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:
parent
641ca2dcca
commit
76e95729e4
@ -84,8 +84,8 @@ export const recursiveParent = (schema: Schema, component) => {
|
|||||||
return schema['x-component'] === component
|
return schema['x-component'] === component
|
||||||
? schema
|
? schema
|
||||||
: schema.parent
|
: schema.parent
|
||||||
? recursiveParent(schema.parent, component)
|
? recursiveParent(schema.parent, component)
|
||||||
: null;
|
: null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useAssociationNames = (collection) => {
|
const useAssociationNames = (collection) => {
|
||||||
@ -256,6 +256,7 @@ export const useTableSelectorProps = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ctx?.service?.loading) {
|
if (!ctx?.service?.loading) {
|
||||||
field.value = ctx?.service?.data?.data;
|
field.value = ctx?.service?.data?.data;
|
||||||
|
field?.setInitialValue?.(ctx?.service?.data?.data);
|
||||||
field.data = field.data || {};
|
field.data = field.data || {};
|
||||||
field.data.selectedRowKeys = ctx?.field?.data?.selectedRowKeys;
|
field.data.selectedRowKeys = ctx?.field?.data?.selectedRowKeys;
|
||||||
field.componentProps.pagination = field.componentProps.pagination || {};
|
field.componentProps.pagination = field.componentProps.pagination || {};
|
||||||
|
@ -49,7 +49,6 @@ const InternalField: React.FC = (props: Props) => {
|
|||||||
const defaultVal = fieldSchema.default || defaultValue;
|
const defaultVal = fieldSchema.default || defaultValue;
|
||||||
defaultVal !== null && defaultVal !== undefined && setFieldProps('initialValue', defaultVal);
|
defaultVal !== null && defaultVal !== undefined && setFieldProps('initialValue', defaultVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!field.validator && (uiSchema['x-validator'] || fieldSchema['x-validator'])) {
|
if (!field.validator && (uiSchema['x-validator'] || fieldSchema['x-validator'])) {
|
||||||
const concatSchema = concat([], uiSchema['x-validator'] || [], fieldSchema['x-validator'] || []);
|
const concatSchema = concat([], uiSchema['x-validator'] || [], fieldSchema['x-validator'] || []);
|
||||||
field.validator = concatSchema;
|
field.validator = concatSchema;
|
||||||
|
Loading…
Reference in New Issue
Block a user