@wcardinal/wcardinal-ui 0.333.0 → 0.335.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/types/wcardinal/ui/d-button-select.d.ts +3 -3
  2. package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable-impl.d.ts +7 -7
  3. package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable.d.ts +4 -4
  4. package/dist/types/wcardinal/ui/d-dialog-select-search-impl.d.ts +4 -4
  5. package/dist/types/wcardinal/ui/d-dialog-select-search.d.ts +2 -2
  6. package/dist/types/wcardinal/ui/d-dialog-select.d.ts +42 -14
  7. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.d.ts +2 -0
  8. package/dist/types/wcardinal/ui/theme/white/d-theme-white-dialog-select.d.ts +2 -0
  9. package/dist/types/wcardinal/ui/util/index.d.ts +1 -0
  10. package/dist/types/wcardinal/ui/util/to-id.d.ts +1 -0
  11. package/dist/wcardinal/ui/d-button-select.js +2 -37
  12. package/dist/wcardinal/ui/d-button-select.js.map +1 -1
  13. package/dist/wcardinal/ui/d-dialog-select-search-dismissable-impl.js.map +1 -1
  14. package/dist/wcardinal/ui/d-dialog-select-search-dismissable.js.map +1 -1
  15. package/dist/wcardinal/ui/d-dialog-select-search-impl.js +1 -1
  16. package/dist/wcardinal/ui/d-dialog-select-search-impl.js.map +1 -1
  17. package/dist/wcardinal/ui/d-dialog-select-search.js.map +1 -1
  18. package/dist/wcardinal/ui/d-dialog-select.js +162 -15
  19. package/dist/wcardinal/ui/d-dialog-select.js.map +1 -1
  20. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js +9 -1
  21. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js.map +1 -1
  22. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js +9 -1
  23. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js.map +1 -1
  24. package/dist/wcardinal/ui/util/index.js +1 -0
  25. package/dist/wcardinal/ui/util/index.js.map +1 -1
  26. package/dist/wcardinal/ui/util/to-id.js +27 -0
  27. package/dist/wcardinal/ui/util/to-id.js.map +1 -0
  28. package/dist/wcardinal-ui-theme-dark.js +10 -2
  29. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  30. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  31. package/dist/wcardinal-ui-theme-white.js +10 -2
  32. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  33. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  34. package/dist/wcardinal-ui.cjs.js +203 -56
  35. package/dist/wcardinal-ui.js +189 -54
  36. package/dist/wcardinal-ui.min.js +2 -2
  37. package/dist/wcardinal-ui.min.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.333.0
2
+ Winter Cardinal UI v0.335.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -49273,6 +49273,31 @@ var DThemeWhiteButtonSelect = /** @class */ (function (_super) {
49273
49273
  return DThemeWhiteButtonSelect;
49274
49274
  }(DThemeWhiteButton));
49275
49275
 
49276
+ /*
49277
+ * Copyright (C) 2019 Toshiba Corporation
49278
+ * SPDX-License-Identifier: Apache-2.0
49279
+ */
49280
+ var toId = function (target) {
49281
+ if (target != null) {
49282
+ if (isString(target)) {
49283
+ return target;
49284
+ }
49285
+ else if (isNumber(target)) {
49286
+ return target;
49287
+ }
49288
+ else if ("id" in target) {
49289
+ return target.id;
49290
+ }
49291
+ else if ("name" in target) {
49292
+ return target.name;
49293
+ }
49294
+ else if ("label" in target) {
49295
+ return target.label;
49296
+ }
49297
+ }
49298
+ return 0;
49299
+ };
49300
+
49276
49301
  /*
49277
49302
  * Copyright (C) 2019 Toshiba Corporation
49278
49303
  * SPDX-License-Identifier: Apache-2.0
@@ -49289,7 +49314,13 @@ var DThemeWhiteDialogSelect = /** @class */ (function (_super) {
49289
49314
  return null;
49290
49315
  };
49291
49316
  DThemeWhiteDialogSelect.prototype.getInputMargin = function () {
49292
- return 32;
49317
+ return 19;
49318
+ };
49319
+ DThemeWhiteDialogSelect.prototype.toCategoryId = function (category) {
49320
+ return toId(category);
49321
+ };
49322
+ DThemeWhiteDialogSelect.prototype.toCategoryLabel = function (category) {
49323
+ return toLabel$1(category);
49293
49324
  };
49294
49325
  return DThemeWhiteDialogSelect;
49295
49326
  }(DThemeWhiteDialogLayered));
@@ -58564,7 +58595,13 @@ var DThemeDarkDialogSelect = /** @class */ (function (_super) {
58564
58595
  return null;
58565
58596
  };
58566
58597
  DThemeDarkDialogSelect.prototype.getInputMargin = function () {
58567
- return 32;
58598
+ return 19;
58599
+ };
58600
+ DThemeDarkDialogSelect.prototype.toCategoryId = function (category) {
58601
+ return toId(category);
58602
+ };
58603
+ DThemeDarkDialogSelect.prototype.toCategoryLabel = function (category) {
58604
+ return toLabel$1(category);
58568
58605
  };
58569
58606
  return DThemeDarkDialogSelect;
58570
58607
  }(DThemeDarkDialogLayered));
@@ -73623,7 +73660,7 @@ var DDialogSelectSearhImpl = /** @class */ (function (_super) {
73623
73660
  DDialogSelectSearhImpl.prototype.create = function (args) {
73624
73661
  var _this = this;
73625
73662
  var id = ++this._id;
73626
- this._search(args[0]).then(function (searchResult) {
73663
+ this._search(args[0], args[1]).then(function (searchResult) {
73627
73664
  if (_this._id === id) {
73628
73665
  _this._idCompleted = id;
73629
73666
  _this.emit("success", _this, searchResult);
@@ -73836,7 +73873,7 @@ var DDialogSelect = /** @class */ (function (_super) {
73836
73873
  get: function () {
73837
73874
  var result = this._inputLayout;
73838
73875
  if (result == null) {
73839
- result = this.newInputLayout(this.input, this.theme, this._options);
73876
+ result = this.newInputLayout();
73840
73877
  this._inputLayout = result;
73841
73878
  }
73842
73879
  return result;
@@ -73844,20 +73881,78 @@ var DDialogSelect = /** @class */ (function (_super) {
73844
73881
  enumerable: false,
73845
73882
  configurable: true
73846
73883
  });
73847
- DDialogSelect.prototype.newInputLayout = function (input, theme, options) {
73848
- return new DLayoutHorizontal(this.toInputLayoutOptions(input, theme, options));
73849
- };
73850
- DDialogSelect.prototype.toInputLayoutOptions = function (input, theme, options) {
73851
- var margin = this.toInputMargin(theme, options);
73852
- return {
73884
+ DDialogSelect.prototype.newInputLayout = function () {
73885
+ return new DLayoutHorizontal({
73853
73886
  width: "padding",
73854
73887
  height: "auto",
73855
- children: [
73856
- new DLayoutSpace({ width: margin }),
73857
- input,
73858
- new DLayoutSpace({ width: margin })
73859
- ]
73860
- };
73888
+ children: [this.spaceLeft, this.selectCategory, this.input, this.spaceRight]
73889
+ });
73890
+ };
73891
+ Object.defineProperty(DDialogSelect.prototype, "spaceLeft", {
73892
+ get: function () {
73893
+ var result = this._spaceLeft;
73894
+ if (result == null) {
73895
+ result = this.newSpace();
73896
+ this._spaceLeft = result;
73897
+ }
73898
+ return result;
73899
+ },
73900
+ enumerable: false,
73901
+ configurable: true
73902
+ });
73903
+ Object.defineProperty(DDialogSelect.prototype, "spaceRight", {
73904
+ get: function () {
73905
+ var result = this._spaceRight;
73906
+ if (result == null) {
73907
+ result = this.newSpace();
73908
+ this._spaceRight = result;
73909
+ }
73910
+ return result;
73911
+ },
73912
+ enumerable: false,
73913
+ configurable: true
73914
+ });
73915
+ DDialogSelect.prototype.newSpace = function () {
73916
+ return new DLayoutSpace({
73917
+ width: this.toInputMargin(this.theme, this._options)
73918
+ });
73919
+ };
73920
+ Object.defineProperty(DDialogSelect.prototype, "selectCategory", {
73921
+ get: function () {
73922
+ var result = this._selectCategory;
73923
+ if (result === undefined) {
73924
+ result = this.newSelectCategory();
73925
+ this._selectCategory = result;
73926
+ }
73927
+ return result;
73928
+ },
73929
+ enumerable: false,
73930
+ configurable: true
73931
+ });
73932
+ DDialogSelect.prototype.newSelectCategory = function () {
73933
+ var _this = this;
73934
+ var options = this._options;
73935
+ if (options != null) {
73936
+ var controller = options.controller;
73937
+ if (controller != null && controller.getCategories != null) {
73938
+ var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
73939
+ result.on("change", function (value) {
73940
+ _this.onSelectCategoryChange(value);
73941
+ });
73942
+ return result;
73943
+ }
73944
+ }
73945
+ return null;
73946
+ };
73947
+ DDialogSelect.prototype.toSelectCategoryOptions = function (theme, options) {
73948
+ var result = (options === null || options === void 0 ? void 0 : options.category) || {};
73949
+ if (result.width === undefined && result.weight === undefined) {
73950
+ result.width = 140;
73951
+ }
73952
+ return result;
73953
+ };
73954
+ DDialogSelect.prototype.onSelectCategoryChange = function (categoryId) {
73955
+ this.search.create([this.input.value, categoryId]);
73861
73956
  };
73862
73957
  Object.defineProperty(DDialogSelect.prototype, "input", {
73863
73958
  get: function () {
@@ -73875,7 +73970,7 @@ var DDialogSelect = /** @class */ (function (_super) {
73875
73970
  var _this = this;
73876
73971
  var result = new DInputSearch(this.toInputOptions(this.theme, this._options));
73877
73972
  result.on("input", function (value) {
73878
- _this.search.create([value]);
73973
+ _this.onInputInput(value);
73879
73974
  });
73880
73975
  return result;
73881
73976
  };
@@ -73890,6 +73985,10 @@ var DDialogSelect = /** @class */ (function (_super) {
73890
73985
  var _a, _b;
73891
73986
  return (_b = (_a = options === null || options === void 0 ? void 0 : options.input) === null || _a === void 0 ? void 0 : _a.margin) !== null && _b !== void 0 ? _b : theme.getInputMargin();
73892
73987
  };
73988
+ DDialogSelect.prototype.onInputInput = function (value) {
73989
+ var _a, _b;
73990
+ this.search.create([value, (_b = (_a = this.selectCategory) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null]);
73991
+ };
73893
73992
  Object.defineProperty(DDialogSelect.prototype, "list", {
73894
73993
  get: function () {
73895
73994
  var result = this._list;
@@ -74068,9 +74167,91 @@ var DDialogSelect = /** @class */ (function (_super) {
74068
74167
  return "DDialogSelect";
74069
74168
  };
74070
74169
  DDialogSelect.prototype.onOpen = function () {
74170
+ var _this = this;
74071
74171
  _super.prototype.onOpen.call(this);
74072
74172
  this.list.selection.clear();
74073
- this.search.create([this.input.value]);
74173
+ var selectCategory = this.selectCategory;
74174
+ if (selectCategory != null) {
74175
+ if (this._isCategoryFetched !== true) {
74176
+ this._isCategoryFetched = true;
74177
+ var categoriesOrPromise = this.findCategories();
74178
+ if (categoriesOrPromise == null) {
74179
+ this.search.create([this.input.value, null]);
74180
+ }
74181
+ else if (isArray(categoriesOrPromise)) {
74182
+ this.onCategoryFetched(selectCategory, categoriesOrPromise);
74183
+ }
74184
+ else {
74185
+ selectCategory.state.isEnabled = false;
74186
+ categoriesOrPromise.then(function (categories) {
74187
+ selectCategory.state.isEnabled = true;
74188
+ _this.onCategoryFetched(selectCategory, categories);
74189
+ });
74190
+ }
74191
+ }
74192
+ else {
74193
+ this.search.create([this.input.value, selectCategory.value]);
74194
+ }
74195
+ }
74196
+ else {
74197
+ this.search.create([this.input.value, null]);
74198
+ }
74199
+ };
74200
+ DDialogSelect.prototype.onCategoryFetched = function (selectCategory, categories) {
74201
+ var items = [];
74202
+ for (var i = 0, imax = categories.length; i < imax; ++i) {
74203
+ var category = categories[i];
74204
+ items.push({
74205
+ value: this.toCategoryId(category),
74206
+ text: {
74207
+ value: this.toCategoryLabel(category)
74208
+ }
74209
+ });
74210
+ }
74211
+ selectCategory.menu = new DMenu({
74212
+ fit: true,
74213
+ items: items
74214
+ });
74215
+ var newValue = 0 < items.length ? items[0].value : null;
74216
+ selectCategory.value = newValue;
74217
+ selectCategory.show();
74218
+ this.search.create([this.input.value, newValue]);
74219
+ };
74220
+ DDialogSelect.prototype.toCategoryId = function (target) {
74221
+ var options = this._options;
74222
+ if (options != null) {
74223
+ var category = options.category;
74224
+ if (category != null) {
74225
+ var toId = category.toId;
74226
+ if (toId != null) {
74227
+ return toId(target);
74228
+ }
74229
+ }
74230
+ }
74231
+ return this.theme.toCategoryId(target);
74232
+ };
74233
+ DDialogSelect.prototype.toCategoryLabel = function (target) {
74234
+ var options = this._options;
74235
+ if (options != null) {
74236
+ var category = options.category;
74237
+ if (category != null) {
74238
+ var toLabel = category.toLabel;
74239
+ if (toLabel != null) {
74240
+ return toLabel(target);
74241
+ }
74242
+ }
74243
+ }
74244
+ return this.theme.toCategoryLabel(target);
74245
+ };
74246
+ DDialogSelect.prototype.findCategories = function () {
74247
+ var options = this._options;
74248
+ if (options != null) {
74249
+ var controller = options.controller;
74250
+ if (controller != null && controller.getCategories != null) {
74251
+ return controller.getCategories();
74252
+ }
74253
+ }
74254
+ return null;
74074
74255
  };
74075
74256
  DDialogSelect.prototype.onOk = function (value) {
74076
74257
  this.emit("select", value, this);
@@ -74113,47 +74294,12 @@ var defaultGetter$1 = function (dialog) {
74113
74294
  var defaultSetter$1 = function () {
74114
74295
  // DO NOTHING
74115
74296
  };
74116
- var toOptions = function (options) {
74117
- var _a, _b, _c;
74118
- if (options) {
74119
- // Try to copy text.formatter to dialog.item.text.formatter at first
74120
- var formatter = (_a = options.text) === null || _a === void 0 ? void 0 : _a.formatter;
74121
- if (formatter !== undefined) {
74122
- var dialog = options.dialog;
74123
- if (!(dialog && "open" in dialog)) {
74124
- dialog = dialog || {};
74125
- var item = (dialog.item = dialog.item || {});
74126
- var text = (item.text = item.text || {});
74127
- if (text.formatter === undefined) {
74128
- // Assumes formatter is ( value: DIALOG_VALUE | null, caller: any ) => string.
74129
- text.formatter = formatter;
74130
- }
74131
- }
74132
- }
74133
- else {
74134
- // Try to copy dialog.item.text.formatter to text.formatter
74135
- var dialog = options.dialog;
74136
- if (!(dialog && "open" in dialog)) {
74137
- var dialogFormatter = (_c = (_b = dialog === null || dialog === void 0 ? void 0 : dialog.item) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.formatter;
74138
- if (dialogFormatter !== undefined) {
74139
- var text = options.text || {};
74140
- options.text = text;
74141
- if (text.formatter === undefined) {
74142
- // Assumes dialogFormatter is ( value: VALUE | null, caller: any ) => string.
74143
- text.formatter = dialogFormatter;
74144
- }
74145
- }
74146
- }
74147
- }
74148
- }
74149
- return options;
74150
- };
74151
74297
  var DButtonSelect = /** @class */ (function (_super) {
74152
74298
  __extends(DButtonSelect, _super);
74153
74299
  function DButtonSelect(options) {
74154
74300
  var _this = this;
74155
74301
  var _a, _b;
74156
- _this = _super.call(this, toOptions(options)) || this;
74302
+ _this = _super.call(this, options) || this;
74157
74303
  _this._dialogGetter = (_a = options === null || options === void 0 ? void 0 : options.getter) !== null && _a !== void 0 ? _a : defaultGetter$1;
74158
74304
  _this._dialogSetter = (_b = options === null || options === void 0 ? void 0 : options.setter) !== null && _b !== void 0 ? _b : defaultSetter$1;
74159
74305
  return _this;
@@ -74183,7 +74329,7 @@ var DButtonSelect = /** @class */ (function (_super) {
74183
74329
  dialog = options;
74184
74330
  }
74185
74331
  else {
74186
- // Assumes DIALOG === DDialogSelect<DIALOG_VALUE>.
74332
+ // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY, DIALOG_CATEGORY_ID>.
74187
74333
  dialog = new DDialogSelect(options);
74188
74334
  }
74189
74335
  this._dialog = dialog;
@@ -95130,6 +95276,7 @@ exports.toDash = toDash;
95130
95276
  exports.toEnum = toEnum;
95131
95277
  exports.toGradientImageUrl = toGradientImageUrl;
95132
95278
  exports.toGradientSerialized = toGradientSerialized;
95279
+ exports.toId = toId;
95133
95280
  exports.toImageElement = toImageElement;
95134
95281
  exports.toIndexOf = toIndexOf;
95135
95282
  exports.toLabel = toLabel$1;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.333.0
2
+ Winter Cardinal UI v0.335.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -46990,6 +46990,31 @@
46990
46990
  return target;
46991
46991
  };
46992
46992
 
46993
+ /*
46994
+ * Copyright (C) 2019 Toshiba Corporation
46995
+ * SPDX-License-Identifier: Apache-2.0
46996
+ */
46997
+ var toId = function (target) {
46998
+ if (target != null) {
46999
+ if (isString(target)) {
47000
+ return target;
47001
+ }
47002
+ else if (isNumber(target)) {
47003
+ return target;
47004
+ }
47005
+ else if ("id" in target) {
47006
+ return target.id;
47007
+ }
47008
+ else if ("name" in target) {
47009
+ return target.name;
47010
+ }
47011
+ else if ("label" in target) {
47012
+ return target.label;
47013
+ }
47014
+ }
47015
+ return 0;
47016
+ };
47017
+
46993
47018
  /*
46994
47019
  * Copyright (C) 2019 Toshiba Corporation
46995
47020
  * SPDX-License-Identifier: Apache-2.0
@@ -55103,7 +55128,7 @@
55103
55128
  DDialogSelectSearhImpl.prototype.create = function (args) {
55104
55129
  var _this = this;
55105
55130
  var id = ++this._id;
55106
- this._search(args[0]).then(function (searchResult) {
55131
+ this._search(args[0], args[1]).then(function (searchResult) {
55107
55132
  if (_this._id === id) {
55108
55133
  _this._idCompleted = id;
55109
55134
  _this.emit("success", _this, searchResult);
@@ -55316,7 +55341,7 @@
55316
55341
  get: function () {
55317
55342
  var result = this._inputLayout;
55318
55343
  if (result == null) {
55319
- result = this.newInputLayout(this.input, this.theme, this._options);
55344
+ result = this.newInputLayout();
55320
55345
  this._inputLayout = result;
55321
55346
  }
55322
55347
  return result;
@@ -55324,20 +55349,78 @@
55324
55349
  enumerable: false,
55325
55350
  configurable: true
55326
55351
  });
55327
- DDialogSelect.prototype.newInputLayout = function (input, theme, options) {
55328
- return new DLayoutHorizontal(this.toInputLayoutOptions(input, theme, options));
55329
- };
55330
- DDialogSelect.prototype.toInputLayoutOptions = function (input, theme, options) {
55331
- var margin = this.toInputMargin(theme, options);
55332
- return {
55352
+ DDialogSelect.prototype.newInputLayout = function () {
55353
+ return new DLayoutHorizontal({
55333
55354
  width: "padding",
55334
55355
  height: "auto",
55335
- children: [
55336
- new DLayoutSpace({ width: margin }),
55337
- input,
55338
- new DLayoutSpace({ width: margin })
55339
- ]
55340
- };
55356
+ children: [this.spaceLeft, this.selectCategory, this.input, this.spaceRight]
55357
+ });
55358
+ };
55359
+ Object.defineProperty(DDialogSelect.prototype, "spaceLeft", {
55360
+ get: function () {
55361
+ var result = this._spaceLeft;
55362
+ if (result == null) {
55363
+ result = this.newSpace();
55364
+ this._spaceLeft = result;
55365
+ }
55366
+ return result;
55367
+ },
55368
+ enumerable: false,
55369
+ configurable: true
55370
+ });
55371
+ Object.defineProperty(DDialogSelect.prototype, "spaceRight", {
55372
+ get: function () {
55373
+ var result = this._spaceRight;
55374
+ if (result == null) {
55375
+ result = this.newSpace();
55376
+ this._spaceRight = result;
55377
+ }
55378
+ return result;
55379
+ },
55380
+ enumerable: false,
55381
+ configurable: true
55382
+ });
55383
+ DDialogSelect.prototype.newSpace = function () {
55384
+ return new DLayoutSpace({
55385
+ width: this.toInputMargin(this.theme, this._options)
55386
+ });
55387
+ };
55388
+ Object.defineProperty(DDialogSelect.prototype, "selectCategory", {
55389
+ get: function () {
55390
+ var result = this._selectCategory;
55391
+ if (result === undefined) {
55392
+ result = this.newSelectCategory();
55393
+ this._selectCategory = result;
55394
+ }
55395
+ return result;
55396
+ },
55397
+ enumerable: false,
55398
+ configurable: true
55399
+ });
55400
+ DDialogSelect.prototype.newSelectCategory = function () {
55401
+ var _this = this;
55402
+ var options = this._options;
55403
+ if (options != null) {
55404
+ var controller = options.controller;
55405
+ if (controller != null && controller.getCategories != null) {
55406
+ var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
55407
+ result.on("change", function (value) {
55408
+ _this.onSelectCategoryChange(value);
55409
+ });
55410
+ return result;
55411
+ }
55412
+ }
55413
+ return null;
55414
+ };
55415
+ DDialogSelect.prototype.toSelectCategoryOptions = function (theme, options) {
55416
+ var result = (options === null || options === void 0 ? void 0 : options.category) || {};
55417
+ if (result.width === undefined && result.weight === undefined) {
55418
+ result.width = 140;
55419
+ }
55420
+ return result;
55421
+ };
55422
+ DDialogSelect.prototype.onSelectCategoryChange = function (categoryId) {
55423
+ this.search.create([this.input.value, categoryId]);
55341
55424
  };
55342
55425
  Object.defineProperty(DDialogSelect.prototype, "input", {
55343
55426
  get: function () {
@@ -55355,7 +55438,7 @@
55355
55438
  var _this = this;
55356
55439
  var result = new DInputSearch(this.toInputOptions(this.theme, this._options));
55357
55440
  result.on("input", function (value) {
55358
- _this.search.create([value]);
55441
+ _this.onInputInput(value);
55359
55442
  });
55360
55443
  return result;
55361
55444
  };
@@ -55370,6 +55453,10 @@
55370
55453
  var _a, _b;
55371
55454
  return (_b = (_a = options === null || options === void 0 ? void 0 : options.input) === null || _a === void 0 ? void 0 : _a.margin) !== null && _b !== void 0 ? _b : theme.getInputMargin();
55372
55455
  };
55456
+ DDialogSelect.prototype.onInputInput = function (value) {
55457
+ var _a, _b;
55458
+ this.search.create([value, (_b = (_a = this.selectCategory) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null]);
55459
+ };
55373
55460
  Object.defineProperty(DDialogSelect.prototype, "list", {
55374
55461
  get: function () {
55375
55462
  var result = this._list;
@@ -55548,9 +55635,91 @@
55548
55635
  return "DDialogSelect";
55549
55636
  };
55550
55637
  DDialogSelect.prototype.onOpen = function () {
55638
+ var _this = this;
55551
55639
  _super.prototype.onOpen.call(this);
55552
55640
  this.list.selection.clear();
55553
- this.search.create([this.input.value]);
55641
+ var selectCategory = this.selectCategory;
55642
+ if (selectCategory != null) {
55643
+ if (this._isCategoryFetched !== true) {
55644
+ this._isCategoryFetched = true;
55645
+ var categoriesOrPromise = this.findCategories();
55646
+ if (categoriesOrPromise == null) {
55647
+ this.search.create([this.input.value, null]);
55648
+ }
55649
+ else if (isArray(categoriesOrPromise)) {
55650
+ this.onCategoryFetched(selectCategory, categoriesOrPromise);
55651
+ }
55652
+ else {
55653
+ selectCategory.state.isEnabled = false;
55654
+ categoriesOrPromise.then(function (categories) {
55655
+ selectCategory.state.isEnabled = true;
55656
+ _this.onCategoryFetched(selectCategory, categories);
55657
+ });
55658
+ }
55659
+ }
55660
+ else {
55661
+ this.search.create([this.input.value, selectCategory.value]);
55662
+ }
55663
+ }
55664
+ else {
55665
+ this.search.create([this.input.value, null]);
55666
+ }
55667
+ };
55668
+ DDialogSelect.prototype.onCategoryFetched = function (selectCategory, categories) {
55669
+ var items = [];
55670
+ for (var i = 0, imax = categories.length; i < imax; ++i) {
55671
+ var category = categories[i];
55672
+ items.push({
55673
+ value: this.toCategoryId(category),
55674
+ text: {
55675
+ value: this.toCategoryLabel(category)
55676
+ }
55677
+ });
55678
+ }
55679
+ selectCategory.menu = new DMenu({
55680
+ fit: true,
55681
+ items: items
55682
+ });
55683
+ var newValue = 0 < items.length ? items[0].value : null;
55684
+ selectCategory.value = newValue;
55685
+ selectCategory.show();
55686
+ this.search.create([this.input.value, newValue]);
55687
+ };
55688
+ DDialogSelect.prototype.toCategoryId = function (target) {
55689
+ var options = this._options;
55690
+ if (options != null) {
55691
+ var category = options.category;
55692
+ if (category != null) {
55693
+ var toId = category.toId;
55694
+ if (toId != null) {
55695
+ return toId(target);
55696
+ }
55697
+ }
55698
+ }
55699
+ return this.theme.toCategoryId(target);
55700
+ };
55701
+ DDialogSelect.prototype.toCategoryLabel = function (target) {
55702
+ var options = this._options;
55703
+ if (options != null) {
55704
+ var category = options.category;
55705
+ if (category != null) {
55706
+ var toLabel = category.toLabel;
55707
+ if (toLabel != null) {
55708
+ return toLabel(target);
55709
+ }
55710
+ }
55711
+ }
55712
+ return this.theme.toCategoryLabel(target);
55713
+ };
55714
+ DDialogSelect.prototype.findCategories = function () {
55715
+ var options = this._options;
55716
+ if (options != null) {
55717
+ var controller = options.controller;
55718
+ if (controller != null && controller.getCategories != null) {
55719
+ return controller.getCategories();
55720
+ }
55721
+ }
55722
+ return null;
55554
55723
  };
55555
55724
  DDialogSelect.prototype.onOk = function (value) {
55556
55725
  this.emit("select", value, this);
@@ -55593,47 +55762,12 @@
55593
55762
  var defaultSetter$1 = function () {
55594
55763
  // DO NOTHING
55595
55764
  };
55596
- var toOptions = function (options) {
55597
- var _a, _b, _c;
55598
- if (options) {
55599
- // Try to copy text.formatter to dialog.item.text.formatter at first
55600
- var formatter = (_a = options.text) === null || _a === void 0 ? void 0 : _a.formatter;
55601
- if (formatter !== undefined) {
55602
- var dialog = options.dialog;
55603
- if (!(dialog && "open" in dialog)) {
55604
- dialog = dialog || {};
55605
- var item = (dialog.item = dialog.item || {});
55606
- var text = (item.text = item.text || {});
55607
- if (text.formatter === undefined) {
55608
- // Assumes formatter is ( value: DIALOG_VALUE | null, caller: any ) => string.
55609
- text.formatter = formatter;
55610
- }
55611
- }
55612
- }
55613
- else {
55614
- // Try to copy dialog.item.text.formatter to text.formatter
55615
- var dialog = options.dialog;
55616
- if (!(dialog && "open" in dialog)) {
55617
- var dialogFormatter = (_c = (_b = dialog === null || dialog === void 0 ? void 0 : dialog.item) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.formatter;
55618
- if (dialogFormatter !== undefined) {
55619
- var text = options.text || {};
55620
- options.text = text;
55621
- if (text.formatter === undefined) {
55622
- // Assumes dialogFormatter is ( value: VALUE | null, caller: any ) => string.
55623
- text.formatter = dialogFormatter;
55624
- }
55625
- }
55626
- }
55627
- }
55628
- }
55629
- return options;
55630
- };
55631
55765
  var DButtonSelect = /** @class */ (function (_super) {
55632
55766
  __extends(DButtonSelect, _super);
55633
55767
  function DButtonSelect(options) {
55634
55768
  var _this = this;
55635
55769
  var _a, _b;
55636
- _this = _super.call(this, toOptions(options)) || this;
55770
+ _this = _super.call(this, options) || this;
55637
55771
  _this._dialogGetter = (_a = options === null || options === void 0 ? void 0 : options.getter) !== null && _a !== void 0 ? _a : defaultGetter$1;
55638
55772
  _this._dialogSetter = (_b = options === null || options === void 0 ? void 0 : options.setter) !== null && _b !== void 0 ? _b : defaultSetter$1;
55639
55773
  return _this;
@@ -55663,7 +55797,7 @@
55663
55797
  dialog = options;
55664
55798
  }
55665
55799
  else {
55666
- // Assumes DIALOG === DDialogSelect<DIALOG_VALUE>.
55800
+ // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY, DIALOG_CATEGORY_ID>.
55667
55801
  dialog = new DDialogSelect(options);
55668
55802
  }
55669
55803
  this._dialog = dialog;
@@ -75628,6 +75762,7 @@
75628
75762
  toCeilingIndex: toCeilingIndex,
75629
75763
  toCloned: toCloned,
75630
75764
  toEnum: toEnum,
75765
+ toId: toId,
75631
75766
  toIndexOf: toIndexOf,
75632
75767
  toLabel: toLabel$1,
75633
75768
  toMerged: toMerged,