@wcardinal/wcardinal-ui 0.449.0 → 0.450.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 (32) hide show
  1. package/dist/types/wcardinal/ui/d-dropdown-base.d.ts +2 -0
  2. package/dist/types/wcardinal/ui/d-menu-items.d.ts +6 -0
  3. package/dist/types/wcardinal/ui/d-select-multiple.d.ts +1 -1
  4. package/dist/types/wcardinal/ui/d-select.d.ts +1 -1
  5. package/dist/types/wcardinal/ui/index.d.ts +1 -0
  6. package/dist/wcardinal/ui/d-dropdown-base.js +30 -24
  7. package/dist/wcardinal/ui/d-dropdown-base.js.map +1 -1
  8. package/dist/wcardinal/ui/d-menu-items.js +36 -0
  9. package/dist/wcardinal/ui/d-menu-items.js.map +1 -0
  10. package/dist/wcardinal/ui/d-select-multiple.js +2 -2
  11. package/dist/wcardinal/ui/d-select-multiple.js.map +1 -1
  12. package/dist/wcardinal/ui/d-select.js +9 -21
  13. package/dist/wcardinal/ui/d-select.js.map +1 -1
  14. package/dist/wcardinal/ui/index.js +1 -0
  15. package/dist/wcardinal/ui/index.js.map +1 -1
  16. package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
  17. package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
  18. package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
  19. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
  20. package/dist/wcardinal-ui-theme-dark.js +1 -1
  21. package/dist/wcardinal-ui-theme-dark.min.js +1 -1
  22. package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
  23. package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
  24. package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
  25. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
  26. package/dist/wcardinal-ui-theme-white.js +1 -1
  27. package/dist/wcardinal-ui-theme-white.min.js +1 -1
  28. package/dist/wcardinal-ui.cjs.js +75 -46
  29. package/dist/wcardinal-ui.js +75 -46
  30. package/dist/wcardinal-ui.min.js +2 -2
  31. package/dist/wcardinal-ui.min.js.map +1 -1
  32. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.449.0
2
+ Winter Cardinal UI v0.450.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -55566,41 +55566,80 @@
55566
55566
  this.open();
55567
55567
  };
55568
55568
  DDropdownBase.prototype.open = function () {
55569
- var _this = this;
55570
55569
  var menu = this.menu;
55571
55570
  if (menu.isHidden()) {
55572
- // In the case that the menu is created elsewhere,
55573
- // the menu might be opened by other UI elements
55574
- // and the `select` event might be triggered. In
55575
- // that case, we are not supposed to catct that
55576
- // `select` event. This is why the `select` event
55577
- // handler is registered here. Instead of the
55578
- // initialization time.
55579
- var onMenuSelectBound = this._onMenuSelectBound;
55580
- if (onMenuSelectBound == null) {
55581
- onMenuSelectBound = function (value, item, m) {
55582
- _this.onMenuSelect(value, item, m);
55583
- };
55584
- this._onMenuSelectBound = onMenuSelectBound;
55585
- }
55586
- var onMenuCloseBound = this._onMenuCloseBound;
55587
- if (onMenuCloseBound == null) {
55588
- onMenuCloseBound = function () {
55589
- _this.onMenuClose(_this._menu);
55590
- };
55591
- }
55592
- menu.on("select", onMenuSelectBound);
55593
- menu.on("close", onMenuCloseBound);
55571
+ this.onMenuOpening(menu);
55594
55572
  menu.open(this);
55595
- this.emit("open", menu, this);
55573
+ this.onMenuOpened(menu);
55596
55574
  }
55597
55575
  };
55576
+ DDropdownBase.prototype.onMenuOpening = function (menu) {
55577
+ var _this = this;
55578
+ // In the case that the menu is created elsewhere,
55579
+ // the menu might be opened by other UI elements
55580
+ // and the `select` event might be triggered. In
55581
+ // that case, we are not supposed to catch that
55582
+ // `select` event. This is why the `select` event
55583
+ // handler is registered here. Instead of the
55584
+ // initialization time.
55585
+ var onMenuSelectBound = this._onMenuSelectBound;
55586
+ if (onMenuSelectBound == null) {
55587
+ onMenuSelectBound = function (value, item, m) {
55588
+ _this.onMenuSelect(value, item, m);
55589
+ };
55590
+ this._onMenuSelectBound = onMenuSelectBound;
55591
+ }
55592
+ var onMenuCloseBound = this._onMenuCloseBound;
55593
+ if (onMenuCloseBound == null) {
55594
+ onMenuCloseBound = function () {
55595
+ _this.onMenuClose(_this._menu);
55596
+ };
55597
+ }
55598
+ menu.on("select", onMenuSelectBound);
55599
+ menu.on("close", onMenuCloseBound);
55600
+ };
55601
+ DDropdownBase.prototype.onMenuOpened = function (menu) {
55602
+ this.emit("open", menu, this);
55603
+ };
55598
55604
  DDropdownBase.prototype.close = function () {
55599
55605
  this.menu.close();
55600
55606
  };
55601
55607
  return DDropdownBase;
55602
55608
  }(DButtonBase));
55603
55609
 
55610
+ /*
55611
+ * Copyright (C) 2019 Toshiba Corporation
55612
+ * SPDX-License-Identifier: Apache-2.0
55613
+ */
55614
+ var DMenuItems = /** @class */ (function () {
55615
+ function DMenuItems() {
55616
+ }
55617
+ DMenuItems.each = function (menu, iteratee) {
55618
+ var children = menu.children;
55619
+ for (var i = 0, imax = children.length; i < imax; ++i) {
55620
+ var child = children[i];
55621
+ if (child instanceof DMenuItemMenu) {
55622
+ var result = this.each(child.menu, iteratee);
55623
+ if (result != null) {
55624
+ return result;
55625
+ }
55626
+ }
55627
+ else if (child instanceof DMenuItem) {
55628
+ if (iteratee(child)) {
55629
+ return child;
55630
+ }
55631
+ }
55632
+ }
55633
+ return null;
55634
+ };
55635
+ DMenuItems.find = function (menu, value) {
55636
+ return this.each(menu, function (item) {
55637
+ return item.value === value;
55638
+ });
55639
+ };
55640
+ return DMenuItems;
55641
+ }());
55642
+
55604
55643
  /*
55605
55644
  * Copyright (C) 2019 Toshiba Corporation
55606
55645
  * SPDX-License-Identifier: Apache-2.0
@@ -55633,7 +55672,7 @@
55633
55672
  _super.prototype.onMenuReplaced.call(this, newMenu, oldMenu);
55634
55673
  // Update the value
55635
55674
  var value = this._value;
55636
- var item = this.findMenuItem(newMenu, value);
55675
+ var item = DMenuItems.find(newMenu, value);
55637
55676
  if (item != null) {
55638
55677
  this._value = value;
55639
55678
  this.text = item;
@@ -55646,23 +55685,12 @@
55646
55685
  DSelect.prototype.onValueChange = function (newValue, oldValue, item) {
55647
55686
  this.emit("change", newValue, oldValue, item, this);
55648
55687
  };
55649
- DSelect.prototype.findMenuItem = function (menu, value) {
55650
- var children = menu.children;
55651
- for (var i = 0, imax = children.length; i < imax; ++i) {
55652
- var child = children[i];
55653
- if (child instanceof DMenuItemMenu) {
55654
- var result = this.findMenuItem(child.menu, value);
55655
- if (result != null) {
55656
- return result;
55657
- }
55658
- }
55659
- else if (child instanceof DMenuItem) {
55660
- if (child.value === value) {
55661
- return child;
55662
- }
55663
- }
55664
- }
55665
- return null;
55688
+ DSelect.prototype.onMenuOpening = function (menu) {
55689
+ _super.prototype.onMenuOpening.call(this, menu);
55690
+ var value = this._value;
55691
+ DMenuItems.each(menu, function (item) {
55692
+ item.state.isActive = item.value === value;
55693
+ });
55666
55694
  };
55667
55695
  Object.defineProperty(DSelect.prototype, "value", {
55668
55696
  /**
@@ -55676,7 +55704,7 @@
55676
55704
  */
55677
55705
  set: function (value) {
55678
55706
  if (this._value !== value) {
55679
- var item = this.findMenuItem(this.menu, value);
55707
+ var item = DMenuItems.find(this.menu, value);
55680
55708
  if (item != null) {
55681
55709
  this._value = value;
55682
55710
  this.text = item;
@@ -71550,9 +71578,9 @@
71550
71578
  DSelectMultiple.prototype.onValueChange = function (newValues, oldValues, items) {
71551
71579
  this.emit("change", newValues, oldValues, items, this);
71552
71580
  };
71553
- DSelectMultiple.prototype.open = function () {
71581
+ DSelectMultiple.prototype.onMenuOpening = function (menu) {
71582
+ _super.prototype.onMenuOpening.call(this, menu);
71554
71583
  this.updateMenuItems(this.menu, this._values);
71555
- _super.prototype.open.call(this);
71556
71584
  };
71557
71585
  Object.defineProperty(DSelectMultiple.prototype, "values", {
71558
71586
  /**
@@ -81580,6 +81608,7 @@
81580
81608
  DMenuItemSpace: DMenuItemSpace,
81581
81609
  DMenuItemText: DMenuItemText,
81582
81610
  DMenuItem: DMenuItem,
81611
+ DMenuItems: DMenuItems,
81583
81612
  DMenuSidedContent: DMenuSidedContent,
81584
81613
  DMenuSidedItemCheck: DMenuSidedItemCheck,
81585
81614
  DMenuSidedItemExpandableItemCheck: DMenuSidedItemExpandableItemCheck,