@wcardinal/wcardinal-ui 0.359.0 → 0.362.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/types/wcardinal/ui/d-diagram-editor.d.ts +13 -1
  2. package/dist/types/wcardinal/ui/d-dialog-select.d.ts +10 -10
  3. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.d.ts +1 -0
  4. package/dist/types/wcardinal/ui/theme/white/d-theme-white-diagram-editor.d.ts +1 -0
  5. package/dist/types/wcardinal/ui/util/index.d.ts +1 -0
  6. package/dist/types/wcardinal/ui/util/to-label-with.d.ts +1 -0
  7. package/dist/wcardinal/ui/d-diagram-canvas-editor.js +1 -0
  8. package/dist/wcardinal/ui/d-diagram-canvas-editor.js.map +1 -1
  9. package/dist/wcardinal/ui/d-diagram-editor.js +10 -5
  10. package/dist/wcardinal/ui/d-diagram-editor.js.map +1 -1
  11. package/dist/wcardinal/ui/d-dialog-select.js +28 -14
  12. package/dist/wcardinal/ui/d-dialog-select.js.map +1 -1
  13. package/dist/wcardinal/ui/d-select.js +4 -10
  14. package/dist/wcardinal/ui/d-select.js.map +1 -1
  15. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js +3 -0
  16. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js.map +1 -1
  17. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js +2 -2
  18. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js.map +1 -1
  19. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js +3 -0
  20. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js.map +1 -1
  21. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js +2 -2
  22. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js.map +1 -1
  23. package/dist/wcardinal/ui/util/index.js +1 -0
  24. package/dist/wcardinal/ui/util/index.js.map +1 -1
  25. package/dist/wcardinal/ui/util/to-label-with.js +27 -0
  26. package/dist/wcardinal/ui/util/to-label-with.js.map +1 -0
  27. package/dist/wcardinal/ui/util/to-label.js +2 -20
  28. package/dist/wcardinal/ui/util/to-label.js.map +1 -1
  29. package/dist/wcardinal-ui-theme-dark.js +7 -2
  30. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  31. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  32. package/dist/wcardinal-ui-theme-white.js +7 -2
  33. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  34. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  35. package/dist/wcardinal-ui.cjs.js +62 -34
  36. package/dist/wcardinal-ui.js +54 -32
  37. package/dist/wcardinal-ui.min.js +2 -2
  38. package/dist/wcardinal-ui.min.js.map +1 -1
  39. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { DColorAndAlpha } from "./d-color-and-alpha";
1
2
  import { DControllerDocument } from "./d-controller-document";
2
3
  import { DDiagramBase, DDiagramBaseEvents, DDiagramBaseOptions, DThemeDiagramBase } from "./d-diagram-base";
3
4
  import { DDiagramCanvasEditor, DDiagramCanvasEditorOptions } from "./d-diagram-canvas-editor";
@@ -88,10 +89,21 @@ export interface DDiagramEditorOptions<THEME extends DThemeDiagramEditor = DThem
88
89
  mapping?: boolean;
89
90
  snapper?: ESnapperOptions;
90
91
  }
92
+ export interface DDiagramEditorCreateOptions {
93
+ name: string;
94
+ label?: string;
95
+ width: number;
96
+ height: number;
97
+ category?: string | null;
98
+ summary?: string;
99
+ description?: string;
100
+ background?: DColorAndAlpha;
101
+ }
91
102
  /**
92
103
  * {@link DDiagramEditor} theme.
93
104
  */
94
105
  export interface DThemeDiagramEditor extends DThemeDiagramBase, DThemeDiagramEditorThumbnail, EThemeSnapper {
106
+ getBaseLayerLabel(): string;
95
107
  }
96
108
  export declare class DDiagramEditor<THEME extends DThemeDiagramEditor = DThemeDiagramEditor, OPTIONS extends DDiagramEditorOptions<THEME> = DDiagramEditorOptions<THEME>> extends DDiagramBase<DDiagramCanvasEditor, DDiagramCanvasEditorOptions, DDiagramEditorController, THEME, OPTIONS> implements DControllerDocument<DDiagramSerialized> {
97
109
  protected _isChanged: boolean;
@@ -107,7 +119,7 @@ export declare class DDiagramEditor<THEME extends DThemeDiagramEditor = DThemeDi
107
119
  save(): Promise<unknown>;
108
120
  saveAs(name: string): Promise<unknown>;
109
121
  delete(): Promise<unknown>;
110
- create(name: string, width: number, height: number): Promise<DDiagramCanvasEditor>;
122
+ create(options: DDiagramEditorCreateOptions): Promise<DDiagramCanvasEditor>;
111
123
  protected onSet(serialized: DDiagramSerialized, canvas: DDiagramCanvasEditor): void;
112
124
  protected onUnset(): void;
113
125
  open(id: number): Promise<DDiagramCanvasEditor>;
@@ -42,9 +42,9 @@ export interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvent
42
42
  /**
43
43
  * {@link DDialogSelect} category options.
44
44
  */
45
- export interface DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID> extends DSelectOptions<CATEGORY_ID> {
45
+ export interface DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID> extends DSelectOptions<CATEGORY_ID | null> {
46
46
  toId?: (category: CATEGORY) => CATEGORY_ID;
47
- toLabel?: (category: CATEGORY) => string;
47
+ toLabel?: (category: CATEGORY | null) => string;
48
48
  }
49
49
  /**
50
50
  * {@link DDialogSelect} "on" options.
@@ -69,13 +69,13 @@ export interface DDialogSelectOptions<VALUE, CATEGORY = unknown, CATEGORY_ID = u
69
69
  export interface DThemeDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY_ID = unknown> extends DThemeDialogLayered {
70
70
  getInputMargin(): number;
71
71
  toCategoryId(category: CATEGORY): CATEGORY_ID;
72
- toCategoryLabel(category: CATEGORY): string;
72
+ toCategoryLabel(category: CATEGORY | null): string;
73
73
  }
74
74
  export declare class DDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY_ID = unknown, THEME extends DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID> = DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID>, OPTIONS extends DDialogSelectOptions<VALUE, CATEGORY, CATEGORY_ID, THEME> = DDialogSelectOptions<VALUE, CATEGORY, CATEGORY_ID, THEME>> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {
75
75
  protected _value: VALUE | null;
76
76
  protected _spaceLeft?: DLayoutSpace;
77
77
  protected _spaceRight?: DLayoutSpace;
78
- protected _selectCategory?: DSelect<CATEGORY_ID> | null;
78
+ protected _selectCategory?: DSelect<CATEGORY_ID | null> | null;
79
79
  protected _isCategoryFetched?: boolean;
80
80
  protected _input?: DInputSearch;
81
81
  protected _inputLayout?: DLayoutHorizontal;
@@ -91,9 +91,9 @@ export declare class DDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY
91
91
  protected get spaceLeft(): DLayoutSpace;
92
92
  protected get spaceRight(): DLayoutSpace;
93
93
  protected newSpace(): DLayoutSpace;
94
- protected get selectCategory(): DSelect<CATEGORY_ID> | null;
95
- protected newSelectCategory(): DSelect<CATEGORY_ID> | null;
96
- protected toSelectCategoryOptions(theme: THEME, options?: OPTIONS): DSelectOptions<CATEGORY_ID>;
94
+ protected get selectCategory(): DSelect<CATEGORY_ID | null> | null;
95
+ protected newSelectCategory(): DSelect<CATEGORY_ID | null> | null;
96
+ protected toSelectCategoryOptions(theme: THEME, options?: OPTIONS): DSelectOptions<CATEGORY_ID | null>;
97
97
  protected onSelectCategoryChange(categoryId: CATEGORY_ID): void;
98
98
  get input(): DInputSearch;
99
99
  protected newInput(): DInputSearch;
@@ -118,9 +118,9 @@ export declare class DDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY
118
118
  protected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null>;
119
119
  protected getType(): string;
120
120
  protected onOpen(): void;
121
- protected onCategoryFetched(selectCategory: DSelect<CATEGORY_ID>, categories: CATEGORY[]): void;
122
- protected toCategoryId(target: CATEGORY): CATEGORY_ID;
123
- protected toCategoryLabel(target: CATEGORY): string;
121
+ protected onCategoryFetched(selectCategory: DSelect<CATEGORY_ID | null>, categories: CATEGORY[]): void;
122
+ protected newToCategoryId(): (category: CATEGORY) => CATEGORY_ID;
123
+ protected newToCategoryLabel(): (category: CATEGORY | null) => string;
124
124
  protected findCategories(): Promise<CATEGORY[]> | CATEGORY[] | null;
125
125
  protected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void;
126
126
  destroy(): void;
@@ -10,4 +10,5 @@ export declare class DThemeDarkDiagramEditor extends DThemeDarkDiagramBase imple
10
10
  getSnapGridSize(): number;
11
11
  isSnapTargetVisible(): boolean;
12
12
  isSnapTargetEnabled(): boolean;
13
+ getBaseLayerLabel(): string;
13
14
  }
@@ -10,4 +10,5 @@ export declare class DThemeWhiteDiagramEditor extends DThemeWhiteDiagramBase imp
10
10
  getSnapGridSize(): number;
11
11
  isSnapTargetVisible(): boolean;
12
12
  isSnapTargetEnabled(): boolean;
13
+ getBaseLayerLabel(): string;
13
14
  }
@@ -33,6 +33,7 @@ export * from "./to-cloned";
33
33
  export * from "./to-enum";
34
34
  export * from "./to-id";
35
35
  export * from "./to-index-of";
36
+ export * from "./to-label-with";
36
37
  export * from "./to-label";
37
38
  export * from "./to-merged";
38
39
  export * from "./to-padded";
@@ -0,0 +1 @@
1
+ export declare const toLabelWith: (target: any, def: string) => string;
@@ -58,6 +58,7 @@ var DDiagramCanvasEditor = /** @class */ (function (_super) {
58
58
  label: this.label,
59
59
  width: this.width,
60
60
  height: this.height,
61
+ category: this.category,
61
62
  summary: this.summary,
62
63
  description: this.description,
63
64
  background: {
@@ -1 +1 @@
1
- {"version":3,"file":"d-diagram-canvas-editor.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagram-canvas-editor.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EACN,kBAAkB,EAGlB,MAAM,yBAAyB,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B,GA0E3B","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n\tDDiagramCanvasBase,\n\tDDiagramCanvasBaseOptions,\n\tDThemeDiagramCanvasBase\n} from \"./d-diagram-canvas-base\";\nimport { DDiagramCanvasEditorShape } from \"./d-diagram-canvas-editor-shape\";\nimport { DDiagramCanvasEditorShapeImpl } from \"./d-diagram-canvas-editor-shape-impl\";\nimport {\n\tDDiagramCanvasEditorSnap,\n\tDDiagramCanvasEditorSnapOptions,\n\tDThemeDiagramCanvasEditorSnap\n} from \"./d-diagram-canvas-editor-snap\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedItem,\n\tDDiagramSerializedVersion\n} from \"./d-diagram-serialized\";\nimport { EShapeResourceManagerSerialization } from \"./shape/e-shape-resource-manager-serialization\";\nimport { isNumber } from \"./util/is-number\";\n\nexport interface DDiagramCanvasEditorOptions<\n\tTHEME extends DThemeDiagramCanvasEditor = DThemeDiagramCanvasEditor\n> extends DDiagramCanvasBaseOptions<THEME> {\n\tsnap?: DDiagramCanvasEditorSnapOptions;\n}\n\nexport interface DThemeDiagramCanvasEditor\n\textends DThemeDiagramCanvasBase,\n\t\tDThemeDiagramCanvasEditorSnap {}\n\nexport interface DDiagramCanvasEditorThumbnail {\n\tserialize(): string | undefined;\n}\n\nexport class DDiagramCanvasEditor<\n\tTHEME extends DThemeDiagramCanvasEditor = DThemeDiagramCanvasEditor,\n\tOPTIONS extends DDiagramCanvasEditorOptions<THEME> = DDiagramCanvasEditorOptions<THEME>\n> extends DDiagramCanvasBase<THEME, OPTIONS> {\n\tprotected _shape?: DDiagramCanvasEditorShape;\n\tprotected _snap: DDiagramCanvasEditorSnap | null;\n\n\tconstructor(options: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._snap = this.toSnap(this.theme, options.snap);\n\t}\n\n\tprotected toSnap(\n\t\ttheme: THEME,\n\t\toptions?: DDiagramCanvasEditorSnapOptions\n\t): DDiagramCanvasEditorSnap | null {\n\t\tif (options) {\n\t\t\treturn new DDiagramCanvasEditorSnap(this, theme, options);\n\t\t}\n\t\treturn null;\n\t}\n\n\tget snap(): DDiagramCanvasEditorSnap | null {\n\t\treturn this._snap;\n\t}\n\n\tget shape(): DDiagramCanvasEditorShape {\n\t\tlet result = this._shape;\n\t\tif (result == null) {\n\t\t\tresult = this.newShape();\n\t\t\tthis._shape = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newShape(): DDiagramCanvasEditorShape {\n\t\treturn new DDiagramCanvasEditorShapeImpl(this);\n\t}\n\n\tserialize(id?: number, thumbnail?: DDiagramCanvasEditorThumbnail): DDiagramSerialized {\n\t\tconst manager = new EShapeResourceManagerSerialization();\n\t\tconst items: DDiagramSerializedItem[] = [];\n\t\tconst background = this._background;\n\t\tconst backgroundColor = background.color;\n\t\tconst backgroundAlpha = background.alpha;\n\t\treturn {\n\t\t\tversion: DDiagramSerializedVersion,\n\t\t\tid,\n\t\t\tname: this.name,\n\t\t\tlabel: this.label,\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tsummary: this.summary,\n\t\t\tdescription: this.description,\n\t\t\tbackground: {\n\t\t\t\tcolor: isNumber(backgroundColor) ? backgroundColor : 0xffffff,\n\t\t\t\talpha: isNumber(backgroundAlpha) ? backgroundAlpha : 0\n\t\t\t},\n\t\t\ttile: this._tile.serialize(),\n\t\t\tresources: manager.resources,\n\t\t\tdata: manager.data,\n\t\t\tpieces: manager.pieces,\n\t\t\tlayers: this._layer.serialize(manager, items),\n\t\t\titems,\n\t\t\tsnap: this._snap?.serialize(),\n\t\t\tthumbnail: thumbnail?.serialize()\n\t\t};\n\t}\n\n\tonReflow(): void {\n\t\tsuper.onReflow();\n\t\tthis._snap?.onReflow();\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDiagramCanvasEditor\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-diagram-canvas-editor.js","sourceRoot":"","sources":["../../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AAI,CAAC,KAAK,0CAAE,QAAQ,EAAE,CAAC;IACxB,CAAC;IAES,sCAAO,GAAjB;QACC,OAAO,sBAAsB,CAAC;IAC/B,CAAC;IACF,2BAAC;AAAD,CAAC,AA9ED,CAGU,kBAAkB,GA2E3B","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n\tDDiagramCanvasBase,\n\tDDiagramCanvasBaseOptions,\n\tDThemeDiagramCanvasBase\n} from \"./d-diagram-canvas-base\";\nimport { DDiagramCanvasEditorShape } from \"./d-diagram-canvas-editor-shape\";\nimport { DDiagramCanvasEditorShapeImpl } from \"./d-diagram-canvas-editor-shape-impl\";\nimport {\n\tDDiagramCanvasEditorSnap,\n\tDDiagramCanvasEditorSnapOptions,\n\tDThemeDiagramCanvasEditorSnap\n} from \"./d-diagram-canvas-editor-snap\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedItem,\n\tDDiagramSerializedVersion\n} from \"./d-diagram-serialized\";\nimport { EShapeResourceManagerSerialization } from \"./shape/e-shape-resource-manager-serialization\";\nimport { isNumber } from \"./util/is-number\";\n\nexport interface DDiagramCanvasEditorOptions<\n\tTHEME extends DThemeDiagramCanvasEditor = DThemeDiagramCanvasEditor\n> extends DDiagramCanvasBaseOptions<THEME> {\n\tsnap?: DDiagramCanvasEditorSnapOptions;\n}\n\nexport interface DThemeDiagramCanvasEditor\n\textends DThemeDiagramCanvasBase,\n\t\tDThemeDiagramCanvasEditorSnap {}\n\nexport interface DDiagramCanvasEditorThumbnail {\n\tserialize(): string | undefined;\n}\n\nexport class DDiagramCanvasEditor<\n\tTHEME extends DThemeDiagramCanvasEditor = DThemeDiagramCanvasEditor,\n\tOPTIONS extends DDiagramCanvasEditorOptions<THEME> = DDiagramCanvasEditorOptions<THEME>\n> extends DDiagramCanvasBase<THEME, OPTIONS> {\n\tprotected _shape?: DDiagramCanvasEditorShape;\n\tprotected _snap: DDiagramCanvasEditorSnap | null;\n\n\tconstructor(options: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._snap = this.toSnap(this.theme, options.snap);\n\t}\n\n\tprotected toSnap(\n\t\ttheme: THEME,\n\t\toptions?: DDiagramCanvasEditorSnapOptions\n\t): DDiagramCanvasEditorSnap | null {\n\t\tif (options) {\n\t\t\treturn new DDiagramCanvasEditorSnap(this, theme, options);\n\t\t}\n\t\treturn null;\n\t}\n\n\tget snap(): DDiagramCanvasEditorSnap | null {\n\t\treturn this._snap;\n\t}\n\n\tget shape(): DDiagramCanvasEditorShape {\n\t\tlet result = this._shape;\n\t\tif (result == null) {\n\t\t\tresult = this.newShape();\n\t\t\tthis._shape = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newShape(): DDiagramCanvasEditorShape {\n\t\treturn new DDiagramCanvasEditorShapeImpl(this);\n\t}\n\n\tserialize(id?: number, thumbnail?: DDiagramCanvasEditorThumbnail): DDiagramSerialized {\n\t\tconst manager = new EShapeResourceManagerSerialization();\n\t\tconst items: DDiagramSerializedItem[] = [];\n\t\tconst background = this._background;\n\t\tconst backgroundColor = background.color;\n\t\tconst backgroundAlpha = background.alpha;\n\t\treturn {\n\t\t\tversion: DDiagramSerializedVersion,\n\t\t\tid,\n\t\t\tname: this.name,\n\t\t\tlabel: this.label,\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tcategory: this.category,\n\t\t\tsummary: this.summary,\n\t\t\tdescription: this.description,\n\t\t\tbackground: {\n\t\t\t\tcolor: isNumber(backgroundColor) ? backgroundColor : 0xffffff,\n\t\t\t\talpha: isNumber(backgroundAlpha) ? backgroundAlpha : 0\n\t\t\t},\n\t\t\ttile: this._tile.serialize(),\n\t\t\tresources: manager.resources,\n\t\t\tdata: manager.data,\n\t\t\tpieces: manager.pieces,\n\t\t\tlayers: this._layer.serialize(manager, items),\n\t\t\titems,\n\t\t\tsnap: this._snap?.serialize(),\n\t\t\tthumbnail: thumbnail?.serialize()\n\t\t};\n\t}\n\n\tonReflow(): void {\n\t\tsuper.onReflow();\n\t\tthis._snap?.onReflow();\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDiagramCanvasEditor\";\n\t}\n}\n"]}
@@ -167,16 +167,21 @@ var DDiagramEditor = /** @class */ (function (_super) {
167
167
  this.emit("deleted", null, this);
168
168
  return Promise.resolve(null);
169
169
  };
170
- DDiagramEditor.prototype.create = function (name, width, height) {
170
+ DDiagramEditor.prototype.create = function (options) {
171
171
  return this.set({
172
172
  version: DDiagramSerializedVersion,
173
173
  id: undefined,
174
- name: name,
175
- width: width,
176
- height: height,
174
+ name: options.name,
175
+ label: options.label,
176
+ width: options.width,
177
+ height: options.height,
178
+ category: options.category,
179
+ summary: options.summary,
180
+ description: options.description,
181
+ background: options.background,
177
182
  resources: [],
178
183
  data: [],
179
- layers: [["Default layer"]],
184
+ layers: [[this.theme.getBaseLayerLabel()]],
180
185
  items: [],
181
186
  snap: undefined
182
187
  });
@@ -1 +1 @@
1
- {"version":3,"file":"d-diagram-editor.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagram-editor.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACN,YAAY,EAIZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAA+B,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EACN,uBAAuB,EAGvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGN,yBAAyB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,wCAAwC,EAAE,MAAM,uDAAuD,CAAC;AACjH,OAAO,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AAgH/E;IAIS,kCAMP;IAOD,wBAAY,OAAiB;QAA7B,YACC,kBAAM,OAAO,CAAC,SAcd;QAnBS,gBAAU,G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AAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAI,CAAC,CAAC;gBAClC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC,CACD,CAAC;SACF;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,8BAAK,GAAL;QACC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,kCAAS,GAAT;QACC,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,8BAAK,GAAL;QACC,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,UAAU,IAAI,IAAI,EAAE;YACvB,OAAO,UAAU,CAAC,EAAE,IAAI,IAAI,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,gCAAO,GAAP;QACC,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,UAAU,IAAI,IAAI,EAAE;YACvB,OAAO,UAAU,CAAC,IAAI,CAAC;SACvB;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAES,gCAAO,GAAjB;QACC,OAAO,gBAAgB,CAAC;IACzB,CAAC;IACF,qBAAC;AAAD,CAAC,AA3QD,CAIS,YAAY,GAuQpB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DControllerDocument } from \"./d-controller-document\";\nimport { DControllers } from \"./d-controllers\";\nimport {\n\tDDiagramBase,\n\tDDiagramBaseEvents,\n\tDDiagramBaseOptions,\n\tDThemeDiagramBase\n} from \"./d-diagram-base\";\nimport { DDiagramCanvasEditor, DDiagramCanvasEditorOptions } from \"./d-diagram-canvas-editor\";\nimport { DDiagramEditorController } from \"./d-diagram-editor-controller\";\nimport {\n\tDDiagramEditorThumbnail,\n\tDDiagramEditorThumbnailOptions,\n\tDThemeDiagramEditorThumbnail\n} from \"./d-diagram-editor-thumbnail\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedSimple,\n\tDDiagramSerializedVersion\n} from \"./d-diagram-serialized\";\nimport { DDiagrams } from \"./d-diagrams\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { EShapeResourceManagerDeserializationMode } from \"./shape/e-shape-resource-manager-deserialization-mode\";\nimport { ESnapper, ESnapperOptions, EThemeSnapper } from \"./snapper/e-snapper\";\n\n/**\n * {@link DDiagramEditor} events.\n */\nexport interface DDiagramEditorEvents<EMITTER>\n\textends DDiagramBaseEvents<DDiagramCanvasEditor, EMITTER> {\n\t/**\n\t * Triggered when a serialized data is changed without using the set / unset methods.\n\t * This happens, for instance, when the name or the ID of the serialized data is changed.\n\t *\n\t * @param emitter an emitter\n\t */\n\tchange(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before serializing a canvas.\n\t *\n\t * @param canvas a canvas\n\t * @param emitter an emitter\n\t */\n\tserializing(canvas: DDiagramCanvasEditor, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when serialized successfully or when failed to serialize.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\tserialized(canvas: DDiagramCanvasEditor, reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before saving.\n\t *\n\t * @param simple a serialized data\n\t * @param emitter an emitter\n\t */\n\tsaving(simple: DDiagramSerializedSimple, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when saved successfully or when failed to save.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\tsaved(reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before opening.\n\t *\n\t * @param emitter an emitter\n\t */\n\topening(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when opened successfully or when failed to open.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\topened(reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before deleting.\n\t *\n\t * @param emitter an emitter\n\t */\n\tdeleting(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when deleted successfully or when failed to delete.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter.\n\t */\n\tdeleted(reason: string | null, emitter: EMITTER): void;\n}\n\n/**\n * {@link DDiagramEditor} \"on\" options.\n */\nexport interface DDiagramEditorOnOptions<EMITTER>\n\textends Partial<DDiagramEditorEvents<EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDiagramEditor} options.\n */\nexport interface DDiagramEditorOptions<\n\tTHEME extends DThemeDiagramEditor = DThemeDiagramEditor,\n\tEMITTER = any\n> extends DDiagramBaseOptions<\n\t\tDDiagramCanvasEditor,\n\t\tDDiagramCanvasEditorOptions,\n\t\tDDiagramEditorController,\n\t\tTHEME\n\t> {\n\tcontroller?: DDiagramEditorController;\n\ton?: DDiagramEditorOnOptions<EMITTER>;\n\tthumbnail?: DDiagramEditorThumbnailOptions;\n\tmapping?: boolean;\n\tsnapper?: ESnapperOptions;\n}\n\n/**\n * {@link DDiagramEditor} theme.\n */\nexport interface DThemeDiagramEditor\n\textends DThemeDiagramBase,\n\t\tDThemeDiagramEditorThumbnail,\n\t\tEThemeSnapper {}\n\nexport class DDiagramEditor<\n\t\tTHEME extends DThemeDiagramEditor = DThemeDiagramEditor,\n\t\tOPTIONS extends DDiagramEditorOptions<THEME> = DDiagramEditorOptions<THEME>\n\t>\n\textends DDiagramBase<\n\t\tDDiagramCanvasEditor,\n\t\tDDiagramCanvasEditorOptions,\n\t\tDDiagramEditorController,\n\t\tTHEME,\n\t\tOPTIONS\n\t>\n\timplements DControllerDocument<DDiagramSerialized>\n{\n\tprotected _isChanged: boolean = false;\n\tprotected _snapper: ESnapper;\n\tprotected _thumbnail: DDiagramEditorThumbnail;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._isChanged = false;\n\n\t\tconst commands = DControllers.getCommandController();\n\t\tcommands.on(\"dirty\", (): void => {\n\t\t\tif (this._isChanged !== true) {\n\t\t\t\tthis._isChanged = true;\n\t\t\t\tthis.emit(\"change\", this);\n\t\t\t}\n\t\t});\n\n\t\tconst theme = this.theme;\n\t\tthis._snapper = new ESnapper(this, theme, options?.snapper);\n\t\tthis._thumbnail = new DDiagramEditorThumbnail(this._snapshot, theme, options?.thumbnail);\n\t}\n\n\tget thumbnail(): DDiagramEditorThumbnail {\n\t\treturn this._thumbnail;\n\t}\n\n\tget snapper(): ESnapper {\n\t\treturn this._snapper;\n\t}\n\n\tprotected toMode(options?: OPTIONS): EShapeResourceManagerDeserializationMode {\n\t\tif (options?.mapping) {\n\t\t\treturn EShapeResourceManagerDeserializationMode.EDITOR_DATA_MAPPED;\n\t\t}\n\t\treturn EShapeResourceManagerDeserializationMode.EDITOR;\n\t}\n\n\tprotected newCanvas(serialized: DDiagramSerialized): DDiagramCanvasEditor {\n\t\treturn new DDiagramCanvasEditor(this.toCanvasOptions(serialized));\n\t}\n\n\tprotected toCanvasOptions(serialized: DDiagramSerialized): DDiagramCanvasEditorOptions {\n\t\tconst options: DDiagramCanvasEditorOptions = this.toCanvasBaseOptions(serialized);\n\n\t\t// Snapper\n\t\tconst snapper = this._snapper;\n\t\tconst snap = options.snap;\n\t\tif (snap == null) {\n\t\t\toptions.snap = {\n\t\t\t\tcontroller: snapper\n\t\t\t};\n\t\t} else if (snap.controller == null) {\n\t\t\tsnap.controller = snapper;\n\t\t}\n\n\t\treturn options;\n\t}\n\n\tserialize(): DDiagramSerialized | null {\n\t\tconst canvas = this.canvas;\n\t\tconst serialized = this._serialized;\n\t\tif (canvas != null && serialized != null) {\n\t\t\tthis.emit(\"serializing\", canvas, this);\n\t\t\ttry {\n\t\t\t\tconst result = canvas.serialize(serialized.id, this._thumbnail);\n\t\t\t\tthis.emit(\"serialized\", canvas, null, this);\n\t\t\t\treturn result;\n\t\t\t} catch (e) {\n\t\t\t\tthis.emit(\"serialized\", canvas, \"exception\", this);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tsave(): Promise<unknown> {\n\t\tconst serialized = this.serialize();\n\t\tif (serialized != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tconst simple = DDiagrams.toSimple(serialized);\n\t\t\t\tthis.emit(\"saving\", simple, this);\n\t\t\t\treturn controller.save(simple).then(\n\t\t\t\t\t(newId: number): void => {\n\t\t\t\t\t\tthis._isChanged = false;\n\t\t\t\t\t\tserialized.id = newId;\n\t\t\t\t\t\tthis._serialized = serialized;\n\t\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t\t\tthis.emit(\"saved\", null, this);\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string): void => {\n\t\t\t\t\t\tthis.emit(\"saved\", reason, this);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"saved\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject();\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"saved\", null, this);\n\t\treturn Promise.resolve();\n\t}\n\n\tsaveAs(name: string): Promise<unknown> {\n\t\tconst serialized = this.serialize();\n\t\tif (serialized != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tserialized.id = undefined;\n\t\t\t\tserialized.name = name;\n\t\t\t\tconst simple = DDiagrams.toSimple(serialized);\n\t\t\t\tthis.emit(\"saving\", simple, this);\n\t\t\t\treturn controller.save(simple).then(\n\t\t\t\t\t(newId: number): void => {\n\t\t\t\t\t\tthis._isChanged = false;\n\t\t\t\t\t\tserialized.id = newId;\n\t\t\t\t\t\tthis._serialized = serialized;\n\t\t\t\t\t\tconst canvas = this.canvas;\n\t\t\t\t\t\tif (canvas != null) {\n\t\t\t\t\t\t\tcanvas.name = name;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t\t\tthis.emit(\"saved\", null, this);\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string): void => {\n\t\t\t\t\t\tthis.emit(\"saved\", reason, this);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"saved\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject(\"no-controller\");\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"saved\", null, this);\n\t\treturn Promise.resolve();\n\t}\n\n\tdelete(): Promise<unknown> {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized && serialized.id != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tthis.emit(\"deleting\", this);\n\t\t\t\treturn controller.delete(serialized.id).then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tconst result = this.set(null);\n\t\t\t\t\t\tthis.emit(\"deleted\", null, this);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string) => {\n\t\t\t\t\t\tthis.emit(\"deleted\", reason, this);\n\t\t\t\t\t\treturn Promise.reject(reason);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"deleted\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject(\"no-controller\");\n\t\t\t}\n\t\t}\n\t\tthis.set(null);\n\t\tthis.emit(\"deleted\", null, this);\n\t\treturn Promise.resolve(null);\n\t}\n\n\tcreate(name: string, width: number, height: number): Promise<DDiagramCanvasEditor> {\n\t\treturn this.set({\n\t\t\tversion: DDiagramSerializedVersion,\n\t\t\tid: undefined,\n\t\t\tname,\n\t\t\twidth,\n\t\t\theight,\n\t\t\tresources: [],\n\t\t\tdata: [],\n\t\t\tlayers: [[\"Default layer\"]],\n\t\t\titems: [],\n\t\t\tsnap: undefined\n\t\t});\n\t}\n\n\tprotected onSet(serialized: DDiagramSerialized, canvas: DDiagramCanvasEditor): void {\n\t\tsuper.onSet(serialized, canvas);\n\n\t\t// Snap settings\n\t\tconst snap = serialized.snap;\n\t\tconst snapper = this._snapper;\n\t\tif (snap != null) {\n\t\t\tsnapper.deserialize(snap);\n\t\t} else {\n\t\t\tsnapper.reset();\n\t\t}\n\t\tif (this._isAmbient) {\n\t\t\tsnapper.target.visible = false;\n\t\t\tsnapper.grid.visible = false;\n\t\t}\n\n\t\t// Reset the isChanged flag\n\t\tthis._isChanged = false;\n\n\t\t// Done\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tprotected onUnset(): void {\n\t\tsuper.onUnset();\n\t\tthis._isChanged = false;\n\t\tthis.emit(\"change\", this);\n\t}\n\n\topen(id: number): Promise<DDiagramCanvasEditor> {\n\t\tconst controller = this._controller;\n\t\tif (controller) {\n\t\t\tthis.emit(\"opening\", this);\n\t\t\treturn controller.get(id).then(\n\t\t\t\t(serialized: DDiagramSerializedSimple | DDiagramSerialized) => {\n\t\t\t\t\tconst result = this.set(DDiagrams.toSerialized(serialized));\n\t\t\t\t\tthis.emit(\"opened\", null, this);\n\t\t\t\t\treturn result;\n\t\t\t\t},\n\t\t\t\t(reason: string) => {\n\t\t\t\t\tthis.emit(\"opened\", reason, this);\n\t\t\t\t\treturn Promise.reject(reason);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tthis.emit(\"opened\", \"no-controller\", this);\n\t\treturn Promise.reject(\"no-controller\");\n\t}\n\n\tclose(): Promise<unknown> {\n\t\treturn this.set(null);\n\t}\n\n\tisChanged(): boolean {\n\t\treturn this._isChanged || this.isNew();\n\t}\n\n\tisNew(): boolean {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized != null) {\n\t\t\treturn serialized.id == null;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetName(): string | null {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized != null) {\n\t\t\treturn serialized.name;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDiagramEditor\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-diagram-editor.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagram-editor.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACN,YAAY,EAIZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAA+B,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EACN,uBAAuB,EAGvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGN,yBAAyB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,wCAAwC,EAAE,MAAM,uDAAuD,CAAC;AACjH,OAAO,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AA6H/E;IAIS,kCAMP;IAOD,wBAAY,OAAiB;QAA7B,YACC,kBAAM,OAAO,CAAC,SAcd;QAnBS,gBAAU,GAAY,KAAK,CAAC;QAMrC,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAExB,IAAM,QAAQ,GAAG,YAAY,CAAC,oBAAoB,EAAE,CAAC;QACrD,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;YACpB,IAAI,KAAI,CAAC,UAAU,KAAK,IAAI,EAAE;gBAC7B,KAAI,CAAC,UAAU,GAAG,IAAI,CAAC;gBACvB,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QAEH,IAAM,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC;QACzB,KAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,KAAI,EAAE,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,O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AAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAED,8BAAK,GAAL;QACC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,kCAAS,GAAT;QACC,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,8BAAK,GAAL;QACC,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,UAAU,IAAI,IAAI,EAAE;YACvB,OAAO,UAAU,CAAC,EAAE,IAAI,IAAI,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED,gCAAO,GAAP;QACC,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,UAAU,IAAI,IAAI,EAAE;YACvB,OAAO,UAAU,CAAC,IAAI,CAAC;SACvB;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAES,gCAAO,GAAjB;QACC,OAAO,gBAAgB,CAAC;IACzB,CAAC;IACF,qBAAC;AAAD,CAAC,AAhRD,CAIS,YAAY,GA4QpB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DColorAndAlpha } from \"./d-color-and-alpha\";\nimport { DControllerDocument } from \"./d-controller-document\";\nimport { DControllers } from \"./d-controllers\";\nimport {\n\tDDiagramBase,\n\tDDiagramBaseEvents,\n\tDDiagramBaseOptions,\n\tDThemeDiagramBase\n} from \"./d-diagram-base\";\nimport { DDiagramCanvasEditor, DDiagramCanvasEditorOptions } from \"./d-diagram-canvas-editor\";\nimport { DDiagramEditorController } from \"./d-diagram-editor-controller\";\nimport {\n\tDDiagramEditorThumbnail,\n\tDDiagramEditorThumbnailOptions,\n\tDThemeDiagramEditorThumbnail\n} from \"./d-diagram-editor-thumbnail\";\nimport {\n\tDDiagramSerialized,\n\tDDiagramSerializedSimple,\n\tDDiagramSerializedVersion\n} from \"./d-diagram-serialized\";\nimport { DDiagrams } from \"./d-diagrams\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { EShapeResourceManagerDeserializationMode } from \"./shape/e-shape-resource-manager-deserialization-mode\";\nimport { ESnapper, ESnapperOptions, EThemeSnapper } from \"./snapper/e-snapper\";\n\n/**\n * {@link DDiagramEditor} events.\n */\nexport interface DDiagramEditorEvents<EMITTER>\n\textends DDiagramBaseEvents<DDiagramCanvasEditor, EMITTER> {\n\t/**\n\t * Triggered when a serialized data is changed without using the set / unset methods.\n\t * This happens, for instance, when the name or the ID of the serialized data is changed.\n\t *\n\t * @param emitter an emitter\n\t */\n\tchange(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before serializing a canvas.\n\t *\n\t * @param canvas a canvas\n\t * @param emitter an emitter\n\t */\n\tserializing(canvas: DDiagramCanvasEditor, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when serialized successfully or when failed to serialize.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\tserialized(canvas: DDiagramCanvasEditor, reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before saving.\n\t *\n\t * @param simple a serialized data\n\t * @param emitter an emitter\n\t */\n\tsaving(simple: DDiagramSerializedSimple, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when saved successfully or when failed to save.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\tsaved(reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before opening.\n\t *\n\t * @param emitter an emitter\n\t */\n\topening(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when opened successfully or when failed to open.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter\n\t */\n\topened(reason: string | null, emitter: EMITTER): void;\n\n\t/**\n\t * Triggered before deleting.\n\t *\n\t * @param emitter an emitter\n\t */\n\tdeleting(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when deleted successfully or when failed to delete.\n\t *\n\t * @param reason Null if succeeded. Otherwise, a string representing a reason why failed.\n\t * @param emitter an emitter.\n\t */\n\tdeleted(reason: string | null, emitter: EMITTER): void;\n}\n\n/**\n * {@link DDiagramEditor} \"on\" options.\n */\nexport interface DDiagramEditorOnOptions<EMITTER>\n\textends Partial<DDiagramEditorEvents<EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDiagramEditor} options.\n */\nexport interface DDiagramEditorOptions<\n\tTHEME extends DThemeDiagramEditor = DThemeDiagramEditor,\n\tEMITTER = any\n> extends DDiagramBaseOptions<\n\t\tDDiagramCanvasEditor,\n\t\tDDiagramCanvasEditorOptions,\n\t\tDDiagramEditorController,\n\t\tTHEME\n\t> {\n\tcontroller?: DDiagramEditorController;\n\ton?: DDiagramEditorOnOptions<EMITTER>;\n\tthumbnail?: DDiagramEditorThumbnailOptions;\n\tmapping?: boolean;\n\tsnapper?: ESnapperOptions;\n}\n\nexport interface DDiagramEditorCreateOptions {\n\tname: string;\n\tlabel?: string;\n\twidth: number;\n\theight: number;\n\tcategory?: string | null;\n\tsummary?: string;\n\tdescription?: string;\n\tbackground?: DColorAndAlpha;\n}\n\n/**\n * {@link DDiagramEditor} theme.\n */\nexport interface DThemeDiagramEditor\n\textends DThemeDiagramBase,\n\t\tDThemeDiagramEditorThumbnail,\n\t\tEThemeSnapper {\n\tgetBaseLayerLabel(): string;\n}\n\nexport class DDiagramEditor<\n\t\tTHEME extends DThemeDiagramEditor = DThemeDiagramEditor,\n\t\tOPTIONS extends DDiagramEditorOptions<THEME> = DDiagramEditorOptions<THEME>\n\t>\n\textends DDiagramBase<\n\t\tDDiagramCanvasEditor,\n\t\tDDiagramCanvasEditorOptions,\n\t\tDDiagramEditorController,\n\t\tTHEME,\n\t\tOPTIONS\n\t>\n\timplements DControllerDocument<DDiagramSerialized>\n{\n\tprotected _isChanged: boolean = false;\n\tprotected _snapper: ESnapper;\n\tprotected _thumbnail: DDiagramEditorThumbnail;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._isChanged = false;\n\n\t\tconst commands = DControllers.getCommandController();\n\t\tcommands.on(\"dirty\", (): void => {\n\t\t\tif (this._isChanged !== true) {\n\t\t\t\tthis._isChanged = true;\n\t\t\t\tthis.emit(\"change\", this);\n\t\t\t}\n\t\t});\n\n\t\tconst theme = this.theme;\n\t\tthis._snapper = new ESnapper(this, theme, options?.snapper);\n\t\tthis._thumbnail = new DDiagramEditorThumbnail(this._snapshot, theme, options?.thumbnail);\n\t}\n\n\tget thumbnail(): DDiagramEditorThumbnail {\n\t\treturn this._thumbnail;\n\t}\n\n\tget snapper(): ESnapper {\n\t\treturn this._snapper;\n\t}\n\n\tprotected toMode(options?: OPTIONS): EShapeResourceManagerDeserializationMode {\n\t\tif (options?.mapping) {\n\t\t\treturn EShapeResourceManagerDeserializationMode.EDITOR_DATA_MAPPED;\n\t\t}\n\t\treturn EShapeResourceManagerDeserializationMode.EDITOR;\n\t}\n\n\tprotected newCanvas(serialized: DDiagramSerialized): DDiagramCanvasEditor {\n\t\treturn new DDiagramCanvasEditor(this.toCanvasOptions(serialized));\n\t}\n\n\tprotected toCanvasOptions(serialized: DDiagramSerialized): DDiagramCanvasEditorOptions {\n\t\tconst options: DDiagramCanvasEditorOptions = this.toCanvasBaseOptions(serialized);\n\n\t\t// Snapper\n\t\tconst snapper = this._snapper;\n\t\tconst snap = options.snap;\n\t\tif (snap == null) {\n\t\t\toptions.snap = {\n\t\t\t\tcontroller: snapper\n\t\t\t};\n\t\t} else if (snap.controller == null) {\n\t\t\tsnap.controller = snapper;\n\t\t}\n\n\t\treturn options;\n\t}\n\n\tserialize(): DDiagramSerialized | null {\n\t\tconst canvas = this.canvas;\n\t\tconst serialized = this._serialized;\n\t\tif (canvas != null && serialized != null) {\n\t\t\tthis.emit(\"serializing\", canvas, this);\n\t\t\ttry {\n\t\t\t\tconst result = canvas.serialize(serialized.id, this._thumbnail);\n\t\t\t\tthis.emit(\"serialized\", canvas, null, this);\n\t\t\t\treturn result;\n\t\t\t} catch (e) {\n\t\t\t\tthis.emit(\"serialized\", canvas, \"exception\", this);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tsave(): Promise<unknown> {\n\t\tconst serialized = this.serialize();\n\t\tif (serialized != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tconst simple = DDiagrams.toSimple(serialized);\n\t\t\t\tthis.emit(\"saving\", simple, this);\n\t\t\t\treturn controller.save(simple).then(\n\t\t\t\t\t(newId: number): void => {\n\t\t\t\t\t\tthis._isChanged = false;\n\t\t\t\t\t\tserialized.id = newId;\n\t\t\t\t\t\tthis._serialized = serialized;\n\t\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t\t\tthis.emit(\"saved\", null, this);\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string): void => {\n\t\t\t\t\t\tthis.emit(\"saved\", reason, this);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"saved\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject();\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"saved\", null, this);\n\t\treturn Promise.resolve();\n\t}\n\n\tsaveAs(name: string): Promise<unknown> {\n\t\tconst serialized = this.serialize();\n\t\tif (serialized != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tserialized.id = undefined;\n\t\t\t\tserialized.name = name;\n\t\t\t\tconst simple = DDiagrams.toSimple(serialized);\n\t\t\t\tthis.emit(\"saving\", simple, this);\n\t\t\t\treturn controller.save(simple).then(\n\t\t\t\t\t(newId: number): void => {\n\t\t\t\t\t\tthis._isChanged = false;\n\t\t\t\t\t\tserialized.id = newId;\n\t\t\t\t\t\tthis._serialized = serialized;\n\t\t\t\t\t\tconst canvas = this.canvas;\n\t\t\t\t\t\tif (canvas != null) {\n\t\t\t\t\t\t\tcanvas.name = name;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t\t\tthis.emit(\"saved\", null, this);\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string): void => {\n\t\t\t\t\t\tthis.emit(\"saved\", reason, this);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"saved\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject(\"no-controller\");\n\t\t\t}\n\t\t}\n\t\tthis.emit(\"saved\", null, this);\n\t\treturn Promise.resolve();\n\t}\n\n\tdelete(): Promise<unknown> {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized && serialized.id != null) {\n\t\t\tconst controller = this._controller;\n\t\t\tif (controller) {\n\t\t\t\tthis.emit(\"deleting\", this);\n\t\t\t\treturn controller.delete(serialized.id).then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tconst result = this.set(null);\n\t\t\t\t\t\tthis.emit(\"deleted\", null, this);\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t},\n\t\t\t\t\t(reason: string) => {\n\t\t\t\t\t\tthis.emit(\"deleted\", reason, this);\n\t\t\t\t\t\treturn Promise.reject(reason);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"deleted\", \"no-controller\", this);\n\t\t\t\treturn Promise.reject(\"no-controller\");\n\t\t\t}\n\t\t}\n\t\tthis.set(null);\n\t\tthis.emit(\"deleted\", null, this);\n\t\treturn Promise.resolve(null);\n\t}\n\n\tcreate(options: DDiagramEditorCreateOptions): Promise<DDiagramCanvasEditor> {\n\t\treturn this.set({\n\t\t\tversion: DDiagramSerializedVersion,\n\t\t\tid: undefined,\n\t\t\tname: options.name,\n\t\t\tlabel: options.label,\n\t\t\twidth: options.width,\n\t\t\theight: options.height,\n\t\t\tcategory: options.category,\n\t\t\tsummary: options.summary,\n\t\t\tdescription: options.description,\n\t\t\tbackground: options.background,\n\t\t\tresources: [],\n\t\t\tdata: [],\n\t\t\tlayers: [[this.theme.getBaseLayerLabel()]],\n\t\t\titems: [],\n\t\t\tsnap: undefined\n\t\t});\n\t}\n\n\tprotected onSet(serialized: DDiagramSerialized, canvas: DDiagramCanvasEditor): void {\n\t\tsuper.onSet(serialized, canvas);\n\n\t\t// Snap settings\n\t\tconst snap = serialized.snap;\n\t\tconst snapper = this._snapper;\n\t\tif (snap != null) {\n\t\t\tsnapper.deserialize(snap);\n\t\t} else {\n\t\t\tsnapper.reset();\n\t\t}\n\t\tif (this._isAmbient) {\n\t\t\tsnapper.target.visible = false;\n\t\t\tsnapper.grid.visible = false;\n\t\t}\n\n\t\t// Reset the isChanged flag\n\t\tthis._isChanged = false;\n\n\t\t// Done\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tprotected onUnset(): void {\n\t\tsuper.onUnset();\n\t\tthis._isChanged = false;\n\t\tthis.emit(\"change\", this);\n\t}\n\n\topen(id: number): Promise<DDiagramCanvasEditor> {\n\t\tconst controller = this._controller;\n\t\tif (controller) {\n\t\t\tthis.emit(\"opening\", this);\n\t\t\treturn controller.get(id).then(\n\t\t\t\t(serialized: DDiagramSerializedSimple | DDiagramSerialized) => {\n\t\t\t\t\tconst result = this.set(DDiagrams.toSerialized(serialized));\n\t\t\t\t\tthis.emit(\"opened\", null, this);\n\t\t\t\t\treturn result;\n\t\t\t\t},\n\t\t\t\t(reason: string) => {\n\t\t\t\t\tthis.emit(\"opened\", reason, this);\n\t\t\t\t\treturn Promise.reject(reason);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tthis.emit(\"opened\", \"no-controller\", this);\n\t\treturn Promise.reject(\"no-controller\");\n\t}\n\n\tclose(): Promise<unknown> {\n\t\treturn this.set(null);\n\t}\n\n\tisChanged(): boolean {\n\t\treturn this._isChanged || this.isNew();\n\t}\n\n\tisNew(): boolean {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized != null) {\n\t\t\treturn serialized.id == null;\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetName(): string | null {\n\t\tconst serialized = this._serialized;\n\t\tif (serialized != null) {\n\t\t\treturn serialized.name;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDiagramEditor\";\n\t}\n}\n"]}
@@ -17,6 +17,7 @@ import { DDialogSelectSearhDismissableImpl } from "./d-dialog-select-search-dism
17
17
  import { DSelect } from "./d-select";
18
18
  import { DMenu } from "./d-menu";
19
19
  import { isArray } from "./util/is-array";
20
+ import { DBaseState } from "./d-base-state";
20
21
  var DDialogSelect = /** @class */ (function (_super) {
21
22
  __extends(DDialogSelect, _super);
22
23
  function DDialogSelect(options) {
@@ -133,6 +134,9 @@ var DDialogSelect = /** @class */ (function (_super) {
133
134
  if (result.width === undefined && result.weight === undefined) {
134
135
  result.width = 140;
135
136
  }
137
+ if (result.state === undefined) {
138
+ result.state = DBaseState.DISABLED;
139
+ }
136
140
  return result;
137
141
  };
138
142
  DDialogSelect.prototype.onSelectCategoryChange = function (categoryId) {
@@ -371,9 +375,7 @@ var DDialogSelect = /** @class */ (function (_super) {
371
375
  this.onCategoryFetched(selectCategory, categoriesOrPromise);
372
376
  }
373
377
  else {
374
- selectCategory.state.isEnabled = false;
375
378
  categoriesOrPromise.then(function (categories) {
376
- selectCategory.state.isEnabled = true;
377
379
  _this.onCategoryFetched(selectCategory, categories);
378
380
  });
379
381
  }
@@ -388,12 +390,20 @@ var DDialogSelect = /** @class */ (function (_super) {
388
390
  };
389
391
  DDialogSelect.prototype.onCategoryFetched = function (selectCategory, categories) {
390
392
  var items = [];
393
+ var toId = this.newToCategoryId();
394
+ var toLabel = this.newToCategoryLabel();
395
+ items.push({
396
+ value: null,
397
+ text: {
398
+ value: toLabel(null)
399
+ }
400
+ });
391
401
  for (var i = 0, imax = categories.length; i < imax; ++i) {
392
402
  var category = categories[i];
393
403
  items.push({
394
- value: this.toCategoryId(category),
404
+ value: toId(category),
395
405
  text: {
396
- value: this.toCategoryLabel(category)
406
+ value: toLabel(category)
397
407
  }
398
408
  });
399
409
  }
@@ -401,36 +411,40 @@ var DDialogSelect = /** @class */ (function (_super) {
401
411
  fit: true,
402
412
  items: items
403
413
  });
404
- var newValue = 0 < items.length ? items[0].value : null;
405
- selectCategory.value = newValue;
406
- selectCategory.show();
407
- this.search.create([this.input.value, newValue]);
414
+ selectCategory.state.isEnabled = true;
415
+ this.search.create([this.input.value, null]);
408
416
  };
409
- DDialogSelect.prototype.toCategoryId = function (target) {
417
+ DDialogSelect.prototype.newToCategoryId = function () {
410
418
  var options = this._options;
411
419
  if (options != null) {
412
420
  var category = options.category;
413
421
  if (category != null) {
414
422
  var toId = category.toId;
415
423
  if (toId != null) {
416
- return toId(target);
424
+ return toId;
417
425
  }
418
426
  }
419
427
  }
420
- return this.theme.toCategoryId(target);
428
+ var theme = this.theme;
429
+ return function (category) {
430
+ return theme.toCategoryId(category);
431
+ };
421
432
  };
422
- DDialogSelect.prototype.toCategoryLabel = function (target) {
433
+ DDialogSelect.prototype.newToCategoryLabel = function () {
423
434
  var options = this._options;
424
435
  if (options != null) {
425
436
  var category = options.category;
426
437
  if (category != null) {
427
438
  var toLabel = category.toLabel;
428
439
  if (toLabel != null) {
429
- return toLabel(target);
440
+ return toLabel;
430
441
  }
431
442
  }
432
443
  }
433
- return this.theme.toCategoryLabel(target);
444
+ var theme = this.theme;
445
+ return function (category) {
446
+ return theme.toCategoryLabel(category);
447
+ };
434
448
  };
435
449
  DDialogSelect.prototype.findCategories = function () {
436
450
  var options = this._options;
@@ -1 +1 @@
1
- {"version":3,"file":"d-dialog-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EACN,cAAc,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+B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,OAAO,IAAI,CAAC;IACb,CAAC;IAES,4BAAI,GAAd,UAAe,KAA+C;QAC7D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QACjC,iBAAM,IAAI,YAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,+BAAO,GAAP;QACC,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,KAAK,EAAE;YACV,KAAK,CAAC,OAAO,EAAE,CAAC;SAChB;QACD,IAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,SAAS,EAAE;YACd,SAAS,CAAC,OAAO,EAAE,CAAC;SACpB;QACD,IAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAChD,IAAI,gBAAgB,EAAE;YACrB,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,OAAO,EAAE,CAAC;SAC5B;QACD,IAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,IAAI,aAAa,EAAE;YAClB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,EAAE,CAAC;SACzB;QACD,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,EAAE;YACT,IAAI,CAAC,OAAO,EAAE,CAAC;SACf;QACD,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,oBAAC;AAAD,CAAC,AArdD,CAeU,cAAc,GAscvB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject } from \"pixi.js\";\nimport { DBase } from \"./d-base\";\nimport {\n\tDDialogLayered,\n\tDDialogLayeredEvents,\n\tDDialogLayeredOptions,\n\tDThemeDialogLayered\n} from \"./d-dialog-layered\";\nimport { DDialogSelectList, DDialogSelectListOptions } from \"./d-dialog-select-list\";\nimport { DDialogSelectSearhImpl } from \"./d-dialog-select-search-impl\";\nimport { DInputSearch, DInputSearchOptions } from \"./d-input-search\";\nimport { DLayoutHorizontal } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DListOptions } from \"./d-list\";\nimport { DListDataSelection } from \"./d-list-data-selection\";\nimport { DNote, DNoteOptions } from \"./d-note\";\nimport { DNoteSmallError } from \"./d-note-small-error\";\nimport { DNoteSmallNoItemsFound } from \"./d-note-small-no-items-found\";\nimport { DNoteSmallSearching } from \"./d-note-small-searching\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { UtilTransition } from \"./util/util-transition\";\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\nimport { DDialogSelectSearhDismissableOptions } from \"./d-dialog-select-search-dismissable\";\nimport { DDialogSelectSearhDismissableImpl } from \"./d-dialog-select-search-dismissable-impl\";\nimport { DSelect, DSelectOptions } from \"./d-select\";\nimport { DMenu } from \"./d-menu\";\nimport { isArray } from \"./util/is-array\";\nimport { DDialogSelectSearchFunction } from \"./d-dialog-select-search-function\";\n\nexport interface DDialogSelectInputOpitons extends DInputSearchOptions {\n\tmargin?: number;\n}\n\n/**\n * {@link DDialogSelect} controller.\n */\nexport interface DDialogSelectController<VALUE, CATEGORY = unknown, CATEGORY_ID = unknown> {\n\tsearch:\n\t\t| DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID>\n\t\t| DDialogSelectSearchFunction<VALUE, CATEGORY, CATEGORY_ID>;\n\tgetCategories?: () => CATEGORY[] | Promise<CATEGORY[]>;\n}\n\n/**\n * {@link DDialogSelect} note options.\n */\nexport interface DDialogSelectNoteOptions {\n\terror?: DNoteOptions | null;\n\tnoItemsFound?: DNoteOptions | null;\n\tsearching?: DNoteOptions | null;\n}\n\nexport type DDialogSelectItemToLabel<VALUE> = (result: VALUE, caller: any) => string;\n\nexport type DDialogSelectItemIsEqual<VALUE> = (a: VALUE, b: VALUE, caller: any) => boolean;\n\n/**\n * {@link DDialogSelect} events.\n */\nexport interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvents<VALUE, EMITTER> {\n\tselect(value: VALUE, self: EMITTER): void;\n}\n\n/**\n * {@link DDialogSelect} category options.\n */\nexport interface DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID>\n\textends DSelectOptions<CATEGORY_ID> {\n\ttoId?: (category: CATEGORY) => CATEGORY_ID;\n\ttoLabel?: (category: CATEGORY) => string;\n}\n\n/**\n * {@link DDialogSelect} \"on\" options.\n */\nexport interface DDialogSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DDialogSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDialogSelect} options.\n */\nexport interface DDialogSelectOptions<\n\tVALUE,\n\tCATEGORY = unknown,\n\tCATEGORY_ID = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID> = DThemeDialogSelect<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID\n\t>,\n\tEMITTER = any\n> extends DDialogLayeredOptions<VALUE, THEME> {\n\tcontroller?: DDialogSelectController<VALUE, CATEGORY, CATEGORY_ID>;\n\tcategory?: DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID>;\n\tdismiss?: DDialogSelectSearhDismissableOptions<VALUE, CATEGORY, CATEGORY_ID>;\n\tinput?: DDialogSelectInputOpitons;\n\tlist?: DListOptions<VALUE>;\n\tnote?: DDialogSelectNoteOptions;\n\ton?: DDialogSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DDialogSelect} theme.\n */\nexport interface DThemeDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY_ID = unknown>\n\textends DThemeDialogLayered {\n\tgetInputMargin(): number;\n\ttoCategoryId(category: CATEGORY): CATEGORY_ID;\n\ttoCategoryLabel(category: CATEGORY): string;\n}\n\nexport class DDialogSelect<\n\tVALUE = unknown,\n\tCATEGORY = unknown,\n\tCATEGORY_ID = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID> = DThemeDialogSelect<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID\n\t>,\n\tOPTIONS extends DDialogSelectOptions<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID,\n\t\tTHEME\n\t> = DDialogSelectOptions<VALUE, CATEGORY, CATEGORY_ID, THEME>\n> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\tprotected _spaceLeft?: DLayoutSpace;\n\tprotected _spaceRight?: DLayoutSpace;\n\tprotected _selectCategory?: DSelect<CATEGORY_ID> | null;\n\tprotected _isCategoryFetched?: boolean;\n\tprotected _input?: DInputSearch;\n\tprotected _inputLayout?: DLayoutHorizontal;\n\tprotected _list?: DDialogSelectList<VALUE>;\n\tprotected _search?: DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID>;\n\tprotected _noteError?: DNote | null;\n\tprotected _noteNoItemsFound?: DNote | null;\n\tprotected _noteSearching?: DNote | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis._value = null;\n\n\t\t// Controller binding\n\t\tconst transition = new UtilTransition();\n\t\tconst search = this.search;\n\t\tsearch.on(\"success\", (e: unknown, results: VALUE[]): void => {\n\t\t\tif (0 < results.length) {\n\t\t\t\ttransition.hide();\n\t\t\t} else {\n\t\t\t\ttransition.show(this.noteNoItemsFound);\n\t\t\t}\n\t\t\tthis.onSearched(results);\n\t\t});\n\t\tsearch.on(\"fail\", (): void => {\n\t\t\ttransition.show(this.noteError);\n\t\t\tthis.onSearched([]);\n\t\t});\n\t\tsearch.on(\"change\", (): void => {\n\t\t\tif (!search.isDone()) {\n\t\t\t\tconst noteSearching = this.noteSearching;\n\t\t\t\tif (noteSearching) {\n\t\t\t\t\ttransition.show(noteSearching);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected newContentChildren(theme: THEME, options?: OPTIONS): Array<DisplayObject | null> {\n\t\tconst result = super.newContentChildren(theme, options);\n\t\tresult.push(this.inputLayout, this.list);\n\t\treturn result;\n\t}\n\n\tprotected get inputLayout(): DLayoutHorizontal {\n\t\tlet result = this._inputLayout;\n\t\tif (result == null) {\n\t\t\tresult = this.newInputLayout();\n\t\t\tthis._inputLayout = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInputLayout(): DLayoutHorizontal {\n\t\treturn new DLayoutHorizontal({\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tchildren: [this.spaceLeft, this.selectCategory, this.input, this.spaceRight]\n\t\t});\n\t}\n\n\tprotected get spaceLeft(): DLayoutSpace {\n\t\tlet result = this._spaceLeft;\n\t\tif (result == null) {\n\t\t\tresult = this.newSpace();\n\t\t\tthis._spaceLeft = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get spaceRight(): DLayoutSpace {\n\t\tlet result = this._spaceRight;\n\t\tif (result == null) {\n\t\t\tresult = this.newSpace();\n\t\t\tthis._spaceRight = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSpace(): DLayoutSpace {\n\t\treturn new DLayoutSpace({\n\t\t\twidth: this.toInputMargin(this.theme, this._options)\n\t\t});\n\t}\n\n\tprotected get selectCategory(): DSelect<CATEGORY_ID> | null {\n\t\tlet result = this._selectCategory;\n\t\tif (result === undefined) {\n\t\t\tresult = this.newSelectCategory();\n\t\t\tthis._selectCategory = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSelectCategory(): DSelect<CATEGORY_ID> | null {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller != null && controller.getCategories != null) {\n\t\t\t\tconst result = new DSelect<CATEGORY_ID>(\n\t\t\t\t\tthis.toSelectCategoryOptions(this.theme, this._options)\n\t\t\t\t);\n\t\t\t\tresult.on(\"change\", (value: CATEGORY_ID) => {\n\t\t\t\t\tthis.onSelectCategoryChange(value);\n\t\t\t\t});\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toSelectCategoryOptions(\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DSelectOptions<CATEGORY_ID> {\n\t\tconst result = options?.category || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.width = 140;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onSelectCategoryChange(categoryId: CATEGORY_ID): void {\n\t\tthis.search.create([this.input.value, categoryId]);\n\t}\n\n\tget input(): DInputSearch {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tresult = this.newInput();\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInput(): DInputSearch {\n\t\tconst result = new DInputSearch(this.toInputOptions(this.theme, this._options));\n\t\tresult.on(\"input\", (value: string): void => {\n\t\t\tthis.onInputInput(value);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected toInputOptions(theme: THEME, options?: OPTIONS): DInputSearchOptions {\n\t\tconst result = options?.input || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.weight = 1;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected toInputMargin(theme: THEME, options?: OPTIONS): number {\n\t\treturn options?.input?.margin ?? theme.getInputMargin();\n\t}\n\n\tprotected onInputInput(value: string): void {\n\t\tconst selectCategory = this.selectCategory;\n\t\tif (selectCategory != null) {\n\t\t\tthis.search.create([value, selectCategory.value]);\n\t\t} else {\n\t\t\tthis.search.create([value]);\n\t\t}\n\t}\n\n\tget list(): DDialogSelectList<VALUE> {\n\t\tlet result = this._list;\n\t\tif (result == null) {\n\t\t\tresult = this.newList();\n\t\t\tthis._list = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newList(): DDialogSelectList<VALUE> {\n\t\tconst result = new DDialogSelectList<VALUE>(this.toListOptions(this.theme, this._options));\n\t\tresult.selection.on(\"change\", (selection: DListDataSelection<VALUE>): void => {\n\t\t\tthis.onListSelectionChange(selection);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected onListSelectionChange(selection: DListDataSelection<VALUE>): void {\n\t\tlet selected = selection.first;\n\t\tif (selected == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst dismiss = options.dismiss;\n\t\t\tif (dismiss) {\n\t\t\t\tif (selected === dismiss.value) {\n\t\t\t\t\tselected = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._value = selected;\n\t\tthis.onOk(selected);\n\t}\n\n\tprotected toListOptions(theme: THEME, options?: OPTIONS): DDialogSelectListOptions<VALUE> {\n\t\tconst result = options?.list || {};\n\t\tif (result.width === undefined) {\n\t\t\tresult.width = \"padding\";\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get noteError(): DNote | null {\n\t\tlet result = this._noteError;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteError();\n\t\t\tthis._noteError = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteError(): DNote | null {\n\t\tconst error = this._options?.note?.error;\n\t\tif (error !== null) {\n\t\t\treturn new DNoteSmallError(this.toNoteOptions(this.list, error));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteNoItemsFound(): DNote | null {\n\t\tlet result = this._noteNoItemsFound;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteNoItemsFound();\n\t\t\tthis._noteNoItemsFound = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteNoItemsFound(): DNote | null {\n\t\tconst noItemsFound = this._options?.note?.noItemsFound;\n\t\tif (noItemsFound !== null) {\n\t\t\treturn new DNoteSmallNoItemsFound(this.toNoteOptions(this.list, noItemsFound));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteSearching(): DNote | null {\n\t\tlet result = this._noteSearching;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteSearching();\n\t\t\tthis._noteSearching = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteSearching(): DNote | null {\n\t\tconst searching = this._options?.note?.searching;\n\t\t// Because the `searching` note is disabled by default,\n\t\t// if options.searching is missing, i.e., if its value is undefined,\n\t\t// this method returns null. This is why `!=` is used here instead of `!==`.\n\t\tif (searching != null) {\n\t\t\treturn new DNoteSmallSearching(this.toNoteOptions(this.list, searching));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toNoteOptions(parent: DBase, options?: DNoteOptions): DNoteOptions {\n\t\tif (options != null) {\n\t\t\tif (options.parent == null) {\n\t\t\t\toptions.parent = parent;\n\t\t\t}\n\t\t\tif (options.visible == null) {\n\t\t\t\toptions.visible = false;\n\t\t\t}\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tparent,\n\t\t\tvisible: false\n\t\t};\n\t}\n\n\tprotected get search(): DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID> {\n\t\tlet result = this._search;\n\t\tif (result == null) {\n\t\t\tresult = this.newSearch();\n\t\t\tthis._search = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSearch(): DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID> {\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller) {\n\t\t\t\tconst dismiss = options.dismiss;\n\t\t\t\tconst search = controller.search;\n\t\t\t\tif (\"create\" in search) {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(search, dismiss);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn search;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(\n\t\t\t\t\t\t\tnew DDialogSelectSearhImpl(search),\n\t\t\t\t\t\t\tdismiss\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn new DDialogSelectSearhImpl(search);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new DDialogSelectSearhImpl();\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\tprotected onSearched(results: VALUE[]): void {\n\t\tthis.list.data.items = results;\n\t}\n\n\tprotected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null> {\n\t\treturn this._value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogSelect\";\n\t}\n\n\tprotected onOpen(): void {\n\t\tsuper.onOpen();\n\t\tthis.list.selection.clear();\n\t\tconst selectCategory = this.selectCategory;\n\t\tif (selectCategory != null) {\n\t\t\tif (this._isCategoryFetched !== true) {\n\t\t\t\tthis._isCategoryFetched = true;\n\t\t\t\tconst categoriesOrPromise = this.findCategories();\n\t\t\t\tif (categoriesOrPromise == null) {\n\t\t\t\t\tthis.search.create([this.input.value, null]);\n\t\t\t\t} else if (isArray(categoriesOrPromise)) {\n\t\t\t\t\tthis.onCategoryFetched(selectCategory, categoriesOrPromise);\n\t\t\t\t} else {\n\t\t\t\t\tselectCategory.state.isEnabled = false;\n\t\t\t\t\tcategoriesOrPromise.then((categories) => {\n\t\t\t\t\t\tselectCategory.state.isEnabled = true;\n\t\t\t\t\t\tthis.onCategoryFetched(selectCategory, categories);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.search.create([this.input.value, selectCategory.value]);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.search.create([this.input.value]);\n\t\t}\n\t}\n\n\tprotected onCategoryFetched(\n\t\tselectCategory: DSelect<CATEGORY_ID>,\n\t\tcategories: CATEGORY[]\n\t): void {\n\t\tconst items = [];\n\t\tfor (let i = 0, imax = categories.length; i < imax; ++i) {\n\t\t\tconst category = categories[i];\n\t\t\titems.push({\n\t\t\t\tvalue: this.toCategoryId(category),\n\t\t\t\ttext: {\n\t\t\t\t\tvalue: this.toCategoryLabel(category)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tselectCategory.menu = new DMenu<CATEGORY_ID>({\n\t\t\tfit: true,\n\t\t\titems\n\t\t});\n\t\tconst newValue = 0 < items.length ? items[0].value : null;\n\t\tselectCategory.value = newValue;\n\t\tselectCategory.show();\n\t\tthis.search.create([this.input.value, newValue]);\n\t}\n\n\tprotected toCategoryId(target: CATEGORY): CATEGORY_ID {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst category = options.category;\n\t\t\tif (category != null) {\n\t\t\t\tconst toId = category.toId;\n\t\t\t\tif (toId != null) {\n\t\t\t\t\treturn toId(target);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.theme.toCategoryId(target);\n\t}\n\n\tprotected toCategoryLabel(target: CATEGORY): string {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst category = options.category;\n\t\t\tif (category != null) {\n\t\t\t\tconst toLabel = category.toLabel;\n\t\t\t\tif (toLabel != null) {\n\t\t\t\t\treturn toLabel(target);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.theme.toCategoryLabel(target);\n\t}\n\n\tprotected findCategories(): Promise<CATEGORY[]> | CATEGORY[] | null {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller != null && controller.getCategories != null) {\n\t\t\t\treturn controller.getCategories();\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void {\n\t\tthis.emit(\"select\", value, this);\n\t\tsuper.onOk(value);\n\t}\n\n\tdestroy(): void {\n\t\tconst input = this._input;\n\t\tif (input) {\n\t\t\tinput.destroy();\n\t\t}\n\t\tconst noteError = this._noteError;\n\t\tif (noteError) {\n\t\t\tnoteError.destroy();\n\t\t}\n\t\tconst noteNoItemsFound = this._noteNoItemsFound;\n\t\tif (noteNoItemsFound) {\n\t\t\tnoteNoItemsFound?.destroy();\n\t\t}\n\t\tconst noteSearching = this._noteSearching;\n\t\tif (noteSearching) {\n\t\t\tnoteSearching?.destroy();\n\t\t}\n\t\tconst list = this._list;\n\t\tif (list) {\n\t\t\tlist.destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-dialog-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EACN,cAAc,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAuB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAkB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqF5C;IAeU,iCAA4C;IAcrD,uBAAY,OAAiB;QAA7B,YACC,kBAAM,OAAO,CAAC,SA2Bd;QAzBA,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,qBAAqB;QACrB,IAAM,UAAU,GAAG,IAAI,cAAc,EAA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,CAAC,cAAc,CAAC;QAC1C,IAAI,aAAa,EAAE;YAClB,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,EAAE,CAAC;SACzB;QACD,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,EAAE;YACT,IAAI,CAAC,OAAO,EAAE,CAAC;SACf;QACD,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,oBAAC;AAAD,CAAC,AAleD,CAeU,cAAc,GAmdvB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject } from \"pixi.js\";\nimport { DBase } from \"./d-base\";\nimport {\n\tDDialogLayered,\n\tDDialogLayeredEvents,\n\tDDialogLayeredOptions,\n\tDThemeDialogLayered\n} from \"./d-dialog-layered\";\nimport { DDialogSelectList, DDialogSelectListOptions } from \"./d-dialog-select-list\";\nimport { DDialogSelectSearhImpl } from \"./d-dialog-select-search-impl\";\nimport { DInputSearch, DInputSearchOptions } from \"./d-input-search\";\nimport { DLayoutHorizontal } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DListOptions } from \"./d-list\";\nimport { DListDataSelection } from \"./d-list-data-selection\";\nimport { DNote, DNoteOptions } from \"./d-note\";\nimport { DNoteSmallError } from \"./d-note-small-error\";\nimport { DNoteSmallNoItemsFound } from \"./d-note-small-no-items-found\";\nimport { DNoteSmallSearching } from \"./d-note-small-searching\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { UtilTransition } from \"./util/util-transition\";\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\nimport { DDialogSelectSearhDismissableOptions } from \"./d-dialog-select-search-dismissable\";\nimport { DDialogSelectSearhDismissableImpl } from \"./d-dialog-select-search-dismissable-impl\";\nimport { DSelect, DSelectOptions } from \"./d-select\";\nimport { DMenu } from \"./d-menu\";\nimport { isArray } from \"./util/is-array\";\nimport { DDialogSelectSearchFunction } from \"./d-dialog-select-search-function\";\nimport { DBaseState } from \"./d-base-state\";\n\nexport interface DDialogSelectInputOpitons extends DInputSearchOptions {\n\tmargin?: number;\n}\n\n/**\n * {@link DDialogSelect} controller.\n */\nexport interface DDialogSelectController<VALUE, CATEGORY = unknown, CATEGORY_ID = unknown> {\n\tsearch:\n\t\t| DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID>\n\t\t| DDialogSelectSearchFunction<VALUE, CATEGORY, CATEGORY_ID>;\n\tgetCategories?: () => CATEGORY[] | Promise<CATEGORY[]>;\n}\n\n/**\n * {@link DDialogSelect} note options.\n */\nexport interface DDialogSelectNoteOptions {\n\terror?: DNoteOptions | null;\n\tnoItemsFound?: DNoteOptions | null;\n\tsearching?: DNoteOptions | null;\n}\n\nexport type DDialogSelectItemToLabel<VALUE> = (result: VALUE, caller: any) => string;\n\nexport type DDialogSelectItemIsEqual<VALUE> = (a: VALUE, b: VALUE, caller: any) => boolean;\n\n/**\n * {@link DDialogSelect} events.\n */\nexport interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvents<VALUE, EMITTER> {\n\tselect(value: VALUE, self: EMITTER): void;\n}\n\n/**\n * {@link DDialogSelect} category options.\n */\nexport interface DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID>\n\textends DSelectOptions<CATEGORY_ID | null> {\n\ttoId?: (category: CATEGORY) => CATEGORY_ID;\n\ttoLabel?: (category: CATEGORY | null) => string;\n}\n\n/**\n * {@link DDialogSelect} \"on\" options.\n */\nexport interface DDialogSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DDialogSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDialogSelect} options.\n */\nexport interface DDialogSelectOptions<\n\tVALUE,\n\tCATEGORY = unknown,\n\tCATEGORY_ID = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID> = DThemeDialogSelect<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID\n\t>,\n\tEMITTER = any\n> extends DDialogLayeredOptions<VALUE, THEME> {\n\tcontroller?: DDialogSelectController<VALUE, CATEGORY, CATEGORY_ID>;\n\tcategory?: DDialogSelectCategoryOptions<VALUE, CATEGORY, CATEGORY_ID>;\n\tdismiss?: DDialogSelectSearhDismissableOptions<VALUE, CATEGORY, CATEGORY_ID>;\n\tinput?: DDialogSelectInputOpitons;\n\tlist?: DListOptions<VALUE>;\n\tnote?: DDialogSelectNoteOptions;\n\ton?: DDialogSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DDialogSelect} theme.\n */\nexport interface DThemeDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY_ID = unknown>\n\textends DThemeDialogLayered {\n\tgetInputMargin(): number;\n\ttoCategoryId(category: CATEGORY): CATEGORY_ID;\n\ttoCategoryLabel(category: CATEGORY | null): string;\n}\n\nexport class DDialogSelect<\n\tVALUE = unknown,\n\tCATEGORY = unknown,\n\tCATEGORY_ID = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE, CATEGORY, CATEGORY_ID> = DThemeDialogSelect<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID\n\t>,\n\tOPTIONS extends DDialogSelectOptions<\n\t\tVALUE,\n\t\tCATEGORY,\n\t\tCATEGORY_ID,\n\t\tTHEME\n\t> = DDialogSelectOptions<VALUE, CATEGORY, CATEGORY_ID, THEME>\n> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\tprotected _spaceLeft?: DLayoutSpace;\n\tprotected _spaceRight?: DLayoutSpace;\n\tprotected _selectCategory?: DSelect<CATEGORY_ID | null> | null;\n\tprotected _isCategoryFetched?: boolean;\n\tprotected _input?: DInputSearch;\n\tprotected _inputLayout?: DLayoutHorizontal;\n\tprotected _list?: DDialogSelectList<VALUE>;\n\tprotected _search?: DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID>;\n\tprotected _noteError?: DNote | null;\n\tprotected _noteNoItemsFound?: DNote | null;\n\tprotected _noteSearching?: DNote | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis._value = null;\n\n\t\t// Controller binding\n\t\tconst transition = new UtilTransition();\n\t\tconst search = this.search;\n\t\tsearch.on(\"success\", (e: unknown, results: VALUE[]): void => {\n\t\t\tif (0 < results.length) {\n\t\t\t\ttransition.hide();\n\t\t\t} else {\n\t\t\t\ttransition.show(this.noteNoItemsFound);\n\t\t\t}\n\t\t\tthis.onSearched(results);\n\t\t});\n\t\tsearch.on(\"fail\", (): void => {\n\t\t\ttransition.show(this.noteError);\n\t\t\tthis.onSearched([]);\n\t\t});\n\t\tsearch.on(\"change\", (): void => {\n\t\t\tif (!search.isDone()) {\n\t\t\t\tconst noteSearching = this.noteSearching;\n\t\t\t\tif (noteSearching) {\n\t\t\t\t\ttransition.show(noteSearching);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected newContentChildren(theme: THEME, options?: OPTIONS): Array<DisplayObject | null> {\n\t\tconst result = super.newContentChildren(theme, options);\n\t\tresult.push(this.inputLayout, this.list);\n\t\treturn result;\n\t}\n\n\tprotected get inputLayout(): DLayoutHorizontal {\n\t\tlet result = this._inputLayout;\n\t\tif (result == null) {\n\t\t\tresult = this.newInputLayout();\n\t\t\tthis._inputLayout = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInputLayout(): DLayoutHorizontal {\n\t\treturn new DLayoutHorizontal({\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tchildren: [this.spaceLeft, this.selectCategory, this.input, this.spaceRight]\n\t\t});\n\t}\n\n\tprotected get spaceLeft(): DLayoutSpace {\n\t\tlet result = this._spaceLeft;\n\t\tif (result == null) {\n\t\t\tresult = this.newSpace();\n\t\t\tthis._spaceLeft = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get spaceRight(): DLayoutSpace {\n\t\tlet result = this._spaceRight;\n\t\tif (result == null) {\n\t\t\tresult = this.newSpace();\n\t\t\tthis._spaceRight = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSpace(): DLayoutSpace {\n\t\treturn new DLayoutSpace({\n\t\t\twidth: this.toInputMargin(this.theme, this._options)\n\t\t});\n\t}\n\n\tprotected get selectCategory(): DSelect<CATEGORY_ID | null> | null {\n\t\tlet result = this._selectCategory;\n\t\tif (result === undefined) {\n\t\t\tresult = this.newSelectCategory();\n\t\t\tthis._selectCategory = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSelectCategory(): DSelect<CATEGORY_ID | null> | null {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller != null && controller.getCategories != null) {\n\t\t\t\tconst result = new DSelect<CATEGORY_ID | null>(\n\t\t\t\t\tthis.toSelectCategoryOptions(this.theme, this._options)\n\t\t\t\t);\n\t\t\t\tresult.on(\"change\", (value: CATEGORY_ID) => {\n\t\t\t\t\tthis.onSelectCategoryChange(value);\n\t\t\t\t});\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toSelectCategoryOptions(\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DSelectOptions<CATEGORY_ID | null> {\n\t\tconst result = options?.category || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.width = 140;\n\t\t}\n\t\tif (result.state === undefined) {\n\t\t\tresult.state = DBaseState.DISABLED;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onSelectCategoryChange(categoryId: CATEGORY_ID): void {\n\t\tthis.search.create([this.input.value, categoryId]);\n\t}\n\n\tget input(): DInputSearch {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tresult = this.newInput();\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInput(): DInputSearch {\n\t\tconst result = new DInputSearch(this.toInputOptions(this.theme, this._options));\n\t\tresult.on(\"input\", (value: string): void => {\n\t\t\tthis.onInputInput(value);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected toInputOptions(theme: THEME, options?: OPTIONS): DInputSearchOptions {\n\t\tconst result = options?.input || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.weight = 1;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected toInputMargin(theme: THEME, options?: OPTIONS): number {\n\t\treturn options?.input?.margin ?? theme.getInputMargin();\n\t}\n\n\tprotected onInputInput(value: string): void {\n\t\tconst selectCategory = this.selectCategory;\n\t\tif (selectCategory != null) {\n\t\t\tthis.search.create([value, selectCategory.value]);\n\t\t} else {\n\t\t\tthis.search.create([value]);\n\t\t}\n\t}\n\n\tget list(): DDialogSelectList<VALUE> {\n\t\tlet result = this._list;\n\t\tif (result == null) {\n\t\t\tresult = this.newList();\n\t\t\tthis._list = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newList(): DDialogSelectList<VALUE> {\n\t\tconst result = new DDialogSelectList<VALUE>(this.toListOptions(this.theme, this._options));\n\t\tresult.selection.on(\"change\", (selection: DListDataSelection<VALUE>): void => {\n\t\t\tthis.onListSelectionChange(selection);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected onListSelectionChange(selection: DListDataSelection<VALUE>): void {\n\t\tlet selected = selection.first;\n\t\tif (selected == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst dismiss = options.dismiss;\n\t\t\tif (dismiss) {\n\t\t\t\tif (selected === dismiss.value) {\n\t\t\t\t\tselected = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._value = selected;\n\t\tthis.onOk(selected);\n\t}\n\n\tprotected toListOptions(theme: THEME, options?: OPTIONS): DDialogSelectListOptions<VALUE> {\n\t\tconst result = options?.list || {};\n\t\tif (result.width === undefined) {\n\t\t\tresult.width = \"padding\";\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get noteError(): DNote | null {\n\t\tlet result = this._noteError;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteError();\n\t\t\tthis._noteError = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteError(): DNote | null {\n\t\tconst error = this._options?.note?.error;\n\t\tif (error !== null) {\n\t\t\treturn new DNoteSmallError(this.toNoteOptions(this.list, error));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteNoItemsFound(): DNote | null {\n\t\tlet result = this._noteNoItemsFound;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteNoItemsFound();\n\t\t\tthis._noteNoItemsFound = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteNoItemsFound(): DNote | null {\n\t\tconst noItemsFound = this._options?.note?.noItemsFound;\n\t\tif (noItemsFound !== null) {\n\t\t\treturn new DNoteSmallNoItemsFound(this.toNoteOptions(this.list, noItemsFound));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteSearching(): DNote | null {\n\t\tlet result = this._noteSearching;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteSearching();\n\t\t\tthis._noteSearching = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteSearching(): DNote | null {\n\t\tconst searching = this._options?.note?.searching;\n\t\t// Because the `searching` note is disabled by default,\n\t\t// if options.searching is missing, i.e., if its value is undefined,\n\t\t// this method returns null. This is why `!=` is used here instead of `!==`.\n\t\tif (searching != null) {\n\t\t\treturn new DNoteSmallSearching(this.toNoteOptions(this.list, searching));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toNoteOptions(parent: DBase, options?: DNoteOptions): DNoteOptions {\n\t\tif (options != null) {\n\t\t\tif (options.parent == null) {\n\t\t\t\toptions.parent = parent;\n\t\t\t}\n\t\t\tif (options.visible == null) {\n\t\t\t\toptions.visible = false;\n\t\t\t}\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tparent,\n\t\t\tvisible: false\n\t\t};\n\t}\n\n\tprotected get search(): DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID> {\n\t\tlet result = this._search;\n\t\tif (result == null) {\n\t\t\tresult = this.newSearch();\n\t\t\tthis._search = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSearch(): DDialogSelectSearch<VALUE, CATEGORY, CATEGORY_ID> {\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller) {\n\t\t\t\tconst dismiss = options.dismiss;\n\t\t\t\tconst search = controller.search;\n\t\t\t\tif (\"create\" in search) {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(search, dismiss);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn search;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(\n\t\t\t\t\t\t\tnew DDialogSelectSearhImpl(search),\n\t\t\t\t\t\t\tdismiss\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn new DDialogSelectSearhImpl(search);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new DDialogSelectSearhImpl();\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\tprotected onSearched(results: VALUE[]): void {\n\t\tthis.list.data.items = results;\n\t}\n\n\tprotected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null> {\n\t\treturn this._value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogSelect\";\n\t}\n\n\tprotected onOpen(): void {\n\t\tsuper.onOpen();\n\t\tthis.list.selection.clear();\n\t\tconst selectCategory = this.selectCategory;\n\t\tif (selectCategory != null) {\n\t\t\tif (this._isCategoryFetched !== true) {\n\t\t\t\tthis._isCategoryFetched = true;\n\t\t\t\tconst categoriesOrPromise = this.findCategories();\n\t\t\t\tif (categoriesOrPromise == null) {\n\t\t\t\t\tthis.search.create([this.input.value, null]);\n\t\t\t\t} else if (isArray(categoriesOrPromise)) {\n\t\t\t\t\tthis.onCategoryFetched(selectCategory, categoriesOrPromise);\n\t\t\t\t} else {\n\t\t\t\t\tcategoriesOrPromise.then((categories) => {\n\t\t\t\t\t\tthis.onCategoryFetched(selectCategory, categories);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.search.create([this.input.value, selectCategory.value]);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.search.create([this.input.value]);\n\t\t}\n\t}\n\n\tprotected onCategoryFetched(\n\t\tselectCategory: DSelect<CATEGORY_ID | null>,\n\t\tcategories: CATEGORY[]\n\t): void {\n\t\tconst items = [];\n\t\tconst toId = this.newToCategoryId();\n\t\tconst toLabel = this.newToCategoryLabel();\n\t\titems.push({\n\t\t\tvalue: null,\n\t\t\ttext: {\n\t\t\t\tvalue: toLabel(null)\n\t\t\t}\n\t\t});\n\t\tfor (let i = 0, imax = categories.length; i < imax; ++i) {\n\t\t\tconst category = categories[i];\n\t\t\titems.push({\n\t\t\t\tvalue: toId(category),\n\t\t\t\ttext: {\n\t\t\t\t\tvalue: toLabel(category)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tselectCategory.menu = new DMenu<CATEGORY_ID | null>({\n\t\t\tfit: true,\n\t\t\titems\n\t\t});\n\t\tselectCategory.state.isEnabled = true;\n\t\tthis.search.create([this.input.value, null]);\n\t}\n\n\tprotected newToCategoryId(): (category: CATEGORY) => CATEGORY_ID {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst category = options.category;\n\t\t\tif (category != null) {\n\t\t\t\tconst toId = category.toId;\n\t\t\t\tif (toId != null) {\n\t\t\t\t\treturn toId;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst theme = this.theme;\n\t\treturn (category: CATEGORY): CATEGORY_ID => {\n\t\t\treturn theme.toCategoryId(category);\n\t\t};\n\t}\n\n\tprotected newToCategoryLabel(): (category: CATEGORY | null) => string {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst category = options.category;\n\t\t\tif (category != null) {\n\t\t\t\tconst toLabel = category.toLabel;\n\t\t\t\tif (toLabel != null) {\n\t\t\t\t\treturn toLabel;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst theme = this.theme;\n\t\treturn (category: CATEGORY | null): string => {\n\t\t\treturn theme.toCategoryLabel(category);\n\t\t};\n\t}\n\n\tprotected findCategories(): Promise<CATEGORY[]> | CATEGORY[] | null {\n\t\tconst options = this._options;\n\t\tif (options != null) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller != null && controller.getCategories != null) {\n\t\t\t\treturn controller.getCategories();\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void {\n\t\tthis.emit(\"select\", value, this);\n\t\tsuper.onOk(value);\n\t}\n\n\tdestroy(): void {\n\t\tconst input = this._input;\n\t\tif (input) {\n\t\t\tinput.destroy();\n\t\t}\n\t\tconst noteError = this._noteError;\n\t\tif (noteError) {\n\t\t\tnoteError.destroy();\n\t\t}\n\t\tconst noteNoItemsFound = this._noteNoItemsFound;\n\t\tif (noteNoItemsFound) {\n\t\t\tnoteNoItemsFound?.destroy();\n\t\t}\n\t\tconst noteSearching = this._noteSearching;\n\t\tif (noteSearching) {\n\t\t\tnoteSearching?.destroy();\n\t\t}\n\t\tconst list = this._list;\n\t\tif (list) {\n\t\t\tlist.destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
@@ -34,16 +34,10 @@ var DSelect = /** @class */ (function (_super) {
34
34
  _super.prototype.onMenuReplaced.call(this, newMenu, oldMenu);
35
35
  // Update the value
36
36
  var value = this._value;
37
- if (value != null) {
38
- var item = this.findMenuItem(newMenu, value);
39
- if (item != null) {
40
- this._value = value;
41
- this.text = item;
42
- }
43
- else {
44
- this._value = null;
45
- this.text = null;
46
- }
37
+ var item = this.findMenuItem(newMenu, value);
38
+ if (item != null) {
39
+ this._value = value;
40
+ this.text = item;
47
41
  }
48
42
  else {
49
43
  this._value = null;
@@ -1 +1 @@
1
- {"version":3,"file":"d-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EACN,aAAa,EAIb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqDnD;;GAEG;AACH;IAIU,2BAA6D;IAGtE,iBAAY,OAAiB;QAA7B,YACC,kBAAM,OAAO,CAAC,SAQd;QANA,gBAAgB;QAChB,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAM,KAAK,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;SACnB;;IACF,CAAC;IAES,8BAAY,GAAtB,UAAuB,QAAe,EAAE,IAAsB,EAAE,IAAkB;QACjF,iBAAM,YAAY,YAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,IAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;QAC7B,IAAI,QAAQ,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;YACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;SAC7C;IACF,CAAC;IAES,gCAAc,GAAxB,UAAyB,OAAqB,EAAE,OAAsB;QACrE,iBAAM,cAAc,YAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAEvC,mBAAmB;QACnB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E;oBAC1B,OAAO,KAAK,CAAC;iBACb;aACD;SACD;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAKD,sBAAI,0BAAK;QAHT;;WAEG;aACH;YACC,OAAO,IAAI,CAAC,MAAM,CAAC;QACpB,CAAC;QAED;;WAEG;aACH,UAAU,KAAmB;YAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE;gBAC1B,IAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACjD,IAAI,IAAI,IAAI,IAAI,EAAE;oBACjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;oBACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;iBACjB;qBAAM;oBACN,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;oBACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;iBACjB;aACD;QACF,CAAC;;;OAhBA;IAkBS,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AApGD,CAIU,aAAa,GAgGtB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n\tDDropdownBase,\n\tDDropdownBaseEvents,\n\tDDropdownBaseOptions,\n\tDThemeDropdownBase\n} from \"./d-dropdown-base\";\nimport { DMenu } from \"./d-menu\";\nimport { DMenuItem } from \"./d-menu-item\";\nimport { DMenuItemMenu } from \"./d-menu-item-menu\";\nimport { DOnOptions } from \"./d-on-options\";\n\n/**\n * {@link DSelect} events.\n */\nexport interface DSelectEvents<VALUE, EMITTER>\n\textends DDropdownBaseEvents<VALUE, DMenuItem<VALUE> | null, EMITTER> {\n\t/**\n\t * Triggered when a selection is changed.\n\t *\n\t * @param newVAlue a newly-selected value\n\t * @param oldValue a previously-selected value\n\t * @param item a newly-selected item\n\t * @param emitter an emitter\n\t */\n\tchange(\n\t\tnewValue: VALUE | null,\n\t\toldValue: VALUE | null,\n\t\titem: DMenuItem<VALUE> | null,\n\t\temitter: EMITTER\n\t): void;\n}\n\n/**\n * {@link DSelect} \"on\" options.\n */\nexport interface DSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DSelect} options.\n */\nexport interface DSelectOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeSelect<VALUE> = DThemeSelect<VALUE>,\n\tEMITTER = any\n> extends DDropdownBaseOptions<VALUE, DMenuItem<VALUE> | null, THEME, EMITTER> {\n\t/**\n\t * A default value.\n\t */\n\tvalue?: VALUE | null;\n\n\ton?: DSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DSelect} theme.\n */\nexport interface DThemeSelect<VALUE = unknown>\n\textends DThemeDropdownBase<DMenuItem<VALUE> | null> {}\n\n/**\n * A selector class.\n */\nexport class DSelect<\n\tVALUE = unknown,\n\tTHEME extends DThemeSelect<VALUE> = DThemeSelect<VALUE>,\n\tOPTIONS extends DSelectOptions<VALUE, THEME> = DSelectOptions<VALUE, THEME>\n> extends DDropdownBase<VALUE, DMenuItem<VALUE> | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\t// Default value\n\t\tthis._value = null;\n\t\tconst value = options?.value;\n\t\tif (value != null) {\n\t\t\tthis.value = value;\n\t\t}\n\t}\n\n\tprotected onMenuSelect(newValue: VALUE, item: DMenuItem<VALUE>, menu: DMenu<VALUE>): void {\n\t\tsuper.onMenuSelect(newValue, item, menu);\n\t\tconst oldValue = this._value;\n\t\tif (oldValue !== newValue) {\n\t\t\tthis._value = newValue;\n\t\t\tthis.text = item;\n\t\t\tthis.onValueChange(newValue, oldValue, item);\n\t\t}\n\t}\n\n\tprotected onMenuReplaced(newMenu: DMenu<VALUE>, oldMenu?: DMenu<VALUE>): void {\n\t\tsuper.onMenuReplaced(newMenu, oldMenu);\n\n\t\t// Update the value\n\t\tconst value = this._value;\n\t\tif (value != null) {\n\t\t\tconst item = this.findMenuItem(newMenu, value);\n\t\t\tif (item != null) {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis.text = item;\n\t\t\t} else {\n\t\t\t\tthis._value = null;\n\t\t\t\tthis.text = null;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._value = null;\n\t\t\tthis.text = null;\n\t\t}\n\t}\n\n\tprotected onValueChange(\n\t\tnewValue: VALUE | null,\n\t\toldValue: VALUE | null,\n\t\titem: DMenuItem<VALUE> | null\n\t): void {\n\t\tthis.emit(\"change\", newValue, oldValue, item, this);\n\t}\n\n\tprotected findMenuItem(menu: DMenu<VALUE>, value: VALUE | null): DMenuItem<VALUE> | null {\n\t\tconst children = menu.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DMenuItemMenu) {\n\t\t\t\tconst result = this.findMenuItem(child.menu, value);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else if (child instanceof DMenuItem) {\n\t\t\t\tif (child.value === value) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns a selected value or null.\n\t */\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Sets to the specified value.\n\t */\n\tset value(value: VALUE | null) {\n\t\tif (this._value !== value) {\n\t\t\tconst item = this.findMenuItem(this.menu, value);\n\t\t\tif (item != null) {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis.text = item;\n\t\t\t} else {\n\t\t\t\tthis._value = null;\n\t\t\t\tthis.text = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DSelect\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"d-select.js","sourceRoot":"","sources":["../../../src/main/typescript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;gBACjD,IAAI,IAAI,IAAI,IAAI,EAAE;oBACjB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;oBACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;iBACjB;qBAAM;oBACN,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;oBACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;iBACjB;aACD;QACF,CAAC;;;OAhBA;IAkBS,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA/FD,CAIU,aAAa,GA2FtB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n\tDDropdownBase,\n\tDDropdownBaseEvents,\n\tDDropdownBaseOptions,\n\tDThemeDropdownBase\n} from \"./d-dropdown-base\";\nimport { DMenu } from \"./d-menu\";\nimport { DMenuItem } from \"./d-menu-item\";\nimport { DMenuItemMenu } from \"./d-menu-item-menu\";\nimport { DOnOptions } from \"./d-on-options\";\n\n/**\n * {@link DSelect} events.\n */\nexport interface DSelectEvents<VALUE, EMITTER>\n\textends DDropdownBaseEvents<VALUE, DMenuItem<VALUE> | null, EMITTER> {\n\t/**\n\t * Triggered when a selection is changed.\n\t *\n\t * @param newVAlue a newly-selected value\n\t * @param oldValue a previously-selected value\n\t * @param item a newly-selected item\n\t * @param emitter an emitter\n\t */\n\tchange(\n\t\tnewValue: VALUE | null,\n\t\toldValue: VALUE | null,\n\t\titem: DMenuItem<VALUE> | null,\n\t\temitter: EMITTER\n\t): void;\n}\n\n/**\n * {@link DSelect} \"on\" options.\n */\nexport interface DSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DSelect} options.\n */\nexport interface DSelectOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeSelect<VALUE> = DThemeSelect<VALUE>,\n\tEMITTER = any\n> extends DDropdownBaseOptions<VALUE, DMenuItem<VALUE> | null, THEME, EMITTER> {\n\t/**\n\t * A default value.\n\t */\n\tvalue?: VALUE | null;\n\n\ton?: DSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DSelect} theme.\n */\nexport interface DThemeSelect<VALUE = unknown>\n\textends DThemeDropdownBase<DMenuItem<VALUE> | null> {}\n\n/**\n * A selector class.\n */\nexport class DSelect<\n\tVALUE = unknown,\n\tTHEME extends DThemeSelect<VALUE> = DThemeSelect<VALUE>,\n\tOPTIONS extends DSelectOptions<VALUE, THEME> = DSelectOptions<VALUE, THEME>\n> extends DDropdownBase<VALUE, DMenuItem<VALUE> | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\t// Default value\n\t\tthis._value = null;\n\t\tconst value = options?.value;\n\t\tif (value != null) {\n\t\t\tthis.value = value;\n\t\t}\n\t}\n\n\tprotected onMenuSelect(newValue: VALUE, item: DMenuItem<VALUE>, menu: DMenu<VALUE>): void {\n\t\tsuper.onMenuSelect(newValue, item, menu);\n\t\tconst oldValue = this._value;\n\t\tif (oldValue !== newValue) {\n\t\t\tthis._value = newValue;\n\t\t\tthis.text = item;\n\t\t\tthis.onValueChange(newValue, oldValue, item);\n\t\t}\n\t}\n\n\tprotected onMenuReplaced(newMenu: DMenu<VALUE>, oldMenu?: DMenu<VALUE>): void {\n\t\tsuper.onMenuReplaced(newMenu, oldMenu);\n\n\t\t// Update the value\n\t\tconst value = this._value;\n\t\tconst item = this.findMenuItem(newMenu, value);\n\t\tif (item != null) {\n\t\t\tthis._value = value;\n\t\t\tthis.text = item;\n\t\t} else {\n\t\t\tthis._value = null;\n\t\t\tthis.text = null;\n\t\t}\n\t}\n\n\tprotected onValueChange(\n\t\tnewValue: VALUE | null,\n\t\toldValue: VALUE | null,\n\t\titem: DMenuItem<VALUE> | null\n\t): void {\n\t\tthis.emit(\"change\", newValue, oldValue, item, this);\n\t}\n\n\tprotected findMenuItem(menu: DMenu<VALUE>, value: VALUE | null): DMenuItem<VALUE> | null {\n\t\tconst children = menu.children;\n\t\tfor (let i = 0, imax = children.length; i < imax; ++i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child instanceof DMenuItemMenu) {\n\t\t\t\tconst result = this.findMenuItem(child.menu, value);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else if (child instanceof DMenuItem) {\n\t\t\t\tif (child.value === value) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns a selected value or null.\n\t */\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * Sets to the specified value.\n\t */\n\tset value(value: VALUE | null) {\n\t\tif (this._value !== value) {\n\t\t\tconst item = this.findMenuItem(this.menu, value);\n\t\t\tif (item != null) {\n\t\t\t\tthis._value = value;\n\t\t\t\tthis.text = item;\n\t\t\t} else {\n\t\t\t\tthis._value = null;\n\t\t\t\tthis.text = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DSelect\";\n\t}\n}\n"]}
@@ -36,6 +36,9 @@ var DThemeDarkDiagramEditor = /** @class */ (function (_super) {
36
36
  DThemeDarkDiagramEditor.prototype.isSnapTargetEnabled = function () {
37
37
  return true;
38
38
  };
39
+ DThemeDarkDiagramEditor.prototype.getBaseLayerLabel = function () {
40
+ return "Base Layer";
41
+ };
39
42
  return DThemeDarkDiagramEditor;
40
43
  }(DThemeDarkDiagramBase));
41
44
  export { DThemeDarkDiagramEditor };