@trackunit/filters-asset-filter-definitions 2.32.6 → 3.0.0
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 +146 -144
- package/index.esm.js +90 -94
- package/migrations/entry.js.map +1 -0
- package/package.json +1 -1
- package/src/defaultFilters/defaults/AccessManagementModeFilter.d.ts +8 -7
- package/src/defaultFilters/defaults/ActivityFiltersView.d.ts +8 -7
- package/src/defaultFilters/defaults/CountryFilter/buildCountryOptions.d.ts +2 -4
- package/src/defaultFilters/defaults/CustomerIdsFilterView.d.ts +2 -2
- package/src/defaultFilters/defaults/InspectionTemplateAssignedFilter.d.ts +1 -1
- package/src/defaultFilters/defaults/LastInspectionResultFiltersView.d.ts +1 -1
- package/src/defaultFilters/defaults/LastPerformedInspectionFilterView.d.ts +1 -1
- package/src/defaultFilters/defaults/LastSeenFiltersView.d.ts +8 -7
- package/src/defaultFilters/defaults/MetadataCompletenessFilterView.d.ts +2 -2
- package/src/defaultFilters/defaults/NameFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/PeriodFilterView.d.ts +8 -7
- package/src/defaultFilters/defaults/RentalContractCustomerParentExternalReferenceFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/RentalContractCustomerParentNameFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/RentalContractOrderNumberFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/RentalContractReferenceCodeDescriptionFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/RentalContractReferenceCodeFilterView.d.ts +2 -1
- package/src/defaultFilters/defaults/SearchFilterInline.d.ts +2 -1
- package/src/defaultFilters/defaults/SiteStatusFilterView.d.ts +7 -6
- package/src/defaultFilters/defaults/SiteTypesFilterView.d.ts +12 -11
- package/src/defaultFilters/defaults/area/usePlacesSearch.d.ts +19 -129
- package/src/defaultFilters/defaults/test/summaryConnectionTestUtils.d.ts +16 -32
- package/src/hooks/useDefaultAssetFilterBarDefinition.d.ts +45 -43
- package/src/shared/ClearItemButton.d.ts +2 -2
- package/src/shared/FreeTextRecentSearchesFilterView.d.ts +2 -1
- package/src/shared/RecentSearchesFooter.d.ts +2 -2
- package/src/translation.d.ts +4 -7
package/index.esm.js
CHANGED
|
@@ -11,9 +11,9 @@ import { RadioGroup, RadioItem, Search } from '@trackunit/react-form-components'
|
|
|
11
11
|
import { ActivityIndicator } from '@trackunit/utilization-indicator';
|
|
12
12
|
import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonMultiPolygonSchema, geoJsonBboxSchema } from '@trackunit/geo-json-utils';
|
|
13
13
|
import { z } from 'zod';
|
|
14
|
-
import { useLocalStorage, useDebounce, IconButton, Icon, Text, Button,
|
|
14
|
+
import { useLocalStorage, useDebounce, IconButton, Icon, Text, Button, MenuItem, useMeasure, Popover, PopoverTrigger, PopoverContent, MenuContent } from '@trackunit/react-components';
|
|
15
15
|
import { titleCase, lowerCase } from 'string-ts';
|
|
16
|
-
import { objectValues, stringNaturalCompare, getCountryName, stringCompare, hourIntervals, exhaustiveCheck, enumFromValue } from '@trackunit/shared-utils';
|
|
16
|
+
import { objectValues, stringNaturalCompare, getCountryName, stringCompare, nonNullable, hourIntervals, exhaustiveCheck, enumFromValue } from '@trackunit/shared-utils';
|
|
17
17
|
import { useMachineTypeTranslations } from '@trackunit/translations-machine-type';
|
|
18
18
|
import { parse } from 'graphql';
|
|
19
19
|
import { CriticalityIndicator } from '@trackunit/criticality-indicator';
|
|
@@ -326,14 +326,13 @@ const AccessManagementModeFilterView = ({ filterDefinition, filterState, filterB
|
|
|
326
326
|
}, [data?.assetSummary?.accessManagementModeDesired?.summary, t]);
|
|
327
327
|
return (jsx(DefaultCheckboxFilter, { filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: accessManagementModes, setValue: setValue }));
|
|
328
328
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
})(AccessManagementMode || (AccessManagementMode = {}));
|
|
329
|
+
const AccessManagementMode = {
|
|
330
|
+
UNLOCKED_FOR_ALL: "UNLOCKED_FOR_ALL",
|
|
331
|
+
UNLOCKED_FOR_KEY: "UNLOCKED_FOR_KEY",
|
|
332
|
+
LOCKED_FOR_ALL: "LOCKED_FOR_ALL",
|
|
333
|
+
UNSUPPORTED: "UNSUPPORTED",
|
|
334
|
+
UNKNOWN: "UNKNOWN",
|
|
335
|
+
};
|
|
337
336
|
/**
|
|
338
337
|
Access Management Mode filter definition
|
|
339
338
|
It is a string array filter that filters assets based on their access management mode
|
|
@@ -4676,13 +4675,12 @@ const GetFleetRentalCustomerParentNameSummaryMissingDocument = {
|
|
|
4676
4675
|
],
|
|
4677
4676
|
};
|
|
4678
4677
|
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
})(AssetActivityState || (AssetActivityState = {}));
|
|
4678
|
+
const AssetActivityState = {
|
|
4679
|
+
Idling: "IDLING",
|
|
4680
|
+
Stopped: "STOPPED",
|
|
4681
|
+
Unknown: "UNKNOWN",
|
|
4682
|
+
Working: "WORKING",
|
|
4683
|
+
};
|
|
4686
4684
|
/**
|
|
4687
4685
|
* Maps the activity state to a label id
|
|
4688
4686
|
*
|
|
@@ -5022,6 +5020,8 @@ const assetTypeConst = {
|
|
|
5022
5020
|
VEHICLE: "VEHICLE",
|
|
5023
5021
|
};
|
|
5024
5022
|
const ALL_TYPES = objectValues(assetTypeConst);
|
|
5023
|
+
const isAssetType = (value) => ALL_TYPES.some(type => type === value);
|
|
5024
|
+
const mapAssetTypeToLabelId = (value) => isAssetType(value) ? `assetFilters.assetType.${value}` : "assetFilters.unknown";
|
|
5025
5025
|
/**
|
|
5026
5026
|
* A filter view component for filtering asset types.
|
|
5027
5027
|
*
|
|
@@ -5079,7 +5079,7 @@ const useAssetTypeFilter = ({ showTypes } = { showTypes: ALL_TYPES }) => {
|
|
|
5079
5079
|
type: "stringArray",
|
|
5080
5080
|
group: "METADATA",
|
|
5081
5081
|
title: t("fleetlist.column.assetType"),
|
|
5082
|
-
valueAsText: values => values.map(value => t(
|
|
5082
|
+
valueAsText: values => values.map(value => t(mapAssetTypeToLabelId(value))),
|
|
5083
5083
|
component: props => jsx(AssetTypesFilterView, { showTypes: showTypes, ...props }),
|
|
5084
5084
|
};
|
|
5085
5085
|
}, [showTypes, t]);
|
|
@@ -5721,7 +5721,7 @@ const useFacetLimitedOptions = (filterState, config) => {
|
|
|
5721
5721
|
variables: { limit: FACET_FETCH_LIMIT, search: debouncedSearch, filters: config.scope(activeFilters) },
|
|
5722
5722
|
});
|
|
5723
5723
|
const options = useMemo(() => {
|
|
5724
|
-
const items = data ? (config.read(data) ?? []) : [];
|
|
5724
|
+
const items = data !== undefined && data !== null ? (config.read(data) ?? []) : [];
|
|
5725
5725
|
const facetOptions = items.map(item => config.toOption(item));
|
|
5726
5726
|
return config.showCount === false ? facetOptions.map(option => ({ ...option, count: undefined })) : facetOptions;
|
|
5727
5727
|
}, [config, data]);
|
|
@@ -5847,7 +5847,7 @@ const useCustomerHierarchy = (customerSummary) => {
|
|
|
5847
5847
|
// Finalize and sort the hierarchy
|
|
5848
5848
|
const finalRootOptions = Array.from(rootCustomerIds)
|
|
5849
5849
|
.map(id => customerMap.get(id))
|
|
5850
|
-
.filter(
|
|
5850
|
+
.filter(nonNullable)
|
|
5851
5851
|
.sort((a, b) => a.label.localeCompare(b.label));
|
|
5852
5852
|
finalRootOptions.forEach(option => assignLevelAndSort(option, 0));
|
|
5853
5853
|
return finalRootOptions;
|
|
@@ -5862,13 +5862,15 @@ const useCustomerHierarchy = (customerSummary) => {
|
|
|
5862
5862
|
* @param props - Filter properties including data, state, and actions.
|
|
5863
5863
|
* @param props.customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
5864
5864
|
* @param props.hasCount - Whether the filter should display the count for matching items.
|
|
5865
|
-
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
5865
|
+
* @returns {ReactElement | null} A customer ID filter component for rendering in the UI, or null when the filter definition is not a valueNameArray definition.
|
|
5866
5866
|
*/
|
|
5867
5867
|
const CustomerIdsFilterView = ({ customerId, hasCount = true, ...props }) => {
|
|
5868
5868
|
const { data, loading, customSearch } = useCustomerData(props.filterState.values, customerId);
|
|
5869
5869
|
const hierarchicalOptions = useCustomerHierarchy(data?.assetSummary?.customers?.summary);
|
|
5870
|
-
|
|
5871
|
-
|
|
5870
|
+
if (props.filterDefinition.type !== "valueNameArray") {
|
|
5871
|
+
return null;
|
|
5872
|
+
}
|
|
5873
|
+
return (jsx(HierarchicalCheckboxFilter, { cascadeSelection: true, customSearch: customSearch, filterBarActions: props.filterBarActions, filterDefinition: props.filterDefinition, filterState: props.filterState, loading: loading, options: hierarchicalOptions, setValue: props.setValue, showCount: hasCount, value: props.value }));
|
|
5872
5874
|
};
|
|
5873
5875
|
/**
|
|
5874
5876
|
* Custom hook to create and configure a customer IDs filter definition.
|
|
@@ -6303,7 +6305,7 @@ const GroupIdsFilterView = (props) => {
|
|
|
6303
6305
|
read: asGroupConnectionNode,
|
|
6304
6306
|
toOption: node => ({
|
|
6305
6307
|
key: node.group?.groupId || "unknown",
|
|
6306
|
-
count: node.count
|
|
6308
|
+
count: node.count ?? 0,
|
|
6307
6309
|
label: node.group?.name || t("machine.types.Unknown"),
|
|
6308
6310
|
}),
|
|
6309
6311
|
},
|
|
@@ -6712,7 +6714,7 @@ const InspectionTemplateAssignedFilter = (props) => {
|
|
|
6712
6714
|
* Inspection template assigned filter definition. Applied to results via
|
|
6713
6715
|
* `AssetFiltersInput.inspectionTemplateAssigned` (see `useActiveAssetFilters`).
|
|
6714
6716
|
*/
|
|
6715
|
-
const useInspectionTemplateAssignedFilter = ({ isDefault } = {}) => {
|
|
6717
|
+
const useInspectionTemplateAssignedFilter = ({ isDefault, } = {}) => {
|
|
6716
6718
|
const [t] = useTranslation();
|
|
6717
6719
|
const result = useMemo(() => {
|
|
6718
6720
|
return {
|
|
@@ -6815,7 +6817,7 @@ const LastInspectionResultFiltersView = (props) => {
|
|
|
6815
6817
|
* @param root0.isDefault - When true, include in default filter bar configuration
|
|
6816
6818
|
* @returns {StringArrayFilterDefinition} Filter definition for the asset filter bar
|
|
6817
6819
|
*/
|
|
6818
|
-
const useLastInspectionResultFilter = ({ isDefault } = {}) => {
|
|
6820
|
+
const useLastInspectionResultFilter = ({ isDefault, } = {}) => {
|
|
6819
6821
|
const [t] = useTranslation();
|
|
6820
6822
|
const result = useMemo(() => {
|
|
6821
6823
|
return {
|
|
@@ -6904,7 +6906,7 @@ const LastPerformedInspectionFilterView = (props) => {
|
|
|
6904
6906
|
* `inspectionLastFilters.performed` (see `useActiveAssetFilters`); the schema exposes no
|
|
6905
6907
|
* per-time-bucket summary, so options render without counts.
|
|
6906
6908
|
*/
|
|
6907
|
-
const useLastPerformedInspectionFilter = ({ isDefault } = {}) => {
|
|
6909
|
+
const useLastPerformedInspectionFilter = ({ isDefault, } = {}) => {
|
|
6908
6910
|
const [t] = useTranslation();
|
|
6909
6911
|
const result = useMemo(() => {
|
|
6910
6912
|
return {
|
|
@@ -6921,14 +6923,13 @@ const useLastPerformedInspectionFilter = ({ isDefault } = {}) => {
|
|
|
6921
6923
|
};
|
|
6922
6924
|
|
|
6923
6925
|
/** The time the asset was last seen. */
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
})(AssetLastSeen || (AssetLastSeen = {}));
|
|
6926
|
+
const AssetLastSeen = {
|
|
6927
|
+
Last_7Days: "LAST_7_DAYS",
|
|
6928
|
+
Last_24Hours: "LAST_24_HOURS",
|
|
6929
|
+
Last_30Days: "LAST_30_DAYS",
|
|
6930
|
+
LastHour: "LAST_HOUR",
|
|
6931
|
+
OlderThan_30Days: "OLDER_THAN_30_DAYS",
|
|
6932
|
+
};
|
|
6932
6933
|
/**
|
|
6933
6934
|
* Represents the view component for the "Last Seen" filter.
|
|
6934
6935
|
*
|
|
@@ -7050,7 +7051,7 @@ const MetadataCompletenessFilterView = (props) => {
|
|
|
7050
7051
|
/**
|
|
7051
7052
|
* MetadataCompleteness filter definition
|
|
7052
7053
|
*/
|
|
7053
|
-
const useMetadataCompletenessFilter = ({ isDefault } = {}) => {
|
|
7054
|
+
const useMetadataCompletenessFilter = ({ isDefault, } = {}) => {
|
|
7054
7055
|
const [t] = useTranslation();
|
|
7055
7056
|
const result = useMemo(() => {
|
|
7056
7057
|
return {
|
|
@@ -7208,9 +7209,16 @@ const useFreeTextRecentSearches = ({ recentSearches, setRecentSearches, }) => {
|
|
|
7208
7209
|
// eslint-disable-next-line @trackunit/require-component-prop-contracts -- renders a fragment (header + body) with no DOM root to attach these props to; fix in GLU-2699
|
|
7209
7210
|
const FreeTextRecentSearchesFilterView = ({ filterBarActions, filterState, filterDefinition, localStorageKey, searchPlaceholder, }) => {
|
|
7210
7211
|
const [t] = useTranslation();
|
|
7211
|
-
const
|
|
7212
|
+
const filterKey = filterDefinition?.filterKey;
|
|
7213
|
+
const filterValue = filterKey ? String(filterState.values[filterKey]) : undefined;
|
|
7212
7214
|
const [searchString, setSearchString] = useState(filterValue ?? "");
|
|
7213
|
-
const
|
|
7215
|
+
const [syncedFilterValue, setSyncedFilterValue] = useState(filterValue);
|
|
7216
|
+
if (filterValue !== syncedFilterValue) {
|
|
7217
|
+
setSyncedFilterValue(filterValue);
|
|
7218
|
+
if (filterValue !== searchString && filterValue !== undefined) {
|
|
7219
|
+
setSearchString(filterValue);
|
|
7220
|
+
}
|
|
7221
|
+
}
|
|
7214
7222
|
const { clientSideUserId } = useCurrentUser();
|
|
7215
7223
|
useDebounce(searchString, {
|
|
7216
7224
|
delay: 500,
|
|
@@ -7221,19 +7229,11 @@ const FreeTextRecentSearchesFilterView = ({ filterBarActions, filterState, filte
|
|
|
7221
7229
|
apply({ value: debouncedSearchString, setRecent: false });
|
|
7222
7230
|
},
|
|
7223
7231
|
});
|
|
7224
|
-
useEffect(() => {
|
|
7225
|
-
if (filterValue === searchString || previousFilterValue === filterValue) {
|
|
7226
|
-
return;
|
|
7227
|
-
}
|
|
7228
|
-
if (filterValue !== undefined) {
|
|
7229
|
-
setSearchString(filterValue);
|
|
7230
|
-
}
|
|
7231
|
-
}, [filterValue, previousFilterValue, searchString]);
|
|
7232
7232
|
const localStorageProps = useMemo(() => ({
|
|
7233
7233
|
defaultState: [],
|
|
7234
|
-
key: `${localStorageKey}-${
|
|
7234
|
+
key: `${localStorageKey}-${filterKey}-free-text-filter-recent-searches-${clientSideUserId}`,
|
|
7235
7235
|
schema: z.array(z.string()),
|
|
7236
|
-
}), [localStorageKey,
|
|
7236
|
+
}), [localStorageKey, filterKey, clientSideUserId]);
|
|
7237
7237
|
const [recentSearches, setRecentSearches] = useLocalStorage(localStorageProps);
|
|
7238
7238
|
const { recentSearchesWithoutEmptyValues, rememberRecentSearch } = useFreeTextRecentSearches({
|
|
7239
7239
|
recentSearches,
|
|
@@ -7243,11 +7243,11 @@ const FreeTextRecentSearchesFilterView = ({ filterBarActions, filterState, filte
|
|
|
7243
7243
|
if (setRecent !== false) {
|
|
7244
7244
|
rememberRecentSearch(value);
|
|
7245
7245
|
}
|
|
7246
|
-
if (
|
|
7247
|
-
filterBarActions.setStringValue(
|
|
7246
|
+
if (filterKey) {
|
|
7247
|
+
filterBarActions.setStringValue(filterKey, value);
|
|
7248
7248
|
}
|
|
7249
|
-
}, [
|
|
7250
|
-
return (jsxs(Fragment, { children: [jsx(FilterHeader, { ...filterDefinition, ...filterBarActions, filterHasChanges: filterBarActions.appliedFilterKeys().includes(
|
|
7249
|
+
}, [filterKey, filterBarActions, rememberRecentSearch]);
|
|
7250
|
+
return (jsxs(Fragment, { children: [jsx(FilterHeader, { ...filterDefinition, ...filterBarActions, filterHasChanges: filterBarActions.appliedFilterKeys().includes(filterKey ?? ""), filterKey: filterKey ?? "", searchEnabled: true, searchProps: {
|
|
7251
7251
|
onEnter: () => apply({ value: searchString, setRecent: true }),
|
|
7252
7252
|
onChange: setSearchString,
|
|
7253
7253
|
onClear: () => setSearchString(""),
|
|
@@ -7369,7 +7369,7 @@ const OwnerAccountIdsFilterView = (props) => {
|
|
|
7369
7369
|
read: asOwnerAccountConnectionNode,
|
|
7370
7370
|
toOption: node => ({
|
|
7371
7371
|
key: node.ownerAccount?.accountId || "unknown",
|
|
7372
|
-
count: node.count
|
|
7372
|
+
count: node.count ?? 0,
|
|
7373
7373
|
label: node.ownerAccount?.name || t("machine.types.Unknown"),
|
|
7374
7374
|
}),
|
|
7375
7375
|
},
|
|
@@ -7426,14 +7426,13 @@ const usePartnerFilter = () => {
|
|
|
7426
7426
|
return result;
|
|
7427
7427
|
};
|
|
7428
7428
|
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
})(DayPeriod || (DayPeriod = {}));
|
|
7429
|
+
const DayPeriod = {
|
|
7430
|
+
LAST_24_HOURS: "LAST_24_HOURS",
|
|
7431
|
+
LAST_7_DAYS: "LAST_7_DAYS",
|
|
7432
|
+
LAST_30_DAYS: "LAST_30_DAYS",
|
|
7433
|
+
LIFETIME: "LIFETIME",
|
|
7434
|
+
LAST_YEAR: "LAST_YEAR",
|
|
7435
|
+
};
|
|
7437
7436
|
const dayPeriodToTranslationKey = (value) => {
|
|
7438
7437
|
switch (value) {
|
|
7439
7438
|
case DayPeriod.LAST_24_HOURS:
|
|
@@ -7832,9 +7831,17 @@ const SearchFilterInline = ({ filterBarActions, filterState, filterDefinition, l
|
|
|
7832
7831
|
const { logEvent } = useAnalytics(FilterEvents);
|
|
7833
7832
|
const [t] = useTranslation();
|
|
7834
7833
|
const { geometry, ref: searchElementRef } = useMeasure();
|
|
7835
|
-
const
|
|
7834
|
+
const filterKey = filterDefinition?.filterKey;
|
|
7835
|
+
const filterValue = filterKey ? String(filterState.values[filterKey]) : undefined;
|
|
7836
7836
|
const [searchString, setSearchString] = useState(filterValue ?? "");
|
|
7837
|
-
const
|
|
7837
|
+
const [syncedFilterValue, setSyncedFilterValue] = useState(filterValue);
|
|
7838
|
+
if (filterValue !== syncedFilterValue) {
|
|
7839
|
+
// Catch a change in filter value from outside the component and update the search string to match
|
|
7840
|
+
setSyncedFilterValue(filterValue);
|
|
7841
|
+
if (filterValue !== searchString && filterValue !== undefined) {
|
|
7842
|
+
setSearchString(filterValue);
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
7838
7845
|
const { clientSideUserId } = useCurrentUser();
|
|
7839
7846
|
useDebounce(searchString, {
|
|
7840
7847
|
delay: 500,
|
|
@@ -7845,20 +7852,11 @@ const SearchFilterInline = ({ filterBarActions, filterState, filterDefinition, l
|
|
|
7845
7852
|
apply({ value: debouncedSearchString, setRecent: false });
|
|
7846
7853
|
},
|
|
7847
7854
|
});
|
|
7848
|
-
useEffect(() => {
|
|
7849
|
-
// Catch a change in filter value from outside the component and update the search string to match
|
|
7850
|
-
if (filterValue === searchString || previousFilterValue === filterValue) {
|
|
7851
|
-
return;
|
|
7852
|
-
}
|
|
7853
|
-
if (filterValue !== undefined) {
|
|
7854
|
-
setSearchString(filterValue);
|
|
7855
|
-
}
|
|
7856
|
-
}, [filterValue, previousFilterValue, searchString]);
|
|
7857
7855
|
const localStorageProps = useMemo(() => ({
|
|
7858
7856
|
defaultState: [],
|
|
7859
|
-
key: `${localStorageKey}-${
|
|
7857
|
+
key: `${localStorageKey}-${filterKey}-free-text-filter-recent-searches-${clientSideUserId}`,
|
|
7860
7858
|
schema: searchStringSchema,
|
|
7861
|
-
}), [localStorageKey,
|
|
7859
|
+
}), [localStorageKey, filterKey, clientSideUserId]);
|
|
7862
7860
|
const [recentSearches, setRecentSearches] = useLocalStorage(localStorageProps);
|
|
7863
7861
|
const apply = useCallback(({ value, wasPreviousSearch = false, setRecent = true }) => {
|
|
7864
7862
|
if (setRecent !== false) {
|
|
@@ -7875,10 +7873,10 @@ const SearchFilterInline = ({ filterBarActions, filterState, filterDefinition, l
|
|
|
7875
7873
|
wasPreviousSearch: Boolean(wasPreviousSearch),
|
|
7876
7874
|
},
|
|
7877
7875
|
});
|
|
7878
|
-
if (
|
|
7879
|
-
filterBarActions.setStringValue(
|
|
7876
|
+
if (filterKey) {
|
|
7877
|
+
filterBarActions.setStringValue(filterKey, value);
|
|
7880
7878
|
}
|
|
7881
|
-
}, [
|
|
7879
|
+
}, [filterKey, filterBarActions, logEvent, setRecentSearches]);
|
|
7882
7880
|
return (jsxs(Popover, { activation: defaultActivation => ({ ...defaultActivation, keyboardHandlers: false }), "data-testid": dataTestId ? `${dataTestId}-popover` : undefined, placement: "bottom-start", children: [jsx(PopoverTrigger, { children: jsx("div", { className: "flex-grow", "data-testid": "filters-menu-search-field-container", children: jsx(Search
|
|
7883
7881
|
//TODO: [Buss] remove height restriction once baseinput sizes matches buttons
|
|
7884
7882
|
, {
|
|
@@ -8111,13 +8109,12 @@ const useSiteIdsFilter = (props) => {
|
|
|
8111
8109
|
};
|
|
8112
8110
|
|
|
8113
8111
|
/** The states of a site */
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
})(SiteStatus || (SiteStatus = {}));
|
|
8112
|
+
const SiteStatus = {
|
|
8113
|
+
Active: "ACTIVE",
|
|
8114
|
+
Archived: "ARCHIVED",
|
|
8115
|
+
Finished: "FINISHED",
|
|
8116
|
+
Planned: "PLANNED",
|
|
8117
|
+
};
|
|
8121
8118
|
/**
|
|
8122
8119
|
* A component that renders a checkbox filter view with site statuses.
|
|
8123
8120
|
*
|
|
@@ -8167,16 +8164,15 @@ const useSiteStatusFilter = (props) => {
|
|
|
8167
8164
|
};
|
|
8168
8165
|
|
|
8169
8166
|
/** The different types of a site for SFS */
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
})(SiteTypeSFS || (SiteTypeSFS = {}));
|
|
8167
|
+
const SiteTypeSFS = {
|
|
8168
|
+
Area: "AREA",
|
|
8169
|
+
ClassicPoi: "CLASSIC_POI",
|
|
8170
|
+
ClassicZone: "CLASSIC_ZONE",
|
|
8171
|
+
ConstructionSite: "CONSTRUCTION_SITE",
|
|
8172
|
+
Depot: "DEPOT",
|
|
8173
|
+
NotOnSite: "NOT_ON_SITE",
|
|
8174
|
+
WorkPlace: "WORK_PLACE",
|
|
8175
|
+
};
|
|
8180
8176
|
/**
|
|
8181
8177
|
* Sorts the site type summary array in the correct order
|
|
8182
8178
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/filters/asset-filter-definitions/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
-
export declare
|
|
3
|
-
UNLOCKED_FOR_ALL
|
|
4
|
-
UNLOCKED_FOR_KEY
|
|
5
|
-
LOCKED_FOR_ALL
|
|
6
|
-
UNSUPPORTED
|
|
7
|
-
UNKNOWN
|
|
8
|
-
}
|
|
2
|
+
export declare const AccessManagementMode: {
|
|
3
|
+
readonly UNLOCKED_FOR_ALL: "UNLOCKED_FOR_ALL";
|
|
4
|
+
readonly UNLOCKED_FOR_KEY: "UNLOCKED_FOR_KEY";
|
|
5
|
+
readonly LOCKED_FOR_ALL: "LOCKED_FOR_ALL";
|
|
6
|
+
readonly UNSUPPORTED: "UNSUPPORTED";
|
|
7
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
8
|
+
};
|
|
9
|
+
export type AccessManagementModeValue = (typeof AccessManagementMode)[keyof typeof AccessManagementMode];
|
|
9
10
|
/**
|
|
10
11
|
Access Management Mode filter definition
|
|
11
12
|
It is a string array filter that filters assets based on their access management mode
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
|
-
export declare
|
|
4
|
-
Idling
|
|
5
|
-
Stopped
|
|
6
|
-
Unknown
|
|
7
|
-
Working
|
|
8
|
-
}
|
|
3
|
+
export declare const AssetActivityState: {
|
|
4
|
+
readonly Idling: "IDLING";
|
|
5
|
+
readonly Stopped: "STOPPED";
|
|
6
|
+
readonly Unknown: "UNKNOWN";
|
|
7
|
+
readonly Working: "WORKING";
|
|
8
|
+
};
|
|
9
|
+
export type AssetActivityStateValue = (typeof AssetActivityState)[keyof typeof AssetActivityState];
|
|
9
10
|
/**
|
|
10
11
|
* Maps the activity state to a label id
|
|
11
12
|
*
|
|
12
13
|
* @param state Activity state
|
|
13
14
|
* @returns {string} Label id
|
|
14
15
|
*/
|
|
15
|
-
export declare const mapActivityToLabelId: (state:
|
|
16
|
+
export declare const mapActivityToLabelId: (state: string) => "assetFilters.activityFilter.working" | "assetFilters.activityFilter.idling" | "assetFilters.activityFilter.stopped" | "assetFilters.activityFilter.unknown";
|
|
16
17
|
/**
|
|
17
18
|
* Renders the Activity Filters view with the provided filter properties.
|
|
18
19
|
*
|
|
@@ -10,9 +10,7 @@ interface CountrySummaryEntry {
|
|
|
10
10
|
* @param languages - Preferred display languages, typically `i18n.languages`.
|
|
11
11
|
* @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
|
|
12
12
|
*/
|
|
13
|
-
export declare const buildCountryOptions: (summary: ReadonlyArray<CountrySummaryEntry>, languages: ReadonlyArray<string>) => {
|
|
14
|
-
key: string;
|
|
15
|
-
count: number;
|
|
13
|
+
export declare const buildCountryOptions: (summary: ReadonlyArray<CountrySummaryEntry>, languages: ReadonlyArray<string>) => Array<CountrySummaryEntry & {
|
|
16
14
|
label: string;
|
|
17
|
-
}
|
|
15
|
+
}>;
|
|
18
16
|
export {};
|
|
@@ -8,11 +8,11 @@ import { ReactElement } from "react";
|
|
|
8
8
|
* @param props - Filter properties including data, state, and actions.
|
|
9
9
|
* @param props.customerId - The ID of the customer that owns the customers shown in the filter bar.
|
|
10
10
|
* @param props.hasCount - Whether the filter should display the count for matching items.
|
|
11
|
-
* @returns {ReactElement} A customer ID filter component for rendering in the UI.
|
|
11
|
+
* @returns {ReactElement | null} A customer ID filter component for rendering in the UI, or null when the filter definition is not a valueNameArray definition.
|
|
12
12
|
*/
|
|
13
13
|
export declare const CustomerIdsFilterView: ({ customerId, hasCount, ...props }: {
|
|
14
14
|
customerId?: string;
|
|
15
|
-
} & FilterViewProps<Array<ValueName>>) => ReactElement;
|
|
15
|
+
} & FilterViewProps<Array<ValueName>>) => ReactElement | null;
|
|
16
16
|
interface CustomerIdsFilterProps {
|
|
17
17
|
showInFilterBar?: () => boolean;
|
|
18
18
|
defaultValue?: Array<ValueName>;
|
|
@@ -18,5 +18,5 @@ interface UseInspectionTemplateAssignedFilterProps {
|
|
|
18
18
|
* Inspection template assigned filter definition. Applied to results via
|
|
19
19
|
* `AssetFiltersInput.inspectionTemplateAssigned` (see `useActiveAssetFilters`).
|
|
20
20
|
*/
|
|
21
|
-
export declare const useInspectionTemplateAssignedFilter: ({ isDefault }?: UseInspectionTemplateAssignedFilterProps) => ValueNameFilterDefinition;
|
|
21
|
+
export declare const useInspectionTemplateAssignedFilter: ({ isDefault, }?: UseInspectionTemplateAssignedFilterProps) => ValueNameFilterDefinition;
|
|
22
22
|
export {};
|
|
@@ -20,5 +20,5 @@ interface UseLastInspectionResultFilterProps {
|
|
|
20
20
|
* @param root0.isDefault - When true, include in default filter bar configuration
|
|
21
21
|
* @returns {StringArrayFilterDefinition} Filter definition for the asset filter bar
|
|
22
22
|
*/
|
|
23
|
-
export declare const useLastInspectionResultFilter: ({ isDefault }?: UseLastInspectionResultFilterProps) => StringArrayFilterDefinition;
|
|
23
|
+
export declare const useLastInspectionResultFilter: ({ isDefault, }?: UseLastInspectionResultFilterProps) => StringArrayFilterDefinition;
|
|
24
24
|
export {};
|
|
@@ -19,5 +19,5 @@ interface UseLastPerformedInspectionFilterProps {
|
|
|
19
19
|
* `inspectionLastFilters.performed` (see `useActiveAssetFilters`); the schema exposes no
|
|
20
20
|
* per-time-bucket summary, so options render without counts.
|
|
21
21
|
*/
|
|
22
|
-
export declare const useLastPerformedInspectionFilter: ({ isDefault }?: UseLastPerformedInspectionFilterProps) => ValueNameFilterDefinition;
|
|
22
|
+
export declare const useLastPerformedInspectionFilter: ({ isDefault, }?: UseLastPerformedInspectionFilterProps) => ValueNameFilterDefinition;
|
|
23
23
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { FilterViewProps, StringFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
3
|
/** The time the asset was last seen. */
|
|
4
|
-
export declare
|
|
5
|
-
Last_7Days
|
|
6
|
-
Last_24Hours
|
|
7
|
-
Last_30Days
|
|
8
|
-
LastHour
|
|
9
|
-
OlderThan_30Days
|
|
10
|
-
}
|
|
4
|
+
export declare const AssetLastSeen: {
|
|
5
|
+
readonly Last_7Days: "LAST_7_DAYS";
|
|
6
|
+
readonly Last_24Hours: "LAST_24_HOURS";
|
|
7
|
+
readonly Last_30Days: "LAST_30_DAYS";
|
|
8
|
+
readonly LastHour: "LAST_HOUR";
|
|
9
|
+
readonly OlderThan_30Days: "OLDER_THAN_30_DAYS";
|
|
10
|
+
};
|
|
11
|
+
export type AssetLastSeenValue = (typeof AssetLastSeen)[keyof typeof AssetLastSeen];
|
|
11
12
|
/**
|
|
12
13
|
* Represents the view component for the "Last Seen" filter.
|
|
13
14
|
*
|
|
@@ -13,7 +13,7 @@ export declare const metadataCompletenessOptions: Array<MetadataCompleteness>;
|
|
|
13
13
|
* @param type Asset type
|
|
14
14
|
* @returns {string} Label id
|
|
15
15
|
*/
|
|
16
|
-
export declare const mapMetadataCompletenessToLabelId: (type: MetadataCompleteness) => "assetFilters.metadataCompleteness.
|
|
16
|
+
export declare const mapMetadataCompletenessToLabelId: (type: MetadataCompleteness) => "assetFilters.metadataCompleteness.COMPLETE" | "assetFilters.metadataCompleteness.PARTIAL" | "assetFilters.metadataCompleteness.ALL" | "assetFilters.unknown";
|
|
17
17
|
/**
|
|
18
18
|
* The `MetadataCompletenessFilterView` component provides a filter
|
|
19
19
|
* for selecting metadata completeness levels.
|
|
@@ -28,5 +28,5 @@ interface UseMetadataCompletenessFilterProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* MetadataCompleteness filter definition
|
|
30
30
|
*/
|
|
31
|
-
export declare const useMetadataCompletenessFilter: ({ isDefault }?: UseMetadataCompletenessFilterProps) => ValueNameFilterDefinition;
|
|
31
|
+
export declare const useMetadataCompletenessFilter: ({ isDefault, }?: UseMetadataCompletenessFilterProps) => ValueNameFilterDefinition;
|
|
32
32
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FilterBarDefinition, StringFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
import { SearchFilterProps } from "./SearchFilterInline";
|
|
3
4
|
/**
|
|
4
5
|
* Asset name filter view component.
|
|
@@ -6,7 +7,7 @@ import { SearchFilterProps } from "./SearchFilterInline";
|
|
|
6
7
|
* @param {SearchFilterProps<FilterBarDefinition>} props - The props for the component.
|
|
7
8
|
* @returns {Element} The rendered component.
|
|
8
9
|
*/
|
|
9
|
-
export declare const NameFilterView: <TFilterState extends FilterBarDefinition>(props: SearchFilterProps<TFilterState>) =>
|
|
10
|
+
export declare const NameFilterView: <TFilterState extends FilterBarDefinition>(props: SearchFilterProps<TFilterState>) => ReactElement;
|
|
10
11
|
interface FilterProps {
|
|
11
12
|
showInFilterBar?: () => boolean;
|
|
12
13
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FilterViewProps, StringFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
2
|
import { ReactElement } from "react";
|
|
3
|
-
export declare
|
|
4
|
-
LAST_24_HOURS
|
|
5
|
-
LAST_7_DAYS
|
|
6
|
-
LAST_30_DAYS
|
|
7
|
-
LIFETIME
|
|
8
|
-
LAST_YEAR
|
|
9
|
-
}
|
|
3
|
+
export declare const DayPeriod: {
|
|
4
|
+
readonly LAST_24_HOURS: "LAST_24_HOURS";
|
|
5
|
+
readonly LAST_7_DAYS: "LAST_7_DAYS";
|
|
6
|
+
readonly LAST_30_DAYS: "LAST_30_DAYS";
|
|
7
|
+
readonly LIFETIME: "LIFETIME";
|
|
8
|
+
readonly LAST_YEAR: "LAST_YEAR";
|
|
9
|
+
};
|
|
10
|
+
export type DayPeriodValue = (typeof DayPeriod)[keyof typeof DayPeriod];
|
|
10
11
|
/**
|
|
11
12
|
* Renders the Period Filter component, which allows users to select a time period for filtering data.
|
|
12
13
|
*
|
package/src/defaultFilters/defaults/RentalContractCustomerParentExternalReferenceFilterView.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Rental contract customer parent external reference filter view component.
|
|
4
5
|
*/
|
|
5
|
-
export declare const RentalContractCustomerParentExternalReferenceFilterView: (props: FilterViewProps<Array<string>>) =>
|
|
6
|
+
export declare const RentalContractCustomerParentExternalReferenceFilterView: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
6
7
|
interface FilterProps {
|
|
7
8
|
showInFilterBar?: () => boolean;
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Rental contract customer parent name filter view component.
|
|
4
5
|
*/
|
|
5
|
-
export declare const RentalContractCustomerParentNameFilterView: (props: FilterViewProps<Array<string>>) =>
|
|
6
|
+
export declare const RentalContractCustomerParentNameFilterView: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
6
7
|
interface FilterProps {
|
|
7
8
|
showInFilterBar?: () => boolean;
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Rental contract order numbers filter view component.
|
|
4
5
|
*/
|
|
5
|
-
export declare const RentalContractOrderNumberFilterView: (props: FilterViewProps<Array<string>>) =>
|
|
6
|
+
export declare const RentalContractOrderNumberFilterView: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
6
7
|
interface FilterProps {
|
|
7
8
|
showInFilterBar?: () => boolean;
|
|
8
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FilterBarDefinition, StringFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
import { SearchFilterProps } from "./SearchFilterInline";
|
|
3
4
|
/**
|
|
4
5
|
* Rental contract reference code description filter view component.
|
|
@@ -6,7 +7,7 @@ import { SearchFilterProps } from "./SearchFilterInline";
|
|
|
6
7
|
* @param {SearchFilterProps<FilterBarDefinition>} props - The props for the component.
|
|
7
8
|
* @returns {Element} The rendered component.
|
|
8
9
|
*/
|
|
9
|
-
export declare const RentalContractReferenceCodeDescriptionFilterView: <TFilterState extends FilterBarDefinition>(props: SearchFilterProps<TFilterState>) =>
|
|
10
|
+
export declare const RentalContractReferenceCodeDescriptionFilterView: <TFilterState extends FilterBarDefinition>(props: SearchFilterProps<TFilterState>) => ReactElement;
|
|
10
11
|
interface FilterProps {
|
|
11
12
|
showInFilterBar?: () => boolean;
|
|
12
13
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FilterViewProps, StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Rental contract reference code filter view component.
|
|
4
5
|
*/
|
|
5
|
-
export declare const RentalContractReferenceCodeFilterView: (props: FilterViewProps<Array<string>>) =>
|
|
6
|
+
export declare const RentalContractReferenceCodeFilterView: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
6
7
|
interface FilterProps {
|
|
7
8
|
showInFilterBar?: () => boolean;
|
|
8
9
|
}
|