@hw-component/form 1.10.89 → 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 +4 -5
- package/es/Form/FormItem/hooks.d.ts +1 -1
- package/es/Form/hooks/useHForm.js +2 -0
- package/lib/DialogForm/ModalForm.js +4 -5
- 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 +5 -6
- package/src/components/Form/FormItem/hooks.tsx +1 -1
- package/src/components/Form/hooks/useHForm.ts +6 -0
- package/src/pages/Form/index.tsx +42 -7
- package/src/pages/ModalForm/index.tsx +2 -0
|
@@ -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,7 +114,7 @@ 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,
|
|
@@ -123,10 +123,10 @@ var Index = function Index(_ref) {
|
|
|
123
123
|
});
|
|
124
124
|
var selfAfterClose = function selfAfterClose() {
|
|
125
125
|
if (autoClear) {
|
|
126
|
-
|
|
126
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
130
130
|
};
|
|
131
131
|
return jsx(Modal, _objectSpread(_objectSpread({
|
|
132
132
|
title: modalTitle,
|
|
@@ -139,7 +139,6 @@ var Index = function Index(_ref) {
|
|
|
139
139
|
setLoading(false);
|
|
140
140
|
}
|
|
141
141
|
}, props), {}, {
|
|
142
|
-
onOk: currentForm.submit,
|
|
143
142
|
destroyOnClose: destroyOnClose,
|
|
144
143
|
footer: defaultFooter,
|
|
145
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,7 +117,7 @@ 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,
|
|
@@ -126,10 +126,10 @@ var Index = function Index(_ref) {
|
|
|
126
126
|
});
|
|
127
127
|
var selfAfterClose = function selfAfterClose() {
|
|
128
128
|
if (autoClear) {
|
|
129
|
-
|
|
129
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
133
133
|
};
|
|
134
134
|
return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
|
|
135
135
|
title: modalTitle,
|
|
@@ -142,7 +142,6 @@ var Index = function Index(_ref) {
|
|
|
142
142
|
setLoading(false);
|
|
143
143
|
}
|
|
144
144
|
}, props), {}, {
|
|
145
|
-
onOk: currentForm.submit,
|
|
146
145
|
destroyOnClose: destroyOnClose,
|
|
147
146
|
footer: defaultFooter,
|
|
148
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,7 +90,7 @@ 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,
|
|
@@ -99,10 +99,10 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
99
99
|
});
|
|
100
100
|
const selfAfterClose = () => {
|
|
101
101
|
if (autoClear) {
|
|
102
|
-
|
|
102
|
+
currentForm?.clear();
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
currentForm?.resetFormStatus();
|
|
106
106
|
};
|
|
107
107
|
return (
|
|
108
108
|
<Modal
|
|
@@ -116,7 +116,6 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
116
116
|
setLoading(false);
|
|
117
117
|
}}
|
|
118
118
|
{...props}
|
|
119
|
-
onOk={currentForm.submit}
|
|
120
119
|
destroyOnClose={destroyOnClose}
|
|
121
120
|
footer={defaultFooter}
|
|
122
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,
|
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) => {
|
|
@@ -24,6 +24,7 @@ const data = [
|
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
|
|
27
28
|
const time = async () => {
|
|
28
29
|
return new Promise((resolve, reject) => {
|
|
29
30
|
return setTimeout(() => {
|
|
@@ -31,6 +32,7 @@ const time = async () => {
|
|
|
31
32
|
}, 3000);
|
|
32
33
|
});
|
|
33
34
|
};
|
|
35
|
+
|
|
34
36
|
export default () => {
|
|
35
37
|
const modalForm = useHDialogForm();
|
|
36
38
|
const [visible,setVisible]=useState(false);
|