mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
refactor: add filter support to multi-app management (#7124)
This commit is contained in:
parent
a4eb026ea4
commit
940002a876
@ -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") }}',
|
||||
|
Loading…
x
Reference in New Issue
Block a user