@hw-component/form 1.10.89 → 1.10.91
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 +8 -5
- package/es/DialogForm/hooks.js +2 -8
- package/es/Form/FormItem/hooks.d.ts +1 -1
- package/es/Form/hooks/useHForm.js +2 -0
- package/lib/DialogForm/ModalForm.js +8 -5
- package/lib/DialogForm/hooks.js +2 -8
- 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 +9 -6
- package/src/components/DialogForm/hooks.tsx +1 -7
- 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 +3 -0
|
@@ -55,6 +55,10 @@ var Index = function Index(_ref) {
|
|
|
55
55
|
modalTitle = _useModifyProps.title,
|
|
56
56
|
saveOldParams = _useModifyProps.saveOldParams;
|
|
57
57
|
var cancel = function cancel() {
|
|
58
|
+
if (dialogForm) {
|
|
59
|
+
dialogForm.hide();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
58
62
|
saveOldParams();
|
|
59
63
|
if (onCancel) {
|
|
60
64
|
return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
@@ -98,7 +102,7 @@ var Index = function Index(_ref) {
|
|
|
98
102
|
}();
|
|
99
103
|
var footerOnOk = function footerOnOk() {
|
|
100
104
|
if (modalFormData) {
|
|
101
|
-
|
|
105
|
+
currentForm === null || currentForm === void 0 || currentForm.submit();
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
104
108
|
finish({}, formParams);
|
|
@@ -114,7 +118,7 @@ var Index = function Index(_ref) {
|
|
|
114
118
|
infoRequest: infoRequest
|
|
115
119
|
}));
|
|
116
120
|
var defaultFooter = useFooterRender({
|
|
117
|
-
dialogForm:
|
|
121
|
+
dialogForm: currentForm,
|
|
118
122
|
footer: footer,
|
|
119
123
|
confirmLoading: loading,
|
|
120
124
|
params: formParams,
|
|
@@ -123,10 +127,10 @@ var Index = function Index(_ref) {
|
|
|
123
127
|
});
|
|
124
128
|
var selfAfterClose = function selfAfterClose() {
|
|
125
129
|
if (autoClear) {
|
|
126
|
-
|
|
130
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
127
131
|
return;
|
|
128
132
|
}
|
|
129
|
-
|
|
133
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
130
134
|
};
|
|
131
135
|
return jsx(Modal, _objectSpread(_objectSpread({
|
|
132
136
|
title: modalTitle,
|
|
@@ -139,7 +143,6 @@ var Index = function Index(_ref) {
|
|
|
139
143
|
setLoading(false);
|
|
140
144
|
}
|
|
141
145
|
}, props), {}, {
|
|
142
|
-
onOk: currentForm.submit,
|
|
143
146
|
destroyOnClose: destroyOnClose,
|
|
144
147
|
footer: defaultFooter,
|
|
145
148
|
children: jsx(Index$1, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
package/es/DialogForm/hooks.js
CHANGED
|
@@ -196,7 +196,7 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
196
196
|
dialogForm = _ref4.dialogForm,
|
|
197
197
|
params = _ref4.params,
|
|
198
198
|
onOk = _ref4.onOk,
|
|
199
|
-
|
|
199
|
+
onCancel = _ref4.onCancel;
|
|
200
200
|
if (footer === null) {
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
@@ -204,13 +204,7 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
204
204
|
return footer(dialogForm, confirmLoading, params);
|
|
205
205
|
}
|
|
206
206
|
return footer || jsx(Footer, {
|
|
207
|
-
onCancel:
|
|
208
|
-
if (dialogForm) {
|
|
209
|
-
dialogForm.hide();
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
_onCancel === null || _onCancel === void 0 || _onCancel();
|
|
213
|
-
},
|
|
207
|
+
onCancel: onCancel,
|
|
214
208
|
onOk: onOk,
|
|
215
209
|
confirmLoading: confirmLoading
|
|
216
210
|
});
|
|
@@ -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() {
|
|
@@ -58,6 +58,10 @@ var Index = function Index(_ref) {
|
|
|
58
58
|
modalTitle = _useModifyProps.title,
|
|
59
59
|
saveOldParams = _useModifyProps.saveOldParams;
|
|
60
60
|
var cancel = function cancel() {
|
|
61
|
+
if (dialogForm) {
|
|
62
|
+
dialogForm.hide();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
61
65
|
saveOldParams();
|
|
62
66
|
if (onCancel) {
|
|
63
67
|
return onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
@@ -101,7 +105,7 @@ var Index = function Index(_ref) {
|
|
|
101
105
|
}();
|
|
102
106
|
var footerOnOk = function footerOnOk() {
|
|
103
107
|
if (modalFormData) {
|
|
104
|
-
|
|
108
|
+
currentForm === null || currentForm === void 0 || currentForm.submit();
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
107
111
|
finish({}, formParams);
|
|
@@ -117,7 +121,7 @@ var Index = function Index(_ref) {
|
|
|
117
121
|
infoRequest: infoRequest
|
|
118
122
|
}));
|
|
119
123
|
var defaultFooter = hooks.useFooterRender({
|
|
120
|
-
dialogForm:
|
|
124
|
+
dialogForm: currentForm,
|
|
121
125
|
footer: footer,
|
|
122
126
|
confirmLoading: loading,
|
|
123
127
|
params: formParams,
|
|
@@ -126,10 +130,10 @@ var Index = function Index(_ref) {
|
|
|
126
130
|
});
|
|
127
131
|
var selfAfterClose = function selfAfterClose() {
|
|
128
132
|
if (autoClear) {
|
|
129
|
-
|
|
133
|
+
currentForm === null || currentForm === void 0 || currentForm.clear();
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
132
|
-
|
|
136
|
+
currentForm === null || currentForm === void 0 || currentForm.resetFormStatus();
|
|
133
137
|
};
|
|
134
138
|
return jsxRuntime.jsx(antd.Modal, _objectSpread(_objectSpread({
|
|
135
139
|
title: modalTitle,
|
|
@@ -142,7 +146,6 @@ var Index = function Index(_ref) {
|
|
|
142
146
|
setLoading(false);
|
|
143
147
|
}
|
|
144
148
|
}, props), {}, {
|
|
145
|
-
onOk: currentForm.submit,
|
|
146
149
|
destroyOnClose: destroyOnClose,
|
|
147
150
|
footer: defaultFooter,
|
|
148
151
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
package/lib/DialogForm/hooks.js
CHANGED
|
@@ -197,7 +197,7 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
197
197
|
dialogForm = _ref4.dialogForm,
|
|
198
198
|
params = _ref4.params,
|
|
199
199
|
onOk = _ref4.onOk,
|
|
200
|
-
|
|
200
|
+
onCancel = _ref4.onCancel;
|
|
201
201
|
if (footer === null) {
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
@@ -205,13 +205,7 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
205
205
|
return footer(dialogForm, confirmLoading, params);
|
|
206
206
|
}
|
|
207
207
|
return footer || jsxRuntime.jsx(Footer.default, {
|
|
208
|
-
onCancel:
|
|
209
|
-
if (dialogForm) {
|
|
210
|
-
dialogForm.hide();
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
_onCancel === null || _onCancel === void 0 || _onCancel();
|
|
214
|
-
},
|
|
208
|
+
onCancel: onCancel,
|
|
215
209
|
onOk: onOk,
|
|
216
210
|
confirmLoading: confirmLoading
|
|
217
211
|
});
|
|
@@ -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
|
|
|
@@ -55,6 +55,10 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
55
55
|
autoClear,
|
|
56
56
|
});
|
|
57
57
|
const cancel = () => {
|
|
58
|
+
if (dialogForm){
|
|
59
|
+
dialogForm.hide();
|
|
60
|
+
return ;
|
|
61
|
+
}
|
|
58
62
|
saveOldParams();
|
|
59
63
|
if (onCancel) {
|
|
60
64
|
return onCancel?.();
|
|
@@ -72,7 +76,7 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
72
76
|
};
|
|
73
77
|
const footerOnOk = () => {
|
|
74
78
|
if (modalFormData) {
|
|
75
|
-
|
|
79
|
+
currentForm?.submit();
|
|
76
80
|
return;
|
|
77
81
|
}
|
|
78
82
|
finish({}, formParams);
|
|
@@ -90,7 +94,7 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
90
94
|
/>
|
|
91
95
|
);
|
|
92
96
|
const defaultFooter = useFooterRender({
|
|
93
|
-
dialogForm,
|
|
97
|
+
dialogForm:currentForm,
|
|
94
98
|
footer,
|
|
95
99
|
confirmLoading: loading,
|
|
96
100
|
params: formParams,
|
|
@@ -99,10 +103,10 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
99
103
|
});
|
|
100
104
|
const selfAfterClose = () => {
|
|
101
105
|
if (autoClear) {
|
|
102
|
-
|
|
106
|
+
currentForm?.clear();
|
|
103
107
|
return;
|
|
104
108
|
}
|
|
105
|
-
|
|
109
|
+
currentForm?.resetFormStatus();
|
|
106
110
|
};
|
|
107
111
|
return (
|
|
108
112
|
<Modal
|
|
@@ -116,7 +120,6 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
116
120
|
setLoading(false);
|
|
117
121
|
}}
|
|
118
122
|
{...props}
|
|
119
|
-
onOk={currentForm.submit}
|
|
120
123
|
destroyOnClose={destroyOnClose}
|
|
121
124
|
footer={defaultFooter}
|
|
122
125
|
>
|
|
@@ -183,13 +183,7 @@ export const useFooterRender = ({
|
|
|
183
183
|
return (
|
|
184
184
|
footer || (
|
|
185
185
|
<Footer
|
|
186
|
-
onCancel={
|
|
187
|
-
if (dialogForm) {
|
|
188
|
-
dialogForm.hide();
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
onCancel?.();
|
|
192
|
-
}}
|
|
186
|
+
onCancel={onCancel}
|
|
193
187
|
onOk={onOk}
|
|
194
188
|
confirmLoading={confirmLoading}
|
|
195
189
|
/>
|
|
@@ -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);
|
|
@@ -69,6 +71,7 @@ export default () => {
|
|
|
69
71
|
configData={data}
|
|
70
72
|
visible={visible}
|
|
71
73
|
onCancel={()=>{
|
|
74
|
+
console.log("fffff")
|
|
72
75
|
setVisible(false);
|
|
73
76
|
}}
|
|
74
77
|
formItemStyle={{
|