@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
@@ -17,7 +17,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
17
17
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
19
19
  };
20
- import { addClass, append, Event, Collection, Complex, Component, EventHandler, formatUnit, getInstance, getComponent, getUniqueID, closest } from '@syncfusion/ej2-base';
20
+ import { addClass, append, Event, Collection, Complex, Component, EventHandler, formatUnit, getInstance, getComponent, getUniqueID, closest, KeyboardEvents } from '@syncfusion/ej2-base';
21
21
  import { isNullOrUndefined, isUndefined, NotifyPropertyChanges, Property, remove, removeClass } from '@syncfusion/ej2-base';
22
22
  import { Tab, TabAnimationSettings, HScroll, Toolbar } from '@syncfusion/ej2-navigations';
23
23
  import { RibbonTab, FileMenuSettings } from '../models/index';
@@ -27,6 +27,7 @@ import { RibbonButton, RibbonComboBox, RibbonCheckBox, RibbonDropDown, RibbonSpl
27
27
  import { destroyControl, getCollection, getGroup, getIndex, getItem, getItemElement, updateCommonProperty, updateControlDisabled, isTooltipPresent, getTemplateFunction, createTooltip, destroyTooltip, updateTooltipProp } from './utils';
28
28
  import * as constants from './constant';
29
29
  import { DropDownButton, SplitButton } from '@syncfusion/ej2-splitbuttons';
30
+ import { CheckBox } from '@syncfusion/ej2-buttons';
30
31
  /**
31
32
  * The Ribbon Component is a structured layout to manage tools with tabs and groups.
32
33
  */
@@ -58,6 +59,12 @@ var Ribbon = /** @class */ (function (_super) {
58
59
  this.idIndex = 0;
59
60
  this.tooltipData = [];
60
61
  this.isAddRemove = false;
62
+ this.keyConfigs = {
63
+ leftarrow: 'leftarrow',
64
+ rightarrow: 'rightarrow',
65
+ tab: 'tab',
66
+ shiftTab: 'shift+tab'
67
+ };
61
68
  };
62
69
  /**
63
70
  * Get the properties to be maintained in the persisted state.
@@ -99,12 +106,239 @@ var Ribbon = /** @class */ (function (_super) {
99
106
  this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
100
107
  }
101
108
  this.createHelpPaneTemplate();
109
+ var toolbar = this.tabObj['tbObj'];
110
+ toolbar.refreshOverflow();
102
111
  createTooltip(this.element, this);
103
112
  this.wireEvents();
113
+ this.wireKeyboardEvent();
114
+ this.currentControlIndex = 0;
104
115
  };
105
116
  Ribbon.prototype.wireEvents = function () {
106
117
  EventHandler.add(window, 'resize', this.resizeHandler, this);
107
118
  };
119
+ Ribbon.prototype.wireKeyboardEvent = function () {
120
+ this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
121
+ keyAction: this.keyActionHandler.bind(this),
122
+ keyConfigs: this.keyConfigs,
123
+ eventName: 'keydown'
124
+ });
125
+ };
126
+ Ribbon.prototype.keyActionHandler = function (e) {
127
+ if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
128
+ e.preventDefault();
129
+ }
130
+ var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
131
+ var ribbonControls = activeContent.querySelectorAll('.e-control');
132
+ var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
133
+ var comboBoxEle;
134
+ if (comboBoxElements) {
135
+ for (var i = 0; i < comboBoxElements.length; i++) {
136
+ if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
137
+ comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
138
+ }
139
+ }
140
+ }
141
+ if (comboBoxEle) {
142
+ for (var i = 0; i < ribbonControls.length; i++) {
143
+ if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
144
+ if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
145
+ this.currentControlIndex = i;
146
+ }
147
+ }
148
+ }
149
+ }
150
+ if (this.currentControlIndex === 0) {
151
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
152
+ while (item && item.classList.contains('e-disabled')) {
153
+ this.currentControlIndex++;
154
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
155
+ }
156
+ }
157
+ if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
158
+ e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
159
+ e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
160
+ e.target.classList.contains('e-ribbon-overall-of-btn')) {
161
+ switch (e.action) {
162
+ case 'rightarrow':
163
+ this.handleNavigation(e, !this.enableRtl, ribbonControls);
164
+ break;
165
+ case 'leftarrow':
166
+ this.handleNavigation(e, this.enableRtl, ribbonControls);
167
+ break;
168
+ case 'tab':
169
+ if (e.target.classList.contains('e-combobox')) {
170
+ if (this.currentControlIndex < ribbonControls.length - 1) {
171
+ this.currentControlIndex++;
172
+ }
173
+ }
174
+ break;
175
+ case 'shiftTab':
176
+ if (e.target.classList.contains('e-combobox')) {
177
+ if (this.currentControlIndex > 0) {
178
+ this.currentControlIndex--;
179
+ }
180
+ }
181
+ else {
182
+ this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
183
+ this.currentControlIndex = 0;
184
+ }
185
+ }
186
+ }
187
+ };
188
+ Ribbon.prototype.handleNavigation = function (e, enableRtl, ribbonControls) {
189
+ var groupContainer;
190
+ var prevGroupId;
191
+ if (enableRtl) {
192
+ if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
193
+ this.currentControlIndex++;
194
+ }
195
+ }
196
+ else {
197
+ if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
198
+ this.currentControlIndex--;
199
+ }
200
+ }
201
+ if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
202
+ if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
203
+ if (enableRtl) {
204
+ this.currentControlIndex++;
205
+ }
206
+ else {
207
+ var prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + constants.RIBBON_GROUP_CONTAINER);
208
+ if (prevGroupContainer) {
209
+ prevGroupId = prevGroupContainer.getAttribute('id');
210
+ }
211
+ this.currentControlIndex--;
212
+ }
213
+ var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
214
+ while (item && item.classList.contains('e-disabled')) {
215
+ if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
216
+ (!enableRtl && this.currentControlIndex === 0))) {
217
+ if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
218
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
219
+ break;
220
+ }
221
+ }
222
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
223
+ enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
224
+ item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
225
+ }
226
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
227
+ if (this.activeLayout === 'Classic') {
228
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + constants.RIBBON_GROUP_CONTAINER);
229
+ if (enableRtl) {
230
+ var launcherIconEle = void 0;
231
+ if (groupContainer) {
232
+ launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
233
+ }
234
+ if (launcherIconEle) {
235
+ var items = groupContainer.querySelectorAll('.e-ribbon-item');
236
+ items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
237
+ }
238
+ }
239
+ else {
240
+ if (groupContainer) {
241
+ var groupContainerId = groupContainer.getAttribute('id');
242
+ if (prevGroupId !== groupContainerId) {
243
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
244
+ if (launcherIconEle) {
245
+ ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+ else {
252
+ if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
253
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
254
+ }
255
+ else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
256
+ ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
257
+ }
258
+ }
259
+ }
260
+ }
261
+ else {
262
+ if (this.activeLayout === 'Classic') {
263
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
264
+ }
265
+ if (this.activeLayout === 'Simplified') {
266
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
267
+ if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
268
+ overflowButton.focus();
269
+ }
270
+ else {
271
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
272
+ }
273
+ }
274
+ }
275
+ if (e.target.classList.contains('e-ribbon-last-item')) {
276
+ if (enableRtl) {
277
+ groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + constants.RIBBON_GROUP_CONTAINER);
278
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
279
+ }
280
+ else {
281
+ this.currentControlIndex--;
282
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
283
+ }
284
+ }
285
+ if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
286
+ groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + constants.RIBBON_GROUP_CONTAINER);
287
+ var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
288
+ if (launcherIconEle) {
289
+ groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
290
+ }
291
+ }
292
+ if (e.target.classList.contains('e-ribbon-launcher-icon')) {
293
+ if (enableRtl) {
294
+ this.currentControlIndex++;
295
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
296
+ if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
297
+ ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
298
+ }
299
+ }
300
+ else {
301
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
302
+ this.currentControlIndex;
303
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
304
+ }
305
+ }
306
+ if (e.target.classList.contains('e-ribbon-collapse-btn')) {
307
+ if (enableRtl) {
308
+ this.currentControlIndex = 0;
309
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
310
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
311
+ this.currentControlIndex++;
312
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
313
+ }
314
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
315
+ }
316
+ else {
317
+ var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
318
+ if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
319
+ overflowButton.focus();
320
+ }
321
+ else {
322
+ this.currentControlIndex = ribbonControls.length - 1;
323
+ var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
324
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
325
+ this.currentControlIndex--;
326
+ ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
327
+ }
328
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
329
+ }
330
+ }
331
+ }
332
+ if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
333
+ if (enableRtl) {
334
+ this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
335
+ }
336
+ else {
337
+ this.currentControlIndex = ribbonControls.length - 1;
338
+ ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
339
+ }
340
+ }
341
+ };
108
342
  Ribbon.prototype.resizeHandler = function () {
109
343
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
110
344
  this.checkOverflow(this.selectedTab, activeContent);
@@ -307,7 +541,8 @@ var Ribbon = /** @class */ (function (_super) {
307
541
  for (var k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
308
542
  var item = collection.items[k - 1];
309
543
  var itemContainer = collectionEle.querySelector('#' + item.id + constants.CONTAINER_ID);
310
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
544
+ if (((item.displayOptions === DisplayMode.Auto) ||
545
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
311
546
  itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
312
547
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
313
548
  if (item.activeSize === RibbonItemSize.Small) {
@@ -378,7 +613,8 @@ var Ribbon = /** @class */ (function (_super) {
378
613
  if (overflowtarget) {
379
614
  itemContainer = overflowtarget.querySelector('#' + item.id + constants.CONTAINER_ID);
380
615
  }
381
- if ((item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow)) && !isNullOrUndefined(itemContainer)) {
616
+ if (((item.displayOptions === DisplayMode.Auto) ||
617
+ (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
382
618
  var width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
383
619
  if (!isClear && (tabContent.offsetWidth < width)) {
384
620
  flag = false;
@@ -468,7 +704,9 @@ var Ribbon = /** @class */ (function (_super) {
468
704
  }
469
705
  overflowButton = this.overflowDDB;
470
706
  }
471
- this.addOverflowEvents(item, itemEle, overflowButton);
707
+ if (itemEle !== null) {
708
+ this.addOverflowEvents(item, itemEle, overflowButton);
709
+ }
472
710
  };
473
711
  Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
474
712
  switch (item.type) {
@@ -517,6 +755,50 @@ var Ribbon = /** @class */ (function (_super) {
517
755
  }
518
756
  return isBreak;
519
757
  };
758
+ Ribbon.prototype.checkValidCollectionLength = function (collections) {
759
+ var count = 0;
760
+ for (var i = 0; i < collections.length; i++) {
761
+ var items = collections[parseInt(i.toString(), 10)].items;
762
+ for (var ind = 0; ind < items.length; ind++) {
763
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
764
+ count++;
765
+ break;
766
+ }
767
+ }
768
+ if (count > 1) {
769
+ return false;
770
+ }
771
+ }
772
+ return count === 1;
773
+ };
774
+ Ribbon.prototype.checkClassicCollection = function (collections, n, isIncrement) {
775
+ var items = collections[parseInt(n.toString(), 10)].items;
776
+ for (var ind = 0; ind < items.length; ind++) {
777
+ if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
778
+ return n;
779
+ }
780
+ }
781
+ n = isIncrement ? n + 1 : n - 1;
782
+ if (isIncrement) {
783
+ return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
784
+ }
785
+ else {
786
+ return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
787
+ }
788
+ };
789
+ Ribbon.prototype.checkClassicItem = function (items, n, isIncrement) {
790
+ var item = items[parseInt(n.toString(), 10)];
791
+ if (item.displayOptions & DisplayMode.Classic) {
792
+ return n;
793
+ }
794
+ n = isIncrement ? n + 1 : n - 1;
795
+ if (isIncrement) {
796
+ return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
797
+ }
798
+ else {
799
+ return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
800
+ }
801
+ };
520
802
  Ribbon.prototype.checkLargeToMedium = function (tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip) {
521
803
  var _this = this;
522
804
  if (shouldSkip === void 0) { shouldSkip = false; }
@@ -550,6 +832,9 @@ var Ribbon = /** @class */ (function (_super) {
550
832
  createShrinkEle(collection.id, firstItem, start, end);
551
833
  for (var i = start; i <= end; i++) {
552
834
  var item = collection.items[parseInt(i.toString(), 10)];
835
+ if (!(item.displayOptions & DisplayMode.Classic)) {
836
+ continue;
837
+ }
553
838
  var ele = activeContent.querySelector('#' + item.id + constants.CONTAINER_ID);
554
839
  shrinkEle.appendChild(ele);
555
840
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
@@ -574,45 +859,65 @@ var Ribbon = /** @class */ (function (_super) {
574
859
  if (orientation === ItemOrientation.Column) {
575
860
  for (var k = (group.collections.length - 1); k > 0; k--) {
576
861
  //to avoid negative index while checking for the second collection
577
- if (((k - 1) >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
578
- if (canReduceCollection(group.collections[k - 1])) {
579
- if (((k - 2) >= 0) && canReduceCollection(group.collections[k - 2])) {
580
- moveCollectionToColumn(k - 2, k);
862
+ k = this.checkClassicCollection(group.collections, k, false);
863
+ var l = k - 1;
864
+ //Checks the element rendered at position n
865
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
866
+ l = this.checkClassicCollection(group.collections, l, false);
867
+ //Checks the element rendered at position n-1
868
+ if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
869
+ var m = l - 1;
870
+ if (m >= 0) {
871
+ m = this.checkClassicCollection(group.collections, m, false);
872
+ }
873
+ //Checks the element rendered at position n-2
874
+ if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
875
+ moveCollectionToColumn(m, k);
581
876
  }
582
877
  else {
583
- moveCollectionToColumn(k - 1, k);
878
+ moveCollectionToColumn(l, k);
584
879
  }
585
- k -= 2;
880
+ k = m;
586
881
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
587
882
  return true;
588
883
  }
589
884
  }
590
885
  else {
591
- k--;
886
+ k = l;
592
887
  }
593
888
  }
594
889
  }
595
890
  }
596
891
  else {
597
- if (group.collections.length === 1) {
892
+ if (this.checkValidCollectionLength(group.collections)) {
598
893
  var collection = group.collections[0];
599
894
  for (var k = (collection.items.length - 1); k > 0; k--) {
600
895
  //to avoid negative index while checking for the second item
601
- if (((k - 1) >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
602
- if (canReduceItem(collection.items[k - 1])) {
603
- if (((k - 2) >= 0) && canReduceItem(collection.items[k - 2])) {
604
- moveItemToColumn(k - 2, k);
896
+ k = this.checkClassicItem(collection.items, k, false);
897
+ var l = k - 1;
898
+ //Checks the element rendered at position n
899
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
900
+ l = this.checkClassicItem(collection.items, l, false);
901
+ //Checks the element rendered at position n-1
902
+ if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
903
+ var m = l - 1;
904
+ //Checks the element rendered at position n-2
905
+ if (m >= 0) {
906
+ m = this.checkClassicItem(collection.items, m, false);
907
+ }
908
+ if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
909
+ moveItemToColumn(m, k);
605
910
  }
606
911
  else {
607
- moveItemToColumn(k - 1, k);
912
+ moveItemToColumn(l, k);
608
913
  }
609
- k -= 2;
914
+ k = m;
610
915
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
611
916
  return true;
612
917
  }
613
918
  }
614
919
  else {
615
- k--;
920
+ k = l;
616
921
  }
617
922
  }
618
923
  }
@@ -633,28 +938,44 @@ var Ribbon = /** @class */ (function (_super) {
633
938
  var canReduceItem = function (item) {
634
939
  return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
635
940
  };
636
- var reduceItemsToSmall = function (collectionIndex, start, end) {
941
+ var reduceItemsToSmall = function (collectionIndex, start, end, middle) {
942
+ if (middle === void 0) { middle = null; }
637
943
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
638
944
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
639
- for (var i = start; i <= end; i++) {
945
+ var reduce = function (i) {
640
946
  var item = collection.items[parseInt(i.toString(), 10)];
641
- var ele_1 = activeContent.querySelector('#' + item.id);
642
- item.setProperties({ activeSize: RibbonItemSize.Small }, true);
643
- _this.setItemSize(ele_1, item);
947
+ if (item.displayOptions & DisplayMode.Classic) {
948
+ var ele_1 = activeContent.querySelector('#' + item.id);
949
+ item.setProperties({ activeSize: RibbonItemSize.Small }, true);
950
+ _this.setItemSize(ele_1, item);
951
+ }
952
+ };
953
+ reduce(start);
954
+ if (middle) {
955
+ reduce(middle);
644
956
  }
957
+ reduce(end);
645
958
  };
646
- var reduceCollectionsToSmall = function (index, start, end) {
959
+ var reduceCollectionsToSmall = function (index, start, end, middle) {
960
+ if (middle === void 0) { middle = null; }
647
961
  var group = _this.tabs[parseInt(tabIndex.toString(), 10)]
648
962
  .groups[parseInt(groupIndex.toString(), 10)];
649
963
  if (!shouldSkip) {
650
964
  shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
651
965
  }
652
- for (var i = start; i <= end; i++) {
966
+ var reduce = function (i) {
653
967
  var collection = group.collections[parseInt(i.toString(), 10)];
654
- var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
655
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
656
- _this.setItemSize(ele_2, collection.items[0]);
968
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
969
+ var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
970
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
971
+ _this.setItemSize(ele_2, collection.items[0]);
972
+ }
973
+ };
974
+ reduce(start);
975
+ if (middle) {
976
+ reduce(middle);
657
977
  }
978
+ reduce(end);
658
979
  };
659
980
  var setWidth = function (id) {
660
981
  if (!shouldSkip) {
@@ -668,13 +989,14 @@ var Ribbon = /** @class */ (function (_super) {
668
989
  var start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
669
990
  var end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
670
991
  //only 2 or 3 itmes alone can be present in shrinked column
992
+ var l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
671
993
  if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
672
- && canReduceItem(group.collections[start + 1].items[0])) {
673
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
994
+ && canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
995
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
674
996
  reduceCollectionsToSmall(k, start, end);
675
997
  }
676
- else if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])) {
677
- reduceCollectionsToSmall(k, start, end);
998
+ else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
999
+ reduceCollectionsToSmall(k, start, end, l);
678
1000
  }
679
1001
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
680
1002
  return true;
@@ -684,16 +1006,22 @@ var Ribbon = /** @class */ (function (_super) {
684
1006
  }
685
1007
  for (var k = (group.collections.length - 1); k >= 0; k--) {
686
1008
  var collection = group.collections[parseInt(k.toString(), 10)];
1009
+ var classicItems = [];
1010
+ for (var i = 0; i < collection.items.length; i++) {
1011
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
1012
+ classicItems.push(i);
1013
+ }
1014
+ }
687
1015
  //If items length is 1 then, it would have been already check for shrinked column
688
- if ((collection.items.length > 1)) {
689
- if (canReduceItem(collection.items[0]) && canReduceItem(collection.items[1])) {
690
- if (collection.items.length === 2) {
1016
+ if ((classicItems.length > 1)) {
1017
+ if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
1018
+ if (classicItems.length === 2) {
691
1019
  setWidth(collection.id);
692
- reduceItemsToSmall(k, 0, 1);
1020
+ reduceItemsToSmall(k, classicItems[0], classicItems[1]);
693
1021
  }
694
- else if (canReduceItem(collection.items[2])) {
1022
+ else if (canReduceItem(collection.items[classicItems[2]])) {
695
1023
  setWidth(collection.id);
696
- reduceItemsToSmall(k, 0, 2);
1024
+ reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
697
1025
  }
698
1026
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
699
1027
  return true;
@@ -703,22 +1031,24 @@ var Ribbon = /** @class */ (function (_super) {
703
1031
  }
704
1032
  }
705
1033
  else {
706
- if (group.collections.length === 1) {
1034
+ if (this.checkValidCollectionLength(group.collections)) {
707
1035
  if (shrinkColumns.length > 0) {
708
1036
  for (var k = (shrinkColumns.length - 1); k >= 0; k--) {
709
1037
  var shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
710
1038
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
711
1039
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
712
1040
  //only 2 or 3 itmes alone can be present in shrinked column
1041
+ var collection = group.collections[0];
1042
+ var l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
713
1043
  if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
714
- && canReduceItem(group.collections[0].items[start + 1])) {
715
- if ((end - start) === 1) { //if only 2 item, the difference will be 1, else check for 3 rd item satus.
1044
+ && canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
1045
+ if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
716
1046
  setWidth(shrinkColumn.id);
717
1047
  reduceItemsToSmall(0, start, end);
718
1048
  }
719
1049
  else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
720
1050
  setWidth(shrinkColumn.id);
721
- reduceItemsToSmall(0, start, end);
1051
+ reduceItemsToSmall(0, start, end, l);
722
1052
  }
723
1053
  if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
724
1054
  return true;
@@ -731,6 +1061,10 @@ var Ribbon = /** @class */ (function (_super) {
731
1061
  for (var k = (group.collections.length - 1); k >= 0; k--) {
732
1062
  var collection = group.collections[parseInt(k.toString(), 10)];
733
1063
  for (var l = (collection.items.length - 1); l >= 0; l--) {
1064
+ l = this.checkClassicItem(collection.items, l, false);
1065
+ if (l < 0) {
1066
+ continue;
1067
+ }
734
1068
  var item = collection.items[parseInt(l.toString(), 10)];
735
1069
  if (canReduceItem(item)) {
736
1070
  setWidth(item.id);
@@ -764,20 +1098,21 @@ var Ribbon = /** @class */ (function (_super) {
764
1098
  var canExpandItem = function (item) {
765
1099
  return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
766
1100
  };
767
- var expandItemsToMedium = function (collectionIndex, start, end, parentEle) {
1101
+ var expandItemToMedium = function (collectionIndex, index, parentEle) {
768
1102
  var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
769
1103
  .groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
770
- for (var i = start; i <= end; i++) {
771
- var item = collection.items[parseInt(i.toString(), 10)];
1104
+ var item = collection.items[parseInt(index.toString(), 10)];
1105
+ if (item.displayOptions & DisplayMode.Classic) {
772
1106
  var ele_4 = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
773
1107
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
774
1108
  _this.setItemSize(ele_4, item);
775
1109
  }
776
1110
  };
777
- var expandCollectionsToMedium = function (start, end) {
1111
+ var expandCollectionsToMedium = function (i) {
778
1112
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)]
779
1113
  .groups[parseInt(groupIndex.toString(), 10)].collections;
780
- for (var i = start; i <= end; i++) {
1114
+ var item = collections[parseInt(i.toString(), 10)].items[0];
1115
+ if (item.displayOptions & DisplayMode.Classic) {
781
1116
  var ele_5 = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
782
1117
  collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
783
1118
  _this.setItemSize(ele_5, collections[parseInt(i.toString(), 10)].items[0]);
@@ -785,17 +1120,21 @@ var Ribbon = /** @class */ (function (_super) {
785
1120
  };
786
1121
  if (orientation === ItemOrientation.Row) {
787
1122
  // collection length is 1, then the it wll be covered in shrinked columns
788
- if (group.collections.length !== 1) {
1123
+ if (!this.checkValidCollectionLength(group.collections)) {
789
1124
  for (var k = 0; k < group.collections.length; k++) {
790
1125
  var collection = group.collections[parseInt(k.toString(), 10)];
791
1126
  for (var l = 0; l < collection.items.length; l++) {
1127
+ l = this.checkClassicItem(collection.items, l, true);
1128
+ if (l === collection.items.length) {
1129
+ continue;
1130
+ }
792
1131
  var item = collection.items[parseInt(l.toString(), 10)];
793
1132
  if (canExpandItem(item)) {
794
1133
  var itemEle = activeContent.querySelector('#' + item.id);
795
1134
  var valString = itemEle.getAttribute('data-medium-width');
796
1135
  var value = valString ? parseInt(valString, 10) : null;
797
1136
  if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
798
- expandItemsToMedium(k, l, l, itemEle);
1137
+ expandItemToMedium(k, l, itemEle);
799
1138
  if (!shouldSkip || shouldClear) {
800
1139
  itemEle.removeAttribute('data-medium-width');
801
1140
  }
@@ -816,8 +1155,18 @@ var Ribbon = /** @class */ (function (_super) {
816
1155
  var itemEle = activeContent.querySelector('#' + collection.id);
817
1156
  var valString = itemEle.getAttribute('data-medium-width');
818
1157
  var value = valString ? parseInt(valString, 10) : null;
819
- if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
820
- expandItemsToMedium(k, 0, (collection.items.length === 2) ? 1 : 2, itemEle);
1158
+ var classicItems = [];
1159
+ for (var i = 0; i < collection.items.length; i++) {
1160
+ if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
1161
+ classicItems.push(i);
1162
+ }
1163
+ }
1164
+ if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
1165
+ expandItemToMedium(k, classicItems[0], itemEle);
1166
+ expandItemToMedium(k, classicItems[1], itemEle);
1167
+ if (classicItems.length === 3) {
1168
+ expandItemToMedium(k, classicItems[2], itemEle);
1169
+ }
821
1170
  if (!shouldSkip || shouldClear) {
822
1171
  itemEle.removeAttribute('data-medium-width');
823
1172
  }
@@ -837,10 +1186,22 @@ var Ribbon = /** @class */ (function (_super) {
837
1186
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
838
1187
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
839
1188
  if (orientation === ItemOrientation.Row) {
840
- expandItemsToMedium(0, start, end, shrinkColumn);
1189
+ var collection = group.collections[0];
1190
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
1191
+ expandItemToMedium(0, start, shrinkColumn);
1192
+ expandItemToMedium(0, l, shrinkColumn);
1193
+ // 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.
1194
+ if (l !== end) {
1195
+ expandItemToMedium(0, end, shrinkColumn);
1196
+ }
841
1197
  }
842
1198
  else {
843
- expandCollectionsToMedium(start, end);
1199
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
1200
+ expandCollectionsToMedium(start);
1201
+ expandCollectionsToMedium(m);
1202
+ if (m !== end) {
1203
+ expandCollectionsToMedium(end);
1204
+ }
844
1205
  }
845
1206
  if (!shouldSkip || shouldClear) {
846
1207
  shrinkColumn.removeAttribute('data-medium-width');
@@ -862,32 +1223,46 @@ var Ribbon = /** @class */ (function (_super) {
862
1223
  if (shrinkColumns.length === 0) {
863
1224
  return false;
864
1225
  }
865
- var expandItemsToLarge = function (start, end, parentEle) {
1226
+ var expandItemsToLarge = function (start, end, parentEle, middle) {
866
1227
  var items = _this.tabs[parseInt(tabIndex.toString(), 10)].
867
1228
  groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
868
- for (var i = end; i >= start; i--) {
1229
+ var reduce = function (i) {
869
1230
  var item = items[parseInt(i.toString(), 10)];
870
- var container = parentEle.querySelector('#' + item.id + constants.CONTAINER_ID);
871
- var ele_6 = container.querySelector('#' + item.id);
872
- item.setProperties({ activeSize: RibbonItemSize.Large }, true);
873
- _this.setItemSize(ele_6, item);
874
- parentEle.insertAdjacentElement('afterend', container);
1231
+ if (item.displayOptions & DisplayMode.Classic) {
1232
+ var container = parentEle.querySelector('#' + item.id + constants.CONTAINER_ID);
1233
+ var ele_6 = container.querySelector('#' + item.id);
1234
+ item.setProperties({ activeSize: RibbonItemSize.Large }, true);
1235
+ _this.setItemSize(ele_6, item);
1236
+ parentEle.insertAdjacentElement('afterend', container);
1237
+ }
1238
+ };
1239
+ reduce(start);
1240
+ if (middle) {
1241
+ reduce(middle);
875
1242
  }
1243
+ reduce(end);
876
1244
  if (!shouldSkip || shouldClear) {
877
1245
  remove(parentEle);
878
1246
  }
879
1247
  };
880
- var expandCollectionsToLarge = function (start, end, parentEle) {
1248
+ var expandCollectionsToLarge = function (start, end, parentEle, middle) {
881
1249
  var collections = _this.tabs[parseInt(tabIndex.toString(), 10)].
882
1250
  groups[parseInt(groupIndex.toString(), 10)].collections;
883
- for (var i = end; i >= start; i--) {
1251
+ var reduce = function (i) {
884
1252
  var collection = collections[parseInt(i.toString(), 10)];
885
- var collectionEle = parentEle.querySelector('#' + collection.id);
886
- var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
887
- collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
888
- _this.setItemSize(ele_7, collection.items[0]);
889
- parentEle.insertAdjacentElement('afterend', collectionEle);
1253
+ if (collection.items[0].displayOptions & DisplayMode.Classic) {
1254
+ var collectionEle = parentEle.querySelector('#' + collection.id);
1255
+ var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
1256
+ collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
1257
+ _this.setItemSize(ele_7, collection.items[0]);
1258
+ parentEle.insertAdjacentElement('afterend', collectionEle);
1259
+ }
1260
+ };
1261
+ reduce(start);
1262
+ if (middle) {
1263
+ reduce(middle);
890
1264
  }
1265
+ reduce(end);
891
1266
  if (!shouldSkip || shouldClear) {
892
1267
  remove(parentEle);
893
1268
  }
@@ -900,10 +1275,23 @@ var Ribbon = /** @class */ (function (_super) {
900
1275
  var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
901
1276
  var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
902
1277
  if (orientation === ItemOrientation.Row) {
903
- expandItemsToLarge(start, end, shrinkColumn);
1278
+ var collection = group.collections[0];
1279
+ var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
1280
+ if (l === end) {
1281
+ expandItemsToLarge(start, end, shrinkColumn);
1282
+ }
1283
+ else {
1284
+ expandItemsToLarge(start, end, shrinkColumn, l);
1285
+ }
904
1286
  }
905
1287
  else {
906
- expandCollectionsToLarge(start, end, shrinkColumn);
1288
+ var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
1289
+ if (m === end) {
1290
+ expandCollectionsToLarge(start, end, shrinkColumn);
1291
+ }
1292
+ else {
1293
+ expandCollectionsToLarge(start, end, shrinkColumn, m);
1294
+ }
907
1295
  }
908
1296
  if (!shouldSkip || shouldClear) {
909
1297
  shrinkColumn.removeAttribute('data-large-width');
@@ -959,7 +1347,7 @@ var Ribbon = /** @class */ (function (_super) {
959
1347
  //Expanding the items in the group to their original expanded state
960
1348
  this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
961
1349
  this_1.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
962
- var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
1350
+ var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
963
1351
  this_1.tabs[parseInt(tabIndex.toString(), 10)].
964
1352
  groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
965
1353
  for (var j = 0; j < group.collections.length; j++) {
@@ -968,7 +1356,9 @@ var Ribbon = /** @class */ (function (_super) {
968
1356
  for (var k = 0; k < collection.items.length; k++) {
969
1357
  var item = collection.items[parseInt(k.toString(), 10)];
970
1358
  var itemEle = collectionEle.querySelector('#' + item.id + constants.CONTAINER_ID);
971
- this_1.addOverflowEvents(item, itemEle, dropdown);
1359
+ if (itemEle !== null) {
1360
+ this_1.addOverflowEvents(item, itemEle, dropdown);
1361
+ }
972
1362
  }
973
1363
  }
974
1364
  };
@@ -1008,7 +1398,9 @@ var Ribbon = /** @class */ (function (_super) {
1008
1398
  for (var k = 0; k < collection.items.length; k++) {
1009
1399
  var item = collection.items[parseInt(k.toString(), 10)];
1010
1400
  var itemEle = collectionEle.querySelector('#' + item.id + constants.CONTAINER_ID);
1011
- this_2.removeOverflowEvent(item, itemEle);
1401
+ if (itemEle !== null) {
1402
+ this_2.removeOverflowEvent(item, itemEle);
1403
+ }
1012
1404
  }
1013
1405
  }
1014
1406
  };
@@ -1066,6 +1458,7 @@ var Ribbon = /** @class */ (function (_super) {
1066
1458
  };
1067
1459
  Ribbon.prototype.ribbonTabSelecting = function (e) {
1068
1460
  var _this = this;
1461
+ this.currentControlIndex = 0;
1069
1462
  var nextTabId = e.selectingItem.getAttribute('data-id');
1070
1463
  var previousTabId = e.previousItem.getAttribute('data-id');
1071
1464
  var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
@@ -1122,11 +1515,13 @@ var Ribbon = /** @class */ (function (_super) {
1122
1515
  this.checkOverflow(this.selectedTab, activeContent);
1123
1516
  };
1124
1517
  Ribbon.prototype.addOverflowButton = function (btnId) {
1518
+ var _this = this;
1125
1519
  var overflowButton = this.createElement('button', {
1126
1520
  id: btnId
1127
1521
  });
1128
1522
  var overflowTarget = this.createElement('div', {
1129
- className: constants.RIBBON_OVERFLOW_TARGET
1523
+ className: constants.RIBBON_OVERFLOW_TARGET,
1524
+ attrs: { 'tabindex': '0' }
1130
1525
  });
1131
1526
  var overflowDDB = new DropDownButton({
1132
1527
  iconCss: constants.OVERFLOW_ICON,
@@ -1144,8 +1539,112 @@ var Ribbon = /** @class */ (function (_super) {
1144
1539
  }, overflowButton);
1145
1540
  this.element.classList.add(constants.RIBBON_OVERFLOW);
1146
1541
  createTooltip(overflowTarget, this);
1542
+ var isGroupOf;
1543
+ overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
1544
+ overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
1147
1545
  return overflowDDB;
1148
1546
  };
1547
+ Ribbon.prototype.upDownKeyHandler = function (e, target, isGroupOf) {
1548
+ var items;
1549
+ if (isGroupOf) {
1550
+ items = target.getElementsByClassName('e-ribbon-item');
1551
+ }
1552
+ else {
1553
+ var currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
1554
+ items = currentList.getElementsByClassName('e-ribbon-item');
1555
+ }
1556
+ 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;
1557
+ var ribbonItem;
1558
+ if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
1559
+ if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
1560
+ if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
1561
+ this.itemIndex = 0;
1562
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1563
+ this.findDisabledItem(ribbonItem, items, true);
1564
+ if (comboBoxEle && e.key === 'Tab') {
1565
+ e.preventDefault();
1566
+ items[this.itemIndex].querySelector('.e-control').focus();
1567
+ }
1568
+ }
1569
+ else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
1570
+ this.itemIndex++;
1571
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1572
+ this.findDisabledItem(ribbonItem, items, true);
1573
+ }
1574
+ }
1575
+ else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
1576
+ if (comboBoxEle === null || (e.key === 'Tab')) {
1577
+ if (!this.itemIndex || this.itemIndex === -1) {
1578
+ this.itemIndex = items.length - 1;
1579
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1580
+ this.findDisabledItem(ribbonItem, items, false);
1581
+ if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
1582
+ e.preventDefault();
1583
+ items[this.itemIndex].querySelector('.e-control').focus();
1584
+ }
1585
+ }
1586
+ else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
1587
+ this.itemIndex--;
1588
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1589
+ this.findDisabledItem(ribbonItem, items, false);
1590
+ }
1591
+ }
1592
+ }
1593
+ target.setAttribute('index', this.itemIndex.toString());
1594
+ }
1595
+ var currentItemIndex = parseInt(target.getAttribute('index'), 10);
1596
+ var itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
1597
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
1598
+ if (itemType === 'ColorPicker') {
1599
+ if (e.key === 'Tab') {
1600
+ e.preventDefault();
1601
+ }
1602
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
1603
+ }
1604
+ else {
1605
+ if (e.key === 'Tab') {
1606
+ e.preventDefault();
1607
+ }
1608
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
1609
+ }
1610
+ if (e.key === ' ' && (itemType === 'CheckBox')) {
1611
+ var checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
1612
+ var checkBox = getComponent(checkBoxEle, CheckBox);
1613
+ this.itemIndex = -1;
1614
+ checkBox.click();
1615
+ }
1616
+ }
1617
+ if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
1618
+ if (e.key === 'ArrowRight') {
1619
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
1620
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
1621
+ }
1622
+ if (e.key === 'ArrowLeft') {
1623
+ this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
1624
+ items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
1625
+ }
1626
+ }
1627
+ if (e.key === 'Enter') {
1628
+ this.itemIndex = -1;
1629
+ }
1630
+ };
1631
+ Ribbon.prototype.findDisabledItem = function (ribbonItem, items, isIncrease) {
1632
+ while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
1633
+ if (isIncrease) {
1634
+ if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
1635
+ this.itemIndex = -1;
1636
+ }
1637
+ }
1638
+ else {
1639
+ if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
1640
+ this.itemIndex = items.length;
1641
+ }
1642
+ }
1643
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
1644
+ isIncrease ? this.itemIndex++ : this.itemIndex--;
1645
+ ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
1646
+ }
1647
+ };
1149
1648
  Ribbon.prototype.removeOverflowButton = function (overflowDDB) {
1150
1649
  if (overflowDDB) {
1151
1650
  var btnEle = overflowDDB.element;
@@ -1235,6 +1734,7 @@ var Ribbon = /** @class */ (function (_super) {
1235
1734
  }
1236
1735
  };
1237
1736
  Ribbon.prototype.switchLayout = function () {
1737
+ this.currentControlIndex = 0;
1238
1738
  this.destroyScroll();
1239
1739
  this.collapseButton.classList.toggle(constants.RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
1240
1740
  this.element.classList.toggle(constants.RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
@@ -1249,6 +1749,7 @@ var Ribbon = /** @class */ (function (_super) {
1249
1749
  if (this.activeLayout === 'Simplified') {
1250
1750
  for (var i_1 = 0; i_1 < groupList.length; i_1++) {
1251
1751
  var group = groupList[parseInt(i_1.toString(), 10)];
1752
+ var alignType = groupList[parseInt(i_1.toString(), 10)].orientation;
1252
1753
  if (group.isCollapsed) {
1253
1754
  group.setProperties({ isCollapsed: false }, true);
1254
1755
  this.removeDropdown(group.id);
@@ -1276,11 +1777,11 @@ var Ribbon = /** @class */ (function (_super) {
1276
1777
  var itemList = collection.items;
1277
1778
  var item = collection.items[parseInt(k.toString(), 10)];
1278
1779
  var flag = true;
1279
- while ((flag) && (item.displayOptions === DisplayMode.None)) {
1780
+ while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
1280
1781
  k++;
1281
1782
  var itemEle_1 = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
1282
- var ele_8 = itemEle_1.querySelector('#' + item.id);
1283
- this.destroyFunction(item, ele_8);
1783
+ var ele = itemEle_1.querySelector('#' + item.id);
1784
+ this.destroyFunction(item, ele);
1284
1785
  itemEle_1.remove();
1285
1786
  if (k < itemList.length) {
1286
1787
  item = itemList[parseInt(k.toString(), 10)];
@@ -1292,19 +1793,29 @@ var Ribbon = /** @class */ (function (_super) {
1292
1793
  if (!flag) {
1293
1794
  break;
1294
1795
  }
1295
- var itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
1296
- var ele = itemEle.querySelector('#' + item.id);
1297
1796
  var size = ((item.allowedSizes === RibbonItemSize.Large) ||
1298
1797
  (item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
1299
- if (item.displayOptions === DisplayMode.Overflow) {
1300
- this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
1301
- size = RibbonItemSize.Medium;
1302
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
1303
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
1798
+ size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
1799
+ ? RibbonItemSize.Medium : size;
1800
+ var itemEle = void 0;
1801
+ if (!(item.displayOptions & DisplayMode.Classic)) {
1802
+ itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
1803
+ if (item.displayOptions & DisplayMode.Simplified) {
1804
+ groupCollection.append(itemEle);
1304
1805
  }
1305
1806
  }
1306
- item.setProperties({ activeSize: size }, true);
1307
- this.setItemSize(ele, item);
1807
+ else {
1808
+ itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
1809
+ if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
1810
+ this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
1811
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
1812
+ this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
1813
+ }
1814
+ }
1815
+ item.setProperties({ activeSize: size }, true);
1816
+ var ele = itemEle.querySelector('#' + item.id);
1817
+ this.setItemSize(ele, item);
1818
+ }
1308
1819
  }
1309
1820
  }
1310
1821
  if (!(group.enableGroupOverflow || groupEle.querySelector('.' + constants.RIBBON_ITEM))) {
@@ -1351,22 +1862,37 @@ var Ribbon = /** @class */ (function (_super) {
1351
1862
  groupCollection.classList.replace(constants.RIBBON_COLUMN, constants.RIBBON_ROW);
1352
1863
  }
1353
1864
  for (var k = 0; k < collection.items.length; k++) {
1865
+ var itemList = collection.items;
1354
1866
  var item = collection.items[parseInt(k.toString(), 10)];
1355
- if (item.displayOptions === DisplayMode.None) {
1356
- var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
1357
- groupCollection.append(itemEle);
1358
- }
1359
- else if ((item.displayOptions === DisplayMode.Overflow)) {
1360
- var itemEle = overflowtarget.querySelector('#' + item.id + constants.CONTAINER_ID);
1361
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
1362
- this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
1867
+ var flag = true;
1868
+ while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
1869
+ k++;
1870
+ var itemEle = void 0;
1871
+ if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
1872
+ if (item.displayOptions & DisplayMode.Simplified) {
1873
+ itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
1874
+ }
1875
+ else {
1876
+ itemEle = overflowtarget.querySelector('#' + item.id + constants.CONTAINER_ID);
1877
+ }
1878
+ if (itemEle !== null) {
1879
+ var ele_8 = itemEle.querySelector('#' + item.id);
1880
+ this.destroyFunction(item, ele_8);
1881
+ itemEle.remove();
1882
+ }
1883
+ }
1884
+ if (k < itemList.length) {
1885
+ item = itemList[parseInt(k.toString(), 10)];
1886
+ }
1887
+ else {
1888
+ flag = false;
1363
1889
  }
1364
- groupCollection.append(itemEle);
1365
- this.removeOverflowEvent(item, itemEle);
1366
1890
  }
1367
- else if ((item.displayOptions === DisplayMode.Simplified)) {
1368
- //To make sure the items are in proper order
1369
- var itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
1891
+ if (!flag) {
1892
+ break;
1893
+ }
1894
+ if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
1895
+ var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
1370
1896
  groupCollection.append(itemEle);
1371
1897
  }
1372
1898
  else {
@@ -1404,36 +1930,51 @@ var Ribbon = /** @class */ (function (_super) {
1404
1930
  this.overflowDDB = null;
1405
1931
  }
1406
1932
  };
1933
+ Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
1934
+ var _this = this;
1935
+ var launcherIcon = this.createElement('div', {
1936
+ className: constants.RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : constants.RIBBON_LAUNCHER_ICON),
1937
+ id: groupId + constants.LAUNCHER_ID,
1938
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
1939
+ });
1940
+ groupContainer.appendChild(launcherIcon);
1941
+ groupContainer.classList.add(constants.RIBBON_LAUNCHER);
1942
+ EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
1943
+ EventHandler.add(launcherIcon, 'keydown', function (e) {
1944
+ if (e.key === 'Enter') {
1945
+ _this.launcherIconClicked(groupId);
1946
+ }
1947
+ }, this);
1948
+ };
1407
1949
  Ribbon.prototype.launcherIconClicked = function (id) {
1408
1950
  var eventArgs = { groupId: id };
1409
1951
  this.trigger('launcherIconClick', eventArgs);
1410
1952
  };
1411
1953
  Ribbon.prototype.createGroups = function (groupList, tabIndex) {
1412
- var _this = this;
1413
1954
  var groupElements = [];
1414
- var _loop_3 = function (i) {
1955
+ for (var i = 0; i < groupList.length; i++) {
1415
1956
  var group = groupList[parseInt(i.toString(), 10)];
1416
1957
  var alignType = group.orientation;
1417
- var groupEle = this_3.createElement('div', {
1958
+ var groupEle = this.createElement('div', {
1418
1959
  className: group.cssClass,
1419
1960
  id: group.id
1420
1961
  });
1421
1962
  groupEle.classList.add(constants.RIBBON_GROUP);
1422
1963
  groupElements.push(groupEle);
1423
- var groupContainer = this_3.createElement('div', {
1964
+ var groupContainer = this.createElement('div', {
1424
1965
  className: group.cssClass,
1425
1966
  id: group.id + constants.CONTAINER_ID
1426
1967
  });
1427
1968
  groupContainer.classList.add(constants.RIBBON_GROUP_CONTAINER);
1428
1969
  groupEle.appendChild(groupContainer);
1429
- var groupContent = this_3.createElement('div', {
1430
- className: this_3.activeLayout === 'Simplified' ? constants.RIBBON_GROUP_CONTENT : (constants.RIBBON_GROUP_CONTENT + constants.SPACE + constants.RIBBON_CONTENT_HEIGHT),
1970
+ var groupContent = this.createElement('div', {
1971
+ className: this.activeLayout === 'Simplified' ? constants.RIBBON_GROUP_CONTENT : (constants.RIBBON_GROUP_CONTENT + constants.SPACE + constants.RIBBON_CONTENT_HEIGHT),
1431
1972
  id: group.id + constants.CONTENT_ID
1432
1973
  });
1433
- groupContent.classList.add(((alignType === 'Column') || (this_3.activeLayout === 'Simplified')) ? constants.RIBBON_COLUMN : constants.RIBBON_ROW);
1974
+ groupContent.classList.add(((alignType === 'Column') || (this.activeLayout === 'Simplified')) ? constants.RIBBON_COLUMN : constants.RIBBON_ROW);
1434
1975
  groupContainer.appendChild(groupContent);
1435
- if (this_3.activeLayout === 'Classic') {
1436
- var groupHeader = this_3.createElement('div', {
1976
+ if (this.activeLayout === 'Classic') {
1977
+ var groupHeader = this.createElement('div', {
1437
1978
  className: constants.RIBBON_GROUP_HEADER,
1438
1979
  id: group.id + constants.HEADER_ID,
1439
1980
  innerHTML: group.header
@@ -1441,29 +1982,13 @@ var Ribbon = /** @class */ (function (_super) {
1441
1982
  groupContainer.appendChild(groupHeader);
1442
1983
  }
1443
1984
  if (group.showLauncherIcon) {
1444
- var launcherIcon = this_3.createElement('div', {
1445
- className: constants.RIBBON_LAUNCHER_ICON_ELE + ' ' + (this_3.launcherIconCss ? this_3.launcherIconCss : constants.RIBBON_LAUNCHER_ICON),
1446
- id: group.id + constants.LAUNCHER_ID,
1447
- attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
1448
- });
1449
- groupContainer.appendChild(launcherIcon);
1450
- groupContainer.classList.add(constants.RIBBON_LAUNCHER);
1451
- EventHandler.add(launcherIcon, 'click', this_3.launcherIconClicked.bind(this_3, group.id), this_3);
1452
- EventHandler.add(launcherIcon, 'keydown', function (e) {
1453
- if (e.key === 'Enter') {
1454
- _this.launcherIconClicked(group.id);
1455
- }
1456
- }, this_3);
1985
+ this.createLauncherIcon(group.id, groupContainer);
1457
1986
  }
1458
- var elements = this_3.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
1987
+ var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
1459
1988
  append(elements, groupContent);
1460
- if ((this_3.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + constants.RIBBON_ITEM))) {
1989
+ if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + constants.RIBBON_ITEM))) {
1461
1990
  groupEle.classList.add('e-ribbon-emptyCollection');
1462
1991
  }
1463
- };
1464
- var this_3 = this;
1465
- for (var i = 0; i < groupList.length; i++) {
1466
- _loop_3(i);
1467
1992
  }
1468
1993
  return groupElements;
1469
1994
  };
@@ -1525,6 +2050,31 @@ var Ribbon = /** @class */ (function (_super) {
1525
2050
  }
1526
2051
  return collectionElements;
1527
2052
  };
2053
+ Ribbon.prototype.createRibbonItem = function (item, itemEle) {
2054
+ switch (item.type) {
2055
+ case 'Button':
2056
+ this.ribbonButtonModule.createButton(item, itemEle);
2057
+ break;
2058
+ case 'DropDown':
2059
+ this.ribbonDropDownModule.createDropDown(item, itemEle);
2060
+ break;
2061
+ case 'SplitButton':
2062
+ this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
2063
+ break;
2064
+ case 'CheckBox':
2065
+ this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
2066
+ break;
2067
+ case 'ColorPicker':
2068
+ this.ribbonColorPickerModule.createColorPicker(item, itemEle);
2069
+ break;
2070
+ case 'ComboBox':
2071
+ this.ribbonComboBoxModule.createComboBox(item, itemEle);
2072
+ break;
2073
+ case 'Template':
2074
+ this.createTemplateContent(item, itemEle);
2075
+ break;
2076
+ }
2077
+ };
1528
2078
  Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
1529
2079
  var _a;
1530
2080
  var itemElements = [];
@@ -1532,7 +2082,9 @@ var Ribbon = /** @class */ (function (_super) {
1532
2082
  var item = itemList[parseInt(i.toString(), 10)];
1533
2083
  //To stop rendering of items with simplified mode position type as none
1534
2084
  var flag = true;
1535
- while ((this.activeLayout === 'Simplified') && (flag) && (item.displayOptions === DisplayMode.None)) {
2085
+ while (flag &&
2086
+ (((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
2087
+ ((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
1536
2088
  i++;
1537
2089
  if (i < itemList.length) {
1538
2090
  item = itemList[parseInt(i.toString(), 10)];
@@ -1566,30 +2118,8 @@ var Ribbon = /** @class */ (function (_super) {
1566
2118
  else {
1567
2119
  itemEle.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
1568
2120
  }
1569
- switch (item.type) {
1570
- case 'Button':
1571
- this.ribbonButtonModule.createButton(item, itemEle);
1572
- break;
1573
- case 'DropDown':
1574
- this.ribbonDropDownModule.createDropDown(item, itemEle);
1575
- break;
1576
- case 'SplitButton':
1577
- this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
1578
- break;
1579
- case 'CheckBox':
1580
- this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
1581
- break;
1582
- case 'ColorPicker':
1583
- this.ribbonColorPickerModule.createColorPicker(item, itemEle);
1584
- break;
1585
- case 'ComboBox':
1586
- this.ribbonComboBoxModule.createComboBox(item, itemEle);
1587
- break;
1588
- case 'Template':
1589
- this.createTemplateContent(item, itemEle);
1590
- break;
1591
- }
1592
- if ((this.activeLayout === 'Simplified') && (item.displayOptions === DisplayMode.Overflow)) {
2121
+ this.createRibbonItem(item, itemEle);
2122
+ if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
1593
2123
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
1594
2124
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
1595
2125
  this.updatePopupItems(item, itemEle, isGroupOF, true);
@@ -1696,13 +2226,15 @@ var Ribbon = /** @class */ (function (_super) {
1696
2226
  var item = _e[_d];
1697
2227
  var ele = null;
1698
2228
  if (this.activeLayout === RibbonLayout.Classic) {
1699
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
2229
+ if (item.displayOptions & DisplayMode.Classic) {
2230
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
2231
+ }
1700
2232
  }
1701
2233
  else {
1702
- //Checks for Simplified and Auto options (Auto = simplified + popup)
2234
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
1703
2235
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
1704
2236
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
1705
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
2237
+ if (!ele) {
1706
2238
  ele = dropdown.target.querySelector('#' + item.id);
1707
2239
  if (item.type === 'DropDown') {
1708
2240
  this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
@@ -1758,15 +2290,17 @@ var Ribbon = /** @class */ (function (_super) {
1758
2290
  var item = _e[_d];
1759
2291
  var ele = void 0;
1760
2292
  if (this.activeLayout === RibbonLayout.Classic) {
1761
- ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
1762
- contentEle.querySelector('#' + item.id);
2293
+ if (item.displayOptions & DisplayMode.Classic) {
2294
+ ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
2295
+ contentEle.querySelector('#' + item.id);
2296
+ }
1763
2297
  }
1764
2298
  else {
1765
- //Checks for Simplified and Auto options (Auto = simplified + popup)
2299
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
1766
2300
  ele = (item.displayOptions & DisplayMode.Simplified) ?
1767
2301
  contentEle.querySelector('#' + item.id) : null;
1768
2302
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
1769
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
2303
+ if (!ele) {
1770
2304
  ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
1771
2305
  }
1772
2306
  }
@@ -2188,16 +2722,382 @@ var Ribbon = /** @class */ (function (_super) {
2188
2722
  this.refreshLayout();
2189
2723
  }
2190
2724
  };
2725
+ /**
2726
+ * tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
2727
+ *
2728
+ * @param {RibbonTabModel} tab - Gets the ribbon tab model.
2729
+ * @returns {void}
2730
+ */
2731
+ Ribbon.prototype.updateTab = function (tab) {
2732
+ var tabId = tab.id;
2733
+ var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
2734
+ if (index === -1) {
2735
+ return;
2736
+ }
2737
+ var contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
2738
+ var groups = this.tabs[parseInt(index.toString(), 10)].groups;
2739
+ var tabEle = this.tabObj.element;
2740
+ if (groups && (contentEle.innerHTML !== '')) {
2741
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
2742
+ if (tab.cssClass) {
2743
+ if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
2744
+ contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
2745
+ tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
2746
+ }
2747
+ }
2748
+ // Check whether group is passed by the user, and if it is, then remove the old values.
2749
+ if (tab.groups) {
2750
+ for (var _i = 0, groups_2 = groups; _i < groups_2.length; _i++) {
2751
+ var group = groups_2[_i];
2752
+ var dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID) : null;
2753
+ for (var _a = 0, _b = group.collections; _a < _b.length; _a++) {
2754
+ var collection = _b[_a];
2755
+ for (var _c = 0, _d = collection.items; _c < _d.length; _c++) {
2756
+ var item = _d[_c];
2757
+ var ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
2758
+ if (ele) {
2759
+ this.destroyFunction(item, ele);
2760
+ }
2761
+ }
2762
+ }
2763
+ if (dropdownElement) {
2764
+ this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
2765
+ }
2766
+ }
2767
+ var groupElements = contentEle.querySelectorAll('.e-ribbon-group');
2768
+ // eslint-disable-next-line @typescript-eslint/tslint/config
2769
+ groupElements.forEach(function (groupEle) { groupEle.remove(); });
2770
+ }
2771
+ }
2772
+ if (index === this.selectedTab) {
2773
+ this.isAddRemove = true;
2774
+ }
2775
+ var ribbonTab = this.tabs[parseInt(index.toString(), 10)];
2776
+ ribbonTab.setProperties(tab, true);
2777
+ this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
2778
+ this.validateItemSize();
2779
+ if (contentEle.innerHTML === '') {
2780
+ // Check whether group is passed by the user and sets the updated values.
2781
+ if (tab.groups) {
2782
+ var elements = this.createGroups(ribbonTab.groups, index);
2783
+ append(elements, contentEle);
2784
+ }
2785
+ if (this.selectedTab === index) {
2786
+ this.refreshLayout();
2787
+ }
2788
+ // Check whether cssClass is passed by the user and sets the updated values.
2789
+ if (tab.cssClass) {
2790
+ contentEle.classList.add(ribbonTab.cssClass);
2791
+ tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
2792
+ }
2793
+ // Check whether header is passed by the user and sets the updated values.
2794
+ if (tab.header) {
2795
+ tabEle.querySelector('#' + tabId + constants.HEADER_ID).innerText = ribbonTab.header;
2796
+ }
2797
+ }
2798
+ };
2799
+ /**
2800
+ * group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
2801
+ *
2802
+ * @param {RibbonGroupModel} group - Gets the ribbon group model.
2803
+ * @returns {void}
2804
+ */
2805
+ Ribbon.prototype.updateGroup = function (group) {
2806
+ var groupId = group.id;
2807
+ var itemProp = getGroup(this.tabs, groupId);
2808
+ if (!itemProp) {
2809
+ return;
2810
+ }
2811
+ if (this.selectedTab === itemProp.tabIndex) {
2812
+ this.clearOverflowResize();
2813
+ }
2814
+ //Check whether the tab items are rendered
2815
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
2816
+ var groupEle = contentEle.querySelector('#' + groupId);
2817
+ var groupContainer = groupEle.querySelector('#' + group.id + constants.CONTAINER_ID);
2818
+ var dropdownElement;
2819
+ var dropdown;
2820
+ if (contentEle.innerHTML !== '') {
2821
+ if (itemProp.group.showLauncherIcon) {
2822
+ this.removeLauncherIcon(itemProp.group.id, null, contentEle);
2823
+ }
2824
+ if (this.activeLayout === RibbonLayout.Simplified) {
2825
+ dropdownElement = itemProp.group.enableGroupOverflow ?
2826
+ contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) : null;
2827
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
2828
+ }
2829
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
2830
+ if (group.cssClass) {
2831
+ if (itemProp.group.cssClass) {
2832
+ groupEle.classList.remove(itemProp.group.cssClass);
2833
+ if (groupContainer) {
2834
+ groupContainer.classList.remove(itemProp.group.cssClass);
2835
+ }
2836
+ }
2837
+ }
2838
+ // Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
2839
+ if (group.collections || group.orientation) {
2840
+ if (itemProp.group.collections || itemProp.group.orientation) {
2841
+ for (var _i = 0, _a = itemProp.group.collections; _i < _a.length; _i++) {
2842
+ var collection = _a[_i];
2843
+ for (var _b = 0, _c = collection.items; _b < _c.length; _b++) {
2844
+ var item = _c[_b];
2845
+ this.removeItemElement(contentEle, item, dropdown);
2846
+ }
2847
+ }
2848
+ var collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
2849
+ // eslint-disable-next-line @typescript-eslint/tslint/config
2850
+ collectionElements.forEach(function (collectionEle) { collectionEle.remove(); });
2851
+ if (group.orientation) {
2852
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
2853
+ var removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
2854
+ if (removeCss) {
2855
+ removeClass([groupContent], removeCss);
2856
+ }
2857
+ }
2858
+ }
2859
+ }
2860
+ if (this.activeLayout === RibbonLayout.Simplified) {
2861
+ if (itemProp.group.enableGroupOverflow) {
2862
+ if (dropdown.target.childElementCount === 0) {
2863
+ this.removeOverflowButton(dropdown);
2864
+ }
2865
+ }
2866
+ else {
2867
+ var ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + constants.CONTAINER_ID);
2868
+ if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
2869
+ ofGroupContainer.remove();
2870
+ }
2871
+ var ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + constants.OVERFLOW_ID);
2872
+ if (ofTabContainer && ofTabContainer.childElementCount === 0) {
2873
+ ofTabContainer.remove();
2874
+ }
2875
+ }
2876
+ }
2877
+ }
2878
+ var ribbongroup = itemProp.group;
2879
+ ribbongroup.setProperties(group, true);
2880
+ ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
2881
+ this.validateItemSize();
2882
+ if (contentEle.innerHTML !== '') {
2883
+ // Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
2884
+ if (group.showLauncherIcon) {
2885
+ this.createLauncherIcon(ribbongroup.id, groupContainer);
2886
+ }
2887
+ // Check whether collections or orientation is passed by the user and sets the updated values.
2888
+ if (group.collections || group.orientation) {
2889
+ var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
2890
+ groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? constants.RIBBON_COLUMN : constants.RIBBON_ROW);
2891
+ var elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
2892
+ append(elements, groupContent);
2893
+ }
2894
+ if (this.selectedTab === itemProp.tabIndex) {
2895
+ this.refreshLayout();
2896
+ }
2897
+ // Check whether cssClass is passed by the user and sets the updated values.
2898
+ if (group.cssClass) {
2899
+ groupEle.classList.add(ribbongroup.cssClass);
2900
+ if (groupContainer) {
2901
+ groupContainer.classList.add(ribbongroup.cssClass);
2902
+ }
2903
+ }
2904
+ // Check whether header is passed by the user and sets the updated values.
2905
+ if (group.header) {
2906
+ if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
2907
+ var overflowHeader = dropdown.target.querySelector('#' + group.id + constants.HEADER_ID);
2908
+ if (overflowHeader) {
2909
+ overflowHeader.innerText = ribbongroup.header;
2910
+ }
2911
+ }
2912
+ else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
2913
+ groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
2914
+ }
2915
+ else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
2916
+ var overflowEle = groupEle.querySelector('#' + ribbongroup.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID);
2917
+ // need to set instance for dropdown
2918
+ var dropDownBtn = getInstance(overflowEle, DropDownButton);
2919
+ var overflowHeader = dropDownBtn.target.querySelector('#' + group.id + constants.HEADER_ID);
2920
+ if (overflowHeader) {
2921
+ overflowHeader.innerText = ribbongroup.header;
2922
+ }
2923
+ }
2924
+ }
2925
+ }
2926
+ };
2927
+ /**
2928
+ * collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
2929
+ *
2930
+ * @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
2931
+ * @returns {void}
2932
+ */
2933
+ Ribbon.prototype.updateCollection = function (collection) {
2934
+ var collectionId = collection.id;
2935
+ var itemProp = getCollection(this.tabs, collectionId);
2936
+ if (!itemProp) {
2937
+ return;
2938
+ }
2939
+ if (this.selectedTab === itemProp.tabIndex) {
2940
+ this.clearOverflowResize();
2941
+ }
2942
+ //Check whether the tab items are rendered
2943
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
2944
+ var collectionEle = contentEle.querySelector('#' + collectionId);
2945
+ if (contentEle.innerHTML !== '') {
2946
+ var dropdownElement = void 0;
2947
+ var dropdown = void 0;
2948
+ if (this.activeLayout === RibbonLayout.Simplified) {
2949
+ dropdownElement = itemProp.group.enableGroupOverflow ?
2950
+ contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) : null;
2951
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
2952
+ }
2953
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
2954
+ if (collection.cssClass) {
2955
+ if (itemProp.collection.cssClass) {
2956
+ collectionEle.classList.remove(itemProp.collection.cssClass);
2957
+ }
2958
+ }
2959
+ if (collection.items) {
2960
+ if (itemProp.collection.items) {
2961
+ for (var _i = 0, _a = itemProp.collection.items; _i < _a.length; _i++) {
2962
+ var item = _a[_i];
2963
+ this.removeItemElement(contentEle, item, dropdown);
2964
+ }
2965
+ }
2966
+ }
2967
+ }
2968
+ var ribboncollection = itemProp.collection;
2969
+ ribboncollection.setProperties(collection, true);
2970
+ ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
2971
+ this.validateItemSize();
2972
+ if (contentEle.innerHTML !== '') {
2973
+ if (collection.items) {
2974
+ var groupContainer = contentEle.querySelector('#' + itemProp.group.id + constants.CONTAINER_ID);
2975
+ var elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
2976
+ append(elements, collectionEle);
2977
+ }
2978
+ }
2979
+ if (this.selectedTab === itemProp.tabIndex) {
2980
+ this.refreshLayout();
2981
+ }
2982
+ // Check whether cssClass is passed by the user and sets the updated values.
2983
+ if (collection.cssClass) {
2984
+ collectionEle.classList.add(ribboncollection.cssClass);
2985
+ }
2986
+ };
2987
+ /**
2988
+ * item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
2989
+ *
2990
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
2991
+ * @returns {void}
2992
+ */
2993
+ Ribbon.prototype.updateItem = function (item) {
2994
+ var itemId = item.id;
2995
+ var itemProp = getItem(this.tabs, itemId);
2996
+ if (!itemProp) {
2997
+ return;
2998
+ }
2999
+ if (this.selectedTab === itemProp.tabIndex) {
3000
+ this.clearOverflowResize();
3001
+ }
3002
+ //Check whether the tab items are rendered
3003
+ var contentEle = this.tabObj.items[itemProp.tabIndex].content;
3004
+ var groupEle = contentEle.querySelector('#' + itemProp.group.id);
3005
+ var groupContainer = groupEle.querySelector('#' + itemProp.group.id + constants.CONTAINER_ID);
3006
+ var itemContainer = null;
3007
+ var itemEle = null;
3008
+ var dropdownElement;
3009
+ var dropdown;
3010
+ if (contentEle.innerHTML !== '') {
3011
+ if (this.activeLayout === RibbonLayout.Simplified) {
3012
+ dropdownElement = itemProp.group.enableGroupOverflow ?
3013
+ contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) : null;
3014
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
3015
+ }
3016
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
3017
+ itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
3018
+ itemEle = dropdown.target.querySelector('#' + itemId);
3019
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
3020
+ var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
3021
+ if (collectionEle) {
3022
+ collectionEle.appendChild(itemContainer);
3023
+ }
3024
+ }
3025
+ }
3026
+ else {
3027
+ itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
3028
+ itemEle = contentEle.querySelector('#' + itemId);
3029
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
3030
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
3031
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
3032
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
3033
+ }
3034
+ }
3035
+ }
3036
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
3037
+ if (item.cssClass) {
3038
+ if (itemProp.item.cssClass) {
3039
+ itemContainer.classList.remove(itemProp.item.cssClass);
3040
+ }
3041
+ }
3042
+ this.destroyFunction(itemProp.item, itemEle);
3043
+ itemEle.remove();
3044
+ var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
3045
+ if (removeCss) {
3046
+ removeClass([itemContainer], removeCss);
3047
+ }
3048
+ }
3049
+ var ribbonItem = itemProp.item;
3050
+ ribbonItem.setProperties(item, true);
3051
+ this.validateItemSize();
3052
+ if (contentEle.innerHTML !== '') {
3053
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
3054
+ itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
3055
+ }
3056
+ else {
3057
+ itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
3058
+ }
3059
+ // To avoid undefined items condition is added
3060
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
3061
+ itemContainer.classList.add(constants.RIBBON_TOOLTIP_TARGET);
3062
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
3063
+ }
3064
+ var size = ribbonItem.activeSize;
3065
+ if (this.activeLayout === 'Simplified') {
3066
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
3067
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
3068
+ ribbonItem.setProperties({ activeSize: size }, true);
3069
+ }
3070
+ if (size & RibbonItemSize.Large) {
3071
+ itemContainer.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
3072
+ }
3073
+ else {
3074
+ itemContainer.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
3075
+ }
3076
+ this.createRibbonItem(ribbonItem, itemContainer);
3077
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
3078
+ if (dropdown.target.childElementCount === 0) {
3079
+ this.removeOverflowButton(dropdown);
3080
+ }
3081
+ }
3082
+ if (this.selectedTab === itemProp.tabIndex) {
3083
+ this.refreshLayout();
3084
+ }
3085
+ if (item.cssClass) {
3086
+ itemContainer.classList.add(ribbonItem.cssClass);
3087
+ }
3088
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
3089
+ }
3090
+ };
2191
3091
  Ribbon.prototype.removeItemElement = function (contentEle, item, dropdown) {
2192
3092
  var ele = null;
2193
3093
  if (this.activeLayout === RibbonLayout.Classic) {
2194
- ele = contentEle.querySelector('#' + item.id);
3094
+ ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
2195
3095
  }
2196
3096
  else {
2197
- //Checks for Simplified and Auto options (Auto = simplified + popup)
3097
+ //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
2198
3098
  ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
2199
3099
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
2200
- if (!ele && (item.displayOptions !== DisplayMode.None)) {
3100
+ if (!ele) {
2201
3101
  ele = dropdown.target.querySelector('#' + item.id);
2202
3102
  }
2203
3103
  }
@@ -2248,6 +3148,8 @@ var Ribbon = /** @class */ (function (_super) {
2248
3148
  EventHandler.remove(window, 'resize', this.resizeHandler);
2249
3149
  };
2250
3150
  Ribbon.prototype.destroy = function () {
3151
+ this.keyboardModuleRibbon.destroy();
3152
+ this.keyboardModuleRibbon = null;
2251
3153
  destroyTooltip(this.element);
2252
3154
  this.destroyTabItems(this.tabs);
2253
3155
  this.removeExpandCollapse();
@@ -2299,6 +3201,9 @@ var Ribbon = /** @class */ (function (_super) {
2299
3201
  case 'isMinimized':
2300
3202
  this.element.classList.toggle(constants.RIBBON_MINIMIZE, this.isMinimized);
2301
3203
  this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
3204
+ if (!this.isMinimized) {
3205
+ this.refreshLayout();
3206
+ }
2302
3207
  break;
2303
3208
  case 'locale':
2304
3209
  this.updateCommonProperty({ locale: this.locale });
@@ -2323,7 +3228,7 @@ var Ribbon = /** @class */ (function (_super) {
2323
3228
  if (group.showLauncherIcon) {
2324
3229
  var className = constants.RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || constants.RIBBON_LAUNCHER_ICON);
2325
3230
  if (group.isCollapsed) {
2326
- var element = tabContent.querySelector('.' + constants.RIBBON_GROUP_OVERFLOW_DDB);
3231
+ var element = tabContent.querySelector('#' + group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID);
2327
3232
  var dropdown = getComponent(element, DropDownButton);
2328
3233
  var launcherIconEle = dropdown.target.querySelector('#' + group.id + constants.LAUNCHER_ID);
2329
3234
  launcherIconEle.className = className;
@@ -2354,14 +3259,20 @@ var Ribbon = /** @class */ (function (_super) {
2354
3259
  if (this.ribbonFileMenuModule) {
2355
3260
  this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
2356
3261
  }
3262
+ var toolbarEle = this.tabObj['tbObj'];
3263
+ toolbarEle.refreshOverflow();
2357
3264
  break;
2358
3265
  case 'helpPaneTemplate':
2359
3266
  if (this.ribbonTempEle) {
2360
3267
  remove(this.ribbonTempEle);
3268
+ this.ribbonTempEle = null;
3269
+ this.tabObj.element.style.setProperty(constants.RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
2361
3270
  }
2362
3271
  if (this.helpPaneTemplate) {
2363
3272
  this.createHelpPaneTemplate();
2364
3273
  }
3274
+ var toolbar_1 = this.tabObj['tbObj'];
3275
+ toolbar_1.refreshOverflow();
2365
3276
  break;
2366
3277
  }
2367
3278
  }