@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.
@@ -6838,6 +6838,12 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
6838
6838
  var itemObj = items[parseInt(index.toString(), 10)];
6839
6839
  items.splice(index, 1);
6840
6840
  this.restoreContent(index);
6841
+ var header = select('.' + CLS_HEADERCTN, item);
6842
+ var content = select('.' + CLS_CTENT, item);
6843
+ if (this.isReact || this.isAngular) {
6844
+ this.clearAccordionTemplate(header, 'header', CLS_HEADERCTN);
6845
+ this.clearAccordionTemplate(content, 'content', CLS_CTENT);
6846
+ }
6841
6847
  detach(item);
6842
6848
  this.addItem(itemObj, index);
6843
6849
  }
@@ -6858,6 +6864,30 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
6858
6864
  });
6859
6865
  }
6860
6866
  };
6867
+ Accordion.prototype.clearAccordionTemplate = function (templateEle, templateName, className) {
6868
+ if (this.registeredTemplate && this.registeredTemplate["" + templateName]) {
6869
+ var registeredTemplates = this.registeredTemplate;
6870
+ for (var index = 0; index < registeredTemplates["" + templateName].length; index++) {
6871
+ var registeredItem = registeredTemplates["" + templateName][parseInt(index.toString(), 10)].rootNodes[0];
6872
+ var closestItem = closest(registeredItem.containerInfo, '.' + className);
6873
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6874
+ this.clearTemplate([templateName], [registeredTemplates["" + templateName][parseInt(index.toString(), 10)]]);
6875
+ break;
6876
+ }
6877
+ }
6878
+ }
6879
+ else if (this.portals && this.portals.length > 0) {
6880
+ var portals = this.portals;
6881
+ for (var index = 0; index < portals.length; index++) {
6882
+ var portalItem = portals[parseInt(index.toString(), 10)];
6883
+ var closestItem = closest(portalItem.containerInfo, '.' + className);
6884
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
6885
+ this.clearTemplate([templateName], index);
6886
+ break;
6887
+ }
6888
+ }
6889
+ }
6890
+ };
6861
6891
  Accordion.prototype.getPersistData = function () {
6862
6892
  var keyEntity = ['expandedIndices'];
6863
6893
  return this.addOnPersist(keyEntity);
@@ -6881,44 +6911,50 @@ var Accordion = /** @__PURE__ @class */ (function (_super) {
6881
6911
  var changedProp = Object.keys(newProp.items);
6882
6912
  for (var j = 0; j < changedProp.length; j++) {
6883
6913
  var index = parseInt(Object.keys(newProp.items)[parseInt(j.toString(), 10)], 10);
6884
- var property = Object.keys(newProp.items[parseInt(index.toString(), 10)])[0];
6885
- var item = selectAll('.' + CLS_ITEM$1, this.element)[parseInt(index.toString(), 10)];
6886
- var oldVal = Object(oldProp.items[parseInt(index.toString(), 10)])["" + property];
6887
- var newVal = Object(newProp.items[parseInt(index.toString(), 10)])["" + property];
6888
- var temp = property;
6889
- if (temp === 'header' || temp === 'iconCss' || temp === 'expanded' || ((temp === 'content') && (oldVal === ''))) {
6890
- this.updateItem(item, index);
6891
- }
6892
- if (property === 'cssClass' && !isNullOrUndefined(item)) {
6893
- if (oldVal) {
6894
- removeClass([item], oldVal.split(' '));
6914
+ var property = Object.keys(newProp.items[parseInt(index.toString(), 10)]);
6915
+ for (var k = 0; k < property.length; k++) {
6916
+ var item = selectAll('.' + CLS_ITEM$1, this.element)[parseInt(index.toString(), 10)];
6917
+ var oldVal = Object(oldProp.items[parseInt(index.toString(), 10)])["" + property[parseInt(k.toString(), 10)]];
6918
+ var newVal = Object(newProp.items[parseInt(index.toString(), 10)])["" + property[parseInt(k.toString(), 10)]];
6919
+ var temp = property[parseInt(k.toString(), 10)];
6920
+ var content = select('.' + CLS_CTENT, item);
6921
+ if (temp === 'header' || temp === 'iconCss' || temp === 'expanded' || ((temp === 'content') && (oldVal === ''))) {
6922
+ this.updateItem(item, index);
6895
6923
  }
6896
- if (newVal) {
6897
- addClass([item], newVal.split(' '));
6898
- }
6899
- }
6900
- if (property === 'visible' && !isNullOrUndefined(item)) {
6901
- if (Object(newProp.items[parseInt(index.toString(), 10)])["" + property] === false) {
6902
- item.classList.add(CLS_ITEMHIDE);
6924
+ if (property[parseInt(k.toString(), 10)] === 'cssClass' && !isNullOrUndefined(item)) {
6925
+ if (oldVal) {
6926
+ removeClass([item], oldVal.split(' '));
6927
+ }
6928
+ if (newVal) {
6929
+ addClass([item], newVal.split(' '));
6930
+ }
6903
6931
  }
6904
- else {
6905
- item.classList.remove(CLS_ITEMHIDE);
6932
+ if (property[parseInt(k.toString(), 10)] === 'visible' && !isNullOrUndefined(item)) {
6933
+ if (Object(newProp.items[parseInt(index.toString(), 10)])["" + property[parseInt(k.toString(), 10)]] === false) {
6934
+ item.classList.add(CLS_ITEMHIDE);
6935
+ }
6936
+ else {
6937
+ item.classList.remove(CLS_ITEMHIDE);
6938
+ }
6906
6939
  }
6907
- }
6908
- if (property === 'disabled' && !isNullOrUndefined(item)) {
6909
- this.enableItem(index, !newVal);
6910
- }
6911
- if (property === 'content' && !isNullOrUndefined(item) && item.children.length === 2) {
6912
- if (typeof newVal === 'function') {
6913
- var activeContent = item.querySelector('.' + CLS_CTENT);
6914
- activeContent.innerHTML = '';
6915
- this.setTemplate(newVal, activeContent, index);
6940
+ if (property[parseInt(k.toString(), 10)] === 'disabled' && !isNullOrUndefined(item)) {
6941
+ this.enableItem(index, !newVal);
6916
6942
  }
6917
- else {
6918
- if (item.classList.contains(CLS_SLCTED)) {
6919
- this.expandItem(false, index);
6943
+ if (property[parseInt(k.toString(), 10)] === 'content' && !isNullOrUndefined(item) && item.children.length === 2) {
6944
+ if (typeof newVal === 'function') {
6945
+ if (this.isAngular || this.isReact) {
6946
+ this.clearAccordionTemplate(content, property[parseInt(k.toString(), 10)], CLS_CTENT);
6947
+ }
6948
+ var activeContent = item.querySelector('.' + CLS_CTENT);
6949
+ activeContent.innerHTML = '';
6950
+ this.setTemplate(newVal, activeContent, index);
6951
+ }
6952
+ else {
6953
+ if (item.classList.contains(CLS_SLCTED)) {
6954
+ this.expandItem(false, index);
6955
+ }
6956
+ detach(item.querySelector('.' + CLS_CONTENT));
6920
6957
  }
6921
- detach(item.querySelector('.' + CLS_CONTENT));
6922
6958
  }
6923
6959
  }
6924
6960
  }