@wcardinal/wcardinal-ui 0.165.0 → 0.168.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 +4 -3
- package/dist/types/wcardinal/ui/d-dialog.d.ts +18 -5
- package/dist/types/wcardinal/ui/d-table-column.d.ts +2 -2
- 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-dialog.js +71 -23
- package/dist/wcardinal/ui/d-dialog.js.map +1 -1
- package/dist/wcardinal/ui/d-image-base.js +3 -1
- package/dist/wcardinal/ui/d-image-base.js.map +1 -1
- package/dist/wcardinal/ui/d-table-column.js.map +1 -1
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog.js +1 -7
- package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/d-theme-white-dialog.js +1 -7
- package/dist/wcardinal/ui/theme/white/d-theme-white-dialog.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +2 -8
- 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 +2 -8
- 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 +3973 -3936
- package/dist/wcardinal-ui.js +19043 -18994
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { interaction } from "pixi.js";
|
|
2
2
|
import { DButton, DButtonEvents, DButtonOptions, DThemeButton } from "./d-button";
|
|
3
|
+
import { DDialogOpener } from "./d-dialog";
|
|
3
4
|
import { DDialogSelectOptions } from "./d-dialog-select";
|
|
4
5
|
import { DOnOptions } from "./d-on-options";
|
|
5
6
|
/**
|
|
@@ -7,7 +8,7 @@ import { DOnOptions } from "./d-on-options";
|
|
|
7
8
|
*/
|
|
8
9
|
export interface DButtonSelectDialog<VALUE> {
|
|
9
10
|
readonly value: VALUE | null;
|
|
10
|
-
open(): Promise<unknown>;
|
|
11
|
+
open(opener?: DDialogOpener): Promise<unknown>;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* A function to retrieve a selected value from a dialog.
|
|
@@ -39,7 +40,7 @@ export interface DButtonSelectOnOptions<VALUE, EMITTER> extends Partial<DButtonS
|
|
|
39
40
|
/**
|
|
40
41
|
* {@link DButtonSelect} options.
|
|
41
42
|
*/
|
|
42
|
-
export interface DButtonSelectOptions<VALUE
|
|
43
|
+
export interface DButtonSelectOptions<VALUE = unknown, DIALOG_VALUE = unknown, DIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>, THEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>, EMITTER = any> extends DButtonOptions<VALUE | null, THEME, EMITTER> {
|
|
43
44
|
/**
|
|
44
45
|
* A function to retrieve a selected value from a dialog.
|
|
45
46
|
*/
|
|
@@ -60,7 +61,7 @@ export interface DButtonSelectOptions<VALUE extends unknown = unknown, DIALOG_VA
|
|
|
60
61
|
*/
|
|
61
62
|
export interface DThemeButtonSelect<VALUE = unknown> extends DThemeButton<VALUE | null> {
|
|
62
63
|
}
|
|
63
|
-
export declare class DButtonSelect<VALUE
|
|
64
|
+
export declare class DButtonSelect<VALUE = unknown, DIALOG_VALUE = unknown, DIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>, THEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>, OPTIONS extends DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG, THEME> = DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG, THEME>> extends DButton<VALUE | null, THEME, OPTIONS> {
|
|
64
65
|
protected _dialog?: DIALOG;
|
|
65
66
|
protected _dialogGetter: DButtonSelectGetter<VALUE, DIALOG>;
|
|
66
67
|
protected _dialogSetter: DButtonSelectSetter<VALUE, DIALOG>;
|
|
@@ -37,7 +37,7 @@ export interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER
|
|
|
37
37
|
* {@link DDialog} options.
|
|
38
38
|
*/
|
|
39
39
|
export interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any> extends DBaseOptions<THEME> {
|
|
40
|
-
closeOn?: DDialogCloseOn;
|
|
40
|
+
closeOn?: DDialogCloseOn | Array<keyof typeof DDialogCloseOn> | keyof typeof DDialogCloseOn;
|
|
41
41
|
animation?: DAnimation<DBase>;
|
|
42
42
|
/**
|
|
43
43
|
* A dialog mode.
|
|
@@ -45,7 +45,7 @@ export interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITT
|
|
|
45
45
|
mode?: DDialogMode | keyof typeof DDialogMode;
|
|
46
46
|
sticky?: boolean;
|
|
47
47
|
gesture?: boolean | DDialogGestureOptions;
|
|
48
|
-
align?: DDialogAlign | null;
|
|
48
|
+
align?: DDialogAlign | null | keyof typeof DDialogAlign;
|
|
49
49
|
/**
|
|
50
50
|
* Mappings of event names and handlers.
|
|
51
51
|
*/
|
|
@@ -65,7 +65,7 @@ export interface DThemeDialog extends DThemeBase {
|
|
|
65
65
|
getAlign(mode: DDialogMode): DDialogAlign | null;
|
|
66
66
|
newAnimation(mode: DDialogMode): DAnimation<DBase> | null;
|
|
67
67
|
}
|
|
68
|
-
export interface
|
|
68
|
+
export interface DDialogOpener {
|
|
69
69
|
getBounds(skipUpdate: boolean, result: Rectangle): Rectangle;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -89,18 +89,31 @@ export declare class DDialog<VALUE = void, THEME extends DThemeDialog = DThemeDi
|
|
|
89
89
|
protected _sticky: boolean;
|
|
90
90
|
protected _onPrerenderBound: () => void;
|
|
91
91
|
protected _align: DDialogAlign | null;
|
|
92
|
-
protected
|
|
92
|
+
protected _opener?: DDialogOpener | null;
|
|
93
93
|
protected _gesture: DDialogGesture<this>;
|
|
94
94
|
protected _layer: DApplicationLayerLike | null;
|
|
95
95
|
protected init(options?: OPTIONS): void;
|
|
96
|
+
protected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn;
|
|
97
|
+
protected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null;
|
|
96
98
|
get mode(): DDialogMode;
|
|
99
|
+
get align(): DDialogAlign | null;
|
|
100
|
+
set algin(align: DDialogAlign | null);
|
|
97
101
|
get gesture(): DDialogGesture<this>;
|
|
98
102
|
get layer(): DApplicationLayerLike | null;
|
|
99
103
|
protected toGestureOptions(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogGestureOptions;
|
|
100
104
|
onParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void;
|
|
101
105
|
protected getAnimation(): DAnimation | null;
|
|
102
106
|
protected onAnimationEnd(isReverse: boolean): void;
|
|
103
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Opens a dialog.
|
|
109
|
+
*
|
|
110
|
+
* @param opener An opener of a dialog.
|
|
111
|
+
* The dialog position is determined based on a position and a size of the opener.
|
|
112
|
+
* If the opener is undefined, the dialog is placed at the center of the screen.
|
|
113
|
+
*
|
|
114
|
+
* @returns a value of this dialog
|
|
115
|
+
*/
|
|
116
|
+
open(opener?: DDialogOpener): Promise<VALUE>;
|
|
104
117
|
protected onPrerender(): void;
|
|
105
118
|
protected onOpen(): void;
|
|
106
119
|
isOpened(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DAlignHorizontal } from "./d-align-horizontal";
|
|
2
|
-
import {
|
|
2
|
+
import { DDialogOpener } from "./d-dialog";
|
|
3
3
|
import { DDialogSelectOptions } from "./d-dialog-select";
|
|
4
4
|
import { DMenu, DMenuOptions } from "./d-menu";
|
|
5
5
|
import { DTableBodyCellButtonOptions } from "./d-table-body-cell-button";
|
|
@@ -72,7 +72,7 @@ export interface DTableColumnSorting<ROW_VALUE> {
|
|
|
72
72
|
}
|
|
73
73
|
export interface DTableColumnSelectingDialog<DIALOG_VALUE> {
|
|
74
74
|
readonly value: DIALOG_VALUE;
|
|
75
|
-
open(owner?:
|
|
75
|
+
open(owner?: DDialogOpener): Promise<DIALOG_VALUE>;
|
|
76
76
|
}
|
|
77
77
|
export interface DTableColumnSelectingOptions<CELL_VALUE, DIALOG_VALUE, DIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE>> {
|
|
78
78
|
getter?: DTableSelectingGetter<CELL_VALUE, DIALOG>;
|
|
@@ -64,7 +64,7 @@ var DButtonSelect = /** @class */ (function (_super) {
|
|
|
64
64
|
var dialog = this.dialog;
|
|
65
65
|
var oldValue = (_a = this._textValueComputed) !== null && _a !== void 0 ? _a : null;
|
|
66
66
|
this._dialogSetter(dialog, oldValue);
|
|
67
|
-
dialog.open().then(function () {
|
|
67
|
+
dialog.open(this).then(function () {
|
|
68
68
|
var newValue = _this._dialogGetter(dialog);
|
|
69
69
|
if (newValue !== oldValue) {
|
|
70
70
|
_this.text = newValue;
|
|
@@ -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;
|
|
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;AA6ExE,IAAM,aAAa,GAAG,UAAC,MAAgC;IACtD,qCAAqC;IACrC,OAAO,MAAM,C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,IAAI,OAAO,EAAE;oBACjC,MAAM,GAAG,OAAO,CAAC;iBACjB;qBAAM;oBACN,kDAAkD;oBAClD,MAAM,GAAG,IAAI,aAAa,CAAe,OAAO,CAAkB,CAAC;iBACnE;gBACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;aACtB;YACD,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,AAhED,CAWU,OAAO,GAqDhB","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 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;\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\nconst toOptions = <OPTIONS extends DButtonSelectOptions<any, any, any, any>>(\n\toptions?: OPTIONS\n): OPTIONS | undefined => {\n\tif (options) {\n\t\t// Try to copy text.formatter to dialog.item.text.formatter at first\n\t\tconst formatter = options.text?.formatter;\n\t\tif (formatter !== undefined) {\n\t\t\tlet dialog = options.dialog;\n\t\t\tif (!(dialog && \"open\" in dialog)) {\n\t\t\t\tdialog = dialog || {};\n\t\t\t\tconst item = (dialog.item = dialog.item || {});\n\t\t\t\tconst text = (item.text = item.text || {});\n\t\t\t\tif (text.formatter === undefined) {\n\t\t\t\t\t// Assumes formatter is ( value: DIALOG_VALUE | null, caller: any ) => string.\n\t\t\t\t\ttext.formatter = formatter as any;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Try to copy dialog.item.text.formatter to text.formatter\n\t\t\tconst dialog = options.dialog;\n\t\t\tif (!(dialog && \"open\" in dialog)) {\n\t\t\t\tconst dialogFormatter = dialog?.item?.text?.formatter;\n\t\t\t\tif (dialogFormatter !== undefined) {\n\t\t\t\t\tconst text = options.text || {};\n\t\t\t\t\toptions.text = text;\n\t\t\t\t\tif (text.formatter === undefined) {\n\t\t\t\t\t\t// Assumes dialogFormatter is ( value: VALUE | null, caller: any ) => string.\n\t\t\t\t\t\ttext.formatter = dialogFormatter as any;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn options;\n};\n\nexport class DButtonSelect<\n\tVALUE = unknown,\n\tDIALOG_VALUE = unknown,\n\tDIALOG extends DButtonSelectDialog<DIALOG_VALUE> = DButtonSelectDialog<DIALOG_VALUE>,\n\tTHEME extends DThemeButtonSelect<VALUE> = DThemeButtonSelect<VALUE>,\n\tOPTIONS extends DButtonSelectOptions<VALUE, DIALOG_VALUE, DIALOG, THEME> = DButtonSelectOptions<\n\t\tVALUE,\n\t\tDIALOG_VALUE,\n\t\tDIALOG,\n\t\tTHEME\n\t>\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(toOptions(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>.\n\t\t\t\tdialog = new DDialogSelect<DIALOG_VALUE>(options) 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"]}
|
|
@@ -13,6 +13,7 @@ import { DDialogGestureImpl } from "./d-dialog-gesture-impl";
|
|
|
13
13
|
import { DDialogGestureMode } from "./d-dialog-gesture-mode";
|
|
14
14
|
import { DDialogMode } from "./d-dialog-mode";
|
|
15
15
|
import { DDialogState } from "./d-dialog-state";
|
|
16
|
+
import { isArray, isString } from "./util";
|
|
16
17
|
import { toEnum } from "./util/to-enum";
|
|
17
18
|
import { UtilAttach } from "./util/util-attach";
|
|
18
19
|
import { UtilClickOutside } from "./util/util-click-outside";
|
|
@@ -33,7 +34,7 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
33
34
|
}
|
|
34
35
|
DDialog.prototype.init = function (options) {
|
|
35
36
|
var _this = this;
|
|
36
|
-
var _a, _b
|
|
37
|
+
var _a, _b;
|
|
37
38
|
_super.prototype.init.call(this, options);
|
|
38
39
|
this._onPrerenderBound = function () {
|
|
39
40
|
_this.onPrerender();
|
|
@@ -46,13 +47,12 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
46
47
|
// Sticky
|
|
47
48
|
this._sticky = (_b = options === null || options === void 0 ? void 0 : options.sticky) !== null && _b !== void 0 ? _b : theme.isSticky(mode);
|
|
48
49
|
// Close On
|
|
49
|
-
var closeOn = (
|
|
50
|
+
var closeOn = this.toCloseOn(mode, theme, options);
|
|
50
51
|
this._closeOn = closeOn;
|
|
51
52
|
// Align
|
|
52
|
-
this._align =
|
|
53
|
+
this._align = this.toAlign(mode, theme, options);
|
|
53
54
|
// Overlay
|
|
54
|
-
|
|
55
|
-
this._overlay = overlay;
|
|
55
|
+
this._overlay = new UtilOverlay();
|
|
56
56
|
// Gesture
|
|
57
57
|
this._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));
|
|
58
58
|
// State
|
|
@@ -76,6 +76,35 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
+
DDialog.prototype.toCloseOn = function (mode, theme, options) {
|
|
80
|
+
var closeOn = options === null || options === void 0 ? void 0 : options.closeOn;
|
|
81
|
+
if (closeOn == null) {
|
|
82
|
+
return theme.closeOn(mode);
|
|
83
|
+
}
|
|
84
|
+
else if (isArray(closeOn)) {
|
|
85
|
+
var result = DDialogCloseOn.NONE;
|
|
86
|
+
for (var i = 0, imax = closeOn.length; i < imax; ++i) {
|
|
87
|
+
result |= DDialogCloseOn[closeOn[i]];
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
else if (isString(closeOn)) {
|
|
92
|
+
return DDialogCloseOn[closeOn];
|
|
93
|
+
}
|
|
94
|
+
return closeOn;
|
|
95
|
+
};
|
|
96
|
+
DDialog.prototype.toAlign = function (mode, theme, options) {
|
|
97
|
+
var align = options === null || options === void 0 ? void 0 : options.align;
|
|
98
|
+
if (align === null) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
else if (align === undefined) {
|
|
102
|
+
return theme.getAlign(mode);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return toEnum(align, DDialogAlign);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
79
108
|
Object.defineProperty(DDialog.prototype, "mode", {
|
|
80
109
|
get: function () {
|
|
81
110
|
return this._mode;
|
|
@@ -83,6 +112,20 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
83
112
|
enumerable: false,
|
|
84
113
|
configurable: true
|
|
85
114
|
});
|
|
115
|
+
Object.defineProperty(DDialog.prototype, "align", {
|
|
116
|
+
get: function () {
|
|
117
|
+
return this._align;
|
|
118
|
+
},
|
|
119
|
+
enumerable: false,
|
|
120
|
+
configurable: true
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(DDialog.prototype, "algin", {
|
|
123
|
+
set: function (align) {
|
|
124
|
+
this._align = align;
|
|
125
|
+
},
|
|
126
|
+
enumerable: false,
|
|
127
|
+
configurable: true
|
|
128
|
+
});
|
|
86
129
|
Object.defineProperty(DDialog.prototype, "gesture", {
|
|
87
130
|
get: function () {
|
|
88
131
|
return this._gesture;
|
|
@@ -171,7 +214,16 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
171
214
|
}
|
|
172
215
|
}
|
|
173
216
|
};
|
|
174
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Opens a dialog.
|
|
219
|
+
*
|
|
220
|
+
* @param opener An opener of a dialog.
|
|
221
|
+
* The dialog position is determined based on a position and a size of the opener.
|
|
222
|
+
* If the opener is undefined, the dialog is placed at the center of the screen.
|
|
223
|
+
*
|
|
224
|
+
* @returns a value of this dialog
|
|
225
|
+
*/
|
|
226
|
+
DDialog.prototype.open = function (opener) {
|
|
175
227
|
var _this = this;
|
|
176
228
|
var result = this._promise;
|
|
177
229
|
if (result == null) {
|
|
@@ -180,7 +232,7 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
180
232
|
_this._reject = reject;
|
|
181
233
|
});
|
|
182
234
|
this._promise = result;
|
|
183
|
-
this.
|
|
235
|
+
this._opener = opener;
|
|
184
236
|
// Attach to a layer
|
|
185
237
|
var layer = null;
|
|
186
238
|
switch (this._mode) {
|
|
@@ -199,9 +251,8 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
199
251
|
if (gesture.mode === DDialogGestureMode.CLEAN) {
|
|
200
252
|
gesture.toClean();
|
|
201
253
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (layer != null) {
|
|
254
|
+
if (layer != null) {
|
|
255
|
+
if (gesture.isClean()) {
|
|
205
256
|
var renderer = layer.renderer;
|
|
206
257
|
var onPrerenderBound = this._onPrerenderBound;
|
|
207
258
|
if (this._sticky) {
|
|
@@ -211,10 +262,10 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
211
262
|
renderer.once("prerender", onPrerenderBound);
|
|
212
263
|
}
|
|
213
264
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
265
|
+
else {
|
|
266
|
+
var position = this.position;
|
|
267
|
+
gesture.constraint(this, layer, position.x, position.y);
|
|
268
|
+
}
|
|
218
269
|
}
|
|
219
270
|
// Done
|
|
220
271
|
this.onOpen();
|
|
@@ -223,18 +274,15 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
223
274
|
};
|
|
224
275
|
DDialog.prototype.onPrerender = function () {
|
|
225
276
|
var _a;
|
|
226
|
-
var align = this._align;
|
|
227
|
-
if (align == null) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
277
|
var layer = this._layer;
|
|
231
278
|
if (layer == null) {
|
|
232
279
|
return;
|
|
233
280
|
}
|
|
234
|
-
var
|
|
235
|
-
|
|
281
|
+
var align = this._align;
|
|
282
|
+
var opener = this._opener;
|
|
283
|
+
if (align != null && opener != null) {
|
|
236
284
|
var mode = this._mode;
|
|
237
|
-
var bounds =
|
|
285
|
+
var bounds = opener.getBounds(false, ((_a = DDialog.WORK_BOUNDS) !== null && _a !== void 0 ? _a : (DDialog.WORK_BOUNDS = new Rectangle())));
|
|
238
286
|
var theme = this.theme;
|
|
239
287
|
UtilAttach.attach(this, bounds, theme.getOffsetX(mode), theme.getOffsetY(mode), layer.width, layer.height, align);
|
|
240
288
|
}
|
|
@@ -305,8 +353,8 @@ var DDialog = /** @class */ (function (_super) {
|
|
|
305
353
|
layer.renderer.off("prerender", this._onPrerenderBound);
|
|
306
354
|
this._layer = null;
|
|
307
355
|
}
|
|
308
|
-
// Forget the
|
|
309
|
-
this.
|
|
356
|
+
// Forget the opener
|
|
357
|
+
this._opener = null;
|
|
310
358
|
// Animation
|
|
311
359
|
var animation = this.getAnimation();
|
|
312
360
|
if (animation) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAyC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,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EAAE,CAAC;QACtC,IAAI,SAAS,EAAE;YACd,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACtB;aAAM,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC,IAAI,EAAE;YAC3C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,2BAAS,GAAT,UAAU,CAAgB;QACzB,IAAI,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,GAAG,EAAE;YACvC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;gBACrC,IAAI,CAAC,SAAS,EAAE,CAAC;aACjB;SACD;QACD,OAAO,iBAAM,SAAS,YAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAES,2BAAS,GAAnB;QACC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAES,qCAAmB,GAA7B,UAA8B,KAAY;QACzC,QAAQ,IAAI,CAAC,KAAK,EAAE;YACnB,KAAK,WAAW,CAAC,KAAK,CAAC;YACvB,KAAK,WAAW,CAAC,IAAI;gBACpB,OAAO,IAAI,CAAC;YACb,KAAK,WAAW,CAAC,QAAQ;gBACxB,OAAO,iBAAM,mBAAmB,YAAC,KAAK,CAAC,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AAzWD,CAIU,KAAK,GAqWd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogGesture, DDialogGestureOptions } from \"./d-dialog-gesture\";\nimport { DDialogGestureImpl } from \"./d-dialog-gesture-impl\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DPadding } from \"./d-padding\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn;\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\tgesture?: boolean | DDialogGestureOptions;\n\n\talign?: DDialogAlign | null;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(mode: DDialogMode): DDialogCloseOn;\n\tisSticky(mode: DDialogMode): boolean;\n\tisGestureEnabled(mode: DDialogMode): boolean;\n\tgetGestureMode(mode: DDialogMode): DDialogGestureMode;\n\tgetOffsetX(mode: DDialogMode): number;\n\tgetOffsetY(mode: DDialogMode): number;\n\tgetAlign(mode: DDialogMode): DDialogAlign | null;\n\tnewAnimation(mode: DDialogMode): DAnimation<DBase> | null;\n}\n\nexport interface DDialogOwner {\n\tgetBounds(skipUpdate: boolean, result: Rectangle): Rectangle;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. By default, the dialog assumes the last created application is\n * the one it belongs to at the time when it is created.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign | null;\n\tprotected _owner?: DDialogOwner | null;\n\n\tprotected _gesture!: DDialogGesture<this>;\n\tprotected _layer!: DApplicationLayerLike | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\t\tthis._layer = null;\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky(mode);\n\n\t\t// Close On\n\t\tconst closeOn = options?.closeOn ?? theme.closeOn(mode);\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = toEnum(options?.align ?? theme.getAlign(mode), DDialogAlign);\n\n\t\t// Overlay\n\t\tconst overlay = new UtilOverlay();\n\t\tthis._overlay = overlay;\n\n\t\t// Gesture\n\t\tthis._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));\n\n\t\t// State\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Outside-click handling\n\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\tthis.onCloseOn();\n\t\t\t});\n\t\t}\n\t}\n\n\tget mode(): DDialogMode {\n\t\treturn this._mode;\n\t}\n\n\tget gesture(): DDialogGesture<this> {\n\t\treturn this._gesture;\n\t}\n\n\tget layer(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tprotected toGestureOptions(\n\t\tmode: DDialogMode,\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DDialogGestureOptions {\n\t\tconst gesture = options?.gesture;\n\t\tif (gesture === true) {\n\t\t\treturn {\n\t\t\t\tenable: true,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture === false) {\n\t\t\treturn {\n\t\t\t\tenable: false,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture != null) {\n\t\t\tif (gesture.enable === undefined) {\n\t\t\t\tgesture.enable = theme.isGestureEnabled(mode);\n\t\t\t}\n\t\t\tif (gesture.mode === undefined) {\n\t\t\t\tgesture.mode = theme.getGestureMode(mode);\n\t\t\t}\n\t\t\treturn gesture;\n\t\t}\n\t\treturn {\n\t\t\tenable: theme.isGestureEnabled(mode),\n\t\t\tmode: theme.getGestureMode(mode)\n\t\t};\n\t}\n\n\tonParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void {\n\t\tif (this.isOpened()) {\n\t\t\tconst layer = this._layer;\n\t\t\tif (layer != null) {\n\t\t\t\tconst gesture = this._gesture;\n\t\t\t\tif (gesture.isDirty()) {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsuper.onParentResize(parentWidth, parentHeight, parentPadding);\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tresult = this._options?.animation ?? this.theme.newAnimation(this._mode);\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tconst firstFocusable = focusController.find(this, false, true, true);\n\t\t\t\tfocusController.focus(firstFocusable || this);\n\t\t\t}\n\t\t}\n\t}\n\n\topen(owner?: DDialogOwner): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._owner = owner;\n\n\t\t\t// Attach to a layer\n\t\t\tlet layer: DApplicationLayerLike | null = null;\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tlayer = this._overlay.pick(this);\n\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tlayer = DApplications.getLayer(this);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._layer = layer;\n\n\t\t\t// Position & size\n\t\t\tconst gesture = this._gesture;\n\t\t\tif (gesture.mode === DDialogGestureMode.CLEAN) {\n\t\t\t\tgesture.toClean();\n\t\t\t}\n\t\t\tconst align = this._align;\n\t\t\tif (align != null && gesture.isClean()) {\n\t\t\t\tif (layer != null) {\n\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (layer != null) {\n\t\t\t\tconst position = this.position;\n\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t}\n\n\t\t\t// Done\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst align = this._align;\n\t\tif (align == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst layer = this._layer;\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst owner = this._owner;\n\t\tif (owner) {\n\t\t\tconst mode = this._mode;\n\t\t\tconst bounds = owner.getBounds(false, (DDialog.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tconst theme = this.theme;\n\t\t\tUtilAttach.attach(\n\t\t\t\tthis,\n\t\t\t\tbounds,\n\t\t\t\ttheme.getOffsetX(mode),\n\t\t\t\ttheme.getOffsetY(mode),\n\t\t\t\tlayer.width,\n\t\t\t\tlayer.height,\n\t\t\t\talign\n\t\t\t);\n\t\t} else {\n\t\t\tthis.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._layer;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler and forget the layer\n\t\tif (layer) {\n\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\tthis._layer = null;\n\t\t}\n\n\t\t// Forget the owner\n\t\tthis._owner = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tonKeyDown(e: KeyboardEvent): boolean {\n\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\tthis.onCloseOn();\n\t\t\t}\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-dialog.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAS,SAA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C,CAAC;SACzC;IACF,CAAC;IAES,yBAAO,GAAjB;QACC,OAAO,SAAS,CAAC;IAClB,CAAC;IACF,cAAC;AAAD,CAAC,AA9YD,CAIU,KAAK,GA0Yd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Point, Rectangle } from \"pixi.js\";\nimport { DAnimation } from \"./d-animation\";\nimport { DApplicationLayerLike } from \"./d-application-layer-like\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DThemeBase } from \"./d-base\";\nimport { DBaseState } from \"./d-base-state\";\nimport { DFocusable } from \"./d-controller-focus\";\nimport { DDialogAlign } from \"./d-dialog-align\";\nimport { DDialogCloseOn } from \"./d-dialog-close-on\";\nimport { DDialogGesture, DDialogGestureOptions } from \"./d-dialog-gesture\";\nimport { DDialogGestureImpl } from \"./d-dialog-gesture-impl\";\nimport { DDialogGestureMode } from \"./d-dialog-gesture-mode\";\nimport { DDialogMode } from \"./d-dialog-mode\";\nimport { DDialogState } from \"./d-dialog-state\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DPadding } from \"./d-padding\";\nimport { isArray, isString } from \"./util\";\nimport { toEnum } from \"./util/to-enum\";\nimport { UtilAttach } from \"./util/util-attach\";\nimport { UtilClickOutside } from \"./util/util-click-outside\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilOverlay } from \"./util/util-overlay\";\n\n/**\n * {@link DDialog} events.\n */\nexport interface DDialogEvents<EMITTER> extends DBaseEvents<EMITTER> {\n\t/**\n\t * Triggered when a dialog is opened.\n\t *\n\t * @param emitter this\n\t */\n\topen(emitter: EMITTER): void;\n\n\t/**\n\t * Triggered when a dialog is closed.\n\t *\n\t * @param emitter this\n\t */\n\tclose(emitter: EMITTER): void;\n}\n\n/**\n * {@link DDialog} `on` options.\n */\nexport interface DDialogOnOptions<EMITTER> extends Partial<DDialogEvents<EMITTER>>, DOnOptions {}\n\n/**\n * {@link DDialog} options.\n */\nexport interface DDialogOptions<THEME extends DThemeDialog = DThemeDialog, EMITTER = any>\n\textends DBaseOptions<THEME> {\n\tcloseOn?: DDialogCloseOn | Array<keyof typeof DDialogCloseOn> | keyof typeof DDialogCloseOn;\n\n\tanimation?: DAnimation<DBase>;\n\n\t/**\n\t * A dialog mode.\n\t */\n\tmode?: DDialogMode | keyof typeof DDialogMode;\n\n\tsticky?: boolean;\n\n\tgesture?: boolean | DDialogGestureOptions;\n\n\talign?: DDialogAlign | null | keyof typeof DDialogAlign;\n\n\t/**\n\t * Mappings of event names and handlers.\n\t */\n\ton?: DDialogOnOptions<EMITTER>;\n}\n\n/**\n * {@link DDialog} theme.\n */\nexport interface DThemeDialog extends DThemeBase {\n\tgetMode(): DDialogMode;\n\tcloseOn(mode: DDialogMode): DDialogCloseOn;\n\tisSticky(mode: DDialogMode): boolean;\n\tisGestureEnabled(mode: DDialogMode): boolean;\n\tgetGestureMode(mode: DDialogMode): DDialogGestureMode;\n\tgetOffsetX(mode: DDialogMode): number;\n\tgetOffsetY(mode: DDialogMode): number;\n\tgetAlign(mode: DDialogMode): DDialogAlign | null;\n\tnewAnimation(mode: DDialogMode): DAnimation<DBase> | null;\n}\n\nexport interface DDialogOpener {\n\tgetBounds(skipUpdate: boolean, result: Rectangle): Rectangle;\n}\n\n/**\n * A dialog class.\n *\n * If multiple application instances are there, better to set the constructor\n * option `parent` to an `application.stage` so that the dialog picks a right\n * application. By default, the dialog assumes the last created application is\n * the one it belongs to at the time when it is created.\n */\nexport class DDialog<\n\tVALUE = void,\n\tTHEME extends DThemeDialog = DThemeDialog,\n\tOPTIONS extends DDialogOptions<THEME> = DDialogOptions<THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected static WORK_BOUNDS?: Rectangle;\n\n\tprotected _promise?: Promise<VALUE>;\n\tprotected _resolve?: (value: VALUE | PromiseLike<VALUE>) => void;\n\tprotected _reject?: (reason?: any) => void;\n\n\tprotected _animation?: DAnimation<DBase> | null;\n\tprotected _closeOn!: DDialogCloseOn;\n\tprotected _focused?: DFocusable | null;\n\tprotected _overlay!: UtilOverlay;\n\tprotected _mode!: DDialogMode;\n\tprotected _sticky!: boolean;\n\tprotected _onPrerenderBound!: () => void;\n\tprotected _align!: DDialogAlign | null;\n\tprotected _opener?: DDialogOpener | null;\n\n\tprotected _gesture!: DDialogGesture<this>;\n\tprotected _layer!: DApplicationLayerLike | null;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tthis._onPrerenderBound = (): void => {\n\t\t\tthis.onPrerender();\n\t\t};\n\t\tthis._layer = null;\n\n\t\t// Mode\n\t\tconst theme = this.theme;\n\t\tconst mode = toEnum(options?.mode ?? theme.getMode(), DDialogMode);\n\t\tthis._mode = mode;\n\n\t\t// Sticky\n\t\tthis._sticky = options?.sticky ?? theme.isSticky(mode);\n\n\t\t// Close On\n\t\tconst closeOn = this.toCloseOn(mode, theme, options);\n\t\tthis._closeOn = closeOn;\n\n\t\t// Align\n\t\tthis._align = this.toAlign(mode, theme, options);\n\n\t\t// Overlay\n\t\tthis._overlay = new UtilOverlay();\n\n\t\t// Gesture\n\t\tthis._gesture = new DDialogGestureImpl(this, this.toGestureOptions(mode, theme, options));\n\n\t\t// State\n\t\tswitch (mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MODAL);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\tthis.state.add(DDialogState.MODELESS);\n\t\t\t\tbreak;\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\tthis.visible = false;\n\t\t\t\tthis.state.addAll(DBaseState.FOCUS_ROOT, DDialogState.MENU);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Outside-click handling\n\t\tif (closeOn & DDialogCloseOn.CLICK_OUTSIDE) {\n\t\t\tUtilClickOutside.apply(this, (): void => {\n\t\t\t\tthis.onCloseOn();\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected toCloseOn(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogCloseOn {\n\t\tconst closeOn = options?.closeOn;\n\t\tif (closeOn == null) {\n\t\t\treturn theme.closeOn(mode);\n\t\t} else if (isArray(closeOn)) {\n\t\t\tlet result = DDialogCloseOn.NONE;\n\t\t\tfor (let i = 0, imax = closeOn.length; i < imax; ++i) {\n\t\t\t\tresult |= DDialogCloseOn[closeOn[i]];\n\t\t\t}\n\t\t\treturn result;\n\t\t} else if (isString(closeOn)) {\n\t\t\treturn DDialogCloseOn[closeOn];\n\t\t}\n\t\treturn closeOn;\n\t}\n\n\tprotected toAlign(mode: DDialogMode, theme: THEME, options?: OPTIONS): DDialogAlign | null {\n\t\tconst align = options?.align;\n\t\tif (align === null) {\n\t\t\treturn null;\n\t\t} else if (align === undefined) {\n\t\t\treturn theme.getAlign(mode);\n\t\t} else {\n\t\t\treturn toEnum(align, DDialogAlign);\n\t\t}\n\t}\n\n\tget mode(): DDialogMode {\n\t\treturn this._mode;\n\t}\n\n\tget align(): DDialogAlign | null {\n\t\treturn this._align;\n\t}\n\n\tset algin(align: DDialogAlign | null) {\n\t\tthis._align = align;\n\t}\n\n\tget gesture(): DDialogGesture<this> {\n\t\treturn this._gesture;\n\t}\n\n\tget layer(): DApplicationLayerLike | null {\n\t\treturn this._layer;\n\t}\n\n\tprotected toGestureOptions(\n\t\tmode: DDialogMode,\n\t\ttheme: THEME,\n\t\toptions?: OPTIONS\n\t): DDialogGestureOptions {\n\t\tconst gesture = options?.gesture;\n\t\tif (gesture === true) {\n\t\t\treturn {\n\t\t\t\tenable: true,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture === false) {\n\t\t\treturn {\n\t\t\t\tenable: false,\n\t\t\t\tmode: theme.getGestureMode(mode)\n\t\t\t};\n\t\t} else if (gesture != null) {\n\t\t\tif (gesture.enable === undefined) {\n\t\t\t\tgesture.enable = theme.isGestureEnabled(mode);\n\t\t\t}\n\t\t\tif (gesture.mode === undefined) {\n\t\t\t\tgesture.mode = theme.getGestureMode(mode);\n\t\t\t}\n\t\t\treturn gesture;\n\t\t}\n\t\treturn {\n\t\t\tenable: theme.isGestureEnabled(mode),\n\t\t\tmode: theme.getGestureMode(mode)\n\t\t};\n\t}\n\n\tonParentResize(parentWidth: number, parentHeight: number, parentPadding: DPadding): void {\n\t\tif (this.isOpened()) {\n\t\t\tconst layer = this._layer;\n\t\t\tif (layer != null) {\n\t\t\t\tconst gesture = this._gesture;\n\t\t\t\tif (gesture.isDirty()) {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsuper.onParentResize(parentWidth, parentHeight, parentPadding);\n\t}\n\n\tprotected getAnimation(): DAnimation | null {\n\t\tlet result = this._animation;\n\t\tif (result === undefined) {\n\t\t\tresult = this._options?.animation ?? this.theme.newAnimation(this._mode);\n\t\t\tif (result) {\n\t\t\t\tresult.target = this;\n\t\t\t\tresult.on(\"end\", (isReverse: boolean): void => {\n\t\t\t\t\tthis.onAnimationEnd(isReverse);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis._animation = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onAnimationEnd(isReverse: boolean): void {\n\t\tif (isReverse) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent) {\n\t\t\t\tparent.removeChild(this);\n\t\t\t}\n\t\t} else {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tconst focusController = layer.getFocusController();\n\t\t\t\tthis._focused = focusController.get();\n\t\t\t\tconst firstFocusable = focusController.find(this, false, true, true);\n\t\t\t\tfocusController.focus(firstFocusable || this);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Opens a dialog.\n\t *\n\t * @param opener An opener of a dialog.\n\t * The dialog position is determined based on a position and a size of the opener.\n\t * If the opener is undefined, the dialog is placed at the center of the screen.\n\t *\n\t * @returns a value of this dialog\n\t */\n\topen(opener?: DDialogOpener): Promise<VALUE> {\n\t\tlet result = this._promise;\n\t\tif (result == null) {\n\t\t\tresult = new Promise<VALUE>((resolve, reject): void => {\n\t\t\t\tthis._resolve = resolve;\n\t\t\t\tthis._reject = reject;\n\t\t\t});\n\t\t\tthis._promise = result;\n\n\t\t\tthis._opener = opener;\n\n\t\t\t// Attach to a layer\n\t\t\tlet layer: DApplicationLayerLike | null = null;\n\t\t\tswitch (this._mode) {\n\t\t\t\tcase DDialogMode.MODAL:\n\t\t\t\tcase DDialogMode.MENU:\n\t\t\t\t\tlayer = this._overlay.pick(this);\n\t\t\t\t\tlayer.stage.addChild(this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\t\tlayer = DApplications.getLayer(this);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis._layer = layer;\n\n\t\t\t// Position & size\n\t\t\tconst gesture = this._gesture;\n\t\t\tif (gesture.mode === DDialogGestureMode.CLEAN) {\n\t\t\t\tgesture.toClean();\n\t\t\t}\n\t\t\tif (layer != null) {\n\t\t\t\tif (gesture.isClean()) {\n\t\t\t\t\tconst renderer = layer.renderer;\n\t\t\t\t\tconst onPrerenderBound = this._onPrerenderBound;\n\t\t\t\t\tif (this._sticky) {\n\t\t\t\t\t\trenderer.on(\"prerender\", onPrerenderBound);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trenderer.once(\"prerender\", onPrerenderBound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst position = this.position;\n\t\t\t\t\tgesture.constraint(this, layer, position.x, position.y);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Done\n\t\t\tthis.onOpen();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected onPrerender(): void {\n\t\tconst layer = this._layer;\n\t\tif (layer == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst align = this._align;\n\t\tconst opener = this._opener;\n\t\tif (align != null && opener != null) {\n\t\t\tconst mode = this._mode;\n\t\t\tconst bounds = opener.getBounds(false, (DDialog.WORK_BOUNDS ??= new Rectangle()));\n\t\t\tconst theme = this.theme;\n\t\t\tUtilAttach.attach(\n\t\t\t\tthis,\n\t\t\t\tbounds,\n\t\t\t\ttheme.getOffsetX(mode),\n\t\t\t\ttheme.getOffsetY(mode),\n\t\t\t\tlayer.width,\n\t\t\t\tlayer.height,\n\t\t\t\talign\n\t\t\t);\n\t\t} else {\n\t\t\tthis.position.set((layer.width - this.width) * 0.5, (layer.height - this.height) * 0.5);\n\t\t}\n\t}\n\n\tprotected onOpen(): void {\n\t\tthis.emit(\"open\", this);\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start();\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = true;\n\t\t\tthis.onAnimationEnd(false);\n\t\t}\n\t}\n\n\tisOpened(): boolean {\n\t\treturn this._promise != null;\n\t}\n\n\tclose(): void {\n\t\tthis.doReject();\n\t}\n\n\tprotected doResolve(value: VALUE | PromiseLike<VALUE>): void {\n\t\tconst resolve = this._resolve;\n\t\tif (resolve) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\tresolve(value);\n\t\t}\n\t}\n\n\tprotected doReject(reason?: any): void {\n\t\tconst reject = this._reject;\n\t\tif (reject) {\n\t\t\tthis._promise = undefined;\n\t\t\tthis._resolve = undefined;\n\t\t\tthis._reject = undefined;\n\n\t\t\tthis.onClose();\n\n\t\t\treject(reason);\n\t\t}\n\t}\n\n\tprotected onClose(): void {\n\t\t// Focus\n\t\tconst layer = this._layer;\n\t\tconst focused = this._focused;\n\t\tif (focused != null) {\n\t\t\tthis._focused = null;\n\t\t\tif (layer) {\n\t\t\t\tconst focusedLayer = DApplications.getLayer(focused);\n\t\t\t\tif (focusedLayer != null && layer !== focusedLayer) {\n\t\t\t\t\tfocusedLayer.view.focus();\n\t\t\t\t}\n\t\t\t\tlayer.getFocusController().focus(focused);\n\t\t\t} else {\n\t\t\t\tthis.blur(true);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.blur(true);\n\t\t}\n\n\t\t// Remove the prerender event handler and forget the layer\n\t\tif (layer) {\n\t\t\tlayer.renderer.off(\"prerender\", this._onPrerenderBound);\n\t\t\tthis._layer = null;\n\t\t}\n\n\t\t// Forget the opener\n\t\tthis._opener = null;\n\n\t\t// Animation\n\t\tconst animation = this.getAnimation();\n\t\tif (animation) {\n\t\t\tanimation.start(true);\n\t\t} else if (this._mode === DDialogMode.MENU) {\n\t\t\tthis.visible = false;\n\t\t\tthis.onAnimationEnd(true);\n\t\t}\n\n\t\tthis.emit(\"close\", this);\n\t}\n\n\tonKeyDown(e: KeyboardEvent): boolean {\n\t\tif (this._closeOn & DDialogCloseOn.ESC) {\n\t\t\tif (UtilKeyboardEvent.isCancelKey(e)) {\n\t\t\t\tthis.onCloseOn();\n\t\t\t}\n\t\t}\n\t\treturn super.onKeyDown(e);\n\t}\n\n\tprotected onCloseOn(): void {\n\t\tthis.close();\n\t}\n\n\tprotected containsGlobalPoint(point: Point): boolean {\n\t\tswitch (this._mode) {\n\t\t\tcase DDialogMode.MODAL:\n\t\t\tcase DDialogMode.MENU:\n\t\t\t\treturn true;\n\t\t\tcase DDialogMode.MODELESS:\n\t\t\t\treturn super.containsGlobalPoint(point);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialog\";\n\t}\n}\n"]}
|
|
@@ -49,7 +49,9 @@ var DImageBase = /** @class */ (function (_super) {
|
|
|
49
49
|
return this._images[0].source;
|
|
50
50
|
},
|
|
51
51
|
set: function (imageSource) {
|
|
52
|
-
this._images[0]
|
|
52
|
+
var image = this._images[0];
|
|
53
|
+
image.source = imageSource;
|
|
54
|
+
image.updateSource();
|
|
53
55
|
},
|
|
54
56
|
enumerable: false,
|
|
55
57
|
configurable: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-image-base.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAQH,OAAO,EACN,+BAA+B,EAE/B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,8BAA8B,EAE9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAwC,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAqD,MAAM,eAAe,CAAC;AAiD7F,IAAM,uBAAuB,GAAG,UAC/B,KAA6B;IAE7B,OAAO,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;AACxC,CAAC,CAAC;AAEF,IAAM,sBAAsB,GAAG,UAC9B,KAA6B;IAE7B,OAAO,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;AACvC,CAAC,CAAC;AAEF;;;GAGG;AACH;IAIU,8BAAgC;IAJ1C;;IA+GA,CAAC;IAvGU,yBAAI,GAAd,UAAe,OAAiB;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,iBAAM,IAAI,YAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAES,8BAAS,GAAnB,UAAoB,KAAY,EAAE,OAAiB;QAClD,IAAM,MAAM,GAAkB,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9E,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE;YACnC,M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AAI,CAAC;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;gBAClC,OAAO,IAAI,CAAC;aACZ;SACD;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IAES,4BAAO,GAAjB;QACC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,4BAAO,GAAP;QACC,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACpB;QACD,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,iBAAC;AAAD,CAAC,AA/GD,CAIU,SAAS,GA2GlB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, Texture } from \"pixi.js\";\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DAlignWith } from \"./d-align-with\";\nimport { DRefitable } from \"./d-base\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport {\n\tDImageBaseThemeWrapperSecondary,\n\tDThemeImageBaseSecondary\n} from \"./d-image-base-theme-wrapper-secondary\";\nimport {\n\tDImageBaseThemeWrapperTertiary,\n\tDThemeImageBaseTertiary\n} from \"./d-image-base-theme-wrapper-tertiary\";\nimport { DImagePiece, DImagePieceOptions, DThemeImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouter } from \"./d-image-piece-layouter\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DStateAwareOrValueMightBe } from \"./d-state-aware\";\nimport { DTextBase, DTextBaseEvents, DTextBaseOptions, DThemeTextBase } from \"./d-text-base\";\n\n/**\n * {@link DImageBase} events.\n */\nexport interface DImageBaseEvents<VALUE, EMITTER> extends DTextBaseEvents<VALUE, EMITTER> {}\n\n/**\n * {@link DImageBase} \"on\" options.\n */\nexport interface DImageBaseOnOptions<VALUE, EMITTER>\n\textends Partial<DImageBaseEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DImageBase} options.\n */\nexport interface DImageBaseOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeImageBase<VALUE> = DThemeImageBase<VALUE>,\n\tEMITTER = any\n> extends DTextBaseOptions<VALUE, THEME, EMITTER> {\n\timage?: DImagePieceOptions;\n\ton?: DImageBaseOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DImageBase} theme.\n */\nexport interface DThemeImageBase<VALUE = unknown> extends DThemeTextBase<VALUE>, DThemeImagePiece {\n\tgetSecondaryImageAlignHorizontal(): DAlignHorizontal;\n\tgetSecondaryImageAlignVertical(): DAlignVertical;\n\tgetSecondaryImageAlignWith(): DAlignWith;\n\tgetSecondaryImageMarginHorizontal(): number;\n\tgetSecondaryImageMarginVertial(): number;\n\tgetSecondaryImageTintColor(state: DBaseStateSet): number | null;\n\tgetSecondaryImageTintAlpha(state: DBaseStateSet): number;\n\tgetSecondaryImageSource?(state: DBaseStateSet): Texture | DisplayObject | null;\n\n\tgetTertiaryImageAlignHorizontal(): DAlignHorizontal;\n\tgetTertiaryImageAlignVertical(): DAlignVertical;\n\tgetTertiaryImageAlignWith(): DAlignWith;\n\tgetTertiaryImageMarginHorizontal(): number;\n\tgetTertiaryImageMarginVertial(): number;\n\tgetTertiaryImageTintColor(state: DBaseStateSet): number | null;\n\tgetTertiaryImageTintAlpha(state: DBaseStateSet): number;\n\tgetTertiaryImageSource?(state: DBaseStateSet): Texture | DisplayObject | null;\n}\n\nconst hasSecondaryImageSource = <VALUE>(\n\ttheme: DThemeImageBase<VALUE>\n): theme is DThemeImageBase<VALUE> & DThemeImageBaseSecondary => {\n\treturn !!theme.getSecondaryImageSource;\n};\n\nconst hasTertiaryImageSource = <VALUE>(\n\ttheme: DThemeImageBase<VALUE>\n): theme is DThemeImageBase<VALUE> & DThemeImageBaseTertiary => {\n\treturn !!theme.getTertiaryImageSource;\n};\n\n/**\n * A base class for UI classes with an image support.\n * See {@link DImageBaseEvents} for event details.\n */\nexport class DImageBase<\n\tVALUE = unknown,\n\tTHEME extends DThemeImageBase<VALUE> = DThemeImageBase<VALUE>,\n\tOPTIONS extends DImageBaseOptions<VALUE, THEME> = DImageBaseOptions<VALUE, THEME>\n> extends DTextBase<VALUE, THEME, OPTIONS> {\n\tprotected static LAYOUTER?: DImagePieceLayouter;\n\tprotected _images!: DImagePiece[];\n\n\tprotected init(options?: OPTIONS): void {\n\t\tthis._images = this.newImages(this.theme, options);\n\t\tsuper.init(options);\n\t}\n\n\tprotected newImages(theme: THEME, options?: OPTIONS): DImagePiece[] {\n\t\tconst images: DImagePiece[] = [];\n\t\timages.push(this.newImage(theme, this.toImageOptions(theme, options?.image)));\n\t\tif (hasSecondaryImageSource(theme)) {\n\t\t\timages.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));\n\t\t}\n\t\tif (hasTertiaryImageSource(theme)) {\n\t\t\timages.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));\n\t\t}\n\t\treturn images;\n\t}\n\n\tprotected toImageOptions(\n\t\ttheme: THEME,\n\t\toptions?: DImagePieceOptions\n\t): DImagePieceOptions | undefined {\n\t\treturn options;\n\t}\n\n\tprotected newImage(theme: DThemeImagePiece, options?: DImagePieceOptions): DImagePiece {\n\t\treturn new DImagePiece(this, theme, this._textAlign, options);\n\t}\n\n\tget image(): DStateAwareOrValueMightBe<Texture | DisplayObject | null> {\n\t\treturn this._images[0].source;\n\t}\n\n\tset image(imageSource: DStateAwareOrValueMightBe<Texture | DisplayObject | null>) {\n\t\tthis._images[0].source = imageSource;\n\t}\n\n\tprotected onStateChange(newState: DBaseStateSet, oldState: DBaseStateSet): void {\n\t\tsuper.onStateChange(newState, oldState);\n\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\timages[i].onStateChange(newState, oldState);\n\t\t}\n\t}\n\n\tprotected updateText(): void {\n\t\tthis.updateTextValue();\n\t\tthis.updateTextAndImage();\n\t}\n\n\tprotected updateTextAndImage(): void {\n\t\tconst images = this._images;\n\t\tconst layouter = (DImageBase.LAYOUTER ??= new DImagePieceLayouter());\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\tconst image = images[i];\n\t\t\timage.updateSource();\n\t\t\timage.updateTint();\n\t\t\timage.updateBound();\n\t\t\tlayouter.add(image);\n\t\t}\n\t\tconst text = this._text;\n\t\tif (text != null) {\n\t\t\tthis.updateTextColor(text);\n\t\t\tlayouter.set(text);\n\t\t} else {\n\t\t\tlayouter.set(null);\n\t\t}\n\t\tconst auto = this._auto;\n\t\tlayouter.execute(\n\t\t\tthis._padding,\n\t\t\tthis._textAlign,\n\t\t\tauto.width.isOn ? null : this.width,\n\t\t\tauto.height.isOn ? null : this.height\n\t\t);\n\t\tlayouter.clear();\n\t}\n\n\tprotected isRefitable(target: any): target is DRefitable {\n\t\tif (super.isRefitable(target)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\tif (images[i].isRefitable(target)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DImageBase\";\n\t}\n\n\tdestroy(): void {\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\timages[i].destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
|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;SACZ;QAED,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;gBAClC,OAAO,IAAI,CAAC;aACZ;SACD;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IAES,4BAAO,GAAjB;QACC,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,4BAAO,GAAP;QACC,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;YACpD,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACpB;QACD,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,iBAAC;AAAD,CAAC,AAjHD,CAIU,SAAS,GA6GlB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, Texture } from \"pixi.js\";\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DAlignWith } from \"./d-align-with\";\nimport { DRefitable } from \"./d-base\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport {\n\tDImageBaseThemeWrapperSecondary,\n\tDThemeImageBaseSecondary\n} from \"./d-image-base-theme-wrapper-secondary\";\nimport {\n\tDImageBaseThemeWrapperTertiary,\n\tDThemeImageBaseTertiary\n} from \"./d-image-base-theme-wrapper-tertiary\";\nimport { DImagePiece, DImagePieceOptions, DThemeImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouter } from \"./d-image-piece-layouter\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DStateAwareOrValueMightBe } from \"./d-state-aware\";\nimport { DTextBase, DTextBaseEvents, DTextBaseOptions, DThemeTextBase } from \"./d-text-base\";\n\n/**\n * {@link DImageBase} events.\n */\nexport interface DImageBaseEvents<VALUE, EMITTER> extends DTextBaseEvents<VALUE, EMITTER> {}\n\n/**\n * {@link DImageBase} \"on\" options.\n */\nexport interface DImageBaseOnOptions<VALUE, EMITTER>\n\textends Partial<DImageBaseEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DImageBase} options.\n */\nexport interface DImageBaseOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeImageBase<VALUE> = DThemeImageBase<VALUE>,\n\tEMITTER = any\n> extends DTextBaseOptions<VALUE, THEME, EMITTER> {\n\timage?: DImagePieceOptions;\n\ton?: DImageBaseOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DImageBase} theme.\n */\nexport interface DThemeImageBase<VALUE = unknown> extends DThemeTextBase<VALUE>, DThemeImagePiece {\n\tgetSecondaryImageAlignHorizontal(): DAlignHorizontal;\n\tgetSecondaryImageAlignVertical(): DAlignVertical;\n\tgetSecondaryImageAlignWith(): DAlignWith;\n\tgetSecondaryImageMarginHorizontal(): number;\n\tgetSecondaryImageMarginVertial(): number;\n\tgetSecondaryImageTintColor(state: DBaseStateSet): number | null;\n\tgetSecondaryImageTintAlpha(state: DBaseStateSet): number;\n\tgetSecondaryImageSource?(state: DBaseStateSet): Texture | DisplayObject | null;\n\n\tgetTertiaryImageAlignHorizontal(): DAlignHorizontal;\n\tgetTertiaryImageAlignVertical(): DAlignVertical;\n\tgetTertiaryImageAlignWith(): DAlignWith;\n\tgetTertiaryImageMarginHorizontal(): number;\n\tgetTertiaryImageMarginVertial(): number;\n\tgetTertiaryImageTintColor(state: DBaseStateSet): number | null;\n\tgetTertiaryImageTintAlpha(state: DBaseStateSet): number;\n\tgetTertiaryImageSource?(state: DBaseStateSet): Texture | DisplayObject | null;\n}\n\nconst hasSecondaryImageSource = <VALUE>(\n\ttheme: DThemeImageBase<VALUE>\n): theme is DThemeImageBase<VALUE> & DThemeImageBaseSecondary => {\n\treturn !!theme.getSecondaryImageSource;\n};\n\nconst hasTertiaryImageSource = <VALUE>(\n\ttheme: DThemeImageBase<VALUE>\n): theme is DThemeImageBase<VALUE> & DThemeImageBaseTertiary => {\n\treturn !!theme.getTertiaryImageSource;\n};\n\n/**\n * A base class for UI classes with an image support.\n * See {@link DImageBaseEvents} for event details.\n */\nexport class DImageBase<\n\tVALUE = unknown,\n\tTHEME extends DThemeImageBase<VALUE> = DThemeImageBase<VALUE>,\n\tOPTIONS extends DImageBaseOptions<VALUE, THEME> = DImageBaseOptions<VALUE, THEME>\n> extends DTextBase<VALUE, THEME, OPTIONS> {\n\tprotected static LAYOUTER?: DImagePieceLayouter;\n\tprotected _images!: DImagePiece[];\n\n\tprotected init(options?: OPTIONS): void {\n\t\tthis._images = this.newImages(this.theme, options);\n\t\tsuper.init(options);\n\t}\n\n\tprotected newImages(theme: THEME, options?: OPTIONS): DImagePiece[] {\n\t\tconst images: DImagePiece[] = [];\n\t\timages.push(this.newImage(theme, this.toImageOptions(theme, options?.image)));\n\t\tif (hasSecondaryImageSource(theme)) {\n\t\t\timages.push(this.newImage(new DImageBaseThemeWrapperSecondary(theme)));\n\t\t}\n\t\tif (hasTertiaryImageSource(theme)) {\n\t\t\timages.push(this.newImage(new DImageBaseThemeWrapperTertiary(theme)));\n\t\t}\n\t\treturn images;\n\t}\n\n\tprotected toImageOptions(\n\t\ttheme: THEME,\n\t\toptions?: DImagePieceOptions\n\t): DImagePieceOptions | undefined {\n\t\treturn options;\n\t}\n\n\tprotected newImage(theme: DThemeImagePiece, options?: DImagePieceOptions): DImagePiece {\n\t\treturn new DImagePiece(this, theme, this._textAlign, options);\n\t}\n\n\tget image(): DStateAwareOrValueMightBe<Texture | DisplayObject | null> {\n\t\treturn this._images[0].source;\n\t}\n\n\tset image(imageSource: DStateAwareOrValueMightBe<Texture | DisplayObject | null>) {\n\t\tconst image = this._images[0];\n\t\timage.source = imageSource;\n\t\timage.updateSource();\n\t}\n\n\tprotected onStateChange(newState: DBaseStateSet, oldState: DBaseStateSet): void {\n\t\tsuper.onStateChange(newState, oldState);\n\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\timages[i].onStateChange(newState, oldState);\n\t\t}\n\t}\n\n\tprotected updateText(): void {\n\t\tthis.updateTextValue();\n\t\tthis.updateTextAndImage();\n\t}\n\n\tprotected updateTextAndImage(): void {\n\t\tconst images = this._images;\n\t\tconst layouter = (DImageBase.LAYOUTER ??= new DImagePieceLayouter());\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\tconst image = images[i];\n\t\t\timage.updateSource();\n\t\t\timage.updateTint();\n\t\t\timage.updateBound();\n\t\t\tlayouter.add(image);\n\t\t}\n\t\tconst text = this._text;\n\t\tif (text != null) {\n\t\t\tthis.updateTextColor(text);\n\t\t\tlayouter.set(text);\n\t\t} else {\n\t\t\tlayouter.set(null);\n\t\t}\n\t\tconst auto = this._auto;\n\t\tlayouter.execute(\n\t\t\tthis._padding,\n\t\t\tthis._textAlign,\n\t\t\tauto.width.isOn ? null : this.width,\n\t\t\tauto.height.isOn ? null : this.height\n\t\t);\n\t\tlayouter.clear();\n\t}\n\n\tprotected isRefitable(target: any): target is DRefitable {\n\t\tif (super.isRefitable(target)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\tif (images[i].isRefitable(target)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DImageBase\";\n\t}\n\n\tdestroy(): void {\n\t\tconst images = this._images;\n\t\tfor (let i = 0, imax = images.length; i < imax; ++i) {\n\t\t\timages[i].destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-table-column.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-column.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC/B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;CACC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport {
|
|
1
|
+
{"version":3,"file":"d-table-column.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-column.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC/B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,YAAY,EAAE,CAAC;IACf,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;CACC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DDialogOpener } from \"./d-dialog\";\nimport { DDialogSelectOptions } from \"./d-dialog-select\";\nimport { DMenu, DMenuOptions } from \"./d-menu\";\nimport { DTableBodyCellButtonOptions } from \"./d-table-body-cell-button\";\nimport { DTableBodyCellCheckOptions } from \"./d-table-body-cell-check\";\nimport { DTableBodyCellColorOptions } from \"./d-table-body-cell-color\";\nimport { DTableBodyCellDateOptions } from \"./d-table-body-cell-date\";\nimport { DTableBodyCellDatetimeOptions } from \"./d-table-body-cell-datetime\";\nimport { DTableBodyCellIndexOptions } from \"./d-table-body-cell-index\";\nimport { DTableBodyCellInputIntegerOptions } from \"./d-table-body-cell-input-integer\";\nimport { DTableBodyCellInputRealOptions } from \"./d-table-body-cell-input-real\";\nimport { DTableBodyCellInputTextOptions } from \"./d-table-body-cell-input-text\";\nimport { DTableBodyCellLinkLinkOptions, DTableBodyCellLinkOptions } from \"./d-table-body-cell-link\";\nimport { DTableBodyCellSelectDialogOptions } from \"./d-table-body-cell-select-dialog\";\nimport { DTableBodyCellSelectMenuOptions } from \"./d-table-body-cell-select-menu\";\nimport { DTableBodyCellSelectMultipleOptions } from \"./d-table-body-cell-select-multiple\";\nimport { DTableBodyCellSelectPromiseOptions } from \"./d-table-body-cell-select-promise\";\nimport { DTableBodyCellTextOptions } from \"./d-table-body-cell-text\";\nimport { DTableBodyCellTimeOptions } from \"./d-table-body-cell-time\";\nimport { DTableBodyCellTreeOptions } from \"./d-table-body-cell-tree\";\nimport { DTableDataComparator } from \"./d-table-data-sorter\";\nimport { DTableHeaderCellOptions } from \"./d-table-header-cell\";\n\nexport const DTableColumnType = {\n\tINDEX: 0,\n\tTEXT: 1,\n\tINTEGER: 2,\n\tREAL: 3,\n\tCHECK: 4,\n\tCHECK_SINGLE: 5,\n\tCOLOR: 6,\n\tBUTTON: 7,\n\tSELECT: 8,\n\tDATE: 9,\n\tDATETIME: 10,\n\tTIME: 11,\n\tACTION: 12,\n\tLINK: 13,\n\tTREE: 14\n} as const;\n\nexport type DTableColumnType = typeof DTableColumnType[keyof typeof DTableColumnType];\n\nexport type DTableGetter<ROW_VALUE, CELL_VALUE> = (\n\trow: ROW_VALUE,\n\tcolumnIndex: number\n) => CELL_VALUE;\nexport type DTableSetter<ROW_VALUE, CELL_VALUE> = (\n\trow: ROW_VALUE,\n\tcolumnIndex: number,\n\tcell: CELL_VALUE\n) => void;\nexport type DTableFormatter<CELL_VALUE> = (cell: CELL_VALUE) => string;\nexport type DTableEditingFormatter<CELL_VALUE> = (cell: CELL_VALUE) => string;\nexport type DTableEditingUnformatter<CELL_VALUE> = (formatted: string) => CELL_VALUE;\nexport type DTableEditingValidator<CELL_VALUE> = (cell: CELL_VALUE) => string | null;\nexport type DTableSelectingGetter<CELL_VALUE, DIALOG> = (dialog: DIALOG) => CELL_VALUE;\nexport type DTableSelectingSetter<CELL_VALUE, DIALOG> = (dialog: DIALOG, cell: CELL_VALUE) => void;\nexport type DTableEditable<ROW_VALUE> = (row: ROW_VALUE, columnIndex: number) => boolean;\nexport type DTableRenderable<ROW_VALUE> = (row: ROW_VALUE, columnIndex: number) => boolean;\n\nexport type DTableBodyCellOptionsUnion<ROW_VALUE> =\n\t| DTableBodyCellTextOptions<ROW_VALUE>\n\t| DTableBodyCellInputTextOptions<ROW_VALUE>\n\t| DTableBodyCellInputIntegerOptions<ROW_VALUE>\n\t| DTableBodyCellInputRealOptions<ROW_VALUE>\n\t| DTableBodyCellIndexOptions<ROW_VALUE>\n\t| DTableBodyCellColorOptions<ROW_VALUE>\n\t| DTableBodyCellCheckOptions<ROW_VALUE>\n\t| DTableBodyCellSelectDialogOptions<ROW_VALUE>\n\t| DTableBodyCellSelectPromiseOptions<ROW_VALUE>\n\t| DTableBodyCellSelectMenuOptions<ROW_VALUE>\n\t| DTableBodyCellDateOptions<ROW_VALUE>\n\t| DTableBodyCellDatetimeOptions<ROW_VALUE>\n\t| DTableBodyCellTimeOptions<ROW_VALUE>\n\t| DTableBodyCellButtonOptions<ROW_VALUE>\n\t| DTableBodyCellLinkOptions<ROW_VALUE>\n\t| DTableBodyCellSelectMultipleOptions<ROW_VALUE>\n\t| DTableBodyCellTreeOptions<ROW_VALUE>;\n\nexport interface DTableColumnEditingOptions<ROW_VALUE, CELL_VALUE> {\n\tenable?: boolean | DTableEditable<ROW_VALUE> | \"auto\" | \"AUTO\";\n\tformatter?: DTableEditingFormatter<CELL_VALUE>;\n\tunformatter?: DTableEditingUnformatter<CELL_VALUE>;\n\tvalidator?: DTableEditingValidator<CELL_VALUE>;\n}\n\nexport interface DTableColumnEditing<ROW_VALUE, CELL_VALUE> {\n\tenable: boolean | DTableEditable<ROW_VALUE>;\n\tformatter?: DTableEditingFormatter<CELL_VALUE>;\n\tunformatter?: DTableEditingUnformatter<CELL_VALUE>;\n\tvalidator?: DTableEditingValidator<CELL_VALUE>;\n}\n\nexport interface DTableColumnSortingOptions<ROW_VALUE> {\n\tenable?: boolean;\n\tcomparator?: DTableDataComparator<ROW_VALUE>;\n}\n\nexport interface DTableColumnSorting<ROW_VALUE> {\n\tenable: boolean;\n\tcomparator?: DTableDataComparator<ROW_VALUE>;\n}\n\nexport interface DTableColumnSelectingDialog<DIALOG_VALUE> {\n\treadonly value: DIALOG_VALUE;\n\topen(owner?: DDialogOpener): Promise<DIALOG_VALUE>;\n}\n\nexport interface DTableColumnSelectingOptions<\n\tCELL_VALUE,\n\tDIALOG_VALUE,\n\tDIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE>\n> {\n\tgetter?: DTableSelectingGetter<CELL_VALUE, DIALOG>;\n\tsetter?: DTableSelectingSetter<CELL_VALUE, DIALOG>;\n\n\tmenu?: DMenuOptions<CELL_VALUE> | DMenu<CELL_VALUE>;\n\tmultiple?: DMenuOptions<CELL_VALUE> | DMenu<CELL_VALUE>;\n\tdialog?: DDialogSelectOptions<DIALOG_VALUE> | DIALOG;\n\tpromise?: () => Promise<CELL_VALUE>;\n}\n\nexport interface DTableColumnSelecting<\n\tCELL_VALUE,\n\tDIALOG_VALUE,\n\tDIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE>\n> {\n\tgetter: DTableSelectingGetter<CELL_VALUE, DIALOG>;\n\tsetter: DTableSelectingSetter<CELL_VALUE, DIALOG>;\n\n\tmenu?: DMenu<CELL_VALUE>;\n\tmultiple?: DMenu<CELL_VALUE>;\n\tdialog?: DIALOG;\n\tpromise?: () => Promise<CELL_VALUE>;\n}\n\nexport interface DTableColumnOptions<\n\tROW_VALUE,\n\tCELL_VALUE = any,\n\tDIALOG_VALUE = any,\n\tDIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE> = any\n> {\n\tweight?: number;\n\twidth?: number;\n\n\ttype?: keyof typeof DTableColumnType | DTableColumnType;\n\tlabel?: string;\n\tgetter?: DTableGetter<ROW_VALUE, CELL_VALUE>;\n\tsetter?: DTableSetter<ROW_VALUE, CELL_VALUE>;\n\tpath?: string;\n\tdefault?: CELL_VALUE;\n\tformatter?: DTableFormatter<CELL_VALUE>;\n\talign?: keyof typeof DAlignHorizontal | DAlignHorizontal;\n\n\t/**\n\t * If the renderable is\n\t *\n\t * * true, cells get rendered.\n\t * * false, cells do not get rendered.\n\t * * a function, cells get rendered only when that function returns true.\n\t * * \"AUTO\", cells get rendered only when the cell data exit.\n\t */\n\trenderable?: boolean | DTableRenderable<ROW_VALUE> | \"auto\" | \"AUTO\";\n\n\t/**\n\t * If the editable is\n\t *\n\t * * true, cells get editable.\n\t * * false, cells do not get editable.\n\t * * a function, cells are editable only when that function returns true.\n\t * * \"AUTO\", cells are editable only when the cell data exist.\n\t */\n\teditable?: boolean | DTableEditable<ROW_VALUE> | \"auto\" | \"AUTO\";\n\tediting?: DTableColumnEditingOptions<ROW_VALUE, CELL_VALUE>;\n\n\tsortable?: boolean;\n\tsorting?: DTableColumnSortingOptions<ROW_VALUE>;\n\n\theader?: DTableHeaderCellOptions<ROW_VALUE>;\n\tbody?: DTableBodyCellOptionsUnion<ROW_VALUE>;\n\n\tselecting?: DTableColumnSelectingOptions<CELL_VALUE, DIALOG_VALUE, DIALOG>;\n\n\tcategory?: string | string[];\n\tfrozen?: boolean;\n\n\tlink?: DTableBodyCellLinkLinkOptions<ROW_VALUE, CELL_VALUE>;\n}\n\nexport interface DTableColumn<\n\tROW_VALUE,\n\tCELL_VALUE,\n\tDIALOG_VALUE = CELL_VALUE,\n\tDIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE> = DTableColumnSelectingDialog<DIALOG_VALUE>\n> {\n\tweight: number | undefined;\n\twidth: number | undefined;\n\n\ttype: DTableColumnType;\n\tlabel: string;\n\tgetter: DTableGetter<ROW_VALUE, CELL_VALUE>;\n\tsetter: DTableSetter<ROW_VALUE, CELL_VALUE>;\n\tformatter?: DTableFormatter<CELL_VALUE>;\n\talign: DAlignHorizontal;\n\trenderable: boolean | DTableRenderable<ROW_VALUE>;\n\n\tediting: DTableColumnEditing<ROW_VALUE, CELL_VALUE>;\n\tsorting: DTableColumnSorting<ROW_VALUE>;\n\n\theader?: DTableHeaderCellOptions<ROW_VALUE>;\n\tbody?: DTableBodyCellOptionsUnion<ROW_VALUE>;\n\n\tselecting: DTableColumnSelecting<CELL_VALUE, DIALOG_VALUE, DIALOG>;\n\n\tcategory?: string | string[];\n\tfrozen?: boolean;\n\toffset: number;\n\n\tlink?: DTableBodyCellLinkLinkOptions<ROW_VALUE, CELL_VALUE>;\n}\n"]}
|
|
@@ -52,13 +52,7 @@ var DThemeDarkDialog = /** @class */ (function (_super) {
|
|
|
52
52
|
return 5;
|
|
53
53
|
};
|
|
54
54
|
DThemeDarkDialog.prototype.getAlign = function (mode) {
|
|
55
|
-
|
|
56
|
-
case DDialogMode.MODAL:
|
|
57
|
-
return DDialogAlign.OVER;
|
|
58
|
-
case DDialogMode.MODELESS:
|
|
59
|
-
case DDialogMode.MENU:
|
|
60
|
-
return DDialogAlign.BOTTOM;
|
|
61
|
-
}
|
|
55
|
+
return DDialogAlign.BOTTOM;
|
|
62
56
|
};
|
|
63
57
|
DThemeDarkDialog.prototype.newAnimation = function (mode) {
|
|
64
58
|
switch (mode) {
|