@syncfusion/ej2-ribbon 21.2.3 → 22.1.34
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/.eslintrc.json +1 -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 +1249 -161
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +1270 -176
- 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 +16 -13
- package/src/ribbon/base/interface.d.ts +6 -6
- package/src/ribbon/base/interface.js +6 -6
- package/src/ribbon/base/ribbon-model.d.ts +2 -2
- package/src/ribbon/base/ribbon.d.ts +43 -1
- package/src/ribbon/base/ribbon.js +1074 -163
- package/src/ribbon/base/utils.d.ts +2 -2
- package/src/ribbon/base/utils.js +11 -6
- package/src/ribbon/items/ribbon-button.js +1 -0
- package/src/ribbon/items/ribbon-checkbox.js +1 -0
- package/src/ribbon/items/ribbon-colorpicker.js +1 -0
- package/src/ribbon/items/ribbon-combobox.js +1 -0
- package/src/ribbon/items/ribbon-dropdown.d.ts +7 -1
- package/src/ribbon/items/ribbon-dropdown.js +152 -1
- package/src/ribbon/items/ribbon-splitbutton.js +24 -0
- package/src/ribbon/models/ribbon-combobox-settings-model.d.ts +10 -5
- package/src/ribbon/models/ribbon-combobox-settings.d.ts +10 -5
- package/src/ribbon/models/ribbon-file-menu-settings-model.d.ts +3 -1
- package/src/ribbon/models/ribbon-file-menu-settings.d.ts +3 -1
- package/src/ribbon/models/ribbon-item-model.d.ts +1 -1
- package/src/ribbon/models/ribbon-item.d.ts +1 -1
- package/styles/bootstrap-dark.css +26 -0
- package/styles/bootstrap.css +26 -0
- package/styles/bootstrap4.css +26 -0
- package/styles/bootstrap5-dark.css +26 -0
- package/styles/bootstrap5.css +26 -0
- package/styles/fabric-dark.css +26 -0
- package/styles/fabric.css +26 -0
- package/styles/fluent-dark.css +26 -0
- package/styles/fluent.css +26 -0
- package/styles/highcontrast-light.css +26 -0
- package/styles/highcontrast.css +30 -4
- package/styles/material-dark.css +26 -0
- package/styles/material.css +26 -0
- package/styles/material3-dark.css +1671 -0
- package/styles/material3-dark.scss +3 -0
- package/styles/material3.css +1727 -0
- package/styles/material3.scss +3 -0
- package/styles/ribbon/_bootstrap-dark-definition.scss +4 -0
- package/styles/ribbon/_bootstrap-definition.scss +4 -0
- package/styles/ribbon/_bootstrap4-definition.scss +4 -0
- package/styles/ribbon/_bootstrap5-definition.scss +4 -0
- package/styles/ribbon/_fabric-dark-definition.scss +4 -0
- package/styles/ribbon/_fabric-definition.scss +4 -0
- package/styles/ribbon/_fluent-definition.scss +4 -0
- package/styles/ribbon/_fusionnew-definition.scss +4 -0
- package/styles/ribbon/_highcontrast-definition.scss +6 -2
- package/styles/ribbon/_highcontrast-light-definition.scss +4 -0
- package/styles/ribbon/_layout.scss +27 -0
- package/styles/ribbon/_material-dark-definition.scss +4 -0
- package/styles/ribbon/_material-definition.scss +4 -0
- package/styles/ribbon/_material3-dark-definition.scss +1 -0
- package/styles/ribbon/_material3-definition.scss +210 -0
- package/styles/ribbon/_tailwind-definition.scss +4 -0
- package/styles/ribbon/bootstrap-dark.css +26 -0
- package/styles/ribbon/bootstrap.css +26 -0
- package/styles/ribbon/bootstrap4.css +26 -0
- package/styles/ribbon/bootstrap5-dark.css +26 -0
- package/styles/ribbon/bootstrap5.css +26 -0
- package/styles/ribbon/fabric-dark.css +26 -0
- package/styles/ribbon/fabric.css +26 -0
- package/styles/ribbon/fluent-dark.css +26 -0
- package/styles/ribbon/fluent.css +26 -0
- package/styles/ribbon/highcontrast-light.css +26 -0
- package/styles/ribbon/highcontrast.css +30 -4
- package/styles/ribbon/icons/_material3-dark.scss +1 -0
- package/styles/ribbon/material-dark.css +26 -0
- package/styles/ribbon/material.css +26 -0
- package/styles/ribbon/material3-dark.css +1671 -0
- package/styles/ribbon/material3-dark.scss +18 -0
- package/styles/ribbon/material3.css +1727 -0
- package/styles/ribbon/material3.scss +18 -0
- package/styles/ribbon/tailwind-dark.css +26 -0
- package/styles/ribbon/tailwind.css +26 -0
- package/styles/tailwind-dark.css +26 -0
- package/styles/tailwind.css +26 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChildProperty, Collection, Complex, Component, Event, EventHandler, NotifyPropertyChanges, Property, addClass, append, closest, compile, formatUnit, getComponent, getInstance, getUniqueID, isNullOrUndefined, isUndefined, merge, remove, removeClass, select } from '@syncfusion/ej2-base';
|
|
1
|
+
import { ChildProperty, Collection, Complex, Component, Event, EventHandler, KeyboardEvents, NotifyPropertyChanges, Property, addClass, append, closest, compile, formatUnit, getComponent, getInstance, getUniqueID, isNullOrUndefined, isUndefined, merge, remove, removeClass, select } from '@syncfusion/ej2-base';
|
|
2
2
|
import { HScroll, Menu, MenuAnimationSettings, MenuItem, Tab, TabAnimationSettings, Toolbar } from '@syncfusion/ej2-navigations';
|
|
3
3
|
import { ComboBox, FieldSettings } from '@syncfusion/ej2-dropdowns';
|
|
4
4
|
import { DropDownButton, Item, SplitButton } from '@syncfusion/ej2-splitbuttons';
|
|
@@ -61,6 +61,10 @@ var RibbonItemSize;
|
|
|
61
61
|
*/
|
|
62
62
|
var DisplayMode;
|
|
63
63
|
(function (DisplayMode) {
|
|
64
|
+
/**
|
|
65
|
+
* The item appears in the classic layout group.
|
|
66
|
+
*/
|
|
67
|
+
DisplayMode[DisplayMode["Classic"] = 4] = "Classic";
|
|
64
68
|
/**
|
|
65
69
|
* The item appears in the simplified layout group.
|
|
66
70
|
*/
|
|
@@ -70,13 +74,9 @@ var DisplayMode;
|
|
|
70
74
|
*/
|
|
71
75
|
DisplayMode[DisplayMode["Overflow"] = 1] = "Overflow";
|
|
72
76
|
/**
|
|
73
|
-
|
|
74
|
-
*/
|
|
75
|
-
DisplayMode[DisplayMode["Auto"] = 3] = "Auto";
|
|
76
|
-
/**
|
|
77
|
-
* The item is hidden in simplified mode.
|
|
77
|
+
* The item appears in classic layout group, simplified layout group, and overflow popup based on ribbon overflow state.
|
|
78
78
|
*/
|
|
79
|
-
DisplayMode[DisplayMode["
|
|
79
|
+
DisplayMode[DisplayMode["Auto"] = 7] = "Auto";
|
|
80
80
|
})(DisplayMode || (DisplayMode = {}));
|
|
81
81
|
/**
|
|
82
82
|
* Defines the type of the ribbon item.
|
|
@@ -975,6 +975,7 @@ class RibbonButton {
|
|
|
975
975
|
*/
|
|
976
976
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
977
977
|
const buttonEle = itemEle.querySelector('#' + item.id);
|
|
978
|
+
buttonEle.setAttribute('data-control', item.type.toString());
|
|
978
979
|
const buttonObj = getComponent(buttonEle, Button);
|
|
979
980
|
buttonObj.setProperties({ cssClass: buttonObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
980
981
|
buttonEle.onclick = (e) => {
|
|
@@ -1118,6 +1119,7 @@ class RibbonCheckBox {
|
|
|
1118
1119
|
*/
|
|
1119
1120
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
1120
1121
|
const inputEle = itemEle.querySelector('#' + item.id);
|
|
1122
|
+
inputEle.setAttribute('data-control', item.type.toString());
|
|
1121
1123
|
const checkBoxObj = getComponent(inputEle, CheckBox);
|
|
1122
1124
|
checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
1123
1125
|
checkBoxObj.dataBind();
|
|
@@ -1271,6 +1273,7 @@ class RibbonColorPicker {
|
|
|
1271
1273
|
*/
|
|
1272
1274
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
1273
1275
|
const colorPickerEle = itemEle.querySelector('#' + item.id);
|
|
1276
|
+
colorPickerEle.setAttribute('data-control', item.type.toString());
|
|
1274
1277
|
const colorPickerObj = getComponent(colorPickerEle, ColorPicker);
|
|
1275
1278
|
colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
1276
1279
|
//Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
|
|
@@ -1460,10 +1463,11 @@ class RibbonComboBox {
|
|
|
1460
1463
|
*/
|
|
1461
1464
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
1462
1465
|
const inputEle = itemEle.querySelector('#' + item.id);
|
|
1466
|
+
inputEle.setAttribute('data-control', item.type.toString());
|
|
1463
1467
|
const comboBoxObj = getComponent(inputEle, ComboBox);
|
|
1464
1468
|
comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
1465
1469
|
comboBoxObj.close = (e) => {
|
|
1466
|
-
|
|
1470
|
+
const target = e.event ? e.event.target : null;
|
|
1467
1471
|
if (item.comboBoxSettings.close) {
|
|
1468
1472
|
item.comboBoxSettings.close.call(this, e);
|
|
1469
1473
|
}
|
|
@@ -1629,6 +1633,7 @@ class RibbonDropDown {
|
|
|
1629
1633
|
*/
|
|
1630
1634
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
1631
1635
|
const dropdownElement = itemEle.querySelector('#' + item.id);
|
|
1636
|
+
dropdownElement.setAttribute('data-control', item.type.toString());
|
|
1632
1637
|
const dropdown = getComponent(dropdownElement, DropDownButton);
|
|
1633
1638
|
dropdown.cssClass = dropdown.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
1634
1639
|
dropdown.dataBind();
|
|
@@ -1685,10 +1690,12 @@ class RibbonDropDown {
|
|
|
1685
1690
|
* @returns {void}
|
|
1686
1691
|
* @hidden
|
|
1687
1692
|
*/
|
|
1688
|
-
createOverFlowDropDown(id, name, iconCss, groupEle, overflowEle) {
|
|
1693
|
+
createOverFlowDropDown(id, name, iconCss, groupEle, overflowEle, enableRtl) {
|
|
1694
|
+
this.enableRtl = enableRtl;
|
|
1689
1695
|
const buttonEle = this.parent.createElement('button', {
|
|
1690
1696
|
id: id + OVERFLOW_ID + DROPDOWN_ID
|
|
1691
1697
|
});
|
|
1698
|
+
groupEle.setAttribute('tabindex', '0');
|
|
1692
1699
|
overflowEle.appendChild(buttonEle);
|
|
1693
1700
|
const dropdown = new DropDownButton({
|
|
1694
1701
|
iconCss: iconCss,
|
|
@@ -1704,8 +1711,155 @@ class RibbonDropDown {
|
|
|
1704
1711
|
}
|
|
1705
1712
|
}, buttonEle);
|
|
1706
1713
|
createTooltip(groupEle, this.parent);
|
|
1714
|
+
buttonEle.onclick = buttonEle.onkeydown = () => { this.itemIndex = 0; };
|
|
1715
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1716
|
+
groupEle.onkeydown = (e) => { this.keyActionHandler(e, groupEle), this; };
|
|
1707
1717
|
return dropdown;
|
|
1708
1718
|
}
|
|
1719
|
+
keyActionHandler(e, target) {
|
|
1720
|
+
const items = target.querySelectorAll('.e-control');
|
|
1721
|
+
const comboBoxElements = target.querySelectorAll('.e-combobox');
|
|
1722
|
+
let comboBoxEle;
|
|
1723
|
+
if (comboBoxElements) {
|
|
1724
|
+
for (let i = 0; i < comboBoxElements.length; i++) {
|
|
1725
|
+
if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
1726
|
+
comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
if (comboBoxEle) {
|
|
1731
|
+
for (let i = 0; i < items.length; i++) {
|
|
1732
|
+
if (items[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
|
|
1733
|
+
if (items[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
1734
|
+
this.itemIndex = i;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
1740
|
+
e.target.classList.contains('e-ribbon-last-item') || e.target.classList.contains('e-ribbon-first-item')) {
|
|
1741
|
+
if (e.key === 'ArrowRight' || (!e.shiftKey && e.key === 'Tab')) {
|
|
1742
|
+
this.handleNavigation(e, !this.enableRtl, items);
|
|
1743
|
+
}
|
|
1744
|
+
if (e.key === 'ArrowLeft' || (e.shiftKey && e.key === 'Tab')) {
|
|
1745
|
+
this.handleNavigation(e, this.enableRtl, items);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
handleNavigation(e, enableRtl, items) {
|
|
1750
|
+
if (!(items[0].classList.contains('e-ribbon-first-item'))) {
|
|
1751
|
+
items[0].classList.add('e-ribbon-first-item');
|
|
1752
|
+
}
|
|
1753
|
+
if (!(items[items.length - 1].classList.contains('e-ribbon-last-item'))) {
|
|
1754
|
+
items[items.length - 1].classList.add('e-ribbon-last-item');
|
|
1755
|
+
}
|
|
1756
|
+
if (enableRtl) {
|
|
1757
|
+
if (this.itemIndex === 0 && items[parseInt(this.itemIndex.toString(), 10)].classList.contains('e-ribbon-first-item')) {
|
|
1758
|
+
this.updateItemIndex(e, items, true);
|
|
1759
|
+
}
|
|
1760
|
+
if (!e.target.classList.contains('e-combobox') && !e.target.classList.contains('e-ribbon-last-item') &&
|
|
1761
|
+
!e.target.classList.contains('e-ribbon-group-container') && (e.target.classList.contains('e-ribbon-first-item')
|
|
1762
|
+
|| this.itemIndex !== 0) && e.target.classList.contains('e-control')) {
|
|
1763
|
+
this.itemIndex++;
|
|
1764
|
+
this.updateItemIndex(e, items, true);
|
|
1765
|
+
}
|
|
1766
|
+
if (e.target.classList.contains('e-ribbon-last-item')) {
|
|
1767
|
+
let launcherIcon = false;
|
|
1768
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
1769
|
+
if (!launcherIcon) {
|
|
1770
|
+
this.itemIndex = 0;
|
|
1771
|
+
this.updateItemIndex(e, items, true);
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
1775
|
+
this.itemIndex = 0;
|
|
1776
|
+
this.updateItemIndex(e, items, true);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
else {
|
|
1780
|
+
if (!e.target.classList.contains('e-combobox') && this.itemIndex !== 0) {
|
|
1781
|
+
this.itemIndex--;
|
|
1782
|
+
this.updateItemIndex(e, items, false);
|
|
1783
|
+
}
|
|
1784
|
+
if (e.target.classList.contains('e-ribbon-first-item')) {
|
|
1785
|
+
let launcherIcon = false;
|
|
1786
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
1787
|
+
if (!launcherIcon) {
|
|
1788
|
+
this.itemIndex = items.length - 1;
|
|
1789
|
+
this.updateItemIndex(e, items, false);
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
1793
|
+
this.itemIndex = items.length - 1;
|
|
1794
|
+
this.updateItemIndex(e, items, false);
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
if (e.target.classList.contains('e-combobox') && (e.key === 'Tab')) {
|
|
1798
|
+
if (enableRtl) {
|
|
1799
|
+
if (this.itemIndex < items.length - 1) {
|
|
1800
|
+
this.itemIndex++;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
else {
|
|
1804
|
+
if (this.itemIndex > 0) {
|
|
1805
|
+
this.itemIndex--;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
focusLauncherIcon(e, items) {
|
|
1811
|
+
const groupContainer = items[parseInt(this.itemIndex.toString(), 10)].closest('.e-ribbon-group-container');
|
|
1812
|
+
let launcherIconEle;
|
|
1813
|
+
if (groupContainer) {
|
|
1814
|
+
launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
1815
|
+
}
|
|
1816
|
+
if (launcherIconEle) {
|
|
1817
|
+
if (e.key === 'Tab') {
|
|
1818
|
+
e.preventDefault();
|
|
1819
|
+
}
|
|
1820
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
1821
|
+
return true;
|
|
1822
|
+
}
|
|
1823
|
+
else {
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
updateItemIndex(e, items, enableRtl) {
|
|
1828
|
+
let ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
1829
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
1830
|
+
if (enableRtl) {
|
|
1831
|
+
if (this.itemIndex < items.length - 1) {
|
|
1832
|
+
this.itemIndex++;
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
let launcherIcon = false;
|
|
1836
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
1837
|
+
if (launcherIcon) {
|
|
1838
|
+
break;
|
|
1839
|
+
}
|
|
1840
|
+
this.itemIndex = 0;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
else {
|
|
1844
|
+
if (this.itemIndex > 0) {
|
|
1845
|
+
this.itemIndex--;
|
|
1846
|
+
}
|
|
1847
|
+
else {
|
|
1848
|
+
let launcherIcon = false;
|
|
1849
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
1850
|
+
if (launcherIcon) {
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
this.itemIndex = items.length - 1;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
1857
|
+
}
|
|
1858
|
+
if (e.key === 'Tab') {
|
|
1859
|
+
e.preventDefault();
|
|
1860
|
+
}
|
|
1861
|
+
items[parseInt(this.itemIndex.toString(), 10)].focus();
|
|
1862
|
+
}
|
|
1709
1863
|
/**
|
|
1710
1864
|
* Removes Overflow DropDown.
|
|
1711
1865
|
*
|
|
@@ -1904,6 +2058,13 @@ class RibbonSplitButton {
|
|
|
1904
2058
|
}
|
|
1905
2059
|
}
|
|
1906
2060
|
}, buttonEle);
|
|
2061
|
+
const dropdownEle = buttonEle.parentElement.querySelector('.e-dropdown-btn');
|
|
2062
|
+
dropdownEle.onkeydown = (e) => {
|
|
2063
|
+
if (e.key === 'Enter') {
|
|
2064
|
+
e.stopImmediatePropagation();
|
|
2065
|
+
dropdownEle.click();
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
1907
2068
|
this.setContent(item, splitbutton);
|
|
1908
2069
|
const wrapper = splitbutton['wrapper'];
|
|
1909
2070
|
EventHandler.add(wrapper, 'mouseenter', () => { wrapper.classList.add(RIBBON_HOVER); }, this);
|
|
@@ -1920,9 +2081,26 @@ class RibbonSplitButton {
|
|
|
1920
2081
|
*/
|
|
1921
2082
|
addOverFlowEvents(item, itemEle, overflowButton) {
|
|
1922
2083
|
const splitButtonEle = itemEle.querySelector('#' + item.id);
|
|
2084
|
+
splitButtonEle.setAttribute('data-control', item.type.toString());
|
|
1923
2085
|
const splitbutton = getComponent(splitButtonEle, SplitButton);
|
|
1924
2086
|
splitbutton.cssClass = splitbutton.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
1925
2087
|
splitbutton.dataBind();
|
|
2088
|
+
const dropdownEle = splitButtonEle.parentElement.querySelector('.e-dropdown-btn');
|
|
2089
|
+
const ddbId = dropdownEle.getAttribute('id');
|
|
2090
|
+
const popupEle = document.querySelector('#' + ddbId + '-popup');
|
|
2091
|
+
dropdownEle.onkeydown = (e) => {
|
|
2092
|
+
if (e.key === 'Enter') {
|
|
2093
|
+
e.stopImmediatePropagation();
|
|
2094
|
+
dropdownEle.click();
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
popupEle.onkeydown = (e) => {
|
|
2098
|
+
if (e.key === 'Enter') {
|
|
2099
|
+
e.preventDefault();
|
|
2100
|
+
splitbutton['wrapper'].classList.remove('e-ribbon-open');
|
|
2101
|
+
popupEle.querySelector('.e-focused').click();
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
1926
2104
|
let target;
|
|
1927
2105
|
splitbutton.beforeClose = (e) => {
|
|
1928
2106
|
if (item.splitButtonSettings.beforeClose) {
|
|
@@ -2093,7 +2271,7 @@ function getIndex(arr, condition) {
|
|
|
2093
2271
|
/**
|
|
2094
2272
|
* Gets template content based on the template property value.
|
|
2095
2273
|
*
|
|
2096
|
-
* @param {string | HTMLElement} template - Template property value.
|
|
2274
|
+
* @param {string | HTMLElement| Function} template - Template property value.
|
|
2097
2275
|
* @returns {Function} - Return template function.
|
|
2098
2276
|
* @hidden
|
|
2099
2277
|
*/
|
|
@@ -2254,16 +2432,21 @@ function getItemElement(parent, id, itemProp) {
|
|
|
2254
2432
|
return null;
|
|
2255
2433
|
}
|
|
2256
2434
|
if (parent.activeLayout === RibbonLayout.Classic) {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2435
|
+
if (itemProp.item.displayOptions & DisplayMode.Classic) {
|
|
2436
|
+
contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
|
|
2437
|
+
: contentEle;
|
|
2438
|
+
return contentEle.querySelector('#' + id);
|
|
2439
|
+
}
|
|
2440
|
+
else {
|
|
2441
|
+
return null;
|
|
2442
|
+
}
|
|
2260
2443
|
}
|
|
2261
2444
|
else {
|
|
2262
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
2445
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
2263
2446
|
let ele = (itemProp.item.displayOptions & DisplayMode.Simplified) ?
|
|
2264
2447
|
contentEle.querySelector('#' + itemProp.item.id) : null;
|
|
2265
2448
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
2266
|
-
if (!ele
|
|
2449
|
+
if (!ele) {
|
|
2267
2450
|
const dropdown = itemProp.group.enableGroupOverflow ?
|
|
2268
2451
|
getComponent(contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID), DropDownButton)
|
|
2269
2452
|
: parent.overflowDDB;
|
|
@@ -2407,6 +2590,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2407
2590
|
this.idIndex = 0;
|
|
2408
2591
|
this.tooltipData = [];
|
|
2409
2592
|
this.isAddRemove = false;
|
|
2593
|
+
this.keyConfigs = {
|
|
2594
|
+
leftarrow: 'leftarrow',
|
|
2595
|
+
rightarrow: 'rightarrow',
|
|
2596
|
+
tab: 'tab',
|
|
2597
|
+
shiftTab: 'shift+tab'
|
|
2598
|
+
};
|
|
2410
2599
|
}
|
|
2411
2600
|
/**
|
|
2412
2601
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -2448,12 +2637,239 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2448
2637
|
this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
|
|
2449
2638
|
}
|
|
2450
2639
|
this.createHelpPaneTemplate();
|
|
2640
|
+
const toolbar = this.tabObj['tbObj'];
|
|
2641
|
+
toolbar.refreshOverflow();
|
|
2451
2642
|
createTooltip(this.element, this);
|
|
2452
2643
|
this.wireEvents();
|
|
2644
|
+
this.wireKeyboardEvent();
|
|
2645
|
+
this.currentControlIndex = 0;
|
|
2453
2646
|
}
|
|
2454
2647
|
wireEvents() {
|
|
2455
2648
|
EventHandler.add(window, 'resize', this.resizeHandler, this);
|
|
2456
2649
|
}
|
|
2650
|
+
wireKeyboardEvent() {
|
|
2651
|
+
this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
|
|
2652
|
+
keyAction: this.keyActionHandler.bind(this),
|
|
2653
|
+
keyConfigs: this.keyConfigs,
|
|
2654
|
+
eventName: 'keydown'
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
keyActionHandler(e) {
|
|
2658
|
+
if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
|
|
2659
|
+
e.preventDefault();
|
|
2660
|
+
}
|
|
2661
|
+
const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2662
|
+
const ribbonControls = activeContent.querySelectorAll('.e-control');
|
|
2663
|
+
const comboBoxElements = activeContent.querySelectorAll('.e-combobox');
|
|
2664
|
+
let comboBoxEle;
|
|
2665
|
+
if (comboBoxElements) {
|
|
2666
|
+
for (let i = 0; i < comboBoxElements.length; i++) {
|
|
2667
|
+
if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2668
|
+
comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
if (comboBoxEle) {
|
|
2673
|
+
for (let i = 0; i < ribbonControls.length; i++) {
|
|
2674
|
+
if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
|
|
2675
|
+
if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2676
|
+
this.currentControlIndex = i;
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
if (this.currentControlIndex === 0) {
|
|
2682
|
+
let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2683
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
2684
|
+
this.currentControlIndex++;
|
|
2685
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
2689
|
+
e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
|
|
2690
|
+
e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
|
|
2691
|
+
e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
2692
|
+
switch (e.action) {
|
|
2693
|
+
case 'rightarrow':
|
|
2694
|
+
this.handleNavigation(e, !this.enableRtl, ribbonControls);
|
|
2695
|
+
break;
|
|
2696
|
+
case 'leftarrow':
|
|
2697
|
+
this.handleNavigation(e, this.enableRtl, ribbonControls);
|
|
2698
|
+
break;
|
|
2699
|
+
case 'tab':
|
|
2700
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2701
|
+
if (this.currentControlIndex < ribbonControls.length - 1) {
|
|
2702
|
+
this.currentControlIndex++;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
break;
|
|
2706
|
+
case 'shiftTab':
|
|
2707
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2708
|
+
if (this.currentControlIndex > 0) {
|
|
2709
|
+
this.currentControlIndex--;
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
else {
|
|
2713
|
+
this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
|
|
2714
|
+
this.currentControlIndex = 0;
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
handleNavigation(e, enableRtl, ribbonControls) {
|
|
2720
|
+
let groupContainer;
|
|
2721
|
+
let prevGroupId;
|
|
2722
|
+
if (enableRtl) {
|
|
2723
|
+
if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
|
|
2724
|
+
this.currentControlIndex++;
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
else {
|
|
2728
|
+
if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
|
|
2729
|
+
this.currentControlIndex--;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
|
|
2733
|
+
if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
|
|
2734
|
+
if (enableRtl) {
|
|
2735
|
+
this.currentControlIndex++;
|
|
2736
|
+
}
|
|
2737
|
+
else {
|
|
2738
|
+
const prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2739
|
+
if (prevGroupContainer) {
|
|
2740
|
+
prevGroupId = prevGroupContainer.getAttribute('id');
|
|
2741
|
+
}
|
|
2742
|
+
this.currentControlIndex--;
|
|
2743
|
+
}
|
|
2744
|
+
let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2745
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
2746
|
+
if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
|
|
2747
|
+
(!enableRtl && this.currentControlIndex === 0))) {
|
|
2748
|
+
if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
2749
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2750
|
+
break;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
2754
|
+
enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
|
|
2755
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2756
|
+
}
|
|
2757
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2758
|
+
if (this.activeLayout === 'Classic') {
|
|
2759
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2760
|
+
if (enableRtl) {
|
|
2761
|
+
let launcherIconEle;
|
|
2762
|
+
if (groupContainer) {
|
|
2763
|
+
launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2764
|
+
}
|
|
2765
|
+
if (launcherIconEle) {
|
|
2766
|
+
const items = groupContainer.querySelectorAll('.e-ribbon-item');
|
|
2767
|
+
items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
else {
|
|
2771
|
+
if (groupContainer) {
|
|
2772
|
+
const groupContainerId = groupContainer.getAttribute('id');
|
|
2773
|
+
if (prevGroupId !== groupContainerId) {
|
|
2774
|
+
const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2775
|
+
if (launcherIconEle) {
|
|
2776
|
+
ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
else {
|
|
2783
|
+
if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
|
|
2784
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
|
|
2785
|
+
}
|
|
2786
|
+
else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
2787
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
else {
|
|
2793
|
+
if (this.activeLayout === 'Classic') {
|
|
2794
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2795
|
+
}
|
|
2796
|
+
if (this.activeLayout === 'Simplified') {
|
|
2797
|
+
const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
2798
|
+
if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
2799
|
+
overflowButton.focus();
|
|
2800
|
+
}
|
|
2801
|
+
else {
|
|
2802
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
if (e.target.classList.contains('e-ribbon-last-item')) {
|
|
2807
|
+
if (enableRtl) {
|
|
2808
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2809
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
2810
|
+
}
|
|
2811
|
+
else {
|
|
2812
|
+
this.currentControlIndex--;
|
|
2813
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
|
|
2817
|
+
groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2818
|
+
const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2819
|
+
if (launcherIconEle) {
|
|
2820
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
2824
|
+
if (enableRtl) {
|
|
2825
|
+
this.currentControlIndex++;
|
|
2826
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2827
|
+
if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
2828
|
+
ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
else {
|
|
2832
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
2833
|
+
this.currentControlIndex;
|
|
2834
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
if (e.target.classList.contains('e-ribbon-collapse-btn')) {
|
|
2838
|
+
if (enableRtl) {
|
|
2839
|
+
this.currentControlIndex = 0;
|
|
2840
|
+
let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2841
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
2842
|
+
this.currentControlIndex++;
|
|
2843
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2844
|
+
}
|
|
2845
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2846
|
+
}
|
|
2847
|
+
else {
|
|
2848
|
+
const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
2849
|
+
if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
2850
|
+
overflowButton.focus();
|
|
2851
|
+
}
|
|
2852
|
+
else {
|
|
2853
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
2854
|
+
let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2855
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
2856
|
+
this.currentControlIndex--;
|
|
2857
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2858
|
+
}
|
|
2859
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
2864
|
+
if (enableRtl) {
|
|
2865
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2866
|
+
}
|
|
2867
|
+
else {
|
|
2868
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
2869
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2457
2873
|
resizeHandler() {
|
|
2458
2874
|
const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2459
2875
|
this.checkOverflow(this.selectedTab, activeContent);
|
|
@@ -2655,7 +3071,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2655
3071
|
for (let k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
|
|
2656
3072
|
const item = collection.items[k - 1];
|
|
2657
3073
|
const itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
2658
|
-
if ((item.displayOptions ===
|
|
3074
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3075
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2659
3076
|
itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
|
|
2660
3077
|
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
|
|
2661
3078
|
if (item.activeSize === RibbonItemSize.Small) {
|
|
@@ -2725,7 +3142,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2725
3142
|
if (overflowtarget) {
|
|
2726
3143
|
itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
2727
3144
|
}
|
|
2728
|
-
if ((item.displayOptions ===
|
|
3145
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3146
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2729
3147
|
const width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
|
|
2730
3148
|
if (!isClear && (tabContent.offsetWidth < width)) {
|
|
2731
3149
|
flag = false;
|
|
@@ -2815,7 +3233,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2815
3233
|
}
|
|
2816
3234
|
overflowButton = this.overflowDDB;
|
|
2817
3235
|
}
|
|
2818
|
-
|
|
3236
|
+
if (itemEle !== null) {
|
|
3237
|
+
this.addOverflowEvents(item, itemEle, overflowButton);
|
|
3238
|
+
}
|
|
2819
3239
|
}
|
|
2820
3240
|
addOverflowEvents(item, itemEle, overflowButton) {
|
|
2821
3241
|
switch (item.type) {
|
|
@@ -2864,6 +3284,50 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2864
3284
|
}
|
|
2865
3285
|
return isBreak;
|
|
2866
3286
|
}
|
|
3287
|
+
checkValidCollectionLength(collections) {
|
|
3288
|
+
let count = 0;
|
|
3289
|
+
for (let i = 0; i < collections.length; i++) {
|
|
3290
|
+
const items = collections[parseInt(i.toString(), 10)].items;
|
|
3291
|
+
for (let ind = 0; ind < items.length; ind++) {
|
|
3292
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3293
|
+
count++;
|
|
3294
|
+
break;
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
if (count > 1) {
|
|
3298
|
+
return false;
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
return count === 1;
|
|
3302
|
+
}
|
|
3303
|
+
checkClassicCollection(collections, n, isIncrement) {
|
|
3304
|
+
const items = collections[parseInt(n.toString(), 10)].items;
|
|
3305
|
+
for (let ind = 0; ind < items.length; ind++) {
|
|
3306
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3307
|
+
return n;
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3311
|
+
if (isIncrement) {
|
|
3312
|
+
return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3313
|
+
}
|
|
3314
|
+
else {
|
|
3315
|
+
return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
checkClassicItem(items, n, isIncrement) {
|
|
3319
|
+
const item = items[parseInt(n.toString(), 10)];
|
|
3320
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3321
|
+
return n;
|
|
3322
|
+
}
|
|
3323
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3324
|
+
if (isIncrement) {
|
|
3325
|
+
return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3326
|
+
}
|
|
3327
|
+
else {
|
|
3328
|
+
return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
2867
3331
|
checkLargeToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip = false) {
|
|
2868
3332
|
const group = tab.groups[parseInt(groupIndex.toString(), 10)];
|
|
2869
3333
|
if (group.isCollapsed && !shouldSkip) {
|
|
@@ -2895,6 +3359,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2895
3359
|
createShrinkEle(collection.id, firstItem, start, end);
|
|
2896
3360
|
for (let i = start; i <= end; i++) {
|
|
2897
3361
|
const item = collection.items[parseInt(i.toString(), 10)];
|
|
3362
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
3363
|
+
continue;
|
|
3364
|
+
}
|
|
2898
3365
|
const ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
|
|
2899
3366
|
shrinkEle.appendChild(ele);
|
|
2900
3367
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
@@ -2919,45 +3386,65 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2919
3386
|
if (orientation === ItemOrientation.Column) {
|
|
2920
3387
|
for (let k = (group.collections.length - 1); k > 0; k--) {
|
|
2921
3388
|
//to avoid negative index while checking for the second collection
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
3389
|
+
k = this.checkClassicCollection(group.collections, k, false);
|
|
3390
|
+
let l = k - 1;
|
|
3391
|
+
//Checks the element rendered at position n
|
|
3392
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
|
|
3393
|
+
l = this.checkClassicCollection(group.collections, l, false);
|
|
3394
|
+
//Checks the element rendered at position n-1
|
|
3395
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
|
|
3396
|
+
let m = l - 1;
|
|
3397
|
+
if (m >= 0) {
|
|
3398
|
+
m = this.checkClassicCollection(group.collections, m, false);
|
|
3399
|
+
}
|
|
3400
|
+
//Checks the element rendered at position n-2
|
|
3401
|
+
if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
|
|
3402
|
+
moveCollectionToColumn(m, k);
|
|
2926
3403
|
}
|
|
2927
3404
|
else {
|
|
2928
|
-
moveCollectionToColumn(
|
|
3405
|
+
moveCollectionToColumn(l, k);
|
|
2929
3406
|
}
|
|
2930
|
-
k
|
|
3407
|
+
k = m;
|
|
2931
3408
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
2932
3409
|
return true;
|
|
2933
3410
|
}
|
|
2934
3411
|
}
|
|
2935
3412
|
else {
|
|
2936
|
-
k
|
|
3413
|
+
k = l;
|
|
2937
3414
|
}
|
|
2938
3415
|
}
|
|
2939
3416
|
}
|
|
2940
3417
|
}
|
|
2941
3418
|
else {
|
|
2942
|
-
if (group.collections
|
|
3419
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
2943
3420
|
const collection = group.collections[0];
|
|
2944
3421
|
for (let k = (collection.items.length - 1); k > 0; k--) {
|
|
2945
3422
|
//to avoid negative index while checking for the second item
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
3423
|
+
k = this.checkClassicItem(collection.items, k, false);
|
|
3424
|
+
let l = k - 1;
|
|
3425
|
+
//Checks the element rendered at position n
|
|
3426
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
|
|
3427
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3428
|
+
//Checks the element rendered at position n-1
|
|
3429
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
|
|
3430
|
+
let m = l - 1;
|
|
3431
|
+
//Checks the element rendered at position n-2
|
|
3432
|
+
if (m >= 0) {
|
|
3433
|
+
m = this.checkClassicItem(collection.items, m, false);
|
|
3434
|
+
}
|
|
3435
|
+
if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
|
|
3436
|
+
moveItemToColumn(m, k);
|
|
2950
3437
|
}
|
|
2951
3438
|
else {
|
|
2952
|
-
moveItemToColumn(
|
|
3439
|
+
moveItemToColumn(l, k);
|
|
2953
3440
|
}
|
|
2954
|
-
k
|
|
3441
|
+
k = m;
|
|
2955
3442
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
2956
3443
|
return true;
|
|
2957
3444
|
}
|
|
2958
3445
|
}
|
|
2959
3446
|
else {
|
|
2960
|
-
k
|
|
3447
|
+
k = l;
|
|
2961
3448
|
}
|
|
2962
3449
|
}
|
|
2963
3450
|
}
|
|
@@ -2976,28 +3463,42 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2976
3463
|
const canReduceItem = (item) => {
|
|
2977
3464
|
return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
|
|
2978
3465
|
};
|
|
2979
|
-
const reduceItemsToSmall = (collectionIndex, start, end) => {
|
|
3466
|
+
const reduceItemsToSmall = (collectionIndex, start, end, middle = null) => {
|
|
2980
3467
|
const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
2981
3468
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
2982
|
-
|
|
3469
|
+
const reduce = (i) => {
|
|
2983
3470
|
const item = collection.items[parseInt(i.toString(), 10)];
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3471
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3472
|
+
const ele = activeContent.querySelector('#' + item.id);
|
|
3473
|
+
item.setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3474
|
+
this.setItemSize(ele, item);
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
reduce(start);
|
|
3478
|
+
if (middle) {
|
|
3479
|
+
reduce(middle);
|
|
2987
3480
|
}
|
|
3481
|
+
reduce(end);
|
|
2988
3482
|
};
|
|
2989
|
-
const reduceCollectionsToSmall = (index, start, end) => {
|
|
3483
|
+
const reduceCollectionsToSmall = (index, start, end, middle = null) => {
|
|
2990
3484
|
const group = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
2991
3485
|
.groups[parseInt(groupIndex.toString(), 10)];
|
|
2992
3486
|
if (!shouldSkip) {
|
|
2993
3487
|
shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
|
|
2994
3488
|
}
|
|
2995
|
-
|
|
3489
|
+
const reduce = (i) => {
|
|
2996
3490
|
const collection = group.collections[parseInt(i.toString(), 10)];
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3491
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
3492
|
+
const ele = activeContent.querySelector('#' + collection.items[0].id);
|
|
3493
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3494
|
+
this.setItemSize(ele, collection.items[0]);
|
|
3495
|
+
}
|
|
3496
|
+
};
|
|
3497
|
+
reduce(start);
|
|
3498
|
+
if (middle) {
|
|
3499
|
+
reduce(middle);
|
|
3000
3500
|
}
|
|
3501
|
+
reduce(end);
|
|
3001
3502
|
};
|
|
3002
3503
|
const setWidth = (id) => {
|
|
3003
3504
|
if (!shouldSkip) {
|
|
@@ -3011,13 +3512,14 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3011
3512
|
const start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
|
|
3012
3513
|
const end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
|
|
3013
3514
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3515
|
+
const l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
|
|
3014
3516
|
if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
|
|
3015
|
-
&& canReduceItem(group.collections[
|
|
3016
|
-
if (
|
|
3517
|
+
&& canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
|
|
3518
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3017
3519
|
reduceCollectionsToSmall(k, start, end);
|
|
3018
3520
|
}
|
|
3019
|
-
else if (canReduceItem(group.collections[parseInt(
|
|
3020
|
-
reduceCollectionsToSmall(k, start, end);
|
|
3521
|
+
else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
|
|
3522
|
+
reduceCollectionsToSmall(k, start, end, l);
|
|
3021
3523
|
}
|
|
3022
3524
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3023
3525
|
return true;
|
|
@@ -3027,16 +3529,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3027
3529
|
}
|
|
3028
3530
|
for (let k = (group.collections.length - 1); k >= 0; k--) {
|
|
3029
3531
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3532
|
+
const classicItems = [];
|
|
3533
|
+
for (let i = 0; i < collection.items.length; i++) {
|
|
3534
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3535
|
+
classicItems.push(i);
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3030
3538
|
//If items length is 1 then, it would have been already check for shrinked column
|
|
3031
|
-
if ((
|
|
3032
|
-
if (canReduceItem(collection.items[0]) && canReduceItem(collection.items[1])) {
|
|
3033
|
-
if (
|
|
3539
|
+
if ((classicItems.length > 1)) {
|
|
3540
|
+
if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
|
|
3541
|
+
if (classicItems.length === 2) {
|
|
3034
3542
|
setWidth(collection.id);
|
|
3035
|
-
reduceItemsToSmall(k, 0, 1);
|
|
3543
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[1]);
|
|
3036
3544
|
}
|
|
3037
|
-
else if (canReduceItem(collection.items[2])) {
|
|
3545
|
+
else if (canReduceItem(collection.items[classicItems[2]])) {
|
|
3038
3546
|
setWidth(collection.id);
|
|
3039
|
-
reduceItemsToSmall(k, 0, 2);
|
|
3547
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
|
|
3040
3548
|
}
|
|
3041
3549
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3042
3550
|
return true;
|
|
@@ -3046,22 +3554,24 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3046
3554
|
}
|
|
3047
3555
|
}
|
|
3048
3556
|
else {
|
|
3049
|
-
if (group.collections
|
|
3557
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
3050
3558
|
if (shrinkColumns.length > 0) {
|
|
3051
3559
|
for (let k = (shrinkColumns.length - 1); k >= 0; k--) {
|
|
3052
3560
|
const shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
|
|
3053
3561
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3054
3562
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3055
3563
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3564
|
+
const collection = group.collections[0];
|
|
3565
|
+
const l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
|
|
3056
3566
|
if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
|
|
3057
|
-
&& canReduceItem(group.collections[0].items[
|
|
3058
|
-
if (
|
|
3567
|
+
&& canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
|
|
3568
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3059
3569
|
setWidth(shrinkColumn.id);
|
|
3060
3570
|
reduceItemsToSmall(0, start, end);
|
|
3061
3571
|
}
|
|
3062
3572
|
else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
|
|
3063
3573
|
setWidth(shrinkColumn.id);
|
|
3064
|
-
reduceItemsToSmall(0, start, end);
|
|
3574
|
+
reduceItemsToSmall(0, start, end, l);
|
|
3065
3575
|
}
|
|
3066
3576
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3067
3577
|
return true;
|
|
@@ -3074,6 +3584,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3074
3584
|
for (let k = (group.collections.length - 1); k >= 0; k--) {
|
|
3075
3585
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3076
3586
|
for (let l = (collection.items.length - 1); l >= 0; l--) {
|
|
3587
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3588
|
+
if (l < 0) {
|
|
3589
|
+
continue;
|
|
3590
|
+
}
|
|
3077
3591
|
const item = collection.items[parseInt(l.toString(), 10)];
|
|
3078
3592
|
if (canReduceItem(item)) {
|
|
3079
3593
|
setWidth(item.id);
|
|
@@ -3106,20 +3620,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3106
3620
|
const canExpandItem = (item) => {
|
|
3107
3621
|
return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
|
|
3108
3622
|
};
|
|
3109
|
-
const
|
|
3623
|
+
const expandItemToMedium = (collectionIndex, index, parentEle) => {
|
|
3110
3624
|
const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3111
3625
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
3112
|
-
|
|
3113
|
-
|
|
3626
|
+
const item = collection.items[parseInt(index.toString(), 10)];
|
|
3627
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3114
3628
|
const ele = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
|
|
3115
3629
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3116
3630
|
this.setItemSize(ele, item);
|
|
3117
3631
|
}
|
|
3118
3632
|
};
|
|
3119
|
-
const expandCollectionsToMedium = (
|
|
3633
|
+
const expandCollectionsToMedium = (i) => {
|
|
3120
3634
|
const collections = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3121
3635
|
.groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3122
|
-
|
|
3636
|
+
const item = collections[parseInt(i.toString(), 10)].items[0];
|
|
3637
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3123
3638
|
const ele = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
|
|
3124
3639
|
collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3125
3640
|
this.setItemSize(ele, collections[parseInt(i.toString(), 10)].items[0]);
|
|
@@ -3127,17 +3642,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3127
3642
|
};
|
|
3128
3643
|
if (orientation === ItemOrientation.Row) {
|
|
3129
3644
|
// collection length is 1, then the it wll be covered in shrinked columns
|
|
3130
|
-
if (group.collections
|
|
3645
|
+
if (!this.checkValidCollectionLength(group.collections)) {
|
|
3131
3646
|
for (let k = 0; k < group.collections.length; k++) {
|
|
3132
3647
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3133
3648
|
for (let l = 0; l < collection.items.length; l++) {
|
|
3649
|
+
l = this.checkClassicItem(collection.items, l, true);
|
|
3650
|
+
if (l === collection.items.length) {
|
|
3651
|
+
continue;
|
|
3652
|
+
}
|
|
3134
3653
|
const item = collection.items[parseInt(l.toString(), 10)];
|
|
3135
3654
|
if (canExpandItem(item)) {
|
|
3136
3655
|
const itemEle = activeContent.querySelector('#' + item.id);
|
|
3137
3656
|
const valString = itemEle.getAttribute('data-medium-width');
|
|
3138
3657
|
const value = valString ? parseInt(valString, 10) : null;
|
|
3139
3658
|
if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3140
|
-
|
|
3659
|
+
expandItemToMedium(k, l, itemEle);
|
|
3141
3660
|
if (!shouldSkip || shouldClear) {
|
|
3142
3661
|
itemEle.removeAttribute('data-medium-width');
|
|
3143
3662
|
}
|
|
@@ -3158,8 +3677,18 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3158
3677
|
const itemEle = activeContent.querySelector('#' + collection.id);
|
|
3159
3678
|
const valString = itemEle.getAttribute('data-medium-width');
|
|
3160
3679
|
const value = valString ? parseInt(valString, 10) : null;
|
|
3161
|
-
|
|
3162
|
-
|
|
3680
|
+
const classicItems = [];
|
|
3681
|
+
for (let i = 0; i < collection.items.length; i++) {
|
|
3682
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3683
|
+
classicItems.push(i);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3687
|
+
expandItemToMedium(k, classicItems[0], itemEle);
|
|
3688
|
+
expandItemToMedium(k, classicItems[1], itemEle);
|
|
3689
|
+
if (classicItems.length === 3) {
|
|
3690
|
+
expandItemToMedium(k, classicItems[2], itemEle);
|
|
3691
|
+
}
|
|
3163
3692
|
if (!shouldSkip || shouldClear) {
|
|
3164
3693
|
itemEle.removeAttribute('data-medium-width');
|
|
3165
3694
|
}
|
|
@@ -3179,10 +3708,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3179
3708
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3180
3709
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3181
3710
|
if (orientation === ItemOrientation.Row) {
|
|
3182
|
-
|
|
3711
|
+
const collection = group.collections[0];
|
|
3712
|
+
const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
3713
|
+
expandItemToMedium(0, start, shrinkColumn);
|
|
3714
|
+
expandItemToMedium(0, l, shrinkColumn);
|
|
3715
|
+
// if l == end, then l is the last item, else L is the middle item. If l is middle then call the method for end.
|
|
3716
|
+
if (l !== end) {
|
|
3717
|
+
expandItemToMedium(0, end, shrinkColumn);
|
|
3718
|
+
}
|
|
3183
3719
|
}
|
|
3184
3720
|
else {
|
|
3185
|
-
|
|
3721
|
+
const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
3722
|
+
expandCollectionsToMedium(start);
|
|
3723
|
+
expandCollectionsToMedium(m);
|
|
3724
|
+
if (m !== end) {
|
|
3725
|
+
expandCollectionsToMedium(end);
|
|
3726
|
+
}
|
|
3186
3727
|
}
|
|
3187
3728
|
if (!shouldSkip || shouldClear) {
|
|
3188
3729
|
shrinkColumn.removeAttribute('data-medium-width');
|
|
@@ -3203,32 +3744,46 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3203
3744
|
if (shrinkColumns.length === 0) {
|
|
3204
3745
|
return false;
|
|
3205
3746
|
}
|
|
3206
|
-
const expandItemsToLarge = (start, end, parentEle) => {
|
|
3747
|
+
const expandItemsToLarge = (start, end, parentEle, middle) => {
|
|
3207
3748
|
const items = this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3208
3749
|
groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
|
|
3209
|
-
|
|
3750
|
+
const reduce = (i) => {
|
|
3210
3751
|
const item = items[parseInt(i.toString(), 10)];
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3752
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3753
|
+
const container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3754
|
+
const ele = container.querySelector('#' + item.id);
|
|
3755
|
+
item.setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
3756
|
+
this.setItemSize(ele, item);
|
|
3757
|
+
parentEle.insertAdjacentElement('afterend', container);
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
reduce(start);
|
|
3761
|
+
if (middle) {
|
|
3762
|
+
reduce(middle);
|
|
3216
3763
|
}
|
|
3764
|
+
reduce(end);
|
|
3217
3765
|
if (!shouldSkip || shouldClear) {
|
|
3218
3766
|
remove(parentEle);
|
|
3219
3767
|
}
|
|
3220
3768
|
};
|
|
3221
|
-
const expandCollectionsToLarge = (start, end, parentEle) => {
|
|
3769
|
+
const expandCollectionsToLarge = (start, end, parentEle, middle) => {
|
|
3222
3770
|
const collections = this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3223
3771
|
groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3224
|
-
|
|
3772
|
+
const reduce = (i) => {
|
|
3225
3773
|
const collection = collections[parseInt(i.toString(), 10)];
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3774
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
3775
|
+
const collectionEle = parentEle.querySelector('#' + collection.id);
|
|
3776
|
+
const ele = collectionEle.querySelector('#' + collection.items[0].id);
|
|
3777
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
3778
|
+
this.setItemSize(ele, collection.items[0]);
|
|
3779
|
+
parentEle.insertAdjacentElement('afterend', collectionEle);
|
|
3780
|
+
}
|
|
3781
|
+
};
|
|
3782
|
+
reduce(start);
|
|
3783
|
+
if (middle) {
|
|
3784
|
+
reduce(middle);
|
|
3231
3785
|
}
|
|
3786
|
+
reduce(end);
|
|
3232
3787
|
if (!shouldSkip || shouldClear) {
|
|
3233
3788
|
remove(parentEle);
|
|
3234
3789
|
}
|
|
@@ -3241,10 +3796,23 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3241
3796
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3242
3797
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3243
3798
|
if (orientation === ItemOrientation.Row) {
|
|
3244
|
-
|
|
3799
|
+
const collection = group.collections[0];
|
|
3800
|
+
const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
3801
|
+
if (l === end) {
|
|
3802
|
+
expandItemsToLarge(start, end, shrinkColumn);
|
|
3803
|
+
}
|
|
3804
|
+
else {
|
|
3805
|
+
expandItemsToLarge(start, end, shrinkColumn, l);
|
|
3806
|
+
}
|
|
3245
3807
|
}
|
|
3246
3808
|
else {
|
|
3247
|
-
|
|
3809
|
+
const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
3810
|
+
if (m === end) {
|
|
3811
|
+
expandCollectionsToLarge(start, end, shrinkColumn);
|
|
3812
|
+
}
|
|
3813
|
+
else {
|
|
3814
|
+
expandCollectionsToLarge(start, end, shrinkColumn, m);
|
|
3815
|
+
}
|
|
3248
3816
|
}
|
|
3249
3817
|
if (!shouldSkip || shouldClear) {
|
|
3250
3818
|
shrinkColumn.removeAttribute('data-large-width');
|
|
@@ -3300,7 +3868,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3300
3868
|
//Expanding the items in the group to their original expanded state
|
|
3301
3869
|
this.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3302
3870
|
this.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3303
|
-
const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
|
|
3871
|
+
const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this.enableRtl);
|
|
3304
3872
|
this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3305
3873
|
groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
|
|
3306
3874
|
for (let j = 0; j < group.collections.length; j++) {
|
|
@@ -3309,7 +3877,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3309
3877
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3310
3878
|
const item = collection.items[parseInt(k.toString(), 10)];
|
|
3311
3879
|
const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3312
|
-
|
|
3880
|
+
if (itemEle !== null) {
|
|
3881
|
+
this.addOverflowEvents(item, itemEle, dropdown);
|
|
3882
|
+
}
|
|
3313
3883
|
}
|
|
3314
3884
|
}
|
|
3315
3885
|
}
|
|
@@ -3344,7 +3914,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3344
3914
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3345
3915
|
const item = collection.items[parseInt(k.toString(), 10)];
|
|
3346
3916
|
const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3347
|
-
|
|
3917
|
+
if (itemEle !== null) {
|
|
3918
|
+
this.removeOverflowEvent(item, itemEle);
|
|
3919
|
+
}
|
|
3348
3920
|
}
|
|
3349
3921
|
}
|
|
3350
3922
|
}
|
|
@@ -3392,6 +3964,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3392
3964
|
}
|
|
3393
3965
|
}
|
|
3394
3966
|
ribbonTabSelecting(e) {
|
|
3967
|
+
this.currentControlIndex = 0;
|
|
3395
3968
|
const nextTabId = e.selectingItem.getAttribute('data-id');
|
|
3396
3969
|
const previousTabId = e.previousItem.getAttribute('data-id');
|
|
3397
3970
|
let nextIndex = getIndex(this.tabs, ((tab) => (tab.id === nextTabId)));
|
|
@@ -3451,7 +4024,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3451
4024
|
id: btnId
|
|
3452
4025
|
});
|
|
3453
4026
|
const overflowTarget = this.createElement('div', {
|
|
3454
|
-
className: RIBBON_OVERFLOW_TARGET
|
|
4027
|
+
className: RIBBON_OVERFLOW_TARGET,
|
|
4028
|
+
attrs: { 'tabindex': '0' }
|
|
3455
4029
|
});
|
|
3456
4030
|
const overflowDDB = new DropDownButton({
|
|
3457
4031
|
iconCss: OVERFLOW_ICON,
|
|
@@ -3469,8 +4043,112 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3469
4043
|
}, overflowButton);
|
|
3470
4044
|
this.element.classList.add(RIBBON_OVERFLOW);
|
|
3471
4045
|
createTooltip(overflowTarget, this);
|
|
4046
|
+
let isGroupOf;
|
|
4047
|
+
overflowButton.onkeydown = overflowButton.onclick = () => { this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
|
|
4048
|
+
overflowTarget.onkeydown = (e) => (this.upDownKeyHandler(e, overflowTarget, isGroupOf), this);
|
|
3472
4049
|
return overflowDDB;
|
|
3473
4050
|
}
|
|
4051
|
+
upDownKeyHandler(e, target, isGroupOf) {
|
|
4052
|
+
let items;
|
|
4053
|
+
if (isGroupOf) {
|
|
4054
|
+
items = target.getElementsByClassName('e-ribbon-item');
|
|
4055
|
+
}
|
|
4056
|
+
else {
|
|
4057
|
+
const currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
|
|
4058
|
+
items = currentList.getElementsByClassName('e-ribbon-item');
|
|
4059
|
+
}
|
|
4060
|
+
const comboBoxEle = items[(!this.itemIndex || this.itemIndex < 0) ? 0 : this.itemIndex].querySelector('.e-control').classList.contains('e-combobox') ? items[(!this.itemIndex || this.itemIndex < 0) ? 0 : this.itemIndex].querySelector('.e-combobox') : null;
|
|
4061
|
+
let ribbonItem;
|
|
4062
|
+
if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
|
|
4063
|
+
if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
|
|
4064
|
+
if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
|
|
4065
|
+
this.itemIndex = 0;
|
|
4066
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4067
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4068
|
+
if (comboBoxEle && e.key === 'Tab') {
|
|
4069
|
+
e.preventDefault();
|
|
4070
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
|
|
4074
|
+
this.itemIndex++;
|
|
4075
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4076
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
|
|
4080
|
+
if (comboBoxEle === null || (e.key === 'Tab')) {
|
|
4081
|
+
if (!this.itemIndex || this.itemIndex === -1) {
|
|
4082
|
+
this.itemIndex = items.length - 1;
|
|
4083
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4084
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4085
|
+
if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
|
|
4086
|
+
e.preventDefault();
|
|
4087
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
|
|
4091
|
+
this.itemIndex--;
|
|
4092
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4093
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
target.setAttribute('index', this.itemIndex.toString());
|
|
4098
|
+
}
|
|
4099
|
+
const currentItemIndex = parseInt(target.getAttribute('index'), 10);
|
|
4100
|
+
const itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
|
|
4101
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
|
|
4102
|
+
if (itemType === 'ColorPicker') {
|
|
4103
|
+
if (e.key === 'Tab') {
|
|
4104
|
+
e.preventDefault();
|
|
4105
|
+
}
|
|
4106
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
|
|
4107
|
+
}
|
|
4108
|
+
else {
|
|
4109
|
+
if (e.key === 'Tab') {
|
|
4110
|
+
e.preventDefault();
|
|
4111
|
+
}
|
|
4112
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4113
|
+
}
|
|
4114
|
+
if (e.key === ' ' && (itemType === 'CheckBox')) {
|
|
4115
|
+
const checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
|
|
4116
|
+
const checkBox = getComponent(checkBoxEle, CheckBox);
|
|
4117
|
+
this.itemIndex = -1;
|
|
4118
|
+
checkBox.click();
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
|
|
4122
|
+
if (e.key === 'ArrowRight') {
|
|
4123
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
|
|
4124
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
|
|
4125
|
+
}
|
|
4126
|
+
if (e.key === 'ArrowLeft') {
|
|
4127
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
|
|
4128
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
if (e.key === 'Enter') {
|
|
4132
|
+
this.itemIndex = -1;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
findDisabledItem(ribbonItem, items, isIncrease) {
|
|
4136
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
4137
|
+
if (isIncrease) {
|
|
4138
|
+
if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4139
|
+
this.itemIndex = -1;
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
else {
|
|
4143
|
+
if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4144
|
+
this.itemIndex = items.length;
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
4148
|
+
isIncrease ? this.itemIndex++ : this.itemIndex--;
|
|
4149
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
3474
4152
|
removeOverflowButton(overflowDDB) {
|
|
3475
4153
|
if (overflowDDB) {
|
|
3476
4154
|
const btnEle = overflowDDB.element;
|
|
@@ -3558,6 +4236,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3558
4236
|
}
|
|
3559
4237
|
}
|
|
3560
4238
|
switchLayout() {
|
|
4239
|
+
this.currentControlIndex = 0;
|
|
3561
4240
|
this.destroyScroll();
|
|
3562
4241
|
this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
|
|
3563
4242
|
this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
|
|
@@ -3572,6 +4251,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3572
4251
|
if (this.activeLayout === 'Simplified') {
|
|
3573
4252
|
for (let i = 0; i < groupList.length; i++) {
|
|
3574
4253
|
const group = groupList[parseInt(i.toString(), 10)];
|
|
4254
|
+
const alignType = groupList[parseInt(i.toString(), 10)].orientation;
|
|
3575
4255
|
if (group.isCollapsed) {
|
|
3576
4256
|
group.setProperties({ isCollapsed: false }, true);
|
|
3577
4257
|
this.removeDropdown(group.id);
|
|
@@ -3599,7 +4279,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3599
4279
|
const itemList = collection.items;
|
|
3600
4280
|
let item = collection.items[parseInt(k.toString(), 10)];
|
|
3601
4281
|
let flag = true;
|
|
3602
|
-
while ((flag) && (item.displayOptions === DisplayMode.
|
|
4282
|
+
while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
|
|
3603
4283
|
k++;
|
|
3604
4284
|
const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3605
4285
|
const ele = itemEle.querySelector('#' + item.id);
|
|
@@ -3615,19 +4295,29 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3615
4295
|
if (!flag) {
|
|
3616
4296
|
break;
|
|
3617
4297
|
}
|
|
3618
|
-
const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3619
|
-
const ele = itemEle.querySelector('#' + item.id);
|
|
3620
4298
|
let size = ((item.allowedSizes === RibbonItemSize.Large) ||
|
|
3621
4299
|
(item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
4300
|
+
size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
|
|
4301
|
+
? RibbonItemSize.Medium : size;
|
|
4302
|
+
let itemEle;
|
|
4303
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
4304
|
+
itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
|
|
4305
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4306
|
+
groupCollection.append(itemEle);
|
|
3627
4307
|
}
|
|
3628
4308
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
4309
|
+
else {
|
|
4310
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4311
|
+
if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
|
|
4312
|
+
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
|
|
4313
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
4314
|
+
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
item.setProperties({ activeSize: size }, true);
|
|
4318
|
+
const ele = itemEle.querySelector('#' + item.id);
|
|
4319
|
+
this.setItemSize(ele, item);
|
|
4320
|
+
}
|
|
3631
4321
|
}
|
|
3632
4322
|
}
|
|
3633
4323
|
if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
|
|
@@ -3674,22 +4364,37 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3674
4364
|
groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
|
|
3675
4365
|
}
|
|
3676
4366
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
4367
|
+
const itemList = collection.items;
|
|
4368
|
+
let item = collection.items[parseInt(k.toString(), 10)];
|
|
4369
|
+
let flag = true;
|
|
4370
|
+
while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
|
|
4371
|
+
k++;
|
|
4372
|
+
let itemEle;
|
|
4373
|
+
if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
|
|
4374
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4375
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4376
|
+
}
|
|
4377
|
+
else {
|
|
4378
|
+
itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
4379
|
+
}
|
|
4380
|
+
if (itemEle !== null) {
|
|
4381
|
+
const ele = itemEle.querySelector('#' + item.id);
|
|
4382
|
+
this.destroyFunction(item, ele);
|
|
4383
|
+
itemEle.remove();
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
if (k < itemList.length) {
|
|
4387
|
+
item = itemList[parseInt(k.toString(), 10)];
|
|
4388
|
+
}
|
|
4389
|
+
else {
|
|
4390
|
+
flag = false;
|
|
3686
4391
|
}
|
|
3687
|
-
groupCollection.append(itemEle);
|
|
3688
|
-
this.removeOverflowEvent(item, itemEle);
|
|
3689
4392
|
}
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
4393
|
+
if (!flag) {
|
|
4394
|
+
break;
|
|
4395
|
+
}
|
|
4396
|
+
if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
|
|
4397
|
+
const itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
|
|
3693
4398
|
groupCollection.append(itemEle);
|
|
3694
4399
|
}
|
|
3695
4400
|
else {
|
|
@@ -3727,6 +4432,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3727
4432
|
this.overflowDDB = null;
|
|
3728
4433
|
}
|
|
3729
4434
|
}
|
|
4435
|
+
createLauncherIcon(groupId, groupContainer) {
|
|
4436
|
+
const launcherIcon = this.createElement('div', {
|
|
4437
|
+
className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
|
|
4438
|
+
id: groupId + LAUNCHER_ID,
|
|
4439
|
+
attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
|
|
4440
|
+
});
|
|
4441
|
+
groupContainer.appendChild(launcherIcon);
|
|
4442
|
+
groupContainer.classList.add(RIBBON_LAUNCHER);
|
|
4443
|
+
EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
|
|
4444
|
+
EventHandler.add(launcherIcon, 'keydown', (e) => {
|
|
4445
|
+
if (e.key === 'Enter') {
|
|
4446
|
+
this.launcherIconClicked(groupId);
|
|
4447
|
+
}
|
|
4448
|
+
}, this);
|
|
4449
|
+
}
|
|
3730
4450
|
launcherIconClicked(id) {
|
|
3731
4451
|
const eventArgs = { groupId: id };
|
|
3732
4452
|
this.trigger('launcherIconClick', eventArgs);
|
|
@@ -3763,19 +4483,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3763
4483
|
groupContainer.appendChild(groupHeader);
|
|
3764
4484
|
}
|
|
3765
4485
|
if (group.showLauncherIcon) {
|
|
3766
|
-
|
|
3767
|
-
className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
|
|
3768
|
-
id: group.id + LAUNCHER_ID,
|
|
3769
|
-
attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
|
|
3770
|
-
});
|
|
3771
|
-
groupContainer.appendChild(launcherIcon);
|
|
3772
|
-
groupContainer.classList.add(RIBBON_LAUNCHER);
|
|
3773
|
-
EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, group.id), this);
|
|
3774
|
-
EventHandler.add(launcherIcon, 'keydown', (e) => {
|
|
3775
|
-
if (e.key === 'Enter') {
|
|
3776
|
-
this.launcherIconClicked(group.id);
|
|
3777
|
-
}
|
|
3778
|
-
}, this);
|
|
4486
|
+
this.createLauncherIcon(group.id, groupContainer);
|
|
3779
4487
|
}
|
|
3780
4488
|
const elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
|
|
3781
4489
|
append(elements, groupContent);
|
|
@@ -3843,13 +4551,40 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3843
4551
|
}
|
|
3844
4552
|
return collectionElements;
|
|
3845
4553
|
}
|
|
4554
|
+
createRibbonItem(item, itemEle) {
|
|
4555
|
+
switch (item.type) {
|
|
4556
|
+
case 'Button':
|
|
4557
|
+
this.ribbonButtonModule.createButton(item, itemEle);
|
|
4558
|
+
break;
|
|
4559
|
+
case 'DropDown':
|
|
4560
|
+
this.ribbonDropDownModule.createDropDown(item, itemEle);
|
|
4561
|
+
break;
|
|
4562
|
+
case 'SplitButton':
|
|
4563
|
+
this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
|
|
4564
|
+
break;
|
|
4565
|
+
case 'CheckBox':
|
|
4566
|
+
this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
|
|
4567
|
+
break;
|
|
4568
|
+
case 'ColorPicker':
|
|
4569
|
+
this.ribbonColorPickerModule.createColorPicker(item, itemEle);
|
|
4570
|
+
break;
|
|
4571
|
+
case 'ComboBox':
|
|
4572
|
+
this.ribbonComboBoxModule.createComboBox(item, itemEle);
|
|
4573
|
+
break;
|
|
4574
|
+
case 'Template':
|
|
4575
|
+
this.createTemplateContent(item, itemEle);
|
|
4576
|
+
break;
|
|
4577
|
+
}
|
|
4578
|
+
}
|
|
3846
4579
|
createItems(itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
|
|
3847
4580
|
const itemElements = [];
|
|
3848
4581
|
for (let i = 0; i < itemList.length; i++) {
|
|
3849
4582
|
let item = itemList[parseInt(i.toString(), 10)];
|
|
3850
4583
|
//To stop rendering of items with simplified mode position type as none
|
|
3851
4584
|
let flag = true;
|
|
3852
|
-
while (
|
|
4585
|
+
while (flag &&
|
|
4586
|
+
(((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
|
|
4587
|
+
((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
|
|
3853
4588
|
i++;
|
|
3854
4589
|
if (i < itemList.length) {
|
|
3855
4590
|
item = itemList[parseInt(i.toString(), 10)];
|
|
@@ -3883,30 +4618,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3883
4618
|
else {
|
|
3884
4619
|
itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
3885
4620
|
}
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
this.ribbonButtonModule.createButton(item, itemEle);
|
|
3889
|
-
break;
|
|
3890
|
-
case 'DropDown':
|
|
3891
|
-
this.ribbonDropDownModule.createDropDown(item, itemEle);
|
|
3892
|
-
break;
|
|
3893
|
-
case 'SplitButton':
|
|
3894
|
-
this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
|
|
3895
|
-
break;
|
|
3896
|
-
case 'CheckBox':
|
|
3897
|
-
this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
|
|
3898
|
-
break;
|
|
3899
|
-
case 'ColorPicker':
|
|
3900
|
-
this.ribbonColorPickerModule.createColorPicker(item, itemEle);
|
|
3901
|
-
break;
|
|
3902
|
-
case 'ComboBox':
|
|
3903
|
-
this.ribbonComboBoxModule.createComboBox(item, itemEle);
|
|
3904
|
-
break;
|
|
3905
|
-
case 'Template':
|
|
3906
|
-
this.createTemplateContent(item, itemEle);
|
|
3907
|
-
break;
|
|
3908
|
-
}
|
|
3909
|
-
if ((this.activeLayout === 'Simplified') && (item.displayOptions === DisplayMode.Overflow)) {
|
|
4621
|
+
this.createRibbonItem(item, itemEle);
|
|
4622
|
+
if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
|
|
3910
4623
|
this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
|
|
3911
4624
|
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
3912
4625
|
this.updatePopupItems(item, itemEle, isGroupOF, true);
|
|
@@ -4010,13 +4723,15 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4010
4723
|
for (const item of collection.items) {
|
|
4011
4724
|
let ele = null;
|
|
4012
4725
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4013
|
-
|
|
4726
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
4727
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
4728
|
+
}
|
|
4014
4729
|
}
|
|
4015
4730
|
else {
|
|
4016
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
4731
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4017
4732
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4018
4733
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4019
|
-
if (!ele
|
|
4734
|
+
if (!ele) {
|
|
4020
4735
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4021
4736
|
if (item.type === 'DropDown') {
|
|
4022
4737
|
this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
|
|
@@ -4069,15 +4784,17 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4069
4784
|
for (const item of collection.items) {
|
|
4070
4785
|
let ele;
|
|
4071
4786
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4072
|
-
|
|
4073
|
-
|
|
4787
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
4788
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
|
|
4789
|
+
contentEle.querySelector('#' + item.id);
|
|
4790
|
+
}
|
|
4074
4791
|
}
|
|
4075
4792
|
else {
|
|
4076
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
4793
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4077
4794
|
ele = (item.displayOptions & DisplayMode.Simplified) ?
|
|
4078
4795
|
contentEle.querySelector('#' + item.id) : null;
|
|
4079
4796
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4080
|
-
if (!ele
|
|
4797
|
+
if (!ele) {
|
|
4081
4798
|
ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
|
|
4082
4799
|
}
|
|
4083
4800
|
}
|
|
@@ -4493,16 +5210,376 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4493
5210
|
this.refreshLayout();
|
|
4494
5211
|
}
|
|
4495
5212
|
}
|
|
5213
|
+
/**
|
|
5214
|
+
* tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
|
|
5215
|
+
*
|
|
5216
|
+
* @param {RibbonTabModel} tab - Gets the ribbon tab model.
|
|
5217
|
+
* @returns {void}
|
|
5218
|
+
*/
|
|
5219
|
+
updateTab(tab) {
|
|
5220
|
+
const tabId = tab.id;
|
|
5221
|
+
const index = getIndex(this.tabs, (e) => { return e.id === tabId; });
|
|
5222
|
+
if (index === -1) {
|
|
5223
|
+
return;
|
|
5224
|
+
}
|
|
5225
|
+
const contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
|
|
5226
|
+
const groups = this.tabs[parseInt(index.toString(), 10)].groups;
|
|
5227
|
+
const tabEle = this.tabObj.element;
|
|
5228
|
+
if (groups && (contentEle.innerHTML !== '')) {
|
|
5229
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5230
|
+
if (tab.cssClass) {
|
|
5231
|
+
if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
|
|
5232
|
+
contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5233
|
+
tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5234
|
+
}
|
|
5235
|
+
}
|
|
5236
|
+
// Check whether group is passed by the user, and if it is, then remove the old values.
|
|
5237
|
+
if (tab.groups) {
|
|
5238
|
+
for (const group of groups) {
|
|
5239
|
+
const dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
|
|
5240
|
+
for (const collection of group.collections) {
|
|
5241
|
+
for (const item of collection.items) {
|
|
5242
|
+
const ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
5243
|
+
if (ele) {
|
|
5244
|
+
this.destroyFunction(item, ele);
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
if (dropdownElement) {
|
|
5249
|
+
this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
|
|
5250
|
+
}
|
|
5251
|
+
}
|
|
5252
|
+
const groupElements = contentEle.querySelectorAll('.e-ribbon-group');
|
|
5253
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5254
|
+
groupElements.forEach(groupEle => { groupEle.remove(); });
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
if (index === this.selectedTab) {
|
|
5258
|
+
this.isAddRemove = true;
|
|
5259
|
+
}
|
|
5260
|
+
const ribbonTab = this.tabs[parseInt(index.toString(), 10)];
|
|
5261
|
+
ribbonTab.setProperties(tab, true);
|
|
5262
|
+
this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
|
|
5263
|
+
this.validateItemSize();
|
|
5264
|
+
if (contentEle.innerHTML === '') {
|
|
5265
|
+
// Check whether group is passed by the user and sets the updated values.
|
|
5266
|
+
if (tab.groups) {
|
|
5267
|
+
const elements = this.createGroups(ribbonTab.groups, index);
|
|
5268
|
+
append(elements, contentEle);
|
|
5269
|
+
}
|
|
5270
|
+
if (this.selectedTab === index) {
|
|
5271
|
+
this.refreshLayout();
|
|
5272
|
+
}
|
|
5273
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5274
|
+
if (tab.cssClass) {
|
|
5275
|
+
contentEle.classList.add(ribbonTab.cssClass);
|
|
5276
|
+
tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
|
|
5277
|
+
}
|
|
5278
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5279
|
+
if (tab.header) {
|
|
5280
|
+
tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
/**
|
|
5285
|
+
* group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
|
|
5286
|
+
*
|
|
5287
|
+
* @param {RibbonGroupModel} group - Gets the ribbon group model.
|
|
5288
|
+
* @returns {void}
|
|
5289
|
+
*/
|
|
5290
|
+
updateGroup(group) {
|
|
5291
|
+
const groupId = group.id;
|
|
5292
|
+
const itemProp = getGroup(this.tabs, groupId);
|
|
5293
|
+
if (!itemProp) {
|
|
5294
|
+
return;
|
|
5295
|
+
}
|
|
5296
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5297
|
+
this.clearOverflowResize();
|
|
5298
|
+
}
|
|
5299
|
+
//Check whether the tab items are rendered
|
|
5300
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5301
|
+
const groupEle = contentEle.querySelector('#' + groupId);
|
|
5302
|
+
const groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
|
|
5303
|
+
let dropdownElement;
|
|
5304
|
+
let dropdown;
|
|
5305
|
+
if (contentEle.innerHTML !== '') {
|
|
5306
|
+
if (itemProp.group.showLauncherIcon) {
|
|
5307
|
+
this.removeLauncherIcon(itemProp.group.id, null, contentEle);
|
|
5308
|
+
}
|
|
5309
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5310
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5311
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5312
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5313
|
+
}
|
|
5314
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5315
|
+
if (group.cssClass) {
|
|
5316
|
+
if (itemProp.group.cssClass) {
|
|
5317
|
+
groupEle.classList.remove(itemProp.group.cssClass);
|
|
5318
|
+
if (groupContainer) {
|
|
5319
|
+
groupContainer.classList.remove(itemProp.group.cssClass);
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
// Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
|
|
5324
|
+
if (group.collections || group.orientation) {
|
|
5325
|
+
if (itemProp.group.collections || itemProp.group.orientation) {
|
|
5326
|
+
for (const collection of itemProp.group.collections) {
|
|
5327
|
+
for (const item of collection.items) {
|
|
5328
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5329
|
+
}
|
|
5330
|
+
}
|
|
5331
|
+
const collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
|
|
5332
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5333
|
+
collectionElements.forEach(collectionEle => { collectionEle.remove(); });
|
|
5334
|
+
if (group.orientation) {
|
|
5335
|
+
const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5336
|
+
const removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
|
|
5337
|
+
if (removeCss) {
|
|
5338
|
+
removeClass([groupContent], removeCss);
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5344
|
+
if (itemProp.group.enableGroupOverflow) {
|
|
5345
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5346
|
+
this.removeOverflowButton(dropdown);
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
else {
|
|
5350
|
+
const ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5351
|
+
if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
|
|
5352
|
+
ofGroupContainer.remove();
|
|
5353
|
+
}
|
|
5354
|
+
const ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
5355
|
+
if (ofTabContainer && ofTabContainer.childElementCount === 0) {
|
|
5356
|
+
ofTabContainer.remove();
|
|
5357
|
+
}
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
const ribbongroup = itemProp.group;
|
|
5362
|
+
ribbongroup.setProperties(group, true);
|
|
5363
|
+
ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
|
|
5364
|
+
this.validateItemSize();
|
|
5365
|
+
if (contentEle.innerHTML !== '') {
|
|
5366
|
+
// Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
|
|
5367
|
+
if (group.showLauncherIcon) {
|
|
5368
|
+
this.createLauncherIcon(ribbongroup.id, groupContainer);
|
|
5369
|
+
}
|
|
5370
|
+
// Check whether collections or orientation is passed by the user and sets the updated values.
|
|
5371
|
+
if (group.collections || group.orientation) {
|
|
5372
|
+
const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5373
|
+
groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
|
|
5374
|
+
const elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5375
|
+
append(elements, groupContent);
|
|
5376
|
+
}
|
|
5377
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5378
|
+
this.refreshLayout();
|
|
5379
|
+
}
|
|
5380
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5381
|
+
if (group.cssClass) {
|
|
5382
|
+
groupEle.classList.add(ribbongroup.cssClass);
|
|
5383
|
+
if (groupContainer) {
|
|
5384
|
+
groupContainer.classList.add(ribbongroup.cssClass);
|
|
5385
|
+
}
|
|
5386
|
+
}
|
|
5387
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5388
|
+
if (group.header) {
|
|
5389
|
+
if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
|
|
5390
|
+
const overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
|
|
5391
|
+
if (overflowHeader) {
|
|
5392
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5393
|
+
}
|
|
5394
|
+
}
|
|
5395
|
+
else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
|
|
5396
|
+
groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
|
|
5397
|
+
}
|
|
5398
|
+
else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
|
|
5399
|
+
const overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
5400
|
+
// need to set instance for dropdown
|
|
5401
|
+
const dropDownBtn = getInstance(overflowEle, DropDownButton);
|
|
5402
|
+
const overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
|
|
5403
|
+
if (overflowHeader) {
|
|
5404
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
/**
|
|
5411
|
+
* collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
|
|
5412
|
+
*
|
|
5413
|
+
* @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
|
|
5414
|
+
* @returns {void}
|
|
5415
|
+
*/
|
|
5416
|
+
updateCollection(collection) {
|
|
5417
|
+
const collectionId = collection.id;
|
|
5418
|
+
const itemProp = getCollection(this.tabs, collectionId);
|
|
5419
|
+
if (!itemProp) {
|
|
5420
|
+
return;
|
|
5421
|
+
}
|
|
5422
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5423
|
+
this.clearOverflowResize();
|
|
5424
|
+
}
|
|
5425
|
+
//Check whether the tab items are rendered
|
|
5426
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5427
|
+
const collectionEle = contentEle.querySelector('#' + collectionId);
|
|
5428
|
+
if (contentEle.innerHTML !== '') {
|
|
5429
|
+
let dropdownElement;
|
|
5430
|
+
let dropdown;
|
|
5431
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5432
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5433
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5434
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5435
|
+
}
|
|
5436
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5437
|
+
if (collection.cssClass) {
|
|
5438
|
+
if (itemProp.collection.cssClass) {
|
|
5439
|
+
collectionEle.classList.remove(itemProp.collection.cssClass);
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
if (collection.items) {
|
|
5443
|
+
if (itemProp.collection.items) {
|
|
5444
|
+
for (const item of itemProp.collection.items) {
|
|
5445
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
const ribboncollection = itemProp.collection;
|
|
5451
|
+
ribboncollection.setProperties(collection, true);
|
|
5452
|
+
ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
|
|
5453
|
+
this.validateItemSize();
|
|
5454
|
+
if (contentEle.innerHTML !== '') {
|
|
5455
|
+
if (collection.items) {
|
|
5456
|
+
const groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5457
|
+
const elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5458
|
+
append(elements, collectionEle);
|
|
5459
|
+
}
|
|
5460
|
+
}
|
|
5461
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5462
|
+
this.refreshLayout();
|
|
5463
|
+
}
|
|
5464
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5465
|
+
if (collection.cssClass) {
|
|
5466
|
+
collectionEle.classList.add(ribboncollection.cssClass);
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
/**
|
|
5470
|
+
* item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
|
|
5471
|
+
*
|
|
5472
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
5473
|
+
* @returns {void}
|
|
5474
|
+
*/
|
|
5475
|
+
updateItem(item) {
|
|
5476
|
+
const itemId = item.id;
|
|
5477
|
+
const itemProp = getItem(this.tabs, itemId);
|
|
5478
|
+
if (!itemProp) {
|
|
5479
|
+
return;
|
|
5480
|
+
}
|
|
5481
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5482
|
+
this.clearOverflowResize();
|
|
5483
|
+
}
|
|
5484
|
+
//Check whether the tab items are rendered
|
|
5485
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5486
|
+
const groupEle = contentEle.querySelector('#' + itemProp.group.id);
|
|
5487
|
+
const groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5488
|
+
let itemContainer = null;
|
|
5489
|
+
let itemEle = null;
|
|
5490
|
+
let dropdownElement;
|
|
5491
|
+
let dropdown;
|
|
5492
|
+
if (contentEle.innerHTML !== '') {
|
|
5493
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5494
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5495
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5496
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5497
|
+
}
|
|
5498
|
+
if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
|
|
5499
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5500
|
+
itemEle = dropdown.target.querySelector('#' + itemId);
|
|
5501
|
+
if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
|
|
5502
|
+
const collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
|
|
5503
|
+
if (collectionEle) {
|
|
5504
|
+
collectionEle.appendChild(itemContainer);
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
else {
|
|
5509
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5510
|
+
itemEle = contentEle.querySelector('#' + itemId);
|
|
5511
|
+
if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
|
|
5512
|
+
this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
|
|
5513
|
+
if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
|
|
5514
|
+
this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5519
|
+
if (item.cssClass) {
|
|
5520
|
+
if (itemProp.item.cssClass) {
|
|
5521
|
+
itemContainer.classList.remove(itemProp.item.cssClass);
|
|
5522
|
+
}
|
|
5523
|
+
}
|
|
5524
|
+
this.destroyFunction(itemProp.item, itemEle);
|
|
5525
|
+
itemEle.remove();
|
|
5526
|
+
const removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
|
|
5527
|
+
if (removeCss) {
|
|
5528
|
+
removeClass([itemContainer], removeCss);
|
|
5529
|
+
}
|
|
5530
|
+
}
|
|
5531
|
+
const ribbonItem = itemProp.item;
|
|
5532
|
+
ribbonItem.setProperties(item, true);
|
|
5533
|
+
this.validateItemSize();
|
|
5534
|
+
if (contentEle.innerHTML !== '') {
|
|
5535
|
+
if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
|
|
5536
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5537
|
+
}
|
|
5538
|
+
else {
|
|
5539
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5540
|
+
}
|
|
5541
|
+
// To avoid undefined items condition is added
|
|
5542
|
+
if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
|
|
5543
|
+
itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
|
|
5544
|
+
this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
|
|
5545
|
+
}
|
|
5546
|
+
let size = ribbonItem.activeSize;
|
|
5547
|
+
if (this.activeLayout === 'Simplified') {
|
|
5548
|
+
size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
|
|
5549
|
+
(ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
5550
|
+
ribbonItem.setProperties({ activeSize: size }, true);
|
|
5551
|
+
}
|
|
5552
|
+
if (size & RibbonItemSize.Large) {
|
|
5553
|
+
itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
|
|
5554
|
+
}
|
|
5555
|
+
else {
|
|
5556
|
+
itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
5557
|
+
}
|
|
5558
|
+
this.createRibbonItem(ribbonItem, itemContainer);
|
|
5559
|
+
if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
|
|
5560
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5561
|
+
this.removeOverflowButton(dropdown);
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5564
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5565
|
+
this.refreshLayout();
|
|
5566
|
+
}
|
|
5567
|
+
if (item.cssClass) {
|
|
5568
|
+
itemContainer.classList.add(ribbonItem.cssClass);
|
|
5569
|
+
}
|
|
5570
|
+
this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
|
|
5571
|
+
}
|
|
5572
|
+
}
|
|
4496
5573
|
removeItemElement(contentEle, item, dropdown) {
|
|
4497
5574
|
let ele = null;
|
|
4498
5575
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4499
|
-
ele = contentEle.querySelector('#' + item.id);
|
|
5576
|
+
ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
|
|
4500
5577
|
}
|
|
4501
5578
|
else {
|
|
4502
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
5579
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4503
5580
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4504
5581
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4505
|
-
if (!ele
|
|
5582
|
+
if (!ele) {
|
|
4506
5583
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4507
5584
|
}
|
|
4508
5585
|
}
|
|
@@ -4553,6 +5630,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4553
5630
|
EventHandler.remove(window, 'resize', this.resizeHandler);
|
|
4554
5631
|
}
|
|
4555
5632
|
destroy() {
|
|
5633
|
+
this.keyboardModuleRibbon.destroy();
|
|
5634
|
+
this.keyboardModuleRibbon = null;
|
|
4556
5635
|
destroyTooltip(this.element);
|
|
4557
5636
|
this.destroyTabItems(this.tabs);
|
|
4558
5637
|
this.removeExpandCollapse();
|
|
@@ -4602,6 +5681,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4602
5681
|
case 'isMinimized':
|
|
4603
5682
|
this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
|
|
4604
5683
|
this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
|
|
5684
|
+
if (!this.isMinimized) {
|
|
5685
|
+
this.refreshLayout();
|
|
5686
|
+
}
|
|
4605
5687
|
break;
|
|
4606
5688
|
case 'locale':
|
|
4607
5689
|
this.updateCommonProperty({ locale: this.locale });
|
|
@@ -4625,7 +5707,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4625
5707
|
if (group.showLauncherIcon) {
|
|
4626
5708
|
const className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
|
|
4627
5709
|
if (group.isCollapsed) {
|
|
4628
|
-
const element = tabContent.querySelector('
|
|
5710
|
+
const element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
4629
5711
|
const dropdown = getComponent(element, DropDownButton);
|
|
4630
5712
|
const launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
|
|
4631
5713
|
launcherIconEle.className = className;
|
|
@@ -4656,14 +5738,20 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4656
5738
|
if (this.ribbonFileMenuModule) {
|
|
4657
5739
|
this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
|
|
4658
5740
|
}
|
|
5741
|
+
const toolbarEle = this.tabObj['tbObj'];
|
|
5742
|
+
toolbarEle.refreshOverflow();
|
|
4659
5743
|
break;
|
|
4660
5744
|
case 'helpPaneTemplate':
|
|
4661
5745
|
if (this.ribbonTempEle) {
|
|
4662
5746
|
remove(this.ribbonTempEle);
|
|
5747
|
+
this.ribbonTempEle = null;
|
|
5748
|
+
this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
|
|
4663
5749
|
}
|
|
4664
5750
|
if (this.helpPaneTemplate) {
|
|
4665
5751
|
this.createHelpPaneTemplate();
|
|
4666
5752
|
}
|
|
5753
|
+
const toolbar = this.tabObj['tbObj'];
|
|
5754
|
+
toolbar.refreshOverflow();
|
|
4667
5755
|
break;
|
|
4668
5756
|
}
|
|
4669
5757
|
}
|