refactor: add filter support to multi-app management (#7124)

This commit is contained in:
Katherine 2025-06-27 14:15:34 +08:00 committed by GitHub
parent a4eb026ea4
commit 940002a876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,8 @@ import {
useRequest,
useResourceActionContext,
useResourceContext,
useFilterFieldProps,
useFilterFieldOptions,
} from '@nocobase/client';
import React from 'react';
import { i18nText } from '../../utils';
@ -212,6 +214,16 @@ export const tableActionColumnSchema: ISchema = {
},
};
export const useFilterActionProps = () => {
const { collection } = useResourceContext();
const options = useFilterFieldOptions(collection.fields);
const service = useResourceActionContext();
return useFilterFieldProps({
options: options,
params: service.state?.params?.[0] || service.params,
service,
});
};
export const schema: ISchema = {
type: 'object',
properties: {
@ -245,6 +257,18 @@ export const schema: ISchema = {
},
},
properties: {
filter: {
'x-component': 'Filter.Action',
'x-use-component-props': useFilterActionProps,
default: {
$and: [{ displayName: { $includes: '' } }, { name: { $includes: '' } }],
},
title: "{{t('Filter')}}",
'x-component-props': {
icon: 'FilterOutlined',
},
'x-align': 'left',
},
delete: {
type: 'void',
title: '{{ t("Delete") }}',