@syncfusion/ej2-ribbon 23.1.41 → 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.
Files changed (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/ej2-ribbon.umd.min.js +2 -2
  3. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-ribbon.es2015.js +225 -71
  5. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  6. package/dist/es6/ej2-ribbon.es5.js +225 -71
  7. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  8. package/dist/global/ej2-ribbon.min.js +2 -2
  9. package/dist/global/ej2-ribbon.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +11 -11
  12. package/src/ribbon/base/ribbon.d.ts +3 -0
  13. package/src/ribbon/base/ribbon.js +160 -70
  14. package/src/ribbon/base/utils.d.ts +11 -0
  15. package/src/ribbon/base/utils.js +27 -1
  16. package/src/ribbon/items/ribbon-button.js +4 -1
  17. package/src/ribbon/items/ribbon-checkbox.js +1 -0
  18. package/src/ribbon/items/ribbon-colorpicker.js +4 -1
  19. package/src/ribbon/items/ribbon-combobox.js +1 -0
  20. package/src/ribbon/items/ribbon-dropdown.js +4 -1
  21. package/src/ribbon/items/ribbon-groupbutton.js +4 -1
  22. package/src/ribbon/items/ribbon-splitbutton.js +4 -1
  23. package/src/ribbon/models/ribbon-button-settings-model.d.ts +7 -0
  24. package/src/ribbon/models/ribbon-button-settings.d.ts +8 -0
  25. package/src/ribbon/models/ribbon-button-settings.js +3 -0
  26. package/src/ribbon/models/ribbon-checkbox-settings-model.d.ts +7 -0
  27. package/src/ribbon/models/ribbon-checkbox-settings.d.ts +8 -0
  28. package/src/ribbon/models/ribbon-checkbox-settings.js +3 -0
  29. package/src/ribbon/models/ribbon-colorpicker-settings-model.d.ts +7 -0
  30. package/src/ribbon/models/ribbon-colorpicker-settings.d.ts +8 -0
  31. package/src/ribbon/models/ribbon-colorpicker-settings.js +3 -0
  32. package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +7 -0
  33. package/src/ribbon/models/ribbon-combobox-settings.d.ts +8 -0
  34. package/src/ribbon/models/ribbon-combobox-settings.js +3 -0
  35. package/src/ribbon/models/ribbon-dropdown-settings-model.d.ts +7 -0
  36. package/src/ribbon/models/ribbon-dropdown-settings.d.ts +8 -0
  37. package/src/ribbon/models/ribbon-dropdown-settings.js +3 -0
  38. package/src/ribbon/models/ribbon-group-button-item-model.d.ts +7 -0
  39. package/src/ribbon/models/ribbon-group-button-item.d.ts +8 -0
  40. package/src/ribbon/models/ribbon-group-button-item.js +3 -0
  41. package/src/ribbon/models/ribbon-splitbutton-settings-model.d.ts +7 -0
  42. package/src/ribbon/models/ribbon-splitbutton-settings.d.ts +8 -0
  43. package/src/ribbon/models/ribbon-splitbutton-settings.js +3 -0
@@ -166,6 +166,9 @@ __decorate$5([
166
166
  __decorate$5([
167
167
  Property(false)
168
168
  ], RibbonButtonSettings.prototype, "isPrimary", void 0);
169
+ __decorate$5([
170
+ Property({})
171
+ ], RibbonButtonSettings.prototype, "htmlAttributes", void 0);
169
172
  __decorate$5([
170
173
  Event()
171
174
  ], RibbonButtonSettings.prototype, "created", void 0);
@@ -205,6 +208,9 @@ __decorate$6([
205
208
  __decorate$6([
206
209
  Property('After')
207
210
  ], RibbonCheckBoxSettings.prototype, "labelPosition", void 0);
211
+ __decorate$6([
212
+ Property({})
213
+ ], RibbonCheckBoxSettings.prototype, "htmlAttributes", void 0);
208
214
  __decorate$6([
209
215
  Event()
210
216
  ], RibbonCheckBoxSettings.prototype, "created", void 0);
@@ -259,6 +265,9 @@ __decorate$7([
259
265
  __decorate$7([
260
266
  Property('#008000ff')
261
267
  ], RibbonColorPickerSettings.prototype, "value", void 0);
268
+ __decorate$7([
269
+ Property({})
270
+ ], RibbonColorPickerSettings.prototype, "htmlAttributes", void 0);
262
271
  __decorate$7([
263
272
  Event()
264
273
  ], RibbonColorPickerSettings.prototype, "beforeClose", void 0);
@@ -361,6 +370,9 @@ __decorate$8([
361
370
  __decorate$8([
362
371
  Property('150px')
363
372
  ], RibbonComboBoxSettings.prototype, "width", void 0);
373
+ __decorate$8([
374
+ Property({})
375
+ ], RibbonComboBoxSettings.prototype, "htmlAttributes", void 0);
364
376
  __decorate$8([
365
377
  Event()
366
378
  ], RibbonComboBoxSettings.prototype, "beforeOpen", void 0);
@@ -424,6 +436,9 @@ __decorate$9([
424
436
  __decorate$9([
425
437
  Property(false)
426
438
  ], RibbonDropDownSettings.prototype, "createPopupOnClick", void 0);
439
+ __decorate$9([
440
+ Property({})
441
+ ], RibbonDropDownSettings.prototype, "htmlAttributes", void 0);
427
442
  __decorate$9([
428
443
  Event()
429
444
  ], RibbonDropDownSettings.prototype, "beforeClose", void 0);
@@ -484,6 +499,9 @@ __decorate$10([
484
499
  __decorate$10([
485
500
  Property('')
486
501
  ], RibbonSplitButtonSettings.prototype, "target", void 0);
502
+ __decorate$10([
503
+ Property({})
504
+ ], RibbonSplitButtonSettings.prototype, "htmlAttributes", void 0);
487
505
  __decorate$10([
488
506
  Event()
489
507
  ], RibbonSplitButtonSettings.prototype, "beforeClose", void 0);
@@ -559,6 +577,9 @@ __decorate$13([
559
577
  __decorate$13([
560
578
  Property(false)
561
579
  ], RibbonGroupButtonItem.prototype, "selected", void 0);
580
+ __decorate$13([
581
+ Property({})
582
+ ], RibbonGroupButtonItem.prototype, "htmlAttributes", void 0);
562
583
  __decorate$13([
563
584
  Event()
564
585
  ], RibbonGroupButtonItem.prototype, "beforeClick", void 0);
@@ -1171,6 +1192,9 @@ class RibbonButton {
1171
1192
  isToggle: btnSettings.isToggle,
1172
1193
  created: btnSettings.created
1173
1194
  }, buttonEle);
1195
+ if (btnSettings.htmlAttributes) {
1196
+ setCustomAttributes(buttonEle, btnSettings.htmlAttributes);
1197
+ }
1174
1198
  buttonEle.onclick = (e) => {
1175
1199
  if (btnSettings.clicked) {
1176
1200
  btnSettings.clicked.call(this, e);
@@ -1318,6 +1342,7 @@ class RibbonCheckBox {
1318
1342
  labelPosition: checkBoxSettings.labelPosition,
1319
1343
  disabled: item.disabled,
1320
1344
  created: checkBoxSettings.created,
1345
+ htmlAttributes: checkBoxSettings.htmlAttributes,
1321
1346
  change: (e) => {
1322
1347
  if (checkBoxSettings.change) {
1323
1348
  checkBoxSettings.change.call(this, e);
@@ -1467,6 +1492,9 @@ class RibbonColorPicker {
1467
1492
  },
1468
1493
  select: colorPickerSettings.select
1469
1494
  }, inputEle);
1495
+ if (colorPickerSettings.htmlAttributes) {
1496
+ setCustomAttributes(inputEle, colorPickerSettings.htmlAttributes);
1497
+ }
1470
1498
  const wrapper = colorPicker.element.parentElement;
1471
1499
  EventHandler.add(wrapper, 'mouseenter', this.toggleWrapperHover.bind(this, wrapper, true), this);
1472
1500
  EventHandler.add(wrapper, 'mouseleave', this.toggleWrapperHover.bind(this, wrapper, false), this);
@@ -1658,6 +1686,7 @@ class RibbonComboBox {
1658
1686
  width: comboBoxSettings.width,
1659
1687
  beforeOpen: comboBoxSettings.beforeOpen,
1660
1688
  open: comboBoxSettings.open,
1689
+ htmlAttributes: comboBoxSettings.htmlAttributes,
1661
1690
  close: (e) => {
1662
1691
  if (comboBoxSettings.close) {
1663
1692
  comboBoxSettings.close.call(this, e);
@@ -1839,6 +1868,9 @@ class RibbonDropDown {
1839
1868
  open: dropDownSettings.open,
1840
1869
  select: dropDownSettings.select
1841
1870
  }).appendTo(buttonEle);
1871
+ if (dropDownSettings.htmlAttributes) {
1872
+ setCustomAttributes(buttonEle, dropDownSettings.htmlAttributes);
1873
+ }
1842
1874
  }
1843
1875
  /**
1844
1876
  * Adds the additional event handlers as the item moved into overflow popup.
@@ -2276,6 +2308,9 @@ class RibbonSplitButton {
2276
2308
  }
2277
2309
  }
2278
2310
  }, buttonEle);
2311
+ if (splitButtonSettings.htmlAttributes) {
2312
+ setCustomAttributes(buttonEle, splitButtonSettings.htmlAttributes);
2313
+ }
2279
2314
  const dropdownEle = buttonEle.parentElement.querySelector('.e-dropdown-btn');
2280
2315
  dropdownEle.onkeydown = (e) => {
2281
2316
  if (e.key === 'Enter') {
@@ -2774,6 +2809,32 @@ function updateTooltipProp(element, prop) {
2774
2809
  const control = getComponent(element, Tooltip);
2775
2810
  control.setProperties(prop);
2776
2811
  }
2812
+ /**
2813
+ * Sets the HTML attributes of an element
2814
+ *
2815
+ * @param {HTMLElement} element - The HTML element for which attributes are to be updated.
2816
+ * @param {commonProperties} attributes - An object containing key-value pairs of attributes to be updated.
2817
+ * @returns {void}
2818
+ * @hidden
2819
+ */
2820
+ function setCustomAttributes(element, attributes) {
2821
+ for (const key in attributes) {
2822
+ if (key === 'class') {
2823
+ const elementClass = attributes['class'].replace(/\s+/g, ' ').trim();
2824
+ if (elementClass) {
2825
+ addClass([element], elementClass.split(' '));
2826
+ }
2827
+ }
2828
+ else if (key === 'style') {
2829
+ const prevStyles = element.getAttribute('style') || '';
2830
+ const value = `${prevStyles}${attributes[`${key}`]}`;
2831
+ element.setAttribute(`${key}`, value);
2832
+ }
2833
+ else {
2834
+ element.setAttribute(key, attributes[`${key}`]);
2835
+ }
2836
+ }
2837
+ }
2777
2838
 
2778
2839
  /**
2779
2840
  * Defines the items of Ribbon.
@@ -2819,6 +2880,9 @@ class RibbonGroupButton {
2819
2880
  content: item.activeSize === RibbonItemSize.Small ? '' : groupBtnSettings.items[parseInt(i.toString(), 10)].content,
2820
2881
  iconPosition: item.activeSize === RibbonItemSize.Large ? 'Top' : 'Left'
2821
2882
  }, groupButtonEle);
2883
+ if (groupBtnSettings.items[parseInt(i.toString(), 10)].htmlAttributes) {
2884
+ setCustomAttributes(groupButtonEle, groupBtnSettings.items[parseInt(i.toString(), 10)].htmlAttributes);
2885
+ }
2822
2886
  const buttonEle = itemElement.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + i);
2823
2887
  if (groupBtnSettings.selection === RibbonGroupButtonSelection.Single) {
2824
2888
  btnContainerEle.classList.add(RIBBON_SINGLE_BUTTON_SELECTION);
@@ -3241,6 +3305,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3241
3305
  preRender() {
3242
3306
  this.idIndex = 0;
3243
3307
  this.tooltipData = [];
3308
+ this.initialPropsData = {};
3244
3309
  this.isAddRemove = false;
3245
3310
  this.keyConfigs = {
3246
3311
  leftarrow: 'leftarrow',
@@ -3755,21 +3820,23 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3755
3820
  // The position is reversed if RTL is enabled.
3756
3821
  // isRight = ((isGroupOF && isMenu) && !this.enableRtl ) || (!(isGroupOF && isMenu) && this.enableRtl) ==> (isGroupOF && isMenu) !== this.enableRtl
3757
3822
  const isLeft = (isGroupOF && isMenu) === this.enableRtl;
3758
- dropDownPopup.setProperties({ position: { X: isLeft ? 'left' : 'right', Y: isMenu ? 'top' : 'bottom' } }, true);
3759
- if (isMenu) {
3760
- dropdown.beforeOpen = () => {
3761
- if (isLeft) {
3762
- dropDownPopup.element.style.setProperty('visibility', 'hidden');
3763
- dropDownPopup.element.style.setProperty('display', 'block');
3764
- dropDownPopup.setProperties({ offsetX: -1 * dropDownPopup.element.offsetWidth });
3765
- dropDownPopup.element.style.removeProperty('display');
3766
- dropDownPopup.element.style.removeProperty('visibility');
3767
- }
3768
- };
3769
- }
3770
- else {
3771
- dropDownPopup.setProperties({ offsetX: 0 }, true);
3772
- dropdown.beforeOpen = null;
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
+ }
3773
3840
  }
3774
3841
  }
3775
3842
  removeSimplfiedOverflow(tabContent, activeContent, tabIndex, isClear = false) {
@@ -3854,7 +3921,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3854
3921
  createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer, isResize) {
3855
3922
  let overflowButton;
3856
3923
  const contentEle = this.tabObj.items[parseInt(tabIndex.toString(), 10)].content;
3857
- const isDisabledGroup = contentEle.querySelector('#' + groupId);
3924
+ const groupEle = contentEle.querySelector('#' + groupId);
3858
3925
  if (isGroupOF) {
3859
3926
  const overflowDDB = groupContainer.querySelector('#' + groupId + GROUPOF_BUTTON_ID);
3860
3927
  if (!overflowDDB) {
@@ -3866,9 +3933,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3866
3933
  overflowButton = getInstance(overflowDDB, DropDownButton);
3867
3934
  }
3868
3935
  const overflowBtnTarget = overflowButton.target;
3869
- if (isDisabledGroup && isDisabledGroup.classList.contains('e-disabled')) {
3936
+ if (groupEle && groupEle.classList.contains('e-disabled')) {
3870
3937
  overflowBtnTarget.classList.add('e-disabled');
3871
3938
  }
3939
+ if (groupEle && groupEle.classList.contains('e-hidden')) {
3940
+ overflowBtnTarget.classList.add('e-hidden');
3941
+ }
3872
3942
  isResize ? overflowBtnTarget.insertBefore(itemEle, overflowBtnTarget.querySelector('.' + RIBBON_ITEM))
3873
3943
  : overflowBtnTarget.append(itemEle);
3874
3944
  }
@@ -3887,7 +3957,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3887
3957
  let ofGroupContainer = overflowEle.querySelector('#' + groupId + CONTAINER_ID);
3888
3958
  if (!ofGroupContainer) {
3889
3959
  ofGroupContainer = this.createGroupContainer(groupId, groupHeader);
3890
- if (isDisabledGroup && isDisabledGroup.classList.contains('e-disabled')) {
3960
+ if (groupEle && groupEle.classList.contains('e-disabled')) {
3891
3961
  ofGroupContainer.classList.add('e-disabled');
3892
3962
  }
3893
3963
  ofTabContainer.append(ofGroupContainer);
@@ -3944,6 +4014,15 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3944
4014
  if (tabIndex === this.selectedTab) {
3945
4015
  ofTabContainer.classList.add(RIBBON_TAB_ACTIVE);
3946
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
+ }
3947
4026
  }
3948
4027
  checkGroupShrinking(tabIndex, tabContent, activeContent, isLarge) {
3949
4028
  let isOverFlow = true;
@@ -4532,30 +4611,32 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4532
4611
  (isRemoveOverflow ? (itemContainer.classList.add(RIBBON_CONTENT_HEIGHT)) : (itemContainer.classList.remove(RIBBON_CONTENT_HEIGHT)));
4533
4612
  }
4534
4613
  setItemSize(itemEle, item) {
4535
- const itemContainer = itemEle.closest('.' + RIBBON_ITEM);
4536
- if (item.type === RibbonItemType.Button) {
4537
- this.ribbonButtonModule.updateButtonSize(itemEle, item);
4538
- }
4539
- else if (item.type === RibbonItemType.DropDown) {
4540
- this.ribbonDropDownModule.updateDropDownSize(itemEle, item);
4541
- }
4542
- else if (item.type === RibbonItemType.SplitButton) {
4543
- this.ribbonSplitButtonModule.updateSplitButtonSize(itemEle, item);
4544
- }
4545
- else if (item.type === RibbonItemType.Template) {
4546
- remove(itemEle);
4547
- this.createTemplateContent(item, itemContainer);
4548
- }
4549
- else if (item.type === RibbonItemType.GroupButton) {
4550
- this.ribbonGroupButtonModule.updateGroupButtonSize(itemEle, item);
4551
- }
4552
- itemContainer.classList.remove(RIBBON_CONTENT_HEIGHT, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM);
4553
- if (item.activeSize === RibbonItemSize.Large) {
4554
- itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
4555
- }
4556
- else {
4557
- itemContainer.classList.add((item.activeSize === RibbonItemSize.Medium) ?
4558
- RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
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
+ }
4559
4640
  }
4560
4641
  }
4561
4642
  createOverflowDropdown(tabIndex, tabContent, activeContent) {
@@ -4870,28 +4951,30 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4870
4951
  }
4871
4952
  }
4872
4953
  removeOverflowEvent(item, itemEle) {
4873
- switch (item.type) {
4874
- case 'Button':
4875
- this.ribbonButtonModule.removeOverFlowEvents(item, itemEle);
4876
- break;
4877
- case 'DropDown':
4878
- this.ribbonDropDownModule.removeOverFlowEvents(item, itemEle);
4879
- break;
4880
- case 'SplitButton':
4881
- this.ribbonSplitButtonModule.removeOverFlowEvents(item, itemEle);
4882
- break;
4883
- case 'CheckBox':
4884
- this.ribbonCheckBoxModule.removeOverFlowEvents(item, itemEle);
4885
- break;
4886
- case 'ColorPicker':
4887
- this.ribbonColorPickerModule.removeOverFlowEvents(item, itemEle);
4888
- break;
4889
- case 'ComboBox':
4890
- this.ribbonComboBoxModule.removeOverFlowEvents(item, itemEle);
4891
- break;
4892
- case 'GroupButton':
4893
- this.ribbonGroupButtonModule.removeOverFlowEvents(item, itemEle);
4894
- break;
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
+ }
4895
4978
  }
4896
4979
  }
4897
4980
  createGroupContainer(groupId, groupHeader) {
@@ -5091,8 +5174,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5091
5174
  this.ribbonGroupButtonModule.switchGroupButton(item, itemEle);
5092
5175
  }
5093
5176
  item.setProperties({ activeSize: size }, true);
5094
- const ele = itemEle.querySelector('#' + item.id);
5095
- this.setItemSize(ele, item);
5177
+ if (itemEle) {
5178
+ const ele = itemEle.querySelector('#' + item.id);
5179
+ this.setItemSize(ele, item);
5180
+ }
5096
5181
  }
5097
5182
  }
5098
5183
  }
@@ -5175,7 +5260,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5175
5260
  }
5176
5261
  else {
5177
5262
  let itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
5178
- if (!itemEle) {
5263
+ if (!itemEle && overflowtarget) {
5179
5264
  itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
5180
5265
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
5181
5266
  this.updatePopupItems(item, itemEle, group.enableGroupOverflow, false);
@@ -5185,7 +5270,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5185
5270
  if (item.type === RibbonItemType.GroupButton) {
5186
5271
  this.ribbonGroupButtonModule.switchGroupButton(item, itemEle);
5187
5272
  }
5188
- groupCollection.append(itemEle);
5273
+ if (itemEle) {
5274
+ groupCollection.append(itemEle);
5275
+ }
5189
5276
  }
5190
5277
  let ele = groupContainer.querySelector('#' + item.id);
5191
5278
  if (item.type === RibbonItemType.GroupButton) {
@@ -5272,9 +5359,28 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5272
5359
  if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
5273
5360
  groupEle.classList.add('e-ribbon-emptyCollection');
5274
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)];
5275
5374
  }
5276
5375
  return groupElements;
5277
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
+ }
5278
5384
  validateItemSize() {
5279
5385
  for (let k = 0; k < this.tabs.length; k++) {
5280
5386
  const groupList = this.tabs[parseInt(k.toString(), 10)].groups;
@@ -5403,6 +5509,13 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5403
5509
  else {
5404
5510
  itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
5405
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
+ }
5406
5519
  this.createRibbonItem(item, itemEle);
5407
5520
  if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
5408
5521
  this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
@@ -5955,7 +6068,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
5955
6068
  }
5956
6069
  const contentEle = this.tabObj.items[itemProp.tabIndex].content;
5957
6070
  const groupEle = contentEle.querySelector('#' + groupID);
5958
- isHidden ? groupEle.classList.add('e-hidden') : groupEle.classList.remove('e-hidden');
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
+ }
5959
6077
  if (this.overflowDDB) {
5960
6078
  const overflowEle = this.overflowDDB.target;
5961
6079
  const ofTabContainer = overflowEle.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
@@ -6005,7 +6123,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
6005
6123
  }
6006
6124
  const contentEle = this.tabObj.items[itemProp.tabIndex].content;
6007
6125
  const groupEle = contentEle.querySelector('#' + groupID);
6008
- isDisabled ? groupEle.classList.add('e-disabled') : groupEle.classList.remove('e-disabled');
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
+ }
6009
6132
  if (this.overflowDDB) {
6010
6133
  const overflowEle = this.overflowDDB.target;
6011
6134
  const ofTabContainer = overflowEle.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
@@ -6232,6 +6355,36 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
6232
6355
  if (ele) {
6233
6356
  const itemEle = closest(ele, '.e-ribbon-item');
6234
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
+ }
6235
6388
  }
6236
6389
  }
6237
6390
  /**
@@ -6708,6 +6861,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
6708
6861
  super.destroy();
6709
6862
  this.tabObj.destroy();
6710
6863
  this.tabObj = undefined;
6864
+ this.initialPropsData = {};
6711
6865
  remove(this.element.querySelector('#' + this.element.id + TAB_ID));
6712
6866
  this.element.style.removeProperty(RIBBON_FILE_MENU_WIDTH);
6713
6867
  this.element.style.removeProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH);
@@ -7739,5 +7893,5 @@ class RibbonBackstage extends Component {
7739
7893
  // export all modules from current location
7740
7894
  // example: export * from './module'
7741
7895
 
7742
- export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, RibbonGroupButtonSelection, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, BACKSTAGE_CLOSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_SINGLE_BUTTON_SELECTION, RIBBON_MULTIPLE_BUTTON_SELECTION, RIBBON_GROUP_BUTTON, RIBBON_GROUP_BUTTON_OVERFLOW_POPUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_TEMPLATE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, RIBBON_BACKSTAGE_POPUP, RIBBON_BACKSTAGE_OPEN, RIBBON_BACKSTAGE_CONTENT, RIBBON_SELECTED_CONTENT, RIBBON_BACKSTAGE, RIBBON_BACKSTAGE_MENU, RIBBON_BACKSTAGE_TEMPLATE, RIBBON_BACKSTAGE_MENU_WRAPPER, RIBBON_BACKSTAGE_ITEMS_WRAPPER, RIBBON_BACKSTAGE_TEXT_MENU, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_BACKSTAGE_MENU_ID, RIBBON_BACKSTAGE_POPUP_ID, RIBBON_FILE_MENU_LIST, RIBBON_MENU_LIST, RIBBON_FOOTER_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_GROUP_BUTTON_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, BackStageMenu, BackstageBackButton, BackstageItem, RibbonTooltip, RibbonGroupButtonSettings, RibbonGroupButtonItem, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonGroupButton, RibbonFileMenu, RibbonBackstage };
7896
+ export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, RibbonGroupButtonSelection, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, BACKSTAGE_CLOSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_SINGLE_BUTTON_SELECTION, RIBBON_MULTIPLE_BUTTON_SELECTION, RIBBON_GROUP_BUTTON, RIBBON_GROUP_BUTTON_OVERFLOW_POPUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_TEMPLATE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, RIBBON_BACKSTAGE_POPUP, RIBBON_BACKSTAGE_OPEN, RIBBON_BACKSTAGE_CONTENT, RIBBON_SELECTED_CONTENT, RIBBON_BACKSTAGE, RIBBON_BACKSTAGE_MENU, RIBBON_BACKSTAGE_TEMPLATE, RIBBON_BACKSTAGE_MENU_WRAPPER, RIBBON_BACKSTAGE_ITEMS_WRAPPER, RIBBON_BACKSTAGE_TEXT_MENU, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_BACKSTAGE_MENU_ID, RIBBON_BACKSTAGE_POPUP_ID, RIBBON_FILE_MENU_LIST, RIBBON_MENU_LIST, RIBBON_FOOTER_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_GROUP_BUTTON_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, setCustomAttributes, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, BackStageMenu, BackstageBackButton, BackstageItem, RibbonTooltip, RibbonGroupButtonSettings, RibbonGroupButtonItem, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonGroupButton, RibbonFileMenu, RibbonBackstage };
7743
7897
  //# sourceMappingURL=ej2-ribbon.es2015.js.map