@tanstack/table-core 8.19.3 → 8.20.1
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/lib/core/column.js +1 -1
- package/build/lib/core/column.js.map +1 -1
- package/build/lib/index.esm.js +11 -18
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +11 -18
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils/getFacetedMinMaxValues.js +10 -17
- package/build/lib/utils/getFacetedMinMaxValues.js.map +1 -1
- package/build/umd/index.development.js +11 -18
- 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/core/column.ts +5 -1
- package/src/utils/getFacetedMinMaxValues.ts +11 -20
package/package.json
CHANGED
package/src/core/column.ts
CHANGED
|
@@ -79,7 +79,11 @@ export function createColumn<TData extends RowData, TValue>(
|
|
|
79
79
|
|
|
80
80
|
let id =
|
|
81
81
|
resolvedColumnDef.id ??
|
|
82
|
-
(accessorKey
|
|
82
|
+
(accessorKey
|
|
83
|
+
? typeof String.prototype.replaceAll === 'function'
|
|
84
|
+
? accessorKey.replaceAll('.', '_')
|
|
85
|
+
: accessorKey.replace(/\./g, '_')
|
|
86
|
+
: undefined) ??
|
|
83
87
|
(typeof resolvedColumnDef.header === 'string'
|
|
84
88
|
? resolvedColumnDef.header
|
|
85
89
|
: undefined)
|
|
@@ -11,31 +11,22 @@ export function getFacetedMinMaxValues<TData extends RowData>(): (
|
|
|
11
11
|
facetedRowModel => {
|
|
12
12
|
if (!facetedRowModel) return undefined
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const uniqueValues = facetedRowModel.flatRows
|
|
15
|
+
.flatMap(flatRow => flatRow.getUniqueValues(columnId) ?? [])
|
|
16
|
+
.map(Number)
|
|
17
|
+
.filter(value => !Number.isNaN(value))
|
|
16
18
|
|
|
17
|
-
if (
|
|
18
|
-
return undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let facetedMinMaxValues: [any, any] = [firstValue, firstValue]
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
24
|
-
const values =
|
|
25
|
-
facetedRowModel.flatRows[i]!.getUniqueValues<number>(columnId)
|
|
19
|
+
if (!uniqueValues.length) return
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
let facetedMinValue = uniqueValues[0]!
|
|
22
|
+
let facetedMaxValue = uniqueValues[uniqueValues.length - 1]!
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
facetedMinMaxValues[1] = value
|
|
34
|
-
}
|
|
35
|
-
}
|
|
24
|
+
for (const value of uniqueValues) {
|
|
25
|
+
if (value < facetedMinValue) facetedMinValue = value
|
|
26
|
+
else if (value > facetedMaxValue) facetedMaxValue = value
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
return
|
|
29
|
+
return [facetedMinValue, facetedMaxValue]
|
|
39
30
|
},
|
|
40
31
|
getMemoOptions(table.options, 'debugTable', 'getFacetedMinMaxValues')
|
|
41
32
|
)
|