primevue 3.44.0 → 3.45.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 (467) hide show
  1. package/accordion/Accordion.vue +1 -0
  2. package/accordion/accordion.cjs.js +1 -0
  3. package/accordion/accordion.cjs.min.js +1 -1
  4. package/accordion/accordion.esm.js +1 -0
  5. package/accordion/accordion.esm.min.js +1 -1
  6. package/accordion/accordion.js +1 -0
  7. package/accordion/accordion.min.js +1 -1
  8. package/basecomponent/BaseComponent.vue +1 -1
  9. package/basecomponent/basecomponent.cjs.js +2 -2
  10. package/basecomponent/basecomponent.cjs.min.js +1 -1
  11. package/basecomponent/basecomponent.esm.js +2 -2
  12. package/basecomponent/basecomponent.esm.min.js +1 -1
  13. package/basecomponent/basecomponent.js +2 -2
  14. package/basecomponent/basecomponent.min.js +1 -1
  15. package/basecomponent/style/basecomponentstyle.cjs.js +1 -1
  16. package/basecomponent/style/basecomponentstyle.cjs.min.js +1 -1
  17. package/basecomponent/style/basecomponentstyle.esm.js +1 -1
  18. package/basecomponent/style/basecomponentstyle.esm.min.js +1 -1
  19. package/basecomponent/style/basecomponentstyle.js +1 -1
  20. package/basecomponent/style/basecomponentstyle.min.js +1 -1
  21. package/baseicon/BaseIcon.vue +8 -14
  22. package/baseicon/baseicon.cjs.js +10 -15
  23. package/baseicon/baseicon.cjs.min.js +1 -1
  24. package/baseicon/baseicon.esm.js +10 -15
  25. package/baseicon/baseicon.esm.min.js +1 -1
  26. package/baseicon/baseicon.js +10 -15
  27. package/baseicon/baseicon.min.js +1 -1
  28. package/calendar/Calendar.vue +5 -2
  29. package/calendar/calendar.cjs.js +5 -2
  30. package/calendar/calendar.cjs.min.js +1 -1
  31. package/calendar/calendar.esm.js +5 -2
  32. package/calendar/calendar.esm.min.js +1 -1
  33. package/calendar/calendar.js +5 -2
  34. package/calendar/calendar.min.js +1 -1
  35. package/cascadeselect/CascadeSelect.vue +1 -0
  36. package/cascadeselect/cascadeselect.cjs.js +1 -0
  37. package/cascadeselect/cascadeselect.cjs.min.js +1 -1
  38. package/cascadeselect/cascadeselect.esm.js +1 -0
  39. package/cascadeselect/cascadeselect.esm.min.js +1 -1
  40. package/cascadeselect/cascadeselect.js +1 -0
  41. package/cascadeselect/cascadeselect.min.js +1 -1
  42. package/cascadeselect/style/cascadeselectstyle.cjs.js +1 -1
  43. package/cascadeselect/style/cascadeselectstyle.cjs.min.js +1 -1
  44. package/cascadeselect/style/cascadeselectstyle.esm.js +1 -1
  45. package/cascadeselect/style/cascadeselectstyle.esm.min.js +1 -1
  46. package/cascadeselect/style/cascadeselectstyle.js +1 -1
  47. package/cascadeselect/style/cascadeselectstyle.min.js +1 -1
  48. package/chips/Chips.vue +1 -0
  49. package/chips/chips.cjs.js +1 -0
  50. package/chips/chips.cjs.min.js +1 -1
  51. package/chips/chips.esm.js +1 -0
  52. package/chips/chips.esm.min.js +1 -1
  53. package/chips/chips.js +1 -0
  54. package/chips/chips.min.js +1 -1
  55. package/column/Column.vue +7 -0
  56. package/column/column.cjs.js +9 -0
  57. package/column/column.cjs.min.js +1 -1
  58. package/column/column.esm.js +9 -0
  59. package/column/column.esm.min.js +1 -1
  60. package/column/column.js +9 -0
  61. package/column/column.min.js +1 -1
  62. package/columngroup/ColumnGroup.vue +7 -0
  63. package/columngroup/columngroup.cjs.js +9 -0
  64. package/columngroup/columngroup.cjs.min.js +1 -1
  65. package/columngroup/columngroup.esm.js +9 -0
  66. package/columngroup/columngroup.esm.min.js +1 -1
  67. package/columngroup/columngroup.js +9 -0
  68. package/columngroup/columngroup.min.js +1 -1
  69. package/confirmdialog/ConfirmDialog.d.ts +1 -1
  70. package/confirmpopup/ConfirmPopup.vue +2 -2
  71. package/confirmpopup/confirmpopup.cjs.js +2 -2
  72. package/confirmpopup/confirmpopup.cjs.min.js +1 -1
  73. package/confirmpopup/confirmpopup.esm.js +2 -2
  74. package/confirmpopup/confirmpopup.esm.min.js +1 -1
  75. package/confirmpopup/confirmpopup.js +2 -2
  76. package/confirmpopup/confirmpopup.min.js +1 -1
  77. package/contextmenu/ContextMenu.vue +1 -0
  78. package/contextmenu/contextmenu.cjs.js +1 -0
  79. package/contextmenu/contextmenu.cjs.min.js +1 -1
  80. package/contextmenu/contextmenu.esm.js +1 -0
  81. package/contextmenu/contextmenu.esm.min.js +1 -1
  82. package/contextmenu/contextmenu.js +1 -0
  83. package/contextmenu/contextmenu.min.js +1 -1
  84. package/core/core.js +276 -132
  85. package/core/core.min.js +22 -22
  86. package/datatable/BaseDataTable.vue +2 -2
  87. package/datatable/BodyRow.vue +578 -0
  88. package/datatable/ColumnFilter.vue +1 -0
  89. package/datatable/DataTable.d.ts +1 -1
  90. package/datatable/DataTable.vue +111 -132
  91. package/datatable/HeaderCell.vue +9 -7
  92. package/datatable/TableBody.vue +74 -414
  93. package/datatable/TableFooter.vue +19 -26
  94. package/datatable/TableHeader.vue +19 -26
  95. package/datatable/datatable.cjs.js +891 -634
  96. package/datatable/datatable.cjs.min.js +1 -1
  97. package/datatable/datatable.esm.js +892 -635
  98. package/datatable/datatable.esm.min.js +1 -1
  99. package/datatable/datatable.js +891 -634
  100. package/datatable/datatable.min.js +1 -1
  101. package/datatable/style/datatablestyle.cjs.js +5 -4
  102. package/datatable/style/datatablestyle.cjs.min.js +1 -1
  103. package/datatable/style/datatablestyle.esm.js +5 -4
  104. package/datatable/style/datatablestyle.esm.min.js +1 -1
  105. package/datatable/style/datatablestyle.js +5 -4
  106. package/datatable/style/datatablestyle.min.js +1 -1
  107. package/dialog/style/dialogstyle.cjs.js +1 -1
  108. package/dialog/style/dialogstyle.cjs.min.js +1 -1
  109. package/dialog/style/dialogstyle.esm.js +1 -1
  110. package/dialog/style/dialogstyle.esm.min.js +1 -1
  111. package/dialog/style/dialogstyle.js +1 -1
  112. package/dialog/style/dialogstyle.min.js +1 -1
  113. package/dock/DockSub.vue +1 -0
  114. package/dock/dock.cjs.js +1 -0
  115. package/dock/dock.cjs.min.js +1 -1
  116. package/dock/dock.esm.js +1 -0
  117. package/dock/dock.esm.min.js +1 -1
  118. package/dock/dock.js +1 -0
  119. package/dock/dock.min.js +1 -1
  120. package/dropdown/Dropdown.vue +26 -0
  121. package/dropdown/dropdown.cjs.js +49 -25
  122. package/dropdown/dropdown.cjs.min.js +1 -1
  123. package/dropdown/dropdown.esm.js +49 -25
  124. package/dropdown/dropdown.esm.min.js +1 -1
  125. package/dropdown/dropdown.js +49 -25
  126. package/dropdown/dropdown.min.js +1 -1
  127. package/fieldset/Fieldset.vue +1 -1
  128. package/fieldset/fieldset.cjs.js +1 -1
  129. package/fieldset/fieldset.cjs.min.js +1 -1
  130. package/fieldset/fieldset.esm.js +1 -1
  131. package/fieldset/fieldset.esm.min.js +1 -1
  132. package/fieldset/fieldset.js +1 -1
  133. package/fieldset/fieldset.min.js +1 -1
  134. package/galleria/GalleriaItem.vue +1 -0
  135. package/galleria/GalleriaThumbnails.vue +1 -1
  136. package/galleria/galleria.cjs.js +2 -1
  137. package/galleria/galleria.cjs.min.js +1 -1
  138. package/galleria/galleria.esm.js +2 -1
  139. package/galleria/galleria.esm.min.js +1 -1
  140. package/galleria/galleria.js +2 -1
  141. package/galleria/galleria.min.js +1 -1
  142. package/icons/sortamountdown/index.cjs.js +10 -7
  143. package/icons/sortamountdown/index.cjs.min.js +1 -1
  144. package/icons/sortamountdown/index.esm.js +11 -8
  145. package/icons/sortamountdown/index.esm.min.js +1 -1
  146. package/icons/sortamountdown/index.js +10 -7
  147. package/icons/sortamountdown/index.min.js +1 -1
  148. package/icons/sortamountdown/index.vue +1 -21
  149. package/icons/sortamountupalt/index.cjs.js +10 -7
  150. package/icons/sortamountupalt/index.cjs.min.js +1 -1
  151. package/icons/sortamountupalt/index.esm.js +11 -8
  152. package/icons/sortamountupalt/index.esm.min.js +1 -1
  153. package/icons/sortamountupalt/index.js +10 -7
  154. package/icons/sortamountupalt/index.min.js +1 -1
  155. package/icons/sortamountupalt/index.vue +1 -21
  156. package/image/Image.vue +2 -6
  157. package/image/image.cjs.js +2 -5
  158. package/image/image.cjs.min.js +1 -1
  159. package/image/image.esm.js +2 -5
  160. package/image/image.esm.min.js +1 -1
  161. package/image/image.js +2 -5
  162. package/image/image.min.js +1 -1
  163. package/image/style/imagestyle.cjs.js +1 -1
  164. package/image/style/imagestyle.cjs.min.js +1 -1
  165. package/image/style/imagestyle.esm.js +1 -1
  166. package/image/style/imagestyle.esm.min.js +1 -1
  167. package/image/style/imagestyle.js +1 -1
  168. package/image/style/imagestyle.min.js +1 -1
  169. package/inputnumber/BaseInputNumber.vue +7 -0
  170. package/inputnumber/InputNumber.d.ts +7 -0
  171. package/inputnumber/InputNumber.vue +4 -3
  172. package/inputnumber/inputnumber.cjs.js +13 -3
  173. package/inputnumber/inputnumber.cjs.min.js +1 -1
  174. package/inputnumber/inputnumber.esm.js +13 -3
  175. package/inputnumber/inputnumber.esm.min.js +1 -1
  176. package/inputnumber/inputnumber.js +13 -3
  177. package/inputnumber/inputnumber.min.js +1 -1
  178. package/knob/Knob.vue +1 -1
  179. package/knob/knob.cjs.js +1 -1
  180. package/knob/knob.cjs.min.js +1 -1
  181. package/knob/knob.esm.js +1 -1
  182. package/knob/knob.esm.min.js +1 -1
  183. package/knob/knob.js +1 -1
  184. package/knob/knob.min.js +1 -1
  185. package/listbox/BaseListbox.vue +1 -1
  186. package/listbox/Listbox.d.ts +1 -1
  187. package/listbox/Listbox.vue +2 -0
  188. package/listbox/listbox.cjs.js +3 -1
  189. package/listbox/listbox.cjs.min.js +1 -1
  190. package/listbox/listbox.esm.js +3 -1
  191. package/listbox/listbox.esm.min.js +1 -1
  192. package/listbox/listbox.js +3 -1
  193. package/listbox/listbox.min.js +1 -1
  194. package/megamenu/MegaMenu.vue +2 -1
  195. package/megamenu/megamenu.cjs.js +2 -1
  196. package/megamenu/megamenu.cjs.min.js +1 -1
  197. package/megamenu/megamenu.esm.js +2 -1
  198. package/megamenu/megamenu.esm.min.js +1 -1
  199. package/megamenu/megamenu.js +2 -1
  200. package/megamenu/megamenu.min.js +1 -1
  201. package/menu/Menu.vue +1 -0
  202. package/menu/menu.cjs.js +1 -0
  203. package/menu/menu.cjs.min.js +1 -1
  204. package/menu/menu.esm.js +1 -0
  205. package/menu/menu.esm.min.js +1 -1
  206. package/menu/menu.js +1 -0
  207. package/menu/menu.min.js +1 -1
  208. package/menubar/Menubar.vue +2 -1
  209. package/menubar/menubar.cjs.js +2 -1
  210. package/menubar/menubar.cjs.min.js +1 -1
  211. package/menubar/menubar.esm.js +2 -1
  212. package/menubar/menubar.esm.min.js +1 -1
  213. package/menubar/menubar.js +2 -1
  214. package/menubar/menubar.min.js +1 -1
  215. package/menuitem/MenuItem.d.ts +0 -6
  216. package/message/style/messagestyle.cjs.js +1 -1
  217. package/message/style/messagestyle.cjs.min.js +1 -1
  218. package/message/style/messagestyle.esm.js +1 -1
  219. package/message/style/messagestyle.esm.min.js +1 -1
  220. package/message/style/messagestyle.js +1 -1
  221. package/message/style/messagestyle.min.js +1 -1
  222. package/multiselect/MultiSelect.vue +2 -0
  223. package/multiselect/multiselect.cjs.js +2 -0
  224. package/multiselect/multiselect.cjs.min.js +1 -1
  225. package/multiselect/multiselect.esm.js +2 -0
  226. package/multiselect/multiselect.esm.min.js +1 -1
  227. package/multiselect/multiselect.js +2 -0
  228. package/multiselect/multiselect.min.js +1 -1
  229. package/orderlist/BaseOrderList.vue +1 -1
  230. package/orderlist/OrderList.d.ts +1 -1
  231. package/orderlist/OrderList.vue +1 -0
  232. package/orderlist/orderlist.cjs.js +2 -1
  233. package/orderlist/orderlist.cjs.min.js +1 -1
  234. package/orderlist/orderlist.esm.js +2 -1
  235. package/orderlist/orderlist.esm.min.js +1 -1
  236. package/orderlist/orderlist.js +2 -1
  237. package/orderlist/orderlist.min.js +1 -1
  238. package/organizationchart/OrganizationChartNode.vue +1 -1
  239. package/organizationchart/organizationchart.cjs.js +1 -1
  240. package/organizationchart/organizationchart.cjs.min.js +1 -1
  241. package/organizationchart/organizationchart.esm.js +1 -1
  242. package/organizationchart/organizationchart.esm.min.js +1 -1
  243. package/organizationchart/organizationchart.js +1 -1
  244. package/organizationchart/organizationchart.min.js +1 -1
  245. package/package.json +1 -1
  246. package/paginator/Paginator.vue +4 -4
  247. package/paginator/paginator.cjs.js +2 -2
  248. package/paginator/paginator.cjs.min.js +1 -1
  249. package/paginator/paginator.esm.js +2 -2
  250. package/paginator/paginator.esm.min.js +1 -1
  251. package/paginator/paginator.js +2 -2
  252. package/paginator/paginator.min.js +1 -1
  253. package/panel/Panel.vue +1 -1
  254. package/panel/panel.cjs.js +1 -1
  255. package/panel/panel.cjs.min.js +1 -1
  256. package/panel/panel.esm.js +1 -1
  257. package/panel/panel.esm.min.js +1 -1
  258. package/panel/panel.js +1 -1
  259. package/panel/panel.min.js +1 -1
  260. package/panelmenu/PanelMenu.vue +1 -0
  261. package/panelmenu/PanelMenuList.vue +1 -0
  262. package/panelmenu/panelmenu.cjs.js +2 -0
  263. package/panelmenu/panelmenu.cjs.min.js +1 -1
  264. package/panelmenu/panelmenu.esm.js +2 -0
  265. package/panelmenu/panelmenu.esm.min.js +1 -1
  266. package/panelmenu/panelmenu.js +2 -0
  267. package/panelmenu/panelmenu.min.js +1 -1
  268. package/picklist/BasePickList.vue +1 -1
  269. package/picklist/PickList.d.ts +1 -1
  270. package/picklist/PickList.vue +2 -1
  271. package/picklist/picklist.cjs.js +3 -2
  272. package/picklist/picklist.cjs.min.js +1 -1
  273. package/picklist/picklist.esm.js +3 -2
  274. package/picklist/picklist.esm.min.js +1 -1
  275. package/picklist/picklist.js +3 -2
  276. package/picklist/picklist.min.js +1 -1
  277. package/picklist/style/pickliststyle.cjs.js +1 -1
  278. package/picklist/style/pickliststyle.cjs.min.js +1 -1
  279. package/picklist/style/pickliststyle.esm.js +1 -1
  280. package/picklist/style/pickliststyle.esm.min.js +1 -1
  281. package/picklist/style/pickliststyle.js +1 -1
  282. package/picklist/style/pickliststyle.min.js +1 -1
  283. package/resources/themes/arya-blue/theme.css +4 -4
  284. package/resources/themes/arya-green/theme.css +4 -4
  285. package/resources/themes/arya-orange/theme.css +4 -4
  286. package/resources/themes/arya-purple/theme.css +4 -4
  287. package/resources/themes/bootstrap4-dark-blue/theme.css +4 -4
  288. package/resources/themes/bootstrap4-dark-purple/theme.css +4 -4
  289. package/resources/themes/bootstrap4-light-blue/theme.css +4 -4
  290. package/resources/themes/bootstrap4-light-purple/theme.css +4 -4
  291. package/resources/themes/fluent-light/theme.css +4 -4
  292. package/resources/themes/lara-dark-amber/theme.css +4 -4
  293. package/resources/themes/lara-dark-blue/theme.css +4 -4
  294. package/resources/themes/lara-dark-cyan/theme.css +4 -4
  295. package/resources/themes/lara-dark-green/theme.css +4 -4
  296. package/resources/themes/lara-dark-indigo/theme.css +4 -4
  297. package/resources/themes/lara-dark-pink/theme.css +4 -4
  298. package/resources/themes/lara-dark-purple/theme.css +4 -4
  299. package/resources/themes/lara-dark-teal/theme.css +4 -4
  300. package/resources/themes/lara-light-amber/theme.css +4 -4
  301. package/resources/themes/lara-light-blue/theme.css +4 -4
  302. package/resources/themes/lara-light-cyan/theme.css +4 -4
  303. package/resources/themes/lara-light-green/theme.css +4 -4
  304. package/resources/themes/lara-light-indigo/theme.css +4 -4
  305. package/resources/themes/lara-light-pink/theme.css +4 -4
  306. package/resources/themes/lara-light-purple/theme.css +4 -4
  307. package/resources/themes/lara-light-teal/theme.css +44 -44
  308. package/resources/themes/luna-amber/theme.css +4 -4
  309. package/resources/themes/luna-blue/theme.css +4 -4
  310. package/resources/themes/luna-green/theme.css +4 -4
  311. package/resources/themes/luna-pink/theme.css +4 -4
  312. package/resources/themes/md-dark-deeppurple/theme.css +4 -4
  313. package/resources/themes/md-dark-indigo/theme.css +4 -4
  314. package/resources/themes/md-light-deeppurple/theme.css +4 -4
  315. package/resources/themes/md-light-indigo/theme.css +4 -4
  316. package/resources/themes/mdc-dark-deeppurple/theme.css +4 -4
  317. package/resources/themes/mdc-dark-indigo/theme.css +4 -4
  318. package/resources/themes/mdc-light-deeppurple/theme.css +4 -4
  319. package/resources/themes/mdc-light-indigo/theme.css +4 -4
  320. package/resources/themes/mira/theme.css +4 -4
  321. package/resources/themes/nano/theme.css +4 -4
  322. package/resources/themes/nova/theme.css +4 -4
  323. package/resources/themes/nova-accent/theme.css +4 -4
  324. package/resources/themes/nova-alt/theme.css +4 -4
  325. package/resources/themes/nova-vue/theme.css +4 -4
  326. package/resources/themes/rhea/theme.css +4 -4
  327. package/resources/themes/saga-blue/theme.css +4 -4
  328. package/resources/themes/saga-green/theme.css +4 -4
  329. package/resources/themes/saga-orange/theme.css +4 -4
  330. package/resources/themes/saga-purple/theme.css +4 -4
  331. package/resources/themes/soho-dark/theme.css +4 -4
  332. package/resources/themes/soho-light/theme.css +4 -4
  333. package/resources/themes/tailwind-light/theme.css +4 -4
  334. package/resources/themes/vela-blue/theme.css +4 -4
  335. package/resources/themes/vela-green/theme.css +4 -4
  336. package/resources/themes/vela-orange/theme.css +4 -4
  337. package/resources/themes/vela-purple/theme.css +4 -4
  338. package/resources/themes/viva-dark/theme.css +4 -4
  339. package/resources/themes/viva-light/theme.css +4 -4
  340. package/ripple/style/ripplestyle.cjs.js +1 -1
  341. package/ripple/style/ripplestyle.cjs.min.js +1 -1
  342. package/ripple/style/ripplestyle.esm.js +1 -1
  343. package/ripple/style/ripplestyle.esm.min.js +1 -1
  344. package/ripple/style/ripplestyle.js +1 -1
  345. package/ripple/style/ripplestyle.min.js +1 -1
  346. package/row/Row.vue +7 -0
  347. package/row/row.cjs.js +9 -0
  348. package/row/row.cjs.min.js +1 -1
  349. package/row/row.esm.js +9 -0
  350. package/row/row.esm.min.js +1 -1
  351. package/row/row.js +9 -0
  352. package/row/row.min.js +1 -1
  353. package/slider/Slider.vue +26 -19
  354. package/slider/slider.cjs.js +19 -11
  355. package/slider/slider.cjs.min.js +1 -1
  356. package/slider/slider.esm.js +19 -11
  357. package/slider/slider.esm.min.js +1 -1
  358. package/slider/slider.js +19 -11
  359. package/slider/slider.min.js +1 -1
  360. package/speeddial/SpeedDial.vue +1 -0
  361. package/speeddial/speeddial.cjs.js +1 -0
  362. package/speeddial/speeddial.cjs.min.js +1 -1
  363. package/speeddial/speeddial.esm.js +1 -0
  364. package/speeddial/speeddial.esm.min.js +1 -1
  365. package/speeddial/speeddial.js +1 -0
  366. package/speeddial/speeddial.min.js +1 -1
  367. package/steps/Steps.vue +1 -0
  368. package/steps/steps.cjs.js +1 -0
  369. package/steps/steps.cjs.min.js +1 -1
  370. package/steps/steps.esm.js +1 -0
  371. package/steps/steps.esm.min.js +1 -1
  372. package/steps/steps.js +1 -0
  373. package/steps/steps.min.js +1 -1
  374. package/tabmenu/TabMenu.vue +1 -0
  375. package/tabmenu/tabmenu.cjs.js +1 -0
  376. package/tabmenu/tabmenu.cjs.min.js +1 -1
  377. package/tabmenu/tabmenu.esm.js +1 -0
  378. package/tabmenu/tabmenu.esm.min.js +1 -1
  379. package/tabmenu/tabmenu.js +1 -0
  380. package/tabmenu/tabmenu.min.js +1 -1
  381. package/tabview/TabView.vue +1 -0
  382. package/tabview/tabview.cjs.js +1 -0
  383. package/tabview/tabview.cjs.min.js +1 -1
  384. package/tabview/tabview.esm.js +1 -0
  385. package/tabview/tabview.esm.min.js +1 -1
  386. package/tabview/tabview.js +1 -0
  387. package/tabview/tabview.min.js +1 -1
  388. package/terminal/Terminal.vue +1 -1
  389. package/terminal/terminal.cjs.js +1 -1
  390. package/terminal/terminal.cjs.min.js +1 -1
  391. package/terminal/terminal.esm.js +1 -1
  392. package/terminal/terminal.esm.min.js +1 -1
  393. package/terminal/terminal.js +1 -1
  394. package/terminal/terminal.min.js +1 -1
  395. package/tieredmenu/TieredMenu.vue +1 -0
  396. package/tieredmenu/tieredmenu.cjs.js +1 -0
  397. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  398. package/tieredmenu/tieredmenu.esm.js +1 -0
  399. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  400. package/tieredmenu/tieredmenu.js +1 -0
  401. package/tieredmenu/tieredmenu.min.js +1 -1
  402. package/tree/BaseTree.vue +1 -1
  403. package/tree/Tree.d.ts +1 -1
  404. package/tree/Tree.vue +1 -1
  405. package/tree/TreeNode.vue +1 -0
  406. package/tree/tree.cjs.js +3 -2
  407. package/tree/tree.cjs.min.js +1 -1
  408. package/tree/tree.esm.js +3 -2
  409. package/tree/tree.esm.min.js +1 -1
  410. package/tree/tree.js +3 -2
  411. package/tree/tree.min.js +1 -1
  412. package/treeselect/BaseTreeSelect.vue +1 -1
  413. package/treeselect/TreeSelect.d.ts +1 -1
  414. package/treeselect/TreeSelect.vue +1 -0
  415. package/treeselect/treeselect.cjs.js +2 -1
  416. package/treeselect/treeselect.cjs.min.js +1 -1
  417. package/treeselect/treeselect.esm.js +2 -1
  418. package/treeselect/treeselect.esm.min.js +1 -1
  419. package/treeselect/treeselect.js +2 -1
  420. package/treeselect/treeselect.min.js +1 -1
  421. package/treetable/BaseTreeTable.vue +5 -1
  422. package/treetable/HeaderCell.vue +1 -1
  423. package/treetable/TreeTable.d.ts +6 -1
  424. package/treetable/TreeTable.vue +32 -24
  425. package/treetable/TreeTableRow.vue +32 -20
  426. package/treetable/style/treetablestyle.cjs.js +1 -1
  427. package/treetable/style/treetablestyle.cjs.min.js +1 -1
  428. package/treetable/style/treetablestyle.esm.js +1 -1
  429. package/treetable/style/treetablestyle.esm.min.js +1 -1
  430. package/treetable/style/treetablestyle.js +1 -1
  431. package/treetable/style/treetablestyle.min.js +1 -1
  432. package/treetable/treetable.cjs.js +70 -43
  433. package/treetable/treetable.cjs.min.js +1 -1
  434. package/treetable/treetable.esm.js +71 -44
  435. package/treetable/treetable.esm.min.js +1 -1
  436. package/treetable/treetable.js +70 -43
  437. package/treetable/treetable.min.js +1 -1
  438. package/tristatecheckbox/TriStateCheckbox.vue +1 -1
  439. package/tristatecheckbox/tristatecheckbox.cjs.js +1 -1
  440. package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
  441. package/tristatecheckbox/tristatecheckbox.esm.js +1 -1
  442. package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
  443. package/tristatecheckbox/tristatecheckbox.js +1 -1
  444. package/tristatecheckbox/tristatecheckbox.min.js +1 -1
  445. package/utils/Utils.d.ts +9 -0
  446. package/utils/utils.cjs.js +142 -41
  447. package/utils/utils.cjs.min.js +1 -1
  448. package/utils/utils.esm.js +142 -42
  449. package/utils/utils.esm.min.js +1 -1
  450. package/utils/utils.js +142 -41
  451. package/utils/utils.min.js +1 -1
  452. package/vetur-attributes.json +4 -0
  453. package/vetur-tags.json +1 -0
  454. package/virtualscroller/VirtualScroller.vue +19 -15
  455. package/virtualscroller/style/virtualscrollerstyle.cjs.js +1 -1
  456. package/virtualscroller/style/virtualscrollerstyle.cjs.min.js +1 -1
  457. package/virtualscroller/style/virtualscrollerstyle.esm.js +1 -1
  458. package/virtualscroller/style/virtualscrollerstyle.esm.min.js +1 -1
  459. package/virtualscroller/style/virtualscrollerstyle.js +1 -1
  460. package/virtualscroller/style/virtualscrollerstyle.min.js +1 -1
  461. package/virtualscroller/virtualscroller.cjs.js +19 -15
  462. package/virtualscroller/virtualscroller.cjs.min.js +1 -1
  463. package/virtualscroller/virtualscroller.esm.js +19 -15
  464. package/virtualscroller/virtualscroller.esm.min.js +1 -1
  465. package/virtualscroller/virtualscroller.js +19 -15
  466. package/virtualscroller/virtualscroller.min.js +1 -1
  467. package/web-types.json +11 -1
@@ -1 +1 @@
1
- import{FilterService as e}from"primevue/api";import t from"primevue/icons/search";import i from"primevue/ripple";import{UniqueComponentId as n,ObjectUtils as o,DomHandler as s}from"primevue/utils";import l from"primevue/virtualscroller";import r from"primevue/basecomponent";import a from"primevue/listbox/style";import{resolveComponent as u,resolveDirective as d,openBlock as c,createElementBlock as p,mergeProps as h,createElementVNode as f,renderSlot as O,withDirectives as b,vModelText as m,normalizeClass as y,createBlock as g,resolveDynamicComponent as v,toDisplayString as x,createCommentVNode as I,createVNode as S,createSlots as F,withCtx as M,Fragment as K,renderList as w,createTextVNode as V}from"vue";function L(e){return $(e)||E(e)||T(e)||D()}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){if(e){if("string"==typeof e)return P(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(e,t):void 0}}function E(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function $(e){if(Array.isArray(e))return P(e)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var k={name:"Listbox",extends:{name:"BaseListbox",extends:r,props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:{type:Boolean,default:!1},dataKey:null,multiple:{type:Boolean,default:!1},metaKeySelection:{type:Boolean,default:!0},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},filterIcon:{type:String,default:void 0},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:a,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","filter"],list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",focusOnHover:!1,data:function(){return{id:this.$attrs.id,filterValue:null,focused:!1,focusedOptionIndex:-1}},watch:{"$attrs.id":function(e){this.id=e||n()},options:function(){this.autoUpdateModel()}},mounted:function(){this.id=this.id||n(),this.autoUpdateModel()},methods:{getOptionIndex:function(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel:function(e){return this.optionLabel?o.resolveFieldData(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?o.resolveFieldData(e,this.optionValue):e},getOptionRenderKey:function(e,t){return(this.dataKey?o.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTOptions:function(e,t,i,n){return this.ptm(n,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled:function(e){return!!this.optionDisabled&&o.resolveFieldData(e,this.optionDisabled)},isOptionGroup:function(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel:function(e){return o.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren:function(e){return o.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset:function(e){var t=this;return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((function(e){return t.isOptionGroup(e)})).length:e)+1},onFirstHiddenFocus:function(){s.focus(this.list);var e=s.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');this.$refs.lastHiddenFocusableElement.tabIndex=s.isElement(e)?void 0:-1,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus:function(e){if(e.relatedTarget===this.list){var t=s.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');s.focus(t),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else s.focus(this.$refs.firstHiddenFocusableElement);this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout:function(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus:function(e){this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.autoUpdateModel(),this.$emit("focus",e)},onListBlur:function(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown:function(e){var t=this,i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(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":case"Space":this.onSpaceKey(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if(this.multiple&&"KeyA"===e.code&&i){var n=this.visibleOptions.filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,n),e.preventDefault();break}!i&&o.isPrintableCharacter(e.key)&&(this.searchOptions(e,e.key),e.preventDefault())}},onOptionSelect:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseDown:function(e,t){this.changeFocusedOptionIndex(e,t)},onOptionMouseMove:function(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd:function(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle:function(e,t){var i=this.isSelected(t),n=!1,o=null;!this.optionTouched&&this.metaKeySelection?i?e&&(e.metaKey||e.ctrlKey)&&(o=null,n=!0):(o=this.getOptionValue(t),n=!0):(o=i?null:this.getOptionValue(t),n=!0);n&&this.updateModel(e,o)},onOptionSelectMultiple:function(e,t){var i=this.isSelected(t),n=null;if(!this.optionTouched&&this.metaKeySelection){var o=e.metaKey||e.ctrlKey;n=i?o?this.removeOption(t):[this.getOptionValue(t)]:[].concat(L(n=o&&this.modelValue||[]),[this.getOptionValue(t)])}else n=i?this.removeOption(t):[].concat(L(this.modelValue||[]),[this.getOptionValue(t)]);this.updateModel(e,n)},onOptionSelectRange:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===i&&(i=this.findNearestSelectedOptionIndex(n,!0)),-1===n&&(n=this.findNearestSelectedOptionIndex(i)),-1!==i&&-1!==n){var o=Math.min(i,n),s=Math.max(i,n),l=this.visibleOptions.slice(o,s+1).filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,l)}},onFilterChange:function(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur:function(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey:function(e){var t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){var t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{var t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{var n=e.metaKey||e.ctrlKey,o=this.findLastOptionIndex();this.multiple&&e.shiftKey&&n&&this.onOptionSelectRange(e,this.startRangeIndex,o),this.changeFocusedOptionIndex(e,o)}e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onShiftKey:function(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return o.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){var t=this,i=this.getOptionValue(e);return this.multiple?(this.modelValue||[]).some((function(e){return o.equals(e,i,t.equalityKey)})):o.equals(this.modelValue,i,this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex((function(t){return e.isValidOption(t)}))},findLastOptionIndex:function(){var e=this;return o.findLastIndex(this.visibleOptions,(function(t){return e.isValidOption(t)}))},findNextOptionIndex:function(e){var t=this,i=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return i>-1?i+e+1:e},findPrevOptionIndex:function(e){var t=this,i=e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return i>-1?i:e},findFirstSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex((function(t){return e.isValidSelectedOption(t)})):-1},findLastSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?o.findLastIndex(this.visibleOptions,(function(t){return e.isValidSelectedOption(t)})):-1},findNextSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i+e+1:-1},findPrevSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i:-1},findNearestSelectedOptionIndex:function(e){var t=-1;return this.hasSelectedOption&&(t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?-1===(t=this.findPrevSelectedOptionIndex(e))?this.findNextSelectedOptionIndex(e):t:-1===(t=this.findNextSelectedOptionIndex(e))?this.findPrevSelectedOptionIndex(e):t),t>-1?t:e},findFirstFocusedOptionIndex:function(){var e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1;-1===(n=-1!==this.focusedOptionIndex?-1===(n=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})):n+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return i.isOptionMatched(e)})))&&-1===this.focusedOptionIndex&&(n=this.findFirstFocusedOptionIndex()),-1!==n&&this.changeFocusedOptionIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500)},removeOption:function(e){var t=this;return this.modelValue.filter((function(i){return!o.equals(i,t.getOptionValue(e),t.equalityKey)}))},changeFocusedOptionIndex:function(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.onOptionSelect(e,this.visibleOptions[t]))},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedOptionId,i=s.findSingle(this.list,'li[id="'.concat(t,'"]'));i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&!this.multiple&&this.focused&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex]))},updateModel:function(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions:function(e){var t=this;return(e||[]).reduce((function(e,i,n){e.push({optionGroup:i,group:!0,index:n});var o=t.getOptionGroupChildren(i);return o&&o.forEach((function(t){return e.push(t)})),e}),[])},listRef:function(e,t){this.list=e,t&&t(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?e.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):t},hasSelectedOption:function(){return o.isNotEmpty(this.modelValue)},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return o.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId:function(){return-1!==this.focusedOptionIndex?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter((function(t){return!e.isOptionGroup(t)})).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:i},components:{VirtualScroller:l,SearchIcon:t}};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function A(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function H(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?A(Object(i),!0).forEach((function(t){G(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function G(e,t,i){var n;return(t="symbol"==R(n=j(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function j(e,t){if("object"!=R(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var C=["id"],B=["tabindex"],U=["placeholder","aria-owns","aria-activedescendant","tabindex"],N=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],_=["id"],q=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousedown","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"],z=["tabindex"];k.render=function(e,t,i,n,o,s){var l=u("VirtualScroller"),r=d("ripple");return c(),p("div",h({id:o.id,class:e.cx("root"),onFocusout:t[10]||(t[10]=function(){return s.onFocusout&&s.onFocusout.apply(s,arguments)})},e.ptm("root"),{"data-pc-name":"listbox"}),[f("span",h({ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[0]||(t[0]=function(){return s.onFirstHiddenFocus&&s.onFirstHiddenFocus.apply(s,arguments)})},e.ptm("hiddenFirstFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,B),O(e.$slots,"header",{value:e.modelValue,options:s.visibleOptions}),e.filter?(c(),p("div",h({key:0,class:e.cx("header")},e.ptm("header")),[f("div",h({class:e.cx("filterContainer")},e.ptm("filterContainer")),[b(f("input",h({ref:"filterInput","onUpdate:modelValue":t[1]||(t[1]=function(e){return o.filterValue=e}),type:"text",class:e.cx("filterInput"),placeholder:e.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,tabindex:e.disabled||o.focused?-1:e.tabindex,onInput:t[2]||(t[2]=function(){return s.onFilterChange&&s.onFilterChange.apply(s,arguments)}),onBlur:t[3]||(t[3]=function(){return s.onFilterBlur&&s.onFilterBlur.apply(s,arguments)}),onKeydown:t[4]||(t[4]=function(){return s.onFilterKeyDown&&s.onFilterKeyDown.apply(s,arguments)})},H(H({},e.filterInputProps),e.ptm("filterInput"))),null,16,U),[[m,o.filterValue]]),O(e.$slots,"filtericon",{class:y(e.cx("filterIcon"))},(function(){return[(c(),g(v(e.filterIcon?"span":"SearchIcon"),h({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),f("span",h({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),x(s.filterResultMessageText),17)],16)):I("",!0),f("div",h({ref:"listWrapper",class:e.cx("wrapper"),style:e.listStyle},e.ptm("wrapper")),[S(l,h({ref:s.virtualScrollerRef},e.virtualScrollerOptions,{style:e.listStyle,items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),F({content:M((function(i){var n=i.styleClass,l=i.contentRef,a=i.items,u=i.getItemOptions,d=i.contentStyle,m=i.itemSize;return[f("ul",h({ref:function(e){return s.listRef(e,l)},id:o.id+"_list",class:[e.cx("list"),n],style:d,tabindex:-1,role:"listbox","aria-multiselectable":e.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":e.disabled,onFocus:t[6]||(t[6]=function(){return s.onListFocus&&s.onListFocus.apply(s,arguments)}),onBlur:t[7]||(t[7]=function(){return s.onListBlur&&s.onListBlur.apply(s,arguments)}),onKeydown:t[8]||(t[8]=function(){return s.onListKeyDown&&s.onListKeyDown.apply(s,arguments)})},e.ptm("list")),[(c(!0),p(K,null,w(a,(function(i,n){return c(),p(K,{key:s.getOptionRenderKey(i,s.getOptionIndex(n,u))},[s.isOptionGroup(i)?(c(),p("li",h({key:0,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:m?m+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[O(e.$slots,"optiongroup",{option:i.optionGroup,index:s.getOptionIndex(n,u)},(function(){return[V(x(s.getOptionGroupLabel(i.optionGroup)),1)]}))],16,_)):b((c(),p("li",h({key:1,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:m?m+"px":void 0},class:e.cx("item",{option:i,index:n,getItemOptions:u}),role:"option","aria-label":s.getOptionLabel(i),"aria-selected":s.isSelected(i),"aria-disabled":s.isOptionDisabled(i),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(n,u)),onClick:function(e){return s.onOptionSelect(e,i,s.getOptionIndex(n,u))},onMousedown:function(e){return s.onOptionMouseDown(e,s.getOptionIndex(n,u))},onMousemove:function(e){return s.onOptionMouseMove(e,s.getOptionIndex(n,u))},onTouchend:t[5]||(t[5]=function(e){return s.onOptionTouchEnd()})},s.getPTOptions(i,u,n,"item"),{"data-p-highlight":s.isSelected(i),"data-p-focused":o.focusedOptionIndex===s.getOptionIndex(n,u),"data-p-disabled":s.isOptionDisabled(i)}),[O(e.$slots,"option",{option:i,index:s.getOptionIndex(n,u)},(function(){return[V(x(s.getOptionLabel(i)),1)]}))],16,q)),[[r]])],64)})),128)),o.filterValue&&(!a||a&&0===a.length)?(c(),p("li",h({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[O(e.$slots,"emptyfilter",{},(function(){return[V(x(s.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(c(),p("li",h({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[O(e.$slots,"empty",{},(function(){return[V(x(s.emptyMessageText),1)]}))],16)):I("",!0)],16,N)]})),_:2},[e.$slots.loader?{name:"loader",fn:M((function(t){return[O(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["style","items","disabled","pt"])],16),O(e.$slots,"footer",{value:e.modelValue,options:s.visibleOptions}),!e.options||e.options&&0===e.options.length?(c(),p("span",h({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),x(s.emptyMessageText),17)):I("",!0),f("span",h({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),x(s.selectedMessageText),17),f("span",h({ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[9]||(t[9]=function(){return s.onLastHiddenFocus&&s.onLastHiddenFocus.apply(s,arguments)})},e.ptm("hiddenLastFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,z)],16,C)};export{k as default};
1
+ import{FilterService as e}from"primevue/api";import t from"primevue/icons/search";import i from"primevue/ripple";import{UniqueComponentId as n,ObjectUtils as o,DomHandler as s}from"primevue/utils";import l from"primevue/virtualscroller";import r from"primevue/basecomponent";import a from"primevue/listbox/style";import{resolveComponent as u,resolveDirective as d,openBlock as c,createElementBlock as p,mergeProps as h,createElementVNode as f,renderSlot as O,withDirectives as b,vModelText as m,normalizeClass as y,createBlock as g,resolveDynamicComponent as v,toDisplayString as x,createCommentVNode as I,createVNode as S,createSlots as F,withCtx as M,Fragment as K,renderList as w,createTextVNode as V}from"vue";function L(e){return $(e)||T(e)||E(e)||D()}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){if(e){if("string"==typeof e)return P(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(e,t):void 0}}function T(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function $(e){if(Array.isArray(e))return P(e)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var k={name:"Listbox",extends:{name:"BaseListbox",extends:r,props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:{type:Boolean,default:!1},dataKey:null,multiple:{type:Boolean,default:!1},metaKeySelection:{type:Boolean,default:!1},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},filterIcon:{type:String,default:void 0},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:a,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","filter"],list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",focusOnHover:!1,data:function(){return{id:this.$attrs.id,filterValue:null,focused:!1,focusedOptionIndex:-1}},watch:{"$attrs.id":function(e){this.id=e||n()},options:function(){this.autoUpdateModel()}},mounted:function(){this.id=this.id||n(),this.autoUpdateModel()},methods:{getOptionIndex:function(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel:function(e){return this.optionLabel?o.resolveFieldData(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?o.resolveFieldData(e,this.optionValue):e},getOptionRenderKey:function(e,t){return(this.dataKey?o.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTOptions:function(e,t,i,n){return this.ptm(n,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled:function(e){return!!this.optionDisabled&&o.resolveFieldData(e,this.optionDisabled)},isOptionGroup:function(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel:function(e){return o.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren:function(e){return o.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset:function(e){var t=this;return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((function(e){return t.isOptionGroup(e)})).length:e)+1},onFirstHiddenFocus:function(){s.focus(this.list);var e=s.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');this.$refs.lastHiddenFocusableElement.tabIndex=s.isElement(e)?void 0:-1,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus:function(e){if(e.relatedTarget===this.list){var t=s.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');s.focus(t),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else s.focus(this.$refs.firstHiddenFocusableElement);this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout:function(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus:function(e){this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.autoUpdateModel(),this.$emit("focus",e)},onListBlur:function(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown:function(e){var t=this,i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(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":case"NumpadEnter":case"Space":this.onSpaceKey(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if(this.multiple&&"KeyA"===e.code&&i){var n=this.visibleOptions.filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,n),e.preventDefault();break}!i&&o.isPrintableCharacter(e.key)&&(this.searchOptions(e,e.key),e.preventDefault())}},onOptionSelect:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseDown:function(e,t){this.changeFocusedOptionIndex(e,t)},onOptionMouseMove:function(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd:function(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle:function(e,t){var i=this.isSelected(t),n=!1,o=null;!this.optionTouched&&this.metaKeySelection?i?e&&(e.metaKey||e.ctrlKey)&&(o=null,n=!0):(o=this.getOptionValue(t),n=!0):(o=i?null:this.getOptionValue(t),n=!0);n&&this.updateModel(e,o)},onOptionSelectMultiple:function(e,t){var i=this.isSelected(t),n=null;if(!this.optionTouched&&this.metaKeySelection){var o=e.metaKey||e.ctrlKey;n=i?o?this.removeOption(t):[this.getOptionValue(t)]:[].concat(L(n=o&&this.modelValue||[]),[this.getOptionValue(t)])}else n=i?this.removeOption(t):[].concat(L(this.modelValue||[]),[this.getOptionValue(t)]);this.updateModel(e,n)},onOptionSelectRange:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===i&&(i=this.findNearestSelectedOptionIndex(n,!0)),-1===n&&(n=this.findNearestSelectedOptionIndex(i)),-1!==i&&-1!==n){var o=Math.min(i,n),s=Math.max(i,n),l=this.visibleOptions.slice(o,s+1).filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,l)}},onFilterChange:function(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur:function(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey:function(e){var t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){var t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{var t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{var n=e.metaKey||e.ctrlKey,o=this.findLastOptionIndex();this.multiple&&e.shiftKey&&n&&this.onOptionSelectRange(e,this.startRangeIndex,o),this.changeFocusedOptionIndex(e,o)}e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onShiftKey:function(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return o.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){var t=this,i=this.getOptionValue(e);return this.multiple?(this.modelValue||[]).some((function(e){return o.equals(e,i,t.equalityKey)})):o.equals(this.modelValue,i,this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex((function(t){return e.isValidOption(t)}))},findLastOptionIndex:function(){var e=this;return o.findLastIndex(this.visibleOptions,(function(t){return e.isValidOption(t)}))},findNextOptionIndex:function(e){var t=this,i=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return i>-1?i+e+1:e},findPrevOptionIndex:function(e){var t=this,i=e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return i>-1?i:e},findFirstSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex((function(t){return e.isValidSelectedOption(t)})):-1},findLastSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?o.findLastIndex(this.visibleOptions,(function(t){return e.isValidSelectedOption(t)})):-1},findNextSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i+e+1:-1},findPrevSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e>0?o.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i:-1},findNearestSelectedOptionIndex:function(e){var t=-1;return this.hasSelectedOption&&(t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?-1===(t=this.findPrevSelectedOptionIndex(e))?this.findNextSelectedOptionIndex(e):t:-1===(t=this.findNextSelectedOptionIndex(e))?this.findPrevSelectedOptionIndex(e):t),t>-1?t:e},findFirstFocusedOptionIndex:function(){var e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1;-1===(n=-1!==this.focusedOptionIndex?-1===(n=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})):n+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return i.isOptionMatched(e)})))&&-1===this.focusedOptionIndex&&(n=this.findFirstFocusedOptionIndex()),-1!==n&&this.changeFocusedOptionIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500)},removeOption:function(e){var t=this;return this.modelValue.filter((function(i){return!o.equals(i,t.getOptionValue(e),t.equalityKey)}))},changeFocusedOptionIndex:function(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.onOptionSelect(e,this.visibleOptions[t]))},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedOptionId,i=s.findSingle(this.list,'li[id="'.concat(t,'"]'));i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&!this.multiple&&this.focused&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex]))},updateModel:function(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions:function(e){var t=this;return(e||[]).reduce((function(e,i,n){e.push({optionGroup:i,group:!0,index:n});var o=t.getOptionGroupChildren(i);return o&&o.forEach((function(t){return e.push(t)})),e}),[])},listRef:function(e,t){this.list=e,t&&t(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?e.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):t},hasSelectedOption:function(){return o.isNotEmpty(this.modelValue)},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return o.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId:function(){return-1!==this.focusedOptionIndex?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter((function(t){return!e.isOptionGroup(t)})).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:i},components:{VirtualScroller:l,SearchIcon:t}};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function A(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function H(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?A(Object(i),!0).forEach((function(t){G(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):A(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function G(e,t,i){var n;return(t="symbol"==R(n=j(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function j(e,t){if("object"!=R(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var C=["id"],B=["tabindex"],N=["placeholder","aria-owns","aria-activedescendant","tabindex"],U=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],_=["id"],q=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousedown","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"],z=["tabindex"];k.render=function(e,t,i,n,o,s){var l=u("VirtualScroller"),r=d("ripple");return c(),p("div",h({id:o.id,class:e.cx("root"),onFocusout:t[10]||(t[10]=function(){return s.onFocusout&&s.onFocusout.apply(s,arguments)})},e.ptm("root"),{"data-pc-name":"listbox"}),[f("span",h({ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[0]||(t[0]=function(){return s.onFirstHiddenFocus&&s.onFirstHiddenFocus.apply(s,arguments)})},e.ptm("hiddenFirstFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,B),O(e.$slots,"header",{value:e.modelValue,options:s.visibleOptions}),e.filter?(c(),p("div",h({key:0,class:e.cx("header")},e.ptm("header")),[f("div",h({class:e.cx("filterContainer")},e.ptm("filterContainer")),[b(f("input",h({ref:"filterInput","onUpdate:modelValue":t[1]||(t[1]=function(e){return o.filterValue=e}),type:"text",class:e.cx("filterInput"),placeholder:e.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,tabindex:e.disabled||o.focused?-1:e.tabindex,onInput:t[2]||(t[2]=function(){return s.onFilterChange&&s.onFilterChange.apply(s,arguments)}),onBlur:t[3]||(t[3]=function(){return s.onFilterBlur&&s.onFilterBlur.apply(s,arguments)}),onKeydown:t[4]||(t[4]=function(){return s.onFilterKeyDown&&s.onFilterKeyDown.apply(s,arguments)})},H(H({},e.filterInputProps),e.ptm("filterInput"))),null,16,N),[[m,o.filterValue]]),O(e.$slots,"filtericon",{class:y(e.cx("filterIcon"))},(function(){return[(c(),g(v(e.filterIcon?"span":"SearchIcon"),h({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),f("span",h({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),x(s.filterResultMessageText),17)],16)):I("",!0),f("div",h({ref:"listWrapper",class:e.cx("wrapper"),style:e.listStyle},e.ptm("wrapper")),[S(l,h({ref:s.virtualScrollerRef},e.virtualScrollerOptions,{style:e.listStyle,items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),F({content:M((function(i){var n=i.styleClass,l=i.contentRef,a=i.items,u=i.getItemOptions,d=i.contentStyle,m=i.itemSize;return[f("ul",h({ref:function(e){return s.listRef(e,l)},id:o.id+"_list",class:[e.cx("list"),n],style:d,tabindex:-1,role:"listbox","aria-multiselectable":e.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":e.disabled,onFocus:t[6]||(t[6]=function(){return s.onListFocus&&s.onListFocus.apply(s,arguments)}),onBlur:t[7]||(t[7]=function(){return s.onListBlur&&s.onListBlur.apply(s,arguments)}),onKeydown:t[8]||(t[8]=function(){return s.onListKeyDown&&s.onListKeyDown.apply(s,arguments)})},e.ptm("list")),[(c(!0),p(K,null,w(a,(function(i,n){return c(),p(K,{key:s.getOptionRenderKey(i,s.getOptionIndex(n,u))},[s.isOptionGroup(i)?(c(),p("li",h({key:0,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:m?m+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[O(e.$slots,"optiongroup",{option:i.optionGroup,index:s.getOptionIndex(n,u)},(function(){return[V(x(s.getOptionGroupLabel(i.optionGroup)),1)]}))],16,_)):b((c(),p("li",h({key:1,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:m?m+"px":void 0},class:e.cx("item",{option:i,index:n,getItemOptions:u}),role:"option","aria-label":s.getOptionLabel(i),"aria-selected":s.isSelected(i),"aria-disabled":s.isOptionDisabled(i),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(n,u)),onClick:function(e){return s.onOptionSelect(e,i,s.getOptionIndex(n,u))},onMousedown:function(e){return s.onOptionMouseDown(e,s.getOptionIndex(n,u))},onMousemove:function(e){return s.onOptionMouseMove(e,s.getOptionIndex(n,u))},onTouchend:t[5]||(t[5]=function(e){return s.onOptionTouchEnd()})},s.getPTOptions(i,u,n,"item"),{"data-p-highlight":s.isSelected(i),"data-p-focused":o.focusedOptionIndex===s.getOptionIndex(n,u),"data-p-disabled":s.isOptionDisabled(i)}),[O(e.$slots,"option",{option:i,index:s.getOptionIndex(n,u)},(function(){return[V(x(s.getOptionLabel(i)),1)]}))],16,q)),[[r]])],64)})),128)),o.filterValue&&(!a||a&&0===a.length)?(c(),p("li",h({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[O(e.$slots,"emptyfilter",{},(function(){return[V(x(s.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(c(),p("li",h({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[O(e.$slots,"empty",{},(function(){return[V(x(s.emptyMessageText),1)]}))],16)):I("",!0)],16,U)]})),_:2},[e.$slots.loader?{name:"loader",fn:M((function(t){return[O(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["style","items","disabled","pt"])],16),O(e.$slots,"footer",{value:e.modelValue,options:s.visibleOptions}),!e.options||e.options&&0===e.options.length?(c(),p("span",h({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),x(s.emptyMessageText),17)):I("",!0),f("span",h({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),x(s.selectedMessageText),17),f("span",h({ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[9]||(t[9]=function(){return s.onLastHiddenFocus&&s.onLastHiddenFocus.apply(s,arguments)})},e.ptm("hiddenLastFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,z)],16,C)};export{k as default};
@@ -33,7 +33,7 @@ this.primevue.listbox = (function (api, SearchIcon, Ripple, utils, VirtualScroll
33
33
  },
34
34
  metaKeySelection: {
35
35
  type: Boolean,
36
- "default": true
36
+ "default": false
37
37
  },
38
38
  filter: Boolean,
39
39
  filterPlaceholder: String,
@@ -238,6 +238,7 @@ this.primevue.listbox = (function (api, SearchIcon, Ripple, utils, VirtualScroll
238
238
  this.onPageUpKey(event);
239
239
  break;
240
240
  case 'Enter':
241
+ case 'NumpadEnter':
241
242
  case 'Space':
242
243
  this.onSpaceKey(event);
243
244
  break;
@@ -376,6 +377,7 @@ this.primevue.listbox = (function (api, SearchIcon, Ripple, utils, VirtualScroll
376
377
  this.onEndKey(event, true);
377
378
  break;
378
379
  case 'Enter':
380
+ case 'NumpadEnter':
379
381
  this.onEnterKey(event);
380
382
  break;
381
383
  case 'ShiftLeft':
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.listbox=function(e,t,i,n,o,s,l,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),u=a(i),d=a(o);function p(e){return m(e)||O(e)||f(e)||h()}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){if(e){if("string"==typeof e)return b(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?b(e,t):void 0}}function O(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function m(e){if(Array.isArray(e))return b(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var g={name:"Listbox",extends:{name:"BaseListbox",extends:a(s).default,props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:{type:Boolean,default:!1},dataKey:null,multiple:{type:Boolean,default:!1},metaKeySelection:{type:Boolean,default:!0},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},filterIcon:{type:String,default:void 0},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:a(l).default,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","filter"],list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",focusOnHover:!1,data:function(){return{id:this.$attrs.id,filterValue:null,focused:!1,focusedOptionIndex:-1}},watch:{"$attrs.id":function(e){this.id=e||n.UniqueComponentId()},options:function(){this.autoUpdateModel()}},mounted:function(){this.id=this.id||n.UniqueComponentId(),this.autoUpdateModel()},methods:{getOptionIndex:function(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel:function(e){return this.optionLabel?n.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?n.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey:function(e,t){return(this.dataKey?n.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTOptions:function(e,t,i,n){return this.ptm(n,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled:function(e){return!!this.optionDisabled&&n.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup:function(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel:function(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren:function(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset:function(e){var t=this;return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((function(e){return t.isOptionGroup(e)})).length:e)+1},onFirstHiddenFocus:function(){n.DomHandler.focus(this.list);var e=n.DomHandler.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');this.$refs.lastHiddenFocusableElement.tabIndex=n.DomHandler.isElement(e)?void 0:-1,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus:function(e){if(e.relatedTarget===this.list){var t=n.DomHandler.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');n.DomHandler.focus(t),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else n.DomHandler.focus(this.$refs.firstHiddenFocusableElement);this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout:function(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus:function(e){this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.autoUpdateModel(),this.$emit("focus",e)},onListBlur:function(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown:function(e){var t=this,i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(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":case"Space":this.onSpaceKey(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if(this.multiple&&"KeyA"===e.code&&i){var o=this.visibleOptions.filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,o),e.preventDefault();break}!i&&n.ObjectUtils.isPrintableCharacter(e.key)&&(this.searchOptions(e,e.key),e.preventDefault())}},onOptionSelect:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseDown:function(e,t){this.changeFocusedOptionIndex(e,t)},onOptionMouseMove:function(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd:function(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle:function(e,t){var i=this.isSelected(t),n=!1,o=null;!this.optionTouched&&this.metaKeySelection?i?e&&(e.metaKey||e.ctrlKey)&&(o=null,n=!0):(o=this.getOptionValue(t),n=!0):(o=i?null:this.getOptionValue(t),n=!0);n&&this.updateModel(e,o)},onOptionSelectMultiple:function(e,t){var i=this.isSelected(t),n=null;if(!this.optionTouched&&this.metaKeySelection){var o=e.metaKey||e.ctrlKey;n=i?o?this.removeOption(t):[this.getOptionValue(t)]:[].concat(p(n=o&&this.modelValue||[]),[this.getOptionValue(t)])}else n=i?this.removeOption(t):[].concat(p(this.modelValue||[]),[this.getOptionValue(t)]);this.updateModel(e,n)},onOptionSelectRange:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===i&&(i=this.findNearestSelectedOptionIndex(n,!0)),-1===n&&(n=this.findNearestSelectedOptionIndex(i)),-1!==i&&-1!==n){var o=Math.min(i,n),s=Math.max(i,n),l=this.visibleOptions.slice(o,s+1).filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,l)}},onFilterChange:function(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur:function(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey:function(e){var t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){var t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{var t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{var n=e.metaKey||e.ctrlKey,o=this.findLastOptionIndex();this.multiple&&e.shiftKey&&n&&this.onOptionSelectRange(e,this.startRangeIndex,o),this.changeFocusedOptionIndex(e,o)}e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onShiftKey:function(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return n.ObjectUtils.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){var t=this,i=this.getOptionValue(e);return this.multiple?(this.modelValue||[]).some((function(e){return n.ObjectUtils.equals(e,i,t.equalityKey)})):n.ObjectUtils.equals(this.modelValue,i,this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex((function(t){return e.isValidOption(t)}))},findLastOptionIndex:function(){var e=this;return n.ObjectUtils.findLastIndex(this.visibleOptions,(function(t){return e.isValidOption(t)}))},findNextOptionIndex:function(e){var t=this,i=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return i>-1?i+e+1:e},findPrevOptionIndex:function(e){var t=this,i=e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return i>-1?i:e},findFirstSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex((function(t){return e.isValidSelectedOption(t)})):-1},findLastSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?n.ObjectUtils.findLastIndex(this.visibleOptions,(function(t){return e.isValidSelectedOption(t)})):-1},findNextSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i+e+1:-1},findPrevSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i:-1},findNearestSelectedOptionIndex:function(e){var t=-1;return this.hasSelectedOption&&(t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?-1===(t=this.findPrevSelectedOptionIndex(e))?this.findNextSelectedOptionIndex(e):t:-1===(t=this.findNextSelectedOptionIndex(e))?this.findPrevSelectedOptionIndex(e):t),t>-1?t:e},findFirstFocusedOptionIndex:function(){var e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1;-1===(n=-1!==this.focusedOptionIndex?-1===(n=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})):n+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return i.isOptionMatched(e)})))&&-1===this.focusedOptionIndex&&(n=this.findFirstFocusedOptionIndex()),-1!==n&&this.changeFocusedOptionIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500)},removeOption:function(e){var t=this;return this.modelValue.filter((function(i){return!n.ObjectUtils.equals(i,t.getOptionValue(e),t.equalityKey)}))},changeFocusedOptionIndex:function(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.onOptionSelect(e,this.visibleOptions[t]))},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedOptionId,i=n.DomHandler.findSingle(this.list,'li[id="'.concat(t,'"]'));i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&!this.multiple&&this.focused&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex]))},updateModel:function(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions:function(e){var t=this;return(e||[]).reduce((function(e,i,n){e.push({optionGroup:i,group:!0,index:n});var o=t.getOptionGroupChildren(i);return o&&o.forEach((function(t){return e.push(t)})),e}),[])},listRef:function(e,t){this.list=e,t&&t(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):t},hasSelectedOption:function(){return n.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return n.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId:function(){return-1!==this.focusedOptionIndex?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter((function(t){return!e.isOptionGroup(t)})).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:u.default},components:{VirtualScroller:d.default,SearchIcon:c.default}};function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function v(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function x(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach((function(t){I(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function I(e,t,i){var n;return(t="symbol"==y(n=S(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function S(e,t){if("object"!=y(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var F=["id"],V=["tabindex"],M=["placeholder","aria-owns","aria-activedescendant","tabindex"],D=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],w=["id"],K=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousedown","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"],L=["tabindex"];return g.render=function(e,t,i,n,o,s){var l=r.resolveComponent("VirtualScroller"),a=r.resolveDirective("ripple");return r.openBlock(),r.createElementBlock("div",r.mergeProps({id:o.id,class:e.cx("root"),onFocusout:t[10]||(t[10]=function(){return s.onFocusout&&s.onFocusout.apply(s,arguments)})},e.ptm("root"),{"data-pc-name":"listbox"}),[r.createElementVNode("span",r.mergeProps({ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[0]||(t[0]=function(){return s.onFirstHiddenFocus&&s.onFirstHiddenFocus.apply(s,arguments)})},e.ptm("hiddenFirstFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,V),r.renderSlot(e.$slots,"header",{value:e.modelValue,options:s.visibleOptions}),e.filter?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,class:e.cx("header")},e.ptm("header")),[r.createElementVNode("div",r.mergeProps({class:e.cx("filterContainer")},e.ptm("filterContainer")),[r.withDirectives(r.createElementVNode("input",r.mergeProps({ref:"filterInput","onUpdate:modelValue":t[1]||(t[1]=function(e){return o.filterValue=e}),type:"text",class:e.cx("filterInput"),placeholder:e.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,tabindex:e.disabled||o.focused?-1:e.tabindex,onInput:t[2]||(t[2]=function(){return s.onFilterChange&&s.onFilterChange.apply(s,arguments)}),onBlur:t[3]||(t[3]=function(){return s.onFilterBlur&&s.onFilterBlur.apply(s,arguments)}),onKeydown:t[4]||(t[4]=function(){return s.onFilterKeyDown&&s.onFilterKeyDown.apply(s,arguments)})},x(x({},e.filterInputProps),e.ptm("filterInput"))),null,16,M),[[r.vModelText,o.filterValue]]),r.renderSlot(e.$slots,"filtericon",{class:r.normalizeClass(e.cx("filterIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.filterIcon?"span":"SearchIcon"),r.mergeProps({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),r.createElementVNode("span",r.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.filterResultMessageText),17)],16)):r.createCommentVNode("",!0),r.createElementVNode("div",r.mergeProps({ref:"listWrapper",class:e.cx("wrapper"),style:e.listStyle},e.ptm("wrapper")),[r.createVNode(l,r.mergeProps({ref:s.virtualScrollerRef},e.virtualScrollerOptions,{style:e.listStyle,items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),r.createSlots({content:r.withCtx((function(i){var n=i.styleClass,l=i.contentRef,c=i.items,u=i.getItemOptions,d=i.contentStyle,p=i.itemSize;return[r.createElementVNode("ul",r.mergeProps({ref:function(e){return s.listRef(e,l)},id:o.id+"_list",class:[e.cx("list"),n],style:d,tabindex:-1,role:"listbox","aria-multiselectable":e.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":e.disabled,onFocus:t[6]||(t[6]=function(){return s.onListFocus&&s.onListFocus.apply(s,arguments)}),onBlur:t[7]||(t[7]=function(){return s.onListBlur&&s.onListBlur.apply(s,arguments)}),onKeydown:t[8]||(t[8]=function(){return s.onListKeyDown&&s.onListKeyDown.apply(s,arguments)})},e.ptm("list")),[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c,(function(i,n){return r.openBlock(),r.createElementBlock(r.Fragment,{key:s.getOptionRenderKey(i,s.getOptionIndex(n,u))},[s.isOptionGroup(i)?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:p?p+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[r.renderSlot(e.$slots,"optiongroup",{option:i.optionGroup,index:s.getOptionIndex(n,u)},(function(){return[r.createTextVNode(r.toDisplayString(s.getOptionGroupLabel(i.optionGroup)),1)]}))],16,w)):r.withDirectives((r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:p?p+"px":void 0},class:e.cx("item",{option:i,index:n,getItemOptions:u}),role:"option","aria-label":s.getOptionLabel(i),"aria-selected":s.isSelected(i),"aria-disabled":s.isOptionDisabled(i),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(n,u)),onClick:function(e){return s.onOptionSelect(e,i,s.getOptionIndex(n,u))},onMousedown:function(e){return s.onOptionMouseDown(e,s.getOptionIndex(n,u))},onMousemove:function(e){return s.onOptionMouseMove(e,s.getOptionIndex(n,u))},onTouchend:t[5]||(t[5]=function(e){return s.onOptionTouchEnd()})},s.getPTOptions(i,u,n,"item"),{"data-p-highlight":s.isSelected(i),"data-p-focused":o.focusedOptionIndex===s.getOptionIndex(n,u),"data-p-disabled":s.isOptionDisabled(i)}),[r.renderSlot(e.$slots,"option",{option:i,index:s.getOptionIndex(n,u)},(function(){return[r.createTextVNode(r.toDisplayString(s.getOptionLabel(i)),1)]}))],16,K)),[[a]])],64)})),128)),o.filterValue&&(!c||c&&0===c.length)?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[r.renderSlot(e.$slots,"emptyfilter",{},(function(){return[r.createTextVNode(r.toDisplayString(s.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[r.renderSlot(e.$slots,"empty",{},(function(){return[r.createTextVNode(r.toDisplayString(s.emptyMessageText),1)]}))],16)):r.createCommentVNode("",!0)],16,D)]})),_:2},[e.$slots.loader?{name:"loader",fn:r.withCtx((function(t){return[r.renderSlot(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["style","items","disabled","pt"])],16),r.renderSlot(e.$slots,"footer",{value:e.modelValue,options:s.visibleOptions}),!e.options||e.options&&0===e.options.length?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.emptyMessageText),17)):r.createCommentVNode("",!0),r.createElementVNode("span",r.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.selectedMessageText),17),r.createElementVNode("span",r.mergeProps({ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[9]||(t[9]=function(){return s.onLastHiddenFocus&&s.onLastHiddenFocus.apply(s,arguments)})},e.ptm("hiddenLastFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,L)],16,F)},g}(primevue.api,primevue.icons.search,primevue.ripple,primevue.utils,primevue.virtualscroller,primevue.basecomponent,primevue.listbox.style,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.listbox=function(e,t,i,n,o,s,l,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),u=a(i),d=a(o);function p(e){return m(e)||O(e)||f(e)||h()}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){if(e){if("string"==typeof e)return b(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?b(e,t):void 0}}function O(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function m(e){if(Array.isArray(e))return b(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}var g={name:"Listbox",extends:{name:"BaseListbox",extends:a(s).default,props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:{type:Boolean,default:!1},dataKey:null,multiple:{type:Boolean,default:!1},metaKeySelection:{type:Boolean,default:!1},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},filterIcon:{type:String,default:void 0},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:a(l).default,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","filter"],list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",focusOnHover:!1,data:function(){return{id:this.$attrs.id,filterValue:null,focused:!1,focusedOptionIndex:-1}},watch:{"$attrs.id":function(e){this.id=e||n.UniqueComponentId()},options:function(){this.autoUpdateModel()}},mounted:function(){this.id=this.id||n.UniqueComponentId(),this.autoUpdateModel()},methods:{getOptionIndex:function(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel:function(e){return this.optionLabel?n.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?n.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey:function(e,t){return(this.dataKey?n.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTOptions:function(e,t,i,n){return this.ptm(n,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled:function(e){return!!this.optionDisabled&&n.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup:function(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel:function(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren:function(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset:function(e){var t=this;return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((function(e){return t.isOptionGroup(e)})).length:e)+1},onFirstHiddenFocus:function(){n.DomHandler.focus(this.list);var e=n.DomHandler.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');this.$refs.lastHiddenFocusableElement.tabIndex=n.DomHandler.isElement(e)?void 0:-1,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus:function(e){if(e.relatedTarget===this.list){var t=n.DomHandler.getFirstFocusableElement(this.$el,':not([data-p-hidden-focusable="true"])');n.DomHandler.focus(t),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else n.DomHandler.focus(this.$refs.firstHiddenFocusableElement);this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout:function(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus:function(e){this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.autoUpdateModel(),this.$emit("focus",e)},onListBlur:function(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown:function(e){var t=this,i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(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":case"NumpadEnter":case"Space":this.onSpaceKey(e);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e);break;default:if(this.multiple&&"KeyA"===e.code&&i){var o=this.visibleOptions.filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,o),e.preventDefault();break}!i&&n.ObjectUtils.isPrintableCharacter(e.key)&&(this.searchOptions(e,e.key),e.preventDefault())}},onOptionSelect:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseDown:function(e,t){this.changeFocusedOptionIndex(e,t)},onOptionMouseMove:function(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd:function(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle:function(e,t){var i=this.isSelected(t),n=!1,o=null;!this.optionTouched&&this.metaKeySelection?i?e&&(e.metaKey||e.ctrlKey)&&(o=null,n=!0):(o=this.getOptionValue(t),n=!0):(o=i?null:this.getOptionValue(t),n=!0);n&&this.updateModel(e,o)},onOptionSelectMultiple:function(e,t){var i=this.isSelected(t),n=null;if(!this.optionTouched&&this.metaKeySelection){var o=e.metaKey||e.ctrlKey;n=i?o?this.removeOption(t):[this.getOptionValue(t)]:[].concat(p(n=o&&this.modelValue||[]),[this.getOptionValue(t)])}else n=i?this.removeOption(t):[].concat(p(this.modelValue||[]),[this.getOptionValue(t)]);this.updateModel(e,n)},onOptionSelectRange:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===i&&(i=this.findNearestSelectedOptionIndex(n,!0)),-1===n&&(n=this.findNearestSelectedOptionIndex(i)),-1!==i&&-1!==n){var o=Math.min(i,n),s=Math.max(i,n),l=this.visibleOptions.slice(o,s+1).filter((function(e){return t.isValidOption(e)})).map((function(e){return t.getOptionValue(e)}));this.updateModel(e,l)}},onFilterChange:function(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur:function(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey:function(e){var t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){var t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{var t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{var n=e.metaKey||e.ctrlKey,o=this.findLastOptionIndex();this.multiple&&e.shiftKey&&n&&this.onOptionSelectRange(e,this.startRangeIndex,o),this.changeFocusedOptionIndex(e,o)}e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onShiftKey:function(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return n.ObjectUtils.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){var t=this,i=this.getOptionValue(e);return this.multiple?(this.modelValue||[]).some((function(e){return n.ObjectUtils.equals(e,i,t.equalityKey)})):n.ObjectUtils.equals(this.modelValue,i,this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex((function(t){return e.isValidOption(t)}))},findLastOptionIndex:function(){var e=this;return n.ObjectUtils.findLastIndex(this.visibleOptions,(function(t){return e.isValidOption(t)}))},findNextOptionIndex:function(e){var t=this,i=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return i>-1?i+e+1:e},findPrevOptionIndex:function(e){var t=this,i=e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return i>-1?i:e},findFirstSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex((function(t){return e.isValidSelectedOption(t)})):-1},findLastSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?n.ObjectUtils.findLastIndex(this.visibleOptions,(function(t){return e.isValidSelectedOption(t)})):-1},findNextSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i+e+1:-1},findPrevSelectedOptionIndex:function(e){var t=this,i=this.hasSelectedOption&&e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidSelectedOption(e)})):-1;return i>-1?i:-1},findNearestSelectedOptionIndex:function(e){var t=-1;return this.hasSelectedOption&&(t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?-1===(t=this.findPrevSelectedOptionIndex(e))?this.findNextSelectedOptionIndex(e):t:-1===(t=this.findNextSelectedOptionIndex(e))?this.findPrevSelectedOptionIndex(e):t),t>-1?t:e},findFirstFocusedOptionIndex:function(){var e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1;-1===(n=-1!==this.focusedOptionIndex?-1===(n=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})):n+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return i.isOptionMatched(e)})))&&-1===this.focusedOptionIndex&&(n=this.findFirstFocusedOptionIndex()),-1!==n&&this.changeFocusedOptionIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500)},removeOption:function(e){var t=this;return this.modelValue.filter((function(i){return!n.ObjectUtils.equals(i,t.getOptionValue(e),t.equalityKey)}))},changeFocusedOptionIndex:function(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.onOptionSelect(e,this.visibleOptions[t]))},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedOptionId,i=n.DomHandler.findSingle(this.list,'li[id="'.concat(t,'"]'));i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&!this.multiple&&this.focused&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex]))},updateModel:function(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions:function(e){var t=this;return(e||[]).reduce((function(e,i,n){e.push({optionGroup:i,group:!0,index:n});var o=t.getOptionGroupChildren(i);return o&&o.forEach((function(t){return e.push(t)})),e}),[])},listRef:function(e,t){this.list=e,t&&t(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):t},hasSelectedOption:function(){return n.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return n.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId:function(){return-1!==this.focusedOptionIndex?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter((function(t){return!e.isOptionGroup(t)})).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:u.default},components:{VirtualScroller:d.default,SearchIcon:c.default}};function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function v(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function x(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach((function(t){I(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function I(e,t,i){var n;return(t="symbol"==y(n=S(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function S(e,t){if("object"!=y(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var F=["id"],V=["tabindex"],M=["placeholder","aria-owns","aria-activedescendant","tabindex"],D=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],w=["id"],K=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousedown","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"],L=["tabindex"];return g.render=function(e,t,i,n,o,s){var l=r.resolveComponent("VirtualScroller"),a=r.resolveDirective("ripple");return r.openBlock(),r.createElementBlock("div",r.mergeProps({id:o.id,class:e.cx("root"),onFocusout:t[10]||(t[10]=function(){return s.onFocusout&&s.onFocusout.apply(s,arguments)})},e.ptm("root"),{"data-pc-name":"listbox"}),[r.createElementVNode("span",r.mergeProps({ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[0]||(t[0]=function(){return s.onFirstHiddenFocus&&s.onFirstHiddenFocus.apply(s,arguments)})},e.ptm("hiddenFirstFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,V),r.renderSlot(e.$slots,"header",{value:e.modelValue,options:s.visibleOptions}),e.filter?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,class:e.cx("header")},e.ptm("header")),[r.createElementVNode("div",r.mergeProps({class:e.cx("filterContainer")},e.ptm("filterContainer")),[r.withDirectives(r.createElementVNode("input",r.mergeProps({ref:"filterInput","onUpdate:modelValue":t[1]||(t[1]=function(e){return o.filterValue=e}),type:"text",class:e.cx("filterInput"),placeholder:e.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,tabindex:e.disabled||o.focused?-1:e.tabindex,onInput:t[2]||(t[2]=function(){return s.onFilterChange&&s.onFilterChange.apply(s,arguments)}),onBlur:t[3]||(t[3]=function(){return s.onFilterBlur&&s.onFilterBlur.apply(s,arguments)}),onKeydown:t[4]||(t[4]=function(){return s.onFilterKeyDown&&s.onFilterKeyDown.apply(s,arguments)})},x(x({},e.filterInputProps),e.ptm("filterInput"))),null,16,M),[[r.vModelText,o.filterValue]]),r.renderSlot(e.$slots,"filtericon",{class:r.normalizeClass(e.cx("filterIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.filterIcon?"span":"SearchIcon"),r.mergeProps({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),r.createElementVNode("span",r.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.filterResultMessageText),17)],16)):r.createCommentVNode("",!0),r.createElementVNode("div",r.mergeProps({ref:"listWrapper",class:e.cx("wrapper"),style:e.listStyle},e.ptm("wrapper")),[r.createVNode(l,r.mergeProps({ref:s.virtualScrollerRef},e.virtualScrollerOptions,{style:e.listStyle,items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),r.createSlots({content:r.withCtx((function(i){var n=i.styleClass,l=i.contentRef,c=i.items,u=i.getItemOptions,d=i.contentStyle,p=i.itemSize;return[r.createElementVNode("ul",r.mergeProps({ref:function(e){return s.listRef(e,l)},id:o.id+"_list",class:[e.cx("list"),n],style:d,tabindex:-1,role:"listbox","aria-multiselectable":e.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":e.disabled,onFocus:t[6]||(t[6]=function(){return s.onListFocus&&s.onListFocus.apply(s,arguments)}),onBlur:t[7]||(t[7]=function(){return s.onListBlur&&s.onListBlur.apply(s,arguments)}),onKeydown:t[8]||(t[8]=function(){return s.onListKeyDown&&s.onListKeyDown.apply(s,arguments)})},e.ptm("list")),[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(c,(function(i,n){return r.openBlock(),r.createElementBlock(r.Fragment,{key:s.getOptionRenderKey(i,s.getOptionIndex(n,u))},[s.isOptionGroup(i)?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:p?p+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[r.renderSlot(e.$slots,"optiongroup",{option:i.optionGroup,index:s.getOptionIndex(n,u)},(function(){return[r.createTextVNode(r.toDisplayString(s.getOptionGroupLabel(i.optionGroup)),1)]}))],16,w)):r.withDirectives((r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,id:o.id+"_"+s.getOptionIndex(n,u),style:{height:p?p+"px":void 0},class:e.cx("item",{option:i,index:n,getItemOptions:u}),role:"option","aria-label":s.getOptionLabel(i),"aria-selected":s.isSelected(i),"aria-disabled":s.isOptionDisabled(i),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(n,u)),onClick:function(e){return s.onOptionSelect(e,i,s.getOptionIndex(n,u))},onMousedown:function(e){return s.onOptionMouseDown(e,s.getOptionIndex(n,u))},onMousemove:function(e){return s.onOptionMouseMove(e,s.getOptionIndex(n,u))},onTouchend:t[5]||(t[5]=function(e){return s.onOptionTouchEnd()})},s.getPTOptions(i,u,n,"item"),{"data-p-highlight":s.isSelected(i),"data-p-focused":o.focusedOptionIndex===s.getOptionIndex(n,u),"data-p-disabled":s.isOptionDisabled(i)}),[r.renderSlot(e.$slots,"option",{option:i,index:s.getOptionIndex(n,u)},(function(){return[r.createTextVNode(r.toDisplayString(s.getOptionLabel(i)),1)]}))],16,K)),[[a]])],64)})),128)),o.filterValue&&(!c||c&&0===c.length)?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[r.renderSlot(e.$slots,"emptyfilter",{},(function(){return[r.createTextVNode(r.toDisplayString(s.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage")),[r.renderSlot(e.$slots,"empty",{},(function(){return[r.createTextVNode(r.toDisplayString(s.emptyMessageText),1)]}))],16)):r.createCommentVNode("",!0)],16,D)]})),_:2},[e.$slots.loader?{name:"loader",fn:r.withCtx((function(t){return[r.renderSlot(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["style","items","disabled","pt"])],16),r.renderSlot(e.$slots,"footer",{value:e.modelValue,options:s.visibleOptions}),!e.options||e.options&&0===e.options.length?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.emptyMessageText),17)):r.createCommentVNode("",!0),r.createElementVNode("span",r.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),r.toDisplayString(s.selectedMessageText),17),r.createElementVNode("span",r.mergeProps({ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:e.disabled?-1:e.tabindex,onFocus:t[9]||(t[9]=function(){return s.onLastHiddenFocus&&s.onLastHiddenFocus.apply(s,arguments)})},e.ptm("hiddenLastFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16,L)],16,F)},g}(primevue.api,primevue.icons.search,primevue.ripple,primevue.utils,primevue.virtualscroller,primevue.basecomponent,primevue.listbox.style,Vue);
@@ -223,6 +223,7 @@ export default {
223
223
  break;
224
224
 
225
225
  case 'Enter':
226
+ case 'NumpadEnter':
226
227
  this.onEnterKey(event);
227
228
  break;
228
229
 
@@ -300,7 +301,7 @@ export default {
300
301
  this.toggle(event);
301
302
  },
302
303
  menuButtonKeydown(event) {
303
- (event.code === 'Enter' || event.code === 'Space') && this.menuButtonClick(event);
304
+ (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') && this.menuButtonClick(event);
304
305
  },
305
306
  onArrowDownKey(event) {
306
307
  if (this.horizontal) {
@@ -502,6 +502,7 @@ var script = {
502
502
  this.onSpaceKey(event);
503
503
  break;
504
504
  case 'Enter':
505
+ case 'NumpadEnter':
505
506
  this.onEnterKey(event);
506
507
  break;
507
508
  case 'Escape':
@@ -581,7 +582,7 @@ var script = {
581
582
  this.toggle(event);
582
583
  },
583
584
  menuButtonKeydown: function menuButtonKeydown(event) {
584
- (event.code === 'Enter' || event.code === 'Space') && this.menuButtonClick(event);
585
+ (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') && this.menuButtonClick(event);
585
586
  },
586
587
  onArrowDownKey: function onArrowDownKey(event) {
587
588
  if (this.horizontal) {
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/icons/bars"),t=require("primevue/utils"),i=require("primevue/basecomponent"),n=require("primevue/megamenu/style"),s=require("primevue/icons/angledown"),o=require("primevue/icons/angleright"),r=require("primevue/ripple"),c=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=a(e),l=a(i),u=a(n),d=a(s),I={name:"BaseMegaMenu",extends:l.default,props:{model:{type:Array,default:null},orientation:{type:String,default:"horizontal"},breakpoint:{type:String,default:"960px"},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:u.default,provide:function(){return{$parentInstance:this}}},h={name:"MegaMenuSub",hostName:"MegaMenu",extends:l.default,emits:["item-click","item-mouseenter"],props:{menuId:{type:String,default:null},focusedItemId:{type:String,default:null},horizontal:{type:Boolean,default:!1},submenu:{type:Object,default:null},mobileActive:{type:Boolean,default:!1},items:{type:Array,default:null},level:{type:Number,default:0},templates:{type:Object,default:null},activeItem:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getSubListId:function(e){return"".concat(this.getItemId(e),"_list")},getSubListKey:function(e){return this.getSubListId(e)},getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.ObjectUtils.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getPTOptions:function(e,t,i){return this.ptm(i,{context:{item:e,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})},isItemActive:function(e){return!!t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},getMenuItemProps:function(e,t){return{action:c.mergeProps({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions(e,t,"action")),icon:c.mergeProps({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions(e,t,"icon")),label:c.mergeProps({class:this.cx("label")},this.getPTOptions(e,t,"label")),submenuicon:c.mergeProps({class:this.cx("submenuIcon")},this.getPTOptions(e,t,"submenuIcon"))}}},components:{AngleRightIcon:a(o).default,AngleDownIcon:d.default},directives:{ripple:a(r).default}},f=["tabindex"],p=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],b=["onClick","onMouseenter"],v=["href","target"],g=["id"];h.render=function(e,t,i,n,s,o){var r=c.resolveComponent("MegaMenuSub",!0),a=c.resolveDirective("ripple");return c.openBlock(),c.createElementBlock("ul",c.mergeProps({class:e.cx(0===i.level?"menu":"submenu"),tabindex:i.tabindex},e.ptm(0===i.level?"menu":"submenu")),[i.submenu?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:0,class:[e.cx("submenuHeader",{submenu:i.submenu}),o.getItemProp(i.submenu,"class")],style:o.getItemProp(i.submenu,"style"),role:"presentation"},e.ptm("submenuHeader")),c.toDisplayString(o.getItemLabel(i.submenu)),17)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.items,(function(n,s){return c.openBlock(),c.createElementBlock(c.Fragment,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions(n,s,"menuitem"),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[c.createElementVNode("div",c.mergeProps({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)}},o.getPTOptions(n,s,"content")),[i.templates.item?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.item),{key:1,item:n.item,hasSubmenu:o.isItemGroup(n),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):c.withDirectives((c.openBlock(),c.createElementBlock("a",c.mergeProps({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions(n,s,"action")),[i.templates.itemicon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.itemicon),{key:0,item:n.item,class:c.normalizeClass([e.cx("icon"),o.getItemProp(n,"icon")])},null,8,["item","class"])):o.getItemProp(n,"icon")?(c.openBlock(),c.createElementBlock("span",c.mergeProps({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions(n,s,"icon")),null,16)):c.createCommentVNode("",!0),c.createElementVNode("span",c.mergeProps({class:e.cx(0===i.level?"label":"submenuLabel")},o.getPTOptions(n,s,0===i.level?"label":"submenuLabel")),c.toDisplayString(o.getItemLabel(n)),17),o.isItemGroup(n)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:2},[i.templates.submenuicon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.submenuicon),c.mergeProps({key:0,active:o.isItemActive(n),class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["active","class"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.horizontal||i.mobileActive?"AngleDownIcon":"AngleRightIcon"),c.mergeProps({key:1,class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["class"]))],64)):c.createCommentVNode("",!0)],16,v)),[[a]])],16,b),o.isItemVisible(n)&&o.isItemGroup(n)?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:0,class:e.cx("panel")},e.ptm("panel")),[c.createElementVNode("div",c.mergeProps({class:e.cx("grid")},e.ptm("grid")),[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.items,(function(s){return c.openBlock(),c.createElementBlock("div",c.mergeProps({key:o.getItemKey(s),class:e.cx("column",{processedItem:n})},e.ptm("column")),[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s,(function(s){return c.openBlock(),c.createBlock(r,{key:o.getSubListKey(s),id:o.getSubListId(s),style:c.normalizeStyle(e.sx("submenu",!0,{processedItem:n})),role:"menu",menuId:i.menuId,focusedItemId:i.focusedItemId,submenu:s,items:s.items,templates:i.templates,level:i.level+1,mobileActive:i.mobileActive,pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)})},null,8,["id","style","menuId","focusedItemId","submenu","items","templates","level","mobileActive","pt","unstyled"])})),128))],16)})),128))],16)],16)):c.createCommentVNode("",!0)],16,p)):c.createCommentVNode("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:1,id:o.getItemId(n),class:[e.cx("separator"),o.getItemProp(n,"class")],style:o.getItemProp(n,"style"),role:"separator"},e.ptm("separator")),null,16,g)):c.createCommentVNode("",!0)],64)})),128))],16,f)};var y={name:"MegaMenu",extends:I,emits:["focus","blur"],outsideClickListener:null,resizeListener:null,matchMediaListener:null,container:null,menubar:null,searchTimeout:null,searchValue:null,data:function(){return{id:this.$attrs.id,mobileActive:!1,focused:!1,focusedItemInfo:{index:-1,key:"",parentKey:""},activeItem:null,dirty:!1,query:null,queryMatches:!1}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeItem:function(e){t.ObjectUtils.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||t.UniqueComponentId(),this.bindMatchMediaListener()},beforeUnmount:function(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener()},methods:{getItemProp:function(e,i){return e?t.ObjectUtils.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.ObjectUtils.isNotEmpty(e.items)},toggle:function(e){var i=this;this.mobileActive?(this.mobileActive=!1,t.ZIndexUtils.clear(this.menubar),this.hide()):(this.mobileActive=!0,t.ZIndexUtils.set("menu",this.menubar,this.$primevue.config.zIndex.menu),setTimeout((function(){i.show()}),1)),this.bindOutsideClickListener(),e.preventDefault()},show:function(){this.focusedItemInfo={index:this.findFirstFocusedItemIndex(),level:0,parentKey:""},t.DomHandler.focus(this.menubar)},hide:function(e,i){var n=this;this.mobileActive&&(this.mobileActive=!1,setTimeout((function(){t.DomHandler.focus(n.$refs.menubutton)}),0)),this.activeItem=null,this.focusedItemInfo={index:-1,key:"",parentKey:""},i&&t.DomHandler.focus(this.menubar),this.dirty=!1},onFocus:function(e){if(this.focused=!0,-1===this.focusedItemInfo.index){var t=this.findFirstFocusedItemIndex(),i=this.findVisibleItem(t);this.focusedItemInfo={index:t,key:i.key,parentKey:i.parentKey}}this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,key:"",parentKey:""},this.searchValue="",this.dirty=!1,this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled)e.preventDefault();else{var i=e.metaKey||e.ctrlKey;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"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.ObjectUtils.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.ObjectUtils.isEmpty(i)){var s=i.index,o=i.key,r=i.parentKey,c=t.ObjectUtils.isNotEmpty(i.items);c&&(this.activeItem=i),this.focusedItemInfo={index:s,key:o,parentKey:r},c&&(this.dirty=!0),n&&t.DomHandler.focus(this.menubar)}},onItemClick:function(e){var i=e.originalEvent,n=e.processedItem,s=this.isProccessedItemGroup(n),o=t.ObjectUtils.isEmpty(n.parent);if(this.isSelected(n)){var r=n.index,c=n.key,a=n.parentKey;this.activeItem=null,this.focusedItemInfo={index:r,key:c,parentKey:a},this.dirty=!o,t.DomHandler.focus(this.menubar)}else if(s)this.onItemChange(e);else{var m=o?n:this.activeItem;this.hide(i),this.changeFocusedItemInfo(i,m?m.index:-1),this.mobileActive=!1,t.DomHandler.focus(this.menubar)}},onItemMouseEnter:function(e){!this.mobileActive&&this.dirty&&this.onItemChange(e)},menuButtonClick:function(e){this.toggle(e)},menuButtonKeydown:function(e){("Enter"===e.code||"Space"===e.code)&&this.menuButtonClick(e)},onArrowDownKey:function(e){if(this.horizontal)if(t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===this.focusedItemInfo.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var i=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo={index:-1,key:i.key,parentKey:i.parentKey},this.searchValue="")}var n=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&this.horizontal){if(-1!==this.focusedItemInfo.index){var i=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(i)&&t.ObjectUtils.isNotEmpty(this.activeItem)&&(0===this.focusedItemInfo.index?(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null):this.changeFocusedItemInfo(e,this.findFirstItemIndex()))}e.preventDefault()}else{var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()}},onArrowLeftKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.horizontal){var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n)}}else{this.vertical&&t.ObjectUtils.isNotEmpty(this.activeItem)&&0===i.columnIndex&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null);var s=i.columnIndex-1,o=this.visibleItems.findIndex((function(e){return e.columnIndex===s}));-1!==o&&this.changeFocusedItemInfo(e,o)}e.preventDefault()},onArrowRightKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.vertical)if(t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===i.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var n=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo={index:-1,key:n.key,parentKey:n.parentKey},this.searchValue="")}var s=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,s)}else{var o=i.columnIndex+1,r=this.visibleItems.findIndex((function(e){return e.columnIndex===o}));-1!==r&&this.changeFocusedItemInfo(e,r)}e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemInfo(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemInfo(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var i=t.DomHandler.findSingle(this.menubar,'li[id="'.concat("".concat(this.focusedItemId),'"]')),n=i&&t.DomHandler.findSingle(i,'a[data-pc-section="action"]');n?n.click():i&&i.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&this.changeFocusedItemInfo(e,this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){t.ObjectUtils.isNotEmpty(this.activeItem)&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key},this.activeItem=null),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(i){t.DomHandler.isTouchDevice()||e.hide(i,!0),e.mobileActive=!1},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia("(max-width: ".concat(this.breakpoint,")"));this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches,e.mobileActive=!1},this.query.addEventListener("change",this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)},isItemMatched:function(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return!!t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.ObjectUtils.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.ObjectUtils.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},findVisibleItem:function(e){return t.ObjectUtils.isNotEmpty(this.visibleItems)?this.visibleItems[e]:null},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemInfo(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemInfo:function(e,i){var n=this.findVisibleItem(i);this.focusedItemInfo.index=i,this.focusedItemInfo.key=t.ObjectUtils.isNotEmpty(n)?n.key:"",this.scrollInView()},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemId,n=t.DomHandler.findSingle(this.menubar,'li[id="'.concat(i,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4?arguments[4]:void 0,r=[];return e&&e.forEach((function(e,c){var a=(""!==s?s+"_":"")+(void 0!==o?o+"_":"")+c,m={item:e,index:c,level:i,key:a,parent:n,parentKey:s,columnIndex:void 0!==o?o:void 0!==n.columnIndex?n.columnIndex:c};m.items=0===i&&e.items&&e.items.length>0?e.items.map((function(e,n){return t.createProcessedItems(e,i+1,m,a,n)})):t.createProcessedItems(e.items,i+1,m,a),r.push(m)})),r},containerRef:function(e){this.container=e},menubarRef:function(e){this.menubar=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=t.ObjectUtils.isNotEmpty(this.activeItem)?this.activeItem:null;return e&&e.key===this.focusedItemInfo.parentKey?e.items.reduce((function(e,t){return t.forEach((function(t){t.items.forEach((function(t){e.push(t)}))})),e}),[]):this.processedItems},horizontal:function(){return"horizontal"===this.orientation},vertical:function(){return"vertical"===this.orientation},focusedItemId:function(){return t.ObjectUtils.isNotEmpty(this.focusedItemInfo.key)?"".concat(this.id,"_").concat(this.focusedItemInfo.key):null}},components:{MegaMenuSub:h,BarsIcon:m.default}},k=["id"],x=["aria-haspopup","aria-expanded","aria-controls","aria-label"];y.render=function(e,t,i,n,s,o){var r=c.resolveComponent("BarsIcon"),a=c.resolveComponent("MegaMenuSub");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref:o.containerRef,id:s.id,class:e.cx("root")},e.ptm("root"),{"data-pc-name":"megamenu"}),[e.$slots.start?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:0,class:e.cx("start")},e.ptm("start")),[c.renderSlot(e.$slots,"start")],16)):c.createCommentVNode("",!0),c.renderSlot(e.$slots,"menubutton",{id:s.id,class:c.normalizeClass(e.cx("menubutton")),toggleCallback:function(e){return o.menuButtonClick(e)}},(function(){var i;return[e.model&&e.model.length>0?(c.openBlock(),c.createElementBlock("a",c.mergeProps({key:0,ref:"menubutton",role:"button",tabindex:"0",class:e.cx("menubutton"),"aria-haspopup":!!(e.model.length&&e.model.length>0),"aria-expanded":s.mobileActive,"aria-controls":s.id,"aria-label":null===(i=e.$primevue.config.locale.aria)||void 0===i?void 0:i.navigation,onClick:t[0]||(t[0]=function(e){return o.menuButtonClick(e)}),onKeydown:t[1]||(t[1]=function(e){return o.menuButtonKeydown(e)})},e.ptm("menubutton")),[c.renderSlot(e.$slots,"menubuttonicon",{},(function(){return[c.createVNode(r,c.normalizeProps(c.guardReactiveProps(e.ptm("menubuttonicon"))),null,16)]}))],16,x)):c.createCommentVNode("",!0)]})),c.createVNode(a,{ref:o.menubarRef,id:s.id+"_list",tabindex:e.disabled?-1:e.tabindex,role:"menubar","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-disabled":e.disabled||void 0,"aria-orientation":e.orientation,"aria-activedescendant":s.focused?o.focusedItemId:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemId:void 0,items:o.processedItems,horizontal:o.horizontal,templates:e.$slots,activeItem:s.activeItem,mobileActive:s.mobileActive,level:0,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter},null,8,["id","tabindex","aria-label","aria-labelledby","aria-disabled","aria-orientation","aria-activedescendant","menuId","focusedItemId","items","horizontal","templates","activeItem","mobileActive","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter"]),e.$slots.end?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:1,class:e.cx("end")},e.ptm("end")),[c.renderSlot(e.$slots,"end")],16)):c.createCommentVNode("",!0)],16,k)},module.exports=y;
1
+ "use strict";var e=require("primevue/icons/bars"),t=require("primevue/utils"),i=require("primevue/basecomponent"),n=require("primevue/megamenu/style"),s=require("primevue/icons/angledown"),o=require("primevue/icons/angleright"),r=require("primevue/ripple"),c=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=a(e),l=a(i),u=a(n),d=a(s),I={name:"BaseMegaMenu",extends:l.default,props:{model:{type:Array,default:null},orientation:{type:String,default:"horizontal"},breakpoint:{type:String,default:"960px"},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:u.default,provide:function(){return{$parentInstance:this}}},h={name:"MegaMenuSub",hostName:"MegaMenu",extends:l.default,emits:["item-click","item-mouseenter"],props:{menuId:{type:String,default:null},focusedItemId:{type:String,default:null},horizontal:{type:Boolean,default:!1},submenu:{type:Object,default:null},mobileActive:{type:Boolean,default:!1},items:{type:Array,default:null},level:{type:Number,default:0},templates:{type:Object,default:null},activeItem:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getSubListId:function(e){return"".concat(this.getItemId(e),"_list")},getSubListKey:function(e){return this.getSubListId(e)},getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.ObjectUtils.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getPTOptions:function(e,t,i){return this.ptm(i,{context:{item:e,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})},isItemActive:function(e){return!!t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},getMenuItemProps:function(e,t){return{action:c.mergeProps({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions(e,t,"action")),icon:c.mergeProps({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions(e,t,"icon")),label:c.mergeProps({class:this.cx("label")},this.getPTOptions(e,t,"label")),submenuicon:c.mergeProps({class:this.cx("submenuIcon")},this.getPTOptions(e,t,"submenuIcon"))}}},components:{AngleRightIcon:a(o).default,AngleDownIcon:d.default},directives:{ripple:a(r).default}},f=["tabindex"],p=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],b=["onClick","onMouseenter"],v=["href","target"],g=["id"];h.render=function(e,t,i,n,s,o){var r=c.resolveComponent("MegaMenuSub",!0),a=c.resolveDirective("ripple");return c.openBlock(),c.createElementBlock("ul",c.mergeProps({class:e.cx(0===i.level?"menu":"submenu"),tabindex:i.tabindex},e.ptm(0===i.level?"menu":"submenu")),[i.submenu?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:0,class:[e.cx("submenuHeader",{submenu:i.submenu}),o.getItemProp(i.submenu,"class")],style:o.getItemProp(i.submenu,"style"),role:"presentation"},e.ptm("submenuHeader")),c.toDisplayString(o.getItemLabel(i.submenu)),17)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.items,(function(n,s){return c.openBlock(),c.createElementBlock(c.Fragment,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions(n,s,"menuitem"),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[c.createElementVNode("div",c.mergeProps({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)}},o.getPTOptions(n,s,"content")),[i.templates.item?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.item),{key:1,item:n.item,hasSubmenu:o.isItemGroup(n),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):c.withDirectives((c.openBlock(),c.createElementBlock("a",c.mergeProps({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions(n,s,"action")),[i.templates.itemicon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.itemicon),{key:0,item:n.item,class:c.normalizeClass([e.cx("icon"),o.getItemProp(n,"icon")])},null,8,["item","class"])):o.getItemProp(n,"icon")?(c.openBlock(),c.createElementBlock("span",c.mergeProps({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions(n,s,"icon")),null,16)):c.createCommentVNode("",!0),c.createElementVNode("span",c.mergeProps({class:e.cx(0===i.level?"label":"submenuLabel")},o.getPTOptions(n,s,0===i.level?"label":"submenuLabel")),c.toDisplayString(o.getItemLabel(n)),17),o.isItemGroup(n)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:2},[i.templates.submenuicon?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.templates.submenuicon),c.mergeProps({key:0,active:o.isItemActive(n),class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["active","class"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.horizontal||i.mobileActive?"AngleDownIcon":"AngleRightIcon"),c.mergeProps({key:1,class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["class"]))],64)):c.createCommentVNode("",!0)],16,v)),[[a]])],16,b),o.isItemVisible(n)&&o.isItemGroup(n)?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:0,class:e.cx("panel")},e.ptm("panel")),[c.createElementVNode("div",c.mergeProps({class:e.cx("grid")},e.ptm("grid")),[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.items,(function(s){return c.openBlock(),c.createElementBlock("div",c.mergeProps({key:o.getItemKey(s),class:e.cx("column",{processedItem:n})},e.ptm("column")),[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s,(function(s){return c.openBlock(),c.createBlock(r,{key:o.getSubListKey(s),id:o.getSubListId(s),style:c.normalizeStyle(e.sx("submenu",!0,{processedItem:n})),role:"menu",menuId:i.menuId,focusedItemId:i.focusedItemId,submenu:s,items:s.items,templates:i.templates,level:i.level+1,mobileActive:i.mobileActive,pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)})},null,8,["id","style","menuId","focusedItemId","submenu","items","templates","level","mobileActive","pt","unstyled"])})),128))],16)})),128))],16)],16)):c.createCommentVNode("",!0)],16,p)):c.createCommentVNode("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(c.openBlock(),c.createElementBlock("li",c.mergeProps({key:1,id:o.getItemId(n),class:[e.cx("separator"),o.getItemProp(n,"class")],style:o.getItemProp(n,"style"),role:"separator"},e.ptm("separator")),null,16,g)):c.createCommentVNode("",!0)],64)})),128))],16,f)};var y={name:"MegaMenu",extends:I,emits:["focus","blur"],outsideClickListener:null,resizeListener:null,matchMediaListener:null,container:null,menubar:null,searchTimeout:null,searchValue:null,data:function(){return{id:this.$attrs.id,mobileActive:!1,focused:!1,focusedItemInfo:{index:-1,key:"",parentKey:""},activeItem:null,dirty:!1,query:null,queryMatches:!1}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeItem:function(e){t.ObjectUtils.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||t.UniqueComponentId(),this.bindMatchMediaListener()},beforeUnmount:function(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener()},methods:{getItemProp:function(e,i){return e?t.ObjectUtils.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.ObjectUtils.isNotEmpty(e.items)},toggle:function(e){var i=this;this.mobileActive?(this.mobileActive=!1,t.ZIndexUtils.clear(this.menubar),this.hide()):(this.mobileActive=!0,t.ZIndexUtils.set("menu",this.menubar,this.$primevue.config.zIndex.menu),setTimeout((function(){i.show()}),1)),this.bindOutsideClickListener(),e.preventDefault()},show:function(){this.focusedItemInfo={index:this.findFirstFocusedItemIndex(),level:0,parentKey:""},t.DomHandler.focus(this.menubar)},hide:function(e,i){var n=this;this.mobileActive&&(this.mobileActive=!1,setTimeout((function(){t.DomHandler.focus(n.$refs.menubutton)}),0)),this.activeItem=null,this.focusedItemInfo={index:-1,key:"",parentKey:""},i&&t.DomHandler.focus(this.menubar),this.dirty=!1},onFocus:function(e){if(this.focused=!0,-1===this.focusedItemInfo.index){var t=this.findFirstFocusedItemIndex(),i=this.findVisibleItem(t);this.focusedItemInfo={index:t,key:i.key,parentKey:i.parentKey}}this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,key:"",parentKey:""},this.searchValue="",this.dirty=!1,this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled)e.preventDefault();else{var i=e.metaKey||e.ctrlKey;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"Space":this.onSpaceKey(e);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.ObjectUtils.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.ObjectUtils.isEmpty(i)){var s=i.index,o=i.key,r=i.parentKey,c=t.ObjectUtils.isNotEmpty(i.items);c&&(this.activeItem=i),this.focusedItemInfo={index:s,key:o,parentKey:r},c&&(this.dirty=!0),n&&t.DomHandler.focus(this.menubar)}},onItemClick:function(e){var i=e.originalEvent,n=e.processedItem,s=this.isProccessedItemGroup(n),o=t.ObjectUtils.isEmpty(n.parent);if(this.isSelected(n)){var r=n.index,c=n.key,a=n.parentKey;this.activeItem=null,this.focusedItemInfo={index:r,key:c,parentKey:a},this.dirty=!o,t.DomHandler.focus(this.menubar)}else if(s)this.onItemChange(e);else{var m=o?n:this.activeItem;this.hide(i),this.changeFocusedItemInfo(i,m?m.index:-1),this.mobileActive=!1,t.DomHandler.focus(this.menubar)}},onItemMouseEnter:function(e){!this.mobileActive&&this.dirty&&this.onItemChange(e)},menuButtonClick:function(e){this.toggle(e)},menuButtonKeydown:function(e){("Enter"===e.code||"NumpadEnter"===e.code||"Space"===e.code)&&this.menuButtonClick(e)},onArrowDownKey:function(e){if(this.horizontal)if(t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===this.focusedItemInfo.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var i=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo={index:-1,key:i.key,parentKey:i.parentKey},this.searchValue="")}var n=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&this.horizontal){if(-1!==this.focusedItemInfo.index){var i=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(i)&&t.ObjectUtils.isNotEmpty(this.activeItem)&&(0===this.focusedItemInfo.index?(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null):this.changeFocusedItemInfo(e,this.findFirstItemIndex()))}e.preventDefault()}else{var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()}},onArrowLeftKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.horizontal){var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n)}}else{this.vertical&&t.ObjectUtils.isNotEmpty(this.activeItem)&&0===i.columnIndex&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null);var s=i.columnIndex-1,o=this.visibleItems.findIndex((function(e){return e.columnIndex===s}));-1!==o&&this.changeFocusedItemInfo(e,o)}e.preventDefault()},onArrowRightKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.vertical)if(t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===i.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var n=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo={index:-1,key:n.key,parentKey:n.parentKey},this.searchValue="")}var s=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,s)}else{var o=i.columnIndex+1,r=this.visibleItems.findIndex((function(e){return e.columnIndex===o}));-1!==r&&this.changeFocusedItemInfo(e,r)}e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemInfo(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemInfo(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var i=t.DomHandler.findSingle(this.menubar,'li[id="'.concat("".concat(this.focusedItemId),'"]')),n=i&&t.DomHandler.findSingle(i,'a[data-pc-section="action"]');n?n.click():i&&i.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&this.changeFocusedItemInfo(e,this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){t.ObjectUtils.isNotEmpty(this.activeItem)&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key},this.activeItem=null),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(i){t.DomHandler.isTouchDevice()||e.hide(i,!0),e.mobileActive=!1},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia("(max-width: ".concat(this.breakpoint,")"));this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches,e.mobileActive=!1},this.query.addEventListener("change",this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)},isItemMatched:function(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return!!t.ObjectUtils.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.ObjectUtils.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.ObjectUtils.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},findVisibleItem:function(e){return t.ObjectUtils.isNotEmpty(this.visibleItems)?this.visibleItems[e]:null},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemInfo(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemInfo:function(e,i){var n=this.findVisibleItem(i);this.focusedItemInfo.index=i,this.focusedItemInfo.key=t.ObjectUtils.isNotEmpty(n)?n.key:"",this.scrollInView()},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemId,n=t.DomHandler.findSingle(this.menubar,'li[id="'.concat(i,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4?arguments[4]:void 0,r=[];return e&&e.forEach((function(e,c){var a=(""!==s?s+"_":"")+(void 0!==o?o+"_":"")+c,m={item:e,index:c,level:i,key:a,parent:n,parentKey:s,columnIndex:void 0!==o?o:void 0!==n.columnIndex?n.columnIndex:c};m.items=0===i&&e.items&&e.items.length>0?e.items.map((function(e,n){return t.createProcessedItems(e,i+1,m,a,n)})):t.createProcessedItems(e.items,i+1,m,a),r.push(m)})),r},containerRef:function(e){this.container=e},menubarRef:function(e){this.menubar=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=t.ObjectUtils.isNotEmpty(this.activeItem)?this.activeItem:null;return e&&e.key===this.focusedItemInfo.parentKey?e.items.reduce((function(e,t){return t.forEach((function(t){t.items.forEach((function(t){e.push(t)}))})),e}),[]):this.processedItems},horizontal:function(){return"horizontal"===this.orientation},vertical:function(){return"vertical"===this.orientation},focusedItemId:function(){return t.ObjectUtils.isNotEmpty(this.focusedItemInfo.key)?"".concat(this.id,"_").concat(this.focusedItemInfo.key):null}},components:{MegaMenuSub:h,BarsIcon:m.default}},k=["id"],x=["aria-haspopup","aria-expanded","aria-controls","aria-label"];y.render=function(e,t,i,n,s,o){var r=c.resolveComponent("BarsIcon"),a=c.resolveComponent("MegaMenuSub");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref:o.containerRef,id:s.id,class:e.cx("root")},e.ptm("root"),{"data-pc-name":"megamenu"}),[e.$slots.start?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:0,class:e.cx("start")},e.ptm("start")),[c.renderSlot(e.$slots,"start")],16)):c.createCommentVNode("",!0),c.renderSlot(e.$slots,"menubutton",{id:s.id,class:c.normalizeClass(e.cx("menubutton")),toggleCallback:function(e){return o.menuButtonClick(e)}},(function(){var i;return[e.model&&e.model.length>0?(c.openBlock(),c.createElementBlock("a",c.mergeProps({key:0,ref:"menubutton",role:"button",tabindex:"0",class:e.cx("menubutton"),"aria-haspopup":!!(e.model.length&&e.model.length>0),"aria-expanded":s.mobileActive,"aria-controls":s.id,"aria-label":null===(i=e.$primevue.config.locale.aria)||void 0===i?void 0:i.navigation,onClick:t[0]||(t[0]=function(e){return o.menuButtonClick(e)}),onKeydown:t[1]||(t[1]=function(e){return o.menuButtonKeydown(e)})},e.ptm("menubutton")),[c.renderSlot(e.$slots,"menubuttonicon",{},(function(){return[c.createVNode(r,c.normalizeProps(c.guardReactiveProps(e.ptm("menubuttonicon"))),null,16)]}))],16,x)):c.createCommentVNode("",!0)]})),c.createVNode(a,{ref:o.menubarRef,id:s.id+"_list",tabindex:e.disabled?-1:e.tabindex,role:"menubar","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-disabled":e.disabled||void 0,"aria-orientation":e.orientation,"aria-activedescendant":s.focused?o.focusedItemId:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemId:void 0,items:o.processedItems,horizontal:o.horizontal,templates:e.$slots,activeItem:s.activeItem,mobileActive:s.mobileActive,level:0,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter},null,8,["id","tabindex","aria-label","aria-labelledby","aria-disabled","aria-orientation","aria-activedescendant","menuId","focusedItemId","items","horizontal","templates","activeItem","mobileActive","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter"]),e.$slots.end?(c.openBlock(),c.createElementBlock("div",c.mergeProps({key:1,class:e.cx("end")},e.ptm("end")),[c.renderSlot(e.$slots,"end")],16)):c.createCommentVNode("",!0)],16,k)},module.exports=y;
@@ -491,6 +491,7 @@ var script = {
491
491
  this.onSpaceKey(event);
492
492
  break;
493
493
  case 'Enter':
494
+ case 'NumpadEnter':
494
495
  this.onEnterKey(event);
495
496
  break;
496
497
  case 'Escape':
@@ -570,7 +571,7 @@ var script = {
570
571
  this.toggle(event);
571
572
  },
572
573
  menuButtonKeydown: function menuButtonKeydown(event) {
573
- (event.code === 'Enter' || event.code === 'Space') && this.menuButtonClick(event);
574
+ (event.code === 'Enter' || event.code === 'NumpadEnter' || event.code === 'Space') && this.menuButtonClick(event);
574
575
  },
575
576
  onArrowDownKey: function onArrowDownKey(event) {
576
577
  if (this.horizontal) {
@@ -1 +1 @@
1
- import e from"primevue/icons/bars";import{ObjectUtils as t,UniqueComponentId as i,ZIndexUtils as n,DomHandler as s}from"primevue/utils";import o from"primevue/basecomponent";import r from"primevue/megamenu/style";import a from"primevue/icons/angledown";import c from"primevue/icons/angleright";import u from"primevue/ripple";import{mergeProps as m,resolveComponent as d,resolveDirective as l,openBlock as I,createElementBlock as h,toDisplayString as f,createCommentVNode as p,Fragment as b,renderList as v,createElementVNode as y,withDirectives as g,createBlock as x,resolveDynamicComponent as k,normalizeClass as L,normalizeStyle as P,renderSlot as K,createVNode as E,normalizeProps as M,guardReactiveProps as A}from"vue";var F={name:"BaseMegaMenu",extends:o,props:{model:{type:Array,default:null},orientation:{type:String,default:"horizontal"},breakpoint:{type:String,default:"960px"},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:r,provide:function(){return{$parentInstance:this}}},w={name:"MegaMenuSub",hostName:"MegaMenu",extends:o,emits:["item-click","item-mouseenter"],props:{menuId:{type:String,default:null},focusedItemId:{type:String,default:null},horizontal:{type:Boolean,default:!1},submenu:{type:Object,default:null},mobileActive:{type:Boolean,default:!1},items:{type:Array,default:null},level:{type:Number,default:0},templates:{type:Object,default:null},activeItem:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getSubListId:function(e){return"".concat(this.getItemId(e),"_list")},getSubListKey:function(e){return this.getSubListId(e)},getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getPTOptions:function(e,t,i){return this.ptm(i,{context:{item:e,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})},isItemActive:function(e){return!!t.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},getMenuItemProps:function(e,t){return{action:m({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions(e,t,"action")),icon:m({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions(e,t,"icon")),label:m({class:this.cx("label")},this.getPTOptions(e,t,"label")),submenuicon:m({class:this.cx("submenuIcon")},this.getPTOptions(e,t,"submenuIcon"))}}},components:{AngleRightIcon:c,AngleDownIcon:a},directives:{ripple:u}},S=["tabindex"],V=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],C=["onClick","onMouseenter"],z=["href","target"],D=["id"];w.render=function(e,t,i,n,s,o){var r=d("MegaMenuSub",!0),a=l("ripple");return I(),h("ul",m({class:e.cx(0===i.level?"menu":"submenu"),tabindex:i.tabindex},e.ptm(0===i.level?"menu":"submenu")),[i.submenu?(I(),h("li",m({key:0,class:[e.cx("submenuHeader",{submenu:i.submenu}),o.getItemProp(i.submenu,"class")],style:o.getItemProp(i.submenu,"style"),role:"presentation"},e.ptm("submenuHeader")),f(o.getItemLabel(i.submenu)),17)):p("",!0),(I(!0),h(b,null,v(i.items,(function(n,s){return I(),h(b,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(I(),h("li",m({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions(n,s,"menuitem"),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[y("div",m({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)}},o.getPTOptions(n,s,"content")),[i.templates.item?(I(),x(k(i.templates.item),{key:1,item:n.item,hasSubmenu:o.isItemGroup(n),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):g((I(),h("a",m({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions(n,s,"action")),[i.templates.itemicon?(I(),x(k(i.templates.itemicon),{key:0,item:n.item,class:L([e.cx("icon"),o.getItemProp(n,"icon")])},null,8,["item","class"])):o.getItemProp(n,"icon")?(I(),h("span",m({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions(n,s,"icon")),null,16)):p("",!0),y("span",m({class:e.cx(0===i.level?"label":"submenuLabel")},o.getPTOptions(n,s,0===i.level?"label":"submenuLabel")),f(o.getItemLabel(n)),17),o.isItemGroup(n)?(I(),h(b,{key:2},[i.templates.submenuicon?(I(),x(k(i.templates.submenuicon),m({key:0,active:o.isItemActive(n),class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["active","class"])):(I(),x(k(i.horizontal||i.mobileActive?"AngleDownIcon":"AngleRightIcon"),m({key:1,class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["class"]))],64)):p("",!0)],16,z)),[[a]])],16,C),o.isItemVisible(n)&&o.isItemGroup(n)?(I(),h("div",m({key:0,class:e.cx("panel")},e.ptm("panel")),[y("div",m({class:e.cx("grid")},e.ptm("grid")),[(I(!0),h(b,null,v(n.items,(function(s){return I(),h("div",m({key:o.getItemKey(s),class:e.cx("column",{processedItem:n})},e.ptm("column")),[(I(!0),h(b,null,v(s,(function(s){return I(),x(r,{key:o.getSubListKey(s),id:o.getSubListId(s),style:P(e.sx("submenu",!0,{processedItem:n})),role:"menu",menuId:i.menuId,focusedItemId:i.focusedItemId,submenu:s,items:s.items,templates:i.templates,level:i.level+1,mobileActive:i.mobileActive,pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)})},null,8,["id","style","menuId","focusedItemId","submenu","items","templates","level","mobileActive","pt","unstyled"])})),128))],16)})),128))],16)],16)):p("",!0)],16,V)):p("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(I(),h("li",m({key:1,id:o.getItemId(n),class:[e.cx("separator"),o.getItemProp(n,"class")],style:o.getItemProp(n,"style"),role:"separator"},e.ptm("separator")),null,16,D)):p("",!0)],64)})),128))],16,S)};var T={name:"MegaMenu",extends:F,emits:["focus","blur"],outsideClickListener:null,resizeListener:null,matchMediaListener:null,container:null,menubar:null,searchTimeout:null,searchValue:null,data:function(){return{id:this.$attrs.id,mobileActive:!1,focused:!1,focusedItemInfo:{index:-1,key:"",parentKey:""},activeItem:null,dirty:!1,query:null,queryMatches:!1}},watch:{"$attrs.id":function(e){this.id=e||i()},activeItem:function(e){t.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||i(),this.bindMatchMediaListener()},beforeUnmount:function(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener()},methods:{getItemProp:function(e,i){return e?t.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemGroup:function(e){return t.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.isNotEmpty(e.items)},toggle:function(e){var t=this;this.mobileActive?(this.mobileActive=!1,n.clear(this.menubar),this.hide()):(this.mobileActive=!0,n.set("menu",this.menubar,this.$primevue.config.zIndex.menu),setTimeout((function(){t.show()}),1)),this.bindOutsideClickListener(),e.preventDefault()},show:function(){this.focusedItemInfo={index:this.findFirstFocusedItemIndex(),level:0,parentKey:""},s.focus(this.menubar)},hide:function(e,t){var i=this;this.mobileActive&&(this.mobileActive=!1,setTimeout((function(){s.focus(i.$refs.menubutton)}),0)),this.activeItem=null,this.focusedItemInfo={index:-1,key:"",parentKey:""},t&&s.focus(this.menubar),this.dirty=!1},onFocus:function(e){if(this.focused=!0,-1===this.focusedItemInfo.index){var t=this.findFirstFocusedItemIndex(),i=this.findVisibleItem(t);this.focusedItemInfo={index:t,key:i.key,parentKey:i.parentKey}}this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,key:"",parentKey:""},this.searchValue="",this.dirty=!1,this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled)e.preventDefault();else{var i=e.metaKey||e.ctrlKey;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"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.isEmpty(i)){var o=i.index,r=i.key,a=i.parentKey,c=t.isNotEmpty(i.items);c&&(this.activeItem=i),this.focusedItemInfo={index:o,key:r,parentKey:a},c&&(this.dirty=!0),n&&s.focus(this.menubar)}},onItemClick:function(e){var i=e.originalEvent,n=e.processedItem,o=this.isProccessedItemGroup(n),r=t.isEmpty(n.parent);if(this.isSelected(n)){var a=n.index,c=n.key,u=n.parentKey;this.activeItem=null,this.focusedItemInfo={index:a,key:c,parentKey:u},this.dirty=!r,s.focus(this.menubar)}else if(o)this.onItemChange(e);else{var m=r?n:this.activeItem;this.hide(i),this.changeFocusedItemInfo(i,m?m.index:-1),this.mobileActive=!1,s.focus(this.menubar)}},onItemMouseEnter:function(e){!this.mobileActive&&this.dirty&&this.onItemChange(e)},menuButtonClick:function(e){this.toggle(e)},menuButtonKeydown:function(e){("Enter"===e.code||"Space"===e.code)&&this.menuButtonClick(e)},onArrowDownKey:function(e){if(this.horizontal)if(t.isNotEmpty(this.activeItem)&&this.activeItem.key===this.focusedItemInfo.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var i=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo={index:-1,key:i.key,parentKey:i.parentKey},this.searchValue="")}var n=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&this.horizontal){if(-1!==this.focusedItemInfo.index){var i=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(i)&&t.isNotEmpty(this.activeItem)&&(0===this.focusedItemInfo.index?(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null):this.changeFocusedItemInfo(e,this.findFirstItemIndex()))}e.preventDefault()}else{var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()}},onArrowLeftKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.horizontal){var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n)}}else{this.vertical&&t.isNotEmpty(this.activeItem)&&0===i.columnIndex&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null);var s=i.columnIndex-1,o=this.visibleItems.findIndex((function(e){return e.columnIndex===s}));-1!==o&&this.changeFocusedItemInfo(e,o)}e.preventDefault()},onArrowRightKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.vertical)if(t.isNotEmpty(this.activeItem)&&this.activeItem.key===i.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var n=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo={index:-1,key:n.key,parentKey:n.parentKey},this.searchValue="")}var s=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,s)}else{var o=i.columnIndex+1,r=this.visibleItems.findIndex((function(e){return e.columnIndex===o}));-1!==r&&this.changeFocusedItemInfo(e,r)}e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemInfo(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemInfo(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var t=s.findSingle(this.menubar,'li[id="'.concat("".concat(this.focusedItemId),'"]')),i=t&&s.findSingle(t,'a[data-pc-section="action"]');i?i.click():t&&t.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&this.changeFocusedItemInfo(e,this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){t.isNotEmpty(this.activeItem)&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key},this.activeItem=null),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(t){s.isTouchDevice()||e.hide(t,!0),e.mobileActive=!1},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia("(max-width: ".concat(this.breakpoint,")"));this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches,e.mobileActive=!1},this.query.addEventListener("change",this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)},isItemMatched:function(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return!!t.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},findVisibleItem:function(e){return t.isNotEmpty(this.visibleItems)?this.visibleItems[e]:null},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemInfo(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemInfo:function(e,i){var n=this.findVisibleItem(i);this.focusedItemInfo.index=i,this.focusedItemInfo.key=t.isNotEmpty(n)?n.key:"",this.scrollInView()},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemId,i=s.findSingle(this.menubar,'li[id="'.concat(t,'"]'));i&&i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4?arguments[4]:void 0,r=[];return e&&e.forEach((function(e,a){var c=(""!==s?s+"_":"")+(void 0!==o?o+"_":"")+a,u={item:e,index:a,level:i,key:c,parent:n,parentKey:s,columnIndex:void 0!==o?o:void 0!==n.columnIndex?n.columnIndex:a};u.items=0===i&&e.items&&e.items.length>0?e.items.map((function(e,n){return t.createProcessedItems(e,i+1,u,c,n)})):t.createProcessedItems(e.items,i+1,u,c),r.push(u)})),r},containerRef:function(e){this.container=e},menubarRef:function(e){this.menubar=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=t.isNotEmpty(this.activeItem)?this.activeItem:null;return e&&e.key===this.focusedItemInfo.parentKey?e.items.reduce((function(e,t){return t.forEach((function(t){t.items.forEach((function(t){e.push(t)}))})),e}),[]):this.processedItems},horizontal:function(){return"horizontal"===this.orientation},vertical:function(){return"vertical"===this.orientation},focusedItemId:function(){return t.isNotEmpty(this.focusedItemInfo.key)?"".concat(this.id,"_").concat(this.focusedItemInfo.key):null}},components:{MegaMenuSub:w,BarsIcon:e}},N=["id"],O=["aria-haspopup","aria-expanded","aria-controls","aria-label"];T.render=function(e,t,i,n,s,o){var r=d("BarsIcon"),a=d("MegaMenuSub");return I(),h("div",m({ref:o.containerRef,id:s.id,class:e.cx("root")},e.ptm("root"),{"data-pc-name":"megamenu"}),[e.$slots.start?(I(),h("div",m({key:0,class:e.cx("start")},e.ptm("start")),[K(e.$slots,"start")],16)):p("",!0),K(e.$slots,"menubutton",{id:s.id,class:L(e.cx("menubutton")),toggleCallback:function(e){return o.menuButtonClick(e)}},(function(){var i;return[e.model&&e.model.length>0?(I(),h("a",m({key:0,ref:"menubutton",role:"button",tabindex:"0",class:e.cx("menubutton"),"aria-haspopup":!!(e.model.length&&e.model.length>0),"aria-expanded":s.mobileActive,"aria-controls":s.id,"aria-label":null===(i=e.$primevue.config.locale.aria)||void 0===i?void 0:i.navigation,onClick:t[0]||(t[0]=function(e){return o.menuButtonClick(e)}),onKeydown:t[1]||(t[1]=function(e){return o.menuButtonKeydown(e)})},e.ptm("menubutton")),[K(e.$slots,"menubuttonicon",{},(function(){return[E(r,M(A(e.ptm("menubuttonicon"))),null,16)]}))],16,O)):p("",!0)]})),E(a,{ref:o.menubarRef,id:s.id+"_list",tabindex:e.disabled?-1:e.tabindex,role:"menubar","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-disabled":e.disabled||void 0,"aria-orientation":e.orientation,"aria-activedescendant":s.focused?o.focusedItemId:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemId:void 0,items:o.processedItems,horizontal:o.horizontal,templates:e.$slots,activeItem:s.activeItem,mobileActive:s.mobileActive,level:0,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter},null,8,["id","tabindex","aria-label","aria-labelledby","aria-disabled","aria-orientation","aria-activedescendant","menuId","focusedItemId","items","horizontal","templates","activeItem","mobileActive","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter"]),e.$slots.end?(I(),h("div",m({key:1,class:e.cx("end")},e.ptm("end")),[K(e.$slots,"end")],16)):p("",!0)],16,N)};export{T as default};
1
+ import e from"primevue/icons/bars";import{ObjectUtils as t,UniqueComponentId as i,ZIndexUtils as n,DomHandler as s}from"primevue/utils";import o from"primevue/basecomponent";import r from"primevue/megamenu/style";import a from"primevue/icons/angledown";import c from"primevue/icons/angleright";import u from"primevue/ripple";import{mergeProps as m,resolveComponent as d,resolveDirective as l,openBlock as I,createElementBlock as h,toDisplayString as f,createCommentVNode as p,Fragment as b,renderList as v,createElementVNode as y,withDirectives as g,createBlock as x,resolveDynamicComponent as k,normalizeClass as L,normalizeStyle as P,renderSlot as K,createVNode as E,normalizeProps as M,guardReactiveProps as A}from"vue";var F={name:"BaseMegaMenu",extends:o,props:{model:{type:Array,default:null},orientation:{type:String,default:"horizontal"},breakpoint:{type:String,default:"960px"},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:r,provide:function(){return{$parentInstance:this}}},w={name:"MegaMenuSub",hostName:"MegaMenu",extends:o,emits:["item-click","item-mouseenter"],props:{menuId:{type:String,default:null},focusedItemId:{type:String,default:null},horizontal:{type:Boolean,default:!1},submenu:{type:Object,default:null},mobileActive:{type:Boolean,default:!1},items:{type:Array,default:null},level:{type:Number,default:0},templates:{type:Object,default:null},activeItem:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getSubListId:function(e){return"".concat(this.getItemId(e),"_list")},getSubListKey:function(e){return this.getSubListId(e)},getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getPTOptions:function(e,t,i){return this.ptm(i,{context:{item:e,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})},isItemActive:function(e){return!!t.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},getMenuItemProps:function(e,t){return{action:m({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions(e,t,"action")),icon:m({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions(e,t,"icon")),label:m({class:this.cx("label")},this.getPTOptions(e,t,"label")),submenuicon:m({class:this.cx("submenuIcon")},this.getPTOptions(e,t,"submenuIcon"))}}},components:{AngleRightIcon:c,AngleDownIcon:a},directives:{ripple:u}},S=["tabindex"],V=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],C=["onClick","onMouseenter"],z=["href","target"],D=["id"];w.render=function(e,t,i,n,s,o){var r=d("MegaMenuSub",!0),a=l("ripple");return I(),h("ul",m({class:e.cx(0===i.level?"menu":"submenu"),tabindex:i.tabindex},e.ptm(0===i.level?"menu":"submenu")),[i.submenu?(I(),h("li",m({key:0,class:[e.cx("submenuHeader",{submenu:i.submenu}),o.getItemProp(i.submenu,"class")],style:o.getItemProp(i.submenu,"style"),role:"presentation"},e.ptm("submenuHeader")),f(o.getItemLabel(i.submenu)),17)):p("",!0),(I(!0),h(b,null,v(i.items,(function(n,s){return I(),h(b,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(I(),h("li",m({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions(n,s,"menuitem"),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[y("div",m({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)}},o.getPTOptions(n,s,"content")),[i.templates.item?(I(),x(k(i.templates.item),{key:1,item:n.item,hasSubmenu:o.isItemGroup(n),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):g((I(),h("a",m({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions(n,s,"action")),[i.templates.itemicon?(I(),x(k(i.templates.itemicon),{key:0,item:n.item,class:L([e.cx("icon"),o.getItemProp(n,"icon")])},null,8,["item","class"])):o.getItemProp(n,"icon")?(I(),h("span",m({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions(n,s,"icon")),null,16)):p("",!0),y("span",m({class:e.cx(0===i.level?"label":"submenuLabel")},o.getPTOptions(n,s,0===i.level?"label":"submenuLabel")),f(o.getItemLabel(n)),17),o.isItemGroup(n)?(I(),h(b,{key:2},[i.templates.submenuicon?(I(),x(k(i.templates.submenuicon),m({key:0,active:o.isItemActive(n),class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["active","class"])):(I(),x(k(i.horizontal||i.mobileActive?"AngleDownIcon":"AngleRightIcon"),m({key:1,class:e.cx("submenuIcon")},o.getPTOptions(n,s,"submenuIcon")),null,16,["class"]))],64)):p("",!0)],16,z)),[[a]])],16,C),o.isItemVisible(n)&&o.isItemGroup(n)?(I(),h("div",m({key:0,class:e.cx("panel")},e.ptm("panel")),[y("div",m({class:e.cx("grid")},e.ptm("grid")),[(I(!0),h(b,null,v(n.items,(function(s){return I(),h("div",m({key:o.getItemKey(s),class:e.cx("column",{processedItem:n})},e.ptm("column")),[(I(!0),h(b,null,v(s,(function(s){return I(),x(r,{key:o.getSubListKey(s),id:o.getSubListId(s),style:P(e.sx("submenu",!0,{processedItem:n})),role:"menu",menuId:i.menuId,focusedItemId:i.focusedItemId,submenu:s,items:s.items,templates:i.templates,level:i.level+1,mobileActive:i.mobileActive,pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)})},null,8,["id","style","menuId","focusedItemId","submenu","items","templates","level","mobileActive","pt","unstyled"])})),128))],16)})),128))],16)],16)):p("",!0)],16,V)):p("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(I(),h("li",m({key:1,id:o.getItemId(n),class:[e.cx("separator"),o.getItemProp(n,"class")],style:o.getItemProp(n,"style"),role:"separator"},e.ptm("separator")),null,16,D)):p("",!0)],64)})),128))],16,S)};var N={name:"MegaMenu",extends:F,emits:["focus","blur"],outsideClickListener:null,resizeListener:null,matchMediaListener:null,container:null,menubar:null,searchTimeout:null,searchValue:null,data:function(){return{id:this.$attrs.id,mobileActive:!1,focused:!1,focusedItemInfo:{index:-1,key:"",parentKey:""},activeItem:null,dirty:!1,query:null,queryMatches:!1}},watch:{"$attrs.id":function(e){this.id=e||i()},activeItem:function(e){t.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||i(),this.bindMatchMediaListener()},beforeUnmount:function(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener()},methods:{getItemProp:function(e,i){return e?t.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemGroup:function(e){return t.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.isNotEmpty(e.items)},toggle:function(e){var t=this;this.mobileActive?(this.mobileActive=!1,n.clear(this.menubar),this.hide()):(this.mobileActive=!0,n.set("menu",this.menubar,this.$primevue.config.zIndex.menu),setTimeout((function(){t.show()}),1)),this.bindOutsideClickListener(),e.preventDefault()},show:function(){this.focusedItemInfo={index:this.findFirstFocusedItemIndex(),level:0,parentKey:""},s.focus(this.menubar)},hide:function(e,t){var i=this;this.mobileActive&&(this.mobileActive=!1,setTimeout((function(){s.focus(i.$refs.menubutton)}),0)),this.activeItem=null,this.focusedItemInfo={index:-1,key:"",parentKey:""},t&&s.focus(this.menubar),this.dirty=!1},onFocus:function(e){if(this.focused=!0,-1===this.focusedItemInfo.index){var t=this.findFirstFocusedItemIndex(),i=this.findVisibleItem(t);this.focusedItemInfo={index:t,key:i.key,parentKey:i.parentKey}}this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,key:"",parentKey:""},this.searchValue="",this.dirty=!1,this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled)e.preventDefault();else{var i=e.metaKey||e.ctrlKey;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"Space":this.onSpaceKey(e);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.isEmpty(i)){var o=i.index,r=i.key,a=i.parentKey,c=t.isNotEmpty(i.items);c&&(this.activeItem=i),this.focusedItemInfo={index:o,key:r,parentKey:a},c&&(this.dirty=!0),n&&s.focus(this.menubar)}},onItemClick:function(e){var i=e.originalEvent,n=e.processedItem,o=this.isProccessedItemGroup(n),r=t.isEmpty(n.parent);if(this.isSelected(n)){var a=n.index,c=n.key,u=n.parentKey;this.activeItem=null,this.focusedItemInfo={index:a,key:c,parentKey:u},this.dirty=!r,s.focus(this.menubar)}else if(o)this.onItemChange(e);else{var m=r?n:this.activeItem;this.hide(i),this.changeFocusedItemInfo(i,m?m.index:-1),this.mobileActive=!1,s.focus(this.menubar)}},onItemMouseEnter:function(e){!this.mobileActive&&this.dirty&&this.onItemChange(e)},menuButtonClick:function(e){this.toggle(e)},menuButtonKeydown:function(e){("Enter"===e.code||"NumpadEnter"===e.code||"Space"===e.code)&&this.menuButtonClick(e)},onArrowDownKey:function(e){if(this.horizontal)if(t.isNotEmpty(this.activeItem)&&this.activeItem.key===this.focusedItemInfo.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var i=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo={index:-1,key:i.key,parentKey:i.parentKey},this.searchValue="")}var n=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&this.horizontal){if(-1!==this.focusedItemInfo.index){var i=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(i)&&t.isNotEmpty(this.activeItem)&&(0===this.focusedItemInfo.index?(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null):this.changeFocusedItemInfo(e,this.findFirstItemIndex()))}e.preventDefault()}else{var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n),e.preventDefault()}},onArrowLeftKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.horizontal){var n=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemInfo(e,n)}}else{this.vertical&&t.isNotEmpty(this.activeItem)&&0===i.columnIndex&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key,parentKey:this.activeItem.parentKey},this.activeItem=null);var s=i.columnIndex-1,o=this.visibleItems.findIndex((function(e){return e.columnIndex===s}));-1!==o&&this.changeFocusedItemInfo(e,o)}e.preventDefault()},onArrowRightKey:function(e){var i=this.findVisibleItem(this.focusedItemInfo.index);if(this.isProccessedItemGroup(i)){if(this.vertical)if(t.isNotEmpty(this.activeItem)&&this.activeItem.key===i.key)this.focusedItemInfo={index:-1,key:"",parentKey:this.activeItem.key};else{var n=this.findVisibleItem(this.focusedItemInfo.index);this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo={index:-1,key:n.key,parentKey:n.parentKey},this.searchValue="")}var s=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemInfo(e,s)}else{var o=i.columnIndex+1,r=this.visibleItems.findIndex((function(e){return e.columnIndex===o}));-1!==r&&this.changeFocusedItemInfo(e,r)}e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemInfo(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemInfo(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var t=s.findSingle(this.menubar,'li[id="'.concat("".concat(this.focusedItemId),'"]')),i=t&&s.findSingle(t,'a[data-pc-section="action"]');i?i.click():t&&t.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&this.changeFocusedItemInfo(e,this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){t.isNotEmpty(this.activeItem)&&(this.focusedItemInfo={index:this.activeItem.index,key:this.activeItem.key},this.activeItem=null),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.findVisibleItem(this.focusedItemInfo.index);!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(t){s.isTouchDevice()||e.hide(t,!0),e.mobileActive=!1},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia("(max-width: ".concat(this.breakpoint,")"));this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches,e.mobileActive=!1},this.query.addEventListener("change",this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)},isItemMatched:function(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return!!t.isNotEmpty(this.activeItem)&&this.activeItem.key===e.key},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},findVisibleItem:function(e){return t.isNotEmpty(this.visibleItems)?this.visibleItems[e]:null},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemInfo(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemInfo:function(e,i){var n=this.findVisibleItem(i);this.focusedItemInfo.index=i,this.focusedItemInfo.key=t.isNotEmpty(n)?n.key:"",this.scrollInView()},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemId,i=s.findSingle(this.menubar,'li[id="'.concat(t,'"]'));i&&i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4?arguments[4]:void 0,r=[];return e&&e.forEach((function(e,a){var c=(""!==s?s+"_":"")+(void 0!==o?o+"_":"")+a,u={item:e,index:a,level:i,key:c,parent:n,parentKey:s,columnIndex:void 0!==o?o:void 0!==n.columnIndex?n.columnIndex:a};u.items=0===i&&e.items&&e.items.length>0?e.items.map((function(e,n){return t.createProcessedItems(e,i+1,u,c,n)})):t.createProcessedItems(e.items,i+1,u,c),r.push(u)})),r},containerRef:function(e){this.container=e},menubarRef:function(e){this.menubar=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=t.isNotEmpty(this.activeItem)?this.activeItem:null;return e&&e.key===this.focusedItemInfo.parentKey?e.items.reduce((function(e,t){return t.forEach((function(t){t.items.forEach((function(t){e.push(t)}))})),e}),[]):this.processedItems},horizontal:function(){return"horizontal"===this.orientation},vertical:function(){return"vertical"===this.orientation},focusedItemId:function(){return t.isNotEmpty(this.focusedItemInfo.key)?"".concat(this.id,"_").concat(this.focusedItemInfo.key):null}},components:{MegaMenuSub:w,BarsIcon:e}},T=["id"],O=["aria-haspopup","aria-expanded","aria-controls","aria-label"];N.render=function(e,t,i,n,s,o){var r=d("BarsIcon"),a=d("MegaMenuSub");return I(),h("div",m({ref:o.containerRef,id:s.id,class:e.cx("root")},e.ptm("root"),{"data-pc-name":"megamenu"}),[e.$slots.start?(I(),h("div",m({key:0,class:e.cx("start")},e.ptm("start")),[K(e.$slots,"start")],16)):p("",!0),K(e.$slots,"menubutton",{id:s.id,class:L(e.cx("menubutton")),toggleCallback:function(e){return o.menuButtonClick(e)}},(function(){var i;return[e.model&&e.model.length>0?(I(),h("a",m({key:0,ref:"menubutton",role:"button",tabindex:"0",class:e.cx("menubutton"),"aria-haspopup":!!(e.model.length&&e.model.length>0),"aria-expanded":s.mobileActive,"aria-controls":s.id,"aria-label":null===(i=e.$primevue.config.locale.aria)||void 0===i?void 0:i.navigation,onClick:t[0]||(t[0]=function(e){return o.menuButtonClick(e)}),onKeydown:t[1]||(t[1]=function(e){return o.menuButtonKeydown(e)})},e.ptm("menubutton")),[K(e.$slots,"menubuttonicon",{},(function(){return[E(r,M(A(e.ptm("menubuttonicon"))),null,16)]}))],16,O)):p("",!0)]})),E(a,{ref:o.menubarRef,id:s.id+"_list",tabindex:e.disabled?-1:e.tabindex,role:"menubar","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-disabled":e.disabled||void 0,"aria-orientation":e.orientation,"aria-activedescendant":s.focused?o.focusedItemId:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemId:void 0,items:o.processedItems,horizontal:o.horizontal,templates:e.$slots,activeItem:s.activeItem,mobileActive:s.mobileActive,level:0,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter},null,8,["id","tabindex","aria-label","aria-labelledby","aria-disabled","aria-orientation","aria-activedescendant","menuId","focusedItemId","items","horizontal","templates","activeItem","mobileActive","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter"]),e.$slots.end?(I(),h("div",m({key:1,class:e.cx("end")},e.ptm("end")),[K(e.$slots,"end")],16)):p("",!0)],16,T)};export{N as default};