@syncfusion/ej2-navigations 22.2.7 → 22.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.
@@ -5038,7 +5038,7 @@ let Toolbar = class Toolbar extends Component {
5038
5038
  this.tbarAlgEle[(this.items[parseInt(eleIdx.toString(), 10)].align + 's').toLowerCase()].splice(parseInt(indexAgn.toString(), 10), 1);
5039
5039
  }
5040
5040
  if (this.isReact) {
5041
- this.clearTemplate();
5041
+ this.clearToolbarTemplate(innerItems[parseInt(index.toString(), 10)]);
5042
5042
  }
5043
5043
  const btnItem = innerItems[parseInt(index.toString(), 10)].querySelector('.e-control.e-btn');
5044
5044
  if (!isNullOrUndefined(btnItem) && !isNullOrUndefined(btnItem.ej2_instances[0]) && !(btnItem.ej2_instances[0].isDestroyed)) {
@@ -5350,6 +5350,30 @@ let Toolbar = class Toolbar extends Component {
5350
5350
  nextEle = innerItems[++eleIndex];
5351
5351
  }
5352
5352
  }
5353
+ clearToolbarTemplate(templateEle) {
5354
+ if (this.registeredTemplate && this.registeredTemplate[`${'template'}`]) {
5355
+ const registeredTemplates = this.registeredTemplate;
5356
+ for (let index = 0; index < registeredTemplates[`${'template'}`].length; index++) {
5357
+ const registeredItem = registeredTemplates[`${'template'}`][parseInt(index.toString(), 10)].rootNodes[0];
5358
+ const closestItem = closest(registeredItem, '.' + CLS_ITEM);
5359
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
5360
+ this.clearTemplate(['template'], [registeredTemplates[`${'template'}`][parseInt(index.toString(), 10)]]);
5361
+ break;
5362
+ }
5363
+ }
5364
+ }
5365
+ else if (this.portals && this.portals.length > 0) {
5366
+ const portals = this.portals;
5367
+ for (let index = 0; index < portals.length; index++) {
5368
+ const portalItem = portals[parseInt(index.toString(), 10)];
5369
+ const closestItem = closest(portalItem.containerInfo, '.' + CLS_ITEM);
5370
+ if (!isNullOrUndefined(closestItem) && closestItem === templateEle) {
5371
+ this.clearTemplate(['template'], index);
5372
+ break;
5373
+ }
5374
+ }
5375
+ }
5376
+ }
5353
5377
  /**
5354
5378
  * Gets called when the model property changes.The data that describes the old and new values of the property that changed.
5355
5379
  *
@@ -5371,31 +5395,29 @@ let Toolbar = class Toolbar extends Component {
5371
5395
  const index = parseInt(Object.keys(newProp.items)[parseInt(i.toString(), 10)], 10);
5372
5396
  const property = Object.keys(newProp.items[parseInt(index.toString(), 10)])[0];
5373
5397
  const newProperty = Object(newProp.items[parseInt(index.toString(), 10)])[`${property}`];
5374
- if (typeof newProperty !== 'function') {
5375
- if (this.tbarAlign || property === 'align') {
5376
- this.refresh();
5377
- this.trigger('created');
5378
- break;
5379
- }
5380
- const popupPriCheck = property === 'showAlwaysInPopup' && !newProperty;
5381
- const booleanCheck = property === 'overflow' && this.popupPriCount !== 0;
5382
- if ((popupPriCheck) || (this.items[parseInt(index.toString(), 10)].showAlwaysInPopup) && booleanCheck) {
5383
- --this.popupPriCount;
5384
- }
5385
- if (isNullOrUndefined(this.scrollModule)) {
5386
- this.destroyMode();
5387
- }
5388
- const itemCol = [].slice.call(selectAll('.' + CLS_ITEMS + ' .' + CLS_ITEM, tEle));
5389
- if (this.isReact && this.items[parseInt(index.toString(), 10)].template) {
5390
- this.clearTemplate();
5391
- }
5392
- detach(itemCol[parseInt(index.toString(), 10)]);
5393
- this.tbarEle.splice(index, 1);
5394
- this.addItems([this.items[parseInt(index.toString(), 10)]], index);
5395
- this.items.splice(index, 1);
5396
- if (this.items[parseInt(index.toString(), 10)].template) {
5397
- this.tbarEle.splice(this.items.length, 1);
5398
- }
5398
+ if (this.tbarAlign || property === 'align') {
5399
+ this.refresh();
5400
+ this.trigger('created');
5401
+ break;
5402
+ }
5403
+ const popupPriCheck = property === 'showAlwaysInPopup' && !newProperty;
5404
+ const booleanCheck = property === 'overflow' && this.popupPriCount !== 0;
5405
+ if ((popupPriCheck) || (this.items[parseInt(index.toString(), 10)].showAlwaysInPopup) && booleanCheck) {
5406
+ --this.popupPriCount;
5407
+ }
5408
+ if (isNullOrUndefined(this.scrollModule)) {
5409
+ this.destroyMode();
5410
+ }
5411
+ const itemCol = [].slice.call(selectAll('.' + CLS_ITEMS + ' .' + CLS_ITEM, tEle));
5412
+ if (this.isReact && this.items[parseInt(index.toString(), 10)].template) {
5413
+ this.clearToolbarTemplate(itemCol[parseInt(index.toString(), 10)]);
5414
+ }
5415
+ detach(itemCol[parseInt(index.toString(), 10)]);
5416
+ this.tbarEle.splice(index, 1);
5417
+ this.addItems([this.items[parseInt(index.toString(), 10)]], index);
5418
+ this.items.splice(index, 1);
5419
+ if (this.items[parseInt(index.toString(), 10)].template) {
5420
+ this.tbarEle.splice(this.items.length, 1);
5399
5421
  }
5400
5422
  }
5401
5423
  }
@@ -8734,6 +8756,9 @@ let Tab = class Tab extends Component {
8734
8756
  }
8735
8757
  }
8736
8758
  clearTabTemplate(templateEle, templateName, className) {
8759
+ if (!this.clearTemplates) {
8760
+ return;
8761
+ }
8737
8762
  if (this.registeredTemplate && this.registeredTemplate[templateName]) {
8738
8763
  const registeredTemplates = this.registeredTemplate;
8739
8764
  for (let index = 0; index < registeredTemplates[templateName].length; index++) {
@@ -9626,6 +9651,9 @@ __decorate$7([
9626
9651
  __decorate$7([
9627
9652
  Property(false)
9628
9653
  ], Tab.prototype, "allowDragAndDrop", void 0);
9654
+ __decorate$7([
9655
+ Property(true)
9656
+ ], Tab.prototype, "clearTemplates", void 0);
9629
9657
  __decorate$7([
9630
9658
  Complex({}, TabAnimationSettings)
9631
9659
  ], Tab.prototype, "animation", void 0);