@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,167 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { useEventCallback } from '@laser-ui/hooks';
|
|
5
|
+
import { scrollIntoViewIfNeeded } from '@laser-ui/utils';
|
|
6
|
+
import { ReactComponent as AddBoxOutlined } from '@material-design-icons/svg/outlined/add_box.svg';
|
|
7
|
+
import { ReactComponent as ArrowRightOutlined } from '@material-design-icons/svg/outlined/arrow_right.svg';
|
|
8
|
+
import { ReactComponent as IndeterminateCheckBoxOutlined } from '@material-design-icons/svg/outlined/indeterminate_check_box.svg';
|
|
9
|
+
import { isUndefined } from 'lodash';
|
|
10
|
+
import { cloneElement, forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
11
|
+
import { Checkbox } from '../../checkbox';
|
|
12
|
+
import { Empty } from '../../empty';
|
|
13
|
+
import { useTranslation } from '../../hooks';
|
|
14
|
+
import { Icon } from '../../icon';
|
|
15
|
+
import { CircularProgress } from '../../internal/circular-progress';
|
|
16
|
+
import { CollapseTransition } from '../../internal/transition';
|
|
17
|
+
import { mergeCS } from '../../utils';
|
|
18
|
+
import { TTANSITION_DURING_BASE } from '../../vars';
|
|
19
|
+
import { VirtualScroll } from '../../virtual-scroll';
|
|
20
|
+
function TreePanelFC(props, ref) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const { namespace, styled, list, itemId, itemSelected, itemFocused, expands, customItem, showLine, multiple, onlyLeafSelectable, disabled, virtual, focusVisible, onNodeFocus, onNodeExpand, onNodeClick, onScrollBottom } = props, restProps = __rest(props, ["namespace", "styled", "list", "itemId", "itemSelected", "itemFocused", "expands", "customItem", "showLine", "multiple", "onlyLeafSelectable", "disabled", "virtual", "focusVisible", "onNodeFocus", "onNodeExpand", "onNodeClick", "onScrollBottom"]);
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const listRef = useRef(null);
|
|
25
|
+
const vsRef = useRef(null);
|
|
26
|
+
const handleKeyDown = useEventCallback((code) => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
|
+
if (listRef.current) {
|
|
29
|
+
let item;
|
|
30
|
+
if (itemFocused) {
|
|
31
|
+
const isExpand = expands.has(itemFocused.id);
|
|
32
|
+
switch (code) {
|
|
33
|
+
case 'next':
|
|
34
|
+
item = (_a = vsRef.current) === null || _a === void 0 ? void 0 : _a.scrollToStep(listRef.current, 1);
|
|
35
|
+
break;
|
|
36
|
+
case 'prev':
|
|
37
|
+
item = (_b = vsRef.current) === null || _b === void 0 ? void 0 : _b.scrollToStep(listRef.current, -1);
|
|
38
|
+
break;
|
|
39
|
+
case 'first':
|
|
40
|
+
item = (_c = vsRef.current) === null || _c === void 0 ? void 0 : _c.scrollToStart(listRef.current);
|
|
41
|
+
break;
|
|
42
|
+
case 'last':
|
|
43
|
+
item = (_d = vsRef.current) === null || _d === void 0 ? void 0 : _d.scrollToEnd(listRef.current);
|
|
44
|
+
break;
|
|
45
|
+
case 'prev-level':
|
|
46
|
+
if (!itemFocused.isLeaf && isExpand) {
|
|
47
|
+
onNodeExpand(itemFocused);
|
|
48
|
+
}
|
|
49
|
+
else if (itemFocused.parent) {
|
|
50
|
+
item = (_e = vsRef.current) === null || _e === void 0 ? void 0 : _e.scrollToItem(listRef.current, itemFocused.parent.id);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 'next-level':
|
|
54
|
+
if (!itemFocused.isLeaf) {
|
|
55
|
+
if (isExpand) {
|
|
56
|
+
item = (_f = vsRef.current) === null || _f === void 0 ? void 0 : _f.scrollToNested(listRef.current);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
onNodeExpand(itemFocused);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
if (code instanceof HTMLElement && listRef.current) {
|
|
65
|
+
scrollIntoViewIfNeeded(code, listRef.current);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return item;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
useImperativeHandle(ref, () => handleKeyDown, [handleKeyDown]);
|
|
74
|
+
const vsProps = useMemo(() => {
|
|
75
|
+
var _a;
|
|
76
|
+
return ({
|
|
77
|
+
list,
|
|
78
|
+
itemKey: (item) => item.id,
|
|
79
|
+
itemSize: (_a = virtual === null || virtual === void 0 ? void 0 : virtual.itemSize) !== null && _a !== void 0 ? _a : 32,
|
|
80
|
+
itemEmptySize: 32,
|
|
81
|
+
itemNested: (item) => item.children,
|
|
82
|
+
itemFocusable: (item) => item.enabled,
|
|
83
|
+
itemExpand: (item) => (item.children ? expands.has(item.id) : undefined),
|
|
84
|
+
});
|
|
85
|
+
}, [expands, list, virtual]);
|
|
86
|
+
return (_jsx(VirtualScroll, Object.assign({}, vsProps, { ref: vsRef, enable: !isUndefined(virtual), listSize: (_a = virtual === null || virtual === void 0 ? void 0 : virtual.listSize) !== null && _a !== void 0 ? _a : 0, listPadding: (_b = virtual === null || virtual === void 0 ? void 0 : virtual.listPadding) !== null && _b !== void 0 ? _b : 0, itemRender: (item, index, props, ancestry, children) => {
|
|
87
|
+
if (item.children) {
|
|
88
|
+
const isExpand = expands.has(item.id);
|
|
89
|
+
let isSelectedAncestry = false;
|
|
90
|
+
if (item.children && itemSelected) {
|
|
91
|
+
let node = itemSelected;
|
|
92
|
+
while (node.parent) {
|
|
93
|
+
node = node.parent;
|
|
94
|
+
if (node.id === item.id) {
|
|
95
|
+
isSelectedAncestry = true;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return (_createElement("li", Object.assign({}, styled('tree__group', {
|
|
101
|
+
'tree__group--root': props['aria-level'] === 1,
|
|
102
|
+
}), props, { key: item.id, role: "treeitem", "aria-expanded": isExpand, "aria-selected": item.checked, "aria-disabled": item.disabled }),
|
|
103
|
+
_jsxs("div", Object.assign({}, styled('tree__option', {
|
|
104
|
+
'tree__option.is-selected': !multiple && item.checked,
|
|
105
|
+
'tree__option.is-disabled': item.disabled,
|
|
106
|
+
'tree__option--root': props['aria-level'] === 1,
|
|
107
|
+
'tree__option--first': index === 0,
|
|
108
|
+
}), { id: itemId(item.id), title: item.origin.label, onClick: () => {
|
|
109
|
+
onNodeFocus(item);
|
|
110
|
+
if (multiple || onlyLeafSelectable) {
|
|
111
|
+
onNodeExpand(item);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
onNodeClick(item);
|
|
115
|
+
}
|
|
116
|
+
}, children: [focusVisible && (itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.id) === item.id && _jsx("div", { className: `${namespace}-focus-outline` }), isSelectedAncestry && _jsx("div", Object.assign({}, styled('tree__option-dot'))), _jsx("div", Object.assign({}, styled('tree__option-icon'), { onClick: (e) => {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
onNodeFocus(item);
|
|
119
|
+
onNodeExpand(item);
|
|
120
|
+
}, children: _jsx(Icon, { children: item.origin.loading ? (_jsx(CircularProgress, {})) : showLine ? (isExpand ? (_jsx(IndeterminateCheckBoxOutlined, {})) : (_jsx(AddBoxOutlined, {}))) : (_jsx(ArrowRightOutlined, Object.assign({}, styled('tree__option-arrow', {
|
|
121
|
+
'tree__option-arrow.is-expand': isExpand,
|
|
122
|
+
})))) }) })), multiple && (_jsx("div", Object.assign({}, styled('tree__option-checkbox'), { children: _jsx(Checkbox, { model: item.checked, disabled: item.disabled, indeterminate: item.indeterminate, inputRender: (el) => cloneElement(el, { tabIndex: -1 }), onClick: (e) => {
|
|
123
|
+
e.stopPropagation();
|
|
124
|
+
onNodeFocus(item);
|
|
125
|
+
onNodeClick(item);
|
|
126
|
+
} }) }))), _jsx("div", Object.assign({}, styled('tree__option-content'), { children: customItem ? customItem(item.origin) : item.origin.label }))] })),
|
|
127
|
+
!item.origin.loading && (_jsx(CollapseTransition, { originalSize: {
|
|
128
|
+
height: 'auto',
|
|
129
|
+
}, collapsedSize: {
|
|
130
|
+
height: 0,
|
|
131
|
+
}, enter: isExpand, during: TTANSITION_DURING_BASE, styles: {
|
|
132
|
+
entering: {
|
|
133
|
+
transition: ['height', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-out`).join(', '),
|
|
134
|
+
},
|
|
135
|
+
leaving: {
|
|
136
|
+
transition: ['height', 'padding', 'margin'].map((attr) => `${attr} ${TTANSITION_DURING_BASE}ms ease-in`).join(', '),
|
|
137
|
+
},
|
|
138
|
+
leaved: { display: 'none' },
|
|
139
|
+
}, children: (listRef, collapseStyle) => (_jsx("ul", Object.assign({}, mergeCS(styled('tree__group'), {
|
|
140
|
+
style: collapseStyle,
|
|
141
|
+
}), { ref: listRef, role: "group", "aria-labelledby": itemId(item.id), children: children }))) }))));
|
|
142
|
+
}
|
|
143
|
+
return (_createElement("li", Object.assign({}, styled('tree__option', {
|
|
144
|
+
'tree__option.is-selected': !multiple && item.checked,
|
|
145
|
+
'tree__option.is-disabled': item.disabled,
|
|
146
|
+
'tree__option--root': props['aria-level'] === 1,
|
|
147
|
+
'tree__option--first': index === 0,
|
|
148
|
+
}), props, { key: item.id, id: itemId(item.id), title: item.origin.label, role: "treeitem", "aria-selected": item.checked, "aria-disabled": item.disabled, onClick: () => {
|
|
149
|
+
onNodeFocus(item);
|
|
150
|
+
onNodeClick(item);
|
|
151
|
+
} }),
|
|
152
|
+
focusVisible && (itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.id) === item.id && _jsx("div", { className: `${namespace}-focus-outline` }),
|
|
153
|
+
multiple && (_jsx("div", Object.assign({}, styled('tree__option-checkbox'), { children: _jsx(Checkbox, { model: item.checked, disabled: item.disabled, indeterminate: item.indeterminate, inputRender: (el) => cloneElement(el, { tabIndex: -1 }), onClick: (e) => {
|
|
154
|
+
e.stopPropagation();
|
|
155
|
+
onNodeFocus(item);
|
|
156
|
+
onNodeClick(item);
|
|
157
|
+
} }) }))),
|
|
158
|
+
_jsx("div", Object.assign({}, styled('tree__option-content'), { children: customItem ? customItem(item.origin) : item.origin.label }))));
|
|
159
|
+
}, itemFocused: itemFocused === null || itemFocused === void 0 ? void 0 : itemFocused.id, itemEmptyRender: () => (_jsx("li", Object.assign({}, styled('tree__empty'), { children: _jsx("div", Object.assign({}, styled('tree__option-content'), { children: t('No Data') })) }))), itemInAriaSetsize: (item) => !item.children, placeholder: "li", onScrollEnd: onScrollBottom, children: (vsList, onScroll) => (_jsx("ul", Object.assign({}, restProps, mergeCS(styled('tree', {
|
|
160
|
+
'tree.is-disabled': disabled,
|
|
161
|
+
'tree--line': showLine,
|
|
162
|
+
}), {
|
|
163
|
+
className: restProps.className,
|
|
164
|
+
style: restProps.style,
|
|
165
|
+
}), { ref: listRef, role: "tree", "aria-multiselectable": multiple, "aria-activedescendant": isUndefined(itemFocused) ? undefined : itemId(itemFocused.id), onScroll: onScroll, children: list.length === 0 ? _jsx(Empty, { style: { padding: '12px 28px' }, image: Empty.SIMPLE_IMG }) : vsList }))) })));
|
|
166
|
+
}
|
|
167
|
+
export const TreePanel = forwardRef(TreePanelFC);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TreeNode, TreeNodeStatus } from './types';
|
|
3
|
+
export declare abstract class AbstractTreeNode<ID extends React.Key, T extends TreeNode> {
|
|
4
|
+
origin: T;
|
|
5
|
+
private _parent;
|
|
6
|
+
constructor(origin: T);
|
|
7
|
+
get parent(): AbstractTreeNode<ID, T> | null;
|
|
8
|
+
get root(): AbstractTreeNode<ID, T>;
|
|
9
|
+
get isLeaf(): boolean;
|
|
10
|
+
get id(): ID;
|
|
11
|
+
get status(): TreeNodeStatus;
|
|
12
|
+
get checked(): boolean;
|
|
13
|
+
get unchecked(): boolean;
|
|
14
|
+
get indeterminate(): boolean;
|
|
15
|
+
get disabled(): boolean;
|
|
16
|
+
get enabled(): boolean;
|
|
17
|
+
updateStatus(checked: ID | null | Set<ID>, onlySelf?: boolean): void;
|
|
18
|
+
protected _setParent(parent: AbstractTreeNode<ID, T>): void;
|
|
19
|
+
protected _updateAncestors(checked: ID | null | Set<ID>, onlySelf: boolean): void;
|
|
20
|
+
abstract children?: AbstractTreeNode<ID, T>[];
|
|
21
|
+
protected abstract _id: ID;
|
|
22
|
+
protected abstract _status: TreeNodeStatus;
|
|
23
|
+
protected abstract _disabled: boolean;
|
|
24
|
+
protected abstract _calculateStatus(checked: ID | null | Set<ID>): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CHECKED, INDETERMINATE, UNCHECKED } from './vars';
|
|
2
|
+
export class AbstractTreeNode {
|
|
3
|
+
constructor(origin) {
|
|
4
|
+
Object.defineProperty(this, "origin", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: origin
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(this, "_parent", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: null
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
get parent() {
|
|
18
|
+
return this._parent;
|
|
19
|
+
}
|
|
20
|
+
get root() {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
22
|
+
let node = this;
|
|
23
|
+
while (node.parent) {
|
|
24
|
+
node = node.parent;
|
|
25
|
+
}
|
|
26
|
+
return node;
|
|
27
|
+
}
|
|
28
|
+
get isLeaf() {
|
|
29
|
+
return !this.children;
|
|
30
|
+
}
|
|
31
|
+
get id() {
|
|
32
|
+
return this._id;
|
|
33
|
+
}
|
|
34
|
+
get status() {
|
|
35
|
+
return this._status;
|
|
36
|
+
}
|
|
37
|
+
get checked() {
|
|
38
|
+
return this._status === CHECKED;
|
|
39
|
+
}
|
|
40
|
+
get unchecked() {
|
|
41
|
+
return this._status === UNCHECKED;
|
|
42
|
+
}
|
|
43
|
+
get indeterminate() {
|
|
44
|
+
return this._status === INDETERMINATE;
|
|
45
|
+
}
|
|
46
|
+
get disabled() {
|
|
47
|
+
return this._disabled;
|
|
48
|
+
}
|
|
49
|
+
get enabled() {
|
|
50
|
+
return !this._disabled;
|
|
51
|
+
}
|
|
52
|
+
updateStatus(checked, onlySelf = false) {
|
|
53
|
+
if (this.children && !onlySelf) {
|
|
54
|
+
this.children.forEach((child) => {
|
|
55
|
+
child.updateStatus(checked, onlySelf);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
this._calculateStatus(checked);
|
|
59
|
+
}
|
|
60
|
+
_setParent(parent) {
|
|
61
|
+
this._parent = parent;
|
|
62
|
+
}
|
|
63
|
+
_updateAncestors(checked, onlySelf) {
|
|
64
|
+
if (this._parent && !onlySelf) {
|
|
65
|
+
this._parent.updateStatus(checked, onlySelf);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TreeNode, TreeNodeStatus } from './types';
|
|
3
|
+
import { AbstractTreeNode } from './abstract-node';
|
|
4
|
+
export declare class MultipleTreeNode<ID extends React.Key, T extends TreeNode> extends AbstractTreeNode<ID, T> {
|
|
5
|
+
private getId;
|
|
6
|
+
private opts;
|
|
7
|
+
children?: MultipleTreeNode<ID, T>[];
|
|
8
|
+
protected _id: ID;
|
|
9
|
+
protected _status: TreeNodeStatus;
|
|
10
|
+
protected _disabled: boolean;
|
|
11
|
+
constructor(origin: T, getId: (origin: T) => ID, opts: {
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
});
|
|
14
|
+
changeStatus(status: TreeNodeStatus, checkeds: Set<ID>): Set<ID>;
|
|
15
|
+
protected _calculateStatus(checkeds: Set<ID>): void;
|
|
16
|
+
protected _changeStatus(status: TreeNodeStatus, initValue: Set<ID>): Set<ID>;
|
|
17
|
+
private _setUpChildren;
|
|
18
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { AbstractTreeNode } from './abstract-node';
|
|
2
|
+
import { CHECKED, INDETERMINATE, UNCHECKED } from './vars';
|
|
3
|
+
export class MultipleTreeNode extends AbstractTreeNode {
|
|
4
|
+
constructor(origin, getId, opts) {
|
|
5
|
+
super(origin);
|
|
6
|
+
Object.defineProperty(this, "getId", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: getId
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "opts", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: opts
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "children", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "_id", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "_status", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "_disabled", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: void 0
|
|
41
|
+
});
|
|
42
|
+
this._id = getId(origin);
|
|
43
|
+
this._disabled = !!(opts.disabled || origin.disabled);
|
|
44
|
+
this._setUpChildren();
|
|
45
|
+
}
|
|
46
|
+
changeStatus(status, checkeds) {
|
|
47
|
+
const newCheckeds = this._changeStatus(status, checkeds);
|
|
48
|
+
return newCheckeds;
|
|
49
|
+
}
|
|
50
|
+
_calculateStatus(checkeds) {
|
|
51
|
+
if (this.children) {
|
|
52
|
+
let checkedNum = 0;
|
|
53
|
+
let hasIndeterminate = false;
|
|
54
|
+
let enabledLength = 0;
|
|
55
|
+
for (const child of this.children) {
|
|
56
|
+
if (child.enabled) {
|
|
57
|
+
enabledLength += 1;
|
|
58
|
+
}
|
|
59
|
+
if (child.checked) {
|
|
60
|
+
checkedNum += 1;
|
|
61
|
+
}
|
|
62
|
+
else if (child.enabled && child.indeterminate) {
|
|
63
|
+
hasIndeterminate = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this._status = hasIndeterminate
|
|
67
|
+
? INDETERMINATE
|
|
68
|
+
: checkedNum === 0
|
|
69
|
+
? UNCHECKED
|
|
70
|
+
: checkedNum === enabledLength
|
|
71
|
+
? CHECKED
|
|
72
|
+
: INDETERMINATE;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this._status = checkeds.has(this._id) ? CHECKED : UNCHECKED;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_changeStatus(status, initValue) {
|
|
79
|
+
let res = new Set(initValue);
|
|
80
|
+
if (this.enabled && this._status !== status) {
|
|
81
|
+
this._status = status;
|
|
82
|
+
if (this.children) {
|
|
83
|
+
this.children.forEach((child) => {
|
|
84
|
+
res = child._changeStatus(status, res);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
if (status === CHECKED) {
|
|
89
|
+
res.add(this._id);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
res.delete(this._id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return res;
|
|
97
|
+
}
|
|
98
|
+
_setUpChildren() {
|
|
99
|
+
if (this.origin.children) {
|
|
100
|
+
this.children = this.origin.children.map((child) => {
|
|
101
|
+
const node = new MultipleTreeNode(child, this.getId, Object.assign(this.opts, {
|
|
102
|
+
disabled: this._disabled,
|
|
103
|
+
}));
|
|
104
|
+
node._setParent(this);
|
|
105
|
+
return node;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TreeNode, TreeNodeStatus } from './types';
|
|
3
|
+
import { AbstractTreeNode } from './abstract-node';
|
|
4
|
+
export declare class SingleTreeNode<ID extends React.Key, T extends TreeNode> extends AbstractTreeNode<ID, T> {
|
|
5
|
+
private getId;
|
|
6
|
+
private opts;
|
|
7
|
+
children?: SingleTreeNode<ID, T>[];
|
|
8
|
+
protected _id: ID;
|
|
9
|
+
protected _status: TreeNodeStatus;
|
|
10
|
+
protected _disabled: boolean;
|
|
11
|
+
constructor(origin: T, getId: (origin: T) => ID, opts: {
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
});
|
|
14
|
+
private _setUpChildren;
|
|
15
|
+
protected _calculateStatus(checked: ID | null): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AbstractTreeNode } from './abstract-node';
|
|
2
|
+
import { CHECKED, UNCHECKED } from './vars';
|
|
3
|
+
export class SingleTreeNode extends AbstractTreeNode {
|
|
4
|
+
constructor(origin, getId, opts) {
|
|
5
|
+
super(origin);
|
|
6
|
+
Object.defineProperty(this, "getId", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: getId
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "opts", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: opts
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "children", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "_id", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "_status", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(this, "_disabled", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true,
|
|
40
|
+
value: void 0
|
|
41
|
+
});
|
|
42
|
+
this._id = getId(origin);
|
|
43
|
+
this._disabled = !!(opts.disabled || origin.disabled);
|
|
44
|
+
this._setUpChildren();
|
|
45
|
+
}
|
|
46
|
+
_setUpChildren() {
|
|
47
|
+
if (this.origin.children) {
|
|
48
|
+
this.children = this.origin.children.map((child) => {
|
|
49
|
+
const node = new SingleTreeNode(child, this.getId, Object.assign(this.opts, {
|
|
50
|
+
disabled: this._disabled,
|
|
51
|
+
}));
|
|
52
|
+
node._setParent(this);
|
|
53
|
+
return node;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_calculateStatus(checked) {
|
|
58
|
+
this._status = this.id === checked ? CHECKED : UNCHECKED;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const [INDETERMINATE, CHECKED, UNCHECKED] = ['INDETERMINATE', 'CHECKED', 'UNCHECKED'];
|
package/tree/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CLASSES } from './vars';
|
|
3
|
+
import type { FormControlProvider } from '../form/types';
|
|
4
|
+
import type { BaseProps } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export interface TreeItem<V extends React.Key> {
|
|
7
|
+
label: string;
|
|
8
|
+
value: V;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
children?: TreeItem<V>[];
|
|
12
|
+
}
|
|
13
|
+
export interface TreeProps<V extends React.Key, T extends TreeItem<V>> extends BaseProps<'tree', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLUListElement>, 'children'> {
|
|
14
|
+
formControl?: FormControlProvider;
|
|
15
|
+
list: T[];
|
|
16
|
+
model?: V | null | V[];
|
|
17
|
+
defaultModel?: V | null | V[];
|
|
18
|
+
expands?: V[];
|
|
19
|
+
defaultExpands?: V[];
|
|
20
|
+
showLine?: boolean;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
onlyLeafSelectable?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
virtual?: {
|
|
25
|
+
listSize: number;
|
|
26
|
+
listPadding: number;
|
|
27
|
+
itemSize?: number;
|
|
28
|
+
};
|
|
29
|
+
customItem?: (item: T) => React.ReactNode;
|
|
30
|
+
onModelChange?: (value: any, origin: any) => void;
|
|
31
|
+
onFirstExpand?: (value: V, origin: T) => void;
|
|
32
|
+
onExpandsChange?: (values: V[], origins: T[]) => void;
|
|
33
|
+
onScrollBottom?: () => void;
|
|
34
|
+
}
|
package/tree/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/tree/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AbstractTreeNode } from './node/abstract-node';
|
|
3
|
+
import type { TreeNode } from './node/types';
|
|
4
|
+
export declare function getTreeNodeLabel<V extends React.Key, T extends TreeNode & {
|
|
5
|
+
label: string;
|
|
6
|
+
}>(node: AbstractTreeNode<V, T>): string;
|
package/tree/utils.js
ADDED
package/tree/vars.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CLASSES: {
|
|
2
|
+
tree: string;
|
|
3
|
+
'tree.is-disabled': string;
|
|
4
|
+
'tree--line': string;
|
|
5
|
+
tree__group: string;
|
|
6
|
+
'tree__group--root': string;
|
|
7
|
+
tree__option: string;
|
|
8
|
+
'tree__option.is-selected': string;
|
|
9
|
+
'tree__option.is-disabled': string;
|
|
10
|
+
'tree__option--root': string;
|
|
11
|
+
'tree__option--first': string;
|
|
12
|
+
'tree__option-dot': string;
|
|
13
|
+
'tree__option-icon': string;
|
|
14
|
+
'tree__option-arrow': string;
|
|
15
|
+
'tree__option-arrow.is-expand': string;
|
|
16
|
+
'tree__option-checkbox': string;
|
|
17
|
+
'tree__option-content': string;
|
|
18
|
+
tree__empty: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const TREE_NODE_KEY: unique symbol;
|
package/tree/vars.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const CLASSES = {
|
|
2
|
+
tree: '^tree',
|
|
3
|
+
'tree.is-disabled': 'is-disabled',
|
|
4
|
+
'tree--line': '^tree--line',
|
|
5
|
+
tree__group: '^tree__group',
|
|
6
|
+
'tree__group--root': '^tree__group--root',
|
|
7
|
+
tree__option: '^tree__option',
|
|
8
|
+
'tree__option.is-selected': 'is-selected',
|
|
9
|
+
'tree__option.is-disabled': 'is-disabled',
|
|
10
|
+
'tree__option--root': '^tree__option--root',
|
|
11
|
+
'tree__option--first': '^tree__option--first',
|
|
12
|
+
'tree__option-dot': '^tree__option-dot',
|
|
13
|
+
'tree__option-icon': '^tree__option-icon',
|
|
14
|
+
'tree__option-arrow': '^tree__option-arrow',
|
|
15
|
+
'tree__option-arrow.is-expand': 'is-expand',
|
|
16
|
+
'tree__option-checkbox': '^tree__option-checkbox',
|
|
17
|
+
'tree__option-content': '^tree__option-content',
|
|
18
|
+
tree__empty: '^tree__empty',
|
|
19
|
+
};
|
|
20
|
+
export const TREE_NODE_KEY = Symbol();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TreeSelectProps, TreeSelectRef } from './types';
|
|
3
|
+
import type { TreeItem } from '../tree/types';
|
|
4
|
+
declare function TreeSelectFC<V extends React.Key, T extends TreeItem<V>>(props: TreeSelectProps<V, T>, ref: React.ForwardedRef<TreeSelectRef>): JSX.Element | null;
|
|
5
|
+
export declare const TreeSelect: <ID extends React.Key, T extends TreeItem<ID>>(props: TreeSelectProps<ID, T> & React.RefAttributes<TreeSelectRef>) => ReturnType<typeof TreeSelectFC>;
|
|
6
|
+
export {};
|