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