@trackunit/filters-asset-filter-definitions 0.0.600 → 0.0.602
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js
CHANGED
|
@@ -1710,10 +1710,14 @@ const RecentSearchesFooter = ({ count, onClearAll }) => {
|
|
|
1710
1710
|
};
|
|
1711
1711
|
|
|
1712
1712
|
const LOCAL_STORAGE_KEY = "area-filter-recent-searches";
|
|
1713
|
-
const
|
|
1713
|
+
const areaFilterInternalGeoJsonGeometrySchema = zod.z.union([
|
|
1714
|
+
geoJsonUtils.geoJsonPolygonSchema,
|
|
1715
|
+
geoJsonUtils.geoJsonPointSchema,
|
|
1716
|
+
geoJsonUtils.geoJsonMultiPolygonSchema,
|
|
1717
|
+
]);
|
|
1714
1718
|
const areaFilterInternalSchema = zod.z.object({
|
|
1715
1719
|
bBox: geoJsonUtils.geoJsonBboxSchema,
|
|
1716
|
-
geometry:
|
|
1720
|
+
geometry: areaFilterInternalGeoJsonGeometrySchema,
|
|
1717
1721
|
properties: zod.z.object({
|
|
1718
1722
|
formattedAddress: zod.z.string(),
|
|
1719
1723
|
}),
|
|
@@ -1736,7 +1740,7 @@ const AreaView = (props) => {
|
|
|
1736
1740
|
return ((_b = (_a = stableData === null || stableData === void 0 ? void 0 : stableData.findPlaces) === null || _a === void 0 ? void 0 : _a.map(place => {
|
|
1737
1741
|
var _a, _b;
|
|
1738
1742
|
const parsedBbox = geoJsonUtils.geoJsonBboxSchema.safeParse(place.bbox);
|
|
1739
|
-
const parsedGeometry =
|
|
1743
|
+
const parsedGeometry = areaFilterInternalGeoJsonGeometrySchema.safeParse(((_a = place.geometry) === null || _a === void 0 ? void 0 : _a.type)
|
|
1740
1744
|
? {
|
|
1741
1745
|
type: stringTs.titleCase(place.geometry.type),
|
|
1742
1746
|
coordinates: place.geometry.coordinates,
|
|
@@ -1880,7 +1884,7 @@ const useAreaFilter = ({ showWithSearch } = {
|
|
|
1880
1884
|
const getSelectedOption = (value, options) => {
|
|
1881
1885
|
return options.find(option => {
|
|
1882
1886
|
// Polygons are compared by their coordinates directly
|
|
1883
|
-
if (option.geometry.type === "Polygon") {
|
|
1887
|
+
if (option.geometry.type === "Polygon" || option.geometry.type === "MultiPolygon") {
|
|
1884
1888
|
return JSON.stringify(option.geometry.coordinates) === JSON.stringify(value === null || value === void 0 ? void 0 : value.coordinates);
|
|
1885
1889
|
}
|
|
1886
1890
|
// All other geometries are stored by the filter as a
|
package/index.esm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
|
|
8
8
|
import { useQuery } from '@apollo/client';
|
|
9
9
|
import { useActiveAssetFilters, useAssetQueryFilters } from '@trackunit/filters-graphql-hook';
|
|
10
10
|
import { ActivityIndicator } from '@trackunit/utilization-indicator';
|
|
11
|
-
import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonBboxSchema, getPolygonFromBbox, getBboxFromGeoJsonPolygon, getGeoJsonPolygonFromBoundingBox } from '@trackunit/geo-json-utils';
|
|
11
|
+
import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonMultiPolygonSchema, geoJsonBboxSchema, getPolygonFromBbox, getBboxFromGeoJsonPolygon, getGeoJsonPolygonFromBoundingBox } from '@trackunit/geo-json-utils';
|
|
12
12
|
import { Tooltip, IconButton, Icon, Text, Button, useDebounce, useGeometry, Popover, PopoverTrigger, PopoverContent, MenuList, MenuItem } from '@trackunit/react-components';
|
|
13
13
|
import { nonNullable, objectValues, hourIntervals, enumFromValue, objectKeys } from '@trackunit/shared-utils';
|
|
14
14
|
import { titleCase, lowerCase } from 'string-ts';
|
|
@@ -1708,10 +1708,14 @@ const RecentSearchesFooter = ({ count, onClearAll }) => {
|
|
|
1708
1708
|
};
|
|
1709
1709
|
|
|
1710
1710
|
const LOCAL_STORAGE_KEY = "area-filter-recent-searches";
|
|
1711
|
-
const
|
|
1711
|
+
const areaFilterInternalGeoJsonGeometrySchema = z.union([
|
|
1712
|
+
geoJsonPolygonSchema,
|
|
1713
|
+
geoJsonPointSchema,
|
|
1714
|
+
geoJsonMultiPolygonSchema,
|
|
1715
|
+
]);
|
|
1712
1716
|
const areaFilterInternalSchema = z.object({
|
|
1713
1717
|
bBox: geoJsonBboxSchema,
|
|
1714
|
-
geometry:
|
|
1718
|
+
geometry: areaFilterInternalGeoJsonGeometrySchema,
|
|
1715
1719
|
properties: z.object({
|
|
1716
1720
|
formattedAddress: z.string(),
|
|
1717
1721
|
}),
|
|
@@ -1734,7 +1738,7 @@ const AreaView = (props) => {
|
|
|
1734
1738
|
return ((_b = (_a = stableData === null || stableData === void 0 ? void 0 : stableData.findPlaces) === null || _a === void 0 ? void 0 : _a.map(place => {
|
|
1735
1739
|
var _a, _b;
|
|
1736
1740
|
const parsedBbox = geoJsonBboxSchema.safeParse(place.bbox);
|
|
1737
|
-
const parsedGeometry =
|
|
1741
|
+
const parsedGeometry = areaFilterInternalGeoJsonGeometrySchema.safeParse(((_a = place.geometry) === null || _a === void 0 ? void 0 : _a.type)
|
|
1738
1742
|
? {
|
|
1739
1743
|
type: titleCase(place.geometry.type),
|
|
1740
1744
|
coordinates: place.geometry.coordinates,
|
|
@@ -1878,7 +1882,7 @@ const useAreaFilter = ({ showWithSearch } = {
|
|
|
1878
1882
|
const getSelectedOption = (value, options) => {
|
|
1879
1883
|
return options.find(option => {
|
|
1880
1884
|
// Polygons are compared by their coordinates directly
|
|
1881
|
-
if (option.geometry.type === "Polygon") {
|
|
1885
|
+
if (option.geometry.type === "Polygon" || option.geometry.type === "MultiPolygon") {
|
|
1882
1886
|
return JSON.stringify(option.geometry.coordinates) === JSON.stringify(value === null || value === void 0 ? void 0 : value.coordinates);
|
|
1883
1887
|
}
|
|
1884
1888
|
// All other geometries are stored by the filter as a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/filters-asset-filter-definitions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.602",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,31 +8,31 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@graphql-codegen/cli": "^5.0.3",
|
|
11
|
-
"@trackunit/iris-app-build-utilities": "*",
|
|
12
|
-
"@trackunit/react-core-contexts-api": "*",
|
|
13
11
|
"@apollo/client": "3.10.4",
|
|
14
|
-
"@trackunit/filters-filter-bar": "*",
|
|
15
|
-
"@trackunit/filters-graphql-hook": "*",
|
|
16
|
-
"@trackunit/utilization-indicator": "*",
|
|
17
12
|
"react": "18.3.1",
|
|
18
|
-
"@trackunit/react-filter-components": "*",
|
|
19
|
-
"@trackunit/react-components": "*",
|
|
20
|
-
"@trackunit/translations-machine-type": "*",
|
|
21
|
-
"@trackunit/criticality-indicator": "*",
|
|
22
|
-
"@trackunit/react-core-hooks": "*",
|
|
23
|
-
"@trackunit/react-form-components": "*",
|
|
24
|
-
"@trackunit/shared-utils": "*",
|
|
25
|
-
"@trackunit/geo-json-utils": "*",
|
|
26
13
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
27
14
|
"graphql": "^16.9.0",
|
|
28
|
-
"@trackunit/iris-app-api": "*",
|
|
29
|
-
"@trackunit/react-core-contexts-test": "*",
|
|
30
15
|
"zod": "3.22.4",
|
|
31
|
-
"@trackunit/i18n-library-translation": "*",
|
|
32
16
|
"jest-fetch-mock": "^3.0.3",
|
|
33
17
|
"@tanstack/react-router": "1.47.1",
|
|
34
18
|
"string-ts": "^2.0.0",
|
|
35
|
-
"tailwind-merge": "^2.0.0"
|
|
19
|
+
"tailwind-merge": "^2.0.0",
|
|
20
|
+
"@trackunit/iris-app-build-utilities": "^0.0.464",
|
|
21
|
+
"@trackunit/filters-filter-bar": "^0.1.20",
|
|
22
|
+
"@trackunit/react-core-hooks": "^0.2.273",
|
|
23
|
+
"@trackunit/react-filter-components": "^0.1.18",
|
|
24
|
+
"@trackunit/react-form-components": "^0.2.12",
|
|
25
|
+
"@trackunit/filters-graphql-hook": "^0.0.513",
|
|
26
|
+
"@trackunit/utilization-indicator": "^0.0.326",
|
|
27
|
+
"@trackunit/geo-json-utils": "^0.0.5",
|
|
28
|
+
"@trackunit/react-components": "^0.5.42",
|
|
29
|
+
"@trackunit/shared-utils": "^0.0.92",
|
|
30
|
+
"@trackunit/translations-machine-type": "^0.0.253",
|
|
31
|
+
"@trackunit/criticality-indicator": "^0.0.322",
|
|
32
|
+
"@trackunit/iris-app-api": "^0.2.19",
|
|
33
|
+
"@trackunit/react-core-contexts-test": "^0.1.302",
|
|
34
|
+
"@trackunit/react-core-contexts-api": "^0.2.191",
|
|
35
|
+
"@trackunit/i18n-library-translation": "^0.0.231"
|
|
36
36
|
},
|
|
37
37
|
"module": "./index.esm.js",
|
|
38
38
|
"main": "./index.cjs.js",
|
|
@@ -20,6 +20,15 @@ declare const areaFilterInternalSchema: z.ZodObject<{
|
|
|
20
20
|
}, {
|
|
21
21
|
type: "Point";
|
|
22
22
|
coordinates: [number, number];
|
|
23
|
+
}>, z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
25
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
type: "MultiPolygon";
|
|
28
|
+
coordinates: [number, number][][][];
|
|
29
|
+
}, {
|
|
30
|
+
type: "MultiPolygon";
|
|
31
|
+
coordinates: [number, number][][][];
|
|
23
32
|
}>]>;
|
|
24
33
|
properties: z.ZodObject<{
|
|
25
34
|
formattedAddress: z.ZodString;
|
|
@@ -37,6 +46,9 @@ declare const areaFilterInternalSchema: z.ZodObject<{
|
|
|
37
46
|
} | {
|
|
38
47
|
type: "Point";
|
|
39
48
|
coordinates: [number, number];
|
|
49
|
+
} | {
|
|
50
|
+
type: "MultiPolygon";
|
|
51
|
+
coordinates: [number, number][][][];
|
|
40
52
|
};
|
|
41
53
|
properties: {
|
|
42
54
|
formattedAddress: string;
|
|
@@ -50,6 +62,9 @@ declare const areaFilterInternalSchema: z.ZodObject<{
|
|
|
50
62
|
} | {
|
|
51
63
|
type: "Point";
|
|
52
64
|
coordinates: [number, number];
|
|
65
|
+
} | {
|
|
66
|
+
type: "MultiPolygon";
|
|
67
|
+
coordinates: [number, number][][][];
|
|
53
68
|
};
|
|
54
69
|
properties: {
|
|
55
70
|
formattedAddress: string;
|
|
@@ -130,6 +130,7 @@ export type Scalars = {
|
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
export declare const areaFilterGeoJsonGeometryType: {
|
|
133
|
+
readonly MultiPolygon: "MultiPolygon";
|
|
133
134
|
readonly Polygon: "Polygon";
|
|
134
135
|
};
|
|
135
136
|
export type AreaFilterGeoJsonGeometryType = (typeof areaFilterGeoJsonGeometryType)[keyof typeof areaFilterGeoJsonGeometryType];
|