CollectionFilterPanel

CollectionFilterPanel 用来把 Collection 多条件筛选表单直接嵌在 drawer、设置页或自定义面板里。

如果你只需要一个点击后弹出筛选表单的按钮,默认用 CollectionFilter

基本用法

import { CollectionFilterPanel, type CollectionFilterPanelRef } from '@nocobase/client-v2';

const ref = useRef<CollectionFilterPanelRef>(null);

<CollectionFilterPanel ref={ref} collection={collection} t={t} />;

const filter = ref.current?.getFilter();

API

参数类型说明
collectionCollection | undefined字段来源
initialValueRecord<string, unknown> | undefined初始 filter
onChange(filter) => void条件变化或 reset 时触发
t(key, options?) => string翻译函数
filterableFieldNamesstring[]字段白名单
nonfilterableFieldNamesstring[]字段黑名单
noIgnoreboolean跳过白名单限制

ref 暴露:

方法说明
getFilter()获取当前编译后的 filter
reset()清空条件

相关链接