@databiosphere/findable-ui 46.0.0 → 46.1.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +19 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.js +1 -1
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.js +10 -1
- package/package.json +1 -1
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.tsx +1 -1
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.ts +20 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [46.1.1](https://github.com/DataBiosphere/findable-ui/compare/v46.1.0...v46.1.1) (2025-11-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* column filters clear all filters does not clear all filters with initial column filters ([#699](https://github.com/DataBiosphere/findable-ui/issues/699)) ([#700](https://github.com/DataBiosphere/findable-ui/issues/700)) ([75d1c2d](https://github.com/DataBiosphere/findable-ui/commit/75d1c2d47f88a894e2e9941d7aa2228c3eef5252))
|
|
9
|
+
|
|
10
|
+
## [46.1.0](https://github.com/DataBiosphere/findable-ui/compare/v46.0.0...v46.1.0) (2025-11-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* update column filter adapter to render custom filter values ([#694](https://github.com/DataBiosphere/findable-ui/issues/694)) ([#695](https://github.com/DataBiosphere/findable-ui/issues/695)) ([67404e9](https://github.com/DataBiosphere/findable-ui/commit/67404e940ea7610153e8a756609cd402225fa0cc))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update column filter adapter to always show filter values with a zero count ([#696](https://github.com/DataBiosphere/findable-ui/issues/696)) ([#697](https://github.com/DataBiosphere/findable-ui/issues/697)) ([a693f3b](https://github.com/DataBiosphere/findable-ui/commit/a693f3bf4f84cacf5602bbbe134b7a4f611e36dc))
|
|
21
|
+
|
|
3
22
|
## [46.0.0](https://github.com/DataBiosphere/findable-ui/compare/v45.1.0...v46.0.0) (2025-10-28)
|
|
4
23
|
|
|
5
24
|
|
|
@@ -14,7 +14,7 @@ export const ColumnFiltersAdapter = ({ renderSurface, table, }) => {
|
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- `categorySection` is not required by TanStack adapter.
|
|
15
15
|
_categorySection, viewKind) => {
|
|
16
16
|
if (categoryKey === CLEAR_ALL) {
|
|
17
|
-
table.resetColumnFilters();
|
|
17
|
+
table.resetColumnFilters(true);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
// Range filters use direct value assignment (e.g., [min, max] tuple for numeric ranges).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isRangeCategoryConfig } from "../../../../../../common/categories/config/range/typeGuards";
|
|
2
2
|
import { FILTER_SORT } from "../../../../../../common/filters/sort/config/types";
|
|
3
3
|
import { sortCategoryValueViews } from "../../../../../../common/filters/sort/models/utils";
|
|
4
|
+
import { getSelectCategoryValue } from "../../../../../../hooks/useCategoryFilter";
|
|
4
5
|
import { getColumnHeader } from "../../../../../Table/common/utils";
|
|
5
6
|
/**
|
|
6
7
|
* Adapter for TanStack table to category configs.
|
|
@@ -132,8 +133,16 @@ function mapColumnToRangeCategoryView(column, categoryConfig) {
|
|
|
132
133
|
*/
|
|
133
134
|
function mapColumnToSelectCategoryView(column, filterSort, categoryConfig) {
|
|
134
135
|
const facetedUniqueValues = column.getFacetedUniqueValues();
|
|
136
|
+
// Selected values for the column.
|
|
137
|
+
const filterValue = (column.getFilterValue() || []);
|
|
138
|
+
// Update faceted unique values with selected filters that are not in the faceted unique values.
|
|
139
|
+
for (const value of filterValue) {
|
|
140
|
+
if (facetedUniqueValues.has(value))
|
|
141
|
+
continue;
|
|
142
|
+
facetedUniqueValues.set(value, 0);
|
|
143
|
+
}
|
|
135
144
|
const isDisabled = facetedUniqueValues.size === 0;
|
|
136
|
-
const values = mapColumnToSelectCategoryValueView(column, filterSort);
|
|
145
|
+
const values = mapColumnToSelectCategoryValueView(column, filterSort).map(categoryConfig?.mapSelectCategoryValue || getSelectCategoryValue);
|
|
137
146
|
return {
|
|
138
147
|
annotation: undefined,
|
|
139
148
|
enableChartView: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Column, RowData, Table } from "@tanstack/react-table";
|
|
2
2
|
import { isRangeCategoryConfig } from "../../../../../../common/categories/config/range/typeGuards";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CategoryConfig,
|
|
5
|
+
SelectCategoryConfig,
|
|
6
|
+
} from "../../../../../../common/categories/config/types";
|
|
4
7
|
import { RangeCategoryView } from "../../../../../../common/categories/views/range/types";
|
|
5
8
|
import { CategoryView } from "../../../../../../common/categories/views/types";
|
|
6
9
|
import {
|
|
@@ -10,6 +13,7 @@ import {
|
|
|
10
13
|
import { FILTER_SORT } from "../../../../../../common/filters/sort/config/types";
|
|
11
14
|
import { sortCategoryValueViews } from "../../../../../../common/filters/sort/models/utils";
|
|
12
15
|
import { CategoryGroup } from "../../../../../../config/entities";
|
|
16
|
+
import { getSelectCategoryValue } from "../../../../../../hooks/useCategoryFilter";
|
|
13
17
|
import { getColumnHeader } from "../../../../../Table/common/utils";
|
|
14
18
|
import { CategoryFilter } from "../../../Filters/filters";
|
|
15
19
|
import { SurfaceProps } from "../../../surfaces/types";
|
|
@@ -142,7 +146,7 @@ function mapCategoryFilter<T extends RowData>(
|
|
|
142
146
|
categoryView = mapColumnToSelectCategoryView(
|
|
143
147
|
column,
|
|
144
148
|
filterSort,
|
|
145
|
-
categoryConfig
|
|
149
|
+
categoryConfig as SelectCategoryConfig
|
|
146
150
|
);
|
|
147
151
|
}
|
|
148
152
|
|
|
@@ -198,11 +202,23 @@ function mapColumnToRangeCategoryView<T extends RowData>(
|
|
|
198
202
|
function mapColumnToSelectCategoryView<T extends RowData>(
|
|
199
203
|
column: Column<T>,
|
|
200
204
|
filterSort: FILTER_SORT,
|
|
201
|
-
categoryConfig?:
|
|
205
|
+
categoryConfig?: SelectCategoryConfig
|
|
202
206
|
): SelectCategoryView {
|
|
203
207
|
const facetedUniqueValues = column.getFacetedUniqueValues();
|
|
208
|
+
|
|
209
|
+
// Selected values for the column.
|
|
210
|
+
const filterValue = (column.getFilterValue() || []) as unknown[];
|
|
211
|
+
|
|
212
|
+
// Update faceted unique values with selected filters that are not in the faceted unique values.
|
|
213
|
+
for (const value of filterValue) {
|
|
214
|
+
if (facetedUniqueValues.has(value)) continue;
|
|
215
|
+
facetedUniqueValues.set(value, 0);
|
|
216
|
+
}
|
|
217
|
+
|
|
204
218
|
const isDisabled = facetedUniqueValues.size === 0;
|
|
205
|
-
const values = mapColumnToSelectCategoryValueView(column, filterSort)
|
|
219
|
+
const values = mapColumnToSelectCategoryValueView(column, filterSort).map(
|
|
220
|
+
categoryConfig?.mapSelectCategoryValue || getSelectCategoryValue
|
|
221
|
+
);
|
|
206
222
|
return {
|
|
207
223
|
annotation: undefined,
|
|
208
224
|
enableChartView: false,
|