doui-react 1.0.0
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/LICENSE +21 -0
- package/README.md +28 -0
- package/es/api/component/class-name.d.ts +3 -0
- package/es/api/component/class-name.js +15 -0
- package/es/api/component/common.d.ts +22 -0
- package/es/api/component/common.js +144 -0
- package/es/api/component/dom.d.ts +2 -0
- package/es/api/component/dom.js +7 -0
- package/es/api/component/global-style.d.ts +3 -0
- package/es/api/component/global-style.js +16 -0
- package/es/api/component/index.d.ts +9 -0
- package/es/api/component/index.js +9 -0
- package/es/api/component/react-dom.d.ts +3 -0
- package/es/api/component/react-dom.js +72 -0
- package/es/api/component/sort.d.ts +2 -0
- package/es/api/component/sort.js +20 -0
- package/es/api/component/style.d.ts +4 -0
- package/es/api/component/style.js +33 -0
- package/es/api/component/url.d.ts +33 -0
- package/es/api/component/url.js +126 -0
- package/es/api/component/validate-input.d.ts +8 -0
- package/es/api/component/validate-input.js +16 -0
- package/es/api/index.d.ts +2 -0
- package/es/api/index.js +2 -0
- package/es/api/type/common.d.ts +24 -0
- package/es/api/type/common.js +1 -0
- package/es/api/type/index.d.ts +5 -0
- package/es/api/type/index.js +2 -0
- package/es/button/component/index.d.ts +2 -0
- package/es/button/component/index.js +87 -0
- package/es/button/index.d.ts +2 -0
- package/es/button/index.js +2 -0
- package/es/button/type/index.d.ts +31 -0
- package/es/button/type/index.js +1 -0
- package/es/checkbox/component/checkbox-group.d.ts +2 -0
- package/es/checkbox/component/checkbox-group.js +66 -0
- package/es/checkbox/component/checkbox.d.ts +2 -0
- package/es/checkbox/component/checkbox.js +8 -0
- package/es/checkbox/component/index.d.ts +2 -0
- package/es/checkbox/component/index.js +10 -0
- package/es/checkbox/component/use-checkbox.d.ts +12 -0
- package/es/checkbox/component/use-checkbox.js +43 -0
- package/es/checkbox/component/utils.d.ts +13 -0
- package/es/checkbox/component/utils.js +40 -0
- package/es/checkbox/index.d.ts +2 -0
- package/es/checkbox/index.js +2 -0
- package/es/checkbox/style/index.d.ts +5 -0
- package/es/checkbox/style/index.js +11 -0
- package/es/checkbox/type/index.d.ts +18 -0
- package/es/checkbox/type/index.js +1 -0
- package/es/config/index.d.ts +0 -0
- package/es/config/index.js +0 -0
- package/es/date-picker/component/index.d.ts +3 -0
- package/es/date-picker/component/index.js +38 -0
- package/es/date-picker/index.d.ts +2 -0
- package/es/date-picker/index.js +2 -0
- package/es/date-picker/style/index.d.ts +4 -0
- package/es/date-picker/style/index.js +7 -0
- package/es/date-picker/type/index.d.ts +21 -0
- package/es/date-picker/type/index.js +1 -0
- package/es/empty/component/index.d.ts +2 -0
- package/es/empty/component/index.js +17 -0
- package/es/empty/index.d.ts +2 -0
- package/es/empty/index.js +2 -0
- package/es/empty/type/index.d.ts +9 -0
- package/es/empty/type/index.js +1 -0
- package/es/form/component/constant.d.ts +15 -0
- package/es/form/component/constant.js +15 -0
- package/es/form/component/form-content.d.ts +10 -0
- package/es/form/component/form-content.js +280 -0
- package/es/form/component/form-item-map.d.ts +40 -0
- package/es/form/component/form-item-map.js +120 -0
- package/es/form/component/form-item.d.ts +7 -0
- package/es/form/component/form-item.js +219 -0
- package/es/form/component/form-list.d.ts +36 -0
- package/es/form/component/form-list.js +190 -0
- package/es/form/component/form.d.ts +2 -0
- package/es/form/component/form.js +40 -0
- package/es/form/component/index.d.ts +15 -0
- package/es/form/component/index.js +14 -0
- package/es/form/component/submit-button.d.ts +2 -0
- package/es/form/component/submit-button.js +47 -0
- package/es/form/component/use-debug.d.ts +1 -0
- package/es/form/component/use-debug.js +16 -0
- package/es/form/component/utils.d.ts +95 -0
- package/es/form/component/utils.js +435 -0
- package/es/form/component/validator-item.d.ts +7 -0
- package/es/form/component/validator-item.js +53 -0
- package/es/form/hook/index.d.ts +16 -0
- package/es/form/hook/index.js +116 -0
- package/es/form/hook/list-provider.d.ts +6 -0
- package/es/form/hook/list-provider.js +16 -0
- package/es/form/hook/provider.d.ts +23 -0
- package/es/form/hook/provider.js +21 -0
- package/es/form/hook/use-form.d.ts +2 -0
- package/es/form/hook/use-form.js +335 -0
- package/es/form/index.d.ts +3 -0
- package/es/form/index.js +3 -0
- package/es/form/style/form-item.d.ts +3 -0
- package/es/form/style/form-item.js +38 -0
- package/es/form/style/index.d.ts +7 -0
- package/es/form/style/index.js +13 -0
- package/es/form/type/form-item.d.ts +141 -0
- package/es/form/type/form-item.js +1 -0
- package/es/form/type/form-list.d.ts +91 -0
- package/es/form/type/form-list.js +1 -0
- package/es/form/type/index.d.ts +134 -0
- package/es/form/type/index.js +3 -0
- package/es/grid/component/index.d.ts +2 -0
- package/es/grid/component/index.js +76 -0
- package/es/grid/component/pagination.d.ts +50 -0
- package/es/grid/component/pagination.js +54 -0
- package/es/grid/component/utils.d.ts +2 -0
- package/es/grid/component/utils.js +7 -0
- package/es/grid/index.d.ts +2 -0
- package/es/grid/index.js +2 -0
- package/es/grid/style/index.d.ts +11 -0
- package/es/grid/style/index.js +26 -0
- package/es/grid/type/index.d.ts +67 -0
- package/es/grid/type/index.js +1 -0
- package/es/highlight-text/component/index.d.ts +2 -0
- package/es/highlight-text/component/index.js +71 -0
- package/es/highlight-text/index.d.ts +2 -0
- package/es/highlight-text/index.js +2 -0
- package/es/highlight-text/style/index.d.ts +4 -0
- package/es/highlight-text/style/index.js +7 -0
- package/es/highlight-text/type/index.d.ts +18 -0
- package/es/highlight-text/type/index.js +1 -0
- package/es/hooks/hook/common.d.ts +1 -0
- package/es/hooks/hook/common.js +12 -0
- package/es/hooks/hook/index.d.ts +7 -0
- package/es/hooks/hook/index.js +7 -0
- package/es/hooks/hook/use-debounce.d.ts +4 -0
- package/es/hooks/hook/use-debounce.js +23 -0
- package/es/hooks/hook/use-deep.d.ts +9 -0
- package/es/hooks/hook/use-deep.js +64 -0
- package/es/hooks/hook/use-fetch.d.ts +8 -0
- package/es/hooks/hook/use-fetch.js +164 -0
- package/es/hooks/hook/use-list-operation.d.ts +5 -0
- package/es/hooks/hook/use-list-operation.js +70 -0
- package/es/hooks/hook/use-loading.d.ts +7 -0
- package/es/hooks/hook/use-loading.js +59 -0
- package/es/hooks/hook/use-window-resize.d.ts +5 -0
- package/es/hooks/hook/use-window-resize.js +16 -0
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/type/index.d.ts +2 -0
- package/es/hooks/type/index.js +2 -0
- package/es/hooks/type/use-fetch.d.ts +31 -0
- package/es/hooks/type/use-fetch.js +1 -0
- package/es/hooks/type/use-list-operation.d.ts +34 -0
- package/es/hooks/type/use-list-operation.js +1 -0
- package/es/icon/component/down.d.ts +2 -0
- package/es/icon/component/down.js +42 -0
- package/es/icon/component/index.d.ts +2 -0
- package/es/icon/component/index.js +5 -0
- package/es/icon/component/up.d.ts +2 -0
- package/es/icon/component/up.js +41 -0
- package/es/icon/hook/index.d.ts +477 -0
- package/es/icon/hook/index.js +60 -0
- package/es/icon/index.d.ts +2 -0
- package/es/icon/index.js +2 -0
- package/es/icon/style/index.d.ts +4 -0
- package/es/icon/style/index.js +10 -0
- package/es/icon/type/index.d.ts +14 -0
- package/es/icon/type/index.js +1 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +25 -0
- package/es/input/component/index.d.ts +12 -0
- package/es/input/component/index.js +25 -0
- package/es/input/component/input.d.ts +2 -0
- package/es/input/component/input.js +8 -0
- package/es/input/component/number.d.ts +4 -0
- package/es/input/component/number.js +50 -0
- package/es/input/component/password.d.ts +2 -0
- package/es/input/component/password.js +8 -0
- package/es/input/component/text-area.d.ts +2 -0
- package/es/input/component/text-area.js +16 -0
- package/es/input/component/utils.d.ts +15 -0
- package/es/input/component/utils.js +102 -0
- package/es/input/index.d.ts +2 -0
- package/es/input/index.js +2 -0
- package/es/input/style/index.d.ts +6 -0
- package/es/input/style/index.js +11 -0
- package/es/input/type/index.d.ts +41 -0
- package/es/input/type/index.js +1 -0
- package/es/modal-prompt/component/index.d.ts +5 -0
- package/es/modal-prompt/component/index.js +60 -0
- package/es/modal-prompt/component/open-loading.d.ts +2 -0
- package/es/modal-prompt/component/open-loading.js +21 -0
- package/es/modal-prompt/component/utils.d.ts +4 -0
- package/es/modal-prompt/component/utils.js +49 -0
- package/es/modal-prompt/index.d.ts +2 -0
- package/es/modal-prompt/index.js +2 -0
- package/es/modal-prompt/style/index.d.ts +5 -0
- package/es/modal-prompt/style/index.js +9 -0
- package/es/modal-prompt/type/index.d.ts +36 -0
- package/es/modal-prompt/type/index.js +1 -0
- package/es/open-modal/component/constant.d.ts +1 -0
- package/es/open-modal/component/constant.js +3 -0
- package/es/open-modal/component/footer.d.ts +2 -0
- package/es/open-modal/component/footer.js +34 -0
- package/es/open-modal/component/index.d.ts +4 -0
- package/es/open-modal/component/index.js +9 -0
- package/es/open-modal/component/modal.d.ts +10 -0
- package/es/open-modal/component/modal.js +37 -0
- package/es/open-modal/component/title.d.ts +6 -0
- package/es/open-modal/component/title.js +12 -0
- package/es/open-modal/component/use-modal.d.ts +14 -0
- package/es/open-modal/component/use-modal.js +177 -0
- package/es/open-modal/component/utils.d.ts +11 -0
- package/es/open-modal/component/utils.js +109 -0
- package/es/open-modal/hook/index.d.ts +7 -0
- package/es/open-modal/hook/index.js +17 -0
- package/es/open-modal/hook/use-modal.d.ts +6 -0
- package/es/open-modal/hook/use-modal.js +27 -0
- package/es/open-modal/index.d.ts +3 -0
- package/es/open-modal/index.js +3 -0
- package/es/open-modal/style/index.d.ts +5 -0
- package/es/open-modal/style/index.js +18 -0
- package/es/open-modal/style/wrap.d.ts +2 -0
- package/es/open-modal/style/wrap.js +6 -0
- package/es/open-modal/type/index.d.ts +91 -0
- package/es/open-modal/type/index.js +1 -0
- package/es/portal/component/index.d.ts +2 -0
- package/es/portal/component/index.js +40 -0
- package/es/portal/index.d.ts +2 -0
- package/es/portal/index.js +2 -0
- package/es/portal/type/index.d.ts +13 -0
- package/es/portal/type/index.js +1 -0
- package/es/radio/component/abstract-box.d.ts +380 -0
- package/es/radio/component/abstract-box.js +90 -0
- package/es/radio/component/index.d.ts +2 -0
- package/es/radio/component/index.js +10 -0
- package/es/radio/component/radio.d.ts +2 -0
- package/es/radio/component/radio.js +10 -0
- package/es/radio/component/redio-group.d.ts +2 -0
- package/es/radio/component/redio-group.js +50 -0
- package/es/radio/component/use-box-options.d.ts +6 -0
- package/es/radio/component/use-box-options.js +20 -0
- package/es/radio/component/use-radio.d.ts +23 -0
- package/es/radio/component/use-radio.js +21 -0
- package/es/radio/component/utils.d.ts +7 -0
- package/es/radio/component/utils.js +25 -0
- package/es/radio/index.d.ts +2 -0
- package/es/radio/index.js +2 -0
- package/es/radio/style/index.d.ts +7 -0
- package/es/radio/style/index.js +15 -0
- package/es/radio/type/index.d.ts +32 -0
- package/es/radio/type/index.js +1 -0
- package/es/select/component/constant.d.ts +1 -0
- package/es/select/component/constant.js +1 -0
- package/es/select/component/index.d.ts +3 -0
- package/es/select/component/index.js +16 -0
- package/es/select/component/loading.d.ts +1 -0
- package/es/select/component/loading.js +13 -0
- package/es/select/component/use-select-options.d.ts +11 -0
- package/es/select/component/use-select-options.js +80 -0
- package/es/select/component/use-select.d.ts +2 -0
- package/es/select/component/use-select.js +136 -0
- package/es/select/component/utils.d.ts +14 -0
- package/es/select/component/utils.js +142 -0
- package/es/select/index.d.ts +2 -0
- package/es/select/index.js +2 -0
- package/es/select/style/index.d.ts +4 -0
- package/es/select/style/index.js +7 -0
- package/es/select/type/index.d.ts +105 -0
- package/es/select/type/index.js +1 -0
- package/es/stack/component/center-stack.d.ts +2 -0
- package/es/stack/component/center-stack.js +32 -0
- package/es/stack/component/h-stack.d.ts +2 -0
- package/es/stack/component/h-stack.js +39 -0
- package/es/stack/component/index.d.ts +3 -0
- package/es/stack/component/index.js +3 -0
- package/es/stack/component/v-stack.d.ts +2 -0
- package/es/stack/component/v-stack.js +36 -0
- package/es/stack/index.d.ts +2 -0
- package/es/stack/index.js +2 -0
- package/es/stack/style/index.d.ts +21 -0
- package/es/stack/style/index.js +49 -0
- package/es/stack/type/index.d.ts +54 -0
- package/es/stack/type/index.js +1 -0
- package/es/switch/component/index.d.ts +2 -0
- package/es/switch/component/index.js +60 -0
- package/es/switch/index.d.ts +2 -0
- package/es/switch/index.js +2 -0
- package/es/switch/style/index.d.ts +5 -0
- package/es/switch/style/index.js +13 -0
- package/es/switch/type/index.d.ts +27 -0
- package/es/switch/type/index.js +1 -0
- package/es/table/component/action-button.d.ts +2 -0
- package/es/table/component/action-button.js +95 -0
- package/es/table/component/actions.d.ts +2 -0
- package/es/table/component/actions.js +35 -0
- package/es/table/component/constant.d.ts +1 -0
- package/es/table/component/constant.js +5 -0
- package/es/table/component/editor.d.ts +2 -0
- package/es/table/component/editor.js +35 -0
- package/es/table/component/filter.d.ts +3 -0
- package/es/table/component/filter.js +55 -0
- package/es/table/component/index.d.ts +7 -0
- package/es/table/component/index.js +4 -0
- package/es/table/component/link.d.ts +2 -0
- package/es/table/component/link.js +20 -0
- package/es/table/component/sort.d.ts +6 -0
- package/es/table/component/sort.js +17 -0
- package/es/table/component/switch.d.ts +2 -0
- package/es/table/component/switch.js +27 -0
- package/es/table/component/table-body.d.ts +6 -0
- package/es/table/component/table-body.js +88 -0
- package/es/table/component/table.d.ts +10 -0
- package/es/table/component/table.js +235 -0
- package/es/table/component/time.d.ts +2 -0
- package/es/table/component/time.js +12 -0
- package/es/table/component/utils.d.ts +120 -0
- package/es/table/component/utils.js +222 -0
- package/es/table/component/wrapper.d.ts +6 -0
- package/es/table/component/wrapper.js +30 -0
- package/es/table/hook/index.d.ts +7 -0
- package/es/table/hook/index.js +17 -0
- package/es/table/hook/search.d.ts +5 -0
- package/es/table/hook/search.js +131 -0
- package/es/table/index.d.ts +3 -0
- package/es/table/index.js +3 -0
- package/es/table/style/index.d.ts +9 -0
- package/es/table/style/index.js +16 -0
- package/es/table/type/action.d.ts +48 -0
- package/es/table/type/action.js +1 -0
- package/es/table/type/column.d.ts +110 -0
- package/es/table/type/column.js +1 -0
- package/es/table/type/index.d.ts +113 -0
- package/es/table/type/index.js +11 -0
- package/es/tabs/component/constant.d.ts +2 -0
- package/es/tabs/component/constant.js +2 -0
- package/es/tabs/component/index.d.ts +2 -0
- package/es/tabs/component/index.js +18 -0
- package/es/tabs/component/utils.d.ts +24 -0
- package/es/tabs/component/utils.js +55 -0
- package/es/tabs/index.d.ts +2 -0
- package/es/tabs/index.js +2 -0
- package/es/tabs/style/index.d.ts +5 -0
- package/es/tabs/style/index.js +10 -0
- package/es/tabs/type/index.d.ts +20 -0
- package/es/tabs/type/index.js +1 -0
- package/es/text/component/index.d.ts +3 -0
- package/es/text/component/index.js +57 -0
- package/es/text/component/use-text.d.ts +4 -0
- package/es/text/component/use-text.js +24 -0
- package/es/text/component/utils.d.ts +3 -0
- package/es/text/component/utils.js +9 -0
- package/es/text/index.d.ts +2 -0
- package/es/text/index.js +2 -0
- package/es/text/style/index.d.ts +5 -0
- package/es/text/style/index.js +8 -0
- package/es/text/type/index.d.ts +19 -0
- package/es/text/type/index.js +1 -0
- package/es/tooltip/component/index.d.ts +48 -0
- package/es/tooltip/component/index.js +19 -0
- package/es/tooltip/index.d.ts +2 -0
- package/es/tooltip/index.js +2 -0
- package/es/tooltip/type/index.d.ts +8 -0
- package/es/tooltip/type/index.js +1 -0
- package/es/tree/component/index.d.ts +2 -0
- package/es/tree/component/index.js +23 -0
- package/es/tree/component/utils.d.ts +1 -0
- package/es/tree/component/utils.js +3 -0
- package/es/tree/index.d.ts +2 -0
- package/es/tree/index.js +2 -0
- package/es/tree/style/index.d.ts +4 -0
- package/es/tree/style/index.js +7 -0
- package/es/tree/type/index.d.ts +2 -0
- package/es/tree/type/index.js +1 -0
- package/es/tree-select/component/index.d.ts +2 -0
- package/es/tree-select/component/index.js +15 -0
- package/es/tree-select/component/use-tree-select.d.ts +2 -0
- package/es/tree-select/component/use-tree-select.js +59 -0
- package/es/tree-select/index.d.ts +2 -0
- package/es/tree-select/index.js +2 -0
- package/es/tree-select/style/index.d.ts +5 -0
- package/es/tree-select/style/index.js +15 -0
- package/es/tree-select/type/index.d.ts +23 -0
- package/es/tree-select/type/index.js +1 -0
- package/es/virtual-list/component/index.d.ts +2 -0
- package/es/virtual-list/component/index.js +28 -0
- package/es/virtual-list/index.d.ts +2 -0
- package/es/virtual-list/index.js +2 -0
- package/es/virtual-list/type/index.d.ts +17 -0
- package/es/virtual-list/type/index.js +1 -0
- package/lib/api/component/class-name.d.ts +3 -0
- package/lib/api/component/class-name.js +23 -0
- package/lib/api/component/common.d.ts +22 -0
- package/lib/api/component/common.js +163 -0
- package/lib/api/component/dom.d.ts +2 -0
- package/lib/api/component/dom.js +14 -0
- package/lib/api/component/global-style.d.ts +3 -0
- package/lib/api/component/global-style.js +23 -0
- package/lib/api/component/index.d.ts +9 -0
- package/lib/api/component/index.js +104 -0
- package/lib/api/component/react-dom.d.ts +3 -0
- package/lib/api/component/react-dom.js +80 -0
- package/lib/api/component/sort.d.ts +2 -0
- package/lib/api/component/sort.js +28 -0
- package/lib/api/component/style.d.ts +4 -0
- package/lib/api/component/style.js +43 -0
- package/lib/api/component/url.d.ts +33 -0
- package/lib/api/component/url.js +133 -0
- package/lib/api/component/validate-input.d.ts +8 -0
- package/lib/api/component/validate-input.js +24 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +27 -0
- package/lib/api/type/common.d.ts +24 -0
- package/lib/api/type/common.js +5 -0
- package/lib/api/type/index.d.ts +5 -0
- package/lib/api/type/index.js +16 -0
- package/lib/button/component/index.d.ts +2 -0
- package/lib/button/component/index.js +94 -0
- package/lib/button/index.d.ts +2 -0
- package/lib/button/index.js +27 -0
- package/lib/button/type/index.d.ts +31 -0
- package/lib/button/type/index.js +5 -0
- package/lib/checkbox/component/checkbox-group.d.ts +2 -0
- package/lib/checkbox/component/checkbox-group.js +73 -0
- package/lib/checkbox/component/checkbox.d.ts +2 -0
- package/lib/checkbox/component/checkbox.js +15 -0
- package/lib/checkbox/component/index.d.ts +2 -0
- package/lib/checkbox/component/index.js +17 -0
- package/lib/checkbox/component/use-checkbox.d.ts +12 -0
- package/lib/checkbox/component/use-checkbox.js +50 -0
- package/lib/checkbox/component/utils.d.ts +13 -0
- package/lib/checkbox/component/utils.js +47 -0
- package/lib/checkbox/index.d.ts +2 -0
- package/lib/checkbox/index.js +27 -0
- package/lib/checkbox/style/index.d.ts +5 -0
- package/lib/checkbox/style/index.js +18 -0
- package/lib/checkbox/type/index.d.ts +18 -0
- package/lib/checkbox/type/index.js +5 -0
- package/lib/config/index.d.ts +0 -0
- package/lib/config/index.js +1 -0
- package/lib/date-picker/component/index.d.ts +3 -0
- package/lib/date-picker/component/index.js +46 -0
- package/lib/date-picker/index.d.ts +2 -0
- package/lib/date-picker/index.js +27 -0
- package/lib/date-picker/style/index.d.ts +4 -0
- package/lib/date-picker/style/index.js +14 -0
- package/lib/date-picker/type/index.d.ts +21 -0
- package/lib/date-picker/type/index.js +5 -0
- package/lib/empty/component/index.d.ts +2 -0
- package/lib/empty/component/index.js +24 -0
- package/lib/empty/index.d.ts +2 -0
- package/lib/empty/index.js +27 -0
- package/lib/empty/type/index.d.ts +9 -0
- package/lib/empty/type/index.js +5 -0
- package/lib/form/component/constant.d.ts +15 -0
- package/lib/form/component/constant.js +21 -0
- package/lib/form/component/form-content.d.ts +10 -0
- package/lib/form/component/form-content.js +288 -0
- package/lib/form/component/form-item-map.d.ts +40 -0
- package/lib/form/component/form-item-map.js +128 -0
- package/lib/form/component/form-item.d.ts +7 -0
- package/lib/form/component/form-item.js +227 -0
- package/lib/form/component/form-list.d.ts +36 -0
- package/lib/form/component/form-list.js +201 -0
- package/lib/form/component/form.d.ts +2 -0
- package/lib/form/component/form.js +47 -0
- package/lib/form/component/index.d.ts +15 -0
- package/lib/form/component/index.js +20 -0
- package/lib/form/component/submit-button.d.ts +2 -0
- package/lib/form/component/submit-button.js +54 -0
- package/lib/form/component/use-debug.d.ts +1 -0
- package/lib/form/component/use-debug.js +22 -0
- package/lib/form/component/utils.d.ts +95 -0
- package/lib/form/component/utils.js +467 -0
- package/lib/form/component/validator-item.d.ts +7 -0
- package/lib/form/component/validator-item.js +60 -0
- package/lib/form/hook/index.d.ts +16 -0
- package/lib/form/hook/index.js +163 -0
- package/lib/form/hook/list-provider.d.ts +6 -0
- package/lib/form/hook/list-provider.js +24 -0
- package/lib/form/hook/provider.d.ts +23 -0
- package/lib/form/hook/provider.js +30 -0
- package/lib/form/hook/use-form.d.ts +2 -0
- package/lib/form/hook/use-form.js +342 -0
- package/lib/form/index.d.ts +3 -0
- package/lib/form/index.js +38 -0
- package/lib/form/style/form-item.d.ts +3 -0
- package/lib/form/style/form-item.js +46 -0
- package/lib/form/style/index.d.ts +7 -0
- package/lib/form/style/index.js +32 -0
- package/lib/form/type/form-item.d.ts +141 -0
- package/lib/form/type/form-item.js +5 -0
- package/lib/form/type/form-list.d.ts +91 -0
- package/lib/form/type/form-list.js +5 -0
- package/lib/form/type/index.d.ts +134 -0
- package/lib/form/type/index.js +27 -0
- package/lib/grid/component/index.d.ts +2 -0
- package/lib/grid/component/index.js +83 -0
- package/lib/grid/component/pagination.d.ts +50 -0
- package/lib/grid/component/pagination.js +62 -0
- package/lib/grid/component/utils.d.ts +2 -0
- package/lib/grid/component/utils.js +14 -0
- package/lib/grid/index.d.ts +2 -0
- package/lib/grid/index.js +27 -0
- package/lib/grid/style/index.d.ts +11 -0
- package/lib/grid/style/index.js +33 -0
- package/lib/grid/type/index.d.ts +67 -0
- package/lib/grid/type/index.js +5 -0
- package/lib/highlight-text/component/index.d.ts +2 -0
- package/lib/highlight-text/component/index.js +78 -0
- package/lib/highlight-text/index.d.ts +2 -0
- package/lib/highlight-text/index.js +27 -0
- package/lib/highlight-text/style/index.d.ts +4 -0
- package/lib/highlight-text/style/index.js +14 -0
- package/lib/highlight-text/type/index.d.ts +18 -0
- package/lib/highlight-text/type/index.js +5 -0
- package/lib/hooks/hook/common.d.ts +1 -0
- package/lib/hooks/hook/common.js +18 -0
- package/lib/hooks/hook/index.d.ts +7 -0
- package/lib/hooks/hook/index.js +82 -0
- package/lib/hooks/hook/use-debounce.d.ts +4 -0
- package/lib/hooks/hook/use-debounce.js +32 -0
- package/lib/hooks/hook/use-deep.d.ts +9 -0
- package/lib/hooks/hook/use-deep.js +76 -0
- package/lib/hooks/hook/use-fetch.d.ts +8 -0
- package/lib/hooks/hook/use-fetch.js +171 -0
- package/lib/hooks/hook/use-list-operation.d.ts +5 -0
- package/lib/hooks/hook/use-list-operation.js +80 -0
- package/lib/hooks/hook/use-loading.d.ts +7 -0
- package/lib/hooks/hook/use-loading.js +66 -0
- package/lib/hooks/hook/use-window-resize.d.ts +5 -0
- package/lib/hooks/hook/use-window-resize.js +22 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +27 -0
- package/lib/hooks/type/index.d.ts +2 -0
- package/lib/hooks/type/index.js +27 -0
- package/lib/hooks/type/use-fetch.d.ts +31 -0
- package/lib/hooks/type/use-fetch.js +5 -0
- package/lib/hooks/type/use-list-operation.d.ts +34 -0
- package/lib/hooks/type/use-list-operation.js +5 -0
- package/lib/icon/component/down.d.ts +2 -0
- package/lib/icon/component/down.js +50 -0
- package/lib/icon/component/index.d.ts +2 -0
- package/lib/icon/component/index.js +27 -0
- package/lib/icon/component/up.d.ts +2 -0
- package/lib/icon/component/up.js +49 -0
- package/lib/icon/hook/index.d.ts +477 -0
- package/lib/icon/hook/index.js +67 -0
- package/lib/icon/index.d.ts +2 -0
- package/lib/icon/index.js +27 -0
- package/lib/icon/style/index.d.ts +4 -0
- package/lib/icon/style/index.js +17 -0
- package/lib/icon/type/index.d.ts +14 -0
- package/lib/icon/type/index.js +5 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.js +345 -0
- package/lib/input/component/index.d.ts +12 -0
- package/lib/input/component/index.js +33 -0
- package/lib/input/component/input.d.ts +2 -0
- package/lib/input/component/input.js +15 -0
- package/lib/input/component/number.d.ts +4 -0
- package/lib/input/component/number.js +57 -0
- package/lib/input/component/password.d.ts +2 -0
- package/lib/input/component/password.js +15 -0
- package/lib/input/component/text-area.d.ts +2 -0
- package/lib/input/component/text-area.js +23 -0
- package/lib/input/component/utils.d.ts +15 -0
- package/lib/input/component/utils.js +114 -0
- package/lib/input/index.d.ts +2 -0
- package/lib/input/index.js +27 -0
- package/lib/input/style/index.d.ts +6 -0
- package/lib/input/style/index.js +18 -0
- package/lib/input/type/index.d.ts +41 -0
- package/lib/input/type/index.js +5 -0
- package/lib/modal-prompt/component/index.d.ts +5 -0
- package/lib/modal-prompt/component/index.js +85 -0
- package/lib/modal-prompt/component/open-loading.d.ts +2 -0
- package/lib/modal-prompt/component/open-loading.js +28 -0
- package/lib/modal-prompt/component/utils.d.ts +4 -0
- package/lib/modal-prompt/component/utils.js +57 -0
- package/lib/modal-prompt/index.d.ts +2 -0
- package/lib/modal-prompt/index.js +27 -0
- package/lib/modal-prompt/style/index.d.ts +5 -0
- package/lib/modal-prompt/style/index.js +16 -0
- package/lib/modal-prompt/type/index.d.ts +36 -0
- package/lib/modal-prompt/type/index.js +5 -0
- package/lib/open-modal/component/constant.d.ts +1 -0
- package/lib/open-modal/component/constant.js +10 -0
- package/lib/open-modal/component/footer.d.ts +2 -0
- package/lib/open-modal/component/footer.js +41 -0
- package/lib/open-modal/component/index.d.ts +4 -0
- package/lib/open-modal/component/index.js +30 -0
- package/lib/open-modal/component/modal.d.ts +10 -0
- package/lib/open-modal/component/modal.js +44 -0
- package/lib/open-modal/component/title.d.ts +6 -0
- package/lib/open-modal/component/title.js +18 -0
- package/lib/open-modal/component/use-modal.d.ts +14 -0
- package/lib/open-modal/component/use-modal.js +184 -0
- package/lib/open-modal/component/utils.d.ts +11 -0
- package/lib/open-modal/component/utils.js +117 -0
- package/lib/open-modal/hook/index.d.ts +7 -0
- package/lib/open-modal/hook/index.js +40 -0
- package/lib/open-modal/hook/use-modal.d.ts +6 -0
- package/lib/open-modal/hook/use-modal.js +34 -0
- package/lib/open-modal/index.d.ts +3 -0
- package/lib/open-modal/index.js +38 -0
- package/lib/open-modal/style/index.d.ts +5 -0
- package/lib/open-modal/style/index.js +25 -0
- package/lib/open-modal/style/wrap.d.ts +2 -0
- package/lib/open-modal/style/wrap.js +13 -0
- package/lib/open-modal/type/index.d.ts +91 -0
- package/lib/open-modal/type/index.js +5 -0
- package/lib/portal/component/index.d.ts +2 -0
- package/lib/portal/component/index.js +47 -0
- package/lib/portal/index.d.ts +2 -0
- package/lib/portal/index.js +27 -0
- package/lib/portal/type/index.d.ts +13 -0
- package/lib/portal/type/index.js +5 -0
- package/lib/radio/component/abstract-box.d.ts +380 -0
- package/lib/radio/component/abstract-box.js +98 -0
- package/lib/radio/component/index.d.ts +2 -0
- package/lib/radio/component/index.js +17 -0
- package/lib/radio/component/radio.d.ts +2 -0
- package/lib/radio/component/radio.js +17 -0
- package/lib/radio/component/redio-group.d.ts +2 -0
- package/lib/radio/component/redio-group.js +57 -0
- package/lib/radio/component/use-box-options.d.ts +6 -0
- package/lib/radio/component/use-box-options.js +27 -0
- package/lib/radio/component/use-radio.d.ts +23 -0
- package/lib/radio/component/use-radio.js +28 -0
- package/lib/radio/component/utils.d.ts +7 -0
- package/lib/radio/component/utils.js +33 -0
- package/lib/radio/index.d.ts +2 -0
- package/lib/radio/index.js +27 -0
- package/lib/radio/style/index.d.ts +7 -0
- package/lib/radio/style/index.js +22 -0
- package/lib/radio/type/index.d.ts +32 -0
- package/lib/radio/type/index.js +5 -0
- package/lib/select/component/constant.d.ts +1 -0
- package/lib/select/component/constant.js +7 -0
- package/lib/select/component/index.d.ts +3 -0
- package/lib/select/component/index.js +29 -0
- package/lib/select/component/loading.d.ts +1 -0
- package/lib/select/component/loading.js +20 -0
- package/lib/select/component/use-select-options.d.ts +11 -0
- package/lib/select/component/use-select-options.js +88 -0
- package/lib/select/component/use-select.d.ts +2 -0
- package/lib/select/component/use-select.js +143 -0
- package/lib/select/component/utils.d.ts +14 -0
- package/lib/select/component/utils.js +152 -0
- package/lib/select/index.d.ts +2 -0
- package/lib/select/index.js +27 -0
- package/lib/select/style/index.d.ts +4 -0
- package/lib/select/style/index.js +14 -0
- package/lib/select/type/index.d.ts +105 -0
- package/lib/select/type/index.js +5 -0
- package/lib/stack/component/center-stack.d.ts +2 -0
- package/lib/stack/component/center-stack.js +39 -0
- package/lib/stack/component/h-stack.d.ts +2 -0
- package/lib/stack/component/h-stack.js +46 -0
- package/lib/stack/component/index.d.ts +3 -0
- package/lib/stack/component/index.js +38 -0
- package/lib/stack/component/v-stack.d.ts +2 -0
- package/lib/stack/component/v-stack.js +43 -0
- package/lib/stack/index.d.ts +2 -0
- package/lib/stack/index.js +27 -0
- package/lib/stack/style/index.d.ts +21 -0
- package/lib/stack/style/index.js +59 -0
- package/lib/stack/type/index.d.ts +54 -0
- package/lib/stack/type/index.js +5 -0
- package/lib/switch/component/index.d.ts +2 -0
- package/lib/switch/component/index.js +67 -0
- package/lib/switch/index.d.ts +2 -0
- package/lib/switch/index.js +27 -0
- package/lib/switch/style/index.d.ts +5 -0
- package/lib/switch/style/index.js +20 -0
- package/lib/switch/type/index.d.ts +27 -0
- package/lib/switch/type/index.js +5 -0
- package/lib/table/component/action-button.d.ts +2 -0
- package/lib/table/component/action-button.js +102 -0
- package/lib/table/component/actions.d.ts +2 -0
- package/lib/table/component/actions.js +42 -0
- package/lib/table/component/constant.d.ts +1 -0
- package/lib/table/component/constant.js +12 -0
- package/lib/table/component/editor.d.ts +2 -0
- package/lib/table/component/editor.js +42 -0
- package/lib/table/component/filter.d.ts +3 -0
- package/lib/table/component/filter.js +62 -0
- package/lib/table/component/index.d.ts +7 -0
- package/lib/table/component/index.js +10 -0
- package/lib/table/component/link.d.ts +2 -0
- package/lib/table/component/link.js +27 -0
- package/lib/table/component/sort.d.ts +6 -0
- package/lib/table/component/sort.js +24 -0
- package/lib/table/component/switch.d.ts +2 -0
- package/lib/table/component/switch.js +34 -0
- package/lib/table/component/table-body.d.ts +6 -0
- package/lib/table/component/table-body.js +95 -0
- package/lib/table/component/table.d.ts +10 -0
- package/lib/table/component/table.js +243 -0
- package/lib/table/component/time.d.ts +2 -0
- package/lib/table/component/time.js +19 -0
- package/lib/table/component/utils.d.ts +120 -0
- package/lib/table/component/utils.js +235 -0
- package/lib/table/component/wrapper.d.ts +6 -0
- package/lib/table/component/wrapper.js +37 -0
- package/lib/table/hook/index.d.ts +7 -0
- package/lib/table/hook/index.js +40 -0
- package/lib/table/hook/search.d.ts +5 -0
- package/lib/table/hook/search.js +138 -0
- package/lib/table/index.d.ts +3 -0
- package/lib/table/index.js +38 -0
- package/lib/table/style/index.d.ts +9 -0
- package/lib/table/style/index.js +23 -0
- package/lib/table/type/action.d.ts +48 -0
- package/lib/table/type/action.js +5 -0
- package/lib/table/type/column.d.ts +110 -0
- package/lib/table/type/column.js +5 -0
- package/lib/table/type/index.d.ts +113 -0
- package/lib/table/type/index.js +27 -0
- package/lib/tabs/component/constant.d.ts +2 -0
- package/lib/tabs/component/constant.js +8 -0
- package/lib/tabs/component/index.d.ts +2 -0
- package/lib/tabs/component/index.js +25 -0
- package/lib/tabs/component/utils.d.ts +24 -0
- package/lib/tabs/component/utils.js +63 -0
- package/lib/tabs/index.d.ts +2 -0
- package/lib/tabs/index.js +27 -0
- package/lib/tabs/style/index.d.ts +5 -0
- package/lib/tabs/style/index.js +17 -0
- package/lib/tabs/type/index.d.ts +20 -0
- package/lib/tabs/type/index.js +5 -0
- package/lib/text/component/index.d.ts +3 -0
- package/lib/text/component/index.js +78 -0
- package/lib/text/component/use-text.d.ts +4 -0
- package/lib/text/component/use-text.js +31 -0
- package/lib/text/component/utils.d.ts +3 -0
- package/lib/text/component/utils.js +15 -0
- package/lib/text/index.d.ts +2 -0
- package/lib/text/index.js +27 -0
- package/lib/text/style/index.d.ts +5 -0
- package/lib/text/style/index.js +15 -0
- package/lib/text/type/index.d.ts +19 -0
- package/lib/text/type/index.js +5 -0
- package/lib/tooltip/component/index.d.ts +48 -0
- package/lib/tooltip/component/index.js +28 -0
- package/lib/tooltip/index.d.ts +2 -0
- package/lib/tooltip/index.js +27 -0
- package/lib/tooltip/type/index.d.ts +8 -0
- package/lib/tooltip/type/index.js +5 -0
- package/lib/tree/component/index.d.ts +2 -0
- package/lib/tree/component/index.js +30 -0
- package/lib/tree/component/utils.d.ts +1 -0
- package/lib/tree/component/utils.js +9 -0
- package/lib/tree/index.d.ts +2 -0
- package/lib/tree/index.js +27 -0
- package/lib/tree/style/index.d.ts +4 -0
- package/lib/tree/style/index.js +14 -0
- package/lib/tree/type/index.d.ts +2 -0
- package/lib/tree/type/index.js +5 -0
- package/lib/tree-select/component/index.d.ts +2 -0
- package/lib/tree-select/component/index.js +22 -0
- package/lib/tree-select/component/use-tree-select.d.ts +2 -0
- package/lib/tree-select/component/use-tree-select.js +66 -0
- package/lib/tree-select/index.d.ts +2 -0
- package/lib/tree-select/index.js +27 -0
- package/lib/tree-select/style/index.d.ts +5 -0
- package/lib/tree-select/style/index.js +22 -0
- package/lib/tree-select/type/index.d.ts +23 -0
- package/lib/tree-select/type/index.js +5 -0
- package/lib/virtual-list/component/index.d.ts +2 -0
- package/lib/virtual-list/component/index.js +35 -0
- package/lib/virtual-list/index.d.ts +2 -0
- package/lib/virtual-list/index.js +27 -0
- package/lib/virtual-list/type/index.d.ts +17 -0
- package/lib/virtual-list/type/index.js +5 -0
- package/package.json +147 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
useFormValueChange: true,
|
|
9
|
+
useValidateForm: true,
|
|
10
|
+
useValidateNotExistValue: true
|
|
11
|
+
};
|
|
12
|
+
exports.useFormValueChange = useFormValueChange;
|
|
13
|
+
exports.useValidateForm = useValidateForm;
|
|
14
|
+
exports.useValidateNotExistValue = useValidateNotExistValue;
|
|
15
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
20
|
+
var _ = require("./..");
|
|
21
|
+
var _formItemMap = require("../component/form-item-map");
|
|
22
|
+
var _hooks = require("../../hooks");
|
|
23
|
+
var _react = require("react");
|
|
24
|
+
var _constant = require("../component/constant");
|
|
25
|
+
var _utils = require("../component/utils");
|
|
26
|
+
var _listProvider = require("./list-provider");
|
|
27
|
+
Object.keys(_listProvider).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
30
|
+
if (key in exports && exports[key] === _listProvider[key]) return;
|
|
31
|
+
Object.defineProperty(exports, key, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function get() {
|
|
34
|
+
return _listProvider[key];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var _provider = require("./provider");
|
|
39
|
+
Object.keys(_provider).forEach(function (key) {
|
|
40
|
+
if (key === "default" || key === "__esModule") return;
|
|
41
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
42
|
+
if (key in exports && exports[key] === _provider[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function get() {
|
|
46
|
+
return _provider[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _useForm = require("./use-form");
|
|
51
|
+
Object.keys(_useForm).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
54
|
+
if (key in exports && exports[key] === _useForm[key]) return;
|
|
55
|
+
Object.defineProperty(exports, key, {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function get() {
|
|
58
|
+
return _useForm[key];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
var _excluded = ["loading", "value", "options"];
|
|
63
|
+
function useFormValueChange(fn) {
|
|
64
|
+
var deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
65
|
+
var _useFormContext = (0, _.useFormContext)(),
|
|
66
|
+
values = _useFormContext.values;
|
|
67
|
+
var _useSafeState = (0, _hooks.useSafeState)(),
|
|
68
|
+
_useSafeState2 = (0, _slicedToArray2.default)(_useSafeState, 2),
|
|
69
|
+
result = _useSafeState2[0],
|
|
70
|
+
setResult = _useSafeState2[1];
|
|
71
|
+
(0, _hooks.useDeepEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
72
|
+
var res;
|
|
73
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
74
|
+
while (1) switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
_context.next = 2;
|
|
77
|
+
return fn(values);
|
|
78
|
+
case 2:
|
|
79
|
+
res = _context.sent;
|
|
80
|
+
setResult(res);
|
|
81
|
+
case 4:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
84
|
+
}
|
|
85
|
+
}, _callee);
|
|
86
|
+
})), [values].concat((0, _toConsumableArray2.default)(deps)));
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
function useValidateForm() {
|
|
90
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91
|
+
onValidate = _ref2.onValidate,
|
|
92
|
+
validateOnly = _ref2.validateOnly;
|
|
93
|
+
var _useFormContext2 = (0, _.useFormContext)(),
|
|
94
|
+
loading = _useFormContext2.loading,
|
|
95
|
+
form = _useFormContext2.form,
|
|
96
|
+
items = _useFormContext2.items,
|
|
97
|
+
values = _useFormContext2.values;
|
|
98
|
+
var _useSafeState3 = (0, _hooks.useSafeState)(false),
|
|
99
|
+
_useSafeState4 = (0, _slicedToArray2.default)(_useSafeState3, 2),
|
|
100
|
+
result = _useSafeState4[0],
|
|
101
|
+
setResult = _useSafeState4[1];
|
|
102
|
+
var validate = /*#__PURE__*/function () {
|
|
103
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
104
|
+
var _onValidate;
|
|
105
|
+
var isValid, customValidate, final;
|
|
106
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
107
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
108
|
+
case 0:
|
|
109
|
+
if (!(loading || (0, _utils.hasItemLoading)(items))) {
|
|
110
|
+
_context2.next = 2;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return _context2.abrupt("return");
|
|
114
|
+
case 2:
|
|
115
|
+
_context2.next = 4;
|
|
116
|
+
return form.callMethod(_constant.registerMethods.internalValidate);
|
|
117
|
+
case 4:
|
|
118
|
+
isValid = _context2.sent;
|
|
119
|
+
customValidate = (_onValidate = onValidate === null || onValidate === void 0 ? void 0 : onValidate(isValid, form)) !== null && _onValidate !== void 0 ? _onValidate : true;
|
|
120
|
+
final = customValidate && isValid;
|
|
121
|
+
if (!validateOnly) {
|
|
122
|
+
setResult(final);
|
|
123
|
+
}
|
|
124
|
+
case 8:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context2.stop();
|
|
127
|
+
}
|
|
128
|
+
}, _callee2);
|
|
129
|
+
}));
|
|
130
|
+
return function validate() {
|
|
131
|
+
return _ref3.apply(this, arguments);
|
|
132
|
+
};
|
|
133
|
+
}();
|
|
134
|
+
var onChangeDebounce = (0, _hooks.useDebounce)(validate, 100, {
|
|
135
|
+
leading: false
|
|
136
|
+
});
|
|
137
|
+
(0, _react.useEffect)(function () {
|
|
138
|
+
onChangeDebounce();
|
|
139
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
|
+
}, [values, loading, items]);
|
|
141
|
+
|
|
142
|
+
// 供 form.setError 使用
|
|
143
|
+
form.registerMethod(_constant.registerMethods.triggerValidate, onChangeDebounce);
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
function useValidateNotExistValue(_ref4) {
|
|
147
|
+
var loading = _ref4.loading,
|
|
148
|
+
value = _ref4.value,
|
|
149
|
+
options = _ref4.options,
|
|
150
|
+
props = (0, _objectWithoutProperties2.default)(_ref4, _excluded);
|
|
151
|
+
var _useFormContext3 = (0, _.useFormContext)(),
|
|
152
|
+
formLoading = _useFormContext3.loading;
|
|
153
|
+
var _useCollectFormItemSt = (0, _formItemMap.useCollectFormItemState)(props),
|
|
154
|
+
__callback__ = _useCollectFormItemSt.__callback__;
|
|
155
|
+
var params = {
|
|
156
|
+
options: options,
|
|
157
|
+
value: value,
|
|
158
|
+
loading: formLoading || loading
|
|
159
|
+
};
|
|
160
|
+
(0, _hooks.useDeepEffect)(function () {
|
|
161
|
+
__callback__(params);
|
|
162
|
+
}, [params]);
|
|
163
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormListContext } from "..";
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare function FormListProvider({ children, ...props }: FormListContext & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useFormListContext(): FormListContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FormListProvider = FormListProvider;
|
|
8
|
+
exports.useFormListContext = useFormListContext;
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
12
|
+
var _excluded = ["children"];
|
|
13
|
+
var FormListCtx = /*#__PURE__*/(0, _react.createContext)({});
|
|
14
|
+
function FormListProvider(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
17
|
+
return (0, _jsxRuntime.jsx)(FormListCtx.Provider, {
|
|
18
|
+
value: props,
|
|
19
|
+
children: children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function useFormListContext() {
|
|
23
|
+
return (0, _react.useContext)(FormListCtx);
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormInstance, FormItemContext, FormValues } from "..";
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface RemoveCollectOptions {
|
|
4
|
+
isFormList?: boolean;
|
|
5
|
+
isTableEditor?: boolean;
|
|
6
|
+
onlyResetLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface FormContext {
|
|
9
|
+
loading: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
form: FormInstance;
|
|
12
|
+
values: FormValues;
|
|
13
|
+
items: FormItemContext[];
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
__collect__(item: FormItemContext): void;
|
|
17
|
+
__removeCollect__(name: string, options?: RemoveCollectOptions): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function FormProvider({ children, ...props }: FormContext & {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function useFormContext<T>(): T & FormContext;
|
|
23
|
+
export declare function useFormValue(): FormValues;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FormProvider = FormProvider;
|
|
8
|
+
exports.useFormContext = useFormContext;
|
|
9
|
+
exports.useFormValue = useFormValue;
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
13
|
+
var _excluded = ["children"];
|
|
14
|
+
var FormCtx = /*#__PURE__*/(0, _react.createContext)({});
|
|
15
|
+
function FormProvider(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
18
|
+
return (0, _jsxRuntime.jsx)(FormCtx.Provider, {
|
|
19
|
+
value: props,
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function useFormContext() {
|
|
24
|
+
return (0, _react.useContext)(FormCtx);
|
|
25
|
+
}
|
|
26
|
+
function useFormValue() {
|
|
27
|
+
var _useFormContext = useFormContext(),
|
|
28
|
+
values = _useFormContext.values;
|
|
29
|
+
return values;
|
|
30
|
+
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useForm = useForm;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _api = require("../../api");
|
|
12
|
+
var _antd = require("antd");
|
|
13
|
+
var _delay = _interopRequireDefault(require("delay"));
|
|
14
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
|
+
var _reactUse = require("react-use");
|
|
16
|
+
var _constant = require("../component/constant");
|
|
17
|
+
var _utils = require("../component/utils");
|
|
18
|
+
var pathMap = {
|
|
19
|
+
initForm: '__INTERNAL__.initForm',
|
|
20
|
+
name: '__INTERNAL__.name',
|
|
21
|
+
items: '__INTERNAL__.items',
|
|
22
|
+
itemsStatus: '__INTERNAL__.itemsStatus',
|
|
23
|
+
loading: '__INTERNAL__.loading',
|
|
24
|
+
errors: '__INTERNAL__.errors',
|
|
25
|
+
methods: '__INTERNAL__.methods'
|
|
26
|
+
};
|
|
27
|
+
function useForm() {
|
|
28
|
+
var form = _antd.Form.useForm()[0];
|
|
29
|
+
var update = (0, _reactUse.useUpdate)();
|
|
30
|
+
|
|
31
|
+
// 防止重复初始化
|
|
32
|
+
if (_lodash.default.get(form, pathMap.initForm)) {
|
|
33
|
+
return form;
|
|
34
|
+
}
|
|
35
|
+
_lodash.default.set(form, pathMap.initForm, true);
|
|
36
|
+
var methods = [registerAndCallMethod, updateForm, setError, setValue, getValue, validate, reset, submit, getName, processFormItems, processFormItemsStatus, getFieldInstance, getFormList, focus];
|
|
37
|
+
methods.forEach(function (fn) {
|
|
38
|
+
return fn(form, update);
|
|
39
|
+
});
|
|
40
|
+
return form;
|
|
41
|
+
}
|
|
42
|
+
function registerAndCallMethod(form) {
|
|
43
|
+
var path = pathMap.methods;
|
|
44
|
+
form.registerMethod = function (name, fn) {
|
|
45
|
+
_lodash.default.set(form, "".concat(path, ".").concat(name), fn);
|
|
46
|
+
};
|
|
47
|
+
form.callMethod = function (name) {
|
|
48
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
49
|
+
args[_key - 1] = arguments[_key];
|
|
50
|
+
}
|
|
51
|
+
return _lodash.default.invoke.apply(_lodash.default, [form, "".concat(path, ".").concat(name)].concat(args));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function getValue(form) {
|
|
55
|
+
form.getValue = function (name) {
|
|
56
|
+
var path = (0, _utils.transformNameToPath)(name);
|
|
57
|
+
return path ? form.getFieldValue(path) : form.getFieldsValue(true);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function setError(form) {
|
|
61
|
+
form.setError = /*#__PURE__*/function () {
|
|
62
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nameOrParams, message) {
|
|
63
|
+
var errors, internalErrors;
|
|
64
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
65
|
+
while (1) switch (_context.prev = _context.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
_context.next = 2;
|
|
68
|
+
return (0, _api.wait)(function () {
|
|
69
|
+
return !form.callMethod(_constant.registerMethods.getLoading);
|
|
70
|
+
});
|
|
71
|
+
case 2:
|
|
72
|
+
errors = [];
|
|
73
|
+
if (_lodash.default.isString(nameOrParams) || _lodash.default.isArray(nameOrParams)) {
|
|
74
|
+
errors.push({
|
|
75
|
+
name: (0, _utils.transformNameToPath)(nameOrParams),
|
|
76
|
+
errors: [message || '']
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
errors = _lodash.default.map(nameOrParams, function (value, name) {
|
|
80
|
+
return {
|
|
81
|
+
name: (0, _utils.transformNameToPath)(name),
|
|
82
|
+
errors: [value]
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
form.setFields(errors);
|
|
87
|
+
|
|
88
|
+
// 暂存 errors, 实时校验需要获取 errors
|
|
89
|
+
internalErrors = getInternalErrors(form);
|
|
90
|
+
_lodash.default.forEach(errors, function (error) {
|
|
91
|
+
return _lodash.default.set(internalErrors, error.name, error.errors[0]);
|
|
92
|
+
});
|
|
93
|
+
form.callMethod(_constant.registerMethods.triggerValidate);
|
|
94
|
+
case 8:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}));
|
|
100
|
+
return function (_x, _x2) {
|
|
101
|
+
return _ref.apply(this, arguments);
|
|
102
|
+
};
|
|
103
|
+
}();
|
|
104
|
+
form.registerMethod(_constant.registerMethods.getInternalErrors, function (name) {
|
|
105
|
+
var internalErrors = getInternalErrors(form);
|
|
106
|
+
return _lodash.default.get(internalErrors, name);
|
|
107
|
+
});
|
|
108
|
+
form.registerMethod(_constant.registerMethods.resetInternalError, function (name) {
|
|
109
|
+
var internalErrors = getInternalErrors(form);
|
|
110
|
+
if (name) {
|
|
111
|
+
_lodash.default.unset(internalErrors, name);
|
|
112
|
+
} else {
|
|
113
|
+
_lodash.default.set(form, pathMap.errors, {});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// reset itemsStatus
|
|
117
|
+
form.callMethod(_constant.registerMethods.setItemsStatus, name);
|
|
118
|
+
});
|
|
119
|
+
form.resetError = function (name) {
|
|
120
|
+
var nameList = _lodash.default.castArray(name);
|
|
121
|
+
var fields = nameList.map(function (x) {
|
|
122
|
+
return {
|
|
123
|
+
name: (0, _utils.transformNameToPath)(x),
|
|
124
|
+
errors: []
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
form.setFields(fields);
|
|
128
|
+
_lodash.default.forEach(nameList, function (name) {
|
|
129
|
+
return form.callMethod(_constant.registerMethods.resetInternalError, name);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function getInternalErrors(form) {
|
|
134
|
+
var errors = _lodash.default.get(form, pathMap.errors);
|
|
135
|
+
if (errors) {
|
|
136
|
+
return errors;
|
|
137
|
+
}
|
|
138
|
+
var defaultErrors = {};
|
|
139
|
+
_lodash.default.set(form, pathMap.errors, defaultErrors);
|
|
140
|
+
return defaultErrors;
|
|
141
|
+
}
|
|
142
|
+
function setValue(form, update) {
|
|
143
|
+
form.setValue = function (nameOrParams, value) {
|
|
144
|
+
if (_lodash.default.isString(nameOrParams) || _lodash.default.isArray(nameOrParams)) {
|
|
145
|
+
var name = (0, _utils.transformNameToPath)(nameOrParams);
|
|
146
|
+
// 该方法会替换 Value
|
|
147
|
+
form.setFieldValue(name, value);
|
|
148
|
+
} else {
|
|
149
|
+
var values = (0, _utils.transformKeyToPath)(nameOrParams);
|
|
150
|
+
// 该方法会 Merge Value,同时会清空状态
|
|
151
|
+
form.setFieldsValue(values);
|
|
152
|
+
}
|
|
153
|
+
update();
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function validate(form) {
|
|
157
|
+
form.validate = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
158
|
+
var _len2,
|
|
159
|
+
args,
|
|
160
|
+
_key2,
|
|
161
|
+
_args2 = arguments;
|
|
162
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
163
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
164
|
+
case 0:
|
|
165
|
+
_context2.next = 2;
|
|
166
|
+
return (0, _api.wait)(function () {
|
|
167
|
+
return !form.callMethod(_constant.registerMethods.getLoading);
|
|
168
|
+
});
|
|
169
|
+
case 2:
|
|
170
|
+
for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
171
|
+
args[_key2] = _args2[_key2];
|
|
172
|
+
}
|
|
173
|
+
return _context2.abrupt("return", form.callMethod.apply(form, [_constant.registerMethods.internalValidate].concat(args)));
|
|
174
|
+
case 4:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context2.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee2);
|
|
179
|
+
}));
|
|
180
|
+
form.registerMethod(_constant.registerMethods.internalValidate, /*#__PURE__*/function () {
|
|
181
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(name, options) {
|
|
182
|
+
var path, nameList;
|
|
183
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
|
184
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
185
|
+
case 0:
|
|
186
|
+
_context3.prev = 0;
|
|
187
|
+
if (!name) {
|
|
188
|
+
_context3.next = 8;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
path = (0, _utils.transformNameToPath)(name);
|
|
192
|
+
nameList = _lodash.default.isString(name) ? [path] : path;
|
|
193
|
+
_context3.next = 6;
|
|
194
|
+
return form.validateFields(nameList, options);
|
|
195
|
+
case 6:
|
|
196
|
+
_context3.next = 10;
|
|
197
|
+
break;
|
|
198
|
+
case 8:
|
|
199
|
+
_context3.next = 10;
|
|
200
|
+
return form.validateFields((0, _objectSpread2.default)({
|
|
201
|
+
validateOnly: true
|
|
202
|
+
}, options));
|
|
203
|
+
case 10:
|
|
204
|
+
return _context3.abrupt("return", true);
|
|
205
|
+
case 13:
|
|
206
|
+
_context3.prev = 13;
|
|
207
|
+
_context3.t0 = _context3["catch"](0);
|
|
208
|
+
form.callMethod(_constant.registerMethods.onValidateFailed, (0, _utils.parseFormFailedError)(_context3.t0));
|
|
209
|
+
return _context3.abrupt("return", false);
|
|
210
|
+
case 17:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context3.stop();
|
|
213
|
+
}
|
|
214
|
+
}, _callee3, null, [[0, 13]]);
|
|
215
|
+
}));
|
|
216
|
+
return function (_x3, _x4) {
|
|
217
|
+
return _ref3.apply(this, arguments);
|
|
218
|
+
};
|
|
219
|
+
}());
|
|
220
|
+
}
|
|
221
|
+
function reset(form) {
|
|
222
|
+
form.reset = function (name) {
|
|
223
|
+
if (name) {
|
|
224
|
+
var path = (0, _utils.transformNameToPath)(name);
|
|
225
|
+
var nameList = _lodash.default.isString(name) ? [path] : path;
|
|
226
|
+
_lodash.default.forEach(nameList, function (name) {
|
|
227
|
+
return form.callMethod(_constant.registerMethods.resetInternalError, name);
|
|
228
|
+
});
|
|
229
|
+
form.resetFields(nameList);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
form.callMethod(_constant.registerMethods.resetInternalError);
|
|
233
|
+
form.resetFields();
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function submit(form) {
|
|
237
|
+
var originalSubmit = form.submit;
|
|
238
|
+
form.submit = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
|
239
|
+
var err;
|
|
240
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
|
241
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
_context4.prev = 0;
|
|
244
|
+
originalSubmit();
|
|
245
|
+
// 修复submit和validateFields同时调用时,某种场景会出现的bug
|
|
246
|
+
_context4.next = 4;
|
|
247
|
+
return (0, _delay.default)(20);
|
|
248
|
+
case 4:
|
|
249
|
+
_context4.next = 6;
|
|
250
|
+
return form.validateFields();
|
|
251
|
+
case 6:
|
|
252
|
+
return _context4.abrupt("return", form.getValue());
|
|
253
|
+
case 9:
|
|
254
|
+
_context4.prev = 9;
|
|
255
|
+
_context4.t0 = _context4["catch"](0);
|
|
256
|
+
err = (0, _utils.parseFormFailedError)(_context4.t0);
|
|
257
|
+
return _context4.abrupt("return", Promise.reject(err));
|
|
258
|
+
case 13:
|
|
259
|
+
case "end":
|
|
260
|
+
return _context4.stop();
|
|
261
|
+
}
|
|
262
|
+
}, _callee4, null, [[0, 9]]);
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
function updateForm(form, update) {
|
|
266
|
+
form.update = update;
|
|
267
|
+
}
|
|
268
|
+
function getName(form) {
|
|
269
|
+
var id = (0, _api.runDevOrJest)(_lodash.default.uniqueId('form_'), 'form');
|
|
270
|
+
var path = pathMap.name;
|
|
271
|
+
_lodash.default.set(form, path, id);
|
|
272
|
+
form.getName = function () {
|
|
273
|
+
return _lodash.default.get(form, path);
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function processFormItems(form) {
|
|
277
|
+
var path = pathMap.items;
|
|
278
|
+
form.setItems = function (items) {
|
|
279
|
+
return _lodash.default.set(form, path, items);
|
|
280
|
+
};
|
|
281
|
+
form.getItems = function (name) {
|
|
282
|
+
var items = _lodash.default.get(form, path) || [];
|
|
283
|
+
if (name) {
|
|
284
|
+
var namePath = (0, _utils.transformPathToName)(name);
|
|
285
|
+
return _lodash.default.find(items, function (item) {
|
|
286
|
+
return (0, _utils.transformPathToName)(item.name) === namePath;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
return items;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function processFormItemsStatus(form) {
|
|
293
|
+
var path = pathMap.itemsStatus;
|
|
294
|
+
form.registerMethod(_constant.registerMethods.setItemsStatus, function (name, errors) {
|
|
295
|
+
if (!name) {
|
|
296
|
+
return _lodash.default.set(form, path, {});
|
|
297
|
+
}
|
|
298
|
+
var namePath = (0, _utils.transformPathToName)(name);
|
|
299
|
+
var fullPath = "".concat(path, ".").concat(namePath);
|
|
300
|
+
if (_lodash.default.isEmpty(errors)) {
|
|
301
|
+
return _lodash.default.unset(form, fullPath);
|
|
302
|
+
}
|
|
303
|
+
_lodash.default.set(form, fullPath, errors);
|
|
304
|
+
});
|
|
305
|
+
form.registerMethod(_constant.registerMethods.getItemsStatus, function (name) {
|
|
306
|
+
var namePath = (0, _utils.transformPathToName)(name);
|
|
307
|
+
var fullPath = name ? "".concat(path, ".").concat(namePath) : path;
|
|
308
|
+
var errors = _lodash.default.get(form, fullPath);
|
|
309
|
+
return removeEmptyError(errors);
|
|
310
|
+
});
|
|
311
|
+
form.getError = function (name) {
|
|
312
|
+
return form.callMethod(_constant.registerMethods.getItemsStatus, name);
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function removeEmptyError(error) {
|
|
316
|
+
if (!_lodash.default.isPlainObject(error)) {
|
|
317
|
+
return error;
|
|
318
|
+
}
|
|
319
|
+
var processed = _lodash.default.mapValues(error, removeEmptyError);
|
|
320
|
+
return _lodash.default.omitBy(processed, _lodash.default.isEmpty);
|
|
321
|
+
}
|
|
322
|
+
function getFieldInstance(form) {
|
|
323
|
+
form.getFieldInstance = function (name) {
|
|
324
|
+
var _form$getItems;
|
|
325
|
+
return (_form$getItems = form.getItems(name)) === null || _form$getItems === void 0 ? void 0 : _form$getItems.refs.current;
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function getFormList(form) {
|
|
329
|
+
// @ts-ignore
|
|
330
|
+
form.getFormList = function (name) {
|
|
331
|
+
var list = (0, _lodash.default)(form.getItems()).map('formListContext').compact().unionBy('name').value();
|
|
332
|
+
return name ? _lodash.default.find(list, {
|
|
333
|
+
name: name
|
|
334
|
+
}) : list;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function focus(form) {
|
|
338
|
+
form.focus = function (name, option) {
|
|
339
|
+
var _form$getFieldInstanc;
|
|
340
|
+
(_form$getFieldInstanc = form.getFieldInstance(name)) === null || _form$getFieldInstanc === void 0 || _form$getFieldInstanc.focus(option);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _component = require("./component");
|
|
7
|
+
Object.keys(_component).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _component[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _component[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _hook = require("./hook");
|
|
18
|
+
Object.keys(_hook).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _hook[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _hook[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _type = require("./type");
|
|
29
|
+
Object.keys(_type).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _type[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _type[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FormItemProps, FormItemPropsWithType } from "..";
|
|
2
|
+
export declare function getFormItemWidth({ width, type }: FormItemPropsWithType): string | number | undefined;
|
|
3
|
+
export declare function getFormItemStyle({ labelWidth, controlWidth, requiredMark, layout, type, ...props }: FormItemProps): string;
|