fix: record picker display incorrect data when field has default value in collection (#3266)

* fix: default value should not set when field is readpretty or readonly

* fix: record picker display incorrect data when field has default value in collection
This commit is contained in:
katherinehhh 2023-12-26 17:21:25 +08:00 committed by GitHub
parent 641ca2dcca
commit 76e95729e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -84,8 +84,8 @@ export const recursiveParent = (schema: Schema, component) => {
return schema['x-component'] === component
? schema
: schema.parent
? recursiveParent(schema.parent, component)
: null;
? recursiveParent(schema.parent, component)
: null;
};
const useAssociationNames = (collection) => {
@ -256,6 +256,7 @@ export const useTableSelectorProps = () => {
useEffect(() => {
if (!ctx?.service?.loading) {
field.value = ctx?.service?.data?.data;
field?.setInitialValue?.(ctx?.service?.data?.data);
field.data = field.data || {};
field.data.selectedRowKeys = ctx?.field?.data?.selectedRowKeys;
field.componentProps.pagination = field.componentProps.pagination || {};

View File

@ -49,7 +49,6 @@ const InternalField: React.FC = (props: Props) => {
const defaultVal = fieldSchema.default || defaultValue;
defaultVal !== null && defaultVal !== undefined && setFieldProps('initialValue', defaultVal);
}
if (!field.validator && (uiSchema['x-validator'] || fieldSchema['x-validator'])) {
const concatSchema = concat([], uiSchema['x-validator'] || [], fieldSchema['x-validator'] || []);
field.validator = concatSchema;