@tanstack/table-core 8.0.0-alpha.40 → 8.0.0-alpha.43
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/features/Expanding.js +5 -0
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/features/RowSelection.js.map +1 -1
- package/build/cjs/utils/getColumnFilteredRowModelSync.js +2 -2
- package/build/cjs/utils/getColumnFilteredRowModelSync.js.map +1 -1
- package/build/cjs/utils/getExpandedRowModel.js +1 -1
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getGlobalFilteredRowModelSync.js +1 -1
- package/build/cjs/utils/getGlobalFilteredRowModelSync.js.map +1 -1
- 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 +1 -1
- package/build/cjs/utils/getSortedRowModelSync.js.map +1 -1
- package/build/esm/index.js +12 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +301 -301
- package/build/types/features/Expanding.d.ts +1 -0
- package/build/types/features/Filters.d.ts +0 -1
- package/build/umd/index.development.js +12 -7
- 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 +1 -1
- package/src/features/Expanding.ts +6 -0
- package/src/features/Filters.ts +0 -1
- package/src/features/RowSelection.ts +1 -1
- package/src/utils/getColumnFilteredRowModelAsync.ts +4 -1
- package/src/utils/getColumnFilteredRowModelSync.ts +5 -2
- package/src/utils/getExpandedRowModel.ts +1 -1
- package/src/utils/getGlobalFilteredRowModelAsync.ts +4 -1
- package/src/utils/getGlobalFilteredRowModelSync.ts +4 -1
- package/src/utils/getGroupedRowModel.ts +1 -1
- package/src/utils/getPaginationRowModel.ts +4 -1
- package/src/utils/getSortedRowModelAsync.ts +1 -1
- 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.
|
|
4
|
+
"version": "8.0.0-alpha.43",
|
|
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",
|
|
@@ -52,6 +52,7 @@ export type ExpandedInstance<TGenerics extends AnyGenerics> = {
|
|
|
52
52
|
toggleAllRowsExpanded: (expanded?: boolean) => void
|
|
53
53
|
resetExpanded: () => void
|
|
54
54
|
getRowCanExpand: (rowId: string) => boolean
|
|
55
|
+
getCanSomeRowsExpand: () => boolean
|
|
55
56
|
getIsRowExpanded: (rowId: string) => boolean
|
|
56
57
|
getToggleExpandedProps: <TGetter extends Getter<ToggleExpandedProps>>(
|
|
57
58
|
rowId: string,
|
|
@@ -199,6 +200,11 @@ export const Expanding = {
|
|
|
199
200
|
!!row.subRows?.length
|
|
200
201
|
)
|
|
201
202
|
},
|
|
203
|
+
getCanSomeRowsExpand: () => {
|
|
204
|
+
return Object.keys(instance.getRowModel().rowsById).some(id =>
|
|
205
|
+
instance.getRowCanExpand(id)
|
|
206
|
+
)
|
|
207
|
+
},
|
|
202
208
|
getToggleExpandedProps: (rowId, userProps) => {
|
|
203
209
|
const row = instance.getRow(rowId)
|
|
204
210
|
|
package/src/features/Filters.ts
CHANGED
|
@@ -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
|
-
() => [
|
|
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
|
-
() => [
|
|
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.
|
|
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
|
-
() => [
|
|
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
|
-
() => [
|
|
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.
|
|
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
|
-
() => [
|
|
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.
|
|
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.
|
|
10
|
+
() => [instance.getState().sorting, instance.getPreSortedRowModel()],
|
|
11
11
|
(sorting, rowModel) => {
|
|
12
12
|
if (!rowModel.rows.length || !sorting?.length) {
|
|
13
13
|
return rowModel
|