@syncfusion/ej2-navigations 33.1.46 → 33.1.49

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.
@@ -1216,6 +1216,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1216
1216
  _this.isAnimationNone = false;
1217
1217
  _this.isKBDAction = false;
1218
1218
  _this.skipNextArrowDown = false;
1219
+ _this.isCmenuOpened = false;
1219
1220
  return _this;
1220
1221
  }
1221
1222
  /**
@@ -1389,27 +1390,32 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1389
1390
  new Touch(target, { tapHold: this.touchHandler.bind(this) });
1390
1391
  }
1391
1392
  else {
1392
- EventHandler.add(target, 'contextmenu', this.cmenuHandler, this);
1393
+ this.delegateContextMenuHandler = this.cmenuHandler.bind(this);
1394
+ EventHandler.add(target, 'contextmenu', this.delegateContextMenuHandler, this);
1393
1395
  }
1394
1396
  }
1395
1397
  }
1396
1398
  this.targetElement = target;
1397
1399
  if (!this.isMenu) {
1398
1400
  EventHandler.add(this.targetElement, 'scroll', this.scrollHandler, this);
1399
- for (var _i = 0, _a = getScrollableParent(this.targetElement); _i < _a.length; _i++) {
1401
+ this.scrollParents = getScrollableParent(this.targetElement).slice();
1402
+ this.delegateParentScrollHandler = this.scrollHandler.bind(this);
1403
+ for (var _i = 0, _a = this.scrollParents; _i < _a.length; _i++) {
1400
1404
  var parent_1 = _a[_i];
1401
- EventHandler.add(parent_1, 'scroll', this.scrollHandler, this);
1405
+ EventHandler.add(parent_1, 'scroll', this.delegateParentScrollHandler, this);
1402
1406
  }
1403
1407
  }
1404
1408
  }
1405
1409
  if (!Browser.isDevice) {
1406
1410
  this.delegateMoverHandler = this.moverHandler.bind(this);
1407
1411
  this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
1412
+ this.delegateDomKeyHandler = this.domKeyHandler.bind(this);
1408
1413
  EventHandler.add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
1409
1414
  EventHandler.add(document, 'mousedown', this.delegateMouseDownHandler, this);
1410
- EventHandler.add(document, 'keydown', this.domKeyHandler, this);
1415
+ EventHandler.add(document, 'keydown', this.delegateDomKeyHandler, this);
1411
1416
  if (!this.isMenu && !this.target) {
1412
- EventHandler.add(document, 'scroll', this.scrollHandler, this);
1417
+ this.delegateScrollHandler = this.scrollHandler.bind(this);
1418
+ EventHandler.add(document, 'scroll', this.delegateScrollHandler, this);
1413
1419
  }
1414
1420
  }
1415
1421
  this.delegateClickHandler = this.clickHandler.bind(this);
@@ -1418,7 +1424,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1418
1424
  this.rippleFn = rippleEffect(wrapper, { selector: '.' + ITEM });
1419
1425
  if (!this.isMenu && this.enableScrolling) {
1420
1426
  this.enableTouchScroll(wrapper);
1421
- document.addEventListener('touchstart', this.touchOutsideHandler.bind(this), { passive: true });
1427
+ this.delegateTouchOutsideHandler = this.touchOutsideHandler.bind(this);
1428
+ document.addEventListener('touchstart', this.delegateTouchOutsideHandler, { passive: true });
1422
1429
  }
1423
1430
  };
1424
1431
  MenuBase.prototype.wireKeyboardEvent = function (element) {
@@ -1725,6 +1732,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1725
1732
  if (this.isCMenu) {
1726
1733
  if (this.canOpen(e.target)) {
1727
1734
  this.openMenu(null, null, this.pageY, this.pageX, e);
1735
+ this.isCmenuOpened = true;
1728
1736
  }
1729
1737
  this.isCMenu = false;
1730
1738
  }
@@ -3129,33 +3137,59 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3129
3137
  }
3130
3138
  }
3131
3139
  else {
3132
- EventHandler.remove(target, 'contextmenu', this.cmenuHandler);
3140
+ if (this.delegateContextMenuHandler) {
3141
+ EventHandler.remove(target, 'contextmenu', this.delegateContextMenuHandler);
3142
+ this.delegateContextMenuHandler = null;
3143
+ }
3133
3144
  }
3134
3145
  }
3135
3146
  }
3136
3147
  if (!this.isMenu) {
3137
3148
  EventHandler.remove(this.targetElement, 'scroll', this.scrollHandler);
3138
- for (var _i = 0, _a = getScrollableParent(this.targetElement); _i < _a.length; _i++) {
3139
- var parent_2 = _a[_i];
3140
- EventHandler.remove(parent_2, 'scroll', this.scrollHandler);
3149
+ if (this.scrollParents) {
3150
+ for (var _i = 0, _a = this.scrollParents; _i < _a.length; _i++) {
3151
+ var parent_2 = _a[_i];
3152
+ EventHandler.remove(parent_2, 'scroll', this.delegateParentScrollHandler);
3153
+ }
3154
+ this.delegateParentScrollHandler = null;
3155
+ this.scrollParents.length = 0;
3156
+ this.scrollParents = null;
3141
3157
  }
3142
3158
  }
3143
3159
  }
3144
3160
  if (!Browser.isDevice) {
3145
- EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
3146
- EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
3147
- EventHandler.remove(document, 'keydown', this.domKeyHandler);
3161
+ if (this.delegateMoverHandler) {
3162
+ EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
3163
+ this.delegateMoverHandler = null;
3164
+ }
3165
+ if (this.delegateMouseDownHandler) {
3166
+ EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
3167
+ this.delegateMouseDownHandler = null;
3168
+ }
3169
+ if (this.delegateDomKeyHandler) {
3170
+ EventHandler.remove(document, 'keydown', this.delegateDomKeyHandler);
3171
+ this.delegateDomKeyHandler = null;
3172
+ }
3148
3173
  if (!this.isMenu && !this.target) {
3149
- EventHandler.remove(document, 'scroll', this.scrollHandler);
3174
+ if (this.delegateScrollHandler) {
3175
+ EventHandler.remove(document, 'scroll', this.delegateScrollHandler);
3176
+ this.delegateScrollHandler = null;
3177
+ }
3150
3178
  }
3151
3179
  }
3152
- EventHandler.remove(document, 'click', this.delegateClickHandler);
3180
+ if (this.delegateClickHandler) {
3181
+ EventHandler.remove(document, 'click', this.delegateClickHandler);
3182
+ this.delegateClickHandler = null;
3183
+ }
3153
3184
  this.unWireKeyboardEvent(wrapper);
3154
3185
  this.rippleFn();
3155
3186
  if (!this.isMenu && this.enableScrolling) {
3156
3187
  wrapper.removeEventListener('touchstart', this.touchStartFn);
3157
3188
  wrapper.removeEventListener('touchmove', this.touchMoveFn);
3158
- document.removeEventListener('touchstart', this.touchOutsideHandler);
3189
+ if (this.delegateTouchOutsideHandler) {
3190
+ document.removeEventListener('touchstart', this.delegateTouchOutsideHandler);
3191
+ this.delegateTouchOutsideHandler = null;
3192
+ }
3159
3193
  }
3160
3194
  };
3161
3195
  MenuBase.prototype.unWireKeyboardEvent = function (element) {
@@ -3599,6 +3633,17 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3599
3633
  var wrapper = this.getWrapper();
3600
3634
  if (wrapper) {
3601
3635
  this.unWireEvents();
3636
+ this.delegateClickHandler = null;
3637
+ this.delegateMoverHandler = null;
3638
+ this.delegateMouseDownHandler = null;
3639
+ this.delegateDomKeyHandler = null;
3640
+ this.delegateScrollHandler = null;
3641
+ this.delegateTouchOutsideHandler = null;
3642
+ this.delegateParentScrollHandler = null;
3643
+ if (this.delegateContextMenuHandler) {
3644
+ EventHandler.remove(this.targetElement, 'contextmenu', this.delegateContextMenuHandler);
3645
+ this.delegateContextMenuHandler = null;
3646
+ }
3602
3647
  if (!this.isMenu) {
3603
3648
  this.clonedElement.style.display = '';
3604
3649
  if (this.clonedElement.tagName === 'EJS-CONTEXTMENU') {
@@ -3642,7 +3687,31 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3642
3687
  wrapper.parentNode.insertBefore(this.element, wrapper);
3643
3688
  this.clonedElement = null;
3644
3689
  }
3690
+ if (this.popupObj) {
3691
+ this.popupObj.destroy();
3692
+ this.popupObj = null;
3693
+ }
3694
+ this.currentTarget = null;
3695
+ this.targetElement = null;
3696
+ if (this.animation) {
3697
+ this.animation.destroy();
3698
+ this.animation = null;
3699
+ }
3700
+ if (!this.isMenu && !this.isCmenuOpened && this.element) {
3701
+ var elementInstance = getValue('ej2_instances', this.element);
3702
+ if (elementInstance && Array.isArray(elementInstance)) {
3703
+ elementInstance.length = 0;
3704
+ setValue('ej2_instances', elementInstance, this.element);
3705
+ }
3706
+ }
3645
3707
  detach(wrapper);
3708
+ if (this.uList && !document.body.contains(this.uList)) {
3709
+ var ulInstance = getValue('ej2_instances', this.uList);
3710
+ if (ulInstance && Array.isArray(ulInstance)) {
3711
+ ulInstance.length = 0;
3712
+ setValue('ej2_instances', ulInstance, this.uList);
3713
+ }
3714
+ }
3646
3715
  _super.prototype.destroy.call(this);
3647
3716
  if (this.template) {
3648
3717
  this.clearTemplate(['template']);
@@ -6440,6 +6509,11 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
6440
6509
  if (!isNullOrUndefined(this.keyModule)) {
6441
6510
  this.keyModule.destroy();
6442
6511
  }
6512
+ var headerEles = [].slice.call(this.element.querySelectorAll('.' + CLS_HEADER));
6513
+ for (var _i = 0, headerEles_1 = headerEles; _i < headerEles_1.length; _i++) {
6514
+ var hdr = headerEles_1[_i];
6515
+ EventHandler.clearEvents(hdr);
6516
+ }
6443
6517
  };
6444
6518
  Accordion.prototype.wireEvents = function () {
6445
6519
  EventHandler.add(this.element, 'click', this.clickHandler, this);
@@ -7361,6 +7435,10 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
7361
7435
  this.clearTemplate();
7362
7436
  }
7363
7437
  [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM$1)).forEach(function (el) {
7438
+ var hdr = select('.' + CLS_HEADER, el);
7439
+ if (hdr) {
7440
+ EventHandler.clearEvents(hdr);
7441
+ }
7364
7442
  detach(el);
7365
7443
  });
7366
7444
  };
@@ -15374,6 +15452,18 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
15374
15452
  this.wireExpandOnEvent(false);
15375
15453
  EventHandler.remove(this.element, 'mouseover', this.onMouseOver);
15376
15454
  EventHandler.remove(this.element, 'mouseout', this.onMouseLeave);
15455
+ var liElements = selectAll('.' + LISTITEM, this.element);
15456
+ for (var i = 0; i < liElements.length; i++) {
15457
+ var li = liElements[parseInt(i.toString(), 10)];
15458
+ EventHandler.remove(li, 'focus', this.focusIn);
15459
+ EventHandler.remove(li, 'blur', this.focusOut);
15460
+ var frame = select('.' + CHECKBOXFRAME, li);
15461
+ if (frame) {
15462
+ EventHandler.remove(frame, 'mousedown', this.frameMouseHandler);
15463
+ EventHandler.remove(frame, 'mouseup', this.frameMouseHandler);
15464
+ EventHandler.remove(frame, 'mouseleave', this.frameMouseHandler);
15465
+ }
15466
+ }
15377
15467
  if (!this.disabled) {
15378
15468
  this.keyboardModule.destroy();
15379
15469
  }
@@ -16602,6 +16692,7 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
16602
16692
  function Sidebar(options, element) {
16603
16693
  var _this = _super.call(this, options, element) || this;
16604
16694
  _this.documentClickContext = _this.documentclickHandler.bind(_this);
16695
+ _this.resizeHandler = _this.resize.bind(_this);
16605
16696
  return _this;
16606
16697
  }
16607
16698
  Sidebar.prototype.preRender = function () {
@@ -17007,11 +17098,12 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
17007
17098
  };
17008
17099
  Sidebar.prototype.wireEvents = function () {
17009
17100
  this.setEnableGestures();
17010
- EventHandler.add(window, 'resize', this.resize, this);
17101
+ EventHandler.add(window, 'resize', this.resizeHandler);
17011
17102
  };
17012
17103
  Sidebar.prototype.unWireEvents = function () {
17013
- EventHandler.remove(window, 'resize', this.resize);
17104
+ EventHandler.remove(window, 'resize', this.resizeHandler);
17014
17105
  EventHandler.remove(document, 'mousedown touchstart', this.documentclickHandler);
17106
+ EventHandler.remove(this.element, 'transitionend', this.transitionEnd);
17015
17107
  if (this.mainContentEle) {
17016
17108
  this.mainContentEle.destroy();
17017
17109
  }
@@ -17906,7 +17998,7 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
17906
17998
  detach(this.popupObj.element);
17907
17999
  }
17908
18000
  };
17909
- Breadcrumb.prototype.resize = function () {
18001
+ Breadcrumb.prototype.resize = function (e) {
17910
18002
  this._maxItems = this.maxItems;
17911
18003
  this.initPvtProps();
17912
18004
  this.reRenderItems();
@@ -17997,7 +18089,8 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
17997
18089
  this.delegateClickHanlder = this.documentClickHandler.bind(this);
17998
18090
  EventHandler.add(document, 'click', this.delegateClickHanlder, this);
17999
18091
  EventHandler.add(this.element, 'click', this.clickHandler, this);
18000
- window.addEventListener('resize', this.resize.bind(this));
18092
+ this.resizeHandler = this.resize.bind(this);
18093
+ window.addEventListener('resize', this.resizeHandler);
18001
18094
  };
18002
18095
  Breadcrumb.prototype.popupWireEvents = function () {
18003
18096
  EventHandler.add(this.popupObj.element, 'click', this.clickHandler, this);
@@ -18006,7 +18099,8 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
18006
18099
  Breadcrumb.prototype.unWireEvents = function () {
18007
18100
  EventHandler.remove(document, 'click', this.delegateClickHanlder);
18008
18101
  EventHandler.remove(this.element, 'click', this.clickHandler);
18009
- window.removeEventListener('resize', this.resize.bind(this));
18102
+ window.removeEventListener('resize', this.resizeHandler);
18103
+ this.resizeHandler = null;
18010
18104
  if (this.popupObj) {
18011
18105
  EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
18012
18106
  EventHandler.remove(this.popupObj.element, 'keydown', this.popupKeyDownHandler);
@@ -20168,12 +20262,20 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
20168
20262
  }
20169
20263
  };
20170
20264
  Stepper.prototype.wireEvents = function () {
20171
- EventHandler.add(window, 'resize', this.updateResize, this);
20172
- EventHandler.add(window, 'click', this.updateStepFocus, this);
20265
+ this.windowEventHandlers = {};
20266
+ this.windowEventHandlers.resize = this.updateResize.bind(this);
20267
+ this.windowEventHandlers.click = this.updateStepFocus.bind(this);
20268
+ EventHandler.add(window, 'resize', this.windowEventHandlers.resize);
20269
+ EventHandler.add(window, 'click', this.windowEventHandlers.click);
20173
20270
  };
20174
20271
  Stepper.prototype.unWireEvents = function () {
20175
- EventHandler.remove(window, 'resize', this.updateResize);
20176
- EventHandler.remove(window, 'click', this.updateStepFocus);
20272
+ EventHandler.remove(window, 'resize', this.windowEventHandlers && this.windowEventHandlers.resize);
20273
+ EventHandler.remove(window, 'click', this.windowEventHandlers && this.windowEventHandlers.click);
20274
+ if (this.windowEventHandlers) {
20275
+ this.windowEventHandlers.resize = null;
20276
+ this.windowEventHandlers.click = null;
20277
+ this.windowEventHandlers = null;
20278
+ }
20177
20279
  };
20178
20280
  Stepper.prototype.updateResize = function () {
20179
20281
  if (this.stepperItemList && this.progressbar && this.element.classList.contains(HORIZSTEP$1)) {