@syncfusion/ej2-splitbuttons 22.1.34 → 22.2.5

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.
@@ -227,6 +227,10 @@ let DropDownButton = class DropDownButton extends Component {
227
227
  if (this.canOpen()) {
228
228
  this.openPopUp();
229
229
  }
230
+ else if (this.createPopupOnClick && !this.isPopupCreated) {
231
+ this.createPopup();
232
+ this.openPopUp();
233
+ }
230
234
  else {
231
235
  this.closePopup();
232
236
  }
@@ -505,6 +509,12 @@ let DropDownButton = class DropDownButton extends Component {
505
509
  }
506
510
  getPopUpElement() {
507
511
  let val = null;
512
+ if (!this.dropDown && this.activeElem[0].classList.contains('e-split-btn')) {
513
+ const dropDownBtn = getComponent(this.activeElem[1], 'dropdown-btn');
514
+ if (dropDownBtn) {
515
+ this.dropDown = dropDownBtn.dropDown;
516
+ }
517
+ }
508
518
  if (this.dropDown) {
509
519
  val = this.dropDown.element;
510
520
  }
@@ -526,6 +536,9 @@ let DropDownButton = class DropDownButton extends Component {
526
536
  EventHandler.add(this.element, 'keydown', this.keyBoardHandler, this);
527
537
  }
528
538
  popupWireEvents() {
539
+ if (!this.delegateMousedownHandler) {
540
+ this.delegateMousedownHandler = this.mousedownHandler.bind(this);
541
+ }
529
542
  const popupElement = this.getPopUpElement();
530
543
  if (this.createPopupOnClick) {
531
544
  EventHandler.add(document, 'mousedown touchstart', this.delegateMousedownHandler, this);
@@ -644,7 +657,7 @@ let DropDownButton = class DropDownButton extends Component {
644
657
  clickHandler(e) {
645
658
  const trgt = e.target;
646
659
  if (closest(trgt, '[id="' + this.element.id + '"]')) {
647
- if (!this.createPopupOnClick || (this.target && !this.isColorPicker())) {
660
+ if (!this.createPopupOnClick || (this.target && this.target !== '' && !this.isColorPicker())) {
648
661
  if (this.getPopUpElement().classList.contains('e-popup-close')) {
649
662
  this.openPopUp(e);
650
663
  }
@@ -768,9 +781,6 @@ let DropDownButton = class DropDownButton extends Component {
768
781
  this.destroyPopup();
769
782
  }
770
783
  }
771
- if (this.target) {
772
- this.isPopupCreated = this.createPopupOnClick ? false : true;
773
- }
774
784
  }
775
785
  else {
776
786
  if (ul) {
@@ -1120,6 +1130,8 @@ let SplitButton = class SplitButton extends DropDownButton {
1120
1130
  this.secondaryBtnObj.dropDown.relateTo = this.wrapper;
1121
1131
  this.dropDown = this.secondaryBtnObj.dropDown;
1122
1132
  }
1133
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1134
+ this.isPopupCreated = this.secondaryBtnObj.isPopupCreated;
1123
1135
  this.secondaryBtnObj.activeElem = [this.element, this.secondaryBtnObj.element];
1124
1136
  this.secondaryBtnObj.element.querySelector('.e-btn-icon').classList.remove('e-icon-right');
1125
1137
  if (this.disabled) {
@@ -1204,7 +1216,7 @@ let SplitButton = class SplitButton extends DropDownButton {
1204
1216
  break;
1205
1217
  case 'enter':
1206
1218
  this.clickHandler(e);
1207
- if (!this.getPopUpElement().classList.contains('e-popup-close')) {
1219
+ if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1208
1220
  this.element.classList.remove('e-active');
1209
1221
  this.secondaryBtnObj.element.classList.add('e-active');
1210
1222
  }