Skip to content

Commit e0e4321

Browse files
committed
feat: custom valuetypemap should not cull any props
1 parent a9c1cc5 commit e0e4321

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/field/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ const ProFieldComponent: React.ForwardRefRenderFunction<
663663
? undefined
664664
: (rest?.placeholder ?? fieldProps?.placeholder),
665665
}),
666+
Object.keys(context.valueTypeMap || {})?.includes(valueType as string),
666667
),
667668
}),
668669
context.valueTypeMap || {},

packages/utils/src/pickProProps/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ const proFieldProps = `valueType request plain renderFormItem render text formIt
22

33
const proFormProps = `fieldProps isDefaultDom groupProps contentRender submitterProps submitter`;
44

5-
export function pickProProps(props: Record<string, any>) {
5+
export function pickProProps(
6+
props: Record<string, any>,
7+
customValueType = false,
8+
) {
69
const propList = `${proFieldProps} ${proFormProps}`.split(/[\s\n]+/);
710

811
const attrs = {} as Record<string, any>;
912
Object.keys(props || {}).forEach((key) => {
10-
if (propList.includes(key)) {
13+
//如果是自定义的 valueType,则不需要过滤掉,全部传给使用者
14+
if (propList.includes(key) && !customValueType) {
1115
return;
1216
}
1317
attrs[key] = props[key];

0 commit comments

Comments
 (0)