@tanstack/table-core 9.0.0-beta.34 → 9.0.0-beta.35
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/dist/core/rows/coreRowsFeature.types.d.cts +2 -0
- package/dist/core/rows/coreRowsFeature.types.d.ts +2 -0
- package/dist/core/rows/coreRowsFeature.utils.cjs +11 -1
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.js +11 -1
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.cjs +12 -11
- package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.js +13 -12
- package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +26 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +26 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +26 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +14 -2
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +14 -2
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +27 -3
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +10 -6
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.js +10 -6
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/static-functions.cjs +1 -0
- package/dist/static-functions.d.cts +2 -2
- package/dist/static-functions.d.ts +2 -2
- package/dist/static-functions.js +2 -2
- package/dist/utils.cjs +3 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +3 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/rows/coreRowsFeature.types.ts +5 -0
- package/src/core/rows/coreRowsFeature.utils.ts +13 -1
- package/src/features/column-ordering/columnOrderingFeature.ts +12 -8
- package/src/features/column-ordering/columnOrderingFeature.types.ts +26 -0
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +56 -5
- package/src/features/column-pinning/columnPinningFeature.utils.ts +24 -10
- package/src/utils.ts +3 -2
|
@@ -139,15 +139,22 @@ export function column_getIsPinned<
|
|
|
139
139
|
>(
|
|
140
140
|
column: Column_Internal<TFeatures, TData, TValue>,
|
|
141
141
|
): ColumnPinningPosition | false {
|
|
142
|
-
const
|
|
142
|
+
const leafColumns = column.getLeafColumns()
|
|
143
143
|
|
|
144
144
|
const { left, right } =
|
|
145
145
|
column.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
for (let i = 0; i < leafColumns.length; i++) {
|
|
148
|
+
if (left.includes(leafColumns[i]!.id)) {
|
|
149
|
+
return 'left'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
for (let i = 0; i < leafColumns.length; i++) {
|
|
153
|
+
if (right.includes(leafColumns[i]!.id)) {
|
|
154
|
+
return 'right'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
/**
|
|
@@ -197,6 +204,9 @@ export function row_getCenterVisibleCells<
|
|
|
197
204
|
)
|
|
198
205
|
const { left, right } =
|
|
199
206
|
row.table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
207
|
+
if (!left.length && !right.length) {
|
|
208
|
+
return allCells
|
|
209
|
+
}
|
|
200
210
|
const leftAndRight: Array<string> = [...left, ...right]
|
|
201
211
|
return allCells.filter((d) => !leftAndRight.includes(d.column.id))
|
|
202
212
|
}
|
|
@@ -441,11 +451,12 @@ export function table_getCenterHeaderGroups<
|
|
|
441
451
|
)
|
|
442
452
|
const { left, right } =
|
|
443
453
|
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
if (left.length || right.length) {
|
|
455
|
+
const leftAndRight: Array<string> = [...left, ...right]
|
|
456
|
+
leafColumns = leafColumns.filter(
|
|
457
|
+
(column) => !leftAndRight.includes(column.id),
|
|
458
|
+
)
|
|
459
|
+
}
|
|
449
460
|
return buildHeaderGroups(allColumns, leafColumns, table, 'center')
|
|
450
461
|
}
|
|
451
462
|
|
|
@@ -741,6 +752,9 @@ export function table_getCenterLeafColumns<
|
|
|
741
752
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
742
753
|
const { left, right } =
|
|
743
754
|
table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()
|
|
755
|
+
if (!left.length && !right.length) {
|
|
756
|
+
return table.getAllLeafColumns()
|
|
757
|
+
}
|
|
744
758
|
const leftAndRight: Array<string> = [...left, ...right]
|
|
745
759
|
return table.getAllLeafColumns().filter((d) => !leftAndRight.includes(d.id))
|
|
746
760
|
}
|
package/src/utils.ts
CHANGED
|
@@ -52,7 +52,8 @@ export function cloneState<T>(value: T): T {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Copies prototype-instance own properties without carrying over lazy memo
|
|
55
|
-
* closures
|
|
55
|
+
* closures or the per-row cell cache, both of which are bound to the source
|
|
56
|
+
* instance (cached cells reference the source row).
|
|
56
57
|
*/
|
|
57
58
|
export function copyInstancePropertiesWithoutMemos<
|
|
58
59
|
TTarget extends Record<string, any>,
|
|
@@ -63,7 +64,7 @@ export function copyInstancePropertiesWithoutMemos<
|
|
|
63
64
|
|
|
64
65
|
for (let i = 0; i < keys.length; i++) {
|
|
65
66
|
const key = keys[i]!
|
|
66
|
-
if (!key.startsWith('_memo_')) {
|
|
67
|
+
if (!key.startsWith('_memo_') && key !== '_cellsCache') {
|
|
67
68
|
targetRecord[key] = source[key]
|
|
68
69
|
}
|
|
69
70
|
}
|