@tanstack/table-core 8.0.0-alpha.63 → 8.0.0-alpha.67
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 +7 -4
- package/build/cjs/core.js.map +1 -1
- package/build/cjs/features/Cells.js +2 -2
- package/build/cjs/features/Cells.js.map +1 -1
- package/build/cjs/features/ColumnSizing.js +68 -143
- package/build/cjs/features/ColumnSizing.js.map +1 -1
- package/build/cjs/features/Columns.js +7 -7
- package/build/cjs/features/Columns.js.map +1 -1
- package/build/cjs/features/Expanding.js +52 -90
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js +213 -191
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/Grouping.js +54 -80
- package/build/cjs/features/Grouping.js.map +1 -1
- package/build/cjs/features/Headers.js +16 -40
- package/build/cjs/features/Headers.js.map +1 -1
- package/build/cjs/features/Ordering.js +6 -5
- package/build/cjs/features/Ordering.js.map +1 -1
- package/build/cjs/features/Pagination.js +5 -5
- package/build/cjs/features/Pagination.js.map +1 -1
- package/build/cjs/features/Pinning.js +82 -168
- package/build/cjs/features/Pinning.js.map +1 -1
- package/build/cjs/features/RowSelection.js +67 -119
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/features/Sorting.js +41 -91
- package/build/cjs/features/Sorting.js.map +1 -1
- package/build/cjs/features/Visibility.js +20 -43
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/filterFns.js +51 -108
- package/build/cjs/filterFns.js.map +1 -1
- package/build/cjs/index.js +5 -4
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/utils/filterRowsUtils.js +21 -0
- package/build/cjs/utils/filterRowsUtils.js.map +1 -1
- package/build/cjs/utils/getCoreRowModelAsync.js +1 -1
- package/build/cjs/utils/getCoreRowModelAsync.js.map +1 -1
- package/build/cjs/utils/getCoreRowModelSync.js +1 -1
- package/build/cjs/utils/getCoreRowModelSync.js.map +1 -1
- package/build/cjs/utils/getExpandedRowModel.js +2 -2
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getFilteredRowModelSync.js +125 -0
- package/build/cjs/utils/getFilteredRowModelSync.js.map +1 -0
- package/build/cjs/utils/getGroupedRowModel.js +1 -1
- package/build/cjs/utils/getGroupedRowModel.js.map +1 -1
- package/build/cjs/utils/getPaginationRowModel.js +1 -1
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/cjs/utils/getSortedRowModelSync.js +3 -3
- package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
- package/build/cjs/utils.js +2 -6
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +899 -1357
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +404 -418
- package/build/types/features/ColumnSizing.d.ts +2 -13
- package/build/types/features/Expanding.d.ts +3 -13
- package/build/types/features/Filters.d.ts +38 -42
- package/build/types/features/Grouping.d.ts +3 -18
- package/build/types/features/Ordering.d.ts +2 -6
- package/build/types/features/Pinning.d.ts +2 -19
- package/build/types/features/RowSelection.d.ts +4 -15
- package/build/types/features/Sorting.d.ts +5 -22
- package/build/types/features/Visibility.d.ts +2 -15
- package/build/types/filterFns.d.ts +10 -52
- package/build/types/index.d.ts +1 -2
- package/build/types/types.d.ts +2 -4
- package/build/types/utils/filterRowsUtils.d.ts +1 -0
- package/build/types/utils/{getColumnFilteredRowModelAsync.d.ts → getFilteredRowModelAsync.d.ts} +1 -1
- package/build/types/utils/getFilteredRowModelSync.d.ts +2 -0
- package/build/types/utils.d.ts +2 -2
- package/build/umd/index.development.js +867 -1323
- 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 +2 -1
- package/src/core.ts +5 -5
- package/src/features/Cells.ts +4 -2
- package/src/features/ColumnSizing.ts +69 -126
- package/src/features/Columns.ts +12 -7
- package/src/features/Expanding.ts +62 -107
- package/src/features/Filters.ts +293 -243
- package/src/features/Grouping.ts +59 -81
- package/src/features/Headers.ts +18 -40
- package/src/features/Ordering.ts +7 -9
- package/src/features/Pagination.ts +4 -3
- package/src/features/Pinning.ts +77 -164
- package/src/features/RowSelection.ts +76 -123
- package/src/features/Sorting.ts +48 -106
- package/src/features/Visibility.ts +25 -52
- package/src/filterFns.ts +74 -147
- package/src/index.ts +1 -2
- package/src/types.ts +2 -2
- package/src/utils/filterRowsUtils.ts +24 -0
- package/src/utils/getCoreRowModelAsync.ts +1 -1
- package/src/utils/getCoreRowModelSync.ts +1 -1
- package/src/utils/getExpandedRowModel.ts +2 -2
- package/src/utils/getFilteredRowModelAsync.ts +157 -0
- package/src/utils/getFilteredRowModelSync.ts +141 -0
- package/src/utils/getGroupedRowModel.ts +1 -1
- package/src/utils/getPaginationRowModel.ts +1 -1
- package/src/utils/getSortedRowModelAsync.ts +1 -1
- package/src/utils/getSortedRowModelSync.ts +4 -4
- package/src/utils.ts +2 -4
- package/build/cjs/utils/getColumnFilteredRowModelSync.js +0 -115
- package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +0 -1
- package/build/cjs/utils/getGlobalFilteredRowModelSync.js +0 -91
- package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +0 -1
- package/build/types/utils/getColumnFilteredRowModelSync.d.ts +0 -2
- package/build/types/utils/getGlobalFilteredRowModelAsync.d.ts +0 -4
- package/build/types/utils/getGlobalFilteredRowModelSync.d.ts +0 -2
- package/src/utils/getColumnFilteredRowModelAsync.ts +0 -118
- package/src/utils/getColumnFilteredRowModelSync.ts +0 -102
- package/src/utils/getGlobalFilteredRowModelAsync.ts +0 -96
- package/src/utils/getGlobalFilteredRowModelSync.ts +0 -79
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { TableInstance, RowModel, TableGenerics, Row } from '../types'
|
|
2
|
-
import { memo } from '../utils'
|
|
3
|
-
import {
|
|
4
|
-
filterRowModelFromLeafs,
|
|
5
|
-
filterRowModelFromRoot,
|
|
6
|
-
} from './filterRowsUtils'
|
|
7
|
-
|
|
8
|
-
export function getGlobalFilteredRowModelSync<
|
|
9
|
-
TGenerics extends TableGenerics
|
|
10
|
-
>(): (instance: TableInstance<TGenerics>) => () => RowModel<TGenerics> {
|
|
11
|
-
return instance =>
|
|
12
|
-
memo(
|
|
13
|
-
() => [
|
|
14
|
-
instance.getState().globalFilter,
|
|
15
|
-
instance.getPreGlobalFilteredRowModel(),
|
|
16
|
-
],
|
|
17
|
-
(globalFilter, rowModel) => {
|
|
18
|
-
const globalFilteredRowModel: RowModel<TGenerics> = (() => {
|
|
19
|
-
if (!rowModel.rows.length || !globalFilter) {
|
|
20
|
-
return rowModel
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const filterFromLeafRows = instance.options.filterFromLeafRows
|
|
24
|
-
|
|
25
|
-
const filterFn = instance.getGlobalFilterFn()
|
|
26
|
-
|
|
27
|
-
if (!filterFn) {
|
|
28
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
console.warn(`Could not find a valid 'globalFilterType'`)
|
|
30
|
-
}
|
|
31
|
-
return rowModel
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const filterableColumns = instance
|
|
35
|
-
.getAllLeafColumns()
|
|
36
|
-
.filter(column => column.getCanGlobalFilter())
|
|
37
|
-
|
|
38
|
-
const filterableColumnIds = filterableColumns.map(d => d.id)
|
|
39
|
-
|
|
40
|
-
const filterRows = (rows: Row<TGenerics>[]) => {
|
|
41
|
-
return filterFn(rows, filterableColumnIds, globalFilter)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (filterFromLeafRows) {
|
|
45
|
-
return filterRowModelFromLeafs(rowModel.rows, filterRows, instance)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return filterRowModelFromRoot(rowModel.rows, filterRows, instance)
|
|
49
|
-
})()
|
|
50
|
-
|
|
51
|
-
// Now that each filtered column has it's partially filtered rows,
|
|
52
|
-
// lets assign the final filtered rows to all of the other columns
|
|
53
|
-
const nonFilteredColumns = instance
|
|
54
|
-
.getAllLeafColumns()
|
|
55
|
-
.filter(
|
|
56
|
-
column =>
|
|
57
|
-
!instance.getState().columnFilters?.find(d => d.id === column.id)
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
// This essentially enables faceted filter options to be built easily
|
|
61
|
-
// using every column's preFilteredRows value
|
|
62
|
-
|
|
63
|
-
nonFilteredColumns.forEach(column => {
|
|
64
|
-
column.getPreFilteredRows = () => globalFilteredRowModel.rows
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
return globalFilteredRowModel
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
key: 'getGlobalFilteredRowModelSync',
|
|
71
|
-
debug: () => instance.options.debugAll ?? instance.options.debugTable,
|
|
72
|
-
onChange: () => {
|
|
73
|
-
instance.queue(() => {
|
|
74
|
-
instance._autoResetPageIndex()
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
}
|