@tanstack/react-table 8.0.0-alpha.6 → 8.0.0-alpha.9
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.
- package/build/cjs/core.js +66 -73
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/createTable.js +47 -33
- package/build/cjs/createTable.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +23 -22
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Expanding.js +10 -22
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +27 -58
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +10 -27
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +108 -28
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Ordering.js +2 -2
- package/build/cjs/features/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js +24 -29
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js +23 -38
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js +10 -22
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +10 -2
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterTypes.js.map +1 -1
- package/build/cjs/index.js +12 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/sortTypes.js.map +1 -1
- package/build/cjs/types.js +22 -0
- package/build/cjs/types.js.map +1 -0
- package/build/cjs/utils/columnFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/expandRowsFn.js.map +1 -1
- package/build/cjs/utils/globalFilterRowsFn.js.map +1 -1
- package/build/cjs/utils/groupRowsFn.js.map +1 -1
- package/build/cjs/utils/paginateRowsFn.js.map +1 -1
- package/build/cjs/utils/sortRowsFn.js.map +1 -1
- package/build/cjs/utils.js +44 -18
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +1388 -1355
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +337 -307
- package/build/types/core.d.ts +63 -67
- package/build/types/createTable.d.ts +34 -44
- package/build/types/features/ColumnSizing.d.ts +13 -7
- package/build/types/features/Expanding.d.ts +11 -16
- package/build/types/features/Filters.d.ts +39 -47
- package/build/types/features/Grouping.d.ts +28 -27
- package/build/types/features/Headers.d.ts +30 -30
- package/build/types/features/Ordering.d.ts +5 -5
- package/build/types/features/Pagination.d.ts +11 -16
- package/build/types/features/Pinning.d.ts +5 -5
- package/build/types/features/RowSelection.d.ts +15 -23
- package/build/types/features/Sorting.d.ts +26 -25
- package/build/types/features/Visibility.d.ts +9 -9
- package/build/types/filterTypes.d.ts +10 -10
- package/build/types/index.d.ts +1 -0
- package/build/types/sortTypes.d.ts +7 -7
- package/build/types/types.d.ts +34 -23
- package/build/types/utils/columnFilterRowsFn.d.ts +2 -2
- package/build/types/utils/expandRowsFn.d.ts +2 -2
- package/build/types/utils/globalFilterRowsFn.d.ts +2 -2
- package/build/types/utils/groupRowsFn.d.ts +2 -2
- package/build/types/utils/paginateRowsFn.d.ts +2 -2
- package/build/types/utils/sortRowsFn.d.ts +2 -2
- package/build/types/utils.d.ts +5 -6
- package/build/umd/index.development.js +1397 -1354
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/core.tsx +192 -520
- package/src/createTable.tsx +137 -192
- package/src/features/ColumnSizing.ts +48 -77
- package/src/features/Expanding.ts +25 -113
- package/src/features/Filters.ts +91 -293
- package/src/features/Grouping.ts +60 -165
- package/src/features/Headers.ts +148 -331
- package/src/features/Ordering.ts +19 -42
- package/src/features/Pagination.ts +35 -110
- package/src/features/Pinning.ts +16 -40
- package/src/features/RowSelection.ts +47 -227
- package/src/features/Sorting.ts +49 -143
- package/src/features/Visibility.ts +23 -64
- package/src/filterTypes.ts +19 -82
- package/src/index.tsx +1 -0
- package/src/sortTypes.ts +19 -31
- package/src/types.ts +80 -100
- package/src/utils/columnFilterRowsFn.ts +11 -53
- package/src/utils/expandRowsFn.ts +7 -27
- package/src/utils/globalFilterRowsFn.ts +10 -43
- package/src/utils/groupRowsFn.ts +13 -37
- package/src/utils/paginateRowsFn.ts +5 -11
- package/src/utils/sortRowsFn.ts +8 -28
- package/src/utils.tsx +61 -35
package/build/types/types.d.ts
CHANGED
|
@@ -7,51 +7,63 @@ import { HeadersInstance, HeadersRow } from './features/Headers';
|
|
|
7
7
|
import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, FiltersTableState } from './features/Filters';
|
|
8
8
|
import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
|
|
9
9
|
import { GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
|
|
10
|
-
import { ExpandedInstance, ExpandedOptions, ExpandedTableState } from './features/Expanding';
|
|
10
|
+
import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/Expanding';
|
|
11
11
|
import { Overwrite } from './utils';
|
|
12
|
-
import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
|
|
12
|
+
import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
|
|
13
13
|
import { PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
|
|
14
14
|
import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
|
|
15
|
-
export declare type
|
|
15
|
+
export declare type DefaultGenerics = {
|
|
16
|
+
Row: unknown;
|
|
17
|
+
Value: unknown;
|
|
18
|
+
FilterFns: object;
|
|
19
|
+
SortingFns: object;
|
|
20
|
+
AggregationFns: object;
|
|
21
|
+
};
|
|
22
|
+
export declare type PartialGenerics = Partial<DefaultGenerics>;
|
|
23
|
+
export declare type TableInstance<TGenerics extends PartialGenerics> = TableCore<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
|
|
16
24
|
export declare type Renderable<TProps> = React.ReactNode | React.FunctionComponent<TProps> | React.Component<TProps>;
|
|
17
|
-
export declare type Options<
|
|
25
|
+
export declare type Options<TGenerics extends PartialGenerics> = CoreOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
|
|
18
26
|
export declare type Updater<T> = T | ((old: T) => T);
|
|
19
27
|
export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void;
|
|
20
28
|
export declare type TableState = VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
|
|
21
|
-
export declare type Row<
|
|
29
|
+
export declare type Row<TGenerics extends PartialGenerics> = CoreRow<TGenerics> & VisibilityRow<TGenerics> & HeadersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
|
|
22
30
|
export declare type RowValues = {
|
|
23
31
|
[key: string]: any;
|
|
24
32
|
};
|
|
25
|
-
export declare type RowModel<
|
|
26
|
-
rows: Row<
|
|
27
|
-
flatRows: Row<
|
|
28
|
-
rowsById: Record<string, Row<
|
|
33
|
+
export declare type RowModel<TGenerics extends PartialGenerics> = {
|
|
34
|
+
rows: Row<TGenerics>[];
|
|
35
|
+
flatRows: Row<TGenerics>[];
|
|
36
|
+
rowsById: Record<string, Row<TGenerics>>;
|
|
29
37
|
};
|
|
30
38
|
export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
|
|
31
|
-
export declare
|
|
32
|
-
export declare type
|
|
33
|
-
|
|
39
|
+
export declare const Please_use_the_create_table_column_utilities_to_define_columns: unique symbol;
|
|
40
|
+
export declare type _NonGenerated<T> = Overwrite<T, {
|
|
41
|
+
[Please_use_the_create_table_column_utilities_to_define_columns]?: never;
|
|
42
|
+
}>;
|
|
43
|
+
export declare type ColumnDef<TGenerics extends PartialGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
|
|
44
|
+
export declare type Column<TGenerics extends PartialGenerics> = ColumnDef<TGenerics> & CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
|
|
45
|
+
export declare type Cell<TGenerics extends PartialGenerics> = {
|
|
34
46
|
id: string;
|
|
35
47
|
rowId: string;
|
|
36
48
|
columnId: string;
|
|
37
|
-
value:
|
|
38
|
-
row: Row<
|
|
39
|
-
column: Column<
|
|
49
|
+
value: TGenerics['Value'];
|
|
50
|
+
row: Row<TGenerics>;
|
|
51
|
+
column: Column<TGenerics>;
|
|
40
52
|
getCellProps: PropGetter<CellProps>;
|
|
41
53
|
renderCell: () => React.ReactNode;
|
|
42
54
|
};
|
|
43
|
-
export declare type Header<
|
|
44
|
-
export declare type CoreHeader<
|
|
55
|
+
export declare type Header<TGenerics extends PartialGenerics> = CoreHeader<TGenerics> & ColumnSizingHeader<TGenerics>;
|
|
56
|
+
export declare type CoreHeader<TGenerics extends PartialGenerics> = {
|
|
45
57
|
id: string;
|
|
46
58
|
depth: number;
|
|
47
|
-
column: Column<
|
|
59
|
+
column: Column<TGenerics>;
|
|
48
60
|
getWidth: () => number;
|
|
49
|
-
subHeaders: Header<
|
|
61
|
+
subHeaders: Header<TGenerics>[];
|
|
50
62
|
colSpan?: number;
|
|
51
63
|
rowSpan?: number;
|
|
52
64
|
getHeaderProps: PropGetter<HeaderProps>;
|
|
53
65
|
getFooterProps: PropGetter<HeaderProps>;
|
|
54
|
-
getLeafHeaders: () => Header<
|
|
66
|
+
getLeafHeaders: () => Header<TGenerics>[];
|
|
55
67
|
isPlaceholder?: boolean;
|
|
56
68
|
placeholderId?: string;
|
|
57
69
|
renderHeader: (options?: {
|
|
@@ -61,10 +73,10 @@ export declare type CoreHeader<TData, TValue, TFilterFns, TSortingFns, TAggregat
|
|
|
61
73
|
renderPlaceholder?: boolean;
|
|
62
74
|
}) => React.ReactNode;
|
|
63
75
|
};
|
|
64
|
-
export declare type HeaderGroup<
|
|
76
|
+
export declare type HeaderGroup<TGenerics extends PartialGenerics> = {
|
|
65
77
|
id: string;
|
|
66
78
|
depth: number;
|
|
67
|
-
headers: Header<
|
|
79
|
+
headers: Header<TGenerics>[];
|
|
68
80
|
getHeaderGroupProps: PropGetter<HeaderGroupProps>;
|
|
69
81
|
getFooterGroupProps: PropGetter<FooterGroupProps>;
|
|
70
82
|
};
|
|
@@ -120,7 +132,6 @@ export declare type CellProps = {
|
|
|
120
132
|
key: string;
|
|
121
133
|
role: string;
|
|
122
134
|
};
|
|
123
|
-
export declare type Listener<TArgs extends [...any]> = (...args: [...TArgs]) => void;
|
|
124
135
|
export declare type PropGetter<TBase> = <TGetter extends Getter<TBase>>(userProps?: TGetter) => PropGetterValue<TBase, TGetter>;
|
|
125
136
|
export declare type Getter<TInitial> = ((initial: TInitial) => object) | object | undefined;
|
|
126
137
|
export declare type PropGetterValue<TBase, TGetter> = TGetter extends undefined ? TBase : TGetter extends (...args: any[]) => infer TReturn ? Overwrite<TBase, TReturn> : TGetter extends object ? Overwrite<TBase, TGetter> : never;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function columnFilterRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function columnFilterRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, rowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function expandRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function expandRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, sortedRowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function globalFilterRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function globalFilterRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, rowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function groupRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function groupRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, sortedRowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function paginateRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function paginateRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, rowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function sortRowsFn<
|
|
1
|
+
import { PartialGenerics, TableInstance, RowModel } from '../types';
|
|
2
|
+
export declare function sortRowsFn<TGenerics extends PartialGenerics>(instance: TableInstance<TGenerics>, rowModel: RowModel<TGenerics>): RowModel<TGenerics>;
|
package/build/types/utils.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Getter, NoInfer, PropGetterValue, Renderable, TableState } from './types';
|
|
2
|
+
import { Getter, NoInfer, PropGetterValue, Renderable, TableState, Updater } from './types';
|
|
3
3
|
export declare type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
4
4
|
export declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5
5
|
export declare type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
6
6
|
export declare type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
7
|
-
export declare type DataUpdateFunction<
|
|
8
|
-
export declare
|
|
9
|
-
export declare function functionalUpdate<TInput, TOutput = TInput>(updater: Updater<TInput, TOutput>, input: TInput): TOutput;
|
|
7
|
+
export declare type DataUpdateFunction<T> = (input: T) => T;
|
|
8
|
+
export declare function functionalUpdate<T>(updater: Updater<T>, input: T): T;
|
|
10
9
|
export declare function noop(): void;
|
|
11
|
-
export declare function makeStateUpdater(key: keyof TableState, instance: unknown): (updater: Updater<any
|
|
10
|
+
export declare function makeStateUpdater(key: keyof TableState, instance: unknown): (updater: Updater<any>) => void;
|
|
12
11
|
declare type AnyFunction = (...args: any) => any;
|
|
13
12
|
export declare function isFunction<T extends AnyFunction>(d: any): d is T;
|
|
14
13
|
export declare function flattenBy<TNode>(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[];
|
|
@@ -16,7 +15,7 @@ declare type PropGetterImpl = <TBaseProps, TGetter extends Getter<TBaseProps>>(i
|
|
|
16
15
|
export declare const propGetter: PropGetterImpl;
|
|
17
16
|
export declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
|
|
18
17
|
key: string;
|
|
19
|
-
debug?:
|
|
18
|
+
debug?: () => any;
|
|
20
19
|
onChange?: (result: TResult, previousResult?: TResult) => void;
|
|
21
20
|
}): () => TResult;
|
|
22
21
|
export declare type Render = typeof flexRender;
|