@tanstack/table-core 8.0.0-alpha.87 → 8.0.0-alpha.88
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/cell.js +9 -7
- package/build/cjs/core/cell.js.map +1 -1
- package/build/cjs/core/column.js +1 -1
- package/build/cjs/core/column.js.map +1 -1
- package/build/cjs/features/Expanding.js +6 -2
- package/build/cjs/features/Expanding.js.map +1 -1
- package/build/cjs/features/Visibility.js +2 -2
- package/build/cjs/features/Visibility.js.map +1 -1
- package/build/cjs/utils/getCoreRowModel.js +4 -8
- package/build/cjs/utils/getCoreRowModel.js.map +1 -1
- package/build/esm/index.js +22 -20
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +315 -315
- package/build/types/index.d.ts +0 -2
- package/build/umd/index.development.js +22 -20
- 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 +4 -4
- package/src/core/cell.ts +4 -3
- package/src/core/column.ts +0 -1
- package/src/features/Expanding.ts +6 -2
- package/src/features/Visibility.ts +3 -9
- package/src/index.ts +0 -2
- package/src/utils/getCoreRowModel.ts +8 -11
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "8.0.0-alpha.88",
|
|
5
|
+
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://github.com/tanstack/
|
|
7
|
+
"homepage": "https://github.com/tanstack/table#readme",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/tanstack/
|
|
10
|
+
"url": "git+https://github.com/tanstack/table.git"
|
|
11
11
|
},
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"registry": "https://registry.npmjs.org/"
|
package/src/core/cell.ts
CHANGED
|
@@ -19,8 +19,8 @@ export function createCell<TGenerics extends TableGenerics>(
|
|
|
19
19
|
row,
|
|
20
20
|
column,
|
|
21
21
|
getValue: () => row.getValue(columnId),
|
|
22
|
-
renderCell: () =>
|
|
23
|
-
column.columnDef.cell
|
|
22
|
+
renderCell: () => {
|
|
23
|
+
return column.columnDef.cell
|
|
24
24
|
? instance._render(column.columnDef.cell, {
|
|
25
25
|
instance,
|
|
26
26
|
column,
|
|
@@ -28,7 +28,8 @@ export function createCell<TGenerics extends TableGenerics>(
|
|
|
28
28
|
cell: cell as Cell<TGenerics>,
|
|
29
29
|
getValue: cell.getValue,
|
|
30
30
|
})
|
|
31
|
-
: null
|
|
31
|
+
: null
|
|
32
|
+
},
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
instance._features.forEach(feature => {
|
package/src/core/column.ts
CHANGED
|
@@ -131,8 +131,12 @@ export const Expanding: TableFeature = {
|
|
|
131
131
|
const expanded = instance.getState().expanded
|
|
132
132
|
|
|
133
133
|
// If expanded is true, save some cycles and return true
|
|
134
|
-
if (expanded ===
|
|
135
|
-
return true
|
|
134
|
+
if (typeof expanded === 'boolean') {
|
|
135
|
+
return expanded === true
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (!Object.keys(expanded).length) {
|
|
139
|
+
return false
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
// If any row is not expanded, return false
|
|
@@ -112,15 +112,9 @@ export const Visibility: TableFeature = {
|
|
|
112
112
|
): VisibilityRow<TGenerics> => {
|
|
113
113
|
return {
|
|
114
114
|
_getAllVisibleCells: memo(
|
|
115
|
-
() => [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.filter(cell => cell.column.getIsVisible())
|
|
119
|
-
.map(d => d.id)
|
|
120
|
-
.join('_'),
|
|
121
|
-
],
|
|
122
|
-
_ => {
|
|
123
|
-
return row.getAllCells().filter(cell => cell.column.getIsVisible())
|
|
115
|
+
() => [row.getAllCells(), instance.getState().columnVisibility],
|
|
116
|
+
cells => {
|
|
117
|
+
return cells.filter(cell => cell.column.getIsVisible())
|
|
124
118
|
},
|
|
125
119
|
{
|
|
126
120
|
key:
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './core/column'
|
|
|
5
5
|
export * from './core/headers'
|
|
6
6
|
export * from './core/row'
|
|
7
7
|
export * from './features/ColumnSizing'
|
|
8
|
-
export * from './features/ColumnSizing'
|
|
9
8
|
export * from './features/Expanding'
|
|
10
9
|
export * from './features/Filters'
|
|
11
10
|
export * from './features/Grouping'
|
|
@@ -15,7 +14,6 @@ export * from './features/Pinning'
|
|
|
15
14
|
export * from './features/RowSelection'
|
|
16
15
|
export * from './features/Sorting'
|
|
17
16
|
export * from './features/Visibility'
|
|
18
|
-
export * from './features/Expanding'
|
|
19
17
|
export * from './filterFns'
|
|
20
18
|
export * from './sortingFns'
|
|
21
19
|
export * from './aggregationFns'
|
|
@@ -21,20 +21,14 @@ export function getCoreRowModel<TGenerics extends TableGenerics>(): (
|
|
|
21
21
|
rowsById: {},
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
let rows
|
|
25
|
-
let row
|
|
26
|
-
let originalRow
|
|
27
|
-
|
|
28
24
|
const accessRows = (
|
|
29
25
|
originalRows: TGenerics['Row'][],
|
|
30
26
|
depth = 0,
|
|
31
27
|
parent?: Row<TGenerics>
|
|
32
28
|
): Row<TGenerics>[] => {
|
|
33
|
-
rows = []
|
|
29
|
+
const rows = [] as Row<TGenerics>[]
|
|
34
30
|
|
|
35
31
|
for (let i = 0; i < originalRows.length; i++) {
|
|
36
|
-
originalRow = originalRows[i]
|
|
37
|
-
|
|
38
32
|
// This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
39
33
|
// if (!id) {
|
|
40
34
|
// if (process.env.NODE_ENV !== 'production') {
|
|
@@ -43,10 +37,10 @@ export function getCoreRowModel<TGenerics extends TableGenerics>(): (
|
|
|
43
37
|
// }
|
|
44
38
|
|
|
45
39
|
// Make the row
|
|
46
|
-
row = createRow(
|
|
40
|
+
const row = createRow(
|
|
47
41
|
instance,
|
|
48
|
-
instance._getRowId(
|
|
49
|
-
|
|
42
|
+
instance._getRowId(originalRows[i], i, parent),
|
|
43
|
+
originalRows[i],
|
|
50
44
|
i,
|
|
51
45
|
depth
|
|
52
46
|
)
|
|
@@ -60,7 +54,10 @@ export function getCoreRowModel<TGenerics extends TableGenerics>(): (
|
|
|
60
54
|
|
|
61
55
|
// Get the original subrows
|
|
62
56
|
if (instance.options.getSubRows) {
|
|
63
|
-
row.originalSubRows = instance.options.getSubRows(
|
|
57
|
+
row.originalSubRows = instance.options.getSubRows(
|
|
58
|
+
originalRows[i],
|
|
59
|
+
i
|
|
60
|
+
)
|
|
64
61
|
|
|
65
62
|
// Then recursively access them
|
|
66
63
|
if (row.originalSubRows?.length) {
|