fix: time field operator set to between in filter form, component didn't change to time range picker (#6170)

This commit is contained in:
Katherine 2025-02-06 22:12:57 +08:00 committed by GitHub
parent ab6b43745f
commit 474c0421c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 5 deletions

View File

@ -55,9 +55,9 @@ export const FilterCollectionFieldInternalField: React.FC = (props: Props) => {
const { uiSchema: uiSchemaOrigin, defaultValue, interface: collectionInterface } = useCollectionField(); const { uiSchema: uiSchemaOrigin, defaultValue, interface: collectionInterface } = useCollectionField();
const { isAllowToSetDefaultValue } = useIsAllowToSetDefaultValue(); const { isAllowToSetDefaultValue } = useIsAllowToSetDefaultValue();
const targetInterface = getInterface(collectionInterface); const targetInterface = getInterface(collectionInterface);
const operator = targetInterface?.filterable?.operators?.find( const operator =
(v, index) => v.value === fieldSchema['x-filter-operator'] || index === 0, targetInterface?.filterable?.operators?.find((v, index) => v.value === fieldSchema?.['x-filter-operator']) ||
); targetInterface?.filterable?.operators?.[0];
const Component = useComponent( const Component = useComponent(
operator?.schema?.['x-component'] || operator?.schema?.['x-component'] ||
fieldSchema['x-component-props']?.['component'] || fieldSchema['x-component-props']?.['component'] ||

View File

@ -289,7 +289,7 @@ DatePicker.FilterWithPicker = function FilterWithPicker(props: any) {
const field: any = useField(); const field: any = useField();
const [stateProps, setStateProps] = useState(newProps); const [stateProps, setStateProps] = useState(newProps);
return ( return (
<Space.Compact> <Space.Compact style={{ width: '100%' }}>
<Select <Select
// @ts-ignore // @ts-ignore
role="button" role="button"

View File

@ -192,7 +192,6 @@ export const removeNullCondition = (filter, customFlat = flat) => {
export const useFilterActionProps = () => { export const useFilterActionProps = () => {
const collection = useCollection(); const collection = useCollection();
const options = useFilterOptions(collection?.name); const options = useFilterOptions(collection?.name);
console.log(options);
const props = useDataBlockProps(); const props = useDataBlockProps();
return useFilterFieldProps({ options, params: props?.params }); return useFilterFieldProps({ options, params: props?.params });
}; };