@syncfusion/ej2-navigations 21.2.5 → 21.2.8

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.
@@ -3034,7 +3034,8 @@ let MenuBase = class MenuBase extends Component {
3034
3034
  index = navIdx.pop();
3035
3035
  ul = this.getUlByNavIdx(navIdx.length);
3036
3036
  if (ul) {
3037
- if (ishide) {
3037
+ let validUl = isUniqueId ? ul.children[index].id : ul.children[index].textContent;
3038
+ if (ishide && validUl === items[i]) {
3038
3039
  ul.children[index].classList.add(HIDE);
3039
3040
  }
3040
3041
  else {
@@ -6643,6 +6644,12 @@ let Accordion = class Accordion extends Component {
6643
6644
  const itemObj = items[parseInt(index.toString(), 10)];
6644
6645
  items.splice(index, 1);
6645
6646
  this.restoreContent(index);
6647
+ const header = select('.' + CLS_HEADERCTN, item);
6648
+ const content = select('.' + CLS_CTENT, item);
6649
+ if (this.isReact || this.isAngular) {
6650
+ this.clearAccordionTemplate(header, 'header', CLS_HEADERCTN);
6651
+ this.clearAccordionTemplate(content, 'content', CLS_CTENT);
6652
+ }
6646
6653
  detach(item);
6647
6654
  this.addItem(itemObj, index);
6648
6655
  }
@@ -6663,6 +6670,30 @@ let Accordion = class Accordion extends Component {
6663
6670
  });
6664
6671
  }
6665
6672
  }
6673
+ clearAccordionTemplate(templateEle, templateName, className) {
6674
+ if (this.registeredTemplate && this.registeredTemplate[`${templateName}`]) {
6675
+ const registeredTemplates = this.registeredTemplate;
6676
+ for (let index = 0; index < registeredTemplates[`${templateName}`].length; index++) {
6677
+ const registeredItem = registeredTemplates[`${templateName}`][parseInt(index.toString(), 10)].rootNodes[0];
6678
+ const closestItem = closest(registeredItem.containerInfo, '.' + className);
6679
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6680
+ this.clearTemplate([templateName], [registeredTemplates[`${templateName}`][parseInt(index.toString(), 10)]]);
6681
+ break;
6682
+ }
6683
+ }
6684
+ }
6685
+ else if (this.portals && this.portals.length > 0) {
6686
+ const portals = this.portals;
6687
+ for (let index = 0; index < portals.length; index++) {
6688
+ const portalItem = portals[parseInt(index.toString(), 10)];
6689
+ const closestItem = closest(portalItem.containerInfo, '.' + className);
6690
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6691
+ this.clearTemplate([templateName], index);
6692
+ break;
6693
+ }
6694
+ }
6695
+ }
6696
+ }
6666
6697
  getPersistData() {
6667
6698
  const keyEntity = ['expandedIndices'];
6668
6699
  return this.addOnPersist(keyEntity);
@@ -6685,44 +6716,50 @@ let Accordion = class Accordion extends Component {
6685
6716
  const changedProp = Object.keys(newProp.items);
6686
6717
  for (let j = 0; j < changedProp.length; j++) {
6687
6718
  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(' '));
6719
+ const property = Object.keys(newProp.items[parseInt(index.toString(), 10)]);
6720
+ for (let k = 0; k < property.length; k++) {
6721
+ const item = selectAll('.' + CLS_ITEM$1, this.element)[parseInt(index.toString(), 10)];
6722
+ const oldVal = Object(oldProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`];
6723
+ const newVal = Object(newProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`];
6724
+ const temp = property[parseInt(k.toString(), 10)];
6725
+ const content = select('.' + CLS_CTENT, item);
6726
+ if (temp === 'header' || temp === 'iconCss' || temp === 'expanded' || ((temp === 'content') && (oldVal === ''))) {
6727
+ this.updateItem(item, index);
6699
6728
  }
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);
6729
+ if (property[parseInt(k.toString(), 10)] === 'cssClass' && !isNullOrUndefined(item)) {
6730
+ if (oldVal) {
6731
+ removeClass([item], oldVal.split(' '));
6732
+ }
6733
+ if (newVal) {
6734
+ addClass([item], newVal.split(' '));
6735
+ }
6707
6736
  }
6708
- else {
6709
- item.classList.remove(CLS_ITEMHIDE);
6737
+ if (property[parseInt(k.toString(), 10)] === 'visible' && !isNullOrUndefined(item)) {
6738
+ if (Object(newProp.items[parseInt(index.toString(), 10)])[`${property[parseInt(k.toString(), 10)]}`] === false) {
6739
+ item.classList.add(CLS_ITEMHIDE);
6740
+ }
6741
+ else {
6742
+ item.classList.remove(CLS_ITEMHIDE);
6743
+ }
6710
6744
  }
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);
6745
+ if (property[parseInt(k.toString(), 10)] === 'disabled' && !isNullOrUndefined(item)) {
6746
+ this.enableItem(index, !newVal);
6720
6747
  }
6721
- else {
6722
- if (item.classList.contains(CLS_SLCTED)) {
6723
- this.expandItem(false, index);
6748
+ if (property[parseInt(k.toString(), 10)] === 'content' && !isNullOrUndefined(item) && item.children.length === 2) {
6749
+ if (typeof newVal === 'function') {
6750
+ if (this.isAngular || this.isReact) {
6751
+ this.clearAccordionTemplate(content, property[parseInt(k.toString(), 10)], CLS_CTENT);
6752
+ }
6753
+ const activeContent = item.querySelector('.' + CLS_CTENT);
6754
+ activeContent.innerHTML = '';
6755
+ this.setTemplate(newVal, activeContent, index);
6756
+ }
6757
+ else {
6758
+ if (item.classList.contains(CLS_SLCTED)) {
6759
+ this.expandItem(false, index);
6760
+ }
6761
+ detach(item.querySelector('.' + CLS_CONTENT));
6724
6762
  }
6725
- detach(item.querySelector('.' + CLS_CONTENT));
6726
6763
  }
6727
6764
  }
6728
6765
  }