@syncfusion/ej2-ribbon 21.2.3 → 22.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.eslintrc.json +1 -0
  2. package/dist/ej2-ribbon.umd.min.js +2 -2
  3. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-ribbon.es2015.js +1249 -161
  5. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  6. package/dist/es6/ej2-ribbon.es5.js +1270 -176
  7. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  8. package/dist/global/ej2-ribbon.min.js +2 -2
  9. package/dist/global/ej2-ribbon.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +16 -13
  12. package/src/ribbon/base/interface.d.ts +6 -6
  13. package/src/ribbon/base/interface.js +6 -6
  14. package/src/ribbon/base/ribbon-model.d.ts +2 -2
  15. package/src/ribbon/base/ribbon.d.ts +43 -1
  16. package/src/ribbon/base/ribbon.js +1074 -163
  17. package/src/ribbon/base/utils.d.ts +2 -2
  18. package/src/ribbon/base/utils.js +11 -6
  19. package/src/ribbon/items/ribbon-button.js +1 -0
  20. package/src/ribbon/items/ribbon-checkbox.js +1 -0
  21. package/src/ribbon/items/ribbon-colorpicker.js +1 -0
  22. package/src/ribbon/items/ribbon-combobox.js +1 -0
  23. package/src/ribbon/items/ribbon-dropdown.d.ts +7 -1
  24. package/src/ribbon/items/ribbon-dropdown.js +152 -1
  25. package/src/ribbon/items/ribbon-splitbutton.js +24 -0
  26. package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +10 -5
  27. package/src/ribbon/models/ribbon-combobox-settings.d.ts +10 -5
  28. package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +3 -1
  29. package/src/ribbon/models/ribbon-file-menu-settings.d.ts +3 -1
  30. package/src/ribbon/models/ribbon-item-model.d.ts +1 -1
  31. package/src/ribbon/models/ribbon-item.d.ts +1 -1
  32. package/styles/bootstrap-dark.css +26 -0
  33. package/styles/bootstrap.css +26 -0
  34. package/styles/bootstrap4.css +26 -0
  35. package/styles/bootstrap5-dark.css +26 -0
  36. package/styles/bootstrap5.css +26 -0
  37. package/styles/fabric-dark.css +26 -0
  38. package/styles/fabric.css +26 -0
  39. package/styles/fluent-dark.css +26 -0
  40. package/styles/fluent.css +26 -0
  41. package/styles/highcontrast-light.css +26 -0
  42. package/styles/highcontrast.css +30 -4
  43. package/styles/material-dark.css +26 -0
  44. package/styles/material.css +26 -0
  45. package/styles/material3-dark.css +1671 -0
  46. package/styles/material3-dark.scss +3 -0
  47. package/styles/material3.css +1727 -0
  48. package/styles/material3.scss +3 -0
  49. package/styles/ribbon/_bootstrap-dark-definition.scss +4 -0
  50. package/styles/ribbon/_bootstrap-definition.scss +4 -0
  51. package/styles/ribbon/_bootstrap4-definition.scss +4 -0
  52. package/styles/ribbon/_bootstrap5-definition.scss +4 -0
  53. package/styles/ribbon/_fabric-dark-definition.scss +4 -0
  54. package/styles/ribbon/_fabric-definition.scss +4 -0
  55. package/styles/ribbon/_fluent-definition.scss +4 -0
  56. package/styles/ribbon/_fusionnew-definition.scss +4 -0
  57. package/styles/ribbon/_highcontrast-definition.scss +6 -2
  58. package/styles/ribbon/_highcontrast-light-definition.scss +4 -0
  59. package/styles/ribbon/_layout.scss +27 -0
  60. package/styles/ribbon/_material-dark-definition.scss +4 -0
  61. package/styles/ribbon/_material-definition.scss +4 -0
  62. package/styles/ribbon/_material3-dark-definition.scss +1 -0
  63. package/styles/ribbon/_material3-definition.scss +210 -0
  64. package/styles/ribbon/_tailwind-definition.scss +4 -0
  65. package/styles/ribbon/bootstrap-dark.css +26 -0
  66. package/styles/ribbon/bootstrap.css +26 -0
  67. package/styles/ribbon/bootstrap4.css +26 -0
  68. package/styles/ribbon/bootstrap5-dark.css +26 -0
  69. package/styles/ribbon/bootstrap5.css +26 -0
  70. package/styles/ribbon/fabric-dark.css +26 -0
  71. package/styles/ribbon/fabric.css +26 -0
  72. package/styles/ribbon/fluent-dark.css +26 -0
  73. package/styles/ribbon/fluent.css +26 -0
  74. package/styles/ribbon/highcontrast-light.css +26 -0
  75. package/styles/ribbon/highcontrast.css +30 -4
  76. package/styles/ribbon/icons/_material3-dark.scss +1 -0
  77. package/styles/ribbon/material-dark.css +26 -0
  78. package/styles/ribbon/material.css +26 -0
  79. package/styles/ribbon/material3-dark.css +1671 -0
  80. package/styles/ribbon/material3-dark.scss +18 -0
  81. package/styles/ribbon/material3.css +1727 -0
  82. package/styles/ribbon/material3.scss +18 -0
  83. package/styles/ribbon/tailwind-dark.css +26 -0
  84. package/styles/ribbon/tailwind.css +26 -0
  85. package/styles/tailwind-dark.css +26 -0
  86. package/styles/tailwind.css +26 -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;
@@ -2663,6 +2847,12 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2663
2847
  this.idIndex = 0;
2664
2848
  this.tooltipData = [];
2665
2849
  this.isAddRemove = false;
2850
+ this.keyConfigs = {
2851
+ leftarrow: 'leftarrow',
2852
+ rightarrow: 'rightarrow',
2853
+ tab: 'tab',
2854
+ shiftTab: 'shift+tab'
2855
+ };
2666
2856
  };
2667
2857
  /**
2668
2858
  * Get the properties to be maintained in the persisted state.
@@ -2704,12 +2894,239 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2704
2894
  this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
2705
2895
  }
2706
2896
  this.createHelpPaneTemplate();
2897
+ var toolbar = this.tabObj['tbObj'];
2898
+ toolbar.refreshOverflow();
2707
2899
  createTooltip(this.element, this);
2708
2900
  this.wireEvents();
2901
+ this.wireKeyboardEvent();
2902
+ this.currentControlIndex = 0;
2709
2903
  };
2710
2904
  Ribbon.prototype.wireEvents = function () {
2711
2905
  EventHandler.add(window, 'resize', this.resizeHandler, this);
2712
2906
  };
2907
+ Ribbon.prototype.wireKeyboardEvent = function () {
2908
+ this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
2909
+ keyAction: this.keyActionHandler.bind(this),
2910
+ keyConfigs: this.keyConfigs,
2911
+ eventName: 'keydown'
2912
+ });
2913
+ };
2914
+ Ribbon.prototype.keyActionHandler = function (e) {
2915
+ if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
2916
+ e.preventDefault();
2917
+ }
2918
+ var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2919
+ var ribbonControls = activeContent.querySelectorAll('.e-control');
2920
+ var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
2921
+ var comboBoxEle;
2922
+ if (comboBoxElements) {
2923
+ for (var i = 0; i < comboBoxElements.length; i++) {
2924
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2925
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
2926
+ }
2927
+ }
2928
+ }
2929
+ if (comboBoxEle) {
2930
+ for (var i = 0; i < ribbonControls.length; i++) {
2931
+ if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
2932
+ if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
2933
+ this.currentControlIndex = i;
2934
+ }
2935
+ }
2936
+ }
2937
+ }
2938
+ if (this.currentControlIndex === 0) {
2939
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2940
+ while (item && item.classList.contains('e-disabled')) {
2941
+ this.currentControlIndex++;
2942
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
2943
+ }
2944
+ }
2945
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
2946
+ e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
2947
+ e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
2948
+ e.target.classList.contains('e-ribbon-overall-of-btn')) {
2949
+ switch (e.action) {
2950
+ case 'rightarrow':
2951
+ this.handleNavigation(e, !this.enableRtl, ribbonControls);
2952
+ break;
2953
+ case 'leftarrow':
2954
+ this.handleNavigation(e, this.enableRtl, ribbonControls);
2955
+ break;
2956
+ case 'tab':
2957
+ if (e.target.classList.contains('e-combobox')) {
2958
+ if (this.currentControlIndex < ribbonControls.length - 1) {
2959
+ this.currentControlIndex++;
2960
+ }
2961
+ }
2962
+ break;
2963
+ case 'shiftTab':
2964
+ if (e.target.classList.contains('e-combobox')) {
2965
+ if (this.currentControlIndex > 0) {
2966
+ this.currentControlIndex--;
2967
+ }
2968
+ }
2969
+ else {
2970
+ this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
2971
+ this.currentControlIndex = 0;
2972
+ }
2973
+ }
2974
+ }
2975
+ };
2976
+ Ribbon.prototype.handleNavigation = function (e, enableRtl, ribbonControls) {
2977
+ var groupContainer;
2978
+ var prevGroupId;
2979
+ if (enableRtl) {
2980
+ if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
2981
+ this.currentControlIndex++;
2982
+ }
2983
+ }
2984
+ else {
2985
+ if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
2986
+ this.currentControlIndex--;
2987
+ }
2988
+ }
2989
+ if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
2990
+ if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
2991
+ if (enableRtl) {
2992
+ this.currentControlIndex++;
2993
+ }
2994
+ else {
2995
+ var prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
2996
+ if (prevGroupContainer) {
2997
+ prevGroupId = prevGroupContainer.getAttribute('id');
2998
+ }
2999
+ this.currentControlIndex--;
3000
+ }
3001
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3002
+ while (item && item.classList.contains('e-disabled')) {
3003
+ if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
3004
+ (!enableRtl && this.currentControlIndex === 0))) {
3005
+ if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
3006
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3007
+ break;
3008
+ }
3009
+ }
3010
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3011
+ enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
3012
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3013
+ }
3014
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3015
+ if (this.activeLayout === 'Classic') {
3016
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3017
+ if (enableRtl) {
3018
+ var launcherIconEle = void 0;
3019
+ if (groupContainer) {
3020
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3021
+ }
3022
+ if (launcherIconEle) {
3023
+ var items = groupContainer.querySelectorAll('.e-ribbon-item');
3024
+ items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
3025
+ }
3026
+ }
3027
+ else {
3028
+ if (groupContainer) {
3029
+ var groupContainerId = groupContainer.getAttribute('id');
3030
+ if (prevGroupId !== groupContainerId) {
3031
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3032
+ if (launcherIconEle) {
3033
+ ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
3034
+ }
3035
+ }
3036
+ }
3037
+ }
3038
+ }
3039
+ else {
3040
+ if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
3041
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
3042
+ }
3043
+ else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
3044
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
3045
+ }
3046
+ }
3047
+ }
3048
+ }
3049
+ else {
3050
+ if (this.activeLayout === 'Classic') {
3051
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3052
+ }
3053
+ if (this.activeLayout === 'Simplified') {
3054
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
3055
+ if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
3056
+ overflowButton.focus();
3057
+ }
3058
+ else {
3059
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3060
+ }
3061
+ }
3062
+ }
3063
+ if (e.target.classList.contains('e-ribbon-last-item')) {
3064
+ if (enableRtl) {
3065
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3066
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
3067
+ }
3068
+ else {
3069
+ this.currentControlIndex--;
3070
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3071
+ }
3072
+ }
3073
+ if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
3074
+ groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
3075
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
3076
+ if (launcherIconEle) {
3077
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
3078
+ }
3079
+ }
3080
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
3081
+ if (enableRtl) {
3082
+ this.currentControlIndex++;
3083
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3084
+ if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
3085
+ ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
3086
+ }
3087
+ }
3088
+ else {
3089
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
3090
+ this.currentControlIndex;
3091
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3092
+ }
3093
+ }
3094
+ if (e.target.classList.contains('e-ribbon-collapse-btn')) {
3095
+ if (enableRtl) {
3096
+ this.currentControlIndex = 0;
3097
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3098
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
3099
+ this.currentControlIndex++;
3100
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3101
+ }
3102
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3103
+ }
3104
+ else {
3105
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
3106
+ if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
3107
+ overflowButton.focus();
3108
+ }
3109
+ else {
3110
+ this.currentControlIndex = ribbonControls.length - 1;
3111
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3112
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
3113
+ this.currentControlIndex--;
3114
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
3115
+ }
3116
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3117
+ }
3118
+ }
3119
+ }
3120
+ if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
3121
+ if (enableRtl) {
3122
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
3123
+ }
3124
+ else {
3125
+ this.currentControlIndex = ribbonControls.length - 1;
3126
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
3127
+ }
3128
+ }
3129
+ };
2713
3130
  Ribbon.prototype.resizeHandler = function () {
2714
3131
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
2715
3132
  this.checkOverflow(this.selectedTab, activeContent);
@@ -2912,7 +3329,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2912
3329
  for (var k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
2913
3330
  var item = collection.items[k - 1];
2914
3331
  var itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
2915
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3332
+ if (((item.displayOptions === DisplayMode.Auto) ||
3333
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2916
3334
  itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
2917
3335
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
2918
3336
  if (item.activeSize === RibbonItemSize.Small) {
@@ -2983,7 +3401,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
2983
3401
  if (overflowtarget) {
2984
3402
  itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
2985
3403
  }
2986
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
3404
+ if (((item.displayOptions === DisplayMode.Auto) ||
3405
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
2987
3406
  var width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
2988
3407
  if (!isClear && (tabContent.offsetWidth < width)) {
2989
3408
  flag = false;
@@ -3073,7 +3492,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3073
3492
  }
3074
3493
  overflowButton = this.overflowDDB;
3075
3494
  }
3076
- this.addOverflowEvents(item, itemEle, overflowButton);
3495
+ if (itemEle !== null) {
3496
+ this.addOverflowEvents(item, itemEle, overflowButton);
3497
+ }
3077
3498
  };
3078
3499
  Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
3079
3500
  switch (item.type) {
@@ -3122,6 +3543,50 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3122
3543
  }
3123
3544
  return isBreak;
3124
3545
  };
3546
+ Ribbon.prototype.checkValidCollectionLength = function (collections) {
3547
+ var count = 0;
3548
+ for (var i = 0; i < collections.length; i++) {
3549
+ var items = collections[parseInt(i.toString(), 10)].items;
3550
+ for (var ind = 0; ind < items.length; ind++) {
3551
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3552
+ count++;
3553
+ break;
3554
+ }
3555
+ }
3556
+ if (count > 1) {
3557
+ return false;
3558
+ }
3559
+ }
3560
+ return count === 1;
3561
+ };
3562
+ Ribbon.prototype.checkClassicCollection = function (collections, n, isIncrement) {
3563
+ var items = collections[parseInt(n.toString(), 10)].items;
3564
+ for (var ind = 0; ind < items.length; ind++) {
3565
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
3566
+ return n;
3567
+ }
3568
+ }
3569
+ n = isIncrement ? n + 1 : n - 1;
3570
+ if (isIncrement) {
3571
+ return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
3572
+ }
3573
+ else {
3574
+ return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
3575
+ }
3576
+ };
3577
+ Ribbon.prototype.checkClassicItem = function (items, n, isIncrement) {
3578
+ var item = items[parseInt(n.toString(), 10)];
3579
+ if (item.displayOptions & DisplayMode.Classic) {
3580
+ return n;
3581
+ }
3582
+ n = isIncrement ? n + 1 : n - 1;
3583
+ if (isIncrement) {
3584
+ return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
3585
+ }
3586
+ else {
3587
+ return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
3588
+ }
3589
+ };
3125
3590
  Ribbon.prototype.checkLargeToMedium = function (tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip) {
3126
3591
  var _this = this;
3127
3592
  if (shouldSkip === void 0) { shouldSkip = false; }
@@ -3155,6 +3620,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3155
3620
  createShrinkEle(collection.id, firstItem, start, end);
3156
3621
  for (var i = start; i <= end; i++) {
3157
3622
  var item = collection.items[parseInt(i.toString(), 10)];
3623
+ if (!(item.displayOptions & DisplayMode.Classic)) {
3624
+ continue;
3625
+ }
3158
3626
  var ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
3159
3627
  shrinkEle.appendChild(ele);
3160
3628
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
@@ -3179,45 +3647,65 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3179
3647
  if (orientation === ItemOrientation.Column) {
3180
3648
  for (var k = (group.collections.length - 1); k > 0; k--) {
3181
3649
  //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);
3650
+ k = this.checkClassicCollection(group.collections, k, false);
3651
+ var l = k - 1;
3652
+ //Checks the element rendered at position n
3653
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
3654
+ l = this.checkClassicCollection(group.collections, l, false);
3655
+ //Checks the element rendered at position n-1
3656
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
3657
+ var m = l - 1;
3658
+ if (m >= 0) {
3659
+ m = this.checkClassicCollection(group.collections, m, false);
3660
+ }
3661
+ //Checks the element rendered at position n-2
3662
+ if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
3663
+ moveCollectionToColumn(m, k);
3186
3664
  }
3187
3665
  else {
3188
- moveCollectionToColumn(k - 1, k);
3666
+ moveCollectionToColumn(l, k);
3189
3667
  }
3190
- k -= 2;
3668
+ k = m;
3191
3669
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3192
3670
  return true;
3193
3671
  }
3194
3672
  }
3195
3673
  else {
3196
- k--;
3674
+ k = l;
3197
3675
  }
3198
3676
  }
3199
3677
  }
3200
3678
  }
3201
3679
  else {
3202
- if (group.collections.length === 1) {
3680
+ if (this.checkValidCollectionLength(group.collections)) {
3203
3681
  var collection = group.collections[0];
3204
3682
  for (var k = (collection.items.length - 1); k > 0; k--) {
3205
3683
  //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);
3684
+ k = this.checkClassicItem(collection.items, k, false);
3685
+ var l = k - 1;
3686
+ //Checks the element rendered at position n
3687
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
3688
+ l = this.checkClassicItem(collection.items, l, false);
3689
+ //Checks the element rendered at position n-1
3690
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
3691
+ var m = l - 1;
3692
+ //Checks the element rendered at position n-2
3693
+ if (m >= 0) {
3694
+ m = this.checkClassicItem(collection.items, m, false);
3695
+ }
3696
+ if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
3697
+ moveItemToColumn(m, k);
3210
3698
  }
3211
3699
  else {
3212
- moveItemToColumn(k - 1, k);
3700
+ moveItemToColumn(l, k);
3213
3701
  }
3214
- k -= 2;
3702
+ k = m;
3215
3703
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3216
3704
  return true;
3217
3705
  }
3218
3706
  }
3219
3707
  else {
3220
- k--;
3708
+ k = l;
3221
3709
  }
3222
3710
  }
3223
3711
  }
@@ -3238,28 +3726,44 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3238
3726
  var canReduceItem = function (item) {
3239
3727
  return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
3240
3728
  };
3241
- var reduceItemsToSmall = function (collectionIndex, start, end) {
3729
+ var reduceItemsToSmall = function (collectionIndex, start, end, middle) {
3730
+ if (middle === void 0) { middle = null; }
3242
3731
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
3243
3732
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
3244
- for (var i = start; i <= end; i++) {
3733
+ var reduce = function (i) {
3245
3734
  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);
3735
+ if (item.displayOptions & DisplayMode.Classic) {
3736
+ var ele_1 = activeContent.querySelector('#' + item.id);
3737
+ item.setProperties({ activeSize: RibbonItemSize.Small }, true);
3738
+ _this.setItemSize(ele_1, item);
3739
+ }
3740
+ };
3741
+ reduce(start);
3742
+ if (middle) {
3743
+ reduce(middle);
3249
3744
  }
3745
+ reduce(end);
3250
3746
  };
3251
- var reduceCollectionsToSmall = function (index, start, end) {
3747
+ var reduceCollectionsToSmall = function (index, start, end, middle) {
3748
+ if (middle === void 0) { middle = null; }
3252
3749
  var group = _this.tabs[parseInt(tabIndex.toString(), 10)]
3253
3750
  .groups[parseInt(groupIndex.toString(), 10)];
3254
3751
  if (!shouldSkip) {
3255
3752
  shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
3256
3753
  }
3257
- for (var i = start; i <= end; i++) {
3754
+ var reduce = function (i) {
3258
3755
  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]);
3756
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
3757
+ var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
3758
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
3759
+ _this.setItemSize(ele_2, collection.items[0]);
3760
+ }
3761
+ };
3762
+ reduce(start);
3763
+ if (middle) {
3764
+ reduce(middle);
3262
3765
  }
3766
+ reduce(end);
3263
3767
  };
3264
3768
  var setWidth = function (id) {
3265
3769
  if (!shouldSkip) {
@@ -3273,13 +3777,14 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3273
3777
  var start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
3274
3778
  var end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
3275
3779
  //only 2 or 3 itmes alone can be present in shrinked column
3780
+ var l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
3276
3781
  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.
3782
+ && canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
3783
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
3279
3784
  reduceCollectionsToSmall(k, start, end);
3280
3785
  }
3281
- else if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])) {
3282
- reduceCollectionsToSmall(k, start, end);
3786
+ else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
3787
+ reduceCollectionsToSmall(k, start, end, l);
3283
3788
  }
3284
3789
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3285
3790
  return true;
@@ -3289,16 +3794,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3289
3794
  }
3290
3795
  for (var k = (group.collections.length - 1); k >= 0; k--) {
3291
3796
  var collection = group.collections[parseInt(k.toString(), 10)];
3797
+ var classicItems = [];
3798
+ for (var i = 0; i < collection.items.length; i++) {
3799
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3800
+ classicItems.push(i);
3801
+ }
3802
+ }
3292
3803
  //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) {
3804
+ if ((classicItems.length > 1)) {
3805
+ if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
3806
+ if (classicItems.length === 2) {
3296
3807
  setWidth(collection.id);
3297
- reduceItemsToSmall(k, 0, 1);
3808
+ reduceItemsToSmall(k, classicItems[0], classicItems[1]);
3298
3809
  }
3299
- else if (canReduceItem(collection.items[2])) {
3810
+ else if (canReduceItem(collection.items[classicItems[2]])) {
3300
3811
  setWidth(collection.id);
3301
- reduceItemsToSmall(k, 0, 2);
3812
+ reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
3302
3813
  }
3303
3814
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3304
3815
  return true;
@@ -3308,22 +3819,24 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3308
3819
  }
3309
3820
  }
3310
3821
  else {
3311
- if (group.collections.length === 1) {
3822
+ if (this.checkValidCollectionLength(group.collections)) {
3312
3823
  if (shrinkColumns.length > 0) {
3313
3824
  for (var k = (shrinkColumns.length - 1); k >= 0; k--) {
3314
3825
  var shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
3315
3826
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3316
3827
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3317
3828
  //only 2 or 3 itmes alone can be present in shrinked column
3829
+ var collection = group.collections[0];
3830
+ var l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
3318
3831
  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.
3832
+ && canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
3833
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
3321
3834
  setWidth(shrinkColumn.id);
3322
3835
  reduceItemsToSmall(0, start, end);
3323
3836
  }
3324
3837
  else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
3325
3838
  setWidth(shrinkColumn.id);
3326
- reduceItemsToSmall(0, start, end);
3839
+ reduceItemsToSmall(0, start, end, l);
3327
3840
  }
3328
3841
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
3329
3842
  return true;
@@ -3336,6 +3849,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3336
3849
  for (var k = (group.collections.length - 1); k >= 0; k--) {
3337
3850
  var collection = group.collections[parseInt(k.toString(), 10)];
3338
3851
  for (var l = (collection.items.length - 1); l >= 0; l--) {
3852
+ l = this.checkClassicItem(collection.items, l, false);
3853
+ if (l < 0) {
3854
+ continue;
3855
+ }
3339
3856
  var item = collection.items[parseInt(l.toString(), 10)];
3340
3857
  if (canReduceItem(item)) {
3341
3858
  setWidth(item.id);
@@ -3369,20 +3886,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3369
3886
  var canExpandItem = function (item) {
3370
3887
  return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
3371
3888
  };
3372
- var expandItemsToMedium = function (collectionIndex, start, end, parentEle) {
3889
+ var expandItemToMedium = function (collectionIndex, index, parentEle) {
3373
3890
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
3374
3891
  .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)];
3892
+ var item = collection.items[parseInt(index.toString(), 10)];
3893
+ if (item.displayOptions & DisplayMode.Classic) {
3377
3894
  var ele_4 = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
3378
3895
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
3379
3896
  _this.setItemSize(ele_4, item);
3380
3897
  }
3381
3898
  };
3382
- var expandCollectionsToMedium = function (start, end) {
3899
+ var expandCollectionsToMedium = function (i) {
3383
3900
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)]
3384
3901
  .groups[parseInt(groupIndex.toString(), 10)].collections;
3385
- for (var i = start; i <= end; i++) {
3902
+ var item = collections[parseInt(i.toString(), 10)].items[0];
3903
+ if (item.displayOptions & DisplayMode.Classic) {
3386
3904
  var ele_5 = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
3387
3905
  collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
3388
3906
  _this.setItemSize(ele_5, collections[parseInt(i.toString(), 10)].items[0]);
@@ -3390,17 +3908,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3390
3908
  };
3391
3909
  if (orientation === ItemOrientation.Row) {
3392
3910
  // collection length is 1, then the it wll be covered in shrinked columns
3393
- if (group.collections.length !== 1) {
3911
+ if (!this.checkValidCollectionLength(group.collections)) {
3394
3912
  for (var k = 0; k < group.collections.length; k++) {
3395
3913
  var collection = group.collections[parseInt(k.toString(), 10)];
3396
3914
  for (var l = 0; l < collection.items.length; l++) {
3915
+ l = this.checkClassicItem(collection.items, l, true);
3916
+ if (l === collection.items.length) {
3917
+ continue;
3918
+ }
3397
3919
  var item = collection.items[parseInt(l.toString(), 10)];
3398
3920
  if (canExpandItem(item)) {
3399
3921
  var itemEle = activeContent.querySelector('#' + item.id);
3400
3922
  var valString = itemEle.getAttribute('data-medium-width');
3401
3923
  var value = valString ? parseInt(valString, 10) : null;
3402
3924
  if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
3403
- expandItemsToMedium(k, l, l, itemEle);
3925
+ expandItemToMedium(k, l, itemEle);
3404
3926
  if (!shouldSkip || shouldClear) {
3405
3927
  itemEle.removeAttribute('data-medium-width');
3406
3928
  }
@@ -3421,8 +3943,18 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3421
3943
  var itemEle = activeContent.querySelector('#' + collection.id);
3422
3944
  var valString = itemEle.getAttribute('data-medium-width');
3423
3945
  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);
3946
+ var classicItems = [];
3947
+ for (var i = 0; i < collection.items.length; i++) {
3948
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
3949
+ classicItems.push(i);
3950
+ }
3951
+ }
3952
+ if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
3953
+ expandItemToMedium(k, classicItems[0], itemEle);
3954
+ expandItemToMedium(k, classicItems[1], itemEle);
3955
+ if (classicItems.length === 3) {
3956
+ expandItemToMedium(k, classicItems[2], itemEle);
3957
+ }
3426
3958
  if (!shouldSkip || shouldClear) {
3427
3959
  itemEle.removeAttribute('data-medium-width');
3428
3960
  }
@@ -3442,10 +3974,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3442
3974
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3443
3975
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3444
3976
  if (orientation === ItemOrientation.Row) {
3445
- expandItemsToMedium(0, start, end, shrinkColumn);
3977
+ var collection = group.collections[0];
3978
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
3979
+ expandItemToMedium(0, start, shrinkColumn);
3980
+ expandItemToMedium(0, l, shrinkColumn);
3981
+ // 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.
3982
+ if (l !== end) {
3983
+ expandItemToMedium(0, end, shrinkColumn);
3984
+ }
3446
3985
  }
3447
3986
  else {
3448
- expandCollectionsToMedium(start, end);
3987
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
3988
+ expandCollectionsToMedium(start);
3989
+ expandCollectionsToMedium(m);
3990
+ if (m !== end) {
3991
+ expandCollectionsToMedium(end);
3992
+ }
3449
3993
  }
3450
3994
  if (!shouldSkip || shouldClear) {
3451
3995
  shrinkColumn.removeAttribute('data-medium-width');
@@ -3467,32 +4011,46 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3467
4011
  if (shrinkColumns.length === 0) {
3468
4012
  return false;
3469
4013
  }
3470
- var expandItemsToLarge = function (start, end, parentEle) {
4014
+ var expandItemsToLarge = function (start, end, parentEle, middle) {
3471
4015
  var items = _this.tabs[parseInt(tabIndex.toString(), 10)].
3472
4016
  groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
3473
- for (var i = end; i >= start; i--) {
4017
+ var reduce = function (i) {
3474
4018
  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);
4019
+ if (item.displayOptions & DisplayMode.Classic) {
4020
+ var container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
4021
+ var ele_6 = container.querySelector('#' + item.id);
4022
+ item.setProperties({ activeSize: RibbonItemSize.Large }, true);
4023
+ _this.setItemSize(ele_6, item);
4024
+ parentEle.insertAdjacentElement('afterend', container);
4025
+ }
4026
+ };
4027
+ reduce(start);
4028
+ if (middle) {
4029
+ reduce(middle);
3480
4030
  }
4031
+ reduce(end);
3481
4032
  if (!shouldSkip || shouldClear) {
3482
4033
  remove(parentEle);
3483
4034
  }
3484
4035
  };
3485
- var expandCollectionsToLarge = function (start, end, parentEle) {
4036
+ var expandCollectionsToLarge = function (start, end, parentEle, middle) {
3486
4037
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)].
3487
4038
  groups[parseInt(groupIndex.toString(), 10)].collections;
3488
- for (var i = end; i >= start; i--) {
4039
+ var reduce = function (i) {
3489
4040
  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);
4041
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
4042
+ var collectionEle = parentEle.querySelector('#' + collection.id);
4043
+ var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
4044
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
4045
+ _this.setItemSize(ele_7, collection.items[0]);
4046
+ parentEle.insertAdjacentElement('afterend', collectionEle);
4047
+ }
4048
+ };
4049
+ reduce(start);
4050
+ if (middle) {
4051
+ reduce(middle);
3495
4052
  }
4053
+ reduce(end);
3496
4054
  if (!shouldSkip || shouldClear) {
3497
4055
  remove(parentEle);
3498
4056
  }
@@ -3505,10 +4063,23 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3505
4063
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
3506
4064
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
3507
4065
  if (orientation === ItemOrientation.Row) {
3508
- expandItemsToLarge(start, end, shrinkColumn);
4066
+ var collection = group.collections[0];
4067
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
4068
+ if (l === end) {
4069
+ expandItemsToLarge(start, end, shrinkColumn);
4070
+ }
4071
+ else {
4072
+ expandItemsToLarge(start, end, shrinkColumn, l);
4073
+ }
3509
4074
  }
3510
4075
  else {
3511
- expandCollectionsToLarge(start, end, shrinkColumn);
4076
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
4077
+ if (m === end) {
4078
+ expandCollectionsToLarge(start, end, shrinkColumn);
4079
+ }
4080
+ else {
4081
+ expandCollectionsToLarge(start, end, shrinkColumn, m);
4082
+ }
3512
4083
  }
3513
4084
  if (!shouldSkip || shouldClear) {
3514
4085
  shrinkColumn.removeAttribute('data-large-width');
@@ -3564,7 +4135,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3564
4135
  //Expanding the items in the group to their original expanded state
3565
4136
  this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
3566
4137
  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);
4138
+ var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
3568
4139
  this_1.tabs[parseInt(tabIndex.toString(), 10)].
3569
4140
  groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
3570
4141
  for (var j = 0; j < group.collections.length; j++) {
@@ -3573,7 +4144,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3573
4144
  for (var k = 0; k < collection.items.length; k++) {
3574
4145
  var item = collection.items[parseInt(k.toString(), 10)];
3575
4146
  var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3576
- this_1.addOverflowEvents(item, itemEle, dropdown);
4147
+ if (itemEle !== null) {
4148
+ this_1.addOverflowEvents(item, itemEle, dropdown);
4149
+ }
3577
4150
  }
3578
4151
  }
3579
4152
  };
@@ -3613,7 +4186,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3613
4186
  for (var k = 0; k < collection.items.length; k++) {
3614
4187
  var item = collection.items[parseInt(k.toString(), 10)];
3615
4188
  var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
3616
- this_2.removeOverflowEvent(item, itemEle);
4189
+ if (itemEle !== null) {
4190
+ this_2.removeOverflowEvent(item, itemEle);
4191
+ }
3617
4192
  }
3618
4193
  }
3619
4194
  };
@@ -3671,6 +4246,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3671
4246
  };
3672
4247
  Ribbon.prototype.ribbonTabSelecting = function (e) {
3673
4248
  var _this = this;
4249
+ this.currentControlIndex = 0;
3674
4250
  var nextTabId = e.selectingItem.getAttribute('data-id');
3675
4251
  var previousTabId = e.previousItem.getAttribute('data-id');
3676
4252
  var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
@@ -3727,11 +4303,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3727
4303
  this.checkOverflow(this.selectedTab, activeContent);
3728
4304
  };
3729
4305
  Ribbon.prototype.addOverflowButton = function (btnId) {
4306
+ var _this = this;
3730
4307
  var overflowButton = this.createElement('button', {
3731
4308
  id: btnId
3732
4309
  });
3733
4310
  var overflowTarget = this.createElement('div', {
3734
- className: RIBBON_OVERFLOW_TARGET
4311
+ className: RIBBON_OVERFLOW_TARGET,
4312
+ attrs: { 'tabindex': '0' }
3735
4313
  });
3736
4314
  var overflowDDB = new DropDownButton({
3737
4315
  iconCss: OVERFLOW_ICON,
@@ -3749,8 +4327,112 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3749
4327
  }, overflowButton);
3750
4328
  this.element.classList.add(RIBBON_OVERFLOW);
3751
4329
  createTooltip(overflowTarget, this);
4330
+ var isGroupOf;
4331
+ overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
4332
+ overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
3752
4333
  return overflowDDB;
3753
4334
  };
4335
+ Ribbon.prototype.upDownKeyHandler = function (e, target, isGroupOf) {
4336
+ var items;
4337
+ if (isGroupOf) {
4338
+ items = target.getElementsByClassName('e-ribbon-item');
4339
+ }
4340
+ else {
4341
+ var currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
4342
+ items = currentList.getElementsByClassName('e-ribbon-item');
4343
+ }
4344
+ 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;
4345
+ var ribbonItem;
4346
+ if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
4347
+ if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
4348
+ if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
4349
+ this.itemIndex = 0;
4350
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4351
+ this.findDisabledItem(ribbonItem, items, true);
4352
+ if (comboBoxEle && e.key === 'Tab') {
4353
+ e.preventDefault();
4354
+ items[this.itemIndex].querySelector('.e-control').focus();
4355
+ }
4356
+ }
4357
+ else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
4358
+ this.itemIndex++;
4359
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4360
+ this.findDisabledItem(ribbonItem, items, true);
4361
+ }
4362
+ }
4363
+ else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
4364
+ if (comboBoxEle === null || (e.key === 'Tab')) {
4365
+ if (!this.itemIndex || this.itemIndex === -1) {
4366
+ this.itemIndex = items.length - 1;
4367
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4368
+ this.findDisabledItem(ribbonItem, items, false);
4369
+ if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
4370
+ e.preventDefault();
4371
+ items[this.itemIndex].querySelector('.e-control').focus();
4372
+ }
4373
+ }
4374
+ else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
4375
+ this.itemIndex--;
4376
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4377
+ this.findDisabledItem(ribbonItem, items, false);
4378
+ }
4379
+ }
4380
+ }
4381
+ target.setAttribute('index', this.itemIndex.toString());
4382
+ }
4383
+ var currentItemIndex = parseInt(target.getAttribute('index'), 10);
4384
+ var itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
4385
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
4386
+ if (itemType === 'ColorPicker') {
4387
+ if (e.key === 'Tab') {
4388
+ e.preventDefault();
4389
+ }
4390
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
4391
+ }
4392
+ else {
4393
+ if (e.key === 'Tab') {
4394
+ e.preventDefault();
4395
+ }
4396
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4397
+ }
4398
+ if (e.key === ' ' && (itemType === 'CheckBox')) {
4399
+ var checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
4400
+ var checkBox = getComponent(checkBoxEle, CheckBox);
4401
+ this.itemIndex = -1;
4402
+ checkBox.click();
4403
+ }
4404
+ }
4405
+ if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
4406
+ if (e.key === 'ArrowRight') {
4407
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
4408
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
4409
+ }
4410
+ if (e.key === 'ArrowLeft') {
4411
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
4412
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
4413
+ }
4414
+ }
4415
+ if (e.key === 'Enter') {
4416
+ this.itemIndex = -1;
4417
+ }
4418
+ };
4419
+ Ribbon.prototype.findDisabledItem = function (ribbonItem, items, isIncrease) {
4420
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
4421
+ if (isIncrease) {
4422
+ if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4423
+ this.itemIndex = -1;
4424
+ }
4425
+ }
4426
+ else {
4427
+ if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
4428
+ this.itemIndex = items.length;
4429
+ }
4430
+ }
4431
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
4432
+ isIncrease ? this.itemIndex++ : this.itemIndex--;
4433
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
4434
+ }
4435
+ };
3754
4436
  Ribbon.prototype.removeOverflowButton = function (overflowDDB) {
3755
4437
  if (overflowDDB) {
3756
4438
  var btnEle = overflowDDB.element;
@@ -3840,6 +4522,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3840
4522
  }
3841
4523
  };
3842
4524
  Ribbon.prototype.switchLayout = function () {
4525
+ this.currentControlIndex = 0;
3843
4526
  this.destroyScroll();
3844
4527
  this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
3845
4528
  this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
@@ -3854,6 +4537,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3854
4537
  if (this.activeLayout === 'Simplified') {
3855
4538
  for (var i_1 = 0; i_1 < groupList.length; i_1++) {
3856
4539
  var group = groupList[parseInt(i_1.toString(), 10)];
4540
+ var alignType = groupList[parseInt(i_1.toString(), 10)].orientation;
3857
4541
  if (group.isCollapsed) {
3858
4542
  group.setProperties({ isCollapsed: false }, true);
3859
4543
  this.removeDropdown(group.id);
@@ -3881,11 +4565,11 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3881
4565
  var itemList = collection.items;
3882
4566
  var item = collection.items[parseInt(k.toString(), 10)];
3883
4567
  var flag = true;
3884
- while ((flag) && (item.displayOptions === DisplayMode.None)) {
4568
+ while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
3885
4569
  k++;
3886
4570
  var itemEle_1 = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3887
- var ele_8 = itemEle_1.querySelector('#' + item.id);
3888
- this.destroyFunction(item, ele_8);
4571
+ var ele = itemEle_1.querySelector('#' + item.id);
4572
+ this.destroyFunction(item, ele);
3889
4573
  itemEle_1.remove();
3890
4574
  if (k < itemList.length) {
3891
4575
  item = itemList[parseInt(k.toString(), 10)];
@@ -3897,19 +4581,29 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3897
4581
  if (!flag) {
3898
4582
  break;
3899
4583
  }
3900
- var itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
3901
- var ele = itemEle.querySelector('#' + item.id);
3902
4584
  var size = ((item.allowedSizes === RibbonItemSize.Large) ||
3903
4585
  (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);
4586
+ size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
4587
+ ? RibbonItemSize.Medium : size;
4588
+ var itemEle = void 0;
4589
+ if (!(item.displayOptions & DisplayMode.Classic)) {
4590
+ itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
4591
+ if (item.displayOptions & DisplayMode.Simplified) {
4592
+ groupCollection.append(itemEle);
3909
4593
  }
3910
4594
  }
3911
- item.setProperties({ activeSize: size }, true);
3912
- this.setItemSize(ele, item);
4595
+ else {
4596
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4597
+ if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
4598
+ this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
4599
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
4600
+ this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
4601
+ }
4602
+ }
4603
+ item.setProperties({ activeSize: size }, true);
4604
+ var ele = itemEle.querySelector('#' + item.id);
4605
+ this.setItemSize(ele, item);
4606
+ }
3913
4607
  }
3914
4608
  }
3915
4609
  if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
@@ -3956,22 +4650,37 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3956
4650
  groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
3957
4651
  }
3958
4652
  for (var k = 0; k < collection.items.length; k++) {
4653
+ var itemList = collection.items;
3959
4654
  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);
4655
+ var flag = true;
4656
+ while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
4657
+ k++;
4658
+ var itemEle = void 0;
4659
+ if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
4660
+ if (item.displayOptions & DisplayMode.Simplified) {
4661
+ itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
4662
+ }
4663
+ else {
4664
+ itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
4665
+ }
4666
+ if (itemEle !== null) {
4667
+ var ele_8 = itemEle.querySelector('#' + item.id);
4668
+ this.destroyFunction(item, ele_8);
4669
+ itemEle.remove();
4670
+ }
4671
+ }
4672
+ if (k < itemList.length) {
4673
+ item = itemList[parseInt(k.toString(), 10)];
4674
+ }
4675
+ else {
4676
+ flag = false;
3968
4677
  }
3969
- groupCollection.append(itemEle);
3970
- this.removeOverflowEvent(item, itemEle);
3971
4678
  }
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);
4679
+ if (!flag) {
4680
+ break;
4681
+ }
4682
+ if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
4683
+ var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
3975
4684
  groupCollection.append(itemEle);
3976
4685
  }
3977
4686
  else {
@@ -4009,36 +4718,51 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4009
4718
  this.overflowDDB = null;
4010
4719
  }
4011
4720
  };
4721
+ Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
4722
+ var _this = this;
4723
+ var launcherIcon = this.createElement('div', {
4724
+ className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
4725
+ id: groupId + LAUNCHER_ID,
4726
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
4727
+ });
4728
+ groupContainer.appendChild(launcherIcon);
4729
+ groupContainer.classList.add(RIBBON_LAUNCHER);
4730
+ EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
4731
+ EventHandler.add(launcherIcon, 'keydown', function (e) {
4732
+ if (e.key === 'Enter') {
4733
+ _this.launcherIconClicked(groupId);
4734
+ }
4735
+ }, this);
4736
+ };
4012
4737
  Ribbon.prototype.launcherIconClicked = function (id) {
4013
4738
  var eventArgs = { groupId: id };
4014
4739
  this.trigger('launcherIconClick', eventArgs);
4015
4740
  };
4016
4741
  Ribbon.prototype.createGroups = function (groupList, tabIndex) {
4017
- var _this = this;
4018
4742
  var groupElements = [];
4019
- var _loop_3 = function (i) {
4743
+ for (var i = 0; i < groupList.length; i++) {
4020
4744
  var group = groupList[parseInt(i.toString(), 10)];
4021
4745
  var alignType = group.orientation;
4022
- var groupEle = this_3.createElement('div', {
4746
+ var groupEle = this.createElement('div', {
4023
4747
  className: group.cssClass,
4024
4748
  id: group.id
4025
4749
  });
4026
4750
  groupEle.classList.add(RIBBON_GROUP);
4027
4751
  groupElements.push(groupEle);
4028
- var groupContainer = this_3.createElement('div', {
4752
+ var groupContainer = this.createElement('div', {
4029
4753
  className: group.cssClass,
4030
4754
  id: group.id + CONTAINER_ID
4031
4755
  });
4032
4756
  groupContainer.classList.add(RIBBON_GROUP_CONTAINER);
4033
4757
  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),
4758
+ var groupContent = this.createElement('div', {
4759
+ className: this.activeLayout === 'Simplified' ? RIBBON_GROUP_CONTENT : (RIBBON_GROUP_CONTENT + SPACE + RIBBON_CONTENT_HEIGHT),
4036
4760
  id: group.id + CONTENT_ID
4037
4761
  });
4038
- groupContent.classList.add(((alignType === 'Column') || (this_3.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
4762
+ groupContent.classList.add(((alignType === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
4039
4763
  groupContainer.appendChild(groupContent);
4040
- if (this_3.activeLayout === 'Classic') {
4041
- var groupHeader = this_3.createElement('div', {
4764
+ if (this.activeLayout === 'Classic') {
4765
+ var groupHeader = this.createElement('div', {
4042
4766
  className: RIBBON_GROUP_HEADER,
4043
4767
  id: group.id + HEADER_ID,
4044
4768
  innerHTML: group.header
@@ -4046,29 +4770,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4046
4770
  groupContainer.appendChild(groupHeader);
4047
4771
  }
4048
4772
  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);
4773
+ this.createLauncherIcon(group.id, groupContainer);
4062
4774
  }
4063
- var elements = this_3.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
4775
+ var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
4064
4776
  append(elements, groupContent);
4065
- if ((this_3.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
4777
+ if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
4066
4778
  groupEle.classList.add('e-ribbon-emptyCollection');
4067
4779
  }
4068
- };
4069
- var this_3 = this;
4070
- for (var i = 0; i < groupList.length; i++) {
4071
- _loop_3(i);
4072
4780
  }
4073
4781
  return groupElements;
4074
4782
  };
@@ -4130,6 +4838,31 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4130
4838
  }
4131
4839
  return collectionElements;
4132
4840
  };
4841
+ Ribbon.prototype.createRibbonItem = function (item, itemEle) {
4842
+ switch (item.type) {
4843
+ case 'Button':
4844
+ this.ribbonButtonModule.createButton(item, itemEle);
4845
+ break;
4846
+ case 'DropDown':
4847
+ this.ribbonDropDownModule.createDropDown(item, itemEle);
4848
+ break;
4849
+ case 'SplitButton':
4850
+ this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
4851
+ break;
4852
+ case 'CheckBox':
4853
+ this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
4854
+ break;
4855
+ case 'ColorPicker':
4856
+ this.ribbonColorPickerModule.createColorPicker(item, itemEle);
4857
+ break;
4858
+ case 'ComboBox':
4859
+ this.ribbonComboBoxModule.createComboBox(item, itemEle);
4860
+ break;
4861
+ case 'Template':
4862
+ this.createTemplateContent(item, itemEle);
4863
+ break;
4864
+ }
4865
+ };
4133
4866
  Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
4134
4867
  var _a;
4135
4868
  var itemElements = [];
@@ -4137,7 +4870,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4137
4870
  var item = itemList[parseInt(i.toString(), 10)];
4138
4871
  //To stop rendering of items with simplified mode position type as none
4139
4872
  var flag = true;
4140
- while ((this.activeLayout === 'Simplified') && (flag) && (item.displayOptions === DisplayMode.None)) {
4873
+ while (flag &&
4874
+ (((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
4875
+ ((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
4141
4876
  i++;
4142
4877
  if (i < itemList.length) {
4143
4878
  item = itemList[parseInt(i.toString(), 10)];
@@ -4171,30 +4906,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4171
4906
  else {
4172
4907
  itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
4173
4908
  }
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)) {
4909
+ this.createRibbonItem(item, itemEle);
4910
+ if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
4198
4911
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
4199
4912
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
4200
4913
  this.updatePopupItems(item, itemEle, isGroupOF, true);
@@ -4301,13 +5014,15 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4301
5014
  var item = _e[_d];
4302
5015
  var ele = null;
4303
5016
  if (this.activeLayout === RibbonLayout.Classic) {
4304
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5017
+ if (item.displayOptions & DisplayMode.Classic) {
5018
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5019
+ }
4305
5020
  }
4306
5021
  else {
4307
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5022
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4308
5023
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
4309
5024
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4310
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5025
+ if (!ele) {
4311
5026
  ele = dropdown.target.querySelector('#' + item.id);
4312
5027
  if (item.type === 'DropDown') {
4313
5028
  this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
@@ -4363,15 +5078,17 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4363
5078
  var item = _e[_d];
4364
5079
  var ele = void 0;
4365
5080
  if (this.activeLayout === RibbonLayout.Classic) {
4366
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
4367
- contentEle.querySelector('#' + item.id);
5081
+ if (item.displayOptions & DisplayMode.Classic) {
5082
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
5083
+ contentEle.querySelector('#' + item.id);
5084
+ }
4368
5085
  }
4369
5086
  else {
4370
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5087
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4371
5088
  ele = (item.displayOptions & DisplayMode.Simplified) ?
4372
5089
  contentEle.querySelector('#' + item.id) : null;
4373
5090
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4374
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5091
+ if (!ele) {
4375
5092
  ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
4376
5093
  }
4377
5094
  }
@@ -4793,16 +5510,382 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4793
5510
  this.refreshLayout();
4794
5511
  }
4795
5512
  };
5513
+ /**
5514
+ * tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
5515
+ *
5516
+ * @param {RibbonTabModel} tab - Gets the ribbon tab model.
5517
+ * @returns {void}
5518
+ */
5519
+ Ribbon.prototype.updateTab = function (tab) {
5520
+ var tabId = tab.id;
5521
+ var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
5522
+ if (index === -1) {
5523
+ return;
5524
+ }
5525
+ var contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
5526
+ var groups = this.tabs[parseInt(index.toString(), 10)].groups;
5527
+ var tabEle = this.tabObj.element;
5528
+ if (groups && (contentEle.innerHTML !== '')) {
5529
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5530
+ if (tab.cssClass) {
5531
+ if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
5532
+ contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5533
+ tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
5534
+ }
5535
+ }
5536
+ // Check whether group is passed by the user, and if it is, then remove the old values.
5537
+ if (tab.groups) {
5538
+ for (var _i = 0, groups_2 = groups; _i < groups_2.length; _i++) {
5539
+ var group = groups_2[_i];
5540
+ var dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
5541
+ for (var _a = 0, _b = group.collections; _a < _b.length; _a++) {
5542
+ var collection = _b[_a];
5543
+ for (var _c = 0, _d = collection.items; _c < _d.length; _c++) {
5544
+ var item = _d[_c];
5545
+ var ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
5546
+ if (ele) {
5547
+ this.destroyFunction(item, ele);
5548
+ }
5549
+ }
5550
+ }
5551
+ if (dropdownElement) {
5552
+ this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
5553
+ }
5554
+ }
5555
+ var groupElements = contentEle.querySelectorAll('.e-ribbon-group');
5556
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5557
+ groupElements.forEach(function (groupEle) { groupEle.remove(); });
5558
+ }
5559
+ }
5560
+ if (index === this.selectedTab) {
5561
+ this.isAddRemove = true;
5562
+ }
5563
+ var ribbonTab = this.tabs[parseInt(index.toString(), 10)];
5564
+ ribbonTab.setProperties(tab, true);
5565
+ this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
5566
+ this.validateItemSize();
5567
+ if (contentEle.innerHTML === '') {
5568
+ // Check whether group is passed by the user and sets the updated values.
5569
+ if (tab.groups) {
5570
+ var elements = this.createGroups(ribbonTab.groups, index);
5571
+ append(elements, contentEle);
5572
+ }
5573
+ if (this.selectedTab === index) {
5574
+ this.refreshLayout();
5575
+ }
5576
+ // Check whether cssClass is passed by the user and sets the updated values.
5577
+ if (tab.cssClass) {
5578
+ contentEle.classList.add(ribbonTab.cssClass);
5579
+ tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
5580
+ }
5581
+ // Check whether header is passed by the user and sets the updated values.
5582
+ if (tab.header) {
5583
+ tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
5584
+ }
5585
+ }
5586
+ };
5587
+ /**
5588
+ * group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
5589
+ *
5590
+ * @param {RibbonGroupModel} group - Gets the ribbon group model.
5591
+ * @returns {void}
5592
+ */
5593
+ Ribbon.prototype.updateGroup = function (group) {
5594
+ var groupId = group.id;
5595
+ var itemProp = getGroup(this.tabs, groupId);
5596
+ if (!itemProp) {
5597
+ return;
5598
+ }
5599
+ if (this.selectedTab === itemProp.tabIndex) {
5600
+ this.clearOverflowResize();
5601
+ }
5602
+ //Check whether the tab items are rendered
5603
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5604
+ var groupEle = contentEle.querySelector('#' + groupId);
5605
+ var groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
5606
+ var dropdownElement;
5607
+ var dropdown;
5608
+ if (contentEle.innerHTML !== '') {
5609
+ if (itemProp.group.showLauncherIcon) {
5610
+ this.removeLauncherIcon(itemProp.group.id, null, contentEle);
5611
+ }
5612
+ if (this.activeLayout === RibbonLayout.Simplified) {
5613
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5614
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5615
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5616
+ }
5617
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5618
+ if (group.cssClass) {
5619
+ if (itemProp.group.cssClass) {
5620
+ groupEle.classList.remove(itemProp.group.cssClass);
5621
+ if (groupContainer) {
5622
+ groupContainer.classList.remove(itemProp.group.cssClass);
5623
+ }
5624
+ }
5625
+ }
5626
+ // Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
5627
+ if (group.collections || group.orientation) {
5628
+ if (itemProp.group.collections || itemProp.group.orientation) {
5629
+ for (var _i = 0, _a = itemProp.group.collections; _i < _a.length; _i++) {
5630
+ var collection = _a[_i];
5631
+ for (var _b = 0, _c = collection.items; _b < _c.length; _b++) {
5632
+ var item = _c[_b];
5633
+ this.removeItemElement(contentEle, item, dropdown);
5634
+ }
5635
+ }
5636
+ var collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
5637
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5638
+ collectionElements.forEach(function (collectionEle) { collectionEle.remove(); });
5639
+ if (group.orientation) {
5640
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5641
+ var removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
5642
+ if (removeCss) {
5643
+ removeClass([groupContent], removeCss);
5644
+ }
5645
+ }
5646
+ }
5647
+ }
5648
+ if (this.activeLayout === RibbonLayout.Simplified) {
5649
+ if (itemProp.group.enableGroupOverflow) {
5650
+ if (dropdown.target.childElementCount === 0) {
5651
+ this.removeOverflowButton(dropdown);
5652
+ }
5653
+ }
5654
+ else {
5655
+ var ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5656
+ if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
5657
+ ofGroupContainer.remove();
5658
+ }
5659
+ var ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
5660
+ if (ofTabContainer && ofTabContainer.childElementCount === 0) {
5661
+ ofTabContainer.remove();
5662
+ }
5663
+ }
5664
+ }
5665
+ }
5666
+ var ribbongroup = itemProp.group;
5667
+ ribbongroup.setProperties(group, true);
5668
+ ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
5669
+ this.validateItemSize();
5670
+ if (contentEle.innerHTML !== '') {
5671
+ // Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
5672
+ if (group.showLauncherIcon) {
5673
+ this.createLauncherIcon(ribbongroup.id, groupContainer);
5674
+ }
5675
+ // Check whether collections or orientation is passed by the user and sets the updated values.
5676
+ if (group.collections || group.orientation) {
5677
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
5678
+ groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
5679
+ var elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5680
+ append(elements, groupContent);
5681
+ }
5682
+ if (this.selectedTab === itemProp.tabIndex) {
5683
+ this.refreshLayout();
5684
+ }
5685
+ // Check whether cssClass is passed by the user and sets the updated values.
5686
+ if (group.cssClass) {
5687
+ groupEle.classList.add(ribbongroup.cssClass);
5688
+ if (groupContainer) {
5689
+ groupContainer.classList.add(ribbongroup.cssClass);
5690
+ }
5691
+ }
5692
+ // Check whether header is passed by the user and sets the updated values.
5693
+ if (group.header) {
5694
+ if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
5695
+ var overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
5696
+ if (overflowHeader) {
5697
+ overflowHeader.innerText = ribbongroup.header;
5698
+ }
5699
+ }
5700
+ else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
5701
+ groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
5702
+ }
5703
+ else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
5704
+ var overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
5705
+ // need to set instance for dropdown
5706
+ var dropDownBtn = getInstance(overflowEle, DropDownButton);
5707
+ var overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
5708
+ if (overflowHeader) {
5709
+ overflowHeader.innerText = ribbongroup.header;
5710
+ }
5711
+ }
5712
+ }
5713
+ }
5714
+ };
5715
+ /**
5716
+ * collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
5717
+ *
5718
+ * @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
5719
+ * @returns {void}
5720
+ */
5721
+ Ribbon.prototype.updateCollection = function (collection) {
5722
+ var collectionId = collection.id;
5723
+ var itemProp = getCollection(this.tabs, collectionId);
5724
+ if (!itemProp) {
5725
+ return;
5726
+ }
5727
+ if (this.selectedTab === itemProp.tabIndex) {
5728
+ this.clearOverflowResize();
5729
+ }
5730
+ //Check whether the tab items are rendered
5731
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5732
+ var collectionEle = contentEle.querySelector('#' + collectionId);
5733
+ if (contentEle.innerHTML !== '') {
5734
+ var dropdownElement = void 0;
5735
+ var dropdown = void 0;
5736
+ if (this.activeLayout === RibbonLayout.Simplified) {
5737
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5738
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5739
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5740
+ }
5741
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5742
+ if (collection.cssClass) {
5743
+ if (itemProp.collection.cssClass) {
5744
+ collectionEle.classList.remove(itemProp.collection.cssClass);
5745
+ }
5746
+ }
5747
+ if (collection.items) {
5748
+ if (itemProp.collection.items) {
5749
+ for (var _i = 0, _a = itemProp.collection.items; _i < _a.length; _i++) {
5750
+ var item = _a[_i];
5751
+ this.removeItemElement(contentEle, item, dropdown);
5752
+ }
5753
+ }
5754
+ }
5755
+ }
5756
+ var ribboncollection = itemProp.collection;
5757
+ ribboncollection.setProperties(collection, true);
5758
+ ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
5759
+ this.validateItemSize();
5760
+ if (contentEle.innerHTML !== '') {
5761
+ if (collection.items) {
5762
+ var groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5763
+ var elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
5764
+ append(elements, collectionEle);
5765
+ }
5766
+ }
5767
+ if (this.selectedTab === itemProp.tabIndex) {
5768
+ this.refreshLayout();
5769
+ }
5770
+ // Check whether cssClass is passed by the user and sets the updated values.
5771
+ if (collection.cssClass) {
5772
+ collectionEle.classList.add(ribboncollection.cssClass);
5773
+ }
5774
+ };
5775
+ /**
5776
+ * item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
5777
+ *
5778
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
5779
+ * @returns {void}
5780
+ */
5781
+ Ribbon.prototype.updateItem = function (item) {
5782
+ var itemId = item.id;
5783
+ var itemProp = getItem(this.tabs, itemId);
5784
+ if (!itemProp) {
5785
+ return;
5786
+ }
5787
+ if (this.selectedTab === itemProp.tabIndex) {
5788
+ this.clearOverflowResize();
5789
+ }
5790
+ //Check whether the tab items are rendered
5791
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
5792
+ var groupEle = contentEle.querySelector('#' + itemProp.group.id);
5793
+ var groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
5794
+ var itemContainer = null;
5795
+ var itemEle = null;
5796
+ var dropdownElement;
5797
+ var dropdown;
5798
+ if (contentEle.innerHTML !== '') {
5799
+ if (this.activeLayout === RibbonLayout.Simplified) {
5800
+ dropdownElement = itemProp.group.enableGroupOverflow ?
5801
+ contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
5802
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
5803
+ }
5804
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
5805
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5806
+ itemEle = dropdown.target.querySelector('#' + itemId);
5807
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
5808
+ var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
5809
+ if (collectionEle) {
5810
+ collectionEle.appendChild(itemContainer);
5811
+ }
5812
+ }
5813
+ }
5814
+ else {
5815
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5816
+ itemEle = contentEle.querySelector('#' + itemId);
5817
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
5818
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
5819
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
5820
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
5821
+ }
5822
+ }
5823
+ }
5824
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
5825
+ if (item.cssClass) {
5826
+ if (itemProp.item.cssClass) {
5827
+ itemContainer.classList.remove(itemProp.item.cssClass);
5828
+ }
5829
+ }
5830
+ this.destroyFunction(itemProp.item, itemEle);
5831
+ itemEle.remove();
5832
+ var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
5833
+ if (removeCss) {
5834
+ removeClass([itemContainer], removeCss);
5835
+ }
5836
+ }
5837
+ var ribbonItem = itemProp.item;
5838
+ ribbonItem.setProperties(item, true);
5839
+ this.validateItemSize();
5840
+ if (contentEle.innerHTML !== '') {
5841
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
5842
+ itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
5843
+ }
5844
+ else {
5845
+ itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
5846
+ }
5847
+ // To avoid undefined items condition is added
5848
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
5849
+ itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
5850
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
5851
+ }
5852
+ var size = ribbonItem.activeSize;
5853
+ if (this.activeLayout === 'Simplified') {
5854
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
5855
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
5856
+ ribbonItem.setProperties({ activeSize: size }, true);
5857
+ }
5858
+ if (size & RibbonItemSize.Large) {
5859
+ itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
5860
+ }
5861
+ else {
5862
+ itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
5863
+ }
5864
+ this.createRibbonItem(ribbonItem, itemContainer);
5865
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
5866
+ if (dropdown.target.childElementCount === 0) {
5867
+ this.removeOverflowButton(dropdown);
5868
+ }
5869
+ }
5870
+ if (this.selectedTab === itemProp.tabIndex) {
5871
+ this.refreshLayout();
5872
+ }
5873
+ if (item.cssClass) {
5874
+ itemContainer.classList.add(ribbonItem.cssClass);
5875
+ }
5876
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
5877
+ }
5878
+ };
4796
5879
  Ribbon.prototype.removeItemElement = function (contentEle, item, dropdown) {
4797
5880
  var ele = null;
4798
5881
  if (this.activeLayout === RibbonLayout.Classic) {
4799
- ele = contentEle.querySelector('#' + item.id);
5882
+ ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
4800
5883
  }
4801
5884
  else {
4802
- //Checks for Simplified and Auto options (Auto = simplified + popup)
5885
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
4803
5886
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
4804
5887
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
4805
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
5888
+ if (!ele) {
4806
5889
  ele = dropdown.target.querySelector('#' + item.id);
4807
5890
  }
4808
5891
  }
@@ -4853,6 +5936,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4853
5936
  EventHandler.remove(window, 'resize', this.resizeHandler);
4854
5937
  };
4855
5938
  Ribbon.prototype.destroy = function () {
5939
+ this.keyboardModuleRibbon.destroy();
5940
+ this.keyboardModuleRibbon = null;
4856
5941
  destroyTooltip(this.element);
4857
5942
  this.destroyTabItems(this.tabs);
4858
5943
  this.removeExpandCollapse();
@@ -4904,6 +5989,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4904
5989
  case 'isMinimized':
4905
5990
  this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
4906
5991
  this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
5992
+ if (!this.isMinimized) {
5993
+ this.refreshLayout();
5994
+ }
4907
5995
  break;
4908
5996
  case 'locale':
4909
5997
  this.updateCommonProperty({ locale: this.locale });
@@ -4928,7 +6016,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4928
6016
  if (group.showLauncherIcon) {
4929
6017
  var className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
4930
6018
  if (group.isCollapsed) {
4931
- var element = tabContent.querySelector('.' + RIBBON_GROUP_OVERFLOW_DDB);
6019
+ var element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
4932
6020
  var dropdown = getComponent(element, DropDownButton);
4933
6021
  var launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
4934
6022
  launcherIconEle.className = className;
@@ -4959,14 +6047,20 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4959
6047
  if (this.ribbonFileMenuModule) {
4960
6048
  this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
4961
6049
  }
6050
+ var toolbarEle = this.tabObj['tbObj'];
6051
+ toolbarEle.refreshOverflow();
4962
6052
  break;
4963
6053
  case 'helpPaneTemplate':
4964
6054
  if (this.ribbonTempEle) {
4965
6055
  remove(this.ribbonTempEle);
6056
+ this.ribbonTempEle = null;
6057
+ this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
4966
6058
  }
4967
6059
  if (this.helpPaneTemplate) {
4968
6060
  this.createHelpPaneTemplate();
4969
6061
  }
6062
+ var toolbar_1 = this.tabObj['tbObj'];
6063
+ toolbar_1.refreshOverflow();
4970
6064
  break;
4971
6065
  }
4972
6066
  }