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