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
@@ -18,18 +18,19 @@ var Portal__default = /*#__PURE__*/_interopDefaultLegacy(Portal);
18
18
 
19
19
  var script = {
20
20
  name: 'AutoComplete',
21
- inheritAttrs: false,
22
- emits: ['update:modelValue', 'item-select', 'item-unselect', 'dropdown-click', 'clear', 'complete'],
21
+ emits: ['update:modelValue', 'change', 'focus', 'blur', 'item-select', 'item-unselect', 'dropdown-click', 'clear', 'complete', 'before-show', 'before-hide', 'show', 'hide'],
23
22
  props: {
24
23
  modelValue: null,
25
24
  suggestions: {
26
25
  type: Array,
27
26
  default: null
28
27
  },
29
- field: {
28
+ field: { // TODO: Deprecated since v3.16.0
30
29
  type: [String,Function],
31
30
  default: null
32
31
  },
32
+ optionLabel: null,
33
+ optionDisabled: null,
33
34
  optionGroupLabel: null,
34
35
  optionGroupChildren: null,
35
36
  scrollHeight: {
@@ -44,7 +45,7 @@ var script = {
44
45
  type: String,
45
46
  default: 'blank'
46
47
  },
47
- autoHighlight: {
48
+ autoHighlight: { // TODO: Deprecated since v3.16.0
48
49
  type: Boolean,
49
50
  default: false
50
51
  },
@@ -52,6 +53,18 @@ var script = {
52
53
  type: Boolean,
53
54
  default: false
54
55
  },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ placeholder: {
61
+ type: String,
62
+ default: null
63
+ },
64
+ dataKey: {
65
+ type: String,
66
+ default: null
67
+ },
55
68
  minLength: {
56
69
  type: Number,
57
70
  default: 1
@@ -72,45 +85,96 @@ var script = {
72
85
  type: Boolean,
73
86
  default: false
74
87
  },
75
- inputClass: null,
88
+ inputId: String,
76
89
  inputStyle: null,
77
- class: null,
78
- style: null,
90
+ inputClass: null,
91
+ inputProps: null,
92
+ panelStyle: null,
79
93
  panelClass: null,
94
+ panelProps: null,
95
+ loadingIcon: {
96
+ type: String,
97
+ default: 'pi pi-spinner'
98
+ },
80
99
  virtualScrollerOptions: {
81
100
  type: Object,
82
101
  default: null
83
102
  },
84
- loadingIcon: {
103
+ autoOptionFocus: {
104
+ type: Boolean,
105
+ default: true
106
+ },
107
+ searchLocale: {
85
108
  type: String,
86
- default: 'pi pi-spinner'
109
+ default: undefined
110
+ },
111
+ searchMessage: {
112
+ type: String,
113
+ default: null
114
+ },
115
+ selectionMessage: {
116
+ type: String,
117
+ default: null
118
+ },
119
+ emptySelectionMessage: {
120
+ type: String,
121
+ default: null
122
+ },
123
+ emptySearchMessage: {
124
+ type: String,
125
+ default: null
126
+ },
127
+ tabindex: {
128
+ type: Number,
129
+ default: 0
130
+ },
131
+ 'aria-label': {
132
+ type: String,
133
+ default: null
134
+ },
135
+ 'aria-labelledby': {
136
+ type: String,
137
+ default: null
87
138
  }
88
139
  },
89
- timeout: null,
90
140
  outsideClickListener: null,
91
141
  resizeListener: null,
92
142
  scrollHandler: null,
93
143
  overlay: null,
94
144
  virtualScroller: null,
145
+ searchTimeout: null,
146
+ selectOnFocus: false,
147
+ focusOnHover: false,
148
+ dirty: false,
95
149
  data() {
96
150
  return {
97
- searching: false,
151
+ id: utils.UniqueComponentId(),
98
152
  focused: false,
153
+ focusedOptionIndex: -1,
154
+ focusedMultipleOptionIndex: -1,
99
155
  overlayVisible: false,
100
- inputTextValue: null,
101
- highlightItem: null
102
- };
156
+ searching: false
157
+ }
103
158
  },
104
159
  watch: {
105
160
  suggestions() {
106
161
  if (this.searching) {
107
- if (this.suggestions && this.suggestions.length)
108
- this.showOverlay();
109
- else
110
- this.hideOverlay();
111
-
162
+ utils.ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : this.hide();
163
+ this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
112
164
  this.searching = false;
113
165
  }
166
+
167
+ this.autoUpdateModel();
168
+ }
169
+ },
170
+ mounted() {
171
+ this.id = this.$attrs.id || this.id;
172
+
173
+ this.autoUpdateModel();
174
+ },
175
+ updated() {
176
+ if (this.overlayVisible) {
177
+ this.alignOverlay();
114
178
  }
115
179
  },
116
180
  beforeUnmount() {
@@ -127,20 +191,24 @@ var script = {
127
191
  this.overlay = null;
128
192
  }
129
193
  },
130
- updated() {
131
- if (this.overlayVisible) {
132
- this.alignOverlay();
133
- }
134
- },
135
194
  methods: {
136
195
  getOptionIndex(index, fn) {
137
196
  return this.virtualScrollerDisabled ? index : (fn && fn(index)['index']);
138
197
  },
139
- getOptionRenderKey(option) {
140
- return this.getItemContent(option);
198
+ getOptionLabel(option) {
199
+ return this.field || this.optionLabel ? utils.ObjectUtils.resolveFieldData(option, this.field || this.optionLabel) : option;
141
200
  },
142
- getOptionGroupRenderKey(optionGroup) {
143
- return utils.ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
201
+ getOptionValue(option) {
202
+ return option; // TODO: The 'optionValue' properties can be added.
203
+ },
204
+ getOptionRenderKey(option, index) {
205
+ return (this.dataKey ? utils.ObjectUtils.resolveFieldData(option, this.dataKey) : this.getOptionLabel(option)) + '_' + index;
206
+ },
207
+ isOptionDisabled(option) {
208
+ return this.optionDisabled ? utils.ObjectUtils.resolveFieldData(option, this.optionDisabled) : false;
209
+ },
210
+ isOptionGroup(option) {
211
+ return this.optionGroupLabel && option.optionGroup && option.group;
144
212
  },
145
213
  getOptionGroupLabel(optionGroup) {
146
214
  return utils.ObjectUtils.resolveFieldData(optionGroup, this.optionGroupLabel);
@@ -148,28 +216,380 @@ var script = {
148
216
  getOptionGroupChildren(optionGroup) {
149
217
  return utils.ObjectUtils.resolveFieldData(optionGroup, this.optionGroupChildren);
150
218
  },
219
+ getAriaPosInset(index) {
220
+ return (this.optionGroupLabel ? index - this.visibleOptions.slice(0, index).filter(option => this.isOptionGroup(option)).length : index) + 1;
221
+ },
222
+ show(isFocus) {
223
+ this.$emit('before-show');
224
+ this.dirty = true;
225
+ this.overlayVisible = true;
226
+ this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : (this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1);
227
+
228
+ isFocus && this.$refs.focusInput.focus();
229
+ },
230
+ hide(isFocus) {
231
+ const _hide = () => {
232
+ this.$emit('before-hide');
233
+ this.dirty = isFocus;
234
+ this.overlayVisible = false;
235
+ this.focusedOptionIndex = -1;
236
+
237
+ isFocus && this.$refs.focusInput.focus();
238
+ };
239
+
240
+ setTimeout(() => { _hide(); }, 0); // For ScreenReaders
241
+ },
242
+ onFocus(event) {
243
+ if (!this.dirty && this.completeOnFocus) {
244
+ this.search(event, event.target.value, 'focus');
245
+ }
246
+
247
+ this.dirty = true;
248
+ this.focused = true;
249
+ this.focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
250
+ this.overlayVisible && this.scrollInView(this.focusedOptionIndex);
251
+ this.$emit('focus', event);
252
+ },
253
+ onBlur(event) {
254
+ this.dirty = false;
255
+ this.focused = false;
256
+ this.focusedOptionIndex = -1;
257
+ this.$emit('blur', event);
258
+ },
259
+ onKeyDown(event) {
260
+ switch (event.code) {
261
+ case 'ArrowDown':
262
+ this.onArrowDownKey(event);
263
+ break;
264
+
265
+ case 'ArrowUp':
266
+ this.onArrowUpKey(event);
267
+ break;
268
+
269
+ case 'ArrowLeft':
270
+ this.onArrowLeftKey(event);
271
+ break;
272
+
273
+ case 'ArrowRight':
274
+ this.onArrowRightKey(event);
275
+ break;
276
+
277
+ case 'Home':
278
+ this.onHomeKey(event);
279
+ break;
280
+
281
+ case 'End':
282
+ this.onEndKey(event);
283
+ break;
284
+
285
+ case 'PageDown':
286
+ this.onPageDownKey(event);
287
+ break;
288
+
289
+ case 'PageUp':
290
+ this.onPageUpKey(event);
291
+ break;
292
+
293
+ case 'Enter':
294
+ this.onEnterKey(event);
295
+ break;
296
+
297
+ case 'Escape':
298
+ this.onEscapeKey(event);
299
+ break;
300
+
301
+ case 'Tab':
302
+ this.onTabKey(event);
303
+ break;
304
+
305
+ case 'Backspace':
306
+ this.onBackspaceKey(event);
307
+ break;
308
+ }
309
+ },
310
+ onInput(event) {
311
+ if (this.searchTimeout) {
312
+ clearTimeout(this.searchTimeout);
313
+ }
314
+
315
+ let query = event.target.value;
316
+ if (!this.multiple) {
317
+ this.updateModel(event, query);
318
+ }
319
+
320
+ if (query.length === 0) {
321
+ this.hide();
322
+ this.$emit('clear');
323
+ }
324
+ else {
325
+ if (query.length >= this.minLength) {
326
+ this.focusedOptionIndex = -1;
327
+
328
+ this.searchTimeout = setTimeout(() => {
329
+ this.search(event, query, 'input');
330
+ }, this.delay);
331
+ }
332
+ else {
333
+ this.hide();
334
+ }
335
+ }
336
+ },
337
+ onChange(event) {
338
+ if (this.forceSelection) {
339
+ let valid = false;
340
+
341
+ if (this.visibleOptions) {
342
+ const matchedValue = this.visibleOptions.find(option => this.isOptionMatched(option, event.target.value));
343
+
344
+ if (matchedValue !== undefined) {
345
+ valid = true;
346
+ !this.isSelected(matchedValue) && this.onOptionSelect(event, matchedValue);
347
+ }
348
+ }
349
+
350
+ if (!valid) {
351
+ this.$refs.focusInput.value = '';
352
+ this.$emit('clear');
353
+ !this.multiple && this.updateModel(event, null);
354
+ }
355
+ }
356
+ },
357
+ onMultipleContainerFocus() {
358
+ this.focused = true;
359
+ },
360
+ onMultipleContainerBlur() {
361
+ this.focusedMultipleOptionIndex = -1;
362
+ this.focused = false;
363
+ },
364
+ onMultipleContainerKeyDown(event) {
365
+ switch (event.code) {
366
+ case 'ArrowLeft':
367
+ this.onArrowLeftKeyOnMultiple(event);
368
+ break;
369
+
370
+ case 'ArrowRight':
371
+ this.onArrowRightKeyOnMultiple(event);
372
+ break;
373
+
374
+ case 'Backspace':
375
+ this.onBackspaceKeyOnMultiple(event);
376
+ break;
377
+ }
378
+ },
379
+ onContainerClick(event) {
380
+ if (this.disabled || this.searching || this.isInputClicked(event) || this.isDropdownClicked(event)) {
381
+ return;
382
+ }
383
+
384
+ if (!this.overlay || !this.overlay.contains(event.target)) {
385
+ this.$refs.focusInput.focus();
386
+ }
387
+ },
388
+ onDropdownClick(event) {
389
+ let query = undefined;
390
+
391
+ if (this.overlayVisible) {
392
+ this.hide(true);
393
+ }
394
+ else {
395
+ this.$refs.focusInput.focus();
396
+ query = this.$refs.focusInput.value;
397
+
398
+ if (this.dropdownMode === 'blank')
399
+ this.search(event, '', 'dropdown');
400
+ else if (this.dropdownMode === 'current')
401
+ this.search(event, query, 'dropdown');
402
+ }
403
+
404
+ this.$emit('dropdown-click', { originalEvent: event, query });
405
+ },
406
+ onOptionSelect(event, option) {
407
+ const value = this.getOptionValue(option);
408
+
409
+ if (this.multiple) {
410
+ this.$refs.focusInput.value = '';
411
+
412
+ if (!this.isSelected(option)) {
413
+ this.updateModel(event, [...(this.modelValue || []), value]);
414
+ }
415
+ }
416
+ else {
417
+ this.updateModel(event, value);
418
+ }
419
+
420
+ this.$emit('item-select', { originalEvent: event, value: option });
421
+
422
+ this.hide(true);
423
+ },
424
+ onOptionMouseMove(event, index) {
425
+ if (this.focusOnHover) {
426
+ this.changeFocusedOptionIndex(event, index);
427
+ }
428
+ },
429
+ onOverlayClick(event) {
430
+ OverlayEventBus__default["default"].emit('overlay-click', {
431
+ originalEvent: event,
432
+ target: this.$el
433
+ });
434
+ },
435
+ onOverlayKeyDown(event) {
436
+ switch (event.code) {
437
+ case 'Escape':
438
+ this.onEscapeKey(event);
439
+ break;
440
+ }
441
+ },
442
+ onArrowDownKey(event) {
443
+ if (!this.overlayVisible) {
444
+ return;
445
+ }
446
+
447
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findNextOptionIndex(this.focusedOptionIndex) : this.findFirstFocusedOptionIndex();
448
+
449
+ this.changeFocusedOptionIndex(event, optionIndex);
450
+
451
+ event.preventDefault();
452
+ },
453
+ onArrowUpKey(event) {
454
+ if (!this.overlayVisible) {
455
+ return;
456
+ }
457
+
458
+ if (event.altKey) {
459
+ if (this.focusedOptionIndex !== -1) {
460
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
461
+ }
462
+
463
+ this.overlayVisible && this.hide();
464
+ event.preventDefault();
465
+ }
466
+ else {
467
+ const optionIndex = this.focusedOptionIndex !== -1 ? this.findPrevOptionIndex(this.focusedOptionIndex) : this.findLastFocusedOptionIndex();
468
+
469
+ this.changeFocusedOptionIndex(event, optionIndex);
470
+
471
+ event.preventDefault();
472
+ }
473
+ },
474
+ onArrowLeftKey(event) {
475
+ const target = event.currentTarget;
476
+ this.focusedOptionIndex = -1;
477
+
478
+ if (this.multiple) {
479
+ if (utils.ObjectUtils.isEmpty(target.value) && this.hasSelectedOption) {
480
+ this.$refs.multiContainer.focus();
481
+ this.focusedMultipleOptionIndex = this.modelValue.length;
482
+ }
483
+ else {
484
+ event.stopPropagation(); // To prevent onArrowLeftKeyOnMultiple method
485
+ }
486
+ }
487
+ },
488
+ onArrowRightKey(event) {
489
+ this.focusedOptionIndex = -1;
490
+
491
+ this.multiple && event.stopPropagation(); // To prevent onArrowRightKeyOnMultiple method
492
+ },
493
+ onHomeKey(event) {
494
+ event.currentTarget.setSelectionRange(0, 0);
495
+ this.focusedOptionIndex = -1;
496
+
497
+ event.preventDefault();
498
+ },
499
+ onEndKey(event) {
500
+ const target = event.currentTarget;
501
+ const len = target.value.length;
502
+ target.setSelectionRange(len, len);
503
+ this.focusedOptionIndex = -1;
504
+
505
+ event.preventDefault();
506
+ },
507
+ onPageUpKey(event) {
508
+ this.scrollInView(0);
509
+ event.preventDefault();
510
+ },
511
+ onPageDownKey(event) {
512
+ this.scrollInView(this.visibleOptions.length - 1);
513
+ event.preventDefault();
514
+ },
515
+ onEnterKey(event) {
516
+ if (!this.overlayVisible) {
517
+ this.onArrowDownKey(event);
518
+ }
519
+ else {
520
+ if (this.focusedOptionIndex !== -1) {
521
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
522
+ }
523
+
524
+ this.hide();
525
+ }
526
+
527
+ event.preventDefault();
528
+ },
529
+ onEscapeKey(event) {
530
+ this.overlayVisible && this.hide(true);
531
+ event.preventDefault();
532
+ },
533
+ onTabKey(event) {
534
+ if (this.focusedOptionIndex !== -1) {
535
+ this.onOptionSelect(event, this.visibleOptions[this.focusedOptionIndex]);
536
+ }
537
+
538
+ this.overlayVisible && this.hide();
539
+ },
540
+ onBackspaceKey(event) {
541
+ if (this.multiple) {
542
+ if (utils.ObjectUtils.isNotEmpty(this.modelValue) && !this.$refs.focusInput.value) {
543
+ const removedValue = this.modelValue[this.modelValue.length - 1];
544
+ const newValue = this.modelValue.slice(0, -1);
545
+
546
+ this.$emit('update:modelValue', newValue);
547
+ this.$emit('item-unselect', { originalEvent: event, value: removedValue });
548
+ }
549
+
550
+ event.stopPropagation(); // To prevent onBackspaceKeyOnMultiple method
551
+ }
552
+ },
553
+ onArrowLeftKeyOnMultiple() {
554
+ this.focusedMultipleOptionIndex = this.focusedMultipleOptionIndex < 1 ? 0 : this.focusedMultipleOptionIndex - 1;
555
+ },
556
+ onArrowRightKeyOnMultiple() {
557
+ this.focusedMultipleOptionIndex++;
558
+
559
+ if (this.focusedMultipleOptionIndex > (this.modelValue.length - 1)) {
560
+ this.focusedMultipleOptionIndex = -1;
561
+ this.$refs.focusInput.focus();
562
+ }
563
+ },
564
+ onBackspaceKeyOnMultiple(event) {
565
+ if (this.focusedMultipleOptionIndex !== -1) {
566
+ this.removeOption(event, this.focusedMultipleOptionIndex);
567
+ }
568
+ },
151
569
  onOverlayEnter(el) {
152
570
  utils.ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
153
571
  this.alignOverlay();
572
+ },
573
+ onOverlayAfterEnter() {
154
574
  this.bindOutsideClickListener();
155
575
  this.bindScrollListener();
156
576
  this.bindResizeListener();
157
577
 
158
- if (this.autoHighlight && this.suggestions && this.suggestions.length) {
159
- utils.DomHandler.addClass(this.list.firstElementChild, 'p-highlight');
160
- }
578
+ this.$emit('show');
161
579
  },
162
580
  onOverlayLeave() {
163
581
  this.unbindOutsideClickListener();
164
582
  this.unbindScrollListener();
165
583
  this.unbindResizeListener();
584
+
585
+ this.$emit('hide');
166
586
  this.overlay = null;
167
587
  },
168
588
  onOverlayAfterLeave(el) {
169
589
  utils.ZIndexUtils.clear(el);
170
590
  },
171
591
  alignOverlay() {
172
- let target = this.multiple ? this.$refs.multiContainer : this.$refs.input;
592
+ let target = this.multiple ? this.$refs.multiContainer : this.$refs.focusInput;
173
593
  if (this.appendTo === 'self') {
174
594
  utils.DomHandler.relativePosition(this.overlay, target);
175
595
  }
@@ -182,17 +602,23 @@ var script = {
182
602
  if (!this.outsideClickListener) {
183
603
  this.outsideClickListener = (event) => {
184
604
  if (this.overlayVisible && this.overlay && this.isOutsideClicked(event)) {
185
- this.hideOverlay();
605
+ this.hide();
186
606
  }
187
607
  };
188
608
  document.addEventListener('click', this.outsideClickListener);
189
609
  }
190
610
  },
611
+ unbindOutsideClickListener() {
612
+ if (this.outsideClickListener) {
613
+ document.removeEventListener('click', this.outsideClickListener);
614
+ this.outsideClickListener = null;
615
+ }
616
+ },
191
617
  bindScrollListener() {
192
618
  if (!this.scrollHandler) {
193
619
  this.scrollHandler = new utils.ConnectedOverlayScrollHandler(this.$refs.container, () => {
194
620
  if (this.overlayVisible) {
195
- this.hideOverlay();
621
+ this.hide();
196
622
  }
197
623
  });
198
624
  }
@@ -208,7 +634,7 @@ var script = {
208
634
  if (!this.resizeListener) {
209
635
  this.resizeListener = () => {
210
636
  if (this.overlayVisible && !utils.DomHandler.isTouchDevice()) {
211
- this.hideOverlay();
637
+ this.hide();
212
638
  }
213
639
  };
214
640
  window.addEventListener('resize', this.resizeListener);
@@ -227,79 +653,47 @@ var script = {
227
653
  if (this.multiple)
228
654
  return event.target === this.$refs.multiContainer || this.$refs.multiContainer.contains(event.target);
229
655
  else
230
- return event.target === this.$refs.input;
656
+ return event.target === this.$refs.focusInput;
231
657
  },
232
658
  isDropdownClicked(event) {
233
659
  return this.$refs.dropdownButton ? (event.target === this.$refs.dropdownButton || this.$refs.dropdownButton.$el.contains(event.target)) : false;
234
660
  },
235
- unbindOutsideClickListener() {
236
- if (this.outsideClickListener) {
237
- document.removeEventListener('click', this.outsideClickListener);
238
- this.outsideClickListener = null;
239
- }
661
+ isOptionMatched(option, value) {
662
+ return this.isValidOption(option) && this.getOptionLabel(option).toLocaleLowerCase(this.searchLocale) === value.toLocaleLowerCase(this.searchLocale);
240
663
  },
241
- selectItem(event, item) {
242
- if (this.multiple) {
243
- this.$refs.input.value = '';
244
- this.inputTextValue = '';
245
-
246
- if (!this.isSelected(item)) {
247
- let newValue = this.modelValue ? [...this.modelValue, item] : [item];
248
- this.$emit('update:modelValue', newValue);
249
- }
250
- }
251
- else {
252
- this.$emit('update:modelValue', item);
253
- }
254
-
255
- this.$emit('item-select', {
256
- originalEvent: event,
257
- value: item
258
- });
259
-
260
- this.focus();
261
- this.hideOverlay();
664
+ isValidOption(option) {
665
+ return option && !(this.isOptionDisabled(option) || this.isOptionGroup(option));
262
666
  },
263
- onMultiContainerClick(event) {
264
- this.focus();
265
- if(this.completeOnFocus) {
266
- this.search(event, '', 'click');
267
- }
667
+ isValidSelectedOption(option) {
668
+ return this.isValidOption(option) && this.isSelected(option);
268
669
  },
269
- removeItem(event, index) {
270
- let removedValue = this.modelValue[index];
271
- let newValue = this.modelValue.filter((val, i) => (index !== i));
272
- this.$emit('update:modelValue', newValue);
273
- this.$emit('item-unselect', {
274
- originalEvent: event,
275
- value: removedValue
276
- });
670
+ isSelected(option) {
671
+ return utils.ObjectUtils.equals(this.modelValue, this.getOptionValue(option), this.equalityKey);
277
672
  },
278
- onDropdownClick(event) {
279
- this.focus();
280
- const query = this.$refs.input.value;
281
-
282
- if (this.dropdownMode === 'blank')
283
- this.search(event, '', 'dropdown');
284
- else if (this.dropdownMode === 'current')
285
- this.search(event, query, 'dropdown');
286
-
287
- this.$emit('dropdown-click', {
288
- originalEvent: event,
289
- query: query
290
- });
673
+ findFirstOptionIndex() {
674
+ return this.visibleOptions.findIndex(option => this.isValidOption(option));
291
675
  },
292
- getItemContent(item) {
293
- return this.field ? utils.ObjectUtils.resolveFieldData(item, this.field) : item;
676
+ findLastOptionIndex() {
677
+ return utils.ObjectUtils.findLastIndex(this.visibleOptions, option => this.isValidOption(option));
294
678
  },
295
- showOverlay() {
296
- this.overlayVisible = true;
679
+ findNextOptionIndex(index) {
680
+ const matchedOptionIndex = index < (this.visibleOptions.length - 1) ? this.visibleOptions.slice(index + 1).findIndex(option => this.isValidOption(option)) : -1;
681
+ return matchedOptionIndex > -1 ? matchedOptionIndex + index + 1 : index;
682
+ },
683
+ findPrevOptionIndex(index) {
684
+ const matchedOptionIndex = index > 0 ? utils.ObjectUtils.findLastIndex(this.visibleOptions.slice(0, index), option => this.isValidOption(option)) : -1;
685
+ return matchedOptionIndex > -1 ? matchedOptionIndex : index;
686
+ },
687
+ findSelectedOptionIndex() {
688
+ return this.hasSelectedOption ? this.visibleOptions.findIndex(option => this.isValidSelectedOption(option)) : -1;
297
689
  },
298
- hideOverlay() {
299
- this.overlayVisible = false;
690
+ findFirstFocusedOptionIndex() {
691
+ const selectedIndex = this.findSelectedOptionIndex();
692
+ return selectedIndex < 0 ? this.findFirstOptionIndex() : selectedIndex;
300
693
  },
301
- focus() {
302
- this.$refs.input.focus();
694
+ findLastFocusedOptionIndex() {
695
+ const selectedIndex = this.findSelectedOptionIndex();
696
+ return selectedIndex < 0 ? this.findLastOptionIndex() : selectedIndex;
303
697
  },
304
698
  search(event, query, source) {
305
699
  //allow empty string but not undefined or null
@@ -313,242 +707,93 @@ var script = {
313
707
  }
314
708
 
315
709
  this.searching = true;
316
- this.$emit('complete', {
317
- originalEvent: event,
318
- query: query
319
- });
710
+ this.$emit('complete', { originalEvent: event, query });
320
711
  },
321
- onInputClicked(event) {
322
- if(this.completeOnFocus) {
323
- this.search(event, '', 'click');
324
- }
325
- },
326
- onInput(event) {
327
- this.inputTextValue = event.target.value;
328
-
329
- if (this.timeout) {
330
- clearTimeout(this.timeout);
331
- }
332
-
333
- let query = event.target.value;
334
- if (!this.multiple) {
335
- this.$emit('update:modelValue', query);
336
- }
712
+ removeOption(event, index) {
713
+ const removedOption = this.modelValue[index];
714
+ const value = this.modelValue.filter((_, i) => i !== index).map(option => this.getOptionValue(option));
337
715
 
338
- if (query.length === 0) {
339
- this.hideOverlay();
340
- this.$emit('clear');
341
- }
342
- else {
343
- if (query.length >= this.minLength) {
344
- this.timeout = setTimeout(() => {
345
- this.search(event, query, 'input');
346
- }, this.delay);
347
- }
348
- else {
349
- this.hideOverlay();
350
- }
351
- }
352
- },
353
- onFocus() {
354
- this.focused = true;
355
- },
356
- onBlur() {
357
- this.focused = false;
716
+ this.updateModel(event, value);
717
+ this.$emit('item-unselect', { originalEvent: event, value: removedOption });
718
+ this.dirty = true;
719
+ this.$refs.focusInput.focus();
358
720
  },
359
- onKeyDown(event) {
360
- if (this.overlayVisible) {
361
- let highlightItem = utils.DomHandler.findSingle(this.list, 'li.p-highlight');
362
-
363
- switch(event.which) {
364
- //down
365
- case 40:
366
- if (highlightItem) {
367
- let nextElement = this.findNextItem(highlightItem);
368
- if (nextElement) {
369
- utils.DomHandler.addClass(nextElement, 'p-highlight');
370
- utils.DomHandler.removeClass(highlightItem, 'p-highlight');
371
- nextElement.scrollIntoView({ block: 'nearest', inline: 'start' });
372
- }
373
- }
374
- else {
375
- highlightItem = this.list.firstElementChild;
376
- if (utils.DomHandler.hasClass(highlightItem, 'p-autocomplete-item-group')) {
377
- highlightItem = this.findNextItem(highlightItem);
378
- }
379
-
380
- if (highlightItem) {
381
- utils.DomHandler.addClass(highlightItem, 'p-highlight');
382
- }
383
- }
384
-
385
- event.preventDefault();
386
- break;
387
-
388
- //up
389
- case 38:
390
- if (highlightItem) {
391
- let previousElement = this.findPrevItem(highlightItem);
392
- if (previousElement) {
393
- utils.DomHandler.addClass(previousElement, 'p-highlight');
394
- utils.DomHandler.removeClass(highlightItem, 'p-highlight');
395
- previousElement.scrollIntoView({ block: 'nearest', inline: 'start' });
396
- }
397
- }
398
-
399
- event.preventDefault();
400
- break;
401
-
402
- //enter
403
- case 13:
404
- if (highlightItem) {
405
- this.selectHighlightItem(event, highlightItem);
406
- this.hideOverlay();
407
- }
408
-
409
- event.preventDefault();
410
- break;
721
+ changeFocusedOptionIndex(event, index) {
722
+ if (this.focusedOptionIndex !== index) {
723
+ this.focusedOptionIndex = index;
724
+ this.scrollInView();
411
725
 
412
- //escape
413
- case 27:
414
- this.hideOverlay();
415
- event.preventDefault();
416
- break;
417
-
418
- //tab
419
- case 9:
420
- if (highlightItem) {
421
- this.selectHighlightItem(event, highlightItem);
422
- }
423
-
424
- this.hideOverlay();
425
- break;
426
- }
427
- }
428
-
429
- if (this.multiple) {
430
- switch(event.which) {
431
- //backspace
432
- case 8:
433
- if (this.modelValue && this.modelValue.length && !this.$refs.input.value) {
434
- let removedValue = this.modelValue[this.modelValue.length - 1];
435
- let newValue = this.modelValue.slice(0, -1);
436
-
437
- this.$emit('update:modelValue', newValue);
438
- this.$emit('item-unselect', {
439
- originalEvent: event,
440
- value: removedValue
441
- });
442
- }
443
- break;
726
+ if (this.selectOnFocus || this.autoHighlight) {
727
+ this.updateModel(event, this.getOptionValue(this.visibleOptions[index]));
444
728
  }
445
729
  }
446
730
  },
447
- selectHighlightItem(event, item) {
448
- if (this.optionGroupLabel) {
449
- let optionGroup = this.suggestions[item.dataset.group];
450
- this.selectItem(event, this.getOptionGroupChildren(optionGroup)[item.dataset.index]);
731
+ scrollInView(index = -1) {
732
+ const id = index !== -1 ? `${this.id}_${index}` : this.focusedOptionId;
733
+ const element = utils.DomHandler.findSingle(this.list, `li[id="${id}"]`);
734
+ if (element) {
735
+ element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
451
736
  }
452
- else {
453
- this.selectItem(event, this.suggestions[item.dataset.index]);
737
+ else if (!this.virtualScrollerDisabled) {
738
+ setTimeout(() => {
739
+ this.virtualScroller && this.virtualScroller.scrollToIndex(index !== -1 ? index : this.focusedOptionIndex);
740
+ }, 0);
454
741
  }
455
742
  },
456
- findNextItem(item) {
457
- let nextItem = item.nextElementSibling;
458
-
459
- if (nextItem)
460
- return utils.DomHandler.hasClass(nextItem, 'p-autocomplete-item-group') ? this.findNextItem(nextItem) : nextItem;
461
- else
462
- return null;
743
+ autoUpdateModel() {
744
+ if ((this.selectOnFocus || this.autoHighlight) && this.autoOptionFocus && !this.hasSelectedOption) {
745
+ this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
746
+ const value = this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]);
747
+ this.updateModel(null, this.multiple ? [value] : value);
748
+ }
463
749
  },
464
- findPrevItem(item) {
465
- let prevItem = item.previousElementSibling;
466
-
467
- if (prevItem)
468
- return utils.DomHandler.hasClass(prevItem, 'p-autocomplete-item-group') ? this.findPrevItem(prevItem) : prevItem;
469
- else
470
- return null;
750
+ updateModel(event, value) {
751
+ this.$emit('update:modelValue', value);
752
+ this.$emit('change', { originalEvent: event, value });
471
753
  },
472
- onChange(event) {
473
- if (this.forceSelection) {
474
- let valid = false;
475
- let inputValue = event.target.value.trim();
476
-
477
- if (this.suggestions) {
478
- for (let item of this.suggestions) {
479
- let itemValue = this.field ? utils.ObjectUtils.resolveFieldData(item, this.field) : item;
480
- if (itemValue && inputValue === itemValue.trim()) {
481
- valid = true;
482
- this.selectItem(event, item);
483
- break;
484
- }
485
- }
486
- }
754
+ flatOptions(options) {
755
+ return (options || []).reduce((result, option, index) => {
756
+ result.push({ optionGroup: option, group: true, index });
487
757
 
488
- if (!valid) {
489
- this.$refs.input.value = '';
490
- this.inputTextValue = '';
491
- this.$emit('clear');
492
- if (!this.multiple) {
493
- this.$emit('update:modelValue', null);
494
- }
495
- }
496
- }
497
- },
498
- isSelected(val) {
499
- let selected = false;
500
- if (this.modelValue && this.modelValue.length) {
501
- for (let i = 0; i < this.modelValue.length; i++) {
502
- if (utils.ObjectUtils.equals(this.modelValue[i], val)) {
503
- selected = true;
504
- break;
505
- }
506
- }
507
- }
758
+ const optionGroupChildren = this.getOptionGroupChildren(option);
759
+ optionGroupChildren && optionGroupChildren.forEach(o => result.push(o));
508
760
 
509
- return selected;
761
+ return result;
762
+ }, []);
510
763
  },
511
764
  overlayRef(el) {
512
765
  this.overlay = el;
513
766
  },
514
767
  listRef(el, contentRef) {
515
768
  this.list = el;
516
- contentRef && contentRef(el); // for virtualScroller
769
+ contentRef && contentRef(el); // For VirtualScroller
517
770
  },
518
771
  virtualScrollerRef(el) {
519
772
  this.virtualScroller = el;
520
- },
521
- onOverlayClick(event) {
522
- OverlayEventBus__default["default"].emit('overlay-click', {
523
- originalEvent: event,
524
- target: this.$el
525
- });
526
773
  }
527
774
  },
528
775
  computed: {
529
776
  containerClass() {
530
- return ['p-autocomplete p-component p-inputwrapper', this.class, {
777
+ return ['p-autocomplete p-component p-inputwrapper', {
778
+ 'p-disabled': this.disabled,
779
+ 'p-focus': this.focused,
531
780
  'p-autocomplete-dd': this.dropdown,
532
781
  'p-autocomplete-multiple': this.multiple,
533
- 'p-inputwrapper-filled': ((this.modelValue) || (this.inputTextValue && this.inputTextValue.length)),
534
- 'p-inputwrapper-focus': this.focused
782
+ 'p-inputwrapper-filled': this.modelValue || utils.ObjectUtils.isNotEmpty(this.inputValue),
783
+ 'p-inputwrapper-focus': this.focused,
784
+ 'p-overlay-open': this.overlayVisible
535
785
  }];
536
786
  },
537
- inputFieldClass() {
787
+ inputStyleClass() {
538
788
  return ['p-autocomplete-input p-inputtext p-component', this.inputClass, {
539
- 'p-autocomplete-dd-input': this.dropdown,
540
- 'p-disabled': this.$attrs.disabled
789
+ 'p-autocomplete-dd-input': this.dropdown
541
790
  }];
542
791
  },
543
792
  multiContainerClass() {
544
- return ['p-autocomplete-multiple-container p-component p-inputtext', {
545
- 'p-disabled': this.$attrs.disabled,
546
- 'p-focus': this.focused
547
- }];
793
+ return ['p-autocomplete-multiple-container p-component p-inputtext'];
548
794
  },
549
795
  panelStyleClass() {
550
- return [
551
- 'p-autocomplete-panel p-component', this.panelClass, {
796
+ return ['p-autocomplete-panel p-component', this.panelClass, {
552
797
  'p-input-filled': this.$primevue.config.inputStyle === 'filled',
553
798
  'p-ripple-disabled': this.$primevue.config.ripple === false
554
799
  }];
@@ -556,21 +801,55 @@ var script = {
556
801
  loadingIconClass() {
557
802
  return ['p-autocomplete-loader pi-spin', this.loadingIcon];
558
803
  },
804
+ visibleOptions() {
805
+ return this.optionGroupLabel ? this.flatOptions(this.suggestions) : (this.suggestions || []);
806
+ },
559
807
  inputValue() {
560
808
  if (this.modelValue) {
561
- if (this.field && typeof this.modelValue === 'object') {
562
- const resolvedFieldData = utils.ObjectUtils.resolveFieldData(this.modelValue, this.field);
563
- return resolvedFieldData != null ? resolvedFieldData : this.modelValue;
809
+ if (typeof this.modelValue === 'object') {
810
+ const label = this.getOptionLabel(this.modelValue);
811
+ return label != null ? label : this.modelValue;
564
812
  }
565
- else
813
+ else {
566
814
  return this.modelValue;
815
+ }
567
816
  }
568
817
  else {
569
818
  return '';
570
819
  }
571
820
  },
572
- listId() {
573
- return utils.UniqueComponentId() + '_list';
821
+ hasSelectedOption() {
822
+ return utils.ObjectUtils.isNotEmpty(this.modelValue);
823
+ },
824
+ equalityKey() {
825
+ return this.dataKey; // TODO: The 'optionValue' properties can be added.
826
+ },
827
+ searchResultMessageText() {
828
+ return utils.ObjectUtils.isNotEmpty(this.visibleOptions) && this.overlayVisible ? this.searchMessageText.replaceAll('{0}', this.visibleOptions.length) : this.emptySearchMessageText;
829
+ },
830
+ searchMessageText() {
831
+ return this.searchMessage || this.$primevue.config.locale.searchMessage || '';
832
+ },
833
+ emptySearchMessageText() {
834
+ return this.emptySearchMessage || this.$primevue.config.locale.emptySearchMessage || '';
835
+ },
836
+ selectionMessageText() {
837
+ return this.selectionMessage || this.$primevue.config.locale.selectionMessage || '';
838
+ },
839
+ emptySelectionMessageText() {
840
+ return this.emptySelectionMessage || this.$primevue.config.locale.emptySelectionMessage || '';
841
+ },
842
+ selectedMessageText() {
843
+ return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
844
+ },
845
+ focusedOptionId() {
846
+ return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
847
+ },
848
+ focusedMultipleOptionId() {
849
+ return this.focusedMultipleOptionIndex !== -1 ? `${this.id}_multiple_option_${this.focusedMultipleOptionIndex}` : null;
850
+ },
851
+ ariaSetSize() {
852
+ return this.visibleOptions.filter(option => !this.isOptionGroup(option)).length;
574
853
  },
575
854
  virtualScrollerDisabled() {
576
855
  return !this.virtualScrollerOptions;
@@ -586,16 +865,29 @@ var script = {
586
865
  }
587
866
  };
588
867
 
589
- const _hoisted_1 = ["aria-owns", "aria-expanded"];
590
- const _hoisted_2 = ["value", "aria-controls"];
591
- const _hoisted_3 = { class: "p-autocomplete-token-label" };
592
- const _hoisted_4 = ["onClick"];
593
- const _hoisted_5 = { class: "p-autocomplete-input-token" };
594
- const _hoisted_6 = ["aria-controls"];
595
- const _hoisted_7 = ["id"];
596
- const _hoisted_8 = ["onClick", "data-index"];
597
- const _hoisted_9 = { class: "p-autocomplete-item-group" };
598
- const _hoisted_10 = ["onClick", "data-group", "data-index"];
868
+ const _hoisted_1 = ["id", "value", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant"];
869
+ const _hoisted_2 = ["aria-activedescendant"];
870
+ const _hoisted_3 = ["id", "aria-label", "aria-setsize", "aria-posinset"];
871
+ const _hoisted_4 = { class: "p-autocomplete-token-label" };
872
+ const _hoisted_5 = ["onClick"];
873
+ const _hoisted_6 = {
874
+ class: "p-autocomplete-input-token",
875
+ role: "option"
876
+ };
877
+ const _hoisted_7 = ["id", "placeholder", "tabindex", "disabled", "aria-label", "aria-labelledby", "aria-expanded", "aria-controls", "aria-activedescendant"];
878
+ const _hoisted_8 = {
879
+ role: "status",
880
+ "aria-live": "polite",
881
+ class: "p-hidden-accessible"
882
+ };
883
+ const _hoisted_9 = ["id"];
884
+ const _hoisted_10 = ["id"];
885
+ const _hoisted_11 = ["id", "aria-label", "aria-selected", "aria-disabled", "aria-setsize", "aria-posinset", "onClick", "onMousemove"];
886
+ const _hoisted_12 = {
887
+ role: "status",
888
+ "aria-live": "polite",
889
+ class: "p-hidden-accessible"
890
+ };
599
891
 
600
892
  function render(_ctx, _cache, $props, $setup, $data, $options) {
601
893
  const _component_Button = vue.resolveComponent("Button");
@@ -603,78 +895,106 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
603
895
  const _component_Portal = vue.resolveComponent("Portal");
604
896
  const _directive_ripple = vue.resolveDirective("ripple");
605
897
 
606
- return (vue.openBlock(), vue.createElementBlock("span", {
898
+ return (vue.openBlock(), vue.createElementBlock("div", {
607
899
  ref: "container",
608
900
  class: vue.normalizeClass($options.containerClass),
609
- "aria-haspopup": "listbox",
610
- "aria-owns": $options.listId,
611
- "aria-expanded": $data.overlayVisible,
612
- style: vue.normalizeStyle($props.style)
901
+ onClick: _cache[15] || (_cache[15] = (...args) => ($options.onContainerClick && $options.onContainerClick(...args)))
613
902
  }, [
614
903
  (!$props.multiple)
615
904
  ? (vue.openBlock(), vue.createElementBlock("input", vue.mergeProps({
616
905
  key: 0,
617
- ref: "input",
618
- class: $options.inputFieldClass,
619
- style: $props.inputStyle
620
- }, _ctx.$attrs, {
621
- value: $options.inputValue,
622
- onClick: _cache[0] || (_cache[0] = (...args) => ($options.onInputClicked && $options.onInputClicked(...args))),
623
- onInput: _cache[1] || (_cache[1] = (...args) => ($options.onInput && $options.onInput(...args))),
624
- onFocus: _cache[2] || (_cache[2] = (...args) => ($options.onFocus && $options.onFocus(...args))),
625
- onBlur: _cache[3] || (_cache[3] = (...args) => ($options.onBlur && $options.onBlur(...args))),
626
- onKeydown: _cache[4] || (_cache[4] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
627
- onChange: _cache[5] || (_cache[5] = (...args) => ($options.onChange && $options.onChange(...args))),
906
+ ref: "focusInput",
907
+ id: $props.inputId,
628
908
  type: "text",
629
- autoComplete: "off",
630
- role: "searchbox",
909
+ style: $props.inputStyle,
910
+ class: $options.inputStyleClass,
911
+ value: $options.inputValue,
912
+ placeholder: $props.placeholder,
913
+ tabindex: !$props.disabled ? $props.tabindex : -1,
914
+ disabled: $props.disabled,
915
+ autocomplete: "off",
916
+ role: "combobox",
917
+ "aria-label": _ctx.ariaLabel,
918
+ "aria-labelledby": _ctx.ariaLabelledby,
919
+ "aria-haspopup": "listbox",
631
920
  "aria-autocomplete": "list",
632
- "aria-controls": $options.listId
633
- }), null, 16, _hoisted_2))
921
+ "aria-expanded": $data.overlayVisible,
922
+ "aria-controls": $data.id + '_list',
923
+ "aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
924
+ onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFocus && $options.onFocus(...args))),
925
+ onBlur: _cache[1] || (_cache[1] = (...args) => ($options.onBlur && $options.onBlur(...args))),
926
+ onKeydown: _cache[2] || (_cache[2] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
927
+ onInput: _cache[3] || (_cache[3] = (...args) => ($options.onInput && $options.onInput(...args))),
928
+ onChange: _cache[4] || (_cache[4] = (...args) => ($options.onChange && $options.onChange(...args)))
929
+ }, $props.inputProps), null, 16, _hoisted_1))
634
930
  : vue.createCommentVNode("", true),
635
931
  ($props.multiple)
636
932
  ? (vue.openBlock(), vue.createElementBlock("ul", {
637
933
  key: 1,
638
934
  ref: "multiContainer",
639
935
  class: vue.normalizeClass($options.multiContainerClass),
640
- onClick: _cache[11] || (_cache[11] = (...args) => ($options.onMultiContainerClick && $options.onMultiContainerClick(...args)))
936
+ tabindex: "-1",
937
+ role: "listbox",
938
+ "aria-orientation": "horizontal",
939
+ "aria-activedescendant": $data.focused ? $options.focusedMultipleOptionId : undefined,
940
+ onFocus: _cache[10] || (_cache[10] = (...args) => ($options.onMultipleContainerFocus && $options.onMultipleContainerFocus(...args))),
941
+ onBlur: _cache[11] || (_cache[11] = (...args) => ($options.onMultipleContainerBlur && $options.onMultipleContainerBlur(...args))),
942
+ onKeydown: _cache[12] || (_cache[12] = (...args) => ($options.onMultipleContainerKeyDown && $options.onMultipleContainerKeyDown(...args)))
641
943
  }, [
642
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue, (item, i) => {
944
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue, (option, i) => {
643
945
  return (vue.openBlock(), vue.createElementBlock("li", {
644
946
  key: i,
645
- class: "p-autocomplete-token"
947
+ id: $data.id + '_multiple_option_' + i,
948
+ class: vue.normalizeClass(['p-autocomplete-token', {'p-focus': $data.focusedMultipleOptionIndex === i}]),
949
+ role: "option",
950
+ "aria-label": $options.getOptionLabel(option),
951
+ "aria-selected": true,
952
+ "aria-setsize": $props.modelValue.length,
953
+ "aria-posinset": i + 1
646
954
  }, [
647
- vue.renderSlot(_ctx.$slots, "chip", { value: item }, () => [
648
- vue.createElementVNode("span", _hoisted_3, vue.toDisplayString($options.getItemContent(item)), 1)
955
+ vue.renderSlot(_ctx.$slots, "chip", { value: option }, () => [
956
+ vue.createElementVNode("span", _hoisted_4, vue.toDisplayString($options.getOptionLabel(option)), 1)
649
957
  ]),
650
958
  vue.createElementVNode("span", {
651
959
  class: "p-autocomplete-token-icon pi pi-times-circle",
652
- onClick: $event => ($options.removeItem($event, i))
653
- }, null, 8, _hoisted_4)
654
- ]))
960
+ onClick: $event => ($options.removeOption($event, i)),
961
+ "aria-hidden": "true"
962
+ }, null, 8, _hoisted_5)
963
+ ], 10, _hoisted_3))
655
964
  }), 128)),
656
- vue.createElementVNode("li", _hoisted_5, [
965
+ vue.createElementVNode("li", _hoisted_6, [
657
966
  vue.createElementVNode("input", vue.mergeProps({
658
- ref: "input",
967
+ ref: "focusInput",
968
+ id: $props.inputId,
659
969
  type: "text",
660
- autoComplete: "off"
661
- }, _ctx.$attrs, {
662
- onInput: _cache[6] || (_cache[6] = (...args) => ($options.onInput && $options.onInput(...args))),
663
- onFocus: _cache[7] || (_cache[7] = (...args) => ($options.onFocus && $options.onFocus(...args))),
664
- onBlur: _cache[8] || (_cache[8] = (...args) => ($options.onBlur && $options.onBlur(...args))),
665
- onKeydown: _cache[9] || (_cache[9] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
666
- onChange: _cache[10] || (_cache[10] = (...args) => ($options.onChange && $options.onChange(...args))),
667
- role: "searchbox",
970
+ style: $props.inputStyle,
971
+ class: $props.inputClass,
972
+ placeholder: $props.placeholder,
973
+ tabindex: !$props.disabled ? $props.tabindex : -1,
974
+ disabled: $props.disabled,
975
+ autocomplete: "off",
976
+ role: "combobox",
977
+ "aria-label": _ctx.ariaLabel,
978
+ "aria-labelledby": _ctx.ariaLabelledby,
979
+ "aria-haspopup": "listbox",
668
980
  "aria-autocomplete": "list",
669
- "aria-controls": $options.listId
670
- }), null, 16, _hoisted_6)
981
+ "aria-expanded": $data.overlayVisible,
982
+ "aria-controls": $data.id + '_list',
983
+ "aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
984
+ onFocus: _cache[5] || (_cache[5] = (...args) => ($options.onFocus && $options.onFocus(...args))),
985
+ onBlur: _cache[6] || (_cache[6] = (...args) => ($options.onBlur && $options.onBlur(...args))),
986
+ onKeydown: _cache[7] || (_cache[7] = (...args) => ($options.onKeyDown && $options.onKeyDown(...args))),
987
+ onInput: _cache[8] || (_cache[8] = (...args) => ($options.onInput && $options.onInput(...args))),
988
+ onChange: _cache[9] || (_cache[9] = (...args) => ($options.onChange && $options.onChange(...args)))
989
+ }, $props.inputProps), null, 16, _hoisted_7)
671
990
  ])
672
- ], 2))
991
+ ], 42, _hoisted_2))
673
992
  : vue.createCommentVNode("", true),
674
993
  ($data.searching)
675
994
  ? (vue.openBlock(), vue.createElementBlock("i", {
676
995
  key: 2,
677
- class: vue.normalizeClass($options.loadingIconClass)
996
+ class: vue.normalizeClass($options.loadingIconClass),
997
+ "aria-hidden": "true"
678
998
  }, null, 2))
679
999
  : vue.createCommentVNode("", true),
680
1000
  ($props.dropdown)
@@ -684,97 +1004,106 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
684
1004
  type: "button",
685
1005
  icon: "pi pi-chevron-down",
686
1006
  class: "p-autocomplete-dropdown",
687
- disabled: _ctx.$attrs.disabled,
1007
+ tabindex: "-1",
1008
+ disabled: $props.disabled,
1009
+ "aria-hidden": "true",
688
1010
  onClick: $options.onDropdownClick
689
1011
  }, null, 8, ["disabled", "onClick"]))
690
1012
  : vue.createCommentVNode("", true),
1013
+ vue.createElementVNode("span", _hoisted_8, vue.toDisplayString($options.searchResultMessageText), 1),
691
1014
  vue.createVNode(_component_Portal, { appendTo: $props.appendTo }, {
692
1015
  default: vue.withCtx(() => [
693
1016
  vue.createVNode(vue.Transition, {
694
1017
  name: "p-connected-overlay",
695
1018
  onEnter: $options.onOverlayEnter,
1019
+ onAfterEnter: $options.onOverlayAfterEnter,
696
1020
  onLeave: $options.onOverlayLeave,
697
1021
  onAfterLeave: $options.onOverlayAfterLeave
698
1022
  }, {
699
1023
  default: vue.withCtx(() => [
700
1024
  ($data.overlayVisible)
701
- ? (vue.openBlock(), vue.createElementBlock("div", {
1025
+ ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
702
1026
  key: 0,
703
1027
  ref: $options.overlayRef,
704
- class: vue.normalizeClass($options.panelStyleClass),
705
- style: vue.normalizeStyle({'max-height': $options.virtualScrollerDisabled ? $props.scrollHeight : ''}),
706
- onClick: _cache[12] || (_cache[12] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
707
- }, [
1028
+ class: $options.panelStyleClass,
1029
+ style: {...$props.panelStyle, 'max-height': $options.virtualScrollerDisabled ? $props.scrollHeight : ''},
1030
+ onClick: _cache[13] || (_cache[13] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args))),
1031
+ onKeydown: _cache[14] || (_cache[14] = (...args) => ($options.onOverlayKeyDown && $options.onOverlayKeyDown(...args)))
1032
+ }, $props.panelProps), [
708
1033
  vue.renderSlot(_ctx.$slots, "header", {
709
1034
  value: $props.modelValue,
710
- suggestions: $props.suggestions
1035
+ suggestions: $options.visibleOptions
711
1036
  }),
712
1037
  vue.createVNode(_component_VirtualScroller, vue.mergeProps({ ref: $options.virtualScrollerRef }, $props.virtualScrollerOptions, {
713
1038
  style: {'height': $props.scrollHeight},
714
- items: $props.suggestions,
1039
+ items: $options.visibleOptions,
1040
+ tabindex: -1,
715
1041
  disabled: $options.virtualScrollerDisabled
716
1042
  }), vue.createSlots({
717
- content: vue.withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle }) => [
1043
+ content: vue.withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle, itemSize }) => [
718
1044
  vue.createElementVNode("ul", {
719
- id: $options.listId,
720
1045
  ref: (el) => $options.listRef(el, contentRef),
1046
+ id: $data.id + '_list',
721
1047
  class: vue.normalizeClass(['p-autocomplete-items', styleClass]),
722
1048
  style: vue.normalizeStyle(contentStyle),
723
1049
  role: "listbox"
724
1050
  }, [
725
- (!$props.optionGroupLabel)
726
- ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(items, (item, i) => {
727
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
728
- class: "p-autocomplete-item",
729
- key: $options.getOptionRenderKey(item),
730
- onClick: $event => ($options.selectItem($event, item)),
731
- role: "option",
732
- "data-index": $options.getOptionIndex(i, getItemOptions)
733
- }, [
734
- vue.renderSlot(_ctx.$slots, "item", {
735
- item: item,
736
- index: $options.getOptionIndex(i, getItemOptions)
737
- }, () => [
738
- vue.createTextVNode(vue.toDisplayString($options.getItemContent(item)), 1)
739
- ])
740
- ], 8, _hoisted_8)), [
741
- [_directive_ripple]
742
- ])
743
- }), 128))
744
- : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(items, (optionGroup, i) => {
745
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
746
- key: $options.getOptionGroupRenderKey(optionGroup)
747
- }, [
748
- vue.createElementVNode("li", _hoisted_9, [
1051
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items, (option, i) => {
1052
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
1053
+ key: $options.getOptionRenderKey(option, $options.getOptionIndex(i, getItemOptions))
1054
+ }, [
1055
+ ($options.isOptionGroup(option))
1056
+ ? (vue.openBlock(), vue.createElementBlock("li", {
1057
+ key: 0,
1058
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
1059
+ style: vue.normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
1060
+ class: "p-autocomplete-item-group",
1061
+ role: "option"
1062
+ }, [
749
1063
  vue.renderSlot(_ctx.$slots, "optiongroup", {
750
- item: optionGroup,
1064
+ option: option.optionGroup,
1065
+ item: option.optionGroup,
751
1066
  index: $options.getOptionIndex(i, getItemOptions)
752
1067
  }, () => [
753
- vue.createTextVNode(vue.toDisplayString($options.getOptionGroupLabel(optionGroup)), 1)
1068
+ vue.createTextVNode(vue.toDisplayString($options.getOptionGroupLabel(option.optionGroup)), 1)
754
1069
  ])
755
- ]),
756
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($options.getOptionGroupChildren(optionGroup), (item, j) => {
757
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
758
- class: "p-autocomplete-item",
759
- key: j,
760
- onClick: $event => ($options.selectItem($event, item)),
761
- role: "option",
762
- "data-group": i,
763
- "data-index": $options.getOptionIndex(j, getItemOptions)
764
- }, [
765
- vue.renderSlot(_ctx.$slots, "item", {
766
- item: item,
767
- index: $options.getOptionIndex(j, getItemOptions)
768
- }, () => [
769
- vue.createTextVNode(vue.toDisplayString($options.getItemContent(item)), 1)
770
- ])
771
- ], 8, _hoisted_10)), [
772
- [_directive_ripple]
773
- ])
774
- }), 128))
775
- ], 64))
776
- }), 128))
777
- ], 14, _hoisted_7)
1070
+ ], 12, _hoisted_10))
1071
+ : vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
1072
+ key: 1,
1073
+ id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
1074
+ style: vue.normalizeStyle({height: itemSize ? itemSize + 'px' : undefined}),
1075
+ class: vue.normalizeClass(['p-autocomplete-item', {'p-highlight': $options.isSelected(option), 'p-focus': $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), 'p-disabled': $options.isOptionDisabled(option)}]),
1076
+ role: "option",
1077
+ "aria-label": $options.getOptionLabel(option),
1078
+ "aria-selected": $options.isSelected(option),
1079
+ "aria-disabled": $options.isOptionDisabled(option),
1080
+ "aria-setsize": $options.ariaSetSize,
1081
+ "aria-posinset": $options.getAriaPosInset($options.getOptionIndex(i, getItemOptions)),
1082
+ onClick: $event => ($options.onOptionSelect($event, option)),
1083
+ onMousemove: $event => ($options.onOptionMouseMove($event, $options.getOptionIndex(i, getItemOptions)))
1084
+ }, [
1085
+ (_ctx.$slots.option)
1086
+ ? vue.renderSlot(_ctx.$slots, "option", {
1087
+ key: 0,
1088
+ option: option,
1089
+ index: $options.getOptionIndex(i, getItemOptions)
1090
+ }, () => [
1091
+ vue.createTextVNode(vue.toDisplayString($options.getOptionLabel(option)), 1)
1092
+ ])
1093
+ : vue.renderSlot(_ctx.$slots, "item", {
1094
+ key: 1,
1095
+ item: option,
1096
+ index: $options.getOptionIndex(i, getItemOptions)
1097
+ }, () => [
1098
+ vue.createTextVNode(vue.toDisplayString($options.getOptionLabel(option)), 1)
1099
+ ])
1100
+ ], 46, _hoisted_11)), [
1101
+ [_directive_ripple]
1102
+ ])
1103
+ ], 64))
1104
+ }), 128))
1105
+ ], 14, _hoisted_9),
1106
+ vue.createElementVNode("span", _hoisted_12, vue.toDisplayString($options.selectedMessageText), 1)
778
1107
  ]),
779
1108
  _: 2
780
1109
  }, [
@@ -789,17 +1118,17 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
789
1118
  ]), 1040, ["style", "items", "disabled"]),
790
1119
  vue.renderSlot(_ctx.$slots, "footer", {
791
1120
  value: $props.modelValue,
792
- suggestions: $props.suggestions
1121
+ suggestions: $options.visibleOptions
793
1122
  })
794
- ], 6))
1123
+ ], 16))
795
1124
  : vue.createCommentVNode("", true)
796
1125
  ]),
797
1126
  _: 3
798
- }, 8, ["onEnter", "onLeave", "onAfterLeave"])
1127
+ }, 8, ["onEnter", "onAfterEnter", "onLeave", "onAfterLeave"])
799
1128
  ]),
800
1129
  _: 3
801
1130
  }, 8, ["appendTo"])
802
- ], 14, _hoisted_1))
1131
+ ], 2))
803
1132
  }
804
1133
 
805
1134
  function styleInject(css, ref) {