| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224 | 1×
1×
1×
3597×
1679×
900×
2697×
1×
1×
99×
99×
99×
99×
30×
2×
28×
69×
99×
1×
1×
3825×
4813×
4813×
8085×
8085×
11025×
11025×
20927×
20927×
1137×
2688×
1×
1×
22×
28×
28×
37×
37×
53×
53×
19×
3×
1×
1×
883×
921×
921×
3007×
3007×
878×
5×
1×
1×
1939×
1939×
1×
1×
67×
67×
1×
1×
41×
41×
1×
1×
316×
143×
143×
5×
311×
311×
14×
297×
182×
181×
181×
1×
115×
115×
65×
65×
115×
1×
1×
2347×
1×
1×
10×
18×
10×
10×
10×
10×
10×
10×
10×
10×
10×
6×
6×
10×
10×
10×
10×
1×
1×
694×
694×
1×
10×
1×
1×
518×
518×
1×
1×
3×
3×
1×
1×
2124×
123×
2×
2×
2×
121×
2×
2×
2×
119×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-popups", "./interface", "./constant", "@syncfusion/ej2-splitbuttons"], function (require, exports, ej2_base_1, ej2_popups_1, interface_1, constants, ej2_splitbuttons_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function getIndex(arr, condition) {
for (var i = 0; i < arr.length; i++) {
if (condition(arr[parseInt(i.toString(), 10)], i)) {
return i;
}
}
return -1;
}
exports.getIndex = getIndex;
function getTemplateFunction(template) {
Eif (typeof template === 'string') {
var content = '';
try {
var tempEle = ej2_base_1.select(template);
if (tempEle) {
content = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
}
else {
content = template;
}
}
catch (e) {
content = template;
}
return ej2_base_1.compile(content);
}
else {
return ej2_base_1.compile(template);
}
}
exports.getTemplateFunction = getTemplateFunction;
function getItem(tabs, id, type) {
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[parseInt(i.toString(), 10)];
for (var j = 0; j < tab.groups.length; j++) {
var group = tab.groups[parseInt(j.toString(), 10)];
for (var k = 0; k < group.collections.length; k++) {
var collection = group.collections[parseInt(k.toString(), 10)];
for (var l = 0; l < collection.items.length; l++) {
var item = collection.items[parseInt(l.toString(), 10)];
if ((id && item.id === id) || (type && item.type === type)) {
return {
item: item, collection: collection, group: group,
tabIndex: i, groupIndex: j, collectionIndex: k, itemIndex: l
};
}
}
}
}
}
return null;
}
exports.getItem = getItem;
function getCollection(tabs, id) {
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[parseInt(i.toString(), 10)];
for (var j = 0; j < tab.groups.length; j++) {
var group = tab.groups[parseInt(j.toString(), 10)];
for (var k = 0; k < group.collections.length; k++) {
var collection = group.collections[parseInt(k.toString(), 10)];
if (collection.id === id) {
return {
collection: collection, group: group,
tabIndex: i, groupIndex: j, collectionIndex: k
};
}
}
}
}
return null;
}
exports.getCollection = getCollection;
function getGroup(tabs, id) {
for (var i = 0; i < tabs.length; i++) {
var tab = tabs[parseInt(i.toString(), 10)];
for (var j = 0; j < tab.groups.length; j++) {
var group = tab.groups[parseInt(j.toString(), 10)];
if (group.id === id) {
return {
group: group, tabIndex: i, groupIndex: j
};
}
}
}
return null;
}
exports.getGroup = getGroup;
function destroyControl(element, moduleName) {
var control = ej2_base_1.getComponent(element, moduleName);
control.destroy();
}
exports.destroyControl = destroyControl;
function updateCommonProperty(element, moduleName, commonProp) {
var control = ej2_base_1.getComponent(element, moduleName);
control.setProperties(commonProp);
}
exports.updateCommonProperty = updateCommonProperty;
function updateControlDisabled(element, moduleName, disable) {
var control = ej2_base_1.getComponent(element, moduleName);
control.setProperties(moduleName === 'combobox' ? { enabled: !disable } : { disabled: disable });
}
exports.updateControlDisabled = updateControlDisabled;
function getItemElement(parent, id, itemProp) {
if (!itemProp) {
itemProp = getItem(parent.tabs, id);
if (!itemProp) {
return null;
}
}
var contentEle = parent.tabObj.items[itemProp.tabIndex].content;
if (contentEle.innerHTML === '') {
return null;
}
if (parent.activeLayout === interface_1.RibbonLayout.Classic) {
if (itemProp.item.displayOptions & interface_1.DisplayMode.Classic) {
contentEle = (itemProp.group.isCollapsed) ? parent.ribbonDropDownModule.getOverflowDropDownPopup(itemProp, contentEle)
: contentEle;
return contentEle.querySelector('#' + id);
}
else {
return null;
}
}
else {
var ele = (itemProp.item.displayOptions & interface_1.DisplayMode.Simplified) ?
contentEle.querySelector('#' + itemProp.item.id) : null;
if (!ele) {
var dropdown = itemProp.group.enableGroupOverflow ?
ej2_base_1.getComponent(contentEle.querySelector('#' + itemProp.group.id + constants.GROUPOF_BUTTON_ID), ej2_splitbuttons_1.DropDownButton)
: parent.overflowDDB;
ele = dropdown.target.querySelector('#' + itemProp.item.id);
}
return ele;
}
}
exports.getItemElement = getItemElement;
function isTooltipPresent(tooltip) {
return (tooltip.content || tooltip.iconCss || tooltip.title || tooltip.id || tooltip.cssClass) ? true : false;
}
exports.isTooltipPresent = isTooltipPresent;
function setToolTipContent(args, tooltip, tooltipData) {
var targetId = args.target.getAttribute('id');
var dataObj = tooltipData.filter(function (e) { return e.id === targetId; })[0];
var data = dataObj.data;
var content = tooltip.createElement('div', {
id: data.id ? constants.RIBBON_TOOLTIP_CONTAINER + '_' + data.id : constants.RIBBON_TOOLTIP_CONTAINER
});
tooltip.element.append(content);
Eif (data.title) {
var header = tooltip.createElement('div', {
innerHTML: data.title,
className: constants.RIBBON_TOOLTIP_TITLE
});
content.appendChild(header);
}
var textContainer = tooltip.createElement('div', {
className: constants.RIBBON_TEXT_CONTAINER
});
content.appendChild(textContainer);
if (data.iconCss) {
var customCss = tooltip.createElement('div', {
className: data.iconCss + ' ' + constants.RIBBON_TOOLTIP_ICON
});
textContainer.appendChild(customCss);
}
Eif (data.content) {
var tooltipContent = tooltip.createElement('div', {
innerHTML: data.content,
className: constants.RIBBON_TOOLTIP_CONTENT
});
textContainer.appendChild(tooltipContent);
}
tooltip.setProperties({
content: content,
cssClass: data.cssClass ? data.cssClass + ' ' + constants.RIBBON_TOOLTIP : constants.RIBBON_TOOLTIP
});
}
exports.setToolTipContent = setToolTipContent;
function createTooltip(element, ribbon) {
var ribbonTooltip = new ej2_popups_1.Tooltip({
target: '.' + constants.RIBBON_TOOLTIP_TARGET,
beforeRender: beforeTooltipRender.bind(this),
windowCollision: true
});
ribbonTooltip.appendTo(element);
function beforeTooltipRender(args) {
setToolTipContent(args, ribbonTooltip, ribbon.tooltipData);
}
}
exports.createTooltip = createTooltip;
function destroyTooltip(element) {
var control = ej2_base_1.getComponent(element, ej2_popups_1.Tooltip);
control.destroy();
}
exports.destroyTooltip = destroyTooltip;
function updateTooltipProp(element, prop) {
var control = ej2_base_1.getComponent(element, ej2_popups_1.Tooltip);
control.setProperties(prop);
}
exports.updateTooltipProp = updateTooltipProp;
function setCustomAttributes(element, attributes) {
for (var key in attributes) {
if (key === 'class') {
var elementClass = attributes['class'].replace(/\s+/g, ' ').trim();
Eif (elementClass) {
ej2_base_1.addClass([element], elementClass.split(' '));
}
}
else if (key === 'style') {
var prevStyles = element.getAttribute('style') || '';
var value = "" + prevStyles + attributes["" + key];
element.setAttribute("" + key, value);
}
else {
element.setAttribute(key, attributes["" + key]);
}
}
}
exports.setCustomAttributes = setCustomAttributes;
});
|