@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
package/context/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isUndefined } from 'lodash';
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
export class LContextManager {
|
|
4
|
+
get parent() {
|
|
5
|
+
return this._parent;
|
|
6
|
+
}
|
|
7
|
+
get root() {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
9
|
+
let instance = this;
|
|
10
|
+
while (instance.parent) {
|
|
11
|
+
instance = instance.parent;
|
|
12
|
+
}
|
|
13
|
+
return instance;
|
|
14
|
+
}
|
|
15
|
+
constructor(context) {
|
|
16
|
+
Object.defineProperty(this, "namespace", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "componentDisabled", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "componentSize", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "componentDefaultProps", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "layoutPageScrollEl", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(this, "layoutContentResizeEl", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
value: void 0
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(this, "listenGlobalScrolling", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true,
|
|
56
|
+
value: void 0
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(this, "_parent", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: null
|
|
63
|
+
});
|
|
64
|
+
this.namespace = context.namespace;
|
|
65
|
+
this.componentDisabled = context.componentDisabled;
|
|
66
|
+
this.componentSize = context.componentSize;
|
|
67
|
+
this.componentDefaultProps = context.componentDefaultProps;
|
|
68
|
+
this.layoutPageScrollEl = context.layoutPageScrollEl;
|
|
69
|
+
this.layoutContentResizeEl = context.layoutContentResizeEl;
|
|
70
|
+
this.listenGlobalScrolling = context.listenGlobalScrolling;
|
|
71
|
+
}
|
|
72
|
+
setParent(parent) {
|
|
73
|
+
this._parent = parent;
|
|
74
|
+
}
|
|
75
|
+
derive(context) {
|
|
76
|
+
const contextCopied = {
|
|
77
|
+
namespace: this.namespace,
|
|
78
|
+
componentDisabled: this.componentDisabled,
|
|
79
|
+
componentSize: this.componentSize,
|
|
80
|
+
componentDefaultProps: Object.assign({}, this.componentDefaultProps),
|
|
81
|
+
layoutPageScrollEl: this.layoutPageScrollEl,
|
|
82
|
+
layoutContentResizeEl: this.layoutContentResizeEl,
|
|
83
|
+
listenGlobalScrolling: this.listenGlobalScrolling,
|
|
84
|
+
};
|
|
85
|
+
Object.keys(context).forEach((key) => {
|
|
86
|
+
if (!isUndefined(context[key])) {
|
|
87
|
+
if (key === 'componentDefaultProps') {
|
|
88
|
+
Object.assign(contextCopied.componentDefaultProps, context[key]);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
contextCopied[key] = context[key];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return contextCopied;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export const LContext = createContext(new LContextManager({
|
|
99
|
+
namespace: 'l',
|
|
100
|
+
componentDisabled: false,
|
|
101
|
+
componentSize: 'medium',
|
|
102
|
+
componentDefaultProps: {},
|
|
103
|
+
layoutPageScrollEl: ':root',
|
|
104
|
+
layoutContentResizeEl: null,
|
|
105
|
+
listenGlobalScrolling: false,
|
|
106
|
+
}));
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { AccordionProps } from '../accordion';
|
|
2
|
+
import type { AffixProps } from '../affix';
|
|
3
|
+
import type { AlertProps } from '../alert';
|
|
4
|
+
import type { AnchorProps } from '../anchor';
|
|
5
|
+
import type { AvatarProps } from '../avatar';
|
|
6
|
+
import type { BadgeProps, BadgeTextProps } from '../badge';
|
|
7
|
+
import type { BreadcrumbProps } from '../breadcrumb';
|
|
8
|
+
import type { ButtonProps } from '../button';
|
|
9
|
+
import type { CardActionProps, CardContentProps, CardHeaderProps, CardProps } from '../card';
|
|
10
|
+
import type { CascaderProps } from '../cascader';
|
|
11
|
+
import type { CheckboxGroupProps, CheckboxProps } from '../checkbox';
|
|
12
|
+
import type { ComposeItemProps, ComposeProps } from '../compose';
|
|
13
|
+
import type { DatePickerProps } from '../date-picker';
|
|
14
|
+
import type { DrawerFooterProps, DrawerHeaderProps, DrawerProps } from '../drawer';
|
|
15
|
+
import type { DropdownProps } from '../dropdown';
|
|
16
|
+
import type { EmptyProps } from '../empty';
|
|
17
|
+
import type { FabBacktopProps, FabButtonProps, FabProps } from '../fab';
|
|
18
|
+
import type { FormItemProps, FormProps } from '../form';
|
|
19
|
+
import type { IconProps } from '../icon';
|
|
20
|
+
import type { ImageActionProps, ImagePreviewProps, ImageProps } from '../image';
|
|
21
|
+
import type { InputNumberProps, InputProps } from '../input';
|
|
22
|
+
import type { MenuProps } from '../menu';
|
|
23
|
+
import type { ModalProps, ModalHeaderProps, ModalFooterProps, ModalAlertProps } from '../modal';
|
|
24
|
+
import type { NotificationProps } from '../notification';
|
|
25
|
+
import type { PaginationProps } from '../pagination';
|
|
26
|
+
import type { PopoverFooterProps, PopoverHeaderProps, PopoverProps } from '../popover';
|
|
27
|
+
import type { ProgressProps } from '../progress';
|
|
28
|
+
import type { RadioGroupProps, RadioProps } from '../radio';
|
|
29
|
+
import type { RatingProps } from '../rating';
|
|
30
|
+
import type { SelectProps } from '../select';
|
|
31
|
+
import type { SeparatorProps } from '../separator';
|
|
32
|
+
import type { SkeletonProps } from '../skeleton';
|
|
33
|
+
import type { SliderProps } from '../slider';
|
|
34
|
+
import type { SlidesProps } from '../slides';
|
|
35
|
+
import type { SpinnerProps } from '../spinner';
|
|
36
|
+
import type { StepperProps } from '../stepper';
|
|
37
|
+
import type { SwitchProps } from '../switch';
|
|
38
|
+
import type { TableEmptyProps, TableExpandProps, TableFilterProps, TableProps, TableTdProps, TableThActionProps, TableThProps } from '../table';
|
|
39
|
+
import type { TabsProps } from '../tabs';
|
|
40
|
+
import type { TagProps } from '../tag';
|
|
41
|
+
import type { TextareaProps } from '../textarea';
|
|
42
|
+
import type { TimePickerProps } from '../time-picker';
|
|
43
|
+
import type { TimelineProps } from '../timeline';
|
|
44
|
+
import type { ToastProps } from '../toast';
|
|
45
|
+
import type { TooltipProps } from '../tooltip';
|
|
46
|
+
import type { TransferProps } from '../transfer';
|
|
47
|
+
import type { TreeProps } from '../tree';
|
|
48
|
+
import type { TreeSelectProps } from '../tree-select';
|
|
49
|
+
import type { UploadActionProps, UploadButtonProps, UploadListProps, UploadPictureListProps, UploadPictureProps, UploadPreviewActionProps, UploadProps } from '../upload';
|
|
50
|
+
import type { VirtualScrollProps } from '../virtual-scroll';
|
|
51
|
+
export interface ComponentProps {
|
|
52
|
+
Accordion: AccordionProps<any, any>;
|
|
53
|
+
Affix: AffixProps;
|
|
54
|
+
Alert: AlertProps;
|
|
55
|
+
Anchor: AnchorProps<any>;
|
|
56
|
+
Avatar: AvatarProps;
|
|
57
|
+
Breadcrumb: BreadcrumbProps<any, any>;
|
|
58
|
+
Badge: BadgeProps;
|
|
59
|
+
BadgeText: BadgeTextProps;
|
|
60
|
+
Button: ButtonProps;
|
|
61
|
+
Card: CardProps;
|
|
62
|
+
CardHeader: CardHeaderProps;
|
|
63
|
+
CardContent: CardContentProps;
|
|
64
|
+
CardAction: CardActionProps;
|
|
65
|
+
Cascader: CascaderProps<any, any>;
|
|
66
|
+
Checkbox: CheckboxProps;
|
|
67
|
+
CheckboxGroup: CheckboxGroupProps<any, any>;
|
|
68
|
+
Compose: ComposeProps;
|
|
69
|
+
ComposeItem: ComposeItemProps;
|
|
70
|
+
DatePicker: DatePickerProps;
|
|
71
|
+
Drawer: DrawerProps;
|
|
72
|
+
DrawerHeader: DrawerHeaderProps;
|
|
73
|
+
DrawerFooter: DrawerFooterProps;
|
|
74
|
+
Dropdown: DropdownProps<any, any>;
|
|
75
|
+
Empty: EmptyProps;
|
|
76
|
+
Fab: FabProps;
|
|
77
|
+
Form: FormProps;
|
|
78
|
+
FormItem: FormItemProps<any>;
|
|
79
|
+
FabButton: FabButtonProps;
|
|
80
|
+
FabBacktop: FabBacktopProps;
|
|
81
|
+
Icon: IconProps;
|
|
82
|
+
Image: ImageProps;
|
|
83
|
+
ImageAction: ImageActionProps;
|
|
84
|
+
ImagePreview: ImagePreviewProps;
|
|
85
|
+
Input: InputProps;
|
|
86
|
+
InputNumber: InputNumberProps;
|
|
87
|
+
Menu: MenuProps<any, any>;
|
|
88
|
+
Modal: ModalProps;
|
|
89
|
+
ModalHeader: ModalHeaderProps;
|
|
90
|
+
ModalFooter: ModalFooterProps;
|
|
91
|
+
ModalAlert: ModalAlertProps;
|
|
92
|
+
Notification: NotificationProps;
|
|
93
|
+
Pagination: PaginationProps;
|
|
94
|
+
Popover: PopoverProps;
|
|
95
|
+
PopoverHeader: PopoverHeaderProps;
|
|
96
|
+
PopoverFooter: PopoverFooterProps;
|
|
97
|
+
Progress: ProgressProps;
|
|
98
|
+
Radio: RadioProps;
|
|
99
|
+
RadioGroup: RadioGroupProps<any, any>;
|
|
100
|
+
Rating: RatingProps;
|
|
101
|
+
Select: SelectProps<any, any>;
|
|
102
|
+
Separator: SeparatorProps;
|
|
103
|
+
Skeleton: SkeletonProps;
|
|
104
|
+
Slider: SliderProps;
|
|
105
|
+
Slides: SlidesProps<any, any>;
|
|
106
|
+
Spinner: SpinnerProps;
|
|
107
|
+
Stepper: StepperProps<any>;
|
|
108
|
+
Switch: SwitchProps;
|
|
109
|
+
Table: TableProps;
|
|
110
|
+
TableTh: TableThProps;
|
|
111
|
+
TableThAction: TableThActionProps;
|
|
112
|
+
TableTd: TableTdProps;
|
|
113
|
+
TableFilter: TableFilterProps;
|
|
114
|
+
TableEmpty: TableEmptyProps;
|
|
115
|
+
TableExpand: TableExpandProps;
|
|
116
|
+
Tabs: TabsProps<any, any>;
|
|
117
|
+
Tag: TagProps;
|
|
118
|
+
Textarea: TextareaProps;
|
|
119
|
+
TimePicker: TimePickerProps;
|
|
120
|
+
Timeline: TimelineProps<any>;
|
|
121
|
+
Toast: ToastProps;
|
|
122
|
+
Tooltip: TooltipProps;
|
|
123
|
+
Transfer: TransferProps<any, any>;
|
|
124
|
+
Tree: TreeProps<any, any>;
|
|
125
|
+
TreeSelect: TreeSelectProps<any, any>;
|
|
126
|
+
Upload: UploadProps;
|
|
127
|
+
UploadButton: UploadButtonProps;
|
|
128
|
+
UploadAction: UploadActionProps;
|
|
129
|
+
UploadPreviewAction: UploadPreviewActionProps;
|
|
130
|
+
UploadList: UploadListProps;
|
|
131
|
+
UploadPicture: UploadPictureProps;
|
|
132
|
+
UploadPictureList: UploadPictureListProps;
|
|
133
|
+
VirtualScroll: VirtualScrollProps<any>;
|
|
134
|
+
}
|
package/context/props.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useAsync, useEvent, useEventCallback, useForceUpdate, useForkRef, useImmer, useResize } from '@laser-ui/hooks';
|
|
5
|
+
import { ReactComponent as CancelFilled } from '@material-design-icons/svg/filled/cancel.svg';
|
|
6
|
+
import { ReactComponent as CalendarTodayOutlined } from '@material-design-icons/svg/outlined/calendar_today.svg';
|
|
7
|
+
import { ReactComponent as SwapHorizOutlined } from '@material-design-icons/svg/outlined/swap_horiz.svg';
|
|
8
|
+
import { isArray, isBoolean, isNull, isUndefined } from 'lodash';
|
|
9
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
10
|
+
import { DatePickerPanel } from './internal/DatePickerPanel';
|
|
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 { TimePickerPanel } from '../time-picker/internal/TimePickerPanel';
|
|
20
|
+
import { deepCompareDate, orderDate } from '../time-picker/utils';
|
|
21
|
+
import { getVerticalSidePosition, mergeCS } from '../utils';
|
|
22
|
+
import { TTANSITION_DURING_POPUP, WINDOW_SPACE } from '../vars';
|
|
23
|
+
export const DatePicker = forwardRef((props, ref) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const _c = useComponentProps('DatePicker', props), { styleOverrides, styleProvider, formControl, model, defaultModel, visible: visibleProp, defaultVisible, placeholder, range = false, format: formatProp, order: orderProp = 'ascend', clearable: clearableProp = false, size: sizeProp, disabled: disabledProp = false, presetDate, config, showTime = false, 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", "presetDate", "config", "showTime", "escClosable", "inputRef", "inputRender", "onModelChange", "onVisibleChange", "onClear", "afterVisibleChange"]);
|
|
26
|
+
const namespace = useNamespace();
|
|
27
|
+
const styled = useStyled(CLASSES, {
|
|
28
|
+
'date-picker': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['date-picker'],
|
|
29
|
+
'time-picker': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['time-picker'],
|
|
30
|
+
'date-picker-popup': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['date-picker-popup'],
|
|
31
|
+
}, styleOverrides);
|
|
32
|
+
const { t } = useTranslation();
|
|
33
|
+
const forceUpdate = useForceUpdate();
|
|
34
|
+
const async = useAsync();
|
|
35
|
+
const { pageScrollRef, contentResizeRef } = useLayout();
|
|
36
|
+
const boxRef = useRef(null);
|
|
37
|
+
const popupRef = useRef(null);
|
|
38
|
+
const inputLeftRef = useRef(null);
|
|
39
|
+
const inputRightRef = useRef(null);
|
|
40
|
+
const indicatorRef = useRef(null);
|
|
41
|
+
const combineInputLeftRef = useForkRef(inputLeftRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[0]);
|
|
42
|
+
const combineInputRightRef = useForkRef(inputRightRef, inputRef === null || inputRef === void 0 ? void 0 : inputRef[1]);
|
|
43
|
+
const panelRef = useRef(null);
|
|
44
|
+
const timePickerPanelRef = useRef(null);
|
|
45
|
+
const updatePanel = (date) => {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
(_a = panelRef.current) === null || _a === void 0 ? void 0 : _a.call(panelRef, date);
|
|
48
|
+
(_b = timePickerPanelRef.current) === null || _b === void 0 ? void 0 : _b.call(timePickerPanelRef, date);
|
|
49
|
+
};
|
|
50
|
+
const dataRef = useRef({
|
|
51
|
+
latestFocused: 'start',
|
|
52
|
+
onceVisible: false,
|
|
53
|
+
focusAnother: false,
|
|
54
|
+
inputValue: [undefined, undefined],
|
|
55
|
+
rangeDate: [null, null],
|
|
56
|
+
});
|
|
57
|
+
const format = isUndefined(formatProp) ? (showTime ? 'YYYY-MM-DD HH:mm:ss' : `YYYY-MM-DD`) : formatProp;
|
|
58
|
+
const order = (date) => orderDate(date, orderProp, showTime ? undefined : 'date');
|
|
59
|
+
const [visible, changeVisible] = useControlled(defaultVisible !== null && defaultVisible !== void 0 ? defaultVisible : false, visibleProp, onVisibleChange);
|
|
60
|
+
const [focused, setFocused] = useImmer([false, false]);
|
|
61
|
+
if (focused[0]) {
|
|
62
|
+
dataRef.current.latestFocused = 'start';
|
|
63
|
+
}
|
|
64
|
+
if (focused[1]) {
|
|
65
|
+
dataRef.current.latestFocused = 'end';
|
|
66
|
+
}
|
|
67
|
+
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);
|
|
68
|
+
let [valueLeft, valueRight = null] = range ? (_a = _value) !== null && _a !== void 0 ? _a : [null, null] : [_value, null];
|
|
69
|
+
if (range) {
|
|
70
|
+
if (isNull(_value)) {
|
|
71
|
+
[valueLeft, valueRight] = dataRef.current.rangeDate;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
dataRef.current.rangeDate = [null, null];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const inputValue = [0, 1].map((index) => focused[index] && !isUndefined(dataRef.current.inputValue[index])
|
|
78
|
+
? dataRef.current.inputValue[index]
|
|
79
|
+
: (() => {
|
|
80
|
+
const value = index === 0 ? valueLeft : valueRight;
|
|
81
|
+
return isNull(value) ? '' : dayjs(value).format(format);
|
|
82
|
+
})());
|
|
83
|
+
const changeValue = (date) => {
|
|
84
|
+
const index = focused.findIndex((f) => f);
|
|
85
|
+
if (range) {
|
|
86
|
+
if (isNull(_value)) {
|
|
87
|
+
dataRef.current.rangeDate[index] = date;
|
|
88
|
+
if (dataRef.current.rangeDate.every((v) => !isNull(v))) {
|
|
89
|
+
dataRef.current.focusAnother = order(dataRef.current.rangeDate);
|
|
90
|
+
if (dataRef.current.focusAnother) {
|
|
91
|
+
dataRef.current.rangeDate.reverse();
|
|
92
|
+
}
|
|
93
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
94
|
+
_changeValue(dataRef.current.rangeDate);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
99
|
+
_changeValue((draft) => {
|
|
100
|
+
draft[index] = date;
|
|
101
|
+
dataRef.current.focusAnother = order(draft);
|
|
102
|
+
if (dataRef.current.focusAnother) {
|
|
103
|
+
draft.reverse();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
110
|
+
_changeValue(date);
|
|
111
|
+
}
|
|
112
|
+
forceUpdate();
|
|
113
|
+
};
|
|
114
|
+
const [placeholderLeft = t('DatePicker', range ? 'Start date' : 'Select date'), placeholderRight = t('DatePicker', 'End date')] = range
|
|
115
|
+
? (_b = placeholder) !== null && _b !== void 0 ? _b : []
|
|
116
|
+
: [placeholder];
|
|
117
|
+
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: disabledProp || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
118
|
+
const maxZIndex = useMaxIndex(visible);
|
|
119
|
+
const zIndex = `calc(var(--${namespace}-zindex-fixed) + ${maxZIndex})`;
|
|
120
|
+
const [transformOrigin, setTransformOrigin] = useState();
|
|
121
|
+
const [popupPositionStyle, setPopupPositionStyle] = useState({
|
|
122
|
+
top: '-200vh',
|
|
123
|
+
left: '-200vw',
|
|
124
|
+
});
|
|
125
|
+
const updatePosition = useEventCallback(() => {
|
|
126
|
+
if (visible && boxRef.current && popupRef.current) {
|
|
127
|
+
const height = popupRef.current.offsetHeight;
|
|
128
|
+
const maxWidth = ROOT_DATA.windowSize.width - WINDOW_SPACE * 2;
|
|
129
|
+
const width = Math.min(popupRef.current.scrollWidth, maxWidth);
|
|
130
|
+
const position = getVerticalSidePosition(boxRef.current, { width, height }, {
|
|
131
|
+
placement: 'bottom-left',
|
|
132
|
+
inWindow: WINDOW_SPACE,
|
|
133
|
+
});
|
|
134
|
+
setTransformOrigin(position.transformOrigin);
|
|
135
|
+
setPopupPositionStyle({
|
|
136
|
+
top: position.top,
|
|
137
|
+
left: position.left,
|
|
138
|
+
maxWidth,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const listenGlobalScrolling = useListenGlobalScrolling(updatePosition, !visible);
|
|
143
|
+
useEvent(pageScrollRef, 'scroll', updatePosition, { passive: true }, !visible || listenGlobalScrolling);
|
|
144
|
+
useResize(boxRef, updatePosition, undefined, !visible);
|
|
145
|
+
useResize(popupRef, updatePosition, undefined, !visible);
|
|
146
|
+
useResize(contentResizeRef, updatePosition, undefined, !visible);
|
|
147
|
+
useImperativeHandle(ref, () => ({
|
|
148
|
+
updatePosition,
|
|
149
|
+
}), [updatePosition]);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (boxRef.current && indicatorRef.current) {
|
|
152
|
+
let focus = false;
|
|
153
|
+
const boxRect = boxRef.current.getBoundingClientRect();
|
|
154
|
+
if (inputLeftRef.current && document.activeElement === inputLeftRef.current) {
|
|
155
|
+
const rect = inputLeftRef.current.getBoundingClientRect();
|
|
156
|
+
indicatorRef.current.style.cssText = `left:${rect.left - boxRect.left}px;width:${rect.width}px;opacity:1;`;
|
|
157
|
+
focus = true;
|
|
158
|
+
}
|
|
159
|
+
if (inputRightRef.current && document.activeElement === inputRightRef.current) {
|
|
160
|
+
const rect = inputRightRef.current.getBoundingClientRect();
|
|
161
|
+
indicatorRef.current.style.cssText = `left:${rect.left - boxRect.left}px;width:${rect.width}px;opacity:1;`;
|
|
162
|
+
focus = true;
|
|
163
|
+
}
|
|
164
|
+
if (!focus) {
|
|
165
|
+
indicatorRef.current.style.cssText += 'opacity:0;';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
if (dataRef.current.focusAnother && document.activeElement) {
|
|
171
|
+
const el = document.activeElement.parentElement;
|
|
172
|
+
for (let index = 0; index < el.childElementCount; index++) {
|
|
173
|
+
const element = el.children.item(index);
|
|
174
|
+
if (element.tagName.toLowerCase() === 'input' && element !== document.activeElement) {
|
|
175
|
+
element.focus({ preventScroll: true });
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
dataRef.current.focusAnother = false;
|
|
181
|
+
});
|
|
182
|
+
const handleEnter = (date) => {
|
|
183
|
+
if (range) {
|
|
184
|
+
const index = focused.findIndex((f) => f);
|
|
185
|
+
if (isNull(index === 0 ? valueRight : valueLeft)) {
|
|
186
|
+
dataRef.current.focusAnother = true;
|
|
187
|
+
forceUpdate();
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
changeVisible(false);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
changeVisible(false);
|
|
195
|
+
}
|
|
196
|
+
if (!dataRef.current.focusAnother) {
|
|
197
|
+
updatePanel(date);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const clearable = clearableProp && !isNull(_value) && !visible && !disabled;
|
|
201
|
+
const inputNode = (isLeft) => {
|
|
202
|
+
const index = isLeft ? 0 : 1;
|
|
203
|
+
const value = isLeft ? valueLeft : valueRight;
|
|
204
|
+
const render = inputRender === null || inputRender === void 0 ? void 0 : inputRender[index];
|
|
205
|
+
const node = (_jsx("input", Object.assign({}, styled('date-picker__input'), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: isLeft ? combineInputLeftRef : combineInputRightRef, type: "text", autoComplete: "off", value: inputValue[index], size: 22, placeholder: isLeft ? placeholderLeft : placeholderRight, disabled: disabled, onChange: (e) => {
|
|
206
|
+
forceUpdate();
|
|
207
|
+
dataRef.current.inputValue[index] = e.currentTarget.value;
|
|
208
|
+
if (dayjs(e.currentTarget.value, format, true).isValid()) {
|
|
209
|
+
const date = dayjs(e.currentTarget.value, format).toDate();
|
|
210
|
+
changeValue(date);
|
|
211
|
+
updatePanel(date);
|
|
212
|
+
}
|
|
213
|
+
}, onKeyDown: (e) => {
|
|
214
|
+
if (e.code === 'Escape') {
|
|
215
|
+
if (visible && escClosable) {
|
|
216
|
+
e.stopPropagation();
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
changeVisible(false);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else if (e.code === 'Enter' && inputValue[index] && dayjs(inputValue[index], format, true).isValid()) {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
const date = dayjs(inputValue[index], format).toDate();
|
|
224
|
+
handleEnter(date);
|
|
225
|
+
}
|
|
226
|
+
}, onFocus: () => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
(_b = (_a = dataRef.current).clearTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
229
|
+
setFocused((draft) => {
|
|
230
|
+
draft.fill(false);
|
|
231
|
+
draft[isLeft ? 0 : 1] = true;
|
|
232
|
+
});
|
|
233
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
234
|
+
if (visible && range && value) {
|
|
235
|
+
updatePanel(value);
|
|
236
|
+
}
|
|
237
|
+
}, onBlur: () => {
|
|
238
|
+
dataRef.current.clearTid = async.setTimeout(() => {
|
|
239
|
+
setFocused([false, false]);
|
|
240
|
+
changeVisible(false);
|
|
241
|
+
}, 20);
|
|
242
|
+
} })));
|
|
243
|
+
return render ? render(node) : node;
|
|
244
|
+
};
|
|
245
|
+
const preventBlur = (e) => {
|
|
246
|
+
if ((document.activeElement === inputLeftRef.current || document.activeElement === inputRightRef.current) &&
|
|
247
|
+
e.target !== inputLeftRef.current &&
|
|
248
|
+
e.target !== inputRightRef.current &&
|
|
249
|
+
e.button === 0) {
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const designProps = useDesign({ compose: { disabled }, form: formControl });
|
|
254
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({}, restProps, mergeCS(styled('date-picker', `date-picker--${size}`, {
|
|
255
|
+
'date-picker.is-disabled': disabled,
|
|
256
|
+
}), {
|
|
257
|
+
className: restProps.className,
|
|
258
|
+
style: restProps.style,
|
|
259
|
+
}), designProps, { ref: boxRef, onMouseDown: (e) => {
|
|
260
|
+
var _a;
|
|
261
|
+
(_a = restProps.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
262
|
+
preventBlur(e);
|
|
263
|
+
}, onMouseUp: (e) => {
|
|
264
|
+
var _a;
|
|
265
|
+
(_a = restProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
266
|
+
preventBlur(e);
|
|
267
|
+
}, onClick: (e) => {
|
|
268
|
+
var _a, _b;
|
|
269
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
270
|
+
if (!focused.some((f) => f)) {
|
|
271
|
+
(_b = inputLeftRef.current) === null || _b === void 0 ? void 0 : _b.focus({ preventScroll: true });
|
|
272
|
+
}
|
|
273
|
+
changeVisible(true);
|
|
274
|
+
}, children: [inputNode(true), range && (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({}, styled('date-picker__indicator'), { ref: indicatorRef })), _jsx("div", Object.assign({}, styled('date-picker__separator'), { children: _jsx(Icon, { children: _jsx(SwapHorizOutlined, {}) }) })), inputNode(false)] })), clearable && (_jsx("div", Object.assign({}, styled('date-picker__clear'), { role: "button", "aria-label": t('Clear'), onClick: (e) => {
|
|
275
|
+
e.stopPropagation();
|
|
276
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
277
|
+
_changeValue(null);
|
|
278
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
279
|
+
}, children: _jsx(Icon, { children: _jsx(CancelFilled, {}) }) }))), _jsx("div", Object.assign({}, mergeCS(styled('date-picker__icon'), {
|
|
280
|
+
style: { visibility: clearable ? 'hidden' : undefined },
|
|
281
|
+
}), { children: _jsx(Icon, { children: _jsx(CalendarTodayOutlined, {}) }) }))] })), _jsx(Portal, { selector: () => {
|
|
282
|
+
let el = document.getElementById(`${namespace}-date-picker-root`);
|
|
283
|
+
if (!el) {
|
|
284
|
+
el = document.createElement('div');
|
|
285
|
+
el.id = `${namespace}-date-picker-root`;
|
|
286
|
+
document.body.appendChild(el);
|
|
287
|
+
}
|
|
288
|
+
return el;
|
|
289
|
+
}, children: _jsx(Transition, { enter: visible, during: TTANSITION_DURING_POPUP, afterRender: () => {
|
|
290
|
+
updatePosition();
|
|
291
|
+
const cb = () => {
|
|
292
|
+
const value = focused[0] ? valueLeft : valueRight;
|
|
293
|
+
if (value) {
|
|
294
|
+
updatePanel(value);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
if (range) {
|
|
298
|
+
cb();
|
|
299
|
+
}
|
|
300
|
+
else if (!dataRef.current.onceVisible) {
|
|
301
|
+
dataRef.current.onceVisible = true;
|
|
302
|
+
cb();
|
|
303
|
+
}
|
|
304
|
+
}, afterEnter: () => {
|
|
305
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(true);
|
|
306
|
+
}, afterLeave: () => {
|
|
307
|
+
afterVisibleChange === null || afterVisibleChange === void 0 ? void 0 : afterVisibleChange(false);
|
|
308
|
+
}, children: (state) => {
|
|
309
|
+
let transitionStyle = {};
|
|
310
|
+
switch (state) {
|
|
311
|
+
case 'enter':
|
|
312
|
+
transitionStyle = { transform: 'scaleY(0.7)', opacity: 0 };
|
|
313
|
+
break;
|
|
314
|
+
case 'entering':
|
|
315
|
+
transitionStyle = {
|
|
316
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-out`).join(', '),
|
|
317
|
+
transformOrigin,
|
|
318
|
+
};
|
|
319
|
+
break;
|
|
320
|
+
case 'leaving':
|
|
321
|
+
transitionStyle = {
|
|
322
|
+
transform: 'scaleY(0.7)',
|
|
323
|
+
opacity: 0,
|
|
324
|
+
transition: ['transform', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_POPUP}ms ease-in`).join(', '),
|
|
325
|
+
transformOrigin,
|
|
326
|
+
};
|
|
327
|
+
break;
|
|
328
|
+
case 'leaved':
|
|
329
|
+
transitionStyle = { display: 'none' };
|
|
330
|
+
break;
|
|
331
|
+
default:
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
return (_jsxs("div", Object.assign({}, mergeCS(styled('date-picker-popup'), {
|
|
335
|
+
style: Object.assign(Object.assign({ zIndex }, popupPositionStyle), transitionStyle),
|
|
336
|
+
}), { ref: popupRef, onMouseDown: (e) => {
|
|
337
|
+
preventBlur(e);
|
|
338
|
+
}, onMouseUp: (e) => {
|
|
339
|
+
preventBlur(e);
|
|
340
|
+
}, children: [presetDate && (_jsx("ul", Object.assign({}, styled('date-picker__preset'), { children: Object.keys(presetDate).map((name) => {
|
|
341
|
+
const handleClick = () => {
|
|
342
|
+
const date = presetDate[name]();
|
|
343
|
+
dataRef.current.inputValue = [undefined, undefined];
|
|
344
|
+
if (range) {
|
|
345
|
+
if (isArray(date)) {
|
|
346
|
+
_changeValue(date);
|
|
347
|
+
changeVisible(false);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
changeValue(date);
|
|
351
|
+
handleEnter(date);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
_changeValue(date);
|
|
356
|
+
handleEnter(date);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
return (_createElement("li", Object.assign({}, styled('date-picker__preset-option'), { key: name, role: "button", onClick: handleClick }), name));
|
|
360
|
+
}) }))), _jsxs("div", Object.assign({}, styled('date-picker__panel-wrapper'), { children: [_jsx(DatePickerPanel, { ref: panelRef, styled: styled, currentSelected: dataRef.current.latestFocused === 'start' ? valueLeft : valueRight, anotherSelected: dataRef.current.latestFocused === 'start' ? valueRight : valueLeft, config: config ? (...args) => config(...args, dataRef.current.latestFocused, [valueLeft, valueRight]) : undefined, range: range, onDateChange: (date) => {
|
|
361
|
+
changeValue(date);
|
|
362
|
+
if (!showTime) {
|
|
363
|
+
handleEnter(date);
|
|
364
|
+
}
|
|
365
|
+
} }), showTime && (_jsx(TimePickerPanel, { ref: timePickerPanelRef, styled: styled, time: dataRef.current.latestFocused === 'start' ? valueLeft : valueRight, format: format, config: showTime && !isBoolean(showTime) && showTime.config
|
|
366
|
+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
367
|
+
(...args) => showTime.config(...args, dataRef.current.latestFocused, [valueLeft, valueRight])
|
|
368
|
+
: undefined, inDatePicker: true, onTimeChange: (time) => {
|
|
369
|
+
changeValue(time);
|
|
370
|
+
} })), _jsx("div", Object.assign({}, styled('date-picker__footer'), { children: _jsx(Button, { pattern: "link", onClick: () => {
|
|
371
|
+
const now = new Date();
|
|
372
|
+
changeValue(now);
|
|
373
|
+
handleEnter(now);
|
|
374
|
+
}, children: t('DatePicker', showTime ? 'Now' : 'Today') }) }))] }))] })));
|
|
375
|
+
} }) })] }));
|
|
376
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker } from './DatePicker';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Styled } from '../../hooks/useStyled';
|
|
3
|
+
import type { CLASSES } from '../vars';
|
|
4
|
+
interface DatePickerPanelProps {
|
|
5
|
+
styled: Styled<typeof CLASSES>;
|
|
6
|
+
currentSelected: Date | null;
|
|
7
|
+
anotherSelected: Date | null;
|
|
8
|
+
config: ((date: Date) => {
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}) | undefined;
|
|
11
|
+
range: boolean;
|
|
12
|
+
onDateChange: (date: Date) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const DatePickerPanel: import("react").ForwardRefExoticComponent<DatePickerPanelProps & import("react").RefAttributes<(date: Date) => void>>;
|
|
15
|
+
export {};
|