primevue 3.7.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.
- package/README.md +2 -2
- package/accordion/Accordion.vue +1 -1
- package/accordion/accordion.cjs.js +1 -1
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.esm.js +1 -1
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +1 -1
- package/accordion/accordion.min.js +1 -1
- package/api/Api.d.ts +73 -32
- package/api/api.cjs.js +66 -32
- package/api/api.cjs.min.js +1 -1
- package/api/api.esm.js +66 -32
- package/api/api.esm.min.js +1 -1
- package/api/api.js +66 -32
- package/api/api.min.js +1 -1
- package/autocomplete/AutoComplete.d.ts +43 -9
- package/autocomplete/AutoComplete.vue +16 -9
- package/autocomplete/autocomplete.cjs.js +19 -11
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +19 -11
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +19 -11
- package/autocomplete/autocomplete.min.js +1 -1
- package/blockui/BlockUI.vue +1 -1
- package/blockui/blockui.cjs.js +5 -7
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +6 -8
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +5 -7
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/Breadcrumb.d.ts +7 -0
- package/breadcrumb/Breadcrumb.vue +4 -0
- package/breadcrumb/BreadcrumbItem.vue +5 -2
- package/breadcrumb/breadcrumb.cjs.js +6 -3
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +6 -3
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +6 -3
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/calendar/Calendar.d.ts +11 -1
- package/calendar/Calendar.vue +362 -67
- package/calendar/calendar.cjs.js +459 -168
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +461 -170
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +459 -168
- package/calendar/calendar.min.js +1 -1
- package/carousel/Carousel.d.ts +6 -1
- package/carousel/Carousel.vue +2 -2
- package/carousel/carousel.cjs.js +6 -6
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +6 -6
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +6 -6
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/CascadeSelect.d.ts +19 -6
- package/chart/Chart.vue +9 -2
- package/chart/chart.cjs.js +9 -2
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +9 -2
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +9 -2
- package/chart/chart.min.js +1 -1
- package/chips/Chips.d.ts +5 -1
- package/colorpicker/ColorPicker.d.ts +3 -0
- package/colorpicker/ColorPicker.vue +6 -1
- package/colorpicker/colorpicker.cjs.js +6 -1
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +6 -1
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +6 -1
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +42 -11
- package/confirmationservice/ConfirmationService.d.ts +3 -2
- package/confirmdialog/ConfirmDialog.vue +8 -2
- package/confirmdialog/confirmdialog.cjs.js +11 -4
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +11 -4
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +11 -4
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/confirmpopup/ConfirmPopup.d.ts +7 -0
- package/confirmpopup/ConfirmPopup.vue +7 -4
- package/confirmpopup/confirmpopup.cjs.js +13 -5
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +14 -6
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +13 -5
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/ContextMenu.d.ts +5 -1
- package/contextmenu/ContextMenuSub.vue +8 -5
- package/contextmenu/contextmenu.cjs.js +8 -5
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +8 -5
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +8 -5
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +7644 -0
- package/core/core.min.js +47 -0
- package/datatable/BodyCell.vue +37 -17
- package/datatable/ColumnFilter.vue +17 -6
- package/datatable/DataTable.d.ts +37 -9
- package/datatable/DataTable.vue +90 -48
- package/datatable/FooterCell.vue +2 -2
- package/datatable/HeaderCell.vue +2 -2
- package/datatable/TableBody.vue +15 -6
- package/datatable/TableFooter.vue +17 -2
- package/datatable/TableHeader.vue +17 -2
- package/datatable/datatable.cjs.js +321 -197
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +321 -197
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +321 -197
- package/datatable/datatable.min.js +1 -1
- package/dataview/DataView.d.ts +9 -4
- package/dataview/DataView.vue +8 -8
- package/dataview/dataview.cjs.js +12 -12
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +12 -12
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +12 -12
- package/dataview/dataview.min.js +1 -1
- package/dialog/Dialog.vue +6 -1
- package/dialog/dialog.cjs.js +4 -2
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +4 -2
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +4 -2
- package/dialog/dialog.min.js +1 -1
- package/dock/Dock.d.ts +10 -1
- package/dock/Dock.vue +1 -1
- package/dock/DockSub.vue +13 -8
- package/dock/dock.cjs.js +24 -10
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +20 -10
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +25 -12
- package/dock/dock.min.js +1 -1
- package/dropdown/Dropdown.d.ts +56 -13
- package/dropdown/Dropdown.vue +1 -0
- package/dropdown/dropdown.cjs.js +1 -0
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +1 -0
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +1 -0
- package/dropdown/dropdown.min.js +1 -1
- package/fileupload/FileUpload.d.ts +5 -0
- package/galleria/Galleria.d.ts +20 -4
- package/inplace/Inplace.d.ts +1 -0
- package/inplace/Inplace.vue +12 -1
- package/inplace/inplace.cjs.js +13 -2
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +13 -2
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +13 -2
- package/inplace/inplace.min.js +1 -1
- package/inputnumber/InputNumber.d.ts +1 -1
- package/inputnumber/InputNumber.vue +19 -3
- package/inputnumber/inputnumber.cjs.js +19 -3
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +19 -3
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +19 -3
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/InputSwitch.vue +6 -3
- package/inputswitch/inputswitch.cjs.js +6 -3
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +6 -3
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +6 -3
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/InputText.d.ts +1 -1
- package/inputtext/InputText.vue +1 -1
- package/inputtext/inputtext.cjs.js +2 -2
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.esm.js +3 -3
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +2 -2
- package/inputtext/inputtext.min.js +1 -1
- package/listbox/Listbox.d.ts +48 -12
- package/megamenu/MegaMenu.d.ts +5 -1
- package/megamenu/MegaMenu.vue +11 -8
- package/megamenu/megamenu.cjs.js +11 -8
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +11 -8
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +11 -8
- package/megamenu/megamenu.min.js +1 -1
- package/menu/Menu.d.ts +5 -1
- package/menu/Menu.vue +6 -3
- package/menu/Menuitem.vue +5 -2
- package/menu/menu.cjs.js +11 -5
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +11 -5
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +11 -5
- package/menu/menu.min.js +1 -1
- package/menubar/Menubar.d.ts +5 -1
- package/menubar/MenubarSub.vue +8 -5
- package/menubar/menubar.cjs.js +8 -5
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +8 -5
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +8 -5
- package/menubar/menubar.min.js +1 -1
- package/message/Message.d.ts +1 -0
- package/message/Message.vue +6 -2
- package/message/message.cjs.js +6 -2
- package/message/message.cjs.min.js +1 -1
- package/message/message.esm.js +6 -2
- package/message/message.esm.min.js +1 -1
- package/message/message.js +6 -2
- package/message/message.min.js +1 -1
- package/multiselect/MultiSelect.d.ts +61 -14
- package/orderlist/OrderList.d.ts +8 -1
- package/orderlist/OrderList.vue +2 -0
- package/orderlist/orderlist.cjs.js +3 -1
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +3 -1
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +3 -1
- package/orderlist/orderlist.min.js +1 -1
- package/overlaypanel/OverlayPanel.vue +1 -0
- package/overlaypanel/overlaypanel.cjs.js +1 -0
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +1 -0
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +1 -0
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +5 -1
- package/paginator/CurrentPageReport.vue +5 -1
- package/paginator/JumpToPageInput.vue +1 -1
- package/paginator/Paginator.d.ts +10 -4
- package/paginator/Paginator.vue +10 -7
- package/paginator/paginator.cjs.js +16 -8
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +16 -8
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +16 -8
- package/paginator/paginator.min.js +1 -1
- package/panel/Panel.d.ts +1 -0
- package/panel/Panel.vue +1 -1
- package/panelmenu/PanelMenu.d.ts +5 -3
- package/panelmenu/PanelMenu.vue +6 -3
- package/panelmenu/PanelMenuSub.vue +8 -5
- package/panelmenu/panelmenu.cjs.js +14 -8
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +14 -8
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +14 -8
- package/panelmenu/panelmenu.min.js +1 -1
- package/picklist/PickList.d.ts +14 -3
- package/picklist/PickList.vue +10 -4
- package/picklist/picklist.cjs.js +13 -7
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +13 -7
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +13 -7
- package/picklist/picklist.min.js +1 -1
- package/progressbar/ProgressBar.vue +13 -12
- package/progressbar/progressbar.cjs.js +13 -12
- package/progressbar/progressbar.cjs.min.js +1 -1
- package/progressbar/progressbar.esm.js +14 -13
- package/progressbar/progressbar.esm.min.js +1 -1
- package/progressbar/progressbar.js +13 -12
- package/progressbar/progressbar.min.js +1 -1
- package/rating/Rating.vue +1 -1
- package/rating/rating.cjs.js +1 -1
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +1 -1
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +1 -1
- package/rating/rating.min.js +1 -1
- package/resources/primevue.css +5 -0
- package/resources/primevue.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +57 -16
- package/resources/themes/arya-green/theme.css +57 -16
- package/resources/themes/arya-orange/theme.css +57 -16
- package/resources/themes/arya-purple/theme.css +57 -16
- package/resources/themes/bootstrap4-dark-blue/theme.css +54 -20
- package/resources/themes/bootstrap4-dark-purple/theme.css +54 -20
- package/resources/themes/bootstrap4-light-blue/theme.css +54 -20
- package/resources/themes/bootstrap4-light-purple/theme.css +54 -20
- package/resources/themes/fluent-light/theme.css +57 -16
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/theme.css +5414 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/theme.css +5414 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/theme.css +5414 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/theme.css +5414 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-blue/theme.css +5414 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/theme.css +5414 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-purple/theme.css +5414 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-teal/theme.css +5414 -0
- package/resources/themes/luna-amber/theme.css +54 -20
- package/resources/themes/luna-blue/theme.css +54 -20
- package/resources/themes/luna-green/theme.css +54 -20
- package/resources/themes/luna-pink/theme.css +54 -20
- package/resources/themes/md-dark-deeppurple/theme.css +245 -48
- package/resources/themes/md-dark-indigo/theme.css +245 -48
- package/resources/themes/md-light-deeppurple/theme.css +245 -48
- package/resources/themes/md-light-indigo/theme.css +245 -48
- package/resources/themes/mdc-dark-deeppurple/theme.css +245 -48
- package/resources/themes/mdc-dark-indigo/theme.css +245 -48
- package/resources/themes/mdc-light-deeppurple/theme.css +245 -48
- package/resources/themes/mdc-light-indigo/theme.css +245 -48
- package/resources/themes/nova/theme.css +54 -20
- package/resources/themes/nova-accent/theme.css +54 -20
- package/resources/themes/nova-alt/theme.css +54 -20
- package/resources/themes/nova-vue/theme.css +54 -20
- package/resources/themes/rhea/theme.css +54 -20
- package/resources/themes/saga-blue/theme.css +57 -16
- package/resources/themes/saga-green/theme.css +57 -16
- package/resources/themes/saga-orange/theme.css +57 -16
- package/resources/themes/saga-purple/theme.css +57 -16
- package/resources/themes/tailwind-light/theme.css +68 -19
- package/resources/themes/vela-blue/theme.css +57 -16
- package/resources/themes/vela-green/theme.css +57 -16
- package/resources/themes/vela-orange/theme.css +57 -16
- package/resources/themes/vela-purple/theme.css +57 -16
- package/selectbutton/SelectButton.d.ts +13 -5
- package/selectbutton/SelectButton.vue +8 -2
- package/selectbutton/selectbutton.cjs.js +14 -9
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +14 -9
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +14 -9
- package/selectbutton/selectbutton.min.js +1 -1
- package/speeddial/SpeedDial.d.ts +5 -1
- package/speeddial/SpeedDial.vue +2 -1
- package/speeddial/speeddial.cjs.js +2 -1
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +2 -1
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +2 -1
- package/speeddial/speeddial.min.js +1 -1
- package/splitter/Splitter.vue +5 -3
- package/splitter/splitter.cjs.js +4 -2
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +5 -3
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +4 -2
- package/splitter/splitter.min.js +1 -1
- package/steps/Steps.d.ts +5 -3
- package/steps/Steps.vue +5 -2
- package/steps/steps.cjs.js +5 -2
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +5 -2
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +5 -2
- package/steps/steps.min.js +1 -1
- package/tabmenu/TabMenu.d.ts +5 -3
- package/tabmenu/TabMenu.vue +10 -3
- package/tabmenu/tabmenu.cjs.js +7 -4
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +7 -4
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +7 -4
- package/tabmenu/tabmenu.min.js +1 -1
- package/terminal/terminal.js +1 -1
- package/terminal/terminal.min.js +1 -1
- package/terminalservice/TerminalService.d.ts +9 -6
- package/tieredmenu/TieredMenu.d.ts +5 -3
- package/tieredmenu/TieredMenuSub.vue +8 -5
- package/tieredmenu/tieredmenu.cjs.js +8 -5
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +8 -5
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +8 -5
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/Timeline.d.ts +8 -3
- package/toast/Toast.d.ts +7 -0
- package/toastservice/ToastService.d.ts +3 -2
- package/tooltip/tooltip.cjs.js +5 -1
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +5 -1
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +5 -1
- package/tooltip/tooltip.min.js +1 -1
- package/tree/Tree.d.ts +5 -1
- package/tree/TreeNode.vue +4 -1
- package/tree/tree.cjs.js +4 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +4 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +4 -1
- package/tree/tree.min.js +1 -1
- package/treeselect/TreeSelect.d.ts +20 -3
- package/treeselect/TreeSelect.vue +9 -0
- package/treeselect/treeselect.cjs.js +9 -0
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +9 -0
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +9 -0
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/BodyCell.vue +2 -3
- package/treetable/FooterCell.vue +2 -2
- package/treetable/HeaderCell.vue +2 -2
- package/treetable/TreeTable.d.ts +2 -2
- package/treetable/TreeTable.vue +10 -10
- package/treetable/TreeTableRow.vue +2 -2
- package/treetable/treetable.cjs.js +18 -18
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +19 -19
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +18 -18
- package/treetable/treetable.min.js +1 -1
- package/utils/Utils.d.ts +80 -0
- package/utils/package.json +3 -2
- package/utils/utils.cjs.js +126 -108
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +126 -108
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +126 -108
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +24 -0
- package/vetur-tags.json +9 -3
- package/virtualscroller/VirtualScroller.d.ts +52 -6
- package/virtualscroller/VirtualScroller.vue +1 -1
- package/virtualscroller/virtualscroller.cjs.js +1 -1
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +1 -1
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +1 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +228 -13
package/dock/dock.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.dock=function(e){"use strict";var
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.dock=function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o={name:"DockSub",props:{model:{type:Array,default:null},templates:{type:null,default:null},exact:{type:Boolean,default:!0},tooltipOptions:null},data:()=>({currentIndex:-3}),methods:{onListMouseLeave(){this.currentIndex=-3},onItemMouseEnter(e){this.currentIndex=e},onItemClick(e,t,n){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.to&&n&&n(e))},itemClass(e){return["p-dock-item",{"p-dock-item-second-prev":this.currentIndex-2===e,"p-dock-item-prev":this.currentIndex-1===e,"p-dock-item-current":this.currentIndex===e,"p-dock-item-next":this.currentIndex+1===e,"p-dock-item-second-next":this.currentIndex+2===e}]},linkClass(e,t){return["p-dock-action",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled},directives:{ripple:n(e).default}};const i={class:"p-dock-list-container"};o.render=function(e,n,o,l,c,r){const s=t.resolveComponent("router-link"),a=t.resolveDirective("ripple"),p=t.resolveDirective("tooltip");return t.openBlock(),t.createBlock("div",i,[t.createVNode("ul",{ref:"list",class:"p-dock-list",role:"menu",onMouseleave:n[1]||(n[1]=(...e)=>r.onListMouseLeave&&r.onListMouseLeave(...e))},[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(o.model,((e,n)=>(t.openBlock(),t.createBlock("li",{class:r.itemClass(n),key:n,role:"none",onMouseenter:e=>r.onItemMouseEnter(n)},[o.templates.item?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.templates.item),{key:1,item:e},null,8,["item"])):(t.openBlock(),t.createBlock(t.Fragment,{key:0},[e.to&&!r.disabled(e)?(t.openBlock(),t.createBlock(s,{key:0,to:e.to,custom:""},{default:t.withCtx((({navigate:n,href:i,isActive:l,isExactActive:c})=>[t.withDirectives(t.createVNode("a",{href:i,role:"menuitem",class:r.linkClass(e,{isActive:l,isExactActive:c}),target:e.target,onClick:t=>r.onItemClick(t,e,n)},[o.templates.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.templates.icon),{key:1,item:e},null,8,["item"])):t.withDirectives((t.openBlock(),t.createBlock("span",{key:0,class:["p-dock-action-icon",e.icon]},null,2)),[[a]])],10,["href","target","onClick"]),[[p,{value:e.label,disabled:!o.tooltipOptions},o.tooltipOptions]])])),_:2},1032,["to"])):t.withDirectives((t.openBlock(),t.createBlock("a",{key:1,href:e.url,role:"menuitem",class:r.linkClass(e),target:e.target,onClick:t=>r.onItemClick(t,e),tabindex:r.disabled(e)?null:"0"},[o.templates.icon?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.templates.icon),{key:1,item:e},null,8,["item"])):t.withDirectives((t.openBlock(),t.createBlock("span",{key:0,class:["p-dock-action-icon",e.icon]},null,2)),[[a]])],10,["href","target","onClick","tabindex"])),[[p,{value:e.label,disabled:!o.tooltipOptions},o.tooltipOptions]])],64))],42,["onMouseenter"])))),128))],544)])};var l={name:"Dock",props:{position:{type:String,default:"bottom"},model:null,class:null,style:null,tooltipOptions:null,exact:{type:Boolean,default:!0}},computed:{containerClass(){return["p-dock p-component",`p-dock-${this.position}`,this.class]}},components:{DockSub:o}};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-dock {\n position: absolute;\n z-index: 1;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n pointer-events: none;\n}\n.p-dock-list-container {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n pointer-events: auto;\n}\n.p-dock-list {\n margin: 0;\n padding: 0;\n list-style: none;\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-dock-item {\n -webkit-transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);\n transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);\n will-change: transform;\n}\n.p-dock-action {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\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 position: relative;\n overflow: hidden;\n cursor: default;\n}\n.p-dock-item-second-prev,\n.p-dock-item-second-next {\n -webkit-transform: scale(1.2);\n transform: scale(1.2);\n}\n.p-dock-item-prev,\n.p-dock-item-next {\n -webkit-transform: scale(1.4);\n transform: scale(1.4);\n}\n.p-dock-item-current {\n -webkit-transform: scale(1.6);\n transform: scale(1.6);\n z-index: 1;\n}\n\n/* Position */\n/* top */\n.p-dock-top {\n left: 0;\n top: 0;\n width: 100%;\n}\n.p-dock-top .p-dock-item {\n -webkit-transform-origin: center top;\n transform-origin: center top;\n}\n\n/* bottom */\n.p-dock-bottom {\n left: 0;\n bottom: 0;\n width: 100%;\n}\n.p-dock-bottom .p-dock-item {\n -webkit-transform-origin: center bottom;\n transform-origin: center bottom;\n}\n\n/* right */\n.p-dock-right {\n right: 0;\n top: 0;\n height: 100%;\n}\n.p-dock-right .p-dock-item {\n -webkit-transform-origin: center right;\n transform-origin: center right;\n}\n.p-dock-right .p-dock-list {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n\n/* left */\n.p-dock-left {\n left: 0;\n top: 0;\n height: 100%;\n}\n.p-dock-left .p-dock-item {\n -webkit-transform-origin: center left;\n transform-origin: center left;\n}\n.p-dock-left .p-dock-list {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n"),l.render=function(e,n,o,i,l,c){const r=t.resolveComponent("DockSub");return t.openBlock(),t.createBlock("div",{class:c.containerClass,style:o.style},[t.createVNode(r,{model:o.model,templates:e.$slots,exact:o.exact,tooltipOptions:o.tooltipOptions},null,8,["model","templates","exact","tooltipOptions"])],6)},l}(primevue.ripple,Vue);
|
package/dropdown/Dropdown.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
|
-
import
|
|
2
|
+
import VirtualScrollerProps from '../virtualscroller';
|
|
3
|
+
|
|
4
|
+
type DropdownOptionLabelType = string | ((data: any) => string) | undefined;
|
|
5
|
+
type DropdownOptionValueType = string | ((data: any) => any) | undefined;
|
|
6
|
+
type DropdownOptionDisabledType = string | ((data: any) => boolean) | undefined;
|
|
7
|
+
type DropdownOptionChildrenType = string | ((data: any) => any[]) | undefined;
|
|
3
8
|
|
|
4
9
|
interface DropdownProps {
|
|
5
10
|
modelValue?: any;
|
|
6
11
|
options?: any[];
|
|
7
|
-
optionLabel?:
|
|
8
|
-
optionValue?:
|
|
9
|
-
optionDisabled?:
|
|
10
|
-
optionGroupLabel?:
|
|
11
|
-
optionGroupChildren?:
|
|
12
|
+
optionLabel?: DropdownOptionLabelType;
|
|
13
|
+
optionValue?: DropdownOptionValueType;
|
|
14
|
+
optionDisabled?: DropdownOptionDisabledType;
|
|
15
|
+
optionGroupLabel?: DropdownOptionLabelType;
|
|
16
|
+
optionGroupChildren?: DropdownOptionChildrenType;
|
|
12
17
|
scrollHeight?: string;
|
|
13
18
|
filter?: boolean;
|
|
14
19
|
filterPlaceholder?: string;
|
|
@@ -32,6 +37,42 @@ interface DropdownProps {
|
|
|
32
37
|
virtualScrollerOptions?: VirtualScrollerProps;
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
interface DropdownValueSlotInterface {
|
|
41
|
+
value: any;
|
|
42
|
+
placeholder: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface DropdownHeaderSlotInterface {
|
|
46
|
+
value: any;
|
|
47
|
+
options: any[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface DropdownFooterSlotInterface {
|
|
51
|
+
value: any;
|
|
52
|
+
options: any[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface DropdownOptionSlotInterface {
|
|
56
|
+
option: any;
|
|
57
|
+
index: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface DropdownOptionGroupSlotInterface {
|
|
61
|
+
option: any;
|
|
62
|
+
index: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface DropdownContentInterface {
|
|
66
|
+
items: any;
|
|
67
|
+
styleClass: string;
|
|
68
|
+
contentRef: string;
|
|
69
|
+
getItemOptions: any;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface DropdownLoaderInterface {
|
|
73
|
+
options: any[];
|
|
74
|
+
}
|
|
75
|
+
|
|
35
76
|
declare class Dropdown {
|
|
36
77
|
$props: DropdownProps;
|
|
37
78
|
$emit(eventName: 'update:modelValue', value: any): this;
|
|
@@ -43,16 +84,18 @@ declare class Dropdown {
|
|
|
43
84
|
$emit(eventName: 'focus', e: Event): this;
|
|
44
85
|
$emit(eventName: 'blur', e: Event): this;
|
|
45
86
|
$emit(eventName: 'filter', e: { originalEvent: Event, value: string }): this;
|
|
87
|
+
show(): void;
|
|
88
|
+
hide(): void;
|
|
46
89
|
$slot: {
|
|
47
|
-
value:
|
|
48
|
-
header:
|
|
49
|
-
footer:
|
|
50
|
-
option:
|
|
51
|
-
optiongroup:
|
|
90
|
+
value: DropdownValueSlotInterface;
|
|
91
|
+
header: DropdownHeaderSlotInterface;
|
|
92
|
+
footer: DropdownFooterSlotInterface;
|
|
93
|
+
option: DropdownOptionSlotInterface;
|
|
94
|
+
optiongroup: DropdownOptionGroupSlotInterface;
|
|
52
95
|
emptyfilter: VNode[];
|
|
53
96
|
empty: VNode[];
|
|
54
|
-
content:
|
|
55
|
-
loader:
|
|
97
|
+
content: DropdownContentInterface;
|
|
98
|
+
loader: DropdownLoaderInterface;
|
|
56
99
|
indicator: VNode[];
|
|
57
100
|
}
|
|
58
101
|
}
|
package/dropdown/Dropdown.vue
CHANGED
package/dropdown/dropdown.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/api"),l=require("primevue/ripple"),n=require("primevue/virtualscroller"),o=require("vue");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&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.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=d;
|
|
1
|
+
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/api"),l=require("primevue/ripple"),n=require("primevue/virtualscroller"),o=require("vue");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.scrollValueInView(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&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.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=d;
|
package/dropdown/dropdown.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ZIndexUtils as e,ObjectUtils as i,DomHandler as t,ConnectedOverlayScrollHandler as l}from"primevue/utils";import n from"primevue/overlayeventbus";import{FilterService as o}from"primevue/api";import s from"primevue/ripple";import r from"primevue/virtualscroller";import{resolveComponent as a,resolveDirective as p,openBlock as d,createBlock as h,createVNode as u,createCommentVNode as c,renderSlot as b,createTextVNode as f,toDisplayString as v,Teleport as g,Transition as y,withCtx as m,withDirectives as O,vModelText as w,mergeProps as L,createSlots as x,Fragment as V,renderList as C}from"vue";var S={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,i){return this.virtualScrollerDisabled?e:i&&i(e).index},getOptionLabel(e){return this.optionLabel?i.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?i.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e){return this.dataKey?i.resolveFieldData(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled(e){return!!this.optionDisabled&&i.resolveFieldData(e,this.optionDisabled)},getOptionGroupRenderKey(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupLabel(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return i.resolveFieldData(e,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let i=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==i)return{group:e,option:i}}}return-1},findOptionIndexInList(e,t){for(let l=0;l<t.length;l++)if(i.equals(e,this.getOptionValue(t[l]),this.equalityKey))return l;return-1},isSelected(e){return i.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let i=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let i=this.findPrevOption(this.getSelectedOptionIndex());i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let i=-1===e?0:e.group,t=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i+1!==this.visibleOptions.length?this.findNextOption({group:i+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,i){let t=i+1;if(t===e.length)return null;let l=e[t];return this.isOptionDisabled(l)?this.findNextOptionInList(t):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let i=e.group,t=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i>0?this.findPrevOption({group:i-1,option:this.getOptionGroupChildren(this.visibleOptions[i-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,i){let t=i-1;if(t<0)return null;let l=e[t];return this.isOptionDisabled(l)?this.findPrevOption(t):l},onClearClick(e){this.updateModel(e,null)},onClick(e){this.disabled||this.loading||t.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,i){let t=this.getOptionValue(i);this.updateModel(e,t),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(i){if(e.set("overlay",i,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(i){e.clear(i)},alignOverlay(){this.appendDisabled?t.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=t.getOuterWidth(this.$el)+"px",t.absolutePosition(this.overlay,this.$el))},updateModel(e,i){this.$emit("update:modelValue",i),this.$emit("change",{originalEvent:e,value:i})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new l(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!t.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const i=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=i,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+i:i,this.searchValue){let i=this.getSelectedOptionIndex(),t=this.optionGroupLabel?this.searchOptionInGroup(i):this.searchOption(++i);t&&this.updateModel(e,this.getOptionValue(t))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let i;return this.searchValue&&(i=this.searchOptionInRange(e,this.visibleOptions.length),i||(i=this.searchOptionInRange(0,e))),i},searchOptionInRange(e,i){for(let t=e;t<i;t++){let e=this.visibleOptions[t];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let i=-1===e?{group:0,option:-1}:e;for(let e=i.group;e<this.visibleOptions.length;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=i.group===e?i.option+1:0;l<t.length;l++)if(this.matchesSearchValue(t[l]))return t[l]}for(let e=0;e<=i.group;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(i.group===e?i.option:t.length);l++)if(this.matchesSearchValue(t[l]))return t[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let e=t.findSingle(this.overlay,"li.p-highlight");e&&e.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let i of this.options){let t=o.filter(this.getOptionGroupChildren(i),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(t&&t.length){let l={...i};l[this.optionGroupChildren]=t,e.push(l)}}return e}return o.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:s},components:{VirtualScroller:r}};const k={class:"p-hidden-accessible"},I={key:0,class:"p-dropdown-header"},D={class:"p-dropdown-filter-container"},$=u("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),F={class:"p-dropdown-item-group"},G={key:2,class:"p-dropdown-empty-message"},K={key:3,class:"p-dropdown-empty-message"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===t&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),S.render=function(e,i,t,l,n,o){const s=a("VirtualScroller"),r=p("ripple");return d(),h("div",{ref:"container",class:o.containerClass,onClick:i[13]||(i[13]=e=>o.onClick(e))},[u("div",k,[u("input",{ref:"focusInput",type:"text",id:t.inputId,readonly:"",disabled:t.disabled,onFocus:i[1]||(i[1]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[2]||(i[2]=(...e)=>o.onBlur&&o.onBlur(...e)),onKeydown:i[3]||(i[3]=(...e)=>o.onKeyDown&&o.onKeyDown(...e)),tabindex:t.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":t.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),t.editable?(d(),h("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:t.disabled,onFocus:i[4]||(i[4]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[5]||(i[5]=(...e)=>o.onBlur&&o.onBlur(...e)),placeholder:t.placeholder,value:o.editableInputValue,onInput:i[6]||(i[6]=(...e)=>o.onEditableInput&&o.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):c("",!0),t.editable?c("",!0):(d(),h("span",{key:1,class:o.labelClass},[b(e.$slots,"value",{value:t.modelValue,placeholder:t.placeholder},(()=>[f(v(o.label||"empty"),1)]))],2)),t.showClear&&null!=t.modelValue?(d(),h("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:i[7]||(i[7]=e=>o.onClearClick(e))})):c("",!0),u("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[b(e.$slots,"indicator",{},(()=>[u("span",{class:o.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(d(),h(g,{to:o.appendTarget,disabled:o.appendDisabled},[u(y,{name:"p-connected-overlay",onEnter:o.onOverlayEnter,onLeave:o.onOverlayLeave,onAfterLeave:o.onOverlayAfterLeave},{default:m((()=>[n.overlayVisible?(d(),h("div",{key:0,ref:o.overlayRef,class:o.panelStyleClass,onClick:i[12]||(i[12]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))},[b(e.$slots,"header",{value:t.modelValue,options:o.visibleOptions}),t.filter?(d(),h("div",I,[u("div",D,[O(u("input",{type:"text",ref:"filterInput","onUpdate:modelValue":i[8]||(i[8]=e=>n.filterValue=e),onVnodeUpdated:i[9]||(i[9]=(...e)=>o.onFilterUpdated&&o.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:t.filterPlaceholder,onKeydown:i[10]||(i[10]=(...e)=>o.onFilterKeyDown&&o.onFilterKeyDown(...e)),onInput:i[11]||(i[11]=(...e)=>o.onFilterChange&&o.onFilterChange(...e))},null,40,["placeholder"]),[[w,n.filterValue]]),$])])):c("",!0),u("div",{ref:o.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":o.virtualScrollerDisabled?t.scrollHeight:""}},[u(s,L({ref:o.virtualScrollerRef},t.virtualScrollerOptions,{items:o.visibleOptions,style:{height:t.scrollHeight},disabled:o.virtualScrollerDisabled}),x({content:m((({styleClass:i,contentRef:l,items:s,getItemOptions:a})=>[u("ul",{ref:l,class:["p-dropdown-items",i],role:"listbox"},[t.optionGroupLabel?(d(!0),h(V,{key:1},C(s,((i,t)=>(d(),h(V,{key:o.getOptionGroupRenderKey(i)},[u("li",F,[b(e.$slots,"optiongroup",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionGroupLabel(i)),1)]))]),(d(!0),h(V,null,C(o.getOptionGroupChildren(i),((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128))],64)))),128)):(d(!0),h(V,{key:0},C(s,((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(d(),h("li",G,[b(e.$slots,"emptyfilter",{},(()=>[f(v(o.emptyFilterMessageText),1)]))])):!t.options||t.options&&0===t.options.length?(d(),h("li",K,[b(e.$slots,"empty",{},(()=>[f(v(o.emptyMessageText),1)]))])):c("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:m((({options:i})=>[b(e.$slots,"loader",{options:i})]))}:void 0]),1040,["items","style","disabled"])],4),b(e.$slots,"footer",{value:t.modelValue,options:o.visibleOptions})],2)):c("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export default S;
|
|
1
|
+
import{ZIndexUtils as e,ObjectUtils as i,DomHandler as t,ConnectedOverlayScrollHandler as l}from"primevue/utils";import n from"primevue/overlayeventbus";import{FilterService as o}from"primevue/api";import s from"primevue/ripple";import r from"primevue/virtualscroller";import{resolveComponent as a,resolveDirective as p,openBlock as d,createBlock as h,createVNode as u,createCommentVNode as c,renderSlot as b,createTextVNode as f,toDisplayString as v,Teleport as g,Transition as y,withCtx as m,withDirectives as O,vModelText as w,mergeProps as L,createSlots as V,Fragment as x,renderList as C}from"vue";var S={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,i){return this.virtualScrollerDisabled?e:i&&i(e).index},getOptionLabel(e){return this.optionLabel?i.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?i.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e){return this.dataKey?i.resolveFieldData(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled(e){return!!this.optionDisabled&&i.resolveFieldData(e,this.optionDisabled)},getOptionGroupRenderKey(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupLabel(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return i.resolveFieldData(e,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let i=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==i)return{group:e,option:i}}}return-1},findOptionIndexInList(e,t){for(let l=0;l<t.length;l++)if(i.equals(e,this.getOptionValue(t[l]),this.equalityKey))return l;return-1},isSelected(e){return i.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let i=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let i=this.findPrevOption(this.getSelectedOptionIndex());i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let i=-1===e?0:e.group,t=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i+1!==this.visibleOptions.length?this.findNextOption({group:i+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,i){let t=i+1;if(t===e.length)return null;let l=e[t];return this.isOptionDisabled(l)?this.findNextOptionInList(t):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let i=e.group,t=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i>0?this.findPrevOption({group:i-1,option:this.getOptionGroupChildren(this.visibleOptions[i-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,i){let t=i-1;if(t<0)return null;let l=e[t];return this.isOptionDisabled(l)?this.findPrevOption(t):l},onClearClick(e){this.updateModel(e,null)},onClick(e){this.disabled||this.loading||t.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,i){let t=this.getOptionValue(i);this.updateModel(e,t),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(i){if(e.set("overlay",i,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.scrollValueInView(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(i){e.clear(i)},alignOverlay(){this.appendDisabled?t.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=t.getOuterWidth(this.$el)+"px",t.absolutePosition(this.overlay,this.$el))},updateModel(e,i){this.$emit("update:modelValue",i),this.$emit("change",{originalEvent:e,value:i})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new l(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!t.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const i=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=i,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+i:i,this.searchValue){let i=this.getSelectedOptionIndex(),t=this.optionGroupLabel?this.searchOptionInGroup(i):this.searchOption(++i);t&&this.updateModel(e,this.getOptionValue(t))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let i;return this.searchValue&&(i=this.searchOptionInRange(e,this.visibleOptions.length),i||(i=this.searchOptionInRange(0,e))),i},searchOptionInRange(e,i){for(let t=e;t<i;t++){let e=this.visibleOptions[t];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let i=-1===e?{group:0,option:-1}:e;for(let e=i.group;e<this.visibleOptions.length;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=i.group===e?i.option+1:0;l<t.length;l++)if(this.matchesSearchValue(t[l]))return t[l]}for(let e=0;e<=i.group;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(i.group===e?i.option:t.length);l++)if(this.matchesSearchValue(t[l]))return t[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let e=t.findSingle(this.overlay,"li.p-highlight");e&&e.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let i of this.options){let t=o.filter(this.getOptionGroupChildren(i),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(t&&t.length){let l={...i};l[this.optionGroupChildren]=t,e.push(l)}}return e}return o.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:s},components:{VirtualScroller:r}};const k={class:"p-hidden-accessible"},I={key:0,class:"p-dropdown-header"},D={class:"p-dropdown-filter-container"},$=u("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),F={class:"p-dropdown-item-group"},G={key:2,class:"p-dropdown-empty-message"},K={key:3,class:"p-dropdown-empty-message"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===t&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),S.render=function(e,i,t,l,n,o){const s=a("VirtualScroller"),r=p("ripple");return d(),h("div",{ref:"container",class:o.containerClass,onClick:i[13]||(i[13]=e=>o.onClick(e))},[u("div",k,[u("input",{ref:"focusInput",type:"text",id:t.inputId,readonly:"",disabled:t.disabled,onFocus:i[1]||(i[1]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[2]||(i[2]=(...e)=>o.onBlur&&o.onBlur(...e)),onKeydown:i[3]||(i[3]=(...e)=>o.onKeyDown&&o.onKeyDown(...e)),tabindex:t.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":t.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),t.editable?(d(),h("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:t.disabled,onFocus:i[4]||(i[4]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[5]||(i[5]=(...e)=>o.onBlur&&o.onBlur(...e)),placeholder:t.placeholder,value:o.editableInputValue,onInput:i[6]||(i[6]=(...e)=>o.onEditableInput&&o.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):c("",!0),t.editable?c("",!0):(d(),h("span",{key:1,class:o.labelClass},[b(e.$slots,"value",{value:t.modelValue,placeholder:t.placeholder},(()=>[f(v(o.label||"empty"),1)]))],2)),t.showClear&&null!=t.modelValue?(d(),h("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:i[7]||(i[7]=e=>o.onClearClick(e))})):c("",!0),u("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[b(e.$slots,"indicator",{},(()=>[u("span",{class:o.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(d(),h(g,{to:o.appendTarget,disabled:o.appendDisabled},[u(y,{name:"p-connected-overlay",onEnter:o.onOverlayEnter,onLeave:o.onOverlayLeave,onAfterLeave:o.onOverlayAfterLeave},{default:m((()=>[n.overlayVisible?(d(),h("div",{key:0,ref:o.overlayRef,class:o.panelStyleClass,onClick:i[12]||(i[12]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))},[b(e.$slots,"header",{value:t.modelValue,options:o.visibleOptions}),t.filter?(d(),h("div",I,[u("div",D,[O(u("input",{type:"text",ref:"filterInput","onUpdate:modelValue":i[8]||(i[8]=e=>n.filterValue=e),onVnodeUpdated:i[9]||(i[9]=(...e)=>o.onFilterUpdated&&o.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:t.filterPlaceholder,onKeydown:i[10]||(i[10]=(...e)=>o.onFilterKeyDown&&o.onFilterKeyDown(...e)),onInput:i[11]||(i[11]=(...e)=>o.onFilterChange&&o.onFilterChange(...e))},null,40,["placeholder"]),[[w,n.filterValue]]),$])])):c("",!0),u("div",{ref:o.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":o.virtualScrollerDisabled?t.scrollHeight:""}},[u(s,L({ref:o.virtualScrollerRef},t.virtualScrollerOptions,{items:o.visibleOptions,style:{height:t.scrollHeight},disabled:o.virtualScrollerDisabled}),V({content:m((({styleClass:i,contentRef:l,items:s,getItemOptions:a})=>[u("ul",{ref:l,class:["p-dropdown-items",i],role:"listbox"},[t.optionGroupLabel?(d(!0),h(x,{key:1},C(s,((i,t)=>(d(),h(x,{key:o.getOptionGroupRenderKey(i)},[u("li",F,[b(e.$slots,"optiongroup",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionGroupLabel(i)),1)]))]),(d(!0),h(x,null,C(o.getOptionGroupChildren(i),((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128))],64)))),128)):(d(!0),h(x,{key:0},C(s,((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(d(),h("li",G,[b(e.$slots,"emptyfilter",{},(()=>[f(v(o.emptyFilterMessageText),1)]))])):!t.options||t.options&&0===t.options.length?(d(),h("li",K,[b(e.$slots,"empty",{},(()=>[f(v(o.emptyMessageText),1)]))])):c("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:m((({options:i})=>[b(e.$slots,"loader",{options:i})]))}:void 0]),1040,["items","style","disabled"])],4),b(e.$slots,"footer",{value:t.modelValue,options:o.visibleOptions})],2)):c("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export default S;
|
package/dropdown/dropdown.js
CHANGED
|
@@ -372,6 +372,7 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
372
372
|
this.bindOutsideClickListener();
|
|
373
373
|
this.bindScrollListener();
|
|
374
374
|
this.bindResizeListener();
|
|
375
|
+
this.scrollValueInView();
|
|
375
376
|
|
|
376
377
|
if (this.filter) {
|
|
377
378
|
this.$refs.filterInput.focus();
|
package/dropdown/dropdown.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,l,n,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&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.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},d}(primevue.utils,primevue.overlayeventbus,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,l,n,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.scrollValueInView(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&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.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\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 -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},d}(primevue.utils,primevue.overlayeventbus,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
|
|
1
3
|
interface FileUploadProps {
|
|
2
4
|
name?: string;
|
|
3
5
|
url?: string;
|
|
@@ -34,6 +36,9 @@ declare class FileUpload {
|
|
|
34
36
|
$emit(eventName: 'before-send', e: { xhr: XMLHttpRequest, formData: any }): this;
|
|
35
37
|
$emit(eventName: 'clear'): this;
|
|
36
38
|
$emit(eventName: 'remove', e: { file: File, files: File[] }): this;
|
|
39
|
+
$slots: {
|
|
40
|
+
empty: VNode[];
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
export default FileUpload;
|
package/galleria/Galleria.d.ts
CHANGED
|
@@ -27,6 +27,22 @@ interface GalleriaProps {
|
|
|
27
27
|
containerClass?: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
interface GalleriaItemSlotInterface {
|
|
31
|
+
item: any;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface GalleriaCaptionSlotInterface {
|
|
35
|
+
item: any;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface GalleriaIndicatorlotInterface {
|
|
39
|
+
index: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface GalleriaThumbnailSlotInterface {
|
|
43
|
+
item: any;
|
|
44
|
+
}
|
|
45
|
+
|
|
30
46
|
declare class Galleria {
|
|
31
47
|
$props: GalleriaProps;
|
|
32
48
|
$emit(eventName: 'update:activeIndex', value: number): this;
|
|
@@ -34,10 +50,10 @@ declare class Galleria {
|
|
|
34
50
|
$slots: {
|
|
35
51
|
header: VNode[];
|
|
36
52
|
footer: VNode[];
|
|
37
|
-
item:
|
|
38
|
-
caption:
|
|
39
|
-
indicator:
|
|
40
|
-
thumbnail:
|
|
53
|
+
item: GalleriaItemSlotInterface;
|
|
54
|
+
caption: GalleriaCaptionSlotInterface;
|
|
55
|
+
indicator: GalleriaIndicatorlotInterface;
|
|
56
|
+
thumbnail: GalleriaThumbnailSlotInterface;
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
|
package/inplace/Inplace.d.ts
CHANGED
package/inplace/Inplace.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="containerClass">
|
|
3
|
-
<div class="
|
|
3
|
+
<div :class="displayClass" :tabindex="$attrs.tabindex||'0'" v-if="!d_active" @click="open" @keydown.enter="open">
|
|
4
4
|
<slot name="display"></slot>
|
|
5
5
|
</div>
|
|
6
6
|
<div class="p-inplace-content" v-else>
|
|
@@ -24,6 +24,10 @@ export default {
|
|
|
24
24
|
active: {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
default: false
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
watch: {
|
|
@@ -38,6 +42,10 @@ export default {
|
|
|
38
42
|
},
|
|
39
43
|
methods: {
|
|
40
44
|
open(event) {
|
|
45
|
+
if (this.disabled) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
this.$emit('open', event);
|
|
42
50
|
this.d_active = true;
|
|
43
51
|
this.$emit('update:active', true);
|
|
@@ -51,6 +59,9 @@ export default {
|
|
|
51
59
|
computed: {
|
|
52
60
|
containerClass() {
|
|
53
61
|
return ['p-inplace p-component', {'p-inplace-closable': this.closable}];
|
|
62
|
+
},
|
|
63
|
+
displayClass() {
|
|
64
|
+
return ['p-inplace-display', {'p-disabled': this.disabled}];
|
|
54
65
|
}
|
|
55
66
|
},
|
|
56
67
|
components: {
|