import React from "react"; import type { DataList } from "./data-list"; import type { FilterConfig, FilterValues } from "./filter-expression"; import "./filter-bar.scss"; /** 自定义过滤器类型的注册信息(公开 API,供扩展自定义过滤器) */ export interface FilterTypeRegistration { /** 过滤器控件,接收 { config, value, onChange } */ control: React.ComponentType<{ config: FilterConfig; value: any; onChange: (value: any) => void; }>; /** 自定义类型的默认表达式规则,可被 config.buildExpression 覆盖 */ defaultExpression?: (value: any) => string | undefined; } /** 注册自定义过滤器类型,FilterBar 与设计器据此渲染 */ export declare function registerFilterType(typeName: string, registration: FilterTypeRegistration): void; export declare function getFilterType(typeName: string): FilterTypeRegistration | undefined; export interface FilterGroupProps extends Omit { } export interface FilterSelectProps extends Omit { } export interface FilterSearchProps extends Omit { } export interface FilterDateRangeProps extends Omit { } /** 胶囊单选组("全部"选项用 value: "" 表示,空值不产出表达式) */ export declare function FilterGroup(props: FilterGroupProps): React.ReactElement; /** 下拉选择过滤器 */ export declare function FilterSelect(props: FilterSelectProps): React.ReactElement; /** 搜索过滤器,fields 声明参与模糊匹配的字段 */ export declare function FilterSearch(props: FilterSearchProps): React.ReactElement; /** 日期范围过滤器 */ export declare function FilterDateRange(props: FilterDateRangeProps): React.ReactElement; export interface FilterBarProps { /** 过滤器声明,使用 FilterGroup / FilterSelect / FilterSearch / FilterDateRange 作为子组件 */ children?: React.ReactNode; /** 值变化回调(结构化值,宿主可据此自行接管查询) */ onValuesChange?: (values: FilterValues) => void; /** 查询回调;在 DataList 内部使用时不需要(自动调用 DataList.searchByFilter), * 脱离 DataList 单独使用时通过它接管查询 */ onSearch?: (expression?: string) => void; resetText?: string; } /** 过滤工具栏:作为 DataList 的子组件使用,构造 filter 表达式后调用 DataList.searchByFilter 筛选 */ export declare class FilterBar extends React.Component { static contextType: React.Context | null>; context: DataList | null; private valuesRef; private configsRef; private actions; constructor(props: FilterBarProps); componentDidMount(): void; componentDidUpdate(prevProps: FilterBarProps, prevState: { values: FilterValues; }): void; private runSearch; private registerConfig; private setValue; private handleReset; render(): React.JSX.Element | null; }