fix: chart field default value set error
This commit is contained in:
parent
d48ef598f6
commit
b563f3727b
@ -1,4 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
|
CollectionFieldProvider,
|
||||||
|
CollectionManagerProvider,
|
||||||
|
CollectionProvider,
|
||||||
|
DEFAULT_DATA_SOURCE_KEY,
|
||||||
SchemaComponent,
|
SchemaComponent,
|
||||||
VariableInput,
|
VariableInput,
|
||||||
VariableScopeProvider,
|
VariableScopeProvider,
|
||||||
@ -40,19 +44,29 @@ export const ChartFilterVariableInput: React.FC<any> = (props) => {
|
|||||||
}
|
}
|
||||||
}, [fieldSchema.default, handleChange]);
|
}, [fieldSchema.default, handleChange]);
|
||||||
|
|
||||||
|
const dataSource = schema?.['x-data-source'] || DEFAULT_DATA_SOURCE_KEY;
|
||||||
|
const collectionField = schema?.['x-collection-field'] || '';
|
||||||
|
const [collection] = collectionField.split('.');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<VariableScopeProvider scope={options}>
|
<CollectionManagerProvider dataSource={dataSource}>
|
||||||
<VariableInput
|
<CollectionProvider name={collection} allowNull={!collection}>
|
||||||
{...componentProps}
|
<CollectionFieldProvider name={schema['x-collection-field']} allowNull={!schema['x-collection-field']}>
|
||||||
renderSchemaComponent={() => <SchemaComponent schema={schema} />}
|
<VariableScopeProvider scope={options}>
|
||||||
fieldNames={{}}
|
<VariableInput
|
||||||
value={value?.value}
|
{...componentProps}
|
||||||
scope={options}
|
renderSchemaComponent={() => <SchemaComponent schema={schema} />}
|
||||||
onChange={(v: any) => {
|
fieldNames={{}}
|
||||||
onChange({ value: v });
|
value={value?.value}
|
||||||
}}
|
scope={options}
|
||||||
shouldChange={getShouldChange({} as any)}
|
onChange={(v: any) => {
|
||||||
/>
|
onChange({ value: v });
|
||||||
</VariableScopeProvider>
|
}}
|
||||||
|
shouldChange={getShouldChange({} as any)}
|
||||||
|
/>
|
||||||
|
</VariableScopeProvider>
|
||||||
|
</CollectionFieldProvider>
|
||||||
|
</CollectionProvider>
|
||||||
|
</CollectionManagerProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user