@laser-ui/components 0.0.1
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/accordion/Accordion.d.ts +3 -0
- package/accordion/Accordion.js +162 -0
- package/accordion/index.d.ts +2 -0
- package/accordion/index.js +1 -0
- package/accordion/types.d.ts +20 -0
- package/accordion/types.js +1 -0
- package/accordion/vars.d.ts +10 -0
- package/accordion/vars.js +10 -0
- package/affix/Affix.d.ts +3 -0
- package/affix/Affix.js +56 -0
- package/affix/index.d.ts +2 -0
- package/affix/index.js +1 -0
- package/affix/types.d.ts +14 -0
- package/affix/types.js +1 -0
- package/alert/Alert.d.ts +3 -0
- package/alert/Alert.js +53 -0
- package/alert/index.d.ts +2 -0
- package/alert/index.js +1 -0
- package/alert/types.d.ts +13 -0
- package/alert/types.js +1 -0
- package/alert/vars.d.ts +14 -0
- package/alert/vars.js +14 -0
- package/anchor/Anchor.d.ts +10 -0
- package/anchor/Anchor.js +112 -0
- package/anchor/index.d.ts +2 -0
- package/anchor/index.js +1 -0
- package/anchor/types.d.ts +23 -0
- package/anchor/types.js +1 -0
- package/anchor/vars.d.ts +11 -0
- package/anchor/vars.js +11 -0
- package/avatar/Avatar.d.ts +3 -0
- package/avatar/Avatar.js +43 -0
- package/avatar/index.d.ts +2 -0
- package/avatar/index.js +1 -0
- package/avatar/types.d.ts +11 -0
- package/avatar/types.js +1 -0
- package/avatar/vars.d.ts +9 -0
- package/avatar/vars.js +9 -0
- package/badge/Badge.d.ts +7 -0
- package/badge/Badge.js +61 -0
- package/badge/BadgeText.d.ts +2 -0
- package/badge/BadgeText.js +40 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +1 -0
- package/badge/internal/BadgeNumber.d.ts +10 -0
- package/badge/internal/BadgeNumber.js +37 -0
- package/badge/types.d.ts +19 -0
- package/badge/types.js +1 -0
- package/badge/vars.d.ts +12 -0
- package/badge/vars.js +12 -0
- package/breadcrumb/Breadcrumb.d.ts +3 -0
- package/breadcrumb/Breadcrumb.js +22 -0
- package/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/index.js +1 -0
- package/breadcrumb/types.d.ts +15 -0
- package/breadcrumb/types.js +1 -0
- package/breadcrumb/vars.d.ts +8 -0
- package/breadcrumb/vars.js +8 -0
- package/button/Button.d.ts +3 -0
- package/button/Button.js +50 -0
- package/button/index.d.ts +2 -0
- package/button/index.js +1 -0
- package/button/types.d.ts +14 -0
- package/button/types.js +1 -0
- package/button/vars.d.ts +23 -0
- package/button/vars.js +23 -0
- package/card/Card.d.ts +11 -0
- package/card/Card.js +30 -0
- package/card/CardAction.d.ts +3 -0
- package/card/CardAction.js +17 -0
- package/card/CardContent.d.ts +3 -0
- package/card/CardContent.js +13 -0
- package/card/CardHeader.d.ts +3 -0
- package/card/CardHeader.js +13 -0
- package/card/index.d.ts +2 -0
- package/card/index.js +1 -0
- package/card/types.d.ts +17 -0
- package/card/types.js +1 -0
- package/card/vars.d.ts +12 -0
- package/card/vars.js +12 -0
- package/cascader/Cascader.d.ts +5 -0
- package/cascader/Cascader.js +487 -0
- package/cascader/index.d.ts +2 -0
- package/cascader/index.js +1 -0
- package/cascader/internal/CascaderPanel.d.ts +23 -0
- package/cascader/internal/CascaderPanel.js +135 -0
- package/cascader/internal/CascaderSearchPanel.d.ts +22 -0
- package/cascader/internal/CascaderSearchPanel.js +73 -0
- package/cascader/internal/types.d.ts +8 -0
- package/cascader/internal/types.js +1 -0
- package/cascader/types.d.ts +49 -0
- package/cascader/types.js +1 -0
- package/cascader/vars.d.ts +32 -0
- package/cascader/vars.js +32 -0
- package/checkbox/Checkbox.d.ts +7 -0
- package/checkbox/Checkbox.js +25 -0
- package/checkbox/CheckboxGroup.d.ts +3 -0
- package/checkbox/CheckboxGroup.js +25 -0
- package/checkbox/index.d.ts +2 -0
- package/checkbox/index.js +1 -0
- package/checkbox/types.d.ts +29 -0
- package/checkbox/types.js +1 -0
- package/checkbox/vars.d.ts +11 -0
- package/checkbox/vars.js +11 -0
- package/compose/Compose.d.ts +7 -0
- package/compose/Compose.js +24 -0
- package/compose/ComposeItem.d.ts +3 -0
- package/compose/ComposeItem.js +18 -0
- package/compose/index.d.ts +2 -0
- package/compose/index.js +1 -0
- package/compose/types.d.ts +12 -0
- package/compose/types.js +1 -0
- package/compose/vars.d.ts +10 -0
- package/compose/vars.js +10 -0
- package/config-provider/ConfigProvider.d.ts +3 -0
- package/config-provider/ConfigProvider.js +14 -0
- package/config-provider/index.d.ts +2 -0
- package/config-provider/index.js +1 -0
- package/config-provider/types.d.ts +7 -0
- package/config-provider/types.js +1 -0
- package/context/index.d.ts +33 -0
- package/context/index.js +106 -0
- package/context/props.d.ts +134 -0
- package/context/props.js +1 -0
- package/date-picker/DatePicker.d.ts +3 -0
- package/date-picker/DatePicker.js +376 -0
- package/date-picker/index.d.ts +2 -0
- package/date-picker/index.js +1 -0
- package/date-picker/internal/DatePickerPanel.d.ts +15 -0
- package/date-picker/internal/DatePickerPanel.js +104 -0
- package/date-picker/types.d.ts +37 -0
- package/date-picker/types.js +1 -0
- package/date-picker/vars.d.ts +36 -0
- package/date-picker/vars.js +36 -0
- package/dayjs.d.ts +3 -0
- package/dayjs.js +11 -0
- package/drawer/Drawer.d.ts +9 -0
- package/drawer/Drawer.js +141 -0
- package/drawer/DrawerFooter.d.ts +3 -0
- package/drawer/DrawerFooter.js +51 -0
- package/drawer/DrawerHeader.d.ts +3 -0
- package/drawer/DrawerHeader.js +37 -0
- package/drawer/index.d.ts +2 -0
- package/drawer/index.js +1 -0
- package/drawer/types.d.ts +36 -0
- package/drawer/types.js +1 -0
- package/drawer/vars.d.ts +21 -0
- package/drawer/vars.js +18 -0
- package/dropdown/Dropdown.d.ts +5 -0
- package/dropdown/Dropdown.js +376 -0
- package/dropdown/index.d.ts +2 -0
- package/dropdown/index.js +1 -0
- package/dropdown/internal/DropdownGroup.d.ts +13 -0
- package/dropdown/internal/DropdownGroup.js +8 -0
- package/dropdown/internal/DropdownItem.d.ts +16 -0
- package/dropdown/internal/DropdownItem.js +9 -0
- package/dropdown/internal/DropdownSub.d.ts +22 -0
- package/dropdown/internal/DropdownSub.js +78 -0
- package/dropdown/types.d.ts +31 -0
- package/dropdown/types.js +1 -0
- package/dropdown/utils.d.ts +4 -0
- package/dropdown/utils.js +18 -0
- package/dropdown/vars.d.ts +23 -0
- package/dropdown/vars.js +23 -0
- package/empty/Empty.d.ts +7 -0
- package/empty/Empty.js +18 -0
- package/empty/index.d.ts +2 -0
- package/empty/index.js +1 -0
- package/empty/types.d.ts +8 -0
- package/empty/types.js +1 -0
- package/empty/vars.d.ts +7 -0
- package/empty/vars.js +7 -0
- package/fab/Fab.d.ts +9 -0
- package/fab/Fab.js +31 -0
- package/fab/FabBacktop.d.ts +3 -0
- package/fab/FabBacktop.js +58 -0
- package/fab/FabButton.d.ts +3 -0
- package/fab/FabButton.js +23 -0
- package/fab/index.d.ts +2 -0
- package/fab/index.js +1 -0
- package/fab/types.d.ts +26 -0
- package/fab/types.js +1 -0
- package/fab/vars.d.ts +28 -0
- package/fab/vars.js +28 -0
- package/form/Form.d.ts +7 -0
- package/form/Form.js +34 -0
- package/form/FormItem.d.ts +5 -0
- package/form/FormItem.js +201 -0
- package/form/hooks.d.ts +5 -0
- package/form/hooks.js +18 -0
- package/form/index.d.ts +8 -0
- package/form/index.js +7 -0
- package/form/internal/FormError.d.ts +12 -0
- package/form/internal/FormError.js +24 -0
- package/form/model/abstract-control.d.ts +67 -0
- package/form/model/abstract-control.js +335 -0
- package/form/model/form-control.d.ts +23 -0
- package/form/model/form-control.js +72 -0
- package/form/model/form-group.d.ts +62 -0
- package/form/model/form-group.js +165 -0
- package/form/model/types.d.ts +8 -0
- package/form/model/types.js +1 -0
- package/form/model/validators.d.ts +11 -0
- package/form/model/validators.js +83 -0
- package/form/model/vars.d.ts +1 -0
- package/form/model/vars.js +1 -0
- package/form/types.d.ts +63 -0
- package/form/types.js +1 -0
- package/form/vars.d.ts +27 -0
- package/form/vars.js +25 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +14 -0
- package/hooks/useComponentProps.d.ts +2 -0
- package/hooks/useComponentProps.js +15 -0
- package/hooks/useControlled.d.ts +3 -0
- package/hooks/useControlled.js +26 -0
- package/hooks/useDesign.d.ts +12 -0
- package/hooks/useDesign.js +8 -0
- package/hooks/useFocusVisible.d.ts +2 -0
- package/hooks/useFocusVisible.js +38 -0
- package/hooks/useLayout.d.ts +5 -0
- package/hooks/useLayout.js +10 -0
- package/hooks/useListenGlobalScrolling.d.ts +1 -0
- package/hooks/useListenGlobalScrolling.js +9 -0
- package/hooks/useLockScroll.d.ts +1 -0
- package/hooks/useLockScroll.js +24 -0
- package/hooks/useMaxIndex.d.ts +1 -0
- package/hooks/useMaxIndex.js +32 -0
- package/hooks/useNamespace.d.ts +1 -0
- package/hooks/useNamespace.js +6 -0
- package/hooks/useNestedPopup.d.ts +13 -0
- package/hooks/useNestedPopup.js +37 -0
- package/hooks/useNextTick.d.ts +2 -0
- package/hooks/useNextTick.js +9 -0
- package/hooks/useScopedProps.d.ts +8 -0
- package/hooks/useScopedProps.js +7 -0
- package/hooks/useStyled.d.ts +20 -0
- package/hooks/useStyled.js +82 -0
- package/hooks/useTranslation.d.ts +4 -0
- package/hooks/useTranslation.js +17 -0
- package/icon/Icon.d.ts +3 -0
- package/icon/Icon.js +18 -0
- package/icon/index.d.ts +2 -0
- package/icon/index.js +1 -0
- package/icon/types.d.ts +12 -0
- package/icon/types.js +1 -0
- package/icon/vars.d.ts +7 -0
- package/icon/vars.js +7 -0
- package/image/Image.d.ts +9 -0
- package/image/Image.js +50 -0
- package/image/ImageAction.d.ts +3 -0
- package/image/ImageAction.js +15 -0
- package/image/ImagePreview.d.ts +3 -0
- package/image/ImagePreview.js +261 -0
- package/image/index.d.ts +2 -0
- package/image/index.js +1 -0
- package/image/types.d.ts +24 -0
- package/image/types.js +1 -0
- package/image/vars.d.ts +26 -0
- package/image/vars.js +26 -0
- package/index.d.ts +52 -0
- package/index.js +52 -0
- package/input/Input.d.ts +7 -0
- package/input/Input.js +56 -0
- package/input/InputNumber.d.ts +2 -0
- package/input/InputNumber.js +142 -0
- package/input/index.d.ts +2 -0
- package/input/index.js +1 -0
- package/input/types.d.ts +44 -0
- package/input/types.js +1 -0
- package/input/vars.d.ts +14 -0
- package/input/vars.js +14 -0
- package/internal/circular-progress/CircularProgress.d.ts +2 -0
- package/internal/circular-progress/CircularProgress.js +11 -0
- package/internal/circular-progress/index.d.ts +1 -0
- package/internal/circular-progress/index.js +1 -0
- package/internal/circular-progress/vars.d.ts +4 -0
- package/internal/circular-progress/vars.js +4 -0
- package/internal/mask/Mask.d.ts +3 -0
- package/internal/mask/Mask.js +36 -0
- package/internal/mask/index.d.ts +2 -0
- package/internal/mask/index.js +1 -0
- package/internal/mask/types.d.ts +7 -0
- package/internal/mask/types.js +1 -0
- package/internal/mask/vars.d.ts +3 -0
- package/internal/mask/vars.js +3 -0
- package/internal/popup/Popup.d.ts +3 -0
- package/internal/popup/Popup.js +132 -0
- package/internal/popup/index.d.ts +2 -0
- package/internal/popup/index.js +1 -0
- package/internal/popup/types.d.ts +21 -0
- package/internal/popup/types.js +1 -0
- package/internal/portal/Portal.d.ts +3 -0
- package/internal/portal/Portal.js +14 -0
- package/internal/portal/index.d.ts +2 -0
- package/internal/portal/index.js +1 -0
- package/internal/portal/types.d.ts +6 -0
- package/internal/portal/types.js +1 -0
- package/internal/transition/CollapseTransition.d.ts +3 -0
- package/internal/transition/CollapseTransition.js +101 -0
- package/internal/transition/Transition.d.ts +3 -0
- package/internal/transition/Transition.js +87 -0
- package/internal/transition/index.d.ts +3 -0
- package/internal/transition/index.js +2 -0
- package/internal/transition/types.d.ts +33 -0
- package/internal/transition/types.js +1 -0
- package/internal/wave/Wave.d.ts +3 -0
- package/internal/wave/Wave.js +25 -0
- package/internal/wave/index.d.ts +2 -0
- package/internal/wave/index.js +1 -0
- package/internal/wave/types.d.ts +6 -0
- package/internal/wave/types.js +1 -0
- package/internal/wave/vars.d.ts +3 -0
- package/internal/wave/vars.js +3 -0
- package/menu/Menu.d.ts +5 -0
- package/menu/Menu.js +386 -0
- package/menu/index.d.ts +2 -0
- package/menu/index.js +1 -0
- package/menu/internal/MenuGroup.d.ts +15 -0
- package/menu/internal/MenuGroup.js +8 -0
- package/menu/internal/MenuItem.d.ts +23 -0
- package/menu/internal/MenuItem.js +18 -0
- package/menu/internal/MenuSub.d.ts +31 -0
- package/menu/internal/MenuSub.js +129 -0
- package/menu/types.d.ts +30 -0
- package/menu/types.js +1 -0
- package/menu/utils.d.ts +4 -0
- package/menu/utils.js +18 -0
- package/menu/vars.d.ts +28 -0
- package/menu/vars.js +28 -0
- package/modal/Modal.d.ts +11 -0
- package/modal/Modal.js +127 -0
- package/modal/ModalAlert.d.ts +3 -0
- package/modal/ModalAlert.js +19 -0
- package/modal/ModalFooter.d.ts +3 -0
- package/modal/ModalFooter.js +51 -0
- package/modal/ModalHeader.d.ts +3 -0
- package/modal/ModalHeader.js +37 -0
- package/modal/index.d.ts +2 -0
- package/modal/index.js +1 -0
- package/modal/types.d.ts +39 -0
- package/modal/types.js +1 -0
- package/modal/vars.d.ts +23 -0
- package/modal/vars.js +23 -0
- package/notification/Notification.d.ts +3 -0
- package/notification/Notification.js +129 -0
- package/notification/index.d.ts +2 -0
- package/notification/index.js +1 -0
- package/notification/types.d.ts +18 -0
- package/notification/types.js +1 -0
- package/notification/vars.d.ts +17 -0
- package/notification/vars.js +14 -0
- package/package.json +47 -0
- package/pagination/Pagination.d.ts +3 -0
- package/pagination/Pagination.js +191 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/index.js +1 -0
- package/pagination/types.d.ts +23 -0
- package/pagination/types.js +1 -0
- package/pagination/utils.d.ts +2 -0
- package/pagination/utils.js +14 -0
- package/pagination/vars.d.ts +14 -0
- package/pagination/vars.js +14 -0
- package/popover/Popover.d.ts +9 -0
- package/popover/Popover.js +173 -0
- package/popover/PopoverFooter.d.ts +3 -0
- package/popover/PopoverFooter.js +51 -0
- package/popover/PopoverHeader.d.ts +3 -0
- package/popover/PopoverHeader.js +37 -0
- package/popover/index.d.ts +2 -0
- package/popover/index.js +1 -0
- package/popover/types.d.ts +46 -0
- package/popover/types.js +1 -0
- package/popover/vars.d.ts +30 -0
- package/popover/vars.js +27 -0
- package/progress/Progress.d.ts +3 -0
- package/progress/Progress.js +45 -0
- package/progress/index.d.ts +2 -0
- package/progress/index.js +1 -0
- package/progress/types.d.ts +19 -0
- package/progress/types.js +1 -0
- package/progress/vars.d.ts +15 -0
- package/progress/vars.js +15 -0
- package/radio/Radio.d.ts +7 -0
- package/radio/Radio.js +38 -0
- package/radio/RadioGroup.d.ts +3 -0
- package/radio/RadioGroup.js +21 -0
- package/radio/index.d.ts +2 -0
- package/radio/index.js +1 -0
- package/radio/types.d.ts +31 -0
- package/radio/types.js +1 -0
- package/radio/vars.d.ts +14 -0
- package/radio/vars.js +14 -0
- package/rating/Rating.d.ts +3 -0
- package/rating/Rating.js +34 -0
- package/rating/index.d.ts +2 -0
- package/rating/index.js +1 -0
- package/rating/internal/RatingStar.d.ts +19 -0
- package/rating/internal/RatingStar.js +37 -0
- package/rating/types.d.ts +18 -0
- package/rating/types.js +1 -0
- package/rating/vars.d.ts +11 -0
- package/rating/vars.js +11 -0
- package/resources.json +128 -0
- package/root/Root.d.ts +3 -0
- package/root/Root.js +85 -0
- package/root/dialog-service.d.ts +12 -0
- package/root/dialog-service.js +62 -0
- package/root/index.d.ts +3 -0
- package/root/index.js +2 -0
- package/root/types.d.ts +16 -0
- package/root/types.js +1 -0
- package/root/vars.d.ts +25 -0
- package/root/vars.js +13 -0
- package/select/Select.d.ts +5 -0
- package/select/Select.js +528 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +1 -0
- package/select/types.d.ts +50 -0
- package/select/types.js +1 -0
- package/select/vars.d.ts +31 -0
- package/select/vars.js +31 -0
- package/separator/Separator.d.ts +3 -0
- package/separator/Separator.js +19 -0
- package/separator/index.d.ts +2 -0
- package/separator/index.js +1 -0
- package/separator/types.d.ts +8 -0
- package/separator/types.js +1 -0
- package/separator/vars.d.ts +9 -0
- package/separator/vars.js +9 -0
- package/skeleton/Skeleton.d.ts +3 -0
- package/skeleton/Skeleton.js +13 -0
- package/skeleton/index.d.ts +2 -0
- package/skeleton/index.js +1 -0
- package/skeleton/types.d.ts +7 -0
- package/skeleton/types.js +1 -0
- package/skeleton/vars.d.ts +6 -0
- package/skeleton/vars.js +6 -0
- package/slider/Slider.d.ts +3 -0
- package/slider/Slider.js +324 -0
- package/slider/index.d.ts +2 -0
- package/slider/index.js +1 -0
- package/slider/types.d.ts +28 -0
- package/slider/types.js +1 -0
- package/slider/vars.d.ts +17 -0
- package/slider/vars.js +17 -0
- package/slides/Slides.d.ts +3 -0
- package/slides/Slides.js +277 -0
- package/slides/index.d.ts +2 -0
- package/slides/index.js +1 -0
- package/slides/types.d.ts +29 -0
- package/slides/types.js +1 -0
- package/slides/vars.d.ts +20 -0
- package/slides/vars.js +20 -0
- package/spinner/Spinner.d.ts +3 -0
- package/spinner/Spinner.js +66 -0
- package/spinner/index.d.ts +2 -0
- package/spinner/index.js +1 -0
- package/spinner/types.d.ts +12 -0
- package/spinner/types.js +1 -0
- package/spinner/vars.d.ts +7 -0
- package/spinner/vars.js +7 -0
- package/stepper/Stepper.d.ts +3 -0
- package/stepper/Stepper.js +87 -0
- package/stepper/index.d.ts +2 -0
- package/stepper/index.js +1 -0
- package/stepper/types.d.ts +22 -0
- package/stepper/types.js +1 -0
- package/stepper/vars.d.ts +19 -0
- package/stepper/vars.js +19 -0
- package/switch/Switch.d.ts +2 -0
- package/switch/Switch.js +48 -0
- package/switch/index.d.ts +2 -0
- package/switch/index.js +1 -0
- package/switch/types.d.ts +18 -0
- package/switch/types.js +1 -0
- package/switch/vars.d.ts +17 -0
- package/switch/vars.js +17 -0
- package/table/Table.d.ts +17 -0
- package/table/Table.js +72 -0
- package/table/TableEmpty.d.ts +3 -0
- package/table/TableEmpty.js +37 -0
- package/table/TableExpand.d.ts +3 -0
- package/table/TableExpand.js +20 -0
- package/table/TableFilter.d.ts +3 -0
- package/table/TableFilter.js +22 -0
- package/table/TableTd.d.ts +3 -0
- package/table/TableTd.js +11 -0
- package/table/TableTh.d.ts +3 -0
- package/table/TableTh.js +33 -0
- package/table/TableThAction.d.ts +3 -0
- package/table/TableThAction.js +18 -0
- package/table/index.d.ts +2 -0
- package/table/index.js +1 -0
- package/table/internal/TableCell.d.ts +19 -0
- package/table/internal/TableCell.js +61 -0
- package/table/types.d.ts +73 -0
- package/table/types.js +1 -0
- package/table/vars.d.ts +29 -0
- package/table/vars.js +28 -0
- package/tabs/Tabs.d.ts +5 -0
- package/tabs/Tabs.js +248 -0
- package/tabs/index.d.ts +2 -0
- package/tabs/index.js +1 -0
- package/tabs/types.d.ts +28 -0
- package/tabs/types.js +1 -0
- package/tabs/vars.d.ts +30 -0
- package/tabs/vars.js +30 -0
- package/tag/Tag.d.ts +3 -0
- package/tag/Tag.js +16 -0
- package/tag/index.d.ts +2 -0
- package/tag/index.js +1 -0
- package/tag/types.d.ts +9 -0
- package/tag/types.js +1 -0
- package/tag/vars.d.ts +13 -0
- package/tag/vars.js +13 -0
- package/textarea/Textarea.d.ts +3 -0
- package/textarea/Textarea.js +72 -0
- package/textarea/index.d.ts +2 -0
- package/textarea/index.js +1 -0
- package/textarea/types.d.ts +18 -0
- package/textarea/types.js +1 -0
- package/textarea/vars.d.ts +7 -0
- package/textarea/vars.js +7 -0
- package/time-picker/TimePicker.d.ts +3 -0
- package/time-picker/TimePicker.js +338 -0
- package/time-picker/index.d.ts +2 -0
- package/time-picker/index.js +1 -0
- package/time-picker/internal/TimePickerPanel.d.ts +16 -0
- package/time-picker/internal/TimePickerPanel.js +138 -0
- package/time-picker/types.d.ts +33 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +4 -0
- package/time-picker/utils.js +26 -0
- package/time-picker/vars.d.ts +20 -0
- package/time-picker/vars.js +20 -0
- package/timeline/Timeline.d.ts +3 -0
- package/timeline/Timeline.js +53 -0
- package/timeline/index.d.ts +2 -0
- package/timeline/index.js +1 -0
- package/timeline/types.d.ts +15 -0
- package/timeline/types.js +1 -0
- package/timeline/vars.d.ts +19 -0
- package/timeline/vars.js +19 -0
- package/toast/Toast.d.ts +3 -0
- package/toast/Toast.js +123 -0
- package/toast/index.d.ts +2 -0
- package/toast/index.js +1 -0
- package/toast/types.d.ts +17 -0
- package/toast/types.js +1 -0
- package/toast/vars.d.ts +14 -0
- package/toast/vars.js +11 -0
- package/tooltip/Tooltip.d.ts +3 -0
- package/tooltip/Tooltip.js +113 -0
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +1 -0
- package/tooltip/types.d.ts +29 -0
- package/tooltip/types.js +1 -0
- package/tooltip/vars.d.ts +20 -0
- package/tooltip/vars.js +17 -0
- package/transfer/Transfer.d.ts +3 -0
- package/transfer/Transfer.js +156 -0
- package/transfer/index.d.ts +2 -0
- package/transfer/index.js +1 -0
- package/transfer/internal/TransferPanel.d.ts +21 -0
- package/transfer/internal/TransferPanel.js +42 -0
- package/transfer/types.d.ts +34 -0
- package/transfer/types.js +1 -0
- package/transfer/vars.d.ts +17 -0
- package/transfer/vars.js +17 -0
- package/tree/Tree.d.ts +3 -0
- package/tree/Tree.js +165 -0
- package/tree/index.d.ts +2 -0
- package/tree/index.js +1 -0
- package/tree/internal/TreePanel.d.ts +32 -0
- package/tree/internal/TreePanel.js +167 -0
- package/tree/node/abstract-node.d.ts +25 -0
- package/tree/node/abstract-node.js +68 -0
- package/tree/node/multiple-node.d.ts +18 -0
- package/tree/node/multiple-node.js +109 -0
- package/tree/node/single-node.d.ts +16 -0
- package/tree/node/single-node.js +60 -0
- package/tree/node/types.d.ts +6 -0
- package/tree/node/types.js +1 -0
- package/tree/node/vars.d.ts +2 -0
- package/tree/node/vars.js +1 -0
- package/tree/types.d.ts +34 -0
- package/tree/types.js +1 -0
- package/tree/utils.d.ts +6 -0
- package/tree/utils.js +9 -0
- package/tree/vars.d.ts +20 -0
- package/tree/vars.js +20 -0
- package/tree-select/TreeSelect.d.ts +6 -0
- package/tree-select/TreeSelect.js +509 -0
- package/tree-select/index.d.ts +2 -0
- package/tree-select/index.js +1 -0
- package/tree-select/internal/TreeSelectSearchPanel.d.ts +22 -0
- package/tree-select/internal/TreeSelectSearchPanel.js +73 -0
- package/tree-select/internal/types.d.ts +8 -0
- package/tree-select/internal/types.js +1 -0
- package/tree-select/types.d.ts +48 -0
- package/tree-select/types.js +1 -0
- package/tree-select/vars.d.ts +37 -0
- package/tree-select/vars.js +37 -0
- package/types.d.ts +21 -0
- package/types.js +1 -0
- package/upload/Upload.d.ts +19 -0
- package/upload/Upload.js +203 -0
- package/upload/UploadAction.d.ts +3 -0
- package/upload/UploadAction.js +44 -0
- package/upload/UploadButton.d.ts +3 -0
- package/upload/UploadButton.js +31 -0
- package/upload/UploadList.d.ts +3 -0
- package/upload/UploadList.js +62 -0
- package/upload/UploadPicture.d.ts +3 -0
- package/upload/UploadPicture.js +72 -0
- package/upload/UploadPictureList.d.ts +3 -0
- package/upload/UploadPictureList.js +62 -0
- package/upload/UploadPreviewAction.d.ts +3 -0
- package/upload/UploadPreviewAction.js +32 -0
- package/upload/index.d.ts +2 -0
- package/upload/index.js +1 -0
- package/upload/types.d.ts +78 -0
- package/upload/types.js +1 -0
- package/upload/vars.d.ts +65 -0
- package/upload/vars.js +65 -0
- package/utils/handleModalKeyDown.d.ts +2 -0
- package/utils/handleModalKeyDown.js +17 -0
- package/utils/index.d.ts +6 -0
- package/utils/index.js +6 -0
- package/utils/isPrintableCharacter.d.ts +1 -0
- package/utils/isPrintableCharacter.js +3 -0
- package/utils/mergeCS.d.ts +11 -0
- package/utils/mergeCS.js +6 -0
- package/utils/position/getHorizontalSidePosition.d.ts +14 -0
- package/utils/position/getHorizontalSidePosition.js +22 -0
- package/utils/position/getPopupPosition.d.ts +18 -0
- package/utils/position/getPopupPosition.js +170 -0
- package/utils/position/getVerticalSidePosition.d.ts +17 -0
- package/utils/position/getVerticalSidePosition.js +43 -0
- package/vars.d.ts +5 -0
- package/vars.js +5 -0
- package/virtual-scroll/VirtualScroll.d.ts +5 -0
- package/virtual-scroll/VirtualScroll.js +430 -0
- package/virtual-scroll/index.d.ts +2 -0
- package/virtual-scroll/index.js +1 -0
- package/virtual-scroll/types.d.ts +34 -0
- package/virtual-scroll/types.js +1 -0
- package/virtual-scroll/vars.d.ts +1 -0
- package/virtual-scroll/vars.js +1 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAsync, useEvent, useEventCallback, useForceUpdate, useForkRef, useImmer, useResize } from '@laser-ui/hooks';
|
|
4
|
+
import { ReactComponent as CancelFilled } from '@material-design-icons/svg/filled/cancel.svg';
|
|
5
|
+
import { ReactComponent as AccessTimeOutlined } from '@material-design-icons/svg/outlined/access_time.svg';
|
|
6
|
+
import { ReactComponent as SwapHorizOutlined } from '@material-design-icons/svg/outlined/swap_horiz.svg';
|
|
7
|
+
import { isNull, isUndefined } from 'lodash';
|
|
8
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
|
+
import { TimePickerPanel } from './internal/TimePickerPanel';
|
|
10
|
+
import { deepCompareDate, orderTime } from './utils';
|
|
11
|
+
import { CLASSES } from './vars';
|
|
12
|
+
import { Button } from '../button';
|
|
13
|
+
import dayjs from '../dayjs';
|
|
14
|
+
import { useComponentProps, useControlled, useDesign, useLayout, useListenGlobalScrolling, useMaxIndex, useNamespace, useScopedProps, useStyled, useTranslation, } from '../hooks';
|
|
15
|
+
import { Icon } from '../icon';
|
|
16
|
+
import { Portal } from '../internal/portal';
|
|
17
|
+
import { Transition } from '../internal/transition';
|
|
18
|
+
import { ROOT_DATA } from '../root/vars';
|
|
19
|
+
import { getVerticalSidePosition, mergeCS } from '../utils';
|
|
20
|
+
import { TTANSITION_DURING_POPUP, WINDOW_SPACE } from '../vars';
|
|
21
|
+
export const TimePicker = forwardRef((props, ref) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const _c = useComponentProps('TimePicker', props), { styleOverrides, styleProvider, formControl, model, defaultModel, visible: visibleProp, defaultVisible, placeholder, range = false, format = 'HH:mm:ss', order: orderProp = 'ascend', clearable: clearableProp = false, size: sizeProp, disabled: disabledProp = false, config, escClosable = true, inputRef, inputRender, onModelChange, onVisibleChange, onClear, afterVisibleChange } = _c, restProps = __rest(_c, ["styleOverrides", "styleProvider", "formControl", "model", "defaultModel", "visible", "defaultVisible", "placeholder", "range", "format", "order", "clearable", "size", "disabled", "config", "escClosable", "inputRef", "inputRender", "onModelChange", "onVisibleChange", "onClear", "afterVisibleChange"]);
|
|
24
|
+
const namespace = useNamespace();
|
|
25
|
+
const styled = useStyled(CLASSES, { 'time-picker': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['time-picker'], 'time-picker-popup': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['time-picker-popup'] }, styleOverrides);
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const forceUpdate = useForceUpdate();
|
|
28
|
+
const async = useAsync();
|
|
29
|
+
const { pageScrollRef, contentResizeRef } = useLayout();
|
|
30
|
+
const boxRef = useRef(null);
|
|
31
|
+
const popupRef = useRef(null);
|
|
32
|
+
const inputLeftRef = useRef(null);
|
|
33
|
+
const inputRightRef = useRef(null);
|
|
34
|
+
const indicatorRef = useRef(null);
|
|
35
|
+
const combineInputLeftRef = useForkRef(inputLeftRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[0]);
|
|
36
|
+
const combineInputRightRef = useForkRef(inputRightRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[1]);
|
|
37
|
+
const panelRef = useRef(null);
|
|
38
|
+
const dataRef = useRef({
|
|
39
|
+
latestFocused: 'start',
|
|
40
|
+
onceVisible: false,
|
|
41
|
+
focusAnother: false,
|
|
42
|
+
inputValue: [undefined, undefined],
|
|
43
|
+
rangeDate: [null, null],
|
|
44
|
+
});
|
|
45
|
+
const order = (date) => orderTime(date, orderProp);
|
|
46
|
+
const [visible, changeVisible] = useControlled(defaultVisible !== null && defaultVisible !== void 0 ? defaultVisible : false, visibleProp, onVisibleChange);
|
|
47
|
+
const [focused, setFocused] = useImmer([false, false]);
|
|
48
|
+
if (focused[0]) {
|
|
49
|
+
dataRef.current.latestFocused = 'start';
|
|
50
|
+
}
|
|
51
|
+
if (focused[1]) {
|
|
52
|
+
dataRef.current.latestFocused = 'end';
|
|
53
|
+
}
|
|
54
|
+
const [_value, _changeValue] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : null, model, onModelChange, (a, b) => deepCompareDate(a, b, format), formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
55
|
+
let [valueLeft, valueRight = null] = range ? (_a = _value) !== null && _a !== void 0 ? _a : [null, null] : [_value, null];
|
|
56
|
+
if (range) {
|
|
57
|
+
if (isNull(_value)) {
|
|
58
|
+
[valueLeft, valueRight] = dataRef.current.rangeDate;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
dataRef.current.rangeDate = [null, null];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const inputValue = [0, 1].map((index) => focused[index] && !isUndefined(dataRef.current.inputValue[index])
|
|
65
|
+
? dataRef.current.inputValue[index]
|
|
66
|
+
: (() => {
|
|
67
|
+
const value = index === 0 ? valueLeft : valueRight;
|
|
68
|
+
return isNull(value) ? '' : dayjs(value).format(format);
|
|
69
|
+
})());
|
|
70
|
+
const changeValue = (date) => {
|
|
71
|
+
const index = focused.findIndex((f) => f);
|
|
72
|
+
if (range) {
|
|
73
|
+
if (isNull(_value)) {
|
|
74
|
+
dataRef.current.rangeDate[index] = date;
|
|
75
|
+
if (dataRef.current.rangeDate.every((v) => !isNull(v))) {
|
|
76
|
+
dataRef.current.focusAnother = order(dataRef.current.rangeDate);
|
|
77
|
+
if (dataRef.current.focusAnother) {
|
|
78
|
+
dataRef.current.rangeDate.reverse();
|
|
79
|
+
}
|
|
80
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
81
|
+
_changeValue(dataRef.current.rangeDate);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
86
|
+
_changeValue((draft) => {
|
|
87
|
+
draft[index] = date;
|
|
88
|
+
dataRef.current.focusAnother = order(draft);
|
|
89
|
+
if (dataRef.current.focusAnother) {
|
|
90
|
+
draft.reverse();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
97
|
+
_changeValue(date);
|
|
98
|
+
}
|
|
99
|
+
forceUpdate();
|
|
100
|
+
};
|
|
101
|
+
const [placeholderLeft = t('TimePicker', range ? 'Start time' : 'Select time'), placeholderRight = t('TimePicker', 'End time')] = range
|
|
102
|
+
? (_b = placeholder) !== null && _b !== void 0 ? _b : []
|
|
103
|
+
: [placeholder];
|
|
104
|
+
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: disabledProp || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
105
|
+
const maxZIndex = useMaxIndex(visible);
|
|
106
|
+
const zIndex = `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
|
|
107
|
+
const [transformOrigin, setTransformOrigin] = useState();
|
|
108
|
+
const [popupPositionStyle, setPopupPositionStyle] = useState({
|
|
109
|
+
top: '-200vh',
|
|
110
|
+
left: '-200vw',
|
|
111
|
+
});
|
|
112
|
+
const updatePosition = useEventCallback(() => {
|
|
113
|
+
if (visible && boxRef.current && popupRef.current) {
|
|
114
|
+
const height = popupRef.current.offsetHeight;
|
|
115
|
+
const maxWidth = ROOT_DATA.windowSize.width - WINDOW_SPACE * 2;
|
|
116
|
+
const width = Math.min(popupRef.current.scrollWidth, maxWidth);
|
|
117
|
+
const position = getVerticalSidePosition(boxRef.current, { width, height }, {
|
|
118
|
+
placement: 'bottom-left',
|
|
119
|
+
inWindow: WINDOW_SPACE,
|
|
120
|
+
});
|
|
121
|
+
setTransformOrigin(position.transformOrigin);
|
|
122
|
+
setPopupPositionStyle({
|
|
123
|
+
top: position.top,
|
|
124
|
+
left: position.left,
|
|
125
|
+
maxWidth,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const listenGlobalScrolling = useListenGlobalScrolling(updatePosition, !visible);
|
|
130
|
+
useEvent(pageScrollRef, 'scroll', updatePosition, { passive: true }, !visible || listenGlobalScrolling);
|
|
131
|
+
useResize(boxRef, updatePosition, undefined, !visible);
|
|
132
|
+
useResize(popupRef, updatePosition, undefined, !visible);
|
|
133
|
+
useResize(contentResizeRef, updatePosition, undefined, !visible);
|
|
134
|
+
useImperativeHandle(ref, () => ({
|
|
135
|
+
updatePosition,
|
|
136
|
+
}), [updatePosition]);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (boxRef.current && indicatorRef.current) {
|
|
139
|
+
let focus = false;
|
|
140
|
+
const boxRect = boxRef.current.getBoundingClientRect();
|
|
141
|
+
if (inputLeftRef.current && document.activeElement === inputLeftRef.current) {
|
|
142
|
+
const rect = inputLeftRef.current.getBoundingClientRect();
|
|
143
|
+
indicatorRef.current.style.cssText = `left:${rect.left - boxRect.left}px;width:${rect.width}px;opacity:1;`;
|
|
144
|
+
focus = true;
|
|
145
|
+
}
|
|
146
|
+
if (inputRightRef.current && document.activeElement === inputRightRef.current) {
|
|
147
|
+
const rect = inputRightRef.current.getBoundingClientRect();
|
|
148
|
+
indicatorRef.current.style.cssText = `left:${rect.left - boxRect.left}px;width:${rect.width}px;opacity:1;`;
|
|
149
|
+
focus = true;
|
|
150
|
+
}
|
|
151
|
+
if (!focus) {
|
|
152
|
+
indicatorRef.current.style.cssText += 'opacity:0;';
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (dataRef.current.focusAnother && document.activeElement) {
|
|
158
|
+
const el = document.activeElement.parentElement;
|
|
159
|
+
for (let index = 0; index < el.childElementCount; index++) {
|
|
160
|
+
const element = el.children.item(index);
|
|
161
|
+
if (element.tagName.toLowerCase() === 'input' && element !== document.activeElement) {
|
|
162
|
+
element.focus({ preventScroll: true });
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
dataRef.current.focusAnother = false;
|
|
168
|
+
});
|
|
169
|
+
const handleEnter = (time) => {
|
|
170
|
+
var _a;
|
|
171
|
+
if (range) {
|
|
172
|
+
const index = focused.findIndex((f) => f);
|
|
173
|
+
if (isNull(index === 0 ? valueRight : valueLeft)) {
|
|
174
|
+
dataRef.current.focusAnother = true;
|
|
175
|
+
forceUpdate();
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
changeVisible(false);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
changeVisible(false);
|
|
183
|
+
}
|
|
184
|
+
if (!dataRef.current.focusAnother) {
|
|
185
|
+
(_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.call(panelRef, time);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const clearable = clearableProp && !isNull(_value) && !visible && !disabled;
|
|
189
|
+
const inputNode = (isLeft) => {
|
|
190
|
+
const index = isLeft ? 0 : 1;
|
|
191
|
+
const value = isLeft ? valueLeft : valueRight;
|
|
192
|
+
const render = inputRender === null || inputRender === void 0 ? void 0 : inputRender[index];
|
|
193
|
+
const node = (_jsx("input", Object.assign({}, styled('time-picker__input'), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: isLeft ? combineInputLeftRef : combineInputRightRef, type: "text", autoComplete: "off", value: inputValue[index], size: 10, placeholder: isLeft ? placeholderLeft : placeholderRight, disabled: disabled, onChange: (e) => {
|
|
194
|
+
var _a;
|
|
195
|
+
forceUpdate();
|
|
196
|
+
dataRef.current.inputValue[index] = e.currentTarget.value;
|
|
197
|
+
if (dayjs(e.currentTarget.value, format, true).isValid()) {
|
|
198
|
+
const date = dayjs(e.currentTarget.value, format).toDate();
|
|
199
|
+
changeValue(date);
|
|
200
|
+
(_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.call(panelRef, date);
|
|
201
|
+
}
|
|
202
|
+
}, onKeyDown: (e) => {
|
|
203
|
+
if (e.code === 'Escape') {
|
|
204
|
+
if (visible && escClosable) {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
changeVisible(false);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (e.code === 'Enter' && inputValue[index] && dayjs(inputValue[index], format, true).isValid()) {
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
const time = dayjs(inputValue[index], format).toDate();
|
|
213
|
+
handleEnter(time);
|
|
214
|
+
}
|
|
215
|
+
}, onFocus: () => {
|
|
216
|
+
var _a, _b, _c;
|
|
217
|
+
(_b = (_a = dataRef.current).clearTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
218
|
+
setFocused((draft) => {
|
|
219
|
+
draft.fill(false);
|
|
220
|
+
draft[isLeft ? 0 : 1] = true;
|
|
221
|
+
});
|
|
222
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
223
|
+
if (visible && range && value) {
|
|
224
|
+
(_c = panelRef.current) === null || _c === void 0 ? void 0 : _c.call(panelRef, value);
|
|
225
|
+
}
|
|
226
|
+
}, onBlur: () => {
|
|
227
|
+
dataRef.current.clearTid = async.setTimeout(() => {
|
|
228
|
+
setFocused([false, false]);
|
|
229
|
+
changeVisible(false);
|
|
230
|
+
}, 20);
|
|
231
|
+
} })));
|
|
232
|
+
return render ? render(node) : node;
|
|
233
|
+
};
|
|
234
|
+
const preventBlur = (e) => {
|
|
235
|
+
if ((document.activeElement === inputLeftRef.current || document.activeElement === inputRightRef.current) &&
|
|
236
|
+
e.target !== inputLeftRef.current &&
|
|
237
|
+
e.target !== inputRightRef.current &&
|
|
238
|
+
e.button === 0) {
|
|
239
|
+
e.preventDefault();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const designProps = useDesign({ compose: { disabled }, form: formControl });
|
|
243
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({}, restProps, mergeCS(styled('time-picker', `time-picker--${size}`, {
|
|
244
|
+
'time-picker.is-disabled': disabled,
|
|
245
|
+
}), {
|
|
246
|
+
className: restProps.className,
|
|
247
|
+
style: restProps.style,
|
|
248
|
+
}), designProps, { ref: boxRef, onMouseDown: (e) => {
|
|
249
|
+
var _a;
|
|
250
|
+
(_a = restProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
251
|
+
preventBlur(e);
|
|
252
|
+
}, onMouseUp: (e) => {
|
|
253
|
+
var _a;
|
|
254
|
+
(_a = restProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
255
|
+
preventBlur(e);
|
|
256
|
+
}, onClick: (e) => {
|
|
257
|
+
var _a, _b;
|
|
258
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
259
|
+
if (!focused.some((f) => f)) {
|
|
260
|
+
(_b = inputLeftRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
|
|
261
|
+
}
|
|
262
|
+
changeVisible(true);
|
|
263
|
+
}, children: [inputNode(true), range && (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({}, styled('time-picker__indicator'), { ref: indicatorRef })), _jsx("div", Object.assign({}, styled('time-picker__separator'), { children: _jsx(Icon, { children: _jsx(SwapHorizOutlined, {}) }) })), inputNode(false)] })), clearable && (_jsx("div", Object.assign({}, styled('time-picker__clear'), { role: "button", "aria-label": t('Clear'), onClick: (e) => {
|
|
264
|
+
e.stopPropagation();
|
|
265
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
266
|
+
_changeValue(null);
|
|
267
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
268
|
+
}, children: _jsx(Icon, { children: _jsx(CancelFilled, {}) }) }))), _jsx("div", Object.assign({}, mergeCS(styled('time-picker__icon'), {
|
|
269
|
+
style: { visibility: clearable ? 'hidden' : undefined },
|
|
270
|
+
}), { children: _jsx(Icon, { children: _jsx(AccessTimeOutlined, {}) }) }))] })), _jsx(Portal, { selector: () => {
|
|
271
|
+
let el = document.getElementById(`${namespace}-time-picker-root`);
|
|
272
|
+
if (!el) {
|
|
273
|
+
el = document.createElement('div');
|
|
274
|
+
el.id = `${namespace}-time-picker-root`;
|
|
275
|
+
document.body.appendChild(el);
|
|
276
|
+
}
|
|
277
|
+
return el;
|
|
278
|
+
}, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING_POPUP, afterRender: () => {
|
|
279
|
+
updatePosition();
|
|
280
|
+
const cb = () => {
|
|
281
|
+
var _a;
|
|
282
|
+
const value = focused[0] ? valueLeft : valueRight;
|
|
283
|
+
if (value) {
|
|
284
|
+
(_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.call(panelRef, value);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
if (range) {
|
|
288
|
+
cb();
|
|
289
|
+
}
|
|
290
|
+
else if (!dataRef.current.onceVisible) {
|
|
291
|
+
dataRef.current.onceVisible = true;
|
|
292
|
+
cb();
|
|
293
|
+
}
|
|
294
|
+
}, afterEnter: () => {
|
|
295
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
296
|
+
}, afterLeave: () => {
|
|
297
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
298
|
+
}, children: (state) => {
|
|
299
|
+
let transitionStyle = {};
|
|
300
|
+
switch (state) {
|
|
301
|
+
case 'enter':
|
|
302
|
+
transitionStyle = { transform: 'scaleY(0.7)', opacity: 0 };
|
|
303
|
+
break;
|
|
304
|
+
case 'entering':
|
|
305
|
+
transitionStyle = {
|
|
306
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-out`).join(', '),
|
|
307
|
+
transformOrigin,
|
|
308
|
+
};
|
|
309
|
+
break;
|
|
310
|
+
case 'leaving':
|
|
311
|
+
transitionStyle = {
|
|
312
|
+
transform: 'scaleY(0.7)',
|
|
313
|
+
opacity: 0,
|
|
314
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-in`).join(', '),
|
|
315
|
+
transformOrigin,
|
|
316
|
+
};
|
|
317
|
+
break;
|
|
318
|
+
case 'leaved':
|
|
319
|
+
transitionStyle = { display: 'none' };
|
|
320
|
+
break;
|
|
321
|
+
default:
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
return (_jsxs("div", Object.assign({}, mergeCS(styled('time-picker-popup'), {
|
|
325
|
+
style: Object.assign(Object.assign({ zIndex }, popupPositionStyle), transitionStyle),
|
|
326
|
+
}), { ref: popupRef, onMouseDown: (e) => {
|
|
327
|
+
preventBlur(e);
|
|
328
|
+
}, onMouseUp: (e) => {
|
|
329
|
+
preventBlur(e);
|
|
330
|
+
}, children: [_jsx(TimePickerPanel, { ref: panelRef, styled: styled, time: dataRef.current.latestFocused === 'start' ? valueLeft : valueRight, format: format, config: config ? (...args) => config(...args, dataRef.current.latestFocused, [valueLeft, valueRight]) : undefined, onTimeChange: (time) => {
|
|
331
|
+
changeValue(time);
|
|
332
|
+
} }), _jsx("div", Object.assign({}, styled('time-picker__footer'), { children: _jsx(Button, { pattern: "link", onClick: () => {
|
|
333
|
+
const now = new Date();
|
|
334
|
+
changeValue(now);
|
|
335
|
+
handleEnter(now);
|
|
336
|
+
}, children: t('TimePicker', 'Now') }) }))] })));
|
|
337
|
+
} }) })] }));
|
|
338
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TimePicker } from './TimePicker';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Styled } from '../../hooks/useStyled';
|
|
3
|
+
import type { CLASSES } from '../vars';
|
|
4
|
+
interface TimePickerPanelProps {
|
|
5
|
+
styled: Styled<typeof CLASSES>;
|
|
6
|
+
time: Date | null;
|
|
7
|
+
format: string;
|
|
8
|
+
config: ((unit: 'hour' | 'minute' | 'second', value: number) => {
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
}) | undefined;
|
|
12
|
+
inDatePicker?: boolean;
|
|
13
|
+
onTimeChange: (time: Date) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const TimePickerPanel: import("react").ForwardRefExoticComponent<TimePickerPanelProps & import("react").RefAttributes<(date: Date) => void>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEventCallback } from '@laser-ui/hooks';
|
|
4
|
+
import { scrollTo } from '@laser-ui/utils';
|
|
5
|
+
import { freeze } from 'immer';
|
|
6
|
+
import { isUndefined } from 'lodash';
|
|
7
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
8
|
+
import dayjs from '../../dayjs';
|
|
9
|
+
const H12 = freeze(['12', ...Array.from({ length: 11 }).map((_, i) => `${i + 1 < 10 ? '0' : ''}${i + 1}`)]);
|
|
10
|
+
const [H24, M60, S60] = [24, 60, 60].map((num) => freeze(Array.from({ length: num }).map((_, i) => `${i < 10 ? '0' : ''}${i}`)));
|
|
11
|
+
export const TimePickerPanel = forwardRef((props, ref) => {
|
|
12
|
+
const { styled, time: timeProp, format: formatProp, config, inDatePicker = false, onTimeChange } = props;
|
|
13
|
+
const ulHRef = useRef(null);
|
|
14
|
+
const ulMRef = useRef(null);
|
|
15
|
+
const ulSRef = useRef(null);
|
|
16
|
+
const dataRef = useRef({});
|
|
17
|
+
const is12Hour = formatProp.includes('hh');
|
|
18
|
+
const cols = (() => {
|
|
19
|
+
const cols = [];
|
|
20
|
+
if (formatProp.toLowerCase().includes('hh')) {
|
|
21
|
+
cols.push('HH');
|
|
22
|
+
}
|
|
23
|
+
if (formatProp.includes('mm')) {
|
|
24
|
+
cols.push('mm');
|
|
25
|
+
}
|
|
26
|
+
if (formatProp.includes('ss')) {
|
|
27
|
+
cols.push('ss');
|
|
28
|
+
}
|
|
29
|
+
return cols;
|
|
30
|
+
})();
|
|
31
|
+
const time = timeProp ? dayjs(timeProp) : dayjs('00:00:00', 'HH:mm:ss');
|
|
32
|
+
const [_a, setA] = useState('AM');
|
|
33
|
+
const a = timeProp ? (time.get('hour') < 12 ? 'AM' : 'PM') : _a;
|
|
34
|
+
const updateView = useEventCallback((t, unit, behavior = 'smooth') => {
|
|
35
|
+
var _b, _c, _d, _e, _f, _g;
|
|
36
|
+
if (unit === 'hour' || isUndefined(unit)) {
|
|
37
|
+
let hour = t.getHours();
|
|
38
|
+
if (is12Hour) {
|
|
39
|
+
if (a === 'AM' && hour > 11) {
|
|
40
|
+
hour -= 12;
|
|
41
|
+
}
|
|
42
|
+
if (a === 'PM' && hour < 12) {
|
|
43
|
+
hour += 12;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (ulHRef.current) {
|
|
47
|
+
(_c = (_b = dataRef.current).clearHTid) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
48
|
+
dataRef.current.clearHTid = scrollTo(ulHRef.current, {
|
|
49
|
+
top: Array.prototype.indexOf.call(ulHRef.current.children, ulHRef.current.querySelector(`[data-h="${hour}"]`)) * 28,
|
|
50
|
+
behavior,
|
|
51
|
+
during: 200,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (unit === 'minute' || isUndefined(unit)) {
|
|
56
|
+
const minute = t.getMinutes();
|
|
57
|
+
if (ulMRef.current) {
|
|
58
|
+
(_e = (_d = dataRef.current).clearMTid) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
59
|
+
dataRef.current.clearMTid = scrollTo(ulMRef.current, {
|
|
60
|
+
top: Array.prototype.indexOf.call(ulMRef.current.children, ulMRef.current.querySelector(`[data-m="${minute}"]`)) * 28,
|
|
61
|
+
behavior,
|
|
62
|
+
during: 200,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (unit === 'second' || isUndefined(unit)) {
|
|
67
|
+
const second = t.getSeconds();
|
|
68
|
+
if (ulSRef.current) {
|
|
69
|
+
(_g = (_f = dataRef.current).clearSTid) === null || _g === void 0 ? void 0 : _g.call(_f);
|
|
70
|
+
dataRef.current.clearSTid = scrollTo(ulSRef.current, {
|
|
71
|
+
top: Array.prototype.indexOf.call(ulSRef.current.children, ulSRef.current.querySelector(`[data-s="${second}"]`)) * 28,
|
|
72
|
+
behavior,
|
|
73
|
+
during: 200,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
useImperativeHandle(ref, () => (t) => {
|
|
79
|
+
updateView(t, undefined, 'instant');
|
|
80
|
+
}, [updateView]);
|
|
81
|
+
return (_jsxs("div", Object.assign({}, styled('time-picker__panel'), { children: [inDatePicker && _jsx("div", Object.assign({}, styled('time-picker__header'), { children: time.format(cols.join(':')) })), cols.includes('HH') && (_jsx("ul", Object.assign({}, styled('time-picker__column'), { ref: ulHRef, children: (is12Hour ? H12 : H24).map((n) => {
|
|
82
|
+
var _b;
|
|
83
|
+
let hour = Number(n);
|
|
84
|
+
if (is12Hour) {
|
|
85
|
+
if (a === 'AM' && hour === 12) {
|
|
86
|
+
hour = 0;
|
|
87
|
+
}
|
|
88
|
+
if (a === 'PM' && hour !== 12) {
|
|
89
|
+
hour += 12;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const { disabled, hidden } = (_b = config === null || config === void 0 ? void 0 : config('hour', hour)) !== null && _b !== void 0 ? _b : {};
|
|
93
|
+
return hidden ? null : (_createElement("li", Object.assign({}, styled('time-picker__cell', {
|
|
94
|
+
'time-picker__cell.is-active': timeProp && time.get('hour') === hour,
|
|
95
|
+
'time-picker__cell.is-disabled': disabled,
|
|
96
|
+
}), { key: hour, "data-h": hour, onClick: () => {
|
|
97
|
+
const newTime = time.set('hour', hour).toDate();
|
|
98
|
+
updateView(newTime, 'hour');
|
|
99
|
+
onTimeChange(newTime);
|
|
100
|
+
} }), n));
|
|
101
|
+
}) }))), cols.includes('mm') && (_jsx("ul", Object.assign({}, styled('time-picker__column'), { ref: ulMRef, children: M60.map((n) => {
|
|
102
|
+
var _b;
|
|
103
|
+
const minute = Number(n);
|
|
104
|
+
const { disabled, hidden } = (_b = config === null || config === void 0 ? void 0 : config('minute', minute)) !== null && _b !== void 0 ? _b : {};
|
|
105
|
+
return hidden ? null : (_createElement("li", Object.assign({}, styled('time-picker__cell', {
|
|
106
|
+
'time-picker__cell.is-active': timeProp && time.get('minute') === minute,
|
|
107
|
+
'time-picker__cell.is-disabled': disabled,
|
|
108
|
+
}), { key: minute, "data-m": minute, onClick: () => {
|
|
109
|
+
const newTime = time.set('minute', minute).toDate();
|
|
110
|
+
updateView(newTime, 'minute');
|
|
111
|
+
onTimeChange(newTime);
|
|
112
|
+
} }), n));
|
|
113
|
+
}) }))), cols.includes('ss') && (_jsx("ul", Object.assign({}, styled('time-picker__column'), { ref: ulSRef, children: S60.map((n) => {
|
|
114
|
+
var _b;
|
|
115
|
+
const second = Number(n);
|
|
116
|
+
const { disabled, hidden } = (_b = config === null || config === void 0 ? void 0 : config('second', second)) !== null && _b !== void 0 ? _b : {};
|
|
117
|
+
return hidden ? null : (_createElement("li", Object.assign({}, styled('time-picker__cell', {
|
|
118
|
+
'time-picker__cell.is-active': timeProp && time.get('second') === second,
|
|
119
|
+
'time-picker__cell.is-disabled': disabled,
|
|
120
|
+
}), { key: second, "data-s": second, onClick: () => {
|
|
121
|
+
const newTime = time.set('second', second).toDate();
|
|
122
|
+
updateView(newTime, 'second');
|
|
123
|
+
onTimeChange(newTime);
|
|
124
|
+
} }), n));
|
|
125
|
+
}) }))), is12Hour && (_jsx("ul", Object.assign({}, styled('time-picker__column'), { children: ['AM', 'PM'].map((A) => (_createElement("li", Object.assign({}, styled('time-picker__cell', {
|
|
126
|
+
'time-picker__cell.is-active': a === A,
|
|
127
|
+
}), { key: A, onClick: () => {
|
|
128
|
+
if (timeProp) {
|
|
129
|
+
if (a !== A) {
|
|
130
|
+
const newT = time.set('hour', time.get('hour') + (A === 'AM' ? -12 : 12)).toDate();
|
|
131
|
+
onTimeChange(newT);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
setA(A);
|
|
136
|
+
}
|
|
137
|
+
} }), A))) })))] })));
|
|
138
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { BaseProps, CloneHTMLElement, Size } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export interface TimePickerRef {
|
|
7
|
+
updatePosition: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface TimePickerProps extends BaseProps<'time-picker' | 'time-picker-popup', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'placeholder'> {
|
|
10
|
+
formControl?: FormControlProvider;
|
|
11
|
+
model?: Date | [Date, Date] | null;
|
|
12
|
+
defaultModel?: Date | [Date, Date] | null;
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
defaultVisible?: boolean;
|
|
15
|
+
placeholder?: string | [string?, string?];
|
|
16
|
+
range?: boolean;
|
|
17
|
+
format?: string;
|
|
18
|
+
order?: 'ascend' | 'descend' | false;
|
|
19
|
+
clearable?: boolean;
|
|
20
|
+
size?: Size;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
config?: (unit: 'hour' | 'minute' | 'second', value: number, position: 'start' | 'end', current: [Date | null, Date | null]) => {
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
hidden?: boolean;
|
|
25
|
+
};
|
|
26
|
+
escClosable?: boolean;
|
|
27
|
+
inputRef?: [React.ForwardedRef<HTMLInputElement>?, React.ForwardedRef<HTMLInputElement>?];
|
|
28
|
+
inputRender?: [CloneHTMLElement?, CloneHTMLElement?];
|
|
29
|
+
onModelChange?: (date: any) => void;
|
|
30
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
31
|
+
onClear?: () => void;
|
|
32
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OpUnitType } from 'dayjs';
|
|
2
|
+
export declare function deepCompareDate(a: Date | [Date, Date] | null, b: Date | [Date, Date] | null, format: string): boolean;
|
|
3
|
+
export declare function orderDate(date: [Date, Date], order: 'ascend' | 'descend' | false, unit?: OpUnitType): boolean;
|
|
4
|
+
export declare function orderTime(time: [Date, Date], order: 'ascend' | 'descend' | false): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isArray, isDate, isNull } from 'lodash';
|
|
2
|
+
import dayjs from '../dayjs';
|
|
3
|
+
export function deepCompareDate(a, b, format) {
|
|
4
|
+
const isSame = (t1, t2) => dayjs(t1).format(format) === dayjs(t2).format(format);
|
|
5
|
+
if (isDate(a) && isDate(b)) {
|
|
6
|
+
return isSame(a, b);
|
|
7
|
+
}
|
|
8
|
+
if (isNull(a) && isNull(b)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (isArray(a) && isArray(b)) {
|
|
12
|
+
return isSame(a[0], b[0]) && isSame(a[1], b[1]);
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
export function orderDate(date, order, unit) {
|
|
17
|
+
if ((order === 'ascend' && dayjs(date[0]).isAfter(date[1], unit)) || (order === 'descend' && dayjs(date[0]).isBefore(date[1], unit))) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
export function orderTime(time, order) {
|
|
23
|
+
const t1 = dayjs(time[0]).set('year', 2000).set('month', 0).set('date', 1);
|
|
24
|
+
const t2 = dayjs(time[1]).set('year', 2000).set('month', 0).set('date', 1);
|
|
25
|
+
return orderDate([t1.toDate(), t2.toDate()], order);
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
'time-picker': string;
|
|
3
|
+
'time-picker.is-disabled': string;
|
|
4
|
+
'time-picker--small': string;
|
|
5
|
+
'time-picker--medium': string;
|
|
6
|
+
'time-picker--large': string;
|
|
7
|
+
'time-picker__input': string;
|
|
8
|
+
'time-picker__indicator': string;
|
|
9
|
+
'time-picker__separator': string;
|
|
10
|
+
'time-picker__clear': string;
|
|
11
|
+
'time-picker__icon': string;
|
|
12
|
+
'time-picker-popup': string;
|
|
13
|
+
'time-picker__panel': string;
|
|
14
|
+
'time-picker__header': string;
|
|
15
|
+
'time-picker__column': string;
|
|
16
|
+
'time-picker__cell': string;
|
|
17
|
+
'time-picker__cell.is-active': string;
|
|
18
|
+
'time-picker__cell.is-disabled': string;
|
|
19
|
+
'time-picker__footer': string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
'time-picker': '^time-picker',
|
|
3
|
+
'time-picker.is-disabled': 'is-disabled',
|
|
4
|
+
'time-picker--small': '^time-picker--small',
|
|
5
|
+
'time-picker--medium': '^time-picker--medium',
|
|
6
|
+
'time-picker--large': '^time-picker--large',
|
|
7
|
+
'time-picker__input': '^time-picker__input',
|
|
8
|
+
'time-picker__indicator': '^time-picker__indicator',
|
|
9
|
+
'time-picker__separator': '^time-picker__separator',
|
|
10
|
+
'time-picker__clear': '^time-picker__clear',
|
|
11
|
+
'time-picker__icon': '^time-picker__icon',
|
|
12
|
+
'time-picker-popup': '^time-picker-popup',
|
|
13
|
+
'time-picker__panel': '^time-picker__panel',
|
|
14
|
+
'time-picker__header': '^time-picker__header',
|
|
15
|
+
'time-picker__column': '^time-picker__column',
|
|
16
|
+
'time-picker__cell': '^time-picker__cell',
|
|
17
|
+
'time-picker__cell.is-active': 'is-active',
|
|
18
|
+
'time-picker__cell.is-disabled': 'is-disabled',
|
|
19
|
+
'time-picker__footer': '^time-picker__footer',
|
|
20
|
+
};
|