@syncfusion/ej2-ribbon 31.1.17 → 31.1.22
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/dist/ej2-ribbon.umd.min.js +3 -3
- package/dist/ej2-ribbon.umd.min.js.map +1 -1
- package/dist/es6/ej2-ribbon.es2015.js +24 -5
- package/dist/es6/ej2-ribbon.es2015.js.map +1 -1
- package/dist/es6/ej2-ribbon.es5.js +24 -5
- package/dist/es6/ej2-ribbon.es5.js.map +1 -1
- package/dist/global/ej2-ribbon.min.js +3 -3
- package/dist/global/ej2-ribbon.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/package.json +17 -53
- package/src/ribbon/base/ribbon-model.d.ts +1 -1
- package/src/ribbon/base/ribbon.js +14 -5
- package/src/ribbon/items/ribbon-splitbutton.js +11 -0
- package/styles/bds-lite.css +9 -0
- package/styles/bds.css +9 -0
- package/styles/bootstrap-dark-lite.css +9 -0
- package/styles/bootstrap-dark.css +9 -0
- package/styles/bootstrap-lite.css +9 -0
- package/styles/bootstrap.css +9 -0
- package/styles/bootstrap4-lite.css +17 -0
- package/styles/bootstrap4.css +17 -0
- package/styles/bootstrap5-dark-lite.css +9 -0
- package/styles/bootstrap5-dark.css +9 -0
- package/styles/bootstrap5-lite.css +9 -0
- package/styles/bootstrap5.3-lite.css +9 -0
- package/styles/bootstrap5.3.css +9 -0
- package/styles/bootstrap5.css +9 -0
- package/styles/fabric-dark-lite.css +9 -0
- package/styles/fabric-dark.css +9 -0
- package/styles/fabric-lite.css +9 -0
- package/styles/fabric.css +9 -0
- package/styles/fluent-dark-lite.css +9 -0
- package/styles/fluent-dark.css +9 -0
- package/styles/fluent-lite.css +9 -0
- package/styles/fluent.css +9 -0
- package/styles/fluent2-lite.css +11 -2
- package/styles/fluent2.css +11 -2
- package/styles/highcontrast-light-lite.css +9 -0
- package/styles/highcontrast-light.css +9 -0
- package/styles/highcontrast-lite.css +9 -0
- package/styles/highcontrast.css +9 -0
- package/styles/material-dark-lite.css +9 -0
- package/styles/material-dark.css +9 -0
- package/styles/material-lite.css +9 -0
- package/styles/material.css +9 -0
- package/styles/material3-dark-lite.css +9 -0
- package/styles/material3-dark.css +9 -0
- package/styles/material3-lite.css +9 -0
- package/styles/material3.css +9 -0
- package/styles/ribbon/_fluent2-definition.scss +2 -2
- package/styles/ribbon/_layout.scss +7 -0
- package/styles/ribbon/bds.css +9 -0
- package/styles/ribbon/bootstrap-dark.css +9 -0
- package/styles/ribbon/bootstrap.css +9 -0
- package/styles/ribbon/bootstrap4.css +17 -0
- package/styles/ribbon/bootstrap5-dark.css +9 -0
- package/styles/ribbon/bootstrap5.3.css +9 -0
- package/styles/ribbon/bootstrap5.css +9 -0
- package/styles/ribbon/fabric-dark.css +9 -0
- package/styles/ribbon/fabric.css +9 -0
- package/styles/ribbon/fluent-dark.css +9 -0
- package/styles/ribbon/fluent.css +9 -0
- package/styles/ribbon/fluent2.css +11 -2
- package/styles/ribbon/highcontrast-light.css +9 -0
- package/styles/ribbon/highcontrast.css +9 -0
- package/styles/ribbon/material-dark.css +9 -0
- package/styles/ribbon/material.css +9 -0
- package/styles/ribbon/material3-dark.css +9 -0
- package/styles/ribbon/material3.css +9 -0
- package/styles/ribbon/tailwind-dark.css +9 -0
- package/styles/ribbon/tailwind.css +9 -0
- package/styles/ribbon/tailwind3.css +9 -0
- package/styles/tailwind-dark-lite.css +9 -0
- package/styles/tailwind-dark.css +9 -0
- package/styles/tailwind-lite.css +9 -0
- package/styles/tailwind.css +9 -0
- package/styles/tailwind3-lite.css +9 -0
- package/styles/tailwind3.css +9 -0
- package/dist/ts/index.d.ts +0 -1
- package/dist/ts/index.ts +0 -3
- package/dist/ts/ribbon/base/constant.d.ts +0 -201
- package/dist/ts/ribbon/base/constant.ts +0 -204
- package/dist/ts/ribbon/base/index.d.ts +0 -8
- package/dist/ts/ribbon/base/index.ts +0 -8
- package/dist/ts/ribbon/base/interface.d.ts +0 -398
- package/dist/ts/ribbon/base/interface.ts +0 -424
- package/dist/ts/ribbon/base/ribbon-model.d.ts +0 -195
- package/dist/ts/ribbon/base/ribbon.d.ts +0 -608
- package/dist/ts/ribbon/base/ribbon.ts +0 -4896
- package/dist/ts/ribbon/base/utils.d.ts +0 -139
- package/dist/ts/ribbon/base/utils.ts +0 -341
- package/dist/ts/ribbon/index.d.ts +0 -7
- package/dist/ts/ribbon/index.ts +0 -7
- package/dist/ts/ribbon/items/index.d.ts +0 -8
- package/dist/ts/ribbon/items/index.ts +0 -8
- package/dist/ts/ribbon/items/ribbon-button.d.ts +0 -64
- package/dist/ts/ribbon/items/ribbon-button.ts +0 -160
- package/dist/ts/ribbon/items/ribbon-checkbox.d.ts +0 -55
- package/dist/ts/ribbon/items/ribbon-checkbox.ts +0 -130
- package/dist/ts/ribbon/items/ribbon-colorpicker.d.ts +0 -72
- package/dist/ts/ribbon/items/ribbon-colorpicker.ts +0 -228
- package/dist/ts/ribbon/items/ribbon-combobox.d.ts +0 -77
- package/dist/ts/ribbon/items/ribbon-combobox.ts +0 -201
- package/dist/ts/ribbon/items/ribbon-dropdown.d.ts +0 -128
- package/dist/ts/ribbon/items/ribbon-dropdown.ts +0 -400
- package/dist/ts/ribbon/items/ribbon-gallery.d.ts +0 -97
- package/dist/ts/ribbon/items/ribbon-gallery.ts +0 -773
- package/dist/ts/ribbon/items/ribbon-groupbutton.d.ts +0 -73
- package/dist/ts/ribbon/items/ribbon-groupbutton.ts +0 -531
- package/dist/ts/ribbon/items/ribbon-splitbutton.d.ts +0 -85
- package/dist/ts/ribbon/items/ribbon-splitbutton.ts +0 -257
- package/dist/ts/ribbon/models/index.d.ts +0 -42
- package/dist/ts/ribbon/models/index.ts +0 -44
- package/dist/ts/ribbon/models/ribbon-back-button-model.d.ts +0 -29
- package/dist/ts/ribbon/models/ribbon-back-button.d.ts +0 -24
- package/dist/ts/ribbon/models/ribbon-back-button.ts +0 -31
- package/dist/ts/ribbon/models/ribbon-back-stage-settings-model.d.ts +0 -83
- package/dist/ts/ribbon/models/ribbon-back-stage-settings.d.ts +0 -81
- package/dist/ts/ribbon/models/ribbon-back-stage-settings.ts +0 -109
- package/dist/ts/ribbon/models/ribbon-backstage-item-model.d.ts +0 -69
- package/dist/ts/ribbon/models/ribbon-backstage-item.d.ts +0 -80
- package/dist/ts/ribbon/models/ribbon-backstage-item.ts +0 -102
- package/dist/ts/ribbon/models/ribbon-button-settings-model.d.ts +0 -64
- package/dist/ts/ribbon/models/ribbon-button-settings.d.ts +0 -63
- package/dist/ts/ribbon/models/ribbon-button-settings.ts +0 -80
- package/dist/ts/ribbon/models/ribbon-checkbox-settings-model.d.ts +0 -57
- package/dist/ts/ribbon/models/ribbon-checkbox-settings.d.ts +0 -58
- package/dist/ts/ribbon/models/ribbon-checkbox-settings.ts +0 -74
- package/dist/ts/ribbon/models/ribbon-collection-model.d.ts +0 -30
- package/dist/ts/ribbon/models/ribbon-collection.d.ts +0 -33
- package/dist/ts/ribbon/models/ribbon-collection.ts +0 -45
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings-model.d.ts +0 -137
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings.d.ts +0 -129
- package/dist/ts/ribbon/models/ribbon-colorpicker-settings.ts +0 -165
- package/dist/ts/ribbon/models/ribbon-combobox-settings-model.d.ts +0 -275
- package/dist/ts/ribbon/models/ribbon-combobox-settings.d.ts +0 -257
- package/dist/ts/ribbon/models/ribbon-combobox-settings.ts +0 -313
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings-model.d.ts +0 -30
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings.d.ts +0 -33
- package/dist/ts/ribbon/models/ribbon-contextual-tab-settings.ts +0 -44
- package/dist/ts/ribbon/models/ribbon-dropdown-settings-model.d.ts +0 -114
- package/dist/ts/ribbon/models/ribbon-dropdown-settings.d.ts +0 -107
- package/dist/ts/ribbon/models/ribbon-dropdown-settings.ts +0 -139
- package/dist/ts/ribbon/models/ribbon-file-menu-settings-model.d.ts +0 -123
- package/dist/ts/ribbon/models/ribbon-file-menu-settings.d.ts +0 -173
- package/dist/ts/ribbon/models/ribbon-file-menu-settings.ts +0 -220
- package/dist/ts/ribbon/models/ribbon-gallery-group-model.d.ts +0 -44
- package/dist/ts/ribbon/models/ribbon-gallery-group.d.ts +0 -38
- package/dist/ts/ribbon/models/ribbon-gallery-group.ts +0 -50
- package/dist/ts/ribbon/models/ribbon-gallery-item-model.d.ts +0 -43
- package/dist/ts/ribbon/models/ribbon-gallery-item.d.ts +0 -38
- package/dist/ts/ribbon/models/ribbon-gallery-item.ts +0 -47
- package/dist/ts/ribbon/models/ribbon-gallery-settings-model.d.ts +0 -108
- package/dist/ts/ribbon/models/ribbon-gallery-settings.d.ts +0 -95
- package/dist/ts/ribbon/models/ribbon-gallery-settings.ts +0 -123
- package/dist/ts/ribbon/models/ribbon-group-button-item-model.d.ts +0 -64
- package/dist/ts/ribbon/models/ribbon-group-button-item.d.ts +0 -65
- package/dist/ts/ribbon/models/ribbon-group-button-item.ts +0 -85
- package/dist/ts/ribbon/models/ribbon-group-button-settings-model.d.ts +0 -32
- package/dist/ts/ribbon/models/ribbon-group-button-settings.d.ts +0 -29
- package/dist/ts/ribbon/models/ribbon-group-button-settings.ts +0 -38
- package/dist/ts/ribbon/models/ribbon-group-model.d.ts +0 -112
- package/dist/ts/ribbon/models/ribbon-group.d.ts +0 -105
- package/dist/ts/ribbon/models/ribbon-group.ts +0 -138
- package/dist/ts/ribbon/models/ribbon-item-model.d.ts +0 -144
- package/dist/ts/ribbon/models/ribbon-item.d.ts +0 -141
- package/dist/ts/ribbon/models/ribbon-item.ts +0 -190
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings-model.d.ts +0 -114
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings.d.ts +0 -107
- package/dist/ts/ribbon/models/ribbon-splitbutton-settings.ts +0 -140
- package/dist/ts/ribbon/models/ribbon-tab-model.d.ts +0 -44
- package/dist/ts/ribbon/models/ribbon-tab.d.ts +0 -45
- package/dist/ts/ribbon/models/ribbon-tab.ts +0 -61
- package/dist/ts/ribbon/models/ribbon-tooltip-model.d.ts +0 -43
- package/dist/ts/ribbon/models/ribbon-tooltip.d.ts +0 -36
- package/dist/ts/ribbon/models/ribbon-tooltip.ts +0 -47
- package/dist/ts/ribbon/modules/index.d.ts +0 -4
- package/dist/ts/ribbon/modules/index.ts +0 -5
- package/dist/ts/ribbon/modules/ribbon-backstage.d.ts +0 -117
- package/dist/ts/ribbon/modules/ribbon-backstage.ts +0 -620
- package/dist/ts/ribbon/modules/ribbon-contextualtab.d.ts +0 -27
- package/dist/ts/ribbon/modules/ribbon-contextualtab.ts +0 -93
- package/dist/ts/ribbon/modules/ribbon-filemenu.d.ts +0 -96
- package/dist/ts/ribbon/modules/ribbon-filemenu.ts +0 -353
- package/dist/ts/ribbon/modules/ribbon-keytip.d.ts +0 -56
- package/dist/ts/ribbon/modules/ribbon-keytip.ts +0 -580
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { getComponent, merge } from '@syncfusion/ej2-base';
|
|
2
|
-
import { Button } from '@syncfusion/ej2-buttons';
|
|
3
|
-
import { getItem, getItemElement, itemProps, Ribbon, RibbonItemSize, setCustomAttributes } from '../base/index';
|
|
4
|
-
import { ITEM_VERTICAL_CENTER, RIBBON_CONTROL, RIBBON_POPUP_CONTROL, SPACE } from '../base/constant';
|
|
5
|
-
import { RibbonButtonSettingsModel, RibbonItemModel } from '../models/index';
|
|
6
|
-
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Defines the items of Ribbon.
|
|
10
|
-
*/
|
|
11
|
-
export class RibbonButton {
|
|
12
|
-
private parent: Ribbon;
|
|
13
|
-
|
|
14
|
-
constructor(parent: Ribbon) {
|
|
15
|
-
this.parent = parent;
|
|
16
|
-
}
|
|
17
|
-
protected getModuleName(): string {
|
|
18
|
-
return 'ribbonButton';
|
|
19
|
-
}
|
|
20
|
-
protected destroy(): void {
|
|
21
|
-
this.parent = null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Creates button.
|
|
26
|
-
*
|
|
27
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
28
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
29
|
-
* @returns {void}
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
public createButton(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
33
|
-
const buttonEle: HTMLButtonElement = this.parent.createElement('button', {
|
|
34
|
-
id: item.id
|
|
35
|
-
});
|
|
36
|
-
itemEle.appendChild(buttonEle);
|
|
37
|
-
const btnSettings: RibbonButtonSettingsModel = item.buttonSettings;
|
|
38
|
-
new Button({
|
|
39
|
-
locale: this.parent.locale,
|
|
40
|
-
enableRtl: this.parent.enableRtl,
|
|
41
|
-
enablePersistence: this.parent.enablePersistence,
|
|
42
|
-
iconPosition: item.activeSize === RibbonItemSize.Large ? 'Top' : 'Left',
|
|
43
|
-
iconCss: btnSettings.iconCss,
|
|
44
|
-
disabled: item.disabled,
|
|
45
|
-
cssClass: (ITEM_VERTICAL_CENTER + SPACE + RIBBON_CONTROL + SPACE + (btnSettings.cssClass ? btnSettings.cssClass : '')).trim(),
|
|
46
|
-
content: item.activeSize === RibbonItemSize.Small ? '' : btnSettings.content,
|
|
47
|
-
isPrimary: btnSettings.isPrimary,
|
|
48
|
-
isToggle: btnSettings.isToggle,
|
|
49
|
-
created: btnSettings.created
|
|
50
|
-
}, buttonEle);
|
|
51
|
-
if (btnSettings.htmlAttributes) {
|
|
52
|
-
if (btnSettings.htmlAttributes.id) {
|
|
53
|
-
delete btnSettings.htmlAttributes.id;
|
|
54
|
-
}
|
|
55
|
-
setCustomAttributes(buttonEle, btnSettings.htmlAttributes);
|
|
56
|
-
}
|
|
57
|
-
buttonEle.onclick = (e: Event) => {
|
|
58
|
-
if (btnSettings.clicked) { btnSettings.clicked.call(this, e); }
|
|
59
|
-
};
|
|
60
|
-
if (btnSettings.content) {
|
|
61
|
-
buttonEle.setAttribute('aria-label', btnSettings.content);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
buttonEle.setAttribute('aria-label', 'button');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Adds the additional event handlers as the item moved into overflow popup.
|
|
70
|
-
*
|
|
71
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
72
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
73
|
-
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
74
|
-
* @returns {void}
|
|
75
|
-
* @hidden
|
|
76
|
-
*/
|
|
77
|
-
public addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void {
|
|
78
|
-
const buttonEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
79
|
-
buttonEle.setAttribute('data-control', item.type.toString());
|
|
80
|
-
const buttonObj: Button = getComponent(buttonEle, Button);
|
|
81
|
-
buttonObj.setProperties({ cssClass: buttonObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
82
|
-
buttonEle.onclick = (e: Event) => {
|
|
83
|
-
if (item.buttonSettings.clicked) { item.buttonSettings.clicked.call(this, e); }
|
|
84
|
-
if (overflowButton.element.classList.contains('e-active')) {
|
|
85
|
-
overflowButton.toggle();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Removes the additional event handlers as the item moved from overflow popup.
|
|
91
|
-
*
|
|
92
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
93
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
94
|
-
* @returns {void}
|
|
95
|
-
* @hidden
|
|
96
|
-
*/
|
|
97
|
-
public removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
98
|
-
const buttonEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
99
|
-
const buttonObj: Button = getComponent(buttonEle, Button);
|
|
100
|
-
let cssClass: string[] = buttonObj.cssClass.split(SPACE);
|
|
101
|
-
cssClass = cssClass.filter((value: string) => value !== RIBBON_POPUP_CONTROL);
|
|
102
|
-
buttonObj.setProperties({ cssClass: cssClass.join(SPACE) });
|
|
103
|
-
buttonEle.onclick = (e: Event) => {
|
|
104
|
-
if (item.buttonSettings.clicked) { item.buttonSettings.clicked.call(this, e); }
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Triggers the click action on the button.
|
|
110
|
-
*
|
|
111
|
-
* @param {string} controlId - Gets the control ID.
|
|
112
|
-
* @returns {void}
|
|
113
|
-
*/
|
|
114
|
-
public click(controlId: string): void {
|
|
115
|
-
const buttonEle: HTMLElement = getItemElement(this.parent, controlId);
|
|
116
|
-
if (!buttonEle) { return; }
|
|
117
|
-
const buttonObj: Button = getComponent(buttonEle, Button);
|
|
118
|
-
if (!buttonObj.disabled) {
|
|
119
|
-
buttonObj.click();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Updates the button properties.
|
|
124
|
-
*
|
|
125
|
-
* @param {RibbonButtonSettingsModel} prop - Gets the button property.
|
|
126
|
-
* @param {string} id - Gets the ID of button item.
|
|
127
|
-
* @returns {void}
|
|
128
|
-
*/
|
|
129
|
-
public updateButton(prop: RibbonButtonSettingsModel, id: string): void {
|
|
130
|
-
const itemProp: itemProps = getItem(this.parent.tabs, id);
|
|
131
|
-
if (!itemProp) { return; }
|
|
132
|
-
merge(itemProp.item.buttonSettings, prop);
|
|
133
|
-
const buttonEle: HTMLElement = getItemElement(this.parent, id, itemProp);
|
|
134
|
-
if (!buttonEle) { return; }
|
|
135
|
-
const buttonObj: Button = getComponent(buttonEle, Button);
|
|
136
|
-
if (prop.isToggle) { buttonEle.classList.add('e-active'); }
|
|
137
|
-
if (prop.cssClass) { prop.cssClass = (ITEM_VERTICAL_CENTER + SPACE + RIBBON_CONTROL + SPACE + prop.cssClass).trim(); }
|
|
138
|
-
if (prop.content) {
|
|
139
|
-
prop.content = itemProp.item.activeSize === RibbonItemSize.Small ? '' : prop.content;
|
|
140
|
-
buttonEle.setAttribute('aria-label', prop.content);
|
|
141
|
-
}
|
|
142
|
-
delete prop.clicked;
|
|
143
|
-
buttonObj.setProperties(prop);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Updates the button size.
|
|
147
|
-
*
|
|
148
|
-
* @param {HTMLElement} element - Gets the button element.
|
|
149
|
-
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
150
|
-
* @returns {void}
|
|
151
|
-
* @hidden
|
|
152
|
-
*/
|
|
153
|
-
public updateButtonSize(element: HTMLElement, item: RibbonItemModel): void {
|
|
154
|
-
const buttonObj: Button = getComponent(element, Button);
|
|
155
|
-
buttonObj.setProperties({
|
|
156
|
-
iconPosition: item.activeSize === RibbonItemSize.Large ? 'Top' : 'Left',
|
|
157
|
-
content: item.activeSize === RibbonItemSize.Small ? '' : item.buttonSettings.content
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
2
|
-
import { Ribbon } from '../base/index';
|
|
3
|
-
import { RibbonCheckBoxSettingsModel, RibbonItemModel } from '../models/index';
|
|
4
|
-
/**
|
|
5
|
-
* Defines the items of Ribbon.
|
|
6
|
-
*/
|
|
7
|
-
export declare class RibbonCheckBox {
|
|
8
|
-
private parent;
|
|
9
|
-
constructor(parent: Ribbon);
|
|
10
|
-
protected getModuleName(): string;
|
|
11
|
-
protected destroy(): void;
|
|
12
|
-
/**
|
|
13
|
-
* Creates the check box.
|
|
14
|
-
*
|
|
15
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
16
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
17
|
-
* @returns {void}
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
createCheckBox(item: RibbonItemModel, itemEle: HTMLElement): void;
|
|
21
|
-
/**
|
|
22
|
-
* Adds the additional event handlers as the item moved into overflow popup.
|
|
23
|
-
*
|
|
24
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
25
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
26
|
-
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
27
|
-
* @returns {void}
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
|
|
31
|
-
/**
|
|
32
|
-
* Removes the additional event handlers as the item moved from overflow popup.
|
|
33
|
-
*
|
|
34
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
35
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
36
|
-
* @returns {void}
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
|
|
40
|
-
/**
|
|
41
|
-
* Triggers the click action on the Checkbox.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} controlId - Gets the control ID.
|
|
44
|
-
* @returns {void}
|
|
45
|
-
*/
|
|
46
|
-
click(controlId: string): void;
|
|
47
|
-
/**
|
|
48
|
-
* Updates the checkbox.
|
|
49
|
-
*
|
|
50
|
-
* @param {RibbonCheckBoxSettingsModel} prop - Gets the checkbox property.
|
|
51
|
-
* @param {string} id - Gets the ID of checkbox.
|
|
52
|
-
* @returns {void}
|
|
53
|
-
*/
|
|
54
|
-
updateCheckBox(prop: RibbonCheckBoxSettingsModel, id: string): void;
|
|
55
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { getComponent, merge } from '@syncfusion/ej2-base';
|
|
2
|
-
import { ChangeEventArgs, CheckBox } from '@syncfusion/ej2-buttons';
|
|
3
|
-
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
-
import { itemProps, Ribbon, getItem, getItemElement, RIBBON_CONTROL, SPACE, RIBBON_POPUP_CONTROL } from '../base/index';
|
|
5
|
-
import { RibbonCheckBoxSettingsModel, RibbonItemModel } from '../models/index';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Defines the items of Ribbon.
|
|
9
|
-
*/
|
|
10
|
-
export class RibbonCheckBox {
|
|
11
|
-
private parent: Ribbon;
|
|
12
|
-
|
|
13
|
-
constructor(parent: Ribbon) {
|
|
14
|
-
this.parent = parent;
|
|
15
|
-
}
|
|
16
|
-
protected getModuleName(): string {
|
|
17
|
-
return 'ribbonCheckBox';
|
|
18
|
-
}
|
|
19
|
-
protected destroy(): void {
|
|
20
|
-
this.parent = null;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Creates the check box.
|
|
24
|
-
*
|
|
25
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
26
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
27
|
-
* @returns {void}
|
|
28
|
-
* @hidden
|
|
29
|
-
*/
|
|
30
|
-
public createCheckBox(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
31
|
-
const inputEle: HTMLInputElement = this.parent.createElement('input', {
|
|
32
|
-
id: item.id
|
|
33
|
-
});
|
|
34
|
-
itemEle.appendChild(inputEle);
|
|
35
|
-
const checkBoxSettings: RibbonCheckBoxSettingsModel = item.checkBoxSettings;
|
|
36
|
-
if (checkBoxSettings.htmlAttributes) {
|
|
37
|
-
if (checkBoxSettings.htmlAttributes.id) {
|
|
38
|
-
delete checkBoxSettings.htmlAttributes.id;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
new CheckBox({
|
|
42
|
-
locale: this.parent.locale,
|
|
43
|
-
enableRtl: this.parent.enableRtl,
|
|
44
|
-
enablePersistence: this.parent.enablePersistence,
|
|
45
|
-
checked: checkBoxSettings.checked,
|
|
46
|
-
cssClass: (RIBBON_CONTROL + SPACE + (checkBoxSettings.cssClass ? checkBoxSettings.cssClass : '')).trim(),
|
|
47
|
-
label: checkBoxSettings.label,
|
|
48
|
-
labelPosition: checkBoxSettings.labelPosition,
|
|
49
|
-
disabled: item.disabled,
|
|
50
|
-
created: checkBoxSettings.created,
|
|
51
|
-
htmlAttributes: checkBoxSettings.htmlAttributes,
|
|
52
|
-
change: (e: ChangeEventArgs) => {
|
|
53
|
-
if (checkBoxSettings.change) { checkBoxSettings.change.call(this, e); }
|
|
54
|
-
}
|
|
55
|
-
}, inputEle);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Adds the additional event handlers as the item moved into overflow popup.
|
|
59
|
-
*
|
|
60
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
61
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
62
|
-
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
63
|
-
* @returns {void}
|
|
64
|
-
* @hidden
|
|
65
|
-
*/
|
|
66
|
-
public addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void {
|
|
67
|
-
const inputEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
68
|
-
inputEle.setAttribute('data-control', item.type.toString());
|
|
69
|
-
const checkBoxObj: CheckBox = getComponent(inputEle, CheckBox);
|
|
70
|
-
checkBoxObj.cssClass = checkBoxObj.cssClass + SPACE + RIBBON_POPUP_CONTROL;
|
|
71
|
-
checkBoxObj.dataBind();
|
|
72
|
-
checkBoxObj.change = (e: ChangeEventArgs) => {
|
|
73
|
-
if (item.checkBoxSettings.change) { item.checkBoxSettings.change.call(this, e); }
|
|
74
|
-
if (overflowButton.element.classList.contains('e-active')) {
|
|
75
|
-
overflowButton.toggle();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Removes the additional event handlers as the item moved from overflow popup.
|
|
81
|
-
*
|
|
82
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
83
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
84
|
-
* @returns {void}
|
|
85
|
-
* @hidden
|
|
86
|
-
*/
|
|
87
|
-
public removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
88
|
-
const inputEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
89
|
-
const checkBoxObj: CheckBox = getComponent(inputEle, CheckBox);
|
|
90
|
-
let cssClass: string[] = checkBoxObj.cssClass.split(SPACE);
|
|
91
|
-
cssClass = cssClass.filter((value: string) => value !== RIBBON_POPUP_CONTROL);
|
|
92
|
-
checkBoxObj.cssClass = cssClass.join(SPACE);
|
|
93
|
-
checkBoxObj.dataBind();
|
|
94
|
-
checkBoxObj.change = (e: ChangeEventArgs) => {
|
|
95
|
-
if (item.checkBoxSettings.change) { item.checkBoxSettings.change.call(this, e); }
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Triggers the click action on the Checkbox.
|
|
100
|
-
*
|
|
101
|
-
* @param {string} controlId - Gets the control ID.
|
|
102
|
-
* @returns {void}
|
|
103
|
-
*/
|
|
104
|
-
public click(controlId: string): void {
|
|
105
|
-
const inputEle: HTMLElement = getItemElement(this.parent, controlId);
|
|
106
|
-
if (!inputEle) { return; }
|
|
107
|
-
const checkBoxObj: CheckBox = getComponent(inputEle, CheckBox);
|
|
108
|
-
if (!checkBoxObj.disabled) {
|
|
109
|
-
checkBoxObj.click();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Updates the checkbox.
|
|
114
|
-
*
|
|
115
|
-
* @param {RibbonCheckBoxSettingsModel} prop - Gets the checkbox property.
|
|
116
|
-
* @param {string} id - Gets the ID of checkbox.
|
|
117
|
-
* @returns {void}
|
|
118
|
-
*/
|
|
119
|
-
public updateCheckBox(prop: RibbonCheckBoxSettingsModel, id: string): void {
|
|
120
|
-
const itemProp: itemProps = getItem(this.parent.tabs, id);
|
|
121
|
-
if (!itemProp) { return; }
|
|
122
|
-
merge(itemProp.item.checkBoxSettings, prop);
|
|
123
|
-
const inputEle: HTMLElement = getItemElement(this.parent, id, itemProp);
|
|
124
|
-
if (!inputEle) { return; }
|
|
125
|
-
if (prop.cssClass) { prop.cssClass = (RIBBON_CONTROL + SPACE + prop.cssClass).trim(); }
|
|
126
|
-
delete prop.change;
|
|
127
|
-
const checkBoxObj: CheckBox = getComponent(inputEle, CheckBox);
|
|
128
|
-
checkBoxObj.setProperties(prop);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Ribbon } from '../base/index';
|
|
2
|
-
import { RibbonItemModel, RibbonColorPickerSettingsModel } from '../models/index';
|
|
3
|
-
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
-
/**
|
|
5
|
-
* Defines the items of Ribbon.
|
|
6
|
-
*/
|
|
7
|
-
export declare class RibbonColorPicker {
|
|
8
|
-
private parent;
|
|
9
|
-
constructor(parent: Ribbon);
|
|
10
|
-
protected getModuleName(): string;
|
|
11
|
-
protected destroy(): void;
|
|
12
|
-
/**
|
|
13
|
-
* Creates the colorpicker.
|
|
14
|
-
*
|
|
15
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
16
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
17
|
-
* @returns {void}
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
createColorPicker(item: RibbonItemModel, itemEle: HTMLElement): void;
|
|
21
|
-
private toggleWrapperHover;
|
|
22
|
-
/**
|
|
23
|
-
* Adds the additional event handlers as the item moved into overflow popup.
|
|
24
|
-
*
|
|
25
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
26
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
27
|
-
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
28
|
-
* @returns {void}
|
|
29
|
-
* @hidden
|
|
30
|
-
*/
|
|
31
|
-
addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void;
|
|
32
|
-
/**
|
|
33
|
-
* Removes the additional event handlers as the item moved from overflow popup.
|
|
34
|
-
*
|
|
35
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
36
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
37
|
-
* @returns {void}
|
|
38
|
-
* @hidden
|
|
39
|
-
*/
|
|
40
|
-
removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void;
|
|
41
|
-
private getColorPickerObj;
|
|
42
|
-
/**
|
|
43
|
-
* Gets color value in specified type.
|
|
44
|
-
*
|
|
45
|
-
* @param {string} controlId -Gets the control ID.
|
|
46
|
-
* @param {string} value - Specify the color value.
|
|
47
|
-
* @param {string} type - Specify the type to which the specified color needs to be converted.
|
|
48
|
-
* @returns {string} - Returns string.
|
|
49
|
-
*/
|
|
50
|
-
getValue(controlId: string, value?: string, type?: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* To show/hide ColorPicker popup based on current state of the SplitButton.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} controlId - set the id of the control.
|
|
55
|
-
* @returns {void} - Returns void.
|
|
56
|
-
*/
|
|
57
|
-
toggle(controlId: string): void;
|
|
58
|
-
/**
|
|
59
|
-
* Updates the colorpicker properties.
|
|
60
|
-
*
|
|
61
|
-
* @param {RibbonColorPickerSettingsModel} prop - Gets the colorpicker property.
|
|
62
|
-
* @param {string} id - Gets the ID of colorpicker.
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
|
-
updateColorPicker(prop: RibbonColorPickerSettingsModel, id: string): void;
|
|
66
|
-
/**
|
|
67
|
-
* @param {HTMLElement} element - Gets the colorpicker element to be destroyed.
|
|
68
|
-
* @returns {void}
|
|
69
|
-
* @hidden
|
|
70
|
-
*/
|
|
71
|
-
unwireColorPickerEvents(element: HTMLElement): void;
|
|
72
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { EventHandler, getComponent, merge } from '@syncfusion/ej2-base';
|
|
2
|
-
import { ColorPicker } from '@syncfusion/ej2-inputs';
|
|
3
|
-
import { itemProps, Ribbon, getItem, getItemElement, setCustomAttributes } from '../base/index';
|
|
4
|
-
import { RibbonItemModel, RibbonColorPickerSettingsModel } from '../models/index';
|
|
5
|
-
import { RIBBON_CONTROL, RIBBON_HOVER, RIBBON_POPUP_CONTROL, RIBBON_POPUP_OPEN, SPACE } from '../base/constant';
|
|
6
|
-
import { BeforeOpenCloseMenuEventArgs, DropDownButton, SplitButton } from '@syncfusion/ej2-splitbuttons';
|
|
7
|
-
import { ChangeEventArgs } from '@syncfusion/ej2-dropdowns';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Defines the items of Ribbon.
|
|
11
|
-
*/
|
|
12
|
-
export class RibbonColorPicker {
|
|
13
|
-
private parent: Ribbon;
|
|
14
|
-
|
|
15
|
-
constructor(parent: Ribbon) {
|
|
16
|
-
this.parent = parent;
|
|
17
|
-
}
|
|
18
|
-
protected getModuleName(): string {
|
|
19
|
-
return 'ribbonColorPicker';
|
|
20
|
-
}
|
|
21
|
-
protected destroy(): void {
|
|
22
|
-
this.parent = null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates the colorpicker.
|
|
27
|
-
*
|
|
28
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
29
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
30
|
-
* @returns {void}
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
public createColorPicker(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
34
|
-
const inputEle: HTMLInputElement = this.parent.createElement('input', {
|
|
35
|
-
id: item.id
|
|
36
|
-
});
|
|
37
|
-
itemEle.appendChild(inputEle);
|
|
38
|
-
const colorPickerSettings: RibbonColorPickerSettingsModel = item.colorPickerSettings;
|
|
39
|
-
const colorPicker: ColorPicker = new ColorPicker({
|
|
40
|
-
locale: this.parent.locale,
|
|
41
|
-
enableRtl: this.parent.enableRtl,
|
|
42
|
-
enablePersistence: this.parent.enablePersistence,
|
|
43
|
-
columns: colorPickerSettings.columns,
|
|
44
|
-
cssClass: (RIBBON_CONTROL + SPACE + (colorPickerSettings.cssClass ? colorPickerSettings.cssClass : '')).trim(),
|
|
45
|
-
disabled: item.disabled,
|
|
46
|
-
enableOpacity: colorPickerSettings.enableOpacity,
|
|
47
|
-
mode: colorPickerSettings.mode,
|
|
48
|
-
modeSwitcher: colorPickerSettings.modeSwitcher,
|
|
49
|
-
noColor: colorPickerSettings.noColor,
|
|
50
|
-
presetColors: colorPickerSettings.presetColors,
|
|
51
|
-
showButtons: colorPickerSettings.showButtons,
|
|
52
|
-
value: colorPickerSettings.value,
|
|
53
|
-
beforeClose: () => {
|
|
54
|
-
colorPicker.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
|
|
55
|
-
if (colorPickerSettings.beforeClose) {
|
|
56
|
-
colorPickerSettings.beforeClose.call(this);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
beforeOpen: colorPickerSettings.beforeOpen,
|
|
60
|
-
beforeTileRender: colorPickerSettings.beforeTileRender,
|
|
61
|
-
created: colorPickerSettings.created,
|
|
62
|
-
change: (e: ChangeEventArgs) => {
|
|
63
|
-
colorPickerSettings.value = e.value.toString();
|
|
64
|
-
if (colorPickerSettings.change) {
|
|
65
|
-
colorPickerSettings.change.call(this, e);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
open: () => {
|
|
69
|
-
colorPicker.element.parentElement.classList.add(RIBBON_POPUP_OPEN);
|
|
70
|
-
if (colorPickerSettings.open) {
|
|
71
|
-
colorPickerSettings.open.call(this);
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
select: colorPickerSettings.select
|
|
75
|
-
}, inputEle);
|
|
76
|
-
if (colorPickerSettings.htmlAttributes) {
|
|
77
|
-
if (colorPickerSettings.htmlAttributes.id) {
|
|
78
|
-
delete colorPickerSettings.htmlAttributes.id;
|
|
79
|
-
}
|
|
80
|
-
setCustomAttributes(inputEle, colorPickerSettings.htmlAttributes);
|
|
81
|
-
}
|
|
82
|
-
const wrapper: HTMLElement = colorPicker.element.parentElement;
|
|
83
|
-
EventHandler.add(wrapper, 'mouseenter', this.toggleWrapperHover.bind(this, wrapper, true), this);
|
|
84
|
-
EventHandler.add(wrapper, 'mouseleave', this.toggleWrapperHover.bind(this, wrapper, false), this);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private toggleWrapperHover(wrapper: HTMLElement, isAdd: boolean): void {
|
|
88
|
-
if (isAdd) {
|
|
89
|
-
wrapper.classList.add(RIBBON_HOVER);
|
|
90
|
-
} else {
|
|
91
|
-
wrapper.classList.remove(RIBBON_HOVER);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Adds the additional event handlers as the item moved into overflow popup.
|
|
97
|
-
*
|
|
98
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
99
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
100
|
-
* @param {DropDownButton} overflowButton - Gets the overflow button.
|
|
101
|
-
* @returns {void}
|
|
102
|
-
* @hidden
|
|
103
|
-
*/
|
|
104
|
-
public addOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement, overflowButton: DropDownButton): void {
|
|
105
|
-
const colorPickerSettings: RibbonColorPickerSettingsModel = item.colorPickerSettings;
|
|
106
|
-
if (colorPickerSettings.label && this.parent.activeLayout === 'Simplified') {
|
|
107
|
-
const label: HTMLElement = this.parent.createElement('div', {
|
|
108
|
-
className: 'e-ribbon-colorpicker-label',
|
|
109
|
-
id: item.id + '_label',
|
|
110
|
-
innerHTML: colorPickerSettings.label
|
|
111
|
-
});
|
|
112
|
-
itemEle.insertBefore(label, itemEle.firstChild);
|
|
113
|
-
}
|
|
114
|
-
const colorPickerEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
115
|
-
colorPickerEle.setAttribute('data-control', item.type.toString());
|
|
116
|
-
const colorPickerObj: ColorPicker = getComponent(colorPickerEle, ColorPicker);
|
|
117
|
-
colorPickerObj.setProperties({ cssClass: colorPickerObj.cssClass + SPACE + RIBBON_POPUP_CONTROL });
|
|
118
|
-
//Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
|
|
119
|
-
const splitBtn: SplitButton = (colorPickerObj['splitBtn'] as SplitButton);
|
|
120
|
-
let target: HTMLElement;
|
|
121
|
-
colorPickerObj.beforeClose = (e: BeforeOpenCloseMenuEventArgs) => {
|
|
122
|
-
target = e.event ? e.event.target as HTMLElement : null;
|
|
123
|
-
colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
|
|
124
|
-
if (item.colorPickerSettings.beforeClose) {
|
|
125
|
-
item.colorPickerSettings.beforeClose.call(this);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
splitBtn.close = () => {
|
|
129
|
-
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
|
|
130
|
-
if (overflowButton.element.classList.contains('e-active')) {
|
|
131
|
-
overflowButton.toggle();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Removes the additional event handlers as the item moved from overflow popup.
|
|
138
|
-
*
|
|
139
|
-
* @param {RibbonItemModel} item - Gets the ribbon item model.
|
|
140
|
-
* @param {HTMLElement} itemEle - Gets the ribbon item element.
|
|
141
|
-
* @returns {void}
|
|
142
|
-
* @hidden
|
|
143
|
-
*/
|
|
144
|
-
public removeOverFlowEvents(item: RibbonItemModel, itemEle: HTMLElement): void {
|
|
145
|
-
const colorPickerSettings: RibbonColorPickerSettingsModel = item.colorPickerSettings;
|
|
146
|
-
if (colorPickerSettings.label) {
|
|
147
|
-
const label: HTMLElement = itemEle.querySelector('#' + item.id + '_label');
|
|
148
|
-
if (label) {
|
|
149
|
-
label.remove();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
const colorPickerEle: HTMLElement = itemEle.querySelector('#' + item.id);
|
|
153
|
-
const colorPickerObj: ColorPicker = getComponent(colorPickerEle, ColorPicker);
|
|
154
|
-
let cssClass: string[] = colorPickerObj.cssClass.split(SPACE);
|
|
155
|
-
cssClass = cssClass.filter((value: string) => value !== RIBBON_POPUP_CONTROL);
|
|
156
|
-
colorPickerObj.setProperties({ cssClass: cssClass.join(SPACE) });
|
|
157
|
-
const splitBtn: SplitButton = (colorPickerObj['splitBtn'] as SplitButton);
|
|
158
|
-
//Accessing the private property 'splitBtn' of ColorPicker component to get the colorpicker instance as there is no close event in colorpicker.
|
|
159
|
-
splitBtn.close = null;
|
|
160
|
-
colorPickerObj.beforeClose = () => {
|
|
161
|
-
colorPickerObj.element.parentElement.classList.remove(RIBBON_POPUP_OPEN);
|
|
162
|
-
if (item.colorPickerSettings.beforeClose) {
|
|
163
|
-
item.colorPickerSettings.beforeClose.call(this);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private getColorPickerObj(controlId: string): ColorPicker {
|
|
169
|
-
const inputEle: HTMLElement = getItemElement(this.parent, controlId);
|
|
170
|
-
return inputEle ? getComponent(inputEle, ColorPicker) : null;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Gets color value in specified type.
|
|
174
|
-
*
|
|
175
|
-
* @param {string} controlId -Gets the control ID.
|
|
176
|
-
* @param {string} value - Specify the color value.
|
|
177
|
-
* @param {string} type - Specify the type to which the specified color needs to be converted.
|
|
178
|
-
* @returns {string} - Returns string.
|
|
179
|
-
*/
|
|
180
|
-
public getValue(controlId: string, value?: string, type?: string): string {
|
|
181
|
-
const colorPickerObj: ColorPicker = this.getColorPickerObj(controlId);
|
|
182
|
-
return colorPickerObj ? colorPickerObj.getValue(value, type) : '';
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* To show/hide ColorPicker popup based on current state of the SplitButton.
|
|
186
|
-
*
|
|
187
|
-
* @param {string} controlId - set the id of the control.
|
|
188
|
-
* @returns {void} - Returns void.
|
|
189
|
-
*/
|
|
190
|
-
public toggle(controlId: string): void {
|
|
191
|
-
const colorPickerObj: ColorPicker = this.getColorPickerObj(controlId);
|
|
192
|
-
if (!colorPickerObj) { return; }
|
|
193
|
-
if (!colorPickerObj.disabled) {
|
|
194
|
-
colorPickerObj.toggle();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Updates the colorpicker properties.
|
|
199
|
-
*
|
|
200
|
-
* @param {RibbonColorPickerSettingsModel} prop - Gets the colorpicker property.
|
|
201
|
-
* @param {string} id - Gets the ID of colorpicker.
|
|
202
|
-
* @returns {void}
|
|
203
|
-
*/
|
|
204
|
-
public updateColorPicker(prop: RibbonColorPickerSettingsModel, id: string): void {
|
|
205
|
-
const itemProp: itemProps = getItem(this.parent.tabs, id);
|
|
206
|
-
if (!itemProp) { return; }
|
|
207
|
-
merge(itemProp.item.checkBoxSettings, prop);
|
|
208
|
-
const inputEle: HTMLElement = getItemElement(this.parent, id, itemProp);
|
|
209
|
-
if (!inputEle) { return; }
|
|
210
|
-
if (prop.cssClass) { prop.cssClass = (RIBBON_CONTROL + SPACE + prop.cssClass).trim(); }
|
|
211
|
-
delete prop.beforeClose;
|
|
212
|
-
delete prop.open;
|
|
213
|
-
const colorPickerObj: ColorPicker = getComponent(inputEle, ColorPicker);
|
|
214
|
-
colorPickerObj.setProperties(prop);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @param {HTMLElement} element - Gets the colorpicker element to be destroyed.
|
|
219
|
-
* @returns {void}
|
|
220
|
-
* @hidden
|
|
221
|
-
*/
|
|
222
|
-
public unwireColorPickerEvents(element: HTMLElement): void {
|
|
223
|
-
const colorPickerObj: ColorPicker = getComponent(element, ColorPicker);
|
|
224
|
-
const wrapper: HTMLElement = colorPickerObj.element.parentElement;
|
|
225
|
-
EventHandler.remove(wrapper, 'mouseenter', this.toggleWrapperHover);
|
|
226
|
-
EventHandler.remove(wrapper, 'mouseleave', this.toggleWrapperHover);
|
|
227
|
-
}
|
|
228
|
-
}
|