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