zy-react-library 1.0.49 → 1.0.51
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.
|
@@ -4,26 +4,12 @@ import type { NamePath } from "rc-field-form/lib/interface";
|
|
|
4
4
|
import type { FC, ReactNode } from "react";
|
|
5
5
|
import type { FORM_ITEM_RENDER_ENUM } from "../../enum/formItemRender";
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* 自定义渲染组件的属性
|
|
9
|
-
*/
|
|
10
|
-
export interface CustomRenderProps {
|
|
11
|
-
/** 表单当前值 */
|
|
12
|
-
formValues: FormValues;
|
|
13
|
-
/** 字段值 */
|
|
14
|
-
value?: any;
|
|
15
|
-
/** 值变化回调 */
|
|
16
|
-
onChange?: (value: any) => void;
|
|
17
|
-
/** 其他属性 */
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
7
|
/**
|
|
22
8
|
* 表单项渲染类型
|
|
23
9
|
*/
|
|
24
10
|
export type FormItemRenderType
|
|
25
11
|
= | (typeof FORM_ITEM_RENDER_ENUM)[keyof typeof FORM_ITEM_RENDER_ENUM]
|
|
26
|
-
|
|
|
12
|
+
| ReactNode;
|
|
27
13
|
|
|
28
14
|
/**
|
|
29
15
|
* 选项项数据类型
|
|
@@ -245,15 +245,7 @@ const FormItemsRenderer = ({
|
|
|
245
245
|
return null;
|
|
246
246
|
|
|
247
247
|
default:
|
|
248
|
-
|
|
249
|
-
if (typeof render === "function" || typeof render === "object") {
|
|
250
|
-
const CustomComponent = render;
|
|
251
|
-
if (typeof render === "function")
|
|
252
|
-
return <CustomComponent {...componentProps} formValues={getFormValues()} />;
|
|
253
|
-
if (typeof render === "object")
|
|
254
|
-
return <CustomComponent {...componentProps} />;
|
|
255
|
-
}
|
|
256
|
-
return <Input placeholder={placeholder} {...componentProps} />;
|
|
248
|
+
return render;
|
|
257
249
|
}
|
|
258
250
|
};
|
|
259
251
|
|