@syncfusion/ej2-ribbon 21.2.3 → 22.1.39

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 (102) hide show
  1. package/.eslintrc.json +1 -0
  2. package/CHANGELOG.md +8 -0
  3. package/dist/ej2-ribbon.umd.min.js +2 -2
  4. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-ribbon.es2015.js +1254 -165
  6. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  7. package/dist/es6/ej2-ribbon.es5.js +1275 -180
  8. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  9. package/dist/global/ej2-ribbon.min.js +2 -2
  10. package/dist/global/ej2-ribbon.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +16 -13
  13. package/src/ribbon/base/interface.d.ts +6 -6
  14. package/src/ribbon/base/interface.js +6 -6
  15. package/src/ribbon/base/ribbon-model.d.ts +2 -2
  16. package/src/ribbon/base/ribbon.d.ts +43 -1
  17. package/src/ribbon/base/ribbon.js +1074 -163
  18. package/src/ribbon/base/utils.d.ts +2 -2
  19. package/src/ribbon/base/utils.js +16 -10
  20. package/src/ribbon/items/ribbon-button.js +1 -0
  21. package/src/ribbon/items/ribbon-checkbox.js +1 -0
  22. package/src/ribbon/items/ribbon-colorpicker.js +1 -0
  23. package/src/ribbon/items/ribbon-combobox.js +1 -0
  24. package/src/ribbon/items/ribbon-dropdown.d.ts +7 -1
  25. package/src/ribbon/items/ribbon-dropdown.js +152 -1
  26. package/src/ribbon/items/ribbon-splitbutton.js +24 -0
  27. package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +10 -5
  28. package/src/ribbon/models/ribbon-combobox-settings.d.ts +10 -5
  29. package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +3 -1
  30. package/src/ribbon/models/ribbon-file-menu-settings.d.ts +3 -1
  31. package/src/ribbon/models/ribbon-item-model.d.ts +1 -1
  32. package/src/ribbon/models/ribbon-item.d.ts +1 -1
  33. package/styles/bootstrap-dark.css +27 -0
  34. package/styles/bootstrap.css +27 -0
  35. package/styles/bootstrap4.css +27 -0
  36. package/styles/bootstrap5-dark.css +27 -0
  37. package/styles/bootstrap5.css +27 -0
  38. package/styles/fabric-dark.css +27 -0
  39. package/styles/fabric.css +27 -0
  40. package/styles/fluent-dark.css +27 -0
  41. package/styles/fluent.css +27 -0
  42. package/styles/highcontrast-light.css +27 -0
  43. package/styles/highcontrast.css +31 -4
  44. package/styles/material-dark.css +27 -0
  45. package/styles/material.css +27 -0
  46. package/styles/material3-dark.css +1672 -0
  47. package/styles/material3-dark.scss +3 -0
  48. package/styles/material3.css +1728 -0
  49. package/styles/material3.scss +3 -0
  50. package/styles/ribbon/_bootstrap-dark-definition.scss +4 -0
  51. package/styles/ribbon/_bootstrap-definition.scss +4 -0
  52. package/styles/ribbon/_bootstrap4-definition.scss +4 -0
  53. package/styles/ribbon/_bootstrap5-definition.scss +4 -0
  54. package/styles/ribbon/_fabric-dark-definition.scss +4 -0
  55. package/styles/ribbon/_fabric-definition.scss +4 -0
  56. package/styles/ribbon/_fluent-definition.scss +4 -0
  57. package/styles/ribbon/_fusionnew-definition.scss +4 -0
  58. package/styles/ribbon/_highcontrast-definition.scss +6 -2
  59. package/styles/ribbon/_highcontrast-light-definition.scss +4 -0
  60. package/styles/ribbon/_layout.scss +28 -0
  61. package/styles/ribbon/_material-dark-definition.scss +4 -0
  62. package/styles/ribbon/_material-definition.scss +4 -0
  63. package/styles/ribbon/_material3-dark-definition.scss +1 -0
  64. package/styles/ribbon/_material3-definition.scss +210 -0
  65. package/styles/ribbon/_tailwind-definition.scss +4 -0
  66. package/styles/ribbon/bootstrap-dark.css +27 -0
  67. package/styles/ribbon/bootstrap-dark.scss +1 -0
  68. package/styles/ribbon/bootstrap.css +27 -0
  69. package/styles/ribbon/bootstrap.scss +1 -0
  70. package/styles/ribbon/bootstrap4.css +27 -0
  71. package/styles/ribbon/bootstrap4.scss +1 -0
  72. package/styles/ribbon/bootstrap5-dark.css +27 -0
  73. package/styles/ribbon/bootstrap5-dark.scss +1 -0
  74. package/styles/ribbon/bootstrap5.css +27 -0
  75. package/styles/ribbon/bootstrap5.scss +1 -0
  76. package/styles/ribbon/fabric-dark.css +27 -0
  77. package/styles/ribbon/fabric-dark.scss +1 -0
  78. package/styles/ribbon/fabric.css +27 -0
  79. package/styles/ribbon/fabric.scss +1 -0
  80. package/styles/ribbon/fluent-dark.css +27 -0
  81. package/styles/ribbon/fluent-dark.scss +1 -0
  82. package/styles/ribbon/fluent.css +27 -0
  83. package/styles/ribbon/fluent.scss +1 -0
  84. package/styles/ribbon/highcontrast-light.css +27 -0
  85. package/styles/ribbon/highcontrast-light.scss +1 -0
  86. package/styles/ribbon/highcontrast.css +31 -4
  87. package/styles/ribbon/highcontrast.scss +1 -0
  88. package/styles/ribbon/icons/_material3-dark.scss +1 -0
  89. package/styles/ribbon/material-dark.css +27 -0
  90. package/styles/ribbon/material-dark.scss +1 -0
  91. package/styles/ribbon/material.css +27 -0
  92. package/styles/ribbon/material.scss +1 -0
  93. package/styles/ribbon/material3-dark.css +1672 -0
  94. package/styles/ribbon/material3-dark.scss +19 -0
  95. package/styles/ribbon/material3.css +1728 -0
  96. package/styles/ribbon/material3.scss +19 -0
  97. package/styles/ribbon/tailwind-dark.css +27 -0
  98. package/styles/ribbon/tailwind-dark.scss +1 -0
  99. package/styles/ribbon/tailwind.css +27 -0
  100. package/styles/ribbon/tailwind.scss +1 -0
  101. package/styles/tailwind-dark.css +27 -0
  102. package/styles/tailwind.css +27 -0
@@ -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.
@@ -1193,6 +1193,7 @@ var RibbonButton = /** @__PURE__ @class */ (function () {
1193
1193
  RibbonButton.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
1194
1194
  var _this = this;
1195
1195
  var buttonEle = itemEle.querySelector('#' + item.id);
1196
+ buttonEle.setAttribute('data-control', item.type.toString());
1196
1197
  var buttonObj = getComponent(buttonEle, Button);
1197
1198
  buttonObj.setProperties({ cssClass: buttonObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
1198
1199
  buttonEle.onclick = function (e) {
@@ -1340,6 +1341,7 @@ var RibbonCheckBox = /** @__PURE__ @class */ (function () {
1340
1341
  RibbonCheckBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
1341
1342
  var _this = this;
1342
1343
  var inputEle = itemEle.querySelector('#' + item.id);
1344
+ inputEle.setAttribute('data-control', item.type.toString());
1343
1345
  var checkBoxObj = getComponent(inputEle, CheckBox);
1344
1346
  checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
1345
1347
  checkBoxObj.dataBind();
@@ -1497,6 +1499,7 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
1497
1499
  RibbonColorPicker.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
1498
1500
  var _this = this;
1499
1501
  var colorPickerEle = itemEle.querySelector('#' + item.id);
1502
+ colorPickerEle.setAttribute('data-control', item.type.toString());
1500
1503
  var colorPickerObj = getComponent(colorPickerEle, ColorPicker);
1501
1504
  colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
1502
1505
  //Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
@@ -1690,6 +1693,7 @@ var RibbonComboBox = /** @__PURE__ @class */ (function () {
1690
1693
  RibbonComboBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
1691
1694
  var _this = this;
1692
1695
  var inputEle = itemEle.querySelector('#' + item.id);
1696
+ inputEle.setAttribute('data-control', item.type.toString());
1693
1697
  var comboBoxObj = getComponent(inputEle, ComboBox);
1694
1698
  comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
1695
1699
  comboBoxObj.close = function (e) {
@@ -1863,6 +1867,7 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
1863
1867
  RibbonDropDown.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
1864
1868
  var _this = this;
1865
1869
  var dropdownElement = itemEle.querySelector('#' + item.id);
1870
+ dropdownElement.setAttribute('data-control', item.type.toString());
1866
1871
  var dropdown = getComponent(dropdownElement, DropDownButton);
1867
1872
  dropdown.cssClass = dropdown.cssClass + SPACE + RIBBON_POPUP_CONTROL;
1868
1873
  dropdown.dataBind();
@@ -1920,10 +1925,13 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
1920
1925
  * @returns {void}
1921
1926
  * @hidden
1922
1927
  */
1923
- RibbonDropDown.prototype.createOverFlowDropDown = function (id, name, iconCss, groupEle, overflowEle) {
1928
+ RibbonDropDown.prototype.createOverFlowDropDown = function (id, name, iconCss, groupEle, overflowEle, enableRtl) {
1929
+ var _this = this;
1930
+ this.enableRtl = enableRtl;
1924
1931
  var buttonEle = this.parent.createElement('button', {
1925
1932
  id: id + OVERFLOW_ID + DROPDOWN_ID
1926
1933
  });
1934
+ groupEle.setAttribute('tabindex', '0');
1927
1935
  overflowEle.appendChild(buttonEle);
1928
1936
  var dropdown = new DropDownButton({
1929
1937
  iconCss: iconCss,
@@ -1939,8 +1947,155 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
1939
1947
  }
1940
1948
  }, buttonEle);
1941
1949
  createTooltip(groupEle, this.parent);
1950
+ buttonEle.onclick = buttonEle.onkeydown = function () { _this.itemIndex = 0; };
1951
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1952
+ groupEle.onkeydown = function (e) { _this.keyActionHandler(e, groupEle), _this; };
1942
1953
  return dropdown;
1943
1954
  };
1955
+ RibbonDropDown.prototype.keyActionHandler = function (e, target) {
1956
+ var items = target.querySelectorAll('.e-control');
1957
+ var comboBoxElements = target.querySelectorAll('.e-combobox');
1958
+ var comboBoxEle;
1959
+ if (comboBoxElements) {
1960
+ for (var i = 0; i < comboBoxElements.length; i++) {
1961
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
1962
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
1963
+ }
1964
+ }
1965
+ }
1966
+ if (comboBoxEle) {
1967
+ for (var i = 0; i < items.length; i++) {
1968
+ if (items[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
1969
+ if (items[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
1970
+ this.itemIndex = i;
1971
+ }
1972
+ }
1973
+ }
1974
+ }
1975
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
1976
+ e.target.classList.contains('e-ribbon-last-item') || e.target.classList.contains('e-ribbon-first-item')) {
1977
+ if (e.key === 'ArrowRight' || (!e.shiftKey && e.key === 'Tab')) {
1978
+ this.handleNavigation(e, !this.enableRtl, items);
1979
+ }
1980
+ if (e.key === 'ArrowLeft' || (e.shiftKey && e.key === 'Tab')) {
1981
+ this.handleNavigation(e, this.enableRtl, items);
1982
+ }
1983
+ }
1984
+ };
1985
+ RibbonDropDown.prototype.handleNavigation = function (e, enableRtl, items) {
1986
+ if (!(items[0].classList.contains('e-ribbon-first-item'))) {
1987
+ items[0].classList.add('e-ribbon-first-item');
1988
+ }
1989
+ if (!(items[items.length - 1].classList.contains('e-ribbon-last-item'))) {
1990
+ items[items.length - 1].classList.add('e-ribbon-last-item');
1991
+ }
1992
+ if (enableRtl) {
1993
+ if (this.itemIndex === 0 && items[parseInt(this.itemIndex.toString(), 10)].classList.contains('e-ribbon-first-item')) {
1994
+ this.updateItemIndex(e, items, true);
1995
+ }
1996
+ if (!e.target.classList.contains('e-combobox') && !e.target.classList.contains('e-ribbon-last-item') &&
1997
+ !e.target.classList.contains('e-ribbon-group-container') && (e.target.classList.contains('e-ribbon-first-item')
1998
+ || this.itemIndex !== 0) && e.target.classList.contains('e-control')) {
1999
+ this.itemIndex++;
2000
+ this.updateItemIndex(e, items, true);
2001
+ }
2002
+ if (e.target.classList.contains('e-ribbon-last-item')) {
2003
+ var launcherIcon = false;
2004
+ launcherIcon = this.focusLauncherIcon(e, items);
2005
+ if (!launcherIcon) {
2006
+ this.itemIndex = 0;
2007
+ this.updateItemIndex(e, items, true);
2008
+ }
2009
+ }
2010
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
2011
+ this.itemIndex = 0;
2012
+ this.updateItemIndex(e, items, true);
2013
+ }
2014
+ }
2015
+ else {
2016
+ if (!e.target.classList.contains('e-combobox') && this.itemIndex !== 0) {
2017
+ this.itemIndex--;
2018
+ this.updateItemIndex(e, items, false);
2019
+ }
2020
+ if (e.target.classList.contains('e-ribbon-first-item')) {
2021
+ var launcherIcon = false;
2022
+ launcherIcon = this.focusLauncherIcon(e, items);
2023
+ if (!launcherIcon) {
2024
+ this.itemIndex = items.length - 1;
2025
+ this.updateItemIndex(e, items, false);
2026
+ }
2027
+ }
2028
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
2029
+ this.itemIndex = items.length - 1;
2030
+ this.updateItemIndex(e, items, false);
2031
+ }
2032
+ }
2033
+ if (e.target.classList.contains('e-combobox') && (e.key === 'Tab')) {
2034
+ if (enableRtl) {
2035
+ if (this.itemIndex < items.length - 1) {
2036
+ this.itemIndex++;
2037
+ }
2038
+ }
2039
+ else {
2040
+ if (this.itemIndex > 0) {
2041
+ this.itemIndex--;
2042
+ }
2043
+ }
2044
+ }
2045
+ };
2046
+ RibbonDropDown.prototype.focusLauncherIcon = function (e, items) {
2047
+ var groupContainer = items[parseInt(this.itemIndex.toString(), 10)].closest('.e-ribbon-group-container');
2048
+ var launcherIconEle;
2049
+ if (groupContainer) {
2050
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
2051
+ }
2052
+ if (launcherIconEle) {
2053
+ if (e.key === 'Tab') {
2054
+ e.preventDefault();
2055
+ }
2056
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
2057
+ return true;
2058
+ }
2059
+ else {
2060
+ return false;
2061
+ }
2062
+ };
2063
+ RibbonDropDown.prototype.updateItemIndex = function (e, items, enableRtl) {
2064
+ var ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
2065
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
2066
+ if (enableRtl) {
2067
+ if (this.itemIndex < items.length - 1) {
2068
+ this.itemIndex++;
2069
+ }
2070
+ else {
2071
+ var launcherIcon = false;
2072
+ launcherIcon = this.focusLauncherIcon(e, items);
2073
+ if (launcherIcon) {
2074
+ break;
2075
+ }
2076
+ this.itemIndex = 0;
2077
+ }
2078
+ }
2079
+ else {
2080
+ if (this.itemIndex > 0) {
2081
+ this.itemIndex--;
2082
+ }
2083
+ else {
2084
+ var launcherIcon = false;
2085
+ launcherIcon = this.focusLauncherIcon(e, items);
2086
+ if (launcherIcon) {
2087
+ break;
2088
+ }
2089
+ this.itemIndex = items.length - 1;
2090
+ }
2091
+ }
2092
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
2093
+ }
2094
+ if (e.key === 'Tab') {
2095
+ e.preventDefault();
2096
+ }
2097
+ items[parseInt(this.itemIndex.toString(), 10)].focus();
2098
+ };
1944
2099
  /**
1945
2100
  * Removes Overflow DropDown.
1946
2101
  *
@@ -2141,6 +2296,13 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
2141
2296
  }
2142
2297
  }
2143
2298
  }, buttonEle);
2299
+ var dropdownEle = buttonEle.parentElement.querySelector('.e-dropdown-btn');
2300
+ dropdownEle.onkeydown = function (e) {
2301
+ if (e.key === 'Enter') {
2302
+ e.stopImmediatePropagation();
2303
+ dropdownEle.click();
2304
+ }
2305
+ };
2144
2306
  this.setContent(item, splitbutton);
2145
2307
  var wrapper = splitbutton['wrapper'];
2146
2308
  EventHandler.add(wrapper, 'mouseenter', function () { wrapper.classList.add(RIBBON_HOVER); }, this);
@@ -2158,9 +2320,26 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
2158
2320
  RibbonSplitButton.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
2159
2321
  var _this = this;
2160
2322
  var splitButtonEle = itemEle.querySelector('#' + item.id);
2323
+ splitButtonEle.setAttribute('data-control', item.type.toString());
2161
2324
  var splitbutton = getComponent(splitButtonEle, SplitButton);
2162
2325
  splitbutton.cssClass = splitbutton.cssClass + SPACE + RIBBON_POPUP_CONTROL;
2163
2326
  splitbutton.dataBind();
2327
+ var dropdownEle = splitButtonEle.parentElement.querySelector('.e-dropdown-btn');
2328
+ var ddbId = dropdownEle.getAttribute('id');
2329
+ var popupEle = document.querySelector('#' + ddbId + '-popup');
2330
+ dropdownEle.onkeydown = function (e) {
2331
+ if (e.key === 'Enter') {
2332
+ e.stopImmediatePropagation();
2333
+ dropdownEle.click();
2334
+ }
2335
+ };
2336
+ popupEle.onkeydown = function (e) {
2337
+ if (e.key === 'Enter') {
2338
+ e.preventDefault();
2339
+ splitbutton['wrapper'].classList.remove('e-ribbon-open');
2340
+ popupEle.querySelector('.e-focused').click();
2341
+ }
2342
+ };
2164
2343
  var target;
2165
2344
  splitbutton.beforeClose = function (e) {
2166
2345
  if (item.splitButtonSettings.beforeClose) {
@@ -2333,7 +2512,7 @@ function getIndex(arr, condition) {
2333
2512
  /**
2334
2513
  * Gets template content based on the template property value.
2335
2514
  *
2336
- * @param {string | HTMLElement} template - Template property value.
2515
+ * @param {string | HTMLElement| Function} template - Template property value.
2337
2516
  * @returns {Function} - Return template function.
2338
2517
  * @hidden
2339
2518
  */
@@ -2494,16 +2673,21 @@ function getItemElement(parent, id, itemProp) {
2494
2673
  return null;
2495
2674
  }
2496
2675
  if (parent.activeLayout === RibbonLayout.Classic) {
2497
- contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
2498
- : contentEle;
2499
- return contentEle.querySelector('#' + id);
2676
+ if (itemProp.item.displayOptions & DisplayMode.Classic) {
2677
+ contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
2678
+ : contentEle;
2679
+ return contentEle.querySelector('#' + id);
2680
+ }
2681
+ else {
2682
+ return null;
2683
+ }
2500
2684
  }
2501
2685
  else {
2502
- //Checks for Simplified and Auto options (Auto = simplified + popup)
2686
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
2503
2687
  var ele = (itemProp.item.displayOptions & DisplayMode.Simplified) ?
2504
2688
  contentEle.querySelector('#' + itemProp.item.id) : null;
2505
2689
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
2506
- if (!ele && (DisplayMode.Simplified !== DisplayMode.None)) {
2690
+ if (!ele) {
2507
2691
  var dropdown = itemProp.group.enableGroupOverflow ?
2508
2692
  getComponent(contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID), DropDownButton)
2509
2693
  : parent.overflowDDB;
@@ -2550,7 +2734,7 @@ function setToolTipContent(args, tooltip, tooltipData) {
2550
2734
  content.appendChild(textContainer);
2551
2735
  if (data.iconCss) {
2552
2736
  var customCss = tooltip.createElement('div', {
2553
- className: data.cssClass ? data.cssClass + ' ' + data.iconCss + ' ' + RIBBON_TOOLTIP_ICON : data.iconCss + ' ' + RIBBON_TOOLTIP_ICON
2737
+ className: data.iconCss + ' ' + RIBBON_TOOLTIP_ICON
2554
2738
  });
2555
2739
  textContainer.appendChild(customCss);
2556
2740
  }
@@ -2562,7 +2746,8 @@ function setToolTipContent(args, tooltip, tooltipData) {
2562
2746
  textContainer.appendChild(tooltipContent);
2563
2747
  }
2564
2748
  tooltip.setProperties({
2565
- content: content
2749
+ content: content,
2750
+ cssClass: data.cssClass ? data.cssClass + ' ' + RIBBON_TOOLTIP : RIBBON_TOOLTIP
2566
2751
  });
2567
2752
  }
2568
2753
  /**
@@ -2575,9 +2760,9 @@ function setToolTipContent(args, tooltip, tooltipData) {
2575
2760
  */
2576
2761
  function createTooltip(element, ribbon) {
2577
2762
  var ribbonTooltip = new Tooltip({
2578
- cssClass: (RIBBON_TOOLTIP + ' ' + ribbon.cssClass).trim(),
2579
2763
  target: '.' + RIBBON_TOOLTIP_TARGET,
2580
- beforeRender: beforeTooltipRender.bind(this)
2764
+ beforeRender: beforeTooltipRender.bind(this),
2765
+ windowCollision: true
2581
2766
  });
2582
2767
  ribbonTooltip.appendTo(element);
2583
2768
  /**
@@ -2663,6 +2848,12 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2663
2848
  this.idIndex = 0;
2664
2849
  this.tooltipData = [];
2665
2850
  this.isAddRemove = false;
2851
+ this.keyConfigs = {
2852
+ leftarrow: 'leftarrow',
2853
+ rightarrow: 'rightarrow',
2854
+ tab: 'tab',
2855
+ shiftTab: 'shift+tab'
2856
+ };
2666
2857
  };
2667
2858
  /**
2668
2859
  * Get the properties to be maintained in the persisted state.
@@ -2704,12 +2895,239 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2704
2895
  this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
2705
2896
  }
2706
2897
  this.createHelpPaneTemplate();
2898
+ var toolbar = this.tabObj['tbObj'];
2899
+ toolbar.refreshOverflow();
2707
2900
  createTooltip(this.element, this);
2708
2901
  this.wireEvents();
2902
+ this.wireKeyboardEvent();
2903
+ this.currentControlIndex = 0;
2709
2904
  };
2710
2905
  Ribbon.prototype.wireEvents = function () {
2711
2906
  EventHandler.add(window, 'resize', this.resizeHandler, this);
2712
2907
  };
2908
+ Ribbon.prototype.wireKeyboardEvent = function () {
2909
+ this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
2910
+ keyAction: this.keyActionHandler.bind(this),
2911
+ keyConfigs: this.keyConfigs,
2912
+ eventName: 'keydown'
2913
+ });
2914
+ };
2915
+ Ribbon.prototype.keyActionHandler = function (e) {
2916
+ if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
2917
+ e.preventDefault();
2918
+ }
2919
+ var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2920
+ var ribbonControls = activeContent.querySelectorAll('.e-control');
2921
+ var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
2922
+ var comboBoxEle;
2923
+ if (comboBoxElements) {
2924
+ for (var i = 0; i < comboBoxElements.length; i++) {
2925
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2926
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
2927
+ }
2928
+ }
2929
+ }
2930
+ if (comboBoxEle) {
2931
+ for (var i = 0; i < ribbonControls.length; i++) {
2932
+ if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
2933
+ if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2934
+ this.currentControlIndex = i;
2935
+ }
2936
+ }
2937
+ }
2938
+ }
2939
+ if (this.currentControlIndex === 0) {
2940
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2941
+ while (item && item.classList.contains('e-disabled')) {
2942
+ this.currentControlIndex++;
2943
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2944
+ }
2945
+ }
2946
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
2947
+ e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
2948
+ e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
2949
+ e.target.classList.contains('e-ribbon-overall-of-btn')) {
2950
+ switch (e.action) {
2951
+ case 'rightarrow':
2952
+ this.handleNavigation(e, !this.enableRtl, ribbonControls);
2953
+ break;
2954
+ case 'leftarrow':
2955
+ this.handleNavigation(e, this.enableRtl, ribbonControls);
2956
+ break;
2957
+ case 'tab':
2958
+ if (e.target.classList.contains('e-combobox')) {
2959
+ if (this.currentControlIndex < ribbonControls.length - 1) {
2960
+ this.currentControlIndex++;
2961
+ }
2962
+ }
2963
+ break;
2964
+ case 'shiftTab':
2965
+ if (e.target.classList.contains('e-combobox')) {
2966
+ if (this.currentControlIndex > 0) {
2967
+ this.currentControlIndex--;
2968
+ }
2969
+ }
2970
+ else {
2971
+ this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
2972
+ this.currentControlIndex = 0;
2973
+ }
2974
+ }
2975
+ }
2976
+ };
2977
+ Ribbon.prototype.handleNavigation = function (e, enableRtl, ribbonControls) {
2978
+ var groupContainer;
2979
+ var prevGroupId;
2980
+ if (enableRtl) {
2981
+ if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
2982
+ this.currentControlIndex++;
2983
+ }
2984
+ }
2985
+ else {
2986
+ if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
2987
+ this.currentControlIndex--;
2988
+ }
2989
+ }
2990
+ if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
2991
+ if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
2992
+ if (enableRtl) {
2993
+ this.currentControlIndex++;
2994
+ }
2995
+ else {
2996
+ var prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2997
+ if (prevGroupContainer) {
2998
+ prevGroupId = prevGroupContainer.getAttribute('id');
2999
+ }
3000
+ this.currentControlIndex--;
3001
+ }
3002
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3003
+ while (item && item.classList.contains('e-disabled')) {
3004
+ if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
3005
+ (!enableRtl && this.currentControlIndex === 0))) {
3006
+ if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
3007
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3008
+ break;
3009
+ }
3010
+ }
3011
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3012
+ enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
3013
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3014
+ }
3015
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3016
+ if (this.activeLayout === 'Classic') {
3017
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3018
+ if (enableRtl) {
3019
+ var launcherIconEle = void 0;
3020
+ if (groupContainer) {
3021
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3022
+ }
3023
+ if (launcherIconEle) {
3024
+ var items = groupContainer.querySelectorAll('.e-ribbon-item');
3025
+ items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
3026
+ }
3027
+ }
3028
+ else {
3029
+ if (groupContainer) {
3030
+ var groupContainerId = groupContainer.getAttribute('id');
3031
+ if (prevGroupId !== groupContainerId) {
3032
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3033
+ if (launcherIconEle) {
3034
+ ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
3035
+ }
3036
+ }
3037
+ }
3038
+ }
3039
+ }
3040
+ else {
3041
+ if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
3042
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
3043
+ }
3044
+ else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
3045
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
3046
+ }
3047
+ }
3048
+ }
3049
+ }
3050
+ else {
3051
+ if (this.activeLayout === 'Classic') {
3052
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3053
+ }
3054
+ if (this.activeLayout === 'Simplified') {
3055
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
3056
+ if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
3057
+ overflowButton.focus();
3058
+ }
3059
+ else {
3060
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3061
+ }
3062
+ }
3063
+ }
3064
+ if (e.target.classList.contains('e-ribbon-last-item')) {
3065
+ if (enableRtl) {
3066
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3067
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
3068
+ }
3069
+ else {
3070
+ this.currentControlIndex--;
3071
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3072
+ }
3073
+ }
3074
+ if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
3075
+ groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3076
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3077
+ if (launcherIconEle) {
3078
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
3079
+ }
3080
+ }
3081
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
3082
+ if (enableRtl) {
3083
+ this.currentControlIndex++;
3084
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3085
+ if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
3086
+ ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
3087
+ }
3088
+ }
3089
+ else {
3090
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3091
+ this.currentControlIndex;
3092
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3093
+ }
3094
+ }
3095
+ if (e.target.classList.contains('e-ribbon-collapse-btn')) {
3096
+ if (enableRtl) {
3097
+ this.currentControlIndex = 0;
3098
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3099
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
3100
+ this.currentControlIndex++;
3101
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3102
+ }
3103
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3104
+ }
3105
+ else {
3106
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
3107
+ if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
3108
+ overflowButton.focus();
3109
+ }
3110
+ else {
3111
+ this.currentControlIndex = ribbonControls.length - 1;
3112
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3113
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
3114
+ this.currentControlIndex--;
3115
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3116
+ }
3117
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3118
+ }
3119
+ }
3120
+ }
3121
+ if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
3122
+ if (enableRtl) {
3123
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3124
+ }
3125
+ else {
3126
+ this.currentControlIndex = ribbonControls.length - 1;
3127
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3128
+ }
3129
+ }
3130
+ };
2713
3131
  Ribbon.prototype.resizeHandler = function () {
2714
3132
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2715
3133
  this.checkOverflow(this.selectedTab, activeContent);
@@ -2912,7 +3330,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2912
3330
  for (var k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
2913
3331
  var item = collection.items[k - 1];
2914
3332
  var itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
2915
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3333
+ if (((item.displayOptions === DisplayMode.Auto) ||
3334
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2916
3335
  itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
2917
3336
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
2918
3337
  if (item.activeSize === RibbonItemSize.Small) {
@@ -2983,7 +3402,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2983
3402
  if (overflowtarget) {
2984
3403
  itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
2985
3404
  }
2986
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3405
+ if (((item.displayOptions === DisplayMode.Auto) ||
3406
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2987
3407
  var width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
2988
3408
  if (!isClear && (tabContent.offsetWidth < width)) {
2989
3409
  flag = false;
@@ -3073,7 +3493,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3073
3493
  }
3074
3494
  overflowButton = this.overflowDDB;
3075
3495
  }
3076
- this.addOverflowEvents(item, itemEle, overflowButton);
3496
+ if (itemEle !== null) {
3497
+ this.addOverflowEvents(item, itemEle, overflowButton);
3498
+ }
3077
3499
  };
3078
3500
  Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
3079
3501
  switch (item.type) {
@@ -3122,6 +3544,50 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3122
3544
  }
3123
3545
  return isBreak;
3124
3546
  };
3547
+ Ribbon.prototype.checkValidCollectionLength = function (collections) {
3548
+ var count = 0;
3549
+ for (var i = 0; i < collections.length; i++) {
3550
+ var items = collections[parseInt(i.toString(), 10)].items;
3551
+ for (var ind = 0; ind < items.length; ind++) {
3552
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3553
+ count++;
3554
+ break;
3555
+ }
3556
+ }
3557
+ if (count > 1) {
3558
+ return false;
3559
+ }
3560
+ }
3561
+ return count === 1;
3562
+ };
3563
+ Ribbon.prototype.checkClassicCollection = function (collections, n, isIncrement) {
3564
+ var items = collections[parseInt(n.toString(), 10)].items;
3565
+ for (var ind = 0; ind < items.length; ind++) {
3566
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3567
+ return n;
3568
+ }
3569
+ }
3570
+ n = isIncrement ? n + 1 : n - 1;
3571
+ if (isIncrement) {
3572
+ return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
3573
+ }
3574
+ else {
3575
+ return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
3576
+ }
3577
+ };
3578
+ Ribbon.prototype.checkClassicItem = function (items, n, isIncrement) {
3579
+ var item = items[parseInt(n.toString(), 10)];
3580
+ if (item.displayOptions & DisplayMode.Classic) {
3581
+ return n;
3582
+ }
3583
+ n = isIncrement ? n + 1 : n - 1;
3584
+ if (isIncrement) {
3585
+ return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
3586
+ }
3587
+ else {
3588
+ return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
3589
+ }
3590
+ };
3125
3591
  Ribbon.prototype.checkLargeToMedium = function (tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip) {
3126
3592
  var _this = this;
3127
3593
  if (shouldSkip === void 0) { shouldSkip = false; }
@@ -3155,6 +3621,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3155
3621
  createShrinkEle(collection.id, firstItem, start, end);
3156
3622
  for (var i = start; i <= end; i++) {
3157
3623
  var item = collection.items[parseInt(i.toString(), 10)];
3624
+ if (!(item.displayOptions & DisplayMode.Classic)) {
3625
+ continue;
3626
+ }
3158
3627
  var ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
3159
3628
  shrinkEle.appendChild(ele);
3160
3629
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
@@ -3179,45 +3648,65 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3179
3648
  if (orientation === ItemOrientation.Column) {
3180
3649
  for (var k = (group.collections.length - 1); k > 0; k--) {
3181
3650
  //to avoid negative index while checking for the second collection
3182
- if (((k - 1) >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
3183
- if (canReduceCollection(group.collections[k - 1])) {
3184
- if (((k - 2) >= 0) && canReduceCollection(group.collections[k - 2])) {
3185
- moveCollectionToColumn(k - 2, k);
3651
+ k = this.checkClassicCollection(group.collections, k, false);
3652
+ var l = k - 1;
3653
+ //Checks the element rendered at position n
3654
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
3655
+ l = this.checkClassicCollection(group.collections, l, false);
3656
+ //Checks the element rendered at position n-1
3657
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
3658
+ var m = l - 1;
3659
+ if (m >= 0) {
3660
+ m = this.checkClassicCollection(group.collections, m, false);
3661
+ }
3662
+ //Checks the element rendered at position n-2
3663
+ if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
3664
+ moveCollectionToColumn(m, k);
3186
3665
  }
3187
3666
  else {
3188
- moveCollectionToColumn(k - 1, k);
3667
+ moveCollectionToColumn(l, k);
3189
3668
  }
3190
- k -= 2;
3669
+ k = m;
3191
3670
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3192
3671
  return true;
3193
3672
  }
3194
3673
  }
3195
3674
  else {
3196
- k--;
3675
+ k = l;
3197
3676
  }
3198
3677
  }
3199
3678
  }
3200
3679
  }
3201
3680
  else {
3202
- if (group.collections.length === 1) {
3681
+ if (this.checkValidCollectionLength(group.collections)) {
3203
3682
  var collection = group.collections[0];
3204
3683
  for (var k = (collection.items.length - 1); k > 0; k--) {
3205
3684
  //to avoid negative index while checking for the second item
3206
- if (((k - 1) >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
3207
- if (canReduceItem(collection.items[k - 1])) {
3208
- if (((k - 2) >= 0) && canReduceItem(collection.items[k - 2])) {
3209
- moveItemToColumn(k - 2, k);
3685
+ k = this.checkClassicItem(collection.items, k, false);
3686
+ var l = k - 1;
3687
+ //Checks the element rendered at position n
3688
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
3689
+ l = this.checkClassicItem(collection.items, l, false);
3690
+ //Checks the element rendered at position n-1
3691
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
3692
+ var m = l - 1;
3693
+ //Checks the element rendered at position n-2
3694
+ if (m >= 0) {
3695
+ m = this.checkClassicItem(collection.items, m, false);
3696
+ }
3697
+ if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
3698
+ moveItemToColumn(m, k);
3210
3699
  }
3211
3700
  else {
3212
- moveItemToColumn(k - 1, k);
3701
+ moveItemToColumn(l, k);
3213
3702
  }
3214
- k -= 2;
3703
+ k = m;
3215
3704
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3216
3705
  return true;
3217
3706
  }
3218
3707
  }
3219
3708
  else {
3220
- k--;
3709
+ k = l;
3221
3710
  }
3222
3711
  }
3223
3712
  }
@@ -3238,28 +3727,44 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3238
3727
  var canReduceItem = function (item) {
3239
3728
  return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
3240
3729
  };
3241
- var reduceItemsToSmall = function (collectionIndex, start, end) {
3730
+ var reduceItemsToSmall = function (collectionIndex, start, end, middle) {
3731
+ if (middle === void 0) { middle = null; }
3242
3732
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
3243
3733
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
3244
- for (var i = start; i <= end; i++) {
3734
+ var reduce = function (i) {
3245
3735
  var item = collection.items[parseInt(i.toString(), 10)];
3246
- var ele_1 = activeContent.querySelector('#' + item.id);
3247
- item.setProperties({ activeSize: RibbonItemSize.Small }, true);
3248
- _this.setItemSize(ele_1, item);
3736
+ if (item.displayOptions & DisplayMode.Classic) {
3737
+ var ele_1 = activeContent.querySelector('#' + item.id);
3738
+ item.setProperties({ activeSize: RibbonItemSize.Small }, true);
3739
+ _this.setItemSize(ele_1, item);
3740
+ }
3741
+ };
3742
+ reduce(start);
3743
+ if (middle) {
3744
+ reduce(middle);
3249
3745
  }
3746
+ reduce(end);
3250
3747
  };
3251
- var reduceCollectionsToSmall = function (index, start, end) {
3748
+ var reduceCollectionsToSmall = function (index, start, end, middle) {
3749
+ if (middle === void 0) { middle = null; }
3252
3750
  var group = _this.tabs[parseInt(tabIndex.toString(), 10)]
3253
3751
  .groups[parseInt(groupIndex.toString(), 10)];
3254
3752
  if (!shouldSkip) {
3255
3753
  shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
3256
3754
  }
3257
- for (var i = start; i <= end; i++) {
3755
+ var reduce = function (i) {
3258
3756
  var collection = group.collections[parseInt(i.toString(), 10)];
3259
- var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
3260
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
3261
- _this.setItemSize(ele_2, collection.items[0]);
3757
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
3758
+ var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
3759
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
3760
+ _this.setItemSize(ele_2, collection.items[0]);
3761
+ }
3762
+ };
3763
+ reduce(start);
3764
+ if (middle) {
3765
+ reduce(middle);
3262
3766
  }
3767
+ reduce(end);
3263
3768
  };
3264
3769
  var setWidth = function (id) {
3265
3770
  if (!shouldSkip) {
@@ -3273,13 +3778,14 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3273
3778
  var start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
3274
3779
  var end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
3275
3780
  //only 2 or 3 itmes alone can be present in shrinked column
3781
+ var l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
3276
3782
  if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
3277
- && canReduceItem(group.collections[start + 1].items[0])) {
3278
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
3783
+ && canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
3784
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
3279
3785
  reduceCollectionsToSmall(k, start, end);
3280
3786
  }
3281
- else if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])) {
3282
- reduceCollectionsToSmall(k, start, end);
3787
+ else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
3788
+ reduceCollectionsToSmall(k, start, end, l);
3283
3789
  }
3284
3790
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3285
3791
  return true;
@@ -3289,16 +3795,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3289
3795
  }
3290
3796
  for (var k = (group.collections.length - 1); k >= 0; k--) {
3291
3797
  var collection = group.collections[parseInt(k.toString(), 10)];
3798
+ var classicItems = [];
3799
+ for (var i = 0; i < collection.items.length; i++) {
3800
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3801
+ classicItems.push(i);
3802
+ }
3803
+ }
3292
3804
  //If items length is 1 then, it would have been already check for shrinked column
3293
- if ((collection.items.length > 1)) {
3294
- if (canReduceItem(collection.items[0]) && canReduceItem(collection.items[1])) {
3295
- if (collection.items.length === 2) {
3805
+ if ((classicItems.length > 1)) {
3806
+ if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
3807
+ if (classicItems.length === 2) {
3296
3808
  setWidth(collection.id);
3297
- reduceItemsToSmall(k, 0, 1);
3809
+ reduceItemsToSmall(k, classicItems[0], classicItems[1]);
3298
3810
  }
3299
- else if (canReduceItem(collection.items[2])) {
3811
+ else if (canReduceItem(collection.items[classicItems[2]])) {
3300
3812
  setWidth(collection.id);
3301
- reduceItemsToSmall(k, 0, 2);
3813
+ reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
3302
3814
  }
3303
3815
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3304
3816
  return true;
@@ -3308,22 +3820,24 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3308
3820
  }
3309
3821
  }
3310
3822
  else {
3311
- if (group.collections.length === 1) {
3823
+ if (this.checkValidCollectionLength(group.collections)) {
3312
3824
  if (shrinkColumns.length > 0) {
3313
3825
  for (var k = (shrinkColumns.length - 1); k >= 0; k--) {
3314
3826
  var shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
3315
3827
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3316
3828
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3317
3829
  //only 2 or 3 itmes alone can be present in shrinked column
3830
+ var collection = group.collections[0];
3831
+ var l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
3318
3832
  if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
3319
- && canReduceItem(group.collections[0].items[start + 1])) {
3320
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
3833
+ && canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
3834
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
3321
3835
  setWidth(shrinkColumn.id);
3322
3836
  reduceItemsToSmall(0, start, end);
3323
3837
  }
3324
3838
  else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
3325
3839
  setWidth(shrinkColumn.id);
3326
- reduceItemsToSmall(0, start, end);
3840
+ reduceItemsToSmall(0, start, end, l);
3327
3841
  }
3328
3842
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3329
3843
  return true;
@@ -3336,6 +3850,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3336
3850
  for (var k = (group.collections.length - 1); k >= 0; k--) {
3337
3851
  var collection = group.collections[parseInt(k.toString(), 10)];
3338
3852
  for (var l = (collection.items.length - 1); l >= 0; l--) {
3853
+ l = this.checkClassicItem(collection.items, l, false);
3854
+ if (l < 0) {
3855
+ continue;
3856
+ }
3339
3857
  var item = collection.items[parseInt(l.toString(), 10)];
3340
3858
  if (canReduceItem(item)) {
3341
3859
  setWidth(item.id);
@@ -3369,20 +3887,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3369
3887
  var canExpandItem = function (item) {
3370
3888
  return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
3371
3889
  };
3372
- var expandItemsToMedium = function (collectionIndex, start, end, parentEle) {
3890
+ var expandItemToMedium = function (collectionIndex, index, parentEle) {
3373
3891
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
3374
3892
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
3375
- for (var i = start; i <= end; i++) {
3376
- var item = collection.items[parseInt(i.toString(), 10)];
3893
+ var item = collection.items[parseInt(index.toString(), 10)];
3894
+ if (item.displayOptions & DisplayMode.Classic) {
3377
3895
  var ele_4 = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
3378
3896
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
3379
3897
  _this.setItemSize(ele_4, item);
3380
3898
  }
3381
3899
  };
3382
- var expandCollectionsToMedium = function (start, end) {
3900
+ var expandCollectionsToMedium = function (i) {
3383
3901
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)]
3384
3902
  .groups[parseInt(groupIndex.toString(), 10)].collections;
3385
- for (var i = start; i <= end; i++) {
3903
+ var item = collections[parseInt(i.toString(), 10)].items[0];
3904
+ if (item.displayOptions & DisplayMode.Classic) {
3386
3905
  var ele_5 = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
3387
3906
  collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
3388
3907
  _this.setItemSize(ele_5, collections[parseInt(i.toString(), 10)].items[0]);
@@ -3390,17 +3909,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3390
3909
  };
3391
3910
  if (orientation === ItemOrientation.Row) {
3392
3911
  // collection length is 1, then the it wll be covered in shrinked columns
3393
- if (group.collections.length !== 1) {
3912
+ if (!this.checkValidCollectionLength(group.collections)) {
3394
3913
  for (var k = 0; k < group.collections.length; k++) {
3395
3914
  var collection = group.collections[parseInt(k.toString(), 10)];
3396
3915
  for (var l = 0; l < collection.items.length; l++) {
3916
+ l = this.checkClassicItem(collection.items, l, true);
3917
+ if (l === collection.items.length) {
3918
+ continue;
3919
+ }
3397
3920
  var item = collection.items[parseInt(l.toString(), 10)];
3398
3921
  if (canExpandItem(item)) {
3399
3922
  var itemEle = activeContent.querySelector('#' + item.id);
3400
3923
  var valString = itemEle.getAttribute('data-medium-width');
3401
3924
  var value = valString ? parseInt(valString, 10) : null;
3402
3925
  if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
3403
- expandItemsToMedium(k, l, l, itemEle);
3926
+ expandItemToMedium(k, l, itemEle);
3404
3927
  if (!shouldSkip || shouldClear) {
3405
3928
  itemEle.removeAttribute('data-medium-width');
3406
3929
  }
@@ -3421,8 +3944,18 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3421
3944
  var itemEle = activeContent.querySelector('#' + collection.id);
3422
3945
  var valString = itemEle.getAttribute('data-medium-width');
3423
3946
  var value = valString ? parseInt(valString, 10) : null;
3424
- if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
3425
- expandItemsToMedium(k, 0, (collection.items.length === 2) ? 1 : 2, itemEle);
3947
+ var classicItems = [];
3948
+ for (var i = 0; i < collection.items.length; i++) {
3949
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3950
+ classicItems.push(i);
3951
+ }
3952
+ }
3953
+ if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
3954
+ expandItemToMedium(k, classicItems[0], itemEle);
3955
+ expandItemToMedium(k, classicItems[1], itemEle);
3956
+ if (classicItems.length === 3) {
3957
+ expandItemToMedium(k, classicItems[2], itemEle);
3958
+ }
3426
3959
  if (!shouldSkip || shouldClear) {
3427
3960
  itemEle.removeAttribute('data-medium-width');
3428
3961
  }
@@ -3442,10 +3975,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3442
3975
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3443
3976
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3444
3977
  if (orientation === ItemOrientation.Row) {
3445
- expandItemsToMedium(0, start, end, shrinkColumn);
3978
+ var collection = group.collections[0];
3979
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
3980
+ expandItemToMedium(0, start, shrinkColumn);
3981
+ expandItemToMedium(0, l, shrinkColumn);
3982
+ // 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.
3983
+ if (l !== end) {
3984
+ expandItemToMedium(0, end, shrinkColumn);
3985
+ }
3446
3986
  }
3447
3987
  else {
3448
- expandCollectionsToMedium(start, end);
3988
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
3989
+ expandCollectionsToMedium(start);
3990
+ expandCollectionsToMedium(m);
3991
+ if (m !== end) {
3992
+ expandCollectionsToMedium(end);
3993
+ }
3449
3994
  }
3450
3995
  if (!shouldSkip || shouldClear) {
3451
3996
  shrinkColumn.removeAttribute('data-medium-width');
@@ -3467,32 +4012,46 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3467
4012
  if (shrinkColumns.length === 0) {
3468
4013
  return false;
3469
4014
  }
3470
- var expandItemsToLarge = function (start, end, parentEle) {
4015
+ var expandItemsToLarge = function (start, end, parentEle, middle) {
3471
4016
  var items = _this.tabs[parseInt(tabIndex.toString(), 10)].
3472
4017
  groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
3473
- for (var i = end; i >= start; i--) {
4018
+ var reduce = function (i) {
3474
4019
  var item = items[parseInt(i.toString(), 10)];
3475
- var container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
3476
- var ele_6 = container.querySelector('#' + item.id);
3477
- item.setProperties({ activeSize: RibbonItemSize.Large }, true);
3478
- _this.setItemSize(ele_6, item);
3479
- parentEle.insertAdjacentElement('afterend', container);
4020
+ if (item.displayOptions & DisplayMode.Classic) {
4021
+ var container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
4022
+ var ele_6 = container.querySelector('#' + item.id);
4023
+ item.setProperties({ activeSize: RibbonItemSize.Large }, true);
4024
+ _this.setItemSize(ele_6, item);
4025
+ parentEle.insertAdjacentElement('afterend', container);
4026
+ }
4027
+ };
4028
+ reduce(start);
4029
+ if (middle) {
4030
+ reduce(middle);
3480
4031
  }
4032
+ reduce(end);
3481
4033
  if (!shouldSkip || shouldClear) {
3482
4034
  remove(parentEle);
3483
4035
  }
3484
4036
  };
3485
- var expandCollectionsToLarge = function (start, end, parentEle) {
4037
+ var expandCollectionsToLarge = function (start, end, parentEle, middle) {
3486
4038
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)].
3487
4039
  groups[parseInt(groupIndex.toString(), 10)].collections;
3488
- for (var i = end; i >= start; i--) {
4040
+ var reduce = function (i) {
3489
4041
  var collection = collections[parseInt(i.toString(), 10)];
3490
- var collectionEle = parentEle.querySelector('#' + collection.id);
3491
- var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
3492
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
3493
- _this.setItemSize(ele_7, collection.items[0]);
3494
- parentEle.insertAdjacentElement('afterend', collectionEle);
4042
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
4043
+ var collectionEle = parentEle.querySelector('#' + collection.id);
4044
+ var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
4045
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
4046
+ _this.setItemSize(ele_7, collection.items[0]);
4047
+ parentEle.insertAdjacentElement('afterend', collectionEle);
4048
+ }
4049
+ };
4050
+ reduce(start);
4051
+ if (middle) {
4052
+ reduce(middle);
3495
4053
  }
4054
+ reduce(end);
3496
4055
  if (!shouldSkip || shouldClear) {
3497
4056
  remove(parentEle);
3498
4057
  }
@@ -3505,10 +4064,23 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3505
4064
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3506
4065
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3507
4066
  if (orientation === ItemOrientation.Row) {
3508
- expandItemsToLarge(start, end, shrinkColumn);
4067
+ var collection = group.collections[0];
4068
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
4069
+ if (l === end) {
4070
+ expandItemsToLarge(start, end, shrinkColumn);
4071
+ }
4072
+ else {
4073
+ expandItemsToLarge(start, end, shrinkColumn, l);
4074
+ }
3509
4075
  }
3510
4076
  else {
3511
- expandCollectionsToLarge(start, end, shrinkColumn);
4077
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
4078
+ if (m === end) {
4079
+ expandCollectionsToLarge(start, end, shrinkColumn);
4080
+ }
4081
+ else {
4082
+ expandCollectionsToLarge(start, end, shrinkColumn, m);
4083
+ }
3512
4084
  }
3513
4085
  if (!shouldSkip || shouldClear) {
3514
4086
  shrinkColumn.removeAttribute('data-large-width');
@@ -3564,7 +4136,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3564
4136
  //Expanding the items in the group to their original expanded state
3565
4137
  this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
3566
4138
  this_1.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
3567
- var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
4139
+ var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
3568
4140
  this_1.tabs[parseInt(tabIndex.toString(), 10)].
3569
4141
  groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
3570
4142
  for (var j = 0; j < group.collections.length; j++) {
@@ -3573,7 +4145,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3573
4145
  for (var k = 0; k < collection.items.length; k++) {
3574
4146
  var item = collection.items[parseInt(k.toString(), 10)];
3575
4147
  var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3576
- this_1.addOverflowEvents(item, itemEle, dropdown);
4148
+ if (itemEle !== null) {
4149
+ this_1.addOverflowEvents(item, itemEle, dropdown);
4150
+ }
3577
4151
  }
3578
4152
  }
3579
4153
  };
@@ -3613,7 +4187,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3613
4187
  for (var k = 0; k < collection.items.length; k++) {
3614
4188
  var item = collection.items[parseInt(k.toString(), 10)];
3615
4189
  var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3616
- this_2.removeOverflowEvent(item, itemEle);
4190
+ if (itemEle !== null) {
4191
+ this_2.removeOverflowEvent(item, itemEle);
4192
+ }
3617
4193
  }
3618
4194
  }
3619
4195
  };
@@ -3671,6 +4247,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3671
4247
  };
3672
4248
  Ribbon.prototype.ribbonTabSelecting = function (e) {
3673
4249
  var _this = this;
4250
+ this.currentControlIndex = 0;
3674
4251
  var nextTabId = e.selectingItem.getAttribute('data-id');
3675
4252
  var previousTabId = e.previousItem.getAttribute('data-id');
3676
4253
  var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
@@ -3727,11 +4304,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3727
4304
  this.checkOverflow(this.selectedTab, activeContent);
3728
4305
  };
3729
4306
  Ribbon.prototype.addOverflowButton = function (btnId) {
4307
+ var _this = this;
3730
4308
  var overflowButton = this.createElement('button', {
3731
4309
  id: btnId
3732
4310
  });
3733
4311
  var overflowTarget = this.createElement('div', {
3734
- className: RIBBON_OVERFLOW_TARGET
4312
+ className: RIBBON_OVERFLOW_TARGET,
4313
+ attrs: { 'tabindex': '0' }
3735
4314
  });
3736
4315
  var overflowDDB = new DropDownButton({
3737
4316
  iconCss: OVERFLOW_ICON,
@@ -3749,8 +4328,112 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3749
4328
  }, overflowButton);
3750
4329
  this.element.classList.add(RIBBON_OVERFLOW);
3751
4330
  createTooltip(overflowTarget, this);
4331
+ var isGroupOf;
4332
+ overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
4333
+ overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
3752
4334
  return overflowDDB;
3753
4335
  };
4336
+ Ribbon.prototype.upDownKeyHandler = function (e, target, isGroupOf) {
4337
+ var items;
4338
+ if (isGroupOf) {
4339
+ items = target.getElementsByClassName('e-ribbon-item');
4340
+ }
4341
+ else {
4342
+ var currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
4343
+ items = currentList.getElementsByClassName('e-ribbon-item');
4344
+ }
4345
+ var 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;
4346
+ var ribbonItem;
4347
+ if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
4348
+ if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
4349
+ if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
4350
+ this.itemIndex = 0;
4351
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4352
+ this.findDisabledItem(ribbonItem, items, true);
4353
+ if (comboBoxEle && e.key === 'Tab') {
4354
+ e.preventDefault();
4355
+ items[this.itemIndex].querySelector('.e-control').focus();
4356
+ }
4357
+ }
4358
+ else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
4359
+ this.itemIndex++;
4360
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4361
+ this.findDisabledItem(ribbonItem, items, true);
4362
+ }
4363
+ }
4364
+ else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
4365
+ if (comboBoxEle === null || (e.key === 'Tab')) {
4366
+ if (!this.itemIndex || this.itemIndex === -1) {
4367
+ this.itemIndex = items.length - 1;
4368
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4369
+ this.findDisabledItem(ribbonItem, items, false);
4370
+ if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
4371
+ e.preventDefault();
4372
+ items[this.itemIndex].querySelector('.e-control').focus();
4373
+ }
4374
+ }
4375
+ else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
4376
+ this.itemIndex--;
4377
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4378
+ this.findDisabledItem(ribbonItem, items, false);
4379
+ }
4380
+ }
4381
+ }
4382
+ target.setAttribute('index', this.itemIndex.toString());
4383
+ }
4384
+ var currentItemIndex = parseInt(target.getAttribute('index'), 10);
4385
+ var itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
4386
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
4387
+ if (itemType === 'ColorPicker') {
4388
+ if (e.key === 'Tab') {
4389
+ e.preventDefault();
4390
+ }
4391
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
4392
+ }
4393
+ else {
4394
+ if (e.key === 'Tab') {
4395
+ e.preventDefault();
4396
+ }
4397
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4398
+ }
4399
+ if (e.key === ' ' && (itemType === 'CheckBox')) {
4400
+ var checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
4401
+ var checkBox = getComponent(checkBoxEle, CheckBox);
4402
+ this.itemIndex = -1;
4403
+ checkBox.click();
4404
+ }
4405
+ }
4406
+ if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
4407
+ if (e.key === 'ArrowRight') {
4408
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
4409
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
4410
+ }
4411
+ if (e.key === 'ArrowLeft') {
4412
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
4413
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4414
+ }
4415
+ }
4416
+ if (e.key === 'Enter') {
4417
+ this.itemIndex = -1;
4418
+ }
4419
+ };
4420
+ Ribbon.prototype.findDisabledItem = function (ribbonItem, items, isIncrease) {
4421
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
4422
+ if (isIncrease) {
4423
+ if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4424
+ this.itemIndex = -1;
4425
+ }
4426
+ }
4427
+ else {
4428
+ if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4429
+ this.itemIndex = items.length;
4430
+ }
4431
+ }
4432
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
4433
+ isIncrease ? this.itemIndex++ : this.itemIndex--;
4434
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4435
+ }
4436
+ };
3754
4437
  Ribbon.prototype.removeOverflowButton = function (overflowDDB) {
3755
4438
  if (overflowDDB) {
3756
4439
  var btnEle = overflowDDB.element;
@@ -3840,6 +4523,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3840
4523
  }
3841
4524
  };
3842
4525
  Ribbon.prototype.switchLayout = function () {
4526
+ this.currentControlIndex = 0;
3843
4527
  this.destroyScroll();
3844
4528
  this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
3845
4529
  this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
@@ -3854,6 +4538,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3854
4538
  if (this.activeLayout === 'Simplified') {
3855
4539
  for (var i_1 = 0; i_1 < groupList.length; i_1++) {
3856
4540
  var group = groupList[parseInt(i_1.toString(), 10)];
4541
+ var alignType = groupList[parseInt(i_1.toString(), 10)].orientation;
3857
4542
  if (group.isCollapsed) {
3858
4543
  group.setProperties({ isCollapsed: false }, true);
3859
4544
  this.removeDropdown(group.id);
@@ -3881,11 +4566,11 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3881
4566
  var itemList = collection.items;
3882
4567
  var item = collection.items[parseInt(k.toString(), 10)];
3883
4568
  var flag = true;
3884
- while ((flag) && (item.displayOptions === DisplayMode.None)) {
4569
+ while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
3885
4570
  k++;
3886
4571
  var itemEle_1 = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3887
- var ele_8 = itemEle_1.querySelector('#' + item.id);
3888
- this.destroyFunction(item, ele_8);
4572
+ var ele = itemEle_1.querySelector('#' + item.id);
4573
+ this.destroyFunction(item, ele);
3889
4574
  itemEle_1.remove();
3890
4575
  if (k < itemList.length) {
3891
4576
  item = itemList[parseInt(k.toString(), 10)];
@@ -3897,19 +4582,29 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3897
4582
  if (!flag) {
3898
4583
  break;
3899
4584
  }
3900
- var itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3901
- var ele = itemEle.querySelector('#' + item.id);
3902
4585
  var size = ((item.allowedSizes === RibbonItemSize.Large) ||
3903
4586
  (item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
3904
- if (item.displayOptions === DisplayMode.Overflow) {
3905
- this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
3906
- size = RibbonItemSize.Medium;
3907
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
3908
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
4587
+ size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
4588
+ ? RibbonItemSize.Medium : size;
4589
+ var itemEle = void 0;
4590
+ if (!(item.displayOptions & DisplayMode.Classic)) {
4591
+ itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
4592
+ if (item.displayOptions & DisplayMode.Simplified) {
4593
+ groupCollection.append(itemEle);
3909
4594
  }
3910
4595
  }
3911
- item.setProperties({ activeSize: size }, true);
3912
- this.setItemSize(ele, item);
4596
+ else {
4597
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4598
+ if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
4599
+ this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
4600
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
4601
+ this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
4602
+ }
4603
+ }
4604
+ item.setProperties({ activeSize: size }, true);
4605
+ var ele = itemEle.querySelector('#' + item.id);
4606
+ this.setItemSize(ele, item);
4607
+ }
3913
4608
  }
3914
4609
  }
3915
4610
  if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
@@ -3956,22 +4651,37 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3956
4651
  groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
3957
4652
  }
3958
4653
  for (var k = 0; k < collection.items.length; k++) {
4654
+ var itemList = collection.items;
3959
4655
  var item = collection.items[parseInt(k.toString(), 10)];
3960
- if (item.displayOptions === DisplayMode.None) {
3961
- var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
3962
- groupCollection.append(itemEle);
3963
- }
3964
- else if ((item.displayOptions === DisplayMode.Overflow)) {
3965
- var itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
3966
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
3967
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
4656
+ var flag = true;
4657
+ while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
4658
+ k++;
4659
+ var itemEle = void 0;
4660
+ if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
4661
+ if (item.displayOptions & DisplayMode.Simplified) {
4662
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4663
+ }
4664
+ else {
4665
+ itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
4666
+ }
4667
+ if (itemEle !== null) {
4668
+ var ele_8 = itemEle.querySelector('#' + item.id);
4669
+ this.destroyFunction(item, ele_8);
4670
+ itemEle.remove();
4671
+ }
4672
+ }
4673
+ if (k < itemList.length) {
4674
+ item = itemList[parseInt(k.toString(), 10)];
4675
+ }
4676
+ else {
4677
+ flag = false;
3968
4678
  }
3969
- groupCollection.append(itemEle);
3970
- this.removeOverflowEvent(item, itemEle);
3971
4679
  }
3972
- else if ((item.displayOptions === DisplayMode.Simplified)) {
3973
- //To make sure the items are in proper order
3974
- var itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4680
+ if (!flag) {
4681
+ break;
4682
+ }
4683
+ if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
4684
+ var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
3975
4685
  groupCollection.append(itemEle);
3976
4686
  }
3977
4687
  else {
@@ -4009,36 +4719,51 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4009
4719
  this.overflowDDB = null;
4010
4720
  }
4011
4721
  };
4722
+ Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
4723
+ var _this = this;
4724
+ var launcherIcon = this.createElement('div', {
4725
+ className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
4726
+ id: groupId + LAUNCHER_ID,
4727
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
4728
+ });
4729
+ groupContainer.appendChild(launcherIcon);
4730
+ groupContainer.classList.add(RIBBON_LAUNCHER);
4731
+ EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
4732
+ EventHandler.add(launcherIcon, 'keydown', function (e) {
4733
+ if (e.key === 'Enter') {
4734
+ _this.launcherIconClicked(groupId);
4735
+ }
4736
+ }, this);
4737
+ };
4012
4738
  Ribbon.prototype.launcherIconClicked = function (id) {
4013
4739
  var eventArgs = { groupId: id };
4014
4740
  this.trigger('launcherIconClick', eventArgs);
4015
4741
  };
4016
4742
  Ribbon.prototype.createGroups = function (groupList, tabIndex) {
4017
- var _this = this;
4018
4743
  var groupElements = [];
4019
- var _loop_3 = function (i) {
4744
+ for (var i = 0; i < groupList.length; i++) {
4020
4745
  var group = groupList[parseInt(i.toString(), 10)];
4021
4746
  var alignType = group.orientation;
4022
- var groupEle = this_3.createElement('div', {
4747
+ var groupEle = this.createElement('div', {
4023
4748
  className: group.cssClass,
4024
4749
  id: group.id
4025
4750
  });
4026
4751
  groupEle.classList.add(RIBBON_GROUP);
4027
4752
  groupElements.push(groupEle);
4028
- var groupContainer = this_3.createElement('div', {
4753
+ var groupContainer = this.createElement('div', {
4029
4754
  className: group.cssClass,
4030
4755
  id: group.id + CONTAINER_ID
4031
4756
  });
4032
4757
  groupContainer.classList.add(RIBBON_GROUP_CONTAINER);
4033
4758
  groupEle.appendChild(groupContainer);
4034
- var groupContent = this_3.createElement('div', {
4035
- className: this_3.activeLayout === 'Simplified' ? RIBBON_GROUP_CONTENT : (RIBBON_GROUP_CONTENT + SPACE + RIBBON_CONTENT_HEIGHT),
4759
+ var groupContent = this.createElement('div', {
4760
+ className: this.activeLayout === 'Simplified' ? RIBBON_GROUP_CONTENT : (RIBBON_GROUP_CONTENT + SPACE + RIBBON_CONTENT_HEIGHT),
4036
4761
  id: group.id + CONTENT_ID
4037
4762
  });
4038
- groupContent.classList.add(((alignType === 'Column') || (this_3.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
4763
+ groupContent.classList.add(((alignType === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
4039
4764
  groupContainer.appendChild(groupContent);
4040
- if (this_3.activeLayout === 'Classic') {
4041
- var groupHeader = this_3.createElement('div', {
4765
+ if (this.activeLayout === 'Classic') {
4766
+ var groupHeader = this.createElement('div', {
4042
4767
  className: RIBBON_GROUP_HEADER,
4043
4768
  id: group.id + HEADER_ID,
4044
4769
  innerHTML: group.header
@@ -4046,29 +4771,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4046
4771
  groupContainer.appendChild(groupHeader);
4047
4772
  }
4048
4773
  if (group.showLauncherIcon) {
4049
- var launcherIcon = this_3.createElement('div', {
4050
- className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this_3.launcherIconCss ? this_3.launcherIconCss : RIBBON_LAUNCHER_ICON),
4051
- id: group.id + LAUNCHER_ID,
4052
- attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
4053
- });
4054
- groupContainer.appendChild(launcherIcon);
4055
- groupContainer.classList.add(RIBBON_LAUNCHER);
4056
- EventHandler.add(launcherIcon, 'click', this_3.launcherIconClicked.bind(this_3, group.id), this_3);
4057
- EventHandler.add(launcherIcon, 'keydown', function (e) {
4058
- if (e.key === 'Enter') {
4059
- _this.launcherIconClicked(group.id);
4060
- }
4061
- }, this_3);
4774
+ this.createLauncherIcon(group.id, groupContainer);
4062
4775
  }
4063
- var elements = this_3.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
4776
+ var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
4064
4777
  append(elements, groupContent);
4065
- if ((this_3.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
4778
+ if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
4066
4779
  groupEle.classList.add('e-ribbon-emptyCollection');
4067
4780
  }
4068
- };
4069
- var this_3 = this;
4070
- for (var i = 0; i < groupList.length; i++) {
4071
- _loop_3(i);
4072
4781
  }
4073
4782
  return groupElements;
4074
4783
  };
@@ -4130,6 +4839,31 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4130
4839
  }
4131
4840
  return collectionElements;
4132
4841
  };
4842
+ Ribbon.prototype.createRibbonItem = function (item, itemEle) {
4843
+ switch (item.type) {
4844
+ case 'Button':
4845
+ this.ribbonButtonModule.createButton(item, itemEle);
4846
+ break;
4847
+ case 'DropDown':
4848
+ this.ribbonDropDownModule.createDropDown(item, itemEle);
4849
+ break;
4850
+ case 'SplitButton':
4851
+ this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
4852
+ break;
4853
+ case 'CheckBox':
4854
+ this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
4855
+ break;
4856
+ case 'ColorPicker':
4857
+ this.ribbonColorPickerModule.createColorPicker(item, itemEle);
4858
+ break;
4859
+ case 'ComboBox':
4860
+ this.ribbonComboBoxModule.createComboBox(item, itemEle);
4861
+ break;
4862
+ case 'Template':
4863
+ this.createTemplateContent(item, itemEle);
4864
+ break;
4865
+ }
4866
+ };
4133
4867
  Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
4134
4868
  var _a;
4135
4869
  var itemElements = [];
@@ -4137,7 +4871,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4137
4871
  var item = itemList[parseInt(i.toString(), 10)];
4138
4872
  //To stop rendering of items with simplified mode position type as none
4139
4873
  var flag = true;
4140
- while ((this.activeLayout === 'Simplified') && (flag) && (item.displayOptions === DisplayMode.None)) {
4874
+ while (flag &&
4875
+ (((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
4876
+ ((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
4141
4877
  i++;
4142
4878
  if (i < itemList.length) {
4143
4879
  item = itemList[parseInt(i.toString(), 10)];
@@ -4171,30 +4907,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4171
4907
  else {
4172
4908
  itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
4173
4909
  }
4174
- switch (item.type) {
4175
- case 'Button':
4176
- this.ribbonButtonModule.createButton(item, itemEle);
4177
- break;
4178
- case 'DropDown':
4179
- this.ribbonDropDownModule.createDropDown(item, itemEle);
4180
- break;
4181
- case 'SplitButton':
4182
- this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
4183
- break;
4184
- case 'CheckBox':
4185
- this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
4186
- break;
4187
- case 'ColorPicker':
4188
- this.ribbonColorPickerModule.createColorPicker(item, itemEle);
4189
- break;
4190
- case 'ComboBox':
4191
- this.ribbonComboBoxModule.createComboBox(item, itemEle);
4192
- break;
4193
- case 'Template':
4194
- this.createTemplateContent(item, itemEle);
4195
- break;
4196
- }
4197
- if ((this.activeLayout === 'Simplified') && (item.displayOptions === DisplayMode.Overflow)) {
4910
+ this.createRibbonItem(item, itemEle);
4911
+ if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
4198
4912
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
4199
4913
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
4200
4914
  this.updatePopupItems(item, itemEle, isGroupOF, true);
@@ -4301,13 +5015,15 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4301
5015
  var item = _e[_d];
4302
5016
  var ele = null;
4303
5017
  if (this.activeLayout === RibbonLayout.Classic) {
4304
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5018
+ if (item.displayOptions & DisplayMode.Classic) {
5019
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5020
+ }
4305
5021
  }
4306
5022
  else {
4307
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5023
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4308
5024
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
4309
5025
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4310
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5026
+ if (!ele) {
4311
5027
  ele = dropdown.target.querySelector('#' + item.id);
4312
5028
  if (item.type === 'DropDown') {
4313
5029
  this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
@@ -4363,15 +5079,17 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4363
5079
  var item = _e[_d];
4364
5080
  var ele = void 0;
4365
5081
  if (this.activeLayout === RibbonLayout.Classic) {
4366
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
4367
- contentEle.querySelector('#' + item.id);
5082
+ if (item.displayOptions & DisplayMode.Classic) {
5083
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
5084
+ contentEle.querySelector('#' + item.id);
5085
+ }
4368
5086
  }
4369
5087
  else {
4370
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5088
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4371
5089
  ele = (item.displayOptions & DisplayMode.Simplified) ?
4372
5090
  contentEle.querySelector('#' + item.id) : null;
4373
5091
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4374
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5092
+ if (!ele) {
4375
5093
  ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
4376
5094
  }
4377
5095
  }
@@ -4793,16 +5511,382 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4793
5511
  this.refreshLayout();
4794
5512
  }
4795
5513
  };
5514
+ /**
5515
+ * tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
5516
+ *
5517
+ * @param {RibbonTabModel} tab - Gets the ribbon tab model.
5518
+ * @returns {void}
5519
+ */
5520
+ Ribbon.prototype.updateTab = function (tab) {
5521
+ var tabId = tab.id;
5522
+ var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
5523
+ if (index === -1) {
5524
+ return;
5525
+ }
5526
+ var contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
5527
+ var groups = this.tabs[parseInt(index.toString(), 10)].groups;
5528
+ var tabEle = this.tabObj.element;
5529
+ if (groups && (contentEle.innerHTML !== '')) {
5530
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5531
+ if (tab.cssClass) {
5532
+ if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
5533
+ contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5534
+ tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5535
+ }
5536
+ }
5537
+ // Check whether group is passed by the user, and if it is, then remove the old values.
5538
+ if (tab.groups) {
5539
+ for (var _i = 0, groups_2 = groups; _i < groups_2.length; _i++) {
5540
+ var group = groups_2[_i];
5541
+ var dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
5542
+ for (var _a = 0, _b = group.collections; _a < _b.length; _a++) {
5543
+ var collection = _b[_a];
5544
+ for (var _c = 0, _d = collection.items; _c < _d.length; _c++) {
5545
+ var item = _d[_c];
5546
+ var ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5547
+ if (ele) {
5548
+ this.destroyFunction(item, ele);
5549
+ }
5550
+ }
5551
+ }
5552
+ if (dropdownElement) {
5553
+ this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
5554
+ }
5555
+ }
5556
+ var groupElements = contentEle.querySelectorAll('.e-ribbon-group');
5557
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5558
+ groupElements.forEach(function (groupEle) { groupEle.remove(); });
5559
+ }
5560
+ }
5561
+ if (index === this.selectedTab) {
5562
+ this.isAddRemove = true;
5563
+ }
5564
+ var ribbonTab = this.tabs[parseInt(index.toString(), 10)];
5565
+ ribbonTab.setProperties(tab, true);
5566
+ this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
5567
+ this.validateItemSize();
5568
+ if (contentEle.innerHTML === '') {
5569
+ // Check whether group is passed by the user and sets the updated values.
5570
+ if (tab.groups) {
5571
+ var elements = this.createGroups(ribbonTab.groups, index);
5572
+ append(elements, contentEle);
5573
+ }
5574
+ if (this.selectedTab === index) {
5575
+ this.refreshLayout();
5576
+ }
5577
+ // Check whether cssClass is passed by the user and sets the updated values.
5578
+ if (tab.cssClass) {
5579
+ contentEle.classList.add(ribbonTab.cssClass);
5580
+ tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
5581
+ }
5582
+ // Check whether header is passed by the user and sets the updated values.
5583
+ if (tab.header) {
5584
+ tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
5585
+ }
5586
+ }
5587
+ };
5588
+ /**
5589
+ * group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
5590
+ *
5591
+ * @param {RibbonGroupModel} group - Gets the ribbon group model.
5592
+ * @returns {void}
5593
+ */
5594
+ Ribbon.prototype.updateGroup = function (group) {
5595
+ var groupId = group.id;
5596
+ var itemProp = getGroup(this.tabs, groupId);
5597
+ if (!itemProp) {
5598
+ return;
5599
+ }
5600
+ if (this.selectedTab === itemProp.tabIndex) {
5601
+ this.clearOverflowResize();
5602
+ }
5603
+ //Check whether the tab items are rendered
5604
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5605
+ var groupEle = contentEle.querySelector('#' + groupId);
5606
+ var groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
5607
+ var dropdownElement;
5608
+ var dropdown;
5609
+ if (contentEle.innerHTML !== '') {
5610
+ if (itemProp.group.showLauncherIcon) {
5611
+ this.removeLauncherIcon(itemProp.group.id, null, contentEle);
5612
+ }
5613
+ if (this.activeLayout === RibbonLayout.Simplified) {
5614
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5615
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5616
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5617
+ }
5618
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5619
+ if (group.cssClass) {
5620
+ if (itemProp.group.cssClass) {
5621
+ groupEle.classList.remove(itemProp.group.cssClass);
5622
+ if (groupContainer) {
5623
+ groupContainer.classList.remove(itemProp.group.cssClass);
5624
+ }
5625
+ }
5626
+ }
5627
+ // Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
5628
+ if (group.collections || group.orientation) {
5629
+ if (itemProp.group.collections || itemProp.group.orientation) {
5630
+ for (var _i = 0, _a = itemProp.group.collections; _i < _a.length; _i++) {
5631
+ var collection = _a[_i];
5632
+ for (var _b = 0, _c = collection.items; _b < _c.length; _b++) {
5633
+ var item = _c[_b];
5634
+ this.removeItemElement(contentEle, item, dropdown);
5635
+ }
5636
+ }
5637
+ var collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
5638
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5639
+ collectionElements.forEach(function (collectionEle) { collectionEle.remove(); });
5640
+ if (group.orientation) {
5641
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5642
+ var removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
5643
+ if (removeCss) {
5644
+ removeClass([groupContent], removeCss);
5645
+ }
5646
+ }
5647
+ }
5648
+ }
5649
+ if (this.activeLayout === RibbonLayout.Simplified) {
5650
+ if (itemProp.group.enableGroupOverflow) {
5651
+ if (dropdown.target.childElementCount === 0) {
5652
+ this.removeOverflowButton(dropdown);
5653
+ }
5654
+ }
5655
+ else {
5656
+ var ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5657
+ if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
5658
+ ofGroupContainer.remove();
5659
+ }
5660
+ var ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
5661
+ if (ofTabContainer && ofTabContainer.childElementCount === 0) {
5662
+ ofTabContainer.remove();
5663
+ }
5664
+ }
5665
+ }
5666
+ }
5667
+ var ribbongroup = itemProp.group;
5668
+ ribbongroup.setProperties(group, true);
5669
+ ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
5670
+ this.validateItemSize();
5671
+ if (contentEle.innerHTML !== '') {
5672
+ // Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
5673
+ if (group.showLauncherIcon) {
5674
+ this.createLauncherIcon(ribbongroup.id, groupContainer);
5675
+ }
5676
+ // Check whether collections or orientation is passed by the user and sets the updated values.
5677
+ if (group.collections || group.orientation) {
5678
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5679
+ groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
5680
+ var elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5681
+ append(elements, groupContent);
5682
+ }
5683
+ if (this.selectedTab === itemProp.tabIndex) {
5684
+ this.refreshLayout();
5685
+ }
5686
+ // Check whether cssClass is passed by the user and sets the updated values.
5687
+ if (group.cssClass) {
5688
+ groupEle.classList.add(ribbongroup.cssClass);
5689
+ if (groupContainer) {
5690
+ groupContainer.classList.add(ribbongroup.cssClass);
5691
+ }
5692
+ }
5693
+ // Check whether header is passed by the user and sets the updated values.
5694
+ if (group.header) {
5695
+ if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
5696
+ var overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
5697
+ if (overflowHeader) {
5698
+ overflowHeader.innerText = ribbongroup.header;
5699
+ }
5700
+ }
5701
+ else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
5702
+ groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
5703
+ }
5704
+ else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
5705
+ var overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
5706
+ // need to set instance for dropdown
5707
+ var dropDownBtn = getInstance(overflowEle, DropDownButton);
5708
+ var overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
5709
+ if (overflowHeader) {
5710
+ overflowHeader.innerText = ribbongroup.header;
5711
+ }
5712
+ }
5713
+ }
5714
+ }
5715
+ };
5716
+ /**
5717
+ * collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
5718
+ *
5719
+ * @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
5720
+ * @returns {void}
5721
+ */
5722
+ Ribbon.prototype.updateCollection = function (collection) {
5723
+ var collectionId = collection.id;
5724
+ var itemProp = getCollection(this.tabs, collectionId);
5725
+ if (!itemProp) {
5726
+ return;
5727
+ }
5728
+ if (this.selectedTab === itemProp.tabIndex) {
5729
+ this.clearOverflowResize();
5730
+ }
5731
+ //Check whether the tab items are rendered
5732
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5733
+ var collectionEle = contentEle.querySelector('#' + collectionId);
5734
+ if (contentEle.innerHTML !== '') {
5735
+ var dropdownElement = void 0;
5736
+ var dropdown = void 0;
5737
+ if (this.activeLayout === RibbonLayout.Simplified) {
5738
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5739
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5740
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5741
+ }
5742
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5743
+ if (collection.cssClass) {
5744
+ if (itemProp.collection.cssClass) {
5745
+ collectionEle.classList.remove(itemProp.collection.cssClass);
5746
+ }
5747
+ }
5748
+ if (collection.items) {
5749
+ if (itemProp.collection.items) {
5750
+ for (var _i = 0, _a = itemProp.collection.items; _i < _a.length; _i++) {
5751
+ var item = _a[_i];
5752
+ this.removeItemElement(contentEle, item, dropdown);
5753
+ }
5754
+ }
5755
+ }
5756
+ }
5757
+ var ribboncollection = itemProp.collection;
5758
+ ribboncollection.setProperties(collection, true);
5759
+ ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
5760
+ this.validateItemSize();
5761
+ if (contentEle.innerHTML !== '') {
5762
+ if (collection.items) {
5763
+ var groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5764
+ var elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5765
+ append(elements, collectionEle);
5766
+ }
5767
+ }
5768
+ if (this.selectedTab === itemProp.tabIndex) {
5769
+ this.refreshLayout();
5770
+ }
5771
+ // Check whether cssClass is passed by the user and sets the updated values.
5772
+ if (collection.cssClass) {
5773
+ collectionEle.classList.add(ribboncollection.cssClass);
5774
+ }
5775
+ };
5776
+ /**
5777
+ * item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
5778
+ *
5779
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
5780
+ * @returns {void}
5781
+ */
5782
+ Ribbon.prototype.updateItem = function (item) {
5783
+ var itemId = item.id;
5784
+ var itemProp = getItem(this.tabs, itemId);
5785
+ if (!itemProp) {
5786
+ return;
5787
+ }
5788
+ if (this.selectedTab === itemProp.tabIndex) {
5789
+ this.clearOverflowResize();
5790
+ }
5791
+ //Check whether the tab items are rendered
5792
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5793
+ var groupEle = contentEle.querySelector('#' + itemProp.group.id);
5794
+ var groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5795
+ var itemContainer = null;
5796
+ var itemEle = null;
5797
+ var dropdownElement;
5798
+ var dropdown;
5799
+ if (contentEle.innerHTML !== '') {
5800
+ if (this.activeLayout === RibbonLayout.Simplified) {
5801
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5802
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5803
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5804
+ }
5805
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
5806
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5807
+ itemEle = dropdown.target.querySelector('#' + itemId);
5808
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
5809
+ var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
5810
+ if (collectionEle) {
5811
+ collectionEle.appendChild(itemContainer);
5812
+ }
5813
+ }
5814
+ }
5815
+ else {
5816
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5817
+ itemEle = contentEle.querySelector('#' + itemId);
5818
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
5819
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
5820
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
5821
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
5822
+ }
5823
+ }
5824
+ }
5825
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5826
+ if (item.cssClass) {
5827
+ if (itemProp.item.cssClass) {
5828
+ itemContainer.classList.remove(itemProp.item.cssClass);
5829
+ }
5830
+ }
5831
+ this.destroyFunction(itemProp.item, itemEle);
5832
+ itemEle.remove();
5833
+ var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
5834
+ if (removeCss) {
5835
+ removeClass([itemContainer], removeCss);
5836
+ }
5837
+ }
5838
+ var ribbonItem = itemProp.item;
5839
+ ribbonItem.setProperties(item, true);
5840
+ this.validateItemSize();
5841
+ if (contentEle.innerHTML !== '') {
5842
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
5843
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5844
+ }
5845
+ else {
5846
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5847
+ }
5848
+ // To avoid undefined items condition is added
5849
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
5850
+ itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
5851
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
5852
+ }
5853
+ var size = ribbonItem.activeSize;
5854
+ if (this.activeLayout === 'Simplified') {
5855
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
5856
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
5857
+ ribbonItem.setProperties({ activeSize: size }, true);
5858
+ }
5859
+ if (size & RibbonItemSize.Large) {
5860
+ itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
5861
+ }
5862
+ else {
5863
+ itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
5864
+ }
5865
+ this.createRibbonItem(ribbonItem, itemContainer);
5866
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
5867
+ if (dropdown.target.childElementCount === 0) {
5868
+ this.removeOverflowButton(dropdown);
5869
+ }
5870
+ }
5871
+ if (this.selectedTab === itemProp.tabIndex) {
5872
+ this.refreshLayout();
5873
+ }
5874
+ if (item.cssClass) {
5875
+ itemContainer.classList.add(ribbonItem.cssClass);
5876
+ }
5877
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
5878
+ }
5879
+ };
4796
5880
  Ribbon.prototype.removeItemElement = function (contentEle, item, dropdown) {
4797
5881
  var ele = null;
4798
5882
  if (this.activeLayout === RibbonLayout.Classic) {
4799
- ele = contentEle.querySelector('#' + item.id);
5883
+ ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
4800
5884
  }
4801
5885
  else {
4802
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5886
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4803
5887
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
4804
5888
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4805
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5889
+ if (!ele) {
4806
5890
  ele = dropdown.target.querySelector('#' + item.id);
4807
5891
  }
4808
5892
  }
@@ -4853,6 +5937,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4853
5937
  EventHandler.remove(window, 'resize', this.resizeHandler);
4854
5938
  };
4855
5939
  Ribbon.prototype.destroy = function () {
5940
+ this.keyboardModuleRibbon.destroy();
5941
+ this.keyboardModuleRibbon = null;
4856
5942
  destroyTooltip(this.element);
4857
5943
  this.destroyTabItems(this.tabs);
4858
5944
  this.removeExpandCollapse();
@@ -4904,6 +5990,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4904
5990
  case 'isMinimized':
4905
5991
  this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
4906
5992
  this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
5993
+ if (!this.isMinimized) {
5994
+ this.refreshLayout();
5995
+ }
4907
5996
  break;
4908
5997
  case 'locale':
4909
5998
  this.updateCommonProperty({ locale: this.locale });
@@ -4928,7 +6017,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4928
6017
  if (group.showLauncherIcon) {
4929
6018
  var className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
4930
6019
  if (group.isCollapsed) {
4931
- var element = tabContent.querySelector('.' + RIBBON_GROUP_OVERFLOW_DDB);
6020
+ var element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
4932
6021
  var dropdown = getComponent(element, DropDownButton);
4933
6022
  var launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
4934
6023
  launcherIconEle.className = className;
@@ -4959,14 +6048,20 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4959
6048
  if (this.ribbonFileMenuModule) {
4960
6049
  this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
4961
6050
  }
6051
+ var toolbarEle = this.tabObj['tbObj'];
6052
+ toolbarEle.refreshOverflow();
4962
6053
  break;
4963
6054
  case 'helpPaneTemplate':
4964
6055
  if (this.ribbonTempEle) {
4965
6056
  remove(this.ribbonTempEle);
6057
+ this.ribbonTempEle = null;
6058
+ this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
4966
6059
  }
4967
6060
  if (this.helpPaneTemplate) {
4968
6061
  this.createHelpPaneTemplate();
4969
6062
  }
6063
+ var toolbar_1 = this.tabObj['tbObj'];
6064
+ toolbar_1.refreshOverflow();
4970
6065
  break;
4971
6066
  }
4972
6067
  }