@syncfusion/ej2-dropdowns 23.1.40-85814 → 23.1.41

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 (303) hide show
  1. package/.eslintrc.json +260 -0
  2. package/CHANGELOG.md +2057 -2042
  3. package/{ReadMe.md → README.md} +217 -217
  4. package/dist/ej2-dropdowns.min.js +10 -0
  5. package/dist/ej2-dropdowns.umd.min.js +10 -1
  6. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es2015.js +101 -60
  8. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  9. package/dist/es6/ej2-dropdowns.es5.js +243 -202
  10. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  11. package/dist/global/ej2-dropdowns.min.js +10 -1
  12. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  13. package/dist/global/index.d.ts +9 -0
  14. package/helpers/e2e/autocomplete.js +13 -13
  15. package/helpers/e2e/combobox.js +13 -13
  16. package/helpers/e2e/dropdownlist.js +13 -13
  17. package/helpers/e2e/index.js +3 -3
  18. package/helpers/e2e/listboxHelper.js +13 -13
  19. package/helpers/e2e/multiselect.js +13 -13
  20. package/license +2 -2
  21. package/package.json +79 -79
  22. package/src/auto-complete/auto-complete-model.d.ts +188 -188
  23. package/src/auto-complete/auto-complete.d.ts +12 -12
  24. package/src/auto-complete/auto-complete.js +21 -21
  25. package/src/combo-box/combo-box-model.d.ts +224 -224
  26. package/src/combo-box/combo-box.d.ts +27 -27
  27. package/src/combo-box/combo-box.js +29 -29
  28. package/src/common/virtual-scroll.js +46 -46
  29. package/src/drop-down-base/drop-down-base-model.d.ts +200 -200
  30. package/src/drop-down-base/drop-down-base.d.ts +16 -15
  31. package/src/drop-down-base/drop-down-base.js +25 -20
  32. package/src/drop-down-list/drop-down-list-model.d.ts +202 -202
  33. package/src/drop-down-list/drop-down-list.d.ts +7 -4
  34. package/src/drop-down-list/drop-down-list.js +53 -22
  35. package/src/drop-down-tree/drop-down-tree-model.d.ts +468 -468
  36. package/src/drop-down-tree/drop-down-tree.js +21 -21
  37. package/src/list-box/list-box-model.d.ts +193 -193
  38. package/src/list-box/list-box.d.ts +2 -2
  39. package/src/list-box/list-box.js +19 -19
  40. package/src/mention/mention-model.d.ts +261 -261
  41. package/src/mention/mention.js +19 -19
  42. package/src/multi-select/multi-select-model.d.ts +512 -512
  43. package/src/multi-select/multi-select.js +24 -19
  44. package/styles/auto-complete/_all.scss +1 -1
  45. package/styles/auto-complete/_bootstrap-dark-definition.scss +3 -3
  46. package/styles/auto-complete/_bootstrap-definition.scss +2 -2
  47. package/styles/auto-complete/_bootstrap4-definition.scss +11 -11
  48. package/styles/auto-complete/_bootstrap5-definition.scss +2 -2
  49. package/styles/auto-complete/_fabric-dark-definition.scss +2 -2
  50. package/styles/auto-complete/_fabric-definition.scss +2 -2
  51. package/styles/auto-complete/_fluent-definition.scss +2 -2
  52. package/styles/auto-complete/_fusionnew-definition.scss +2 -2
  53. package/styles/auto-complete/_highcontrast-definition.scss +2 -2
  54. package/styles/auto-complete/_highcontrast-light-definition.scss +2 -2
  55. package/styles/auto-complete/_material-dark-definition.scss +2 -2
  56. package/styles/auto-complete/_material-definition.scss +2 -2
  57. package/styles/auto-complete/_material3-definition.scss +2 -2
  58. package/styles/auto-complete/_tailwind-definition.scss +2 -2
  59. package/styles/auto-complete/material3-dark.scss +1 -1
  60. package/styles/auto-complete/material3.scss +1 -1
  61. package/styles/bootstrap-dark.css +1 -1
  62. package/styles/bootstrap.css +1 -1
  63. package/styles/bootstrap4.css +1 -1
  64. package/styles/bootstrap5-dark.css +1 -1
  65. package/styles/bootstrap5.css +1 -1
  66. package/styles/combo-box/_all.scss +1 -1
  67. package/styles/combo-box/_bootstrap-dark-definition.scss +2 -2
  68. package/styles/combo-box/_bootstrap-definition.scss +2 -2
  69. package/styles/combo-box/_bootstrap4-definition.scss +11 -11
  70. package/styles/combo-box/_bootstrap5-definition.scss +2 -2
  71. package/styles/combo-box/_fabric-dark-definition.scss +2 -2
  72. package/styles/combo-box/_fabric-definition.scss +2 -2
  73. package/styles/combo-box/_fluent-definition.scss +2 -2
  74. package/styles/combo-box/_fusionnew-definition.scss +2 -2
  75. package/styles/combo-box/_highcontrast-definition.scss +2 -2
  76. package/styles/combo-box/_highcontrast-light-definition.scss +3 -3
  77. package/styles/combo-box/_material-dark-definition.scss +2 -2
  78. package/styles/combo-box/_material-definition.scss +2 -2
  79. package/styles/combo-box/_material3-definition.scss +2 -2
  80. package/styles/combo-box/_tailwind-definition.scss +2 -2
  81. package/styles/combo-box/material3-dark.scss +1 -1
  82. package/styles/combo-box/material3.scss +1 -1
  83. package/styles/drop-down-base/_all.scss +2 -2
  84. package/styles/drop-down-base/_bootstrap-dark-definition.scss +83 -83
  85. package/styles/drop-down-base/_bootstrap-definition.scss +83 -83
  86. package/styles/drop-down-base/_bootstrap4-definition.scss +90 -90
  87. package/styles/drop-down-base/_bootstrap5-definition.scss +117 -117
  88. package/styles/drop-down-base/_definition.scss +23 -23
  89. package/styles/drop-down-base/_fabric-dark-definition.scss +86 -86
  90. package/styles/drop-down-base/_fabric-definition.scss +84 -84
  91. package/styles/drop-down-base/_fluent-definition.scss +121 -121
  92. package/styles/drop-down-base/_fusionnew-definition.scss +117 -117
  93. package/styles/drop-down-base/_highcontrast-definition.scss +105 -105
  94. package/styles/drop-down-base/_highcontrast-light-definition.scss +105 -105
  95. package/styles/drop-down-base/_layout.scss +195 -195
  96. package/styles/drop-down-base/_material-dark-definition.scss +86 -86
  97. package/styles/drop-down-base/_material-definition.scss +85 -85
  98. package/styles/drop-down-base/_material3-definition.scss +87 -87
  99. package/styles/drop-down-base/_tailwind-definition.scss +129 -129
  100. package/styles/drop-down-base/_theme.scss +391 -391
  101. package/styles/drop-down-base/material3-dark.scss +1 -1
  102. package/styles/drop-down-base/material3.scss +1 -1
  103. package/styles/drop-down-list/_all.scss +3 -3
  104. package/styles/drop-down-list/_bootstrap-dark-definition.scss +157 -157
  105. package/styles/drop-down-list/_bootstrap-definition.scss +156 -156
  106. package/styles/drop-down-list/_bootstrap4-definition.scss +202 -202
  107. package/styles/drop-down-list/_bootstrap5-definition.scss +201 -201
  108. package/styles/drop-down-list/_fabric-dark-definition.scss +128 -128
  109. package/styles/drop-down-list/_fabric-definition.scss +124 -124
  110. package/styles/drop-down-list/_fluent-definition.scss +185 -185
  111. package/styles/drop-down-list/_fusionnew-definition.scss +201 -201
  112. package/styles/drop-down-list/_highcontrast-definition.scss +142 -142
  113. package/styles/drop-down-list/_highcontrast-light-definition.scss +144 -144
  114. package/styles/drop-down-list/_layout.scss +310 -310
  115. package/styles/drop-down-list/_material-dark-definition.scss +143 -143
  116. package/styles/drop-down-list/_material-definition.scss +167 -167
  117. package/styles/drop-down-list/_material3-definition.scss +180 -180
  118. package/styles/drop-down-list/_tailwind-definition.scss +134 -134
  119. package/styles/drop-down-list/_theme.scss +10 -10
  120. package/styles/drop-down-list/icons/_bootstrap-dark.scss +14 -14
  121. package/styles/drop-down-list/icons/_bootstrap.scss +14 -14
  122. package/styles/drop-down-list/icons/_bootstrap4.scss +14 -14
  123. package/styles/drop-down-list/icons/_bootstrap5.scss +14 -14
  124. package/styles/drop-down-list/icons/_fabric-dark.scss +14 -14
  125. package/styles/drop-down-list/icons/_fabric.scss +14 -14
  126. package/styles/drop-down-list/icons/_fluent.scss +14 -14
  127. package/styles/drop-down-list/icons/_fusionnew.scss +14 -14
  128. package/styles/drop-down-list/icons/_highcontrast-light.scss +14 -14
  129. package/styles/drop-down-list/icons/_highcontrast.scss +14 -14
  130. package/styles/drop-down-list/icons/_material-dark.scss +14 -14
  131. package/styles/drop-down-list/icons/_material.scss +14 -14
  132. package/styles/drop-down-list/icons/_material3.scss +14 -14
  133. package/styles/drop-down-list/icons/_tailwind.scss +14 -14
  134. package/styles/drop-down-list/material3-dark.scss +1 -1
  135. package/styles/drop-down-list/material3.scss +1 -1
  136. package/styles/drop-down-tree/_all.scss +2 -2
  137. package/styles/drop-down-tree/_bootstrap-dark-definition.scss +71 -71
  138. package/styles/drop-down-tree/_bootstrap-definition.scss +70 -70
  139. package/styles/drop-down-tree/_bootstrap4-definition.scss +71 -71
  140. package/styles/drop-down-tree/_bootstrap5-definition.scss +59 -59
  141. package/styles/drop-down-tree/_fabric-dark-definition.scss +71 -71
  142. package/styles/drop-down-tree/_fabric-definition.scss +71 -71
  143. package/styles/drop-down-tree/_fluent-definition.scss +65 -65
  144. package/styles/drop-down-tree/_fusionnew-definition.scss +59 -59
  145. package/styles/drop-down-tree/_highcontrast-definition.scss +71 -71
  146. package/styles/drop-down-tree/_highcontrast-light-definition.scss +71 -71
  147. package/styles/drop-down-tree/_layout.scss +1412 -1418
  148. package/styles/drop-down-tree/_material-dark-definition.scss +72 -72
  149. package/styles/drop-down-tree/_material-definition.scss +72 -72
  150. package/styles/drop-down-tree/_material3-definition.scss +76 -76
  151. package/styles/drop-down-tree/_tailwind-definition.scss +61 -61
  152. package/styles/drop-down-tree/_theme.scss +132 -132
  153. package/styles/drop-down-tree/fluent-dark.css +0 -2
  154. package/styles/drop-down-tree/fluent.css +0 -2
  155. package/styles/drop-down-tree/icons/_bootstrap-dark.scss +11 -11
  156. package/styles/drop-down-tree/icons/_bootstrap.scss +11 -11
  157. package/styles/drop-down-tree/icons/_bootstrap4.scss +11 -11
  158. package/styles/drop-down-tree/icons/_bootstrap5.scss +11 -11
  159. package/styles/drop-down-tree/icons/_fabric-dark.scss +11 -11
  160. package/styles/drop-down-tree/icons/_fabric.scss +11 -11
  161. package/styles/drop-down-tree/icons/_fluent.scss +11 -11
  162. package/styles/drop-down-tree/icons/_fusionnew.scss +11 -11
  163. package/styles/drop-down-tree/icons/_highcontrast-light.scss +11 -11
  164. package/styles/drop-down-tree/icons/_highcontrast.scss +11 -11
  165. package/styles/drop-down-tree/icons/_material-dark.scss +11 -11
  166. package/styles/drop-down-tree/icons/_material.scss +11 -11
  167. package/styles/drop-down-tree/icons/_material3.scss +11 -11
  168. package/styles/drop-down-tree/icons/_tailwind-dark.scss +11 -11
  169. package/styles/drop-down-tree/icons/_tailwind.scss +11 -11
  170. package/styles/drop-down-tree/material3-dark.scss +1 -1
  171. package/styles/drop-down-tree/material3.scss +1 -1
  172. package/styles/fabric-dark.css +1 -1
  173. package/styles/fabric.css +1 -1
  174. package/styles/fluent-dark.css +1 -3
  175. package/styles/fluent.css +1 -3
  176. package/styles/highcontrast-light.css +1 -1
  177. package/styles/highcontrast.css +1 -1
  178. package/styles/list-box/_all.scss +2 -2
  179. package/styles/list-box/_bootstrap-dark-definition.scss +126 -126
  180. package/styles/list-box/_bootstrap-definition.scss +119 -119
  181. package/styles/list-box/_bootstrap4-definition.scss +124 -124
  182. package/styles/list-box/_bootstrap5-definition.scss +120 -120
  183. package/styles/list-box/_fabric-dark-definition.scss +126 -126
  184. package/styles/list-box/_fabric-definition.scss +119 -119
  185. package/styles/list-box/_fluent-definition.scss +120 -120
  186. package/styles/list-box/_fusionnew-definition.scss +111 -111
  187. package/styles/list-box/_highcontrast-definition.scss +119 -119
  188. package/styles/list-box/_highcontrast-light-definition.scss +126 -126
  189. package/styles/list-box/_layout.scss +542 -542
  190. package/styles/list-box/_material-dark-definition.scss +126 -126
  191. package/styles/list-box/_material-definition.scss +119 -119
  192. package/styles/list-box/_material3-definition.scss +119 -119
  193. package/styles/list-box/_tailwind-definition.scss +119 -119
  194. package/styles/list-box/_theme.scss +382 -382
  195. package/styles/list-box/bootstrap-dark.css +1 -1
  196. package/styles/list-box/bootstrap.css +1 -1
  197. package/styles/list-box/bootstrap4.css +1 -1
  198. package/styles/list-box/bootstrap5-dark.css +1 -1
  199. package/styles/list-box/bootstrap5.css +1 -1
  200. package/styles/list-box/fabric-dark.css +1 -1
  201. package/styles/list-box/fabric.css +1 -1
  202. package/styles/list-box/fluent-dark.css +1 -1
  203. package/styles/list-box/fluent.css +1 -1
  204. package/styles/list-box/highcontrast-light.css +1 -1
  205. package/styles/list-box/highcontrast.css +1 -1
  206. package/styles/list-box/icons/_bootstrap-dark.scss +25 -25
  207. package/styles/list-box/icons/_bootstrap.scss +25 -25
  208. package/styles/list-box/icons/_bootstrap4.scss +25 -25
  209. package/styles/list-box/icons/_bootstrap5.scss +25 -25
  210. package/styles/list-box/icons/_fabric-dark.scss +25 -25
  211. package/styles/list-box/icons/_fabric.scss +25 -25
  212. package/styles/list-box/icons/_fluent.scss +25 -25
  213. package/styles/list-box/icons/_fusionnew.scss +25 -25
  214. package/styles/list-box/icons/_highcontrast-light.scss +25 -25
  215. package/styles/list-box/icons/_highcontrast.scss +25 -25
  216. package/styles/list-box/icons/_material-dark.scss +25 -25
  217. package/styles/list-box/icons/_material.scss +25 -25
  218. package/styles/list-box/icons/_material3.scss +25 -25
  219. package/styles/list-box/icons/_tailwind-dark.scss +25 -25
  220. package/styles/list-box/icons/_tailwind.scss +25 -25
  221. package/styles/list-box/material-dark.css +1 -1
  222. package/styles/list-box/material.css +1 -1
  223. package/styles/list-box/material3-dark.css +1 -1
  224. package/styles/list-box/material3-dark.scss +1 -1
  225. package/styles/list-box/material3.css +1 -1
  226. package/styles/list-box/material3.scss +1 -1
  227. package/styles/list-box/tailwind-dark.css +1 -1
  228. package/styles/list-box/tailwind.css +1 -1
  229. package/styles/material-dark.css +1 -1
  230. package/styles/material.css +1 -1
  231. package/styles/material3-dark.css +1 -1
  232. package/styles/material3-dark.scss +1 -1
  233. package/styles/material3.css +1 -1
  234. package/styles/material3.scss +1 -1
  235. package/styles/mention/_all.scss +1 -1
  236. package/styles/mention/_bootstrap-dark-definition.scss +3 -3
  237. package/styles/mention/_bootstrap-definition.scss +3 -3
  238. package/styles/mention/_bootstrap4-definition.scss +3 -3
  239. package/styles/mention/_bootstrap5-definition.scss +1 -1
  240. package/styles/mention/_fabric-dark-definition.scss +2 -2
  241. package/styles/mention/_fabric-definition.scss +3 -3
  242. package/styles/mention/_fluent-definition.scss +1 -1
  243. package/styles/mention/_fusionnew-definition.scss +1 -1
  244. package/styles/mention/_highcontrast-definition.scss +3 -3
  245. package/styles/mention/_highcontrast-light-definition.scss +3 -3
  246. package/styles/mention/_layout.scss +6 -6
  247. package/styles/mention/_material-dark-definition.scss +3 -3
  248. package/styles/mention/_material-definition.scss +3 -3
  249. package/styles/mention/_material3-definition.scss +1 -1
  250. package/styles/mention/_tailwind-definition.scss +1 -1
  251. package/styles/mention/material3-dark.scss +1 -1
  252. package/styles/mention/material3.scss +1 -1
  253. package/styles/multi-select/_all.scss +2 -2
  254. package/styles/multi-select/_bootstrap-dark-definition.scss +198 -198
  255. package/styles/multi-select/_bootstrap-definition.scss +192 -192
  256. package/styles/multi-select/_bootstrap4-definition.scss +278 -278
  257. package/styles/multi-select/_bootstrap5-definition.scss +229 -229
  258. package/styles/multi-select/_fabric-dark-definition.scss +187 -187
  259. package/styles/multi-select/_fabric-definition.scss +183 -183
  260. package/styles/multi-select/_fluent-definition.scss +240 -240
  261. package/styles/multi-select/_fusionnew-definition.scss +227 -227
  262. package/styles/multi-select/_highcontrast-definition.scss +298 -298
  263. package/styles/multi-select/_highcontrast-light-definition.scss +297 -297
  264. package/styles/multi-select/_layout.scss +2199 -2199
  265. package/styles/multi-select/_material-dark-definition.scss +230 -230
  266. package/styles/multi-select/_material-definition.scss +223 -223
  267. package/styles/multi-select/_material3-definition.scss +246 -246
  268. package/styles/multi-select/_tailwind-definition.scss +234 -234
  269. package/styles/multi-select/_theme.scss +586 -586
  270. package/styles/multi-select/icons/_bootstrap-dark.scss +26 -26
  271. package/styles/multi-select/icons/_bootstrap.scss +26 -26
  272. package/styles/multi-select/icons/_bootstrap4.scss +37 -37
  273. package/styles/multi-select/icons/_bootstrap5.scss +26 -26
  274. package/styles/multi-select/icons/_fabric-dark.scss +26 -26
  275. package/styles/multi-select/icons/_fabric.scss +26 -26
  276. package/styles/multi-select/icons/_fluent.scss +55 -55
  277. package/styles/multi-select/icons/_fusionnew.scss +26 -26
  278. package/styles/multi-select/icons/_highcontrast-light.scss +26 -26
  279. package/styles/multi-select/icons/_highcontrast.scss +26 -26
  280. package/styles/multi-select/icons/_material-dark.scss +693 -693
  281. package/styles/multi-select/icons/_material.scss +693 -693
  282. package/styles/multi-select/icons/_material3.scss +692 -692
  283. package/styles/multi-select/icons/_tailwind.scss +26 -26
  284. package/styles/multi-select/material3-dark.scss +1 -1
  285. package/styles/multi-select/material3.scss +1 -1
  286. package/styles/tailwind-dark.css +1 -1
  287. package/styles/tailwind.css +1 -1
  288. package/tslint.json +111 -0
  289. package/dist/ts/auto-complete/auto-complete.ts +0 -615
  290. package/dist/ts/combo-box/combo-box.ts +0 -1028
  291. package/dist/ts/common/highlight-search.ts +0 -57
  292. package/dist/ts/common/incremental-search.ts +0 -131
  293. package/dist/ts/common/interface.ts +0 -72
  294. package/dist/ts/common/virtual-scroll.ts +0 -354
  295. package/dist/ts/drop-down-base/drop-down-base.ts +0 -1838
  296. package/dist/ts/drop-down-list/drop-down-list.ts +0 -3889
  297. package/dist/ts/drop-down-tree/drop-down-tree.ts +0 -3750
  298. package/dist/ts/list-box/list-box.ts +0 -2736
  299. package/dist/ts/mention/mention.ts +0 -1828
  300. package/dist/ts/multi-select/checkbox-selection.ts +0 -547
  301. package/dist/ts/multi-select/float-label.ts +0 -176
  302. package/dist/ts/multi-select/interface.ts +0 -70
  303. package/dist/ts/multi-select/multi-select.ts +0 -4874
@@ -1,547 +0,0 @@
1
- import { createCheckBox } from '@syncfusion/ej2-buttons';
2
- import { IMulitSelect } from './interface';
3
- import { Input, InputObject } from '@syncfusion/ej2-inputs';
4
- import { EventHandler, select, removeClass, addClass, detach, compile, L10n } from '@syncfusion/ej2-base';
5
- import { Browser, attributes, isNullOrUndefined, KeyboardEventArgs, append, closest, prepend } from '@syncfusion/ej2-base';
6
- import { dropDownBaseClasses } from '../drop-down-base/drop-down-base';
7
- import { MultiSelectModel } from '../multi-select';
8
-
9
-
10
- const ICON: string = 'e-icons';
11
- const CHECKBOXFRAME: string = 'e-frame';
12
- const CHECK: string = 'e-check';
13
- const CHECKBOXWRAP: string = 'e-checkbox-wrapper';
14
- const INDETERMINATE: string = 'e-stop';
15
- const checkAllParent: string = 'e-selectall-parent';
16
- const searchBackIcon: string = 'e-input-group-icon e-back-icon e-icons';
17
- const filterBarClearIcon: string = 'e-input-group-icon e-clear-icon e-icons';
18
- const filterInput: string = 'e-input-filter';
19
- const filterParent: string = 'e-filter-parent';
20
- const mobileFilter: string = 'e-ddl-device-filter';
21
- const clearIcon: string = 'e-clear-icon';
22
- const popupFullScreen: string = 'e-popup-full-page';
23
- const device: string = 'e-ddl-device';
24
- const FOCUS: string = 'e-input-focus';
25
-
26
- /**
27
- * The Multiselect enable CheckBoxSelection call this inject module.
28
- */
29
-
30
- export class CheckBoxSelection {
31
- private parent: IMulitSelect;
32
- private checkAllParent: HTMLElement;
33
- private selectAllSpan: HTMLElement;
34
- public filterInput: HTMLInputElement;
35
- private filterInputObj: InputObject;
36
- private backIconElement: Element;
37
- private clearIconElement: Element;
38
- private checkWrapper: HTMLElement;
39
- public list: HTMLElement;
40
- private activeLi: HTMLElement[] = [];
41
- private activeEle: HTMLElement[] = [];
42
- public constructor(parent?: IMulitSelect) {
43
- this.parent = parent;
44
- this.removeEventListener();
45
- this.addEventListener();
46
- }
47
- public getModuleName(): string {
48
- return 'CheckBoxSelection';
49
- }
50
-
51
- public addEventListener(): void {
52
- if (this.parent.isDestroyed) {
53
- return;
54
- }
55
- this.parent.on('updatelist', this.listSelection, this);
56
- this.parent.on('listoption', this.listOption, this);
57
- this.parent.on('selectAll', this.setSelectAll, this);
58
- this.parent.on('checkSelectAll', this.checkSelectAll, this);
59
- this.parent.on('searchBox', this.setSearchBox, this);
60
- this.parent.on('blur', this.onBlurHandler, this);
61
- this.parent.on('targetElement', this.targetElement, this);
62
- this.parent.on('deviceSearchBox', this.setDeviceSearchBox, this);
63
- this.parent.on('inputFocus', this.getFocus, this);
64
- this.parent.on('reOrder', this.setReorder, this);
65
- this.parent.on('activeList', this.getActiveList, this);
66
- this.parent.on('selectAllText', this.setLocale, this);
67
- this.parent.on('filterBarPlaceholder', this.setPlaceholder, this);
68
- EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
69
- this.parent.on('addItem', this.checboxCreate, this);
70
- this.parent.on('popupFullScreen', this.setPopupFullScreen, this);
71
- }
72
- public removeEventListener(): void {
73
- if (this.parent.isDestroyed) {
74
- return;
75
- }
76
- this.parent.off('updatelist', this.listSelection);
77
- this.parent.off('listoption', this.listOption);
78
- this.parent.off('selectAll', this.setSelectAll);
79
- this.parent.off('checkSelectAll', this.checkSelectAll);
80
- this.parent.off('searchBox', this.setSearchBox);
81
- this.parent.off('blur', this.onBlurHandler);
82
- this.parent.off('targetElement', this.targetElement);
83
- this.parent.off('deviceSearchBox', this.setDeviceSearchBox);
84
- this.parent.off('inputFocus', this.getFocus);
85
- this.parent.off('reOrder', this.setReorder);
86
- this.parent.off('activeList', this.getActiveList);
87
- this.parent.off('selectAllText', this.setLocale);
88
- this.parent.off('filterBarPlaceholder', this.setPlaceholder);
89
- this.parent.off('addItem', this.checboxCreate);
90
- this.parent.off('popupFullScreen', this.setPopupFullScreen);
91
- }
92
-
93
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
- public listOption(args: { [key: string]: Object }): void {
95
- if (isNullOrUndefined(this.parent.listCurrentOptions.itemCreated)) {
96
- this.parent.listCurrentOptions.itemCreated = (e: { [key: string]: HTMLElement }) => {
97
- this.checboxCreate(e);
98
- };
99
- } else {
100
- const itemCreated: Function = <Function>this.parent.listCurrentOptions.itemCreated;
101
- this.parent.listCurrentOptions.itemCreated = (e: { [key: string]: HTMLElement }) => {
102
- this.checboxCreate(e);
103
- itemCreated.apply(this, [e]);
104
- };
105
- }
106
- }
107
- private setPlaceholder(props: MultiSelectModel): void {
108
- Input.setPlaceholder(props.filterBarPlaceholder, this.filterInput as HTMLInputElement);
109
- }
110
- private checboxCreate(e: { [key: string]: HTMLElement } | HTMLElement): { [key: string]: HTMLElement } | HTMLElement {
111
- let item: { [key: string]: HTMLElement } | HTMLElement;
112
- if (!isNullOrUndefined((e as { [key: string]: HTMLElement }).item)) {
113
- item = (e as { [key: string]: HTMLElement }).item;
114
- } else {
115
- item = e;
116
- }
117
- if (this.parent.enableGroupCheckBox || ((item as HTMLElement).className !== 'e-list-group-item '
118
- && (item as HTMLElement).className !== 'e-list-group-item')) {
119
- const checkboxEle: HTMLElement | Element | string = createCheckBox(this.parent.createElement, true);
120
- const icon: Element = select('div.' + ICON, (item as HTMLElement));
121
- (item as HTMLElement).insertBefore(checkboxEle, (item as HTMLElement).childNodes[isNullOrUndefined(icon) ? 0 : 1]);
122
- select('.' + CHECKBOXFRAME, checkboxEle);
123
- if (this.parent.enableGroupCheckBox ) {
124
- this.parent.popupWrapper.classList.add('e-multiselect-group');
125
- }
126
- return item;
127
- } else {
128
- return item;
129
- }
130
- }
131
-
132
- private setSelectAll(): void {
133
- if (this.parent.showSelectAll) {
134
- if (isNullOrUndefined(this.checkAllParent)) {
135
- this.checkAllParent = this.parent.createElement('div', {
136
- className: checkAllParent
137
- });
138
- this.selectAllSpan = this.parent.createElement('span', {
139
- className: 'e-all-text'
140
- });
141
- this.selectAllSpan.textContent = '';
142
- this.checkAllParent.appendChild(this.selectAllSpan);
143
- this.setLocale();
144
- this.checboxCreate(this.checkAllParent as { [key: string]: HTMLElement } | HTMLElement);
145
- if (this.parent.headerTemplate) {
146
- if (!isNullOrUndefined(this.parent.filterParent)) {
147
- append([this.checkAllParent], this.parent.filterParent);
148
- } else {
149
- append([this.checkAllParent], this.parent.popupWrapper);
150
- }
151
- }
152
- if (!this.parent.headerTemplate) {
153
- if (!isNullOrUndefined(this.parent.filterParent)) {
154
- this.parent.filterParent.parentNode.insertBefore(this.checkAllParent, this.parent.filterParent.nextSibling);
155
- } else {
156
- prepend([this.checkAllParent], this.parent.popupWrapper);
157
- }
158
- }
159
- EventHandler.add(this.checkAllParent, 'mousedown', this.clickHandler, this);
160
- }
161
- if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
162
- !(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
163
- this.parent.listData && this.parent.listData.length <= 1)) {
164
- this.checkAllParent.style.display = 'none';
165
- } else {
166
- this.checkAllParent.style.display = 'block';
167
- }
168
- this.parent.selectAllHeight = this.checkAllParent.getBoundingClientRect().height;
169
- } else if (!isNullOrUndefined(this.checkAllParent)) {
170
- this.checkAllParent.parentElement.removeChild(this.checkAllParent);
171
- this.checkAllParent = null;
172
- }
173
- }
174
-
175
- public destroy(): void {
176
- this.removeEventListener();
177
- EventHandler.remove(document, 'mousedown', this.onDocumentClick);
178
- this.checkAllParent = null;
179
- this.clearIconElement = null;
180
- this.filterInput = null;
181
- this.filterInputObj = null;
182
- this.checkWrapper = null;
183
- this.selectAllSpan = null;
184
- }
185
- public listSelection(args: IUpdateListArgs): void {
186
- let target: EventTarget;
187
- if (!isNullOrUndefined(args.e)) {
188
- const frameElm: Element = args.li.querySelector('.e-checkbox-wrapper .e-frame');
189
- target = !isNullOrUndefined(args.e.target) ?
190
- ((args.e.target as HTMLElement).classList.contains('e-frame')
191
- && (!this.parent.showSelectAll
192
- || ( this.checkAllParent && !this.checkAllParent.contains(args.e.target as Element)))) ?
193
- args.e.target : args.li.querySelector('.e-checkbox-wrapper').childNodes[1]
194
- : args.li.querySelector('.e-checkbox-wrapper').childNodes[1];
195
- } else {
196
- const checkboxWrapper: Element = args.li.querySelector('.e-checkbox-wrapper');
197
- target = checkboxWrapper ? checkboxWrapper.childNodes[1] : args.li.lastElementChild.childNodes[1];
198
- }
199
- if (this.parent.itemTemplate || this.parent.enableGroupCheckBox ) {
200
- target = args.li.firstElementChild.childNodes[1];
201
- }
202
- if (!isNullOrUndefined(target)) {
203
- this.checkWrapper = closest((target as HTMLElement), '.' + CHECKBOXWRAP) as HTMLElement;
204
- }
205
- if (!isNullOrUndefined(this.checkWrapper)) {
206
- const checkElement: Element = select('.' + CHECKBOXFRAME, this.checkWrapper);
207
- const selectAll: boolean = false;
208
- this.validateCheckNode(this.checkWrapper, checkElement.classList.contains(CHECK), args.li, args.e, selectAll);
209
- }
210
- }
211
- private validateCheckNode(
212
- checkWrap: HTMLElement | Element,
213
- isCheck: boolean, li?: HTMLElement | Element,
214
- e?: KeyboardEventArgs | MouseEvent, selectAll?: boolean): void {
215
- this.changeState(checkWrap, isCheck ? 'uncheck' : 'check', e, true, selectAll);
216
- }
217
- private clickHandler(e: MouseEvent): void {
218
- let target: EventTarget;
219
- if ((e.currentTarget as HTMLElement).classList.contains(this.checkAllParent.className) || ((e.currentTarget as HTMLElement).classList.value === this.checkAllParent.className)) {
220
- target = (e.currentTarget as HTMLElement).firstElementChild.lastElementChild;
221
- } else {
222
- target = <Element>e.currentTarget;
223
- }
224
- this.checkWrapper = closest((target as HTMLElement), '.' + CHECKBOXWRAP) as HTMLElement;
225
- const selectAll: boolean = true;
226
- if (!isNullOrUndefined(this.checkWrapper)) {
227
- const checkElement: Element = select('.' + CHECKBOXFRAME, this.checkWrapper);
228
- this.validateCheckNode(this.checkWrapper, checkElement.classList.contains(CHECK), null, e, selectAll);
229
- }
230
- e.preventDefault();
231
- }
232
- private changeState(
233
- wrapper: HTMLElement | Element, state: string, e?: MouseEvent | KeyboardEventArgs, isPrevent?: boolean, selectAll?: boolean): void {
234
- let ariaState: string;
235
- const frameSpan: Element = wrapper.getElementsByClassName(CHECKBOXFRAME)[0];
236
- if (state === 'check' && !frameSpan.classList.contains(CHECK)) {
237
- frameSpan.classList.remove(INDETERMINATE);
238
- frameSpan.classList.add(CHECK);
239
- ariaState = 'true';
240
- if (selectAll) {
241
- this.parent.selectAllItems(true, e as MouseEvent);
242
- this.setLocale(true);
243
- }
244
- } else if (state === 'uncheck' && (frameSpan.classList.contains(CHECK) || frameSpan.classList.contains(INDETERMINATE))) {
245
- removeClass([frameSpan], [CHECK, INDETERMINATE]);
246
- ariaState = 'false';
247
- if (selectAll) {
248
- this.parent.selectAllItems(false, e as MouseEvent);
249
- this.setLocale();
250
- }
251
- } else if (state === 'indeterminate' && !(frameSpan.classList.contains(INDETERMINATE))) {
252
- removeClass([frameSpan], [CHECK]);
253
- frameSpan.classList.add(INDETERMINATE);
254
- ariaState = 'false';
255
- if (selectAll) {
256
- this.parent.selectAllItems(false, e as MouseEvent);
257
- this.setLocale();
258
- }
259
- }
260
- }
261
- protected setSearchBox(args: IUpdateListArgs): InputObject | void {
262
- if (isNullOrUndefined(this.parent.filterParent)) {
263
- this.parent.filterParent = this.parent.createElement('span', {
264
- className: filterParent
265
- });
266
- this.filterInput = <HTMLInputElement>this.parent.createElement('input', {
267
- attrs: { type: 'text' },
268
- className: filterInput
269
- });
270
- this.parent.element.parentNode.insertBefore(this.filterInput, this.parent.element);
271
- let backIcon: boolean = false;
272
- if (Browser.isDevice) {
273
- backIcon = true;
274
- this.parent.mobFilter = false;
275
- }
276
- this.filterInputObj = Input.createInput(
277
- {
278
- element: this.filterInput,
279
- buttons: backIcon ? [searchBackIcon, filterBarClearIcon] : [filterBarClearIcon],
280
- properties: { placeholder: this.parent.filterBarPlaceholder }
281
- },
282
- this.parent.createElement
283
- );
284
- if (!isNullOrUndefined(this.parent.cssClass)) {
285
- if (this.parent.cssClass.split(' ').indexOf('e-outline') !== -1) {
286
- addClass([this.filterInputObj.container], 'e-outline');
287
- } else if (this.parent.cssClass.split(' ').indexOf('e-filled') !== -1) {
288
- addClass([this.filterInputObj.container], 'e-filled');
289
- }
290
- }
291
- append([this.filterInputObj.container], this.parent.filterParent);
292
- prepend([this.parent.filterParent], args.popupElement);
293
- attributes(this.filterInput, {
294
- 'aria-disabled': 'false',
295
- 'role': 'combobox',
296
- 'autocomplete': 'off',
297
- 'autocapitalize': 'off',
298
- 'spellcheck': 'false'
299
- });
300
- this.clearIconElement = this.filterInput.parentElement.querySelector('.' + clearIcon);
301
- if (!Browser.isDevice && this.clearIconElement) {
302
- EventHandler.add(this.clearIconElement, 'mousedown', this.clearText, this);
303
- (this.clearIconElement as HTMLElement).style.visibility = 'hidden';
304
- }
305
- EventHandler.add(this.filterInput, 'input', this.parent.onInput, this.parent);
306
- EventHandler.add(this.filterInput, 'keyup', this.parent.keyUp, this.parent);
307
- EventHandler.add(this.filterInput, 'keydown', this.parent.onKeyDown, this.parent);
308
- EventHandler.add(this.filterInput, 'blur', this.onBlurHandler, this);
309
- EventHandler.add(this.filterInput, 'paste', this.parent.pasteHandler, this.parent);
310
- this.parent.searchBoxHeight = (this.filterInputObj.container.parentElement).getBoundingClientRect().height;
311
- return this.filterInputObj;
312
- }
313
- }
314
-
315
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
316
- private clickOnBackIcon(e: EventHandler): void {
317
- this.parent.hidePopup();
318
- removeClass([document.body, this.parent.popupObj.element], popupFullScreen);
319
- this.parent.inputElement.focus();
320
- }
321
- private clearText(e: MouseEvent): void {
322
- (this.parent.targetInputElement as HTMLInputElement).value = '';
323
- if (this.parent.allowFiltering && (this.parent.targetInputElement as HTMLInputElement).value === '') {
324
- this.parent.search(null);
325
- }
326
- this.parent.refreshPopup();
327
- this.parent.refreshListItems(null);
328
- (this.clearIconElement as HTMLElement).style.visibility = 'hidden';
329
- this.filterInput.focus();
330
- this.setReorder(e);
331
- e.preventDefault();
332
- }
333
-
334
- private setDeviceSearchBox(): void {
335
- this.parent.popupObj.element.classList.add(device);
336
- this.parent.popupObj.element.classList.add(mobileFilter);
337
- this.parent.popupObj.position = { X: 0, Y: 0 };
338
- this.parent.popupObj.dataBind();
339
- this.setSearchBoxPosition();
340
- this.backIconElement = this.filterInputObj.container.querySelector('.e-back-icon');
341
- this.clearIconElement = this.filterInputObj.container.querySelector('.' + clearIcon);
342
- (this.clearIconElement as HTMLElement).style.visibility = 'hidden';
343
- EventHandler.add(this.backIconElement, 'click', this.clickOnBackIcon, this);
344
- EventHandler.add(this.clearIconElement, 'click', this.clearText, this);
345
- }
346
-
347
- private setSearchBoxPosition(): void {
348
- const searchBoxHeight: number = this.filterInput.parentElement.getBoundingClientRect().height;
349
- let selectAllHeight: number = 0;
350
- if (this.checkAllParent) {
351
- selectAllHeight = this.checkAllParent.getBoundingClientRect().height;
352
- }
353
- this.parent.popupObj.element.style.maxHeight = '100%';
354
- this.parent.popupObj.element.style.width = '100%';
355
- this.parent.list.style.maxHeight = (window.innerHeight - searchBoxHeight - selectAllHeight) + 'px';
356
- this.parent.list.style.height = (window.innerHeight - searchBoxHeight - selectAllHeight) + 'px';
357
- const clearElement: Element = this.filterInput.parentElement.querySelector('.' + clearIcon);
358
- detach(this.filterInput);
359
- clearElement.parentElement.insertBefore(this.filterInput, clearElement);
360
- }
361
-
362
- protected setPopupFullScreen(): void {
363
- if (this.parent && this.parent.popupObj) {
364
- attributes(this.parent.popupObj.element, { style: 'left:0px;right:0px;top:0px;bottom:0px;' });
365
- addClass([document.body, this.parent.popupObj.element], popupFullScreen);
366
- this.parent.popupObj.element.style.maxHeight = '100%';
367
- this.parent.popupObj.element.style.width = '100%';
368
- }
369
- }
370
-
371
- protected targetElement(): string {
372
- if (!isNullOrUndefined(this.clearIconElement)) {
373
- this.parent.targetInputElement = this.filterInput;
374
- (this.clearIconElement as HTMLElement).style.visibility = this.parent.targetInputElement.value === '' ? 'hidden' : 'visible';
375
- }
376
- return (this.parent.targetInputElement as HTMLInputElement).value;
377
- }
378
-
379
- private onBlurHandler(e: MouseEvent): void {
380
- if (!this.parent.element.classList.contains('e-listbox')) {
381
- let target: HTMLElement;
382
- if (this.parent.keyAction) {
383
- return;
384
- }
385
- if (Browser.isIE) {
386
- target = !isNullOrUndefined(e) && <HTMLElement>e.target;
387
- }
388
- if (!Browser.isIE) {
389
- target = !isNullOrUndefined(e) && <HTMLElement>e.relatedTarget;
390
- }
391
- // eslint-disable-next-line max-len
392
- if (this.parent.popupObj && document.body.contains(this.parent.popupObj.element) && this.parent.popupObj.element.contains(target)
393
- && !Browser.isIE && this.filterInput) {
394
- this.filterInput.focus();
395
- return;
396
- }
397
- if (this.parent.scrollFocusStatus && this.filterInput) {
398
- e.preventDefault();
399
- this.filterInput.focus();
400
- this.parent.scrollFocusStatus = false;
401
- return;
402
- }
403
- if (this.parent.popupObj && document.body.contains(this.parent.popupObj.element)
404
- && !this.parent.popupObj.element.classList.contains('e-popup-close')) {
405
- this.parent.inputFocus = false;
406
- this.parent.updateValueState(e, this.parent.value, this.parent.tempValues);
407
- this.parent.dispatchEvent(this.parent.hiddenElement as HTMLElement, 'change');
408
- }
409
- if (this.parent.popupObj && document.body.contains(this.parent.popupObj.element) &&
410
- !this.parent.popupObj.element.classList.contains('e-popup-close')) {
411
- this.parent.inputFocus = false;
412
- this.parent.overAllWrapper.classList.remove(FOCUS);
413
- this.parent.trigger('blur');
414
- this.parent.focused = true;
415
- }
416
- if (this.parent.popupObj && document.body.contains(this.parent.popupObj.element) &&
417
- !this.parent.popupObj.element.classList.contains('e-popup-close') && !Browser.isDevice) {
418
- this.parent.hidePopup();
419
- }
420
- }
421
- }
422
- protected onDocumentClick(e: MouseEvent): void {
423
- if (this.parent.getLocaleName() !== 'listbox') {
424
- const target: HTMLElement = <HTMLElement>e.target;
425
- if (!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]')) {
426
- if (!(this.filterInput && this.filterInput.value !== '')) {
427
- e.preventDefault();
428
- }
429
- }
430
- if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
431
- && !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target as Node)) {
432
- if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
433
- this.parent.inputFocus = false;
434
- this.parent.scrollFocusStatus = false;
435
- this.parent.hidePopup();
436
- this.parent.onBlurHandler(e, true);
437
- this.parent.focused = true;
438
- }
439
- } else {
440
- this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
441
- (document.activeElement === this.filterInput);
442
- }
443
- if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target as Node) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
444
- !this.parent.isPopupOpen()) {
445
- if (Browser.isIE) {
446
- this.parent.onBlurHandler();
447
- } else {
448
- this.parent.onBlurHandler(e);
449
- }
450
- }
451
- if (this.filterInput === target) {
452
- this.filterInput.focus();
453
- }
454
- }
455
- }
456
- private getFocus(e: IUpdateListArgs): void {
457
- this.parent.overAllWrapper.classList.remove(FOCUS);
458
- if (this.parent.keyAction && e.value !== 'clear' && e.value !== 'focus') {
459
- this.parent.keyAction = false;
460
- return;
461
- }
462
- if (e.value === 'focus') {
463
- this.filterInput.focus();
464
- this.parent.removeFocus();
465
- EventHandler.remove(this.parent.list, 'keydown', this.parent.onKeyDown);
466
- }
467
- if (e.value === 'clear') {
468
- this.filterInput.value = '';
469
- (this.clearIconElement as HTMLElement).style.visibility = 'hidden';
470
- }
471
- }
472
- private checkSelectAll(e: IUpdateListArgs): void {
473
- if (e.value === 'check') {
474
- this.changeState(this.checkAllParent, e.value, null, null, false);
475
- this.setLocale(true);
476
- }
477
- if (e.value === 'uncheck') {
478
- this.changeState(this.checkAllParent, e.value, null, null, false);
479
- this.setLocale();
480
- }
481
- if (e.value === 'indeterminate') {
482
- this.changeState(this.checkAllParent, e.value, null, null, false);
483
- this.setLocale();
484
- }
485
- }
486
- private setLocale(unSelect?: boolean): void {
487
- if (this.parent.selectAllText !== 'Select All' || this.parent.unSelectAllText !== 'Unselect All') {
488
- const template: string = unSelect ? this.parent.unSelectAllText : this.parent.selectAllText;
489
- this.selectAllSpan.textContent = '';
490
- const compiledString: Function = compile(template);
491
- const templateName: string = unSelect ? 'unSelectAllText' : 'selectAllText';
492
- for (const item of compiledString({}, this.parent, templateName, null, !this.parent.isStringTemplate)) {
493
- this.selectAllSpan.textContent = item.textContent;
494
- }
495
- } else {
496
- const l10nLocale: Object = { selectAllText: 'Select All', unSelectAllText: 'Unselect All' };
497
- let l10n: L10n = new L10n(this.parent.getLocaleName(), {}, this.parent.locale);
498
- if (l10n.getConstant('selectAllText') === '') {
499
- l10n = new L10n('dropdowns', l10nLocale, this.parent.locale);
500
- }
501
- this.selectAllSpan.textContent = unSelect ? l10n.getConstant('unSelectAllText') : l10n.getConstant('selectAllText');
502
- }
503
- }
504
- private getActiveList(args: IUpdateListArgs): void {
505
- if (args.li.classList.contains('e-active')) {
506
- this.activeLi.push(args.li.cloneNode(true) as HTMLElement);
507
- } else {
508
- this.activeLi.splice(args.index, 1);
509
- }
510
- }
511
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
512
- private setReorder(args: IUpdateListArgs | MouseEvent): void {
513
- if (this.parent.enableSelectionOrder && !isNullOrUndefined(this.parent.value)) {
514
- const activeLiCount: number = this.parent.ulElement.querySelectorAll('li.e-active').length;
515
- let remLi: NodeListOf<Element>;
516
- const ulEle: HTMLElement = this.parent.createElement('ul', {
517
- className: 'e-list-parent e-ul e-reorder'
518
- });
519
- if (activeLiCount > 0) {
520
- const activeListItems = this.parent.ulElement.querySelectorAll('li.e-active');
521
- activeListItems.forEach(item => {
522
- ulEle.appendChild(item);
523
- });
524
- remLi = this.parent.ulElement.querySelectorAll('li.e-active');
525
- addClass(remLi, 'e-reorder-hide');
526
- prepend([ulEle], this.parent.list);
527
- }
528
- this.parent.focusAtFirstListItem();
529
- }
530
- }
531
- }
532
-
533
- export interface ItemCreatedArgs {
534
- curData: { [key: string]: Object }
535
- item: HTMLElement
536
- text: string
537
- }
538
-
539
- export interface IUpdateListArgs {
540
- module: string
541
- enable: boolean
542
- li: HTMLElement
543
- e: MouseEvent | KeyboardEventArgs
544
- popupElement: HTMLElement
545
- value: string
546
- index: number
547
- }