primevue 3.15.0 → 3.16.2

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