@syncfusion/ej2-ribbon 24.2.8 → 25.1.35

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 +5 -9
  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 +2051 -137
  6. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  7. package/dist/es6/ej2-ribbon.es5.js +2180 -146
  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 +67 -5
  20. package/src/ribbon/base/ribbon.js +457 -76
  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 +390 -16
  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 +79 -4
  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 +390 -16
  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
@@ -57,6 +57,7 @@ var RibbonFileMenu = /** @class */ (function () {
57
57
  }
58
58
  this.parent.tabObj.refreshActiveTabBorder();
59
59
  this.addFileMenuTooltip(fileMenuOptions);
60
+ this.addFileMenuKeytip();
60
61
  };
61
62
  RibbonFileMenu.prototype.addFileMenuTooltip = function (fileMenuOptions) {
62
63
  if (isTooltipPresent(fileMenuOptions.ribbonTooltipSettings)) {
@@ -64,6 +65,12 @@ var RibbonFileMenu = /** @class */ (function () {
64
65
  this.parent.tooltipData.push({ id: this.ddbElement.id, data: fileMenuOptions.ribbonTooltipSettings });
65
66
  }
66
67
  };
68
+ RibbonFileMenu.prototype.addFileMenuKeytip = function () {
69
+ if (this.parent.fileMenu.keyTip) {
70
+ this.parent.keyTipElements['filemenu'] = [];
71
+ this.parent.keyTipElements['filemenu'].push({ id: this.ddbElement.id, type: 'filemenu', keyTip: this.parent.fileMenu.keyTip });
72
+ }
73
+ };
67
74
  RibbonFileMenu.prototype.ddbBeforeEvent = function (isOpen, args) {
68
75
  //args.event is null when dropdown button is closed using a method call
69
76
  if (!isOpen && args.event && args.event.target.closest('.e-ribbon-menu')) {
@@ -216,7 +223,9 @@ var RibbonFileMenu = /** @class */ (function () {
216
223
  }
217
224
  }
218
225
  this.removeFileMenuTooltip();
226
+ this.removeFileMenuKeytip();
219
227
  this.addFileMenuTooltip(fileMenuOptions);
228
+ this.addFileMenuKeytip();
220
229
  }
221
230
  else {
222
231
  this.createFileMenu(fileMenuOptions);
@@ -235,6 +244,7 @@ var RibbonFileMenu = /** @class */ (function () {
235
244
  };
236
245
  RibbonFileMenu.prototype.destroyDDB = function () {
237
246
  this.removeFileMenuTooltip();
247
+ this.removeFileMenuKeytip();
238
248
  var tabEle = this.parent.tabObj.element;
239
249
  tabEle.style.removeProperty(constants.RIBBON_FILE_MENU_WIDTH);
240
250
  this.destroyMenu();
@@ -251,6 +261,15 @@ var RibbonFileMenu = /** @class */ (function () {
251
261
  this.parent.tooltipData.splice(index, 1);
252
262
  }
253
263
  };
264
+ RibbonFileMenu.prototype.removeFileMenuKeytip = function () {
265
+ var _this = this;
266
+ if (this.parent.keyTipElements['filemenu']) {
267
+ var index = getIndex(this.parent.keyTipElements['filemenu'], function (e) { return e.id === _this.ddbElement.id; });
268
+ if (index !== -1) {
269
+ this.parent.keyTipElements['filemenu'].splice(index, 1);
270
+ }
271
+ }
272
+ };
254
273
  /**
255
274
  * Add items to FileMenu.
256
275
  *
@@ -0,0 +1,54 @@
1
+ import { Ribbon } from '../base';
2
+ /**
3
+ * Defines the keytip of Ribbon.
4
+ */
5
+ export declare class RibbonKeyTip {
6
+ private parent;
7
+ private isKeytipPopupOpen;
8
+ private isKeytipPresent;
9
+ constructor(parent: Ribbon);
10
+ protected getModuleName(): string;
11
+ protected destroy(): void;
12
+ /**
13
+ * Creates the keytips.
14
+ *
15
+ * @param {string} key - get's the keytip type.
16
+ * @returns {void}
17
+ * @hidden
18
+ */
19
+ createKeytip(key?: string): void;
20
+ private calculateItemPosition;
21
+ private createKeyTipElement;
22
+ private calculateKeyTipPosition;
23
+ /**
24
+ * Performs keytip action.
25
+ *
26
+ * @param {string} keyPress - Gets the keytip text.
27
+ * @returns {void}
28
+ * @hidden
29
+ */
30
+ keytipPress(keyPress: string, isMethod?: boolean): void;
31
+ private clickItems;
32
+ private commonItemsKeyTipPress;
33
+ /**
34
+ * Removes the keytip.
35
+ *
36
+ * @param {string} key - Gets the keyboard key element.
37
+ * @returns {void}
38
+ * @hidden
39
+ */
40
+ removeKeytip(key?: string): void;
41
+ /**
42
+ * Shows the Keytip dynamically.
43
+ *
44
+ * @param {string} keyAction - Item for which the tooltip is to be shown.
45
+ * @returns {void}
46
+ */
47
+ showKeyTips(keyAction?: string): void;
48
+ /**
49
+ * Hides the Keytip dynamically.
50
+ *
51
+ * @returns {void}
52
+ */
53
+ hideKeyTips(): void;
54
+ }
@@ -0,0 +1,554 @@
1
+ import { getGroup, getItem } from '../base/utils';
2
+ import { getIndex } from '../base/index';
3
+ import * as constants from '../base/constant';
4
+ import { Popup } from '@syncfusion/ej2-popups';
5
+ import { getInstance, remove } from '@syncfusion/ej2-base';
6
+ import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
7
+ /**
8
+ * Defines the keytip of Ribbon.
9
+ */
10
+ var RibbonKeyTip = /** @class */ (function () {
11
+ function RibbonKeyTip(parent) {
12
+ this.isKeytipPopupOpen = false;
13
+ this.parent = parent;
14
+ }
15
+ RibbonKeyTip.prototype.getModuleName = function () {
16
+ return 'ribbonKeyTip';
17
+ };
18
+ RibbonKeyTip.prototype.destroy = function () {
19
+ this.parent = null;
20
+ };
21
+ /**
22
+ * Creates the keytips.
23
+ *
24
+ * @param {string} key - get's the keytip type.
25
+ * @returns {void}
26
+ * @hidden
27
+ */
28
+ RibbonKeyTip.prototype.createKeytip = function (key) {
29
+ if (this.parent.keyTipElements) {
30
+ var keytipData = void 0;
31
+ if (key === 'tab') {
32
+ for (var i = 0; i < this.parent.tabs.length; i++) {
33
+ if (this.parent.keyTipElements[parseInt(i.toString(), 10)]) {
34
+ // eslint-disable-next-line
35
+ keytipData = this.parent.keyTipElements[i][key];
36
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'tab', 'center', 'bottom', true);
37
+ }
38
+ }
39
+ if (this.parent.keyTipElements['filemenu']) {
40
+ keytipData = this.parent.keyTipElements['filemenu'];
41
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'filemenu');
42
+ }
43
+ if (this.parent.keyTipElements['backstage']) {
44
+ keytipData = this.parent.keyTipElements['backstage'];
45
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'backstage');
46
+ }
47
+ if (this.parent.keyTipElements['collapse']) {
48
+ keytipData = this.parent.keyTipElements['collapse'];
49
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'collapse');
50
+ }
51
+ if (this.parent.keyTipElements['taboverflow']) {
52
+ keytipData = this.parent.keyTipElements['taboverflow'];
53
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'taboverflow');
54
+ }
55
+ }
56
+ else if (key === 'popupitem') {
57
+ if (this.parent.keyTipElements[this.parent.selectedTab]['popupitem']) {
58
+ var popupKeyTipData = this.parent.keyTipElements[this.parent.selectedTab]['popupitem'];
59
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[this.parent.selectedTab]['popupitem']).length; i++) {
60
+ this.createKeyTipElement((popupKeyTipData[parseInt(i.toString(), 10)].id), popupKeyTipData[parseInt(i.toString(), 10)].keyTip, 'popupitem', 'left', 'top', false, true);
61
+ }
62
+ }
63
+ }
64
+ else if (key === 'backstageMenu') {
65
+ if (this.parent.keyTipElements['backstageMenu']) {
66
+ var backstageKeyTipData = this.parent.keyTipElements['backstageMenu'];
67
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements['backstageMenu']).length; i++) {
68
+ this.createKeyTipElement((backstageKeyTipData[parseInt(i.toString(), 10)].id), backstageKeyTipData[parseInt(i.toString(), 10)].keyTip, 'backstageMenu', 'left', 'center');
69
+ }
70
+ }
71
+ }
72
+ else if (key === 'grpoverflowpopup' && this.parent.activeLayout === 'Classic') {
73
+ if (this.parent.keyTipElements[this.parent.selectedTab]['grpoverflowpopup']) {
74
+ this.calculateItemPosition(key);
75
+ }
76
+ if (this.parent.keyTipElements[this.parent.selectedTab]['launcher']) {
77
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[this.parent.selectedTab]['launcher']).length; i++) {
78
+ keytipData = this.parent.keyTipElements[this.parent.selectedTab]['launcher'];
79
+ this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, 'launcher', 'center', 'bottom', false, true);
80
+ }
81
+ }
82
+ }
83
+ else {
84
+ this.calculateItemPosition(key);
85
+ if (this.parent.activeLayout === 'Classic') {
86
+ if (this.parent.keyTipElements[this.parent.selectedTab]['launcher']) {
87
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[this.parent.selectedTab]['launcher']).length; i++) {
88
+ keytipData = this.parent.keyTipElements[this.parent.selectedTab]['launcher'];
89
+ this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, 'launcher');
90
+ }
91
+ }
92
+ if (this.parent.keyTipElements[this.parent.selectedTab]['grpoverflow']) {
93
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[this.parent.selectedTab]['grpoverflow']).length; i++) {
94
+ keytipData = this.parent.keyTipElements[this.parent.selectedTab]['grpoverflow'];
95
+ this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, 'grpoverflow');
96
+ }
97
+ }
98
+ }
99
+ if (this.parent.activeLayout === 'Simplified') {
100
+ if (this.parent.keyTipElements['overflowbtn']) {
101
+ keytipData = this.parent.keyTipElements['overflowbtn'];
102
+ this.createKeyTipElement((keytipData[0].id), keytipData[0].keyTip, 'overflowbtn');
103
+ }
104
+ if (this.parent.keyTipElements[this.parent.selectedTab]['grpofbtn']) {
105
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[this.parent.selectedTab]['grpofbtn']).length; i++) {
106
+ keytipData = this.parent.keyTipElements[this.parent.selectedTab]['grpofbtn'];
107
+ this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, 'grpofbtn');
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ };
114
+ RibbonKeyTip.prototype.calculateItemPosition = function (key, isMethod, keyTip) {
115
+ if (isMethod === void 0) { isMethod = false; }
116
+ var xOffset;
117
+ var yOffset;
118
+ var keytipData;
119
+ /* eslint-disable */
120
+ keytipData = this.parent.keyTipElements[parseInt(this.parent.selectedTab.toString(), 10)][key];
121
+ if (keytipData) {
122
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[parseInt(this.parent.selectedTab.toString(), 10)][key]).length; i++) {
123
+ /* eslint-enable */
124
+ if ((isMethod && (keytipData[parseInt(i.toString(), 10)].keyTip === keyTip)) || !isMethod) {
125
+ var itemID = keytipData[parseInt(i.toString(), 10)].id;
126
+ if (keytipData[parseInt(i.toString(), 10)].id.includes("_grpbtn")) {
127
+ itemID = keytipData[parseInt(i.toString(), 10)].id.replace(/_grpbtn\d+/, '');
128
+ }
129
+ var itemProp = getItem(this.parent.tabs, itemID);
130
+ if (itemProp && itemProp.group.orientation === 'Column' && itemProp.collection.items.length > 1 && this.parent.activeLayout !== 'Simplified') {
131
+ if (itemProp.itemIndex === 0) {
132
+ xOffset = 'center';
133
+ yOffset = 'top';
134
+ }
135
+ else if (itemProp.itemIndex === 1) {
136
+ xOffset = 'center';
137
+ yOffset = 'center';
138
+ }
139
+ else {
140
+ xOffset = 'center';
141
+ yOffset = 'bottom';
142
+ }
143
+ }
144
+ else if (itemProp && itemProp.group.orientation === 'Row' && itemProp.group.collections.length > 1 && this.parent.activeLayout !== 'Simplified') {
145
+ if (itemProp.collectionIndex === 0) {
146
+ xOffset = 'center';
147
+ yOffset = 'top';
148
+ }
149
+ else {
150
+ xOffset = 'center';
151
+ yOffset = 'bottom';
152
+ }
153
+ }
154
+ key === 'item' ? this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, key, xOffset, yOffset) : this.createKeyTipElement((keytipData[parseInt(i.toString(), 10)].id), keytipData[parseInt(i.toString(), 10)].keyTip, key, xOffset, yOffset, false, true);
155
+ }
156
+ }
157
+ }
158
+ };
159
+ RibbonKeyTip.prototype.createKeyTipElement = function (id, keyTip, type, xOffset, yOffset, isTab, isPopUpItem) {
160
+ if (xOffset === void 0) { xOffset = 'center'; }
161
+ if (yOffset === void 0) { yOffset = 'bottom'; }
162
+ if (isTab === void 0) { isTab = false; }
163
+ if (isPopUpItem === void 0) { isPopUpItem = false; }
164
+ var keyEle = document.querySelector('#' + id);
165
+ var isPopUpPresent = false;
166
+ var splitBtnID;
167
+ if (isTab) {
168
+ keyEle = document.querySelector('#' + id + constants.HEADER_ID);
169
+ }
170
+ if (keyEle) {
171
+ if (keyEle.closest('.e-ribbon-group-overflow-ddb')) {
172
+ isPopUpPresent = true;
173
+ }
174
+ if ((isTab && isPopUpItem) && keyEle.closest('.e-toolbar-pop')) {
175
+ isPopUpPresent = true;
176
+ }
177
+ if (keyEle.closest('.e-split-btn-wrapper')) {
178
+ var splitBtn = keyEle.closest('.e-split-btn-wrapper');
179
+ splitBtnID = splitBtn.closest('.e-ribbon-item').id;
180
+ }
181
+ else {
182
+ if (keyEle.closest('.e-colorpicker-wrapper')) {
183
+ keyEle = keyEle.closest('.e-colorpicker-wrapper');
184
+ splitBtnID = keyEle.closest('.e-ribbon-item').id;
185
+ }
186
+ }
187
+ }
188
+ if ((keyEle && keyEle.offsetParent) || (isTab && isPopUpItem)) {
189
+ if ((isPopUpItem && isPopUpPresent) || !isPopUpItem) {
190
+ var keytipElement = this.parent.createElement('div', {
191
+ className: constants.RIBBON_KEYTIP,
192
+ id: id + constants.RIBBON_KEYTIP_ID
193
+ });
194
+ document.body.append(keytipElement);
195
+ var keytipPopup = new Popup(keytipElement, {
196
+ relateTo: '#' + (isTab ? id + constants.HEADER_ID : splitBtnID ? splitBtnID : id),
197
+ content: keyTip,
198
+ collision: { X: 'fit', Y: 'flip' },
199
+ targetType: 'relative',
200
+ position: { X: xOffset, Y: yOffset },
201
+ enableRtl: this.parent.enableRtl
202
+ });
203
+ keytipPopup.show();
204
+ this.calculateKeyTipPosition(keyEle, keytipElement, type, yOffset, (isTab && isPopUpItem));
205
+ this.parent.isKeytipOpen = true;
206
+ }
207
+ }
208
+ };
209
+ RibbonKeyTip.prototype.calculateKeyTipPosition = function (itemEle, keytipElement, type, yOffset, isTabOverflow) {
210
+ if (isTabOverflow === void 0) { isTabOverflow = false; }
211
+ var position = itemEle.getBoundingClientRect();
212
+ if (type === 'backstageMenu') {
213
+ keytipElement.style.top = position.top + ((keytipElement.offsetHeight) / 2) + 'px';
214
+ keytipElement.style.left = position.left + (itemEle.offsetWidth / 5) + 'px';
215
+ }
216
+ else {
217
+ if (type !== 'popupitem') {
218
+ keytipElement.style.left = position.left + (position.width - keytipElement.offsetWidth) / 2 + 'px';
219
+ }
220
+ }
221
+ if (type === 'filemenu' || type === 'backstage') {
222
+ keytipElement.style.top = position.top + ((itemEle.offsetHeight - (itemEle.offsetHeight / 3)) + (keytipElement.offsetHeight / 6)) + 'px';
223
+ }
224
+ else if ((type === 'item' && yOffset === 'top')) {
225
+ keytipElement.style.top = (position.top - (itemEle.offsetHeight) / 2) + 'px';
226
+ }
227
+ };
228
+ /**
229
+ * Performs keytip action.
230
+ *
231
+ * @param {string} keyPress - Gets the keytip text.
232
+ * @returns {void}
233
+ * @hidden
234
+ */
235
+ RibbonKeyTip.prototype.keytipPress = function (keyPress, isMethod) {
236
+ var _this = this;
237
+ if (isMethod === void 0) { isMethod = false; }
238
+ this.isKeytipPresent = false;
239
+ for (var i = 0; ((i < Object.keys(this.parent.keyTipElements).length) && !this.isKeytipPresent); i++) {
240
+ if (this.parent.keyTipElements[parseInt(i.toString(), 10)]) {
241
+ for (var j = 0; ((j < Object.keys(this.parent.keyTipElements[parseInt(i.toString(), 10)]).length) && !this.isKeytipPresent); j++) {
242
+ var keytipData = this.parent.keyTipElements[parseInt(i.toString(), 10)][Object.keys(this.parent.keyTipElements[parseInt(i.toString(), 10)])[parseInt(j.toString(), 10)]];
243
+ for (var k = 0; ((k < keytipData.length) && !this.isKeytipPresent); k++) {
244
+ if (keyPress.toUpperCase() === keytipData[parseInt(k.toString(), 10)].keyTip) {
245
+ var keyTipElement = document.querySelector('#' + keytipData[parseInt(k.toString(), 10)].id + constants.RIBBON_KEYTIP_ID);
246
+ if (keyTipElement || isMethod) {
247
+ this.isKeytipPresent = true;
248
+ this.removeKeytip();
249
+ if (keytipData[parseInt(k.toString(), 10)].type === 'tab') {
250
+ if (i !== this.parent.selectedTab) {
251
+ this.parent.tabObj.select(i);
252
+ setTimeout(function () {
253
+ var tabOverflow = _this.parent.tabObj.element.querySelector('.e-nav-active');
254
+ if (tabOverflow)
255
+ tabOverflow.click();
256
+ _this.createKeytip('item');
257
+ }, 600);
258
+ }
259
+ else {
260
+ this.createKeytip('item');
261
+ }
262
+ }
263
+ else {
264
+ if (keytipData[parseInt(k.toString(), 10)].type === 'item' || keytipData[parseInt(k.toString(), 10)].type === 'grpoverflowpopup' || keytipData[parseInt(k.toString(), 10)].type === 'popupitem') {
265
+ if (document.getElementById(keytipData[parseInt(k.toString(), 10)].id) && document.getElementById(keytipData[parseInt(k.toString(), 10)].id).classList.contains('e-ribbon-group-button')) {
266
+ document.getElementById(keytipData[parseInt(k.toString(), 10)].id).click();
267
+ }
268
+ else {
269
+ var itemProp = void 0;
270
+ if ((keytipData[parseInt(k.toString(), 10)].id).includes("_popupButton")) {
271
+ var galleryID = keytipData[parseInt(k.toString(), 10)].id.replace(/_popupButton/g, '');
272
+ itemProp = getItem(this.parent.tabs, galleryID);
273
+ }
274
+ else {
275
+ itemProp = getItem(this.parent.tabs, keytipData[parseInt(k.toString(), 10)].id);
276
+ }
277
+ if (!isMethod || (isMethod && itemProp.tabIndex === this.parent.selectedTab)) {
278
+ this.clickItems(itemProp, keytipData, k, false, isMethod);
279
+ }
280
+ }
281
+ }
282
+ else if (keytipData[parseInt(k.toString(), 10)].type === 'grpoverflow' || keytipData[parseInt(k.toString(), 10)].type === 'grpofbtn' || keytipData[parseInt(k.toString(), 10)].type === 'launcher') {
283
+ var keyEle = document.querySelector('#' + keytipData[parseInt(k.toString(), 10)].id);
284
+ this.removeKeytip();
285
+ if (keyEle) {
286
+ var groupID = keytipData[parseInt(k.toString(), 10)].id;
287
+ if (isMethod) {
288
+ if (keytipData[parseInt(k.toString(), 10)].id.includes("_launcher") || keytipData[parseInt(k.toString(), 10)].id.includes("_sim_grp_overflow") || keytipData[parseInt(k.toString(), 10)].id.includes("_overflow_dropdown")) {
289
+ groupID = keytipData[parseInt(k.toString(), 10)].id.replace(/_launcher|_sim_grp_overflow|_overflow_dropdown/g, '');
290
+ var itemProp = getGroup(this.parent.tabs, groupID);
291
+ if (itemProp.tabIndex === this.parent.selectedTab) {
292
+ this.clickItems(itemProp, keytipData, k, true, isMethod, keyEle);
293
+ }
294
+ }
295
+ }
296
+ else {
297
+ this.clickItems(null, keytipData, k, true, isMethod, keyEle);
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+ }
307
+ else {
308
+ if (this.parent.keyTipElements) {
309
+ this.commonItemsKeyTipPress(keyPress, Object.keys(this.parent.keyTipElements)[parseInt(i.toString(), 10)], isMethod);
310
+ }
311
+ }
312
+ }
313
+ };
314
+ RibbonKeyTip.prototype.clickItems = function (itemProp, keytipData, k, isGroupItems, isMethod, keyEle) {
315
+ if (isGroupItems) {
316
+ keyEle.click();
317
+ if (!(keytipData[parseInt(k.toString(), 10)].type === 'launcher')) {
318
+ this.isKeytipPopupOpen = true;
319
+ keytipData[parseInt(k.toString(), 10)].type === 'grpoverflow' ? this.createKeytip('grpoverflowpopup') : this.createKeytip('popupitem');
320
+ }
321
+ }
322
+ else {
323
+ var itemID = keytipData[parseInt(k.toString(), 10)].id;
324
+ if (document.querySelector('#' + itemID) && isMethod) {
325
+ if (this.parent.activeLayout === 'Simplified') {
326
+ if (document.querySelector('#' + itemID).closest('#' + itemProp.group.id + '_sim_grp_overflow-popup') && document.querySelector('#' + itemID).closest('#' + itemProp.group.id + '_sim_grp_overflow-popup').classList.contains('e-popup-close')) {
327
+ document.querySelector('#' + itemProp.group.id + '_sim_grp_overflow').click();
328
+ }
329
+ else if (document.querySelector('#' + itemID).closest('#' + this.parent.tabObj.element.id + constants.OVRLOF_BUTTON_ID + '-popup') && document.querySelector('#' + itemID).closest('#' + this.parent.tabObj.element.id + constants.OVRLOF_BUTTON_ID + '-popup').classList.contains('e-popup-close')) {
330
+ document.querySelector('#' + this.parent.tabObj.element.id + constants.OVRLOF_BUTTON_ID).click();
331
+ }
332
+ }
333
+ else {
334
+ if (document.querySelector('#' + itemID).closest('#' + itemProp.group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID + '-popup') && document.querySelector('#' + itemID).closest('#' + itemProp.group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID + '-popup').classList.contains('e-popup-close')) {
335
+ document.querySelector('#' + itemProp.group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID).click();
336
+ }
337
+ }
338
+ }
339
+ var itemType = this.parent.getItemModuleName(itemProp.item);
340
+ switch (itemType) {
341
+ case 'btn':
342
+ this.parent.ribbonButtonModule.click(itemID);
343
+ break;
344
+ case 'dropdown-btn':
345
+ this.parent.ribbonDropDownModule.toggle(itemID);
346
+ break;
347
+ case 'split-btn':
348
+ this.parent.ribbonSplitButtonModule.toggle(itemID);
349
+ break;
350
+ case 'checkbox':
351
+ this.parent.ribbonCheckBoxModule.click(itemID);
352
+ break;
353
+ case 'colorpicker':
354
+ this.parent.ribbonColorPickerModule.toggle(itemID);
355
+ break;
356
+ case 'combobox':
357
+ var itemEle_1 = document.querySelector('#' + itemID);
358
+ setTimeout(function () {
359
+ itemEle_1.focus();
360
+ }, 100);
361
+ break;
362
+ case 'gallery':
363
+ var galleryEle = document.querySelector('#' + itemID);
364
+ galleryEle.click();
365
+ break;
366
+ case 'template':
367
+ var templateEle = document.querySelector('#' + itemID);
368
+ templateEle.focus();
369
+ break;
370
+ case 'group-btn':
371
+ var itemElement = document.querySelector('#' + itemID);
372
+ if (itemElement) {
373
+ var item = getInstance(itemElement, DropDownButton);
374
+ item.toggle();
375
+ for (var i = 0; i < itemProp.item.groupButtonSettings.items.length; i++) {
376
+ if (itemProp.item.groupButtonSettings.items[parseInt(i.toString(), 10)].keyTip) {
377
+ this.createKeyTipElement(itemID + (constants.RIBBON_GROUP_BUTTON_ID + i), itemProp.item.groupButtonSettings.items[parseInt(i.toString(), 10)].keyTip, 'item');
378
+ }
379
+ }
380
+ }
381
+ break;
382
+ }
383
+ }
384
+ };
385
+ RibbonKeyTip.prototype.commonItemsKeyTipPress = function (keyPress, key, isMethod) {
386
+ var _this = this;
387
+ /* eslint-disable */
388
+ if (this.parent.keyTipElements[key]) {
389
+ var isKeyPressed = false;
390
+ var keytipData = this.parent.keyTipElements[key];
391
+ var keyEle = void 0;
392
+ var keytipElement = void 0;
393
+ if (keytipData) {
394
+ if (key === 'backstageMenu') {
395
+ for (var i = 0; i < Object.keys(this.parent.keyTipElements[key]).length; i++) {
396
+ /* eslint-enable */
397
+ if (keytipData[parseInt(i.toString(), 10)].keyTip === keyPress.toUpperCase()) {
398
+ keyEle = document.querySelector('#' + keytipData[parseInt(i.toString(), 10)].id);
399
+ keytipElement = document.querySelector('#' + keyEle.id + constants.RIBBON_KEYTIP_ID);
400
+ if (keytipElement || isMethod) {
401
+ isKeyPressed = true;
402
+ if (isMethod && document.querySelector('.e-ribbon-backstage-popup').classList.contains('e-popup-close')) {
403
+ this.parent.tabObj.element.querySelector('.e-ribbon-backstage').click();
404
+ }
405
+ break;
406
+ }
407
+ }
408
+ }
409
+ }
410
+ else {
411
+ if (keytipData[0] && keytipData[0].keyTip === keyPress.toUpperCase()) {
412
+ keyEle = document.querySelector('#' + keytipData[0].id);
413
+ keytipElement = document.querySelector('#' + keytipData[0].id + constants.RIBBON_KEYTIP_ID);
414
+ if (keytipElement || isMethod) {
415
+ isKeyPressed = true;
416
+ }
417
+ }
418
+ }
419
+ }
420
+ if (isKeyPressed) {
421
+ this.removeKeytip();
422
+ this.isKeytipPresent = true;
423
+ if (keyEle) {
424
+ keyEle.click();
425
+ if (key === 'backstage') {
426
+ this.createKeytip('backstageMenu');
427
+ }
428
+ else if (key === 'overflowbtn') {
429
+ this.isKeytipPopupOpen = true;
430
+ this.createKeytip('popupitem');
431
+ }
432
+ else if (key === 'taboverflow') {
433
+ setTimeout(function () {
434
+ for (var i = 0; i < Object.keys(_this.parent.keyTipElements).length; i++) {
435
+ if (_this.parent.keyTipElements[parseInt(i.toString(), 10)]) {
436
+ var keytipData_1 = _this.parent.keyTipElements[parseInt(i.toString(), 10)]['tab'];
437
+ _this.createKeyTipElement((keytipData_1[0].id), keytipData_1[0].keyTip, 'tab', 'center', 'bottom', true, true);
438
+ }
439
+ }
440
+ }, 600);
441
+ }
442
+ }
443
+ }
444
+ }
445
+ };
446
+ /**
447
+ * Removes the keytip.
448
+ *
449
+ * @param {string} key - Gets the keyboard key element.
450
+ * @returns {void}
451
+ * @hidden
452
+ */
453
+ RibbonKeyTip.prototype.removeKeytip = function (key) {
454
+ var _this = this;
455
+ var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
456
+ var isKeyTipExist = false;
457
+ this.parent.keysPress = '';
458
+ var _loop_1 = function (i) {
459
+ var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
460
+ if (key === 'Escape' && this_1.parent.keyTipElements && this_1.parent.keyTipElements[this_1.parent.selectedTab]) {
461
+ /* eslint-disable */
462
+ for (var j = 0; j < Object.keys(this_1.parent.keyTipElements[this_1.parent.selectedTab]).length; j++) {
463
+ var keyText = (Object.keys(this_1.parent.keyTipElements[this_1.parent.selectedTab]))[j];
464
+ if (this_1.parent.keyTipElements[this_1.parent.selectedTab][keyText]) {
465
+ var index = getIndex(this_1.parent.keyTipElements[this_1.parent.selectedTab][keyText], function (e) { return e.id + constants.RIBBON_KEYTIP_ID === keyTipItems[parseInt(i.toString(), 10)].id; });
466
+ /* eslint-enable */
467
+ if (index !== -1) {
468
+ if ((keyText === 'item' && !(this_1.isKeytipPopupOpen)) || (keyText === 'grpoverflow' && this_1.parent.activeLayout === 'Classic')) {
469
+ this_1.createKeytip('tab');
470
+ key = '';
471
+ isKeyTipExist = true;
472
+ break;
473
+ }
474
+ else if (this_1.isKeytipPopupOpen) {
475
+ if ((keyText === 'popupitem' && this_1.parent.activeLayout === 'Simplified') || (keyText === 'grpoverflowpopup' && this_1.parent.activeLayout === 'Classic')) {
476
+ this_1.createKeytip('item');
477
+ key = '';
478
+ isKeyTipExist = true;
479
+ break;
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ for (var n = 0; n < Object.keys(this_1.parent.keyTipElements).length; n++) {
486
+ if (this_1.parent.keyTipElements[parseInt(n.toString(), 10)]) {
487
+ var keytipData = this_1.parent.keyTipElements[parseInt(n.toString(), 10)]['tab'];
488
+ for (var j = 0; j < keytipData.length; j++) {
489
+ if (keyTipItem.id === keytipData[0].id + constants.RIBBON_KEYTIP_ID) {
490
+ if (document.querySelector('#' + keytipData[0].id + constants.HEADER_ID).closest('.e-toolbar-pop')) {
491
+ var tabOverflow = this_1.parent.tabObj.element.querySelector('.e-nav-active');
492
+ tabOverflow.click();
493
+ setTimeout(function () {
494
+ _this.createKeytip('tab');
495
+ }, 600);
496
+ key = '';
497
+ isKeyTipExist = true;
498
+ break;
499
+ }
500
+ }
501
+ }
502
+ if (isKeyTipExist) {
503
+ break;
504
+ }
505
+ }
506
+ }
507
+ if (!isKeyTipExist && this_1.parent.keyTipElements['backstageMenu']) {
508
+ var index = getIndex(this_1.parent.keyTipElements['backstageMenu'], function (e) { return e.id + constants.RIBBON_KEYTIP_ID === keyTipItems[parseInt(i.toString(), 10)].id; });
509
+ if (index !== -1) {
510
+ this_1.createKeytip('tab');
511
+ key = '';
512
+ isKeyTipExist = true;
513
+ }
514
+ }
515
+ }
516
+ if (keyTipItem) {
517
+ remove(keyTipItem);
518
+ }
519
+ };
520
+ var this_1 = this;
521
+ for (var i = 0; i < keyTipItems.length; i++) {
522
+ _loop_1(i);
523
+ }
524
+ this.isKeytipPopupOpen = false;
525
+ if (!isKeyTipExist)
526
+ this.parent.isKeytipOpen = false;
527
+ };
528
+ /**
529
+ * Shows the Keytip dynamically.
530
+ *
531
+ * @param {string} keyAction - Item for which the tooltip is to be shown.
532
+ * @returns {void}
533
+ */
534
+ RibbonKeyTip.prototype.showKeyTips = function (keyAction) {
535
+ if (this.parent.enableKeyTips) {
536
+ if (keyAction) {
537
+ this.keytipPress(keyAction, true);
538
+ }
539
+ else {
540
+ this.createKeytip('tab');
541
+ }
542
+ }
543
+ };
544
+ /**
545
+ * Hides the Keytip dynamically.
546
+ *
547
+ * @returns {void}
548
+ */
549
+ RibbonKeyTip.prototype.hideKeyTips = function () {
550
+ this.removeKeytip();
551
+ };
552
+ return RibbonKeyTip;
553
+ }());
554
+ export { RibbonKeyTip };