@syncfusion/ej2-navigations 33.1.45 → 33.1.47

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,6 +148,7 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
148
148
  * @returns {void}
149
149
  */
150
150
  HScroll.prototype.destroy = function () {
151
+ var _this = this;
151
152
  var ele = this.element;
152
153
  ele.style.display = '';
153
154
  ele.classList.remove(CLS_ROOT);
@@ -155,8 +156,22 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
155
156
  ele.classList.remove(CLS_RTL);
156
157
  var nav = selectAll('.e-' + ele.id + '_nav.' + CLS_HSCROLLNAV, ele);
157
158
  var overlay = selectAll('.' + CLS_OVERLAY, ele);
158
- [].slice.call(overlay).forEach(function (ele) {
159
- detach(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);
160
175
  });
161
176
  for (var _i = 0, _a = [].slice.call(this.scrollItems.children); _i < _a.length; _i++) {
162
177
  var elem = _a[_i];
@@ -167,14 +182,37 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
167
182
  }
168
183
  detach(this.scrollEle);
169
184
  if (nav.length > 0) {
170
- detach(nav[0]);
171
- if (!isNullOrUndefined(nav[1])) {
172
- detach(nav[1]);
173
- }
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
+ });
174
202
  }
175
203
  EventHandler.remove(this.scrollEle, 'scroll', this.scrollHandler);
176
204
  this.touchModule.destroy();
177
205
  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;
178
216
  _super.prototype.destroy.call(this);
179
217
  };
180
218
  /**
@@ -261,17 +299,34 @@ var HScroll = /** @__PURE__ @class */ (function (_super) {
261
299
  HScroll.prototype.eventBinding = function (ele) {
262
300
  var _this = this;
263
301
  [].slice.call(ele).forEach(function (el) {
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
- });
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);
272
324
  EventHandler.add(el, 'click', _this.clickEventHandler, _this);
273
325
  });
274
326
  };
327
+ HScroll.prototype.contextMenuHandler = function (e) {
328
+ e.preventDefault();
329
+ };
275
330
  HScroll.prototype.repeatScroll = function () {
276
331
  clearInterval(this.timeout);
277
332
  };
@@ -1405,11 +1460,13 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1405
1460
  if (!Browser.isDevice) {
1406
1461
  this.delegateMoverHandler = this.moverHandler.bind(this);
1407
1462
  this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
1463
+ this.delegateDomKeyHandler = this.domKeyHandler.bind(this);
1408
1464
  EventHandler.add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
1409
1465
  EventHandler.add(document, 'mousedown', this.delegateMouseDownHandler, this);
1410
- EventHandler.add(document, 'keydown', this.domKeyHandler, this);
1466
+ EventHandler.add(document, 'keydown', this.delegateDomKeyHandler, this);
1411
1467
  if (!this.isMenu && !this.target) {
1412
- EventHandler.add(document, 'scroll', this.scrollHandler, this);
1468
+ this.delegateScrollHandler = this.scrollHandler.bind(this);
1469
+ EventHandler.add(document, 'scroll', this.delegateScrollHandler, this);
1413
1470
  }
1414
1471
  }
1415
1472
  this.delegateClickHandler = this.clickHandler.bind(this);
@@ -1418,7 +1475,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1418
1475
  this.rippleFn = rippleEffect(wrapper, { selector: '.' + ITEM });
1419
1476
  if (!this.isMenu && this.enableScrolling) {
1420
1477
  this.enableTouchScroll(wrapper);
1421
- document.addEventListener('touchstart', this.touchOutsideHandler.bind(this), { passive: true });
1478
+ this.delegateTouchOutsideHandler = this.touchOutsideHandler.bind(this);
1479
+ document.addEventListener('touchstart', this.delegateTouchOutsideHandler, { passive: true });
1422
1480
  }
1423
1481
  };
1424
1482
  MenuBase.prototype.wireKeyboardEvent = function (element) {
@@ -3142,20 +3200,38 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3142
3200
  }
3143
3201
  }
3144
3202
  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);
3203
+ if (this.delegateMoverHandler) {
3204
+ EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
3205
+ this.delegateMoverHandler = null;
3206
+ }
3207
+ if (this.delegateMouseDownHandler) {
3208
+ EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
3209
+ this.delegateMouseDownHandler = null;
3210
+ }
3211
+ if (this.delegateDomKeyHandler) {
3212
+ EventHandler.remove(document, 'keydown', this.delegateDomKeyHandler);
3213
+ this.delegateDomKeyHandler = null;
3214
+ }
3148
3215
  if (!this.isMenu && !this.target) {
3149
- EventHandler.remove(document, 'scroll', this.scrollHandler);
3216
+ if (this.delegateScrollHandler) {
3217
+ EventHandler.remove(document, 'scroll', this.delegateScrollHandler);
3218
+ this.delegateScrollHandler = null;
3219
+ }
3150
3220
  }
3151
3221
  }
3152
- EventHandler.remove(document, 'click', this.delegateClickHandler);
3222
+ if (this.delegateClickHandler) {
3223
+ EventHandler.remove(document, 'click', this.delegateClickHandler);
3224
+ this.delegateClickHandler = null;
3225
+ }
3153
3226
  this.unWireKeyboardEvent(wrapper);
3154
3227
  this.rippleFn();
3155
3228
  if (!this.isMenu && this.enableScrolling) {
3156
3229
  wrapper.removeEventListener('touchstart', this.touchStartFn);
3157
3230
  wrapper.removeEventListener('touchmove', this.touchMoveFn);
3158
- document.removeEventListener('touchstart', this.touchOutsideHandler);
3231
+ if (this.delegateTouchOutsideHandler) {
3232
+ document.removeEventListener('touchstart', this.delegateTouchOutsideHandler);
3233
+ this.delegateTouchOutsideHandler = null;
3234
+ }
3159
3235
  }
3160
3236
  };
3161
3237
  MenuBase.prototype.unWireKeyboardEvent = function (element) {
@@ -4024,14 +4100,19 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
4024
4100
  }
4025
4101
  };
4026
4102
  Toolbar.prototype.destroyItems = function () {
4103
+ var _this = this;
4027
4104
  if (this.element) {
4028
- [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach(function (el) { detach(el); });
4105
+ [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach(function (el) {
4106
+ EventHandler.remove(el, 'click', _this.itemClick);
4107
+ detach(el);
4108
+ });
4029
4109
  }
4030
4110
  if (this.tbarAlign) {
4031
4111
  var tbarItems = this.element.querySelector('.' + CLS_ITEMS);
4032
4112
  if (tbarItems) {
4033
4113
  if (tbarItems.children) {
4034
4114
  [].slice.call(tbarItems.children).forEach(function (el) {
4115
+ EventHandler.remove(el, 'click', _this.itemClick);
4035
4116
  detach(el);
4036
4117
  });
4037
4118
  }
@@ -5776,7 +5857,7 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
5776
5857
  dom.setAttribute('aria-label', (item.text || item.tooltipText));
5777
5858
  dom.setAttribute('aria-disabled', 'false');
5778
5859
  innerEle.appendChild(dom);
5779
- innerEle.addEventListener('click', this.itemClick.bind(this));
5860
+ EventHandler.add(innerEle, 'click', this.itemClick, this);
5780
5861
  break;
5781
5862
  case 'Separator':
5782
5863
  this.add(innerEle, CLS_SEPARATOR);
@@ -6440,6 +6521,11 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
6440
6521
  if (!isNullOrUndefined(this.keyModule)) {
6441
6522
  this.keyModule.destroy();
6442
6523
  }
6524
+ var headerEles = [].slice.call(this.element.querySelectorAll('.' + CLS_HEADER));
6525
+ for (var _i = 0, headerEles_1 = headerEles; _i < headerEles_1.length; _i++) {
6526
+ var hdr = headerEles_1[_i];
6527
+ EventHandler.clearEvents(hdr);
6528
+ }
6443
6529
  };
6444
6530
  Accordion.prototype.wireEvents = function () {
6445
6531
  EventHandler.add(this.element, 'click', this.clickHandler, this);
@@ -7361,6 +7447,10 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
7361
7447
  this.clearTemplate();
7362
7448
  }
7363
7449
  [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM$1)).forEach(function (el) {
7450
+ var hdr = select('.' + CLS_HEADER, el);
7451
+ if (hdr) {
7452
+ EventHandler.clearEvents(hdr);
7453
+ }
7364
7454
  detach(el);
7365
7455
  });
7366
7456
  };
@@ -9560,12 +9650,20 @@ var Tab = /** @__PURE__ @class */ (function (_super) {
9560
9650
  }
9561
9651
  if (properties[j] === 'cssClass') {
9562
9652
  if (!isNullOrUndefined(hdrItem)) {
9563
- hdrItem.classList.remove(oldVal);
9564
- hdrItem.classList.add(newVal);
9653
+ if (!isNullOrUndefined(oldVal) && oldVal !== '') {
9654
+ hdrItem.classList.remove(oldVal);
9655
+ }
9656
+ if (!isNullOrUndefined(newVal) && newVal !== '') {
9657
+ hdrItem.classList.add(newVal);
9658
+ }
9565
9659
  }
9566
9660
  if (!isNullOrUndefined(cntItem)) {
9567
- cntItem.classList.remove(oldVal);
9568
- cntItem.classList.add(newVal);
9661
+ if (!isNullOrUndefined(oldVal) && oldVal !== '') {
9662
+ cntItem.classList.remove(oldVal);
9663
+ }
9664
+ if (!isNullOrUndefined(newVal) && newVal !== '') {
9665
+ cntItem.classList.add(newVal);
9666
+ }
9569
9667
  }
9570
9668
  }
9571
9669
  if (properties[j] === 'disabled') {
@@ -15366,6 +15464,18 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
15366
15464
  this.wireExpandOnEvent(false);
15367
15465
  EventHandler.remove(this.element, 'mouseover', this.onMouseOver);
15368
15466
  EventHandler.remove(this.element, 'mouseout', this.onMouseLeave);
15467
+ var liElements = selectAll('.' + LISTITEM, this.element);
15468
+ for (var i = 0; i < liElements.length; i++) {
15469
+ var li = liElements[parseInt(i.toString(), 10)];
15470
+ EventHandler.remove(li, 'focus', this.focusIn);
15471
+ EventHandler.remove(li, 'blur', this.focusOut);
15472
+ var frame = select('.' + CHECKBOXFRAME, li);
15473
+ if (frame) {
15474
+ EventHandler.remove(frame, 'mousedown', this.frameMouseHandler);
15475
+ EventHandler.remove(frame, 'mouseup', this.frameMouseHandler);
15476
+ EventHandler.remove(frame, 'mouseleave', this.frameMouseHandler);
15477
+ }
15478
+ }
15369
15479
  if (!this.disabled) {
15370
15480
  this.keyboardModule.destroy();
15371
15481
  }
@@ -16594,6 +16704,7 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
16594
16704
  function Sidebar(options, element) {
16595
16705
  var _this = _super.call(this, options, element) || this;
16596
16706
  _this.documentClickContext = _this.documentclickHandler.bind(_this);
16707
+ _this.resizeHandler = _this.resize.bind(_this);
16597
16708
  return _this;
16598
16709
  }
16599
16710
  Sidebar.prototype.preRender = function () {
@@ -16999,11 +17110,12 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
16999
17110
  };
17000
17111
  Sidebar.prototype.wireEvents = function () {
17001
17112
  this.setEnableGestures();
17002
- EventHandler.add(window, 'resize', this.resize, this);
17113
+ EventHandler.add(window, 'resize', this.resizeHandler);
17003
17114
  };
17004
17115
  Sidebar.prototype.unWireEvents = function () {
17005
- EventHandler.remove(window, 'resize', this.resize);
17116
+ EventHandler.remove(window, 'resize', this.resizeHandler);
17006
17117
  EventHandler.remove(document, 'mousedown touchstart', this.documentclickHandler);
17118
+ EventHandler.remove(this.element, 'transitionend', this.transitionEnd);
17007
17119
  if (this.mainContentEle) {
17008
17120
  this.mainContentEle.destroy();
17009
17121
  }
@@ -17898,7 +18010,7 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
17898
18010
  detach(this.popupObj.element);
17899
18011
  }
17900
18012
  };
17901
- Breadcrumb.prototype.resize = function () {
18013
+ Breadcrumb.prototype.resize = function (e) {
17902
18014
  this._maxItems = this.maxItems;
17903
18015
  this.initPvtProps();
17904
18016
  this.reRenderItems();
@@ -17989,7 +18101,8 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
17989
18101
  this.delegateClickHanlder = this.documentClickHandler.bind(this);
17990
18102
  EventHandler.add(document, 'click', this.delegateClickHanlder, this);
17991
18103
  EventHandler.add(this.element, 'click', this.clickHandler, this);
17992
- window.addEventListener('resize', this.resize.bind(this));
18104
+ this.resizeHandler = this.resize.bind(this);
18105
+ window.addEventListener('resize', this.resizeHandler);
17993
18106
  };
17994
18107
  Breadcrumb.prototype.popupWireEvents = function () {
17995
18108
  EventHandler.add(this.popupObj.element, 'click', this.clickHandler, this);
@@ -17998,7 +18111,8 @@ var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
17998
18111
  Breadcrumb.prototype.unWireEvents = function () {
17999
18112
  EventHandler.remove(document, 'click', this.delegateClickHanlder);
18000
18113
  EventHandler.remove(this.element, 'click', this.clickHandler);
18001
- window.removeEventListener('resize', this.resize.bind(this));
18114
+ window.removeEventListener('resize', this.resizeHandler);
18115
+ this.resizeHandler = null;
18002
18116
  if (this.popupObj) {
18003
18117
  EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
18004
18118
  EventHandler.remove(this.popupObj.element, 'keydown', this.popupKeyDownHandler);
@@ -20160,12 +20274,20 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
20160
20274
  }
20161
20275
  };
20162
20276
  Stepper.prototype.wireEvents = function () {
20163
- EventHandler.add(window, 'resize', this.updateResize, this);
20164
- EventHandler.add(window, 'click', this.updateStepFocus, this);
20277
+ this.windowEventHandlers = {};
20278
+ this.windowEventHandlers.resize = this.updateResize.bind(this);
20279
+ this.windowEventHandlers.click = this.updateStepFocus.bind(this);
20280
+ EventHandler.add(window, 'resize', this.windowEventHandlers.resize);
20281
+ EventHandler.add(window, 'click', this.windowEventHandlers.click);
20165
20282
  };
20166
20283
  Stepper.prototype.unWireEvents = function () {
20167
- EventHandler.remove(window, 'resize', this.updateResize);
20168
- EventHandler.remove(window, 'click', this.updateStepFocus);
20284
+ EventHandler.remove(window, 'resize', this.windowEventHandlers && this.windowEventHandlers.resize);
20285
+ EventHandler.remove(window, 'click', this.windowEventHandlers && this.windowEventHandlers.click);
20286
+ if (this.windowEventHandlers) {
20287
+ this.windowEventHandlers.resize = null;
20288
+ this.windowEventHandlers.click = null;
20289
+ this.windowEventHandlers = null;
20290
+ }
20169
20291
  };
20170
20292
  Stepper.prototype.updateResize = function () {
20171
20293
  if (this.stepperItemList && this.progressbar && this.element.classList.contains(HORIZSTEP$1)) {