mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 04:40:10 +00:00
refactor(CollectionFieldInternalField): remove useless code
This commit is contained in:
parent
2e06a04f73
commit
38320fe489
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
import { Field } from '@formily/core';
|
import { Field } from '@formily/core';
|
||||||
import { connect, Schema, useField, useFieldSchema } from '@formily/react';
|
import { connect, Schema, useField, useFieldSchema } from '@formily/react';
|
||||||
import { untracked } from '@formily/reactive';
|
|
||||||
import { merge } from '@formily/shared';
|
import { merge } from '@formily/shared';
|
||||||
import { concat } from 'lodash';
|
import { concat } from 'lodash';
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
@ -24,11 +23,9 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const setFieldProps = (field: Field, key: string, value: any) => {
|
const setFieldProps = (field: Field, key: string, value: any) => {
|
||||||
untracked(() => {
|
|
||||||
if (field[key] === undefined) {
|
if (field[key] === undefined) {
|
||||||
field[key] = value;
|
field[key] = value;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setRequired = (field: Field, fieldSchema: Schema, uiSchema: Schema) => {
|
const setRequired = (field: Field, fieldSchema: Schema, uiSchema: Schema) => {
|
||||||
@ -78,7 +75,7 @@ export const CollectionFieldInternalField: React.FC = (props: Props) => {
|
|||||||
setRequired(field, fieldSchema, uiSchema);
|
setRequired(field, fieldSchema, uiSchema);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
field.dataSource = uiSchema.enum;
|
field.dataSource = uiSchema.enum;
|
||||||
const originalProps = compile(uiSchema['x-component-props']) || {};
|
const originalProps = uiSchema['x-component-props'] || {};
|
||||||
field.componentProps = merge(originalProps, field.componentProps || {}, dynamicProps || {});
|
field.componentProps = merge(originalProps, field.componentProps || {}, dynamicProps || {});
|
||||||
}, [uiSchemaOrigin]);
|
}, [uiSchemaOrigin]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user