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