@syncfusion/ej2-ribbon 21.2.3 → 22.1.39
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/CHANGELOG.md +8 -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 +1254 -165
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +1275 -180
- 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 +16 -10
- 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 +27 -0
- package/styles/bootstrap.css +27 -0
- package/styles/bootstrap4.css +27 -0
- package/styles/bootstrap5-dark.css +27 -0
- package/styles/bootstrap5.css +27 -0
- package/styles/fabric-dark.css +27 -0
- package/styles/fabric.css +27 -0
- package/styles/fluent-dark.css +27 -0
- package/styles/fluent.css +27 -0
- package/styles/highcontrast-light.css +27 -0
- package/styles/highcontrast.css +31 -4
- package/styles/material-dark.css +27 -0
- package/styles/material.css +27 -0
- package/styles/material3-dark.css +1672 -0
- package/styles/material3-dark.scss +3 -0
- package/styles/material3.css +1728 -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 +28 -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 +27 -0
- package/styles/ribbon/bootstrap-dark.scss +1 -0
- package/styles/ribbon/bootstrap.css +27 -0
- package/styles/ribbon/bootstrap.scss +1 -0
- package/styles/ribbon/bootstrap4.css +27 -0
- package/styles/ribbon/bootstrap4.scss +1 -0
- package/styles/ribbon/bootstrap5-dark.css +27 -0
- package/styles/ribbon/bootstrap5-dark.scss +1 -0
- package/styles/ribbon/bootstrap5.css +27 -0
- package/styles/ribbon/bootstrap5.scss +1 -0
- package/styles/ribbon/fabric-dark.css +27 -0
- package/styles/ribbon/fabric-dark.scss +1 -0
- package/styles/ribbon/fabric.css +27 -0
- package/styles/ribbon/fabric.scss +1 -0
- package/styles/ribbon/fluent-dark.css +27 -0
- package/styles/ribbon/fluent-dark.scss +1 -0
- package/styles/ribbon/fluent.css +27 -0
- package/styles/ribbon/fluent.scss +1 -0
- package/styles/ribbon/highcontrast-light.css +27 -0
- package/styles/ribbon/highcontrast-light.scss +1 -0
- package/styles/ribbon/highcontrast.css +31 -4
- package/styles/ribbon/highcontrast.scss +1 -0
- package/styles/ribbon/icons/_material3-dark.scss +1 -0
- package/styles/ribbon/material-dark.css +27 -0
- package/styles/ribbon/material-dark.scss +1 -0
- package/styles/ribbon/material.css +27 -0
- package/styles/ribbon/material.scss +1 -0
- package/styles/ribbon/material3-dark.css +1672 -0
- package/styles/ribbon/material3-dark.scss +19 -0
- package/styles/ribbon/material3.css +1728 -0
- package/styles/ribbon/material3.scss +19 -0
- package/styles/ribbon/tailwind-dark.css +27 -0
- package/styles/ribbon/tailwind-dark.scss +1 -0
- package/styles/ribbon/tailwind.css +27 -0
- package/styles/ribbon/tailwind.scss +1 -0
- package/styles/tailwind-dark.css +27 -0
- package/styles/tailwind.css +27 -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;
|
|
@@ -2310,7 +2493,7 @@ function setToolTipContent(args, tooltip, tooltipData) {
|
|
|
2310
2493
|
content.appendChild(textContainer);
|
|
2311
2494
|
if (data.iconCss) {
|
|
2312
2495
|
const customCss = tooltip.createElement('div', {
|
|
2313
|
-
className: data.
|
|
2496
|
+
className: data.iconCss + ' ' + RIBBON_TOOLTIP_ICON
|
|
2314
2497
|
});
|
|
2315
2498
|
textContainer.appendChild(customCss);
|
|
2316
2499
|
}
|
|
@@ -2322,7 +2505,8 @@ function setToolTipContent(args, tooltip, tooltipData) {
|
|
|
2322
2505
|
textContainer.appendChild(tooltipContent);
|
|
2323
2506
|
}
|
|
2324
2507
|
tooltip.setProperties({
|
|
2325
|
-
content: content
|
|
2508
|
+
content: content,
|
|
2509
|
+
cssClass: data.cssClass ? data.cssClass + ' ' + RIBBON_TOOLTIP : RIBBON_TOOLTIP
|
|
2326
2510
|
});
|
|
2327
2511
|
}
|
|
2328
2512
|
/**
|
|
@@ -2335,9 +2519,9 @@ function setToolTipContent(args, tooltip, tooltipData) {
|
|
|
2335
2519
|
*/
|
|
2336
2520
|
function createTooltip(element, ribbon) {
|
|
2337
2521
|
const ribbonTooltip = new Tooltip({
|
|
2338
|
-
cssClass: (RIBBON_TOOLTIP + ' ' + ribbon.cssClass).trim(),
|
|
2339
2522
|
target: '.' + RIBBON_TOOLTIP_TARGET,
|
|
2340
|
-
beforeRender: beforeTooltipRender.bind(this)
|
|
2523
|
+
beforeRender: beforeTooltipRender.bind(this),
|
|
2524
|
+
windowCollision: true
|
|
2341
2525
|
});
|
|
2342
2526
|
ribbonTooltip.appendTo(element);
|
|
2343
2527
|
/**
|
|
@@ -2407,6 +2591,12 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2407
2591
|
this.idIndex = 0;
|
|
2408
2592
|
this.tooltipData = [];
|
|
2409
2593
|
this.isAddRemove = false;
|
|
2594
|
+
this.keyConfigs = {
|
|
2595
|
+
leftarrow: 'leftarrow',
|
|
2596
|
+
rightarrow: 'rightarrow',
|
|
2597
|
+
tab: 'tab',
|
|
2598
|
+
shiftTab: 'shift+tab'
|
|
2599
|
+
};
|
|
2410
2600
|
}
|
|
2411
2601
|
/**
|
|
2412
2602
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -2448,12 +2638,239 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2448
2638
|
this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
|
|
2449
2639
|
}
|
|
2450
2640
|
this.createHelpPaneTemplate();
|
|
2641
|
+
const toolbar = this.tabObj['tbObj'];
|
|
2642
|
+
toolbar.refreshOverflow();
|
|
2451
2643
|
createTooltip(this.element, this);
|
|
2452
2644
|
this.wireEvents();
|
|
2645
|
+
this.wireKeyboardEvent();
|
|
2646
|
+
this.currentControlIndex = 0;
|
|
2453
2647
|
}
|
|
2454
2648
|
wireEvents() {
|
|
2455
2649
|
EventHandler.add(window, 'resize', this.resizeHandler, this);
|
|
2456
2650
|
}
|
|
2651
|
+
wireKeyboardEvent() {
|
|
2652
|
+
this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
|
|
2653
|
+
keyAction: this.keyActionHandler.bind(this),
|
|
2654
|
+
keyConfigs: this.keyConfigs,
|
|
2655
|
+
eventName: 'keydown'
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
keyActionHandler(e) {
|
|
2659
|
+
if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
|
|
2660
|
+
e.preventDefault();
|
|
2661
|
+
}
|
|
2662
|
+
const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2663
|
+
const ribbonControls = activeContent.querySelectorAll('.e-control');
|
|
2664
|
+
const comboBoxElements = activeContent.querySelectorAll('.e-combobox');
|
|
2665
|
+
let comboBoxEle;
|
|
2666
|
+
if (comboBoxElements) {
|
|
2667
|
+
for (let i = 0; i < comboBoxElements.length; i++) {
|
|
2668
|
+
if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2669
|
+
comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
if (comboBoxEle) {
|
|
2674
|
+
for (let i = 0; i < ribbonControls.length; i++) {
|
|
2675
|
+
if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
|
|
2676
|
+
if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2677
|
+
this.currentControlIndex = i;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
if (this.currentControlIndex === 0) {
|
|
2683
|
+
let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2684
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
2685
|
+
this.currentControlIndex++;
|
|
2686
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
2690
|
+
e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
|
|
2691
|
+
e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
|
|
2692
|
+
e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
2693
|
+
switch (e.action) {
|
|
2694
|
+
case 'rightarrow':
|
|
2695
|
+
this.handleNavigation(e, !this.enableRtl, ribbonControls);
|
|
2696
|
+
break;
|
|
2697
|
+
case 'leftarrow':
|
|
2698
|
+
this.handleNavigation(e, this.enableRtl, ribbonControls);
|
|
2699
|
+
break;
|
|
2700
|
+
case 'tab':
|
|
2701
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2702
|
+
if (this.currentControlIndex < ribbonControls.length - 1) {
|
|
2703
|
+
this.currentControlIndex++;
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
break;
|
|
2707
|
+
case 'shiftTab':
|
|
2708
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2709
|
+
if (this.currentControlIndex > 0) {
|
|
2710
|
+
this.currentControlIndex--;
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
else {
|
|
2714
|
+
this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
|
|
2715
|
+
this.currentControlIndex = 0;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
handleNavigation(e, enableRtl, ribbonControls) {
|
|
2721
|
+
let groupContainer;
|
|
2722
|
+
let prevGroupId;
|
|
2723
|
+
if (enableRtl) {
|
|
2724
|
+
if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
|
|
2725
|
+
this.currentControlIndex++;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
else {
|
|
2729
|
+
if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
|
|
2730
|
+
this.currentControlIndex--;
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
|
|
2734
|
+
if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
|
|
2735
|
+
if (enableRtl) {
|
|
2736
|
+
this.currentControlIndex++;
|
|
2737
|
+
}
|
|
2738
|
+
else {
|
|
2739
|
+
const prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2740
|
+
if (prevGroupContainer) {
|
|
2741
|
+
prevGroupId = prevGroupContainer.getAttribute('id');
|
|
2742
|
+
}
|
|
2743
|
+
this.currentControlIndex--;
|
|
2744
|
+
}
|
|
2745
|
+
let item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2746
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
2747
|
+
if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
|
|
2748
|
+
(!enableRtl && this.currentControlIndex === 0))) {
|
|
2749
|
+
if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
2750
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2751
|
+
break;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
2755
|
+
enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
|
|
2756
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2757
|
+
}
|
|
2758
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2759
|
+
if (this.activeLayout === 'Classic') {
|
|
2760
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2761
|
+
if (enableRtl) {
|
|
2762
|
+
let launcherIconEle;
|
|
2763
|
+
if (groupContainer) {
|
|
2764
|
+
launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2765
|
+
}
|
|
2766
|
+
if (launcherIconEle) {
|
|
2767
|
+
const items = groupContainer.querySelectorAll('.e-ribbon-item');
|
|
2768
|
+
items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
else {
|
|
2772
|
+
if (groupContainer) {
|
|
2773
|
+
const groupContainerId = groupContainer.getAttribute('id');
|
|
2774
|
+
if (prevGroupId !== groupContainerId) {
|
|
2775
|
+
const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2776
|
+
if (launcherIconEle) {
|
|
2777
|
+
ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
else {
|
|
2784
|
+
if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
|
|
2785
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
|
|
2786
|
+
}
|
|
2787
|
+
else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
2788
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
else {
|
|
2794
|
+
if (this.activeLayout === 'Classic') {
|
|
2795
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2796
|
+
}
|
|
2797
|
+
if (this.activeLayout === 'Simplified') {
|
|
2798
|
+
const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
2799
|
+
if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
2800
|
+
overflowButton.focus();
|
|
2801
|
+
}
|
|
2802
|
+
else {
|
|
2803
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
if (e.target.classList.contains('e-ribbon-last-item')) {
|
|
2808
|
+
if (enableRtl) {
|
|
2809
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2810
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
2811
|
+
}
|
|
2812
|
+
else {
|
|
2813
|
+
this.currentControlIndex--;
|
|
2814
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
|
|
2818
|
+
groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2819
|
+
const launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2820
|
+
if (launcherIconEle) {
|
|
2821
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
2825
|
+
if (enableRtl) {
|
|
2826
|
+
this.currentControlIndex++;
|
|
2827
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2828
|
+
if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
2829
|
+
ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
else {
|
|
2833
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
2834
|
+
this.currentControlIndex;
|
|
2835
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
if (e.target.classList.contains('e-ribbon-collapse-btn')) {
|
|
2839
|
+
if (enableRtl) {
|
|
2840
|
+
this.currentControlIndex = 0;
|
|
2841
|
+
let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2842
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
2843
|
+
this.currentControlIndex++;
|
|
2844
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2845
|
+
}
|
|
2846
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2847
|
+
}
|
|
2848
|
+
else {
|
|
2849
|
+
const overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
2850
|
+
if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
2851
|
+
overflowButton.focus();
|
|
2852
|
+
}
|
|
2853
|
+
else {
|
|
2854
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
2855
|
+
let ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2856
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
2857
|
+
this.currentControlIndex--;
|
|
2858
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2859
|
+
}
|
|
2860
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
2865
|
+
if (enableRtl) {
|
|
2866
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
2867
|
+
}
|
|
2868
|
+
else {
|
|
2869
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
2870
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2457
2874
|
resizeHandler() {
|
|
2458
2875
|
const activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2459
2876
|
this.checkOverflow(this.selectedTab, activeContent);
|
|
@@ -2655,7 +3072,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2655
3072
|
for (let k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
|
|
2656
3073
|
const item = collection.items[k - 1];
|
|
2657
3074
|
const itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
2658
|
-
if ((item.displayOptions ===
|
|
3075
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3076
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2659
3077
|
itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
|
|
2660
3078
|
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
|
|
2661
3079
|
if (item.activeSize === RibbonItemSize.Small) {
|
|
@@ -2725,7 +3143,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2725
3143
|
if (overflowtarget) {
|
|
2726
3144
|
itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
2727
3145
|
}
|
|
2728
|
-
if ((item.displayOptions ===
|
|
3146
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3147
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2729
3148
|
const width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
|
|
2730
3149
|
if (!isClear && (tabContent.offsetWidth < width)) {
|
|
2731
3150
|
flag = false;
|
|
@@ -2815,7 +3234,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2815
3234
|
}
|
|
2816
3235
|
overflowButton = this.overflowDDB;
|
|
2817
3236
|
}
|
|
2818
|
-
|
|
3237
|
+
if (itemEle !== null) {
|
|
3238
|
+
this.addOverflowEvents(item, itemEle, overflowButton);
|
|
3239
|
+
}
|
|
2819
3240
|
}
|
|
2820
3241
|
addOverflowEvents(item, itemEle, overflowButton) {
|
|
2821
3242
|
switch (item.type) {
|
|
@@ -2864,6 +3285,50 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2864
3285
|
}
|
|
2865
3286
|
return isBreak;
|
|
2866
3287
|
}
|
|
3288
|
+
checkValidCollectionLength(collections) {
|
|
3289
|
+
let count = 0;
|
|
3290
|
+
for (let i = 0; i < collections.length; i++) {
|
|
3291
|
+
const items = collections[parseInt(i.toString(), 10)].items;
|
|
3292
|
+
for (let ind = 0; ind < items.length; ind++) {
|
|
3293
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3294
|
+
count++;
|
|
3295
|
+
break;
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
if (count > 1) {
|
|
3299
|
+
return false;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
return count === 1;
|
|
3303
|
+
}
|
|
3304
|
+
checkClassicCollection(collections, n, isIncrement) {
|
|
3305
|
+
const items = collections[parseInt(n.toString(), 10)].items;
|
|
3306
|
+
for (let ind = 0; ind < items.length; ind++) {
|
|
3307
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3308
|
+
return n;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3312
|
+
if (isIncrement) {
|
|
3313
|
+
return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3314
|
+
}
|
|
3315
|
+
else {
|
|
3316
|
+
return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
checkClassicItem(items, n, isIncrement) {
|
|
3320
|
+
const item = items[parseInt(n.toString(), 10)];
|
|
3321
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3322
|
+
return n;
|
|
3323
|
+
}
|
|
3324
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3325
|
+
if (isIncrement) {
|
|
3326
|
+
return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3327
|
+
}
|
|
3328
|
+
else {
|
|
3329
|
+
return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
2867
3332
|
checkLargeToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip = false) {
|
|
2868
3333
|
const group = tab.groups[parseInt(groupIndex.toString(), 10)];
|
|
2869
3334
|
if (group.isCollapsed && !shouldSkip) {
|
|
@@ -2895,6 +3360,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2895
3360
|
createShrinkEle(collection.id, firstItem, start, end);
|
|
2896
3361
|
for (let i = start; i <= end; i++) {
|
|
2897
3362
|
const item = collection.items[parseInt(i.toString(), 10)];
|
|
3363
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
3364
|
+
continue;
|
|
3365
|
+
}
|
|
2898
3366
|
const ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
|
|
2899
3367
|
shrinkEle.appendChild(ele);
|
|
2900
3368
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
@@ -2919,45 +3387,65 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2919
3387
|
if (orientation === ItemOrientation.Column) {
|
|
2920
3388
|
for (let k = (group.collections.length - 1); k > 0; k--) {
|
|
2921
3389
|
//to avoid negative index while checking for the second collection
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
3390
|
+
k = this.checkClassicCollection(group.collections, k, false);
|
|
3391
|
+
let l = k - 1;
|
|
3392
|
+
//Checks the element rendered at position n
|
|
3393
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
|
|
3394
|
+
l = this.checkClassicCollection(group.collections, l, false);
|
|
3395
|
+
//Checks the element rendered at position n-1
|
|
3396
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
|
|
3397
|
+
let m = l - 1;
|
|
3398
|
+
if (m >= 0) {
|
|
3399
|
+
m = this.checkClassicCollection(group.collections, m, false);
|
|
3400
|
+
}
|
|
3401
|
+
//Checks the element rendered at position n-2
|
|
3402
|
+
if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
|
|
3403
|
+
moveCollectionToColumn(m, k);
|
|
2926
3404
|
}
|
|
2927
3405
|
else {
|
|
2928
|
-
moveCollectionToColumn(
|
|
3406
|
+
moveCollectionToColumn(l, k);
|
|
2929
3407
|
}
|
|
2930
|
-
k
|
|
3408
|
+
k = m;
|
|
2931
3409
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
2932
3410
|
return true;
|
|
2933
3411
|
}
|
|
2934
3412
|
}
|
|
2935
3413
|
else {
|
|
2936
|
-
k
|
|
3414
|
+
k = l;
|
|
2937
3415
|
}
|
|
2938
3416
|
}
|
|
2939
3417
|
}
|
|
2940
3418
|
}
|
|
2941
3419
|
else {
|
|
2942
|
-
if (group.collections
|
|
3420
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
2943
3421
|
const collection = group.collections[0];
|
|
2944
3422
|
for (let k = (collection.items.length - 1); k > 0; k--) {
|
|
2945
3423
|
//to avoid negative index while checking for the second item
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
3424
|
+
k = this.checkClassicItem(collection.items, k, false);
|
|
3425
|
+
let l = k - 1;
|
|
3426
|
+
//Checks the element rendered at position n
|
|
3427
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
|
|
3428
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3429
|
+
//Checks the element rendered at position n-1
|
|
3430
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
|
|
3431
|
+
let m = l - 1;
|
|
3432
|
+
//Checks the element rendered at position n-2
|
|
3433
|
+
if (m >= 0) {
|
|
3434
|
+
m = this.checkClassicItem(collection.items, m, false);
|
|
3435
|
+
}
|
|
3436
|
+
if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
|
|
3437
|
+
moveItemToColumn(m, k);
|
|
2950
3438
|
}
|
|
2951
3439
|
else {
|
|
2952
|
-
moveItemToColumn(
|
|
3440
|
+
moveItemToColumn(l, k);
|
|
2953
3441
|
}
|
|
2954
|
-
k
|
|
3442
|
+
k = m;
|
|
2955
3443
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
2956
3444
|
return true;
|
|
2957
3445
|
}
|
|
2958
3446
|
}
|
|
2959
3447
|
else {
|
|
2960
|
-
k
|
|
3448
|
+
k = l;
|
|
2961
3449
|
}
|
|
2962
3450
|
}
|
|
2963
3451
|
}
|
|
@@ -2976,28 +3464,42 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
2976
3464
|
const canReduceItem = (item) => {
|
|
2977
3465
|
return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
|
|
2978
3466
|
};
|
|
2979
|
-
const reduceItemsToSmall = (collectionIndex, start, end) => {
|
|
3467
|
+
const reduceItemsToSmall = (collectionIndex, start, end, middle = null) => {
|
|
2980
3468
|
const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
2981
3469
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
2982
|
-
|
|
3470
|
+
const reduce = (i) => {
|
|
2983
3471
|
const item = collection.items[parseInt(i.toString(), 10)];
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3472
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3473
|
+
const ele = activeContent.querySelector('#' + item.id);
|
|
3474
|
+
item.setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3475
|
+
this.setItemSize(ele, item);
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
reduce(start);
|
|
3479
|
+
if (middle) {
|
|
3480
|
+
reduce(middle);
|
|
2987
3481
|
}
|
|
3482
|
+
reduce(end);
|
|
2988
3483
|
};
|
|
2989
|
-
const reduceCollectionsToSmall = (index, start, end) => {
|
|
3484
|
+
const reduceCollectionsToSmall = (index, start, end, middle = null) => {
|
|
2990
3485
|
const group = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
2991
3486
|
.groups[parseInt(groupIndex.toString(), 10)];
|
|
2992
3487
|
if (!shouldSkip) {
|
|
2993
3488
|
shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
|
|
2994
3489
|
}
|
|
2995
|
-
|
|
3490
|
+
const reduce = (i) => {
|
|
2996
3491
|
const collection = group.collections[parseInt(i.toString(), 10)];
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3492
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
3493
|
+
const ele = activeContent.querySelector('#' + collection.items[0].id);
|
|
3494
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3495
|
+
this.setItemSize(ele, collection.items[0]);
|
|
3496
|
+
}
|
|
3497
|
+
};
|
|
3498
|
+
reduce(start);
|
|
3499
|
+
if (middle) {
|
|
3500
|
+
reduce(middle);
|
|
3000
3501
|
}
|
|
3502
|
+
reduce(end);
|
|
3001
3503
|
};
|
|
3002
3504
|
const setWidth = (id) => {
|
|
3003
3505
|
if (!shouldSkip) {
|
|
@@ -3011,13 +3513,14 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3011
3513
|
const start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
|
|
3012
3514
|
const end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
|
|
3013
3515
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3516
|
+
const l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
|
|
3014
3517
|
if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
|
|
3015
|
-
&& canReduceItem(group.collections[
|
|
3016
|
-
if (
|
|
3518
|
+
&& canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
|
|
3519
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3017
3520
|
reduceCollectionsToSmall(k, start, end);
|
|
3018
3521
|
}
|
|
3019
|
-
else if (canReduceItem(group.collections[parseInt(
|
|
3020
|
-
reduceCollectionsToSmall(k, start, end);
|
|
3522
|
+
else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
|
|
3523
|
+
reduceCollectionsToSmall(k, start, end, l);
|
|
3021
3524
|
}
|
|
3022
3525
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3023
3526
|
return true;
|
|
@@ -3027,16 +3530,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3027
3530
|
}
|
|
3028
3531
|
for (let k = (group.collections.length - 1); k >= 0; k--) {
|
|
3029
3532
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3533
|
+
const classicItems = [];
|
|
3534
|
+
for (let i = 0; i < collection.items.length; i++) {
|
|
3535
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3536
|
+
classicItems.push(i);
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3030
3539
|
//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 (
|
|
3540
|
+
if ((classicItems.length > 1)) {
|
|
3541
|
+
if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
|
|
3542
|
+
if (classicItems.length === 2) {
|
|
3034
3543
|
setWidth(collection.id);
|
|
3035
|
-
reduceItemsToSmall(k, 0, 1);
|
|
3544
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[1]);
|
|
3036
3545
|
}
|
|
3037
|
-
else if (canReduceItem(collection.items[2])) {
|
|
3546
|
+
else if (canReduceItem(collection.items[classicItems[2]])) {
|
|
3038
3547
|
setWidth(collection.id);
|
|
3039
|
-
reduceItemsToSmall(k, 0, 2);
|
|
3548
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
|
|
3040
3549
|
}
|
|
3041
3550
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3042
3551
|
return true;
|
|
@@ -3046,22 +3555,24 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3046
3555
|
}
|
|
3047
3556
|
}
|
|
3048
3557
|
else {
|
|
3049
|
-
if (group.collections
|
|
3558
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
3050
3559
|
if (shrinkColumns.length > 0) {
|
|
3051
3560
|
for (let k = (shrinkColumns.length - 1); k >= 0; k--) {
|
|
3052
3561
|
const shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
|
|
3053
3562
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3054
3563
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3055
3564
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3565
|
+
const collection = group.collections[0];
|
|
3566
|
+
const l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
|
|
3056
3567
|
if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
|
|
3057
|
-
&& canReduceItem(group.collections[0].items[
|
|
3058
|
-
if (
|
|
3568
|
+
&& canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
|
|
3569
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3059
3570
|
setWidth(shrinkColumn.id);
|
|
3060
3571
|
reduceItemsToSmall(0, start, end);
|
|
3061
3572
|
}
|
|
3062
3573
|
else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
|
|
3063
3574
|
setWidth(shrinkColumn.id);
|
|
3064
|
-
reduceItemsToSmall(0, start, end);
|
|
3575
|
+
reduceItemsToSmall(0, start, end, l);
|
|
3065
3576
|
}
|
|
3066
3577
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3067
3578
|
return true;
|
|
@@ -3074,6 +3585,10 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3074
3585
|
for (let k = (group.collections.length - 1); k >= 0; k--) {
|
|
3075
3586
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3076
3587
|
for (let l = (collection.items.length - 1); l >= 0; l--) {
|
|
3588
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3589
|
+
if (l < 0) {
|
|
3590
|
+
continue;
|
|
3591
|
+
}
|
|
3077
3592
|
const item = collection.items[parseInt(l.toString(), 10)];
|
|
3078
3593
|
if (canReduceItem(item)) {
|
|
3079
3594
|
setWidth(item.id);
|
|
@@ -3106,20 +3621,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3106
3621
|
const canExpandItem = (item) => {
|
|
3107
3622
|
return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
|
|
3108
3623
|
};
|
|
3109
|
-
const
|
|
3624
|
+
const expandItemToMedium = (collectionIndex, index, parentEle) => {
|
|
3110
3625
|
const collection = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3111
3626
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
3112
|
-
|
|
3113
|
-
|
|
3627
|
+
const item = collection.items[parseInt(index.toString(), 10)];
|
|
3628
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3114
3629
|
const ele = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
|
|
3115
3630
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3116
3631
|
this.setItemSize(ele, item);
|
|
3117
3632
|
}
|
|
3118
3633
|
};
|
|
3119
|
-
const expandCollectionsToMedium = (
|
|
3634
|
+
const expandCollectionsToMedium = (i) => {
|
|
3120
3635
|
const collections = this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3121
3636
|
.groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3122
|
-
|
|
3637
|
+
const item = collections[parseInt(i.toString(), 10)].items[0];
|
|
3638
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3123
3639
|
const ele = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
|
|
3124
3640
|
collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3125
3641
|
this.setItemSize(ele, collections[parseInt(i.toString(), 10)].items[0]);
|
|
@@ -3127,17 +3643,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3127
3643
|
};
|
|
3128
3644
|
if (orientation === ItemOrientation.Row) {
|
|
3129
3645
|
// collection length is 1, then the it wll be covered in shrinked columns
|
|
3130
|
-
if (group.collections
|
|
3646
|
+
if (!this.checkValidCollectionLength(group.collections)) {
|
|
3131
3647
|
for (let k = 0; k < group.collections.length; k++) {
|
|
3132
3648
|
const collection = group.collections[parseInt(k.toString(), 10)];
|
|
3133
3649
|
for (let l = 0; l < collection.items.length; l++) {
|
|
3650
|
+
l = this.checkClassicItem(collection.items, l, true);
|
|
3651
|
+
if (l === collection.items.length) {
|
|
3652
|
+
continue;
|
|
3653
|
+
}
|
|
3134
3654
|
const item = collection.items[parseInt(l.toString(), 10)];
|
|
3135
3655
|
if (canExpandItem(item)) {
|
|
3136
3656
|
const itemEle = activeContent.querySelector('#' + item.id);
|
|
3137
3657
|
const valString = itemEle.getAttribute('data-medium-width');
|
|
3138
3658
|
const value = valString ? parseInt(valString, 10) : null;
|
|
3139
3659
|
if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3140
|
-
|
|
3660
|
+
expandItemToMedium(k, l, itemEle);
|
|
3141
3661
|
if (!shouldSkip || shouldClear) {
|
|
3142
3662
|
itemEle.removeAttribute('data-medium-width');
|
|
3143
3663
|
}
|
|
@@ -3158,8 +3678,18 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3158
3678
|
const itemEle = activeContent.querySelector('#' + collection.id);
|
|
3159
3679
|
const valString = itemEle.getAttribute('data-medium-width');
|
|
3160
3680
|
const value = valString ? parseInt(valString, 10) : null;
|
|
3161
|
-
|
|
3162
|
-
|
|
3681
|
+
const classicItems = [];
|
|
3682
|
+
for (let i = 0; i < collection.items.length; i++) {
|
|
3683
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3684
|
+
classicItems.push(i);
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3688
|
+
expandItemToMedium(k, classicItems[0], itemEle);
|
|
3689
|
+
expandItemToMedium(k, classicItems[1], itemEle);
|
|
3690
|
+
if (classicItems.length === 3) {
|
|
3691
|
+
expandItemToMedium(k, classicItems[2], itemEle);
|
|
3692
|
+
}
|
|
3163
3693
|
if (!shouldSkip || shouldClear) {
|
|
3164
3694
|
itemEle.removeAttribute('data-medium-width');
|
|
3165
3695
|
}
|
|
@@ -3179,10 +3709,22 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3179
3709
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3180
3710
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3181
3711
|
if (orientation === ItemOrientation.Row) {
|
|
3182
|
-
|
|
3712
|
+
const collection = group.collections[0];
|
|
3713
|
+
const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
3714
|
+
expandItemToMedium(0, start, shrinkColumn);
|
|
3715
|
+
expandItemToMedium(0, l, shrinkColumn);
|
|
3716
|
+
// 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.
|
|
3717
|
+
if (l !== end) {
|
|
3718
|
+
expandItemToMedium(0, end, shrinkColumn);
|
|
3719
|
+
}
|
|
3183
3720
|
}
|
|
3184
3721
|
else {
|
|
3185
|
-
|
|
3722
|
+
const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
3723
|
+
expandCollectionsToMedium(start);
|
|
3724
|
+
expandCollectionsToMedium(m);
|
|
3725
|
+
if (m !== end) {
|
|
3726
|
+
expandCollectionsToMedium(end);
|
|
3727
|
+
}
|
|
3186
3728
|
}
|
|
3187
3729
|
if (!shouldSkip || shouldClear) {
|
|
3188
3730
|
shrinkColumn.removeAttribute('data-medium-width');
|
|
@@ -3203,32 +3745,46 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3203
3745
|
if (shrinkColumns.length === 0) {
|
|
3204
3746
|
return false;
|
|
3205
3747
|
}
|
|
3206
|
-
const expandItemsToLarge = (start, end, parentEle) => {
|
|
3748
|
+
const expandItemsToLarge = (start, end, parentEle, middle) => {
|
|
3207
3749
|
const items = this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3208
3750
|
groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
|
|
3209
|
-
|
|
3751
|
+
const reduce = (i) => {
|
|
3210
3752
|
const item = items[parseInt(i.toString(), 10)];
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3753
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3754
|
+
const container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3755
|
+
const ele = container.querySelector('#' + item.id);
|
|
3756
|
+
item.setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
3757
|
+
this.setItemSize(ele, item);
|
|
3758
|
+
parentEle.insertAdjacentElement('afterend', container);
|
|
3759
|
+
}
|
|
3760
|
+
};
|
|
3761
|
+
reduce(start);
|
|
3762
|
+
if (middle) {
|
|
3763
|
+
reduce(middle);
|
|
3216
3764
|
}
|
|
3765
|
+
reduce(end);
|
|
3217
3766
|
if (!shouldSkip || shouldClear) {
|
|
3218
3767
|
remove(parentEle);
|
|
3219
3768
|
}
|
|
3220
3769
|
};
|
|
3221
|
-
const expandCollectionsToLarge = (start, end, parentEle) => {
|
|
3770
|
+
const expandCollectionsToLarge = (start, end, parentEle, middle) => {
|
|
3222
3771
|
const collections = this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3223
3772
|
groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3224
|
-
|
|
3773
|
+
const reduce = (i) => {
|
|
3225
3774
|
const collection = collections[parseInt(i.toString(), 10)];
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3775
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
3776
|
+
const collectionEle = parentEle.querySelector('#' + collection.id);
|
|
3777
|
+
const ele = collectionEle.querySelector('#' + collection.items[0].id);
|
|
3778
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
3779
|
+
this.setItemSize(ele, collection.items[0]);
|
|
3780
|
+
parentEle.insertAdjacentElement('afterend', collectionEle);
|
|
3781
|
+
}
|
|
3782
|
+
};
|
|
3783
|
+
reduce(start);
|
|
3784
|
+
if (middle) {
|
|
3785
|
+
reduce(middle);
|
|
3231
3786
|
}
|
|
3787
|
+
reduce(end);
|
|
3232
3788
|
if (!shouldSkip || shouldClear) {
|
|
3233
3789
|
remove(parentEle);
|
|
3234
3790
|
}
|
|
@@ -3241,10 +3797,23 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3241
3797
|
const start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3242
3798
|
const end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3243
3799
|
if (orientation === ItemOrientation.Row) {
|
|
3244
|
-
|
|
3800
|
+
const collection = group.collections[0];
|
|
3801
|
+
const l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
3802
|
+
if (l === end) {
|
|
3803
|
+
expandItemsToLarge(start, end, shrinkColumn);
|
|
3804
|
+
}
|
|
3805
|
+
else {
|
|
3806
|
+
expandItemsToLarge(start, end, shrinkColumn, l);
|
|
3807
|
+
}
|
|
3245
3808
|
}
|
|
3246
3809
|
else {
|
|
3247
|
-
|
|
3810
|
+
const m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
3811
|
+
if (m === end) {
|
|
3812
|
+
expandCollectionsToLarge(start, end, shrinkColumn);
|
|
3813
|
+
}
|
|
3814
|
+
else {
|
|
3815
|
+
expandCollectionsToLarge(start, end, shrinkColumn, m);
|
|
3816
|
+
}
|
|
3248
3817
|
}
|
|
3249
3818
|
if (!shouldSkip || shouldClear) {
|
|
3250
3819
|
shrinkColumn.removeAttribute('data-large-width');
|
|
@@ -3300,7 +3869,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3300
3869
|
//Expanding the items in the group to their original expanded state
|
|
3301
3870
|
this.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3302
3871
|
this.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3303
|
-
const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
|
|
3872
|
+
const dropdown = this.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this.enableRtl);
|
|
3304
3873
|
this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3305
3874
|
groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
|
|
3306
3875
|
for (let j = 0; j < group.collections.length; j++) {
|
|
@@ -3309,7 +3878,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3309
3878
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3310
3879
|
const item = collection.items[parseInt(k.toString(), 10)];
|
|
3311
3880
|
const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3312
|
-
|
|
3881
|
+
if (itemEle !== null) {
|
|
3882
|
+
this.addOverflowEvents(item, itemEle, dropdown);
|
|
3883
|
+
}
|
|
3313
3884
|
}
|
|
3314
3885
|
}
|
|
3315
3886
|
}
|
|
@@ -3344,7 +3915,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3344
3915
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3345
3916
|
const item = collection.items[parseInt(k.toString(), 10)];
|
|
3346
3917
|
const itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3347
|
-
|
|
3918
|
+
if (itemEle !== null) {
|
|
3919
|
+
this.removeOverflowEvent(item, itemEle);
|
|
3920
|
+
}
|
|
3348
3921
|
}
|
|
3349
3922
|
}
|
|
3350
3923
|
}
|
|
@@ -3392,6 +3965,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3392
3965
|
}
|
|
3393
3966
|
}
|
|
3394
3967
|
ribbonTabSelecting(e) {
|
|
3968
|
+
this.currentControlIndex = 0;
|
|
3395
3969
|
const nextTabId = e.selectingItem.getAttribute('data-id');
|
|
3396
3970
|
const previousTabId = e.previousItem.getAttribute('data-id');
|
|
3397
3971
|
let nextIndex = getIndex(this.tabs, ((tab) => (tab.id === nextTabId)));
|
|
@@ -3451,7 +4025,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3451
4025
|
id: btnId
|
|
3452
4026
|
});
|
|
3453
4027
|
const overflowTarget = this.createElement('div', {
|
|
3454
|
-
className: RIBBON_OVERFLOW_TARGET
|
|
4028
|
+
className: RIBBON_OVERFLOW_TARGET,
|
|
4029
|
+
attrs: { 'tabindex': '0' }
|
|
3455
4030
|
});
|
|
3456
4031
|
const overflowDDB = new DropDownButton({
|
|
3457
4032
|
iconCss: OVERFLOW_ICON,
|
|
@@ -3469,8 +4044,112 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3469
4044
|
}, overflowButton);
|
|
3470
4045
|
this.element.classList.add(RIBBON_OVERFLOW);
|
|
3471
4046
|
createTooltip(overflowTarget, this);
|
|
4047
|
+
let isGroupOf;
|
|
4048
|
+
overflowButton.onkeydown = overflowButton.onclick = () => { this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
|
|
4049
|
+
overflowTarget.onkeydown = (e) => (this.upDownKeyHandler(e, overflowTarget, isGroupOf), this);
|
|
3472
4050
|
return overflowDDB;
|
|
3473
4051
|
}
|
|
4052
|
+
upDownKeyHandler(e, target, isGroupOf) {
|
|
4053
|
+
let items;
|
|
4054
|
+
if (isGroupOf) {
|
|
4055
|
+
items = target.getElementsByClassName('e-ribbon-item');
|
|
4056
|
+
}
|
|
4057
|
+
else {
|
|
4058
|
+
const currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
|
|
4059
|
+
items = currentList.getElementsByClassName('e-ribbon-item');
|
|
4060
|
+
}
|
|
4061
|
+
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;
|
|
4062
|
+
let ribbonItem;
|
|
4063
|
+
if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
|
|
4064
|
+
if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
|
|
4065
|
+
if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
|
|
4066
|
+
this.itemIndex = 0;
|
|
4067
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4068
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4069
|
+
if (comboBoxEle && e.key === 'Tab') {
|
|
4070
|
+
e.preventDefault();
|
|
4071
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
|
|
4075
|
+
this.itemIndex++;
|
|
4076
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4077
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
|
|
4081
|
+
if (comboBoxEle === null || (e.key === 'Tab')) {
|
|
4082
|
+
if (!this.itemIndex || this.itemIndex === -1) {
|
|
4083
|
+
this.itemIndex = items.length - 1;
|
|
4084
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4085
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4086
|
+
if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
|
|
4087
|
+
e.preventDefault();
|
|
4088
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
|
|
4092
|
+
this.itemIndex--;
|
|
4093
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4094
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
target.setAttribute('index', this.itemIndex.toString());
|
|
4099
|
+
}
|
|
4100
|
+
const currentItemIndex = parseInt(target.getAttribute('index'), 10);
|
|
4101
|
+
const itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
|
|
4102
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
|
|
4103
|
+
if (itemType === 'ColorPicker') {
|
|
4104
|
+
if (e.key === 'Tab') {
|
|
4105
|
+
e.preventDefault();
|
|
4106
|
+
}
|
|
4107
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
|
|
4108
|
+
}
|
|
4109
|
+
else {
|
|
4110
|
+
if (e.key === 'Tab') {
|
|
4111
|
+
e.preventDefault();
|
|
4112
|
+
}
|
|
4113
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4114
|
+
}
|
|
4115
|
+
if (e.key === ' ' && (itemType === 'CheckBox')) {
|
|
4116
|
+
const checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
|
|
4117
|
+
const checkBox = getComponent(checkBoxEle, CheckBox);
|
|
4118
|
+
this.itemIndex = -1;
|
|
4119
|
+
checkBox.click();
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
|
|
4123
|
+
if (e.key === 'ArrowRight') {
|
|
4124
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
|
|
4125
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
|
|
4126
|
+
}
|
|
4127
|
+
if (e.key === 'ArrowLeft') {
|
|
4128
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
|
|
4129
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
if (e.key === 'Enter') {
|
|
4133
|
+
this.itemIndex = -1;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
findDisabledItem(ribbonItem, items, isIncrease) {
|
|
4137
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
4138
|
+
if (isIncrease) {
|
|
4139
|
+
if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4140
|
+
this.itemIndex = -1;
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
else {
|
|
4144
|
+
if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4145
|
+
this.itemIndex = items.length;
|
|
4146
|
+
}
|
|
4147
|
+
}
|
|
4148
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
4149
|
+
isIncrease ? this.itemIndex++ : this.itemIndex--;
|
|
4150
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
3474
4153
|
removeOverflowButton(overflowDDB) {
|
|
3475
4154
|
if (overflowDDB) {
|
|
3476
4155
|
const btnEle = overflowDDB.element;
|
|
@@ -3558,6 +4237,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3558
4237
|
}
|
|
3559
4238
|
}
|
|
3560
4239
|
switchLayout() {
|
|
4240
|
+
this.currentControlIndex = 0;
|
|
3561
4241
|
this.destroyScroll();
|
|
3562
4242
|
this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
|
|
3563
4243
|
this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
|
|
@@ -3572,6 +4252,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3572
4252
|
if (this.activeLayout === 'Simplified') {
|
|
3573
4253
|
for (let i = 0; i < groupList.length; i++) {
|
|
3574
4254
|
const group = groupList[parseInt(i.toString(), 10)];
|
|
4255
|
+
const alignType = groupList[parseInt(i.toString(), 10)].orientation;
|
|
3575
4256
|
if (group.isCollapsed) {
|
|
3576
4257
|
group.setProperties({ isCollapsed: false }, true);
|
|
3577
4258
|
this.removeDropdown(group.id);
|
|
@@ -3599,7 +4280,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3599
4280
|
const itemList = collection.items;
|
|
3600
4281
|
let item = collection.items[parseInt(k.toString(), 10)];
|
|
3601
4282
|
let flag = true;
|
|
3602
|
-
while ((flag) && (item.displayOptions === DisplayMode.
|
|
4283
|
+
while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
|
|
3603
4284
|
k++;
|
|
3604
4285
|
const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3605
4286
|
const ele = itemEle.querySelector('#' + item.id);
|
|
@@ -3615,19 +4296,29 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3615
4296
|
if (!flag) {
|
|
3616
4297
|
break;
|
|
3617
4298
|
}
|
|
3618
|
-
const itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3619
|
-
const ele = itemEle.querySelector('#' + item.id);
|
|
3620
4299
|
let size = ((item.allowedSizes === RibbonItemSize.Large) ||
|
|
3621
4300
|
(item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
4301
|
+
size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
|
|
4302
|
+
? RibbonItemSize.Medium : size;
|
|
4303
|
+
let itemEle;
|
|
4304
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
4305
|
+
itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
|
|
4306
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4307
|
+
groupCollection.append(itemEle);
|
|
3627
4308
|
}
|
|
3628
4309
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
4310
|
+
else {
|
|
4311
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4312
|
+
if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
|
|
4313
|
+
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
|
|
4314
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
4315
|
+
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
item.setProperties({ activeSize: size }, true);
|
|
4319
|
+
const ele = itemEle.querySelector('#' + item.id);
|
|
4320
|
+
this.setItemSize(ele, item);
|
|
4321
|
+
}
|
|
3631
4322
|
}
|
|
3632
4323
|
}
|
|
3633
4324
|
if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
|
|
@@ -3674,22 +4365,37 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3674
4365
|
groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
|
|
3675
4366
|
}
|
|
3676
4367
|
for (let k = 0; k < collection.items.length; k++) {
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
4368
|
+
const itemList = collection.items;
|
|
4369
|
+
let item = collection.items[parseInt(k.toString(), 10)];
|
|
4370
|
+
let flag = true;
|
|
4371
|
+
while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
|
|
4372
|
+
k++;
|
|
4373
|
+
let itemEle;
|
|
4374
|
+
if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
|
|
4375
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4376
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4377
|
+
}
|
|
4378
|
+
else {
|
|
4379
|
+
itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
4380
|
+
}
|
|
4381
|
+
if (itemEle !== null) {
|
|
4382
|
+
const ele = itemEle.querySelector('#' + item.id);
|
|
4383
|
+
this.destroyFunction(item, ele);
|
|
4384
|
+
itemEle.remove();
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
if (k < itemList.length) {
|
|
4388
|
+
item = itemList[parseInt(k.toString(), 10)];
|
|
4389
|
+
}
|
|
4390
|
+
else {
|
|
4391
|
+
flag = false;
|
|
3686
4392
|
}
|
|
3687
|
-
groupCollection.append(itemEle);
|
|
3688
|
-
this.removeOverflowEvent(item, itemEle);
|
|
3689
4393
|
}
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
4394
|
+
if (!flag) {
|
|
4395
|
+
break;
|
|
4396
|
+
}
|
|
4397
|
+
if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
|
|
4398
|
+
const itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
|
|
3693
4399
|
groupCollection.append(itemEle);
|
|
3694
4400
|
}
|
|
3695
4401
|
else {
|
|
@@ -3727,6 +4433,21 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3727
4433
|
this.overflowDDB = null;
|
|
3728
4434
|
}
|
|
3729
4435
|
}
|
|
4436
|
+
createLauncherIcon(groupId, groupContainer) {
|
|
4437
|
+
const launcherIcon = this.createElement('div', {
|
|
4438
|
+
className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
|
|
4439
|
+
id: groupId + LAUNCHER_ID,
|
|
4440
|
+
attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
|
|
4441
|
+
});
|
|
4442
|
+
groupContainer.appendChild(launcherIcon);
|
|
4443
|
+
groupContainer.classList.add(RIBBON_LAUNCHER);
|
|
4444
|
+
EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
|
|
4445
|
+
EventHandler.add(launcherIcon, 'keydown', (e) => {
|
|
4446
|
+
if (e.key === 'Enter') {
|
|
4447
|
+
this.launcherIconClicked(groupId);
|
|
4448
|
+
}
|
|
4449
|
+
}, this);
|
|
4450
|
+
}
|
|
3730
4451
|
launcherIconClicked(id) {
|
|
3731
4452
|
const eventArgs = { groupId: id };
|
|
3732
4453
|
this.trigger('launcherIconClick', eventArgs);
|
|
@@ -3763,19 +4484,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3763
4484
|
groupContainer.appendChild(groupHeader);
|
|
3764
4485
|
}
|
|
3765
4486
|
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);
|
|
4487
|
+
this.createLauncherIcon(group.id, groupContainer);
|
|
3779
4488
|
}
|
|
3780
4489
|
const elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
|
|
3781
4490
|
append(elements, groupContent);
|
|
@@ -3843,13 +4552,40 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3843
4552
|
}
|
|
3844
4553
|
return collectionElements;
|
|
3845
4554
|
}
|
|
4555
|
+
createRibbonItem(item, itemEle) {
|
|
4556
|
+
switch (item.type) {
|
|
4557
|
+
case 'Button':
|
|
4558
|
+
this.ribbonButtonModule.createButton(item, itemEle);
|
|
4559
|
+
break;
|
|
4560
|
+
case 'DropDown':
|
|
4561
|
+
this.ribbonDropDownModule.createDropDown(item, itemEle);
|
|
4562
|
+
break;
|
|
4563
|
+
case 'SplitButton':
|
|
4564
|
+
this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
|
|
4565
|
+
break;
|
|
4566
|
+
case 'CheckBox':
|
|
4567
|
+
this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
|
|
4568
|
+
break;
|
|
4569
|
+
case 'ColorPicker':
|
|
4570
|
+
this.ribbonColorPickerModule.createColorPicker(item, itemEle);
|
|
4571
|
+
break;
|
|
4572
|
+
case 'ComboBox':
|
|
4573
|
+
this.ribbonComboBoxModule.createComboBox(item, itemEle);
|
|
4574
|
+
break;
|
|
4575
|
+
case 'Template':
|
|
4576
|
+
this.createTemplateContent(item, itemEle);
|
|
4577
|
+
break;
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
3846
4580
|
createItems(itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
|
|
3847
4581
|
const itemElements = [];
|
|
3848
4582
|
for (let i = 0; i < itemList.length; i++) {
|
|
3849
4583
|
let item = itemList[parseInt(i.toString(), 10)];
|
|
3850
4584
|
//To stop rendering of items with simplified mode position type as none
|
|
3851
4585
|
let flag = true;
|
|
3852
|
-
while (
|
|
4586
|
+
while (flag &&
|
|
4587
|
+
(((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
|
|
4588
|
+
((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
|
|
3853
4589
|
i++;
|
|
3854
4590
|
if (i < itemList.length) {
|
|
3855
4591
|
item = itemList[parseInt(i.toString(), 10)];
|
|
@@ -3883,30 +4619,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
3883
4619
|
else {
|
|
3884
4620
|
itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
3885
4621
|
}
|
|
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)) {
|
|
4622
|
+
this.createRibbonItem(item, itemEle);
|
|
4623
|
+
if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
|
|
3910
4624
|
this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
|
|
3911
4625
|
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
3912
4626
|
this.updatePopupItems(item, itemEle, isGroupOF, true);
|
|
@@ -4010,13 +4724,15 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4010
4724
|
for (const item of collection.items) {
|
|
4011
4725
|
let ele = null;
|
|
4012
4726
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4013
|
-
|
|
4727
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
4728
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
4729
|
+
}
|
|
4014
4730
|
}
|
|
4015
4731
|
else {
|
|
4016
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
4732
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4017
4733
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4018
4734
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4019
|
-
if (!ele
|
|
4735
|
+
if (!ele) {
|
|
4020
4736
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4021
4737
|
if (item.type === 'DropDown') {
|
|
4022
4738
|
this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
|
|
@@ -4069,15 +4785,17 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4069
4785
|
for (const item of collection.items) {
|
|
4070
4786
|
let ele;
|
|
4071
4787
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4072
|
-
|
|
4073
|
-
|
|
4788
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
4789
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
|
|
4790
|
+
contentEle.querySelector('#' + item.id);
|
|
4791
|
+
}
|
|
4074
4792
|
}
|
|
4075
4793
|
else {
|
|
4076
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
4794
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4077
4795
|
ele = (item.displayOptions & DisplayMode.Simplified) ?
|
|
4078
4796
|
contentEle.querySelector('#' + item.id) : null;
|
|
4079
4797
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4080
|
-
if (!ele
|
|
4798
|
+
if (!ele) {
|
|
4081
4799
|
ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
|
|
4082
4800
|
}
|
|
4083
4801
|
}
|
|
@@ -4493,16 +5211,376 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4493
5211
|
this.refreshLayout();
|
|
4494
5212
|
}
|
|
4495
5213
|
}
|
|
5214
|
+
/**
|
|
5215
|
+
* tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
|
|
5216
|
+
*
|
|
5217
|
+
* @param {RibbonTabModel} tab - Gets the ribbon tab model.
|
|
5218
|
+
* @returns {void}
|
|
5219
|
+
*/
|
|
5220
|
+
updateTab(tab) {
|
|
5221
|
+
const tabId = tab.id;
|
|
5222
|
+
const index = getIndex(this.tabs, (e) => { return e.id === tabId; });
|
|
5223
|
+
if (index === -1) {
|
|
5224
|
+
return;
|
|
5225
|
+
}
|
|
5226
|
+
const contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
|
|
5227
|
+
const groups = this.tabs[parseInt(index.toString(), 10)].groups;
|
|
5228
|
+
const tabEle = this.tabObj.element;
|
|
5229
|
+
if (groups && (contentEle.innerHTML !== '')) {
|
|
5230
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5231
|
+
if (tab.cssClass) {
|
|
5232
|
+
if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
|
|
5233
|
+
contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5234
|
+
tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
// Check whether group is passed by the user, and if it is, then remove the old values.
|
|
5238
|
+
if (tab.groups) {
|
|
5239
|
+
for (const group of groups) {
|
|
5240
|
+
const dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
|
|
5241
|
+
for (const collection of group.collections) {
|
|
5242
|
+
for (const item of collection.items) {
|
|
5243
|
+
const ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
5244
|
+
if (ele) {
|
|
5245
|
+
this.destroyFunction(item, ele);
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5249
|
+
if (dropdownElement) {
|
|
5250
|
+
this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
const groupElements = contentEle.querySelectorAll('.e-ribbon-group');
|
|
5254
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5255
|
+
groupElements.forEach(groupEle => { groupEle.remove(); });
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
if (index === this.selectedTab) {
|
|
5259
|
+
this.isAddRemove = true;
|
|
5260
|
+
}
|
|
5261
|
+
const ribbonTab = this.tabs[parseInt(index.toString(), 10)];
|
|
5262
|
+
ribbonTab.setProperties(tab, true);
|
|
5263
|
+
this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
|
|
5264
|
+
this.validateItemSize();
|
|
5265
|
+
if (contentEle.innerHTML === '') {
|
|
5266
|
+
// Check whether group is passed by the user and sets the updated values.
|
|
5267
|
+
if (tab.groups) {
|
|
5268
|
+
const elements = this.createGroups(ribbonTab.groups, index);
|
|
5269
|
+
append(elements, contentEle);
|
|
5270
|
+
}
|
|
5271
|
+
if (this.selectedTab === index) {
|
|
5272
|
+
this.refreshLayout();
|
|
5273
|
+
}
|
|
5274
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5275
|
+
if (tab.cssClass) {
|
|
5276
|
+
contentEle.classList.add(ribbonTab.cssClass);
|
|
5277
|
+
tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
|
|
5278
|
+
}
|
|
5279
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5280
|
+
if (tab.header) {
|
|
5281
|
+
tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
|
|
5282
|
+
}
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5285
|
+
/**
|
|
5286
|
+
* group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
|
|
5287
|
+
*
|
|
5288
|
+
* @param {RibbonGroupModel} group - Gets the ribbon group model.
|
|
5289
|
+
* @returns {void}
|
|
5290
|
+
*/
|
|
5291
|
+
updateGroup(group) {
|
|
5292
|
+
const groupId = group.id;
|
|
5293
|
+
const itemProp = getGroup(this.tabs, groupId);
|
|
5294
|
+
if (!itemProp) {
|
|
5295
|
+
return;
|
|
5296
|
+
}
|
|
5297
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5298
|
+
this.clearOverflowResize();
|
|
5299
|
+
}
|
|
5300
|
+
//Check whether the tab items are rendered
|
|
5301
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5302
|
+
const groupEle = contentEle.querySelector('#' + groupId);
|
|
5303
|
+
const groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
|
|
5304
|
+
let dropdownElement;
|
|
5305
|
+
let dropdown;
|
|
5306
|
+
if (contentEle.innerHTML !== '') {
|
|
5307
|
+
if (itemProp.group.showLauncherIcon) {
|
|
5308
|
+
this.removeLauncherIcon(itemProp.group.id, null, contentEle);
|
|
5309
|
+
}
|
|
5310
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5311
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5312
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5313
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5314
|
+
}
|
|
5315
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5316
|
+
if (group.cssClass) {
|
|
5317
|
+
if (itemProp.group.cssClass) {
|
|
5318
|
+
groupEle.classList.remove(itemProp.group.cssClass);
|
|
5319
|
+
if (groupContainer) {
|
|
5320
|
+
groupContainer.classList.remove(itemProp.group.cssClass);
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
}
|
|
5324
|
+
// Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
|
|
5325
|
+
if (group.collections || group.orientation) {
|
|
5326
|
+
if (itemProp.group.collections || itemProp.group.orientation) {
|
|
5327
|
+
for (const collection of itemProp.group.collections) {
|
|
5328
|
+
for (const item of collection.items) {
|
|
5329
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
const collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
|
|
5333
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5334
|
+
collectionElements.forEach(collectionEle => { collectionEle.remove(); });
|
|
5335
|
+
if (group.orientation) {
|
|
5336
|
+
const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5337
|
+
const removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
|
|
5338
|
+
if (removeCss) {
|
|
5339
|
+
removeClass([groupContent], removeCss);
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5345
|
+
if (itemProp.group.enableGroupOverflow) {
|
|
5346
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5347
|
+
this.removeOverflowButton(dropdown);
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
else {
|
|
5351
|
+
const ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5352
|
+
if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
|
|
5353
|
+
ofGroupContainer.remove();
|
|
5354
|
+
}
|
|
5355
|
+
const ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
5356
|
+
if (ofTabContainer && ofTabContainer.childElementCount === 0) {
|
|
5357
|
+
ofTabContainer.remove();
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
const ribbongroup = itemProp.group;
|
|
5363
|
+
ribbongroup.setProperties(group, true);
|
|
5364
|
+
ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
|
|
5365
|
+
this.validateItemSize();
|
|
5366
|
+
if (contentEle.innerHTML !== '') {
|
|
5367
|
+
// Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
|
|
5368
|
+
if (group.showLauncherIcon) {
|
|
5369
|
+
this.createLauncherIcon(ribbongroup.id, groupContainer);
|
|
5370
|
+
}
|
|
5371
|
+
// Check whether collections or orientation is passed by the user and sets the updated values.
|
|
5372
|
+
if (group.collections || group.orientation) {
|
|
5373
|
+
const groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5374
|
+
groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
|
|
5375
|
+
const elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5376
|
+
append(elements, groupContent);
|
|
5377
|
+
}
|
|
5378
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5379
|
+
this.refreshLayout();
|
|
5380
|
+
}
|
|
5381
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5382
|
+
if (group.cssClass) {
|
|
5383
|
+
groupEle.classList.add(ribbongroup.cssClass);
|
|
5384
|
+
if (groupContainer) {
|
|
5385
|
+
groupContainer.classList.add(ribbongroup.cssClass);
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5389
|
+
if (group.header) {
|
|
5390
|
+
if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
|
|
5391
|
+
const overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
|
|
5392
|
+
if (overflowHeader) {
|
|
5393
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
|
|
5397
|
+
groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
|
|
5398
|
+
}
|
|
5399
|
+
else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
|
|
5400
|
+
const overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
5401
|
+
// need to set instance for dropdown
|
|
5402
|
+
const dropDownBtn = getInstance(overflowEle, DropDownButton);
|
|
5403
|
+
const overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
|
|
5404
|
+
if (overflowHeader) {
|
|
5405
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
/**
|
|
5412
|
+
* collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
|
|
5413
|
+
*
|
|
5414
|
+
* @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
|
|
5415
|
+
* @returns {void}
|
|
5416
|
+
*/
|
|
5417
|
+
updateCollection(collection) {
|
|
5418
|
+
const collectionId = collection.id;
|
|
5419
|
+
const itemProp = getCollection(this.tabs, collectionId);
|
|
5420
|
+
if (!itemProp) {
|
|
5421
|
+
return;
|
|
5422
|
+
}
|
|
5423
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5424
|
+
this.clearOverflowResize();
|
|
5425
|
+
}
|
|
5426
|
+
//Check whether the tab items are rendered
|
|
5427
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5428
|
+
const collectionEle = contentEle.querySelector('#' + collectionId);
|
|
5429
|
+
if (contentEle.innerHTML !== '') {
|
|
5430
|
+
let dropdownElement;
|
|
5431
|
+
let dropdown;
|
|
5432
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5433
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5434
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5435
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5436
|
+
}
|
|
5437
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5438
|
+
if (collection.cssClass) {
|
|
5439
|
+
if (itemProp.collection.cssClass) {
|
|
5440
|
+
collectionEle.classList.remove(itemProp.collection.cssClass);
|
|
5441
|
+
}
|
|
5442
|
+
}
|
|
5443
|
+
if (collection.items) {
|
|
5444
|
+
if (itemProp.collection.items) {
|
|
5445
|
+
for (const item of itemProp.collection.items) {
|
|
5446
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
}
|
|
5451
|
+
const ribboncollection = itemProp.collection;
|
|
5452
|
+
ribboncollection.setProperties(collection, true);
|
|
5453
|
+
ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
|
|
5454
|
+
this.validateItemSize();
|
|
5455
|
+
if (contentEle.innerHTML !== '') {
|
|
5456
|
+
if (collection.items) {
|
|
5457
|
+
const groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5458
|
+
const elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5459
|
+
append(elements, collectionEle);
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5463
|
+
this.refreshLayout();
|
|
5464
|
+
}
|
|
5465
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5466
|
+
if (collection.cssClass) {
|
|
5467
|
+
collectionEle.classList.add(ribboncollection.cssClass);
|
|
5468
|
+
}
|
|
5469
|
+
}
|
|
5470
|
+
/**
|
|
5471
|
+
* item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
|
|
5472
|
+
*
|
|
5473
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
5474
|
+
* @returns {void}
|
|
5475
|
+
*/
|
|
5476
|
+
updateItem(item) {
|
|
5477
|
+
const itemId = item.id;
|
|
5478
|
+
const itemProp = getItem(this.tabs, itemId);
|
|
5479
|
+
if (!itemProp) {
|
|
5480
|
+
return;
|
|
5481
|
+
}
|
|
5482
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5483
|
+
this.clearOverflowResize();
|
|
5484
|
+
}
|
|
5485
|
+
//Check whether the tab items are rendered
|
|
5486
|
+
const contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5487
|
+
const groupEle = contentEle.querySelector('#' + itemProp.group.id);
|
|
5488
|
+
const groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5489
|
+
let itemContainer = null;
|
|
5490
|
+
let itemEle = null;
|
|
5491
|
+
let dropdownElement;
|
|
5492
|
+
let dropdown;
|
|
5493
|
+
if (contentEle.innerHTML !== '') {
|
|
5494
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5495
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5496
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5497
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5498
|
+
}
|
|
5499
|
+
if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
|
|
5500
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5501
|
+
itemEle = dropdown.target.querySelector('#' + itemId);
|
|
5502
|
+
if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
|
|
5503
|
+
const collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
|
|
5504
|
+
if (collectionEle) {
|
|
5505
|
+
collectionEle.appendChild(itemContainer);
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
}
|
|
5509
|
+
else {
|
|
5510
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5511
|
+
itemEle = contentEle.querySelector('#' + itemId);
|
|
5512
|
+
if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
|
|
5513
|
+
this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
|
|
5514
|
+
if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
|
|
5515
|
+
this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5520
|
+
if (item.cssClass) {
|
|
5521
|
+
if (itemProp.item.cssClass) {
|
|
5522
|
+
itemContainer.classList.remove(itemProp.item.cssClass);
|
|
5523
|
+
}
|
|
5524
|
+
}
|
|
5525
|
+
this.destroyFunction(itemProp.item, itemEle);
|
|
5526
|
+
itemEle.remove();
|
|
5527
|
+
const removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
|
|
5528
|
+
if (removeCss) {
|
|
5529
|
+
removeClass([itemContainer], removeCss);
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
const ribbonItem = itemProp.item;
|
|
5533
|
+
ribbonItem.setProperties(item, true);
|
|
5534
|
+
this.validateItemSize();
|
|
5535
|
+
if (contentEle.innerHTML !== '') {
|
|
5536
|
+
if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
|
|
5537
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5538
|
+
}
|
|
5539
|
+
else {
|
|
5540
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5541
|
+
}
|
|
5542
|
+
// To avoid undefined items condition is added
|
|
5543
|
+
if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
|
|
5544
|
+
itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
|
|
5545
|
+
this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
|
|
5546
|
+
}
|
|
5547
|
+
let size = ribbonItem.activeSize;
|
|
5548
|
+
if (this.activeLayout === 'Simplified') {
|
|
5549
|
+
size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
|
|
5550
|
+
(ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
5551
|
+
ribbonItem.setProperties({ activeSize: size }, true);
|
|
5552
|
+
}
|
|
5553
|
+
if (size & RibbonItemSize.Large) {
|
|
5554
|
+
itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
|
|
5555
|
+
}
|
|
5556
|
+
else {
|
|
5557
|
+
itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
5558
|
+
}
|
|
5559
|
+
this.createRibbonItem(ribbonItem, itemContainer);
|
|
5560
|
+
if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
|
|
5561
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5562
|
+
this.removeOverflowButton(dropdown);
|
|
5563
|
+
}
|
|
5564
|
+
}
|
|
5565
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5566
|
+
this.refreshLayout();
|
|
5567
|
+
}
|
|
5568
|
+
if (item.cssClass) {
|
|
5569
|
+
itemContainer.classList.add(ribbonItem.cssClass);
|
|
5570
|
+
}
|
|
5571
|
+
this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
|
|
5572
|
+
}
|
|
5573
|
+
}
|
|
4496
5574
|
removeItemElement(contentEle, item, dropdown) {
|
|
4497
5575
|
let ele = null;
|
|
4498
5576
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4499
|
-
ele = contentEle.querySelector('#' + item.id);
|
|
5577
|
+
ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
|
|
4500
5578
|
}
|
|
4501
5579
|
else {
|
|
4502
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
5580
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4503
5581
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4504
5582
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4505
|
-
if (!ele
|
|
5583
|
+
if (!ele) {
|
|
4506
5584
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4507
5585
|
}
|
|
4508
5586
|
}
|
|
@@ -4553,6 +5631,8 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4553
5631
|
EventHandler.remove(window, 'resize', this.resizeHandler);
|
|
4554
5632
|
}
|
|
4555
5633
|
destroy() {
|
|
5634
|
+
this.keyboardModuleRibbon.destroy();
|
|
5635
|
+
this.keyboardModuleRibbon = null;
|
|
4556
5636
|
destroyTooltip(this.element);
|
|
4557
5637
|
this.destroyTabItems(this.tabs);
|
|
4558
5638
|
this.removeExpandCollapse();
|
|
@@ -4602,6 +5682,9 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4602
5682
|
case 'isMinimized':
|
|
4603
5683
|
this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
|
|
4604
5684
|
this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
|
|
5685
|
+
if (!this.isMinimized) {
|
|
5686
|
+
this.refreshLayout();
|
|
5687
|
+
}
|
|
4605
5688
|
break;
|
|
4606
5689
|
case 'locale':
|
|
4607
5690
|
this.updateCommonProperty({ locale: this.locale });
|
|
@@ -4625,7 +5708,7 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4625
5708
|
if (group.showLauncherIcon) {
|
|
4626
5709
|
const className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
|
|
4627
5710
|
if (group.isCollapsed) {
|
|
4628
|
-
const element = tabContent.querySelector('
|
|
5711
|
+
const element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
4629
5712
|
const dropdown = getComponent(element, DropDownButton);
|
|
4630
5713
|
const launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
|
|
4631
5714
|
launcherIconEle.className = className;
|
|
@@ -4656,14 +5739,20 @@ let Ribbon = Ribbon_1 = class Ribbon extends Component {
|
|
|
4656
5739
|
if (this.ribbonFileMenuModule) {
|
|
4657
5740
|
this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
|
|
4658
5741
|
}
|
|
5742
|
+
const toolbarEle = this.tabObj['tbObj'];
|
|
5743
|
+
toolbarEle.refreshOverflow();
|
|
4659
5744
|
break;
|
|
4660
5745
|
case 'helpPaneTemplate':
|
|
4661
5746
|
if (this.ribbonTempEle) {
|
|
4662
5747
|
remove(this.ribbonTempEle);
|
|
5748
|
+
this.ribbonTempEle = null;
|
|
5749
|
+
this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
|
|
4663
5750
|
}
|
|
4664
5751
|
if (this.helpPaneTemplate) {
|
|
4665
5752
|
this.createHelpPaneTemplate();
|
|
4666
5753
|
}
|
|
5754
|
+
const toolbar = this.tabObj['tbObj'];
|
|
5755
|
+
toolbar.refreshOverflow();
|
|
4667
5756
|
break;
|
|
4668
5757
|
}
|
|
4669
5758
|
}
|