|
1 | | -import { getDiagram } from './diagram.importer'; |
| 1 | +// eslint-disable-next-line @stylistic/max-len |
| 2 | +/* eslint-disable @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-unused-vars */ |
| 3 | +import { getDiagram } from '@ts/ui/diagram/diagram.importer'; |
2 | 4 |
|
3 | 5 | class DiagramBar { |
4 | | - constructor(owner) { |
5 | | - const { EventDispatcher } = getDiagram(); |
6 | | - this.onChanged = new EventDispatcher(); // IBar.onChanged: EventDispatcher<IBarListener> |
7 | | - this._owner = owner; |
8 | | - } |
9 | | - raiseBarCommandExecuted(key, parameter) { |
10 | | - this.onChanged.raise('notifyBarCommandExecuted', parseInt(key), parameter); |
11 | | - } |
12 | | - |
13 | | - getCommandKeys() { // IBar.getCommandKeys(): DiagramCommand[] |
14 | | - throw 'Not Implemented'; |
15 | | - } |
16 | | - setItemValue(key, value) { // IBar.setItemValue(key: DiagramCommand, value: any) |
17 | | - } |
18 | | - setItemEnabled(key, enabled) { // IBar.setItemEnabled(key: DiagramCommand, enabled: boolean) |
19 | | - } |
20 | | - setItemVisible(key, enabled) { // IBar.setItemVisible(key: DiagramCommand, visible: boolean) |
21 | | - } |
22 | | - setEnabled(enabled) { // IBar.setEnabled(enabled: boolean) |
23 | | - } |
24 | | - setItemSubItems(key, items) { // IBar.setItemSubItems(key: DiagramCommand, items: any[]) |
25 | | - } |
26 | | - isVisible() { // IBar.isVisible(): boolean |
27 | | - return true; |
28 | | - } |
29 | | - |
30 | | - _getKeys(items) { |
31 | | - const keys = items.reduce((commands, item) => { |
32 | | - if(item.command !== undefined) { |
33 | | - commands.push(item.command); |
34 | | - } |
35 | | - if(item.items) { |
36 | | - commands = commands.concat(this._getKeys(item.items)); |
37 | | - } |
38 | | - return commands; |
39 | | - }, []); |
40 | | - return keys; |
41 | | - } |
| 6 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 7 | + onChanged: any; |
| 8 | + |
| 9 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 10 | + _owner: any; |
| 11 | + |
| 12 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 13 | + constructor(owner: any) { |
| 14 | + const { EventDispatcher } = getDiagram(); |
| 15 | + this.onChanged = new EventDispatcher(); // IBar.onChanged: EventDispatcher<IBarListener> |
| 16 | + this._owner = owner; |
| 17 | + } |
| 18 | + |
| 19 | + raiseBarCommandExecuted(key, parameter): void { |
| 20 | + this.onChanged.raise('notifyBarCommandExecuted', parseInt(key, 10), parameter); |
| 21 | + } |
| 22 | + |
| 23 | + getCommandKeys(): void { |
| 24 | + // IBar.getCommandKeys(): DiagramCommand[] |
| 25 | + throw 'Not Implemented'; |
| 26 | + } |
| 27 | + |
| 28 | + setItemValue(key, value): void { |
| 29 | + // IBar.setItemValue(key: DiagramCommand, value: any) |
| 30 | + } |
| 31 | + |
| 32 | + setItemEnabled(key, enabled): void { |
| 33 | + // IBar.setItemEnabled(key: DiagramCommand, enabled: boolean) |
| 34 | + } |
| 35 | + |
| 36 | + setItemVisible(key, enabled): void { |
| 37 | + // IBar.setItemVisible(key: DiagramCommand, visible: boolean) |
| 38 | + } |
| 39 | + |
| 40 | + setEnabled(enabled): void { |
| 41 | + // IBar.setEnabled(enabled: boolean) |
| 42 | + } |
| 43 | + |
| 44 | + setItemSubItems(key, items): void { |
| 45 | + // IBar.setItemSubItems(key: DiagramCommand, items: any[]) |
| 46 | + } |
| 47 | + |
| 48 | + isVisible(): boolean { |
| 49 | + // IBar.isVisible(): boolean |
| 50 | + return true; |
| 51 | + } |
| 52 | + |
| 53 | + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type |
| 54 | + _getKeys(items) { |
| 55 | + const keys = items.reduce((commands, item) => { |
| 56 | + if (item.command !== undefined) { |
| 57 | + commands.push(item.command); |
| 58 | + } |
| 59 | + if (item.items) { |
| 60 | + // eslint-disable-next-line no-param-reassign |
| 61 | + commands = commands.concat(this._getKeys(item.items)); |
| 62 | + } |
| 63 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-return |
| 64 | + return commands; |
| 65 | + }, []); |
| 66 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-return |
| 67 | + return keys; |
| 68 | + } |
42 | 69 | } |
43 | 70 |
|
44 | 71 | export default DiagramBar; |
0 commit comments