@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.
@@ -3333,10 +3333,7 @@ var RibbonGroupButton = /** @__PURE__ @class */ (function () {
3333
3333
  this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
3334
3334
  }
3335
3335
  buttonEle.onclick = buttonEle.onkeydown = function () {
3336
- if (itemElement.querySelector('#' + item.id).classList.contains('e-active')) {
3337
- document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
3338
- _this.grpBtnIndex = 0;
3339
- }
3336
+ _this.handleFocusState(item, itemElement);
3340
3337
  };
3341
3338
  btnContainerEle.onkeydown = function (e) {
3342
3339
  if (_this.parent.activeLayout === 'Simplified') {
@@ -3507,10 +3504,7 @@ var RibbonGroupButton = /** @__PURE__ @class */ (function () {
3507
3504
  this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
3508
3505
  }
3509
3506
  buttonEle.onclick = buttonEle.onkeydown = function () {
3510
- if (itemElement.querySelector('#' + item.id).classList.contains('e-active')) {
3511
- document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
3512
- _this.grpBtnIndex = 0;
3513
- }
3507
+ _this.handleFocusState(item, itemElement);
3514
3508
  };
3515
3509
  containerEle.onkeydown = function (e) {
3516
3510
  if (_this.parent.activeLayout === 'Simplified') {
@@ -3529,6 +3523,18 @@ var RibbonGroupButton = /** @__PURE__ @class */ (function () {
3529
3523
  }
3530
3524
  }
3531
3525
  };
3526
+ RibbonGroupButton.prototype.handleFocusState = function (item, itemElement) {
3527
+ if (itemElement.querySelector('#' + item.id).classList.contains('e-active')) {
3528
+ var defaultSelectedBtn = document.querySelector('#' + item.id + '_grpbtn').querySelector('.' + RIBBON_GROUP_BUTTON + '.e-active');
3529
+ if (defaultSelectedBtn) {
3530
+ defaultSelectedBtn.focus();
3531
+ }
3532
+ else {
3533
+ document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + 0).focus();
3534
+ }
3535
+ this.grpBtnIndex = 0;
3536
+ }
3537
+ };
3532
3538
  RibbonGroupButton.prototype.addGroupButtonHeader = function (itemID, groupBtnSettings, popupEle) {
3533
3539
  var groupButtonHeader = this.parent.createElement('div', {
3534
3540
  className: 'e-ribbon-groupbutton-header',
@@ -3746,6 +3752,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
3746
3752
  this.idIndex = 0;
3747
3753
  this.tooltipData = [];
3748
3754
  this.initialPropsData = {};
3755
+ this.hiddenElements = {};
3756
+ this.hiddenGroups = [];
3749
3757
  this.isAddRemove = false;
3750
3758
  this.keyConfigs = {
3751
3759
  leftarrow: 'leftarrow',
@@ -4118,6 +4126,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4118
4126
  selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
4119
4127
  var eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex };
4120
4128
  this.setProperties({ selectedTab: selectedIndex }, true);
4129
+ this.calculateHiddenElementsWidth(selectedIndex);
4121
4130
  this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
4122
4131
  if (this.activeLayout === 'Simplified' && this.overflowDDB) {
4123
4132
  var overflowTarget = this.overflowDDB.target;
@@ -4241,6 +4250,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4241
4250
  var orderedGroups = this.getGroupResizeOrder(true, tabIndex);
4242
4251
  var isEmptyCollection;
4243
4252
  for (var i = 0; ((i < orderedGroups.length) && (tabContent.offsetWidth < activeContent.offsetWidth)); i++) {
4253
+ var isGroupUpdated = false;
4244
4254
  var group = orderedGroups[parseInt(i.toString(), 10)];
4245
4255
  var groupEle = tabContent.querySelector('#' + group.id);
4246
4256
  var groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
@@ -4252,7 +4262,67 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4252
4262
  var itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
4253
4263
  if (((item.displayOptions === DisplayMode.Auto) ||
4254
4264
  (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
4255
- itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
4265
+ var groupHidden = false;
4266
+ var itemHidden = false;
4267
+ var isAllItemHidden = false;
4268
+ var isEmptyCollection_1 = false;
4269
+ var groupItems = void 0;
4270
+ if (groupEle.classList.contains('e-hidden') || groupEle.classList.contains('e-hide-group')) {
4271
+ groupItems = groupEle.querySelectorAll('.e-ribbon-item.e-hidden');
4272
+ if (groupItems.length) {
4273
+ for (var i_1 = 0; i_1 < groupItems.length; i_1++) {
4274
+ groupItems[parseInt(i_1.toString(), 10)].classList.remove('e-hidden');
4275
+ }
4276
+ }
4277
+ if (groupEle.classList.contains('e-hide-group')) {
4278
+ isAllItemHidden = true;
4279
+ groupEle.classList.remove('e-hide-group');
4280
+ groupEle.classList.remove('e-ribbon-emptyCollection');
4281
+ if (this.hiddenGroups.indexOf(groupEle.id) !== -1) {
4282
+ this.hiddenGroups.splice(this.hiddenGroups.indexOf(groupEle.id), 1);
4283
+ }
4284
+ }
4285
+ else {
4286
+ groupHidden = true;
4287
+ groupEle.classList.remove('e-hidden');
4288
+ }
4289
+ if (!isGroupUpdated) {
4290
+ this.calculateOverflowItemsWidth(groupEle.offsetWidth, false, tabIndex);
4291
+ this.calculateMediumDataWidth(groupEle.offsetWidth, tabIndex, false);
4292
+ isGroupUpdated = true;
4293
+ }
4294
+ }
4295
+ else {
4296
+ if (itemContainer.classList.contains('e-hidden')) {
4297
+ itemHidden = true;
4298
+ itemContainer.classList.remove('e-hidden');
4299
+ if (groupEle.classList.contains('e-ribbon-emptyCollection')) {
4300
+ isEmptyCollection_1 = true;
4301
+ groupEle.classList.remove('e-ribbon-emptyCollection');
4302
+ }
4303
+ this.calculateOverflowItemsWidth(itemContainer.offsetWidth, false, tabIndex);
4304
+ this.calculateMediumDataWidth(itemContainer.offsetWidth, tabIndex, false);
4305
+ }
4306
+ }
4307
+ itemContainer.setAttribute('data-simplified-width', (activeContent.offsetWidth).toString());
4308
+ if (itemHidden) {
4309
+ itemContainer.classList.add('e-hidden');
4310
+ }
4311
+ if (groupItems && groupItems.length) {
4312
+ for (var i_2 = 0; i_2 < groupItems.length; i_2++) {
4313
+ groupItems[parseInt(i_2.toString(), 10)].classList.add('e-hidden');
4314
+ }
4315
+ }
4316
+ if (groupHidden) {
4317
+ groupEle.classList.add('e-hidden');
4318
+ }
4319
+ if (isAllItemHidden) {
4320
+ groupEle.classList.add('e-hide-group');
4321
+ groupEle.classList.add('e-ribbon-emptyCollection');
4322
+ }
4323
+ if (isEmptyCollection_1) {
4324
+ groupEle.classList.add('e-ribbon-emptyCollection');
4325
+ }
4256
4326
  this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer, true);
4257
4327
  if (item.activeSize === RibbonItemSize.Small) {
4258
4328
  var itemEle = itemContainer.querySelector('#' + item.id);
@@ -4346,31 +4416,55 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4346
4416
  if (((item.displayOptions === DisplayMode.Auto) ||
4347
4417
  (item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
4348
4418
  var width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
4419
+ var groupItemEle = tabContent.querySelector('#' + group.id);
4420
+ if (itemContainer.classList.contains('e-hidden') || groupItemEle.classList.contains('e-hidden')) {
4421
+ width = Math.abs(width - activeContent.offsetWidth);
4422
+ }
4349
4423
  if (!isClear && (tabContent.offsetWidth < width)) {
4350
4424
  flag = false;
4351
4425
  break;
4352
4426
  }
4353
- var groupEle_1 = tabContent.querySelector('#' + collection.id);
4427
+ var groupEle = tabContent.querySelector('#' + collection.id);
4354
4428
  if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton) || (item.type === RibbonItemType.GroupButton)) {
4355
4429
  this.updatePopupItems(item, itemContainer, group.enableGroupOverflow, false);
4356
4430
  }
4357
- groupEle_1.append(itemContainer);
4431
+ groupEle.append(itemContainer);
4432
+ if (itemContainer.classList.contains('e-hidden') || groupItemEle.classList.contains('e-hidden')) {
4433
+ itemContainer.setAttribute('data-simplified-width', width.toString());
4434
+ var isGroupHidden = false;
4435
+ var widthDifference = 0;
4436
+ if (itemContainer.classList.contains('e-hidden')) {
4437
+ itemContainer.classList.remove('e-hidden');
4438
+ if (groupItemEle.classList.contains('e-hide-group')) {
4439
+ isGroupHidden = true;
4440
+ widthDifference = this.checkWidthDifference(itemContainer, groupItemEle);
4441
+ }
4442
+ width = itemContainer.offsetWidth + widthDifference;
4443
+ itemContainer.classList.add('e-hidden');
4444
+ }
4445
+ this.calculateOverflowItemsWidth(width, true, tabIndex);
4446
+ this.calculateMediumDataWidth(width, tabIndex, true);
4447
+ if (isGroupHidden) {
4448
+ groupItemEle.classList.add('e-hide-group');
4449
+ groupItemEle.classList.add('e-ribbon-emptyCollection');
4450
+ }
4451
+ }
4358
4452
  this.removeOverflowEvent(item, itemContainer);
4359
4453
  if (item.allowedSizes & RibbonItemSize.Small) {
4360
4454
  item.setProperties({ activeSize: RibbonItemSize.Small }, true);
4361
4455
  this.setItemSize(itemContainer.querySelector('#' + item.id), item);
4362
4456
  }
4363
- }
4364
- }
4365
- }
4366
- var groupEle = tabContent.querySelector('#' + group.id);
4367
- var itemEle = groupEle.querySelector('.' + RIBBON_ITEM);
4368
- if (groupEle.classList.contains('e-ribbon-emptyCollection') && itemEle !== null) {
4369
- var itemsLength = groupEle.querySelectorAll('.' + RIBBON_ITEM);
4370
- if (itemsLength) {
4371
- isEmptyCollection = this.checkEmptyCollection(itemsLength);
4372
- if (!isEmptyCollection) {
4373
- groupEle.classList.remove('e-ribbon-emptyCollection');
4457
+ var groupElement = tabContent.querySelector('#' + group.id);
4458
+ var itemEle = groupElement.querySelector('.' + RIBBON_ITEM);
4459
+ if (groupElement.classList.contains('e-ribbon-emptyCollection') && itemEle !== null) {
4460
+ var itemsLength = groupElement.querySelectorAll('.' + RIBBON_ITEM);
4461
+ if (itemsLength) {
4462
+ isEmptyCollection = this.checkEmptyCollection(itemsLength);
4463
+ if (!isEmptyCollection) {
4464
+ groupElement.classList.remove('e-ribbon-emptyCollection');
4465
+ }
4466
+ }
4467
+ }
4374
4468
  }
4375
4469
  }
4376
4470
  }
@@ -4392,7 +4486,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4392
4486
  }
4393
4487
  }
4394
4488
  }
4395
- this.checkOverflowHiddenItems(group.enableGroupOverflow, tabIndex, group.id);
4489
+ }
4490
+ for (var i = 0; i < orderedGroups.length; i++) {
4491
+ this.checkOverflowHiddenItems(orderedGroups[parseInt(i.toString(), 10)].enableGroupOverflow, tabIndex, orderedGroups[parseInt(i.toString(), 10)].id);
4396
4492
  }
4397
4493
  if (this.overflowDDB) {
4398
4494
  var overflowEle = this.overflowDDB.target;
@@ -5729,22 +5825,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
5729
5825
  var activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + CONTENT_ID);
5730
5826
  var tabContent = activeContent.closest('.' + TAB_CONTENT);
5731
5827
  if (this.activeLayout === 'Simplified') {
5732
- for (var i_1 = 0; i_1 < groupList.length; i_1++) {
5733
- var group = groupList[parseInt(i_1.toString(), 10)];
5734
- var alignType = groupList[parseInt(i_1.toString(), 10)].orientation;
5828
+ for (var i_3 = 0; i_3 < groupList.length; i_3++) {
5829
+ var group = groupList[parseInt(i_3.toString(), 10)];
5830
+ var alignType = groupList[parseInt(i_3.toString(), 10)].orientation;
5735
5831
  if (group.isCollapsed) {
5736
5832
  group.setProperties({ isCollapsed: false }, true);
5737
5833
  this.removeDropdown(group.id);
5738
5834
  }
5739
5835
  else {
5740
- this.checkSmallToMedium(tabIndex, tab, i_1, tabContent, activeContent, true, false);
5741
- this.checkMediumToLarge(tabIndex, tab, i_1, tabContent, activeContent, true, false);
5836
+ this.checkSmallToMedium(tabIndex, tab, i_3, tabContent, activeContent, true, false);
5837
+ this.checkMediumToLarge(tabIndex, tab, i_3, tabContent, activeContent, true, false);
5742
5838
  }
5743
5839
  var groupEle = tabContent.querySelector('#' + group.id);
5744
5840
  var groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
5745
5841
  var shrinkColumns = groupContainer.querySelectorAll('.' + 'e-ribbon-shrink');
5746
- for (var i_2 = 0; i_2 < shrinkColumns.length; i_2++) {
5747
- shrinkColumns[parseInt(i_2.toString(), 10)].remove();
5842
+ for (var i_4 = 0; i_4 < shrinkColumns.length; i_4++) {
5843
+ shrinkColumns[parseInt(i_4.toString(), 10)].remove();
5748
5844
  }
5749
5845
  var groupHeader = groupContainer.querySelector('#' + group.id + HEADER_ID);
5750
5846
  groupHeader.remove();
@@ -5812,9 +5908,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
5812
5908
  }
5813
5909
  else {
5814
5910
  this.element.classList.remove(RIBBON_OVERFLOW);
5815
- for (var i_3 = 0; i_3 < groupList.length; i_3++) {
5816
- var group = groupList[parseInt(i_3.toString(), 10)];
5817
- var alignType = groupList[parseInt(i_3.toString(), 10)].orientation;
5911
+ for (var i_5 = 0; i_5 < groupList.length; i_5++) {
5912
+ var group = groupList[parseInt(i_5.toString(), 10)];
5913
+ var alignType = groupList[parseInt(i_5.toString(), 10)].orientation;
5818
5914
  var groupContainer = tabContent.querySelector('#' + group.id + CONTAINER_ID);
5819
5915
  var groupContent = groupContainer.querySelector('#' + group.id + CONTENT_ID);
5820
5916
  var groupHeader = this.createElement('div', {
@@ -6288,15 +6384,15 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
6288
6384
  var moduleName = this.getItemModuleName(item);
6289
6385
  if (moduleName !== 'template') {
6290
6386
  if (moduleName === 'group-btn' && this.activeLayout === 'Classic') {
6291
- for (var i_4 = 0; i_4 < item.groupButtonSettings.items.length; i_4++) {
6292
- var btnEle = ele.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + i_4);
6387
+ for (var i_6 = 0; i_6 < item.groupButtonSettings.items.length; i_6++) {
6388
+ var btnEle = ele.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + i_6);
6293
6389
  updateCommonProperty(btnEle, 'btn', commonProp);
6294
6390
  }
6295
6391
  }
6296
6392
  else if (moduleName === 'group-btn' && this.activeLayout === 'Simplified') {
6297
6393
  updateCommonProperty(ele, 'dropdown-btn', commonProp);
6298
- for (var i_5 = 0; i_5 < item.groupButtonSettings.items.length; i_5++) {
6299
- var btnEle = document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + i_5);
6394
+ for (var i_7 = 0; i_7 < item.groupButtonSettings.items.length; i_7++) {
6395
+ var btnEle = document.querySelector('#' + item.id + RIBBON_GROUP_BUTTON_ID + i_7);
6300
6396
  updateCommonProperty(btnEle, 'btn', commonProp);
6301
6397
  }
6302
6398
  }
@@ -6728,7 +6824,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
6728
6824
  var contentEle = this.tabObj.items[itemProp.tabIndex].content;
6729
6825
  var groupEle = contentEle.querySelector('#' + groupID);
6730
6826
  if (groupEle) {
6731
- isHidden ? groupEle.classList.add('e-hidden') : groupEle.classList.remove('e-hidden');
6827
+ this.updateHiddenElements(itemProp.tabIndex, isHidden ? 'hideGroup' : 'showGroup', groupID, isHidden, groupEle);
6732
6828
  }
6733
6829
  else {
6734
6830
  this.updateInitialProps(itemProp.tabIndex, groupID, 'hiddenGroups', isHidden);
@@ -6753,7 +6849,244 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
6753
6849
  }
6754
6850
  }
6755
6851
  }
6756
- this.refreshLayout();
6852
+ if (this.selectedTab === itemProp.tabIndex) {
6853
+ this.refreshLayout();
6854
+ }
6855
+ };
6856
+ Ribbon.prototype.updateHiddenElements = function (tabIndex, key, id, isHidden, element, group) {
6857
+ if (isHidden) {
6858
+ if (!(element.classList.contains('e-hidden'))) {
6859
+ this.checkHiddenElements(key, id, tabIndex);
6860
+ element.classList.add('e-hidden');
6861
+ if (key === 'hideItem') {
6862
+ this.checkHiddenItems(group, isHidden, tabIndex);
6863
+ }
6864
+ this.calculateHiddenElementsWidth(tabIndex);
6865
+ }
6866
+ }
6867
+ else {
6868
+ if (element.classList.contains('e-hidden')) {
6869
+ this.checkHiddenElements(key, id, tabIndex);
6870
+ element.classList.remove('e-hidden');
6871
+ this.calculateHiddenElementsWidth(tabIndex);
6872
+ if (key === 'showItem') {
6873
+ this.checkHiddenItems(group, isHidden, tabIndex);
6874
+ }
6875
+ }
6876
+ }
6877
+ };
6878
+ Ribbon.prototype.checkHiddenElements = function (key, id, tabIndex) {
6879
+ if (this.activeLayout === 'Simplified') {
6880
+ var hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
6881
+ if (!hiddenProps) {
6882
+ this.hiddenElements[parseInt(tabIndex.toString(), 10)] = {};
6883
+ hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
6884
+ }
6885
+ if (hiddenProps) {
6886
+ /* eslint-disable */
6887
+ if (!hiddenProps[key]) {
6888
+ hiddenProps[key] = [];
6889
+ }
6890
+ if (hiddenProps[key].length) {
6891
+ var index = hiddenProps[key].indexOf(id);
6892
+ if (index === -1) {
6893
+ hiddenProps[key].push(id);
6894
+ }
6895
+ }
6896
+ else {
6897
+ hiddenProps[key].push(id);
6898
+ }
6899
+ /* eslint-enable */
6900
+ }
6901
+ }
6902
+ };
6903
+ Ribbon.prototype.updateItemsSimplifiedWidth = function (tabIndex, key) {
6904
+ var hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
6905
+ /* eslint-disable */
6906
+ if (hiddenProps && hiddenProps[key] && hiddenProps[key].length) {
6907
+ var _loop_4 = function (i) {
6908
+ var contentEle = this_4.tabObj.items[tabIndex].content;
6909
+ var hiddenEle;
6910
+ var groupEle = void 0;
6911
+ var isGroupHidden = false;
6912
+ var widthDifference = 0;
6913
+ if (key === 'hideGroup' || key === 'showGroup') {
6914
+ hiddenEle = contentEle.querySelector('#' + hiddenProps[key][i]);
6915
+ }
6916
+ else {
6917
+ hiddenEle = contentEle.querySelector('#' + hiddenProps[key][i] + CONTAINER_ID);
6918
+ }
6919
+ if (hiddenEle) {
6920
+ if (key === 'hideGroup' || key === 'hideItem') {
6921
+ var isHidden = false;
6922
+ if (hiddenEle.classList.contains('e-hidden')) {
6923
+ isHidden = true;
6924
+ hiddenEle.classList.remove('e-hidden');
6925
+ }
6926
+ if (key === 'hideItem') {
6927
+ groupEle = hiddenEle.closest('.e-ribbon-group');
6928
+ if (groupEle.classList.contains('e-hide-group')) {
6929
+ isGroupHidden = true;
6930
+ widthDifference = this_4.checkWidthDifference(hiddenEle, groupEle);
6931
+ }
6932
+ }
6933
+ this_4.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, true, tabIndex);
6934
+ this_4.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, true);
6935
+ if (isHidden) {
6936
+ hiddenEle.classList.add('e-hidden');
6937
+ }
6938
+ }
6939
+ else {
6940
+ if (key === 'showItem') {
6941
+ groupEle = hiddenEle.closest('.e-ribbon-group');
6942
+ if (groupEle.classList.contains('e-hide-group')) {
6943
+ isGroupHidden = true;
6944
+ groupEle.classList.remove('e-hide-group');
6945
+ groupEle.classList.remove('e-ribbon-emptyCollection');
6946
+ widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
6947
+ if (this_4.hiddenGroups.indexOf(groupEle.id) !== -1) {
6948
+ this_4.hiddenGroups.splice(this_4.hiddenGroups.indexOf(groupEle.id), 1);
6949
+ }
6950
+ }
6951
+ else {
6952
+ if (this_4.hiddenGroups.indexOf(groupEle.id) !== -1) {
6953
+ var hiddenItems = groupEle.querySelectorAll('.e-ribbon-item:not(.e-hidden)');
6954
+ hiddenItems.forEach(function (item) {
6955
+ if (item.id !== hiddenEle.id) {
6956
+ item.classList.add('e-hidden');
6957
+ }
6958
+ });
6959
+ widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
6960
+ hiddenItems.forEach(function (item) {
6961
+ if (item.id !== hiddenEle.id) {
6962
+ item.classList.remove('e-hidden');
6963
+ }
6964
+ });
6965
+ this_4.hiddenGroups.splice(this_4.hiddenGroups.indexOf(groupEle.id), 1);
6966
+ }
6967
+ }
6968
+ }
6969
+ this_4.calculateOverflowItemsWidth(hiddenEle.offsetWidth + widthDifference, false, tabIndex);
6970
+ this_4.calculateMediumDataWidth(hiddenEle.offsetWidth + widthDifference, tabIndex, false);
6971
+ }
6972
+ if (isGroupHidden) {
6973
+ groupEle.classList.add('e-hide-group');
6974
+ groupEle.classList.add('e-ribbon-emptyCollection');
6975
+ }
6976
+ }
6977
+ var index = hiddenProps[key].indexOf(hiddenProps[key][i]);
6978
+ if (index !== -1) {
6979
+ hiddenProps[key].splice(index, 1);
6980
+ i--;
6981
+ }
6982
+ out_i_1 = i;
6983
+ };
6984
+ var this_4 = this, out_i_1;
6985
+ for (var i = 0; i < hiddenProps[key].length; i++) {
6986
+ _loop_4(i);
6987
+ i = out_i_1;
6988
+ }
6989
+ }
6990
+ };
6991
+ Ribbon.prototype.checkWidthDifference = function (hiddenEle, groupEle) {
6992
+ var widthDifference = 0;
6993
+ groupEle.classList.remove('e-hide-group');
6994
+ groupEle.classList.remove('e-ribbon-emptyCollection');
6995
+ if (this.hiddenGroups.length) {
6996
+ if (this.hiddenGroups.indexOf(groupEle.id) === -1) {
6997
+ this.hiddenGroups.push(groupEle.id);
6998
+ widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
6999
+ }
7000
+ }
7001
+ else {
7002
+ this.hiddenGroups.push(groupEle.id);
7003
+ widthDifference = Math.abs(hiddenEle.offsetWidth - groupEle.offsetWidth);
7004
+ }
7005
+ return widthDifference;
7006
+ };
7007
+ Ribbon.prototype.calculateHiddenElementsWidth = function (tabIndex) {
7008
+ if (tabIndex === this.selectedTab && this.activeLayout === 'Simplified') {
7009
+ var hiddenProps = this.hiddenElements[parseInt(tabIndex.toString(), 10)];
7010
+ if (hiddenProps) {
7011
+ for (var i = 0; i < Object.keys(hiddenProps).length; i++) {
7012
+ this.updateItemsSimplifiedWidth(tabIndex, Object.keys(hiddenProps)[parseInt(i.toString(), 10)]);
7013
+ }
7014
+ }
7015
+ }
7016
+ };
7017
+ Ribbon.prototype.calculateMediumDataWidth = function (hiddenWidth, tabIndex, isHidden) {
7018
+ if (this.selectedTab === tabIndex && this.activeLayout === 'Simplified') {
7019
+ var activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + CONTENT_ID);
7020
+ var mediumDataItems = Array.prototype.slice.call(activeContent.querySelectorAll('.e-ribbon-item'));
7021
+ if (this.overflowDDB) {
7022
+ var overflowEle = this.overflowDDB.target;
7023
+ var overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
7024
+ var selectedOFTab = document.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
7025
+ for (var i = 0; i < overflowItems.length; i++) {
7026
+ var ofTab = overflowItems[parseInt(i.toString(), 10)].closest('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
7027
+ if (selectedOFTab && ofTab && selectedOFTab.id === ofTab.id && overflowItems[parseInt(i.toString(), 10)].hasAttribute('data-medium-width')) {
7028
+ mediumDataItems.push(overflowItems[parseInt(i.toString(), 10)]);
7029
+ }
7030
+ }
7031
+ }
7032
+ var groupOFButton = activeContent.querySelectorAll('.e-ribbon-group-of-btn');
7033
+ for (var i = 0; i < groupOFButton.length; i++) {
7034
+ var overflowButton = getInstance(groupOFButton[parseInt(i.toString(), 10)], DropDownButton);
7035
+ var overflowBtnTarget = overflowButton.target;
7036
+ var overflowItems = overflowBtnTarget.querySelectorAll('.e-ribbon-item');
7037
+ for (var i_8 = 0; i_8 < overflowItems.length; i_8++) {
7038
+ if (overflowItems[parseInt(i_8.toString(), 10)].hasAttribute('data-medium-width')) {
7039
+ mediumDataItems.push(overflowItems[parseInt(i_8.toString(), 10)]);
7040
+ }
7041
+ }
7042
+ }
7043
+ for (var i = 0; i < mediumDataItems.length; i++) {
7044
+ if (mediumDataItems[parseInt(i.toString(), 10)].hasAttribute('data-medium-width')) {
7045
+ var previousWidth = parseInt(mediumDataItems[parseInt(i.toString(), 10)].getAttribute('data-medium-width'), 10);
7046
+ mediumDataItems[parseInt(i.toString(), 10)].setAttribute('data-medium-width', isHidden ? (previousWidth - hiddenWidth).toString() : (previousWidth + hiddenWidth).toString());
7047
+ }
7048
+ }
7049
+ }
7050
+ };
7051
+ Ribbon.prototype.calculateOverflowItemsWidth = function (hiddenItem, isHidden, tabIndex) {
7052
+ if (this.selectedTab === tabIndex && this.activeLayout === 'Simplified') {
7053
+ var groupList = this.tabs[parseInt(tabIndex.toString(), 10)].groups;
7054
+ for (var i = 0; i < groupList.length; i++) {
7055
+ var group = groupList[parseInt(i.toString(), 10)];
7056
+ if (group.enableGroupOverflow) {
7057
+ var groupContainer = document.querySelector('#' + group.id);
7058
+ var overflowButton = void 0;
7059
+ var overflowDDB = groupContainer.querySelector('#' + group.id + GROUPOF_BUTTON_ID);
7060
+ if (overflowDDB) {
7061
+ overflowButton = getInstance(overflowDDB, DropDownButton);
7062
+ }
7063
+ if (overflowButton) {
7064
+ var overflowEle = overflowButton.target;
7065
+ var overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
7066
+ for (var i_9 = 0; i_9 < overflowItems.length; i_9++) {
7067
+ var previousWidth = parseInt(overflowItems[parseInt(i_9.toString(), 10)].getAttribute('data-simplified-width'), 10);
7068
+ if (previousWidth) {
7069
+ overflowItems[parseInt(i_9.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
7070
+ }
7071
+ }
7072
+ }
7073
+ }
7074
+ }
7075
+ }
7076
+ if (this.overflowDDB) {
7077
+ var selectedOFTab = document.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
7078
+ var overflowEle = this.overflowDDB.target;
7079
+ var overflowItems = overflowEle.querySelectorAll('.e-ribbon-item');
7080
+ for (var i = 0; i < overflowItems.length; i++) {
7081
+ var ofTab = overflowItems[parseInt(i.toString(), 10)].closest('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + OVERFLOW_ID);
7082
+ if (selectedOFTab && ofTab && selectedOFTab.id === ofTab.id) {
7083
+ var previousWidth = parseInt(overflowItems[parseInt(i.toString(), 10)].getAttribute('data-simplified-width'), 10);
7084
+ if (previousWidth) {
7085
+ overflowItems[parseInt(i.toString(), 10)].setAttribute('data-simplified-width', isHidden ? (previousWidth - hiddenItem).toString() : (previousWidth + hiddenItem).toString());
7086
+ }
7087
+ }
7088
+ }
7089
+ }
6757
7090
  };
6758
7091
  /**
6759
7092
  * Disables a specific group within a ribbon tab.
@@ -7014,9 +7347,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
7014
7347
  }
7015
7348
  if (ele) {
7016
7349
  var itemEle = closest(ele, '.e-ribbon-item');
7017
- isHidden ? itemEle.classList.add('e-hidden') : itemEle.classList.remove('e-hidden');
7018
- this.checkHiddenItems(itemProp.group, isHidden, itemProp.tabIndex);
7019
- this.refreshLayout();
7350
+ this.updateHiddenElements(itemProp.tabIndex, isHidden ? 'hideItem' : 'showItem', itemId, isHidden, itemEle, itemProp.group);
7351
+ if (this.selectedTab === itemProp.tabIndex) {
7352
+ this.refreshLayout();
7353
+ }
7020
7354
  }
7021
7355
  else {
7022
7356
  this.updateInitialProps(itemProp.tabIndex, itemId, 'hiddenItems', isHidden);
@@ -7583,6 +7917,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
7583
7917
  this.keyboardModuleRibbon.destroy();
7584
7918
  this.keyboardModuleRibbon = null;
7585
7919
  destroyTooltip(this.element);
7920
+ if (this.refreshing) {
7921
+ this.clearOverflowDropDown(this.selectedTab);
7922
+ }
7586
7923
  this.destroyTabItems(this.tabs);
7587
7924
  if (!this.hideLayoutSwitcher) {
7588
7925
  this.removeExpandCollapse();
@@ -7590,6 +7927,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
7590
7927
  this.collapseButton = undefined;
7591
7928
  if (this.scrollModule) {
7592
7929
  this.scrollModule.destroy();
7930
+ this.scrollModule = null;
7593
7931
  }
7594
7932
  if (this.ribbonTempEle) {
7595
7933
  remove(this.ribbonTempEle);
@@ -7599,6 +7937,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
7599
7937
  this.tabObj.destroy();
7600
7938
  this.tabObj = undefined;
7601
7939
  this.initialPropsData = {};
7940
+ this.hiddenGroups = [];
7941
+ this.hiddenElements = {};
7602
7942
  remove(this.element.querySelector('#' + this.element.id + TAB_ID));
7603
7943
  this.element.style.removeProperty(RIBBON_FILE_MENU_WIDTH);
7604
7944
  this.element.style.removeProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH);