@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,165 @@
|
|
|
1
|
+
import { AbstractControl } from './abstract-control';
|
|
2
|
+
import { VALID } from './vars';
|
|
3
|
+
function find(control, path, delimiter) {
|
|
4
|
+
if (path == null)
|
|
5
|
+
return null;
|
|
6
|
+
if (!Array.isArray(path)) {
|
|
7
|
+
path = path.split(delimiter);
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(path) && path.length === 0)
|
|
10
|
+
return null;
|
|
11
|
+
// Not using Array.reduce here due to a Chrome 80 bug
|
|
12
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
|
|
13
|
+
let controlToFind = control;
|
|
14
|
+
path.forEach((name) => {
|
|
15
|
+
if (controlToFind instanceof FormGroup) {
|
|
16
|
+
controlToFind = name in controlToFind.controls ? controlToFind.controls[name] : null;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
controlToFind = null;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return controlToFind;
|
|
23
|
+
}
|
|
24
|
+
export class FormGroup extends AbstractControl {
|
|
25
|
+
constructor(controls, validators, asyncValidator) {
|
|
26
|
+
super(validators !== null && validators !== void 0 ? validators : null, asyncValidator !== null && asyncValidator !== void 0 ? asyncValidator : null);
|
|
27
|
+
Object.defineProperty(this, "controls", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: controls
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(this, "_value", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(this, "_status", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
writable: true,
|
|
43
|
+
value: VALID
|
|
44
|
+
});
|
|
45
|
+
this._setUpControls();
|
|
46
|
+
this.updateValueAndValidity(true);
|
|
47
|
+
}
|
|
48
|
+
get(path) {
|
|
49
|
+
return find(this, path, '.');
|
|
50
|
+
}
|
|
51
|
+
getError(errorCode, path) {
|
|
52
|
+
const control = path ? this.get(path) : this;
|
|
53
|
+
return control && control.errors ? control.errors[errorCode] : null;
|
|
54
|
+
}
|
|
55
|
+
hasError(errorCode, path) {
|
|
56
|
+
return !!this.getError(errorCode, path);
|
|
57
|
+
}
|
|
58
|
+
addControl(name, control) {
|
|
59
|
+
if (!(name in this.controls)) {
|
|
60
|
+
this.controls[name] = control;
|
|
61
|
+
control.setParent(this);
|
|
62
|
+
}
|
|
63
|
+
this.updateValueAndValidity();
|
|
64
|
+
}
|
|
65
|
+
removeControl(name) {
|
|
66
|
+
delete this.controls[name];
|
|
67
|
+
this.updateValueAndValidity();
|
|
68
|
+
}
|
|
69
|
+
setControl(name, control) {
|
|
70
|
+
delete this.controls[name];
|
|
71
|
+
this.addControl(name, control);
|
|
72
|
+
this.updateValueAndValidity();
|
|
73
|
+
}
|
|
74
|
+
contains(controlName) {
|
|
75
|
+
return controlName in this.controls;
|
|
76
|
+
}
|
|
77
|
+
setValue(value, onlySelf) {
|
|
78
|
+
this._checkAllValuesPresent(value);
|
|
79
|
+
Object.keys(value).forEach((name) => {
|
|
80
|
+
this._throwIfControlMissing(name);
|
|
81
|
+
this.controls[name].setValue(value[name], true);
|
|
82
|
+
});
|
|
83
|
+
this.updateValueAndValidity(onlySelf);
|
|
84
|
+
}
|
|
85
|
+
patchValue(value, onlySelf) {
|
|
86
|
+
Object.keys(value).forEach((name) => {
|
|
87
|
+
if (this.controls[name]) {
|
|
88
|
+
this.controls[name].patchValue(value[name], true);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
this.updateValueAndValidity(onlySelf);
|
|
92
|
+
}
|
|
93
|
+
reset(value = {}, onlySelf) {
|
|
94
|
+
this._forEachChild((control, name) => {
|
|
95
|
+
control.reset(value[name], true);
|
|
96
|
+
});
|
|
97
|
+
this._updatePristine(onlySelf);
|
|
98
|
+
this.updateValueAndValidity(onlySelf);
|
|
99
|
+
}
|
|
100
|
+
_updateValue() {
|
|
101
|
+
this._value = this._reduceValue();
|
|
102
|
+
}
|
|
103
|
+
_forEachChild(cb) {
|
|
104
|
+
Object.keys(this.controls).forEach((key) => {
|
|
105
|
+
// The list of controls can change (for ex. controls might be removed) while the loop
|
|
106
|
+
// is running (as a result of invoking Forms API in `valueChanges` subscription), so we
|
|
107
|
+
// have to null check before invoking the callback.
|
|
108
|
+
const control = this.controls[key];
|
|
109
|
+
control && cb(control, key);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
_anyControls(condition) {
|
|
113
|
+
for (const controlName of Object.keys(this.controls)) {
|
|
114
|
+
const control = this.controls[controlName];
|
|
115
|
+
if (this.contains(controlName) && condition(control)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
_allControlsDisabled() {
|
|
122
|
+
for (const controlName of Object.keys(this.controls)) {
|
|
123
|
+
if (this.controls[controlName].enabled) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return Object.keys(this.controls).length > 0 || this.disabled;
|
|
128
|
+
}
|
|
129
|
+
_setUpControls() {
|
|
130
|
+
this._forEachChild((control) => {
|
|
131
|
+
control.setParent(this);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
_reduceValue() {
|
|
135
|
+
return this._reduceChildren({}, (acc, control, name) => {
|
|
136
|
+
acc[name] = control.value;
|
|
137
|
+
return acc;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
_reduceChildren(initValue, fn) {
|
|
141
|
+
let res = initValue;
|
|
142
|
+
this._forEachChild((control, name) => {
|
|
143
|
+
res = fn(res, control, name);
|
|
144
|
+
});
|
|
145
|
+
return res;
|
|
146
|
+
}
|
|
147
|
+
_checkAllValuesPresent(value) {
|
|
148
|
+
this._forEachChild((control, name) => {
|
|
149
|
+
if (value[name] === undefined) {
|
|
150
|
+
throw new Error(`Must supply a value for form control with name: '${name}'.`);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
_throwIfControlMissing(name) {
|
|
155
|
+
if (!Object.keys(this.controls).length) {
|
|
156
|
+
throw new Error(`
|
|
157
|
+
There are no form controls registered with this group yet. If you're using ngModel,
|
|
158
|
+
you may want to check next tick (e.g. use setTimeout).
|
|
159
|
+
`);
|
|
160
|
+
}
|
|
161
|
+
if (!this.controls[name]) {
|
|
162
|
+
throw new Error(`Cannot find form control with name: ${name}.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AbstractControl } from './abstract-control';
|
|
2
|
+
export {};
|
|
3
|
+
export type FormControlStatus = 'VALID' | 'INVALID' | 'PENDING' | 'DISABLED';
|
|
4
|
+
export interface ValidationErrors {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export type ValidatorFn = (control: AbstractControl) => ValidationErrors | null;
|
|
8
|
+
export type AsyncValidatorFn = (control: AbstractControl) => Promise<ValidationErrors | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AbstractControl } from './abstract-control';
|
|
2
|
+
import type { ValidationErrors, ValidatorFn } from './types';
|
|
3
|
+
export declare class Validators {
|
|
4
|
+
static min(min: number): ValidatorFn;
|
|
5
|
+
static max(max: number): ValidatorFn;
|
|
6
|
+
static required(control: AbstractControl): ValidationErrors | null;
|
|
7
|
+
static email(control: AbstractControl): ValidationErrors | null;
|
|
8
|
+
static minLength(minLength: number): ValidatorFn;
|
|
9
|
+
static maxLength(maxLength: number): ValidatorFn;
|
|
10
|
+
static pattern(pattern: string | RegExp): ValidatorFn;
|
|
11
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isArray, isNull, isNumber, isString } from 'lodash';
|
|
2
|
+
export class Validators {
|
|
3
|
+
static min(min) {
|
|
4
|
+
return (control) => {
|
|
5
|
+
if (isString(control.value) || isNumber(control.value)) {
|
|
6
|
+
const value = Number(control.value);
|
|
7
|
+
if (Number.isNaN(value)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return value < min ? { min: { min, actual: control.value } } : null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
static max(max) {
|
|
18
|
+
return (control) => {
|
|
19
|
+
if (isString(control.value) || isNumber(control.value)) {
|
|
20
|
+
const value = Number(control.value);
|
|
21
|
+
if (Number.isNaN(value)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return value > max ? { max: { max, actual: control.value } } : null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static required(control) {
|
|
32
|
+
const isEmpty = isArray(control.value) || isString(control.value) ? control.value.length === 0 : isNull(control.value) ? true : false;
|
|
33
|
+
return isEmpty ? { required: true } : null;
|
|
34
|
+
}
|
|
35
|
+
static email(control) {
|
|
36
|
+
if (isString(control.value) &&
|
|
37
|
+
!/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(control.value)) {
|
|
38
|
+
return { email: true };
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
static minLength(minLength) {
|
|
43
|
+
return (control) => {
|
|
44
|
+
if ((isArray(control.value) || isString(control.value)) && control.value.length < minLength) {
|
|
45
|
+
return { minLength: { minLength, actual: control.value.length } };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
static maxLength(maxLength) {
|
|
51
|
+
return (control) => {
|
|
52
|
+
if ((isArray(control.value) || isString(control.value)) && control.value.length > maxLength) {
|
|
53
|
+
return { maxLength: { maxLength, actual: control.value.length } };
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static pattern(pattern) {
|
|
59
|
+
if (!pattern)
|
|
60
|
+
return () => null;
|
|
61
|
+
let regex;
|
|
62
|
+
let regexStr;
|
|
63
|
+
if (isString(pattern)) {
|
|
64
|
+
regexStr = '';
|
|
65
|
+
if (pattern.charAt(0) !== '^')
|
|
66
|
+
regexStr += '^';
|
|
67
|
+
regexStr += pattern;
|
|
68
|
+
if (pattern.charAt(pattern.length - 1) !== '$')
|
|
69
|
+
regexStr += '$';
|
|
70
|
+
regex = new RegExp(regexStr);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
regexStr = pattern.toString();
|
|
74
|
+
regex = pattern;
|
|
75
|
+
}
|
|
76
|
+
return (control) => {
|
|
77
|
+
if ((isString(control.value) || isNumber(control.value)) && !regex.test(control.value.toString())) {
|
|
78
|
+
return { pattern: { pattern: regexStr, actual: control.value } };
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VALID: "VALID", INVALID: "INVALID", PENDING: "PENDING", DISABLED: "DISABLED";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const [VALID, INVALID, PENDING, DISABLED] = ['VALID', 'INVALID', 'PENDING', 'DISABLED'];
|
package/form/types.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AbstractControl } from './model/abstract-control';
|
|
3
|
+
import type { CLASSES } from './vars';
|
|
4
|
+
import type { BaseProps, Size } from '../types';
|
|
5
|
+
export {};
|
|
6
|
+
export type FormErrors = string | {
|
|
7
|
+
message: string;
|
|
8
|
+
invalid: 'warning' | 'error';
|
|
9
|
+
} | {
|
|
10
|
+
[index: string]: string | {
|
|
11
|
+
message: string;
|
|
12
|
+
invalid: 'warning' | 'error';
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export interface FormControlProvider {
|
|
16
|
+
control: AbstractControl;
|
|
17
|
+
invalid: 'warning' | 'error' | false;
|
|
18
|
+
inputAria: {
|
|
19
|
+
'aria-invalid'?: boolean;
|
|
20
|
+
'aria-describedby'?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface FormContextData {
|
|
24
|
+
vertical: boolean;
|
|
25
|
+
labelWidth: number | string | undefined;
|
|
26
|
+
labelColon: boolean;
|
|
27
|
+
requiredType: 'required' | 'optional' | 'hidden';
|
|
28
|
+
feedbackIcon: boolean | {
|
|
29
|
+
success?: React.ReactNode;
|
|
30
|
+
warning?: React.ReactNode;
|
|
31
|
+
error?: React.ReactNode;
|
|
32
|
+
pending?: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface FormProps extends BaseProps<'form', typeof CLASSES>, React.FormHTMLAttributes<HTMLFormElement> {
|
|
36
|
+
vertical?: boolean;
|
|
37
|
+
labelWidth?: number | string;
|
|
38
|
+
labelColon?: boolean;
|
|
39
|
+
requiredType?: 'required' | 'optional' | 'hidden';
|
|
40
|
+
feedbackIcon?: boolean | {
|
|
41
|
+
success?: React.ReactNode;
|
|
42
|
+
warning?: React.ReactNode;
|
|
43
|
+
error?: React.ReactNode;
|
|
44
|
+
pending?: React.ReactNode;
|
|
45
|
+
};
|
|
46
|
+
size?: Size;
|
|
47
|
+
}
|
|
48
|
+
export interface FormItemProps<T extends {
|
|
49
|
+
[index: string]: FormErrors;
|
|
50
|
+
}> extends BaseProps<'form', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
51
|
+
children: React.ReactNode | ((formControls: {
|
|
52
|
+
[N in keyof T]: FormControlProvider;
|
|
53
|
+
}) => React.ReactNode);
|
|
54
|
+
formControls?: T;
|
|
55
|
+
label?: React.ReactNode;
|
|
56
|
+
labelWidth?: number | string;
|
|
57
|
+
labelExtra?: {
|
|
58
|
+
title: string;
|
|
59
|
+
icon?: React.ReactElement;
|
|
60
|
+
} | string;
|
|
61
|
+
labelFor?: string;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
}
|
package/form/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/form/vars.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FormGroup } from './model/form-group';
|
|
3
|
+
import type { FormContextData } from './types';
|
|
4
|
+
export declare const CLASSES: {
|
|
5
|
+
form: string;
|
|
6
|
+
'form--small': string;
|
|
7
|
+
'form--medium': string;
|
|
8
|
+
'form--large': string;
|
|
9
|
+
form__row: string;
|
|
10
|
+
form__item: string;
|
|
11
|
+
'form__item-container': string;
|
|
12
|
+
'form__item-label-wrapper': string;
|
|
13
|
+
'form__item-label': string;
|
|
14
|
+
'form__item-label--auto': string;
|
|
15
|
+
'form__item-label--required': string;
|
|
16
|
+
'form__item-label--colon': string;
|
|
17
|
+
'form__item-label-extra': string;
|
|
18
|
+
'form__item-content': string;
|
|
19
|
+
'form__item-control': string;
|
|
20
|
+
'form__item-feedback-icon': string;
|
|
21
|
+
'form__error-container': string;
|
|
22
|
+
form__error: string;
|
|
23
|
+
'form__error--error': string;
|
|
24
|
+
'form__error--warning': string;
|
|
25
|
+
};
|
|
26
|
+
export declare const FormContext: import("react").Context<FormContextData>;
|
|
27
|
+
export declare const FormGroupContext: import("react").Context<FormGroup<any>>;
|
package/form/vars.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const CLASSES = {
|
|
3
|
+
form: '^form',
|
|
4
|
+
'form--small': '^form--small',
|
|
5
|
+
'form--medium': '^form--medium',
|
|
6
|
+
'form--large': '^form--large',
|
|
7
|
+
form__row: '^form__row',
|
|
8
|
+
form__item: '^form__item',
|
|
9
|
+
'form__item-container': '^form__item-container',
|
|
10
|
+
'form__item-label-wrapper': '^form__item-label-wrapper',
|
|
11
|
+
'form__item-label': '^form__item-label',
|
|
12
|
+
'form__item-label--auto': '^form__item-label--auto',
|
|
13
|
+
'form__item-label--required': '^form__item-label--required',
|
|
14
|
+
'form__item-label--colon': '^form__item-label--colon',
|
|
15
|
+
'form__item-label-extra': '^form__item-label-extra',
|
|
16
|
+
'form__item-content': '^form__item-content',
|
|
17
|
+
'form__item-control': '^form__item-control',
|
|
18
|
+
'form__item-feedback-icon': '^form__item-feedback-icon',
|
|
19
|
+
'form__error-container': '^form__error-container',
|
|
20
|
+
form__error: '^form__error',
|
|
21
|
+
'form__error--error': '^form__error--error',
|
|
22
|
+
'form__error--warning': '^form__error--warning',
|
|
23
|
+
};
|
|
24
|
+
export const FormContext = createContext(undefined);
|
|
25
|
+
export const FormGroupContext = createContext(undefined);
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { useComponentProps } from './useComponentProps';
|
|
2
|
+
export { useControlled } from './useControlled';
|
|
3
|
+
export { useDesign } from './useDesign';
|
|
4
|
+
export { useFocusVisible } from './useFocusVisible';
|
|
5
|
+
export { useLayout } from './useLayout';
|
|
6
|
+
export { useListenGlobalScrolling } from './useListenGlobalScrolling';
|
|
7
|
+
export { useLockScroll } from './useLockScroll';
|
|
8
|
+
export { useMaxIndex } from './useMaxIndex';
|
|
9
|
+
export { useNamespace } from './useNamespace';
|
|
10
|
+
export { useNestedPopup } from './useNestedPopup';
|
|
11
|
+
export { useNextTick } from './useNextTick';
|
|
12
|
+
export { useScopedProps } from './useScopedProps';
|
|
13
|
+
export { useStyled } from './useStyled';
|
|
14
|
+
export { useTranslation } from './useTranslation';
|
package/hooks/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { useComponentProps } from './useComponentProps';
|
|
2
|
+
export { useControlled } from './useControlled';
|
|
3
|
+
export { useDesign } from './useDesign';
|
|
4
|
+
export { useFocusVisible } from './useFocusVisible';
|
|
5
|
+
export { useLayout } from './useLayout';
|
|
6
|
+
export { useListenGlobalScrolling } from './useListenGlobalScrolling';
|
|
7
|
+
export { useLockScroll } from './useLockScroll';
|
|
8
|
+
export { useMaxIndex } from './useMaxIndex';
|
|
9
|
+
export { useNamespace } from './useNamespace';
|
|
10
|
+
export { useNestedPopup } from './useNestedPopup';
|
|
11
|
+
export { useNextTick } from './useNextTick';
|
|
12
|
+
export { useScopedProps } from './useScopedProps';
|
|
13
|
+
export { useStyled } from './useStyled';
|
|
14
|
+
export { useTranslation } from './useTranslation';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isUndefined } from 'lodash';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { LContext } from '../context';
|
|
4
|
+
export function useComponentProps(component, props) {
|
|
5
|
+
var _a;
|
|
6
|
+
const context = useContext(LContext);
|
|
7
|
+
const defaultProps = (_a = context.componentDefaultProps[component]) !== null && _a !== void 0 ? _a : {};
|
|
8
|
+
const definedProps = {};
|
|
9
|
+
Object.keys(props).forEach((key) => {
|
|
10
|
+
if (!isUndefined(props[key])) {
|
|
11
|
+
definedProps[key] = props[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return Object.assign(defaultProps, definedProps);
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AbstractControl } from '../form';
|
|
2
|
+
import type { DraftFunction } from '@laser-ui/hooks/useImmer';
|
|
3
|
+
export declare function useControlled<T, S = T>(initialValue: T | (() => T), value?: T, onChange?: (value: S) => void, deepCompare?: (previous: T, current: S) => boolean, formControl?: AbstractControl): [T, (value: S | DraftFunction<S>) => S];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { freeze, produce } from 'immer';
|
|
2
|
+
import { isFunction, isUndefined } from 'lodash';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
export function useControlled(initialValue, value, onChange, deepCompare, formControl) {
|
|
5
|
+
const [_value, setValue] = useState(initialValue);
|
|
6
|
+
const valueRef = useRef(_value);
|
|
7
|
+
valueRef.current = formControl ? formControl.value : !isUndefined(value) ? value : _value;
|
|
8
|
+
return [
|
|
9
|
+
valueRef.current,
|
|
10
|
+
(value) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const newValue = isFunction(value) ? produce(valueRef.current, value) : freeze(value);
|
|
13
|
+
const reRender = deepCompare ? !deepCompare(valueRef.current, newValue) : !Object.is(valueRef.current, newValue);
|
|
14
|
+
if (reRender) {
|
|
15
|
+
setValue(newValue);
|
|
16
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
17
|
+
if (formControl) {
|
|
18
|
+
formControl.markAsDirty(true);
|
|
19
|
+
formControl.setValue(newValue);
|
|
20
|
+
(_b = (_a = formControl.root)._emitChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return newValue;
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormControlProvider } from '../form/types';
|
|
2
|
+
export declare function useDesign(opts: {
|
|
3
|
+
compose?: {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
form?: FormControlProvider;
|
|
8
|
+
}): {
|
|
9
|
+
'data-l-compose-active': boolean | undefined;
|
|
10
|
+
'data-l-compose-disabled': boolean | undefined;
|
|
11
|
+
'data-l-form-invalid': false | "error" | "warning" | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function useDesign(opts) {
|
|
2
|
+
var _a, _b, _c;
|
|
3
|
+
return {
|
|
4
|
+
'data-l-compose-active': (_a = opts.compose) === null || _a === void 0 ? void 0 : _a.active,
|
|
5
|
+
'data-l-compose-disabled': (_b = opts.compose) === null || _b === void 0 ? void 0 : _b.disabled,
|
|
6
|
+
'data-l-form-invalid': (_c = opts.form) === null || _c === void 0 ? void 0 : _c.invalid,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useAsync, useEvent, useRefExtra } from '@laser-ui/hooks';
|
|
2
|
+
import { cloneElement, useRef, useState } from 'react';
|
|
3
|
+
export function useFocusVisible(isValidCode) {
|
|
4
|
+
const windowRef = useRefExtra(() => window);
|
|
5
|
+
const async = useAsync();
|
|
6
|
+
const hadKeyboardEvent = useRef(false);
|
|
7
|
+
const [focusVisible, setFocusVisible] = useState(false);
|
|
8
|
+
useEvent(windowRef, 'keydown', () => {
|
|
9
|
+
hadKeyboardEvent.current = true;
|
|
10
|
+
async.requestAnimationFrame(() => {
|
|
11
|
+
hadKeyboardEvent.current = false;
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return [
|
|
15
|
+
focusVisible,
|
|
16
|
+
(el) => cloneElement(el, {
|
|
17
|
+
onFocus: (e) => {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
(_b = (_a = el.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
20
|
+
if (hadKeyboardEvent.current) {
|
|
21
|
+
setFocusVisible(true);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
onBlur: (e) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
(_b = (_a = el.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
27
|
+
setFocusVisible(false);
|
|
28
|
+
},
|
|
29
|
+
onKeyDown: (e) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_b = (_a = el.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
32
|
+
if (isValidCode(e.code)) {
|
|
33
|
+
setFocusVisible(true);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRefExtra } from '@laser-ui/hooks';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { LContext } from '../context';
|
|
4
|
+
export function useLayout() {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const context = useContext(LContext);
|
|
7
|
+
const pageScrollRef = useRefExtra((_a = context.layoutPageScrollEl) !== null && _a !== void 0 ? _a : (() => null));
|
|
8
|
+
const contentResizeRef = useRefExtra((_b = context.layoutContentResizeEl) !== null && _b !== void 0 ? _b : (() => null));
|
|
9
|
+
return { pageScrollRef, contentResizeRef };
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useListenGlobalScrolling(callback?: () => void, disabled?: boolean): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useEvent, useRefExtra } from '@laser-ui/hooks';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { LContext } from '../context';
|
|
4
|
+
export function useListenGlobalScrolling(callback, disabled = false) {
|
|
5
|
+
const context = useContext(LContext);
|
|
6
|
+
const windowRef = useRefExtra(() => window);
|
|
7
|
+
useEvent(windowRef, 'scroll', callback, { passive: true, capture: true }, !context.listenGlobalScrolling || disabled);
|
|
8
|
+
return context.listenGlobalScrolling;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLockScroll(lock: boolean): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { ROOT_DATA } from '../root/vars';
|
|
3
|
+
export function useLockScroll(lock) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
if (lock) {
|
|
6
|
+
const cssText = document.documentElement.style.cssText;
|
|
7
|
+
const scrollTop = document.documentElement.scrollTop;
|
|
8
|
+
const scrollLeft = document.documentElement.scrollLeft;
|
|
9
|
+
let addCssText = 'position:fixed;width:100%;height:100%;';
|
|
10
|
+
if (document.documentElement.scrollHeight > ROOT_DATA.windowSize.height) {
|
|
11
|
+
addCssText += `top:-${scrollTop}px;overflow-y:scroll;`;
|
|
12
|
+
}
|
|
13
|
+
if (document.documentElement.scrollWidth > ROOT_DATA.windowSize.width) {
|
|
14
|
+
addCssText += `left:-${scrollLeft}px;overflow-x:scroll;`;
|
|
15
|
+
}
|
|
16
|
+
document.documentElement.style.cssText += addCssText;
|
|
17
|
+
return () => {
|
|
18
|
+
document.documentElement.style.cssText = cssText;
|
|
19
|
+
document.documentElement.scrollTop = scrollTop;
|
|
20
|
+
document.documentElement.scrollLeft = scrollLeft;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [lock]);
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMaxIndex(visible: boolean): number;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useUnmount } from '@laser-ui/hooks';
|
|
2
|
+
import { useId, useMemo, useRef } from 'react';
|
|
3
|
+
const MAX_INDEX_MANAGER = {
|
|
4
|
+
record: [],
|
|
5
|
+
add(id) {
|
|
6
|
+
let n = 1;
|
|
7
|
+
if (this.record.length > 0) {
|
|
8
|
+
n = this.record[this.record.length - 1].n + 1;
|
|
9
|
+
}
|
|
10
|
+
this.record.push({ id, n });
|
|
11
|
+
return n;
|
|
12
|
+
},
|
|
13
|
+
delete(id) {
|
|
14
|
+
this.record = this.record.filter((item) => item.id !== id);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export function useMaxIndex(visible) {
|
|
18
|
+
const id = useId();
|
|
19
|
+
const prevMaxZIndex = useRef(0);
|
|
20
|
+
const maxZIndex = useMemo(() => {
|
|
21
|
+
if (visible) {
|
|
22
|
+
return MAX_INDEX_MANAGER.add(id);
|
|
23
|
+
}
|
|
24
|
+
MAX_INDEX_MANAGER.delete(id);
|
|
25
|
+
return prevMaxZIndex.current;
|
|
26
|
+
}, [id, visible]);
|
|
27
|
+
prevMaxZIndex.current = maxZIndex;
|
|
28
|
+
useUnmount(() => {
|
|
29
|
+
MAX_INDEX_MANAGER.delete(id);
|
|
30
|
+
});
|
|
31
|
+
return maxZIndex;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useNamespace(): string;
|