@syncfusion/ej2-navigations 21.2.3 → 21.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.
@@ -1810,9 +1810,29 @@ let MenuBase = class MenuBase extends Component {
1810
1810
  else {
1811
1811
  this.uList = this.element;
1812
1812
  this.uList.style.zIndex = getZindexPartial(target ? target : this.element).toString();
1813
- this.triggerBeforeOpen(li, this.uList, item, e, top, left, 'none');
1813
+ if (isNullOrUndefined(e)) {
1814
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1815
+ const ev = document.createEvent('MouseEvents');
1816
+ ev.initEvent("click", true, false);
1817
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1818
+ let targetEvent = this.copyObject(ev, {});
1819
+ targetEvent.target = targetEvent.srcElement = target;
1820
+ targetEvent.currentTarget = target;
1821
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1822
+ this.triggerBeforeOpen(li, this.uList, item, targetEvent, top, left, 'none');
1823
+ }
1824
+ else {
1825
+ this.triggerBeforeOpen(li, this.uList, item, e, top, left, 'none');
1826
+ }
1814
1827
  }
1815
1828
  }
1829
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1830
+ copyObject(source, destination) {
1831
+ for (const prop in source) {
1832
+ destination[`${prop}`] = source[`${prop}`];
1833
+ }
1834
+ return destination;
1835
+ }
1816
1836
  calculateIndentSize(ul, li) {
1817
1837
  const liStyle = getComputedStyle(li);
1818
1838
  let liIndent = parseInt(liStyle.textIndent, 10);
@@ -2953,7 +2973,7 @@ let MenuBase = class MenuBase extends Component {
2953
2973
  }
2954
2974
  idx = navIdx.pop();
2955
2975
  ul = this.getUlByNavIdx(navIdx.length);
2956
- if (ul) {
2976
+ if (ul && !isNullOrUndefined(idx)) {
2957
2977
  if (enable) {
2958
2978
  if (this.isMenu) {
2959
2979
  ul.children[idx].classList.remove(disabled);
@@ -7509,15 +7529,6 @@ let Tab = class Tab extends Component {
7509
7529
  this.setContentHeight(true);
7510
7530
  this.select(this.selectedItem);
7511
7531
  }
7512
- this.tbItem = selectAll('.' + CLS_TB_ITEM, this.hdrEle);
7513
- if (!isNullOrUndefined(this.tbItem)) {
7514
- for (let i = 0; i < this.items.length; i++) {
7515
- if (this.tbItem[i]) {
7516
- const tabID = this.items[i].id;
7517
- this.tbItem[i].setAttribute('data-id', tabID);
7518
- }
7519
- }
7520
- }
7521
7532
  this.setRTL(this.enableRtl);
7522
7533
  }
7523
7534
  }
@@ -7536,12 +7547,9 @@ let Tab = class Tab extends Component {
7536
7547
  const count = this.hdrEle.children.length;
7537
7548
  const hdrItems = [];
7538
7549
  for (let i = 0; i < count; i++) {
7539
- hdrItems.push(this.hdrEle.children.item(i).innerHTML);
7550
+ hdrItems.push(this.hdrEle.children.item(i));
7540
7551
  }
7541
7552
  if (count > 0) {
7542
- while (this.hdrEle.firstElementChild) {
7543
- detach(this.hdrEle.firstElementChild);
7544
- }
7545
7553
  const tabItems = this.createElement('div', { className: CLS_ITEMS$1 });
7546
7554
  this.hdrEle.appendChild(tabItems);
7547
7555
  hdrItems.forEach((item, index) => {
@@ -7550,7 +7558,7 @@ let Tab = class Tab extends Component {
7550
7558
  className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index
7551
7559
  };
7552
7560
  const txt = this.createElement('span', {
7553
- className: CLS_TEXT, innerHTML: item, attrs: { 'role': 'presentation' }
7561
+ className: CLS_TEXT, attrs: { 'role': 'presentation' }
7554
7562
  }).outerHTML;
7555
7563
  const cont = this.createElement('div', {
7556
7564
  className: CLS_TEXT_WRAP, innerHTML: txt + this.btnCls.outerHTML
@@ -7559,6 +7567,7 @@ let Tab = class Tab extends Component {
7559
7567
  className: CLS_WRAP, innerHTML: cont,
7560
7568
  attrs: { role: 'tab', tabIndex: '-1', 'aria-selected': 'false', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-disabled': 'false' }
7561
7569
  });
7570
+ wrap.querySelector('.' + CLS_TEXT).appendChild(item);
7562
7571
  tabItems.appendChild(this.createElement('div', attr));
7563
7572
  selectAll('.' + CLS_ITEM$2, tabItems)[index].appendChild(wrap);
7564
7573
  });
@@ -7696,7 +7705,7 @@ let Tab = class Tab extends Component {
7696
7705
  this.itemIndexArray.splice((index + i), 0, CLS_ITEM$2 + this.tabId + '_' + this.lastIndex);
7697
7706
  }
7698
7707
  const attrObj = {
7699
- id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex
7708
+ id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex, 'data-id': item.id
7700
7709
  };
7701
7710
  const tItem = { htmlAttributes: attrObj, template: wrap };
7702
7711
  tItem.cssClass = ((item.cssClass !== undefined) ? item.cssClass : ' ') + ' ' + disabled + ' ' + hidden + ' '
@@ -8772,6 +8781,10 @@ let Tab = class Tab extends Component {
8772
8781
  };
8773
8782
  this.trigger('onDragStart', dragArgs, (tabitemDragArgs) => {
8774
8783
  if (tabitemDragArgs.cancel) {
8784
+ const dragObj = e.element.ej2_instances[0];
8785
+ if (!isNullOrUndefined(dragObj)) {
8786
+ dragObj.intDestroy(e.event);
8787
+ }
8775
8788
  detach(this.cloneElement);
8776
8789
  }
8777
8790
  else {
@@ -12468,6 +12481,8 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12468
12481
  enableTailMode: true, enableAutoScroll: true,
12469
12482
  dragArea: this.dragArea,
12470
12483
  dragTarget: '.' + TEXTWRAP,
12484
+ enableTapHold: true,
12485
+ tapHoldThreshold: 100,
12471
12486
  helper: (e) => {
12472
12487
  this.dragTarget = e.sender.target;
12473
12488
  let dragRoot = closest(this.dragTarget, '.' + ROOT);
@@ -12897,7 +12912,10 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12897
12912
  dropUl.style.display = 'none';
12898
12913
  }
12899
12914
  if (isNullOrUndefined(dropUl)) {
12900
- this.trigger('nodeExpanding', this.getExpandEvent(dropLi, null));
12915
+ let args = this.expandArgs;
12916
+ if (isNullOrUndefined(args) || args.name != 'nodeExpanding') {
12917
+ this.trigger('nodeExpanding', this.getExpandEvent(dropLi, null));
12918
+ }
12901
12919
  if (isNullOrUndefined(dropIcon)) {
12902
12920
  ListBase.generateIcon(this.createElement, dropLi, COLLAPSIBLE, this.listBaseOption);
12903
12921
  }
@@ -13245,6 +13263,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13245
13263
  }
13246
13264
  refNode = dropUl.childNodes[index];
13247
13265
  if (!this.isFirstRender || this.dataType === 1) {
13266
+ let args = this.expandArgs;
13248
13267
  if (refNode || this.sortOrder === 'None') {
13249
13268
  for (let i = 0; i < li.length; i++) {
13250
13269
  dropUl.insertBefore(li[i], refNode);
@@ -13252,7 +13271,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13252
13271
  if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13253
13272
  this.preventExpand = false;
13254
13273
  let dropIcon = select('div.' + ICON, dropLi);
13255
- if (dropIcon && dropIcon.classList.contains(EXPANDABLE)) {
13274
+ if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name != 'nodeExpanding')) {
13256
13275
  this.expandAction(dropLi, dropIcon, null);
13257
13276
  }
13258
13277
  }
@@ -13265,7 +13284,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13265
13284
  if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13266
13285
  this.preventExpand = false;
13267
13286
  let dropIcon = select('div.' + ICON, dropLi);
13268
- if (dropIcon && dropIcon.classList.contains(EXPANDABLE)) {
13287
+ if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name != 'nodeExpanding')) {
13269
13288
  this.expandAction(dropLi, dropIcon, null);
13270
13289
  }
13271
13290
  }