@syncfusion/ej2-multicolumn-combobox 26.1.35
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/README.md +47 -0
- package/dist/ej2-multicolumn-combobox.umd.min.js +2 -0
- package/dist/ej2-multicolumn-combobox.umd.min.js.map +1 -0
- package/dist/es6/ej2-multicolumn-combobox.es2015.js +1612 -0
- package/dist/es6/ej2-multicolumn-combobox.es2015.js.map +1 -0
- package/dist/es6/ej2-multicolumn-combobox.es5.js +1663 -0
- package/dist/es6/ej2-multicolumn-combobox.es5.js.map +1 -0
- package/dist/global/ej2-multicolumn-combobox.min.js +2 -0
- package/dist/global/ej2-multicolumn-combobox.min.js.map +1 -0
- package/dist/global/index.d.ts +5 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/multicolumn-combobox.d.ts +4 -0
- package/multicolumn-combobox.js +4 -0
- package/package.json +62 -0
- package/src/global.js +3 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -0
- package/src/multicolumn-combobox/index.d.ts +6 -0
- package/src/multicolumn-combobox/index.js +5 -0
- package/src/multicolumn-combobox/multi-column-combo-box-model.d.ts +527 -0
- package/src/multicolumn-combobox/multi-column-combo-box.d.ts +860 -0
- package/src/multicolumn-combobox/multi-column-combo-box.js +1666 -0
- package/styles/bootstrap-dark.css +331 -0
- package/styles/bootstrap-dark.scss +10 -0
- package/styles/bootstrap.css +331 -0
- package/styles/bootstrap.scss +10 -0
- package/styles/bootstrap4.css +395 -0
- package/styles/bootstrap4.scss +10 -0
- package/styles/bootstrap5-dark.css +399 -0
- package/styles/bootstrap5-dark.scss +10 -0
- package/styles/bootstrap5.css +399 -0
- package/styles/bootstrap5.scss +10 -0
- package/styles/fabric-dark.css +306 -0
- package/styles/fabric-dark.scss +10 -0
- package/styles/fabric.css +299 -0
- package/styles/fabric.scss +10 -0
- package/styles/fluent-dark.css +379 -0
- package/styles/fluent-dark.scss +10 -0
- package/styles/fluent.css +379 -0
- package/styles/fluent.scss +10 -0
- package/styles/fluent2.css +1408 -0
- package/styles/fluent2.scss +10 -0
- package/styles/highcontrast-light.css +317 -0
- package/styles/highcontrast-light.scss +10 -0
- package/styles/highcontrast.css +317 -0
- package/styles/highcontrast.scss +10 -0
- package/styles/material-dark.css +339 -0
- package/styles/material-dark.scss +10 -0
- package/styles/material.css +364 -0
- package/styles/material.scss +10 -0
- package/styles/material3-dark.css +431 -0
- package/styles/material3-dark.scss +12 -0
- package/styles/material3.css +487 -0
- package/styles/material3.scss +12 -0
- package/styles/multicolumn-combobox/_all.scss +2 -0
- package/styles/multicolumn-combobox/_bds-definition.scss +29 -0
- package/styles/multicolumn-combobox/_bootstrap-dark-definition.scss +29 -0
- package/styles/multicolumn-combobox/_bootstrap-definition.scss +29 -0
- package/styles/multicolumn-combobox/_bootstrap4-definition.scss +29 -0
- package/styles/multicolumn-combobox/_bootstrap5-dark-definition.scss +1 -0
- package/styles/multicolumn-combobox/_bootstrap5-definition.scss +29 -0
- package/styles/multicolumn-combobox/_bootstrap5.3-definition.scss +29 -0
- package/styles/multicolumn-combobox/_fabric-dark-definition.scss +29 -0
- package/styles/multicolumn-combobox/_fabric-definition.scss +29 -0
- package/styles/multicolumn-combobox/_fluent-dark-definition.scss +1 -0
- package/styles/multicolumn-combobox/_fluent-definition.scss +29 -0
- package/styles/multicolumn-combobox/_fluent2-definition.scss +29 -0
- package/styles/multicolumn-combobox/_fusionnew-definition.scss +29 -0
- package/styles/multicolumn-combobox/_highcontrast-definition.scss +29 -0
- package/styles/multicolumn-combobox/_highcontrast-light-definition.scss +29 -0
- package/styles/multicolumn-combobox/_layout.scss +130 -0
- package/styles/multicolumn-combobox/_material-dark-definition.scss +29 -0
- package/styles/multicolumn-combobox/_material-definition.scss +29 -0
- package/styles/multicolumn-combobox/_material3-dark-definition.scss +1 -0
- package/styles/multicolumn-combobox/_material3-definition.scss +29 -0
- package/styles/multicolumn-combobox/_tailwind-dark-definition.scss +1 -0
- package/styles/multicolumn-combobox/_tailwind-definition.scss +29 -0
- package/styles/multicolumn-combobox/_theme.scss +49 -0
- package/styles/multicolumn-combobox/bootstrap-dark.css +331 -0
- package/styles/multicolumn-combobox/bootstrap-dark.scss +10 -0
- package/styles/multicolumn-combobox/bootstrap.css +331 -0
- package/styles/multicolumn-combobox/bootstrap.scss +10 -0
- package/styles/multicolumn-combobox/bootstrap4.css +395 -0
- package/styles/multicolumn-combobox/bootstrap4.scss +10 -0
- package/styles/multicolumn-combobox/bootstrap5-dark.css +399 -0
- package/styles/multicolumn-combobox/bootstrap5-dark.scss +10 -0
- package/styles/multicolumn-combobox/bootstrap5.css +399 -0
- package/styles/multicolumn-combobox/bootstrap5.scss +10 -0
- package/styles/multicolumn-combobox/fabric-dark.css +306 -0
- package/styles/multicolumn-combobox/fabric-dark.scss +10 -0
- package/styles/multicolumn-combobox/fabric.css +299 -0
- package/styles/multicolumn-combobox/fabric.scss +10 -0
- package/styles/multicolumn-combobox/fluent-dark.css +379 -0
- package/styles/multicolumn-combobox/fluent-dark.scss +10 -0
- package/styles/multicolumn-combobox/fluent.css +379 -0
- package/styles/multicolumn-combobox/fluent.scss +10 -0
- package/styles/multicolumn-combobox/fluent2.css +1408 -0
- package/styles/multicolumn-combobox/fluent2.scss +10 -0
- package/styles/multicolumn-combobox/highcontrast-light.css +317 -0
- package/styles/multicolumn-combobox/highcontrast-light.scss +10 -0
- package/styles/multicolumn-combobox/highcontrast.css +317 -0
- package/styles/multicolumn-combobox/highcontrast.scss +10 -0
- package/styles/multicolumn-combobox/icons/_bds.scss +6 -0
- package/styles/multicolumn-combobox/icons/_bootstrap-dark.scss +6 -0
- package/styles/multicolumn-combobox/icons/_bootstrap.scss +6 -0
- package/styles/multicolumn-combobox/icons/_bootstrap4.scss +6 -0
- package/styles/multicolumn-combobox/icons/_bootstrap5-dark.scss +1 -0
- package/styles/multicolumn-combobox/icons/_bootstrap5.3.scss +6 -0
- package/styles/multicolumn-combobox/icons/_bootstrap5.scss +6 -0
- package/styles/multicolumn-combobox/icons/_fabric-dark.scss +6 -0
- package/styles/multicolumn-combobox/icons/_fabric.scss +6 -0
- package/styles/multicolumn-combobox/icons/_fluent-dark.scss +1 -0
- package/styles/multicolumn-combobox/icons/_fluent.scss +6 -0
- package/styles/multicolumn-combobox/icons/_fluent2.scss +6 -0
- package/styles/multicolumn-combobox/icons/_fusionnew.scss +6 -0
- package/styles/multicolumn-combobox/icons/_highcontrast-light.scss +6 -0
- package/styles/multicolumn-combobox/icons/_highcontrast.scss +6 -0
- package/styles/multicolumn-combobox/icons/_material-dark.scss +6 -0
- package/styles/multicolumn-combobox/icons/_material.scss +6 -0
- package/styles/multicolumn-combobox/icons/_material3-dark.scss +1 -0
- package/styles/multicolumn-combobox/icons/_material3.scss +6 -0
- package/styles/multicolumn-combobox/icons/_tailwind-dark.scss +1 -0
- package/styles/multicolumn-combobox/icons/_tailwind.scss +6 -0
- package/styles/multicolumn-combobox/material-dark.css +339 -0
- package/styles/multicolumn-combobox/material-dark.scss +10 -0
- package/styles/multicolumn-combobox/material.css +364 -0
- package/styles/multicolumn-combobox/material.scss +10 -0
- package/styles/multicolumn-combobox/material3-dark.css +431 -0
- package/styles/multicolumn-combobox/material3-dark.scss +11 -0
- package/styles/multicolumn-combobox/material3.css +487 -0
- package/styles/multicolumn-combobox/material3.scss +11 -0
- package/styles/multicolumn-combobox/tailwind-dark.css +363 -0
- package/styles/multicolumn-combobox/tailwind-dark.scss +10 -0
- package/styles/multicolumn-combobox/tailwind.css +363 -0
- package/styles/multicolumn-combobox/tailwind.scss +10 -0
- package/styles/tailwind-dark.css +363 -0
- package/styles/tailwind-dark.scss +10 -0
- package/styles/tailwind.css +363 -0
- package/styles/tailwind.scss +10 -0
|
@@ -0,0 +1,1666 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
import { Component, EventHandler, Property, NotifyPropertyChanges, closest, attributes, append, compile, detach, KeyboardEvents } from '@syncfusion/ej2-base';
|
|
21
|
+
import { ChildProperty, prepend, Collection, getUniqueID, Complex, isNullOrUndefined as isNOU, select, L10n, Browser } from '@syncfusion/ej2-base';
|
|
22
|
+
import { formatUnit, addClass, removeClass, Event, Animation } from '@syncfusion/ej2-base';
|
|
23
|
+
import { Input } from '@syncfusion/ej2-inputs';
|
|
24
|
+
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
25
|
+
import { Popup } from '@syncfusion/ej2-popups';
|
|
26
|
+
import { Grid, VirtualScroll, Group as GridGroup, Edit, Sort } from '@syncfusion/ej2-grids';
|
|
27
|
+
var DROPDOWNICON = 'e-input-group-icon e-multicolumn-list-icon e-icons';
|
|
28
|
+
var CONTENT = 'e-popup-content';
|
|
29
|
+
var ICONANIMATION = 'e-icon-anim';
|
|
30
|
+
var NODATA = 'e-nodata';
|
|
31
|
+
var DISABLED = 'e-disabled';
|
|
32
|
+
var INPUTFOCUS = 'e-input-focus';
|
|
33
|
+
var MULTICOLUMNLIST = 'e-multicolumn-list';
|
|
34
|
+
var MULTICOLUMNGRID = 'e-multicolumn-grid';
|
|
35
|
+
var MultiColumnGrid = /** @class */ (function () {
|
|
36
|
+
function MultiColumnGrid() {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Injecting required modules for component.
|
|
40
|
+
*
|
|
41
|
+
* @returns {void}
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
MultiColumnGrid.prototype.InjectModules = function () {
|
|
45
|
+
Grid.Inject(VirtualScroll, GridGroup, Edit, Sort);
|
|
46
|
+
};
|
|
47
|
+
return MultiColumnGrid;
|
|
48
|
+
}());
|
|
49
|
+
export { MultiColumnGrid };
|
|
50
|
+
/**
|
|
51
|
+
* Defines the filter type.
|
|
52
|
+
*/
|
|
53
|
+
export var FilterType;
|
|
54
|
+
(function (FilterType) {
|
|
55
|
+
/**
|
|
56
|
+
* Checks whether a value begins with the specified value.
|
|
57
|
+
*/
|
|
58
|
+
FilterType["StartsWith"] = "StartsWith";
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether a value ends with specified value.
|
|
61
|
+
*/
|
|
62
|
+
FilterType["EndsWith"] = "EndsWith";
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether a value contains with specified value.
|
|
65
|
+
*/
|
|
66
|
+
FilterType["Contains"] = "Contains";
|
|
67
|
+
})(FilterType || (FilterType = {}));
|
|
68
|
+
/**
|
|
69
|
+
* Specifies the sortOrder to sort the data source.
|
|
70
|
+
*/
|
|
71
|
+
export var SortOrder;
|
|
72
|
+
(function (SortOrder) {
|
|
73
|
+
/**
|
|
74
|
+
* The datasource is not sorting. Default value is None.
|
|
75
|
+
*/
|
|
76
|
+
SortOrder["None"] = "None";
|
|
77
|
+
/**
|
|
78
|
+
* The datasource is sorting with ascending order.
|
|
79
|
+
*/
|
|
80
|
+
SortOrder["Ascending"] = "Ascending";
|
|
81
|
+
/**
|
|
82
|
+
* The data source is sorting with descending order.
|
|
83
|
+
*/
|
|
84
|
+
SortOrder["Descending"] = "Descending";
|
|
85
|
+
})(SortOrder || (SortOrder = {}));
|
|
86
|
+
/**
|
|
87
|
+
* Specifies the type of sorting to be applied for the columns.
|
|
88
|
+
*/
|
|
89
|
+
export var SortType;
|
|
90
|
+
(function (SortType) {
|
|
91
|
+
/**
|
|
92
|
+
* Allow sorting only one column
|
|
93
|
+
*/
|
|
94
|
+
SortType["OneColumn"] = "OneColumn";
|
|
95
|
+
/**
|
|
96
|
+
* Allow sorting multiple columns
|
|
97
|
+
*/
|
|
98
|
+
SortType["MultipleColumns"] = "MultipleColumns";
|
|
99
|
+
})(SortType || (SortType = {}));
|
|
100
|
+
/**
|
|
101
|
+
* The fields property maps the columns of the data table and binds the data to the component.
|
|
102
|
+
*/
|
|
103
|
+
var FieldSettings = /** @class */ (function (_super) {
|
|
104
|
+
__extends(FieldSettings, _super);
|
|
105
|
+
function FieldSettings() {
|
|
106
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
107
|
+
}
|
|
108
|
+
__decorate([
|
|
109
|
+
Property()
|
|
110
|
+
], FieldSettings.prototype, "text", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
Property()
|
|
113
|
+
], FieldSettings.prototype, "value", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
Property()
|
|
116
|
+
], FieldSettings.prototype, "groupBy", void 0);
|
|
117
|
+
return FieldSettings;
|
|
118
|
+
}(ChildProperty));
|
|
119
|
+
export { FieldSettings };
|
|
120
|
+
/**
|
|
121
|
+
* Specifies the number of columns and its respective fields to be displayed in the dropdown popup.
|
|
122
|
+
*/
|
|
123
|
+
var Column = /** @class */ (function (_super) {
|
|
124
|
+
__extends(Column, _super);
|
|
125
|
+
function Column() {
|
|
126
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
127
|
+
}
|
|
128
|
+
__decorate([
|
|
129
|
+
Property('')
|
|
130
|
+
], Column.prototype, "field", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
Property('')
|
|
133
|
+
], Column.prototype, "header", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
Property('')
|
|
136
|
+
], Column.prototype, "width", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
Property('')
|
|
139
|
+
], Column.prototype, "textAlign", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
Property(null)
|
|
142
|
+
], Column.prototype, "format", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
Property(false)
|
|
145
|
+
], Column.prototype, "displayAsCheckBox", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
Property(null)
|
|
148
|
+
], Column.prototype, "template", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
Property(null)
|
|
151
|
+
], Column.prototype, "headerTemplate", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
Property(null)
|
|
154
|
+
], Column.prototype, "customAttributes", void 0);
|
|
155
|
+
return Column;
|
|
156
|
+
}(ChildProperty));
|
|
157
|
+
export { Column };
|
|
158
|
+
/**
|
|
159
|
+
* Specifies the configuration of the columns in the popup content.
|
|
160
|
+
*/
|
|
161
|
+
var GridSettings = /** @class */ (function (_super) {
|
|
162
|
+
__extends(GridSettings, _super);
|
|
163
|
+
function GridSettings() {
|
|
164
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
165
|
+
}
|
|
166
|
+
__decorate([
|
|
167
|
+
Property(false)
|
|
168
|
+
], GridSettings.prototype, "enableAltRow", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
Property(null)
|
|
171
|
+
], GridSettings.prototype, "rowHeight", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
Property('Default')
|
|
174
|
+
], GridSettings.prototype, "gridLines", void 0);
|
|
175
|
+
return GridSettings;
|
|
176
|
+
}(ChildProperty));
|
|
177
|
+
export { GridSettings };
|
|
178
|
+
/**
|
|
179
|
+
* The `MultiColumnComboBox` allows the user to search and select values from a list. It provides a list of options that can be selected using a filter input.
|
|
180
|
+
* The selected value will be displayed in the input element.
|
|
181
|
+
*
|
|
182
|
+
* ```html
|
|
183
|
+
* <input type="text" id="multi-column"></input>
|
|
184
|
+
* ```
|
|
185
|
+
* ```typescript
|
|
186
|
+
* let multiColObj: MultiColumnComboBox = new MultiColumnComboBox();
|
|
187
|
+
* multiColObj.appendTo("#multi-column");
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
var MultiColumnComboBox = /** @class */ (function (_super) {
|
|
191
|
+
__extends(MultiColumnComboBox, _super);
|
|
192
|
+
/**
|
|
193
|
+
* *Constructor for creating the component
|
|
194
|
+
*
|
|
195
|
+
* @param {MultiColumnComboBoxModel} options - Specifies the MultiColumnComboBox model.
|
|
196
|
+
* @param {string | HTMLElement} element - Specifies the element to render as component.
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
function MultiColumnComboBox(options, element) {
|
|
200
|
+
var _this = _super.call(this, options, element) || this;
|
|
201
|
+
_this.gridInject = new MultiColumnGrid();
|
|
202
|
+
_this.gridInject.InjectModules();
|
|
203
|
+
return _this;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Initialize the event handler
|
|
207
|
+
*
|
|
208
|
+
* @private
|
|
209
|
+
* @returns {void}
|
|
210
|
+
*/
|
|
211
|
+
MultiColumnComboBox.prototype.preRender = function () {
|
|
212
|
+
if (!this.element.id) {
|
|
213
|
+
this.element.id = getUniqueID('e-' + this.getModuleName());
|
|
214
|
+
}
|
|
215
|
+
this.keyConfigs = {
|
|
216
|
+
escape: 'escape',
|
|
217
|
+
altUp: 'alt+uparrow',
|
|
218
|
+
altDown: 'alt+downarrow',
|
|
219
|
+
tab: 'tab',
|
|
220
|
+
shiftTab: 'shift+tab',
|
|
221
|
+
end: 'end',
|
|
222
|
+
enter: 'enter',
|
|
223
|
+
home: 'home',
|
|
224
|
+
moveDown: 'downarrow',
|
|
225
|
+
moveUp: 'uparrow'
|
|
226
|
+
};
|
|
227
|
+
this.matchedRowEle = this.matchedContent = null;
|
|
228
|
+
this.persistData();
|
|
229
|
+
};
|
|
230
|
+
MultiColumnComboBox.prototype.getDirective = function () {
|
|
231
|
+
return 'EJS-MULTICOLUMNCOMBOBOX';
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* To get component name.
|
|
235
|
+
*
|
|
236
|
+
* @returns {string} - It returns the current module name.
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
MultiColumnComboBox.prototype.getModuleName = function () {
|
|
240
|
+
return 'multicolumncombobox';
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Get the properties to be maintained in the persisted state.
|
|
244
|
+
*
|
|
245
|
+
* @private
|
|
246
|
+
* @returns {string} - It returns the persisted data.
|
|
247
|
+
*/
|
|
248
|
+
MultiColumnComboBox.prototype.getPersistData = function () {
|
|
249
|
+
return this.addOnPersist(['value']);
|
|
250
|
+
};
|
|
251
|
+
MultiColumnComboBox.prototype.persistData = function () {
|
|
252
|
+
if (this.enablePersistence) {
|
|
253
|
+
this.element.id = this.element.id + '_wrapper';
|
|
254
|
+
var data = window.localStorage.getItem(this.getModuleName() + this.element.id);
|
|
255
|
+
if (!(isNOU(data) || (data === ''))) {
|
|
256
|
+
this.setProperties(JSON.parse(data), true);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
MultiColumnComboBox.prototype.render = function () {
|
|
261
|
+
this.renderGrid();
|
|
262
|
+
this.renderInput();
|
|
263
|
+
this.popupDiv = this.createElement('div', { className: CONTENT });
|
|
264
|
+
this.popupDiv.appendChild(this.gridEle);
|
|
265
|
+
this.setHTMLAttributes();
|
|
266
|
+
this.renderPopup();
|
|
267
|
+
this.wireEvents();
|
|
268
|
+
};
|
|
269
|
+
MultiColumnComboBox.prototype.renderGrid = function () {
|
|
270
|
+
var _this = this;
|
|
271
|
+
var gridColumns = this.getGridColumns();
|
|
272
|
+
this.gridObj = new Grid({
|
|
273
|
+
dataSource: this.dataSource,
|
|
274
|
+
columns: gridColumns,
|
|
275
|
+
allowSorting: this.allowSorting,
|
|
276
|
+
enableStickyHeader: true,
|
|
277
|
+
gridLines: this.gridSettings.gridLines,
|
|
278
|
+
rowHeight: this.gridSettings.rowHeight,
|
|
279
|
+
enableAltRow: this.gridSettings.enableAltRow,
|
|
280
|
+
enableVirtualization: this.enableVirtualization,
|
|
281
|
+
enableRtl: this.enableRtl,
|
|
282
|
+
editSettings: { allowAdding: false },
|
|
283
|
+
query: this.query,
|
|
284
|
+
height: this.popupHeight,
|
|
285
|
+
allowMultiSorting: this.sortType.toString().toLowerCase() === 'multiplecolumns' && this.allowSorting,
|
|
286
|
+
rowTemplate: this.itemTemplate,
|
|
287
|
+
dataBound: function () { _this.onDataBound(); },
|
|
288
|
+
actionFailure: function (args) { _this.onActionFailure(args); },
|
|
289
|
+
actionBegin: function (args) { _this.trigger('actionBegin', args); },
|
|
290
|
+
actionComplete: function (args) {
|
|
291
|
+
_this.trigger('actionComplete', args);
|
|
292
|
+
if (args.requestType === 'sorting') {
|
|
293
|
+
_this.updateRowSelection(args);
|
|
294
|
+
}
|
|
295
|
+
var dataRows = args.rows;
|
|
296
|
+
if (_this.isDataFiltered && dataRows.length > 0 && _this.inputEle.value !== '' && args.requestType !== 'sorting') {
|
|
297
|
+
var firstRowEle = _this.gridObj.getRows()[0];
|
|
298
|
+
firstRowEle.classList.add('e-row-focus');
|
|
299
|
+
}
|
|
300
|
+
_this.popupObj.refreshPosition();
|
|
301
|
+
},
|
|
302
|
+
keyPressed: function (args) {
|
|
303
|
+
if (args.key === 'Enter') {
|
|
304
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
305
|
+
args.cancel = true;
|
|
306
|
+
if (_this.isPopupOpen) {
|
|
307
|
+
_this.selectedGridRow(_this.gridObj.getRows()[_this.gridObj.selectedRowIndex], args, true);
|
|
308
|
+
_this.hidePopup(args);
|
|
309
|
+
_this.focusIn(args);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (_this.fields.groupBy) {
|
|
313
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
314
|
+
args.cancel = true;
|
|
315
|
+
_this.gridKeyActionHandler(args, true);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
this.gridEle = this.createElement('div', { id: getUniqueID('grid'), className: MULTICOLUMNGRID });
|
|
320
|
+
this.updateGroupByField();
|
|
321
|
+
var sortOrder = this.sortOrder.toString().toLowerCase();
|
|
322
|
+
// Set first column as primary key to avoid PRIMARY KEY MISSING warning.
|
|
323
|
+
this.gridObj.columns[0].isPrimaryKey = true;
|
|
324
|
+
if (sortOrder !== 'none') {
|
|
325
|
+
this.gridObj.sortSettings = { columns: [{ field: this.fields.text, direction: sortOrder === 'ascending' ?
|
|
326
|
+
SortOrder.Ascending : SortOrder.Descending }] };
|
|
327
|
+
}
|
|
328
|
+
this.gridObj.appendTo(this.gridEle);
|
|
329
|
+
};
|
|
330
|
+
// eslint-disable @typescript-eslint/no-explicit-any
|
|
331
|
+
MultiColumnComboBox.prototype.isRowMatching = function (data, selectedValue, selectedText) {
|
|
332
|
+
var values = Object.values(data).map(String);
|
|
333
|
+
var isRowPresent = values.includes(selectedValue) && values.includes(selectedText);
|
|
334
|
+
return isRowPresent;
|
|
335
|
+
};
|
|
336
|
+
MultiColumnComboBox.prototype.updateRowSelection = function (args) {
|
|
337
|
+
var _this = this;
|
|
338
|
+
if (args) {
|
|
339
|
+
var dataRows = args.rows;
|
|
340
|
+
dataRows.forEach(function (row) {
|
|
341
|
+
var data = row.data;
|
|
342
|
+
var index = row.index;
|
|
343
|
+
_this.selectDataRow(data, index);
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
MultiColumnComboBox.prototype.selectDataRow = function (data, index) {
|
|
348
|
+
var isPresent = this.isRowMatching(data, this.value ? this.value.toString() : '', this.text ? this.text.toString() : '');
|
|
349
|
+
if (isPresent) {
|
|
350
|
+
this.gridObj.selectRow(index);
|
|
351
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
352
|
+
this.isProtectedOnChange = true;
|
|
353
|
+
this.index = index;
|
|
354
|
+
this.isProtectedOnChange = prevOnChange;
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
MultiColumnComboBox.prototype.findIndex = function (arr, obj) {
|
|
359
|
+
return arr.findIndex(function (item) {
|
|
360
|
+
return Object.keys(obj).every(function (key) { return item[key] === obj[key]; });
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
;
|
|
364
|
+
// eslint-enable @typescript-eslint/no-explicit-any
|
|
365
|
+
MultiColumnComboBox.prototype.getGridColumns = function () {
|
|
366
|
+
var _this = this;
|
|
367
|
+
return this.columns.map(function (column) {
|
|
368
|
+
return {
|
|
369
|
+
field: column.field,
|
|
370
|
+
headerText: column.header,
|
|
371
|
+
width: column.width,
|
|
372
|
+
textAlign: column.textAlign === '' && _this.enableRtl ? 'Right' : column.textAlign,
|
|
373
|
+
format: column.format,
|
|
374
|
+
displayAsCheckBox: column.displayAsCheckBox,
|
|
375
|
+
template: column.template,
|
|
376
|
+
headerTemplate: column.headerTemplate,
|
|
377
|
+
customAttributes: column.customAttributes,
|
|
378
|
+
type: column.displayAsCheckBox ? 'boolean' : 'string'
|
|
379
|
+
};
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
MultiColumnComboBox.prototype.updateGroupByField = function () {
|
|
383
|
+
if (this.fields.groupBy !== '' && !isNOU(this.fields.groupBy)) {
|
|
384
|
+
if (this.sortType.toString().toLowerCase() !== 'multiplecolumns') {
|
|
385
|
+
this.gridEle.classList.add('e-multicolumn-group');
|
|
386
|
+
}
|
|
387
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
388
|
+
this.isProtectedOnChange = true;
|
|
389
|
+
this.gridObj.allowGrouping = true;
|
|
390
|
+
this.gridObj.groupSettings = {
|
|
391
|
+
showDropArea: false,
|
|
392
|
+
columns: [this.fields.groupBy],
|
|
393
|
+
captionTemplate: (this.groupTemplate && this.fields.groupBy !== '' && !isNOU(this.fields.groupBy))
|
|
394
|
+
? this.groupTemplate : "${key}"
|
|
395
|
+
};
|
|
396
|
+
if (this.isVue) {
|
|
397
|
+
this.gridObj.isVue = this.isVue;
|
|
398
|
+
}
|
|
399
|
+
this.isProtectedOnChange = prevOnChange;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
MultiColumnComboBox.prototype.onDataBound = function () {
|
|
403
|
+
var dataCount = this.dataSource.length;
|
|
404
|
+
var popupChild = this.popupDiv.querySelector('.' + MULTICOLUMNGRID);
|
|
405
|
+
if (dataCount <= 0 && popupChild) {
|
|
406
|
+
this.l10nUpdate();
|
|
407
|
+
this.popupDiv.removeChild(this.gridEle);
|
|
408
|
+
addClass([this.popupDiv], [NODATA]);
|
|
409
|
+
}
|
|
410
|
+
else if (this.popupDiv.classList.contains(NODATA) && dataCount >= 1) {
|
|
411
|
+
removeClass([this.popupDiv], [NODATA]);
|
|
412
|
+
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
413
|
+
if (noRecordEle) {
|
|
414
|
+
this.popupDiv.removeChild(noRecordEle);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
MultiColumnComboBox.prototype.onActionFailure = function (args) {
|
|
419
|
+
this.trigger('actionFailure', args);
|
|
420
|
+
this.l10nUpdate(true);
|
|
421
|
+
addClass([this.popupDiv], [NODATA]);
|
|
422
|
+
};
|
|
423
|
+
MultiColumnComboBox.prototype.renderInput = function () {
|
|
424
|
+
if (this.element.tagName === 'INPUT') {
|
|
425
|
+
this.inputEle = this.element;
|
|
426
|
+
if (isNOU(this.inputEle.getAttribute('role'))) {
|
|
427
|
+
this.inputEle.setAttribute('role', 'combobox');
|
|
428
|
+
}
|
|
429
|
+
if (isNOU(this.inputEle.getAttribute('type'))) {
|
|
430
|
+
this.inputEle.setAttribute('type', 'text');
|
|
431
|
+
}
|
|
432
|
+
this.inputEle.setAttribute('aria-expanded', 'false');
|
|
433
|
+
this.inputEle.setAttribute('aria-readOnly', this.readonly.toString());
|
|
434
|
+
this.inputEle.setAttribute('aria-disabled', this.disabled.toString());
|
|
435
|
+
this.inputEle.setAttribute('tabindex', '0');
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
this.inputEle = this.createElement('input', { attrs: { role: 'textbox', type: 'text' } });
|
|
439
|
+
this.element.parentElement.insertBefore(this.inputEle, this.element);
|
|
440
|
+
}
|
|
441
|
+
this.inputObj = Input.createInput({
|
|
442
|
+
element: this.inputEle,
|
|
443
|
+
buttons: [DROPDOWNICON],
|
|
444
|
+
floatLabelType: this.floatLabelType,
|
|
445
|
+
properties: {
|
|
446
|
+
enabled: !this.disabled,
|
|
447
|
+
readonly: this.readonly,
|
|
448
|
+
placeholder: this.placeholder,
|
|
449
|
+
enableRtl: this.enableRtl,
|
|
450
|
+
showClearButton: this.showClearButton,
|
|
451
|
+
cssClass: this.cssClass
|
|
452
|
+
}
|
|
453
|
+
}, this.createElement);
|
|
454
|
+
this.inputWrapper = this.inputObj.container;
|
|
455
|
+
this.inputWrapper.classList.add(MULTICOLUMNLIST);
|
|
456
|
+
this.inputWrapper.setAttribute('spellcheck', 'false');
|
|
457
|
+
if (this.element.tagName === this.getDirective()) {
|
|
458
|
+
this.element.appendChild(this.inputWrapper);
|
|
459
|
+
}
|
|
460
|
+
this.setElementWidth(this.width);
|
|
461
|
+
if (!isNOU(this.value) || !isNOU(this.text) || !isNOU(this.index)) {
|
|
462
|
+
this.initValue(null, null, true);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
/* To calculate the width when change via set model */
|
|
466
|
+
MultiColumnComboBox.prototype.setElementWidth = function (inputWidth) {
|
|
467
|
+
var ddElement = this.inputWrapper;
|
|
468
|
+
if (!isNOU(inputWidth)) {
|
|
469
|
+
if (typeof inputWidth === 'number') {
|
|
470
|
+
ddElement.style.width = formatUnit(inputWidth);
|
|
471
|
+
}
|
|
472
|
+
else if (typeof inputWidth === 'string') {
|
|
473
|
+
ddElement.style.width = (inputWidth.match(/px|%|em/)) ? (inputWidth) : (formatUnit(inputWidth));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
MultiColumnComboBox.prototype.setHTMLAttributes = function () {
|
|
478
|
+
if (Object.keys(this.htmlAttributes).length) {
|
|
479
|
+
for (var _i = 0, _a = Object.keys(this.htmlAttributes); _i < _a.length; _i++) {
|
|
480
|
+
var htmlAttr = _a[_i];
|
|
481
|
+
if (htmlAttr === 'class') {
|
|
482
|
+
this.inputWrapper.classList.add(this.htmlAttributes["" + htmlAttr]);
|
|
483
|
+
}
|
|
484
|
+
else if (htmlAttr === 'disabled') {
|
|
485
|
+
this.setProperties({ enabled: false }, true);
|
|
486
|
+
this.setEnable();
|
|
487
|
+
}
|
|
488
|
+
else if (htmlAttr === 'readonly') {
|
|
489
|
+
this.setProperties({ readonly: true }, true);
|
|
490
|
+
this.dataBind();
|
|
491
|
+
}
|
|
492
|
+
else if (htmlAttr === 'style') {
|
|
493
|
+
this.inputWrapper.setAttribute('style', this.htmlAttributes["" + htmlAttr]);
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
var defaultAttr = ['title', 'id', 'placeholder',
|
|
497
|
+
'role', 'autocomplete', 'autocapitalize', 'spellcheck', 'minlength', 'maxlength'];
|
|
498
|
+
if (defaultAttr.indexOf(htmlAttr) > -1) {
|
|
499
|
+
if (htmlAttr === 'placeholder') {
|
|
500
|
+
Input.setPlaceholder(this.htmlAttributes["" + htmlAttr], this.inputEle);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
this.inputEle.setAttribute(htmlAttr, this.htmlAttributes["" + htmlAttr]);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
/* To set enable property */
|
|
514
|
+
MultiColumnComboBox.prototype.setEnable = function () {
|
|
515
|
+
Input.setEnabled(!this.disabled, this.inputEle);
|
|
516
|
+
if (!this.disabled) {
|
|
517
|
+
removeClass([this.inputWrapper], DISABLED);
|
|
518
|
+
this.inputEle.setAttribute('aria-disabled', 'false');
|
|
519
|
+
this.inputWrapper.setAttribute('aria-disabled', 'false');
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
if (this.isPopupOpen) {
|
|
523
|
+
this.hidePopup();
|
|
524
|
+
}
|
|
525
|
+
addClass([this.inputWrapper], DISABLED);
|
|
526
|
+
if (this.inputWrapper && this.inputWrapper.classList.contains(INPUTFOCUS)) {
|
|
527
|
+
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
528
|
+
}
|
|
529
|
+
this.inputEle.setAttribute('aria-disabled', 'true');
|
|
530
|
+
this.inputWrapper.setAttribute('aria-disabled', 'true');
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
MultiColumnComboBox.prototype.initValue = function (isRerender, isValue, isInitial) {
|
|
534
|
+
var _this = this;
|
|
535
|
+
var prevItemData = this.gridObj.getSelectedRecords()[0];
|
|
536
|
+
var prevItemEle = this.gridObj.getSelectedRows()[0];
|
|
537
|
+
var item;
|
|
538
|
+
var currentValue;
|
|
539
|
+
var currentText;
|
|
540
|
+
var currentIndex;
|
|
541
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
542
|
+
this.isProtectedOnChange = true;
|
|
543
|
+
this.value = this.value ? this.value.toString() : this.value;
|
|
544
|
+
this.isProtectedOnChange = prevOnChange;
|
|
545
|
+
var updateValues = function (dataList) {
|
|
546
|
+
var result = _this.updateCurrentValues(item, dataList);
|
|
547
|
+
currentValue = result.currentValue;
|
|
548
|
+
currentText = result.currentText;
|
|
549
|
+
currentIndex = result.currentIndex;
|
|
550
|
+
};
|
|
551
|
+
if ((!isRerender && (!isNOU(this.value) || !isNOU(this.text))) || (isRerender && isValue !== undefined)) {
|
|
552
|
+
var value_1 = isRerender ? (isValue ? this.value : this.text) : (!isNOU(this.value) ? this.value : this.text);
|
|
553
|
+
if (!isNOU(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
554
|
+
this.dataSource.executeQuery(new Query).then(function (e) {
|
|
555
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
556
|
+
var dataLists = e.result;
|
|
557
|
+
var filteredData = dataLists.filter(function (item) {
|
|
558
|
+
return item[isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
559
|
+
!isNOU(_this.value) ? _this.fields.value : _this.fields.text].toString() === value_1;
|
|
560
|
+
});
|
|
561
|
+
if (filteredData.length > 0) {
|
|
562
|
+
item = filteredData[0];
|
|
563
|
+
updateValues(dataLists);
|
|
564
|
+
_this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
|
|
565
|
+
_this.gridObj.selectRow(_this.index);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
else if (!isNOU(this.dataSource) && this.dataSource instanceof Array) {
|
|
570
|
+
item = this.dataSource.filter(function (data) {
|
|
571
|
+
return data[isRerender ? (isValue ? _this.fields.value : _this.fields.text) :
|
|
572
|
+
!isNOU(_this.value) ? _this.fields.value : _this.fields.text].toString() === value_1;
|
|
573
|
+
})[0];
|
|
574
|
+
updateValues(this.dataSource);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else if (!isNOU(this.index)) {
|
|
578
|
+
if (!isNOU(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
579
|
+
this.dataSource.executeQuery(new Query).then(function (e) {
|
|
580
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
581
|
+
var dataLists = e.result;
|
|
582
|
+
item = dataLists[_this.index];
|
|
583
|
+
updateValues(dataLists);
|
|
584
|
+
_this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
|
|
585
|
+
_this.gridObj.selectRow(_this.index);
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
else if (!isNOU(this.dataSource) && this.dataSource instanceof Array) {
|
|
589
|
+
item = this.dataSource[this.index];
|
|
590
|
+
updateValues(this.dataSource);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (!(this.dataSource instanceof DataManager)) {
|
|
594
|
+
this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
MultiColumnComboBox.prototype.updateChangeEvent = function (item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial) {
|
|
598
|
+
var ChangeEventArgs = {
|
|
599
|
+
value: item ? item[this.fields.value].toString() : null,
|
|
600
|
+
itemData: { text: currentText, value: currentValue },
|
|
601
|
+
item: this.getDataByValue(this.value),
|
|
602
|
+
previousItemData: prevItemData,
|
|
603
|
+
previousItemElement: prevItemEle,
|
|
604
|
+
itemElement: this.inputWrapper,
|
|
605
|
+
event: null,
|
|
606
|
+
isInteracted: !isRerender
|
|
607
|
+
};
|
|
608
|
+
this.updateValues(currentValue, currentText, currentIndex, ChangeEventArgs, isInitial);
|
|
609
|
+
};
|
|
610
|
+
MultiColumnComboBox.prototype.updateCurrentValues = function (item, dataList) {
|
|
611
|
+
if (!isNOU(item)) {
|
|
612
|
+
Input.setValue(item[this.fields.text].toString(), this.inputEle, this.floatLabelType, this.showClearButton);
|
|
613
|
+
return {
|
|
614
|
+
currentValue: item[this.fields.value].toString(),
|
|
615
|
+
currentText: item[this.fields.text].toString(),
|
|
616
|
+
currentIndex: dataList.indexOf(item)
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
currentValue: null,
|
|
621
|
+
currentText: null,
|
|
622
|
+
currentIndex: null
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
MultiColumnComboBox.prototype.renderPopup = function () {
|
|
626
|
+
this.popupEle = this.createElement('div', {
|
|
627
|
+
id: this.element.id + '_options', className: MULTICOLUMNLIST + ' e-popup ' + (this.cssClass !== null ? this.cssClass : '')
|
|
628
|
+
});
|
|
629
|
+
attributes(this.popupEle, { 'aria-label': this.element.id, 'role': 'dialog' });
|
|
630
|
+
document.body.appendChild(this.popupEle);
|
|
631
|
+
this.createPopup(this.popupEle);
|
|
632
|
+
prepend([this.popupDiv], this.popupEle);
|
|
633
|
+
if (this.footerTemplate) {
|
|
634
|
+
this.setFooterTemplate();
|
|
635
|
+
}
|
|
636
|
+
var popupHeight = this.getSize(false);
|
|
637
|
+
this.popupEle.style.maxHeight = popupHeight;
|
|
638
|
+
if (this.footerTemplate) {
|
|
639
|
+
this.footer = this.footer ? this.footer : this.popupEle.querySelector('.e-popup-footer');
|
|
640
|
+
var height = Math.round(this.footer.getBoundingClientRect().height);
|
|
641
|
+
popupHeight = formatUnit(parseInt(popupHeight, 10) - height + 'px');
|
|
642
|
+
}
|
|
643
|
+
this.popupDiv.style.maxHeight = popupHeight;
|
|
644
|
+
this.popupRowHeight = this.popupDiv.querySelector('.e-gridcontent tr').getBoundingClientRect().height;
|
|
645
|
+
this.updateGridHeight();
|
|
646
|
+
this.popupObj.hide();
|
|
647
|
+
};
|
|
648
|
+
MultiColumnComboBox.prototype.updateGridHeight = function (isFilter, autoHeight, dataSourceCount) {
|
|
649
|
+
var height;
|
|
650
|
+
if (isFilter) {
|
|
651
|
+
var gridContentEle = this.gridObj.getContent().querySelector('.e-content');
|
|
652
|
+
var scrollBarHeight = gridContentEle.offsetHeight - gridContentEle.clientHeight;
|
|
653
|
+
var totalRowHeight = dataSourceCount * this.popupRowHeight;
|
|
654
|
+
if (this.fields.groupBy !== '' && !isNOU(this.fields.groupBy)) {
|
|
655
|
+
totalRowHeight += this.popupRowHeight;
|
|
656
|
+
}
|
|
657
|
+
height = autoHeight ? (totalRowHeight < this.prevGridHeight ? (totalRowHeight + scrollBarHeight) + 'px' : this.prevGridHeight + 'px') : this.prevGridHeight + 'px';
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
this.prevGridHeight = this.popupDiv.getBoundingClientRect().height - this.popupDiv.querySelector('.e-gridheader').getBoundingClientRect().height;
|
|
661
|
+
height = this.prevGridHeight + 'px';
|
|
662
|
+
}
|
|
663
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
664
|
+
this.isProtectedOnChange = true;
|
|
665
|
+
this.gridObj.height = height;
|
|
666
|
+
this.isProtectedOnChange = prevOnChange;
|
|
667
|
+
};
|
|
668
|
+
MultiColumnComboBox.prototype.createPopup = function (element) {
|
|
669
|
+
var _this = this;
|
|
670
|
+
this.popupObj = new Popup(element, {
|
|
671
|
+
width: this.getSize(true),
|
|
672
|
+
targetType: 'relative',
|
|
673
|
+
collision: { X: 'flip', Y: 'flip' },
|
|
674
|
+
relateTo: this.inputWrapper,
|
|
675
|
+
enableRtl: this.enableRtl,
|
|
676
|
+
position: { X: 'left', Y: 'bottom' },
|
|
677
|
+
targetExitViewport: function () {
|
|
678
|
+
if (!Browser.isDevice) {
|
|
679
|
+
_this.hidePopup();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
MultiColumnComboBox.prototype.setFooterTemplate = function () {
|
|
685
|
+
if (this.footer) {
|
|
686
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
687
|
+
if (this.isReact && typeof this.footerTemplate === 'function') {
|
|
688
|
+
this.clearTemplate(['footerTemplate']);
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
this.footer.innerHTML = '';
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
this.footer = this.createElement('div');
|
|
696
|
+
addClass([this.footer], 'e-popup-footer');
|
|
697
|
+
}
|
|
698
|
+
var compiledString = this.getTemplateFunction(this.footerTemplate);
|
|
699
|
+
var dataCount = this.dataSource.length;
|
|
700
|
+
var tempArr = compiledString({ count: dataCount }, this, 'footerTemplate', this.element.id + 'footerTemplate', this.isStringTemplate, undefined, this.footer);
|
|
701
|
+
if (tempArr) {
|
|
702
|
+
tempArr = Array.prototype.slice.call(tempArr);
|
|
703
|
+
append(tempArr, this.footer);
|
|
704
|
+
}
|
|
705
|
+
append([this.footer], this.popupEle);
|
|
706
|
+
};
|
|
707
|
+
MultiColumnComboBox.prototype.l10nUpdate = function (actionFailure) {
|
|
708
|
+
if (this.noRecord) {
|
|
709
|
+
this.noRecord.innerHTML = '';
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
this.noRecord = this.createElement('div');
|
|
713
|
+
}
|
|
714
|
+
if (this.noRecordsTemplate !== 'No records found' || this.actionFailureTemplate !== 'Request Failed') {
|
|
715
|
+
var template = actionFailure ? this.actionFailureTemplate : this.noRecordsTemplate;
|
|
716
|
+
var templateId = actionFailure ? this.element.id + '_actionFailure' : this.element.id + '_noRecords';
|
|
717
|
+
var templatestring = actionFailure ? 'actionFailureTemplate' : 'noRecordsTemplate';
|
|
718
|
+
var compiledString = this.getTemplateFunction(template);
|
|
719
|
+
var tempArr = compiledString({}, this, templatestring, templateId, this.isStringTemplate, undefined, this.noRecord);
|
|
720
|
+
if (tempArr) {
|
|
721
|
+
tempArr = Array.prototype.slice.call(tempArr);
|
|
722
|
+
append(tempArr, this.noRecord);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
var l10nLocale = { noRecordsTemplate: 'No records found', actionFailureTemplate: 'Request Failed' };
|
|
727
|
+
this.l10n = new L10n('multicolumncombobox', l10nLocale, this.locale);
|
|
728
|
+
this.noRecord.innerHTML = actionFailure ?
|
|
729
|
+
this.l10n.getConstant('actionFailureTemplate') : this.l10n.getConstant('noRecordsTemplate');
|
|
730
|
+
}
|
|
731
|
+
addClass([this.noRecord], 'e-no-records');
|
|
732
|
+
prepend([this.noRecord], this.popupDiv);
|
|
733
|
+
this.popupObj.refreshPosition();
|
|
734
|
+
};
|
|
735
|
+
/**
|
|
736
|
+
* Gets template content based on the template property value.
|
|
737
|
+
*
|
|
738
|
+
* @param {string | Function} template - Template property value.
|
|
739
|
+
* @returns {Function} - Return template function.
|
|
740
|
+
* @hidden
|
|
741
|
+
*/
|
|
742
|
+
MultiColumnComboBox.prototype.getTemplateFunction = function (template) {
|
|
743
|
+
if (typeof template === 'string') {
|
|
744
|
+
var content = '';
|
|
745
|
+
try {
|
|
746
|
+
var tempEle = select(template);
|
|
747
|
+
if (tempEle) {
|
|
748
|
+
//Return innerHTML incase of jsrenderer script else outerHTML
|
|
749
|
+
content = tempEle.tagName === 'SCRIPT' ? tempEle.innerHTML : tempEle.outerHTML;
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
content = template;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
catch (e) {
|
|
756
|
+
content = template;
|
|
757
|
+
}
|
|
758
|
+
return compile(content);
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
762
|
+
return compile(template);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
/*To calculate the width and height of the popup */
|
|
766
|
+
MultiColumnComboBox.prototype.getSize = function (ispopupWidth) {
|
|
767
|
+
var currentDimension = ispopupWidth ? this.popupWidth : this.popupHeight;
|
|
768
|
+
var size = formatUnit(currentDimension);
|
|
769
|
+
if (size.indexOf('%') > -1) {
|
|
770
|
+
var dimensionValue = ispopupWidth ? this.inputWrapper.offsetWidth : document.documentElement.clientHeight;
|
|
771
|
+
size = (dimensionValue * parseFloat(size) / 100).toString() + 'px';
|
|
772
|
+
}
|
|
773
|
+
else if (typeof currentDimension === 'string') {
|
|
774
|
+
size = currentDimension.match(/px|em/) ? currentDimension : size;
|
|
775
|
+
}
|
|
776
|
+
return size;
|
|
777
|
+
};
|
|
778
|
+
MultiColumnComboBox.prototype.selectedGridRow = function (row, e, isKeyNav) {
|
|
779
|
+
var _this = this;
|
|
780
|
+
var eventArgs = {
|
|
781
|
+
isInteracted: e ? true : false,
|
|
782
|
+
item: this.gridObj.getSelectedRecords()[0],
|
|
783
|
+
itemElement: row,
|
|
784
|
+
itemData: this.gridObj.getSelectedRecords()[0],
|
|
785
|
+
event: e,
|
|
786
|
+
cancel: false
|
|
787
|
+
};
|
|
788
|
+
var selectedRecords = this.gridObj.getSelectedRecords()[0];
|
|
789
|
+
var fieldText = selectedRecords ? selectedRecords[this.fields.text].toString() : "";
|
|
790
|
+
var fieldValue = selectedRecords ? selectedRecords[this.fields.value].toString() : "";
|
|
791
|
+
var ChangeEventArgs = {
|
|
792
|
+
isInteracted: e ? true : false,
|
|
793
|
+
item: selectedRecords,
|
|
794
|
+
itemElement: row,
|
|
795
|
+
itemData: { text: fieldText, value: fieldValue },
|
|
796
|
+
event: e,
|
|
797
|
+
cancel: false,
|
|
798
|
+
value: fieldValue,
|
|
799
|
+
previousItemData: { text: this.text, value: this.value },
|
|
800
|
+
previousItemElement: this.previousItemElement
|
|
801
|
+
};
|
|
802
|
+
this.trigger('select', eventArgs, function (eventArgs) {
|
|
803
|
+
if (!eventArgs.cancel && eventArgs.itemData) {
|
|
804
|
+
var selectedRecord = eventArgs.itemData;
|
|
805
|
+
if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
|
|
806
|
+
_this.updateValues(selectedRecord[_this.fields.value], selectedRecord[_this.fields.text], _this.gridObj.selectedRowIndex, ChangeEventArgs);
|
|
807
|
+
}
|
|
808
|
+
Input.setValue(selectedRecord[_this.fields.text], _this.inputEle, _this.floatLabelType, _this.showClearButton);
|
|
809
|
+
if (!isKeyNav || (isKeyNav && e.key === 'Enter')) {
|
|
810
|
+
_this.hidePopup(e);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
MultiColumnComboBox.prototype.updateValues = function (value, text, index, eventArgs, isInitial) {
|
|
816
|
+
this.previousItemElement = eventArgs.itemElement;
|
|
817
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
818
|
+
this.isProtectedOnChange = true;
|
|
819
|
+
this.text = text ? text : this.text;
|
|
820
|
+
this.value = value ? value : this.value;
|
|
821
|
+
this.index = !isNOU(index) ? index : this.index;
|
|
822
|
+
this.isProtectedOnChange = prevOnChange;
|
|
823
|
+
if (!isInitial) {
|
|
824
|
+
this.triggerChangeEvent(eventArgs);
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
MultiColumnComboBox.prototype.triggerChangeEvent = function (eventArgs) {
|
|
828
|
+
this.trigger('change', eventArgs, function (eventArgs) {
|
|
829
|
+
if (eventArgs.cancel) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
};
|
|
834
|
+
MultiColumnComboBox.prototype.inputHandler = function (e) {
|
|
835
|
+
var _this = this;
|
|
836
|
+
this.showPopup(null, true);
|
|
837
|
+
if (this.allowFiltering) {
|
|
838
|
+
var inputValue_1 = e.target.value.toLowerCase();
|
|
839
|
+
var customFiltering_1 = false;
|
|
840
|
+
var eventArgs_1 = {
|
|
841
|
+
preventDefaultAction: false,
|
|
842
|
+
text: inputValue_1,
|
|
843
|
+
updateData: function (dataSource, query, fields) {
|
|
844
|
+
if (eventArgs_1.cancel) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
customFiltering_1 = true;
|
|
848
|
+
_this.filterAction(dataSource, inputValue_1, query, fields);
|
|
849
|
+
},
|
|
850
|
+
event: e,
|
|
851
|
+
cancel: false
|
|
852
|
+
};
|
|
853
|
+
this.trigger('filtering', eventArgs_1, function (eventArgs) {
|
|
854
|
+
if (!eventArgs.cancel && !eventArgs.preventDefaultAction && !customFiltering_1) {
|
|
855
|
+
_this.filterAction(_this.dataSource, inputValue_1, _this.query, _this.fields);
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
this.updateInputValue(e.target.value);
|
|
860
|
+
};
|
|
861
|
+
MultiColumnComboBox.prototype.updateInputValue = function (inputValue) {
|
|
862
|
+
var _this = this;
|
|
863
|
+
var data;
|
|
864
|
+
if (this.dataSource instanceof DataManager) {
|
|
865
|
+
var query = new Query();
|
|
866
|
+
this.dataSource.executeQuery(query).then(function (result) {
|
|
867
|
+
var totaldata = result.result;
|
|
868
|
+
data = totaldata.filter(function (item) {
|
|
869
|
+
return item[_this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
|
|
870
|
+
});
|
|
871
|
+
_this.selectFilteredRows(data);
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
else if (Array.isArray(this.dataSource)) {
|
|
875
|
+
data = this.dataSource.filter(function (item) {
|
|
876
|
+
return item[_this.fields.text].toString().toLowerCase().startsWith(inputValue.toLowerCase());
|
|
877
|
+
});
|
|
878
|
+
this.selectFilteredRows(data);
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
MultiColumnComboBox.prototype.selectFilteredRows = function (data) {
|
|
882
|
+
if (data.length > 0) {
|
|
883
|
+
this.matchedContent = data[0];
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
this.matchedContent = null;
|
|
887
|
+
}
|
|
888
|
+
if (this.matchedContent) {
|
|
889
|
+
var selectedIndex = this.findIndex(this.gridObj.currentViewData, this.matchedContent);
|
|
890
|
+
this.matchedRowEle = this.gridObj.getRowByIndex(selectedIndex);
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
this.matchedRowEle = null;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
897
|
+
MultiColumnComboBox.prototype.filterAction = function (dataSource, inputValue, query, fields) {
|
|
898
|
+
var _this = this;
|
|
899
|
+
var filterType = this.filterType.toString().toLowerCase();
|
|
900
|
+
var isQuery = query || new Query();
|
|
901
|
+
var filteredData;
|
|
902
|
+
if (dataSource instanceof DataManager) {
|
|
903
|
+
// Handle filtering for DataManager
|
|
904
|
+
dataSource.executeQuery(isQuery).then(function (e) {
|
|
905
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
906
|
+
var dataLists = e.result;
|
|
907
|
+
var dataLength = dataLists.length;
|
|
908
|
+
filteredData = dataLists.filter(function (item) { return _this.filterData(item, filterType, inputValue, fields); });
|
|
909
|
+
_this.updateGridDataSource(filteredData, dataLength);
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
else if (Array.isArray(dataSource)) {
|
|
913
|
+
// Handle filtering for array data source
|
|
914
|
+
filteredData = dataSource.filter(function (item) {
|
|
915
|
+
return _this.filterData(item, filterType, inputValue, fields);
|
|
916
|
+
});
|
|
917
|
+
this.updateGridDataSource(filteredData);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
MultiColumnComboBox.prototype.filterData = function (item, filterType, inputValue, fields) {
|
|
921
|
+
var itemValue = item[fields ? fields.text : this.fields.text].toString().toLowerCase();
|
|
922
|
+
switch (filterType) {
|
|
923
|
+
case 'startswith':
|
|
924
|
+
return itemValue.startsWith(inputValue);
|
|
925
|
+
case 'endswith':
|
|
926
|
+
return itemValue.endsWith(inputValue);
|
|
927
|
+
case 'contains':
|
|
928
|
+
return itemValue.includes(inputValue);
|
|
929
|
+
default:
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
MultiColumnComboBox.prototype.updateGridDataSource = function (dataSource, dataLength) {
|
|
934
|
+
var autoHeight = true;
|
|
935
|
+
if (dataSource.length > 0) {
|
|
936
|
+
var length_1 = this.dataSource instanceof DataManager ? dataLength : this.dataSource.length;
|
|
937
|
+
autoHeight = length_1 !== dataSource.length;
|
|
938
|
+
removeClass([this.popupDiv], [NODATA]);
|
|
939
|
+
var noRecordEle = this.popupDiv.querySelector('.e-no-records');
|
|
940
|
+
if (noRecordEle) {
|
|
941
|
+
this.popupDiv.removeChild(noRecordEle);
|
|
942
|
+
}
|
|
943
|
+
this.gridObj.dataSource = dataSource;
|
|
944
|
+
this.isDataFiltered = true;
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
this.l10nUpdate();
|
|
948
|
+
addClass([this.popupDiv], [NODATA]);
|
|
949
|
+
}
|
|
950
|
+
this.updateGridHeight(true, autoHeight, dataSource.length);
|
|
951
|
+
};
|
|
952
|
+
MultiColumnComboBox.prototype.wireEvents = function () {
|
|
953
|
+
var ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
|
|
954
|
+
var clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
|
|
955
|
+
EventHandler.add(ddbIcon, 'mousedown', this.dropDownClick, this);
|
|
956
|
+
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
957
|
+
EventHandler.add(this.gridEle, 'click', this.onMouseClick, this);
|
|
958
|
+
EventHandler.add(this.inputEle, 'input', this.inputHandler, this);
|
|
959
|
+
EventHandler.add(this.inputWrapper, 'focus', this.focusIn, this);
|
|
960
|
+
if (clearIcon) {
|
|
961
|
+
EventHandler.add(clearIcon, 'click', this.clearText, this);
|
|
962
|
+
}
|
|
963
|
+
EventHandler.add(window, 'resize', this.windowResize, this);
|
|
964
|
+
this.keyboardModule = new KeyboardEvents(this.inputWrapper, {
|
|
965
|
+
keyAction: this.keyActionHandler.bind(this),
|
|
966
|
+
keyConfigs: this.keyConfigs,
|
|
967
|
+
eventName: 'keydown'
|
|
968
|
+
});
|
|
969
|
+
this.keyboardModule = new KeyboardEvents(this.gridEle, {
|
|
970
|
+
keyAction: this.gridKeyActionHandler.bind(this),
|
|
971
|
+
keyConfigs: this.keyConfigs,
|
|
972
|
+
eventName: 'keydown'
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
MultiColumnComboBox.prototype.unWireEvents = function () {
|
|
976
|
+
var ddbIcon = this.inputWrapper.querySelector('.e-input-group-icon');
|
|
977
|
+
var clearIcon = this.inputWrapper.querySelector('.e-clear-icon');
|
|
978
|
+
EventHandler.remove(ddbIcon, 'mousedown', this.dropDownClick);
|
|
979
|
+
EventHandler.remove(document, 'mousedown', this.onDocumentClick);
|
|
980
|
+
EventHandler.remove(this.inputEle, 'input', this.inputHandler);
|
|
981
|
+
EventHandler.remove(this.inputWrapper, 'focus', this.focusIn);
|
|
982
|
+
EventHandler.remove(window, 'resize', this.windowResize);
|
|
983
|
+
EventHandler.remove(this.gridEle, 'click', this.onMouseClick);
|
|
984
|
+
if (clearIcon) {
|
|
985
|
+
EventHandler.remove(clearIcon, 'click', this.clearText);
|
|
986
|
+
}
|
|
987
|
+
if (this.keyboardModule) {
|
|
988
|
+
this.keyboardModule.destroy();
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
MultiColumnComboBox.prototype.dropDownClick = function (e) {
|
|
992
|
+
if (this.disabled || this.readonly) {
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
var focusedEle = this.gridEle.querySelector('.e-row-focus');
|
|
996
|
+
if (focusedEle) {
|
|
997
|
+
focusedEle.classList.remove('e-row-focus');
|
|
998
|
+
}
|
|
999
|
+
if (this.isPopupOpen) {
|
|
1000
|
+
this.hidePopup(e);
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
this.showPopup(e);
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
MultiColumnComboBox.prototype.onMouseClick = function (e) {
|
|
1007
|
+
var target = e.target;
|
|
1008
|
+
var row = closest(target, '.e-row');
|
|
1009
|
+
var selectedRowIndex = this.gridObj.selectedRowIndex;
|
|
1010
|
+
if (row) {
|
|
1011
|
+
if (selectedRowIndex >= 0) {
|
|
1012
|
+
this.selectedGridRow(row, e);
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
this.gridObj.selectedRowIndex = this.gridObj.getRows().indexOf(row);
|
|
1016
|
+
this.gridObj.selectRow(this.gridObj.selectedRowIndex);
|
|
1017
|
+
this.hidePopup(e);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
MultiColumnComboBox.prototype.onDocumentClick = function (e) {
|
|
1022
|
+
if (this.disabled || this.readonly || !this.isPopupOpen) {
|
|
1023
|
+
if (!(e.target.closest('.e-multicolumn-list'))) {
|
|
1024
|
+
this.focusOut();
|
|
1025
|
+
}
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
var target = e.target;
|
|
1029
|
+
if ((target.classList.contains('e-multicolumn-list-icon') || closest(target, '.e-popup'))) {
|
|
1030
|
+
e.preventDefault();
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
if (!target.classList.contains('e-multicolumncombobox') && !target.classList.contains('e-clear-icon')) {
|
|
1034
|
+
this.updateValuesOnInput(e);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (!closest(target, '.e-multicolumn-list')) {
|
|
1038
|
+
this.inputWrapper.tabIndex = -1;
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
MultiColumnComboBox.prototype.updateValuesOnInput = function (mouseEvent, keyEvent, isClearValues) {
|
|
1042
|
+
var _this = this;
|
|
1043
|
+
var e = mouseEvent ? mouseEvent : keyEvent;
|
|
1044
|
+
this.hidePopup(e);
|
|
1045
|
+
if (this.matchedRowEle && !isClearValues) {
|
|
1046
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
1047
|
+
this.isProtectedOnChange = true;
|
|
1048
|
+
setTimeout(function () {
|
|
1049
|
+
_this.inputEle.value = _this.matchedContent[_this.fields.text].toString();
|
|
1050
|
+
_this.value = _this.matchedContent[_this.fields.value].toString();
|
|
1051
|
+
var selectIndex = _this.findIndex(_this.gridObj.currentViewData, _this.matchedContent);
|
|
1052
|
+
_this.index = selectIndex;
|
|
1053
|
+
_this.text = _this.matchedContent[_this.fields.text].toString();
|
|
1054
|
+
_this.gridObj.selectRow(selectIndex);
|
|
1055
|
+
_this.selectedGridRow(_this.gridObj.getRowByIndex(selectIndex), e);
|
|
1056
|
+
_this.previousItemElement = _this.gridObj.getSelectedRows()[0];
|
|
1057
|
+
}, 100);
|
|
1058
|
+
this.isProtectedOnChange = prevOnChange;
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
if (this.isDataFiltered) {
|
|
1062
|
+
this.inputEle.value = '';
|
|
1063
|
+
var ChangeEventArgs = {
|
|
1064
|
+
value: null,
|
|
1065
|
+
itemData: { text: null, value: null },
|
|
1066
|
+
item: null,
|
|
1067
|
+
previousItemData: { text: this.text, value: this.value },
|
|
1068
|
+
previousItemElement: this.previousItemElement,
|
|
1069
|
+
itemElement: null,
|
|
1070
|
+
event: e,
|
|
1071
|
+
isInteracted: true,
|
|
1072
|
+
cancel: false
|
|
1073
|
+
};
|
|
1074
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
1075
|
+
this.isProtectedOnChange = true;
|
|
1076
|
+
this.text = this.value = this.index = null;
|
|
1077
|
+
this.gridObj.refreshColumns();
|
|
1078
|
+
this.isProtectedOnChange = prevOnChange;
|
|
1079
|
+
this.triggerChangeEvent(ChangeEventArgs);
|
|
1080
|
+
this.isDataFiltered = false;
|
|
1081
|
+
this.matchedContent = this.matchedRowEle = null;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
MultiColumnComboBox.prototype.clearText = function (e) {
|
|
1086
|
+
this.isDataFiltered = true;
|
|
1087
|
+
this.updateValuesOnInput(e, null, true);
|
|
1088
|
+
};
|
|
1089
|
+
MultiColumnComboBox.prototype.windowResize = function () {
|
|
1090
|
+
if (this.popupObj) {
|
|
1091
|
+
this.popupObj.setProperties({ width: this.getSize(true) });
|
|
1092
|
+
this.popupObj.refreshPosition();
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
/* To set cssclass for the dropdowntree */
|
|
1096
|
+
MultiColumnComboBox.prototype.setCssClass = function (newClass, oldClass) {
|
|
1097
|
+
var elements = this.popupObj ? [this.inputWrapper, this.popupObj.element] : [this.inputWrapper];
|
|
1098
|
+
if (!isNOU(oldClass) && oldClass !== '') {
|
|
1099
|
+
removeClass(elements, oldClass.split(' '));
|
|
1100
|
+
}
|
|
1101
|
+
if (!isNOU(newClass) && newClass !== '') {
|
|
1102
|
+
addClass(elements, newClass.split(' '));
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
MultiColumnComboBox.prototype.keyActionHandler = function (e) {
|
|
1106
|
+
switch (e.action) {
|
|
1107
|
+
case 'escape':
|
|
1108
|
+
case 'altUp':
|
|
1109
|
+
case 'shiftTab':
|
|
1110
|
+
case 'tab':
|
|
1111
|
+
if (this.isPopupOpen) {
|
|
1112
|
+
this.hidePopup(e);
|
|
1113
|
+
}
|
|
1114
|
+
break;
|
|
1115
|
+
case 'altDown':
|
|
1116
|
+
if (!this.isPopupOpen) {
|
|
1117
|
+
this.showPopup(e);
|
|
1118
|
+
this.updateSelectedItem(e, false);
|
|
1119
|
+
}
|
|
1120
|
+
break;
|
|
1121
|
+
case 'moveDown':
|
|
1122
|
+
case 'moveUp':
|
|
1123
|
+
this.updateSelectedItem(e);
|
|
1124
|
+
break;
|
|
1125
|
+
case 'enter':
|
|
1126
|
+
this.updateValuesOnInput(null, e);
|
|
1127
|
+
this.focusIn(e);
|
|
1128
|
+
break;
|
|
1129
|
+
case 'home':
|
|
1130
|
+
case 'end':
|
|
1131
|
+
this.updateSelectedItem(e);
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
MultiColumnComboBox.prototype.gridKeyActionHandler = function (e, isGroup) {
|
|
1136
|
+
if (isGroup) {
|
|
1137
|
+
if (e.key === 'ArrowDown') {
|
|
1138
|
+
e.action = 'moveDown';
|
|
1139
|
+
}
|
|
1140
|
+
else if (e.key === 'ArrowUp') {
|
|
1141
|
+
e.action = 'moveUp';
|
|
1142
|
+
}
|
|
1143
|
+
else if (e.key === 'End') {
|
|
1144
|
+
e.action = 'end';
|
|
1145
|
+
}
|
|
1146
|
+
else if (e.key === 'Home') {
|
|
1147
|
+
e.action = 'home';
|
|
1148
|
+
}
|
|
1149
|
+
if (e.altKey && e.key === 'ArrowUp') {
|
|
1150
|
+
e.action = 'altUp';
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
switch (e.action) {
|
|
1154
|
+
case 'escape':
|
|
1155
|
+
case 'tab':
|
|
1156
|
+
case 'shiftTab':
|
|
1157
|
+
case 'altUp':
|
|
1158
|
+
if (this.isPopupOpen) {
|
|
1159
|
+
e.preventDefault();
|
|
1160
|
+
this.hidePopup(e);
|
|
1161
|
+
}
|
|
1162
|
+
break;
|
|
1163
|
+
case 'moveDown':
|
|
1164
|
+
case 'moveUp':
|
|
1165
|
+
case 'home':
|
|
1166
|
+
case 'end':
|
|
1167
|
+
this.updateSelectedItem(e);
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
MultiColumnComboBox.prototype.updateSelectedItem = function (e, isUpdateIndex) {
|
|
1172
|
+
if (isUpdateIndex === void 0) { isUpdateIndex = true; }
|
|
1173
|
+
if (this.isPopupOpen) {
|
|
1174
|
+
var index = !this.fields.groupBy ? this.gridObj.selectedRowIndex : this.gridObj.selectedRowIndex ? this.gridObj.selectedRowIndex : 0;
|
|
1175
|
+
if ((index === -1 && (e.action === 'moveDown' || e.action === 'moveUp')) || (e.action === 'home')) {
|
|
1176
|
+
index = 0;
|
|
1177
|
+
}
|
|
1178
|
+
else if ((index >= this.gridObj.getRows().length && e.action === 'moveDown') || (e.action === 'end')) {
|
|
1179
|
+
index = this.gridObj.getRows().length - 1;
|
|
1180
|
+
}
|
|
1181
|
+
else if (e.action === 'moveDown' && (index >= 0 && index <= this.gridObj.getRows().length) && this.fields.groupBy) {
|
|
1182
|
+
index += 1;
|
|
1183
|
+
}
|
|
1184
|
+
else if (e.action === 'moveUp' && index > 0 && this.fields.groupBy) {
|
|
1185
|
+
index -= 1;
|
|
1186
|
+
}
|
|
1187
|
+
this.gridObj.selectRow(index);
|
|
1188
|
+
this.gridObj.selectedRowIndex = index;
|
|
1189
|
+
var focusedEle = this.gridEle.querySelector('.e-row-focus');
|
|
1190
|
+
if (focusedEle) {
|
|
1191
|
+
focusedEle.classList.remove('e-row-focus');
|
|
1192
|
+
}
|
|
1193
|
+
if (isUpdateIndex) {
|
|
1194
|
+
this.selectedGridRow(this.gridObj.getRows()[index], e, true);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
/**
|
|
1199
|
+
* Sets the focus to the component for interaction.component for interaction.
|
|
1200
|
+
*
|
|
1201
|
+
* @param {FocusEvent | MouseEvent | KeyboardEvent | TouchEvent} e - Specifies the event.
|
|
1202
|
+
* @returns {void}
|
|
1203
|
+
*/
|
|
1204
|
+
MultiColumnComboBox.prototype.focusIn = function (e) {
|
|
1205
|
+
if (this.disabled || this.readonly) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
addClass([this.inputWrapper], [INPUTFOCUS]);
|
|
1209
|
+
this.inputWrapper.tabIndex = 0;
|
|
1210
|
+
this.inputWrapper.focus();
|
|
1211
|
+
var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
|
|
1212
|
+
if (clearIconEle && (this.value && this.value.toString() !== '' || this.text && this.text !== '')) {
|
|
1213
|
+
clearIconEle.classList.remove('e-clear-icon-hide');
|
|
1214
|
+
}
|
|
1215
|
+
this.trigger('focus', e);
|
|
1216
|
+
if (this.floatLabelType !== 'Never') {
|
|
1217
|
+
Input.calculateWidth(this.inputEle, this.inputWrapper);
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
/**
|
|
1221
|
+
* Moves the focus from the component if the component is already focused.
|
|
1222
|
+
*
|
|
1223
|
+
* @param {MouseEvent | KeyboardEvent} e - Specifies the event.
|
|
1224
|
+
* @returns {void}
|
|
1225
|
+
*/
|
|
1226
|
+
MultiColumnComboBox.prototype.focusOut = function (e) {
|
|
1227
|
+
if (this.disabled || this.readonly) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
this.hidePopup(e);
|
|
1231
|
+
removeClass([this.inputWrapper], [INPUTFOCUS]);
|
|
1232
|
+
this.inputWrapper.tabIndex = -1;
|
|
1233
|
+
var clearIconEle = this.inputWrapper.querySelector('.e-clear-icon');
|
|
1234
|
+
if (clearIconEle) {
|
|
1235
|
+
clearIconEle.classList.add('e-clear-icon-hide');
|
|
1236
|
+
}
|
|
1237
|
+
if (this.floatLabelType !== 'Never') {
|
|
1238
|
+
Input.calculateWidth(this.inputEle, this.inputWrapper);
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
/**
|
|
1242
|
+
* Opens the popup that displays the list of items.
|
|
1243
|
+
*
|
|
1244
|
+
* @param {MouseEvent | KeyboardEventArgs | TouchEvent} e - Specifies the event.
|
|
1245
|
+
* @returns {void}
|
|
1246
|
+
*/
|
|
1247
|
+
MultiColumnComboBox.prototype.showPopup = function (e, isInputOpen) {
|
|
1248
|
+
var _this = this;
|
|
1249
|
+
var animModel = { name: 'FadeIn', duration: 100 };
|
|
1250
|
+
var eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
|
|
1251
|
+
this.trigger('open', eventArgs, function (eventArgs) {
|
|
1252
|
+
if (!eventArgs.cancel && !_this.isPopupOpen) {
|
|
1253
|
+
_this.isPopupOpen = true;
|
|
1254
|
+
_this.popupObj.refreshPosition();
|
|
1255
|
+
addClass([_this.inputWrapper], [ICONANIMATION]);
|
|
1256
|
+
attributes(_this.inputEle, { 'aria-expanded': 'true', 'aria-owns': _this.element.id + '_popup', 'aria-controls': _this.element.id });
|
|
1257
|
+
if (!isInputOpen) {
|
|
1258
|
+
if ((_this.value || _this.text || _this.index)) {
|
|
1259
|
+
var dataRows = _this.gridObj.currentViewData;
|
|
1260
|
+
dataRows.forEach(function (data, index) {
|
|
1261
|
+
_this.selectDataRow(data, index);
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
_this.focusIn(e);
|
|
1265
|
+
}
|
|
1266
|
+
_this.popupObj.show(new Animation(eventArgs.animation), _this.popupEle);
|
|
1267
|
+
}
|
|
1268
|
+
});
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Hides the popup if it is in open state.
|
|
1272
|
+
*
|
|
1273
|
+
* @param {MouseEvent | KeyboardEventArgs | TouchEvent} e - Specifies the event.
|
|
1274
|
+
* @returns {void}
|
|
1275
|
+
*/
|
|
1276
|
+
MultiColumnComboBox.prototype.hidePopup = function (e) {
|
|
1277
|
+
var _this = this;
|
|
1278
|
+
var animModel = { name: 'FadeOut', duration: 100 };
|
|
1279
|
+
var eventArgs = { popup: this.popupObj, event: e || null, cancel: false, animation: animModel };
|
|
1280
|
+
this.trigger('close', eventArgs, function (eventArgs) {
|
|
1281
|
+
if (!eventArgs.cancel) {
|
|
1282
|
+
_this.isPopupOpen = false;
|
|
1283
|
+
removeClass([_this.inputWrapper], [ICONANIMATION]);
|
|
1284
|
+
attributes(_this.inputEle, { 'aria-expanded': 'false' });
|
|
1285
|
+
_this.popupObj.hide(new Animation(eventArgs.animation));
|
|
1286
|
+
_this.inputEle.value = _this.text ? _this.text.toString() : '';
|
|
1287
|
+
if (e) {
|
|
1288
|
+
var target = e.target;
|
|
1289
|
+
if (target.classList.contains('e-multicolumn-list-icon') || target.classList.contains('e-rowcell')) {
|
|
1290
|
+
if (!_this.value) {
|
|
1291
|
+
_this.gridObj.refreshColumns();
|
|
1292
|
+
}
|
|
1293
|
+
_this.focusIn(e);
|
|
1294
|
+
}
|
|
1295
|
+
else {
|
|
1296
|
+
_this.focusOut();
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
setTimeout(function () {
|
|
1302
|
+
if (_this.gridObj) {
|
|
1303
|
+
_this.gridObj.dataSource = _this.dataSource;
|
|
1304
|
+
_this.updateGridHeight(true, false);
|
|
1305
|
+
}
|
|
1306
|
+
}, 100);
|
|
1307
|
+
};
|
|
1308
|
+
/**
|
|
1309
|
+
* Adds a new item to the popup list. By default, new item appends to the list as the last item,
|
|
1310
|
+
* but you can insert based on the index parameter.
|
|
1311
|
+
*
|
|
1312
|
+
* @param { Object[] } items - Specifies an array of JSON data or a JSON data.
|
|
1313
|
+
* @param { number } index - Specifies the index to place the newly added item in the popup list.
|
|
1314
|
+
* @returns {void}
|
|
1315
|
+
*/
|
|
1316
|
+
MultiColumnComboBox.prototype.addItems = function (items, index) {
|
|
1317
|
+
var prevOnChange = this.isProtectedOnChange;
|
|
1318
|
+
this.isProtectedOnChange = true;
|
|
1319
|
+
this.gridObj.editSettings.allowAdding = true;
|
|
1320
|
+
this.gridObj.dataBind();
|
|
1321
|
+
this.isProtectedOnChange = prevOnChange;
|
|
1322
|
+
this.gridObj.addRecord(items, index);
|
|
1323
|
+
};
|
|
1324
|
+
/* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
|
|
1325
|
+
/**
|
|
1326
|
+
* Gets all the list items bound on this component.
|
|
1327
|
+
*
|
|
1328
|
+
* @returns {Element[]}
|
|
1329
|
+
*/
|
|
1330
|
+
MultiColumnComboBox.prototype.getItems = function () {
|
|
1331
|
+
return this.gridObj.getDataRows();
|
|
1332
|
+
};
|
|
1333
|
+
/**
|
|
1334
|
+
* Gets the data Object that matches the given value.
|
|
1335
|
+
*
|
|
1336
|
+
* @param { string } value - Specifies the value of the list item.
|
|
1337
|
+
* @returns {Object}
|
|
1338
|
+
*/
|
|
1339
|
+
MultiColumnComboBox.prototype.getDataByValue = function (value) {
|
|
1340
|
+
var _this = this;
|
|
1341
|
+
if (!isNOU(this.dataSource) && this.dataSource instanceof Array) {
|
|
1342
|
+
return this.dataSource.filter(function (item) {
|
|
1343
|
+
return item[_this.fields.value].toString() === value;
|
|
1344
|
+
})[0];
|
|
1345
|
+
}
|
|
1346
|
+
else if (!isNOU(this.dataSource) && this.dataSource instanceof DataManager) {
|
|
1347
|
+
this.dataSource.executeQuery(new Query()).then(function (e) {
|
|
1348
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1349
|
+
var dataLists = e.result;
|
|
1350
|
+
return dataLists.filter(function (item) {
|
|
1351
|
+
return item[_this.fields.value].toString() === value;
|
|
1352
|
+
})[0];
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
return null;
|
|
1356
|
+
};
|
|
1357
|
+
MultiColumnComboBox.prototype.destroy = function () {
|
|
1358
|
+
this.unWireEvents();
|
|
1359
|
+
if (this.gridObj) {
|
|
1360
|
+
this.gridObj.destroy();
|
|
1361
|
+
detach(this.gridObj.element);
|
|
1362
|
+
}
|
|
1363
|
+
if (this.popupObj) {
|
|
1364
|
+
this.popupObj.destroy();
|
|
1365
|
+
detach(this.popupObj.element);
|
|
1366
|
+
}
|
|
1367
|
+
if (this.inputEle) {
|
|
1368
|
+
var attrArray = ['placeholder', 'aria-expanded', 'spellcheck', 'aria-label', 'role', 'tabindex', 'type', 'id', 'aria-owns', 'aria-controls'];
|
|
1369
|
+
for (var i = 0; i < attrArray.length; i++) {
|
|
1370
|
+
this.inputEle.removeAttribute(attrArray[i]);
|
|
1371
|
+
}
|
|
1372
|
+
this.inputEle.classList.remove('e-input');
|
|
1373
|
+
Input.setValue('', this.inputEle, this.floatLabelType, this.showClearButton);
|
|
1374
|
+
}
|
|
1375
|
+
if (this.element.tagName !== this.getDirective()) {
|
|
1376
|
+
this.inputWrapper.parentElement.insertBefore(this.element, this.inputWrapper);
|
|
1377
|
+
}
|
|
1378
|
+
if (this.inputObj) {
|
|
1379
|
+
detach(this.inputObj.container);
|
|
1380
|
+
this.inputObj = null;
|
|
1381
|
+
}
|
|
1382
|
+
Input.destroy({
|
|
1383
|
+
element: this.inputEle,
|
|
1384
|
+
floatLabelType: this.floatLabelType,
|
|
1385
|
+
properties: this.properties
|
|
1386
|
+
});
|
|
1387
|
+
detach(this.inputWrapper);
|
|
1388
|
+
detach(this.popupDiv);
|
|
1389
|
+
this.inputEle = null;
|
|
1390
|
+
this.previousItemElement = null;
|
|
1391
|
+
this.inputWrapper.innerHTML = '';
|
|
1392
|
+
this.inputWrapper = null;
|
|
1393
|
+
this.popupDiv = null;
|
|
1394
|
+
this.popupObj = null;
|
|
1395
|
+
this.gridObj = null;
|
|
1396
|
+
this.gridEle = null;
|
|
1397
|
+
this.popupEle = null;
|
|
1398
|
+
this.footer = null;
|
|
1399
|
+
this.noRecord = null;
|
|
1400
|
+
_super.prototype.destroy.call(this);
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Called internally if any of the property value changed.
|
|
1404
|
+
*
|
|
1405
|
+
* @param {MultiColumnComboBoxModel} newProp - Specifies new properties
|
|
1406
|
+
* @param {MultiColumnComboBoxModel} oldProp - Specifies old properties
|
|
1407
|
+
* @returns {void}
|
|
1408
|
+
* @private
|
|
1409
|
+
*/
|
|
1410
|
+
MultiColumnComboBox.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
1411
|
+
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
1412
|
+
var prop = _a[_i];
|
|
1413
|
+
var gridColumns = void 0;
|
|
1414
|
+
switch (prop) {
|
|
1415
|
+
case 'width':
|
|
1416
|
+
case 'popupWidth':
|
|
1417
|
+
if (prop === 'width') {
|
|
1418
|
+
this.setElementWidth(newProp.width);
|
|
1419
|
+
}
|
|
1420
|
+
if (this.popupObj) {
|
|
1421
|
+
this.popupObj.element.style.width = this.getSize(true);
|
|
1422
|
+
}
|
|
1423
|
+
break;
|
|
1424
|
+
case 'popupHeight':
|
|
1425
|
+
if (this.popupObj) {
|
|
1426
|
+
var height = this.getSize(false);
|
|
1427
|
+
this.popupObj.element.style.maxHeight = height;
|
|
1428
|
+
this.popupDiv.style.maxHeight = height;
|
|
1429
|
+
this.gridObj.height = height;
|
|
1430
|
+
}
|
|
1431
|
+
break;
|
|
1432
|
+
case 'placeholder':
|
|
1433
|
+
Input.setPlaceholder(newProp.placeholder, this.inputEle);
|
|
1434
|
+
break;
|
|
1435
|
+
case 'readonly':
|
|
1436
|
+
Input.setReadonly(this.readonly, this.inputEle);
|
|
1437
|
+
break;
|
|
1438
|
+
case 'disabled':
|
|
1439
|
+
Input.setEnabled(!this.disabled, this.inputEle);
|
|
1440
|
+
this.setEnable();
|
|
1441
|
+
break;
|
|
1442
|
+
case 'cssClass':
|
|
1443
|
+
this.setCssClass(newProp.cssClass, oldProp.cssClass);
|
|
1444
|
+
break;
|
|
1445
|
+
case 'floatLabelType':
|
|
1446
|
+
Input.removeFloating(this.inputObj);
|
|
1447
|
+
Input.addFloating(this.inputEle, this.floatLabelType, this.placeholder);
|
|
1448
|
+
break;
|
|
1449
|
+
case 'showClearButton':
|
|
1450
|
+
Input.setClearButton(newProp.showClearButton, this.inputEle, this.inputObj);
|
|
1451
|
+
break;
|
|
1452
|
+
case 'value':
|
|
1453
|
+
this.initValue(true, true);
|
|
1454
|
+
break;
|
|
1455
|
+
case 'text':
|
|
1456
|
+
this.initValue(true, false);
|
|
1457
|
+
break;
|
|
1458
|
+
case 'index':
|
|
1459
|
+
this.initValue();
|
|
1460
|
+
break;
|
|
1461
|
+
case 'sortOrder':
|
|
1462
|
+
if (this.gridObj) {
|
|
1463
|
+
this.gridObj.sortSettings.columns = [{ field: this.fields.text, direction: newProp.sortOrder === SortOrder.Ascending ?
|
|
1464
|
+
SortOrder.Ascending : SortOrder.Descending }];
|
|
1465
|
+
}
|
|
1466
|
+
break;
|
|
1467
|
+
case 'htmlAttributes':
|
|
1468
|
+
this.setHTMLAttributes();
|
|
1469
|
+
break;
|
|
1470
|
+
case 'noRecordsTemplate':
|
|
1471
|
+
this.l10nUpdate();
|
|
1472
|
+
break;
|
|
1473
|
+
case 'actionFailureTemplate':
|
|
1474
|
+
this.l10nUpdate(true);
|
|
1475
|
+
break;
|
|
1476
|
+
case 'footerTemplate':
|
|
1477
|
+
this.setFooterTemplate();
|
|
1478
|
+
break;
|
|
1479
|
+
case 'itemTemplate':
|
|
1480
|
+
if (this.gridObj) {
|
|
1481
|
+
this.gridObj.rowTemplate = newProp.itemTemplate;
|
|
1482
|
+
}
|
|
1483
|
+
break;
|
|
1484
|
+
case 'groupTemplate':
|
|
1485
|
+
this.groupTemplate = newProp.groupTemplate;
|
|
1486
|
+
this.updateGroupByField();
|
|
1487
|
+
break;
|
|
1488
|
+
case 'enableRtl':
|
|
1489
|
+
if (this.gridObj && this.popupObj) {
|
|
1490
|
+
this.gridObj.enableRtl = newProp.enableRtl;
|
|
1491
|
+
Input.setEnableRtl(newProp.enableRtl, [this.inputWrapper]);
|
|
1492
|
+
this.popupObj.enableRtl = newProp.enableRtl;
|
|
1493
|
+
}
|
|
1494
|
+
break;
|
|
1495
|
+
case 'dataSource':
|
|
1496
|
+
if (this.gridObj) {
|
|
1497
|
+
this.gridObj.dataSource = newProp.dataSource;
|
|
1498
|
+
}
|
|
1499
|
+
break;
|
|
1500
|
+
case 'query':
|
|
1501
|
+
if (this.gridObj) {
|
|
1502
|
+
this.gridObj.query = newProp.query;
|
|
1503
|
+
}
|
|
1504
|
+
break;
|
|
1505
|
+
case 'gridSettings':
|
|
1506
|
+
if (this.gridObj) {
|
|
1507
|
+
this.gridObj.gridLines = newProp.gridSettings.gridLines;
|
|
1508
|
+
this.gridObj.rowHeight = newProp.gridSettings.rowHeight;
|
|
1509
|
+
this.gridObj.enableAltRow = newProp.gridSettings.enableAltRow;
|
|
1510
|
+
}
|
|
1511
|
+
break;
|
|
1512
|
+
case 'fields':
|
|
1513
|
+
this.fields = newProp.fields;
|
|
1514
|
+
this.updateGroupByField();
|
|
1515
|
+
break;
|
|
1516
|
+
case 'filterType':
|
|
1517
|
+
this.filterType = newProp.filterType;
|
|
1518
|
+
break;
|
|
1519
|
+
case 'enableVirtualization':
|
|
1520
|
+
if (this.gridObj) {
|
|
1521
|
+
this.enableVirtualization = this.gridObj.enableVirtualization = newProp.enableVirtualization;
|
|
1522
|
+
}
|
|
1523
|
+
break;
|
|
1524
|
+
case 'sortType':
|
|
1525
|
+
this.sortType = newProp.sortType;
|
|
1526
|
+
break;
|
|
1527
|
+
case 'allowFiltering':
|
|
1528
|
+
this.allowFiltering = newProp.allowFiltering;
|
|
1529
|
+
break;
|
|
1530
|
+
case 'allowSorting':
|
|
1531
|
+
if (this.gridObj) {
|
|
1532
|
+
this.allowSorting = this.gridObj.allowSorting = newProp.allowSorting;
|
|
1533
|
+
}
|
|
1534
|
+
break;
|
|
1535
|
+
case 'columns':
|
|
1536
|
+
if (this.gridObj) {
|
|
1537
|
+
gridColumns = this.getGridColumns();
|
|
1538
|
+
this.gridObj.columns = gridColumns;
|
|
1539
|
+
}
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
__decorate([
|
|
1545
|
+
Property([])
|
|
1546
|
+
], MultiColumnComboBox.prototype, "dataSource", void 0);
|
|
1547
|
+
__decorate([
|
|
1548
|
+
Property(null)
|
|
1549
|
+
], MultiColumnComboBox.prototype, "text", void 0);
|
|
1550
|
+
__decorate([
|
|
1551
|
+
Property(null)
|
|
1552
|
+
], MultiColumnComboBox.prototype, "value", void 0);
|
|
1553
|
+
__decorate([
|
|
1554
|
+
Property(null)
|
|
1555
|
+
], MultiColumnComboBox.prototype, "index", void 0);
|
|
1556
|
+
__decorate([
|
|
1557
|
+
Property('100%')
|
|
1558
|
+
], MultiColumnComboBox.prototype, "width", void 0);
|
|
1559
|
+
__decorate([
|
|
1560
|
+
Property('300px')
|
|
1561
|
+
], MultiColumnComboBox.prototype, "popupHeight", void 0);
|
|
1562
|
+
__decorate([
|
|
1563
|
+
Property('100%')
|
|
1564
|
+
], MultiColumnComboBox.prototype, "popupWidth", void 0);
|
|
1565
|
+
__decorate([
|
|
1566
|
+
Property(null)
|
|
1567
|
+
], MultiColumnComboBox.prototype, "placeholder", void 0);
|
|
1568
|
+
__decorate([
|
|
1569
|
+
Property(true)
|
|
1570
|
+
], MultiColumnComboBox.prototype, "allowFiltering", void 0);
|
|
1571
|
+
__decorate([
|
|
1572
|
+
Property(true)
|
|
1573
|
+
], MultiColumnComboBox.prototype, "allowSorting", void 0);
|
|
1574
|
+
__decorate([
|
|
1575
|
+
Property(false)
|
|
1576
|
+
], MultiColumnComboBox.prototype, "showClearButton", void 0);
|
|
1577
|
+
__decorate([
|
|
1578
|
+
Property('')
|
|
1579
|
+
], MultiColumnComboBox.prototype, "cssClass", void 0);
|
|
1580
|
+
__decorate([
|
|
1581
|
+
Complex({ text: null, value: null, groupBy: null }, FieldSettings)
|
|
1582
|
+
], MultiColumnComboBox.prototype, "fields", void 0);
|
|
1583
|
+
__decorate([
|
|
1584
|
+
Collection([], Column)
|
|
1585
|
+
], MultiColumnComboBox.prototype, "columns", void 0);
|
|
1586
|
+
__decorate([
|
|
1587
|
+
Complex({}, GridSettings)
|
|
1588
|
+
], MultiColumnComboBox.prototype, "gridSettings", void 0);
|
|
1589
|
+
__decorate([
|
|
1590
|
+
Property(FilterType.StartsWith)
|
|
1591
|
+
], MultiColumnComboBox.prototype, "filterType", void 0);
|
|
1592
|
+
__decorate([
|
|
1593
|
+
Property('Never')
|
|
1594
|
+
], MultiColumnComboBox.prototype, "floatLabelType", void 0);
|
|
1595
|
+
__decorate([
|
|
1596
|
+
Property(SortOrder.None)
|
|
1597
|
+
], MultiColumnComboBox.prototype, "sortOrder", void 0);
|
|
1598
|
+
__decorate([
|
|
1599
|
+
Property(SortType.OneColumn)
|
|
1600
|
+
], MultiColumnComboBox.prototype, "sortType", void 0);
|
|
1601
|
+
__decorate([
|
|
1602
|
+
Property(false)
|
|
1603
|
+
], MultiColumnComboBox.prototype, "enableVirtualization", void 0);
|
|
1604
|
+
__decorate([
|
|
1605
|
+
Property(false)
|
|
1606
|
+
], MultiColumnComboBox.prototype, "disabled", void 0);
|
|
1607
|
+
__decorate([
|
|
1608
|
+
Property(false)
|
|
1609
|
+
], MultiColumnComboBox.prototype, "readonly", void 0);
|
|
1610
|
+
__decorate([
|
|
1611
|
+
Property(false)
|
|
1612
|
+
], MultiColumnComboBox.prototype, "enablePersistence", void 0);
|
|
1613
|
+
__decorate([
|
|
1614
|
+
Property()
|
|
1615
|
+
], MultiColumnComboBox.prototype, "query", void 0);
|
|
1616
|
+
__decorate([
|
|
1617
|
+
Property(null)
|
|
1618
|
+
], MultiColumnComboBox.prototype, "itemTemplate", void 0);
|
|
1619
|
+
__decorate([
|
|
1620
|
+
Property(null)
|
|
1621
|
+
], MultiColumnComboBox.prototype, "footerTemplate", void 0);
|
|
1622
|
+
__decorate([
|
|
1623
|
+
Property(null)
|
|
1624
|
+
], MultiColumnComboBox.prototype, "groupTemplate", void 0);
|
|
1625
|
+
__decorate([
|
|
1626
|
+
Property('Request Failed')
|
|
1627
|
+
], MultiColumnComboBox.prototype, "actionFailureTemplate", void 0);
|
|
1628
|
+
__decorate([
|
|
1629
|
+
Property('No records found')
|
|
1630
|
+
], MultiColumnComboBox.prototype, "noRecordsTemplate", void 0);
|
|
1631
|
+
__decorate([
|
|
1632
|
+
Property({})
|
|
1633
|
+
], MultiColumnComboBox.prototype, "htmlAttributes", void 0);
|
|
1634
|
+
__decorate([
|
|
1635
|
+
Event()
|
|
1636
|
+
], MultiColumnComboBox.prototype, "created", void 0);
|
|
1637
|
+
__decorate([
|
|
1638
|
+
Event()
|
|
1639
|
+
], MultiColumnComboBox.prototype, "open", void 0);
|
|
1640
|
+
__decorate([
|
|
1641
|
+
Event()
|
|
1642
|
+
], MultiColumnComboBox.prototype, "close", void 0);
|
|
1643
|
+
__decorate([
|
|
1644
|
+
Event()
|
|
1645
|
+
], MultiColumnComboBox.prototype, "actionFailure", void 0);
|
|
1646
|
+
__decorate([
|
|
1647
|
+
Event()
|
|
1648
|
+
], MultiColumnComboBox.prototype, "actionBegin", void 0);
|
|
1649
|
+
__decorate([
|
|
1650
|
+
Event()
|
|
1651
|
+
], MultiColumnComboBox.prototype, "actionComplete", void 0);
|
|
1652
|
+
__decorate([
|
|
1653
|
+
Event()
|
|
1654
|
+
], MultiColumnComboBox.prototype, "filtering", void 0);
|
|
1655
|
+
__decorate([
|
|
1656
|
+
Event()
|
|
1657
|
+
], MultiColumnComboBox.prototype, "select", void 0);
|
|
1658
|
+
__decorate([
|
|
1659
|
+
Event()
|
|
1660
|
+
], MultiColumnComboBox.prototype, "change", void 0);
|
|
1661
|
+
MultiColumnComboBox = __decorate([
|
|
1662
|
+
NotifyPropertyChanges
|
|
1663
|
+
], MultiColumnComboBox);
|
|
1664
|
+
return MultiColumnComboBox;
|
|
1665
|
+
}(Component));
|
|
1666
|
+
export { MultiColumnComboBox };
|