@syncfusion/ej2-ribbon 24.2.3 → 25.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -5
- package/README.md +3 -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 +2053 -138
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +2182 -147
- 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 +13 -13
- package/src/global.js +1 -1
- package/src/ribbon/base/constant.d.ts +8 -0
- package/src/ribbon/base/constant.js +8 -0
- package/src/ribbon/base/interface.d.ts +114 -1
- package/src/ribbon/base/interface.js +4 -0
- package/src/ribbon/base/ribbon-model.d.ts +22 -1
- package/src/ribbon/base/ribbon.d.ts +67 -5
- package/src/ribbon/base/ribbon.js +459 -77
- package/src/ribbon/base/utils.d.ts +3 -2
- package/src/ribbon/base/utils.js +3 -2
- package/src/ribbon/items/index.d.ts +1 -0
- package/src/ribbon/items/index.js +1 -0
- package/src/ribbon/items/ribbon-colorpicker.js +6 -1
- package/src/ribbon/items/ribbon-gallery.d.ts +87 -0
- package/src/ribbon/items/ribbon-gallery.js +712 -0
- package/src/ribbon/items/ribbon-groupbutton.js +3 -0
- package/src/ribbon/models/index.d.ts +8 -0
- package/src/ribbon/models/index.js +4 -0
- package/src/ribbon/models/ribbon-back-stage-settings-model.d.ts +7 -0
- package/src/ribbon/models/ribbon-back-stage-settings.d.ts +6 -0
- package/src/ribbon/models/ribbon-back-stage-settings.js +3 -0
- package/src/ribbon/models/ribbon-backstage-item-model.d.ts +7 -0
- package/src/ribbon/models/ribbon-backstage-item.d.ts +6 -0
- package/src/ribbon/models/ribbon-backstage-item.js +3 -0
- package/src/ribbon/models/ribbon-contextual-tab-settings-model.d.ts +30 -0
- package/src/ribbon/models/ribbon-contextual-tab-settings.d.ts +33 -0
- package/src/ribbon/models/ribbon-contextual-tab-settings.js +50 -0
- package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +7 -0
- package/src/ribbon/models/ribbon-file-menu-settings.d.ts +6 -0
- package/src/ribbon/models/ribbon-file-menu-settings.js +3 -0
- package/src/ribbon/models/ribbon-gallery-group-model.d.ts +44 -0
- package/src/ribbon/models/ribbon-gallery-group.d.ts +38 -0
- package/src/ribbon/models/ribbon-gallery-group.js +47 -0
- package/src/ribbon/models/ribbon-gallery-item-model.d.ts +43 -0
- package/src/ribbon/models/ribbon-gallery-item.d.ts +38 -0
- package/src/ribbon/models/ribbon-gallery-item.js +46 -0
- package/src/ribbon/models/ribbon-gallery-settings-model.d.ts +108 -0
- package/src/ribbon/models/ribbon-gallery-settings.d.ts +95 -0
- package/src/ribbon/models/ribbon-gallery-settings.js +71 -0
- package/src/ribbon/models/ribbon-group-button-item-model.d.ts +7 -0
- package/src/ribbon/models/ribbon-group-button-item.d.ts +6 -0
- package/src/ribbon/models/ribbon-group-button-item.js +3 -0
- package/src/ribbon/models/ribbon-group-model.d.ts +14 -0
- package/src/ribbon/models/ribbon-group.d.ts +12 -0
- package/src/ribbon/models/ribbon-group.js +6 -0
- package/src/ribbon/models/ribbon-item-model.d.ts +15 -1
- package/src/ribbon/models/ribbon-item.d.ts +13 -0
- package/src/ribbon/models/ribbon-item.js +7 -0
- package/src/ribbon/models/ribbon-tab-model.d.ts +7 -0
- package/src/ribbon/models/ribbon-tab.d.ts +6 -0
- package/src/ribbon/models/ribbon-tab.js +3 -0
- package/src/ribbon/modules/index.d.ts +2 -0
- package/src/ribbon/modules/index.js +2 -0
- package/src/ribbon/modules/ribbon-backstage.d.ts +2 -0
- package/src/ribbon/modules/ribbon-backstage.js +37 -0
- package/src/ribbon/modules/ribbon-contextualtab.d.ts +27 -0
- package/src/ribbon/modules/ribbon-contextualtab.js +90 -0
- package/src/ribbon/modules/ribbon-filemenu.d.ts +2 -0
- package/src/ribbon/modules/ribbon-filemenu.js +19 -0
- package/src/ribbon/modules/ribbon-keytip.d.ts +54 -0
- package/src/ribbon/modules/ribbon-keytip.js +554 -0
- package/styles/bootstrap-dark.css +398 -24
- package/styles/bootstrap.css +389 -15
- package/styles/bootstrap4.css +398 -24
- package/styles/bootstrap5-dark.css +391 -17
- package/styles/bootstrap5.css +391 -17
- package/styles/fabric-dark.css +390 -16
- package/styles/fabric.css +387 -13
- package/styles/fluent-dark.css +389 -15
- package/styles/fluent.css +389 -15
- package/styles/highcontrast-light.css +381 -7
- package/styles/highcontrast.css +390 -16
- package/styles/material-dark.css +391 -17
- package/styles/material.css +391 -17
- package/styles/material3-dark.css +389 -15
- package/styles/material3.css +389 -15
- package/styles/ribbon/_bds-definition.scss +360 -0
- package/styles/ribbon/_bootstrap-dark-definition.scss +81 -6
- package/styles/ribbon/_bootstrap-definition.scss +81 -6
- package/styles/ribbon/_bootstrap4-definition.scss +82 -7
- package/styles/ribbon/_bootstrap5-definition.scss +81 -6
- package/styles/ribbon/_fabric-dark-definition.scss +79 -4
- package/styles/ribbon/_fabric-definition.scss +78 -3
- package/styles/ribbon/_fluent-definition.scss +80 -5
- package/styles/ribbon/_fusionnew-definition.scss +76 -1
- package/styles/ribbon/_highcontrast-definition.scss +80 -5
- package/styles/ribbon/_highcontrast-light-definition.scss +76 -1
- package/styles/ribbon/_layout.scss +344 -38
- package/styles/ribbon/_material-dark-definition.scss +80 -5
- package/styles/ribbon/_material-definition.scss +81 -6
- package/styles/ribbon/_material3-definition.scss +80 -5
- package/styles/ribbon/_tailwind-definition.scss +80 -5
- package/styles/ribbon/_theme.scss +71 -0
- package/styles/ribbon/bootstrap-dark.css +398 -24
- package/styles/ribbon/bootstrap.css +389 -15
- package/styles/ribbon/bootstrap4.css +398 -24
- package/styles/ribbon/bootstrap5-dark.css +391 -17
- package/styles/ribbon/bootstrap5.css +391 -17
- package/styles/ribbon/fabric-dark.css +390 -16
- package/styles/ribbon/fabric.css +387 -13
- package/styles/ribbon/fluent-dark.css +389 -15
- package/styles/ribbon/fluent.css +389 -15
- package/styles/ribbon/highcontrast-light.css +381 -7
- package/styles/ribbon/highcontrast.css +390 -16
- package/styles/ribbon/icons/_bds.scss +9 -0
- package/styles/ribbon/material-dark.css +391 -17
- package/styles/ribbon/material.css +391 -17
- package/styles/ribbon/material3-dark.css +389 -15
- package/styles/ribbon/material3.css +389 -15
- package/styles/ribbon/tailwind-dark.css +390 -16
- package/styles/ribbon/tailwind.css +390 -16
- package/styles/tailwind-dark.css +390 -16
- package/styles/tailwind.css +390 -16
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -60
- package/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -37
|
@@ -20,12 +20,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
20
20
|
import { addClass, append, Event, Collection, Complex, Component, EventHandler, formatUnit, getInstance, getComponent, getUniqueID, closest, KeyboardEvents } from '@syncfusion/ej2-base';
|
|
21
21
|
import { isNullOrUndefined, isUndefined, NotifyPropertyChanges, Property, remove, removeClass } from '@syncfusion/ej2-base';
|
|
22
22
|
import { Tab, TabAnimationSettings, HScroll, Toolbar } from '@syncfusion/ej2-navigations';
|
|
23
|
-
import { RibbonTab, FileMenuSettings, BackStageMenu } from '../models/index';
|
|
23
|
+
import { RibbonTab, FileMenuSettings, BackStageMenu, RibbonContextualTabSettings } from '../models/index';
|
|
24
24
|
import { DisplayMode, RibbonLayout } from './interface';
|
|
25
25
|
import { ItemOrientation, RibbonItemSize, RibbonItemType } from './interface';
|
|
26
26
|
import { RibbonButton, RibbonComboBox, RibbonCheckBox, RibbonDropDown, RibbonSplitButton, RibbonGroupButton } from '../items/index';
|
|
27
27
|
import { destroyControl, getCollection, getGroup, getIndex, getItem, getItemElement, updateCommonProperty, updateControlDisabled, isTooltipPresent, getTemplateFunction, createTooltip, destroyTooltip, updateTooltipProp } from './utils';
|
|
28
28
|
import * as constants from './constant';
|
|
29
|
+
import { Popup } from '@syncfusion/ej2-popups';
|
|
29
30
|
import { DropDownButton, SplitButton } from '@syncfusion/ej2-splitbuttons';
|
|
30
31
|
import { CheckBox } from '@syncfusion/ej2-buttons';
|
|
31
32
|
/**
|
|
@@ -56,10 +57,12 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
56
57
|
this.initialize();
|
|
57
58
|
};
|
|
58
59
|
Ribbon.prototype.preRender = function () {
|
|
60
|
+
this.keysPress = '';
|
|
59
61
|
this.idIndex = 0;
|
|
60
62
|
this.tooltipData = [];
|
|
61
63
|
this.initialPropsData = {};
|
|
62
64
|
this.hiddenElements = {};
|
|
65
|
+
this.keyTipElements = {};
|
|
63
66
|
this.hiddenGroups = [];
|
|
64
67
|
this.isAddRemove = false;
|
|
65
68
|
this.keyConfigs = {
|
|
@@ -94,7 +97,27 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
94
97
|
*/
|
|
95
98
|
Ribbon.prototype.requiredModules = function () {
|
|
96
99
|
var modules = [];
|
|
97
|
-
modules.push({ member: 'ribbonButton', args: [this] }, { member: 'ribbonDropDown', args: [this] }, { member: 'ribbonSplitButton', args: [this] }, { member: 'ribbonCheckBox', args: [this]
|
|
100
|
+
modules.push({ member: 'ribbonButton', args: [this], name: 'RibbonButton' }, { member: 'ribbonDropDown', args: [this], name: 'RibbonDropDown' }, { member: 'ribbonSplitButton', args: [this], name: 'RibbonSplitButton' }, { member: 'ribbonCheckBox', args: [this], name: 'RibbonCheckBox' }, { member: 'ribbonComboBox', args: [this], name: 'RibbonComboBox' }, { member: 'ribbonGroupButton', args: [this], name: 'RibbonGroupButton' });
|
|
101
|
+
var canInjectColorPickerModule = getItem(this.tabs, null, RibbonItemType.ColorPicker);
|
|
102
|
+
var canInjectGalleryModule = getItem(this.tabs, null, RibbonItemType.Gallery);
|
|
103
|
+
if (canInjectColorPickerModule) {
|
|
104
|
+
modules.push({ member: 'ribbonColorPicker', args: [this], name: 'RibbonColorPicker' });
|
|
105
|
+
}
|
|
106
|
+
if (canInjectGalleryModule) {
|
|
107
|
+
modules.push({ member: 'ribbonGallery', args: [this], name: 'RibbonGallery' });
|
|
108
|
+
}
|
|
109
|
+
if (this.backStageMenu.visible || this.backStageMenu.items.length) {
|
|
110
|
+
modules.push({ member: 'ribbonBackstage', args: [this], name: 'RibbonBackstage' });
|
|
111
|
+
}
|
|
112
|
+
if (this.fileMenu.visible || this.fileMenu.menuItems.length) {
|
|
113
|
+
modules.push({ member: 'ribbonFileMenu', args: [this], name: 'RibbonFileMenu' });
|
|
114
|
+
}
|
|
115
|
+
if (this.contextualTabs.length) {
|
|
116
|
+
modules.push({ member: 'ribbonContextualTab', args: [this], name: 'RibbonContextualTab' });
|
|
117
|
+
}
|
|
118
|
+
if (this.enableKeyTips) {
|
|
119
|
+
modules.push({ member: 'ribbonKeyTip', args: [this], name: 'RibbonKeyTip' });
|
|
120
|
+
}
|
|
98
121
|
return modules;
|
|
99
122
|
};
|
|
100
123
|
Ribbon.prototype.initialize = function () {
|
|
@@ -105,6 +128,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
105
128
|
}
|
|
106
129
|
this.element.style.width = formatUnit(this.width);
|
|
107
130
|
this.renderTabs();
|
|
131
|
+
if (this.ribbonContextualTabModule) {
|
|
132
|
+
this.ribbonContextualTabModule.addContextualTabs();
|
|
133
|
+
}
|
|
108
134
|
if (this.ribbonFileMenuModule) {
|
|
109
135
|
this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
|
|
110
136
|
}
|
|
@@ -114,13 +140,18 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
114
140
|
this.createHelpPaneTemplate();
|
|
115
141
|
var toolbar = this.tabObj['tbObj'];
|
|
116
142
|
toolbar.refreshOverflow();
|
|
143
|
+
this.addTabOverflowKeyTip();
|
|
117
144
|
createTooltip(this.element, this);
|
|
145
|
+
this.isKeytipOpen = false;
|
|
118
146
|
this.wireEvents();
|
|
119
147
|
this.wireKeyboardEvent();
|
|
120
148
|
this.currentControlIndex = 0;
|
|
121
149
|
};
|
|
122
150
|
Ribbon.prototype.wireEvents = function () {
|
|
123
151
|
EventHandler.add(window, 'resize', this.resizeHandler, this);
|
|
152
|
+
EventHandler.add(document.body, 'keydown', this.keytipActionHandler, this);
|
|
153
|
+
EventHandler.add(document, 'mousedown', this.mouseEventHandler, this);
|
|
154
|
+
EventHandler.add(document, 'scroll', this.mouseEventHandler, this);
|
|
124
155
|
};
|
|
125
156
|
Ribbon.prototype.wireKeyboardEvent = function () {
|
|
126
157
|
this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
|
|
@@ -136,7 +167,8 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
136
167
|
var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
|
|
137
168
|
var controlElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-control'));
|
|
138
169
|
var templateElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-template'));
|
|
139
|
-
var
|
|
170
|
+
var galleryElements = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-gallery-item'));
|
|
171
|
+
var ribbonControls = controlElements.concat(templateElements, galleryElements);
|
|
140
172
|
var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
|
|
141
173
|
var comboBoxEle;
|
|
142
174
|
if (comboBoxElements) {
|
|
@@ -165,7 +197,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
165
197
|
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
166
198
|
e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
|
|
167
199
|
e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
|
|
168
|
-
e.target.classList.contains('e-ribbon-overall-of-btn') || e.target.classList.contains('e-ribbon-template')) {
|
|
200
|
+
e.target.classList.contains('e-ribbon-overall-of-btn') || e.target.classList.contains('e-ribbon-template') || e.target.classList.contains('e-ribbon-gallery-item')) {
|
|
169
201
|
switch (e.action) {
|
|
170
202
|
case 'rightarrow':
|
|
171
203
|
this.handleNavigation(e, !this.enableRtl, ribbonControls);
|
|
@@ -207,7 +239,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
207
239
|
}
|
|
208
240
|
}
|
|
209
241
|
if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
|
|
210
|
-
if (!e.target.classList.contains('e-combobox') && (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-template')) && !e.target.classList.contains('e-ribbon-last-item')) {
|
|
242
|
+
if (!e.target.classList.contains('e-combobox') && (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-template') || e.target.classList.contains('e-ribbon-gallery-item')) && !e.target.classList.contains('e-ribbon-last-item')) {
|
|
211
243
|
if (enableRtl) {
|
|
212
244
|
this.currentControlIndex++;
|
|
213
245
|
}
|
|
@@ -366,6 +398,111 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
366
398
|
}
|
|
367
399
|
}
|
|
368
400
|
}
|
|
401
|
+
var galleryPopupEle = document.querySelector('.e-ribbon-gallery-popup.e-popup-open');
|
|
402
|
+
if (galleryPopupEle) {
|
|
403
|
+
var popup = getComponent(galleryPopupEle, Popup);
|
|
404
|
+
popup.hide();
|
|
405
|
+
}
|
|
406
|
+
if (this.ribbonKeyTipModule && this.enableKeyTips) {
|
|
407
|
+
this.ribbonKeyTipModule.removeKeytip();
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
Ribbon.prototype.mouseEventHandler = function (e) {
|
|
411
|
+
if (this.ribbonKeyTipModule && this.enableKeyTips) {
|
|
412
|
+
this.ribbonKeyTipModule.removeKeytip();
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
Ribbon.prototype.keytipActionHandler = function (e) {
|
|
416
|
+
if (this.enableKeyTips) {
|
|
417
|
+
var isKeyTipPresent = false;
|
|
418
|
+
var keyPress = e.key;
|
|
419
|
+
if (e.altKey && e.key === 'Meta') {
|
|
420
|
+
var activePopup = document.querySelectorAll('.e-ribbon .e-dropdown-btn.e-active, .e-ribbon-group-overflow-ddb .e-dropdown-btn.e-active');
|
|
421
|
+
if (activePopup.length) {
|
|
422
|
+
for (var i = 0; i < activePopup.length; i++) {
|
|
423
|
+
var dropDownBtn = getInstance(activePopup[parseInt(i.toString(), 10)], DropDownButton);
|
|
424
|
+
dropDownBtn.toggle();
|
|
425
|
+
}
|
|
426
|
+
this.ribbonKeyTipModule.removeKeytip();
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
if (!this.isKeytipOpen) {
|
|
430
|
+
var backstagePopup = document.querySelector('.e-ribbon-backstage-popup');
|
|
431
|
+
if (backstagePopup && backstagePopup.classList.contains('e-popup-open')) {
|
|
432
|
+
this.ribbonBackstageModule.hideBackstage();
|
|
433
|
+
}
|
|
434
|
+
this.ribbonKeyTipModule.createKeytip('tab');
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this.ribbonKeyTipModule.removeKeytip();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
else if (e.key === 'Escape' || e.key === 'Tab' || e.key === 'ArrowLeft' || e.key === 'ArrowUp' || e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
442
|
+
this.ribbonKeyTipModule.removeKeytip(e.key);
|
|
443
|
+
}
|
|
444
|
+
else {
|
|
445
|
+
var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
|
|
446
|
+
if (keyTipItems) {
|
|
447
|
+
for (var i = 0; i < keyTipItems.length; i++) {
|
|
448
|
+
var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
|
|
449
|
+
if (keyTipItem.innerHTML.toLowerCase() === keyPress) {
|
|
450
|
+
isKeyTipPresent = true;
|
|
451
|
+
this.ribbonKeyTipModule.keytipPress(keyPress);
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (!isKeyTipPresent) {
|
|
456
|
+
this.checkKeyTipPresent(keyPress, this.keysPress.length);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
Ribbon.prototype.checkKeyTipPresent = function (keyTip, length) {
|
|
463
|
+
var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
|
|
464
|
+
for (var i = 0; i < keyTipItems.length; i++) {
|
|
465
|
+
var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
|
|
466
|
+
if (keyTipItem.innerHTML.length > 1 && keyTipItem.innerHTML[parseInt(length.toString(), 10)].toLowerCase() === keyTip) {
|
|
467
|
+
this.keysPress += keyTip;
|
|
468
|
+
this.ribbonKeyTipModule.keytipPress(this.keysPress);
|
|
469
|
+
this.removeKeytip(this.keysPress);
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
Ribbon.prototype.removeKeytip = function (keyTip) {
|
|
475
|
+
var keyTipItems = document.querySelectorAll('.e-ribbon-keytip');
|
|
476
|
+
for (var i = 0; i < keyTipItems.length; i++) {
|
|
477
|
+
var keyTipItem = keyTipItems[parseInt(i.toString(), 10)];
|
|
478
|
+
if (keyTipItem.innerHTML[0].toLowerCase() !== keyTip && keyTip !== '') {
|
|
479
|
+
remove(keyTipItem);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
Ribbon.prototype.addKeyTip = function (tabIndex, keyTip, id, type) {
|
|
484
|
+
if (this.keyTipElements && this.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
|
|
485
|
+
var isKeyTipExist = false;
|
|
486
|
+
/* eslint-disable */
|
|
487
|
+
if (!(this.keyTipElements[parseInt(tabIndex.toString(), 10)][type])) {
|
|
488
|
+
this.keyTipElements[parseInt(tabIndex.toString(), 10)][type] = [];
|
|
489
|
+
}
|
|
490
|
+
if (Object.keys(this.keyTipElements[tabIndex][type]).length) {
|
|
491
|
+
var keytipData = this.keyTipElements[tabIndex][type];
|
|
492
|
+
for (var i = 0; i < Object.keys(this.keyTipElements[tabIndex][type]).length; i++) {
|
|
493
|
+
if (keytipData[parseInt(i.toString(), 10)].id === id) {
|
|
494
|
+
isKeyTipExist = true;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (!isKeyTipExist) {
|
|
498
|
+
this.keyTipElements[tabIndex][type].push({ id: id, type: type, keyTip: keyTip });
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
this.keyTipElements[tabIndex][type].push({ id: id, type: type, keyTip: keyTip });
|
|
503
|
+
}
|
|
504
|
+
/* eslint-enable */
|
|
505
|
+
}
|
|
369
506
|
};
|
|
370
507
|
Ribbon.prototype.renderTabs = function () {
|
|
371
508
|
this.tabsInternal = this.tabs.slice();
|
|
@@ -386,7 +523,8 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
386
523
|
enableRtl: this.enableRtl,
|
|
387
524
|
created: this.tabCreated.bind(this),
|
|
388
525
|
selected: this.ribbonTabSelected.bind(this),
|
|
389
|
-
selecting: this.ribbonTabSelecting.bind(this)
|
|
526
|
+
selecting: this.ribbonTabSelecting.bind(this),
|
|
527
|
+
animation: this.tabAnimation
|
|
390
528
|
});
|
|
391
529
|
this.tabObj.appendTo(tabEle);
|
|
392
530
|
//Set the width value as "0px" with unit for proper calculation.
|
|
@@ -427,14 +565,20 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
427
565
|
this.renderInitialTab(this.selectedTab);
|
|
428
566
|
};
|
|
429
567
|
Ribbon.prototype.ribbonTabSelected = function (e) {
|
|
568
|
+
e.preventFocus = true;
|
|
430
569
|
this.isAddRemove = false;
|
|
431
570
|
var selectedTabId = e.selectedItem.getAttribute('data-id');
|
|
432
571
|
var selectedIndex = getIndex(this.tabs, (function (tab) { return (tab.id === selectedTabId); }));
|
|
433
572
|
selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
|
|
434
|
-
var
|
|
573
|
+
var isContextual = this.isContextualTab(selectedTabId);
|
|
574
|
+
this.updateSelectedState(selectedTabId);
|
|
575
|
+
var eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex, isContextual: isContextual };
|
|
435
576
|
this.setProperties({ selectedTab: selectedIndex }, true);
|
|
436
577
|
this.calculateHiddenElementsWidth(selectedIndex);
|
|
437
578
|
this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
|
|
579
|
+
if (this.activeLayout === 'Classic' && this.ribbonGalleryModule) {
|
|
580
|
+
this.ribbonGalleryModule.checkAvailableHeight(selectedIndex, e.selectedContent.firstChild);
|
|
581
|
+
}
|
|
438
582
|
if (this.activeLayout === 'Simplified' && this.overflowDDB) {
|
|
439
583
|
var overflowTarget = this.overflowDDB.target;
|
|
440
584
|
var ofTabContainer = overflowTarget.querySelector('.' + constants.RIBBON_TAB_ACTIVE);
|
|
@@ -453,6 +597,20 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
453
597
|
}
|
|
454
598
|
this.trigger('tabSelected', eventArgs);
|
|
455
599
|
};
|
|
600
|
+
Ribbon.prototype.updateSelectedState = function (tabID) {
|
|
601
|
+
if (this.contextualTabs.length) {
|
|
602
|
+
for (var i = 0; i < this.contextualTabs.length; i++) {
|
|
603
|
+
var isSelected = false;
|
|
604
|
+
for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
|
|
605
|
+
if (this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id === tabID) {
|
|
606
|
+
isSelected = true;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
this.contextualTabs[parseInt(i.toString(), 10)].setProperties({ isSelected: isSelected }, true);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
456
614
|
Ribbon.prototype.checkOverflow = function (tabIndex, activeContent) {
|
|
457
615
|
var tabContent = activeContent.closest('.' + constants.TAB_CONTENT);
|
|
458
616
|
var isOverFlow = tabContent.offsetWidth < activeContent.offsetWidth;
|
|
@@ -502,6 +660,17 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
502
660
|
}
|
|
503
661
|
}
|
|
504
662
|
}
|
|
663
|
+
this.addTabOverflowKeyTip();
|
|
664
|
+
};
|
|
665
|
+
Ribbon.prototype.addTabOverflowKeyTip = function () {
|
|
666
|
+
var tabOverflow = this.tabObj.element.querySelector('#_nav');
|
|
667
|
+
if (tabOverflow) {
|
|
668
|
+
this.keyTipElements['taboverflow'] = [];
|
|
669
|
+
this.keyTipElements['taboverflow'].push({ id: tabOverflow.id, type: 'taboverflow', keyTip: '00' });
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
delete (this.keyTipElements['taboverflow']);
|
|
673
|
+
}
|
|
505
674
|
};
|
|
506
675
|
Ribbon.prototype.checkSimplifiedItemShrinking = function (tabIndex, tabContent, activeContent) {
|
|
507
676
|
var tab = this.tabs[parseInt(tabIndex.toString(), 10)];
|
|
@@ -636,7 +805,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
636
805
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
637
806
|
this.setItemSize(itemEle, item);
|
|
638
807
|
}
|
|
639
|
-
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
808
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
640
809
|
this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, true);
|
|
641
810
|
}
|
|
642
811
|
}
|
|
@@ -666,7 +835,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
666
835
|
return isEmptyCollection;
|
|
667
836
|
};
|
|
668
837
|
Ribbon.prototype.updatePopupItems = function (item, itemEle, isGroupOF, isMenu) {
|
|
669
|
-
var dropdown = getComponent(itemEle.querySelector('#' + item.id), (item.type === RibbonItemType.DropDown || item.type === RibbonItemType.GroupButton) ? DropDownButton : SplitButton);
|
|
838
|
+
var dropdown = getComponent(itemEle.querySelector('#' + item.id), (item.type === RibbonItemType.DropDown || item.type === RibbonItemType.Gallery || item.type === RibbonItemType.GroupButton) ? DropDownButton : SplitButton);
|
|
670
839
|
var dropDownPopup = dropdown.dropDown;
|
|
671
840
|
// popup is on right if (isGroupOF && isMenu)
|
|
672
841
|
// The position is reversed if RTL is enabled.
|
|
@@ -732,7 +901,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
732
901
|
break;
|
|
733
902
|
}
|
|
734
903
|
var groupEle = tabContent.querySelector('#' + collection.id);
|
|
735
|
-
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
904
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
736
905
|
this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, false);
|
|
737
906
|
}
|
|
738
907
|
groupEle.append(itemContainer);
|
|
@@ -851,19 +1020,22 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
851
1020
|
};
|
|
852
1021
|
Ribbon.prototype.createOverflowPopup = function (item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer, isResize) {
|
|
853
1022
|
var overflowButton;
|
|
1023
|
+
var overflowtarget;
|
|
854
1024
|
var itemProp = getGroup(this.tabs, groupId);
|
|
855
1025
|
var contentEle = this.tabObj.items[parseInt(tabIndex.toString(), 10)].content;
|
|
856
1026
|
var groupEle = contentEle.querySelector('#' + groupId);
|
|
857
1027
|
if (isGroupOF) {
|
|
858
1028
|
var overflowDDB = groupContainer.querySelector('#' + groupId + constants.GROUPOF_BUTTON_ID);
|
|
859
1029
|
if (!overflowDDB) {
|
|
860
|
-
overflowButton = this.addOverflowButton(groupId + constants.GROUPOF_BUTTON_ID);
|
|
1030
|
+
overflowButton = this.addOverflowButton(groupId + constants.GROUPOF_BUTTON_ID, isGroupOF);
|
|
861
1031
|
overflowButton.element.classList.add(constants.RIBBON_GROUP_OF_BUTTON);
|
|
862
1032
|
groupContainer.appendChild(overflowButton.element);
|
|
863
1033
|
}
|
|
864
1034
|
else {
|
|
865
1035
|
overflowButton = getInstance(overflowDDB, DropDownButton);
|
|
866
1036
|
}
|
|
1037
|
+
this.addKeyTip(tabIndex, '0' + (itemProp.groupIndex + 1), overflowButton.element.id, 'grpofbtn');
|
|
1038
|
+
overflowtarget = overflowButton.target;
|
|
867
1039
|
var overflowBtnTarget = overflowButton.target;
|
|
868
1040
|
var headerEle = overflowBtnTarget.querySelector('#' + groupId + constants.GROUPOF_BUTTON_ID + constants.HEADER_ID);
|
|
869
1041
|
if (!headerEle) {
|
|
@@ -892,7 +1064,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
892
1064
|
}
|
|
893
1065
|
else {
|
|
894
1066
|
if (!this.overflowDDB) {
|
|
895
|
-
this.overflowDDB = this.addOverflowButton(this.tabObj.element.id + constants.OVRLOF_BUTTON_ID);
|
|
1067
|
+
this.overflowDDB = this.addOverflowButton(this.tabObj.element.id + constants.OVRLOF_BUTTON_ID, isGroupOF);
|
|
896
1068
|
this.tabObj.element.insertBefore(this.overflowDDB.element, this.collapseButton);
|
|
897
1069
|
this.overflowDDB.element.classList.add(constants.RIBBON_OVERALL_OF_BUTTON);
|
|
898
1070
|
this.createOfTabContainer(groupId, groupHeader, itemEle, tabIndex);
|
|
@@ -925,10 +1097,16 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
925
1097
|
}
|
|
926
1098
|
}
|
|
927
1099
|
overflowButton = this.overflowDDB;
|
|
1100
|
+
overflowtarget = this.overflowDDB ? this.overflowDDB.target : null;
|
|
928
1101
|
}
|
|
929
1102
|
if (itemEle !== null) {
|
|
930
1103
|
this.addOverflowEvents(item, itemEle, overflowButton);
|
|
931
1104
|
}
|
|
1105
|
+
if (overflowtarget) {
|
|
1106
|
+
if (item.keyTip) {
|
|
1107
|
+
this.addKeyTip(tabIndex, item.keyTip, item.id, 'popupitem');
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
932
1110
|
};
|
|
933
1111
|
Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
|
|
934
1112
|
switch (item.type) {
|
|
@@ -950,6 +1128,11 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
950
1128
|
case 'ComboBox':
|
|
951
1129
|
this.ribbonComboBoxModule.addOverFlowEvents(item, itemEle, overflowButton);
|
|
952
1130
|
break;
|
|
1131
|
+
case 'Gallery':
|
|
1132
|
+
if (this.activeLayout === 'Simplified') {
|
|
1133
|
+
this.ribbonGalleryModule.addOverFlowEvents(item, itemEle, overflowButton);
|
|
1134
|
+
}
|
|
1135
|
+
break;
|
|
953
1136
|
case 'GroupButton':
|
|
954
1137
|
if (this.activeLayout === 'Simplified') {
|
|
955
1138
|
this.ribbonGroupButtonModule.addOverFlowEvents(item, itemEle, overflowButton);
|
|
@@ -1628,6 +1811,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1628
1811
|
this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
1629
1812
|
this_1.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
1630
1813
|
var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
|
|
1814
|
+
if (group.keyTip) {
|
|
1815
|
+
var overflowDDB = group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID;
|
|
1816
|
+
this_1.addKeyTip(tabIndex, group.keyTip, overflowDDB, 'grpoverflow');
|
|
1817
|
+
}
|
|
1631
1818
|
this_1.tabs[parseInt(tabIndex.toString(), 10)].
|
|
1632
1819
|
groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
|
|
1633
1820
|
for (var j = 0; j < group.collections.length; j++) {
|
|
@@ -1640,6 +1827,25 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1640
1827
|
this_1.handleContentSize(itemEle);
|
|
1641
1828
|
this_1.addOverflowEvents(item, itemEle, dropdown);
|
|
1642
1829
|
}
|
|
1830
|
+
var overflowDDB = document.querySelector('#' + group.id + constants.OVERFLOW_ID + constants.DROPDOWN_ID);
|
|
1831
|
+
var overflowButton = getInstance(overflowDDB, DropDownButton);
|
|
1832
|
+
if (overflowButton) {
|
|
1833
|
+
var overflowtarget = overflowButton.target;
|
|
1834
|
+
if (overflowtarget) {
|
|
1835
|
+
if (this_1.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
|
|
1836
|
+
if (item.type === RibbonItemType.GroupButton) {
|
|
1837
|
+
for (var i_3 = 0; i_3 < item.groupButtonSettings.items.length; i_3++) {
|
|
1838
|
+
if (item.groupButtonSettings.items[parseInt(i_3.toString(), 10)].keyTip) {
|
|
1839
|
+
this_1.addKeyTip(tabIndex, item.groupButtonSettings.items[parseInt(i_3.toString(), 10)].keyTip, item.id + (constants.RIBBON_GROUP_BUTTON_ID + i_3), 'grpoverflowpopup');
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
if (item.keyTip) {
|
|
1844
|
+
this_1.addKeyTip(tabIndex, item.keyTip, item.id, 'grpoverflowpopup');
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1643
1849
|
}
|
|
1644
1850
|
}
|
|
1645
1851
|
};
|
|
@@ -1738,16 +1944,31 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1738
1944
|
this.removeOverflowDropdown(activeContent, tabContent, true, index);
|
|
1739
1945
|
}
|
|
1740
1946
|
};
|
|
1947
|
+
Ribbon.prototype.isContextualTab = function (tabID) {
|
|
1948
|
+
var isContextual = false;
|
|
1949
|
+
if (this.contextualTabs.length) {
|
|
1950
|
+
for (var i = 0; i < this.contextualTabs.length; i++) {
|
|
1951
|
+
for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
|
|
1952
|
+
if (this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id === tabID) {
|
|
1953
|
+
isContextual = true;
|
|
1954
|
+
break;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
return isContextual;
|
|
1960
|
+
};
|
|
1741
1961
|
Ribbon.prototype.ribbonTabSelecting = function (e) {
|
|
1742
1962
|
var _this = this;
|
|
1743
1963
|
this.currentControlIndex = 0;
|
|
1744
1964
|
var nextTabId = e.selectingItem.getAttribute('data-id');
|
|
1745
1965
|
var previousTabId = e.previousItem.getAttribute('data-id');
|
|
1746
1966
|
var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
|
|
1967
|
+
var isContextual = this.isContextualTab(nextTabId);
|
|
1747
1968
|
var previousIndex = getIndex(this.tabs, (function (tab) { return (tab.id === previousTabId); }));
|
|
1748
1969
|
nextIndex = nextIndex === -1 ? this.selectedTab : nextIndex;
|
|
1749
1970
|
var eventArgs = {
|
|
1750
|
-
cancel: e.cancel, isInteracted: e.isInteracted, previousIndex: previousIndex, selectedIndex: nextIndex
|
|
1971
|
+
cancel: e.cancel, isInteracted: e.isInteracted, previousIndex: previousIndex, selectedIndex: nextIndex, isContextual: isContextual
|
|
1751
1972
|
};
|
|
1752
1973
|
this.trigger('tabSelecting', eventArgs, function (args) {
|
|
1753
1974
|
if (args.cancel) {
|
|
@@ -1767,22 +1988,33 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1767
1988
|
Ribbon.prototype.createTabItems = function (tabs) {
|
|
1768
1989
|
var _this = this;
|
|
1769
1990
|
var tabItems = [];
|
|
1770
|
-
|
|
1991
|
+
var _loop_3 = function (i) {
|
|
1771
1992
|
var ribbonTab = tabs[parseInt(i.toString(), 10)];
|
|
1772
|
-
var header =
|
|
1993
|
+
var header = this_3.createElement('span', {
|
|
1773
1994
|
innerHTML: ribbonTab.header,
|
|
1774
1995
|
id: ribbonTab.id + constants.HEADER_ID
|
|
1775
1996
|
});
|
|
1997
|
+
var tabIndex = getIndex(this_3.tabs, (function (tab) { return (tab.id === ribbonTab.id); }));
|
|
1998
|
+
if (ribbonTab.keyTip) {
|
|
1999
|
+
if (!this_3.keyTipElements[parseInt(tabIndex.toString(), 10)]) {
|
|
2000
|
+
this_3.keyTipElements[parseInt(tabIndex.toString(), 10)] = {};
|
|
2001
|
+
}
|
|
2002
|
+
this_3.addKeyTip(tabIndex, ribbonTab.keyTip, ribbonTab.id, 'tab');
|
|
2003
|
+
}
|
|
1776
2004
|
header.onclick = function () { _this.minimize(false); };
|
|
1777
2005
|
header.ondblclick = function () { _this.minimize(true); };
|
|
1778
2006
|
var tab = { header: { text: header }, id: ribbonTab.id, cssClass: ribbonTab.cssClass };
|
|
1779
|
-
var content =
|
|
2007
|
+
var content = this_3.createElement('div', {
|
|
1780
2008
|
className: tab.cssClass,
|
|
1781
2009
|
id: ribbonTab.id + constants.CONTENT_ID
|
|
1782
2010
|
});
|
|
1783
2011
|
content.classList.add(constants.RIBBON_TAB_ITEM);
|
|
1784
2012
|
tab.content = content;
|
|
1785
2013
|
tabItems.push(tab);
|
|
2014
|
+
};
|
|
2015
|
+
var this_3 = this;
|
|
2016
|
+
for (var i = 0; i < tabs.length; i++) {
|
|
2017
|
+
_loop_3(i);
|
|
1786
2018
|
}
|
|
1787
2019
|
return tabItems;
|
|
1788
2020
|
};
|
|
@@ -1795,8 +2027,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1795
2027
|
}
|
|
1796
2028
|
var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + constants.CONTENT_ID);
|
|
1797
2029
|
this.checkOverflow(this.selectedTab, activeContent);
|
|
2030
|
+
if (this.activeLayout === 'Classic' && this.ribbonGalleryModule)
|
|
2031
|
+
this.ribbonGalleryModule.checkAvailableHeight(this.selectedTab, activeContent);
|
|
1798
2032
|
};
|
|
1799
|
-
Ribbon.prototype.addOverflowButton = function (btnId) {
|
|
2033
|
+
Ribbon.prototype.addOverflowButton = function (btnId, isGroupOF) {
|
|
1800
2034
|
var _this = this;
|
|
1801
2035
|
var overflowButton = this.createElement('button', {
|
|
1802
2036
|
id: btnId
|
|
@@ -1833,6 +2067,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1833
2067
|
}, overflowButton);
|
|
1834
2068
|
this.element.classList.add(constants.RIBBON_OVERFLOW);
|
|
1835
2069
|
createTooltip(overflowTarget, this);
|
|
2070
|
+
if (!isGroupOF) {
|
|
2071
|
+
this.keyTipElements['overflowbtn'] = [];
|
|
2072
|
+
this.keyTipElements['overflowbtn'].push({ id: btnId, type: 'overflowbtn', keyTip: '00' });
|
|
2073
|
+
}
|
|
1836
2074
|
var isGroupOf;
|
|
1837
2075
|
overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
|
|
1838
2076
|
overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
|
|
@@ -1993,6 +2231,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
1993
2231
|
case 'ComboBox':
|
|
1994
2232
|
this.ribbonComboBoxModule.removeOverFlowEvents(item, itemEle);
|
|
1995
2233
|
break;
|
|
2234
|
+
case 'Gallery':
|
|
2235
|
+
this.ribbonGalleryModule.removeOverFlowEvents(item, itemEle);
|
|
2236
|
+
break;
|
|
1996
2237
|
case 'GroupButton':
|
|
1997
2238
|
this.ribbonGroupButtonModule.removeOverFlowEvents(item, itemEle);
|
|
1998
2239
|
break;
|
|
@@ -2030,6 +2271,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2030
2271
|
this.collapseButton.classList.add(constants.RIBBON_EXPAND_BUTTON);
|
|
2031
2272
|
}
|
|
2032
2273
|
this.tabObj.element.appendChild(this.collapseButton);
|
|
2274
|
+
if (this.layoutSwitcherKeyTip) {
|
|
2275
|
+
this.keyTipElements['collapse'] = [];
|
|
2276
|
+
this.keyTipElements['collapse'].push({ id: this.collapseButton.id, type: 'collapse', keyTip: this.layoutSwitcherKeyTip });
|
|
2277
|
+
}
|
|
2033
2278
|
};
|
|
2034
2279
|
Ribbon.prototype.removeExpandCollapse = function () {
|
|
2035
2280
|
var _this = this;
|
|
@@ -2132,22 +2377,22 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2132
2377
|
var activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + constants.CONTENT_ID);
|
|
2133
2378
|
var tabContent = activeContent.closest('.' + constants.TAB_CONTENT);
|
|
2134
2379
|
if (this.activeLayout === 'Simplified') {
|
|
2135
|
-
for (var
|
|
2136
|
-
var group = groupList[parseInt(
|
|
2137
|
-
var alignType = groupList[parseInt(
|
|
2380
|
+
for (var i_4 = 0; i_4 < groupList.length; i_4++) {
|
|
2381
|
+
var group = groupList[parseInt(i_4.toString(), 10)];
|
|
2382
|
+
var alignType = groupList[parseInt(i_4.toString(), 10)].orientation;
|
|
2138
2383
|
if (group.isCollapsed) {
|
|
2139
2384
|
group.setProperties({ isCollapsed: false }, true);
|
|
2140
2385
|
this.removeDropdown(group.id);
|
|
2141
2386
|
}
|
|
2142
2387
|
else {
|
|
2143
|
-
this.checkSmallToMedium(tabIndex, tab,
|
|
2144
|
-
this.checkMediumToLarge(tabIndex, tab,
|
|
2388
|
+
this.checkSmallToMedium(tabIndex, tab, i_4, tabContent, activeContent, true, false);
|
|
2389
|
+
this.checkMediumToLarge(tabIndex, tab, i_4, tabContent, activeContent, true, false);
|
|
2145
2390
|
}
|
|
2146
2391
|
var groupEle = tabContent.querySelector('#' + group.id);
|
|
2147
2392
|
var groupContainer = groupEle.querySelector('#' + group.id + constants.CONTAINER_ID);
|
|
2148
2393
|
var shrinkColumns = groupContainer.querySelectorAll('.' + 'e-ribbon-shrink');
|
|
2149
|
-
for (var
|
|
2150
|
-
shrinkColumns[parseInt(
|
|
2394
|
+
for (var i_5 = 0; i_5 < shrinkColumns.length; i_5++) {
|
|
2395
|
+
shrinkColumns[parseInt(i_5.toString(), 10)].remove();
|
|
2151
2396
|
}
|
|
2152
2397
|
var groupHeader = groupContainer.querySelector('#' + group.id + constants.HEADER_ID);
|
|
2153
2398
|
groupHeader.remove();
|
|
@@ -2193,7 +2438,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2193
2438
|
itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
|
|
2194
2439
|
if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
|
|
2195
2440
|
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
|
|
2196
|
-
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
2441
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
2197
2442
|
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
|
|
2198
2443
|
}
|
|
2199
2444
|
}
|
|
@@ -2206,6 +2451,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2206
2451
|
this.setItemSize(ele, item);
|
|
2207
2452
|
}
|
|
2208
2453
|
}
|
|
2454
|
+
if (item.type === RibbonItemType.Gallery) {
|
|
2455
|
+
this.ribbonGalleryModule.switchGalleryItems(this.activeLayout, item.id);
|
|
2456
|
+
}
|
|
2209
2457
|
}
|
|
2210
2458
|
}
|
|
2211
2459
|
if (!(group.enableGroupOverflow || groupEle.querySelector('.' + constants.RIBBON_ITEM))) {
|
|
@@ -2215,9 +2463,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2215
2463
|
}
|
|
2216
2464
|
else {
|
|
2217
2465
|
this.element.classList.remove(constants.RIBBON_OVERFLOW);
|
|
2218
|
-
for (var
|
|
2219
|
-
var group = groupList[parseInt(
|
|
2220
|
-
var alignType = groupList[parseInt(
|
|
2466
|
+
for (var i_6 = 0; i_6 < groupList.length; i_6++) {
|
|
2467
|
+
var group = groupList[parseInt(i_6.toString(), 10)];
|
|
2468
|
+
var alignType = groupList[parseInt(i_6.toString(), 10)].orientation;
|
|
2221
2469
|
var groupContainer = tabContent.querySelector('#' + group.id + constants.CONTAINER_ID);
|
|
2222
2470
|
var groupContent = groupContainer.querySelector('#' + group.id + constants.CONTENT_ID);
|
|
2223
2471
|
var groupHeader = this.createElement('div', {
|
|
@@ -2289,7 +2537,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2289
2537
|
var itemEle = groupContainer.querySelector('#' + item.id + constants.CONTAINER_ID);
|
|
2290
2538
|
if (!itemEle && overflowtarget) {
|
|
2291
2539
|
itemEle = overflowtarget.querySelector('#' + item.id + constants.CONTAINER_ID);
|
|
2292
|
-
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
2540
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
2293
2541
|
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
|
|
2294
2542
|
}
|
|
2295
2543
|
this.removeOverflowEvent(item, itemEle);
|
|
@@ -2309,6 +2557,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2309
2557
|
(item.allowedSizes & RibbonItemSize.Medium) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
2310
2558
|
item.setProperties({ activeSize: itemsize }, true);
|
|
2311
2559
|
this.setItemSize(ele, item);
|
|
2560
|
+
if (item.type === RibbonItemType.Gallery) {
|
|
2561
|
+
this.ribbonGalleryModule.switchGalleryItems(this.activeLayout, item.id);
|
|
2562
|
+
}
|
|
2312
2563
|
}
|
|
2313
2564
|
if (group.enableGroupOverflow && overflowDDB) {
|
|
2314
2565
|
if (overflowtarget.childElementCount === 0 || (overflowtarget.childElementCount === 1 && this.isHeaderVisible(overflowtarget, group.id))) {
|
|
@@ -2328,7 +2579,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2328
2579
|
this.overflowDDB = null;
|
|
2329
2580
|
}
|
|
2330
2581
|
};
|
|
2331
|
-
Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
|
|
2582
|
+
Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer, tabIndex) {
|
|
2332
2583
|
var _this = this;
|
|
2333
2584
|
var launcherIcon = this.createElement('div', {
|
|
2334
2585
|
className: constants.RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : constants.RIBBON_LAUNCHER_ICON),
|
|
@@ -2343,6 +2594,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2343
2594
|
_this.launcherIconClicked(groupId);
|
|
2344
2595
|
}
|
|
2345
2596
|
}, this);
|
|
2597
|
+
var itemProp = getGroup(this.tabs, groupId);
|
|
2598
|
+
if (itemProp.group.launcherIconKeyTip) {
|
|
2599
|
+
this.addKeyTip(tabIndex, itemProp.group.launcherIconKeyTip, launcherIcon.id, 'launcher');
|
|
2600
|
+
}
|
|
2346
2601
|
};
|
|
2347
2602
|
Ribbon.prototype.launcherIconClicked = function (id) {
|
|
2348
2603
|
var eventArgs = { groupId: id };
|
|
@@ -2380,7 +2635,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2380
2635
|
groupContainer.appendChild(groupHeader);
|
|
2381
2636
|
}
|
|
2382
2637
|
if (group.showLauncherIcon) {
|
|
2383
|
-
this.createLauncherIcon(group.id, groupContainer);
|
|
2638
|
+
this.createLauncherIcon(group.id, groupContainer, tabIndex);
|
|
2384
2639
|
}
|
|
2385
2640
|
var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
|
|
2386
2641
|
append(elements, groupContent);
|
|
@@ -2507,6 +2762,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2507
2762
|
case 'GroupButton':
|
|
2508
2763
|
this.ribbonGroupButtonModule.createGroupButton(item, itemEle);
|
|
2509
2764
|
break;
|
|
2765
|
+
case 'Gallery':
|
|
2766
|
+
this.ribbonGalleryModule.createGallery(item, itemEle);
|
|
2767
|
+
break;
|
|
2510
2768
|
}
|
|
2511
2769
|
};
|
|
2512
2770
|
Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
|
|
@@ -2540,17 +2798,34 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2540
2798
|
itemEle.classList.add(constants.RIBBON_TOOLTIP_TARGET);
|
|
2541
2799
|
this.tooltipData.push({ id: itemEle.id, data: item.ribbonTooltipSettings });
|
|
2542
2800
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2801
|
+
if (item.type === RibbonItemType.GroupButton) {
|
|
2802
|
+
for (var i_7 = 0; i_7 < item.groupButtonSettings.items.length; i_7++) {
|
|
2803
|
+
if (this.keyTipElements[parseInt(tabIndex.toString(), 10)] && item.groupButtonSettings.items[parseInt(i_7.toString(), 10)].keyTip) {
|
|
2804
|
+
this.addKeyTip(tabIndex, item.groupButtonSettings.items[parseInt(i_7.toString(), 10)].keyTip, item.id + (constants.RIBBON_GROUP_BUTTON_ID + i_7), 'item');
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2548
2807
|
}
|
|
2549
|
-
if (
|
|
2550
|
-
|
|
2808
|
+
if (item.keyTip) {
|
|
2809
|
+
if (item.type === RibbonItemType.Gallery) {
|
|
2810
|
+
this.addKeyTip(tabIndex, item.keyTip, (item.id + '_popupButton'), 'item');
|
|
2811
|
+
}
|
|
2812
|
+
else {
|
|
2813
|
+
this.addKeyTip(tabIndex, item.keyTip, item.id, 'item');
|
|
2814
|
+
}
|
|
2551
2815
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2816
|
+
var size = item.activeSize;
|
|
2817
|
+
if (!(item.type === RibbonItemType.Gallery)) {
|
|
2818
|
+
if (this.activeLayout === 'Simplified') {
|
|
2819
|
+
size = ((item.allowedSizes === RibbonItemSize.Large) || (item.allowedSizes & RibbonItemSize.Medium) ||
|
|
2820
|
+
(item.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
2821
|
+
item.setProperties({ activeSize: size }, true);
|
|
2822
|
+
}
|
|
2823
|
+
if (size & RibbonItemSize.Large) {
|
|
2824
|
+
itemEle.classList.add(constants.RIBBON_LARGE_ITEM, constants.RIBBON_CONTENT_HEIGHT);
|
|
2825
|
+
}
|
|
2826
|
+
else {
|
|
2827
|
+
itemEle.classList.add((size & RibbonItemSize.Medium) ? constants.RIBBON_MEDIUM_ITEM : constants.RIBBON_SMALL_ITEM);
|
|
2828
|
+
}
|
|
2554
2829
|
}
|
|
2555
2830
|
var initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
2556
2831
|
if (initialProps && initialProps.hiddenItems && initialProps.hiddenItems.length) {
|
|
@@ -2562,7 +2837,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2562
2837
|
this.createRibbonItem(item, itemEle);
|
|
2563
2838
|
if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
|
|
2564
2839
|
this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
|
|
2565
|
-
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
2840
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
2566
2841
|
this.updatePopupItems(item, itemEle, isGroupOF, true);
|
|
2567
2842
|
}
|
|
2568
2843
|
}
|
|
@@ -2691,15 +2966,15 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2691
2966
|
var moduleName = this.getItemModuleName(item);
|
|
2692
2967
|
if (moduleName !== 'template') {
|
|
2693
2968
|
if (moduleName === 'group-btn' && this.activeLayout === 'Classic') {
|
|
2694
|
-
for (var
|
|
2695
|
-
var btnEle = ele.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID +
|
|
2969
|
+
for (var i_8 = 0; i_8 < item.groupButtonSettings.items.length; i_8++) {
|
|
2970
|
+
var btnEle = ele.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_8);
|
|
2696
2971
|
updateCommonProperty(btnEle, 'btn', commonProp);
|
|
2697
2972
|
}
|
|
2698
2973
|
}
|
|
2699
2974
|
else if (moduleName === 'group-btn' && this.activeLayout === 'Simplified') {
|
|
2700
2975
|
updateCommonProperty(ele, 'dropdown-btn', commonProp);
|
|
2701
|
-
for (var
|
|
2702
|
-
var btnEle = document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID +
|
|
2976
|
+
for (var i_9 = 0; i_9 < item.groupButtonSettings.items.length; i_9++) {
|
|
2977
|
+
var btnEle = document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i_9);
|
|
2703
2978
|
updateCommonProperty(btnEle, 'btn', commonProp);
|
|
2704
2979
|
}
|
|
2705
2980
|
}
|
|
@@ -2759,12 +3034,18 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2759
3034
|
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id + constants.RIBBON_GROUP_BUTTON_ID) :
|
|
2760
3035
|
contentEle.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID);
|
|
2761
3036
|
}
|
|
3037
|
+
if (item.type === RibbonItemType.Gallery) {
|
|
3038
|
+
ele = contentEle.querySelector('#' + item.id + constants.CONTAINER_ID);
|
|
3039
|
+
}
|
|
2762
3040
|
}
|
|
2763
3041
|
}
|
|
2764
3042
|
else {
|
|
2765
3043
|
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
2766
3044
|
ele = (item.displayOptions & DisplayMode.Simplified) ?
|
|
2767
3045
|
contentEle.querySelector('#' + item.id) : null;
|
|
3046
|
+
if (item.type === RibbonItemType.Gallery) {
|
|
3047
|
+
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id + constants.CONTAINER_ID) : null;
|
|
3048
|
+
}
|
|
2768
3049
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
2769
3050
|
if (!ele) {
|
|
2770
3051
|
ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
|
|
@@ -2805,18 +3086,42 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2805
3086
|
else {
|
|
2806
3087
|
this.ribbonGroupButtonModule.destroyDropDown(item);
|
|
2807
3088
|
}
|
|
2808
|
-
var
|
|
3089
|
+
var _loop_4 = function (i) {
|
|
2809
3090
|
if (item.groupButtonSettings.items[parseInt(i.toString(), 10)].ribbonTooltipSettings) {
|
|
2810
3091
|
var groupButtonID_1 = item.id + constants.RIBBON_GROUP_BUTTON_ID + i;
|
|
2811
|
-
var index = getIndex(
|
|
3092
|
+
var index = getIndex(this_4.tooltipData, function (e) { return e.id === groupButtonID_1; });
|
|
2812
3093
|
if (index !== -1) {
|
|
2813
|
-
|
|
3094
|
+
this_4.tooltipData.splice(index, 1);
|
|
2814
3095
|
}
|
|
2815
3096
|
}
|
|
2816
3097
|
};
|
|
2817
|
-
var
|
|
3098
|
+
var this_4 = this;
|
|
2818
3099
|
for (var i = 0; i < item.groupButtonSettings.items.length; i++) {
|
|
2819
|
-
|
|
3100
|
+
_loop_4(i);
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
else if (moduleName === 'gallery') {
|
|
3104
|
+
if (ele.closest('.e-ribbon-overflow-target')) {
|
|
3105
|
+
destroyControl(ele, 'dropdown-btn');
|
|
3106
|
+
var galleryPopupEle = Array.prototype.slice.call(document.querySelectorAll('#' + item.id + '_galleryPopup'));
|
|
3107
|
+
galleryPopupEle.concat(Array.prototype.slice.call(document.querySelectorAll('#' + item.id + '-popup')));
|
|
3108
|
+
for (var i = 0; i < galleryPopupEle.length; i++) {
|
|
3109
|
+
galleryPopupEle[parseInt(i.toString(), 10)].remove();
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
else {
|
|
3113
|
+
var galleryEle = ele.querySelectorAll('.e-ribbon-gallery-item');
|
|
3114
|
+
var galleryPopupBtn = ele.querySelector('#' + item.id + '_popupButton');
|
|
3115
|
+
if (galleryPopupBtn) {
|
|
3116
|
+
galleryPopupBtn.remove();
|
|
3117
|
+
}
|
|
3118
|
+
for (var i = 0; i < galleryEle.length; i++) {
|
|
3119
|
+
galleryEle[parseInt(i.toString(), 10)].remove();
|
|
3120
|
+
}
|
|
3121
|
+
var galleryPopupEle = document.querySelectorAll('#' + item.id + '_galleryPopup');
|
|
3122
|
+
for (var i = 0; i < galleryPopupEle.length; i++) {
|
|
3123
|
+
galleryPopupEle[parseInt(i.toString(), 10)].remove();
|
|
3124
|
+
}
|
|
2820
3125
|
}
|
|
2821
3126
|
}
|
|
2822
3127
|
else if (moduleName !== 'template') {
|
|
@@ -2832,6 +3137,13 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2832
3137
|
this.ribbonGroupButtonModule.destroyDropDown(item);
|
|
2833
3138
|
}
|
|
2834
3139
|
};
|
|
3140
|
+
/**
|
|
3141
|
+
* Gets the item module name.
|
|
3142
|
+
*
|
|
3143
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
3144
|
+
* @returns {void}
|
|
3145
|
+
* @hidden
|
|
3146
|
+
*/
|
|
2835
3147
|
Ribbon.prototype.getItemModuleName = function (item) {
|
|
2836
3148
|
switch (item.type) {
|
|
2837
3149
|
case 'Button':
|
|
@@ -2848,6 +3160,8 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2848
3160
|
return 'combobox';
|
|
2849
3161
|
case 'GroupButton':
|
|
2850
3162
|
return 'group-btn';
|
|
3163
|
+
case 'Gallery':
|
|
3164
|
+
return 'gallery';
|
|
2851
3165
|
default:
|
|
2852
3166
|
return 'template';
|
|
2853
3167
|
}
|
|
@@ -2887,8 +3201,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2887
3201
|
* @param {string} tabId - The ID of the tab to be shown.
|
|
2888
3202
|
* @returns {void}
|
|
2889
3203
|
*/
|
|
2890
|
-
Ribbon.prototype.showTab = function (tabId) {
|
|
2891
|
-
|
|
3204
|
+
Ribbon.prototype.showTab = function (tabId, isContextual) {
|
|
3205
|
+
if (isContextual === void 0) { isContextual = false; }
|
|
3206
|
+
this.showHideTab(tabId, false, isContextual);
|
|
2892
3207
|
};
|
|
2893
3208
|
/**
|
|
2894
3209
|
* Hides a specific tab in the ribbon.
|
|
@@ -2896,15 +3211,49 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
2896
3211
|
* @param {string} tabId - The ID of the tab to be hidden.
|
|
2897
3212
|
* @returns {void}
|
|
2898
3213
|
*/
|
|
2899
|
-
Ribbon.prototype.hideTab = function (tabId) {
|
|
2900
|
-
|
|
3214
|
+
Ribbon.prototype.hideTab = function (tabId, isContextual) {
|
|
3215
|
+
if (isContextual === void 0) { isContextual = false; }
|
|
3216
|
+
this.showHideTab(tabId, true, isContextual);
|
|
2901
3217
|
};
|
|
2902
|
-
Ribbon.prototype.showHideTab = function (tabId, value) {
|
|
3218
|
+
Ribbon.prototype.showHideTab = function (tabId, value, isContextual) {
|
|
2903
3219
|
var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
|
|
2904
3220
|
if (index === -1) {
|
|
2905
3221
|
return;
|
|
2906
3222
|
}
|
|
2907
3223
|
this.tabObj.hideTab(index, value);
|
|
3224
|
+
if (isContextual) {
|
|
3225
|
+
var contextualTab_1;
|
|
3226
|
+
var tabEle = this.tabObj.element;
|
|
3227
|
+
for (var i = 0; i < this.contextualTabs.length; i++) {
|
|
3228
|
+
for (var j = 0; j < this.contextualTabs[parseInt(i.toString(), 10)].tabs.length; j++) {
|
|
3229
|
+
if (tabId === this.contextualTabs[parseInt(i.toString(), 10)].tabs[parseInt(j.toString(), 10)].id) {
|
|
3230
|
+
contextualTab_1 = this.contextualTabs[parseInt(i.toString(), 10)];
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
if (contextualTab_1) {
|
|
3235
|
+
var isTabHidden = true;
|
|
3236
|
+
var _loop_5 = function (i) {
|
|
3237
|
+
var index_1 = getIndex(this_5.tabs, function (e) { return e.id === contextualTab_1.tabs[parseInt(i.toString(), 10)].id; });
|
|
3238
|
+
if (index_1 !== -1) {
|
|
3239
|
+
var toolbarEle = tabEle.querySelectorAll('.e-toolbar-item')[parseInt(index_1.toString(), 10)];
|
|
3240
|
+
if (!(toolbarEle.classList.contains('e-hidden'))) {
|
|
3241
|
+
isTabHidden = false;
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
var this_5 = this;
|
|
3246
|
+
for (var i = 0; i < contextualTab_1.tabs.length; i++) {
|
|
3247
|
+
_loop_5(i);
|
|
3248
|
+
}
|
|
3249
|
+
if (isTabHidden) {
|
|
3250
|
+
contextualTab_1.setProperties({ visible: false }, true);
|
|
3251
|
+
}
|
|
3252
|
+
else {
|
|
3253
|
+
contextualTab_1.setProperties({ visible: true }, true);
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
2908
3257
|
};
|
|
2909
3258
|
/**
|
|
2910
3259
|
* Enables a specific tab in the ribbon.
|
|
@@ -3211,8 +3560,8 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3211
3560
|
var hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
|
|
3212
3561
|
/* eslint-disable */
|
|
3213
3562
|
if (hiddenProps && hiddenProps[key] && hiddenProps[key].length) {
|
|
3214
|
-
var
|
|
3215
|
-
var contentEle =
|
|
3563
|
+
var _loop_6 = function (i) {
|
|
3564
|
+
var contentEle = this_6.tabObj.items[tabIndex].content;
|
|
3216
3565
|
var hiddenEle;
|
|
3217
3566
|
var groupEle = void 0;
|
|
3218
3567
|
var isGroupHidden = false;
|
|
@@ -3234,11 +3583,11 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3234
3583
|
groupEle = hiddenEle.closest('.e-ribbon-group');
|
|
3235
3584
|
if (groupEle.classList.contains('e-hide-group')) {
|
|
3236
3585
|
isGroupHidden = true;
|
|
3237
|
-
widthDifference =
|
|
3586
|
+
widthDifference = this_6.checkWidthDifference(hiddenEle, groupEle);
|
|
3238
3587
|
}
|
|
3239
3588
|
}
|
|
3240
|
-
|
|
3241
|
-
|
|
3589
|
+
this_6.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, true, tabIndex);
|
|
3590
|
+
this_6.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, true);
|
|
3242
3591
|
if (isHidden) {
|
|
3243
3592
|
hiddenEle.classList.add('e-hidden');
|
|
3244
3593
|
}
|
|
@@ -3251,12 +3600,12 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3251
3600
|
groupEle.classList.remove('e-hide-group');
|
|
3252
3601
|
groupEle.classList.remove('e-ribbon-emptyCollection');
|
|
3253
3602
|
widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
|
|
3254
|
-
if (
|
|
3255
|
-
|
|
3603
|
+
if (this_6.hiddenGroups.indexOf(groupEle.id) !== -1) {
|
|
3604
|
+
this_6.hiddenGroups.splice(this_6.hiddenGroups.indexOf(groupEle.id), 1);
|
|
3256
3605
|
}
|
|
3257
3606
|
}
|
|
3258
3607
|
else {
|
|
3259
|
-
if (
|
|
3608
|
+
if (this_6.hiddenGroups.indexOf(groupEle.id) !== -1) {
|
|
3260
3609
|
var hiddenItems = groupEle.querySelectorAll('.e-ribbon-item:not(.e-hidden)');
|
|
3261
3610
|
hiddenItems.forEach(function (item) {
|
|
3262
3611
|
if (item.id !== hiddenEle.id) {
|
|
@@ -3269,12 +3618,12 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3269
3618
|
item.classList.remove('e-hidden');
|
|
3270
3619
|
}
|
|
3271
3620
|
});
|
|
3272
|
-
|
|
3621
|
+
this_6.hiddenGroups.splice(this_6.hiddenGroups.indexOf(groupEle.id), 1);
|
|
3273
3622
|
}
|
|
3274
3623
|
}
|
|
3275
3624
|
}
|
|
3276
|
-
|
|
3277
|
-
|
|
3625
|
+
this_6.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, false, tabIndex);
|
|
3626
|
+
this_6.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, false);
|
|
3278
3627
|
}
|
|
3279
3628
|
if (isGroupHidden) {
|
|
3280
3629
|
groupEle.classList.add('e-hide-group');
|
|
@@ -3288,9 +3637,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3288
3637
|
}
|
|
3289
3638
|
out_i_1 = i;
|
|
3290
3639
|
};
|
|
3291
|
-
var
|
|
3640
|
+
var this_6 = this, out_i_1;
|
|
3292
3641
|
for (var i = 0; i < hiddenProps[key].length; i++) {
|
|
3293
|
-
|
|
3642
|
+
_loop_6(i);
|
|
3294
3643
|
i = out_i_1;
|
|
3295
3644
|
}
|
|
3296
3645
|
}
|
|
@@ -3341,9 +3690,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3341
3690
|
var overflowButton = getInstance(groupOFButton[parseInt(i.toString(), 10)], DropDownButton);
|
|
3342
3691
|
var overflowBtnTarget = overflowButton.target;
|
|
3343
3692
|
var overflowItems = overflowBtnTarget.querySelectorAll('.e-ribbon-item');
|
|
3344
|
-
for (var
|
|
3345
|
-
if (overflowItems[parseInt(
|
|
3346
|
-
mediumDataItems.push(overflowItems[parseInt(
|
|
3693
|
+
for (var i_10 = 0; i_10 < overflowItems.length; i_10++) {
|
|
3694
|
+
if (overflowItems[parseInt(i_10.toString(), 10)].hasAttribute('data-medium-width')) {
|
|
3695
|
+
mediumDataItems.push(overflowItems[parseInt(i_10.toString(), 10)]);
|
|
3347
3696
|
}
|
|
3348
3697
|
}
|
|
3349
3698
|
}
|
|
@@ -3370,10 +3719,10 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3370
3719
|
if (overflowButton) {
|
|
3371
3720
|
var overflowEle = overflowButton.target;
|
|
3372
3721
|
var overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
|
|
3373
|
-
for (var
|
|
3374
|
-
var previousWidth = parseInt(overflowItems[parseInt(
|
|
3722
|
+
for (var i_11 = 0; i_11 < overflowItems.length; i_11++) {
|
|
3723
|
+
var previousWidth = parseInt(overflowItems[parseInt(i_11.toString(), 10)].getAttribute('data-simplified-width'), 10);
|
|
3375
3724
|
if (previousWidth) {
|
|
3376
|
-
overflowItems[parseInt(
|
|
3725
|
+
overflowItems[parseInt(i_11.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
|
|
3377
3726
|
}
|
|
3378
3727
|
}
|
|
3379
3728
|
}
|
|
@@ -3923,7 +4272,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
3923
4272
|
if (contentEle.innerHTML !== '') {
|
|
3924
4273
|
// Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
|
|
3925
4274
|
if (group.showLauncherIcon) {
|
|
3926
|
-
this.createLauncherIcon(ribbongroup.id, groupContainer);
|
|
4275
|
+
this.createLauncherIcon(ribbongroup.id, groupContainer, itemProp.tabIndex);
|
|
3927
4276
|
}
|
|
3928
4277
|
// Check whether collections or orientation is passed by the user and sets the updated values.
|
|
3929
4278
|
if (group.collections || group.orientation) {
|
|
@@ -4072,7 +4421,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4072
4421
|
}
|
|
4073
4422
|
if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
|
|
4074
4423
|
this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
|
|
4075
|
-
if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
4424
|
+
if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton) || (item.type === RibbonItemType.Gallery)) {
|
|
4076
4425
|
this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
|
|
4077
4426
|
}
|
|
4078
4427
|
}
|
|
@@ -4179,6 +4528,15 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4179
4528
|
Ribbon.prototype.disableItem = function (itemId) {
|
|
4180
4529
|
this.enableDisableItem(itemId, true);
|
|
4181
4530
|
};
|
|
4531
|
+
/**
|
|
4532
|
+
* Gets the Ribbon item model associated with the specified item ID.
|
|
4533
|
+
*
|
|
4534
|
+
* @param {string} itemId - The unique ID of the Ribbon item.
|
|
4535
|
+
* @returns {RibbonItemModel}
|
|
4536
|
+
*/
|
|
4537
|
+
Ribbon.prototype.getItem = function (itemId) {
|
|
4538
|
+
return getItem(this.tabs, itemId).item;
|
|
4539
|
+
};
|
|
4182
4540
|
Ribbon.prototype.enableDisableItem = function (itemId, isDisabled) {
|
|
4183
4541
|
var isUpdated = false;
|
|
4184
4542
|
var itemProp = getItem(this.tabs, itemId);
|
|
@@ -4226,6 +4584,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4226
4584
|
};
|
|
4227
4585
|
Ribbon.prototype.unwireEvents = function () {
|
|
4228
4586
|
EventHandler.remove(window, 'resize', this.resizeHandler);
|
|
4587
|
+
EventHandler.remove(document.body, 'keydown', this.keytipActionHandler);
|
|
4588
|
+
EventHandler.remove(document, 'mousedown', this.mouseEventHandler);
|
|
4589
|
+
EventHandler.remove(document, 'scroll', this.mouseEventHandler);
|
|
4229
4590
|
};
|
|
4230
4591
|
Ribbon.prototype.destroy = function () {
|
|
4231
4592
|
this.keyboardModuleRibbon.destroy();
|
|
@@ -4253,6 +4614,7 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4253
4614
|
this.initialPropsData = {};
|
|
4254
4615
|
this.hiddenGroups = [];
|
|
4255
4616
|
this.hiddenElements = {};
|
|
4617
|
+
this.keyTipElements = {};
|
|
4256
4618
|
remove(this.element.querySelector('#' + this.element.id + constants.TAB_ID));
|
|
4257
4619
|
this.element.style.removeProperty(constants.RIBBON_FILE_MENU_WIDTH);
|
|
4258
4620
|
this.element.style.removeProperty(constants.RIBBON_HELP_PANE_TEMPLATE_WIDTH);
|
|
@@ -4332,7 +4694,11 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4332
4694
|
}
|
|
4333
4695
|
break;
|
|
4334
4696
|
case 'selectedTab':
|
|
4335
|
-
this.tabObj.
|
|
4697
|
+
var tabEle = this.tabObj.element;
|
|
4698
|
+
var toolbarItem = tabEle.querySelectorAll('.e-toolbar-item')[parseInt(newProp.selectedTab.toString(), 10)];
|
|
4699
|
+
if (!(toolbarItem.classList.contains('e-hidden') || toolbarItem.classList.contains('e-disable'))) {
|
|
4700
|
+
this.tabObj.setProperties({ selectedItem: newProp.selectedTab });
|
|
4701
|
+
}
|
|
4336
4702
|
break;
|
|
4337
4703
|
case 'tabAnimation':
|
|
4338
4704
|
this.tabObj.setProperties({ animation: newProp.tabAnimation });
|
|
@@ -4340,6 +4706,13 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4340
4706
|
case 'tabs':
|
|
4341
4707
|
this.reRenderTabs(newProp.tabs);
|
|
4342
4708
|
break;
|
|
4709
|
+
case 'contextualTabs':
|
|
4710
|
+
for (var i = 0; i < this.contextualTabs.length; i++) {
|
|
4711
|
+
if (newProp.contextualTabs[parseInt(i.toString(), 10)]) {
|
|
4712
|
+
this.ribbonContextualTabModule.updateContextualTabs(newProp.contextualTabs[parseInt(i.toString(), 10)], this.contextualTabs[parseInt(i.toString(), 10)]);
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
break;
|
|
4343
4716
|
case 'width':
|
|
4344
4717
|
this.element.style.width = formatUnit(newProp.width);
|
|
4345
4718
|
this.refreshLayout();
|
|
@@ -4383,6 +4756,12 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4383
4756
|
__decorate([
|
|
4384
4757
|
Property('')
|
|
4385
4758
|
], Ribbon.prototype, "cssClass", void 0);
|
|
4759
|
+
__decorate([
|
|
4760
|
+
Property(false)
|
|
4761
|
+
], Ribbon.prototype, "enableKeyTips", void 0);
|
|
4762
|
+
__decorate([
|
|
4763
|
+
Property('')
|
|
4764
|
+
], Ribbon.prototype, "layoutSwitcherKeyTip", void 0);
|
|
4386
4765
|
__decorate([
|
|
4387
4766
|
Complex({}, FileMenuSettings)
|
|
4388
4767
|
], Ribbon.prototype, "fileMenu", void 0);
|
|
@@ -4407,6 +4786,9 @@ var Ribbon = /** @class */ (function (_super) {
|
|
|
4407
4786
|
__decorate([
|
|
4408
4787
|
Collection([], RibbonTab)
|
|
4409
4788
|
], Ribbon.prototype, "tabs", void 0);
|
|
4789
|
+
__decorate([
|
|
4790
|
+
Collection([], RibbonContextualTabSettings)
|
|
4791
|
+
], Ribbon.prototype, "contextualTabs", void 0);
|
|
4410
4792
|
__decorate([
|
|
4411
4793
|
Property('100%')
|
|
4412
4794
|
], Ribbon.prototype, "width", void 0);
|