Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | import React from "react"; import { ControlledProps } from "../../../form/controlled"; import { Combine, StyledProps } from "../../../_type"; import { SelectOption, SelectMultipleProps } from "../../../select"; import { SelectSearchProps } from "../../../select/SelectProps"; export type FilterType = "single" | "multiple"; /** * `filterable` 插件支持表头过滤,配置详见 `SingleFilterableConfig` 及 `MultipleFilterableConfig`。 */ export type FilterableConfig = | SingleFilterableConfig | MultipleFilterableConfig; /** * `filterable` 插件支持表头过滤,以下是其单选(`type = 'single'`)时配置。 */ export interface SingleFilterableConfig extends BaseConfig<string> { type: "single"; } /** * `filterable` 插件支持表头过滤,以下是其多选(`type = 'multiple'`)时配置。 */ export interface MultipleFilterableConfig extends BaseConfig<string[]> { type: "multiple"; /** * 如果开启了全选支持,则可以指定哪些记录从全选的范围内排除 * * - 默认为 `disabled` 可以排除禁用的记录 * - 提供回调则自定义哪些记录应该排除,对于应该排除的记录,应该返回 `true` */ shouldOptionExcludeFromAll?: SelectMultipleProps["shouldOptionExcludeFromAll"]; } interface BaseConfig<T> extends Combine<SelectSearchProps<FilterOption>, ControlledProps<T>> { /** * 筛选类型,单选还是多选 */ type: FilterType; /** * 支持筛选的列 * */ column: string; /** * 筛选条件列表 */ options: FilterOption[]; /** * 表示全部的特殊条件,如果不希望支持全选,请传入 `false` */ all?: FilterOption | false; } export interface FilterOption extends SelectOption { /** * **\[Deprecated\]** 请使用 `text` 属性 * * @deprecated */ label?: React.ReactNode; } export interface FilterButtonProps<Value> extends Combine< SelectSearchProps<FilterOption>, StyledProps, ControlledProps<Value> > { children?: React.ReactNode; all?: FilterOption | false; options: FilterOption[]; shouldOptionExcludeFromAll?: SelectMultipleProps["shouldOptionExcludeFromAll"]; } |