@syncfusion/ej2-navigations 33.1.46 → 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.
@@ -140,8 +140,22 @@ let HScroll = class HScroll extends Component {
140
140
  ele.classList.remove(CLS_RTL);
141
141
  const nav = selectAll('.e-' + ele.id + '_nav.' + CLS_HSCROLLNAV, ele);
142
142
  const overlay = selectAll('.' + CLS_OVERLAY, ele);
143
- [].slice.call(overlay).forEach((ele) => {
144
- detach(ele);
143
+ [].slice.call(overlay).forEach((oElem) => {
144
+ if (this.onKeyPressBound) {
145
+ oElem.removeEventListener('keydown', this.onKeyPressBound);
146
+ }
147
+ if (this.onKeyUpBound) {
148
+ oElem.removeEventListener('keyup', this.onKeyUpBound);
149
+ }
150
+ if (this.repeatScrollBound) {
151
+ oElem.removeEventListener('mouseup', this.repeatScrollBound);
152
+ oElem.removeEventListener('touchend', this.repeatScrollBound);
153
+ }
154
+ if (this.contextMenuBound) {
155
+ oElem.removeEventListener('contextmenu', this.contextMenuBound);
156
+ }
157
+ EventHandler.remove(oElem, 'click', this.clickEventHandler);
158
+ detach(oElem);
145
159
  });
146
160
  for (const elem of [].slice.call(this.scrollItems.children)) {
147
161
  ele.appendChild(elem);
@@ -151,14 +165,37 @@ let HScroll = class HScroll extends Component {
151
165
  }
152
166
  detach(this.scrollEle);
153
167
  if (nav.length > 0) {
154
- detach(nav[0]);
155
- if (!isNullOrUndefined(nav[1])) {
156
- detach(nav[1]);
157
- }
168
+ [].slice.call(nav).forEach((nElem) => {
169
+ if (this.onKeyPressBound) {
170
+ nElem.removeEventListener('keydown', this.onKeyPressBound);
171
+ }
172
+ if (this.onKeyUpBound) {
173
+ nElem.removeEventListener('keyup', this.onKeyUpBound);
174
+ }
175
+ if (this.repeatScrollBound) {
176
+ nElem.removeEventListener('mouseup', this.repeatScrollBound);
177
+ nElem.removeEventListener('touchend', this.repeatScrollBound);
178
+ }
179
+ if (this.contextMenuBound) {
180
+ nElem.removeEventListener('contextmenu', this.contextMenuBound);
181
+ }
182
+ EventHandler.remove(nElem, 'click', this.clickEventHandler);
183
+ detach(nElem);
184
+ });
158
185
  }
159
186
  EventHandler.remove(this.scrollEle, 'scroll', this.scrollHandler);
160
187
  this.touchModule.destroy();
161
188
  this.touchModule = null;
189
+ if (this.navTouchCollection) {
190
+ this.navTouchCollection.forEach((t) => { if (t && typeof t.destroy === 'function') {
191
+ t.destroy();
192
+ } });
193
+ this.navTouchCollection = null;
194
+ }
195
+ this.onKeyPressBound = null;
196
+ this.onKeyUpBound = null;
197
+ this.repeatScrollBound = null;
198
+ this.contextMenuBound = null;
162
199
  super.destroy();
163
200
  }
164
201
  /**
@@ -243,17 +280,34 @@ let HScroll = class HScroll extends Component {
243
280
  }
244
281
  eventBinding(ele) {
245
282
  [].slice.call(ele).forEach((el) => {
246
- new Touch(el, { tapHold: this.tabHoldHandler.bind(this), tapHoldThreshold: 500 });
247
- el.addEventListener('keydown', this.onKeyPress.bind(this));
248
- el.addEventListener('keyup', this.onKeyUp.bind(this));
249
- el.addEventListener('mouseup', this.repeatScroll.bind(this));
250
- el.addEventListener('touchend', this.repeatScroll.bind(this));
251
- el.addEventListener('contextmenu', (e) => {
252
- e.preventDefault();
253
- });
283
+ const navTouch = new Touch(el, { tapHold: this.tabHoldHandler.bind(this), tapHoldThreshold: 500 });
284
+ if (!this.navTouchCollection) {
285
+ this.navTouchCollection = [];
286
+ }
287
+ this.navTouchCollection.push(navTouch);
288
+ if (!this.onKeyPressBound) {
289
+ this.onKeyPressBound = this.onKeyPress.bind(this);
290
+ }
291
+ if (!this.onKeyUpBound) {
292
+ this.onKeyUpBound = this.onKeyUp.bind(this);
293
+ }
294
+ if (!this.repeatScrollBound) {
295
+ this.repeatScrollBound = this.repeatScroll.bind(this);
296
+ }
297
+ if (!this.contextMenuBound) {
298
+ this.contextMenuBound = this.contextMenuHandler.bind(this);
299
+ }
300
+ el.addEventListener('keydown', this.onKeyPressBound);
301
+ el.addEventListener('keyup', this.onKeyUpBound);
302
+ el.addEventListener('mouseup', this.repeatScrollBound);
303
+ el.addEventListener('touchend', this.repeatScrollBound);
304
+ el.addEventListener('contextmenu', this.contextMenuBound);
254
305
  EventHandler.add(el, 'click', this.clickEventHandler, this);
255
306
  });
256
307
  }
308
+ contextMenuHandler(e) {
309
+ e.preventDefault();
310
+ }
257
311
  repeatScroll() {
258
312
  clearInterval(this.timeout);
259
313
  }
@@ -1329,11 +1383,13 @@ let MenuBase = class MenuBase extends Component {
1329
1383
  if (!Browser.isDevice) {
1330
1384
  this.delegateMoverHandler = this.moverHandler.bind(this);
1331
1385
  this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
1386
+ this.delegateDomKeyHandler = this.domKeyHandler.bind(this);
1332
1387
  EventHandler.add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
1333
1388
  EventHandler.add(document, 'mousedown', this.delegateMouseDownHandler, this);
1334
- EventHandler.add(document, 'keydown', this.domKeyHandler, this);
1389
+ EventHandler.add(document, 'keydown', this.delegateDomKeyHandler, this);
1335
1390
  if (!this.isMenu && !this.target) {
1336
- EventHandler.add(document, 'scroll', this.scrollHandler, this);
1391
+ this.delegateScrollHandler = this.scrollHandler.bind(this);
1392
+ EventHandler.add(document, 'scroll', this.delegateScrollHandler, this);
1337
1393
  }
1338
1394
  }
1339
1395
  this.delegateClickHandler = this.clickHandler.bind(this);
@@ -1342,7 +1398,8 @@ let MenuBase = class MenuBase extends Component {
1342
1398
  this.rippleFn = rippleEffect(wrapper, { selector: '.' + ITEM });
1343
1399
  if (!this.isMenu && this.enableScrolling) {
1344
1400
  this.enableTouchScroll(wrapper);
1345
- document.addEventListener('touchstart', this.touchOutsideHandler.bind(this), { passive: true });
1401
+ this.delegateTouchOutsideHandler = this.touchOutsideHandler.bind(this);
1402
+ document.addEventListener('touchstart', this.delegateTouchOutsideHandler, { passive: true });
1346
1403
  }
1347
1404
  }
1348
1405
  wireKeyboardEvent(element) {
@@ -3035,20 +3092,38 @@ let MenuBase = class MenuBase extends Component {
3035
3092
  }
3036
3093
  }
3037
3094
  if (!Browser.isDevice) {
3038
- EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
3039
- EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
3040
- EventHandler.remove(document, 'keydown', this.domKeyHandler);
3095
+ if (this.delegateMoverHandler) {
3096
+ EventHandler.remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
3097
+ this.delegateMoverHandler = null;
3098
+ }
3099
+ if (this.delegateMouseDownHandler) {
3100
+ EventHandler.remove(document, 'mousedown', this.delegateMouseDownHandler);
3101
+ this.delegateMouseDownHandler = null;
3102
+ }
3103
+ if (this.delegateDomKeyHandler) {
3104
+ EventHandler.remove(document, 'keydown', this.delegateDomKeyHandler);
3105
+ this.delegateDomKeyHandler = null;
3106
+ }
3041
3107
  if (!this.isMenu && !this.target) {
3042
- EventHandler.remove(document, 'scroll', this.scrollHandler);
3108
+ if (this.delegateScrollHandler) {
3109
+ EventHandler.remove(document, 'scroll', this.delegateScrollHandler);
3110
+ this.delegateScrollHandler = null;
3111
+ }
3043
3112
  }
3044
3113
  }
3045
- EventHandler.remove(document, 'click', this.delegateClickHandler);
3114
+ if (this.delegateClickHandler) {
3115
+ EventHandler.remove(document, 'click', this.delegateClickHandler);
3116
+ this.delegateClickHandler = null;
3117
+ }
3046
3118
  this.unWireKeyboardEvent(wrapper);
3047
3119
  this.rippleFn();
3048
3120
  if (!this.isMenu && this.enableScrolling) {
3049
3121
  wrapper.removeEventListener('touchstart', this.touchStartFn);
3050
3122
  wrapper.removeEventListener('touchmove', this.touchMoveFn);
3051
- document.removeEventListener('touchstart', this.touchOutsideHandler);
3123
+ if (this.delegateTouchOutsideHandler) {
3124
+ document.removeEventListener('touchstart', this.delegateTouchOutsideHandler);
3125
+ this.delegateTouchOutsideHandler = null;
3126
+ }
3052
3127
  }
3053
3128
  }
3054
3129
  unWireKeyboardEvent(element) {
@@ -3885,13 +3960,17 @@ let Toolbar = class Toolbar extends Component {
3885
3960
  }
3886
3961
  destroyItems() {
3887
3962
  if (this.element) {
3888
- [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach((el) => { detach(el); });
3963
+ [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM)).forEach((el) => {
3964
+ EventHandler.remove(el, 'click', this.itemClick);
3965
+ detach(el);
3966
+ });
3889
3967
  }
3890
3968
  if (this.tbarAlign) {
3891
3969
  const tbarItems = this.element.querySelector('.' + CLS_ITEMS);
3892
3970
  if (tbarItems) {
3893
3971
  if (tbarItems.children) {
3894
3972
  [].slice.call(tbarItems.children).forEach((el) => {
3973
+ EventHandler.remove(el, 'click', this.itemClick);
3895
3974
  detach(el);
3896
3975
  });
3897
3976
  }
@@ -5619,7 +5698,7 @@ let Toolbar = class Toolbar extends Component {
5619
5698
  dom.setAttribute('aria-label', (item.text || item.tooltipText));
5620
5699
  dom.setAttribute('aria-disabled', 'false');
5621
5700
  innerEle.appendChild(dom);
5622
- innerEle.addEventListener('click', this.itemClick.bind(this));
5701
+ EventHandler.add(innerEle, 'click', this.itemClick, this);
5623
5702
  break;
5624
5703
  case 'Separator':
5625
5704
  this.add(innerEle, CLS_SEPARATOR);
@@ -6249,6 +6328,10 @@ let Accordion = class Accordion extends Component {
6249
6328
  if (!isNullOrUndefined(this.keyModule)) {
6250
6329
  this.keyModule.destroy();
6251
6330
  }
6331
+ const headerEles = [].slice.call(this.element.querySelectorAll('.' + CLS_HEADER));
6332
+ for (const hdr of headerEles) {
6333
+ EventHandler.clearEvents(hdr);
6334
+ }
6252
6335
  }
6253
6336
  wireEvents() {
6254
6337
  EventHandler.add(this.element, 'click', this.clickHandler, this);
@@ -7160,6 +7243,10 @@ let Accordion = class Accordion extends Component {
7160
7243
  this.clearTemplate();
7161
7244
  }
7162
7245
  [].slice.call(this.element.querySelectorAll('.' + CLS_ITEM$1)).forEach((el) => {
7246
+ const hdr = select('.' + CLS_HEADER, el);
7247
+ if (hdr) {
7248
+ EventHandler.clearEvents(hdr);
7249
+ }
7163
7250
  detach(el);
7164
7251
  });
7165
7252
  }
@@ -15002,6 +15089,18 @@ let TreeView = TreeView_1 = class TreeView extends Component {
15002
15089
  this.wireExpandOnEvent(false);
15003
15090
  EventHandler.remove(this.element, 'mouseover', this.onMouseOver);
15004
15091
  EventHandler.remove(this.element, 'mouseout', this.onMouseLeave);
15092
+ const liElements = selectAll('.' + LISTITEM, this.element);
15093
+ for (let i = 0; i < liElements.length; i++) {
15094
+ const li = liElements[parseInt(i.toString(), 10)];
15095
+ EventHandler.remove(li, 'focus', this.focusIn);
15096
+ EventHandler.remove(li, 'blur', this.focusOut);
15097
+ const frame = select('.' + CHECKBOXFRAME, li);
15098
+ if (frame) {
15099
+ EventHandler.remove(frame, 'mousedown', this.frameMouseHandler);
15100
+ EventHandler.remove(frame, 'mouseup', this.frameMouseHandler);
15101
+ EventHandler.remove(frame, 'mouseleave', this.frameMouseHandler);
15102
+ }
15103
+ }
15005
15104
  if (!this.disabled) {
15006
15105
  this.keyboardModule.destroy();
15007
15106
  }
@@ -16203,6 +16302,7 @@ let Sidebar = class Sidebar extends Component {
16203
16302
  constructor(options, element) {
16204
16303
  super(options, element);
16205
16304
  this.documentClickContext = this.documentclickHandler.bind(this);
16305
+ this.resizeHandler = this.resize.bind(this);
16206
16306
  }
16207
16307
  preRender() {
16208
16308
  this.setWidth();
@@ -16605,11 +16705,12 @@ let Sidebar = class Sidebar extends Component {
16605
16705
  }
16606
16706
  wireEvents() {
16607
16707
  this.setEnableGestures();
16608
- EventHandler.add(window, 'resize', this.resize, this);
16708
+ EventHandler.add(window, 'resize', this.resizeHandler);
16609
16709
  }
16610
16710
  unWireEvents() {
16611
- EventHandler.remove(window, 'resize', this.resize);
16711
+ EventHandler.remove(window, 'resize', this.resizeHandler);
16612
16712
  EventHandler.remove(document, 'mousedown touchstart', this.documentclickHandler);
16713
+ EventHandler.remove(this.element, 'transitionend', this.transitionEnd);
16613
16714
  if (this.mainContentEle) {
16614
16715
  this.mainContentEle.destroy();
16615
16716
  }
@@ -17479,7 +17580,7 @@ let Breadcrumb = class Breadcrumb extends Component {
17479
17580
  detach(this.popupObj.element);
17480
17581
  }
17481
17582
  }
17482
- resize() {
17583
+ resize(e) {
17483
17584
  this._maxItems = this.maxItems;
17484
17585
  this.initPvtProps();
17485
17586
  this.reRenderItems();
@@ -17569,7 +17670,8 @@ let Breadcrumb = class Breadcrumb extends Component {
17569
17670
  this.delegateClickHanlder = this.documentClickHandler.bind(this);
17570
17671
  EventHandler.add(document, 'click', this.delegateClickHanlder, this);
17571
17672
  EventHandler.add(this.element, 'click', this.clickHandler, this);
17572
- window.addEventListener('resize', this.resize.bind(this));
17673
+ this.resizeHandler = this.resize.bind(this);
17674
+ window.addEventListener('resize', this.resizeHandler);
17573
17675
  }
17574
17676
  popupWireEvents() {
17575
17677
  EventHandler.add(this.popupObj.element, 'click', this.clickHandler, this);
@@ -17578,7 +17680,8 @@ let Breadcrumb = class Breadcrumb extends Component {
17578
17680
  unWireEvents() {
17579
17681
  EventHandler.remove(document, 'click', this.delegateClickHanlder);
17580
17682
  EventHandler.remove(this.element, 'click', this.clickHandler);
17581
- window.removeEventListener('resize', this.resize.bind(this));
17683
+ window.removeEventListener('resize', this.resizeHandler);
17684
+ this.resizeHandler = null;
17582
17685
  if (this.popupObj) {
17583
17686
  EventHandler.remove(this.popupObj.element, 'click', this.clickHandler);
17584
17687
  EventHandler.remove(this.popupObj.element, 'keydown', this.popupKeyDownHandler);
@@ -19643,12 +19746,20 @@ let Stepper = class Stepper extends StepperBase {
19643
19746
  }
19644
19747
  }
19645
19748
  wireEvents() {
19646
- EventHandler.add(window, 'resize', this.updateResize, this);
19647
- EventHandler.add(window, 'click', this.updateStepFocus, this);
19749
+ this.windowEventHandlers = {};
19750
+ this.windowEventHandlers.resize = this.updateResize.bind(this);
19751
+ this.windowEventHandlers.click = this.updateStepFocus.bind(this);
19752
+ EventHandler.add(window, 'resize', this.windowEventHandlers.resize);
19753
+ EventHandler.add(window, 'click', this.windowEventHandlers.click);
19648
19754
  }
19649
19755
  unWireEvents() {
19650
- EventHandler.remove(window, 'resize', this.updateResize);
19651
- EventHandler.remove(window, 'click', this.updateStepFocus);
19756
+ EventHandler.remove(window, 'resize', this.windowEventHandlers && this.windowEventHandlers.resize);
19757
+ EventHandler.remove(window, 'click', this.windowEventHandlers && this.windowEventHandlers.click);
19758
+ if (this.windowEventHandlers) {
19759
+ this.windowEventHandlers.resize = null;
19760
+ this.windowEventHandlers.click = null;
19761
+ this.windowEventHandlers = null;
19762
+ }
19652
19763
  }
19653
19764
  updateResize() {
19654
19765
  if (this.stepperItemList && this.progressbar && this.element.classList.contains(HORIZSTEP$1)) {