@syncfusion/ej2-navigations 21.2.5 → 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(' '));
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);
6699
6727
  }
6700
- if (newVal) {
6701
- addClass([item], newVal.split(' '));
6702
- }
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
  }