schummar-table 0.10.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/package.json +19 -17
  2. package/dist/cjs/index.js +0 -2959
  3. package/dist/cjs/index.js.map +0 -1
  4. package/dist/cjs/mui4Theme.js +0 -98
  5. package/dist/cjs/mui4Theme.js.map +0 -1
  6. package/dist/cjs/mui5Theme.js +0 -102
  7. package/dist/cjs/mui5Theme.js.map +0 -1
  8. package/dist/cjs/package.json +0 -1
  9. package/dist/cjs/tableTheme.js +0 -248
  10. package/dist/cjs/tableTheme.js.map +0 -1
  11. package/dist/es/index.js +0 -2937
  12. package/dist/es/index.js.map +0 -1
  13. package/dist/es/mui4Theme.js +0 -94
  14. package/dist/es/mui4Theme.js.map +0 -1
  15. package/dist/es/mui5Theme.js +0 -98
  16. package/dist/es/mui5Theme.js.map +0 -1
  17. package/dist/es/tableTheme.js +0 -238
  18. package/dist/es/tableTheme.js.map +0 -1
  19. package/dist/types/components/autoFocusTextField.d.ts +0 -5
  20. package/dist/types/components/cell.d.ts +0 -6
  21. package/dist/types/components/clearFiltersButton.d.ts +0 -1
  22. package/dist/types/components/columnFooter.d.ts +0 -1
  23. package/dist/types/components/columnHeader.d.ts +0 -6
  24. package/dist/types/components/columnSelection.d.ts +0 -2
  25. package/dist/types/components/dateFilter.d.ts +0 -11
  26. package/dist/types/components/dateInput.d.ts +0 -5
  27. package/dist/types/components/datePicker.d.ts +0 -25
  28. package/dist/types/components/expandControl.d.ts +0 -6
  29. package/dist/types/components/export.d.ts +0 -2
  30. package/dist/types/components/filterControl.d.ts +0 -3
  31. package/dist/types/components/formControlLabel.d.ts +0 -6
  32. package/dist/types/components/resizeHandle.d.ts +0 -5
  33. package/dist/types/components/row.d.ts +0 -7
  34. package/dist/types/components/selectComponent.d.ts +0 -5
  35. package/dist/types/components/selectFilter.d.ts +0 -12
  36. package/dist/types/components/sortComponent.d.ts +0 -4
  37. package/dist/types/components/spinnner.d.ts +0 -3
  38. package/dist/types/components/table.d.ts +0 -8
  39. package/dist/types/components/textFilter.d.ts +0 -8
  40. package/dist/types/components/virtualized.d.ts +0 -7
  41. package/dist/types/hooks/useFilter.d.ts +0 -7
  42. package/dist/types/hooks/useMemoMap.d.ts +0 -2
  43. package/dist/types/hooks/useTableMemo.d.ts +0 -6
  44. package/dist/types/hooks/useTheme.d.ts +0 -2
  45. package/dist/types/index.d.ts +0 -13
  46. package/dist/types/internalState/calcItems.d.ts +0 -3
  47. package/dist/types/internalState/calcProps.d.ts +0 -2
  48. package/dist/types/internalState/cleanupState.d.ts +0 -3
  49. package/dist/types/internalState/filterColumns.d.ts +0 -3
  50. package/dist/types/internalState/normalizeExpanded.d.ts +0 -3
  51. package/dist/types/internalState/syncSelections.d.ts +0 -3
  52. package/dist/types/internalState/tableStateStorage.d.ts +0 -11
  53. package/dist/types/internalState/useTableState.d.ts +0 -3
  54. package/dist/types/misc/csvExport.d.ts +0 -7
  55. package/dist/types/misc/debounce.d.ts +0 -4
  56. package/dist/types/misc/helpers.d.ts +0 -16
  57. package/dist/types/misc/queue.d.ts +0 -6
  58. package/dist/types/misc/textMatch.d.ts +0 -2
  59. package/dist/types/misc/throttle.d.ts +0 -5
  60. package/dist/types/theme/defaultTheme/badge.d.ts +0 -2
  61. package/dist/types/theme/defaultTheme/button.d.ts +0 -2
  62. package/dist/types/theme/defaultTheme/checkbox.d.ts +0 -2
  63. package/dist/types/theme/defaultTheme/defaultClasses.d.ts +0 -19
  64. package/dist/types/theme/defaultTheme/defaultColors.d.ts +0 -2
  65. package/dist/types/theme/defaultTheme/defaultComponents.d.ts +0 -2
  66. package/dist/types/theme/defaultTheme/defaultIcons.d.ts +0 -2
  67. package/dist/types/theme/defaultTheme/defaultTexts.d.ts +0 -2
  68. package/dist/types/theme/defaultTheme/iconButton.d.ts +0 -2
  69. package/dist/types/theme/defaultTheme/index.d.ts +0 -2
  70. package/dist/types/theme/defaultTheme/popover.d.ts +0 -7
  71. package/dist/types/theme/defaultTheme/textField.d.ts +0 -2
  72. package/dist/types/theme/mui4Theme/index.d.ts +0 -7
  73. package/dist/types/theme/mui5Theme/index.d.ts +0 -7
  74. package/dist/types/theme/tableTheme.d.ts +0 -10
  75. package/dist/types/theme/useCssVariables.d.ts +0 -9
  76. package/dist/types/types.d.ts +0 -329
@@ -1,7 +0,0 @@
1
- export declare type CsvExportOptions = {
2
- sepPrefix?: boolean;
3
- separator?: string;
4
- quote?: string;
5
- eol?: string;
6
- };
7
- export declare function csvExport(data: (string | number)[][], { sepPrefix, separator, quote, eol }?: CsvExportOptions): string;
@@ -1,4 +0,0 @@
1
- export declare function debounce<Args extends any[]>(fn: (...args: Args) => void, ms: number): {
2
- (...args: Args): void;
3
- flush(): void;
4
- };
@@ -1,16 +0,0 @@
1
- import { Id, TableItem } from '../types';
2
- export declare const flatMap: <T, S>(arr: Iterable<T>, flatMap: (t: T) => S[]) => S[];
3
- export declare const orderBy: <T>(arr: T[], selectors?: ((t: T) => any)[], direction?: ('desc' | 'asc')[]) => T[];
4
- export declare const uniq: <T>(arr: T[]) => T[];
5
- export declare const intersect: <T>(a: Iterable<T>, b: {
6
- has(t: T): boolean;
7
- }) => Set<T>;
8
- export declare const getAncestors: <T>(activeItemsById: Map<Id, TableItem<T>>, ...items: TableItem<T>[]) => Set<Id>;
9
- export declare const getDescendants: <T>(...items: TableItem<T>[]) => Set<Id>;
10
- export declare const identity: (x: unknown) => any;
11
- export declare const asString: (x: unknown) => string;
12
- export declare const asStringOrArray: (x: unknown) => string | string[];
13
- export declare const defaultEquals: (a: unknown, b: unknown) => boolean;
14
- export declare const subStringMatch: (a: string, b: string) => boolean;
15
- export declare const castArray: <T>(a: T | T[]) => T[];
16
- export declare const cx: (...classNames: (string | false | undefined | null | Record<string, boolean>)[]) => string;
@@ -1,6 +0,0 @@
1
- export declare class Queue {
2
- private q;
3
- private isRunning;
4
- run<T>(job: () => Promise<T>, replace?: boolean): Promise<T>;
5
- private start;
6
- }
@@ -1,2 +0,0 @@
1
- export declare const textMatch: (text: string, query: string) => boolean;
2
- export declare const termMatch: (text: string, query: string) => boolean;
@@ -1,5 +0,0 @@
1
- export declare function throttle<Args extends any[]>(fn: (...args: Args) => void, ms: number): {
2
- (...args: Args): void;
3
- flush(): void;
4
- cancel(): void;
5
- };
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const Badge: TableTheme['components']['Badge'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const Button: TableTheme['components']['Button'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const Checkbox: TableTheme['components']['Checkbox'];
@@ -1,19 +0,0 @@
1
- export declare const white = "#ffffff";
2
- export declare const lightGray = "#eeeeee";
3
- export declare const gray = "#bdbdbd";
4
- export declare const darkGray = "#777";
5
- export declare const defaultClasses: {
6
- table: import("@emotion/utils").SerializedStyles;
7
- cell: import("@emotion/utils").SerializedStyles;
8
- cellFill: import("@emotion/utils").SerializedStyles;
9
- headerCell: import("@emotion/utils").SerializedStyles;
10
- footerCell: import("@emotion/utils").SerializedStyles;
11
- firstCell: import("@emotion/utils").SerializedStyles;
12
- sticky: import("@emotion/utils").SerializedStyles;
13
- stickyBottom: import("@emotion/utils").SerializedStyles;
14
- headerFill: import("@emotion/utils").SerializedStyles;
15
- footerFill: import("@emotion/utils").SerializedStyles;
16
- text: import("@emotion/utils").SerializedStyles;
17
- card: import("@emotion/utils").SerializedStyles;
18
- clearFiltersButton: import("@emotion/utils").SerializedStyles;
19
- };
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const defaultColors: TableTheme['colors'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const defaultComponents: TableTheme['components'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const defaultIcons: TableTheme['icons'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const defaultTexts: TableTheme['text'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const IconButton: TableTheme['components']['IconButton'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const defaultTableTheme: TableTheme;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { TableTheme } from '../../types';
3
- export declare const PopoverContext: React.Context<{
4
- depth: number;
5
- visible: boolean;
6
- }>;
7
- export declare const Popover: TableTheme['components']['Popover'];
@@ -1,2 +0,0 @@
1
- import { TableTheme } from '../../types';
2
- export declare const TextField: TableTheme['components']['TextField'];
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { PartialTableTheme } from '../../types';
3
- export declare const mui4Theme: PartialTableTheme;
4
- export declare function Mui4TableThemeProvider({ theme, children }: {
5
- theme?: PartialTableTheme;
6
- children: ReactNode;
7
- }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { PartialTableTheme } from '../../types';
3
- export declare const mui5Theme: PartialTableTheme;
4
- export declare function Mui5TableThemeProvider({ theme, children }: {
5
- theme?: PartialTableTheme;
6
- children: ReactNode;
7
- }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { PartialTableTheme } from '../types';
3
- export declare let globalTableTheme: PartialTableTheme;
4
- export declare function configureTableTheme(tableTheme: PartialTableTheme): void;
5
- export declare const TableThemeContext: import("react").Context<PartialTableTheme<unknown>>;
6
- export declare function TableThemeProvider({ theme, children }: {
7
- theme: PartialTableTheme;
8
- children: ReactNode;
9
- }): import("@emotion/react/jsx-runtime").JSX.Element;
10
- export declare function mergeThemes<T>(...themes: PartialTableTheme<T>[]): PartialTableTheme<T>;
@@ -1,9 +0,0 @@
1
- export declare function useCssVariables(): {
2
- '--spacing': string | number;
3
- '--primaryMain': string;
4
- '--primaryLight': string;
5
- '--primaryContrastText': string;
6
- '--secondaryMain': string;
7
- '--secondaryLight': string;
8
- '--secondaryContrastText': string;
9
- };
@@ -1,329 +0,0 @@
1
- import { CSSInterpolation } from '@emotion/serialize';
2
- import React, { ComponentType, DependencyList, ReactNode, Ref } from 'react';
3
- import { TableStateStorage } from './internalState/tableStateStorage';
4
- import { CsvExportOptions } from './misc/csvExport';
5
- export declare type Sort = {
6
- columnId: string | number;
7
- direction: SortDirection;
8
- };
9
- export declare type SortDirection = 'asc' | 'desc';
10
- export declare type Id = string | number;
11
- export declare type KeyOfType<T, S> = {
12
- [K in keyof T]: T[K] extends S ? K : never;
13
- }[keyof T];
14
- export declare type FunctionWithDeps<F extends (...args: any[]) => any> = F | [function: F, ...deps: DependencyList];
15
- export declare type MemoizedFunctions<T> = {
16
- [K in keyof T]: Exclude<T[K], [function: (...args: any[]) => any, ...deps: DependencyList[]]>;
17
- };
18
- export interface TableTheme<T = unknown> {
19
- /** Define display texts. */
20
- text: {
21
- selectColumns: ReactNode;
22
- noResults: ReactNode;
23
- exportTitle: ReactNode;
24
- exportCopy: ReactNode;
25
- exportDownload: ReactNode;
26
- today: ReactNode;
27
- thisWeek: ReactNode;
28
- reset: ReactNode;
29
- loading: ReactNode;
30
- clearFilters: ReactNode;
31
- deselectAll: ReactNode;
32
- };
33
- /** Define styles. */
34
- classes?: {
35
- table?: string;
36
- headerCell?: string;
37
- footerCell?: string;
38
- cell?: string | FunctionWithDeps<(item: T, index: number) => string | undefined>;
39
- evenCell?: string;
40
- oddCell?: string;
41
- };
42
- /** Define components to be used in the table. */
43
- components: {
44
- IconButton: ComponentType<{
45
- children: ReactNode;
46
- onClick?: (e: React.MouseEvent<Element>) => void;
47
- className?: string;
48
- }>;
49
- Button: ComponentType<{
50
- children: ReactNode;
51
- onClick?: (e: React.MouseEvent<Element>) => void;
52
- startIcon?: ReactNode;
53
- variant?: 'text' | 'outlined' | 'contained';
54
- disabled?: boolean;
55
- className?: string;
56
- }>;
57
- Checkbox: ComponentType<{
58
- checked: boolean;
59
- onChange: (e: React.ChangeEvent) => void;
60
- disabled?: boolean;
61
- className?: string;
62
- }>;
63
- Popover: ComponentType<{
64
- anchorEl: Element | null;
65
- open: boolean;
66
- hidden?: boolean;
67
- onClose: () => void;
68
- children: ReactNode;
69
- className?: string;
70
- align?: 'center' | 'left';
71
- }>;
72
- Badge: ComponentType<{
73
- children: ReactNode;
74
- badgeContent: ReactNode;
75
- }>;
76
- TextField: ComponentType<{
77
- value: string | null;
78
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
79
- endIcon?: ReactNode;
80
- className?: string;
81
- inputRef?: Ref<HTMLInputElement>;
82
- }>;
83
- Spinner: (props: {
84
- className?: string;
85
- }) => JSX.Element;
86
- };
87
- /** Define icons for the table. */
88
- icons: {
89
- [K in 'Settings' | 'Export' | 'Clipboard' | 'ChevronRight' | 'Search' | 'Clear' | 'ArrowDropDown' | 'FilterList' | 'ArrowUpward']: ComponentType<{
90
- className?: string;
91
- }>;
92
- };
93
- /** Define colors */
94
- colors: {
95
- primary: {
96
- main: string;
97
- light: string;
98
- contrastText: string;
99
- };
100
- secondary: {
101
- main: string;
102
- light: string;
103
- contrastText: string;
104
- };
105
- };
106
- /** Spacing. */
107
- spacing: string | number;
108
- }
109
- export declare type PartialTableTheme<T = unknown> = {
110
- [K in keyof TableTheme<T>]?: TableTheme<T>[K] extends Record<string, any> ? Partial<TableTheme<T>[K]> : TableTheme<T>[K];
111
- };
112
- export declare type MemoizedTableTheme<T> = Omit<TableTheme, 'classes' | 'text'> & {
113
- classes: MemoizedFunctions<TableTheme<T>['classes']>;
114
- text: MemoizedFunctions<TableTheme<T>['text']>;
115
- };
116
- export interface TableProps<T> extends PartialTableTheme<T> {
117
- /** The data to be rendered. One item per row. */
118
- items?: T[];
119
- /** Unique id for each item/row. */
120
- id: FunctionWithDeps<(item: T) => Id> | KeyOfType<T, Id>;
121
- /** Create a nested structure by assigning parents to items. Child items are hidden until the parent is expanded. */
122
- parentId?: FunctionWithDeps<(item: T) => Id | undefined> | KeyOfType<T, Id | undefined>;
123
- /** If true for an item, it means that children will be loaded asynchronously as soon as item is expanded. */
124
- hasDeferredChildren?: (item: T) => boolean;
125
- /** Column definitions. */
126
- columns: Column<T, any>[] | ((col: <V>(value: (item: T) => V, column: Omit<Column<T, V>, 'value'>) => Column<T, V>) => Column<T, any>[]);
127
- /** Default props for all column. Will take effect if not overriden in column definition. */
128
- defaultColumnProps?: Omit<Column<T, unknown>, 'id' | 'value'>;
129
- /** Wrap each cell */
130
- wrapCell?: FunctionWithDeps<(content: ReactNode, value: unknown, item: T, index: number) => ReactNode>;
131
- /** Display a cell at the start of each row. Useful for "go to details" button for example. */
132
- rowAction?: ReactNode | FunctionWithDeps<(item: T, index: number) => ReactNode>;
133
- /** Default sort order. */
134
- defaultSort?: Sort[];
135
- /** If given, controls the sort order. */
136
- sort?: Sort[];
137
- /** Called when sort order changes. */
138
- onSortChange?: (sort: Sort[]) => void;
139
- /** Default selection. */
140
- defaultSelection?: Set<Id>;
141
- /** If given, controls the selection. */
142
- selection?: Set<Id>;
143
- /** Called when selection changes. */
144
- onSelectionChange?: (selection: Set<Id>) => void;
145
- /** Whether to show checkboxes at the start of each row.
146
- * @default true
147
- */
148
- enableSelection?: boolean;
149
- /** Select and deselect children if a parent is selected or deselected.
150
- * @default true
151
- */
152
- selectSyncChildren?: boolean;
153
- /** Expand parents whose children fit a newly selected filter
154
- * @default false
155
- */
156
- revealFiltered?: boolean;
157
- /** Default expanded rows. */
158
- defaultExpanded?: Set<Id>;
159
- /** If given, controls expanded rows. */
160
- expanded?: Set<Id>;
161
- /** Called when expanded rows change. */
162
- onExpandedChange?: (expanded: Set<Id>) => void;
163
- /** If enabled and one row is expanded, other rows will be closed.
164
- * @default false
165
- */
166
- expandOnlyOne?: boolean;
167
- /** Default hidden columns. */
168
- defaultHiddenColumns?: Set<Id>;
169
- /** If given, controls hidden columns. */
170
- hiddenColumns?: Set<Id>;
171
- /** Called when hidden columns change. */
172
- onHiddenColumnsChange?: (hiddenColumns: Set<Id>) => void;
173
- /** Whether to stretch the table component over the available space. If value is "left" or "right", align accordingly. */
174
- fullWidth?: boolean | 'left' | 'right';
175
- /** Whether the table header should be sticky.
176
- * @default true
177
- */
178
- stickyHeader?: boolean | {
179
- top: number;
180
- };
181
- /** Whether the table footer should be sticky.
182
- * @default true
183
- */
184
- stickyFooter?: boolean | {
185
- bottom: number;
186
- };
187
- /** Whether the table cells should only be rendered when in viewport.
188
- * @default true
189
- */
190
- virtual?: boolean | {
191
- rowHeight?: number;
192
- initalRowHeight?: number;
193
- throttleScroll?: number;
194
- overscan?: number;
195
- overscanBottom?: number;
196
- overscanTop?: number;
197
- };
198
- /** Enable menu to select which columns are visible.
199
- * @default true
200
- */
201
- enableColumnSelection?: boolean;
202
- /** Enable exporting to csv.
203
- * @default false
204
- */
205
- enableExport?: boolean | {
206
- copy?: boolean | CsvExportOptions;
207
- download?: boolean | CsvExportOptions;
208
- };
209
- /** Shows a button to clear all filters while any are active
210
- * @default false
211
- */
212
- enableClearFiltersButton?: boolean;
213
- /** Allow to drag and drop column separators to resize the column left of it.
214
- * @default true
215
- */
216
- enableColumnResize?: boolean;
217
- /** Allow to drag and drop column header to reorder columns.
218
- * @default true
219
- */
220
- enableColumnReorder?: boolean;
221
- /** If enabled, automatically store table state in localStorage, localForage or another compatible storage. */
222
- persist?: {
223
- storage: TableStateStorage;
224
- id: string;
225
- include?: ('sort' | 'selection' | 'expanded' | 'hiddenColumns' | 'filterValues' | 'columnWidths' | 'columnOrder')[];
226
- exclude?: ('sort' | 'selection' | 'expanded' | 'hiddenColumns' | 'filterValues' | 'columnWidths' | 'columnOrder')[];
227
- };
228
- debug?: (...output: any) => void;
229
- debugRender?: (...output: any) => void;
230
- }
231
- export declare type InternalTableProps<T> = MemoizedFunctions<Omit<TableProps<T>, 'id' | 'parentId' | 'columns' | 'defaultColumnProps' | 'enableExport'> & {
232
- id: (item: T) => Id;
233
- parentId?: (item: T) => Id | undefined;
234
- columns: InternalColumn<T, unknown>[];
235
- enableExport: {
236
- copy?: CsvExportOptions;
237
- download?: CsvExportOptions;
238
- };
239
- }>;
240
- export declare type TableItem<T = unknown> = {
241
- id: Id;
242
- parentId?: Id;
243
- children: TableItem<T>[];
244
- value: T;
245
- };
246
- export declare type Column<T, V> = {
247
- /** Column id. If not provided, the index in the column array will be used.
248
- * An explicit id is better however for controlling column related states, persitance etc.
249
- */
250
- id?: string;
251
- /** Render table header for this column. */
252
- header?: ReactNode | FunctionWithDeps<(values: V[], items: T[]) => ReactNode>;
253
- /** Render table header for this column. */
254
- footer?: ReactNode | FunctionWithDeps<(values: V[], items: T[]) => ReactNode>;
255
- /** Extract value for this column */
256
- value: FunctionWithDeps<(item: T) => V>;
257
- /** Render table cell. If not provided, a string representation of the value will be rendered. */
258
- renderCell?: FunctionWithDeps<(value: V, item: T) => ReactNode>;
259
- /** Serialize column value for exports. If not provided, a string representation of the value will be used. */
260
- exportCell?: (value: V, item: T) => string | number;
261
- /** Customize sort criteria. By default it will be the value itself in case it's a number or Date, or a string representation of the value otherwise. */
262
- sortBy?: FunctionWithDeps<(value: V, item: T) => unknown>[];
263
- /** Set filter component that will be displayed in the column header */
264
- filter?: ReactNode;
265
- /** Prevent hiding the column. */
266
- cannotHide?: boolean;
267
- /** Specify a css width.
268
- * @default 'max-content'
269
- */
270
- width?: string;
271
- /** Provide css class names to override columns styles. */
272
- classes?: TableTheme<T>['classes'];
273
- };
274
- export declare type InternalColumn<T, V> = MemoizedFunctions<Required<Omit<Column<T, V>, 'id' | 'sortBy'>, 'header' | 'renderCell' | 'exportCell' | 'sortBy'> & {
275
- id: Id;
276
- sortBy: ((value: V, item: T) => unknown)[];
277
- }>;
278
- declare type Required<T, S> = T & {
279
- [P in keyof T as P extends S ? P : never]-?: T[P];
280
- };
281
- export declare type InternalTableState<T> = {
282
- props: InternalTableProps<T>;
283
- sort: Sort[];
284
- selection: Set<Id>;
285
- expanded: Set<Id>;
286
- rowHeights: Map<Id, number>;
287
- filters: Map<Id, MemoizedFunctions<FilterImplementation<T, any, any, any>>>;
288
- filterValues: Map<Id, any>;
289
- hiddenColumns: Set<Id>;
290
- columnWidths: Map<Id, string>;
291
- columnOrder: Id[];
292
- columnStyleOverride: Map<Id, CSSInterpolation>;
293
- activeColumns: InternalColumn<T, unknown>[];
294
- items: TableItem<T>[];
295
- itemsById: Map<Id, TableItem<T>>;
296
- activeItems: TableItem<T>[];
297
- activeItemsById: Map<Id, TableItem<T>>;
298
- lastSelectedId?: Id;
299
- };
300
- export declare type CommonFilterProps<T, V, F, S extends SerializableValue> = {
301
- /** Filter by? By default the column value will be used. If filterBy returns an array, an items will be active if at least one entry matches the active filter. */
302
- filterBy?: FunctionWithDeps<(value: V, item: T) => F | F[]>;
303
- /** Preselected filter value. */
304
- defaultValue?: S;
305
- /** Controlled filter value. */
306
- value?: S;
307
- /** Notifies on filter change. */
308
- onChange?: (value?: S) => void;
309
- /** Whether to persist filter value (given that filter persitance is enabled for the table).
310
- * @default true
311
- */
312
- persist?: boolean;
313
- };
314
- export declare type FilterImplementation<T, V, F, S extends SerializableValue> = CommonFilterProps<T, V, F, S> & {
315
- /** Unique filter id. Used to persist filter values. */
316
- id: string;
317
- /** Whether the filter is active currently. */
318
- isActive: (filterValue: S) => boolean;
319
- /** When the filter is active, this function is used to filter the items to be displayed. */
320
- test: (filterValue: S, value: F) => boolean;
321
- };
322
- export declare type SerializableValue = string | number | boolean | null | Date | SerializableArray | SerializableObject | SerializableSet | SerializableMap;
323
- export declare type SerializableObject = {
324
- [key: string]: SerializableValue;
325
- };
326
- export declare type SerializableArray = SerializableValue[];
327
- export declare type SerializableSet = Set<SerializableValue>;
328
- export declare type SerializableMap = Map<SerializableValue, SerializableValue>;
329
- export {};