@syncfusion/ej2-dropdowns 18.2.44-4568 → 18.2.44-4569

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 (169) hide show
  1. package/.eslintrc.json +244 -0
  2. package/CHANGELOG.md +1524 -1524
  3. package/README.md +118 -118
  4. package/dist/ej2-dropdowns.umd.min.js +1 -1
  5. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-dropdowns.es2015.js +99 -60
  7. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  8. package/dist/es6/ej2-dropdowns.es5.js +191 -151
  9. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  10. package/dist/global/ej2-dropdowns.min.js +1 -1
  11. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  12. package/dist/ts/auto-complete/auto-complete.ts +527 -0
  13. package/dist/ts/combo-box/combo-box.ts +957 -0
  14. package/dist/ts/common/highlight-search.ts +47 -0
  15. package/dist/ts/common/incremental-search.ts +81 -0
  16. package/dist/ts/drop-down-base/drop-down-base.ts +1572 -0
  17. package/dist/ts/drop-down-list/drop-down-list.ts +2993 -0
  18. package/dist/ts/drop-down-tree/drop-down-tree.ts +3066 -0
  19. package/dist/ts/list-box/list-box.ts +2317 -0
  20. package/dist/ts/multi-select/checkbox-selection.ts +528 -0
  21. package/dist/ts/multi-select/float-label.ts +155 -0
  22. package/dist/ts/multi-select/interface.ts +66 -0
  23. package/dist/ts/multi-select/multi-select.ts +4216 -0
  24. package/helpers/e2e/index.js +3 -3
  25. package/license +2 -2
  26. package/package.json +77 -78
  27. package/src/auto-complete/auto-complete-model.d.ts +179 -179
  28. package/src/auto-complete/auto-complete.js +19 -19
  29. package/src/combo-box/combo-box-model.d.ts +212 -212
  30. package/src/combo-box/combo-box.js +19 -19
  31. package/src/drop-down-base/drop-down-base-model.d.ts +191 -191
  32. package/src/drop-down-base/drop-down-base.js +19 -19
  33. package/src/drop-down-list/drop-down-list-model.d.ts +222 -222
  34. package/src/drop-down-list/drop-down-list.js +19 -19
  35. package/src/drop-down-tree/drop-down-tree-model.d.ts +344 -344
  36. package/src/drop-down-tree/drop-down-tree.js +19 -19
  37. package/src/list-box/list-box-model.d.ts +156 -156
  38. package/src/list-box/list-box.js +19 -19
  39. package/src/multi-select/multi-select-model.d.ts +452 -452
  40. package/src/multi-select/multi-select.d.ts +2 -0
  41. package/src/multi-select/multi-select.js +73 -36
  42. package/styles/_all.scss +3 -3
  43. package/styles/auto-complete/_bootstrap-dark-definition.scss +3 -3
  44. package/styles/auto-complete/_bootstrap4-definition.scss +11 -11
  45. package/styles/auto-complete/_fabric-dark-definition.scss +2 -2
  46. package/styles/auto-complete/_highcontrast-light-definition.scss +2 -2
  47. package/styles/auto-complete/_material-dark-definition.scss +2 -2
  48. package/styles/bootstrap-dark.css +13 -16
  49. package/styles/bootstrap.css +12 -15
  50. package/styles/bootstrap4.css +6 -10
  51. package/styles/combo-box/_bootstrap-dark-definition.scss +2 -2
  52. package/styles/combo-box/_bootstrap4-definition.scss +11 -11
  53. package/styles/combo-box/_fabric-dark-definition.scss +2 -2
  54. package/styles/combo-box/_highcontrast-light-definition.scss +3 -3
  55. package/styles/combo-box/_material-dark-definition.scss +2 -2
  56. package/styles/drop-down-base/_all.scss +2 -2
  57. package/styles/drop-down-base/_bootstrap-dark-definition.scss +64 -64
  58. package/styles/drop-down-base/_bootstrap-definition.scss +64 -64
  59. package/styles/drop-down-base/_bootstrap4-definition.scss +78 -78
  60. package/styles/drop-down-base/_definition.scss +23 -23
  61. package/styles/drop-down-base/_fabric-dark-definition.scss +68 -68
  62. package/styles/drop-down-base/_fabric-definition.scss +66 -66
  63. package/styles/drop-down-base/_highcontrast-definition.scss +82 -82
  64. package/styles/drop-down-base/_highcontrast-light-definition.scss +81 -81
  65. package/styles/drop-down-base/_layout.scss +108 -108
  66. package/styles/drop-down-base/_material-dark-definition.scss +67 -67
  67. package/styles/drop-down-base/_material-definition.scss +65 -65
  68. package/styles/drop-down-base/_theme.scss +242 -242
  69. package/styles/drop-down-list/_all.scss +2 -2
  70. package/styles/drop-down-list/_bootstrap-dark-definition.scss +157 -157
  71. package/styles/drop-down-list/_bootstrap-definition.scss +156 -156
  72. package/styles/drop-down-list/_bootstrap4-definition.scss +184 -184
  73. package/styles/drop-down-list/_fabric-dark-definition.scss +127 -127
  74. package/styles/drop-down-list/_fabric-definition.scss +122 -122
  75. package/styles/drop-down-list/_highcontrast-definition.scss +131 -131
  76. package/styles/drop-down-list/_highcontrast-light-definition.scss +133 -133
  77. package/styles/drop-down-list/_layout.scss +218 -218
  78. package/styles/drop-down-list/_material-dark-definition.scss +143 -143
  79. package/styles/drop-down-list/_material-definition.scss +166 -166
  80. package/styles/drop-down-list/_theme.scss +10 -10
  81. package/styles/drop-down-list/icons/_bootstrap-dark.scss +14 -14
  82. package/styles/drop-down-list/icons/_bootstrap.scss +14 -14
  83. package/styles/drop-down-list/icons/_bootstrap4.scss +14 -14
  84. package/styles/drop-down-list/icons/_fabric-dark.scss +14 -14
  85. package/styles/drop-down-list/icons/_fabric.scss +14 -14
  86. package/styles/drop-down-list/icons/_highcontrast-light.scss +14 -14
  87. package/styles/drop-down-list/icons/_highcontrast.scss +14 -14
  88. package/styles/drop-down-list/icons/_material-dark.scss +14 -14
  89. package/styles/drop-down-list/icons/_material.scss +14 -14
  90. package/styles/drop-down-list/material.css +9 -0
  91. package/styles/drop-down-tree/_all.scss +2 -2
  92. package/styles/drop-down-tree/_bootstrap-dark-definition.scss +61 -61
  93. package/styles/drop-down-tree/_bootstrap-definition.scss +61 -61
  94. package/styles/drop-down-tree/_bootstrap4-definition.scss +62 -62
  95. package/styles/drop-down-tree/_fabric-dark-definition.scss +62 -62
  96. package/styles/drop-down-tree/_fabric-definition.scss +62 -62
  97. package/styles/drop-down-tree/_highcontrast-definition.scss +62 -62
  98. package/styles/drop-down-tree/_highcontrast-light-definition.scss +62 -62
  99. package/styles/drop-down-tree/_layout.scss +437 -437
  100. package/styles/drop-down-tree/_material-dark-definition.scss +60 -60
  101. package/styles/drop-down-tree/_material-definition.scss +60 -60
  102. package/styles/drop-down-tree/_theme.scss +68 -68
  103. package/styles/drop-down-tree/icons/_bootstrap-dark.scss +11 -11
  104. package/styles/drop-down-tree/icons/_bootstrap.scss +11 -11
  105. package/styles/drop-down-tree/icons/_bootstrap4.scss +11 -11
  106. package/styles/drop-down-tree/icons/_fabric-dark.scss +11 -11
  107. package/styles/drop-down-tree/icons/_fabric.scss +11 -11
  108. package/styles/drop-down-tree/icons/_highcontrast-light.scss +11 -11
  109. package/styles/drop-down-tree/icons/_highcontrast.scss +11 -11
  110. package/styles/drop-down-tree/icons/_material-dark.scss +11 -11
  111. package/styles/drop-down-tree/icons/_material.scss +11 -11
  112. package/styles/drop-down-tree/material.css +9 -0
  113. package/styles/fabric-dark.css +2 -5
  114. package/styles/fabric.css +1 -4
  115. package/styles/highcontrast-light.css +2 -5
  116. package/styles/highcontrast.css +2 -7
  117. package/styles/list-box/_all.scss +2 -2
  118. package/styles/list-box/_bootstrap-dark-definition.scss +118 -118
  119. package/styles/list-box/_bootstrap-definition.scss +112 -112
  120. package/styles/list-box/_bootstrap4-definition.scss +118 -118
  121. package/styles/list-box/_fabric-dark-definition.scss +118 -118
  122. package/styles/list-box/_fabric-definition.scss +112 -112
  123. package/styles/list-box/_highcontrast-definition.scss +112 -112
  124. package/styles/list-box/_highcontrast-light-definition.scss +118 -118
  125. package/styles/list-box/_layout.scss +458 -458
  126. package/styles/list-box/_material-dark-definition.scss +118 -118
  127. package/styles/list-box/_material-definition.scss +112 -112
  128. package/styles/list-box/_theme.scss +273 -273
  129. package/styles/list-box/icons/_bootstrap-dark.scss +25 -25
  130. package/styles/list-box/icons/_bootstrap.scss +25 -25
  131. package/styles/list-box/icons/_bootstrap4.scss +25 -25
  132. package/styles/list-box/icons/_fabric-dark.scss +25 -25
  133. package/styles/list-box/icons/_fabric.scss +25 -25
  134. package/styles/list-box/icons/_highcontrast-light.scss +25 -25
  135. package/styles/list-box/icons/_highcontrast.scss +25 -25
  136. package/styles/list-box/icons/_material-dark.scss +25 -25
  137. package/styles/list-box/icons/_material.scss +25 -25
  138. package/styles/material-dark.css +8 -11
  139. package/styles/material.css +34 -10
  140. package/styles/multi-select/_all.scss +2 -2
  141. package/styles/multi-select/_bootstrap-dark-definition.scss +171 -171
  142. package/styles/multi-select/_bootstrap-definition.scss +166 -166
  143. package/styles/multi-select/_bootstrap4-definition.scss +233 -233
  144. package/styles/multi-select/_fabric-dark-definition.scss +170 -170
  145. package/styles/multi-select/_fabric-definition.scss +167 -167
  146. package/styles/multi-select/_highcontrast-definition.scss +257 -259
  147. package/styles/multi-select/_highcontrast-light-definition.scss +258 -258
  148. package/styles/multi-select/_layout.scss +1153 -1153
  149. package/styles/multi-select/_material-dark-definition.scss +186 -186
  150. package/styles/multi-select/_material-definition.scss +191 -191
  151. package/styles/multi-select/_theme.scss +384 -389
  152. package/styles/multi-select/bootstrap-dark.css +13 -16
  153. package/styles/multi-select/bootstrap.css +12 -15
  154. package/styles/multi-select/bootstrap4.css +6 -10
  155. package/styles/multi-select/fabric-dark.css +2 -5
  156. package/styles/multi-select/fabric.css +1 -4
  157. package/styles/multi-select/highcontrast-light.css +2 -5
  158. package/styles/multi-select/highcontrast.css +2 -7
  159. package/styles/multi-select/icons/_bootstrap-dark.scss +26 -26
  160. package/styles/multi-select/icons/_bootstrap.scss +26 -26
  161. package/styles/multi-select/icons/_bootstrap4.scss +37 -37
  162. package/styles/multi-select/icons/_fabric-dark.scss +26 -26
  163. package/styles/multi-select/icons/_fabric.scss +26 -26
  164. package/styles/multi-select/icons/_highcontrast-light.scss +26 -26
  165. package/styles/multi-select/icons/_highcontrast.scss +26 -26
  166. package/styles/multi-select/icons/_material-dark.scss +26 -26
  167. package/styles/multi-select/icons/_material.scss +324 -324
  168. package/styles/multi-select/material-dark.css +8 -11
  169. package/styles/multi-select/material.css +16 -10
@@ -0,0 +1,527 @@
1
+ /// <reference path='../combo-box/combo-box-model.d.ts'/>
2
+ import { Property, EventHandler, KeyboardEventArgs, isNullOrUndefined, detach } from '@syncfusion/ej2-base';
3
+ import { Event, EmitType, Complex } from '@syncfusion/ej2-base';
4
+ import { removeClass, attributes, NotifyPropertyChanges } from '@syncfusion/ej2-base';
5
+ import { dropDownListClasses } from '../drop-down-list/drop-down-list';
6
+ import { ComboBox } from '../combo-box/combo-box';
7
+ import { AutoCompleteModel } from '../auto-complete/auto-complete-model';
8
+ import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
9
+ import { Search } from '../common/incremental-search';
10
+ import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';
11
+ import { FieldSettings, FilteringEventArgs, FilterType } from '../drop-down-base/drop-down-base';
12
+
13
+ /* tslint:disable */
14
+ import { FloatLabelType, Input } from '@syncfusion/ej2-inputs';
15
+ import { SortOrder } from '@syncfusion/ej2-lists';
16
+ import { DataManager, Query } from '@syncfusion/ej2-data';
17
+ /* tslint:enable */
18
+
19
+ dropDownListClasses.root = 'e-autocomplete';
20
+ dropDownListClasses.icon = 'e-input-group-icon e-ddl-icon e-search-icon';
21
+
22
+
23
+ /**
24
+ * The AutoComplete component provides the matched suggestion list when type into the input,
25
+ * from which the user can select one.
26
+ * ```html
27
+ * <input id="list" type="text"/>
28
+ * ```
29
+ * ```typescript
30
+ * let atcObj:AutoComplete = new AutoComplete();
31
+ * atcObj.appendTo("#list");
32
+ * ```
33
+ */
34
+ @NotifyPropertyChanges
35
+ export class AutoComplete extends ComboBox {
36
+ private isFiltered: boolean = false;
37
+ /**
38
+ * The `fields` property maps the columns of the data table and binds the data to the component.
39
+ * * text - Maps the text column from data table for each list item
40
+ * * value - Maps the value column from data table for each list item
41
+ * * iconCss - Maps the icon class column from data table for each list item
42
+ * * groupBy - Group the list items with it's related items by mapping groupBy field
43
+ *
44
+ * {% codeBlock src='autocomplete/fields/index.md' %}{% endcodeBlock %}
45
+ * > For more details about the field mapping refer to [`Data binding`](../../auto-complete/data-binding) documentation.
46
+ * @default { value: null, iconCss: null, groupBy: null}
47
+ * @deprecated
48
+ */
49
+ @Complex<FieldSettingsModel>({ value: null, iconCss: null, groupBy: null }, FieldSettings)
50
+ public fields: FieldSettingsModel;
51
+ /**
52
+ * When set to ‘false’, consider the [`case-sensitive`](../../auto-complete/filtering/#case-sensitive-filtering)
53
+ * on performing the search to find suggestions.
54
+ * By default consider the casing.
55
+ * @default true
56
+ * @deprecated
57
+ */
58
+ @Property(true)
59
+ public ignoreCase: boolean;
60
+ /**
61
+ * Allows you to either show or hide the popup button on the component.
62
+ * @default false
63
+ */
64
+ @Property(false)
65
+ public showPopupButton: boolean;
66
+ /**
67
+ * When set to ‘true’, highlight the searched characters on suggested list items.
68
+ * > For more details about the highlight refer to [`Custom highlight search`](../../auto-complete/how-to/custom-search) documentation.
69
+ * @default false
70
+ */
71
+ @Property(false)
72
+ public highlight: boolean;
73
+ /**
74
+ * Supports the [`specified number`](../../auto-complete/filtering#filter-item-count)
75
+ * of list items on the suggestion popup.
76
+ * @default 20
77
+ * @blazorType int
78
+ */
79
+ @Property(20)
80
+ public suggestionCount: number;
81
+ /**
82
+ * Allows additional HTML attributes such as title, name, etc., and
83
+ * accepts n number of attributes in a key-value pair format.
84
+ *
85
+ * {% codeBlock src='autocomplete/htmlAttributes/index.md' %}{% endcodeBlock %}
86
+ * @default {}
87
+ * @deprecated
88
+ */
89
+ @Property({})
90
+ public htmlAttributes: { [key: string]: string; };
91
+ /**
92
+ * Accepts the external `query`
93
+ * that execute along with data processing.
94
+ *
95
+ * {% codeBlock src='autocomplete/query/index.md' %}{% endcodeBlock %}
96
+ * @default null
97
+ * @deprecated
98
+ */
99
+ @Property(null)
100
+ public query: Query;
101
+ /**
102
+ * Allows you to set [`the minimum search character length']
103
+ * (../../auto-complete/filtering#limit-the-minimum-filter-character),
104
+ * the search action will perform after typed minimum characters.
105
+ * @default 1
106
+ * @blazorType int
107
+ */
108
+ @Property(1)
109
+ public minLength: number;
110
+ /**
111
+ * Determines on which filter type, the component needs to be considered on search action.
112
+ * The available [`FilterType`](../../auto-complete/filtering/#change-the-filter-type)
113
+ * and its supported data types are
114
+ *
115
+ * <table>
116
+ * <tr>
117
+ * <td colSpan=1 rowSpan=1>
118
+ * FilterType<br/></td><td colSpan=1 rowSpan=1>
119
+ * Description<br/></td><td colSpan=1 rowSpan=1>
120
+ * Supported Types<br/></td></tr>
121
+ * <tr>
122
+ * <td colSpan=1 rowSpan=1>
123
+ * StartsWith<br/></td><td colSpan=1 rowSpan=1>
124
+ * Checks whether a value begins with the specified value.<br/></td><td colSpan=1 rowSpan=1>
125
+ * String<br/></td></tr>
126
+ * <tr>
127
+ * <td colSpan=1 rowSpan=1>
128
+ * EndsWith<br/></td><td colSpan=1 rowSpan=1>
129
+ * Checks whether a value ends with specified value.<br/><br/></td><td colSpan=1 rowSpan=1>
130
+ * <br/>String<br/></td></tr>
131
+ * <tr>
132
+ * <td colSpan=1 rowSpan=1>
133
+ * Contains<br/></td><td colSpan=1 rowSpan=1>
134
+ * Checks whether a value contains with specified value.<br/><br/></td><td colSpan=1 rowSpan=1>
135
+ * <br/>String<br/></td></tr>
136
+ * </table>
137
+ *
138
+ * {% codeBlock src="autocomplete/filter-type-api/index.ts" %}{% endcodeBlock %}
139
+ *
140
+ * {% codeBlock src="autocomplete/filter-type-api/index.html" %}{% endcodeBlock %}
141
+ *
142
+ * The default value set to `Contains`, all the suggestion items which contain typed characters to listed in the suggestion popup.
143
+ * @default 'Contains'
144
+ * @blazorOverrideType override
145
+ */
146
+ @Property('Contains')
147
+ public filterType: FilterType;
148
+ /**
149
+ * Triggers on typing a character in the component.
150
+ * @event
151
+ * @blazorProperty 'Filtering'
152
+ */
153
+ @Event()
154
+ public filtering: EmitType<FilteringEventArgs>;
155
+ /**
156
+ * Not applicable to this component.
157
+ * @default null
158
+ * @private
159
+ * @blazorType int
160
+ * @isBlazorNullableType true
161
+ * @blazorDefaultValue
162
+ * @deprecated
163
+ */
164
+ @Property(null)
165
+ public index: number;
166
+ /**
167
+ * Specifies whether to display the floating label above the input element.
168
+ * Possible values are:
169
+ * * Never: The label will never float in the input when the placeholder is available.
170
+ * * Always: The floating label will always float above the input.
171
+ * * Auto: The floating label will float above the input after focusing or entering a value in the input.
172
+ *
173
+ * {% codeBlock src="autocomplete/float-label-type-api/index.ts" %}{% endcodeBlock %}
174
+ *
175
+ * {% codeBlock src="autocomplete/float-label-type-api/index.html" %}{% endcodeBlock %}
176
+ *
177
+ * @default Syncfusion.EJ2.Inputs.FloatLabelType.Never
178
+ * @aspType Syncfusion.EJ2.Inputs.FloatLabelType
179
+ * @isEnumeration true
180
+ * @blazorType Syncfusion.Blazor.Inputs.FloatLabelType
181
+ * @deprecated
182
+ */
183
+ @Property('Never')
184
+ public floatLabelType: FloatLabelType;
185
+ /**
186
+ * Not applicable to this component.
187
+ * @default null
188
+ * @private
189
+ * @deprecated
190
+ */
191
+ @Property(null)
192
+ public valueTemplate: string;
193
+ /**
194
+ * Not applicable to this component.
195
+ * @default null
196
+ * @private
197
+ * @deprecated
198
+ */
199
+ @Property(null)
200
+ public filterBarPlaceholder: string;
201
+ /**
202
+ * Not applicable to this component.
203
+ * @default false
204
+ * @private
205
+ * @deprecated
206
+ */
207
+ @Property(false)
208
+ public allowFiltering: boolean;
209
+ /**
210
+ * Not applicable to this component.
211
+ * @default null
212
+ * @private
213
+ * @deprecated
214
+ */
215
+ @Property(null)
216
+ public text: string;
217
+ /**
218
+ * * Constructor for creating the widget
219
+ */
220
+ constructor(options?: AutoCompleteModel, element?: string | HTMLElement) {
221
+ super(options, element);
222
+ };
223
+ /**
224
+ * Initialize the event handler
225
+ * @private
226
+ */
227
+ protected preRender(): void {
228
+ super.preRender();
229
+ }
230
+
231
+ protected getLocaleName(): string {
232
+ return 'auto-complete';
233
+ };
234
+
235
+ protected getNgDirective(): string {
236
+ return 'EJS-AUTOCOMPLETE';
237
+ }
238
+
239
+ protected getQuery(query: Query): Query {
240
+ let filterQuery: Query = query ? query.clone() : this.query ? this.query.clone() : new Query();
241
+ let filterType: string = (this.queryString === '' && !isNullOrUndefined(this.value)) ? 'equal' : this.filterType;
242
+ let queryString: string = (this.queryString === '' && !isNullOrUndefined(this.value)) ? this.value as string : this.queryString;
243
+ if (this.isFiltered) {
244
+ return filterQuery;
245
+ }
246
+ if (this.queryString !== null) {
247
+ let dataType: string = <string>this.typeOfData(this.dataSource as { [key: string]: Object; }[]).typeof;
248
+ if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
249
+ filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
250
+ } else {
251
+ let mapping: string = !isNullOrUndefined(this.fields.value) ? this.fields.value : '';
252
+ filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
253
+ }
254
+ }
255
+ if (!isNullOrUndefined(this.suggestionCount)) {
256
+ // Since defualt value of suggestioncount is 20, checked the condition
257
+ if (this.suggestionCount !== 20) {
258
+ for (let queryElements: number = 0; queryElements < filterQuery.queries.length; queryElements++) {
259
+ if (filterQuery.queries[queryElements].fn === 'onTake') {
260
+ filterQuery.queries.splice(queryElements, 1);
261
+ }
262
+ }
263
+ }
264
+ filterQuery.take(this.suggestionCount);
265
+ }
266
+ return filterQuery;
267
+ }
268
+ protected searchLists(e: KeyboardEventArgs): void {
269
+ this.isTyped = true;
270
+ this.isDataFetched = this.isSelectCustom = false;
271
+ if (this.isServerBlazor) {
272
+ this.beforePopupOpen = (this.isFiltering() && !this.beforePopupOpen) ? !this.beforePopupOpen : this.beforePopupOpen;
273
+ this.queryString = this.filterInput.value;
274
+ if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
275
+ // tslint:disable-next-line
276
+ (this as any).interopAdaptor.invokeMethodAsync('OnServerFilter', this.filterInput.value);
277
+ } else {
278
+ this.hidePopup();
279
+ }
280
+ } else {
281
+ if (isNullOrUndefined(this.list)) {
282
+ super.renderList(true);
283
+ }
284
+ this.queryString = this.filterInput.value;
285
+ if (e.keyCode === 40 || e.keyCode === 38) {
286
+ this.queryString = this.queryString === '' ? null : this.queryString;
287
+ this.beforePopupOpen = true;
288
+ this.resetList(this.dataSource, this.fields);
289
+ return;
290
+ }
291
+ this.isSelected = false;
292
+ this.activeIndex = null;
293
+ let eventArgs: { [key: string]: Object } = {
294
+ preventDefaultAction: false,
295
+ text: this.filterInput.value,
296
+ updateData: (
297
+ dataSource: { [key: string]: Object }[] | DataManager | string[] | number[], query?: Query,
298
+ fields?: FieldSettingsModel) => {
299
+ if (eventArgs.cancel) { return; }
300
+ this.isFiltered = true;
301
+ this.filterAction(dataSource, query, fields);
302
+ },
303
+ cancel: false
304
+ };
305
+ this.trigger('filtering', eventArgs, (eventArgs: FilteringEventArgs) => {
306
+ if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
307
+ this.filterAction(this.dataSource, null, this.fields);
308
+ }
309
+ });
310
+ }
311
+ }
312
+
313
+ /**
314
+ * To filter the data from given data source by using query
315
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
316
+ * @param {Query} query - Specify the query to filter the data.
317
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
318
+ * @return {void}.
319
+ * @deprecated
320
+ */
321
+ public filter(
322
+ dataSource: { [key: string]: Object }[] | DataManager | string[] | number[] | boolean[],
323
+ query?: Query, fields?: FieldSettingsModel): void {
324
+ this.isFiltered = true;
325
+ this.filterAction(dataSource, query, fields);
326
+ }
327
+
328
+ private filterAction(
329
+ dataSource: { [key: string]: Object }[] | DataManager | string[] | number[] | boolean[],
330
+ query?: Query, fields?: FieldSettingsModel): void {
331
+ this.beforePopupOpen = true;
332
+ if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
333
+ this.resetList(dataSource, fields, query);
334
+ } else {
335
+ this.hidePopup();
336
+ }
337
+ }
338
+
339
+ protected clearAll(e?: MouseEvent, property?: AutoCompleteModel): void {
340
+ if (isNullOrUndefined(property) || (!isNullOrUndefined(property) && isNullOrUndefined(property.dataSource))) {
341
+ super.clearAll(e);
342
+ }
343
+ if (this.beforePopupOpen) {
344
+ this.hidePopup();
345
+ }
346
+ }
347
+
348
+ protected onActionComplete(ulElement: HTMLElement, list: { [key: string]: Object }[], e?: Object, isUpdated?: boolean): void {
349
+ this.fixedHeaderElement = null;
350
+ super.onActionComplete(ulElement, list, e);
351
+ let item: Element = this.list.querySelector('.' + dropDownListClasses.li);
352
+ if (!isNullOrUndefined(item)) {
353
+ removeClass([item], dropDownListClasses.focus);
354
+ }
355
+ this.postBackAction();
356
+ }
357
+
358
+ private postBackAction(): void {
359
+ if (this.autofill && !isNullOrUndefined(this.liCollections[0])) {
360
+ let items: HTMLElement[] = [this.liCollections[0]];
361
+ let searchItem: { [key: string]: number | Element } = Search(this.inputElement.value, items, 'StartsWith', this.ignoreCase);
362
+ if (!isNullOrUndefined(searchItem.item)) {
363
+ super.setAutoFill(this.liCollections[0], true);
364
+ }
365
+ }
366
+ }
367
+
368
+ protected setSelection(li: Element, e: MouseEvent | KeyboardEventArgs | TouchEvent): void {
369
+ if (!this.isValidLI(li)) {
370
+ return;
371
+ }
372
+ if (!isNullOrUndefined(e) && e.type === 'keydown' && (e as KeyboardEventArgs).action !== 'enter'
373
+ && (e as KeyboardEventArgs).action !== 'tab' && this.isValidLI(li)) {
374
+ let value: string | number | boolean = this.getFormattedValue(li.getAttribute('data-value'));
375
+ this.activeIndex = this.getIndexByValue(value);
376
+ if (this.isServerBlazor) { this.removeHover(); }
377
+ this.setHoverList(li);
378
+ this.selectedLI = <HTMLElement>li;
379
+ this.setScrollPosition(e as KeyboardEventArgs);
380
+ if (this.autofill) {
381
+ this.preventAutoFill = false;
382
+ super.setAutoFill(li);
383
+ }
384
+ attributes(this.inputElement, { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
385
+ } else {
386
+ super.setSelection(li, e);
387
+ }
388
+ }
389
+
390
+ protected listOption(dataSource: { [key: string]: Object }[], fieldsSettings: FieldSettingsModel): FieldSettingsModel {
391
+ let fields: { [key: string]: Object } = <{ [key: string]: Object }>super.listOption(dataSource, fieldsSettings);
392
+ if (isNullOrUndefined(fields.itemCreated)) {
393
+ fields.itemCreated = (e: { [key: string]: HTMLElement }) => {
394
+ if (this.highlight) {
395
+ if (this.element.tagName === this.getNgDirective() && this.itemTemplate) {
396
+ setTimeout((): void => { highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType); }, 0);
397
+ } else {
398
+ highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
399
+ }
400
+ }
401
+ };
402
+ } else {
403
+ let itemCreated: Function = <Function>fields.itemCreated;
404
+ fields.itemCreated = (e: { [key: string]: HTMLElement }) => {
405
+ if (this.highlight) {
406
+ highlightSearch(e.item, this.queryString, this.ignoreCase, this.filterType);
407
+ }
408
+ itemCreated.apply(this, [e]);
409
+ };
410
+ }
411
+ return fields;
412
+ };
413
+
414
+ protected isFiltering(): boolean {
415
+ return true;
416
+ }
417
+
418
+ protected renderPopup(): void {
419
+ this.list.scrollTop = 0;
420
+ super.renderPopup();
421
+ }
422
+
423
+ protected isEditTextBox(): boolean {
424
+ return true && this.inputElement.value.trim() !== '';
425
+ }
426
+
427
+ protected isPopupButton(): boolean {
428
+ return this.showPopupButton;
429
+ }
430
+
431
+ protected isSelectFocusItem(element: Element): boolean {
432
+ return false;
433
+ }
434
+ /**
435
+ * Search the entered text and show it in the suggestion list if available.
436
+ * @returns void.
437
+ * @deprecated
438
+ */
439
+ public showPopup(): void {
440
+ if (!this.enabled) {
441
+ return;
442
+ }
443
+ if (this.beforePopupOpen && !this.isServerBlazor) {
444
+ this.refreshPopup();
445
+ return;
446
+ }
447
+ this.beforePopupOpen = true;
448
+ this.preventAutoFill = true;
449
+ if (isNullOrUndefined(this.list) || this.isServerBlazor) {
450
+ this.renderList();
451
+ } else {
452
+ this.resetList(this.dataSource, this.fields);
453
+ }
454
+ }
455
+ /**
456
+ * Hides the popup if it is in open state.
457
+ * @returns void.
458
+ */
459
+ public hidePopup(): void {
460
+ this.DropDownBaseresetBlazorTemplates(true, false, false, false);
461
+ super.hidePopup();
462
+ this.activeIndex = -1;
463
+ }
464
+ /**
465
+ * Dynamically change the value of properties.
466
+ * @private
467
+ */
468
+ public onPropertyChanged(newProp: AutoCompleteModel, oldProp: AutoCompleteModel): void {
469
+ if (this.getModuleName() === 'autocomplete') {
470
+ this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp as { [key: string]: string; });
471
+ }
472
+ for (let prop of Object.keys(newProp)) {
473
+ switch (prop) {
474
+ case 'showPopupButton':
475
+ if (this.showPopupButton) {
476
+ if (!this.isServerBlazor) {
477
+ let button: HTMLElement = Input.appendSpan(
478
+ dropDownListClasses.icon,
479
+ this.inputWrapper.container,
480
+ this.createElement);
481
+ this.inputWrapper.buttons[0] = button;
482
+ } else if (this.inputWrapper && this.inputWrapper.container) {
483
+ let button: HTMLElement = this.inputWrapper.container.querySelector('.e-input-group-icon.e-ddl-icon');
484
+ this.inputWrapper.buttons[0] = button;
485
+ }
486
+ if (this.inputWrapper && this.inputWrapper.buttons && this.inputWrapper.buttons[0]) {
487
+ EventHandler.add(this.inputWrapper.buttons[0], 'click', this.dropDownClick, this);
488
+ }
489
+ } else if (!this.isServerBlazor) {
490
+ detach(this.inputWrapper.buttons[0]);
491
+ this.inputWrapper.buttons[0] = null;
492
+ }
493
+ break;
494
+ default:
495
+ let atcProps: { [key: string]: Object };
496
+ atcProps = this.getPropObject(prop, <{ [key: string]: string; }>newProp, <{ [key: string]: string; }>oldProp);
497
+ super.onPropertyChanged(atcProps.newProperty, atcProps.oldProperty);
498
+ break;
499
+ }
500
+ }
501
+ }
502
+ protected renderHightSearch(): void {
503
+ if (this.highlight) {
504
+ for (let i: number = 0; i < this.liCollections.length; i++) {
505
+ let isHighlight: HTMLElement = this.ulElement.querySelector('.e-active');
506
+ if (!isHighlight) {
507
+ revertHighlightSearch(this.liCollections[i]);
508
+ highlightSearch(this.liCollections[i], this.queryString, this.ignoreCase, this.filterType, this.isServerBlazor);
509
+ }
510
+ }
511
+ }
512
+ }
513
+ /**
514
+ * Return the module name of this component.
515
+ * @private
516
+ */
517
+ public getModuleName(): string {
518
+ return 'autocomplete';
519
+ }
520
+ /**
521
+ * To initialize the control rendering
522
+ * @private
523
+ */
524
+ public render(): void {
525
+ super.render();
526
+ };
527
+ }