@syncfusion/ej2-dropdowns 23.1.38 → 23.1.40-85814

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 (306) hide show
  1. package/CHANGELOG.md +2042 -2034
  2. package/{README.md → ReadMe.md} +217 -217
  3. package/dist/ej2-dropdowns.umd.min.js +1 -10
  4. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-dropdowns.es2015.js +60 -57
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +202 -199
  8. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  9. package/dist/global/ej2-dropdowns.min.js +1 -10
  10. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  11. package/dist/global/index.d.ts +0 -9
  12. package/dist/ts/auto-complete/auto-complete.ts +615 -0
  13. package/dist/ts/combo-box/combo-box.ts +1028 -0
  14. package/dist/ts/common/highlight-search.ts +57 -0
  15. package/dist/ts/common/incremental-search.ts +131 -0
  16. package/dist/ts/common/interface.ts +72 -0
  17. package/dist/ts/common/virtual-scroll.ts +354 -0
  18. package/dist/ts/drop-down-base/drop-down-base.ts +1838 -0
  19. package/dist/ts/drop-down-list/drop-down-list.ts +3889 -0
  20. package/dist/ts/drop-down-tree/drop-down-tree.ts +3750 -0
  21. package/dist/ts/list-box/list-box.ts +2736 -0
  22. package/dist/ts/mention/mention.ts +1828 -0
  23. package/dist/ts/multi-select/checkbox-selection.ts +547 -0
  24. package/dist/ts/multi-select/float-label.ts +176 -0
  25. package/dist/ts/multi-select/interface.ts +70 -0
  26. package/dist/ts/multi-select/multi-select.ts +4874 -0
  27. package/helpers/e2e/autocomplete.js +13 -13
  28. package/helpers/e2e/combobox.js +13 -13
  29. package/helpers/e2e/dropdownlist.js +13 -13
  30. package/helpers/e2e/index.js +3 -3
  31. package/helpers/e2e/listboxHelper.js +13 -13
  32. package/helpers/e2e/multiselect.js +13 -13
  33. package/license +2 -2
  34. package/package.json +79 -79
  35. package/src/auto-complete/auto-complete-model.d.ts +188 -188
  36. package/src/auto-complete/auto-complete.d.ts +12 -12
  37. package/src/auto-complete/auto-complete.js +21 -21
  38. package/src/combo-box/combo-box-model.d.ts +224 -224
  39. package/src/combo-box/combo-box.d.ts +27 -27
  40. package/src/combo-box/combo-box.js +29 -29
  41. package/src/common/virtual-scroll.js +46 -46
  42. package/src/drop-down-base/drop-down-base-model.d.ts +200 -200
  43. package/src/drop-down-base/drop-down-base.d.ts +15 -15
  44. package/src/drop-down-base/drop-down-base.js +20 -20
  45. package/src/drop-down-list/drop-down-list-model.d.ts +202 -202
  46. package/src/drop-down-list/drop-down-list.d.ts +4 -4
  47. package/src/drop-down-list/drop-down-list.js +24 -21
  48. package/src/drop-down-tree/drop-down-tree-model.d.ts +468 -468
  49. package/src/drop-down-tree/drop-down-tree.js +19 -19
  50. package/src/list-box/list-box-model.d.ts +193 -193
  51. package/src/list-box/list-box.d.ts +2 -2
  52. package/src/list-box/list-box.js +19 -19
  53. package/src/mention/mention-model.d.ts +261 -261
  54. package/src/mention/mention.js +19 -19
  55. package/src/multi-select/multi-select-model.d.ts +512 -512
  56. package/src/multi-select/multi-select.js +19 -19
  57. package/styles/auto-complete/_all.scss +1 -1
  58. package/styles/auto-complete/_bootstrap-dark-definition.scss +3 -3
  59. package/styles/auto-complete/_bootstrap-definition.scss +2 -2
  60. package/styles/auto-complete/_bootstrap4-definition.scss +11 -11
  61. package/styles/auto-complete/_bootstrap5-definition.scss +2 -2
  62. package/styles/auto-complete/_fabric-dark-definition.scss +2 -2
  63. package/styles/auto-complete/_fabric-definition.scss +2 -2
  64. package/styles/auto-complete/_fluent-definition.scss +2 -2
  65. package/styles/auto-complete/_fusionnew-definition.scss +2 -2
  66. package/styles/auto-complete/_highcontrast-definition.scss +2 -2
  67. package/styles/auto-complete/_highcontrast-light-definition.scss +2 -2
  68. package/styles/auto-complete/_material-dark-definition.scss +2 -2
  69. package/styles/auto-complete/_material-definition.scss +2 -2
  70. package/styles/auto-complete/_material3-definition.scss +2 -2
  71. package/styles/auto-complete/_tailwind-definition.scss +2 -2
  72. package/styles/auto-complete/bootstrap4.css +13 -2
  73. package/styles/auto-complete/material3-dark.scss +1 -1
  74. package/styles/auto-complete/material3.scss +1 -1
  75. package/styles/bootstrap-dark.css +12 -1
  76. package/styles/bootstrap.css +12 -1
  77. package/styles/bootstrap4.css +44 -3
  78. package/styles/bootstrap5-dark.css +12 -1
  79. package/styles/bootstrap5.css +12 -1
  80. package/styles/combo-box/_all.scss +1 -1
  81. package/styles/combo-box/_bootstrap-dark-definition.scss +2 -2
  82. package/styles/combo-box/_bootstrap-definition.scss +2 -2
  83. package/styles/combo-box/_bootstrap4-definition.scss +11 -11
  84. package/styles/combo-box/_bootstrap5-definition.scss +2 -2
  85. package/styles/combo-box/_fabric-dark-definition.scss +2 -2
  86. package/styles/combo-box/_fabric-definition.scss +2 -2
  87. package/styles/combo-box/_fluent-definition.scss +2 -2
  88. package/styles/combo-box/_fusionnew-definition.scss +2 -2
  89. package/styles/combo-box/_highcontrast-definition.scss +2 -2
  90. package/styles/combo-box/_highcontrast-light-definition.scss +3 -3
  91. package/styles/combo-box/_material-dark-definition.scss +2 -2
  92. package/styles/combo-box/_material-definition.scss +2 -2
  93. package/styles/combo-box/_material3-definition.scss +2 -2
  94. package/styles/combo-box/_tailwind-definition.scss +2 -2
  95. package/styles/combo-box/bootstrap4.css +13 -2
  96. package/styles/combo-box/material3-dark.scss +1 -1
  97. package/styles/combo-box/material3.scss +1 -1
  98. package/styles/drop-down-base/_all.scss +2 -2
  99. package/styles/drop-down-base/_bootstrap-dark-definition.scss +83 -83
  100. package/styles/drop-down-base/_bootstrap-definition.scss +83 -83
  101. package/styles/drop-down-base/_bootstrap4-definition.scss +90 -90
  102. package/styles/drop-down-base/_bootstrap5-definition.scss +117 -117
  103. package/styles/drop-down-base/_definition.scss +23 -23
  104. package/styles/drop-down-base/_fabric-dark-definition.scss +86 -86
  105. package/styles/drop-down-base/_fabric-definition.scss +84 -84
  106. package/styles/drop-down-base/_fluent-definition.scss +121 -121
  107. package/styles/drop-down-base/_fusionnew-definition.scss +117 -117
  108. package/styles/drop-down-base/_highcontrast-definition.scss +105 -105
  109. package/styles/drop-down-base/_highcontrast-light-definition.scss +105 -105
  110. package/styles/drop-down-base/_layout.scss +195 -195
  111. package/styles/drop-down-base/_material-dark-definition.scss +86 -86
  112. package/styles/drop-down-base/_material-definition.scss +85 -85
  113. package/styles/drop-down-base/_material3-definition.scss +87 -87
  114. package/styles/drop-down-base/_tailwind-definition.scss +129 -129
  115. package/styles/drop-down-base/_theme.scss +391 -391
  116. package/styles/drop-down-base/material3-dark.scss +1 -1
  117. package/styles/drop-down-base/material3.scss +1 -1
  118. package/styles/drop-down-list/_all.scss +3 -3
  119. package/styles/drop-down-list/_bootstrap-dark-definition.scss +157 -157
  120. package/styles/drop-down-list/_bootstrap-definition.scss +156 -156
  121. package/styles/drop-down-list/_bootstrap4-definition.scss +202 -191
  122. package/styles/drop-down-list/_bootstrap5-definition.scss +201 -201
  123. package/styles/drop-down-list/_fabric-dark-definition.scss +128 -128
  124. package/styles/drop-down-list/_fabric-definition.scss +124 -124
  125. package/styles/drop-down-list/_fluent-definition.scss +185 -185
  126. package/styles/drop-down-list/_fusionnew-definition.scss +201 -201
  127. package/styles/drop-down-list/_highcontrast-definition.scss +142 -142
  128. package/styles/drop-down-list/_highcontrast-light-definition.scss +144 -144
  129. package/styles/drop-down-list/_layout.scss +310 -310
  130. package/styles/drop-down-list/_material-dark-definition.scss +143 -143
  131. package/styles/drop-down-list/_material-definition.scss +167 -167
  132. package/styles/drop-down-list/_material3-definition.scss +180 -180
  133. package/styles/drop-down-list/_tailwind-definition.scss +134 -134
  134. package/styles/drop-down-list/_theme.scss +10 -10
  135. package/styles/drop-down-list/bootstrap4.css +13 -2
  136. package/styles/drop-down-list/icons/_bootstrap-dark.scss +14 -14
  137. package/styles/drop-down-list/icons/_bootstrap.scss +14 -14
  138. package/styles/drop-down-list/icons/_bootstrap4.scss +14 -14
  139. package/styles/drop-down-list/icons/_bootstrap5.scss +14 -14
  140. package/styles/drop-down-list/icons/_fabric-dark.scss +14 -14
  141. package/styles/drop-down-list/icons/_fabric.scss +14 -14
  142. package/styles/drop-down-list/icons/_fluent.scss +14 -14
  143. package/styles/drop-down-list/icons/_fusionnew.scss +14 -14
  144. package/styles/drop-down-list/icons/_highcontrast-light.scss +14 -14
  145. package/styles/drop-down-list/icons/_highcontrast.scss +14 -14
  146. package/styles/drop-down-list/icons/_material-dark.scss +14 -14
  147. package/styles/drop-down-list/icons/_material.scss +14 -14
  148. package/styles/drop-down-list/icons/_material3.scss +14 -14
  149. package/styles/drop-down-list/icons/_tailwind.scss +14 -14
  150. package/styles/drop-down-list/material3-dark.scss +1 -1
  151. package/styles/drop-down-list/material3.scss +1 -1
  152. package/styles/drop-down-tree/_all.scss +2 -2
  153. package/styles/drop-down-tree/_bootstrap-dark-definition.scss +71 -71
  154. package/styles/drop-down-tree/_bootstrap-definition.scss +70 -70
  155. package/styles/drop-down-tree/_bootstrap4-definition.scss +71 -71
  156. package/styles/drop-down-tree/_bootstrap5-definition.scss +59 -59
  157. package/styles/drop-down-tree/_fabric-dark-definition.scss +71 -71
  158. package/styles/drop-down-tree/_fabric-definition.scss +71 -71
  159. package/styles/drop-down-tree/_fluent-definition.scss +65 -65
  160. package/styles/drop-down-tree/_fusionnew-definition.scss +59 -59
  161. package/styles/drop-down-tree/_highcontrast-definition.scss +71 -71
  162. package/styles/drop-down-tree/_highcontrast-light-definition.scss +71 -71
  163. package/styles/drop-down-tree/_layout.scss +1418 -1412
  164. package/styles/drop-down-tree/_material-dark-definition.scss +72 -72
  165. package/styles/drop-down-tree/_material-definition.scss +72 -72
  166. package/styles/drop-down-tree/_material3-definition.scss +76 -76
  167. package/styles/drop-down-tree/_tailwind-definition.scss +61 -61
  168. package/styles/drop-down-tree/_theme.scss +132 -132
  169. package/styles/drop-down-tree/fluent-dark.css +2 -0
  170. package/styles/drop-down-tree/fluent.css +2 -0
  171. package/styles/drop-down-tree/icons/_bootstrap-dark.scss +11 -11
  172. package/styles/drop-down-tree/icons/_bootstrap.scss +11 -11
  173. package/styles/drop-down-tree/icons/_bootstrap4.scss +11 -11
  174. package/styles/drop-down-tree/icons/_bootstrap5.scss +11 -11
  175. package/styles/drop-down-tree/icons/_fabric-dark.scss +11 -11
  176. package/styles/drop-down-tree/icons/_fabric.scss +11 -11
  177. package/styles/drop-down-tree/icons/_fluent.scss +11 -11
  178. package/styles/drop-down-tree/icons/_fusionnew.scss +11 -11
  179. package/styles/drop-down-tree/icons/_highcontrast-light.scss +11 -11
  180. package/styles/drop-down-tree/icons/_highcontrast.scss +11 -11
  181. package/styles/drop-down-tree/icons/_material-dark.scss +11 -11
  182. package/styles/drop-down-tree/icons/_material.scss +11 -11
  183. package/styles/drop-down-tree/icons/_material3.scss +11 -11
  184. package/styles/drop-down-tree/icons/_tailwind-dark.scss +11 -11
  185. package/styles/drop-down-tree/icons/_tailwind.scss +11 -11
  186. package/styles/drop-down-tree/material3-dark.scss +1 -1
  187. package/styles/drop-down-tree/material3.scss +1 -1
  188. package/styles/fabric-dark.css +13 -2
  189. package/styles/fabric.css +13 -2
  190. package/styles/fluent-dark.css +14 -1
  191. package/styles/fluent.css +14 -1
  192. package/styles/highcontrast-light.css +12 -1
  193. package/styles/highcontrast.css +12 -1
  194. package/styles/list-box/_all.scss +2 -2
  195. package/styles/list-box/_bootstrap-dark-definition.scss +126 -126
  196. package/styles/list-box/_bootstrap-definition.scss +119 -119
  197. package/styles/list-box/_bootstrap4-definition.scss +124 -124
  198. package/styles/list-box/_bootstrap5-definition.scss +120 -120
  199. package/styles/list-box/_fabric-dark-definition.scss +126 -126
  200. package/styles/list-box/_fabric-definition.scss +119 -119
  201. package/styles/list-box/_fluent-definition.scss +120 -120
  202. package/styles/list-box/_fusionnew-definition.scss +111 -111
  203. package/styles/list-box/_highcontrast-definition.scss +119 -119
  204. package/styles/list-box/_highcontrast-light-definition.scss +126 -126
  205. package/styles/list-box/_layout.scss +542 -542
  206. package/styles/list-box/_material-dark-definition.scss +126 -126
  207. package/styles/list-box/_material-definition.scss +119 -119
  208. package/styles/list-box/_material3-definition.scss +119 -119
  209. package/styles/list-box/_tailwind-definition.scss +119 -119
  210. package/styles/list-box/_theme.scss +382 -382
  211. package/styles/list-box/icons/_bootstrap-dark.scss +25 -25
  212. package/styles/list-box/icons/_bootstrap.scss +25 -25
  213. package/styles/list-box/icons/_bootstrap4.scss +25 -25
  214. package/styles/list-box/icons/_bootstrap5.scss +25 -25
  215. package/styles/list-box/icons/_fabric-dark.scss +25 -25
  216. package/styles/list-box/icons/_fabric.scss +25 -25
  217. package/styles/list-box/icons/_fluent.scss +25 -25
  218. package/styles/list-box/icons/_fusionnew.scss +25 -25
  219. package/styles/list-box/icons/_highcontrast-light.scss +25 -25
  220. package/styles/list-box/icons/_highcontrast.scss +25 -25
  221. package/styles/list-box/icons/_material-dark.scss +25 -25
  222. package/styles/list-box/icons/_material.scss +25 -25
  223. package/styles/list-box/icons/_material3.scss +25 -25
  224. package/styles/list-box/icons/_tailwind-dark.scss +25 -25
  225. package/styles/list-box/icons/_tailwind.scss +25 -25
  226. package/styles/list-box/material3-dark.scss +1 -1
  227. package/styles/list-box/material3.scss +1 -1
  228. package/styles/material-dark.css +12 -1
  229. package/styles/material.css +12 -1
  230. package/styles/material3-dark.css +10 -0
  231. package/styles/material3-dark.scss +1 -1
  232. package/styles/material3.css +10 -0
  233. package/styles/material3.scss +1 -1
  234. package/styles/mention/_all.scss +1 -1
  235. package/styles/mention/_bootstrap-dark-definition.scss +3 -3
  236. package/styles/mention/_bootstrap-definition.scss +3 -3
  237. package/styles/mention/_bootstrap4-definition.scss +3 -3
  238. package/styles/mention/_bootstrap5-definition.scss +1 -1
  239. package/styles/mention/_fabric-dark-definition.scss +2 -2
  240. package/styles/mention/_fabric-definition.scss +3 -3
  241. package/styles/mention/_fluent-definition.scss +1 -1
  242. package/styles/mention/_fusionnew-definition.scss +1 -1
  243. package/styles/mention/_highcontrast-definition.scss +3 -3
  244. package/styles/mention/_highcontrast-light-definition.scss +3 -3
  245. package/styles/mention/_layout.scss +6 -6
  246. package/styles/mention/_material-dark-definition.scss +3 -3
  247. package/styles/mention/_material-definition.scss +3 -3
  248. package/styles/mention/_material3-definition.scss +1 -1
  249. package/styles/mention/_tailwind-definition.scss +1 -1
  250. package/styles/mention/material3-dark.scss +1 -1
  251. package/styles/mention/material3.scss +1 -1
  252. package/styles/multi-select/_all.scss +2 -2
  253. package/styles/multi-select/_bootstrap-dark-definition.scss +198 -196
  254. package/styles/multi-select/_bootstrap-definition.scss +192 -190
  255. package/styles/multi-select/_bootstrap4-definition.scss +278 -257
  256. package/styles/multi-select/_bootstrap5-definition.scss +229 -227
  257. package/styles/multi-select/_fabric-dark-definition.scss +187 -185
  258. package/styles/multi-select/_fabric-definition.scss +183 -181
  259. package/styles/multi-select/_fluent-definition.scss +240 -238
  260. package/styles/multi-select/_fusionnew-definition.scss +227 -227
  261. package/styles/multi-select/_highcontrast-definition.scss +298 -296
  262. package/styles/multi-select/_highcontrast-light-definition.scss +297 -295
  263. package/styles/multi-select/_layout.scss +2199 -2188
  264. package/styles/multi-select/_material-dark-definition.scss +230 -228
  265. package/styles/multi-select/_material-definition.scss +223 -221
  266. package/styles/multi-select/_material3-definition.scss +246 -246
  267. package/styles/multi-select/_tailwind-definition.scss +234 -232
  268. package/styles/multi-select/_theme.scss +586 -586
  269. package/styles/multi-select/bootstrap-dark.css +12 -1
  270. package/styles/multi-select/bootstrap.css +12 -1
  271. package/styles/multi-select/bootstrap4.css +31 -1
  272. package/styles/multi-select/bootstrap5-dark.css +12 -1
  273. package/styles/multi-select/bootstrap5.css +12 -1
  274. package/styles/multi-select/fabric-dark.css +13 -2
  275. package/styles/multi-select/fabric.css +13 -2
  276. package/styles/multi-select/fluent-dark.css +12 -1
  277. package/styles/multi-select/fluent.css +12 -1
  278. package/styles/multi-select/highcontrast-light.css +12 -1
  279. package/styles/multi-select/highcontrast.css +12 -1
  280. package/styles/multi-select/icons/_bootstrap-dark.scss +26 -26
  281. package/styles/multi-select/icons/_bootstrap.scss +26 -26
  282. package/styles/multi-select/icons/_bootstrap4.scss +37 -37
  283. package/styles/multi-select/icons/_bootstrap5.scss +26 -26
  284. package/styles/multi-select/icons/_fabric-dark.scss +26 -26
  285. package/styles/multi-select/icons/_fabric.scss +26 -26
  286. package/styles/multi-select/icons/_fluent.scss +55 -55
  287. package/styles/multi-select/icons/_fusionnew.scss +26 -26
  288. package/styles/multi-select/icons/_highcontrast-light.scss +26 -26
  289. package/styles/multi-select/icons/_highcontrast.scss +26 -26
  290. package/styles/multi-select/icons/_material-dark.scss +693 -693
  291. package/styles/multi-select/icons/_material.scss +693 -693
  292. package/styles/multi-select/icons/_material3.scss +692 -692
  293. package/styles/multi-select/icons/_tailwind.scss +26 -26
  294. package/styles/multi-select/material-dark.css +12 -1
  295. package/styles/multi-select/material.css +12 -1
  296. package/styles/multi-select/material3-dark.css +10 -0
  297. package/styles/multi-select/material3-dark.scss +1 -1
  298. package/styles/multi-select/material3.css +10 -0
  299. package/styles/multi-select/material3.scss +1 -1
  300. package/styles/multi-select/tailwind-dark.css +12 -1
  301. package/styles/multi-select/tailwind.css +12 -1
  302. package/styles/tailwind-dark.css +12 -1
  303. package/styles/tailwind.css +12 -1
  304. package/.eslintrc.json +0 -260
  305. package/dist/ej2-dropdowns.min.js +0 -10
  306. package/tslint.json +0 -111
@@ -0,0 +1,1028 @@
1
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
2
+ /// <reference path='../drop-down-list/drop-down-list-model.d.ts'/>
3
+ import { EventHandler, Property, Event, EmitType, addClass, Browser, KeyboardEventArgs, removeClass, detach } from '@syncfusion/ej2-base';
4
+ import { isNullOrUndefined, NotifyPropertyChanges, getValue, setValue } from '@syncfusion/ej2-base';
5
+ import { DropDownList, dropDownListClasses } from '../drop-down-list/drop-down-list';
6
+ import { FilteringEventArgs } from '../drop-down-base/drop-down-base';
7
+ import { FieldSettingsModel } from '../drop-down-base/drop-down-base-model';
8
+ import { ComboBoxModel } from '../combo-box/combo-box-model';
9
+ import { Search } from '../common/incremental-search';
10
+ import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
11
+ import { Input, InputObject, FloatLabelType } from '@syncfusion/ej2-inputs';
12
+ import { DataManager, Query } from '@syncfusion/ej2-data';
13
+
14
+ const SPINNER_CLASS: string = 'e-atc-spinner-icon';
15
+
16
+ dropDownListClasses.root = 'e-combobox';
17
+ const inputObject: InputObject = {
18
+ container: null,
19
+ buttons: []
20
+ };
21
+ /**
22
+ * The ComboBox component allows the user to type a value or choose an option from the list of predefined options.
23
+ * ```html
24
+ * <select id="list">
25
+ * <option value='1'>Badminton</option>
26
+ * <option value='2'>Basketball</option>
27
+ * <option value='3'>Cricket</option>
28
+ * <option value='4'>Football</option>
29
+ * <option value='5'>Tennis</option>
30
+ * </select>
31
+ * ```
32
+ * ```typescript
33
+ * let games:ComboBox = new ComboBox();
34
+ * games.appendTo("#list");
35
+ * ```
36
+ */
37
+ @NotifyPropertyChanges
38
+ export class ComboBox extends DropDownList {
39
+ /**
40
+ * Specifies whether suggest a first matched item in input when searching. No action happens when no matches found.
41
+ *
42
+ * @default false
43
+ */
44
+ @Property(false)
45
+ public autofill: boolean;
46
+ /**
47
+ * Specifies whether the component allows user defined value which does not exist in data source.
48
+ *
49
+ * @default true
50
+ */
51
+ @Property(true)
52
+ public allowCustom: boolean;
53
+ /**
54
+ * Allows additional HTML attributes such as title, name, etc., and
55
+ * accepts n number of attributes in a key-value pair format.
56
+ *
57
+ * {% codeBlock src='combobox/htmlAttributes/index.md' %}{% endcodeBlock %}
58
+ *
59
+ * @default {}
60
+ * @deprecated
61
+ */
62
+ @Property({})
63
+ public htmlAttributes: { [key: string]: string };
64
+ /**
65
+ * When allowFiltering is set to true, show the filter bar (search box) of the component.
66
+ * The filter action retrieves matched items through the `filtering` event based on
67
+ * the characters typed in the search TextBox.
68
+ * If no match is found, the value of the `noRecordsTemplate` property will be displayed.
69
+ *
70
+ * {% codeBlock src="combobox/allow-filtering-api/index.ts" %}{% endcodeBlock %}
71
+ *
72
+ * {% codeBlock src="combobox/allow-filtering-api/index.html" %}{% endcodeBlock %}
73
+ *
74
+ * @default false
75
+ * @deprecated
76
+ */
77
+ @Property(false)
78
+ public allowFiltering: boolean;
79
+ /**
80
+ * Accepts the external `Query`
81
+ * that execute along with [`data processing`](../../combo-box/data-binding).
82
+ *
83
+ * {% codeBlock src='combobox/query/index.md' %}{% endcodeBlock %}
84
+ *
85
+ * @default null
86
+ * @deprecated
87
+ */
88
+ @Property(null)
89
+ public query: Query;
90
+ /**
91
+ * Gets or sets the index of the selected item in the component.
92
+ *
93
+ * {% codeBlock src="combobox/index-api/index.ts" %}{% endcodeBlock %}
94
+ *
95
+ * {% codeBlock src="combobox/index-api/index.html" %}{% endcodeBlock %}
96
+ *
97
+ * @default null
98
+ * @deprecated
99
+ */
100
+ @Property(null)
101
+ public index: number;
102
+ /**
103
+ * Specifies whether to show or hide the clear button.
104
+ * When the clear button is clicked, `value`, `text`, and `index` properties are reset to null.
105
+ *
106
+ * @default true
107
+ */
108
+ @Property(true)
109
+ public showClearButton: boolean;
110
+ /**
111
+ * Enable or disable rendering component in right to left direction.
112
+ *
113
+ * @default false
114
+ * @deprecated
115
+ */
116
+ @Property(false)
117
+ public enableRtl: boolean;
118
+ /**
119
+ * Triggers on set a
120
+ * [`custom value`](../../combo-box/getting-started#custom-values) to this component.
121
+ *
122
+ * @event customValueSpecifier
123
+ */
124
+ @Event()
125
+ public customValueSpecifier: EmitType<CustomValueSpecifierEventArgs>;
126
+
127
+ /**
128
+ * Triggers on typing a character in the component.
129
+ * > For more details about the filtering refer to [`Filtering`](../../combo-box/filtering) documentation.
130
+ *
131
+ * @event filtering
132
+ */
133
+ @Event()
134
+ public filtering: EmitType<FilteringEventArgs>;
135
+
136
+ /**
137
+ * Not applicable to this component.
138
+ *
139
+ * @default null
140
+ * @aspType string
141
+ * @private
142
+ */
143
+ @Property(null)
144
+ public valueTemplate: string | Function;
145
+ /**
146
+ * Specifies whether to display the floating label above the input element.
147
+ * Possible values are:
148
+ * * Never: The label will never float in the input when the placeholder is available.
149
+ * * Always: The floating label will always float above the input.
150
+ * * Auto: The floating label will float above the input after focusing or entering a value in the input.
151
+ *
152
+ * {% codeBlock src="combobox/float-label-type-api/index.ts" %}{% endcodeBlock %}
153
+ *
154
+ * {% codeBlock src="combobox/float-label-type-api/index.html" %}{% endcodeBlock %}
155
+ *
156
+ * @default Syncfusion.EJ2.Inputs.FloatLabelType.Never
157
+ * @aspType Syncfusion.EJ2.Inputs.FloatLabelType
158
+ * @isEnumeration true
159
+ * @deprecated
160
+ */
161
+ @Property('Never')
162
+ public floatLabelType: FloatLabelType;
163
+ /**
164
+ * Not applicable to this component.
165
+ *
166
+ * @default null
167
+ * @private
168
+ * @deprecated
169
+ */
170
+ @Property(null)
171
+ public filterBarPlaceholder: string;
172
+ /**
173
+ * Sets CSS classes to the root element of the component that allows customization of appearance.
174
+ *
175
+ * @default null
176
+ * @deprecated
177
+ */
178
+ @Property(null)
179
+ public cssClass: string;
180
+ /**
181
+ * Accepts the template design and assigns it to the header container of the popup list.
182
+ * > For more details about the available template options refer to [`Template`](../../drop-down-list/templates) documentation.
183
+ *
184
+ * @default null
185
+ * @aspType string
186
+ * @deprecated
187
+ */
188
+ @Property(null)
189
+ public headerTemplate: string | Function;
190
+ /**
191
+ * Accepts the template design and assigns it to the footer container of the popup list.
192
+ * > For more details about the available template options refer to [`Template`](../../drop-down-list/templates) documentation.
193
+ *
194
+ * @default null
195
+ * @aspType string
196
+ * @deprecated
197
+ */
198
+ @Property(null)
199
+ public footerTemplate: string | Function;
200
+ /**
201
+ * Specifies a short hint that describes the expected value of the DropDownList component.
202
+ *
203
+ * @default null
204
+ * @deprecated
205
+ */
206
+ @Property(null)
207
+ public placeholder: string;
208
+ /**
209
+ * Specifies the width of the component. By default, the component width sets based on the width of
210
+ * its parent container. You can also set the width in pixel values.
211
+ *
212
+ * @default '100%'
213
+ * @aspType string
214
+ * @deprecated
215
+ */
216
+ @Property('100%')
217
+ public width: string | number;
218
+ /**
219
+ * Specifies the height of the popup list.
220
+ * > For more details about the popup configuration refer to
221
+ * [`Popup Configuration`](../../drop-down-list/getting-started#configure-the-popup-list) documentation.
222
+ *
223
+ * @default '300px'
224
+ * @aspType string
225
+ * @deprecated
226
+ */
227
+ @Property('300px')
228
+ public popupHeight: string | number;
229
+ /**
230
+ * Specifies the width of the popup list. By default, the popup width sets based on the width of
231
+ * the component.
232
+ * > For more details about the popup configuration refer to
233
+ * [`Popup Configuration`](../../drop-down-list/getting-started#configure-the-popup-list) documentation.
234
+ *
235
+ * @default '100%'
236
+ * @aspType string
237
+ * @deprecated
238
+ */
239
+ @Property('100%')
240
+ public popupWidth: string | number;
241
+ /**
242
+ * When set to true, the user interactions on the component are disabled.
243
+ *
244
+ * @default false
245
+ * @deprecated
246
+ */
247
+ @Property(false)
248
+ public readonly: boolean;
249
+ /**
250
+ * Gets or sets the display text of the selected item in the component.
251
+ *
252
+ * @default null
253
+ * @deprecated
254
+ */
255
+ @Property(null)
256
+ public text: string;
257
+ /**
258
+ * Gets or sets the value of the selected item in the component.
259
+ *
260
+ * @default null
261
+ * @isGenericType true
262
+ * @deprecated
263
+ */
264
+ @Property(null)
265
+ public value: number | string | boolean;
266
+ /**
267
+ * *Constructor for creating the component
268
+ *
269
+ * @param {ComboBoxModel} options - Specifies the ComboBox model.
270
+ * @param {string | HTMLElement} element - Specifies the element to render as component.
271
+ * @private
272
+ */
273
+ public constructor(options?: ComboBoxModel, element?: string | HTMLElement) {
274
+ super(options, element);
275
+ }
276
+ /**
277
+ * Initialize the event handler
278
+ *
279
+ * @private
280
+ * @returns {void}
281
+ */
282
+ protected preRender(): void {
283
+ super.preRender();
284
+ }
285
+
286
+ protected getLocaleName(): string {
287
+ return 'combo-box';
288
+ }
289
+
290
+ protected wireEvent(): void {
291
+ if (this.getModuleName() === 'combobox') {
292
+ EventHandler.add(this.inputWrapper.buttons[0], 'mousedown', this.preventBlur, this);
293
+ EventHandler.add(this.inputWrapper.container, 'blur', this.onBlurHandler, this);
294
+ }
295
+ if (!isNullOrUndefined(this.inputWrapper.buttons[0])) {
296
+ EventHandler.add(this.inputWrapper.buttons[0], 'mousedown', this.dropDownClick, this);
297
+ }
298
+ EventHandler.add(this.inputElement, 'focus', this.targetFocus, this);
299
+ if (!this.readonly) {
300
+ EventHandler.add(this.inputElement, 'input', this.onInput, this);
301
+ EventHandler.add(this.inputElement, 'keyup', this.onFilterUp, this);
302
+ EventHandler.add(this.inputElement, 'keydown', this.onFilterDown, this);
303
+ EventHandler.add(this.inputElement, 'paste', this.pasteHandler, this);
304
+ EventHandler.add(<HTMLElement & Window>window, 'resize',this.windowResize, this);
305
+ }
306
+ this.bindCommonEvent();
307
+ }
308
+
309
+ private preventBlur(e: MouseEvent): void {
310
+ if ((!this.allowFiltering && document.activeElement !== this.inputElement &&
311
+ !document.activeElement.classList.contains(dropDownListClasses.input) && Browser.isDevice || !Browser.isDevice)) {
312
+ e.preventDefault();
313
+ }
314
+ }
315
+
316
+ protected onBlurHandler(e: MouseEvent): void {
317
+ const inputValue: string = this.inputElement && this.inputElement.value === '' ?
318
+ null : this.inputElement && this.inputElement.value;
319
+ if (!isNullOrUndefined(this.listData) && !isNullOrUndefined(inputValue) && inputValue !== this.text) {
320
+ this.customValue(e);
321
+ }
322
+ super.onBlurHandler(e);
323
+ }
324
+
325
+ protected targetElement(): HTMLElement | HTMLInputElement {
326
+ return this.inputElement;
327
+ }
328
+
329
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
330
+ protected setOldText(text: string): void {
331
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
332
+ this.customValue();
333
+ this.removeSelection();
334
+ }
335
+
336
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
337
+ protected setOldValue(value: string | number): void {
338
+ if (this.allowCustom) {
339
+ this.valueMuteChange(this.value);
340
+ } else {
341
+ this.valueMuteChange(null);
342
+ }
343
+ this.removeSelection();
344
+ this.setHiddenValue();
345
+ }
346
+ private valueMuteChange(value: string | number | boolean): void {
347
+ const inputValue: string = isNullOrUndefined(value) ? null : value.toString();
348
+ Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
349
+ this.setProperties({ value: value, text: value, index: null }, true);
350
+ this.activeIndex = this.index;
351
+ const fields: FieldSettingsModel = this.fields;
352
+ const dataItem: { [key: string]: string | Object } = {};
353
+ dataItem[fields.text] = isNullOrUndefined(value) ? null : value.toString();
354
+ dataItem[fields.value] = isNullOrUndefined(value) ? null : value.toString();
355
+ this.itemData = <{ [key: string]: Object }>dataItem;
356
+ this.item = null;
357
+ if (this.previousValue !== this.value) {
358
+ this.detachChangeEvent(null);
359
+ }
360
+ }
361
+ protected updateValues(): void {
362
+ if (!isNullOrUndefined(this.value)) {
363
+ const li: Element = this.getElementByValue(this.value);
364
+ if (li) {
365
+ this.setSelection(li, null);
366
+ } else if (this.allowCustom) {
367
+ this.valueMuteChange(this.value);
368
+ } else {
369
+ this.valueMuteChange(null);
370
+ }
371
+ } else if (this.text && isNullOrUndefined(this.value)) {
372
+ const li: Element = this.getElementByText(this.text);
373
+ if (li) {
374
+ this.setSelection(li, null);
375
+ } else {
376
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
377
+ this.customValue();
378
+ }
379
+ } else {
380
+ this.setSelection(this.liCollections[this.activeIndex], null);
381
+ }
382
+ this.setHiddenValue();
383
+ Input.setValue(this.text, this.inputElement, this.floatLabelType, this.showClearButton);
384
+ }
385
+
386
+ protected updateIconState(): void {
387
+ if (this.showClearButton) {
388
+ if (this.inputElement && this.inputElement.value !== '' && !this.readonly) {
389
+ removeClass([this.inputWrapper.clearButton], dropDownListClasses.clearIconHide);
390
+ } else {
391
+ addClass([this.inputWrapper.clearButton], dropDownListClasses.clearIconHide);
392
+ }
393
+ }
394
+ }
395
+
396
+ protected getAriaAttributes(): { [key: string]: string } {
397
+ const ariaAttributes: { [key: string]: string } = {
398
+ 'role': 'combobox',
399
+ 'aria-autocomplete': 'both',
400
+ 'aria-labelledby': this.hiddenElement.id,
401
+ 'aria-expanded': 'false',
402
+ 'aria-readonly': this.readonly.toString(),
403
+ 'autocomplete': 'off',
404
+ 'autocapitalize': 'off',
405
+ 'spellcheck': 'false'
406
+ };
407
+ return ariaAttributes;
408
+ }
409
+
410
+ protected searchLists(e: KeyboardEventArgs | MouseEvent): void {
411
+ this.isTyped = true;
412
+ if (this.isFiltering()) {
413
+ super.searchLists(e);
414
+ if (this.ulElement && this.filterInput.value.trim() === '') {
415
+ this.setHoverList(this.ulElement.querySelector('.' + dropDownListClasses.li));
416
+ }
417
+ } else {
418
+ if (this.ulElement && this.inputElement.value === '' && this.preventAutoFill) {
419
+ this.setHoverList(this.ulElement.querySelector('.' + dropDownListClasses.li));
420
+ }
421
+ this.incrementalSearch(e as KeyboardEventArgs);
422
+ }
423
+ }
424
+
425
+ protected getNgDirective(): string {
426
+ return 'EJS-COMBOBOX';
427
+ }
428
+
429
+ protected setSearchBox(): InputObject {
430
+ this.filterInput = this.inputElement;
431
+ let searchBoxContainer = (this.isFiltering() || ((this as any).isReact && this.getModuleName() === 'combobox'))? this.inputWrapper : inputObject;
432
+ return searchBoxContainer;
433
+ }
434
+
435
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
436
+ protected onActionComplete(ulElement: HTMLElement, list: { [key: string]: Object }[], e?: Object, isUpdated?: boolean): void {
437
+ super.onActionComplete(ulElement, list, e);
438
+ if (this.isSelectCustom) {
439
+ this.removeSelection();
440
+ }
441
+ if (!this.preventAutoFill && this.getModuleName() === 'combobox' && this.isTyped) {
442
+ setTimeout(() => {
443
+ this.inlineSearch();
444
+ });
445
+ }
446
+ }
447
+
448
+ protected getFocusElement(): Element {
449
+ const dataItem: { [key: string]: string } = this.isSelectCustom ? { text: '' } : this.getItemData();
450
+ const selected: HTMLElement = !isNullOrUndefined(this.list) ? <HTMLElement>this.list.querySelector('.' + dropDownListClasses.selected) : this.list;
451
+ const isSelected: boolean = dataItem.text === this.inputElement.value && !isNullOrUndefined(selected);
452
+ if (isSelected) {
453
+ return selected;
454
+ }
455
+ if ((Browser.isDevice && !this.isDropDownClick || !Browser.isDevice) &&
456
+ !isNullOrUndefined(this.liCollections) && this.liCollections.length > 0) {
457
+ const inputValue: string = this.inputElement.value;
458
+ const dataSource: { [key: string]: Object }[] = this.sortedData as { [key: string]: Object }[];
459
+ const type: string = this.typeOfData(dataSource).typeof as string;
460
+ const activeItem: { [key: string]: Element | number } =
461
+ Search(inputValue, this.liCollections, this.filterType, true, dataSource, this.fields, type);
462
+ const activeElement: Element = activeItem.item as Element;
463
+ if (!isNullOrUndefined(activeElement)) {
464
+ const count: number = this.getIndexByValue(activeElement.getAttribute('data-value')) - 1;
465
+ const height: number = parseInt(getComputedStyle(this.liCollections[0], null).getPropertyValue('height'), 10);
466
+ if (!isNaN(height) && this.getModuleName() !== 'autocomplete') {
467
+ this.removeFocus();
468
+ const fixedHead: number = this.fields.groupBy ? this.liCollections[0].offsetHeight : 0;
469
+ if (!this.enableVirtualization) {
470
+ this.list.scrollTop = count * height + fixedHead;
471
+ }
472
+ addClass([activeElement], dropDownListClasses.focus);
473
+ }
474
+ } else {
475
+ if (this.isSelectCustom && this.inputElement.value.trim() !== '') {
476
+ this.removeFocus();
477
+ if (!this.enableVirtualization) {
478
+ this.list.scrollTop = 0;
479
+ }
480
+ }
481
+ }
482
+ return activeElement;
483
+ } else {
484
+ return null;
485
+ }
486
+ }
487
+
488
+ protected setValue(e?: KeyboardEventArgs): boolean {
489
+ if (e && e.type === 'keydown' && e.action === 'enter') {
490
+ this.removeFillSelection();
491
+ }
492
+ if (this.autofill && this.getModuleName() === 'combobox' && e && e.type === 'keydown' && e.action !== 'enter') {
493
+ this.preventAutoFill = false;
494
+ this.inlineSearch(e);
495
+ return false;
496
+ } else {
497
+ return super.setValue(e);
498
+ }
499
+ }
500
+ protected checkCustomValue(): void {
501
+ this.itemData = this.getDataByValue(this.value);
502
+ const dataItem: { [key: string]: string } = this.getItemData();
503
+ if (!(this.allowCustom && isNullOrUndefined(dataItem.value) && isNullOrUndefined(dataItem.text))) {
504
+ this.setProperties({ 'value': dataItem.value }, !this.allowCustom);
505
+ }
506
+ }
507
+ /**
508
+ * Shows the spinner loader.
509
+ *
510
+ * @returns {void}
511
+ * @deprecated
512
+ */
513
+ public showSpinner(): void {
514
+ if (isNullOrUndefined(this.spinnerElement)) {
515
+ this.spinnerElement = (this.getModuleName() === 'autocomplete') ? (this.inputWrapper.buttons[0] ||
516
+ this.inputWrapper.clearButton ||
517
+ Input.appendSpan('e-input-group-icon ' + SPINNER_CLASS, this.inputWrapper.container, this.createElement)) :
518
+ (this.inputWrapper.buttons[0] || this.inputWrapper.clearButton);
519
+ addClass([this.spinnerElement], dropDownListClasses.disableIcon);
520
+ createSpinner(
521
+ {
522
+ target: this.spinnerElement,
523
+ width: Browser.isDevice ? '16px' : '14px'
524
+ },
525
+ this.createElement);
526
+ showSpinner(this.spinnerElement);
527
+ }
528
+ }
529
+ /**
530
+ * Hides the spinner loader.
531
+ *
532
+ * @returns {void}
533
+ * @deprecated
534
+ */
535
+ public hideSpinner(): void {
536
+ if (!isNullOrUndefined(this.spinnerElement)) {
537
+ hideSpinner(this.spinnerElement);
538
+ removeClass([this.spinnerElement], dropDownListClasses.disableIcon);
539
+ if (this.spinnerElement.classList.contains(SPINNER_CLASS)) {
540
+ detach(this.spinnerElement);
541
+ } else {
542
+ this.spinnerElement.innerHTML = '';
543
+ }
544
+ this.spinnerElement = null;
545
+ }
546
+ }
547
+
548
+ protected setAutoFill(activeElement: Element, isHover?: boolean): void {
549
+ if (!isHover) {
550
+ this.setHoverList(activeElement);
551
+ }
552
+ if (this.autofill && !this.preventAutoFill) {
553
+ const currentValue: string = <string>this.getTextByValue(activeElement.getAttribute('data-value')).toString();
554
+ const currentFillValue: string | number | boolean = this.getFormattedValue(activeElement.getAttribute('data-value'));
555
+ if (this.getModuleName() === 'combobox') {
556
+ if (!this.isSelected && this.previousValue !== currentFillValue) {
557
+ this.updateSelectedItem(activeElement, null);
558
+ this.isSelected = true;
559
+ this.previousValue = this.getFormattedValue(activeElement.getAttribute('data-value'));
560
+ } else {
561
+ this.updateSelectedItem(activeElement, null, true);
562
+ }
563
+ }
564
+ if (!this.isAndroidAutoFill(currentValue)) {
565
+ this.setAutoFillSelection(currentValue, isHover);
566
+ }
567
+ }
568
+ }
569
+
570
+ private isAndroidAutoFill(value: string): boolean {
571
+ if (Browser.isAndroid) {
572
+ const currentPoints: { [key: string]: number } = this.getSelectionPoints();
573
+ const prevEnd: number = this.prevSelectPoints.end;
574
+ const curEnd: number = currentPoints.end;
575
+ const prevStart: number = this.prevSelectPoints.start;
576
+ const curStart: number = currentPoints.start;
577
+ if (prevEnd !== 0 && ((prevEnd === value.length && prevStart === value.length) ||
578
+ (prevStart > curStart && prevEnd > curEnd) || (prevEnd === curEnd && prevStart === curStart))) {
579
+ return true;
580
+ } else {
581
+ return false;
582
+ }
583
+ } else {
584
+ return false;
585
+ }
586
+ }
587
+
588
+ protected clearAll(e?: MouseEvent | KeyboardEventArgs, property?: ComboBoxModel): void {
589
+ if (isNullOrUndefined(property) || (!isNullOrUndefined(property) && isNullOrUndefined(property.dataSource))) {
590
+ super.clearAll(e);
591
+ }
592
+ if (this.isFiltering() && !isNullOrUndefined(e) && e.target === this.inputWrapper.clearButton) {
593
+ this.searchLists(e);
594
+ }
595
+ }
596
+
597
+ protected isSelectFocusItem(element: Element): boolean {
598
+ return !isNullOrUndefined(element);
599
+ }
600
+
601
+ private inlineSearch(e?: KeyboardEventArgs): void {
602
+ const isKeyNavigate: boolean = (e && (e.action === 'down' || e.action === 'up' ||
603
+ e.action === 'home' || e.action === 'end' || e.action === 'pageUp' || e.action === 'pageDown'));
604
+ const activeElement: Element = isKeyNavigate ? this.liCollections[this.activeIndex] : this.getFocusElement();
605
+ if (!isNullOrUndefined(activeElement)) {
606
+ if (!isKeyNavigate) {
607
+ const value: string | number | boolean = this.getFormattedValue(activeElement.getAttribute('data-value'));
608
+ this.activeIndex = this.getIndexByValue(value);
609
+ this.activeIndex = !isNullOrUndefined(this.activeIndex) ? this.activeIndex : null;
610
+ }
611
+ this.preventAutoFill = this.inputElement.value === '' ? false : this.preventAutoFill;
612
+ this.setAutoFill(activeElement, isKeyNavigate);
613
+ } else if (this.inputElement.value === '') {
614
+ this.activeIndex = null;
615
+ if (!isNullOrUndefined(this.list)) {
616
+ if (!this.enableVirtualization) {
617
+ this.list.scrollTop = 0;
618
+ }
619
+ const focusItem: Element = this.list.querySelector('.' + dropDownListClasses.li);
620
+ this.setHoverList(focusItem);
621
+ }
622
+ } else {
623
+ this.activeIndex = null;
624
+ this.removeSelection();
625
+ if (this.liCollections && this.liCollections.length > 0 && !this.isCustomFilter) {
626
+ this.removeFocus();
627
+ }
628
+ }
629
+ }
630
+
631
+ protected incrementalSearch(e: KeyboardEventArgs): void {
632
+ this.showPopup(e);
633
+ if (!isNullOrUndefined(this.listData)) {
634
+ this.inlineSearch(e);
635
+ e.preventDefault();
636
+ }
637
+ }
638
+
639
+ private setAutoFillSelection(currentValue: string, isKeyNavigate: boolean = false): void {
640
+ const selection: { [key: string]: number } = this.getSelectionPoints();
641
+ const value: string = this.inputElement.value.substr(0, selection.start);
642
+ if (value && (value.toLowerCase() === currentValue.substr(0, selection.start).toLowerCase())) {
643
+ const inputValue: string = value + currentValue.substr(value.length, currentValue.length);
644
+ Input.setValue(inputValue, this.inputElement, this.floatLabelType, this.showClearButton);
645
+ this.inputElement.setSelectionRange(selection.start, this.inputElement.value.length);
646
+ } else if (isKeyNavigate) {
647
+ Input.setValue(currentValue, this.inputElement, this.floatLabelType, this.showClearButton);
648
+ this.inputElement.setSelectionRange(0, this.inputElement.value.length);
649
+ }
650
+ }
651
+
652
+ protected getValueByText(text: string): string | number | boolean {
653
+ return super.getValueByText(text, true, this.ignoreAccent);
654
+ }
655
+
656
+ protected unWireEvent(): void {
657
+ if (this.getModuleName() === 'combobox') {
658
+ EventHandler.remove(this.inputWrapper.buttons[0], 'mousedown', this.preventBlur);
659
+ EventHandler.remove(this.inputWrapper.container, 'blur', this.onBlurHandler);
660
+ }
661
+ if (!isNullOrUndefined(this.inputWrapper.buttons[0])) {
662
+ EventHandler.remove(this.inputWrapper.buttons[0], 'mousedown', this.dropDownClick);
663
+ }
664
+ if (this.inputElement) {
665
+ EventHandler.remove(this.inputElement, 'focus', this.targetFocus);
666
+ if (!this.readonly) {
667
+ EventHandler.remove(this.inputElement, 'input', this.onInput);
668
+ EventHandler.remove(this.inputElement, 'keyup', this.onFilterUp);
669
+ EventHandler.remove(this.inputElement, 'keydown', this.onFilterDown);
670
+ EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
671
+ EventHandler.remove(<HTMLElement & Window>window, 'resize', this.windowResize);
672
+ }
673
+ }
674
+ this.unBindCommonEvent();
675
+ }
676
+
677
+ protected setSelection(li: Element, e: MouseEvent | KeyboardEventArgs | TouchEvent): void {
678
+ super.setSelection(li, e);
679
+ if (!isNullOrUndefined(li) && !this.autofill && !this.isDropDownClick) {
680
+ this.removeFocus();
681
+ }
682
+ }
683
+ protected selectCurrentItem(e: KeyboardEventArgs): void {
684
+ let li: Element;
685
+ if (this.isPopupOpen) {
686
+ if (this.isSelected) {
687
+ li = this.list.querySelector('.' + dropDownListClasses.selected);
688
+ } else {
689
+ li = this.list.querySelector('.' + dropDownListClasses.focus);
690
+ }
691
+ if (li) {
692
+ this.setSelection(li, e);
693
+ this.isTyped = false;
694
+ }
695
+ if (this.isSelected) {
696
+ this.isSelectCustom = false;
697
+ this.onChangeEvent(e);
698
+ }
699
+ }
700
+ if (e.action === 'enter' && this.inputElement.value.trim() === '') {
701
+ this.clearAll(e);
702
+ } else if (this.isTyped && !this.isSelected && isNullOrUndefined(li)) {
703
+ this.customValue(e);
704
+ }
705
+ this.hidePopup(e);
706
+ }
707
+
708
+ protected setHoverList(li: Element): void {
709
+ this.removeSelection();
710
+ if (this.isValidLI(li) && !li.classList.contains(dropDownListClasses.selected)) {
711
+ this.removeFocus();
712
+ li.classList.add(dropDownListClasses.focus);
713
+ }
714
+ }
715
+ private targetFocus(e: MouseEvent): void {
716
+ if (Browser.isDevice && !this.allowFiltering) {
717
+ this.preventFocus = false;
718
+ }
719
+ this.onFocus(e);
720
+ Input.calculateWidth(this.inputElement, this.inputWrapper.container);
721
+ }
722
+ protected dropDownClick(e: MouseEvent): void {
723
+ e.preventDefault();
724
+ if (Browser.isDevice && !this.isFiltering()) {
725
+ this.preventFocus = true;
726
+ }
727
+ super.dropDownClick(e);
728
+ }
729
+ private customValue(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
730
+ const value: string | number | boolean = this.getValueByText(this.inputElement.value);
731
+ if (!this.allowCustom && this.inputElement.value !== '') {
732
+ const previousValue: string | number | boolean = this.previousValue;
733
+ const currentValue: string | number | boolean = this.value;
734
+ this.setProperties({ value: value });
735
+ if (isNullOrUndefined(this.value)) {
736
+ Input.setValue('', this.inputElement, this.floatLabelType, this.showClearButton);
737
+ }
738
+ if (this.autofill && previousValue === this.value && currentValue !== this.value) {
739
+ this.onChangeEvent(null);
740
+ }
741
+ } else if (this.inputElement.value.trim() !== '') {
742
+ const previousValue: string | number | boolean = this.value;
743
+ if (isNullOrUndefined(value)) {
744
+ const value: string | Object = this.inputElement.value === '' ? null : this.inputElement.value;
745
+ // eslint-disable-next-line max-len
746
+ const eventArgs: { [key: string]: Object | string | number } = <{ [key: string]: Object | string | number }>{ text: value, item: {} };
747
+ if (!this.initial) {
748
+ this.trigger('customValueSpecifier', eventArgs, (eventArgs: { [key: string]: Object | string | number }) => {
749
+ this.updateCustomValueCallback(value, eventArgs, previousValue, e);
750
+ });
751
+ } else {
752
+ this.updateCustomValueCallback(value, eventArgs, previousValue);
753
+ }
754
+ } else {
755
+ this.isSelectCustom = false;
756
+ this.setProperties({ value: value });
757
+ if (previousValue !== this.value) {
758
+ this.onChangeEvent(e);
759
+ }
760
+ }
761
+ } else if (this.allowCustom) {
762
+ this.isSelectCustom = true;
763
+ }
764
+ }
765
+ private updateCustomValueCallback(
766
+ value: string | Object,
767
+ eventArgs: { [key: string]: Object | string | number },
768
+ previousValue: string | number | boolean,
769
+ e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
770
+ const fields: FieldSettingsModel = this.fields;
771
+ const item: { [key: string]: string | Object } = <{ [key: string]: string | Object }>eventArgs.item;
772
+ let dataItem: { [key: string]: string | Object } = {};
773
+ if (item && getValue(fields.text, item) && getValue(fields.value, item)) {
774
+ dataItem = item;
775
+ } else {
776
+ setValue(fields.text, value, dataItem);
777
+ setValue(fields.value, value, dataItem);
778
+ }
779
+ this.itemData = <{ [key: string]: Object }>dataItem;
780
+ const changeData: { [key: string]: Object } = {
781
+ text: getValue(fields.text, this.itemData),
782
+ value: getValue(fields.value, this.itemData),
783
+ index: null
784
+ };
785
+ this.setProperties(changeData, true);
786
+ this.setSelection(null, null);
787
+ this.isSelectCustom = true;
788
+ if (previousValue !== this.value) {
789
+ this.onChangeEvent(e);
790
+ }
791
+ }
792
+ /**
793
+ * Dynamically change the value of properties.
794
+ *
795
+ * @param {ComboBoxModel} newProp - Returns the dynamic property value of the component.
796
+ * @param {ComboBoxModel} oldProp - Returns the previous property value of the component.
797
+ * @private
798
+ * @returns {void}
799
+ */
800
+ public onPropertyChanged(newProp: ComboBoxModel, oldProp: ComboBoxModel): void {
801
+ if (this.getModuleName() === 'combobox') {
802
+ this.checkData(newProp);
803
+ this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp as { [key: string]: string });
804
+ }
805
+ for (const prop of Object.keys(newProp)) {
806
+ switch (prop) {
807
+ case 'readonly':
808
+ Input.setReadonly(this.readonly, this.inputElement as HTMLInputElement);
809
+ if (this.readonly) {
810
+ EventHandler.remove(this.inputElement, 'input', this.onInput);
811
+ EventHandler.remove(this.inputElement, 'keyup', this.onFilterUp);
812
+ EventHandler.remove(this.inputElement, 'keydown', this.onFilterDown);
813
+ } else {
814
+ EventHandler.add(this.inputElement, 'input', this.onInput, this);
815
+ EventHandler.add(this.inputElement, 'keyup', this.onFilterUp, this);
816
+ EventHandler.add(this.inputElement, 'keydown', this.onFilterDown, this);
817
+ }
818
+ this.setReadOnly();
819
+ break;
820
+ case 'allowFiltering':
821
+ this.setSearchBox();
822
+ if (this.isFiltering() && this.getModuleName() === 'combobox' && isNullOrUndefined(this.list)) {
823
+ super.renderList();
824
+ }
825
+ break;
826
+ case 'allowCustom':
827
+ break;
828
+ default: {
829
+ // eslint-disable-next-line max-len
830
+ const comboProps: { [key: string]: Object } = this.getPropObject(prop, <{ [key: string]: string }>newProp, <{ [key: string]: string }>oldProp);
831
+ super.onPropertyChanged(comboProps.newProperty, comboProps.oldProperty);
832
+ if (this.isFiltering() && prop === 'dataSource' && isNullOrUndefined(this.list) && this.itemTemplate &&
833
+ this.getModuleName() === 'combobox') {
834
+ super.renderList();
835
+ }
836
+ break;
837
+ }
838
+ }
839
+ }
840
+ }
841
+ /**
842
+ * To initialize the control rendering.
843
+ *
844
+ * @private
845
+ * @returns {void}
846
+ */
847
+ public render(): void {
848
+ super.render();
849
+ this.setSearchBox();
850
+ if (this.isFiltering() && this.getModuleName() === 'combobox' && isNullOrUndefined(this.list)) {
851
+ super.renderList();
852
+ }
853
+ this.renderComplete();
854
+ }
855
+ /**
856
+ * Return the module name of this component.
857
+ *
858
+ * @private
859
+ * @returns {string} Return the module name of this component.
860
+ */
861
+ public getModuleName(): string {
862
+ return 'combobox';
863
+ }
864
+ /**
865
+ * Adds a new item to the combobox popup list. By default, new item appends to the list as the last item,
866
+ * but you can insert based on the index parameter.
867
+ *
868
+ * @param { Object[] } items - Specifies an array of JSON data or a JSON data.
869
+ * @param { number } itemIndex - Specifies the index to place the newly added item in the popup list.
870
+ * @returns {void}
871
+ * @deprecated
872
+ */
873
+ public addItem(
874
+ items: { [key: string]: Object }[] | { [key: string]: Object } | string | boolean | number | string[] | boolean[] | number[],
875
+ itemIndex?: number): void {
876
+ super.addItem(items, itemIndex);
877
+ }
878
+ /**
879
+ * To filter the data from given data source by using query
880
+ *
881
+ * @param {Object[] | DataManager } dataSource - Set the data source to filter.
882
+ * @param {Query} query - Specify the query to filter the data.
883
+ * @param {FieldSettingsModel} fields - Specify the fields to map the column in the data table.
884
+ * @returns {void}
885
+ * @deprecated
886
+ */
887
+ public filter(
888
+ dataSource: { [key: string]: Object }[] | DataManager | string[] | number[] | boolean[],
889
+ query?: Query, fields?: FieldSettingsModel): void {
890
+ super.filter(dataSource, query, fields);
891
+ }
892
+ /* eslint-disable valid-jsdoc, jsdoc/require-param */
893
+ /**
894
+ * Opens the popup that displays the list of items.
895
+ *
896
+ * @returns {void}
897
+ * @deprecated
898
+ */
899
+ public showPopup(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
900
+ /* eslint-enable valid-jsdoc, jsdoc/require-param */
901
+ super.showPopup(e);
902
+ }
903
+ /* eslint-disable valid-jsdoc, jsdoc/require-param */
904
+ /**
905
+ * Hides the popup if it is in open state.
906
+ *
907
+ * @returns {void}
908
+ * @deprecated
909
+ */
910
+ public hidePopup(e?: MouseEvent | KeyboardEventArgs | TouchEvent): void {
911
+ /* eslint-enable valid-jsdoc, jsdoc/require-param */
912
+ const inputValue: string | Object = this.inputElement && this.inputElement.value === '' ? null
913
+ : this.inputElement && this.inputElement.value;
914
+ if (!isNullOrUndefined(this.listData)) {
915
+ const isEscape: boolean = this.isEscapeKey;
916
+ if (this.isEscapeKey) {
917
+ Input.setValue(this.typedString, this.inputElement, this.floatLabelType, this.showClearButton);
918
+ this.isEscapeKey = false;
919
+ }
920
+ if (this.autofill) {
921
+ this.removeFillSelection();
922
+ }
923
+ const dataItem: { [key: string]: string } = this.isSelectCustom ? { text: '' } : this.getItemData();
924
+ const selected: HTMLElement = !isNullOrUndefined(this.list) ? <HTMLElement>this.list.querySelector('.' + dropDownListClasses.selected) : null;
925
+ if (this.inputElement && dataItem.text === this.inputElement.value && !isNullOrUndefined(selected)) {
926
+ if (this.isSelected) {
927
+ this.onChangeEvent(e);
928
+ this.isSelectCustom = false;
929
+ }
930
+ super.hidePopup(e);
931
+ return;
932
+ }
933
+ if (this.getModuleName() === 'combobox' && this.inputElement.value.trim() !== '') {
934
+ const dataSource: { [key: string]: Object }[] = this.sortedData as { [key: string]: Object }[];
935
+ const type: string = this.typeOfData(dataSource).typeof as string;
936
+ const searchItem: { [key: string]: number | Element } = Search(this.inputElement.value, this.liCollections, 'Equal', true, dataSource, this.fields, type);
937
+ this.selectedLI = searchItem.item as HTMLElement;
938
+ if (isNullOrUndefined(searchItem.index)) {
939
+ searchItem.index = Search(this.inputElement.value, this.liCollections, 'StartsWith', true, dataSource, this.fields, type).index as number;
940
+ }
941
+ this.activeIndex = searchItem.index as number;
942
+ if (!isNullOrUndefined(this.selectedLI)) {
943
+ this.updateSelectedItem(this.selectedLI, null, true);
944
+ } else if (isEscape) {
945
+ this.isSelectCustom = true;
946
+ this.removeSelection();
947
+ }
948
+ }
949
+ if (!this.isEscapeKey && this.isTyped && !this.isInteracted) {
950
+ this.customValue(e);
951
+ }
952
+ }
953
+ if (isNullOrUndefined(this.listData) && this.allowCustom && !isNullOrUndefined(inputValue) && inputValue !== this.value) {
954
+ this.customValue();
955
+ }
956
+ super.hidePopup(e);
957
+ }
958
+ /**
959
+ * Sets the focus to the component for interaction.
960
+ *
961
+ * @returns {void}
962
+ */
963
+ public focusIn(): void {
964
+ if (!this.enabled) {
965
+ return;
966
+ }
967
+ if (Browser.isDevice && !this.isFiltering()) {
968
+ this.preventFocus = true;
969
+ }
970
+ super.focusIn();
971
+ }
972
+ /**
973
+ * Allows you to clear the selected values from the component.
974
+ *
975
+ * @returns {void}
976
+ * @deprecated
977
+ */
978
+ public clear(): void {
979
+ this.value = null;
980
+ }
981
+ /* eslint-disable valid-jsdoc, jsdoc/require-param */
982
+ /**
983
+ * Moves the focus from the component if the component is already focused.
984
+ *
985
+ * @returns {void}
986
+ * @deprecated
987
+ */
988
+ public focusOut(e?: MouseEvent | KeyboardEventArgs): void {
989
+ /* eslint-enable valid-jsdoc, jsdoc/require-param */
990
+ super.focusOut(e);
991
+ }
992
+ /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
993
+ /**
994
+ * Gets all the list items bound on this component.
995
+ *
996
+ * @returns {Element[]}
997
+ * @deprecated
998
+ */
999
+ public getItems(): Element[] {
1000
+ return super.getItems();
1001
+ }
1002
+ /**
1003
+ * Gets the data Object that matches the given value.
1004
+ *
1005
+ * @param { string | number } value - Specifies the value of the list item.
1006
+ * @returns {Object}
1007
+ * @deprecated
1008
+ */
1009
+ public getDataByValue(value: string | number | boolean)
1010
+ : { [key: string]: Object } | string | number | boolean {
1011
+ return super.getDataByValue(value);
1012
+ }
1013
+ /* eslint-enable valid-jsdoc, jsdoc/require-returns-description */
1014
+ protected renderHightSearch(): void {
1015
+ // update high light search
1016
+ }
1017
+ }
1018
+ export interface CustomValueSpecifierEventArgs {
1019
+ /**
1020
+ * Gets the typed custom text to make a own text format and assign it to `item` argument.
1021
+ */
1022
+ text: string
1023
+ /**
1024
+ * Sets the text custom format data for set a `value` and `text`.
1025
+ *
1026
+ */
1027
+ item: { [key: string]: string | Object }
1028
+ }