@wcardinal/wcardinal-ui 0.234.0 → 0.236.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-dialog-select-search-dismissable-impl.d.ts +14 -0
- package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable.d.ts +11 -0
- package/dist/types/wcardinal/ui/d-dialog-select-search-impl.d.ts +10 -0
- package/dist/types/wcardinal/ui/d-dialog-select-search.d.ts +7 -8
- package/dist/types/wcardinal/ui/d-dialog-select.d.ts +5 -11
- package/dist/types/wcardinal/ui/index.d.ts +3 -0
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable-impl.js +61 -0
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable.js +6 -0
- package/dist/wcardinal/ui/d-dialog-select-search-dismissable.js.map +1 -0
- package/dist/wcardinal/ui/d-dialog-select-search-impl.js +40 -0
- package/dist/wcardinal/ui/d-dialog-select-search-impl.js.map +1 -0
- package/dist/wcardinal/ui/d-dialog-select-search.js +1 -41
- package/dist/wcardinal/ui/d-dialog-select-search.js.map +1 -1
- package/dist/wcardinal/ui/d-dialog-select.js +44 -26
- package/dist/wcardinal/ui/d-dialog-select.js.map +1 -1
- package/dist/wcardinal/ui/index.js +3 -0
- package/dist/wcardinal/ui/index.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 +109 -39
- package/dist/wcardinal-ui.js +109 -39
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { utils } from "pixi.js";
|
|
2
|
+
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
3
|
+
import { DDialogSelectSearchDismissable, DDialogSelectSearhDismissableFilter, DDialogSelectSearhDismissableOptions } from "./d-dialog-select-search-dismissable";
|
|
4
|
+
export declare class DDialogSelectSearhDismissableImpl<VALUE> extends utils.EventEmitter implements DDialogSelectSearchDismissable<VALUE> {
|
|
5
|
+
protected _target: DDialogSelectSearch<VALUE>;
|
|
6
|
+
protected _args?: [string];
|
|
7
|
+
protected _value?: VALUE;
|
|
8
|
+
protected _filter?: DDialogSelectSearhDismissableFilter<VALUE>;
|
|
9
|
+
constructor(target: DDialogSelectSearch<VALUE>, options: DDialogSelectSearhDismissableOptions<VALUE>);
|
|
10
|
+
protected toDismissValue(args?: [string]): VALUE | undefined;
|
|
11
|
+
protected toDismissable(values: VALUE[]): VALUE[];
|
|
12
|
+
create(args: [string]): void;
|
|
13
|
+
isDone(): boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
2
|
+
export declare type DDialogSelectSearhDismissableFilter<VALUE> = (value: VALUE, word?: string) => boolean;
|
|
3
|
+
export interface DDialogSelectSearhDismissableOptions<VALUE> {
|
|
4
|
+
value: VALUE;
|
|
5
|
+
filter?: DDialogSelectSearhDismissableFilter<VALUE>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* {@link DDialogSelect} dismissable search object.
|
|
9
|
+
*/
|
|
10
|
+
export interface DDialogSelectSearchDismissable<VALUE> extends DDialogSelectSearch<VALUE> {
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { utils } from "pixi.js";
|
|
2
|
+
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
3
|
+
export declare class DDialogSelectSearhImpl<VALUE> extends utils.EventEmitter implements DDialogSelectSearch<VALUE> {
|
|
4
|
+
protected _search: (word: string) => Promise<VALUE[]>;
|
|
5
|
+
protected _id: number;
|
|
6
|
+
protected _idCompleted: number;
|
|
7
|
+
constructor(search?: (word: string) => Promise<VALUE[]>);
|
|
8
|
+
create(args: [string]): void;
|
|
9
|
+
isDone(): boolean;
|
|
10
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
protected _idCompleted: number;
|
|
6
|
-
protected _result: SEARCH_RESULT[] | null;
|
|
7
|
-
constructor(search?: (word: string) => Promise<SEARCH_RESULT[]>);
|
|
1
|
+
/**
|
|
2
|
+
* {@link DDialogSelect} search object.
|
|
3
|
+
*/
|
|
4
|
+
export interface DDialogSelectSearch<VALUE> {
|
|
8
5
|
create(args: [string]): void;
|
|
6
|
+
on(event: "success", handler: (e: unknown, searchResults: VALUE[]) => void): void;
|
|
7
|
+
on(event: "fail", handler: () => void): void;
|
|
8
|
+
on(event: "change", handler: () => void): void;
|
|
9
9
|
isDone(): boolean;
|
|
10
|
-
getResult(): SEARCH_RESULT[] | null;
|
|
11
10
|
}
|
|
@@ -5,22 +5,14 @@ import { DDialogSelectList, DDialogSelectListOptions } from "./d-dialog-select-l
|
|
|
5
5
|
import { DInputSearch, DInputSearchOptions } from "./d-input-search";
|
|
6
6
|
import { DLayoutHorizontal, DLayoutHorizontalOptions } from "./d-layout-horizontal";
|
|
7
7
|
import { DListOptions } from "./d-list";
|
|
8
|
+
import { DListDataSelection } from "./d-list-data-selection";
|
|
8
9
|
import { DNote, DNoteOptions } from "./d-note";
|
|
9
10
|
import { DOnOptions } from "./d-on-options";
|
|
11
|
+
import { DDialogSelectSearch } from "./d-dialog-select-search";
|
|
12
|
+
import { DDialogSelectSearhDismissableOptions } from "./d-dialog-select-search-dismissable";
|
|
10
13
|
export interface DDialogSelectInputOpitons extends DInputSearchOptions {
|
|
11
14
|
margin?: number;
|
|
12
15
|
}
|
|
13
|
-
/**
|
|
14
|
-
* {@link DDialogSelect} search object.
|
|
15
|
-
*/
|
|
16
|
-
export interface DDialogSelectSearch<VALUE> {
|
|
17
|
-
create(args: [string]): void;
|
|
18
|
-
on(event: "success", handler: (e: unknown, searchResults: VALUE[]) => void): void;
|
|
19
|
-
on(event: "fail", handler: () => void): void;
|
|
20
|
-
on(event: "change", handler: () => void): void;
|
|
21
|
-
isDone(): boolean;
|
|
22
|
-
getResult(): VALUE[] | null;
|
|
23
|
-
}
|
|
24
16
|
/**
|
|
25
17
|
* {@link DDialogSelect} search function.
|
|
26
18
|
*/
|
|
@@ -57,6 +49,7 @@ export interface DDialogSelectOnOptions<VALUE, EMITTER> extends Partial<DDialogS
|
|
|
57
49
|
*/
|
|
58
50
|
export interface DDialogSelectOptions<VALUE, THEME extends DThemeDialogSelect<VALUE> = DThemeDialogSelect<VALUE>, EMITTER = any> extends DDialogLayeredOptions<VALUE, THEME> {
|
|
59
51
|
controller?: DDialogSelectController<VALUE>;
|
|
52
|
+
dismiss?: DDialogSelectSearhDismissableOptions<VALUE>;
|
|
60
53
|
input?: DDialogSelectInputOpitons;
|
|
61
54
|
list?: DListOptions<VALUE>;
|
|
62
55
|
note?: DDialogSelectNoteOptions;
|
|
@@ -88,6 +81,7 @@ export declare class DDialogSelect<VALUE = unknown, THEME extends DThemeDialogSe
|
|
|
88
81
|
protected toInputMargin(theme: THEME, options?: OPTIONS): number;
|
|
89
82
|
get list(): DDialogSelectList<VALUE>;
|
|
90
83
|
protected newList(): DDialogSelectList<VALUE>;
|
|
84
|
+
protected onListSelectionChange(selection: DListDataSelection<VALUE>): void;
|
|
91
85
|
protected toListOptions(theme: THEME, options?: OPTIONS): DDialogSelectListOptions<VALUE>;
|
|
92
86
|
protected get noteError(): DNote | null;
|
|
93
87
|
protected newNoteError(): DNote | null;
|
|
@@ -261,6 +261,9 @@ export * from "./d-dialog-save-as";
|
|
|
261
261
|
export * from "./d-dialog-select-list-item-updater";
|
|
262
262
|
export * from "./d-dialog-select-list-item";
|
|
263
263
|
export * from "./d-dialog-select-list";
|
|
264
|
+
export * from "./d-dialog-select-search-dismissable-impl";
|
|
265
|
+
export * from "./d-dialog-select-search-dismissable";
|
|
266
|
+
export * from "./d-dialog-select-search-impl";
|
|
264
267
|
export * from "./d-dialog-select-search";
|
|
265
268
|
export * from "./d-dialog-select";
|
|
266
269
|
export * from "./d-dialog-state";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { __extends } from "tslib";
|
|
6
|
+
import { utils } from "pixi.js";
|
|
7
|
+
var DDialogSelectSearhDismissableImpl = /** @class */ (function (_super) {
|
|
8
|
+
__extends(DDialogSelectSearhDismissableImpl, _super);
|
|
9
|
+
function DDialogSelectSearhDismissableImpl(target, options) {
|
|
10
|
+
var _this = _super.call(this) || this;
|
|
11
|
+
_this._target = target;
|
|
12
|
+
_this._value = options.value;
|
|
13
|
+
_this._filter = options.filter;
|
|
14
|
+
target.on("change", function () {
|
|
15
|
+
_this.emit("change", _this);
|
|
16
|
+
});
|
|
17
|
+
target.on("success", function (e, values) {
|
|
18
|
+
_this.emit("success", _this, _this.toDismissable(values));
|
|
19
|
+
});
|
|
20
|
+
target.on("fail", function () {
|
|
21
|
+
_this.emit("fail", _this);
|
|
22
|
+
});
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
DDialogSelectSearhDismissableImpl.prototype.toDismissValue = function (args) {
|
|
26
|
+
if (args == null) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var value = this._value;
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var filter = this._filter;
|
|
34
|
+
if (filter != null && !filter(value, args[0])) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
};
|
|
39
|
+
DDialogSelectSearhDismissableImpl.prototype.toDismissable = function (values) {
|
|
40
|
+
var value = this.toDismissValue(this._args);
|
|
41
|
+
if (value === undefined) {
|
|
42
|
+
return values;
|
|
43
|
+
}
|
|
44
|
+
var result = [];
|
|
45
|
+
for (var i = 0, imax = values.length; i < imax; ++i) {
|
|
46
|
+
result.push(values[i]);
|
|
47
|
+
}
|
|
48
|
+
result.push(value);
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
51
|
+
DDialogSelectSearhDismissableImpl.prototype.create = function (args) {
|
|
52
|
+
this._args = args;
|
|
53
|
+
this._target.create(args);
|
|
54
|
+
};
|
|
55
|
+
DDialogSelectSearhDismissableImpl.prototype.isDone = function () {
|
|
56
|
+
return this._target.isDone();
|
|
57
|
+
};
|
|
58
|
+
return DDialogSelectSearhDismissableImpl;
|
|
59
|
+
}(utils.EventEmitter));
|
|
60
|
+
export { DDialogSelectSearhDismissableImpl };
|
|
61
|
+
//# sourceMappingURL=d-dialog-select-search-dismissable-impl.js.map
|
|
@@ -0,0 +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,MAAkC,EAClC,OAAoD;QAFrD,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;YACnB,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,CAAC,EAAE,MAAM;YAC9B,KAAI,CAAC,IAAI,CAAC,SAAS,E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AC;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>\n\textends utils.EventEmitter\n\timplements DDialogSelectSearchDismissable<VALUE>\n{\n\tprotected _target: DDialogSelectSearch<VALUE>;\n\n\tprotected _args?: [string];\n\tprotected _value?: VALUE;\n\tprotected _filter?: DDialogSelectSearhDismissableFilter<VALUE>;\n\n\tconstructor(\n\t\ttarget: DDialogSelectSearch<VALUE>,\n\t\toptions: DDialogSelectSearhDismissableOptions<VALUE>\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]): 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]): 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"]}
|
|
@@ -0,0 +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> = (value: VALUE, word?: string) => boolean;\n\nexport interface DDialogSelectSearhDismissableOptions<VALUE> {\n\tvalue: VALUE;\n\tfilter?: DDialogSelectSearhDismissableFilter<VALUE>;\n}\n\n/**\n * {@link DDialogSelect} dismissable search object.\n */\nexport interface DDialogSelectSearchDismissable<VALUE> extends DDialogSelectSearch<VALUE> {}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { __extends } from "tslib";
|
|
6
|
+
import { utils } from "pixi.js";
|
|
7
|
+
var DDialogSelectSearhImpl = /** @class */ (function (_super) {
|
|
8
|
+
__extends(DDialogSelectSearhImpl, _super);
|
|
9
|
+
function DDialogSelectSearhImpl(search) {
|
|
10
|
+
var _this = _super.call(this) || this;
|
|
11
|
+
_this._search = search || (function (_) { return Promise.resolve([]); });
|
|
12
|
+
_this._id = 0;
|
|
13
|
+
_this._idCompleted = 0;
|
|
14
|
+
return _this;
|
|
15
|
+
}
|
|
16
|
+
DDialogSelectSearhImpl.prototype.create = function (args) {
|
|
17
|
+
var _this = this;
|
|
18
|
+
var id = ++this._id;
|
|
19
|
+
this._search(args[0]).then(function (searchResult) {
|
|
20
|
+
if (_this._id === id) {
|
|
21
|
+
_this._idCompleted = id;
|
|
22
|
+
_this.emit("success", _this, searchResult);
|
|
23
|
+
_this.emit("change", _this);
|
|
24
|
+
}
|
|
25
|
+
}, function () {
|
|
26
|
+
if (_this._id === id) {
|
|
27
|
+
_this._idCompleted = id;
|
|
28
|
+
_this.emit("fail", _this);
|
|
29
|
+
_this.emit("change", _this);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.emit("change", this);
|
|
33
|
+
};
|
|
34
|
+
DDialogSelectSearhImpl.prototype.isDone = function () {
|
|
35
|
+
return this._id === this._idCompleted;
|
|
36
|
+
};
|
|
37
|
+
return DDialogSelectSearhImpl;
|
|
38
|
+
}(utils.EventEmitter));
|
|
39
|
+
export { DDialogSelectSearhImpl };
|
|
40
|
+
//# sourceMappingURL=d-dialog-select-search-impl.js.map
|
|
@@ -0,0 +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;AAGhC;IACS,0CAAkB;IAO1B,gCAAY,MAA2C;QAAvD,YACC,iBAAO,SAKP;QAHA,KAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,UAAC,CAAS,IAAK,OAAA,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAnB,CAAmB,CAAC,CAAC;QAC9D,KAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,KAAI,CAAC,YAAY,GAAG,CAAC,CAAC;;IACvB,CAAC;IAED,uCAAM,GAAN,UAAO,IAAc;QAArB,iBAmBC;QAlBA,IAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACzB,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 { DDialogSelectSearch } from \"./d-dialog-select-search\";\n\nexport class DDialogSelectSearhImpl<VALUE>\n\textends utils.EventEmitter\n\timplements DDialogSelectSearch<VALUE>\n{\n\tprotected _search: (word: string) => Promise<VALUE[]>;\n\tprotected _id: number;\n\tprotected _idCompleted: number;\n\n\tconstructor(search?: (word: string) => Promise<VALUE[]>) {\n\t\tsuper();\n\n\t\tthis._search = search || ((_: string) => Promise.resolve([]));\n\t\tthis._id = 0;\n\t\tthis._idCompleted = 0;\n\t}\n\n\tcreate(args: [string]): void {\n\t\tconst id = ++this._id;\n\t\tthis._search(args[0]).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"]}
|
|
@@ -2,45 +2,5 @@
|
|
|
2
2
|
* Copyright (C) 2019 Toshiba Corporation
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import { utils } from "pixi.js";
|
|
7
|
-
var DDialogSelectSearh = /** @class */ (function (_super) {
|
|
8
|
-
__extends(DDialogSelectSearh, _super);
|
|
9
|
-
function DDialogSelectSearh(search) {
|
|
10
|
-
var _this = _super.call(this) || this;
|
|
11
|
-
_this._search = search || (function (_) { return Promise.resolve([]); });
|
|
12
|
-
_this._id = 0;
|
|
13
|
-
_this._idCompleted = 0;
|
|
14
|
-
_this._result = null;
|
|
15
|
-
return _this;
|
|
16
|
-
}
|
|
17
|
-
DDialogSelectSearh.prototype.create = function (args) {
|
|
18
|
-
var _this = this;
|
|
19
|
-
var id = ++this._id;
|
|
20
|
-
this._search(args[0]).then(function (searchResult) {
|
|
21
|
-
if (_this._id === id) {
|
|
22
|
-
_this._idCompleted = id;
|
|
23
|
-
_this._result = searchResult;
|
|
24
|
-
_this.emit("success", _this, searchResult);
|
|
25
|
-
_this.emit("change", _this);
|
|
26
|
-
}
|
|
27
|
-
}, function () {
|
|
28
|
-
if (_this._id === id) {
|
|
29
|
-
_this._idCompleted = id;
|
|
30
|
-
_this._result = null;
|
|
31
|
-
_this.emit("fail", _this);
|
|
32
|
-
_this.emit("change", _this);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
this.emit("change", this);
|
|
36
|
-
};
|
|
37
|
-
DDialogSelectSearh.prototype.isDone = function () {
|
|
38
|
-
return this._id === this._idCompleted;
|
|
39
|
-
};
|
|
40
|
-
DDialogSelectSearh.prototype.getResult = function () {
|
|
41
|
-
return this._result;
|
|
42
|
-
};
|
|
43
|
-
return DDialogSelectSearh;
|
|
44
|
-
}(utils.EventEmitter));
|
|
45
|
-
export { DDialogSelectSearh };
|
|
5
|
+
export {};
|
|
46
6
|
//# sourceMappingURL=d-dialog-select-search.js.map
|
|
@@ -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
|
|
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> {\n\tcreate(args: [string]): 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"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { __extends } from "tslib";
|
|
6
6
|
import { DDialogLayered } from "./d-dialog-layered";
|
|
7
7
|
import { DDialogSelectList } from "./d-dialog-select-list";
|
|
8
|
-
import {
|
|
8
|
+
import { DDialogSelectSearhImpl } from "./d-dialog-select-search-impl";
|
|
9
9
|
import { DInputSearch } from "./d-input-search";
|
|
10
10
|
import { DLayoutHorizontal } from "./d-layout-horizontal";
|
|
11
11
|
import { DLayoutSpace } from "./d-layout-space";
|
|
@@ -13,36 +13,30 @@ import { DNoteSmallError } from "./d-note-small-error";
|
|
|
13
13
|
import { DNoteSmallNoItemsFound } from "./d-note-small-no-items-found";
|
|
14
14
|
import { DNoteSmallSearching } from "./d-note-small-searching";
|
|
15
15
|
import { UtilTransition } from "./util/util-transition";
|
|
16
|
+
import { DDialogSelectSearhDismissableImpl } from "./d-dialog-select-search-dismissable-impl";
|
|
16
17
|
var DDialogSelect = /** @class */ (function (_super) {
|
|
17
18
|
__extends(DDialogSelect, _super);
|
|
18
19
|
function DDialogSelect(options) {
|
|
19
20
|
var _this = _super.call(this, options) || this;
|
|
20
21
|
_this._value = null;
|
|
21
22
|
// Controller binding
|
|
23
|
+
var transition = new UtilTransition();
|
|
22
24
|
var search = _this.search;
|
|
23
25
|
search.on("success", function (e, results) {
|
|
26
|
+
if (0 < results.length) {
|
|
27
|
+
transition.hide();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
transition.show(_this.noteNoItemsFound);
|
|
31
|
+
}
|
|
24
32
|
_this.onSearched(results);
|
|
25
33
|
});
|
|
26
34
|
search.on("fail", function () {
|
|
35
|
+
transition.show(_this.noteError);
|
|
27
36
|
_this.onSearched([]);
|
|
28
37
|
});
|
|
29
|
-
var transition = new UtilTransition();
|
|
30
38
|
search.on("change", function () {
|
|
31
|
-
if (search.isDone()) {
|
|
32
|
-
var searchResult = search.getResult();
|
|
33
|
-
if (searchResult != null) {
|
|
34
|
-
if (0 < searchResult.length) {
|
|
35
|
-
transition.hide();
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
transition.show(_this.noteNoItemsFound);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
transition.show(_this.noteError);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
39
|
+
if (!search.isDone()) {
|
|
46
40
|
var noteSearching = _this.noteSearching;
|
|
47
41
|
if (noteSearching) {
|
|
48
42
|
transition.show(noteSearching);
|
|
@@ -130,14 +124,27 @@ var DDialogSelect = /** @class */ (function (_super) {
|
|
|
130
124
|
var _this = this;
|
|
131
125
|
var result = new DDialogSelectList(this.toListOptions(this.theme, this._options));
|
|
132
126
|
result.selection.on("change", function (selection) {
|
|
133
|
-
|
|
134
|
-
if (first != null) {
|
|
135
|
-
_this._value = first;
|
|
136
|
-
_this.onOk(first);
|
|
137
|
-
}
|
|
127
|
+
_this.onListSelectionChange(selection);
|
|
138
128
|
});
|
|
139
129
|
return result;
|
|
140
130
|
};
|
|
131
|
+
DDialogSelect.prototype.onListSelectionChange = function (selection) {
|
|
132
|
+
var selected = selection.first;
|
|
133
|
+
if (selected == null) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var options = this._options;
|
|
137
|
+
if (options) {
|
|
138
|
+
var dismiss = options.dismiss;
|
|
139
|
+
if (dismiss) {
|
|
140
|
+
if (selected === dismiss.value) {
|
|
141
|
+
selected = null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
this._value = selected;
|
|
146
|
+
this.onOk(selected);
|
|
147
|
+
};
|
|
141
148
|
DDialogSelect.prototype.toListOptions = function (theme, options) {
|
|
142
149
|
var result = (options === null || options === void 0 ? void 0 : options.list) || {};
|
|
143
150
|
if (result.width === undefined) {
|
|
@@ -200,7 +207,7 @@ var DDialogSelect = /** @class */ (function (_super) {
|
|
|
200
207
|
DDialogSelect.prototype.newNoteSearching = function () {
|
|
201
208
|
var _a, _b;
|
|
202
209
|
var searching = (_b = (_a = this._options) === null || _a === void 0 ? void 0 : _a.note) === null || _b === void 0 ? void 0 : _b.searching;
|
|
203
|
-
// Because the `
|
|
210
|
+
// Because the `searching` note is disabled by default,
|
|
204
211
|
// if options.searching is missing, i.e., if its value is undefined,
|
|
205
212
|
// this method returns null. This is why `!=` is used here instead of `!==`.
|
|
206
213
|
if (searching != null) {
|
|
@@ -240,16 +247,27 @@ var DDialogSelect = /** @class */ (function (_super) {
|
|
|
240
247
|
if (options) {
|
|
241
248
|
var controller = options.controller;
|
|
242
249
|
if (controller) {
|
|
250
|
+
var dismiss = options.dismiss;
|
|
243
251
|
var search = controller.search;
|
|
244
252
|
if ("create" in search) {
|
|
245
|
-
|
|
253
|
+
if (dismiss != null) {
|
|
254
|
+
return new DDialogSelectSearhDismissableImpl(search, dismiss);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return search;
|
|
258
|
+
}
|
|
246
259
|
}
|
|
247
260
|
else {
|
|
248
|
-
|
|
261
|
+
if (dismiss != null) {
|
|
262
|
+
return new DDialogSelectSearhDismissableImpl(new DDialogSelectSearhImpl(search), dismiss);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return new DDialogSelectSearhImpl(search);
|
|
266
|
+
}
|
|
249
267
|
}
|
|
250
268
|
}
|
|
251
269
|
}
|
|
252
|
-
return new
|
|
270
|
+
return new DDialogSelectSearhImpl();
|
|
253
271
|
};
|
|
254
272
|
Object.defineProperty(DDialogSelect.prototype, "value", {
|
|
255
273
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dialog-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EACN,cAAc,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAuB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAA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AC;SACf;QACD,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,oBAAC;AAAD,CAAC,AApSD,CAIU,cAAc,GAgSvB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject } from \"pixi.js\";\nimport { DBase } from \"./d-base\";\nimport {\n\tDDialogLayered,\n\tDDialogLayeredEvents,\n\tDDialogLayeredOptions,\n\tDThemeDialogLayered\n} from \"./d-dialog-layered\";\nimport { DDialogSelectList, DDialogSelectListOptions } from \"./d-dialog-select-list\";\nimport { DDialogSelectSearh } from \"./d-dialog-select-search\";\nimport { DInputSearch, DInputSearchOptions } from \"./d-input-search\";\nimport { DLayoutHorizontal, DLayoutHorizontalOptions } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DListOptions } from \"./d-list\";\nimport { DListDataSelection } from \"./d-list-data-selection\";\nimport { DNote, DNoteOptions } from \"./d-note\";\nimport { DNoteSmallError } from \"./d-note-small-error\";\nimport { DNoteSmallNoItemsFound } from \"./d-note-small-no-items-found\";\nimport { DNoteSmallSearching } from \"./d-note-small-searching\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { UtilTransition } from \"./util/util-transition\";\n\nexport interface DDialogSelectInputOpitons extends DInputSearchOptions {\n\tmargin?: number;\n}\n\n/**\n * {@link DDialogSelect} search object.\n */\nexport interface DDialogSelectSearch<VALUE> {\n\tcreate(args: [string]): 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\tgetResult(): VALUE[] | null;\n}\n\n/**\n * {@link DDialogSelect} search function.\n */\nexport type DDialogSelectSearchFunction<VALUE> = (word: string) => Promise<VALUE[]>;\n\n/**\n * {@link DDialogSelect} controller.\n */\nexport interface DDialogSelectController<VALUE> {\n\tsearch: DDialogSelectSearch<VALUE> | DDialogSelectSearchFunction<VALUE>;\n}\n\n/**\n * {@link DDialogSelect} note options.\n */\nexport interface DDialogSelectNoteOptions {\n\terror?: DNoteOptions | null;\n\tnoItemsFound?: DNoteOptions | null;\n\tsearching?: DNoteOptions | null;\n}\n\nexport type DDialogSelectItemToLabel<VALUE> = (result: VALUE, caller: any) => string;\n\nexport type DDialogSelectItemIsEqual<VALUE> = (a: VALUE, b: VALUE, caller: any) => boolean;\n\n/**\n * {@link DDialogSelect} events.\n */\nexport interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvents<VALUE, EMITTER> {\n\tselect(value: VALUE, self: EMITTER): void;\n}\n\n/**\n * {@link DDialogSelect} \"on\" options.\n */\nexport interface DDialogSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DDialogSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDialogSelect} options.\n */\nexport interface DDialogSelectOptions<\n\tVALUE,\n\tTHEME extends DThemeDialogSelect<VALUE> = DThemeDialogSelect<VALUE>,\n\tEMITTER = any\n> extends DDialogLayeredOptions<VALUE, THEME> {\n\tcontroller?: DDialogSelectController<VALUE>;\n\tinput?: DDialogSelectInputOpitons;\n\tlist?: DListOptions<VALUE>;\n\tnote?: DDialogSelectNoteOptions;\n\ton?: DDialogSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DDialogSelect} theme.\n */\nexport interface DThemeDialogSelect<VALUE = unknown> extends DThemeDialogLayered {\n\tgetInputMargin(): number;\n}\n\nexport class DDialogSelect<\n\tVALUE = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE> = DThemeDialogSelect<VALUE>,\n\tOPTIONS extends DDialogSelectOptions<VALUE, THEME> = DDialogSelectOptions<VALUE, THEME>\n> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\tprotected _input?: DInputSearch;\n\tprotected _inputLayout?: DLayoutHorizontal;\n\tprotected _list?: DDialogSelectList<VALUE>;\n\tprotected _search?: DDialogSelectSearch<VALUE>;\n\tprotected _noteError?: DNote | null;\n\tprotected _noteNoItemsFound?: DNote | null;\n\tprotected _noteSearching?: DNote | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis._value = null;\n\n\t\t// Controller binding\n\t\tconst search = this.search;\n\t\tsearch.on(\"success\", (e: unknown, results: VALUE[]): void => {\n\t\t\tthis.onSearched(results);\n\t\t});\n\t\tsearch.on(\"fail\", (): void => {\n\t\t\tthis.onSearched([]);\n\t\t});\n\t\tconst transition = new UtilTransition();\n\t\tsearch.on(\"change\", (): void => {\n\t\t\tif (search.isDone()) {\n\t\t\t\tconst searchResult = search.getResult();\n\t\t\t\tif (searchResult != null) {\n\t\t\t\t\tif (0 < searchResult.length) {\n\t\t\t\t\t\ttransition.hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttransition.show(this.noteNoItemsFound);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttransition.show(this.noteError);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst noteSearching = this.noteSearching;\n\t\t\t\tif (noteSearching) {\n\t\t\t\t\ttransition.show(noteSearching);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected newContentChildren(theme: THEME, options?: OPTIONS): Array<DisplayObject | null> {\n\t\tconst result = super.newContentChildren(theme, options);\n\t\tresult.push(this.inputLayout, this.list);\n\t\treturn result;\n\t}\n\n\tprotected get inputLayout(): DLayoutHorizontal {\n\t\tlet result = this._inputLayout;\n\t\tif (result == null) {\n\t\t\tresult = this.newInputLayout(this.input, this.theme, this._options);\n\t\t\tthis._inputLayout = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInputLayout(\n\t\tinput: DInputSearch,\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DLayoutHorizontal {\n\t\treturn new DLayoutHorizontal(this.toInputLayoutOptions(input, theme, options));\n\t}\n\n\tprotected toInputLayoutOptions(\n\t\tinput: DInputSearch,\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DLayoutHorizontalOptions {\n\t\tconst margin = this.toInputMargin(theme, options);\n\t\treturn {\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tchildren: [\n\t\t\t\tnew DLayoutSpace({ width: margin }),\n\t\t\t\tinput,\n\t\t\t\tnew DLayoutSpace({ width: margin })\n\t\t\t]\n\t\t};\n\t}\n\n\tget input(): DInputSearch {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tresult = this.newInput();\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInput(): DInputSearch {\n\t\tconst result = new DInputSearch(this.toInputOptions(this.theme, this._options));\n\t\tresult.on(\"input\", (value: string): void => {\n\t\t\tthis.search.create([value]);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected toInputOptions(theme: THEME, options?: OPTIONS): DInputSearchOptions {\n\t\tconst result = options?.input || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.weight = 1;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected toInputMargin(theme: THEME, options?: OPTIONS): number {\n\t\treturn options?.input?.margin ?? theme.getInputMargin();\n\t}\n\n\tget list(): DDialogSelectList<VALUE> {\n\t\tlet result = this._list;\n\t\tif (result == null) {\n\t\t\tresult = this.newList();\n\t\t\tthis._list = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newList(): DDialogSelectList<VALUE> {\n\t\tconst result = new DDialogSelectList<VALUE>(this.toListOptions(this.theme, this._options));\n\t\tresult.selection.on(\"change\", (selection: DListDataSelection<VALUE>): void => {\n\t\t\tconst first = selection.first;\n\t\t\tif (first != null) {\n\t\t\t\tthis._value = first;\n\t\t\t\tthis.onOk(first);\n\t\t\t}\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected toListOptions(theme: THEME, options?: OPTIONS): DDialogSelectListOptions<VALUE> {\n\t\tconst result = options?.list || {};\n\t\tif (result.width === undefined) {\n\t\t\tresult.width = \"padding\";\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get noteError(): DNote | null {\n\t\tlet result = this._noteError;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteError();\n\t\t\tthis._noteError = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteError(): DNote | null {\n\t\tconst error = this._options?.note?.error;\n\t\tif (error !== null) {\n\t\t\treturn new DNoteSmallError(this.toNoteOptions(this.list, error));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteNoItemsFound(): DNote | null {\n\t\tlet result = this._noteNoItemsFound;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteNoItemsFound();\n\t\t\tthis._noteNoItemsFound = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteNoItemsFound(): DNote | null {\n\t\tconst noItemsFound = this._options?.note?.noItemsFound;\n\t\tif (noItemsFound !== null) {\n\t\t\treturn new DNoteSmallNoItemsFound(this.toNoteOptions(this.list, noItemsFound));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteSearching(): DNote | null {\n\t\tlet result = this._noteSearching;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteSearching();\n\t\t\tthis._noteSearching = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteSearching(): DNote | null {\n\t\tconst searching = this._options?.note?.searching;\n\t\t// Because the `searcing` note is disabled by default,\n\t\t// if options.searching is missing, i.e., if its value is undefined,\n\t\t// this method returns null. This is why `!=` is used here instead of `!==`.\n\t\tif (searching != null) {\n\t\t\treturn new DNoteSmallSearching(this.toNoteOptions(this.list, searching));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toNoteOptions(parent: DBase, options?: DNoteOptions): DNoteOptions {\n\t\tif (options != null) {\n\t\t\tif (options.parent == null) {\n\t\t\t\toptions.parent = parent;\n\t\t\t}\n\t\t\tif (options.visible == null) {\n\t\t\t\toptions.visible = false;\n\t\t\t}\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tparent,\n\t\t\tvisible: false\n\t\t};\n\t}\n\n\tprotected get search(): DDialogSelectSearch<VALUE> {\n\t\tlet result = this._search;\n\t\tif (result == null) {\n\t\t\tresult = this.newSearch();\n\t\t\tthis._search = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSearch(): DDialogSelectSearch<VALUE> {\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller) {\n\t\t\t\tconst search = controller.search;\n\t\t\t\tif (\"create\" in search) {\n\t\t\t\t\treturn search;\n\t\t\t\t} else {\n\t\t\t\t\treturn new DDialogSelectSearh(search);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new DDialogSelectSearh();\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\tprotected onSearched(results: VALUE[]): void {\n\t\tthis.list.data.items = results;\n\t}\n\n\tprotected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null> {\n\t\treturn this._value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogSelect\";\n\t}\n\n\tprotected onOpen(): void {\n\t\tsuper.onOpen();\n\t\tthis.list.selection.clear();\n\t\tthis.search.create([this.input.value]);\n\t}\n\n\tprotected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void {\n\t\tthis.emit(\"select\", value, this);\n\t\tsuper.onOk(value);\n\t}\n\n\tdestroy(): void {\n\t\tconst input = this._input;\n\t\tif (input) {\n\t\t\tinput.destroy();\n\t\t}\n\t\tconst noteError = this._noteError;\n\t\tif (noteError) {\n\t\t\tnoteError.destroy();\n\t\t}\n\t\tconst noteNoItemsFound = this._noteNoItemsFound;\n\t\tif (noteNoItemsFound) {\n\t\t\tnoteNoItemsFound?.destroy();\n\t\t}\n\t\tconst noteSearching = this._noteSearching;\n\t\tif (noteSearching) {\n\t\t\tnoteSearching?.destroy();\n\t\t}\n\t\tconst list = this._list;\n\t\tif (list) {\n\t\t\tlist.destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-dialog-select.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dialog-select.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAIH,OAAO,EACN,cAAc,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAuB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAA4B,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAoE9F;IAIU,iCAA4C;IAUrD,uBAAY,OAAiB;QAA7B,YACC,kBAAM,OAAO,CAAC,SA2Bd;QAzBA,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,qBAAqB;QACrB,IAAM,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACxC,IAAM,MAAM,GAAG,KAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,UAAC,CAAU,EAAE,OAAgB;YACjD,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE;gBACvB,UAAU,CAAC,IAAI,EAAE,CAAC;aAClB;iBAAM;gBACN,UAAU,CAAC,IAAI,CAAC,KAAI,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\nimport { DisplayObject } from \"pixi.js\";\nimport { DBase } from \"./d-base\";\nimport {\n\tDDialogLayered,\n\tDDialogLayeredEvents,\n\tDDialogLayeredOptions,\n\tDThemeDialogLayered\n} from \"./d-dialog-layered\";\nimport { DDialogSelectList, DDialogSelectListOptions } from \"./d-dialog-select-list\";\nimport { DDialogSelectSearhImpl } from \"./d-dialog-select-search-impl\";\nimport { DInputSearch, DInputSearchOptions } from \"./d-input-search\";\nimport { DLayoutHorizontal, DLayoutHorizontalOptions } from \"./d-layout-horizontal\";\nimport { DLayoutSpace } from \"./d-layout-space\";\nimport { DListOptions } from \"./d-list\";\nimport { DListDataSelection } from \"./d-list-data-selection\";\nimport { DNote, DNoteOptions } from \"./d-note\";\nimport { DNoteSmallError } from \"./d-note-small-error\";\nimport { DNoteSmallNoItemsFound } from \"./d-note-small-no-items-found\";\nimport { DNoteSmallSearching } from \"./d-note-small-searching\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { UtilTransition } from \"./util/util-transition\";\nimport { DDialogSelectSearch } from \"./d-dialog-select-search\";\nimport { DDialogSelectSearhDismissableOptions } from \"./d-dialog-select-search-dismissable\";\nimport { DDialogSelectSearhDismissableImpl } from \"./d-dialog-select-search-dismissable-impl\";\n\nexport interface DDialogSelectInputOpitons extends DInputSearchOptions {\n\tmargin?: number;\n}\n\n/**\n * {@link DDialogSelect} search function.\n */\nexport type DDialogSelectSearchFunction<VALUE> = (word: string) => Promise<VALUE[]>;\n\n/**\n * {@link DDialogSelect} controller.\n */\nexport interface DDialogSelectController<VALUE> {\n\tsearch: DDialogSelectSearch<VALUE> | DDialogSelectSearchFunction<VALUE>;\n}\n\n/**\n * {@link DDialogSelect} note options.\n */\nexport interface DDialogSelectNoteOptions {\n\terror?: DNoteOptions | null;\n\tnoItemsFound?: DNoteOptions | null;\n\tsearching?: DNoteOptions | null;\n}\n\nexport type DDialogSelectItemToLabel<VALUE> = (result: VALUE, caller: any) => string;\n\nexport type DDialogSelectItemIsEqual<VALUE> = (a: VALUE, b: VALUE, caller: any) => boolean;\n\n/**\n * {@link DDialogSelect} events.\n */\nexport interface DDialogSelectEvents<VALUE, EMITTER> extends DDialogLayeredEvents<VALUE, EMITTER> {\n\tselect(value: VALUE, self: EMITTER): void;\n}\n\n/**\n * {@link DDialogSelect} \"on\" options.\n */\nexport interface DDialogSelectOnOptions<VALUE, EMITTER>\n\textends Partial<DDialogSelectEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DDialogSelect} options.\n */\nexport interface DDialogSelectOptions<\n\tVALUE,\n\tTHEME extends DThemeDialogSelect<VALUE> = DThemeDialogSelect<VALUE>,\n\tEMITTER = any\n> extends DDialogLayeredOptions<VALUE, THEME> {\n\tcontroller?: DDialogSelectController<VALUE>;\n\tdismiss?: DDialogSelectSearhDismissableOptions<VALUE>;\n\tinput?: DDialogSelectInputOpitons;\n\tlist?: DListOptions<VALUE>;\n\tnote?: DDialogSelectNoteOptions;\n\ton?: DDialogSelectOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DDialogSelect} theme.\n */\nexport interface DThemeDialogSelect<VALUE = unknown> extends DThemeDialogLayered {\n\tgetInputMargin(): number;\n}\n\nexport class DDialogSelect<\n\tVALUE = unknown,\n\tTHEME extends DThemeDialogSelect<VALUE> = DThemeDialogSelect<VALUE>,\n\tOPTIONS extends DDialogSelectOptions<VALUE, THEME> = DDialogSelectOptions<VALUE, THEME>\n> extends DDialogLayered<VALUE | null, THEME, OPTIONS> {\n\tprotected _value: VALUE | null;\n\tprotected _input?: DInputSearch;\n\tprotected _inputLayout?: DLayoutHorizontal;\n\tprotected _list?: DDialogSelectList<VALUE>;\n\tprotected _search?: DDialogSelectSearch<VALUE>;\n\tprotected _noteError?: DNote | null;\n\tprotected _noteNoItemsFound?: DNote | null;\n\tprotected _noteSearching?: DNote | null;\n\n\tconstructor(options?: OPTIONS) {\n\t\tsuper(options);\n\n\t\tthis._value = null;\n\n\t\t// Controller binding\n\t\tconst transition = new UtilTransition();\n\t\tconst search = this.search;\n\t\tsearch.on(\"success\", (e: unknown, results: VALUE[]): void => {\n\t\t\tif (0 < results.length) {\n\t\t\t\ttransition.hide();\n\t\t\t} else {\n\t\t\t\ttransition.show(this.noteNoItemsFound);\n\t\t\t}\n\t\t\tthis.onSearched(results);\n\t\t});\n\t\tsearch.on(\"fail\", (): void => {\n\t\t\ttransition.show(this.noteError);\n\t\t\tthis.onSearched([]);\n\t\t});\n\t\tsearch.on(\"change\", (): void => {\n\t\t\tif (!search.isDone()) {\n\t\t\t\tconst noteSearching = this.noteSearching;\n\t\t\t\tif (noteSearching) {\n\t\t\t\t\ttransition.show(noteSearching);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected newContentChildren(theme: THEME, options?: OPTIONS): Array<DisplayObject | null> {\n\t\tconst result = super.newContentChildren(theme, options);\n\t\tresult.push(this.inputLayout, this.list);\n\t\treturn result;\n\t}\n\n\tprotected get inputLayout(): DLayoutHorizontal {\n\t\tlet result = this._inputLayout;\n\t\tif (result == null) {\n\t\t\tresult = this.newInputLayout(this.input, this.theme, this._options);\n\t\t\tthis._inputLayout = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInputLayout(\n\t\tinput: DInputSearch,\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DLayoutHorizontal {\n\t\treturn new DLayoutHorizontal(this.toInputLayoutOptions(input, theme, options));\n\t}\n\n\tprotected toInputLayoutOptions(\n\t\tinput: DInputSearch,\n\t\ttheme: THEME,\n\t\toptions: OPTIONS | undefined\n\t): DLayoutHorizontalOptions {\n\t\tconst margin = this.toInputMargin(theme, options);\n\t\treturn {\n\t\t\twidth: \"padding\",\n\t\t\theight: \"auto\",\n\t\t\tchildren: [\n\t\t\t\tnew DLayoutSpace({ width: margin }),\n\t\t\t\tinput,\n\t\t\t\tnew DLayoutSpace({ width: margin })\n\t\t\t]\n\t\t};\n\t}\n\n\tget input(): DInputSearch {\n\t\tlet result = this._input;\n\t\tif (result == null) {\n\t\t\tresult = this.newInput();\n\t\t\tthis._input = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newInput(): DInputSearch {\n\t\tconst result = new DInputSearch(this.toInputOptions(this.theme, this._options));\n\t\tresult.on(\"input\", (value: string): void => {\n\t\t\tthis.search.create([value]);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected toInputOptions(theme: THEME, options?: OPTIONS): DInputSearchOptions {\n\t\tconst result = options?.input || {};\n\t\tif (result.width === undefined && result.weight === undefined) {\n\t\t\tresult.weight = 1;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected toInputMargin(theme: THEME, options?: OPTIONS): number {\n\t\treturn options?.input?.margin ?? theme.getInputMargin();\n\t}\n\n\tget list(): DDialogSelectList<VALUE> {\n\t\tlet result = this._list;\n\t\tif (result == null) {\n\t\t\tresult = this.newList();\n\t\t\tthis._list = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newList(): DDialogSelectList<VALUE> {\n\t\tconst result = new DDialogSelectList<VALUE>(this.toListOptions(this.theme, this._options));\n\t\tresult.selection.on(\"change\", (selection: DListDataSelection<VALUE>): void => {\n\t\t\tthis.onListSelectionChange(selection);\n\t\t});\n\t\treturn result;\n\t}\n\n\tprotected onListSelectionChange(selection: DListDataSelection<VALUE>): void {\n\t\tlet selected = selection.first;\n\t\tif (selected == null) {\n\t\t\treturn;\n\t\t}\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst dismiss = options.dismiss;\n\t\t\tif (dismiss) {\n\t\t\t\tif (selected === dismiss.value) {\n\t\t\t\t\tselected = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis._value = selected;\n\t\tthis.onOk(selected);\n\t}\n\n\tprotected toListOptions(theme: THEME, options?: OPTIONS): DDialogSelectListOptions<VALUE> {\n\t\tconst result = options?.list || {};\n\t\tif (result.width === undefined) {\n\t\t\tresult.width = \"padding\";\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected get noteError(): DNote | null {\n\t\tlet result = this._noteError;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteError();\n\t\t\tthis._noteError = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteError(): DNote | null {\n\t\tconst error = this._options?.note?.error;\n\t\tif (error !== null) {\n\t\t\treturn new DNoteSmallError(this.toNoteOptions(this.list, error));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteNoItemsFound(): DNote | null {\n\t\tlet result = this._noteNoItemsFound;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteNoItemsFound();\n\t\t\tthis._noteNoItemsFound = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteNoItemsFound(): DNote | null {\n\t\tconst noItemsFound = this._options?.note?.noItemsFound;\n\t\tif (noItemsFound !== null) {\n\t\t\treturn new DNoteSmallNoItemsFound(this.toNoteOptions(this.list, noItemsFound));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected get noteSearching(): DNote | null {\n\t\tlet result = this._noteSearching;\n\t\tif (result == null) {\n\t\t\tresult = this.newNoteSearching();\n\t\t\tthis._noteSearching = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newNoteSearching(): DNote | null {\n\t\tconst searching = this._options?.note?.searching;\n\t\t// Because the `searching` note is disabled by default,\n\t\t// if options.searching is missing, i.e., if its value is undefined,\n\t\t// this method returns null. This is why `!=` is used here instead of `!==`.\n\t\tif (searching != null) {\n\t\t\treturn new DNoteSmallSearching(this.toNoteOptions(this.list, searching));\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected toNoteOptions(parent: DBase, options?: DNoteOptions): DNoteOptions {\n\t\tif (options != null) {\n\t\t\tif (options.parent == null) {\n\t\t\t\toptions.parent = parent;\n\t\t\t}\n\t\t\tif (options.visible == null) {\n\t\t\t\toptions.visible = false;\n\t\t\t}\n\t\t\treturn options;\n\t\t}\n\t\treturn {\n\t\t\tparent,\n\t\t\tvisible: false\n\t\t};\n\t}\n\n\tprotected get search(): DDialogSelectSearch<VALUE> {\n\t\tlet result = this._search;\n\t\tif (result == null) {\n\t\t\tresult = this.newSearch();\n\t\t\tthis._search = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected newSearch(): DDialogSelectSearch<VALUE> {\n\t\tconst options = this._options;\n\t\tif (options) {\n\t\t\tconst controller = options.controller;\n\t\t\tif (controller) {\n\t\t\t\tconst dismiss = options.dismiss;\n\t\t\t\tconst search = controller.search;\n\t\t\t\tif (\"create\" in search) {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(search, dismiss);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn search;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (dismiss != null) {\n\t\t\t\t\t\treturn new DDialogSelectSearhDismissableImpl(\n\t\t\t\t\t\t\tnew DDialogSelectSearhImpl(search),\n\t\t\t\t\t\t\tdismiss\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn new DDialogSelectSearhImpl(search);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn new DDialogSelectSearhImpl();\n\t}\n\n\tget value(): VALUE | null {\n\t\treturn this._value;\n\t}\n\n\tprotected onSearched(results: VALUE[]): void {\n\t\tthis.list.data.items = results;\n\t}\n\n\tprotected getResolvedValue(): VALUE | null | PromiseLike<VALUE | null> {\n\t\treturn this._value;\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DDialogSelect\";\n\t}\n\n\tprotected onOpen(): void {\n\t\tsuper.onOpen();\n\t\tthis.list.selection.clear();\n\t\tthis.search.create([this.input.value]);\n\t}\n\n\tprotected onOk(value: VALUE | null | PromiseLike<VALUE | null>): void {\n\t\tthis.emit(\"select\", value, this);\n\t\tsuper.onOk(value);\n\t}\n\n\tdestroy(): void {\n\t\tconst input = this._input;\n\t\tif (input) {\n\t\t\tinput.destroy();\n\t\t}\n\t\tconst noteError = this._noteError;\n\t\tif (noteError) {\n\t\t\tnoteError.destroy();\n\t\t}\n\t\tconst noteNoItemsFound = this._noteNoItemsFound;\n\t\tif (noteNoItemsFound) {\n\t\t\tnoteNoItemsFound?.destroy();\n\t\t}\n\t\tconst noteSearching = this._noteSearching;\n\t\tif (noteSearching) {\n\t\t\tnoteSearching?.destroy();\n\t\t}\n\t\tconst list = this._list;\n\t\tif (list) {\n\t\t\tlist.destroy();\n\t\t}\n\t\tsuper.destroy();\n\t}\n}\n"]}
|
|
@@ -265,6 +265,9 @@ export * from "./d-dialog-save-as";
|
|
|
265
265
|
export * from "./d-dialog-select-list-item-updater";
|
|
266
266
|
export * from "./d-dialog-select-list-item";
|
|
267
267
|
export * from "./d-dialog-select-list";
|
|
268
|
+
export * from "./d-dialog-select-search-dismissable-impl";
|
|
269
|
+
export * from "./d-dialog-select-search-dismissable";
|
|
270
|
+
export * from "./d-dialog-select-search-impl";
|
|
268
271
|
export * from "./d-dialog-select-search";
|
|
269
272
|
export * from "./d-dialog-select";
|
|
270
273
|
export * from "./d-dialog-state";
|