@syncfusion/ej2-navigations 21.2.3 → 21.2.4

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);
@@ -7536,12 +7556,9 @@ let Tab = class Tab extends Component {
7536
7556
  const count = this.hdrEle.children.length;
7537
7557
  const hdrItems = [];
7538
7558
  for (let i = 0; i < count; i++) {
7539
- hdrItems.push(this.hdrEle.children.item(i).innerHTML);
7559
+ hdrItems.push(this.hdrEle.children.item(i));
7540
7560
  }
7541
7561
  if (count > 0) {
7542
- while (this.hdrEle.firstElementChild) {
7543
- detach(this.hdrEle.firstElementChild);
7544
- }
7545
7562
  const tabItems = this.createElement('div', { className: CLS_ITEMS$1 });
7546
7563
  this.hdrEle.appendChild(tabItems);
7547
7564
  hdrItems.forEach((item, index) => {
@@ -7550,7 +7567,7 @@ let Tab = class Tab extends Component {
7550
7567
  className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index
7551
7568
  };
7552
7569
  const txt = this.createElement('span', {
7553
- className: CLS_TEXT, innerHTML: item, attrs: { 'role': 'presentation' }
7570
+ className: CLS_TEXT, attrs: { 'role': 'presentation' }
7554
7571
  }).outerHTML;
7555
7572
  const cont = this.createElement('div', {
7556
7573
  className: CLS_TEXT_WRAP, innerHTML: txt + this.btnCls.outerHTML
@@ -7559,6 +7576,7 @@ let Tab = class Tab extends Component {
7559
7576
  className: CLS_WRAP, innerHTML: cont,
7560
7577
  attrs: { role: 'tab', tabIndex: '-1', 'aria-selected': 'false', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-disabled': 'false' }
7561
7578
  });
7579
+ wrap.querySelector('.' + CLS_TEXT).appendChild(item);
7562
7580
  tabItems.appendChild(this.createElement('div', attr));
7563
7581
  selectAll('.' + CLS_ITEM$2, tabItems)[index].appendChild(wrap);
7564
7582
  });