@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,139 @@
|
|
|
1
|
+
import { Tooltip, TooltipEventArgs } from '@syncfusion/ej2-popups';
|
|
2
|
+
import { RibbonTabModel, RibbonTooltipModel } from '../models/index';
|
|
3
|
+
import { commonProperties, itemProps, ribbonTooltipData, RibbonItemType } from './interface';
|
|
4
|
+
import { Ribbon } from './ribbon';
|
|
5
|
+
/**
|
|
6
|
+
* Gets index value.
|
|
7
|
+
*
|
|
8
|
+
* @param {Array} arr - Gets the array to find index.
|
|
9
|
+
* @param {boolean} condition - Defines whether index matches with the value.
|
|
10
|
+
* @returns {number} - Gets the index value.
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
export declare function getIndex<T>(arr: Array<T>, condition: (value: T, index: number) => boolean): number;
|
|
14
|
+
/**
|
|
15
|
+
* Gets template content based on the template property value.
|
|
16
|
+
*
|
|
17
|
+
* @param {string | HTMLElement| Function} template - Template property value.
|
|
18
|
+
* @returns {Function} - Return template function.
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export declare function getTemplateFunction(template: string | HTMLElement | Function): Function;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the ribbon item
|
|
24
|
+
*
|
|
25
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
26
|
+
* @param {string} id - Gets the ID of the tab.
|
|
27
|
+
* @param {RibbonItemType} type - Gets the type of the item.
|
|
28
|
+
* @returns {itemProps} - Gets the ribbon item.
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export declare function getItem(tabs: RibbonTabModel[], id: string, type?: RibbonItemType): itemProps;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the ribbon collection.
|
|
34
|
+
*
|
|
35
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
36
|
+
* @param {string} id - Gets the ID of the tab.
|
|
37
|
+
* @returns {itemProps} - Gets the ribbon collection.
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export declare function getCollection(tabs: RibbonTabModel[], id: string): itemProps;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the ribbon group.
|
|
43
|
+
*
|
|
44
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
45
|
+
* @param {string} id - Gets the ID of the tab.
|
|
46
|
+
* @returns {itemProps} - Gets the ribbon group.
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
export declare function getGroup(tabs: RibbonTabModel[], id: string): itemProps;
|
|
50
|
+
/**
|
|
51
|
+
* @param {HTMLElement} element - Gets the element to be destroyed.
|
|
52
|
+
* @param {string} moduleName - Gets the module name.
|
|
53
|
+
* @returns {void}
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
export declare function destroyControl(element: HTMLElement, moduleName: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Updates common properties.
|
|
59
|
+
*
|
|
60
|
+
* @param {HTMLElement} element - Gets the element to be updated.
|
|
61
|
+
* @param {string} moduleName - Gets the module name.
|
|
62
|
+
* @param {commonProperties} commonProp - Gets the common properties to be updated.
|
|
63
|
+
* @returns {void}
|
|
64
|
+
* @hidden
|
|
65
|
+
*/
|
|
66
|
+
export declare function updateCommonProperty(element: HTMLElement, moduleName: string, commonProp: commonProperties): void;
|
|
67
|
+
/**
|
|
68
|
+
* Updates disabled control.
|
|
69
|
+
*
|
|
70
|
+
* @param {HTMLElement} element - Gets the element to be disabled.
|
|
71
|
+
* @param {string} moduleName - Gets the module name.
|
|
72
|
+
* @param {boolean} disable - Defines whether the control to be disabled or not.
|
|
73
|
+
* @returns {void}
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
export declare function updateControlDisabled(element: HTMLElement, moduleName: string, disable: boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the ribbon item element.
|
|
79
|
+
*
|
|
80
|
+
* @param {Ribbon} parent - Gets the parent element.
|
|
81
|
+
* @param {string} id - Gets the ID of the item.
|
|
82
|
+
* @param {itemProps} itemProp - Gets the ribbon item.
|
|
83
|
+
* @returns {HTMLElement} - Gets the ribbon item element.
|
|
84
|
+
* @hidden
|
|
85
|
+
*/
|
|
86
|
+
export declare function getItemElement(parent: Ribbon, id: string, itemProp?: itemProps): HTMLElement;
|
|
87
|
+
/**
|
|
88
|
+
* @param {RibbonTooltipModel} tooltip - Gets the property of tooltip.
|
|
89
|
+
* @returns {boolean} - Gets whether the tooltip is present or not.
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
export declare function isTooltipPresent(tooltip: RibbonTooltipModel): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Sets content for tooltip.
|
|
95
|
+
*
|
|
96
|
+
* @param {TooltipEventArgs} args - Gets the argument of tooltip.
|
|
97
|
+
* @param {Tooltip} tooltip - Gets the tooltip to set the content.
|
|
98
|
+
* @param {ribbonTooltipData} tooltipData - Gets the tooltip data.
|
|
99
|
+
* @returns {void}
|
|
100
|
+
* @hidden
|
|
101
|
+
*/
|
|
102
|
+
export declare function setToolTipContent(args: TooltipEventArgs, tooltip: Tooltip, tooltipData: ribbonTooltipData[]): void;
|
|
103
|
+
/**
|
|
104
|
+
* Creates tooltip.
|
|
105
|
+
*
|
|
106
|
+
* @param {HTMLElement} element - Gets the element to add tooltip.
|
|
107
|
+
* @param {Ribbon} ribbon - Gets the ribbon.
|
|
108
|
+
* @returns {void}
|
|
109
|
+
* @hidden
|
|
110
|
+
*/
|
|
111
|
+
export declare function createTooltip(element: HTMLElement, ribbon: Ribbon): void;
|
|
112
|
+
/**
|
|
113
|
+
* Destroys tooltip
|
|
114
|
+
*
|
|
115
|
+
* @param {HTMLElement} element - Gets the element in which the tooltip needs to be destroyed.
|
|
116
|
+
* @returns {void}
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
export declare function destroyTooltip(element: HTMLElement): void;
|
|
120
|
+
/**
|
|
121
|
+
* Updates tooltip
|
|
122
|
+
*
|
|
123
|
+
* @param {HTMLElement} element - Gets the element in which the tooltip needs to be Updated.
|
|
124
|
+
* @param {commonProperties} prop - Gets the property to be updated.
|
|
125
|
+
* @returns {void}
|
|
126
|
+
* @hidden
|
|
127
|
+
*/
|
|
128
|
+
export declare function updateTooltipProp(element: HTMLElement, prop: commonProperties): void;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the HTML attributes of an element
|
|
131
|
+
*
|
|
132
|
+
* @param {HTMLElement} element - The HTML element for which attributes are to be updated.
|
|
133
|
+
* @param {commonProperties} attributes - An object containing key-value pairs of attributes to be updated.
|
|
134
|
+
* @returns {void}
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
137
|
+
export declare function setCustomAttributes(element: HTMLElement, attributes: {
|
|
138
|
+
[key: string]: string;
|
|
139
|
+
}): void;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { compile, getComponent, select, addClass } from '@syncfusion/ej2-base';
|
|
2
|
+
import { Tooltip, TooltipEventArgs } from '@syncfusion/ej2-popups';
|
|
3
|
+
import { RibbonTabModel, RibbonGroupModel, RibbonCollectionModel, RibbonItemModel, RibbonTooltipModel } from '../models/index';
|
|
4
|
+
import { commonProperties, DisplayMode, EJ2Control, itemProps, RibbonLayout, ribbonTooltipData, RibbonItemType } from './interface';
|
|
5
|
+
import { Ribbon } from './ribbon';
|
|
6
|
+
import * as constants from './constant';
|
|
7
|
+
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Gets index value.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array} arr - Gets the array to find index.
|
|
14
|
+
* @param {boolean} condition - Defines whether index matches with the value.
|
|
15
|
+
* @returns {number} - Gets the index value.
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export function getIndex<T>(arr: Array<T>, condition: (value: T, index: number) => boolean): number {
|
|
19
|
+
for (let i: number = 0; i < arr.length; i++) {
|
|
20
|
+
if (condition(arr[parseInt(i.toString(), 10)
|
|
21
|
+
], i)) { return i; }
|
|
22
|
+
}
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets template content based on the template property value.
|
|
27
|
+
*
|
|
28
|
+
* @param {string | HTMLElement| Function} template - Template property value.
|
|
29
|
+
* @returns {Function} - Return template function.
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export function getTemplateFunction(template: string | HTMLElement | Function): Function {
|
|
33
|
+
if (typeof template === 'string') {
|
|
34
|
+
let content: string = '';
|
|
35
|
+
try {
|
|
36
|
+
const tempEle: HTMLElement = select(template);
|
|
37
|
+
if (tempEle) {
|
|
38
|
+
//Return innerHTML incase of jsrenderer script else outerHTML
|
|
39
|
+
content = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
|
|
40
|
+
} else {
|
|
41
|
+
content = template;
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
content = template;
|
|
45
|
+
}
|
|
46
|
+
return compile(content);
|
|
47
|
+
} else {
|
|
48
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
49
|
+
return compile(template as any);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the ribbon item
|
|
55
|
+
*
|
|
56
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
57
|
+
* @param {string} id - Gets the ID of the tab.
|
|
58
|
+
* @param {RibbonItemType} type - Gets the type of the item.
|
|
59
|
+
* @returns {itemProps} - Gets the ribbon item.
|
|
60
|
+
* @hidden
|
|
61
|
+
*/
|
|
62
|
+
export function getItem(tabs: RibbonTabModel[], id: string, type?: RibbonItemType): itemProps {
|
|
63
|
+
for (let i: number = 0; i < tabs.length; i++) {
|
|
64
|
+
const tab: RibbonTabModel = tabs[parseInt(i.toString(), 10)];
|
|
65
|
+
for (let j: number = 0; j < tab.groups.length; j++) {
|
|
66
|
+
const group: RibbonGroupModel = tab.groups[parseInt(j.toString(), 10)];
|
|
67
|
+
for (let k: number = 0; k < group.collections.length; k++) {
|
|
68
|
+
const collection: RibbonCollectionModel = group.collections[parseInt(k.toString(), 10)];
|
|
69
|
+
for (let l: number = 0; l < collection.items.length; l++) {
|
|
70
|
+
const item: RibbonItemModel = collection.items[parseInt(l.toString(), 10)];
|
|
71
|
+
if ((id && item.id === id) || (type && item.type === type)) {
|
|
72
|
+
return {
|
|
73
|
+
item: item, collection: collection, group: group,
|
|
74
|
+
tabIndex: i, groupIndex: j, collectionIndex: k, itemIndex: l
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Gets the ribbon collection.
|
|
86
|
+
*
|
|
87
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
88
|
+
* @param {string} id - Gets the ID of the tab.
|
|
89
|
+
* @returns {itemProps} - Gets the ribbon collection.
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
92
|
+
export function getCollection(tabs: RibbonTabModel[], id: string): itemProps {
|
|
93
|
+
for (let i: number = 0; i < tabs.length; i++) {
|
|
94
|
+
const tab: RibbonTabModel = tabs[parseInt(i.toString(), 10)];
|
|
95
|
+
for (let j: number = 0; j < tab.groups.length; j++) {
|
|
96
|
+
const group: RibbonGroupModel = tab.groups[parseInt(j.toString(), 10)];
|
|
97
|
+
for (let k: number = 0; k < group.collections.length; k++) {
|
|
98
|
+
const collection: RibbonCollectionModel = group.collections[parseInt(k.toString(), 10)];
|
|
99
|
+
if (collection.id === id) {
|
|
100
|
+
return {
|
|
101
|
+
collection: collection, group: group,
|
|
102
|
+
tabIndex: i, groupIndex: j, collectionIndex: k
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Gets the ribbon group.
|
|
113
|
+
*
|
|
114
|
+
* @param {RibbonTabModel} tabs - Gets the ribbon tab model.
|
|
115
|
+
* @param {string} id - Gets the ID of the tab.
|
|
116
|
+
* @returns {itemProps} - Gets the ribbon group.
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
export function getGroup(tabs: RibbonTabModel[], id: string): itemProps {
|
|
120
|
+
for (let i: number = 0; i < tabs.length; i++) {
|
|
121
|
+
const tab: RibbonTabModel = tabs[parseInt(i.toString(), 10)];
|
|
122
|
+
for (let j: number = 0; j < tab.groups.length; j++) {
|
|
123
|
+
const group: RibbonGroupModel = tab.groups[parseInt(j.toString(), 10)];
|
|
124
|
+
if (group.id === id) {
|
|
125
|
+
return {
|
|
126
|
+
group: group, tabIndex: i, groupIndex: j
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @param {HTMLElement} element - Gets the element to be destroyed.
|
|
136
|
+
* @param {string} moduleName - Gets the module name.
|
|
137
|
+
* @returns {void}
|
|
138
|
+
* @hidden
|
|
139
|
+
*/
|
|
140
|
+
export function destroyControl(element: HTMLElement, moduleName: string): void {
|
|
141
|
+
const control: EJ2Control = getComponent(element, moduleName);
|
|
142
|
+
control.destroy();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Updates common properties.
|
|
147
|
+
*
|
|
148
|
+
* @param {HTMLElement} element - Gets the element to be updated.
|
|
149
|
+
* @param {string} moduleName - Gets the module name.
|
|
150
|
+
* @param {commonProperties} commonProp - Gets the common properties to be updated.
|
|
151
|
+
* @returns {void}
|
|
152
|
+
* @hidden
|
|
153
|
+
*/
|
|
154
|
+
export function updateCommonProperty(element: HTMLElement, moduleName: string, commonProp: commonProperties): void {
|
|
155
|
+
const control: EJ2Control = getComponent(element, moduleName);
|
|
156
|
+
control.setProperties(commonProp);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Updates disabled control.
|
|
161
|
+
*
|
|
162
|
+
* @param {HTMLElement} element - Gets the element to be disabled.
|
|
163
|
+
* @param {string} moduleName - Gets the module name.
|
|
164
|
+
* @param {boolean} disable - Defines whether the control to be disabled or not.
|
|
165
|
+
* @returns {void}
|
|
166
|
+
* @hidden
|
|
167
|
+
*/
|
|
168
|
+
export function updateControlDisabled(element: HTMLElement, moduleName: string, disable: boolean): void {
|
|
169
|
+
const control: EJ2Control = getComponent(element, moduleName);
|
|
170
|
+
control.setProperties(moduleName === 'combobox' ? { enabled: !disable } : { disabled: disable });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Gets the ribbon item element.
|
|
175
|
+
*
|
|
176
|
+
* @param {Ribbon} parent - Gets the parent element.
|
|
177
|
+
* @param {string} id - Gets the ID of the item.
|
|
178
|
+
* @param {itemProps} itemProp - Gets the ribbon item.
|
|
179
|
+
* @returns {HTMLElement} - Gets the ribbon item element.
|
|
180
|
+
* @hidden
|
|
181
|
+
*/
|
|
182
|
+
export function getItemElement(parent: Ribbon, id: string, itemProp?: itemProps): HTMLElement {
|
|
183
|
+
if (!itemProp) {
|
|
184
|
+
itemProp = getItem(parent.tabs, id);
|
|
185
|
+
if (!itemProp) { return null; }
|
|
186
|
+
}
|
|
187
|
+
let contentEle: HTMLElement = parent.tabObj.items[itemProp.tabIndex].content as HTMLElement;
|
|
188
|
+
if (contentEle.innerHTML === '') { return null; }
|
|
189
|
+
if (parent.activeLayout === RibbonLayout.Classic) {
|
|
190
|
+
if (itemProp.item.displayOptions & DisplayMode.Classic) {
|
|
191
|
+
contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
|
|
192
|
+
: contentEle;
|
|
193
|
+
return contentEle.querySelector('#' + id);
|
|
194
|
+
}
|
|
195
|
+
else { return null; }
|
|
196
|
+
} else {
|
|
197
|
+
//Checks for Simplified and Auto options (Auto = classic + simplified + popup)
|
|
198
|
+
let ele: HTMLElement = (itemProp.item.displayOptions & DisplayMode.Simplified) ?
|
|
199
|
+
contentEle.querySelector('#' + itemProp.item.id) : null;
|
|
200
|
+
// element will be null for "Popup" and if the item is moved to overflow in "Auto" mode
|
|
201
|
+
if (!ele){
|
|
202
|
+
const dropdown: DropDownButton = itemProp.group.enableGroupOverflow ?
|
|
203
|
+
getComponent(contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID) as HTMLElement, DropDownButton)
|
|
204
|
+
: parent.overflowDDB;
|
|
205
|
+
ele = (dropdown.target as HTMLElement).querySelector('#' + itemProp.item.id);
|
|
206
|
+
}
|
|
207
|
+
return ele;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @param {RibbonTooltipModel} tooltip - Gets the property of tooltip.
|
|
213
|
+
* @returns {boolean} - Gets whether the tooltip is present or not.
|
|
214
|
+
* @hidden
|
|
215
|
+
*/
|
|
216
|
+
export function isTooltipPresent(tooltip: RibbonTooltipModel): boolean {
|
|
217
|
+
return (tooltip.content || tooltip.iconCss || tooltip.title || tooltip.id || tooltip.cssClass) ? true : false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Sets content for tooltip.
|
|
222
|
+
*
|
|
223
|
+
* @param {TooltipEventArgs} args - Gets the argument of tooltip.
|
|
224
|
+
* @param {Tooltip} tooltip - Gets the tooltip to set the content.
|
|
225
|
+
* @param {ribbonTooltipData} tooltipData - Gets the tooltip data.
|
|
226
|
+
* @returns {void}
|
|
227
|
+
* @hidden
|
|
228
|
+
*/
|
|
229
|
+
export function setToolTipContent(args: TooltipEventArgs, tooltip: Tooltip, tooltipData: ribbonTooltipData[]): void {
|
|
230
|
+
const targetId: string = args.target.getAttribute('id');
|
|
231
|
+
const dataObj: ribbonTooltipData = tooltipData.filter((e: ribbonTooltipData) => e.id === targetId)[0];
|
|
232
|
+
const data: RibbonTooltipModel = dataObj.data;
|
|
233
|
+
const content: HTMLElement = tooltip.createElement('div', {
|
|
234
|
+
id: data.id ? constants.RIBBON_TOOLTIP_CONTAINER + '_' + data.id : constants.RIBBON_TOOLTIP_CONTAINER
|
|
235
|
+
});
|
|
236
|
+
tooltip.element.append(content);
|
|
237
|
+
if (data.title) {
|
|
238
|
+
const header: HTMLElement = tooltip.createElement('div', {
|
|
239
|
+
innerHTML: data.title,
|
|
240
|
+
className: constants.RIBBON_TOOLTIP_TITLE
|
|
241
|
+
});
|
|
242
|
+
content.appendChild(header);
|
|
243
|
+
}
|
|
244
|
+
const textContainer: HTMLElement = tooltip.createElement('div', {
|
|
245
|
+
className: constants.RIBBON_TEXT_CONTAINER
|
|
246
|
+
});
|
|
247
|
+
content.appendChild(textContainer);
|
|
248
|
+
if (data.iconCss) {
|
|
249
|
+
const customCss: HTMLElement = tooltip.createElement('div', {
|
|
250
|
+
className: data.iconCss + ' ' + constants.RIBBON_TOOLTIP_ICON
|
|
251
|
+
});
|
|
252
|
+
textContainer.appendChild(customCss);
|
|
253
|
+
}
|
|
254
|
+
if (data.content) {
|
|
255
|
+
const tooltipContent: HTMLElement = tooltip.createElement('div', {
|
|
256
|
+
innerHTML: data.content,
|
|
257
|
+
className: constants.RIBBON_TOOLTIP_CONTENT
|
|
258
|
+
});
|
|
259
|
+
textContainer.appendChild(tooltipContent);
|
|
260
|
+
}
|
|
261
|
+
tooltip.setProperties({
|
|
262
|
+
content: content,
|
|
263
|
+
cssClass: data.cssClass ? data.cssClass + ' ' + constants.RIBBON_TOOLTIP : constants.RIBBON_TOOLTIP
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Creates tooltip.
|
|
268
|
+
*
|
|
269
|
+
* @param {HTMLElement} element - Gets the element to add tooltip.
|
|
270
|
+
* @param {Ribbon} ribbon - Gets the ribbon.
|
|
271
|
+
* @returns {void}
|
|
272
|
+
* @hidden
|
|
273
|
+
*/
|
|
274
|
+
export function createTooltip(element: HTMLElement, ribbon: Ribbon): void {
|
|
275
|
+
const ribbonTooltip: Tooltip = new Tooltip({
|
|
276
|
+
target: '.' + constants.RIBBON_TOOLTIP_TARGET,
|
|
277
|
+
beforeRender: beforeTooltipRender.bind(this),
|
|
278
|
+
windowCollision: true
|
|
279
|
+
});
|
|
280
|
+
ribbonTooltip.appendTo(element);
|
|
281
|
+
/**
|
|
282
|
+
* @param {TooltipEventArgs} args - Gets the tooltip argument.
|
|
283
|
+
* @returns {void}
|
|
284
|
+
* @hidden
|
|
285
|
+
*/
|
|
286
|
+
function beforeTooltipRender(args: TooltipEventArgs): void {
|
|
287
|
+
setToolTipContent(args, ribbonTooltip, ribbon.tooltipData);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Destroys tooltip
|
|
293
|
+
*
|
|
294
|
+
* @param {HTMLElement} element - Gets the element in which the tooltip needs to be destroyed.
|
|
295
|
+
* @returns {void}
|
|
296
|
+
* @hidden
|
|
297
|
+
*/
|
|
298
|
+
export function destroyTooltip(element: HTMLElement): void {
|
|
299
|
+
const control: Tooltip = getComponent(element, Tooltip);
|
|
300
|
+
control.destroy();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Updates tooltip
|
|
305
|
+
*
|
|
306
|
+
* @param {HTMLElement} element - Gets the element in which the tooltip needs to be Updated.
|
|
307
|
+
* @param {commonProperties} prop - Gets the property to be updated.
|
|
308
|
+
* @returns {void}
|
|
309
|
+
* @hidden
|
|
310
|
+
*/
|
|
311
|
+
export function updateTooltipProp(element: HTMLElement, prop: commonProperties): void {
|
|
312
|
+
const control: Tooltip = getComponent(element, Tooltip);
|
|
313
|
+
control.setProperties(prop);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Sets the HTML attributes of an element
|
|
318
|
+
*
|
|
319
|
+
* @param {HTMLElement} element - The HTML element for which attributes are to be updated.
|
|
320
|
+
* @param {commonProperties} attributes - An object containing key-value pairs of attributes to be updated.
|
|
321
|
+
* @returns {void}
|
|
322
|
+
* @hidden
|
|
323
|
+
*/
|
|
324
|
+
export function setCustomAttributes(element: HTMLElement, attributes: { [key: string]: string }): void {
|
|
325
|
+
for (const key in attributes) {
|
|
326
|
+
if (key === 'class') {
|
|
327
|
+
const elementClass: string = attributes['class'].replace(/\s+/g, ' ').trim();
|
|
328
|
+
if (elementClass) {
|
|
329
|
+
addClass([element], elementClass.split(' '));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
else if (key === 'style') {
|
|
333
|
+
const prevStyles: string = element.getAttribute('style') || '';
|
|
334
|
+
const value: string = `${prevStyles}${attributes[`${key}`]}`;
|
|
335
|
+
element.setAttribute(`${key}`, value);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
element.setAttribute(key, attributes[`${key}`]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './ribbon-button';
|
|
2
|
+
export * from './ribbon-checkbox';
|
|
3
|
+
export * from './ribbon-colorpicker';
|
|
4
|
+
export * from './ribbon-combobox';
|
|
5
|
+
export * from './ribbon-dropdown';
|
|
6
|
+
export * from './ribbon-splitbutton';
|
|
7
|
+
export * from './ribbon-groupbutton';
|
|
8
|
+
export * from './ribbon-gallery';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './ribbon-button';
|
|
2
|
+
export * from './ribbon-checkbox';
|
|
3
|
+
export * from './ribbon-colorpicker';
|
|
4
|
+
export * from './ribbon-combobox';
|
|
5
|
+
export * from './ribbon-dropdown';
|
|
6
|
+
export * from './ribbon-splitbutton';
|
|
7
|
+
export * from './ribbon-groupbutton';
|
|
8
|
+
export * from './ribbon-gallery';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Ribbon } from '../base/index';
|
|
2
|
+
import { RibbonButtonSettingsModel, RibbonItemModel } from '../models/index';
|
|
3
|
+
import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the items of Ribbon.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RibbonButton {
|
|
8
|
+
private parent;
|
|
9
|
+
constructor(parent: Ribbon);
|
|
10
|
+
protected getModuleName(): string;
|
|
11
|
+
protected destroy(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Creates button.
|
|
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
|
+
createButton(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 button.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} controlId - Gets the control ID.
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
46
|
+
click(controlId: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Updates the button properties.
|
|
49
|
+
*
|
|
50
|
+
* @param {RibbonButtonSettingsModel} prop - Gets the button property.
|
|
51
|
+
* @param {string} id - Gets the ID of button item.
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
updateButton(prop: RibbonButtonSettingsModel, id: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the button size.
|
|
57
|
+
*
|
|
58
|
+
* @param {HTMLElement} element - Gets the button element.
|
|
59
|
+
* @param {RibbonItemModel} item - Gets the ribbon item.
|
|
60
|
+
* @returns {void}
|
|
61
|
+
* @hidden
|
|
62
|
+
*/
|
|
63
|
+
updateButtonSize(element: HTMLElement, item: RibbonItemModel): void;
|
|
64
|
+
}
|