@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/switch/Switch.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
+
import { CLASSES, TTANSITION_DURING } from './vars';
|
|
5
|
+
import { useComponentProps, useControlled, useDesign, useScopedProps, useStyled } from '../hooks';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { CircularProgress } from '../internal/circular-progress';
|
|
8
|
+
import { Transition } from '../internal/transition';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
export function Switch(props) {
|
|
11
|
+
const _a = useComponentProps('Switch', props), { children, styleOverrides, styleProvider, formControl, model, defaultModel, stateContent, labelPlacement = 'right', size: sizeProp, loading = false, disabled: disabledProp = false, inputRef, inputRender, onModelChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "formControl", "model", "defaultModel", "stateContent", "labelPlacement", "size", "loading", "disabled", "inputRef", "inputRender", "onModelChange"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { switch: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.switch }, styleOverrides);
|
|
13
|
+
const [checked, changeChecked] = useControlled(defaultModel !== null && defaultModel !== void 0 ? defaultModel : false, model, onModelChange, undefined, formControl === null || formControl === void 0 ? void 0 : formControl.control);
|
|
14
|
+
const { size, disabled } = useScopedProps({ size: sizeProp, disabled: disabledProp || (formControl === null || formControl === void 0 ? void 0 : formControl.control.disabled) });
|
|
15
|
+
const designProps = useDesign({ compose: { active: checked, disabled } });
|
|
16
|
+
const transitionStyles = {
|
|
17
|
+
enter: { left: 2 },
|
|
18
|
+
entering: {
|
|
19
|
+
left: 'calc(100% - 20px)',
|
|
20
|
+
transition: ['width', 'padding', 'margin', 'left'].map((attr) => `${attr} ${TTANSITION_DURING}ms linear`).join(', '),
|
|
21
|
+
},
|
|
22
|
+
entered: { right: 2 },
|
|
23
|
+
leave: { right: 2 },
|
|
24
|
+
leaving: {
|
|
25
|
+
right: 'calc(100% - 20px)',
|
|
26
|
+
transition: ['width', 'padding', 'margin', 'right'].map((attr) => `${attr} ${TTANSITION_DURING}ms linear`).join(', '),
|
|
27
|
+
},
|
|
28
|
+
leaved: { left: 2 },
|
|
29
|
+
};
|
|
30
|
+
const inputNode = (_jsx("input", Object.assign({}, styled('switch__input'), formControl === null || formControl === void 0 ? void 0 : formControl.inputAria, { ref: inputRef, type: "checkbox", disabled: disabled, role: "switch", "aria-checked": checked, onChange: () => {
|
|
31
|
+
changeChecked((draft) => !draft);
|
|
32
|
+
} })));
|
|
33
|
+
return (_jsxs("label", Object.assign({}, restProps, mergeCS(styled('switch', `switch--${size}`, {
|
|
34
|
+
'switch--label-left': labelPlacement === 'left',
|
|
35
|
+
'switch.is-checked': checked,
|
|
36
|
+
'switch.is-loading': loading,
|
|
37
|
+
'switch.is-disabled': disabled,
|
|
38
|
+
}), {
|
|
39
|
+
className: restProps.className,
|
|
40
|
+
style: restProps.style,
|
|
41
|
+
}), designProps, { children: [_jsxs("div", Object.assign({}, styled('switch__state-container'), { children: [stateContent && (_jsxs(_Fragment, { children: [checkNodeExist(stateContent[0]) && (_jsx("div", Object.assign({}, mergeCS(styled('switch__state-content', 'switch__state-content--left'), {
|
|
42
|
+
style: { opacity: checked ? 1 : 0 },
|
|
43
|
+
}), { children: stateContent[0] }))), checkNodeExist(stateContent[1]) && (_jsx("div", Object.assign({}, mergeCS(styled('switch__state-content'), {
|
|
44
|
+
style: { opacity: checked ? 0 : 1 },
|
|
45
|
+
}), { children: stateContent[1] })))] })), inputRender ? inputRender(inputNode) : inputNode, _jsx(Transition, { enter: checked, during: TTANSITION_DURING, children: (state) => (_jsx("div", Object.assign({}, mergeCS(styled('switch__state-dot'), {
|
|
46
|
+
style: transitionStyles[state],
|
|
47
|
+
}), { children: loading && (_jsx(Icon, { children: _jsx(CircularProgress, {}) })) }))) })] })), checkNodeExist(children) && _jsx("div", Object.assign({}, styled('switch__label'), { children: children }))] })));
|
|
48
|
+
}
|
package/switch/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './Switch';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { BaseProps, CloneHTMLElement, Size } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export interface SwitchProps extends BaseProps<'switch', typeof CLASSES>, React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
7
|
+
formControl?: FormControlProvider;
|
|
8
|
+
model?: boolean;
|
|
9
|
+
defaultModel?: boolean;
|
|
10
|
+
stateContent?: [React.ReactNode, React.ReactNode];
|
|
11
|
+
labelPlacement?: 'left' | 'right';
|
|
12
|
+
size?: Size;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
inputRef?: React.ForwardedRef<HTMLInputElement>;
|
|
16
|
+
inputRender?: CloneHTMLElement;
|
|
17
|
+
onModelChange?: (checked: boolean) => void;
|
|
18
|
+
}
|
package/switch/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/switch/vars.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
switch: string;
|
|
3
|
+
'switch.is-checked': string;
|
|
4
|
+
'switch.is-loading': string;
|
|
5
|
+
'switch.is-disabled': string;
|
|
6
|
+
'switch--label-left': string;
|
|
7
|
+
'switch--small': string;
|
|
8
|
+
'switch--medium': string;
|
|
9
|
+
'switch--large': string;
|
|
10
|
+
'switch__state-container': string;
|
|
11
|
+
'switch__state-content': string;
|
|
12
|
+
'switch__state-content--left': string;
|
|
13
|
+
'switch__state-dot': string;
|
|
14
|
+
switch__input: string;
|
|
15
|
+
switch__label: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const TTANSITION_DURING = 133;
|
package/switch/vars.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
switch: '^switch',
|
|
3
|
+
'switch.is-checked': 'is-checked',
|
|
4
|
+
'switch.is-loading': 'is-loading',
|
|
5
|
+
'switch.is-disabled': 'is-disabled',
|
|
6
|
+
'switch--label-left': '^switch--label-left',
|
|
7
|
+
'switch--small': '^switch--small',
|
|
8
|
+
'switch--medium': '^switch--medium',
|
|
9
|
+
'switch--large': '^switch--large',
|
|
10
|
+
'switch__state-container': '^switch__state-container',
|
|
11
|
+
'switch__state-content': '^switch__state-content',
|
|
12
|
+
'switch__state-content--left': '^switch__state-content--left',
|
|
13
|
+
'switch__state-dot': '^switch__state-dot',
|
|
14
|
+
switch__input: '^switch__input',
|
|
15
|
+
switch__label: '^switch__label',
|
|
16
|
+
};
|
|
17
|
+
export const TTANSITION_DURING = 133;
|
package/table/Table.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableProps } from './types';
|
|
3
|
+
import { TableEmpty } from './TableEmpty';
|
|
4
|
+
import { TableExpand } from './TableExpand';
|
|
5
|
+
import { TableFilter } from './TableFilter';
|
|
6
|
+
import { TableTd } from './TableTd';
|
|
7
|
+
import { TableTh } from './TableTh';
|
|
8
|
+
import { TableThAction } from './TableThAction';
|
|
9
|
+
export declare const Table: {
|
|
10
|
+
(props: TableProps): JSX.Element | null;
|
|
11
|
+
Th: typeof TableTh;
|
|
12
|
+
ThAction: typeof TableThAction;
|
|
13
|
+
Td: typeof TableTd;
|
|
14
|
+
Filter: typeof TableFilter;
|
|
15
|
+
Empty: typeof TableEmpty;
|
|
16
|
+
Expand: typeof TableExpand;
|
|
17
|
+
};
|
package/table/Table.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useAsync, useMount, useResize } from '@laser-ui/hooks';
|
|
4
|
+
import { isSimpleArrayEqual } from '@laser-ui/utils';
|
|
5
|
+
import { useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { TableEmpty } from './TableEmpty';
|
|
7
|
+
import { TableExpand } from './TableExpand';
|
|
8
|
+
import { TableFilter } from './TableFilter';
|
|
9
|
+
import { TableTd } from './TableTd';
|
|
10
|
+
import { TableTh } from './TableTh';
|
|
11
|
+
import { TableThAction } from './TableThAction';
|
|
12
|
+
import { CLASSES, TableContext } from './vars';
|
|
13
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
14
|
+
import { mergeCS } from '../utils';
|
|
15
|
+
export const Table = (props) => {
|
|
16
|
+
const _a = useComponentProps('Table', props), { children, styleOverrides, styleProvider, border = false, ellipsis = false } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "border", "ellipsis"]);
|
|
17
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
18
|
+
const async = useAsync();
|
|
19
|
+
const divRef = useRef(null);
|
|
20
|
+
const dataRef = useRef({});
|
|
21
|
+
const [fixed, setFixed] = useState([]);
|
|
22
|
+
const handleFixed = () => {
|
|
23
|
+
if (divRef.current) {
|
|
24
|
+
const scrollLeft = divRef.current.scrollLeft;
|
|
25
|
+
const maxScrollLeft = divRef.current.scrollWidth - divRef.current.clientWidth;
|
|
26
|
+
let newFixed = [];
|
|
27
|
+
if (maxScrollLeft === 0) {
|
|
28
|
+
newFixed = [];
|
|
29
|
+
}
|
|
30
|
+
else if (scrollLeft === 0) {
|
|
31
|
+
newFixed = ['right'];
|
|
32
|
+
}
|
|
33
|
+
else if (Math.ceil(scrollLeft) >= maxScrollLeft) {
|
|
34
|
+
newFixed = ['left'];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
newFixed = ['left', 'right'];
|
|
38
|
+
}
|
|
39
|
+
if (!isSimpleArrayEqual(newFixed, fixed)) {
|
|
40
|
+
setFixed(newFixed);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
useMount(() => {
|
|
45
|
+
handleFixed();
|
|
46
|
+
});
|
|
47
|
+
useResize(divRef, () => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
(_b = (_a = dataRef.current).clearTid) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
50
|
+
dataRef.current.clearTid = async.setTimeout(() => {
|
|
51
|
+
dataRef.current.clearTid = undefined;
|
|
52
|
+
handleFixed();
|
|
53
|
+
}, 100);
|
|
54
|
+
});
|
|
55
|
+
const context = useMemo(() => ({ fixed, ellipsis }), [ellipsis, fixed]);
|
|
56
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('table', {
|
|
57
|
+
'table--border': border,
|
|
58
|
+
}), {
|
|
59
|
+
className: restProps.className,
|
|
60
|
+
style: restProps.style,
|
|
61
|
+
}), { ref: divRef, onScroll: (e) => {
|
|
62
|
+
var _a;
|
|
63
|
+
(_a = restProps.onScroll) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
64
|
+
handleFixed();
|
|
65
|
+
}, children: _jsx(TableContext.Provider, { value: context, children: children }) })));
|
|
66
|
+
};
|
|
67
|
+
Table.Th = TableTh;
|
|
68
|
+
Table.ThAction = TableThAction;
|
|
69
|
+
Table.Td = TableTd;
|
|
70
|
+
Table.Filter = TableFilter;
|
|
71
|
+
Table.Empty = TableEmpty;
|
|
72
|
+
Table.Expand = TableExpand;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
+
import { isUndefined } from 'lodash';
|
|
5
|
+
import { useEffect, useRef } from 'react';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { Empty } from '../empty';
|
|
8
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
export function TableEmpty(props) {
|
|
11
|
+
const _a = useComponentProps('TableEmpty', props), { children, styleOverrides, styleProvider, colSpan } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "colSpan"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
13
|
+
const tdRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (isUndefined(colSpan) && tdRef.current) {
|
|
17
|
+
let tableEl = tdRef.current.parentElement;
|
|
18
|
+
while (tableEl && tableEl.tagName.toLowerCase() !== 'table') {
|
|
19
|
+
tableEl = tableEl.parentElement;
|
|
20
|
+
}
|
|
21
|
+
if (tableEl) {
|
|
22
|
+
let colSpan = 0;
|
|
23
|
+
const cells = (_a = tableEl.rows.item(0)) === null || _a === void 0 ? void 0 : _a.cells;
|
|
24
|
+
if (cells) {
|
|
25
|
+
for (let index = 0; index < cells.length; index++) {
|
|
26
|
+
colSpan += (_b = cells.item(index).colSpan) !== null && _b !== void 0 ? _b : 1;
|
|
27
|
+
}
|
|
28
|
+
tdRef.current.colSpan = colSpan;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return (_jsx("tr", Object.assign({}, restProps, mergeCS(styled('table__empty'), {
|
|
34
|
+
className: restProps.className,
|
|
35
|
+
style: restProps.style,
|
|
36
|
+
}), { children: _jsx("td", { ref: tdRef, colSpan: colSpan, children: _jsx("div", Object.assign({}, styled('table__empty-content'), { children: checkNodeExist(children) ? children : _jsx(Empty, { image: Empty.SIMPLE_IMG }) })) }) })));
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { CLASSES } from './vars';
|
|
4
|
+
import { useComponentProps, useControlled, useStyled } from '../hooks';
|
|
5
|
+
import { mergeCS } from '../utils';
|
|
6
|
+
export function TableExpand(props) {
|
|
7
|
+
const _a = useComponentProps('TableExpand', props), { styleOverrides, styleProvider, expand: expandProp, onExpandChange } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "expand", "onExpandChange"]);
|
|
8
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
9
|
+
const [expand, changeExpand] = useControlled(false, expandProp, onExpandChange);
|
|
10
|
+
return (_jsx("button", Object.assign({}, restProps, mergeCS(styled('table__expand', {
|
|
11
|
+
'table__expand.is-expand': expand,
|
|
12
|
+
}), {
|
|
13
|
+
className: restProps.className,
|
|
14
|
+
style: restProps.style,
|
|
15
|
+
}), { onClick: (e) => {
|
|
16
|
+
var _a;
|
|
17
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
18
|
+
changeExpand((draft) => !draft);
|
|
19
|
+
} })));
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ReactComponent as SearchOutlined } from '@material-design-icons/svg/outlined/search.svg';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import { useComponentProps, useStyled, useTranslation } from '../hooks';
|
|
7
|
+
import { Icon } from '../icon';
|
|
8
|
+
import { Input } from '../input';
|
|
9
|
+
import { Popover } from '../popover';
|
|
10
|
+
export function TableFilter(props) {
|
|
11
|
+
const _a = useComponentProps('TableFilter', props), { children, styleOverrides, styleProvider, content, visible, placement = 'bottom-right', placementFixed = false, escClosable = true, gap, inWindow = false, searchable = false, searchValue, modal = false, destroyAfterClose = true, zIndex, scrolling, onVisibleChange, onSearch, onReset, afterVisibleChange } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "content", "visible", "placement", "placementFixed", "escClosable", "gap", "inWindow", "searchable", "searchValue", "modal", "destroyAfterClose", "zIndex", "scrolling", "onVisibleChange", "onSearch", "onReset", "afterVisibleChange"]);
|
|
12
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
return (_jsx(Popover, Object.assign({}, restProps, { children: children, content: _jsxs("div", Object.assign({}, styled('table__filter'), { children: [searchable && (_jsx(Input, { style: { display: 'flex' }, model: searchValue, prefix: _jsx(Icon, { children: _jsx(SearchOutlined, {}) }), placeholder: t('Search'), clearable: true, onModelChange: (value) => {
|
|
15
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
|
|
16
|
+
} })), content] })), footer: _jsx(Popover.Footer, { styleOverrides: { popover__footer: { style: { justifyContent: 'space-between' } } }, actions: [
|
|
17
|
+
_jsx(Button, { pattern: "link", onClick: () => {
|
|
18
|
+
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
19
|
+
}, children: t('Table', 'Reset') }),
|
|
20
|
+
'ok',
|
|
21
|
+
] }), visible: visible, trigger: "click", placement: placement, placementFixed: placementFixed, arrow: false, escClosable: escClosable, gap: gap, inWindow: inWindow, modal: modal, destroyAfterClose: destroyAfterClose, zIndex: zIndex, scrolling: scrolling, onVisibleChange: onVisibleChange, afterVisibleChange: afterVisibleChange })));
|
|
22
|
+
}
|
package/table/TableTd.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { TableCell } from './internal/TableCell';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { useComponentProps, useNamespace, useStyled } from '../hooks';
|
|
6
|
+
export function TableTd(props) {
|
|
7
|
+
const _a = useComponentProps('TableTd', props), { children, styleOverrides, styleProvider, width, align = 'left', fixed, ellipsis = false } = _a, restProps = __rest(_a, ["children", "styleOverrides", "styleProvider", "width", "align", "fixed", "ellipsis"]);
|
|
8
|
+
const namespace = useNamespace();
|
|
9
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
10
|
+
return (_jsx(TableCell, Object.assign({}, restProps, { namespace: namespace, styled: styled, tag: "td", width: width, align: align, fixed: fixed, ellipsis: ellipsis, children: _jsx("div", Object.assign({}, styled('table__cell-text'), { children: children })) })));
|
|
11
|
+
}
|
package/table/TableTh.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { checkNodeExist } from '@laser-ui/utils';
|
|
4
|
+
import { isUndefined } from 'lodash';
|
|
5
|
+
import { TableCell } from './internal/TableCell';
|
|
6
|
+
import { CLASSES } from './vars';
|
|
7
|
+
import { useComponentProps, useControlled, useNamespace, useStyled } from '../hooks';
|
|
8
|
+
import { Icon } from '../icon';
|
|
9
|
+
import { mergeCS } from '../utils';
|
|
10
|
+
export function TableTh(props) {
|
|
11
|
+
var _a;
|
|
12
|
+
const _b = useComponentProps('TableTh', props), { children, styleOverrides, styleProvider, width, align = 'left', fixed, sort: sortProp, action, ellipsis = false } = _b, restProps = __rest(_b, ["children", "styleOverrides", "styleProvider", "width", "align", "fixed", "sort", "action", "ellipsis"]);
|
|
13
|
+
const namespace = useNamespace();
|
|
14
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
15
|
+
const [sort, changeSort] = useControlled((_a = sortProp === null || sortProp === void 0 ? void 0 : sortProp.defaultActive) !== null && _a !== void 0 ? _a : null, sortProp === null || sortProp === void 0 ? void 0 : sortProp.active, sortProp === null || sortProp === void 0 ? void 0 : sortProp.onChange);
|
|
16
|
+
return (_jsxs(TableCell, Object.assign({}, restProps, mergeCS(styled({ 'table__cell--th-sort': sortProp }), {
|
|
17
|
+
className: restProps.className,
|
|
18
|
+
style: restProps.style,
|
|
19
|
+
}), { namespace: namespace, styled: styled, tag: "th", width: width, align: align, fixed: fixed, ellipsis: ellipsis, "aria-sort": sort === 'ascend' ? 'ascending' : sort === 'descend' ? 'descending' : undefined, onClick: (e) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
(_a = restProps.onClick) === null || _a === void 0 ? void 0 : _a.call(restProps, e);
|
|
22
|
+
if (sortProp) {
|
|
23
|
+
const sortOptions = (_b = sortProp.options) !== null && _b !== void 0 ? _b : [null, 'ascend', 'descend'];
|
|
24
|
+
changeSort((draft) => sortOptions[(sortOptions.findIndex((order) => order === draft) + 1) % sortOptions.length]);
|
|
25
|
+
}
|
|
26
|
+
}, children: [_jsx("div", Object.assign({}, styled('table__cell-text'), { children: children })), (sortProp || checkNodeExist(action)) && (_jsxs("div", Object.assign({}, styled('table__th-actions'), { "aria-hidden": true, children: [sortProp && (_jsxs("button", Object.assign({}, styled('table__th-action', 'table__th-action--sort'), { children: [(isUndefined(sortProp.options) || sortProp.options.includes('ascend')) && (_jsx("div", Object.assign({}, styled('table__th-sort-icon', {
|
|
27
|
+
'table__th-sort-icon.is-active': sort === 'ascend',
|
|
28
|
+
}), { children: _jsx(Icon, { size: 12, children: _jsx("svg", { viewBox: "0 0 1024 1024", children: _jsx("path", { d: "M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" }) }) }) }))), (isUndefined(sortProp.options) || sortProp.options.includes('descend')) && (_jsx("div", Object.assign({}, styled('table__th-sort-icon', {
|
|
29
|
+
'table__th-sort-icon.is-active': sort === 'descend',
|
|
30
|
+
}), { children: _jsx(Icon, { size: 12, children: _jsx("svg", { viewBox: "0 0 1024 1024", children: _jsx("path", { d: "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" }) }) }) })))] }))), _jsx("div", { onClick: (e) => {
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
}, children: action })] })))] })));
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { CLASSES } from './vars';
|
|
5
|
+
import { useComponentProps, useStyled } from '../hooks';
|
|
6
|
+
import { mergeCS } from '../utils';
|
|
7
|
+
export const TableThAction = forwardRef((props, ref) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
const _c = useComponentProps('TableThAction', props), { styleOverrides, styleProvider, children, active = false, disabled = false } = _c, restProps = __rest(_c, ["styleOverrides", "styleProvider", "children", "active", "disabled"]);
|
|
10
|
+
const styled = useStyled(CLASSES, { table: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.table }, styleOverrides);
|
|
11
|
+
return (_jsx("div", Object.assign({}, restProps, mergeCS(styled('table__th-action', {
|
|
12
|
+
'table__th-action.is-active': active,
|
|
13
|
+
'table__th-action.is-disabled': disabled,
|
|
14
|
+
}), {
|
|
15
|
+
className: restProps.className,
|
|
16
|
+
style: restProps.style,
|
|
17
|
+
}), { ref: ref, role: (_a = restProps['role']) !== null && _a !== void 0 ? _a : 'button', tabIndex: (_b = restProps['tabIndex']) !== null && _b !== void 0 ? _b : (disabled ? -1 : 0), children: children })));
|
|
18
|
+
});
|
package/table/index.d.ts
ADDED
package/table/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Table } from './Table';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Styled } from '../../hooks/useStyled';
|
|
3
|
+
import { type CLASSES } from '../vars';
|
|
4
|
+
interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
5
|
+
namespace: string;
|
|
6
|
+
styled: Styled<typeof CLASSES>;
|
|
7
|
+
tag: 'th' | 'td';
|
|
8
|
+
width: number | string | undefined;
|
|
9
|
+
align: 'left' | 'right' | 'center';
|
|
10
|
+
fixed: {
|
|
11
|
+
top?: number | string;
|
|
12
|
+
right?: number | string;
|
|
13
|
+
bottom?: number | string;
|
|
14
|
+
left?: number | string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
ellipsis: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function TableCell(props: TableCellProps): JSX.Element | null;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { isNumber, isUndefined } from 'lodash';
|
|
4
|
+
import { createElement, useContext, useEffect, useRef } from 'react';
|
|
5
|
+
import { mergeCS } from '../../utils';
|
|
6
|
+
import { TableContext } from '../vars';
|
|
7
|
+
const ZINDEX_CONFIG = {
|
|
8
|
+
top: 5,
|
|
9
|
+
right: 2,
|
|
10
|
+
bottom: 5,
|
|
11
|
+
left: 2,
|
|
12
|
+
};
|
|
13
|
+
export function TableCell(props) {
|
|
14
|
+
const { children, namespace, styled, tag, width, align, fixed, ellipsis: ellipsisProp } = props, restProps = __rest(props, ["children", "namespace", "styled", "tag", "width", "align", "fixed", "ellipsis"]);
|
|
15
|
+
const tableContext = useContext(TableContext);
|
|
16
|
+
const cellRef = useRef(null);
|
|
17
|
+
const ellipsis = ellipsisProp || tableContext.ellipsis;
|
|
18
|
+
let fixedLeft = false;
|
|
19
|
+
let fixedRight = false;
|
|
20
|
+
let fixedStyle = {};
|
|
21
|
+
if (fixed) {
|
|
22
|
+
fixedStyle = Object.assign(Object.assign({}, fixed), { position: 'sticky', zIndex: (tag === 'th' ? 1 : 0) +
|
|
23
|
+
Object.keys(fixed).reduce((previous, current) => previous + ZINDEX_CONFIG[current], 0) });
|
|
24
|
+
if ('left' in fixed) {
|
|
25
|
+
fixedLeft = true;
|
|
26
|
+
}
|
|
27
|
+
if ('right' in fixed) {
|
|
28
|
+
fixedRight = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (cellRef.current && cellRef.current.parentElement) {
|
|
33
|
+
let showShadow = false;
|
|
34
|
+
if (fixedLeft && tableContext.fixed.includes('left')) {
|
|
35
|
+
const elsL = cellRef.current.parentElement.querySelectorAll(`.${namespace}-table__cell--fixed-left`);
|
|
36
|
+
if (elsL.item(elsL.length - 1) === cellRef.current) {
|
|
37
|
+
showShadow = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (fixedRight && tableContext.fixed.includes('right')) {
|
|
41
|
+
const elsR = cellRef.current.parentElement.querySelectorAll(`.${namespace}-table__cell--fixed-right`);
|
|
42
|
+
if (elsR.item(0) === cellRef.current) {
|
|
43
|
+
showShadow = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
cellRef.current.classList.toggle(`${namespace}-table__cell--fixed-shadow`, showShadow);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return createElement(tag, Object.assign(Object.assign(Object.assign({}, restProps), mergeCS(styled('table__cell', `table__cell--${align}`, {
|
|
50
|
+
'table__cell--fixed-left': fixedLeft,
|
|
51
|
+
'table__cell--fixed-right': fixedRight,
|
|
52
|
+
'table__cell--ellipsis': ellipsis,
|
|
53
|
+
}), {
|
|
54
|
+
className: restProps.className,
|
|
55
|
+
style: Object.assign(Object.assign(Object.assign({}, restProps.style), fixedStyle), { width: isUndefined(width) ? undefined : width }),
|
|
56
|
+
})), { ref: cellRef }), _jsx("div", Object.assign({}, mergeCS(styled('table__cell-content'), {
|
|
57
|
+
style: {
|
|
58
|
+
width: isUndefined(width) ? undefined : `calc(${width}${isNumber(width) ? 'px' : ''} - var(--padding-size) * 2)`,
|
|
59
|
+
},
|
|
60
|
+
}), { children: children })));
|
|
61
|
+
}
|
package/table/types.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { BaseProps, CloneHTMLElement, PopupPlacement } from '../types';
|
|
4
|
+
import type { RefExtra } from '@laser-ui/hooks/useRefExtra';
|
|
5
|
+
export {};
|
|
6
|
+
export interface TableContextData {
|
|
7
|
+
fixed: ('left' | 'right')[];
|
|
8
|
+
ellipsis: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TableProps extends BaseProps<'table', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
border?: boolean;
|
|
12
|
+
ellipsis?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TableThProps extends BaseProps<'table', typeof CLASSES>, React.ThHTMLAttributes<HTMLTableCellElement> {
|
|
15
|
+
width?: number | string;
|
|
16
|
+
align?: 'left' | 'right' | 'center';
|
|
17
|
+
fixed?: {
|
|
18
|
+
top?: number | string;
|
|
19
|
+
right?: number | string;
|
|
20
|
+
bottom?: number | string;
|
|
21
|
+
left?: number | string;
|
|
22
|
+
};
|
|
23
|
+
sort?: {
|
|
24
|
+
options?: ('ascend' | 'descend' | null)[];
|
|
25
|
+
active?: 'ascend' | 'descend' | null;
|
|
26
|
+
defaultActive?: 'ascend' | 'descend' | null;
|
|
27
|
+
onChange?: (order: 'ascend' | 'descend' | null) => void;
|
|
28
|
+
};
|
|
29
|
+
action?: React.ReactNode;
|
|
30
|
+
ellipsis?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface TableTdProps extends BaseProps<'table', typeof CLASSES>, React.TdHTMLAttributes<HTMLTableCellElement> {
|
|
33
|
+
width?: number | string;
|
|
34
|
+
align?: 'left' | 'right' | 'center';
|
|
35
|
+
fixed?: {
|
|
36
|
+
top?: number | string;
|
|
37
|
+
right?: number | string;
|
|
38
|
+
bottom?: number | string;
|
|
39
|
+
left?: number | string;
|
|
40
|
+
};
|
|
41
|
+
ellipsis?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface TableFilterProps extends BaseProps<'table', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'content'> {
|
|
44
|
+
children: React.ReactElement | ((render: CloneHTMLElement) => React.ReactNode);
|
|
45
|
+
content?: React.ReactNode;
|
|
46
|
+
visible?: boolean;
|
|
47
|
+
placement?: PopupPlacement;
|
|
48
|
+
placementFixed?: boolean;
|
|
49
|
+
escClosable?: boolean;
|
|
50
|
+
gap?: number;
|
|
51
|
+
inWindow?: number | false;
|
|
52
|
+
searchable?: boolean;
|
|
53
|
+
searchValue?: string;
|
|
54
|
+
modal?: boolean;
|
|
55
|
+
destroyAfterClose?: boolean;
|
|
56
|
+
zIndex?: number | string;
|
|
57
|
+
scrolling?: RefExtra;
|
|
58
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
59
|
+
onSearch?: (value: string) => void;
|
|
60
|
+
onReset?: () => void;
|
|
61
|
+
afterVisibleChange?: (visible: boolean) => void;
|
|
62
|
+
}
|
|
63
|
+
export interface TableThActionProps extends BaseProps<'table', typeof CLASSES>, React.HTMLAttributes<HTMLDivElement> {
|
|
64
|
+
active?: boolean;
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface TableEmptyProps extends BaseProps<'table', typeof CLASSES>, React.HTMLAttributes<HTMLTableRowElement> {
|
|
68
|
+
colSpan?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface TableExpandProps extends BaseProps<'table', typeof CLASSES>, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
71
|
+
expand?: boolean;
|
|
72
|
+
onExpandChange?: (expand: boolean) => void;
|
|
73
|
+
}
|
package/table/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/table/vars.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TableContextData } from './types';
|
|
3
|
+
export declare const CLASSES: {
|
|
4
|
+
table: string;
|
|
5
|
+
'table--border': string;
|
|
6
|
+
table__cell: string;
|
|
7
|
+
'table__cell--left': string;
|
|
8
|
+
'table__cell--right': string;
|
|
9
|
+
'table__cell--center': string;
|
|
10
|
+
'table__cell--fixed-left': string;
|
|
11
|
+
'table__cell--fixed-right': string;
|
|
12
|
+
'table__cell--ellipsis': string;
|
|
13
|
+
'table__cell--th-sort': string;
|
|
14
|
+
'table__cell-content': string;
|
|
15
|
+
'table__cell-text': string;
|
|
16
|
+
'table__th-actions': string;
|
|
17
|
+
'table__th-action': string;
|
|
18
|
+
'table__th-action.is-active': string;
|
|
19
|
+
'table__th-action.is-disabled': string;
|
|
20
|
+
'table__th-action--sort': string;
|
|
21
|
+
'table__th-sort-icon': string;
|
|
22
|
+
'table__th-sort-icon.is-active': string;
|
|
23
|
+
table__filter: string;
|
|
24
|
+
table__empty: string;
|
|
25
|
+
'table__empty-content': string;
|
|
26
|
+
table__expand: string;
|
|
27
|
+
'table__expand.is-expand': string;
|
|
28
|
+
};
|
|
29
|
+
export declare const TableContext: import("react").Context<TableContextData>;
|
package/table/vars.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const CLASSES = {
|
|
3
|
+
table: '^table',
|
|
4
|
+
'table--border': '^table--border',
|
|
5
|
+
table__cell: '^table__cell',
|
|
6
|
+
'table__cell--left': '^table__cell--left',
|
|
7
|
+
'table__cell--right': '^table__cell--right',
|
|
8
|
+
'table__cell--center': '^table__cell--center',
|
|
9
|
+
'table__cell--fixed-left': '^table__cell--fixed-left',
|
|
10
|
+
'table__cell--fixed-right': '^table__cell--fixed-right',
|
|
11
|
+
'table__cell--ellipsis': '^table__cell--ellipsis',
|
|
12
|
+
'table__cell--th-sort': '^table__cell--th-sort',
|
|
13
|
+
'table__cell-content': '^table__cell-content',
|
|
14
|
+
'table__cell-text': '^table__cell-text',
|
|
15
|
+
'table__th-actions': '^table__th-actions',
|
|
16
|
+
'table__th-action': '^table__th-action',
|
|
17
|
+
'table__th-action.is-active': 'is-active',
|
|
18
|
+
'table__th-action.is-disabled': 'is-disabled',
|
|
19
|
+
'table__th-action--sort': '^table__th-action--sort',
|
|
20
|
+
'table__th-sort-icon': '^table__th-sort-icon',
|
|
21
|
+
'table__th-sort-icon.is-active': 'is-active',
|
|
22
|
+
table__filter: '^table__filter',
|
|
23
|
+
table__empty: '^table__empty',
|
|
24
|
+
'table__empty-content': '^table__empty-content',
|
|
25
|
+
table__expand: '^table__expand',
|
|
26
|
+
'table__expand.is-expand': 'is-expand',
|
|
27
|
+
};
|
|
28
|
+
export const TableContext = createContext(undefined);
|
package/tabs/Tabs.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TabsItem, TabsProps, TabsRef } from './types';
|
|
3
|
+
declare function TabsFC<ID extends React.Key, T extends TabsItem<ID>>(props: TabsProps<ID, T>, ref: React.ForwardedRef<TabsRef>): JSX.Element | null;
|
|
4
|
+
export declare const Tabs: <ID extends React.Key, T extends TabsItem<ID>>(props: TabsProps<ID, T> & React.RefAttributes<TabsRef>) => ReturnType<typeof TabsFC>;
|
|
5
|
+
export {};
|