@trackunit/filters-filter-bar 1.8.133 → 1.8.135
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 +7 -7
- package/index.esm.js +3 -3
- package/package.json +12 -12
package/index.cjs.js
CHANGED
|
@@ -625,7 +625,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
|
|
|
625
625
|
setValueAsValueNameArray(() => values.map(value => ({ name: value.label, value: value.key })));
|
|
626
626
|
}
|
|
627
627
|
};
|
|
628
|
-
const [filteredOptions, searchText, setSearchText] =
|
|
628
|
+
const [filteredOptions, searchText, setSearchText] = reactComponents.useTextSearch(options, item => [item.label]);
|
|
629
629
|
const results = react.useMemo(() => {
|
|
630
630
|
const result = customSearch ? options : filteredOptions;
|
|
631
631
|
if (showUndefinedOptionWithCountAtBottom) {
|
|
@@ -776,7 +776,7 @@ const DefaultMinMaxFilter = ({ filterDefinition, filterName, value, setValue, fi
|
|
|
776
776
|
*/
|
|
777
777
|
const DefaultRadioFilter = ({ filterDefinition, filterBarActions, options, loading, filterName, customSearch, showRequestMoreUseSearch = false, setValue, }) => {
|
|
778
778
|
const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
|
|
779
|
-
const [filteredOptions, searchText, setSearchText] =
|
|
779
|
+
const [filteredOptions, searchText, setSearchText] = reactComponents.useTextSearch(options, item => [item.label]);
|
|
780
780
|
const handleClick = (selectedId) => {
|
|
781
781
|
const { key, label } = filteredOptions.find(({ key: id }) => id === selectedId) ?? {};
|
|
782
782
|
if (key && label) {
|
|
@@ -880,7 +880,7 @@ const useFiltersMenu = ({ filterBarDefinition, filterBarConfig, hiddenFilters =
|
|
|
880
880
|
};
|
|
881
881
|
}, [filterBarConfig, filtersGrouped, allowShowFiltersDirectly]);
|
|
882
882
|
const textCallback = react.useCallback((item) => [item.title], []);
|
|
883
|
-
const [searchResults, searchText, setSearchText] =
|
|
883
|
+
const [searchResults, searchText, setSearchText] = reactComponents.useTextSearch(filtersToShow, textCallback);
|
|
884
884
|
const { filtersGrouped: searchResultsGrouped } = useGroupFilters(searchResults);
|
|
885
885
|
const { filtersGrouped: filtersToShowGrouped } = useGroupFilters(filtersToShow);
|
|
886
886
|
const appliedCustomFields = react.useMemo(() => appliedFilters.filter(filter => filter.group === "CUSTOM_FIELDS"), [appliedFilters]);
|
|
@@ -2108,7 +2108,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2108
2108
|
const search = reactRouter.useSearch({ strict: false, shouldThrow: false });
|
|
2109
2109
|
const location = reactRouter.useLocation();
|
|
2110
2110
|
const navigate = reactRouter.useNavigate();
|
|
2111
|
-
const { encode, decode } =
|
|
2111
|
+
const { encode, decode } = reactComponents.useCustomEncoding();
|
|
2112
2112
|
const { getUrlLengthWithSearchParam } = useSearchUtils();
|
|
2113
2113
|
const updateSearch = react.useCallback(async (searchParams) => {
|
|
2114
2114
|
if (!inputLoadData && !inputSaveData && Boolean(search)) {
|
|
@@ -2322,7 +2322,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2322
2322
|
const urlObject = getFilterValuesToUrl(initialFilterBarConfig.values, updatedFilterDefinitionsValues, false, isDefaultValue);
|
|
2323
2323
|
const result = {};
|
|
2324
2324
|
if (initialFilterBarConfig.name) {
|
|
2325
|
-
result[initialFilterBarConfig.name] = encode(
|
|
2325
|
+
result[initialFilterBarConfig.name] = encode(urlObject);
|
|
2326
2326
|
// Update the ref BEFORE updating the URL to prevent false external change detection
|
|
2327
2327
|
lastSearchUpdateRef.current = result[initialFilterBarConfig.name];
|
|
2328
2328
|
}
|
|
@@ -2394,7 +2394,7 @@ const useFilterBar = ({ name, onValuesChange, filterBarDefinition, loadData: inp
|
|
|
2394
2394
|
onValuesChangeRef.current?.(values);
|
|
2395
2395
|
}, []);
|
|
2396
2396
|
// Watch for changes in filter values and only save/notify when they actually change
|
|
2397
|
-
|
|
2397
|
+
reactComponents.useWatch({
|
|
2398
2398
|
value: filterBarConfig.values,
|
|
2399
2399
|
onChange: currentValues => {
|
|
2400
2400
|
saveData(filterBarConfig, filterBarDefinition);
|
|
@@ -2484,7 +2484,7 @@ const useFilterBarAsync = ({ name, onValuesChange, filterBarDefinition, loadData
|
|
|
2484
2484
|
onValuesChangeRef.current?.(values);
|
|
2485
2485
|
}, []);
|
|
2486
2486
|
// Watch for changes in filter values and only save/notify when they actually change
|
|
2487
|
-
|
|
2487
|
+
reactComponents.useWatch({
|
|
2488
2488
|
value: isDataLoaded ? filterBarConfigMemoed.values : null,
|
|
2489
2489
|
onChange: currentValues => {
|
|
2490
2490
|
if (currentValues !== null) {
|
package/index.esm.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { useMemo, useRef, useState, useEffect, useCallback, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { Filter, FilterBody, RadioFilterItem, CheckBoxFilterItem, FilterHeader as FilterHeader$1, FilterFooter } from '@trackunit/react-filter-components';
|
|
5
|
-
import { Button, Icon, useList, List, Text, Card, CardBody, useViewportBreakpoints, Popover, PopoverTrigger, Tooltip, Badge, PopoverContent, IconButton, MenuList } from '@trackunit/react-components';
|
|
6
|
-
import { useAnalytics,
|
|
5
|
+
import { Button, Icon, useList, List, Text, useTextSearch, Card, CardBody, useViewportBreakpoints, Popover, PopoverTrigger, Tooltip, Badge, PopoverContent, IconButton, MenuList, useCustomEncoding, useWatch } from '@trackunit/react-components';
|
|
6
|
+
import { useAnalytics, useCurrentUser } from '@trackunit/react-core-hooks';
|
|
7
7
|
import { capitalize } from 'string-ts';
|
|
8
8
|
import { createEvent } from '@trackunit/iris-app-runtime-core-api';
|
|
9
9
|
import { Search, NumberField, RadioGroup } from '@trackunit/react-form-components';
|
|
@@ -2320,7 +2320,7 @@ const useFilterBarPersistence = ({ name, setValue, refreshData, isDefaultValue,
|
|
|
2320
2320
|
const urlObject = getFilterValuesToUrl(initialFilterBarConfig.values, updatedFilterDefinitionsValues, false, isDefaultValue);
|
|
2321
2321
|
const result = {};
|
|
2322
2322
|
if (initialFilterBarConfig.name) {
|
|
2323
|
-
result[initialFilterBarConfig.name] = encode(
|
|
2323
|
+
result[initialFilterBarConfig.name] = encode(urlObject);
|
|
2324
2324
|
// Update the ref BEFORE updating the URL to prevent false external change detection
|
|
2325
2325
|
lastSearchUpdateRef.current = result[initialFilterBarConfig.name];
|
|
2326
2326
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-filter-bar",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.135",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
"tailwind-merge": "^2.0.0",
|
|
13
13
|
"string-ts": "^2.0.0",
|
|
14
14
|
"zod": "^3.23.8",
|
|
15
|
-
"@trackunit/iris-app-api": "1.9.
|
|
16
|
-
"@trackunit/react-core-hooks": "1.7.
|
|
17
|
-
"@trackunit/react-filter-components": "1.7.
|
|
18
|
-
"@trackunit/react-date-and-time-components": "1.10.
|
|
19
|
-
"@trackunit/shared-utils": "1.9.
|
|
20
|
-
"@trackunit/react-form-components": "1.8.
|
|
21
|
-
"@trackunit/iris-app-runtime-core-api": "1.7.
|
|
22
|
-
"@trackunit/geo-json-utils": "1.7.
|
|
23
|
-
"@trackunit/i18n-library-translation": "1.7.
|
|
24
|
-
"@trackunit/css-class-variance-utilities": "1.7.
|
|
25
|
-
"@trackunit/react-components": "1.10.
|
|
15
|
+
"@trackunit/iris-app-api": "1.9.20",
|
|
16
|
+
"@trackunit/react-core-hooks": "1.7.96",
|
|
17
|
+
"@trackunit/react-filter-components": "1.7.129",
|
|
18
|
+
"@trackunit/react-date-and-time-components": "1.10.129",
|
|
19
|
+
"@trackunit/shared-utils": "1.9.82",
|
|
20
|
+
"@trackunit/react-form-components": "1.8.126",
|
|
21
|
+
"@trackunit/iris-app-runtime-core-api": "1.7.92",
|
|
22
|
+
"@trackunit/geo-json-utils": "1.7.82",
|
|
23
|
+
"@trackunit/i18n-library-translation": "1.7.100",
|
|
24
|
+
"@trackunit/css-class-variance-utilities": "1.7.82",
|
|
25
|
+
"@trackunit/react-components": "1.10.57",
|
|
26
26
|
"@tanstack/react-router": "1.114.29"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|