@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
 
@@ -49492,7 +49492,7 @@ var loadThemeWhiteButtonSecondary = function () {
49492
49492
  * Copyright (C) 2019 Toshiba Corporation
49493
49493
  * SPDX-License-Identifier: Apache-2.0
49494
49494
  */
49495
- var toLabelWith = function (target, def) {
49495
+ var toLabel$1 = function (target) {
49496
49496
  if (target != null) {
49497
49497
  if (isString(target)) {
49498
49498
  return target;
@@ -49510,15 +49510,7 @@ var toLabelWith = function (target, def) {
49510
49510
  return target.id;
49511
49511
  }
49512
49512
  }
49513
- return def;
49514
- };
49515
-
49516
- /*
49517
- * Copyright (C) 2019 Toshiba Corporation
49518
- * SPDX-License-Identifier: Apache-2.0
49519
- */
49520
- var toLabel$1 = function (target) {
49521
- return toLabelWith(target, "");
49513
+ return "";
49522
49514
  };
49523
49515
 
49524
49516
  /*
@@ -49539,31 +49531,6 @@ var DThemeWhiteButtonSelect = /** @class */ (function (_super) {
49539
49531
  return DThemeWhiteButtonSelect;
49540
49532
  }(DThemeWhiteButton));
49541
49533
 
49542
- /*
49543
- * Copyright (C) 2019 Toshiba Corporation
49544
- * SPDX-License-Identifier: Apache-2.0
49545
- */
49546
- var toId = function (target) {
49547
- if (target != null) {
49548
- if (isString(target)) {
49549
- return target;
49550
- }
49551
- else if (isNumber(target)) {
49552
- return target;
49553
- }
49554
- else if ("id" in target) {
49555
- return target.id;
49556
- }
49557
- else if ("name" in target) {
49558
- return target.name;
49559
- }
49560
- else if ("label" in target) {
49561
- return target.label;
49562
- }
49563
- }
49564
- return 0;
49565
- };
49566
-
49567
49534
  /*
49568
49535
  * Copyright (C) 2019 Toshiba Corporation
49569
49536
  * SPDX-License-Identifier: Apache-2.0
@@ -49582,11 +49549,11 @@ var DThemeWhiteDialogSelect = /** @class */ (function (_super) {
49582
49549
  DThemeWhiteDialogSelect.prototype.getInputMargin = function () {
49583
49550
  return 19;
49584
49551
  };
49585
- DThemeWhiteDialogSelect.prototype.toCategoryId = function (category) {
49586
- return toId(category);
49552
+ DThemeWhiteDialogSelect.prototype.isCategoryDismissable = function () {
49553
+ return true;
49587
49554
  };
49588
- DThemeWhiteDialogSelect.prototype.toCategoryLabel = function (category) {
49589
- return toLabelWith(category, "All");
49555
+ DThemeWhiteDialogSelect.prototype.getCategoryDismissLabel = function () {
49556
+ return "All";
49590
49557
  };
49591
49558
  return DThemeWhiteDialogSelect;
49592
49559
  }(DThemeWhiteDialogLayered));
@@ -51134,6 +51101,9 @@ var DThemeWhiteDiagramEditor = /** @class */ (function (_super) {
51134
51101
  DThemeWhiteDiagramEditor.prototype.isSnapTargetEnabled = function () {
51135
51102
  return true;
51136
51103
  };
51104
+ DThemeWhiteDiagramEditor.prototype.getBaseLayerLabel = function () {
51105
+ return "Base Layer";
51106
+ };
51137
51107
  return DThemeWhiteDiagramEditor;
51138
51108
  }(DThemeWhiteDiagramBase));
51139
51109
 
@@ -58885,11 +58855,11 @@ var DThemeDarkDialogSelect = /** @class */ (function (_super) {
58885
58855
  DThemeDarkDialogSelect.prototype.getInputMargin = function () {
58886
58856
  return 19;
58887
58857
  };
58888
- DThemeDarkDialogSelect.prototype.toCategoryId = function (category) {
58889
- return toId(category);
58858
+ DThemeDarkDialogSelect.prototype.isCategoryDismissable = function () {
58859
+ return true;
58890
58860
  };
58891
- DThemeDarkDialogSelect.prototype.toCategoryLabel = function (category) {
58892
- return toLabelWith(category, "All");
58861
+ DThemeDarkDialogSelect.prototype.getCategoryDismissLabel = function () {
58862
+ return "All";
58893
58863
  };
58894
58864
  return DThemeDarkDialogSelect;
58895
58865
  }(DThemeDarkDialogLayered));
@@ -60418,6 +60388,9 @@ var DThemeDarkDiagramEditor = /** @class */ (function (_super) {
60418
60388
  DThemeDarkDiagramEditor.prototype.isSnapTargetEnabled = function () {
60419
60389
  return true;
60420
60390
  };
60391
+ DThemeDarkDiagramEditor.prototype.getBaseLayerLabel = function () {
60392
+ return "Base Layer";
60393
+ };
60421
60394
  return DThemeDarkDiagramEditor;
60422
60395
  }(DThemeDarkDiagramBase));
60423
60396
 
@@ -66498,6 +66471,31 @@ var toCloned = function (target) {
66498
66471
  return target;
66499
66472
  };
66500
66473
 
66474
+ /*
66475
+ * Copyright (C) 2019 Toshiba Corporation
66476
+ * SPDX-License-Identifier: Apache-2.0
66477
+ */
66478
+ var toId = function (target) {
66479
+ if (target != null) {
66480
+ if (isString(target)) {
66481
+ return target;
66482
+ }
66483
+ else if (isNumber(target)) {
66484
+ return target;
66485
+ }
66486
+ else if ("id" in target) {
66487
+ return target.id;
66488
+ }
66489
+ else if ("name" in target) {
66490
+ return target.name;
66491
+ }
66492
+ else if ("label" in target) {
66493
+ return target.label;
66494
+ }
66495
+ }
66496
+ return 0;
66497
+ };
66498
+
66501
66499
  /*
66502
66500
  * Copyright (C) 2019 Toshiba Corporation
66503
66501
  * SPDX-License-Identifier: Apache-2.0
@@ -74167,8 +74165,17 @@ var DDialogSelectSearhDismissableImpl = /** @class */ (function (_super) {
74167
74165
  var DDialogSelect = /** @class */ (function (_super) {
74168
74166
  __extends(DDialogSelect, _super);
74169
74167
  function DDialogSelect(options) {
74170
- var _this = _super.call(this, options) || this;
74168
+ var _this = this;
74169
+ var _a, _b;
74170
+ _this = _super.call(this, options) || this;
74171
+ // Value
74171
74172
  _this._value = null;
74173
+ // Categories
74174
+ 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 : [];
74175
+ _this._categories = categories;
74176
+ if (0 < categories.length) {
74177
+ _this.onCategoriesChange(categories);
74178
+ }
74172
74179
  // Controller binding
74173
74180
  var transition = new UtilTransition();
74174
74181
  var search = _this.search;
@@ -74251,7 +74258,7 @@ var DDialogSelect = /** @class */ (function (_super) {
74251
74258
  Object.defineProperty(DDialogSelect.prototype, "selectCategory", {
74252
74259
  get: function () {
74253
74260
  var result = this._selectCategory;
74254
- if (result === undefined) {
74261
+ if (result == null) {
74255
74262
  result = this.newSelectCategory();
74256
74263
  this._selectCategory = result;
74257
74264
  }
@@ -74262,26 +74269,19 @@ var DDialogSelect = /** @class */ (function (_super) {
74262
74269
  });
74263
74270
  DDialogSelect.prototype.newSelectCategory = function () {
74264
74271
  var _this = this;
74265
- var options = this._options;
74266
- if (options != null) {
74267
- var controller = options.controller;
74268
- if (controller != null && controller.getCategories != null) {
74269
- var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
74270
- result.on("change", function (value) {
74271
- _this.onSelectCategoryChange(value);
74272
- });
74273
- return result;
74274
- }
74275
- }
74276
- return null;
74272
+ var result = new DSelect(this.toSelectCategoryOptions(this.theme, this._options));
74273
+ result.on("change", function (value) {
74274
+ _this.onSelectCategoryChange(value);
74275
+ });
74276
+ return result;
74277
74277
  };
74278
74278
  DDialogSelect.prototype.toSelectCategoryOptions = function (theme, options) {
74279
74279
  var result = (options === null || options === void 0 ? void 0 : options.category) || {};
74280
74280
  if (result.width === undefined && result.weight === undefined) {
74281
74281
  result.width = 140;
74282
74282
  }
74283
- if (result.state === undefined) {
74284
- result.state = DBaseState.DISABLED;
74283
+ if (result.visible === undefined) {
74284
+ result.visible = false;
74285
74285
  }
74286
74286
  return result;
74287
74287
  };
@@ -74506,101 +74506,59 @@ var DDialogSelect = /** @class */ (function (_super) {
74506
74506
  return "DDialogSelect";
74507
74507
  };
74508
74508
  DDialogSelect.prototype.onOpen = function () {
74509
- var _this = this;
74510
74509
  _super.prototype.onOpen.call(this);
74511
74510
  this.list.selection.clear();
74512
- var selectCategory = this.selectCategory;
74513
- if (selectCategory != null) {
74514
- if (this._isCategoryFetched !== true) {
74515
- this._isCategoryFetched = true;
74516
- var categoriesOrPromise = this.findCategories();
74517
- if (categoriesOrPromise == null) {
74518
- this.search.create([this.input.value, null]);
74519
- }
74520
- else if (isArray(categoriesOrPromise)) {
74521
- this.onCategoryFetched(selectCategory, categoriesOrPromise);
74522
- }
74523
- else {
74524
- categoriesOrPromise.then(function (categories) {
74525
- _this.onCategoryFetched(selectCategory, categories);
74526
- });
74527
- }
74528
- }
74529
- else {
74530
- this.search.create([this.input.value, selectCategory.value]);
74531
- }
74511
+ if (0 < this._categories.length) {
74512
+ this.search.create([this.input.value, this.selectCategory.value]);
74532
74513
  }
74533
74514
  else {
74534
74515
  this.search.create([this.input.value]);
74535
74516
  }
74536
74517
  };
74537
- DDialogSelect.prototype.onCategoryFetched = function (selectCategory, categories) {
74538
- var items = [];
74539
- var toId = this.newToCategoryId();
74540
- var toLabel = this.newToCategoryLabel();
74541
- items.push({
74542
- value: null,
74543
- text: {
74544
- value: toLabel(null)
74545
- }
74546
- });
74547
- for (var i = 0, imax = categories.length; i < imax; ++i) {
74548
- var category = categories[i];
74549
- items.push({
74550
- value: toId(category),
74551
- text: {
74552
- value: toLabel(category)
74553
- }
74554
- });
74555
- }
74556
- selectCategory.menu = new DMenu({
74557
- fit: true,
74558
- items: items
74559
- });
74560
- selectCategory.state.isEnabled = true;
74561
- this.search.create([this.input.value, null]);
74562
- };
74563
- DDialogSelect.prototype.newToCategoryId = function () {
74564
- var options = this._options;
74565
- if (options != null) {
74566
- var category = options.category;
74567
- if (category != null) {
74568
- var toId = category.toId;
74569
- if (toId != null) {
74570
- return toId;
74571
- }
74518
+ Object.defineProperty(DDialogSelect.prototype, "categories", {
74519
+ get: function () {
74520
+ return this._categories;
74521
+ },
74522
+ set: function (categories) {
74523
+ this._categories = categories;
74524
+ this.onCategoriesChange(categories);
74525
+ },
74526
+ enumerable: false,
74527
+ configurable: true
74528
+ });
74529
+ DDialogSelect.prototype.onCategoriesChange = function (categories) {
74530
+ var _a, _b, _c, _d, _e;
74531
+ var selectCategory = this.selectCategory;
74532
+ if (0 < categories.length) {
74533
+ var items = [];
74534
+ var theme = this.theme;
74535
+ 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 : {};
74536
+ if ((_d = options.enable) !== null && _d !== void 0 ? _d : theme.isCategoryDismissable()) {
74537
+ items.push({
74538
+ value: null,
74539
+ text: {
74540
+ value: (_e = options.label) !== null && _e !== void 0 ? _e : theme.getCategoryDismissLabel()
74541
+ }
74542
+ });
74572
74543
  }
74573
- }
74574
- var theme = this.theme;
74575
- return function (category) {
74576
- return theme.toCategoryId(category);
74577
- };
74578
- };
74579
- DDialogSelect.prototype.newToCategoryLabel = function () {
74580
- var options = this._options;
74581
- if (options != null) {
74582
- var category = options.category;
74583
- if (category != null) {
74584
- var toLabel = category.toLabel;
74585
- if (toLabel != null) {
74586
- return toLabel;
74587
- }
74544
+ for (var i = 0, imax = categories.length; i < imax; ++i) {
74545
+ var category = categories[i];
74546
+ items.push({
74547
+ value: category.id,
74548
+ text: {
74549
+ value: category.label
74550
+ }
74551
+ });
74588
74552
  }
74553
+ selectCategory.menu = new DMenu({
74554
+ fit: true,
74555
+ items: items
74556
+ });
74557
+ selectCategory.show();
74589
74558
  }
74590
- var theme = this.theme;
74591
- return function (category) {
74592
- return theme.toCategoryLabel(category);
74593
- };
74594
- };
74595
- DDialogSelect.prototype.findCategories = function () {
74596
- var options = this._options;
74597
- if (options != null) {
74598
- var controller = options.controller;
74599
- if (controller != null && controller.getCategories != null) {
74600
- return controller.getCategories();
74601
- }
74559
+ else {
74560
+ selectCategory.hide();
74602
74561
  }
74603
- return null;
74604
74562
  };
74605
74563
  DDialogSelect.prototype.onOk = function (value) {
74606
74564
  this.emit("select", value, this);
@@ -74678,7 +74636,7 @@ var DButtonSelect = /** @class */ (function (_super) {
74678
74636
  dialog = options;
74679
74637
  }
74680
74638
  else {
74681
- // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY, DIALOG_CATEGORY_ID>.
74639
+ // Assumes DIALOG === DDialogSelect<DIALOG_VALUE, DIALOG_CATEGORY_ID>.
74682
74640
  dialog = new DDialogSelect(options);
74683
74641
  }
74684
74642
  this._dialog = dialog;
@@ -81943,6 +81901,7 @@ var DDiagramCanvasEditor = /** @class */ (function (_super) {
81943
81901
  label: this.label,
81944
81902
  width: this.width,
81945
81903
  height: this.height,
81904
+ category: this.category,
81946
81905
  summary: this.summary,
81947
81906
  description: this.description,
81948
81907
  background: {
@@ -83366,16 +83325,21 @@ var DDiagramEditor = /** @class */ (function (_super) {
83366
83325
  this.emit("deleted", null, this);
83367
83326
  return Promise.resolve(null);
83368
83327
  };
83369
- DDiagramEditor.prototype.create = function (name, width, height) {
83328
+ DDiagramEditor.prototype.create = function (options) {
83370
83329
  return this.set({
83371
83330
  version: DDiagramSerializedVersion,
83372
83331
  id: undefined,
83373
- name: name,
83374
- width: width,
83375
- height: height,
83332
+ name: options.name,
83333
+ label: options.label,
83334
+ width: options.width,
83335
+ height: options.height,
83336
+ category: options.category,
83337
+ summary: options.summary,
83338
+ description: options.description,
83339
+ background: options.background,
83376
83340
  resources: [],
83377
83341
  data: [],
83378
- layers: [["Default layer"]],
83342
+ layers: [[this.theme.getBaseLayerLabel()]],
83379
83343
  items: [],
83380
83344
  snap: undefined
83381
83345
  });
@@ -95915,7 +95879,6 @@ exports.toId = toId;
95915
95879
  exports.toImageElement = toImageElement;
95916
95880
  exports.toIndexOf = toIndexOf;
95917
95881
  exports.toLabel = toLabel$1;
95918
- exports.toLabelWith = toLabelWith;
95919
95882
  exports.toLength = toLength;
95920
95883
  exports.toLineIndexCount = toLineIndexCount;
95921
95884
  exports.toLineOfAnyPointCount = toLineOfAnyPointCount;