@syncfusion/ej2-ribbon 21.1.37 → 22.1.34

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 (89) hide show
  1. package/.eslintrc.json +1 -0
  2. package/dist/ej2-ribbon.umd.min.js +2 -2
  3. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-ribbon.es2015.js +1344 -176
  5. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  6. package/dist/es6/ej2-ribbon.es5.js +1367 -191
  7. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  8. package/dist/global/ej2-ribbon.min.js +2 -2
  9. package/dist/global/ej2-ribbon.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/ribbon/base/constant.d.ts +2 -0
  13. package/src/ribbon/base/constant.js +2 -0
  14. package/src/ribbon/base/interface.d.ts +6 -6
  15. package/src/ribbon/base/interface.js +6 -6
  16. package/src/ribbon/base/ribbon-model.d.ts +2 -2
  17. package/src/ribbon/base/ribbon.d.ts +43 -1
  18. package/src/ribbon/base/ribbon.js +1082 -169
  19. package/src/ribbon/base/utils.d.ts +2 -2
  20. package/src/ribbon/base/utils.js +11 -6
  21. package/src/ribbon/items/ribbon-button.js +1 -0
  22. package/src/ribbon/items/ribbon-checkbox.js +1 -0
  23. package/src/ribbon/items/ribbon-colorpicker.d.ts +7 -0
  24. package/src/ribbon/items/ribbon-colorpicker.js +41 -3
  25. package/src/ribbon/items/ribbon-combobox.js +5 -1
  26. package/src/ribbon/items/ribbon-dropdown.d.ts +7 -1
  27. package/src/ribbon/items/ribbon-dropdown.js +173 -3
  28. package/src/ribbon/items/ribbon-splitbutton.js +45 -2
  29. package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +10 -5
  30. package/src/ribbon/models/ribbon-combobox-settings.d.ts +10 -5
  31. package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +3 -1
  32. package/src/ribbon/models/ribbon-file-menu-settings.d.ts +3 -1
  33. package/src/ribbon/models/ribbon-item-model.d.ts +1 -1
  34. package/src/ribbon/models/ribbon-item.d.ts +1 -1
  35. package/styles/bootstrap-dark.css +62 -12
  36. package/styles/bootstrap.css +62 -12
  37. package/styles/bootstrap4.css +62 -12
  38. package/styles/bootstrap5-dark.css +62 -12
  39. package/styles/bootstrap5.css +62 -12
  40. package/styles/fabric-dark.css +62 -12
  41. package/styles/fabric.css +62 -12
  42. package/styles/fluent-dark.css +62 -12
  43. package/styles/fluent.css +62 -12
  44. package/styles/highcontrast-light.css +62 -12
  45. package/styles/highcontrast.css +66 -16
  46. package/styles/material-dark.css +62 -12
  47. package/styles/material.css +62 -12
  48. package/styles/material3-dark.css +1671 -0
  49. package/styles/material3-dark.scss +3 -0
  50. package/styles/material3.css +1727 -0
  51. package/styles/material3.scss +3 -0
  52. package/styles/ribbon/_bootstrap-dark-definition.scss +4 -0
  53. package/styles/ribbon/_bootstrap-definition.scss +4 -0
  54. package/styles/ribbon/_bootstrap4-definition.scss +4 -0
  55. package/styles/ribbon/_bootstrap5-definition.scss +4 -0
  56. package/styles/ribbon/_fabric-dark-definition.scss +4 -0
  57. package/styles/ribbon/_fabric-definition.scss +4 -0
  58. package/styles/ribbon/_fluent-definition.scss +4 -0
  59. package/styles/ribbon/_fusionnew-definition.scss +4 -0
  60. package/styles/ribbon/_highcontrast-definition.scss +6 -2
  61. package/styles/ribbon/_highcontrast-light-definition.scss +4 -0
  62. package/styles/ribbon/_layout.scss +88 -18
  63. package/styles/ribbon/_material-dark-definition.scss +4 -0
  64. package/styles/ribbon/_material-definition.scss +4 -0
  65. package/styles/ribbon/_material3-dark-definition.scss +1 -0
  66. package/styles/ribbon/_material3-definition.scss +210 -0
  67. package/styles/ribbon/_tailwind-definition.scss +4 -0
  68. package/styles/ribbon/bootstrap-dark.css +62 -12
  69. package/styles/ribbon/bootstrap.css +62 -12
  70. package/styles/ribbon/bootstrap4.css +62 -12
  71. package/styles/ribbon/bootstrap5-dark.css +62 -12
  72. package/styles/ribbon/bootstrap5.css +62 -12
  73. package/styles/ribbon/fabric-dark.css +62 -12
  74. package/styles/ribbon/fabric.css +62 -12
  75. package/styles/ribbon/fluent-dark.css +62 -12
  76. package/styles/ribbon/fluent.css +62 -12
  77. package/styles/ribbon/highcontrast-light.css +62 -12
  78. package/styles/ribbon/highcontrast.css +66 -16
  79. package/styles/ribbon/icons/_material3-dark.scss +1 -0
  80. package/styles/ribbon/material-dark.css +62 -12
  81. package/styles/ribbon/material.css +62 -12
  82. package/styles/ribbon/material3-dark.css +1671 -0
  83. package/styles/ribbon/material3-dark.scss +18 -0
  84. package/styles/ribbon/material3.css +1727 -0
  85. package/styles/ribbon/material3.scss +18 -0
  86. package/styles/ribbon/tailwind-dark.css +62 -12
  87. package/styles/ribbon/tailwind.css +62 -12
  88. package/styles/tailwind-dark.css +62 -12
  89. package/styles/tailwind.css +62 -12
@@ -1,4 +1,4 @@
1
- import { ChildProperty, Collection, Complex, Component, Event, EventHandler, NotifyPropertyChanges, Property, addClass, append, closest, compile, formatUnit, getComponent, getInstance, getUniqueID, isNullOrUndefined, isUndefined, merge, remove, removeClass, select } from '@syncfusion/ej2-base';
1
+ import { ChildProperty, Collection, Complex, Component, Event, EventHandler, KeyboardEvents, NotifyPropertyChanges, Property, addClass, append, closest, compile, formatUnit, getComponent, getInstance, getUniqueID, isNullOrUndefined, isUndefined, merge, remove, removeClass, select } from '@syncfusion/ej2-base';
2
2
  import { HScroll, Menu, MenuAnimationSettings, MenuItem, Tab, TabAnimationSettings, Toolbar } from '@syncfusion/ej2-navigations';
3
3
  import { ComboBox, FieldSettings } from '@syncfusion/ej2-dropdowns';
4
4
  import { DropDownButton, Item, SplitButton } from '@syncfusion/ej2-splitbuttons';
@@ -61,6 +61,10 @@ var RibbonItemSize;
61
61
  */
62
62
  var DisplayMode;
63
63
  (function (DisplayMode) {
64
+ /**
65
+ * The item appears in the classic layout group.
66
+ */
67
+ DisplayMode[DisplayMode["Classic"] = 4] = "Classic";
64
68
  /**
65
69
  * The item appears in the simplified layout group.
66
70
  */
@@ -70,13 +74,9 @@ var DisplayMode;
70
74
  */
71
75
  DisplayMode[DisplayMode["Overflow"] = 1] = "Overflow";
72
76
  /**
73
- * The item appears in both simplified layout group and overflow popup based on ribbon overflow state.
74
- */
75
- DisplayMode[DisplayMode["Auto"] = 3] = "Auto";
76
- /**
77
- * The item is hidden in simplified mode.
77
+ * The item appears in classic layout group, simplified layout group, and overflow popup based on ribbon overflow state.
78
78
  */
79
- DisplayMode[DisplayMode["None"] = 0] = "None";
79
+ DisplayMode[DisplayMode["Auto"] = 7] = "Auto";
80
80
  })(DisplayMode || (DisplayMode = {}));
81
81
  /**
82
82
  * Defines the type of the ribbon item.
@@ -861,6 +861,8 @@ const DROPDOWNBUTTON = 'e-dropdown-btn';
861
861
  /** @hidden */
862
862
  const DROPDOWNBUTTON_HIDE = 'e-caret-hide';
863
863
  /** @hidden */
864
+ const RIBBON_TEMPLATE = 'e-ribbon-template';
865
+ /** @hidden */
864
866
  const RIBBON_HELP_TEMPLATE = 'e-ribbon-help-template';
865
867
  /** @hidden */
866
868
  const RIBBON_TOOLTIP = 'e-ribbon-tooltip';
@@ -973,6 +975,7 @@ class RibbonButton {
973
975
  */
974
976
  addOverFlowEvents(item, itemEle, overflowButton) {
975
977
  const buttonEle = itemEle.querySelector('#' + item.id);
978
+ buttonEle.setAttribute('data-control', item.type.toString());
976
979
  const buttonObj = getComponent(buttonEle, Button);
977
980
  buttonObj.setProperties({ cssClass: buttonObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
978
981
  buttonEle.onclick = (e) => {
@@ -1116,6 +1119,7 @@ class RibbonCheckBox {
1116
1119
  */
1117
1120
  addOverFlowEvents(item, itemEle, overflowButton) {
1118
1121
  const inputEle = itemEle.querySelector('#' + item.id);
1122
+ inputEle.setAttribute('data-control', item.type.toString());
1119
1123
  const checkBoxObj = getComponent(inputEle, CheckBox);
1120
1124
  checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
1121
1125
  checkBoxObj.dataBind();
@@ -1247,8 +1251,16 @@ class RibbonColorPicker {
1247
1251
  select: colorPickerSettings.select
1248
1252
  }, inputEle);
1249
1253
  const wrapper = colorPicker.element.parentElement;
1250
- EventHandler.add(wrapper, 'mouseenter', () => { wrapper.classList.add(RIBBON_HOVER); }, this);
1251
- EventHandler.add(wrapper, 'mouseleave', () => { wrapper.classList.remove(RIBBON_HOVER); }, this);
1254
+ EventHandler.add(wrapper, 'mouseenter', this.toggleWrapperHover.bind(this, wrapper, true), this);
1255
+ EventHandler.add(wrapper, 'mouseleave', this.toggleWrapperHover.bind(this, wrapper, false), this);
1256
+ }
1257
+ toggleWrapperHover(wrapper, isAdd) {
1258
+ if (isAdd) {
1259
+ wrapper.classList.add(RIBBON_HOVER);
1260
+ }
1261
+ else {
1262
+ wrapper.classList.remove(RIBBON_HOVER);
1263
+ }
1252
1264
  }
1253
1265
  /**
1254
1266
  * Adds the additional event handlers as the item moved into overflow popup.
@@ -1261,12 +1273,23 @@ class RibbonColorPicker {
1261
1273
  */
1262
1274
  addOverFlowEvents(item, itemEle, overflowButton) {
1263
1275
  const colorPickerEle = itemEle.querySelector('#' + item.id);
1276
+ colorPickerEle.setAttribute('data-control', item.type.toString());
1264
1277
  const colorPickerObj = getComponent(colorPickerEle, ColorPicker);
1265
1278
  colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
1266
1279
  //Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
1267
1280
  const splitBtn = colorPickerObj['splitBtn'];
1281
+ let target;
1282
+ colorPickerObj.beforeClose = (e) => {
1283
+ target = e.event ? e.event.target : null;
1284
+ colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
1285
+ if (item.colorPickerSettings.beforeClose) {
1286
+ item.colorPickerSettings.beforeClose.call(this);
1287
+ }
1288
+ };
1268
1289
  splitBtn.close = () => {
1269
- overflowButton.toggle();
1290
+ if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
1291
+ overflowButton.toggle();
1292
+ }
1270
1293
  };
1271
1294
  }
1272
1295
  /**
@@ -1286,6 +1309,12 @@ class RibbonColorPicker {
1286
1309
  const splitBtn = colorPickerObj['splitBtn'];
1287
1310
  //Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
1288
1311
  splitBtn.close = null;
1312
+ colorPickerObj.beforeClose = (e) => {
1313
+ colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
1314
+ if (item.colorPickerSettings.beforeClose) {
1315
+ item.colorPickerSettings.beforeClose.call(this);
1316
+ }
1317
+ };
1289
1318
  }
1290
1319
  getColorPickerObj(controlId) {
1291
1320
  const inputEle = getItemElement(this.parent, controlId);
@@ -1341,6 +1370,17 @@ class RibbonColorPicker {
1341
1370
  const colorPickerObj = getComponent(inputEle, ColorPicker);
1342
1371
  colorPickerObj.setProperties(prop);
1343
1372
  }
1373
+ /**
1374
+ * @param {HTMLElement} element - Gets the colorpicker element to be destroyed.
1375
+ * @returns {void}
1376
+ * @hidden
1377
+ */
1378
+ unwireColorPickerEvents(element) {
1379
+ const colorPickerObj = getComponent(element, ColorPicker);
1380
+ const wrapper = colorPickerObj.element.parentElement;
1381
+ EventHandler.remove(wrapper, 'mouseenter', this.toggleWrapperHover);
1382
+ EventHandler.remove(wrapper, 'mouseleave', this.toggleWrapperHover);
1383
+ }
1344
1384
  }
1345
1385
 
1346
1386
  /**
@@ -1423,13 +1463,17 @@ class RibbonComboBox {
1423
1463
  */
1424
1464
  addOverFlowEvents(item, itemEle, overflowButton) {
1425
1465
  const inputEle = itemEle.querySelector('#' + item.id);
1466
+ inputEle.setAttribute('data-control', item.type.toString());
1426
1467
  const comboBoxObj = getComponent(inputEle, ComboBox);
1427
1468
  comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
1428
1469
  comboBoxObj.close = (e) => {
1470
+ const target = e.event ? e.event.target : null;
1429
1471
  if (item.comboBoxSettings.close) {
1430
1472
  item.comboBoxSettings.close.call(this, e);
1431
1473
  }
1432
- overflowButton.toggle();
1474
+ if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
1475
+ overflowButton.toggle();
1476
+ }
1433
1477
  };
1434
1478
  }
1435
1479
  /**
@@ -1561,7 +1605,11 @@ class RibbonDropDown {
1561
1605
  iconCss: dropDownSettings.iconCss,
1562
1606
  items: dropDownSettings.items,
1563
1607
  target: dropDownSettings.target,
1564
- beforeClose: dropDownSettings.beforeClose,
1608
+ beforeClose: (e) => {
1609
+ if (dropDownSettings.beforeClose) {
1610
+ dropDownSettings.beforeClose.call(this, e);
1611
+ }
1612
+ },
1565
1613
  beforeItemRender: dropDownSettings.beforeItemRender,
1566
1614
  beforeOpen: dropDownSettings.beforeOpen,
1567
1615
  close: (e) => {
@@ -1585,14 +1633,24 @@ class RibbonDropDown {
1585
1633
  */
1586
1634
  addOverFlowEvents(item, itemEle, overflowButton) {
1587
1635
  const dropdownElement = itemEle.querySelector('#' + item.id);
1636
+ dropdownElement.setAttribute('data-control', item.type.toString());
1588
1637
  const dropdown = getComponent(dropdownElement, DropDownButton);
1589
1638
  dropdown.cssClass = dropdown.cssClass + SPACE + RIBBON_POPUP_CONTROL;
1590
1639
  dropdown.dataBind();
1640
+ let target;
1641
+ dropdown.beforeClose = (e) => {
1642
+ if (item.dropDownSettings.beforeClose) {
1643
+ item.dropDownSettings.beforeClose.call(this, e);
1644
+ }
1645
+ target = e.event ? e.event.target : null;
1646
+ };
1591
1647
  dropdown.close = (e) => {
1592
1648
  if (item.dropDownSettings.close) {
1593
1649
  item.dropDownSettings.close.call(this, e);
1594
1650
  }
1595
- overflowButton.toggle();
1651
+ if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
1652
+ overflowButton.toggle();
1653
+ }
1596
1654
  };
1597
1655
  }
1598
1656
  /**
@@ -1615,6 +1673,11 @@ class RibbonDropDown {
1615
1673
  item.dropDownSettings.close.call(this, e);
1616
1674
  }
1617
1675
  };
1676
+ dropdown.beforeClose = (e) => {
1677
+ if (item.dropDownSettings.beforeClose) {
1678
+ item.dropDownSettings.beforeClose.call(this, e);
1679
+ }
1680
+ };
1618
1681
  }
1619
1682
  /**
1620
1683
  * Creates Overflow DropDown.
@@ -1627,10 +1690,12 @@ class RibbonDropDown {
1627
1690
  * @returns {void}
1628
1691
  * @hidden
1629
1692
  */
1630
- createOverFlowDropDown(id, name, iconCss, groupEle, overflowEle) {
1693
+ createOverFlowDropDown(id, name, iconCss, groupEle, overflowEle, enableRtl) {
1694
+ this.enableRtl = enableRtl;
1631
1695
  const buttonEle = this.parent.createElement('button', {
1632
1696
  id: id + OVERFLOW_ID + DROPDOWN_ID
1633
1697
  });
1698
+ groupEle.setAttribute('tabindex', '0');
1634
1699
  overflowEle.appendChild(buttonEle);
1635
1700
  const dropdown = new DropDownButton({
1636
1701
  iconCss: iconCss,
@@ -1646,8 +1711,155 @@ class RibbonDropDown {
1646
1711
  }
1647
1712
  }, buttonEle);
1648
1713
  createTooltip(groupEle, this.parent);
1714
+ buttonEle.onclick = buttonEle.onkeydown = () => { this.itemIndex = 0; };
1715
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1716
+ groupEle.onkeydown = (e) => { this.keyActionHandler(e, groupEle), this; };
1649
1717
  return dropdown;
1650
1718
  }
1719
+ keyActionHandler(e, target) {
1720
+ const items = target.querySelectorAll('.e-control');
1721
+ const comboBoxElements = target.querySelectorAll('.e-combobox');
1722
+ let comboBoxEle;
1723
+ if (comboBoxElements) {
1724
+ for (let i = 0; i < comboBoxElements.length; i++) {
1725
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
1726
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
1727
+ }
1728
+ }
1729
+ }
1730
+ if (comboBoxEle) {
1731
+ for (let i = 0; i < items.length; i++) {
1732
+ if (items[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
1733
+ if (items[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
1734
+ this.itemIndex = i;
1735
+ }
1736
+ }
1737
+ }
1738
+ }
1739
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
1740
+ e.target.classList.contains('e-ribbon-last-item') || e.target.classList.contains('e-ribbon-first-item')) {
1741
+ if (e.key === 'ArrowRight' || (!e.shiftKey && e.key === 'Tab')) {
1742
+ this.handleNavigation(e, !this.enableRtl, items);
1743
+ }
1744
+ if (e.key === 'ArrowLeft' || (e.shiftKey && e.key === 'Tab')) {
1745
+ this.handleNavigation(e, this.enableRtl, items);
1746
+ }
1747
+ }
1748
+ }
1749
+ handleNavigation(e, enableRtl, items) {
1750
+ if (!(items[0].classList.contains('e-ribbon-first-item'))) {
1751
+ items[0].classList.add('e-ribbon-first-item');
1752
+ }
1753
+ if (!(items[items.length - 1].classList.contains('e-ribbon-last-item'))) {
1754
+ items[items.length - 1].classList.add('e-ribbon-last-item');
1755
+ }
1756
+ if (enableRtl) {
1757
+ if (this.itemIndex === 0 && items[parseInt(this.itemIndex.toString(), 10)].classList.contains('e-ribbon-first-item')) {
1758
+ this.updateItemIndex(e, items, true);
1759
+ }
1760
+ if (!e.target.classList.contains('e-combobox') && !e.target.classList.contains('e-ribbon-last-item') &&
1761
+ !e.target.classList.contains('e-ribbon-group-container') && (e.target.classList.contains('e-ribbon-first-item')
1762
+ || this.itemIndex !== 0) && e.target.classList.contains('e-control')) {
1763
+ this.itemIndex++;
1764
+ this.updateItemIndex(e, items, true);
1765
+ }
1766
+ if (e.target.classList.contains('e-ribbon-last-item')) {
1767
+ let launcherIcon = false;
1768
+ launcherIcon = this.focusLauncherIcon(e, items);
1769
+ if (!launcherIcon) {
1770
+ this.itemIndex = 0;
1771
+ this.updateItemIndex(e, items, true);
1772
+ }
1773
+ }
1774
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
1775
+ this.itemIndex = 0;
1776
+ this.updateItemIndex(e, items, true);
1777
+ }
1778
+ }
1779
+ else {
1780
+ if (!e.target.classList.contains('e-combobox') && this.itemIndex !== 0) {
1781
+ this.itemIndex--;
1782
+ this.updateItemIndex(e, items, false);
1783
+ }
1784
+ if (e.target.classList.contains('e-ribbon-first-item')) {
1785
+ let launcherIcon = false;
1786
+ launcherIcon = this.focusLauncherIcon(e, items);
1787
+ if (!launcherIcon) {
1788
+ this.itemIndex = items.length - 1;
1789
+ this.updateItemIndex(e, items, false);
1790
+ }
1791
+ }
1792
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
1793
+ this.itemIndex = items.length - 1;
1794
+ this.updateItemIndex(e, items, false);
1795
+ }
1796
+ }
1797
+ if (e.target.classList.contains('e-combobox') && (e.key === 'Tab')) {
1798
+ if (enableRtl) {
1799
+ if (this.itemIndex < items.length - 1) {
1800
+ this.itemIndex++;
1801
+ }
1802
+ }
1803
+ else {
1804
+ if (this.itemIndex > 0) {
1805
+ this.itemIndex--;
1806
+ }
1807
+ }
1808
+ }
1809
+ }
1810
+ focusLauncherIcon(e, items) {
1811
+ const groupContainer = items[parseInt(this.itemIndex.toString(), 10)].closest('.e-ribbon-group-container');
1812
+ let launcherIconEle;
1813
+ if (groupContainer) {
1814
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
1815
+ }
1816
+ if (launcherIconEle) {
1817
+ if (e.key === 'Tab') {
1818
+ e.preventDefault();
1819
+ }
1820
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
1821
+ return true;
1822
+ }
1823
+ else {
1824
+ return false;
1825
+ }
1826
+ }
1827
+ updateItemIndex(e, items, enableRtl) {
1828
+ let ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1829
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
1830
+ if (enableRtl) {
1831
+ if (this.itemIndex < items.length - 1) {
1832
+ this.itemIndex++;
1833
+ }
1834
+ else {
1835
+ let launcherIcon = false;
1836
+ launcherIcon = this.focusLauncherIcon(e, items);
1837
+ if (launcherIcon) {
1838
+ break;
1839
+ }
1840
+ this.itemIndex = 0;
1841
+ }
1842
+ }
1843
+ else {
1844
+ if (this.itemIndex > 0) {
1845
+ this.itemIndex--;
1846
+ }
1847
+ else {
1848
+ let launcherIcon = false;
1849
+ launcherIcon = this.focusLauncherIcon(e, items);
1850
+ if (launcherIcon) {
1851
+ break;
1852
+ }
1853
+ this.itemIndex = items.length - 1;
1854
+ }
1855
+ }
1856
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1857
+ }
1858
+ if (e.key === 'Tab') {
1859
+ e.preventDefault();
1860
+ }
1861
+ items[parseInt(this.itemIndex.toString(), 10)].focus();
1862
+ }
1651
1863
  /**
1652
1864
  * Removes Overflow DropDown.
1653
1865
  *
@@ -1750,6 +1962,7 @@ class RibbonDropDown {
1750
1962
  control.cssClass = prop.cssClass;
1751
1963
  }
1752
1964
  delete prop.close;
1965
+ delete prop.beforeClose;
1753
1966
  if (prop.content) {
1754
1967
  prop.content = itemProp.item.activeSize === RibbonItemSize.Small ? '' : prop.content;
1755
1968
  }
@@ -1818,7 +2031,11 @@ class RibbonSplitButton {
1818
2031
  iconCss: splitButtonSettings.iconCss,
1819
2032
  items: splitButtonSettings.items,
1820
2033
  target: splitButtonSettings.target,
1821
- beforeClose: splitButtonSettings.beforeClose,
2034
+ beforeClose: (e) => {
2035
+ if (splitButtonSettings.beforeClose) {
2036
+ splitButtonSettings.beforeClose.call(this, e);
2037
+ }
2038
+ },
1822
2039
  beforeItemRender: splitButtonSettings.beforeItemRender,
1823
2040
  beforeOpen: splitButtonSettings.beforeOpen,
1824
2041
  close: () => {
@@ -1841,6 +2058,13 @@ class RibbonSplitButton {
1841
2058
  }
1842
2059
  }
1843
2060
  }, buttonEle);
2061
+ const dropdownEle = buttonEle.parentElement.querySelector('.e-dropdown-btn');
2062
+ dropdownEle.onkeydown = (e) => {
2063
+ if (e.key === 'Enter') {
2064
+ e.stopImmediatePropagation();
2065
+ dropdownEle.click();
2066
+ }
2067
+ };
1844
2068
  this.setContent(item, splitbutton);
1845
2069
  const wrapper = splitbutton['wrapper'];
1846
2070
  EventHandler.add(wrapper, 'mouseenter', () => { wrapper.classList.add(RIBBON_HOVER); }, this);
@@ -1857,9 +2081,33 @@ class RibbonSplitButton {
1857
2081
  */
1858
2082
  addOverFlowEvents(item, itemEle, overflowButton) {
1859
2083
  const splitButtonEle = itemEle.querySelector('#' + item.id);
2084
+ splitButtonEle.setAttribute('data-control', item.type.toString());
1860
2085
  const splitbutton = getComponent(splitButtonEle, SplitButton);
1861
2086
  splitbutton.cssClass = splitbutton.cssClass + SPACE + RIBBON_POPUP_CONTROL;
1862
2087
  splitbutton.dataBind();
2088
+ const dropdownEle = splitButtonEle.parentElement.querySelector('.e-dropdown-btn');
2089
+ const ddbId = dropdownEle.getAttribute('id');
2090
+ const popupEle = document.querySelector('#' + ddbId + '-popup');
2091
+ dropdownEle.onkeydown = (e) => {
2092
+ if (e.key === 'Enter') {
2093
+ e.stopImmediatePropagation();
2094
+ dropdownEle.click();
2095
+ }
2096
+ };
2097
+ popupEle.onkeydown = (e) => {
2098
+ if (e.key === 'Enter') {
2099
+ e.preventDefault();
2100
+ splitbutton['wrapper'].classList.remove('e-ribbon-open');
2101
+ popupEle.querySelector('.e-focused').click();
2102
+ }
2103
+ };
2104
+ let target;
2105
+ splitbutton.beforeClose = (e) => {
2106
+ if (item.splitButtonSettings.beforeClose) {
2107
+ item.splitButtonSettings.beforeClose.call(this, e);
2108
+ }
2109
+ target = e.event ? e.event.target : null;
2110
+ };
1863
2111
  splitbutton.click = (e) => {
1864
2112
  if (item.splitButtonSettings.click) {
1865
2113
  item.splitButtonSettings.click.call(this, e);
@@ -1871,7 +2119,9 @@ class RibbonSplitButton {
1871
2119
  item.splitButtonSettings.close.call(this, e);
1872
2120
  }
1873
2121
  splitbutton['wrapper'].classList.remove(RIBBON_POPUP_OPEN);
1874
- overflowButton.toggle();
2122
+ if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
2123
+ overflowButton.toggle();
2124
+ }
1875
2125
  };
1876
2126
  }
1877
2127
  /**
@@ -1889,6 +2139,11 @@ class RibbonSplitButton {
1889
2139
  cssClass = cssClass.filter((value) => value !== RIBBON_POPUP_CONTROL);
1890
2140
  splitbutton.cssClass = cssClass.join(SPACE);
1891
2141
  splitbutton.dataBind();
2142
+ splitbutton.beforeClose = (e) => {
2143
+ if (item.splitButtonSettings.beforeClose) {
2144
+ item.splitButtonSettings.beforeClose.call(this, e);
2145
+ }
2146
+ };
1892
2147
  splitbutton.click = (e) => {
1893
2148
  if (item.splitButtonSettings.click) {
1894
2149
  item.splitButtonSettings.click.call(this, e);
@@ -1968,6 +2223,7 @@ class RibbonSplitButton {
1968
2223
  delete prop.open;
1969
2224
  delete prop.click;
1970
2225
  delete prop.close;
2226
+ delete prop.beforeClose;
1971
2227
  control.setProperties(prop);
1972
2228
  if (prop.content) {
1973
2229
  this.setContent(itemProp.item, control);
@@ -2015,7 +2271,7 @@ function getIndex(arr, condition) {
2015
2271
  /**
2016
2272
  * Gets template content based on the template property value.
2017
2273
  *
2018
- * @param {string | HTMLElement} template - Template property value.
2274
+ * @param {string | HTMLElement| Function} template - Template property value.
2019
2275
  * @returns {Function} - Return template function.
2020
2276
  * @hidden
2021
2277
  */
@@ -2176,16 +2432,21 @@ function getItemElement(parent, id, itemProp) {
2176
2432
  return null;
2177
2433
  }
2178
2434
  if (parent.activeLayout === RibbonLayout.Classic) {
2179
- contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
2180
- : contentEle;
2181
- return contentEle.querySelector('#' + id);
2435
+ if (itemProp.item.displayOptions & DisplayMode.Classic) {
2436
+ contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
2437
+ : contentEle;
2438
+ return contentEle.querySelector('#' + id);
2439
+ }
2440
+ else {
2441
+ return null;
2442
+ }
2182
2443
  }
2183
2444
  else {
2184
- //Checks for Simplified and Auto options (Auto = simplified + popup)
2445
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
2185
2446
  let ele = (itemProp.item.displayOptions & DisplayMode.Simplified) ?
2186
2447
  contentEle.querySelector('#' + itemProp.item.id) : null;
2187
2448
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
2188
- if (!ele && (DisplayMode.Simplified !== DisplayMode.None)) {
2449
+ if (!ele) {
2189
2450
  const dropdown = itemProp.group.enableGroupOverflow ?
2190
2451
  getComponent(contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID), DropDownButton)
2191
2452
  : parent.overflowDDB;
@@ -2329,6 +2590,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2329
2590
  this.idIndex = 0;
2330
2591
  this.tooltipData = [];
2331
2592
  this.isAddRemove = false;
2593
+ this.keyConfigs = {
2594
+ leftarrow: 'leftarrow',
2595
+ rightarrow: 'rightarrow',
2596
+ tab: 'tab',
2597
+ shiftTab: 'shift+tab'
2598
+ };
2332
2599
  }
2333
2600
  /**
2334
2601
  * Get the properties to be maintained in the persisted state.
@@ -2370,12 +2637,239 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2370
2637
  this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
2371
2638
  }
2372
2639
  this.createHelpPaneTemplate();
2640
+ const toolbar = this.tabObj['tbObj'];
2641
+ toolbar.refreshOverflow();
2373
2642
  createTooltip(this.element, this);
2374
2643
  this.wireEvents();
2644
+ this.wireKeyboardEvent();
2645
+ this.currentControlIndex = 0;
2375
2646
  }
2376
2647
  wireEvents() {
2377
2648
  EventHandler.add(window, 'resize', this.resizeHandler, this);
2378
2649
  }
2650
+ wireKeyboardEvent() {
2651
+ this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
2652
+ keyAction: this.keyActionHandler.bind(this),
2653
+ keyConfigs: this.keyConfigs,
2654
+ eventName: 'keydown'
2655
+ });
2656
+ }
2657
+ keyActionHandler(e) {
2658
+ if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
2659
+ e.preventDefault();
2660
+ }
2661
+ const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2662
+ const ribbonControls = activeContent.querySelectorAll('.e-control');
2663
+ const comboBoxElements = activeContent.querySelectorAll('.e-combobox');
2664
+ let comboBoxEle;
2665
+ if (comboBoxElements) {
2666
+ for (let i = 0; i < comboBoxElements.length; i++) {
2667
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2668
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
2669
+ }
2670
+ }
2671
+ }
2672
+ if (comboBoxEle) {
2673
+ for (let i = 0; i < ribbonControls.length; i++) {
2674
+ if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
2675
+ if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2676
+ this.currentControlIndex = i;
2677
+ }
2678
+ }
2679
+ }
2680
+ }
2681
+ if (this.currentControlIndex === 0) {
2682
+ let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2683
+ while (item && item.classList.contains('e-disabled')) {
2684
+ this.currentControlIndex++;
2685
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2686
+ }
2687
+ }
2688
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
2689
+ e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
2690
+ e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
2691
+ e.target.classList.contains('e-ribbon-overall-of-btn')) {
2692
+ switch (e.action) {
2693
+ case 'rightarrow':
2694
+ this.handleNavigation(e, !this.enableRtl, ribbonControls);
2695
+ break;
2696
+ case 'leftarrow':
2697
+ this.handleNavigation(e, this.enableRtl, ribbonControls);
2698
+ break;
2699
+ case 'tab':
2700
+ if (e.target.classList.contains('e-combobox')) {
2701
+ if (this.currentControlIndex < ribbonControls.length - 1) {
2702
+ this.currentControlIndex++;
2703
+ }
2704
+ }
2705
+ break;
2706
+ case 'shiftTab':
2707
+ if (e.target.classList.contains('e-combobox')) {
2708
+ if (this.currentControlIndex > 0) {
2709
+ this.currentControlIndex--;
2710
+ }
2711
+ }
2712
+ else {
2713
+ this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
2714
+ this.currentControlIndex = 0;
2715
+ }
2716
+ }
2717
+ }
2718
+ }
2719
+ handleNavigation(e, enableRtl, ribbonControls) {
2720
+ let groupContainer;
2721
+ let prevGroupId;
2722
+ if (enableRtl) {
2723
+ if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
2724
+ this.currentControlIndex++;
2725
+ }
2726
+ }
2727
+ else {
2728
+ if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
2729
+ this.currentControlIndex--;
2730
+ }
2731
+ }
2732
+ if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
2733
+ if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
2734
+ if (enableRtl) {
2735
+ this.currentControlIndex++;
2736
+ }
2737
+ else {
2738
+ const prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2739
+ if (prevGroupContainer) {
2740
+ prevGroupId = prevGroupContainer.getAttribute('id');
2741
+ }
2742
+ this.currentControlIndex--;
2743
+ }
2744
+ let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2745
+ while (item && item.classList.contains('e-disabled')) {
2746
+ if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
2747
+ (!enableRtl && this.currentControlIndex === 0))) {
2748
+ if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
2749
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
2750
+ break;
2751
+ }
2752
+ }
2753
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
2754
+ enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
2755
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2756
+ }
2757
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2758
+ if (this.activeLayout === 'Classic') {
2759
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2760
+ if (enableRtl) {
2761
+ let launcherIconEle;
2762
+ if (groupContainer) {
2763
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
2764
+ }
2765
+ if (launcherIconEle) {
2766
+ const items = groupContainer.querySelectorAll('.e-ribbon-item');
2767
+ items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
2768
+ }
2769
+ }
2770
+ else {
2771
+ if (groupContainer) {
2772
+ const groupContainerId = groupContainer.getAttribute('id');
2773
+ if (prevGroupId !== groupContainerId) {
2774
+ const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
2775
+ if (launcherIconEle) {
2776
+ ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
2777
+ }
2778
+ }
2779
+ }
2780
+ }
2781
+ }
2782
+ else {
2783
+ if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
2784
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
2785
+ }
2786
+ else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
2787
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
2788
+ }
2789
+ }
2790
+ }
2791
+ }
2792
+ else {
2793
+ if (this.activeLayout === 'Classic') {
2794
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
2795
+ }
2796
+ if (this.activeLayout === 'Simplified') {
2797
+ const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
2798
+ if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
2799
+ overflowButton.focus();
2800
+ }
2801
+ else {
2802
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
2803
+ }
2804
+ }
2805
+ }
2806
+ if (e.target.classList.contains('e-ribbon-last-item')) {
2807
+ if (enableRtl) {
2808
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2809
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
2810
+ }
2811
+ else {
2812
+ this.currentControlIndex--;
2813
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2814
+ }
2815
+ }
2816
+ if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
2817
+ groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2818
+ const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
2819
+ if (launcherIconEle) {
2820
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
2821
+ }
2822
+ }
2823
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
2824
+ if (enableRtl) {
2825
+ this.currentControlIndex++;
2826
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2827
+ if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
2828
+ ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
2829
+ }
2830
+ }
2831
+ else {
2832
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
2833
+ this.currentControlIndex;
2834
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2835
+ }
2836
+ }
2837
+ if (e.target.classList.contains('e-ribbon-collapse-btn')) {
2838
+ if (enableRtl) {
2839
+ this.currentControlIndex = 0;
2840
+ let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2841
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
2842
+ this.currentControlIndex++;
2843
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2844
+ }
2845
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2846
+ }
2847
+ else {
2848
+ const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
2849
+ if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
2850
+ overflowButton.focus();
2851
+ }
2852
+ else {
2853
+ this.currentControlIndex = ribbonControls.length - 1;
2854
+ let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2855
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
2856
+ this.currentControlIndex--;
2857
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2858
+ }
2859
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2860
+ }
2861
+ }
2862
+ }
2863
+ if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
2864
+ if (enableRtl) {
2865
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
2866
+ }
2867
+ else {
2868
+ this.currentControlIndex = ribbonControls.length - 1;
2869
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
2870
+ }
2871
+ }
2872
+ }
2379
2873
  resizeHandler() {
2380
2874
  const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2381
2875
  this.checkOverflow(this.selectedTab, activeContent);
@@ -2447,7 +2941,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2447
2941
  selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
2448
2942
  const eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex };
2449
2943
  this.setProperties({ selectedTab: selectedIndex }, true);
2450
- this.checkOverflow(selectedIndex, e.selectedContent);
2944
+ this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
2451
2945
  if (this.activeLayout === 'Simplified' && this.overflowDDB) {
2452
2946
  const overflowTarget = this.overflowDDB.target;
2453
2947
  const ofTabContainer = overflowTarget.querySelector('.' + RIBBON_TAB_ACTIVE);
@@ -2466,9 +2960,6 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2466
2960
  this.trigger('tabSelected', eventArgs);
2467
2961
  }
2468
2962
  checkOverflow(tabIndex, activeContent) {
2469
- if (!activeContent) {
2470
- activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + CONTENT_ID);
2471
- }
2472
2963
  const tabContent = activeContent.closest('.' + TAB_CONTENT);
2473
2964
  const isOverFlow = tabContent.offsetWidth < activeContent.offsetWidth;
2474
2965
  if (isOverFlow && !this.scrollModule) {
@@ -2580,7 +3071,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2580
3071
  for (let k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
2581
3072
  const item = collection.items[k - 1];
2582
3073
  const itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
2583
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3074
+ if (((item.displayOptions === DisplayMode.Auto) ||
3075
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2584
3076
  itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
2585
3077
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
2586
3078
  if (item.activeSize === RibbonItemSize.Small) {
@@ -2650,7 +3142,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2650
3142
  if (overflowtarget) {
2651
3143
  itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
2652
3144
  }
2653
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3145
+ if (((item.displayOptions === DisplayMode.Auto) ||
3146
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2654
3147
  const width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
2655
3148
  if (!isClear && (tabContent.offsetWidth < width)) {
2656
3149
  flag = false;
@@ -2740,7 +3233,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2740
3233
  }
2741
3234
  overflowButton = this.overflowDDB;
2742
3235
  }
2743
- this.addOverflowEvents(item, itemEle, overflowButton);
3236
+ if (itemEle !== null) {
3237
+ this.addOverflowEvents(item, itemEle, overflowButton);
3238
+ }
2744
3239
  }
2745
3240
  addOverflowEvents(item, itemEle, overflowButton) {
2746
3241
  switch (item.type) {
@@ -2789,6 +3284,50 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2789
3284
  }
2790
3285
  return isBreak;
2791
3286
  }
3287
+ checkValidCollectionLength(collections) {
3288
+ let count = 0;
3289
+ for (let i = 0; i < collections.length; i++) {
3290
+ const items = collections[parseInt(i.toString(), 10)].items;
3291
+ for (let ind = 0; ind < items.length; ind++) {
3292
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3293
+ count++;
3294
+ break;
3295
+ }
3296
+ }
3297
+ if (count > 1) {
3298
+ return false;
3299
+ }
3300
+ }
3301
+ return count === 1;
3302
+ }
3303
+ checkClassicCollection(collections, n, isIncrement) {
3304
+ const items = collections[parseInt(n.toString(), 10)].items;
3305
+ for (let ind = 0; ind < items.length; ind++) {
3306
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3307
+ return n;
3308
+ }
3309
+ }
3310
+ n = isIncrement ? n + 1 : n - 1;
3311
+ if (isIncrement) {
3312
+ return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
3313
+ }
3314
+ else {
3315
+ return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
3316
+ }
3317
+ }
3318
+ checkClassicItem(items, n, isIncrement) {
3319
+ const item = items[parseInt(n.toString(), 10)];
3320
+ if (item.displayOptions & DisplayMode.Classic) {
3321
+ return n;
3322
+ }
3323
+ n = isIncrement ? n + 1 : n - 1;
3324
+ if (isIncrement) {
3325
+ return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
3326
+ }
3327
+ else {
3328
+ return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
3329
+ }
3330
+ }
2792
3331
  checkLargeToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip = false) {
2793
3332
  const group = tab.groups[parseInt(groupIndex.toString(), 10)];
2794
3333
  if (group.isCollapsed && !shouldSkip) {
@@ -2820,6 +3359,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2820
3359
  createShrinkEle(collection.id, firstItem, start, end);
2821
3360
  for (let i = start; i <= end; i++) {
2822
3361
  const item = collection.items[parseInt(i.toString(), 10)];
3362
+ if (!(item.displayOptions & DisplayMode.Classic)) {
3363
+ continue;
3364
+ }
2823
3365
  const ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
2824
3366
  shrinkEle.appendChild(ele);
2825
3367
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
@@ -2844,45 +3386,65 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2844
3386
  if (orientation === ItemOrientation.Column) {
2845
3387
  for (let k = (group.collections.length - 1); k > 0; k--) {
2846
3388
  //to avoid negative index while checking for the second collection
2847
- if (((k - 1) >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
2848
- if (canReduceCollection(group.collections[k - 1])) {
2849
- if (((k - 2) >= 0) && canReduceCollection(group.collections[k - 2])) {
2850
- moveCollectionToColumn(k - 2, k);
3389
+ k = this.checkClassicCollection(group.collections, k, false);
3390
+ let l = k - 1;
3391
+ //Checks the element rendered at position n
3392
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
3393
+ l = this.checkClassicCollection(group.collections, l, false);
3394
+ //Checks the element rendered at position n-1
3395
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
3396
+ let m = l - 1;
3397
+ if (m >= 0) {
3398
+ m = this.checkClassicCollection(group.collections, m, false);
3399
+ }
3400
+ //Checks the element rendered at position n-2
3401
+ if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
3402
+ moveCollectionToColumn(m, k);
2851
3403
  }
2852
3404
  else {
2853
- moveCollectionToColumn(k - 1, k);
3405
+ moveCollectionToColumn(l, k);
2854
3406
  }
2855
- k -= 2;
3407
+ k = m;
2856
3408
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
2857
3409
  return true;
2858
3410
  }
2859
3411
  }
2860
3412
  else {
2861
- k--;
3413
+ k = l;
2862
3414
  }
2863
3415
  }
2864
3416
  }
2865
3417
  }
2866
3418
  else {
2867
- if (group.collections.length === 1) {
3419
+ if (this.checkValidCollectionLength(group.collections)) {
2868
3420
  const collection = group.collections[0];
2869
3421
  for (let k = (collection.items.length - 1); k > 0; k--) {
2870
3422
  //to avoid negative index while checking for the second item
2871
- if (((k - 1) >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
2872
- if (canReduceItem(collection.items[k - 1])) {
2873
- if (((k - 2) >= 0) && canReduceItem(collection.items[k - 2])) {
2874
- moveItemToColumn(k - 2, k);
3423
+ k = this.checkClassicItem(collection.items, k, false);
3424
+ let l = k - 1;
3425
+ //Checks the element rendered at position n
3426
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
3427
+ l = this.checkClassicItem(collection.items, l, false);
3428
+ //Checks the element rendered at position n-1
3429
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
3430
+ let m = l - 1;
3431
+ //Checks the element rendered at position n-2
3432
+ if (m >= 0) {
3433
+ m = this.checkClassicItem(collection.items, m, false);
3434
+ }
3435
+ if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
3436
+ moveItemToColumn(m, k);
2875
3437
  }
2876
3438
  else {
2877
- moveItemToColumn(k - 1, k);
3439
+ moveItemToColumn(l, k);
2878
3440
  }
2879
- k -= 2;
3441
+ k = m;
2880
3442
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
2881
3443
  return true;
2882
3444
  }
2883
3445
  }
2884
3446
  else {
2885
- k--;
3447
+ k = l;
2886
3448
  }
2887
3449
  }
2888
3450
  }
@@ -2901,28 +3463,42 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2901
3463
  const canReduceItem = (item) => {
2902
3464
  return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
2903
3465
  };
2904
- const reduceItemsToSmall = (collectionIndex, start, end) => {
3466
+ const reduceItemsToSmall = (collectionIndex, start, end, middle = null) => {
2905
3467
  const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
2906
3468
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
2907
- for (let i = start; i <= end; i++) {
3469
+ const reduce = (i) => {
2908
3470
  const item = collection.items[parseInt(i.toString(), 10)];
2909
- const ele = activeContent.querySelector('#' + item.id);
2910
- item.setProperties({ activeSize: RibbonItemSize.Small }, true);
2911
- this.setItemSize(ele, item);
3471
+ if (item.displayOptions & DisplayMode.Classic) {
3472
+ const ele = activeContent.querySelector('#' + item.id);
3473
+ item.setProperties({ activeSize: RibbonItemSize.Small }, true);
3474
+ this.setItemSize(ele, item);
3475
+ }
3476
+ };
3477
+ reduce(start);
3478
+ if (middle) {
3479
+ reduce(middle);
2912
3480
  }
3481
+ reduce(end);
2913
3482
  };
2914
- const reduceCollectionsToSmall = (index, start, end) => {
3483
+ const reduceCollectionsToSmall = (index, start, end, middle = null) => {
2915
3484
  const group = this.tabs[parseInt(tabIndex.toString(), 10)]
2916
3485
  .groups[parseInt(groupIndex.toString(), 10)];
2917
3486
  if (!shouldSkip) {
2918
3487
  shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
2919
3488
  }
2920
- for (let i = start; i <= end; i++) {
3489
+ const reduce = (i) => {
2921
3490
  const collection = group.collections[parseInt(i.toString(), 10)];
2922
- const ele = activeContent.querySelector('#' + collection.items[0].id);
2923
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
2924
- this.setItemSize(ele, collection.items[0]);
3491
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
3492
+ const ele = activeContent.querySelector('#' + collection.items[0].id);
3493
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
3494
+ this.setItemSize(ele, collection.items[0]);
3495
+ }
3496
+ };
3497
+ reduce(start);
3498
+ if (middle) {
3499
+ reduce(middle);
2925
3500
  }
3501
+ reduce(end);
2926
3502
  };
2927
3503
  const setWidth = (id) => {
2928
3504
  if (!shouldSkip) {
@@ -2936,13 +3512,14 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2936
3512
  const start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
2937
3513
  const end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
2938
3514
  //only 2 or 3 itmes alone can be present in shrinked column
3515
+ const l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
2939
3516
  if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
2940
- && canReduceItem(group.collections[start + 1].items[0])) {
2941
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
3517
+ && canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
3518
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
2942
3519
  reduceCollectionsToSmall(k, start, end);
2943
3520
  }
2944
- else if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])) {
2945
- reduceCollectionsToSmall(k, start, end);
3521
+ else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
3522
+ reduceCollectionsToSmall(k, start, end, l);
2946
3523
  }
2947
3524
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
2948
3525
  return true;
@@ -2952,16 +3529,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2952
3529
  }
2953
3530
  for (let k = (group.collections.length - 1); k >= 0; k--) {
2954
3531
  const collection = group.collections[parseInt(k.toString(), 10)];
3532
+ const classicItems = [];
3533
+ for (let i = 0; i < collection.items.length; i++) {
3534
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3535
+ classicItems.push(i);
3536
+ }
3537
+ }
2955
3538
  //If items length is 1 then, it would have been already check for shrinked column
2956
- if ((collection.items.length > 1)) {
2957
- if (canReduceItem(collection.items[0]) && canReduceItem(collection.items[1])) {
2958
- if (collection.items.length === 2) {
3539
+ if ((classicItems.length > 1)) {
3540
+ if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
3541
+ if (classicItems.length === 2) {
2959
3542
  setWidth(collection.id);
2960
- reduceItemsToSmall(k, 0, 1);
3543
+ reduceItemsToSmall(k, classicItems[0], classicItems[1]);
2961
3544
  }
2962
- else if (canReduceItem(collection.items[2])) {
3545
+ else if (canReduceItem(collection.items[classicItems[2]])) {
2963
3546
  setWidth(collection.id);
2964
- reduceItemsToSmall(k, 0, 2);
3547
+ reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
2965
3548
  }
2966
3549
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
2967
3550
  return true;
@@ -2971,22 +3554,24 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2971
3554
  }
2972
3555
  }
2973
3556
  else {
2974
- if (group.collections.length === 1) {
3557
+ if (this.checkValidCollectionLength(group.collections)) {
2975
3558
  if (shrinkColumns.length > 0) {
2976
3559
  for (let k = (shrinkColumns.length - 1); k >= 0; k--) {
2977
3560
  const shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
2978
3561
  const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
2979
3562
  const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
2980
3563
  //only 2 or 3 itmes alone can be present in shrinked column
3564
+ const collection = group.collections[0];
3565
+ const l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
2981
3566
  if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
2982
- && canReduceItem(group.collections[0].items[start + 1])) {
2983
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
3567
+ && canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
3568
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
2984
3569
  setWidth(shrinkColumn.id);
2985
3570
  reduceItemsToSmall(0, start, end);
2986
3571
  }
2987
3572
  else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
2988
3573
  setWidth(shrinkColumn.id);
2989
- reduceItemsToSmall(0, start, end);
3574
+ reduceItemsToSmall(0, start, end, l);
2990
3575
  }
2991
3576
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
2992
3577
  return true;
@@ -2999,6 +3584,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2999
3584
  for (let k = (group.collections.length - 1); k >= 0; k--) {
3000
3585
  const collection = group.collections[parseInt(k.toString(), 10)];
3001
3586
  for (let l = (collection.items.length - 1); l >= 0; l--) {
3587
+ l = this.checkClassicItem(collection.items, l, false);
3588
+ if (l < 0) {
3589
+ continue;
3590
+ }
3002
3591
  const item = collection.items[parseInt(l.toString(), 10)];
3003
3592
  if (canReduceItem(item)) {
3004
3593
  setWidth(item.id);
@@ -3031,20 +3620,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3031
3620
  const canExpandItem = (item) => {
3032
3621
  return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
3033
3622
  };
3034
- const expandItemsToMedium = (collectionIndex, start, end, parentEle) => {
3623
+ const expandItemToMedium = (collectionIndex, index, parentEle) => {
3035
3624
  const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
3036
3625
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
3037
- for (let i = start; i <= end; i++) {
3038
- const item = collection.items[parseInt(i.toString(), 10)];
3626
+ const item = collection.items[parseInt(index.toString(), 10)];
3627
+ if (item.displayOptions & DisplayMode.Classic) {
3039
3628
  const ele = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
3040
3629
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
3041
3630
  this.setItemSize(ele, item);
3042
3631
  }
3043
3632
  };
3044
- const expandCollectionsToMedium = (start, end) => {
3633
+ const expandCollectionsToMedium = (i) => {
3045
3634
  const collections = this.tabs[parseInt(tabIndex.toString(), 10)]
3046
3635
  .groups[parseInt(groupIndex.toString(), 10)].collections;
3047
- for (let i = start; i <= end; i++) {
3636
+ const item = collections[parseInt(i.toString(), 10)].items[0];
3637
+ if (item.displayOptions & DisplayMode.Classic) {
3048
3638
  const ele = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
3049
3639
  collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
3050
3640
  this.setItemSize(ele, collections[parseInt(i.toString(), 10)].items[0]);
@@ -3052,17 +3642,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3052
3642
  };
3053
3643
  if (orientation === ItemOrientation.Row) {
3054
3644
  // collection length is 1, then the it wll be covered in shrinked columns
3055
- if (group.collections.length !== 1) {
3645
+ if (!this.checkValidCollectionLength(group.collections)) {
3056
3646
  for (let k = 0; k < group.collections.length; k++) {
3057
3647
  const collection = group.collections[parseInt(k.toString(), 10)];
3058
3648
  for (let l = 0; l < collection.items.length; l++) {
3649
+ l = this.checkClassicItem(collection.items, l, true);
3650
+ if (l === collection.items.length) {
3651
+ continue;
3652
+ }
3059
3653
  const item = collection.items[parseInt(l.toString(), 10)];
3060
3654
  if (canExpandItem(item)) {
3061
3655
  const itemEle = activeContent.querySelector('#' + item.id);
3062
3656
  const valString = itemEle.getAttribute('data-medium-width');
3063
3657
  const value = valString ? parseInt(valString, 10) : null;
3064
3658
  if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
3065
- expandItemsToMedium(k, l, l, itemEle);
3659
+ expandItemToMedium(k, l, itemEle);
3066
3660
  if (!shouldSkip || shouldClear) {
3067
3661
  itemEle.removeAttribute('data-medium-width');
3068
3662
  }
@@ -3083,8 +3677,18 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3083
3677
  const itemEle = activeContent.querySelector('#' + collection.id);
3084
3678
  const valString = itemEle.getAttribute('data-medium-width');
3085
3679
  const value = valString ? parseInt(valString, 10) : null;
3086
- if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
3087
- expandItemsToMedium(k, 0, (collection.items.length === 2) ? 1 : 2, itemEle);
3680
+ const classicItems = [];
3681
+ for (let i = 0; i < collection.items.length; i++) {
3682
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3683
+ classicItems.push(i);
3684
+ }
3685
+ }
3686
+ if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
3687
+ expandItemToMedium(k, classicItems[0], itemEle);
3688
+ expandItemToMedium(k, classicItems[1], itemEle);
3689
+ if (classicItems.length === 3) {
3690
+ expandItemToMedium(k, classicItems[2], itemEle);
3691
+ }
3088
3692
  if (!shouldSkip || shouldClear) {
3089
3693
  itemEle.removeAttribute('data-medium-width');
3090
3694
  }
@@ -3104,10 +3708,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3104
3708
  const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3105
3709
  const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3106
3710
  if (orientation === ItemOrientation.Row) {
3107
- expandItemsToMedium(0, start, end, shrinkColumn);
3711
+ const collection = group.collections[0];
3712
+ const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
3713
+ expandItemToMedium(0, start, shrinkColumn);
3714
+ expandItemToMedium(0, l, shrinkColumn);
3715
+ // if l == end, then l is the last item, else L is the middle item. If l is middle then call the method for end.
3716
+ if (l !== end) {
3717
+ expandItemToMedium(0, end, shrinkColumn);
3718
+ }
3108
3719
  }
3109
3720
  else {
3110
- expandCollectionsToMedium(start, end);
3721
+ const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
3722
+ expandCollectionsToMedium(start);
3723
+ expandCollectionsToMedium(m);
3724
+ if (m !== end) {
3725
+ expandCollectionsToMedium(end);
3726
+ }
3111
3727
  }
3112
3728
  if (!shouldSkip || shouldClear) {
3113
3729
  shrinkColumn.removeAttribute('data-medium-width');
@@ -3128,32 +3744,46 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3128
3744
  if (shrinkColumns.length === 0) {
3129
3745
  return false;
3130
3746
  }
3131
- const expandItemsToLarge = (start, end, parentEle) => {
3747
+ const expandItemsToLarge = (start, end, parentEle, middle) => {
3132
3748
  const items = this.tabs[parseInt(tabIndex.toString(), 10)].
3133
3749
  groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
3134
- for (let i = end; i >= start; i--) {
3750
+ const reduce = (i) => {
3135
3751
  const item = items[parseInt(i.toString(), 10)];
3136
- const container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
3137
- const ele = container.querySelector('#' + item.id);
3138
- item.setProperties({ activeSize: RibbonItemSize.Large }, true);
3139
- this.setItemSize(ele, item);
3140
- parentEle.insertAdjacentElement('afterend', container);
3752
+ if (item.displayOptions & DisplayMode.Classic) {
3753
+ const container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
3754
+ const ele = container.querySelector('#' + item.id);
3755
+ item.setProperties({ activeSize: RibbonItemSize.Large }, true);
3756
+ this.setItemSize(ele, item);
3757
+ parentEle.insertAdjacentElement('afterend', container);
3758
+ }
3759
+ };
3760
+ reduce(start);
3761
+ if (middle) {
3762
+ reduce(middle);
3141
3763
  }
3764
+ reduce(end);
3142
3765
  if (!shouldSkip || shouldClear) {
3143
3766
  remove(parentEle);
3144
3767
  }
3145
3768
  };
3146
- const expandCollectionsToLarge = (start, end, parentEle) => {
3769
+ const expandCollectionsToLarge = (start, end, parentEle, middle) => {
3147
3770
  const collections = this.tabs[parseInt(tabIndex.toString(), 10)].
3148
3771
  groups[parseInt(groupIndex.toString(), 10)].collections;
3149
- for (let i = end; i >= start; i--) {
3772
+ const reduce = (i) => {
3150
3773
  const collection = collections[parseInt(i.toString(), 10)];
3151
- const collectionEle = parentEle.querySelector('#' + collection.id);
3152
- const ele = collectionEle.querySelector('#' + collection.items[0].id);
3153
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
3154
- this.setItemSize(ele, collection.items[0]);
3155
- parentEle.insertAdjacentElement('afterend', collectionEle);
3774
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
3775
+ const collectionEle = parentEle.querySelector('#' + collection.id);
3776
+ const ele = collectionEle.querySelector('#' + collection.items[0].id);
3777
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
3778
+ this.setItemSize(ele, collection.items[0]);
3779
+ parentEle.insertAdjacentElement('afterend', collectionEle);
3780
+ }
3781
+ };
3782
+ reduce(start);
3783
+ if (middle) {
3784
+ reduce(middle);
3156
3785
  }
3786
+ reduce(end);
3157
3787
  if (!shouldSkip || shouldClear) {
3158
3788
  remove(parentEle);
3159
3789
  }
@@ -3166,10 +3796,23 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3166
3796
  const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3167
3797
  const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3168
3798
  if (orientation === ItemOrientation.Row) {
3169
- expandItemsToLarge(start, end, shrinkColumn);
3799
+ const collection = group.collections[0];
3800
+ const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
3801
+ if (l === end) {
3802
+ expandItemsToLarge(start, end, shrinkColumn);
3803
+ }
3804
+ else {
3805
+ expandItemsToLarge(start, end, shrinkColumn, l);
3806
+ }
3170
3807
  }
3171
3808
  else {
3172
- expandCollectionsToLarge(start, end, shrinkColumn);
3809
+ const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
3810
+ if (m === end) {
3811
+ expandCollectionsToLarge(start, end, shrinkColumn);
3812
+ }
3813
+ else {
3814
+ expandCollectionsToLarge(start, end, shrinkColumn, m);
3815
+ }
3173
3816
  }
3174
3817
  if (!shouldSkip || shouldClear) {
3175
3818
  shrinkColumn.removeAttribute('data-large-width');
@@ -3225,7 +3868,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3225
3868
  //Expanding the items in the group to their original expanded state
3226
3869
  this.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
3227
3870
  this.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
3228
- const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
3871
+ const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this.enableRtl);
3229
3872
  this.tabs[parseInt(tabIndex.toString(), 10)].
3230
3873
  groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
3231
3874
  for (let j = 0; j < group.collections.length; j++) {
@@ -3234,7 +3877,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3234
3877
  for (let k = 0; k < collection.items.length; k++) {
3235
3878
  const item = collection.items[parseInt(k.toString(), 10)];
3236
3879
  const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3237
- this.addOverflowEvents(item, itemEle, dropdown);
3880
+ if (itemEle !== null) {
3881
+ this.addOverflowEvents(item, itemEle, dropdown);
3882
+ }
3238
3883
  }
3239
3884
  }
3240
3885
  }
@@ -3269,7 +3914,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3269
3914
  for (let k = 0; k < collection.items.length; k++) {
3270
3915
  const item = collection.items[parseInt(k.toString(), 10)];
3271
3916
  const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3272
- this.removeOverflowEvent(item, itemEle);
3917
+ if (itemEle !== null) {
3918
+ this.removeOverflowEvent(item, itemEle);
3919
+ }
3273
3920
  }
3274
3921
  }
3275
3922
  }
@@ -3317,6 +3964,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3317
3964
  }
3318
3965
  }
3319
3966
  ribbonTabSelecting(e) {
3967
+ this.currentControlIndex = 0;
3320
3968
  const nextTabId = e.selectingItem.getAttribute('data-id');
3321
3969
  const previousTabId = e.previousItem.getAttribute('data-id');
3322
3970
  let nextIndex = getIndex(this.tabs, ((tab) => (tab.id === nextTabId)));
@@ -3376,7 +4024,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3376
4024
  id: btnId
3377
4025
  });
3378
4026
  const overflowTarget = this.createElement('div', {
3379
- className: RIBBON_OVERFLOW_TARGET
4027
+ className: RIBBON_OVERFLOW_TARGET,
4028
+ attrs: { 'tabindex': '0' }
3380
4029
  });
3381
4030
  const overflowDDB = new DropDownButton({
3382
4031
  iconCss: OVERFLOW_ICON,
@@ -3394,9 +4043,113 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3394
4043
  }, overflowButton);
3395
4044
  this.element.classList.add(RIBBON_OVERFLOW);
3396
4045
  createTooltip(overflowTarget, this);
4046
+ let isGroupOf;
4047
+ overflowButton.onkeydown = overflowButton.onclick = () => { this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
4048
+ overflowTarget.onkeydown = (e) => (this.upDownKeyHandler(e, overflowTarget, isGroupOf), this);
3397
4049
  return overflowDDB;
3398
4050
  }
3399
- removeOverflowButton(overflowDDB) {
4051
+ upDownKeyHandler(e, target, isGroupOf) {
4052
+ let items;
4053
+ if (isGroupOf) {
4054
+ items = target.getElementsByClassName('e-ribbon-item');
4055
+ }
4056
+ else {
4057
+ const currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
4058
+ items = currentList.getElementsByClassName('e-ribbon-item');
4059
+ }
4060
+ const comboBoxEle = items[(!this.itemIndex || this.itemIndex < 0) ? 0 : this.itemIndex].querySelector('.e-control').classList.contains('e-combobox') ? items[(!this.itemIndex || this.itemIndex < 0) ? 0 : this.itemIndex].querySelector('.e-combobox') : null;
4061
+ let ribbonItem;
4062
+ if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
4063
+ if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
4064
+ if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
4065
+ this.itemIndex = 0;
4066
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4067
+ this.findDisabledItem(ribbonItem, items, true);
4068
+ if (comboBoxEle && e.key === 'Tab') {
4069
+ e.preventDefault();
4070
+ items[this.itemIndex].querySelector('.e-control').focus();
4071
+ }
4072
+ }
4073
+ else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
4074
+ this.itemIndex++;
4075
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4076
+ this.findDisabledItem(ribbonItem, items, true);
4077
+ }
4078
+ }
4079
+ else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
4080
+ if (comboBoxEle === null || (e.key === 'Tab')) {
4081
+ if (!this.itemIndex || this.itemIndex === -1) {
4082
+ this.itemIndex = items.length - 1;
4083
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4084
+ this.findDisabledItem(ribbonItem, items, false);
4085
+ if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
4086
+ e.preventDefault();
4087
+ items[this.itemIndex].querySelector('.e-control').focus();
4088
+ }
4089
+ }
4090
+ else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
4091
+ this.itemIndex--;
4092
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4093
+ this.findDisabledItem(ribbonItem, items, false);
4094
+ }
4095
+ }
4096
+ }
4097
+ target.setAttribute('index', this.itemIndex.toString());
4098
+ }
4099
+ const currentItemIndex = parseInt(target.getAttribute('index'), 10);
4100
+ const itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
4101
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
4102
+ if (itemType === 'ColorPicker') {
4103
+ if (e.key === 'Tab') {
4104
+ e.preventDefault();
4105
+ }
4106
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
4107
+ }
4108
+ else {
4109
+ if (e.key === 'Tab') {
4110
+ e.preventDefault();
4111
+ }
4112
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4113
+ }
4114
+ if (e.key === ' ' && (itemType === 'CheckBox')) {
4115
+ const checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
4116
+ const checkBox = getComponent(checkBoxEle, CheckBox);
4117
+ this.itemIndex = -1;
4118
+ checkBox.click();
4119
+ }
4120
+ }
4121
+ if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
4122
+ if (e.key === 'ArrowRight') {
4123
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
4124
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
4125
+ }
4126
+ if (e.key === 'ArrowLeft') {
4127
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
4128
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4129
+ }
4130
+ }
4131
+ if (e.key === 'Enter') {
4132
+ this.itemIndex = -1;
4133
+ }
4134
+ }
4135
+ findDisabledItem(ribbonItem, items, isIncrease) {
4136
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
4137
+ if (isIncrease) {
4138
+ if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4139
+ this.itemIndex = -1;
4140
+ }
4141
+ }
4142
+ else {
4143
+ if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4144
+ this.itemIndex = items.length;
4145
+ }
4146
+ }
4147
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
4148
+ isIncrease ? this.itemIndex++ : this.itemIndex--;
4149
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4150
+ }
4151
+ }
4152
+ removeOverflowButton(overflowDDB) {
3400
4153
  if (overflowDDB) {
3401
4154
  const btnEle = overflowDDB.element;
3402
4155
  destroyTooltip(overflowDDB.target);
@@ -3483,6 +4236,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3483
4236
  }
3484
4237
  }
3485
4238
  switchLayout() {
4239
+ this.currentControlIndex = 0;
3486
4240
  this.destroyScroll();
3487
4241
  this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
3488
4242
  this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
@@ -3497,6 +4251,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3497
4251
  if (this.activeLayout === 'Simplified') {
3498
4252
  for (let i = 0; i < groupList.length; i++) {
3499
4253
  const group = groupList[parseInt(i.toString(), 10)];
4254
+ const alignType = groupList[parseInt(i.toString(), 10)].orientation;
3500
4255
  if (group.isCollapsed) {
3501
4256
  group.setProperties({ isCollapsed: false }, true);
3502
4257
  this.removeDropdown(group.id);
@@ -3524,7 +4279,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3524
4279
  const itemList = collection.items;
3525
4280
  let item = collection.items[parseInt(k.toString(), 10)];
3526
4281
  let flag = true;
3527
- while ((flag) && (item.displayOptions === DisplayMode.None)) {
4282
+ while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
3528
4283
  k++;
3529
4284
  const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3530
4285
  const ele = itemEle.querySelector('#' + item.id);
@@ -3540,19 +4295,29 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3540
4295
  if (!flag) {
3541
4296
  break;
3542
4297
  }
3543
- const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3544
- const ele = itemEle.querySelector('#' + item.id);
3545
4298
  let size = ((item.allowedSizes === RibbonItemSize.Large) ||
3546
4299
  (item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
3547
- if (item.displayOptions === DisplayMode.Overflow) {
3548
- this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
3549
- size = RibbonItemSize.Medium;
3550
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
3551
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
4300
+ size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
4301
+ ? RibbonItemSize.Medium : size;
4302
+ let itemEle;
4303
+ if (!(item.displayOptions & DisplayMode.Classic)) {
4304
+ itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
4305
+ if (item.displayOptions & DisplayMode.Simplified) {
4306
+ groupCollection.append(itemEle);
3552
4307
  }
3553
4308
  }
3554
- item.setProperties({ activeSize: size }, true);
3555
- this.setItemSize(ele, item);
4309
+ else {
4310
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4311
+ if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
4312
+ this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
4313
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
4314
+ this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
4315
+ }
4316
+ }
4317
+ item.setProperties({ activeSize: size }, true);
4318
+ const ele = itemEle.querySelector('#' + item.id);
4319
+ this.setItemSize(ele, item);
4320
+ }
3556
4321
  }
3557
4322
  }
3558
4323
  if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
@@ -3599,22 +4364,37 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3599
4364
  groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
3600
4365
  }
3601
4366
  for (let k = 0; k < collection.items.length; k++) {
3602
- const item = collection.items[parseInt(k.toString(), 10)];
3603
- if (item.displayOptions === DisplayMode.None) {
3604
- const itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
3605
- groupCollection.append(itemEle);
3606
- }
3607
- else if ((item.displayOptions === DisplayMode.Overflow)) {
3608
- const itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
3609
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
3610
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
4367
+ const itemList = collection.items;
4368
+ let item = collection.items[parseInt(k.toString(), 10)];
4369
+ let flag = true;
4370
+ while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
4371
+ k++;
4372
+ let itemEle;
4373
+ if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
4374
+ if (item.displayOptions & DisplayMode.Simplified) {
4375
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4376
+ }
4377
+ else {
4378
+ itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
4379
+ }
4380
+ if (itemEle !== null) {
4381
+ const ele = itemEle.querySelector('#' + item.id);
4382
+ this.destroyFunction(item, ele);
4383
+ itemEle.remove();
4384
+ }
4385
+ }
4386
+ if (k < itemList.length) {
4387
+ item = itemList[parseInt(k.toString(), 10)];
4388
+ }
4389
+ else {
4390
+ flag = false;
3611
4391
  }
3612
- groupCollection.append(itemEle);
3613
- this.removeOverflowEvent(item, itemEle);
3614
4392
  }
3615
- else if ((item.displayOptions === DisplayMode.Simplified)) {
3616
- //To make sure the items are in proper order
3617
- const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4393
+ if (!flag) {
4394
+ break;
4395
+ }
4396
+ if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
4397
+ const itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
3618
4398
  groupCollection.append(itemEle);
3619
4399
  }
3620
4400
  else {
@@ -3652,6 +4432,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3652
4432
  this.overflowDDB = null;
3653
4433
  }
3654
4434
  }
4435
+ createLauncherIcon(groupId, groupContainer) {
4436
+ const launcherIcon = this.createElement('div', {
4437
+ className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
4438
+ id: groupId + LAUNCHER_ID,
4439
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
4440
+ });
4441
+ groupContainer.appendChild(launcherIcon);
4442
+ groupContainer.classList.add(RIBBON_LAUNCHER);
4443
+ EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
4444
+ EventHandler.add(launcherIcon, 'keydown', (e) => {
4445
+ if (e.key === 'Enter') {
4446
+ this.launcherIconClicked(groupId);
4447
+ }
4448
+ }, this);
4449
+ }
3655
4450
  launcherIconClicked(id) {
3656
4451
  const eventArgs = { groupId: id };
3657
4452
  this.trigger('launcherIconClick', eventArgs);
@@ -3688,19 +4483,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3688
4483
  groupContainer.appendChild(groupHeader);
3689
4484
  }
3690
4485
  if (group.showLauncherIcon) {
3691
- const launcherIcon = this.createElement('div', {
3692
- className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
3693
- id: group.id + LAUNCHER_ID,
3694
- attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
3695
- });
3696
- groupContainer.appendChild(launcherIcon);
3697
- groupContainer.classList.add(RIBBON_LAUNCHER);
3698
- EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, group.id), this);
3699
- EventHandler.add(launcherIcon, 'keydown', (e) => {
3700
- if (e.key === 'Enter') {
3701
- this.launcherIconClicked(group.id);
3702
- }
3703
- }, this);
4486
+ this.createLauncherIcon(group.id, groupContainer);
3704
4487
  }
3705
4488
  const elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
3706
4489
  append(elements, groupContent);
@@ -3768,13 +4551,40 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3768
4551
  }
3769
4552
  return collectionElements;
3770
4553
  }
4554
+ createRibbonItem(item, itemEle) {
4555
+ switch (item.type) {
4556
+ case 'Button':
4557
+ this.ribbonButtonModule.createButton(item, itemEle);
4558
+ break;
4559
+ case 'DropDown':
4560
+ this.ribbonDropDownModule.createDropDown(item, itemEle);
4561
+ break;
4562
+ case 'SplitButton':
4563
+ this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
4564
+ break;
4565
+ case 'CheckBox':
4566
+ this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
4567
+ break;
4568
+ case 'ColorPicker':
4569
+ this.ribbonColorPickerModule.createColorPicker(item, itemEle);
4570
+ break;
4571
+ case 'ComboBox':
4572
+ this.ribbonComboBoxModule.createComboBox(item, itemEle);
4573
+ break;
4574
+ case 'Template':
4575
+ this.createTemplateContent(item, itemEle);
4576
+ break;
4577
+ }
4578
+ }
3771
4579
  createItems(itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
3772
4580
  const itemElements = [];
3773
4581
  for (let i = 0; i < itemList.length; i++) {
3774
4582
  let item = itemList[parseInt(i.toString(), 10)];
3775
4583
  //To stop rendering of items with simplified mode position type as none
3776
4584
  let flag = true;
3777
- while ((this.activeLayout === 'Simplified') && (flag) && (item.displayOptions === DisplayMode.None)) {
4585
+ while (flag &&
4586
+ (((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
4587
+ ((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
3778
4588
  i++;
3779
4589
  if (i < itemList.length) {
3780
4590
  item = itemList[parseInt(i.toString(), 10)];
@@ -3808,30 +4618,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3808
4618
  else {
3809
4619
  itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
3810
4620
  }
3811
- switch (item.type) {
3812
- case 'Button':
3813
- this.ribbonButtonModule.createButton(item, itemEle);
3814
- break;
3815
- case 'DropDown':
3816
- this.ribbonDropDownModule.createDropDown(item, itemEle);
3817
- break;
3818
- case 'SplitButton':
3819
- this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
3820
- break;
3821
- case 'CheckBox':
3822
- this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
3823
- break;
3824
- case 'ColorPicker':
3825
- this.ribbonColorPickerModule.createColorPicker(item, itemEle);
3826
- break;
3827
- case 'ComboBox':
3828
- this.ribbonComboBoxModule.createComboBox(item, itemEle);
3829
- break;
3830
- case 'Template':
3831
- this.createTemplateContent(item, itemEle);
3832
- break;
3833
- }
3834
- if ((this.activeLayout === 'Simplified') && (item.displayOptions === DisplayMode.Overflow)) {
4621
+ this.createRibbonItem(item, itemEle);
4622
+ if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
3835
4623
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
3836
4624
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
3837
4625
  this.updatePopupItems(item, itemEle, isGroupOF, true);
@@ -3866,10 +4654,11 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3866
4654
  }
3867
4655
  createTemplateContent(item, itemElement) {
3868
4656
  const itemEle = this.createElement('div', {
3869
- className: item.disabled ? DISABLED_CSS + SPACE + item.cssClass : item.cssClass,
4657
+ className: item.cssClass ? (RIBBON_TEMPLATE + SPACE + item.cssClass) : RIBBON_TEMPLATE,
3870
4658
  id: item.id
3871
4659
  });
3872
4660
  if (item.disabled) {
4661
+ itemEle.classList.add(DISABLED_CSS);
3873
4662
  itemEle.setAttribute('disabled', '');
3874
4663
  }
3875
4664
  itemElement.appendChild(itemEle);
@@ -3934,13 +4723,15 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3934
4723
  for (const item of collection.items) {
3935
4724
  let ele = null;
3936
4725
  if (this.activeLayout === RibbonLayout.Classic) {
3937
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
4726
+ if (item.displayOptions & DisplayMode.Classic) {
4727
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
4728
+ }
3938
4729
  }
3939
4730
  else {
3940
- //Checks for Simplified and Auto options (Auto = simplified + popup)
4731
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
3941
4732
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
3942
4733
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
3943
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
4734
+ if (!ele) {
3944
4735
  ele = dropdown.target.querySelector('#' + item.id);
3945
4736
  if (item.type === 'DropDown') {
3946
4737
  this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
@@ -3993,15 +4784,17 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3993
4784
  for (const item of collection.items) {
3994
4785
  let ele;
3995
4786
  if (this.activeLayout === RibbonLayout.Classic) {
3996
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
3997
- contentEle.querySelector('#' + item.id);
4787
+ if (item.displayOptions & DisplayMode.Classic) {
4788
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
4789
+ contentEle.querySelector('#' + item.id);
4790
+ }
3998
4791
  }
3999
4792
  else {
4000
- //Checks for Simplified and Auto options (Auto = simplified + popup)
4793
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4001
4794
  ele = (item.displayOptions & DisplayMode.Simplified) ?
4002
4795
  contentEle.querySelector('#' + item.id) : null;
4003
4796
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4004
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
4797
+ if (!ele) {
4005
4798
  ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
4006
4799
  }
4007
4800
  }
@@ -4025,7 +4818,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4025
4818
  }
4026
4819
  destroyFunction(item, ele) {
4027
4820
  const moduleName = this.getItemModuleName(item);
4028
- if (moduleName !== 'template') {
4821
+ if (moduleName === 'colorpicker') {
4822
+ this.ribbonColorPickerModule.unwireColorPickerEvents(ele);
4823
+ }
4824
+ else if (moduleName !== 'template') {
4029
4825
  destroyControl(ele, moduleName);
4030
4826
  }
4031
4827
  if (item.ribbonTooltipSettings) {
@@ -4414,16 +5210,376 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4414
5210
  this.refreshLayout();
4415
5211
  }
4416
5212
  }
5213
+ /**
5214
+ * tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
5215
+ *
5216
+ * @param {RibbonTabModel} tab - Gets the ribbon tab model.
5217
+ * @returns {void}
5218
+ */
5219
+ updateTab(tab) {
5220
+ const tabId = tab.id;
5221
+ const index = getIndex(this.tabs, (e) => { return e.id === tabId; });
5222
+ if (index === -1) {
5223
+ return;
5224
+ }
5225
+ const contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
5226
+ const groups = this.tabs[parseInt(index.toString(), 10)].groups;
5227
+ const tabEle = this.tabObj.element;
5228
+ if (groups && (contentEle.innerHTML !== '')) {
5229
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5230
+ if (tab.cssClass) {
5231
+ if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
5232
+ contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5233
+ tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5234
+ }
5235
+ }
5236
+ // Check whether group is passed by the user, and if it is, then remove the old values.
5237
+ if (tab.groups) {
5238
+ for (const group of groups) {
5239
+ const dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
5240
+ for (const collection of group.collections) {
5241
+ for (const item of collection.items) {
5242
+ const ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5243
+ if (ele) {
5244
+ this.destroyFunction(item, ele);
5245
+ }
5246
+ }
5247
+ }
5248
+ if (dropdownElement) {
5249
+ this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
5250
+ }
5251
+ }
5252
+ const groupElements = contentEle.querySelectorAll('.e-ribbon-group');
5253
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5254
+ groupElements.forEach(groupEle => { groupEle.remove(); });
5255
+ }
5256
+ }
5257
+ if (index === this.selectedTab) {
5258
+ this.isAddRemove = true;
5259
+ }
5260
+ const ribbonTab = this.tabs[parseInt(index.toString(), 10)];
5261
+ ribbonTab.setProperties(tab, true);
5262
+ this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
5263
+ this.validateItemSize();
5264
+ if (contentEle.innerHTML === '') {
5265
+ // Check whether group is passed by the user and sets the updated values.
5266
+ if (tab.groups) {
5267
+ const elements = this.createGroups(ribbonTab.groups, index);
5268
+ append(elements, contentEle);
5269
+ }
5270
+ if (this.selectedTab === index) {
5271
+ this.refreshLayout();
5272
+ }
5273
+ // Check whether cssClass is passed by the user and sets the updated values.
5274
+ if (tab.cssClass) {
5275
+ contentEle.classList.add(ribbonTab.cssClass);
5276
+ tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
5277
+ }
5278
+ // Check whether header is passed by the user and sets the updated values.
5279
+ if (tab.header) {
5280
+ tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
5281
+ }
5282
+ }
5283
+ }
5284
+ /**
5285
+ * group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
5286
+ *
5287
+ * @param {RibbonGroupModel} group - Gets the ribbon group model.
5288
+ * @returns {void}
5289
+ */
5290
+ updateGroup(group) {
5291
+ const groupId = group.id;
5292
+ const itemProp = getGroup(this.tabs, groupId);
5293
+ if (!itemProp) {
5294
+ return;
5295
+ }
5296
+ if (this.selectedTab === itemProp.tabIndex) {
5297
+ this.clearOverflowResize();
5298
+ }
5299
+ //Check whether the tab items are rendered
5300
+ const contentEle = this.tabObj.items[itemProp.tabIndex].content;
5301
+ const groupEle = contentEle.querySelector('#' + groupId);
5302
+ const groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
5303
+ let dropdownElement;
5304
+ let dropdown;
5305
+ if (contentEle.innerHTML !== '') {
5306
+ if (itemProp.group.showLauncherIcon) {
5307
+ this.removeLauncherIcon(itemProp.group.id, null, contentEle);
5308
+ }
5309
+ if (this.activeLayout === RibbonLayout.Simplified) {
5310
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5311
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5312
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5313
+ }
5314
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5315
+ if (group.cssClass) {
5316
+ if (itemProp.group.cssClass) {
5317
+ groupEle.classList.remove(itemProp.group.cssClass);
5318
+ if (groupContainer) {
5319
+ groupContainer.classList.remove(itemProp.group.cssClass);
5320
+ }
5321
+ }
5322
+ }
5323
+ // Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
5324
+ if (group.collections || group.orientation) {
5325
+ if (itemProp.group.collections || itemProp.group.orientation) {
5326
+ for (const collection of itemProp.group.collections) {
5327
+ for (const item of collection.items) {
5328
+ this.removeItemElement(contentEle, item, dropdown);
5329
+ }
5330
+ }
5331
+ const collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
5332
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5333
+ collectionElements.forEach(collectionEle => { collectionEle.remove(); });
5334
+ if (group.orientation) {
5335
+ const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5336
+ const removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
5337
+ if (removeCss) {
5338
+ removeClass([groupContent], removeCss);
5339
+ }
5340
+ }
5341
+ }
5342
+ }
5343
+ if (this.activeLayout === RibbonLayout.Simplified) {
5344
+ if (itemProp.group.enableGroupOverflow) {
5345
+ if (dropdown.target.childElementCount === 0) {
5346
+ this.removeOverflowButton(dropdown);
5347
+ }
5348
+ }
5349
+ else {
5350
+ const ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5351
+ if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
5352
+ ofGroupContainer.remove();
5353
+ }
5354
+ const ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
5355
+ if (ofTabContainer && ofTabContainer.childElementCount === 0) {
5356
+ ofTabContainer.remove();
5357
+ }
5358
+ }
5359
+ }
5360
+ }
5361
+ const ribbongroup = itemProp.group;
5362
+ ribbongroup.setProperties(group, true);
5363
+ ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
5364
+ this.validateItemSize();
5365
+ if (contentEle.innerHTML !== '') {
5366
+ // Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
5367
+ if (group.showLauncherIcon) {
5368
+ this.createLauncherIcon(ribbongroup.id, groupContainer);
5369
+ }
5370
+ // Check whether collections or orientation is passed by the user and sets the updated values.
5371
+ if (group.collections || group.orientation) {
5372
+ const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5373
+ groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
5374
+ const elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5375
+ append(elements, groupContent);
5376
+ }
5377
+ if (this.selectedTab === itemProp.tabIndex) {
5378
+ this.refreshLayout();
5379
+ }
5380
+ // Check whether cssClass is passed by the user and sets the updated values.
5381
+ if (group.cssClass) {
5382
+ groupEle.classList.add(ribbongroup.cssClass);
5383
+ if (groupContainer) {
5384
+ groupContainer.classList.add(ribbongroup.cssClass);
5385
+ }
5386
+ }
5387
+ // Check whether header is passed by the user and sets the updated values.
5388
+ if (group.header) {
5389
+ if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
5390
+ const overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
5391
+ if (overflowHeader) {
5392
+ overflowHeader.innerText = ribbongroup.header;
5393
+ }
5394
+ }
5395
+ else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
5396
+ groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
5397
+ }
5398
+ else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
5399
+ const overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
5400
+ // need to set instance for dropdown
5401
+ const dropDownBtn = getInstance(overflowEle, DropDownButton);
5402
+ const overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
5403
+ if (overflowHeader) {
5404
+ overflowHeader.innerText = ribbongroup.header;
5405
+ }
5406
+ }
5407
+ }
5408
+ }
5409
+ }
5410
+ /**
5411
+ * collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
5412
+ *
5413
+ * @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
5414
+ * @returns {void}
5415
+ */
5416
+ updateCollection(collection) {
5417
+ const collectionId = collection.id;
5418
+ const itemProp = getCollection(this.tabs, collectionId);
5419
+ if (!itemProp) {
5420
+ return;
5421
+ }
5422
+ if (this.selectedTab === itemProp.tabIndex) {
5423
+ this.clearOverflowResize();
5424
+ }
5425
+ //Check whether the tab items are rendered
5426
+ const contentEle = this.tabObj.items[itemProp.tabIndex].content;
5427
+ const collectionEle = contentEle.querySelector('#' + collectionId);
5428
+ if (contentEle.innerHTML !== '') {
5429
+ let dropdownElement;
5430
+ let dropdown;
5431
+ if (this.activeLayout === RibbonLayout.Simplified) {
5432
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5433
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5434
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5435
+ }
5436
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5437
+ if (collection.cssClass) {
5438
+ if (itemProp.collection.cssClass) {
5439
+ collectionEle.classList.remove(itemProp.collection.cssClass);
5440
+ }
5441
+ }
5442
+ if (collection.items) {
5443
+ if (itemProp.collection.items) {
5444
+ for (const item of itemProp.collection.items) {
5445
+ this.removeItemElement(contentEle, item, dropdown);
5446
+ }
5447
+ }
5448
+ }
5449
+ }
5450
+ const ribboncollection = itemProp.collection;
5451
+ ribboncollection.setProperties(collection, true);
5452
+ ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
5453
+ this.validateItemSize();
5454
+ if (contentEle.innerHTML !== '') {
5455
+ if (collection.items) {
5456
+ const groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5457
+ const elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5458
+ append(elements, collectionEle);
5459
+ }
5460
+ }
5461
+ if (this.selectedTab === itemProp.tabIndex) {
5462
+ this.refreshLayout();
5463
+ }
5464
+ // Check whether cssClass is passed by the user and sets the updated values.
5465
+ if (collection.cssClass) {
5466
+ collectionEle.classList.add(ribboncollection.cssClass);
5467
+ }
5468
+ }
5469
+ /**
5470
+ * item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
5471
+ *
5472
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
5473
+ * @returns {void}
5474
+ */
5475
+ updateItem(item) {
5476
+ const itemId = item.id;
5477
+ const itemProp = getItem(this.tabs, itemId);
5478
+ if (!itemProp) {
5479
+ return;
5480
+ }
5481
+ if (this.selectedTab === itemProp.tabIndex) {
5482
+ this.clearOverflowResize();
5483
+ }
5484
+ //Check whether the tab items are rendered
5485
+ const contentEle = this.tabObj.items[itemProp.tabIndex].content;
5486
+ const groupEle = contentEle.querySelector('#' + itemProp.group.id);
5487
+ const groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5488
+ let itemContainer = null;
5489
+ let itemEle = null;
5490
+ let dropdownElement;
5491
+ let dropdown;
5492
+ if (contentEle.innerHTML !== '') {
5493
+ if (this.activeLayout === RibbonLayout.Simplified) {
5494
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5495
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5496
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5497
+ }
5498
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
5499
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5500
+ itemEle = dropdown.target.querySelector('#' + itemId);
5501
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
5502
+ const collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
5503
+ if (collectionEle) {
5504
+ collectionEle.appendChild(itemContainer);
5505
+ }
5506
+ }
5507
+ }
5508
+ else {
5509
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5510
+ itemEle = contentEle.querySelector('#' + itemId);
5511
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
5512
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
5513
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
5514
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
5515
+ }
5516
+ }
5517
+ }
5518
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5519
+ if (item.cssClass) {
5520
+ if (itemProp.item.cssClass) {
5521
+ itemContainer.classList.remove(itemProp.item.cssClass);
5522
+ }
5523
+ }
5524
+ this.destroyFunction(itemProp.item, itemEle);
5525
+ itemEle.remove();
5526
+ const removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
5527
+ if (removeCss) {
5528
+ removeClass([itemContainer], removeCss);
5529
+ }
5530
+ }
5531
+ const ribbonItem = itemProp.item;
5532
+ ribbonItem.setProperties(item, true);
5533
+ this.validateItemSize();
5534
+ if (contentEle.innerHTML !== '') {
5535
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
5536
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5537
+ }
5538
+ else {
5539
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5540
+ }
5541
+ // To avoid undefined items condition is added
5542
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
5543
+ itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
5544
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
5545
+ }
5546
+ let size = ribbonItem.activeSize;
5547
+ if (this.activeLayout === 'Simplified') {
5548
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
5549
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
5550
+ ribbonItem.setProperties({ activeSize: size }, true);
5551
+ }
5552
+ if (size & RibbonItemSize.Large) {
5553
+ itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
5554
+ }
5555
+ else {
5556
+ itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
5557
+ }
5558
+ this.createRibbonItem(ribbonItem, itemContainer);
5559
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
5560
+ if (dropdown.target.childElementCount === 0) {
5561
+ this.removeOverflowButton(dropdown);
5562
+ }
5563
+ }
5564
+ if (this.selectedTab === itemProp.tabIndex) {
5565
+ this.refreshLayout();
5566
+ }
5567
+ if (item.cssClass) {
5568
+ itemContainer.classList.add(ribbonItem.cssClass);
5569
+ }
5570
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
5571
+ }
5572
+ }
4417
5573
  removeItemElement(contentEle, item, dropdown) {
4418
5574
  let ele = null;
4419
5575
  if (this.activeLayout === RibbonLayout.Classic) {
4420
- ele = contentEle.querySelector('#' + item.id);
5576
+ ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
4421
5577
  }
4422
5578
  else {
4423
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5579
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4424
5580
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
4425
5581
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4426
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5582
+ if (!ele) {
4427
5583
  ele = dropdown.target.querySelector('#' + item.id);
4428
5584
  }
4429
5585
  }
@@ -4474,6 +5630,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4474
5630
  EventHandler.remove(window, 'resize', this.resizeHandler);
4475
5631
  }
4476
5632
  destroy() {
5633
+ this.keyboardModuleRibbon.destroy();
5634
+ this.keyboardModuleRibbon = null;
4477
5635
  destroyTooltip(this.element);
4478
5636
  this.destroyTabItems(this.tabs);
4479
5637
  this.removeExpandCollapse();
@@ -4523,6 +5681,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4523
5681
  case 'isMinimized':
4524
5682
  this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
4525
5683
  this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
5684
+ if (!this.isMinimized) {
5685
+ this.refreshLayout();
5686
+ }
4526
5687
  break;
4527
5688
  case 'locale':
4528
5689
  this.updateCommonProperty({ locale: this.locale });
@@ -4546,7 +5707,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4546
5707
  if (group.showLauncherIcon) {
4547
5708
  const className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
4548
5709
  if (group.isCollapsed) {
4549
- const element = tabContent.querySelector('.' + RIBBON_GROUP_OVERFLOW_DDB);
5710
+ const element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
4550
5711
  const dropdown = getComponent(element, DropDownButton);
4551
5712
  const launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
4552
5713
  launcherIconEle.className = className;
@@ -4571,19 +5732,26 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4571
5732
  break;
4572
5733
  case 'width':
4573
5734
  this.element.style.width = formatUnit(newProp.width);
5735
+ this.refreshLayout();
4574
5736
  break;
4575
5737
  case 'fileMenu':
4576
5738
  if (this.ribbonFileMenuModule) {
4577
5739
  this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
4578
5740
  }
5741
+ const toolbarEle = this.tabObj['tbObj'];
5742
+ toolbarEle.refreshOverflow();
4579
5743
  break;
4580
5744
  case 'helpPaneTemplate':
4581
5745
  if (this.ribbonTempEle) {
4582
5746
  remove(this.ribbonTempEle);
5747
+ this.ribbonTempEle = null;
5748
+ this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
4583
5749
  }
4584
5750
  if (this.helpPaneTemplate) {
4585
5751
  this.createHelpPaneTemplate();
4586
5752
  }
5753
+ const toolbar = this.tabObj['tbObj'];
5754
+ toolbar.refreshOverflow();
4587
5755
  break;
4588
5756
  }
4589
5757
  }
@@ -4963,5 +6131,5 @@ class RibbonFileMenu {
4963
6131
  // export all modules from current location
4964
6132
  // example: export * from './module'
4965
6133
 
4966
- export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_FILE_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, RibbonTooltip, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonFileMenu };
6134
+ export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_TEMPLATE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_FILE_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, RibbonTooltip, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonFileMenu };
4967
6135
  //# sourceMappingURL=ej2-ribbon.es2015.js.map