@trackunit/filters-asset-filter-definitions 1.7.25 → 1.7.26
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 +449 -19
- package/index.esm.js +443 -21
- package/package.json +2 -2
- package/src/defaultFilters/defaults/RentalContractOrderNumberFilter.d.ts +21 -0
- package/src/defaultFilters/defaults/RentalContractReferenceCodeDescriptionFilter.d.ts +22 -0
- package/src/defaultFilters/defaults/RentalContractReferenceCodeFilter.d.ts +21 -0
- package/src/defaultFilters/defaults/SearchFilter.d.ts +1 -1
- package/src/defaultFilters/defaults/index.d.ts +3 -0
- package/src/generated/graphql-api/gql.d.ts +2 -2
- package/src/generated/graphql-api/graphql.d.ts +42 -0
- package/src/generated/graphql-api/mock.d.ts +6 -0
- package/src/translation.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -100,6 +100,10 @@ var defaultTranslations = {
|
|
|
100
100
|
"assetFilters.regions.WESTERN_ASIA": "Western Asia",
|
|
101
101
|
"assetFilters.regions.WESTERN_EUROPE": "Western Europe",
|
|
102
102
|
"assetFilters.regions.WHOLE_WORLD": "Whole world",
|
|
103
|
+
"assetFilters.rentalContractOrderNumberFilter.label": "Order number",
|
|
104
|
+
"assetFilters.rentalContractReferenceCodeDescriptionFilter.label": "Reference code description",
|
|
105
|
+
"assetFilters.rentalContractReferenceCodeDescriptionFilter.searchPlaceholder": "Search by reference code description...",
|
|
106
|
+
"assetFilters.rentalContractReferenceCodeFilter.label": "Reference code",
|
|
103
107
|
"assetFilters.rentalCustomerNameFilter.label": "Customer",
|
|
104
108
|
"assetFilters.searchFilter.label": "Text search",
|
|
105
109
|
"assetFilters.searchPlaceholder": "Search by text...",
|
|
@@ -1914,6 +1918,168 @@ const GetPlaceDetailsDocument = {
|
|
|
1914
1918
|
},
|
|
1915
1919
|
],
|
|
1916
1920
|
};
|
|
1921
|
+
const GetFleetRentalContractOrderNumberSummaryDocument = {
|
|
1922
|
+
kind: "Document",
|
|
1923
|
+
definitions: [
|
|
1924
|
+
{
|
|
1925
|
+
kind: "OperationDefinition",
|
|
1926
|
+
operation: "query",
|
|
1927
|
+
name: { kind: "Name", value: "GetFleetRentalContractOrderNumberSummary" },
|
|
1928
|
+
variableDefinitions: [
|
|
1929
|
+
{
|
|
1930
|
+
kind: "VariableDefinition",
|
|
1931
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1932
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
kind: "VariableDefinition",
|
|
1936
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
1937
|
+
type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } },
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
kind: "VariableDefinition",
|
|
1941
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
1942
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "String" } },
|
|
1943
|
+
},
|
|
1944
|
+
],
|
|
1945
|
+
selectionSet: {
|
|
1946
|
+
kind: "SelectionSet",
|
|
1947
|
+
selections: [
|
|
1948
|
+
{
|
|
1949
|
+
kind: "Field",
|
|
1950
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
1951
|
+
arguments: [
|
|
1952
|
+
{
|
|
1953
|
+
kind: "Argument",
|
|
1954
|
+
name: { kind: "Name", value: "filters" },
|
|
1955
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
1956
|
+
},
|
|
1957
|
+
],
|
|
1958
|
+
selectionSet: {
|
|
1959
|
+
kind: "SelectionSet",
|
|
1960
|
+
selections: [
|
|
1961
|
+
{
|
|
1962
|
+
kind: "Field",
|
|
1963
|
+
name: { kind: "Name", value: "rentalContractOrderNumbers" },
|
|
1964
|
+
arguments: [
|
|
1965
|
+
{
|
|
1966
|
+
kind: "Argument",
|
|
1967
|
+
name: { kind: "Name", value: "limit" },
|
|
1968
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
kind: "Argument",
|
|
1972
|
+
name: { kind: "Name", value: "filter" },
|
|
1973
|
+
value: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
1974
|
+
},
|
|
1975
|
+
],
|
|
1976
|
+
selectionSet: {
|
|
1977
|
+
kind: "SelectionSet",
|
|
1978
|
+
selections: [
|
|
1979
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
1980
|
+
{
|
|
1981
|
+
kind: "Field",
|
|
1982
|
+
name: { kind: "Name", value: "summary" },
|
|
1983
|
+
selectionSet: {
|
|
1984
|
+
kind: "SelectionSet",
|
|
1985
|
+
selections: [
|
|
1986
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
1987
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
1988
|
+
],
|
|
1989
|
+
},
|
|
1990
|
+
},
|
|
1991
|
+
],
|
|
1992
|
+
},
|
|
1993
|
+
},
|
|
1994
|
+
],
|
|
1995
|
+
},
|
|
1996
|
+
},
|
|
1997
|
+
],
|
|
1998
|
+
},
|
|
1999
|
+
},
|
|
2000
|
+
],
|
|
2001
|
+
};
|
|
2002
|
+
const GetFleetRentalContractReferenceCodesSummaryDocument = {
|
|
2003
|
+
kind: "Document",
|
|
2004
|
+
definitions: [
|
|
2005
|
+
{
|
|
2006
|
+
kind: "OperationDefinition",
|
|
2007
|
+
operation: "query",
|
|
2008
|
+
name: { kind: "Name", value: "GetFleetRentalContractReferenceCodesSummary" },
|
|
2009
|
+
variableDefinitions: [
|
|
2010
|
+
{
|
|
2011
|
+
kind: "VariableDefinition",
|
|
2012
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
2013
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
kind: "VariableDefinition",
|
|
2017
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
2018
|
+
type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } },
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
kind: "VariableDefinition",
|
|
2022
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
2023
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "String" } },
|
|
2024
|
+
},
|
|
2025
|
+
],
|
|
2026
|
+
selectionSet: {
|
|
2027
|
+
kind: "SelectionSet",
|
|
2028
|
+
selections: [
|
|
2029
|
+
{
|
|
2030
|
+
kind: "Field",
|
|
2031
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
2032
|
+
arguments: [
|
|
2033
|
+
{
|
|
2034
|
+
kind: "Argument",
|
|
2035
|
+
name: { kind: "Name", value: "filters" },
|
|
2036
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
2037
|
+
},
|
|
2038
|
+
],
|
|
2039
|
+
selectionSet: {
|
|
2040
|
+
kind: "SelectionSet",
|
|
2041
|
+
selections: [
|
|
2042
|
+
{
|
|
2043
|
+
kind: "Field",
|
|
2044
|
+
name: { kind: "Name", value: "rentalContractReferenceCodes" },
|
|
2045
|
+
arguments: [
|
|
2046
|
+
{
|
|
2047
|
+
kind: "Argument",
|
|
2048
|
+
name: { kind: "Name", value: "limit" },
|
|
2049
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
kind: "Argument",
|
|
2053
|
+
name: { kind: "Name", value: "filter" },
|
|
2054
|
+
value: { kind: "Variable", name: { kind: "Name", value: "search" } },
|
|
2055
|
+
},
|
|
2056
|
+
],
|
|
2057
|
+
selectionSet: {
|
|
2058
|
+
kind: "SelectionSet",
|
|
2059
|
+
selections: [
|
|
2060
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
2061
|
+
{
|
|
2062
|
+
kind: "Field",
|
|
2063
|
+
name: { kind: "Name", value: "summary" },
|
|
2064
|
+
selectionSet: {
|
|
2065
|
+
kind: "SelectionSet",
|
|
2066
|
+
selections: [
|
|
2067
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
2068
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
2069
|
+
],
|
|
2070
|
+
},
|
|
2071
|
+
},
|
|
2072
|
+
],
|
|
2073
|
+
},
|
|
2074
|
+
},
|
|
2075
|
+
],
|
|
2076
|
+
},
|
|
2077
|
+
},
|
|
2078
|
+
],
|
|
2079
|
+
},
|
|
2080
|
+
},
|
|
2081
|
+
],
|
|
2082
|
+
};
|
|
1917
2083
|
|
|
1918
2084
|
exports.AssetActivityState = void 0;
|
|
1919
2085
|
(function (AssetActivityState) {
|
|
@@ -2063,7 +2229,7 @@ const placeSchema = areaFilterInternalSchema.extend({
|
|
|
2063
2229
|
});
|
|
2064
2230
|
|
|
2065
2231
|
const SHARED_LOCATIONS_LOCAL_STORAGE_KEY = "shared-recent-locations";
|
|
2066
|
-
const MAX_RECENT_SEARCHES$
|
|
2232
|
+
const MAX_RECENT_SEARCHES$2 = 5;
|
|
2067
2233
|
const MIN_LENGTH_SEARCH = 3;
|
|
2068
2234
|
const MAX_RESULTS = 5;
|
|
2069
2235
|
/**
|
|
@@ -2072,7 +2238,7 @@ const MAX_RESULTS = 5;
|
|
|
2072
2238
|
*
|
|
2073
2239
|
* Local storage for recent searches prevents unnecessary repetitive queries.
|
|
2074
2240
|
*/
|
|
2075
|
-
const usePlacesSearch = ({ localStorageKey = SHARED_LOCATIONS_LOCAL_STORAGE_KEY, maxRecentSearches = MAX_RECENT_SEARCHES$
|
|
2241
|
+
const usePlacesSearch = ({ localStorageKey = SHARED_LOCATIONS_LOCAL_STORAGE_KEY, maxRecentSearches = MAX_RECENT_SEARCHES$2, maxResults = MAX_RESULTS, }) => {
|
|
2076
2242
|
const [t] = useTranslation();
|
|
2077
2243
|
const [searchString, setSearchString] = react.useState("");
|
|
2078
2244
|
const [selectedPrediction, setSelectedPrediction] = react.useState(undefined);
|
|
@@ -2436,7 +2602,7 @@ const useAssetTypeFilter = ({ showTypes } = { showTypes: ALL_TYPES }) => {
|
|
|
2436
2602
|
return result;
|
|
2437
2603
|
};
|
|
2438
2604
|
|
|
2439
|
-
const FETCH_LIMIT$
|
|
2605
|
+
const FETCH_LIMIT$a = 1000;
|
|
2440
2606
|
/**
|
|
2441
2607
|
* React component for rendering the brand filter.
|
|
2442
2608
|
*
|
|
@@ -2452,7 +2618,7 @@ const BrandFilterView = (props) => {
|
|
|
2452
2618
|
const { data, loading } = client.useQuery(GetFleetBrandsSummaryDocument, {
|
|
2453
2619
|
fetchPolicy: "cache-first",
|
|
2454
2620
|
variables: {
|
|
2455
|
-
limit: FETCH_LIMIT$
|
|
2621
|
+
limit: FETCH_LIMIT$a,
|
|
2456
2622
|
search: debouncedSearch.trim(),
|
|
2457
2623
|
filters: {
|
|
2458
2624
|
...activeFilters,
|
|
@@ -2469,7 +2635,7 @@ const BrandFilterView = (props) => {
|
|
|
2469
2635
|
return result;
|
|
2470
2636
|
}, [data?.assetSummary?.brands?.summary, getMachineTypeTranslation]);
|
|
2471
2637
|
react.useEffect(() => {
|
|
2472
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
2638
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$a);
|
|
2473
2639
|
}, [options]);
|
|
2474
2640
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
2475
2641
|
};
|
|
@@ -2568,7 +2734,7 @@ const useCriticalityFilter = () => {
|
|
|
2568
2734
|
return result;
|
|
2569
2735
|
};
|
|
2570
2736
|
|
|
2571
|
-
const FETCH_LIMIT$
|
|
2737
|
+
const FETCH_LIMIT$9 = 1000;
|
|
2572
2738
|
/**
|
|
2573
2739
|
* Custom hook to fetch customer summary data based on active filters and search text.
|
|
2574
2740
|
*
|
|
@@ -2582,7 +2748,7 @@ const useCustomerData = (filterValues) => {
|
|
|
2582
2748
|
const { data, loading } = client.useQuery(GetCustomerIdSummaryDocument, {
|
|
2583
2749
|
fetchPolicy: "cache-first",
|
|
2584
2750
|
variables: {
|
|
2585
|
-
limit: FETCH_LIMIT$
|
|
2751
|
+
limit: FETCH_LIMIT$9,
|
|
2586
2752
|
search: debouncedSearch,
|
|
2587
2753
|
filters: {
|
|
2588
2754
|
...activeFilters,
|
|
@@ -2778,7 +2944,7 @@ const useFollowedFilter = () => {
|
|
|
2778
2944
|
return result;
|
|
2779
2945
|
};
|
|
2780
2946
|
|
|
2781
|
-
const FETCH_LIMIT$
|
|
2947
|
+
const FETCH_LIMIT$8 = 1000;
|
|
2782
2948
|
/**
|
|
2783
2949
|
* The GroupIdsFilterView component is a filter view for group IDs.
|
|
2784
2950
|
* It utilizes a checkbox filter with a search feature to display and manage group selections.
|
|
@@ -2794,7 +2960,7 @@ const GroupIdsFilterView = (props) => {
|
|
|
2794
2960
|
const { data, loading } = client.useQuery(GetFleetGroupSummaryDocument, {
|
|
2795
2961
|
fetchPolicy: "cache-first",
|
|
2796
2962
|
variables: {
|
|
2797
|
-
limit: FETCH_LIMIT$
|
|
2963
|
+
limit: FETCH_LIMIT$8,
|
|
2798
2964
|
search: debouncedSearch,
|
|
2799
2965
|
filters: {
|
|
2800
2966
|
...activeFilters,
|
|
@@ -2818,7 +2984,7 @@ const GroupIdsFilterView = (props) => {
|
|
|
2818
2984
|
return result;
|
|
2819
2985
|
}, [data?.assetSummary?.groups, props.hasCount]);
|
|
2820
2986
|
react.useEffect(() => {
|
|
2821
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
2987
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$8);
|
|
2822
2988
|
}, [options]);
|
|
2823
2989
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
2824
2990
|
};
|
|
@@ -3018,7 +3184,7 @@ const useMetadataCompletenessFilter = ({ isDefault } = {}) => {
|
|
|
3018
3184
|
return result;
|
|
3019
3185
|
};
|
|
3020
3186
|
|
|
3021
|
-
const FETCH_LIMIT$
|
|
3187
|
+
const FETCH_LIMIT$7 = 1000;
|
|
3022
3188
|
/**
|
|
3023
3189
|
* Renders a custom model filter component, allowing filtering of active assets by models.
|
|
3024
3190
|
* It also provides search functionality and controls for managing filtered results.
|
|
@@ -3035,7 +3201,7 @@ const ModelsFilterView = (props) => {
|
|
|
3035
3201
|
const { data, loading } = client.useQuery(GetFleetModelsSummaryDocument, {
|
|
3036
3202
|
fetchPolicy: "cache-first",
|
|
3037
3203
|
variables: {
|
|
3038
|
-
limit: FETCH_LIMIT$
|
|
3204
|
+
limit: FETCH_LIMIT$7,
|
|
3039
3205
|
search: debouncedSearch,
|
|
3040
3206
|
filters: {
|
|
3041
3207
|
...activeFilters,
|
|
@@ -3052,7 +3218,7 @@ const ModelsFilterView = (props) => {
|
|
|
3052
3218
|
return result;
|
|
3053
3219
|
}, [data?.assetSummary?.models?.summary, getMachineTypeTranslation]);
|
|
3054
3220
|
react.useEffect(() => {
|
|
3055
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
3221
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$7);
|
|
3056
3222
|
}, [options]);
|
|
3057
3223
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3058
3224
|
};
|
|
@@ -3077,7 +3243,7 @@ const useModelsFilter = () => {
|
|
|
3077
3243
|
return result;
|
|
3078
3244
|
};
|
|
3079
3245
|
|
|
3080
|
-
const FETCH_LIMIT$
|
|
3246
|
+
const FETCH_LIMIT$6 = 1000;
|
|
3081
3247
|
/**
|
|
3082
3248
|
* Component for rendering the Owner Account IDs filter view within the filter bar.
|
|
3083
3249
|
*
|
|
@@ -3092,7 +3258,7 @@ const OwnerAccountIdsFilterView = (props) => {
|
|
|
3092
3258
|
const { data, loading } = client.useQuery(GetFleetOwnerAccountSummaryDocument, {
|
|
3093
3259
|
fetchPolicy: "cache-first",
|
|
3094
3260
|
variables: {
|
|
3095
|
-
limit: FETCH_LIMIT$
|
|
3261
|
+
limit: FETCH_LIMIT$6,
|
|
3096
3262
|
search: debouncedSearch,
|
|
3097
3263
|
filters: {
|
|
3098
3264
|
...activeFilters,
|
|
@@ -3109,7 +3275,7 @@ const OwnerAccountIdsFilterView = (props) => {
|
|
|
3109
3275
|
return result;
|
|
3110
3276
|
}, [data?.assetSummary?.ownerAccounts?.summary]);
|
|
3111
3277
|
react.useEffect(() => {
|
|
3112
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
3278
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$6);
|
|
3113
3279
|
}, [options]);
|
|
3114
3280
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3115
3281
|
};
|
|
@@ -3225,7 +3391,7 @@ const usePeriodFilter = () => {
|
|
|
3225
3391
|
return result;
|
|
3226
3392
|
};
|
|
3227
3393
|
|
|
3228
|
-
const FETCH_LIMIT$
|
|
3394
|
+
const FETCH_LIMIT$5 = 1000;
|
|
3229
3395
|
/**
|
|
3230
3396
|
* Production Year Filter View component.
|
|
3231
3397
|
*
|
|
@@ -3246,7 +3412,7 @@ const ProductionYearFilterView = ({ filterDefinition, filterState, filterBarActi
|
|
|
3246
3412
|
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
3247
3413
|
const { data, loading } = client.useQuery(GetFleetProductionYearsSummaryDocument, {
|
|
3248
3414
|
variables: {
|
|
3249
|
-
limit: FETCH_LIMIT$
|
|
3415
|
+
limit: FETCH_LIMIT$5,
|
|
3250
3416
|
search: debouncedSearch,
|
|
3251
3417
|
filters: {
|
|
3252
3418
|
...activeFilters,
|
|
@@ -3263,7 +3429,7 @@ const ProductionYearFilterView = ({ filterDefinition, filterState, filterBarActi
|
|
|
3263
3429
|
return result;
|
|
3264
3430
|
}, [data?.assetSummary?.productionYears?.summary, t]);
|
|
3265
3431
|
react.useEffect(() => {
|
|
3266
|
-
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$
|
|
3432
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$5);
|
|
3267
3433
|
}, [options]);
|
|
3268
3434
|
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3269
3435
|
};
|
|
@@ -3286,6 +3452,224 @@ const useProductionYearFilter = () => {
|
|
|
3286
3452
|
return result;
|
|
3287
3453
|
};
|
|
3288
3454
|
|
|
3455
|
+
const FETCH_LIMIT$4 = 1000;
|
|
3456
|
+
/**
|
|
3457
|
+
* Rental contract order numbers filter view component.
|
|
3458
|
+
*
|
|
3459
|
+
* This component provides an interface to select rental contract order numbers.
|
|
3460
|
+
* It fetches data from a GraphQL query and integrates with the filter bar's filtering logic.
|
|
3461
|
+
*
|
|
3462
|
+
* @param {FilterViewProps<Array<string>>} props - The props for the component.
|
|
3463
|
+
* @returns {JSX.Element} The rendered component.
|
|
3464
|
+
*/
|
|
3465
|
+
const RentalContractOrderNumberFilterView = (props) => {
|
|
3466
|
+
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3467
|
+
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
3468
|
+
const [searchText, setSearchText] = react.useState("");
|
|
3469
|
+
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
3470
|
+
const { data, loading } = client.useQuery(GetFleetRentalContractOrderNumberSummaryDocument, {
|
|
3471
|
+
fetchPolicy: "cache-first",
|
|
3472
|
+
context: {
|
|
3473
|
+
headers: {
|
|
3474
|
+
"TU-PREVIEW": "dragonfruit-monty,KOREAN-BELL",
|
|
3475
|
+
},
|
|
3476
|
+
},
|
|
3477
|
+
variables: {
|
|
3478
|
+
limit: FETCH_LIMIT$4,
|
|
3479
|
+
search: debouncedSearch,
|
|
3480
|
+
filters: {
|
|
3481
|
+
...activeFilters,
|
|
3482
|
+
rentalContractOrderNumbers: null, // Omit the filters own values so list shows options correctly
|
|
3483
|
+
},
|
|
3484
|
+
},
|
|
3485
|
+
});
|
|
3486
|
+
const options = react.useMemo(() => {
|
|
3487
|
+
return (data?.assetSummary?.rentalContractOrderNumbers?.summary.map(edge => ({
|
|
3488
|
+
key: edge.key || "unknown",
|
|
3489
|
+
count: edge.count,
|
|
3490
|
+
label: edge.key || "Unknown",
|
|
3491
|
+
})) ?? []);
|
|
3492
|
+
}, [data]);
|
|
3493
|
+
react.useEffect(() => {
|
|
3494
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$4);
|
|
3495
|
+
}, [options]);
|
|
3496
|
+
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3497
|
+
};
|
|
3498
|
+
/**
|
|
3499
|
+
* Rental contract order numbers filter definition
|
|
3500
|
+
*
|
|
3501
|
+
* @returns {StringArrayFilterDefinition} Rental contract order numbers filter definition
|
|
3502
|
+
*/
|
|
3503
|
+
const useRentalContractOrderNumberFilter = ({ showInFilterBar } = {
|
|
3504
|
+
showInFilterBar: () => true,
|
|
3505
|
+
}) => {
|
|
3506
|
+
const [t] = useTranslation();
|
|
3507
|
+
const result = react.useMemo(() => {
|
|
3508
|
+
return {
|
|
3509
|
+
filterKey: "rentalContractOrderNumber",
|
|
3510
|
+
type: "stringArray",
|
|
3511
|
+
group: "CUSTOMERS",
|
|
3512
|
+
title: t("assetFilters.rentalContractOrderNumberFilter.label"),
|
|
3513
|
+
showInFilterBar,
|
|
3514
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
3515
|
+
valueAsText: values => values.map(value => value),
|
|
3516
|
+
component: props => jsxRuntime.jsx(RentalContractOrderNumberFilterView, { ...props }),
|
|
3517
|
+
};
|
|
3518
|
+
}, [showInFilterBar, t]);
|
|
3519
|
+
return result;
|
|
3520
|
+
};
|
|
3521
|
+
|
|
3522
|
+
const MAX_RECENT_SEARCHES$1 = 20;
|
|
3523
|
+
/**
|
|
3524
|
+
* Rental contract reference code description filter view component.
|
|
3525
|
+
*
|
|
3526
|
+
* This component provides an interface to select rental contract reference code descriptions.
|
|
3527
|
+
* It fetches data from a GraphQL query and integrates with the filter bar's filtering logic.
|
|
3528
|
+
*
|
|
3529
|
+
* @param {SearchFilterProps<FilterBarDefinition>} props - The props for the component.
|
|
3530
|
+
* @returns {JSX.Element} The rendered component.
|
|
3531
|
+
*/
|
|
3532
|
+
const RentalContractReferenceCodeDescriptionFilterView = ({ filterBarActions, filterState, filterDefinition, localStorageKey, }) => {
|
|
3533
|
+
const [t] = useTranslation();
|
|
3534
|
+
const filterValue = filterDefinition?.filterKey ? String(filterState.values[filterDefinition.filterKey]) : undefined;
|
|
3535
|
+
const [searchString, setSearchString] = react.useState(filterValue ?? "");
|
|
3536
|
+
const previousFilterValue = reactCoreHooks.usePrevious(filterValue);
|
|
3537
|
+
const { clientSideUserId } = reactCoreHooks.useCurrentUser();
|
|
3538
|
+
reactComponents.useDebounce(searchString, 500, "both", debouncedSearchString => {
|
|
3539
|
+
if (filterValue === debouncedSearchString) {
|
|
3540
|
+
return;
|
|
3541
|
+
}
|
|
3542
|
+
apply({ value: debouncedSearchString, setRecent: false });
|
|
3543
|
+
});
|
|
3544
|
+
react.useEffect(() => {
|
|
3545
|
+
if (filterValue === searchString || previousFilterValue === filterValue) {
|
|
3546
|
+
return;
|
|
3547
|
+
}
|
|
3548
|
+
filterValue !== undefined && setSearchString(filterValue);
|
|
3549
|
+
}, [filterValue, previousFilterValue, searchString]);
|
|
3550
|
+
const [recentSearches, setRecentSearches] = reactCoreHooks.useLocalStorage({
|
|
3551
|
+
defaultState: [],
|
|
3552
|
+
key: `${localStorageKey}-${filterDefinition?.filterKey}-free-text-filter-recent-searches-${clientSideUserId}`,
|
|
3553
|
+
schema: zod.z.array(zod.z.string()),
|
|
3554
|
+
});
|
|
3555
|
+
const apply = react.useCallback(({ value, setRecent = true }) => {
|
|
3556
|
+
if (setRecent !== false) {
|
|
3557
|
+
setRecentSearches(prev => {
|
|
3558
|
+
const noDuplicatesRecent = prev.filter(r => r !== value);
|
|
3559
|
+
const cappedLengthRecent = noDuplicatesRecent.slice(0, MAX_RECENT_SEARCHES$1 - 1);
|
|
3560
|
+
return [value, ...cappedLengthRecent];
|
|
3561
|
+
});
|
|
3562
|
+
}
|
|
3563
|
+
filterDefinition?.filterKey && filterBarActions.setStringValue(filterDefinition.filterKey, value);
|
|
3564
|
+
}, [filterDefinition?.filterKey, filterBarActions, setRecentSearches]);
|
|
3565
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(filtersFilterBar.FilterHeader, { ...filterDefinition, ...filterBarActions, filterHasChanges: filterBarActions.appliedFilterKeys().includes(filterDefinition?.filterKey ?? ""), filterKey: filterDefinition?.filterKey ?? "", searchEnabled: true, searchProps: {
|
|
3566
|
+
onEnter: () => apply({ value: searchString, setRecent: true }),
|
|
3567
|
+
onChange: setSearchString,
|
|
3568
|
+
onClear: () => setSearchString(""),
|
|
3569
|
+
value: searchString,
|
|
3570
|
+
placeholder: t("assetFilters.rentalContractReferenceCodeDescriptionFilter.searchPlaceholder"),
|
|
3571
|
+
}, title: filterDefinition?.title ?? "" }), jsxRuntime.jsx(reactFilterComponents.FilterBody, { children: recentSearches.length > 0 ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("ul", { className: "grid h-full gap-0.5", children: recentSearches.map((option, index) => (jsxRuntime.jsx(reactComponents.MenuItem, { className: "max-h-fit overflow-hidden py-1", label: option, onClick: () => {
|
|
3572
|
+
apply({ value: option, setRecent: true });
|
|
3573
|
+
setRecentSearches(prev => {
|
|
3574
|
+
const noDuplicatesRecent = prev.filter(recentSearch => recentSearch !== option);
|
|
3575
|
+
const cappedLengthRecent = noDuplicatesRecent.slice(0, MAX_RECENT_SEARCHES$1 - 1);
|
|
3576
|
+
return [option, ...cappedLengthRecent];
|
|
3577
|
+
});
|
|
3578
|
+
setSearchString(option);
|
|
3579
|
+
}, selected: option === filterValue, suffix: jsxRuntime.jsx(ClearItemButton, { onClick: e => {
|
|
3580
|
+
e.stopPropagation();
|
|
3581
|
+
setRecentSearches(prev => prev.filter(r => r !== option));
|
|
3582
|
+
} }) }, `${option}-${index}`))) }), jsxRuntime.jsx(RecentSearchesFooter, { count: recentSearches.length, onClearAll: () => setRecentSearches([]) })] })) : (jsxRuntime.jsx("p", { className: "py-2 text-center text-sm text-gray-400", children: t("filters.shared.noHistory") })) })] }));
|
|
3583
|
+
};
|
|
3584
|
+
/**
|
|
3585
|
+
* Rental contract reference code description filter definition
|
|
3586
|
+
*
|
|
3587
|
+
* @returns {StringFilterDefinition} Rental contract reference code description filter definition
|
|
3588
|
+
*/
|
|
3589
|
+
const useRentalContractReferenceCodeDescriptionFilter = ({ showInFilterBar } = {
|
|
3590
|
+
showInFilterBar: () => true,
|
|
3591
|
+
}) => {
|
|
3592
|
+
const [t] = useTranslation();
|
|
3593
|
+
const result = react.useMemo(() => {
|
|
3594
|
+
return {
|
|
3595
|
+
filterKey: "rentalContractReferenceCodeDescriptionQuery",
|
|
3596
|
+
type: "string",
|
|
3597
|
+
group: "CUSTOMERS",
|
|
3598
|
+
title: t("assetFilters.rentalContractReferenceCodeDescriptionFilter.label"),
|
|
3599
|
+
showInFilterBar,
|
|
3600
|
+
component: props => (jsxRuntime.jsx(RentalContractReferenceCodeDescriptionFilterView, { ...props, localStorageKey: "rentalContractReferenceCodeDescriptionFilter" })),
|
|
3601
|
+
};
|
|
3602
|
+
}, [showInFilterBar, t]);
|
|
3603
|
+
return result;
|
|
3604
|
+
};
|
|
3605
|
+
|
|
3606
|
+
const FETCH_LIMIT$3 = 1000;
|
|
3607
|
+
/**
|
|
3608
|
+
* Rental contract order numbers filter view component.
|
|
3609
|
+
*
|
|
3610
|
+
* This component provides an interface to select rental contract order numbers.
|
|
3611
|
+
* It fetches data from a GraphQL query and integrates with the filter bar's filtering logic.
|
|
3612
|
+
*
|
|
3613
|
+
* @param {FilterViewProps<Array<string>>} props - The props for the component.
|
|
3614
|
+
* @returns {JSX.Element} The rendered component.
|
|
3615
|
+
*/
|
|
3616
|
+
const RentalContractReferenceCodeFilterView = (props) => {
|
|
3617
|
+
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3618
|
+
const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = react.useState(false);
|
|
3619
|
+
const [searchText, setSearchText] = react.useState("");
|
|
3620
|
+
const debouncedSearch = reactComponents.useDebounce(searchText, 500);
|
|
3621
|
+
const { data, loading } = client.useQuery(GetFleetRentalContractReferenceCodesSummaryDocument, {
|
|
3622
|
+
fetchPolicy: "cache-first",
|
|
3623
|
+
context: {
|
|
3624
|
+
headers: {
|
|
3625
|
+
"TU-PREVIEW": "dragonfruit-monty,KOREAN-BELL",
|
|
3626
|
+
},
|
|
3627
|
+
},
|
|
3628
|
+
variables: {
|
|
3629
|
+
limit: FETCH_LIMIT$3,
|
|
3630
|
+
search: debouncedSearch,
|
|
3631
|
+
filters: {
|
|
3632
|
+
...activeFilters,
|
|
3633
|
+
rentalContractReferenceCodes: null, // Omit the filters own values so list shows options correctly
|
|
3634
|
+
},
|
|
3635
|
+
},
|
|
3636
|
+
});
|
|
3637
|
+
const options = react.useMemo(() => {
|
|
3638
|
+
return (data?.assetSummary?.rentalContractReferenceCodes?.summary.map(edge => ({
|
|
3639
|
+
key: edge.key || "unknown",
|
|
3640
|
+
count: edge.count,
|
|
3641
|
+
label: edge.key || "Unknown",
|
|
3642
|
+
})) ?? []);
|
|
3643
|
+
}, [data]);
|
|
3644
|
+
react.useEffect(() => {
|
|
3645
|
+
setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$3);
|
|
3646
|
+
}, [options]);
|
|
3647
|
+
return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
|
|
3648
|
+
};
|
|
3649
|
+
/**
|
|
3650
|
+
* Rental contract reference code filter definition
|
|
3651
|
+
*
|
|
3652
|
+
* @returns {StringArrayFilterDefinition} Rental contract reference code filter definition
|
|
3653
|
+
*/
|
|
3654
|
+
const useRentalContractReferenceCodeFilter = ({ showInFilterBar } = {
|
|
3655
|
+
showInFilterBar: () => true,
|
|
3656
|
+
}) => {
|
|
3657
|
+
const [t] = useTranslation();
|
|
3658
|
+
const result = react.useMemo(() => {
|
|
3659
|
+
return {
|
|
3660
|
+
filterKey: "rentalContractReferenceCode",
|
|
3661
|
+
type: "stringArray",
|
|
3662
|
+
group: "CUSTOMERS",
|
|
3663
|
+
title: t("assetFilters.rentalContractReferenceCodeFilter.label"),
|
|
3664
|
+
showInFilterBar,
|
|
3665
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
3666
|
+
valueAsText: values => values.map(value => value),
|
|
3667
|
+
component: props => jsxRuntime.jsx(RentalContractReferenceCodeFilterView, { ...props }),
|
|
3668
|
+
};
|
|
3669
|
+
}, [showInFilterBar, t]);
|
|
3670
|
+
return result;
|
|
3671
|
+
};
|
|
3672
|
+
|
|
3289
3673
|
const MAX_RECENT_SEARCHES = 20;
|
|
3290
3674
|
/**
|
|
3291
3675
|
*
|
|
@@ -4324,6 +4708,44 @@ const mockForGetPlaceDetailsQuery = (variables, data) => {
|
|
|
4324
4708
|
},
|
|
4325
4709
|
}, data || {}));
|
|
4326
4710
|
};
|
|
4711
|
+
const mockForGetFleetRentalContractOrderNumberSummaryQuery = (variables, data) => {
|
|
4712
|
+
return reactCoreContextsTest.queryFor(GetFleetRentalContractOrderNumberSummaryDocument, variables, utilities.mergeDeep({
|
|
4713
|
+
__typename: "Query",
|
|
4714
|
+
assetSummary: {
|
|
4715
|
+
__typename: "AssetSummary",
|
|
4716
|
+
rentalContractOrderNumbers: {
|
|
4717
|
+
__typename: "MetadataSummary",
|
|
4718
|
+
total: 6273236744536064,
|
|
4719
|
+
summary: [
|
|
4720
|
+
{
|
|
4721
|
+
__typename: "Summary",
|
|
4722
|
+
key: "subito",
|
|
4723
|
+
count: 6273236744536064,
|
|
4724
|
+
},
|
|
4725
|
+
],
|
|
4726
|
+
},
|
|
4727
|
+
},
|
|
4728
|
+
}, data || {}));
|
|
4729
|
+
};
|
|
4730
|
+
const mockForGetFleetRentalContractReferenceCodesSummaryQuery = (variables, data) => {
|
|
4731
|
+
return reactCoreContextsTest.queryFor(GetFleetRentalContractReferenceCodesSummaryDocument, variables, utilities.mergeDeep({
|
|
4732
|
+
__typename: "Query",
|
|
4733
|
+
assetSummary: {
|
|
4734
|
+
__typename: "AssetSummary",
|
|
4735
|
+
rentalContractReferenceCodes: {
|
|
4736
|
+
__typename: "MetadataSummary",
|
|
4737
|
+
total: 6273236744536064,
|
|
4738
|
+
summary: [
|
|
4739
|
+
{
|
|
4740
|
+
__typename: "Summary",
|
|
4741
|
+
key: "subito",
|
|
4742
|
+
count: 6273236744536064,
|
|
4743
|
+
},
|
|
4744
|
+
],
|
|
4745
|
+
},
|
|
4746
|
+
},
|
|
4747
|
+
}, data || {}));
|
|
4748
|
+
};
|
|
4327
4749
|
|
|
4328
4750
|
/**
|
|
4329
4751
|
* Default asset filter bar definition, used to define the default filters for the asset related filters.
|
|
@@ -4579,6 +5001,9 @@ exports.OwnerAccountIdsFilterView = OwnerAccountIdsFilterView;
|
|
|
4579
5001
|
exports.PartnerFilterView = PartnerFilterView;
|
|
4580
5002
|
exports.PeriodFilterView = PeriodFilterView;
|
|
4581
5003
|
exports.ProductionYearFilterView = ProductionYearFilterView;
|
|
5004
|
+
exports.RentalContractOrderNumberFilterView = RentalContractOrderNumberFilterView;
|
|
5005
|
+
exports.RentalContractReferenceCodeDescriptionFilterView = RentalContractReferenceCodeDescriptionFilterView;
|
|
5006
|
+
exports.RentalContractReferenceCodeFilterView = RentalContractReferenceCodeFilterView;
|
|
4582
5007
|
exports.SERVICE_PLAN_STATUSES_TO_SHOW = SERVICE_PLAN_STATUSES_TO_SHOW;
|
|
4583
5008
|
exports.SearchFilterInline = SearchFilterInline;
|
|
4584
5009
|
exports.ServicePanStatusesFiltersView = ServicePanStatusesFiltersView;
|
|
@@ -4606,6 +5031,8 @@ exports.mockForGetFleetGroupSummaryQuery = mockForGetFleetGroupSummaryQuery;
|
|
|
4606
5031
|
exports.mockForGetFleetModelsSummaryQuery = mockForGetFleetModelsSummaryQuery;
|
|
4607
5032
|
exports.mockForGetFleetOwnerAccountSummaryQuery = mockForGetFleetOwnerAccountSummaryQuery;
|
|
4608
5033
|
exports.mockForGetFleetProductionYearsSummaryQuery = mockForGetFleetProductionYearsSummaryQuery;
|
|
5034
|
+
exports.mockForGetFleetRentalContractOrderNumberSummaryQuery = mockForGetFleetRentalContractOrderNumberSummaryQuery;
|
|
5035
|
+
exports.mockForGetFleetRentalContractReferenceCodesSummaryQuery = mockForGetFleetRentalContractReferenceCodesSummaryQuery;
|
|
4609
5036
|
exports.mockForGetFleetServicePlanAssignmentsSummaryQuery = mockForGetFleetServicePlanAssignmentsSummaryQuery;
|
|
4610
5037
|
exports.mockForGetFleetServicePlanStatusesSummaryQuery = mockForGetFleetServicePlanStatusesSummaryQuery;
|
|
4611
5038
|
exports.mockForGetFleetServiceProvidersSummaryQuery = mockForGetFleetServiceProvidersSummaryQuery;
|
|
@@ -4640,6 +5067,9 @@ exports.usePartnerFilter = usePartnerFilter;
|
|
|
4640
5067
|
exports.usePeriodFilter = usePeriodFilter;
|
|
4641
5068
|
exports.usePlacesSearch = usePlacesSearch;
|
|
4642
5069
|
exports.useProductionYearFilter = useProductionYearFilter;
|
|
5070
|
+
exports.useRentalContractOrderNumberFilter = useRentalContractOrderNumberFilter;
|
|
5071
|
+
exports.useRentalContractReferenceCodeDescriptionFilter = useRentalContractReferenceCodeDescriptionFilter;
|
|
5072
|
+
exports.useRentalContractReferenceCodeFilter = useRentalContractReferenceCodeFilter;
|
|
4643
5073
|
exports.useSearchFilter = useSearchFilter;
|
|
4644
5074
|
exports.useServicePlanStatusFilter = useServicePlanStatusFilter;
|
|
4645
5075
|
exports.useSetAssetFilterStateFromUrl = useSetAssetFilterStateFromUrl;
|