@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,43 @@
|
|
|
1
|
+
import { ROOT_DATA } from '../../root/vars';
|
|
2
|
+
export function getVerticalSidePosition(targetEl, popupSize, config) {
|
|
3
|
+
const { width, height } = popupSize;
|
|
4
|
+
const { placement, placementFixed = false, gap = 8, inWindow = false } = config;
|
|
5
|
+
const bound = inWindow === false ? 0 : inWindow;
|
|
6
|
+
const targetRect = targetEl.getBoundingClientRect();
|
|
7
|
+
const getPosition = (placement, defaultPosition) => {
|
|
8
|
+
let top = placement === 'top' || placement === 'top-left' || placement === 'top-right'
|
|
9
|
+
? targetRect.top - height - gap
|
|
10
|
+
: targetRect.top + targetRect.height + gap;
|
|
11
|
+
let left = placement === 'top' || placement === 'bottom'
|
|
12
|
+
? targetRect.left + (targetRect.width - width) / 2
|
|
13
|
+
: placement === 'top-left' || placement === 'bottom-left'
|
|
14
|
+
? targetRect.left
|
|
15
|
+
: targetRect.left + targetRect.width - width;
|
|
16
|
+
const inBound = [top, ROOT_DATA.windowSize.width - left - width, ROOT_DATA.windowSize.height - top - height, left].every((num) => num >= bound);
|
|
17
|
+
if (inWindow !== false) {
|
|
18
|
+
top = Math.min(Math.max(top, inWindow), ROOT_DATA.windowSize.height - height - inWindow);
|
|
19
|
+
}
|
|
20
|
+
if (inWindow !== false) {
|
|
21
|
+
left = Math.min(Math.max(left, inWindow), window.screen.availWidth - width - inWindow);
|
|
22
|
+
}
|
|
23
|
+
const transformOrigin = placement === 'top' || placement === 'top-left' || placement === 'top-right' ? 'center bottom' : 'center top';
|
|
24
|
+
const position = {
|
|
25
|
+
top,
|
|
26
|
+
left,
|
|
27
|
+
transformOrigin,
|
|
28
|
+
placement,
|
|
29
|
+
};
|
|
30
|
+
if (!placementFixed && !inBound) {
|
|
31
|
+
if (defaultPosition) {
|
|
32
|
+
return defaultPosition;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return getPosition(placement.includes('top')
|
|
36
|
+
? placement.replace('top', 'bottom')
|
|
37
|
+
: placement.replace('bottom', 'top'), position);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return position;
|
|
41
|
+
};
|
|
42
|
+
return getPosition(placement);
|
|
43
|
+
}
|
package/vars.d.ts
ADDED
package/vars.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { VirtualScrollProps, VirtualScrollRef } from './types';
|
|
3
|
+
declare function VirtualScrollFC<T>(props: VirtualScrollProps<T>, ref: React.ForwardedRef<VirtualScrollRef<T>>): JSX.Element | null;
|
|
4
|
+
export declare const VirtualScroll: <T>(props: VirtualScrollProps<T> & React.RefAttributes<VirtualScrollRef<T>>) => ReturnType<typeof VirtualScrollFC>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEventCallback } from '@laser-ui/hooks';
|
|
3
|
+
import { checkScrollEnd } from '@laser-ui/utils';
|
|
4
|
+
import { isBoolean, isNumber, isUndefined, nth } from 'lodash';
|
|
5
|
+
import { Fragment, createElement, forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { EMPTY } from './vars';
|
|
7
|
+
import { useComponentProps } from '../hooks';
|
|
8
|
+
function VirtualScrollFC(props, ref) {
|
|
9
|
+
const { children, enable = true, list, listSize, listPadding: listPaddingProp, itemKey, itemRender, itemSize: itemSizeProp, itemEmptySize: itemEmptySizeProp = 0, itemNested, itemEmptyRender, itemExpand, itemFocusable: itemFocusableProp = true, itemFocused, itemInAriaSetsize: itemInAriaSetsizeProp = true, placeholder, horizontal = false, onScrollEnd, } = useComponentProps('VirtualScroll', props);
|
|
10
|
+
const listPadding = isNumber(listPaddingProp) ? [listPaddingProp, listPaddingProp] : listPaddingProp;
|
|
11
|
+
const dataRef = useRef({
|
|
12
|
+
listCache: new Map(),
|
|
13
|
+
});
|
|
14
|
+
const [_scrollPosition, setScrollPosition] = useState(0);
|
|
15
|
+
const itemSize = useMemo(() => (isNumber(itemSizeProp) ? () => itemSizeProp : itemSizeProp), [itemSizeProp]);
|
|
16
|
+
const itemEmptySize = useMemo(() => (isNumber(itemEmptySizeProp) ? () => itemEmptySizeProp : itemEmptySizeProp), [itemEmptySizeProp]);
|
|
17
|
+
const itemFocusable = useMemo(() => (isBoolean(itemFocusableProp) ? () => itemFocusableProp : itemFocusableProp), [itemFocusableProp]);
|
|
18
|
+
const itemInAriaSetsize = useMemo(() => (isBoolean(itemInAriaSetsizeProp) ? () => itemInAriaSetsizeProp : itemInAriaSetsizeProp), [itemInAriaSetsizeProp]);
|
|
19
|
+
const [items, totalSize, firstFocusableItem, lastFocusableItem] = useMemo(() => {
|
|
20
|
+
const items = new Map();
|
|
21
|
+
let accSize = 0;
|
|
22
|
+
let totalSize = 0;
|
|
23
|
+
let firstFocusableItem;
|
|
24
|
+
let lastFocusableItem;
|
|
25
|
+
if (enable) {
|
|
26
|
+
const reduceArr = (arr, level = 0) => {
|
|
27
|
+
let size = 0;
|
|
28
|
+
for (const item of arr) {
|
|
29
|
+
if (itemFocusable(item)) {
|
|
30
|
+
lastFocusableItem = item;
|
|
31
|
+
if (isUndefined(firstFocusableItem)) {
|
|
32
|
+
firstFocusableItem = item;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const key = itemKey(item);
|
|
36
|
+
const _size = itemSize(item);
|
|
37
|
+
size += _size;
|
|
38
|
+
accSize += _size;
|
|
39
|
+
const data = { item, level, accSize, nestedSize: 0 };
|
|
40
|
+
items.set(key, data);
|
|
41
|
+
const nestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(item);
|
|
42
|
+
if (nestedData) {
|
|
43
|
+
const expand = itemExpand ? itemExpand(item) : true;
|
|
44
|
+
if (expand) {
|
|
45
|
+
if (nestedData.length === 0) {
|
|
46
|
+
data.nestedSize = itemEmptySize(item);
|
|
47
|
+
size += data.nestedSize;
|
|
48
|
+
accSize += data.nestedSize;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
data.nestedSize = reduceArr(nestedData, level + 1);
|
|
52
|
+
size += data.nestedSize;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return size;
|
|
58
|
+
};
|
|
59
|
+
totalSize = reduceArr(list);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const reduceArr = (arr, level = 0) => {
|
|
63
|
+
for (const item of arr) {
|
|
64
|
+
if (itemFocusable(item)) {
|
|
65
|
+
lastFocusableItem = item;
|
|
66
|
+
if (isUndefined(firstFocusableItem)) {
|
|
67
|
+
firstFocusableItem = item;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const key = itemKey(item);
|
|
71
|
+
const data = { item, level, accSize, nestedSize: 0 };
|
|
72
|
+
items.set(key, data);
|
|
73
|
+
const nestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(item);
|
|
74
|
+
if (nestedData) {
|
|
75
|
+
const expand = itemExpand ? itemExpand(item) : true;
|
|
76
|
+
if (expand) {
|
|
77
|
+
if (nestedData.length > 0) {
|
|
78
|
+
reduceArr(nestedData, level + 1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
reduceArr(list);
|
|
85
|
+
}
|
|
86
|
+
return [items, totalSize, firstFocusableItem, lastFocusableItem];
|
|
87
|
+
}, [enable, itemEmptySize, itemExpand, itemFocusable, itemKey, itemNested, itemSize, list]);
|
|
88
|
+
const vsList = (() => {
|
|
89
|
+
if (enable) {
|
|
90
|
+
const maxScrollSize = Math.max(totalSize + listPadding[0] + listPadding[1] - listSize, 0);
|
|
91
|
+
const scrollPosition = Math.min(_scrollPosition, maxScrollSize);
|
|
92
|
+
let totalAccSize = 0;
|
|
93
|
+
const startSize = scrollPosition - listSize - listPadding[0];
|
|
94
|
+
const endSize = scrollPosition + listSize * 2 - listPadding[0];
|
|
95
|
+
let hasStart = false;
|
|
96
|
+
let hasEnd = false;
|
|
97
|
+
const getList = (arr, ancestry = []) => {
|
|
98
|
+
var _a;
|
|
99
|
+
const fillSize = [0, 0];
|
|
100
|
+
const list = [];
|
|
101
|
+
const ariaSetsize = arr.filter((item) => {
|
|
102
|
+
if (item === EMPTY) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return itemInAriaSetsize(item);
|
|
106
|
+
}).length;
|
|
107
|
+
for (const [index, item] of arr.entries()) {
|
|
108
|
+
let size = 0;
|
|
109
|
+
let listNestedSize = 0;
|
|
110
|
+
let key;
|
|
111
|
+
let nestedData;
|
|
112
|
+
let emptyNode;
|
|
113
|
+
if (item === EMPTY) {
|
|
114
|
+
const parentNestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(ancestry[ancestry.length - 1]);
|
|
115
|
+
if (parentNestedData) {
|
|
116
|
+
size = itemEmptySize(ancestry[ancestry.length - 1]);
|
|
117
|
+
emptyNode = _jsx(Fragment, { children: itemEmptyRender === null || itemEmptyRender === void 0 ? void 0 : itemEmptyRender(ancestry[ancestry.length - 1]) }, "$$empty");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
key = itemKey(item);
|
|
122
|
+
size = itemSize(item);
|
|
123
|
+
nestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(item);
|
|
124
|
+
if (nestedData) {
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
126
|
+
listNestedSize = items.get(key).nestedSize;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (hasEnd) {
|
|
130
|
+
fillSize[1] += size + listNestedSize;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
totalAccSize += size;
|
|
134
|
+
if (nestedData) {
|
|
135
|
+
if (totalAccSize + listNestedSize > startSize) {
|
|
136
|
+
const expand = itemExpand ? itemExpand(item) : undefined;
|
|
137
|
+
let childrenList = [];
|
|
138
|
+
if (isUndefined(expand)) {
|
|
139
|
+
childrenList = getList(nestedData.length === 0 ? [EMPTY] : nestedData, ancestry.concat([item]));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
childrenList = (_a = dataRef.current.listCache.get(key)) !== null && _a !== void 0 ? _a : [];
|
|
143
|
+
if (expand) {
|
|
144
|
+
childrenList = getList(nestedData.length === 0 ? [EMPTY] : nestedData, ancestry.concat([item]));
|
|
145
|
+
dataRef.current.listCache.set(key, childrenList);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
list.push(itemRender(item, index, {
|
|
149
|
+
'aria-level': ancestry.length + 1,
|
|
150
|
+
'aria-setsize': ariaSetsize,
|
|
151
|
+
'aria-posinset': index + 1,
|
|
152
|
+
}, ancestry, childrenList));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
totalAccSize += listNestedSize;
|
|
156
|
+
fillSize[0] += size + listNestedSize;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else if (!hasStart) {
|
|
160
|
+
if (totalAccSize > startSize) {
|
|
161
|
+
list.push(item === EMPTY
|
|
162
|
+
? emptyNode
|
|
163
|
+
: itemRender(item, index, {
|
|
164
|
+
'aria-level': ancestry.length + 1,
|
|
165
|
+
'aria-setsize': ariaSetsize,
|
|
166
|
+
'aria-posinset': index + 1,
|
|
167
|
+
}, ancestry));
|
|
168
|
+
hasStart = true;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
fillSize[0] += size;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (!hasEnd) {
|
|
175
|
+
if (totalAccSize > endSize) {
|
|
176
|
+
hasEnd = true;
|
|
177
|
+
fillSize[1] += size;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
list.push(item === EMPTY
|
|
181
|
+
? emptyNode
|
|
182
|
+
: itemRender(item, index, {
|
|
183
|
+
'aria-level': ancestry.length + 1,
|
|
184
|
+
'aria-setsize': ariaSetsize,
|
|
185
|
+
'aria-posinset': index + 1,
|
|
186
|
+
}, ancestry));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (fillSize[0] > 0) {
|
|
191
|
+
list.unshift(createElement(placeholder, {
|
|
192
|
+
key: '$$fill-size-0',
|
|
193
|
+
style: {
|
|
194
|
+
display: horizontal ? 'inline-block' : 'block',
|
|
195
|
+
overflow: 'hidden',
|
|
196
|
+
width: horizontal ? fillSize[0] : 0,
|
|
197
|
+
height: horizontal ? 0 : fillSize[0],
|
|
198
|
+
flexShrink: 0,
|
|
199
|
+
},
|
|
200
|
+
'aria-hidden': true,
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
if (fillSize[1] > 0) {
|
|
204
|
+
list.push(createElement(placeholder, {
|
|
205
|
+
key: '$$fill-size-1',
|
|
206
|
+
style: {
|
|
207
|
+
display: horizontal ? 'inline-block' : 'block',
|
|
208
|
+
overflow: 'hidden',
|
|
209
|
+
width: horizontal ? fillSize[1] : 0,
|
|
210
|
+
height: horizontal ? 0 : fillSize[1],
|
|
211
|
+
flexShrink: 0,
|
|
212
|
+
},
|
|
213
|
+
'aria-hidden': true,
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
return list;
|
|
217
|
+
};
|
|
218
|
+
return getList(list);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const getList = (arr, ancestry = []) => {
|
|
222
|
+
var _a;
|
|
223
|
+
const list = [];
|
|
224
|
+
const ariaSetsize = arr.filter((item) => {
|
|
225
|
+
if (item === EMPTY) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
return itemInAriaSetsize(item);
|
|
229
|
+
}).length;
|
|
230
|
+
for (const [index, item] of arr.entries()) {
|
|
231
|
+
let key;
|
|
232
|
+
let nestedData;
|
|
233
|
+
let emptyNode;
|
|
234
|
+
if (item === EMPTY) {
|
|
235
|
+
const parentNestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(ancestry[ancestry.length - 1]);
|
|
236
|
+
if (parentNestedData) {
|
|
237
|
+
emptyNode = _jsx(Fragment, { children: itemEmptyRender === null || itemEmptyRender === void 0 ? void 0 : itemEmptyRender(ancestry[ancestry.length - 1]) }, "$$empty");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
key = itemKey(item);
|
|
242
|
+
nestedData = itemNested === null || itemNested === void 0 ? void 0 : itemNested(item);
|
|
243
|
+
}
|
|
244
|
+
if (nestedData) {
|
|
245
|
+
const expand = itemExpand ? itemExpand(item) : undefined;
|
|
246
|
+
let childrenList = [];
|
|
247
|
+
if (isUndefined(expand)) {
|
|
248
|
+
childrenList = getList(nestedData.length === 0 ? [EMPTY] : nestedData, ancestry.concat([item]));
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
childrenList = (_a = dataRef.current.listCache.get(key)) !== null && _a !== void 0 ? _a : [];
|
|
252
|
+
if (expand) {
|
|
253
|
+
childrenList = getList(nestedData.length === 0 ? [EMPTY] : nestedData, ancestry.concat([item]));
|
|
254
|
+
dataRef.current.listCache.set(key, childrenList);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
list.push(itemRender(item, index, {
|
|
258
|
+
'aria-level': ancestry.length + 1,
|
|
259
|
+
'aria-setsize': ariaSetsize,
|
|
260
|
+
'aria-posinset': index + 1,
|
|
261
|
+
}, ancestry, childrenList));
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
list.push(item === EMPTY
|
|
265
|
+
? emptyNode
|
|
266
|
+
: itemRender(item, index, {
|
|
267
|
+
'aria-level': ancestry.length + 1,
|
|
268
|
+
'aria-setsize': ariaSetsize,
|
|
269
|
+
'aria-posinset': index + 1,
|
|
270
|
+
}, ancestry));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return list;
|
|
274
|
+
};
|
|
275
|
+
return getList(list);
|
|
276
|
+
}
|
|
277
|
+
})();
|
|
278
|
+
const scrollTo = (el, num) => {
|
|
279
|
+
el[horizontal ? 'scrollLeft' : 'scrollTop'] = num;
|
|
280
|
+
};
|
|
281
|
+
const scrollToItem = useEventCallback((el, key) => {
|
|
282
|
+
const findItem = items.get(key);
|
|
283
|
+
if (enable && !isUndefined(findItem)) {
|
|
284
|
+
scrollTo(el, findItem.accSize - itemSize(findItem.item) + listPadding[0]);
|
|
285
|
+
}
|
|
286
|
+
return findItem === null || findItem === void 0 ? void 0 : findItem.item;
|
|
287
|
+
});
|
|
288
|
+
const scrollToStart = useEventCallback((el) => {
|
|
289
|
+
if (enable) {
|
|
290
|
+
scrollTo(el, 0);
|
|
291
|
+
}
|
|
292
|
+
return firstFocusableItem;
|
|
293
|
+
});
|
|
294
|
+
const scrollToEnd = useEventCallback((el) => {
|
|
295
|
+
if (enable) {
|
|
296
|
+
scrollTo(el, el[horizontal ? 'scrollWidth' : 'scrollHeight']);
|
|
297
|
+
}
|
|
298
|
+
return lastFocusableItem;
|
|
299
|
+
});
|
|
300
|
+
const scrollToStep = useEventCallback((el, step) => {
|
|
301
|
+
if (isUndefined(itemFocused)) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
let findItem;
|
|
305
|
+
let offsetSize;
|
|
306
|
+
let index = -1;
|
|
307
|
+
let findIndex = -1;
|
|
308
|
+
const accSizeList = [];
|
|
309
|
+
for (const iterator of items) {
|
|
310
|
+
index += 1;
|
|
311
|
+
if (iterator[0] === itemFocused) {
|
|
312
|
+
findIndex = index;
|
|
313
|
+
}
|
|
314
|
+
accSizeList.push(iterator[1]);
|
|
315
|
+
}
|
|
316
|
+
if (findIndex !== -1) {
|
|
317
|
+
if (step === 1) {
|
|
318
|
+
for (let index = findIndex + 1, n = 0; n < accSizeList.length; index++, n++) {
|
|
319
|
+
const accSizeItem = nth(accSizeList, index % accSizeList.length);
|
|
320
|
+
if (accSizeItem && itemFocusable(accSizeItem.item)) {
|
|
321
|
+
findItem = accSizeItem.item;
|
|
322
|
+
if (enable) {
|
|
323
|
+
offsetSize = [accSizeItem.accSize - itemSize(findItem) + listPadding[0], accSizeItem.accSize + listPadding[0]];
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
for (let index = findIndex - 1, n = 0; n < accSizeList.length; index--, n++) {
|
|
331
|
+
const accSizeItem = nth(accSizeList, index);
|
|
332
|
+
if (accSizeItem && itemFocusable(accSizeItem.item)) {
|
|
333
|
+
findItem = accSizeItem.item;
|
|
334
|
+
if (enable) {
|
|
335
|
+
offsetSize = [accSizeItem.accSize - itemSize(findItem) + listPadding[0], accSizeItem.accSize + listPadding[0]];
|
|
336
|
+
}
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (!isUndefined(offsetSize)) {
|
|
343
|
+
const listElScrollPosition = el[horizontal ? 'scrollLeft' : 'scrollTop'];
|
|
344
|
+
const listElClientSize = el[horizontal ? 'clientWidth' : 'clientHeight'];
|
|
345
|
+
if (listElScrollPosition > offsetSize[1]) {
|
|
346
|
+
scrollTo(el, offsetSize[0] - listPadding[0]);
|
|
347
|
+
}
|
|
348
|
+
else if (offsetSize[0] > listElScrollPosition + listElClientSize) {
|
|
349
|
+
scrollTo(el, offsetSize[1] - listElClientSize + listPadding[0]);
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
if (step === 1) {
|
|
353
|
+
if (offsetSize[1] > listElScrollPosition + listElClientSize) {
|
|
354
|
+
scrollTo(el, offsetSize[1] - listElClientSize + listPadding[0]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
if (listElScrollPosition > offsetSize[0]) {
|
|
359
|
+
scrollTo(el, offsetSize[0] - listPadding[0]);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return findItem;
|
|
365
|
+
});
|
|
366
|
+
const scrollToNested = useEventCallback((el) => {
|
|
367
|
+
if (isUndefined(itemFocused)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
let findItem;
|
|
371
|
+
let offsetSize;
|
|
372
|
+
let index = -1;
|
|
373
|
+
let findIndex = -1;
|
|
374
|
+
let level = 0;
|
|
375
|
+
const accSizeList = [];
|
|
376
|
+
for (const iterator of items) {
|
|
377
|
+
index += 1;
|
|
378
|
+
if (iterator[0] === itemFocused) {
|
|
379
|
+
findIndex = index;
|
|
380
|
+
level = iterator[1].level;
|
|
381
|
+
}
|
|
382
|
+
accSizeList.push(iterator[1]);
|
|
383
|
+
}
|
|
384
|
+
if (findIndex !== -1) {
|
|
385
|
+
for (let index = findIndex + 1; index < accSizeList.length; index++) {
|
|
386
|
+
const accSizeItem = accSizeList[index];
|
|
387
|
+
if (accSizeItem.level <= level) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (itemFocusable(accSizeItem.item)) {
|
|
391
|
+
findItem = accSizeItem.item;
|
|
392
|
+
if (enable) {
|
|
393
|
+
offsetSize = [accSizeItem.accSize - itemSize(findItem) + listPadding[0], accSizeItem.accSize + listPadding[0]];
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!isUndefined(offsetSize)) {
|
|
400
|
+
const listElScrollPosition = el[horizontal ? 'scrollLeft' : 'scrollTop'];
|
|
401
|
+
const listElClientSize = el[horizontal ? 'clientWidth' : 'clientHeight'];
|
|
402
|
+
if (listElScrollPosition > offsetSize[1]) {
|
|
403
|
+
scrollTo(el, offsetSize[0] - listPadding[0]);
|
|
404
|
+
}
|
|
405
|
+
else if (offsetSize[0] > listElScrollPosition + listElClientSize) {
|
|
406
|
+
scrollTo(el, offsetSize[1] - listElClientSize + listPadding[0]);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
if (offsetSize[1] > listElScrollPosition + listElClientSize) {
|
|
410
|
+
scrollTo(el, offsetSize[1] - listElClientSize + listPadding[0]);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return findItem;
|
|
415
|
+
});
|
|
416
|
+
useImperativeHandle(ref, () => ({
|
|
417
|
+
scrollToItem,
|
|
418
|
+
scrollToStep,
|
|
419
|
+
scrollToNested,
|
|
420
|
+
scrollToStart,
|
|
421
|
+
scrollToEnd,
|
|
422
|
+
}), [scrollToItem, scrollToStep, scrollToNested, scrollToStart, scrollToEnd]);
|
|
423
|
+
return children(vsList, (e) => {
|
|
424
|
+
setScrollPosition(e.currentTarget[horizontal ? 'scrollLeft' : 'scrollTop']);
|
|
425
|
+
if (checkScrollEnd(e.currentTarget)[horizontal ? 'x' : 'y']) {
|
|
426
|
+
onScrollEnd === null || onScrollEnd === void 0 ? void 0 : onScrollEnd();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
export const VirtualScroll = forwardRef(VirtualScrollFC);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VirtualScroll } from './VirtualScroll';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export {};
|
|
3
|
+
export type VirtualScrollOptimization<T = any> = Pick<VirtualScrollProps<T>, 'list' | 'itemKey' | 'itemSize' | 'itemEmptySize' | 'itemNested' | 'itemFocusable' | 'itemExpand'>;
|
|
4
|
+
export interface VirtualScrollRef<T> {
|
|
5
|
+
scrollToItem: (el: HTMLElement, key: React.Key) => T | undefined;
|
|
6
|
+
scrollToStep: (el: HTMLElement, step: 1 | -1) => T | undefined;
|
|
7
|
+
scrollToNested: (el: HTMLElement) => T | undefined;
|
|
8
|
+
scrollToStart: (el: HTMLElement) => T | undefined;
|
|
9
|
+
scrollToEnd: (el: HTMLElement) => T | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface VirtualScrollProps<T> {
|
|
12
|
+
children: (vsList: React.ReactNode, onScroll: React.UIEventHandler<HTMLElement>) => JSX.Element | null;
|
|
13
|
+
enable?: boolean;
|
|
14
|
+
list: T[];
|
|
15
|
+
listSize: number;
|
|
16
|
+
listPadding: number | [number, number];
|
|
17
|
+
itemKey: (item: T) => React.Key;
|
|
18
|
+
itemRender: (item: T, index: number, props: {
|
|
19
|
+
'aria-level': number;
|
|
20
|
+
'aria-setsize': number;
|
|
21
|
+
'aria-posinset': number;
|
|
22
|
+
}, ancestry: T[], children?: React.ReactNode) => React.ReactNode;
|
|
23
|
+
itemSize: number | ((item: T) => number);
|
|
24
|
+
itemEmptySize?: number | ((item: T) => number);
|
|
25
|
+
itemNested?: (item: T) => T[] | undefined;
|
|
26
|
+
itemEmptyRender?: (item: T) => React.ReactNode;
|
|
27
|
+
itemExpand?: (item: T) => boolean | undefined;
|
|
28
|
+
itemFocusable?: boolean | ((item: T) => boolean);
|
|
29
|
+
itemFocused?: React.Key;
|
|
30
|
+
itemInAriaSetsize?: boolean | ((item: T) => boolean);
|
|
31
|
+
placeholder: string;
|
|
32
|
+
horizontal?: boolean;
|
|
33
|
+
onScrollEnd?: () => void;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EMPTY: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const EMPTY = Symbol();
|