@opengeoweb/sigmet-airmet 14.3.0 → 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
@@ -79,7 +79,7 @@ var en = {
79
79
  "geometry-maximum-points-message": "The start position drawing allows a maximum of {{maxPoints}} individual points",
80
80
  "geometry-more-than-6-points-message": "The start/end position drawing has exceeded 6 individual points. The TAC has a total of {{totalDrawnPoints}} points. If possible, reduce the number of points.",
81
81
  "geometry-intersection-above-6-points-message": "The start/end position of the intersected polygon has {{intersectingPolygonPointsTotal}} points, and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points. Check if the TAC in the preview corresponds to the intended area.",
82
- "geometry-only-one-start-position-drawing": "Only one start position drawing is allowed",
82
+ "geometry-only-one-start-position-drawing": "The drawn polygon results in several polygons, and no TAC can be produced",
83
83
  "progress-get-movement-step-valktmessage": "Speed should be rounded to the nearest {{value}}kt",
84
84
  "progress-get-movement-step-valkmhmessage": "Speed should be rounded to the nearest {{value}}kmh",
85
85
  "progress-coordinate-empty-message": "An end position drawing is required when selecting End position",
@@ -144,7 +144,8 @@ var en = {
144
144
  "surface-visibility-maximum-visibility": "The maximum visibility in meters is {{maximumVisibility}}",
145
145
  "surface-visibility-helper-text": "Value in meters",
146
146
  "surface-visibility-between-time": "Forecast time should lie between the valid start and valid end time",
147
- phenomenon: "Phenomenon"
147
+ phenomenon: "Phenomenon",
148
+ "geometry-drawing-disabled": "Link a map to enable draw tools"
148
149
  };
149
150
  var fi = {
150
151
  "sigmet-airmet": "sigmet",
@@ -269,7 +270,8 @@ var fi = {
269
270
  "surface-visibility-maximum-visibility": "Maksiminäkyvyys metreinä: {{maximumVisibility}}",
270
271
  "surface-visibility-helper-text": "Arvo metreinä",
271
272
  "surface-visibility-between-time": "Ennusteajan tulee olla voimassa olevan alkamis- ja päättymisajan välissä",
272
- phenomenon: "sääilmiö"
273
+ phenomenon: "sääilmiö",
274
+ "geometry-drawing-disabled": "Link a map to enable draw tools"
273
275
  };
274
276
  var no = {
275
277
  "sigmet-airmet": "sigmet",
@@ -396,7 +398,8 @@ var no = {
396
398
  "surface-visibility-maximum-visibility": "The maximum visibility in meters is {{maximumVisibility}}",
397
399
  "surface-visibility-helper-text": "Value in meters",
398
400
  "surface-visibility-between-time": "Forecast time should lie between the valid start and valid end time",
399
- phenomenon: "Phenomenon"
401
+ phenomenon: "Phenomenon",
402
+ "geometry-drawing-disabled": "Link a map to enable draw tools"
400
403
  };
401
404
  var nl = {
402
405
  "sigmet-airmet": "sigmet",
@@ -521,7 +524,8 @@ var nl = {
521
524
  "surface-visibility-maximum-visibility": "De maximale zichtbaarheid in meters is {{maximumVisibility}}",
522
525
  "surface-visibility-helper-text": "Waarde in meters",
523
526
  "surface-visibility-between-time": "De prognosetijd moet tussen de geldige start- en eindtijd liggen",
524
- phenomenon: "Fenomeen"
527
+ phenomenon: "Fenomeen",
528
+ "geometry-drawing-disabled": "Link a map to enable draw tools"
525
529
  };
526
530
  var sigmetAirmetTranslations = {
527
531
  en: en,
@@ -5555,7 +5559,8 @@ var DrawTools = function DrawTools(_ref) {
5555
5559
  tools = _ref.tools,
5556
5560
  onChangeTool = _ref.onChangeTool,
5557
5561
  _ref$isDisabled = _ref.isDisabled,
5558
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
5562
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
5563
+ disabledTooltip = _ref.disabledTooltip;
5559
5564
  usePreventBrowserClose(activeTool !== '');
5560
5565
  return jsx(Box, {
5561
5566
  "data-testid": "drawtools",
@@ -5565,19 +5570,23 @@ var DrawTools = function DrawTools(_ref) {
5565
5570
  justifyContent: 'space-between'
5566
5571
  },
5567
5572
  children: tools.map(function (tool) {
5573
+ var radio = jsx(Radio, {
5574
+ icon: getToolIcon(tool.selectionType),
5575
+ value: true,
5576
+ checkedIcon: getToolIcon(tool.selectionType),
5577
+ checked: activeTool === tool.drawModeId,
5578
+ disabled: isDisabled,
5579
+ onChange: function onChange() {
5580
+ onChangeTool(tool);
5581
+ },
5582
+ "data-testid": tool.drawModeId,
5583
+ sx: styles$1.radioInput
5584
+ });
5585
+ var title = isDisabled && disabledTooltip ? disabledTooltip : tool.title;
5568
5586
  return jsx(CustomTooltip, {
5569
- title: tool.title,
5570
- children: jsx(Radio, {
5571
- icon: getToolIcon(tool.selectionType),
5572
- value: true,
5573
- checkedIcon: getToolIcon(tool.selectionType),
5574
- checked: activeTool === tool.drawModeId,
5575
- disabled: isDisabled,
5576
- onChange: function onChange() {
5577
- onChangeTool(tool);
5578
- },
5579
- "data-testid": tool.drawModeId,
5580
- sx: styles$1.radioInput
5587
+ title: title,
5588
+ children: jsx("span", {
5589
+ children: radio
5581
5590
  })
5582
5591
  }, tool.drawModeId);
5583
5592
  })
@@ -6425,6 +6434,9 @@ var Progress = function Progress(_ref) {
6425
6434
  var isRequired = function isRequired(value) {
6426
6435
  return isShortTest() || isRequiredField(value);
6427
6436
  };
6437
+ var shortTest = isShortTest();
6438
+ var combinedDisabled = shortTest || drawToolsDisabled;
6439
+ var disabledTooltip = !shortTest && drawToolsDisabled ? t('geometry-drawing-disabled') : undefined;
6428
6440
  var movementType = watch('movementType');
6429
6441
  var getFIRValue = function getFIRValue() {
6430
6442
  return getValues('locationIndicatorATSR');
@@ -6620,7 +6632,8 @@ var Progress = function Progress(_ref) {
6620
6632
  tools: tools,
6621
6633
  activeTool: activeTool,
6622
6634
  onChangeTool: onChangeTool,
6623
- isDisabled: drawToolsDisabled
6635
+ isDisabled: combinedDisabled,
6636
+ disabledTooltip: disabledTooltip
6624
6637
  }), activeTool && jsx(FormHelperText, {
6625
6638
  variant: "filled",
6626
6639
  sx: styles$2.quitDrawModeMessage,
@@ -6806,6 +6819,9 @@ var StartGeometry = function StartGeometry(_ref) {
6806
6819
  var getFIRValue = function getFIRValue() {
6807
6820
  return getValues('locationIndicatorATSR');
6808
6821
  };
6822
+ var shortTest = isShortTest();
6823
+ var combinedDisabled = shortTest || isDisabled;
6824
+ var disabledTooltip = !shortTest && isDisabled ? t('geometry-drawing-disabled') : undefined;
6809
6825
  // Max points the FIR allows for a polygon
6810
6826
  var maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
6811
6827
  // Intersections with FIR
@@ -6827,7 +6843,8 @@ var StartGeometry = function StartGeometry(_ref) {
6827
6843
  activeTool: activeTool,
6828
6844
  tools: tools,
6829
6845
  onChangeTool: onChangeTool,
6830
- isDisabled: isShortTest() || isDisabled
6846
+ isDisabled: combinedDisabled,
6847
+ disabledTooltip: disabledTooltip
6831
6848
  }), activeTool && jsx(FormHelperText, {
6832
6849
  variant: "filled",
6833
6850
  sx: styles$2.quitDrawModeMessage,
@@ -6852,15 +6869,14 @@ var StartGeometry = function StartGeometry(_ref) {
6852
6869
  children: t('geometry-intersection-above-6-points-message', {
6853
6870
  intersectingPolygonPointsTotal: intersectingPolygonPointsTotal
6854
6871
  })
6855
- }), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.startGeometry && !isFir(geoJSON) && jsx(FormHelperText, {
6856
- variant: "filled",
6857
- children: t('geometry-multi-intersections-message')
6858
6872
  }), jsx(ReactHookFormHiddenInput, {
6859
6873
  name: "startGeometry",
6860
6874
  rules: {
6861
6875
  validate: {
6862
- maximumOneDrawing: function maximumOneDrawing(value) {
6863
- return isMaximumOneDrawing(value) || t('geometry-only-one-start-position-drawing');
6876
+ maximumOneDrawing: function maximumOneDrawing() {
6877
+ var intersection = watch('startGeometryIntersect');
6878
+ var result = isMaximumOneDrawing(intersection);
6879
+ return result || t('geometry-only-one-start-position-drawing');
6864
6880
  },
6865
6881
  intersectWithFIR: function intersectWithFIR(value) {
6866
6882
  return hasIntersectionWithFIR(value, watch('startGeometryIntersect')) || t('geometry-no-intersection-message');
@@ -8471,6 +8487,7 @@ var SigmetForm = function SigmetForm(_ref) {
8471
8487
  watch = _useFormContext2.watch,
8472
8488
  setValue = _useFormContext2.setValue,
8473
8489
  handleSubmit = _useFormContext2.handleSubmit,
8490
+ trigger = _useFormContext2.trigger,
8474
8491
  errors = _useFormContext2.formState.errors;
8475
8492
  var _React$useState = React__default.useState(false),
8476
8493
  hasUserChangedTime = _React$useState[0],
@@ -8565,15 +8582,18 @@ var SigmetForm = function SigmetForm(_ref) {
8565
8582
  }, [updateTac, watch]);
8566
8583
  var onUpdateStartgeoJSON = useCallback(function (updatedStartGeoJSON, updateStartGeoJSONIntersection) {
8567
8584
  setValue('startGeometry', updatedStartGeoJSON, {
8568
- shouldValidate: true,
8585
+ shouldValidate: false,
8569
8586
  shouldDirty: isGeometryDirty(watch('startGeometry'), updatedStartGeoJSON)
8570
8587
  });
8571
8588
  setValue('startGeometryIntersect', updateStartGeoJSONIntersection, {
8572
- shouldValidate: true,
8589
+ shouldValidate: false,
8573
8590
  shouldDirty: isGeometryDirty(watch('startGeometryIntersect'), updateStartGeoJSONIntersection)
8574
8591
  });
8592
+ queueMicrotask(function () {
8593
+ return void trigger('startGeometry');
8594
+ });
8575
8595
  onChangeForm();
8576
- }, [setValue, watch, onChangeForm]);
8596
+ }, [setValue, watch, trigger, onChangeForm]);
8577
8597
  var onUpdateEndGeoJson = useCallback(function (updatedEndGeoJSON, updateEndGeoJSONIntersection) {
8578
8598
  setValue('endGeometry', updatedEndGeoJSON, {
8579
8599
  shouldValidate: true,
@@ -8939,15 +8959,18 @@ var AirmetForm = function AirmetForm(_ref) {
8939
8959
  }, [updateTac, watch]);
8940
8960
  var onUpdateStartgeoJSON = useCallback(function (updatedStartGeoJSON, updateStartGeoJSONIntersection) {
8941
8961
  setValue('startGeometry', updatedStartGeoJSON, {
8942
- shouldValidate: true,
8962
+ shouldValidate: false,
8943
8963
  shouldDirty: isGeometryDirty(watch('startGeometry'), updatedStartGeoJSON)
8944
8964
  });
8945
8965
  setValue('startGeometryIntersect', updateStartGeoJSONIntersection, {
8946
- shouldValidate: true,
8966
+ shouldValidate: false,
8947
8967
  shouldDirty: isGeometryDirty(watch('startGeometryIntersect'), updateStartGeoJSONIntersection)
8948
8968
  });
8969
+ queueMicrotask(function () {
8970
+ return void trigger('startGeometry');
8971
+ });
8949
8972
  onChangeForm();
8950
- }, [setValue, watch, onChangeForm]);
8973
+ }, [setValue, watch, onChangeForm, trigger]);
8951
8974
  var updateStartGeoJson = useCallback(function (newGeoJSON) {
8952
8975
  var _setGeoJSON = setGeoJSON(newGeoJSON),
8953
8976
  newStartGeoJson = _setGeoJSON[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "14.3.0",
3
+ "version": "14.4.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,17 +8,17 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/api": "14.3.0",
12
- "@opengeoweb/shared": "14.3.0",
13
- "@opengeoweb/theme": "14.3.0",
14
- "@opengeoweb/store": "14.3.0",
15
- "@opengeoweb/webmap": "14.3.0",
16
- "@opengeoweb/webmap-react": "14.3.0",
11
+ "@opengeoweb/api": "14.4.0",
12
+ "@opengeoweb/shared": "14.4.0",
13
+ "@opengeoweb/theme": "14.4.0",
14
+ "@opengeoweb/store": "14.4.0",
15
+ "@opengeoweb/webmap": "14.4.0",
16
+ "@opengeoweb/webmap-react": "14.4.0",
17
17
  "react-redux": "^9.2.0",
18
- "@opengeoweb/core": "14.3.0",
19
- "@opengeoweb/authentication": "14.3.0",
18
+ "@opengeoweb/core": "14.4.0",
19
+ "@opengeoweb/authentication": "14.4.0",
20
20
  "@mui/system": "^7.3.2",
21
- "@opengeoweb/form-fields": "14.3.0",
21
+ "@opengeoweb/form-fields": "14.4.0",
22
22
  "react-hook-form": "^7.50.1",
23
23
  "axios": "^1.7.7",
24
24
  "lodash": "^4.17.21",
@@ -5,6 +5,7 @@ interface DrawToolsProps {
5
5
  tools: DrawMode[];
6
6
  onChangeTool: (newToolMode: DrawMode) => void;
7
7
  isDisabled?: boolean;
8
+ disabledTooltip?: string;
8
9
  }
9
10
  declare const DrawTools: React.FC<DrawToolsProps>;
10
11
  export default DrawTools;