@opengeoweb/form-fields 14.2.2 → 14.4.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.esm.js CHANGED
@@ -207,6 +207,10 @@ var isValidGeoJsonCoordinates = function isValidGeoJsonCoordinates(geojson) {
207
207
  if (coordinates.length === 2 && type === 'Point') {
208
208
  return true;
209
209
  }
210
+ // For type LINESTRING coordinates is an array of at least 2
211
+ if (coordinates.length > 1 && type === 'LineString') {
212
+ return true;
213
+ }
210
214
  // For type POLYGON coordinates is an array of arrays
211
215
  if (coordinates.length === 1 && coordinates[0].length > 0 && type === 'Polygon') {
212
216
  return true;
@@ -214,17 +218,14 @@ var isValidGeoJsonCoordinates = function isValidGeoJsonCoordinates(geojson) {
214
218
  return false;
215
219
  };
216
220
  var isMaximumOneDrawing = function isMaximumOneDrawing(geojson) {
217
- var hasGeometry = hasValidGeometry(geojson);
218
- if (!hasGeometry) {
219
- return true; // no need to check further when there is no drawing yet
221
+ if (!hasValidGeometry(geojson)) {
222
+ return true;
220
223
  }
221
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
222
- // @ts-ignore
223
- var _geojson$features$0$g3 = geojson.features[0].geometry,
224
- coordinates = _geojson$features$0$g3.coordinates,
225
- type = _geojson$features$0$g3.type;
226
- // For type POLYGON only one array of coordinates is allowed
227
- if (type === 'Polygon' && coordinates.length > 1) {
224
+ var geometry = geojson.features[0].geometry;
225
+ if (geometry.type === 'MultiPolygon') {
226
+ return false;
227
+ }
228
+ if (geometry.type === 'Polygon' && geometry.coordinates.length > 1) {
228
229
  return false;
229
230
  }
230
231
  return true;
@@ -260,9 +261,9 @@ var hasMulitpleIntersections = function hasMulitpleIntersections(geojson) {
260
261
  }
261
262
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
262
263
  // @ts-ignore
263
- var _geojson$features$0$g4 = geojson.features[0].geometry,
264
- coordinates = _geojson$features$0$g4.coordinates,
265
- type = _geojson$features$0$g4.type;
264
+ var _geojson$features$0$g3 = geojson.features[0].geometry,
265
+ coordinates = _geojson$features$0$g3.coordinates,
266
+ type = _geojson$features$0$g3.type;
266
267
  if (type === 'MultiPolygon' || coordinates.length > 1 && type !== 'Point') {
267
268
  return true;
268
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/form-fields",
3
- "version": "14.2.2",
3
+ "version": "14.4.0",
4
4
  "description": "GeoWeb form-fields library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,11 +8,11 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/theme": "14.2.2",
11
+ "@opengeoweb/theme": "14.4.0",
12
12
  "react-hook-form": "^7.50.1",
13
13
  "@mui/x-date-pickers": "^8.11.2",
14
14
  "lodash": "^4.17.21",
15
- "@opengeoweb/shared": "14.2.2",
15
+ "@opengeoweb/shared": "14.4.0",
16
16
  "react-i18next": "^15.1.1",
17
17
  "@mui/material": "^7.0.1",
18
18
  "i18next": "^25.0.1",
@@ -2,6 +2,6 @@ import i18n from 'i18next';
2
2
  import type { UseTranslationResponse } from 'react-i18next';
3
3
  export declare const FORM_FIELDS_NAMESPACE = "form-fields";
4
4
  export declare const initFormFieldsI18n: () => void;
5
- export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
5
+ export declare const translateInTestsAndStories: (key: string, params?: Record<string, string | number> | undefined) => string;
6
6
  export declare const useFormFieldsTranslation: () => UseTranslationResponse<typeof FORM_FIELDS_NAMESPACE, typeof i18n>;
7
7
  export { i18n };