@tanstack/table-core 8.0.0-alpha.83 → 8.0.0-alpha.86

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 (105) hide show
  1. package/build/cjs/aggregationFns.js +50 -51
  2. package/build/cjs/aggregationFns.js.map +1 -1
  3. package/build/cjs/core/cell.js +38 -0
  4. package/build/cjs/core/cell.js.map +1 -0
  5. package/build/cjs/core/column.js +88 -0
  6. package/build/cjs/core/column.js.map +1 -0
  7. package/build/cjs/{features/Headers.js → core/headers.js} +54 -66
  8. package/build/cjs/core/headers.js.map +1 -0
  9. package/build/cjs/core/instance.js +255 -0
  10. package/build/cjs/core/instance.js.map +1 -0
  11. package/build/cjs/core/row.js +77 -0
  12. package/build/cjs/core/row.js.map +1 -0
  13. package/build/cjs/features/ColumnSizing.js.map +1 -1
  14. package/build/cjs/features/Expanding.js +0 -1
  15. package/build/cjs/features/Expanding.js.map +1 -1
  16. package/build/cjs/features/Filters.js +2 -3
  17. package/build/cjs/features/Filters.js.map +1 -1
  18. package/build/cjs/features/Grouping.js +5 -5
  19. package/build/cjs/features/Grouping.js.map +1 -1
  20. package/build/cjs/features/Ordering.js.map +1 -1
  21. package/build/cjs/features/Pagination.js.map +1 -1
  22. package/build/cjs/features/Pinning.js +3 -3
  23. package/build/cjs/features/Pinning.js.map +1 -1
  24. package/build/cjs/features/RowSelection.js.map +1 -1
  25. package/build/cjs/features/Sorting.js.map +1 -1
  26. package/build/cjs/features/Visibility.js +0 -5
  27. package/build/cjs/features/Visibility.js.map +1 -1
  28. package/build/cjs/index.js +9 -6
  29. package/build/cjs/index.js.map +1 -1
  30. package/build/cjs/utils/filterRowsUtils.js +23 -21
  31. package/build/cjs/utils/filterRowsUtils.js.map +1 -1
  32. package/build/cjs/utils/getCoreRowModel.js +9 -8
  33. package/build/cjs/utils/getCoreRowModel.js.map +1 -1
  34. package/build/cjs/utils/getExpandedRowModel.js +2 -2
  35. package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
  36. package/build/cjs/utils/getGroupedRowModel.js +13 -20
  37. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  38. package/build/cjs/utils/getPaginationRowModel.js +1 -1
  39. package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
  40. package/build/esm/index.js +718 -838
  41. package/build/esm/index.js.map +1 -1
  42. package/build/stats-html.html +1 -1
  43. package/build/stats-react.json +403 -380
  44. package/build/types/aggregationFns.d.ts +10 -19
  45. package/build/types/core/cell.d.ts +9 -0
  46. package/build/types/{features/Columns.d.ts → core/column.d.ts} +3 -17
  47. package/build/types/{features/Headers.d.ts → core/headers.d.ts} +26 -11
  48. package/build/types/core/instance.d.ts +57 -0
  49. package/build/types/core/row.d.ts +15 -0
  50. package/build/types/features/ColumnSizing.d.ts +2 -1
  51. package/build/types/features/Expanding.d.ts +2 -2
  52. package/build/types/features/Filters.d.ts +2 -3
  53. package/build/types/features/Grouping.d.ts +8 -9
  54. package/build/types/features/Ordering.d.ts +2 -1
  55. package/build/types/features/Pagination.d.ts +2 -1
  56. package/build/types/features/Pinning.d.ts +2 -1
  57. package/build/types/features/RowSelection.d.ts +2 -1
  58. package/build/types/features/Sorting.d.ts +2 -1
  59. package/build/types/features/Visibility.d.ts +7 -7
  60. package/build/types/index.d.ts +4 -2
  61. package/build/types/sortingFns.d.ts +4 -4
  62. package/build/types/types.d.ts +10 -53
  63. package/build/umd/index.development.js +721 -836
  64. package/build/umd/index.development.js.map +1 -1
  65. package/build/umd/index.production.js +1 -1
  66. package/build/umd/index.production.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/aggregationFns.ts +44 -40
  69. package/src/core/cell.ts +47 -0
  70. package/src/core/column.ts +148 -0
  71. package/src/{features/Headers.ts → core/headers.ts} +98 -99
  72. package/src/core/instance.ts +361 -0
  73. package/src/core/row.ts +85 -0
  74. package/src/features/ColumnSizing.ts +1 -1
  75. package/src/features/Expanding.ts +1 -4
  76. package/src/features/Filters.ts +2 -7
  77. package/src/features/Grouping.ts +16 -19
  78. package/src/features/Ordering.ts +1 -1
  79. package/src/features/Pagination.ts +1 -1
  80. package/src/features/Pinning.ts +8 -4
  81. package/src/features/RowSelection.ts +1 -1
  82. package/src/features/Sorting.ts +1 -1
  83. package/src/features/Visibility.ts +8 -17
  84. package/src/index.ts +4 -8
  85. package/src/types.ts +9 -61
  86. package/src/utils/filterRowsUtils.ts +4 -2
  87. package/src/utils/getCoreRowModel.ts +4 -2
  88. package/src/utils/getExpandedRowModel.ts +1 -5
  89. package/src/utils/getGroupedRowModel.ts +14 -23
  90. package/build/cjs/core.js +0 -168
  91. package/build/cjs/core.js.map +0 -1
  92. package/build/cjs/features/Cells.js +0 -101
  93. package/build/cjs/features/Cells.js.map +0 -1
  94. package/build/cjs/features/Columns.js +0 -191
  95. package/build/cjs/features/Columns.js.map +0 -1
  96. package/build/cjs/features/Headers.js.map +0 -1
  97. package/build/cjs/features/Rows.js +0 -94
  98. package/build/cjs/features/Rows.js.map +0 -1
  99. package/build/types/core.d.ts +0 -30
  100. package/build/types/features/Cells.d.ts +0 -13
  101. package/build/types/features/Rows.d.ts +0 -28
  102. package/src/core.ts +0 -246
  103. package/src/features/Cells.ts +0 -128
  104. package/src/features/Columns.ts +0 -293
  105. package/src/features/Rows.ts +0 -142
@@ -1,22 +1,13 @@
1
+ import { AggregationFn } from './features/Grouping';
1
2
  export declare const aggregationFns: {
2
- sum: typeof sum;
3
- min: typeof min;
4
- max: typeof max;
5
- extent: typeof extent;
6
- mean: typeof mean;
7
- median: typeof median;
8
- unique: typeof unique;
9
- uniqueCount: typeof uniqueCount;
10
- count: typeof count;
3
+ sum: AggregationFn<any>;
4
+ min: AggregationFn<any>;
5
+ max: AggregationFn<any>;
6
+ extent: AggregationFn<any>;
7
+ mean: AggregationFn<any>;
8
+ median: AggregationFn<any>;
9
+ unique: AggregationFn<any>;
10
+ uniqueCount: AggregationFn<any>;
11
+ count: AggregationFn<any>;
11
12
  };
12
13
  export declare type BuiltInAggregationFn = keyof typeof aggregationFns;
13
- declare function sum(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number;
14
- declare function min(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number | undefined;
15
- declare function max(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): number | undefined;
16
- declare function extent(_getLeafValues: () => unknown[], getChildValues: () => unknown[]): (number | undefined)[];
17
- export declare function mean(getLeafValues: () => unknown[]): number | undefined;
18
- declare function median(getLeafValues: () => unknown[]): number | undefined;
19
- declare function unique<T>(getLeafValues: () => T[]): T[];
20
- declare function uniqueCount(getLeafValues: () => unknown[]): number;
21
- declare function count(getLeafValues: () => unknown[]): number;
22
- export {};
@@ -0,0 +1,9 @@
1
+ import { Cell, Column, Row, TableGenerics, TableInstance } from '../types';
2
+ export declare type CoreCell<TGenerics extends TableGenerics> = {
3
+ id: string;
4
+ getValue: () => TGenerics['Value'];
5
+ row: Row<TGenerics>;
6
+ column: Column<TGenerics>;
7
+ renderCell: () => string | null | TGenerics['Rendered'];
8
+ };
9
+ export declare function createCell<TGenerics extends TableGenerics>(instance: TableInstance<TGenerics>, row: Row<TGenerics>, column: Column<TGenerics>, columnId: string): Cell<TGenerics>;
@@ -35,20 +35,6 @@ export declare type CoreColumn<TGenerics extends TableGenerics> = {
35
35
  getFlatColumns: () => Column<TGenerics>[];
36
36
  getLeafColumns: () => Column<TGenerics>[];
37
37
  };
38
- export declare type ColumnsOptions<TGenerics extends TableGenerics> = {
39
- columns: ColumnDef<TGenerics>[];
40
- defaultColumnDef?: Partial<ColumnDef<TGenerics>>;
41
- };
42
- export declare type ColumnsInstance<TGenerics extends TableGenerics> = {
43
- getDefaultColumnDef: () => Partial<ColumnDef<TGenerics>>;
44
- getColumnDefs: () => ColumnDef<TGenerics>[];
45
- createColumn: (columnDef: ColumnDef<TGenerics>, depth: number, parent?: Column<TGenerics>) => Column<TGenerics>;
46
- getAllColumns: () => Column<TGenerics>[];
47
- getAllFlatColumns: () => Column<TGenerics>[];
48
- getAllFlatColumnsById: () => Record<string, Column<TGenerics>>;
49
- getAllLeafColumns: () => Column<TGenerics>[];
50
- getColumn: (columnId: string) => Column<TGenerics>;
51
- };
52
- export declare const Columns: {
53
- createInstance: <TGenerics extends TableGenerics>(instance: TableInstance<TGenerics>) => ColumnsInstance<TGenerics>;
54
- };
38
+ export declare function createColumn<TGenerics extends TableGenerics>(instance: TableInstance<TGenerics>, columnDef: ColumnDef<TGenerics> & {
39
+ columnDefType?: CoreColumnDefType;
40
+ }, depth: number, parent?: Column<TGenerics>): Column<TGenerics>;
@@ -1,12 +1,30 @@
1
1
  import { Column, Header, HeaderGroup, TableGenerics, TableInstance } from '../types';
2
+ import { TableFeature } from './instance';
3
+ export declare type CoreHeaderGroup<TGenerics extends TableGenerics> = {
4
+ id: string;
5
+ depth: number;
6
+ headers: Header<TGenerics>[];
7
+ };
8
+ export declare type CoreHeader<TGenerics extends TableGenerics> = {
9
+ id: string;
10
+ index: number;
11
+ depth: number;
12
+ column: Column<TGenerics>;
13
+ headerGroup: HeaderGroup<TGenerics>;
14
+ subHeaders: Header<TGenerics>[];
15
+ colSpan: number;
16
+ rowSpan: number;
17
+ getLeafHeaders: () => Header<TGenerics>[];
18
+ isPlaceholder: boolean;
19
+ placeholderId?: string;
20
+ renderHeader: (options?: {
21
+ renderPlaceholder?: boolean;
22
+ }) => string | null | TGenerics['Rendered'];
23
+ renderFooter: (options?: {
24
+ renderPlaceholder?: boolean;
25
+ }) => string | null | TGenerics['Rendered'];
26
+ };
2
27
  export declare type HeadersInstance<TGenerics extends TableGenerics> = {
3
- createHeader: (column: Column<TGenerics>, options: {
4
- id?: string;
5
- isPlaceholder?: boolean;
6
- placeholderId?: string;
7
- index: number;
8
- depth: number;
9
- }) => Header<TGenerics>;
10
28
  getHeaderGroups: () => HeaderGroup<TGenerics>[];
11
29
  getLeftHeaderGroups: () => HeaderGroup<TGenerics>[];
12
30
  getCenterHeaderGroups: () => HeaderGroup<TGenerics>[];
@@ -23,9 +41,6 @@ export declare type HeadersInstance<TGenerics extends TableGenerics> = {
23
41
  getLeftLeafHeaders: () => Header<TGenerics>[];
24
42
  getCenterLeafHeaders: () => Header<TGenerics>[];
25
43
  getRightLeafHeaders: () => Header<TGenerics>[];
26
- getHeader: (id: string) => Header<TGenerics>;
27
- };
28
- export declare const Headers: {
29
- createInstance: <TGenerics extends TableGenerics>(instance: TableInstance<TGenerics>) => HeadersInstance<TGenerics>;
30
44
  };
45
+ export declare const Headers: TableFeature;
31
46
  export declare function buildHeaderGroups<TGenerics extends TableGenerics>(allColumns: Column<TGenerics>[], columnsToGroup: Column<TGenerics>[], instance: TableInstance<TGenerics>, headerFamily?: 'center' | 'left' | 'right'): HeaderGroup<TGenerics>[];
@@ -0,0 +1,57 @@
1
+ import { RequiredKeys } from '../utils';
2
+ import { Updater, TableOptionsResolved, TableState, TableInstance, Renderable, TableGenerics, InitialTableState, Row, Column, RowModel, ColumnDef } from '../types';
3
+ export declare type TableFeature = {
4
+ getDefaultOptions?: (instance: any) => any;
5
+ getInitialState?: (initialState?: InitialTableState) => any;
6
+ createInstance?: (instance: any) => any;
7
+ getDefaultColumnDef?: () => any;
8
+ createColumn?: (column: any, instance: any) => any;
9
+ createHeader?: (column: any, instance: any) => any;
10
+ createCell?: (cell: any, column: any, row: any, instance: any) => any;
11
+ createRow?: (row: any, instance: any) => any;
12
+ };
13
+ export declare type CoreTableState = {};
14
+ export declare type CoreOptions<TGenerics extends TableGenerics> = {
15
+ data: TGenerics['Row'][];
16
+ state: Partial<TableState>;
17
+ onStateChange: (updater: Updater<TableState>) => void;
18
+ render: TGenerics['Renderer'];
19
+ debugAll?: boolean;
20
+ debugTable?: boolean;
21
+ debugHeaders?: boolean;
22
+ debugColumns?: boolean;
23
+ debugRows?: boolean;
24
+ initialState?: InitialTableState;
25
+ autoResetAll?: boolean;
26
+ mergeOptions?: <T>(defaultOptions: T, options: Partial<T>) => T;
27
+ meta?: TGenerics['TableMeta'];
28
+ getCoreRowModel: (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
29
+ getSubRows?: (originalRow: TGenerics['Row'], index: number) => undefined | TGenerics['Row'][];
30
+ getRowId?: (originalRow: TGenerics['Row'], index: number, parent?: Row<TGenerics>) => string;
31
+ columns: ColumnDef<TGenerics>[];
32
+ defaultColumn?: Partial<ColumnDef<TGenerics>>;
33
+ };
34
+ export declare type CoreInstance<TGenerics extends TableGenerics> = {
35
+ initialState: TableState;
36
+ reset: () => void;
37
+ options: RequiredKeys<TableOptionsResolved<TGenerics>, 'state'>;
38
+ setOptions: (newOptions: Updater<TableOptionsResolved<TGenerics>>) => void;
39
+ getState: () => TableState;
40
+ setState: (updater: Updater<TableState>) => void;
41
+ _features: readonly TableFeature[];
42
+ _queue: (cb: () => void) => void;
43
+ _render: <TProps>(template: Renderable<TGenerics, TProps>, props: TProps) => string | null | TGenerics['Rendered'];
44
+ _getRowId: (_: TGenerics['Row'], index: number, parent?: Row<TGenerics>) => string;
45
+ getCoreRowModel: () => RowModel<TGenerics>;
46
+ _getCoreRowModel?: () => RowModel<TGenerics>;
47
+ getRowModel: () => RowModel<TGenerics>;
48
+ getRow: (id: string) => Row<TGenerics>;
49
+ _getDefaultColumnDef: () => Partial<ColumnDef<TGenerics>>;
50
+ _getColumnDefs: () => ColumnDef<TGenerics>[];
51
+ _getAllFlatColumnsById: () => Record<string, Column<TGenerics>>;
52
+ getAllColumns: () => Column<TGenerics>[];
53
+ getAllFlatColumns: () => Column<TGenerics>[];
54
+ getAllLeafColumns: () => Column<TGenerics>[];
55
+ getColumn: (columnId: string) => Column<TGenerics>;
56
+ };
57
+ export declare function createTableInstance<TGenerics extends TableGenerics>(options: TableOptionsResolved<TGenerics>): TableInstance<TGenerics>;
@@ -0,0 +1,15 @@
1
+ import { Cell, Row, TableGenerics, TableInstance } from '../types';
2
+ export declare type CoreRow<TGenerics extends TableGenerics> = {
3
+ id: string;
4
+ index: number;
5
+ original?: TGenerics['Row'];
6
+ depth: number;
7
+ _valuesCache: Record<string, any>;
8
+ getValue: (columnId: string) => any;
9
+ subRows: Row<TGenerics>[];
10
+ getLeafRows: () => Row<TGenerics>[];
11
+ originalSubRows?: TGenerics['Row'][];
12
+ getAllCells: () => Cell<TGenerics>[];
13
+ _getAllCellsByColumnId: () => Record<string, Cell<TGenerics>>;
14
+ };
15
+ export declare const createRow: <TGenerics extends TableGenerics>(instance: TableInstance<TGenerics>, id: string, original: TGenerics["Row"] | undefined, rowIndex: number, depth: number, subRows?: Row<TGenerics>[] | undefined) => Row<TGenerics>;
@@ -1,4 +1,5 @@
1
- import { OnChangeFn, TableGenerics, Updater, TableFeature } from '../types';
1
+ import { TableFeature } from '../core/instance';
2
+ import { OnChangeFn, TableGenerics, Updater } from '../types';
2
3
  import { ColumnPinningPosition } from './Pinning';
3
4
  export declare type ColumnSizingTableState = {
4
5
  columnSizing: ColumnSizingState;
@@ -1,5 +1,6 @@
1
1
  import { RowModel } from '..';
2
- import { OnChangeFn, TableGenerics, TableInstance, Row, Updater, TableFeature } from '../types';
2
+ import { TableFeature } from '../core/instance';
3
+ import { OnChangeFn, TableGenerics, TableInstance, Row, Updater } from '../types';
3
4
  export declare type ExpandedStateList = Record<string, boolean>;
4
5
  export declare type ExpandedState = true | Record<string, boolean>;
5
6
  export declare type ExpandedTableState = {
@@ -17,7 +18,6 @@ export declare type ExpandedOptions<TGenerics extends TableGenerics> = {
17
18
  autoResetExpanded?: boolean;
18
19
  enableExpanding?: boolean;
19
20
  getExpandedRowModel?: (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
20
- expandSubRows?: boolean;
21
21
  getIsRowExpanded?: (row: Row<TGenerics>) => boolean;
22
22
  getRowCanExpand?: (row: Row<TGenerics>) => boolean;
23
23
  paginateExpandedRows?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { RowModel } from '..';
2
+ import { TableFeature } from '../core/instance';
2
3
  import { BuiltInFilterFn } from '../filterFns';
3
- import { Column, OnChangeFn, TableGenerics, TableInstance, Row, Updater, TableFeature } from '../types';
4
+ import { Column, OnChangeFn, TableGenerics, TableInstance, Row, Updater } from '../types';
4
5
  import { Overwrite } from '../utils';
5
6
  export declare type FiltersTableState = {
6
7
  columnFilters: ColumnFiltersState;
@@ -31,7 +32,6 @@ export declare type FiltersColumnDef<TGenerics extends TableGenerics> = {
31
32
  }>>;
32
33
  enableColumnFilter?: boolean;
33
34
  enableGlobalFilter?: boolean;
34
- enableFaceting?: boolean;
35
35
  };
36
36
  export declare type FiltersColumn<TGenerics extends TableGenerics> = {
37
37
  filterFn: FilterFnOption<Overwrite<TGenerics, {
@@ -55,7 +55,6 @@ export declare type FiltersColumn<TGenerics extends TableGenerics> = {
55
55
  export declare type FiltersRow<TGenerics extends TableGenerics> = {
56
56
  columnFilters: Record<string, boolean>;
57
57
  columnFiltersMeta: Record<string, TGenerics['FilterMeta']>;
58
- subRowsByFacetId: Record<string, Row<TGenerics>[]>;
59
58
  };
60
59
  export declare type FiltersOptions<TGenerics extends TableGenerics> = {
61
60
  enableFilters?: boolean;
@@ -1,19 +1,19 @@
1
1
  import { RowModel } from '..';
2
2
  import { BuiltInAggregationFn } from '../aggregationFns';
3
- import { Cell, Column, OnChangeFn, TableInstance, Row, Updater, Renderable, TableGenerics, TableFeature } from '../types';
3
+ import { TableFeature } from '../core/instance';
4
+ import { Cell, Column, OnChangeFn, TableInstance, Row, Updater, Renderable, TableGenerics } from '../types';
4
5
  import { Overwrite } from '../utils';
5
6
  export declare type GroupingState = string[];
6
- export declare type AggregationFn<TGenerics extends TableGenerics> = (getLeafValues: () => TGenerics['Value'][], getChildValues: () => TGenerics['Value'][]) => any;
7
- export declare type CustomAggregationFns<TGenerics extends TableGenerics> = Record<string, AggregationFn<TGenerics>>;
8
- export declare type AggregationFnOption<TGenerics extends TableGenerics> = 'auto' | BuiltInAggregationFn | keyof TGenerics['AggregationFns'] | AggregationFn<TGenerics>;
9
7
  export declare type GroupingTableState = {
10
8
  grouping: GroupingState;
11
9
  };
10
+ export declare type AggregationFn<TGenerics extends TableGenerics> = (columnId: string, leafRows: Row<TGenerics>[], childRows: Row<TGenerics>[]) => any;
11
+ export declare type CustomAggregationFns<TGenerics extends TableGenerics> = Record<string, AggregationFn<TGenerics>>;
12
+ export declare type AggregationFnOption<TGenerics extends TableGenerics> = 'auto' | BuiltInAggregationFn | keyof TGenerics['AggregationFns'] | AggregationFn<TGenerics>;
12
13
  export declare type GroupingColumnDef<TGenerics extends TableGenerics> = {
13
14
  aggregationFn?: AggregationFnOption<Overwrite<TGenerics, {
14
15
  Value: any;
15
16
  }>>;
16
- aggregateValue?: (columnValue: unknown) => any;
17
17
  aggregatedCell?: Renderable<TGenerics, {
18
18
  instance: TableInstance<TGenerics>;
19
19
  row: Row<TGenerics>;
@@ -32,14 +32,14 @@ export declare type GroupingColumn<TGenerics extends TableGenerics> = {
32
32
  getGroupedIndex: () => number;
33
33
  toggleGrouping: () => void;
34
34
  getToggleGroupingHandler: () => () => void;
35
- getColumnAutoAggregationFn: () => AggregationFn<TGenerics> | undefined;
36
- getColumnAggregationFn: () => AggregationFn<TGenerics> | undefined;
35
+ getAutoAggregationFn: () => AggregationFn<TGenerics> | undefined;
36
+ getAggregationFn: () => AggregationFn<TGenerics> | undefined;
37
37
  };
38
38
  export declare type GroupingRow = {
39
39
  groupingColumnId?: string;
40
40
  groupingValue?: any;
41
41
  getIsGrouped: () => boolean;
42
- groupingValuesCache: Record<string, any>;
42
+ _groupingValuesCache: Record<string, any>;
43
43
  };
44
44
  export declare type GroupingCell<TGenerics extends TableGenerics> = {
45
45
  getIsGrouped: () => boolean;
@@ -56,7 +56,6 @@ export declare type GroupingOptions<TGenerics extends TableGenerics> = {
56
56
  aggregationFns?: TGenerics['AggregationFns'];
57
57
  onGroupingChange?: OnChangeFn<GroupingState>;
58
58
  enableGrouping?: boolean;
59
- enableGroupingRemoval?: boolean;
60
59
  getGroupedRowModel?: (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics>;
61
60
  groupedColumnMode?: false | 'reorder' | 'remove';
62
61
  };
@@ -1,4 +1,5 @@
1
- import { OnChangeFn, Updater, Column, TableGenerics, TableFeature } from '../types';
1
+ import { OnChangeFn, Updater, Column, TableGenerics } from '../types';
2
+ import { TableFeature } from '../core/instance';
2
3
  export declare type ColumnOrderTableState = {
3
4
  columnOrder: ColumnOrderState;
4
5
  };
@@ -1,4 +1,5 @@
1
- import { OnChangeFn, TableGenerics, TableInstance, RowModel, Updater, TableFeature } from '../types';
1
+ import { TableFeature } from '../core/instance';
2
+ import { OnChangeFn, TableGenerics, TableInstance, RowModel, Updater } from '../types';
2
3
  export declare type PaginationState = {
3
4
  pageIndex: number;
4
5
  pageSize: number;
@@ -1,4 +1,5 @@
1
- import { OnChangeFn, Updater, Column, TableGenerics, Cell, TableFeature } from '../types';
1
+ import { TableFeature } from '../core/instance';
2
+ import { OnChangeFn, Updater, Column, TableGenerics, Cell } from '../types';
2
3
  export declare type ColumnPinningPosition = false | 'left' | 'right';
3
4
  export declare type ColumnPinningState = {
4
5
  left?: string[];
@@ -1,4 +1,5 @@
1
- import { OnChangeFn, TableGenerics, TableInstance, Row, RowModel, Updater, TableFeature } from '../types';
1
+ import { TableFeature } from '../core/instance';
2
+ import { OnChangeFn, TableGenerics, TableInstance, Row, RowModel, Updater } from '../types';
2
3
  export declare type RowSelectionState = Record<string, boolean>;
3
4
  export declare type RowSelectionTableState = {
4
5
  rowSelection: RowSelectionState;
@@ -1,6 +1,7 @@
1
1
  import { RowModel } from '..';
2
+ import { TableFeature } from '../core/instance';
2
3
  import { BuiltInSortingFn } from '../sortingFns';
3
- import { OnChangeFn, TableGenerics, TableInstance, Row, Updater, TableFeature } from '../types';
4
+ import { OnChangeFn, TableGenerics, TableInstance, Row, Updater } from '../types';
4
5
  import { Overwrite } from '../utils';
5
6
  export declare type SortDirection = 'asc' | 'desc';
6
7
  export declare type ColumnSort = {
@@ -1,4 +1,9 @@
1
- import { Cell, Column, OnChangeFn, TableGenerics, Updater, TableFeature } from '../types';
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
+ };
2
7
  export declare type VisibilityOptions = {
3
8
  onColumnVisibilityChange?: OnChangeFn<VisibilityState>;
4
9
  enableHiding?: boolean;
@@ -6,10 +11,6 @@ export declare type VisibilityOptions = {
6
11
  export declare type VisibilityDefaultOptions = {
7
12
  onColumnVisibilityChange: OnChangeFn<VisibilityState>;
8
13
  };
9
- export declare type VisibilityState = Record<string, boolean>;
10
- export declare type VisibilityTableState = {
11
- columnVisibility: VisibilityState;
12
- };
13
14
  export declare type VisibilityInstance<TGenerics extends TableGenerics> = {
14
15
  getVisibleFlatColumns: () => Column<TGenerics>[];
15
16
  getVisibleLeafColumns: () => Column<TGenerics>[];
@@ -21,11 +22,10 @@ export declare type VisibilityInstance<TGenerics extends TableGenerics> = {
21
22
  toggleAllColumnsVisible: (value?: boolean) => void;
22
23
  getIsAllColumnsVisible: () => boolean;
23
24
  getIsSomeColumnsVisible: () => boolean;
24
- getToggleAllColumnsVisibilityHandler: () => undefined | ((event: unknown) => void);
25
+ getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void;
25
26
  };
26
27
  export declare type VisibilityColumnDef = {
27
28
  enableHiding?: boolean;
28
- defaultIsVisible?: boolean;
29
29
  };
30
30
  export declare type VisibilityRow<TGenerics extends TableGenerics> = {
31
31
  _getAllVisibleCells: () => Cell<TGenerics>[];
@@ -1,12 +1,14 @@
1
- export * from './core';
1
+ export * from './core/instance';
2
2
  export * from './types';
3
3
  export * from './createTable';
4
+ export * from './core/column';
5
+ export * from './core/headers';
6
+ export * from './core/row';
4
7
  export * from './features/ColumnSizing';
5
8
  export * from './features/ColumnSizing';
6
9
  export * from './features/Expanding';
7
10
  export * from './features/Filters';
8
11
  export * from './features/Grouping';
9
- export * from './features/Headers';
10
12
  export * from './features/Ordering';
11
13
  export * from './features/Pagination';
12
14
  export * from './features/Pinning';
@@ -11,8 +11,8 @@ export declare const sortingFns: {
11
11
  export declare type BuiltInSortingFn = keyof typeof sortingFns;
12
12
  declare function alphanumeric<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
13
13
  declare function alphanumericCaseSensitive<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): number;
14
- declare function text<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
15
- declare function textCaseSensitive<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
16
- declare function datetime<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
17
- declare function basic<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 0 | 1 | -1;
14
+ declare function text<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 1 | -1 | 0;
15
+ declare function textCaseSensitive<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 1 | -1 | 0;
16
+ declare function datetime<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 1 | -1 | 0;
17
+ declare function basic<TGenerics extends TableGenerics>(rowA: Row<TGenerics>, rowB: Row<TGenerics>, columnId: string): 1 | -1 | 0;
18
18
  export {};
@@ -1,20 +1,19 @@
1
- import { CoreOptions, CoreTableState, CoreInstance } from './core';
2
- import { ColumnsOptions, CoreColumn, CoreColumnDef } from './features/Columns';
1
+ import { CoreOptions, CoreTableState, CoreInstance } from './core/instance';
2
+ import { CoreColumn, CoreColumnDef } from './core/column';
3
3
  import { VisibilityInstance, VisibilityTableState, VisibilityColumn as ColumnVisibilityColumn, VisibilityOptions, VisibilityColumnDef, VisibilityRow } from './features/Visibility';
4
4
  import { ColumnOrderInstance, ColumnOrderOptions, ColumnOrderTableState } from './features/Ordering';
5
5
  import { ColumnPinningColumn, ColumnPinningColumnDef, ColumnPinningInstance, ColumnPinningOptions, ColumnPinningRow, ColumnPinningTableState } from './features/Pinning';
6
- import { HeadersInstance } from './features/Headers';
6
+ import { CoreHeader, CoreHeaderGroup, HeadersInstance } from './core/headers';
7
7
  import { FiltersColumn, FiltersColumnDef, FiltersInstance, FiltersOptions, FiltersRow, FiltersTableState } from './features/Filters';
8
8
  import { SortingColumn, SortingColumnDef, SortingInstance, SortingOptions, SortingTableState } from './features/Sorting';
9
9
  import { GroupingCell, GroupingColumn, GroupingColumnDef, GroupingInstance, GroupingOptions, GroupingRow, GroupingTableState } from './features/Grouping';
10
10
  import { ExpandedInstance, ExpandedOptions, ExpandedTableState, ExpandedRow } from './features/Expanding';
11
- import { PartialKeys } from './utils';
12
11
  import { ColumnSizingColumn, ColumnSizingColumnDef, ColumnSizingHeader, ColumnSizingInstance, ColumnSizingOptions, ColumnSizingTableState } from './features/ColumnSizing';
13
12
  import { PaginationInitialTableState, PaginationInstance, PaginationOptions, PaginationTableState } from './features/Pagination';
14
13
  import { RowSelectionInstance, RowSelectionOptions, RowSelectionRow, RowSelectionTableState } from './features/RowSelection';
15
- import { ColumnsInstance } from './features/Columns';
16
- import { CellsInstance, CellsRow } from './features/Cells';
17
- import { CoreRow, RowsInstance, RowsOptions } from './features/Rows';
14
+ import { CoreRow } from './core/row';
15
+ import { PartialKeys } from './utils';
16
+ import { CoreCell } from './core/cell';
18
17
  export declare type Updater<T> = T | ((old: T) => T);
19
18
  export declare type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
20
19
  export declare type TableGenerics = {
@@ -30,22 +29,12 @@ export declare type TableGenerics = {
30
29
  FilterMeta?: any;
31
30
  };
32
31
  export declare type AnyRender = (Comp: any, props: any) => any;
33
- export declare type TableFeature = {
34
- getDefaultOptions?: (instance: any) => any;
35
- getInitialState?: (initialState?: InitialTableState) => any;
36
- createInstance?: (instance: any) => any;
37
- getDefaultColumnDef?: () => any;
38
- createColumn?: (column: any, instance: any) => any;
39
- createHeader?: (column: any, instance: any) => any;
40
- createCell?: (cell: any, column: any, row: any, instance: any) => any;
41
- createRow?: (row: any, instance: any) => any;
42
- };
43
- export declare type TableInstance<TGenerics extends TableGenerics> = CoreInstance<TGenerics> & ColumnsInstance<TGenerics> & RowsInstance<TGenerics> & CellsInstance<TGenerics> & VisibilityInstance<TGenerics> & ColumnOrderInstance<TGenerics> & ColumnPinningInstance<TGenerics> & HeadersInstance<TGenerics> & FiltersInstance<TGenerics> & SortingInstance<TGenerics> & GroupingInstance<TGenerics> & ColumnSizingInstance<TGenerics> & ExpandedInstance<TGenerics> & PaginationInstance<TGenerics> & RowSelectionInstance<TGenerics>;
44
- export declare type TableOptionsResolved<TGenerics extends TableGenerics> = CoreOptions<TGenerics> & ColumnsOptions<TGenerics> & RowsOptions<TGenerics> & VisibilityOptions & ColumnOrderOptions & ColumnPinningOptions & FiltersOptions<TGenerics> & SortingOptions<TGenerics> & GroupingOptions<TGenerics> & ExpandedOptions<TGenerics> & ColumnSizingOptions & PaginationOptions<TGenerics> & RowSelectionOptions<TGenerics>;
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>;
45
34
  export declare type TableOptions<TGenerics extends TableGenerics> = Omit<PartialKeys<TableOptionsResolved<TGenerics>, 'state' | 'onStateChange'>, 'render'>;
46
35
  export declare type TableState = CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationTableState & RowSelectionTableState;
47
36
  export declare type InitialTableState = Partial<CoreTableState & VisibilityTableState & ColumnOrderTableState & ColumnPinningTableState & FiltersTableState & SortingTableState & ExpandedTableState & GroupingTableState & ColumnSizingTableState & PaginationInitialTableState & RowSelectionTableState>;
48
- export declare type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> & CellsRow<TGenerics> & VisibilityRow<TGenerics> & ColumnPinningRow<TGenerics> & FiltersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
37
+ export declare type Row<TGenerics extends TableGenerics> = CoreRow<TGenerics> & VisibilityRow<TGenerics> & ColumnPinningRow<TGenerics> & FiltersRow<TGenerics> & GroupingRow & RowSelectionRow & ExpandedRow;
49
38
  export declare type RowValues = {
50
39
  [key: string]: any;
51
40
  };
@@ -59,38 +48,6 @@ export declare type Renderable<TGenerics extends TableGenerics, TProps> = string
59
48
  export declare type ColumnDef<TGenerics extends TableGenerics> = CoreColumnDef<TGenerics> & VisibilityColumnDef & ColumnPinningColumnDef & FiltersColumnDef<TGenerics> & SortingColumnDef<TGenerics> & GroupingColumnDef<TGenerics> & ColumnSizingColumnDef;
60
49
  export declare type Column<TGenerics extends TableGenerics> = CoreColumn<TGenerics> & ColumnVisibilityColumn & ColumnPinningColumn & FiltersColumn<TGenerics> & SortingColumn<TGenerics> & GroupingColumn<TGenerics> & ColumnSizingColumn<TGenerics>;
61
50
  export declare type Cell<TGenerics extends TableGenerics> = CoreCell<TGenerics> & GroupingCell<TGenerics>;
62
- export declare type CoreCell<TGenerics extends TableGenerics> = {
63
- id: string;
64
- rowId: string;
65
- columnId: string;
66
- getValue: () => TGenerics['Value'];
67
- row: Row<TGenerics>;
68
- column: Column<TGenerics>;
69
- renderCell: () => string | null | TGenerics['Rendered'];
70
- };
71
51
  export declare type Header<TGenerics extends TableGenerics> = CoreHeader<TGenerics> & ColumnSizingHeader<TGenerics>;
72
- export declare type CoreHeader<TGenerics extends TableGenerics> = {
73
- id: string;
74
- index: number;
75
- depth: number;
76
- column: Column<TGenerics>;
77
- headerGroup: HeaderGroup<TGenerics>;
78
- subHeaders: Header<TGenerics>[];
79
- colSpan?: number;
80
- rowSpan?: number;
81
- getLeafHeaders: () => Header<TGenerics>[];
82
- isPlaceholder?: boolean;
83
- placeholderId?: string;
84
- renderHeader: (options?: {
85
- renderPlaceholder?: boolean;
86
- }) => string | null | TGenerics['Rendered'];
87
- renderFooter: (options?: {
88
- renderPlaceholder?: boolean;
89
- }) => string | null | TGenerics['Rendered'];
90
- };
91
- export declare type HeaderGroup<TGenerics extends TableGenerics> = {
92
- id: string;
93
- depth: number;
94
- headers: Header<TGenerics>[];
95
- };
52
+ export declare type HeaderGroup<TGenerics extends TableGenerics> = CoreHeaderGroup<TGenerics>;
96
53
  export declare type NoInfer<A extends any> = [A][A extends any ? 0 : never];