@syncfusion/ej2-splitbuttons 22.1.34 → 22.1.37

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.
@@ -262,6 +262,10 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
262
262
  if (this.canOpen()) {
263
263
  this.openPopUp();
264
264
  }
265
+ else if (this.createPopupOnClick && !this.isPopupCreated) {
266
+ this.createPopup();
267
+ this.openPopUp();
268
+ }
265
269
  else {
266
270
  this.closePopup();
267
271
  }
@@ -539,6 +543,12 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
539
543
  };
540
544
  DropDownButton.prototype.getPopUpElement = function () {
541
545
  var val = null;
546
+ if (!this.dropDown && this.activeElem[0].classList.contains('e-split-btn')) {
547
+ var dropDownBtn = getComponent(this.activeElem[1], 'dropdown-btn');
548
+ if (dropDownBtn) {
549
+ this.dropDown = dropDownBtn.dropDown;
550
+ }
551
+ }
542
552
  if (this.dropDown) {
543
553
  val = this.dropDown.element;
544
554
  }
@@ -560,6 +570,9 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
560
570
  EventHandler.add(this.element, 'keydown', this.keyBoardHandler, this);
561
571
  };
562
572
  DropDownButton.prototype.popupWireEvents = function () {
573
+ if (!this.delegateMousedownHandler) {
574
+ this.delegateMousedownHandler = this.mousedownHandler.bind(this);
575
+ }
563
576
  var popupElement = this.getPopUpElement();
564
577
  if (this.createPopupOnClick) {
565
578
  EventHandler.add(document, 'mousedown touchstart', this.delegateMousedownHandler, this);
@@ -678,7 +691,7 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
678
691
  DropDownButton.prototype.clickHandler = function (e) {
679
692
  var trgt = e.target;
680
693
  if (closest(trgt, '[id="' + this.element.id + '"]')) {
681
- if (!this.createPopupOnClick || (this.target && !this.isColorPicker())) {
694
+ if (!this.createPopupOnClick || (this.target && this.target !== '' && !this.isColorPicker())) {
682
695
  if (this.getPopUpElement().classList.contains('e-popup-close')) {
683
696
  this.openPopUp(e);
684
697
  }
@@ -806,9 +819,6 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
806
819
  _this.destroyPopup();
807
820
  }
808
821
  }
809
- if (_this.target) {
810
- _this.isPopupCreated = _this.createPopupOnClick ? false : true;
811
- }
812
822
  }
813
823
  else {
814
824
  if (ul) {
@@ -1175,6 +1185,8 @@ var SplitButton = /** @__PURE__ @class */ (function (_super) {
1175
1185
  this.secondaryBtnObj.dropDown.relateTo = this.wrapper;
1176
1186
  this.dropDown = this.secondaryBtnObj.dropDown;
1177
1187
  }
1188
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1189
+ this.isPopupCreated = this.secondaryBtnObj.isPopupCreated;
1178
1190
  this.secondaryBtnObj.activeElem = [this.element, this.secondaryBtnObj.element];
1179
1191
  this.secondaryBtnObj.element.querySelector('.e-btn-icon').classList.remove('e-icon-right');
1180
1192
  if (this.disabled) {
@@ -1260,7 +1272,7 @@ var SplitButton = /** @__PURE__ @class */ (function (_super) {
1260
1272
  break;
1261
1273
  case 'enter':
1262
1274
  this.clickHandler(e);
1263
- if (!this.getPopUpElement().classList.contains('e-popup-close')) {
1275
+ if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1264
1276
  this.element.classList.remove('e-active');
1265
1277
  this.secondaryBtnObj.element.classList.add('e-active');
1266
1278
  }