primevue 3.20.0 → 3.21.0

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 (375) hide show
  1. package/autocomplete/AutoComplete.d.ts +5 -1
  2. package/autocomplete/AutoComplete.vue +9 -5
  3. package/autocomplete/autocomplete.cjs.js +10 -6
  4. package/autocomplete/autocomplete.cjs.min.js +1 -1
  5. package/autocomplete/autocomplete.esm.js +10 -6
  6. package/autocomplete/autocomplete.esm.min.js +1 -1
  7. package/autocomplete/autocomplete.js +10 -6
  8. package/autocomplete/autocomplete.min.js +1 -1
  9. package/calendar/Calendar.vue +1 -0
  10. package/calendar/calendar.cjs.js +1 -0
  11. package/calendar/calendar.cjs.min.js +1 -1
  12. package/calendar/calendar.esm.js +1 -0
  13. package/calendar/calendar.esm.min.js +1 -1
  14. package/calendar/calendar.js +1 -0
  15. package/calendar/calendar.min.js +1 -1
  16. package/carousel/Carousel.d.ts +9 -1
  17. package/carousel/Carousel.vue +131 -9
  18. package/carousel/carousel.cjs.js +142 -29
  19. package/carousel/carousel.cjs.min.js +1 -1
  20. package/carousel/carousel.esm.js +143 -30
  21. package/carousel/carousel.esm.min.js +1 -1
  22. package/carousel/carousel.js +143 -30
  23. package/carousel/carousel.min.js +1 -1
  24. package/cascadeselect/CascadeSelect.vue +4 -4
  25. package/cascadeselect/cascadeselect.cjs.js +3 -3
  26. package/cascadeselect/cascadeselect.cjs.min.js +1 -1
  27. package/cascadeselect/cascadeselect.esm.js +3 -3
  28. package/cascadeselect/cascadeselect.esm.min.js +1 -1
  29. package/cascadeselect/cascadeselect.js +3 -3
  30. package/cascadeselect/cascadeselect.min.js +1 -1
  31. package/chart/Chart.d.ts +5 -0
  32. package/chart/Chart.vue +5 -1
  33. package/chart/chart.cjs.js +6 -2
  34. package/chart/chart.cjs.min.js +1 -1
  35. package/chart/chart.esm.js +7 -3
  36. package/chart/chart.esm.min.js +1 -1
  37. package/chart/chart.js +6 -2
  38. package/chart/chart.min.js +1 -1
  39. package/colorpicker/ColorPicker.vue +5 -7
  40. package/colorpicker/colorpicker.cjs.js +5 -7
  41. package/colorpicker/colorpicker.cjs.min.js +1 -1
  42. package/colorpicker/colorpicker.esm.js +5 -7
  43. package/colorpicker/colorpicker.esm.min.js +1 -1
  44. package/colorpicker/colorpicker.js +6 -8
  45. package/colorpicker/colorpicker.min.js +1 -1
  46. package/config/PrimeVue.d.ts +37 -0
  47. package/config/config.cjs.js +38 -1
  48. package/config/config.cjs.min.js +1 -1
  49. package/config/config.esm.js +38 -1
  50. package/config/config.esm.min.js +1 -1
  51. package/config/config.js +38 -1
  52. package/config/config.min.js +1 -1
  53. package/core/core.js +451 -198
  54. package/core/core.min.js +11 -11
  55. package/datatable/BodyCell.vue +39 -14
  56. package/datatable/ColumnFilter.vue +67 -41
  57. package/datatable/DataTable.d.ts +9 -1
  58. package/datatable/DataTable.vue +162 -25
  59. package/datatable/HeaderCell.vue +12 -6
  60. package/datatable/HeaderCheckbox.vue +17 -14
  61. package/datatable/RowCheckbox.vue +28 -13
  62. package/datatable/RowRadioButton.vue +11 -3
  63. package/datatable/TableBody.vue +25 -7
  64. package/datatable/TableFooter.vue +1 -1
  65. package/datatable/TableHeader.vue +9 -3
  66. package/datatable/TableLoadingBody.vue +1 -1
  67. package/datatable/datatable.cjs.js +539 -268
  68. package/datatable/datatable.cjs.min.js +1 -1
  69. package/datatable/datatable.esm.js +538 -268
  70. package/datatable/datatable.esm.min.js +1 -1
  71. package/datatable/datatable.js +538 -268
  72. package/datatable/datatable.min.js +1 -1
  73. package/dataviewlayoutoptions/DataViewLayoutOptions.vue +23 -3
  74. package/dataviewlayoutoptions/dataviewlayoutoptions.cjs.js +40 -11
  75. package/dataviewlayoutoptions/dataviewlayoutoptions.cjs.min.js +1 -1
  76. package/dataviewlayoutoptions/dataviewlayoutoptions.esm.js +40 -11
  77. package/dataviewlayoutoptions/dataviewlayoutoptions.esm.min.js +1 -1
  78. package/dataviewlayoutoptions/dataviewlayoutoptions.js +40 -11
  79. package/dataviewlayoutoptions/dataviewlayoutoptions.min.js +1 -1
  80. package/dialog/Dialog.vue +12 -7
  81. package/dialog/dialog.cjs.js +14 -9
  82. package/dialog/dialog.cjs.min.js +1 -1
  83. package/dialog/dialog.esm.js +14 -9
  84. package/dialog/dialog.esm.min.js +1 -1
  85. package/dialog/dialog.js +14 -9
  86. package/dialog/dialog.min.js +1 -1
  87. package/dropdown/Dropdown.vue +13 -16
  88. package/dropdown/dropdown.cjs.js +13 -16
  89. package/dropdown/dropdown.cjs.min.js +1 -1
  90. package/dropdown/dropdown.esm.js +13 -16
  91. package/dropdown/dropdown.esm.min.js +1 -1
  92. package/dropdown/dropdown.js +13 -16
  93. package/dropdown/dropdown.min.js +1 -1
  94. package/fieldset/Fieldset.vue +1 -1
  95. package/fieldset/fieldset.cjs.js +1 -1
  96. package/fieldset/fieldset.cjs.min.js +1 -1
  97. package/fieldset/fieldset.esm.js +1 -1
  98. package/fieldset/fieldset.esm.min.js +1 -1
  99. package/fieldset/fieldset.js +2 -2
  100. package/fieldset/fieldset.min.js +1 -1
  101. package/fileupload/FileUpload.d.ts +51 -1
  102. package/fileupload/FileUpload.vue +2 -2
  103. package/fileupload/fileupload.cjs.js +2 -2
  104. package/fileupload/fileupload.cjs.min.js +1 -1
  105. package/fileupload/fileupload.esm.js +2 -2
  106. package/fileupload/fileupload.esm.min.js +1 -1
  107. package/fileupload/fileupload.js +2 -2
  108. package/fileupload/fileupload.min.js +1 -1
  109. package/focustrap/focustrap.cjs.js +86 -64
  110. package/focustrap/focustrap.cjs.min.js +1 -1
  111. package/focustrap/focustrap.esm.js +85 -63
  112. package/focustrap/focustrap.esm.min.js +1 -1
  113. package/focustrap/focustrap.js +86 -64
  114. package/focustrap/focustrap.min.js +1 -1
  115. package/galleria/Galleria.d.ts +15 -3
  116. package/galleria/Galleria.vue +36 -6
  117. package/galleria/GalleriaContent.vue +11 -7
  118. package/galleria/GalleriaItem.vue +36 -6
  119. package/galleria/GalleriaThumbnails.vue +108 -4
  120. package/galleria/galleria.cjs.js +258 -122
  121. package/galleria/galleria.cjs.min.js +1 -1
  122. package/galleria/galleria.esm.js +257 -122
  123. package/galleria/galleria.esm.min.js +1 -1
  124. package/galleria/galleria.js +258 -123
  125. package/galleria/galleria.min.js +1 -1
  126. package/image/Image.vue +71 -13
  127. package/image/image.cjs.js +112 -39
  128. package/image/image.cjs.min.js +1 -1
  129. package/image/image.esm.js +112 -40
  130. package/image/image.esm.min.js +1 -1
  131. package/image/image.js +112 -40
  132. package/image/image.min.js +1 -1
  133. package/inputnumber/InputNumber.vue +11 -20
  134. package/inputnumber/inputnumber.cjs.js +11 -20
  135. package/inputnumber/inputnumber.cjs.min.js +1 -1
  136. package/inputnumber/inputnumber.esm.js +11 -20
  137. package/inputnumber/inputnumber.esm.min.js +1 -1
  138. package/inputnumber/inputnumber.js +11 -20
  139. package/inputnumber/inputnumber.min.js +1 -1
  140. package/listbox/Listbox.vue +7 -7
  141. package/listbox/listbox.cjs.js +7 -7
  142. package/listbox/listbox.cjs.min.js +1 -1
  143. package/listbox/listbox.esm.js +7 -7
  144. package/listbox/listbox.esm.min.js +1 -1
  145. package/listbox/listbox.js +8 -8
  146. package/listbox/listbox.min.js +1 -1
  147. package/megamenu/MegaMenu.vue +10 -1
  148. package/megamenu/megamenu.cjs.js +10 -1
  149. package/megamenu/megamenu.cjs.min.js +1 -1
  150. package/megamenu/megamenu.esm.js +10 -1
  151. package/megamenu/megamenu.esm.min.js +1 -1
  152. package/megamenu/megamenu.js +10 -1
  153. package/megamenu/megamenu.min.js +1 -1
  154. package/menu/Menu.vue +8 -2
  155. package/menu/menu.cjs.js +8 -2
  156. package/menu/menu.cjs.min.js +1 -1
  157. package/menu/menu.esm.js +8 -2
  158. package/menu/menu.esm.min.js +1 -1
  159. package/menu/menu.js +8 -2
  160. package/menu/menu.min.js +1 -1
  161. package/menubar/Menubar.vue +7 -2
  162. package/menubar/menubar.cjs.js +7 -2
  163. package/menubar/menubar.cjs.min.js +1 -1
  164. package/menubar/menubar.esm.js +7 -2
  165. package/menubar/menubar.esm.min.js +1 -1
  166. package/menubar/menubar.js +7 -2
  167. package/menubar/menubar.min.js +1 -1
  168. package/message/Message.d.ts +5 -1
  169. package/message/Message.vue +9 -2
  170. package/message/message.cjs.js +17 -6
  171. package/message/message.cjs.min.js +1 -1
  172. package/message/message.esm.js +18 -7
  173. package/message/message.esm.min.js +1 -1
  174. package/message/message.js +17 -6
  175. package/message/message.min.js +1 -1
  176. package/multiselect/MultiSelect.vue +33 -32
  177. package/multiselect/multiselect.cjs.js +33 -32
  178. package/multiselect/multiselect.cjs.min.js +1 -1
  179. package/multiselect/multiselect.esm.js +34 -33
  180. package/multiselect/multiselect.esm.min.js +1 -1
  181. package/multiselect/multiselect.js +33 -32
  182. package/multiselect/multiselect.min.js +1 -1
  183. package/orderlist/OrderList.d.ts +33 -1
  184. package/orderlist/OrderList.vue +258 -63
  185. package/orderlist/orderlist.cjs.js +270 -68
  186. package/orderlist/orderlist.cjs.min.js +1 -1
  187. package/orderlist/orderlist.esm.js +271 -69
  188. package/orderlist/orderlist.esm.min.js +1 -1
  189. package/orderlist/orderlist.js +271 -69
  190. package/orderlist/orderlist.min.js +1 -1
  191. package/organizationchart/OrganizationChartNode.vue +7 -1
  192. package/organizationchart/organizationchart.cjs.js +7 -1
  193. package/organizationchart/organizationchart.cjs.min.js +1 -1
  194. package/organizationchart/organizationchart.esm.js +8 -2
  195. package/organizationchart/organizationchart.esm.min.js +1 -1
  196. package/organizationchart/organizationchart.js +7 -1
  197. package/organizationchart/organizationchart.min.js +1 -1
  198. package/package.json +1 -1
  199. package/paginator/CurrentPageReport.vue +0 -1
  200. package/paginator/JumpToPageDropdown.vue +0 -1
  201. package/paginator/JumpToPageInput.vue +6 -1
  202. package/paginator/PageLinks.vue +16 -1
  203. package/paginator/Paginator.vue +23 -10
  204. package/paginator/RowsPerPageDropdown.vue +0 -1
  205. package/paginator/paginator.cjs.js +35 -15
  206. package/paginator/paginator.cjs.min.js +1 -1
  207. package/paginator/paginator.esm.js +35 -15
  208. package/paginator/paginator.esm.min.js +1 -1
  209. package/paginator/paginator.js +35 -15
  210. package/paginator/paginator.min.js +1 -1
  211. package/panel/Panel.vue +1 -1
  212. package/panel/panel.cjs.js +1 -1
  213. package/panel/panel.cjs.min.js +1 -1
  214. package/panel/panel.esm.js +1 -1
  215. package/panel/panel.esm.min.js +1 -1
  216. package/panel/panel.js +2 -2
  217. package/panel/panel.min.js +1 -1
  218. package/panelmenu/PanelMenuList.vue +57 -0
  219. package/panelmenu/panelmenu.cjs.js +70 -0
  220. package/panelmenu/panelmenu.cjs.min.js +1 -1
  221. package/panelmenu/panelmenu.esm.js +70 -0
  222. package/panelmenu/panelmenu.esm.min.js +1 -1
  223. package/panelmenu/panelmenu.js +70 -0
  224. package/panelmenu/panelmenu.min.js +1 -1
  225. package/password/Password.vue +5 -0
  226. package/password/password.cjs.js +1 -1
  227. package/password/password.cjs.min.js +1 -1
  228. package/password/password.esm.js +1 -1
  229. package/password/password.esm.min.js +1 -1
  230. package/password/password.js +1 -1
  231. package/password/password.min.js +1 -1
  232. package/picklist/PickList.d.ts +45 -1
  233. package/picklist/PickList.vue +296 -58
  234. package/picklist/picklist.cjs.js +340 -88
  235. package/picklist/picklist.cjs.min.js +1 -1
  236. package/picklist/picklist.esm.js +341 -89
  237. package/picklist/picklist.esm.min.js +1 -1
  238. package/picklist/picklist.js +341 -89
  239. package/picklist/picklist.min.js +1 -1
  240. package/resources/primevue.css +2 -6
  241. package/resources/primevue.min.css +1 -1
  242. package/resources/themes/arya-blue/theme.css +31 -13
  243. package/resources/themes/arya-green/theme.css +31 -13
  244. package/resources/themes/arya-orange/theme.css +31 -13
  245. package/resources/themes/arya-purple/theme.css +31 -13
  246. package/resources/themes/bootstrap4-dark-blue/theme.css +31 -13
  247. package/resources/themes/bootstrap4-dark-purple/theme.css +31 -13
  248. package/resources/themes/bootstrap4-light-blue/theme.css +31 -13
  249. package/resources/themes/bootstrap4-light-purple/theme.css +31 -13
  250. package/resources/themes/fluent-light/theme.css +31 -13
  251. package/resources/themes/lara-dark-blue/theme.css +35 -13
  252. package/resources/themes/lara-dark-indigo/theme.css +35 -13
  253. package/resources/themes/lara-dark-purple/theme.css +35 -13
  254. package/resources/themes/lara-dark-teal/theme.css +35 -13
  255. package/resources/themes/lara-light-blue/theme.css +35 -13
  256. package/resources/themes/lara-light-indigo/theme.css +35 -13
  257. package/resources/themes/lara-light-purple/theme.css +35 -13
  258. package/resources/themes/lara-light-teal/theme.css +35 -13
  259. package/resources/themes/luna-amber/theme.css +31 -13
  260. package/resources/themes/luna-blue/theme.css +31 -13
  261. package/resources/themes/luna-green/theme.css +31 -13
  262. package/resources/themes/luna-pink/theme.css +31 -13
  263. package/resources/themes/md-dark-deeppurple/theme.css +55 -19
  264. package/resources/themes/md-dark-indigo/theme.css +55 -19
  265. package/resources/themes/md-light-deeppurple/theme.css +55 -19
  266. package/resources/themes/md-light-indigo/theme.css +55 -19
  267. package/resources/themes/mdc-dark-deeppurple/theme.css +55 -19
  268. package/resources/themes/mdc-dark-indigo/theme.css +55 -19
  269. package/resources/themes/mdc-light-deeppurple/theme.css +55 -19
  270. package/resources/themes/mdc-light-indigo/theme.css +55 -19
  271. package/resources/themes/nova/theme.css +31 -13
  272. package/resources/themes/nova-accent/theme.css +31 -13
  273. package/resources/themes/nova-alt/theme.css +31 -13
  274. package/resources/themes/nova-vue/theme.css +31 -13
  275. package/resources/themes/rhea/theme.css +31 -13
  276. package/resources/themes/saga-blue/theme.css +31 -13
  277. package/resources/themes/saga-green/theme.css +31 -13
  278. package/resources/themes/saga-orange/theme.css +31 -13
  279. package/resources/themes/saga-purple/theme.css +31 -13
  280. package/resources/themes/tailwind-light/theme.css +35 -13
  281. package/resources/themes/vela-blue/theme.css +31 -13
  282. package/resources/themes/vela-green/theme.css +31 -13
  283. package/resources/themes/vela-orange/theme.css +31 -13
  284. package/resources/themes/vela-purple/theme.css +31 -13
  285. package/selectbutton/SelectButton.vue +1 -1
  286. package/selectbutton/selectbutton.cjs.js +1 -1
  287. package/selectbutton/selectbutton.cjs.min.js +1 -1
  288. package/selectbutton/selectbutton.esm.js +1 -1
  289. package/selectbutton/selectbutton.esm.min.js +1 -1
  290. package/selectbutton/selectbutton.js +2 -2
  291. package/selectbutton/selectbutton.min.js +1 -1
  292. package/speeddial/SpeedDial.d.ts +19 -1
  293. package/speeddial/SpeedDial.vue +250 -7
  294. package/speeddial/speeddial.cjs.js +254 -13
  295. package/speeddial/speeddial.cjs.min.js +1 -1
  296. package/speeddial/speeddial.esm.js +255 -14
  297. package/speeddial/speeddial.esm.min.js +1 -1
  298. package/speeddial/speeddial.js +254 -13
  299. package/speeddial/speeddial.min.js +1 -1
  300. package/splitbutton/SplitButton.d.ts +16 -4
  301. package/splitbutton/SplitButton.vue +49 -8
  302. package/splitbutton/splitbutton.cjs.js +49 -16
  303. package/splitbutton/splitbutton.cjs.min.js +1 -1
  304. package/splitbutton/splitbutton.esm.js +49 -16
  305. package/splitbutton/splitbutton.esm.min.js +1 -1
  306. package/splitbutton/splitbutton.js +49 -16
  307. package/splitbutton/splitbutton.min.js +1 -1
  308. package/tabmenu/TabMenu.vue +2 -14
  309. package/tabmenu/tabmenu.cjs.js +12 -11
  310. package/tabmenu/tabmenu.cjs.min.js +1 -1
  311. package/tabmenu/tabmenu.esm.js +12 -11
  312. package/tabmenu/tabmenu.esm.min.js +1 -1
  313. package/tabmenu/tabmenu.js +12 -11
  314. package/tabmenu/tabmenu.min.js +1 -1
  315. package/tieredmenu/TieredMenu.vue +13 -3
  316. package/tieredmenu/tieredmenu.cjs.js +13 -3
  317. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  318. package/tieredmenu/tieredmenu.esm.js +13 -3
  319. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  320. package/tieredmenu/tieredmenu.js +13 -3
  321. package/tieredmenu/tieredmenu.min.js +1 -1
  322. package/toast/Toast.d.ts +5 -1
  323. package/toast/Toast.vue +5 -0
  324. package/toast/ToastMessage.vue +36 -8
  325. package/toast/toast.cjs.js +48 -12
  326. package/toast/toast.cjs.min.js +1 -1
  327. package/toast/toast.esm.js +49 -13
  328. package/toast/toast.esm.min.js +1 -1
  329. package/toast/toast.js +48 -12
  330. package/toast/toast.min.js +1 -1
  331. package/toolbar/Toolbar.d.ts +6 -0
  332. package/toolbar/Toolbar.vue +12 -2
  333. package/toolbar/toolbar.cjs.js +7 -3
  334. package/toolbar/toolbar.cjs.min.js +1 -1
  335. package/toolbar/toolbar.esm.js +7 -3
  336. package/toolbar/toolbar.esm.min.js +1 -1
  337. package/toolbar/toolbar.js +7 -3
  338. package/toolbar/toolbar.min.js +1 -1
  339. package/tree/Tree.d.ts +8 -0
  340. package/tree/Tree.vue +10 -2
  341. package/tree/TreeNode.vue +174 -37
  342. package/tree/tree.cjs.js +192 -58
  343. package/tree/tree.cjs.min.js +1 -1
  344. package/tree/tree.esm.js +192 -58
  345. package/tree/tree.esm.min.js +1 -1
  346. package/tree/tree.js +192 -58
  347. package/tree/tree.min.js +1 -1
  348. package/treeselect/TreeSelect.vue +40 -26
  349. package/treeselect/treeselect.cjs.js +45 -29
  350. package/treeselect/treeselect.cjs.min.js +1 -1
  351. package/treeselect/treeselect.esm.js +43 -27
  352. package/treeselect/treeselect.esm.min.js +1 -1
  353. package/treeselect/treeselect.js +44 -28
  354. package/treeselect/treeselect.min.js +1 -1
  355. package/treetable/BodyCell.vue +4 -4
  356. package/treetable/HeaderCell.vue +4 -2
  357. package/treetable/TreeTable.d.ts +4 -0
  358. package/treetable/TreeTable.vue +43 -17
  359. package/treetable/TreeTableRow.vue +200 -59
  360. package/treetable/treetable.cjs.js +797 -620
  361. package/treetable/treetable.cjs.min.js +1 -1
  362. package/treetable/treetable.esm.js +794 -617
  363. package/treetable/treetable.esm.min.js +1 -1
  364. package/treetable/treetable.js +794 -617
  365. package/treetable/treetable.min.js +1 -1
  366. package/utils/utils.cjs.js +26 -6
  367. package/utils/utils.cjs.min.js +1 -1
  368. package/utils/utils.esm.js +26 -6
  369. package/utils/utils.esm.min.js +1 -1
  370. package/utils/utils.js +26 -6
  371. package/utils/utils.min.js +1 -1
  372. package/vetur-attributes.json +153 -1
  373. package/vetur-tags.json +51 -13
  374. package/web-types.json +420 -4
  375. package/galleria/GalleriaItemSlot.vue +0 -53
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes, InputHTMLAttributes, VNode } from 'vue';
2
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
- import { VirtualScrollerProps, VirtualScrollerItemOptions } from '../virtualscroller';
3
+ import { VirtualScrollerItemOptions, VirtualScrollerProps } from '../virtualscroller';
4
4
 
5
5
  type AutoCompleteFieldType = string | ((data: any) => string) | undefined;
6
6
 
@@ -192,6 +192,10 @@ export interface AutoCompleteProps {
192
192
  * Default value is 'pi pi-chevron-down'.
193
193
  */
194
194
  dropdownIcon?: string | undefined;
195
+ /**
196
+ * Style class of the dropdown button.
197
+ */
198
+ dropdownClass?: string | undefined;
195
199
  /**
196
200
  * Icon to display in loading state.
197
201
  * Default value is 'pi pi-spinner pi-spin'.
@@ -84,7 +84,7 @@
84
84
  </li>
85
85
  </ul>
86
86
  <i v-if="searching" :class="loadingIconClass" aria-hidden="true"></i>
87
- <Button v-if="dropdown" ref="dropdownButton" type="button" :icon="dropdownIcon" class="p-autocomplete-dropdown" tabindex="-1" :disabled="disabled" aria-hidden="true" @click="onDropdownClick" />
87
+ <Button v-if="dropdown" ref="dropdownButton" type="button" :icon="dropdownIcon" :class="['p-autocomplete-dropdown', dropdownClass]" tabindex="-1" :disabled="disabled" aria-hidden="true" @click="onDropdownClick" />
88
88
  <span role="status" aria-live="polite" class="p-hidden-accessible">
89
89
  {{ searchResultMessageText }}
90
90
  </span>
@@ -120,15 +120,15 @@
120
120
  </li>
121
121
  </template>
122
122
  </ul>
123
- <span role="status" aria-live="polite" class="p-hidden-accessible">
124
- {{ selectedMessageText }}
125
- </span>
126
123
  </template>
127
124
  <template v-if="$slots.loader" v-slot:loader="{ options }">
128
125
  <slot name="loader" :options="options"></slot>
129
126
  </template>
130
127
  </VirtualScroller>
131
128
  <slot name="footer" :value="modelValue" :suggestions="visibleOptions"></slot>
129
+ <span role="status" aria-live="polite" class="p-hidden-accessible">
130
+ {{ selectedMessageText }}
131
+ </span>
132
132
  </div>
133
133
  </transition>
134
134
  </Portal>
@@ -246,6 +246,10 @@ export default {
246
246
  type: String,
247
247
  default: 'pi pi-chevron-down'
248
248
  },
249
+ dropdownClass: {
250
+ type: String,
251
+ default: null
252
+ },
249
253
  loadingIcon: {
250
254
  type: String,
251
255
  default: 'pi pi-spinner'
@@ -506,7 +510,7 @@ export default {
506
510
  let valid = false;
507
511
 
508
512
  if (this.visibleOptions) {
509
- const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, event.target.value));
513
+ const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, this.$refs.focusInput.value || ''));
510
514
 
511
515
  if (matchedValue !== undefined) {
512
516
  valid = true;
@@ -119,6 +119,10 @@ var script = {
119
119
  type: String,
120
120
  default: 'pi pi-chevron-down'
121
121
  },
122
+ dropdownClass: {
123
+ type: String,
124
+ default: null
125
+ },
122
126
  loadingIcon: {
123
127
  type: String,
124
128
  default: 'pi pi-spinner'
@@ -371,7 +375,7 @@ var script = {
371
375
  let valid = false;
372
376
 
373
377
  if (this.visibleOptions) {
374
- const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, event.target.value));
378
+ const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, this.$refs.focusInput.value || ''));
375
379
 
376
380
  if (matchedValue !== undefined) {
377
381
  valid = true;
@@ -1060,12 +1064,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1060
1064
  ref: "dropdownButton",
1061
1065
  type: "button",
1062
1066
  icon: $props.dropdownIcon,
1063
- class: "p-autocomplete-dropdown",
1067
+ class: vue.normalizeClass(['p-autocomplete-dropdown', $props.dropdownClass]),
1064
1068
  tabindex: "-1",
1065
1069
  disabled: $props.disabled,
1066
1070
  "aria-hidden": "true",
1067
1071
  onClick: $options.onDropdownClick
1068
- }, null, 8, ["icon", "disabled", "onClick"]))
1072
+ }, null, 8, ["icon", "class", "disabled", "onClick"]))
1069
1073
  : vue.createCommentVNode("", true),
1070
1074
  vue.createElementVNode("span", _hoisted_8, vue.toDisplayString($options.searchResultMessageText), 1),
1071
1075
  vue.createVNode(_component_Portal, { appendTo: $props.appendTo }, {
@@ -1159,8 +1163,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1159
1163
  ])
1160
1164
  ], 64))
1161
1165
  }), 128))
1162
- ], 14, _hoisted_9),
1163
- vue.createElementVNode("span", _hoisted_12, vue.toDisplayString($options.selectedMessageText), 1)
1166
+ ], 14, _hoisted_9)
1164
1167
  ]),
1165
1168
  _: 2
1166
1169
  }, [
@@ -1177,7 +1180,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1177
1180
  vue.renderSlot(_ctx.$slots, "footer", {
1178
1181
  value: $props.modelValue,
1179
1182
  suggestions: $options.visibleOptions
1180
- })
1183
+ }),
1184
+ vue.createElementVNode("span", _hoisted_12, vue.toDisplayString($options.selectedMessageText), 1)
1181
1185
  ], 16))
1182
1186
  : vue.createCommentVNode("", true)
1183
1187
  ]),
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/button"),t=require("primevue/overlayeventbus"),i=require("primevue/portal"),n=require("primevue/ripple"),o=require("primevue/utils"),l=require("primevue/virtualscroller"),s=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(e),d=a(t),p=a(i),u=a(n),c=a(l),h={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data:()=>({focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}),watch:{suggestions(){this.searching&&(o.ObjectUtils.isNotEmpty(this.suggestions)?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(o.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?o.ObjectUtils.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?o.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&o.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&o.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e)},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((t=>this.isOptionMatched(t,e.target.value)));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.focused=!0},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||o.DomHandler.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(o.DomHandler.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],n])):this.updateModel(e,n),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){d.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(o.ObjectUtils.isEmpty(t.value)&&this.hasSelectedOption?(o.DomHandler.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const t=e.currentTarget.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,t):e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const t=e.currentTarget,i=t.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,i):t.setSelectionRange(i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(o.ObjectUtils.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,o.DomHandler.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){o.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){o.ZIndexUtils.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?o.DomHandler.relativePosition(this.overlay,e):(this.overlay.style.minWidth=o.DomHandler.getOuterWidth(e)+"px",o.DomHandler.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new o.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!o.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return o.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],n=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,n),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,o.DomHandler.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=o.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||o.ObjectUtils.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return o.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return o.ObjectUtils.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},id(){return this.$attrs.id||o.UniqueComponentId()},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:r.default,VirtualScroller:c.default,Portal:p.default},directives:{ripple:u.default}};const f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],m=["aria-activedescendant"],y=["id","aria-label","aria-setsize","aria-posinset"],b={class:"p-autocomplete-token-label"},g=["onClick"],O={class:"p-autocomplete-input-token",role:"option"},v=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],x={role:"status","aria-live":"polite",class:"p-hidden-accessible"},I=["id"],w=["id"],k=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],S={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),h.render=function(e,t,i,n,o,l){const a=s.resolveComponent("Button"),r=s.resolveComponent("VirtualScroller"),d=s.resolveComponent("Portal"),p=s.resolveDirective("ripple");return s.openBlock(),s.createElementBlock("div",{ref:"container",class:s.normalizeClass(l.containerClass),onClick:t[15]||(t[15]=(...e)=>l.onContainerClick&&l.onContainerClick(...e))},[i.multiple?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("input",s.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:l.inputStyleClass,value:l.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":l.id+"_list","aria-activedescendant":o.focused?l.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>l.onFocus&&l.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>l.onBlur&&l.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>l.onKeyDown&&l.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>l.onInput&&l.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>l.onChange&&l.onChange(...e))},i.inputProps),null,16,f)),i.multiple?(s.openBlock(),s.createElementBlock("ul",{key:1,ref:"multiContainer",class:s.normalizeClass(l.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":o.focused?l.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>l.onMultipleContainerFocus&&l.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>l.onMultipleContainerBlur&&l.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>l.onMultipleContainerKeyDown&&l.onMultipleContainerKeyDown(...e))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.modelValue,((t,n)=>(s.openBlock(),s.createElementBlock("li",{key:n,id:l.id+"_multiple_option_"+n,class:s.normalizeClass(["p-autocomplete-token",{"p-focus":o.focusedMultipleOptionIndex===n}]),role:"option","aria-label":l.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":n+1},[s.renderSlot(e.$slots,"chip",{value:t},(()=>[s.createElementVNode("span",b,s.toDisplayString(l.getOptionLabel(t)),1)])),s.createElementVNode("span",{class:s.normalizeClass(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>l.removeOption(e,n),"aria-hidden":"true"},null,10,g)],10,y)))),128)),s.createElementVNode("li",O,[s.createElementVNode("input",s.mergeProps({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":l.id+"_list","aria-activedescendant":o.focused?l.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>l.onFocus&&l.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>l.onBlur&&l.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>l.onKeyDown&&l.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>l.onInput&&l.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>l.onChange&&l.onChange(...e))},i.inputProps),null,16,v)])],42,m)):s.createCommentVNode("",!0),o.searching?(s.openBlock(),s.createElementBlock("i",{key:2,class:s.normalizeClass(l.loadingIconClass),"aria-hidden":"true"},null,2)):s.createCommentVNode("",!0),i.dropdown?(s.openBlock(),s.createBlock(a,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:"p-autocomplete-dropdown",tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:l.onDropdownClick},null,8,["icon","disabled","onClick"])):s.createCommentVNode("",!0),s.createElementVNode("span",x,s.toDisplayString(l.searchResultMessageText),1),s.createVNode(d,{appendTo:i.appendTo},{default:s.withCtx((()=>[s.createVNode(s.Transition,{name:"p-connected-overlay",onEnter:l.onOverlayEnter,onAfterEnter:l.onOverlayAfterEnter,onLeave:l.onOverlayLeave,onAfterLeave:l.onOverlayAfterLeave},{default:s.withCtx((()=>[o.overlayVisible?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:l.overlayRef,class:l.panelStyleClass,style:{...i.panelStyle,"max-height":l.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>l.onOverlayClick&&l.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>l.onOverlayKeyDown&&l.onOverlayKeyDown(...e))},i.panelProps),[s.renderSlot(e.$slots,"header",{value:i.modelValue,suggestions:l.visibleOptions}),s.createVNode(r,s.mergeProps({ref:l.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:l.visibleOptions,tabindex:-1,disabled:l.virtualScrollerDisabled}),s.createSlots({content:s.withCtx((({styleClass:t,contentRef:i,items:n,getItemOptions:a,contentStyle:r,itemSize:d})=>[s.createElementVNode("ul",{ref:e=>l.listRef(e,i),id:l.id+"_list",class:s.normalizeClass(["p-autocomplete-items",t]),style:s.normalizeStyle(r),role:"listbox"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n,((t,i)=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:l.getOptionRenderKey(t,l.getOptionIndex(i,a))},[l.isOptionGroup(t)?(s.openBlock(),s.createElementBlock("li",{key:0,id:l.id+"_"+l.getOptionIndex(i,a),style:s.normalizeStyle({height:d?d+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[s.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionGroupLabel(t.optionGroup)),1)]))],12,w)):s.withDirectives((s.openBlock(),s.createElementBlock("li",{key:1,id:l.id+"_"+l.getOptionIndex(i,a),style:s.normalizeStyle({height:d?d+"px":void 0}),class:s.normalizeClass(["p-autocomplete-item",{"p-highlight":l.isSelected(t),"p-focus":o.focusedOptionIndex===l.getOptionIndex(i,a),"p-disabled":l.isOptionDisabled(t)}]),role:"option","aria-label":l.getOptionLabel(t),"aria-selected":l.isSelected(t),"aria-disabled":l.isOptionDisabled(t),"aria-setsize":l.ariaSetSize,"aria-posinset":l.getAriaPosInset(l.getOptionIndex(i,a)),onClick:e=>l.onOptionSelect(e,t),onMousemove:e=>l.onOptionMouseMove(e,l.getOptionIndex(i,a))},[e.$slots.option?s.renderSlot(e.$slots,"option",{key:0,option:t,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionLabel(t)),1)])):s.renderSlot(e.$slots,"item",{key:1,item:t,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionLabel(t)),1)]))],46,k)),[[p]])],64)))),128))],14,I),s.createElementVNode("span",S,s.toDisplayString(l.selectedMessageText),1)])),_:2},[e.$slots.loader?{name:"loader",fn:s.withCtx((({options:t})=>[s.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),s.renderSlot(e.$slots,"footer",{value:i.modelValue,suggestions:l.visibleOptions})],16)):s.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)},module.exports=h;
1
+ "use strict";var e=require("primevue/button"),t=require("primevue/overlayeventbus"),i=require("primevue/portal"),n=require("primevue/ripple"),o=require("primevue/utils"),l=require("primevue/virtualscroller"),s=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(e),d=a(t),p=a(i),u=a(n),c=a(l),h={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},dropdownClass:{type:String,default:null},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data:()=>({focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}),watch:{suggestions(){this.searching&&(o.ObjectUtils.isNotEmpty(this.suggestions)?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(o.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?o.ObjectUtils.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?o.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&o.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&o.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e)},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((e=>this.isOptionMatched(e,this.$refs.focusInput.value||"")));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.focused=!0},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||o.DomHandler.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(o.DomHandler.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],n])):this.updateModel(e,n),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){d.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(o.ObjectUtils.isEmpty(t.value)&&this.hasSelectedOption?(o.DomHandler.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const t=e.currentTarget.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,t):e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const t=e.currentTarget,i=t.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,i):t.setSelectionRange(i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(o.ObjectUtils.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,o.DomHandler.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){o.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){o.ZIndexUtils.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?o.DomHandler.relativePosition(this.overlay,e):(this.overlay.style.minWidth=o.DomHandler.getOuterWidth(e)+"px",o.DomHandler.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new o.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!o.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return o.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],n=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,n),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,o.DomHandler.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=o.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||o.ObjectUtils.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return o.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return o.ObjectUtils.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},id(){return this.$attrs.id||o.UniqueComponentId()},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:r.default,VirtualScroller:c.default,Portal:p.default},directives:{ripple:u.default}};const f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],m=["aria-activedescendant"],y=["id","aria-label","aria-setsize","aria-posinset"],b={class:"p-autocomplete-token-label"},g=["onClick"],O={class:"p-autocomplete-input-token",role:"option"},v=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],x={role:"status","aria-live":"polite",class:"p-hidden-accessible"},I=["id"],w=["id"],k=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],S={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),h.render=function(e,t,i,n,o,l){const a=s.resolveComponent("Button"),r=s.resolveComponent("VirtualScroller"),d=s.resolveComponent("Portal"),p=s.resolveDirective("ripple");return s.openBlock(),s.createElementBlock("div",{ref:"container",class:s.normalizeClass(l.containerClass),onClick:t[15]||(t[15]=(...e)=>l.onContainerClick&&l.onContainerClick(...e))},[i.multiple?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("input",s.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:l.inputStyleClass,value:l.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":l.id+"_list","aria-activedescendant":o.focused?l.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>l.onFocus&&l.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>l.onBlur&&l.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>l.onKeyDown&&l.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>l.onInput&&l.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>l.onChange&&l.onChange(...e))},i.inputProps),null,16,f)),i.multiple?(s.openBlock(),s.createElementBlock("ul",{key:1,ref:"multiContainer",class:s.normalizeClass(l.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":o.focused?l.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>l.onMultipleContainerFocus&&l.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>l.onMultipleContainerBlur&&l.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>l.onMultipleContainerKeyDown&&l.onMultipleContainerKeyDown(...e))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.modelValue,((t,n)=>(s.openBlock(),s.createElementBlock("li",{key:n,id:l.id+"_multiple_option_"+n,class:s.normalizeClass(["p-autocomplete-token",{"p-focus":o.focusedMultipleOptionIndex===n}]),role:"option","aria-label":l.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":n+1},[s.renderSlot(e.$slots,"chip",{value:t},(()=>[s.createElementVNode("span",b,s.toDisplayString(l.getOptionLabel(t)),1)])),s.createElementVNode("span",{class:s.normalizeClass(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>l.removeOption(e,n),"aria-hidden":"true"},null,10,g)],10,y)))),128)),s.createElementVNode("li",O,[s.createElementVNode("input",s.mergeProps({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":l.id+"_list","aria-activedescendant":o.focused?l.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>l.onFocus&&l.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>l.onBlur&&l.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>l.onKeyDown&&l.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>l.onInput&&l.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>l.onChange&&l.onChange(...e))},i.inputProps),null,16,v)])],42,m)):s.createCommentVNode("",!0),o.searching?(s.openBlock(),s.createElementBlock("i",{key:2,class:s.normalizeClass(l.loadingIconClass),"aria-hidden":"true"},null,2)):s.createCommentVNode("",!0),i.dropdown?(s.openBlock(),s.createBlock(a,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:s.normalizeClass(["p-autocomplete-dropdown",i.dropdownClass]),tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:l.onDropdownClick},null,8,["icon","class","disabled","onClick"])):s.createCommentVNode("",!0),s.createElementVNode("span",x,s.toDisplayString(l.searchResultMessageText),1),s.createVNode(d,{appendTo:i.appendTo},{default:s.withCtx((()=>[s.createVNode(s.Transition,{name:"p-connected-overlay",onEnter:l.onOverlayEnter,onAfterEnter:l.onOverlayAfterEnter,onLeave:l.onOverlayLeave,onAfterLeave:l.onOverlayAfterLeave},{default:s.withCtx((()=>[o.overlayVisible?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:l.overlayRef,class:l.panelStyleClass,style:{...i.panelStyle,"max-height":l.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>l.onOverlayClick&&l.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>l.onOverlayKeyDown&&l.onOverlayKeyDown(...e))},i.panelProps),[s.renderSlot(e.$slots,"header",{value:i.modelValue,suggestions:l.visibleOptions}),s.createVNode(r,s.mergeProps({ref:l.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:l.visibleOptions,tabindex:-1,disabled:l.virtualScrollerDisabled}),s.createSlots({content:s.withCtx((({styleClass:t,contentRef:i,items:n,getItemOptions:a,contentStyle:r,itemSize:d})=>[s.createElementVNode("ul",{ref:e=>l.listRef(e,i),id:l.id+"_list",class:s.normalizeClass(["p-autocomplete-items",t]),style:s.normalizeStyle(r),role:"listbox"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n,((t,i)=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:l.getOptionRenderKey(t,l.getOptionIndex(i,a))},[l.isOptionGroup(t)?(s.openBlock(),s.createElementBlock("li",{key:0,id:l.id+"_"+l.getOptionIndex(i,a),style:s.normalizeStyle({height:d?d+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[s.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionGroupLabel(t.optionGroup)),1)]))],12,w)):s.withDirectives((s.openBlock(),s.createElementBlock("li",{key:1,id:l.id+"_"+l.getOptionIndex(i,a),style:s.normalizeStyle({height:d?d+"px":void 0}),class:s.normalizeClass(["p-autocomplete-item",{"p-highlight":l.isSelected(t),"p-focus":o.focusedOptionIndex===l.getOptionIndex(i,a),"p-disabled":l.isOptionDisabled(t)}]),role:"option","aria-label":l.getOptionLabel(t),"aria-selected":l.isSelected(t),"aria-disabled":l.isOptionDisabled(t),"aria-setsize":l.ariaSetSize,"aria-posinset":l.getAriaPosInset(l.getOptionIndex(i,a)),onClick:e=>l.onOptionSelect(e,t),onMousemove:e=>l.onOptionMouseMove(e,l.getOptionIndex(i,a))},[e.$slots.option?s.renderSlot(e.$slots,"option",{key:0,option:t,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionLabel(t)),1)])):s.renderSlot(e.$slots,"item",{key:1,item:t,index:l.getOptionIndex(i,a)},(()=>[s.createTextVNode(s.toDisplayString(l.getOptionLabel(t)),1)]))],46,k)),[[p]])],64)))),128))],14,I)])),_:2},[e.$slots.loader?{name:"loader",fn:s.withCtx((({options:t})=>[s.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),s.renderSlot(e.$slots,"footer",{value:i.modelValue,suggestions:l.visibleOptions}),s.createElementVNode("span",S,s.toDisplayString(l.selectedMessageText),1)],16)):s.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)},module.exports=h;
@@ -109,6 +109,10 @@ var script = {
109
109
  type: String,
110
110
  default: 'pi pi-chevron-down'
111
111
  },
112
+ dropdownClass: {
113
+ type: String,
114
+ default: null
115
+ },
112
116
  loadingIcon: {
113
117
  type: String,
114
118
  default: 'pi pi-spinner'
@@ -361,7 +365,7 @@ var script = {
361
365
  let valid = false;
362
366
 
363
367
  if (this.visibleOptions) {
364
- const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, event.target.value));
368
+ const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, this.$refs.focusInput.value || ''));
365
369
 
366
370
  if (matchedValue !== undefined) {
367
371
  valid = true;
@@ -1050,12 +1054,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1050
1054
  ref: "dropdownButton",
1051
1055
  type: "button",
1052
1056
  icon: $props.dropdownIcon,
1053
- class: "p-autocomplete-dropdown",
1057
+ class: normalizeClass(['p-autocomplete-dropdown', $props.dropdownClass]),
1054
1058
  tabindex: "-1",
1055
1059
  disabled: $props.disabled,
1056
1060
  "aria-hidden": "true",
1057
1061
  onClick: $options.onDropdownClick
1058
- }, null, 8, ["icon", "disabled", "onClick"]))
1062
+ }, null, 8, ["icon", "class", "disabled", "onClick"]))
1059
1063
  : createCommentVNode("", true),
1060
1064
  createElementVNode("span", _hoisted_8, toDisplayString($options.searchResultMessageText), 1),
1061
1065
  createVNode(_component_Portal, { appendTo: $props.appendTo }, {
@@ -1149,8 +1153,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1149
1153
  ])
1150
1154
  ], 64))
1151
1155
  }), 128))
1152
- ], 14, _hoisted_9),
1153
- createElementVNode("span", _hoisted_12, toDisplayString($options.selectedMessageText), 1)
1156
+ ], 14, _hoisted_9)
1154
1157
  ]),
1155
1158
  _: 2
1156
1159
  }, [
@@ -1167,7 +1170,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1167
1170
  renderSlot(_ctx.$slots, "footer", {
1168
1171
  value: $props.modelValue,
1169
1172
  suggestions: $options.visibleOptions
1170
- })
1173
+ }),
1174
+ createElementVNode("span", _hoisted_12, toDisplayString($options.selectedMessageText), 1)
1171
1175
  ], 16))
1172
1176
  : createCommentVNode("", true)
1173
1177
  ]),
@@ -1 +1 @@
1
- import e from"primevue/button";import t from"primevue/overlayeventbus";import i from"primevue/portal";import n from"primevue/ripple";import{ObjectUtils as o,ZIndexUtils as s,DomHandler as l,ConnectedOverlayScrollHandler as a,UniqueComponentId as r}from"primevue/utils";import p from"primevue/virtualscroller";import{resolveComponent as d,resolveDirective as u,openBlock as c,createElementBlock as h,normalizeClass as f,mergeProps as y,createCommentVNode as m,Fragment as b,renderList as g,renderSlot as O,createElementVNode as v,toDisplayString as x,createBlock as I,createVNode as w,withCtx as S,Transition as k,createSlots as C,normalizeStyle as L,createTextVNode as M,withDirectives as V}from"vue";var $={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data:()=>({focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}),watch:{suggestions(){this.searching&&(o.isNotEmpty(this.suggestions)?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(s.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?o.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?o.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&l.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&l.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e)},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((t=>this.isOptionMatched(t,e.target.value)));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.focused=!0},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||l.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(l.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],n])):this.updateModel(e,n),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){t.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(o.isEmpty(t.value)&&this.hasSelectedOption?(l.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const t=e.currentTarget.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,t):e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const t=e.currentTarget,i=t.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,i):t.setSelectionRange(i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(o.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,l.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){s.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){s.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?l.relativePosition(this.overlay,e):(this.overlay.style.minWidth=l.getOuterWidth(e)+"px",l.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new a(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!l.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return o.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],n=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,n),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,l.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=l.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||o.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return o.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return o.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},id(){return this.$attrs.id||r()},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:e,VirtualScroller:p,Portal:i},directives:{ripple:n}};const K=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],D=["aria-activedescendant"],F=["id","aria-label","aria-setsize","aria-posinset"],T={class:"p-autocomplete-token-label"},E=["onClick"],A={class:"p-autocomplete-input-token",role:"option"},B=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],R={role:"status","aria-live":"polite",class:"p-hidden-accessible"},z=["id"],P=["id"],G=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],H={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),$.render=function(e,t,i,n,o,s){const l=d("Button"),a=d("VirtualScroller"),r=d("Portal"),p=u("ripple");return c(),h("div",{ref:"container",class:f(s.containerClass),onClick:t[15]||(t[15]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.multiple?m("",!0):(c(),h("input",y({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,K)),i.multiple?(c(),h("ul",{key:1,ref:"multiContainer",class:f(s.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":o.focused?s.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>s.onMultipleContainerFocus&&s.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onMultipleContainerBlur&&s.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>s.onMultipleContainerKeyDown&&s.onMultipleContainerKeyDown(...e))},[(c(!0),h(b,null,g(i.modelValue,((t,n)=>(c(),h("li",{key:n,id:s.id+"_multiple_option_"+n,class:f(["p-autocomplete-token",{"p-focus":o.focusedMultipleOptionIndex===n}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":n+1},[O(e.$slots,"chip",{value:t},(()=>[v("span",T,x(s.getOptionLabel(t)),1)])),v("span",{class:f(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>s.removeOption(e,n),"aria-hidden":"true"},null,10,E)],10,F)))),128)),v("li",A,[v("input",y({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,B)])],42,D)):m("",!0),o.searching?(c(),h("i",{key:2,class:f(s.loadingIconClass),"aria-hidden":"true"},null,2)):m("",!0),i.dropdown?(c(),I(l,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:"p-autocomplete-dropdown",tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:s.onDropdownClick},null,8,["icon","disabled","onClick"])):m("",!0),v("span",R,x(s.searchResultMessageText),1),w(r,{appendTo:i.appendTo},{default:S((()=>[w(k,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:S((()=>[o.overlayVisible?(c(),h("div",y({key:0,ref:s.overlayRef,class:s.panelStyleClass,style:{...i.panelStyle,"max-height":s.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[O(e.$slots,"header",{value:i.modelValue,suggestions:s.visibleOptions}),w(a,y({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled}),C({content:S((({styleClass:t,contentRef:i,items:n,getItemOptions:l,contentStyle:a,itemSize:r})=>[v("ul",{ref:e=>s.listRef(e,i),id:s.id+"_list",class:f(["p-autocomplete-items",t]),style:L(a),role:"listbox"},[(c(!0),h(b,null,g(n,((t,i)=>(c(),h(b,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,l))},[s.isOptionGroup(t)?(c(),h("li",{key:0,id:s.id+"_"+s.getOptionIndex(i,l),style:L({height:r?r+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[O(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,P)):V((c(),h("li",{key:1,id:s.id+"_"+s.getOptionIndex(i,l),style:L({height:r?r+"px":void 0}),class:f(["p-autocomplete-item",{"p-highlight":s.isSelected(t),"p-focus":o.focusedOptionIndex===s.getOptionIndex(i,l),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,l)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,l))},[e.$slots.option?O(e.$slots,"option",{key:0,option:t,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionLabel(t)),1)])):O(e.$slots,"item",{key:1,item:t,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionLabel(t)),1)]))],46,G)),[[p]])],64)))),128))],14,z),v("span",H,x(s.selectedMessageText),1)])),_:2},[e.$slots.loader?{name:"loader",fn:S((({options:t})=>[O(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),O(e.$slots,"footer",{value:i.modelValue,suggestions:s.visibleOptions})],16)):m("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)};export{$ as default};
1
+ import e from"primevue/button";import t from"primevue/overlayeventbus";import i from"primevue/portal";import n from"primevue/ripple";import{ObjectUtils as o,ZIndexUtils as s,DomHandler as l,ConnectedOverlayScrollHandler as a,UniqueComponentId as r}from"primevue/utils";import p from"primevue/virtualscroller";import{resolveComponent as d,resolveDirective as u,openBlock as c,createElementBlock as h,normalizeClass as f,mergeProps as y,createCommentVNode as m,Fragment as b,renderList as g,renderSlot as O,createElementVNode as v,toDisplayString as x,createBlock as I,createVNode as w,withCtx as S,Transition as k,createSlots as C,normalizeStyle as L,createTextVNode as M,withDirectives as V}from"vue";var $={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},dropdownClass:{type:String,default:null},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data:()=>({focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}),watch:{suggestions(){this.searching&&(o.isNotEmpty(this.suggestions)?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(s.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?o.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?o.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&l.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&l.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e)},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((e=>this.isOptionMatched(e,this.$refs.focusInput.value||"")));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.focused=!0},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||l.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(l.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],n])):this.updateModel(e,n),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){t.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(o.isEmpty(t.value)&&this.hasSelectedOption?(l.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const t=e.currentTarget.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,t):e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const t=e.currentTarget,i=t.value.length;e.shiftKey?e.currentTarget.setSelectionRange(0,i):t.setSelectionRange(i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(o.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,l.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){s.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){s.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?l.relativePosition(this.overlay,e):(this.overlay.style.minWidth=l.getOuterWidth(e)+"px",l.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new a(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!l.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return o.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],n=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,n),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,l.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=l.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||o.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return o.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return o.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},id(){return this.$attrs.id||r()},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:e,VirtualScroller:p,Portal:i},directives:{ripple:n}};const K=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],D=["aria-activedescendant"],F=["id","aria-label","aria-setsize","aria-posinset"],T={class:"p-autocomplete-token-label"},E=["onClick"],A={class:"p-autocomplete-input-token",role:"option"},B=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],R={role:"status","aria-live":"polite",class:"p-hidden-accessible"},z=["id"],P=["id"],G=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],H={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),$.render=function(e,t,i,n,o,s){const l=d("Button"),a=d("VirtualScroller"),r=d("Portal"),p=u("ripple");return c(),h("div",{ref:"container",class:f(s.containerClass),onClick:t[15]||(t[15]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.multiple?m("",!0):(c(),h("input",y({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,K)),i.multiple?(c(),h("ul",{key:1,ref:"multiContainer",class:f(s.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":o.focused?s.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>s.onMultipleContainerFocus&&s.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onMultipleContainerBlur&&s.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>s.onMultipleContainerKeyDown&&s.onMultipleContainerKeyDown(...e))},[(c(!0),h(b,null,g(i.modelValue,((t,n)=>(c(),h("li",{key:n,id:s.id+"_multiple_option_"+n,class:f(["p-autocomplete-token",{"p-focus":o.focusedMultipleOptionIndex===n}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":n+1},[O(e.$slots,"chip",{value:t},(()=>[v("span",T,x(s.getOptionLabel(t)),1)])),v("span",{class:f(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>s.removeOption(e,n),"aria-hidden":"true"},null,10,E)],10,F)))),128)),v("li",A,[v("input",y({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":o.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,B)])],42,D)):m("",!0),o.searching?(c(),h("i",{key:2,class:f(s.loadingIconClass),"aria-hidden":"true"},null,2)):m("",!0),i.dropdown?(c(),I(l,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:f(["p-autocomplete-dropdown",i.dropdownClass]),tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:s.onDropdownClick},null,8,["icon","class","disabled","onClick"])):m("",!0),v("span",R,x(s.searchResultMessageText),1),w(r,{appendTo:i.appendTo},{default:S((()=>[w(k,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:S((()=>[o.overlayVisible?(c(),h("div",y({key:0,ref:s.overlayRef,class:s.panelStyleClass,style:{...i.panelStyle,"max-height":s.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[O(e.$slots,"header",{value:i.modelValue,suggestions:s.visibleOptions}),w(a,y({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled}),C({content:S((({styleClass:t,contentRef:i,items:n,getItemOptions:l,contentStyle:a,itemSize:r})=>[v("ul",{ref:e=>s.listRef(e,i),id:s.id+"_list",class:f(["p-autocomplete-items",t]),style:L(a),role:"listbox"},[(c(!0),h(b,null,g(n,((t,i)=>(c(),h(b,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,l))},[s.isOptionGroup(t)?(c(),h("li",{key:0,id:s.id+"_"+s.getOptionIndex(i,l),style:L({height:r?r+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[O(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,P)):V((c(),h("li",{key:1,id:s.id+"_"+s.getOptionIndex(i,l),style:L({height:r?r+"px":void 0}),class:f(["p-autocomplete-item",{"p-highlight":s.isSelected(t),"p-focus":o.focusedOptionIndex===s.getOptionIndex(i,l),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,l)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,l))},[e.$slots.option?O(e.$slots,"option",{key:0,option:t,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionLabel(t)),1)])):O(e.$slots,"item",{key:1,item:t,index:s.getOptionIndex(i,l)},(()=>[M(x(s.getOptionLabel(t)),1)]))],46,G)),[[p]])],64)))),128))],14,z)])),_:2},[e.$slots.loader?{name:"loader",fn:S((({options:t})=>[O(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),O(e.$slots,"footer",{value:i.modelValue,suggestions:s.visibleOptions}),v("span",H,x(s.selectedMessageText),1)],16)):m("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)};export{$ as default};
@@ -113,6 +113,10 @@ this.primevue.autocomplete = (function (Button, OverlayEventBus, Portal, Ripple,
113
113
  type: String,
114
114
  default: 'pi pi-chevron-down'
115
115
  },
116
+ dropdownClass: {
117
+ type: String,
118
+ default: null
119
+ },
116
120
  loadingIcon: {
117
121
  type: String,
118
122
  default: 'pi pi-spinner'
@@ -365,7 +369,7 @@ this.primevue.autocomplete = (function (Button, OverlayEventBus, Portal, Ripple,
365
369
  let valid = false;
366
370
 
367
371
  if (this.visibleOptions) {
368
- const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, event.target.value));
372
+ const matchedValue = this.visibleOptions.find((option) => this.isOptionMatched(option, this.$refs.focusInput.value || ''));
369
373
 
370
374
  if (matchedValue !== undefined) {
371
375
  valid = true;
@@ -1054,12 +1058,12 @@ this.primevue.autocomplete = (function (Button, OverlayEventBus, Portal, Ripple,
1054
1058
  ref: "dropdownButton",
1055
1059
  type: "button",
1056
1060
  icon: $props.dropdownIcon,
1057
- class: "p-autocomplete-dropdown",
1061
+ class: vue.normalizeClass(['p-autocomplete-dropdown', $props.dropdownClass]),
1058
1062
  tabindex: "-1",
1059
1063
  disabled: $props.disabled,
1060
1064
  "aria-hidden": "true",
1061
1065
  onClick: $options.onDropdownClick
1062
- }, null, 8, ["icon", "disabled", "onClick"]))
1066
+ }, null, 8, ["icon", "class", "disabled", "onClick"]))
1063
1067
  : vue.createCommentVNode("", true),
1064
1068
  vue.createElementVNode("span", _hoisted_8, vue.toDisplayString($options.searchResultMessageText), 1),
1065
1069
  vue.createVNode(_component_Portal, { appendTo: $props.appendTo }, {
@@ -1153,8 +1157,7 @@ this.primevue.autocomplete = (function (Button, OverlayEventBus, Portal, Ripple,
1153
1157
  ])
1154
1158
  ], 64))
1155
1159
  }), 128))
1156
- ], 14, _hoisted_9),
1157
- vue.createElementVNode("span", _hoisted_12, vue.toDisplayString($options.selectedMessageText), 1)
1160
+ ], 14, _hoisted_9)
1158
1161
  ]),
1159
1162
  _: 2
1160
1163
  }, [
@@ -1171,7 +1174,8 @@ this.primevue.autocomplete = (function (Button, OverlayEventBus, Portal, Ripple,
1171
1174
  vue.renderSlot(_ctx.$slots, "footer", {
1172
1175
  value: $props.modelValue,
1173
1176
  suggestions: $options.visibleOptions
1174
- })
1177
+ }),
1178
+ vue.createElementVNode("span", _hoisted_12, vue.toDisplayString($options.selectedMessageText), 1)
1175
1179
  ], 16))
1176
1180
  : vue.createCommentVNode("", true)
1177
1181
  ]),