@syncfusion/ej2-ribbon 21.1.37 → 22.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -0
- package/dist/ej2-ribbon.umd.min.js +2 -2
- package/dist/ej2-ribbon.umd.min.js.map +1 -1
- package/dist/es6/ej2-ribbon.es2015.js +1344 -176
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +1367 -191
- 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 +12 -12
- package/src/ribbon/base/constant.d.ts +2 -0
- package/src/ribbon/base/constant.js +2 -0
- 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 +1082 -169
- package/src/ribbon/base/utils.d.ts +2 -2
- package/src/ribbon/base/utils.js +11 -6
- package/src/ribbon/items/ribbon-button.js +1 -0
- package/src/ribbon/items/ribbon-checkbox.js +1 -0
- package/src/ribbon/items/ribbon-colorpicker.d.ts +7 -0
- package/src/ribbon/items/ribbon-colorpicker.js +41 -3
- package/src/ribbon/items/ribbon-combobox.js +5 -1
- package/src/ribbon/items/ribbon-dropdown.d.ts +7 -1
- package/src/ribbon/items/ribbon-dropdown.js +173 -3
- package/src/ribbon/items/ribbon-splitbutton.js +45 -2
- 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 +62 -12
- package/styles/bootstrap.css +62 -12
- package/styles/bootstrap4.css +62 -12
- package/styles/bootstrap5-dark.css +62 -12
- package/styles/bootstrap5.css +62 -12
- package/styles/fabric-dark.css +62 -12
- package/styles/fabric.css +62 -12
- package/styles/fluent-dark.css +62 -12
- package/styles/fluent.css +62 -12
- package/styles/highcontrast-light.css +62 -12
- package/styles/highcontrast.css +66 -16
- package/styles/material-dark.css +62 -12
- package/styles/material.css +62 -12
- package/styles/material3-dark.css +1671 -0
- package/styles/material3-dark.scss +3 -0
- package/styles/material3.css +1727 -0
- package/styles/material3.scss +3 -0
- package/styles/ribbon/_bootstrap-dark-definition.scss +4 -0
- package/styles/ribbon/_bootstrap-definition.scss +4 -0
- package/styles/ribbon/_bootstrap4-definition.scss +4 -0
- package/styles/ribbon/_bootstrap5-definition.scss +4 -0
- package/styles/ribbon/_fabric-dark-definition.scss +4 -0
- package/styles/ribbon/_fabric-definition.scss +4 -0
- package/styles/ribbon/_fluent-definition.scss +4 -0
- package/styles/ribbon/_fusionnew-definition.scss +4 -0
- package/styles/ribbon/_highcontrast-definition.scss +6 -2
- package/styles/ribbon/_highcontrast-light-definition.scss +4 -0
- package/styles/ribbon/_layout.scss +88 -18
- 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 +62 -12
- package/styles/ribbon/bootstrap.css +62 -12
- package/styles/ribbon/bootstrap4.css +62 -12
- package/styles/ribbon/bootstrap5-dark.css +62 -12
- package/styles/ribbon/bootstrap5.css +62 -12
- package/styles/ribbon/fabric-dark.css +62 -12
- package/styles/ribbon/fabric.css +62 -12
- package/styles/ribbon/fluent-dark.css +62 -12
- package/styles/ribbon/fluent.css +62 -12
- package/styles/ribbon/highcontrast-light.css +62 -12
- package/styles/ribbon/highcontrast.css +66 -16
- package/styles/ribbon/icons/_material3-dark.scss +1 -0
- package/styles/ribbon/material-dark.css +62 -12
- package/styles/ribbon/material.css +62 -12
- package/styles/ribbon/material3-dark.css +1671 -0
- package/styles/ribbon/material3-dark.scss +18 -0
- package/styles/ribbon/material3.css +1727 -0
- package/styles/ribbon/material3.scss +18 -0
- package/styles/ribbon/tailwind-dark.css +62 -12
- package/styles/ribbon/tailwind.css +62 -12
- package/styles/tailwind-dark.css +62 -12
- package/styles/tailwind.css +62 -12
|
@@ -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.
|
|
@@ -1077,6 +1077,8 @@ var DROPDOWNBUTTON = 'e-dropdown-btn';
|
|
|
1077
1077
|
/** @hidden */
|
|
1078
1078
|
var DROPDOWNBUTTON_HIDE = 'e-caret-hide';
|
|
1079
1079
|
/** @hidden */
|
|
1080
|
+
var RIBBON_TEMPLATE = 'e-ribbon-template';
|
|
1081
|
+
/** @hidden */
|
|
1080
1082
|
var RIBBON_HELP_TEMPLATE = 'e-ribbon-help-template';
|
|
1081
1083
|
/** @hidden */
|
|
1082
1084
|
var RIBBON_TOOLTIP = 'e-ribbon-tooltip';
|
|
@@ -1191,6 +1193,7 @@ var RibbonButton = /** @__PURE__ @class */ (function () {
|
|
|
1191
1193
|
RibbonButton.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
1192
1194
|
var _this = this;
|
|
1193
1195
|
var buttonEle = itemEle.querySelector('#' + item.id);
|
|
1196
|
+
buttonEle.setAttribute('data-control', item.type.toString());
|
|
1194
1197
|
var buttonObj = getComponent(buttonEle, Button);
|
|
1195
1198
|
buttonObj.setProperties({ cssClass: buttonObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
1196
1199
|
buttonEle.onclick = function (e) {
|
|
@@ -1338,6 +1341,7 @@ var RibbonCheckBox = /** @__PURE__ @class */ (function () {
|
|
|
1338
1341
|
RibbonCheckBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
1339
1342
|
var _this = this;
|
|
1340
1343
|
var inputEle = itemEle.querySelector('#' + item.id);
|
|
1344
|
+
inputEle.setAttribute('data-control', item.type.toString());
|
|
1341
1345
|
var checkBoxObj = getComponent(inputEle, CheckBox);
|
|
1342
1346
|
checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
1343
1347
|
checkBoxObj.dataBind();
|
|
@@ -1472,8 +1476,16 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
|
|
|
1472
1476
|
select: colorPickerSettings.select
|
|
1473
1477
|
}, inputEle);
|
|
1474
1478
|
var wrapper = colorPicker.element.parentElement;
|
|
1475
|
-
EventHandler.add(wrapper, 'mouseenter',
|
|
1476
|
-
EventHandler.add(wrapper, 'mouseleave',
|
|
1479
|
+
EventHandler.add(wrapper, 'mouseenter', this.toggleWrapperHover.bind(this, wrapper, true), this);
|
|
1480
|
+
EventHandler.add(wrapper, 'mouseleave', this.toggleWrapperHover.bind(this, wrapper, false), this);
|
|
1481
|
+
};
|
|
1482
|
+
RibbonColorPicker.prototype.toggleWrapperHover = function (wrapper, isAdd) {
|
|
1483
|
+
if (isAdd) {
|
|
1484
|
+
wrapper.classList.add(RIBBON_HOVER);
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
wrapper.classList.remove(RIBBON_HOVER);
|
|
1488
|
+
}
|
|
1477
1489
|
};
|
|
1478
1490
|
/**
|
|
1479
1491
|
* Adds the additional event handlers as the item moved into overflow popup.
|
|
@@ -1485,13 +1497,25 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
|
|
|
1485
1497
|
* @hidden
|
|
1486
1498
|
*/
|
|
1487
1499
|
RibbonColorPicker.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
1500
|
+
var _this = this;
|
|
1488
1501
|
var colorPickerEle = itemEle.querySelector('#' + item.id);
|
|
1502
|
+
colorPickerEle.setAttribute('data-control', item.type.toString());
|
|
1489
1503
|
var colorPickerObj = getComponent(colorPickerEle, ColorPicker);
|
|
1490
1504
|
colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
1491
1505
|
//Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
|
|
1492
1506
|
var splitBtn = colorPickerObj['splitBtn'];
|
|
1507
|
+
var target;
|
|
1508
|
+
colorPickerObj.beforeClose = function (e) {
|
|
1509
|
+
target = e.event ? e.event.target : null;
|
|
1510
|
+
colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
|
|
1511
|
+
if (item.colorPickerSettings.beforeClose) {
|
|
1512
|
+
item.colorPickerSettings.beforeClose.call(_this);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1493
1515
|
splitBtn.close = function () {
|
|
1494
|
-
|
|
1516
|
+
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
|
|
1517
|
+
overflowButton.toggle();
|
|
1518
|
+
}
|
|
1495
1519
|
};
|
|
1496
1520
|
};
|
|
1497
1521
|
/**
|
|
@@ -1503,6 +1527,7 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
|
|
|
1503
1527
|
* @hidden
|
|
1504
1528
|
*/
|
|
1505
1529
|
RibbonColorPicker.prototype.removeOverFlowEvents = function (item, itemEle) {
|
|
1530
|
+
var _this = this;
|
|
1506
1531
|
var colorPickerEle = itemEle.querySelector('#' + item.id);
|
|
1507
1532
|
var colorPickerObj = getComponent(colorPickerEle, ColorPicker);
|
|
1508
1533
|
var cssClass = colorPickerObj.cssClass.split(SPACE);
|
|
@@ -1511,6 +1536,12 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
|
|
|
1511
1536
|
var splitBtn = colorPickerObj['splitBtn'];
|
|
1512
1537
|
//Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
|
|
1513
1538
|
splitBtn.close = null;
|
|
1539
|
+
colorPickerObj.beforeClose = function (e) {
|
|
1540
|
+
colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
|
|
1541
|
+
if (item.colorPickerSettings.beforeClose) {
|
|
1542
|
+
item.colorPickerSettings.beforeClose.call(_this);
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1514
1545
|
};
|
|
1515
1546
|
RibbonColorPicker.prototype.getColorPickerObj = function (controlId) {
|
|
1516
1547
|
var inputEle = getItemElement(this.parent, controlId);
|
|
@@ -1566,6 +1597,17 @@ var RibbonColorPicker = /** @__PURE__ @class */ (function () {
|
|
|
1566
1597
|
var colorPickerObj = getComponent(inputEle, ColorPicker);
|
|
1567
1598
|
colorPickerObj.setProperties(prop);
|
|
1568
1599
|
};
|
|
1600
|
+
/**
|
|
1601
|
+
* @param {HTMLElement} element - Gets the colorpicker element to be destroyed.
|
|
1602
|
+
* @returns {void}
|
|
1603
|
+
* @hidden
|
|
1604
|
+
*/
|
|
1605
|
+
RibbonColorPicker.prototype.unwireColorPickerEvents = function (element) {
|
|
1606
|
+
var colorPickerObj = getComponent(element, ColorPicker);
|
|
1607
|
+
var wrapper = colorPickerObj.element.parentElement;
|
|
1608
|
+
EventHandler.remove(wrapper, 'mouseenter', this.toggleWrapperHover);
|
|
1609
|
+
EventHandler.remove(wrapper, 'mouseleave', this.toggleWrapperHover);
|
|
1610
|
+
};
|
|
1569
1611
|
return RibbonColorPicker;
|
|
1570
1612
|
}());
|
|
1571
1613
|
|
|
@@ -1651,13 +1693,17 @@ var RibbonComboBox = /** @__PURE__ @class */ (function () {
|
|
|
1651
1693
|
RibbonComboBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
1652
1694
|
var _this = this;
|
|
1653
1695
|
var inputEle = itemEle.querySelector('#' + item.id);
|
|
1696
|
+
inputEle.setAttribute('data-control', item.type.toString());
|
|
1654
1697
|
var comboBoxObj = getComponent(inputEle, ComboBox);
|
|
1655
1698
|
comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
1656
1699
|
comboBoxObj.close = function (e) {
|
|
1700
|
+
var target = e.event ? e.event.target : null;
|
|
1657
1701
|
if (item.comboBoxSettings.close) {
|
|
1658
1702
|
item.comboBoxSettings.close.call(_this, e);
|
|
1659
1703
|
}
|
|
1660
|
-
|
|
1704
|
+
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
|
|
1705
|
+
overflowButton.toggle();
|
|
1706
|
+
}
|
|
1661
1707
|
};
|
|
1662
1708
|
};
|
|
1663
1709
|
/**
|
|
@@ -1792,7 +1838,11 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1792
1838
|
iconCss: dropDownSettings.iconCss,
|
|
1793
1839
|
items: dropDownSettings.items,
|
|
1794
1840
|
target: dropDownSettings.target,
|
|
1795
|
-
beforeClose:
|
|
1841
|
+
beforeClose: function (e) {
|
|
1842
|
+
if (dropDownSettings.beforeClose) {
|
|
1843
|
+
dropDownSettings.beforeClose.call(_this, e);
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1796
1846
|
beforeItemRender: dropDownSettings.beforeItemRender,
|
|
1797
1847
|
beforeOpen: dropDownSettings.beforeOpen,
|
|
1798
1848
|
close: function (e) {
|
|
@@ -1817,14 +1867,24 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1817
1867
|
RibbonDropDown.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
1818
1868
|
var _this = this;
|
|
1819
1869
|
var dropdownElement = itemEle.querySelector('#' + item.id);
|
|
1870
|
+
dropdownElement.setAttribute('data-control', item.type.toString());
|
|
1820
1871
|
var dropdown = getComponent(dropdownElement, DropDownButton);
|
|
1821
1872
|
dropdown.cssClass = dropdown.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
1822
1873
|
dropdown.dataBind();
|
|
1874
|
+
var target;
|
|
1875
|
+
dropdown.beforeClose = function (e) {
|
|
1876
|
+
if (item.dropDownSettings.beforeClose) {
|
|
1877
|
+
item.dropDownSettings.beforeClose.call(_this, e);
|
|
1878
|
+
}
|
|
1879
|
+
target = e.event ? e.event.target : null;
|
|
1880
|
+
};
|
|
1823
1881
|
dropdown.close = function (e) {
|
|
1824
1882
|
if (item.dropDownSettings.close) {
|
|
1825
1883
|
item.dropDownSettings.close.call(_this, e);
|
|
1826
1884
|
}
|
|
1827
|
-
|
|
1885
|
+
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
|
|
1886
|
+
overflowButton.toggle();
|
|
1887
|
+
}
|
|
1828
1888
|
};
|
|
1829
1889
|
};
|
|
1830
1890
|
/**
|
|
@@ -1848,6 +1908,11 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1848
1908
|
item.dropDownSettings.close.call(_this, e);
|
|
1849
1909
|
}
|
|
1850
1910
|
};
|
|
1911
|
+
dropdown.beforeClose = function (e) {
|
|
1912
|
+
if (item.dropDownSettings.beforeClose) {
|
|
1913
|
+
item.dropDownSettings.beforeClose.call(_this, e);
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1851
1916
|
};
|
|
1852
1917
|
/**
|
|
1853
1918
|
* Creates Overflow DropDown.
|
|
@@ -1860,10 +1925,13 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1860
1925
|
* @returns {void}
|
|
1861
1926
|
* @hidden
|
|
1862
1927
|
*/
|
|
1863
|
-
RibbonDropDown.prototype.createOverFlowDropDown = function (id, name, iconCss, groupEle, overflowEle) {
|
|
1928
|
+
RibbonDropDown.prototype.createOverFlowDropDown = function (id, name, iconCss, groupEle, overflowEle, enableRtl) {
|
|
1929
|
+
var _this = this;
|
|
1930
|
+
this.enableRtl = enableRtl;
|
|
1864
1931
|
var buttonEle = this.parent.createElement('button', {
|
|
1865
1932
|
id: id + OVERFLOW_ID + DROPDOWN_ID
|
|
1866
1933
|
});
|
|
1934
|
+
groupEle.setAttribute('tabindex', '0');
|
|
1867
1935
|
overflowEle.appendChild(buttonEle);
|
|
1868
1936
|
var dropdown = new DropDownButton({
|
|
1869
1937
|
iconCss: iconCss,
|
|
@@ -1879,8 +1947,155 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1879
1947
|
}
|
|
1880
1948
|
}, buttonEle);
|
|
1881
1949
|
createTooltip(groupEle, this.parent);
|
|
1950
|
+
buttonEle.onclick = buttonEle.onkeydown = function () { _this.itemIndex = 0; };
|
|
1951
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1952
|
+
groupEle.onkeydown = function (e) { _this.keyActionHandler(e, groupEle), _this; };
|
|
1882
1953
|
return dropdown;
|
|
1883
1954
|
};
|
|
1955
|
+
RibbonDropDown.prototype.keyActionHandler = function (e, target) {
|
|
1956
|
+
var items = target.querySelectorAll('.e-control');
|
|
1957
|
+
var comboBoxElements = target.querySelectorAll('.e-combobox');
|
|
1958
|
+
var comboBoxEle;
|
|
1959
|
+
if (comboBoxElements) {
|
|
1960
|
+
for (var i = 0; i < comboBoxElements.length; i++) {
|
|
1961
|
+
if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
1962
|
+
comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
if (comboBoxEle) {
|
|
1967
|
+
for (var i = 0; i < items.length; i++) {
|
|
1968
|
+
if (items[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
|
|
1969
|
+
if (items[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
1970
|
+
this.itemIndex = i;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
1976
|
+
e.target.classList.contains('e-ribbon-last-item') || e.target.classList.contains('e-ribbon-first-item')) {
|
|
1977
|
+
if (e.key === 'ArrowRight' || (!e.shiftKey && e.key === 'Tab')) {
|
|
1978
|
+
this.handleNavigation(e, !this.enableRtl, items);
|
|
1979
|
+
}
|
|
1980
|
+
if (e.key === 'ArrowLeft' || (e.shiftKey && e.key === 'Tab')) {
|
|
1981
|
+
this.handleNavigation(e, this.enableRtl, items);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
};
|
|
1985
|
+
RibbonDropDown.prototype.handleNavigation = function (e, enableRtl, items) {
|
|
1986
|
+
if (!(items[0].classList.contains('e-ribbon-first-item'))) {
|
|
1987
|
+
items[0].classList.add('e-ribbon-first-item');
|
|
1988
|
+
}
|
|
1989
|
+
if (!(items[items.length - 1].classList.contains('e-ribbon-last-item'))) {
|
|
1990
|
+
items[items.length - 1].classList.add('e-ribbon-last-item');
|
|
1991
|
+
}
|
|
1992
|
+
if (enableRtl) {
|
|
1993
|
+
if (this.itemIndex === 0 && items[parseInt(this.itemIndex.toString(), 10)].classList.contains('e-ribbon-first-item')) {
|
|
1994
|
+
this.updateItemIndex(e, items, true);
|
|
1995
|
+
}
|
|
1996
|
+
if (!e.target.classList.contains('e-combobox') && !e.target.classList.contains('e-ribbon-last-item') &&
|
|
1997
|
+
!e.target.classList.contains('e-ribbon-group-container') && (e.target.classList.contains('e-ribbon-first-item')
|
|
1998
|
+
|| this.itemIndex !== 0) && e.target.classList.contains('e-control')) {
|
|
1999
|
+
this.itemIndex++;
|
|
2000
|
+
this.updateItemIndex(e, items, true);
|
|
2001
|
+
}
|
|
2002
|
+
if (e.target.classList.contains('e-ribbon-last-item')) {
|
|
2003
|
+
var launcherIcon = false;
|
|
2004
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
2005
|
+
if (!launcherIcon) {
|
|
2006
|
+
this.itemIndex = 0;
|
|
2007
|
+
this.updateItemIndex(e, items, true);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
2011
|
+
this.itemIndex = 0;
|
|
2012
|
+
this.updateItemIndex(e, items, true);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
else {
|
|
2016
|
+
if (!e.target.classList.contains('e-combobox') && this.itemIndex !== 0) {
|
|
2017
|
+
this.itemIndex--;
|
|
2018
|
+
this.updateItemIndex(e, items, false);
|
|
2019
|
+
}
|
|
2020
|
+
if (e.target.classList.contains('e-ribbon-first-item')) {
|
|
2021
|
+
var launcherIcon = false;
|
|
2022
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
2023
|
+
if (!launcherIcon) {
|
|
2024
|
+
this.itemIndex = items.length - 1;
|
|
2025
|
+
this.updateItemIndex(e, items, false);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
2029
|
+
this.itemIndex = items.length - 1;
|
|
2030
|
+
this.updateItemIndex(e, items, false);
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
if (e.target.classList.contains('e-combobox') && (e.key === 'Tab')) {
|
|
2034
|
+
if (enableRtl) {
|
|
2035
|
+
if (this.itemIndex < items.length - 1) {
|
|
2036
|
+
this.itemIndex++;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
else {
|
|
2040
|
+
if (this.itemIndex > 0) {
|
|
2041
|
+
this.itemIndex--;
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
RibbonDropDown.prototype.focusLauncherIcon = function (e, items) {
|
|
2047
|
+
var groupContainer = items[parseInt(this.itemIndex.toString(), 10)].closest('.e-ribbon-group-container');
|
|
2048
|
+
var launcherIconEle;
|
|
2049
|
+
if (groupContainer) {
|
|
2050
|
+
launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
2051
|
+
}
|
|
2052
|
+
if (launcherIconEle) {
|
|
2053
|
+
if (e.key === 'Tab') {
|
|
2054
|
+
e.preventDefault();
|
|
2055
|
+
}
|
|
2056
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
2057
|
+
return true;
|
|
2058
|
+
}
|
|
2059
|
+
else {
|
|
2060
|
+
return false;
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
RibbonDropDown.prototype.updateItemIndex = function (e, items, enableRtl) {
|
|
2064
|
+
var ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
2065
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
2066
|
+
if (enableRtl) {
|
|
2067
|
+
if (this.itemIndex < items.length - 1) {
|
|
2068
|
+
this.itemIndex++;
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
var launcherIcon = false;
|
|
2072
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
2073
|
+
if (launcherIcon) {
|
|
2074
|
+
break;
|
|
2075
|
+
}
|
|
2076
|
+
this.itemIndex = 0;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
else {
|
|
2080
|
+
if (this.itemIndex > 0) {
|
|
2081
|
+
this.itemIndex--;
|
|
2082
|
+
}
|
|
2083
|
+
else {
|
|
2084
|
+
var launcherIcon = false;
|
|
2085
|
+
launcherIcon = this.focusLauncherIcon(e, items);
|
|
2086
|
+
if (launcherIcon) {
|
|
2087
|
+
break;
|
|
2088
|
+
}
|
|
2089
|
+
this.itemIndex = items.length - 1;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
2093
|
+
}
|
|
2094
|
+
if (e.key === 'Tab') {
|
|
2095
|
+
e.preventDefault();
|
|
2096
|
+
}
|
|
2097
|
+
items[parseInt(this.itemIndex.toString(), 10)].focus();
|
|
2098
|
+
};
|
|
1884
2099
|
/**
|
|
1885
2100
|
* Removes Overflow DropDown.
|
|
1886
2101
|
*
|
|
@@ -1983,6 +2198,7 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
|
|
|
1983
2198
|
control.cssClass = prop.cssClass;
|
|
1984
2199
|
}
|
|
1985
2200
|
delete prop.close;
|
|
2201
|
+
delete prop.beforeClose;
|
|
1986
2202
|
if (prop.content) {
|
|
1987
2203
|
prop.content = itemProp.item.activeSize === RibbonItemSize.Small ? '' : prop.content;
|
|
1988
2204
|
}
|
|
@@ -2053,7 +2269,11 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2053
2269
|
iconCss: splitButtonSettings.iconCss,
|
|
2054
2270
|
items: splitButtonSettings.items,
|
|
2055
2271
|
target: splitButtonSettings.target,
|
|
2056
|
-
beforeClose:
|
|
2272
|
+
beforeClose: function (e) {
|
|
2273
|
+
if (splitButtonSettings.beforeClose) {
|
|
2274
|
+
splitButtonSettings.beforeClose.call(_this, e);
|
|
2275
|
+
}
|
|
2276
|
+
},
|
|
2057
2277
|
beforeItemRender: splitButtonSettings.beforeItemRender,
|
|
2058
2278
|
beforeOpen: splitButtonSettings.beforeOpen,
|
|
2059
2279
|
close: function () {
|
|
@@ -2076,6 +2296,13 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2076
2296
|
}
|
|
2077
2297
|
}
|
|
2078
2298
|
}, buttonEle);
|
|
2299
|
+
var dropdownEle = buttonEle.parentElement.querySelector('.e-dropdown-btn');
|
|
2300
|
+
dropdownEle.onkeydown = function (e) {
|
|
2301
|
+
if (e.key === 'Enter') {
|
|
2302
|
+
e.stopImmediatePropagation();
|
|
2303
|
+
dropdownEle.click();
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2079
2306
|
this.setContent(item, splitbutton);
|
|
2080
2307
|
var wrapper = splitbutton['wrapper'];
|
|
2081
2308
|
EventHandler.add(wrapper, 'mouseenter', function () { wrapper.classList.add(RIBBON_HOVER); }, this);
|
|
@@ -2093,9 +2320,33 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2093
2320
|
RibbonSplitButton.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
|
|
2094
2321
|
var _this = this;
|
|
2095
2322
|
var splitButtonEle = itemEle.querySelector('#' + item.id);
|
|
2323
|
+
splitButtonEle.setAttribute('data-control', item.type.toString());
|
|
2096
2324
|
var splitbutton = getComponent(splitButtonEle, SplitButton);
|
|
2097
2325
|
splitbutton.cssClass = splitbutton.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
2098
2326
|
splitbutton.dataBind();
|
|
2327
|
+
var dropdownEle = splitButtonEle.parentElement.querySelector('.e-dropdown-btn');
|
|
2328
|
+
var ddbId = dropdownEle.getAttribute('id');
|
|
2329
|
+
var popupEle = document.querySelector('#' + ddbId + '-popup');
|
|
2330
|
+
dropdownEle.onkeydown = function (e) {
|
|
2331
|
+
if (e.key === 'Enter') {
|
|
2332
|
+
e.stopImmediatePropagation();
|
|
2333
|
+
dropdownEle.click();
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
popupEle.onkeydown = function (e) {
|
|
2337
|
+
if (e.key === 'Enter') {
|
|
2338
|
+
e.preventDefault();
|
|
2339
|
+
splitbutton['wrapper'].classList.remove('e-ribbon-open');
|
|
2340
|
+
popupEle.querySelector('.e-focused').click();
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
var target;
|
|
2344
|
+
splitbutton.beforeClose = function (e) {
|
|
2345
|
+
if (item.splitButtonSettings.beforeClose) {
|
|
2346
|
+
item.splitButtonSettings.beforeClose.call(_this, e);
|
|
2347
|
+
}
|
|
2348
|
+
target = e.event ? e.event.target : null;
|
|
2349
|
+
};
|
|
2099
2350
|
splitbutton.click = function (e) {
|
|
2100
2351
|
if (item.splitButtonSettings.click) {
|
|
2101
2352
|
item.splitButtonSettings.click.call(_this, e);
|
|
@@ -2107,7 +2358,9 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2107
2358
|
item.splitButtonSettings.close.call(_this, e);
|
|
2108
2359
|
}
|
|
2109
2360
|
splitbutton['wrapper'].classList.remove(RIBBON_POPUP_OPEN);
|
|
2110
|
-
|
|
2361
|
+
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
|
|
2362
|
+
overflowButton.toggle();
|
|
2363
|
+
}
|
|
2111
2364
|
};
|
|
2112
2365
|
};
|
|
2113
2366
|
/**
|
|
@@ -2126,6 +2379,11 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2126
2379
|
cssClass = cssClass.filter(function (value) { return value !== RIBBON_POPUP_CONTROL; });
|
|
2127
2380
|
splitbutton.cssClass = cssClass.join(SPACE);
|
|
2128
2381
|
splitbutton.dataBind();
|
|
2382
|
+
splitbutton.beforeClose = function (e) {
|
|
2383
|
+
if (item.splitButtonSettings.beforeClose) {
|
|
2384
|
+
item.splitButtonSettings.beforeClose.call(_this, e);
|
|
2385
|
+
}
|
|
2386
|
+
};
|
|
2129
2387
|
splitbutton.click = function (e) {
|
|
2130
2388
|
if (item.splitButtonSettings.click) {
|
|
2131
2389
|
item.splitButtonSettings.click.call(_this, e);
|
|
@@ -2205,6 +2463,7 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
|
|
|
2205
2463
|
delete prop.open;
|
|
2206
2464
|
delete prop.click;
|
|
2207
2465
|
delete prop.close;
|
|
2466
|
+
delete prop.beforeClose;
|
|
2208
2467
|
control.setProperties(prop);
|
|
2209
2468
|
if (prop.content) {
|
|
2210
2469
|
this.setContent(itemProp.item, control);
|
|
@@ -2253,7 +2512,7 @@ function getIndex(arr, condition) {
|
|
|
2253
2512
|
/**
|
|
2254
2513
|
* Gets template content based on the template property value.
|
|
2255
2514
|
*
|
|
2256
|
-
* @param {string | HTMLElement} template - Template property value.
|
|
2515
|
+
* @param {string | HTMLElement| Function} template - Template property value.
|
|
2257
2516
|
* @returns {Function} - Return template function.
|
|
2258
2517
|
* @hidden
|
|
2259
2518
|
*/
|
|
@@ -2414,16 +2673,21 @@ function getItemElement(parent, id, itemProp) {
|
|
|
2414
2673
|
return null;
|
|
2415
2674
|
}
|
|
2416
2675
|
if (parent.activeLayout === RibbonLayout.Classic) {
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2676
|
+
if (itemProp.item.displayOptions & DisplayMode.Classic) {
|
|
2677
|
+
contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
|
|
2678
|
+
: contentEle;
|
|
2679
|
+
return contentEle.querySelector('#' + id);
|
|
2680
|
+
}
|
|
2681
|
+
else {
|
|
2682
|
+
return null;
|
|
2683
|
+
}
|
|
2420
2684
|
}
|
|
2421
2685
|
else {
|
|
2422
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
2686
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
2423
2687
|
var ele = (itemProp.item.displayOptions & DisplayMode.Simplified) ?
|
|
2424
2688
|
contentEle.querySelector('#' + itemProp.item.id) : null;
|
|
2425
2689
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
2426
|
-
if (!ele
|
|
2690
|
+
if (!ele) {
|
|
2427
2691
|
var dropdown = itemProp.group.enableGroupOverflow ?
|
|
2428
2692
|
getComponent(contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID), DropDownButton)
|
|
2429
2693
|
: parent.overflowDDB;
|
|
@@ -2583,6 +2847,12 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2583
2847
|
this.idIndex = 0;
|
|
2584
2848
|
this.tooltipData = [];
|
|
2585
2849
|
this.isAddRemove = false;
|
|
2850
|
+
this.keyConfigs = {
|
|
2851
|
+
leftarrow: 'leftarrow',
|
|
2852
|
+
rightarrow: 'rightarrow',
|
|
2853
|
+
tab: 'tab',
|
|
2854
|
+
shiftTab: 'shift+tab'
|
|
2855
|
+
};
|
|
2586
2856
|
};
|
|
2587
2857
|
/**
|
|
2588
2858
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -2624,12 +2894,239 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2624
2894
|
this.ribbonFileMenuModule.createFileMenu(this.fileMenu);
|
|
2625
2895
|
}
|
|
2626
2896
|
this.createHelpPaneTemplate();
|
|
2897
|
+
var toolbar = this.tabObj['tbObj'];
|
|
2898
|
+
toolbar.refreshOverflow();
|
|
2627
2899
|
createTooltip(this.element, this);
|
|
2628
2900
|
this.wireEvents();
|
|
2901
|
+
this.wireKeyboardEvent();
|
|
2902
|
+
this.currentControlIndex = 0;
|
|
2629
2903
|
};
|
|
2630
2904
|
Ribbon.prototype.wireEvents = function () {
|
|
2631
2905
|
EventHandler.add(window, 'resize', this.resizeHandler, this);
|
|
2632
2906
|
};
|
|
2907
|
+
Ribbon.prototype.wireKeyboardEvent = function () {
|
|
2908
|
+
this.keyboardModuleRibbon = new KeyboardEvents(this.element, {
|
|
2909
|
+
keyAction: this.keyActionHandler.bind(this),
|
|
2910
|
+
keyConfigs: this.keyConfigs,
|
|
2911
|
+
eventName: 'keydown'
|
|
2912
|
+
});
|
|
2913
|
+
};
|
|
2914
|
+
Ribbon.prototype.keyActionHandler = function (e) {
|
|
2915
|
+
if (((e.key === 'Tab') && (!(e.target.classList.contains('e-tab-wrap')) && !(e.target.classList.contains('e-combobox'))))) {
|
|
2916
|
+
e.preventDefault();
|
|
2917
|
+
}
|
|
2918
|
+
var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2919
|
+
var ribbonControls = activeContent.querySelectorAll('.e-control');
|
|
2920
|
+
var comboBoxElements = activeContent.querySelectorAll('.e-combobox');
|
|
2921
|
+
var comboBoxEle;
|
|
2922
|
+
if (comboBoxElements) {
|
|
2923
|
+
for (var i = 0; i < comboBoxElements.length; i++) {
|
|
2924
|
+
if (comboBoxElements[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2925
|
+
comboBoxEle = comboBoxElements[parseInt(i.toString(), 10)];
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
if (comboBoxEle) {
|
|
2930
|
+
for (var i = 0; i < ribbonControls.length; i++) {
|
|
2931
|
+
if (ribbonControls[parseInt(i.toString(), 10)].classList.contains('e-combobox')) {
|
|
2932
|
+
if (ribbonControls[parseInt(i.toString(), 10)].closest('.e-input-focus')) {
|
|
2933
|
+
this.currentControlIndex = i;
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
if (this.currentControlIndex === 0) {
|
|
2939
|
+
var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2940
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
2941
|
+
this.currentControlIndex++;
|
|
2942
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
if (e.target.classList.contains('e-control') || e.target.classList.contains('e-ribbon-launcher-icon') ||
|
|
2946
|
+
e.target.classList.contains('e-ribbon-collapse-btn') || e.target.classList.contains('e-ribbon-last-item') ||
|
|
2947
|
+
e.target.classList.contains('e-ribbon-first-item') || e.target.classList.contains('e-ribbon-group-of-btn') ||
|
|
2948
|
+
e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
2949
|
+
switch (e.action) {
|
|
2950
|
+
case 'rightarrow':
|
|
2951
|
+
this.handleNavigation(e, !this.enableRtl, ribbonControls);
|
|
2952
|
+
break;
|
|
2953
|
+
case 'leftarrow':
|
|
2954
|
+
this.handleNavigation(e, this.enableRtl, ribbonControls);
|
|
2955
|
+
break;
|
|
2956
|
+
case 'tab':
|
|
2957
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2958
|
+
if (this.currentControlIndex < ribbonControls.length - 1) {
|
|
2959
|
+
this.currentControlIndex++;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
break;
|
|
2963
|
+
case 'shiftTab':
|
|
2964
|
+
if (e.target.classList.contains('e-combobox')) {
|
|
2965
|
+
if (this.currentControlIndex > 0) {
|
|
2966
|
+
this.currentControlIndex--;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
else {
|
|
2970
|
+
this.tabObj.element.querySelector('.e-toolbar-item.e-active').querySelector('.e-tab-wrap').focus();
|
|
2971
|
+
this.currentControlIndex = 0;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
};
|
|
2976
|
+
Ribbon.prototype.handleNavigation = function (e, enableRtl, ribbonControls) {
|
|
2977
|
+
var groupContainer;
|
|
2978
|
+
var prevGroupId;
|
|
2979
|
+
if (enableRtl) {
|
|
2980
|
+
if (this.currentControlIndex < ribbonControls.length - 1 && ribbonControls[this.currentControlIndex + 1].classList.contains('e-colorpicker')) {
|
|
2981
|
+
this.currentControlIndex++;
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
else {
|
|
2985
|
+
if (this.currentControlIndex > 0 && ribbonControls[this.currentControlIndex - 1].classList.contains('e-colorpicker')) {
|
|
2986
|
+
this.currentControlIndex--;
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
if ((!enableRtl && (this.currentControlIndex > 0)) || (enableRtl && (this.currentControlIndex < ribbonControls.length - 1))) {
|
|
2990
|
+
if (!e.target.classList.contains('e-combobox') && e.target.classList.contains('e-control') && !e.target.classList.contains('e-ribbon-last-item')) {
|
|
2991
|
+
if (enableRtl) {
|
|
2992
|
+
this.currentControlIndex++;
|
|
2993
|
+
}
|
|
2994
|
+
else {
|
|
2995
|
+
var prevGroupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
2996
|
+
if (prevGroupContainer) {
|
|
2997
|
+
prevGroupId = prevGroupContainer.getAttribute('id');
|
|
2998
|
+
}
|
|
2999
|
+
this.currentControlIndex--;
|
|
3000
|
+
}
|
|
3001
|
+
var item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3002
|
+
while (item && item.classList.contains('e-disabled')) {
|
|
3003
|
+
if (((enableRtl && this.currentControlIndex === ribbonControls.length - 1) ||
|
|
3004
|
+
(!enableRtl && this.currentControlIndex === 0))) {
|
|
3005
|
+
if (ribbonControls[this.currentControlIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
3006
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
3007
|
+
break;
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
3011
|
+
enableRtl ? this.currentControlIndex++ : this.currentControlIndex--;
|
|
3012
|
+
item = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3013
|
+
}
|
|
3014
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3015
|
+
if (this.activeLayout === 'Classic') {
|
|
3016
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
3017
|
+
if (enableRtl) {
|
|
3018
|
+
var launcherIconEle = void 0;
|
|
3019
|
+
if (groupContainer) {
|
|
3020
|
+
launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
3021
|
+
}
|
|
3022
|
+
if (launcherIconEle) {
|
|
3023
|
+
var items = groupContainer.querySelectorAll('.e-ribbon-item');
|
|
3024
|
+
items[items.length - 1].querySelector('.e-control').classList.add('e-ribbon-last-item');
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
else {
|
|
3028
|
+
if (groupContainer) {
|
|
3029
|
+
var groupContainerId = groupContainer.getAttribute('id');
|
|
3030
|
+
if (prevGroupId !== groupContainerId) {
|
|
3031
|
+
var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
3032
|
+
if (launcherIconEle) {
|
|
3033
|
+
ribbonControls[parseInt((this.currentControlIndex + 1).toString(), 10)].classList.add('e-ribbon-first-item');
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
else {
|
|
3040
|
+
if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-first-item')) {
|
|
3041
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-first-item');
|
|
3042
|
+
}
|
|
3043
|
+
else if (ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
3044
|
+
ribbonControls[parseInt((this.currentControlIndex).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
else {
|
|
3050
|
+
if (this.activeLayout === 'Classic') {
|
|
3051
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
3052
|
+
}
|
|
3053
|
+
if (this.activeLayout === 'Simplified') {
|
|
3054
|
+
var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
3055
|
+
if (enableRtl && (overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
3056
|
+
overflowButton.focus();
|
|
3057
|
+
}
|
|
3058
|
+
else {
|
|
3059
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
if (e.target.classList.contains('e-ribbon-last-item')) {
|
|
3064
|
+
if (enableRtl) {
|
|
3065
|
+
groupContainer = ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
3066
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
3067
|
+
}
|
|
3068
|
+
else {
|
|
3069
|
+
this.currentControlIndex--;
|
|
3070
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
if (!enableRtl && e.target.classList.contains('e-ribbon-first-item')) {
|
|
3074
|
+
groupContainer = ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].closest('.' + RIBBON_GROUP_CONTAINER);
|
|
3075
|
+
var launcherIconEle = groupContainer.querySelector('.e-ribbon-launcher-icon');
|
|
3076
|
+
if (launcherIconEle) {
|
|
3077
|
+
groupContainer.querySelector('.e-ribbon-launcher-icon').focus();
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
if (e.target.classList.contains('e-ribbon-launcher-icon')) {
|
|
3081
|
+
if (enableRtl) {
|
|
3082
|
+
this.currentControlIndex++;
|
|
3083
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3084
|
+
if (ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.contains('e-ribbon-last-item')) {
|
|
3085
|
+
ribbonControls[parseInt((this.currentControlIndex - 1).toString(), 10)].classList.remove('e-ribbon-last-item');
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
else {
|
|
3089
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
3090
|
+
this.currentControlIndex;
|
|
3091
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
if (e.target.classList.contains('e-ribbon-collapse-btn')) {
|
|
3095
|
+
if (enableRtl) {
|
|
3096
|
+
this.currentControlIndex = 0;
|
|
3097
|
+
var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3098
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
3099
|
+
this.currentControlIndex++;
|
|
3100
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3101
|
+
}
|
|
3102
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3103
|
+
}
|
|
3104
|
+
else {
|
|
3105
|
+
var overflowButton = this.tabObj.element.querySelector('.e-ribbon-overall-of-btn');
|
|
3106
|
+
if ((overflowButton && !overflowButton.classList.contains('e-ribbon-hide'))) {
|
|
3107
|
+
overflowButton.focus();
|
|
3108
|
+
}
|
|
3109
|
+
else {
|
|
3110
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
3111
|
+
var ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3112
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
3113
|
+
this.currentControlIndex--;
|
|
3114
|
+
ribbonItem = ribbonControls[this.currentControlIndex].closest('.e-ribbon-item');
|
|
3115
|
+
}
|
|
3116
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
if (this.activeLayout === 'Simplified' && e.target.classList.contains('e-ribbon-overall-of-btn')) {
|
|
3121
|
+
if (enableRtl) {
|
|
3122
|
+
this.tabObj.element.querySelector('.e-ribbon-collapse-btn').focus();
|
|
3123
|
+
}
|
|
3124
|
+
else {
|
|
3125
|
+
this.currentControlIndex = ribbonControls.length - 1;
|
|
3126
|
+
ribbonControls[parseInt(this.currentControlIndex.toString(), 10)].focus();
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
};
|
|
2633
3130
|
Ribbon.prototype.resizeHandler = function () {
|
|
2634
3131
|
var activeContent = this.tabObj.element.querySelector('#' + this.tabs[this.selectedTab].id + CONTENT_ID);
|
|
2635
3132
|
this.checkOverflow(this.selectedTab, activeContent);
|
|
@@ -2702,7 +3199,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2702
3199
|
selectedIndex = selectedIndex === -1 ? this.selectedTab : selectedIndex;
|
|
2703
3200
|
var eventArgs = { previousIndex: this.selectedTab, selectedIndex: selectedIndex };
|
|
2704
3201
|
this.setProperties({ selectedTab: selectedIndex }, true);
|
|
2705
|
-
this.checkOverflow(selectedIndex, e.selectedContent);
|
|
3202
|
+
this.checkOverflow(selectedIndex, e.selectedContent.firstChild);
|
|
2706
3203
|
if (this.activeLayout === 'Simplified' && this.overflowDDB) {
|
|
2707
3204
|
var overflowTarget = this.overflowDDB.target;
|
|
2708
3205
|
var ofTabContainer = overflowTarget.querySelector('.' + RIBBON_TAB_ACTIVE);
|
|
@@ -2721,9 +3218,6 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2721
3218
|
this.trigger('tabSelected', eventArgs);
|
|
2722
3219
|
};
|
|
2723
3220
|
Ribbon.prototype.checkOverflow = function (tabIndex, activeContent) {
|
|
2724
|
-
if (!activeContent) {
|
|
2725
|
-
activeContent = this.tabObj.element.querySelector('#' + this.tabs[parseInt(tabIndex.toString(), 10)].id + CONTENT_ID);
|
|
2726
|
-
}
|
|
2727
3221
|
var tabContent = activeContent.closest('.' + TAB_CONTENT);
|
|
2728
3222
|
var isOverFlow = tabContent.offsetWidth < activeContent.offsetWidth;
|
|
2729
3223
|
if (isOverFlow && !this.scrollModule) {
|
|
@@ -2835,7 +3329,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2835
3329
|
for (var k = collection.items.length; ((k >= 1) && (tabContent.offsetWidth < activeContent.offsetWidth)); k--) {
|
|
2836
3330
|
var item = collection.items[k - 1];
|
|
2837
3331
|
var itemContainer = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
2838
|
-
if ((item.displayOptions ===
|
|
3332
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3333
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2839
3334
|
itemContainer.setAttribute('data-simplified-width', activeContent.offsetWidth.toString());
|
|
2840
3335
|
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemContainer, groupContainer);
|
|
2841
3336
|
if (item.activeSize === RibbonItemSize.Small) {
|
|
@@ -2906,7 +3401,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2906
3401
|
if (overflowtarget) {
|
|
2907
3402
|
itemContainer = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
2908
3403
|
}
|
|
2909
|
-
if ((item.displayOptions ===
|
|
3404
|
+
if (((item.displayOptions === DisplayMode.Auto) ||
|
|
3405
|
+
(item.displayOptions === (DisplayMode.Simplified | DisplayMode.Overflow))) && !isNullOrUndefined(itemContainer)) {
|
|
2910
3406
|
var width = parseInt(itemContainer.getAttribute('data-simplified-width'), 10);
|
|
2911
3407
|
if (!isClear && (tabContent.offsetWidth < width)) {
|
|
2912
3408
|
flag = false;
|
|
@@ -2996,7 +3492,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
2996
3492
|
}
|
|
2997
3493
|
overflowButton = this.overflowDDB;
|
|
2998
3494
|
}
|
|
2999
|
-
|
|
3495
|
+
if (itemEle !== null) {
|
|
3496
|
+
this.addOverflowEvents(item, itemEle, overflowButton);
|
|
3497
|
+
}
|
|
3000
3498
|
};
|
|
3001
3499
|
Ribbon.prototype.addOverflowEvents = function (item, itemEle, overflowButton) {
|
|
3002
3500
|
switch (item.type) {
|
|
@@ -3045,6 +3543,50 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3045
3543
|
}
|
|
3046
3544
|
return isBreak;
|
|
3047
3545
|
};
|
|
3546
|
+
Ribbon.prototype.checkValidCollectionLength = function (collections) {
|
|
3547
|
+
var count = 0;
|
|
3548
|
+
for (var i = 0; i < collections.length; i++) {
|
|
3549
|
+
var items = collections[parseInt(i.toString(), 10)].items;
|
|
3550
|
+
for (var ind = 0; ind < items.length; ind++) {
|
|
3551
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3552
|
+
count++;
|
|
3553
|
+
break;
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
if (count > 1) {
|
|
3557
|
+
return false;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
return count === 1;
|
|
3561
|
+
};
|
|
3562
|
+
Ribbon.prototype.checkClassicCollection = function (collections, n, isIncrement) {
|
|
3563
|
+
var items = collections[parseInt(n.toString(), 10)].items;
|
|
3564
|
+
for (var ind = 0; ind < items.length; ind++) {
|
|
3565
|
+
if (items[parseInt(ind.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3566
|
+
return n;
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3570
|
+
if (isIncrement) {
|
|
3571
|
+
return (n === collections.length) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3572
|
+
}
|
|
3573
|
+
else {
|
|
3574
|
+
return (n < 0) ? n : this.checkClassicCollection(collections, n, isIncrement);
|
|
3575
|
+
}
|
|
3576
|
+
};
|
|
3577
|
+
Ribbon.prototype.checkClassicItem = function (items, n, isIncrement) {
|
|
3578
|
+
var item = items[parseInt(n.toString(), 10)];
|
|
3579
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3580
|
+
return n;
|
|
3581
|
+
}
|
|
3582
|
+
n = isIncrement ? n + 1 : n - 1;
|
|
3583
|
+
if (isIncrement) {
|
|
3584
|
+
return (n === items.length) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3585
|
+
}
|
|
3586
|
+
else {
|
|
3587
|
+
return (n < 0) ? n : this.checkClassicItem(items, n, isIncrement);
|
|
3588
|
+
}
|
|
3589
|
+
};
|
|
3048
3590
|
Ribbon.prototype.checkLargeToMedium = function (tabIndex, tab, groupIndex, tabContent, activeContent, shouldSkip) {
|
|
3049
3591
|
var _this = this;
|
|
3050
3592
|
if (shouldSkip === void 0) { shouldSkip = false; }
|
|
@@ -3078,6 +3620,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3078
3620
|
createShrinkEle(collection.id, firstItem, start, end);
|
|
3079
3621
|
for (var i = start; i <= end; i++) {
|
|
3080
3622
|
var item = collection.items[parseInt(i.toString(), 10)];
|
|
3623
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
3624
|
+
continue;
|
|
3625
|
+
}
|
|
3081
3626
|
var ele = activeContent.querySelector('#' + item.id + CONTAINER_ID);
|
|
3082
3627
|
shrinkEle.appendChild(ele);
|
|
3083
3628
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
@@ -3102,45 +3647,65 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3102
3647
|
if (orientation === ItemOrientation.Column) {
|
|
3103
3648
|
for (var k = (group.collections.length - 1); k > 0; k--) {
|
|
3104
3649
|
//to avoid negative index while checking for the second collection
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3650
|
+
k = this.checkClassicCollection(group.collections, k, false);
|
|
3651
|
+
var l = k - 1;
|
|
3652
|
+
//Checks the element rendered at position n
|
|
3653
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(k.toString(), 10)])) {
|
|
3654
|
+
l = this.checkClassicCollection(group.collections, l, false);
|
|
3655
|
+
//Checks the element rendered at position n-1
|
|
3656
|
+
if ((l >= 0) && canReduceCollection(group.collections[parseInt(l.toString(), 10)])) {
|
|
3657
|
+
var m = l - 1;
|
|
3658
|
+
if (m >= 0) {
|
|
3659
|
+
m = this.checkClassicCollection(group.collections, m, false);
|
|
3660
|
+
}
|
|
3661
|
+
//Checks the element rendered at position n-2
|
|
3662
|
+
if ((m >= 0) && canReduceCollection(group.collections[parseInt(m.toString(), 10)])) {
|
|
3663
|
+
moveCollectionToColumn(m, k);
|
|
3109
3664
|
}
|
|
3110
3665
|
else {
|
|
3111
|
-
moveCollectionToColumn(
|
|
3666
|
+
moveCollectionToColumn(l, k);
|
|
3112
3667
|
}
|
|
3113
|
-
k
|
|
3668
|
+
k = m;
|
|
3114
3669
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3115
3670
|
return true;
|
|
3116
3671
|
}
|
|
3117
3672
|
}
|
|
3118
3673
|
else {
|
|
3119
|
-
k
|
|
3674
|
+
k = l;
|
|
3120
3675
|
}
|
|
3121
3676
|
}
|
|
3122
3677
|
}
|
|
3123
3678
|
}
|
|
3124
3679
|
else {
|
|
3125
|
-
if (group.collections
|
|
3680
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
3126
3681
|
var collection = group.collections[0];
|
|
3127
3682
|
for (var k = (collection.items.length - 1); k > 0; k--) {
|
|
3128
3683
|
//to avoid negative index while checking for the second item
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3684
|
+
k = this.checkClassicItem(collection.items, k, false);
|
|
3685
|
+
var l = k - 1;
|
|
3686
|
+
//Checks the element rendered at position n
|
|
3687
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(k.toString(), 10)])) {
|
|
3688
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3689
|
+
//Checks the element rendered at position n-1
|
|
3690
|
+
if ((l >= 0) && canReduceItem(collection.items[parseInt(l.toString(), 10)])) {
|
|
3691
|
+
var m = l - 1;
|
|
3692
|
+
//Checks the element rendered at position n-2
|
|
3693
|
+
if (m >= 0) {
|
|
3694
|
+
m = this.checkClassicItem(collection.items, m, false);
|
|
3695
|
+
}
|
|
3696
|
+
if ((m >= 0) && canReduceItem(collection.items[parseInt(m.toString(), 10)])) {
|
|
3697
|
+
moveItemToColumn(m, k);
|
|
3133
3698
|
}
|
|
3134
3699
|
else {
|
|
3135
|
-
moveItemToColumn(
|
|
3700
|
+
moveItemToColumn(l, k);
|
|
3136
3701
|
}
|
|
3137
|
-
k
|
|
3702
|
+
k = m;
|
|
3138
3703
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3139
3704
|
return true;
|
|
3140
3705
|
}
|
|
3141
3706
|
}
|
|
3142
3707
|
else {
|
|
3143
|
-
k
|
|
3708
|
+
k = l;
|
|
3144
3709
|
}
|
|
3145
3710
|
}
|
|
3146
3711
|
}
|
|
@@ -3161,28 +3726,44 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3161
3726
|
var canReduceItem = function (item) {
|
|
3162
3727
|
return (item.allowedSizes & RibbonItemSize.Small) && (item.activeSize === RibbonItemSize.Medium);
|
|
3163
3728
|
};
|
|
3164
|
-
var reduceItemsToSmall = function (collectionIndex, start, end) {
|
|
3729
|
+
var reduceItemsToSmall = function (collectionIndex, start, end, middle) {
|
|
3730
|
+
if (middle === void 0) { middle = null; }
|
|
3165
3731
|
var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3166
3732
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
3167
|
-
|
|
3733
|
+
var reduce = function (i) {
|
|
3168
3734
|
var item = collection.items[parseInt(i.toString(), 10)];
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3735
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3736
|
+
var ele_1 = activeContent.querySelector('#' + item.id);
|
|
3737
|
+
item.setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3738
|
+
_this.setItemSize(ele_1, item);
|
|
3739
|
+
}
|
|
3740
|
+
};
|
|
3741
|
+
reduce(start);
|
|
3742
|
+
if (middle) {
|
|
3743
|
+
reduce(middle);
|
|
3172
3744
|
}
|
|
3745
|
+
reduce(end);
|
|
3173
3746
|
};
|
|
3174
|
-
var reduceCollectionsToSmall = function (index, start, end) {
|
|
3747
|
+
var reduceCollectionsToSmall = function (index, start, end, middle) {
|
|
3748
|
+
if (middle === void 0) { middle = null; }
|
|
3175
3749
|
var group = _this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3176
3750
|
.groups[parseInt(groupIndex.toString(), 10)];
|
|
3177
3751
|
if (!shouldSkip) {
|
|
3178
3752
|
shrinkColumns[parseInt(index.toString(), 10)].setAttribute('data-medium-width', activeContent.offsetWidth.toString());
|
|
3179
3753
|
}
|
|
3180
|
-
|
|
3754
|
+
var reduce = function (i) {
|
|
3181
3755
|
var collection = group.collections[parseInt(i.toString(), 10)];
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3756
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
3757
|
+
var ele_2 = activeContent.querySelector('#' + collection.items[0].id);
|
|
3758
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Small }, true);
|
|
3759
|
+
_this.setItemSize(ele_2, collection.items[0]);
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
reduce(start);
|
|
3763
|
+
if (middle) {
|
|
3764
|
+
reduce(middle);
|
|
3185
3765
|
}
|
|
3766
|
+
reduce(end);
|
|
3186
3767
|
};
|
|
3187
3768
|
var setWidth = function (id) {
|
|
3188
3769
|
if (!shouldSkip) {
|
|
@@ -3196,13 +3777,14 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3196
3777
|
var start = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-start'), 10);
|
|
3197
3778
|
var end = parseInt(shrinkColumns[parseInt(k.toString(), 10)].getAttribute('data-end'), 10);
|
|
3198
3779
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3780
|
+
var l = this.checkClassicCollection(group.collections, start + 1, false); //next valid item
|
|
3199
3781
|
if (canReduceItem(group.collections[parseInt(start.toString(), 10)].items[0])
|
|
3200
|
-
&& canReduceItem(group.collections[
|
|
3201
|
-
if (
|
|
3782
|
+
&& canReduceItem(group.collections[parseInt(l.toString(), 10)].items[0])) {
|
|
3783
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3202
3784
|
reduceCollectionsToSmall(k, start, end);
|
|
3203
3785
|
}
|
|
3204
|
-
else if (canReduceItem(group.collections[parseInt(
|
|
3205
|
-
reduceCollectionsToSmall(k, start, end);
|
|
3786
|
+
else if (canReduceItem(group.collections[parseInt(end.toString(), 10)].items[0])) {
|
|
3787
|
+
reduceCollectionsToSmall(k, start, end, l);
|
|
3206
3788
|
}
|
|
3207
3789
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3208
3790
|
return true;
|
|
@@ -3212,16 +3794,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3212
3794
|
}
|
|
3213
3795
|
for (var k = (group.collections.length - 1); k >= 0; k--) {
|
|
3214
3796
|
var collection = group.collections[parseInt(k.toString(), 10)];
|
|
3797
|
+
var classicItems = [];
|
|
3798
|
+
for (var i = 0; i < collection.items.length; i++) {
|
|
3799
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3800
|
+
classicItems.push(i);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3215
3803
|
//If items length is 1 then, it would have been already check for shrinked column
|
|
3216
|
-
if ((
|
|
3217
|
-
if (canReduceItem(collection.items[0]) && canReduceItem(collection.items[1])) {
|
|
3218
|
-
if (
|
|
3804
|
+
if ((classicItems.length > 1)) {
|
|
3805
|
+
if (canReduceItem(collection.items[classicItems[0]]) && canReduceItem(collection.items[classicItems[1]])) {
|
|
3806
|
+
if (classicItems.length === 2) {
|
|
3219
3807
|
setWidth(collection.id);
|
|
3220
|
-
reduceItemsToSmall(k, 0, 1);
|
|
3808
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[1]);
|
|
3221
3809
|
}
|
|
3222
|
-
else if (canReduceItem(collection.items[2])) {
|
|
3810
|
+
else if (canReduceItem(collection.items[classicItems[2]])) {
|
|
3223
3811
|
setWidth(collection.id);
|
|
3224
|
-
reduceItemsToSmall(k, 0, 2);
|
|
3812
|
+
reduceItemsToSmall(k, classicItems[0], classicItems[2], classicItems[1]);
|
|
3225
3813
|
}
|
|
3226
3814
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3227
3815
|
return true;
|
|
@@ -3231,22 +3819,24 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3231
3819
|
}
|
|
3232
3820
|
}
|
|
3233
3821
|
else {
|
|
3234
|
-
if (group.collections
|
|
3822
|
+
if (this.checkValidCollectionLength(group.collections)) {
|
|
3235
3823
|
if (shrinkColumns.length > 0) {
|
|
3236
3824
|
for (var k = (shrinkColumns.length - 1); k >= 0; k--) {
|
|
3237
3825
|
var shrinkColumn = shrinkColumns[parseInt(k.toString(), 10)];
|
|
3238
3826
|
var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3239
3827
|
var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3240
3828
|
//only 2 or 3 itmes alone can be present in shrinked column
|
|
3829
|
+
var collection = group.collections[0];
|
|
3830
|
+
var l = this.checkClassicItem(collection.items, start + 1, false); //next valid item
|
|
3241
3831
|
if (canReduceItem(group.collections[0].items[parseInt(start.toString(), 10)])
|
|
3242
|
-
&& canReduceItem(group.collections[0].items[
|
|
3243
|
-
if (
|
|
3832
|
+
&& canReduceItem(group.collections[0].items[parseInt(l.toString(), 10)])) {
|
|
3833
|
+
if (end === l) { //if only 2 item, then next valid item will be the end item, else check for 3 rd item satus.
|
|
3244
3834
|
setWidth(shrinkColumn.id);
|
|
3245
3835
|
reduceItemsToSmall(0, start, end);
|
|
3246
3836
|
}
|
|
3247
3837
|
else if (canReduceItem(group.collections[0].items[parseInt(end.toString(), 10)])) {
|
|
3248
3838
|
setWidth(shrinkColumn.id);
|
|
3249
|
-
reduceItemsToSmall(0, start, end);
|
|
3839
|
+
reduceItemsToSmall(0, start, end, l);
|
|
3250
3840
|
}
|
|
3251
3841
|
if (!shouldSkip && (tabContent.offsetWidth > activeContent.offsetWidth)) {
|
|
3252
3842
|
return true;
|
|
@@ -3259,6 +3849,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3259
3849
|
for (var k = (group.collections.length - 1); k >= 0; k--) {
|
|
3260
3850
|
var collection = group.collections[parseInt(k.toString(), 10)];
|
|
3261
3851
|
for (var l = (collection.items.length - 1); l >= 0; l--) {
|
|
3852
|
+
l = this.checkClassicItem(collection.items, l, false);
|
|
3853
|
+
if (l < 0) {
|
|
3854
|
+
continue;
|
|
3855
|
+
}
|
|
3262
3856
|
var item = collection.items[parseInt(l.toString(), 10)];
|
|
3263
3857
|
if (canReduceItem(item)) {
|
|
3264
3858
|
setWidth(item.id);
|
|
@@ -3292,20 +3886,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3292
3886
|
var canExpandItem = function (item) {
|
|
3293
3887
|
return (item.allowedSizes & RibbonItemSize.Medium) && (item.activeSize === RibbonItemSize.Small);
|
|
3294
3888
|
};
|
|
3295
|
-
var
|
|
3889
|
+
var expandItemToMedium = function (collectionIndex, index, parentEle) {
|
|
3296
3890
|
var collection = _this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3297
3891
|
.groups[parseInt(groupIndex.toString(), 10)].collections[parseInt(collectionIndex.toString(), 10)];
|
|
3298
|
-
|
|
3299
|
-
|
|
3892
|
+
var item = collection.items[parseInt(index.toString(), 10)];
|
|
3893
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3300
3894
|
var ele_4 = parentEle.id === item.id ? parentEle : parentEle.querySelector('#' + item.id);
|
|
3301
3895
|
item.setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3302
3896
|
_this.setItemSize(ele_4, item);
|
|
3303
3897
|
}
|
|
3304
3898
|
};
|
|
3305
|
-
var expandCollectionsToMedium = function (
|
|
3899
|
+
var expandCollectionsToMedium = function (i) {
|
|
3306
3900
|
var collections = _this.tabs[parseInt(tabIndex.toString(), 10)]
|
|
3307
3901
|
.groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3308
|
-
|
|
3902
|
+
var item = collections[parseInt(i.toString(), 10)].items[0];
|
|
3903
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
3309
3904
|
var ele_5 = activeContent.querySelector('#' + collections[parseInt(i.toString(), 10)].items[0].id);
|
|
3310
3905
|
collections[parseInt(i.toString(), 10)].items[0].setProperties({ activeSize: RibbonItemSize.Medium }, true);
|
|
3311
3906
|
_this.setItemSize(ele_5, collections[parseInt(i.toString(), 10)].items[0]);
|
|
@@ -3313,17 +3908,21 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3313
3908
|
};
|
|
3314
3909
|
if (orientation === ItemOrientation.Row) {
|
|
3315
3910
|
// collection length is 1, then the it wll be covered in shrinked columns
|
|
3316
|
-
if (group.collections
|
|
3911
|
+
if (!this.checkValidCollectionLength(group.collections)) {
|
|
3317
3912
|
for (var k = 0; k < group.collections.length; k++) {
|
|
3318
3913
|
var collection = group.collections[parseInt(k.toString(), 10)];
|
|
3319
3914
|
for (var l = 0; l < collection.items.length; l++) {
|
|
3915
|
+
l = this.checkClassicItem(collection.items, l, true);
|
|
3916
|
+
if (l === collection.items.length) {
|
|
3917
|
+
continue;
|
|
3918
|
+
}
|
|
3320
3919
|
var item = collection.items[parseInt(l.toString(), 10)];
|
|
3321
3920
|
if (canExpandItem(item)) {
|
|
3322
3921
|
var itemEle = activeContent.querySelector('#' + item.id);
|
|
3323
3922
|
var valString = itemEle.getAttribute('data-medium-width');
|
|
3324
3923
|
var value = valString ? parseInt(valString, 10) : null;
|
|
3325
3924
|
if (value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3326
|
-
|
|
3925
|
+
expandItemToMedium(k, l, itemEle);
|
|
3327
3926
|
if (!shouldSkip || shouldClear) {
|
|
3328
3927
|
itemEle.removeAttribute('data-medium-width');
|
|
3329
3928
|
}
|
|
@@ -3344,8 +3943,18 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3344
3943
|
var itemEle = activeContent.querySelector('#' + collection.id);
|
|
3345
3944
|
var valString = itemEle.getAttribute('data-medium-width');
|
|
3346
3945
|
var value = valString ? parseInt(valString, 10) : null;
|
|
3347
|
-
|
|
3348
|
-
|
|
3946
|
+
var classicItems = [];
|
|
3947
|
+
for (var i = 0; i < collection.items.length; i++) {
|
|
3948
|
+
if (collection.items[parseInt(i.toString(), 10)].displayOptions & DisplayMode.Classic) {
|
|
3949
|
+
classicItems.push(i);
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
if ((classicItems.length > 1) && value && (shouldSkip || (tabContent.offsetWidth > value))) {
|
|
3953
|
+
expandItemToMedium(k, classicItems[0], itemEle);
|
|
3954
|
+
expandItemToMedium(k, classicItems[1], itemEle);
|
|
3955
|
+
if (classicItems.length === 3) {
|
|
3956
|
+
expandItemToMedium(k, classicItems[2], itemEle);
|
|
3957
|
+
}
|
|
3349
3958
|
if (!shouldSkip || shouldClear) {
|
|
3350
3959
|
itemEle.removeAttribute('data-medium-width');
|
|
3351
3960
|
}
|
|
@@ -3365,10 +3974,22 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3365
3974
|
var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3366
3975
|
var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3367
3976
|
if (orientation === ItemOrientation.Row) {
|
|
3368
|
-
|
|
3977
|
+
var collection = group.collections[0];
|
|
3978
|
+
var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
3979
|
+
expandItemToMedium(0, start, shrinkColumn);
|
|
3980
|
+
expandItemToMedium(0, l, shrinkColumn);
|
|
3981
|
+
// 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.
|
|
3982
|
+
if (l !== end) {
|
|
3983
|
+
expandItemToMedium(0, end, shrinkColumn);
|
|
3984
|
+
}
|
|
3369
3985
|
}
|
|
3370
3986
|
else {
|
|
3371
|
-
|
|
3987
|
+
var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
3988
|
+
expandCollectionsToMedium(start);
|
|
3989
|
+
expandCollectionsToMedium(m);
|
|
3990
|
+
if (m !== end) {
|
|
3991
|
+
expandCollectionsToMedium(end);
|
|
3992
|
+
}
|
|
3372
3993
|
}
|
|
3373
3994
|
if (!shouldSkip || shouldClear) {
|
|
3374
3995
|
shrinkColumn.removeAttribute('data-medium-width');
|
|
@@ -3390,32 +4011,46 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3390
4011
|
if (shrinkColumns.length === 0) {
|
|
3391
4012
|
return false;
|
|
3392
4013
|
}
|
|
3393
|
-
var expandItemsToLarge = function (start, end, parentEle) {
|
|
4014
|
+
var expandItemsToLarge = function (start, end, parentEle, middle) {
|
|
3394
4015
|
var items = _this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3395
4016
|
groups[parseInt(groupIndex.toString(), 10)].collections[0].items;
|
|
3396
|
-
|
|
4017
|
+
var reduce = function (i) {
|
|
3397
4018
|
var item = items[parseInt(i.toString(), 10)];
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
4019
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
4020
|
+
var container = parentEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
4021
|
+
var ele_6 = container.querySelector('#' + item.id);
|
|
4022
|
+
item.setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
4023
|
+
_this.setItemSize(ele_6, item);
|
|
4024
|
+
parentEle.insertAdjacentElement('afterend', container);
|
|
4025
|
+
}
|
|
4026
|
+
};
|
|
4027
|
+
reduce(start);
|
|
4028
|
+
if (middle) {
|
|
4029
|
+
reduce(middle);
|
|
3403
4030
|
}
|
|
4031
|
+
reduce(end);
|
|
3404
4032
|
if (!shouldSkip || shouldClear) {
|
|
3405
4033
|
remove(parentEle);
|
|
3406
4034
|
}
|
|
3407
4035
|
};
|
|
3408
|
-
var expandCollectionsToLarge = function (start, end, parentEle) {
|
|
4036
|
+
var expandCollectionsToLarge = function (start, end, parentEle, middle) {
|
|
3409
4037
|
var collections = _this.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3410
4038
|
groups[parseInt(groupIndex.toString(), 10)].collections;
|
|
3411
|
-
|
|
4039
|
+
var reduce = function (i) {
|
|
3412
4040
|
var collection = collections[parseInt(i.toString(), 10)];
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
4041
|
+
if (collection.items[0].displayOptions & DisplayMode.Classic) {
|
|
4042
|
+
var collectionEle = parentEle.querySelector('#' + collection.id);
|
|
4043
|
+
var ele_7 = collectionEle.querySelector('#' + collection.items[0].id);
|
|
4044
|
+
collection.items[0].setProperties({ activeSize: RibbonItemSize.Large }, true);
|
|
4045
|
+
_this.setItemSize(ele_7, collection.items[0]);
|
|
4046
|
+
parentEle.insertAdjacentElement('afterend', collectionEle);
|
|
4047
|
+
}
|
|
4048
|
+
};
|
|
4049
|
+
reduce(start);
|
|
4050
|
+
if (middle) {
|
|
4051
|
+
reduce(middle);
|
|
3418
4052
|
}
|
|
4053
|
+
reduce(end);
|
|
3419
4054
|
if (!shouldSkip || shouldClear) {
|
|
3420
4055
|
remove(parentEle);
|
|
3421
4056
|
}
|
|
@@ -3428,10 +4063,23 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3428
4063
|
var start = parseInt(shrinkColumn.getAttribute('data-start'), 10);
|
|
3429
4064
|
var end = parseInt(shrinkColumn.getAttribute('data-end'), 10);
|
|
3430
4065
|
if (orientation === ItemOrientation.Row) {
|
|
3431
|
-
|
|
4066
|
+
var collection = group.collections[0];
|
|
4067
|
+
var l = this.checkClassicItem(collection.items, start + 1, true); //next valid item
|
|
4068
|
+
if (l === end) {
|
|
4069
|
+
expandItemsToLarge(start, end, shrinkColumn);
|
|
4070
|
+
}
|
|
4071
|
+
else {
|
|
4072
|
+
expandItemsToLarge(start, end, shrinkColumn, l);
|
|
4073
|
+
}
|
|
3432
4074
|
}
|
|
3433
4075
|
else {
|
|
3434
|
-
|
|
4076
|
+
var m = this.checkClassicCollection(group.collections, start + 1, true); //next valid item
|
|
4077
|
+
if (m === end) {
|
|
4078
|
+
expandCollectionsToLarge(start, end, shrinkColumn);
|
|
4079
|
+
}
|
|
4080
|
+
else {
|
|
4081
|
+
expandCollectionsToLarge(start, end, shrinkColumn, m);
|
|
4082
|
+
}
|
|
3435
4083
|
}
|
|
3436
4084
|
if (!shouldSkip || shouldClear) {
|
|
3437
4085
|
shrinkColumn.removeAttribute('data-large-width');
|
|
@@ -3487,7 +4135,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3487
4135
|
//Expanding the items in the group to their original expanded state
|
|
3488
4136
|
this_1.checkSmallToMedium(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3489
4137
|
this_1.checkMediumToLarge(tabIndex, tab, groupIndex, tabContent, activeContent, true, false);
|
|
3490
|
-
var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow);
|
|
4138
|
+
var dropdown = this_1.ribbonDropDownModule.createOverFlowDropDown(group.id, group.header, group.groupIconCss, groupContainer, groupOverFlow, this_1.enableRtl);
|
|
3491
4139
|
this_1.tabs[parseInt(tabIndex.toString(), 10)].
|
|
3492
4140
|
groups[parseInt(groupIndex.toString(), 10)].setProperties({ isCollapsed: true }, true);
|
|
3493
4141
|
for (var j = 0; j < group.collections.length; j++) {
|
|
@@ -3496,7 +4144,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3496
4144
|
for (var k = 0; k < collection.items.length; k++) {
|
|
3497
4145
|
var item = collection.items[parseInt(k.toString(), 10)];
|
|
3498
4146
|
var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3499
|
-
|
|
4147
|
+
if (itemEle !== null) {
|
|
4148
|
+
this_1.addOverflowEvents(item, itemEle, dropdown);
|
|
4149
|
+
}
|
|
3500
4150
|
}
|
|
3501
4151
|
}
|
|
3502
4152
|
};
|
|
@@ -3536,7 +4186,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3536
4186
|
for (var k = 0; k < collection.items.length; k++) {
|
|
3537
4187
|
var item = collection.items[parseInt(k.toString(), 10)];
|
|
3538
4188
|
var itemEle = collectionEle.querySelector('#' + item.id + CONTAINER_ID);
|
|
3539
|
-
|
|
4189
|
+
if (itemEle !== null) {
|
|
4190
|
+
this_2.removeOverflowEvent(item, itemEle);
|
|
4191
|
+
}
|
|
3540
4192
|
}
|
|
3541
4193
|
}
|
|
3542
4194
|
};
|
|
@@ -3594,6 +4246,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3594
4246
|
};
|
|
3595
4247
|
Ribbon.prototype.ribbonTabSelecting = function (e) {
|
|
3596
4248
|
var _this = this;
|
|
4249
|
+
this.currentControlIndex = 0;
|
|
3597
4250
|
var nextTabId = e.selectingItem.getAttribute('data-id');
|
|
3598
4251
|
var previousTabId = e.previousItem.getAttribute('data-id');
|
|
3599
4252
|
var nextIndex = getIndex(this.tabs, (function (tab) { return (tab.id === nextTabId); }));
|
|
@@ -3650,11 +4303,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3650
4303
|
this.checkOverflow(this.selectedTab, activeContent);
|
|
3651
4304
|
};
|
|
3652
4305
|
Ribbon.prototype.addOverflowButton = function (btnId) {
|
|
4306
|
+
var _this = this;
|
|
3653
4307
|
var overflowButton = this.createElement('button', {
|
|
3654
4308
|
id: btnId
|
|
3655
4309
|
});
|
|
3656
4310
|
var overflowTarget = this.createElement('div', {
|
|
3657
|
-
className: RIBBON_OVERFLOW_TARGET
|
|
4311
|
+
className: RIBBON_OVERFLOW_TARGET,
|
|
4312
|
+
attrs: { 'tabindex': '0' }
|
|
3658
4313
|
});
|
|
3659
4314
|
var overflowDDB = new DropDownButton({
|
|
3660
4315
|
iconCss: OVERFLOW_ICON,
|
|
@@ -3672,8 +4327,112 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3672
4327
|
}, overflowButton);
|
|
3673
4328
|
this.element.classList.add(RIBBON_OVERFLOW);
|
|
3674
4329
|
createTooltip(overflowTarget, this);
|
|
4330
|
+
var isGroupOf;
|
|
4331
|
+
overflowButton.onkeydown = overflowButton.onclick = function () { _this.itemIndex = -1; isGroupOf = overflowButton.classList.contains('e-ribbon-overall-of-btn') ? false : true; };
|
|
4332
|
+
overflowTarget.onkeydown = function (e) { return (_this.upDownKeyHandler(e, overflowTarget, isGroupOf), _this); };
|
|
3675
4333
|
return overflowDDB;
|
|
3676
4334
|
};
|
|
4335
|
+
Ribbon.prototype.upDownKeyHandler = function (e, target, isGroupOf) {
|
|
4336
|
+
var items;
|
|
4337
|
+
if (isGroupOf) {
|
|
4338
|
+
items = target.getElementsByClassName('e-ribbon-item');
|
|
4339
|
+
}
|
|
4340
|
+
else {
|
|
4341
|
+
var currentList = target.querySelector('.e-ribbon-of-tab.e-ribbon-active');
|
|
4342
|
+
items = currentList.getElementsByClassName('e-ribbon-item');
|
|
4343
|
+
}
|
|
4344
|
+
var 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;
|
|
4345
|
+
var ribbonItem;
|
|
4346
|
+
if (comboBoxEle === null || (e.key === 'Tab') || this.itemIndex < 0) {
|
|
4347
|
+
if (e.key === 'ArrowDown' || (!e.shiftKey && e.key === 'Tab')) {
|
|
4348
|
+
if ((!this.itemIndex && this.itemIndex !== 0) || this.itemIndex < 0 || this.itemIndex === items.length - 1) {
|
|
4349
|
+
this.itemIndex = 0;
|
|
4350
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4351
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4352
|
+
if (comboBoxEle && e.key === 'Tab') {
|
|
4353
|
+
e.preventDefault();
|
|
4354
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
else if (this.itemIndex < items.length - 1 && this.itemIndex >= 0) {
|
|
4358
|
+
this.itemIndex++;
|
|
4359
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4360
|
+
this.findDisabledItem(ribbonItem, items, true);
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {
|
|
4364
|
+
if (comboBoxEle === null || (e.key === 'Tab')) {
|
|
4365
|
+
if (!this.itemIndex || this.itemIndex === -1) {
|
|
4366
|
+
this.itemIndex = items.length - 1;
|
|
4367
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4368
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4369
|
+
if (comboBoxEle && (e.shiftKey && e.key === 'Tab')) {
|
|
4370
|
+
e.preventDefault();
|
|
4371
|
+
items[this.itemIndex].querySelector('.e-control').focus();
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
else if (this.itemIndex <= items.length - 1 && this.itemIndex > 0) {
|
|
4375
|
+
this.itemIndex--;
|
|
4376
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4377
|
+
this.findDisabledItem(ribbonItem, items, false);
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
target.setAttribute('index', this.itemIndex.toString());
|
|
4382
|
+
}
|
|
4383
|
+
var currentItemIndex = parseInt(target.getAttribute('index'), 10);
|
|
4384
|
+
var itemType = items[parseInt(currentItemIndex.toString(), 10)] ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').getAttribute('data-control') : null;
|
|
4385
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === ' ' || e.key === 'Tab') {
|
|
4386
|
+
if (itemType === 'ColorPicker') {
|
|
4387
|
+
if (e.key === 'Tab') {
|
|
4388
|
+
e.preventDefault();
|
|
4389
|
+
}
|
|
4390
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-split-colorpicker').focus();
|
|
4391
|
+
}
|
|
4392
|
+
else {
|
|
4393
|
+
if (e.key === 'Tab') {
|
|
4394
|
+
e.preventDefault();
|
|
4395
|
+
}
|
|
4396
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4397
|
+
}
|
|
4398
|
+
if (e.key === ' ' && (itemType === 'CheckBox')) {
|
|
4399
|
+
var checkBoxEle = items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control');
|
|
4400
|
+
var checkBox = getComponent(checkBoxEle, CheckBox);
|
|
4401
|
+
this.itemIndex = -1;
|
|
4402
|
+
checkBox.click();
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
if (((itemType === 'SplitButton') && (e.key === 'ArrowRight' || e.key === 'ArrowLeft'))) {
|
|
4406
|
+
if (e.key === 'ArrowRight') {
|
|
4407
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus() :
|
|
4408
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus();
|
|
4409
|
+
}
|
|
4410
|
+
if (e.key === 'ArrowLeft') {
|
|
4411
|
+
this.enableRtl ? items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-dropdown-btn').focus() :
|
|
4412
|
+
items[parseInt(currentItemIndex.toString(), 10)].querySelector('.e-control').focus();
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
if (e.key === 'Enter') {
|
|
4416
|
+
this.itemIndex = -1;
|
|
4417
|
+
}
|
|
4418
|
+
};
|
|
4419
|
+
Ribbon.prototype.findDisabledItem = function (ribbonItem, items, isIncrease) {
|
|
4420
|
+
while (ribbonItem && ribbonItem.classList.contains('e-disabled')) {
|
|
4421
|
+
if (isIncrease) {
|
|
4422
|
+
if (this.itemIndex === items.length - 1 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4423
|
+
this.itemIndex = -1;
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
else {
|
|
4427
|
+
if (this.itemIndex === 0 && items[this.itemIndex].closest('.e-ribbon-item').classList.contains('e-disabled')) {
|
|
4428
|
+
this.itemIndex = items.length;
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
4432
|
+
isIncrease ? this.itemIndex++ : this.itemIndex--;
|
|
4433
|
+
ribbonItem = items[this.itemIndex].closest('.e-ribbon-item');
|
|
4434
|
+
}
|
|
4435
|
+
};
|
|
3677
4436
|
Ribbon.prototype.removeOverflowButton = function (overflowDDB) {
|
|
3678
4437
|
if (overflowDDB) {
|
|
3679
4438
|
var btnEle = overflowDDB.element;
|
|
@@ -3763,6 +4522,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3763
4522
|
}
|
|
3764
4523
|
};
|
|
3765
4524
|
Ribbon.prototype.switchLayout = function () {
|
|
4525
|
+
this.currentControlIndex = 0;
|
|
3766
4526
|
this.destroyScroll();
|
|
3767
4527
|
this.collapseButton.classList.toggle(RIBBON_EXPAND_BUTTON, this.activeLayout === 'Simplified');
|
|
3768
4528
|
this.element.classList.toggle(RIBBON_SIMPLIFIED_MODE, this.activeLayout === 'Simplified');
|
|
@@ -3777,6 +4537,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3777
4537
|
if (this.activeLayout === 'Simplified') {
|
|
3778
4538
|
for (var i_1 = 0; i_1 < groupList.length; i_1++) {
|
|
3779
4539
|
var group = groupList[parseInt(i_1.toString(), 10)];
|
|
4540
|
+
var alignType = groupList[parseInt(i_1.toString(), 10)].orientation;
|
|
3780
4541
|
if (group.isCollapsed) {
|
|
3781
4542
|
group.setProperties({ isCollapsed: false }, true);
|
|
3782
4543
|
this.removeDropdown(group.id);
|
|
@@ -3804,11 +4565,11 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3804
4565
|
var itemList = collection.items;
|
|
3805
4566
|
var item = collection.items[parseInt(k.toString(), 10)];
|
|
3806
4567
|
var flag = true;
|
|
3807
|
-
while ((flag) && (item.displayOptions === DisplayMode.
|
|
4568
|
+
while ((flag) && (item.displayOptions === DisplayMode.Classic)) {
|
|
3808
4569
|
k++;
|
|
3809
4570
|
var itemEle_1 = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3810
|
-
var
|
|
3811
|
-
this.destroyFunction(item,
|
|
4571
|
+
var ele = itemEle_1.querySelector('#' + item.id);
|
|
4572
|
+
this.destroyFunction(item, ele);
|
|
3812
4573
|
itemEle_1.remove();
|
|
3813
4574
|
if (k < itemList.length) {
|
|
3814
4575
|
item = itemList[parseInt(k.toString(), 10)];
|
|
@@ -3820,19 +4581,29 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3820
4581
|
if (!flag) {
|
|
3821
4582
|
break;
|
|
3822
4583
|
}
|
|
3823
|
-
var itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
3824
|
-
var ele = itemEle.querySelector('#' + item.id);
|
|
3825
4584
|
var size = ((item.allowedSizes === RibbonItemSize.Large) ||
|
|
3826
4585
|
(item.allowedSizes & RibbonItemSize.Medium)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
4586
|
+
size = (!(item.displayOptions & DisplayMode.Simplified) && (item.displayOptions & DisplayMode.Overflow))
|
|
4587
|
+
? RibbonItemSize.Medium : size;
|
|
4588
|
+
var itemEle = void 0;
|
|
4589
|
+
if (!(item.displayOptions & DisplayMode.Classic)) {
|
|
4590
|
+
itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer)[0];
|
|
4591
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4592
|
+
groupCollection.append(itemEle);
|
|
3832
4593
|
}
|
|
3833
4594
|
}
|
|
3834
|
-
|
|
3835
|
-
|
|
4595
|
+
else {
|
|
4596
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4597
|
+
if (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)) {
|
|
4598
|
+
this.createOverflowPopup(item, tabIndex, group.enableGroupOverflow, group.id, group.header, itemEle, groupContainer);
|
|
4599
|
+
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
4600
|
+
this.updatePopupItems(item, itemEle, group.enableGroupOverflow, true);
|
|
4601
|
+
}
|
|
4602
|
+
}
|
|
4603
|
+
item.setProperties({ activeSize: size }, true);
|
|
4604
|
+
var ele = itemEle.querySelector('#' + item.id);
|
|
4605
|
+
this.setItemSize(ele, item);
|
|
4606
|
+
}
|
|
3836
4607
|
}
|
|
3837
4608
|
}
|
|
3838
4609
|
if (!(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
|
|
@@ -3879,22 +4650,37 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3879
4650
|
groupCollection.classList.replace(RIBBON_COLUMN, RIBBON_ROW);
|
|
3880
4651
|
}
|
|
3881
4652
|
for (var k = 0; k < collection.items.length; k++) {
|
|
4653
|
+
var itemList = collection.items;
|
|
3882
4654
|
var item = collection.items[parseInt(k.toString(), 10)];
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
4655
|
+
var flag = true;
|
|
4656
|
+
while ((flag) && !(item.displayOptions & DisplayMode.Classic)) {
|
|
4657
|
+
k++;
|
|
4658
|
+
var itemEle = void 0;
|
|
4659
|
+
if ((item.displayOptions & DisplayMode.Simplified) || (item.displayOptions & DisplayMode.Overflow)) {
|
|
4660
|
+
if (item.displayOptions & DisplayMode.Simplified) {
|
|
4661
|
+
itemEle = groupContainer.querySelector('#' + item.id + CONTAINER_ID);
|
|
4662
|
+
}
|
|
4663
|
+
else {
|
|
4664
|
+
itemEle = overflowtarget.querySelector('#' + item.id + CONTAINER_ID);
|
|
4665
|
+
}
|
|
4666
|
+
if (itemEle !== null) {
|
|
4667
|
+
var ele_8 = itemEle.querySelector('#' + item.id);
|
|
4668
|
+
this.destroyFunction(item, ele_8);
|
|
4669
|
+
itemEle.remove();
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
if (k < itemList.length) {
|
|
4673
|
+
item = itemList[parseInt(k.toString(), 10)];
|
|
4674
|
+
}
|
|
4675
|
+
else {
|
|
4676
|
+
flag = false;
|
|
3891
4677
|
}
|
|
3892
|
-
groupCollection.append(itemEle);
|
|
3893
|
-
this.removeOverflowEvent(item, itemEle);
|
|
3894
4678
|
}
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
4679
|
+
if (!flag) {
|
|
4680
|
+
break;
|
|
4681
|
+
}
|
|
4682
|
+
if (!(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) {
|
|
4683
|
+
var itemEle = this.createItems([item], alignType, group.id, group.header, group.enableGroupOverflow, tabIndex)[0];
|
|
3898
4684
|
groupCollection.append(itemEle);
|
|
3899
4685
|
}
|
|
3900
4686
|
else {
|
|
@@ -3932,36 +4718,51 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3932
4718
|
this.overflowDDB = null;
|
|
3933
4719
|
}
|
|
3934
4720
|
};
|
|
4721
|
+
Ribbon.prototype.createLauncherIcon = function (groupId, groupContainer) {
|
|
4722
|
+
var _this = this;
|
|
4723
|
+
var launcherIcon = this.createElement('div', {
|
|
4724
|
+
className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss ? this.launcherIconCss : RIBBON_LAUNCHER_ICON),
|
|
4725
|
+
id: groupId + LAUNCHER_ID,
|
|
4726
|
+
attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
|
|
4727
|
+
});
|
|
4728
|
+
groupContainer.appendChild(launcherIcon);
|
|
4729
|
+
groupContainer.classList.add(RIBBON_LAUNCHER);
|
|
4730
|
+
EventHandler.add(launcherIcon, 'click', this.launcherIconClicked.bind(this, groupId), this);
|
|
4731
|
+
EventHandler.add(launcherIcon, 'keydown', function (e) {
|
|
4732
|
+
if (e.key === 'Enter') {
|
|
4733
|
+
_this.launcherIconClicked(groupId);
|
|
4734
|
+
}
|
|
4735
|
+
}, this);
|
|
4736
|
+
};
|
|
3935
4737
|
Ribbon.prototype.launcherIconClicked = function (id) {
|
|
3936
4738
|
var eventArgs = { groupId: id };
|
|
3937
4739
|
this.trigger('launcherIconClick', eventArgs);
|
|
3938
4740
|
};
|
|
3939
4741
|
Ribbon.prototype.createGroups = function (groupList, tabIndex) {
|
|
3940
|
-
var _this = this;
|
|
3941
4742
|
var groupElements = [];
|
|
3942
|
-
var
|
|
4743
|
+
for (var i = 0; i < groupList.length; i++) {
|
|
3943
4744
|
var group = groupList[parseInt(i.toString(), 10)];
|
|
3944
4745
|
var alignType = group.orientation;
|
|
3945
|
-
var groupEle =
|
|
4746
|
+
var groupEle = this.createElement('div', {
|
|
3946
4747
|
className: group.cssClass,
|
|
3947
4748
|
id: group.id
|
|
3948
4749
|
});
|
|
3949
4750
|
groupEle.classList.add(RIBBON_GROUP);
|
|
3950
4751
|
groupElements.push(groupEle);
|
|
3951
|
-
var groupContainer =
|
|
4752
|
+
var groupContainer = this.createElement('div', {
|
|
3952
4753
|
className: group.cssClass,
|
|
3953
4754
|
id: group.id + CONTAINER_ID
|
|
3954
4755
|
});
|
|
3955
4756
|
groupContainer.classList.add(RIBBON_GROUP_CONTAINER);
|
|
3956
4757
|
groupEle.appendChild(groupContainer);
|
|
3957
|
-
var groupContent =
|
|
3958
|
-
className:
|
|
4758
|
+
var groupContent = this.createElement('div', {
|
|
4759
|
+
className: this.activeLayout === 'Simplified' ? RIBBON_GROUP_CONTENT : (RIBBON_GROUP_CONTENT + SPACE + RIBBON_CONTENT_HEIGHT),
|
|
3959
4760
|
id: group.id + CONTENT_ID
|
|
3960
4761
|
});
|
|
3961
|
-
groupContent.classList.add(((alignType === 'Column') || (
|
|
4762
|
+
groupContent.classList.add(((alignType === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
|
|
3962
4763
|
groupContainer.appendChild(groupContent);
|
|
3963
|
-
if (
|
|
3964
|
-
var groupHeader =
|
|
4764
|
+
if (this.activeLayout === 'Classic') {
|
|
4765
|
+
var groupHeader = this.createElement('div', {
|
|
3965
4766
|
className: RIBBON_GROUP_HEADER,
|
|
3966
4767
|
id: group.id + HEADER_ID,
|
|
3967
4768
|
innerHTML: group.header
|
|
@@ -3969,29 +4770,13 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
3969
4770
|
groupContainer.appendChild(groupHeader);
|
|
3970
4771
|
}
|
|
3971
4772
|
if (group.showLauncherIcon) {
|
|
3972
|
-
|
|
3973
|
-
className: RIBBON_LAUNCHER_ICON_ELE + ' ' + (this_3.launcherIconCss ? this_3.launcherIconCss : RIBBON_LAUNCHER_ICON),
|
|
3974
|
-
id: group.id + LAUNCHER_ID,
|
|
3975
|
-
attrs: { 'tabindex': '0', 'type': 'button', 'aria-label': 'Launcher Icon', 'role': 'button' }
|
|
3976
|
-
});
|
|
3977
|
-
groupContainer.appendChild(launcherIcon);
|
|
3978
|
-
groupContainer.classList.add(RIBBON_LAUNCHER);
|
|
3979
|
-
EventHandler.add(launcherIcon, 'click', this_3.launcherIconClicked.bind(this_3, group.id), this_3);
|
|
3980
|
-
EventHandler.add(launcherIcon, 'keydown', function (e) {
|
|
3981
|
-
if (e.key === 'Enter') {
|
|
3982
|
-
_this.launcherIconClicked(group.id);
|
|
3983
|
-
}
|
|
3984
|
-
}, this_3);
|
|
4773
|
+
this.createLauncherIcon(group.id, groupContainer);
|
|
3985
4774
|
}
|
|
3986
|
-
var elements =
|
|
4775
|
+
var elements = this.createCollection(group.collections, group.orientation, group.id, group.header, group.enableGroupOverflow, tabIndex, groupContainer);
|
|
3987
4776
|
append(elements, groupContent);
|
|
3988
|
-
if ((
|
|
4777
|
+
if ((this.activeLayout === 'Simplified') && !(group.enableGroupOverflow || groupEle.querySelector('.' + RIBBON_ITEM))) {
|
|
3989
4778
|
groupEle.classList.add('e-ribbon-emptyCollection');
|
|
3990
4779
|
}
|
|
3991
|
-
};
|
|
3992
|
-
var this_3 = this;
|
|
3993
|
-
for (var i = 0; i < groupList.length; i++) {
|
|
3994
|
-
_loop_3(i);
|
|
3995
4780
|
}
|
|
3996
4781
|
return groupElements;
|
|
3997
4782
|
};
|
|
@@ -4053,6 +4838,31 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4053
4838
|
}
|
|
4054
4839
|
return collectionElements;
|
|
4055
4840
|
};
|
|
4841
|
+
Ribbon.prototype.createRibbonItem = function (item, itemEle) {
|
|
4842
|
+
switch (item.type) {
|
|
4843
|
+
case 'Button':
|
|
4844
|
+
this.ribbonButtonModule.createButton(item, itemEle);
|
|
4845
|
+
break;
|
|
4846
|
+
case 'DropDown':
|
|
4847
|
+
this.ribbonDropDownModule.createDropDown(item, itemEle);
|
|
4848
|
+
break;
|
|
4849
|
+
case 'SplitButton':
|
|
4850
|
+
this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
|
|
4851
|
+
break;
|
|
4852
|
+
case 'CheckBox':
|
|
4853
|
+
this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
|
|
4854
|
+
break;
|
|
4855
|
+
case 'ColorPicker':
|
|
4856
|
+
this.ribbonColorPickerModule.createColorPicker(item, itemEle);
|
|
4857
|
+
break;
|
|
4858
|
+
case 'ComboBox':
|
|
4859
|
+
this.ribbonComboBoxModule.createComboBox(item, itemEle);
|
|
4860
|
+
break;
|
|
4861
|
+
case 'Template':
|
|
4862
|
+
this.createTemplateContent(item, itemEle);
|
|
4863
|
+
break;
|
|
4864
|
+
}
|
|
4865
|
+
};
|
|
4056
4866
|
Ribbon.prototype.createItems = function (itemList, alignType, groupId, groupHeader, isGroupOF, tabIndex, groupContainer) {
|
|
4057
4867
|
var _a;
|
|
4058
4868
|
var itemElements = [];
|
|
@@ -4060,7 +4870,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4060
4870
|
var item = itemList[parseInt(i.toString(), 10)];
|
|
4061
4871
|
//To stop rendering of items with simplified mode position type as none
|
|
4062
4872
|
var flag = true;
|
|
4063
|
-
while (
|
|
4873
|
+
while (flag &&
|
|
4874
|
+
(((this.activeLayout === 'Simplified') && !(item.displayOptions & (DisplayMode.Simplified | DisplayMode.Overflow))) ||
|
|
4875
|
+
((this.activeLayout === 'Classic') && !(item.displayOptions & DisplayMode.Classic)))) {
|
|
4064
4876
|
i++;
|
|
4065
4877
|
if (i < itemList.length) {
|
|
4066
4878
|
item = itemList[parseInt(i.toString(), 10)];
|
|
@@ -4094,30 +4906,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4094
4906
|
else {
|
|
4095
4907
|
itemEle.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
4096
4908
|
}
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
this.ribbonButtonModule.createButton(item, itemEle);
|
|
4100
|
-
break;
|
|
4101
|
-
case 'DropDown':
|
|
4102
|
-
this.ribbonDropDownModule.createDropDown(item, itemEle);
|
|
4103
|
-
break;
|
|
4104
|
-
case 'SplitButton':
|
|
4105
|
-
this.ribbonSplitButtonModule.createSplitButton(item, itemEle);
|
|
4106
|
-
break;
|
|
4107
|
-
case 'CheckBox':
|
|
4108
|
-
this.ribbonCheckBoxModule.createCheckBox(item, itemEle);
|
|
4109
|
-
break;
|
|
4110
|
-
case 'ColorPicker':
|
|
4111
|
-
this.ribbonColorPickerModule.createColorPicker(item, itemEle);
|
|
4112
|
-
break;
|
|
4113
|
-
case 'ComboBox':
|
|
4114
|
-
this.ribbonComboBoxModule.createComboBox(item, itemEle);
|
|
4115
|
-
break;
|
|
4116
|
-
case 'Template':
|
|
4117
|
-
this.createTemplateContent(item, itemEle);
|
|
4118
|
-
break;
|
|
4119
|
-
}
|
|
4120
|
-
if ((this.activeLayout === 'Simplified') && (item.displayOptions === DisplayMode.Overflow)) {
|
|
4909
|
+
this.createRibbonItem(item, itemEle);
|
|
4910
|
+
if ((this.activeLayout === 'Simplified') && ((item.displayOptions === DisplayMode.Overflow) || (item.displayOptions === (DisplayMode.Classic | DisplayMode.Overflow)))) {
|
|
4121
4911
|
this.createOverflowPopup(item, tabIndex, isGroupOF, groupId, groupHeader, itemEle, groupContainer);
|
|
4122
4912
|
if ((item.type === RibbonItemType.DropDown) || (item.type === RibbonItemType.SplitButton)) {
|
|
4123
4913
|
this.updatePopupItems(item, itemEle, isGroupOF, true);
|
|
@@ -4152,10 +4942,11 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4152
4942
|
};
|
|
4153
4943
|
Ribbon.prototype.createTemplateContent = function (item, itemElement) {
|
|
4154
4944
|
var itemEle = this.createElement('div', {
|
|
4155
|
-
className: item.
|
|
4945
|
+
className: item.cssClass ? (RIBBON_TEMPLATE + SPACE + item.cssClass) : RIBBON_TEMPLATE,
|
|
4156
4946
|
id: item.id
|
|
4157
4947
|
});
|
|
4158
4948
|
if (item.disabled) {
|
|
4949
|
+
itemEle.classList.add(DISABLED_CSS);
|
|
4159
4950
|
itemEle.setAttribute('disabled', '');
|
|
4160
4951
|
}
|
|
4161
4952
|
itemElement.appendChild(itemEle);
|
|
@@ -4223,13 +5014,15 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4223
5014
|
var item = _e[_d];
|
|
4224
5015
|
var ele = null;
|
|
4225
5016
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4226
|
-
|
|
5017
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
5018
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
5019
|
+
}
|
|
4227
5020
|
}
|
|
4228
5021
|
else {
|
|
4229
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
5022
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4230
5023
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4231
5024
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4232
|
-
if (!ele
|
|
5025
|
+
if (!ele) {
|
|
4233
5026
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4234
5027
|
if (item.type === 'DropDown') {
|
|
4235
5028
|
this.updatePopupItems(item, dropdown.target, group.enableGroupOverflow, true);
|
|
@@ -4285,15 +5078,17 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4285
5078
|
var item = _e[_d];
|
|
4286
5079
|
var ele = void 0;
|
|
4287
5080
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4288
|
-
|
|
4289
|
-
|
|
5081
|
+
if (item.displayOptions & DisplayMode.Classic) {
|
|
5082
|
+
ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) :
|
|
5083
|
+
contentEle.querySelector('#' + item.id);
|
|
5084
|
+
}
|
|
4290
5085
|
}
|
|
4291
5086
|
else {
|
|
4292
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
5087
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4293
5088
|
ele = (item.displayOptions & DisplayMode.Simplified) ?
|
|
4294
5089
|
contentEle.querySelector('#' + item.id) : null;
|
|
4295
5090
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4296
|
-
if (!ele
|
|
5091
|
+
if (!ele) {
|
|
4297
5092
|
ele = dropdown ? dropdown.target.querySelector('#' + item.id) : null;
|
|
4298
5093
|
}
|
|
4299
5094
|
}
|
|
@@ -4317,7 +5112,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4317
5112
|
};
|
|
4318
5113
|
Ribbon.prototype.destroyFunction = function (item, ele) {
|
|
4319
5114
|
var moduleName = this.getItemModuleName(item);
|
|
4320
|
-
if (moduleName
|
|
5115
|
+
if (moduleName === 'colorpicker') {
|
|
5116
|
+
this.ribbonColorPickerModule.unwireColorPickerEvents(ele);
|
|
5117
|
+
}
|
|
5118
|
+
else if (moduleName !== 'template') {
|
|
4321
5119
|
destroyControl(ele, moduleName);
|
|
4322
5120
|
}
|
|
4323
5121
|
if (item.ribbonTooltipSettings) {
|
|
@@ -4712,16 +5510,382 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4712
5510
|
this.refreshLayout();
|
|
4713
5511
|
}
|
|
4714
5512
|
};
|
|
5513
|
+
/**
|
|
5514
|
+
* tab - Gets the ribbon tab to be updated. The id of the tab is a required property. Other properties are optional.
|
|
5515
|
+
*
|
|
5516
|
+
* @param {RibbonTabModel} tab - Gets the ribbon tab model.
|
|
5517
|
+
* @returns {void}
|
|
5518
|
+
*/
|
|
5519
|
+
Ribbon.prototype.updateTab = function (tab) {
|
|
5520
|
+
var tabId = tab.id;
|
|
5521
|
+
var index = getIndex(this.tabs, function (e) { return e.id === tabId; });
|
|
5522
|
+
if (index === -1) {
|
|
5523
|
+
return;
|
|
5524
|
+
}
|
|
5525
|
+
var contentEle = this.tabObj.items[parseInt(index.toString(), 10)].content;
|
|
5526
|
+
var groups = this.tabs[parseInt(index.toString(), 10)].groups;
|
|
5527
|
+
var tabEle = this.tabObj.element;
|
|
5528
|
+
if (groups && (contentEle.innerHTML !== '')) {
|
|
5529
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5530
|
+
if (tab.cssClass) {
|
|
5531
|
+
if (this.tabs[parseInt(index.toString(), 10)].cssClass) {
|
|
5532
|
+
contentEle.classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5533
|
+
tabEle.querySelector('.e-active').classList.remove(this.tabs[parseInt(index.toString(), 10)].cssClass);
|
|
5534
|
+
}
|
|
5535
|
+
}
|
|
5536
|
+
// Check whether group is passed by the user, and if it is, then remove the old values.
|
|
5537
|
+
if (tab.groups) {
|
|
5538
|
+
for (var _i = 0, groups_2 = groups; _i < groups_2.length; _i++) {
|
|
5539
|
+
var group = groups_2[_i];
|
|
5540
|
+
var dropdownElement = group.isCollapsed ? contentEle.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID) : null;
|
|
5541
|
+
for (var _a = 0, _b = group.collections; _a < _b.length; _a++) {
|
|
5542
|
+
var collection = _b[_a];
|
|
5543
|
+
for (var _c = 0, _d = collection.items; _c < _d.length; _c++) {
|
|
5544
|
+
var item = _d[_c];
|
|
5545
|
+
var ele = dropdownElement ? this.ribbonDropDownModule.getDDBItemElement(dropdownElement, item.id) : contentEle.querySelector('#' + item.id);
|
|
5546
|
+
if (ele) {
|
|
5547
|
+
this.destroyFunction(item, ele);
|
|
5548
|
+
}
|
|
5549
|
+
}
|
|
5550
|
+
}
|
|
5551
|
+
if (dropdownElement) {
|
|
5552
|
+
this.ribbonDropDownModule.removeOverFlowDropDown(dropdownElement);
|
|
5553
|
+
}
|
|
5554
|
+
}
|
|
5555
|
+
var groupElements = contentEle.querySelectorAll('.e-ribbon-group');
|
|
5556
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5557
|
+
groupElements.forEach(function (groupEle) { groupEle.remove(); });
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
if (index === this.selectedTab) {
|
|
5561
|
+
this.isAddRemove = true;
|
|
5562
|
+
}
|
|
5563
|
+
var ribbonTab = this.tabs[parseInt(index.toString(), 10)];
|
|
5564
|
+
ribbonTab.setProperties(tab, true);
|
|
5565
|
+
this.setProperties({ groups: this.checkID(ribbonTab.groups, 'group', ribbonTab.id) }, true);
|
|
5566
|
+
this.validateItemSize();
|
|
5567
|
+
if (contentEle.innerHTML === '') {
|
|
5568
|
+
// Check whether group is passed by the user and sets the updated values.
|
|
5569
|
+
if (tab.groups) {
|
|
5570
|
+
var elements = this.createGroups(ribbonTab.groups, index);
|
|
5571
|
+
append(elements, contentEle);
|
|
5572
|
+
}
|
|
5573
|
+
if (this.selectedTab === index) {
|
|
5574
|
+
this.refreshLayout();
|
|
5575
|
+
}
|
|
5576
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5577
|
+
if (tab.cssClass) {
|
|
5578
|
+
contentEle.classList.add(ribbonTab.cssClass);
|
|
5579
|
+
tabEle.querySelector('.e-active').classList.add(ribbonTab.cssClass);
|
|
5580
|
+
}
|
|
5581
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5582
|
+
if (tab.header) {
|
|
5583
|
+
tabEle.querySelector('#' + tabId + HEADER_ID).innerText = ribbonTab.header;
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
};
|
|
5587
|
+
/**
|
|
5588
|
+
* group - Gets the ribbon group to be updated. The id of the group is a required property. Other properties are optional.
|
|
5589
|
+
*
|
|
5590
|
+
* @param {RibbonGroupModel} group - Gets the ribbon group model.
|
|
5591
|
+
* @returns {void}
|
|
5592
|
+
*/
|
|
5593
|
+
Ribbon.prototype.updateGroup = function (group) {
|
|
5594
|
+
var groupId = group.id;
|
|
5595
|
+
var itemProp = getGroup(this.tabs, groupId);
|
|
5596
|
+
if (!itemProp) {
|
|
5597
|
+
return;
|
|
5598
|
+
}
|
|
5599
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5600
|
+
this.clearOverflowResize();
|
|
5601
|
+
}
|
|
5602
|
+
//Check whether the tab items are rendered
|
|
5603
|
+
var contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5604
|
+
var groupEle = contentEle.querySelector('#' + groupId);
|
|
5605
|
+
var groupContainer = groupEle.querySelector('#' + group.id + CONTAINER_ID);
|
|
5606
|
+
var dropdownElement;
|
|
5607
|
+
var dropdown;
|
|
5608
|
+
if (contentEle.innerHTML !== '') {
|
|
5609
|
+
if (itemProp.group.showLauncherIcon) {
|
|
5610
|
+
this.removeLauncherIcon(itemProp.group.id, null, contentEle);
|
|
5611
|
+
}
|
|
5612
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5613
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5614
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5615
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5616
|
+
}
|
|
5617
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5618
|
+
if (group.cssClass) {
|
|
5619
|
+
if (itemProp.group.cssClass) {
|
|
5620
|
+
groupEle.classList.remove(itemProp.group.cssClass);
|
|
5621
|
+
if (groupContainer) {
|
|
5622
|
+
groupContainer.classList.remove(itemProp.group.cssClass);
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
// Check whether collections or orientation is passed by the user, and if it is, then remove the old values.
|
|
5627
|
+
if (group.collections || group.orientation) {
|
|
5628
|
+
if (itemProp.group.collections || itemProp.group.orientation) {
|
|
5629
|
+
for (var _i = 0, _a = itemProp.group.collections; _i < _a.length; _i++) {
|
|
5630
|
+
var collection = _a[_i];
|
|
5631
|
+
for (var _b = 0, _c = collection.items; _b < _c.length; _b++) {
|
|
5632
|
+
var item = _c[_b];
|
|
5633
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5636
|
+
var collectionElements = groupEle.querySelectorAll('.e-ribbon-collection');
|
|
5637
|
+
// eslint-disable-next-line @typescript-eslint/tslint/config
|
|
5638
|
+
collectionElements.forEach(function (collectionEle) { collectionEle.remove(); });
|
|
5639
|
+
if (group.orientation) {
|
|
5640
|
+
var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5641
|
+
var removeCss = groupContent.classList.value.match(/(e-ribbon-[column|row]+)/g);
|
|
5642
|
+
if (removeCss) {
|
|
5643
|
+
removeClass([groupContent], removeCss);
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5647
|
+
}
|
|
5648
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5649
|
+
if (itemProp.group.enableGroupOverflow) {
|
|
5650
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5651
|
+
this.removeOverflowButton(dropdown);
|
|
5652
|
+
}
|
|
5653
|
+
}
|
|
5654
|
+
else {
|
|
5655
|
+
var ofGroupContainer = dropdown.target.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5656
|
+
if (ofGroupContainer && ofGroupContainer.childElementCount === 1) {
|
|
5657
|
+
ofGroupContainer.remove();
|
|
5658
|
+
}
|
|
5659
|
+
var ofTabContainer = dropdown.target.querySelector('#' + this.tabs[parseInt(itemProp.tabIndex.toString(), 10)].id + OVERFLOW_ID);
|
|
5660
|
+
if (ofTabContainer && ofTabContainer.childElementCount === 0) {
|
|
5661
|
+
ofTabContainer.remove();
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
var ribbongroup = itemProp.group;
|
|
5667
|
+
ribbongroup.setProperties(group, true);
|
|
5668
|
+
ribbongroup.setProperties({ collections: this.checkID(ribbongroup.collections, 'collection', ribbongroup.id) }, true);
|
|
5669
|
+
this.validateItemSize();
|
|
5670
|
+
if (contentEle.innerHTML !== '') {
|
|
5671
|
+
// Check whether showLauncherIcon or orientation is passed by the user and sets the updated values.
|
|
5672
|
+
if (group.showLauncherIcon) {
|
|
5673
|
+
this.createLauncherIcon(ribbongroup.id, groupContainer);
|
|
5674
|
+
}
|
|
5675
|
+
// Check whether collections or orientation is passed by the user and sets the updated values.
|
|
5676
|
+
if (group.collections || group.orientation) {
|
|
5677
|
+
var groupContent = groupContainer.querySelector('.e-ribbon-group-content');
|
|
5678
|
+
groupContent.classList.add(((ribbongroup.orientation === 'Column') || (this.activeLayout === 'Simplified')) ? RIBBON_COLUMN : RIBBON_ROW);
|
|
5679
|
+
var elements = this.createCollection(ribbongroup.collections, ribbongroup.orientation, ribbongroup.id, ribbongroup.header, ribbongroup.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5680
|
+
append(elements, groupContent);
|
|
5681
|
+
}
|
|
5682
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5683
|
+
this.refreshLayout();
|
|
5684
|
+
}
|
|
5685
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5686
|
+
if (group.cssClass) {
|
|
5687
|
+
groupEle.classList.add(ribbongroup.cssClass);
|
|
5688
|
+
if (groupContainer) {
|
|
5689
|
+
groupContainer.classList.add(ribbongroup.cssClass);
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
// Check whether header is passed by the user and sets the updated values.
|
|
5693
|
+
if (group.header) {
|
|
5694
|
+
if (this.activeLayout === RibbonLayout.Simplified && !group.enableGroupOverflow) {
|
|
5695
|
+
var overflowHeader = dropdown.target.querySelector('#' + group.id + HEADER_ID);
|
|
5696
|
+
if (overflowHeader) {
|
|
5697
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5698
|
+
}
|
|
5699
|
+
}
|
|
5700
|
+
else if (this.activeLayout === RibbonLayout.Classic && !ribbongroup.isCollapsed) {
|
|
5701
|
+
groupEle.querySelector('.e-ribbon-group-header').innerText = ribbongroup.header;
|
|
5702
|
+
}
|
|
5703
|
+
else if (this.activeLayout === RibbonLayout.Classic && ribbongroup.isCollapsed) {
|
|
5704
|
+
var overflowEle = groupEle.querySelector('#' + ribbongroup.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
5705
|
+
// need to set instance for dropdown
|
|
5706
|
+
var dropDownBtn = getInstance(overflowEle, DropDownButton);
|
|
5707
|
+
var overflowHeader = dropDownBtn.target.querySelector('#' + group.id + HEADER_ID);
|
|
5708
|
+
if (overflowHeader) {
|
|
5709
|
+
overflowHeader.innerText = ribbongroup.header;
|
|
5710
|
+
}
|
|
5711
|
+
}
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5714
|
+
};
|
|
5715
|
+
/**
|
|
5716
|
+
* collection - Gets the ribbon collection to be updated. The id of the collection is a required property. Other properties are optional.
|
|
5717
|
+
*
|
|
5718
|
+
* @param {RibbonCollectionModel} collection - Gets the ribbon collection model.
|
|
5719
|
+
* @returns {void}
|
|
5720
|
+
*/
|
|
5721
|
+
Ribbon.prototype.updateCollection = function (collection) {
|
|
5722
|
+
var collectionId = collection.id;
|
|
5723
|
+
var itemProp = getCollection(this.tabs, collectionId);
|
|
5724
|
+
if (!itemProp) {
|
|
5725
|
+
return;
|
|
5726
|
+
}
|
|
5727
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5728
|
+
this.clearOverflowResize();
|
|
5729
|
+
}
|
|
5730
|
+
//Check whether the tab items are rendered
|
|
5731
|
+
var contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5732
|
+
var collectionEle = contentEle.querySelector('#' + collectionId);
|
|
5733
|
+
if (contentEle.innerHTML !== '') {
|
|
5734
|
+
var dropdownElement = void 0;
|
|
5735
|
+
var dropdown = void 0;
|
|
5736
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5737
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5738
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5739
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5740
|
+
}
|
|
5741
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5742
|
+
if (collection.cssClass) {
|
|
5743
|
+
if (itemProp.collection.cssClass) {
|
|
5744
|
+
collectionEle.classList.remove(itemProp.collection.cssClass);
|
|
5745
|
+
}
|
|
5746
|
+
}
|
|
5747
|
+
if (collection.items) {
|
|
5748
|
+
if (itemProp.collection.items) {
|
|
5749
|
+
for (var _i = 0, _a = itemProp.collection.items; _i < _a.length; _i++) {
|
|
5750
|
+
var item = _a[_i];
|
|
5751
|
+
this.removeItemElement(contentEle, item, dropdown);
|
|
5752
|
+
}
|
|
5753
|
+
}
|
|
5754
|
+
}
|
|
5755
|
+
}
|
|
5756
|
+
var ribboncollection = itemProp.collection;
|
|
5757
|
+
ribboncollection.setProperties(collection, true);
|
|
5758
|
+
ribboncollection.setProperties({ items: this.checkID(ribboncollection.items, 'item', ribboncollection.id) }, true);
|
|
5759
|
+
this.validateItemSize();
|
|
5760
|
+
if (contentEle.innerHTML !== '') {
|
|
5761
|
+
if (collection.items) {
|
|
5762
|
+
var groupContainer = contentEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5763
|
+
var elements = this.createItems(ribboncollection.items, itemProp.group.orientation, itemProp.group.id, itemProp.group.header, itemProp.group.enableGroupOverflow, itemProp.tabIndex, groupContainer);
|
|
5764
|
+
append(elements, collectionEle);
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5768
|
+
this.refreshLayout();
|
|
5769
|
+
}
|
|
5770
|
+
// Check whether cssClass is passed by the user and sets the updated values.
|
|
5771
|
+
if (collection.cssClass) {
|
|
5772
|
+
collectionEle.classList.add(ribboncollection.cssClass);
|
|
5773
|
+
}
|
|
5774
|
+
};
|
|
5775
|
+
/**
|
|
5776
|
+
* item - Gets the ribbon item to be updated. The id of the item is a required property. Other properties are optional.
|
|
5777
|
+
*
|
|
5778
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
5779
|
+
* @returns {void}
|
|
5780
|
+
*/
|
|
5781
|
+
Ribbon.prototype.updateItem = function (item) {
|
|
5782
|
+
var itemId = item.id;
|
|
5783
|
+
var itemProp = getItem(this.tabs, itemId);
|
|
5784
|
+
if (!itemProp) {
|
|
5785
|
+
return;
|
|
5786
|
+
}
|
|
5787
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5788
|
+
this.clearOverflowResize();
|
|
5789
|
+
}
|
|
5790
|
+
//Check whether the tab items are rendered
|
|
5791
|
+
var contentEle = this.tabObj.items[itemProp.tabIndex].content;
|
|
5792
|
+
var groupEle = contentEle.querySelector('#' + itemProp.group.id);
|
|
5793
|
+
var groupContainer = groupEle.querySelector('#' + itemProp.group.id + CONTAINER_ID);
|
|
5794
|
+
var itemContainer = null;
|
|
5795
|
+
var itemEle = null;
|
|
5796
|
+
var dropdownElement;
|
|
5797
|
+
var dropdown;
|
|
5798
|
+
if (contentEle.innerHTML !== '') {
|
|
5799
|
+
if (this.activeLayout === RibbonLayout.Simplified) {
|
|
5800
|
+
dropdownElement = itemProp.group.enableGroupOverflow ?
|
|
5801
|
+
contentEle.querySelector('#' + itemProp.group.id + GROUPOF_BUTTON_ID) : null;
|
|
5802
|
+
dropdown = dropdownElement ? getComponent(dropdownElement, DropDownButton) : this.overflowDDB;
|
|
5803
|
+
}
|
|
5804
|
+
if (this.activeLayout === RibbonLayout.Simplified && itemProp.item.displayOptions === DisplayMode.Overflow) {
|
|
5805
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5806
|
+
itemEle = dropdown.target.querySelector('#' + itemId);
|
|
5807
|
+
if (item.displayOptions && item.displayOptions !== DisplayMode.Overflow) {
|
|
5808
|
+
var collectionEle = groupContainer.querySelector('#' + itemProp.collection.id);
|
|
5809
|
+
if (collectionEle) {
|
|
5810
|
+
collectionEle.appendChild(itemContainer);
|
|
5811
|
+
}
|
|
5812
|
+
}
|
|
5813
|
+
}
|
|
5814
|
+
else {
|
|
5815
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5816
|
+
itemEle = contentEle.querySelector('#' + itemId);
|
|
5817
|
+
if (this.activeLayout === RibbonLayout.Simplified && item.displayOptions === DisplayMode.Overflow) {
|
|
5818
|
+
this.createOverflowPopup(itemProp.item, itemProp.tabIndex, itemProp.group.enableGroupOverflow, itemProp.group.id, itemProp.group.header, itemContainer, groupContainer);
|
|
5819
|
+
if ((itemProp.item.type === RibbonItemType.DropDown) || (itemProp.item.type === RibbonItemType.SplitButton)) {
|
|
5820
|
+
this.updatePopupItems(itemProp.item, itemContainer, itemProp.group.enableGroupOverflow, true);
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
// Check whether cssClass is passed by the user, and if it is, then remove the old values.
|
|
5825
|
+
if (item.cssClass) {
|
|
5826
|
+
if (itemProp.item.cssClass) {
|
|
5827
|
+
itemContainer.classList.remove(itemProp.item.cssClass);
|
|
5828
|
+
}
|
|
5829
|
+
}
|
|
5830
|
+
this.destroyFunction(itemProp.item, itemEle);
|
|
5831
|
+
itemEle.remove();
|
|
5832
|
+
var removeCss = itemContainer.classList.value.match(/(e-ribbon-[large|medium|small]+-item)/g);
|
|
5833
|
+
if (removeCss) {
|
|
5834
|
+
removeClass([itemContainer], removeCss);
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
var ribbonItem = itemProp.item;
|
|
5838
|
+
ribbonItem.setProperties(item, true);
|
|
5839
|
+
this.validateItemSize();
|
|
5840
|
+
if (contentEle.innerHTML !== '') {
|
|
5841
|
+
if (!(this.activeLayout === RibbonLayout.Simplified && ribbonItem.displayOptions === DisplayMode.Overflow)) {
|
|
5842
|
+
itemContainer = groupContainer.querySelector('#' + itemId + CONTAINER_ID);
|
|
5843
|
+
}
|
|
5844
|
+
else {
|
|
5845
|
+
itemContainer = dropdown.target.querySelector('#' + itemId + CONTAINER_ID);
|
|
5846
|
+
}
|
|
5847
|
+
// To avoid undefined items condition is added
|
|
5848
|
+
if (ribbonItem.ribbonTooltipSettings && isTooltipPresent(ribbonItem.ribbonTooltipSettings)) {
|
|
5849
|
+
itemContainer.classList.add(RIBBON_TOOLTIP_TARGET);
|
|
5850
|
+
this.tooltipData.push({ id: itemContainer.id, data: ribbonItem.ribbonTooltipSettings });
|
|
5851
|
+
}
|
|
5852
|
+
var size = ribbonItem.activeSize;
|
|
5853
|
+
if (this.activeLayout === 'Simplified') {
|
|
5854
|
+
size = ((ribbonItem.allowedSizes === RibbonItemSize.Large) || (ribbonItem.allowedSizes & RibbonItemSize.Medium) ||
|
|
5855
|
+
(ribbonItem.displayOptions === DisplayMode.Overflow)) ? RibbonItemSize.Medium : RibbonItemSize.Small;
|
|
5856
|
+
ribbonItem.setProperties({ activeSize: size }, true);
|
|
5857
|
+
}
|
|
5858
|
+
if (size & RibbonItemSize.Large) {
|
|
5859
|
+
itemContainer.classList.add(RIBBON_LARGE_ITEM, RIBBON_CONTENT_HEIGHT);
|
|
5860
|
+
}
|
|
5861
|
+
else {
|
|
5862
|
+
itemContainer.classList.add((size & RibbonItemSize.Medium) ? RIBBON_MEDIUM_ITEM : RIBBON_SMALL_ITEM);
|
|
5863
|
+
}
|
|
5864
|
+
this.createRibbonItem(ribbonItem, itemContainer);
|
|
5865
|
+
if (this.activeLayout === 'Simplified' && itemProp.group.enableGroupOverflow) {
|
|
5866
|
+
if (dropdown.target.childElementCount === 0) {
|
|
5867
|
+
this.removeOverflowButton(dropdown);
|
|
5868
|
+
}
|
|
5869
|
+
}
|
|
5870
|
+
if (this.selectedTab === itemProp.tabIndex) {
|
|
5871
|
+
this.refreshLayout();
|
|
5872
|
+
}
|
|
5873
|
+
if (item.cssClass) {
|
|
5874
|
+
itemContainer.classList.add(ribbonItem.cssClass);
|
|
5875
|
+
}
|
|
5876
|
+
this.enableDisableItem(ribbonItem.id, ribbonItem.disabled);
|
|
5877
|
+
}
|
|
5878
|
+
};
|
|
4715
5879
|
Ribbon.prototype.removeItemElement = function (contentEle, item, dropdown) {
|
|
4716
5880
|
var ele = null;
|
|
4717
5881
|
if (this.activeLayout === RibbonLayout.Classic) {
|
|
4718
|
-
ele = contentEle.querySelector('#' + item.id);
|
|
5882
|
+
ele = (item.displayOptions & DisplayMode.Classic) ? contentEle.querySelector('#' + item.id) : null;
|
|
4719
5883
|
}
|
|
4720
5884
|
else {
|
|
4721
|
-
//Checks for Simplified and Auto options (Auto = simplified + popup)
|
|
5885
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
4722
5886
|
ele = (item.displayOptions & DisplayMode.Simplified) ? contentEle.querySelector('#' + item.id) : null;
|
|
4723
5887
|
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
4724
|
-
if (!ele
|
|
5888
|
+
if (!ele) {
|
|
4725
5889
|
ele = dropdown.target.querySelector('#' + item.id);
|
|
4726
5890
|
}
|
|
4727
5891
|
}
|
|
@@ -4772,6 +5936,8 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4772
5936
|
EventHandler.remove(window, 'resize', this.resizeHandler);
|
|
4773
5937
|
};
|
|
4774
5938
|
Ribbon.prototype.destroy = function () {
|
|
5939
|
+
this.keyboardModuleRibbon.destroy();
|
|
5940
|
+
this.keyboardModuleRibbon = null;
|
|
4775
5941
|
destroyTooltip(this.element);
|
|
4776
5942
|
this.destroyTabItems(this.tabs);
|
|
4777
5943
|
this.removeExpandCollapse();
|
|
@@ -4823,6 +5989,9 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4823
5989
|
case 'isMinimized':
|
|
4824
5990
|
this.element.classList.toggle(RIBBON_MINIMIZE, this.isMinimized);
|
|
4825
5991
|
this.tabObj.element.querySelector('.e-content').style.display = this.isMinimized ? 'none' : 'block';
|
|
5992
|
+
if (!this.isMinimized) {
|
|
5993
|
+
this.refreshLayout();
|
|
5994
|
+
}
|
|
4826
5995
|
break;
|
|
4827
5996
|
case 'locale':
|
|
4828
5997
|
this.updateCommonProperty({ locale: this.locale });
|
|
@@ -4847,7 +6016,7 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4847
6016
|
if (group.showLauncherIcon) {
|
|
4848
6017
|
var className = RIBBON_LAUNCHER_ICON_ELE + ' ' + (this.launcherIconCss || RIBBON_LAUNCHER_ICON);
|
|
4849
6018
|
if (group.isCollapsed) {
|
|
4850
|
-
var element = tabContent.querySelector('
|
|
6019
|
+
var element = tabContent.querySelector('#' + group.id + OVERFLOW_ID + DROPDOWN_ID);
|
|
4851
6020
|
var dropdown = getComponent(element, DropDownButton);
|
|
4852
6021
|
var launcherIconEle = dropdown.target.querySelector('#' + group.id + LAUNCHER_ID);
|
|
4853
6022
|
launcherIconEle.className = className;
|
|
@@ -4872,19 +6041,26 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
|
|
|
4872
6041
|
break;
|
|
4873
6042
|
case 'width':
|
|
4874
6043
|
this.element.style.width = formatUnit(newProp.width);
|
|
6044
|
+
this.refreshLayout();
|
|
4875
6045
|
break;
|
|
4876
6046
|
case 'fileMenu':
|
|
4877
6047
|
if (this.ribbonFileMenuModule) {
|
|
4878
6048
|
this.ribbonFileMenuModule.updateFileMenu(this.fileMenu);
|
|
4879
6049
|
}
|
|
6050
|
+
var toolbarEle = this.tabObj['tbObj'];
|
|
6051
|
+
toolbarEle.refreshOverflow();
|
|
4880
6052
|
break;
|
|
4881
6053
|
case 'helpPaneTemplate':
|
|
4882
6054
|
if (this.ribbonTempEle) {
|
|
4883
6055
|
remove(this.ribbonTempEle);
|
|
6056
|
+
this.ribbonTempEle = null;
|
|
6057
|
+
this.tabObj.element.style.setProperty(RIBBON_HELP_PANE_TEMPLATE_WIDTH, '0px');
|
|
4884
6058
|
}
|
|
4885
6059
|
if (this.helpPaneTemplate) {
|
|
4886
6060
|
this.createHelpPaneTemplate();
|
|
4887
6061
|
}
|
|
6062
|
+
var toolbar_1 = this.tabObj['tbObj'];
|
|
6063
|
+
toolbar_1.refreshOverflow();
|
|
4888
6064
|
break;
|
|
4889
6065
|
}
|
|
4890
6066
|
}
|
|
@@ -5270,5 +6446,5 @@ var RibbonFileMenu = /** @__PURE__ @class */ (function () {
|
|
|
5270
6446
|
// export all modules from current location
|
|
5271
6447
|
// example: export * from './module'
|
|
5272
6448
|
|
|
5273
|
-
export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_FILE_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, RibbonTooltip, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonFileMenu };
|
|
6449
|
+
export { Ribbon, RibbonLayout, ItemOrientation, RibbonItemSize, DisplayMode, RibbonItemType, ITEM_VERTICAL_CENTER, EXPAND_COLLAPSE_ICON, OVERFLOW_ICON, VERTICAL_DDB, DISABLED_CSS, RTL_CSS, RIBBON_HOVER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE, HORIZONTAL_SCROLLBAR, HIDE_CSS, RIBBON_TAB, RIBBON_TAB_ACTIVE, RIBBON_TAB_ITEM, RIBBON_COLLAPSE_BUTTON, RIBBON_EXPAND_BUTTON, RIBBON_COLLAPSIBLE, RIBBON_OVERALL_OF_BUTTON, RIBBON_GROUP_OF_BUTTON, RIBBON_OVERFLOW_TARGET, RIBBON_OVERFLOW, TAB_CONTENT, RIBBON_MINIMIZE, RIBBON_GROUP, RIBBON_GROUP_CONTAINER, RIBBON_OF_TAB_CONTAINER, RIBBON_OF_GROUP_CONTAINER, RIBBON_GROUP_CONTENT, RIBBON_GROUP_HEADER, RIBBON_OVERFLOW_HEADER, RIBBON_GROUP_OVERFLOW, RIBBON_GROUP_OVERFLOW_DDB, RIBBON_LAUNCHER, RIBBON_LAUNCHER_ICON_ELE, RIBBON_LAUNCHER_ICON, RIBBON_COLLECTION, RIBBON_ITEM, RIBBON_ROW, RIBBON_COLUMN, RIBBON_LARGE_ITEM, RIBBON_MEDIUM_ITEM, RIBBON_SMALL_ITEM, RIBBON_CONTENT_HEIGHT, DROPDOWNBUTTON, DROPDOWNBUTTON_HIDE, RIBBON_TEMPLATE, RIBBON_HELP_TEMPLATE, RIBBON_TOOLTIP, RIBBON_TOOLTIP_TARGET, RIBBON_TOOLTIP_TITLE, RIBBON_TOOLTIP_CONTENT, RIBBON_TOOLTIP_ICON, RIBBON_TOOLTIP_CONTAINER, RIBBON_TEXT_CONTAINER, RIBBON_SIMPLIFIED_MODE, TAB_ID, GROUP_ID, COLLECTION_ID, ITEM_ID, COLLAPSE_BUTTON_ID, OVRLOF_BUTTON_ID, GROUPOF_BUTTON_ID, HEADER_ID, LAUNCHER_ID, CONTENT_ID, CONTAINER_ID, OVERFLOW_ID, DROPDOWN_ID, RIBBON_FILE_MENU_ID, RIBBON_FILE_MENU_LIST, RIBBON_HELP_PANE_TEMPLATE_ID, RIBBON_FILE_MENU_WIDTH, RIBBON_HELP_PANE_TEMPLATE_WIDTH, getIndex, getTemplateFunction, getItem, getCollection, getGroup, destroyControl, updateCommonProperty, updateControlDisabled, getItemElement, isTooltipPresent, setToolTipContent, createTooltip, destroyTooltip, updateTooltipProp, RibbonTab, RibbonGroup, RibbonCollection, RibbonItem, RibbonButtonSettings, RibbonCheckBoxSettings, RibbonColorPickerSettings, RibbonComboBoxSettings, RibbonDropDownSettings, RibbonSplitButtonSettings, FileMenuSettings, RibbonTooltip, RibbonButton, RibbonCheckBox, RibbonColorPicker, RibbonComboBox, RibbonDropDown, RibbonSplitButton, RibbonFileMenu };
|
|
5274
6450
|
//# sourceMappingURL=ej2-ribbon.es5.js.map
|