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