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,12 +1,12 @@
1
- import { ObjectUtils, DomHandler } from 'primevue/utils';
1
+ import { UniqueComponentId, ObjectUtils, DomHandler } from 'primevue/utils';
2
2
  import { FilterService } from 'primevue/api';
3
3
  import Ripple from 'primevue/ripple';
4
4
  import VirtualScroller from 'primevue/virtualscroller';
5
- import { resolveComponent, resolveDirective, openBlock, createElementBlock, renderSlot, createElementVNode, withDirectives, vModelText, createCommentVNode, normalizeStyle, createVNode, mergeProps, createSlots, withCtx, normalizeClass, Fragment, renderList, createTextVNode, toDisplayString } from 'vue';
5
+ import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, withDirectives, mergeProps, vModelText, toDisplayString, createCommentVNode, normalizeStyle, createVNode, createSlots, withCtx, Fragment, renderList, createTextVNode } from 'vue';
6
6
 
7
7
  var script = {
8
8
  name: 'Listbox',
9
- emits: ['update:modelValue', 'change', 'filter'],
9
+ emits: ['update:modelValue', 'change', 'focus', 'blur', 'filter'],
10
10
  props: {
11
11
  modelValue: null,
12
12
  options: Array,
@@ -31,6 +31,27 @@ var script = {
31
31
  type: Array,
32
32
  default: null
33
33
  },
34
+ filterInputProps: null,
35
+ virtualScrollerOptions: {
36
+ type: Object,
37
+ default: null
38
+ },
39
+ autoOptionFocus: {
40
+ type: Boolean,
41
+ default: true
42
+ },
43
+ filterMessage: {
44
+ type: String,
45
+ default: null
46
+ },
47
+ selectionMessage: {
48
+ type: String,
49
+ default: null
50
+ },
51
+ emptySelectionMessage: {
52
+ type: String,
53
+ default: null
54
+ },
34
55
  emptyFilterMessage: {
35
56
  type: String,
36
57
  default: null
@@ -39,17 +60,44 @@ var script = {
39
60
  type: String,
40
61
  default: null
41
62
  },
42
- virtualScrollerOptions: {
43
- type: Object,
63
+ tabindex: {
64
+ type: Number,
65
+ default: 0
66
+ },
67
+ 'aria-label': {
68
+ type: String,
69
+ default: null
70
+ },
71
+ 'aria-labelledby': {
72
+ type: String,
44
73
  default: null
45
74
  }
46
75
  },
47
- optionTouched: false,
76
+ list: null,
48
77
  virtualScroller: null,
78
+ optionTouched: false,
79
+ startRangeIndex: -1,
80
+ searchTimeout: null,
81
+ searchValue: '',
82
+ selectOnFocus: false,
83
+ focusOnHover: false,
49
84
  data() {
50
85
  return {
51
- filterValue: null
52
- };
86
+ id: UniqueComponentId(),
87
+ filterValue: null,
88
+ focused: false,
89
+ focusedOptionIndex: -1
90
+ }
91
+ },
92
+ watch: {
93
+ options() {
94
+ this.autoUpdateModel();
95
+ }
96
+ },
97
+ mounted() {
98
+ this.id = this.$attrs.id || this.id;
99
+
100
+ this.autoUpdateModel();
53
101
  },
54
102
  methods: {
55
103
  getOptionIndex(index, fn) {
@@ -61,14 +109,14 @@ var script = {
61
109
  getOptionValue(option) {
62
110
  return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
63
111
  },
64
- getOptionRenderKey(option) {
65
- return this.dataKey ? ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option);
112
+ getOptionRenderKey(option, index) {
113
+ return (this.dataKey ? ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option)) + '_' + index;
66
114
  },
67
115
  isOptionDisabled(option) {
68
116
  return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
69
117
  },
70
- getOptionGroupRenderKey(optionGroup) {
71
- return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
118
+ isOptionGroup(option) {
119
+ return this.optionGroupLabel && option.optionGroup && option.group;
72
120
  },
73
121
  getOptionGroupLabel(optionGroup) {
74
122
  return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
@@ -76,17 +124,116 @@ var script = {
76
124
  getOptionGroupChildren(optionGroup) {
77
125
  return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren);
78
126
  },
79
- onOptionSelect(event, option) {
127
+ getAriaPosInset(index) {
128
+ return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(option => this.isOptionGroup(option)).length : index) + 1;
129
+ },
130
+ onFirstHiddenFocus() {
131
+ this.list.focus();
132
+
133
+ const firstFocusableEl = DomHandler.getFirstFocusableElement(this.$el, ':not(.p-hidden-focusable)');
134
+ this.$refs.lastHiddenFocusableElement.tabIndex = ObjectUtils.isEmpty(firstFocusableEl) ? -1 : undefined;
135
+ this.$refs.firstHiddenFocusableElement.tabIndex = -1;
136
+ },
137
+ onLastHiddenFocus(event) {
138
+ const relatedTarget = event.relatedTarget;
139
+
140
+ if (relatedTarget === this.list) {
141
+ const firstFocusableEl = DomHandler.getFirstFocusableElement(this.$el, ':not(.p-hidden-focusable)');
142
+ firstFocusableEl && firstFocusableEl.focus();
143
+ this.$refs.firstHiddenFocusableElement.tabIndex = undefined;
144
+ }
145
+ else {
146
+ this.$refs.firstHiddenFocusableElement.focus();
147
+ }
148
+
149
+ this.$refs.lastHiddenFocusableElement.tabIndex = -1;
150
+ },
151
+ onFocusout(event) {
152
+ if (!this.$el.contains(event.relatedTarget) && this.$refs.lastHiddenFocusableElement && this.$refs.firstHiddenFocusableElement) {
153
+ this.$refs.lastHiddenFocusableElement.tabIndex = this.$refs.firstHiddenFocusableElement.tabIndex = undefined;
154
+ }
155
+ },
156
+ onListFocus(event) {
157
+ this.focused = true;
158
+ this.focusedOptionIndex = this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
159
+ this.$emit('focus', event);
160
+ },
161
+ onListBlur(event) {
162
+ this.focused = false;
163
+ this.focusedOptionIndex = this.startRangeIndex = -1;
164
+ this.searchValue = '';
165
+ this.$emit('blur', event);
166
+ },
167
+ onListKeyDown(event) {
168
+ switch (event.code) {
169
+ case 'ArrowDown':
170
+ this.onArrowDownKey(event);
171
+ break;
172
+
173
+ case 'ArrowUp':
174
+ this.onArrowUpKey(event);
175
+ break;
176
+
177
+ case 'Home':
178
+ this.onHomeKey(event);
179
+ break;
180
+
181
+ case 'End':
182
+ this.onEndKey(event);
183
+ break;
184
+
185
+ case 'PageDown':
186
+ this.onPageDownKey(event);
187
+ break;
188
+
189
+ case 'PageUp':
190
+ this.onPageUpKey(event);
191
+ break;
192
+
193
+ case 'Enter':
194
+ case 'Space':
195
+ this.onSpaceKey(event);
196
+ break;
197
+
198
+ case 'Tab':
199
+ //NOOP
200
+ break;
201
+
202
+ case 'ShiftLeft':
203
+ case 'ShiftRight':
204
+ this.onShiftKey(event);
205
+ break;
206
+
207
+ default:
208
+ if (event.code === 'KeyA' && this.multiple && (event.metaKey || event.ctrlKey)) {
209
+ const value = this.visibleOptions.filter(option => this.isValidOption(option)).map(option => this.getOptionValue(option));
210
+ this.updateModel(event, value);
211
+
212
+ event.preventDefault();
213
+ break;
214
+ }
215
+
216
+ if (ObjectUtils.isPrintableCharacter(event.key)) {
217
+ this.searchOptions(event, event.key);
218
+ event.preventDefault();
219
+ }
220
+
221
+ break;
222
+ }
223
+ },
224
+ onOptionSelect(event, option, index = -1) {
80
225
  if (this.disabled || this.isOptionDisabled(option)) {
81
226
  return;
82
227
  }
83
228
 
84
- if(this.multiple)
85
- this.onOptionSelectMultiple(event, option);
86
- else
87
- this.onOptionSelectSingle(event, option);
88
-
229
+ this.multiple ? this.onOptionSelectMultiple(event, option) : this.onOptionSelectSingle(event, option);
89
230
  this.optionTouched = false;
231
+ index !== -1 && (this.focusedOptionIndex = index);
232
+ },
233
+ onOptionMouseMove(event, index) {
234
+ if (this.focusOnHover) {
235
+ this.changeFocusedOptionIndex(event, index);
236
+ }
90
237
  },
91
238
  onOptionTouchEnd() {
92
239
  if (this.disabled) {
@@ -126,7 +273,6 @@ var script = {
126
273
  },
127
274
  onOptionSelectMultiple(event, option) {
128
275
  let selected = this.isSelected(option);
129
- let valueChanged = false;
130
276
  let value = null;
131
277
  let metaSelection = this.optionTouched ? false : this.metaKeySelection;
132
278
 
@@ -134,133 +280,320 @@ var script = {
134
280
  let metaKey = (event.metaKey || event.ctrlKey);
135
281
 
136
282
  if (selected) {
137
- if(metaKey)
138
- value = this.removeOption(option);
139
- else
140
- value = [this.getOptionValue(option)];
141
-
142
- valueChanged = true;
283
+ value = metaKey ? this.removeOption(option) : [this.getOptionValue(option)];
143
284
  }
144
285
  else {
145
286
  value = (metaKey) ? this.modelValue || [] : [];
146
287
  value = [...value, this.getOptionValue(option)];
147
- valueChanged = true;
148
288
  }
149
289
  }
150
290
  else {
151
- if (selected)
152
- value = this.removeOption(option);
153
- else
154
- value = [...this.modelValue || [], this.getOptionValue(option)];
155
-
156
- valueChanged = true;
291
+ value = selected ? this.removeOption(option) : [...this.modelValue || [], this.getOptionValue(option)];
157
292
  }
158
293
 
159
- if(valueChanged) {
294
+ this.updateModel(event, value);
295
+ },
296
+ onOptionSelectRange(event, start = -1, end = -1) {
297
+ start === -1 && (start = this.findNearestSelectedOptionIndex(end, true));
298
+ end === -1 && (end = this.findNearestSelectedOptionIndex(start));
299
+
300
+ if (start !== -1 && end !== -1) {
301
+ const rangeStart = Math.min(start, end);
302
+ const rangeEnd = Math.max(start, end);
303
+ const value = this.visibleOptions.slice(rangeStart, rangeEnd + 1).filter(option => this.isValidOption(option)).map(option => this.getOptionValue(option));
304
+
160
305
  this.updateModel(event, value);
161
306
  }
162
307
  },
163
- isSelected(option) {
164
- let selected = false;
165
- let optionValue = this.getOptionValue(option);
166
-
167
- if (this.multiple) {
168
- if (this.modelValue) {
169
- for (let val of this.modelValue) {
170
- if (ObjectUtils.equals(val, optionValue, this.equalityKey)) {
171
- selected = true;
172
- break;
173
- }
174
- }
308
+ onFilterChange(event) {
309
+ this.$emit('filter', {originalEvent: event, value: event.target.value});
310
+ this.focusedOptionIndex = this.startRangeIndex = -1;
311
+ },
312
+ onFilterBlur() {
313
+ this.focusedOptionIndex = this.startRangeIndex = -1;
314
+ },
315
+ onFilterKeyDown(event) {
316
+ switch (event.code) {
317
+ case 'ArrowDown':
318
+ this.onArrowDownKey(event);
319
+ break;
320
+
321
+ case 'ArrowUp':
322
+ this.onArrowUpKey(event);
323
+ break;
324
+
325
+ case 'ArrowLeft':
326
+ case 'ArrowRight':
327
+ this.onArrowLeftKey(event, true);
328
+ break;
329
+
330
+ case 'Home':
331
+ this.onHomeKey(event, true);
332
+ break;
333
+
334
+ case 'End':
335
+ this.onEndKey(event, true);
336
+ break;
337
+
338
+ case 'Enter':
339
+ this.onEnterKey(event);
340
+ break;
341
+
342
+ case 'ShiftLeft':
343
+ case 'ShiftRight':
344
+ this.onShiftKey(event);
345
+ break;
346
+ }
347
+ },
348
+ onArrowDownKey(event) {
349
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.findFirstFocusedOptionIndex();
350
+
351
+ if (this.multiple && event.shiftKey) {
352
+ this.onOptionSelectRange(event, this.startRangeIndex, optionIndex);
353
+ }
354
+
355
+ this.changeFocusedOptionIndex(event, optionIndex);
356
+ event.preventDefault();
357
+ },
358
+ onArrowUpKey(event) {
359
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.findLastFocusedOptionIndex();
360
+
361
+ if (this.multiple && event.shiftKey) {
362
+ this.onOptionSelectRange(event, optionIndex, this.startRangeIndex);
363
+ }
364
+
365
+ this.changeFocusedOptionIndex(event, optionIndex);
366
+ event.preventDefault();
367
+ },
368
+ onArrowLeftKey(event, pressedInInputText = false) {
369
+ pressedInInputText && (this.focusedOptionIndex = -1);
370
+ },
371
+ onHomeKey(event, pressedInInputText = false) {
372
+ if (pressedInInputText) {
373
+ event.currentTarget.setSelectionRange(0, 0);
374
+ this.focusedOptionIndex = -1;
375
+ }
376
+ else {
377
+ let metaKey = event.metaKey || event.ctrlKey;
378
+ let optionIndex = this.findFirstOptionIndex();
379
+
380
+ if (this.multiple && event.shiftKey && metaKey) {
381
+ this.onOptionSelectRange(event, optionIndex, this.startRangeIndex);
175
382
  }
383
+
384
+ this.changeFocusedOptionIndex(event, optionIndex);
385
+ }
386
+
387
+ event.preventDefault();
388
+ },
389
+ onEndKey(event, pressedInInputText = false) {
390
+ if (pressedInInputText) {
391
+ const target = event.currentTarget;
392
+ const len = target.value.length;
393
+ target.setSelectionRange(len, len);
394
+ this.focusedOptionIndex = -1;
176
395
  }
177
396
  else {
178
- selected = ObjectUtils.equals(this.modelValue, optionValue, this.equalityKey);
397
+ let metaKey = event.metaKey || event.ctrlKey;
398
+ let optionIndex = this.findLastOptionIndex();
399
+
400
+ if (this.multiple && event.shiftKey && metaKey) {
401
+ this.onOptionSelectRange(event, this.startRangeIndex, optionIndex);
402
+ }
403
+
404
+ this.changeFocusedOptionIndex(event, optionIndex);
179
405
  }
180
406
 
181
- return selected;
407
+ event.preventDefault();
182
408
  },
183
- removeOption(option) {
184
- return this.modelValue.filter(val => !ObjectUtils.equals(val, this.getOptionValue(option), this.equalityKey));
409
+ onPageUpKey(event) {
410
+ this.scrollInView(0);
411
+ event.preventDefault();
185
412
  },
186
- updateModel(event, value) {
187
- this.$emit('update:modelValue', value);
188
- this.$emit('change', {originalEvent: event, value: value});
413
+ onPageDownKey(event) {
414
+ this.scrollInView(this.visibleOptions.length - 1);
415
+ event.preventDefault();
189
416
  },
190
- onOptionKeyDown(event, option) {
191
- let item = event.currentTarget;
417
+ onEnterKey(event) {
418
+ if (this.focusedOptionIndex !== -1) {
419
+ if (this.multiple && event.shiftKey)
420
+ this.onOptionSelectRange(event, this.focusedOptionIndex);
421
+ else
422
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
423
+ }
192
424
 
193
- switch (event.which) {
194
- //down
195
- case 40:
196
- var nextItem = this.findNextItem(item);
197
- if(nextItem) {
198
- nextItem.focus();
199
- }
425
+ event.preventDefault();
426
+ },
427
+ onSpaceKey(event) {
428
+ this.onEnterKey(event);
429
+ },
430
+ onShiftKey() {
431
+ this.startRangeIndex = this.focusedOptionIndex;
432
+ },
433
+ isOptionMatched(option) {
434
+ return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
435
+ },
436
+ isValidOption(option) {
437
+ return option && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
438
+ },
439
+ isValidSelectedOption(option) {
440
+ return this.isValidOption(option) && this.isSelected(option);
441
+ },
442
+ isSelected(option) {
443
+ const optionValue = this.getOptionValue(option);
444
+
445
+ if (this.multiple)
446
+ return (this.modelValue || []).some(value => ObjectUtils.equals(value, optionValue, this.equalityKey));
447
+ else
448
+ return ObjectUtils.equals(this.modelValue, optionValue, this.equalityKey);
449
+ },
450
+ findFirstOptionIndex() {
451
+ return this.visibleOptions.findIndex(option => this.isValidOption(option));
452
+ },
453
+ findLastOptionIndex() {
454
+ return ObjectUtils.findLastIndex(this.visibleOptions, option => this.isValidOption(option));
455
+ },
456
+ findNextOptionIndex(index) {
457
+ const matchedOptionIndex = index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(option => this.isValidOption(option)) : -1;
458
+ return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
459
+ },
460
+ findPrevOptionIndex(index) {
461
+ const matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), option => this.isValidOption(option)) : -1;
462
+ return matchedOptionIndex > -1 ? matchedOptionIndex : index;
463
+ },
464
+ findFirstSelectedOptionIndex() {
465
+ return this.hasSelectedOption ? this.visibleOptions.findIndex(option => this.isValidSelectedOption(option)) : -1;
466
+ },
467
+ findLastSelectedOptionIndex() {
468
+ return this.hasSelectedOption ? ObjectUtils.findLastIndex(this.visibleOptions, option => this.isValidSelectedOption(option)) : -1;
469
+ },
470
+ findNextSelectedOptionIndex(index) {
471
+ const matchedOptionIndex = this.hasSelectedOption && index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(option => this.isValidSelectedOption(option)) : -1;
472
+ return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : -1;
473
+ },
474
+ findPrevSelectedOptionIndex(index) {
475
+ const matchedOptionIndex = this.hasSelectedOption && index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), option => this.isValidSelectedOption(option)) : -1;
476
+ return matchedOptionIndex > -1 ? matchedOptionIndex : -1;
477
+ },
478
+ findNearestSelectedOptionIndex(index, firstCheckUp = false) {
479
+ let matchedOptionIndex = -1;
200
480
 
201
- event.preventDefault();
202
- break;
481
+ if (this.hasSelectedOption) {
482
+ if (firstCheckUp) {
483
+ matchedOptionIndex = this.findPrevSelectedOptionIndex(index);
484
+ matchedOptionIndex = matchedOptionIndex === -1 ? this.findNextSelectedOptionIndex(index) : matchedOptionIndex;
485
+ }
486
+ else {
487
+ matchedOptionIndex = this.findNextSelectedOptionIndex(index);
488
+ matchedOptionIndex = matchedOptionIndex === -1 ? this.findPrevSelectedOptionIndex(index) : matchedOptionIndex;
489
+ }
490
+ }
203
491
 
204
- //up
205
- case 38:
206
- var prevItem = this.findPrevItem(item);
207
- if(prevItem) {
208
- prevItem.focus();
209
- }
492
+ return matchedOptionIndex > -1 ? matchedOptionIndex : index;
493
+ },
494
+ findFirstFocusedOptionIndex() {
495
+ const selectedIndex = this.findFirstSelectedOptionIndex();
496
+ return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
497
+ },
498
+ findLastFocusedOptionIndex() {
499
+ const selectedIndex = this.findLastSelectedOptionIndex();
500
+ return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
501
+ },
502
+ searchOptions(event, char) {
503
+ this.searchValue = (this.searchValue || '') + char;
504
+
505
+ let optionIndex = -1;
506
+ if (this.focusedOptionIndex !== -1) {
507
+ optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex(option => this.isOptionMatched(option));
508
+ optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex(option => this.isOptionMatched(option)) : optionIndex + this.focusedOptionIndex;
509
+ }
510
+ else {
511
+ optionIndex = this.visibleOptions.findIndex(option => this.isOptionMatched(option));
512
+ }
210
513
 
211
- event.preventDefault();
212
- break;
514
+ if (optionIndex === -1 && this.focusedOptionIndex === -1) {
515
+ optionIndex = this.findFirstFocusedOptionIndex();
516
+ }
213
517
 
214
- //enter
215
- case 13:
216
- this.onOptionSelect(event, option);
217
- event.preventDefault();
218
- break;
518
+ if (optionIndex !== -1) {
519
+ this.changeFocusedOptionIndex(event, optionIndex);
219
520
  }
521
+
522
+ if (this.searchTimeout) {
523
+ clearTimeout(this.searchTimeout);
524
+ }
525
+
526
+ this.searchTimeout = setTimeout(() => {
527
+ this.searchValue = '';
528
+ this.searchTimeout = null;
529
+ }, 500);
530
+ },
531
+ removeOption(option) {
532
+ return this.modelValue.filter(val => !ObjectUtils.equals(val, this.getOptionValue(option), this.equalityKey));
220
533
  },
221
- findNextItem(item) {
222
- let nextItem = item.nextElementSibling;
534
+ changeFocusedOptionIndex(event, index) {
535
+ if (this.focusedOptionIndex !== index) {
536
+ this.focusedOptionIndex = index;
537
+ this.scrollInView();
223
538
 
224
- if (nextItem)
225
- return DomHandler.hasClass(nextItem, 'p-disabled') || DomHandler.hasClass(nextItem, 'p-listbox-item-group') ? this.findNextItem(nextItem) : nextItem;
226
- else
227
- return null;
539
+ if (this.selectOnFocus && !this.multiple) {
540
+ this.updateModel(event, this.getOptionValue(this.visibleOptions[index]));
541
+ }
542
+ }
543
+ },
544
+ scrollInView(index = -1) {
545
+ const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
546
+ const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
547
+ if (element) {
548
+ element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
549
+ }
550
+ else if (!this.virtualScrollerDisabled) {
551
+ this.virtualScroller && this.virtualScroller.scrollToIndex(index !== -1 ? index : this.focusedOptionIndex);
552
+ }
553
+ },
554
+ autoUpdateModel() {
555
+ if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {
556
+ this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
557
+ const value = this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]);
558
+ this.updateModel(null, this.multiple ? [value] : value);
559
+ }
560
+ },
561
+ updateModel(event, value) {
562
+ this.$emit('update:modelValue', value);
563
+ this.$emit('change', { originalEvent: event, value });
228
564
  },
229
- findPrevItem(item) {
230
- let prevItem = item.previousElementSibling;
565
+ flatOptions(options) {
566
+ return (options || []).reduce((result, option, index) => {
567
+ result.push({ optionGroup: option, group: true, index });
231
568
 
232
- if (prevItem)
233
- return DomHandler.hasClass(prevItem, 'p-disabled') || DomHandler.hasClass(prevItem, 'p-listbox-item-group') ? this.findPrevItem(prevItem) : prevItem;
234
- else
235
- return null;
569
+ const optionGroupChildren = this.getOptionGroupChildren(option);
570
+ optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
571
+
572
+ return result;
573
+ }, []);
236
574
  },
237
- onFilterChange(event) {
238
- this.$emit('filter', {originalEvent: event, value: event.target.value});
575
+ listRef(el, contentRef) {
576
+ this.list = el;
577
+ contentRef && contentRef(el); // For VirtualScroller
239
578
  },
240
579
  virtualScrollerRef(el) {
241
580
  this.virtualScroller = el;
242
581
  }
243
582
  },
244
583
  computed: {
584
+ containerClass() {
585
+ return ['p-listbox p-component', {
586
+ 'p-focus': this.focused,
587
+ 'p-disabled': this.disabled
588
+ }];
589
+ },
245
590
  visibleOptions() {
246
- if (this.filterValue) {
247
- if (this.optionGroupLabel) {
248
- let filteredGroups = [];
249
- for (let optgroup of this.options) {
250
- let filteredSubOptions = FilterService.filter(this.getOptionGroupChildren(optgroup), this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
251
- if (filteredSubOptions && filteredSubOptions.length) {
252
- filteredGroups.push({...optgroup, ...{items: filteredSubOptions}});
253
- }
254
- }
255
- return filteredGroups
256
- }
257
- else {
258
- return FilterService.filter(this.options, this.searchFields, this.filterValue, 'contains', this.filterLocale);
259
- }
260
- }
261
- else {
262
- return this.options;
263
- }
591
+ const options = this.optionGroupLabel ? this.flatOptions(this.options) : (this.options || []);
592
+
593
+ return this.filterValue ? FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale) : options;
594
+ },
595
+ hasSelectedOption() {
596
+ return ObjectUtils.isNotEmpty(this.modelValue);
264
597
  },
265
598
  equalityKey() {
266
599
  return this.optionValue ? null : this.dataKey;
@@ -268,11 +601,32 @@ var script = {
268
601
  searchFields() {
269
602
  return this.filterFields || [this.optionLabel];
270
603
  },
604
+ filterResultMessageText() {
605
+ return ObjectUtils.isNotEmpty(this.visibleOptions) ? this.filterMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptyFilterMessageText;
606
+ },
607
+ filterMessageText() {
608
+ return this.filterMessage || this.$primevue.config.locale.searchMessage || '';
609
+ },
271
610
  emptyFilterMessageText() {
272
- return this.emptyFilterMessage || this.$primevue.config.locale.emptyFilterMessage;
611
+ return this.emptyFilterMessage || this.$primevue.config.locale.emptySearchMessage || this.$primevue.config.locale.emptyFilterMessage || '';
273
612
  },
274
613
  emptyMessageText() {
275
- return this.emptyMessage || this.$primevue.config.locale.emptyMessage;
614
+ return this.emptyMessage || this.$primevue.config.locale.emptyMessage || '';
615
+ },
616
+ selectionMessageText() {
617
+ return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';
618
+ },
619
+ emptySelectionMessageText() {
620
+ return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';
621
+ },
622
+ selectedMessageText() {
623
+ return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
624
+ },
625
+ focusedOptionId() {
626
+ return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
627
+ },
628
+ ariaSetSize() {
629
+ return this.visibleOptions.filter(option => !this.isOptionGroup(option)).length;
276
630
  },
277
631
  virtualScrollerDisabled() {
278
632
  return !this.virtualScrollerOptions;
@@ -286,141 +640,183 @@ var script = {
286
640
  }
287
641
  };
288
642
 
289
- const _hoisted_1 = { class: "p-listbox p-component" };
290
- const _hoisted_2 = {
643
+ const _hoisted_1 = ["id"];
644
+ const _hoisted_2 = ["tabindex"];
645
+ const _hoisted_3 = {
291
646
  key: 0,
292
647
  class: "p-listbox-header"
293
648
  };
294
- const _hoisted_3 = { class: "p-listbox-filter-container" };
295
- const _hoisted_4 = ["placeholder"];
296
- const _hoisted_5 = /*#__PURE__*/createElementVNode("span", { class: "p-listbox-filter-icon pi pi-search" }, null, -1);
297
- const _hoisted_6 = ["tabindex", "onClick", "onKeydown", "aria-label", "aria-selected"];
298
- const _hoisted_7 = { class: "p-listbox-item-group" };
299
- const _hoisted_8 = ["tabindex", "onClick", "onKeydown", "aria-label", "aria-selected"];
300
- const _hoisted_9 = {
301
- key: 2,
302
- class: "p-listbox-empty-message"
649
+ const _hoisted_4 = { class: "p-listbox-filter-container" };
650
+ const _hoisted_5 = ["placeholder", "aria-owns", "aria-activedescendant", "tabindex"];
651
+ const _hoisted_6 = /*#__PURE__*/createElementVNode("span", { class: "p-listbox-filter-icon pi pi-search" }, null, -1);
652
+ const _hoisted_7 = {
653
+ role: "status",
654
+ "aria-live": "polite",
655
+ class: "p-hidden-accessible"
303
656
  };
304
- const _hoisted_10 = {
305
- key: 3,
306
- class: "p-listbox-empty-message"
657
+ const _hoisted_8 = ["id", "aria-multiselectable", "aria-label", "aria-labelledby", "aria-activedescendant", "aria-disabled"];
658
+ const _hoisted_9 = ["id"];
659
+ const _hoisted_10 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove"];
660
+ const _hoisted_11 = {
661
+ key: 0,
662
+ class: "p-listbox-empty-message",
663
+ role: "option"
664
+ };
665
+ const _hoisted_12 = {
666
+ key: 1,
667
+ class: "p-listbox-empty-message",
668
+ role: "option"
669
+ };
670
+ const _hoisted_13 = {
671
+ key: 0,
672
+ role: "status",
673
+ "aria-live": "polite",
674
+ class: "p-hidden-accessible"
675
+ };
676
+ const _hoisted_14 = {
677
+ role: "status",
678
+ "aria-live": "polite",
679
+ class: "p-hidden-accessible"
307
680
  };
681
+ const _hoisted_15 = ["tabindex"];
308
682
 
309
683
  function render(_ctx, _cache, $props, $setup, $data, $options) {
310
684
  const _component_VirtualScroller = resolveComponent("VirtualScroller");
311
685
  const _directive_ripple = resolveDirective("ripple");
312
686
 
313
- return (openBlock(), createElementBlock("div", _hoisted_1, [
687
+ return (openBlock(), createElementBlock("div", {
688
+ id: $data.id,
689
+ class: normalizeClass($options.containerClass),
690
+ onFocusout: _cache[10] || (_cache[10] = (...args) => ($options.onFocusout && $options.onFocusout(...args)))
691
+ }, [
692
+ createElementVNode("span", {
693
+ ref: "firstHiddenFocusableElement",
694
+ role: "presentation",
695
+ "aria-hidden": "true",
696
+ class: "p-hidden-accessible p-hidden-focusable",
697
+ tabindex: !$props.disabled ? $props.tabindex : -1,
698
+ onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFirstHiddenFocus && $options.onFirstHiddenFocus(...args)))
699
+ }, null, 40, _hoisted_2),
314
700
  renderSlot(_ctx.$slots, "header", {
315
701
  value: $props.modelValue,
316
702
  options: $options.visibleOptions
317
703
  }),
318
704
  ($props.filter)
319
- ? (openBlock(), createElementBlock("div", _hoisted_2, [
320
- createElementVNode("div", _hoisted_3, [
321
- withDirectives(createElementVNode("input", {
705
+ ? (openBlock(), createElementBlock("div", _hoisted_3, [
706
+ createElementVNode("div", _hoisted_4, [
707
+ withDirectives(createElementVNode("input", mergeProps({
708
+ ref: "filterInput",
322
709
  type: "text",
323
710
  class: "p-listbox-filter p-inputtext p-component",
324
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (($data.filterValue) = $event)),
711
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.filterValue) = $event)),
325
712
  placeholder: $props.filterPlaceholder,
326
- onInput: _cache[1] || (_cache[1] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args)))
327
- }, null, 40, _hoisted_4), [
713
+ role: "searchbox",
714
+ autocomplete: "off",
715
+ "aria-owns": $data.id + '_list',
716
+ "aria-activedescendant": $options.focusedOptionId,
717
+ tabindex: !$props.disabled && !$data.focused ? $props.tabindex : -1,
718
+ onInput: _cache[2] || (_cache[2] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args))),
719
+ onBlur: _cache[3] || (_cache[3] = (...args) => ($options.onFilterBlur && $options.onFilterBlur(...args))),
720
+ onKeydown: _cache[4] || (_cache[4] = (...args) => ($options.onFilterKeyDown && $options.onFilterKeyDown(...args)))
721
+ }, $props.filterInputProps), null, 16, _hoisted_5), [
328
722
  [vModelText, $data.filterValue]
329
723
  ]),
330
- _hoisted_5
331
- ])
724
+ _hoisted_6
725
+ ]),
726
+ createElementVNode("span", _hoisted_7, toDisplayString($options.filterResultMessageText), 1)
332
727
  ]))
333
728
  : createCommentVNode("", true),
334
729
  createElementVNode("div", {
730
+ ref: "listWrapper",
335
731
  class: "p-listbox-list-wrapper",
336
732
  style: normalizeStyle($props.listStyle)
337
733
  }, [
338
734
  createVNode(_component_VirtualScroller, mergeProps({ ref: $options.virtualScrollerRef }, $props.virtualScrollerOptions, {
339
735
  style: $props.listStyle,
340
736
  items: $options.visibleOptions,
737
+ tabindex: -1,
341
738
  disabled: $options.virtualScrollerDisabled
342
739
  }), createSlots({
343
- content: withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle }) => [
740
+ content: withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle, itemSize }) => [
344
741
  createElementVNode("ul", {
345
- ref: contentRef,
742
+ ref: (el) => $options.listRef(el, contentRef),
743
+ id: $data.id + '_list',
346
744
  class: normalizeClass(['p-listbox-list', styleClass]),
347
745
  style: normalizeStyle(contentStyle),
746
+ tabindex: -1,
348
747
  role: "listbox",
349
- "aria-multiselectable": "multiple"
748
+ "aria-multiselectable": $props.multiple,
749
+ "aria-label": _ctx.ariaLabel,
750
+ "aria-labelledby": _ctx.ariaLabelledby,
751
+ "aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
752
+ "aria-disabled": $props.disabled,
753
+ onFocus: _cache[6] || (_cache[6] = (...args) => ($options.onListFocus && $options.onListFocus(...args))),
754
+ onBlur: _cache[7] || (_cache[7] = (...args) => ($options.onListBlur && $options.onListBlur(...args))),
755
+ onKeydown: _cache[8] || (_cache[8] = (...args) => ($options.onListKeyDown && $options.onListKeyDown(...args)))
350
756
  }, [
351
- (!$props.optionGroupLabel)
352
- ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(items, (option, i) => {
353
- return withDirectives((openBlock(), createElementBlock("li", {
354
- tabindex: $options.isOptionDisabled(option) ? null : '0',
355
- class: normalizeClass(['p-listbox-item', {'p-highlight': $options.isSelected(option), 'p-disabled': $options.isOptionDisabled(option)}]),
356
- key: $options.getOptionRenderKey(option),
357
- onClick: $event => ($options.onOptionSelect($event, option)),
358
- onTouchend: _cache[2] || (_cache[2] = $event => ($options.onOptionTouchEnd())),
359
- onKeydown: $event => ($options.onOptionKeyDown($event, option)),
360
- role: "option",
361
- "aria-label": $options.getOptionLabel(option),
362
- "aria-selected": $options.isSelected(option)
363
- }, [
364
- renderSlot(_ctx.$slots, "option", {
365
- option: option,
366
- index: $options.getOptionIndex(i, getItemOptions)
367
- }, () => [
368
- createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
369
- ])
370
- ], 42, _hoisted_6)), [
371
- [_directive_ripple]
372
- ])
373
- }), 128))
374
- : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(items, (optionGroup, i) => {
375
- return (openBlock(), createElementBlock(Fragment, {
376
- key: $options.getOptionGroupRenderKey(optionGroup)
377
- }, [
378
- createElementVNode("li", _hoisted_7, [
757
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items, (option, i) => {
758
+ return (openBlock(), createElementBlock(Fragment, {
759
+ key: $options.getOptionRenderKey(option, $options.getOptionIndex(i, getItemOptions))
760
+ }, [
761
+ ($options.isOptionGroup(option))
762
+ ? (openBlock(), createElementBlock("li", {
763
+ key: 0,
764
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
765
+ style: normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
766
+ class: "p-listbox-item-group",
767
+ role: "option"
768
+ }, [
379
769
  renderSlot(_ctx.$slots, "optiongroup", {
380
- option: optionGroup,
770
+ option: option.optionGroup,
381
771
  index: $options.getOptionIndex(i, getItemOptions)
382
772
  }, () => [
383
- createTextVNode(toDisplayString($options.getOptionGroupLabel(optionGroup)), 1)
773
+ createTextVNode(toDisplayString($options.getOptionGroupLabel(option.optionGroup)), 1)
384
774
  ])
385
- ]),
386
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.getOptionGroupChildren(optionGroup), (option, i) => {
387
- return withDirectives((openBlock(), createElementBlock("li", {
388
- tabindex: $options.isOptionDisabled(option) ? null : '0',
389
- class: normalizeClass(['p-listbox-item', {'p-highlight': $options.isSelected(option), 'p-disabled': $options.isOptionDisabled(option)}]),
390
- key: $options.getOptionRenderKey(option),
391
- onClick: $event => ($options.onOptionSelect($event, option)),
392
- onTouchend: _cache[3] || (_cache[3] = $event => ($options.onOptionTouchEnd())),
393
- onKeydown: $event => ($options.onOptionKeyDown($event, option)),
394
- role: "option",
395
- "aria-label": $options.getOptionLabel(option),
396
- "aria-selected": $options.isSelected(option)
397
- }, [
398
- renderSlot(_ctx.$slots, "option", {
399
- option: option,
400
- index: $options.getOptionIndex(i, getItemOptions)
401
- }, () => [
402
- createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
403
- ])
404
- ], 42, _hoisted_8)), [
405
- [_directive_ripple]
775
+ ], 12, _hoisted_9))
776
+ : withDirectives((openBlock(), createElementBlock("li", {
777
+ key: 1,
778
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
779
+ style: normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
780
+ class: normalizeClass(['p-listbox-item', {'p-highlight': $options.isSelected(option), 'p-focus': $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), 'p-disabled': $options.isOptionDisabled(option)}]),
781
+ role: "option",
782
+ "aria-label": $options.getOptionLabel(option),
783
+ "aria-selected": $options.isSelected(option),
784
+ "aria-disabled": $options.isOptionDisabled(option),
785
+ "aria-setsize": $options.ariaSetSize,
786
+ "aria-posinset": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)),
787
+ onClick: $event => ($options.onOptionSelect($event, option, $options.getOptionIndex(i, getItemOptions))),
788
+ onMousemove: $event => ($options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions))),
789
+ onTouchend: _cache[5] || (_cache[5] = $event => ($options.onOptionTouchEnd()))
790
+ }, [
791
+ renderSlot(_ctx.$slots, "option", {
792
+ option: option,
793
+ index: $options.getOptionIndex(i, getItemOptions)
794
+ }, () => [
795
+ createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
406
796
  ])
407
- }), 128))
408
- ], 64))
409
- }), 128)),
797
+ ], 46, _hoisted_10)), [
798
+ [_directive_ripple]
799
+ ])
800
+ ], 64))
801
+ }), 128)),
410
802
  ($data.filterValue && (!items || (items && items.length === 0)))
411
- ? (openBlock(), createElementBlock("li", _hoisted_9, [
803
+ ? (openBlock(), createElementBlock("li", _hoisted_11, [
412
804
  renderSlot(_ctx.$slots, "emptyfilter", {}, () => [
413
805
  createTextVNode(toDisplayString($options.emptyFilterMessageText), 1)
414
806
  ])
415
807
  ]))
416
808
  : ((!$props.options || ($props.options && $props.options.length === 0)))
417
- ? (openBlock(), createElementBlock("li", _hoisted_10, [
809
+ ? (openBlock(), createElementBlock("li", _hoisted_12, [
418
810
  renderSlot(_ctx.$slots, "empty", {}, () => [
419
811
  createTextVNode(toDisplayString($options.emptyMessageText), 1)
420
812
  ])
421
813
  ]))
422
814
  : createCommentVNode("", true)
423
- ], 6)
815
+ ], 46, _hoisted_8),
816
+ ((!$props.options || ($props.options && $props.options.length === 0)))
817
+ ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString($options.emptyMessageText), 1))
818
+ : createCommentVNode("", true),
819
+ createElementVNode("span", _hoisted_14, toDisplayString($options.selectedMessageText), 1)
424
820
  ]),
425
821
  _: 2
426
822
  }, [
@@ -437,8 +833,16 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
437
833
  renderSlot(_ctx.$slots, "footer", {
438
834
  value: $props.modelValue,
439
835
  options: $options.visibleOptions
440
- })
441
- ]))
836
+ }),
837
+ createElementVNode("span", {
838
+ ref: "lastHiddenFocusableElement",
839
+ role: "presentation",
840
+ "aria-hidden": "true",
841
+ class: "p-hidden-accessible p-hidden-focusable",
842
+ tabindex: !$props.disabled ? $props.tabindex : -1,
843
+ onFocus: _cache[9] || (_cache[9] = (...args) => ($options.onLastHiddenFocus && $options.onLastHiddenFocus(...args)))
844
+ }, null, 40, _hoisted_15)
845
+ ], 42, _hoisted_1))
442
846
  }
443
847
 
444
848
  function styleInject(css, ref) {