@tanstack/table-core 8.0.0-alpha.23 → 8.0.0-alpha.26

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 (62) hide show
  1. package/build/cjs/core.js +10 -21
  2. package/build/cjs/core.js.map +1 -1
  3. package/build/cjs/createTable.js +9 -4
  4. package/build/cjs/createTable.js.map +1 -1
  5. package/build/cjs/features/ColumnSizing.js +23 -8
  6. package/build/cjs/features/ColumnSizing.js.map +1 -1
  7. package/build/cjs/features/Expanding.js.map +1 -1
  8. package/build/cjs/features/Filters.js.map +1 -1
  9. package/build/cjs/features/Grouping.js +1 -1
  10. package/build/cjs/features/Grouping.js.map +1 -1
  11. package/build/cjs/features/Headers.js.map +1 -1
  12. package/build/cjs/features/Ordering.js.map +1 -1
  13. package/build/cjs/features/Pagination.js.map +1 -1
  14. package/build/cjs/features/Pinning.js.map +1 -1
  15. package/build/cjs/features/RowSelection.js.map +1 -1
  16. package/build/cjs/features/Sorting.js.map +1 -1
  17. package/build/cjs/features/Visibility.js.map +1 -1
  18. package/build/cjs/filterTypes.js.map +1 -1
  19. package/build/cjs/sortTypes.js.map +1 -1
  20. package/build/cjs/utils/groupRowsFn.js.map +1 -1
  21. package/build/esm/index.js +2620 -2611
  22. package/build/esm/index.js.map +1 -1
  23. package/build/stats-html.html +1 -1
  24. package/build/stats-react.json +336 -336
  25. package/build/types/core.d.ts +9 -12
  26. package/build/types/createTable.d.ts +4 -4
  27. package/build/types/features/ColumnSizing.d.ts +13 -8
  28. package/build/types/features/Expanding.d.ts +6 -6
  29. package/build/types/features/Filters.d.ts +14 -14
  30. package/build/types/features/Grouping.d.ts +16 -16
  31. package/build/types/features/Headers.d.ts +6 -6
  32. package/build/types/features/Ordering.d.ts +4 -4
  33. package/build/types/features/Pagination.d.ts +5 -5
  34. package/build/types/features/Pinning.d.ts +5 -5
  35. package/build/types/features/RowSelection.d.ts +8 -8
  36. package/build/types/features/Sorting.d.ts +12 -12
  37. package/build/types/features/Visibility.d.ts +6 -6
  38. package/build/types/filterTypes.d.ts +10 -10
  39. package/build/types/sortTypes.d.ts +7 -7
  40. package/build/types/types.d.ts +22 -13
  41. package/build/umd/index.development.js +2620 -2611
  42. package/build/umd/index.development.js.map +1 -1
  43. package/build/umd/index.production.js +1 -1
  44. package/build/umd/index.production.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/core.tsx +35 -51
  47. package/src/createTable.tsx +20 -13
  48. package/src/features/ColumnSizing.ts +31 -7
  49. package/src/features/Expanding.ts +5 -5
  50. package/src/features/Filters.ts +13 -13
  51. package/src/features/Grouping.ts +17 -17
  52. package/src/features/Headers.ts +5 -5
  53. package/src/features/Ordering.ts +3 -3
  54. package/src/features/Pagination.ts +4 -4
  55. package/src/features/Pinning.ts +4 -4
  56. package/src/features/RowSelection.ts +8 -8
  57. package/src/features/Sorting.ts +11 -11
  58. package/src/features/Visibility.ts +5 -5
  59. package/src/filterTypes.ts +9 -9
  60. package/src/sortTypes.ts +6 -6
  61. package/src/types.ts +34 -25
  62. package/src/utils/groupRowsFn.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { PartialGenerics, Row } from './types';
1
+ import { AnyGenerics, Row } from './types';
2
2
  export declare const filterTypes: {
3
3
  includesString: typeof includesString;
4
4
  includesStringSensitive: typeof includesStringSensitive;
@@ -11,39 +11,39 @@ export declare const filterTypes: {
11
11
  betweenNumberRange: typeof betweenNumberRange;
12
12
  };
13
13
  export declare type BuiltInFilterType = keyof typeof filterTypes;
14
- declare function includesString<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
14
+ declare function includesString<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
15
15
  declare namespace includesString {
16
16
  var autoRemove: (val: any) => boolean;
17
17
  }
18
- declare function includesStringSensitive<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
18
+ declare function includesStringSensitive<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
19
19
  declare namespace includesStringSensitive {
20
20
  var autoRemove: (val: any) => boolean;
21
21
  }
22
- declare function equalsString<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
22
+ declare function equalsString<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
23
23
  declare namespace equalsString {
24
24
  var autoRemove: (val: any) => boolean;
25
25
  }
26
- declare function equalsStringSensitive<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
26
+ declare function equalsStringSensitive<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
27
27
  declare namespace equalsStringSensitive {
28
28
  var autoRemove: (val: any) => boolean;
29
29
  }
30
- declare function arrIncludes<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
30
+ declare function arrIncludes<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
31
31
  declare namespace arrIncludes {
32
32
  var autoRemove: (val: any) => boolean;
33
33
  }
34
- declare function arrIncludesAll<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown[]): Row<TGenerics>[];
34
+ declare function arrIncludesAll<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown[]): Row<TGenerics>[];
35
35
  declare namespace arrIncludesAll {
36
36
  var autoRemove: (val: any) => boolean;
37
37
  }
38
- declare function equals<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
38
+ declare function equals<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
39
39
  declare namespace equals {
40
40
  var autoRemove: (val: any) => boolean;
41
41
  }
42
- declare function weakEquals<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
42
+ declare function weakEquals<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: unknown): Row<TGenerics>[];
43
43
  declare namespace weakEquals {
44
44
  var autoRemove: (val: any) => boolean;
45
45
  }
46
- declare function betweenNumberRange<TGenerics extends PartialGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: [unknown, unknown]): Row<TGenerics>[];
46
+ declare function betweenNumberRange<TGenerics extends AnyGenerics>(rows: Row<TGenerics>[], columnIds: string[], filterValue: [unknown, unknown]): Row<TGenerics>[];
47
47
  declare namespace betweenNumberRange {
48
48
  var autoRemove: (val: any) => boolean;
49
49
  }
@@ -1,4 +1,4 @@
1
- import { PartialGenerics, Row } from './types';
1
+ import { AnyGenerics, Row } from './types';
2
2
  export declare const reSplitAlphaNumeric: RegExp;
3
3
  export declare const sortTypes: {
4
4
  alphanumeric: typeof alphanumeric;
@@ -9,10 +9,10 @@ export declare const sortTypes: {
9
9
  basic: typeof basic;
10
10
  };
11
11
  export declare type BuiltInSortType = keyof typeof sortTypes;
12
- declare function alphanumeric<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
13
- declare function alphanumericCaseSensitive<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
14
- declare function text<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
15
- declare function textCaseSensitive<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
16
- declare function datetime<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
17
- declare function basic<TGenerics extends PartialGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
12
+ declare function alphanumeric<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
13
+ declare function alphanumericCaseSensitive<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
14
+ declare function text<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
15
+ declare function textCaseSensitive<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
16
+ declare function datetime<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
17
+ declare function basic<TGenerics extends AnyGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
18
18
  export {};
@@ -21,31 +21,40 @@ export declare type DefaultGenerics = {
21
21
  ColumnMeta: object;
22
22
  };
23
23
  export declare type AnyRender = (Comp: any, props: any) => any;
24
- export declare type UseRenderer<TGenerics extends PartialGenerics> = TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any;
24
+ export declare type UseRenderer<TGenerics extends AnyGenerics> = TGenerics['Render'] extends (...args: any) => any ? TGenerics['Render'] : any;
25
25
  export declare type PartialGenerics = Partial<DefaultGenerics>;
26
26
  export declare type AnyGenerics = {
27
27
  [TKey in keyof PartialGenerics]?: any;
28
28
  };
29
- 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>;
30
- 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>;
29
+ export declare type TableFeature = {
30
+ getDefaultOptions?: (instance: any) => any;
31
+ getInitialState?: () => any;
32
+ getInstance?: (instance: any) => any;
33
+ getDefaultColumn?: () => any;
34
+ createColumn?: (column: any, instance: any) => any;
35
+ createCell?: (cell: any, column: any, row: any, instance: any) => any;
36
+ createRow?: (row: any, instance: any) => any;
37
+ };
38
+ export declare type TableInstance<TGenerics extends AnyGenerics> = TableCore<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
39
+ export declare type Options<TGenerics extends AnyGenerics> = CoreOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
31
40
  export declare type Updater<T> = T | ((old: T) => T);
32
41
  export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>, value: T) => void;
33
42
  export declare type TableState = VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
34
- export declare type Row<TGenerics extends PartialGenerics> = CoreRow<TGenerics> & VisibilityRow<TGenerics> & HeadersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
43
+ export declare type Row<TGenerics extends AnyGenerics> = CoreRow<TGenerics> & VisibilityRow<TGenerics> & HeadersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
35
44
  export declare type RowValues = {
36
45
  [key: string]: any;
37
46
  };
38
- export declare type RowModel<TGenerics extends PartialGenerics> = {
47
+ export declare type RowModel<TGenerics extends AnyGenerics> = {
39
48
  rows: Row<TGenerics>[];
40
49
  flatRows: Row<TGenerics>[];
41
50
  rowsById: Record<string, Row<TGenerics>>;
42
51
  };
43
52
  export declare type AccessorFn<TData> = (originalRow: TData, index: number) => any;
44
- export declare type Renderable<TGenerics extends PartialGenerics, TProps> = string | ((props: TProps) => ReturnType<UseRenderer<TGenerics>>);
45
- export declare type ColumnDef<TGenerics extends PartialGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
46
- export declare type Column<TGenerics extends PartialGenerics> = ColumnDef<TGenerics> & CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
47
- export declare type Cell<TGenerics extends PartialGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
48
- export declare type CoreCell<TGenerics extends PartialGenerics> = {
53
+ export declare type Renderable<TGenerics extends AnyGenerics, TProps> = string | ((props: TProps) => ReturnType<UseRenderer<TGenerics>>);
54
+ export declare type ColumnDef<TGenerics extends AnyGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
55
+ export declare type Column<TGenerics extends AnyGenerics> = ColumnDef<TGenerics> & CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
56
+ export declare type Cell<TGenerics extends AnyGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
57
+ export declare type CoreCell<TGenerics extends AnyGenerics> = {
49
58
  id: string;
50
59
  rowId: string;
51
60
  columnId: string;
@@ -55,8 +64,8 @@ export declare type CoreCell<TGenerics extends PartialGenerics> = {
55
64
  getCellProps: PropGetter<CellProps>;
56
65
  renderCell: () => string | null | ReturnType<UseRenderer<TGenerics>>;
57
66
  };
58
- export declare type Header<TGenerics extends PartialGenerics> = CoreHeader<TGenerics> & ColumnSizingHeader<TGenerics>;
59
- export declare type CoreHeader<TGenerics extends PartialGenerics> = {
67
+ export declare type Header<TGenerics extends AnyGenerics> = CoreHeader<TGenerics> & ColumnSizingHeader<TGenerics>;
68
+ export declare type CoreHeader<TGenerics extends AnyGenerics> = {
60
69
  id: string;
61
70
  depth: number;
62
71
  column: Column<TGenerics>;
@@ -76,7 +85,7 @@ export declare type CoreHeader<TGenerics extends PartialGenerics> = {
76
85
  renderPlaceholder?: boolean;
77
86
  }) => string | null | ReturnType<UseRenderer<TGenerics>>;
78
87
  };
79
- export declare type HeaderGroup<TGenerics extends PartialGenerics> = {
88
+ export declare type HeaderGroup<TGenerics extends AnyGenerics> = {
80
89
  id: string;
81
90
  depth: number;
82
91
  headers: Header<TGenerics>[];