@wcardinal/wcardinal-ui 0.361.0 → 0.363.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.
- package/dist/types/wcardinal/ui/d-button-select.d.ts +3 -3
- package/dist/types/wcardinal/ui/d-diagram-editor.d.ts +13 -1
- package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable-impl.d.ts +4 -4
- package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable.d.ts +4 -4
- package/dist/types/wcardinal/ui/d-dialog-select-search-function.d.ts +4 -4
- package/dist/types/wcardinal/ui/d-dialog-select-search-impl.d.ts +3 -3
- package/dist/types/wcardinal/ui/d-dialog-select-search.d.ts +1 -1
- package/dist/types/wcardinal/ui/d-dialog-select.d.ts +34 -24
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.d.ts +2 -2
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-diagram-editor.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/d-theme-white-dialog-select.d.ts +2 -2
- package/dist/types/wcardinal/ui/util/index.d.ts +0 -1
- package/dist/wcardinal/ui/d-button-select.js +1 -1
- package/dist/wcardinal/ui/d-button-select.js.map +1 -1
- package/dist/wcardinal/ui/d-diagram-canvas-editor.js +1 -0
- package/dist/wcardinal/ui/d-diagram-canvas-editor.js.map +1 -1
- package/dist/wcardinal/ui/d-diagram-editor.js +10 -5
- package/dist/wcardinal/ui/d-diagram-editor.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select-search-function.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select-search-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select-search.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select.js +60 -102
- package/dist/wcardinal/ui/d-dialog-select.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js +3 -0
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js +4 -6
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js +3 -0
- package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js +4 -6
- package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js.map +1 -1
- package/dist/wcardinal/ui/util/index.js +0 -1
- package/dist/wcardinal/ui/util/index.js.map +1 -1
- package/dist/wcardinal/ui/util/to-label.js +20 -2
- package/dist/wcardinal/ui/util/to-label.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +8 -9
- package/dist/wcardinal-ui-theme-dark.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white.js +8 -9
- package/dist/wcardinal-ui-theme-white.min.js +2 -2
- package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
- package/dist/wcardinal-ui.cjs.js +114 -151
- package/dist/wcardinal-ui.js +75 -118
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/wcardinal/ui/util/to-label-with.d.ts +0 -1
- package/dist/wcardinal/ui/util/to-label-with.js +0 -27
- package/dist/wcardinal/ui/util/to-label-with.js.map +0 -1
|
@@ -40,7 +40,7 @@ export interface DButtonSelectOnOptions<VALUE, EMITTER> extends Partial<DButtonS
|
|
|
40
40
|
/**
|
|
41
41
|
* {@link DButtonSelect} options.
|
|
42
42
|
*/
|
|
43
|
-
export interface DButtonSelectOptions<VALUE = unknown, DIALOG_VALUE = unknown,
|
|
43
|
+
export interface DButtonSelectOptions<VALUE = unknown, DIALOG_VALUE = unknown, DIALOG_CATEGORY_ID = unknown, DIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>, THEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>, EMITTER = any> extends DButtonOptions<VALUE | null, THEME, EMITTER> {
|
|
44
44
|
/**
|
|
45
45
|
* A function to retrieve a selected value from a dialog.
|
|
46
46
|
*/
|
|
@@ -53,7 +53,7 @@ export interface DButtonSelectOptions<VALUE = unknown, DIALOG_VALUE = unknown, D
|
|
|
53
53
|
/**
|
|
54
54
|
* A dialog to select values.
|
|
55
55
|
*/
|
|
56
|
-
dialog?: DDialogSelectOptions<DIALOG_VALUE,
|
|
56
|
+
dialog?: DDialogSelectOptions<DIALOG_VALUE, DIALOG_CATEGORY_ID> | DIALOG;
|
|
57
57
|
on?: DButtonSelectOnOptions<VALUE, EMITTER>;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
@@ -61,7 +61,7 @@ export interface DButtonSelectOptions<VALUE = unknown, DIALOG_VALUE = unknown, D
|
|
|
61
61
|
*/
|
|
62
62
|
export interface DThemeButtonSelect<VALUE = unknown> extends DThemeButton<VALUE | null> {
|
|
63
63
|
}
|
|
64
|
-
export declare class DButtonSelect<VALUE = unknown, DIALOG_VALUE = unknown,
|
|
64
|
+
export declare class DButtonSelect<VALUE = unknown, DIALOG_VALUE = unknown, DIALOG_CATEGORY_ID = unknown, DIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>, THEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>, OPTIONS extends DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG_CATEGORY_ID, DIALOG, THEME> = DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG_CATEGORY_ID, DIALOG, THEME>> extends DButton<VALUE | null, THEME, OPTIONS> {
|
|
65
65
|
protected _dialog?: DIALOG;
|
|
66
66
|
protected _dialogGetter: DButtonSelectGetter<VALUE, DIALOG>;
|
|
67
67
|
protected _dialogSetter: DButtonSelectSetter<VALUE, DIALOG>;
|
|
@@ -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(
|
|
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>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { utils } from "pixi.js";
|
|
2
2
|
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
3
3
|
import { DDialogSelectSearchDismissable, DDialogSelectSearhDismissableFilter, DDialogSelectSearhDismissableOptions } from "./d-dialog-select-search-dismissable";
|
|
4
|
-
export declare class DDialogSelectSearhDismissableImpl<VALUE,
|
|
5
|
-
protected _target: DDialogSelectSearch<VALUE,
|
|
4
|
+
export declare class DDialogSelectSearhDismissableImpl<VALUE, CATEGORY_ID> extends utils.EventEmitter implements DDialogSelectSearchDismissable<VALUE, CATEGORY_ID> {
|
|
5
|
+
protected _target: DDialogSelectSearch<VALUE, CATEGORY_ID>;
|
|
6
6
|
protected _args?: [string] | [string, CATEGORY_ID | null];
|
|
7
7
|
protected _value?: VALUE;
|
|
8
|
-
protected _filter?: DDialogSelectSearhDismissableFilter<VALUE,
|
|
9
|
-
constructor(target: DDialogSelectSearch<VALUE,
|
|
8
|
+
protected _filter?: DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID>;
|
|
9
|
+
constructor(target: DDialogSelectSearch<VALUE, CATEGORY_ID>, options: DDialogSelectSearhDismissableOptions<VALUE, CATEGORY_ID>);
|
|
10
10
|
protected toDismissValue(args?: [string] | [string, CATEGORY_ID | null]): VALUE | undefined;
|
|
11
11
|
protected toDismissable(values: VALUE[]): VALUE[];
|
|
12
12
|
create(args: [string] | [string, CATEGORY_ID | null]): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
2
|
-
export declare type DDialogSelectSearhDismissableFilter<VALUE,
|
|
3
|
-
export interface DDialogSelectSearhDismissableOptions<VALUE,
|
|
2
|
+
export declare type DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID> = (value: VALUE, word?: string, categoryId?: CATEGORY_ID | null) => boolean;
|
|
3
|
+
export interface DDialogSelectSearhDismissableOptions<VALUE, CATEGORY_ID> {
|
|
4
4
|
value: VALUE;
|
|
5
|
-
filter?: DDialogSelectSearhDismissableFilter<VALUE,
|
|
5
|
+
filter?: DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID>;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* {@link DDialogSelect} dismissable search object.
|
|
9
9
|
*/
|
|
10
|
-
export interface DDialogSelectSearchDismissable<VALUE,
|
|
10
|
+
export interface DDialogSelectSearchDismissable<VALUE, CATEGORY_ID> extends DDialogSelectSearch<VALUE, CATEGORY_ID> {
|
|
11
11
|
}
|
|
@@ -5,12 +5,12 @@ export declare type DDialogSelectSearchFunctionUncategorized<VALUE> = (word: str
|
|
|
5
5
|
/**
|
|
6
6
|
* {@link DDialogSelect} categorized search function.
|
|
7
7
|
*/
|
|
8
|
-
export declare type DDialogSelectSearchFunctionCategorized<VALUE,
|
|
8
|
+
export declare type DDialogSelectSearchFunctionCategorized<VALUE, CATEGORY_ID> = (word: string, categoryId: CATEGORY_ID | null) => Promise<VALUE[]>;
|
|
9
9
|
/**
|
|
10
10
|
* {@link DDialogSelect} search function.
|
|
11
11
|
*/
|
|
12
|
-
export declare type DDialogSelectSearchFunction<VALUE,
|
|
12
|
+
export declare type DDialogSelectSearchFunction<VALUE, CATEGORY_ID> = DDialogSelectSearchFunctionUncategorized<VALUE> | DDialogSelectSearchFunctionCategorized<VALUE, CATEGORY_ID>;
|
|
13
13
|
export declare const DDialogSelectSearchFunctions: {
|
|
14
|
-
isCategorized<VALUE,
|
|
15
|
-
toCategorized<VALUE_1,
|
|
14
|
+
isCategorized<VALUE, CATEGORY_ID>(search: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>): search is DDialogSelectSearchFunctionUncategorized<VALUE>;
|
|
15
|
+
toCategorized<VALUE_1, CATEGORY_ID_1>(search?: DDialogSelectSearchFunction<VALUE_1, CATEGORY_ID_1> | undefined): DDialogSelectSearchFunctionCategorized<VALUE_1, CATEGORY_ID_1>;
|
|
16
16
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { utils } from "pixi.js";
|
|
2
2
|
import { DDialogSelectSearchFunction } from "./d-dialog-select-search-function";
|
|
3
3
|
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
4
|
-
export declare class DDialogSelectSearhImpl<VALUE,
|
|
5
|
-
protected _search: DDialogSelectSearchFunction<VALUE,
|
|
4
|
+
export declare class DDialogSelectSearhImpl<VALUE, CATEGORY_ID> extends utils.EventEmitter implements DDialogSelectSearch<VALUE, CATEGORY_ID> {
|
|
5
|
+
protected _search: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>;
|
|
6
6
|
protected _id: number;
|
|
7
7
|
protected _idCompleted: number;
|
|
8
|
-
constructor(search?: DDialogSelectSearchFunction<VALUE,
|
|
8
|
+
constructor(search?: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>);
|
|
9
9
|
create(args: [string] | [string, CATEGORY_ID | null]): void;
|
|
10
10
|
isDone(): boolean;
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* {@link DDialogSelect} search object.
|
|
3
3
|
*/
|
|
4
|
-
export interface DDialogSelectSearch<VALUE,
|
|
4
|
+
export interface DDialogSelectSearch<VALUE, CATEGORY_ID> {
|
|
5
5
|
create(args: [string] | [string, CATEGORY_ID | null]): void;
|
|
6
6
|
on(event: "success", handler: (e: unknown, searchResults: VALUE[]) => void): void;
|
|
7
7
|
on(event: "fail", handler: () => void): void;
|
|
@@ -19,9 +19,8 @@ export interface DDialogSelectInputOpitons extends DInputSearchOptions {
|
|
|
19
19
|
/**
|
|
20
20
|
* {@link DDialogSelect} controller.
|
|
21
21
|
*/
|
|
22
|
-
export interface DDialogSelectController<VALUE,
|
|
23
|
-
search: DDialogSelectSearch<VALUE,
|
|
24
|
-
getCategories?: () => CATEGORY[] | Promise<CATEGORY[]>;
|
|
22
|
+
export interface DDialogSelectController<VALUE, CATEGORY_ID> {
|
|
23
|
+
search: DDialogSelectSearch<VALUE, CATEGORY_ID> | DDialogSelectSearchFunction<VALUE, CATEGORY_ID>;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* {@link DDialogSelect} note options.
|
|
@@ -39,12 +38,23 @@ export declare type DDialogSelectItemIsEqual<VALUE> = (a: VALUE, b: VALUE, calle
|
|
|
39
38
|
export interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvents<VALUE, EMITTER> {
|
|
40
39
|
select(value: VALUE, self: EMITTER): void;
|
|
41
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* {@link DDialogSelect} category dismiss options.
|
|
43
|
+
*/
|
|
44
|
+
export interface DDialogSelectCategoryDismissOptions {
|
|
45
|
+
enable?: boolean;
|
|
46
|
+
label?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DDialogSelectCategory<CATEGORY_ID> {
|
|
49
|
+
id: CATEGORY_ID;
|
|
50
|
+
label: string;
|
|
51
|
+
}
|
|
42
52
|
/**
|
|
43
53
|
* {@link DDialogSelect} category options.
|
|
44
54
|
*/
|
|
45
|
-
export interface DDialogSelectCategoryOptions<VALUE,
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
export interface DDialogSelectCategoryOptions<VALUE, CATEGORY_ID> extends DSelectOptions<CATEGORY_ID | null> {
|
|
56
|
+
dismiss?: DDialogSelectCategoryDismissOptions;
|
|
57
|
+
items?: DDialogSelectCategory<CATEGORY_ID>[];
|
|
48
58
|
}
|
|
49
59
|
/**
|
|
50
60
|
* {@link DDialogSelect} "on" options.
|
|
@@ -54,10 +64,10 @@ export interface DDialogSelectOnOptions<VALUE, EMITTER> extends Partial<DDialogS
|
|
|
54
64
|
/**
|
|
55
65
|
* {@link DDialogSelect} options.
|
|
56
66
|
*/
|
|
57
|
-
export interface DDialogSelectOptions<VALUE,
|
|
58
|
-
controller?: DDialogSelectController<VALUE,
|
|
59
|
-
category?: DDialogSelectCategoryOptions<VALUE,
|
|
60
|
-
dismiss?: DDialogSelectSearhDismissableOptions<VALUE,
|
|
67
|
+
export interface DDialogSelectOptions<VALUE, CATEGORY_ID = unknown, THEME extends DThemeDialogSelect<VALUE, CATEGORY_ID> = DThemeDialogSelect<VALUE, CATEGORY_ID>, EMITTER = any> extends DDialogLayeredOptions<VALUE, THEME> {
|
|
68
|
+
controller?: DDialogSelectController<VALUE, CATEGORY_ID>;
|
|
69
|
+
category?: DDialogSelectCategoryOptions<VALUE, CATEGORY_ID>;
|
|
70
|
+
dismiss?: DDialogSelectSearhDismissableOptions<VALUE, CATEGORY_ID>;
|
|
61
71
|
input?: DDialogSelectInputOpitons;
|
|
62
72
|
list?: DListOptions<VALUE>;
|
|
63
73
|
note?: DDialogSelectNoteOptions;
|
|
@@ -66,21 +76,22 @@ export interface DDialogSelectOptions<VALUE, CATEGORY = unknown, CATEGORY_ID = u
|
|
|
66
76
|
/**
|
|
67
77
|
* {@link DDialogSelect} theme.
|
|
68
78
|
*/
|
|
69
|
-
export interface DThemeDialogSelect<VALUE = unknown,
|
|
79
|
+
export interface DThemeDialogSelect<VALUE = unknown, CATEGORY_ID = unknown> extends DThemeDialogLayered {
|
|
70
80
|
getInputMargin(): number;
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
isCategoryDismissable(): boolean;
|
|
82
|
+
getCategoryDismissLabel(): string;
|
|
73
83
|
}
|
|
74
|
-
export declare class DDialogSelect<VALUE = unknown,
|
|
84
|
+
export declare class DDialogSelect<VALUE = unknown, CATEGORY_ID = unknown, THEME extends DThemeDialogSelect<VALUE, CATEGORY_ID> = DThemeDialogSelect<VALUE, CATEGORY_ID>, OPTIONS extends DDialogSelectOptions<VALUE, CATEGORY_ID, THEME> = DDialogSelectOptions<VALUE, CATEGORY_ID, THEME>> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {
|
|
75
85
|
protected _value: VALUE | null;
|
|
76
86
|
protected _spaceLeft?: DLayoutSpace;
|
|
77
87
|
protected _spaceRight?: DLayoutSpace;
|
|
78
|
-
protected _selectCategory?: DSelect<CATEGORY_ID | null
|
|
88
|
+
protected _selectCategory?: DSelect<CATEGORY_ID | null>;
|
|
79
89
|
protected _isCategoryFetched?: boolean;
|
|
90
|
+
protected _categories: DDialogSelectCategory<CATEGORY_ID>[];
|
|
80
91
|
protected _input?: DInputSearch;
|
|
81
92
|
protected _inputLayout?: DLayoutHorizontal;
|
|
82
93
|
protected _list?: DDialogSelectList<VALUE>;
|
|
83
|
-
protected _search?: DDialogSelectSearch<VALUE,
|
|
94
|
+
protected _search?: DDialogSelectSearch<VALUE, CATEGORY_ID>;
|
|
84
95
|
protected _noteError?: DNote | null;
|
|
85
96
|
protected _noteNoItemsFound?: DNote | null;
|
|
86
97
|
protected _noteSearching?: DNote | null;
|
|
@@ -91,8 +102,8 @@ export declare class DDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY
|
|
|
91
102
|
protected get spaceLeft(): DLayoutSpace;
|
|
92
103
|
protected get spaceRight(): DLayoutSpace;
|
|
93
104
|
protected newSpace(): DLayoutSpace;
|
|
94
|
-
protected get selectCategory(): DSelect<CATEGORY_ID | null
|
|
95
|
-
protected newSelectCategory(): DSelect<CATEGORY_ID | null
|
|
105
|
+
protected get selectCategory(): DSelect<CATEGORY_ID | null>;
|
|
106
|
+
protected newSelectCategory(): DSelect<CATEGORY_ID | null>;
|
|
96
107
|
protected toSelectCategoryOptions(theme: THEME, options?: OPTIONS): DSelectOptions<CATEGORY_ID | null>;
|
|
97
108
|
protected onSelectCategoryChange(categoryId: CATEGORY_ID): void;
|
|
98
109
|
get input(): DInputSearch;
|
|
@@ -111,17 +122,16 @@ export declare class DDialogSelect<VALUE = unknown, CATEGORY = unknown, CATEGORY
|
|
|
111
122
|
protected get noteSearching(): DNote | null;
|
|
112
123
|
protected newNoteSearching(): DNote | null;
|
|
113
124
|
protected toNoteOptions(parent: DBase, options?: DNoteOptions): DNoteOptions;
|
|
114
|
-
protected get search(): DDialogSelectSearch<VALUE,
|
|
115
|
-
protected newSearch(): DDialogSelectSearch<VALUE,
|
|
125
|
+
protected get search(): DDialogSelectSearch<VALUE, CATEGORY_ID>;
|
|
126
|
+
protected newSearch(): DDialogSelectSearch<VALUE, CATEGORY_ID>;
|
|
116
127
|
get value(): VALUE | null;
|
|
117
128
|
protected onSearched(results: VALUE[]): void;
|
|
118
129
|
protected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null>;
|
|
119
130
|
protected getType(): string;
|
|
120
131
|
protected onOpen(): void;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
protected
|
|
124
|
-
protected findCategories(): Promise<CATEGORY[]> | CATEGORY[] | null;
|
|
132
|
+
get categories(): DDialogSelectCategory<CATEGORY_ID>[];
|
|
133
|
+
set categories(categories: DDialogSelectCategory<CATEGORY_ID>[]);
|
|
134
|
+
protected onCategoriesChange(categories: DDialogSelectCategory<CATEGORY_ID>[]): void;
|
|
125
135
|
protected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void;
|
|
126
136
|
destroy(): void;
|
|
127
137
|
}
|
|
@@ -6,6 +6,6 @@ export declare class DThemeDarkDialogSelect<VALUE> extends DThemeDarkDialogLayer
|
|
|
6
6
|
getWidth(): DCoordinateSize;
|
|
7
7
|
getFooter(): DDialogLayeredFooterOptions | undefined | null;
|
|
8
8
|
getInputMargin(): number;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
isCategoryDismissable(): boolean;
|
|
10
|
+
getCategoryDismissLabel(): string;
|
|
11
11
|
}
|
|
@@ -6,6 +6,6 @@ export declare class DThemeWhiteDialogSelect<VALUE> extends DThemeWhiteDialogLay
|
|
|
6
6
|
getWidth(): DCoordinateSize;
|
|
7
7
|
getFooter(): DDialogLayeredFooterOptions | undefined | null;
|
|
8
8
|
getInputMargin(): number;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
isCategoryDismissable(): boolean;
|
|
10
|
+
getCategoryDismissLabel(): string;
|
|
11
11
|
}
|
|
@@ -47,7 +47,7 @@ var DButtonSelect = /** @class */ (function (_super) {
|
|
|
47
47
|
dialog = options;
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
// Assumes DIALOG === DDialogSelect<DIALOG_VALUE,
|
|
50
|
+
// Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.
|
|
51
51
|
dialog = new DDialogSelect(options);
|
|
52
52
|
}
|
|
53
53
|
this._dialog = dialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-button-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-button-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,OAAO,EAA+C,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"d-button-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-button-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,OAAO,EAA+C,MAAM,YAAY,CAAC;AAElF,OAAO,EAAE,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AA8ExE,IAAM,aAAa,GAAG,UAAC,MAAgC;IACtD,qCAAqC;IACrC,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG;IACrB,aAAa;AACd,CAAC,CAAC;AAEF;IAaU,iCAAqC;IAK9C,uBAAY,OAAiB;QAA7B,iBAIC;;gBAHA,kBAAM,OAAO,CA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OAAO,MAAM,CAAC;QACf,CAAC;;;OAAA;IAED,sBAAI,gCAAK;aAAT;;YACC,OAAO,MAAA,IAAI,CAAC,kBAAkB,mCAAI,IAAI,CAAC;QACxC,CAAC;aAED,UAAU,KAAmB;YAC5B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACnB,CAAC;;;OAJA;IAMS,+BAAO,GAAjB;QACC,OAAO,eAAe,CAAC;IACxB,CAAC;IACF,oBAAC;AAAD,CAAC,AApED,CAaU,OAAO,GAuDhB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction } from \"pixi.js\";\nimport { DButton, DButtonEvents, DButtonOptions, DThemeButton } from \"./d-button\";\nimport { DDialogOpener } from \"./d-dialog\";\nimport { DDialogSelect, DDialogSelectOptions } from \"./d-dialog-select\";\nimport { DOnOptions } from \"./d-on-options\";\n\n/**\n * A dialog to select values.\n */\nexport interface DButtonSelectDialog<VALUE> {\n\treadonly value: VALUE | null;\n\topen(opener?: DDialogOpener): Promise<unknown>;\n}\n\n/**\n * A function to retrieve a selected value from a dialog.\n */\nexport type DButtonSelectGetter<VALUE, DIALOG> = (dialog: DIALOG) => VALUE | null;\n\n/**\n * A function to set a selecte value to a dialog.\n * Called before opening a dialog.\n */\nexport type DButtonSelectSetter<VALUE, DIALOG> = (dialog: DIALOG, value: VALUE | null) => void;\n\n/**\n * {@link DButtonSelect} events.\n */\nexport interface DButtonSelectEvents<VALUE, EMITTER> extends DButtonEvents<VALUE, 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 emitter an emitter\n\t */\n\tchange(newValue: VALUE | null, oldValue: VALUE | null, emitter: EMITTER): void;\n}\n\n/**\n * {@link DButtonSelect} \"on\" options.\n */\nexport interface DButtonSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DButtonSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DButtonSelect} options.\n */\nexport interface DButtonSelectOptions<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tEMITTER = any\n> extends DButtonOptions<VALUE | null, THEME, EMITTER> {\n\t/**\n\t * A function to retrieve a selected value from a dialog.\n\t */\n\tgetter?: DButtonSelectGetter<VALUE, DIALOG>;\n\n\t/**\n\t * A function to set a selected value to a dialog.\n\t * Called before opening a dialog.\n\t */\n\tsetter?: DButtonSelectSetter<VALUE, DIALOG>;\n\n\t/**\n\t * A dialog to select values.\n\t */\n\tdialog?: DDialogSelectOptions<DIALOG_VALUE, DIALOG_CATEGORY_ID> | DIALOG;\n\n\ton?: DButtonSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DButtonSelect} theme.\n */\nexport interface DThemeButtonSelect<VALUE = unknown> extends DThemeButton<VALUE | null> {}\n\nconst defaultGetter = (dialog: DButtonSelectDialog<any>): any => {\n\t// Assumes the dialog.value is VALUE.\n\treturn dialog.value;\n};\n\nconst defaultSetter = (): void => {\n\t// DO NOTHING\n};\n\nexport class DButtonSelect<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG_CATEGORY_ID = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tOPTIONS extends DButtonSelectOptions<\n\t\tVALUE,\n\t\tDIALOG_VALUE,\n\t\tDIALOG_CATEGORY_ID,\n\t\tDIALOG,\n\t\tTHEME\n\t> = DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG_CATEGORY_ID, DIALOG, THEME>\n> extends DButton<VALUE | null, THEME, OPTIONS> {\n\tprotected _dialog?: DIALOG;\n\tprotected _dialogGetter: DButtonSelectGetter<VALUE, DIALOG>;\n\tprotected _dialogSetter: DButtonSelectSetter<VALUE, DIALOG>;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\t\tthis._dialogGetter = options?.getter ?? defaultGetter;\n\t\tthis._dialogSetter = options?.setter ?? defaultSetter;\n\t}\n\n\tprotected onActivate(\n\t\te?: interaction.InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent\n\t): void {\n\t\tsuper.onActivate(e);\n\t\tconst dialog = this.dialog;\n\t\tconst oldValue = this._textValueComputed ?? null;\n\t\tthis._dialogSetter(dialog, oldValue);\n\t\tdialog.open(this).then((): void => {\n\t\t\tconst newValue = this._dialogGetter(dialog);\n\t\t\tif (newValue !== oldValue) {\n\t\t\t\tthis.text = newValue;\n\t\t\t\tthis.emit(\"change\", newValue, oldValue, this);\n\t\t\t}\n\t\t});\n\t}\n\n\tget dialog(): DIALOG {\n\t\tlet dialog = this._dialog;\n\t\tif (dialog == null) {\n\t\t\tconst options = this._options?.dialog;\n\t\t\tif (options && \"open\" in options) {\n\t\t\t\tdialog = options;\n\t\t\t} else {\n\t\t\t\t// Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.\n\t\t\t\tdialog = new DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>(\n\t\t\t\t\toptions\n\t\t\t\t) as any as DIALOG;\n\t\t\t}\n\t\t\tthis._dialog = dialog;\n\t\t}\n\t\treturn dialog;\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._textValueComputed ?? null;\n\t}\n\n\tset value(value: VALUE | null) {\n\t\tthis.text = value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DButtonSelect\";\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-diagram-canvas-editor.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/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AES,sCAAO,GAAjB;QACC,OAAO,sBAAsB,CAAC;IAC/B,CAAC;IACF,2BAAC;AAAD,CAAC,
|
|
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,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EACN,wBAAwB,EAGxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAGN,yBAAyB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgB5C;IAGU,wCAAkC;IAI3C,8BAAY,OAAgB;QAA5B,YACC,kBAAM,OAAO,CAAC,SAEd;QADA,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,MAAM,CAAC,KAAI,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;;IACpD,CAAC;IAES,qCAAM,GAAhB,UACC,KAAY,EACZ,OAAyC;QAEzC,IAAI,OAAO,EAAE;YACZ,OAAO,IAAI,wBAAwB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,sBAAI,sCAAI;aAAR;YACC,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;;;OAAA;IAED,sBAAI,uCAAK;aAAT;YACC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YACzB,IAAI,MAAM,IAAI,IAAI,EAAE;gBACnB,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;aACrB;YACD,OAAO,MAAM,CAAC;QACf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AAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,EAAE;SACjC,CAAC;IACH,CAAC;IAED,uCAAQ,GAAR;;QACC,iBAAM,QAAQ,WAAE,CAAC;QACjB,MAAA,IAAI,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 (
|
|
170
|
+
DDiagramEditor.prototype.create = function (options) {
|
|
171
171
|
return this.set({
|
|
172
172
|
version: DDiagramSerializedVersion,
|
|
173
173
|
id: undefined,
|
|
174
|
-
name: name,
|
|
175
|
-
|
|
176
|
-
|
|
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: [[
|
|
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,8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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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E,KAAI,CAAC,CAAC;gBAChC,OAAO,MAAM,CAAC;YACf,CAAC,EACD,UAAC,MAAc;gBACd,KAAI,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,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select-search-dismissable-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-dismissable-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQhC;IACS,qDAAkB;IAS1B,2CACC,
|
|
1
|
+
{"version":3,"file":"d-dialog-select-search-dismissable-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-dismissable-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAQhC;IACS,qDAAkB;IAS1B,2CACC,MAA+C,EAC/C,OAAiE;QAFlE,YAIC,iBAAO,SAeP;QAbA,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,KAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;QAE9B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE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AAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC;IACf,CAAC;IAED,kDAAM,GAAN,UAAO,IAA6C;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,kDAAM,GAAN;QACC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IACF,wCAAC;AAAD,CAAC,AAnED,CACS,KAAK,CAAC,YAAY,GAkE1B","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\nimport {\n\tDDialogSelectSearchDismissable,\n\tDDialogSelectSearhDismissableFilter,\n\tDDialogSelectSearhDismissableOptions\n} from \"./d-dialog-select-search-dismissable\";\n\nexport class DDialogSelectSearhDismissableImpl<VALUE, CATEGORY_ID>\n\textends utils.EventEmitter\n\timplements DDialogSelectSearchDismissable<VALUE, CATEGORY_ID>\n{\n\tprotected _target: DDialogSelectSearch<VALUE, CATEGORY_ID>;\n\n\tprotected _args?: [string] | [string, CATEGORY_ID | null];\n\tprotected _value?: VALUE;\n\tprotected _filter?: DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID>;\n\n\tconstructor(\n\t\ttarget: DDialogSelectSearch<VALUE, CATEGORY_ID>,\n\t\toptions: DDialogSelectSearhDismissableOptions<VALUE, CATEGORY_ID>\n\t) {\n\t\tsuper();\n\n\t\tthis._target = target;\n\t\tthis._value = options.value;\n\t\tthis._filter = options.filter;\n\n\t\ttarget.on(\"change\", (): void => {\n\t\t\tthis.emit(\"change\", this);\n\t\t});\n\t\ttarget.on(\"success\", (e, values): void => {\n\t\t\tthis.emit(\"success\", this, this.toDismissable(values));\n\t\t});\n\t\ttarget.on(\"fail\", (): void => {\n\t\t\tthis.emit(\"fail\", this);\n\t\t});\n\t}\n\n\tprotected toDismissValue(args?: [string] | [string, CATEGORY_ID | null]): VALUE | undefined {\n\t\tif (args == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst value = this._value;\n\t\tif (value === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst filter = this._filter;\n\t\tif (filter != null && !filter(value, args[0])) {\n\t\t\treturn;\n\t\t}\n\t\treturn value;\n\t}\n\n\tprotected toDismissable(values: VALUE[]): VALUE[] {\n\t\tconst value = this.toDismissValue(this._args);\n\t\tif (value === undefined) {\n\t\t\treturn values;\n\t\t}\n\t\tconst result: VALUE[] = [];\n\t\tfor (let i = 0, imax = values.length; i < imax; ++i) {\n\t\t\tresult.push(values[i]);\n\t\t}\n\t\tresult.push(value);\n\t\treturn result;\n\t}\n\n\tcreate(args: [string] | [string, CATEGORY_ID | null]): void {\n\t\tthis._args = args;\n\t\tthis._target.create(args);\n\t}\n\n\tisDone(): boolean {\n\t\treturn this._target.isDone();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select-search-dismissable.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-dismissable.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\n\nexport type DDialogSelectSearhDismissableFilter<VALUE,
|
|
1
|
+
{"version":3,"file":"d-dialog-select-search-dismissable.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-dismissable.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\n\nexport type DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID> = (\n\tvalue: VALUE,\n\tword?: string,\n\tcategoryId?: CATEGORY_ID | null\n) => boolean;\n\nexport interface DDialogSelectSearhDismissableOptions<VALUE, CATEGORY_ID> {\n\tvalue: VALUE;\n\tfilter?: DDialogSelectSearhDismissableFilter<VALUE, CATEGORY_ID>;\n}\n\n/**\n * {@link DDialogSelect} dismissable search object.\n */\nexport interface DDialogSelectSearchDismissable<VALUE, CATEGORY_ID>\n\textends DDialogSelectSearch<VALUE, CATEGORY_ID> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select-search-function.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,MAAM,CAAC,IAAM,4BAA4B,GAAG;IAC3C,aAAa,EAAb,UACC,
|
|
1
|
+
{"version":3,"file":"d-dialog-select-search-function.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,MAAM,CAAC,IAAM,4BAA4B,GAAG;IAC3C,aAAa,EAAb,UACC,MAAuD;QAEvD,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,aAAa,EAAb,UACC,MAAwD;QAExD,IAAI,MAAM,IAAI,IAAI,EAAE;YACnB,OAAO,UAAC,IAAY,EAAE,UAA8B,IAAK,OAAA,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAnB,CAAmB,CAAC;SAC7E;aAAM,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;YACtC,OAAO,UAAC,IAAY,EAAE,UAA8B;gBACnD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC;SACF;aAAM;YACN,OAAO,MAAM,CAAC;SACd;IACF,CAAC;CACD,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * {@link DDialogSelect} uncategorized search function.\n */\nexport type DDialogSelectSearchFunctionUncategorized<VALUE> = (word: string) => Promise<VALUE[]>;\n\n/**\n * {@link DDialogSelect} categorized search function.\n */\nexport type DDialogSelectSearchFunctionCategorized<VALUE, CATEGORY_ID> = (\n\tword: string,\n\tcategoryId: CATEGORY_ID | null\n) => Promise<VALUE[]>;\n\n/**\n * {@link DDialogSelect} search function.\n */\nexport type DDialogSelectSearchFunction<VALUE, CATEGORY_ID> =\n\t| DDialogSelectSearchFunctionUncategorized<VALUE>\n\t| DDialogSelectSearchFunctionCategorized<VALUE, CATEGORY_ID>;\n\nexport const DDialogSelectSearchFunctions = {\n\tisCategorized<VALUE, CATEGORY_ID>(\n\t\tsearch: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>\n\t): search is DDialogSelectSearchFunctionUncategorized<VALUE> {\n\t\treturn search.length <= 1;\n\t},\n\n\ttoCategorized<VALUE, CATEGORY_ID>(\n\t\tsearch?: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>\n\t): DDialogSelectSearchFunctionCategorized<VALUE, CATEGORY_ID> {\n\t\tif (search == null) {\n\t\t\treturn (word: string, categoryId: CATEGORY_ID | null) => Promise.resolve([]);\n\t\t} else if (this.isCategorized(search)) {\n\t\t\treturn (word: string, categoryId: CATEGORY_ID | null) => {\n\t\t\t\treturn search(word);\n\t\t\t};\n\t\t} else {\n\t\t\treturn search;\n\t\t}\n\t}\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select-search-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAEN,4BAA4B,EAC5B,MAAM,mCAAmC,CAAC;AAG3C;IACS,0CAAkB;IAO1B,gCAAY,
|
|
1
|
+
{"version":3,"file":"d-dialog-select-search-impl.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search-impl.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAEN,4BAA4B,EAC5B,MAAM,mCAAmC,CAAC;AAG3C;IACS,0CAAkB;IAO1B,gCAAY,MAAwD;QAApE,YACC,iBAAO,SAKP;QAHA,KAAI,CAAC,OAAO,GAAG,4BAA4B,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAClE,KAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,KAAI,CAAC,YAAY,GAAG,CAAC,CAAC;;IACvB,CAAC;IAED,uCAAM,GAAN,UAAO,IAA6C;QAApD,iBAmBC;;QAlBA,IAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAA,IAAI,CAAC,CAAC,CAAC,mCAAI,IAAI,CAAC,CAAC,IAAI,CAC1C,UAAC,YAAqB;YACrB,IAAI,KAAI,CAAC,GAAG,KAAK,EAAE,EAAE;gBACpB,KAAI,CAAC,YAAY,GAAG,EAAE,CAAC;gBACvB,KAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAI,EAAE,YAAY,CAAC,CAAC;gBACzC,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;aAC1B;QACF,CAAC,EACD;YACC,IAAI,KAAI,CAAC,GAAG,KAAK,EAAE,EAAE;gBACpB,KAAI,CAAC,YAAY,GAAG,EAAE,CAAC;gBACvB,KAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAI,CAAC,CAAC;gBACxB,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;aAC1B;QACF,CAAC,CACD,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,uCAAM,GAAN;QACC,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC;IACvC,CAAC;IACF,6BAAC;AAAD,CAAC,AAxCD,CACS,KAAK,CAAC,YAAY,GAuC1B","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { utils } from \"pixi.js\";\nimport {\n\tDDialogSelectSearchFunction,\n\tDDialogSelectSearchFunctions\n} from \"./d-dialog-select-search-function\";\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\n\nexport class DDialogSelectSearhImpl<VALUE, CATEGORY_ID>\n\textends utils.EventEmitter\n\timplements DDialogSelectSearch<VALUE, CATEGORY_ID>\n{\n\tprotected _search: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>;\n\tprotected _id: number;\n\tprotected _idCompleted: number;\n\n\tconstructor(search?: DDialogSelectSearchFunction<VALUE, CATEGORY_ID>) {\n\t\tsuper();\n\n\t\tthis._search = DDialogSelectSearchFunctions.toCategorized(search);\n\t\tthis._id = 0;\n\t\tthis._idCompleted = 0;\n\t}\n\n\tcreate(args: [string] | [string, CATEGORY_ID | null]): void {\n\t\tconst id = ++this._id;\n\t\tthis._search(args[0], args[1] ?? null).then(\n\t\t\t(searchResult: VALUE[]) => {\n\t\t\t\tif (this._id === id) {\n\t\t\t\t\tthis._idCompleted = id;\n\t\t\t\t\tthis.emit(\"success\", this, searchResult);\n\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (this._id === id) {\n\t\t\t\t\tthis._idCompleted = id;\n\t\t\t\t\tthis.emit(\"fail\", this);\n\t\t\t\t\tthis.emit(\"change\", this);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tthis.emit(\"change\", this);\n\t}\n\n\tisDone(): boolean {\n\t\treturn this._id === this._idCompleted;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select-search.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * {@link DDialogSelect} search object.\n */\nexport interface DDialogSelectSearch<VALUE,
|
|
1
|
+
{"version":3,"file":"d-dialog-select-search.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select-search.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * {@link DDialogSelect} search object.\n */\nexport interface DDialogSelectSearch<VALUE, CATEGORY_ID> {\n\tcreate(args: [string] | [string, CATEGORY_ID | null]): void;\n\ton(event: \"success\", handler: (e: unknown, searchResults: VALUE[]) => void): void;\n\ton(event: \"fail\", handler: () => void): void;\n\ton(event: \"change\", handler: () => void): void;\n\tisDone(): boolean;\n}\n"]}
|