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,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useModal = useModal;
|
|
8
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
var _form = require("../../form");
|
|
14
|
+
var _delay = _interopRequireDefault(require("delay"));
|
|
15
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
16
|
+
var _react = require("react");
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
var _excluded = ["disableButtonOnValidateFailure"],
|
|
19
|
+
_excluded2 = ["onValidate"],
|
|
20
|
+
_excluded3 = ["context"],
|
|
21
|
+
_excluded4 = ["unmount", "onOk", "onCancel"];
|
|
22
|
+
function useModalAndFormProps(props) {
|
|
23
|
+
var form = (0, _form.useForm)();
|
|
24
|
+
var _getModalAndFormProps = (0, _utils.getModalAndFormProps)(props),
|
|
25
|
+
_getModalAndFormProps2 = _getModalAndFormProps.modalProps,
|
|
26
|
+
disableButtonOnValidateFailure = _getModalAndFormProps2.disableButtonOnValidateFailure,
|
|
27
|
+
restModalProps = (0, _objectWithoutProperties2.default)(_getModalAndFormProps2, _excluded),
|
|
28
|
+
_getModalAndFormProps3 = _getModalAndFormProps.formProps,
|
|
29
|
+
onValidate = _getModalAndFormProps3.onValidate,
|
|
30
|
+
formProps = (0, _objectWithoutProperties2.default)(_getModalAndFormProps3, _excluded2);
|
|
31
|
+
var _useState = (0, _react.useState)(restModalProps),
|
|
32
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
+
modalProps = _useState2[0],
|
|
34
|
+
setModalProps = _useState2[1];
|
|
35
|
+
var updateModalProps = (0, _react.useCallback)(function (parameter) {
|
|
36
|
+
setModalProps(function (oldProps) {
|
|
37
|
+
return _lodash.default.merge({}, oldProps, parameter);
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
var handleValidate = function handleValidate(valid) {
|
|
41
|
+
var _modalProps$okButtonP;
|
|
42
|
+
var disabled = !(0, _utils.shouldEnableButton)({
|
|
43
|
+
disabled: disableButtonOnValidateFailure,
|
|
44
|
+
valid: valid,
|
|
45
|
+
form: form,
|
|
46
|
+
onValidate: onValidate
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// 优化:减少 render 次数
|
|
50
|
+
if (disabled !== ((_modalProps$okButtonP = modalProps.okButtonProps) === null || _modalProps$okButtonP === void 0 ? void 0 : _modalProps$okButtonP.disabled)) {
|
|
51
|
+
updateModalProps({
|
|
52
|
+
okButtonProps: {
|
|
53
|
+
disabled: disabled
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
modalProps: modalProps,
|
|
60
|
+
formProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
61
|
+
form: form
|
|
62
|
+
}, formProps), {}, {
|
|
63
|
+
onValidate: handleValidate
|
|
64
|
+
}),
|
|
65
|
+
setModalProps: updateModalProps
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function useModal(_ref) {
|
|
69
|
+
var outerContext = _ref.context,
|
|
70
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded3);
|
|
71
|
+
var unmount = props.unmount,
|
|
72
|
+
onOk = props.onOk,
|
|
73
|
+
onCancel = props.onCancel,
|
|
74
|
+
restProps = (0, _objectWithoutProperties2.default)(props, _excluded4);
|
|
75
|
+
var _useState3 = (0, _react.useState)(true),
|
|
76
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
77
|
+
open = _useState4[0],
|
|
78
|
+
setOpen = _useState4[1];
|
|
79
|
+
var _useState5 = (0, _react.useState)(false),
|
|
80
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
81
|
+
confirmLoading = _useState6[0],
|
|
82
|
+
setConfirmLoading = _useState6[1];
|
|
83
|
+
var _useModalAndFormProps = useModalAndFormProps(restProps),
|
|
84
|
+
modalProps = _useModalAndFormProps.modalProps,
|
|
85
|
+
formProps = _useModalAndFormProps.formProps,
|
|
86
|
+
setModalProps = _useModalAndFormProps.setModalProps;
|
|
87
|
+
var form = formProps.form;
|
|
88
|
+
function handleOk() {
|
|
89
|
+
return _handleOk.apply(this, arguments);
|
|
90
|
+
}
|
|
91
|
+
function _handleOk() {
|
|
92
|
+
_handleOk = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
93
|
+
var values, res;
|
|
94
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
_context.prev = 0;
|
|
98
|
+
_context.next = 3;
|
|
99
|
+
return form.submit();
|
|
100
|
+
case 3:
|
|
101
|
+
values = _context.sent;
|
|
102
|
+
setConfirmLoading(true);
|
|
103
|
+
_context.next = 7;
|
|
104
|
+
return onOk === null || onOk === void 0 ? void 0 : onOk(values, form);
|
|
105
|
+
case 7:
|
|
106
|
+
res = _context.sent;
|
|
107
|
+
closeModal(res);
|
|
108
|
+
case 9:
|
|
109
|
+
_context.prev = 9;
|
|
110
|
+
setConfirmLoading(false);
|
|
111
|
+
return _context.finish(9);
|
|
112
|
+
case 12:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee, null, [[0,, 9, 12]]);
|
|
117
|
+
}));
|
|
118
|
+
return _handleOk.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
function handleCancel() {
|
|
121
|
+
return _handleCancel.apply(this, arguments);
|
|
122
|
+
} // 内部方法: 关闭Modal
|
|
123
|
+
function _handleCancel() {
|
|
124
|
+
_handleCancel = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
125
|
+
var res;
|
|
126
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
127
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
_context2.next = 2;
|
|
130
|
+
return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
131
|
+
case 2:
|
|
132
|
+
res = _context2.sent;
|
|
133
|
+
closeModal(res);
|
|
134
|
+
case 4:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context2.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee2);
|
|
139
|
+
}));
|
|
140
|
+
return _handleCancel.apply(this, arguments);
|
|
141
|
+
}
|
|
142
|
+
function closeModal(_x) {
|
|
143
|
+
return _closeModal.apply(this, arguments);
|
|
144
|
+
}
|
|
145
|
+
function _closeModal() {
|
|
146
|
+
_closeModal = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(shouldClose) {
|
|
147
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
if (!(shouldClose === false)) {
|
|
151
|
+
_context3.next = 2;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return _context3.abrupt("return");
|
|
155
|
+
case 2:
|
|
156
|
+
setOpen(false);
|
|
157
|
+
// 等待动画结束,再卸载DOM
|
|
158
|
+
_context3.next = 5;
|
|
159
|
+
return (0, _delay.default)(150);
|
|
160
|
+
case 5:
|
|
161
|
+
unmount === null || unmount === void 0 || unmount();
|
|
162
|
+
case 6:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context3.stop();
|
|
165
|
+
}
|
|
166
|
+
}, _callee3);
|
|
167
|
+
}));
|
|
168
|
+
return _closeModal.apply(this, arguments);
|
|
169
|
+
}
|
|
170
|
+
var context = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, outerContext), {}, {
|
|
171
|
+
form: form,
|
|
172
|
+
confirmLoading: confirmLoading,
|
|
173
|
+
isValidForm: !modalProps.okButtonProps.disabled,
|
|
174
|
+
setModalProps: setModalProps,
|
|
175
|
+
close: handleCancel,
|
|
176
|
+
ok: handleOk
|
|
177
|
+
});
|
|
178
|
+
return {
|
|
179
|
+
open: open,
|
|
180
|
+
context: context,
|
|
181
|
+
modalProps: modalProps,
|
|
182
|
+
formProps: formProps
|
|
183
|
+
};
|
|
184
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormInstance, FormProps } from "../../form";
|
|
2
|
+
import { OpenModalProps } from '../type';
|
|
3
|
+
export declare function getModalAndFormProps(props: OpenModalProps): any;
|
|
4
|
+
interface EnableButtonProps {
|
|
5
|
+
valid: boolean;
|
|
6
|
+
form: FormInstance;
|
|
7
|
+
onValidate?: FormProps['onValidate'];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function shouldEnableButton({ disabled, onValidate, valid, form }: EnableButtonProps): boolean;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getModalAndFormProps = getModalAndFormProps;
|
|
8
|
+
exports.shouldEnableButton = shouldEnableButton;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _api = require("../../api");
|
|
12
|
+
var _css = require("@emotion/css");
|
|
13
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
14
|
+
var _style = _interopRequireDefault(require("../style"));
|
|
15
|
+
var _wrap = require("../style/wrap");
|
|
16
|
+
var _constant = require("./constant");
|
|
17
|
+
var _footer = require("./footer");
|
|
18
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
+
var _excluded = ["children", "content"],
|
|
20
|
+
_excluded2 = ["top", "showCancel", "showOk", "bodyBottomMargin", "maskClosable", "titleCenter", "wrapStyle", "wrapClassName"];
|
|
21
|
+
function getModalFormProps(props) {
|
|
22
|
+
var _ref = _lodash.default.pick(props, _constant.formPropsKeys),
|
|
23
|
+
children = _ref.children,
|
|
24
|
+
content = _ref.content,
|
|
25
|
+
formProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
26
|
+
var Component = children !== null && children !== void 0 ? children : content;
|
|
27
|
+
if (_lodash.default.isArray(Component)) {
|
|
28
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formProps), {}, {
|
|
29
|
+
items: Component
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (_lodash.default.isFunction(Component)) {
|
|
33
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formProps), {}, {
|
|
34
|
+
children: (0, _jsxRuntime.jsx)(Component, {})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formProps), {}, {
|
|
38
|
+
children: Component
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function getModalAndFormProps(props) {
|
|
42
|
+
// Form Props
|
|
43
|
+
var formProps = getModalFormProps(props);
|
|
44
|
+
if (formProps.footer) {
|
|
45
|
+
formProps.footer = (0, _jsxRuntime.jsx)(_footer.Footer, {
|
|
46
|
+
children: formProps.footer
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Modal Props
|
|
51
|
+
var _$omit = _lodash.default.omit(props, _constant.formPropsKeys),
|
|
52
|
+
top = _$omit.top,
|
|
53
|
+
_$omit$showCancel = _$omit.showCancel,
|
|
54
|
+
showCancel = _$omit$showCancel === void 0 ? true : _$omit$showCancel,
|
|
55
|
+
_$omit$showOk = _$omit.showOk,
|
|
56
|
+
showOk = _$omit$showOk === void 0 ? true : _$omit$showOk,
|
|
57
|
+
bodyBottomMargin = _$omit.bodyBottomMargin,
|
|
58
|
+
_$omit$maskClosable = _$omit.maskClosable,
|
|
59
|
+
maskClosable = _$omit$maskClosable === void 0 ? false : _$omit$maskClosable,
|
|
60
|
+
titleCenter = _$omit.titleCenter,
|
|
61
|
+
wrapStyle = _$omit.wrapStyle,
|
|
62
|
+
wrapClassName = _$omit.wrapClassName,
|
|
63
|
+
modalProps = (0, _objectWithoutProperties2.default)(_$omit, _excluded2);
|
|
64
|
+
var mergedModalProps = _lodash.default.merge({
|
|
65
|
+
okButtonProps: {
|
|
66
|
+
disabled: true,
|
|
67
|
+
style: {
|
|
68
|
+
display: showOk ? 'unset' : 'none'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
cancelButtonProps: {
|
|
72
|
+
style: {
|
|
73
|
+
display: showCancel ? 'unset' : 'none',
|
|
74
|
+
color: '#44566c'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
maskClosable: maskClosable,
|
|
78
|
+
keyboard: maskClosable,
|
|
79
|
+
autoFocusButton: null,
|
|
80
|
+
focusTriggerAfterClose: false,
|
|
81
|
+
footer: _lodash.default.isNull(formProps.footer) ? null : undefined,
|
|
82
|
+
// 为 null 时,不显示 footer
|
|
83
|
+
css: _style.default.wrapper({
|
|
84
|
+
bodyBottomMargin: getBodyBottomMargin(bodyBottomMargin, formProps),
|
|
85
|
+
titleCenter: titleCenter
|
|
86
|
+
}),
|
|
87
|
+
style: modalProps.centered ? {} : {
|
|
88
|
+
top: top
|
|
89
|
+
},
|
|
90
|
+
wrapClassName: (0, _css.cx)((0, _wrap.getWrapStyle)(wrapStyle), wrapClassName)
|
|
91
|
+
}, modalProps);
|
|
92
|
+
return {
|
|
93
|
+
formProps: formProps,
|
|
94
|
+
modalProps: mergedModalProps
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getBodyBottomMargin(bodyBottomMargin, formProps) {
|
|
98
|
+
var _formProps$items;
|
|
99
|
+
if (!_lodash.default.isNil(bodyBottomMargin)) {
|
|
100
|
+
return (0, _api.transformValueWithStyleUnit)(bodyBottomMargin);
|
|
101
|
+
}
|
|
102
|
+
if ((_formProps$items = formProps.items) !== null && _formProps$items !== void 0 && _formProps$items.length) {
|
|
103
|
+
return '10px';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function shouldEnableButton(_ref2) {
|
|
107
|
+
var _onValidate;
|
|
108
|
+
var disabled = _ref2.disabled,
|
|
109
|
+
onValidate = _ref2.onValidate,
|
|
110
|
+
valid = _ref2.valid,
|
|
111
|
+
form = _ref2.form;
|
|
112
|
+
if (disabled === false) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
var isValid = (_onValidate = onValidate === null || onValidate === void 0 ? void 0 : onValidate(valid, form)) !== null && _onValidate !== void 0 ? _onValidate : true;
|
|
116
|
+
return isValid && valid;
|
|
117
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ModalContext } from '../type';
|
|
3
|
+
export * from './use-modal';
|
|
4
|
+
export declare function ModalProvider({ children, ...props }: ModalContext & {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function useModalContext(): ModalContext;
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
ModalProvider: true,
|
|
9
|
+
useModalContext: true
|
|
10
|
+
};
|
|
11
|
+
exports.ModalProvider = ModalProvider;
|
|
12
|
+
exports.useModalContext = useModalContext;
|
|
13
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
+
var _useModal = require("./use-modal");
|
|
17
|
+
Object.keys(_useModal).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _useModal[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _useModal[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _excluded = ["children"];
|
|
29
|
+
var ModalCtx = /*#__PURE__*/(0, _react.createContext)({});
|
|
30
|
+
function ModalProvider(_ref) {
|
|
31
|
+
var children = _ref.children,
|
|
32
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
|
+
return (0, _jsxRuntime.jsx)(ModalCtx.Provider, {
|
|
34
|
+
value: props,
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function useModalContext() {
|
|
39
|
+
return (0, _react.useContext)(ModalCtx);
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useModal = useModal;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _usePatchElement3 = _interopRequireDefault(require("antd/lib/_util/hooks/usePatchElement"));
|
|
11
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
|
+
var _component = require("../component");
|
|
13
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
14
|
+
function useModal() {
|
|
15
|
+
var _usePatchElement = (0, _usePatchElement3.default)(),
|
|
16
|
+
_usePatchElement2 = (0, _slicedToArray2.default)(_usePatchElement, 2),
|
|
17
|
+
component = _usePatchElement2[0],
|
|
18
|
+
patchElement = _usePatchElement2[1];
|
|
19
|
+
function open(props) {
|
|
20
|
+
var close = undefined;
|
|
21
|
+
var modal = (0, _jsxRuntime.jsx)(_component.Modal, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
22
|
+
unmount: function unmount() {
|
|
23
|
+
var _close;
|
|
24
|
+
return (_close = close) === null || _close === void 0 ? void 0 : _close();
|
|
25
|
+
}
|
|
26
|
+
}), _lodash.default.uniqueId());
|
|
27
|
+
close = patchElement(modal);
|
|
28
|
+
return close;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
component: component,
|
|
32
|
+
open: open
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -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,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _api = require("../../api");
|
|
10
|
+
var _react = require("@emotion/react");
|
|
11
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
12
|
+
function titleStyle(titleCenter) {
|
|
13
|
+
if (titleCenter) {
|
|
14
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n text-align: center;\n "])));
|
|
15
|
+
}
|
|
16
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding-right: 20px;\n "])));
|
|
17
|
+
}
|
|
18
|
+
var style = {
|
|
19
|
+
wrapper: function wrapper(_ref) {
|
|
20
|
+
var bodyBottomMargin = _ref.bodyBottomMargin,
|
|
21
|
+
titleCenter = _ref.titleCenter;
|
|
22
|
+
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n\n .ant-modal-title {\n font-weight: 600;\n ", "\n }\n\n .ant-modal-body {\n padding-bottom: ", ";\n }\n "])), _api.commonFontFamily, titleStyle(titleCenter), bodyBottomMargin);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = style;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getWrapStyle = getWrapStyle;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _css = require("@emotion/css");
|
|
10
|
+
var _templateObject;
|
|
11
|
+
function getWrapStyle(wrapStyle) {
|
|
12
|
+
return (0, _css.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &.ant-modal-centered .ant-select-dropdown {\n text-align: left;\n }\n\n ", "\n "])), wrapStyle);
|
|
13
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { FunctionReturn } from "../../api";
|
|
2
|
+
import { FormInstance, FormItemProps, FormProps, FormValues } from "../../form";
|
|
3
|
+
import { CSSObject } from '@emotion/react';
|
|
4
|
+
import { ModalProps as AntdModalProps } from 'antd/lib/modal/Modal';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
type AntdComponentProps = Omit<AntdModalProps, 'onOk' | 'children'> & Omit<FormProps, 'children' | 'content' | 'title'>;
|
|
7
|
+
/**
|
|
8
|
+
* @noExtends
|
|
9
|
+
*/
|
|
10
|
+
export interface OpenModalProps extends AntdComponentProps {
|
|
11
|
+
/**
|
|
12
|
+
* @description 弹窗内容,当该值为数组时,会自动显示为表单
|
|
13
|
+
* @link FormItemProps: /components/form#formitem
|
|
14
|
+
* @default (必选)
|
|
15
|
+
*/
|
|
16
|
+
children?: FormItemProps[] | ReactNode | (() => ReactNode);
|
|
17
|
+
content?: OpenModalProps['children'];
|
|
18
|
+
/**
|
|
19
|
+
* @description 是否显示取消按钮
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
showCancel?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @description 是否显示确定按钮
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
showOk?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @description 顶部距离
|
|
30
|
+
* @default 100px
|
|
31
|
+
*/
|
|
32
|
+
top?: string | number;
|
|
33
|
+
disableButtonOnValidateFailure?: boolean;
|
|
34
|
+
title?: ReactNode;
|
|
35
|
+
titleCenter?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 打开弹框时,是否禁用页面滚动
|
|
38
|
+
*/
|
|
39
|
+
hideBodyScroll?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @description 底部边距
|
|
42
|
+
* @default 24px
|
|
43
|
+
*/
|
|
44
|
+
bodyBottomMargin?: number | string;
|
|
45
|
+
/**
|
|
46
|
+
* @description 对话框外层容器的样式
|
|
47
|
+
*/
|
|
48
|
+
wrapStyle?: CSSObject;
|
|
49
|
+
/**
|
|
50
|
+
* @description 点击取消按钮的回调
|
|
51
|
+
*/
|
|
52
|
+
onCancel?(): FunctionReturn<boolean | void>;
|
|
53
|
+
/**
|
|
54
|
+
* @description 点击确定按钮的回调
|
|
55
|
+
* @link FormInstance: /components/form#forminstance
|
|
56
|
+
*/
|
|
57
|
+
onOk?(values: FormValues, form: FormInstance): FunctionReturn<boolean | void>;
|
|
58
|
+
/**
|
|
59
|
+
* @description 关闭弹框时的回调
|
|
60
|
+
*/
|
|
61
|
+
unmount?: () => void;
|
|
62
|
+
}
|
|
63
|
+
export interface ModalContext {
|
|
64
|
+
/**
|
|
65
|
+
* @description 表单实例
|
|
66
|
+
* @link FormInstance: /components/form#forminstance
|
|
67
|
+
*/
|
|
68
|
+
form: FormInstance;
|
|
69
|
+
/**
|
|
70
|
+
* @description 表单是否校验通过
|
|
71
|
+
*/
|
|
72
|
+
isValidForm: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* @description 确认按钮加载状态
|
|
75
|
+
*/
|
|
76
|
+
confirmLoading: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* @description 确认弹窗
|
|
79
|
+
*/
|
|
80
|
+
ok(): void;
|
|
81
|
+
/**
|
|
82
|
+
* @description 关闭弹窗
|
|
83
|
+
*/
|
|
84
|
+
close(): void;
|
|
85
|
+
/**
|
|
86
|
+
* @description 设置弹窗属性
|
|
87
|
+
* @link OpenModalProps: #api
|
|
88
|
+
*/
|
|
89
|
+
setModalProps(props: Partial<OpenModalProps>): void;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Portal = Portal;
|
|
8
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _api = require("../../api");
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _reactDom = require("react-dom");
|
|
15
|
+
var _reactUse = require("react-use");
|
|
16
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
+
function Portal(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
container = _ref.container;
|
|
20
|
+
var ref = (0, _react.useRef)(null);
|
|
21
|
+
var _useState = (0, _react.useState)(),
|
|
22
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
23
|
+
to = _useState2[0],
|
|
24
|
+
setTo = _useState2[1];
|
|
25
|
+
(0, _reactUse.useMount)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
26
|
+
var target, el, to;
|
|
27
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
_context.next = 2;
|
|
31
|
+
return (0, _api.executeFunction)(container, ref.current);
|
|
32
|
+
case 2:
|
|
33
|
+
target = _context.sent;
|
|
34
|
+
el = target || document.body;
|
|
35
|
+
to = _lodash.default.isString(el) ? (0, _api.$)(el) : el;
|
|
36
|
+
setTo(to);
|
|
37
|
+
case 6:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
})));
|
|
43
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
44
|
+
ref: ref,
|
|
45
|
+
children: to && /*#__PURE__*/(0, _reactDom.createPortal)(children, to)
|
|
46
|
+
});
|
|
47
|
+
}
|