@wcardinal/wcardinal-ui 0.167.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/wcardinal/ui/d-button-select.js +1 -1
- package/dist/wcardinal/ui/d-button-select.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +2 -2
- package/dist/wcardinal-ui.js +2 -2
- 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>;
|
|
@@ -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,CAAC,KAAK,CAAC;AACrB,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG;IACrB,aAAa;AACd,CAAC,CAAC;AAEF,IAAM,SAAS,GAAG,UACjB,OAAiB;;IAEjB,IAAI,OAAO,EAAE;QACZ,oEAAoE;QACpE,IAAM,SAAS,GAAG,MAAA,OAAO,CAAC,IAAI,0CAAE,SAAS,CAAC;QAC1C,IAAI,SAAS,KAAK,SAAS,EAAE;YAC5B,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC5B,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,EAAE;gBAClC,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;gBACtB,IAAM,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBAC/C,IAAM,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBAC3C,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;oBACjC,8EAA8E;oBAC9E,IAAI,CAAC,SAAS,GAAG,SAAgB,CAAC;iBAClC;aACD;SACD;aAAM;YACN,2DAA2D;YAC3D,IAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC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,KAAK,QAAQ,EAAE;gBAC1B,KAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;gBACrB,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAI,CAAC,CAAC;aAC9C;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,sBAAI,iCAAM;aAAV;;YACC,IAAI,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC1B,IAAI,MAAM,IAAI,IAAI,EAAE;gBACnB,IAAM,OAAO,GAAG,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAC;gBACtC,IAAI,OAAO,IAAI,MAAM,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"]}
|
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.168.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -67710,7 +67710,7 @@ var DButtonSelect = /** @class */ (function (_super) {
|
|
|
67710
67710
|
var dialog = this.dialog;
|
|
67711
67711
|
var oldValue = (_a = this._textValueComputed) !== null && _a !== void 0 ? _a : null;
|
|
67712
67712
|
this._dialogSetter(dialog, oldValue);
|
|
67713
|
-
dialog.open().then(function () {
|
|
67713
|
+
dialog.open(this).then(function () {
|
|
67714
67714
|
var newValue = _this._dialogGetter(dialog);
|
|
67715
67715
|
if (newValue !== oldValue) {
|
|
67716
67716
|
_this.text = newValue;
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.168.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -50388,7 +50388,7 @@
|
|
|
50388
50388
|
var dialog = this.dialog;
|
|
50389
50389
|
var oldValue = (_a = this._textValueComputed) !== null && _a !== void 0 ? _a : null;
|
|
50390
50390
|
this._dialogSetter(dialog, oldValue);
|
|
50391
|
-
dialog.open().then(function () {
|
|
50391
|
+
dialog.open(this).then(function () {
|
|
50392
50392
|
var newValue = _this._dialogGetter(dialog);
|
|
50393
50393
|
if (newValue !== oldValue) {
|
|
50394
50394
|
_this.text = newValue;
|