primevue 3.8.2 → 3.9.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 (373) hide show
  1. package/README.md +2 -2
  2. package/api/Api.d.ts +70 -36
  3. package/api/api.cjs.js +66 -32
  4. package/api/api.cjs.min.js +1 -1
  5. package/api/api.esm.js +66 -32
  6. package/api/api.esm.min.js +1 -1
  7. package/api/api.js +66 -32
  8. package/api/api.min.js +1 -1
  9. package/autocomplete/AutoComplete.vue +16 -9
  10. package/autocomplete/autocomplete.cjs.js +19 -11
  11. package/autocomplete/autocomplete.cjs.min.js +1 -1
  12. package/autocomplete/autocomplete.esm.js +19 -11
  13. package/autocomplete/autocomplete.esm.min.js +1 -1
  14. package/autocomplete/autocomplete.js +19 -11
  15. package/autocomplete/autocomplete.min.js +1 -1
  16. package/breadcrumb/BreadcrumbItem.vue +5 -2
  17. package/breadcrumb/breadcrumb.cjs.js +5 -2
  18. package/breadcrumb/breadcrumb.cjs.min.js +1 -1
  19. package/breadcrumb/breadcrumb.esm.js +5 -2
  20. package/breadcrumb/breadcrumb.esm.min.js +1 -1
  21. package/breadcrumb/breadcrumb.js +5 -2
  22. package/breadcrumb/breadcrumb.min.js +1 -1
  23. package/calendar/Calendar.d.ts +6 -0
  24. package/calendar/Calendar.vue +362 -67
  25. package/calendar/calendar.cjs.js +459 -168
  26. package/calendar/calendar.cjs.min.js +1 -1
  27. package/calendar/calendar.esm.js +461 -170
  28. package/calendar/calendar.esm.min.js +1 -1
  29. package/calendar/calendar.js +459 -168
  30. package/calendar/calendar.min.js +1 -1
  31. package/carousel/Carousel.vue +2 -2
  32. package/carousel/carousel.cjs.js +6 -6
  33. package/carousel/carousel.cjs.min.js +1 -1
  34. package/carousel/carousel.esm.js +6 -6
  35. package/carousel/carousel.esm.min.js +1 -1
  36. package/carousel/carousel.js +6 -6
  37. package/carousel/carousel.min.js +1 -1
  38. package/cascadeselect/CascadeSelect.d.ts +8 -4
  39. package/chart/Chart.vue +9 -2
  40. package/chart/chart.cjs.js +9 -2
  41. package/chart/chart.cjs.min.js +1 -1
  42. package/chart/chart.esm.js +9 -2
  43. package/chart/chart.esm.min.js +1 -1
  44. package/chart/chart.js +9 -2
  45. package/chart/chart.min.js +1 -1
  46. package/colorpicker/ColorPicker.d.ts +3 -0
  47. package/colorpicker/ColorPicker.vue +6 -1
  48. package/colorpicker/colorpicker.cjs.js +6 -1
  49. package/colorpicker/colorpicker.cjs.min.js +1 -1
  50. package/colorpicker/colorpicker.esm.js +6 -1
  51. package/colorpicker/colorpicker.esm.min.js +1 -1
  52. package/colorpicker/colorpicker.js +6 -1
  53. package/colorpicker/colorpicker.min.js +1 -1
  54. package/confirmdialog/ConfirmDialog.vue +8 -2
  55. package/confirmdialog/confirmdialog.cjs.js +11 -4
  56. package/confirmdialog/confirmdialog.cjs.min.js +1 -1
  57. package/confirmdialog/confirmdialog.esm.js +11 -4
  58. package/confirmdialog/confirmdialog.esm.min.js +1 -1
  59. package/confirmdialog/confirmdialog.js +11 -4
  60. package/confirmdialog/confirmdialog.min.js +1 -1
  61. package/confirmpopup/ConfirmPopup.d.ts +7 -0
  62. package/confirmpopup/ConfirmPopup.vue +7 -4
  63. package/confirmpopup/confirmpopup.cjs.js +13 -5
  64. package/confirmpopup/confirmpopup.cjs.min.js +1 -1
  65. package/confirmpopup/confirmpopup.esm.js +14 -6
  66. package/confirmpopup/confirmpopup.esm.min.js +1 -1
  67. package/confirmpopup/confirmpopup.js +13 -5
  68. package/confirmpopup/confirmpopup.min.js +1 -1
  69. package/contextmenu/ContextMenuSub.vue +7 -4
  70. package/contextmenu/contextmenu.cjs.js +7 -4
  71. package/contextmenu/contextmenu.cjs.min.js +1 -1
  72. package/contextmenu/contextmenu.esm.js +7 -4
  73. package/contextmenu/contextmenu.esm.min.js +1 -1
  74. package/contextmenu/contextmenu.js +7 -4
  75. package/contextmenu/contextmenu.min.js +1 -1
  76. package/core/core.js +132 -65
  77. package/core/core.min.js +14 -11
  78. package/datatable/BodyCell.vue +1 -0
  79. package/datatable/ColumnFilter.vue +17 -6
  80. package/datatable/DataTable.d.ts +5 -4
  81. package/datatable/DataTable.vue +34 -21
  82. package/datatable/TableBody.vue +5 -1
  83. package/datatable/TableFooter.vue +15 -1
  84. package/datatable/TableHeader.vue +15 -1
  85. package/datatable/datatable.cjs.js +175 -106
  86. package/datatable/datatable.cjs.min.js +1 -1
  87. package/datatable/datatable.esm.js +175 -106
  88. package/datatable/datatable.esm.min.js +1 -1
  89. package/datatable/datatable.js +175 -106
  90. package/datatable/datatable.min.js +1 -1
  91. package/dataview/DataView.d.ts +2 -2
  92. package/dataview/DataView.vue +8 -8
  93. package/dataview/dataview.cjs.js +12 -12
  94. package/dataview/dataview.cjs.min.js +1 -1
  95. package/dataview/dataview.esm.js +12 -12
  96. package/dataview/dataview.esm.min.js +1 -1
  97. package/dataview/dataview.js +12 -12
  98. package/dataview/dataview.min.js +1 -1
  99. package/dropdown/Dropdown.d.ts +10 -5
  100. package/inputnumber/InputNumber.vue +19 -3
  101. package/inputnumber/inputnumber.cjs.js +19 -3
  102. package/inputnumber/inputnumber.cjs.min.js +1 -1
  103. package/inputnumber/inputnumber.esm.js +19 -3
  104. package/inputnumber/inputnumber.esm.min.js +1 -1
  105. package/inputnumber/inputnumber.js +19 -3
  106. package/inputnumber/inputnumber.min.js +1 -1
  107. package/inputtext/InputText.vue +1 -1
  108. package/inputtext/inputtext.cjs.js +2 -2
  109. package/inputtext/inputtext.cjs.min.js +1 -1
  110. package/inputtext/inputtext.esm.js +3 -3
  111. package/inputtext/inputtext.esm.min.js +1 -1
  112. package/inputtext/inputtext.js +2 -2
  113. package/inputtext/inputtext.min.js +1 -1
  114. package/listbox/Listbox.d.ts +10 -5
  115. package/megamenu/MegaMenu.vue +10 -7
  116. package/megamenu/megamenu.cjs.js +10 -7
  117. package/megamenu/megamenu.cjs.min.js +1 -1
  118. package/megamenu/megamenu.esm.js +10 -7
  119. package/megamenu/megamenu.esm.min.js +1 -1
  120. package/megamenu/megamenu.js +10 -7
  121. package/megamenu/megamenu.min.js +1 -1
  122. package/menu/Menu.vue +6 -3
  123. package/menu/Menuitem.vue +5 -2
  124. package/menu/menu.cjs.js +11 -5
  125. package/menu/menu.cjs.min.js +1 -1
  126. package/menu/menu.esm.js +11 -5
  127. package/menu/menu.esm.min.js +1 -1
  128. package/menu/menu.js +11 -5
  129. package/menu/menu.min.js +1 -1
  130. package/menubar/MenubarSub.vue +7 -4
  131. package/menubar/menubar.cjs.js +7 -4
  132. package/menubar/menubar.cjs.min.js +1 -1
  133. package/menubar/menubar.esm.js +7 -4
  134. package/menubar/menubar.esm.min.js +1 -1
  135. package/menubar/menubar.js +7 -4
  136. package/menubar/menubar.min.js +1 -1
  137. package/message/Message.d.ts +1 -0
  138. package/message/Message.vue +6 -2
  139. package/message/message.cjs.js +6 -2
  140. package/message/message.cjs.min.js +1 -1
  141. package/message/message.esm.js +6 -2
  142. package/message/message.esm.min.js +1 -1
  143. package/message/message.js +6 -2
  144. package/message/message.min.js +1 -1
  145. package/multiselect/MultiSelect.d.ts +10 -5
  146. package/orderlist/OrderList.d.ts +2 -0
  147. package/orderlist/OrderList.vue +2 -0
  148. package/orderlist/orderlist.cjs.js +3 -1
  149. package/orderlist/orderlist.cjs.min.js +1 -1
  150. package/orderlist/orderlist.esm.js +3 -1
  151. package/orderlist/orderlist.esm.min.js +1 -1
  152. package/orderlist/orderlist.js +3 -1
  153. package/orderlist/orderlist.min.js +1 -1
  154. package/package.json +5 -1
  155. package/paginator/Paginator.vue +4 -4
  156. package/paginator/paginator.cjs.js +4 -4
  157. package/paginator/paginator.cjs.min.js +1 -1
  158. package/paginator/paginator.esm.js +4 -4
  159. package/paginator/paginator.esm.min.js +1 -1
  160. package/paginator/paginator.js +4 -4
  161. package/paginator/paginator.min.js +1 -1
  162. package/panel/Panel.d.ts +1 -0
  163. package/panel/Panel.vue +1 -1
  164. package/panelmenu/PanelMenu.vue +6 -3
  165. package/panelmenu/PanelMenuSub.vue +8 -5
  166. package/panelmenu/panelmenu.cjs.js +14 -8
  167. package/panelmenu/panelmenu.cjs.min.js +1 -1
  168. package/panelmenu/panelmenu.esm.js +14 -8
  169. package/panelmenu/panelmenu.esm.min.js +1 -1
  170. package/panelmenu/panelmenu.js +14 -8
  171. package/panelmenu/panelmenu.min.js +1 -1
  172. package/picklist/PickList.d.ts +8 -2
  173. package/picklist/PickList.vue +10 -4
  174. package/picklist/picklist.cjs.js +13 -7
  175. package/picklist/picklist.cjs.min.js +1 -1
  176. package/picklist/picklist.esm.js +13 -7
  177. package/picklist/picklist.esm.min.js +1 -1
  178. package/picklist/picklist.js +13 -7
  179. package/picklist/picklist.min.js +1 -1
  180. package/progressbar/ProgressBar.vue +13 -12
  181. package/progressbar/progressbar.cjs.js +13 -12
  182. package/progressbar/progressbar.cjs.min.js +1 -1
  183. package/progressbar/progressbar.esm.js +14 -13
  184. package/progressbar/progressbar.esm.min.js +1 -1
  185. package/progressbar/progressbar.js +13 -12
  186. package/progressbar/progressbar.min.js +1 -1
  187. package/rating/Rating.vue +1 -1
  188. package/rating/rating.cjs.js +1 -1
  189. package/rating/rating.cjs.min.js +1 -1
  190. package/rating/rating.esm.js +1 -1
  191. package/rating/rating.esm.min.js +1 -1
  192. package/rating/rating.js +1 -1
  193. package/rating/rating.min.js +1 -1
  194. package/resources/primevue.css +5 -0
  195. package/resources/primevue.min.css +1 -1
  196. package/resources/themes/arya-blue/theme.css +56 -15
  197. package/resources/themes/arya-green/theme.css +56 -15
  198. package/resources/themes/arya-orange/theme.css +56 -15
  199. package/resources/themes/arya-purple/theme.css +56 -15
  200. package/resources/themes/bootstrap4-dark-blue/theme.css +53 -19
  201. package/resources/themes/bootstrap4-dark-purple/theme.css +53 -19
  202. package/resources/themes/bootstrap4-light-blue/theme.css +53 -19
  203. package/resources/themes/bootstrap4-light-purple/theme.css +53 -19
  204. package/resources/themes/fluent-light/theme.css +56 -15
  205. package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff +0 -0
  206. package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff2 +0 -0
  207. package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff +0 -0
  208. package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff2 +0 -0
  209. package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff +0 -0
  210. package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff2 +0 -0
  211. package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff +0 -0
  212. package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff2 +0 -0
  213. package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff +0 -0
  214. package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff2 +0 -0
  215. package/resources/themes/lara-dark-blue/theme.css +5414 -0
  216. package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff +0 -0
  217. package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff2 +0 -0
  218. package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff +0 -0
  219. package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff2 +0 -0
  220. package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff +0 -0
  221. package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff2 +0 -0
  222. package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff +0 -0
  223. package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff2 +0 -0
  224. package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff +0 -0
  225. package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff2 +0 -0
  226. package/resources/themes/lara-dark-indigo/theme.css +5414 -0
  227. package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff +0 -0
  228. package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff2 +0 -0
  229. package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff +0 -0
  230. package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff2 +0 -0
  231. package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff +0 -0
  232. package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff2 +0 -0
  233. package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff +0 -0
  234. package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff2 +0 -0
  235. package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff +0 -0
  236. package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff2 +0 -0
  237. package/resources/themes/lara-dark-purple/theme.css +5414 -0
  238. package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff +0 -0
  239. package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff2 +0 -0
  240. package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff +0 -0
  241. package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff2 +0 -0
  242. package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff +0 -0
  243. package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff2 +0 -0
  244. package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff +0 -0
  245. package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff2 +0 -0
  246. package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff +0 -0
  247. package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff2 +0 -0
  248. package/resources/themes/lara-dark-teal/theme.css +5414 -0
  249. package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff +0 -0
  250. package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff2 +0 -0
  251. package/resources/themes/lara-light-blue/fonts/Inter-Light.woff +0 -0
  252. package/resources/themes/lara-light-blue/fonts/Inter-Light.woff2 +0 -0
  253. package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff +0 -0
  254. package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff2 +0 -0
  255. package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff +0 -0
  256. package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff2 +0 -0
  257. package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff +0 -0
  258. package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff2 +0 -0
  259. package/resources/themes/lara-light-blue/theme.css +5414 -0
  260. package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff +0 -0
  261. package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff2 +0 -0
  262. package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff +0 -0
  263. package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff2 +0 -0
  264. package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff +0 -0
  265. package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff2 +0 -0
  266. package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff +0 -0
  267. package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff2 +0 -0
  268. package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff +0 -0
  269. package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff2 +0 -0
  270. package/resources/themes/lara-light-indigo/theme.css +5414 -0
  271. package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff +0 -0
  272. package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff2 +0 -0
  273. package/resources/themes/lara-light-purple/fonts/Inter-Light.woff +0 -0
  274. package/resources/themes/lara-light-purple/fonts/Inter-Light.woff2 +0 -0
  275. package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff +0 -0
  276. package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff2 +0 -0
  277. package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff +0 -0
  278. package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff2 +0 -0
  279. package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff +0 -0
  280. package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff2 +0 -0
  281. package/resources/themes/lara-light-purple/theme.css +5414 -0
  282. package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff +0 -0
  283. package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff2 +0 -0
  284. package/resources/themes/lara-light-teal/fonts/Inter-Light.woff +0 -0
  285. package/resources/themes/lara-light-teal/fonts/Inter-Light.woff2 +0 -0
  286. package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff +0 -0
  287. package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff2 +0 -0
  288. package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff +0 -0
  289. package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff2 +0 -0
  290. package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff +0 -0
  291. package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff2 +0 -0
  292. package/resources/themes/lara-light-teal/theme.css +5414 -0
  293. package/resources/themes/luna-amber/theme.css +53 -19
  294. package/resources/themes/luna-blue/theme.css +53 -19
  295. package/resources/themes/luna-green/theme.css +53 -19
  296. package/resources/themes/luna-pink/theme.css +53 -19
  297. package/resources/themes/md-dark-deeppurple/theme.css +244 -47
  298. package/resources/themes/md-dark-indigo/theme.css +244 -47
  299. package/resources/themes/md-light-deeppurple/theme.css +244 -47
  300. package/resources/themes/md-light-indigo/theme.css +244 -47
  301. package/resources/themes/mdc-dark-deeppurple/theme.css +244 -47
  302. package/resources/themes/mdc-dark-indigo/theme.css +244 -47
  303. package/resources/themes/mdc-light-deeppurple/theme.css +244 -47
  304. package/resources/themes/mdc-light-indigo/theme.css +244 -47
  305. package/resources/themes/nova/theme.css +53 -19
  306. package/resources/themes/nova-accent/theme.css +53 -19
  307. package/resources/themes/nova-alt/theme.css +53 -19
  308. package/resources/themes/nova-vue/theme.css +53 -19
  309. package/resources/themes/rhea/theme.css +53 -19
  310. package/resources/themes/saga-blue/theme.css +56 -15
  311. package/resources/themes/saga-green/theme.css +56 -15
  312. package/resources/themes/saga-orange/theme.css +56 -15
  313. package/resources/themes/saga-purple/theme.css +56 -15
  314. package/resources/themes/tailwind-light/theme.css +67 -18
  315. package/resources/themes/vela-blue/theme.css +56 -15
  316. package/resources/themes/vela-green/theme.css +56 -15
  317. package/resources/themes/vela-orange/theme.css +56 -15
  318. package/resources/themes/vela-purple/theme.css +56 -15
  319. package/selectbutton/SelectButton.d.ts +8 -3
  320. package/selectbutton/SelectButton.vue +8 -2
  321. package/selectbutton/selectbutton.cjs.js +14 -9
  322. package/selectbutton/selectbutton.cjs.min.js +1 -1
  323. package/selectbutton/selectbutton.esm.js +14 -9
  324. package/selectbutton/selectbutton.esm.min.js +1 -1
  325. package/selectbutton/selectbutton.js +14 -9
  326. package/selectbutton/selectbutton.min.js +1 -1
  327. package/steps/Steps.vue +5 -2
  328. package/steps/steps.cjs.js +5 -2
  329. package/steps/steps.cjs.min.js +1 -1
  330. package/steps/steps.esm.js +5 -2
  331. package/steps/steps.esm.min.js +1 -1
  332. package/steps/steps.js +5 -2
  333. package/steps/steps.min.js +1 -1
  334. package/tabmenu/TabMenu.vue +6 -3
  335. package/tabmenu/tabmenu.cjs.js +6 -3
  336. package/tabmenu/tabmenu.cjs.min.js +1 -1
  337. package/tabmenu/tabmenu.esm.js +6 -3
  338. package/tabmenu/tabmenu.esm.min.js +1 -1
  339. package/tabmenu/tabmenu.js +6 -3
  340. package/tabmenu/tabmenu.min.js +1 -1
  341. package/terminalservice/TerminalService.d.ts +9 -6
  342. package/tieredmenu/TieredMenuSub.vue +7 -4
  343. package/tieredmenu/tieredmenu.cjs.js +7 -4
  344. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  345. package/tieredmenu/tieredmenu.esm.js +7 -4
  346. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  347. package/tieredmenu/tieredmenu.js +7 -4
  348. package/tieredmenu/tieredmenu.min.js +1 -1
  349. package/tree/TreeNode.vue +4 -1
  350. package/tree/tree.cjs.js +4 -1
  351. package/tree/tree.cjs.min.js +1 -1
  352. package/tree/tree.esm.js +4 -1
  353. package/tree/tree.esm.min.js +1 -1
  354. package/tree/tree.js +4 -1
  355. package/tree/tree.min.js +1 -1
  356. package/treeselect/TreeSelect.vue +9 -0
  357. package/treeselect/treeselect.cjs.js +9 -0
  358. package/treeselect/treeselect.cjs.min.js +1 -1
  359. package/treeselect/treeselect.esm.js +9 -0
  360. package/treeselect/treeselect.esm.min.js +1 -1
  361. package/treeselect/treeselect.js +9 -0
  362. package/treeselect/treeselect.min.js +1 -1
  363. package/treetable/TreeTable.d.ts +2 -2
  364. package/treetable/TreeTable.vue +8 -8
  365. package/treetable/treetable.cjs.js +12 -12
  366. package/treetable/treetable.cjs.min.js +1 -1
  367. package/treetable/treetable.esm.js +12 -12
  368. package/treetable/treetable.esm.min.js +1 -1
  369. package/treetable/treetable.js +12 -12
  370. package/treetable/treetable.min.js +1 -1
  371. package/vetur-attributes.json +8 -0
  372. package/vetur-tags.json +3 -1
  373. package/web-types.json +143 -9
@@ -204,6 +204,9 @@ var script$1 = {
204
204
  },
205
205
  disabled(item) {
206
206
  return (typeof item.disabled === 'function' ? item.disabled() : item.disabled);
207
+ },
208
+ label(item) {
209
+ return (typeof item.label === 'function' ? item.label() : item.label);
207
210
  }
208
211
  },
209
212
  computed: {
@@ -236,7 +239,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
236
239
  }, [
237
240
  (openBlock(true), createBlock(Fragment, null, renderList($props.model, (item, i) => {
238
241
  return (openBlock(), createBlock(Fragment, {
239
- key: item.label + i.toString()
242
+ key: $options.label(item) + i.toString()
240
243
  }, [
241
244
  ($options.visible(item) && !item.separator)
242
245
  ? (openBlock(), createBlock("li", {
@@ -265,7 +268,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
265
268
  createVNode("span", {
266
269
  class: ['p-menuitem-icon', item.icon]
267
270
  }, null, 2),
268
- createVNode("span", _hoisted_1, toDisplayString(item.label), 1)
271
+ createVNode("span", _hoisted_1, toDisplayString($options.label(item)), 1)
269
272
  ], 42, ["href", "onClick", "onKeydown"]), [
270
273
  [_directive_ripple]
271
274
  ])
@@ -287,7 +290,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
287
290
  createVNode("span", {
288
291
  class: ['p-menuitem-icon', item.icon]
289
292
  }, null, 2),
290
- createVNode("span", _hoisted_2, toDisplayString(item.label), 1),
293
+ createVNode("span", _hoisted_2, toDisplayString($options.label(item)), 1),
291
294
  (item.items)
292
295
  ? (openBlock(), createBlock("span", _hoisted_3))
293
296
  : createCommentVNode("", true)
@@ -302,7 +305,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
302
305
  ($options.visible(item) && item.items)
303
306
  ? (openBlock(), createBlock(_component_TieredMenuSub, {
304
307
  model: item.items,
305
- key: item.label + '_sub_',
308
+ key: $options.label(item) + '_sub_',
306
309
  template: $props.template,
307
310
  onLeafClick: $options.onLeafClick,
308
311
  onKeydownItem: $options.onChildItemKeyDown,
@@ -1 +1 @@
1
- import{DomHandler as e,ZIndexUtils as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import s from"primevue/ripple";import{resolveComponent as l,resolveDirective as r,openBlock as a,createBlock as o,Fragment as c,renderList as d,withCtx as u,withDirectives as m,createVNode as p,toDisplayString as h,createCommentVNode as v,resolveDynamicComponent as b,Teleport as f,Transition as k,mergeProps as y}from"vue";var C={name:"TieredMenuSub",emits:["leaf-click","keydown-item"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,i){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&i&&i(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let i=e.currentTarget.parentElement;switch(e.which){case 40:var n=this.findNextItem(i);n&&n.children[0].focus(),e.preventDefault();break;case 38:var s=this.findPrevItem(i);s&&s.children[0].focus(),e.preventDefault();break;case 39:t.items&&(this.activeItem=t,setTimeout((()=>{i.children[1].children[0].children[0].focus()}),50)),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:i})},onChildItemKeyDown(e){37===e.originalEvent.which&&(this.activeItem=null,e.element.parentElement.previousElementSibling.focus())},findNextItem(t){let i=t.nextElementSibling;return i?e.hasClass(i,"p-disabled")||!e.hasClass(i,"p-menuitem")?this.findNextItem(i):i:null},findPrevItem(t){let i=t.previousElementSibling;return i?e.hasClass(i,"p-disabled")||!e.hasClass(i,"p-menuitem")?this.findPrevItem(i):i:null},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled},computed:{containerClass(){return{"p-submenu-list":!this.root}}},directives:{ripple:s}};const L={class:"p-menuitem-text"},g={class:"p-menuitem-text"},x={key:0,class:"p-submenu-icon pi pi-angle-right"};C.render=function(e,t,i,n,s,f){const k=l("router-link"),y=l("TieredMenuSub",!0),C=r("ripple");return a(),o("ul",{ref:"element",class:f.containerClass,role:"'menubar' : 'menu'","aria-orientation":"horizontal"},[(a(!0),o(c,null,d(i.model,((e,t)=>(a(),o(c,{key:e.label+t.toString()},[f.visible(e)&&!e.separator?(a(),o("li",{key:0,class:f.getItemClass(e),style:e.style,onMouseenter:t=>f.onItemMouseEnter(t,e),role:"none"},[i.template?(a(),o(b(i.template),{key:1,item:e},null,8,["item"])):(a(),o(c,{key:0},[e.to&&!f.disabled(e)?(a(),o(k,{key:0,to:e.to,custom:""},{default:u((({navigate:t,href:i,isActive:n,isExactActive:s})=>[m(p("a",{href:i,onClick:i=>f.onItemClick(i,e,t),class:f.linkClass(e,{isActive:n,isExactActive:s}),onKeydown:t=>f.onItemKeyDown(t,e),role:"menuitem"},[p("span",{class:["p-menuitem-icon",e.icon]},null,2),p("span",L,h(e.label),1)],42,["href","onClick","onKeydown"]),[[C]])])),_:2},1032,["to"])):m((a(),o("a",{key:1,href:e.url,class:f.linkClass(e),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===s.activeItem,onClick:t=>f.onItemClick(t,e),onKeydown:t=>f.onItemKeyDown(t,e),role:"menuitem",tabindex:f.disabled(e)?null:"0"},[p("span",{class:["p-menuitem-icon",e.icon]},null,2),p("span",g,h(e.label),1),e.items?(a(),o("span",x)):v("",!0)],42,["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"])),[[C]])],64)),f.visible(e)&&e.items?(a(),o(y,{model:e.items,key:e.label+"_sub_",template:i.template,onLeafClick:f.onLeafClick,onKeydownItem:f.onChildItemKeyDown,parentActive:e===s.activeItem,exact:i.exact},null,8,["model","template","onLeafClick","onKeydownItem","parentActive","exact"])):v("",!0)],46,["onMouseenter"])):v("",!0),f.visible(e)&&e.separator?(a(),o("li",{class:["p-menu-separator",e.class],style:e.style,key:"separator"+t.toString(),role:"separator"},null,6)):v("",!0)],64)))),128))],2)};var I={name:"TieredMenu",inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},target:null,container:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,data:()=>({visible:!1}),beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&t.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;t.command&&(t.command(e),e.originalEvent.preventDefault()),this.hide()},toggle(e){this.visible?this.hide():this.show(e)},show(e){this.visible=!0,this.target=e.currentTarget},hide(){this.visible=!1},onEnter(e){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&t.set("menu",e,this.baseZIndex+this.$primevue.config.zIndex.menu)},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener()},onAfterLeave(e){this.autoZIndex&&t.clear(e)},alignOverlay(){e.absolutePosition(this.container,this.target),this.container.style.minWidth=e.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new i(this.target,(()=>{this.visible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(){return this.target&&(this.target===event.target||this.target.contains(event.target))},onLeafClick(){this.popup&&this.hide()},containerRef(e){this.container=e},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-tieredmenu p-component",{"p-tieredmenu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{TieredMenuSub:C}};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-tieredmenu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-tieredmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-tieredmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n display: none;\n}\n.p-tieredmenu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-tieredmenu .p-menuitem-text {\n line-height: 1;\n}\n.p-tieredmenu .p-menuitem {\n position: relative;\n}\n.p-tieredmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-tieredmenu .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n"),I.render=function(e,t,i,n,s,r){const c=l("TieredMenuSub");return a(),o(f,{to:i.appendTo,disabled:!i.popup},[p(k,{name:"p-connected-overlay",onEnter:r.onEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},{default:u((()=>[!i.popup||s.visible?(a(),o("div",y({key:0,ref:r.containerRef,class:r.containerClass},e.$attrs,{onClick:t[1]||(t[1]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))}),[p(c,{model:i.model,root:!0,popup:i.popup,onLeafClick:r.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","popup","onLeafClick","template","exact"])],16)):v("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"])};export default I;
1
+ import{DomHandler as e,ZIndexUtils as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import l from"primevue/ripple";import{resolveComponent as s,resolveDirective as r,openBlock as a,createBlock as o,Fragment as c,renderList as d,withCtx as u,withDirectives as m,createVNode as p,toDisplayString as h,createCommentVNode as v,resolveDynamicComponent as b,Teleport as f,Transition as k,mergeProps as y}from"vue";var C={name:"TieredMenuSub",emits:["leaf-click","keydown-item"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,i){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&i&&i(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let i=e.currentTarget.parentElement;switch(e.which){case 40:var n=this.findNextItem(i);n&&n.children[0].focus(),e.preventDefault();break;case 38:var l=this.findPrevItem(i);l&&l.children[0].focus(),e.preventDefault();break;case 39:t.items&&(this.activeItem=t,setTimeout((()=>{i.children[1].children[0].children[0].focus()}),50)),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:i})},onChildItemKeyDown(e){37===e.originalEvent.which&&(this.activeItem=null,e.element.parentElement.previousElementSibling.focus())},findNextItem(t){let i=t.nextElementSibling;return i?e.hasClass(i,"p-disabled")||!e.hasClass(i,"p-menuitem")?this.findNextItem(i):i:null},findPrevItem(t){let i=t.previousElementSibling;return i?e.hasClass(i,"p-disabled")||!e.hasClass(i,"p-menuitem")?this.findPrevItem(i):i:null},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label},computed:{containerClass(){return{"p-submenu-list":!this.root}}},directives:{ripple:l}};const L={class:"p-menuitem-text"},g={class:"p-menuitem-text"},x={key:0,class:"p-submenu-icon pi pi-angle-right"};C.render=function(e,t,i,n,l,f){const k=s("router-link"),y=s("TieredMenuSub",!0),C=r("ripple");return a(),o("ul",{ref:"element",class:f.containerClass,role:"'menubar' : 'menu'","aria-orientation":"horizontal"},[(a(!0),o(c,null,d(i.model,((e,t)=>(a(),o(c,{key:f.label(e)+t.toString()},[f.visible(e)&&!e.separator?(a(),o("li",{key:0,class:f.getItemClass(e),style:e.style,onMouseenter:t=>f.onItemMouseEnter(t,e),role:"none"},[i.template?(a(),o(b(i.template),{key:1,item:e},null,8,["item"])):(a(),o(c,{key:0},[e.to&&!f.disabled(e)?(a(),o(k,{key:0,to:e.to,custom:""},{default:u((({navigate:t,href:i,isActive:n,isExactActive:l})=>[m(p("a",{href:i,onClick:i=>f.onItemClick(i,e,t),class:f.linkClass(e,{isActive:n,isExactActive:l}),onKeydown:t=>f.onItemKeyDown(t,e),role:"menuitem"},[p("span",{class:["p-menuitem-icon",e.icon]},null,2),p("span",L,h(f.label(e)),1)],42,["href","onClick","onKeydown"]),[[C]])])),_:2},1032,["to"])):m((a(),o("a",{key:1,href:e.url,class:f.linkClass(e),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===l.activeItem,onClick:t=>f.onItemClick(t,e),onKeydown:t=>f.onItemKeyDown(t,e),role:"menuitem",tabindex:f.disabled(e)?null:"0"},[p("span",{class:["p-menuitem-icon",e.icon]},null,2),p("span",g,h(f.label(e)),1),e.items?(a(),o("span",x)):v("",!0)],42,["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"])),[[C]])],64)),f.visible(e)&&e.items?(a(),o(y,{model:e.items,key:f.label(e)+"_sub_",template:i.template,onLeafClick:f.onLeafClick,onKeydownItem:f.onChildItemKeyDown,parentActive:e===l.activeItem,exact:i.exact},null,8,["model","template","onLeafClick","onKeydownItem","parentActive","exact"])):v("",!0)],46,["onMouseenter"])):v("",!0),f.visible(e)&&e.separator?(a(),o("li",{class:["p-menu-separator",e.class],style:e.style,key:"separator"+t.toString(),role:"separator"},null,6)):v("",!0)],64)))),128))],2)};var I={name:"TieredMenu",inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},target:null,container:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,data:()=>({visible:!1}),beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&t.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;t.command&&(t.command(e),e.originalEvent.preventDefault()),this.hide()},toggle(e){this.visible?this.hide():this.show(e)},show(e){this.visible=!0,this.target=e.currentTarget},hide(){this.visible=!1},onEnter(e){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&t.set("menu",e,this.baseZIndex+this.$primevue.config.zIndex.menu)},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener()},onAfterLeave(e){this.autoZIndex&&t.clear(e)},alignOverlay(){e.absolutePosition(this.container,this.target),this.container.style.minWidth=e.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new i(this.target,(()=>{this.visible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(){return this.target&&(this.target===event.target||this.target.contains(event.target))},onLeafClick(){this.popup&&this.hide()},containerRef(e){this.container=e},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-tieredmenu p-component",{"p-tieredmenu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{TieredMenuSub:C}};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-tieredmenu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-tieredmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-tieredmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n display: none;\n}\n.p-tieredmenu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-tieredmenu .p-menuitem-text {\n line-height: 1;\n}\n.p-tieredmenu .p-menuitem {\n position: relative;\n}\n.p-tieredmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-tieredmenu .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n"),I.render=function(e,t,i,n,l,r){const c=s("TieredMenuSub");return a(),o(f,{to:i.appendTo,disabled:!i.popup},[p(k,{name:"p-connected-overlay",onEnter:r.onEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},{default:u((()=>[!i.popup||l.visible?(a(),o("div",y({key:0,ref:r.containerRef,class:r.containerClass},e.$attrs,{onClick:t[1]||(t[1]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))}),[p(c,{model:i.model,root:!0,popup:i.popup,onLeafClick:r.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","popup","onLeafClick","template","exact"])],16)):v("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"])};export default I;
@@ -208,6 +208,9 @@ this.primevue.tieredmenu = (function (utils, OverlayEventBus, Ripple, vue) {
208
208
  },
209
209
  disabled(item) {
210
210
  return (typeof item.disabled === 'function' ? item.disabled() : item.disabled);
211
+ },
212
+ label(item) {
213
+ return (typeof item.label === 'function' ? item.label() : item.label);
211
214
  }
212
215
  },
213
216
  computed: {
@@ -240,7 +243,7 @@ this.primevue.tieredmenu = (function (utils, OverlayEventBus, Ripple, vue) {
240
243
  }, [
241
244
  (vue.openBlock(true), vue.createBlock(vue.Fragment, null, vue.renderList($props.model, (item, i) => {
242
245
  return (vue.openBlock(), vue.createBlock(vue.Fragment, {
243
- key: item.label + i.toString()
246
+ key: $options.label(item) + i.toString()
244
247
  }, [
245
248
  ($options.visible(item) && !item.separator)
246
249
  ? (vue.openBlock(), vue.createBlock("li", {
@@ -269,7 +272,7 @@ this.primevue.tieredmenu = (function (utils, OverlayEventBus, Ripple, vue) {
269
272
  vue.createVNode("span", {
270
273
  class: ['p-menuitem-icon', item.icon]
271
274
  }, null, 2),
272
- vue.createVNode("span", _hoisted_1, vue.toDisplayString(item.label), 1)
275
+ vue.createVNode("span", _hoisted_1, vue.toDisplayString($options.label(item)), 1)
273
276
  ], 42, ["href", "onClick", "onKeydown"]), [
274
277
  [_directive_ripple]
275
278
  ])
@@ -291,7 +294,7 @@ this.primevue.tieredmenu = (function (utils, OverlayEventBus, Ripple, vue) {
291
294
  vue.createVNode("span", {
292
295
  class: ['p-menuitem-icon', item.icon]
293
296
  }, null, 2),
294
- vue.createVNode("span", _hoisted_2, vue.toDisplayString(item.label), 1),
297
+ vue.createVNode("span", _hoisted_2, vue.toDisplayString($options.label(item)), 1),
295
298
  (item.items)
296
299
  ? (vue.openBlock(), vue.createBlock("span", _hoisted_3))
297
300
  : vue.createCommentVNode("", true)
@@ -306,7 +309,7 @@ this.primevue.tieredmenu = (function (utils, OverlayEventBus, Ripple, vue) {
306
309
  ($options.visible(item) && item.items)
307
310
  ? (vue.openBlock(), vue.createBlock(_component_TieredMenuSub, {
308
311
  model: item.items,
309
- key: item.label + '_sub_',
312
+ key: $options.label(item) + '_sub_',
310
313
  template: $props.template,
311
314
  onLeafClick: $options.onLeafClick,
312
315
  onKeydownItem: $options.onChildItemKeyDown,
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.tieredmenu=function(e,t,i,n){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t),o={name:"TieredMenuSub",emits:["leaf-click","keydown-item"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,i){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&i&&i(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let i=e.currentTarget.parentElement;switch(e.which){case 40:var n=this.findNextItem(i);n&&n.children[0].focus(),e.preventDefault();break;case 38:var l=this.findPrevItem(i);l&&l.children[0].focus(),e.preventDefault();break;case 39:t.items&&(this.activeItem=t,setTimeout((()=>{i.children[1].children[0].children[0].focus()}),50)),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:i})},onChildItemKeyDown(e){37===e.originalEvent.which&&(this.activeItem=null,e.element.parentElement.previousElementSibling.focus())},findNextItem(t){let i=t.nextElementSibling;return i?e.DomHandler.hasClass(i,"p-disabled")||!e.DomHandler.hasClass(i,"p-menuitem")?this.findNextItem(i):i:null},findPrevItem(t){let i=t.previousElementSibling;return i?e.DomHandler.hasClass(i,"p-disabled")||!e.DomHandler.hasClass(i,"p-menuitem")?this.findPrevItem(i):i:null},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled},computed:{containerClass(){return{"p-submenu-list":!this.root}}},directives:{ripple:l(i).default}};const r={class:"p-menuitem-text"},a={class:"p-menuitem-text"},c={key:0,class:"p-submenu-icon pi pi-angle-right"};o.render=function(e,t,i,l,s,o){const d=n.resolveComponent("router-link"),u=n.resolveComponent("TieredMenuSub",!0),m=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("ul",{ref:"element",class:o.containerClass,role:"'menubar' : 'menu'","aria-orientation":"horizontal"},[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(i.model,((e,t)=>(n.openBlock(),n.createBlock(n.Fragment,{key:e.label+t.toString()},[o.visible(e)&&!e.separator?(n.openBlock(),n.createBlock("li",{key:0,class:o.getItemClass(e),style:e.style,onMouseenter:t=>o.onItemMouseEnter(t,e),role:"none"},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:e},null,8,["item"])):(n.openBlock(),n.createBlock(n.Fragment,{key:0},[e.to&&!o.disabled(e)?(n.openBlock(),n.createBlock(d,{key:0,to:e.to,custom:""},{default:n.withCtx((({navigate:t,href:i,isActive:l,isExactActive:s})=>[n.withDirectives(n.createVNode("a",{href:i,onClick:i=>o.onItemClick(i,e,t),class:o.linkClass(e,{isActive:l,isExactActive:s}),onKeydown:t=>o.onItemKeyDown(t,e),role:"menuitem"},[n.createVNode("span",{class:["p-menuitem-icon",e.icon]},null,2),n.createVNode("span",r,n.toDisplayString(e.label),1)],42,["href","onClick","onKeydown"]),[[m]])])),_:2},1032,["to"])):n.withDirectives((n.openBlock(),n.createBlock("a",{key:1,href:e.url,class:o.linkClass(e),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===s.activeItem,onClick:t=>o.onItemClick(t,e),onKeydown:t=>o.onItemKeyDown(t,e),role:"menuitem",tabindex:o.disabled(e)?null:"0"},[n.createVNode("span",{class:["p-menuitem-icon",e.icon]},null,2),n.createVNode("span",a,n.toDisplayString(e.label),1),e.items?(n.openBlock(),n.createBlock("span",c)):n.createCommentVNode("",!0)],42,["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"])),[[m]])],64)),o.visible(e)&&e.items?(n.openBlock(),n.createBlock(u,{model:e.items,key:e.label+"_sub_",template:i.template,onLeafClick:o.onLeafClick,onKeydownItem:o.onChildItemKeyDown,parentActive:e===s.activeItem,exact:i.exact},null,8,["model","template","onLeafClick","onKeydownItem","parentActive","exact"])):n.createCommentVNode("",!0)],46,["onMouseenter"])):n.createCommentVNode("",!0),o.visible(e)&&e.separator?(n.openBlock(),n.createBlock("li",{class:["p-menu-separator",e.class],style:e.style,key:"separator"+t.toString(),role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],2)};var d={name:"TieredMenu",inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},target:null,container:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,data:()=>({visible:!1}),beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&e.ZIndexUtils.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;t.command&&(t.command(e),e.originalEvent.preventDefault()),this.hide()},toggle(e){this.visible?this.hide():this.show(e)},show(e){this.visible=!0,this.target=e.currentTarget},hide(){this.visible=!1},onEnter(t){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&e.ZIndexUtils.set("menu",t,this.baseZIndex+this.$primevue.config.zIndex.menu)},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener()},onAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){e.DomHandler.absolutePosition(this.container,this.target),this.container.style.minWidth=e.DomHandler.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.target,(()=>{this.visible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(){return this.target&&(this.target===event.target||this.target.contains(event.target))},onLeafClick(){this.popup&&this.hide()},containerRef(e){this.container=e},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-tieredmenu p-component",{"p-tieredmenu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{TieredMenuSub:o}};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-tieredmenu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-tieredmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-tieredmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n display: none;\n}\n.p-tieredmenu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-tieredmenu .p-menuitem-text {\n line-height: 1;\n}\n.p-tieredmenu .p-menuitem {\n position: relative;\n}\n.p-tieredmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-tieredmenu .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n"),d.render=function(e,t,i,l,s,o){const r=n.resolveComponent("TieredMenuSub");return n.openBlock(),n.createBlock(n.Teleport,{to:i.appendTo,disabled:!i.popup},[n.createVNode(n.Transition,{name:"p-connected-overlay",onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},{default:n.withCtx((()=>[!i.popup||s.visible?(n.openBlock(),n.createBlock("div",n.mergeProps({key:0,ref:o.containerRef,class:o.containerClass},e.$attrs,{onClick:t[1]||(t[1]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))}),[n.createVNode(r,{model:i.model,root:!0,popup:i.popup,onLeafClick:o.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","popup","onLeafClick","template","exact"])],16)):n.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"])},d}(primevue.utils,primevue.overlayeventbus,primevue.ripple,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.tieredmenu=function(e,t,i,n){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t),o={name:"TieredMenuSub",emits:["leaf-click","keydown-item"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,i){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&i&&i(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let i=e.currentTarget.parentElement;switch(e.which){case 40:var n=this.findNextItem(i);n&&n.children[0].focus(),e.preventDefault();break;case 38:var l=this.findPrevItem(i);l&&l.children[0].focus(),e.preventDefault();break;case 39:t.items&&(this.activeItem=t,setTimeout((()=>{i.children[1].children[0].children[0].focus()}),50)),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:i})},onChildItemKeyDown(e){37===e.originalEvent.which&&(this.activeItem=null,e.element.parentElement.previousElementSibling.focus())},findNextItem(t){let i=t.nextElementSibling;return i?e.DomHandler.hasClass(i,"p-disabled")||!e.DomHandler.hasClass(i,"p-menuitem")?this.findNextItem(i):i:null},findPrevItem(t){let i=t.previousElementSibling;return i?e.DomHandler.hasClass(i,"p-disabled")||!e.DomHandler.hasClass(i,"p-menuitem")?this.findPrevItem(i):i:null},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label},computed:{containerClass(){return{"p-submenu-list":!this.root}}},directives:{ripple:l(i).default}};const r={class:"p-menuitem-text"},a={class:"p-menuitem-text"},c={key:0,class:"p-submenu-icon pi pi-angle-right"};o.render=function(e,t,i,l,s,o){const d=n.resolveComponent("router-link"),u=n.resolveComponent("TieredMenuSub",!0),m=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("ul",{ref:"element",class:o.containerClass,role:"'menubar' : 'menu'","aria-orientation":"horizontal"},[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(i.model,((e,t)=>(n.openBlock(),n.createBlock(n.Fragment,{key:o.label(e)+t.toString()},[o.visible(e)&&!e.separator?(n.openBlock(),n.createBlock("li",{key:0,class:o.getItemClass(e),style:e.style,onMouseenter:t=>o.onItemMouseEnter(t,e),role:"none"},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:e},null,8,["item"])):(n.openBlock(),n.createBlock(n.Fragment,{key:0},[e.to&&!o.disabled(e)?(n.openBlock(),n.createBlock(d,{key:0,to:e.to,custom:""},{default:n.withCtx((({navigate:t,href:i,isActive:l,isExactActive:s})=>[n.withDirectives(n.createVNode("a",{href:i,onClick:i=>o.onItemClick(i,e,t),class:o.linkClass(e,{isActive:l,isExactActive:s}),onKeydown:t=>o.onItemKeyDown(t,e),role:"menuitem"},[n.createVNode("span",{class:["p-menuitem-icon",e.icon]},null,2),n.createVNode("span",r,n.toDisplayString(o.label(e)),1)],42,["href","onClick","onKeydown"]),[[m]])])),_:2},1032,["to"])):n.withDirectives((n.openBlock(),n.createBlock("a",{key:1,href:e.url,class:o.linkClass(e),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===s.activeItem,onClick:t=>o.onItemClick(t,e),onKeydown:t=>o.onItemKeyDown(t,e),role:"menuitem",tabindex:o.disabled(e)?null:"0"},[n.createVNode("span",{class:["p-menuitem-icon",e.icon]},null,2),n.createVNode("span",a,n.toDisplayString(o.label(e)),1),e.items?(n.openBlock(),n.createBlock("span",c)):n.createCommentVNode("",!0)],42,["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"])),[[m]])],64)),o.visible(e)&&e.items?(n.openBlock(),n.createBlock(u,{model:e.items,key:o.label(e)+"_sub_",template:i.template,onLeafClick:o.onLeafClick,onKeydownItem:o.onChildItemKeyDown,parentActive:e===s.activeItem,exact:i.exact},null,8,["model","template","onLeafClick","onKeydownItem","parentActive","exact"])):n.createCommentVNode("",!0)],46,["onMouseenter"])):n.createCommentVNode("",!0),o.visible(e)&&e.separator?(n.openBlock(),n.createBlock("li",{class:["p-menu-separator",e.class],style:e.style,key:"separator"+t.toString(),role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],2)};var d={name:"TieredMenu",inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},target:null,container:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,data:()=>({visible:!1}),beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&e.ZIndexUtils.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;t.command&&(t.command(e),e.originalEvent.preventDefault()),this.hide()},toggle(e){this.visible?this.hide():this.show(e)},show(e){this.visible=!0,this.target=e.currentTarget},hide(){this.visible=!1},onEnter(t){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&e.ZIndexUtils.set("menu",t,this.baseZIndex+this.$primevue.config.zIndex.menu)},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener()},onAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){e.DomHandler.absolutePosition(this.container,this.target),this.container.style.minWidth=e.DomHandler.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.target,(()=>{this.visible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(){return this.target&&(this.target===event.target||this.target.contains(event.target))},onLeafClick(){this.popup&&this.hide()},containerRef(e){this.container=e},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-tieredmenu p-component",{"p-tieredmenu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{TieredMenuSub:o}};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-tieredmenu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-tieredmenu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-tieredmenu .p-submenu-list {\n position: absolute;\n min-width: 100%;\n z-index: 1;\n display: none;\n}\n.p-tieredmenu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-tieredmenu .p-menuitem-text {\n line-height: 1;\n}\n.p-tieredmenu .p-menuitem {\n position: relative;\n}\n.p-tieredmenu .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-tieredmenu .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n"),d.render=function(e,t,i,l,s,o){const r=n.resolveComponent("TieredMenuSub");return n.openBlock(),n.createBlock(n.Teleport,{to:i.appendTo,disabled:!i.popup},[n.createVNode(n.Transition,{name:"p-connected-overlay",onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},{default:n.withCtx((()=>[!i.popup||s.visible?(n.openBlock(),n.createBlock("div",n.mergeProps({key:0,ref:o.containerRef,class:o.containerClass},e.$attrs,{onClick:t[1]||(t[1]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))}),[n.createVNode(r,{model:i.model,root:!0,popup:i.popup,onLeafClick:o.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","popup","onLeafClick","template","exact"])],16)):n.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"])},d}(primevue.utils,primevue.overlayeventbus,primevue.ripple,Vue);
package/tree/TreeNode.vue CHANGED
@@ -13,7 +13,7 @@
13
13
  <span :class="icon"></span>
14
14
  <span class="p-treenode-label">
15
15
  <component :is="templates[node.type]||templates['default']" :node="node" v-if="templates[node.type]||templates['default']"/>
16
- <template v-else>{{node.label}}</template>
16
+ <template v-else>{{label(node)}}</template>
17
17
  </span>
18
18
  </div>
19
19
  <ul class="p-treenode-children" role="group" v-if="hasChildren && expanded">
@@ -59,6 +59,9 @@ export default {
59
59
  toggle() {
60
60
  this.$emit('node-toggle', this.node);
61
61
  },
62
+ label(node) {
63
+ return (typeof node.label === 'function' ? node.label() : node.label);
64
+ },
62
65
  onChildNodeToggle(node) {
63
66
  this.$emit('node-toggle', node);
64
67
  },
package/tree/tree.cjs.js CHANGED
@@ -38,6 +38,9 @@ var script$1 = {
38
38
  toggle() {
39
39
  this.$emit('node-toggle', this.node);
40
40
  },
41
+ label(node) {
42
+ return (typeof node.label === 'function' ? node.label() : node.label);
43
+ },
41
44
  onChildNodeToggle(node) {
42
45
  this.$emit('node-toggle', node);
43
46
  },
@@ -326,7 +329,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
326
329
  node: $props.node
327
330
  }, null, 8, ["node"]))
328
331
  : (vue.openBlock(), vue.createBlock(vue.Fragment, { key: 1 }, [
329
- vue.createTextVNode(vue.toDisplayString($props.node.label), 1)
332
+ vue.createTextVNode(vue.toDisplayString($options.label($props.node)), 1)
330
333
  ], 64))
331
334
  ])
332
335
  ], 46, ["aria-expanded"]),
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/utils"),t=require("primevue/ripple"),n=require("vue");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.DomHandler.hasClass(t.target,"p-tree-toggler")||e.DomHandler.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let l of e.children)this.propagateDown(l,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},l=0,o=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?l++:n[e.key]&&n[e.key].partialChecked&&(o=!0);t&&l===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],o||l>0&&l!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.DomHandler.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:l(t).default}};const i={key:0,class:"p-checkbox p-component"},s={class:"p-treenode-label"},c={key:0,class:"p-treenode-children",role:"group"};o.render=function(e,t,l,o,d,r){const a=n.resolveComponent("TreeNode",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("li",{class:r.containerClass},[n.createVNode("div",{class:r.contentClass,tabindex:"0",role:"treeitem","aria-expanded":r.expanded,onClick:t[2]||(t[2]=(...e)=>r.onClick&&r.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>r.onTouchEnd&&r.onTouchEnd(...e)),style:l.node.style},[n.withDirectives(n.createVNode("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>r.toggle&&r.toggle(...e)),tabindex:"-1"},[n.createVNode("span",{class:r.toggleIcon},null,2)],512),[[h]]),r.checkboxMode?(n.openBlock(),n.createBlock("div",i,[n.createVNode("div",{class:r.checkboxClass,role:"checkbox","aria-checked":r.checked},[n.createVNode("span",{class:r.checkboxIcon},null,2)],10,["aria-checked"])])):n.createCommentVNode("",!0),n.createVNode("span",{class:r.icon},null,2),n.createVNode("span",s,[l.templates[l.node.type]||l.templates.default?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.templates[l.node.type]||l.templates.default),{key:0,node:l.node},null,8,["node"])):(n.openBlock(),n.createBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.node.label),1)],64))])],46,["aria-expanded"]),r.hasChildren&&r.expanded?(n.openBlock(),n.createBlock("ul",c,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(l.node.children,(e=>(n.openBlock(),n.createBlock(a,{key:e.key,node:e,templates:l.templates,expandedKeys:l.expandedKeys,onNodeToggle:r.onChildNodeToggle,onNodeClick:r.onChildNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:r.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):n.createCommentVNode("",!0)],2)};var d={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,l=t.metaKey||t.ctrlKey;let o;return this.isNodeSelected(n)&&l?(this.isSingleSelectionMode()?o={}:(o={...this.selectionKeys},delete o[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?o={}:this.isMultipleSelectionMode()&&(o=l&&this.selectionKeys?{...this.selectionKeys}:{}),o[n.key]=!0,this.$emit("node-select",n)),o},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let l;return this.isSingleSelectionMode()?n?(l={},this.$emit("node-unselect",t)):(l={},l[t.key]=!0,this.$emit("node-select",t)):n?(l={...this.selectionKeys},delete l[t.key],this.$emit("node-unselect",t)):(l=this.selectionKeys?{...this.selectionKeys}:{},l[t.key]=!0,this.$emit("node-select",t)),l},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let l=[...e.children];e.children=[];for(let o of l){let l={...o};this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}if(n)return!0}},isFilterMatched(t,{searchFields:n,filterText:l,strict:o}){let i=!1;for(let o of n){String(e.ObjectUtils.resolveFieldData(t,o)).toLocaleLowerCase(this.filterLocale).indexOf(l)>-1&&(i=!0)}return(!i||o&&!this.isNodeLeaf(t))&&(i=this.findFilteredNodes(t,{searchFields:n,filterText:l,strict:o})||i),i}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),l="strict"===this.filterMode;for(let o of this.value){let i={...o},s={searchFields:t,filterText:n,strict:l};(l&&(this.findFilteredNodes(i,s)||this.isFilterMatched(i,s))||!l&&(this.isFilterMatched(i,s)||this.findFilteredNodes(i,s)))&&e.push(i)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:o}};const r={key:0,class:"p-tree-loading-overlay p-component-overlay"},a={key:1,class:"p-tree-filter-container"},h=n.createVNode("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),p={class:"p-tree-container",role:"tree"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&l.firstChild?l.insertBefore(o,l.firstChild):l.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),d.render=function(e,t,l,o,i,s){const c=n.resolveComponent("TreeNode");return n.openBlock(),n.createBlock("div",{class:s.containerClass},[l.loading?(n.openBlock(),n.createBlock("div",r,[n.createVNode("i",{class:s.loadingIconClass},null,2)])):n.createCommentVNode("",!0),l.filter?(n.openBlock(),n.createBlock("div",a,[n.withDirectives(n.createVNode("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:l.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>s.onFilterKeydown&&s.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>i.filterValue=e)},null,40,["placeholder"]),[[n.vModelText,i.filterValue]]),h])):n.createCommentVNode("",!0),n.createVNode("div",{class:"p-tree-wrapper",style:{maxHeight:l.scrollHeight}},[n.createVNode("ul",p,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(s.valueToRender,(t=>(n.openBlock(),n.createBlock(c,{key:t.key,node:t,templates:e.$slots,expandedKeys:i.d_expandedKeys,onNodeToggle:s.onNodeToggle,onNodeClick:s.onNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:s.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)},module.exports=d;
1
+ "use strict";var e=require("primevue/utils"),t=require("primevue/ripple"),n=require("vue");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},label:e=>"function"==typeof e.label?e.label():e.label,onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.DomHandler.hasClass(t.target,"p-tree-toggler")||e.DomHandler.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let l of e.children)this.propagateDown(l,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},l=0,o=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?l++:n[e.key]&&n[e.key].partialChecked&&(o=!0);t&&l===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],o||l>0&&l!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.DomHandler.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:l(t).default}};const i={key:0,class:"p-checkbox p-component"},s={class:"p-treenode-label"},c={key:0,class:"p-treenode-children",role:"group"};o.render=function(e,t,l,o,d,r){const a=n.resolveComponent("TreeNode",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("li",{class:r.containerClass},[n.createVNode("div",{class:r.contentClass,tabindex:"0",role:"treeitem","aria-expanded":r.expanded,onClick:t[2]||(t[2]=(...e)=>r.onClick&&r.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>r.onTouchEnd&&r.onTouchEnd(...e)),style:l.node.style},[n.withDirectives(n.createVNode("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>r.toggle&&r.toggle(...e)),tabindex:"-1"},[n.createVNode("span",{class:r.toggleIcon},null,2)],512),[[h]]),r.checkboxMode?(n.openBlock(),n.createBlock("div",i,[n.createVNode("div",{class:r.checkboxClass,role:"checkbox","aria-checked":r.checked},[n.createVNode("span",{class:r.checkboxIcon},null,2)],10,["aria-checked"])])):n.createCommentVNode("",!0),n.createVNode("span",{class:r.icon},null,2),n.createVNode("span",s,[l.templates[l.node.type]||l.templates.default?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.templates[l.node.type]||l.templates.default),{key:0,node:l.node},null,8,["node"])):(n.openBlock(),n.createBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(r.label(l.node)),1)],64))])],46,["aria-expanded"]),r.hasChildren&&r.expanded?(n.openBlock(),n.createBlock("ul",c,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(l.node.children,(e=>(n.openBlock(),n.createBlock(a,{key:e.key,node:e,templates:l.templates,expandedKeys:l.expandedKeys,onNodeToggle:r.onChildNodeToggle,onNodeClick:r.onChildNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:r.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):n.createCommentVNode("",!0)],2)};var d={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,l=t.metaKey||t.ctrlKey;let o;return this.isNodeSelected(n)&&l?(this.isSingleSelectionMode()?o={}:(o={...this.selectionKeys},delete o[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?o={}:this.isMultipleSelectionMode()&&(o=l&&this.selectionKeys?{...this.selectionKeys}:{}),o[n.key]=!0,this.$emit("node-select",n)),o},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let l;return this.isSingleSelectionMode()?n?(l={},this.$emit("node-unselect",t)):(l={},l[t.key]=!0,this.$emit("node-select",t)):n?(l={...this.selectionKeys},delete l[t.key],this.$emit("node-unselect",t)):(l=this.selectionKeys?{...this.selectionKeys}:{},l[t.key]=!0,this.$emit("node-select",t)),l},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let l=[...e.children];e.children=[];for(let o of l){let l={...o};this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}if(n)return!0}},isFilterMatched(t,{searchFields:n,filterText:l,strict:o}){let i=!1;for(let o of n){String(e.ObjectUtils.resolveFieldData(t,o)).toLocaleLowerCase(this.filterLocale).indexOf(l)>-1&&(i=!0)}return(!i||o&&!this.isNodeLeaf(t))&&(i=this.findFilteredNodes(t,{searchFields:n,filterText:l,strict:o})||i),i}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),l="strict"===this.filterMode;for(let o of this.value){let i={...o},s={searchFields:t,filterText:n,strict:l};(l&&(this.findFilteredNodes(i,s)||this.isFilterMatched(i,s))||!l&&(this.isFilterMatched(i,s)||this.findFilteredNodes(i,s)))&&e.push(i)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:o}};const r={key:0,class:"p-tree-loading-overlay p-component-overlay"},a={key:1,class:"p-tree-filter-container"},h=n.createVNode("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),p={class:"p-tree-container",role:"tree"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&l.firstChild?l.insertBefore(o,l.firstChild):l.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),d.render=function(e,t,l,o,i,s){const c=n.resolveComponent("TreeNode");return n.openBlock(),n.createBlock("div",{class:s.containerClass},[l.loading?(n.openBlock(),n.createBlock("div",r,[n.createVNode("i",{class:s.loadingIconClass},null,2)])):n.createCommentVNode("",!0),l.filter?(n.openBlock(),n.createBlock("div",a,[n.withDirectives(n.createVNode("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:l.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>s.onFilterKeydown&&s.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>i.filterValue=e)},null,40,["placeholder"]),[[n.vModelText,i.filterValue]]),h])):n.createCommentVNode("",!0),n.createVNode("div",{class:"p-tree-wrapper",style:{maxHeight:l.scrollHeight}},[n.createVNode("ul",p,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(s.valueToRender,(t=>(n.openBlock(),n.createBlock(c,{key:t.key,node:t,templates:e.$slots,expandedKeys:i.d_expandedKeys,onNodeToggle:s.onNodeToggle,onNodeClick:s.onNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:s.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)},module.exports=d;
package/tree/tree.esm.js CHANGED
@@ -32,6 +32,9 @@ var script$1 = {
32
32
  toggle() {
33
33
  this.$emit('node-toggle', this.node);
34
34
  },
35
+ label(node) {
36
+ return (typeof node.label === 'function' ? node.label() : node.label);
37
+ },
35
38
  onChildNodeToggle(node) {
36
39
  this.$emit('node-toggle', node);
37
40
  },
@@ -320,7 +323,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
320
323
  node: $props.node
321
324
  }, null, 8, ["node"]))
322
325
  : (openBlock(), createBlock(Fragment, { key: 1 }, [
323
- createTextVNode(toDisplayString($props.node.label), 1)
326
+ createTextVNode(toDisplayString($options.label($props.node)), 1)
324
327
  ], 64))
325
328
  ])
326
329
  ], 46, ["aria-expanded"]),
@@ -1 +1 @@
1
- import{DomHandler as e,ObjectUtils as t}from"primevue/utils";import n from"primevue/ripple";import{resolveComponent as i,resolveDirective as l,openBlock as o,createBlock as s,createVNode as d,withDirectives as c,createCommentVNode as r,resolveDynamicComponent as a,Fragment as h,createTextVNode as p,toDisplayString as u,renderList as y,vModelText as f}from"vue";var g={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.hasClass(t.target,"p-tree-toggler")||e.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let i of e.children)this.propagateDown(i,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},i=0,l=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?i++:n[e.key]&&n[e.key].partialChecked&&(l=!0);t&&i===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],l||i>0&&i!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:n}};const k={key:0,class:"p-checkbox p-component"},x={class:"p-treenode-label"},m={key:0,class:"p-treenode-children",role:"group"};g.render=function(e,t,n,f,g,b){const K=i("TreeNode",!0),C=l("ripple");return o(),s("li",{class:b.containerClass},[d("div",{class:b.contentClass,tabindex:"0",role:"treeitem","aria-expanded":b.expanded,onClick:t[2]||(t[2]=(...e)=>b.onClick&&b.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>b.onKeyDown&&b.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>b.onTouchEnd&&b.onTouchEnd(...e)),style:n.node.style},[c(d("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>b.toggle&&b.toggle(...e)),tabindex:"-1"},[d("span",{class:b.toggleIcon},null,2)],512),[[C]]),b.checkboxMode?(o(),s("div",k,[d("div",{class:b.checkboxClass,role:"checkbox","aria-checked":b.checked},[d("span",{class:b.checkboxIcon},null,2)],10,["aria-checked"])])):r("",!0),d("span",{class:b.icon},null,2),d("span",x,[n.templates[n.node.type]||n.templates.default?(o(),s(a(n.templates[n.node.type]||n.templates.default),{key:0,node:n.node},null,8,["node"])):(o(),s(h,{key:1},[p(u(n.node.label),1)],64))])],46,["aria-expanded"]),b.hasChildren&&b.expanded?(o(),s("ul",m,[(o(!0),s(h,null,y(n.node.children,(e=>(o(),s(K,{key:e.key,node:e,templates:n.templates,expandedKeys:n.expandedKeys,onNodeToggle:b.onChildNodeToggle,onNodeClick:b.onChildNodeClick,selectionMode:n.selectionMode,selectionKeys:n.selectionKeys,onCheckboxChange:b.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):r("",!0)],2)};var b={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,i=t.metaKey||t.ctrlKey;let l;return this.isNodeSelected(n)&&i?(this.isSingleSelectionMode()?l={}:(l={...this.selectionKeys},delete l[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?l={}:this.isMultipleSelectionMode()&&(l=i&&this.selectionKeys?{...this.selectionKeys}:{}),l[n.key]=!0,this.$emit("node-select",n)),l},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let i;return this.isSingleSelectionMode()?n?(i={},this.$emit("node-unselect",t)):(i={},i[t.key]=!0,this.$emit("node-select",t)):n?(i={...this.selectionKeys},delete i[t.key],this.$emit("node-unselect",t)):(i=this.selectionKeys?{...this.selectionKeys}:{},i[t.key]=!0,this.$emit("node-select",t)),i},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let i=[...e.children];e.children=[];for(let l of i){let i={...l};this.isFilterMatched(i,t)&&(n=!0,e.children.push(i))}}if(n)return!0}},isFilterMatched(e,{searchFields:n,filterText:i,strict:l}){let o=!1;for(let l of n){String(t.resolveFieldData(e,l)).toLocaleLowerCase(this.filterLocale).indexOf(i)>-1&&(o=!0)}return(!o||l&&!this.isNodeLeaf(e))&&(o=this.findFilteredNodes(e,{searchFields:n,filterText:i,strict:l})||o),o}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),i="strict"===this.filterMode;for(let l of this.value){let o={...l},s={searchFields:t,filterText:n,strict:i};(i&&(this.findFilteredNodes(o,s)||this.isFilterMatched(o,s))||!i&&(this.isFilterMatched(o,s)||this.findFilteredNodes(o,s)))&&e.push(o)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:g}};const K={key:0,class:"p-tree-loading-overlay p-component-overlay"},C={key:1,class:"p-tree-filter-container"},v=d("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),N={class:"p-tree-container",role:"tree"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&i.firstChild?i.insertBefore(l,i.firstChild):i.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),b.render=function(e,t,n,l,a,p){const u=i("TreeNode");return o(),s("div",{class:p.containerClass},[n.loading?(o(),s("div",K,[d("i",{class:p.loadingIconClass},null,2)])):r("",!0),n.filter?(o(),s("div",C,[c(d("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:n.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>p.onFilterKeydown&&p.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>a.filterValue=e)},null,40,["placeholder"]),[[f,a.filterValue]]),v])):r("",!0),d("div",{class:"p-tree-wrapper",style:{maxHeight:n.scrollHeight}},[d("ul",N,[(o(!0),s(h,null,y(p.valueToRender,(t=>(o(),s(u,{key:t.key,node:t,templates:e.$slots,expandedKeys:a.d_expandedKeys,onNodeToggle:p.onNodeToggle,onNodeClick:p.onNodeClick,selectionMode:n.selectionMode,selectionKeys:n.selectionKeys,onCheckboxChange:p.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)};export default b;
1
+ import{DomHandler as e,ObjectUtils as t}from"primevue/utils";import n from"primevue/ripple";import{resolveComponent as l,resolveDirective as i,openBlock as o,createBlock as s,createVNode as d,withDirectives as c,createCommentVNode as r,resolveDynamicComponent as a,Fragment as h,createTextVNode as p,toDisplayString as u,renderList as y,vModelText as f}from"vue";var g={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},label:e=>"function"==typeof e.label?e.label():e.label,onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.hasClass(t.target,"p-tree-toggler")||e.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let l of e.children)this.propagateDown(l,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},l=0,i=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?l++:n[e.key]&&n[e.key].partialChecked&&(i=!0);t&&l===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],i||l>0&&l!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:n}};const k={key:0,class:"p-checkbox p-component"},x={class:"p-treenode-label"},m={key:0,class:"p-treenode-children",role:"group"};g.render=function(e,t,n,f,g,b){const K=l("TreeNode",!0),C=i("ripple");return o(),s("li",{class:b.containerClass},[d("div",{class:b.contentClass,tabindex:"0",role:"treeitem","aria-expanded":b.expanded,onClick:t[2]||(t[2]=(...e)=>b.onClick&&b.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>b.onKeyDown&&b.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>b.onTouchEnd&&b.onTouchEnd(...e)),style:n.node.style},[c(d("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>b.toggle&&b.toggle(...e)),tabindex:"-1"},[d("span",{class:b.toggleIcon},null,2)],512),[[C]]),b.checkboxMode?(o(),s("div",k,[d("div",{class:b.checkboxClass,role:"checkbox","aria-checked":b.checked},[d("span",{class:b.checkboxIcon},null,2)],10,["aria-checked"])])):r("",!0),d("span",{class:b.icon},null,2),d("span",x,[n.templates[n.node.type]||n.templates.default?(o(),s(a(n.templates[n.node.type]||n.templates.default),{key:0,node:n.node},null,8,["node"])):(o(),s(h,{key:1},[p(u(b.label(n.node)),1)],64))])],46,["aria-expanded"]),b.hasChildren&&b.expanded?(o(),s("ul",m,[(o(!0),s(h,null,y(n.node.children,(e=>(o(),s(K,{key:e.key,node:e,templates:n.templates,expandedKeys:n.expandedKeys,onNodeToggle:b.onChildNodeToggle,onNodeClick:b.onChildNodeClick,selectionMode:n.selectionMode,selectionKeys:n.selectionKeys,onCheckboxChange:b.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):r("",!0)],2)};var b={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,l=t.metaKey||t.ctrlKey;let i;return this.isNodeSelected(n)&&l?(this.isSingleSelectionMode()?i={}:(i={...this.selectionKeys},delete i[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?i={}:this.isMultipleSelectionMode()&&(i=l&&this.selectionKeys?{...this.selectionKeys}:{}),i[n.key]=!0,this.$emit("node-select",n)),i},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let l;return this.isSingleSelectionMode()?n?(l={},this.$emit("node-unselect",t)):(l={},l[t.key]=!0,this.$emit("node-select",t)):n?(l={...this.selectionKeys},delete l[t.key],this.$emit("node-unselect",t)):(l=this.selectionKeys?{...this.selectionKeys}:{},l[t.key]=!0,this.$emit("node-select",t)),l},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let l=[...e.children];e.children=[];for(let i of l){let l={...i};this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}if(n)return!0}},isFilterMatched(e,{searchFields:n,filterText:l,strict:i}){let o=!1;for(let i of n){String(t.resolveFieldData(e,i)).toLocaleLowerCase(this.filterLocale).indexOf(l)>-1&&(o=!0)}return(!o||i&&!this.isNodeLeaf(e))&&(o=this.findFilteredNodes(e,{searchFields:n,filterText:l,strict:i})||o),o}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),l="strict"===this.filterMode;for(let i of this.value){let o={...i},s={searchFields:t,filterText:n,strict:l};(l&&(this.findFilteredNodes(o,s)||this.isFilterMatched(o,s))||!l&&(this.isFilterMatched(o,s)||this.findFilteredNodes(o,s)))&&e.push(o)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:g}};const K={key:0,class:"p-tree-loading-overlay p-component-overlay"},C={key:1,class:"p-tree-filter-container"},v=d("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),N={class:"p-tree-container",role:"tree"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),b.render=function(e,t,n,i,a,p){const u=l("TreeNode");return o(),s("div",{class:p.containerClass},[n.loading?(o(),s("div",K,[d("i",{class:p.loadingIconClass},null,2)])):r("",!0),n.filter?(o(),s("div",C,[c(d("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:n.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>p.onFilterKeydown&&p.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>a.filterValue=e)},null,40,["placeholder"]),[[f,a.filterValue]]),v])):r("",!0),d("div",{class:"p-tree-wrapper",style:{maxHeight:n.scrollHeight}},[d("ul",N,[(o(!0),s(h,null,y(p.valueToRender,(t=>(o(),s(u,{key:t.key,node:t,templates:e.$slots,expandedKeys:a.d_expandedKeys,onNodeToggle:p.onNodeToggle,onNodeClick:p.onNodeClick,selectionMode:n.selectionMode,selectionKeys:n.selectionKeys,onCheckboxChange:p.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)};export default b;
package/tree/tree.js CHANGED
@@ -36,6 +36,9 @@ this.primevue.tree = (function (utils, Ripple, vue) {
36
36
  toggle() {
37
37
  this.$emit('node-toggle', this.node);
38
38
  },
39
+ label(node) {
40
+ return (typeof node.label === 'function' ? node.label() : node.label);
41
+ },
39
42
  onChildNodeToggle(node) {
40
43
  this.$emit('node-toggle', node);
41
44
  },
@@ -324,7 +327,7 @@ this.primevue.tree = (function (utils, Ripple, vue) {
324
327
  node: $props.node
325
328
  }, null, 8, ["node"]))
326
329
  : (vue.openBlock(), vue.createBlock(vue.Fragment, { key: 1 }, [
327
- vue.createTextVNode(vue.toDisplayString($props.node.label), 1)
330
+ vue.createTextVNode(vue.toDisplayString($options.label($props.node)), 1)
328
331
  ], 64))
329
332
  ])
330
333
  ], 46, ["aria-expanded"]),
package/tree/tree.min.js CHANGED
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.tree=function(e,t,n){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.DomHandler.hasClass(t.target,"p-tree-toggler")||e.DomHandler.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let l of e.children)this.propagateDown(l,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},l=0,i=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?l++:n[e.key]&&n[e.key].partialChecked&&(i=!0);t&&l===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],i||l>0&&l!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.DomHandler.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:l(t).default}};const o={key:0,class:"p-checkbox p-component"},s={class:"p-treenode-label"},c={key:0,class:"p-treenode-children",role:"group"};i.render=function(e,t,l,i,d,r){const a=n.resolveComponent("TreeNode",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("li",{class:r.containerClass},[n.createVNode("div",{class:r.contentClass,tabindex:"0",role:"treeitem","aria-expanded":r.expanded,onClick:t[2]||(t[2]=(...e)=>r.onClick&&r.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>r.onTouchEnd&&r.onTouchEnd(...e)),style:l.node.style},[n.withDirectives(n.createVNode("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>r.toggle&&r.toggle(...e)),tabindex:"-1"},[n.createVNode("span",{class:r.toggleIcon},null,2)],512),[[h]]),r.checkboxMode?(n.openBlock(),n.createBlock("div",o,[n.createVNode("div",{class:r.checkboxClass,role:"checkbox","aria-checked":r.checked},[n.createVNode("span",{class:r.checkboxIcon},null,2)],10,["aria-checked"])])):n.createCommentVNode("",!0),n.createVNode("span",{class:r.icon},null,2),n.createVNode("span",s,[l.templates[l.node.type]||l.templates.default?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.templates[l.node.type]||l.templates.default),{key:0,node:l.node},null,8,["node"])):(n.openBlock(),n.createBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(l.node.label),1)],64))])],46,["aria-expanded"]),r.hasChildren&&r.expanded?(n.openBlock(),n.createBlock("ul",c,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(l.node.children,(e=>(n.openBlock(),n.createBlock(a,{key:e.key,node:e,templates:l.templates,expandedKeys:l.expandedKeys,onNodeToggle:r.onChildNodeToggle,onNodeClick:r.onChildNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:r.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):n.createCommentVNode("",!0)],2)};var d={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,l=t.metaKey||t.ctrlKey;let i;return this.isNodeSelected(n)&&l?(this.isSingleSelectionMode()?i={}:(i={...this.selectionKeys},delete i[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?i={}:this.isMultipleSelectionMode()&&(i=l&&this.selectionKeys?{...this.selectionKeys}:{}),i[n.key]=!0,this.$emit("node-select",n)),i},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let l;return this.isSingleSelectionMode()?n?(l={},this.$emit("node-unselect",t)):(l={},l[t.key]=!0,this.$emit("node-select",t)):n?(l={...this.selectionKeys},delete l[t.key],this.$emit("node-unselect",t)):(l=this.selectionKeys?{...this.selectionKeys}:{},l[t.key]=!0,this.$emit("node-select",t)),l},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let l=[...e.children];e.children=[];for(let i of l){let l={...i};this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}if(n)return!0}},isFilterMatched(t,{searchFields:n,filterText:l,strict:i}){let o=!1;for(let i of n){String(e.ObjectUtils.resolveFieldData(t,i)).toLocaleLowerCase(this.filterLocale).indexOf(l)>-1&&(o=!0)}return(!o||i&&!this.isNodeLeaf(t))&&(o=this.findFilteredNodes(t,{searchFields:n,filterText:l,strict:i})||o),o}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),l="strict"===this.filterMode;for(let i of this.value){let o={...i},s={searchFields:t,filterText:n,strict:l};(l&&(this.findFilteredNodes(o,s)||this.isFilterMatched(o,s))||!l&&(this.isFilterMatched(o,s)||this.findFilteredNodes(o,s)))&&e.push(o)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:i}};const r={key:0,class:"p-tree-loading-overlay p-component-overlay"},a={key:1,class:"p-tree-filter-container"},h=n.createVNode("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),p={class:"p-tree-container",role:"tree"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),d.render=function(e,t,l,i,o,s){const c=n.resolveComponent("TreeNode");return n.openBlock(),n.createBlock("div",{class:s.containerClass},[l.loading?(n.openBlock(),n.createBlock("div",r,[n.createVNode("i",{class:s.loadingIconClass},null,2)])):n.createCommentVNode("",!0),l.filter?(n.openBlock(),n.createBlock("div",a,[n.withDirectives(n.createVNode("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:l.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>s.onFilterKeydown&&s.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>o.filterValue=e)},null,40,["placeholder"]),[[n.vModelText,o.filterValue]]),h])):n.createCommentVNode("",!0),n.createVNode("div",{class:"p-tree-wrapper",style:{maxHeight:l.scrollHeight}},[n.createVNode("ul",p,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(s.valueToRender,(t=>(n.openBlock(),n.createBlock(c,{key:t.key,node:t,templates:e.$slots,expandedKeys:o.d_expandedKeys,onNodeToggle:s.onNodeToggle,onNodeClick:s.onNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:s.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)},d}(primevue.utils,primevue.ripple,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.tree=function(e,t,n){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o={name:"TreeNode",emits:["node-toggle","node-click","checkbox-change"],props:{node:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},templates:{type:null,default:null}},nodeTouched:!1,methods:{toggle(){this.$emit("node-toggle",this.node)},label:e=>"function"==typeof e.label?e.label():e.label,onChildNodeToggle(e){this.$emit("node-toggle",e)},onClick(t){e.DomHandler.hasClass(t.target,"p-tree-toggler")||e.DomHandler.hasClass(t.target.parentElement,"p-tree-toggler")||(this.isCheckboxSelectionMode()?this.toggleCheckbox():this.$emit("node-click",{originalEvent:t,nodeTouched:this.nodeTouched,node:this.node}),this.nodeTouched=!1)},onChildNodeClick(e){this.$emit("node-click",e)},onTouchEnd(){this.nodeTouched=!0},onKeyDown(e){const t=e.target.parentElement;switch(e.which){case 40:var n=t.children[1];if(n)this.focusNode(n.children[0]);else{const e=t.nextElementSibling;if(e)this.focusNode(e);else{let e=this.findNextSiblingOfAncestor(t);e&&this.focusNode(e)}}e.preventDefault();break;case 38:if(t.previousElementSibling)this.focusNode(this.findLastVisibleDescendant(t.previousElementSibling));else{let e=this.getParentNodeElement(t);e&&this.focusNode(e)}e.preventDefault();break;case 37:case 39:this.$emit("node-toggle",this.node),e.preventDefault();break;case 13:this.onClick(e),e.preventDefault()}},toggleCheckbox(){let e=this.selectionKeys?{...this.selectionKeys}:{};const t=!this.checked;this.propagateDown(this.node,t,e),this.$emit("checkbox-change",{node:this.node,check:t,selectionKeys:e})},propagateDown(e,t,n){if(t?n[e.key]={checked:!0,partialChecked:!1}:delete n[e.key],e.children&&e.children.length)for(let l of e.children)this.propagateDown(l,t,n)},propagateUp(e){let t=e.check,n={...e.selectionKeys},l=0,o=!1;for(let e of this.node.children)n[e.key]&&n[e.key].checked?l++:n[e.key]&&n[e.key].partialChecked&&(o=!0);t&&l===this.node.children.length?n[this.node.key]={checked:!0,partialChecked:!1}:(t||delete n[this.node.key],o||l>0&&l!==this.node.children.length?n[this.node.key]={checked:!1,partialChecked:!0}:delete n[this.node.key]),this.$emit("checkbox-change",{node:e.node,check:e.check,selectionKeys:n})},onChildCheckboxChange(e){this.$emit("checkbox-change",e)},findNextSiblingOfAncestor(e){let t=this.getParentNodeElement(e);return t?t.nextElementSibling?t.nextElementSibling:this.findNextSiblingOfAncestor(t):null},findLastVisibleDescendant(e){const t=e.children[1];if(t){const e=t.children[t.children.length-1];return this.findLastVisibleDescendant(e)}return e},getParentNodeElement(t){const n=t.parentElement.parentElement;return e.DomHandler.hasClass(n,"p-treenode")?n:null},focusNode(e){e.children[0].focus()},isCheckboxSelectionMode(){return"checkbox"===this.selectionMode}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},expanded(){return this.expandedKeys&&!0===this.expandedKeys[this.node.key]},leaf(){return!1!==this.node.leaf&&!(this.node.children&&this.node.children.length)},selectable(){return!1!==this.node.selectable&&null!=this.selectionMode},selected(){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[this.node.key]},containerClass(){return["p-treenode",{"p-treenode-leaf":this.leaf}]},contentClass(){return["p-treenode-content",this.node.styleClass,{"p-treenode-selectable":this.selectable,"p-highlight":this.checkboxMode?this.checked:this.selected}]},icon(){return["p-treenode-icon",this.node.icon]},toggleIcon(){return["p-tree-toggler-icon pi pi-fw",{"pi-chevron-down":this.expanded,"pi-chevron-right":!this.expanded}]},checkboxClass(){return["p-checkbox-box",{"p-highlight":this.checked,"p-indeterminate":this.partialChecked}]},checkboxIcon(){return["p-checkbox-icon",{"pi pi-check":this.checked,"pi pi-minus":this.partialChecked}]},checkboxMode(){return"checkbox"===this.selectionMode&&!1!==this.node.selectable},checked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].checked)},partialChecked(){return!!this.selectionKeys&&(this.selectionKeys[this.node.key]&&this.selectionKeys[this.node.key].partialChecked)}},directives:{ripple:l(t).default}};const i={key:0,class:"p-checkbox p-component"},s={class:"p-treenode-label"},c={key:0,class:"p-treenode-children",role:"group"};o.render=function(e,t,l,o,d,r){const a=n.resolveComponent("TreeNode",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createBlock("li",{class:r.containerClass},[n.createVNode("div",{class:r.contentClass,tabindex:"0",role:"treeitem","aria-expanded":r.expanded,onClick:t[2]||(t[2]=(...e)=>r.onClick&&r.onClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),onTouchend:t[4]||(t[4]=(...e)=>r.onTouchEnd&&r.onTouchEnd(...e)),style:l.node.style},[n.withDirectives(n.createVNode("button",{type:"button",class:"p-tree-toggler p-link",onClick:t[1]||(t[1]=(...e)=>r.toggle&&r.toggle(...e)),tabindex:"-1"},[n.createVNode("span",{class:r.toggleIcon},null,2)],512),[[h]]),r.checkboxMode?(n.openBlock(),n.createBlock("div",i,[n.createVNode("div",{class:r.checkboxClass,role:"checkbox","aria-checked":r.checked},[n.createVNode("span",{class:r.checkboxIcon},null,2)],10,["aria-checked"])])):n.createCommentVNode("",!0),n.createVNode("span",{class:r.icon},null,2),n.createVNode("span",s,[l.templates[l.node.type]||l.templates.default?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(l.templates[l.node.type]||l.templates.default),{key:0,node:l.node},null,8,["node"])):(n.openBlock(),n.createBlock(n.Fragment,{key:1},[n.createTextVNode(n.toDisplayString(r.label(l.node)),1)],64))])],46,["aria-expanded"]),r.hasChildren&&r.expanded?(n.openBlock(),n.createBlock("ul",c,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(l.node.children,(e=>(n.openBlock(),n.createBlock(a,{key:e.key,node:e,templates:l.templates,expandedKeys:l.expandedKeys,onNodeToggle:r.onChildNodeToggle,onNodeClick:r.onChildNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:r.propagateUp},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])):n.createCommentVNode("",!0)],2)};var d={name:"Tree",emits:["node-expand","node-collapse","update:expandedKeys","update:selectionKeys","node-select","node-unselect"],props:{value:{type:null,default:null},expandedKeys:{type:null,default:null},selectionKeys:{type:null,default:null},selectionMode:{type:String,default:null},metaKeySelection:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner"},filter:{type:Boolean,default:!1},filterBy:{type:String,default:"label"},filterMode:{type:String,default:"lenient"},filterPlaceholder:{type:String,default:null},filterLocale:{type:String,default:void 0},scrollHeight:{type:String,default:null}},data(){return{d_expandedKeys:this.expandedKeys||{},filterValue:null}},watch:{expandedKeys(e){this.d_expandedKeys=e}},methods:{onNodeToggle(e){const t=e.key;this.d_expandedKeys[t]?(delete this.d_expandedKeys[t],this.$emit("node-collapse",e)):(this.d_expandedKeys[t]=!0,this.$emit("node-expand",e)),this.d_expandedKeys={...this.d_expandedKeys},this.$emit("update:expandedKeys",this.d_expandedKeys)},onNodeClick(e){if(null!=this.selectionMode&&!1!==e.node.selectable){const t=!e.nodeTouched&&this.metaKeySelection?this.handleSelectionWithMetaKey(e):this.handleSelectionWithoutMetaKey(e);this.$emit("update:selectionKeys",t)}},onCheckboxChange(e){this.$emit("update:selectionKeys",e.selectionKeys),e.check?this.$emit("node-select",e.node):this.$emit("node-unselect",e.node)},handleSelectionWithMetaKey(e){const t=e.originalEvent,n=e.node,l=t.metaKey||t.ctrlKey;let o;return this.isNodeSelected(n)&&l?(this.isSingleSelectionMode()?o={}:(o={...this.selectionKeys},delete o[n.key]),this.$emit("node-unselect",n)):(this.isSingleSelectionMode()?o={}:this.isMultipleSelectionMode()&&(o=l&&this.selectionKeys?{...this.selectionKeys}:{}),o[n.key]=!0,this.$emit("node-select",n)),o},handleSelectionWithoutMetaKey(e){const t=e.node,n=this.isNodeSelected(t);let l;return this.isSingleSelectionMode()?n?(l={},this.$emit("node-unselect",t)):(l={},l[t.key]=!0,this.$emit("node-select",t)):n?(l={...this.selectionKeys},delete l[t.key],this.$emit("node-unselect",t)):(l=this.selectionKeys?{...this.selectionKeys}:{},l[t.key]=!0,this.$emit("node-select",t)),l},isSingleSelectionMode(){return"single"===this.selectionMode},isMultipleSelectionMode(){return"multiple"===this.selectionMode},isNodeSelected(e){return!(!this.selectionMode||!this.selectionKeys)&&!0===this.selectionKeys[e.key]},isChecked(e){return!!this.selectionKeys&&(this.selectionKeys[e.key]&&this.selectionKeys[e.key].checked)},isNodeLeaf:e=>!1!==e.leaf&&!(e.children&&e.children.length),onFilterKeydown(e){13===e.which&&e.preventDefault()},findFilteredNodes(e,t){if(e){let n=!1;if(e.children){let l=[...e.children];e.children=[];for(let o of l){let l={...o};this.isFilterMatched(l,t)&&(n=!0,e.children.push(l))}}if(n)return!0}},isFilterMatched(t,{searchFields:n,filterText:l,strict:o}){let i=!1;for(let o of n){String(e.ObjectUtils.resolveFieldData(t,o)).toLocaleLowerCase(this.filterLocale).indexOf(l)>-1&&(i=!0)}return(!i||o&&!this.isNodeLeaf(t))&&(i=this.findFilteredNodes(t,{searchFields:n,filterText:l,strict:o})||i),i}},computed:{containerClass(){return["p-tree p-component",{"p-tree-selectable":null!=this.selectionMode,"p-tree-loading":this.loading,"p-tree-flex-scrollable":"flex"===this.scrollHeight}]},loadingIconClass(){return["p-tree-loading-icon pi-spin",this.loadingIcon]},filteredValue(){let e=[];const t=this.filterBy.split(","),n=this.filterValue.trim().toLocaleLowerCase(this.filterLocale),l="strict"===this.filterMode;for(let o of this.value){let i={...o},s={searchFields:t,filterText:n,strict:l};(l&&(this.findFilteredNodes(i,s)||this.isFilterMatched(i,s))||!l&&(this.isFilterMatched(i,s)||this.findFilteredNodes(i,s)))&&e.push(i)}return e},valueToRender(){return this.filterValue&&this.filterValue.trim().length>0?this.filteredValue:this.value}},components:{TreeNode:o}};const r={key:0,class:"p-tree-loading-overlay p-component-overlay"},a={key:1,class:"p-tree-filter-container"},h=n.createVNode("span",{class:"p-tree-filter-icon pi pi-search"},null,-1),p={class:"p-tree-container",role:"tree"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&l.firstChild?l.insertBefore(o,l.firstChild):l.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-tree-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n overflow: auto;\n}\n.p-treenode-children {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-tree-wrapper {\n overflow: auto;\n}\n.p-treenode-selectable {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-tree-toggler {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-treenode-leaf > .p-treenode-content .p-tree-toggler {\n visibility: hidden;\n}\n.p-treenode-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-tree-filter {\n width: 100%;\n}\n.p-tree-filter-container {\n position: relative;\n display: block;\n width: 100%;\n}\n.p-tree-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-tree-loading {\n position: relative;\n min-height: 4rem;\n}\n.p-tree .p-tree-loading-overlay {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-tree-flex-scrollable {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n height: 100%;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-tree-flex-scrollable .p-tree-wrapper {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n}\n"),d.render=function(e,t,l,o,i,s){const c=n.resolveComponent("TreeNode");return n.openBlock(),n.createBlock("div",{class:s.containerClass},[l.loading?(n.openBlock(),n.createBlock("div",r,[n.createVNode("i",{class:s.loadingIconClass},null,2)])):n.createCommentVNode("",!0),l.filter?(n.openBlock(),n.createBlock("div",a,[n.withDirectives(n.createVNode("input",{type:"text",autocomplete:"off",class:"p-tree-filter p-inputtext p-component",placeholder:l.filterPlaceholder,onKeydown:t[1]||(t[1]=(...e)=>s.onFilterKeydown&&s.onFilterKeydown(...e)),"onUpdate:modelValue":t[2]||(t[2]=e=>i.filterValue=e)},null,40,["placeholder"]),[[n.vModelText,i.filterValue]]),h])):n.createCommentVNode("",!0),n.createVNode("div",{class:"p-tree-wrapper",style:{maxHeight:l.scrollHeight}},[n.createVNode("ul",p,[(n.openBlock(!0),n.createBlock(n.Fragment,null,n.renderList(s.valueToRender,(t=>(n.openBlock(),n.createBlock(c,{key:t.key,node:t,templates:e.$slots,expandedKeys:i.d_expandedKeys,onNodeToggle:s.onNodeToggle,onNodeClick:s.onNodeClick,selectionMode:l.selectionMode,selectionKeys:l.selectionKeys,onCheckboxChange:s.onCheckboxChange},null,8,["node","templates","expandedKeys","onNodeToggle","onNodeClick","selectionMode","selectionKeys","onCheckboxChange"])))),128))])],4)],2)},d}(primevue.utils,primevue.ripple,Vue);
@@ -218,6 +218,7 @@ export default {
218
218
  this.bindOutsideClickListener();
219
219
  this.bindScrollListener();
220
220
  this.bindResizeListener();
221
+ this.scrollValueInView();
221
222
  this.$emit('show');
222
223
  },
223
224
  onOverlayLeave() {
@@ -354,6 +355,14 @@ export default {
354
355
  this.expandedKeys[key] = true;
355
356
  }
356
357
  }
358
+ },
359
+ scrollValueInView() {
360
+ if (this.overlay) {
361
+ let selectedItem = DomHandler.findSingle(this.overlay, 'li.p-highlight');
362
+ if (selectedItem) {
363
+ selectedItem.scrollIntoView({ block: 'nearest', inline: 'start' });
364
+ }
365
+ }
357
366
  }
358
367
  },
359
368
  computed: {
@@ -177,6 +177,7 @@ var script = {
177
177
  this.bindOutsideClickListener();
178
178
  this.bindScrollListener();
179
179
  this.bindResizeListener();
180
+ this.scrollValueInView();
180
181
  this.$emit('show');
181
182
  },
182
183
  onOverlayLeave() {
@@ -313,6 +314,14 @@ var script = {
313
314
  this.expandedKeys[key] = true;
314
315
  }
315
316
  }
317
+ },
318
+ scrollValueInView() {
319
+ if (this.overlay) {
320
+ let selectedItem = utils.DomHandler.findSingle(this.overlay, 'li.p-highlight');
321
+ if (selectedItem) {
322
+ selectedItem.scrollIntoView({ block: 'nearest', inline: 'start' });
323
+ }
324
+ }
316
325
  }
317
326
  },
318
327
  computed: {