@tanstack/table-core 8.0.11 → 8.0.12

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 (35) hide show
  1. package/build/stats-html.html +1 -1
  2. package/build/stats-react.json +1117 -0
  3. package/build/types/aggregationFns.d.ts +13 -0
  4. package/build/types/core/cell.d.ts +9 -0
  5. package/build/types/core/column.d.ts +40 -0
  6. package/build/types/core/headers.d.ts +46 -0
  7. package/build/types/core/instance.d.ts +58 -0
  8. package/build/types/core/row.d.ts +15 -0
  9. package/build/types/createTable.d.ts +63 -0
  10. package/build/types/features/ColumnSizing.d.ts +63 -0
  11. package/build/types/features/Expanding.d.ts +39 -0
  12. package/build/types/features/Filters.d.ts +90 -0
  13. package/build/types/features/Grouping.d.ts +68 -0
  14. package/build/types/features/Ordering.d.ts +18 -0
  15. package/build/types/features/Pagination.d.ts +42 -0
  16. package/build/types/features/Pinning.d.ts +40 -0
  17. package/build/types/features/RowSelection.d.ts +40 -0
  18. package/build/types/features/Sorting.d.ts +63 -0
  19. package/build/types/features/Visibility.d.ts +40 -0
  20. package/build/types/filterFns.d.ts +13 -0
  21. package/build/types/index.d.ts +29 -0
  22. package/build/types/sortingFns.d.ts +11 -0
  23. package/build/types/types.d.ts +53 -0
  24. package/build/types/utils/filterRowsUtils.d.ts +4 -0
  25. package/build/types/utils/getCoreRowModel.d.ts +2 -0
  26. package/build/types/utils/getExpandedRowModel.d.ts +7 -0
  27. package/build/types/utils/getFacetedMinMaxValues.d.ts +2 -0
  28. package/build/types/utils/getFacetedRowModel.d.ts +2 -0
  29. package/build/types/utils/getFacetedUniqueValues.d.ts +2 -0
  30. package/build/types/utils/getFilteredRowModel.d.ts +2 -0
  31. package/build/types/utils/getGroupedRowModel.d.ts +2 -0
  32. package/build/types/utils/getPaginationRowModel.d.ts +4 -0
  33. package/build/types/utils/getSortedRowModel.d.ts +2 -0
  34. package/build/types/utils.d.ts +19 -0
  35. package/package.json +2 -2
@@ -0,0 +1,63 @@
1
+ import { RowModel } from '..';
2
+ import { TableFeature } from '../core/instance';
3
+ import { BuiltInSortingFn } from '../sortingFns';
4
+ import { OnChangeFn, TableGenerics, TableInstance, Row, Updater } from '../types';
5
+ import { Overwrite } from '../utils';
6
+ export declare type SortDirection = 'asc' | 'desc';
7
+ export declare type ColumnSort = {
8
+ id: string;
9
+ desc: boolean;
10
+ };
11
+ export declare type SortingState = ColumnSort[];
12
+ export declare type SortingTableState = {
13
+ sorting: SortingState;
14
+ };
15
+ export declare type SortingFn<TGenerics extends TableGenerics> = {
16
+ (rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
17
+ };
18
+ export declare type CustomSortingFns<TGenerics extends TableGenerics> = Record<string, SortingFn<TGenerics>>;
19
+ export declare type SortingFnOption<TGenerics extends TableGenerics> = 'auto' | BuiltInSortingFn | keyof TGenerics['SortingFns'] | SortingFn<TGenerics>;
20
+ export declare type SortingColumnDef<TGenerics extends TableGenerics> = {
21
+ sortingFn?: SortingFnOption<Overwrite<TGenerics, {
22
+ Value: any;
23
+ }>>;
24
+ sortDescFirst?: boolean;
25
+ enableSorting?: boolean;
26
+ enableMultiSort?: boolean;
27
+ invertSorting?: boolean;
28
+ sortUndefined?: false | -1 | 1;
29
+ };
30
+ export declare type SortingColumn<TGenerics extends TableGenerics> = {
31
+ getAutoSortingFn: () => SortingFn<TGenerics>;
32
+ getAutoSortDir: () => SortDirection;
33
+ getSortingFn: () => SortingFn<TGenerics>;
34
+ getNextSortingOrder: () => SortDirection | false;
35
+ getCanSort: () => boolean;
36
+ getCanMultiSort: () => boolean;
37
+ getSortIndex: () => number;
38
+ getIsSorted: () => false | SortDirection;
39
+ clearSorting: () => void;
40
+ toggleSorting: (desc?: boolean, isMulti?: boolean) => void;
41
+ getToggleSortingHandler: () => undefined | ((event: unknown) => void);
42
+ };
43
+ export declare type SortingOptions<TGenerics extends TableGenerics> = {
44
+ manualSorting?: boolean;
45
+ sortingFns?: TGenerics['SortingFns'];
46
+ onSortingChange?: OnChangeFn<SortingState>;
47
+ enableSorting?: boolean;
48
+ enableSortingRemoval?: boolean;
49
+ enableMultiRemove?: boolean;
50
+ enableMultiSort?: boolean;
51
+ sortDescFirst?: boolean;
52
+ getSortedRowModel?: (instance: TableInstance<any>) => () => RowModel<any>;
53
+ maxMultiSortColCount?: number;
54
+ isMultiSortEvent?: (e: unknown) => boolean;
55
+ };
56
+ export declare type SortingInstance<TGenerics extends TableGenerics> = {
57
+ setSorting: (updater: Updater<SortingState>) => void;
58
+ resetSorting: (defaultState?: boolean) => void;
59
+ getPreSortedRowModel: () => RowModel<TGenerics>;
60
+ getSortedRowModel: () => RowModel<TGenerics>;
61
+ _getSortedRowModel?: () => RowModel<TGenerics>;
62
+ };
63
+ export declare const Sorting: TableFeature;
@@ -0,0 +1,40 @@
1
+ import { TableFeature } from '../core/instance';
2
+ import { Cell, Column, OnChangeFn, TableGenerics, Updater } from '../types';
3
+ export declare type VisibilityState = Record<string, boolean>;
4
+ export declare type VisibilityTableState = {
5
+ columnVisibility: VisibilityState;
6
+ };
7
+ export declare type VisibilityOptions = {
8
+ onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
9
+ enableHiding?: boolean;
10
+ };
11
+ export declare type VisibilityDefaultOptions = {
12
+ onColumnVisibilityChange: OnChangeFn<VisibilityState>;
13
+ };
14
+ export declare type VisibilityInstance<TGenerics extends TableGenerics> = {
15
+ getVisibleFlatColumns: () => Column<TGenerics>[];
16
+ getVisibleLeafColumns: () => Column<TGenerics>[];
17
+ getLeftVisibleLeafColumns: () => Column<TGenerics>[];
18
+ getRightVisibleLeafColumns: () => Column<TGenerics>[];
19
+ getCenterVisibleLeafColumns: () => Column<TGenerics>[];
20
+ setColumnVisibility: (updater: Updater<VisibilityState>) => void;
21
+ resetColumnVisibility: (defaultState?: boolean) => void;
22
+ toggleAllColumnsVisible: (value?: boolean) => void;
23
+ getIsAllColumnsVisible: () => boolean;
24
+ getIsSomeColumnsVisible: () => boolean;
25
+ getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void;
26
+ };
27
+ export declare type VisibilityColumnDef = {
28
+ enableHiding?: boolean;
29
+ };
30
+ export declare type VisibilityRow<TGenerics extends TableGenerics> = {
31
+ _getAllVisibleCells: () => Cell<TGenerics>[];
32
+ getVisibleCells: () => Cell<TGenerics>[];
33
+ };
34
+ export declare type VisibilityColumn = {
35
+ getCanHide: () => boolean;
36
+ getIsVisible: () => boolean;
37
+ toggleVisibility: (value?: boolean) => void;
38
+ getToggleVisibilityHandler: () => (event: unknown) => void;
39
+ };
40
+ export declare const Visibility: TableFeature;
@@ -0,0 +1,13 @@
1
+ import { FilterFn } from './features/Filters';
2
+ export declare const filterFns: {
3
+ includesString: FilterFn<any>;
4
+ includesStringSensitive: FilterFn<any>;
5
+ equalsString: FilterFn<any>;
6
+ arrIncludes: FilterFn<any>;
7
+ arrIncludesAll: FilterFn<any>;
8
+ arrIncludesSome: FilterFn<any>;
9
+ equals: FilterFn<any>;
10
+ weakEquals: FilterFn<any>;
11
+ inNumberRange: FilterFn<any>;
12
+ };
13
+ export declare type BuiltInFilterFn = keyof typeof filterFns;
@@ -0,0 +1,29 @@
1
+ export * from './core/instance';
2
+ export * from './types';
3
+ export * from './createTable';
4
+ export * from './core/column';
5
+ export * from './core/headers';
6
+ export * from './core/row';
7
+ export * from './features/ColumnSizing';
8
+ export * from './features/Expanding';
9
+ export * from './features/Filters';
10
+ export * from './features/Grouping';
11
+ export * from './features/Ordering';
12
+ export * from './features/Pagination';
13
+ export * from './features/Pinning';
14
+ export * from './features/RowSelection';
15
+ export * from './features/Sorting';
16
+ export * from './features/Visibility';
17
+ export * from './filterFns';
18
+ export * from './sortingFns';
19
+ export * from './aggregationFns';
20
+ export * from './utils';
21
+ export * from './utils/getCoreRowModel';
22
+ export * from './utils/getFilteredRowModel';
23
+ export * from './utils/getFacetedRowModel';
24
+ export * from './utils/getFacetedUniqueValues';
25
+ export * from './utils/getFacetedMinMaxValues';
26
+ export * from './utils/getSortedRowModel';
27
+ export * from './utils/getGroupedRowModel';
28
+ export * from './utils/getExpandedRowModel';
29
+ export * from './utils/getPaginationRowModel';
@@ -0,0 +1,11 @@
1
+ import { SortingFn } from './features/Sorting';
2
+ export declare const reSplitAlphaNumeric: RegExp;
3
+ export declare const sortingFns: {
4
+ alphanumeric: SortingFn<any>;
5
+ alphanumericCaseSensitive: SortingFn<any>;
6
+ text: SortingFn<any>;
7
+ textCaseSensitive: SortingFn<any>;
8
+ datetime: SortingFn<any>;
9
+ basic: SortingFn<any>;
10
+ };
11
+ export declare type BuiltInSortingFn = keyof typeof sortingFns;
@@ -0,0 +1,53 @@
1
+ import { CoreOptions, CoreTableState, CoreInstance } from './core/instance';
2
+ import { CoreColumn, CoreColumnDef } from './core/column';
3
+ import { VisibilityInstance, VisibilityTableState, VisibilityColumn as ColumnVisibilityColumn, VisibilityOptions, VisibilityColumnDef, VisibilityRow } from './features/Visibility';
4
+ import { ColumnOrderInstance, ColumnOrderOptions, ColumnOrderTableState } from './features/Ordering';
5
+ import { ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningRow, ColumnPinningTableState } from './features/Pinning';
6
+ import { CoreHeader, CoreHeaderGroup, HeadersInstance } from './core/headers';
7
+ import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, FiltersRow, FiltersTableState } from './features/Filters';
8
+ import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
9
+ import { GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
10
+ import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/Expanding';
11
+ import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
12
+ import { PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
13
+ import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
14
+ import { CoreRow } from './core/row';
15
+ import { PartialKeys } from './utils';
16
+ import { CoreCell } from './core/cell';
17
+ export declare type Updater<T> = T | ((old: T) => T);
18
+ export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
19
+ export declare type TableGenerics = {
20
+ Row?: any;
21
+ Value?: any;
22
+ FilterFns?: any;
23
+ SortingFns?: any;
24
+ AggregationFns?: any;
25
+ Renderer?: any;
26
+ Rendered?: any;
27
+ ColumnMeta?: any;
28
+ TableMeta?: any;
29
+ FilterMeta?: any;
30
+ };
31
+ export declare type AnyRender = (Comp: any, props: any) => any;
32
+ export declare type TableInstance<TGenerics extends TableGenerics> = CoreInstance<TGenerics> & HeadersInstance<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
33
+ export declare type TableOptionsResolved<TGenerics extends TableGenerics> = CoreOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
34
+ export declare type TableOptions<TGenerics extends TableGenerics> = Omit<PartialKeys<TableOptionsResolved<TGenerics>, 'state' | 'onStateChange'>, 'render' | 'renderFallbackValue'>;
35
+ export declare type TableState = CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
36
+ export declare type InitialTableState = Partial<CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationInitialTableState & RowSelectionTableState>;
37
+ export declare type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> & VisibilityRow<TGenerics> & ColumnPinningRow<TGenerics> & FiltersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
38
+ export declare type RowValues = {
39
+ [key: string]: any;
40
+ };
41
+ export declare type RowModel<TGenerics extends TableGenerics> = {
42
+ rows: Row<TGenerics>[];
43
+ flatRows: Row<TGenerics>[];
44
+ rowsById: Record<string, Row<TGenerics>>;
45
+ };
46
+ export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
47
+ export declare type Renderable<TGenerics extends TableGenerics, TProps> = string | ((props: TProps) => TGenerics['Rendered']);
48
+ export declare type ColumnDef<TGenerics extends TableGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
49
+ export declare type Column<TGenerics extends TableGenerics> = CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
50
+ export declare type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
51
+ export declare type Header<TGenerics extends TableGenerics> = CoreHeader<TGenerics> & ColumnSizingHeader<TGenerics>;
52
+ export declare type HeaderGroup<TGenerics extends TableGenerics> = CoreHeaderGroup<TGenerics>;
53
+ export declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];
@@ -0,0 +1,4 @@
1
+ import { TableGenerics, Row, RowModel, TableInstance } from '../types';
2
+ export declare function filterRows<TGenerics extends TableGenerics>(rows: Row<TGenerics>[], filterRowImpl: (row: Row<TGenerics>) => any, instance: TableInstance<TGenerics>): RowModel<TGenerics>;
3
+ export declare function filterRowModelFromLeafs<TGenerics extends TableGenerics>(rowsToFilter: Row<TGenerics>[], filterRow: (row: Row<TGenerics>) => Row<TGenerics>[], instance: TableInstance<TGenerics>): RowModel<TGenerics>;
4
+ export declare function filterRowModelFromRoot<TGenerics extends TableGenerics>(rowsToFilter: Row<TGenerics>[], filterRow: (row: Row<TGenerics>) => any, instance: TableInstance<TGenerics>): RowModel<TGenerics>;
@@ -0,0 +1,2 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getCoreRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
@@ -0,0 +1,7 @@
1
+ import { TableInstance, Row, RowModel, TableGenerics } from '../types';
2
+ export declare function getExpandedRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
3
+ export declare function expandRows<TGenerics extends TableGenerics>(rowModel: RowModel<TGenerics>, instance: TableInstance<TGenerics>): {
4
+ rows: Row<TGenerics>[];
5
+ flatRows: Row<TGenerics>[];
6
+ rowsById: Record<string, Row<TGenerics>>;
7
+ };
@@ -0,0 +1,2 @@
1
+ import { TableInstance, TableGenerics } from '../types';
2
+ export declare function getFacetedMinMaxValues<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>, columnId: string) => () => undefined | [number, number];
@@ -0,0 +1,2 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getFacetedRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>, columnId: string) => () => RowModel<TGenerics>;
@@ -0,0 +1,2 @@
1
+ import { TableInstance, TableGenerics } from '../types';
2
+ export declare function getFacetedUniqueValues<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>, columnId: string) => () => Map<any, number>;
@@ -0,0 +1,2 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getFilteredRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
@@ -0,0 +1,2 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getGroupedRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
@@ -0,0 +1,4 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getPaginationRowModel<TGenerics extends TableGenerics>(opts?: {
3
+ initialSync: boolean;
4
+ }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
@@ -0,0 +1,2 @@
1
+ import { TableInstance, RowModel, TableGenerics } from '../types';
2
+ export declare function getSortedRowModel<TGenerics extends TableGenerics>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
@@ -0,0 +1,19 @@
1
+ import { NoInfer, TableState, Updater } from './types';
2
+ export declare type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
+ export declare type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
4
+ export declare type Overwrite<T, U extends {
5
+ [TKey in keyof T]?: any;
6
+ }> = Omit<T, keyof U> & U;
7
+ export declare type IfDefined<T, N> = 0 extends 1 & T ? N : T extends {} ? T : N;
8
+ export declare function functionalUpdate<T>(updater: Updater<T>, input: T): T;
9
+ export declare function noop(): void;
10
+ export declare function makeStateUpdater(key: keyof TableState, instance: unknown): (updater: Updater<any>) => void;
11
+ declare type AnyFunction = (...args: any) => any;
12
+ export declare function isFunction<T extends AnyFunction>(d: any): d is T;
13
+ export declare function flattenBy<TNode>(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[];
14
+ export declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
15
+ key: any;
16
+ debug?: () => any;
17
+ onChange?: (result: TResult) => void;
18
+ }): () => TResult;
19
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.0.11",
4
+ "version": "8.0.12",
5
5
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/table#readme",
@@ -33,7 +33,7 @@
33
33
  "node": ">=12"
34
34
  },
35
35
  "files": [
36
- "build",
36
+ "build/**",
37
37
  "src"
38
38
  ]
39
39
  }