@hw-component/form 1.10.88 → 1.10.90
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/ModalForm.js +6 -6
- package/es/Form/FormItem/hooks.d.ts +1 -1
- package/es/Form/hooks/useHForm.js +2 -0
- package/lib/DialogForm/ModalForm.js +6 -6
- package/lib/Form/FormItem/hooks.d.ts +1 -1
- package/lib/Form/hooks/useHForm.js +2 -0
- package/package.json +1 -1
- package/src/components/DialogForm/ModalForm.tsx +6 -6
- package/src/components/Form/FormItem/hooks.tsx +1 -1
- package/src/components/Form/hooks/useHForm.ts +6 -0
- package/src/pages/DrawerForm/index.tsx +8 -23
- package/src/pages/Form/index.tsx +42 -7
- package/src/pages/ModalForm/index.tsx +12 -5
|
@@ -98,7 +98,7 @@ var Index = function Index(_ref) {
|
|
|
98
98
|
}();
|
|
99
99
|
var footerOnOk = function footerOnOk() {
|
|
100
100
|
if (modalFormData) {
|
|
101
|
-
|
|
101
|
+
currentForm === null || currentForm === void 0 || currentForm.submit();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
finish({}, formParams);
|
|
@@ -114,18 +114,19 @@ var Index = function Index(_ref) {
|
|
|
114
114
|
infoRequest: infoRequest
|
|
115
115
|
}));
|
|
116
116
|
var defaultFooter = useFooterRender({
|
|
117
|
-
dialogForm:
|
|
117
|
+
dialogForm: currentForm,
|
|
118
118
|
footer: footer,
|
|
119
119
|
confirmLoading: loading,
|
|
120
120
|
params: formParams,
|
|
121
|
-
onOk: footerOnOk
|
|
121
|
+
onOk: footerOnOk,
|
|
122
|
+
onCancel: cancel
|
|
122
123
|
});
|
|
123
124
|
var selfAfterClose = function selfAfterClose() {
|
|
124
125
|
if (autoClear) {
|
|
125
|
-
|
|
126
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
129
130
|
};
|
|
130
131
|
return jsx(Modal, _objectSpread(_objectSpread({
|
|
131
132
|
title: modalTitle,
|
|
@@ -138,7 +139,6 @@ var Index = function Index(_ref) {
|
|
|
138
139
|
setLoading(false);
|
|
139
140
|
}
|
|
140
141
|
}, props), {}, {
|
|
141
|
-
onOk: currentForm.submit,
|
|
142
142
|
destroyOnClose: destroyOnClose,
|
|
143
143
|
footer: defaultFooter,
|
|
144
144
|
children: jsx(Index$1, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
@@ -2,7 +2,7 @@ import type React from "react";
|
|
|
2
2
|
import type { HFormInstance, HFormItemProps, HItemProps } from "../modal";
|
|
3
3
|
import type { LabelAlignModal } from "../modal";
|
|
4
4
|
import type { HelperModal } from "../modal";
|
|
5
|
-
import { Rule } from "rc-field-form/lib/interface";
|
|
5
|
+
import type { Rule } from "rc-field-form/lib/interface";
|
|
6
6
|
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, hidden, }: HItemProps) => ({ shouldUpdate, dependencies, hide, itemSpan, hidden, ...props }: HFormItemProps) => JSX.Element;
|
|
7
7
|
interface UseHideUpItemModal extends Omit<HItemProps, "name"> {
|
|
8
8
|
form: HFormInstance;
|
|
@@ -198,6 +198,8 @@ var useHForm = (function () {
|
|
|
198
198
|
keys.forEach(function (key) {
|
|
199
199
|
newVale[key] = undefined;
|
|
200
200
|
});
|
|
201
|
+
console.log(newVale);
|
|
202
|
+
console.log(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
|
|
201
203
|
form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
|
|
202
204
|
},
|
|
203
205
|
resetFieldsValues: function resetFieldsValues() {
|
|
@@ -101,7 +101,7 @@ var Index = function Index(_ref) {
|
|
|
101
101
|
}();
|
|
102
102
|
var footerOnOk = function footerOnOk() {
|
|
103
103
|
if (modalFormData) {
|
|
104
|
-
|
|
104
|
+
currentForm === null || currentForm === void 0 || currentForm.submit();
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
finish({}, formParams);
|
|
@@ -117,18 +117,19 @@ var Index = function Index(_ref) {
|
|
|
117
117
|
infoRequest: infoRequest
|
|
118
118
|
}));
|
|
119
119
|
var defaultFooter = hooks.useFooterRender({
|
|
120
|
-
dialogForm:
|
|
120
|
+
dialogForm: currentForm,
|
|
121
121
|
footer: footer,
|
|
122
122
|
confirmLoading: loading,
|
|
123
123
|
params: formParams,
|
|
124
|
-
onOk: footerOnOk
|
|
124
|
+
onOk: footerOnOk,
|
|
125
|
+
onCancel: cancel
|
|
125
126
|
});
|
|
126
127
|
var selfAfterClose = function selfAfterClose() {
|
|
127
128
|
if (autoClear) {
|
|
128
|
-
|
|
129
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
132
133
|
};
|
|
133
134
|
return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
|
|
134
135
|
title: modalTitle,
|
|
@@ -141,7 +142,6 @@ var Index = function Index(_ref) {
|
|
|
141
142
|
setLoading(false);
|
|
142
143
|
}
|
|
143
144
|
}, props), {}, {
|
|
144
|
-
onOk: currentForm.submit,
|
|
145
145
|
destroyOnClose: destroyOnClose,
|
|
146
146
|
footer: defaultFooter,
|
|
147
147
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
@@ -2,7 +2,7 @@ import type React from "react";
|
|
|
2
2
|
import type { HFormInstance, HFormItemProps, HItemProps } from "../modal";
|
|
3
3
|
import type { LabelAlignModal } from "../modal";
|
|
4
4
|
import type { HelperModal } from "../modal";
|
|
5
|
-
import { Rule } from "rc-field-form/lib/interface";
|
|
5
|
+
import type { Rule } from "rc-field-form/lib/interface";
|
|
6
6
|
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, hidden, }: HItemProps) => ({ shouldUpdate, dependencies, hide, itemSpan, hidden, ...props }: HFormItemProps) => JSX.Element;
|
|
7
7
|
interface UseHideUpItemModal extends Omit<HItemProps, "name"> {
|
|
8
8
|
form: HFormInstance;
|
|
@@ -201,6 +201,8 @@ var useHForm = (function () {
|
|
|
201
201
|
keys.forEach(function (key) {
|
|
202
202
|
newVale[key] = undefined;
|
|
203
203
|
});
|
|
204
|
+
console.log(newVale);
|
|
205
|
+
console.log(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
|
|
204
206
|
form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
|
|
205
207
|
},
|
|
206
208
|
resetFieldsValues: function resetFieldsValues() {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useFooterRender,
|
|
10
10
|
useModifyProps,
|
|
11
11
|
useSub,
|
|
12
|
-
} from "
|
|
12
|
+
} from "./hooks";
|
|
13
13
|
import ChildComponent from "./ChildComponent";
|
|
14
14
|
import React from "react";
|
|
15
15
|
|
|
@@ -72,7 +72,7 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
72
72
|
};
|
|
73
73
|
const footerOnOk = () => {
|
|
74
74
|
if (modalFormData) {
|
|
75
|
-
|
|
75
|
+
currentForm?.submit();
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
finish({}, formParams);
|
|
@@ -90,18 +90,19 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
90
90
|
/>
|
|
91
91
|
);
|
|
92
92
|
const defaultFooter = useFooterRender({
|
|
93
|
-
dialogForm,
|
|
93
|
+
dialogForm:currentForm,
|
|
94
94
|
footer,
|
|
95
95
|
confirmLoading: loading,
|
|
96
96
|
params: formParams,
|
|
97
97
|
onOk: footerOnOk,
|
|
98
|
+
onCancel: cancel,
|
|
98
99
|
});
|
|
99
100
|
const selfAfterClose = () => {
|
|
100
101
|
if (autoClear) {
|
|
101
|
-
|
|
102
|
+
currentForm?.clear();
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
currentForm?.resetFormStatus();
|
|
105
106
|
};
|
|
106
107
|
return (
|
|
107
108
|
<Modal
|
|
@@ -115,7 +116,6 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
115
116
|
setLoading(false);
|
|
116
117
|
}}
|
|
117
118
|
{...props}
|
|
118
|
-
onOk={currentForm.submit}
|
|
119
119
|
destroyOnClose={destroyOnClose}
|
|
120
120
|
footer={defaultFooter}
|
|
121
121
|
>
|
|
@@ -6,7 +6,7 @@ import type { HFormInstance, HFormItemProps, HItemProps } from "../modal";
|
|
|
6
6
|
import type { LabelAlignModal } from "../modal";
|
|
7
7
|
import { useClassName } from "../../hooks";
|
|
8
8
|
import type { HelperModal } from "../modal";
|
|
9
|
-
import { Rule } from "rc-field-form/lib/interface";
|
|
9
|
+
import type { Rule } from "rc-field-form/lib/interface";
|
|
10
10
|
|
|
11
11
|
export const useFormItemDomControl = ({
|
|
12
12
|
shouldUpdate,
|
|
@@ -183,6 +183,12 @@ export default () => {
|
|
|
183
183
|
keys.forEach((key) => {
|
|
184
184
|
newVale[key] = undefined;
|
|
185
185
|
});
|
|
186
|
+
console.log(newVale);
|
|
187
|
+
console.log({
|
|
188
|
+
...newVale,
|
|
189
|
+
...initSaveValue,
|
|
190
|
+
...values,
|
|
191
|
+
})
|
|
186
192
|
form.setFieldsValue({
|
|
187
193
|
...newVale,
|
|
188
194
|
...initSaveValue,
|
|
@@ -2,7 +2,7 @@ import { Button } from "antd";
|
|
|
2
2
|
import { HDrawerForm, useHDialogForm } from "../../components";
|
|
3
3
|
import { MediaTypeEnum } from "../../components/Upload/enums";
|
|
4
4
|
import FormItem from "../../components/Form/FormItem";
|
|
5
|
-
import {
|
|
5
|
+
import {useEffect, useState} from "react";
|
|
6
6
|
const Test = () => {
|
|
7
7
|
return <FormItem name="input" label="你好" />;
|
|
8
8
|
};
|
|
@@ -42,37 +42,19 @@ const Test1 = ({ formNode, dialogForm, params }) => {
|
|
|
42
42
|
};
|
|
43
43
|
export default () => {
|
|
44
44
|
const modalForm = useHDialogForm();
|
|
45
|
+
const [visible,setVisible]=useState(false);
|
|
45
46
|
return (
|
|
46
47
|
<>
|
|
47
48
|
<Button
|
|
48
49
|
onClick={() => {
|
|
49
|
-
|
|
50
|
-
modalForm.show({
|
|
51
|
-
initialValues: {
|
|
52
|
-
checkboxGroup: 1,
|
|
53
|
-
urlUpload: [
|
|
54
|
-
{
|
|
55
|
-
name: "https://yzimage.52youzai.net/eeff9ae7fded45b7bdca95c6fc72ba3c.mp4",
|
|
56
|
-
response: {
|
|
57
|
-
url: "https://yzimage.52youzai.net/eeff9ae7fded45b7bdca95c6fc72ba3c.mp4",
|
|
58
|
-
},
|
|
59
|
-
status: "done",
|
|
60
|
-
uid: `init-${num}`,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
});
|
|
50
|
+
setVisible(true);
|
|
65
51
|
}}
|
|
66
52
|
>
|
|
67
53
|
显示
|
|
68
54
|
</Button>
|
|
69
55
|
<Button
|
|
70
56
|
onClick={() => {
|
|
71
|
-
|
|
72
|
-
initialValues: {
|
|
73
|
-
input: "12312",
|
|
74
|
-
},
|
|
75
|
-
});
|
|
57
|
+
setVisible(true);
|
|
76
58
|
}}
|
|
77
59
|
>
|
|
78
60
|
打开
|
|
@@ -81,8 +63,11 @@ export default () => {
|
|
|
81
63
|
configData={data}
|
|
82
64
|
labelWidth={88}
|
|
83
65
|
labelAlign={"left"}
|
|
84
|
-
|
|
66
|
+
visible={visible}
|
|
85
67
|
autoClear={false}
|
|
68
|
+
onCancel={()=>{
|
|
69
|
+
setVisible(false);
|
|
70
|
+
}}
|
|
86
71
|
request={(values) => {
|
|
87
72
|
return Promise.resolve();
|
|
88
73
|
}}
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
HForm,
|
|
3
|
+
HFormConfigProvider,
|
|
4
|
+
useHForm,
|
|
5
|
+
HSelect,
|
|
6
|
+
HBasicForm,
|
|
7
|
+
HRangePicker, HSelectInput,
|
|
8
8
|
} from "../../components";
|
|
9
9
|
import { useEffect, useState } from "react";
|
|
10
10
|
import { Button, Col, Form, Input, Row, Space } from "antd";
|
|
@@ -74,7 +74,6 @@ const Basic = () => {
|
|
|
74
74
|
|
|
75
75
|
const TestItem = ({ value, onChange }) => {
|
|
76
76
|
const { select, time } = value || {};
|
|
77
|
-
console.log(value);
|
|
78
77
|
return (
|
|
79
78
|
<HRangePicker
|
|
80
79
|
addonBeforeStyle={{
|
|
@@ -116,6 +115,31 @@ const TestItem = ({ value, onChange }) => {
|
|
|
116
115
|
);
|
|
117
116
|
};
|
|
118
117
|
|
|
118
|
+
|
|
119
|
+
const TestItem1 = ({ value, onChange }) => {
|
|
120
|
+
const { select, input="" } = value || {};
|
|
121
|
+
console.log(value,"vvvvvv")
|
|
122
|
+
return (
|
|
123
|
+
<HSelectInput
|
|
124
|
+
value={{
|
|
125
|
+
select,
|
|
126
|
+
input
|
|
127
|
+
}}
|
|
128
|
+
onChange={(val)=>{
|
|
129
|
+
onChange({
|
|
130
|
+
...val
|
|
131
|
+
})
|
|
132
|
+
}}
|
|
133
|
+
selectProps={{
|
|
134
|
+
options: [{
|
|
135
|
+
value: "test2",
|
|
136
|
+
key:"1"
|
|
137
|
+
}]
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
|
|
119
143
|
export default () => {
|
|
120
144
|
const form = useHForm();
|
|
121
145
|
const [id, setId] = useState(1);
|
|
@@ -197,6 +221,13 @@ export default () => {
|
|
|
197
221
|
return <TestItem />;
|
|
198
222
|
},
|
|
199
223
|
},
|
|
224
|
+
{
|
|
225
|
+
name: "selectInput",
|
|
226
|
+
label: "selectInput",
|
|
227
|
+
render: () => {
|
|
228
|
+
return <TestItem1 />;
|
|
229
|
+
},
|
|
230
|
+
},
|
|
200
231
|
]}
|
|
201
232
|
dismissOnPressEnter={false}
|
|
202
233
|
form={form}
|
|
@@ -209,6 +240,10 @@ export default () => {
|
|
|
209
240
|
StartTime: null,
|
|
210
241
|
},
|
|
211
242
|
},
|
|
243
|
+
selectInput: {
|
|
244
|
+
select: "1",
|
|
245
|
+
input:""
|
|
246
|
+
}
|
|
212
247
|
}}
|
|
213
248
|
labelAlign={"top"}
|
|
214
249
|
onValuesChange={(val) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Button} from "antd";
|
|
2
2
|
import {
|
|
3
3
|
HModalForm,
|
|
4
4
|
useHDialogForm,
|
|
5
5
|
HFormConfigProvider,
|
|
6
6
|
} from "../../components";
|
|
7
|
+
import {useState} from "react";
|
|
7
8
|
|
|
8
9
|
const data = [
|
|
9
10
|
{ label: "name", name: "name", hover: "1312" },
|
|
@@ -23,6 +24,7 @@ const data = [
|
|
|
23
24
|
},
|
|
24
25
|
];
|
|
25
26
|
|
|
27
|
+
|
|
26
28
|
const time = async () => {
|
|
27
29
|
return new Promise((resolve, reject) => {
|
|
28
30
|
return setTimeout(() => {
|
|
@@ -30,15 +32,16 @@ const time = async () => {
|
|
|
30
32
|
}, 3000);
|
|
31
33
|
});
|
|
32
34
|
};
|
|
35
|
+
|
|
33
36
|
export default () => {
|
|
34
37
|
const modalForm = useHDialogForm();
|
|
38
|
+
const [visible,setVisible]=useState(false);
|
|
39
|
+
const [loading,setLoading]=useState(false)
|
|
35
40
|
return (
|
|
36
41
|
<>
|
|
37
42
|
<Button
|
|
38
43
|
onClick={() => {
|
|
39
|
-
|
|
40
|
-
params: { id: "231231" },
|
|
41
|
-
});
|
|
44
|
+
setVisible(true);
|
|
42
45
|
}}
|
|
43
46
|
>
|
|
44
47
|
打开
|
|
@@ -46,6 +49,7 @@ export default () => {
|
|
|
46
49
|
<Button
|
|
47
50
|
onClick={() => {
|
|
48
51
|
modalForm.show({
|
|
52
|
+
title:"好的",
|
|
49
53
|
initialValues: {
|
|
50
54
|
name: "name",
|
|
51
55
|
},
|
|
@@ -65,11 +69,14 @@ export default () => {
|
|
|
65
69
|
>
|
|
66
70
|
<HModalForm
|
|
67
71
|
configData={data}
|
|
72
|
+
visible={visible}
|
|
73
|
+
onCancel={()=>{
|
|
74
|
+
setVisible(false);
|
|
75
|
+
}}
|
|
68
76
|
formItemStyle={{
|
|
69
77
|
marginBottom: 100,
|
|
70
78
|
}}
|
|
71
79
|
labelAlign={"left"}
|
|
72
|
-
dialogForm={modalForm}
|
|
73
80
|
request={async () => {
|
|
74
81
|
console.log("fff");
|
|
75
82
|
await time();
|