@wcardinal/wcardinal-ui 0.361.0 → 0.363.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/types/wcardinal/ui/d-button-select.d.ts +3 -3
  2. package/dist/types/wcardinal/ui/d-diagram-editor.d.ts +13 -1
  3. package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable-impl.d.ts +4 -4
  4. package/dist/types/wcardinal/ui/d-dialog-select-search-dismissable.d.ts +4 -4
  5. package/dist/types/wcardinal/ui/d-dialog-select-search-function.d.ts +4 -4
  6. package/dist/types/wcardinal/ui/d-dialog-select-search-impl.d.ts +3 -3
  7. package/dist/types/wcardinal/ui/d-dialog-select-search.d.ts +1 -1
  8. package/dist/types/wcardinal/ui/d-dialog-select.d.ts +34 -24
  9. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.d.ts +1 -0
  10. package/dist/types/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.d.ts +2 -2
  11. package/dist/types/wcardinal/ui/theme/white/d-theme-white-diagram-editor.d.ts +1 -0
  12. package/dist/types/wcardinal/ui/theme/white/d-theme-white-dialog-select.d.ts +2 -2
  13. package/dist/types/wcardinal/ui/util/index.d.ts +0 -1
  14. package/dist/wcardinal/ui/d-button-select.js +1 -1
  15. package/dist/wcardinal/ui/d-button-select.js.map +1 -1
  16. package/dist/wcardinal/ui/d-diagram-canvas-editor.js +1 -0
  17. package/dist/wcardinal/ui/d-diagram-canvas-editor.js.map +1 -1
  18. package/dist/wcardinal/ui/d-diagram-editor.js +10 -5
  19. package/dist/wcardinal/ui/d-diagram-editor.js.map +1 -1
  20. package/dist/wcardinal/ui/d-dialog-select-search-dismissable-impl.js.map +1 -1
  21. package/dist/wcardinal/ui/d-dialog-select-search-dismissable.js.map +1 -1
  22. package/dist/wcardinal/ui/d-dialog-select-search-function.js.map +1 -1
  23. package/dist/wcardinal/ui/d-dialog-select-search-impl.js.map +1 -1
  24. package/dist/wcardinal/ui/d-dialog-select-search.js.map +1 -1
  25. package/dist/wcardinal/ui/d-dialog-select.js +60 -102
  26. package/dist/wcardinal/ui/d-dialog-select.js.map +1 -1
  27. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js +3 -0
  28. package/dist/wcardinal/ui/theme/dark/d-theme-dark-diagram-editor.js.map +1 -1
  29. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js +4 -6
  30. package/dist/wcardinal/ui/theme/dark/d-theme-dark-dialog-select.js.map +1 -1
  31. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js +3 -0
  32. package/dist/wcardinal/ui/theme/white/d-theme-white-diagram-editor.js.map +1 -1
  33. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js +4 -6
  34. package/dist/wcardinal/ui/theme/white/d-theme-white-dialog-select.js.map +1 -1
  35. package/dist/wcardinal/ui/util/index.js +0 -1
  36. package/dist/wcardinal/ui/util/index.js.map +1 -1
  37. package/dist/wcardinal/ui/util/to-label.js +20 -2
  38. package/dist/wcardinal/ui/util/to-label.js.map +1 -1
  39. package/dist/wcardinal-ui-theme-dark.js +8 -9
  40. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  41. package/dist/wcardinal-ui-theme-dark.min.js.map +1 -1
  42. package/dist/wcardinal-ui-theme-white.js +8 -9
  43. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  44. package/dist/wcardinal-ui-theme-white.min.js.map +1 -1
  45. package/dist/wcardinal-ui.cjs.js +114 -151
  46. package/dist/wcardinal-ui.js +75 -118
  47. package/dist/wcardinal-ui.min.js +2 -2
  48. package/dist/wcardinal-ui.min.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/types/wcardinal/ui/util/to-label-with.d.ts +0 -1
  51. package/dist/wcardinal/ui/util/to-label-with.js +0 -27
  52. package/dist/wcardinal/ui/util/to-label-with.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.361.0
2
+ Winter Cardinal UI v0.363.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -47278,7 +47278,7 @@
47278
47278
  * Copyright (C) 2019 Toshiba Corporation
47279
47279
  * SPDX-License-Identifier: Apache-2.0
47280
47280
  */
47281
- var toLabelWith = function (target, def) {
47281
+ var toLabel$1 = function (target) {
47282
47282
  if (target != null) {
47283
47283
  if (isString(target)) {
47284
47284
  return target;
@@ -47296,15 +47296,7 @@
47296
47296
  return target.id;
47297
47297
  }
47298
47298
  }
47299
- return def;
47300
- };
47301
-
47302
- /*
47303
- * Copyright (C) 2019 Toshiba Corporation
47304
- * SPDX-License-Identifier: Apache-2.0
47305
- */
47306
- var toLabel$1 = function (target) {
47307
- return toLabelWith(target, "");
47299
+ return "";
47308
47300
  };
47309
47301
 
47310
47302
  /*
@@ -55591,8 +55583,17 @@
55591
55583
  var DDialogSelect = /** @class */ (function (_super) {
55592
55584
  __extends(DDialogSelect, _super);
55593
55585
  function DDialogSelect(options) {
55594
- var _this = _super.call(this, options) || this;
55586
+ var _this = this;
55587
+ var _a, _b;
55588
+ _this = _super.call(this, options) || this;
55589
+ // Value
55595
55590
  _this._value = null;
55591
+ // Categories
55592
+ var categories = (_b = (_a = options === null || options === void 0 ? void 0 : options.category) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [];
55593
+ _this._categories = categories;
55594
+ if (0 < categories.length) {
55595
+ _this.onCategoriesChange(categories);
55596
+ }
55596
55597
  // Controller binding
55597
55598
  var transition = new UtilTransition();
55598
55599
  var search = _this.search;
@@ -55675,7 +55676,7 @@
55675
55676
  Object.defineProperty(DDialogSelect.prototype, "selectCategory", {
55676
55677
  get: function () {
55677
55678
  var result = this._selectCategory;
55678
- if (result === undefined) {
55679
+ if (result == null) {
55679
55680
  result = this.newSelectCategory();
55680
55681
  this._selectCategory = result;
55681
55682
  }
@@ -55686,26 +55687,19 @@
55686
55687
  });
55687
55688
  DDialogSelect.prototype.newSelectCategory = function () {
55688
55689
  var _this = this;
55689
- var options = this._options;
55690
- if (options != null) {
55691
- var controller = options.controller;
55692
- if (controller != null && controller.getCategories != null) {
55693
- var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
55694
- result.on("change", function (value) {
55695
- _this.onSelectCategoryChange(value);
55696
- });
55697
- return result;
55698
- }
55699
- }
55700
- return null;
55690
+ var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
55691
+ result.on("change", function (value) {
55692
+ _this.onSelectCategoryChange(value);
55693
+ });
55694
+ return result;
55701
55695
  };
55702
55696
  DDialogSelect.prototype.toSelectCategoryOptions = function (theme, options) {
55703
55697
  var result = (options === null || options === void 0 ? void 0 : options.category) || {};
55704
55698
  if (result.width === undefined && result.weight === undefined) {
55705
55699
  result.width = 140;
55706
55700
  }
55707
- if (result.state === undefined) {
55708
- result.state = DBaseState.DISABLED;
55701
+ if (result.visible === undefined) {
55702
+ result.visible = false;
55709
55703
  }
55710
55704
  return result;
55711
55705
  };
@@ -55930,101 +55924,59 @@
55930
55924
  return "DDialogSelect";
55931
55925
  };
55932
55926
  DDialogSelect.prototype.onOpen = function () {
55933
- var _this = this;
55934
55927
  _super.prototype.onOpen.call(this);
55935
55928
  this.list.selection.clear();
55936
- var selectCategory = this.selectCategory;
55937
- if (selectCategory != null) {
55938
- if (this._isCategoryFetched !== true) {
55939
- this._isCategoryFetched = true;
55940
- var categoriesOrPromise = this.findCategories();
55941
- if (categoriesOrPromise == null) {
55942
- this.search.create([this.input.value, null]);
55943
- }
55944
- else if (isArray(categoriesOrPromise)) {
55945
- this.onCategoryFetched(selectCategory, categoriesOrPromise);
55946
- }
55947
- else {
55948
- categoriesOrPromise.then(function (categories) {
55949
- _this.onCategoryFetched(selectCategory, categories);
55950
- });
55951
- }
55952
- }
55953
- else {
55954
- this.search.create([this.input.value, selectCategory.value]);
55955
- }
55929
+ if (0 < this._categories.length) {
55930
+ this.search.create([this.input.value, this.selectCategory.value]);
55956
55931
  }
55957
55932
  else {
55958
55933
  this.search.create([this.input.value]);
55959
55934
  }
55960
55935
  };
55961
- DDialogSelect.prototype.onCategoryFetched = function (selectCategory, categories) {
55962
- var items = [];
55963
- var toId = this.newToCategoryId();
55964
- var toLabel = this.newToCategoryLabel();
55965
- items.push({
55966
- value: null,
55967
- text: {
55968
- value: toLabel(null)
55969
- }
55970
- });
55971
- for (var i = 0, imax = categories.length; i < imax; ++i) {
55972
- var category = categories[i];
55973
- items.push({
55974
- value: toId(category),
55975
- text: {
55976
- value: toLabel(category)
55977
- }
55978
- });
55979
- }
55980
- selectCategory.menu = new DMenu({
55981
- fit: true,
55982
- items: items
55983
- });
55984
- selectCategory.state.isEnabled = true;
55985
- this.search.create([this.input.value, null]);
55986
- };
55987
- DDialogSelect.prototype.newToCategoryId = function () {
55988
- var options = this._options;
55989
- if (options != null) {
55990
- var category = options.category;
55991
- if (category != null) {
55992
- var toId = category.toId;
55993
- if (toId != null) {
55994
- return toId;
55995
- }
55936
+ Object.defineProperty(DDialogSelect.prototype, "categories", {
55937
+ get: function () {
55938
+ return this._categories;
55939
+ },
55940
+ set: function (categories) {
55941
+ this._categories = categories;
55942
+ this.onCategoriesChange(categories);
55943
+ },
55944
+ enumerable: false,
55945
+ configurable: true
55946
+ });
55947
+ DDialogSelect.prototype.onCategoriesChange = function (categories) {
55948
+ var _a, _b, _c, _d, _e;
55949
+ var selectCategory = this.selectCategory;
55950
+ if (0 < categories.length) {
55951
+ var items = [];
55952
+ var theme = this.theme;
55953
+ var options = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.category) === null || _b === void 0 ? void 0 : _b.dismiss) !== null && _c !== void 0 ? _c : {};
55954
+ if ((_d = options.enable) !== null && _d !== void 0 ? _d : theme.isCategoryDismissable()) {
55955
+ items.push({
55956
+ value: null,
55957
+ text: {
55958
+ value: (_e = options.label) !== null && _e !== void 0 ? _e : theme.getCategoryDismissLabel()
55959
+ }
55960
+ });
55996
55961
  }
55997
- }
55998
- var theme = this.theme;
55999
- return function (category) {
56000
- return theme.toCategoryId(category);
56001
- };
56002
- };
56003
- DDialogSelect.prototype.newToCategoryLabel = function () {
56004
- var options = this._options;
56005
- if (options != null) {
56006
- var category = options.category;
56007
- if (category != null) {
56008
- var toLabel = category.toLabel;
56009
- if (toLabel != null) {
56010
- return toLabel;
56011
- }
55962
+ for (var i = 0, imax = categories.length; i < imax; ++i) {
55963
+ var category = categories[i];
55964
+ items.push({
55965
+ value: category.id,
55966
+ text: {
55967
+ value: category.label
55968
+ }
55969
+ });
56012
55970
  }
55971
+ selectCategory.menu = new DMenu({
55972
+ fit: true,
55973
+ items: items
55974
+ });
55975
+ selectCategory.show();
56013
55976
  }
56014
- var theme = this.theme;
56015
- return function (category) {
56016
- return theme.toCategoryLabel(category);
56017
- };
56018
- };
56019
- DDialogSelect.prototype.findCategories = function () {
56020
- var options = this._options;
56021
- if (options != null) {
56022
- var controller = options.controller;
56023
- if (controller != null && controller.getCategories != null) {
56024
- return controller.getCategories();
56025
- }
55977
+ else {
55978
+ selectCategory.hide();
56026
55979
  }
56027
- return null;
56028
55980
  };
56029
55981
  DDialogSelect.prototype.onOk = function (value) {
56030
55982
  this.emit("select", value, this);
@@ -56102,7 +56054,7 @@
56102
56054
  dialog = options;
56103
56055
  }
56104
56056
  else {
56105
- // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY, DIALOG_CATEGORY_ID>.
56057
+ // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.
56106
56058
  dialog = new DDialogSelect(options);
56107
56059
  }
56108
56060
  this._dialog = dialog;
@@ -63387,6 +63339,7 @@
63387
63339
  label: this.label,
63388
63340
  width: this.width,
63389
63341
  height: this.height,
63342
+ category: this.category,
63390
63343
  summary: this.summary,
63391
63344
  description: this.description,
63392
63345
  background: {
@@ -64810,16 +64763,21 @@
64810
64763
  this.emit("deleted", null, this);
64811
64764
  return Promise.resolve(null);
64812
64765
  };
64813
- DDiagramEditor.prototype.create = function (name, width, height) {
64766
+ DDiagramEditor.prototype.create = function (options) {
64814
64767
  return this.set({
64815
64768
  version: DDiagramSerializedVersion,
64816
64769
  id: undefined,
64817
- name: name,
64818
- width: width,
64819
- height: height,
64770
+ name: options.name,
64771
+ label: options.label,
64772
+ width: options.width,
64773
+ height: options.height,
64774
+ category: options.category,
64775
+ summary: options.summary,
64776
+ description: options.description,
64777
+ background: options.background,
64820
64778
  resources: [],
64821
64779
  data: [],
64822
- layers: [["Default layer"]],
64780
+ layers: [[this.theme.getBaseLayerLabel()]],
64823
64781
  items: [],
64824
64782
  snap: undefined
64825
64783
  });
@@ -76355,7 +76313,6 @@
76355
76313
  toEnum: toEnum,
76356
76314
  toId: toId,
76357
76315
  toIndexOf: toIndexOf,
76358
- toLabelWith: toLabelWith,
76359
76316
  toLabel: toLabel$1,
76360
76317
  toMerged: toMerged,
76361
76318
  toPadded: toPadded,