@syncfusion/ej2-ribbon 30.1.42 → 31.1.17
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/aceconfig.js +17 -0
- package/dist/ej2-ribbon.umd.min.js +1 -1
- package/dist/global/ej2-ribbon.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/index.d.ts +1 -0
- package/dist/ts/index.ts +3 -0
- package/dist/ts/ribbon/base/constant.d.ts +201 -0
- package/dist/ts/ribbon/base/constant.ts +204 -0
- package/dist/ts/ribbon/base/index.d.ts +8 -0
- package/dist/ts/ribbon/base/index.ts +8 -0
- package/dist/ts/ribbon/base/interface.d.ts +398 -0
- package/dist/ts/ribbon/base/interface.ts +424 -0
- package/dist/ts/ribbon/base/ribbon-model.d.ts +195 -0
- package/dist/ts/ribbon/base/ribbon.d.ts +608 -0
- package/dist/ts/ribbon/base/ribbon.ts +4896 -0
- package/dist/ts/ribbon/base/utils.d.ts +139 -0
- package/dist/ts/ribbon/base/utils.ts +341 -0
- package/dist/ts/ribbon/index.d.ts +7 -0
- package/dist/ts/ribbon/index.ts +7 -0
- package/dist/ts/ribbon/items/index.d.ts +8 -0
- package/dist/ts/ribbon/items/index.ts +8 -0
- package/dist/ts/ribbon/items/ribbon-button.d.ts +64 -0
- package/dist/ts/ribbon/items/ribbon-button.ts +160 -0
- package/dist/ts/ribbon/items/ribbon-checkbox.d.ts +55 -0
- package/dist/ts/ribbon/items/ribbon-checkbox.ts +130 -0
- package/dist/ts/ribbon/items/ribbon-colorpicker.d.ts +72 -0
- package/dist/ts/ribbon/items/ribbon-colorpicker.ts +228 -0
- package/dist/ts/ribbon/items/ribbon-combobox.d.ts +77 -0
- package/dist/ts/ribbon/items/ribbon-combobox.ts +201 -0
- package/dist/ts/ribbon/items/ribbon-dropdown.d.ts +128 -0
- package/dist/ts/ribbon/items/ribbon-dropdown.ts +400 -0
- package/dist/ts/ribbon/items/ribbon-gallery.d.ts +97 -0
- package/dist/ts/ribbon/items/ribbon-gallery.ts +773 -0
- package/dist/ts/ribbon/items/ribbon-groupbutton.d.ts +73 -0
- package/dist/ts/ribbon/items/ribbon-groupbutton.ts +531 -0
- package/dist/ts/ribbon/items/ribbon-splitbutton.d.ts +85 -0
- package/dist/ts/ribbon/items/ribbon-splitbutton.ts +257 -0
- package/dist/ts/ribbon/models/index.d.ts +42 -0
- package/dist/ts/ribbon/models/index.ts +44 -0
- package/dist/ts/ribbon/models/ribbon-back-button-model.d.ts +29 -0
- package/dist/ts/ribbon/models/ribbon-back-button.d.ts +24 -0
- package/dist/ts/ribbon/models/ribbon-back-button.ts +31 -0
- package/dist/ts/ribbon/models/ribbon-back-stage-settings-model.d.ts +83 -0
- package/dist/ts/ribbon/models/ribbon-back-stage-settings.d.ts +81 -0
- package/dist/ts/ribbon/models/ribbon-back-stage-settings.ts +109 -0
- package/dist/ts/ribbon/models/ribbon-backstage-item-model.d.ts +69 -0
- package/dist/ts/ribbon/models/ribbon-backstage-item.d.ts +80 -0
- package/dist/ts/ribbon/models/ribbon-backstage-item.ts +102 -0
- package/dist/ts/ribbon/models/ribbon-button-settings-model.d.ts +64 -0
- package/dist/ts/ribbon/models/ribbon-button-settings.d.ts +63 -0
- package/dist/ts/ribbon/models/ribbon-button-settings.ts +80 -0
- package/dist/ts/ribbon/models/ribbon-checkbox-settings-model.d.ts +57 -0
- package/dist/ts/ribbon/models/ribbon-checkbox-settings.d.ts +58 -0
- package/dist/ts/ribbon/models/ribbon-checkbox-settings.ts +74 -0
- package/dist/ts/ribbon/models/ribbon-collection-model.d.ts +30 -0
- package/dist/ts/ribbon/models/ribbon-collection.d.ts +33 -0
- package/dist/ts/ribbon/models/ribbon-collection.ts +45 -0
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings-model.d.ts +137 -0
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings.d.ts +129 -0
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings.ts +165 -0
- package/dist/ts/ribbon/models/ribbon-combobox-settings-model.d.ts +275 -0
- package/dist/ts/ribbon/models/ribbon-combobox-settings.d.ts +257 -0
- package/dist/ts/ribbon/models/ribbon-combobox-settings.ts +313 -0
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings-model.d.ts +30 -0
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings.d.ts +33 -0
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings.ts +44 -0
- package/dist/ts/ribbon/models/ribbon-dropdown-settings-model.d.ts +114 -0
- package/dist/ts/ribbon/models/ribbon-dropdown-settings.d.ts +107 -0
- package/dist/ts/ribbon/models/ribbon-dropdown-settings.ts +139 -0
- package/dist/ts/ribbon/models/ribbon-file-menu-settings-model.d.ts +123 -0
- package/dist/ts/ribbon/models/ribbon-file-menu-settings.d.ts +173 -0
- package/dist/ts/ribbon/models/ribbon-file-menu-settings.ts +220 -0
- package/dist/ts/ribbon/models/ribbon-gallery-group-model.d.ts +44 -0
- package/dist/ts/ribbon/models/ribbon-gallery-group.d.ts +38 -0
- package/dist/ts/ribbon/models/ribbon-gallery-group.ts +50 -0
- package/dist/ts/ribbon/models/ribbon-gallery-item-model.d.ts +43 -0
- package/dist/ts/ribbon/models/ribbon-gallery-item.d.ts +38 -0
- package/dist/ts/ribbon/models/ribbon-gallery-item.ts +47 -0
- package/dist/ts/ribbon/models/ribbon-gallery-settings-model.d.ts +108 -0
- package/dist/ts/ribbon/models/ribbon-gallery-settings.d.ts +95 -0
- package/dist/ts/ribbon/models/ribbon-gallery-settings.ts +123 -0
- package/dist/ts/ribbon/models/ribbon-group-button-item-model.d.ts +64 -0
- package/dist/ts/ribbon/models/ribbon-group-button-item.d.ts +65 -0
- package/dist/ts/ribbon/models/ribbon-group-button-item.ts +85 -0
- package/dist/ts/ribbon/models/ribbon-group-button-settings-model.d.ts +32 -0
- package/dist/ts/ribbon/models/ribbon-group-button-settings.d.ts +29 -0
- package/dist/ts/ribbon/models/ribbon-group-button-settings.ts +38 -0
- package/dist/ts/ribbon/models/ribbon-group-model.d.ts +112 -0
- package/dist/ts/ribbon/models/ribbon-group.d.ts +105 -0
- package/dist/ts/ribbon/models/ribbon-group.ts +138 -0
- package/dist/ts/ribbon/models/ribbon-item-model.d.ts +144 -0
- package/dist/ts/ribbon/models/ribbon-item.d.ts +141 -0
- package/dist/ts/ribbon/models/ribbon-item.ts +190 -0
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings-model.d.ts +114 -0
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings.d.ts +107 -0
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings.ts +140 -0
- package/dist/ts/ribbon/models/ribbon-tab-model.d.ts +44 -0
- package/dist/ts/ribbon/models/ribbon-tab.d.ts +45 -0
- package/dist/ts/ribbon/models/ribbon-tab.ts +61 -0
- package/dist/ts/ribbon/models/ribbon-tooltip-model.d.ts +43 -0
- package/dist/ts/ribbon/models/ribbon-tooltip.d.ts +36 -0
- package/dist/ts/ribbon/models/ribbon-tooltip.ts +47 -0
- package/dist/ts/ribbon/modules/index.d.ts +4 -0
- package/dist/ts/ribbon/modules/index.ts +5 -0
- package/dist/ts/ribbon/modules/ribbon-backstage.d.ts +117 -0
- package/dist/ts/ribbon/modules/ribbon-backstage.ts +620 -0
- package/dist/ts/ribbon/modules/ribbon-contextualtab.d.ts +27 -0
- package/dist/ts/ribbon/modules/ribbon-contextualtab.ts +93 -0
- package/dist/ts/ribbon/modules/ribbon-filemenu.d.ts +96 -0
- package/dist/ts/ribbon/modules/ribbon-filemenu.ts +353 -0
- package/dist/ts/ribbon/modules/ribbon-keytip.d.ts +56 -0
- package/dist/ts/ribbon/modules/ribbon-keytip.ts +580 -0
- package/package.json +55 -19
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Ribbon } from '../base/ribbon';
|
|
2
|
+
import { RibbonItemModel } from '../models';
|
|
3
|
+
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the items of Ribbon.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RibbonGroupButton {
|
|
8
|
+
private parent;
|
|
9
|
+
private count;
|
|
10
|
+
private isSelected;
|
|
11
|
+
private grpBtnIndex;
|
|
12
|
+
constructor(parent: Ribbon);
|
|
13
|
+
protected getModuleName(): string;
|
|
14
|
+
protected destroy(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Creates Group Button
|
|
17
|
+
*
|
|
18
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
19
|
+
* @param {HTMLElement} itemElement - Gets the ribbon item element.
|
|
20
|
+
* @returns {void}
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
createGroupButton(item: RibbonItemModel, itemElement: HTMLElement): void;
|
|
24
|
+
private groupButtonClicked;
|
|
25
|
+
/**
|
|
26
|
+
* updates group button in mode switching
|
|
27
|
+
*
|
|
28
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
29
|
+
* @param {HTMLElement} itemElement - Gets the ribbon item element.
|
|
30
|
+
* @returns {void}
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
switchGroupButton(item: RibbonItemModel, itemElement: HTMLElement): void;
|
|
34
|
+
private handleFocusState;
|
|
35
|
+
private addGroupButtonHeader;
|
|
36
|
+
private handleGroupButtonNavigation;
|
|
37
|
+
/**
|
|
38
|
+
* Adds the additional event handlers as the item moved into overflow popup.
|
|
39
|
+
*
|
|
40
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
41
|
+
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
42
|
+
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
43
|
+
* @returns {void}
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
|
|
47
|
+
/**
|
|
48
|
+
* Removes the additional event handlers as the item moved into overflow popup.
|
|
49
|
+
*
|
|
50
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
51
|
+
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
52
|
+
* @returns {void}
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
|
|
56
|
+
/**
|
|
57
|
+
* Removes DropDown.
|
|
58
|
+
*
|
|
59
|
+
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
60
|
+
* @returns {void}
|
|
61
|
+
* @hidden
|
|
62
|
+
*/
|
|
63
|
+
destroyDropDown(item: RibbonItemModel): void;
|
|
64
|
+
/**
|
|
65
|
+
* Updates the group button size.
|
|
66
|
+
*
|
|
67
|
+
* @param {HTMLElement} itemElement - Gets the group button container element.
|
|
68
|
+
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
69
|
+
* @returns {void}
|
|
70
|
+
* @hidden
|
|
71
|
+
*/
|
|
72
|
+
updateGroupButtonSize(itemElement: HTMLElement, item: RibbonItemModel): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { EventHandler, KeyboardEventArgs, getComponent, remove } from '@syncfusion/ej2-base';
|
|
2
|
+
import { Ribbon } from '../base/ribbon';
|
|
3
|
+
import { RibbonGroupButtonItem, RibbonGroupButtonItemModel, RibbonGroupButtonSettingsModel, RibbonItemModel } from '../models';
|
|
4
|
+
import * as constants from '../base/constant';
|
|
5
|
+
import { Button } from '@syncfusion/ej2-buttons';
|
|
6
|
+
import { BeforeClickGroupButtonEventArgs, ClickGroupButtonEventArgs, RibbonGroupButtonSelection, RibbonItemSize } from '../base/interface';
|
|
7
|
+
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
8
|
+
import { createTooltip, isTooltipPresent, setCustomAttributes } from '../base/utils';
|
|
9
|
+
import { Popup, Tooltip } from '@syncfusion/ej2-popups';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Defines the items of Ribbon.
|
|
13
|
+
*/
|
|
14
|
+
export class RibbonGroupButton {
|
|
15
|
+
private parent: Ribbon;
|
|
16
|
+
private count: number;
|
|
17
|
+
private isSelected: boolean;
|
|
18
|
+
private grpBtnIndex: number = 0;
|
|
19
|
+
|
|
20
|
+
constructor(parent: Ribbon) {
|
|
21
|
+
this.parent = parent;
|
|
22
|
+
this.isSelected = false;
|
|
23
|
+
}
|
|
24
|
+
protected getModuleName(): string {
|
|
25
|
+
return 'ribbonGroupButton';
|
|
26
|
+
}
|
|
27
|
+
protected destroy(): void {
|
|
28
|
+
this.parent = null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates Group Button
|
|
33
|
+
*
|
|
34
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
35
|
+
* @param {HTMLElement} itemElement - Gets the ribbon item element.
|
|
36
|
+
* @returns {void}
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
public createGroupButton(item: RibbonItemModel, itemElement: HTMLElement): void {
|
|
40
|
+
const groupBtnSettings: RibbonGroupButtonSettingsModel = item.groupButtonSettings;
|
|
41
|
+
this.count = 0;
|
|
42
|
+
const btnContainerEle: HTMLElement = this.parent.createElement('div', {
|
|
43
|
+
id: item.id + constants.RIBBON_GROUP_BUTTON_ID,
|
|
44
|
+
className: 'e-btn-group'
|
|
45
|
+
});
|
|
46
|
+
itemElement.appendChild(btnContainerEle);
|
|
47
|
+
for (let i: number = 0; i < groupBtnSettings.items.length; i++) {
|
|
48
|
+
if ((groupBtnSettings.items[parseInt(i.toString(), 10)].iconCss)) {
|
|
49
|
+
const groupButtonEle: HTMLButtonElement = this.parent.createElement('button', {
|
|
50
|
+
id: item.id + constants.RIBBON_GROUP_BUTTON_ID + i,
|
|
51
|
+
className: constants.RIBBON_GROUP_BUTTON
|
|
52
|
+
});
|
|
53
|
+
btnContainerEle.appendChild(groupButtonEle);
|
|
54
|
+
new Button({
|
|
55
|
+
iconCss: groupBtnSettings.items[parseInt(i.toString(), 10)].iconCss,
|
|
56
|
+
disabled: item.disabled,
|
|
57
|
+
enableRtl: this.parent.enableRtl,
|
|
58
|
+
content: item.activeSize === RibbonItemSize.Small ? '' : groupBtnSettings.items[parseInt(i.toString(), 10)].content,
|
|
59
|
+
iconPosition: item.activeSize === RibbonItemSize.Large ? 'Top' : 'Left'
|
|
60
|
+
}, groupButtonEle);
|
|
61
|
+
if (groupBtnSettings.items[parseInt(i.toString(), 10)].htmlAttributes) {
|
|
62
|
+
setCustomAttributes(groupButtonEle, groupBtnSettings.items[parseInt(i.toString(), 10)].htmlAttributes);
|
|
63
|
+
}
|
|
64
|
+
if (groupBtnSettings.items[parseInt(i.toString(), 10)].content) {
|
|
65
|
+
groupButtonEle.classList.add(constants.RIBBON_GROUP_BUTTON_CONTENT);
|
|
66
|
+
groupButtonEle.setAttribute('aria-label', groupBtnSettings.items[parseInt(i.toString(), 10)].content);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
groupButtonEle.setAttribute('aria-label', 'groupbuttonitem');
|
|
70
|
+
}
|
|
71
|
+
const buttonEle: HTMLElement = itemElement.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i);
|
|
72
|
+
if (groupBtnSettings.selection === RibbonGroupButtonSelection.Single) {
|
|
73
|
+
btnContainerEle.classList.add(constants.RIBBON_SINGLE_BUTTON_SELECTION);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
btnContainerEle.classList.add(constants.RIBBON_MULTIPLE_BUTTON_SELECTION);
|
|
77
|
+
}
|
|
78
|
+
if (groupBtnSettings.items[parseInt(i.toString(), 10)].selected) {
|
|
79
|
+
if (groupBtnSettings.selection === RibbonGroupButtonSelection.Multiple) {
|
|
80
|
+
buttonEle.classList.add('e-active');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if (this.count < 1) {
|
|
84
|
+
buttonEle.classList.add('e-active');
|
|
85
|
+
this.count++;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
this.grpBtnIndex = i;
|
|
89
|
+
}
|
|
90
|
+
if (groupBtnSettings.items[parseInt(i.toString(), 10)].ribbonTooltipSettings &&
|
|
91
|
+
isTooltipPresent(groupBtnSettings.items[parseInt(i.toString(), 10)].ribbonTooltipSettings)) {
|
|
92
|
+
groupButtonEle.classList.add(constants.RIBBON_TOOLTIP_TARGET);
|
|
93
|
+
this.parent.tooltipData.push({
|
|
94
|
+
id: groupButtonEle.id, data: groupBtnSettings.items[parseInt(i.toString(), 10)].ribbonTooltipSettings
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
EventHandler.add(buttonEle, 'click', this.groupButtonClicked.bind(this, i, item, groupBtnSettings), this);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (this.parent.activeLayout === 'Simplified') {
|
|
101
|
+
let dropdownIcon: string;
|
|
102
|
+
let activeEleCount: number = 0;
|
|
103
|
+
let count: number = 0;
|
|
104
|
+
const buttonEle: HTMLButtonElement = this.parent.createElement('button', {
|
|
105
|
+
id: item.id
|
|
106
|
+
});
|
|
107
|
+
itemElement.appendChild(buttonEle);
|
|
108
|
+
for (let i: number = 0; i < groupBtnSettings.items.length; i++) {
|
|
109
|
+
if (item.groupButtonSettings.items[parseInt(i.toString(), 10)].selected &&
|
|
110
|
+
!this.isSelected && groupBtnSettings.selection === RibbonGroupButtonSelection.Single) {
|
|
111
|
+
dropdownIcon = item.groupButtonSettings.items[parseInt(i.toString(), 10)].iconCss;
|
|
112
|
+
this.isSelected = true;
|
|
113
|
+
}
|
|
114
|
+
else if (item.groupButtonSettings.items[parseInt(i.toString(), 10)].selected &&
|
|
115
|
+
groupBtnSettings.selection === RibbonGroupButtonSelection.Multiple) {
|
|
116
|
+
activeEleCount++;
|
|
117
|
+
if (activeEleCount === 1) {
|
|
118
|
+
dropdownIcon = item.groupButtonSettings.items[parseInt(i.toString(), 10)].iconCss;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
dropdownIcon = null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
while (count < item.groupButtonSettings.items.length && !this.isSelected && !dropdownIcon) {
|
|
126
|
+
if (item.groupButtonSettings.items[parseInt(count.toString(), 10)].iconCss) {
|
|
127
|
+
dropdownIcon = item.groupButtonSettings.items[parseInt(count.toString(), 10)].iconCss;
|
|
128
|
+
this.isSelected = true;
|
|
129
|
+
}
|
|
130
|
+
count++;
|
|
131
|
+
}
|
|
132
|
+
const dropdown: DropDownButton = new DropDownButton({
|
|
133
|
+
iconCss: dropdownIcon,
|
|
134
|
+
target: btnContainerEle,
|
|
135
|
+
enableRtl: this.parent.enableRtl,
|
|
136
|
+
cssClass: 'e-ribbon-dropdown-group-button',
|
|
137
|
+
disabled: item.disabled
|
|
138
|
+
}, buttonEle);
|
|
139
|
+
if (groupBtnSettings.header) {
|
|
140
|
+
const dropDownPopup: Popup = dropdown.dropDown;
|
|
141
|
+
this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
|
|
142
|
+
}
|
|
143
|
+
buttonEle.onclick = buttonEle.onkeydown = () => {
|
|
144
|
+
this.handleFocusState(item, itemElement);
|
|
145
|
+
};
|
|
146
|
+
btnContainerEle.onkeydown = (e: KeyboardEventArgs) => {
|
|
147
|
+
if (this.parent.activeLayout === 'Simplified') {
|
|
148
|
+
this.handleGroupButtonNavigation(e, item);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
createTooltip(btnContainerEle, this.parent);
|
|
152
|
+
this.isSelected = false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private groupButtonClicked(itemIndex: number, item: RibbonItemModel, grpBtnSettings: RibbonGroupButtonSettingsModel): void {
|
|
157
|
+
const previousItems: RibbonGroupButtonItemModel[] = [];
|
|
158
|
+
const selectingItems: RibbonGroupButtonItemModel[] = [];
|
|
159
|
+
const selectedItems: RibbonGroupButtonItemModel[] = [];
|
|
160
|
+
const groupButtonEle: HTMLButtonElement = document.querySelector('#' + item.id);
|
|
161
|
+
let dropdown: DropDownButton;
|
|
162
|
+
for (let j: number = 0; j < grpBtnSettings.items.length; j++) {
|
|
163
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + j)) {
|
|
164
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + j).classList.contains('e-active')) {
|
|
165
|
+
previousItems.push(grpBtnSettings.items[parseInt(j.toString(), 10)]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active'))) {
|
|
170
|
+
selectingItems.push(grpBtnSettings.items[parseInt(itemIndex.toString(), 10)]);
|
|
171
|
+
}
|
|
172
|
+
const eventArgs: BeforeClickGroupButtonEventArgs = {
|
|
173
|
+
cancel: false, previousItems: previousItems, selectingItems: selectingItems
|
|
174
|
+
};
|
|
175
|
+
if (grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].beforeClick) {
|
|
176
|
+
grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].beforeClick.call(this, eventArgs);
|
|
177
|
+
}
|
|
178
|
+
if (eventArgs.cancel) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
if (grpBtnSettings.selection === RibbonGroupButtonSelection.Single) {
|
|
183
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.contains(constants.RIBBON_MULTIPLE_BUTTON_SELECTION)) {
|
|
184
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.remove(constants.RIBBON_MULTIPLE_BUTTON_SELECTION);
|
|
185
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.add(constants.RIBBON_SINGLE_BUTTON_SELECTION);
|
|
186
|
+
}
|
|
187
|
+
for (let j: number = 0; j < grpBtnSettings.items.length; j++) {
|
|
188
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + j) && document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + j).classList.contains('e-active')) {
|
|
189
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + j).classList.remove('e-active');
|
|
190
|
+
(grpBtnSettings.items[parseInt(j.toString(), 10)] as RibbonGroupButtonItem).
|
|
191
|
+
setProperties({ selected: false }, true);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.toggle('e-active');
|
|
195
|
+
(grpBtnSettings.items[parseInt(itemIndex.toString(), 10)] as RibbonGroupButtonItem).setProperties({ selected: true }, true);
|
|
196
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active') && this.parent.activeLayout === 'Simplified') {
|
|
197
|
+
this.grpBtnIndex = itemIndex;
|
|
198
|
+
dropdown = getComponent(groupButtonEle, DropDownButton);
|
|
199
|
+
dropdown.setProperties({
|
|
200
|
+
iconCss: grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].iconCss
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.contains(constants.RIBBON_SINGLE_BUTTON_SELECTION)) {
|
|
206
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.remove(constants.RIBBON_SINGLE_BUTTON_SELECTION);
|
|
207
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID).classList.add(constants.RIBBON_MULTIPLE_BUTTON_SELECTION);
|
|
208
|
+
}
|
|
209
|
+
document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.toggle('e-active');
|
|
210
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active')) {
|
|
211
|
+
(grpBtnSettings.items[parseInt(itemIndex.toString(), 10)] as RibbonGroupButtonItem).
|
|
212
|
+
setProperties({ selected: true }, true);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
(grpBtnSettings.items[parseInt(itemIndex.toString(), 10)] as RibbonGroupButtonItem).
|
|
216
|
+
setProperties({ selected: false }, true);
|
|
217
|
+
}
|
|
218
|
+
let activeEleCount: number = 0;
|
|
219
|
+
for (let n: number = 0; n < grpBtnSettings.items.length; n++) {
|
|
220
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + n) && document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + n).classList.contains('e-active') && this.parent.activeLayout === 'Simplified' && n !== itemIndex) {
|
|
221
|
+
this.isSelected = true;
|
|
222
|
+
activeEleCount++;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (this.parent.activeLayout === 'Simplified') {
|
|
226
|
+
let dropdownIcon: string = null;
|
|
227
|
+
let itemsCount: number = 0;
|
|
228
|
+
dropdown = getComponent(groupButtonEle, DropDownButton);
|
|
229
|
+
if (!this.isSelected) {
|
|
230
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active')) {
|
|
231
|
+
dropdownIcon = grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].iconCss;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
if (activeEleCount === 1 && !(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active'))) {
|
|
236
|
+
for (let n: number = 0; n < grpBtnSettings.items.length; n++) {
|
|
237
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + n) && document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + n).classList.contains('e-active')) {
|
|
238
|
+
dropdownIcon = grpBtnSettings.items[parseInt(n.toString(), 10)].iconCss;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
while (itemsCount < grpBtnSettings.items.length && !dropdownIcon) {
|
|
244
|
+
if (grpBtnSettings.items[parseInt(itemsCount.toString(), 10)].iconCss) {
|
|
245
|
+
dropdownIcon = grpBtnSettings.items[parseInt(itemsCount.toString(), 10)].iconCss;
|
|
246
|
+
}
|
|
247
|
+
itemsCount++;
|
|
248
|
+
}
|
|
249
|
+
dropdown.setProperties({ iconCss: dropdownIcon});
|
|
250
|
+
this.grpBtnIndex = itemIndex;
|
|
251
|
+
}
|
|
252
|
+
this.isSelected = false;
|
|
253
|
+
}
|
|
254
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + itemIndex).classList.contains('e-active')) {
|
|
255
|
+
selectedItems.push(grpBtnSettings.items[parseInt(itemIndex.toString(), 10)]);
|
|
256
|
+
}
|
|
257
|
+
const eventArgs: ClickGroupButtonEventArgs = { previousItems: previousItems, selectedItems: selectedItems };
|
|
258
|
+
if (grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].click) {
|
|
259
|
+
grpBtnSettings.items[parseInt(itemIndex.toString(), 10)].click.call(this, eventArgs);
|
|
260
|
+
}
|
|
261
|
+
if (this.parent.activeLayout === 'Simplified' && groupButtonEle) {
|
|
262
|
+
dropdown = getComponent(groupButtonEle, DropDownButton);
|
|
263
|
+
dropdown.toggle();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* updates group button in mode switching
|
|
270
|
+
*
|
|
271
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
272
|
+
* @param {HTMLElement} itemElement - Gets the ribbon item element.
|
|
273
|
+
* @returns {void}
|
|
274
|
+
* @hidden
|
|
275
|
+
*/
|
|
276
|
+
public switchGroupButton(item: RibbonItemModel, itemElement: HTMLElement): void {
|
|
277
|
+
const groupBtnSettings: RibbonGroupButtonSettingsModel = item.groupButtonSettings;
|
|
278
|
+
let dropdownIcon: string = null;
|
|
279
|
+
let activeEleCount: number = 0;
|
|
280
|
+
let itemsCount: number = 0;
|
|
281
|
+
if (this.parent.activeLayout === 'Simplified') {
|
|
282
|
+
const containerEle: HTMLButtonElement = itemElement.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID);
|
|
283
|
+
const buttonEle: HTMLButtonElement = this.parent.createElement('button', {
|
|
284
|
+
id: item.id
|
|
285
|
+
});
|
|
286
|
+
itemElement.appendChild(buttonEle);
|
|
287
|
+
for (let i: number = 0; i < groupBtnSettings.items.length; i++) {
|
|
288
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i)) {
|
|
289
|
+
if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i).classList.contains('e-active') && groupBtnSettings.selection === RibbonGroupButtonSelection.Single) {
|
|
290
|
+
dropdownIcon = groupBtnSettings.items[parseInt(i.toString(), 10)].iconCss;
|
|
291
|
+
}
|
|
292
|
+
else if (document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i).classList.contains('e-active') && groupBtnSettings.selection === RibbonGroupButtonSelection.Multiple) {
|
|
293
|
+
activeEleCount++;
|
|
294
|
+
if (activeEleCount === 1) {
|
|
295
|
+
dropdownIcon = groupBtnSettings.items[parseInt(i.toString(), 10)].iconCss;
|
|
296
|
+
}
|
|
297
|
+
else if (activeEleCount > 1) {
|
|
298
|
+
dropdownIcon = null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
while (itemsCount < groupBtnSettings.items.length && !dropdownIcon) {
|
|
304
|
+
if (groupBtnSettings.items[parseInt(itemsCount.toString(), 10)].iconCss) {
|
|
305
|
+
dropdownIcon = groupBtnSettings.items[parseInt(itemsCount.toString(), 10)].iconCss;
|
|
306
|
+
}
|
|
307
|
+
itemsCount++;
|
|
308
|
+
}
|
|
309
|
+
const dropdown: DropDownButton = new DropDownButton({
|
|
310
|
+
iconCss: dropdownIcon,
|
|
311
|
+
target: containerEle,
|
|
312
|
+
enableRtl: this.parent.enableRtl,
|
|
313
|
+
cssClass: 'e-ribbon-dropdown-group-button',
|
|
314
|
+
disabled: item.disabled
|
|
315
|
+
}, buttonEle);
|
|
316
|
+
if (groupBtnSettings.header) {
|
|
317
|
+
const dropDownPopup: Popup = dropdown.dropDown;
|
|
318
|
+
this.addGroupButtonHeader(item.id, groupBtnSettings, dropDownPopup.element);
|
|
319
|
+
}
|
|
320
|
+
buttonEle.onclick = buttonEle.onkeydown = () => {
|
|
321
|
+
this.handleFocusState(item, itemElement);
|
|
322
|
+
};
|
|
323
|
+
containerEle.onkeydown = (e: KeyboardEventArgs) => {
|
|
324
|
+
if (this.parent.activeLayout === 'Simplified') {
|
|
325
|
+
this.handleGroupButtonNavigation(e, item);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
createTooltip(containerEle, this.parent);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
const groupButtonEle: HTMLButtonElement = itemElement.querySelector('#' + item.id);
|
|
332
|
+
const dropdown: DropDownButton = getComponent(groupButtonEle, DropDownButton);
|
|
333
|
+
itemElement.appendChild(dropdown.target as HTMLElement);
|
|
334
|
+
if (groupButtonEle) {
|
|
335
|
+
dropdown.destroy();
|
|
336
|
+
remove(groupButtonEle);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
private handleFocusState(item: RibbonItemModel, itemElement: HTMLElement): void {
|
|
342
|
+
if (itemElement.querySelector('#' + item.id).classList.contains('e-active')) {
|
|
343
|
+
const defaultSelectedBtn: HTMLElement = document.querySelector('#' + item.id + '_grpbtn').querySelector('.' + constants.RIBBON_GROUP_BUTTON + '.e-active');
|
|
344
|
+
if (defaultSelectedBtn) {
|
|
345
|
+
defaultSelectedBtn.focus();
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + 0) as HTMLElement).focus();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
private addGroupButtonHeader(itemID: string, groupBtnSettings: RibbonGroupButtonSettingsModel, popupEle: HTMLElement): void {
|
|
354
|
+
const groupButtonHeader: HTMLElement = this.parent.createElement('div', {
|
|
355
|
+
className: 'e-ribbon-groupbutton-header',
|
|
356
|
+
id: itemID + constants.HEADER_ID,
|
|
357
|
+
innerHTML: groupBtnSettings.header
|
|
358
|
+
});
|
|
359
|
+
popupEle.insertBefore(groupButtonHeader, popupEle.firstChild);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
private handleGroupButtonNavigation(e: KeyboardEventArgs, item: RibbonItemModel): void {
|
|
363
|
+
const groupButtonEle: HTMLElement = document.querySelector('#' + item.id) as HTMLElement;
|
|
364
|
+
const dropdown: DropDownButton = getComponent(groupButtonEle, DropDownButton);
|
|
365
|
+
const targetEle: HTMLElement = dropdown.target as HTMLElement;
|
|
366
|
+
let isOverflowPopup: boolean = false;
|
|
367
|
+
if (this.parent.activeLayout === 'Simplified' && targetEle.closest('.e-ribbon-dropdown-group-button').classList.contains(constants.RIBBON_GROUP_BUTTON_OVERFLOW_POPUP)) {
|
|
368
|
+
isOverflowPopup = true;
|
|
369
|
+
}
|
|
370
|
+
if (e.key === 'Tab') { e.preventDefault(); }
|
|
371
|
+
const groupBtnSettings: RibbonGroupButtonSettingsModel = item.groupButtonSettings;
|
|
372
|
+
if ((e.key === 'ArrowRight' && !isOverflowPopup) || (e.key === 'ArrowDown' && isOverflowPopup)) {
|
|
373
|
+
if (!this.parent.enableRtl || (e.key === 'ArrowDown' && isOverflowPopup)) {
|
|
374
|
+
this.grpBtnIndex++;
|
|
375
|
+
if (this.grpBtnIndex < groupBtnSettings.items.length) {
|
|
376
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.grpBtnIndex = 0;
|
|
380
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
if (this.grpBtnIndex === 0) {
|
|
385
|
+
this.grpBtnIndex = groupBtnSettings.items.length - 1;
|
|
386
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.grpBtnIndex--;
|
|
390
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else if ((e.key === 'ArrowLeft' && !isOverflowPopup) || (e.key === 'ArrowUp' && isOverflowPopup)) {
|
|
395
|
+
if (!this.parent.enableRtl || (e.key === 'ArrowUp' && isOverflowPopup)) {
|
|
396
|
+
if (this.grpBtnIndex === 0) {
|
|
397
|
+
this.grpBtnIndex = groupBtnSettings.items.length - 1;
|
|
398
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.grpBtnIndex--;
|
|
402
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.grpBtnIndex++;
|
|
407
|
+
if (this.grpBtnIndex < groupBtnSettings.items.length) {
|
|
408
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
this.grpBtnIndex = 0;
|
|
412
|
+
(document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + (this.grpBtnIndex)) as HTMLElement).focus();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Adds the additional event handlers as the item moved into overflow popup.
|
|
420
|
+
*
|
|
421
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
422
|
+
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
423
|
+
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
424
|
+
* @returns {void}
|
|
425
|
+
* @hidden
|
|
426
|
+
*/
|
|
427
|
+
public addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void {
|
|
428
|
+
const groupBtnSettings: RibbonGroupButtonSettingsModel = item.groupButtonSettings;
|
|
429
|
+
let isIconOnly: boolean = true;
|
|
430
|
+
const groupButtonEle: HTMLElement = itemEle.querySelector('#' + item.id) as HTMLElement;
|
|
431
|
+
if (groupButtonEle) {
|
|
432
|
+
const dropdown: DropDownButton = getComponent(groupButtonEle, DropDownButton);
|
|
433
|
+
dropdown.setProperties({ cssClass: dropdown.cssClass + constants.SPACE + constants.RIBBON_GROUP_BUTTON_OVERFLOW_POPUP, content: groupBtnSettings.header ? groupBtnSettings.header : ''});
|
|
434
|
+
const targetEle: HTMLElement = dropdown.target as HTMLElement;
|
|
435
|
+
if (targetEle.children.length) {
|
|
436
|
+
for (let i: number = 0; i < targetEle.children.length; i++) {
|
|
437
|
+
if (groupBtnSettings.items[parseInt(i.toString(), 10)].content) {
|
|
438
|
+
isIconOnly = false;
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (isIconOnly) {
|
|
443
|
+
targetEle.classList.add('e-icon-btn');
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
targetEle.onclick = () => {
|
|
447
|
+
if (this.parent.activeLayout === 'Simplified' && targetEle.closest('.e-ribbon-dropdown-group-button').classList.contains(constants.RIBBON_GROUP_BUTTON_OVERFLOW_POPUP)) {
|
|
448
|
+
if (overflowButton.element.classList.contains('e-active')) {
|
|
449
|
+
overflowButton.toggle();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
const overflowGroupButtonEle: HTMLElement = itemEle.querySelector('#' + item.id + '_grpbtn') as HTMLElement;
|
|
455
|
+
if (this.parent.activeLayout === 'Classic' && overflowGroupButtonEle) {
|
|
456
|
+
overflowGroupButtonEle.onclick = () => {
|
|
457
|
+
if (overflowButton.element.classList.contains('e-active')) {
|
|
458
|
+
overflowButton.toggle();
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Removes the additional event handlers as the item moved into overflow popup.
|
|
466
|
+
*
|
|
467
|
+
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
468
|
+
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
469
|
+
* @returns {void}
|
|
470
|
+
* @hidden
|
|
471
|
+
*/
|
|
472
|
+
public removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
473
|
+
const groupButtonEle: HTMLElement = itemEle.querySelector('#' + item.id) as HTMLElement;
|
|
474
|
+
if (groupButtonEle) {
|
|
475
|
+
const dropdown: DropDownButton = getComponent(groupButtonEle, DropDownButton);
|
|
476
|
+
const targetEle: HTMLElement = dropdown.target as HTMLElement;
|
|
477
|
+
if (targetEle.classList.contains('e-icon-btn')) {
|
|
478
|
+
targetEle.classList.remove('e-icon-btn');
|
|
479
|
+
}
|
|
480
|
+
let cssClass: string[] = dropdown.cssClass.split(constants.SPACE);
|
|
481
|
+
cssClass = cssClass.filter((value: string) => value !== constants.RIBBON_GROUP_BUTTON_OVERFLOW_POPUP);
|
|
482
|
+
dropdown.setProperties({ cssClass: cssClass.join(constants.SPACE), content: '' });
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Removes DropDown.
|
|
488
|
+
*
|
|
489
|
+
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
490
|
+
* @returns {void}
|
|
491
|
+
* @hidden
|
|
492
|
+
*/
|
|
493
|
+
public destroyDropDown(item: RibbonItemModel): void {
|
|
494
|
+
const groupButtonEle: HTMLButtonElement = document.querySelector('#' + item.id);
|
|
495
|
+
if (groupButtonEle) {
|
|
496
|
+
const dropdown: DropDownButton = getComponent(groupButtonEle, DropDownButton);
|
|
497
|
+
const tooltip: Tooltip = getComponent(dropdown.target as HTMLElement, Tooltip);
|
|
498
|
+
tooltip.destroy();
|
|
499
|
+
dropdown.destroy();
|
|
500
|
+
remove(groupButtonEle);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Updates the group button size.
|
|
506
|
+
*
|
|
507
|
+
* @param {HTMLElement} itemElement - Gets the group button container element.
|
|
508
|
+
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
509
|
+
* @returns {void}
|
|
510
|
+
* @hidden
|
|
511
|
+
*/
|
|
512
|
+
public updateGroupButtonSize(itemElement: HTMLElement, item: RibbonItemModel): void {
|
|
513
|
+
const groupBtnSettings: RibbonGroupButtonSettingsModel = item.groupButtonSettings;
|
|
514
|
+
let buttonEle: HTMLElement;
|
|
515
|
+
for (let i: number = 0; i < groupBtnSettings.items.length; i++) {
|
|
516
|
+
if (this.parent.activeLayout === 'Classic') {
|
|
517
|
+
buttonEle = itemElement.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i);
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
buttonEle = document.querySelector('#' + item.id + constants.RIBBON_GROUP_BUTTON_ID + i);
|
|
521
|
+
}
|
|
522
|
+
if (buttonEle) {
|
|
523
|
+
const buttonObj: Button = getComponent(buttonEle, Button);
|
|
524
|
+
buttonObj.setProperties({
|
|
525
|
+
iconPosition: item.activeSize === RibbonItemSize.Large ? 'Top' : 'Left',
|
|
526
|
+
content: item.activeSize === RibbonItemSize.Small ? '' : groupBtnSettings.items[parseInt(i.toString(), 10)].content
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|