@hw-component/form 0.0.6-beta-v6 → 0.0.6-beta-v8
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/es/DialogForm/DrawerForm/index.js +6 -5
- package/es/DialogForm/ModalForm.js +2 -3
- package/es/DialogForm/hooks.js +4 -1
- package/es/Form/hooks/useHForm.js +1 -1
- package/es/Form/modal.d.ts +1 -0
- package/lib/DialogForm/DrawerForm/index.js +6 -5
- package/lib/DialogForm/ModalForm.js +2 -3
- package/lib/DialogForm/hooks.js +4 -1
- package/lib/Form/hooks/useHForm.js +1 -1
- package/lib/Form/modal.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +4 -2
- package/src/components/DialogForm/ModalForm.tsx +2 -2
- package/src/components/DialogForm/hooks.ts +4 -1
- package/src/components/Form/hooks/useHForm.ts +1 -1
- package/src/components/Form/modal.ts +1 -0
- package/src/pages/ModalForm/index.tsx +4 -0
|
@@ -32,8 +32,7 @@ var DrawerForm = (function (_ref) {
|
|
|
32
32
|
var dialogForm = _ref.dialogForm,
|
|
33
33
|
_ref$closable = _ref.closable,
|
|
34
34
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
35
|
-
|
|
36
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
35
|
+
initialValues = _ref.initialValues,
|
|
37
36
|
labelWidth = _ref.labelWidth,
|
|
38
37
|
onOk = _ref.onOk,
|
|
39
38
|
onFinish = _ref.onFinish;
|
|
@@ -50,14 +49,16 @@ var DrawerForm = (function (_ref) {
|
|
|
50
49
|
visible: visible,
|
|
51
50
|
initialValues: initialValues,
|
|
52
51
|
dialogForm: currentForm,
|
|
53
|
-
params: params
|
|
52
|
+
params: params,
|
|
53
|
+
title: title
|
|
54
54
|
}),
|
|
55
55
|
modalVisible = _useModifyProps.modalVisible,
|
|
56
56
|
modalFormData = _useModifyProps.modalFormData,
|
|
57
57
|
setModalVisible = _useModifyProps.setModalVisible,
|
|
58
58
|
initValue = _useModifyProps.initValue,
|
|
59
59
|
onAfterClose = _useModifyProps.onAfterClose,
|
|
60
|
-
formParams = _useModifyProps.formParams
|
|
60
|
+
formParams = _useModifyProps.formParams,
|
|
61
|
+
modalTitle = _useModifyProps.title;
|
|
61
62
|
var cancel = function cancel() {
|
|
62
63
|
onAfterClose();
|
|
63
64
|
if (onCancel) {
|
|
@@ -84,7 +85,7 @@ var DrawerForm = (function (_ref) {
|
|
|
84
85
|
return jsx(Drawer, _objectSpread(_objectSpread({
|
|
85
86
|
visible: modalVisible,
|
|
86
87
|
title: jsx(Title, {
|
|
87
|
-
title:
|
|
88
|
+
title: modalTitle,
|
|
88
89
|
closable: closable,
|
|
89
90
|
onCancel: cancel
|
|
90
91
|
})
|
|
@@ -28,8 +28,7 @@ var ModalForm = (function (_ref) {
|
|
|
28
28
|
request = _ref.request,
|
|
29
29
|
_afterClose = _ref.afterClose,
|
|
30
30
|
dialogForm = _ref.dialogForm,
|
|
31
|
-
|
|
32
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
31
|
+
initialValues = _ref.initialValues,
|
|
33
32
|
onFinish = _ref.onFinish,
|
|
34
33
|
params = _ref.params,
|
|
35
34
|
onOk = _ref.onOk,
|
|
@@ -69,7 +68,7 @@ var ModalForm = (function (_ref) {
|
|
|
69
68
|
onCancel: cancel,
|
|
70
69
|
confirmLoading: loading,
|
|
71
70
|
afterClose: function afterClose() {
|
|
72
|
-
currentForm.
|
|
71
|
+
currentForm.clear();
|
|
73
72
|
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
74
73
|
}
|
|
75
74
|
}, props), {}, {
|
package/es/DialogForm/hooks.js
CHANGED
|
@@ -46,7 +46,7 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
46
46
|
setModalTitle = _useState10[1];
|
|
47
47
|
var onAfterClose = function onAfterClose() {
|
|
48
48
|
setTimeout(function () {
|
|
49
|
-
dialogForm.
|
|
49
|
+
dialogForm.clear();
|
|
50
50
|
afterClose === null || afterClose === void 0 || afterClose();
|
|
51
51
|
}, 100);
|
|
52
52
|
};
|
|
@@ -62,6 +62,9 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
62
62
|
useEffect(function () {
|
|
63
63
|
setModalTitle(title);
|
|
64
64
|
}, [title]);
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
setInitValue(initialValues);
|
|
67
|
+
}, [initialValues]);
|
|
65
68
|
useEffect(function () {
|
|
66
69
|
dialogForm.show = function () {
|
|
67
70
|
var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
99
99
|
addDispatchListener: AddDispatchListenerFn;
|
|
100
100
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
101
101
|
reload: PromiseFnResult;
|
|
102
|
+
clear: VoidFunction;
|
|
102
103
|
}
|
|
103
104
|
export interface ConnectConfigModal {
|
|
104
105
|
format?: Record<string, addFormatItemModal>;
|
|
@@ -35,8 +35,7 @@ var DrawerForm = (function (_ref) {
|
|
|
35
35
|
var dialogForm = _ref.dialogForm,
|
|
36
36
|
_ref$closable = _ref.closable,
|
|
37
37
|
closable = _ref$closable === void 0 ? true : _ref$closable,
|
|
38
|
-
|
|
39
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
38
|
+
initialValues = _ref.initialValues,
|
|
40
39
|
labelWidth = _ref.labelWidth,
|
|
41
40
|
onOk = _ref.onOk,
|
|
42
41
|
onFinish = _ref.onFinish;
|
|
@@ -53,14 +52,16 @@ var DrawerForm = (function (_ref) {
|
|
|
53
52
|
visible: visible,
|
|
54
53
|
initialValues: initialValues,
|
|
55
54
|
dialogForm: currentForm,
|
|
56
|
-
params: params
|
|
55
|
+
params: params,
|
|
56
|
+
title: title
|
|
57
57
|
}),
|
|
58
58
|
modalVisible = _useModifyProps.modalVisible,
|
|
59
59
|
modalFormData = _useModifyProps.modalFormData,
|
|
60
60
|
setModalVisible = _useModifyProps.setModalVisible,
|
|
61
61
|
initValue = _useModifyProps.initValue,
|
|
62
62
|
onAfterClose = _useModifyProps.onAfterClose,
|
|
63
|
-
formParams = _useModifyProps.formParams
|
|
63
|
+
formParams = _useModifyProps.formParams,
|
|
64
|
+
modalTitle = _useModifyProps.title;
|
|
64
65
|
var cancel = function cancel() {
|
|
65
66
|
onAfterClose();
|
|
66
67
|
if (onCancel) {
|
|
@@ -87,7 +88,7 @@ var DrawerForm = (function (_ref) {
|
|
|
87
88
|
return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({
|
|
88
89
|
visible: modalVisible,
|
|
89
90
|
title: jsxRuntime.jsx(Title.default, {
|
|
90
|
-
title:
|
|
91
|
+
title: modalTitle,
|
|
91
92
|
closable: closable,
|
|
92
93
|
onCancel: cancel
|
|
93
94
|
})
|
|
@@ -31,8 +31,7 @@ var ModalForm = (function (_ref) {
|
|
|
31
31
|
request = _ref.request,
|
|
32
32
|
_afterClose = _ref.afterClose,
|
|
33
33
|
dialogForm = _ref.dialogForm,
|
|
34
|
-
|
|
35
|
-
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
34
|
+
initialValues = _ref.initialValues,
|
|
36
35
|
onFinish = _ref.onFinish,
|
|
37
36
|
params = _ref.params,
|
|
38
37
|
onOk = _ref.onOk,
|
|
@@ -72,7 +71,7 @@ var ModalForm = (function (_ref) {
|
|
|
72
71
|
onCancel: cancel,
|
|
73
72
|
confirmLoading: loading,
|
|
74
73
|
afterClose: function afterClose() {
|
|
75
|
-
currentForm.
|
|
74
|
+
currentForm.clear();
|
|
76
75
|
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
77
76
|
}
|
|
78
77
|
}, props), {}, {
|
package/lib/DialogForm/hooks.js
CHANGED
|
@@ -47,7 +47,7 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
47
47
|
setModalTitle = _useState10[1];
|
|
48
48
|
var onAfterClose = function onAfterClose() {
|
|
49
49
|
setTimeout(function () {
|
|
50
|
-
dialogForm.
|
|
50
|
+
dialogForm.clear();
|
|
51
51
|
afterClose === null || afterClose === void 0 || afterClose();
|
|
52
52
|
}, 100);
|
|
53
53
|
};
|
|
@@ -63,6 +63,9 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
63
63
|
React.useEffect(function () {
|
|
64
64
|
setModalTitle(title);
|
|
65
65
|
}, [title]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
setInitValue(initialValues);
|
|
68
|
+
}, [initialValues]);
|
|
66
69
|
React.useEffect(function () {
|
|
67
70
|
dialogForm.show = function () {
|
|
68
71
|
var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
99
99
|
addDispatchListener: AddDispatchListenerFn;
|
|
100
100
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
101
101
|
reload: PromiseFnResult;
|
|
102
|
+
clear: VoidFunction;
|
|
102
103
|
}
|
|
103
104
|
export interface ConnectConfigModal {
|
|
104
105
|
format?: Record<string, addFormatItemModal>;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export default ({
|
|
|
15
15
|
afterClose,
|
|
16
16
|
dialogForm,
|
|
17
17
|
closable = true,
|
|
18
|
-
initialValues
|
|
18
|
+
initialValues,
|
|
19
19
|
labelWidth,
|
|
20
20
|
onOk,
|
|
21
21
|
onFinish,
|
|
@@ -35,12 +35,14 @@ export default ({
|
|
|
35
35
|
initValue,
|
|
36
36
|
onAfterClose,
|
|
37
37
|
formParams,
|
|
38
|
+
title:modalTitle
|
|
38
39
|
} = useModifyProps({
|
|
39
40
|
configData,
|
|
40
41
|
visible,
|
|
41
42
|
initialValues,
|
|
42
43
|
dialogForm: currentForm,
|
|
43
44
|
params,
|
|
45
|
+
title
|
|
44
46
|
});
|
|
45
47
|
const cancel = () => {
|
|
46
48
|
onAfterClose();
|
|
@@ -67,7 +69,7 @@ export default ({
|
|
|
67
69
|
return (
|
|
68
70
|
<Drawer
|
|
69
71
|
visible={modalVisible}
|
|
70
|
-
title={<Title title={
|
|
72
|
+
title={<Title title={modalTitle} closable={closable} onCancel={cancel} />}
|
|
71
73
|
{...props}
|
|
72
74
|
onClose={cancel}
|
|
73
75
|
closable={false}
|
|
@@ -12,7 +12,7 @@ export default ({
|
|
|
12
12
|
request,
|
|
13
13
|
afterClose,
|
|
14
14
|
dialogForm,
|
|
15
|
-
initialValues
|
|
15
|
+
initialValues,
|
|
16
16
|
onFinish,
|
|
17
17
|
params,
|
|
18
18
|
onOk,
|
|
@@ -50,7 +50,7 @@ export default ({
|
|
|
50
50
|
onCancel={cancel}
|
|
51
51
|
confirmLoading={loading}
|
|
52
52
|
afterClose={() => {
|
|
53
|
-
currentForm.
|
|
53
|
+
currentForm.clear();
|
|
54
54
|
afterClose?.();
|
|
55
55
|
}}
|
|
56
56
|
{...props}
|
|
@@ -23,7 +23,7 @@ export const useModifyProps = ({
|
|
|
23
23
|
const [modalTitle, setModalTitle] = useState(title);
|
|
24
24
|
const onAfterClose = () => {
|
|
25
25
|
setTimeout(() => {
|
|
26
|
-
dialogForm.
|
|
26
|
+
dialogForm.clear();
|
|
27
27
|
afterClose?.();
|
|
28
28
|
}, 100);
|
|
29
29
|
};
|
|
@@ -41,6 +41,9 @@ export const useModifyProps = ({
|
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
setModalTitle(title);
|
|
43
43
|
}, [title]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setInitValue(initialValues);
|
|
46
|
+
}, [initialValues]);
|
|
44
47
|
useEffect(() => {
|
|
45
48
|
dialogForm.show = (showParams = {}) => {
|
|
46
49
|
const {
|
|
@@ -147,6 +147,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
147
147
|
addDispatchListener: AddDispatchListenerFn;
|
|
148
148
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
149
149
|
reload: PromiseFnResult;
|
|
150
|
+
clear:VoidFunction;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
export interface ConnectConfigModal {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Button } from "antd";
|
|
2
2
|
import { HModalForm, useHDialogForm ,HFormConfigProvider} from "../../components";
|
|
3
|
+
import {useState} from "react";
|
|
4
|
+
import {ShowParamsModal} from "@/components/DialogForm/modal";
|
|
3
5
|
const data = [
|
|
4
6
|
{
|
|
5
7
|
label: "输入框",
|
|
@@ -118,6 +120,8 @@ const data = [
|
|
|
118
120
|
let num = 0;
|
|
119
121
|
export default () => {
|
|
120
122
|
const modalForm = useHDialogForm();
|
|
123
|
+
const [testModal,setTestModal]=useState<ShowParamsModal>({});
|
|
124
|
+
const {visible,params}=testModal;
|
|
121
125
|
return (
|
|
122
126
|
<>
|
|
123
127
|
<Button
|