@trackunit/filters-filter-bar 2.6.22 → 2.6.27
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/index.cjs.js
CHANGED
|
@@ -372,7 +372,7 @@ const EmptyResults = ({ loading = false }) => {
|
|
|
372
372
|
*
|
|
373
373
|
* @param {DefaultFilterProps<string[]>} props - The properties required for the `DefaultCheckboxFilter` component.
|
|
374
374
|
*/
|
|
375
|
-
const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch = false, showUndefinedOptionWithCountAtBottom = true, pagination, }) => {
|
|
375
|
+
const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch = false, showUndefinedOptionWithCountAtBottom = true, undefinedOptionKey = "UNDEFINED", pagination, }) => {
|
|
376
376
|
const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
|
|
377
377
|
const { t } = useTranslation();
|
|
378
378
|
const handleSetValue = (value) => {
|
|
@@ -420,19 +420,19 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
420
420
|
const results = react.useMemo(() => {
|
|
421
421
|
const result = customSearch ? options : filteredOptions;
|
|
422
422
|
if (showUndefinedOptionWithCountAtBottom) {
|
|
423
|
-
const foundUndefined = result.filter(option => option.key ===
|
|
424
|
-
const allWithoutUndefined = result.filter(option => option.key !==
|
|
423
|
+
const foundUndefined = result.filter(option => option.key === undefinedOptionKey);
|
|
424
|
+
const allWithoutUndefined = result.filter(option => option.key !== undefinedOptionKey);
|
|
425
425
|
return [...allWithoutUndefined, ...foundUndefined];
|
|
426
426
|
}
|
|
427
427
|
return result;
|
|
428
|
-
}, [customSearch, options, filteredOptions, showUndefinedOptionWithCountAtBottom]);
|
|
428
|
+
}, [customSearch, options, filteredOptions, showUndefinedOptionWithCountAtBottom, undefinedOptionKey]);
|
|
429
429
|
const undefinedCount = react.useMemo(() => {
|
|
430
|
-
const index = results.findIndex(option => option.key ===
|
|
430
|
+
const index = results.findIndex(option => option.key === undefinedOptionKey);
|
|
431
431
|
if (index !== -1) {
|
|
432
432
|
return { count: results[index]?.count, index };
|
|
433
433
|
}
|
|
434
434
|
return null;
|
|
435
|
-
}, [results]);
|
|
435
|
+
}, [results, undefinedOptionKey]);
|
|
436
436
|
/**
|
|
437
437
|
* Selects the options loaded so far, which for a paginated facet is the pages fetched up to now
|
|
438
438
|
* rather than every value the server could return. That is what this button has always done — it
|
package/index.esm.js
CHANGED
|
@@ -370,7 +370,7 @@ const EmptyResults = ({ loading = false }) => {
|
|
|
370
370
|
*
|
|
371
371
|
* @param {DefaultFilterProps<string[]>} props - The properties required for the `DefaultCheckboxFilter` component.
|
|
372
372
|
*/
|
|
373
|
-
const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch = false, showUndefinedOptionWithCountAtBottom = true, pagination, }) => {
|
|
373
|
+
const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch = false, showUndefinedOptionWithCountAtBottom = true, undefinedOptionKey = "UNDEFINED", pagination, }) => {
|
|
374
374
|
const { logEvent } = useAnalytics(FilterEvents);
|
|
375
375
|
const { t } = useTranslation();
|
|
376
376
|
const handleSetValue = (value) => {
|
|
@@ -418,19 +418,19 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
418
418
|
const results = useMemo(() => {
|
|
419
419
|
const result = customSearch ? options : filteredOptions;
|
|
420
420
|
if (showUndefinedOptionWithCountAtBottom) {
|
|
421
|
-
const foundUndefined = result.filter(option => option.key ===
|
|
422
|
-
const allWithoutUndefined = result.filter(option => option.key !==
|
|
421
|
+
const foundUndefined = result.filter(option => option.key === undefinedOptionKey);
|
|
422
|
+
const allWithoutUndefined = result.filter(option => option.key !== undefinedOptionKey);
|
|
423
423
|
return [...allWithoutUndefined, ...foundUndefined];
|
|
424
424
|
}
|
|
425
425
|
return result;
|
|
426
|
-
}, [customSearch, options, filteredOptions, showUndefinedOptionWithCountAtBottom]);
|
|
426
|
+
}, [customSearch, options, filteredOptions, showUndefinedOptionWithCountAtBottom, undefinedOptionKey]);
|
|
427
427
|
const undefinedCount = useMemo(() => {
|
|
428
|
-
const index = results.findIndex(option => option.key ===
|
|
428
|
+
const index = results.findIndex(option => option.key === undefinedOptionKey);
|
|
429
429
|
if (index !== -1) {
|
|
430
430
|
return { count: results[index]?.count, index };
|
|
431
431
|
}
|
|
432
432
|
return null;
|
|
433
|
-
}, [results]);
|
|
433
|
+
}, [results, undefinedOptionKey]);
|
|
434
434
|
/**
|
|
435
435
|
* Selects the options loaded so far, which for a paginated facet is the pages fetched up to now
|
|
436
436
|
* rather than every value the server could return. That is what this button has always done — it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-filter-bar",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.27",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"tailwind-merge": "^2.0.0",
|
|
12
12
|
"string-ts": "^2.0.0",
|
|
13
13
|
"zod": "^3.25.76",
|
|
14
|
-
"@trackunit/iris-app-api": "2.4.
|
|
15
|
-
"@trackunit/react-core-hooks": "1.21.
|
|
16
|
-
"@trackunit/react-filter-components": "2.6.
|
|
17
|
-
"@trackunit/react-date-and-time-components": "2.6.
|
|
14
|
+
"@trackunit/iris-app-api": "2.4.17",
|
|
15
|
+
"@trackunit/react-core-hooks": "1.21.25",
|
|
16
|
+
"@trackunit/react-filter-components": "2.6.26",
|
|
17
|
+
"@trackunit/react-date-and-time-components": "2.6.26",
|
|
18
18
|
"@trackunit/shared-utils": "1.16.22",
|
|
19
|
-
"@trackunit/react-form-components": "2.6.
|
|
20
|
-
"@trackunit/iris-app-runtime-core-api": "1.17.
|
|
19
|
+
"@trackunit/react-form-components": "2.6.26",
|
|
20
|
+
"@trackunit/iris-app-runtime-core-api": "1.17.28",
|
|
21
21
|
"@trackunit/geo-json-utils": "1.15.21",
|
|
22
|
-
"@trackunit/i18n-library-translation": "2.4.
|
|
22
|
+
"@trackunit/i18n-library-translation": "2.4.25",
|
|
23
23
|
"@trackunit/css-class-variance-utilities": "1.14.19",
|
|
24
|
-
"@trackunit/react-components": "2.10.
|
|
24
|
+
"@trackunit/react-components": "2.10.19"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@apollo/client": "^3.13.8",
|
|
@@ -7,5 +7,5 @@ type FilterDefinitionValue = Array<string> | Array<ValueName>;
|
|
|
7
7
|
*
|
|
8
8
|
* @param {DefaultFilterProps<string[]>} props - The properties required for the `DefaultCheckboxFilter` component.
|
|
9
9
|
*/
|
|
10
|
-
export declare const DefaultCheckboxFilter: <TFilterValue extends FilterDefinitionValue>({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch, showUndefinedOptionWithCountAtBottom, pagination, }: DefaultFilterProps<TFilterValue>) => ReactElement;
|
|
10
|
+
export declare const DefaultCheckboxFilter: <TFilterValue extends FilterDefinitionValue>({ filterDefinition, filterBarActions, options, loading, setValue, filterName, customSearch, showRequestMoreUseSearch, showUndefinedOptionWithCountAtBottom, undefinedOptionKey, pagination, }: DefaultFilterProps<TFilterValue>) => ReactElement;
|
|
11
11
|
export {};
|
|
@@ -56,9 +56,15 @@ export interface DefaultFilterProps<TReturnType> extends FilterViewProps<TReturn
|
|
|
56
56
|
*/
|
|
57
57
|
pagination?: RelayPagination;
|
|
58
58
|
/**
|
|
59
|
-
* A flag indicating whether the
|
|
59
|
+
* A flag indicating whether the no-value option should be moved to bottom of the list always visible. Default is true
|
|
60
60
|
*/
|
|
61
61
|
showUndefinedOptionWithCountAtBottom?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The option key treated as the no-value bucket, so it is pinned to the bottom, left out of the
|
|
64
|
+
* search count and excluded from `Select all`. A facet whose no-value bucket has to carry a value
|
|
65
|
+
* the backend accepts overrides this. Default is "UNDEFINED"
|
|
66
|
+
*/
|
|
67
|
+
undefinedOptionKey?: string;
|
|
62
68
|
/**
|
|
63
69
|
* By default, searches client side on all options. Override with this to support for server side searching
|
|
64
70
|
*/
|
package/migrations/entry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/filters/filter-bar/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|