@tanstack/table-core 8.0.0-alpha.41 → 8.0.0-alpha.44

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 (38) hide show
  1. package/build/cjs/core.js +4 -2
  2. package/build/cjs/core.js.map +1 -1
  3. package/build/cjs/features/Filters.js.map +1 -1
  4. package/build/cjs/features/RowSelection.js.map +1 -1
  5. package/build/cjs/utils/getColumnFilteredRowModelSync.js +2 -2
  6. package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +1 -1
  7. package/build/cjs/utils/getExpandedRowModel.js +1 -1
  8. package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
  9. package/build/cjs/utils/getGlobalFilteredRowModelSync.js +1 -1
  10. package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +1 -1
  11. package/build/cjs/utils/getGroupedRowModel.js +1 -1
  12. package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
  13. package/build/cjs/utils/getPaginationRowModel.js +1 -1
  14. package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
  15. package/build/cjs/utils/getSortedRowModelSync.js +1 -1
  16. package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
  17. package/build/esm/index.js +11 -9
  18. package/build/esm/index.js.map +1 -1
  19. package/build/stats-html.html +1 -1
  20. package/build/stats-react.json +301 -301
  21. package/build/types/features/Filters.d.ts +0 -1
  22. package/build/umd/index.development.js +11 -9
  23. package/build/umd/index.development.js.map +1 -1
  24. package/build/umd/index.production.js +1 -1
  25. package/build/umd/index.production.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/core.ts +2 -1
  28. package/src/features/Filters.ts +0 -1
  29. package/src/features/RowSelection.ts +1 -1
  30. package/src/utils/getColumnFilteredRowModelAsync.ts +4 -1
  31. package/src/utils/getColumnFilteredRowModelSync.ts +5 -2
  32. package/src/utils/getExpandedRowModel.ts +1 -1
  33. package/src/utils/getGlobalFilteredRowModelAsync.ts +4 -1
  34. package/src/utils/getGlobalFilteredRowModelSync.ts +4 -1
  35. package/src/utils/getGroupedRowModel.ts +1 -1
  36. package/src/utils/getPaginationRowModel.ts +4 -1
  37. package/src/utils/getSortedRowModelAsync.ts +1 -1
  38. package/src/utils/getSortedRowModelSync.ts +1 -1
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.0-alpha.41",
4
+ "version": "8.0.0-alpha.44",
5
5
  "description": "Hooks for building lightweight, fast and extendable datagrids for React",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/react-table#readme",
package/src/core.ts CHANGED
@@ -310,7 +310,8 @@ export function createTableInstance<TGenerics extends AnyGenerics>(
310
310
  return template
311
311
  },
312
312
 
313
- getRowId: (_: TGenerics['Row'], index: number, parent?: Row<TGenerics>) =>
313
+ getRowId: (row: TGenerics['Row'], index: number, parent?: Row<TGenerics>) =>
314
+ instance.options.getRowId?.(row, index, parent) ??
314
315
  `${parent ? [parent.id, index].join('.') : index}`,
315
316
 
316
317
  getState: () => {
@@ -89,7 +89,6 @@ export type FiltersOptions<TGenerics extends AnyGenerics> = {
89
89
  // Global
90
90
  globalFilterType?: FilterType<TGenerics>
91
91
  onGlobalFilterChange?: OnChangeFn<any>
92
- enableGlobalFilters?: boolean
93
92
  autoResetGlobalFilter?: boolean
94
93
  enableGlobalFilter?: boolean
95
94
  getGlobalFilteredRowModel?: (
@@ -591,7 +591,7 @@ export function selectRowsFn<TGenerics extends AnyGenerics>(
591
591
  const newSelectedRowsById: Record<string, Row<TGenerics>> = {}
592
592
 
593
593
  // Filters top level and nested rows
594
- const recurseRows = (rows: Row<TGenerics>[], depth = 0) => {
594
+ const recurseRows = (rows: Row<TGenerics>[], depth = 0): Row<TGenerics>[] => {
595
595
  return rows
596
596
  .map(row => {
597
597
  const isSelected = isRowSelected(row, rowSelection, instance) === true
@@ -12,7 +12,10 @@ export function getColumnFilteredRowModelAsync<
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
13
13
  return instance =>
14
14
  incrementalMemo(
15
- () => [instance.getState().columnFilters, instance.getCoreRowModel()],
15
+ () => [
16
+ instance.getState().columnFilters,
17
+ instance.getPreColumnFilteredRowModel(),
18
+ ],
16
19
  (_sorting, rowModel): RowModel<TGenerics> => {
17
20
  return {
18
21
  rows: rowModel.rows.slice(),
@@ -10,10 +10,13 @@ export function getColumnFilteredRowModelSync<
10
10
  >(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
11
11
  return instance =>
12
12
  memo(
13
- () => [instance.getState().columnFilters, instance.getCoreRowModel()],
13
+ () => [
14
+ instance.getState().columnFilters,
15
+ instance.getPreColumnFilteredRowModel(),
16
+ ],
14
17
  (columnFilters, rowModel) => {
15
18
  const columnFilteredRowModel: RowModel<TGenerics> = (() => {
16
- if (!rowModel.rows.length || !columnFilters) {
19
+ if (!rowModel.rows.length || !columnFilters?.length) {
17
20
  return rowModel
18
21
  }
19
22
 
@@ -8,7 +8,7 @@ export function getExpandedRowModel<TGenerics extends AnyGenerics>(): (
8
8
  memo(
9
9
  () => [
10
10
  instance.getState().expanded,
11
- instance.getGroupedRowModel(),
11
+ instance.getPreExpandedRowModel(),
12
12
  instance.options.paginateExpandedRows,
13
13
  ],
14
14
  (expanded, rowModel, paginateExpandedRows) => {
@@ -12,7 +12,10 @@ export function getGlobalFilteredRowModelAsync<
12
12
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
13
13
  return instance =>
14
14
  incrementalMemo(
15
- () => [instance.getState().globalFilter, instance.getCoreRowModel()],
15
+ () => [
16
+ instance.getState().globalFilter,
17
+ instance.getPreGlobalFilteredRowModel(),
18
+ ],
16
19
  (_globalFilter, rowModel): RowModel<TGenerics> => {
17
20
  return {
18
21
  rows: rowModel.rows.slice(),
@@ -10,7 +10,10 @@ export function getGlobalFilteredRowModelSync<
10
10
  >(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
11
11
  return instance =>
12
12
  memo(
13
- () => [instance.getState().globalFilter, instance.getCoreRowModel()],
13
+ () => [
14
+ instance.getState().globalFilter,
15
+ instance.getPreGlobalFilteredRowModel(),
16
+ ],
14
17
  (globalFilter, rowModel) => {
15
18
  const globalFilteredRowModel: RowModel<TGenerics> = (() => {
16
19
  if (!rowModel.rows.length || !globalFilter) {
@@ -6,7 +6,7 @@ export function getGroupedRowModelSync<TGenerics extends AnyGenerics>(): (
6
6
  ) => () => RowModel<TGenerics> {
7
7
  return instance =>
8
8
  memo(
9
- () => [instance.getState().grouping, instance.getSortedRowModel()],
9
+ () => [instance.getState().grouping, instance.getPreGroupedRowModel()],
10
10
  (grouping, rowModel) => {
11
11
  if (!rowModel.rows.length || !grouping.length) {
12
12
  return rowModel
@@ -7,7 +7,10 @@ export function getPaginationRowModel<TGenerics extends AnyGenerics>(opts?: {
7
7
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
8
8
  return instance =>
9
9
  memo(
10
- () => [instance.getState().pagination, instance.getExpandedRowModel()],
10
+ () => [
11
+ instance.getState().pagination,
12
+ instance.getPrePaginationRowModel(),
13
+ ],
11
14
  (pagination, rowModel) => {
12
15
  if (!rowModel.rows.length) {
13
16
  return rowModel
@@ -7,7 +7,7 @@ export function getSortedRowModelSync<TGenerics extends AnyGenerics>(opts?: {
7
7
  }): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
8
8
  return instance =>
9
9
  incrementalMemo(
10
- () => [instance.getState().sorting, instance.getGlobalFilteredRowModel()],
10
+ () => [instance.getState().sorting, instance.getPreSortedRowModel()],
11
11
  (_sorting, rowModel): RowModel<TGenerics> => {
12
12
  return {
13
13
  rows: rowModel.rows.slice(),
@@ -7,7 +7,7 @@ export function getSortedRowModelSync<TGenerics extends AnyGenerics>(): (
7
7
  ) => () => RowModel<TGenerics> {
8
8
  return instance =>
9
9
  memo(
10
- () => [instance.getState().sorting, instance.getGlobalFilteredRowModel()],
10
+ () => [instance.getState().sorting, instance.getPreSortedRowModel()],
11
11
  (sorting, rowModel) => {
12
12
  if (!rowModel.rows.length || !sorting?.length) {
13
13
  return rowModel