@tanstack/table-core 8.0.0-alpha.74 → 8.0.0-alpha.79

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/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.74",
4
+ "version": "8.0.0-alpha.79",
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",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "module": "build/esm/index.js",
28
28
  "main": "build/cjs/index.js",
29
- "browser": "build/umd/index.production.min.js",
29
+ "browser": "build/umd/index.production.js",
30
30
  "types": "build/types/index.d.ts",
31
31
  "sideEffects": false,
32
32
  "engines": {
@@ -215,7 +215,7 @@ export const ColumnSizing: TableFeature = {
215
215
  }
216
216
  }
217
217
 
218
- const startSize = column.getSize()
218
+ const startSize = header.getSize()
219
219
 
220
220
  const columnSizingStart: [string, number][] = header
221
221
  ? header
@@ -121,15 +121,20 @@ export const Headers = {
121
121
  instance.getState().columnPinning.right,
122
122
  ],
123
123
  (allColumns, leafColumns, left, right) => {
124
- const leftColumns = leafColumns.filter(column =>
125
- left?.includes(column.id)
126
- )
127
- const rightColumns = leafColumns.filter(column =>
128
- right?.includes(column.id)
129
- )
124
+ const leftColumns =
125
+ left
126
+ ?.map(columnId => leafColumns.find(d => d.id === columnId)!)
127
+ .filter(Boolean) ?? []
128
+
129
+ const rightColumns =
130
+ right
131
+ ?.map(columnId => leafColumns.find(d => d.id === columnId)!)
132
+ .filter(Boolean) ?? []
133
+
130
134
  const centerColumns = leafColumns.filter(
131
135
  column => !left?.includes(column.id) && !right?.includes(column.id)
132
136
  )
137
+
133
138
  const headerGroups = buildHeaderGroups(
134
139
  allColumns,
135
140
  [...leftColumns, ...centerColumns, ...rightColumns],
@@ -173,8 +178,17 @@ export const Headers = {
173
178
  instance.getState().columnPinning.left,
174
179
  ],
175
180
  (allColumns, leafColumns, left) => {
176
- leafColumns = leafColumns.filter(column => left?.includes(column.id))
177
- return buildHeaderGroups(allColumns, leafColumns, instance, 'left')
181
+ const orderedLeafColumns =
182
+ left
183
+ ?.map(columnId => leafColumns.find(d => d.id === columnId)!)
184
+ .filter(Boolean) ?? []
185
+
186
+ return buildHeaderGroups(
187
+ allColumns,
188
+ orderedLeafColumns,
189
+ instance,
190
+ 'left'
191
+ )
178
192
  },
179
193
  {
180
194
  key: process.env.NODE_ENV === 'development' && 'getLeftHeaderGroups',
@@ -190,8 +204,17 @@ export const Headers = {
190
204
  instance.getState().columnPinning.right,
191
205
  ],
192
206
  (allColumns, leafColumns, right) => {
193
- leafColumns = leafColumns.filter(column => right?.includes(column.id))
194
- return buildHeaderGroups(allColumns, leafColumns, instance, 'right')
207
+ const orderedLeafColumns =
208
+ right
209
+ ?.map(columnId => leafColumns.find(d => d.id === columnId)!)
210
+ .filter(Boolean) ?? []
211
+
212
+ return buildHeaderGroups(
213
+ allColumns,
214
+ orderedLeafColumns,
215
+ instance,
216
+ 'right'
217
+ )
195
218
  },
196
219
  {
197
220
  key: process.env.NODE_ENV === 'development' && 'getRightHeaderGroups',