Compute power search config from columns
Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7 Reviewed By: antonk52 Differential Revision: D49349521 fbshipit-source-id: 49f8059bdbfbcc316b79eb633ec54d957f16548d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8cea5be59d
commit
54a93c03aa
@@ -7,7 +7,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {DataTableColumn} from './DataTable';
|
||||
import type {DataTableColumn} from './DataTableWithPowerSearch';
|
||||
import {Percentage} from '../../utils/widthUtils';
|
||||
import {MutableRefObject, Reducer, RefObject} from 'react';
|
||||
import {DataSourceVirtualizer} from '../../data-source/index';
|
||||
@@ -43,10 +43,7 @@ type PersistedState = {
|
||||
/** The currently applicable sorting, if any */
|
||||
sorting: Sorting | undefined;
|
||||
/** The default columns, but normalized */
|
||||
columns: Pick<
|
||||
DataTableColumn,
|
||||
'key' | 'width' | 'filters' | 'visible' | 'inversed'
|
||||
>[];
|
||||
columns: Pick<DataTableColumn, 'key' | 'width' | 'visible' | 'inversed'>[];
|
||||
scrollOffset: number;
|
||||
autoScroll: boolean;
|
||||
};
|
||||
@@ -143,9 +140,6 @@ export const dataTableManagerReducer = produce<
|
||||
break;
|
||||
}
|
||||
case 'resetFilters': {
|
||||
draft.columns.forEach((c) =>
|
||||
c.filters?.forEach((f) => (f.enabled = false)),
|
||||
);
|
||||
draft.searchExpression = undefined;
|
||||
draft.filterExceptions = undefined;
|
||||
break;
|
||||
@@ -446,11 +440,6 @@ function computeInitialColumns(
|
||||
(columnsWithoutWidth > 1
|
||||
? `${Math.floor(100 / visibleColumnCount)}%`
|
||||
: undefined),
|
||||
filters:
|
||||
c.filters?.map((f) => ({
|
||||
...f,
|
||||
predefined: true,
|
||||
})) ?? [],
|
||||
visible: c.visible !== false,
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user