@syncfusion/ej2-navigations 21.2.4 → 21.2.6

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.
@@ -6643,6 +6643,12 @@ let Accordion = class Accordion extends Component {
6643
6643
  const itemObj = items[parseInt(index.toString(), 10)];
6644
6644
  items.splice(index, 1);
6645
6645
  this.restoreContent(index);
6646
+ const header = select('.' + CLS_HEADERCTN, item);
6647
+ const content = select('.' + CLS_CTENT, item);
6648
+ if (this.isReact || this.isAngular) {
6649
+ this.clearAccordionTemplate(header, 'header', CLS_HEADERCTN);
6650
+ this.clearAccordionTemplate(content, 'content', CLS_CTENT);
6651
+ }
6646
6652
  detach(item);
6647
6653
  this.addItem(itemObj, index);
6648
6654
  }
@@ -6663,6 +6669,30 @@ let Accordion = class Accordion extends Component {
6663
6669
  });
6664
6670
  }
6665
6671
  }
6672
+ clearAccordionTemplate(templateEle, templateName, className) {
6673
+ if (this.registeredTemplate && this.registeredTemplate[`${templateName}`]) {
6674
+ const registeredTemplates = this.registeredTemplate;
6675
+ for (let index = 0; index < registeredTemplates[`${templateName}`].length; index++) {
6676
+ const registeredItem = registeredTemplates[`${templateName}`][parseInt(index.toString(), 10)].rootNodes[0];
6677
+ const closestItem = closest(registeredItem.containerInfo, '.' + className);
6678
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6679
+ this.clearTemplate([templateName], [registeredTemplates[`${templateName}`][parseInt(index.toString(), 10)]]);
6680
+ break;
6681
+ }
6682
+ }
6683
+ }
6684
+ else if (this.portals && this.portals.length > 0) {
6685
+ const portals = this.portals;
6686
+ for (let index = 0; index < portals.length; index++) {
6687
+ const portalItem = portals[parseInt(index.toString(), 10)];
6688
+ const closestItem = closest(portalItem.containerInfo, '.' + className);
6689
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6690
+ this.clearTemplate([templateName], index);
6691
+ break;
6692
+ }
6693
+ }
6694
+ }
6695
+ }
6666
6696
  getPersistData() {
6667
6697
  const keyEntity = ['expandedIndices'];
6668
6698
  return this.addOnPersist(keyEntity);
@@ -6685,44 +6715,50 @@ let Accordion = class Accordion extends Component {
6685
6715
  const changedProp = Object.keys(newProp.items);
6686
6716
  for (let j = 0; j < changedProp.length; j++) {
6687
6717
  const index = parseInt(Object.keys(newProp.items)[parseInt(j.toString(), 10)], 10);
6688
- const property = Object.keys(newProp.items[parseInt(index.toString(), 10)])[0];
6689
- const item = selectAll('.' + CLS_ITEM$1, this.element)[parseInt(index.toString(), 10)];
6690
- const oldVal = Object(oldProp.items[parseInt(index.toString(), 10)])[`${property}`];
6691
- const newVal = Object(newProp.items[parseInt(index.toString(), 10)])[`${property}`];
6692
- const temp = property;
6693
- if (temp === 'header' || temp === 'iconCss' || temp === 'expanded' || ((temp === 'content') && (oldVal === ''))) {
6694
- this.updateItem(item, index);
6695
- }
6696
- if (property === 'cssClass' && !isNullOrUndefined(item)) {
6697
- if (oldVal) {
6698
- removeClass([item], oldVal.split(' '));
6699
- }
6700
- if (newVal) {
6701
- addClass([item], newVal.split(' '));
6718
+ const property = Object.keys(newProp.items[parseInt(index.toString(), 10)]);
6719
+ for (let k = 0; k < property.length; k++) {
6720
+ const item = selectAll('.' + CLS_ITEM$1, this.element)[parseInt(index.toString(), 10)];
6721
+ const oldVal = Object(oldProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`];
6722
+ const newVal = Object(newProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`];
6723
+ const temp = property[parseInt(k.toString(), 10)];
6724
+ const content = select('.' + CLS_CTENT, item);
6725
+ if (temp === 'header' || temp === 'iconCss' || temp === 'expanded' || ((temp === 'content') && (oldVal === ''))) {
6726
+ this.updateItem(item, index);
6702
6727
  }
6703
- }
6704
- if (property === 'visible' && !isNullOrUndefined(item)) {
6705
- if (Object(newProp.items[parseInt(index.toString(), 10)])[`${property}`] === false) {
6706
- item.classList.add(CLS_ITEMHIDE);
6728
+ if (property[parseInt(k.toString(), 10)] === 'cssClass' && !isNullOrUndefined(item)) {
6729
+ if (oldVal) {
6730
+ removeClass([item], oldVal.split(' '));
6731
+ }
6732
+ if (newVal) {
6733
+ addClass([item], newVal.split(' '));
6734
+ }
6707
6735
  }
6708
- else {
6709
- item.classList.remove(CLS_ITEMHIDE);
6736
+ if (property[parseInt(k.toString(), 10)] === 'visible' && !isNullOrUndefined(item)) {
6737
+ if (Object(newProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`] === false) {
6738
+ item.classList.add(CLS_ITEMHIDE);
6739
+ }
6740
+ else {
6741
+ item.classList.remove(CLS_ITEMHIDE);
6742
+ }
6710
6743
  }
6711
- }
6712
- if (property === 'disabled' && !isNullOrUndefined(item)) {
6713
- this.enableItem(index, !newVal);
6714
- }
6715
- if (property === 'content' && !isNullOrUndefined(item) && item.children.length === 2) {
6716
- if (typeof newVal === 'function') {
6717
- const activeContent = item.querySelector('.' + CLS_CTENT);
6718
- activeContent.innerHTML = '';
6719
- this.setTemplate(newVal, activeContent, index);
6744
+ if (property[parseInt(k.toString(), 10)] === 'disabled' && !isNullOrUndefined(item)) {
6745
+ this.enableItem(index, !newVal);
6720
6746
  }
6721
- else {
6722
- if (item.classList.contains(CLS_SLCTED)) {
6723
- this.expandItem(false, index);
6747
+ if (property[parseInt(k.toString(), 10)] === 'content' && !isNullOrUndefined(item) && item.children.length === 2) {
6748
+ if (typeof newVal === 'function') {
6749
+ if (this.isAngular || this.isReact) {
6750
+ this.clearAccordionTemplate(content, property[parseInt(k.toString(), 10)], CLS_CTENT);
6751
+ }
6752
+ const activeContent = item.querySelector('.' + CLS_CTENT);
6753
+ activeContent.innerHTML = '';
6754
+ this.setTemplate(newVal, activeContent, index);
6755
+ }
6756
+ else {
6757
+ if (item.classList.contains(CLS_SLCTED)) {
6758
+ this.expandItem(false, index);
6759
+ }
6760
+ detach(item.querySelector('.' + CLS_CONTENT));
6724
6761
  }
6725
- detach(item.querySelector('.' + CLS_CONTENT));
6726
6762
  }
6727
6763
  }
6728
6764
  }
@@ -7529,15 +7565,6 @@ let Tab = class Tab extends Component {
7529
7565
  this.setContentHeight(true);
7530
7566
  this.select(this.selectedItem);
7531
7567
  }
7532
- this.tbItem = selectAll('.' + CLS_TB_ITEM, this.hdrEle);
7533
- if (!isNullOrUndefined(this.tbItem)) {
7534
- for (let i = 0; i < this.items.length; i++) {
7535
- if (this.tbItem[i]) {
7536
- const tabID = this.items[i].id;
7537
- this.tbItem[i].setAttribute('data-id', tabID);
7538
- }
7539
- }
7540
- }
7541
7568
  this.setRTL(this.enableRtl);
7542
7569
  }
7543
7570
  }
@@ -7714,7 +7741,7 @@ let Tab = class Tab extends Component {
7714
7741
  this.itemIndexArray.splice((index + i), 0, CLS_ITEM$2 + this.tabId + '_' + this.lastIndex);
7715
7742
  }
7716
7743
  const attrObj = {
7717
- id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex
7744
+ id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex, 'data-id': item.id
7718
7745
  };
7719
7746
  const tItem = { htmlAttributes: attrObj, template: wrap };
7720
7747
  tItem.cssClass = ((item.cssClass !== undefined) ? item.cssClass : ' ') + ' ' + disabled + ' ' + hidden + ' '
@@ -8790,6 +8817,10 @@ let Tab = class Tab extends Component {
8790
8817
  };
8791
8818
  this.trigger('onDragStart', dragArgs, (tabitemDragArgs) => {
8792
8819
  if (tabitemDragArgs.cancel) {
8820
+ const dragObj = e.element.ej2_instances[0];
8821
+ if (!isNullOrUndefined(dragObj)) {
8822
+ dragObj.intDestroy(e.event);
8823
+ }
8793
8824
  detach(this.cloneElement);
8794
8825
  }
8795
8826
  else {
@@ -12486,6 +12517,8 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12486
12517
  enableTailMode: true, enableAutoScroll: true,
12487
12518
  dragArea: this.dragArea,
12488
12519
  dragTarget: '.' + TEXTWRAP,
12520
+ enableTapHold: true,
12521
+ tapHoldThreshold: 100,
12489
12522
  helper: (e) => {
12490
12523
  this.dragTarget = e.sender.target;
12491
12524
  let dragRoot = closest(this.dragTarget, '.' + ROOT);
@@ -12915,7 +12948,10 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12915
12948
  dropUl.style.display = 'none';
12916
12949
  }
12917
12950
  if (isNullOrUndefined(dropUl)) {
12918
- this.trigger('nodeExpanding', this.getExpandEvent(dropLi, null));
12951
+ let args = this.expandArgs;
12952
+ if (isNullOrUndefined(args) || args.name != 'nodeExpanding') {
12953
+ this.trigger('nodeExpanding', this.getExpandEvent(dropLi, null));
12954
+ }
12919
12955
  if (isNullOrUndefined(dropIcon)) {
12920
12956
  ListBase.generateIcon(this.createElement, dropLi, COLLAPSIBLE, this.listBaseOption);
12921
12957
  }
@@ -13263,6 +13299,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13263
13299
  }
13264
13300
  refNode = dropUl.childNodes[index];
13265
13301
  if (!this.isFirstRender || this.dataType === 1) {
13302
+ let args = this.expandArgs;
13266
13303
  if (refNode || this.sortOrder === 'None') {
13267
13304
  for (let i = 0; i < li.length; i++) {
13268
13305
  dropUl.insertBefore(li[i], refNode);
@@ -13270,7 +13307,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13270
13307
  if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13271
13308
  this.preventExpand = false;
13272
13309
  let dropIcon = select('div.' + ICON, dropLi);
13273
- if (dropIcon && dropIcon.classList.contains(EXPANDABLE)) {
13310
+ if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name != 'nodeExpanding')) {
13274
13311
  this.expandAction(dropLi, dropIcon, null);
13275
13312
  }
13276
13313
  }
@@ -13283,7 +13320,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
13283
13320
  if (this.dataType === 1 && !isNullOrUndefined(dropLi) && !isNullOrUndefined(this.element.offsetParent) && !this.element.offsetParent.parentElement.classList.contains('e-filemanager')) {
13284
13321
  this.preventExpand = false;
13285
13322
  let dropIcon = select('div.' + ICON, dropLi);
13286
- if (dropIcon && dropIcon.classList.contains(EXPANDABLE)) {
13323
+ if (dropIcon && dropIcon.classList.contains(EXPANDABLE) && (isNullOrUndefined(args) || args.name != 'nodeExpanding')) {
13287
13324
  this.expandAction(dropLi, dropIcon, null);
13288
13325
  }
13289
13326
  }