@trackunit/filters-asset-filter-definitions 1.3.86 → 1.3.89

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.
Files changed (3) hide show
  1. package/index.cjs.js +32 -9
  2. package/index.esm.js +32 -9
  3. package/package.json +16 -16
package/index.cjs.js CHANGED
@@ -2419,9 +2419,11 @@ const BrandFilterView = (props) => {
2419
2419
  count: brand.count,
2420
2420
  label: getMachineTypeTranslation(brand.key),
2421
2421
  })) ?? [];
2422
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$8);
2423
2422
  return result;
2424
2423
  }, [data?.assetSummary?.brands?.summary, getMachineTypeTranslation]);
2424
+ react.useEffect(() => {
2425
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$8);
2426
+ }, [options]);
2425
2427
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2426
2428
  };
2427
2429
  /**
@@ -2544,9 +2546,11 @@ const CustomerIdsFilterView = (props) => {
2544
2546
  count: customerEdge.count || 0,
2545
2547
  label: customerEdge.customer?.name || "Unknown",
2546
2548
  })) ?? [];
2547
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$7);
2548
2549
  return result;
2549
2550
  }, [data?.assetSummary?.customers?.summary]);
2551
+ react.useEffect(() => {
2552
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$7);
2553
+ }, [options]);
2550
2554
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2551
2555
  };
2552
2556
  /**
@@ -2634,7 +2638,6 @@ const GroupIdsFilterView = (props) => {
2634
2638
  count: edge.count || 0,
2635
2639
  label: edge.group?.name || "Unknown",
2636
2640
  })) ?? [];
2637
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$6);
2638
2641
  if (data?.assetSummary?.groups?.missing && data.assetSummary.groups.missing > 0) {
2639
2642
  result.push({
2640
2643
  key: "UNDEFINED",
@@ -2644,6 +2647,9 @@ const GroupIdsFilterView = (props) => {
2644
2647
  }
2645
2648
  return result;
2646
2649
  }, [data?.assetSummary?.groups]);
2650
+ react.useEffect(() => {
2651
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$6);
2652
+ }, [options]);
2647
2653
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2648
2654
  };
2649
2655
  /**
@@ -2850,9 +2856,11 @@ const ModelsFilterView = (props) => {
2850
2856
  count: model.count,
2851
2857
  label: getMachineTypeTranslation(model.key),
2852
2858
  })) ?? [];
2853
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$5);
2854
2859
  return result;
2855
2860
  }, [data?.assetSummary?.models?.summary, getMachineTypeTranslation]);
2861
+ react.useEffect(() => {
2862
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$5);
2863
+ }, [options]);
2856
2864
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2857
2865
  };
2858
2866
  /**
@@ -2900,9 +2908,11 @@ const OwnerAccountIdsFilterView = (props) => {
2900
2908
  count: edge.count || 0,
2901
2909
  label: edge.ownerAccount?.name || "Unknown",
2902
2910
  })) ?? [];
2903
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$4);
2904
2911
  return result;
2905
2912
  }, [data?.assetSummary?.ownerAccounts?.summary]);
2913
+ react.useEffect(() => {
2914
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$4);
2915
+ }, [options]);
2906
2916
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2907
2917
  };
2908
2918
  /**
@@ -2998,9 +3008,11 @@ const ProductionYearFilterView = ({ filterDefinition, filterState, filterBarActi
2998
3008
  ...productionYear,
2999
3009
  label: productionYear.key.toUpperCase() === "UNDEFINED" ? t(`machine.types.Unknown`) : productionYear.key,
3000
3010
  })) ?? [];
3001
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$3);
3002
3011
  return result;
3003
3012
  }, [data?.assetSummary?.productionYears?.summary, t]);
3013
+ react.useEffect(() => {
3014
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$3);
3015
+ }, [options]);
3004
3016
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3005
3017
  };
3006
3018
  /**
@@ -3239,9 +3251,11 @@ const SiteIdsFilterView = (props) => {
3239
3251
  count: siteEdge.count || 0,
3240
3252
  label: siteEdge.site?.name || "Unknown",
3241
3253
  })) ?? [];
3242
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$2);
3243
3254
  return result;
3244
3255
  }, [data?.assetSummary?.sites?.summary]);
3256
+ react.useEffect(() => {
3257
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$2);
3258
+ }, [options]);
3245
3259
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3246
3260
  };
3247
3261
  /**
@@ -3518,9 +3532,11 @@ const TypesFilterView = (props) => {
3518
3532
  count: type.count,
3519
3533
  label: getMachineTypeTranslation(type.key),
3520
3534
  })) ?? [];
3521
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$1);
3522
3535
  return result;
3523
3536
  }, [data?.assetSummary?.types?.summary, getMachineTypeTranslation]);
3537
+ react.useEffect(() => {
3538
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$1);
3539
+ }, [options]);
3524
3540
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3525
3541
  };
3526
3542
  /**
@@ -4020,9 +4036,11 @@ const SiteDepotOwnershipIdsFilterView = (props) => {
4020
4036
  ? t("siteOwningDepot.notOwned")
4021
4037
  : owningDepotEdge.site?.name || t("siteOwningDepot.unknown"),
4022
4038
  })) ?? [];
4023
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT);
4024
4039
  return result;
4025
4040
  }, [data?.assetSummary?.owningDepots?.summary, t]);
4041
+ react.useEffect(() => {
4042
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT);
4043
+ }, [options]);
4026
4044
  return (jsxRuntime.jsx(filtersFilterBar.DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
4027
4045
  };
4028
4046
  /**
@@ -4221,6 +4239,11 @@ const useSetAssetFilterStateFromUrl = ({ setters }) => {
4221
4239
  setter(() => resolvedValue);
4222
4240
  }
4223
4241
  });
4242
+ //If all filters are undefined, we are done setting filters
4243
+ if (filterMappings.every(({ value }) => !value)) {
4244
+ setIsDoneSettingFilters(true);
4245
+ }
4246
+ //If any filter is defined, we need to navigate to the url with the filters
4224
4247
  if (filterMappings.some(({ value }) => value)) {
4225
4248
  navigate({
4226
4249
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/index.esm.js CHANGED
@@ -2417,9 +2417,11 @@ const BrandFilterView = (props) => {
2417
2417
  count: brand.count,
2418
2418
  label: getMachineTypeTranslation(brand.key),
2419
2419
  })) ?? [];
2420
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$8);
2421
2420
  return result;
2422
2421
  }, [data?.assetSummary?.brands?.summary, getMachineTypeTranslation]);
2422
+ useEffect(() => {
2423
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$8);
2424
+ }, [options]);
2423
2425
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2424
2426
  };
2425
2427
  /**
@@ -2542,9 +2544,11 @@ const CustomerIdsFilterView = (props) => {
2542
2544
  count: customerEdge.count || 0,
2543
2545
  label: customerEdge.customer?.name || "Unknown",
2544
2546
  })) ?? [];
2545
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$7);
2546
2547
  return result;
2547
2548
  }, [data?.assetSummary?.customers?.summary]);
2549
+ useEffect(() => {
2550
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$7);
2551
+ }, [options]);
2548
2552
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2549
2553
  };
2550
2554
  /**
@@ -2632,7 +2636,6 @@ const GroupIdsFilterView = (props) => {
2632
2636
  count: edge.count || 0,
2633
2637
  label: edge.group?.name || "Unknown",
2634
2638
  })) ?? [];
2635
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$6);
2636
2639
  if (data?.assetSummary?.groups?.missing && data.assetSummary.groups.missing > 0) {
2637
2640
  result.push({
2638
2641
  key: "UNDEFINED",
@@ -2642,6 +2645,9 @@ const GroupIdsFilterView = (props) => {
2642
2645
  }
2643
2646
  return result;
2644
2647
  }, [data?.assetSummary?.groups]);
2648
+ useEffect(() => {
2649
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$6);
2650
+ }, [options]);
2645
2651
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2646
2652
  };
2647
2653
  /**
@@ -2848,9 +2854,11 @@ const ModelsFilterView = (props) => {
2848
2854
  count: model.count,
2849
2855
  label: getMachineTypeTranslation(model.key),
2850
2856
  })) ?? [];
2851
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$5);
2852
2857
  return result;
2853
2858
  }, [data?.assetSummary?.models?.summary, getMachineTypeTranslation]);
2859
+ useEffect(() => {
2860
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$5);
2861
+ }, [options]);
2854
2862
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2855
2863
  };
2856
2864
  /**
@@ -2898,9 +2906,11 @@ const OwnerAccountIdsFilterView = (props) => {
2898
2906
  count: edge.count || 0,
2899
2907
  label: edge.ownerAccount?.name || "Unknown",
2900
2908
  })) ?? [];
2901
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$4);
2902
2909
  return result;
2903
2910
  }, [data?.assetSummary?.ownerAccounts?.summary]);
2911
+ useEffect(() => {
2912
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$4);
2913
+ }, [options]);
2904
2914
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
2905
2915
  };
2906
2916
  /**
@@ -2996,9 +3006,11 @@ const ProductionYearFilterView = ({ filterDefinition, filterState, filterBarActi
2996
3006
  ...productionYear,
2997
3007
  label: productionYear.key.toUpperCase() === "UNDEFINED" ? t(`machine.types.Unknown`) : productionYear.key,
2998
3008
  })) ?? [];
2999
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$3);
3000
3009
  return result;
3001
3010
  }, [data?.assetSummary?.productionYears?.summary, t]);
3011
+ useEffect(() => {
3012
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$3);
3013
+ }, [options]);
3002
3014
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3003
3015
  };
3004
3016
  /**
@@ -3237,9 +3249,11 @@ const SiteIdsFilterView = (props) => {
3237
3249
  count: siteEdge.count || 0,
3238
3250
  label: siteEdge.site?.name || "Unknown",
3239
3251
  })) ?? [];
3240
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$2);
3241
3252
  return result;
3242
3253
  }, [data?.assetSummary?.sites?.summary]);
3254
+ useEffect(() => {
3255
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$2);
3256
+ }, [options]);
3243
3257
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3244
3258
  };
3245
3259
  /**
@@ -3516,9 +3530,11 @@ const TypesFilterView = (props) => {
3516
3530
  count: type.count,
3517
3531
  label: getMachineTypeTranslation(type.key),
3518
3532
  })) ?? [];
3519
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT$1);
3520
3533
  return result;
3521
3534
  }, [data?.assetSummary?.types?.summary, getMachineTypeTranslation]);
3535
+ useEffect(() => {
3536
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$1);
3537
+ }, [options]);
3522
3538
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3523
3539
  };
3524
3540
  /**
@@ -4018,9 +4034,11 @@ const SiteDepotOwnershipIdsFilterView = (props) => {
4018
4034
  ? t("siteOwningDepot.notOwned")
4019
4035
  : owningDepotEdge.site?.name || t("siteOwningDepot.unknown"),
4020
4036
  })) ?? [];
4021
- setShowRequestMoreUseSearch(result.length === FETCH_LIMIT);
4022
4037
  return result;
4023
4038
  }, [data?.assetSummary?.owningDepots?.summary, t]);
4039
+ useEffect(() => {
4040
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT);
4041
+ }, [options]);
4024
4042
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
4025
4043
  };
4026
4044
  /**
@@ -4219,6 +4237,11 @@ const useSetAssetFilterStateFromUrl = ({ setters }) => {
4219
4237
  setter(() => resolvedValue);
4220
4238
  }
4221
4239
  });
4240
+ //If all filters are undefined, we are done setting filters
4241
+ if (filterMappings.every(({ value }) => !value)) {
4242
+ setIsDoneSettingFilters(true);
4243
+ }
4244
+ //If any filter is defined, we need to navigate to the url with the filters
4222
4245
  if (filterMappings.some(({ value }) => value)) {
4223
4246
  navigate({
4224
4247
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-asset-filter-definitions",
3
- "version": "1.3.86",
3
+ "version": "1.3.89",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -17,21 +17,21 @@
17
17
  "@tanstack/react-router": "1.47.1",
18
18
  "string-ts": "^2.0.0",
19
19
  "tailwind-merge": "^2.0.0",
20
- "@trackunit/iris-app-build-utilities": "1.3.48",
21
- "@trackunit/filters-filter-bar": "1.3.78",
22
- "@trackunit/react-core-hooks": "1.3.48",
23
- "@trackunit/react-filter-components": "1.3.64",
24
- "@trackunit/react-form-components": "1.3.64",
25
- "@trackunit/filters-graphql-hook": "1.3.78",
26
- "@trackunit/utilization-indicator": "1.3.59",
27
- "@trackunit/geo-json-utils": "1.3.47",
28
- "@trackunit/react-components": "1.4.56",
29
- "@trackunit/shared-utils": "1.5.46",
30
- "@trackunit/translations-machine-type": "1.3.51",
31
- "@trackunit/criticality-indicator": "1.3.59",
32
- "@trackunit/iris-app-api": "1.3.48",
33
- "@trackunit/react-core-contexts-test": "1.3.48",
34
- "@trackunit/i18n-library-translation": "1.3.50"
20
+ "@trackunit/iris-app-build-utilities": "1.3.49",
21
+ "@trackunit/filters-filter-bar": "1.3.81",
22
+ "@trackunit/react-core-hooks": "1.3.50",
23
+ "@trackunit/react-filter-components": "1.3.66",
24
+ "@trackunit/react-form-components": "1.3.66",
25
+ "@trackunit/filters-graphql-hook": "1.3.81",
26
+ "@trackunit/utilization-indicator": "1.3.61",
27
+ "@trackunit/geo-json-utils": "1.3.48",
28
+ "@trackunit/react-components": "1.4.57",
29
+ "@trackunit/shared-utils": "1.5.47",
30
+ "@trackunit/translations-machine-type": "1.3.53",
31
+ "@trackunit/criticality-indicator": "1.3.61",
32
+ "@trackunit/iris-app-api": "1.3.49",
33
+ "@trackunit/react-core-contexts-test": "1.3.50",
34
+ "@trackunit/i18n-library-translation": "1.3.52"
35
35
  },
36
36
  "module": "./index.esm.js",
37
37
  "main": "./index.cjs.js",