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,14 +1,14 @@
1
- import { ZIndexUtils, ObjectUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
1
+ import { UniqueComponentId, ZIndexUtils, ObjectUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
2
2
  import OverlayEventBus from 'primevue/overlayeventbus';
3
3
  import { FilterService } from 'primevue/api';
4
4
  import Ripple from 'primevue/ripple';
5
5
  import VirtualScroller from 'primevue/virtualscroller';
6
6
  import Portal from 'primevue/portal';
7
- import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString, createVNode, withCtx, Transition, normalizeStyle, mergeProps, createSlots, Fragment, renderList, withDirectives } from 'vue';
7
+ import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, mergeProps, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, createVNode, withCtx, Transition, normalizeStyle, createSlots, Fragment, renderList, withDirectives } from 'vue';
8
8
 
9
9
  var script = {
10
10
  name: 'Dropdown',
11
- emits: ['update:modelValue', 'before-show', 'before-hide', 'show', 'hide', 'change', 'filter', 'focus', 'blur'],
11
+ emits: ['update:modelValue', 'change', 'focus', 'blur', 'before-show', 'before-hide', 'show', 'hide', 'filter'],
12
12
  props: {
13
13
  modelValue: null,
14
14
  options: Array,
@@ -38,12 +38,46 @@ var script = {
38
38
  dataKey: null,
39
39
  showClear: Boolean,
40
40
  inputId: String,
41
- tabindex: String,
42
- ariaLabelledBy: null,
41
+ inputStyle: null,
42
+ inputClass: null,
43
+ inputProps: null,
44
+ panelStyle: null,
45
+ panelClass: null,
46
+ panelProps: null,
47
+ filterInputProps: null,
48
+ clearIconProps: null,
43
49
  appendTo: {
44
50
  type: String,
45
51
  default: 'body'
46
52
  },
53
+ loading: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ loadingIcon: {
58
+ type: String,
59
+ default: 'pi pi-spinner pi-spin'
60
+ },
61
+ virtualScrollerOptions: {
62
+ type: Object,
63
+ default: null
64
+ },
65
+ autoOptionFocus: {
66
+ type: Boolean,
67
+ default: true
68
+ },
69
+ filterMessage: {
70
+ type: String,
71
+ default: null
72
+ },
73
+ selectionMessage: {
74
+ type: String,
75
+ default: null
76
+ },
77
+ emptySelectionMessage: {
78
+ type: String,
79
+ default: null
80
+ },
47
81
  emptyFilterMessage: {
48
82
  type: String,
49
83
  default: null
@@ -52,46 +86,55 @@ var script = {
52
86
  type: String,
53
87
  default: null
54
88
  },
55
- panelClass: null,
56
- loading: {
57
- type: Boolean,
58
- default: false
89
+ tabindex: {
90
+ type: Number,
91
+ default: 0
59
92
  },
60
- loadingIcon: {
93
+ 'aria-label': {
61
94
  type: String,
62
- default: 'pi pi-spinner pi-spin'
95
+ default: null
63
96
  },
64
- virtualScrollerOptions: {
65
- type: Object,
97
+ 'aria-labelledby': {
98
+ type: String,
66
99
  default: null
67
100
  }
68
101
  },
102
+ outsideClickListener: null,
103
+ scrollHandler: null,
104
+ resizeListener: null,
105
+ overlay: null,
106
+ list: null,
107
+ virtualScroller: null,
108
+ searchTimeout: null,
109
+ searchValue: null,
110
+ isModelValueChanged: false,
111
+ selectOnFocus: false,
112
+ focusOnHover: false,
69
113
  data() {
70
114
  return {
115
+ id: UniqueComponentId(),
71
116
  focused: false,
117
+ focusedOptionIndex: -1,
72
118
  filterValue: null,
73
119
  overlayVisible: false
74
- };
120
+ }
75
121
  },
76
122
  watch: {
77
123
  modelValue() {
78
124
  this.isModelValueChanged = true;
125
+ },
126
+ options() {
127
+ this.autoUpdateModel();
79
128
  }
80
129
  },
81
- outsideClickListener: null,
82
- scrollHandler: null,
83
- resizeListener: null,
84
- searchTimeout: null,
85
- currentSearchChar: null,
86
- previousSearchChar: null,
87
- searchValue: null,
88
- overlay: null,
89
- itemsWrapper: null,
90
- virtualScroller: null,
91
- isModelValueChanged: false,
130
+ mounted() {
131
+ this.id = this.$attrs.id || this.id;
132
+
133
+ this.autoUpdateModel();
134
+ },
92
135
  updated() {
93
136
  if (this.overlayVisible && this.isModelValueChanged) {
94
- this.scrollValueInView();
137
+ this.scrollInView(this.findSelectedOptionIndex());
95
138
  }
96
139
 
97
140
  this.isModelValueChanged = false;
@@ -105,8 +148,6 @@ var script = {
105
148
  this.scrollHandler = null;
106
149
  }
107
150
 
108
- this.itemsWrapper = null;
109
-
110
151
  if (this.overlay) {
111
152
  ZIndexUtils.clear(this.overlay);
112
153
  this.overlay = null;
@@ -123,13 +164,13 @@ var script = {
123
164
  return this.optionValue ? ObjectUtils.resolveFieldData(option, this.optionValue) : option;
124
165
  },
125
166
  getOptionRenderKey(option, index) {
126
- return this.dataKey ? ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option) + '_' + index.toString();
167
+ return (this.dataKey ? ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option)) + '_' + index;
127
168
  },
128
169
  isOptionDisabled(option) {
129
170
  return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
130
171
  },
131
- getOptionGroupRenderKey(optionGroup) {
132
- return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
172
+ isOptionGroup(option) {
173
+ return this.optionGroupLabel && option.optionGroup && option.group;
133
174
  },
134
175
  getOptionGroupLabel(optionGroup) {
135
176
  return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
@@ -137,254 +178,333 @@ var script = {
137
178
  getOptionGroupChildren(optionGroup) {
138
179
  return ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren);
139
180
  },
140
- getSelectedOption() {
141
- let index = this.getSelectedOptionIndex();
142
- return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.visibleOptions[index.group])[index.option]: this.visibleOptions[index]) : null;
143
- },
144
- getSelectedOptionIndex() {
145
- if (this.modelValue != null && this.visibleOptions) {
146
- if (this.optionGroupLabel) {
147
- for (let i = 0; i < this.visibleOptions.length; i++) {
148
- let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.visibleOptions[i]));
149
- if (selectedOptionIndex !== -1) {
150
- return {group: i, option: selectedOptionIndex};
151
- }
152
- }
153
- }
154
- else {
155
- return this.findOptionIndexInList(this.modelValue, this.visibleOptions);
156
- }
157
- }
158
-
159
- return -1;
160
- },
161
- findOptionIndexInList(value, list) {
162
- for (let i = 0; i < list.length; i++) {
163
- if ((ObjectUtils.equals(value, this.getOptionValue(list[i]), this.equalityKey))) {
164
- return i;
165
- }
166
- }
167
-
168
- return -1;
169
- },
170
- isSelected(option) {
171
- return ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.equalityKey);
181
+ getAriaPosInset(index) {
182
+ return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(option => this.isOptionGroup(option)).length : index) + 1;
172
183
  },
173
184
  show(isFocus) {
174
185
  this.$emit('before-show');
175
186
  this.overlayVisible = true;
187
+ this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : (this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1);
176
188
 
177
189
  isFocus && this.$refs.focusInput.focus();
178
190
  },
179
- hide() {
180
- this.$emit('before-hide');
181
- this.overlayVisible = false;
191
+ hide(isFocus) {
192
+ const _hide = () => {
193
+ this.$emit('before-hide');
194
+ this.overlayVisible = false;
195
+ this.focusedOptionIndex = -1;
196
+ this.searchValue = '';
197
+
198
+ isFocus && this.$refs.focusInput.focus();
199
+ };
200
+
201
+ setTimeout(() => { _hide(); }, 0); // For ScreenReaders
182
202
  },
183
203
  onFocus(event) {
184
204
  this.focused = true;
205
+ this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
206
+ this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
185
207
  this.$emit('focus', event);
186
208
  },
187
209
  onBlur(event) {
188
210
  this.focused = false;
211
+ this.focusedOptionIndex = -1;
212
+ this.searchValue = '';
189
213
  this.$emit('blur', event);
190
214
  },
191
215
  onKeyDown(event) {
192
- switch(event.which) {
193
- //down
194
- case 40:
195
- this.onDownKey(event);
196
- break;
197
-
198
- //up
199
- case 38:
200
- this.onUpKey(event);
201
- break;
202
-
203
- //space
204
- case 32:
205
- if (!this.overlayVisible) {
206
- this.show();
207
- event.preventDefault();
208
- }
209
- break;
216
+ switch (event.code) {
217
+ case 'ArrowDown':
218
+ this.onArrowDownKey(event);
219
+ break;
210
220
 
211
- //enter and escape
212
- case 13:
213
- case 27:
214
- if (this.overlayVisible) {
215
- this.hide();
216
- event.preventDefault();
217
- }
218
- break;
221
+ case 'ArrowUp':
222
+ this.onArrowUpKey(event, this.editable);
223
+ break;
224
+
225
+ case 'ArrowLeft':
226
+ case 'ArrowRight':
227
+ this.onArrowLeftKey(event, this.editable);
228
+ break;
229
+
230
+ case 'Home':
231
+ this.onHomeKey(event, this.editable);
232
+ break;
233
+
234
+ case 'End':
235
+ this.onEndKey(event, this.editable);
236
+ break;
237
+
238
+ case 'PageDown':
239
+ this.onPageDownKey(event);
240
+ break;
219
241
 
220
- //tab
221
- case 9:
222
- this.hide();
223
- break;
242
+ case 'PageUp':
243
+ this.onPageUpKey(event);
244
+ break;
245
+
246
+ case 'Space':
247
+ this.onSpaceKey(event, this.editable);
248
+ break;
249
+
250
+ case 'Enter':
251
+ this.onEnterKey(event);
252
+ break;
253
+
254
+ case 'Escape':
255
+ this.onEscapeKey(event);
256
+ break;
257
+
258
+ case 'Tab':
259
+ this.onTabKey(event);
260
+ break;
261
+
262
+ case 'Backspace':
263
+ this.onBackspaceKey(event, this.editable);
264
+ break;
265
+
266
+ case 'ShiftLeft':
267
+ case 'ShiftRight':
268
+ //NOOP
269
+ break;
224
270
 
225
271
  default:
226
- this.search(event);
227
- break;
272
+ if (ObjectUtils.isPrintableCharacter(event.key)) {
273
+ !this.overlayVisible && this.show();
274
+ !this.editable && this.searchOptions(event, event.key);
275
+ }
276
+
277
+ break;
278
+ }
279
+ },
280
+ onEditableInput(event) {
281
+ const value = event.target.value;
282
+
283
+ this.searchValue = '';
284
+ const matched = this.searchOptions(event, value);
285
+ !matched && (this.focusedOptionIndex = -1);
286
+
287
+ this.$emit('update:modelValue', value);
288
+ },
289
+ onContainerClick(event) {
290
+ if (this.disabled || this.loading) {
291
+ return;
292
+ }
293
+
294
+ if (DomHandler.hasClass(event.target, 'p-dropdown-clear-icon') || event.target.tagName === 'INPUT') {
295
+ return;
296
+ }
297
+ else if (!this.overlay || !this.overlay.contains(event.target)) {
298
+ this.overlayVisible ? this.hide(true) : this.show(true);
299
+ }
300
+ },
301
+ onClearClick(event) {
302
+ this.updateModel(event, null);
303
+ },
304
+ onFirstHiddenFocus(event) {
305
+ const relatedTarget = event.relatedTarget;
306
+
307
+ if (relatedTarget === this.$refs.focusInput) {
308
+ const firstFocusableEl = DomHandler.getFirstFocusableElement(this.overlay, ':not(.p-hidden-focusable)');
309
+ firstFocusableEl && firstFocusableEl.focus();
310
+ }
311
+ else {
312
+ this.$refs.focusInput.focus();
228
313
  }
229
314
  },
315
+ onLastHiddenFocus() {
316
+ this.$refs.firstHiddenFocusableElementOnOverlay.focus();
317
+ },
318
+ onOptionSelect(event, option) {
319
+ const value = this.getOptionValue(option);
320
+
321
+ this.updateModel(event, value);
322
+ this.hide(true);
323
+ },
324
+ onOptionMouseMove(event, index) {
325
+ if (this.focusOnHover) {
326
+ this.changeFocusedOptionIndex(event, index);
327
+ }
328
+ },
329
+ onFilterChange(event) {
330
+ const value = event.target.value;
331
+
332
+ this.filterValue = value;
333
+ this.focusedOptionIndex = -1;
334
+ this.$emit('filter', { originalEvent: event, value });
335
+
336
+ !this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0);
337
+ },
230
338
  onFilterKeyDown(event) {
231
- switch (event.which) {
232
- //down
233
- case 40:
234
- this.onDownKey(event);
339
+ switch (event.code) {
340
+ case 'ArrowDown':
341
+ this.onArrowDownKey(event);
235
342
  break;
236
343
 
237
- //up
238
- case 38:
239
- this.onUpKey(event);
344
+ case 'ArrowUp':
345
+ this.onArrowUpKey(event, true);
240
346
  break;
241
347
 
242
- //enter and escape
243
- case 13:
244
- case 27:
245
- this.overlayVisible = false;
246
- event.preventDefault();
247
- break;
348
+ case 'ArrowLeft':
349
+ case 'ArrowRight':
350
+ this.onArrowLeftKey(event, true);
351
+ break;
352
+
353
+ case 'Home':
354
+ this.onHomeKey(event, true);
355
+ break;
356
+
357
+ case 'End':
358
+ this.onEndKey(event, true);
359
+ break;
360
+
361
+ case 'Enter':
362
+ this.onEnterKey(event);
363
+ break;
364
+
365
+ case 'Escape':
366
+ this.onEscapeKey(event);
367
+ break;
368
+
369
+ case 'Tab':
370
+ this.onTabKey(event, true);
371
+ break;
248
372
  }
249
373
  },
250
- onDownKey(event) {
251
- if (this.visibleOptions) {
252
- if (!this.overlayVisible && event.altKey) {
253
- this.show();
254
- }
255
- else {
256
- let nextOption = this.visibleOptions && this.visibleOptions.length > 0 ? this.findNextOption(this.getSelectedOptionIndex()) : null;
257
- if (nextOption) {
258
- this.updateModel(event, this.getOptionValue(nextOption));
259
- }
260
- }
374
+ onFilterBlur() {
375
+ this.focusedOptionIndex = -1;
376
+ },
377
+ onFilterUpdated() {
378
+ if (this.overlayVisible) {
379
+ this.alignOverlay();
261
380
  }
262
-
263
- event.preventDefault();
264
381
  },
265
- onUpKey(event) {
266
- if (this.visibleOptions) {
267
- let prevOption = this.findPrevOption(this.getSelectedOptionIndex());
268
- if (prevOption) {
269
- this.updateModel(event, this.getOptionValue(prevOption));
270
- }
382
+ onOverlayClick(event) {
383
+ OverlayEventBus.emit('overlay-click', {
384
+ originalEvent: event,
385
+ target: this.$el
386
+ });
387
+ },
388
+ onOverlayKeyDown(event) {
389
+ switch (event.code) {
390
+ case 'Escape':
391
+ this.onEscapeKey(event);
392
+ break;
271
393
  }
394
+ },
395
+ onArrowDownKey(event) {
396
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.findFirstFocusedOptionIndex();
272
397
 
398
+ this.changeFocusedOptionIndex(event, optionIndex);
399
+
400
+ !this.overlayVisible && this.show();
273
401
  event.preventDefault();
274
402
  },
275
- findNextOption(index) {
276
- if (this.optionGroupLabel) {
277
- let groupIndex = index === -1 ? 0 : index.group;
278
- let optionIndex = index === -1 ? -1 : index.option;
279
- let option = this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[groupIndex]), optionIndex);
403
+ onArrowUpKey(event, pressedInInputText = false) {
404
+ if (event.altKey && !pressedInInputText) {
405
+ if (this.focusedOptionIndex !== -1) {
406
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
407
+ }
280
408
 
281
- if (option)
282
- return option;
283
- else if ((groupIndex + 1) !== this.visibleOptions.length)
284
- return this.findNextOption({group: (groupIndex + 1), option: -1});
285
- else
286
- return null;
409
+ this.overlayVisible && this.hide();
410
+ event.preventDefault();
287
411
  }
288
412
  else {
289
- return this.findNextOptionInList(this.visibleOptions, index);
413
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.findLastFocusedOptionIndex();
414
+
415
+ this.changeFocusedOptionIndex(event, optionIndex);
416
+
417
+ !this.overlayVisible && this.show();
418
+ event.preventDefault();
290
419
  }
291
420
  },
292
- findNextOptionInList(list, index) {
293
- let i = index + 1;
294
- if (i === list.length) {
295
- return null;
296
- }
297
-
298
- let option = list[i];
299
- if (this.isOptionDisabled(option))
300
- return this.findNextOptionInList(i);
301
- else
302
- return option;
421
+ onArrowLeftKey(event, pressedInInputText = false) {
422
+ pressedInInputText && (this.focusedOptionIndex = -1);
303
423
  },
304
- findPrevOption(index) {
305
- if (index === -1) {
306
- return null;
424
+ onHomeKey(event, pressedInInputText = false) {
425
+ if (pressedInInputText) {
426
+ event.currentTarget.setSelectionRange(0, 0);
427
+ this.focusedOptionIndex = -1;
307
428
  }
429
+ else {
430
+ this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
308
431
 
309
- if (this.optionGroupLabel) {
310
- let groupIndex = index.group;
311
- let optionIndex = index.option;
312
- let option = this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[groupIndex]), optionIndex);
432
+ !this.overlayVisible && this.show();
433
+ }
313
434
 
314
- if (option)
315
- return option;
316
- else if (groupIndex > 0)
317
- return this.findPrevOption({group: (groupIndex - 1), option: this.getOptionGroupChildren(this.visibleOptions[groupIndex - 1]).length});
318
- else
319
- return null;
435
+ event.preventDefault();
436
+ },
437
+ onEndKey(event, pressedInInputText = false) {
438
+ if (pressedInInputText) {
439
+ const target = event.currentTarget;
440
+ const len = target.value.length;
441
+ target.setSelectionRange(len, len);
442
+ this.focusedOptionIndex = -1;
320
443
  }
321
444
  else {
322
- return this.findPrevOptionInList(this.visibleOptions, index);
323
- }
324
- },
325
- findPrevOptionInList(list, index) {
326
- let i = index - 1;
327
- if (i < 0) {
328
- return null;
445
+ this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
446
+
447
+ !this.overlayVisible && this.show();
329
448
  }
330
449
 
331
- let option = list[i];
332
- if (this.isOptionDisabled(option))
333
- return this.findPrevOption(i);
334
- else
335
- return option;
450
+ event.preventDefault();
336
451
  },
337
- onClearClick(event) {
338
- this.updateModel(event, null);
452
+ onPageUpKey(event) {
453
+ this.scrollInView(0);
454
+ event.preventDefault();
339
455
  },
340
- onClick(event) {
341
- if (this.disabled || this.loading) {
342
- return;
456
+ onPageDownKey(event) {
457
+ this.scrollInView(this.visibleOptions.length - 1);
458
+ event.preventDefault();
459
+ },
460
+ onEnterKey(event) {
461
+ if (!this.overlayVisible) {
462
+ this.onArrowDownKey(event);
343
463
  }
464
+ else {
465
+ if (this.focusedOptionIndex !== -1) {
466
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
467
+ }
344
468
 
345
- if (DomHandler.hasClass(event.target, 'p-dropdown-clear-icon') || event.target.tagName === 'INPUT') {
346
- return;
469
+ this.hide();
347
470
  }
348
- else if (!this.overlay || !this.overlay.contains(event.target)) {
349
- if (this.overlayVisible)
350
- this.hide();
351
- else
352
- this.show();
353
471
 
354
- this.$refs.focusInput.focus();
355
- }
472
+ event.preventDefault();
356
473
  },
357
- onOptionSelect(event, option) {
358
- let value = this.getOptionValue(option);
359
- this.updateModel(event, value);
360
- this.$refs.focusInput.focus();
474
+ onSpaceKey(event, pressedInInputText = false) {
475
+ !pressedInInputText && this.onEnterKey(event);
476
+ },
477
+ onEscapeKey(event) {
478
+ this.overlayVisible && this.hide(true);
479
+ event.preventDefault();
480
+ },
481
+ onTabKey(event, pressedInInputText = false) {
482
+ if (!pressedInInputText) {
483
+ if (this.overlayVisible && this.hasFocusableElements()) {
484
+ this.$refs.firstHiddenFocusableElementOnOverlay.focus();
361
485
 
362
- setTimeout(() => {
363
- this.hide();
364
- }, 200);
486
+ event.preventDefault();
487
+ }
488
+ else {
489
+ if (this.focusedOptionIndex !== -1) {
490
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
491
+ }
492
+
493
+ this.overlayVisible && this.hide(this.filter);
494
+ }
495
+ }
365
496
  },
366
- onEditableInput(event) {
367
- this.$emit('update:modelValue', event.target.value);
497
+ onBackspaceKey(event, pressedInInputText = false) {
498
+ if (pressedInInputText) {
499
+ !this.overlayVisible && this.show();
500
+ }
368
501
  },
369
502
  onOverlayEnter(el) {
370
503
  ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
371
504
  this.alignOverlay();
372
- this.scrollValueInView();
373
-
374
- if (!this.virtualScrollerDisabled) {
375
- const selectedIndex = this.getSelectedOptionIndex();
376
- if (selectedIndex !== -1) {
377
- setTimeout(() => {
378
- this.virtualScroller && this.virtualScroller.scrollToIndex(selectedIndex);
379
- }, 0);
380
- }
381
- }
505
+ this.scrollInView();
382
506
  },
383
507
  onOverlayAfterEnter() {
384
- if (this.filter) {
385
- this.$refs.filterInput.focus();
386
- }
387
-
388
508
  this.bindOutsideClickListener();
389
509
  this.bindScrollListener();
390
510
  this.bindResizeListener();
@@ -395,8 +515,8 @@ var script = {
395
515
  this.unbindOutsideClickListener();
396
516
  this.unbindScrollListener();
397
517
  this.unbindResizeListener();
518
+
398
519
  this.$emit('hide');
399
- this.itemsWrapper = null;
400
520
  this.overlay = null;
401
521
  },
402
522
  onOverlayAfterLeave(el) {
@@ -411,10 +531,6 @@ var script = {
411
531
  DomHandler.absolutePosition(this.overlay, this.$el);
412
532
  }
413
533
  },
414
- updateModel(event, value) {
415
- this.$emit('update:modelValue', value);
416
- this.$emit('change', {originalEvent: event, value: value});
417
- },
418
534
  bindOutsideClickListener() {
419
535
  if (!this.outsideClickListener) {
420
536
  this.outsideClickListener = (event) => {
@@ -463,162 +579,153 @@ var script = {
463
579
  this.resizeListener = null;
464
580
  }
465
581
  },
466
- search(event) {
467
- if (!this.visibleOptions) {
468
- return;
582
+ hasFocusableElements() {
583
+ return DomHandler.getFocusableElements(this.overlay, ':not(.p-hidden-focusable)').length > 0;
584
+ },
585
+ isOptionMatched(option) {
586
+ return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
587
+ },
588
+ isValidOption(option) {
589
+ return option && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
590
+ },
591
+ isValidSelectedOption(option) {
592
+ return this.isValidOption(option) && this.isSelected(option);
593
+ },
594
+ isSelected(option) {
595
+ return ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.equalityKey);
596
+ },
597
+ findFirstOptionIndex() {
598
+ return this.visibleOptions.findIndex(option => this.isValidOption(option));
599
+ },
600
+ findLastOptionIndex() {
601
+ return ObjectUtils.findLastIndex(this.visibleOptions, option => this.isValidOption(option));
602
+ },
603
+ findNextOptionIndex(index) {
604
+ const matchedOptionIndex = index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(option => this.isValidOption(option)) : -1;
605
+ return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
606
+ },
607
+ findPrevOptionIndex(index) {
608
+ const matchedOptionIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), option => this.isValidOption(option)) : -1;
609
+ return matchedOptionIndex > -1 ? matchedOptionIndex : index;
610
+ },
611
+ findSelectedOptionIndex() {
612
+ return this.hasSelectedOption ? this.visibleOptions.findIndex(option => this.isValidSelectedOption(option)) : -1;
613
+ },
614
+ findFirstFocusedOptionIndex() {
615
+ const selectedIndex = this.findSelectedOptionIndex();
616
+ return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
617
+ },
618
+ findLastFocusedOptionIndex() {
619
+ const selectedIndex = this.findSelectedOptionIndex();
620
+ return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
621
+ },
622
+ searchOptions(event, char) {
623
+ this.searchValue = (this.searchValue || '') + char;
624
+
625
+ let optionIndex = -1;
626
+ let matched = false;
627
+
628
+ if (this.focusedOptionIndex !== -1) {
629
+ optionIndex = this.visibleOptions.slice(this.focusedOptionIndex).findIndex(option => this.isOptionMatched(option));
630
+ optionIndex = optionIndex === -1 ? this.visibleOptions.slice(0, this.focusedOptionIndex).findIndex(option => this.isOptionMatched(option)) : optionIndex + this.focusedOptionIndex;
631
+ }
632
+ else {
633
+ optionIndex = this.visibleOptions.findIndex(option => this.isOptionMatched(option));
469
634
  }
470
635
 
471
- if (this.searchTimeout) {
472
- clearTimeout(this.searchTimeout);
636
+ if (optionIndex !== -1) {
637
+ matched = true;
473
638
  }
474
639
 
475
- const char = event.key;
476
- this.previousSearchChar = this.currentSearchChar;
477
- this.currentSearchChar = char;
640
+ if (optionIndex === -1 && this.focusedOptionIndex === -1) {
641
+ optionIndex = this.findFirstFocusedOptionIndex();
642
+ }
478
643
 
479
- if (this.previousSearchChar === this.currentSearchChar)
480
- this.searchValue = this.currentSearchChar;
481
- else
482
- this.searchValue = this.searchValue ? this.searchValue + char : char;
644
+ if (optionIndex !== -1) {
645
+ this.changeFocusedOptionIndex(event, optionIndex);
646
+ }
483
647
 
484
- if (this.searchValue) {
485
- let searchIndex = this.getSelectedOptionIndex();
486
- let newOption = this.optionGroupLabel ? this.searchOptionInGroup(searchIndex) : this.searchOption(++searchIndex);
487
- if (newOption) {
488
- this.updateModel(event, this.getOptionValue(newOption));
489
- }
648
+ if (this.searchTimeout) {
649
+ clearTimeout(this.searchTimeout);
490
650
  }
491
651
 
492
652
  this.searchTimeout = setTimeout(() => {
493
- this.searchValue = null;
494
- }, 250);
495
- },
496
- searchOption(index) {
497
- let option;
653
+ this.searchValue = '';
654
+ this.searchTimeout = null;
655
+ }, 500);
498
656
 
499
- if (this.searchValue) {
500
- option = this.searchOptionInRange(index, this.visibleOptions.length);
657
+ return matched;
658
+ },
659
+ changeFocusedOptionIndex(event, index) {
660
+ if (this.focusedOptionIndex !== index) {
661
+ this.focusedOptionIndex = index;
662
+ this.scrollInView();
501
663
 
502
- if (!option) {
503
- option = this.searchOptionInRange(0, index);
664
+ if (this.selectOnFocus) {
665
+ this.updateModel(event, this.getOptionValue(this.visibleOptions[index]));
504
666
  }
505
667
  }
506
-
507
- return option;
508
668
  },
509
- searchOptionInRange(start, end) {
510
- for (let i = start; i < end; i++) {
511
- let opt = this.visibleOptions[i];
512
- if (this.matchesSearchValue(opt)) {
513
- return opt;
514
- }
669
+ scrollInView(index = -1) {
670
+ const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
671
+ const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
672
+ if (element) {
673
+ element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
515
674
  }
516
-
517
- return null;
518
- },
519
- searchOptionInGroup(index) {
520
- let searchIndex = index === -1 ? {group: 0, option: -1} : index;
521
-
522
- for (let i = searchIndex.group; i < this.visibleOptions.length; i++) {
523
- let groupOptions = this.getOptionGroupChildren(this.visibleOptions[i]);
524
- for (let j = (searchIndex.group === i ? searchIndex.option + 1 : 0); j < groupOptions.length; j++) {
525
- if (this.matchesSearchValue(groupOptions[j])) {
526
- return groupOptions[j];
527
- }
528
- }
675
+ else if (!this.virtualScrollerDisabled) {
676
+ setTimeout(() => {
677
+ this.virtualScroller && this.virtualScroller.scrollToIndex(index !== -1 ? index : this.focusedOptionIndex);
678
+ }, 0);
529
679
  }
530
-
531
- for (let i = 0; i <= searchIndex.group; i++) {
532
- let groupOptions = this.getOptionGroupChildren(this.visibleOptions[i]);
533
- for (let j = 0; j < (searchIndex.group === i ? searchIndex.option: groupOptions.length); j++) {
534
- if (this.matchesSearchValue(groupOptions[j])) {
535
- return groupOptions[j];
536
- }
537
- }
538
- }
539
-
540
- return null;
541
680
  },
542
- matchesSearchValue(option) {
543
- let label = this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale);
544
- return label.startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale));
681
+ autoUpdateModel() {
682
+ if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption) {
683
+ this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
684
+ const value = this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]);
685
+ this.updateModel(null, value);
686
+ }
545
687
  },
546
- onFilterChange(event) {
547
- this.filterValue = event.target.value;
548
- this.$emit('filter', {originalEvent: event, value: event.target.value});
688
+ updateModel(event, value) {
689
+ this.$emit('update:modelValue', value);
690
+ this.$emit('change', { originalEvent: event, value });
549
691
  },
550
- onFilterUpdated() {
551
- if (this.overlayVisible) {
552
- this.alignOverlay();
553
- }
692
+ flatOptions(options) {
693
+ return (options || []).reduce((result, option, index) => {
694
+ result.push({ optionGroup: option, group: true, index });
695
+
696
+ const optionGroupChildren = this.getOptionGroupChildren(option);
697
+ optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
698
+
699
+ return result;
700
+ }, []);
554
701
  },
555
702
  overlayRef(el) {
556
703
  this.overlay = el;
557
704
  },
558
- itemsWrapperRef(el) {
559
- this.itemsWrapper = el;
705
+ listRef(el, contentRef) {
706
+ this.list = el;
707
+ contentRef && contentRef(el); // For VirtualScroller
560
708
  },
561
709
  virtualScrollerRef(el) {
562
710
  this.virtualScroller = el;
563
- },
564
- scrollValueInView() {
565
- if (this.overlay) {
566
- let selectedItem = DomHandler.findSingle(this.overlay, 'li.p-highlight');
567
- if (selectedItem) {
568
- selectedItem.scrollIntoView({ block: 'nearest', inline: 'start' });
569
- }
570
- }
571
- },
572
- onOverlayClick(event) {
573
- OverlayEventBus.emit('overlay-click', {
574
- originalEvent: event,
575
- target: this.$el
576
- });
577
711
  }
578
712
  },
579
713
  computed: {
580
- visibleOptions() {
581
- if (this.filterValue) {
582
- if (this.optionGroupLabel) {
583
- let filteredGroups = [];
584
- for (let optgroup of this.options) {
585
- let filteredSubOptions = FilterService.filter(this.getOptionGroupChildren(optgroup), this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
586
- if (filteredSubOptions && filteredSubOptions.length) {
587
- let filteredGroup = {...optgroup};
588
- filteredGroup[this.optionGroupChildren] = filteredSubOptions;
589
- filteredGroups.push(filteredGroup);
590
- }
591
- }
592
- return filteredGroups
593
- }
594
- else {
595
- return FilterService.filter(this.options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
596
- }
597
- }
598
- else {
599
- return this.options;
600
- }
601
- },
602
714
  containerClass() {
603
- return [
604
- 'p-dropdown p-component p-inputwrapper',
605
- {
606
- 'p-disabled': this.disabled,
607
- 'p-dropdown-clearable': this.showClear && !this.disabled,
608
- 'p-focus': this.focused,
609
- 'p-inputwrapper-filled': this.modelValue,
610
- 'p-inputwrapper-focus': this.focused || this.overlayVisible
611
- }
612
- ];
613
- },
614
- labelClass() {
615
- return [
616
- 'p-dropdown-label p-inputtext',
617
- {
618
- 'p-placeholder': this.label === this.placeholder,
619
- 'p-dropdown-label-empty': !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
620
- }
621
- ];
715
+ return ['p-dropdown p-component p-inputwrapper', {
716
+ 'p-disabled': this.disabled,
717
+ 'p-dropdown-clearable': this.showClear && !this.disabled,
718
+ 'p-focus': this.focused,
719
+ 'p-inputwrapper-filled': this.modelValue,
720
+ 'p-inputwrapper-focus': this.focused || this.overlayVisible,
721
+ 'p-overlay-open': this.overlayVisible
722
+ }];
723
+ },
724
+ inputStyleClass() {
725
+ return ['p-dropdown-label p-inputtext', this.inputClass, {
726
+ 'p-placeholder': !this.editable && this.label === this.placeholder,
727
+ 'p-dropdown-label-empty': !this.editable && !this.$slots['value'] && (this.label === 'p-emptylabel' || this.label.length === 0)
728
+ }];
622
729
  },
623
730
  panelStyleClass() {
624
731
  return ['p-dropdown-panel p-component', this.panelClass, {
@@ -626,19 +733,24 @@ var script = {
626
733
  'p-ripple-disabled': this.$primevue.config.ripple === false
627
734
  }];
628
735
  },
736
+ dropdownIconClass() {
737
+ return ['p-dropdown-trigger-icon', (this.loading ? this.loadingIcon : 'pi pi-chevron-down')];
738
+ },
739
+ visibleOptions() {
740
+ const options = this.optionGroupLabel ? this.flatOptions(this.options) : (this.options || []);
741
+
742
+ return this.filterValue ? FilterService.filter(options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale) : options;
743
+ },
744
+ hasSelectedOption() {
745
+ return ObjectUtils.isNotEmpty(this.modelValue);
746
+ },
629
747
  label() {
630
- let selectedOption = this.getSelectedOption();
631
- if (selectedOption !== null)
632
- return this.getOptionLabel(selectedOption);
633
- else
634
- return this.placeholder||'p-emptylabel';
748
+ const selectedOptionIndex = this.findSelectedOptionIndex();
749
+ return selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions[selectedOptionIndex]) : (this.placeholder || 'p-emptylabel');
635
750
  },
636
751
  editableInputValue() {
637
- let selectedOption = this.getSelectedOption();
638
- if (selectedOption)
639
- return this.getOptionLabel(selectedOption);
640
- else
641
- return this.modelValue;
752
+ const selectedOptionIndex = this.findSelectedOptionIndex();
753
+ return selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions[selectedOptionIndex]) : (this.modelValue || '');
642
754
  },
643
755
  equalityKey() {
644
756
  return this.optionValue ? null : this.dataKey;
@@ -646,17 +758,35 @@ var script = {
646
758
  searchFields() {
647
759
  return this.filterFields || [this.optionLabel];
648
760
  },
761
+ filterResultMessageText() {
762
+ return ObjectUtils.isNotEmpty(this.visibleOptions) ? this.filterMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptyFilterMessageText;
763
+ },
764
+ filterMessageText() {
765
+ return this.filterMessage || this.$primevue.config.locale.searchMessage || '';
766
+ },
649
767
  emptyFilterMessageText() {
650
- return this.emptyFilterMessage || this.$primevue.config.locale.emptyFilterMessage;
768
+ return this.emptyFilterMessage || this.$primevue.config.locale.emptySearchMessage || this.$primevue.config.locale.emptyFilterMessage || '';
651
769
  },
652
770
  emptyMessageText() {
653
- return this.emptyMessage || this.$primevue.config.locale.emptyMessage;
771
+ return this.emptyMessage || this.$primevue.config.locale.emptyMessage || '';
772
+ },
773
+ selectionMessageText() {
774
+ return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';
775
+ },
776
+ emptySelectionMessageText() {
777
+ return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';
778
+ },
779
+ selectedMessageText() {
780
+ return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', '1') : this.emptySelectionMessageText;
781
+ },
782
+ focusedOptionId() {
783
+ return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
784
+ },
785
+ ariaSetSize() {
786
+ return this.visibleOptions.filter(option => !this.isOptionGroup(option)).length;
654
787
  },
655
788
  virtualScrollerDisabled() {
656
789
  return !this.virtualScrollerOptions;
657
- },
658
- dropdownIconClass() {
659
- return ['p-dropdown-trigger-icon', this.loading ? this.loadingIcon : 'pi pi-chevron-down'];
660
790
  }
661
791
  },
662
792
  directives: {
@@ -668,27 +798,45 @@ var script = {
668
798
  }
669
799
  };
670
800
 
671
- const _hoisted_1 = { class: "p-hidden-accessible" };
672
- const _hoisted_2 = ["id", "disabled", "tabindex", "aria-expanded", "aria-labelledby"];
673
- const _hoisted_3 = ["disabled", "placeholder", "value", "aria-expanded"];
674
- const _hoisted_4 = ["aria-expanded"];
801
+ const _hoisted_1 = ["id"];
802
+ const _hoisted_2 = ["id", "value", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant"];
803
+ const _hoisted_3 = ["id", "tabindex", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-disabled"];
804
+ const _hoisted_4 = { class: "p-dropdown-trigger" };
675
805
  const _hoisted_5 = {
676
806
  key: 0,
677
807
  class: "p-dropdown-header"
678
808
  };
679
809
  const _hoisted_6 = { class: "p-dropdown-filter-container" };
680
- const _hoisted_7 = ["value", "placeholder"];
810
+ const _hoisted_7 = ["value", "placeholder", "aria-owns", "aria-activedescendant"];
681
811
  const _hoisted_8 = /*#__PURE__*/createElementVNode("span", { class: "p-dropdown-filter-icon pi pi-search" }, null, -1);
682
- const _hoisted_9 = ["onClick", "aria-label", "aria-selected"];
683
- const _hoisted_10 = { class: "p-dropdown-item-group" };
684
- const _hoisted_11 = ["onClick", "aria-label", "aria-selected"];
685
- const _hoisted_12 = {
686
- key: 2,
687
- class: "p-dropdown-empty-message"
812
+ const _hoisted_9 = {
813
+ role: "status",
814
+ "aria-live": "polite",
815
+ class: "p-hidden-accessible"
688
816
  };
817
+ const _hoisted_10 = ["id"];
818
+ const _hoisted_11 = ["id"];
819
+ const _hoisted_12 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove"];
689
820
  const _hoisted_13 = {
690
- key: 3,
691
- class: "p-dropdown-empty-message"
821
+ key: 0,
822
+ class: "p-dropdown-empty-message",
823
+ role: "option"
824
+ };
825
+ const _hoisted_14 = {
826
+ key: 1,
827
+ class: "p-dropdown-empty-message",
828
+ role: "option"
829
+ };
830
+ const _hoisted_15 = {
831
+ key: 0,
832
+ role: "status",
833
+ "aria-live": "polite",
834
+ class: "p-hidden-accessible"
835
+ };
836
+ const _hoisted_16 = {
837
+ role: "status",
838
+ "aria-live": "polite",
839
+ class: "p-hidden-accessible"
692
840
  };
693
841
 
694
842
  function render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -698,72 +846,76 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
698
846
 
699
847
  return (openBlock(), createElementBlock("div", {
700
848
  ref: "container",
849
+ id: $data.id,
701
850
  class: normalizeClass($options.containerClass),
702
- onClick: _cache[11] || (_cache[11] = $event => ($options.onClick($event)))
851
+ onClick: _cache[16] || (_cache[16] = (...args) => ($options.onContainerClick && $options.onContainerClick(...args)))
703
852
  }, [
704
- createElementVNode("div", _hoisted_1, [
705
- createElementVNode("input", {
706
- ref: "focusInput",
707
- type: "text",
708
- id: $props.inputId,
709
- readonly: "",
710
- disabled: $props.disabled,
711
- onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFocus && $options.onFocus(...args))),
712
- onBlur: _cache[1] || (_cache[1] = (...args) => ($options.onBlur && $options.onBlur(...args))),
713
- onKeydown: _cache[2] || (_cache[2] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
714
- tabindex: $props.tabindex,
715
- "aria-haspopup": "true",
716
- "aria-expanded": $data.overlayVisible,
717
- "aria-labelledby": $props.ariaLabelledBy
718
- }, null, 40, _hoisted_2)
719
- ]),
720
853
  ($props.editable)
721
- ? (openBlock(), createElementBlock("input", {
854
+ ? (openBlock(), createElementBlock("input", mergeProps({
722
855
  key: 0,
856
+ ref: "focusInput",
857
+ id: $props.inputId,
723
858
  type: "text",
724
- class: "p-dropdown-label p-inputtext",
725
- disabled: $props.disabled,
726
- onFocus: _cache[3] || (_cache[3] = (...args) => ($options.onFocus && $options.onFocus(...args))),
727
- onBlur: _cache[4] || (_cache[4] = (...args) => ($options.onBlur && $options.onBlur(...args))),
728
- placeholder: $props.placeholder,
859
+ style: $props.inputStyle,
860
+ class: $options.inputStyleClass,
729
861
  value: $options.editableInputValue,
730
- onInput: _cache[5] || (_cache[5] = (...args) => ($options.onEditableInput && $options.onEditableInput(...args))),
862
+ placeholder: $props.placeholder,
863
+ tabindex: !$props.disabled ? $props.tabindex : -1,
864
+ disabled: $props.disabled,
865
+ autocomplete: "off",
866
+ role: "combobox",
867
+ "aria-label": _ctx.ariaLabel,
868
+ "aria-labelledby": _ctx.ariaLabelledby,
731
869
  "aria-haspopup": "listbox",
732
- "aria-expanded": $data.overlayVisible
733
- }, null, 40, _hoisted_3))
734
- : createCommentVNode("", true),
735
- (!$props.editable)
736
- ? (openBlock(), createElementBlock("span", {
870
+ "aria-expanded": $data.overlayVisible,
871
+ "aria-controls": $data.id + '_list',
872
+ "aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
873
+ onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFocus && $options.onFocus(...args))),
874
+ onBlur: _cache[1] || (_cache[1] = (...args) => ($options.onBlur && $options.onBlur(...args))),
875
+ onKeydown: _cache[2] || (_cache[2] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
876
+ onInput: _cache[3] || (_cache[3] = (...args) => ($options.onEditableInput && $options.onEditableInput(...args)))
877
+ }, $props.inputProps), null, 16, _hoisted_2))
878
+ : (openBlock(), createElementBlock("span", mergeProps({
737
879
  key: 1,
738
- class: normalizeClass($options.labelClass)
739
- }, [
880
+ ref: "focusInput",
881
+ id: $props.inputId,
882
+ style: $props.inputStyle,
883
+ class: $options.inputStyleClass,
884
+ tabindex: !$props.disabled ? $props.tabindex : -1,
885
+ role: "combobox",
886
+ "aria-label": _ctx.ariaLabel || ($options.label === 'p-emptylabel' ? undefined : $options.label),
887
+ "aria-labelledby": _ctx.ariaLabelledby,
888
+ "aria-haspopup": "listbox",
889
+ "aria-expanded": $data.overlayVisible,
890
+ "aria-controls": $data.id + '_list',
891
+ "aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
892
+ "aria-disabled": $props.disabled,
893
+ onFocus: _cache[4] || (_cache[4] = (...args) => ($options.onFocus && $options.onFocus(...args))),
894
+ onBlur: _cache[5] || (_cache[5] = (...args) => ($options.onBlur && $options.onBlur(...args))),
895
+ onKeydown: _cache[6] || (_cache[6] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args)))
896
+ }, $props.inputProps), [
740
897
  renderSlot(_ctx.$slots, "value", {
741
898
  value: $props.modelValue,
742
899
  placeholder: $props.placeholder
743
900
  }, () => [
744
- createTextVNode(toDisplayString($options.label||'empty'), 1)
901
+ createTextVNode(toDisplayString($options.label === 'p-emptylabel' ? ' ' : $options.label || 'empty'), 1)
745
902
  ])
746
- ], 2))
747
- : createCommentVNode("", true),
903
+ ], 16, _hoisted_3)),
748
904
  ($props.showClear && $props.modelValue != null)
749
- ? (openBlock(), createElementBlock("i", {
905
+ ? (openBlock(), createElementBlock("i", mergeProps({
750
906
  key: 2,
751
907
  class: "p-dropdown-clear-icon pi pi-times",
752
- onClick: _cache[6] || (_cache[6] = $event => ($options.onClearClick($event)))
753
- }))
908
+ onClick: _cache[7] || (_cache[7] = (...args) => ($options.onClearClick && $options.onClearClick(...args)))
909
+ }, $props.clearIconProps), null, 16))
754
910
  : createCommentVNode("", true),
755
- createElementVNode("div", {
756
- class: "p-dropdown-trigger",
757
- role: "button",
758
- "aria-haspopup": "listbox",
759
- "aria-expanded": $data.overlayVisible
760
- }, [
911
+ createElementVNode("div", _hoisted_4, [
761
912
  renderSlot(_ctx.$slots, "indicator", {}, () => [
762
913
  createElementVNode("span", {
763
- class: normalizeClass($options.dropdownIconClass)
914
+ class: normalizeClass($options.dropdownIconClass),
915
+ "aria-hidden": "true"
764
916
  }, null, 2)
765
917
  ])
766
- ], 8, _hoisted_4),
918
+ ]),
767
919
  createVNode(_component_Portal, { appendTo: $props.appendTo }, {
768
920
  default: withCtx(() => [
769
921
  createVNode(Transition, {
@@ -775,12 +927,22 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
775
927
  }, {
776
928
  default: withCtx(() => [
777
929
  ($data.overlayVisible)
778
- ? (openBlock(), createElementBlock("div", {
930
+ ? (openBlock(), createElementBlock("div", mergeProps({
779
931
  key: 0,
780
932
  ref: $options.overlayRef,
781
- class: normalizeClass($options.panelStyleClass),
782
- onClick: _cache[10] || (_cache[10] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
783
- }, [
933
+ style: $props.panelStyle,
934
+ class: $options.panelStyleClass,
935
+ onClick: _cache[14] || (_cache[14] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args))),
936
+ onKeydown: _cache[15] || (_cache[15] = (...args) => ($options.onOverlayKeyDown && $options.onOverlayKeyDown(...args)))
937
+ }, $props.panelProps), [
938
+ createElementVNode("span", {
939
+ ref: "firstHiddenFocusableElementOnOverlay",
940
+ role: "presentation",
941
+ "aria-hidden": "true",
942
+ class: "p-hidden-accessible p-hidden-focusable",
943
+ tabindex: 0,
944
+ onFocus: _cache[8] || (_cache[8] = (...args) => ($options.onFirstHiddenFocus && $options.onFirstHiddenFocus(...args)))
945
+ }, null, 544),
784
946
  renderSlot(_ctx.$slots, "header", {
785
947
  value: $props.modelValue,
786
948
  options: $options.visibleOptions
@@ -788,105 +950,106 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
788
950
  ($props.filter)
789
951
  ? (openBlock(), createElementBlock("div", _hoisted_5, [
790
952
  createElementVNode("div", _hoisted_6, [
791
- createElementVNode("input", {
953
+ createElementVNode("input", mergeProps({
792
954
  type: "text",
793
955
  ref: "filterInput",
794
956
  value: $data.filterValue,
795
- onVnodeUpdated: _cache[7] || (_cache[7] = (...args) => ($options.onFilterUpdated && $options.onFilterUpdated(...args))),
796
- autoComplete: "off",
957
+ onVnodeUpdated: _cache[9] || (_cache[9] = (...args) => ($options.onFilterUpdated && $options.onFilterUpdated(...args))),
797
958
  class: "p-dropdown-filter p-inputtext p-component",
798
959
  placeholder: $props.filterPlaceholder,
799
- onKeydown: _cache[8] || (_cache[8] = (...args) => ($options.onFilterKeyDown && $options.onFilterKeyDown(...args))),
800
- onInput: _cache[9] || (_cache[9] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args)))
801
- }, null, 40, _hoisted_7),
960
+ role: "searchbox",
961
+ autocomplete: "off",
962
+ "aria-owns": $data.id + '_list',
963
+ "aria-activedescendant": $options.focusedOptionId,
964
+ onKeydown: _cache[10] || (_cache[10] = (...args) => ($options.onFilterKeyDown && $options.onFilterKeyDown(...args))),
965
+ onBlur: _cache[11] || (_cache[11] = (...args) => ($options.onFilterBlur && $options.onFilterBlur(...args))),
966
+ onInput: _cache[12] || (_cache[12] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args)))
967
+ }, $props.filterInputProps), null, 16, _hoisted_7),
802
968
  _hoisted_8
803
- ])
969
+ ]),
970
+ createElementVNode("span", _hoisted_9, toDisplayString($options.filterResultMessageText), 1)
804
971
  ]))
805
972
  : createCommentVNode("", true),
806
973
  createElementVNode("div", {
807
- ref: $options.itemsWrapperRef,
808
974
  class: "p-dropdown-items-wrapper",
809
975
  style: normalizeStyle({'max-height': $options.virtualScrollerDisabled ? $props.scrollHeight : ''})
810
976
  }, [
811
977
  createVNode(_component_VirtualScroller, mergeProps({ ref: $options.virtualScrollerRef }, $props.virtualScrollerOptions, {
812
978
  items: $options.visibleOptions,
813
979
  style: {'height': $props.scrollHeight},
980
+ tabindex: -1,
814
981
  disabled: $options.virtualScrollerDisabled
815
982
  }), createSlots({
816
- content: withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle }) => [
983
+ content: withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle, itemSize }) => [
817
984
  createElementVNode("ul", {
818
- ref: contentRef,
985
+ ref: (el) => $options.listRef(el, contentRef),
986
+ id: $data.id + '_list',
819
987
  class: normalizeClass(['p-dropdown-items', styleClass]),
820
988
  style: normalizeStyle(contentStyle),
821
989
  role: "listbox"
822
990
  }, [
823
- (!$props.optionGroupLabel)
824
- ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(items, (option, i) => {
825
- return withDirectives((openBlock(), createElementBlock("li", {
826
- class: normalizeClass(['p-dropdown-item', {'p-highlight': $options.isSelected(option), 'p-disabled': $options.isOptionDisabled(option)}]),
827
- key: $options.getOptionRenderKey(option, i),
828
- onClick: $event => ($options.onOptionSelect($event, option)),
829
- role: "option",
830
- "aria-label": $options.getOptionLabel(option),
831
- "aria-selected": $options.isSelected(option)
832
- }, [
833
- renderSlot(_ctx.$slots, "option", {
834
- option: option,
835
- index: $options.getOptionIndex(i, getItemOptions)
836
- }, () => [
837
- createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
838
- ])
839
- ], 10, _hoisted_9)), [
840
- [_directive_ripple]
841
- ])
842
- }), 128))
843
- : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(items, (optionGroup, i) => {
844
- return (openBlock(), createElementBlock(Fragment, {
845
- key: $options.getOptionGroupRenderKey(optionGroup)
846
- }, [
847
- createElementVNode("li", _hoisted_10, [
991
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items, (option, i) => {
992
+ return (openBlock(), createElementBlock(Fragment, {
993
+ key: $options.getOptionRenderKey(option, $options.getOptionIndex(i, getItemOptions))
994
+ }, [
995
+ ($options.isOptionGroup(option))
996
+ ? (openBlock(), createElementBlock("li", {
997
+ key: 0,
998
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
999
+ style: normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
1000
+ class: "p-dropdown-item-group",
1001
+ role: "option"
1002
+ }, [
848
1003
  renderSlot(_ctx.$slots, "optiongroup", {
849
- option: optionGroup,
1004
+ option: option.optionGroup,
850
1005
  index: $options.getOptionIndex(i, getItemOptions)
851
1006
  }, () => [
852
- createTextVNode(toDisplayString($options.getOptionGroupLabel(optionGroup)), 1)
1007
+ createTextVNode(toDisplayString($options.getOptionGroupLabel(option.optionGroup)), 1)
853
1008
  ])
854
- ]),
855
- (openBlock(true), createElementBlock(Fragment, null, renderList($options.getOptionGroupChildren(optionGroup), (option, i) => {
856
- return withDirectives((openBlock(), createElementBlock("li", {
857
- class: normalizeClass(['p-dropdown-item', {'p-highlight': $options.isSelected(option), 'p-disabled': $options.isOptionDisabled(option)}]),
858
- key: $options.getOptionRenderKey(option, i),
859
- onClick: $event => ($options.onOptionSelect($event, option)),
860
- role: "option",
861
- "aria-label": $options.getOptionLabel(option),
862
- "aria-selected": $options.isSelected(option)
863
- }, [
864
- renderSlot(_ctx.$slots, "option", {
865
- option: option,
866
- index: $options.getOptionIndex(i, getItemOptions)
867
- }, () => [
868
- createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
869
- ])
870
- ], 10, _hoisted_11)), [
871
- [_directive_ripple]
1009
+ ], 12, _hoisted_11))
1010
+ : withDirectives((openBlock(), createElementBlock("li", {
1011
+ key: 1,
1012
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
1013
+ style: normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
1014
+ class: normalizeClass(['p-dropdown-item', {'p-highlight': $options.isSelected(option), 'p-focus': $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), 'p-disabled': $options.isOptionDisabled(option)}]),
1015
+ role: "option",
1016
+ "aria-label": $options.getOptionLabel(option),
1017
+ "aria-selected": $options.isSelected(option),
1018
+ "aria-disabled": $options.isOptionDisabled(option),
1019
+ "aria-setsize": $options.ariaSetSize,
1020
+ "aria-posinset": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)),
1021
+ onClick: $event => ($options.onOptionSelect($event, option)),
1022
+ onMousemove: $event => ($options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions)))
1023
+ }, [
1024
+ renderSlot(_ctx.$slots, "option", {
1025
+ option: option,
1026
+ index: $options.getOptionIndex(i, getItemOptions)
1027
+ }, () => [
1028
+ createTextVNode(toDisplayString($options.getOptionLabel(option)), 1)
872
1029
  ])
873
- }), 128))
874
- ], 64))
875
- }), 128)),
1030
+ ], 46, _hoisted_12)), [
1031
+ [_directive_ripple]
1032
+ ])
1033
+ ], 64))
1034
+ }), 128)),
876
1035
  ($data.filterValue && (!items || (items && items.length === 0)))
877
- ? (openBlock(), createElementBlock("li", _hoisted_12, [
1036
+ ? (openBlock(), createElementBlock("li", _hoisted_13, [
878
1037
  renderSlot(_ctx.$slots, "emptyfilter", {}, () => [
879
1038
  createTextVNode(toDisplayString($options.emptyFilterMessageText), 1)
880
1039
  ])
881
1040
  ]))
882
1041
  : ((!$props.options || ($props.options && $props.options.length === 0)))
883
- ? (openBlock(), createElementBlock("li", _hoisted_13, [
1042
+ ? (openBlock(), createElementBlock("li", _hoisted_14, [
884
1043
  renderSlot(_ctx.$slots, "empty", {}, () => [
885
1044
  createTextVNode(toDisplayString($options.emptyMessageText), 1)
886
1045
  ])
887
1046
  ]))
888
1047
  : createCommentVNode("", true)
889
- ], 6)
1048
+ ], 14, _hoisted_10),
1049
+ ((!$props.options || ($props.options && $props.options.length === 0)))
1050
+ ? (openBlock(), createElementBlock("span", _hoisted_15, toDisplayString($options.emptyMessageText), 1))
1051
+ : createCommentVNode("", true),
1052
+ createElementVNode("span", _hoisted_16, toDisplayString($options.selectedMessageText), 1)
890
1053
  ]),
891
1054
  _: 2
892
1055
  }, [
@@ -903,8 +1066,16 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
903
1066
  renderSlot(_ctx.$slots, "footer", {
904
1067
  value: $props.modelValue,
905
1068
  options: $options.visibleOptions
906
- })
907
- ], 2))
1069
+ }),
1070
+ createElementVNode("span", {
1071
+ ref: "lastHiddenFocusableElementOnOverlay",
1072
+ role: "presentation",
1073
+ "aria-hidden": "true",
1074
+ class: "p-hidden-accessible p-hidden-focusable",
1075
+ tabindex: 0,
1076
+ onFocus: _cache[13] || (_cache[13] = (...args) => ($options.onLastHiddenFocus && $options.onLastHiddenFocus(...args)))
1077
+ }, null, 544)
1078
+ ], 16))
908
1079
  : createCommentVNode("", true)
909
1080
  ]),
910
1081
  _: 3
@@ -912,7 +1083,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
912
1083
  ]),
913
1084
  _: 3
914
1085
  }, 8, ["appendTo"])
915
- ], 2))
1086
+ ], 10, _hoisted_1))
916
1087
  }
917
1088
 
918
1089
  function styleInject(css, ref) {
@@ -942,7 +1113,7 @@ function styleInject(css, ref) {
942
1113
  }
943
1114
  }
944
1115
 
945
- var css_248z = "\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n";
1116
+ var css_248z = "\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n opacity: 0;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n";
946
1117
  styleInject(css_248z);
947
1118
 
948
1119
  script.render = render;