mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 07:29:24 +08:00
feat: update VariableFilters to use CardItem and enhance form handling
This commit is contained in:
parent
3f6cae33ec
commit
b271f0cbc3
@ -122,14 +122,20 @@ export function Filter({ config, filter, filterId, previousFilters }) {
|
||||
},
|
||||
};
|
||||
};
|
||||
const argsMap = config.uiSchema
|
||||
? Object.fromEntries(config.uiSchema.map((param, index) => [param.name, filter.args[index]]))
|
||||
: {};
|
||||
|
||||
const useFormBlockProps = () => {
|
||||
return { form, layout: 'vertical' };
|
||||
return { form: createForm({ initialValues: argsMap }), layout: 'vertical' };
|
||||
};
|
||||
|
||||
const WithPropOver = ({ children }) => {
|
||||
const { value } = useVariable();
|
||||
const schema = {
|
||||
'x-uid': uid(),
|
||||
type: 'void',
|
||||
'x-component': 'CardItem',
|
||||
properties: {
|
||||
form: {
|
||||
'x-uid': uid(),
|
||||
type: 'void',
|
||||
'x-component': 'FormV2',
|
||||
@ -186,20 +192,22 @@ export function Filter({ config, filter, filterId, previousFilters }) {
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return (
|
||||
<Popover
|
||||
open={open}
|
||||
onOpenChange={handleOpenChange}
|
||||
content={
|
||||
const Content = (
|
||||
<SchemaComponent
|
||||
schema={schema}
|
||||
scope={{ useSaveActionProps, useFormBlockProps, useDeleteActionProps, outputValue, inputValue }}
|
||||
basePath={['']}
|
||||
/>
|
||||
}
|
||||
trigger={'hover'}
|
||||
>
|
||||
);
|
||||
|
||||
const WithPropOver = ({ children }) => {
|
||||
const { value } = useVariable();
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={handleOpenChange} content={Content} trigger={'click'}>
|
||||
{children}
|
||||
</Popover>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user