@syncfusion/ej2-ribbon 21.1.35 → 21.1.37

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 (60) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +61 -1
  3. package/dist/ej2-ribbon.umd.min.js +2 -2
  4. package/dist/ej2-ribbon.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-ribbon.es2015.js +42 -21
  6. package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
  7. package/dist/es6/ej2-ribbon.es5.js +42 -21
  8. package/dist/es6/ej2-ribbon.es5.js.map +1 -1
  9. package/dist/global/ej2-ribbon.min.js +2 -2
  10. package/dist/global/ej2-ribbon.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +12 -12
  13. package/src/ribbon/base/ribbon-model.d.ts +1 -1
  14. package/src/ribbon/base/ribbon.js +18 -10
  15. package/src/ribbon/base/utils.d.ts +15 -1
  16. package/src/ribbon/base/utils.js +16 -1
  17. package/src/ribbon/items/ribbon-button.d.ts +0 -1
  18. package/src/ribbon/items/ribbon-button.js +2 -1
  19. package/src/ribbon/items/ribbon-checkbox.d.ts +0 -1
  20. package/src/ribbon/items/ribbon-checkbox.js +0 -1
  21. package/src/ribbon/items/ribbon-colorpicker.d.ts +0 -1
  22. package/src/ribbon/items/ribbon-colorpicker.js +0 -1
  23. package/src/ribbon/items/ribbon-combobox.d.ts +0 -1
  24. package/src/ribbon/items/ribbon-combobox.js +0 -1
  25. package/src/ribbon/items/ribbon-dropdown.d.ts +0 -1
  26. package/src/ribbon/items/ribbon-dropdown.js +0 -1
  27. package/src/ribbon/items/ribbon-splitbutton.d.ts +0 -1
  28. package/src/ribbon/items/ribbon-splitbutton.js +0 -1
  29. package/src/ribbon/modules/ribbon-filemenu.js +6 -4
  30. package/styles/bootstrap-dark.css +11 -0
  31. package/styles/bootstrap.css +11 -0
  32. package/styles/bootstrap4.css +11 -0
  33. package/styles/bootstrap5-dark.css +11 -0
  34. package/styles/bootstrap5.css +11 -0
  35. package/styles/fabric-dark.css +11 -0
  36. package/styles/fabric.css +11 -0
  37. package/styles/fluent-dark.css +11 -0
  38. package/styles/fluent.css +11 -0
  39. package/styles/highcontrast-light.css +11 -0
  40. package/styles/highcontrast.css +11 -0
  41. package/styles/material-dark.css +11 -0
  42. package/styles/material.css +11 -0
  43. package/styles/ribbon/_layout.scss +16 -0
  44. package/styles/ribbon/bootstrap-dark.css +11 -0
  45. package/styles/ribbon/bootstrap.css +11 -0
  46. package/styles/ribbon/bootstrap4.css +11 -0
  47. package/styles/ribbon/bootstrap5-dark.css +11 -0
  48. package/styles/ribbon/bootstrap5.css +11 -0
  49. package/styles/ribbon/fabric-dark.css +11 -0
  50. package/styles/ribbon/fabric.css +11 -0
  51. package/styles/ribbon/fluent-dark.css +11 -0
  52. package/styles/ribbon/fluent.css +11 -0
  53. package/styles/ribbon/highcontrast-light.css +11 -0
  54. package/styles/ribbon/highcontrast.css +11 -0
  55. package/styles/ribbon/material-dark.css +11 -0
  56. package/styles/ribbon/material.css +11 -0
  57. package/styles/ribbon/tailwind-dark.css +11 -0
  58. package/styles/ribbon/tailwind.css +11 -0
  59. package/styles/tailwind-dark.css +11 -0
  60. package/styles/tailwind.css +11 -0
@@ -960,6 +960,7 @@ class RibbonButton {
960
960
  btnSettings.clicked.call(this, e);
961
961
  }
962
962
  };
963
+ buttonEle.setAttribute('aria-label', btnSettings.content);
963
964
  }
964
965
  /**
965
966
  * Adds the additional event handlers as the item moved into overflow popup.
@@ -986,7 +987,6 @@ class RibbonButton {
986
987
  *
987
988
  * @param {RibbonItemModel} item - Gets the ribbon item model.
988
989
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
989
- * @param {DropDownButton} overflowButton - Gets the overflow button.
990
990
  * @returns {void}
991
991
  * @hidden
992
992
  */
@@ -1039,6 +1039,7 @@ class RibbonButton {
1039
1039
  }
1040
1040
  if (prop.content) {
1041
1041
  prop.content = itemProp.item.activeSize === RibbonItemSize.Small ? '' : prop.content;
1042
+ buttonEle.setAttribute('aria-label', prop.content);
1042
1043
  }
1043
1044
  delete prop.clicked;
1044
1045
  buttonObj.setProperties(prop);
@@ -1130,7 +1131,6 @@ class RibbonCheckBox {
1130
1131
  *
1131
1132
  * @param {RibbonItemModel} item - Gets the ribbon item model.
1132
1133
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
1133
- * @param {DropDownButton} overflowButton - Gets the overflow button.
1134
1134
  * @returns {void}
1135
1135
  * @hidden
1136
1136
  */
@@ -1274,7 +1274,6 @@ class RibbonColorPicker {
1274
1274
  *
1275
1275
  * @param {RibbonItemModel} item - Gets the ribbon item model.
1276
1276
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
1277
- * @param {DropDownButton} overflowButton - Gets the overflow button.
1278
1277
  * @returns {void}
1279
1278
  * @hidden
1280
1279
  */
@@ -1438,7 +1437,6 @@ class RibbonComboBox {
1438
1437
  *
1439
1438
  * @param {RibbonItemModel} item - Gets the ribbon item model.
1440
1439
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
1441
- * @param {DropDownButton} overflowButton - Gets the overflow button.
1442
1440
  * @returns {void}
1443
1441
  * @hidden
1444
1442
  */
@@ -1602,7 +1600,6 @@ class RibbonDropDown {
1602
1600
  *
1603
1601
  * @param {RibbonItemModel} item - Gets the ribbon item model.
1604
1602
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
1605
- * @param {DropDownButton} overflowButton - Gets the overflow button.
1606
1603
  * @returns {void}
1607
1604
  * @hidden
1608
1605
  */
@@ -1882,7 +1879,6 @@ class RibbonSplitButton {
1882
1879
  *
1883
1880
  * @param {RibbonItemModel} item - Gets the ribbon item model.
1884
1881
  * @param {HTMLElement} itemEle - Gets the ribbon item element.
1885
- * @param {DropDownButton} overflowButton - Gets the overflow button.
1886
1882
  * @returns {void}
1887
1883
  * @hidden
1888
1884
  */
@@ -2006,6 +2002,7 @@ class RibbonSplitButton {
2006
2002
  * @param {Array} arr - Gets the array to find index.
2007
2003
  * @param {boolean} condition - Defines whether index matches with the value.
2008
2004
  * @returns {number} - Gets the index value.
2005
+ * @hidden
2009
2006
  */
2010
2007
  function getIndex(arr, condition) {
2011
2008
  for (let i = 0; i < arr.length; i++) {
@@ -2020,6 +2017,7 @@ function getIndex(arr, condition) {
2020
2017
  *
2021
2018
  * @param {string | HTMLElement} template - Template property value.
2022
2019
  * @returns {Function} - Return template function.
2020
+ * @hidden
2023
2021
  */
2024
2022
  function getTemplateFunction(template) {
2025
2023
  if (typeof template === 'string') {
@@ -2050,6 +2048,7 @@ function getTemplateFunction(template) {
2050
2048
  * @param {RibbonTabModel} tabs - Gets the ribbon tab model.
2051
2049
  * @param {string} id - Gets the ID of the tab.
2052
2050
  * @returns {itemProps} - Gets the ribbon item.
2051
+ * @hidden
2053
2052
  */
2054
2053
  function getItem(tabs, id) {
2055
2054
  for (let i = 0; i < tabs.length; i++) {
@@ -2078,6 +2077,7 @@ function getItem(tabs, id) {
2078
2077
  * @param {RibbonTabModel} tabs - Gets the ribbon tab model.
2079
2078
  * @param {string} id - Gets the ID of the tab.
2080
2079
  * @returns {itemProps} - Gets the ribbon collection.
2080
+ * @hidden
2081
2081
  */
2082
2082
  function getCollection(tabs, id) {
2083
2083
  for (let i = 0; i < tabs.length; i++) {
@@ -2103,6 +2103,7 @@ function getCollection(tabs, id) {
2103
2103
  * @param {RibbonTabModel} tabs - Gets the ribbon tab model.
2104
2104
  * @param {string} id - Gets the ID of the tab.
2105
2105
  * @returns {itemProps} - Gets the ribbon group.
2106
+ * @hidden
2106
2107
  */
2107
2108
  function getGroup(tabs, id) {
2108
2109
  for (let i = 0; i < tabs.length; i++) {
@@ -2122,6 +2123,7 @@ function getGroup(tabs, id) {
2122
2123
  * @param {HTMLElement} element - Gets the element to be destroyed.
2123
2124
  * @param {string} moduleName - Gets the module name.
2124
2125
  * @returns {void}
2126
+ * @hidden
2125
2127
  */
2126
2128
  function destroyControl(element, moduleName) {
2127
2129
  const control = getComponent(element, moduleName);
@@ -2134,6 +2136,7 @@ function destroyControl(element, moduleName) {
2134
2136
  * @param {string} moduleName - Gets the module name.
2135
2137
  * @param {commonProperties} commonProp - Gets the common properties to be updated.
2136
2138
  * @returns {void}
2139
+ * @hidden
2137
2140
  */
2138
2141
  function updateCommonProperty(element, moduleName, commonProp) {
2139
2142
  const control = getComponent(element, moduleName);
@@ -2146,6 +2149,7 @@ function updateCommonProperty(element, moduleName, commonProp) {
2146
2149
  * @param {string} moduleName - Gets the module name.
2147
2150
  * @param {boolean} disable - Defines whether the control to be disabled or not.
2148
2151
  * @returns {void}
2152
+ * @hidden
2149
2153
  */
2150
2154
  function updateControlDisabled(element, moduleName, disable) {
2151
2155
  const control = getComponent(element, moduleName);
@@ -2155,9 +2159,10 @@ function updateControlDisabled(element, moduleName, disable) {
2155
2159
  * Gets the ribbon item element.
2156
2160
  *
2157
2161
  * @param {Ribbon} parent - Gets the parent element.
2158
- * @param {itemProps} itemProp - Gets the ribbon item.
2159
2162
  * @param {string} id - Gets the ID of the item.
2163
+ * @param {itemProps} itemProp - Gets the ribbon item.
2160
2164
  * @returns {HTMLElement} - Gets the ribbon item element.
2165
+ * @hidden
2161
2166
  */
2162
2167
  function getItemElement(parent, id, itemProp) {
2163
2168
  if (!itemProp) {
@@ -2192,6 +2197,7 @@ function getItemElement(parent, id, itemProp) {
2192
2197
  /**
2193
2198
  * @param {RibbonTooltipModel} tooltip - Gets the property of tooltip.
2194
2199
  * @returns {boolean} - Gets whether the tooltip is present or not.
2200
+ * @hidden
2195
2201
  */
2196
2202
  function isTooltipPresent(tooltip) {
2197
2203
  return (tooltip.content || tooltip.iconCss || tooltip.title || tooltip.id || tooltip.cssClass) ? true : false;
@@ -2203,6 +2209,7 @@ function isTooltipPresent(tooltip) {
2203
2209
  * @param {Tooltip} tooltip - Gets the tooltip to set the content.
2204
2210
  * @param {ribbonTooltipData} tooltipData - Gets the tooltip data.
2205
2211
  * @returns {void}
2212
+ * @hidden
2206
2213
  */
2207
2214
  function setToolTipContent(args, tooltip, tooltipData) {
2208
2215
  const targetId = args.target.getAttribute('id');
@@ -2246,6 +2253,7 @@ function setToolTipContent(args, tooltip, tooltipData) {
2246
2253
  * @param {HTMLElement} element - Gets the element to add tooltip.
2247
2254
  * @param {Ribbon} ribbon - Gets the ribbon.
2248
2255
  * @returns {void}
2256
+ * @hidden
2249
2257
  */
2250
2258
  function createTooltip(element, ribbon) {
2251
2259
  const ribbonTooltip = new Tooltip({
@@ -2257,6 +2265,7 @@ function createTooltip(element, ribbon) {
2257
2265
  /**
2258
2266
  * @param {TooltipEventArgs} args - Gets the tooltip argument.
2259
2267
  * @returns {void}
2268
+ * @hidden
2260
2269
  */
2261
2270
  function beforeTooltipRender(args) {
2262
2271
  setToolTipContent(args, ribbonTooltip, ribbon.tooltipData);
@@ -2267,6 +2276,7 @@ function createTooltip(element, ribbon) {
2267
2276
  *
2268
2277
  * @param {HTMLElement} element - Gets the element in which the tooltip needs to be destroyed.
2269
2278
  * @returns {void}
2279
+ * @hidden
2270
2280
  */
2271
2281
  function destroyTooltip(element) {
2272
2282
  const control = getComponent(element, Tooltip);
@@ -2278,6 +2288,7 @@ function destroyTooltip(element) {
2278
2288
  * @param {HTMLElement} element - Gets the element in which the tooltip needs to be Updated.
2279
2289
  * @param {commonProperties} prop - Gets the property to be updated.
2280
2290
  * @returns {void}
2291
+ * @hidden
2281
2292
  */
2282
2293
  function updateTooltipProp(element, prop) {
2283
2294
  const control = getComponent(element, Tooltip);
@@ -2480,7 +2491,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2480
2491
  }
2481
2492
  //Adds Scroll if the tabwidth is less the content width even after adding overflow dropdown.
2482
2493
  if ((tabContent.offsetWidth < activeContent.offsetWidth) && (!this.scrollModule)) {
2483
- this.scrollModule = new HScroll({}, this.tabObj.element.querySelector('.' + TAB_CONTENT));
2494
+ this.scrollModule = new HScroll({
2495
+ enableRtl: this.enableRtl
2496
+ }, this.tabObj.element.querySelector('.' + TAB_CONTENT));
2484
2497
  }
2485
2498
  }
2486
2499
  else if (!isOverFlow) {
@@ -2561,8 +2574,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2561
2574
  const group = orderedGroups[parseInt(i.toString(), 10)];
2562
2575
  const groupEle = tabContent.querySelector('#' + group.id);
2563
2576
  const groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
2564
- for (let j = 0; ((j < group.collections.length) && (tabContent.offsetWidth < activeContent.offsetWidth)); j++) {
2565
- const collection = group.collections[parseInt(j.toString(), 10)];
2577
+ for (let j = group.collections.length; ((j >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); j--) {
2578
+ const collection = group.collections[parseInt((j - 1).toString(), 10)];
2566
2579
  const collectionEle = groupEle.querySelector('#' + collection.id);
2567
2580
  for (let k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
2568
2581
  const item = collection.items[k - 1];
@@ -2628,8 +2641,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
2628
2641
  overflowDDB = this.overflowDDB;
2629
2642
  overflowtarget = this.overflowDDB ? this.overflowDDB.target : null;
2630
2643
  }
2631
- for (let j = (group.collections.length); ((j >= 1) && flag); j--) {
2632
- const collection = group.collections[parseInt((j - 1).toString(), 10)];
2644
+ for (let j = 0; ((j < group.collections.length) && flag); j++) {
2645
+ const collection = group.collections[parseInt(j.toString(), 10)];
2633
2646
  // eslint-disable-next-line max-len
2634
2647
  for (let k = 0; ((k < collection.items.length) && flag && !isClear && (tabContent.offsetWidth > activeContent.offsetWidth)); k++) {
2635
2648
  const item = collection.items[parseInt(k.toString(), 10)];
@@ -3430,11 +3443,11 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3430
3443
  this.collapseButton = this.createElement('span', {
3431
3444
  className: RIBBON_COLLAPSE_BUTTON + SPACE + EXPAND_COLLAPSE_ICON,
3432
3445
  id: this.tabObj.element.id + COLLAPSE_BUTTON_ID,
3433
- attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Layout Switcher' }
3446
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Layout Switcher', 'role': 'button' }
3434
3447
  });
3435
3448
  this.collapseButton.onclick = () => { this.toggleLayout(); };
3436
3449
  this.collapseButton.onkeydown = (e) => {
3437
- if (e.key === "Enter") {
3450
+ if (e.key === 'Enter') {
3438
3451
  this.toggleLayout();
3439
3452
  }
3440
3453
  };
@@ -3678,13 +3691,13 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3678
3691
  const launcherIcon = this.createElement('div', {
3679
3692
  className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
3680
3693
  id: group.id + LAUNCHER_ID,
3681
- attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon' }
3694
+ attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
3682
3695
  });
3683
3696
  groupContainer.appendChild(launcherIcon);
3684
3697
  groupContainer.classList.add(RIBBON_LAUNCHER);
3685
3698
  EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, group.id), this);
3686
3699
  EventHandler.add(launcherIcon, 'keydown', (e) => {
3687
- if (e.key === "Enter") {
3700
+ if (e.key === 'Enter') {
3688
3701
  this.launcherIconClicked(group.id);
3689
3702
  }
3690
3703
  }, this);
@@ -3708,7 +3721,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
3708
3721
  for (let j = 0; j < items.length; j++) {
3709
3722
  const ribbonitem = items[parseInt(j.toString(), 10)];
3710
3723
  if (!ribbonitem.allowedSizes || (ribbonitem.allowedSizes === 0)) {
3711
- ribbonitem.setProperties({ allowedSizes: (RibbonItemSize.Small | RibbonItemSize.Medium | RibbonItemSize.Large) }, true);
3724
+ ribbonitem.setProperties({
3725
+ allowedSizes: (RibbonItemSize.Small | RibbonItemSize.Medium | RibbonItemSize.Large)
3726
+ }, true);
3712
3727
  }
3713
3728
  if ((ribbonitem.type === 'ColorPicker') && (ribbonitem.allowedSizes !== RibbonItemSize.Small)) {
3714
3729
  ribbonitem.setProperties({ allowedSizes: RibbonItemSize.Small }, true);
@@ -4507,6 +4522,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4507
4522
  break;
4508
4523
  case 'isMinimized':
4509
4524
  this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
4525
+ this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
4510
4526
  break;
4511
4527
  case 'locale':
4512
4528
  this.updateCommonProperty({ locale: this.locale });
@@ -4517,6 +4533,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
4517
4533
  case 'enableRtl':
4518
4534
  this.element.classList.toggle(RTL_CSS, this.enableRtl);
4519
4535
  this.updateCommonProperty({ enableRtl: newProp.enableRtl });
4536
+ if (this.scrollModule) {
4537
+ this.scrollModule.setProperties({ enableRtl: newProp.enableRtl });
4538
+ }
4520
4539
  break;
4521
4540
  case 'launcherIconCss':
4522
4541
  for (let i = 0; i < this.tabs.length; i++) {
@@ -4654,7 +4673,7 @@ class RibbonFileMenu {
4654
4673
  return;
4655
4674
  }
4656
4675
  this.ddbElement = this.parent.createElement('button', {
4657
- id: this.parent.element.id + RIBBON_FILE_MENU_ID,
4676
+ id: this.parent.element.id + RIBBON_FILE_MENU_ID
4658
4677
  });
4659
4678
  const tabEle = this.parent.tabObj.element;
4660
4679
  const toolbarEle = tabEle.querySelector('.e-toolbar');
@@ -4745,7 +4764,7 @@ class RibbonFileMenu {
4745
4764
  select: this.menuSelect.bind(this)
4746
4765
  }, ulElem);
4747
4766
  EventHandler.add(ulElem, 'keydown', (e) => {
4748
- if (e.key === "Tab") {
4767
+ if (e.key === 'Tab') {
4749
4768
  this.fileMenuDDB.toggle();
4750
4769
  }
4751
4770
  }, this);
@@ -4754,8 +4773,10 @@ class RibbonFileMenu {
4754
4773
  const event = isOpen ? this.parent.fileMenu.beforeOpen :
4755
4774
  this.parent.fileMenu.beforeClose;
4756
4775
  if (event) {
4757
- const eventArgs = { cancel: args.cancel, element: args.element, event: args.event,
4758
- items: args.items, parentItem: args.parentItem };
4776
+ const eventArgs = {
4777
+ cancel: args.cancel, element: args.element, event: args.event,
4778
+ items: args.items, parentItem: args.parentItem
4779
+ };
4759
4780
  event.call(this, eventArgs);
4760
4781
  args.cancel = eventArgs.cancel;
4761
4782
  }