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 | 1×
1×
1×
1×
60×
60×
60×
60×
60×
60×
59×
59×
1×
56×
56×
56×
56×
56×
56×
56×
56×
56×
56×
3×
3×
2×
1×
1×
1×
56×
56×
1×
2×
1×
4×
4×
1×
1×
56×
56×
56×
13×
13×
8×
8×
56×
48×
1×
1×
11×
1×
47×
56×
1×
43×
1×
76×
20×
56×
56×
56×
56×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-dropdowns", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../base/constant", "../base/string-literals"], function (require, exports, ej2_dropdowns_1, ej2_base_1, ej2_data_1, events, literals) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var FlMenuOptrUI = (function () {
function FlMenuOptrUI(parent, customFltrOperators, serviceLocator, filterSettings) {
this.ddOpen = this.dropDownOpen.bind(this);
this.parent = parent;
this.serviceLocator = serviceLocator;
this.filterSettings = filterSettings;
this.customFilterOperators = customFltrOperators;
if (this.parent) {
this.parent.on(events.filterMenuClose, this.destroyDropDownList, this);
this.parent.on(events.destroy, this.destroyDropDownList, this);
}
}
FlMenuOptrUI.prototype.renderOperatorUI = function (dlgConetntEle, target, column, dlgObj, operator) {
this.dialogObj = dlgObj;
var optr = column.type + 'Operator';
this.optrData = this.customOptr = !ej2_base_1.isNullOrUndefined(operator) ? operator :
(!ej2_base_1.isNullOrUndefined(this.parent.filterSettings.operators) && !ej2_base_1.isNullOrUndefined(this.parent.filterSettings.operators["" + optr])) ?
this.parent.filterSettings.operators["" + optr] : this.customFilterOperators["" + optr];
var dropDatasource = this.customOptr;
var selectedValue = this.dropSelectedVal(column, optr);
var optrDiv = this.parent.createElement('div', { className: 'e-flm_optrdiv' });
dlgConetntEle.appendChild(optrDiv);
var optrInput = this.parent.createElement('input', { id: column.uid + '-floptr' });
optrDiv.appendChild(optrInput);
this.dropOptr = new ej2_dropdowns_1.DropDownList({
dataSource: dropDatasource,
fields: { text: 'text', value: 'value' },
cssClass: this.parent.cssClass ? 'e-popup-flmenu' + ' ' + this.parent.cssClass : 'e-popup-flmenu',
enableRtl: this.parent.enableRtl,
text: selectedValue,
change: function () {
var valInput = document.querySelector('.e-flmenu-valuediv').querySelector('input');
if (this.value === 'isempty' || this.value === 'isnotempty' ||
this.value === 'isnotnull' || this.value === 'isnull') {
if (!ej2_base_1.isNullOrUndefined(valInput['ej2_instances'])) {
valInput['ej2_instances'][0]['enabled'] = false;
}
else {
valInput.setAttribute('disabled', 'true');
}
}
else Iif (!ej2_base_1.isNullOrUndefined(valInput.getAttribute('disabled'))) {
if (!ej2_base_1.isNullOrUndefined(valInput['ej2_instances'])) {
valInput['ej2_instances'][0]['enabled'] = true;
}
else {
valInput.removeAttribute('disabled');
}
}
}
});
this.dropOptr.addEventListener(literals['open'], this.ddOpen);
this.dropOptr.appendTo('#' + column.uid + '-floptr');
};
FlMenuOptrUI.prototype.renderResponsiveDropDownList = function (args) {
args.popup.element.style.width = '100%';
};
FlMenuOptrUI.prototype.dropDownOpen = function (args) {
args.popup.element.style.zIndex = (this.dialogObj.zIndex + 1).toString();
if (this.parent.enableAdaptiveUI) {
this.renderResponsiveDropDownList(args);
}
};
FlMenuOptrUI.prototype.dropSelectedVal = function (col, optr) {
var selValue = '';
var columns = this.parent.filterSettings.columns;
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
var column = columns_1[_i];
if (col.field === column.field || (col.isForeignColumn() && col.foreignKeyValue === column.field)) {
var selectedField = new ej2_data_1.DataManager(this.optrData).executeLocal(new ej2_data_1.Query().where('value', 'equal', column.operator));
selValue = !ej2_base_1.isNullOrUndefined(selectedField[0]) ? selectedField[0].text : '';
}
}
if (selValue === '') {
if (col.filter.operator) {
var optrLen = Object.keys(this.optrData).length;
for (var i = 0; i < optrLen; i++) {
if (this.optrData[parseInt(i.toString(), 10)].value === col.filter.operator) {
selValue = this.optrData[parseInt(i.toString(), 10)].text;
}
}
}
else {
selValue = this.optrData[0].text;
}
}
return selValue;
};
FlMenuOptrUI.prototype.getFlOperator = function () {
return this.dropOptr.value;
};
FlMenuOptrUI.prototype.destroyDropDownList = function () {
if (this.dropOptr.isDestroyed) {
return;
}
this.dropOptr.removeEventListener(literals['open'], this.ddOpen);
this.dropOptr.destroy();
this.parent.off(events.filterMenuClose, this.destroyDropDownList);
this.parent.off(events.destroy, this.destroyDropDownList);
};
return FlMenuOptrUI;
}());
exports.FlMenuOptrUI = FlMenuOptrUI;
});
|