@syncfusion/ej2-ribbon 24.1.41 → 24.1.46
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 +60 -0
- package/README.md +8 -7
- 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 +362 -27
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +382 -42
- 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/ribbon.d.ts +9 -0
- package/src/ribbon/base/ribbon.js +368 -34
- package/src/ribbon/items/ribbon-groupbutton.d.ts +1 -0
- package/src/ribbon/items/ribbon-groupbutton.js +14 -8
|
@@ -3001,10 +3001,7 @@ class RibbonGroupButton {
|
|
|
3001
3001
|
this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
|
|
3002
3002
|
}
|
|
3003
3003
|
buttonEle.onclick = buttonEle.onkeydown = () => {
|
|
3004
|
-
|
|
3005
|
-
document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
|
|
3006
|
-
this.grpBtnIndex = 0;
|
|
3007
|
-
}
|
|
3004
|
+
this.handleFocusState(item, itemElement);
|
|
3008
3005
|
};
|
|
3009
3006
|
btnContainerEle.onkeydown = (e) => {
|
|
3010
3007
|
if (this.parent.activeLayout === 'Simplified') {
|
|
@@ -3174,10 +3171,7 @@ class RibbonGroupButton {
|
|
|
3174
3171
|
this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
|
|
3175
3172
|
}
|
|
3176
3173
|
buttonEle.onclick = buttonEle.onkeydown = () => {
|
|
3177
|
-
|
|
3178
|
-
document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
|
|
3179
|
-
this.grpBtnIndex = 0;
|
|
3180
|
-
}
|
|
3174
|
+
this.handleFocusState(item, itemElement);
|
|
3181
3175
|
};
|
|
3182
3176
|
containerEle.onkeydown = (e) => {
|
|
3183
3177
|
if (this.parent.activeLayout === 'Simplified') {
|
|
@@ -3196,6 +3190,18 @@ class RibbonGroupButton {
|
|
|
3196
3190
|
}
|
|
3197
3191
|
}
|
|
3198
3192
|
}
|
|
3193
|
+
handleFocusState(item, itemElement) {
|
|
3194
|
+
if (itemElement.querySelector('#' + item.id).classList.contains('e-active')) {
|
|
3195
|
+
const defaultSelectedBtn = document.querySelector('#' + item.id + '_grpbtn').querySelector('.' + RIBBON_GROUP_BUTTON + '.e-active');
|
|
3196
|
+
if (defaultSelectedBtn) {
|
|
3197
|
+
defaultSelectedBtn.focus();
|
|
3198
|
+
}
|
|
3199
|
+
else {
|
|
3200
|
+
document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
|
|
3201
|
+
}
|
|
3202
|
+
this.grpBtnIndex = 0;
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3199
3205
|
addGroupButtonHeader(itemID, groupBtnSettings, popupEle) {
|
|
3200
3206
|
const groupButtonHeader = this.parent.createElement('div', {
|
|
3201
3207
|
className: 'e-ribbon-groupbutton-header',
|
|
@@ -3395,6 +3401,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3395
3401
|
this.idIndex = 0;
|
|
3396
3402
|
this.tooltipData = [];
|
|
3397
3403
|
this.initialPropsData = {};
|
|
3404
|
+
this.hiddenElements = {};
|
|
3405
|
+
this.hiddenGroups = [];
|
|
3398
3406
|
this.isAddRemove = false;
|
|
3399
3407
|
this.keyConfigs = {
|
|
3400
3408
|
leftarrow: 'leftarrow',
|
|
@@ -3766,6 +3774,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3766
3774
|
selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
|
|
3767
3775
|
const eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex };
|
|
3768
3776
|
this.setProperties({ selectedTab: selectedIndex }, true);
|
|
3777
|
+
this.calculateHiddenElementsWidth(selectedIndex);
|
|
3769
3778
|
this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
|
|
3770
3779
|
if (this.activeLayout === 'Simplified' && this.overflowDDB) {
|
|
3771
3780
|
const overflowTarget = this.overflowDDB.target;
|
|
@@ -3889,6 +3898,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3889
3898
|
const orderedGroups = this.getGroupResizeOrder(true, tabIndex);
|
|
3890
3899
|
let isEmptyCollection;
|
|
3891
3900
|
for (let i = 0; ((i < orderedGroups.length) && (tabContent.offsetWidth < activeContent.offsetWidth)); i++) {
|
|
3901
|
+
let isGroupUpdated = false;
|
|
3892
3902
|
const group = orderedGroups[parseInt(i.toString(), 10)];
|
|
3893
3903
|
const groupEle = tabContent.querySelector('#' + group.id);
|
|
3894
3904
|
const groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
|
|
@@ -3900,7 +3910,67 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3900
3910
|
const itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3901
3911
|
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3902
3912
|
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
3903
|
-
|
|
3913
|
+
let groupHidden = false;
|
|
3914
|
+
let itemHidden = false;
|
|
3915
|
+
let isAllItemHidden = false;
|
|
3916
|
+
let isEmptyCollection = false;
|
|
3917
|
+
let groupItems;
|
|
3918
|
+
if (groupEle.classList.contains('e-hidden') || groupEle.classList.contains('e-hide-group')) {
|
|
3919
|
+
groupItems = groupEle.querySelectorAll('.e-ribbon-item.e-hidden');
|
|
3920
|
+
if (groupItems.length) {
|
|
3921
|
+
for (let i = 0; i < groupItems.length; i++) {
|
|
3922
|
+
groupItems[parseInt(i.toString(), 10)].classList.remove('e-hidden');
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
if (groupEle.classList.contains('e-hide-group')) {
|
|
3926
|
+
isAllItemHidden = true;
|
|
3927
|
+
groupEle.classList.remove('e-hide-group');
|
|
3928
|
+
groupEle.classList.remove('e-ribbon-emptyCollection');
|
|
3929
|
+
if (this.hiddenGroups.indexOf(groupEle.id) !== -1) {
|
|
3930
|
+
this.hiddenGroups.splice(this.hiddenGroups.indexOf(groupEle.id), 1);
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
else {
|
|
3934
|
+
groupHidden = true;
|
|
3935
|
+
groupEle.classList.remove('e-hidden');
|
|
3936
|
+
}
|
|
3937
|
+
if (!isGroupUpdated) {
|
|
3938
|
+
this.calculateOverflowItemsWidth(groupEle.offsetWidth, false, tabIndex);
|
|
3939
|
+
this.calculateMediumDataWidth(groupEle.offsetWidth, tabIndex, false);
|
|
3940
|
+
isGroupUpdated = true;
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
else {
|
|
3944
|
+
if (itemContainer.classList.contains('e-hidden')) {
|
|
3945
|
+
itemHidden = true;
|
|
3946
|
+
itemContainer.classList.remove('e-hidden');
|
|
3947
|
+
if (groupEle.classList.contains('e-ribbon-emptyCollection')) {
|
|
3948
|
+
isEmptyCollection = true;
|
|
3949
|
+
groupEle.classList.remove('e-ribbon-emptyCollection');
|
|
3950
|
+
}
|
|
3951
|
+
this.calculateOverflowItemsWidth(itemContainer.offsetWidth, false, tabIndex);
|
|
3952
|
+
this.calculateMediumDataWidth(itemContainer.offsetWidth, tabIndex, false);
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
itemContainer.setAttribute('data-simplified-width', (activeContent.offsetWidth).toString());
|
|
3956
|
+
if (itemHidden) {
|
|
3957
|
+
itemContainer.classList.add('e-hidden');
|
|
3958
|
+
}
|
|
3959
|
+
if (groupItems && groupItems.length) {
|
|
3960
|
+
for (let i = 0; i < groupItems.length; i++) {
|
|
3961
|
+
groupItems[parseInt(i.toString(), 10)].classList.add('e-hidden');
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
if (groupHidden) {
|
|
3965
|
+
groupEle.classList.add('e-hidden');
|
|
3966
|
+
}
|
|
3967
|
+
if (isAllItemHidden) {
|
|
3968
|
+
groupEle.classList.add('e-hide-group');
|
|
3969
|
+
groupEle.classList.add('e-ribbon-emptyCollection');
|
|
3970
|
+
}
|
|
3971
|
+
if (isEmptyCollection) {
|
|
3972
|
+
groupEle.classList.add('e-ribbon-emptyCollection');
|
|
3973
|
+
}
|
|
3904
3974
|
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer, true);
|
|
3905
3975
|
if (item.activeSize === RibbonItemSize.Small) {
|
|
3906
3976
|
const itemEle = itemContainer.querySelector('#' + item.id);
|
|
@@ -3992,7 +4062,11 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3992
4062
|
}
|
|
3993
4063
|
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3994
4064
|
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
3995
|
-
|
|
4065
|
+
let width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
|
|
4066
|
+
const groupItemEle = tabContent.querySelector('#' + group.id);
|
|
4067
|
+
if (itemContainer.classList.contains('e-hidden') || groupItemEle.classList.contains('e-hidden')) {
|
|
4068
|
+
width = Math.abs(width - activeContent.offsetWidth);
|
|
4069
|
+
}
|
|
3996
4070
|
if (!isClear && (tabContent.offsetWidth < width)) {
|
|
3997
4071
|
flag = false;
|
|
3998
4072
|
break;
|
|
@@ -4002,22 +4076,42 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4002
4076
|
this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, false);
|
|
4003
4077
|
}
|
|
4004
4078
|
groupEle.append(itemContainer);
|
|
4079
|
+
if (itemContainer.classList.contains('e-hidden') || groupItemEle.classList.contains('e-hidden')) {
|
|
4080
|
+
itemContainer.setAttribute('data-simplified-width', width.toString());
|
|
4081
|
+
let isGroupHidden = false;
|
|
4082
|
+
let widthDifference = 0;
|
|
4083
|
+
if (itemContainer.classList.contains('e-hidden')) {
|
|
4084
|
+
itemContainer.classList.remove('e-hidden');
|
|
4085
|
+
if (groupItemEle.classList.contains('e-hide-group')) {
|
|
4086
|
+
isGroupHidden = true;
|
|
4087
|
+
widthDifference = this.checkWidthDifference(itemContainer, groupItemEle);
|
|
4088
|
+
}
|
|
4089
|
+
width = itemContainer.offsetWidth + widthDifference;
|
|
4090
|
+
itemContainer.classList.add('e-hidden');
|
|
4091
|
+
}
|
|
4092
|
+
this.calculateOverflowItemsWidth(width, true, tabIndex);
|
|
4093
|
+
this.calculateMediumDataWidth(width, tabIndex, true);
|
|
4094
|
+
if (isGroupHidden) {
|
|
4095
|
+
groupItemEle.classList.add('e-hide-group');
|
|
4096
|
+
groupItemEle.classList.add('e-ribbon-emptyCollection');
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4005
4099
|
this.removeOverflowEvent(item, itemContainer);
|
|
4006
4100
|
if (item.allowedSizes & RibbonItemSize.Small) {
|
|
4007
4101
|
item.setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
4008
4102
|
this.setItemSize(itemContainer.querySelector('#' + item.id), item);
|
|
4009
4103
|
}
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4104
|
+
const groupElement = tabContent.querySelector('#' + group.id);
|
|
4105
|
+
const itemEle = groupElement.querySelector('.' + RIBBON_ITEM);
|
|
4106
|
+
if (groupElement.classList.contains('e-ribbon-emptyCollection') && itemEle !== null) {
|
|
4107
|
+
let itemsLength = groupElement.querySelectorAll('.' + RIBBON_ITEM);
|
|
4108
|
+
if (itemsLength) {
|
|
4109
|
+
isEmptyCollection = this.checkEmptyCollection(itemsLength);
|
|
4110
|
+
if (!isEmptyCollection) {
|
|
4111
|
+
groupElement.classList.remove('e-ribbon-emptyCollection');
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4021
4115
|
}
|
|
4022
4116
|
}
|
|
4023
4117
|
}
|
|
@@ -4039,7 +4133,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4039
4133
|
}
|
|
4040
4134
|
}
|
|
4041
4135
|
}
|
|
4042
|
-
|
|
4136
|
+
}
|
|
4137
|
+
for (let i = 0; i < orderedGroups.length; i++) {
|
|
4138
|
+
this.checkOverflowHiddenItems(orderedGroups[parseInt(i.toString(), 10)].enableGroupOverflow, tabIndex, orderedGroups[parseInt(i.toString(), 10)].id);
|
|
4043
4139
|
}
|
|
4044
4140
|
if (this.overflowDDB) {
|
|
4045
4141
|
const overflowEle = this.overflowDDB.target;
|
|
@@ -6328,7 +6424,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6328
6424
|
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
6329
6425
|
const groupEle = contentEle.querySelector('#' + groupID);
|
|
6330
6426
|
if (groupEle) {
|
|
6331
|
-
isHidden ?
|
|
6427
|
+
this.updateHiddenElements(itemProp.tabIndex, isHidden ? 'hideGroup' : 'showGroup', groupID, isHidden, groupEle);
|
|
6332
6428
|
}
|
|
6333
6429
|
else {
|
|
6334
6430
|
this.updateInitialProps(itemProp.tabIndex, groupID, 'hiddenGroups', isHidden);
|
|
@@ -6353,7 +6449,239 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6353
6449
|
}
|
|
6354
6450
|
}
|
|
6355
6451
|
}
|
|
6356
|
-
this.
|
|
6452
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
6453
|
+
this.refreshLayout();
|
|
6454
|
+
}
|
|
6455
|
+
}
|
|
6456
|
+
updateHiddenElements(tabIndex, key, id, isHidden, element, group) {
|
|
6457
|
+
if (isHidden) {
|
|
6458
|
+
if (!(element.classList.contains('e-hidden'))) {
|
|
6459
|
+
this.checkHiddenElements(key, id, tabIndex);
|
|
6460
|
+
element.classList.add('e-hidden');
|
|
6461
|
+
if (key === 'hideItem') {
|
|
6462
|
+
this.checkHiddenItems(group, isHidden, tabIndex);
|
|
6463
|
+
}
|
|
6464
|
+
this.calculateHiddenElementsWidth(tabIndex);
|
|
6465
|
+
}
|
|
6466
|
+
}
|
|
6467
|
+
else {
|
|
6468
|
+
if (element.classList.contains('e-hidden')) {
|
|
6469
|
+
this.checkHiddenElements(key, id, tabIndex);
|
|
6470
|
+
element.classList.remove('e-hidden');
|
|
6471
|
+
this.calculateHiddenElementsWidth(tabIndex);
|
|
6472
|
+
if (key === 'showItem') {
|
|
6473
|
+
this.checkHiddenItems(group, isHidden, tabIndex);
|
|
6474
|
+
}
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
}
|
|
6478
|
+
checkHiddenElements(key, id, tabIndex) {
|
|
6479
|
+
if (this.activeLayout === 'Simplified') {
|
|
6480
|
+
let hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
|
|
6481
|
+
if (!hiddenProps) {
|
|
6482
|
+
this.hiddenElements[parseInt(tabIndex.toString(), 10)] = {};
|
|
6483
|
+
hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
|
|
6484
|
+
}
|
|
6485
|
+
if (hiddenProps) {
|
|
6486
|
+
/* eslint-disable */
|
|
6487
|
+
if (!hiddenProps[key]) {
|
|
6488
|
+
hiddenProps[key] = [];
|
|
6489
|
+
}
|
|
6490
|
+
if (hiddenProps[key].length) {
|
|
6491
|
+
let index = hiddenProps[key].indexOf(id);
|
|
6492
|
+
if (index === -1) {
|
|
6493
|
+
hiddenProps[key].push(id);
|
|
6494
|
+
}
|
|
6495
|
+
}
|
|
6496
|
+
else {
|
|
6497
|
+
hiddenProps[key].push(id);
|
|
6498
|
+
}
|
|
6499
|
+
/* eslint-enable */
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
updateItemsSimplifiedWidth(tabIndex, key) {
|
|
6504
|
+
let hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
|
|
6505
|
+
/* eslint-disable */
|
|
6506
|
+
if (hiddenProps && hiddenProps[key] && hiddenProps[key].length) {
|
|
6507
|
+
for (let i = 0; i < hiddenProps[key].length; i++) {
|
|
6508
|
+
const contentEle = this.tabObj.items[tabIndex].content;
|
|
6509
|
+
let hiddenEle;
|
|
6510
|
+
let groupEle;
|
|
6511
|
+
let isGroupHidden = false;
|
|
6512
|
+
let widthDifference = 0;
|
|
6513
|
+
if (key === 'hideGroup' || key === 'showGroup') {
|
|
6514
|
+
hiddenEle = contentEle.querySelector('#' + hiddenProps[key][i]);
|
|
6515
|
+
}
|
|
6516
|
+
else {
|
|
6517
|
+
hiddenEle = contentEle.querySelector('#' + hiddenProps[key][i] + CONTAINER_ID);
|
|
6518
|
+
}
|
|
6519
|
+
if (hiddenEle) {
|
|
6520
|
+
if (key === 'hideGroup' || key === 'hideItem') {
|
|
6521
|
+
let isHidden = false;
|
|
6522
|
+
if (hiddenEle.classList.contains('e-hidden')) {
|
|
6523
|
+
isHidden = true;
|
|
6524
|
+
hiddenEle.classList.remove('e-hidden');
|
|
6525
|
+
}
|
|
6526
|
+
if (key === 'hideItem') {
|
|
6527
|
+
groupEle = hiddenEle.closest('.e-ribbon-group');
|
|
6528
|
+
if (groupEle.classList.contains('e-hide-group')) {
|
|
6529
|
+
isGroupHidden = true;
|
|
6530
|
+
widthDifference = this.checkWidthDifference(hiddenEle, groupEle);
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
this.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, true, tabIndex);
|
|
6534
|
+
this.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, true);
|
|
6535
|
+
if (isHidden) {
|
|
6536
|
+
hiddenEle.classList.add('e-hidden');
|
|
6537
|
+
}
|
|
6538
|
+
}
|
|
6539
|
+
else {
|
|
6540
|
+
if (key === 'showItem') {
|
|
6541
|
+
groupEle = hiddenEle.closest('.e-ribbon-group');
|
|
6542
|
+
if (groupEle.classList.contains('e-hide-group')) {
|
|
6543
|
+
isGroupHidden = true;
|
|
6544
|
+
groupEle.classList.remove('e-hide-group');
|
|
6545
|
+
groupEle.classList.remove('e-ribbon-emptyCollection');
|
|
6546
|
+
widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
|
|
6547
|
+
if (this.hiddenGroups.indexOf(groupEle.id) !== -1) {
|
|
6548
|
+
this.hiddenGroups.splice(this.hiddenGroups.indexOf(groupEle.id), 1);
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
else {
|
|
6552
|
+
if (this.hiddenGroups.indexOf(groupEle.id) !== -1) {
|
|
6553
|
+
let hiddenItems = groupEle.querySelectorAll('.e-ribbon-item:not(.e-hidden)');
|
|
6554
|
+
hiddenItems.forEach((item) => {
|
|
6555
|
+
if (item.id !== hiddenEle.id) {
|
|
6556
|
+
item.classList.add('e-hidden');
|
|
6557
|
+
}
|
|
6558
|
+
});
|
|
6559
|
+
widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
|
|
6560
|
+
hiddenItems.forEach((item) => {
|
|
6561
|
+
if (item.id !== hiddenEle.id) {
|
|
6562
|
+
item.classList.remove('e-hidden');
|
|
6563
|
+
}
|
|
6564
|
+
});
|
|
6565
|
+
this.hiddenGroups.splice(this.hiddenGroups.indexOf(groupEle.id), 1);
|
|
6566
|
+
}
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
this.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, false, tabIndex);
|
|
6570
|
+
this.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, false);
|
|
6571
|
+
}
|
|
6572
|
+
if (isGroupHidden) {
|
|
6573
|
+
groupEle.classList.add('e-hide-group');
|
|
6574
|
+
groupEle.classList.add('e-ribbon-emptyCollection');
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
let index = hiddenProps[key].indexOf(hiddenProps[key][i]);
|
|
6578
|
+
if (index !== -1) {
|
|
6579
|
+
hiddenProps[key].splice(index, 1);
|
|
6580
|
+
i--;
|
|
6581
|
+
}
|
|
6582
|
+
/* eslint-enable */
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
checkWidthDifference(hiddenEle, groupEle) {
|
|
6587
|
+
let widthDifference = 0;
|
|
6588
|
+
groupEle.classList.remove('e-hide-group');
|
|
6589
|
+
groupEle.classList.remove('e-ribbon-emptyCollection');
|
|
6590
|
+
if (this.hiddenGroups.length) {
|
|
6591
|
+
if (this.hiddenGroups.indexOf(groupEle.id) === -1) {
|
|
6592
|
+
this.hiddenGroups.push(groupEle.id);
|
|
6593
|
+
widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
else {
|
|
6597
|
+
this.hiddenGroups.push(groupEle.id);
|
|
6598
|
+
widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
|
|
6599
|
+
}
|
|
6600
|
+
return widthDifference;
|
|
6601
|
+
}
|
|
6602
|
+
calculateHiddenElementsWidth(tabIndex) {
|
|
6603
|
+
if (tabIndex === this.selectedTab && this.activeLayout === 'Simplified') {
|
|
6604
|
+
let hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
|
|
6605
|
+
if (hiddenProps) {
|
|
6606
|
+
for (let i = 0; i < Object.keys(hiddenProps).length; i++) {
|
|
6607
|
+
this.updateItemsSimplifiedWidth(tabIndex, Object.keys(hiddenProps)[parseInt(i.toString(), 10)]);
|
|
6608
|
+
}
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
calculateMediumDataWidth(hiddenWidth, tabIndex, isHidden) {
|
|
6613
|
+
if (this.selectedTab === tabIndex && this.activeLayout === 'Simplified') {
|
|
6614
|
+
const activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + CONTENT_ID);
|
|
6615
|
+
let mediumDataItems = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-item'));
|
|
6616
|
+
if (this.overflowDDB) {
|
|
6617
|
+
const overflowEle = this.overflowDDB.target;
|
|
6618
|
+
let overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
|
|
6619
|
+
let selectedOFTab = document.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
6620
|
+
for (let i = 0; i < overflowItems.length; i++) {
|
|
6621
|
+
let ofTab = overflowItems[parseInt(i.toString(), 10)].closest('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
6622
|
+
if (selectedOFTab && ofTab && selectedOFTab.id === ofTab.id && overflowItems[parseInt(i.toString(), 10)].hasAttribute('data-medium-width')) {
|
|
6623
|
+
mediumDataItems.push(overflowItems[parseInt(i.toString(), 10)]);
|
|
6624
|
+
}
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
let groupOFButton = activeContent.querySelectorAll('.e-ribbon-group-of-btn');
|
|
6628
|
+
for (let i = 0; i < groupOFButton.length; i++) {
|
|
6629
|
+
let overflowButton = getInstance(groupOFButton[parseInt(i.toString(), 10)], DropDownButton);
|
|
6630
|
+
const overflowBtnTarget = overflowButton.target;
|
|
6631
|
+
let overflowItems = overflowBtnTarget.querySelectorAll('.e-ribbon-item');
|
|
6632
|
+
for (let i = 0; i < overflowItems.length; i++) {
|
|
6633
|
+
if (overflowItems[parseInt(i.toString(), 10)].hasAttribute('data-medium-width')) {
|
|
6634
|
+
mediumDataItems.push(overflowItems[parseInt(i.toString(), 10)]);
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
for (let i = 0; i < mediumDataItems.length; i++) {
|
|
6639
|
+
if (mediumDataItems[parseInt(i.toString(), 10)].hasAttribute('data-medium-width')) {
|
|
6640
|
+
let previousWidth = parseInt(mediumDataItems[parseInt(i.toString(), 10)].getAttribute('data-medium-width'), 10);
|
|
6641
|
+
mediumDataItems[parseInt(i.toString(), 10)].setAttribute('data-medium-width', isHidden ? (previousWidth - hiddenWidth).toString() : (previousWidth + hiddenWidth).toString());
|
|
6642
|
+
}
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
}
|
|
6646
|
+
calculateOverflowItemsWidth(hiddenItem, isHidden, tabIndex) {
|
|
6647
|
+
if (this.selectedTab === tabIndex && this.activeLayout === 'Simplified') {
|
|
6648
|
+
const groupList = this.tabs[parseInt(tabIndex.toString(), 10)].groups;
|
|
6649
|
+
for (let i = 0; i < groupList.length; i++) {
|
|
6650
|
+
const group = groupList[parseInt(i.toString(), 10)];
|
|
6651
|
+
if (group.enableGroupOverflow) {
|
|
6652
|
+
let groupContainer = document.querySelector('#' + group.id);
|
|
6653
|
+
let overflowButton;
|
|
6654
|
+
const overflowDDB = groupContainer.querySelector('#' + group.id + GROUPOF_BUTTON_ID);
|
|
6655
|
+
if (overflowDDB) {
|
|
6656
|
+
overflowButton = getInstance(overflowDDB, DropDownButton);
|
|
6657
|
+
}
|
|
6658
|
+
if (overflowButton) {
|
|
6659
|
+
const overflowEle = overflowButton.target;
|
|
6660
|
+
let overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
|
|
6661
|
+
for (let i = 0; i < overflowItems.length; i++) {
|
|
6662
|
+
let previousWidth = parseInt(overflowItems[parseInt(i.toString(), 10)].getAttribute('data-simplified-width'), 10);
|
|
6663
|
+
if (previousWidth) {
|
|
6664
|
+
overflowItems[parseInt(i.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6667
|
+
}
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
if (this.overflowDDB) {
|
|
6672
|
+
let selectedOFTab = document.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
6673
|
+
const overflowEle = this.overflowDDB.target;
|
|
6674
|
+
let overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
|
|
6675
|
+
for (let i = 0; i < overflowItems.length; i++) {
|
|
6676
|
+
let ofTab = overflowItems[parseInt(i.toString(), 10)].closest('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
6677
|
+
if (selectedOFTab && ofTab && selectedOFTab.id === ofTab.id) {
|
|
6678
|
+
let previousWidth = parseInt(overflowItems[parseInt(i.toString(), 10)].getAttribute('data-simplified-width'), 10);
|
|
6679
|
+
if (previousWidth) {
|
|
6680
|
+
overflowItems[parseInt(i.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6357
6685
|
}
|
|
6358
6686
|
/**
|
|
6359
6687
|
* Disables a specific group within a ribbon tab.
|
|
@@ -6613,9 +6941,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6613
6941
|
}
|
|
6614
6942
|
if (ele) {
|
|
6615
6943
|
const itemEle = closest(ele, '.e-ribbon-item');
|
|
6616
|
-
isHidden ?
|
|
6617
|
-
this.
|
|
6618
|
-
|
|
6944
|
+
this.updateHiddenElements(itemProp.tabIndex, isHidden ? 'hideItem' : 'showItem', itemId, isHidden, itemEle, itemProp.group);
|
|
6945
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
6946
|
+
this.refreshLayout();
|
|
6947
|
+
}
|
|
6619
6948
|
}
|
|
6620
6949
|
else {
|
|
6621
6950
|
this.updateInitialProps(itemProp.tabIndex, itemId, 'hiddenItems', isHidden);
|
|
@@ -7176,6 +7505,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
7176
7505
|
this.keyboardModuleRibbon.destroy();
|
|
7177
7506
|
this.keyboardModuleRibbon = null;
|
|
7178
7507
|
destroyTooltip(this.element);
|
|
7508
|
+
if (this.refreshing) {
|
|
7509
|
+
this.clearOverflowDropDown(this.selectedTab);
|
|
7510
|
+
}
|
|
7179
7511
|
this.destroyTabItems(this.tabs);
|
|
7180
7512
|
if (!this.hideLayoutSwitcher) {
|
|
7181
7513
|
this.removeExpandCollapse();
|
|
@@ -7183,6 +7515,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
7183
7515
|
this.collapseButton = undefined;
|
|
7184
7516
|
if (this.scrollModule) {
|
|
7185
7517
|
this.scrollModule.destroy();
|
|
7518
|
+
this.scrollModule = null;
|
|
7186
7519
|
}
|
|
7187
7520
|
if (this.ribbonTempEle) {
|
|
7188
7521
|
remove(this.ribbonTempEle);
|
|
@@ -7192,6 +7525,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
7192
7525
|
this.tabObj.destroy();
|
|
7193
7526
|
this.tabObj = undefined;
|
|
7194
7527
|
this.initialPropsData = {};
|
|
7528
|
+
this.hiddenGroups = [];
|
|
7529
|
+
this.hiddenElements = {};
|
|
7195
7530
|
remove(this.element.querySelector('#' + this.element.id + TAB_ID));
|
|
7196
7531
|
this.element.style.removeProperty(RIBBON_FILE_MENU_WIDTH);
|
|
7197
7532
|
this.element.style.removeProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH);
|