@syncfusion/ej2-ribbon 25.1.35 → 25.1.41

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +3 -3
  3. package/dist/ej2-ribbon.umd.min.js +2 -2
  4. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-ribbon.es2015.js +114 -81
  6. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  7. package/dist/es6/ej2-ribbon.es5.js +114 -81
  8. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  9. package/dist/global/ej2-ribbon.min.js +2 -2
  10. package/dist/global/ej2-ribbon.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +11 -11
  13. package/src/ribbon/base/ribbon.d.ts +3 -0
  14. package/src/ribbon/base/ribbon.js +115 -82
  15. package/styles/bootstrap-dark.css +1 -1
  16. package/styles/bootstrap.css +1 -1
  17. package/styles/bootstrap4.css +1 -1
  18. package/styles/bootstrap5-dark.css +1 -1
  19. package/styles/bootstrap5.css +1 -1
  20. package/styles/fabric-dark.css +4 -4
  21. package/styles/fabric.css +1 -1
  22. package/styles/fluent-dark.css +1 -1
  23. package/styles/fluent.css +1 -1
  24. package/styles/highcontrast-light.css +1 -1
  25. package/styles/highcontrast.css +1 -1
  26. package/styles/material-dark.css +1 -1
  27. package/styles/material.css +1 -1
  28. package/styles/material3-dark.css +2 -2
  29. package/styles/material3.css +2 -2
  30. package/styles/ribbon/_fabric-dark-definition.scss +1 -1
  31. package/styles/ribbon/_layout.scss +1 -1
  32. package/styles/ribbon/_material3-definition.scss +2 -2
  33. package/styles/ribbon/bootstrap-dark.css +1 -1
  34. package/styles/ribbon/bootstrap.css +1 -1
  35. package/styles/ribbon/bootstrap4.css +1 -1
  36. package/styles/ribbon/bootstrap5-dark.css +1 -1
  37. package/styles/ribbon/bootstrap5.css +1 -1
  38. package/styles/ribbon/fabric-dark.css +4 -4
  39. package/styles/ribbon/fabric.css +1 -1
  40. package/styles/ribbon/fluent-dark.css +1 -1
  41. package/styles/ribbon/fluent.css +1 -1
  42. package/styles/ribbon/highcontrast-light.css +1 -1
  43. package/styles/ribbon/highcontrast.css +1 -1
  44. package/styles/ribbon/material-dark.css +1 -1
  45. package/styles/ribbon/material.css +1 -1
  46. package/styles/ribbon/material3-dark.css +2 -2
  47. package/styles/ribbon/material3.css +2 -2
  48. package/styles/ribbon/tailwind-dark.css +1 -1
  49. package/styles/ribbon/tailwind.css +1 -1
  50. package/styles/tailwind-dark.css +1 -1
  51. package/styles/tailwind.css +1 -1
@@ -4288,7 +4288,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4288
4288
  this.hiddenElements = {};
4289
4289
  this.keyTipElements = {};
4290
4290
  this.hiddenGroups = [];
4291
+ this.itemsModel = [];
4292
+ this.targetTabs = {};
4291
4293
  this.isAddRemove = false;
4294
+ this.isUpdateItems = false;
4292
4295
  this.keyConfigs = {
4293
4296
  leftarrow: 'leftarrow',
4294
4297
  rightarrow: 'rightarrow',
@@ -4798,6 +4801,19 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4798
4801
  const eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex, isContextual: isContextual };
4799
4802
  this.setProperties({ selectedTab: selectedIndex }, true);
4800
4803
  this.calculateHiddenElementsWidth(selectedIndex);
4804
+ if (this.isUpdateItems) {
4805
+ for (let i = 0; i < this.itemsModel.length; i++) {
4806
+ const item = this.itemsModel[parseInt(i.toString(), 10)];
4807
+ if (this.selectedTab === this.targetTabs[item.id]) {
4808
+ this.updateItem(item);
4809
+ this.itemsModel.splice(i, 1);
4810
+ i--;
4811
+ }
4812
+ }
4813
+ if (this.itemsModel.length === 0) {
4814
+ this.isUpdateItems = false;
4815
+ }
4816
+ }
4801
4817
  this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
4802
4818
  if (this.activeLayout === 'Classic' && this.ribbonGalleryModule) {
4803
4819
  this.ribbonGalleryModule.checkAvailableHeight(selectedIndex, e.selectedContent.firstChild);
@@ -8545,96 +8561,111 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
8545
8561
  //Check whether the tab items are rendered
8546
8562
  const contentEle = this.tabObj.items[itemProp.tabIndex].content;
8547
8563
  const groupEle = contentEle.querySelector('#' + itemProp.group.id);
8548
- const groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
8549
- let itemContainer = null;
8550
- let itemEle = null;
8551
- let dropdownElement;
8552
- let dropdown;
8553
- if (contentEle.innerHTML !== '') {
8554
- if (this.activeLayout === RibbonLayout.Simplified) {
8555
- dropdownElement = itemProp.group.enableGroupOverflow ?
8556
- contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
8557
- dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
8558
- }
8559
- if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
8560
- itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
8561
- itemEle = dropdown.target.querySelector('#' + itemId);
8562
- if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
8563
- const collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
8564
- if (collectionEle) {
8565
- collectionEle.appendChild(itemContainer);
8564
+ if (groupEle) {
8565
+ const groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
8566
+ let itemContainer = null;
8567
+ let itemEle = null;
8568
+ let dropdownElement;
8569
+ let dropdown;
8570
+ if (contentEle.innerHTML !== '') {
8571
+ if (this.activeLayout === RibbonLayout.Simplified) {
8572
+ dropdownElement = itemProp.group.enableGroupOverflow ?
8573
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
8574
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
8575
+ }
8576
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
8577
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
8578
+ itemEle = dropdown.target.querySelector('#' + itemId);
8579
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
8580
+ const collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
8581
+ if (collectionEle) {
8582
+ collectionEle.appendChild(itemContainer);
8583
+ }
8566
8584
  }
8567
8585
  }
8568
- }
8569
- else {
8570
- itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
8571
- itemEle = contentEle.querySelector('#' + itemId);
8572
- if (itemProp.item.type === 'GroupButton' && this.activeLayout === RibbonLayout.Classic) {
8573
- itemEle = contentEle.querySelector('#' + itemId + RIBBON_GROUP_BUTTON_ID);
8586
+ else {
8587
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
8588
+ itemEle = contentEle.querySelector('#' + itemId);
8589
+ if (itemProp.item.type === 'GroupButton' && this.activeLayout === RibbonLayout.Classic) {
8590
+ itemEle = contentEle.querySelector('#' + itemId + RIBBON_GROUP_BUTTON_ID);
8591
+ }
8592
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
8593
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
8594
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) ||
8595
+ (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
8596
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
8597
+ }
8598
+ }
8574
8599
  }
8575
- if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
8576
- this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
8577
- if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
8578
- this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
8600
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
8601
+ if (item.cssClass) {
8602
+ if (itemProp.item.cssClass) {
8603
+ itemContainer.classList.remove(itemProp.item.cssClass);
8579
8604
  }
8580
8605
  }
8581
- }
8582
- // Check whether cssClass is passed by the user, and if it is, then remove the old values.
8583
- if (item.cssClass) {
8584
- if (itemProp.item.cssClass) {
8585
- itemContainer.classList.remove(itemProp.item.cssClass);
8606
+ this.destroyFunction(itemProp.item, itemEle);
8607
+ itemEle.remove();
8608
+ const removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
8609
+ if (removeCss) {
8610
+ removeClass([itemContainer], removeCss);
8586
8611
  }
8587
8612
  }
8588
- this.destroyFunction(itemProp.item, itemEle);
8589
- itemEle.remove();
8590
- const removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
8591
- if (removeCss) {
8592
- removeClass([itemContainer], removeCss);
8593
- }
8594
- }
8595
- const ribbonItem = itemProp.item;
8596
- ribbonItem.setProperties(item, true);
8597
- this.validateItemSize();
8598
- if (contentEle.innerHTML !== '') {
8599
- if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
8600
- itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
8601
- }
8602
- else {
8603
- itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
8604
- }
8605
- // To avoid undefined items condition is added
8606
- if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
8607
- itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
8608
- this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
8609
- }
8610
- let size = ribbonItem.activeSize;
8611
- if (this.activeLayout === 'Simplified') {
8612
- size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
8613
- (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
8614
- ribbonItem.setProperties({ activeSize: size }, true);
8615
- }
8616
- if (size & RibbonItemSize.Large) {
8617
- itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
8618
- }
8619
- else {
8620
- itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
8621
- }
8622
- this.createRibbonItem(ribbonItem, itemContainer);
8623
- if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
8624
- if (dropdown.target.childElementCount === 0 || (dropdown.target.childElementCount === 1 && this.isHeaderVisible(dropdown.target, itemProp.group.id))) {
8625
- this.removeOverflowButton(dropdown);
8613
+ const ribbonItem = itemProp.item;
8614
+ ribbonItem.setProperties(item, true);
8615
+ this.validateItemSize();
8616
+ if (contentEle.innerHTML !== '') {
8617
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
8618
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
8626
8619
  }
8620
+ else {
8621
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
8622
+ }
8623
+ // To avoid undefined items condition is added
8624
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
8625
+ itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
8626
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
8627
+ }
8628
+ let size = ribbonItem.activeSize;
8629
+ if (this.activeLayout === 'Simplified') {
8630
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
8631
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
8632
+ ribbonItem.setProperties({ activeSize: size }, true);
8633
+ }
8634
+ if (size & RibbonItemSize.Large) {
8635
+ itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
8636
+ }
8637
+ else {
8638
+ if (size & RibbonItemSize.Medium) {
8639
+ itemContainer.classList.add(RIBBON_MEDIUM_ITEM);
8640
+ }
8641
+ else {
8642
+ itemContainer.classList.add(RIBBON_SMALL_ITEM);
8643
+ }
8644
+ }
8645
+ this.createRibbonItem(ribbonItem, itemContainer);
8646
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
8647
+ if (dropdown.target.childElementCount === 0 ||
8648
+ (dropdown.target.childElementCount === 1 &&
8649
+ this.isHeaderVisible(dropdown.target, itemProp.group.id))) {
8650
+ this.removeOverflowButton(dropdown);
8651
+ }
8652
+ }
8653
+ if (this.selectedTab === itemProp.tabIndex) {
8654
+ this.refreshLayout();
8655
+ }
8656
+ if (item.cssClass) {
8657
+ itemContainer.classList.add(ribbonItem.cssClass);
8658
+ }
8659
+ if (!(ribbonItem.disabled) && itemContainer.classList.contains(DISABLED_CSS)) {
8660
+ itemContainer.classList.remove(DISABLED_CSS);
8661
+ }
8662
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
8627
8663
  }
8628
- if (this.selectedTab === itemProp.tabIndex) {
8629
- this.refreshLayout();
8630
- }
8631
- if (item.cssClass) {
8632
- itemContainer.classList.add(ribbonItem.cssClass);
8633
- }
8634
- if (!(ribbonItem.disabled) && itemContainer.classList.contains(DISABLED_CSS)) {
8635
- itemContainer.classList.remove(DISABLED_CSS);
8636
- }
8637
- this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
8664
+ }
8665
+ else {
8666
+ this.isUpdateItems = true;
8667
+ this.itemsModel.push(item);
8668
+ this.targetTabs[item.id] = itemProp.tabIndex;
8638
8669
  }
8639
8670
  }
8640
8671
  removeItemElement(contentEle, item, dropdown) {
@@ -8768,6 +8799,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
8768
8799
  this.hiddenGroups = [];
8769
8800
  this.hiddenElements = {};
8770
8801
  this.keyTipElements = {};
8802
+ this.itemsModel = [];
8803
+ this.targetTabs = {};
8771
8804
  remove(this.element.querySelector('#' + this.element.id + TAB_ID));
8772
8805
  this.element.style.removeProperty(RIBBON_FILE_MENU_WIDTH);
8773
8806
  this.element.style.removeProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH);