@syncfusion/ej2-ribbon 24.2.8 → 25.1.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +8 -4
  2. package/README.md +3 -0
  3. package/dist/ej2-ribbon.umd.min.js +2 -2
  4. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-ribbon.es2015.js +2164 -217
  6. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  7. package/dist/es6/ej2-ribbon.es5.js +2293 -226
  8. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  9. package/dist/global/ej2-ribbon.min.js +2 -2
  10. package/dist/global/ej2-ribbon.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +13 -13
  13. package/src/global.js +1 -1
  14. package/src/ribbon/base/constant.d.ts +8 -0
  15. package/src/ribbon/base/constant.js +8 -0
  16. package/src/ribbon/base/interface.d.ts +114 -1
  17. package/src/ribbon/base/interface.js +4 -0
  18. package/src/ribbon/base/ribbon-model.d.ts +22 -1
  19. package/src/ribbon/base/ribbon.d.ts +70 -5
  20. package/src/ribbon/base/ribbon.js +571 -157
  21. package/src/ribbon/base/utils.d.ts +3 -2
  22. package/src/ribbon/base/utils.js +3 -2
  23. package/src/ribbon/items/index.d.ts +1 -0
  24. package/src/ribbon/items/index.js +1 -0
  25. package/src/ribbon/items/ribbon-colorpicker.js +6 -1
  26. package/src/ribbon/items/ribbon-gallery.d.ts +87 -0
  27. package/src/ribbon/items/ribbon-gallery.js +712 -0
  28. package/src/ribbon/items/ribbon-groupbutton.js +3 -0
  29. package/src/ribbon/models/index.d.ts +8 -0
  30. package/src/ribbon/models/index.js +4 -0
  31. package/src/ribbon/models/ribbon-back-stage-settings-model.d.ts +7 -0
  32. package/src/ribbon/models/ribbon-back-stage-settings.d.ts +6 -0
  33. package/src/ribbon/models/ribbon-back-stage-settings.js +3 -0
  34. package/src/ribbon/models/ribbon-backstage-item-model.d.ts +7 -0
  35. package/src/ribbon/models/ribbon-backstage-item.d.ts +6 -0
  36. package/src/ribbon/models/ribbon-backstage-item.js +3 -0
  37. package/src/ribbon/models/ribbon-contextual-tab-settings-model.d.ts +30 -0
  38. package/src/ribbon/models/ribbon-contextual-tab-settings.d.ts +33 -0
  39. package/src/ribbon/models/ribbon-contextual-tab-settings.js +50 -0
  40. package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +7 -0
  41. package/src/ribbon/models/ribbon-file-menu-settings.d.ts +6 -0
  42. package/src/ribbon/models/ribbon-file-menu-settings.js +3 -0
  43. package/src/ribbon/models/ribbon-gallery-group-model.d.ts +44 -0
  44. package/src/ribbon/models/ribbon-gallery-group.d.ts +38 -0
  45. package/src/ribbon/models/ribbon-gallery-group.js +47 -0
  46. package/src/ribbon/models/ribbon-gallery-item-model.d.ts +43 -0
  47. package/src/ribbon/models/ribbon-gallery-item.d.ts +38 -0
  48. package/src/ribbon/models/ribbon-gallery-item.js +46 -0
  49. package/src/ribbon/models/ribbon-gallery-settings-model.d.ts +108 -0
  50. package/src/ribbon/models/ribbon-gallery-settings.d.ts +95 -0
  51. package/src/ribbon/models/ribbon-gallery-settings.js +71 -0
  52. package/src/ribbon/models/ribbon-group-button-item-model.d.ts +7 -0
  53. package/src/ribbon/models/ribbon-group-button-item.d.ts +6 -0
  54. package/src/ribbon/models/ribbon-group-button-item.js +3 -0
  55. package/src/ribbon/models/ribbon-group-model.d.ts +14 -0
  56. package/src/ribbon/models/ribbon-group.d.ts +12 -0
  57. package/src/ribbon/models/ribbon-group.js +6 -0
  58. package/src/ribbon/models/ribbon-item-model.d.ts +15 -1
  59. package/src/ribbon/models/ribbon-item.d.ts +13 -0
  60. package/src/ribbon/models/ribbon-item.js +7 -0
  61. package/src/ribbon/models/ribbon-tab-model.d.ts +7 -0
  62. package/src/ribbon/models/ribbon-tab.d.ts +6 -0
  63. package/src/ribbon/models/ribbon-tab.js +3 -0
  64. package/src/ribbon/modules/index.d.ts +2 -0
  65. package/src/ribbon/modules/index.js +2 -0
  66. package/src/ribbon/modules/ribbon-backstage.d.ts +2 -0
  67. package/src/ribbon/modules/ribbon-backstage.js +37 -0
  68. package/src/ribbon/modules/ribbon-contextualtab.d.ts +27 -0
  69. package/src/ribbon/modules/ribbon-contextualtab.js +90 -0
  70. package/src/ribbon/modules/ribbon-filemenu.d.ts +2 -0
  71. package/src/ribbon/modules/ribbon-filemenu.js +19 -0
  72. package/src/ribbon/modules/ribbon-keytip.d.ts +54 -0
  73. package/src/ribbon/modules/ribbon-keytip.js +554 -0
  74. package/styles/bootstrap-dark.css +398 -24
  75. package/styles/bootstrap.css +389 -15
  76. package/styles/bootstrap4.css +398 -24
  77. package/styles/bootstrap5-dark.css +391 -17
  78. package/styles/bootstrap5.css +391 -17
  79. package/styles/fabric-dark.css +388 -14
  80. package/styles/fabric.css +387 -13
  81. package/styles/fluent-dark.css +389 -15
  82. package/styles/fluent.css +389 -15
  83. package/styles/highcontrast-light.css +381 -7
  84. package/styles/highcontrast.css +390 -16
  85. package/styles/material-dark.css +391 -17
  86. package/styles/material.css +391 -17
  87. package/styles/material3-dark.css +389 -15
  88. package/styles/material3.css +389 -15
  89. package/styles/ribbon/_bds-definition.scss +360 -0
  90. package/styles/ribbon/_bootstrap-dark-definition.scss +81 -6
  91. package/styles/ribbon/_bootstrap-definition.scss +81 -6
  92. package/styles/ribbon/_bootstrap4-definition.scss +82 -7
  93. package/styles/ribbon/_bootstrap5-definition.scss +81 -6
  94. package/styles/ribbon/_fabric-dark-definition.scss +78 -3
  95. package/styles/ribbon/_fabric-definition.scss +78 -3
  96. package/styles/ribbon/_fluent-definition.scss +80 -5
  97. package/styles/ribbon/_fusionnew-definition.scss +76 -1
  98. package/styles/ribbon/_highcontrast-definition.scss +80 -5
  99. package/styles/ribbon/_highcontrast-light-definition.scss +76 -1
  100. package/styles/ribbon/_layout.scss +344 -38
  101. package/styles/ribbon/_material-dark-definition.scss +80 -5
  102. package/styles/ribbon/_material-definition.scss +81 -6
  103. package/styles/ribbon/_material3-definition.scss +80 -5
  104. package/styles/ribbon/_tailwind-definition.scss +80 -5
  105. package/styles/ribbon/_theme.scss +71 -0
  106. package/styles/ribbon/bootstrap-dark.css +398 -24
  107. package/styles/ribbon/bootstrap.css +389 -15
  108. package/styles/ribbon/bootstrap4.css +398 -24
  109. package/styles/ribbon/bootstrap5-dark.css +391 -17
  110. package/styles/ribbon/bootstrap5.css +391 -17
  111. package/styles/ribbon/fabric-dark.css +388 -14
  112. package/styles/ribbon/fabric.css +387 -13
  113. package/styles/ribbon/fluent-dark.css +389 -15
  114. package/styles/ribbon/fluent.css +389 -15
  115. package/styles/ribbon/highcontrast-light.css +381 -7
  116. package/styles/ribbon/highcontrast.css +390 -16
  117. package/styles/ribbon/icons/_bds.scss +9 -0
  118. package/styles/ribbon/material-dark.css +391 -17
  119. package/styles/ribbon/material.css +391 -17
  120. package/styles/ribbon/material3-dark.css +389 -15
  121. package/styles/ribbon/material3.css +389 -15
  122. package/styles/ribbon/tailwind-dark.css +390 -16
  123. package/styles/ribbon/tailwind.css +390 -16
  124. package/styles/tailwind-dark.css +390 -16
  125. package/styles/tailwind.css +390 -16
@@ -20,12 +20,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
20
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
- import { RibbonTab, FileMenuSettings, BackStageMenu } from '../models/index';
23
+ import { RibbonTab, FileMenuSettings, BackStageMenu, RibbonContextualTabSettings } from '../models/index';
24
24
  import { DisplayMode, RibbonLayout } from './interface';
25
25
  import { ItemOrientation, RibbonItemSize, RibbonItemType } from './interface';
26
26
  import { RibbonButton, RibbonComboBox, RibbonCheckBox, RibbonDropDown, RibbonSplitButton, RibbonGroupButton } from '../items/index';
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
+ import { Popup } from '@syncfusion/ej2-popups';
29
30
  import { DropDownButton, SplitButton } from '@syncfusion/ej2-splitbuttons';
30
31
  import { CheckBox } from '@syncfusion/ej2-buttons';
31
32
  /**
@@ -56,12 +57,17 @@ var Ribbon = /** @class */ (function (_super) {
56
57
  this.initialize();
57
58
  };
58
59
  Ribbon.prototype.preRender = function () {
60
+ this.keysPress = '';
59
61
  this.idIndex = 0;
60
62
  this.tooltipData = [];
61
63
  this.initialPropsData = {};
62
64
  this.hiddenElements = {};
65
+ this.keyTipElements = {};
63
66
  this.hiddenGroups = [];
67
+ this.itemsModel = [];
68
+ this.targetTabs = {};
64
69
  this.isAddRemove = false;
70
+ this.isUpdateItems = false;
65
71
  this.keyConfigs = {
66
72
  leftarrow: 'leftarrow',
67
73
  rightarrow: 'rightarrow',
@@ -94,7 +100,27 @@ var Ribbon = /** @class */ (function (_super) {
94
100
  */
95
101
  Ribbon.prototype.requiredModules = function () {
96
102
  var modules = [];
97
- modules.push({ member: 'ribbonButton', args: [this] }, { member: 'ribbonDropDown', args: [this] }, { member: 'ribbonSplitButton', args: [this] }, { member: 'ribbonCheckBox', args: [this] }, { member: 'ribbonColorPicker', args: [this] }, { member: 'ribbonComboBox', args: [this] }, { member: 'ribbonGroupButton', args: [this] }, { member: 'ribbonFileMenu', args: [this] }, { member: 'ribbonBackstage', args: [this] });
103
+ modules.push({ member: 'ribbonButton', args: [this], name: 'RibbonButton' }, { member: 'ribbonDropDown', args: [this], name: 'RibbonDropDown' }, { member: 'ribbonSplitButton', args: [this], name: 'RibbonSplitButton' }, { member: 'ribbonCheckBox', args: [this], name: 'RibbonCheckBox' }, { member: 'ribbonComboBox', args: [this], name: 'RibbonComboBox' }, { member: 'ribbonGroupButton', args: [this], name: 'RibbonGroupButton' });
104
+ var canInjectColorPickerModule = getItem(this.tabs, null, RibbonItemType.ColorPicker);
105
+ var canInjectGalleryModule = getItem(this.tabs, null, RibbonItemType.Gallery);
106
+ if (canInjectColorPickerModule) {
107
+ modules.push({ member: 'ribbonColorPicker', args: [this], name: 'RibbonColorPicker' });
108
+ }
109
+ if (canInjectGalleryModule) {
110
+ modules.push({ member: 'ribbonGallery', args: [this], name: 'RibbonGallery' });
111
+ }
112
+ if (this.backStageMenu.visible || this.backStageMenu.items.length) {
113
+ modules.push({ member: 'ribbonBackstage', args: [this], name: 'RibbonBackstage' });
114
+ }
115
+ if (this.fileMenu.visible || this.fileMenu.menuItems.length) {
116
+ modules.push({ member: 'ribbonFileMenu', args: [this], name: 'RibbonFileMenu' });
117
+ }
118
+ if (this.contextualTabs.length) {
119
+ modules.push({ member: 'ribbonContextualTab', args: [this], name: 'RibbonContextualTab' });
120
+ }
121
+ if (this.enableKeyTips) {
122
+ modules.push({ member: 'ribbonKeyTip', args: [this], name: 'RibbonKeyTip' });
123
+ }
98
124
  return modules;
99
125
  };
100
126
  Ribbon.prototype.initialize = function () {
@@ -105,6 +131,9 @@ var Ribbon = /** @class */ (function (_super) {
105
131
  }
106
132
  this.element.style.width = formatUnit(this.width);
107
133
  this.renderTabs();
134
+ if (this.ribbonContextualTabModule) {
135
+ this.ribbonContextualTabModule.addContextualTabs();
136
+ }
108
137
  if (this.ribbonFileMenuModule) {
109
138
  this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
110
139
  }
@@ -114,13 +143,18 @@ var Ribbon = /** @class */ (function (_super) {
114
143
  this.createHelpPaneTemplate();
115
144
  var toolbar = this.tabObj['tbObj'];
116
145
  toolbar.refreshOverflow();
146
+ this.addTabOverflowKeyTip();
117
147
  createTooltip(this.element, this);
148
+ this.isKeytipOpen = false;
118
149
  this.wireEvents();
119
150
  this.wireKeyboardEvent();
120
151
  this.currentControlIndex = 0;
121
152
  };
122
153
  Ribbon.prototype.wireEvents = function () {
123
154
  EventHandler.add(window, 'resize', this.resizeHandler, this);
155
+ EventHandler.add(document.body, 'keydown', this.keytipActionHandler, this);
156
+ EventHandler.add(document, 'mousedown', this.mouseEventHandler, this);
157
+ EventHandler.add(document, 'scroll', this.mouseEventHandler, this);
124
158
  };
125
159
  Ribbon.prototype.wireKeyboardEvent = function () {
126
160
  this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
@@ -136,7 +170,8 @@ var Ribbon = /** @class */ (function (_super) {
136
170
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
137
171
  var controlElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-control'));
138
172
  var templateElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-template'));
139
- var ribbonControls = controlElements.concat(templateElements);
173
+ var galleryElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-gallery-item'));
174
+ var ribbonControls = controlElements.concat(templateElements, galleryElements);
140
175
  var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
141
176
  var comboBoxEle;
142
177
  if (comboBoxElements) {
@@ -165,7 +200,7 @@ var Ribbon = /** @class */ (function (_super) {
165
200
  if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
166
201
  e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
167
202
  e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
168
- e.target.classList.contains('e-ribbon-overall-of-btn') || e.target.classList.contains('e-ribbon-template')) {
203
+ e.target.classList.contains('e-ribbon-overall-of-btn') || e.target.classList.contains('e-ribbon-template') || e.target.classList.contains('e-ribbon-gallery-item')) {
169
204
  switch (e.action) {
170
205
  case 'rightarrow':
171
206
  this.handleNavigation(e, !this.enableRtl, ribbonControls);
@@ -207,7 +242,7 @@ var Ribbon = /** @class */ (function (_super) {
207
242
  }
208
243
  }
209
244
  if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
210
- if (!e.target.classList.contains('e-combobox') && (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-template')) && !e.target.classList.contains('e-ribbon-last-item')) {
245
+ if (!e.target.classList.contains('e-combobox') && (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-template') || e.target.classList.contains('e-ribbon-gallery-item')) && !e.target.classList.contains('e-ribbon-last-item')) {
211
246
  if (enableRtl) {
212
247
  this.currentControlIndex++;
213
248
  }
@@ -366,6 +401,111 @@ var Ribbon = /** @class */ (function (_super) {
366
401
  }
367
402
  }
368
403
  }
404
+ var galleryPopupEle = document.querySelector('.e-ribbon-gallery-popup.e-popup-open');
405
+ if (galleryPopupEle) {
406
+ var popup = getComponent(galleryPopupEle, Popup);
407
+ popup.hide();
408
+ }
409
+ if (this.ribbonKeyTipModule && this.enableKeyTips) {
410
+ this.ribbonKeyTipModule.removeKeytip();
411
+ }
412
+ };
413
+ Ribbon.prototype.mouseEventHandler = function (e) {
414
+ if (this.ribbonKeyTipModule && this.enableKeyTips) {
415
+ this.ribbonKeyTipModule.removeKeytip();
416
+ }
417
+ };
418
+ Ribbon.prototype.keytipActionHandler = function (e) {
419
+ if (this.enableKeyTips) {
420
+ var isKeyTipPresent = false;
421
+ var keyPress = e.key;
422
+ if (e.altKey && e.key === 'Meta') {
423
+ var activePopup = document.querySelectorAll('.e-ribbon .e-dropdown-btn.e-active, .e-ribbon-group-overflow-ddb .e-dropdown-btn.e-active');
424
+ if (activePopup.length) {
425
+ for (var i = 0; i < activePopup.length; i++) {
426
+ var dropDownBtn = getInstance(activePopup[parseInt(i.toString(), 10)], DropDownButton);
427
+ dropDownBtn.toggle();
428
+ }
429
+ this.ribbonKeyTipModule.removeKeytip();
430
+ }
431
+ else {
432
+ if (!this.isKeytipOpen) {
433
+ var backstagePopup = document.querySelector('.e-ribbon-backstage-popup');
434
+ if (backstagePopup && backstagePopup.classList.contains('e-popup-open')) {
435
+ this.ribbonBackstageModule.hideBackstage();
436
+ }
437
+ this.ribbonKeyTipModule.createKeytip('tab');
438
+ }
439
+ else {
440
+ this.ribbonKeyTipModule.removeKeytip();
441
+ }
442
+ }
443
+ }
444
+ else if (e.key === 'Escape' || e.key === 'Tab' || e.key === 'ArrowLeft' || e.key === 'ArrowUp' || e.key === 'ArrowRight' || e.key === 'ArrowDown') {
445
+ this.ribbonKeyTipModule.removeKeytip(e.key);
446
+ }
447
+ else {
448
+ var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
449
+ if (keyTipItems) {
450
+ for (var i = 0; i < keyTipItems.length; i++) {
451
+ var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
452
+ if (keyTipItem.innerHTML.toLowerCase() === keyPress) {
453
+ isKeyTipPresent = true;
454
+ this.ribbonKeyTipModule.keytipPress(keyPress);
455
+ break;
456
+ }
457
+ }
458
+ if (!isKeyTipPresent) {
459
+ this.checkKeyTipPresent(keyPress, this.keysPress.length);
460
+ }
461
+ }
462
+ }
463
+ }
464
+ };
465
+ Ribbon.prototype.checkKeyTipPresent = function (keyTip, length) {
466
+ var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
467
+ for (var i = 0; i < keyTipItems.length; i++) {
468
+ var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
469
+ if (keyTipItem.innerHTML.length > 1 && keyTipItem.innerHTML[parseInt(length.toString(), 10)].toLowerCase() === keyTip) {
470
+ this.keysPress += keyTip;
471
+ this.ribbonKeyTipModule.keytipPress(this.keysPress);
472
+ this.removeKeytip(this.keysPress);
473
+ break;
474
+ }
475
+ }
476
+ };
477
+ Ribbon.prototype.removeKeytip = function (keyTip) {
478
+ var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
479
+ for (var i = 0; i < keyTipItems.length; i++) {
480
+ var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
481
+ if (keyTipItem.innerHTML[0].toLowerCase() !== keyTip && keyTip !== '') {
482
+ remove(keyTipItem);
483
+ }
484
+ }
485
+ };
486
+ Ribbon.prototype.addKeyTip = function (tabIndex, keyTip, id, type) {
487
+ if (this.keyTipElements && this.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
488
+ var isKeyTipExist = false;
489
+ /* eslint-disable */
490
+ if (!(this.keyTipElements[parseInt(tabIndex.toString(), 10)][type])) {
491
+ this.keyTipElements[parseInt(tabIndex.toString(), 10)][type] = [];
492
+ }
493
+ if (Object.keys(this.keyTipElements[tabIndex][type]).length) {
494
+ var keytipData = this.keyTipElements[tabIndex][type];
495
+ for (var i = 0; i < Object.keys(this.keyTipElements[tabIndex][type]).length; i++) {
496
+ if (keytipData[parseInt(i.toString(), 10)].id === id) {
497
+ isKeyTipExist = true;
498
+ }
499
+ }
500
+ if (!isKeyTipExist) {
501
+ this.keyTipElements[tabIndex][type].push({ id: id, type: type, keyTip: keyTip });
502
+ }
503
+ }
504
+ else {
505
+ this.keyTipElements[tabIndex][type].push({ id: id, type: type, keyTip: keyTip });
506
+ }
507
+ /* eslint-enable */
508
+ }
369
509
  };
370
510
  Ribbon.prototype.renderTabs = function () {
371
511
  this.tabsInternal = this.tabs.slice();
@@ -428,14 +568,33 @@ var Ribbon = /** @class */ (function (_super) {
428
568
  this.renderInitialTab(this.selectedTab);
429
569
  };
430
570
  Ribbon.prototype.ribbonTabSelected = function (e) {
571
+ e.preventFocus = true;
431
572
  this.isAddRemove = false;
432
573
  var selectedTabId = e.selectedItem.getAttribute('data-id');
433
574
  var selectedIndex = getIndex(this.tabs, (function (tab) { return (tab.id === selectedTabId); }));
434
575
  selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
435
- var eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex };
576
+ var isContextual = this.isContextualTab(selectedTabId);
577
+ this.updateSelectedState(selectedTabId);
578
+ var eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex, isContextual: isContextual };
436
579
  this.setProperties({ selectedTab: selectedIndex }, true);
437
580
  this.calculateHiddenElementsWidth(selectedIndex);
581
+ if (this.isUpdateItems) {
582
+ for (var i = 0; i < this.itemsModel.length; i++) {
583
+ var item = this.itemsModel[parseInt(i.toString(), 10)];
584
+ if (this.selectedTab === this.targetTabs[item.id]) {
585
+ this.updateItem(item);
586
+ this.itemsModel.splice(i, 1);
587
+ i--;
588
+ }
589
+ }
590
+ if (this.itemsModel.length === 0) {
591
+ this.isUpdateItems = false;
592
+ }
593
+ }
438
594
  this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
595
+ if (this.activeLayout === 'Classic' && this.ribbonGalleryModule) {
596
+ this.ribbonGalleryModule.checkAvailableHeight(selectedIndex, e.selectedContent.firstChild);
597
+ }
439
598
  if (this.activeLayout === 'Simplified' && this.overflowDDB) {
440
599
  var overflowTarget = this.overflowDDB.target;
441
600
  var ofTabContainer = overflowTarget.querySelector('.' + constants.RIBBON_TAB_ACTIVE);
@@ -454,6 +613,20 @@ var Ribbon = /** @class */ (function (_super) {
454
613
  }
455
614
  this.trigger('tabSelected', eventArgs);
456
615
  };
616
+ Ribbon.prototype.updateSelectedState = function (tabID) {
617
+ if (this.contextualTabs.length) {
618
+ for (var i = 0; i < this.contextualTabs.length; i++) {
619
+ var isSelected = false;
620
+ for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
621
+ if (this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id === tabID) {
622
+ isSelected = true;
623
+ break;
624
+ }
625
+ }
626
+ this.contextualTabs[parseInt(i.toString(), 10)].setProperties({ isSelected: isSelected }, true);
627
+ }
628
+ }
629
+ };
457
630
  Ribbon.prototype.checkOverflow = function (tabIndex, activeContent) {
458
631
  var tabContent = activeContent.closest('.' + constants.TAB_CONTENT);
459
632
  var isOverFlow = tabContent.offsetWidth < activeContent.offsetWidth;
@@ -503,6 +676,17 @@ var Ribbon = /** @class */ (function (_super) {
503
676
  }
504
677
  }
505
678
  }
679
+ this.addTabOverflowKeyTip();
680
+ };
681
+ Ribbon.prototype.addTabOverflowKeyTip = function () {
682
+ var tabOverflow = this.tabObj.element.querySelector('#_nav');
683
+ if (tabOverflow) {
684
+ this.keyTipElements['taboverflow'] = [];
685
+ this.keyTipElements['taboverflow'].push({ id: tabOverflow.id, type: 'taboverflow', keyTip: '00' });
686
+ }
687
+ else {
688
+ delete (this.keyTipElements['taboverflow']);
689
+ }
506
690
  };
507
691
  Ribbon.prototype.checkSimplifiedItemShrinking = function (tabIndex, tabContent, activeContent) {
508
692
  var tab = this.tabs[parseInt(tabIndex.toString(), 10)];
@@ -637,7 +821,7 @@ var Ribbon = /** @class */ (function (_super) {
637
821
  item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
638
822
  this.setItemSize(itemEle, item);
639
823
  }
640
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
824
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
641
825
  this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, true);
642
826
  }
643
827
  }
@@ -667,7 +851,7 @@ var Ribbon = /** @class */ (function (_super) {
667
851
  return isEmptyCollection;
668
852
  };
669
853
  Ribbon.prototype.updatePopupItems = function (item, itemEle, isGroupOF, isMenu) {
670
- var dropdown = getComponent(itemEle.querySelector('#' + item.id), (item.type === RibbonItemType.DropDown || item.type === RibbonItemType.GroupButton) ? DropDownButton : SplitButton);
854
+ var dropdown = getComponent(itemEle.querySelector('#' + item.id), (item.type === RibbonItemType.DropDown || item.type === RibbonItemType.Gallery || item.type === RibbonItemType.GroupButton) ? DropDownButton : SplitButton);
671
855
  var dropDownPopup = dropdown.dropDown;
672
856
  // popup is on right if (isGroupOF && isMenu)
673
857
  // The position is reversed if RTL is enabled.
@@ -733,7 +917,7 @@ var Ribbon = /** @class */ (function (_super) {
733
917
  break;
734
918
  }
735
919
  var groupEle = tabContent.querySelector('#' + collection.id);
736
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
920
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
737
921
  this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, false);
738
922
  }
739
923
  groupEle.append(itemContainer);
@@ -852,19 +1036,22 @@ var Ribbon = /** @class */ (function (_super) {
852
1036
  };
853
1037
  Ribbon.prototype.createOverflowPopup = function (item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer, isResize) {
854
1038
  var overflowButton;
1039
+ var overflowtarget;
855
1040
  var itemProp = getGroup(this.tabs, groupId);
856
1041
  var contentEle = this.tabObj.items[parseInt(tabIndex.toString(), 10)].content;
857
1042
  var groupEle = contentEle.querySelector('#' + groupId);
858
1043
  if (isGroupOF) {
859
1044
  var overflowDDB = groupContainer.querySelector('#' + groupId + constants.GROUPOF_BUTTON_ID);
860
1045
  if (!overflowDDB) {
861
- overflowButton = this.addOverflowButton(groupId + constants.GROUPOF_BUTTON_ID);
1046
+ overflowButton = this.addOverflowButton(groupId + constants.GROUPOF_BUTTON_ID, isGroupOF);
862
1047
  overflowButton.element.classList.add(constants.RIBBON_GROUP_OF_BUTTON);
863
1048
  groupContainer.appendChild(overflowButton.element);
864
1049
  }
865
1050
  else {
866
1051
  overflowButton = getInstance(overflowDDB, DropDownButton);
867
1052
  }
1053
+ this.addKeyTip(tabIndex, '0' + (itemProp.groupIndex + 1), overflowButton.element.id, 'grpofbtn');
1054
+ overflowtarget = overflowButton.target;
868
1055
  var overflowBtnTarget = overflowButton.target;
869
1056
  var headerEle = overflowBtnTarget.querySelector('#' + groupId + constants.GROUPOF_BUTTON_ID + constants.HEADER_ID);
870
1057
  if (!headerEle) {
@@ -893,7 +1080,7 @@ var Ribbon = /** @class */ (function (_super) {
893
1080
  }
894
1081
  else {
895
1082
  if (!this.overflowDDB) {
896
- this.overflowDDB = this.addOverflowButton(this.tabObj.element.id + constants.OVRLOF_BUTTON_ID);
1083
+ this.overflowDDB = this.addOverflowButton(this.tabObj.element.id + constants.OVRLOF_BUTTON_ID, isGroupOF);
897
1084
  this.tabObj.element.insertBefore(this.overflowDDB.element, this.collapseButton);
898
1085
  this.overflowDDB.element.classList.add(constants.RIBBON_OVERALL_OF_BUTTON);
899
1086
  this.createOfTabContainer(groupId, groupHeader, itemEle, tabIndex);
@@ -926,10 +1113,16 @@ var Ribbon = /** @class */ (function (_super) {
926
1113
  }
927
1114
  }
928
1115
  overflowButton = this.overflowDDB;
1116
+ overflowtarget = this.overflowDDB ? this.overflowDDB.target : null;
929
1117
  }
930
1118
  if (itemEle !== null) {
931
1119
  this.addOverflowEvents(item, itemEle, overflowButton);
932
1120
  }
1121
+ if (overflowtarget) {
1122
+ if (item.keyTip) {
1123
+ this.addKeyTip(tabIndex, item.keyTip, item.id, 'popupitem');
1124
+ }
1125
+ }
933
1126
  };
934
1127
  Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
935
1128
  switch (item.type) {
@@ -951,6 +1144,11 @@ var Ribbon = /** @class */ (function (_super) {
951
1144
  case 'ComboBox':
952
1145
  this.ribbonComboBoxModule.addOverFlowEvents(item, itemEle, overflowButton);
953
1146
  break;
1147
+ case 'Gallery':
1148
+ if (this.activeLayout === 'Simplified') {
1149
+ this.ribbonGalleryModule.addOverFlowEvents(item, itemEle, overflowButton);
1150
+ }
1151
+ break;
954
1152
  case 'GroupButton':
955
1153
  if (this.activeLayout === 'Simplified') {
956
1154
  this.ribbonGroupButtonModule.addOverFlowEvents(item, itemEle, overflowButton);
@@ -1629,6 +1827,10 @@ var Ribbon = /** @class */ (function (_super) {
1629
1827
  this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
1630
1828
  this_1.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
1631
1829
  var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
1830
+ if (group.keyTip) {
1831
+ var overflowDDB = group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID;
1832
+ this_1.addKeyTip(tabIndex, group.keyTip, overflowDDB, 'grpoverflow');
1833
+ }
1632
1834
  this_1.tabs[parseInt(tabIndex.toString(), 10)].
1633
1835
  groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
1634
1836
  for (var j = 0; j < group.collections.length; j++) {
@@ -1641,6 +1843,25 @@ var Ribbon = /** @class */ (function (_super) {
1641
1843
  this_1.handleContentSize(itemEle);
1642
1844
  this_1.addOverflowEvents(item, itemEle, dropdown);
1643
1845
  }
1846
+ var overflowDDB = document.querySelector('#' + group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID);
1847
+ var overflowButton = getInstance(overflowDDB, DropDownButton);
1848
+ if (overflowButton) {
1849
+ var overflowtarget = overflowButton.target;
1850
+ if (overflowtarget) {
1851
+ if (this_1.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
1852
+ if (item.type === RibbonItemType.GroupButton) {
1853
+ for (var i_3 = 0; i_3 < item.groupButtonSettings.items.length; i_3++) {
1854
+ if (item.groupButtonSettings.items[parseInt(i_3.toString(), 10)].keyTip) {
1855
+ this_1.addKeyTip(tabIndex, item.groupButtonSettings.items[parseInt(i_3.toString(), 10)].keyTip, item.id + (constants.RIBBON_GROUP_BUTTON_ID + i_3), 'grpoverflowpopup');
1856
+ }
1857
+ }
1858
+ }
1859
+ if (item.keyTip) {
1860
+ this_1.addKeyTip(tabIndex, item.keyTip, item.id, 'grpoverflowpopup');
1861
+ }
1862
+ }
1863
+ }
1864
+ }
1644
1865
  }
1645
1866
  }
1646
1867
  };
@@ -1739,16 +1960,31 @@ var Ribbon = /** @class */ (function (_super) {
1739
1960
  this.removeOverflowDropdown(activeContent, tabContent, true, index);
1740
1961
  }
1741
1962
  };
1963
+ Ribbon.prototype.isContextualTab = function (tabID) {
1964
+ var isContextual = false;
1965
+ if (this.contextualTabs.length) {
1966
+ for (var i = 0; i < this.contextualTabs.length; i++) {
1967
+ for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
1968
+ if (this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id === tabID) {
1969
+ isContextual = true;
1970
+ break;
1971
+ }
1972
+ }
1973
+ }
1974
+ }
1975
+ return isContextual;
1976
+ };
1742
1977
  Ribbon.prototype.ribbonTabSelecting = function (e) {
1743
1978
  var _this = this;
1744
1979
  this.currentControlIndex = 0;
1745
1980
  var nextTabId = e.selectingItem.getAttribute('data-id');
1746
1981
  var previousTabId = e.previousItem.getAttribute('data-id');
1747
1982
  var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
1983
+ var isContextual = this.isContextualTab(nextTabId);
1748
1984
  var previousIndex = getIndex(this.tabs, (function (tab) { return (tab.id === previousTabId); }));
1749
1985
  nextIndex = nextIndex === -1 ? this.selectedTab : nextIndex;
1750
1986
  var eventArgs = {
1751
- cancel: e.cancel, isInteracted: e.isInteracted, previousIndex: previousIndex, selectedIndex: nextIndex
1987
+ cancel: e.cancel, isInteracted: e.isInteracted, previousIndex: previousIndex, selectedIndex: nextIndex, isContextual: isContextual
1752
1988
  };
1753
1989
  this.trigger('tabSelecting', eventArgs, function (args) {
1754
1990
  if (args.cancel) {
@@ -1768,22 +2004,33 @@ var Ribbon = /** @class */ (function (_super) {
1768
2004
  Ribbon.prototype.createTabItems = function (tabs) {
1769
2005
  var _this = this;
1770
2006
  var tabItems = [];
1771
- for (var i = 0; i < tabs.length; i++) {
2007
+ var _loop_3 = function (i) {
1772
2008
  var ribbonTab = tabs[parseInt(i.toString(), 10)];
1773
- var header = this.createElement('span', {
2009
+ var header = this_3.createElement('span', {
1774
2010
  innerHTML: ribbonTab.header,
1775
2011
  id: ribbonTab.id + constants.HEADER_ID
1776
2012
  });
2013
+ var tabIndex = getIndex(this_3.tabs, (function (tab) { return (tab.id === ribbonTab.id); }));
2014
+ if (ribbonTab.keyTip) {
2015
+ if (!this_3.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
2016
+ this_3.keyTipElements[parseInt(tabIndex.toString(), 10)] = {};
2017
+ }
2018
+ this_3.addKeyTip(tabIndex, ribbonTab.keyTip, ribbonTab.id, 'tab');
2019
+ }
1777
2020
  header.onclick = function () { _this.minimize(false); };
1778
2021
  header.ondblclick = function () { _this.minimize(true); };
1779
2022
  var tab = { header: { text: header }, id: ribbonTab.id, cssClass: ribbonTab.cssClass };
1780
- var content = this.createElement('div', {
2023
+ var content = this_3.createElement('div', {
1781
2024
  className: tab.cssClass,
1782
2025
  id: ribbonTab.id + constants.CONTENT_ID
1783
2026
  });
1784
2027
  content.classList.add(constants.RIBBON_TAB_ITEM);
1785
2028
  tab.content = content;
1786
2029
  tabItems.push(tab);
2030
+ };
2031
+ var this_3 = this;
2032
+ for (var i = 0; i < tabs.length; i++) {
2033
+ _loop_3(i);
1787
2034
  }
1788
2035
  return tabItems;
1789
2036
  };
@@ -1796,8 +2043,10 @@ var Ribbon = /** @class */ (function (_super) {
1796
2043
  }
1797
2044
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
1798
2045
  this.checkOverflow(this.selectedTab, activeContent);
2046
+ if (this.activeLayout === 'Classic' && this.ribbonGalleryModule)
2047
+ this.ribbonGalleryModule.checkAvailableHeight(this.selectedTab, activeContent);
1799
2048
  };
1800
- Ribbon.prototype.addOverflowButton = function (btnId) {
2049
+ Ribbon.prototype.addOverflowButton = function (btnId, isGroupOF) {
1801
2050
  var _this = this;
1802
2051
  var overflowButton = this.createElement('button', {
1803
2052
  id: btnId
@@ -1834,6 +2083,10 @@ var Ribbon = /** @class */ (function (_super) {
1834
2083
  }, overflowButton);
1835
2084
  this.element.classList.add(constants.RIBBON_OVERFLOW);
1836
2085
  createTooltip(overflowTarget, this);
2086
+ if (!isGroupOF) {
2087
+ this.keyTipElements['overflowbtn'] = [];
2088
+ this.keyTipElements['overflowbtn'].push({ id: btnId, type: 'overflowbtn', keyTip: '00' });
2089
+ }
1837
2090
  var isGroupOf;
1838
2091
  overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
1839
2092
  overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
@@ -1994,6 +2247,9 @@ var Ribbon = /** @class */ (function (_super) {
1994
2247
  case 'ComboBox':
1995
2248
  this.ribbonComboBoxModule.removeOverFlowEvents(item, itemEle);
1996
2249
  break;
2250
+ case 'Gallery':
2251
+ this.ribbonGalleryModule.removeOverFlowEvents(item, itemEle);
2252
+ break;
1997
2253
  case 'GroupButton':
1998
2254
  this.ribbonGroupButtonModule.removeOverFlowEvents(item, itemEle);
1999
2255
  break;
@@ -2031,6 +2287,10 @@ var Ribbon = /** @class */ (function (_super) {
2031
2287
  this.collapseButton.classList.add(constants.RIBBON_EXPAND_BUTTON);
2032
2288
  }
2033
2289
  this.tabObj.element.appendChild(this.collapseButton);
2290
+ if (this.layoutSwitcherKeyTip) {
2291
+ this.keyTipElements['collapse'] = [];
2292
+ this.keyTipElements['collapse'].push({ id: this.collapseButton.id, type: 'collapse', keyTip: this.layoutSwitcherKeyTip });
2293
+ }
2034
2294
  };
2035
2295
  Ribbon.prototype.removeExpandCollapse = function () {
2036
2296
  var _this = this;
@@ -2133,22 +2393,22 @@ var Ribbon = /** @class */ (function (_super) {
2133
2393
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + constants.CONTENT_ID);
2134
2394
  var tabContent = activeContent.closest('.' + constants.TAB_CONTENT);
2135
2395
  if (this.activeLayout === 'Simplified') {
2136
- for (var i_3 = 0; i_3 < groupList.length; i_3++) {
2137
- var group = groupList[parseInt(i_3.toString(), 10)];
2138
- var alignType = groupList[parseInt(i_3.toString(), 10)].orientation;
2396
+ for (var i_4 = 0; i_4 < groupList.length; i_4++) {
2397
+ var group = groupList[parseInt(i_4.toString(), 10)];
2398
+ var alignType = groupList[parseInt(i_4.toString(), 10)].orientation;
2139
2399
  if (group.isCollapsed) {
2140
2400
  group.setProperties({ isCollapsed: false }, true);
2141
2401
  this.removeDropdown(group.id);
2142
2402
  }
2143
2403
  else {
2144
- this.checkSmallToMedium(tabIndex, tab, i_3, tabContent, activeContent, true, false);
2145
- this.checkMediumToLarge(tabIndex, tab, i_3, tabContent, activeContent, true, false);
2404
+ this.checkSmallToMedium(tabIndex, tab, i_4, tabContent, activeContent, true, false);
2405
+ this.checkMediumToLarge(tabIndex, tab, i_4, tabContent, activeContent, true, false);
2146
2406
  }
2147
2407
  var groupEle = tabContent.querySelector('#' + group.id);
2148
2408
  var groupContainer = groupEle.querySelector('#' + group.id + constants.CONTAINER_ID);
2149
2409
  var shrinkColumns = groupContainer.querySelectorAll('.' + 'e-ribbon-shrink');
2150
- for (var i_4 = 0; i_4 < shrinkColumns.length; i_4++) {
2151
- shrinkColumns[parseInt(i_4.toString(), 10)].remove();
2410
+ for (var i_5 = 0; i_5 < shrinkColumns.length; i_5++) {
2411
+ shrinkColumns[parseInt(i_5.toString(), 10)].remove();
2152
2412
  }
2153
2413
  var groupHeader = groupContainer.querySelector('#' + group.id + constants.HEADER_ID);
2154
2414
  groupHeader.remove();
@@ -2194,7 +2454,7 @@ var Ribbon = /** @class */ (function (_super) {
2194
2454
  itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
2195
2455
  if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
2196
2456
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
2197
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
2457
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
2198
2458
  this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
2199
2459
  }
2200
2460
  }
@@ -2207,6 +2467,9 @@ var Ribbon = /** @class */ (function (_super) {
2207
2467
  this.setItemSize(ele, item);
2208
2468
  }
2209
2469
  }
2470
+ if (item.type === RibbonItemType.Gallery) {
2471
+ this.ribbonGalleryModule.switchGalleryItems(this.activeLayout, item.id);
2472
+ }
2210
2473
  }
2211
2474
  }
2212
2475
  if (!(group.enableGroupOverflow || groupEle.querySelector('.' + constants.RIBBON_ITEM))) {
@@ -2216,9 +2479,9 @@ var Ribbon = /** @class */ (function (_super) {
2216
2479
  }
2217
2480
  else {
2218
2481
  this.element.classList.remove(constants.RIBBON_OVERFLOW);
2219
- for (var i_5 = 0; i_5 < groupList.length; i_5++) {
2220
- var group = groupList[parseInt(i_5.toString(), 10)];
2221
- var alignType = groupList[parseInt(i_5.toString(), 10)].orientation;
2482
+ for (var i_6 = 0; i_6 < groupList.length; i_6++) {
2483
+ var group = groupList[parseInt(i_6.toString(), 10)];
2484
+ var alignType = groupList[parseInt(i_6.toString(), 10)].orientation;
2222
2485
  var groupContainer = tabContent.querySelector('#' + group.id + constants.CONTAINER_ID);
2223
2486
  var groupContent = groupContainer.querySelector('#' + group.id + constants.CONTENT_ID);
2224
2487
  var groupHeader = this.createElement('div', {
@@ -2290,7 +2553,7 @@ var Ribbon = /** @class */ (function (_super) {
2290
2553
  var itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
2291
2554
  if (!itemEle && overflowtarget) {
2292
2555
  itemEle = overflowtarget.querySelector('#' + item.id + constants.CONTAINER_ID);
2293
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
2556
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
2294
2557
  this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
2295
2558
  }
2296
2559
  this.removeOverflowEvent(item, itemEle);
@@ -2310,6 +2573,9 @@ var Ribbon = /** @class */ (function (_super) {
2310
2573
  (item.allowedSizes & RibbonItemSize.Medium) ? RibbonItemSize.Medium : RibbonItemSize.Small;
2311
2574
  item.setProperties({ activeSize: itemsize }, true);
2312
2575
  this.setItemSize(ele, item);
2576
+ if (item.type === RibbonItemType.Gallery) {
2577
+ this.ribbonGalleryModule.switchGalleryItems(this.activeLayout, item.id);
2578
+ }
2313
2579
  }
2314
2580
  if (group.enableGroupOverflow && overflowDDB) {
2315
2581
  if (overflowtarget.childElementCount === 0 || (overflowtarget.childElementCount === 1 && this.isHeaderVisible(overflowtarget, group.id))) {
@@ -2329,7 +2595,7 @@ var Ribbon = /** @class */ (function (_super) {
2329
2595
  this.overflowDDB = null;
2330
2596
  }
2331
2597
  };
2332
- Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
2598
+ Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer, tabIndex) {
2333
2599
  var _this = this;
2334
2600
  var launcherIcon = this.createElement('div', {
2335
2601
  className: constants.RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : constants.RIBBON_LAUNCHER_ICON),
@@ -2344,6 +2610,10 @@ var Ribbon = /** @class */ (function (_super) {
2344
2610
  _this.launcherIconClicked(groupId);
2345
2611
  }
2346
2612
  }, this);
2613
+ var itemProp = getGroup(this.tabs, groupId);
2614
+ if (itemProp.group.launcherIconKeyTip) {
2615
+ this.addKeyTip(tabIndex, itemProp.group.launcherIconKeyTip, launcherIcon.id, 'launcher');
2616
+ }
2347
2617
  };
2348
2618
  Ribbon.prototype.launcherIconClicked = function (id) {
2349
2619
  var eventArgs = { groupId: id };
@@ -2381,7 +2651,7 @@ var Ribbon = /** @class */ (function (_super) {
2381
2651
  groupContainer.appendChild(groupHeader);
2382
2652
  }
2383
2653
  if (group.showLauncherIcon) {
2384
- this.createLauncherIcon(group.id, groupContainer);
2654
+ this.createLauncherIcon(group.id, groupContainer, tabIndex);
2385
2655
  }
2386
2656
  var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
2387
2657
  append(elements, groupContent);
@@ -2508,6 +2778,9 @@ var Ribbon = /** @class */ (function (_super) {
2508
2778
  case 'GroupButton':
2509
2779
  this.ribbonGroupButtonModule.createGroupButton(item, itemEle);
2510
2780
  break;
2781
+ case 'Gallery':
2782
+ this.ribbonGalleryModule.createGallery(item, itemEle);
2783
+ break;
2511
2784
  }
2512
2785
  };
2513
2786
  Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
@@ -2541,17 +2814,34 @@ var Ribbon = /** @class */ (function (_super) {
2541
2814
  itemEle.classList.add(constants.RIBBON_TOOLTIP_TARGET);
2542
2815
  this.tooltipData.push({ id: itemEle.id, data: item.ribbonTooltipSettings });
2543
2816
  }
2544
- var size = item.activeSize;
2545
- if (this.activeLayout === 'Simplified') {
2546
- size = ((item.allowedSizes === RibbonItemSize.Large) || (item.allowedSizes & RibbonItemSize.Medium) ||
2547
- (item.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
2548
- item.setProperties({ activeSize: size }, true);
2817
+ if (item.type === RibbonItemType.GroupButton) {
2818
+ for (var i_7 = 0; i_7 < item.groupButtonSettings.items.length; i_7++) {
2819
+ if (this.keyTipElements[parseInt(tabIndex.toString(), 10)] && item.groupButtonSettings.items[parseInt(i_7.toString(), 10)].keyTip) {
2820
+ this.addKeyTip(tabIndex, item.groupButtonSettings.items[parseInt(i_7.toString(), 10)].keyTip, item.id + (constants.RIBBON_GROUP_BUTTON_ID + i_7), 'item');
2821
+ }
2822
+ }
2549
2823
  }
2550
- if (size & RibbonItemSize.Large) {
2551
- itemEle.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
2824
+ if (item.keyTip) {
2825
+ if (item.type === RibbonItemType.Gallery) {
2826
+ this.addKeyTip(tabIndex, item.keyTip, (item.id + '_popupButton'), 'item');
2827
+ }
2828
+ else {
2829
+ this.addKeyTip(tabIndex, item.keyTip, item.id, 'item');
2830
+ }
2552
2831
  }
2553
- else {
2554
- itemEle.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
2832
+ var size = item.activeSize;
2833
+ if (!(item.type === RibbonItemType.Gallery)) {
2834
+ if (this.activeLayout === 'Simplified') {
2835
+ size = ((item.allowedSizes === RibbonItemSize.Large) || (item.allowedSizes & RibbonItemSize.Medium) ||
2836
+ (item.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
2837
+ item.setProperties({ activeSize: size }, true);
2838
+ }
2839
+ if (size & RibbonItemSize.Large) {
2840
+ itemEle.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
2841
+ }
2842
+ else {
2843
+ itemEle.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
2844
+ }
2555
2845
  }
2556
2846
  var initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
2557
2847
  if (initialProps && initialProps.hiddenItems && initialProps.hiddenItems.length) {
@@ -2563,7 +2853,7 @@ var Ribbon = /** @class */ (function (_super) {
2563
2853
  this.createRibbonItem(item, itemEle);
2564
2854
  if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
2565
2855
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
2566
- if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
2856
+ if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
2567
2857
  this.updatePopupItems(item, itemEle, isGroupOF, true);
2568
2858
  }
2569
2859
  }
@@ -2692,15 +2982,15 @@ var Ribbon = /** @class */ (function (_super) {
2692
2982
  var moduleName = this.getItemModuleName(item);
2693
2983
  if (moduleName !== 'template') {
2694
2984
  if (moduleName === 'group-btn' && this.activeLayout === 'Classic') {
2695
- for (var i_6 = 0; i_6 < item.groupButtonSettings.items.length; i_6++) {
2696
- var btnEle = ele.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_6);
2985
+ for (var i_8 = 0; i_8 < item.groupButtonSettings.items.length; i_8++) {
2986
+ var btnEle = ele.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_8);
2697
2987
  updateCommonProperty(btnEle, 'btn', commonProp);
2698
2988
  }
2699
2989
  }
2700
2990
  else if (moduleName === 'group-btn' && this.activeLayout === 'Simplified') {
2701
2991
  updateCommonProperty(ele, 'dropdown-btn', commonProp);
2702
- for (var i_7 = 0; i_7 < item.groupButtonSettings.items.length; i_7++) {
2703
- var btnEle = document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_7);
2992
+ for (var i_9 = 0; i_9 < item.groupButtonSettings.items.length; i_9++) {
2993
+ var btnEle = document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_9);
2704
2994
  updateCommonProperty(btnEle, 'btn', commonProp);
2705
2995
  }
2706
2996
  }
@@ -2760,12 +3050,18 @@ var Ribbon = /** @class */ (function (_super) {
2760
3050
  ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id + constants.RIBBON_GROUP_BUTTON_ID) :
2761
3051
  contentEle.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID);
2762
3052
  }
3053
+ if (item.type === RibbonItemType.Gallery) {
3054
+ ele = contentEle.querySelector('#' + item.id + constants.CONTAINER_ID);
3055
+ }
2763
3056
  }
2764
3057
  }
2765
3058
  else {
2766
3059
  //Checks for Simplified and Auto options (Auto = classic + simplified + popup)
2767
3060
  ele = (item.displayOptions & DisplayMode.Simplified) ?
2768
3061
  contentEle.querySelector('#' + item.id) : null;
3062
+ if (item.type === RibbonItemType.Gallery) {
3063
+ ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id + constants.CONTAINER_ID) : null;
3064
+ }
2769
3065
  // element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
2770
3066
  if (!ele) {
2771
3067
  ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
@@ -2806,18 +3102,42 @@ var Ribbon = /** @class */ (function (_super) {
2806
3102
  else {
2807
3103
  this.ribbonGroupButtonModule.destroyDropDown(item);
2808
3104
  }
2809
- var _loop_3 = function (i) {
3105
+ var _loop_4 = function (i) {
2810
3106
  if (item.groupButtonSettings.items[parseInt(i.toString(), 10)].ribbonTooltipSettings) {
2811
3107
  var groupButtonID_1 = item.id + constants.RIBBON_GROUP_BUTTON_ID + i;
2812
- var index = getIndex(this_3.tooltipData, function (e) { return e.id === groupButtonID_1; });
3108
+ var index = getIndex(this_4.tooltipData, function (e) { return e.id === groupButtonID_1; });
2813
3109
  if (index !== -1) {
2814
- this_3.tooltipData.splice(index, 1);
3110
+ this_4.tooltipData.splice(index, 1);
2815
3111
  }
2816
3112
  }
2817
3113
  };
2818
- var this_3 = this;
3114
+ var this_4 = this;
2819
3115
  for (var i = 0; i < item.groupButtonSettings.items.length; i++) {
2820
- _loop_3(i);
3116
+ _loop_4(i);
3117
+ }
3118
+ }
3119
+ else if (moduleName === 'gallery') {
3120
+ if (ele.closest('.e-ribbon-overflow-target')) {
3121
+ destroyControl(ele, 'dropdown-btn');
3122
+ var galleryPopupEle = Array.prototype.slice.call(document.querySelectorAll('#' + item.id + '_galleryPopup'));
3123
+ galleryPopupEle.concat(Array.prototype.slice.call(document.querySelectorAll('#' + item.id + '-popup')));
3124
+ for (var i = 0; i < galleryPopupEle.length; i++) {
3125
+ galleryPopupEle[parseInt(i.toString(), 10)].remove();
3126
+ }
3127
+ }
3128
+ else {
3129
+ var galleryEle = ele.querySelectorAll('.e-ribbon-gallery-item');
3130
+ var galleryPopupBtn = ele.querySelector('#' + item.id + '_popupButton');
3131
+ if (galleryPopupBtn) {
3132
+ galleryPopupBtn.remove();
3133
+ }
3134
+ for (var i = 0; i < galleryEle.length; i++) {
3135
+ galleryEle[parseInt(i.toString(), 10)].remove();
3136
+ }
3137
+ var galleryPopupEle = document.querySelectorAll('#' + item.id + '_galleryPopup');
3138
+ for (var i = 0; i < galleryPopupEle.length; i++) {
3139
+ galleryPopupEle[parseInt(i.toString(), 10)].remove();
3140
+ }
2821
3141
  }
2822
3142
  }
2823
3143
  else if (moduleName !== 'template') {
@@ -2833,6 +3153,13 @@ var Ribbon = /** @class */ (function (_super) {
2833
3153
  this.ribbonGroupButtonModule.destroyDropDown(item);
2834
3154
  }
2835
3155
  };
3156
+ /**
3157
+ * Gets the item module name.
3158
+ *
3159
+ * @param {RibbonItemModel} item - Gets the ribbon item model.
3160
+ * @returns {void}
3161
+ * @hidden
3162
+ */
2836
3163
  Ribbon.prototype.getItemModuleName = function (item) {
2837
3164
  switch (item.type) {
2838
3165
  case 'Button':
@@ -2849,6 +3176,8 @@ var Ribbon = /** @class */ (function (_super) {
2849
3176
  return 'combobox';
2850
3177
  case 'GroupButton':
2851
3178
  return 'group-btn';
3179
+ case 'Gallery':
3180
+ return 'gallery';
2852
3181
  default:
2853
3182
  return 'template';
2854
3183
  }
@@ -2888,8 +3217,9 @@ var Ribbon = /** @class */ (function (_super) {
2888
3217
  * @param {string} tabId - The ID of the tab to be shown.
2889
3218
  * @returns {void}
2890
3219
  */
2891
- Ribbon.prototype.showTab = function (tabId) {
2892
- this.showHideTab(tabId, false);
3220
+ Ribbon.prototype.showTab = function (tabId, isContextual) {
3221
+ if (isContextual === void 0) { isContextual = false; }
3222
+ this.showHideTab(tabId, false, isContextual);
2893
3223
  };
2894
3224
  /**
2895
3225
  * Hides a specific tab in the ribbon.
@@ -2897,15 +3227,49 @@ var Ribbon = /** @class */ (function (_super) {
2897
3227
  * @param {string} tabId - The ID of the tab to be hidden.
2898
3228
  * @returns {void}
2899
3229
  */
2900
- Ribbon.prototype.hideTab = function (tabId) {
2901
- this.showHideTab(tabId, true);
3230
+ Ribbon.prototype.hideTab = function (tabId, isContextual) {
3231
+ if (isContextual === void 0) { isContextual = false; }
3232
+ this.showHideTab(tabId, true, isContextual);
2902
3233
  };
2903
- Ribbon.prototype.showHideTab = function (tabId, value) {
3234
+ Ribbon.prototype.showHideTab = function (tabId, value, isContextual) {
2904
3235
  var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
2905
3236
  if (index === -1) {
2906
3237
  return;
2907
3238
  }
2908
3239
  this.tabObj.hideTab(index, value);
3240
+ if (isContextual) {
3241
+ var contextualTab_1;
3242
+ var tabEle = this.tabObj.element;
3243
+ for (var i = 0; i < this.contextualTabs.length; i++) {
3244
+ for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
3245
+ if (tabId === this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id) {
3246
+ contextualTab_1 = this.contextualTabs[parseInt(i.toString(), 10)];
3247
+ }
3248
+ }
3249
+ }
3250
+ if (contextualTab_1) {
3251
+ var isTabHidden = true;
3252
+ var _loop_5 = function (i) {
3253
+ var index_1 = getIndex(this_5.tabs, function (e) { return e.id === contextualTab_1.tabs[parseInt(i.toString(), 10)].id; });
3254
+ if (index_1 !== -1) {
3255
+ var toolbarEle = tabEle.querySelectorAll('.e-toolbar-item')[parseInt(index_1.toString(), 10)];
3256
+ if (!(toolbarEle.classList.contains('e-hidden'))) {
3257
+ isTabHidden = false;
3258
+ }
3259
+ }
3260
+ };
3261
+ var this_5 = this;
3262
+ for (var i = 0; i < contextualTab_1.tabs.length; i++) {
3263
+ _loop_5(i);
3264
+ }
3265
+ if (isTabHidden) {
3266
+ contextualTab_1.setProperties({ visible: false }, true);
3267
+ }
3268
+ else {
3269
+ contextualTab_1.setProperties({ visible: true }, true);
3270
+ }
3271
+ }
3272
+ }
2909
3273
  };
2910
3274
  /**
2911
3275
  * Enables a specific tab in the ribbon.
@@ -3212,8 +3576,8 @@ var Ribbon = /** @class */ (function (_super) {
3212
3576
  var hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
3213
3577
  /* eslint-disable */
3214
3578
  if (hiddenProps && hiddenProps[key] && hiddenProps[key].length) {
3215
- var _loop_4 = function (i) {
3216
- var contentEle = this_4.tabObj.items[tabIndex].content;
3579
+ var _loop_6 = function (i) {
3580
+ var contentEle = this_6.tabObj.items[tabIndex].content;
3217
3581
  var hiddenEle;
3218
3582
  var groupEle = void 0;
3219
3583
  var isGroupHidden = false;
@@ -3235,11 +3599,11 @@ var Ribbon = /** @class */ (function (_super) {
3235
3599
  groupEle = hiddenEle.closest('.e-ribbon-group');
3236
3600
  if (groupEle.classList.contains('e-hide-group')) {
3237
3601
  isGroupHidden = true;
3238
- widthDifference = this_4.checkWidthDifference(hiddenEle, groupEle);
3602
+ widthDifference = this_6.checkWidthDifference(hiddenEle, groupEle);
3239
3603
  }
3240
3604
  }
3241
- this_4.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, true, tabIndex);
3242
- this_4.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, true);
3605
+ this_6.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, true, tabIndex);
3606
+ this_6.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, true);
3243
3607
  if (isHidden) {
3244
3608
  hiddenEle.classList.add('e-hidden');
3245
3609
  }
@@ -3252,12 +3616,12 @@ var Ribbon = /** @class */ (function (_super) {
3252
3616
  groupEle.classList.remove('e-hide-group');
3253
3617
  groupEle.classList.remove('e-ribbon-emptyCollection');
3254
3618
  widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
3255
- if (this_4.hiddenGroups.indexOf(groupEle.id) !== -1) {
3256
- this_4.hiddenGroups.splice(this_4.hiddenGroups.indexOf(groupEle.id), 1);
3619
+ if (this_6.hiddenGroups.indexOf(groupEle.id) !== -1) {
3620
+ this_6.hiddenGroups.splice(this_6.hiddenGroups.indexOf(groupEle.id), 1);
3257
3621
  }
3258
3622
  }
3259
3623
  else {
3260
- if (this_4.hiddenGroups.indexOf(groupEle.id) !== -1) {
3624
+ if (this_6.hiddenGroups.indexOf(groupEle.id) !== -1) {
3261
3625
  var hiddenItems = groupEle.querySelectorAll('.e-ribbon-item:not(.e-hidden)');
3262
3626
  hiddenItems.forEach(function (item) {
3263
3627
  if (item.id !== hiddenEle.id) {
@@ -3270,12 +3634,12 @@ var Ribbon = /** @class */ (function (_super) {
3270
3634
  item.classList.remove('e-hidden');
3271
3635
  }
3272
3636
  });
3273
- this_4.hiddenGroups.splice(this_4.hiddenGroups.indexOf(groupEle.id), 1);
3637
+ this_6.hiddenGroups.splice(this_6.hiddenGroups.indexOf(groupEle.id), 1);
3274
3638
  }
3275
3639
  }
3276
3640
  }
3277
- this_4.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, false, tabIndex);
3278
- this_4.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, false);
3641
+ this_6.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, false, tabIndex);
3642
+ this_6.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, false);
3279
3643
  }
3280
3644
  if (isGroupHidden) {
3281
3645
  groupEle.classList.add('e-hide-group');
@@ -3289,9 +3653,9 @@ var Ribbon = /** @class */ (function (_super) {
3289
3653
  }
3290
3654
  out_i_1 = i;
3291
3655
  };
3292
- var this_4 = this, out_i_1;
3656
+ var this_6 = this, out_i_1;
3293
3657
  for (var i = 0; i < hiddenProps[key].length; i++) {
3294
- _loop_4(i);
3658
+ _loop_6(i);
3295
3659
  i = out_i_1;
3296
3660
  }
3297
3661
  }
@@ -3342,9 +3706,9 @@ var Ribbon = /** @class */ (function (_super) {
3342
3706
  var overflowButton = getInstance(groupOFButton[parseInt(i.toString(), 10)], DropDownButton);
3343
3707
  var overflowBtnTarget = overflowButton.target;
3344
3708
  var overflowItems = overflowBtnTarget.querySelectorAll('.e-ribbon-item');
3345
- for (var i_8 = 0; i_8 < overflowItems.length; i_8++) {
3346
- if (overflowItems[parseInt(i_8.toString(), 10)].hasAttribute('data-medium-width')) {
3347
- mediumDataItems.push(overflowItems[parseInt(i_8.toString(), 10)]);
3709
+ for (var i_10 = 0; i_10 < overflowItems.length; i_10++) {
3710
+ if (overflowItems[parseInt(i_10.toString(), 10)].hasAttribute('data-medium-width')) {
3711
+ mediumDataItems.push(overflowItems[parseInt(i_10.toString(), 10)]);
3348
3712
  }
3349
3713
  }
3350
3714
  }
@@ -3371,10 +3735,10 @@ var Ribbon = /** @class */ (function (_super) {
3371
3735
  if (overflowButton) {
3372
3736
  var overflowEle = overflowButton.target;
3373
3737
  var overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
3374
- for (var i_9 = 0; i_9 < overflowItems.length; i_9++) {
3375
- var previousWidth = parseInt(overflowItems[parseInt(i_9.toString(), 10)].getAttribute('data-simplified-width'), 10);
3738
+ for (var i_11 = 0; i_11 < overflowItems.length; i_11++) {
3739
+ var previousWidth = parseInt(overflowItems[parseInt(i_11.toString(), 10)].getAttribute('data-simplified-width'), 10);
3376
3740
  if (previousWidth) {
3377
- overflowItems[parseInt(i_9.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
3741
+ overflowItems[parseInt(i_11.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
3378
3742
  }
3379
3743
  }
3380
3744
  }
@@ -3924,7 +4288,7 @@ var Ribbon = /** @class */ (function (_super) {
3924
4288
  if (contentEle.innerHTML !== '') {
3925
4289
  // Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
3926
4290
  if (group.showLauncherIcon) {
3927
- this.createLauncherIcon(ribbongroup.id, groupContainer);
4291
+ this.createLauncherIcon(ribbongroup.id, groupContainer, itemProp.tabIndex);
3928
4292
  }
3929
4293
  // Check whether collections or orientation is passed by the user and sets the updated values.
3930
4294
  if (group.collections || group.orientation) {
@@ -4044,96 +4408,111 @@ var Ribbon = /** @class */ (function (_super) {
4044
4408
  //Check whether the tab items are rendered
4045
4409
  var contentEle = this.tabObj.items[itemProp.tabIndex].content;
4046
4410
  var groupEle = contentEle.querySelector('#' + itemProp.group.id);
4047
- var groupContainer = groupEle.querySelector('#' + itemProp.group.id + constants.CONTAINER_ID);
4048
- var itemContainer = null;
4049
- var itemEle = null;
4050
- var dropdownElement;
4051
- var dropdown;
4052
- if (contentEle.innerHTML !== '') {
4053
- if (this.activeLayout === RibbonLayout.Simplified) {
4054
- dropdownElement = itemProp.group.enableGroupOverflow ?
4055
- contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) : null;
4056
- dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
4057
- }
4058
- if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
4059
- itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
4060
- itemEle = dropdown.target.querySelector('#' + itemId);
4061
- if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
4062
- var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
4063
- if (collectionEle) {
4064
- collectionEle.appendChild(itemContainer);
4411
+ if (groupEle) {
4412
+ var groupContainer = groupEle.querySelector('#' + itemProp.group.id + constants.CONTAINER_ID);
4413
+ var itemContainer = null;
4414
+ var itemEle = null;
4415
+ var dropdownElement = void 0;
4416
+ var dropdown = void 0;
4417
+ if (contentEle.innerHTML !== '') {
4418
+ if (this.activeLayout === RibbonLayout.Simplified) {
4419
+ dropdownElement = itemProp.group.enableGroupOverflow ?
4420
+ contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) : null;
4421
+ dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
4422
+ }
4423
+ if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
4424
+ itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
4425
+ itemEle = dropdown.target.querySelector('#' + itemId);
4426
+ if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
4427
+ var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
4428
+ if (collectionEle) {
4429
+ collectionEle.appendChild(itemContainer);
4430
+ }
4065
4431
  }
4066
4432
  }
4067
- }
4068
- else {
4069
- itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
4070
- itemEle = contentEle.querySelector('#' + itemId);
4071
- if (itemProp.item.type === 'GroupButton' && this.activeLayout === RibbonLayout.Classic) {
4072
- itemEle = contentEle.querySelector('#' + itemId + constants.RIBBON_GROUP_BUTTON_ID);
4073
- }
4074
- if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
4075
- this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
4076
- if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
4077
- this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
4433
+ else {
4434
+ itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
4435
+ itemEle = contentEle.querySelector('#' + itemId);
4436
+ if (itemProp.item.type === 'GroupButton' && this.activeLayout === RibbonLayout.Classic) {
4437
+ itemEle = contentEle.querySelector('#' + itemId + constants.RIBBON_GROUP_BUTTON_ID);
4438
+ }
4439
+ if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
4440
+ this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
4441
+ if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) ||
4442
+ (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
4443
+ this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
4444
+ }
4078
4445
  }
4079
4446
  }
4080
- }
4081
- // Check whether cssClass is passed by the user, and if it is, then remove the old values.
4082
- if (item.cssClass) {
4083
- if (itemProp.item.cssClass) {
4084
- itemContainer.classList.remove(itemProp.item.cssClass);
4447
+ // Check whether cssClass is passed by the user, and if it is, then remove the old values.
4448
+ if (item.cssClass) {
4449
+ if (itemProp.item.cssClass) {
4450
+ itemContainer.classList.remove(itemProp.item.cssClass);
4451
+ }
4085
4452
  }
4086
- }
4087
- this.destroyFunction(itemProp.item, itemEle);
4088
- itemEle.remove();
4089
- var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
4090
- if (removeCss) {
4091
- removeClass([itemContainer], removeCss);
4092
- }
4093
- }
4094
- var ribbonItem = itemProp.item;
4095
- ribbonItem.setProperties(item, true);
4096
- this.validateItemSize();
4097
- if (contentEle.innerHTML !== '') {
4098
- if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
4099
- itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
4100
- }
4101
- else {
4102
- itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
4103
- }
4104
- // To avoid undefined items condition is added
4105
- if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
4106
- itemContainer.classList.add(constants.RIBBON_TOOLTIP_TARGET);
4107
- this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
4108
- }
4109
- var size = ribbonItem.activeSize;
4110
- if (this.activeLayout === 'Simplified') {
4111
- size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
4112
- (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
4113
- ribbonItem.setProperties({ activeSize: size }, true);
4114
- }
4115
- if (size & RibbonItemSize.Large) {
4116
- itemContainer.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
4117
- }
4118
- else {
4119
- itemContainer.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
4120
- }
4121
- this.createRibbonItem(ribbonItem, itemContainer);
4122
- if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
4123
- if (dropdown.target.childElementCount === 0 || (dropdown.target.childElementCount === 1 && this.isHeaderVisible(dropdown.target, itemProp.group.id))) {
4124
- this.removeOverflowButton(dropdown);
4453
+ this.destroyFunction(itemProp.item, itemEle);
4454
+ itemEle.remove();
4455
+ var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
4456
+ if (removeCss) {
4457
+ removeClass([itemContainer], removeCss);
4125
4458
  }
4126
4459
  }
4127
- if (this.selectedTab === itemProp.tabIndex) {
4128
- this.refreshLayout();
4129
- }
4130
- if (item.cssClass) {
4131
- itemContainer.classList.add(ribbonItem.cssClass);
4132
- }
4133
- if (!(ribbonItem.disabled) && itemContainer.classList.contains(constants.DISABLED_CSS)) {
4134
- itemContainer.classList.remove(constants.DISABLED_CSS);
4460
+ var ribbonItem = itemProp.item;
4461
+ ribbonItem.setProperties(item, true);
4462
+ this.validateItemSize();
4463
+ if (contentEle.innerHTML !== '') {
4464
+ if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
4465
+ itemContainer = groupContainer.querySelector('#' + itemId + constants.CONTAINER_ID);
4466
+ }
4467
+ else {
4468
+ itemContainer = dropdown.target.querySelector('#' + itemId + constants.CONTAINER_ID);
4469
+ }
4470
+ // To avoid undefined items condition is added
4471
+ if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
4472
+ itemContainer.classList.add(constants.RIBBON_TOOLTIP_TARGET);
4473
+ this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
4474
+ }
4475
+ var size = ribbonItem.activeSize;
4476
+ if (this.activeLayout === 'Simplified') {
4477
+ size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
4478
+ (ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
4479
+ ribbonItem.setProperties({ activeSize: size }, true);
4480
+ }
4481
+ if (size & RibbonItemSize.Large) {
4482
+ itemContainer.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
4483
+ }
4484
+ else {
4485
+ if (size & RibbonItemSize.Medium) {
4486
+ itemContainer.classList.add(constants.RIBBON_MEDIUM_ITEM);
4487
+ }
4488
+ else {
4489
+ itemContainer.classList.add(constants.RIBBON_SMALL_ITEM);
4490
+ }
4491
+ }
4492
+ this.createRibbonItem(ribbonItem, itemContainer);
4493
+ if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
4494
+ if (dropdown.target.childElementCount === 0 ||
4495
+ (dropdown.target.childElementCount === 1 &&
4496
+ this.isHeaderVisible(dropdown.target, itemProp.group.id))) {
4497
+ this.removeOverflowButton(dropdown);
4498
+ }
4499
+ }
4500
+ if (this.selectedTab === itemProp.tabIndex) {
4501
+ this.refreshLayout();
4502
+ }
4503
+ if (item.cssClass) {
4504
+ itemContainer.classList.add(ribbonItem.cssClass);
4505
+ }
4506
+ if (!(ribbonItem.disabled) && itemContainer.classList.contains(constants.DISABLED_CSS)) {
4507
+ itemContainer.classList.remove(constants.DISABLED_CSS);
4508
+ }
4509
+ this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
4135
4510
  }
4136
- this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
4511
+ }
4512
+ else {
4513
+ this.isUpdateItems = true;
4514
+ this.itemsModel.push(item);
4515
+ this.targetTabs[item.id] = itemProp.tabIndex;
4137
4516
  }
4138
4517
  };
4139
4518
  Ribbon.prototype.removeItemElement = function (contentEle, item, dropdown) {
@@ -4180,6 +4559,15 @@ var Ribbon = /** @class */ (function (_super) {
4180
4559
  Ribbon.prototype.disableItem = function (itemId) {
4181
4560
  this.enableDisableItem(itemId, true);
4182
4561
  };
4562
+ /**
4563
+ * Gets the Ribbon item model associated with the specified item ID.
4564
+ *
4565
+ * @param {string} itemId - The unique ID of the Ribbon item.
4566
+ * @returns {RibbonItemModel}
4567
+ */
4568
+ Ribbon.prototype.getItem = function (itemId) {
4569
+ return getItem(this.tabs, itemId).item;
4570
+ };
4183
4571
  Ribbon.prototype.enableDisableItem = function (itemId, isDisabled) {
4184
4572
  var isUpdated = false;
4185
4573
  var itemProp = getItem(this.tabs, itemId);
@@ -4227,6 +4615,9 @@ var Ribbon = /** @class */ (function (_super) {
4227
4615
  };
4228
4616
  Ribbon.prototype.unwireEvents = function () {
4229
4617
  EventHandler.remove(window, 'resize', this.resizeHandler);
4618
+ EventHandler.remove(document.body, 'keydown', this.keytipActionHandler);
4619
+ EventHandler.remove(document, 'mousedown', this.mouseEventHandler);
4620
+ EventHandler.remove(document, 'scroll', this.mouseEventHandler);
4230
4621
  };
4231
4622
  Ribbon.prototype.destroy = function () {
4232
4623
  this.keyboardModuleRibbon.destroy();
@@ -4254,6 +4645,9 @@ var Ribbon = /** @class */ (function (_super) {
4254
4645
  this.initialPropsData = {};
4255
4646
  this.hiddenGroups = [];
4256
4647
  this.hiddenElements = {};
4648
+ this.keyTipElements = {};
4649
+ this.itemsModel = [];
4650
+ this.targetTabs = {};
4257
4651
  remove(this.element.querySelector('#' + this.element.id + constants.TAB_ID));
4258
4652
  this.element.style.removeProperty(constants.RIBBON_FILE_MENU_WIDTH);
4259
4653
  this.element.style.removeProperty(constants.RIBBON_HELP_PANE_TEMPLATE_WIDTH);
@@ -4333,7 +4727,11 @@ var Ribbon = /** @class */ (function (_super) {
4333
4727
  }
4334
4728
  break;
4335
4729
  case 'selectedTab':
4336
- this.tabObj.setProperties({ selectedItem: newProp.selectedTab });
4730
+ var tabEle = this.tabObj.element;
4731
+ var toolbarItem = tabEle.querySelectorAll('.e-toolbar-item')[parseInt(newProp.selectedTab.toString(), 10)];
4732
+ if (!(toolbarItem.classList.contains('e-hidden') || toolbarItem.classList.contains('e-disable'))) {
4733
+ this.tabObj.setProperties({ selectedItem: newProp.selectedTab });
4734
+ }
4337
4735
  break;
4338
4736
  case 'tabAnimation':
4339
4737
  this.tabObj.setProperties({ animation: newProp.tabAnimation });
@@ -4341,6 +4739,13 @@ var Ribbon = /** @class */ (function (_super) {
4341
4739
  case 'tabs':
4342
4740
  this.reRenderTabs(newProp.tabs);
4343
4741
  break;
4742
+ case 'contextualTabs':
4743
+ for (var i = 0; i < this.contextualTabs.length; i++) {
4744
+ if (newProp.contextualTabs[parseInt(i.toString(), 10)]) {
4745
+ this.ribbonContextualTabModule.updateContextualTabs(newProp.contextualTabs[parseInt(i.toString(), 10)], this.contextualTabs[parseInt(i.toString(), 10)]);
4746
+ }
4747
+ }
4748
+ break;
4344
4749
  case 'width':
4345
4750
  this.element.style.width = formatUnit(newProp.width);
4346
4751
  this.refreshLayout();
@@ -4384,6 +4789,12 @@ var Ribbon = /** @class */ (function (_super) {
4384
4789
  __decorate([
4385
4790
  Property('')
4386
4791
  ], Ribbon.prototype, "cssClass", void 0);
4792
+ __decorate([
4793
+ Property(false)
4794
+ ], Ribbon.prototype, "enableKeyTips", void 0);
4795
+ __decorate([
4796
+ Property('')
4797
+ ], Ribbon.prototype, "layoutSwitcherKeyTip", void 0);
4387
4798
  __decorate([
4388
4799
  Complex({}, FileMenuSettings)
4389
4800
  ], Ribbon.prototype, "fileMenu", void 0);
@@ -4408,6 +4819,9 @@ var Ribbon = /** @class */ (function (_super) {
4408
4819
  __decorate([
4409
4820
  Collection([], RibbonTab)
4410
4821
  ], Ribbon.prototype, "tabs", void 0);
4822
+ __decorate([
4823
+ Collection([], RibbonContextualTabSettings)
4824
+ ], Ribbon.prototype, "contextualTabs", void 0);
4411
4825
  __decorate([
4412
4826
  Property('100%')
4413
4827
  ], Ribbon.prototype, "width", void 0);