@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,48 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { TreeItem } from '../tree/types';
|
|
5
|
+
import type { BaseProps, CloneHTMLElement, Size } from '../types';
|
|
6
|
+
export {};
|
|
7
|
+
export interface TreeSelectRef {
|
|
8
|
+
updatePosition: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface TreeSelectProps<V extends React.Key, T extends TreeItem<V>> extends BaseProps<'tree-select' | 'tree' | 'tree-select-popup', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
11
|
+
formControl?: FormControlProvider;
|
|
12
|
+
list: T[];
|
|
13
|
+
model?: V | null | V[];
|
|
14
|
+
defaultModel?: V | null | V[];
|
|
15
|
+
expands?: V[];
|
|
16
|
+
defaultExpands?: V[];
|
|
17
|
+
visible?: boolean;
|
|
18
|
+
defaultVisible?: boolean;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
searchable?: boolean;
|
|
22
|
+
searchValue?: string;
|
|
23
|
+
defaultSearchValue?: string;
|
|
24
|
+
onlyLeafSelectable?: boolean;
|
|
25
|
+
showLine?: boolean;
|
|
26
|
+
clearable?: boolean;
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
size?: Size;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
virtual?: boolean | number;
|
|
31
|
+
escClosable?: boolean;
|
|
32
|
+
customItem?: (item: T) => React.ReactNode;
|
|
33
|
+
customSelected?: (selected: T) => string;
|
|
34
|
+
customSearch?: {
|
|
35
|
+
filter?: (value: string, item: T) => boolean;
|
|
36
|
+
sort?: (a: T, b: T) => number;
|
|
37
|
+
};
|
|
38
|
+
inputRef?: React.ForwardedRef<HTMLInputElement>;
|
|
39
|
+
inputRender?: CloneHTMLElement;
|
|
40
|
+
onModelChange?: (value: any, origin: any) => void;
|
|
41
|
+
onFirstExpand?: (value: V, origin: T) => void;
|
|
42
|
+
onExpandsChange?: (values: V[], origins: T[]) => void;
|
|
43
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
44
|
+
onSearch?: (value: string) => void;
|
|
45
|
+
onClear?: () => void;
|
|
46
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
47
|
+
onScrollBottom?: () => void;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
'tree-select': string;
|
|
3
|
+
'tree-select.is-expanded': string;
|
|
4
|
+
'tree-select.is-disabled': string;
|
|
5
|
+
'tree-select--small': string;
|
|
6
|
+
'tree-select--medium': string;
|
|
7
|
+
'tree-select--large': string;
|
|
8
|
+
'tree-select__container': string;
|
|
9
|
+
'tree-select__content': string;
|
|
10
|
+
'tree-select__search': string;
|
|
11
|
+
'tree-select__placeholder-wrapper': string;
|
|
12
|
+
'tree-select__placeholder': string;
|
|
13
|
+
'tree-select__multiple-count': string;
|
|
14
|
+
'tree-select__close': string;
|
|
15
|
+
'tree-select__clear': string;
|
|
16
|
+
'tree-select__icon': string;
|
|
17
|
+
'tree-select__arrow': string;
|
|
18
|
+
'tree-select-popup': string;
|
|
19
|
+
'tree-select-popup__loading': string;
|
|
20
|
+
'tree-select-popup__loading--empty': string;
|
|
21
|
+
tree: string;
|
|
22
|
+
'tree--line': string;
|
|
23
|
+
tree__group: string;
|
|
24
|
+
'tree__group--root': string;
|
|
25
|
+
tree__option: string;
|
|
26
|
+
'tree__option.is-selected': string;
|
|
27
|
+
'tree__option.is-disabled': string;
|
|
28
|
+
'tree__option--root': string;
|
|
29
|
+
'tree__option--first': string;
|
|
30
|
+
'tree__option-dot': string;
|
|
31
|
+
'tree__option-icon': string;
|
|
32
|
+
'tree__option-arrow': string;
|
|
33
|
+
'tree__option-arrow.is-expand': string;
|
|
34
|
+
'tree__option-checkbox': string;
|
|
35
|
+
'tree__option-content': string;
|
|
36
|
+
tree__empty: string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
'tree-select': '^tree-select',
|
|
3
|
+
'tree-select.is-expanded': 'is-expanded',
|
|
4
|
+
'tree-select.is-disabled': 'is-disabled',
|
|
5
|
+
'tree-select--small': '^tree-select--small',
|
|
6
|
+
'tree-select--medium': '^tree-select--medium',
|
|
7
|
+
'tree-select--large': '^tree-select--large',
|
|
8
|
+
'tree-select__container': '^tree-select__container',
|
|
9
|
+
'tree-select__content': '^tree-select__content',
|
|
10
|
+
'tree-select__search': '^tree-select__search',
|
|
11
|
+
'tree-select__placeholder-wrapper': '^tree-select__placeholder-wrapper',
|
|
12
|
+
'tree-select__placeholder': '^tree-select__placeholder',
|
|
13
|
+
'tree-select__multiple-count': '^tree-select__multiple-count',
|
|
14
|
+
'tree-select__close': '^tree-select__close',
|
|
15
|
+
'tree-select__clear': '^tree-select__clear',
|
|
16
|
+
'tree-select__icon': '^tree-select__icon',
|
|
17
|
+
'tree-select__arrow': '^tree-select__arrow',
|
|
18
|
+
'tree-select-popup': '^tree-select-popup',
|
|
19
|
+
'tree-select-popup__loading': '^tree-select-popup__loading',
|
|
20
|
+
'tree-select-popup__loading--empty': '^tree-select-popup__loading--empty',
|
|
21
|
+
tree: '^tree',
|
|
22
|
+
'tree--line': '^tree--line',
|
|
23
|
+
tree__group: '^tree__group',
|
|
24
|
+
'tree__group--root': '^tree__group--root',
|
|
25
|
+
tree__option: '^tree__option',
|
|
26
|
+
'tree__option.is-selected': 'is-selected',
|
|
27
|
+
'tree__option.is-disabled': 'is-disabled',
|
|
28
|
+
'tree__option--root': '^tree__option--root',
|
|
29
|
+
'tree__option--first': '^tree__option--first',
|
|
30
|
+
'tree__option-dot': '^tree__option-dot',
|
|
31
|
+
'tree__option-icon': '^tree__option-icon',
|
|
32
|
+
'tree__option-arrow': '^tree__option-arrow',
|
|
33
|
+
'tree__option-arrow.is-expand': 'is-expand',
|
|
34
|
+
'tree__option-checkbox': '^tree__option-checkbox',
|
|
35
|
+
'tree__option-content': '^tree__option-content',
|
|
36
|
+
tree__empty: '^tree__empty',
|
|
37
|
+
};
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export {};
|
|
3
|
+
export type Lang = 'en-US' | 'zh-CN';
|
|
4
|
+
export type Size = 'small' | 'medium' | 'large';
|
|
5
|
+
export type PopupPlacement = 'top' | 'top-left' | 'top-right' | 'right' | 'right-top' | 'right-bottom' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-top' | 'left-bottom';
|
|
6
|
+
export type VerticalSidePlacement = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right';
|
|
7
|
+
export type CloneHTMLElement<T extends React.ReactElement = React.ReactElement> = (el: T) => T;
|
|
8
|
+
export interface BaseProps<CR extends string, C extends {
|
|
9
|
+
[index: string]: string;
|
|
10
|
+
}> {
|
|
11
|
+
styleOverrides?: {
|
|
12
|
+
[K in keyof C]?: {
|
|
13
|
+
remove?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
styleProvider?: {
|
|
19
|
+
[K in CR]: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
package/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UploadProps } from './types';
|
|
3
|
+
import { UploadAction } from './UploadAction';
|
|
4
|
+
import { UploadButton } from './UploadButton';
|
|
5
|
+
import { UploadList } from './UploadList';
|
|
6
|
+
import { UploadPicture } from './UploadPicture';
|
|
7
|
+
import { UploadPictureList } from './UploadPictureList';
|
|
8
|
+
import { UploadPreviewAction } from './UploadPreviewAction';
|
|
9
|
+
declare function UploadFC(props: UploadProps, ref: React.ForwardedRef<HTMLInputElement>): JSX.Element | null;
|
|
10
|
+
export declare const Upload: {
|
|
11
|
+
(props: UploadProps & React.RefAttributes<HTMLInputElement>): ReturnType<typeof UploadFC>;
|
|
12
|
+
Button: typeof UploadButton;
|
|
13
|
+
Action: typeof UploadAction;
|
|
14
|
+
PreviewAction: typeof UploadPreviewAction;
|
|
15
|
+
List: typeof UploadList;
|
|
16
|
+
Picture: typeof UploadPicture;
|
|
17
|
+
PictureList: typeof UploadPictureList;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
package/upload/Upload.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEventCallback, useForkRef, useUnmount } from '@laser-ui/hooks';
|
|
4
|
+
import { isFunction, isNumber } from 'lodash';
|
|
5
|
+
import { cloneElement, forwardRef, useMemo, useRef } from 'react';
|
|
6
|
+
import { UploadAction } from './UploadAction';
|
|
7
|
+
import { UploadButton } from './UploadButton';
|
|
8
|
+
import { UploadList } from './UploadList';
|
|
9
|
+
import { UploadPicture } from './UploadPicture';
|
|
10
|
+
import { UploadPictureList } from './UploadPictureList';
|
|
11
|
+
import { UploadPreviewAction } from './UploadPreviewAction';
|
|
12
|
+
import { CLASSES, UploadContext } from './vars';
|
|
13
|
+
import { useComponentProps, useControlled, useStyled } from '../hooks';
|
|
14
|
+
import { mergeCS } from '../utils';
|
|
15
|
+
function UploadFC(props, ref) {
|
|
16
|
+
var _a;
|
|
17
|
+
const _b = useComponentProps('Upload', props), { children, styleOverrides, styleProvider, formControl, model, defaultModel, request, max, drag = false, customUpload, beforeUpload, onModelChange, onRemove } = _b, restProps = __rest(_b, ["children", "styleOverrides", "styleProvider", "formControl", "model", "defaultModel", "request", "max", "drag", "customUpload", "beforeUpload", "onModelChange", "onRemove"]);
|
|
18
|
+
const styled = useStyled(CLASSES, { upload: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.upload, 'upload-list': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['upload-list'] }, styleOverrides);
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
const combineInputRef = useForkRef(inputRef, ref);
|
|
21
|
+
const dataRef = useRef({
|
|
22
|
+
fileURLs: [],
|
|
23
|
+
});
|
|
24
|
+
const [files, changeFiles] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : [], model, undefined, undefined, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
25
|
+
useUnmount(() => {
|
|
26
|
+
dataRef.current.fileURLs.forEach((fileURL) => {
|
|
27
|
+
URL.revokeObjectURL(fileURL);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
const handleFiles = (fileList) => {
|
|
31
|
+
if (customUpload) {
|
|
32
|
+
customUpload(fileList);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const filesAdded = [];
|
|
36
|
+
for (let index = 0; index < fileList.length; index++) {
|
|
37
|
+
const file = fileList.item(index);
|
|
38
|
+
if (file) {
|
|
39
|
+
const xhr = new XMLHttpRequest();
|
|
40
|
+
let uid = Date.now();
|
|
41
|
+
const add = (obj) => {
|
|
42
|
+
const fileURL = URL.createObjectURL(file);
|
|
43
|
+
dataRef.current.fileURLs.push(fileURL);
|
|
44
|
+
const fileAdded = Object.assign({ uid, name: file.name, url: fileURL, thumbUrl: file.type.startsWith('image') ? fileURL : undefined, originFile: file, response: xhr.response }, obj);
|
|
45
|
+
if (isNumber(max) && files.length + filesAdded.length >= max) {
|
|
46
|
+
if (max === 1) {
|
|
47
|
+
uid = fileAdded.uid = files[0].uid;
|
|
48
|
+
changeFiles([fileAdded]);
|
|
49
|
+
onModelChange === null || onModelChange === void 0 ? void 0 : onModelChange([fileAdded], {
|
|
50
|
+
type: 'update',
|
|
51
|
+
files: [fileAdded],
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
filesAdded.push(fileAdded);
|
|
58
|
+
};
|
|
59
|
+
const update = (obj) => {
|
|
60
|
+
let hasChange = true;
|
|
61
|
+
const list = changeFiles((draft) => {
|
|
62
|
+
const index = draft.findIndex((f) => f.uid === uid);
|
|
63
|
+
if (index !== -1) {
|
|
64
|
+
draft[index] = Object.assign(draft[index], Object.assign({ response: xhr.response }, obj));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
hasChange = false;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (hasChange) {
|
|
71
|
+
onModelChange === null || onModelChange === void 0 ? void 0 : onModelChange(list, {
|
|
72
|
+
type: 'update',
|
|
73
|
+
files: [list.find((f) => f.uid === uid)],
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const upload = (condition) => {
|
|
78
|
+
if (condition === false) {
|
|
79
|
+
add({ state: null });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const abort = add({ state: 'progress', percent: 0 });
|
|
83
|
+
if (abort) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
xhr.upload.addEventListener('progress', (e) => {
|
|
87
|
+
if (e.lengthComputable) {
|
|
88
|
+
const percent = Math.round((e.loaded * 100) / e.total);
|
|
89
|
+
update({ state: 'progress', percent });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
xhr.addEventListener('error', () => {
|
|
93
|
+
update({ state: 'error', percent: undefined });
|
|
94
|
+
});
|
|
95
|
+
xhr.addEventListener('load', () => {
|
|
96
|
+
update({ state: xhr.status >= 200 && xhr.status < 300 ? 'load' : 'error', percent: undefined });
|
|
97
|
+
});
|
|
98
|
+
const { url, method = 'POST', responseType = 'json', header = {}, body = (file) => {
|
|
99
|
+
const formData = new FormData();
|
|
100
|
+
formData.append('file', file);
|
|
101
|
+
return formData;
|
|
102
|
+
}, custom,
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
104
|
+
} = request;
|
|
105
|
+
xhr.open(method, url);
|
|
106
|
+
xhr.responseType = responseType;
|
|
107
|
+
Object.entries(header).forEach((h) => {
|
|
108
|
+
xhr.setRequestHeader(...h);
|
|
109
|
+
});
|
|
110
|
+
custom === null || custom === void 0 ? void 0 : custom(xhr);
|
|
111
|
+
xhr.send(body(condition === true ? file : condition));
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
let shouldUpload = true;
|
|
115
|
+
if (beforeUpload) {
|
|
116
|
+
shouldUpload = beforeUpload(file, fileList);
|
|
117
|
+
if (shouldUpload instanceof Promise) {
|
|
118
|
+
shouldUpload.then((condition) => {
|
|
119
|
+
upload(condition);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
upload(shouldUpload);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
upload(true);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (filesAdded.length > 0) {
|
|
132
|
+
const list = changeFiles((draft) => draft.concat(filesAdded));
|
|
133
|
+
onModelChange === null || onModelChange === void 0 ? void 0 : onModelChange(list, {
|
|
134
|
+
type: 'add',
|
|
135
|
+
files: filesAdded,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const render = (el) => {
|
|
141
|
+
let dragProps = {};
|
|
142
|
+
if (drag) {
|
|
143
|
+
dragProps = {
|
|
144
|
+
onDragEnter: (e) => {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
(_b = (_a = el.props).onDragEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
},
|
|
150
|
+
onDragOver: (e) => {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
(_b = (_a = el.props).onDragOver) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
},
|
|
156
|
+
onDrop: (e) => {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
(_b = (_a = el.props).onDrop) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
const dt = e.dataTransfer;
|
|
162
|
+
const files = dt.files;
|
|
163
|
+
handleFiles(files);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return cloneElement(el, Object.assign(Object.assign({}, dragProps), { onClick: (e) => {
|
|
168
|
+
var _a, _b;
|
|
169
|
+
(_b = (_a = el.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
170
|
+
if (inputRef.current) {
|
|
171
|
+
inputRef.current.click();
|
|
172
|
+
}
|
|
173
|
+
} }));
|
|
174
|
+
};
|
|
175
|
+
const handleRemove = useEventCallback((file) => {
|
|
176
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
|
|
177
|
+
const newList = changeFiles((draft) => {
|
|
178
|
+
const index = draft.findIndex((f) => f.uid === file.uid);
|
|
179
|
+
draft.splice(index, 1);
|
|
180
|
+
});
|
|
181
|
+
onModelChange === null || onModelChange === void 0 ? void 0 : onModelChange(newList, { type: 'remove', files: [file] });
|
|
182
|
+
});
|
|
183
|
+
const context = useMemo(() => ({ files, onRemove: handleRemove }), [files, handleRemove]);
|
|
184
|
+
return (_jsxs(_Fragment, { children: [_jsx(UploadContext.Provider, { value: context, children: isFunction(children) ? children(render) : render(children) }), _jsx("input", Object.assign({}, restProps, mergeCS(styled('upload'), {
|
|
185
|
+
className: restProps.className,
|
|
186
|
+
style: restProps.style,
|
|
187
|
+
}), { ref: combineInputRef, type: (_a = restProps.type) !== null && _a !== void 0 ? _a : 'file', onChange: (e) => {
|
|
188
|
+
var _a;
|
|
189
|
+
(_a = restProps.onChange) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
190
|
+
const files = e.currentTarget.files;
|
|
191
|
+
if (files) {
|
|
192
|
+
handleFiles(files);
|
|
193
|
+
}
|
|
194
|
+
e.currentTarget.value = '';
|
|
195
|
+
} }))] }));
|
|
196
|
+
}
|
|
197
|
+
export const Upload = forwardRef(UploadFC);
|
|
198
|
+
Upload.Button = UploadButton;
|
|
199
|
+
Upload.Action = UploadAction;
|
|
200
|
+
Upload.PreviewAction = UploadPreviewAction;
|
|
201
|
+
Upload.List = UploadList;
|
|
202
|
+
Upload.Picture = UploadPicture;
|
|
203
|
+
Upload.PictureList = UploadPictureList;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { saveFile } from '@laser-ui/utils';
|
|
4
|
+
import { ReactComponent as DeleteOutlineOutlined } from '@material-design-icons/svg/outlined/delete_outline.svg';
|
|
5
|
+
import { ReactComponent as FileDownloadOutlined } from '@material-design-icons/svg/outlined/file_download.svg';
|
|
6
|
+
import { isUndefined } from 'lodash';
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
|
+
import { ACTION_CLASSES } from './vars';
|
|
9
|
+
import { useComponentProps, useStyled, useTranslation } from '../hooks';
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
|
+
import { mergeCS } from '../utils';
|
|
12
|
+
export const UploadAction = forwardRef((props, ref) => {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const _d = useComponentProps('UploadAction', props), { styleOverrides, styleProvider, children, preset, disabled: disabledProp = false, _file, _defaultActions, _light, _onRemove } = _d, restProps = __rest(_d, ["styleOverrides", "styleProvider", "children", "preset", "disabled", "_file", "_defaultActions", "_light", "_onRemove"]);
|
|
15
|
+
const styled = useStyled(ACTION_CLASSES, { 'upload-action': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['upload-action'] }, styleOverrides);
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const disabled = preset === 'download' ? disabledProp || isUndefined(_file.url) : disabledProp;
|
|
18
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('upload-action', {
|
|
19
|
+
'upload-action.is-disabled': disabled,
|
|
20
|
+
'upload-action--light': _light,
|
|
21
|
+
}), {
|
|
22
|
+
className: restProps.className,
|
|
23
|
+
style: restProps.style,
|
|
24
|
+
}), { ref: ref, role: (_a = restProps['role']) !== null && _a !== void 0 ? _a : 'button', tabIndex: (_b = restProps['tabIndex']) !== null && _b !== void 0 ? _b : (disabled ? -1 : 0), title: ((_c = restProps.title) !== null && _c !== void 0 ? _c : preset === 'download')
|
|
25
|
+
? t('Upload', 'Download file')
|
|
26
|
+
: preset === 'remove'
|
|
27
|
+
? t('Upload', 'Remove file')
|
|
28
|
+
: undefined, onClick: (e) => {
|
|
29
|
+
var _a;
|
|
30
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
if (preset === 'download') {
|
|
33
|
+
if (_defaultActions === null || _defaultActions === void 0 ? void 0 : _defaultActions.download) {
|
|
34
|
+
_defaultActions.download(_file);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
saveFile(_file.url, _file.name);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (preset === 'remove') {
|
|
41
|
+
_onRemove === null || _onRemove === void 0 ? void 0 : _onRemove();
|
|
42
|
+
}
|
|
43
|
+
}, children: children !== null && children !== void 0 ? children : (preset === 'download' ? (_jsx(Icon, { children: _jsx(FileDownloadOutlined, {}) })) : preset === 'remove' ? (_jsx(Icon, { children: _jsx(DeleteOutlineOutlined, {}) })) : null) })));
|
|
44
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ReactComponent as AddOutlined } from '@material-design-icons/svg/outlined/add.svg';
|
|
4
|
+
import { ReactComponent as InsertDriveFileTwoTone } from '@material-design-icons/svg/two-tone/insert_drive_file.svg';
|
|
5
|
+
import { Children, cloneElement, forwardRef } from 'react';
|
|
6
|
+
import { UploadAction } from './UploadAction';
|
|
7
|
+
import { UploadPreviewAction } from './UploadPreviewAction';
|
|
8
|
+
import { BUTTON_CLASSES } from './vars';
|
|
9
|
+
import { useComponentProps, useStyled, useTranslation } from '../hooks';
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
|
+
import { CircularProgress } from '../internal/circular-progress';
|
|
12
|
+
import { mergeCS } from '../utils';
|
|
13
|
+
export const UploadButton = forwardRef((props, ref) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const _b = useComponentProps('UploadButton', props), { styleOverrides, styleProvider, file, actions, defaultActions, onRemove } = _b, restProps = __rest(_b, ["styleOverrides", "styleProvider", "file", "actions", "defaultActions", "onRemove"]);
|
|
16
|
+
const styled = useStyled(BUTTON_CLASSES, { 'upload-button': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['upload-button'] }, styleOverrides);
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const isLoading = file && file.state === 'progress';
|
|
19
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('upload-button', {
|
|
20
|
+
'upload-button.is-disabled': isLoading,
|
|
21
|
+
[`upload-button--${file === null || file === void 0 ? void 0 : file.state}`]: file,
|
|
22
|
+
}), {
|
|
23
|
+
className: restProps.className,
|
|
24
|
+
style: restProps.style,
|
|
25
|
+
}), { ref: ref, tabIndex: (_a = restProps.tabIndex) !== null && _a !== void 0 ? _a : (isLoading ? -1 : 0), children: file && file.state !== 'progress' ? (_jsxs(_Fragment, { children: [file.thumbUrl ? (_jsx("img", Object.assign({}, styled('upload-button__thumbnail'), { src: file.thumbUrl, alt: file.name }))) : (_jsxs(_Fragment, { children: [_jsx(Icon, { theme: file.state === 'error' ? 'danger' : 'primary', children: _jsx(InsertDriveFileTwoTone, {}) }), _jsx("div", Object.assign({}, styled('upload-button__name'), { children: file.name }))] })), _jsx("div", Object.assign({}, styled('upload-button__actions'), { children: Children.map(actions !== null && actions !== void 0 ? actions : [_jsx(UploadPreviewAction, {}), _jsx(UploadAction, { preset: "remove" })], (action) => cloneElement(action, {
|
|
26
|
+
_file: file,
|
|
27
|
+
_defaultActions: defaultActions,
|
|
28
|
+
_light: true,
|
|
29
|
+
_onRemove: onRemove,
|
|
30
|
+
})) }))] })) : (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({}, styled('upload-button__icon'), { children: _jsx(Icon, { children: isLoading ? _jsx(CircularProgress, {}) : _jsx(AddOutlined, {}) }) })), _jsx("div", Object.assign({}, styled('upload-button__text'), { children: t('Upload', isLoading ? 'Uploading' : 'Upload') }))] })) })));
|
|
31
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useImmer } from '@laser-ui/hooks';
|
|
4
|
+
import { ReactComponent as AttachFileOutlined } from '@material-design-icons/svg/outlined/attach_file.svg';
|
|
5
|
+
import { isNumber, isUndefined } from 'lodash';
|
|
6
|
+
import { Children, cloneElement, useContext } from 'react';
|
|
7
|
+
import { UploadAction } from './UploadAction';
|
|
8
|
+
import { LIST_CLASSES, UploadContext } from './vars';
|
|
9
|
+
import { useComponentProps, useNextTick, useStyled } from '../hooks';
|
|
10
|
+
import { Icon } from '../icon';
|
|
11
|
+
import { CircularProgress } from '../internal/circular-progress';
|
|
12
|
+
import { CollapseTransition } from '../internal/transition';
|
|
13
|
+
import { Progress } from '../progress';
|
|
14
|
+
import { mergeCS } from '../utils';
|
|
15
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
16
|
+
export function UploadList(props) {
|
|
17
|
+
const _a = useComponentProps('UploadList', props), { styleOverrides, styleProvider, actions, defaultActions } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "actions", "defaultActions"]);
|
|
18
|
+
const styled = useStyled(LIST_CLASSES, { 'upload-list': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['upload-list'] }, styleOverrides);
|
|
19
|
+
const { files, onRemove } = useContext(UploadContext);
|
|
20
|
+
const nextTick = useNextTick();
|
|
21
|
+
const [removeUIDs, setRemoveUIDs] = useImmer([]);
|
|
22
|
+
return (_jsx("ul", Object.assign({}, restProps, mergeCS(styled('upload-list'), {
|
|
23
|
+
className: restProps.className,
|
|
24
|
+
style: restProps.style,
|
|
25
|
+
}), { children: files.map((file, index) => (_jsx(CollapseTransition, { originalSize: {
|
|
26
|
+
height: 'auto',
|
|
27
|
+
}, collapsedSize: {
|
|
28
|
+
height: 0,
|
|
29
|
+
}, enter: !removeUIDs.includes(file.uid), during: TTANSITION_DURING_BASE, styles: {
|
|
30
|
+
entering: {
|
|
31
|
+
transition: ['height', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
32
|
+
},
|
|
33
|
+
leaving: {
|
|
34
|
+
transition: ['height', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
35
|
+
},
|
|
36
|
+
leaved: { display: 'none' },
|
|
37
|
+
}, skipFirstTransition: nextTick.current ? false : true, afterLeave: () => {
|
|
38
|
+
setRemoveUIDs((draft) => {
|
|
39
|
+
draft.splice(draft.findIndex((uid) => uid === file.uid), 1);
|
|
40
|
+
});
|
|
41
|
+
onRemove(file);
|
|
42
|
+
}, children: (collapseRef, collapseStyle) => (_jsxs("li", Object.assign({}, mergeCS(styled('upload-list__item', {
|
|
43
|
+
[`upload-list__item--${file.state}`]: file.state,
|
|
44
|
+
}), {
|
|
45
|
+
style: collapseStyle,
|
|
46
|
+
}), { ref: collapseRef, children: [_jsx("div", Object.assign({}, styled('upload-list__icon'), { children: file.state === 'progress' ? (_jsx(Icon, { children: _jsx(CircularProgress, {}) })) : (_jsx(Icon, { rotate: 45, children: _jsx(AttachFileOutlined, {}) })) })), _jsx("a", Object.assign({}, styled('upload-list__link', {
|
|
47
|
+
'upload-list__link.is-active': file.state === 'load' && !isUndefined(file.url),
|
|
48
|
+
}), { href: file.url, target: "_blank", rel: "noreferrer", title: file.name, onClick: (e) => {
|
|
49
|
+
if (defaultActions && defaultActions.preview) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
defaultActions.preview(file);
|
|
52
|
+
}
|
|
53
|
+
}, children: file.name })), _jsx("div", Object.assign({}, styled('upload-list__actions'), { children: Children.map(actions ? actions(file, index) : [_jsx(UploadAction, { preset: "remove" })], (action) => cloneElement(action, {
|
|
54
|
+
_file: file,
|
|
55
|
+
_defaultActions: defaultActions,
|
|
56
|
+
_onRemove: () => {
|
|
57
|
+
setRemoveUIDs((draft) => {
|
|
58
|
+
draft.push(file.uid);
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
})) })), _jsx("div", Object.assign({}, styled('upload-list__progress-wrapper'), { children: isNumber(file.percent) && _jsx(Progress, { percent: file.percent, label: false, lineWidth: 2 }) }))] }))) }, file.uid))) })));
|
|
62
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useImmer } from '@laser-ui/hooks';
|
|
4
|
+
import { ReactComponent as InsertDriveFileTwoTone } from '@material-design-icons/svg/two-tone/insert_drive_file.svg';
|
|
5
|
+
import { isNumber } from 'lodash';
|
|
6
|
+
import { Children, cloneElement, useContext } from 'react';
|
|
7
|
+
import { UploadAction } from './UploadAction';
|
|
8
|
+
import { UploadPreviewAction } from './UploadPreviewAction';
|
|
9
|
+
import { PICTURE_CLASSES, UploadContext } from './vars';
|
|
10
|
+
import { useComponentProps, useNextTick, useStyled, useTranslation } from '../hooks';
|
|
11
|
+
import { Icon } from '../icon';
|
|
12
|
+
import { Transition } from '../internal/transition';
|
|
13
|
+
import { Progress } from '../progress';
|
|
14
|
+
import { mergeCS } from '../utils';
|
|
15
|
+
import { TTANSITION_DURING_BASE } from '../vars';
|
|
16
|
+
export function UploadPicture(props) {
|
|
17
|
+
const _a = useComponentProps('UploadPicture', props), { children, styleOverrides, styleProvider, actions, defaultActions } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "actions", "defaultActions"]);
|
|
18
|
+
const styled = useStyled(PICTURE_CLASSES, { 'upload-picture': styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider['upload-picture'] }, styleOverrides);
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
const { files, onRemove } = useContext(UploadContext);
|
|
21
|
+
const nextTick = useNextTick();
|
|
22
|
+
const [removeUIDs, setRemoveUIDs] = useImmer([]);
|
|
23
|
+
return (_jsx("ul", Object.assign({}, restProps, mergeCS(styled('upload-picture'), {
|
|
24
|
+
className: restProps.className,
|
|
25
|
+
style: restProps.style,
|
|
26
|
+
}), { children: _jsxs("div", Object.assign({}, styled('upload-picture__row'), { children: [files.map((file, index) => (_jsx(Transition, { enter: !removeUIDs.includes(file.uid), during: TTANSITION_DURING_BASE, skipFirstTransition: nextTick.current ? false : true, afterLeave: () => {
|
|
27
|
+
setRemoveUIDs((draft) => {
|
|
28
|
+
draft.splice(draft.findIndex((uid) => uid === file.uid), 1);
|
|
29
|
+
});
|
|
30
|
+
onRemove(file);
|
|
31
|
+
}, children: (state) => {
|
|
32
|
+
let transitionStyle = {};
|
|
33
|
+
switch (state) {
|
|
34
|
+
case 'enter':
|
|
35
|
+
transitionStyle = { transform: 'scale(0)' };
|
|
36
|
+
break;
|
|
37
|
+
case 'entering':
|
|
38
|
+
transitionStyle = {
|
|
39
|
+
transition: ['transform'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
40
|
+
transformOrigin: 'top left',
|
|
41
|
+
};
|
|
42
|
+
break;
|
|
43
|
+
case 'leaving':
|
|
44
|
+
transitionStyle = {
|
|
45
|
+
transform: 'scale(0)',
|
|
46
|
+
transition: ['transform'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
47
|
+
transformOrigin: 'top left',
|
|
48
|
+
};
|
|
49
|
+
break;
|
|
50
|
+
case 'leaved':
|
|
51
|
+
transitionStyle = { display: 'none' };
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return (_jsx("div", { children: _jsx("li", Object.assign({}, mergeCS(styled('upload-picture__item', {
|
|
57
|
+
[`upload-picture__item--${file.state}`]: file.state,
|
|
58
|
+
'upload-picture__item.is-disabled': file && file.state === 'progress',
|
|
59
|
+
}), {
|
|
60
|
+
style: transitionStyle,
|
|
61
|
+
}), { children: file.state !== 'progress' ? (_jsxs(_Fragment, { children: [file.thumbUrl ? (_jsx("img", Object.assign({}, styled('upload-picture__thumbnail'), { src: file.thumbUrl, alt: file.name }))) : (_jsxs(_Fragment, { children: [_jsx(Icon, { size: 28, theme: file.state === 'error' ? 'danger' : 'primary', children: _jsx(InsertDriveFileTwoTone, {}) }), _jsx("div", Object.assign({}, styled('upload-picture__name'), { children: file.name }))] })), _jsx("div", Object.assign({}, styled('upload-picture__actions'), { children: Children.map(actions ? actions(file, index) : [_jsx(UploadPreviewAction, {}), _jsx(UploadAction, { preset: "remove" })], (action) => cloneElement(action, {
|
|
62
|
+
_file: file,
|
|
63
|
+
_defaultActions: defaultActions,
|
|
64
|
+
_light: true,
|
|
65
|
+
_onRemove: () => {
|
|
66
|
+
setRemoveUIDs((draft) => {
|
|
67
|
+
draft.push(file.uid);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
})) }))] })) : (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({}, styled('upload-picture__progress-text'), { children: t('Upload', 'Uploading') })), isNumber(file.percent) && (_jsx(Progress, { style: { width: '100%' }, percent: file.percent, label: false, lineWidth: 2 }))] })) })) }));
|
|
71
|
+
} }, file.uid))), _jsx("div", { children: children })] })) })));
|
|
72
|
+
}
|