@privyid/persona 1.2.1 → 1.2.2-rc.2
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/dist/components/accordion/Accordion.vue +111 -0
- package/dist/components/accordion/Accordion.vue.d.ts +80 -0
- package/dist/components/accordion/AccordionItem.vue +224 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +121 -0
- package/dist/components/accordion/AccordionItems.vue +50 -0
- package/dist/components/accordion/AccordionItems.vue.d.ts +41 -0
- package/dist/components/accordion/index.d.ts +7 -0
- package/dist/components/accordion/index.mjs +3 -0
- package/dist/components/aspect-ratio/index.d.ts +3 -0
- package/dist/components/aspect-ratio/index.mjs +21 -0
- package/dist/components/aspect-ratio/utils/calculate-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/utils/calculate-ratio.mjs +10 -0
- package/dist/components/aspect-ratio/utils/resize-observer.d.ts +1 -0
- package/dist/components/aspect-ratio/utils/resize-observer.mjs +22 -0
- package/dist/components/avatar/Avatar.vue +167 -0
- package/dist/components/avatar/Avatar.vue.d.ts +91 -0
- package/dist/components/avatar/AvatarGroup.vue +39 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +40 -0
- package/dist/components/avatar/AvatarTruncate.vue +33 -0
- package/dist/components/avatar/AvatarTruncate.vue.d.ts +31 -0
- package/dist/components/avatar/assets/avatar-old.png +0 -0
- package/dist/components/avatar/assets/avatar.png +0 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.mjs +0 -0
- package/dist/components/avatar/utils/color-hash.d.ts +2 -0
- package/dist/components/avatar/utils/color-hash.mjs +22 -0
- package/dist/components/avatar/utils/create-image.d.ts +5 -0
- package/dist/components/avatar/utils/create-image.mjs +19 -0
- package/dist/components/avatar/utils/load-image.d.ts +1 -0
- package/dist/components/avatar/utils/load-image.mjs +22 -0
- package/dist/components/badge/Badge.vue +210 -0
- package/dist/components/badge/Badge.vue.d.ts +41 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/badge/index.mjs +0 -0
- package/dist/components/banner/Banner.vue +183 -0
- package/dist/components/banner/Banner.vue.d.ts +91 -0
- package/dist/components/banner/index.d.ts +1 -0
- package/dist/components/banner/index.mjs +0 -0
- package/dist/components/breadcrumbs/Breadcrumb.vue +55 -0
- package/dist/components/breadcrumbs/Breadcrumb.vue.d.ts +59 -0
- package/dist/components/breadcrumbs/BreadcrumbItem.vue +83 -0
- package/dist/components/breadcrumbs/BreadcrumbItem.vue.d.ts +40 -0
- package/dist/components/breadcrumbs/BreadcrumbItemDropdown.vue +73 -0
- package/dist/components/breadcrumbs/BreadcrumbItemDropdown.vue.d.ts +38 -0
- package/dist/components/breadcrumbs/index.d.ts +11 -0
- package/dist/components/breadcrumbs/index.mjs +3 -0
- package/dist/components/button/Button.vue +391 -0
- package/dist/components/button/Button.vue.d.ts +108 -0
- package/dist/components/button/index.d.ts +5 -0
- package/dist/components/button/index.mjs +0 -0
- package/dist/components/button-group/ButtonGroup.vue +211 -0
- package/dist/components/button-group/ButtonGroup.vue.d.ts +40 -0
- package/dist/components/button-group/index.d.ts +6 -0
- package/dist/components/button-group/index.mjs +1 -0
- package/dist/components/calendar/Calendar.vue +396 -0
- package/dist/components/calendar/Calendar.vue.d.ts +120 -0
- package/dist/components/calendar/adapter/adapter.d.ts +32 -0
- package/dist/components/calendar/adapter/adapter.mjs +43 -0
- package/dist/components/calendar/adapter/date.d.ts +2 -0
- package/dist/components/calendar/adapter/date.mjs +86 -0
- package/dist/components/calendar/adapter/month.d.ts +2 -0
- package/dist/components/calendar/adapter/month.mjs +66 -0
- package/dist/components/calendar/adapter/year.d.ts +2 -0
- package/dist/components/calendar/adapter/year.mjs +63 -0
- package/dist/components/camera/Camera.vue +356 -0
- package/dist/components/camera/Camera.vue.d.ts +123 -0
- package/dist/components/camera/adapter/adapter.d.ts +41 -0
- package/dist/components/camera/adapter/adapter.mjs +3 -0
- package/dist/components/camera/adapter/capture.d.ts +5 -0
- package/dist/components/camera/adapter/capture.mjs +12 -0
- package/dist/components/camera/adapter/liveness.d.ts +5 -0
- package/dist/components/camera/adapter/liveness.mjs +46 -0
- package/dist/components/camera/adapter/qr-code.d.ts +2 -0
- package/dist/components/camera/adapter/qr-code.mjs +19 -0
- package/dist/components/camera/assets/shutter.wav +0 -0
- package/dist/components/camera/utils/motion.d.ts +29 -0
- package/dist/components/camera/utils/motion.mjs +88 -0
- package/dist/components/camera/utils/take-picture.d.ts +1 -0
- package/dist/components/camera/utils/take-picture.mjs +14 -0
- package/dist/components/caption/Caption.vue +112 -0
- package/dist/components/caption/Caption.vue.d.ts +50 -0
- package/dist/components/caption/index.d.ts +1 -0
- package/dist/components/caption/index.mjs +0 -0
- package/dist/components/card/Card.vue +330 -0
- package/dist/components/card/Card.vue.d.ts +118 -0
- package/dist/components/card/CardSection.vue +69 -0
- package/dist/components/card/CardSection.vue.d.ts +56 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.mjs +0 -0
- package/dist/components/carousel/Carousel.vue +177 -0
- package/dist/components/carousel/Carousel.vue.d.ts +123 -0
- package/dist/components/carousel/CarouselBody.vue +16 -0
- package/dist/components/carousel/CarouselBody.vue.d.ts +17 -0
- package/dist/components/carousel/CarouselItem.vue +10 -0
- package/dist/components/carousel/CarouselItem.vue.d.ts +17 -0
- package/dist/components/carousel/index.d.ts +4 -0
- package/dist/components/carousel/index.mjs +1 -0
- package/dist/components/chart/Chart.vue +129 -0
- package/dist/components/chart/Chart.vue.d.ts +63 -0
- package/dist/components/chart/ChartSet.vue +28 -0
- package/dist/components/chart/ChartSet.vue.d.ts +57 -0
- package/dist/components/chart/ChartVal.vue +32 -0
- package/dist/components/chart/ChartVal.vue.d.ts +67 -0
- package/dist/components/chart/adapter/adapter.d.ts +7 -0
- package/dist/components/chart/adapter/adapter.mjs +3 -0
- package/dist/components/chart/adapter/bubble.d.ts +2 -0
- package/dist/components/chart/adapter/bubble.mjs +26 -0
- package/dist/components/chart/adapter/index.d.ts +3 -0
- package/dist/components/chart/adapter/index.mjs +16 -0
- package/dist/components/chart/adapter/line.d.ts +2 -0
- package/dist/components/chart/adapter/line.mjs +66 -0
- package/dist/components/chart/adapter/pie.d.ts +2 -0
- package/dist/components/chart/adapter/pie.mjs +34 -0
- package/dist/components/chart/index.d.ts +2 -0
- package/dist/components/chart/index.mjs +0 -0
- package/dist/components/chart/utils/use-chart.d.ts +2 -0
- package/dist/components/chart/utils/use-chart.mjs +9 -0
- package/dist/components/checkbox/Checkbox.vue +213 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +105 -0
- package/dist/components/checkbox/icon/IconCheckbox.vue +13 -0
- package/dist/components/checkbox/icon/IconCheckbox.vue.d.ts +2 -0
- package/dist/components/checkbox/icon/IconInderteminate.vue +12 -0
- package/dist/components/checkbox/icon/IconInderteminate.vue.d.ts +2 -0
- package/dist/components/checkbox/index.d.ts +7 -0
- package/dist/components/checkbox/index.mjs +34 -0
- package/dist/components/collapse/Collapse.vue +58 -0
- package/dist/components/collapse/Collapse.vue.d.ts +42 -0
- package/dist/components/contextual-bar/ContextualBar.vue +433 -0
- package/dist/components/contextual-bar/ContextualBar.vue.d.ts +124 -0
- package/dist/components/contextual-bar/index.d.ts +1 -0
- package/dist/components/contextual-bar/index.mjs +0 -0
- package/dist/components/cropper/Cropper.vue +382 -0
- package/dist/components/cropper/Cropper.vue.d.ts +195 -0
- package/dist/components/cropper/index.d.ts +1 -0
- package/dist/components/cropper/index.mjs +3 -0
- package/dist/components/cropper/utils/crop-image.d.ts +44 -0
- package/dist/components/cropper/utils/crop-image.mjs +43 -0
- package/dist/components/cropper/utils/use-pinch.d.ts +8 -0
- package/dist/components/cropper/utils/use-pinch.mjs +50 -0
- package/dist/components/cropper/utils/use-preview.d.ts +3 -0
- package/dist/components/cropper/utils/use-preview.mjs +21 -0
- package/dist/components/cropper/utils/use-ratio.d.ts +9 -0
- package/dist/components/cropper/utils/use-ratio.mjs +24 -0
- package/dist/components/datepicker/Datepicker.vue +204 -0
- package/dist/components/datepicker/Datepicker.vue.d.ts +181 -0
- package/dist/components/dialog/Dialog.vue +130 -0
- package/dist/components/dialog/Dialog.vue.d.ts +8 -0
- package/dist/components/dialog/DialogFooter.vue +121 -0
- package/dist/components/dialog/DialogFooter.vue.d.ts +132 -0
- package/dist/components/dialog/index.d.ts +52 -0
- package/dist/components/dialog/index.mjs +86 -0
- package/dist/components/divider/Divider.vue +61 -0
- package/dist/components/divider/Divider.vue.d.ts +14 -0
- package/dist/components/dot/Dot.vue +95 -0
- package/dist/components/dot/Dot.vue.d.ts +26 -0
- package/dist/components/dot/index.d.ts +1 -0
- package/dist/components/dot/index.mjs +0 -0
- package/dist/components/dropdown/Dropdown.vue +381 -0
- package/dist/components/dropdown/Dropdown.vue.d.ts +301 -0
- package/dist/components/dropdown/DropdownHeader.vue +33 -0
- package/dist/components/dropdown/DropdownHeader.vue.d.ts +18 -0
- package/dist/components/dropdown/DropdownItem.vue +87 -0
- package/dist/components/dropdown/DropdownItem.vue.d.ts +62 -0
- package/dist/components/dropdown/DropdownText.vue +34 -0
- package/dist/components/dropdown/DropdownText.vue.d.ts +17 -0
- package/dist/components/dropdown/index.d.ts +10 -0
- package/dist/components/dropdown/index.mjs +1 -0
- package/dist/components/dropdown/utils/use-focus.d.ts +5 -0
- package/dist/components/dropdown/utils/use-focus.mjs +22 -0
- package/dist/components/dropdown-subitem/DropdownSubitem.vue +153 -0
- package/dist/components/dropdown-subitem/DropdownSubitem.vue.d.ts +58 -0
- package/dist/components/dropdown-subitem/index.d.ts +12 -0
- package/dist/components/dropdown-subitem/index.mjs +1 -0
- package/dist/components/dropzone/Dropzone.vue +205 -0
- package/dist/components/dropzone/Dropzone.vue.d.ts +139 -0
- package/dist/components/dropzone/index.d.ts +4 -0
- package/dist/components/dropzone/index.mjs +0 -0
- package/dist/components/dropzone/utils/accept.d.ts +1 -0
- package/dist/components/dropzone/utils/accept.mjs +17 -0
- package/dist/components/filterbar/Filterbar.vue +103 -0
- package/dist/components/filterbar/Filterbar.vue.d.ts +2495 -0
- package/dist/components/filterbar/index.d.ts +45 -0
- package/dist/components/filterbar/index.mjs +7 -0
- package/dist/components/filterbar/pinned/PinnedDate.vue +100 -0
- package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +508 -0
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue +113 -0
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue.d.ts +675 -0
- package/dist/components/filterbar/pinned/PinnedSelect.vue +100 -0
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +607 -0
- package/dist/components/filterbar/pinned/PinnedToggle.vue +77 -0
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +220 -0
- package/dist/components/form-group/FormGroup.vue +155 -0
- package/dist/components/form-group/FormGroup.vue.d.ts +105 -0
- package/dist/components/global/router.d.ts +24 -0
- package/dist/components/global/router.mjs +7 -0
- package/dist/components/global/store.d.ts +49 -0
- package/dist/components/global/store.mjs +52 -0
- package/dist/components/global/types.d.ts +4 -0
- package/dist/components/global/types.mjs +0 -0
- package/dist/components/global/use-singleton.d.ts +21 -0
- package/dist/components/global/use-singleton.mjs +60 -0
- package/dist/components/global/utils/queue.d.ts +16 -0
- package/dist/components/global/utils/queue.mjs +35 -0
- package/dist/components/heading/Heading.vue +128 -0
- package/dist/components/heading/Heading.vue.d.ts +49 -0
- package/dist/components/heading/index.d.ts +3 -0
- package/dist/components/heading/index.mjs +0 -0
- package/dist/components/input/Input.vue +215 -0
- package/dist/components/input/Input.vue.d.ts +111 -0
- package/dist/components/input/index.d.ts +6 -0
- package/dist/components/input/index.mjs +25 -0
- package/dist/components/input/utils/accept.d.ts +26 -0
- package/dist/components/input/utils/accept.mjs +81 -0
- package/dist/components/input-color/index.d.ts +1 -0
- package/dist/components/input-color/index.mjs +0 -0
- package/dist/components/input-color/inputColor.vue +245 -0
- package/dist/components/input-color/inputColor.vue.d.ts +88 -0
- package/dist/components/input-file/InputFile.vue +195 -0
- package/dist/components/input-file/InputFile.vue.d.ts +755 -0
- package/dist/components/input-group/InputGroup.vue +177 -0
- package/dist/components/input-group/InputGroup.vue.d.ts +58 -0
- package/dist/components/input-group/InputGroupAddon.vue +42 -0
- package/dist/components/input-group/InputGroupAddon.vue.d.ts +17 -0
- package/dist/components/input-group/index.d.ts +6 -0
- package/dist/components/input-group/index.mjs +1 -0
- package/dist/components/input-password/InputPassword.vue +100 -0
- package/dist/components/input-password/InputPassword.vue.d.ts +86 -0
- package/dist/components/input-password/index.d.ts +2 -0
- package/dist/components/input-password/index.mjs +17 -0
- package/dist/components/input-pin/InputPin.vue +142 -0
- package/dist/components/input-pin/InputPin.vue.d.ts +77 -0
- package/dist/components/input-pin/index.d.ts +6 -0
- package/dist/components/input-pin/index.mjs +3 -0
- package/dist/components/input-range/InputRange.vue +253 -0
- package/dist/components/input-range/InputRange.vue.d.ts +106 -0
- package/dist/components/input-range/utils/use-drag.d.ts +3 -0
- package/dist/components/input-range/utils/use-drag.mjs +26 -0
- package/dist/components/label/Label.vue +249 -0
- package/dist/components/label/Label.vue.d.ts +63 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.mjs +0 -0
- package/dist/components/list-group/ListGroup.vue +73 -0
- package/dist/components/list-group/ListGroup.vue.d.ts +56 -0
- package/dist/components/list-group/ListGroupItem.vue +79 -0
- package/dist/components/list-group/ListGroupItem.vue.d.ts +49 -0
- package/dist/components/list-group/index.d.ts +1 -0
- package/dist/components/list-group/index.mjs +0 -0
- package/dist/components/main/Main.vue +66 -0
- package/dist/components/main/Main.vue.d.ts +17 -0
- package/dist/components/markdown/index.d.ts +29 -0
- package/dist/components/markdown/index.mjs +25 -0
- package/dist/components/meta.json +171 -0
- package/dist/components/modal/Modal.vue +514 -0
- package/dist/components/modal/Modal.vue.d.ts +196 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/modal/index.mjs +0 -0
- package/dist/components/nav/Nav.vue +403 -0
- package/dist/components/nav/Nav.vue.d.ts +104 -0
- package/dist/components/nav/NavCollapse.vue +60 -0
- package/dist/components/nav/NavCollapse.vue.d.ts +164 -0
- package/dist/components/nav/NavForm.vue +23 -0
- package/dist/components/nav/NavForm.vue.d.ts +17 -0
- package/dist/components/nav/NavItem.vue +165 -0
- package/dist/components/nav/NavItem.vue.d.ts +80 -0
- package/dist/components/nav/NavItemDropdown.vue +104 -0
- package/dist/components/nav/NavItemDropdown.vue.d.ts +122 -0
- package/dist/components/nav/NavSubItem.vue +178 -0
- package/dist/components/nav/NavSubItem.vue.d.ts +45 -0
- package/dist/components/nav/NavText.vue +19 -0
- package/dist/components/nav/NavText.vue.d.ts +17 -0
- package/dist/components/nav/index.d.ts +2 -0
- package/dist/components/nav/index.mjs +0 -0
- package/dist/components/navbar/Navbar.vue +270 -0
- package/dist/components/navbar/Navbar.vue.d.ts +70 -0
- package/dist/components/navbar/NavbarBrand.vue +30 -0
- package/dist/components/navbar/NavbarBrand.vue.d.ts +29 -0
- package/dist/components/navbar/NavbarNav.vue +110 -0
- package/dist/components/navbar/NavbarNav.vue.d.ts +31 -0
- package/dist/components/navbar/NavbarToggle.vue +67 -0
- package/dist/components/navbar/NavbarToggle.vue.d.ts +19 -0
- package/dist/components/navbar/index.d.ts +9 -0
- package/dist/components/navbar/index.mjs +1 -0
- package/dist/components/navbar-menu/NavbarNavMenu.vue +56 -0
- package/dist/components/navbar-menu/NavbarNavMenu.vue.d.ts +16 -0
- package/dist/components/notify/Notify.vue +36 -0
- package/dist/components/notify/Notify.vue.d.ts +6 -0
- package/dist/components/notify/NotifyGroup.vue +214 -0
- package/dist/components/notify/NotifyGroup.vue.d.ts +34 -0
- package/dist/components/notify/NotifyItem.vue +33 -0
- package/dist/components/notify/NotifyItem.vue.d.ts +22 -0
- package/dist/components/notify/index.d.ts +20 -0
- package/dist/components/notify/index.mjs +18 -0
- package/dist/components/overlay/Overlay.vue +63 -0
- package/dist/components/overlay/Overlay.vue.d.ts +19 -0
- package/dist/components/overlay/assets/icon-white.svg +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.mjs +8 -0
- package/dist/components/overlay/utils/use-loading.d.ts +4 -0
- package/dist/components/overlay/utils/use-loading.mjs +28 -0
- package/dist/components/page/Page.vue +93 -0
- package/dist/components/page/Page.vue.d.ts +54 -0
- package/dist/components/pagination/Pagination.vue +373 -0
- package/dist/components/pagination/Pagination.vue.d.ts +261 -0
- package/dist/components/pagination/index.d.ts +14 -0
- package/dist/components/pagination/index.mjs +38 -0
- package/dist/components/pagination/utils/calculate-page.d.ts +11 -0
- package/dist/components/pagination/utils/calculate-page.mjs +48 -0
- package/dist/components/pdf-helipad/PdfHelipad.vue +129 -0
- package/dist/components/pdf-helipad/PdfHelipad.vue.d.ts +68 -0
- package/dist/components/pdf-helipad/index.d.ts +7 -0
- package/dist/components/pdf-helipad/index.mjs +0 -0
- package/dist/components/pdf-helipad/utils/use-drag.d.ts +3 -0
- package/dist/components/pdf-helipad/utils/use-drag.mjs +38 -0
- package/dist/components/pdf-object/PdfObject.vue +304 -0
- package/dist/components/pdf-object/PdfObject.vue.d.ts +151 -0
- package/dist/components/pdf-object/PdfObjectAddon.vue +49 -0
- package/dist/components/pdf-object/PdfObjectAddon.vue.d.ts +31 -0
- package/dist/components/pdf-object/PdfObjectDebugger.vue +66 -0
- package/dist/components/pdf-object/PdfObjectDebugger.vue.d.ts +2 -0
- package/dist/components/pdf-object/PdfObjects.vue +35 -0
- package/dist/components/pdf-object/PdfObjects.vue.d.ts +31 -0
- package/dist/components/pdf-object/index.d.ts +63 -0
- package/dist/components/pdf-object/index.mjs +110 -0
- package/dist/components/pdf-object/utils/overlap.d.ts +51 -0
- package/dist/components/pdf-object/utils/overlap.mjs +54 -0
- package/dist/components/pdf-object/utils/position.d.ts +64 -0
- package/dist/components/pdf-object/utils/position.mjs +48 -0
- package/dist/components/pdf-object/utils/use-drag.d.ts +9 -0
- package/dist/components/pdf-object/utils/use-drag.mjs +69 -0
- package/dist/components/pdf-object/utils/use-drop.d.ts +7 -0
- package/dist/components/pdf-object/utils/use-drop.mjs +57 -0
- package/dist/components/pdf-object/utils/use-resize.d.ts +17 -0
- package/dist/components/pdf-object/utils/use-resize.mjs +90 -0
- package/dist/components/pdf-object/utils/use-selector.d.ts +4 -0
- package/dist/components/pdf-object/utils/use-selector.mjs +26 -0
- package/dist/components/pdf-text/PdfText.vue +125 -0
- package/dist/components/pdf-text/PdfText.vue.d.ts +170 -0
- package/dist/components/pdf-text/utils/text-to-image.d.ts +68 -0
- package/dist/components/pdf-text/utils/text-to-image.mjs +120 -0
- package/dist/components/pdf-viewer/PdfError.vue +70 -0
- package/dist/components/pdf-viewer/PdfError.vue.d.ts +24 -0
- package/dist/components/pdf-viewer/PdfLoading.vue +24 -0
- package/dist/components/pdf-viewer/PdfLoading.vue.d.ts +2 -0
- package/dist/components/pdf-viewer/PdfNavigation.vue +165 -0
- package/dist/components/pdf-viewer/PdfNavigation.vue.d.ts +49 -0
- package/dist/components/pdf-viewer/PdfViewer.vue +319 -0
- package/dist/components/pdf-viewer/PdfViewer.vue.d.ts +187 -0
- package/dist/components/pdf-viewer/assets/pdf-loading.svg +1 -0
- package/dist/components/pdf-viewer/index.d.ts +25 -0
- package/dist/components/pdf-viewer/index.mjs +24 -0
- package/dist/components/pdf-viewer/utils/pdfjs.d.ts +69 -0
- package/dist/components/pdf-viewer/utils/pdfjs.mjs +57 -0
- package/dist/components/pdf-viewer/utils/use-idle.d.ts +2 -0
- package/dist/components/pdf-viewer/utils/use-idle.mjs +25 -0
- package/dist/components/pdf-viewer/utils/use-sticky.d.ts +6 -0
- package/dist/components/pdf-viewer/utils/use-sticky.mjs +49 -0
- package/dist/components/pdf-viewer/utils/use-viewer.d.ts +27 -0
- package/dist/components/pdf-viewer/utils/use-viewer.mjs +193 -0
- package/dist/components/popover/Popover.vue +109 -0
- package/dist/components/popover/Popover.vue.d.ts +209 -0
- package/dist/components/popover/index.d.ts +17 -0
- package/dist/components/popover/index.mjs +52 -0
- package/dist/components/popup/Popup.vue +412 -0
- package/dist/components/popup/Popup.vue.d.ts +112 -0
- package/dist/components/popup/index.d.ts +39 -0
- package/dist/components/popup/index.mjs +31 -0
- package/dist/components/progress/Progress.vue +198 -0
- package/dist/components/progress/Progress.vue.d.ts +53 -0
- package/dist/components/progress/ProgressItem.vue +46 -0
- package/dist/components/progress/ProgressItem.vue.d.ts +43 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.mjs +0 -0
- package/dist/components/progress-indicator/ProgressIndicator.vue +114 -0
- package/dist/components/progress-indicator/ProgressIndicator.vue.d.ts +40 -0
- package/dist/components/progressbar/Progressbar.vue +105 -0
- package/dist/components/progressbar/Progressbar.vue.d.ts +59 -0
- package/dist/components/progressbar/index.d.ts +7 -0
- package/dist/components/progressbar/index.mjs +11 -0
- package/dist/components/pspdfkit/PspdfHelipad.vue +142 -0
- package/dist/components/pspdfkit/PspdfHelipad.vue.d.ts +68 -0
- package/dist/components/pspdfkit/PspdfObject.vue +291 -0
- package/dist/components/pspdfkit/PspdfObject.vue.d.ts +151 -0
- package/dist/components/pspdfkit/PspdfObjectAddon.vue +24 -0
- package/dist/components/pspdfkit/PspdfObjectAddon.vue.d.ts +31 -0
- package/dist/components/pspdfkit/PspdfObjects.vue +27 -0
- package/dist/components/pspdfkit/PspdfObjects.vue.d.ts +19 -0
- package/dist/components/pspdfkit/PspdfViewer.vue +223 -0
- package/dist/components/pspdfkit/PspdfViewer.vue.d.ts +142 -0
- package/dist/components/pspdfkit/css/custom.css +1 -0
- package/dist/components/pspdfkit/index.d.ts +8 -0
- package/dist/components/pspdfkit/index.mjs +7 -0
- package/dist/components/pspdfkit/utils/position.d.ts +1 -0
- package/dist/components/pspdfkit/utils/position.mjs +5 -0
- package/dist/components/pspdfkit/utils/pspdfkit.d.ts +17 -0
- package/dist/components/pspdfkit/utils/pspdfkit.mjs +53 -0
- package/dist/components/pspdfkit/utils/use-drop.d.ts +2 -0
- package/dist/components/pspdfkit/utils/use-drop.mjs +41 -0
- package/dist/components/pspdfkit/utils/use-viewer.d.ts +17 -0
- package/dist/components/pspdfkit/utils/use-viewer.mjs +167 -0
- package/dist/components/qrcode/Qrcode.vue +150 -0
- package/dist/components/qrcode/Qrcode.vue.d.ts +145 -0
- package/dist/components/qrcode/index.d.ts +1 -0
- package/dist/components/qrcode/index.mjs +0 -0
- package/dist/components/radio/Radio.vue +285 -0
- package/dist/components/radio/Radio.vue.d.ts +97 -0
- package/dist/components/radio/index.d.ts +7 -0
- package/dist/components/radio/index.mjs +16 -0
- package/dist/components/richtext/Richtext.vue +271 -0
- package/dist/components/richtext/Richtext.vue.d.ts +78 -0
- package/dist/components/richtext/RichtextToolbarAdvance.vue +37 -0
- package/dist/components/richtext/RichtextToolbarAdvance.vue.d.ts +2 -0
- package/dist/components/richtext/RichtextToolbarSimple.vue +146 -0
- package/dist/components/richtext/RichtextToolbarSimple.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlFontFamily.vue +52 -0
- package/dist/components/richtext/control/RichtextControlFontFamily.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlFontSize.vue +74 -0
- package/dist/components/richtext/control/RichtextControlFontSize.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlHighlight.vue +127 -0
- package/dist/components/richtext/control/RichtextControlHighlight.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlHistory.vue +26 -0
- package/dist/components/richtext/control/RichtextControlHistory.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlImage.vue +32 -0
- package/dist/components/richtext/control/RichtextControlImage.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlLink.vue +44 -0
- package/dist/components/richtext/control/RichtextControlLink.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlList.vue +43 -0
- package/dist/components/richtext/control/RichtextControlList.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlTable.vue +90 -0
- package/dist/components/richtext/control/RichtextControlTable.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlTextAlign.vue +78 -0
- package/dist/components/richtext/control/RichtextControlTextAlign.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlTextFormat.vue +48 -0
- package/dist/components/richtext/control/RichtextControlTextFormat.vue.d.ts +2 -0
- package/dist/components/richtext/control/RichtextControlTextHeading.vue +93 -0
- package/dist/components/richtext/control/RichtextControlTextHeading.vue.d.ts +2 -0
- package/dist/components/richtext/index.d.ts +7 -0
- package/dist/components/richtext/index.mjs +7 -0
- package/dist/components/richtext/popup/RichtextPopupImageEdit.vue +64 -0
- package/dist/components/richtext/popup/RichtextPopupImageEdit.vue.d.ts +2 -0
- package/dist/components/richtext/popup/RichtextPopupLinkDetail.vue +79 -0
- package/dist/components/richtext/popup/RichtextPopupLinkDetail.vue.d.ts +2 -0
- package/dist/components/richtext/popup/RichtextPopupLinkEdit.vue +64 -0
- package/dist/components/richtext/popup/RichtextPopupLinkEdit.vue.d.ts +22 -0
- package/dist/components/richtext/tiptap/image-align.d.ts +43 -0
- package/dist/components/richtext/tiptap/image-align.mjs +60 -0
- package/dist/components/ringbar/Ringbar.vue +148 -0
- package/dist/components/ringbar/Ringbar.vue.d.ts +62 -0
- package/dist/components/ringbar/index.d.ts +1 -0
- package/dist/components/ringbar/index.mjs +0 -0
- package/dist/components/select/Select.vue +499 -0
- package/dist/components/select/Select.vue.d.ts +753 -0
- package/dist/components/select/SelectInput.vue +101 -0
- package/dist/components/select/SelectInput.vue.d.ts +71 -0
- package/dist/components/select/SelectTags.vue +53 -0
- package/dist/components/select/SelectTags.vue.d.ts +34 -0
- package/dist/components/select/adapter/adapter.d.ts +17 -0
- package/dist/components/select/adapter/adapter.mjs +20 -0
- package/dist/components/select/adapter/async-adapter.d.ts +17 -0
- package/dist/components/select/adapter/async-adapter.mjs +61 -0
- package/dist/components/select/adapter/basic-adapter.d.ts +5 -0
- package/dist/components/select/adapter/basic-adapter.mjs +13 -0
- package/dist/components/select/adapter/fuzzy-adapter.d.ts +2 -0
- package/dist/components/select/adapter/fuzzy-adapter.mjs +24 -0
- package/dist/components/select/index.d.ts +15 -0
- package/dist/components/select/index.mjs +20 -0
- package/dist/components/select/utils/use-on-scroll.d.ts +2 -0
- package/dist/components/select/utils/use-on-scroll.mjs +9 -0
- package/dist/components/select/utils/use-on-typing.d.ts +3 -0
- package/dist/components/select/utils/use-on-typing.mjs +8 -0
- package/dist/components/sheet/Sheet.vue +210 -0
- package/dist/components/sheet/Sheet.vue.d.ts +79 -0
- package/dist/components/shimmer/Shimmer.vue +121 -0
- package/dist/components/shimmer/Shimmer.vue.d.ts +47 -0
- package/dist/components/shimmer/index.d.ts +2 -0
- package/dist/components/shimmer/index.mjs +10 -0
- package/dist/components/sidebar/Sidebar.vue +225 -0
- package/dist/components/sidebar/Sidebar.vue.d.ts +99 -0
- package/dist/components/sidebar/SidebarBrand.vue +101 -0
- package/dist/components/sidebar/SidebarBrand.vue.d.ts +52 -0
- package/dist/components/sidebar/SidebarContent.vue +21 -0
- package/dist/components/sidebar/SidebarContent.vue.d.ts +16 -0
- package/dist/components/sidebar/SidebarNav.vue +254 -0
- package/dist/components/sidebar/SidebarNav.vue.d.ts +77 -0
- package/dist/components/sidebar/index.d.ts +9 -0
- package/dist/components/sidebar/index.mjs +1 -0
- package/dist/components/sidebar-menu/SidebarMenu.vue +112 -0
- package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +112 -0
- package/dist/components/sidebar-menu/SidebarMenuItem.vue +67 -0
- package/dist/components/sidebar-menu/SidebarMenuItem.vue.d.ts +25 -0
- package/dist/components/sidebar-menu/index.d.ts +138 -0
- package/dist/components/sidebar-menu/index.mjs +44 -0
- package/dist/components/signature-draw/SignatureDraw.vue +91 -0
- package/dist/components/signature-draw/SignatureDraw.vue.d.ts +98 -0
- package/dist/components/signature-draw/SignatureDrawDesktop.vue +148 -0
- package/dist/components/signature-draw/SignatureDrawDesktop.vue.d.ts +76 -0
- package/dist/components/signature-draw/SignatureDrawMobile.vue +212 -0
- package/dist/components/signature-draw/SignatureDrawMobile.vue.d.ts +94 -0
- package/dist/components/signature-draw/utils/canvas.d.ts +41 -0
- package/dist/components/signature-draw/utils/canvas.mjs +55 -0
- package/dist/components/signature-draw/utils/image.d.ts +7 -0
- package/dist/components/signature-draw/utils/image.mjs +23 -0
- package/dist/components/signature-draw/utils/smooth-line.d.ts +36 -0
- package/dist/components/signature-draw/utils/smooth-line.mjs +56 -0
- package/dist/components/signature-draw/utils/straight-line.d.ts +8 -0
- package/dist/components/signature-draw/utils/straight-line.mjs +24 -0
- package/dist/components/signature-draw/utils/use-draw.d.ts +7 -0
- package/dist/components/signature-draw/utils/use-draw.mjs +29 -0
- package/dist/components/signature-text/SignatureText.vue +114 -0
- package/dist/components/signature-text/SignatureText.vue.d.ts +98 -0
- package/dist/components/signature-text/utils/formatter.d.ts +2 -0
- package/dist/components/signature-text/utils/formatter.mjs +8 -0
- package/dist/components/signature-text/utils/generate-text.d.ts +8 -0
- package/dist/components/signature-text/utils/generate-text.mjs +28 -0
- package/dist/components/signature-text/utils/load-font.d.ts +1 -0
- package/dist/components/signature-text/utils/load-font.mjs +22 -0
- package/dist/components/spinner/Spinner.vue +156 -0
- package/dist/components/spinner/Spinner.vue.d.ts +2 -0
- package/dist/components/spinner/SpinnerRing.vue +34 -0
- package/dist/components/spinner/SpinnerRing.vue.d.ts +2 -0
- package/dist/components/spinner/SpinnerRinggo.vue +61 -0
- package/dist/components/spinner/SpinnerRinggo.vue.d.ts +2 -0
- package/dist/components/spread/Spread.vue +52 -0
- package/dist/components/spread/Spread.vue.d.ts +29 -0
- package/dist/components/steps/Step.vue +42 -0
- package/dist/components/steps/Step.vue.d.ts +48 -0
- package/dist/components/steps/StepSlider.vue +37 -0
- package/dist/components/steps/StepSlider.vue.d.ts +34 -0
- package/dist/components/steps/Steps.vue +116 -0
- package/dist/components/steps/Steps.vue.d.ts +100 -0
- package/dist/components/steps/index.d.ts +30 -0
- package/dist/components/steps/index.mjs +53 -0
- package/dist/components/steps/utils/hook.d.ts +10 -0
- package/dist/components/steps/utils/hook.mjs +35 -0
- package/dist/components/strengthbar/Strengthbar.vue +90 -0
- package/dist/components/strengthbar/Strengthbar.vue.d.ts +41 -0
- package/dist/components/subheading/Subheading.vue +137 -0
- package/dist/components/subheading/Subheading.vue.d.ts +59 -0
- package/dist/components/subheading/index.d.ts +1 -0
- package/dist/components/subheading/index.mjs +0 -0
- package/dist/components/table/Table.vue +391 -0
- package/dist/components/table/Table.vue.d.ts +337 -0
- package/dist/components/table/index.d.ts +49 -0
- package/dist/components/table/index.mjs +37 -0
- package/dist/components/table-flex/TableFlex.vue +309 -0
- package/dist/components/table-flex/TableFlex.vue.d.ts +77 -0
- package/dist/components/table-static/TableStatic.vue +406 -0
- package/dist/components/table-static/TableStatic.vue.d.ts +90 -0
- package/dist/components/table-static/TableStaticRoot.vue +39 -0
- package/dist/components/table-static/TableStaticRoot.vue.d.ts +40 -0
- package/dist/components/table-static/TableStaticSort.vue +22 -0
- package/dist/components/table-static/TableStaticSort.vue.d.ts +14 -0
- package/dist/components/table-static/index.d.ts +64 -0
- package/dist/components/table-static/index.mjs +24 -0
- package/dist/components/tabs/Tab.vue +26 -0
- package/dist/components/tabs/Tab.vue.d.ts +45 -0
- package/dist/components/tabs/TabContent.vue +53 -0
- package/dist/components/tabs/TabContent.vue.d.ts +33 -0
- package/dist/components/tabs/Tabs.vue +209 -0
- package/dist/components/tabs/Tabs.vue.d.ts +96 -0
- package/dist/components/text/Text.vue +220 -0
- package/dist/components/text/Text.vue.d.ts +69 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/index.mjs +0 -0
- package/dist/components/textarea/Textarea.vue +162 -0
- package/dist/components/textarea/Textarea.vue.d.ts +112 -0
- package/dist/components/time/Time.vue +222 -0
- package/dist/components/time/Time.vue.d.ts +104 -0
- package/dist/components/time/TimeItem.vue +96 -0
- package/dist/components/time/TimeItem.vue.d.ts +61 -0
- package/dist/components/time/index.d.ts +19 -0
- package/dist/components/time/index.mjs +53 -0
- package/dist/components/time/utils/index.d.ts +9 -0
- package/dist/components/time/utils/index.mjs +82 -0
- package/dist/components/timepicker/Timepicker.vue +204 -0
- package/dist/components/timepicker/Timepicker.vue.d.ts +182 -0
- package/dist/components/toast/Toast.vue +247 -0
- package/dist/components/toast/Toast.vue.d.ts +118 -0
- package/dist/components/toast/index.d.ts +50 -0
- package/dist/components/toast/index.mjs +44 -0
- package/dist/components/toggle/Toggle.vue +216 -0
- package/dist/components/toggle/Toggle.vue.d.ts +145 -0
- package/dist/components/tooltip/Tooltip.vue +154 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +68 -0
- package/dist/components/tooltip/TooltipContainer.vue +74 -0
- package/dist/components/tooltip/TooltipContainer.vue.d.ts +16 -0
- package/dist/components/tooltip/index.d.ts +17 -0
- package/dist/components/tooltip/index.mjs +113 -0
- package/dist/components/tooltip/utils/create-handler.d.ts +9 -0
- package/dist/components/tooltip/utils/create-handler.mjs +16 -0
- package/dist/components/tooltip/utils/on-hover.d.ts +23 -0
- package/dist/components/tooltip/utils/on-hover.mjs +42 -0
- package/dist/components/tooltip/utils/parse-bindings.d.ts +23 -0
- package/dist/components/tooltip/utils/parse-bindings.mjs +47 -0
- package/dist/components/tour/Tour.vue +99 -0
- package/dist/components/tour/Tour.vue.d.ts +9 -0
- package/dist/components/tour/TourDialog.vue +201 -0
- package/dist/components/tour/TourDialog.vue.d.ts +112 -0
- package/dist/components/tour/TourHighlight.vue +51 -0
- package/dist/components/tour/TourHighlight.vue.d.ts +15 -0
- package/dist/components/tour/core/base.d.ts +59 -0
- package/dist/components/tour/core/base.mjs +69 -0
- package/dist/components/tour/core/step/action.d.ts +15 -0
- package/dist/components/tour/core/step/action.mjs +14 -0
- package/dist/components/tour/core/step/conditional.d.ts +25 -0
- package/dist/components/tour/core/step/conditional.mjs +57 -0
- package/dist/components/tour/core/step/delay.d.ts +8 -0
- package/dist/components/tour/core/step/delay.mjs +9 -0
- package/dist/components/tour/core/step/dialog.d.ts +11 -0
- package/dist/components/tour/core/step/dialog.mjs +25 -0
- package/dist/components/tour/core/step/visit.d.ts +9 -0
- package/dist/components/tour/core/step/visit.mjs +15 -0
- package/dist/components/tour/core/step.d.ts +37 -0
- package/dist/components/tour/core/step.mjs +46 -0
- package/dist/components/tour/core/story.d.ts +130 -0
- package/dist/components/tour/core/story.mjs +166 -0
- package/dist/components/tour/core/tour.d.ts +126 -0
- package/dist/components/tour/core/tour.mjs +196 -0
- package/dist/components/tour/index.d.ts +3 -0
- package/dist/components/tour/index.mjs +4 -0
- package/dist/components/tour/utils/focus.d.ts +1 -0
- package/dist/components/tour/utils/focus.mjs +6 -0
- package/dist/components/tour/utils/is-visible.d.ts +1 -0
- package/dist/components/tour/utils/is-visible.mjs +29 -0
- package/dist/components/tour/utils/wait-element.d.ts +6 -0
- package/dist/components/tour/utils/wait-element.mjs +45 -0
- package/dist/components/truncate/Truncate.vue +69 -0
- package/dist/components/truncate/Truncate.vue.d.ts +68 -0
- package/dist/components/utils/array.d.ts +2 -0
- package/dist/components/utils/array.mjs +19 -0
- package/dist/components/utils/base64.d.ts +8 -0
- package/dist/components/utils/base64.mjs +35 -0
- package/dist/components/utils/color.d.ts +17 -0
- package/dist/components/utils/color.mjs +14 -0
- package/dist/components/utils/date.d.ts +22 -0
- package/dist/components/utils/date.mjs +14 -0
- package/dist/components/utils/value.d.ts +8 -0
- package/dist/components/utils/value.mjs +7 -0
- package/dist/components/utils/vnode.d.ts +15 -0
- package/dist/components/utils/vnode.mjs +18 -0
- package/dist/components/wizard/Wizard.vue +76 -0
- package/dist/components/wizard/Wizard.vue.d.ts +91 -0
- package/dist/components/wizard/WizardBody.vue +38 -0
- package/dist/components/wizard/WizardBody.vue.d.ts +36 -0
- package/dist/components/wizard/WizardHeader.vue +38 -0
- package/dist/components/wizard/WizardHeader.vue.d.ts +16 -0
- package/dist/components/wizard/WizardStep.vue +22 -0
- package/dist/components/wizard/WizardStep.vue.d.ts +55 -0
- package/dist/core/index.d.ts +43 -0
- package/dist/core/index.mjs +148 -0
- package/dist/directive/index.d.ts +3 -0
- package/dist/directive/index.mjs +12 -0
- package/dist/module.d.mts +28 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +92 -13
- package/dist/runtime/plugins/persona.d.ts +2 -0
- package/dist/runtime/plugins/persona.js +35 -0
- package/dist/types.d.mts +4 -8
- package/package.json +1 -4
- package/dist/module.d.cts +0 -2
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p-card
|
|
3
|
+
data-testid="calendar"
|
|
4
|
+
class="calendar"
|
|
5
|
+
element="div"
|
|
6
|
+
:viewmode="viewmode"
|
|
7
|
+
:class="classNames">
|
|
8
|
+
<div class="calendar__nav">
|
|
9
|
+
<p-button
|
|
10
|
+
data-testid="calendar-prev"
|
|
11
|
+
variant="solid"
|
|
12
|
+
icon
|
|
13
|
+
type="button"
|
|
14
|
+
:disabled="!canPrev"
|
|
15
|
+
:readonly="disabled || readonly"
|
|
16
|
+
@click="prev">
|
|
17
|
+
<IconBack />
|
|
18
|
+
</p-button>
|
|
19
|
+
|
|
20
|
+
<p-button
|
|
21
|
+
data-testid="calendar-title"
|
|
22
|
+
class="calendar__nav-title"
|
|
23
|
+
variant="solid"
|
|
24
|
+
type="button"
|
|
25
|
+
:readonly="disabled || readonly"
|
|
26
|
+
@click="changeMode(1)">
|
|
27
|
+
{{ title }}
|
|
28
|
+
</p-button>
|
|
29
|
+
|
|
30
|
+
<p-button
|
|
31
|
+
data-testid="calendar-next"
|
|
32
|
+
variant="solid"
|
|
33
|
+
icon
|
|
34
|
+
type="button"
|
|
35
|
+
:readonly="disabled || readonly"
|
|
36
|
+
:disabled="!canNext"
|
|
37
|
+
@click="next">
|
|
38
|
+
<IconNext />
|
|
39
|
+
</p-button>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<Transition
|
|
43
|
+
:name="transition"
|
|
44
|
+
mode="out-in">
|
|
45
|
+
<div
|
|
46
|
+
:key="`${cursor.toISOString()}+${viewmode}`"
|
|
47
|
+
data-testid="calendar-items"
|
|
48
|
+
class="calendar__items"
|
|
49
|
+
:viewmode="viewmode">
|
|
50
|
+
<template
|
|
51
|
+
v-for="(item, i) in items"
|
|
52
|
+
:key="i">
|
|
53
|
+
<p-button
|
|
54
|
+
variant="solid"
|
|
55
|
+
type="button"
|
|
56
|
+
data-testid="calendar-item"
|
|
57
|
+
class="calendar__item-btn"
|
|
58
|
+
:readonly="item.readonly || disabled || readonly"
|
|
59
|
+
:active="item.active"
|
|
60
|
+
:disabled="item.disabled"
|
|
61
|
+
:class="{
|
|
62
|
+
'calendar__item--in-range': isInRange(item),
|
|
63
|
+
'calendar__item--head': item.head,
|
|
64
|
+
'calendar__item--tail': item.tail
|
|
65
|
+
}"
|
|
66
|
+
@click="selectItem(item)"
|
|
67
|
+
@mouseover="setHover(item)">
|
|
68
|
+
{{ item.text }}
|
|
69
|
+
</p-button>
|
|
70
|
+
</template>
|
|
71
|
+
</div>
|
|
72
|
+
</Transition>
|
|
73
|
+
</p-card>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script setup>
|
|
77
|
+
import pButton from "../button/Button.vue";
|
|
78
|
+
import pCard from "../card/Card.vue";
|
|
79
|
+
import IconNext from "@privyid/persona-icon/vue/chevron-right/20.vue";
|
|
80
|
+
import IconBack from "@privyid/persona-icon/vue/chevron-left/20.vue";
|
|
81
|
+
import {
|
|
82
|
+
ref,
|
|
83
|
+
computed,
|
|
84
|
+
watch
|
|
85
|
+
} from "vue";
|
|
86
|
+
import {
|
|
87
|
+
CalendarFormat,
|
|
88
|
+
validateDuration,
|
|
89
|
+
parseDuration
|
|
90
|
+
} from "./adapter/adapter";
|
|
91
|
+
import DateAdapter from "./adapter/date";
|
|
92
|
+
import MonthAdapter from "./adapter/month";
|
|
93
|
+
import YearAdapter from "./adapter/year";
|
|
94
|
+
import {
|
|
95
|
+
isWithinInterval,
|
|
96
|
+
startOfMonth,
|
|
97
|
+
min as minDate,
|
|
98
|
+
max as maxDate,
|
|
99
|
+
add,
|
|
100
|
+
sub
|
|
101
|
+
} from "date-fns";
|
|
102
|
+
import {
|
|
103
|
+
minTime as MIN_TIME,
|
|
104
|
+
maxTime as MAX_TIME
|
|
105
|
+
} from "date-fns/constants";
|
|
106
|
+
import { syncRef } from "@vueuse/core";
|
|
107
|
+
const Adapters = {
|
|
108
|
+
date: DateAdapter,
|
|
109
|
+
month: MonthAdapter,
|
|
110
|
+
year: YearAdapter
|
|
111
|
+
};
|
|
112
|
+
const props = defineProps({
|
|
113
|
+
modelValue: {
|
|
114
|
+
type: [Date, Array],
|
|
115
|
+
default: void 0
|
|
116
|
+
},
|
|
117
|
+
start: {
|
|
118
|
+
type: Date,
|
|
119
|
+
default: void 0
|
|
120
|
+
},
|
|
121
|
+
end: {
|
|
122
|
+
type: Date,
|
|
123
|
+
default: void 0
|
|
124
|
+
},
|
|
125
|
+
disabled: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
readonly: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: void 0
|
|
132
|
+
},
|
|
133
|
+
min: {
|
|
134
|
+
type: Date,
|
|
135
|
+
default: () => new Date(MIN_TIME)
|
|
136
|
+
},
|
|
137
|
+
max: {
|
|
138
|
+
type: Date,
|
|
139
|
+
default: () => new Date(MAX_TIME)
|
|
140
|
+
},
|
|
141
|
+
mode: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: "date"
|
|
144
|
+
},
|
|
145
|
+
range: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: false
|
|
148
|
+
},
|
|
149
|
+
minRange: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: void 0,
|
|
152
|
+
validator(value) {
|
|
153
|
+
return validateDuration(value);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
maxRange: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: void 0,
|
|
159
|
+
validator(value) {
|
|
160
|
+
return validateDuration(value);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const emit = defineEmits(["update:modelValue", "update:start", "update:end", "change"]);
|
|
165
|
+
const viewmode = ref(props.mode);
|
|
166
|
+
const transition = ref("slide-left");
|
|
167
|
+
const localStart = ref(Array.isArray(props.modelValue) ? props.modelValue[0] : props.start ?? props.modelValue);
|
|
168
|
+
const localEnd = ref(Array.isArray(props.modelValue) ? props.modelValue[1] : props.end ?? props.modelValue);
|
|
169
|
+
const vStart = computed({
|
|
170
|
+
get() {
|
|
171
|
+
return Array.isArray(props.modelValue) ? props.modelValue?.[0] : props.start ?? props.modelValue;
|
|
172
|
+
},
|
|
173
|
+
set(value) {
|
|
174
|
+
emit("update:start", value);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const vEnd = computed({
|
|
178
|
+
get() {
|
|
179
|
+
return Array.isArray(props.modelValue) ? props.modelValue?.[1] : props.end ?? props.modelValue;
|
|
180
|
+
},
|
|
181
|
+
set(value) {
|
|
182
|
+
emit("update:end", value);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
const cursor = ref(startOfMonth(localStart.value ?? /* @__PURE__ */ new Date()));
|
|
186
|
+
const hover = ref();
|
|
187
|
+
const minRange = computed(() => parseDuration(props.minRange));
|
|
188
|
+
const maxRange = computed(() => parseDuration(props.maxRange));
|
|
189
|
+
const isTempLock = computed(() => props.range && localStart.value && !localEnd.value);
|
|
190
|
+
const min = computed(() => {
|
|
191
|
+
return isTempLock.value ? maxDate([add(localStart.value, minRange.value ?? {}), props.min]) : props.min;
|
|
192
|
+
});
|
|
193
|
+
const max = computed(() => {
|
|
194
|
+
return isTempLock.value && maxRange.value ? minDate([add(localStart.value, maxRange.value), props.max]) : sub(props.max, minRange.value ?? {});
|
|
195
|
+
});
|
|
196
|
+
const context = {
|
|
197
|
+
cursor,
|
|
198
|
+
start: localStart,
|
|
199
|
+
end: localEnd,
|
|
200
|
+
min,
|
|
201
|
+
max
|
|
202
|
+
};
|
|
203
|
+
const adapter = computed(() => {
|
|
204
|
+
return Adapters[viewmode.value];
|
|
205
|
+
});
|
|
206
|
+
const title = computed(() => {
|
|
207
|
+
return adapter.value.getTitle(context);
|
|
208
|
+
});
|
|
209
|
+
const items = computed(() => {
|
|
210
|
+
return adapter.value.getItems(context);
|
|
211
|
+
});
|
|
212
|
+
const canNext = computed(() => {
|
|
213
|
+
return adapter.value.canNext(context);
|
|
214
|
+
});
|
|
215
|
+
const canPrev = computed(() => {
|
|
216
|
+
return adapter.value.canPrev(context);
|
|
217
|
+
});
|
|
218
|
+
const classNames = computed(() => {
|
|
219
|
+
const result = [];
|
|
220
|
+
if (props.disabled)
|
|
221
|
+
result.push("calendar--disabled");
|
|
222
|
+
if (props.readonly)
|
|
223
|
+
result.push("calendar--readonly");
|
|
224
|
+
if (props.range)
|
|
225
|
+
result.push("calendar--range");
|
|
226
|
+
return result;
|
|
227
|
+
});
|
|
228
|
+
function next() {
|
|
229
|
+
if (!props.disabled && !props.readonly)
|
|
230
|
+
cursor.value = adapter.value.getNextCursor(context);
|
|
231
|
+
}
|
|
232
|
+
function prev() {
|
|
233
|
+
if (!props.disabled && !props.readonly)
|
|
234
|
+
cursor.value = adapter.value.getPrevCursor(context);
|
|
235
|
+
}
|
|
236
|
+
function changeMode(step = 1) {
|
|
237
|
+
if (!props.disabled && !props.readonly) {
|
|
238
|
+
const index = CalendarFormat.indexOf(viewmode.value);
|
|
239
|
+
const newMode = CalendarFormat[index + step];
|
|
240
|
+
if (newMode)
|
|
241
|
+
viewmode.value = newMode;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function selectItem(item) {
|
|
245
|
+
if (viewmode.value === props.mode) {
|
|
246
|
+
if (props.range && (localStart.value && !localEnd.value)) {
|
|
247
|
+
const startValue = minDate([localStart.value, item.value]);
|
|
248
|
+
const endValue = maxDate([localStart.value, item.value]);
|
|
249
|
+
localStart.value = adapter.value.setValue(startValue, localStart.value);
|
|
250
|
+
localEnd.value = adapter.value.setValue(endValue, localEnd.value);
|
|
251
|
+
} else {
|
|
252
|
+
localStart.value = adapter.value.setValue(item.value, localStart.value);
|
|
253
|
+
localEnd.value = void 0;
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
cursor.value = item.value;
|
|
257
|
+
changeMode(-1);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function setHover(item) {
|
|
261
|
+
if (props.range && !item.readonly && !item.disabled)
|
|
262
|
+
hover.value = item.value;
|
|
263
|
+
}
|
|
264
|
+
function isInRange(item) {
|
|
265
|
+
if (props.range && localStart.value && (localEnd.value || hover.value) && !item.readonly && !item.active) {
|
|
266
|
+
return isWithinInterval(item.value, {
|
|
267
|
+
start: minDate([localStart.value, localEnd.value ?? hover.value]),
|
|
268
|
+
end: maxDate([localStart.value, localEnd.value ?? hover.value])
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
syncRef(localStart, vStart, { immediate: false });
|
|
274
|
+
syncRef(localEnd, vEnd, { immediate: false });
|
|
275
|
+
watch([localStart, localEnd], ([startVal, endVal]) => {
|
|
276
|
+
if (props.range) {
|
|
277
|
+
if (startVal && endVal) {
|
|
278
|
+
emit("update:modelValue", [startVal, endVal]);
|
|
279
|
+
emit("change", [startVal, endVal]);
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
emit("update:modelValue", startVal);
|
|
283
|
+
emit("change", startVal);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
watch(() => props.mode, (value) => {
|
|
287
|
+
const newIndex = CalendarFormat.indexOf(value);
|
|
288
|
+
const currentIndex = CalendarFormat.indexOf(viewmode.value);
|
|
289
|
+
if (newIndex > currentIndex)
|
|
290
|
+
viewmode.value = value;
|
|
291
|
+
});
|
|
292
|
+
watch([viewmode, cursor], ([vm, cursor2], [vmOld, cursorOld]) => {
|
|
293
|
+
const mode = CalendarFormat.indexOf(vm) - CalendarFormat.indexOf(vmOld);
|
|
294
|
+
if (mode === 0)
|
|
295
|
+
transition.value = cursor2 > cursorOld ? "slide-left" : "slide-right";
|
|
296
|
+
else
|
|
297
|
+
transition.value = mode > 0 ? "zoom-out" : "zoom-in";
|
|
298
|
+
});
|
|
299
|
+
</script>
|
|
300
|
+
|
|
301
|
+
<style lang="postcss">
|
|
302
|
+
.calendar {
|
|
303
|
+
@apply flex flex-col space-y-2 text-sm shadow-xl;
|
|
304
|
+
|
|
305
|
+
&.card {
|
|
306
|
+
@apply border-transparent;
|
|
307
|
+
@apply dark:border-transparent;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&__nav {
|
|
311
|
+
@apply flex justify-between space-x-2 mb-2;
|
|
312
|
+
|
|
313
|
+
&-title {
|
|
314
|
+
@apply grow;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.btn.btn--variant-solid {
|
|
319
|
+
@apply justify-center;
|
|
320
|
+
|
|
321
|
+
&.btn--default {
|
|
322
|
+
@apply border-transparent bg-transparent text-default font-normal;
|
|
323
|
+
@apply dark:border-transparent dark:bg-transparent dark:text-dark-subtle hover:dark:text-dark-default;
|
|
324
|
+
|
|
325
|
+
&.calendar__nav-title {
|
|
326
|
+
@apply font-medium;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
&[active="true"] {
|
|
330
|
+
@apply bg-brand-accent border-brand-accent text-state-emphasis cursor-default;
|
|
331
|
+
@apply dark:bg-dark-brand-accent dark:border-dark-brand-accent dark:text-dark-state-emphasis;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
&[disabled][active="false"] {
|
|
335
|
+
@apply text-muted;
|
|
336
|
+
@apply dark:text-dark-muted;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&.calendar__item--in-range {
|
|
340
|
+
@apply bg-info rounded-none;
|
|
341
|
+
@apply dark:bg-dark-info;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&[readonly] {
|
|
346
|
+
@apply pointer-events-none font-medium;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.calendar__items {
|
|
351
|
+
&[viewmode="date"] {
|
|
352
|
+
@apply grid grid-cols-7 gap-y-1;
|
|
353
|
+
|
|
354
|
+
.calendar__item-btn.btn--md {
|
|
355
|
+
@apply p-1 md:p-2;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.calendar__item-btn:nth-child(-n+7) {
|
|
359
|
+
@apply font-medium;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.calendar__item-btn:nth-child(7n-6) {
|
|
363
|
+
&:not([active="true"]) {
|
|
364
|
+
@apply text-danger dark:text-dark-danger;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
&[viewmode="month"],
|
|
370
|
+
&[viewmode="year"] {
|
|
371
|
+
@apply grid grid-cols-4 gap-y-1;
|
|
372
|
+
.btn--md {
|
|
373
|
+
@apply px-3;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
&--range {
|
|
379
|
+
.calendar__item--head:not(.calendar__item--tail) {
|
|
380
|
+
@apply rounded-r-none;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.calendar__item--tail:not(.calendar__item--head) {
|
|
384
|
+
@apply rounded-l-none;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
&--disabled {
|
|
389
|
+
@apply opacity-50;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.dropdown__subitem & {
|
|
393
|
+
@apply shadow-none;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
</style>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { CalendarMode } from './adapter/adapter';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: PropType<Date | [Date, Date]>;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
start: {
|
|
9
|
+
type: DateConstructor;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
end: {
|
|
13
|
+
type: DateConstructor;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
disabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
readonly: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
min: {
|
|
25
|
+
type: DateConstructor;
|
|
26
|
+
default: () => Date;
|
|
27
|
+
};
|
|
28
|
+
max: {
|
|
29
|
+
type: DateConstructor;
|
|
30
|
+
default: () => Date;
|
|
31
|
+
};
|
|
32
|
+
mode: {
|
|
33
|
+
type: PropType<CalendarMode>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
range: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
minRange: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
validator(value: string): boolean;
|
|
44
|
+
};
|
|
45
|
+
maxRange: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: undefined;
|
|
48
|
+
validator(value: string): boolean;
|
|
49
|
+
};
|
|
50
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
+
"update:modelValue": (args_0: unknown) => void;
|
|
52
|
+
change: (args_0: unknown) => void;
|
|
53
|
+
"update:start": (args_0: Date) => void;
|
|
54
|
+
"update:end": (args_0: Date) => void;
|
|
55
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: PropType<Date | [Date, Date]>;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
start: {
|
|
61
|
+
type: DateConstructor;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
end: {
|
|
65
|
+
type: DateConstructor;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
disabled: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
readonly: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
min: {
|
|
77
|
+
type: DateConstructor;
|
|
78
|
+
default: () => Date;
|
|
79
|
+
};
|
|
80
|
+
max: {
|
|
81
|
+
type: DateConstructor;
|
|
82
|
+
default: () => Date;
|
|
83
|
+
};
|
|
84
|
+
mode: {
|
|
85
|
+
type: PropType<CalendarMode>;
|
|
86
|
+
default: string;
|
|
87
|
+
};
|
|
88
|
+
range: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
92
|
+
minRange: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
validator(value: string): boolean;
|
|
96
|
+
};
|
|
97
|
+
maxRange: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
default: undefined;
|
|
100
|
+
validator(value: string): boolean;
|
|
101
|
+
};
|
|
102
|
+
}>> & Readonly<{
|
|
103
|
+
"onUpdate:modelValue"?: ((args_0: unknown) => any) | undefined;
|
|
104
|
+
onChange?: ((args_0: unknown) => any) | undefined;
|
|
105
|
+
"onUpdate:start"?: ((args_0: Date) => any) | undefined;
|
|
106
|
+
"onUpdate:end"?: ((args_0: Date) => any) | undefined;
|
|
107
|
+
}>, {
|
|
108
|
+
modelValue: Date | [Date, Date];
|
|
109
|
+
disabled: boolean;
|
|
110
|
+
mode: "date" | "month" | "year";
|
|
111
|
+
max: Date;
|
|
112
|
+
start: Date;
|
|
113
|
+
end: Date;
|
|
114
|
+
readonly: boolean;
|
|
115
|
+
min: Date;
|
|
116
|
+
range: boolean;
|
|
117
|
+
minRange: string;
|
|
118
|
+
maxRange: string;
|
|
119
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
120
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { type Duration } from 'date-fns';
|
|
3
|
+
export interface CalendarItem {
|
|
4
|
+
value: Date;
|
|
5
|
+
text: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
readonly: boolean;
|
|
8
|
+
active: boolean;
|
|
9
|
+
head: boolean;
|
|
10
|
+
tail: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface CalendarContext {
|
|
13
|
+
cursor: Ref<Date>;
|
|
14
|
+
start: Ref<Date>;
|
|
15
|
+
end: Ref<Date>;
|
|
16
|
+
min: Ref<Date | undefined>;
|
|
17
|
+
max: Ref<Date | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export interface CalendarAdapter {
|
|
20
|
+
getItems: (this: this, context: CalendarContext) => CalendarItem[];
|
|
21
|
+
getTitle: (this: this, context: CalendarContext) => string;
|
|
22
|
+
getNextCursor: (this: this, context: CalendarContext) => Date;
|
|
23
|
+
getPrevCursor: (this: this, context: CalendarContext) => Date;
|
|
24
|
+
canNext: (this: this, context: CalendarContext) => boolean;
|
|
25
|
+
canPrev: (this: this, context: CalendarContext) => boolean;
|
|
26
|
+
setValue: (this: this, value: Date, lastValue?: Date) => Date;
|
|
27
|
+
}
|
|
28
|
+
export declare const CalendarFormat: readonly ["date", "month", "year"];
|
|
29
|
+
export type CalendarMode = typeof CalendarFormat[number];
|
|
30
|
+
export declare function defineAdapter(adapter: CalendarAdapter): CalendarAdapter;
|
|
31
|
+
export declare function validateDuration(duration?: string): boolean;
|
|
32
|
+
export declare function parseDuration(duration?: string): Duration | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { chunk } from "lodash-es";
|
|
2
|
+
export const CalendarFormat = [
|
|
3
|
+
"date",
|
|
4
|
+
"month",
|
|
5
|
+
"year"
|
|
6
|
+
];
|
|
7
|
+
export function defineAdapter(adapter) {
|
|
8
|
+
return adapter;
|
|
9
|
+
}
|
|
10
|
+
const DURATION_SUFFIX = {
|
|
11
|
+
Y: "years",
|
|
12
|
+
y: "years",
|
|
13
|
+
M: "months",
|
|
14
|
+
W: "weeks",
|
|
15
|
+
w: "weeks",
|
|
16
|
+
D: "days",
|
|
17
|
+
d: "days",
|
|
18
|
+
H: "hours",
|
|
19
|
+
h: "hours",
|
|
20
|
+
m: "minutes",
|
|
21
|
+
s: "seconds"
|
|
22
|
+
};
|
|
23
|
+
const DURATION_REGEX = /((-?\d+)([DHMWYdhmswy]))/;
|
|
24
|
+
export function validateDuration(duration) {
|
|
25
|
+
if (!duration)
|
|
26
|
+
return false;
|
|
27
|
+
const match = duration.split(DURATION_REGEX).filter(Boolean);
|
|
28
|
+
const segment = chunk(match, 3);
|
|
29
|
+
return segment.every(([text]) => text.match(DURATION_REGEX));
|
|
30
|
+
}
|
|
31
|
+
export function parseDuration(duration) {
|
|
32
|
+
if (!duration)
|
|
33
|
+
return;
|
|
34
|
+
const match = duration.split(DURATION_REGEX).filter(Boolean);
|
|
35
|
+
const segment = chunk(match, 3);
|
|
36
|
+
const result = {};
|
|
37
|
+
for (const item of segment) {
|
|
38
|
+
const key = DURATION_SUFFIX[item[2]];
|
|
39
|
+
const value = Number.parseInt(item[1]);
|
|
40
|
+
result[key] = value + (result[key] ?? 0);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
eachDayOfInterval,
|
|
3
|
+
endOfMonth,
|
|
4
|
+
endOfWeek,
|
|
5
|
+
isSameDay,
|
|
6
|
+
isSameMonth,
|
|
7
|
+
startOfMonth,
|
|
8
|
+
startOfWeek,
|
|
9
|
+
addMonths,
|
|
10
|
+
subMonths,
|
|
11
|
+
isAfter,
|
|
12
|
+
isBefore,
|
|
13
|
+
isWithinInterval,
|
|
14
|
+
set,
|
|
15
|
+
isDate
|
|
16
|
+
} from "date-fns";
|
|
17
|
+
import { defineAdapter } from "./adapter.mjs";
|
|
18
|
+
import { formatDate } from "../../utils/date.mjs";
|
|
19
|
+
function getInterval(date) {
|
|
20
|
+
const start = startOfWeek(startOfMonth(date), { weekStartsOn: 0 });
|
|
21
|
+
const end = endOfWeek(endOfMonth(date), { weekStartsOn: 0 });
|
|
22
|
+
return {
|
|
23
|
+
start,
|
|
24
|
+
end
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default defineAdapter({
|
|
28
|
+
getItems({ cursor, start, end, min, max }) {
|
|
29
|
+
const dates = eachDayOfInterval(getInterval(cursor.value)).map((date) => {
|
|
30
|
+
const isDisabled = !isSameMonth(cursor.value, date) || !isWithinInterval(date, { start: min.value, end: max.value });
|
|
31
|
+
const isHead = isSameDay(start.value, date);
|
|
32
|
+
const isTail = isSameDay(end.value, date);
|
|
33
|
+
return {
|
|
34
|
+
value: date,
|
|
35
|
+
text: date.getDate().toString(),
|
|
36
|
+
disabled: isDisabled,
|
|
37
|
+
head: isHead,
|
|
38
|
+
tail: isTail,
|
|
39
|
+
active: isHead || isTail,
|
|
40
|
+
readonly: false
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
const days = dates.slice(0, 7).map((item) => {
|
|
44
|
+
return {
|
|
45
|
+
value: item.value,
|
|
46
|
+
text: formatDate(item.value, "EEEEEE"),
|
|
47
|
+
disabled: false,
|
|
48
|
+
readonly: true,
|
|
49
|
+
head: false,
|
|
50
|
+
tail: false,
|
|
51
|
+
active: false
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
return [...days, ...dates];
|
|
55
|
+
},
|
|
56
|
+
getTitle({ cursor }) {
|
|
57
|
+
return formatDate(cursor.value, "MMMM yyyy");
|
|
58
|
+
},
|
|
59
|
+
getNextCursor({ cursor }) {
|
|
60
|
+
return addMonths(cursor.value, 1);
|
|
61
|
+
},
|
|
62
|
+
getPrevCursor({ cursor }) {
|
|
63
|
+
return subMonths(cursor.value, 1);
|
|
64
|
+
},
|
|
65
|
+
canNext(context) {
|
|
66
|
+
const max = context.max.value;
|
|
67
|
+
const date = this.getNextCursor(context);
|
|
68
|
+
const start = startOfMonth(date);
|
|
69
|
+
const end = endOfMonth(date);
|
|
70
|
+
return !max || isBefore(date, max) || isWithinInterval(max, { start, end });
|
|
71
|
+
},
|
|
72
|
+
canPrev(context) {
|
|
73
|
+
const min = context.min.value;
|
|
74
|
+
const date = this.getPrevCursor(context);
|
|
75
|
+
const start = startOfMonth(date);
|
|
76
|
+
const end = endOfMonth(date);
|
|
77
|
+
return !min || isAfter(date, min) || isWithinInterval(min, { start, end });
|
|
78
|
+
},
|
|
79
|
+
setValue(value, lastValue) {
|
|
80
|
+
return isDate(lastValue) ? set(lastValue, {
|
|
81
|
+
year: value.getFullYear(),
|
|
82
|
+
month: value.getMonth(),
|
|
83
|
+
date: value.getDate()
|
|
84
|
+
}) : value;
|
|
85
|
+
}
|
|
86
|
+
});
|