| 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 | 1×
1×
1×
1×
687×
1×
8338×
1×
353×
1×
192×
192×
192×
192×
192×
192×
192×
5×
2×
1×
120×
120×
120×
1×
1×
120×
120×
120×
120×
120×
6×
6×
3×
6×
5×
4×
1×
37×
37×
37×
1×
1×
1×
37×
37×
37×
78×
37×
37×
2×
1×
1×
7×
7×
1×
1×
1×
2×
2×
1×
1×
1×
4×
4×
1×
3×
1×
6×
6×
1×
5×
5×
5×
1×
4×
2×
4×
4×
4×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-dropdowns", "../base/index"], function (require, exports, ej2_base_1, ej2_dropdowns_1, index_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var RibbonComboBox = (function () {
function RibbonComboBox(parent) {
this.parent = parent;
}
RibbonComboBox.prototype.getModuleName = function () {
return 'ribbonComboBox';
};
RibbonComboBox.prototype.destroy = function () {
this.parent = null;
};
RibbonComboBox.prototype.createComboBox = function (item, itemEle) {
var _this = this;
var inputEle = this.parent.createElement('input', {
id: item.id
});
itemEle.appendChild(inputEle);
var comboBoxSettings = item.comboBoxSettings;
Eif (comboBoxSettings.htmlAttributes) {
Iif (comboBoxSettings.htmlAttributes.id) {
delete comboBoxSettings.htmlAttributes.id;
}
}
new ej2_dropdowns_1.ComboBox({
locale: this.parent.locale,
enableRtl: this.parent.enableRtl,
enablePersistence: this.parent.enablePersistence,
allowCustom: false,
floatLabelType: 'Never',
ignoreAccent: true,
ignoreCase: true,
allowFiltering: comboBoxSettings.allowFiltering,
autofill: comboBoxSettings.autofill,
cssClass: (index_1.RIBBON_CONTROL + index_1.SPACE + (comboBoxSettings.cssClass ? comboBoxSettings.cssClass : '')).trim(),
dataSource: comboBoxSettings.dataSource,
enabled: !item.disabled,
fields: comboBoxSettings.fields,
filterType: comboBoxSettings.filterType,
footerTemplate: comboBoxSettings.footerTemplate,
groupTemplate: comboBoxSettings.groupTemplate,
headerTemplate: comboBoxSettings.headerTemplate,
index: comboBoxSettings.index,
itemTemplate: comboBoxSettings.itemTemplate,
noRecordsTemplate: comboBoxSettings.noRecordsTemplate,
placeholder: comboBoxSettings.placeholder,
popupHeight: comboBoxSettings.popupHeight,
popupWidth: comboBoxSettings.popupWidth,
showClearButton: comboBoxSettings.showClearButton,
sortOrder: comboBoxSettings.sortOrder,
text: comboBoxSettings.text,
value: comboBoxSettings.value,
width: comboBoxSettings.width,
beforeOpen: comboBoxSettings.beforeOpen,
open: comboBoxSettings.open,
htmlAttributes: comboBoxSettings.htmlAttributes,
close: function (e) {
if (comboBoxSettings.close) {
comboBoxSettings.close.call(_this, e);
}
},
filtering: comboBoxSettings.filtering,
change: comboBoxSettings.change,
select: comboBoxSettings.select,
created: comboBoxSettings.created
}, inputEle);
};
RibbonComboBox.prototype.addOverFlowEvents = function (item, itemEle, overflowButton) {
var _this = this;
var comboBoxSettings = item.comboBoxSettings;
if (comboBoxSettings.label && this.parent.activeLayout === 'Simplified') {
var label = this.parent.createElement('div', {
className: 'e-ribbon-combobox-label',
id: item.id + '_label',
innerHTML: comboBoxSettings.label
});
itemEle.insertBefore(label, itemEle.firstChild);
}
var inputEle = itemEle.querySelector('#' + item.id);
inputEle.setAttribute('data-control', item.type.toString());
var comboBoxObj = ej2_base_1.getComponent(inputEle, ej2_dropdowns_1.ComboBox);
comboBoxObj.setProperties({ cssClass: comboBoxObj.cssClass + index_1.SPACE + index_1.RIBBON_POPUP_CONTROL });
comboBoxObj.close = function (e) {
var target = e.event ? e.event.target : null;
if (item.comboBoxSettings.close) {
item.comboBoxSettings.close.call(_this, e);
}
if (target && !target.closest('.e-ribbon-group-overflow-ddb')) {
if (overflowButton.element.classList.contains('e-active')) {
overflowButton.toggle();
}
}
};
};
RibbonComboBox.prototype.removeOverFlowEvents = function (item, itemEle) {
var _this = this;
var comboBoxSettings = item.comboBoxSettings;
if (comboBoxSettings.label) {
var label = itemEle.querySelector('#' + item.id + '_label');
Eif (label) {
label.remove();
}
}
var inputEle = itemEle.querySelector('#' + item.id);
var comboBoxObj = ej2_base_1.getComponent(inputEle, ej2_dropdowns_1.ComboBox);
var cssClass = comboBoxObj.cssClass.split(index_1.SPACE);
cssClass = cssClass.filter(function (value) { return value !== index_1.RIBBON_POPUP_CONTROL; });
comboBoxObj.setProperties({ cssClass: cssClass.join(index_1.SPACE) });
comboBoxObj.close = function (e) {
if (item.comboBoxSettings.close) {
item.comboBoxSettings.close.call(_this, e);
}
};
};
RibbonComboBox.prototype.getComboBoxObj = function (controlId) {
var inputEle = index_1.getItemElement(this.parent, controlId);
return inputEle ? ej2_base_1.getComponent(inputEle, ej2_dropdowns_1.ComboBox) : null;
};
RibbonComboBox.prototype.filter = function (controlId, dataSource, query, fields) {
this.getComboBoxObj(controlId).filter(dataSource, query, fields);
};
RibbonComboBox.prototype.hidePopup = function (controlId) {
var comboBoxObj = this.getComboBoxObj(controlId);
if (!comboBoxObj) {
return;
}
comboBoxObj.hidePopup();
};
RibbonComboBox.prototype.showPopup = function (controlId) {
var comboBoxObj = this.getComboBoxObj(controlId);
if (!comboBoxObj) {
return;
}
comboBoxObj.showPopup();
};
RibbonComboBox.prototype.updateComboBox = function (prop, id) {
var itemProp = index_1.getItem(this.parent.tabs, id);
if (!itemProp) {
return;
}
ej2_base_1.merge(itemProp.item.comboBoxSettings, prop);
var inputEle = index_1.getItemElement(this.parent, id, itemProp);
if (!inputEle) {
return;
}
if (prop.cssClass) {
prop.cssClass = (index_1.RIBBON_CONTROL + index_1.SPACE + prop.cssClass).trim();
}
delete prop.close;
var comboBoxObj = ej2_base_1.getComponent(inputEle, ej2_dropdowns_1.ComboBox);
comboBoxObj.setProperties(prop);
};
return RibbonComboBox;
}());
exports.RibbonComboBox = RibbonComboBox;
});
|