@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,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CollapseTransition } from '../../internal/transition';
|
|
3
|
+
import { mergeCS } from '../../utils';
|
|
4
|
+
import { TTANSITION_DURING_FAST } from '../../vars';
|
|
5
|
+
export function FormError(props) {
|
|
6
|
+
const { styled, visible, message, invalid, afterLeave } = props;
|
|
7
|
+
return (_jsx(CollapseTransition, { originalSize: {
|
|
8
|
+
height: 'auto',
|
|
9
|
+
}, collapsedSize: {
|
|
10
|
+
height: 0,
|
|
11
|
+
}, enter: visible, during: TTANSITION_DURING_FAST, styles: {
|
|
12
|
+
enter: { opacity: 0 },
|
|
13
|
+
entering: {
|
|
14
|
+
transition: ['height', 'padding', 'margin', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_FAST}ms linear`).join(', '),
|
|
15
|
+
},
|
|
16
|
+
leaving: {
|
|
17
|
+
opacity: 0,
|
|
18
|
+
transition: ['height', 'padding', 'margin', 'opacity'].map((attr) => `${attr} ${TTANSITION_DURING_FAST}ms linear`).join(', '),
|
|
19
|
+
},
|
|
20
|
+
leaved: { display: 'none' },
|
|
21
|
+
}, skipFirstTransition: false, afterLeave: afterLeave, children: (ref, collapseStyle) => (_jsx("div", Object.assign({}, mergeCS(styled('form__error', `form__error--${invalid}`), {
|
|
22
|
+
style: collapseStyle,
|
|
23
|
+
}), { ref: ref, title: message, children: message }))) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FormGroup } from './form-group';
|
|
2
|
+
import type { AsyncValidatorFn, FormControlStatus, ValidationErrors, ValidatorFn } from './types';
|
|
3
|
+
export declare abstract class AbstractControl<V = any> {
|
|
4
|
+
private _parent;
|
|
5
|
+
private _pristine;
|
|
6
|
+
private _errors;
|
|
7
|
+
private _hasOwnPendingAsyncValidator;
|
|
8
|
+
private _asyncValidationSubscription?;
|
|
9
|
+
private _composedValidatorFn;
|
|
10
|
+
private _composedAsyncValidatorFn;
|
|
11
|
+
private _rawValidators;
|
|
12
|
+
private _rawAsyncValidators;
|
|
13
|
+
constructor(validators: ValidatorFn | ValidatorFn[] | null, asyncValidators: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
14
|
+
get validator(): ValidatorFn | null;
|
|
15
|
+
set validator(validatorFn: ValidatorFn | null);
|
|
16
|
+
get asyncValidator(): AsyncValidatorFn | null;
|
|
17
|
+
set asyncValidator(asyncValidatorFn: AsyncValidatorFn | null);
|
|
18
|
+
get parent(): FormGroup | null;
|
|
19
|
+
get root(): AbstractControl;
|
|
20
|
+
get value(): V;
|
|
21
|
+
get status(): FormControlStatus;
|
|
22
|
+
get errors(): ValidationErrors | null;
|
|
23
|
+
get valid(): boolean;
|
|
24
|
+
get invalid(): boolean;
|
|
25
|
+
get pending(): boolean;
|
|
26
|
+
get disabled(): boolean;
|
|
27
|
+
get enabled(): boolean;
|
|
28
|
+
get pristine(): boolean;
|
|
29
|
+
get dirty(): boolean;
|
|
30
|
+
setValidators(validators: ValidatorFn | ValidatorFn[] | null): void;
|
|
31
|
+
setAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[] | null): void;
|
|
32
|
+
addValidators(validators: ValidatorFn | ValidatorFn[]): void;
|
|
33
|
+
addAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[]): void;
|
|
34
|
+
removeValidators(validators: ValidatorFn | ValidatorFn[]): void;
|
|
35
|
+
removeAsyncValidators(validators: AsyncValidatorFn | AsyncValidatorFn[]): void;
|
|
36
|
+
hasValidator(validator: ValidatorFn): boolean;
|
|
37
|
+
hasAsyncValidator(validator: AsyncValidatorFn): boolean;
|
|
38
|
+
clearValidators(): void;
|
|
39
|
+
clearAsyncValidators(): void;
|
|
40
|
+
markAsDirty(onlySelf?: boolean): void;
|
|
41
|
+
markAsPristine(onlySelf?: boolean): void;
|
|
42
|
+
markAsPending(onlySelf?: boolean): void;
|
|
43
|
+
disable(onlySelf?: boolean): void;
|
|
44
|
+
enable(onlySelf?: boolean): void;
|
|
45
|
+
setParent(parent: FormGroup): void;
|
|
46
|
+
setErrors(errors: ValidationErrors | null): void;
|
|
47
|
+
updateValueAndValidity(onlySelf?: boolean): void;
|
|
48
|
+
protected abstract _value: V;
|
|
49
|
+
protected abstract _status: FormControlStatus;
|
|
50
|
+
abstract setValue(value: V, onlySelf?: boolean): void;
|
|
51
|
+
abstract patchValue(value: any, onlySelf?: boolean): void;
|
|
52
|
+
abstract reset(value?: any, onlySelf?: boolean): void;
|
|
53
|
+
protected abstract _updateValue(): void;
|
|
54
|
+
protected abstract _forEachChild(cb: (c: AbstractControl) => void): void;
|
|
55
|
+
protected abstract _anyControls(condition: (c: AbstractControl) => boolean): boolean;
|
|
56
|
+
protected abstract _allControlsDisabled(): boolean;
|
|
57
|
+
protected _anyControlsHaveStatus(status: FormControlStatus): boolean;
|
|
58
|
+
protected _anyControlsDirty(): boolean;
|
|
59
|
+
protected _parentMarkedDirty(onlySelf: boolean): boolean;
|
|
60
|
+
protected _updatePristine(onlySelf?: boolean): void;
|
|
61
|
+
protected _updateControlsErrors(): void;
|
|
62
|
+
protected _calculateStatus(): FormControlStatus;
|
|
63
|
+
protected _updateAncestors(onlySelf: boolean, skipPristineCheck: boolean): void;
|
|
64
|
+
protected _runValidator(): ValidationErrors | null;
|
|
65
|
+
protected _cancelExistingSubscription(): void;
|
|
66
|
+
protected _runAsyncValidator(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { isArray } from 'lodash';
|
|
2
|
+
import { forkJoin, from } from 'rxjs';
|
|
3
|
+
import { DISABLED, INVALID, PENDING, VALID } from './vars';
|
|
4
|
+
function mergeErrors(arrayOfErrors) {
|
|
5
|
+
const res = {};
|
|
6
|
+
arrayOfErrors.forEach((errors) => {
|
|
7
|
+
if (errors != null) {
|
|
8
|
+
Object.assign(res, errors);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return Object.keys(res).length === 0 ? null : res;
|
|
12
|
+
}
|
|
13
|
+
function composeValidators(validators) {
|
|
14
|
+
const presentValidators = validators.filter((validator) => validator !== null);
|
|
15
|
+
if (presentValidators.length === 0) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return function (control) {
|
|
19
|
+
return mergeErrors(presentValidators.map((fn) => fn(control)));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function composeAsyncValidators(validators) {
|
|
23
|
+
const presentValidators = validators.filter((validator) => validator !== null);
|
|
24
|
+
if (presentValidators.length === 0) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return function (control) {
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
const observables = forkJoin(presentValidators.map((fn) => fn(control)));
|
|
30
|
+
observables.subscribe({
|
|
31
|
+
next: (errors) => {
|
|
32
|
+
resolve(mergeErrors(errors));
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function coerceToValidator(validator) {
|
|
39
|
+
return isArray(validator) ? composeValidators(validator) : validator;
|
|
40
|
+
}
|
|
41
|
+
function coerceToAsyncValidator(asyncValidator) {
|
|
42
|
+
return isArray(asyncValidator) ? composeAsyncValidators(asyncValidator) : asyncValidator;
|
|
43
|
+
}
|
|
44
|
+
function makeValidatorsArray(validators) {
|
|
45
|
+
if (!validators) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
return isArray(validators) ? validators : [validators];
|
|
49
|
+
}
|
|
50
|
+
function hasValidator(validators, validator) {
|
|
51
|
+
return Array.isArray(validators) ? validators.includes(validator) : validators === validator;
|
|
52
|
+
}
|
|
53
|
+
function addValidators(validators, currentValidators) {
|
|
54
|
+
const current = makeValidatorsArray(currentValidators);
|
|
55
|
+
const validatorsToAdd = makeValidatorsArray(validators);
|
|
56
|
+
return current.concat(validatorsToAdd.filter((validator) => !hasValidator(current, validator)));
|
|
57
|
+
}
|
|
58
|
+
function removeValidators(validators, currentValidators) {
|
|
59
|
+
return makeValidatorsArray(currentValidators).filter((validator) => !hasValidator(validators, validator));
|
|
60
|
+
}
|
|
61
|
+
export class AbstractControl {
|
|
62
|
+
constructor(validators, asyncValidators) {
|
|
63
|
+
Object.defineProperty(this, "_parent", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: null
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(this, "_pristine", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: true
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(this, "_errors", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
configurable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
value: null
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(this, "_hasOwnPendingAsyncValidator", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
value: false
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(this, "_asyncValidationSubscription", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
configurable: true,
|
|
90
|
+
writable: true,
|
|
91
|
+
value: void 0
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(this, "_composedValidatorFn", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
configurable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: void 0
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(this, "_composedAsyncValidatorFn", {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true,
|
|
103
|
+
value: void 0
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(this, "_rawValidators", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true,
|
|
109
|
+
value: void 0
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(this, "_rawAsyncValidators", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
writable: true,
|
|
115
|
+
value: void 0
|
|
116
|
+
});
|
|
117
|
+
this._rawValidators = validators;
|
|
118
|
+
this._rawAsyncValidators = asyncValidators;
|
|
119
|
+
this._composedValidatorFn = coerceToValidator(this._rawValidators);
|
|
120
|
+
this._composedAsyncValidatorFn = coerceToAsyncValidator(this._rawAsyncValidators);
|
|
121
|
+
}
|
|
122
|
+
get validator() {
|
|
123
|
+
return this._composedValidatorFn;
|
|
124
|
+
}
|
|
125
|
+
set validator(validatorFn) {
|
|
126
|
+
this._rawValidators = this._composedValidatorFn = validatorFn;
|
|
127
|
+
}
|
|
128
|
+
get asyncValidator() {
|
|
129
|
+
return this._composedAsyncValidatorFn;
|
|
130
|
+
}
|
|
131
|
+
set asyncValidator(asyncValidatorFn) {
|
|
132
|
+
this._rawAsyncValidators = this._composedAsyncValidatorFn = asyncValidatorFn;
|
|
133
|
+
}
|
|
134
|
+
get parent() {
|
|
135
|
+
return this._parent;
|
|
136
|
+
}
|
|
137
|
+
get root() {
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
139
|
+
let control = this;
|
|
140
|
+
while (control.parent) {
|
|
141
|
+
control = control.parent;
|
|
142
|
+
}
|
|
143
|
+
return control;
|
|
144
|
+
}
|
|
145
|
+
get value() {
|
|
146
|
+
return this._value;
|
|
147
|
+
}
|
|
148
|
+
get status() {
|
|
149
|
+
return this._status;
|
|
150
|
+
}
|
|
151
|
+
get errors() {
|
|
152
|
+
return this._errors;
|
|
153
|
+
}
|
|
154
|
+
get valid() {
|
|
155
|
+
return this._status === VALID;
|
|
156
|
+
}
|
|
157
|
+
get invalid() {
|
|
158
|
+
return this._status === INVALID;
|
|
159
|
+
}
|
|
160
|
+
get pending() {
|
|
161
|
+
return this._status === PENDING;
|
|
162
|
+
}
|
|
163
|
+
get disabled() {
|
|
164
|
+
return this._status === DISABLED;
|
|
165
|
+
}
|
|
166
|
+
get enabled() {
|
|
167
|
+
return this._status !== DISABLED;
|
|
168
|
+
}
|
|
169
|
+
get pristine() {
|
|
170
|
+
return this._pristine;
|
|
171
|
+
}
|
|
172
|
+
get dirty() {
|
|
173
|
+
return !this._pristine;
|
|
174
|
+
}
|
|
175
|
+
setValidators(validators) {
|
|
176
|
+
this._rawValidators = validators;
|
|
177
|
+
this._composedValidatorFn = coerceToValidator(validators);
|
|
178
|
+
}
|
|
179
|
+
setAsyncValidators(validators) {
|
|
180
|
+
this._rawAsyncValidators = validators;
|
|
181
|
+
this._composedAsyncValidatorFn = coerceToAsyncValidator(validators);
|
|
182
|
+
}
|
|
183
|
+
addValidators(validators) {
|
|
184
|
+
this.setValidators(addValidators(validators, this._rawValidators));
|
|
185
|
+
}
|
|
186
|
+
addAsyncValidators(validators) {
|
|
187
|
+
this.setAsyncValidators(addValidators(validators, this._rawAsyncValidators));
|
|
188
|
+
}
|
|
189
|
+
removeValidators(validators) {
|
|
190
|
+
this.setValidators(removeValidators(validators, this._rawValidators));
|
|
191
|
+
}
|
|
192
|
+
removeAsyncValidators(validators) {
|
|
193
|
+
this.setAsyncValidators(removeValidators(validators, this._rawAsyncValidators));
|
|
194
|
+
}
|
|
195
|
+
hasValidator(validator) {
|
|
196
|
+
return hasValidator(this._rawValidators, validator);
|
|
197
|
+
}
|
|
198
|
+
hasAsyncValidator(validator) {
|
|
199
|
+
return hasValidator(this._rawAsyncValidators, validator);
|
|
200
|
+
}
|
|
201
|
+
clearValidators() {
|
|
202
|
+
this.validator = null;
|
|
203
|
+
}
|
|
204
|
+
clearAsyncValidators() {
|
|
205
|
+
this.asyncValidator = null;
|
|
206
|
+
}
|
|
207
|
+
markAsDirty(onlySelf = false) {
|
|
208
|
+
this._pristine = false;
|
|
209
|
+
if (this._parent && !onlySelf) {
|
|
210
|
+
this._parent.markAsDirty(onlySelf);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
markAsPristine(onlySelf = false) {
|
|
214
|
+
this._pristine = true;
|
|
215
|
+
this._forEachChild((control) => {
|
|
216
|
+
control.markAsPristine(true);
|
|
217
|
+
});
|
|
218
|
+
if (this._parent && !onlySelf) {
|
|
219
|
+
this._parent._updatePristine(onlySelf);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
markAsPending(onlySelf = false) {
|
|
223
|
+
this._status = PENDING;
|
|
224
|
+
if (this._parent && !onlySelf) {
|
|
225
|
+
this._parent.markAsPending(onlySelf);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
disable(onlySelf = false) {
|
|
229
|
+
// If parent has been marked artificially dirty we don't want to re-calculate the
|
|
230
|
+
// parent's dirtiness based on the children.
|
|
231
|
+
const skipPristineCheck = this._parentMarkedDirty(onlySelf);
|
|
232
|
+
this._status = DISABLED;
|
|
233
|
+
this._errors = null;
|
|
234
|
+
this._forEachChild((control) => {
|
|
235
|
+
control.disable(true);
|
|
236
|
+
});
|
|
237
|
+
this._updateAncestors(onlySelf, skipPristineCheck);
|
|
238
|
+
}
|
|
239
|
+
enable(onlySelf = false) {
|
|
240
|
+
// If parent has been marked artificially dirty we don't want to re-calculate the
|
|
241
|
+
// parent's dirtiness based on the children.
|
|
242
|
+
const skipPristineCheck = this._parentMarkedDirty(onlySelf);
|
|
243
|
+
this._status = VALID;
|
|
244
|
+
this._forEachChild((control) => {
|
|
245
|
+
control.enable(true);
|
|
246
|
+
});
|
|
247
|
+
this.updateValueAndValidity(true);
|
|
248
|
+
this._updateAncestors(onlySelf, skipPristineCheck);
|
|
249
|
+
}
|
|
250
|
+
setParent(parent) {
|
|
251
|
+
this._parent = parent;
|
|
252
|
+
}
|
|
253
|
+
setErrors(errors) {
|
|
254
|
+
this._errors = errors;
|
|
255
|
+
this._updateControlsErrors();
|
|
256
|
+
}
|
|
257
|
+
updateValueAndValidity(onlySelf = false) {
|
|
258
|
+
this._updateValue();
|
|
259
|
+
if (this.enabled) {
|
|
260
|
+
this._cancelExistingSubscription();
|
|
261
|
+
this._errors = this._runValidator();
|
|
262
|
+
this._status = this._calculateStatus();
|
|
263
|
+
if (this.status === VALID || this.status === PENDING) {
|
|
264
|
+
this._runAsyncValidator();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (this._parent && !onlySelf) {
|
|
268
|
+
this._parent.updateValueAndValidity(onlySelf);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
_anyControlsHaveStatus(status) {
|
|
272
|
+
return this._anyControls((control) => control.status === status);
|
|
273
|
+
}
|
|
274
|
+
_anyControlsDirty() {
|
|
275
|
+
return this._anyControls((control) => control.dirty);
|
|
276
|
+
}
|
|
277
|
+
_parentMarkedDirty(onlySelf) {
|
|
278
|
+
return !!(!onlySelf && this._parent && this._parent.dirty && !this._parent._anyControlsDirty());
|
|
279
|
+
}
|
|
280
|
+
_updatePristine(onlySelf = false) {
|
|
281
|
+
this._pristine = !this._anyControlsDirty();
|
|
282
|
+
if (this._parent && !onlySelf) {
|
|
283
|
+
this._parent._updatePristine(onlySelf);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
_updateControlsErrors() {
|
|
287
|
+
this._status = this._calculateStatus();
|
|
288
|
+
if (this._parent) {
|
|
289
|
+
this._parent._updateControlsErrors();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
_calculateStatus() {
|
|
293
|
+
if (this._allControlsDisabled())
|
|
294
|
+
return DISABLED;
|
|
295
|
+
if (this.errors)
|
|
296
|
+
return INVALID;
|
|
297
|
+
if (this._hasOwnPendingAsyncValidator || this._anyControlsHaveStatus(PENDING))
|
|
298
|
+
return PENDING;
|
|
299
|
+
if (this._anyControlsHaveStatus(INVALID))
|
|
300
|
+
return INVALID;
|
|
301
|
+
return VALID;
|
|
302
|
+
}
|
|
303
|
+
_updateAncestors(onlySelf, skipPristineCheck) {
|
|
304
|
+
if (this._parent && !onlySelf) {
|
|
305
|
+
this._parent.updateValueAndValidity(onlySelf);
|
|
306
|
+
if (!skipPristineCheck) {
|
|
307
|
+
this._parent._updatePristine();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
_runValidator() {
|
|
312
|
+
return this.validator ? this.validator(this) : null;
|
|
313
|
+
}
|
|
314
|
+
_cancelExistingSubscription() {
|
|
315
|
+
if (this._asyncValidationSubscription) {
|
|
316
|
+
this._asyncValidationSubscription.unsubscribe();
|
|
317
|
+
this._hasOwnPendingAsyncValidator = false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
_runAsyncValidator() {
|
|
321
|
+
if (this.asyncValidator) {
|
|
322
|
+
this._status = PENDING;
|
|
323
|
+
this._hasOwnPendingAsyncValidator = true;
|
|
324
|
+
this._asyncValidationSubscription = from(this.asyncValidator(this)).subscribe((errors) => {
|
|
325
|
+
var _a, _b;
|
|
326
|
+
this._hasOwnPendingAsyncValidator = false;
|
|
327
|
+
// This will trigger the recalculation of the validation status, which depends on
|
|
328
|
+
// the state of the asynchronous validation (whether it is in progress or not). So, it is
|
|
329
|
+
// necessary that we have updated the `_hasOwnPendingAsyncValidator` boolean flag first.
|
|
330
|
+
this.setErrors(errors);
|
|
331
|
+
(_b = (_a = this.root)._emitChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AsyncValidatorFn, FormControlStatus, ValidatorFn } from './types';
|
|
2
|
+
import { AbstractControl } from './abstract-control';
|
|
3
|
+
export interface FormControlState<V> {
|
|
4
|
+
value: V;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class FormControl<V> extends AbstractControl<V> {
|
|
8
|
+
readonly defaultState: FormControlState<V> | V;
|
|
9
|
+
protected _value: V;
|
|
10
|
+
protected _status: FormControlStatus;
|
|
11
|
+
constructor(formState: FormControlState<V> | V, validators?: ValidatorFn | ValidatorFn[] | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
12
|
+
getError(errorCode: string): any;
|
|
13
|
+
hasError(errorCode: string): boolean;
|
|
14
|
+
setValue(value: V, onlySelf?: boolean): void;
|
|
15
|
+
patchValue(value: V, onlySelf?: boolean): void;
|
|
16
|
+
reset(formState?: V | FormControlState<V>, onlySelf?: boolean): void;
|
|
17
|
+
protected _updateValue(): void;
|
|
18
|
+
protected _forEachChild(): void;
|
|
19
|
+
protected _anyControls(): boolean;
|
|
20
|
+
protected _allControlsDisabled(): boolean;
|
|
21
|
+
protected _isFormStateObject(formState: FormControlState<V> | V): formState is FormControlState<V>;
|
|
22
|
+
private _applyFormState;
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AbstractControl } from './abstract-control';
|
|
2
|
+
import { VALID } from './vars';
|
|
3
|
+
export class FormControl extends AbstractControl {
|
|
4
|
+
constructor(formState, validators, asyncValidator) {
|
|
5
|
+
super(validators !== null && validators !== void 0 ? validators : null, asyncValidator !== null && asyncValidator !== void 0 ? asyncValidator : null);
|
|
6
|
+
Object.defineProperty(this, "defaultState", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: void 0
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "_value", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "_status", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: VALID
|
|
23
|
+
});
|
|
24
|
+
this.defaultState = formState;
|
|
25
|
+
this._applyFormState(formState);
|
|
26
|
+
this.updateValueAndValidity(true);
|
|
27
|
+
}
|
|
28
|
+
getError(errorCode) {
|
|
29
|
+
return this && this.errors ? this.errors[errorCode] : null;
|
|
30
|
+
}
|
|
31
|
+
hasError(errorCode) {
|
|
32
|
+
return !!this.getError(errorCode);
|
|
33
|
+
}
|
|
34
|
+
setValue(value, onlySelf) {
|
|
35
|
+
this._value = value;
|
|
36
|
+
this.updateValueAndValidity(onlySelf);
|
|
37
|
+
}
|
|
38
|
+
patchValue(value, onlySelf) {
|
|
39
|
+
this.setValue(value, onlySelf);
|
|
40
|
+
}
|
|
41
|
+
reset(formState = this.defaultState, onlySelf) {
|
|
42
|
+
this._applyFormState(formState);
|
|
43
|
+
this.markAsPristine(onlySelf);
|
|
44
|
+
this.setValue(this.value, onlySelf);
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
47
|
+
_updateValue() { }
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
49
|
+
_forEachChild() { }
|
|
50
|
+
_anyControls() {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
_allControlsDisabled() {
|
|
54
|
+
return this.disabled;
|
|
55
|
+
}
|
|
56
|
+
_isFormStateObject(formState) {
|
|
57
|
+
return (typeof formState === 'object' &&
|
|
58
|
+
formState !== null &&
|
|
59
|
+
Object.keys(formState).length === 2 &&
|
|
60
|
+
'value' in formState &&
|
|
61
|
+
'disabled' in formState);
|
|
62
|
+
}
|
|
63
|
+
_applyFormState(formState) {
|
|
64
|
+
if (this._isFormStateObject(formState)) {
|
|
65
|
+
this._value = formState.value;
|
|
66
|
+
formState.disabled ? this.disable(true) : this.enable(true);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this._value = formState;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AsyncValidatorFn, FormControlStatus, ValidatorFn } from './types';
|
|
2
|
+
import { AbstractControl } from './abstract-control';
|
|
3
|
+
type Mutable<T> = {
|
|
4
|
+
-readonly [P in keyof T]: T[P];
|
|
5
|
+
};
|
|
6
|
+
type GetFormControlPropertyFromArray<T, A> = Mutable<A> extends [infer K, ...infer R] ? K extends keyof T ? GetFormControlPropertyFromArray<T[K], R> : any : T;
|
|
7
|
+
type GetFormControlProperty<T, S> = S extends `${infer K}.${infer R}` ? K extends keyof T ? GetFormControlProperty<T[K], R> : any : S extends keyof T ? T[S] : any;
|
|
8
|
+
type GetFormGroupT<C extends FormGroup<any>> = C extends FormGroup<infer T> ? T : unknown;
|
|
9
|
+
type GetFormGroupValue<T extends {
|
|
10
|
+
[K in keyof T]: AbstractControl;
|
|
11
|
+
}> = {
|
|
12
|
+
[K in keyof T]?: T[K] extends FormGroup ? GetFormGroupValue<GetFormGroupT<T[K]>> : T[K]['value'];
|
|
13
|
+
};
|
|
14
|
+
export declare class FormGroup<T extends {
|
|
15
|
+
[K in keyof T]: AbstractControl;
|
|
16
|
+
} = any> extends AbstractControl<{
|
|
17
|
+
[K in keyof T]: T[K]['value'];
|
|
18
|
+
}> {
|
|
19
|
+
controls: T;
|
|
20
|
+
protected _value: {
|
|
21
|
+
[K in keyof T]: T[K]['value'];
|
|
22
|
+
};
|
|
23
|
+
protected _status: FormControlStatus;
|
|
24
|
+
constructor(controls: T, validators?: ValidatorFn | ValidatorFn[] | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
25
|
+
get<S extends string>(path: S): AbstractControl<GetFormControlProperty<{
|
|
26
|
+
[K in keyof T]: T[K]['value'];
|
|
27
|
+
}, S>>;
|
|
28
|
+
get<S extends ArrayLike<string>>(path: S): AbstractControl<GetFormControlPropertyFromArray<{
|
|
29
|
+
[K in keyof T]: T[K]['value'];
|
|
30
|
+
}, S>>;
|
|
31
|
+
getError(errorCode: string, path?: string[] | string): any;
|
|
32
|
+
hasError(errorCode: string, path?: string[] | string): boolean;
|
|
33
|
+
addControl<K extends keyof T>(name: K, control: T[K]): void;
|
|
34
|
+
addControl(name: string, control: AbstractControl): void;
|
|
35
|
+
removeControl<K extends keyof T>(name: K): void;
|
|
36
|
+
removeControl(name: string): void;
|
|
37
|
+
setControl<K extends keyof T>(name: K, control: T[K]): void;
|
|
38
|
+
setControl(name: string, control: AbstractControl): void;
|
|
39
|
+
contains<K extends keyof T>(controlName: K): boolean;
|
|
40
|
+
contains(controlName: string): boolean;
|
|
41
|
+
setValue(value: {
|
|
42
|
+
[K in keyof T]: T[K]['value'];
|
|
43
|
+
} & {
|
|
44
|
+
[K: string]: any;
|
|
45
|
+
}, onlySelf?: boolean): void;
|
|
46
|
+
patchValue(value: GetFormGroupValue<T> & {
|
|
47
|
+
[K: string]: any;
|
|
48
|
+
}, onlySelf?: boolean): void;
|
|
49
|
+
reset(value?: GetFormGroupValue<T> & {
|
|
50
|
+
[K: string]: any;
|
|
51
|
+
}, onlySelf?: boolean): void;
|
|
52
|
+
protected _updateValue(): void;
|
|
53
|
+
protected _forEachChild(cb: (v: any, k: string) => void): void;
|
|
54
|
+
protected _anyControls(condition: (c: AbstractControl) => boolean): boolean;
|
|
55
|
+
protected _allControlsDisabled(): boolean;
|
|
56
|
+
private _setUpControls;
|
|
57
|
+
private _reduceValue;
|
|
58
|
+
private _reduceChildren;
|
|
59
|
+
private _checkAllValuesPresent;
|
|
60
|
+
private _throwIfControlMissing;
|
|
61
|
+
}
|
|
62
|
+
export {};
|