@syncfusion/ej2-navigations 33.1.47 → 33.2.3

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.
@@ -148,7 +148,6 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
148
148
  * @returns {void}
149
149
  */
150
150
  HScroll.prototype.destroy = function () {
151
- var _this = this;
152
151
  var ele = this.element;
153
152
  ele.style.display = '';
154
153
  ele.classList.remove(CLS_ROOT);
@@ -156,22 +155,8 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
156
155
  ele.classList.remove(CLS_RTL);
157
156
  var nav = selectAll('.e-' + ele.id + '_nav.' + CLS_HSCROLLNAV, ele);
158
157
  var overlay = selectAll('.' + CLS_OVERLAY, ele);
159
- [].slice.call(overlay).forEach(function (oElem) {
160
- if (_this.onKeyPressBound) {
161
- oElem.removeEventListener('keydown', _this.onKeyPressBound);
162
- }
163
- if (_this.onKeyUpBound) {
164
- oElem.removeEventListener('keyup', _this.onKeyUpBound);
165
- }
166
- if (_this.repeatScrollBound) {
167
- oElem.removeEventListener('mouseup', _this.repeatScrollBound);
168
- oElem.removeEventListener('touchend', _this.repeatScrollBound);
169
- }
170
- if (_this.contextMenuBound) {
171
- oElem.removeEventListener('contextmenu', _this.contextMenuBound);
172
- }
173
- EventHandler.remove(oElem, 'click', _this.clickEventHandler);
174
- detach(oElem);
158
+ [].slice.call(overlay).forEach(function (ele) {
159
+ detach(ele);
175
160
  });
176
161
  for (var _i = 0, _a = [].slice.call(this.scrollItems.children); _i < _a.length; _i++) {
177
162
  var elem = _a[_i];
@@ -182,37 +167,14 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
182
167
  }
183
168
  detach(this.scrollEle);
184
169
  if (nav.length > 0) {
185
- [].slice.call(nav).forEach(function (nElem) {
186
- if (_this.onKeyPressBound) {
187
- nElem.removeEventListener('keydown', _this.onKeyPressBound);
188
- }
189
- if (_this.onKeyUpBound) {
190
- nElem.removeEventListener('keyup', _this.onKeyUpBound);
191
- }
192
- if (_this.repeatScrollBound) {
193
- nElem.removeEventListener('mouseup', _this.repeatScrollBound);
194
- nElem.removeEventListener('touchend', _this.repeatScrollBound);
195
- }
196
- if (_this.contextMenuBound) {
197
- nElem.removeEventListener('contextmenu', _this.contextMenuBound);
198
- }
199
- EventHandler.remove(nElem, 'click', _this.clickEventHandler);
200
- detach(nElem);
201
- });
170
+ detach(nav[0]);
171
+ if (!isNullOrUndefined(nav[1])) {
172
+ detach(nav[1]);
173
+ }
202
174
  }
203
175
  EventHandler.remove(this.scrollEle, 'scroll', this.scrollHandler);
204
176
  this.touchModule.destroy();
205
177
  this.touchModule = null;
206
- if (this.navTouchCollection) {
207
- this.navTouchCollection.forEach(function (t) { if (t && typeof t.destroy === 'function') {
208
- t.destroy();
209
- } });
210
- this.navTouchCollection = null;
211
- }
212
- this.onKeyPressBound = null;
213
- this.onKeyUpBound = null;
214
- this.repeatScrollBound = null;
215
- this.contextMenuBound = null;
216
178
  _super.prototype.destroy.call(this);
217
179
  };
218
180
  /**
@@ -299,34 +261,17 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
299
261
  HScroll.prototype.eventBinding = function (ele) {
300
262
  var _this = this;
301
263
  [].slice.call(ele).forEach(function (el) {
302
- var navTouch = new Touch(el, { tapHold: _this.tabHoldHandler.bind(_this), tapHoldThreshold: 500 });
303
- if (!_this.navTouchCollection) {
304
- _this.navTouchCollection = [];
305
- }
306
- _this.navTouchCollection.push(navTouch);
307
- if (!_this.onKeyPressBound) {
308
- _this.onKeyPressBound = _this.onKeyPress.bind(_this);
309
- }
310
- if (!_this.onKeyUpBound) {
311
- _this.onKeyUpBound = _this.onKeyUp.bind(_this);
312
- }
313
- if (!_this.repeatScrollBound) {
314
- _this.repeatScrollBound = _this.repeatScroll.bind(_this);
315
- }
316
- if (!_this.contextMenuBound) {
317
- _this.contextMenuBound = _this.contextMenuHandler.bind(_this);
318
- }
319
- el.addEventListener('keydown', _this.onKeyPressBound);
320
- el.addEventListener('keyup', _this.onKeyUpBound);
321
- el.addEventListener('mouseup', _this.repeatScrollBound);
322
- el.addEventListener('touchend', _this.repeatScrollBound);
323
- el.addEventListener('contextmenu', _this.contextMenuBound);
264
+ new Touch(el, { tapHold: _this.tabHoldHandler.bind(_this), tapHoldThreshold: 500 });
265
+ el.addEventListener('keydown', _this.onKeyPress.bind(_this));
266
+ el.addEventListener('keyup', _this.onKeyUp.bind(_this));
267
+ el.addEventListener('mouseup', _this.repeatScroll.bind(_this));
268
+ el.addEventListener('touchend', _this.repeatScroll.bind(_this));
269
+ el.addEventListener('contextmenu', function (e) {
270
+ e.preventDefault();
271
+ });
324
272
  EventHandler.add(el, 'click', _this.clickEventHandler, _this);
325
273
  });
326
274
  };
327
- HScroll.prototype.contextMenuHandler = function (e) {
328
- e.preventDefault();
329
- };
330
275
  HScroll.prototype.repeatScroll = function () {
331
276
  clearInterval(this.timeout);
332
277
  };
@@ -1271,6 +1216,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1271
1216
  _this.isAnimationNone = false;
1272
1217
  _this.isKBDAction = false;
1273
1218
  _this.skipNextArrowDown = false;
1219
+ _this.isCmenuOpened = false;
1274
1220
  return _this;
1275
1221
  }
1276
1222
  /**
@@ -1444,16 +1390,19 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1444
1390
  new Touch(target, { tapHold: this.touchHandler.bind(this) });
1445
1391
  }
1446
1392
  else {
1447
- EventHandler.add(target, 'contextmenu', this.cmenuHandler, this);
1393
+ this.delegateContextMenuHandler = this.cmenuHandler.bind(this);
1394
+ EventHandler.add(target, 'contextmenu', this.delegateContextMenuHandler, this);
1448
1395
  }
1449
1396
  }
1450
1397
  }
1451
1398
  this.targetElement = target;
1452
1399
  if (!this.isMenu) {
1453
1400
  EventHandler.add(this.targetElement, 'scroll', this.scrollHandler, this);
1454
- 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++) {
1455
1404
  var parent_1 = _a[_i];
1456
- EventHandler.add(parent_1, 'scroll', this.scrollHandler, this);
1405
+ EventHandler.add(parent_1, 'scroll', this.delegateParentScrollHandler, this);
1457
1406
  }
1458
1407
  }
1459
1408
  }
@@ -1783,6 +1732,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1783
1732
  if (this.isCMenu) {
1784
1733
  if (this.canOpen(e.target)) {
1785
1734
  this.openMenu(null, null, this.pageY, this.pageX, e);
1735
+ this.isCmenuOpened = true;
1786
1736
  }
1787
1737
  this.isCMenu = false;
1788
1738
  }
@@ -3187,15 +3137,23 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3187
3137
  }
3188
3138
  }
3189
3139
  else {
3190
- EventHandler.remove(target, 'contextmenu', this.cmenuHandler);
3140
+ if (this.delegateContextMenuHandler) {
3141
+ EventHandler.remove(target, 'contextmenu', this.delegateContextMenuHandler);
3142
+ this.delegateContextMenuHandler = null;
3143
+ }
3191
3144
  }
3192
3145
  }
3193
3146
  }
3194
3147
  if (!this.isMenu) {
3195
3148
  EventHandler.remove(this.targetElement, 'scroll', this.scrollHandler);
3196
- for (var _i = 0, _a = getScrollableParent(this.targetElement); _i < _a.length; _i++) {
3197
- var parent_2 = _a[_i];
3198
- 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;
3199
3157
  }
3200
3158
  }
3201
3159
  }
@@ -3675,6 +3633,17 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3675
3633
  var wrapper = this.getWrapper();
3676
3634
  if (wrapper) {
3677
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
+ }
3678
3647
  if (!this.isMenu) {
3679
3648
  this.clonedElement.style.display = '';
3680
3649
  if (this.clonedElement.tagName === 'EJS-CONTEXTMENU') {
@@ -3718,7 +3687,31 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3718
3687
  wrapper.parentNode.insertBefore(this.element, wrapper);
3719
3688
  this.clonedElement = null;
3720
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
+ }
3721
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
+ }
3722
3715
  _super.prototype.destroy.call(this);
3723
3716
  if (this.template) {
3724
3717
  this.clearTemplate(['template']);
@@ -4100,19 +4093,14 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
4100
4093
  }
4101
4094
  };
4102
4095
  Toolbar.prototype.destroyItems = function () {
4103
- var _this = this;
4104
4096
  if (this.element) {
4105
- [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach(function (el) {
4106
- EventHandler.remove(el, 'click', _this.itemClick);
4107
- detach(el);
4108
- });
4097
+ [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach(function (el) { detach(el); });
4109
4098
  }
4110
4099
  if (this.tbarAlign) {
4111
4100
  var tbarItems = this.element.querySelector('.' + CLS_ITEMS);
4112
4101
  if (tbarItems) {
4113
4102
  if (tbarItems.children) {
4114
4103
  [].slice.call(tbarItems.children).forEach(function (el) {
4115
- EventHandler.remove(el, 'click', _this.itemClick);
4116
4104
  detach(el);
4117
4105
  });
4118
4106
  }
@@ -5857,7 +5845,7 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
5857
5845
  dom.setAttribute('aria-label', (item.text || item.tooltipText));
5858
5846
  dom.setAttribute('aria-disabled', 'false');
5859
5847
  innerEle.appendChild(dom);
5860
- EventHandler.add(innerEle, 'click', this.itemClick, this);
5848
+ innerEle.addEventListener('click', this.itemClick.bind(this));
5861
5849
  break;
5862
5850
  case 'Separator':
5863
5851
  this.add(innerEle, CLS_SEPARATOR);