Allow disabling power search for certain columns

Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7

Reviewed By: antonk52

Differential Revision: D49373658

fbshipit-source-id: 872bd6ecdce9c3ed7934f86f1954efdff76185b9
This commit is contained in:
Andrey Goncharov
2023-09-19 08:19:25 -07:00
committed by Facebook GitHub Bot
parent c75c377818
commit 3b75b6994b

View File

@@ -124,11 +124,13 @@ export type DataTableColumn<T = any> = {
visible?: boolean;
inversed?: boolean;
sortable?: boolean;
powerSearchConfig?: {
[K in keyof typeof dataTablePowerSearchOperators]: ReturnType<
(typeof dataTablePowerSearchOperators)[K]
>;
};
powerSearchConfig?:
| {
[K in keyof typeof dataTablePowerSearchOperators]: ReturnType<
(typeof dataTablePowerSearchOperators)[K]
>;
}
| false;
};
export interface TableRowRenderContext<T = any> {
@@ -240,6 +242,9 @@ export function DataTable<T extends object>(
const res: PowerSearchConfig = {fields: {}};
for (const column of columns) {
if (column.powerSearchConfig === false) {
continue;
}
const columnFieldConfig: FieldConfig = {
label: column.title ?? column.key,
key: column.key,