@syncfusion/ej2-ribbon 31.1.17 → 31.1.22

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