material-react-table 1.13.0 → 1.13.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/package.json
CHANGED
@@ -45,10 +45,21 @@ export const MRT_FilterRangeSlider = ({ header, table }: Props) => {
|
|
45
45
|
...mcTableHeadCellFilterTextFieldProps,
|
46
46
|
} as SliderProps;
|
47
47
|
|
48
|
-
|
48
|
+
let [min, max] =
|
49
49
|
sliderProps.min !== undefined && sliderProps.max !== undefined
|
50
50
|
? [sliderProps.min, sliderProps.max]
|
51
51
|
: column.getFacetedMinMaxValues() ?? [0, 0];
|
52
|
+
|
53
|
+
// column.getFacetedMinMaxValues() seems to return an array of arrays for the min value
|
54
|
+
// under some conditions, so check for that and take the first array value if that happens.
|
55
|
+
// To be a bit defensive, implement the same check for max, just in case.
|
56
|
+
if (Array.isArray(min)) {
|
57
|
+
min = min[0]
|
58
|
+
}
|
59
|
+
if (Array.isArray(max)) {
|
60
|
+
max = max[0]
|
61
|
+
}
|
62
|
+
|
52
63
|
const [filterValues, setFilterValues] = useState([min, max]);
|
53
64
|
const columnFilterValue = column.getFilterValue();
|
54
65
|
|