primevue 3.8.2 → 3.11.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.d.ts +74 -11
- package/accordion/accordion.esm.js +1 -1
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +1 -1
- package/accordiontab/AccordionTab.d.ts +37 -8
- package/accordiontab/accordiontab.esm.js +1 -1
- package/accordiontab/accordiontab.esm.min.js +1 -1
- package/accordiontab/accordiontab.js +1 -1
- package/api/Api.d.ts +292 -251
- 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 +67 -33
- package/api/api.min.js +1 -1
- package/autocomplete/AutoComplete.d.ts +280 -63
- package/autocomplete/AutoComplete.vue +16 -9
- package/autocomplete/autocomplete.cjs.js +23 -15
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +20 -12
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +24 -16
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/Avatar.d.ts +57 -8
- package/avatar/avatar.esm.js +1 -1
- package/avatar/avatar.esm.min.js +1 -1
- package/avatar/avatar.js +1 -1
- package/avatargroup/AvatarGroup.d.ts +29 -3
- package/avatargroup/avatargroup.esm.js +1 -1
- package/avatargroup/avatargroup.esm.min.js +1 -1
- package/avatargroup/avatargroup.js +1 -1
- package/badge/Badge.d.ts +46 -5
- package/badge/badge.esm.js +1 -1
- package/badge/badge.esm.min.js +1 -1
- package/badge/badge.js +1 -1
- package/badgedirective/badgedirective.esm.js +1 -1
- package/badgedirective/badgedirective.esm.min.js +1 -1
- package/badgedirective/badgedirective.js +1 -1
- package/blockui/BlockUI.d.ts +52 -11
- package/blockui/blockui.esm.js +1 -1
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +1 -1
- package/breadcrumb/Breadcrumb.d.ts +49 -9
- package/breadcrumb/BreadcrumbItem.vue +5 -2
- package/breadcrumb/breadcrumb.cjs.js +5 -2
- 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/button/Button.d.ts +68 -11
- package/button/button.cjs.js +1 -1
- package/button/button.esm.js +1 -1
- package/button/button.esm.min.js +1 -1
- package/button/button.js +2 -2
- package/calendar/Calendar.d.ts +320 -58
- package/calendar/Calendar.vue +406 -84
- package/calendar/calendar.cjs.js +521 -204
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +521 -203
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +523 -205
- package/calendar/calendar.min.js +1 -1
- package/card/Card.d.ts +43 -9
- package/card/card.esm.js +1 -1
- package/card/card.esm.min.js +1 -1
- package/card/card.js +1 -1
- package/carousel/Carousel.d.ts +121 -24
- package/carousel/Carousel.vue +2 -2
- package/carousel/carousel.cjs.js +7 -7
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +7 -7
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +8 -8
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/CascadeSelect.d.ts +172 -35
- package/cascadeselect/cascadeselect.cjs.js +2 -2
- package/cascadeselect/cascadeselect.esm.js +1 -1
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +3 -3
- package/chart/Chart.d.ts +104 -12
- package/chart/Chart.vue +18 -4
- package/chart/chart.cjs.js +20 -8
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +19 -5
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +19 -5
- package/chart/chart.min.js +1 -1
- package/checkbox/Checkbox.d.ts +66 -8
- package/checkbox/checkbox.esm.js +1 -1
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +1 -1
- package/chip/Chip.d.ts +50 -4
- package/chip/chip.esm.js +1 -1
- package/chip/chip.esm.min.js +1 -1
- package/chip/chip.js +1 -1
- package/chips/Chips.d.ts +88 -15
- package/chips/chips.esm.js +1 -1
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +1 -1
- package/colorpicker/ColorPicker.d.ts +105 -13
- package/colorpicker/ColorPicker.vue +6 -1
- package/colorpicker/colorpicker.cjs.js +7 -2
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +7 -2
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +8 -3
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +448 -78
- package/column/column.esm.js +1 -1
- package/column/column.esm.min.js +1 -1
- package/column/column.js +1 -1
- package/columngroup/ColumnGroup.d.ts +30 -4
- package/columngroup/columngroup.esm.js +1 -1
- package/columngroup/columngroup.esm.min.js +1 -1
- package/columngroup/columngroup.js +1 -1
- package/config/config.cjs.js +1 -1
- package/config/config.esm.js +1 -2
- package/config/config.esm.min.js +1 -1
- package/config/config.js +2 -2
- package/confirmationeventbus/confirmationeventbus.esm.js +1 -1
- package/confirmationeventbus/confirmationeventbus.esm.min.js +1 -1
- package/confirmationeventbus/confirmationeventbus.js +1 -1
- package/confirmationoptions/ConfirmationOptions.d.ts +58 -0
- package/confirmationoptions/package.json +3 -0
- package/confirmationservice/ConfirmationService.d.ts +2 -1
- package/confirmationservice/confirmationservice.cjs.js +2 -2
- package/confirmationservice/confirmationservice.esm.js +1 -1
- package/confirmationservice/confirmationservice.esm.min.js +1 -1
- package/confirmationservice/confirmationservice.js +3 -3
- package/confirmdialog/ConfirmDialog.d.ts +57 -5
- package/confirmdialog/ConfirmDialog.vue +8 -2
- package/confirmdialog/confirmdialog.cjs.js +17 -10
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +12 -5
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +18 -11
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/confirmpopup/ConfirmPopup.d.ts +41 -3
- package/confirmpopup/ConfirmPopup.vue +7 -4
- package/confirmpopup/confirmpopup.cjs.js +19 -11
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +15 -7
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +20 -12
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/ContextMenu.d.ts +88 -16
- package/contextmenu/ContextMenuSub.vue +7 -4
- 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 +9 -6
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +861 -383
- package/core/core.min.js +15 -13
- package/datatable/BodyCell.vue +27 -1
- package/datatable/ColumnFilter.vue +17 -6
- package/datatable/DataTable.d.ts +1056 -130
- package/datatable/DataTable.vue +150 -131
- package/datatable/HeaderCheckbox.vue +5 -2
- package/datatable/RowCheckbox.vue +1 -1
- package/datatable/RowRadioButton.vue +1 -1
- package/datatable/TableBody.vue +57 -14
- package/datatable/TableFooter.vue +15 -1
- package/datatable/TableHeader.vue +15 -1
- package/datatable/datatable.cjs.js +542 -381
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +533 -373
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +543 -383
- package/datatable/datatable.min.js +1 -1
- package/dataview/DataView.d.ts +198 -32
- package/dataview/DataView.vue +8 -8
- package/dataview/dataview.cjs.js +13 -13
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +13 -13
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +14 -14
- package/dataview/dataview.min.js +1 -1
- package/dataviewlayoutoptions/DataViewLayoutOptions.d.ts +34 -5
- package/dataviewlayoutoptions/dataviewlayoutoptions.esm.js +1 -1
- package/dataviewlayoutoptions/dataviewlayoutoptions.esm.min.js +1 -1
- package/dataviewlayoutoptions/dataviewlayoutoptions.js +1 -1
- package/deferredcontent/DeferredContent.d.ts +31 -6
- package/deferredcontent/deferredcontent.esm.js +1 -1
- package/deferredcontent/deferredcontent.esm.min.js +1 -1
- package/deferredcontent/deferredcontent.js +1 -1
- package/dialog/Dialog.d.ts +187 -34
- package/dialog/Dialog.vue +1 -1
- package/dialog/dialog.cjs.js +2 -3
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +2 -3
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +3 -4
- package/dialog/dialog.min.js +1 -1
- package/divider/Divider.d.ts +53 -8
- package/divider/divider.esm.js +1 -1
- package/divider/divider.esm.min.js +1 -1
- package/divider/divider.js +1 -1
- package/dock/Dock.d.ts +92 -15
- package/dock/DockSub.vue +3 -1
- package/dock/dock.cjs.js +4 -1
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +4 -2
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +5 -3
- package/dock/dock.min.js +1 -1
- package/dropdown/Dropdown.d.ts +340 -76
- package/dropdown/Dropdown.vue +1 -1
- package/dropdown/dropdown.cjs.js +4 -4
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +2 -2
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +5 -5
- package/dropdown/dropdown.min.js +1 -1
- package/editor/Editor.d.ts +78 -11
- package/editor/editor.cjs.js +1 -1
- package/editor/editor.esm.js +1 -1
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +2 -2
- package/fieldset/Fieldset.d.ts +63 -11
- package/fieldset/fieldset.cjs.js +1 -1
- package/fieldset/fieldset.esm.js +1 -1
- package/fieldset/fieldset.esm.min.js +1 -1
- package/fieldset/fieldset.js +2 -2
- package/fileupload/FileUpload.d.ts +255 -37
- package/fileupload/fileupload.cjs.js +4 -4
- package/fileupload/fileupload.esm.js +1 -1
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +5 -5
- package/fullcalendar/FullCalendar.d.ts +29 -3
- package/fullcalendar/fullcalendar.esm.js +1 -1
- package/fullcalendar/fullcalendar.esm.min.js +1 -1
- package/fullcalendar/fullcalendar.js +1 -1
- package/galleria/Galleria.d.ts +196 -46
- package/galleria/galleria.cjs.js +3 -3
- package/galleria/galleria.esm.js +1 -1
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +4 -4
- package/image/Image.d.ts +51 -6
- package/image/image.esm.js +1 -1
- package/image/image.esm.min.js +1 -1
- package/image/image.js +1 -1
- package/inlinemessage/InlineMessage.d.ts +34 -6
- package/inlinemessage/inlinemessage.esm.js +1 -1
- package/inlinemessage/inlinemessage.esm.min.js +1 -1
- package/inlinemessage/inlinemessage.js +1 -1
- package/inplace/Inplace.d.ts +57 -12
- package/inplace/inplace.cjs.js +1 -1
- package/inplace/inplace.esm.js +1 -1
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +2 -2
- package/inputmask/InputMask.d.ts +75 -15
- package/inputmask/inputmask.esm.js +1 -1
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +1 -1
- package/inputnumber/InputNumber.d.ts +180 -30
- package/inputnumber/InputNumber.vue +19 -3
- package/inputnumber/inputnumber.cjs.js +21 -5
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +20 -4
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +22 -6
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/InputSwitch.d.ts +61 -9
- package/inputswitch/inputswitch.esm.js +1 -1
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +1 -1
- package/inputtext/InputText.d.ts +34 -5
- 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 +4 -4
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +3 -3
- package/inputtext/inputtext.min.js +1 -1
- package/knob/Knob.d.ts +92 -18
- package/knob/knob.esm.js +1 -1
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +1 -1
- package/listbox/Listbox.d.ts +246 -56
- package/listbox/listbox.cjs.js +2 -2
- package/listbox/listbox.esm.js +1 -1
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +3 -3
- package/megamenu/MegaMenu.d.ts +60 -12
- package/megamenu/MegaMenu.vue +10 -7
- 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 +12 -9
- package/megamenu/megamenu.min.js +1 -1
- package/menu/Menu.d.ts +84 -15
- package/menu/Menu.vue +6 -3
- package/menu/Menuitem.vue +5 -2
- package/menu/menu.cjs.js +13 -7
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +12 -6
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +14 -8
- package/menu/menu.min.js +1 -1
- package/menubar/Menubar.d.ts +52 -11
- package/menubar/Menubar.vue +1 -0
- package/menubar/MenubarSub.vue +7 -4
- package/menubar/menubar.cjs.js +9 -6
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +9 -6
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +10 -7
- package/menubar/menubar.min.js +1 -1
- package/menuitem/MenuItem.d.ts +82 -0
- package/menuitem/package.json +3 -0
- package/message/Message.d.ts +57 -10
- package/message/Message.vue +6 -2
- package/message/message.cjs.js +7 -3
- package/message/message.cjs.min.js +1 -1
- package/message/message.esm.js +7 -3
- package/message/message.esm.min.js +1 -1
- package/message/message.js +8 -4
- package/message/message.min.js +1 -1
- package/multiselect/MultiSelect.d.ts +368 -83
- package/multiselect/multiselect.cjs.js +3 -3
- package/multiselect/multiselect.esm.js +1 -1
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +4 -4
- package/orderlist/OrderList.d.ts +122 -17
- package/orderlist/OrderList.vue +2 -0
- package/orderlist/orderlist.cjs.js +5 -3
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +4 -2
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +6 -4
- package/orderlist/orderlist.min.js +1 -1
- package/organizationchart/OrganizationChart.d.ts +137 -15
- package/organizationchart/OrganizationChart.vue +1 -0
- package/organizationchart/organizationchart.cjs.js +1 -1
- package/organizationchart/organizationchart.cjs.min.js +1 -1
- package/organizationchart/organizationchart.esm.js +2 -2
- package/organizationchart/organizationchart.esm.min.js +1 -1
- package/organizationchart/organizationchart.js +2 -2
- package/organizationchart/organizationchart.min.js +1 -1
- package/overlayeventbus/overlayeventbus.esm.js +1 -1
- package/overlayeventbus/overlayeventbus.esm.min.js +1 -1
- package/overlayeventbus/overlayeventbus.js +1 -1
- package/overlaypanel/OverlayPanel.d.ts +107 -12
- package/overlaypanel/overlaypanel.cjs.js +5 -5
- package/overlaypanel/overlaypanel.esm.js +1 -1
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +6 -6
- package/package.json +5 -1
- package/paginator/Paginator.d.ts +129 -27
- package/paginator/Paginator.vue +4 -4
- package/paginator/paginator.cjs.js +12 -12
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +5 -5
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +13 -13
- package/paginator/paginator.min.js +1 -1
- package/panel/Panel.d.ts +64 -8
- package/panel/Panel.vue +1 -1
- package/panel/panel.cjs.js +1 -1
- package/panel/panel.esm.js +1 -1
- package/panel/panel.esm.min.js +1 -1
- package/panel/panel.js +2 -2
- package/panelmenu/PanelMenu.d.ts +59 -11
- package/panelmenu/PanelMenu.vue +8 -5
- package/panelmenu/PanelMenuSub.vue +8 -5
- package/panelmenu/panelmenu.cjs.js +18 -12
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +19 -13
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +19 -13
- package/panelmenu/panelmenu.min.js +1 -1
- package/password/Password.d.ts +115 -24
- package/password/password.cjs.js +2 -2
- package/password/password.esm.js +1 -1
- package/password/password.esm.min.js +1 -1
- package/password/password.js +3 -3
- package/picklist/PickList.d.ts +199 -26
- package/picklist/PickList.vue +10 -4
- package/picklist/picklist.cjs.js +15 -9
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +14 -8
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +16 -10
- package/picklist/picklist.min.js +1 -1
- package/progressbar/ProgressBar.d.ts +43 -8
- 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 +15 -14
- package/progressbar/progressbar.esm.min.js +1 -1
- package/progressbar/progressbar.js +14 -13
- package/progressbar/progressbar.min.js +1 -1
- package/progressspinner/ProgressSpinner.d.ts +39 -6
- package/progressspinner/progressspinner.esm.js +1 -1
- package/progressspinner/progressspinner.esm.min.js +1 -1
- package/progressspinner/progressspinner.js +1 -1
- package/radiobutton/RadioButton.d.ts +52 -7
- package/radiobutton/radiobutton.esm.js +1 -1
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +1 -1
- package/rating/Rating.d.ts +67 -10
- 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 +2 -2
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +2 -2
- 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 +81 -33
- package/resources/themes/arya-green/theme.css +81 -33
- package/resources/themes/arya-orange/theme.css +81 -33
- package/resources/themes/arya-purple/theme.css +81 -33
- package/resources/themes/bootstrap4-dark-blue/theme.css +62 -21
- package/resources/themes/bootstrap4-dark-purple/theme.css +62 -21
- package/resources/themes/bootstrap4-light-blue/theme.css +62 -21
- package/resources/themes/bootstrap4-light-purple/theme.css +62 -21
- package/resources/themes/fluent-light/theme.css +81 -33
- 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 +5421 -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 +5421 -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 +5421 -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 +5421 -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 +5421 -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 +5421 -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 +5421 -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 +5421 -0
- package/resources/themes/luna-amber/theme.css +78 -37
- package/resources/themes/luna-blue/theme.css +78 -37
- package/resources/themes/luna-green/theme.css +78 -37
- package/resources/themes/luna-pink/theme.css +78 -37
- package/resources/themes/md-dark-deeppurple/theme.css +252 -48
- package/resources/themes/md-dark-indigo/theme.css +252 -48
- package/resources/themes/md-light-deeppurple/theme.css +252 -48
- package/resources/themes/md-light-indigo/theme.css +252 -48
- package/resources/themes/mdc-dark-deeppurple/theme.css +252 -48
- package/resources/themes/mdc-dark-indigo/theme.css +252 -48
- package/resources/themes/mdc-light-deeppurple/theme.css +252 -48
- package/resources/themes/mdc-light-indigo/theme.css +252 -48
- package/resources/themes/nova/theme.css +78 -37
- package/resources/themes/nova-accent/theme.css +78 -37
- package/resources/themes/nova-alt/theme.css +78 -37
- package/resources/themes/nova-vue/theme.css +78 -37
- package/resources/themes/rhea/theme.css +78 -37
- package/resources/themes/saga-blue/theme.css +65 -17
- package/resources/themes/saga-green/theme.css +65 -17
- package/resources/themes/saga-orange/theme.css +65 -17
- package/resources/themes/saga-purple/theme.css +65 -17
- package/resources/themes/tailwind-light/theme.css +92 -36
- package/resources/themes/vela-blue/theme.css +81 -33
- package/resources/themes/vela-green/theme.css +81 -33
- package/resources/themes/vela-orange/theme.css +81 -33
- package/resources/themes/vela-purple/theme.css +81 -33
- package/ripple/ripple.esm.js +1 -1
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -1
- package/row/Row.d.ts +25 -3
- package/row/row.esm.js +1 -1
- package/row/row.esm.min.js +1 -1
- package/row/row.js +1 -1
- package/scrollpanel/ScrollPanel.d.ts +27 -5
- package/scrollpanel/scrollpanel.esm.js +1 -1
- package/scrollpanel/scrollpanel.esm.min.js +1 -1
- package/scrollpanel/scrollpanel.js +1 -1
- package/scrolltop/ScrollTop.d.ts +47 -7
- package/scrolltop/scrolltop.esm.js +1 -1
- package/scrolltop/scrolltop.esm.min.js +1 -1
- package/scrolltop/scrolltop.js +1 -1
- package/selectbutton/SelectButton.d.ts +108 -19
- package/selectbutton/SelectButton.vue +8 -2
- package/selectbutton/selectbutton.cjs.js +15 -10
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +15 -10
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +16 -11
- package/selectbutton/selectbutton.min.js +1 -1
- package/sidebar/Sidebar.d.ts +81 -16
- package/sidebar/sidebar.cjs.js +1 -1
- package/sidebar/sidebar.esm.js +1 -1
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +2 -2
- package/skeleton/Skeleton.d.ts +58 -9
- package/skeleton/skeleton.esm.js +1 -1
- package/skeleton/skeleton.esm.min.js +1 -1
- package/skeleton/skeleton.js +1 -1
- package/slider/Slider.d.ts +90 -14
- package/slider/slider.esm.js +1 -1
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +1 -1
- package/speeddial/SpeedDial.d.ts +166 -29
- package/speeddial/SpeedDial.vue +3 -1
- package/speeddial/speeddial.cjs.js +5 -2
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +4 -2
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +6 -4
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/SplitButton.d.ts +76 -11
- package/splitbutton/SplitButton.vue +3 -1
- package/splitbutton/splitbutton.cjs.js +15 -13
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +15 -13
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +16 -14
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/Splitter.d.ts +74 -7
- package/splitter/Splitter.vue +5 -5
- package/splitter/splitter.cjs.js +1 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +2 -2
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +2 -2
- package/splitter/splitter.min.js +1 -1
- package/splitterpanel/SplitterPanel.d.ts +34 -7
- package/splitterpanel/splitterpanel.esm.js +1 -1
- package/splitterpanel/splitterpanel.esm.min.js +1 -1
- package/splitterpanel/splitterpanel.js +1 -1
- package/steps/Steps.d.ts +51 -11
- 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 +6 -3
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +6 -3
- package/steps/steps.min.js +1 -1
- package/styleclass/styleclass.esm.js +1 -1
- package/styleclass/styleclass.esm.min.js +1 -1
- package/styleclass/styleclass.js +1 -1
- package/tabmenu/TabMenu.d.ts +63 -10
- package/tabmenu/TabMenu.vue +6 -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 +8 -5
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabpanel/TabPanel.d.ts +38 -7
- package/tabpanel/tabpanel.esm.js +1 -1
- package/tabpanel/tabpanel.esm.min.js +1 -1
- package/tabpanel/tabpanel.js +1 -1
- package/tabview/TabView.d.ts +73 -11
- package/tabview/tabview.cjs.js +1 -1
- package/tabview/tabview.esm.js +1 -1
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +2 -2
- package/tag/Tag.d.ts +44 -8
- package/tag/Tag.vue +1 -1
- package/tag/tag.cjs.js +6 -6
- package/tag/tag.cjs.min.js +1 -1
- package/tag/tag.esm.js +8 -8
- package/tag/tag.esm.min.js +1 -1
- package/tag/tag.js +7 -7
- package/tag/tag.min.js +1 -1
- package/terminal/Terminal.d.ts +36 -5
- package/terminal/terminal.cjs.js +3 -3
- package/terminal/terminal.esm.js +1 -1
- package/terminal/terminal.esm.min.js +1 -1
- package/terminal/terminal.js +4 -4
- package/terminalservice/TerminalService.d.ts +9 -6
- package/terminalservice/terminalservice.esm.js +1 -1
- package/terminalservice/terminalservice.esm.min.js +1 -1
- package/terminalservice/terminalservice.js +1 -1
- package/textarea/Textarea.d.ts +38 -6
- package/textarea/textarea.esm.js +1 -1
- package/textarea/textarea.esm.min.js +1 -1
- package/textarea/textarea.js +1 -1
- package/tieredmenu/TieredMenu.d.ts +89 -15
- package/tieredmenu/TieredMenuSub.vue +7 -4
- package/tieredmenu/tieredmenu.cjs.js +9 -6
- 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 +10 -7
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/Timeline.d.ts +94 -15
- package/timeline/timeline.esm.js +1 -1
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +1 -1
- package/toast/Toast.d.ts +118 -12
- package/toast/toast.cjs.js +7 -7
- package/toast/toast.esm.js +1 -1
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +8 -8
- package/toasteventbus/toasteventbus.esm.js +1 -1
- package/toasteventbus/toasteventbus.esm.min.js +1 -1
- package/toasteventbus/toasteventbus.js +1 -1
- package/toastservice/ToastService.d.ts +17 -5
- package/toastservice/toastservice.cjs.js +3 -3
- package/toastservice/toastservice.esm.js +1 -1
- package/toastservice/toastservice.esm.min.js +1 -1
- package/toastservice/toastservice.js +4 -4
- package/togglebutton/ToggleButton.d.ts +64 -11
- package/togglebutton/togglebutton.cjs.js +1 -1
- package/togglebutton/togglebutton.esm.js +1 -1
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +2 -2
- package/toolbar/Toolbar.d.ts +31 -6
- package/toolbar/Toolbar.vue +2 -2
- package/toolbar/toolbar.cjs.js +2 -2
- package/toolbar/toolbar.cjs.min.js +1 -1
- package/toolbar/toolbar.esm.js +3 -3
- package/toolbar/toolbar.esm.min.js +1 -1
- package/toolbar/toolbar.js +3 -3
- package/toolbar/toolbar.min.js +1 -1
- package/tooltip/tooltip.esm.js +1 -1
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +1 -1
- package/tree/Tree.d.ts +189 -26
- package/tree/Tree.vue +1 -0
- package/tree/TreeNode.vue +4 -1
- package/tree/tree.cjs.js +6 -3
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +6 -3
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +7 -4
- package/tree/tree.min.js +1 -1
- package/treeselect/TreeSelect.d.ts +201 -44
- package/treeselect/TreeSelect.vue +9 -0
- package/treeselect/treeselect.cjs.js +12 -3
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +10 -1
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +13 -4
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/BodyCell.vue +3 -3
- package/treetable/TreeTable.d.ts +459 -63
- package/treetable/TreeTable.vue +9 -9
- package/treetable/treetable.cjs.js +17 -17
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +16 -16
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +18 -18
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/TriStateCheckbox.d.ts +40 -6
- package/tristatecheckbox/tristatecheckbox.esm.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +1 -1
- package/ts-helpers.d.ts +28 -0
- package/useconfirm/UseConfirm.d.ts +5 -19
- package/useconfirm/useconfirm.js +1 -1
- package/usetoast/UseToast.d.ts +3 -5
- package/usetoast/usetoast.js +1 -1
- package/utils/Utils.d.ts +3 -0
- package/utils/utils.cjs.js +41 -4
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +41 -4
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +42 -5
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +66 -30
- package/vetur-tags.json +16 -7
- package/virtualscroller/VirtualScroller.d.ts +294 -53
- package/virtualscroller/VirtualScroller.vue +296 -255
- package/virtualscroller/virtualscroller.cjs.js +325 -266
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +326 -267
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +326 -267
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +296 -47
package/chip/Chip.d.ts
CHANGED
|
@@ -1,14 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
3
|
+
|
|
4
|
+
export interface ChipProps {
|
|
5
|
+
/**
|
|
6
|
+
* Defines the text to display.
|
|
7
|
+
*/
|
|
2
8
|
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Defines the icon to display.
|
|
11
|
+
*/
|
|
3
12
|
icon?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Defines the image to display.
|
|
15
|
+
*/
|
|
4
16
|
image?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to display a remove icon.
|
|
19
|
+
*/
|
|
5
20
|
removable?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Icon of the remove element.
|
|
23
|
+
* Default value is 'pi pi-times-circle'.
|
|
24
|
+
*/
|
|
6
25
|
removeIcon?: string;
|
|
7
26
|
}
|
|
8
27
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
28
|
+
export interface ChipSlots {
|
|
29
|
+
/**
|
|
30
|
+
* Content can easily be customized with the default slot instead of using the built-in modes.
|
|
31
|
+
*/
|
|
32
|
+
default: () => VNode[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare type ChipEmits = {
|
|
36
|
+
/**
|
|
37
|
+
* Callback to invoke when a chip is removed.
|
|
38
|
+
* @param {Event} event - Browser event.
|
|
39
|
+
*/
|
|
40
|
+
'remove': (event: Event) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare class Chip extends ClassComponent<ChipProps, ChipSlots, ChipEmits> { }
|
|
44
|
+
|
|
45
|
+
declare module '@vue/runtime-core' {
|
|
46
|
+
interface GlobalComponents {
|
|
47
|
+
Chip: GlobalComponentConstructor<Chip>
|
|
48
|
+
}
|
|
12
49
|
}
|
|
13
50
|
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* Chip represents entities using icons, labels and images.
|
|
54
|
+
*
|
|
55
|
+
* Demos:
|
|
56
|
+
*
|
|
57
|
+
* - [Chip](https://www.primefaces.org/primevue/showcase/#/chip)
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
14
60
|
export default Chip;
|
package/chip/chip.esm.js
CHANGED
package/chip/chip.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{openBlock as e,createBlock as n,renderSlot as i,createCommentVNode as t,toDisplayString as l,withKeys as s}from"vue";var o={name:"Chip",emits:["remove"],props:{label:{type:String,default:null},icon:{type:String,default:null},image:{type:String,default:null},removable:{type:Boolean,default:!1},removeIcon:{type:String,default:"pi pi-times-circle"}},data:()=>({visible:!0}),methods:{close(e){this.visible=!1,this.$emit("remove",e)}},computed:{containerClass(){return["p-chip p-component",{"p-chip-image":null!=this.image}]},iconClass(){return["p-chip-icon",this.icon]},removeIconClass(){return["p-chip-remove-icon",this.removeIcon]}}};const c={key:2,class:"p-chip-text"};!function(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&t.firstChild?t.insertBefore(l,t.firstChild):t.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-chip {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-chip-text {\n line-height: 1.5;\n}\n.p-chip-icon.pi {\n line-height: 1.5;\n}\n.p-chip-remove-icon {\n line-height: 1.5;\n cursor: pointer;\n}\n.p-chip img {\n border-radius: 50%;\n}\n"),o.render=function(o,a,r,p,d,m){return d.visible?(e(),n("div",{key:0,class:m.containerClass},[i(o.$slots,"default",{},(()=>[r.image?(e(),n("img",{key:0,src:r.image},null,8,["src"])):r.icon?(e(),n("span",{key:1,class:m.iconClass},null,2)):t("",!0),r.label?(e(),n("div",c,l(r.label),1)):t("",!0)])),r.removable?(e(),n("span",{key:0,tabindex:"0",class:m.removeIconClass,onClick:a[1]||(a[1]=(...e)=>m.close&&m.close(...e)),onKeydown:a[2]||(a[2]=s(((...e)=>m.close&&m.close(...e)),["enter"]))},null,34)):t("",!0)],2)):t("",!0)};export default
|
|
1
|
+
import{openBlock as e,createBlock as n,renderSlot as i,createCommentVNode as t,toDisplayString as l,withKeys as s}from"vue";var o={name:"Chip",emits:["remove"],props:{label:{type:String,default:null},icon:{type:String,default:null},image:{type:String,default:null},removable:{type:Boolean,default:!1},removeIcon:{type:String,default:"pi pi-times-circle"}},data:()=>({visible:!0}),methods:{close(e){this.visible=!1,this.$emit("remove",e)}},computed:{containerClass(){return["p-chip p-component",{"p-chip-image":null!=this.image}]},iconClass(){return["p-chip-icon",this.icon]},removeIconClass(){return["p-chip-remove-icon",this.removeIcon]}}};const c={key:2,class:"p-chip-text"};!function(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&t.firstChild?t.insertBefore(l,t.firstChild):t.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-chip {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-chip-text {\n line-height: 1.5;\n}\n.p-chip-icon.pi {\n line-height: 1.5;\n}\n.p-chip-remove-icon {\n line-height: 1.5;\n cursor: pointer;\n}\n.p-chip img {\n border-radius: 50%;\n}\n"),o.render=function(o,a,r,p,d,m){return d.visible?(e(),n("div",{key:0,class:m.containerClass},[i(o.$slots,"default",{},(()=>[r.image?(e(),n("img",{key:0,src:r.image},null,8,["src"])):r.icon?(e(),n("span",{key:1,class:m.iconClass},null,2)):t("",!0),r.label?(e(),n("div",c,l(r.label),1)):t("",!0)])),r.removable?(e(),n("span",{key:0,tabindex:"0",class:m.removeIconClass,onClick:a[1]||(a[1]=(...e)=>m.close&&m.close(...e)),onKeydown:a[2]||(a[2]=s(((...e)=>m.close&&m.close(...e)),["enter"]))},null,34)):t("",!0)],2)):t("",!0)};export{o as default};
|
package/chip/chip.js
CHANGED
package/chips/Chips.d.ts
CHANGED
|
@@ -1,27 +1,100 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
|
+
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
2
3
|
|
|
3
|
-
interface
|
|
4
|
+
export interface ChipsAddEvent {
|
|
5
|
+
/**
|
|
6
|
+
* Browser event.
|
|
7
|
+
*/
|
|
8
|
+
originalEvent: Event;
|
|
9
|
+
/**
|
|
10
|
+
* Added/Removed item value.
|
|
11
|
+
*/
|
|
12
|
+
value: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @extends ChipsAddEvent
|
|
17
|
+
*/
|
|
18
|
+
export interface ChipsRemoveEvent extends ChipsAddEvent { }
|
|
19
|
+
|
|
20
|
+
export interface ChipsProps {
|
|
21
|
+
/**
|
|
22
|
+
* Value of the component.
|
|
23
|
+
*/
|
|
4
24
|
modelValue?: any[];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Maximum number of entries allowed.
|
|
27
|
+
*/
|
|
28
|
+
max?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to add an item when the input loses focus.
|
|
31
|
+
*/
|
|
32
|
+
addOnBlur?: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to allow duplicate values or not.
|
|
35
|
+
* Default value is true.
|
|
36
|
+
*/
|
|
37
|
+
allowDuplicate?: boolean | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Separator char to add an item when pressed in addition to the enter key. Currently only possible value is ','
|
|
40
|
+
*/
|
|
41
|
+
separator?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Style class of the component input field.
|
|
44
|
+
*/
|
|
45
|
+
class?: any;
|
|
46
|
+
/**
|
|
47
|
+
* Inline style of the component.
|
|
48
|
+
*/
|
|
10
49
|
style?: any;
|
|
11
50
|
}
|
|
12
51
|
|
|
13
|
-
interface
|
|
14
|
-
|
|
52
|
+
export interface ChipsSlots {
|
|
53
|
+
/**
|
|
54
|
+
* Custom chip template.
|
|
55
|
+
* @param {Object} scope - chip slot's params.
|
|
56
|
+
*/
|
|
57
|
+
chip: (scope: {
|
|
58
|
+
/**
|
|
59
|
+
* Value of the component
|
|
60
|
+
*/
|
|
61
|
+
value: any;
|
|
62
|
+
}) => VNode[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export declare type ChipsEmits = {
|
|
66
|
+
/**
|
|
67
|
+
* Emitted when the value changes.
|
|
68
|
+
* @param {*} value - New value.
|
|
69
|
+
*/
|
|
70
|
+
'update:modelValue': (value: any[]) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Callback to invoke when a chip is added.
|
|
73
|
+
* @param {ChipsAddEvent} event - Custom add event.
|
|
74
|
+
*/
|
|
75
|
+
'add': (event: ChipsAddEvent) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Callback to invoke when a chip is removed.
|
|
78
|
+
* @param {ChipsRemoveEvent} event - Custom remove event.
|
|
79
|
+
*/
|
|
80
|
+
'remove': (event: ChipsRemoveEvent) => void;
|
|
15
81
|
}
|
|
16
82
|
|
|
17
|
-
declare class Chips {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$slots: {
|
|
23
|
-
chip: ChipsChipSlotInterface;
|
|
83
|
+
declare class Chips extends ClassComponent<ChipsProps, ChipsSlots, ChipsEmits> { }
|
|
84
|
+
|
|
85
|
+
declare module '@vue/runtime-core' {
|
|
86
|
+
interface GlobalComponents {
|
|
87
|
+
Chips: GlobalComponentConstructor<Chips>
|
|
24
88
|
}
|
|
25
89
|
}
|
|
26
90
|
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* Chips is used to enter multiple values on an input field.
|
|
94
|
+
*
|
|
95
|
+
* Demos:
|
|
96
|
+
*
|
|
97
|
+
* - [Chips](https://www.primefaces.org/primevue/showcase/#/chips)
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
27
100
|
export default Chips;
|
package/chips/chips.esm.js
CHANGED
package/chips/chips.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{openBlock as e,createBlock as t,createVNode as n,Fragment as l,renderList as i,renderSlot as a,toDisplayString as s,mergeProps as o}from"vue";var p={name:"Chips",inheritAttrs:!1,emits:["update:modelValue","add","remove"],props:{modelValue:{type:Array,default:null},max:{type:Number,default:null},separator:{type:String,default:null},addOnBlur:{type:Boolean,default:null},allowDuplicate:{type:Boolean,default:!0},class:null,style:null},data:()=>({inputValue:null,focused:!1}),methods:{onWrapperClick(){this.$refs.input.focus()},onInput(e){this.inputValue=e.target.value},onFocus(){this.focused=!0},onBlur(e){this.focused=!1,this.addOnBlur&&this.addItem(e,e.target.value,!1)},onKeyDown(e){const t=e.target.value;switch(e.which){case 8:0===t.length&&this.modelValue&&this.modelValue.length>0&&this.removeItem(e,this.modelValue.length-1);break;case 13:t&&t.trim().length&&!this.maxedOut&&this.addItem(e,t,!0);break;default:this.separator&&","===this.separator&&188===e.which&&this.addItem(e,t,!0)}},onPaste(e){if(this.separator){let t=(e.clipboardData||window.clipboardData).getData("Text");if(t){let n=this.modelValue||[],l=t.split(this.separator);l=l.filter((e=>this.allowDuplicate||-1===n.indexOf(e))),n=[...n,...l],this.updateModel(e,n,!0)}}},updateModel(e,t,n){this.$emit("update:modelValue",t),this.$emit("add",{originalEvent:e,value:t}),this.$refs.input.value="",this.inputValue="",n&&e.preventDefault()},addItem(e,t,n){if(t&&t.trim().length){let l=this.modelValue?[...this.modelValue]:[];(this.allowDuplicate||-1===l.indexOf(t))&&(l.push(t),this.updateModel(e,l,n))}},removeItem(e,t){if(this.$attrs.disabled)return;let n=[...this.modelValue];const l=n.splice(t,1);this.$emit("update:modelValue",n),this.$emit("remove",{originalEvent:e,value:l})}},computed:{maxedOut(){return this.max&&this.modelValue&&this.max===this.modelValue.length},containerClass(){return["p-chips p-component p-inputwrapper",this.class,{"p-inputwrapper-filled":this.modelValue&&this.modelValue.length||this.inputValue&&this.inputValue.length,"p-inputwrapper-focus":this.focused}]}}};const d={class:"p-chips-token-label"},u={class:"p-chips-input-token"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-chips {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-chips-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-chips-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-chips-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-chips-token-icon {\n cursor: pointer;\n}\n.p-chips-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-chips {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n"),p.render=function(p,r,c,h,m,f){return e(),t("div",{class:f.containerClass,style:c.style},[n("ul",{class:["p-inputtext p-chips-multiple-container",{"p-disabled":p.$attrs.disabled,"p-focus":m.focused}],onClick:r[6]||(r[6]=e=>f.onWrapperClick())},[(e(!0),t(l,null,i(c.modelValue,((l,i)=>(e(),t("li",{key:`${i}_${l}`,class:"p-chips-token"},[a(p.$slots,"chip",{value:l},(()=>[n("span",d,s(l),1)])),n("span",{class:"p-chips-token-icon pi pi-times-circle",onClick:e=>f.removeItem(e,i)},null,8,["onClick"])])))),128)),n("li",u,[n("input",o({ref:"input",type:"text"},p.$attrs,{onFocus:r[1]||(r[1]=(...e)=>f.onFocus&&f.onFocus(...e)),onBlur:r[2]||(r[2]=e=>f.onBlur(e)),onInput:r[3]||(r[3]=(...e)=>f.onInput&&f.onInput(...e)),onKeydown:r[4]||(r[4]=e=>f.onKeyDown(e)),onPaste:r[5]||(r[5]=e=>f.onPaste(e)),disabled:p.$attrs.disabled||f.maxedOut}),null,16,["disabled"])])],2)],6)};export default
|
|
1
|
+
import{openBlock as e,createBlock as t,createVNode as n,Fragment as l,renderList as i,renderSlot as a,toDisplayString as s,mergeProps as o}from"vue";var p={name:"Chips",inheritAttrs:!1,emits:["update:modelValue","add","remove"],props:{modelValue:{type:Array,default:null},max:{type:Number,default:null},separator:{type:String,default:null},addOnBlur:{type:Boolean,default:null},allowDuplicate:{type:Boolean,default:!0},class:null,style:null},data:()=>({inputValue:null,focused:!1}),methods:{onWrapperClick(){this.$refs.input.focus()},onInput(e){this.inputValue=e.target.value},onFocus(){this.focused=!0},onBlur(e){this.focused=!1,this.addOnBlur&&this.addItem(e,e.target.value,!1)},onKeyDown(e){const t=e.target.value;switch(e.which){case 8:0===t.length&&this.modelValue&&this.modelValue.length>0&&this.removeItem(e,this.modelValue.length-1);break;case 13:t&&t.trim().length&&!this.maxedOut&&this.addItem(e,t,!0);break;default:this.separator&&","===this.separator&&188===e.which&&this.addItem(e,t,!0)}},onPaste(e){if(this.separator){let t=(e.clipboardData||window.clipboardData).getData("Text");if(t){let n=this.modelValue||[],l=t.split(this.separator);l=l.filter((e=>this.allowDuplicate||-1===n.indexOf(e))),n=[...n,...l],this.updateModel(e,n,!0)}}},updateModel(e,t,n){this.$emit("update:modelValue",t),this.$emit("add",{originalEvent:e,value:t}),this.$refs.input.value="",this.inputValue="",n&&e.preventDefault()},addItem(e,t,n){if(t&&t.trim().length){let l=this.modelValue?[...this.modelValue]:[];(this.allowDuplicate||-1===l.indexOf(t))&&(l.push(t),this.updateModel(e,l,n))}},removeItem(e,t){if(this.$attrs.disabled)return;let n=[...this.modelValue];const l=n.splice(t,1);this.$emit("update:modelValue",n),this.$emit("remove",{originalEvent:e,value:l})}},computed:{maxedOut(){return this.max&&this.modelValue&&this.max===this.modelValue.length},containerClass(){return["p-chips p-component p-inputwrapper",this.class,{"p-inputwrapper-filled":this.modelValue&&this.modelValue.length||this.inputValue&&this.inputValue.length,"p-inputwrapper-focus":this.focused}]}}};const d={class:"p-chips-token-label"},u={class:"p-chips-input-token"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-chips {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-chips-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n}\n.p-chips-token {\n cursor: default;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.p-chips-input-token {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n}\n.p-chips-token-icon {\n cursor: pointer;\n}\n.p-chips-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n -webkit-box-shadow: none;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-chips {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n"),p.render=function(p,r,c,h,m,f){return e(),t("div",{class:f.containerClass,style:c.style},[n("ul",{class:["p-inputtext p-chips-multiple-container",{"p-disabled":p.$attrs.disabled,"p-focus":m.focused}],onClick:r[6]||(r[6]=e=>f.onWrapperClick())},[(e(!0),t(l,null,i(c.modelValue,((l,i)=>(e(),t("li",{key:`${i}_${l}`,class:"p-chips-token"},[a(p.$slots,"chip",{value:l},(()=>[n("span",d,s(l),1)])),n("span",{class:"p-chips-token-icon pi pi-times-circle",onClick:e=>f.removeItem(e,i)},null,8,["onClick"])])))),128)),n("li",u,[n("input",o({ref:"input",type:"text"},p.$attrs,{onFocus:r[1]||(r[1]=(...e)=>f.onFocus&&f.onFocus(...e)),onBlur:r[2]||(r[2]=e=>f.onBlur(e)),onInput:r[3]||(r[3]=(...e)=>f.onInput&&f.onInput(...e)),onKeydown:r[4]||(r[4]=e=>f.onKeyDown(e)),onPaste:r[5]||(r[5]=e=>f.onPaste(e)),disabled:p.$attrs.disabled||f.maxedOut}),null,16,["disabled"])])],2)],6)};export{p as default};
|
package/chips/chips.js
CHANGED
|
@@ -1,20 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
2
|
+
|
|
3
|
+
type ColorPickerFormatType = 'hex' | 'rgb' | 'hsb' | undefined;
|
|
4
|
+
|
|
5
|
+
type ColorPickerAppendToType = 'body' | 'self' | string | undefined;
|
|
6
|
+
|
|
7
|
+
export interface ColorPickerChangeEvent {
|
|
8
|
+
/**
|
|
9
|
+
* Browser event
|
|
10
|
+
*/
|
|
11
|
+
originalEvent: Event;
|
|
12
|
+
/**
|
|
13
|
+
* Selected color value.
|
|
14
|
+
*/
|
|
15
|
+
value: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ColorPickerProps {
|
|
19
|
+
/**
|
|
20
|
+
* Value of the component.
|
|
21
|
+
*/
|
|
2
22
|
modelValue?: any;
|
|
23
|
+
/**
|
|
24
|
+
* Initial color to display when value is not defined.
|
|
25
|
+
* Default value is ff0000.
|
|
26
|
+
*/
|
|
3
27
|
defaultColor?: any;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Whether to display as an overlay or not.
|
|
30
|
+
*/
|
|
31
|
+
inline?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Format to use in value binding, supported formats are 'hex', 'rgb' and 'hsb'.
|
|
34
|
+
* @see ColorPickerFormatType
|
|
35
|
+
* Default value is 'hex'.
|
|
36
|
+
*/
|
|
37
|
+
format?: ColorPickerFormatType;
|
|
38
|
+
/**
|
|
39
|
+
* When present, it specifies that the component should be disabled.
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Index of the element in tabbing order.
|
|
44
|
+
*/
|
|
45
|
+
tabindex?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to automatically manage layering.
|
|
48
|
+
* Default value is true.
|
|
49
|
+
*/
|
|
50
|
+
autoZIndex?: boolean | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Base zIndex value to use in layering.
|
|
53
|
+
* Default value is 0.
|
|
54
|
+
*/
|
|
55
|
+
baseZIndex?: number | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
58
|
+
*/
|
|
59
|
+
ariaLabelledBy?: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Style class of the overlay panel.
|
|
62
|
+
*/
|
|
63
|
+
panelClass?: any;
|
|
64
|
+
/**
|
|
65
|
+
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
|
|
66
|
+
* Default value is 'body'.
|
|
67
|
+
*/
|
|
68
|
+
appendTo?: ColorPickerAppendToType;
|
|
13
69
|
}
|
|
14
70
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
71
|
+
export interface ColorPickerSlots {
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export declare type ColorPickerEmits = {
|
|
75
|
+
/**
|
|
76
|
+
* Emitted when the value changes.
|
|
77
|
+
* @param {*} value - New value.
|
|
78
|
+
*/
|
|
79
|
+
'update:modelValue': (value: any) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback to invoke when a chip is added.
|
|
82
|
+
* @param {ColorPickerChangeEvent} event - Custom add event.
|
|
83
|
+
*/
|
|
84
|
+
'change': (event: ColorPickerChangeEvent) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Callback to invoke when input is cleared by the user.
|
|
87
|
+
*/
|
|
88
|
+
'show': () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Callback to invoke when input is cleared by the user.
|
|
91
|
+
*/
|
|
92
|
+
'hide': () => void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare class ColorPicker extends ClassComponent<ColorPickerProps, ColorPickerSlots, ColorPickerEmits> { }
|
|
96
|
+
|
|
97
|
+
declare module '@vue/runtime-core' {
|
|
98
|
+
interface GlobalComponents {
|
|
99
|
+
ColorPicker: GlobalComponentConstructor<ColorPicker>
|
|
100
|
+
}
|
|
18
101
|
}
|
|
19
102
|
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* ColorPicker is an input component to select a color.
|
|
106
|
+
*
|
|
107
|
+
* Demos:
|
|
108
|
+
*
|
|
109
|
+
* - [ColorPicker](https://www.primefaces.org/primevue/showcase/#/colorpicker)
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
20
112
|
export default ColorPicker;
|
|
@@ -29,7 +29,7 @@ import OverlayEventBus from 'primevue/overlayeventbus';
|
|
|
29
29
|
|
|
30
30
|
export default {
|
|
31
31
|
name: 'ColorPicker',
|
|
32
|
-
emits: ['update:modelValue'],
|
|
32
|
+
emits: ['update:modelValue', 'change', 'show', 'hide'],
|
|
33
33
|
props: {
|
|
34
34
|
modelValue: {
|
|
35
35
|
type: null,
|
|
@@ -141,6 +141,7 @@ export default {
|
|
|
141
141
|
this.updateColorHandle();
|
|
142
142
|
this.updateInput();
|
|
143
143
|
this.updateModel();
|
|
144
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
144
145
|
},
|
|
145
146
|
pickHue(event) {
|
|
146
147
|
let top = this.hueView.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
|
|
@@ -155,6 +156,7 @@ export default {
|
|
|
155
156
|
this.updateHue();
|
|
156
157
|
this.updateModel();
|
|
157
158
|
this.updateInput();
|
|
159
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
158
160
|
},
|
|
159
161
|
updateModel() {
|
|
160
162
|
switch(this.format) {
|
|
@@ -354,12 +356,15 @@ export default {
|
|
|
354
356
|
if (this.autoZIndex) {
|
|
355
357
|
ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
356
358
|
}
|
|
359
|
+
|
|
360
|
+
this.$emit('show');
|
|
357
361
|
},
|
|
358
362
|
onOverlayLeave() {
|
|
359
363
|
this.unbindOutsideClickListener();
|
|
360
364
|
this.unbindScrollListener();
|
|
361
365
|
this.unbindResizeListener();
|
|
362
366
|
this.clearRefs();
|
|
367
|
+
this.$emit('hide');
|
|
363
368
|
},
|
|
364
369
|
onOverlayAfterLeave(el) {
|
|
365
370
|
if (this.autoZIndex) {
|
|
@@ -10,7 +10,7 @@ var OverlayEventBus__default = /*#__PURE__*/_interopDefaultLegacy(OverlayEventBu
|
|
|
10
10
|
|
|
11
11
|
var script = {
|
|
12
12
|
name: 'ColorPicker',
|
|
13
|
-
emits: ['update:modelValue'],
|
|
13
|
+
emits: ['update:modelValue', 'change', 'show', 'hide'],
|
|
14
14
|
props: {
|
|
15
15
|
modelValue: {
|
|
16
16
|
type: null,
|
|
@@ -122,6 +122,7 @@ var script = {
|
|
|
122
122
|
this.updateColorHandle();
|
|
123
123
|
this.updateInput();
|
|
124
124
|
this.updateModel();
|
|
125
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
125
126
|
},
|
|
126
127
|
pickHue(event) {
|
|
127
128
|
let top = this.hueView.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
|
|
@@ -136,6 +137,7 @@ var script = {
|
|
|
136
137
|
this.updateHue();
|
|
137
138
|
this.updateModel();
|
|
138
139
|
this.updateInput();
|
|
140
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
139
141
|
},
|
|
140
142
|
updateModel() {
|
|
141
143
|
switch(this.format) {
|
|
@@ -328,12 +330,15 @@ var script = {
|
|
|
328
330
|
if (this.autoZIndex) {
|
|
329
331
|
utils.ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
330
332
|
}
|
|
333
|
+
|
|
334
|
+
this.$emit('show');
|
|
331
335
|
},
|
|
332
336
|
onOverlayLeave() {
|
|
333
337
|
this.unbindOutsideClickListener();
|
|
334
338
|
this.unbindScrollListener();
|
|
335
339
|
this.unbindResizeListener();
|
|
336
340
|
this.clearRefs();
|
|
341
|
+
this.$emit('hide');
|
|
337
342
|
},
|
|
338
343
|
onOverlayAfterLeave(el) {
|
|
339
344
|
if (this.autoZIndex) {
|
|
@@ -526,7 +531,7 @@ var script = {
|
|
|
526
531
|
this.hueHandle = null;
|
|
527
532
|
},
|
|
528
533
|
onOverlayClick(event) {
|
|
529
|
-
OverlayEventBus__default[
|
|
534
|
+
OverlayEventBus__default["default"].emit('overlay-click', {
|
|
530
535
|
originalEvent: event,
|
|
531
536
|
target: this.$el
|
|
532
537
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("vue");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),r={name:"ColorPicker",emits:["update:modelValue"],props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},ariaLabelledBy:{type:String,default:null},appendTo:{type:String,default:"body"},panelClass:null},data:()=>({overlayVisible:!1}),hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,beforeUnmount(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&e.ZIndexUtils.clear(this.picker),this.clearRefs()},mounted(){this.updateUI()},watch:{modelValue:{immediate:!0,handler(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},methods:{pickColor(e){let t=this.colorSelector.getBoundingClientRect(),i=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),n=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-n))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-i)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel()},pickHue(e){let t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(),this.updateInput()},updateModel(){switch(this.format){case"hex":this.$emit("update:modelValue",this.HSBtoHEX(this.hsbValue));break;case"rgb":this.$emit("update:modelValue",this.HSBtoRGB(this.hsbValue));break;case"hsb":this.$emit("update:modelValue",this.hsbValue)}},updateColorSelector(){if(this.colorSelector){let e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:e=>({h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}),validateRGB:e=>({r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}),validateHEX(e){var t=6-e.length;if(t>0){for(var i=[],n=0;n<t;n++)i.push("0");i.push(e),e=i.join("")}return e},HEXtoRGB(e){let t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB(e){var t={h:0,s:0,b:0},i=Math.min(e.r,e.g,e.b),n=Math.max(e.r,e.g,e.b),o=n-i;return t.b=n,t.s=0!==n?255*o/n:0,0!==t.s?e.r===n?t.h=(e.g-e.b)/o:e.g===n?t.h=2+(e.b-e.r)/o:t.h=4+(e.r-e.g)/o:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB(e){var t={r:null,g:null,b:null},i=Math.round(e.h),n=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===n)t={r:o,g:o,b:o};else{var r=o,l=(255-n)*o/255,s=i%60*(r-l)/60;360===i&&(i=0),i<60?(t.r=r,t.b=l,t.g=l+s):i<120?(t.g=r,t.b=l,t.r=r-s):i<180?(t.g=r,t.r=l,t.b=l+s):i<240?(t.b=r,t.r=l,t.g=r-s):i<300?(t.b=r,t.g=l,t.r=l+s):i<360?(t.r=r,t.g=l,t.b=r-s):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var i in t)1===t[i].length&&(t[i]="0"+t[i]);return t.join("")},HSBtoHEX(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB(e){let t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter(t){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay)},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs()},onOverlayAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.picker,this.$refs.input):e.DomHandler.absolutePosition(this.picker,this.$refs.input)},onInputClick(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown(e){switch(e.which){case 32:this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case 27:case 9:this.overlayVisible=!1}},onColorMousedown(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart(t){this.disabled||(this.colorDragging=!0,this.pickColor(t),e.DomHandler.addClass(this.$el,"p-colorpicker-dragging"),t.preventDefault())},onDrag(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd(){this.colorDragging=!1,this.hueDragging=!1,e.DomHandler.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart(t){this.disabled||(this.hueDragging=!0,this.pickHue(t),e.DomHandler.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.picker&&!this.picker.contains(e.target)&&!this.isInputClicked(e)&&(this.overlayVisible=!1)},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.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&(this.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef(e){this.picker=e},colorSelectorRef(e){this.colorSelector=e},colorHandleRef(e){this.colorHandle=e},hueViewRef(e){this.hueView=e},hueHandleRef(e){this.hueHandle=e},clearRefs(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick(e){o.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{containerClass(){return["p-colorpicker p-component",{"p-colorpicker-overlay":!this.inline}]},inputClass(){return["p-colorpicker-preview p-inputtext",{"p-disabled":this.disabled}]},pickerClass(){return["p-colorpicker-panel",this.panelClass,{"p-colorpicker-overlay-panel":!this.inline,"p-disabled":this.disabled,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},appendDisabled(){return"self"===this.appendTo||this.inline},appendTarget(){return this.appendDisabled?null:this.appendTo}}};const l={class:"p-colorpicker-content"},s={class:"p-colorpicker-color"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: .85;\n cursor: pointer;\n}\n"),r.render=function(e,t,n,o,r,a){return i.openBlock(),i.createBlock("div",{ref:"container",class:a.containerClass},[n.inline?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock("input",{key:0,ref:"input",type:"text",class:a.inputClass,readonly:"readonly",tabindex:n.tabindex,disabled:n.disabled,onClick:t[1]||(t[1]=(...e)=>a.onInputClick&&a.onInputClick(...e)),onKeydown:t[2]||(t[2]=(...e)=>a.onInputKeydown&&a.onInputKeydown(...e)),"aria-labelledby":n.ariaLabelledBy},null,42,["tabindex","disabled","aria-labelledby"])),(i.openBlock(),i.createBlock(i.Teleport,{to:a.appendTarget,disabled:a.appendDisabled},[i.createVNode(i.Transition,{name:"p-connected-overlay",onEnter:a.onOverlayEnter,onLeave:a.onOverlayLeave,onAfterLeave:a.onOverlayAfterLeave},{default:i.withCtx((()=>[n.inline||r.overlayVisible?(i.openBlock(),i.createBlock("div",{key:0,ref:a.pickerRef,class:a.pickerClass,onClick:t[11]||(t[11]=(...e)=>a.onOverlayClick&&a.onOverlayClick(...e))},[i.createVNode("div",l,[i.createVNode("div",{ref:a.colorSelectorRef,class:"p-colorpicker-color-selector",onMousedown:t[3]||(t[3]=e=>a.onColorMousedown(e)),onTouchstart:t[4]||(t[4]=e=>a.onColorDragStart(e)),onTouchmove:t[5]||(t[5]=e=>a.onDrag(e)),onTouchend:t[6]||(t[6]=e=>a.onDragEnd())},[i.createVNode("div",s,[i.createVNode("div",{ref:a.colorHandleRef,class:"p-colorpicker-color-handle"},null,512)])],544),i.createVNode("div",{ref:a.hueViewRef,class:"p-colorpicker-hue",onMousedown:t[7]||(t[7]=e=>a.onHueMousedown(e)),onTouchstart:t[8]||(t[8]=e=>a.onHueDragStart(e)),onTouchmove:t[9]||(t[9]=e=>a.onDrag(e)),onTouchend:t[10]||(t[10]=e=>a.onDragEnd())},[i.createVNode("div",{ref:a.hueHandleRef,class:"p-colorpicker-hue-handle"},null,512)],544)])],2)):i.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=r;
|
|
1
|
+
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("vue");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t),r={name:"ColorPicker",emits:["update:modelValue","change","show","hide"],props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},ariaLabelledBy:{type:String,default:null},appendTo:{type:String,default:"body"},panelClass:null},data:()=>({overlayVisible:!1}),hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,beforeUnmount(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&e.ZIndexUtils.clear(this.picker),this.clearRefs()},mounted(){this.updateUI()},watch:{modelValue:{immediate:!0,handler(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},methods:{pickColor(e){let t=this.colorSelector.getBoundingClientRect(),i=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),n=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-n))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-i)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(),this.$emit("change",{event:e,value:this.modelValue})},pickHue(e){let t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(),this.updateInput(),this.$emit("change",{event:e,value:this.modelValue})},updateModel(){switch(this.format){case"hex":this.$emit("update:modelValue",this.HSBtoHEX(this.hsbValue));break;case"rgb":this.$emit("update:modelValue",this.HSBtoRGB(this.hsbValue));break;case"hsb":this.$emit("update:modelValue",this.hsbValue)}},updateColorSelector(){if(this.colorSelector){let e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:e=>({h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}),validateRGB:e=>({r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}),validateHEX(e){var t=6-e.length;if(t>0){for(var i=[],n=0;n<t;n++)i.push("0");i.push(e),e=i.join("")}return e},HEXtoRGB(e){let t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB(e){var t={h:0,s:0,b:0},i=Math.min(e.r,e.g,e.b),n=Math.max(e.r,e.g,e.b),o=n-i;return t.b=n,t.s=0!==n?255*o/n:0,0!==t.s?e.r===n?t.h=(e.g-e.b)/o:e.g===n?t.h=2+(e.b-e.r)/o:t.h=4+(e.r-e.g)/o:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB(e){var t={r:null,g:null,b:null},i=Math.round(e.h),n=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===n)t={r:o,g:o,b:o};else{var r=o,l=(255-n)*o/255,s=i%60*(r-l)/60;360===i&&(i=0),i<60?(t.r=r,t.b=l,t.g=l+s):i<120?(t.g=r,t.b=l,t.r=r-s):i<180?(t.g=r,t.r=l,t.b=l+s):i<240?(t.b=r,t.r=l,t.g=r-s):i<300?(t.b=r,t.g=l,t.r=l+s):i<360?(t.r=r,t.g=l,t.b=r-s):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var i in t)1===t[i].length&&(t[i]="0"+t[i]);return t.join("")},HSBtoHEX(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB(e){let t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter(t){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.picker,this.$refs.input):e.DomHandler.absolutePosition(this.picker,this.$refs.input)},onInputClick(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown(e){switch(e.which){case 32:this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case 27:case 9:this.overlayVisible=!1}},onColorMousedown(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart(t){this.disabled||(this.colorDragging=!0,this.pickColor(t),e.DomHandler.addClass(this.$el,"p-colorpicker-dragging"),t.preventDefault())},onDrag(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd(){this.colorDragging=!1,this.hueDragging=!1,e.DomHandler.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart(t){this.disabled||(this.hueDragging=!0,this.pickHue(t),e.DomHandler.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.picker&&!this.picker.contains(e.target)&&!this.isInputClicked(e)&&(this.overlayVisible=!1)},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.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&(this.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef(e){this.picker=e},colorSelectorRef(e){this.colorSelector=e},colorHandleRef(e){this.colorHandle=e},hueViewRef(e){this.hueView=e},hueHandleRef(e){this.hueHandle=e},clearRefs(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick(e){o.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{containerClass(){return["p-colorpicker p-component",{"p-colorpicker-overlay":!this.inline}]},inputClass(){return["p-colorpicker-preview p-inputtext",{"p-disabled":this.disabled}]},pickerClass(){return["p-colorpicker-panel",this.panelClass,{"p-colorpicker-overlay-panel":!this.inline,"p-disabled":this.disabled,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},appendDisabled(){return"self"===this.appendTo||this.inline},appendTarget(){return this.appendDisabled?null:this.appendTo}}};const l={class:"p-colorpicker-content"},s={class:"p-colorpicker-color"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: .85;\n cursor: pointer;\n}\n"),r.render=function(e,t,n,o,r,a){return i.openBlock(),i.createBlock("div",{ref:"container",class:a.containerClass},[n.inline?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock("input",{key:0,ref:"input",type:"text",class:a.inputClass,readonly:"readonly",tabindex:n.tabindex,disabled:n.disabled,onClick:t[1]||(t[1]=(...e)=>a.onInputClick&&a.onInputClick(...e)),onKeydown:t[2]||(t[2]=(...e)=>a.onInputKeydown&&a.onInputKeydown(...e)),"aria-labelledby":n.ariaLabelledBy},null,42,["tabindex","disabled","aria-labelledby"])),(i.openBlock(),i.createBlock(i.Teleport,{to:a.appendTarget,disabled:a.appendDisabled},[i.createVNode(i.Transition,{name:"p-connected-overlay",onEnter:a.onOverlayEnter,onLeave:a.onOverlayLeave,onAfterLeave:a.onOverlayAfterLeave},{default:i.withCtx((()=>[n.inline||r.overlayVisible?(i.openBlock(),i.createBlock("div",{key:0,ref:a.pickerRef,class:a.pickerClass,onClick:t[11]||(t[11]=(...e)=>a.onOverlayClick&&a.onOverlayClick(...e))},[i.createVNode("div",l,[i.createVNode("div",{ref:a.colorSelectorRef,class:"p-colorpicker-color-selector",onMousedown:t[3]||(t[3]=e=>a.onColorMousedown(e)),onTouchstart:t[4]||(t[4]=e=>a.onColorDragStart(e)),onTouchmove:t[5]||(t[5]=e=>a.onDrag(e)),onTouchend:t[6]||(t[6]=e=>a.onDragEnd())},[i.createVNode("div",s,[i.createVNode("div",{ref:a.colorHandleRef,class:"p-colorpicker-color-handle"},null,512)])],544),i.createVNode("div",{ref:a.hueViewRef,class:"p-colorpicker-hue",onMousedown:t[7]||(t[7]=e=>a.onHueMousedown(e)),onTouchstart:t[8]||(t[8]=e=>a.onHueDragStart(e)),onTouchmove:t[9]||(t[9]=e=>a.onDrag(e)),onTouchend:t[10]||(t[10]=e=>a.onDragEnd())},[i.createVNode("div",{ref:a.hueHandleRef,class:"p-colorpicker-hue-handle"},null,512)],544)])],2)):i.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=r;
|
|
@@ -4,7 +4,7 @@ import { openBlock, createBlock, createCommentVNode, Teleport, createVNode, Tran
|
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
6
6
|
name: 'ColorPicker',
|
|
7
|
-
emits: ['update:modelValue'],
|
|
7
|
+
emits: ['update:modelValue', 'change', 'show', 'hide'],
|
|
8
8
|
props: {
|
|
9
9
|
modelValue: {
|
|
10
10
|
type: null,
|
|
@@ -116,6 +116,7 @@ var script = {
|
|
|
116
116
|
this.updateColorHandle();
|
|
117
117
|
this.updateInput();
|
|
118
118
|
this.updateModel();
|
|
119
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
119
120
|
},
|
|
120
121
|
pickHue(event) {
|
|
121
122
|
let top = this.hueView.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
|
|
@@ -130,6 +131,7 @@ var script = {
|
|
|
130
131
|
this.updateHue();
|
|
131
132
|
this.updateModel();
|
|
132
133
|
this.updateInput();
|
|
134
|
+
this.$emit('change', {event: event, value: this.modelValue});
|
|
133
135
|
},
|
|
134
136
|
updateModel() {
|
|
135
137
|
switch(this.format) {
|
|
@@ -322,12 +324,15 @@ var script = {
|
|
|
322
324
|
if (this.autoZIndex) {
|
|
323
325
|
ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
324
326
|
}
|
|
327
|
+
|
|
328
|
+
this.$emit('show');
|
|
325
329
|
},
|
|
326
330
|
onOverlayLeave() {
|
|
327
331
|
this.unbindOutsideClickListener();
|
|
328
332
|
this.unbindScrollListener();
|
|
329
333
|
this.unbindResizeListener();
|
|
330
334
|
this.clearRefs();
|
|
335
|
+
this.$emit('hide');
|
|
331
336
|
},
|
|
332
337
|
onOverlayAfterLeave(el) {
|
|
333
338
|
if (this.autoZIndex) {
|
|
@@ -660,4 +665,4 @@ styleInject(css_248z);
|
|
|
660
665
|
|
|
661
666
|
script.render = render;
|
|
662
667
|
|
|
663
|
-
export default
|
|
668
|
+
export { script as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ZIndexUtils as e,DomHandler as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import{openBlock as o,createBlock as s,createCommentVNode as r,Teleport as l,createVNode as a,Transition as d,withCtx as h}from"vue";var u={name:"ColorPicker",emits:["update:modelValue"],props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},ariaLabelledBy:{type:String,default:null},appendTo:{type:String,default:"body"},panelClass:null},data:()=>({overlayVisible:!1}),hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,beforeUnmount(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&e.clear(this.picker),this.clearRefs()},mounted(){this.updateUI()},watch:{modelValue:{immediate:!0,handler(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},methods:{pickColor(e){let t=this.colorSelector.getBoundingClientRect(),i=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),n=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-n))/150),s=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-i)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:s}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel()},pickHue(e){let t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(),this.updateInput()},updateModel(){switch(this.format){case"hex":this.$emit("update:modelValue",this.HSBtoHEX(this.hsbValue));break;case"rgb":this.$emit("update:modelValue",this.HSBtoRGB(this.hsbValue));break;case"hsb":this.$emit("update:modelValue",this.hsbValue)}},updateColorSelector(){if(this.colorSelector){let e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:e=>({h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}),validateRGB:e=>({r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}),validateHEX(e){var t=6-e.length;if(t>0){for(var i=[],n=0;n<t;n++)i.push("0");i.push(e),e=i.join("")}return e},HEXtoRGB(e){let t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB(e){var t={h:0,s:0,b:0},i=Math.min(e.r,e.g,e.b),n=Math.max(e.r,e.g,e.b),o=n-i;return t.b=n,t.s=0!==n?255*o/n:0,0!==t.s?e.r===n?t.h=(e.g-e.b)/o:e.g===n?t.h=2+(e.b-e.r)/o:t.h=4+(e.r-e.g)/o:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB(e){var t={r:null,g:null,b:null},i=Math.round(e.h),n=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===n)t={r:o,g:o,b:o};else{var s=o,r=(255-n)*o/255,l=i%60*(s-r)/60;360===i&&(i=0),i<60?(t.r=s,t.b=r,t.g=r+l):i<120?(t.g=s,t.b=r,t.r=s-l):i<180?(t.g=s,t.r=r,t.b=r+l):i<240?(t.b=s,t.r=r,t.g=s-l):i<300?(t.b=s,t.g=r,t.r=r+l):i<360?(t.r=s,t.g=r,t.b=s-l):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var i in t)1===t[i].length&&(t[i]="0"+t[i]);return t.join("")},HSBtoHEX(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB(e){let t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter(t){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&e.set("overlay",t,this.$primevue.config.zIndex.overlay)},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs()},onOverlayAfterLeave(t){this.autoZIndex&&e.clear(t)},alignOverlay(){this.appendDisabled?t.relativePosition(this.picker,this.$refs.input):t.absolutePosition(this.picker,this.$refs.input)},onInputClick(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown(e){switch(e.which){case 32:this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case 27:case 9:this.overlayVisible=!1}},onColorMousedown(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),t.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd(){this.colorDragging=!1,this.hueDragging=!1,t.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),t.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.picker&&!this.picker.contains(e.target)&&!this.isInputClicked(e)&&(this.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new i(this.$refs.container,(()=>{this.overlayVisible&&(this.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&(this.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef(e){this.picker=e},colorSelectorRef(e){this.colorSelector=e},colorHandleRef(e){this.colorHandle=e},hueViewRef(e){this.hueView=e},hueHandleRef(e){this.hueHandle=e},clearRefs(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{containerClass(){return["p-colorpicker p-component",{"p-colorpicker-overlay":!this.inline}]},inputClass(){return["p-colorpicker-preview p-inputtext",{"p-disabled":this.disabled}]},pickerClass(){return["p-colorpicker-panel",this.panelClass,{"p-colorpicker-overlay-panel":!this.inline,"p-disabled":this.disabled,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},appendDisabled(){return"self"===this.appendTo||this.inline},appendTarget(){return this.appendDisabled?null:this.appendTo}}};const p={class:"p-colorpicker-content"},c={class:"p-colorpicker-color"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: .85;\n cursor: pointer;\n}\n"),u.render=function(e,t,i,n,u,b){return o(),s("div",{ref:"container",class:b.containerClass},[i.inline?r("",!0):(o(),s("input",{key:0,ref:"input",type:"text",class:b.inputClass,readonly:"readonly",tabindex:i.tabindex,disabled:i.disabled,onClick:t[1]||(t[1]=(...e)=>b.onInputClick&&b.onInputClick(...e)),onKeydown:t[2]||(t[2]=(...e)=>b.onInputKeydown&&b.onInputKeydown(...e)),"aria-labelledby":i.ariaLabelledBy},null,42,["tabindex","disabled","aria-labelledby"])),(o(),s(l,{to:b.appendTarget,disabled:b.appendDisabled},[a(d,{name:"p-connected-overlay",onEnter:b.onOverlayEnter,onLeave:b.onOverlayLeave,onAfterLeave:b.onOverlayAfterLeave},{default:h((()=>[i.inline||u.overlayVisible?(o(),s("div",{key:0,ref:b.pickerRef,class:b.pickerClass,onClick:t[11]||(t[11]=(...e)=>b.onOverlayClick&&b.onOverlayClick(...e))},[a("div",p,[a("div",{ref:b.colorSelectorRef,class:"p-colorpicker-color-selector",onMousedown:t[3]||(t[3]=e=>b.onColorMousedown(e)),onTouchstart:t[4]||(t[4]=e=>b.onColorDragStart(e)),onTouchmove:t[5]||(t[5]=e=>b.onDrag(e)),onTouchend:t[6]||(t[6]=e=>b.onDragEnd())},[a("div",c,[a("div",{ref:b.colorHandleRef,class:"p-colorpicker-color-handle"},null,512)])],544),a("div",{ref:b.hueViewRef,class:"p-colorpicker-hue",onMousedown:t[7]||(t[7]=e=>b.onHueMousedown(e)),onTouchstart:t[8]||(t[8]=e=>b.onHueDragStart(e)),onTouchmove:t[9]||(t[9]=e=>b.onDrag(e)),onTouchend:t[10]||(t[10]=e=>b.onDragEnd())},[a("div",{ref:b.hueHandleRef,class:"p-colorpicker-hue-handle"},null,512)],544)])],2)):r("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export default u;
|
|
1
|
+
import{ZIndexUtils as e,DomHandler as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import{openBlock as o,createBlock as s,createCommentVNode as l,Teleport as r,createVNode as a,Transition as h,withCtx as d}from"vue";var u={name:"ColorPicker",emits:["update:modelValue","change","show","hide"],props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},ariaLabelledBy:{type:String,default:null},appendTo:{type:String,default:"body"},panelClass:null},data:()=>({overlayVisible:!1}),hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,beforeUnmount(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&e.clear(this.picker),this.clearRefs()},mounted(){this.updateUI()},watch:{modelValue:{immediate:!0,handler(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},methods:{pickColor(e){let t=this.colorSelector.getBoundingClientRect(),i=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),n=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-n))/150),s=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-i)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:s}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(),this.$emit("change",{event:e,value:this.modelValue})},pickHue(e){let t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(),this.updateInput(),this.$emit("change",{event:e,value:this.modelValue})},updateModel(){switch(this.format){case"hex":this.$emit("update:modelValue",this.HSBtoHEX(this.hsbValue));break;case"rgb":this.$emit("update:modelValue",this.HSBtoRGB(this.hsbValue));break;case"hsb":this.$emit("update:modelValue",this.hsbValue)}},updateColorSelector(){if(this.colorSelector){let e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:e=>({h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}),validateRGB:e=>({r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}),validateHEX(e){var t=6-e.length;if(t>0){for(var i=[],n=0;n<t;n++)i.push("0");i.push(e),e=i.join("")}return e},HEXtoRGB(e){let t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB(e){var t={h:0,s:0,b:0},i=Math.min(e.r,e.g,e.b),n=Math.max(e.r,e.g,e.b),o=n-i;return t.b=n,t.s=0!==n?255*o/n:0,0!==t.s?e.r===n?t.h=(e.g-e.b)/o:e.g===n?t.h=2+(e.b-e.r)/o:t.h=4+(e.r-e.g)/o:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB(e){var t={r:null,g:null,b:null},i=Math.round(e.h),n=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===n)t={r:o,g:o,b:o};else{var s=o,l=(255-n)*o/255,r=i%60*(s-l)/60;360===i&&(i=0),i<60?(t.r=s,t.b=l,t.g=l+r):i<120?(t.g=s,t.b=l,t.r=s-r):i<180?(t.g=s,t.r=l,t.b=l+r):i<240?(t.b=s,t.r=l,t.g=s-r):i<300?(t.b=s,t.g=l,t.r=l+r):i<360?(t.r=s,t.g=l,t.b=s-r):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var i in t)1===t[i].length&&(t[i]="0"+t[i]);return t.join("")},HSBtoHEX(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB(e){let t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter(t){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&e.set("overlay",t,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave(t){this.autoZIndex&&e.clear(t)},alignOverlay(){this.appendDisabled?t.relativePosition(this.picker,this.$refs.input):t.absolutePosition(this.picker,this.$refs.input)},onInputClick(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown(e){switch(e.which){case 32:this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case 27:case 9:this.overlayVisible=!1}},onColorMousedown(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),t.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd(){this.colorDragging=!1,this.hueDragging=!1,t.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),t.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.picker&&!this.picker.contains(e.target)&&!this.isInputClicked(e)&&(this.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new i(this.$refs.container,(()=>{this.overlayVisible&&(this.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&(this.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef(e){this.picker=e},colorSelectorRef(e){this.colorSelector=e},colorHandleRef(e){this.colorHandle=e},hueViewRef(e){this.hueView=e},hueHandleRef(e){this.hueHandle=e},clearRefs(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{containerClass(){return["p-colorpicker p-component",{"p-colorpicker-overlay":!this.inline}]},inputClass(){return["p-colorpicker-preview p-inputtext",{"p-disabled":this.disabled}]},pickerClass(){return["p-colorpicker-panel",this.panelClass,{"p-colorpicker-overlay-panel":!this.inline,"p-disabled":this.disabled,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},appendDisabled(){return"self"===this.appendTo||this.inline},appendTarget(){return this.appendDisabled?null:this.appendTo}}};const p={class:"p-colorpicker-content"},c={class:"p-colorpicker-color"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: .85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: .85;\n cursor: pointer;\n}\n"),u.render=function(e,t,i,n,u,b){return o(),s("div",{ref:"container",class:b.containerClass},[i.inline?l("",!0):(o(),s("input",{key:0,ref:"input",type:"text",class:b.inputClass,readonly:"readonly",tabindex:i.tabindex,disabled:i.disabled,onClick:t[1]||(t[1]=(...e)=>b.onInputClick&&b.onInputClick(...e)),onKeydown:t[2]||(t[2]=(...e)=>b.onInputKeydown&&b.onInputKeydown(...e)),"aria-labelledby":i.ariaLabelledBy},null,42,["tabindex","disabled","aria-labelledby"])),(o(),s(r,{to:b.appendTarget,disabled:b.appendDisabled},[a(h,{name:"p-connected-overlay",onEnter:b.onOverlayEnter,onLeave:b.onOverlayLeave,onAfterLeave:b.onOverlayAfterLeave},{default:d((()=>[i.inline||u.overlayVisible?(o(),s("div",{key:0,ref:b.pickerRef,class:b.pickerClass,onClick:t[11]||(t[11]=(...e)=>b.onOverlayClick&&b.onOverlayClick(...e))},[a("div",p,[a("div",{ref:b.colorSelectorRef,class:"p-colorpicker-color-selector",onMousedown:t[3]||(t[3]=e=>b.onColorMousedown(e)),onTouchstart:t[4]||(t[4]=e=>b.onColorDragStart(e)),onTouchmove:t[5]||(t[5]=e=>b.onDrag(e)),onTouchend:t[6]||(t[6]=e=>b.onDragEnd())},[a("div",c,[a("div",{ref:b.colorHandleRef,class:"p-colorpicker-color-handle"},null,512)])],544),a("div",{ref:b.hueViewRef,class:"p-colorpicker-hue",onMousedown:t[7]||(t[7]=e=>b.onHueMousedown(e)),onTouchstart:t[8]||(t[8]=e=>b.onHueDragStart(e)),onTouchmove:t[9]||(t[9]=e=>b.onDrag(e)),onTouchend:t[10]||(t[10]=e=>b.onDragEnd())},[a("div",{ref:b.hueHandleRef,class:"p-colorpicker-hue-handle"},null,512)],544)])],2)):l("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export{u as default};
|