@syncfusion/ej2-ribbon 23.1.43 → 23.1.44
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 +10 -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 +160 -70
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +160 -70
- 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 +8 -8
- package/src/ribbon/base/ribbon.d.ts +3 -0
- package/src/ribbon/base/ribbon.js +160 -70
|
@@ -3305,6 +3305,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3305
3305
|
preRender() {
|
|
3306
3306
|
this.idIndex = 0;
|
|
3307
3307
|
this.tooltipData = [];
|
|
3308
|
+
this.initialPropsData = {};
|
|
3308
3309
|
this.isAddRemove = false;
|
|
3309
3310
|
this.keyConfigs = {
|
|
3310
3311
|
leftarrow: 'leftarrow',
|
|
@@ -3819,21 +3820,23 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3819
3820
|
// The position is reversed if RTL is enabled.
|
|
3820
3821
|
// isRight = ((isGroupOF && isMenu) && !this.enableRtl ) || (!(isGroupOF && isMenu) && this.enableRtl) ==> (isGroupOF && isMenu) !== this.enableRtl
|
|
3821
3822
|
const isLeft = (isGroupOF && isMenu) === this.enableRtl;
|
|
3822
|
-
dropDownPopup
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3823
|
+
if (dropDownPopup) {
|
|
3824
|
+
dropDownPopup.setProperties({ position: { X: isLeft ? 'left' : 'right', Y: isMenu ? 'top' : 'bottom' } }, true);
|
|
3825
|
+
if (isMenu) {
|
|
3826
|
+
dropdown.beforeOpen = () => {
|
|
3827
|
+
if (isLeft) {
|
|
3828
|
+
dropDownPopup.element.style.setProperty('visibility', 'hidden');
|
|
3829
|
+
dropDownPopup.element.style.setProperty('display', 'block');
|
|
3830
|
+
dropDownPopup.setProperties({ offsetX: -1 * dropDownPopup.element.offsetWidth });
|
|
3831
|
+
dropDownPopup.element.style.removeProperty('display');
|
|
3832
|
+
dropDownPopup.element.style.removeProperty('visibility');
|
|
3833
|
+
}
|
|
3834
|
+
};
|
|
3835
|
+
}
|
|
3836
|
+
else {
|
|
3837
|
+
dropDownPopup.setProperties({ offsetX: 0 }, true);
|
|
3838
|
+
dropdown.beforeOpen = null;
|
|
3839
|
+
}
|
|
3837
3840
|
}
|
|
3838
3841
|
}
|
|
3839
3842
|
removeSimplfiedOverflow(tabContent, activeContent, tabIndex, isClear = false) {
|
|
@@ -3918,7 +3921,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3918
3921
|
createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer, isResize) {
|
|
3919
3922
|
let overflowButton;
|
|
3920
3923
|
const contentEle = this.tabObj.items[parseInt(tabIndex.toString(), 10)].content;
|
|
3921
|
-
const
|
|
3924
|
+
const groupEle = contentEle.querySelector('#' + groupId);
|
|
3922
3925
|
if (isGroupOF) {
|
|
3923
3926
|
const overflowDDB = groupContainer.querySelector('#' + groupId + GROUPOF_BUTTON_ID);
|
|
3924
3927
|
if (!overflowDDB) {
|
|
@@ -3930,9 +3933,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3930
3933
|
overflowButton = getInstance(overflowDDB, DropDownButton);
|
|
3931
3934
|
}
|
|
3932
3935
|
const overflowBtnTarget = overflowButton.target;
|
|
3933
|
-
if (
|
|
3936
|
+
if (groupEle && groupEle.classList.contains('e-disabled')) {
|
|
3934
3937
|
overflowBtnTarget.classList.add('e-disabled');
|
|
3935
3938
|
}
|
|
3939
|
+
if (groupEle && groupEle.classList.contains('e-hidden')) {
|
|
3940
|
+
overflowBtnTarget.classList.add('e-hidden');
|
|
3941
|
+
}
|
|
3936
3942
|
isResize ? overflowBtnTarget.insertBefore(itemEle, overflowBtnTarget.querySelector('.' + RIBBON_ITEM))
|
|
3937
3943
|
: overflowBtnTarget.append(itemEle);
|
|
3938
3944
|
}
|
|
@@ -3951,7 +3957,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3951
3957
|
let ofGroupContainer = overflowEle.querySelector('#' + groupId + CONTAINER_ID);
|
|
3952
3958
|
if (!ofGroupContainer) {
|
|
3953
3959
|
ofGroupContainer = this.createGroupContainer(groupId, groupHeader);
|
|
3954
|
-
if (
|
|
3960
|
+
if (groupEle && groupEle.classList.contains('e-disabled')) {
|
|
3955
3961
|
ofGroupContainer.classList.add('e-disabled');
|
|
3956
3962
|
}
|
|
3957
3963
|
ofTabContainer.append(ofGroupContainer);
|
|
@@ -4008,6 +4014,15 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4008
4014
|
if (tabIndex === this.selectedTab) {
|
|
4009
4015
|
ofTabContainer.classList.add(RIBBON_TAB_ACTIVE);
|
|
4010
4016
|
}
|
|
4017
|
+
let groupEle = document.querySelector('#' + groupId);
|
|
4018
|
+
if (groupEle) {
|
|
4019
|
+
if (groupEle.classList.contains('e-disabled')) {
|
|
4020
|
+
ofGroupContainer.classList.add('e-disabled');
|
|
4021
|
+
}
|
|
4022
|
+
if (groupEle.classList.contains('e-hidden')) {
|
|
4023
|
+
ofGroupContainer.classList.add('e-hidden');
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4011
4026
|
}
|
|
4012
4027
|
checkGroupShrinking(tabIndex, tabContent, activeContent, isLarge) {
|
|
4013
4028
|
let isOverFlow = true;
|
|
@@ -4596,30 +4611,32 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4596
4611
|
(isRemoveOverflow ? (itemContainer.classList.add(RIBBON_CONTENT_HEIGHT)) : (itemContainer.classList.remove(RIBBON_CONTENT_HEIGHT)));
|
|
4597
4612
|
}
|
|
4598
4613
|
setItemSize(itemEle, item) {
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4614
|
+
if (itemEle) {
|
|
4615
|
+
const itemContainer = itemEle.closest('.' + RIBBON_ITEM);
|
|
4616
|
+
if (item.type === RibbonItemType.Button) {
|
|
4617
|
+
this.ribbonButtonModule.updateButtonSize(itemEle, item);
|
|
4618
|
+
}
|
|
4619
|
+
else if (item.type === RibbonItemType.DropDown) {
|
|
4620
|
+
this.ribbonDropDownModule.updateDropDownSize(itemEle, item);
|
|
4621
|
+
}
|
|
4622
|
+
else if (item.type === RibbonItemType.SplitButton) {
|
|
4623
|
+
this.ribbonSplitButtonModule.updateSplitButtonSize(itemEle, item);
|
|
4624
|
+
}
|
|
4625
|
+
else if (item.type === RibbonItemType.Template) {
|
|
4626
|
+
remove(itemEle);
|
|
4627
|
+
this.createTemplateContent(item, itemContainer);
|
|
4628
|
+
}
|
|
4629
|
+
else if (item.type === RibbonItemType.GroupButton) {
|
|
4630
|
+
this.ribbonGroupButtonModule.updateGroupButtonSize(itemEle, item);
|
|
4631
|
+
}
|
|
4632
|
+
itemContainer.classList.remove(RIBBON_CONTENT_HEIGHT, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM);
|
|
4633
|
+
if (item.activeSize === RibbonItemSize.Large) {
|
|
4634
|
+
itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
|
|
4635
|
+
}
|
|
4636
|
+
else {
|
|
4637
|
+
itemContainer.classList.add((item.activeSize === RibbonItemSize.Medium) ?
|
|
4638
|
+
RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
4639
|
+
}
|
|
4623
4640
|
}
|
|
4624
4641
|
}
|
|
4625
4642
|
createOverflowDropdown(tabIndex, tabContent, activeContent) {
|
|
@@ -4934,28 +4951,30 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4934
4951
|
}
|
|
4935
4952
|
}
|
|
4936
4953
|
removeOverflowEvent(item, itemEle) {
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4954
|
+
if (itemEle) {
|
|
4955
|
+
switch (item.type) {
|
|
4956
|
+
case 'Button':
|
|
4957
|
+
this.ribbonButtonModule.removeOverFlowEvents(item, itemEle);
|
|
4958
|
+
break;
|
|
4959
|
+
case 'DropDown':
|
|
4960
|
+
this.ribbonDropDownModule.removeOverFlowEvents(item, itemEle);
|
|
4961
|
+
break;
|
|
4962
|
+
case 'SplitButton':
|
|
4963
|
+
this.ribbonSplitButtonModule.removeOverFlowEvents(item, itemEle);
|
|
4964
|
+
break;
|
|
4965
|
+
case 'CheckBox':
|
|
4966
|
+
this.ribbonCheckBoxModule.removeOverFlowEvents(item, itemEle);
|
|
4967
|
+
break;
|
|
4968
|
+
case 'ColorPicker':
|
|
4969
|
+
this.ribbonColorPickerModule.removeOverFlowEvents(item, itemEle);
|
|
4970
|
+
break;
|
|
4971
|
+
case 'ComboBox':
|
|
4972
|
+
this.ribbonComboBoxModule.removeOverFlowEvents(item, itemEle);
|
|
4973
|
+
break;
|
|
4974
|
+
case 'GroupButton':
|
|
4975
|
+
this.ribbonGroupButtonModule.removeOverFlowEvents(item, itemEle);
|
|
4976
|
+
break;
|
|
4977
|
+
}
|
|
4959
4978
|
}
|
|
4960
4979
|
}
|
|
4961
4980
|
createGroupContainer(groupId, groupHeader) {
|
|
@@ -5155,8 +5174,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
5155
5174
|
this.ribbonGroupButtonModule.switchGroupButton(item, itemEle);
|
|
5156
5175
|
}
|
|
5157
5176
|
item.setProperties({ activeSize: size }, true);
|
|
5158
|
-
|
|
5159
|
-
|
|
5177
|
+
if (itemEle) {
|
|
5178
|
+
const ele = itemEle.querySelector('#' + item.id);
|
|
5179
|
+
this.setItemSize(ele, item);
|
|
5180
|
+
}
|
|
5160
5181
|
}
|
|
5161
5182
|
}
|
|
5162
5183
|
}
|
|
@@ -5239,7 +5260,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
5239
5260
|
}
|
|
5240
5261
|
else {
|
|
5241
5262
|
let itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
5242
|
-
if (!itemEle) {
|
|
5263
|
+
if (!itemEle && overflowtarget) {
|
|
5243
5264
|
itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
5244
5265
|
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
|
|
5245
5266
|
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
|
|
@@ -5249,7 +5270,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
5249
5270
|
if (item.type === RibbonItemType.GroupButton) {
|
|
5250
5271
|
this.ribbonGroupButtonModule.switchGroupButton(item, itemEle);
|
|
5251
5272
|
}
|
|
5252
|
-
|
|
5273
|
+
if (itemEle) {
|
|
5274
|
+
groupCollection.append(itemEle);
|
|
5275
|
+
}
|
|
5253
5276
|
}
|
|
5254
5277
|
let ele = groupContainer.querySelector('#' + item.id);
|
|
5255
5278
|
if (item.type === RibbonItemType.GroupButton) {
|
|
@@ -5336,9 +5359,28 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
5336
5359
|
if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
|
|
5337
5360
|
groupEle.classList.add('e-ribbon-emptyCollection');
|
|
5338
5361
|
}
|
|
5362
|
+
const initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
5363
|
+
if (initialProps) {
|
|
5364
|
+
if (initialProps.hiddenGroups && initialProps.hiddenGroups.length) {
|
|
5365
|
+
this.updateGroupProps('hiddenGroups', initialProps, groupEle);
|
|
5366
|
+
}
|
|
5367
|
+
if (initialProps.disabledGroups && initialProps.disabledGroups.length) {
|
|
5368
|
+
this.updateGroupProps('disabledGroups', initialProps, groupEle);
|
|
5369
|
+
}
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
if (this.initialPropsData[parseInt(tabIndex.toString(), 10)]) {
|
|
5373
|
+
delete this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
5339
5374
|
}
|
|
5340
5375
|
return groupElements;
|
|
5341
5376
|
}
|
|
5377
|
+
updateGroupProps(key, initialProps, groupEle) {
|
|
5378
|
+
// eslint-disable-next-line
|
|
5379
|
+
let groupIndex = initialProps[key].indexOf(groupEle.id);
|
|
5380
|
+
if (groupIndex !== -1) {
|
|
5381
|
+
key === 'hiddenGroups' ? groupEle.classList.add('e-hidden') : groupEle.classList.add('e-disabled');
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5342
5384
|
validateItemSize() {
|
|
5343
5385
|
for (let k = 0; k < this.tabs.length; k++) {
|
|
5344
5386
|
const groupList = this.tabs[parseInt(k.toString(), 10)].groups;
|
|
@@ -5467,6 +5509,13 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
5467
5509
|
else {
|
|
5468
5510
|
itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
5469
5511
|
}
|
|
5512
|
+
const initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
5513
|
+
if (initialProps && initialProps.hiddenItems && initialProps.hiddenItems.length) {
|
|
5514
|
+
const itemIndex = initialProps.hiddenItems.indexOf(item.id);
|
|
5515
|
+
if (itemIndex !== -1) {
|
|
5516
|
+
itemEle.classList.add('e-hidden');
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5470
5519
|
this.createRibbonItem(item, itemEle);
|
|
5471
5520
|
if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
|
|
5472
5521
|
this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
|
|
@@ -6019,7 +6068,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6019
6068
|
}
|
|
6020
6069
|
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
6021
6070
|
const groupEle = contentEle.querySelector('#' + groupID);
|
|
6022
|
-
|
|
6071
|
+
if (groupEle) {
|
|
6072
|
+
isHidden ? groupEle.classList.add('e-hidden') : groupEle.classList.remove('e-hidden');
|
|
6073
|
+
}
|
|
6074
|
+
else {
|
|
6075
|
+
this.updateInitialProps(itemProp.tabIndex, groupID, 'hiddenGroups', isHidden);
|
|
6076
|
+
}
|
|
6023
6077
|
if (this.overflowDDB) {
|
|
6024
6078
|
const overflowEle = this.overflowDDB.target;
|
|
6025
6079
|
const ofTabContainer = overflowEle.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
@@ -6069,7 +6123,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6069
6123
|
}
|
|
6070
6124
|
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
6071
6125
|
const groupEle = contentEle.querySelector('#' + groupID);
|
|
6072
|
-
|
|
6126
|
+
if (groupEle) {
|
|
6127
|
+
isDisabled ? groupEle.classList.add('e-disabled') : groupEle.classList.remove('e-disabled');
|
|
6128
|
+
}
|
|
6129
|
+
else {
|
|
6130
|
+
this.updateInitialProps(itemProp.tabIndex, groupID, 'disabledGroups', isDisabled);
|
|
6131
|
+
}
|
|
6073
6132
|
if (this.overflowDDB) {
|
|
6074
6133
|
const overflowEle = this.overflowDDB.target;
|
|
6075
6134
|
const ofTabContainer = overflowEle.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
@@ -6296,6 +6355,36 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6296
6355
|
if (ele) {
|
|
6297
6356
|
const itemEle = closest(ele, '.e-ribbon-item');
|
|
6298
6357
|
isHidden ? itemEle.classList.add('e-hidden') : itemEle.classList.remove('e-hidden');
|
|
6358
|
+
this.refreshLayout();
|
|
6359
|
+
}
|
|
6360
|
+
else {
|
|
6361
|
+
this.updateInitialProps(itemProp.tabIndex, itemId, 'hiddenItems', isHidden);
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
updateInitialProps(tabIndex, id, key, isInsert) {
|
|
6365
|
+
let initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
6366
|
+
if (!initialProps) {
|
|
6367
|
+
this.initialPropsData[parseInt(tabIndex.toString(), 10)] = {};
|
|
6368
|
+
initialProps = this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
6369
|
+
}
|
|
6370
|
+
if (initialProps) {
|
|
6371
|
+
/* eslint-disable */
|
|
6372
|
+
if (!initialProps[key])
|
|
6373
|
+
initialProps[key] = [];
|
|
6374
|
+
const itemIndex = initialProps[key].indexOf(id);
|
|
6375
|
+
if (isInsert) {
|
|
6376
|
+
if (itemIndex === -1)
|
|
6377
|
+
initialProps[key].push(id);
|
|
6378
|
+
}
|
|
6379
|
+
else {
|
|
6380
|
+
if (itemIndex !== -1)
|
|
6381
|
+
initialProps[key].splice(itemIndex, 1);
|
|
6382
|
+
initialProps[key].length === 0 && delete initialProps[key];
|
|
6383
|
+
/* eslint-enable */
|
|
6384
|
+
if (Object.keys(initialProps).length === 0) {
|
|
6385
|
+
delete this.initialPropsData[parseInt(tabIndex.toString(), 10)];
|
|
6386
|
+
}
|
|
6387
|
+
}
|
|
6299
6388
|
}
|
|
6300
6389
|
}
|
|
6301
6390
|
/**
|
|
@@ -6772,6 +6861,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
6772
6861
|
super.destroy();
|
|
6773
6862
|
this.tabObj.destroy();
|
|
6774
6863
|
this.tabObj = undefined;
|
|
6864
|
+
this.initialPropsData = {};
|
|
6775
6865
|
remove(this.element.querySelector('#' + this.element.id + TAB_ID));
|
|
6776
6866
|
this.element.style.removeProperty(RIBBON_FILE_MENU_WIDTH);
|
|
6777
6867
|
this.element.style.removeProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH);
|