@syncfusion/ej2-dropdowns 20.2.50 → 20.3.48

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 (361) hide show
  1. package/CHANGELOG.md +18 -24
  2. package/dist/ej2-dropdowns.min.js +10 -0
  3. package/dist/ej2-dropdowns.umd.min.js +2 -2
  4. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-dropdowns.es2015.js +1424 -51
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +1450 -55
  8. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  9. package/dist/global/ej2-dropdowns.min.js +2 -2
  10. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/mention.d.ts +4 -0
  13. package/mention.js +4 -0
  14. package/package.json +12 -12
  15. package/src/auto-complete/auto-complete.js +2 -2
  16. package/src/combo-box/combo-box.js +0 -3
  17. package/src/drop-down-base/drop-down-base.d.ts +2 -0
  18. package/src/drop-down-base/drop-down-base.js +8 -2
  19. package/src/drop-down-list/drop-down-list.d.ts +1 -0
  20. package/src/drop-down-list/drop-down-list.js +23 -22
  21. package/src/index.d.ts +1 -0
  22. package/src/index.js +1 -0
  23. package/src/list-box/list-box.js +16 -11
  24. package/src/mention/index.d.ts +5 -0
  25. package/src/mention/index.js +4 -0
  26. package/src/mention/mention-model.d.ts +285 -0
  27. package/src/mention/mention.d.ts +452 -0
  28. package/src/mention/mention.js +1383 -0
  29. package/src/multi-select/checkbox-selection.js +1 -4
  30. package/src/multi-select/multi-select.d.ts +1 -0
  31. package/src/multi-select/multi-select.js +20 -11
  32. package/styles/auto-complete/_all.scss +1 -1
  33. package/styles/auto-complete/_bootstrap-dark-definition.scss +1 -1
  34. package/styles/auto-complete/_bootstrap-definition.scss +1 -1
  35. package/styles/auto-complete/_bootstrap4-definition.scss +2 -2
  36. package/styles/auto-complete/_bootstrap5-definition.scss +1 -1
  37. package/styles/auto-complete/_fabric-dark-definition.scss +1 -1
  38. package/styles/auto-complete/_fabric-definition.scss +1 -1
  39. package/styles/auto-complete/_fluent-definition.scss +1 -1
  40. package/styles/auto-complete/_fusionnew-definition.scss +1 -1
  41. package/styles/auto-complete/_highcontrast-definition.scss +1 -1
  42. package/styles/auto-complete/_highcontrast-light-definition.scss +1 -1
  43. package/styles/auto-complete/_material-dark-definition.scss +1 -1
  44. package/styles/auto-complete/_material-definition.scss +1 -1
  45. package/styles/auto-complete/_material3-definition.scss +1 -1
  46. package/styles/auto-complete/_tailwind-definition.scss +1 -1
  47. package/styles/auto-complete/bootstrap-dark.css +3 -1
  48. package/styles/auto-complete/bootstrap.css +3 -1
  49. package/styles/auto-complete/bootstrap4.css +3 -1
  50. package/styles/auto-complete/bootstrap5-dark.css +3 -1
  51. package/styles/auto-complete/bootstrap5.css +3 -1
  52. package/styles/auto-complete/fabric-dark.css +3 -1
  53. package/styles/auto-complete/fabric.css +3 -1
  54. package/styles/auto-complete/fluent-dark.css +3 -1
  55. package/styles/auto-complete/fluent.css +3 -1
  56. package/styles/auto-complete/highcontrast-light.css +3 -1
  57. package/styles/auto-complete/highcontrast.css +3 -1
  58. package/styles/auto-complete/material-dark.css +3 -1
  59. package/styles/auto-complete/material.css +3 -1
  60. package/styles/auto-complete/tailwind-dark.css +3 -1
  61. package/styles/auto-complete/tailwind.css +3 -1
  62. package/styles/bootstrap-dark.css +94 -42
  63. package/styles/bootstrap-dark.scss +1 -0
  64. package/styles/bootstrap.css +94 -42
  65. package/styles/bootstrap.scss +1 -0
  66. package/styles/bootstrap4.css +95 -42
  67. package/styles/bootstrap4.scss +1 -0
  68. package/styles/bootstrap5-dark.css +101 -44
  69. package/styles/bootstrap5-dark.scss +1 -0
  70. package/styles/bootstrap5.css +101 -44
  71. package/styles/bootstrap5.scss +1 -0
  72. package/styles/combo-box/_all.scss +1 -1
  73. package/styles/combo-box/_bootstrap-dark-definition.scss +1 -1
  74. package/styles/combo-box/_bootstrap-definition.scss +1 -1
  75. package/styles/combo-box/_bootstrap4-definition.scss +2 -2
  76. package/styles/combo-box/_bootstrap5-definition.scss +1 -1
  77. package/styles/combo-box/_fabric-dark-definition.scss +1 -1
  78. package/styles/combo-box/_fabric-definition.scss +1 -1
  79. package/styles/combo-box/_fluent-definition.scss +1 -1
  80. package/styles/combo-box/_fusionnew-definition.scss +1 -1
  81. package/styles/combo-box/_highcontrast-definition.scss +1 -1
  82. package/styles/combo-box/_highcontrast-light-definition.scss +1 -1
  83. package/styles/combo-box/_material-dark-definition.scss +1 -1
  84. package/styles/combo-box/_material-definition.scss +1 -1
  85. package/styles/combo-box/_material3-definition.scss +1 -1
  86. package/styles/combo-box/_tailwind-definition.scss +1 -1
  87. package/styles/combo-box/bootstrap-dark.css +3 -1
  88. package/styles/combo-box/bootstrap.css +3 -1
  89. package/styles/combo-box/bootstrap4.css +3 -1
  90. package/styles/combo-box/bootstrap5-dark.css +3 -1
  91. package/styles/combo-box/bootstrap5.css +3 -1
  92. package/styles/combo-box/fabric-dark.css +3 -1
  93. package/styles/combo-box/fabric.css +3 -1
  94. package/styles/combo-box/fluent-dark.css +3 -1
  95. package/styles/combo-box/fluent.css +3 -1
  96. package/styles/combo-box/highcontrast-light.css +3 -1
  97. package/styles/combo-box/highcontrast.css +3 -1
  98. package/styles/combo-box/material-dark.css +3 -1
  99. package/styles/combo-box/material.css +3 -1
  100. package/styles/combo-box/tailwind-dark.css +3 -1
  101. package/styles/combo-box/tailwind.css +3 -1
  102. package/styles/drop-down-base/_all.scss +1 -1
  103. package/styles/drop-down-base/_bootstrap-dark-definition.scss +8 -2
  104. package/styles/drop-down-base/_bootstrap-definition.scss +6 -1
  105. package/styles/drop-down-base/_bootstrap4-definition.scss +6 -1
  106. package/styles/drop-down-base/_bootstrap5-definition.scss +8 -3
  107. package/styles/drop-down-base/_fabric-dark-definition.scss +6 -1
  108. package/styles/drop-down-base/_fabric-definition.scss +6 -1
  109. package/styles/drop-down-base/_fluent-definition.scss +8 -2
  110. package/styles/drop-down-base/_fusionnew-definition.scss +8 -3
  111. package/styles/drop-down-base/_highcontrast-definition.scss +16 -6
  112. package/styles/drop-down-base/_highcontrast-light-definition.scss +18 -7
  113. package/styles/drop-down-base/_layout.scss +44 -3
  114. package/styles/drop-down-base/_material-dark-definition.scss +7 -1
  115. package/styles/drop-down-base/_material-definition.scss +6 -0
  116. package/styles/drop-down-base/_material3-definition.scss +8 -3
  117. package/styles/drop-down-base/_tailwind-definition.scss +8 -3
  118. package/styles/drop-down-base/_theme.scss +4 -4
  119. package/styles/drop-down-base/bootstrap-dark.css +42 -1
  120. package/styles/drop-down-base/bootstrap.css +42 -1
  121. package/styles/drop-down-base/bootstrap4.css +42 -1
  122. package/styles/drop-down-base/bootstrap5-dark.css +42 -1
  123. package/styles/drop-down-base/bootstrap5.css +42 -1
  124. package/styles/drop-down-base/fabric-dark.css +42 -1
  125. package/styles/drop-down-base/fabric.css +42 -1
  126. package/styles/drop-down-base/fluent-dark.css +42 -1
  127. package/styles/drop-down-base/fluent.css +42 -1
  128. package/styles/drop-down-base/highcontrast-light.css +42 -1
  129. package/styles/drop-down-base/highcontrast.css +42 -1
  130. package/styles/drop-down-base/material-dark.css +42 -1
  131. package/styles/drop-down-base/material.css +42 -1
  132. package/styles/drop-down-base/tailwind-dark.css +42 -1
  133. package/styles/drop-down-base/tailwind.css +42 -1
  134. package/styles/drop-down-list/_all.scss +2 -1
  135. package/styles/drop-down-list/_bootstrap-dark-definition.scss +2 -1
  136. package/styles/drop-down-list/_bootstrap-definition.scss +2 -1
  137. package/styles/drop-down-list/_bootstrap4-definition.scss +3 -1
  138. package/styles/drop-down-list/_bootstrap5-definition.scss +3 -3
  139. package/styles/drop-down-list/_fabric-dark-definition.scss +2 -1
  140. package/styles/drop-down-list/_fabric-definition.scss +2 -0
  141. package/styles/drop-down-list/_fluent-definition.scss +2 -1
  142. package/styles/drop-down-list/_fusionnew-definition.scss +3 -3
  143. package/styles/drop-down-list/_highcontrast-definition.scss +21 -10
  144. package/styles/drop-down-list/_highcontrast-light-definition.scss +22 -11
  145. package/styles/drop-down-list/_layout.scss +8 -9
  146. package/styles/drop-down-list/_material-dark-definition.scss +2 -2
  147. package/styles/drop-down-list/_material-definition.scss +1 -0
  148. package/styles/drop-down-list/_material3-definition.scss +3 -3
  149. package/styles/drop-down-list/_tailwind-definition.scss +1 -0
  150. package/styles/drop-down-list/_theme.scss +3 -3
  151. package/styles/drop-down-list/bootstrap-dark.css +5 -0
  152. package/styles/drop-down-list/bootstrap.css +5 -0
  153. package/styles/drop-down-list/bootstrap4.css +5 -0
  154. package/styles/drop-down-list/bootstrap5-dark.css +6 -0
  155. package/styles/drop-down-list/bootstrap5.css +6 -0
  156. package/styles/drop-down-list/fabric-dark.css +5 -0
  157. package/styles/drop-down-list/fabric.css +5 -0
  158. package/styles/drop-down-list/fluent-dark.css +6 -0
  159. package/styles/drop-down-list/fluent.css +6 -0
  160. package/styles/drop-down-list/highcontrast-light.css +5 -0
  161. package/styles/drop-down-list/highcontrast.css +5 -0
  162. package/styles/drop-down-list/icons/_bootstrap.scss +0 -1
  163. package/styles/drop-down-list/icons/_fabric.scss +0 -1
  164. package/styles/drop-down-list/icons/_material.scss +0 -1
  165. package/styles/drop-down-list/material-dark.css +5 -0
  166. package/styles/drop-down-list/material.css +5 -0
  167. package/styles/drop-down-list/tailwind-dark.css +6 -0
  168. package/styles/drop-down-list/tailwind.css +6 -0
  169. package/styles/drop-down-tree/_all.scss +1 -1
  170. package/styles/drop-down-tree/_bootstrap-dark-definition.scss +1 -1
  171. package/styles/drop-down-tree/_bootstrap-definition.scss +1 -1
  172. package/styles/drop-down-tree/_bootstrap4-definition.scss +1 -1
  173. package/styles/drop-down-tree/_bootstrap5-definition.scss +2 -2
  174. package/styles/drop-down-tree/_fabric-dark-definition.scss +1 -1
  175. package/styles/drop-down-tree/_fabric-definition.scss +2 -2
  176. package/styles/drop-down-tree/_fluent-definition.scss +2 -2
  177. package/styles/drop-down-tree/_fusionnew-definition.scss +2 -2
  178. package/styles/drop-down-tree/_highcontrast-definition.scss +1 -1
  179. package/styles/drop-down-tree/_highcontrast-light-definition.scss +1 -1
  180. package/styles/drop-down-tree/_layout.scss +1 -2
  181. package/styles/drop-down-tree/_material-dark-definition.scss +2 -2
  182. package/styles/drop-down-tree/_material-definition.scss +2 -2
  183. package/styles/drop-down-tree/_material3-definition.scss +2 -2
  184. package/styles/drop-down-tree/_tailwind-definition.scss +2 -2
  185. package/styles/drop-down-tree/bootstrap-dark.css +4 -0
  186. package/styles/drop-down-tree/bootstrap.css +4 -0
  187. package/styles/drop-down-tree/bootstrap4.css +4 -0
  188. package/styles/drop-down-tree/bootstrap5-dark.css +5 -0
  189. package/styles/drop-down-tree/bootstrap5.css +5 -0
  190. package/styles/drop-down-tree/fabric-dark.css +4 -0
  191. package/styles/drop-down-tree/fabric.css +4 -0
  192. package/styles/drop-down-tree/fluent-dark.css +5 -0
  193. package/styles/drop-down-tree/fluent.css +5 -0
  194. package/styles/drop-down-tree/highcontrast-light.css +4 -0
  195. package/styles/drop-down-tree/highcontrast.css +4 -0
  196. package/styles/drop-down-tree/icons/_bootstrap.scss +0 -1
  197. package/styles/drop-down-tree/icons/_bootstrap4.scss +0 -1
  198. package/styles/drop-down-tree/icons/_fabric.scss +0 -1
  199. package/styles/drop-down-tree/icons/_highcontrast-light.scss +0 -1
  200. package/styles/drop-down-tree/icons/_highcontrast.scss +0 -1
  201. package/styles/drop-down-tree/icons/_material-dark.scss +0 -1
  202. package/styles/drop-down-tree/icons/_material.scss +0 -1
  203. package/styles/drop-down-tree/material-dark.css +4 -0
  204. package/styles/drop-down-tree/material.css +4 -0
  205. package/styles/drop-down-tree/tailwind-dark.css +5 -0
  206. package/styles/drop-down-tree/tailwind.css +5 -0
  207. package/styles/fabric-dark.css +94 -42
  208. package/styles/fabric-dark.scss +1 -0
  209. package/styles/fabric.css +94 -42
  210. package/styles/fabric.scss +1 -0
  211. package/styles/fluent-dark.css +101 -44
  212. package/styles/fluent-dark.scss +1 -0
  213. package/styles/fluent.css +101 -44
  214. package/styles/fluent.scss +1 -0
  215. package/styles/highcontrast-light.css +97 -42
  216. package/styles/highcontrast-light.scss +1 -0
  217. package/styles/highcontrast.css +97 -42
  218. package/styles/highcontrast.scss +1 -0
  219. package/styles/list-box/_all.scss +1 -1
  220. package/styles/list-box/_bootstrap-dark-definition.scss +2 -0
  221. package/styles/list-box/_bootstrap-definition.scss +1 -0
  222. package/styles/list-box/_bootstrap4-definition.scss +1 -0
  223. package/styles/list-box/_bootstrap5-definition.scss +3 -0
  224. package/styles/list-box/_fabric-dark-definition.scss +3 -1
  225. package/styles/list-box/_fabric-definition.scss +1 -0
  226. package/styles/list-box/_fluent-definition.scss +3 -0
  227. package/styles/list-box/_fusionnew-definition.scss +1 -0
  228. package/styles/list-box/_highcontrast-definition.scss +1 -0
  229. package/styles/list-box/_highcontrast-light-definition.scss +3 -1
  230. package/styles/list-box/_layout.scss +8 -17
  231. package/styles/list-box/_material-dark-definition.scss +2 -0
  232. package/styles/list-box/_material-definition.scss +1 -0
  233. package/styles/list-box/_material3-definition.scss +1 -0
  234. package/styles/list-box/_tailwind-definition.scss +3 -0
  235. package/styles/list-box/_theme.scss +11 -25
  236. package/styles/list-box/bootstrap-dark.css +12 -33
  237. package/styles/list-box/bootstrap.css +14 -35
  238. package/styles/list-box/bootstrap4.css +14 -35
  239. package/styles/list-box/bootstrap5-dark.css +15 -36
  240. package/styles/list-box/bootstrap5.css +15 -36
  241. package/styles/list-box/fabric-dark.css +12 -33
  242. package/styles/list-box/fabric.css +14 -35
  243. package/styles/list-box/fluent-dark.css +15 -36
  244. package/styles/list-box/fluent.css +15 -36
  245. package/styles/list-box/highcontrast-light.css +12 -33
  246. package/styles/list-box/highcontrast.css +14 -35
  247. package/styles/list-box/icons/_bootstrap-dark.scss +2 -2
  248. package/styles/list-box/icons/_bootstrap.scss +1 -1
  249. package/styles/list-box/icons/_bootstrap4.scss +1 -1
  250. package/styles/list-box/icons/_bootstrap5.scss +1 -1
  251. package/styles/list-box/icons/_fabric-dark.scss +1 -1
  252. package/styles/list-box/icons/_fabric.scss +1 -1
  253. package/styles/list-box/icons/_fluent.scss +1 -1
  254. package/styles/list-box/icons/_fusionnew.scss +1 -1
  255. package/styles/list-box/icons/_highcontrast-light.scss +1 -1
  256. package/styles/list-box/icons/_highcontrast.scss +1 -1
  257. package/styles/list-box/icons/_material-dark.scss +1 -1
  258. package/styles/list-box/icons/_material.scss +2 -2
  259. package/styles/list-box/icons/_material3.scss +1 -1
  260. package/styles/list-box/icons/_tailwind-dark.scss +1 -1
  261. package/styles/list-box/icons/_tailwind.scss +1 -1
  262. package/styles/list-box/material-dark.css +12 -33
  263. package/styles/list-box/material.css +14 -35
  264. package/styles/list-box/tailwind-dark.css +15 -36
  265. package/styles/list-box/tailwind.css +15 -36
  266. package/styles/material-dark.css +94 -42
  267. package/styles/material-dark.scss +1 -0
  268. package/styles/material.css +94 -42
  269. package/styles/material.scss +1 -0
  270. package/styles/mention/_all.scss +1 -0
  271. package/styles/mention/_bootstrap-dark-definition.scss +3 -0
  272. package/styles/mention/_bootstrap-definition.scss +3 -0
  273. package/styles/mention/_bootstrap4-definition.scss +3 -0
  274. package/styles/mention/_bootstrap5-dark-definition.scss +1 -0
  275. package/styles/mention/_bootstrap5-definition.scss +1 -0
  276. package/styles/mention/_fabric-dark-definition.scss +2 -0
  277. package/styles/mention/_fabric-definition.scss +3 -0
  278. package/styles/mention/_fluent-dark-definition.scss +1 -0
  279. package/styles/mention/_fluent-definition.scss +1 -0
  280. package/styles/mention/_fusionnew-definition.scss +1 -0
  281. package/styles/mention/_highcontrast-definition.scss +3 -0
  282. package/styles/mention/_highcontrast-light-definition.scss +3 -0
  283. package/styles/mention/_layout.scss +6 -0
  284. package/styles/mention/_material-dark-definition.scss +3 -0
  285. package/styles/mention/_material-definition.scss +3 -0
  286. package/styles/mention/_material3-definition.scss +1 -0
  287. package/styles/mention/_tailwind-dark-definition.scss +1 -0
  288. package/styles/mention/_tailwind-definition.scss +1 -0
  289. package/styles/mention/bootstrap-dark.css +29 -0
  290. package/styles/mention/bootstrap-dark.scss +6 -0
  291. package/styles/mention/bootstrap.css +29 -0
  292. package/styles/mention/bootstrap.scss +6 -0
  293. package/styles/mention/bootstrap4.css +47 -0
  294. package/styles/mention/bootstrap4.scss +6 -0
  295. package/styles/mention/bootstrap5-dark.css +58 -0
  296. package/styles/mention/bootstrap5-dark.scss +6 -0
  297. package/styles/mention/bootstrap5.css +58 -0
  298. package/styles/mention/bootstrap5.scss +6 -0
  299. package/styles/mention/fabric-dark.css +29 -0
  300. package/styles/mention/fabric-dark.scss +6 -0
  301. package/styles/mention/fabric.css +29 -0
  302. package/styles/mention/fabric.scss +6 -0
  303. package/styles/mention/fluent-dark.css +58 -0
  304. package/styles/mention/fluent-dark.scss +6 -0
  305. package/styles/mention/fluent.css +58 -0
  306. package/styles/mention/fluent.scss +6 -0
  307. package/styles/mention/highcontrast-light.css +43 -0
  308. package/styles/mention/highcontrast-light.scss +6 -0
  309. package/styles/mention/highcontrast.css +43 -0
  310. package/styles/mention/highcontrast.scss +6 -0
  311. package/styles/mention/material-dark.css +29 -0
  312. package/styles/mention/material-dark.scss +6 -0
  313. package/styles/mention/material.css +29 -0
  314. package/styles/mention/material.scss +6 -0
  315. package/styles/mention/tailwind-dark.css +68 -0
  316. package/styles/mention/tailwind-dark.scss +6 -0
  317. package/styles/mention/tailwind.css +68 -0
  318. package/styles/mention/tailwind.scss +6 -0
  319. package/styles/multi-select/_all.scss +1 -1
  320. package/styles/multi-select/_bootstrap-dark-definition.scss +4 -1
  321. package/styles/multi-select/_bootstrap-definition.scss +2 -0
  322. package/styles/multi-select/_bootstrap4-definition.scss +5 -2
  323. package/styles/multi-select/_bootstrap5-definition.scss +2 -2
  324. package/styles/multi-select/_fabric-dark-definition.scss +5 -3
  325. package/styles/multi-select/_fabric-definition.scss +4 -2
  326. package/styles/multi-select/_fluent-definition.scss +2 -1
  327. package/styles/multi-select/_fusionnew-definition.scss +2 -2
  328. package/styles/multi-select/_highcontrast-definition.scss +47 -24
  329. package/styles/multi-select/_highcontrast-light-definition.scss +48 -25
  330. package/styles/multi-select/_layout.scss +59 -71
  331. package/styles/multi-select/_material-dark-definition.scss +3 -1
  332. package/styles/multi-select/_material-definition.scss +1 -0
  333. package/styles/multi-select/_material3-definition.scss +2 -2
  334. package/styles/multi-select/_tailwind-definition.scss +2 -3
  335. package/styles/multi-select/_theme.scss +16 -21
  336. package/styles/multi-select/bootstrap-dark.css +10 -6
  337. package/styles/multi-select/bootstrap.css +10 -6
  338. package/styles/multi-select/bootstrap4.css +10 -6
  339. package/styles/multi-select/bootstrap5-dark.css +11 -6
  340. package/styles/multi-select/bootstrap5.css +11 -6
  341. package/styles/multi-select/fabric-dark.css +10 -6
  342. package/styles/multi-select/fabric.css +10 -6
  343. package/styles/multi-select/fluent-dark.css +11 -6
  344. package/styles/multi-select/fluent.css +11 -6
  345. package/styles/multi-select/highcontrast-light.css +13 -6
  346. package/styles/multi-select/highcontrast.css +13 -6
  347. package/styles/multi-select/icons/_bootstrap5.scss +0 -1
  348. package/styles/multi-select/icons/_fluent.scss +0 -1
  349. package/styles/multi-select/icons/_fusionnew.scss +0 -1
  350. package/styles/multi-select/icons/_material-dark.scss +53 -54
  351. package/styles/multi-select/icons/_material.scss +53 -54
  352. package/styles/multi-select/icons/_material3.scss +0 -1
  353. package/styles/multi-select/icons/_tailwind.scss +0 -1
  354. package/styles/multi-select/material-dark.css +10 -6
  355. package/styles/multi-select/material.css +10 -6
  356. package/styles/multi-select/tailwind-dark.css +11 -6
  357. package/styles/multi-select/tailwind.css +11 -6
  358. package/styles/tailwind-dark.css +102 -44
  359. package/styles/tailwind-dark.scss +1 -0
  360. package/styles/tailwind.css +102 -44
  361. package/styles/tailwind.scss +1 -0
@@ -0,0 +1,1383 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ import { KeyboardEvents, compile, Property, EventHandler, Animation, formatUnit, append, attributes } from '@syncfusion/ej2-base';
21
+ import { isNullOrUndefined, detach, Event, Complex, addClass, removeClass, closest, isUndefined, getValue, NotifyPropertyChanges, Browser } from '@syncfusion/ej2-base';
22
+ import { FieldSettings } from '../drop-down-base/drop-down-base';
23
+ import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
24
+ import { DataManager, Query } from '@syncfusion/ej2-data';
25
+ import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
26
+ import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
27
+ /**
28
+ * The Mention component is used to list someone or something based on user input in textarea, input,
29
+ * or any other editable element from which the user can select.
30
+ */
31
+ var Mention = /** @class */ (function (_super) {
32
+ __extends(Mention, _super);
33
+ /**
34
+ * * Constructor for creating the widget
35
+ *
36
+ * @param {MentionModel} options - Specifies the MentionComponent model.
37
+ * @param {string | HTMLElement} element - Specifies the element to render as component.
38
+ * @private
39
+ */
40
+ function Mention(options, element) {
41
+ return _super.call(this, options, element) || this;
42
+ }
43
+ /**
44
+ * When property value changes happened, then onPropertyChanged method will execute the respective changes in this component.
45
+ *
46
+ * @param {MentionModel} newProp - Returns the dynamic property value of the component.
47
+ * @param {MentionModel} oldProp - Returns the previous property value of the component.
48
+ * @private
49
+ * @returns {void}
50
+ */
51
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
52
+ Mention.prototype.onPropertyChanged = function (newProp, oldProp) {
53
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
54
+ var prop = _a[_i];
55
+ switch (prop) {
56
+ case 'minLength':
57
+ this.minLength = newProp.minLength;
58
+ break;
59
+ case 'suffixText':
60
+ this.suffixText = newProp.suffixText;
61
+ break;
62
+ case 'allowSpaces':
63
+ this.allowSpaces = newProp.allowSpaces;
64
+ break;
65
+ case 'mentionChar':
66
+ this.mentionChar = newProp.mentionChar;
67
+ break;
68
+ case 'showMentionChar':
69
+ this.showMentionChar = newProp.showMentionChar;
70
+ break;
71
+ case 'cssClass':
72
+ this.updateCssClass(newProp.cssClass, oldProp.cssClass);
73
+ break;
74
+ }
75
+ }
76
+ };
77
+ Mention.prototype.updateCssClass = function (newClass, oldClass) {
78
+ if (!isNullOrUndefined(oldClass)) {
79
+ oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
80
+ }
81
+ if (!isNullOrUndefined(newClass)) {
82
+ newClass = (newClass.replace(/\s+/g, ' ')).trim();
83
+ }
84
+ this.setCssClass(newClass, [this.inputElement], oldClass);
85
+ if (this.popupObj) {
86
+ this.setCssClass(newClass, [this.popupObj.element], oldClass);
87
+ }
88
+ };
89
+ Mention.prototype.setCssClass = function (cssClass, elements, oldClass) {
90
+ if (!isNullOrUndefined(oldClass) && oldClass !== '') {
91
+ removeClass(elements, oldClass.split(' '));
92
+ }
93
+ if (!isNullOrUndefined(cssClass) && cssClass !== '') {
94
+ addClass(elements, cssClass.split(' '));
95
+ }
96
+ };
97
+ Mention.prototype.initializeData = function () {
98
+ this.isSelected = false;
99
+ this.isFiltered = false;
100
+ this.beforePopupOpen = false;
101
+ this.initRemoteRender = false;
102
+ this.isPopupOpen = false;
103
+ this.isCollided = false;
104
+ this.lineBreak = false;
105
+ this.keyConfigure = {
106
+ tab: 'tab',
107
+ enter: '13',
108
+ escape: '27',
109
+ end: '35',
110
+ home: '36',
111
+ down: '40',
112
+ up: '38',
113
+ pageUp: '33',
114
+ pageDown: '34',
115
+ open: 'alt+40',
116
+ close: 'shift+tab',
117
+ hide: 'alt+38',
118
+ space: '32'
119
+ };
120
+ };
121
+ /**
122
+ * Execute before render the list items
123
+ *
124
+ * @private
125
+ * @returns {void}
126
+ */
127
+ Mention.prototype.preRender = function () {
128
+ this.initializeData();
129
+ _super.prototype.preRender.call(this);
130
+ };
131
+ /**
132
+ * To Initialize the control rendering
133
+ *
134
+ * @private
135
+ * @returns {void}
136
+ */
137
+ Mention.prototype.render = function () {
138
+ this.inputElement = !isNullOrUndefined(this.target) ? ((typeof this.target) === 'string') ?
139
+ document.querySelector(this.target) : this.target : this.element;
140
+ if (this.isContentEditable(this.inputElement)) {
141
+ this.inputElement.setAttribute('contenteditable', 'true');
142
+ addClass([this.inputElement], ['e-mention']);
143
+ if (isNullOrUndefined(this.target)) {
144
+ addClass([this.inputElement], ['e-editable-element']);
145
+ }
146
+ }
147
+ this.queryString = this.elementValue();
148
+ this.wireEvent();
149
+ };
150
+ Mention.prototype.wireEvent = function () {
151
+ EventHandler.add(this.inputElement, 'keyup', this.onKeyUp, this);
152
+ this.bindCommonEvent();
153
+ };
154
+ Mention.prototype.unWireEvent = function () {
155
+ EventHandler.remove(this.inputElement, 'keyup', this.onKeyUp);
156
+ this.unBindCommonEvent();
157
+ };
158
+ Mention.prototype.bindCommonEvent = function () {
159
+ if (!Browser.isDevice) {
160
+ this.keyboardModule = new KeyboardEvents(this.inputElement, {
161
+ keyAction: this.keyActionHandler.bind(this), keyConfigs: this.keyConfigure, eventName: 'keydown'
162
+ });
163
+ }
164
+ };
165
+ /**
166
+ * Hides the spinner loader.
167
+ *
168
+ * @returns {void}
169
+ */
170
+ Mention.prototype.hideSpinner = function () {
171
+ this.hideWaitingSpinner();
172
+ };
173
+ Mention.prototype.hideWaitingSpinner = function () {
174
+ if (!isNullOrUndefined(this.spinnerElement)) {
175
+ hideSpinner(this.spinnerElement);
176
+ }
177
+ if (!isNullOrUndefined(this.spinnerTemplate)) {
178
+ detach(this.spinnerTemplateElement);
179
+ }
180
+ };
181
+ /**
182
+ * Shows the spinner loader.
183
+ *
184
+ * @returns {void}
185
+ */
186
+ Mention.prototype.showWaitingSpinner = function () {
187
+ if (!isNullOrUndefined(this.popupObj)) {
188
+ if (isNullOrUndefined(this.spinnerTemplate) && isNullOrUndefined(this.spinnerElement)) {
189
+ this.spinnerElement = this.popupObj.element;
190
+ createSpinner({
191
+ target: this.spinnerElement,
192
+ width: Browser.isDevice ? '16px' : '14px'
193
+ }, this.createElement);
194
+ showSpinner(this.spinnerElement);
195
+ }
196
+ if (!isNullOrUndefined(this.spinnerTemplate)) {
197
+ this.setSpinnerTemplate();
198
+ this.popupObj.element.appendChild(this.spinnerTemplateElement);
199
+ }
200
+ }
201
+ };
202
+ Mention.prototype.keyActionHandler = function (e) {
203
+ var isNavigation = (e.action === 'down' || e.action === 'up' || e.action === 'pageUp' || e.action === 'pageDown'
204
+ || e.action === 'home' || e.action === 'end');
205
+ var isTabAction = e.action === 'tab' || e.action === 'close';
206
+ if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape') {
207
+ this.renderList();
208
+ }
209
+ if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
210
+ isNavigation && this.liCollections.length === 0) || this.isRequested) {
211
+ return;
212
+ }
213
+ if (e.action === 'escape') {
214
+ e.preventDefault();
215
+ }
216
+ this.isSelected = e.action === 'escape' ? false : this.isSelected;
217
+ switch (e.action) {
218
+ case 'down':
219
+ case 'up':
220
+ this.updateUpDownAction(e);
221
+ break;
222
+ case 'tab':
223
+ if (this.isPopupOpen) {
224
+ var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
225
+ if (li) {
226
+ this.setSelection(li, e);
227
+ }
228
+ if (this.isPopupOpen) {
229
+ this.hidePopup(e);
230
+ }
231
+ }
232
+ break;
233
+ case 'enter':
234
+ if (this.isPopupOpen) {
235
+ e.preventDefault();
236
+ if (this.popupObj && this.popupObj.element.contains(this.selectedLI)) {
237
+ this.setValue(e);
238
+ }
239
+ }
240
+ break;
241
+ case 'escape':
242
+ if (this.isPopupOpen) {
243
+ this.hidePopup(e);
244
+ }
245
+ break;
246
+ }
247
+ };
248
+ Mention.prototype.updateUpDownAction = function (e) {
249
+ var focusEle = this.list.querySelector('.' + dropDownBaseClasses.focus);
250
+ if (this.isSelectFocusItem(focusEle)) {
251
+ this.setSelection(focusEle, e);
252
+ }
253
+ else if (!isNullOrUndefined(this.liCollections)) {
254
+ var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
255
+ if (!isNullOrUndefined(li)) {
256
+ var value = this.getFormattedValue(li.getAttribute('data-value'));
257
+ this.activeIndex = this.getIndexByValue(value);
258
+ }
259
+ var index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
260
+ var startIndex = 0;
261
+ startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
262
+ index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
263
+ var nextItem = isNullOrUndefined(this.activeIndex) ? this.liCollections[startIndex] : this.liCollections[index];
264
+ if (!isNullOrUndefined(nextItem)) {
265
+ this.setSelection(nextItem, e);
266
+ }
267
+ }
268
+ if (this.isPopupOpen) {
269
+ e.preventDefault();
270
+ }
271
+ };
272
+ Mention.prototype.isSelectFocusItem = function (element) {
273
+ return !isNullOrUndefined(element);
274
+ };
275
+ Mention.prototype.unBindCommonEvent = function () {
276
+ if (!Browser.isDevice) {
277
+ this.keyboardModule.destroy();
278
+ }
279
+ };
280
+ Mention.prototype.onKeyUp = function (e) {
281
+ var rangetextContent;
282
+ if (this.isContentEditable(this.inputElement)) {
283
+ this.range = this.getCurrentRange();
284
+ rangetextContent = this.range.startContainer.textContent.split('');
285
+ }
286
+ var currentRange = this.getTextRange();
287
+ var lastWordRange = this.getLastLetter(currentRange);
288
+ var Regex = new RegExp(this.mentionChar, 'g');
289
+ var charRegex = new RegExp('[a-zA-Z]', 'g');
290
+ if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
291
+ return;
292
+ }
293
+ if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
294
+ (lastWordRange.match(Regex) && lastWordRange.match(Regex).length > 1) ||
295
+ (this.isContentEditable(this.inputElement) && this.range.startContainer &&
296
+ this.range.startContainer.previousElementSibling && this.range.startContainer.textContent.split('').length > 0 &&
297
+ (rangetextContent.length === 1 || rangetextContent[rangetextContent.length - 2].indexOf('') === -1 ||
298
+ this.range.startContainer.nodeType === 1))) {
299
+ if (this.allowSpaces && currentRange && currentRange.trim() !== '' && charRegex.test(currentRange) && currentRange.indexOf(this.mentionChar) !== -1
300
+ && !this.isMatchedText() && (currentRange.length > 1 && currentRange.replace(/\u00A0/g, ' ').charAt(currentRange.length - 2) !== ' ') &&
301
+ (this.list && this.list.querySelectorAll('ul').length > 0)) {
302
+ this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
303
+ this.searchLists(e);
304
+ }
305
+ else if (this.isPopupOpen && (!this.allowSpaces || !lastWordRange)) {
306
+ this.hidePopup();
307
+ this.lineBreak = true;
308
+ }
309
+ return;
310
+ }
311
+ this.queryString = lastWordRange.replace(this.mentionChar, '');
312
+ if (this.mentionChar.charCodeAt(0) === lastWordRange.charCodeAt(0) &&
313
+ this.queryString !== '' && e.keyCode !== 38 && e.keyCode !== 40 && !this.lineBreak) {
314
+ this.searchLists(e);
315
+ if (!this.isPopupOpen && this.queryString.length >= this.minLength) {
316
+ if (!this.isContentEditable(this.inputElement)) {
317
+ this.showPopup();
318
+ }
319
+ else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement) {
320
+ this.showPopup();
321
+ }
322
+ }
323
+ }
324
+ else if (lastWordRange.indexOf(this.mentionChar) === 0 && !this.isPopupOpen && e.keyCode !== 8 && (!this.popupObj ||
325
+ (isNullOrUndefined(this.target) && !document.body.contains(this.popupObj.element) ||
326
+ !isNullOrUndefined(this.target) && document.body.contains(this.popupObj.element)))) {
327
+ if (this.initRemoteRender && this.list && this.list.classList.contains('e-nodata')) {
328
+ this.searchLists(e);
329
+ }
330
+ this.resetList(this.dataSource, this.fields);
331
+ if (isNullOrUndefined(this.list)) {
332
+ this.initValue();
333
+ }
334
+ if (!this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
335
+ this.showPopup();
336
+ if (this.initRemoteRender && this.list.querySelectorAll('li').length === 0) {
337
+ this.showWaitingSpinner();
338
+ }
339
+ this.lineBreak = false;
340
+ }
341
+ }
342
+ else if (this.allowSpaces && this.queryString !== '' && currentRange && currentRange.trim() !== '' && currentRange.replace('\u00a0', ' ').lastIndexOf(' ') < currentRange.length - 1 &&
343
+ e.keyCode !== 38 && e.keyCode !== 40 && e.keyCode !== 8) {
344
+ this.queryString = currentRange.substring(currentRange.lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ');
345
+ this.searchLists(e);
346
+ }
347
+ else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
348
+ this.resetList(this.dataSource, this.fields);
349
+ }
350
+ };
351
+ Mention.prototype.isMatchedText = function () {
352
+ var isMatched = false;
353
+ for (var i = 0; i < (this.liCollections && this.liCollections.length); i++) {
354
+ if (this.getTextRange() &&
355
+ this.getTextRange().substring(this.getTextRange().lastIndexOf(this.mentionChar) + 1).replace('\u00a0', ' ').trim() === this.liCollections[i].getAttribute('data-value').toLowerCase()) {
356
+ isMatched = true;
357
+ }
358
+ }
359
+ return isMatched;
360
+ };
361
+ Mention.prototype.getCurrentRange = function () {
362
+ this.range = this.inputElement.ownerDocument.getSelection().getRangeAt(0);
363
+ return this.range;
364
+ };
365
+ Mention.prototype.searchLists = function (e) {
366
+ var _this = this;
367
+ this.isDataFetched = false;
368
+ if (isNullOrUndefined(this.list)) {
369
+ _super.prototype.render.call(this);
370
+ this.unWireListEvents();
371
+ this.wireListEvents();
372
+ }
373
+ if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
374
+ this.queryString = this.queryString === '' ? null : this.queryString;
375
+ this.beforePopupOpen = true;
376
+ this.resetList(this.dataSource, this.fields);
377
+ return;
378
+ }
379
+ this.isSelected = false;
380
+ this.activeIndex = null;
381
+ var eventArgs = {
382
+ preventDefaultAction: false,
383
+ text: this.elementValue(),
384
+ updateData: function (dataSource, query, fields) {
385
+ if (eventArgs.cancel) {
386
+ return;
387
+ }
388
+ _this.isFiltered = true;
389
+ _this.filterAction(dataSource, query, fields);
390
+ },
391
+ cancel: false
392
+ };
393
+ this.trigger('filtering', eventArgs, function (eventArgs) {
394
+ if (!eventArgs.cancel && !_this.isFiltered && !eventArgs.preventDefaultAction) {
395
+ _this.filterAction(_this.dataSource, null, _this.fields);
396
+ }
397
+ });
398
+ };
399
+ Mention.prototype.filterAction = function (dataSource, query, fields) {
400
+ this.beforePopupOpen = true;
401
+ if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
402
+ this.resetList(dataSource, fields, query);
403
+ }
404
+ else {
405
+ if (this.isPopupOpen) {
406
+ this.hidePopup();
407
+ }
408
+ this.beforePopupOpen = false;
409
+ }
410
+ this.setDataIndex();
411
+ this.renderReactTemplates();
412
+ };
413
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
414
+ Mention.prototype.onActionComplete = function (ulElement, list, e, isUpdated) {
415
+ _super.prototype.onActionComplete.call(this, ulElement, list, e);
416
+ if (this.isActive) {
417
+ if (!isNullOrUndefined(ulElement)) {
418
+ attributes(ulElement, { 'id': this.inputElement.id + '_options', 'role': 'listbox', 'aria-hidden': 'false' });
419
+ }
420
+ var focusItem = ulElement.querySelector('.' + dropDownBaseClasses.li);
421
+ if (focusItem) {
422
+ focusItem.classList.add(dropDownBaseClasses.selected);
423
+ this.selectedLI = focusItem;
424
+ var value = this.getFormattedValue(focusItem.getAttribute('data-value'));
425
+ this.selectEventCallback(focusItem, this.getDataByValue(value), value, true);
426
+ }
427
+ }
428
+ };
429
+ Mention.prototype.setDataIndex = function () {
430
+ for (var i = 0; this.liCollections && i < this.liCollections.length; i++) {
431
+ this.liCollections[i].setAttribute('data-index', i.toString());
432
+ }
433
+ };
434
+ Mention.prototype.listOption = function (dataSource, fieldsSettings) {
435
+ var _this = this;
436
+ var fields = _super.prototype.listOption.call(this, dataSource, fieldsSettings);
437
+ if (isNullOrUndefined(fields.itemCreated)) {
438
+ fields.itemCreated = function (e) {
439
+ if (_this.highlight) {
440
+ if (_this.inputElement.tagName === _this.getNgDirective() && _this.itemTemplate) {
441
+ setTimeout(function () {
442
+ highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
443
+ }, 0);
444
+ }
445
+ else {
446
+ highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
447
+ }
448
+ }
449
+ };
450
+ }
451
+ else {
452
+ var itemCreated_1 = fields.itemCreated;
453
+ fields.itemCreated = function (e) {
454
+ if (_this.highlight) {
455
+ highlightSearch(e.item, _this.queryString, _this.ignoreCase, _this.filterType);
456
+ }
457
+ itemCreated_1.apply(_this, [e]);
458
+ };
459
+ }
460
+ return fields;
461
+ };
462
+ Mention.prototype.elementValue = function () {
463
+ if (!this.isContentEditable(this.inputElement)) {
464
+ return this.inputElement.value.replace(this.mentionChar, '');
465
+ }
466
+ else {
467
+ return this.inputElement.textContent.replace(this.mentionChar, '');
468
+ }
469
+ };
470
+ Mention.prototype.getQuery = function (query) {
471
+ var filterQuery = query ? query.clone() : this.query ? this.query.clone() : new Query();
472
+ var filterType = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ? 'equal' : this.filterType;
473
+ var queryString = (this.queryString === '' && !isNullOrUndefined(this.elementValue())) ?
474
+ this.elementValue() : this.queryString;
475
+ if (this.isFiltered) {
476
+ return filterQuery;
477
+ }
478
+ if (this.queryString !== null && this.queryString !== '') {
479
+ var dataType = this.typeOfData(this.dataSource).typeof;
480
+ if (!(this.dataSource instanceof DataManager) && dataType === 'string' || dataType === 'number') {
481
+ filterQuery.where('', filterType, queryString, this.ignoreCase, this.ignoreAccent);
482
+ }
483
+ else {
484
+ var mapping = !isNullOrUndefined(this.fields.text) ? this.fields.text : '';
485
+ filterQuery.where(mapping, filterType, queryString, this.ignoreCase, this.ignoreAccent);
486
+ }
487
+ }
488
+ if (!isNullOrUndefined(this.suggestionCount)) {
489
+ // Since defualt value of suggestioncount is 25, checked the condition
490
+ if (this.suggestionCount !== 25) {
491
+ for (var queryElements = 0; queryElements < filterQuery.queries.length; queryElements++) {
492
+ if (filterQuery.queries[queryElements].fn === 'onTake') {
493
+ filterQuery.queries.splice(queryElements, 1);
494
+ }
495
+ }
496
+ }
497
+ filterQuery.take(this.suggestionCount);
498
+ }
499
+ return filterQuery;
500
+ };
501
+ Mention.prototype.renderHightSearch = function () {
502
+ if (this.highlight) {
503
+ for (var i = 0; i < this.liCollections.length; i++) {
504
+ var isHighlight = this.ulElement.querySelector('.e-active');
505
+ if (!isHighlight) {
506
+ revertHighlightSearch(this.liCollections[i]);
507
+ highlightSearch(this.liCollections[i], this.queryString, this.ignoreCase, this.filterType);
508
+ }
509
+ }
510
+ }
511
+ };
512
+ Mention.prototype.getTextRange = function () {
513
+ var text;
514
+ if (!this.isContentEditable(this.inputElement)) {
515
+ var component = this.inputElement;
516
+ if (!isNullOrUndefined(component)) {
517
+ var startPos = component.selectionStart;
518
+ if (component.value && startPos >= 0) {
519
+ text = component.value.substring(0, startPos);
520
+ }
521
+ }
522
+ }
523
+ else {
524
+ var selectedElem = this.range.startContainer;
525
+ if (!isNullOrUndefined(selectedElem)) {
526
+ var workingNodeContent = selectedElem.textContent;
527
+ var selectStartOffset = this.range.startOffset;
528
+ if (workingNodeContent && selectStartOffset >= 0) {
529
+ text = workingNodeContent.substring(0, selectStartOffset);
530
+ }
531
+ }
532
+ }
533
+ return text;
534
+ };
535
+ Mention.prototype.getLastLetter = function (text) {
536
+ if (isNullOrUndefined(text)) {
537
+ return '';
538
+ }
539
+ var textValue = text.replace(/\u00A0/g, ' ');
540
+ var words = textValue.split(/\s+/);
541
+ var wordCnt = words.length - 1;
542
+ return words[wordCnt].trim();
543
+ };
544
+ Mention.prototype.isContentEditable = function (element) {
545
+ return element && element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';
546
+ };
547
+ /**
548
+ * Opens the popup that displays the list of items.
549
+ *
550
+ * @returns {void}
551
+ */
552
+ Mention.prototype.showPopup = function () {
553
+ this.renderPopup();
554
+ attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
555
+ if (this.selectedElementID == null) {
556
+ this.inputElement.removeAttribute('aria-activedescendant');
557
+ }
558
+ };
559
+ /* eslint-disable valid-jsdoc, jsdoc/require-param */
560
+ /**
561
+ * Hides the popup if it is in an open state.
562
+ *
563
+ * @returns {void}
564
+ */
565
+ Mention.prototype.hidePopup = function (e) {
566
+ this.removeSelection();
567
+ this.closePopup(0, e);
568
+ };
569
+ Mention.prototype.closePopup = function (delay, e) {
570
+ var _this = this;
571
+ if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
572
+ return;
573
+ }
574
+ EventHandler.remove(document, 'mousedown', this.onDocumentClick);
575
+ this.inputElement.removeAttribute('aria-owns');
576
+ this.inputElement.removeAttribute('aria-activedescendant');
577
+ this.beforePopupOpen = false;
578
+ var animModel = {
579
+ name: 'FadeOut',
580
+ duration: 100,
581
+ delay: delay ? delay : 0
582
+ };
583
+ var popupInstance = this.popupObj;
584
+ var eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
585
+ this.trigger('closed', eventArgs, function (eventArgs) {
586
+ if (!eventArgs.cancel && _this.popupObj) {
587
+ if (_this.isPopupOpen) {
588
+ _this.popupObj.hide(new Animation(eventArgs.animation));
589
+ }
590
+ else {
591
+ _this.destroyPopup();
592
+ }
593
+ }
594
+ });
595
+ };
596
+ Mention.prototype.renderPopup = function () {
597
+ var _this = this;
598
+ var args = { cancel: false };
599
+ this.trigger('beforeOpen', args, function (args) {
600
+ if (!args.cancel) {
601
+ var popupEle_1 = isNullOrUndefined(_this.target) ? _this.createElement('div', {
602
+ id: _this.inputElement.id + '_popup', className: 'e-mention e-popup ' + (_this.cssClass != null ? _this.cssClass : '')
603
+ }) : _this.element;
604
+ if (!isNullOrUndefined(_this.target)) {
605
+ popupEle_1.id = _this.inputElement.id + '_popup';
606
+ addClass([popupEle_1], ['e-mention', 'e-popup', 'e-popup-close']);
607
+ }
608
+ _this.listHeight = formatUnit(_this.popupHeight);
609
+ if (!isNullOrUndefined(_this.list.querySelector('li')) && !_this.initRemoteRender) {
610
+ var li = _this.list.querySelector('.' + dropDownBaseClasses.focus);
611
+ if (!isNullOrUndefined(li)) {
612
+ _this.selectedLI = li;
613
+ var value = _this.getFormattedValue(li.getAttribute('data-value'));
614
+ _this.selectEventCallback(li, _this.getDataByValue(value), value, true);
615
+ }
616
+ }
617
+ append([_this.list], popupEle_1);
618
+ if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) || !document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
619
+ document.body.appendChild(popupEle_1);
620
+ }
621
+ var coordinates_1;
622
+ popupEle_1.style.visibility = 'hidden';
623
+ if (_this.popupHeight !== 'auto') {
624
+ _this.list.style.maxHeight = (parseInt(_this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
625
+ popupEle_1.style.maxHeight = formatUnit(_this.popupHeight);
626
+ }
627
+ else {
628
+ popupEle_1.style.height = 'auto';
629
+ }
630
+ var offsetValue = 0;
631
+ var left = 0;
632
+ _this.initializePopup(popupEle_1, offsetValue, left);
633
+ _this.checkCollision(popupEle_1);
634
+ popupEle_1.style.visibility = 'visible';
635
+ if (!isNullOrUndefined(_this.list)) {
636
+ _this.unWireListEvents();
637
+ _this.wireListEvents();
638
+ }
639
+ _this.selectedElementID = _this.selectedLI ? _this.selectedLI.id : null;
640
+ attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options', 'aria-activedescendant': _this.selectedElementID });
641
+ if (_this.selectedElementID == null) {
642
+ _this.inputElement.removeAttribute('aria-activedescendant');
643
+ }
644
+ var animModel = { name: 'FadeIn', duration: 100 };
645
+ _this.beforePopupOpen = true;
646
+ var popupInstance = _this.popupObj;
647
+ var eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
648
+ _this.trigger('opened', eventArgs, function (eventArgs) {
649
+ if (!eventArgs.cancel) {
650
+ _this.renderReactTemplates();
651
+ _this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.inputElement : null);
652
+ coordinates_1 = _this.getCoordinates(_this.inputElement, _this.getTriggerCharPosition());
653
+ if (!_this.isCollided) {
654
+ popupEle_1.style.cssText = 'top: '.concat(coordinates_1.top.toString(), 'px;\n left: ').concat(coordinates_1.left.toString(), 'px;\nposition: absolute;\n display: block;');
655
+ }
656
+ else {
657
+ popupEle_1.style.left = formatUnit(coordinates_1.left);
658
+ _this.isCollided = false;
659
+ }
660
+ popupEle_1.style.width = _this.popupWidth !== '100%' && !isNullOrUndefined(_this.popupWidth) ? formatUnit(_this.popupWidth) : 'auto';
661
+ }
662
+ else {
663
+ _this.beforePopupOpen = false;
664
+ _this.destroyPopup();
665
+ }
666
+ });
667
+ }
668
+ else {
669
+ _this.beforePopupOpen = false;
670
+ }
671
+ });
672
+ };
673
+ Mention.prototype.checkCollision = function (popupEle) {
674
+ if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
675
+ var collision = isCollide(popupEle);
676
+ if (collision.length > 0) {
677
+ popupEle.style.marginTop = -parseInt(getComputedStyle(popupEle).marginTop, 10) + 'px';
678
+ this.isCollided = true;
679
+ }
680
+ this.popupObj.resolveCollision();
681
+ }
682
+ };
683
+ Mention.prototype.getTriggerCharPosition = function () {
684
+ var mostRecentTriggerCharPos;
685
+ var currentRange = this.getTextRange();
686
+ if (currentRange !== undefined && currentRange !== null) {
687
+ mostRecentTriggerCharPos = 0;
688
+ var idx = currentRange.lastIndexOf(this.mentionChar);
689
+ if (idx >= mostRecentTriggerCharPos) {
690
+ mostRecentTriggerCharPos = idx;
691
+ }
692
+ }
693
+ return mostRecentTriggerCharPos;
694
+ };
695
+ Mention.prototype.initializePopup = function (element, offsetValue, left) {
696
+ var _this = this;
697
+ this.popupObj = new Popup(element, {
698
+ width: this.setWidth(), targetType: 'relative',
699
+ relateTo: this.inputElement, collision: { X: 'flip', Y: 'flip' }, offsetY: offsetValue,
700
+ enableRtl: this.enableRtl, offsetX: left, position: { X: 'top', Y: 'left' }, actionOnScroll: 'hide',
701
+ zIndex: this.zIndex,
702
+ close: function () {
703
+ _this.destroyPopup();
704
+ },
705
+ open: function () {
706
+ EventHandler.add(document, 'mousedown', _this.onDocumentClick, _this);
707
+ _this.isPopupOpen = true;
708
+ _this.setDataIndex();
709
+ }
710
+ });
711
+ };
712
+ Mention.prototype.setWidth = function () {
713
+ var width = formatUnit(this.popupWidth);
714
+ if (width.indexOf('%') > -1) {
715
+ var inputWidth = this.inputElement.offsetWidth * parseFloat(width) / 100;
716
+ width = inputWidth.toString() + 'px';
717
+ }
718
+ return width;
719
+ };
720
+ Mention.prototype.destroyPopup = function () {
721
+ this.isPopupOpen = false;
722
+ this.popupObj.destroy();
723
+ if (isNullOrUndefined(this.target)) {
724
+ detach(this.popupObj.element);
725
+ }
726
+ else {
727
+ this.popupObj.element.innerHTML = '';
728
+ this.popupObj.element.removeAttribute('style');
729
+ this.popupObj.element.removeAttribute('aria-disabled');
730
+ }
731
+ };
732
+ Mention.prototype.onDocumentClick = function (e) {
733
+ var target = e.target;
734
+ if (!(!isNullOrUndefined(this.popupObj) && closest(target, '#' + this.popupObj.element.id))) {
735
+ this.hidePopup(e);
736
+ }
737
+ };
738
+ Mention.prototype.getCoordinates = function (element, position) {
739
+ var properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing'];
740
+ var div;
741
+ var span;
742
+ var range;
743
+ var globalRange;
744
+ var coordinates;
745
+ var computed;
746
+ var rect;
747
+ if (!this.isContentEditable(this.inputElement)) {
748
+ div = this.createElement('div', { className: 'e-form-mirror-div' });
749
+ document.body.appendChild(div);
750
+ computed = getComputedStyle(element);
751
+ div.style.position = 'absolute';
752
+ div.style.visibility = 'hidden';
753
+ properties.forEach(function (prop) {
754
+ div.style[prop] = computed[prop];
755
+ });
756
+ div.textContent = element.value.substring(0, position);
757
+ if (this.inputElement.nodeName === 'INPUT') {
758
+ div.textContent = div.textContent.replace(/\s/g, '\u00a0');
759
+ }
760
+ span = this.createElement('span');
761
+ span.textContent = element.value.substring(position) || '.';
762
+ div.appendChild(span);
763
+ rect = element.getBoundingClientRect();
764
+ }
765
+ else {
766
+ var selectedNodePosition = this.getTriggerCharPosition();
767
+ globalRange = this.range;
768
+ range = document.createRange();
769
+ range.setStart(globalRange.startContainer, selectedNodePosition);
770
+ range.setEnd(globalRange.startContainer, selectedNodePosition);
771
+ range.collapse(false);
772
+ rect = range.getBoundingClientRect();
773
+ }
774
+ var doc = document.documentElement;
775
+ var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
776
+ var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
777
+ if (!this.isContentEditable(this.inputElement)) {
778
+ coordinates = {
779
+ top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth, 10) +
780
+ parseInt(computed.fontSize, 10) + 3 - element.scrollTop,
781
+ left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth, 10)
782
+ };
783
+ document.body.removeChild(div);
784
+ }
785
+ else {
786
+ coordinates = {
787
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize),
788
+ left: rect.left + windowLeft
789
+ };
790
+ }
791
+ return coordinates;
792
+ };
793
+ ;
794
+ Mention.prototype.initValue = function () {
795
+ this.renderList();
796
+ if (this.dataSource instanceof DataManager) {
797
+ this.initRemoteRender = true;
798
+ }
799
+ else {
800
+ this.updateValues();
801
+ }
802
+ };
803
+ Mention.prototype.updateValues = function () {
804
+ var li = this.list.querySelector('.' + dropDownBaseClasses.focus);
805
+ if (!isNullOrUndefined(li)) {
806
+ this.setSelection(li, null);
807
+ }
808
+ };
809
+ Mention.prototype.renderList = function () {
810
+ _super.prototype.render.call(this);
811
+ this.unWireListEvents();
812
+ this.wireListEvents();
813
+ };
814
+ /**
815
+ * Event binding for list
816
+ *
817
+ * @returns {void}
818
+ */
819
+ Mention.prototype.wireListEvents = function () {
820
+ EventHandler.add(this.list, 'click', this.onMouseClick, this);
821
+ EventHandler.add(this.list, 'mouseover', this.onMouseOver, this);
822
+ EventHandler.add(this.list, 'mouseout', this.onMouseLeave, this);
823
+ };
824
+ /**
825
+ * Event un binding for list items.
826
+ *
827
+ * @returns {void}
828
+ */
829
+ Mention.prototype.unWireListEvents = function () {
830
+ EventHandler.remove(this.list, 'click', this.onMouseClick);
831
+ EventHandler.remove(this.list, 'mouseover', this.onMouseOver);
832
+ EventHandler.remove(this.list, 'mouseout', this.onMouseLeave);
833
+ };
834
+ Mention.prototype.onMouseClick = function (e) {
835
+ var target = e.target;
836
+ var li = closest(target, '.' + dropDownBaseClasses.li);
837
+ if (!this.isValidLI(li)) {
838
+ return;
839
+ }
840
+ this.setSelection(li, e);
841
+ var delay = 100;
842
+ this.closePopup(delay, e);
843
+ this.inputElement.focus();
844
+ };
845
+ Mention.prototype.updateSelectedItem = function (li, e, preventSelect, isSelection) {
846
+ var _this = this;
847
+ this.removeSelection();
848
+ li.classList.add(dropDownBaseClasses.selected);
849
+ this.removeHover();
850
+ var value = this.getFormattedValue(li.getAttribute('data-value'));
851
+ var selectedData = this.getDataByValue(value);
852
+ if (!preventSelect && !isNullOrUndefined(e)) {
853
+ var items = this.detachChanges(selectedData);
854
+ this.isSelected = true;
855
+ var eventArgs = {
856
+ e: e,
857
+ item: li,
858
+ itemData: items,
859
+ isInteracted: e ? true : false,
860
+ cancel: false
861
+ };
862
+ this.trigger('select', eventArgs, function (eventArgs) {
863
+ if (eventArgs.cancel) {
864
+ li.classList.remove(dropDownBaseClasses.selected);
865
+ }
866
+ else {
867
+ _this.selectEventCallback(li, selectedData, value);
868
+ if (isSelection) {
869
+ _this.setSelectOptions(li, e);
870
+ }
871
+ }
872
+ });
873
+ }
874
+ else {
875
+ this.selectEventCallback(li, selectedData, value);
876
+ if (isSelection) {
877
+ this.setSelectOptions(li, e);
878
+ }
879
+ }
880
+ };
881
+ Mention.prototype.setSelection = function (li, e) {
882
+ if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
883
+ && li.classList.contains(dropDownBaseClasses.selected)))) {
884
+ this.updateSelectedItem(li, e, false, true);
885
+ }
886
+ else {
887
+ this.setSelectOptions(li, e);
888
+ }
889
+ };
890
+ Mention.prototype.setSelectOptions = function (li, e) {
891
+ if (this.list) {
892
+ this.removeHover();
893
+ }
894
+ this.previousSelectedLI = (!isNullOrUndefined(this.selectedLI)) ? this.selectedLI : null;
895
+ this.selectedLI = li;
896
+ if (this.isPopupOpen && !isNullOrUndefined(this.selectedLI)) {
897
+ this.setScrollPosition(e);
898
+ }
899
+ if (e && (e.keyCode === 38 || e.keyCode === 40)) {
900
+ return;
901
+ }
902
+ if (isNullOrUndefined(e) || this.setValue(e)) {
903
+ return;
904
+ }
905
+ };
906
+ Mention.prototype.setScrollPosition = function (e) {
907
+ if (!isNullOrUndefined(e)) {
908
+ switch (e.action) {
909
+ case 'pageDown':
910
+ case 'down':
911
+ case 'end':
912
+ this.scrollBottom();
913
+ break;
914
+ default:
915
+ this.scrollTop();
916
+ break;
917
+ }
918
+ }
919
+ else {
920
+ this.scrollBottom(true);
921
+ }
922
+ };
923
+ Mention.prototype.scrollBottom = function (isInitial) {
924
+ if (!isNullOrUndefined(this.selectedLI)) {
925
+ var currentOffset = this.list.offsetHeight;
926
+ var nextBottom = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
927
+ var nextOffset = this.list.scrollTop + nextBottom - currentOffset;
928
+ nextOffset = isInitial ? nextOffset + parseInt(getComputedStyle(this.list).paddingTop, 10) * 2 : nextOffset;
929
+ var boxRange = this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop;
930
+ if (this.activeIndex === 0) {
931
+ this.list.scrollTop = 0;
932
+ }
933
+ else if (nextBottom > currentOffset || !(boxRange > 0 && this.list.offsetHeight > boxRange)) {
934
+ this.list.scrollTop = nextOffset;
935
+ }
936
+ }
937
+ };
938
+ Mention.prototype.scrollTop = function () {
939
+ if (!isNullOrUndefined(this.selectedLI)) {
940
+ var nextOffset = this.selectedLI.offsetTop - this.list.scrollTop;
941
+ nextOffset = this.fields.groupBy && nextOffset;
942
+ var boxRange = (this.selectedLI.offsetTop + this.selectedLI.offsetHeight - this.list.scrollTop);
943
+ if (this.activeIndex === 0) {
944
+ this.list.scrollTop = 0;
945
+ }
946
+ else if (nextOffset < 0) {
947
+ this.list.scrollTop = this.list.scrollTop + nextOffset;
948
+ }
949
+ else if (!(boxRange > 0 && this.list.offsetHeight > boxRange)) {
950
+ this.list.scrollTop = this.selectedLI.offsetTop;
951
+ }
952
+ }
953
+ };
954
+ Mention.prototype.selectEventCallback = function (li, selectedData, value, selectLi) {
955
+ this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
956
+ this.item = li;
957
+ this.itemData = selectedData;
958
+ var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
959
+ if (focusedItem) {
960
+ removeClass([focusedItem], dropDownBaseClasses.focus);
961
+ }
962
+ if (selectLi) {
963
+ addClass([li], dropDownBaseClasses.selected);
964
+ }
965
+ li.setAttribute('aria-selected', 'true');
966
+ this.activeIndex = this.getIndexByValue(value);
967
+ };
968
+ Mention.prototype.detachChanges = function (value) {
969
+ var items;
970
+ if (typeof value === 'string' ||
971
+ typeof value === 'boolean' ||
972
+ typeof value === 'number') {
973
+ items = Object.defineProperties({}, {
974
+ value: {
975
+ value: value,
976
+ enumerable: true
977
+ },
978
+ text: {
979
+ value: value,
980
+ enumerable: true
981
+ }
982
+ });
983
+ }
984
+ else {
985
+ items = value;
986
+ }
987
+ return items;
988
+ };
989
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
990
+ Mention.prototype.setValue = function (e) {
991
+ var dataItem = this.getItemData();
992
+ var textSuffix;
993
+ var value;
994
+ var endPos;
995
+ var range;
996
+ var globalRange;
997
+ var selection = this.inputElement.ownerDocument.getSelection();
998
+ var startPos = this.getTriggerCharPosition();
999
+ textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
1000
+ if (dataItem.value !== null) {
1001
+ value = this.mentionVal(dataItem.text);
1002
+ }
1003
+ if (!this.isContentEditable(this.inputElement)) {
1004
+ var myField = this.inputElement;
1005
+ var currentTriggerSnippet = this.getTextRange().substring(startPos + this.mentionChar.length, this.getTextRange().length);
1006
+ value += textSuffix;
1007
+ endPos = startPos + this.mentionChar.length;
1008
+ endPos += currentTriggerSnippet.length;
1009
+ myField.value = myField.value.substring(0, startPos) + value + myField.value.substring(endPos, myField.value.length);
1010
+ myField.selectionStart = startPos + value.length;
1011
+ myField.selectionEnd = startPos + value.length;
1012
+ if (this.isPopupOpen) {
1013
+ this.hidePopup();
1014
+ }
1015
+ this.onChangeEvent(e);
1016
+ return true;
1017
+ }
1018
+ else {
1019
+ endPos = this.getTriggerCharPosition() + this.mentionChar.length;
1020
+ if (this.range && (this.range.startContainer.textContent.trim() !== this.mentionChar)) {
1021
+ endPos = this.range.endOffset;
1022
+ }
1023
+ globalRange = this.range;
1024
+ range = document.createRange();
1025
+ range.setStart(globalRange.startContainer, startPos);
1026
+ range.setEnd(globalRange.startContainer, endPos);
1027
+ range.deleteContents();
1028
+ var element = this.createElement('div');
1029
+ element.innerHTML = value;
1030
+ var frag = document.createDocumentFragment();
1031
+ var node = void 0;
1032
+ var lastNode = void 0;
1033
+ while (node = element.firstChild) {
1034
+ lastNode = frag.appendChild(node);
1035
+ }
1036
+ range.insertNode(frag);
1037
+ if (lastNode) {
1038
+ range = range.cloneRange();
1039
+ range.setStartAfter(lastNode);
1040
+ range.collapse(true);
1041
+ selection.removeAllRanges();
1042
+ selection.addRange(range);
1043
+ }
1044
+ if (this.isPopupOpen) {
1045
+ this.hidePopup();
1046
+ }
1047
+ this.onChangeEvent(e);
1048
+ return true;
1049
+ }
1050
+ };
1051
+ Mention.prototype.mentionVal = function (value) {
1052
+ var showChar = this.showMentionChar ? this.mentionChar : '';
1053
+ if (!isNullOrUndefined(this.displayTemplate)) {
1054
+ value = this.setDisplayTemplate();
1055
+ }
1056
+ if (this.isContentEditable(this.inputElement)) {
1057
+ return '<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : ' ');
1058
+ }
1059
+ else {
1060
+ return showChar + value;
1061
+ }
1062
+ };
1063
+ Mention.prototype.setDisplayTemplate = function () {
1064
+ var compiledString;
1065
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1066
+ if (this.isReact) {
1067
+ this.clearTemplate(['displayTemplate']);
1068
+ if (this.displayTempElement) {
1069
+ detach(this.displayTempElement);
1070
+ this.displayTempElement = null;
1071
+ }
1072
+ }
1073
+ if (!this.displayTempElement) {
1074
+ this.displayTempElement = this.createElement('div');
1075
+ }
1076
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1077
+ if (!this.isReact) {
1078
+ this.displayTempElement.innerHTML = '';
1079
+ }
1080
+ compiledString = compile(this.displayTemplate);
1081
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1082
+ var displayCompTemp = compiledString(this.itemData, this, 'displayTemplate', this.displayTemplateId, this.isStringTemplate, null, this.displayTempElement);
1083
+ if (displayCompTemp && displayCompTemp.length > 0) {
1084
+ for (var i = 0; i < displayCompTemp.length; i++) {
1085
+ this.displayTempElement.appendChild(displayCompTemp[i]);
1086
+ }
1087
+ }
1088
+ this.renderReactTemplates();
1089
+ return this.displayTempElement.innerHTML;
1090
+ };
1091
+ Mention.prototype.setSpinnerTemplate = function () {
1092
+ var compiledString;
1093
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1094
+ if (this.isReact) {
1095
+ this.clearTemplate(['spinnerTemplate']);
1096
+ if (this.spinnerTemplateElement) {
1097
+ detach(this.spinnerTemplateElement);
1098
+ this.spinnerTemplateElement = null;
1099
+ }
1100
+ }
1101
+ if (!this.spinnerTemplateElement) {
1102
+ this.spinnerTemplateElement = this.createElement('div');
1103
+ }
1104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1105
+ if (!this.isReact) {
1106
+ this.spinnerTemplateElement.innerHTML = '';
1107
+ }
1108
+ compiledString = compile(this.spinnerTemplate);
1109
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1110
+ var spinnerCompTemp = compiledString(null, this, 'spinnerTemplate', this.spinnerTemplateId, this.isStringTemplate, null, this.spinnerTemplateElement);
1111
+ if (spinnerCompTemp && spinnerCompTemp.length > 0) {
1112
+ for (var i = 0; i < spinnerCompTemp.length; i++) {
1113
+ this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
1114
+ }
1115
+ }
1116
+ this.renderReactTemplates();
1117
+ };
1118
+ Mention.prototype.onChangeEvent = function (eve) {
1119
+ this.isSelected = false;
1120
+ var items = this.detachMentionChanges(this.itemData);
1121
+ var preItems;
1122
+ if (typeof this.previousItemData === 'string' ||
1123
+ typeof this.previousItemData === 'boolean' ||
1124
+ typeof this.previousItemData === 'number') {
1125
+ preItems = Object.defineProperties({}, {
1126
+ value: {
1127
+ value: this.previousItemData,
1128
+ enumerable: true
1129
+ },
1130
+ text: {
1131
+ value: this.previousItemData,
1132
+ enumerable: true
1133
+ }
1134
+ });
1135
+ }
1136
+ else {
1137
+ preItems = this.previousItemData;
1138
+ }
1139
+ var eventArgs = {
1140
+ e: eve,
1141
+ item: this.item,
1142
+ itemData: items,
1143
+ previousItem: this.previousSelectedLI,
1144
+ previousItemData: preItems,
1145
+ isInteracted: eve ? true : false,
1146
+ value: this.item.innerHTML,
1147
+ element: this.inputElement
1148
+ };
1149
+ this.trigger('change', eventArgs);
1150
+ };
1151
+ Mention.prototype.detachMentionChanges = function (value) {
1152
+ var items;
1153
+ if (typeof value === 'string' ||
1154
+ typeof value === 'boolean' ||
1155
+ typeof value === 'number') {
1156
+ items = Object.defineProperties({}, {
1157
+ value: {
1158
+ value: value,
1159
+ enumerable: true
1160
+ },
1161
+ text: {
1162
+ value: value,
1163
+ enumerable: true
1164
+ }
1165
+ });
1166
+ }
1167
+ else {
1168
+ items = value;
1169
+ }
1170
+ return items;
1171
+ };
1172
+ Mention.prototype.getItemData = function () {
1173
+ var fields = this.fields;
1174
+ var dataItem = null;
1175
+ dataItem = this.itemData;
1176
+ var dataValue;
1177
+ var dataText;
1178
+ if (!isNullOrUndefined(dataItem)) {
1179
+ dataValue = getValue(fields.value, dataItem);
1180
+ dataText = getValue(fields.text, dataItem);
1181
+ }
1182
+ var value = (!isNullOrUndefined(dataItem) &&
1183
+ !isUndefined(dataValue) ? dataValue : dataItem);
1184
+ var text = (!isNullOrUndefined(dataItem) &&
1185
+ !isUndefined(dataValue) ? dataText : dataItem);
1186
+ return { value: value, text: text };
1187
+ };
1188
+ Mention.prototype.removeSelection = function () {
1189
+ if (this.list) {
1190
+ var selectedItems = this.list.querySelectorAll('.' + dropDownBaseClasses.selected);
1191
+ if (selectedItems.length) {
1192
+ removeClass(selectedItems, dropDownBaseClasses.selected);
1193
+ selectedItems[0].removeAttribute('aria-selected');
1194
+ }
1195
+ }
1196
+ };
1197
+ Mention.prototype.onMouseOver = function (e) {
1198
+ var currentLi = closest(e.target, '.' + dropDownBaseClasses.li);
1199
+ this.setHover(currentLi);
1200
+ };
1201
+ Mention.prototype.setHover = function (li) {
1202
+ if (this.enabled && this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
1203
+ this.removeHover();
1204
+ addClass([li], dropDownBaseClasses.hover);
1205
+ }
1206
+ };
1207
+ Mention.prototype.removeHover = function () {
1208
+ if (this.list) {
1209
+ var hoveredItem = this.list.querySelectorAll('.' + dropDownBaseClasses.hover);
1210
+ if (hoveredItem && hoveredItem.length) {
1211
+ removeClass(hoveredItem, dropDownBaseClasses.hover);
1212
+ }
1213
+ }
1214
+ };
1215
+ Mention.prototype.isValidLI = function (li) {
1216
+ return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
1217
+ };
1218
+ Mention.prototype.onMouseLeave = function () {
1219
+ this.removeHover();
1220
+ };
1221
+ /**
1222
+ * Search the entered text and show it in the suggestion list if available.
1223
+ *
1224
+ * @returns {void}
1225
+ */
1226
+ Mention.prototype.search = function (text, positionX, positionY) {
1227
+ if ((this.ignoreCase && (text === this.elementValue() || text === this.elementValue().toLowerCase()))
1228
+ || !this.ignoreCase && text === this.elementValue()) {
1229
+ this.resetList(this.dataSource, this.fields);
1230
+ }
1231
+ else {
1232
+ if (this.isPopupOpen) {
1233
+ this.hidePopup();
1234
+ }
1235
+ return;
1236
+ }
1237
+ if (isNullOrUndefined(this.list)) {
1238
+ this.renderList();
1239
+ this.renderPopup();
1240
+ }
1241
+ else {
1242
+ this.showPopup();
1243
+ }
1244
+ this.popupObj.element.style.left = formatUnit(positionX);
1245
+ this.popupObj.element.style.top = formatUnit(positionY);
1246
+ };
1247
+ /**
1248
+ * Removes the component from the DOM and detaches all its related event handlers. Also it removes the attributes and classes.
1249
+ *
1250
+ * @method destroy
1251
+ * @returns {void}
1252
+ */
1253
+ Mention.prototype.destroy = function () {
1254
+ this.hidePopup();
1255
+ this.unWireEvent();
1256
+ if (this.list) {
1257
+ this.unWireListEvents();
1258
+ }
1259
+ if (this.inputElement && !this.inputElement.classList.contains('e-' + this.getModuleName())) {
1260
+ return;
1261
+ }
1262
+ _super.prototype.destroy.call(this);
1263
+ };
1264
+ Mention.prototype.getLocaleName = function () {
1265
+ return 'mention';
1266
+ };
1267
+ Mention.prototype.getNgDirective = function () {
1268
+ return 'EJS-MENTION';
1269
+ };
1270
+ /**
1271
+ * Return the module name of this component.
1272
+ *
1273
+ * @private
1274
+ * @returns {string} Return the module name of this component.
1275
+ */
1276
+ Mention.prototype.getModuleName = function () {
1277
+ return 'mention';
1278
+ };
1279
+ __decorate([
1280
+ Property(null)
1281
+ ], Mention.prototype, "cssClass", void 0);
1282
+ __decorate([
1283
+ Property('@')
1284
+ ], Mention.prototype, "mentionChar", void 0);
1285
+ __decorate([
1286
+ Property(false)
1287
+ ], Mention.prototype, "showMentionChar", void 0);
1288
+ __decorate([
1289
+ Property(false)
1290
+ ], Mention.prototype, "allowSpaces", void 0);
1291
+ __decorate([
1292
+ Property(null)
1293
+ ], Mention.prototype, "suffixText", void 0);
1294
+ __decorate([
1295
+ Property(25)
1296
+ ], Mention.prototype, "suggestionCount", void 0);
1297
+ __decorate([
1298
+ Property(0)
1299
+ ], Mention.prototype, "minLength", void 0);
1300
+ __decorate([
1301
+ Property('None')
1302
+ ], Mention.prototype, "sortOrder", void 0);
1303
+ __decorate([
1304
+ Property(true)
1305
+ ], Mention.prototype, "ignoreCase", void 0);
1306
+ __decorate([
1307
+ Property(false)
1308
+ ], Mention.prototype, "highlight", void 0);
1309
+ __decorate([
1310
+ Property()
1311
+ ], Mention.prototype, "locale", void 0);
1312
+ __decorate([
1313
+ Property('auto')
1314
+ ], Mention.prototype, "popupWidth", void 0);
1315
+ __decorate([
1316
+ Property('300px')
1317
+ ], Mention.prototype, "popupHeight", void 0);
1318
+ __decorate([
1319
+ Property(null)
1320
+ ], Mention.prototype, "displayTemplate", void 0);
1321
+ __decorate([
1322
+ Property(null)
1323
+ ], Mention.prototype, "itemTemplate", void 0);
1324
+ __decorate([
1325
+ Property('No records found')
1326
+ ], Mention.prototype, "noRecordsTemplate", void 0);
1327
+ __decorate([
1328
+ Property(null)
1329
+ ], Mention.prototype, "spinnerTemplate", void 0);
1330
+ __decorate([
1331
+ Property()
1332
+ ], Mention.prototype, "target", void 0);
1333
+ __decorate([
1334
+ Property([])
1335
+ ], Mention.prototype, "dataSource", void 0);
1336
+ __decorate([
1337
+ Property(null)
1338
+ ], Mention.prototype, "query", void 0);
1339
+ __decorate([
1340
+ Property('Contains')
1341
+ ], Mention.prototype, "filterType", void 0);
1342
+ __decorate([
1343
+ Complex({ text: null, value: null, iconCss: null, groupBy: null }, FieldSettings)
1344
+ ], Mention.prototype, "fields", void 0);
1345
+ __decorate([
1346
+ Event()
1347
+ ], Mention.prototype, "actionBegin", void 0);
1348
+ __decorate([
1349
+ Event()
1350
+ ], Mention.prototype, "actionComplete", void 0);
1351
+ __decorate([
1352
+ Event()
1353
+ ], Mention.prototype, "actionFailure", void 0);
1354
+ __decorate([
1355
+ Event()
1356
+ ], Mention.prototype, "change", void 0);
1357
+ __decorate([
1358
+ Event()
1359
+ ], Mention.prototype, "beforeOpen", void 0);
1360
+ __decorate([
1361
+ Event()
1362
+ ], Mention.prototype, "opened", void 0);
1363
+ __decorate([
1364
+ Event()
1365
+ ], Mention.prototype, "closed", void 0);
1366
+ __decorate([
1367
+ Event()
1368
+ ], Mention.prototype, "select", void 0);
1369
+ __decorate([
1370
+ Event()
1371
+ ], Mention.prototype, "filtering", void 0);
1372
+ __decorate([
1373
+ Event()
1374
+ ], Mention.prototype, "created", void 0);
1375
+ __decorate([
1376
+ Event()
1377
+ ], Mention.prototype, "destroyed", void 0);
1378
+ Mention = __decorate([
1379
+ NotifyPropertyChanges
1380
+ ], Mention);
1381
+ return Mention;
1382
+ }(DropDownBase));
1383
+ export { Mention };