@trackunit/filters-asset-filter-definitions 1.10.10 → 1.10.13
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
|
@@ -2755,9 +2755,10 @@ const FETCH_LIMIT$9 = 1000;
|
|
|
2755
2755
|
* Custom hook to fetch customer summary data based on active filters and search text.
|
|
2756
2756
|
*
|
|
2757
2757
|
* @param filterValues - The current values from the filter bar.
|
|
2758
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
2758
2759
|
* @returns An object containing the fetched data, loading state, and a function to set search text.
|
|
2759
2760
|
*/
|
|
2760
|
-
const useCustomerData = (filterValues) => {
|
|
2761
|
+
const useCustomerData = (filterValues, customerId) => {
|
|
2761
2762
|
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(filterValues);
|
|
2762
2763
|
const [searchText, setSearchText] = react.useState("");
|
|
2763
2764
|
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
@@ -2768,7 +2769,7 @@ const useCustomerData = (filterValues) => {
|
|
|
2768
2769
|
search: debouncedSearch,
|
|
2769
2770
|
filters: {
|
|
2770
2771
|
...activeFilters,
|
|
2771
|
-
customerIds:
|
|
2772
|
+
customerIds: customerId ? [customerId] : null,
|
|
2772
2773
|
},
|
|
2773
2774
|
},
|
|
2774
2775
|
});
|
|
@@ -2882,10 +2883,11 @@ const useCustomerHierarchy = (customerSummary) => {
|
|
|
2882
2883
|
* This component renders a hierarchical checkbox filter for selecting customer IDs.
|
|
2883
2884
|
*
|
|
2884
2885
|
* @param {FilterViewProps<ValueName[]>} props - Filter properties including data, state, and actions.
|
|
2886
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
2885
2887
|
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
2886
2888
|
*/
|
|
2887
|
-
const CustomerIdsFilterView = (props) => {
|
|
2888
|
-
const { data, loading, searchText, setSearchText } = useCustomerData(props.filterState.values);
|
|
2889
|
+
const CustomerIdsFilterView = ({ customerId, ...props }) => {
|
|
2890
|
+
const { data, loading, searchText, setSearchText } = useCustomerData(props.filterState.values, customerId);
|
|
2889
2891
|
const hierarchicalOptions = useCustomerHierarchy(data?.assetSummary?.customers?.summary);
|
|
2890
2892
|
const valueNameArrayFilterDefinition = props.filterDefinition;
|
|
2891
2893
|
return (jsxRuntime.jsx(filtersFilterBar.HierarchicalCheckboxFilter, { cascadeSelection: true, customSearch: {
|
|
@@ -2896,7 +2898,7 @@ const CustomerIdsFilterView = (props) => {
|
|
|
2896
2898
|
/**
|
|
2897
2899
|
* Custom hook to create and configure a customer IDs filter definition.
|
|
2898
2900
|
*/
|
|
2899
|
-
const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persistValue } = {
|
|
2901
|
+
const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persistValue, customerId } = {
|
|
2900
2902
|
showInFilterBar: () => true,
|
|
2901
2903
|
hasCount: true,
|
|
2902
2904
|
}) => {
|
|
@@ -2910,9 +2912,9 @@ const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persist
|
|
|
2910
2912
|
title: t("fleetlist.column.customerIds"),
|
|
2911
2913
|
showInFilterBar,
|
|
2912
2914
|
persistValue,
|
|
2913
|
-
component: props => jsxRuntime.jsx(CustomerIdsFilterView, { ...props, hasCount: hasCount }),
|
|
2915
|
+
component: props => jsxRuntime.jsx(CustomerIdsFilterView, { ...props, customerId: customerId, hasCount: hasCount }),
|
|
2914
2916
|
};
|
|
2915
|
-
}, [
|
|
2917
|
+
}, [defaultValue, t, showInFilterBar, persistValue, customerId, hasCount]);
|
|
2916
2918
|
return result;
|
|
2917
2919
|
};
|
|
2918
2920
|
|
package/index.esm.js
CHANGED
|
@@ -2753,9 +2753,10 @@ const FETCH_LIMIT$9 = 1000;
|
|
|
2753
2753
|
* Custom hook to fetch customer summary data based on active filters and search text.
|
|
2754
2754
|
*
|
|
2755
2755
|
* @param filterValues - The current values from the filter bar.
|
|
2756
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
2756
2757
|
* @returns An object containing the fetched data, loading state, and a function to set search text.
|
|
2757
2758
|
*/
|
|
2758
|
-
const useCustomerData = (filterValues) => {
|
|
2759
|
+
const useCustomerData = (filterValues, customerId) => {
|
|
2759
2760
|
const activeFilters = useActiveAssetFilters(filterValues);
|
|
2760
2761
|
const [searchText, setSearchText] = useState("");
|
|
2761
2762
|
const debouncedSearch = useDebounce(searchText, 500);
|
|
@@ -2766,7 +2767,7 @@ const useCustomerData = (filterValues) => {
|
|
|
2766
2767
|
search: debouncedSearch,
|
|
2767
2768
|
filters: {
|
|
2768
2769
|
...activeFilters,
|
|
2769
|
-
customerIds:
|
|
2770
|
+
customerIds: customerId ? [customerId] : null,
|
|
2770
2771
|
},
|
|
2771
2772
|
},
|
|
2772
2773
|
});
|
|
@@ -2880,10 +2881,11 @@ const useCustomerHierarchy = (customerSummary) => {
|
|
|
2880
2881
|
* This component renders a hierarchical checkbox filter for selecting customer IDs.
|
|
2881
2882
|
*
|
|
2882
2883
|
* @param {FilterViewProps<ValueName[]>} props - Filter properties including data, state, and actions.
|
|
2884
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
2883
2885
|
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
2884
2886
|
*/
|
|
2885
|
-
const CustomerIdsFilterView = (props) => {
|
|
2886
|
-
const { data, loading, searchText, setSearchText } = useCustomerData(props.filterState.values);
|
|
2887
|
+
const CustomerIdsFilterView = ({ customerId, ...props }) => {
|
|
2888
|
+
const { data, loading, searchText, setSearchText } = useCustomerData(props.filterState.values, customerId);
|
|
2887
2889
|
const hierarchicalOptions = useCustomerHierarchy(data?.assetSummary?.customers?.summary);
|
|
2888
2890
|
const valueNameArrayFilterDefinition = props.filterDefinition;
|
|
2889
2891
|
return (jsx(HierarchicalCheckboxFilter, { cascadeSelection: true, customSearch: {
|
|
@@ -2894,7 +2896,7 @@ const CustomerIdsFilterView = (props) => {
|
|
|
2894
2896
|
/**
|
|
2895
2897
|
* Custom hook to create and configure a customer IDs filter definition.
|
|
2896
2898
|
*/
|
|
2897
|
-
const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persistValue } = {
|
|
2899
|
+
const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persistValue, customerId } = {
|
|
2898
2900
|
showInFilterBar: () => true,
|
|
2899
2901
|
hasCount: true,
|
|
2900
2902
|
}) => {
|
|
@@ -2908,9 +2910,9 @@ const useCustomerIdsFilter = ({ showInFilterBar, defaultValue, hasCount, persist
|
|
|
2908
2910
|
title: t("fleetlist.column.customerIds"),
|
|
2909
2911
|
showInFilterBar,
|
|
2910
2912
|
persistValue,
|
|
2911
|
-
component: props => jsx(CustomerIdsFilterView, { ...props, hasCount: hasCount }),
|
|
2913
|
+
component: props => jsx(CustomerIdsFilterView, { ...props, customerId: customerId, hasCount: hasCount }),
|
|
2912
2914
|
};
|
|
2913
|
-
}, [
|
|
2915
|
+
}, [defaultValue, t, showInFilterBar, persistValue, customerId, hasCount]);
|
|
2914
2916
|
return result;
|
|
2915
2917
|
};
|
|
2916
2918
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-asset-filter-definitions",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.13",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -16,23 +16,23 @@
|
|
|
16
16
|
"jest-fetch-mock": "^3.0.3",
|
|
17
17
|
"string-ts": "^2.0.0",
|
|
18
18
|
"tailwind-merge": "^2.0.0",
|
|
19
|
-
"@trackunit/iris-app-build-utilities": "1.7.
|
|
20
|
-
"@trackunit/filters-filter-bar": "1.8.
|
|
21
|
-
"@trackunit/react-core-hooks": "1.7.
|
|
22
|
-
"@trackunit/react-filter-components": "1.7.
|
|
23
|
-
"@trackunit/react-form-components": "1.8.
|
|
24
|
-
"@trackunit/filters-graphql-hook": "1.10.
|
|
25
|
-
"@trackunit/utilization-indicator": "1.7.
|
|
26
|
-
"@trackunit/geo-json-utils": "1.7.
|
|
27
|
-
"@trackunit/react-components": "1.9.
|
|
28
|
-
"@trackunit/shared-utils": "1.9.
|
|
29
|
-
"@trackunit/translations-machine-type": "1.7.
|
|
30
|
-
"@trackunit/criticality-indicator": "1.7.
|
|
31
|
-
"@trackunit/iris-app-api": "1.7.
|
|
32
|
-
"@trackunit/react-core-contexts-test": "1.7.
|
|
33
|
-
"@trackunit/i18n-library-translation": "1.7.
|
|
34
|
-
"@trackunit/react-core-contexts-api": "1.8.
|
|
35
|
-
"@trackunit/react-test-setup": "1.4.
|
|
19
|
+
"@trackunit/iris-app-build-utilities": "1.7.9",
|
|
20
|
+
"@trackunit/filters-filter-bar": "1.8.13",
|
|
21
|
+
"@trackunit/react-core-hooks": "1.7.10",
|
|
22
|
+
"@trackunit/react-filter-components": "1.7.13",
|
|
23
|
+
"@trackunit/react-form-components": "1.8.13",
|
|
24
|
+
"@trackunit/filters-graphql-hook": "1.10.13",
|
|
25
|
+
"@trackunit/utilization-indicator": "1.7.13",
|
|
26
|
+
"@trackunit/geo-json-utils": "1.7.8",
|
|
27
|
+
"@trackunit/react-components": "1.9.13",
|
|
28
|
+
"@trackunit/shared-utils": "1.9.8",
|
|
29
|
+
"@trackunit/translations-machine-type": "1.7.11",
|
|
30
|
+
"@trackunit/criticality-indicator": "1.7.13",
|
|
31
|
+
"@trackunit/iris-app-api": "1.7.9",
|
|
32
|
+
"@trackunit/react-core-contexts-test": "1.7.10",
|
|
33
|
+
"@trackunit/i18n-library-translation": "1.7.11",
|
|
34
|
+
"@trackunit/react-core-contexts-api": "1.8.10",
|
|
35
|
+
"@trackunit/react-test-setup": "1.4.8"
|
|
36
36
|
},
|
|
37
37
|
"module": "./index.esm.js",
|
|
38
38
|
"main": "./index.cjs.js",
|
|
@@ -6,17 +6,21 @@ import { ReactElement } from "react";
|
|
|
6
6
|
* This component renders a hierarchical checkbox filter for selecting customer IDs.
|
|
7
7
|
*
|
|
8
8
|
* @param {FilterViewProps<ValueName[]>} props - Filter properties including data, state, and actions.
|
|
9
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
9
10
|
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
10
11
|
*/
|
|
11
|
-
export declare const CustomerIdsFilterView: (props:
|
|
12
|
+
export declare const CustomerIdsFilterView: ({ customerId, ...props }: {
|
|
13
|
+
customerId?: string;
|
|
14
|
+
} & FilterViewProps<Array<ValueName>>) => ReactElement;
|
|
12
15
|
interface CustomerIdsFilterProps {
|
|
13
16
|
showInFilterBar: () => boolean;
|
|
14
17
|
defaultValue?: Array<ValueName>;
|
|
15
18
|
hasCount?: boolean;
|
|
16
19
|
persistValue?: boolean;
|
|
20
|
+
customerId?: string;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* Custom hook to create and configure a customer IDs filter definition.
|
|
20
24
|
*/
|
|
21
|
-
export declare const useCustomerIdsFilter: ({ showInFilterBar, defaultValue, hasCount, persistValue }?: CustomerIdsFilterProps) => ValueNameArrayFilterDefinition;
|
|
25
|
+
export declare const useCustomerIdsFilter: ({ showInFilterBar, defaultValue, hasCount, persistValue, customerId }?: CustomerIdsFilterProps) => ValueNameArrayFilterDefinition;
|
|
22
26
|
export {};
|
|
@@ -4,9 +4,10 @@ import { GetCustomerIdSummaryQuery } from "../../../generated/graphql-api/graphq
|
|
|
4
4
|
* Custom hook to fetch customer summary data based on active filters and search text.
|
|
5
5
|
*
|
|
6
6
|
* @param filterValues - The current values from the filter bar.
|
|
7
|
+
* @param customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
7
8
|
* @returns An object containing the fetched data, loading state, and a function to set search text.
|
|
8
9
|
*/
|
|
9
|
-
export declare const useCustomerData: (filterValues: FilterBarValues | undefined) => {
|
|
10
|
+
export declare const useCustomerData: (filterValues: FilterBarValues | undefined, customerId?: string) => {
|
|
10
11
|
data: GetCustomerIdSummaryQuery | undefined;
|
|
11
12
|
loading: boolean;
|
|
12
13
|
searchText: string;
|