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