@hw-component/form 0.0.3-beta-v1 → 0.0.3-beta-v3
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/Footer.d.ts +6 -2
- package/es/DialogForm/DrawerForm/index.d.ts +1 -1
- package/es/DialogForm/DrawerForm/index.js +26 -13
- package/es/DialogForm/ModalForm.d.ts +1 -1
- package/es/DialogForm/ModalForm.js +24 -10
- package/es/DialogForm/hooks.d.ts +5 -4
- package/es/DialogForm/hooks.js +23 -10
- package/es/DialogForm/modal.d.ts +12 -6
- package/es/Form/hooks/index.d.ts +5 -3
- package/es/Form/hooks/index.js +65 -8
- package/es/Form/hooks/useHForm.js +4 -1
- package/es/Form/index.d.ts +1 -1
- package/es/Form/index.js +17 -42
- package/es/Form/modal.d.ts +6 -3
- package/es/index.d.ts +3 -2
- package/es/index.js +1 -0
- package/lib/DialogForm/DrawerForm/Footer.d.ts +6 -2
- package/lib/DialogForm/DrawerForm/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/index.js +26 -13
- package/lib/DialogForm/ModalForm.d.ts +1 -1
- package/lib/DialogForm/ModalForm.js +24 -10
- package/lib/DialogForm/hooks.d.ts +5 -4
- package/lib/DialogForm/hooks.js +23 -10
- package/lib/DialogForm/modal.d.ts +12 -6
- package/lib/Form/hooks/index.d.ts +5 -3
- package/lib/Form/hooks/index.js +65 -8
- package/lib/Form/hooks/useHForm.js +4 -1
- package/lib/Form/index.d.ts +1 -1
- package/lib/Form/index.js +16 -41
- package/lib/Form/modal.d.ts +6 -3
- package/lib/index.d.ts +3 -2
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/Footer.tsx +7 -2
- package/src/components/DialogForm/DrawerForm/index.tsx +13 -5
- package/src/components/DialogForm/ModalForm.tsx +14 -6
- package/src/components/DialogForm/hooks.ts +19 -6
- package/src/components/DialogForm/modal.ts +13 -6
- package/src/components/Form/FormItem/UpFormItem.tsx +1 -1
- package/src/components/Form/hooks/index.ts +46 -7
- package/src/components/Form/hooks/useHForm.ts +6 -3
- package/src/components/Form/index.tsx +10 -14
- package/src/components/Form/modal.ts +6 -3
- package/src/components/Input/ButtonInput.tsx +7 -1
- package/src/components/Input/modal.ts +1 -1
- package/src/components/Upload/index.tsx +3 -2
- package/src/components/index.tsx +2 -0
- package/src/pages/Form/index.tsx +2 -1
- package/src/pages/ModalForm/index.tsx +20 -8
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Row, Space, Button } from "antd";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
interface IProps{
|
|
4
|
+
onOk?:VoidFunction;
|
|
5
|
+
onCancel?:VoidFunction;
|
|
6
|
+
confirmLoading?:boolean;
|
|
7
|
+
}
|
|
3
8
|
|
|
4
9
|
export default ({
|
|
5
10
|
onCancel,
|
|
6
11
|
onOk,
|
|
7
12
|
confirmLoading,
|
|
8
|
-
}:
|
|
13
|
+
}: IProps) => {
|
|
9
14
|
return (
|
|
10
15
|
<Row justify={"end"}>
|
|
11
16
|
<Space size={"middle"}>
|
|
@@ -21,6 +21,7 @@ export default ({
|
|
|
21
21
|
size,
|
|
22
22
|
form,
|
|
23
23
|
footer,
|
|
24
|
+
params,
|
|
24
25
|
...props
|
|
25
26
|
}: DialogFormProps) => {
|
|
26
27
|
const currentForm = useCurrentForm(dialogForm);
|
|
@@ -30,16 +31,18 @@ export default ({
|
|
|
30
31
|
setModalVisible,
|
|
31
32
|
initValue,
|
|
32
33
|
onAfterClose,
|
|
34
|
+
formParams
|
|
33
35
|
} = useModifyProps({
|
|
34
36
|
configData,
|
|
35
37
|
visible,
|
|
36
38
|
initialValues,
|
|
37
39
|
dialogForm: currentForm,
|
|
40
|
+
params
|
|
38
41
|
});
|
|
39
|
-
const cancel = (
|
|
42
|
+
const cancel = () => {
|
|
40
43
|
onAfterClose();
|
|
41
44
|
if (onCancel) {
|
|
42
|
-
return onCancel?.(
|
|
45
|
+
return onCancel?.();
|
|
43
46
|
}
|
|
44
47
|
setModalVisible(false);
|
|
45
48
|
};
|
|
@@ -73,9 +76,14 @@ export default ({
|
|
|
73
76
|
initialValues={initValue}
|
|
74
77
|
{...props}
|
|
75
78
|
form={currentForm}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
params={formParams}
|
|
80
|
+
onFinish={async (values,subParams) => {
|
|
81
|
+
const result = await run(values,subParams);
|
|
82
|
+
const close = onOk?.(result,subParams);
|
|
83
|
+
if (close === false) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
cancel();
|
|
79
87
|
}}
|
|
80
88
|
infoRequest={infoRequest}
|
|
81
89
|
labelWidth={labelWidth}
|
|
@@ -13,19 +13,22 @@ export default ({
|
|
|
13
13
|
dialogForm,
|
|
14
14
|
initialValues = {},
|
|
15
15
|
onFinish,
|
|
16
|
+
params,
|
|
17
|
+
onOk,
|
|
16
18
|
...props
|
|
17
19
|
}: DialogFormProps) => {
|
|
18
20
|
const currentForm = useCurrentForm(dialogForm);
|
|
19
|
-
const { modalVisible, modalFormData, setModalVisible, initValue } =
|
|
21
|
+
const { modalVisible, modalFormData, setModalVisible, initValue ,formParams} =
|
|
20
22
|
useModifyProps({
|
|
21
23
|
configData,
|
|
22
24
|
visible,
|
|
23
25
|
initialValues,
|
|
24
26
|
dialogForm: currentForm,
|
|
27
|
+
params
|
|
25
28
|
});
|
|
26
|
-
const cancel = (
|
|
29
|
+
const cancel = () => {
|
|
27
30
|
if (onCancel) {
|
|
28
|
-
return onCancel?.(
|
|
31
|
+
return onCancel?.();
|
|
29
32
|
}
|
|
30
33
|
setModalVisible(false);
|
|
31
34
|
};
|
|
@@ -47,11 +50,16 @@ export default ({
|
|
|
47
50
|
<HForm
|
|
48
51
|
configData={modalFormData}
|
|
49
52
|
initialValues={initValue}
|
|
50
|
-
onFinish={async (values) => {
|
|
51
|
-
await run(values);
|
|
52
|
-
|
|
53
|
+
onFinish={async (values,params) => {
|
|
54
|
+
const result = await run(values,params);
|
|
55
|
+
const close = onOk?.(result,params);
|
|
56
|
+
if (close === false) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
cancel();
|
|
53
60
|
}}
|
|
54
61
|
{...props}
|
|
62
|
+
params={formParams}
|
|
55
63
|
form={currentForm}
|
|
56
64
|
infoRequest={infoRequest}
|
|
57
65
|
/>
|
|
@@ -13,31 +13,43 @@ export const useModifyProps = ({
|
|
|
13
13
|
initialValues,
|
|
14
14
|
dialogForm,
|
|
15
15
|
afterClose,
|
|
16
|
+
params
|
|
16
17
|
}: ModifyPropsModal) => {
|
|
17
18
|
const [modalVisible, setModalVisible] = useState(visible);
|
|
18
19
|
const [modalFormData, setModalFormData] = useState(configData);
|
|
19
20
|
const [initValue, setInitValue] = useState(initialValues);
|
|
21
|
+
const [formParams,setFormParams]=useState(params);
|
|
20
22
|
const onAfterClose = () => {
|
|
21
23
|
setTimeout(() => {
|
|
22
24
|
dialogForm.resetFields();
|
|
23
25
|
afterClose?.();
|
|
24
|
-
},
|
|
26
|
+
}, 100);
|
|
25
27
|
};
|
|
28
|
+
|
|
26
29
|
useEffect(() => {
|
|
27
30
|
setModalVisible(visible);
|
|
28
31
|
}, [visible]);
|
|
32
|
+
|
|
29
33
|
useEffect(() => {
|
|
30
34
|
setModalFormData(configData);
|
|
31
35
|
}, [configData]);
|
|
36
|
+
useEffect(()=>{
|
|
37
|
+
setFormParams(params)
|
|
38
|
+
},[params])
|
|
39
|
+
|
|
32
40
|
useEffect(() => {
|
|
33
|
-
dialogForm.show = (
|
|
41
|
+
dialogForm.show = (showParams = {}) => {
|
|
34
42
|
const {
|
|
35
43
|
configData: changeConfigData,
|
|
36
44
|
initialValues: changeInitialValues,
|
|
37
|
-
|
|
45
|
+
params
|
|
46
|
+
} = showParams;
|
|
38
47
|
if (!!changeConfigData) {
|
|
39
48
|
setModalFormData(changeConfigData);
|
|
40
49
|
}
|
|
50
|
+
if (!!params){
|
|
51
|
+
setFormParams(params);
|
|
52
|
+
}
|
|
41
53
|
setInitValue(changeInitialValues);
|
|
42
54
|
setModalVisible(true);
|
|
43
55
|
};
|
|
@@ -54,6 +66,7 @@ export const useModifyProps = ({
|
|
|
54
66
|
initValue,
|
|
55
67
|
setInitValue,
|
|
56
68
|
onAfterClose,
|
|
69
|
+
formParams
|
|
57
70
|
};
|
|
58
71
|
};
|
|
59
72
|
export const useHDialogForm = () => {
|
|
@@ -74,12 +87,12 @@ export const useCurrentForm = (hDialogForm?: HDialogFormInstance) => {
|
|
|
74
87
|
|
|
75
88
|
export const useSub = ({ request, onFinish }: Partial<DialogFormProps>) => {
|
|
76
89
|
return useRequest(
|
|
77
|
-
async (values) => {
|
|
90
|
+
async (values,params) => {
|
|
78
91
|
if (onFinish) {
|
|
79
|
-
return onFinish(values);
|
|
92
|
+
return onFinish(values,params);
|
|
80
93
|
}
|
|
81
94
|
if (request) {
|
|
82
|
-
return request(values);
|
|
95
|
+
return request(values,params);
|
|
83
96
|
}
|
|
84
97
|
},
|
|
85
98
|
{ manual: true }
|
|
@@ -4,24 +4,31 @@ import type { PromiseFnResult } from "../modal";
|
|
|
4
4
|
|
|
5
5
|
type RootProps = HFormProps & ModalProps;
|
|
6
6
|
|
|
7
|
-
export interface ModifyPropsModal {
|
|
7
|
+
export interface ModifyPropsModal<P = any> {
|
|
8
8
|
configData: HItemProps[];
|
|
9
9
|
visible?: boolean;
|
|
10
10
|
initialValues?: Record<string, any>;
|
|
11
11
|
dialogForm: HDialogFormInstance;
|
|
12
12
|
afterClose?: VoidFunction;
|
|
13
|
+
params?: P;
|
|
13
14
|
}
|
|
14
|
-
export interface ShowParamsModal {
|
|
15
|
+
export interface ShowParamsModal<P = any, T = any> {
|
|
15
16
|
configData?: HItemProps[];
|
|
16
17
|
visible?: boolean;
|
|
17
18
|
initialValues?: Record<string, any>;
|
|
19
|
+
infoRequest?: PromiseFnResult<P, T>;
|
|
20
|
+
params?: P;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export interface HDialogFormInstance extends HFormInstance {
|
|
21
|
-
show: (data?: ShowParamsModal) => void;
|
|
23
|
+
export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
24
|
+
show: (data?: ShowParamsModal<P, T>) => void;
|
|
22
25
|
hide: VoidFunction;
|
|
23
26
|
}
|
|
24
|
-
export interface DialogFormProps
|
|
27
|
+
export interface DialogFormProps<P = any, T = any>
|
|
28
|
+
extends Omit<RootProps, "onFinish" | "onCancel" | "onOk" | "infoRequest"> {
|
|
25
29
|
dialogForm?: HDialogFormInstance;
|
|
26
|
-
onFinish?:
|
|
30
|
+
onFinish?:(values:T,params:P)=>Promise<any>;
|
|
31
|
+
onCancel?: VoidFunction;
|
|
32
|
+
onOk?: (data: T,params:P) => boolean | undefined;
|
|
33
|
+
infoRequest?: (params: P) => Promise<T>;
|
|
27
34
|
}
|
|
@@ -1,22 +1,61 @@
|
|
|
1
1
|
import { useRequest } from "ahooks";
|
|
2
|
-
import type { HFormProps } from "
|
|
2
|
+
import type { HFormProps, HFormInstance } from "../modal";
|
|
3
3
|
import useHForm from "./useHForm";
|
|
4
|
-
import
|
|
4
|
+
import {useEffect, useMemo} from "react";
|
|
5
5
|
export const useCurrentForm = (form?: HFormInstance) => {
|
|
6
6
|
const selfForm = useHForm();
|
|
7
7
|
return form || selfForm;
|
|
8
8
|
};
|
|
9
9
|
type ParamsModal = Omit<HFormProps, "configData">;
|
|
10
10
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
11
|
+
export const useInfoReq = ({
|
|
12
|
+
initialValues,
|
|
13
|
+
infoRequest,
|
|
14
|
+
form,
|
|
15
|
+
params,
|
|
16
|
+
request,
|
|
17
|
+
onFinish,
|
|
18
|
+
}: ParamsModal) => {
|
|
19
|
+
const reqData = useMemo(() => {
|
|
20
|
+
const saveParams = params || {};
|
|
21
|
+
return {
|
|
22
|
+
params: saveParams,
|
|
23
|
+
};
|
|
24
|
+
}, [params]);
|
|
25
|
+
|
|
26
|
+
const subControl = useRequest(
|
|
13
27
|
async (value) => {
|
|
14
28
|
const subVal = form?.outputValues(value);
|
|
15
29
|
if (request) {
|
|
16
|
-
await request(subVal);
|
|
30
|
+
await request(subVal,reqData.params);
|
|
17
31
|
}
|
|
18
|
-
onFinish?.(subVal);
|
|
32
|
+
onFinish?.(subVal,reqData.params);
|
|
19
33
|
},
|
|
20
34
|
{ manual: true }
|
|
21
35
|
);
|
|
22
|
-
|
|
36
|
+
const infoControl = useRequest(async (reqParams = reqData.params) => {
|
|
37
|
+
let setValue = initialValues;
|
|
38
|
+
reqData.params = reqParams;
|
|
39
|
+
if (!initialValues && !infoRequest) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
if (infoRequest) {
|
|
43
|
+
setValue = await infoRequest(reqParams);
|
|
44
|
+
}
|
|
45
|
+
form?.setFieldsValue(setValue);
|
|
46
|
+
return setValue || {};
|
|
47
|
+
});
|
|
48
|
+
const {run,mutate}=infoControl;
|
|
49
|
+
useEffect(()=>{
|
|
50
|
+
if (form){
|
|
51
|
+
form.reload=(params)=>{
|
|
52
|
+
mutate(undefined);
|
|
53
|
+
return run(params);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
},[]);
|
|
57
|
+
return {
|
|
58
|
+
subControl,
|
|
59
|
+
infoControl,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -14,7 +14,7 @@ export default () => {
|
|
|
14
14
|
const formatSourceData: Record<string, FormatItemModal> = {};
|
|
15
15
|
let dispatchSourceData: Record<string, DispatchItemData> = {};
|
|
16
16
|
let cacheValues: Record<string, any> = {};
|
|
17
|
-
let isLoading=false;
|
|
17
|
+
let isLoading = false;
|
|
18
18
|
const norAddItemDispatch = (name, fn) => {
|
|
19
19
|
if (!name) {
|
|
20
20
|
return {
|
|
@@ -30,12 +30,15 @@ export default () => {
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
return {
|
|
33
|
+
reload:(params)=>{
|
|
34
|
+
return Promise.resolve(params);
|
|
35
|
+
},
|
|
33
36
|
initValues() {
|
|
34
37
|
if (cacheValues) {
|
|
35
38
|
const newValue = this.formatValues(cacheValues);
|
|
36
39
|
form.setFieldsValue(newValue);
|
|
37
40
|
}
|
|
38
|
-
isLoading=true;
|
|
41
|
+
isLoading = true;
|
|
39
42
|
},
|
|
40
43
|
addFormat(name: string, format?: FormatItemModal) {
|
|
41
44
|
if (!format) {
|
|
@@ -127,7 +130,7 @@ export default () => {
|
|
|
127
130
|
},
|
|
128
131
|
...form,
|
|
129
132
|
setFieldsValue(values) {
|
|
130
|
-
if (!isLoading){
|
|
133
|
+
if (!isLoading) {
|
|
131
134
|
cacheValues = values;
|
|
132
135
|
return;
|
|
133
136
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Form } from "antd";
|
|
2
2
|
import type { HFormProps } from "./modal";
|
|
3
3
|
import Item from "./FormItem";
|
|
4
|
-
import { useCurrentForm,
|
|
4
|
+
import { useCurrentForm, useInfoReq } from "./hooks";
|
|
5
5
|
import { FormContext } from "./Context";
|
|
6
6
|
import PageHandler from "../PageHandler";
|
|
7
7
|
import useInitConfigData from "./hooks/useInitConfigData";
|
|
8
8
|
import { useEffect } from "react";
|
|
9
|
-
import { useRequest } from "ahooks";
|
|
10
9
|
import InitSet from "./InitSet";
|
|
11
10
|
|
|
12
11
|
export default ({
|
|
@@ -18,6 +17,7 @@ export default ({
|
|
|
18
17
|
infoRequest,
|
|
19
18
|
valueType = "float",
|
|
20
19
|
initialValues,
|
|
20
|
+
params = {},
|
|
21
21
|
...props
|
|
22
22
|
}: HFormProps) => {
|
|
23
23
|
const hForm = useCurrentForm(form);
|
|
@@ -25,28 +25,24 @@ export default ({
|
|
|
25
25
|
configData,
|
|
26
26
|
form: hForm,
|
|
27
27
|
});
|
|
28
|
-
const {
|
|
28
|
+
const { subControl, infoControl } = useInfoReq({
|
|
29
|
+
initialValues,
|
|
29
30
|
request,
|
|
30
31
|
onFinish,
|
|
31
32
|
valueType,
|
|
32
33
|
form: hForm,
|
|
34
|
+
infoRequest,
|
|
35
|
+
params,
|
|
33
36
|
});
|
|
37
|
+
|
|
38
|
+
const { run, loading } = subControl;
|
|
34
39
|
const {
|
|
35
40
|
run: infoRun,
|
|
36
41
|
loading: infoLoading,
|
|
37
42
|
error: infoErr,
|
|
38
43
|
data: infoData,
|
|
39
|
-
} =
|
|
40
|
-
|
|
41
|
-
if (!initialValues && !infoRequest) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
if (infoRequest) {
|
|
45
|
-
setValue = await infoRequest();
|
|
46
|
-
}
|
|
47
|
-
hForm.setFieldsValue(setValue);
|
|
48
|
-
return setValue||{};
|
|
49
|
-
});
|
|
44
|
+
} = infoControl;
|
|
45
|
+
|
|
50
46
|
useEffect(() => {
|
|
51
47
|
return () => {
|
|
52
48
|
hForm.removeDispatchListener();
|
|
@@ -70,13 +70,15 @@ export interface HItemProps extends Omit<FormItemProps, "name"> {
|
|
|
70
70
|
name?: string;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form"> {
|
|
73
|
+
export interface HFormProps<T = any, R = any> extends Omit<FormProps, "form"|"onFinish"> {
|
|
74
74
|
configData: HItemProps[];
|
|
75
75
|
labelWidth?: number;
|
|
76
|
-
request?:
|
|
77
|
-
infoRequest?:
|
|
76
|
+
request?: (values:T,params?:any)=>Promise<R>;
|
|
77
|
+
infoRequest?: PromiseFnResult;
|
|
78
78
|
valueType?: string;
|
|
79
79
|
form?: HFormInstance;
|
|
80
|
+
params?: any;
|
|
81
|
+
onFinish?:(values:T,params?:any)=>void;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export interface HFormItemProps extends HItemProps {
|
|
@@ -122,6 +124,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
122
124
|
outputValues: (values?: Record<string, any>) => Record<string, any>;
|
|
123
125
|
addDispatchListener: AddDispatchListenerFn;
|
|
124
126
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
127
|
+
reload:PromiseFnResult;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export interface ConnectConfigModal {
|
|
@@ -32,7 +32,13 @@ const Index: React.FC<HButtonInputProps> = ({
|
|
|
32
32
|
return (
|
|
33
33
|
<Input.Group compact style={{ display: "flex" }}>
|
|
34
34
|
<Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
|
|
35
|
-
<Button
|
|
35
|
+
<Button
|
|
36
|
+
{...oProps}
|
|
37
|
+
type={type}
|
|
38
|
+
onClick={click}
|
|
39
|
+
loading={loading}
|
|
40
|
+
style={{ marginLeft: 4 }}
|
|
41
|
+
>
|
|
36
42
|
{children}
|
|
37
43
|
</Button>
|
|
38
44
|
</Input.Group>
|
|
@@ -24,7 +24,7 @@ export interface HSelectInputProps
|
|
|
24
24
|
export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
25
25
|
onClick: (
|
|
26
26
|
value: string | readonly string[] | number | undefined,
|
|
27
|
-
onChange?:(val:any)=>void
|
|
27
|
+
onChange?: (val: any) => void
|
|
28
28
|
) => void;
|
|
29
29
|
}
|
|
30
30
|
export interface HButtonInputProps extends HInputProps {
|
|
@@ -61,7 +61,8 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
61
61
|
inputValue: (item, initValue) => {
|
|
62
62
|
const { name = "" } = item;
|
|
63
63
|
const initFileList = initValue[name] || [];
|
|
64
|
-
const relInitFileList=
|
|
64
|
+
const relInitFileList =
|
|
65
|
+
typeof initFileList === "string" ? [initFileList] : initFileList;
|
|
65
66
|
const fileList = relInitFileList.map((url, index) => {
|
|
66
67
|
return {
|
|
67
68
|
name: url,
|
|
@@ -84,7 +85,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
84
85
|
return fileItem.response.url;
|
|
85
86
|
});
|
|
86
87
|
return {
|
|
87
|
-
[valueName]: maxCount===1?urls[0]:urls,
|
|
88
|
+
[valueName]: maxCount === 1 ? urls[0] : urls,
|
|
88
89
|
};
|
|
89
90
|
},
|
|
90
91
|
},
|
package/src/components/index.tsx
CHANGED
|
@@ -4,6 +4,8 @@ import PageHandler from "./PageHandler";
|
|
|
4
4
|
export { default as HForm } from "./Form";
|
|
5
5
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
6
6
|
export { useHDialogForm } from "./DialogForm/hooks";
|
|
7
|
+
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
8
|
+
|
|
7
9
|
import ModalForm from "./DialogForm/ModalForm";
|
|
8
10
|
import DrawerForm from "./DialogForm/DrawerForm";
|
|
9
11
|
export const HSelect = FormConfig.select;
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -128,7 +128,8 @@ export default () => {
|
|
|
128
128
|
testEnd: "1693538359",
|
|
129
129
|
op: 1,
|
|
130
130
|
opInput: "12121",
|
|
131
|
-
upload:
|
|
131
|
+
upload:
|
|
132
|
+
"https://img2.baidu.com/it/u=2048195462,703560066&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=333",
|
|
132
133
|
});
|
|
133
134
|
}, 3000);
|
|
134
135
|
});
|
|
@@ -97,20 +97,18 @@ const data = [
|
|
|
97
97
|
rules: [{ required: true }],
|
|
98
98
|
},
|
|
99
99
|
];
|
|
100
|
+
let num=0;
|
|
100
101
|
export default () => {
|
|
101
102
|
const modalForm = useHDialogForm();
|
|
102
103
|
return (
|
|
103
104
|
<>
|
|
104
105
|
<Button
|
|
105
106
|
onClick={() => {
|
|
107
|
+
num++
|
|
106
108
|
modalForm.show({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
testEnd: "1693538359",
|
|
111
|
-
op: 1,
|
|
112
|
-
opInput: "12121",
|
|
113
|
-
},
|
|
109
|
+
params:{
|
|
110
|
+
name:num
|
|
111
|
+
}
|
|
114
112
|
});
|
|
115
113
|
}}
|
|
116
114
|
>
|
|
@@ -119,7 +117,21 @@ export default () => {
|
|
|
119
117
|
<HModalForm
|
|
120
118
|
configData={data}
|
|
121
119
|
labelWidth={88}
|
|
122
|
-
|
|
120
|
+
request={(val,params)=>{
|
|
121
|
+
console.log(val,params);
|
|
122
|
+
}}
|
|
123
|
+
infoRequest={(ppp) => {
|
|
124
|
+
console.log(ppp)
|
|
125
|
+
return Promise.resolve({
|
|
126
|
+
check1: 1,
|
|
127
|
+
testStart: "1694747960",
|
|
128
|
+
testEnd: "1693538359",
|
|
129
|
+
op: 1,
|
|
130
|
+
opInput: "12121",
|
|
131
|
+
name:ppp.name
|
|
132
|
+
});
|
|
133
|
+
}}
|
|
134
|
+
dialogForm={modalForm}
|
|
123
135
|
title="测试"
|
|
124
136
|
/>
|
|
125
137
|
</>
|