@trackunit/filters-asset-filter-definitions 2.1.95 → 2.1.96
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 +140 -0
- package/index.esm.js +141 -2
- package/package.json +18 -18
- package/src/defaultFilters/defaults/CountryFilter/CountryFilter.d.ts +9 -0
- package/src/defaultFilters/defaults/CountryFilter/buildCountryOptions.d.ts +18 -0
- package/src/defaultFilters/defaults/CountryFilter/useCountryFilter.d.ts +7 -0
- package/src/generated/graphql-api/gql.d.ts +8 -0
- package/src/generated/graphql-api/graphql.d.ts +22 -0
- package/src/generated/graphql-api/mock.d.ts +3 -0
- package/src/hooks/useDefaultAssetFilterBarDefinition.d.ts +1 -0
- package/src/index.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -519,6 +519,77 @@ const servicePlanStatus = {
|
|
|
519
519
|
PLANNED: "PLANNED",
|
|
520
520
|
UPCOMING: "UPCOMING",
|
|
521
521
|
};
|
|
522
|
+
const GetFleetCountriesSummaryDocument = {
|
|
523
|
+
kind: "Document",
|
|
524
|
+
definitions: [
|
|
525
|
+
{
|
|
526
|
+
kind: "OperationDefinition",
|
|
527
|
+
operation: "query",
|
|
528
|
+
name: { kind: "Name", value: "GetFleetCountriesSummary" },
|
|
529
|
+
variableDefinitions: [
|
|
530
|
+
{
|
|
531
|
+
kind: "VariableDefinition",
|
|
532
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
533
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
kind: "VariableDefinition",
|
|
537
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
538
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
selectionSet: {
|
|
542
|
+
kind: "SelectionSet",
|
|
543
|
+
selections: [
|
|
544
|
+
{
|
|
545
|
+
kind: "Field",
|
|
546
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
547
|
+
arguments: [
|
|
548
|
+
{
|
|
549
|
+
kind: "Argument",
|
|
550
|
+
name: { kind: "Name", value: "filters" },
|
|
551
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
selectionSet: {
|
|
555
|
+
kind: "SelectionSet",
|
|
556
|
+
selections: [
|
|
557
|
+
{
|
|
558
|
+
kind: "Field",
|
|
559
|
+
name: { kind: "Name", value: "countries" },
|
|
560
|
+
arguments: [
|
|
561
|
+
{
|
|
562
|
+
kind: "Argument",
|
|
563
|
+
name: { kind: "Name", value: "limit" },
|
|
564
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
565
|
+
},
|
|
566
|
+
],
|
|
567
|
+
selectionSet: {
|
|
568
|
+
kind: "SelectionSet",
|
|
569
|
+
selections: [
|
|
570
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
571
|
+
{
|
|
572
|
+
kind: "Field",
|
|
573
|
+
name: { kind: "Name", value: "summary" },
|
|
574
|
+
selectionSet: {
|
|
575
|
+
kind: "SelectionSet",
|
|
576
|
+
selections: [
|
|
577
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
578
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
579
|
+
],
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
},
|
|
584
|
+
},
|
|
585
|
+
],
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
],
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
};
|
|
522
593
|
const DeviceHealthIssueCategorySummariesDocument = {
|
|
523
594
|
kind: "Document",
|
|
524
595
|
definitions: [
|
|
@@ -3122,6 +3193,71 @@ const useBrandFilter = () => {
|
|
|
3122
3193
|
return result;
|
|
3123
3194
|
};
|
|
3124
3195
|
|
|
3196
|
+
/**
|
|
3197
|
+
* Build the country filter options from the SFS country summary, translating each
|
|
3198
|
+
* code to its localized name and ordering the list alphabetically by that name.
|
|
3199
|
+
*
|
|
3200
|
+
* @param summary - The country summary entries (code + asset count) from the SFS dimension.
|
|
3201
|
+
* @param languages - Preferred display languages, typically `i18n.languages`.
|
|
3202
|
+
* @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
|
|
3203
|
+
*/
|
|
3204
|
+
const buildCountryOptions = (summary, languages) => {
|
|
3205
|
+
return summary
|
|
3206
|
+
.map(country => ({
|
|
3207
|
+
key: country.key,
|
|
3208
|
+
count: country.count,
|
|
3209
|
+
label: sharedUtils.getCountryName(country.key, languages),
|
|
3210
|
+
}))
|
|
3211
|
+
.sort((a, b) => sharedUtils.stringCompare(a.label, b.label));
|
|
3212
|
+
};
|
|
3213
|
+
|
|
3214
|
+
const COUNTRY_FETCH_LIMIT = 300;
|
|
3215
|
+
/**
|
|
3216
|
+
* React component for rendering the country filter.
|
|
3217
|
+
*
|
|
3218
|
+
* @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
|
|
3219
|
+
* @returns {ReactElement} The country filter component.
|
|
3220
|
+
*/
|
|
3221
|
+
const CountryFilter = (props) => {
|
|
3222
|
+
const [, i18n] = useTranslation();
|
|
3223
|
+
const activeFilters = filtersGraphqlHook.useActiveAssetFilters(props.filterState.values);
|
|
3224
|
+
const { data, loading } = reactGraphqlHooks.useQuery(GetFleetCountriesSummaryDocument, {
|
|
3225
|
+
fetchPolicy: "cache-first",
|
|
3226
|
+
variables: {
|
|
3227
|
+
limit: COUNTRY_FETCH_LIMIT,
|
|
3228
|
+
filters: {
|
|
3229
|
+
...activeFilters,
|
|
3230
|
+
countries: null, // Omit the filters own values so list shows options correctly
|
|
3231
|
+
},
|
|
3232
|
+
},
|
|
3233
|
+
});
|
|
3234
|
+
const options = react.useMemo(() => {
|
|
3235
|
+
return buildCountryOptions(data?.assetSummary?.countries?.summary ?? [], i18n.languages);
|
|
3236
|
+
}, [data?.assetSummary?.countries?.summary, i18n.languages]);
|
|
3237
|
+
return jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, loading: loading, options: options });
|
|
3238
|
+
};
|
|
3239
|
+
|
|
3240
|
+
/**
|
|
3241
|
+
* Get the Country filter definition
|
|
3242
|
+
*
|
|
3243
|
+
* @returns {StringArrayFilterDefinition} The Country filter definition
|
|
3244
|
+
*/
|
|
3245
|
+
const useCountryFilter = () => {
|
|
3246
|
+
const [t, i18n] = useTranslation();
|
|
3247
|
+
return react.useMemo(() => {
|
|
3248
|
+
return {
|
|
3249
|
+
filterKey: "countries",
|
|
3250
|
+
type: "stringArray",
|
|
3251
|
+
group: "CURRENT_LOCATION",
|
|
3252
|
+
title: t("fleetlist.column.country"),
|
|
3253
|
+
valueAsText(value) {
|
|
3254
|
+
return value.map(code => sharedUtils.getCountryName(code, i18n.languages));
|
|
3255
|
+
},
|
|
3256
|
+
component: props => jsxRuntime.jsx(CountryFilter, { ...props }),
|
|
3257
|
+
};
|
|
3258
|
+
}, [t, i18n.languages]);
|
|
3259
|
+
};
|
|
3260
|
+
|
|
3125
3261
|
const mapCriticalityToLabelId = (state) => {
|
|
3126
3262
|
switch (state) {
|
|
3127
3263
|
case assetCriticalityState.CRITICAL:
|
|
@@ -5818,6 +5954,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5818
5954
|
const siteIds = useSiteIdsFilter(siteEnabledProps);
|
|
5819
5955
|
const siteDepotOwnershipIds = useSiteDepotOwnershipIdsFilter();
|
|
5820
5956
|
const brands = useBrandFilter();
|
|
5957
|
+
const countries = useCountryFilter();
|
|
5821
5958
|
const models = useModelsFilter();
|
|
5822
5959
|
const types = useTypesFilter();
|
|
5823
5960
|
const activity = useActivityFilter();
|
|
@@ -5875,6 +6012,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5875
6012
|
metadataCompleteness,
|
|
5876
6013
|
siteIds,
|
|
5877
6014
|
siteType,
|
|
6015
|
+
countries,
|
|
5878
6016
|
area,
|
|
5879
6017
|
groups,
|
|
5880
6018
|
ownerAccountIds,
|
|
@@ -5909,6 +6047,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5909
6047
|
assetType,
|
|
5910
6048
|
metadataCompleteness,
|
|
5911
6049
|
brands,
|
|
6050
|
+
countries,
|
|
5912
6051
|
models,
|
|
5913
6052
|
types,
|
|
5914
6053
|
activity,
|
|
@@ -6009,6 +6148,7 @@ exports.useAreaFilter = useAreaFilter;
|
|
|
6009
6148
|
exports.useAssetIdsFilter = useAssetIdsFilter;
|
|
6010
6149
|
exports.useAssetTypeFilter = useAssetTypeFilter;
|
|
6011
6150
|
exports.useBrandFilter = useBrandFilter;
|
|
6151
|
+
exports.useCountryFilter = useCountryFilter;
|
|
6012
6152
|
exports.useCriticalityFilter = useCriticalityFilter;
|
|
6013
6153
|
exports.useCustomerIdsFilter = useCustomerIdsFilter;
|
|
6014
6154
|
exports.useDefaultAssetFilterBarDefinition = useDefaultAssetFilterBarDefinition;
|
package/index.esm.js
CHANGED
|
@@ -13,7 +13,7 @@ import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonMultiPolygonSchema, ge
|
|
|
13
13
|
import { z } from 'zod';
|
|
14
14
|
import { useLocalStorage, useDebounce, IconButton, Icon, Text, Button, usePrevious, MenuItem, useMeasure, Popover, PopoverTrigger, PopoverContent, MenuList } from '@trackunit/react-components';
|
|
15
15
|
import { titleCase, lowerCase } from 'string-ts';
|
|
16
|
-
import { objectValues, hourIntervals, enumFromValue } from '@trackunit/shared-utils';
|
|
16
|
+
import { objectValues, getCountryName, stringCompare, hourIntervals, enumFromValue } from '@trackunit/shared-utils';
|
|
17
17
|
import { useMachineTypeTranslations } from '@trackunit/translations-machine-type';
|
|
18
18
|
import { CriticalityIndicator } from '@trackunit/criticality-indicator';
|
|
19
19
|
import { useDeviceTypeTranslations } from '@trackunit/translations-device';
|
|
@@ -517,6 +517,77 @@ const servicePlanStatus = {
|
|
|
517
517
|
PLANNED: "PLANNED",
|
|
518
518
|
UPCOMING: "UPCOMING",
|
|
519
519
|
};
|
|
520
|
+
const GetFleetCountriesSummaryDocument = {
|
|
521
|
+
kind: "Document",
|
|
522
|
+
definitions: [
|
|
523
|
+
{
|
|
524
|
+
kind: "OperationDefinition",
|
|
525
|
+
operation: "query",
|
|
526
|
+
name: { kind: "Name", value: "GetFleetCountriesSummary" },
|
|
527
|
+
variableDefinitions: [
|
|
528
|
+
{
|
|
529
|
+
kind: "VariableDefinition",
|
|
530
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
531
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
kind: "VariableDefinition",
|
|
535
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
536
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
selectionSet: {
|
|
540
|
+
kind: "SelectionSet",
|
|
541
|
+
selections: [
|
|
542
|
+
{
|
|
543
|
+
kind: "Field",
|
|
544
|
+
name: { kind: "Name", value: "assetSummary" },
|
|
545
|
+
arguments: [
|
|
546
|
+
{
|
|
547
|
+
kind: "Argument",
|
|
548
|
+
name: { kind: "Name", value: "filters" },
|
|
549
|
+
value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
|
|
550
|
+
},
|
|
551
|
+
],
|
|
552
|
+
selectionSet: {
|
|
553
|
+
kind: "SelectionSet",
|
|
554
|
+
selections: [
|
|
555
|
+
{
|
|
556
|
+
kind: "Field",
|
|
557
|
+
name: { kind: "Name", value: "countries" },
|
|
558
|
+
arguments: [
|
|
559
|
+
{
|
|
560
|
+
kind: "Argument",
|
|
561
|
+
name: { kind: "Name", value: "limit" },
|
|
562
|
+
value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
|
|
563
|
+
},
|
|
564
|
+
],
|
|
565
|
+
selectionSet: {
|
|
566
|
+
kind: "SelectionSet",
|
|
567
|
+
selections: [
|
|
568
|
+
{ kind: "Field", name: { kind: "Name", value: "total" } },
|
|
569
|
+
{
|
|
570
|
+
kind: "Field",
|
|
571
|
+
name: { kind: "Name", value: "summary" },
|
|
572
|
+
selectionSet: {
|
|
573
|
+
kind: "SelectionSet",
|
|
574
|
+
selections: [
|
|
575
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
576
|
+
{ kind: "Field", name: { kind: "Name", value: "count" } },
|
|
577
|
+
],
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
],
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
],
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
],
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
};
|
|
520
591
|
const DeviceHealthIssueCategorySummariesDocument = {
|
|
521
592
|
kind: "Document",
|
|
522
593
|
definitions: [
|
|
@@ -3120,6 +3191,71 @@ const useBrandFilter = () => {
|
|
|
3120
3191
|
return result;
|
|
3121
3192
|
};
|
|
3122
3193
|
|
|
3194
|
+
/**
|
|
3195
|
+
* Build the country filter options from the SFS country summary, translating each
|
|
3196
|
+
* code to its localized name and ordering the list alphabetically by that name.
|
|
3197
|
+
*
|
|
3198
|
+
* @param summary - The country summary entries (code + asset count) from the SFS dimension.
|
|
3199
|
+
* @param languages - Preferred display languages, typically `i18n.languages`.
|
|
3200
|
+
* @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
|
|
3201
|
+
*/
|
|
3202
|
+
const buildCountryOptions = (summary, languages) => {
|
|
3203
|
+
return summary
|
|
3204
|
+
.map(country => ({
|
|
3205
|
+
key: country.key,
|
|
3206
|
+
count: country.count,
|
|
3207
|
+
label: getCountryName(country.key, languages),
|
|
3208
|
+
}))
|
|
3209
|
+
.sort((a, b) => stringCompare(a.label, b.label));
|
|
3210
|
+
};
|
|
3211
|
+
|
|
3212
|
+
const COUNTRY_FETCH_LIMIT = 300;
|
|
3213
|
+
/**
|
|
3214
|
+
* React component for rendering the country filter.
|
|
3215
|
+
*
|
|
3216
|
+
* @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
|
|
3217
|
+
* @returns {ReactElement} The country filter component.
|
|
3218
|
+
*/
|
|
3219
|
+
const CountryFilter = (props) => {
|
|
3220
|
+
const [, i18n] = useTranslation();
|
|
3221
|
+
const activeFilters = useActiveAssetFilters(props.filterState.values);
|
|
3222
|
+
const { data, loading } = useQuery(GetFleetCountriesSummaryDocument, {
|
|
3223
|
+
fetchPolicy: "cache-first",
|
|
3224
|
+
variables: {
|
|
3225
|
+
limit: COUNTRY_FETCH_LIMIT,
|
|
3226
|
+
filters: {
|
|
3227
|
+
...activeFilters,
|
|
3228
|
+
countries: null, // Omit the filters own values so list shows options correctly
|
|
3229
|
+
},
|
|
3230
|
+
},
|
|
3231
|
+
});
|
|
3232
|
+
const options = useMemo(() => {
|
|
3233
|
+
return buildCountryOptions(data?.assetSummary?.countries?.summary ?? [], i18n.languages);
|
|
3234
|
+
}, [data?.assetSummary?.countries?.summary, i18n.languages]);
|
|
3235
|
+
return jsx(DefaultCheckboxFilter, { ...props, loading: loading, options: options });
|
|
3236
|
+
};
|
|
3237
|
+
|
|
3238
|
+
/**
|
|
3239
|
+
* Get the Country filter definition
|
|
3240
|
+
*
|
|
3241
|
+
* @returns {StringArrayFilterDefinition} The Country filter definition
|
|
3242
|
+
*/
|
|
3243
|
+
const useCountryFilter = () => {
|
|
3244
|
+
const [t, i18n] = useTranslation();
|
|
3245
|
+
return useMemo(() => {
|
|
3246
|
+
return {
|
|
3247
|
+
filterKey: "countries",
|
|
3248
|
+
type: "stringArray",
|
|
3249
|
+
group: "CURRENT_LOCATION",
|
|
3250
|
+
title: t("fleetlist.column.country"),
|
|
3251
|
+
valueAsText(value) {
|
|
3252
|
+
return value.map(code => getCountryName(code, i18n.languages));
|
|
3253
|
+
},
|
|
3254
|
+
component: props => jsx(CountryFilter, { ...props }),
|
|
3255
|
+
};
|
|
3256
|
+
}, [t, i18n.languages]);
|
|
3257
|
+
};
|
|
3258
|
+
|
|
3123
3259
|
const mapCriticalityToLabelId = (state) => {
|
|
3124
3260
|
switch (state) {
|
|
3125
3261
|
case assetCriticalityState.CRITICAL:
|
|
@@ -5816,6 +5952,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5816
5952
|
const siteIds = useSiteIdsFilter(siteEnabledProps);
|
|
5817
5953
|
const siteDepotOwnershipIds = useSiteDepotOwnershipIdsFilter();
|
|
5818
5954
|
const brands = useBrandFilter();
|
|
5955
|
+
const countries = useCountryFilter();
|
|
5819
5956
|
const models = useModelsFilter();
|
|
5820
5957
|
const types = useTypesFilter();
|
|
5821
5958
|
const activity = useActivityFilter();
|
|
@@ -5873,6 +6010,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5873
6010
|
metadataCompleteness,
|
|
5874
6011
|
siteIds,
|
|
5875
6012
|
siteType,
|
|
6013
|
+
countries,
|
|
5876
6014
|
area,
|
|
5877
6015
|
groups,
|
|
5878
6016
|
ownerAccountIds,
|
|
@@ -5907,6 +6045,7 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5907
6045
|
assetType,
|
|
5908
6046
|
metadataCompleteness,
|
|
5909
6047
|
brands,
|
|
6048
|
+
countries,
|
|
5910
6049
|
models,
|
|
5911
6050
|
types,
|
|
5912
6051
|
activity,
|
|
@@ -5949,4 +6088,4 @@ const useDefaultAssetFilterBarDefinition = () => {
|
|
|
5949
6088
|
*/
|
|
5950
6089
|
setupLibraryTranslations();
|
|
5951
6090
|
|
|
5952
|
-
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
|
|
6091
|
+
export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCountryFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-asset-filter-definitions",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.96",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
"zod": "^3.25.76",
|
|
13
13
|
"string-ts": "^2.0.0",
|
|
14
14
|
"tailwind-merge": "^2.0.0",
|
|
15
|
-
"@trackunit/iris-app-build-utilities": "2.0.
|
|
16
|
-
"@trackunit/filters-filter-bar": "2.1.
|
|
17
|
-
"@trackunit/react-core-hooks": "1.17.
|
|
18
|
-
"@trackunit/react-filter-components": "2.1.
|
|
19
|
-
"@trackunit/react-form-components": "2.1.
|
|
20
|
-
"@trackunit/filters-graphql-hook": "2.1.
|
|
21
|
-
"@trackunit/utilization-indicator": "2.1.
|
|
15
|
+
"@trackunit/iris-app-build-utilities": "2.0.53",
|
|
16
|
+
"@trackunit/filters-filter-bar": "2.1.66",
|
|
17
|
+
"@trackunit/react-core-hooks": "1.17.70",
|
|
18
|
+
"@trackunit/react-filter-components": "2.1.65",
|
|
19
|
+
"@trackunit/react-form-components": "2.1.64",
|
|
20
|
+
"@trackunit/filters-graphql-hook": "2.1.88",
|
|
21
|
+
"@trackunit/utilization-indicator": "2.1.61",
|
|
22
22
|
"@trackunit/geo-json-utils": "1.14.59",
|
|
23
|
-
"@trackunit/react-components": "2.1.
|
|
24
|
-
"@trackunit/shared-utils": "1.15.
|
|
25
|
-
"@trackunit/translations-machine-type": "2.0.
|
|
26
|
-
"@trackunit/criticality-indicator": "2.1.
|
|
27
|
-
"@trackunit/iris-app-api": "2.0.
|
|
28
|
-
"@trackunit/react-core-contexts-test": "1.17.
|
|
29
|
-
"@trackunit/i18n-library-translation": "2.0.
|
|
30
|
-
"@trackunit/iris-app-runtime-core-api": "1.16.
|
|
31
|
-
"@trackunit/react-graphql-hooks": "2.1.
|
|
32
|
-
"@trackunit/translations-device": "1.1.
|
|
23
|
+
"@trackunit/react-components": "2.1.61",
|
|
24
|
+
"@trackunit/shared-utils": "1.15.58",
|
|
25
|
+
"@trackunit/translations-machine-type": "2.0.63",
|
|
26
|
+
"@trackunit/criticality-indicator": "2.1.61",
|
|
27
|
+
"@trackunit/iris-app-api": "2.0.49",
|
|
28
|
+
"@trackunit/react-core-contexts-test": "1.17.64",
|
|
29
|
+
"@trackunit/i18n-library-translation": "2.0.59",
|
|
30
|
+
"@trackunit/iris-app-runtime-core-api": "1.16.64",
|
|
31
|
+
"@trackunit/react-graphql-hooks": "2.1.61",
|
|
32
|
+
"@trackunit/translations-device": "1.1.46"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@apollo/client": "^3.13.8",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FilterViewProps } from "@trackunit/filters-filter-bar";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* React component for rendering the country filter.
|
|
5
|
+
*
|
|
6
|
+
* @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
|
|
7
|
+
* @returns {ReactElement} The country filter component.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CountryFilter: (props: FilterViewProps<Array<string>>) => ReactElement;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CountrySummaryEntry {
|
|
2
|
+
key: string;
|
|
3
|
+
count: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Build the country filter options from the SFS country summary, translating each
|
|
7
|
+
* code to its localized name and ordering the list alphabetically by that name.
|
|
8
|
+
*
|
|
9
|
+
* @param summary - The country summary entries (code + asset count) from the SFS dimension.
|
|
10
|
+
* @param languages - Preferred display languages, typically `i18n.languages`.
|
|
11
|
+
* @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
|
|
12
|
+
*/
|
|
13
|
+
export declare const buildCountryOptions: (summary: ReadonlyArray<CountrySummaryEntry>, languages: ReadonlyArray<string>) => {
|
|
14
|
+
key: string;
|
|
15
|
+
count: number;
|
|
16
|
+
label: string;
|
|
17
|
+
}[];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
+
/**
|
|
3
|
+
* Get the Country filter definition
|
|
4
|
+
*
|
|
5
|
+
* @returns {StringArrayFilterDefinition} The Country filter definition
|
|
6
|
+
*/
|
|
7
|
+
export declare const useCountryFilter: () => StringArrayFilterDefinition;
|
|
@@ -12,6 +12,10 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
12
12
|
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
|
|
13
13
|
*/
|
|
14
14
|
declare const documents: {
|
|
15
|
+
"query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetCountriesSummaryQuery, types.Exact<{
|
|
16
|
+
filters: types.InputMaybe<types.AssetFiltersInput>;
|
|
17
|
+
limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
|
|
18
|
+
}>>;
|
|
15
19
|
"query DeviceHealthIssueCategorySummaries($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n fleetHealthCategoriesSummary {\n summary {\n count\n key\n }\n total\n }\n }\n}": DocumentNode<types.DeviceHealthIssueCategorySummariesQuery, types.Exact<{
|
|
16
20
|
filters: types.InputMaybe<types.AssetFiltersInput>;
|
|
17
21
|
}>>;
|
|
@@ -51,6 +55,10 @@ declare const documents: {
|
|
|
51
55
|
* Please regenerate the types.
|
|
52
56
|
*/
|
|
53
57
|
export declare function graphql(source: string): unknown;
|
|
58
|
+
/**
|
|
59
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
60
|
+
*/
|
|
61
|
+
export declare function graphql(source: "query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
|
|
54
62
|
/**
|
|
55
63
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
56
64
|
*/
|
|
@@ -500,6 +500,8 @@ export type AssetFiltersInput = {
|
|
|
500
500
|
can1Profile?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
501
501
|
/** Filter by reported CAN profile 2 values */
|
|
502
502
|
can2Profile?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
503
|
+
/** Filter to only include this list of countries */
|
|
504
|
+
countries?: InputMaybe<Array<Scalars["String"]["input"]>>;
|
|
503
505
|
/** List of criticalities */
|
|
504
506
|
criticalities?: InputMaybe<Array<AssetCriticalityState>>;
|
|
505
507
|
/** List of custom fields to filter by */
|
|
@@ -756,6 +758,25 @@ export type RentalActiveContractFilters = {
|
|
|
756
758
|
/** Filter by rental active contract item on rent dates date range */
|
|
757
759
|
onRentDatesDateRange?: InputMaybe<DateTimeRange>;
|
|
758
760
|
};
|
|
761
|
+
export type GetFleetCountriesSummaryQueryVariables = Exact<{
|
|
762
|
+
filters: InputMaybe<AssetFiltersInput>;
|
|
763
|
+
limit: InputMaybe<Scalars["Int"]["input"]>;
|
|
764
|
+
}>;
|
|
765
|
+
export type GetFleetCountriesSummaryQuery = {
|
|
766
|
+
__typename?: "Query";
|
|
767
|
+
assetSummary: {
|
|
768
|
+
__typename?: "AssetSummary";
|
|
769
|
+
countries: {
|
|
770
|
+
__typename?: "MetadataSummary";
|
|
771
|
+
total: number;
|
|
772
|
+
summary: Array<{
|
|
773
|
+
__typename?: "Summary";
|
|
774
|
+
key: string;
|
|
775
|
+
count: number;
|
|
776
|
+
}>;
|
|
777
|
+
} | null;
|
|
778
|
+
} | null;
|
|
779
|
+
};
|
|
759
780
|
export type DeviceHealthIssueCategorySummariesQueryVariables = Exact<{
|
|
760
781
|
filters: InputMaybe<AssetFiltersInput>;
|
|
761
782
|
}>;
|
|
@@ -1479,6 +1500,7 @@ export type GetBatteryChargerStageSummaryQuery = {
|
|
|
1479
1500
|
} | null;
|
|
1480
1501
|
} | null;
|
|
1481
1502
|
};
|
|
1503
|
+
export declare const GetFleetCountriesSummaryDocument: DocumentNode<GetFleetCountriesSummaryQuery, GetFleetCountriesSummaryQueryVariables>;
|
|
1482
1504
|
export declare const DeviceHealthIssueCategorySummariesDocument: DocumentNode<DeviceHealthIssueCategorySummariesQuery, DeviceHealthIssueCategorySummariesQueryVariables>;
|
|
1483
1505
|
export declare const DeviceHealthIssueStatusSummariesDocument: DocumentNode<DeviceHealthIssueStatusSummariesQuery, DeviceHealthIssueStatusSummariesQueryVariables>;
|
|
1484
1506
|
export declare const DeviceHealthIssueTypeSummariesDocument: DocumentNode<DeviceHealthIssueTypeSummariesQuery, DeviceHealthIssueTypeSummariesQueryVariables>;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DeepPartialNullable, PickDeepPartialNullable } from "@trackunit/react-core-contexts-test";
|
|
2
2
|
import * as gql from "./graphql";
|
|
3
|
+
export declare const mockForGetFleetCountriesSummaryQuery: (variables?: DeepPartialNullable<gql.GetFleetCountriesSummaryQueryVariables>, data?: DeepPartialNullable<gql.GetFleetCountriesSummaryQuery>) => import("@apollo/client/testing").MockedResponse<gql.GetFleetCountriesSummaryQuery, Record<string, any>> & {
|
|
4
|
+
data: gql.GetFleetCountriesSummaryQuery;
|
|
5
|
+
};
|
|
3
6
|
export declare const mockForDeviceHealthIssueCategorySummariesQuery: (variables?: DeepPartialNullable<gql.DeviceHealthIssueCategorySummariesQueryVariables>, data?: DeepPartialNullable<gql.DeviceHealthIssueCategorySummariesQuery>) => import("@apollo/client/testing").MockedResponse<gql.DeviceHealthIssueCategorySummariesQuery, Record<string, any>> & {
|
|
4
7
|
data: gql.DeviceHealthIssueCategorySummariesQuery;
|
|
5
8
|
};
|
|
@@ -14,6 +14,7 @@ export declare const useDefaultAssetFilterBarDefinition: () => {
|
|
|
14
14
|
metadataCompleteness: import("@trackunit/filters-filter-bar").ValueNameFilterDefinition;
|
|
15
15
|
siteIds: import("@trackunit/filters-filter-bar").ValueNameArrayFilterDefinition;
|
|
16
16
|
siteType: import("@trackunit/filters-filter-bar").StringArrayFilterDefinition;
|
|
17
|
+
countries: import("@trackunit/filters-filter-bar").StringArrayFilterDefinition;
|
|
17
18
|
area: import("@trackunit/filters-filter-bar").AreaFilterDefinition;
|
|
18
19
|
groups: import("@trackunit/filters-filter-bar").ValueNameArrayFilterDefinition;
|
|
19
20
|
ownerAccountIds: import("@trackunit/filters-filter-bar").ValueNameArrayFilterDefinition;
|
package/src/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./defaultFilters/defaults/area/usePlacesSearch";
|
|
|
7
7
|
export * from "./defaultFilters/defaults/AssetIdsFilter";
|
|
8
8
|
export * from "./defaultFilters/defaults/AssetTypeFilter";
|
|
9
9
|
export * from "./defaultFilters/defaults/BrandFilter";
|
|
10
|
+
export * from "./defaultFilters/defaults/CountryFilter/useCountryFilter";
|
|
10
11
|
export * from "./defaultFilters/defaults/CriticalityFilter";
|
|
11
12
|
export * from "./defaultFilters/defaults/CustomerIdsFilter";
|
|
12
13
|
export * from "./defaultFilters/defaults/DeviceHealthIssueCategoryFilter/useDeviceHealthIssueCategoryFilter";
|