primevue 3.15.0 → 3.16.2

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 (387) hide show
  1. package/autocomplete/AutoComplete.d.ts +182 -38
  2. package/autocomplete/AutoComplete.vue +636 -342
  3. package/autocomplete/autocomplete.cjs.js +745 -416
  4. package/autocomplete/autocomplete.cjs.min.js +1 -1
  5. package/autocomplete/autocomplete.esm.js +747 -418
  6. package/autocomplete/autocomplete.esm.min.js +1 -1
  7. package/autocomplete/autocomplete.js +745 -416
  8. package/autocomplete/autocomplete.min.js +1 -1
  9. package/button/Button.vue +4 -1
  10. package/button/button.cjs.js +5 -1
  11. package/button/button.cjs.min.js +1 -1
  12. package/button/button.esm.js +5 -1
  13. package/button/button.esm.min.js +1 -1
  14. package/button/button.js +5 -1
  15. package/button/button.min.js +1 -1
  16. package/calendar/Calendar.d.ts +51 -12
  17. package/calendar/Calendar.vue +259 -114
  18. package/calendar/calendar.cjs.js +414 -220
  19. package/calendar/calendar.cjs.min.js +1 -1
  20. package/calendar/calendar.esm.js +415 -221
  21. package/calendar/calendar.esm.min.js +1 -1
  22. package/calendar/calendar.js +414 -220
  23. package/calendar/calendar.min.js +1 -1
  24. package/carousel/Carousel.vue +25 -0
  25. package/carousel/carousel.cjs.js +25 -0
  26. package/carousel/carousel.cjs.min.js +1 -1
  27. package/carousel/carousel.esm.js +25 -0
  28. package/carousel/carousel.esm.min.js +1 -1
  29. package/carousel/carousel.js +25 -0
  30. package/carousel/carousel.min.js +1 -1
  31. package/cascadeselect/CascadeSelect.d.ts +97 -17
  32. package/cascadeselect/CascadeSelect.vue +560 -135
  33. package/cascadeselect/CascadeSelectSub.vue +48 -129
  34. package/cascadeselect/cascadeselect.cjs.js +670 -306
  35. package/cascadeselect/cascadeselect.cjs.min.js +1 -1
  36. package/cascadeselect/cascadeselect.esm.js +672 -308
  37. package/cascadeselect/cascadeselect.esm.min.js +1 -1
  38. package/cascadeselect/cascadeselect.js +670 -306
  39. package/cascadeselect/cascadeselect.min.js +1 -1
  40. package/checkbox/Checkbox.d.ts +40 -4
  41. package/checkbox/Checkbox.vue +50 -13
  42. package/checkbox/checkbox.cjs.js +64 -23
  43. package/checkbox/checkbox.cjs.min.js +1 -1
  44. package/checkbox/checkbox.esm.js +65 -24
  45. package/checkbox/checkbox.esm.min.js +1 -1
  46. package/checkbox/checkbox.js +64 -23
  47. package/checkbox/checkbox.min.js +1 -1
  48. package/chips/Chips.d.ts +36 -12
  49. package/chips/Chips.vue +116 -22
  50. package/chips/chips.cjs.js +149 -37
  51. package/chips/chips.cjs.min.js +1 -1
  52. package/chips/chips.esm.js +150 -38
  53. package/chips/chips.esm.min.js +1 -1
  54. package/chips/chips.js +150 -39
  55. package/chips/chips.min.js +1 -1
  56. package/colorpicker/ColorPicker.d.ts +3 -6
  57. package/colorpicker/ColorPicker.vue +1 -5
  58. package/colorpicker/colorpicker.cjs.js +2 -7
  59. package/colorpicker/colorpicker.cjs.min.js +1 -1
  60. package/colorpicker/colorpicker.esm.js +2 -7
  61. package/colorpicker/colorpicker.esm.min.js +1 -1
  62. package/colorpicker/colorpicker.js +2 -7
  63. package/colorpicker/colorpicker.min.js +1 -1
  64. package/column/Column.d.ts +4 -0
  65. package/column/Column.vue +4 -0
  66. package/column/column.cjs.js +4 -0
  67. package/column/column.cjs.min.js +1 -1
  68. package/column/column.esm.js +4 -0
  69. package/column/column.esm.min.js +1 -1
  70. package/column/column.js +4 -0
  71. package/column/column.min.js +1 -1
  72. package/config/PrimeVue.d.ts +42 -0
  73. package/config/config.cjs.js +35 -4
  74. package/config/config.cjs.min.js +1 -1
  75. package/config/config.esm.js +35 -4
  76. package/config/config.esm.min.js +1 -1
  77. package/config/config.js +35 -4
  78. package/config/config.min.js +1 -1
  79. package/confirmdialog/ConfirmDialog.vue +4 -1
  80. package/confirmdialog/confirmdialog.cjs.js +6 -2
  81. package/confirmdialog/confirmdialog.cjs.min.js +1 -1
  82. package/confirmdialog/confirmdialog.esm.js +6 -2
  83. package/confirmdialog/confirmdialog.esm.min.js +1 -1
  84. package/confirmdialog/confirmdialog.js +6 -2
  85. package/confirmdialog/confirmdialog.min.js +1 -1
  86. package/contextmenu/ContextMenu.d.ts +1 -1
  87. package/contextmenu/ContextMenuSub.vue +3 -3
  88. package/contextmenu/contextmenu.cjs.js +14 -8
  89. package/contextmenu/contextmenu.cjs.min.js +1 -1
  90. package/contextmenu/contextmenu.esm.js +15 -9
  91. package/contextmenu/contextmenu.esm.min.js +1 -1
  92. package/contextmenu/contextmenu.js +14 -8
  93. package/contextmenu/contextmenu.min.js +1 -1
  94. package/core/core.js +1128 -772
  95. package/core/core.min.js +12 -12
  96. package/datatable/BodyCell.vue +11 -2
  97. package/datatable/DataTable.vue +23 -2
  98. package/datatable/datatable.cjs.js +34 -4
  99. package/datatable/datatable.cjs.min.js +1 -1
  100. package/datatable/datatable.esm.js +34 -4
  101. package/datatable/datatable.esm.min.js +1 -1
  102. package/datatable/datatable.js +34 -4
  103. package/datatable/datatable.min.js +1 -1
  104. package/dialog/Dialog.d.ts +5 -1
  105. package/dropdown/Dropdown.d.ts +92 -38
  106. package/dropdown/Dropdown.vue +538 -399
  107. package/dropdown/dropdown.cjs.js +657 -486
  108. package/dropdown/dropdown.cjs.min.js +1 -1
  109. package/dropdown/dropdown.esm.js +659 -488
  110. package/dropdown/dropdown.esm.min.js +1 -1
  111. package/dropdown/dropdown.js +657 -486
  112. package/dropdown/dropdown.min.js +1 -1
  113. package/editor/Editor.d.ts +32 -0
  114. package/editor/Editor.vue +15 -1
  115. package/editor/editor.cjs.js +15 -1
  116. package/editor/editor.cjs.min.js +1 -1
  117. package/editor/editor.esm.js +15 -1
  118. package/editor/editor.esm.min.js +1 -1
  119. package/editor/editor.js +15 -1
  120. package/editor/editor.min.js +1 -1
  121. package/inputmask/InputMask.vue +9 -6
  122. package/inputmask/inputmask.cjs.js +14 -6
  123. package/inputmask/inputmask.cjs.min.js +1 -1
  124. package/inputmask/inputmask.esm.js +15 -7
  125. package/inputmask/inputmask.esm.min.js +1 -1
  126. package/inputmask/inputmask.js +14 -6
  127. package/inputmask/inputmask.min.js +1 -1
  128. package/inputnumber/InputNumber.d.ts +31 -7
  129. package/inputnumber/InputNumber.vue +53 -20
  130. package/inputnumber/inputnumber.cjs.js +75 -29
  131. package/inputnumber/inputnumber.cjs.min.js +1 -1
  132. package/inputnumber/inputnumber.esm.js +76 -30
  133. package/inputnumber/inputnumber.esm.min.js +1 -1
  134. package/inputnumber/inputnumber.js +75 -29
  135. package/inputnumber/inputnumber.min.js +1 -1
  136. package/inputswitch/InputSwitch.d.ts +24 -8
  137. package/inputswitch/InputSwitch.vue +27 -12
  138. package/inputswitch/inputswitch.cjs.js +38 -20
  139. package/inputswitch/inputswitch.cjs.min.js +1 -1
  140. package/inputswitch/inputswitch.esm.js +39 -21
  141. package/inputswitch/inputswitch.esm.min.js +1 -1
  142. package/inputswitch/inputswitch.js +38 -20
  143. package/inputswitch/inputswitch.min.js +1 -1
  144. package/inputtext/InputText.vue +1 -2
  145. package/inputtext/inputtext.cjs.js +3 -4
  146. package/inputtext/inputtext.cjs.min.js +1 -1
  147. package/inputtext/inputtext.esm.js +4 -5
  148. package/inputtext/inputtext.esm.min.js +1 -1
  149. package/inputtext/inputtext.js +3 -4
  150. package/inputtext/inputtext.min.js +1 -1
  151. package/knob/Knob.d.ts +12 -0
  152. package/knob/Knob.vue +62 -2
  153. package/knob/knob.cjs.js +73 -5
  154. package/knob/knob.cjs.min.js +1 -1
  155. package/knob/knob.esm.js +73 -5
  156. package/knob/knob.esm.min.js +1 -1
  157. package/knob/knob.js +73 -5
  158. package/knob/knob.min.js +1 -1
  159. package/listbox/Listbox.d.ts +53 -7
  160. package/listbox/Listbox.vue +500 -135
  161. package/listbox/listbox.cjs.js +597 -193
  162. package/listbox/listbox.cjs.min.js +1 -1
  163. package/listbox/listbox.esm.js +599 -195
  164. package/listbox/listbox.esm.min.js +1 -1
  165. package/listbox/listbox.js +597 -193
  166. package/listbox/listbox.min.js +1 -1
  167. package/menu/Menu.d.ts +1 -1
  168. package/menu/Menuitem.vue +2 -2
  169. package/menu/menu.cjs.js +12 -6
  170. package/menu/menu.cjs.min.js +1 -1
  171. package/menu/menu.esm.js +13 -7
  172. package/menu/menu.esm.min.js +1 -1
  173. package/menu/menu.js +12 -6
  174. package/menu/menu.min.js +1 -1
  175. package/menubar/MenubarSub.vue +3 -3
  176. package/menubar/menubar.cjs.js +14 -8
  177. package/menubar/menubar.cjs.min.js +1 -1
  178. package/menubar/menubar.esm.js +15 -9
  179. package/menubar/menubar.esm.min.js +1 -1
  180. package/menubar/menubar.js +14 -8
  181. package/menubar/menubar.min.js +1 -1
  182. package/menuitem/MenuItem.d.ts +1 -1
  183. package/multiselect/MultiSelect.d.ts +111 -51
  184. package/multiselect/MultiSelect.vue +629 -338
  185. package/multiselect/multiselect.cjs.js +748 -428
  186. package/multiselect/multiselect.cjs.min.js +1 -1
  187. package/multiselect/multiselect.esm.js +750 -430
  188. package/multiselect/multiselect.esm.min.js +1 -1
  189. package/multiselect/multiselect.js +748 -428
  190. package/multiselect/multiselect.min.js +1 -1
  191. package/overlaypanel/OverlayPanel.d.ts +1 -1
  192. package/overlaypanel/OverlayPanel.vue +14 -2
  193. package/overlaypanel/overlaypanel.cjs.js +14 -2
  194. package/overlaypanel/overlaypanel.cjs.min.js +1 -1
  195. package/overlaypanel/overlaypanel.esm.js +14 -2
  196. package/overlaypanel/overlaypanel.esm.min.js +1 -1
  197. package/overlaypanel/overlaypanel.js +14 -2
  198. package/overlaypanel/overlaypanel.min.js +1 -1
  199. package/package.json +2 -2
  200. package/paginator/Paginator.d.ts +2 -2
  201. package/password/Password.d.ts +36 -8
  202. package/password/Password.vue +50 -14
  203. package/password/password.cjs.js +69 -24
  204. package/password/password.cjs.min.js +1 -1
  205. package/password/password.esm.js +71 -26
  206. package/password/password.esm.min.js +1 -1
  207. package/password/password.js +69 -24
  208. package/password/password.min.js +1 -1
  209. package/picklist/PickList.d.ts +8 -0
  210. package/picklist/PickList.vue +10 -2
  211. package/picklist/picklist.cjs.js +68 -50
  212. package/picklist/picklist.cjs.min.js +1 -1
  213. package/picklist/picklist.esm.js +69 -51
  214. package/picklist/picklist.esm.min.js +1 -1
  215. package/picklist/picklist.js +68 -50
  216. package/picklist/picklist.min.js +1 -1
  217. package/portal/Portal.d.ts +1 -1
  218. package/radiobutton/RadioButton.d.ts +28 -4
  219. package/radiobutton/RadioButton.vue +36 -11
  220. package/radiobutton/radiobutton.cjs.js +49 -23
  221. package/radiobutton/radiobutton.cjs.min.js +1 -1
  222. package/radiobutton/radiobutton.esm.js +50 -24
  223. package/radiobutton/radiobutton.esm.min.js +1 -1
  224. package/radiobutton/radiobutton.js +49 -23
  225. package/radiobutton/radiobutton.min.js +1 -1
  226. package/rating/Rating.d.ts +4 -0
  227. package/rating/Rating.vue +61 -7
  228. package/rating/rating.cjs.js +90 -16
  229. package/rating/rating.cjs.min.js +1 -1
  230. package/rating/rating.esm.js +91 -17
  231. package/rating/rating.esm.min.js +1 -1
  232. package/rating/rating.js +90 -16
  233. package/rating/rating.min.js +1 -1
  234. package/resources/primevue.css +8 -0
  235. package/resources/primevue.min.css +1 -1
  236. package/resources/themes/arya-blue/theme.css +82 -40
  237. package/resources/themes/arya-green/theme.css +82 -40
  238. package/resources/themes/arya-orange/theme.css +82 -40
  239. package/resources/themes/arya-purple/theme.css +82 -40
  240. package/resources/themes/bootstrap4-dark-blue/theme.css +82 -40
  241. package/resources/themes/bootstrap4-dark-purple/theme.css +82 -40
  242. package/resources/themes/bootstrap4-light-blue/theme.css +82 -40
  243. package/resources/themes/bootstrap4-light-purple/theme.css +82 -40
  244. package/resources/themes/fluent-light/theme.css +82 -40
  245. package/resources/themes/lara-dark-blue/theme.css +82 -40
  246. package/resources/themes/lara-dark-indigo/theme.css +82 -40
  247. package/resources/themes/lara-dark-purple/theme.css +82 -40
  248. package/resources/themes/lara-dark-teal/theme.css +82 -40
  249. package/resources/themes/lara-light-blue/theme.css +82 -40
  250. package/resources/themes/lara-light-indigo/theme.css +82 -40
  251. package/resources/themes/lara-light-purple/theme.css +82 -40
  252. package/resources/themes/lara-light-teal/theme.css +82 -40
  253. package/resources/themes/luna-amber/theme.css +82 -40
  254. package/resources/themes/luna-blue/theme.css +82 -40
  255. package/resources/themes/luna-green/theme.css +82 -40
  256. package/resources/themes/luna-pink/theme.css +82 -40
  257. package/resources/themes/md-dark-deeppurple/theme.css +82 -40
  258. package/resources/themes/md-dark-indigo/theme.css +82 -40
  259. package/resources/themes/md-light-deeppurple/theme.css +82 -40
  260. package/resources/themes/md-light-indigo/theme.css +82 -40
  261. package/resources/themes/mdc-dark-deeppurple/theme.css +82 -40
  262. package/resources/themes/mdc-dark-indigo/theme.css +82 -40
  263. package/resources/themes/mdc-light-deeppurple/theme.css +82 -40
  264. package/resources/themes/mdc-light-indigo/theme.css +82 -40
  265. package/resources/themes/nova/theme.css +82 -40
  266. package/resources/themes/nova-accent/theme.css +82 -40
  267. package/resources/themes/nova-alt/theme.css +82 -40
  268. package/resources/themes/nova-vue/theme.css +82 -40
  269. package/resources/themes/rhea/theme.css +82 -40
  270. package/resources/themes/saga-blue/theme.css +82 -40
  271. package/resources/themes/saga-green/theme.css +82 -40
  272. package/resources/themes/saga-orange/theme.css +82 -40
  273. package/resources/themes/saga-purple/theme.css +82 -40
  274. package/resources/themes/tailwind-light/theme.css +82 -40
  275. package/resources/themes/vela-blue/theme.css +82 -40
  276. package/resources/themes/vela-green/theme.css +82 -40
  277. package/resources/themes/vela-orange/theme.css +82 -40
  278. package/resources/themes/vela-purple/theme.css +82 -40
  279. package/ripple/ripple.cjs.js +1 -0
  280. package/ripple/ripple.cjs.min.js +1 -1
  281. package/ripple/ripple.esm.js +1 -0
  282. package/ripple/ripple.esm.min.js +1 -1
  283. package/ripple/ripple.js +1 -0
  284. package/ripple/ripple.min.js +1 -1
  285. package/selectbutton/SelectButton.d.ts +6 -2
  286. package/selectbutton/SelectButton.vue +89 -12
  287. package/selectbutton/selectbutton.cjs.js +97 -22
  288. package/selectbutton/selectbutton.cjs.min.js +1 -1
  289. package/selectbutton/selectbutton.esm.js +99 -24
  290. package/selectbutton/selectbutton.esm.min.js +1 -1
  291. package/selectbutton/selectbutton.js +97 -22
  292. package/selectbutton/selectbutton.min.js +1 -1
  293. package/slider/Slider.d.ts +9 -1
  294. package/slider/Slider.vue +50 -34
  295. package/slider/slider.cjs.js +59 -38
  296. package/slider/slider.cjs.min.js +1 -1
  297. package/slider/slider.esm.js +59 -38
  298. package/slider/slider.esm.min.js +1 -1
  299. package/slider/slider.js +59 -38
  300. package/slider/slider.min.js +1 -1
  301. package/splitbutton/SplitButton.d.ts +1 -1
  302. package/splitter/Splitter.vue +30 -1
  303. package/splitter/splitter.cjs.js +30 -1
  304. package/splitter/splitter.cjs.min.js +1 -1
  305. package/splitter/splitter.esm.js +30 -1
  306. package/splitter/splitter.esm.min.js +1 -1
  307. package/splitter/splitter.js +30 -1
  308. package/splitter/splitter.min.js +1 -1
  309. package/textarea/Textarea.vue +1 -2
  310. package/textarea/textarea.cjs.js +3 -5
  311. package/textarea/textarea.cjs.min.js +1 -1
  312. package/textarea/textarea.esm.js +4 -6
  313. package/textarea/textarea.esm.min.js +1 -1
  314. package/textarea/textarea.js +3 -5
  315. package/textarea/textarea.min.js +1 -1
  316. package/tieredmenu/TieredMenu.d.ts +1 -1
  317. package/tieredmenu/TieredMenuSub.vue +3 -3
  318. package/tieredmenu/tieredmenu.cjs.js +14 -8
  319. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  320. package/tieredmenu/tieredmenu.esm.js +15 -9
  321. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  322. package/tieredmenu/tieredmenu.js +14 -8
  323. package/tieredmenu/tieredmenu.min.js +1 -1
  324. package/timeline/Timeline.d.ts +10 -1
  325. package/timeline/Timeline.vue +1 -1
  326. package/timeline/timeline.cjs.js +5 -1
  327. package/timeline/timeline.cjs.min.js +1 -1
  328. package/timeline/timeline.esm.js +5 -1
  329. package/timeline/timeline.esm.min.js +1 -1
  330. package/timeline/timeline.js +5 -1
  331. package/timeline/timeline.min.js +1 -1
  332. package/togglebutton/ToggleButton.d.ts +42 -0
  333. package/togglebutton/ToggleButton.vue +44 -7
  334. package/togglebutton/togglebutton.cjs.js +59 -13
  335. package/togglebutton/togglebutton.cjs.min.js +1 -1
  336. package/togglebutton/togglebutton.esm.js +60 -14
  337. package/togglebutton/togglebutton.esm.min.js +1 -1
  338. package/togglebutton/togglebutton.js +59 -13
  339. package/togglebutton/togglebutton.min.js +1 -1
  340. package/tooltip/tooltip.cjs.js +20 -11
  341. package/tooltip/tooltip.cjs.min.js +1 -1
  342. package/tooltip/tooltip.esm.js +21 -12
  343. package/tooltip/tooltip.esm.min.js +1 -1
  344. package/tooltip/tooltip.js +20 -11
  345. package/tooltip/tooltip.min.js +1 -1
  346. package/tree/Tree.vue +5 -1
  347. package/tree/TreeNode.vue +20 -19
  348. package/tree/tree.cjs.js +47 -32
  349. package/tree/tree.cjs.min.js +1 -1
  350. package/tree/tree.esm.js +47 -32
  351. package/tree/tree.esm.min.js +1 -1
  352. package/tree/tree.js +47 -32
  353. package/tree/tree.min.js +1 -1
  354. package/treeselect/TreeSelect.d.ts +26 -10
  355. package/treeselect/TreeSelect.vue +52 -29
  356. package/treeselect/treeselect.cjs.js +74 -41
  357. package/treeselect/treeselect.cjs.min.js +1 -1
  358. package/treeselect/treeselect.esm.js +76 -43
  359. package/treeselect/treeselect.esm.min.js +1 -1
  360. package/treeselect/treeselect.js +74 -41
  361. package/treeselect/treeselect.min.js +1 -1
  362. package/tristatecheckbox/TriStateCheckbox.d.ts +20 -4
  363. package/tristatecheckbox/TriStateCheckbox.vue +52 -15
  364. package/tristatecheckbox/tristatecheckbox.cjs.js +67 -26
  365. package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
  366. package/tristatecheckbox/tristatecheckbox.esm.js +68 -27
  367. package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
  368. package/tristatecheckbox/tristatecheckbox.js +67 -26
  369. package/tristatecheckbox/tristatecheckbox.min.js +1 -1
  370. package/utils/Utils.d.ts +3 -2
  371. package/utils/utils.cjs.js +239 -173
  372. package/utils/utils.cjs.min.js +1 -1
  373. package/utils/utils.esm.js +239 -173
  374. package/utils/utils.esm.min.js +1 -1
  375. package/utils/utils.js +239 -173
  376. package/utils/utils.min.js +1 -1
  377. package/vetur-attributes.json +612 -136
  378. package/vetur-tags.json +180 -59
  379. package/virtualscroller/VirtualScroller.d.ts +10 -0
  380. package/virtualscroller/VirtualScroller.vue +18 -17
  381. package/virtualscroller/virtualscroller.cjs.js +22 -20
  382. package/virtualscroller/virtualscroller.cjs.min.js +1 -1
  383. package/virtualscroller/virtualscroller.esm.js +22 -20
  384. package/virtualscroller/virtualscroller.esm.min.js +1 -1
  385. package/virtualscroller/virtualscroller.js +22 -20
  386. package/virtualscroller/virtualscroller.min.js +1 -1
  387. package/web-types.json +1745 -338
@@ -1,27 +1,34 @@
1
1
  <template>
2
- <div ref="container" :class="containerClass" @click="onClick($event)">
2
+ <div ref="container" :class="containerClass" @click="onContainerClick($event)">
3
3
  <div class="p-hidden-accessible">
4
- <input ref="focusInput" type="text" :id="inputId" readonly :disabled="disabled" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" :tabindex="tabindex"
5
- aria-haspopup="listbox" :aria-expanded="overlayVisible" :aria-labelledby="ariaLabelledBy" />
4
+ <input ref="focusInput" :id="inputId" type="text" :style="inputStyle" :class="inputClass" readonly :disabled="disabled" :placeholder="placeholder" :tabindex="!disabled ? tabindex : -1"
5
+ role="combobox" :aria-label="ariaLabel" :aria-labelledby="ariaLabelledby" aria-haspopup="tree" :aria-expanded="overlayVisible" :aria-controls="id + '_tree'" :aria-activedescendant="focused ? focusedOptionId : undefined"
6
+ @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" v-bind="inputProps" />
6
7
  </div>
7
8
  <span :class="labelClass">
8
9
  <slot name="value" :value="modelValue" :placeholder="placeholder">
9
10
  {{label}}
10
11
  </slot>
11
12
  </span>
12
- <div class="p-cascadeselect-trigger" role="button" aria-haspopup="listbox" :aria-expanded="overlayVisible">
13
+ <div class="p-cascadeselect-trigger" role="button" tabindex="-1" aria-hidden="true">
13
14
  <slot name="indicator">
14
15
  <span :class="dropdownIconClass"></span>
15
16
  </slot>
16
17
  </div>
18
+ <span role="status" aria-live="polite" class="p-hidden-accessible">
19
+ {{searchResultMessageText}}
20
+ </span>
17
21
  <Portal :appendTo="appendTo">
18
- <transition name="p-connected-overlay" @enter="onOverlayEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
19
- <div :ref="overlayRef" :class="panelStyleClass" v-if="overlayVisible" @click="onOverlayClick">
22
+ <transition name="p-connected-overlay" @enter="onOverlayEnter" @after-enter="onOverlayAfterEnter" @leave="onOverlayLeave" @after-leave="onOverlayAfterLeave">
23
+ <div v-if="overlayVisible" :ref="overlayRef" :style="panelStyle" :class="panelStyleClass" @click="onOverlayClick" @keydown="onOverlayKeyDown" v-bind="panelProps">
20
24
  <div class="p-cascadeselect-items-wrapper">
21
- <CascadeSelectSub :options="options" :selectionPath="selectionPath"
22
- :optionLabel="optionLabel" :optionValue="optionValue" :level="0" :templates="$slots"
23
- :optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren"
24
- @option-select="onOptionSelect" @optiongroup-select="onOptionGroupSelect" :dirty="dirty" :root="true" />
25
+ <CascadeSelectSub :id="id + '_tree'" role="tree" aria-orientation="horizontal" :selectId="id" :focusedOptionId="focused ? focusedOptionId : undefined"
26
+ :options="processedOptions" :activeOptionPath="activeOptionPath" :level="0" :templates="$slots" :optionLabel="optionLabel" :optionValue="optionValue" :optionDisabled="optionDisabled"
27
+ :optionGroupLabel="optionGroupLabel" :optionGroupChildren="optionGroupChildren" @option-change="onOptionChange" />
28
+
29
+ <span role="status" aria-live="polite" class="p-hidden-accessible">
30
+ {{selectedMessageText}}
31
+ </span>
25
32
  </div>
26
33
  </div>
27
34
  </transition>
@@ -30,40 +37,36 @@
30
37
  </template>
31
38
 
32
39
  <script>
33
- import {ConnectedOverlayScrollHandler,ObjectUtils,DomHandler,ZIndexUtils} from 'primevue/utils';
40
+ import {ConnectedOverlayScrollHandler,ObjectUtils,DomHandler,ZIndexUtils,UniqueComponentId} from 'primevue/utils';
34
41
  import OverlayEventBus from 'primevue/overlayeventbus';
35
42
  import CascadeSelectSub from './CascadeSelectSub.vue';
36
43
  import Portal from 'primevue/portal';
37
44
 
38
45
  export default {
39
46
  name: 'CascadeSelect',
40
- emits: ['update:modelValue','change','group-change', 'before-show','before-hide','hide','show'],
41
- data() {
42
- return {
43
- selectionPath: null,
44
- focused: false,
45
- overlayVisible: false,
46
- dirty: false
47
- };
48
- },
47
+ emits: ['update:modelValue', 'change', 'focus', 'blur', 'click', 'group-change', 'before-show', 'before-hide', 'hide', 'show'],
49
48
  props: {
50
49
  modelValue: null,
51
50
  options: Array,
52
- optionLabel: String,
53
- optionValue: String,
54
- optionGroupLabel: String,
55
- optionGroupChildren: Array,
51
+ optionLabel: null,
52
+ optionValue: null,
53
+ optionDisabled: null,
54
+ optionGroupLabel: null,
55
+ optionGroupChildren: null,
56
56
  placeholder: String,
57
57
  disabled: Boolean,
58
58
  dataKey: null,
59
- inputId: String,
60
- tabindex: String,
61
- ariaLabelledBy: null,
59
+ inputId: null,
60
+ inputStyle: null,
61
+ inputClass: null,
62
+ inputProps: null,
63
+ panelStyle: null,
64
+ panelClass: null,
65
+ panelProps: null,
62
66
  appendTo: {
63
67
  type: String,
64
68
  default: 'body'
65
69
  },
66
- panelClass: null,
67
70
  loading: {
68
71
  type: Boolean,
69
72
  default: false
@@ -71,12 +74,74 @@ export default {
71
74
  loadingIcon: {
72
75
  type: String,
73
76
  default: 'pi pi-spinner pi-spin'
77
+ },
78
+ autoOptionFocus: {
79
+ type: Boolean,
80
+ default: true
81
+ },
82
+ searchLocale: {
83
+ type: String,
84
+ default: undefined
85
+ },
86
+ searchMessage: {
87
+ type: String,
88
+ default: null
89
+ },
90
+ selectionMessage: {
91
+ type: String,
92
+ default: null
93
+ },
94
+ emptySelectionMessage: {
95
+ type: String,
96
+ default: null
97
+ },
98
+ emptySearchMessage: {
99
+ type: String,
100
+ default: null
101
+ },
102
+ emptyMessage: {
103
+ type: String,
104
+ default: null
105
+ },
106
+ tabindex: {
107
+ type: Number,
108
+ default: 0
109
+ },
110
+ 'aria-labelledby': {
111
+ type: String,
112
+ default: null
113
+ },
114
+ 'aria-label': {
115
+ type: String,
116
+ default: null
74
117
  }
75
118
  },
76
119
  outsideClickListener: null,
77
120
  scrollHandler: null,
78
121
  resizeListener: null,
79
122
  overlay: null,
123
+ searchTimeout: null,
124
+ searchValue: null,
125
+ selectOnFocus: false,
126
+ focusOnHover: false,
127
+ data() {
128
+ return {
129
+ id: UniqueComponentId(),
130
+ focused: false,
131
+ focusedOptionInfo: { index: -1, level: 0, parentKey: '' },
132
+ activeOptionPath: [],
133
+ overlayVisible: false,
134
+ dirty: false
135
+ }
136
+ },
137
+ watch: {
138
+ options() {
139
+ this.autoUpdateModel();
140
+ }
141
+ },
142
+ mounted() {
143
+ this.id = this.$attrs.id || this.id;
144
+ },
80
145
  beforeUnmount() {
81
146
  this.unbindOutsideClickListener();
82
147
  this.unbindResizeListener();
@@ -91,107 +156,317 @@ export default {
91
156
  this.overlay = null;
92
157
  }
93
158
  },
94
- mounted() {
95
- this.updateSelectionPath();
96
- },
97
- watch: {
98
- modelValue() {
99
- this.updateSelectionPath();
100
- }
101
- },
102
159
  methods: {
103
- onOptionSelect(event) {
104
- this.$emit('update:modelValue', event.value);
105
- this.$emit('change', event);
106
- this.hide();
107
- this.$refs.focusInput.focus();
108
- },
109
- onOptionGroupSelect(event) {
110
- this.dirty = true;
111
- this.$emit('group-change', event);
112
- },
113
160
  getOptionLabel(option) {
114
161
  return this.optionLabel ? ObjectUtils.resolveFieldData(option, this.optionLabel) : option;
115
162
  },
116
163
  getOptionValue(option) {
117
164
  return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
118
165
  },
166
+ isOptionDisabled(option) {
167
+ return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
168
+ },
169
+ getOptionGroupLabel(optionGroup) {
170
+ return this.optionGroupLabel ? ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel) : null;
171
+ },
119
172
  getOptionGroupChildren(optionGroup, level) {
120
173
  return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren[level]);
121
174
  },
122
175
  isOptionGroup(option, level) {
123
176
  return Object.prototype.hasOwnProperty.call(option, this.optionGroupChildren[level]);
124
177
  },
125
- updateSelectionPath() {
126
- let path;
127
- if (this.modelValue != null && this.options) {
128
- for (let option of this.options) {
129
- path = this.findModelOptionInGroup(option, 0);
130
- if (path) {
131
- break;
132
- }
133
- }
134
- }
135
-
136
- this.selectionPath = path;
178
+ getProccessedOptionLabel(processedOption) {
179
+ const grouped = this.isProccessedOptionGroup(processedOption);
180
+ return grouped ? this.getOptionGroupLabel(processedOption.option, processedOption.level) : this.getOptionLabel(processedOption.option);
137
181
  },
138
- findModelOptionInGroup(option, level) {
139
- if (this.isOptionGroup(option, level)) {
140
- let selectedOption;
141
- for (let childOption of this.getOptionGroupChildren(option, level)) {
142
- selectedOption = this.findModelOptionInGroup(childOption, level + 1);
143
- if (selectedOption) {
144
- selectedOption.unshift(option);
145
- return selectedOption;
146
- }
147
- }
148
- }
149
- else if ((ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.dataKey))) {
150
- return [option];
151
- }
152
-
153
- return null;
182
+ isProccessedOptionGroup(processedOption) {
183
+ return ObjectUtils.isNotEmpty(processedOption.children);
154
184
  },
155
- show() {
185
+ show(isFocus) {
156
186
  this.$emit('before-show');
157
187
  this.overlayVisible = true;
188
+ this.activeOptionPath = this.findOptionPathByValue(this.modelValue);
189
+
190
+ if (this.hasSelectedOption && ObjectUtils.isNotEmpty(this.activeOptionPath)) {
191
+ const processedOption = this.activeOptionPath[this.activeOptionPath.length - 1];
192
+ this.focusedOptionInfo = { index: (this.autoOptionFocus ? processedOption.index : -1), level: processedOption.level, parentKey: processedOption.parentKey };
193
+ }
194
+ else {
195
+ this.focusedOptionInfo = { index: (this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1), level: 0, parentKey: '' };
196
+ }
197
+
198
+ isFocus && this.$refs.focusInput.focus();
158
199
  },
159
- hide() {
160
- this.$emit('before-hide');
161
- this.overlayVisible = false;
200
+ hide(isFocus) {
201
+ const _hide = () => {
202
+ this.$emit('before-hide');
203
+ this.overlayVisible = false;
204
+ this.activeOptionPath = [];
205
+ this.focusedOptionInfo = { index: -1, level: 0, parentKey: '' };
206
+
207
+ isFocus && this.$refs.focusInput.focus();
208
+ }
209
+
210
+ setTimeout(() => { _hide() }, 0); // For ScreenReaders
162
211
  },
163
- onFocus() {
212
+ onFocus(event) {
164
213
  this.focused = true;
214
+ this.$emit('focus', event);
165
215
  },
166
- onBlur() {
216
+ onBlur(event) {
167
217
  this.focused = false;
218
+ this.focusedOptionInfo = { index: -1, level: 0, parentKey: '' };
219
+ this.searchValue = '';
220
+ this.$emit('blur', event);
168
221
  },
169
- onClick(event) {
222
+ onKeyDown(event) {
170
223
  if (this.disabled || this.loading) {
224
+ event.preventDefault();
171
225
  return;
172
226
  }
173
227
 
174
- if (!this.overlay || !this.overlay.contains(event.target)) {
175
- if (this.overlayVisible)
176
- this.hide();
177
- else
178
- this.show();
228
+ switch (event.code) {
229
+ case 'ArrowDown':
230
+ this.onArrowDownKey(event);
231
+ break;
232
+
233
+ case 'ArrowUp':
234
+ this.onArrowUpKey(event);
235
+ break;
236
+
237
+ case 'ArrowLeft':
238
+ this.onArrowLeftKey(event);
239
+ break;
240
+
241
+ case 'ArrowRight':
242
+ this.onArrowRightKey(event);
243
+ break;
244
+
245
+ case 'Home':
246
+ this.onHomeKey(event);
247
+ break;
248
+
249
+ case 'End':
250
+ this.onEndKey(event);
251
+ break;
252
+
253
+ case 'Space':
254
+ this.onSpaceKey(event);
255
+ break;
256
+
257
+ case 'Enter':
258
+ this.onEnterKey(event);
259
+ break;
260
+
261
+ case 'Escape':
262
+ this.onEscapeKey(event);
263
+ break;
264
+
265
+ case 'Tab':
266
+ this.onTabKey(event);
267
+ break;
268
+
269
+ case 'PageDown':
270
+ case 'PageUp':
271
+ case 'Backspace':
272
+ case 'ShiftLeft':
273
+ case 'ShiftRight':
274
+ //NOOP
275
+ break;
276
+
277
+ default:
278
+ if (ObjectUtils.isPrintableCharacter(event.key)) {
279
+ !this.overlayVisible && this.show();
280
+ this.searchOptions(event, event.key);
281
+ }
282
+
283
+ break;
284
+ }
285
+ },
286
+ onOptionChange(event) {
287
+ const { originalEvent, processedOption, isFocus } = event;
288
+ const { index, level, parentKey, children } = processedOption;
289
+ const grouped = ObjectUtils.isNotEmpty(children);
290
+
291
+ const activeOptionPath = this.activeOptionPath.filter(p => p.parentKey !== parentKey);
292
+ activeOptionPath.push(processedOption);
293
+
294
+ this.focusedOptionInfo = { index, level, parentKey };
295
+ this.activeOptionPath = activeOptionPath;
296
+
297
+ grouped ? this.onOptionGroupSelect(originalEvent, processedOption) : this.onOptionSelect(originalEvent, processedOption);
298
+ isFocus && this.$refs.focusInput.focus();
299
+ },
300
+ onOptionSelect(event, processedOption) {
301
+ const value = this.getOptionValue(processedOption.option);
179
302
 
303
+ this.activeOptionPath.forEach(p => p.selected = true);
304
+ this.updateModel(event, value);
305
+ this.hide(true);
306
+ },
307
+ onOptionGroupSelect(event, processedOption) {
308
+ this.dirty = true;
309
+ this.$emit('group-change', { originalEvent: event, value: processedOption.option });
310
+ },
311
+ onContainerClick(event) {
312
+ if (this.disabled || this.loading) {
313
+ return;
314
+ }
315
+
316
+ if (!this.overlay || !this.overlay.contains(event.target)) {
317
+ this.overlayVisible ? this.hide() : this.show();
180
318
  this.$refs.focusInput.focus();
181
319
  }
320
+
321
+ this.$emit('click', event);
322
+ },
323
+ onOverlayClick(event) {
324
+ OverlayEventBus.emit('overlay-click', {
325
+ originalEvent: event,
326
+ target: this.$el
327
+ });
328
+ },
329
+ onOverlayKeyDown(event) {
330
+ switch (event.code) {
331
+ case 'Escape':
332
+ this.onEscapeKey(event);
333
+ break;
334
+
335
+ default:
336
+ break;
337
+ }
338
+ },
339
+ onArrowDownKey(event) {
340
+ const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findNextOptionIndex(this.focusedOptionInfo.index) : this.findFirstFocusedOptionIndex();
341
+
342
+ this.changeFocusedOptionIndex(event, optionIndex);
343
+
344
+ !this.overlayVisible && this.show();
345
+ event.preventDefault();
346
+ },
347
+ onArrowUpKey(event) {
348
+ if (event.altKey) {
349
+ if (this.focusedOptionInfo.index !== -1) {
350
+ const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
351
+ const grouped = this.isProccessedOptionGroup(processedOption);
352
+ !grouped && this.onOptionChange({ originalEvent: event, processedOption });
353
+ }
354
+
355
+ this.overlayVisible && this.hide();
356
+ event.preventDefault();
357
+ }
358
+ else {
359
+ const optionIndex = this.focusedOptionInfo.index !== -1 ? this.findPrevOptionIndex(this.focusedOptionInfo.index) : this.findLastFocusedOptionIndex();
360
+
361
+ this.changeFocusedOptionIndex(event, optionIndex);
362
+
363
+ !this.overlayVisible && this.show();
364
+ event.preventDefault();
365
+ }
366
+ },
367
+ onArrowLeftKey(event) {
368
+ if (this.overlayVisible) {
369
+ const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
370
+ const parentOption = this.activeOptionPath.find(p => p.key === processedOption.parentKey);
371
+ const matched = this.focusedOptionInfo.parentKey === '' || (parentOption && parentOption.key === this.focusedOptionInfo.parentKey);
372
+ const root = ObjectUtils.isEmpty(processedOption.parent);
373
+
374
+ if (matched) {
375
+ this.activeOptionPath = this.activeOptionPath.filter(p => p.parentKey !== this.focusedOptionInfo.parentKey);
376
+ }
377
+
378
+ if (!root) {
379
+ this.focusedOptionInfo = { index: -1, parentKey: parentOption ? parentOption.parentKey : '' };
380
+ this.searchValue = '';
381
+ this.onArrowDownKey(event);
382
+ }
383
+
384
+ event.preventDefault();
385
+ }
386
+ },
387
+ onArrowRightKey(event) {
388
+ if (this.overlayVisible) {
389
+ const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
390
+ const grouped = this.isProccessedOptionGroup(processedOption);
391
+
392
+ if (grouped) {
393
+ const matched = this.activeOptionPath.some(p => processedOption.key === p.key);
394
+
395
+ if (matched) {
396
+ this.focusedOptionInfo = { index: -1, parentKey: processedOption.key };
397
+ this.searchValue = '';
398
+ this.onArrowDownKey(event);
399
+ }
400
+ else {
401
+ this.onOptionChange({ originalEvent: event, processedOption });
402
+ }
403
+ }
404
+
405
+ event.preventDefault();
406
+ }
407
+ },
408
+ onHomeKey(event) {
409
+ this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
410
+
411
+ !this.overlayVisible && this.show();
412
+ event.preventDefault();
413
+ },
414
+ onEndKey(event) {
415
+ this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
416
+
417
+ !this.overlayVisible && this.show();
418
+ event.preventDefault();
419
+ },
420
+ onEnterKey(event) {
421
+ if (!this.overlayVisible) {
422
+ this.onArrowDownKey(event);
423
+ }
424
+ else {
425
+ if (this.focusedOptionInfo.index !== -1) {
426
+ const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
427
+ const grouped = this.isProccessedOptionGroup(processedOption);
428
+
429
+ this.onOptionChange({ originalEvent: event, processedOption });
430
+ !grouped && this.hide();
431
+ }
432
+ }
433
+
434
+ event.preventDefault();
435
+ },
436
+ onSpaceKey(event) {
437
+ this.onEnterKey(event);
438
+ },
439
+ onEscapeKey(event) {
440
+ this.overlayVisible && this.hide(true);
441
+ event.preventDefault();
442
+ },
443
+ onTabKey(event) {
444
+ if (this.focusedOptionInfo.index !== -1) {
445
+ const processedOption = this.visibleOptions[this.focusedOptionInfo.index];
446
+ const grouped = this.isProccessedOptionGroup(processedOption);
447
+
448
+ !grouped && this.onOptionChange({ originalEvent: event, processedOption });
449
+ }
450
+
451
+ this.overlayVisible && this.hide();
182
452
  },
183
453
  onOverlayEnter(el) {
184
454
  ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
185
455
  this.alignOverlay();
456
+ this.scrollInView();
457
+ },
458
+ onOverlayAfterEnter() {
186
459
  this.bindOutsideClickListener();
187
460
  this.bindScrollListener();
188
461
  this.bindResizeListener();
462
+
189
463
  this.$emit('show');
190
464
  },
191
465
  onOverlayLeave() {
192
466
  this.unbindOutsideClickListener();
193
467
  this.unbindScrollListener();
194
468
  this.unbindResizeListener();
469
+
195
470
  this.$emit('hide');
196
471
  this.overlay = null;
197
472
  this.dirty = false;
@@ -256,67 +531,168 @@ export default {
256
531
  this.resizeListener = null;
257
532
  }
258
533
  },
259
- overlayRef(el) {
260
- this.overlay = el;
534
+ isOptionMatched(processedOption) {
535
+ return this.isValidOption(processedOption) && this.getProccessedOptionLabel(processedOption).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale));
261
536
  },
262
- onKeyDown(event) {
263
- switch(event.key) {
264
- case 'Down':
265
- case 'ArrowDown':
266
- if (this.overlayVisible) {
267
- DomHandler.findSingle(this.overlay, '.p-cascadeselect-item').children[0].focus();
268
- }
269
- else if (event.altKey && this.options && this.options.length) {
270
- this.show();
271
- }
272
- event.preventDefault();
273
- break;
537
+ isValidOption(processedOption) {
538
+ return !!processedOption && !this.isOptionDisabled(processedOption.option);
539
+ },
540
+ isValidSelectedOption(processedOption) {
541
+ return this.isValidOption(processedOption) && this.isSelected(processedOption);
542
+ },
543
+ isSelected(processedOption) {
544
+ return this.activeOptionPath.some(p => p.key === processedOption.key);
545
+ },
546
+ findFirstOptionIndex() {
547
+ return this.visibleOptions.findIndex(processedOption => this.isValidOption(processedOption));
548
+ },
549
+ findLastOptionIndex() {
550
+ return ObjectUtils.findLastIndex(this.visibleOptions, processedOption => this.isValidOption(processedOption));
551
+ },
552
+ findNextOptionIndex(index) {
553
+ const matchedOptionIndex = index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(processedOption => this.isValidOption(processedOption)) : -1;
554
+ return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
555
+ },
556
+ findPrevOptionIndex(index) {
557
+ const matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), processedOption => this.isValidOption(processedOption)) : -1;
558
+ return matchedOptionIndex > -1 ? matchedOptionIndex : index;
559
+ },
560
+ findSelectedOptionIndex() {
561
+ return this.visibleOptions.findIndex(processedOption => this.isValidSelectedOption(processedOption));
562
+ },
563
+ findFirstFocusedOptionIndex() {
564
+ const selectedIndex = this.findSelectedOptionIndex();
565
+ return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
566
+ },
567
+ findLastFocusedOptionIndex() {
568
+ const selectedIndex = this.findSelectedOptionIndex();
569
+ return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
570
+ },
571
+ findOptionPathByValue(value, processedOptions, level = 0) {
572
+ processedOptions = processedOptions || (level === 0 && this.processedOptions);
274
573
 
275
- case 'Escape':
276
- if (this.overlayVisible) {
277
- this.hide();
278
- event.preventDefault();
279
- }
280
- break;
574
+ if (!processedOptions) return null;
575
+ if (ObjectUtils.isEmpty(value)) return [];
281
576
 
282
- case 'Tab':
283
- this.hide();
284
- break;
577
+ for (let i = 0; i < processedOptions.length; i++) {
578
+ const processedOption = processedOptions[i];
579
+
580
+ if (ObjectUtils.equals(value, this.getOptionValue(processedOption.option), this.equalityKey)) {
581
+ return [processedOption];
582
+ }
583
+
584
+ const matchedOptions = this.findOptionPathByValue(value, processedOption.children, level + 1);
585
+ if (matchedOptions) {
586
+ matchedOptions.unshift(processedOption);
587
+
588
+ return matchedOptions;
589
+ }
285
590
  }
286
591
  },
287
- onOverlayClick(event) {
288
- OverlayEventBus.emit('overlay-click', {
289
- originalEvent: event,
290
- target: this.$el
592
+ searchOptions(event, char) {
593
+ this.searchValue = (this.searchValue || '') + char;
594
+
595
+ let optionIndex = -1;
596
+ let matched = false;
597
+
598
+ if (this.focusedOptionInfo.index !== -1) {
599
+ optionIndex = this.visibleOptions.slice(this.focusedOptionInfo.index).findIndex(processedOption => this.isOptionMatched(processedOption));
600
+ optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionInfo.index).findIndex(processedOption => this.isOptionMatched(processedOption)) : optionIndex + this.focusedOptionInfo.index;
601
+ }
602
+ else {
603
+ optionIndex = this.visibleOptions.findIndex(processedOption => this.isOptionMatched(processedOption));
604
+ }
605
+
606
+ if (optionIndex !== -1) {
607
+ matched = true;
608
+ }
609
+
610
+ if (optionIndex === -1 && this.focusedOptionInfo.index === -1) {
611
+ optionIndex = this.findFirstFocusedOptionIndex();
612
+ }
613
+
614
+ if (optionIndex !== -1) {
615
+ this.changeFocusedOptionIndex(event, optionIndex);
616
+ }
617
+
618
+ if (this.searchTimeout) {
619
+ clearTimeout(this.searchTimeout);
620
+ }
621
+
622
+ this.searchTimeout = setTimeout(() => {
623
+ this.searchValue = '';
624
+ this.searchTimeout = null;
625
+ }, 500);
626
+
627
+ return matched;
628
+ },
629
+ changeFocusedOptionIndex(event, index) {
630
+ if (this.focusedOptionInfo.index !== index) {
631
+ this.focusedOptionInfo.index = index;
632
+ this.scrollInView();
633
+
634
+ if (this.selectOnFocus) {
635
+ this.updateModel(event, this.getOptionValue(this.visibleOptions[index]));
636
+ }
637
+ }
638
+ },
639
+ scrollInView(index = -1) {
640
+ const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
641
+ const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
642
+ if (element) {
643
+ element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
644
+ }
645
+ },
646
+ autoUpdateModel() {
647
+ if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {
648
+ this.focusedOptionInfo.index = this.findFirstFocusedOptionIndex();
649
+ const value = this.getOptionValue(this.visibleOptions[this.focusedOptionInfo.index]);
650
+ this.updateModel(null, value);
651
+ }
652
+ },
653
+ updateModel(event, value) {
654
+ this.$emit('update:modelValue', value);
655
+ this.$emit('change', { originalEvent: event, value });
656
+ },
657
+ createProcessedOptions(options, level = 0, parent = {}, parentKey = '') {
658
+ const processedOptions = [];
659
+
660
+ options && options.forEach((option, index) => {
661
+ const key = (parentKey !== '' ? parentKey + '_' : '') + index;
662
+ const newOption = {
663
+ option,
664
+ index,
665
+ level,
666
+ key,
667
+ parent,
668
+ parentKey
669
+ }
670
+
671
+ newOption['children'] = this.createProcessedOptions(this.getOptionGroupChildren(option, level), level + 1, newOption, key);
672
+ processedOptions.push(newOption);
291
673
  });
674
+
675
+ return processedOptions;
676
+ },
677
+ overlayRef(el) {
678
+ this.overlay = el;
292
679
  }
293
680
  },
294
681
  computed: {
295
682
  containerClass() {
296
- return [
297
- 'p-cascadeselect p-component p-inputwrapper',
298
- {
299
- 'p-disabled': this.disabled,
300
- 'p-focus': this.focused,
301
- 'p-inputwrapper-filled': this.modelValue,
302
- 'p-inputwrapper-focus': this.focused || this.overlayVisible
303
- }
304
- ];
683
+ return ['p-cascadeselect p-component p-inputwrapper', {
684
+ 'p-disabled': this.disabled,
685
+ 'p-focus': this.focused,
686
+ 'p-inputwrapper-filled': this.modelValue,
687
+ 'p-inputwrapper-focus': this.focused || this.overlayVisible,
688
+ 'p-overlay-open': this.overlayVisible
689
+ }];
305
690
  },
306
691
  labelClass() {
307
- return [
308
- 'p-cascadeselect-label',
309
- {
310
- 'p-placeholder': this.label === this.placeholder,
311
- 'p-cascadeselect-label-empty': !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
312
- }
313
- ];
314
- },
315
- label() {
316
- if (this.selectionPath)
317
- return this.getOptionLabel(this.selectionPath[this.selectionPath.length - 1]);
318
- else
319
- return this.placeholder||'p-emptylabel';
692
+ return ['p-cascadeselect-label', {
693
+ 'p-placeholder': this.label === this.placeholder,
694
+ 'p-cascadeselect-label-empty': !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
695
+ }];
320
696
  },
321
697
  panelStyleClass() {
322
698
  return ['p-cascadeselect-panel p-component', this.panelClass, {
@@ -326,6 +702,55 @@ export default {
326
702
  },
327
703
  dropdownIconClass() {
328
704
  return ['p-cascadeselect-trigger-icon', this.loading ? this.loadingIcon : 'pi pi-chevron-down'];
705
+ },
706
+ hasSelectedOption() {
707
+ return ObjectUtils.isNotEmpty(this.modelValue);
708
+ },
709
+ label() {
710
+ const label = this.placeholder || 'p-emptylabel';
711
+
712
+ if (this.hasSelectedOption) {
713
+ const activeOptionPath = this.findOptionPathByValue(this.modelValue);
714
+ const processedOption = activeOptionPath.length ? activeOptionPath[activeOptionPath.length - 1] : null;
715
+
716
+ return processedOption ? this.getOptionLabel(processedOption.option) : label;
717
+ }
718
+
719
+ return label;
720
+ },
721
+ processedOptions() {
722
+ return this.createProcessedOptions(this.options || []);
723
+ },
724
+ visibleOptions() {
725
+ const processedOption = this.activeOptionPath.find(p => p.key === this.focusedOptionInfo.parentKey);
726
+ return processedOption ? processedOption.children : this.processedOptions;
727
+ },
728
+ equalityKey() {
729
+ return this.optionValue ? null : this.dataKey;
730
+ },
731
+ searchResultMessageText() {
732
+ return ObjectUtils.isNotEmpty(this.visibleOptions) ? this.searchMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptySearchMessageText;
733
+ },
734
+ searchMessageText() {
735
+ return this.searchMessage || this.$primevue.config.locale.searchMessage || '';
736
+ },
737
+ emptySearchMessageText() {
738
+ return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || '';
739
+ },
740
+ emptyMessageText() {
741
+ return this.emptyMessage || this.$primevue.config.locale.emptyMessage || '';
742
+ },
743
+ selectionMessageText() {
744
+ return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';
745
+ },
746
+ emptySelectionMessageText() {
747
+ return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';
748
+ },
749
+ selectedMessageText() {
750
+ return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
751
+ },
752
+ focusedOptionId() {
753
+ return this.focusedOptionInfo.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(this.focusedOptionInfo.parentKey) ? '_' + this.focusedOptionInfo.parentKey : ''}_${this.focusedOptionInfo.index}` : null;
329
754
  }
330
755
  },
331
756
  components: {