@opengeoweb/warnings 20.0.0-nightly-20261001 → 20.0.1

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/dist/index.esm.js CHANGED
@@ -15,7 +15,7 @@ import React, { useRef, useState, useEffect, useCallback, useMemo } from 'react'
15
15
  import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
16
16
  import { styled, Box, Typography, useTheme, Accordion, AccordionSummary, ListItem, ListItemButton, Stack, Grid, AccordionDetails, LinearProgress, Tabs, Tab, Button, MenuItem, Menu, ListSubheader, FormHelperText, Paper, Card, CardContent, FormControl, CircularProgress, Chip, ListItemText, ListItemIcon, Popover, RadioGroup, FormControlLabel, Radio, Tooltip, IconButton, Checkbox, DialogTitle, DialogContent, Switch, Collapse } from '@mui/material';
17
17
  import { List, useListRef } from 'react-window';
18
- import { AirmetPhenomena, SigmetPhenomena, getHeaders, handleResponse, useAuthQuery, useAuthenticationContext, optimisticUpdate, ProductStatus, LevelUnits } from '@opengeoweb/api';
18
+ import { AirmetPhenomena, SigmetPhenomena, getHeaders, handleResponse, throwResponseError, useAuthQuery, useAuthenticationContext, optimisticUpdate, ProductStatus, LevelUnits } from '@opengeoweb/api';
19
19
  import { snackbarListener, snackbarReducer, snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
20
20
  import { useQueryClient, useMutation, queryOptions, QueryClient, useQuery } from '@tanstack/react-query';
21
21
  import { omitBy, isUndefined, isEqual, cloneDeep, clamp, omit, concat, groupBy, pick } from 'lodash';
@@ -397,6 +397,9 @@ var en = {
397
397
  "warning-event-expire-event-confirm-description": "Are you sure you would like to expire this event? All active warnings will become EXPIRED and all warnings that have not started yet will become WITHDRAWN. Any unpublished changes will be discarded. Publish the event for this change to take effect.",
398
398
  "warning-event-withdraw-event-confirm-title": "Withdraw event",
399
399
  "warning-event-withdraw-event-confirm-description": "Are you sure you would like to withdraw this event? All warnings will become WITHDRAWN. Any unpublished changes will be discarded. Publish the event for this change to take effect.",
400
+ "warning-event-type-change-confirm-title": "Change warning type",
401
+ "warning-event-type-change-confirm-description": "Are you sure you want to switch from early warning to warning? Once published, this cannot be undone",
402
+ "warning-event-type-change-confirm-confirm": "Change type",
400
403
  "warning-event-validation-incident-max-length": "Max chars is {{MAX_CHARS}}",
401
404
  "warning-event-validation-summary-incomplete": "All summary fields must be completed before publishing",
402
405
  "warning-event-validation-translation-incomplete": "All translation fields must be completed before publishing",
@@ -408,11 +411,7 @@ var en = {
408
411
  "warning-event-validation-propbability-collapsed": "A probability is required",
409
412
  "warning-event-validation-area-missing": "An area is required",
410
413
  "warning-event-validation-area-non-polygon": "Area must be a polygon or multi-polygon",
411
- "warning-event-validation-no-yellow-fog-early": "Code yellow cannot be used for an early warning for fog",
412
- "warning-event-validation-no-probability-yellow-rain": "For a yellow early warning for rain, 10-30 is not allowed",
413
- "warning-event-validation-no-probability-yellow-other": "For a yellow early warning, 10-30 and 30-60 are not allowed",
414
- "warning-event-validation-no-probability-orange-red-fog": "For an orange/red early warning for fog, 10-30 is not allowed",
415
- "warning-event-validation-no-probability-orange-red-other": "For an orange/red early warning, 10-30 and 30-60 are not allowed",
414
+ "warning-event-validation-no-probability-yellow-other": "For a yellow early warning, 10-30 is not allowed",
416
415
  "warning-event-open-summary-dialog-tooltip": "Open the summary dialog to enter detailed texts for all summary fields",
417
416
  "drawing-tool-form-objects": "Objects",
418
417
  "drawing-tool-form-object-name": "Object name",
@@ -754,6 +753,9 @@ var nl = {
754
753
  "warning-event-expire-event-confirm-description": "Weet je zeker dat je dit event wilt markeren als verlopen? Alle actieve waarschuwingen krijgen de status VERLOPEN en alle nog niet gestarte waarschuwingen krijgen de status TERUGGETROKKEN. Ongepubliceerde veranderingen worden verwijderd. Publiceer het event om deze verandering te activeren.",
755
754
  "warning-event-withdraw-event-confirm-title": "Trek event terug",
756
755
  "warning-event-withdraw-event-confirm-description": "Weet je zeker dat je dit event wilt terugtrekken? Alle waarschuwingen krijgen de status TERUGGETROKKEN. Ongepubliceerde veranderingen worden verwijderd. Publiceer het event om deze verandering te activeren.",
756
+ "warning-event-type-change-confirm-title": "Waarschuwingstype wijzigen",
757
+ "warning-event-type-change-confirm-description": "Weet je zeker dat je wilt overschakelen van vroege waarschuwing naar waarschuwing? Na publicatie kan dit niet ongedaan worden gemaakt",
758
+ "warning-event-type-change-confirm-confirm": "Type wijzigen",
757
759
  "warning-event-editor-remove-editor": "Je bent niet langer de editor voor dit event",
758
760
  "warning-event-take-over-message": "Je bent niet langer de editor voor dit event",
759
761
  "warning-event-validation-incident-max-length": "Max tekens is {{MAX_CHARS}}",
@@ -767,11 +769,7 @@ var nl = {
767
769
  "warning-event-validation-propbability-collapsed": "Een waarschijnlijkheid is verplicht",
768
770
  "warning-event-validation-area-missing": "Een gebied is verplicht",
769
771
  "warning-event-validation-area-non-polygon": "Gebied moet een polygoon of multi-polygoon zijn",
770
- "warning-event-validation-no-yellow-fog-early": "Code geel kan niet worden gebruikt voor een vroege waarschuwing voor mist",
771
- "warning-event-validation-no-probability-yellow-rain": "Voor een gele vroege waarschuwing voor regen is 10-30 niet toegestaan",
772
- "warning-event-validation-no-probability-yellow-other": "Voor een gele vroege waarschuwing, zijn 10-30 en 30-60 niet toegestaan",
773
- "warning-event-validation-no-probability-orange-red-fog": "Voor een oranje/rode vroege waarschuwing voor mist is 10-30 niet toegestaan",
774
- "warning-event-validation-no-probability-orange-red-other": "Voor een oranje/rode vroege waarschuwing, zijn 10-30 en 30-60 niet toegestaan",
772
+ "warning-event-validation-no-probability-yellow-other": "Voor een gele vroege waarschuwing, is 10-30 niet toegestaan",
775
773
  "warning-event-open-summary-dialog-tooltip": "Open de samenvatting pop-up om de gedetailleerde samenvattingen in te vullen",
776
774
  "drawing-tool-form-objects": "Objecten",
777
775
  "drawing-tool-form-object-name": "Objectnaam",
@@ -1067,6 +1065,9 @@ var fi = {
1067
1065
  "warning-event-expire-event-confirm-description": "ei käännetty",
1068
1066
  "warning-event-withdraw-event-confirm-title": "ei käännetty",
1069
1067
  "warning-event-withdraw-event-confirm-description": "ei käännetty",
1068
+ "warning-event-type-change-confirm-title": "Vaihda varoituksen tyyppi",
1069
+ "warning-event-type-change-confirm-description": "Haluatko varmasti vaihtaa ennakkovaroituksen varoitukseksi? Julkaisun jälkeen muutosta ei voi perua",
1070
+ "warning-event-type-change-confirm-confirm": "Vaihda tyyppi",
1070
1071
  "warning-event-validation-incident-max-length": "ei käännetty",
1071
1072
  "warning-event-validation-summary-incomplete": "ei käännetty",
1072
1073
  "warning-event-validation-translation-incomplete": "ei käännetty",
@@ -1078,11 +1079,7 @@ var fi = {
1078
1079
  "warning-event-validation-propbability-collapsed": "ei käännetty",
1079
1080
  "warning-event-validation-area-missing": "ei käännetty",
1080
1081
  "warning-event-validation-area-non-polygon": "ei käännetty",
1081
- "warning-event-validation-no-yellow-fog-early": "ei käännetty",
1082
- "warning-event-validation-no-probability-yellow-rain": "ei käännetty",
1083
1082
  "warning-event-validation-no-probability-yellow-other": "ei käännetty",
1084
- "warning-event-validation-no-probability-orange-red-fog": "ei käännetty",
1085
- "warning-event-validation-no-probability-orange-red-other": "ei käännetty",
1086
1083
  "warning-event-open-summary-dialog-tooltip": "ei käännetty",
1087
1084
  "drawing-tool-form-objects": "ei käännetty",
1088
1085
  "drawing-tool-form-object-name": "ei käännetty",
@@ -1376,6 +1373,9 @@ var no = {
1376
1373
  "warning-event-expire-event-confirm-description": "ikke oversatt",
1377
1374
  "warning-event-withdraw-event-confirm-title": "ikke oversatt",
1378
1375
  "warning-event-withdraw-event-confirm-description": "ikke oversatt",
1376
+ "warning-event-type-change-confirm-title": "ikke oversatt",
1377
+ "warning-event-type-change-confirm-description": "ikke oversatt",
1378
+ "warning-event-type-change-confirm-confirm": "ikke oversatt",
1379
1379
  "warning-event-validation-incident-max-length": "ikke oversatt",
1380
1380
  "warning-event-validation-summary-incomplete": "ikke oversatt",
1381
1381
  "warning-event-validation-translation-incomplete": "ikke oversatt",
@@ -1388,11 +1388,7 @@ var no = {
1388
1388
  "warning-event-validation-area-missing": "ikke oversatt",
1389
1389
  "warning-event-validation-area-non-polygon": "ikke oversatt",
1390
1390
  "warning-event-open-summary-dialog-tooltip": "ikke oversatt",
1391
- "warning-event-validation-no-yellow-fog-early": "ikke oversatt",
1392
- "warning-event-validation-no-probability-yellow-rain": "ikke oversatt",
1393
1391
  "warning-event-validation-no-probability-yellow-other": "ikke oversatt",
1394
- "warning-event-validation-no-probability-orange-red-fog": "ikke oversatt",
1395
- "warning-event-validation-no-probability-orange-red-other": "ikke oversatt",
1396
1392
  "drawing-tool-form-objects": "ikke oversatt",
1397
1393
  "drawing-tool-form-object-name": "ikke oversatt",
1398
1394
  "drawing-tool-form-object-name-required": "ikke oversatt",
@@ -4023,7 +4019,8 @@ var saveDrawingAs = /*#__PURE__*/function () {
4023
4019
  _context10.n = 2;
4024
4020
  break;
4025
4021
  }
4026
- throw new Error('Failed to save drawing');
4022
+ _context10.n = 2;
4023
+ return throwResponseError(response);
4027
4024
  case 2:
4028
4025
  return _context10.a(2, response.headers);
4029
4026
  }
@@ -17303,25 +17300,15 @@ var WarningEventItem = function WarningEventItem(_ref) {
17303
17300
  var probabilityValidation = React.useCallback(function (value) {
17304
17301
  var eventType = getValues('warningEventType');
17305
17302
  var warningLevel = getValues("warnings." + index + ".level");
17306
- var phenomenon = getValues('phenomenon');
17307
17303
  // All is allowed for Warning
17308
17304
  if (eventType === WarningEventType.WARNING) {
17309
17305
  return true;
17310
17306
  }
17311
17307
  if (warningLevel === WarningLevel.moderate) {
17312
- // For a yellow early warning: rain, only allow 30-60, 60-90 and 90-100
17313
- if (phenomenon === 'rain') {
17314
- return value === Probability.TEN_TO_THIRTY ? t('warning-event-validation-no-probability-yellow-rain') : true;
17315
- }
17316
- // For yellow early warning: all other phenomena, only allow 60-90 and 90-100
17317
- return value === Probability.TEN_TO_THIRTY || value === Probability.THIRTY_TO_SIXTY ? t('warning-event-validation-no-probability-yellow-other') : true;
17318
- }
17319
- // For a orange/red early warning: fog, only allow 30-60, 60-90 and 90-100
17320
- if (phenomenon === 'fog') {
17321
- return value === Probability.TEN_TO_THIRTY ? t('warning-event-validation-no-probability-orange-red-fog') : true;
17308
+ // For yellow early warning: all phenomena, only allow 30-60, 60-90 and 90-100
17309
+ return value === Probability.TEN_TO_THIRTY ? t('warning-event-validation-no-probability-yellow-other') : true;
17322
17310
  }
17323
- // For orange/red early warning: all other phenomena, only allow 60-90 and 90-100
17324
- return value === Probability.TEN_TO_THIRTY || value === Probability.THIRTY_TO_SIXTY ? t('warning-event-validation-no-probability-orange-red-other') : true;
17311
+ return true;
17325
17312
  }, [getValues, index, t]);
17326
17313
  var editing = React.useMemo(function () {
17327
17314
  return {
@@ -17989,15 +17976,6 @@ var WarningEventItem = function WarningEventItem(_ref) {
17989
17976
  }
17990
17977
  }
17991
17978
  }
17992
- }), jsx(ReactHookFormHiddenInput, {
17993
- name: "warnings." + index + ".level",
17994
- rules: {
17995
- validate: {
17996
- noYellowEarlyWarningFog: function noYellowEarlyWarningFog(value) {
17997
- return getValues('phenomenon') === 'fog' && getValues('warningEventType') === WarningEventType.EARLY_WARNING && value === WarningLevel.moderate ? t('warning-event-validation-no-yellow-fog-early') : true;
17998
- }
17999
- }
18000
- }
18001
17979
  })]
18002
17980
  });
18003
17981
  };
@@ -18038,6 +18016,7 @@ var RemainingChars = function RemainingChars(_ref) {
18038
18016
  });
18039
18017
  };
18040
18018
  var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18019
+ var _useWatch2;
18041
18020
  var _ref2$isReadOnly = _ref2.isReadOnly,
18042
18021
  isReadOnly = _ref2$isReadOnly === void 0 ? false : _ref2$isReadOnly,
18043
18022
  _ref2$onClickAdd = _ref2.onClickAdd,
@@ -18052,6 +18031,13 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18052
18031
  control: control,
18053
18032
  name: 'texts'
18054
18033
  });
18034
+ var warnings = (_useWatch2 = useWatch({
18035
+ control: control,
18036
+ name: 'warnings'
18037
+ })) != null ? _useWatch2 : [];
18038
+ // When the whole event is expired/withdrawn the summary can no longer be edited
18039
+ var isEventFinalised = warnings.length > 0 && warnings.every(isWarningFinalised);
18040
+ var areFieldsDisabled = isReadOnly || isEventFinalised;
18055
18041
  var hasContent = SUMMARY_TEXT_FIELDS.some(function (field) {
18056
18042
  var _texts$field;
18057
18043
  return ((_texts$field = texts == null ? void 0 : texts[field]) != null ? _texts$field : '').trim();
@@ -18155,7 +18141,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18155
18141
  xs: 12
18156
18142
  },
18157
18143
  children: [jsx(ReactHookFormTextField, {
18158
- disabled: isReadOnly,
18144
+ disabled: areFieldsDisabled,
18159
18145
  label: t('warning-event-summary-headline-original'),
18160
18146
  maxRows: 6,
18161
18147
  minRows: 4,
@@ -18171,7 +18157,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18171
18157
  xs: 12
18172
18158
  },
18173
18159
  children: [jsx(ReactHookFormTextField, {
18174
- disabled: isReadOnly,
18160
+ disabled: areFieldsDisabled,
18175
18161
  label: t('warning-event-summary-concise-summary-original'),
18176
18162
  maxRows: 9,
18177
18163
  minRows: 7,
@@ -18187,7 +18173,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18187
18173
  xs: 12
18188
18174
  },
18189
18175
  children: [jsx(ReactHookFormTextField, {
18190
- disabled: isReadOnly,
18176
+ disabled: areFieldsDisabled,
18191
18177
  label: t('warning-event-summary-description-original'),
18192
18178
  maxRows: 11,
18193
18179
  minRows: 9,
@@ -18249,7 +18235,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18249
18235
  xs: 12
18250
18236
  },
18251
18237
  children: [jsx(ReactHookFormTextField, {
18252
- disabled: isReadOnly,
18238
+ disabled: areFieldsDisabled,
18253
18239
  label: t('warning-event-summary-headline-translation'),
18254
18240
  maxRows: 6,
18255
18241
  minRows: 4,
@@ -18265,7 +18251,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18265
18251
  xs: 12
18266
18252
  },
18267
18253
  children: [jsx(ReactHookFormTextField, {
18268
- disabled: isReadOnly,
18254
+ disabled: areFieldsDisabled,
18269
18255
  label: t('warning-event-summary-concise-summary-translation'),
18270
18256
  maxRows: 9,
18271
18257
  minRows: 7,
@@ -18281,7 +18267,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18281
18267
  xs: 12
18282
18268
  },
18283
18269
  children: [jsx(ReactHookFormTextField, {
18284
- disabled: isReadOnly,
18270
+ disabled: areFieldsDisabled,
18285
18271
  label: t('warning-event-summary-description-translation'),
18286
18272
  maxRows: 11,
18287
18273
  minRows: 9,
@@ -18298,7 +18284,7 @@ var WarningEventSummaryForm = function WarningEventSummaryForm(_ref2) {
18298
18284
  })]
18299
18285
  })]
18300
18286
  })
18301
- }), !isReadOnly && jsx(Box, {
18287
+ }), !areFieldsDisabled && jsx(Box, {
18302
18288
  sx: {
18303
18289
  flex: 0,
18304
18290
  display: 'flex',
@@ -18432,6 +18418,9 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18432
18418
  var _React$useState2 = React.useState(false),
18433
18419
  isUnpublishedExpiredWithdraw = _React$useState2[0],
18434
18420
  setIsUnpublishedExpiredWithdraw = _React$useState2[1];
18421
+ var _React$useState3 = React.useState(null),
18422
+ pendingEventAction = _React$useState3[0],
18423
+ setPendingEventAction = _React$useState3[1];
18435
18424
  var _useDraftFormHelpers = useDraftFormHelpers(),
18436
18425
  toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
18437
18426
  DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
@@ -18486,10 +18475,15 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18486
18475
  // sync redux with react-hook-form
18487
18476
  reset(getFormData(selectedEvent));
18488
18477
  }, [eventId, reset, selectedEvent]);
18478
+ // When switching event, clear any pending event level expire/withdraw action
18479
+ React.useEffect(function () {
18480
+ setPendingEventAction(null);
18481
+ }, [eventId]);
18489
18482
  // When the editor gets set back to viewer and the form is dirty, reset any changes made
18490
18483
  React.useEffect(function () {
18491
18484
  if (isReadOnly && Object.keys(dirtyFields).length > 0) {
18492
18485
  reset(getFormData(selectedEvent));
18486
+ setPendingEventAction(null);
18493
18487
  }
18494
18488
  // eslint-disable-next-line react-hooks/exhaustive-deps
18495
18489
  }, [isReadOnly]);
@@ -18521,18 +18515,18 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18521
18515
  control: control,
18522
18516
  name: 'warningEventType'
18523
18517
  });
18524
- var _React$useState3 = React.useState(function () {
18518
+ var _React$useState4 = React.useState(function () {
18525
18519
  return getDefaultDayRangeForType(getValues('warningEventType'));
18526
18520
  }),
18527
- selectedDays = _React$useState3[0],
18528
- setSelectedDays = _React$useState3[1];
18529
- var _React$useState4 = React.useState(function () {
18521
+ selectedDays = _React$useState4[0],
18522
+ setSelectedDays = _React$useState4[1];
18523
+ var _React$useState5 = React.useState(function () {
18530
18524
  return isDefaultCollapsed ? Object.fromEntries(fields.map(function (field) {
18531
18525
  return [field.id, true];
18532
18526
  })) : {};
18533
18527
  }),
18534
- compactIds = _React$useState4[0],
18535
- setCompactIds = _React$useState4[1];
18528
+ compactIds = _React$useState5[0],
18529
+ setCompactIds = _React$useState5[1];
18536
18530
  // Disable warning type field for warnings which have already been published. EARLY_WARNING should be changeable to WARNING still
18537
18531
  var isWarningTypeDisabled = (selectedEvent == null ? void 0 : selectedEvent.warningEventType) === WarningEventType.WARNING && (eventStatus === PublicWarningStatus.DRAFT_PUBLISHED || eventStatus === PublicWarningStatus.PUBLISHED);
18538
18532
  var revalidateProbabilities = React.useCallback(function () {
@@ -18547,6 +18541,24 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18547
18541
  });
18548
18542
  }, [getValues, trigger]);
18549
18543
  var handleWarningTypeChange = function handleWarningTypeChange(nextType) {
18544
+ var isPublishedEvent = eventStatus === PublicWarningStatus.PUBLISHED || eventStatus === PublicWarningStatus.DRAFT_PUBLISHED;
18545
+ var isUpgradeFromEarlyWarning = warningEventType === WarningEventType.EARLY_WARNING && nextType === WarningEventType.WARNING;
18546
+ if (isPublishedEvent && isUpgradeFromEarlyWarning) {
18547
+ void confirmDialog({
18548
+ title: t('warning-event-type-change-confirm-title'),
18549
+ description: t('warning-event-type-change-confirm-description'),
18550
+ confirmLabel: t('warning-event-type-change-confirm-confirm'),
18551
+ cancelLabel: t('warning-dialog-cancel'),
18552
+ catchOnCancel: true
18553
+ }).then(function () {
18554
+ setSelectedDays(getDefaultDayRangeForType(nextType));
18555
+ })["catch"](function () {
18556
+ setValue('warningEventType', WarningEventType.EARLY_WARNING, {
18557
+ shouldDirty: true
18558
+ });
18559
+ });
18560
+ return;
18561
+ }
18550
18562
  setSelectedDays(getDefaultDayRangeForType(nextType));
18551
18563
  revalidateProbabilities();
18552
18564
  };
@@ -18598,9 +18610,9 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18598
18610
  var timelineRange = React.useMemo(function () {
18599
18611
  return getTimelineRange(selectedDays);
18600
18612
  }, [selectedDays]);
18601
- var _React$useState5 = React.useState(0),
18602
- deleteCount = _React$useState5[0],
18603
- setDeleteCount = _React$useState5[1];
18613
+ var _React$useState6 = React.useState(0),
18614
+ deleteCount = _React$useState6[0],
18615
+ setDeleteCount = _React$useState6[1];
18604
18616
  var onAddWarning = function onAddWarning() {
18605
18617
  var _getValues4;
18606
18618
  var newWarning = buildDefaultWarningItem(getValues());
@@ -18722,6 +18734,7 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18722
18734
  }
18723
18735
  });
18724
18736
  setIsUnpublishedExpiredWithdraw(true);
18737
+ setPendingEventAction(status);
18725
18738
  });
18726
18739
  };
18727
18740
  var onChangeMode = function onChangeMode() {
@@ -18731,6 +18744,15 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18731
18744
  _isRequired = _useDraftFormHelpers2.isRequired;
18732
18745
  var disabledWarningDeleteButton = fields.length <= 1;
18733
18746
  var isNewOrDraftEvent = (selectedEvent == null ? void 0 : selectedEvent.status) === undefined || (selectedEvent == null ? void 0 : selectedEvent.status) === PublicWarningStatus.DRAFT;
18747
+ var publishButtonLabel = function () {
18748
+ if (pendingEventAction === PublicWarningStatus.EXPIRED) {
18749
+ return t('warning-dialog-expire-confirm');
18750
+ }
18751
+ if (pendingEventAction === PublicWarningStatus.WITHDRAWN) {
18752
+ return t('warning-dialog-withdraw-confirm');
18753
+ }
18754
+ return t('public-warning-event-button-publish');
18755
+ }();
18734
18756
  return jsxs(Box, {
18735
18757
  "data-testid": "warning-event-form-scroll-container",
18736
18758
  ref: ref,
@@ -18875,11 +18897,14 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18875
18897
  isDisabled: areEventFieldsDisabled || !isNewOrDraftEvent,
18876
18898
  isReadOnly: isReadOnly,
18877
18899
  isWarningEvent: true,
18878
- onChange: revalidateProbabilities
18900
+ onChange: function onChange() {
18901
+ void trigger('warningEventType');
18902
+ }
18879
18903
  })
18880
18904
  }), jsx(Box, {
18881
18905
  sx: {
18882
- flex: '1.3 1 50'
18906
+ flex: '1 1 145px',
18907
+ minWidth: '145px'
18883
18908
  },
18884
18909
  children: jsx(ReactHookFormSelect, {
18885
18910
  disabled: areEventFieldsDisabled || isWarningTypeDisabled,
@@ -18966,7 +18991,7 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
18966
18991
  position: 'relative'
18967
18992
  },
18968
18993
  children: [jsx(ReactHookFormTextField, {
18969
- disabled: isReadOnly,
18994
+ disabled: areEventFieldsDisabled,
18970
18995
  label: t('public-warning-event-summary'),
18971
18996
  multiline: true,
18972
18997
  name: "texts.headlineOriginal",
@@ -19005,7 +19030,7 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
19005
19030
  sm: 6
19006
19031
  },
19007
19032
  children: [jsx(ReactHookFormTextField, {
19008
- disabled: isReadOnly,
19033
+ disabled: areEventFieldsDisabled,
19009
19034
  label: t('public-warning-event-translation'),
19010
19035
  multiline: true,
19011
19036
  name: "texts.headlineTranslation",
@@ -19148,7 +19173,10 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
19148
19173
  },
19149
19174
  children: [jsx(Button, {
19150
19175
  disabled: isPublishing,
19151
- onClick: onCancel,
19176
+ onClick: function onClick() {
19177
+ setPendingEventAction(null);
19178
+ onCancel();
19179
+ },
19152
19180
  sx: {
19153
19181
  textTransform: 'none',
19154
19182
  fontSize: '12px'
@@ -19192,7 +19220,7 @@ var WarningEventFormContent = function WarningEventFormContent(_ref) {
19192
19220
  fontSize: '12px'
19193
19221
  },
19194
19222
  variant: "primary",
19195
- children: t('public-warning-event-button-publish')
19223
+ children: publishButtonLabel
19196
19224
  })]
19197
19225
  })
19198
19226
  })]
@@ -24281,12 +24309,15 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24281
24309
  var warning = _ref.warning,
24282
24310
  _ref$highlighted = _ref.highlighted,
24283
24311
  highlighted = _ref$highlighted === void 0 ? false : _ref$highlighted,
24312
+ _ref$selected = _ref.selected,
24313
+ selected = _ref$selected === void 0 ? false : _ref$selected,
24284
24314
  left = _ref.left,
24285
24315
  onHoverWarning = _ref.onHoverWarning,
24286
24316
  onSelectWarning = _ref.onSelectWarning,
24287
24317
  top = _ref.top,
24288
24318
  warningListItemActions = _ref.warningListItemActions,
24289
24319
  width = _ref.width;
24320
+ var isHighlighted = highlighted || selected;
24290
24321
  var _useWarningsTranslati = useWarningsTranslation(),
24291
24322
  t = _useWarningsTranslati.t;
24292
24323
  var theme = useTheme();
@@ -24309,10 +24340,15 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24309
24340
  border = _getBlockStyle.border,
24310
24341
  iconColor = _getBlockStyle.iconColor,
24311
24342
  letterColor = _getBlockStyle.letterColor;
24343
+ var isCancelledAviation = isAviation && (warning.productStatus === ProductStatus.CANCELLED || (isCancelAirmet(warning.sigmetAirmetDetails) || isCancelSigmet(warning.sigmetAirmetDetails)) && effectiveStatus !== PublicWarningStatus.DRAFT);
24344
+ var isExpired = effectiveStatus === PublicWarningStatus.EXPIRED;
24345
+ var cancellationColors = theme.palette.geowebColors.cancelledWarningTimeline;
24346
+ var cancellationStyle = isExpired ? cancellationColors.expired : cancellationColors.published;
24347
+ var cancellationHoverStyle = isExpired ? cancellationColors.expiredHover : cancellationColors.publishedHover;
24312
24348
  var size = getBlockSize(width);
24313
24349
  var highlightOutlineColor = theme.palette.geowebColors.typographyAndIcons.iconLinkActive;
24314
24350
  var elements = [];
24315
- if (size === 'l' || width >= MIN_WIDTH_FOR_LETTER) {
24351
+ if (!isCancelledAviation && (size === 'l' || width >= MIN_WIDTH_FOR_LETTER)) {
24316
24352
  elements.push(jsx(Box, {
24317
24353
  sx: {
24318
24354
  fontSize: 16,
@@ -24323,7 +24359,7 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24323
24359
  children: letter
24324
24360
  }, "letter"));
24325
24361
  }
24326
- if (size === 'l' || size === 's') {
24362
+ if (!isCancelledAviation && (size === 'l' || size === 's')) {
24327
24363
  elements.push(jsx(Box, {
24328
24364
  sx: {
24329
24365
  display: 'flex',
@@ -24335,7 +24371,7 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24335
24371
  children: getPhenomenaIcon(warningDetail.phenomenon) || null
24336
24372
  }, "icon"));
24337
24373
  }
24338
- if (size === 'l') {
24374
+ if (!isCancelledAviation && size === 'l') {
24339
24375
  elements.push(jsx(Box, {
24340
24376
  sx: {
24341
24377
  border: '0.5px solid white',
@@ -24346,7 +24382,39 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24346
24382
  })
24347
24383
  }, "avatar"));
24348
24384
  }
24349
- var warningMenu = size !== 'xxs' ? jsx(WarningBlockMenu, {
24385
+ if (isCancelledAviation) {
24386
+ if (size === 'l' || size === 's') {
24387
+ elements.push(jsx(Box, {
24388
+ sx: {
24389
+ fontSize: 16,
24390
+ fontWeight: 600,
24391
+ whiteSpace: 'nowrap'
24392
+ },
24393
+ children: warning.sigmetAirmetDetails.sequence
24394
+ }, "sequence"));
24395
+ if (size === 'l') {
24396
+ elements.push(jsx(Box, {
24397
+ sx: {
24398
+ fontSize: 16,
24399
+ whiteSpace: 'nowrap'
24400
+ },
24401
+ children: isExpired ? 'CNLD' : 'CNL'
24402
+ }, "cancellation-status"));
24403
+ }
24404
+ } else if (size === 'xs') {
24405
+ elements.push(jsx(Box, {
24406
+ "data-testid": "cancelled-warning-icon",
24407
+ sx: {
24408
+ display: 'flex',
24409
+ alignItems: 'center',
24410
+ justifyContent: 'center',
24411
+ fontSize: 18
24412
+ },
24413
+ children: getPhenomenaIcon(warningDetail.phenomenon) || null
24414
+ }, "cancelled-icon"));
24415
+ }
24416
+ }
24417
+ var warningMenu = !isCancelledAviation && size !== 'xxs' ? jsx(WarningBlockMenu, {
24350
24418
  effectiveStatus: effectiveStatus,
24351
24419
  hasWarningContent: elements.length > 0,
24352
24420
  isAviation: isAviation,
@@ -24382,7 +24450,7 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24382
24450
  title: getTooltipContent(warning, t),
24383
24451
  children: jsxs(Box, {
24384
24452
  "aria-label": "warning timeline block for " + ((_warning$id = warning.id) != null ? _warning$id : ''),
24385
- "data-highlighted": highlighted ? 'true' : 'false',
24453
+ "data-highlighted": isHighlighted ? 'true' : 'false',
24386
24454
  "data-testid": "warning-block",
24387
24455
  onClick: function onClick() {
24388
24456
  isTooltipSuppressedRef.current = true;
@@ -24408,7 +24476,7 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24408
24476
  onHoverWarning == null || onHoverWarning(undefined);
24409
24477
  },
24410
24478
  role: "button",
24411
- sx: {
24479
+ sx: Object.assign({
24412
24480
  position: 'absolute',
24413
24481
  left: left,
24414
24482
  top: top,
@@ -24416,20 +24484,21 @@ var WarningBlock = /*#__PURE__*/React.memo(function (_ref) {
24416
24484
  height: 28,
24417
24485
  padding: warningBlockPadding,
24418
24486
  background: background,
24419
- border: border,
24487
+ border: border
24488
+ }, isCancelledAviation ? cancellationStyle : {}, isCancelledAviation && highlighted ? cancellationHoverStyle : {}, {
24420
24489
  borderRadius: 1,
24421
- boxShadow: highlighted ? "0 0 0 2px " + highlightOutlineColor : 'none',
24490
+ boxShadow: isHighlighted ? "0 0 0 2px " + highlightOutlineColor : 'none',
24422
24491
  display: 'flex',
24423
24492
  alignItems: 'center',
24424
24493
  justifyContent: elements.length === 1 ? 'center' : 'space-between',
24425
24494
  overflow: 'hidden',
24426
- zIndex: highlighted ? 11 : 1,
24495
+ zIndex: isHighlighted ? 11 : 1,
24427
24496
  cursor: 'pointer',
24428
- '&:hover': {
24497
+ '&:hover': Object.assign({}, isCancelledAviation ? cancellationHoverStyle : {}, {
24429
24498
  boxShadow: "0 0 0 2px " + highlightOutlineColor,
24430
24499
  zIndex: 11
24431
- }
24432
- },
24500
+ })
24501
+ }),
24433
24502
  tabIndex: 0,
24434
24503
  children: [elements.length ? jsx(Box, {
24435
24504
  sx: {
@@ -24541,10 +24610,11 @@ var WarningBlocksLayer = /*#__PURE__*/React.memo(function (_ref2) {
24541
24610
  return jsx(Fragment, {
24542
24611
  children: warningBlocks.map(function (warningLayout) {
24543
24612
  return jsx(WarningBlock, {
24544
- highlighted: hoveredWarningId === warningLayout.warning.id || selectedWarningId === warningLayout.warning.id,
24613
+ highlighted: hoveredWarningId === warningLayout.warning.id,
24545
24614
  left: warningLayout.left,
24546
24615
  onHoverWarning: onHoverWarning,
24547
24616
  onSelectWarning: onSelectWarning,
24617
+ selected: selectedWarningId === warningLayout.warning.id,
24548
24618
  top: warningLayout.top,
24549
24619
  warning: warningLayout.warning,
24550
24620
  warningListItemActions: warningListItemActions,
@@ -4,6 +4,7 @@ import type { WarningListItemActions } from '../PublicWarningList/WarningListIte
4
4
  interface WarningBlockProps {
5
5
  warning: Warning;
6
6
  highlighted?: boolean;
7
+ selected?: boolean;
7
8
  left: number;
8
9
  onHoverWarning?: (warningId?: string) => void;
9
10
  onSelectWarning?: (warning: Warning) => void;
@@ -11,5 +12,5 @@ interface WarningBlockProps {
11
12
  top: number;
12
13
  width: number;
13
14
  }
14
- export declare const WarningBlock: React.MemoExoticComponent<({ warning, highlighted, left, onHoverWarning, onSelectWarning, top, warningListItemActions, width, }: WarningBlockProps) => React.JSX.Element>;
15
+ export declare const WarningBlock: React.MemoExoticComponent<({ warning, highlighted, selected, left, onHoverWarning, onSelectWarning, top, warningListItemActions, width, }: WarningBlockProps) => React.JSX.Element>;
15
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "20.0.0-nightly-20261001",
3
+ "version": "20.0.1",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,24 +20,24 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/api": "20.0.0-nightly-20261001",
24
- "@opengeoweb/shared": "20.0.0-nightly-20261001",
25
- "@opengeoweb/store": "20.0.0-nightly-20261001",
26
- "@opengeoweb/webmap-react": "20.0.0-nightly-20261001",
23
+ "@opengeoweb/api": "20.0.1",
24
+ "@opengeoweb/shared": "20.0.1",
25
+ "@opengeoweb/store": "20.0.1",
26
+ "@opengeoweb/webmap-react": "20.0.1",
27
27
  "@tanstack/react-query": "^5.85.5",
28
28
  "react-redux": "^9.2.0",
29
- "@opengeoweb/theme": "20.0.0-nightly-20261001",
30
- "@opengeoweb/form-fields": "20.0.0-nightly-20261001",
29
+ "@opengeoweb/theme": "20.0.1",
30
+ "@opengeoweb/form-fields": "20.0.1",
31
31
  "react-hook-form": "^7.50.1",
32
32
  "lodash": "^4.18.1",
33
33
  "@reduxjs/toolkit": "^2.6.1",
34
- "@opengeoweb/snackbar": "20.0.0-nightly-20261001",
34
+ "@opengeoweb/snackbar": "20.0.1",
35
35
  "react-window": "^2.2.6",
36
36
  "axios": "^1.18.0",
37
- "@opengeoweb/core": "20.0.0-nightly-20261001",
38
- "@opengeoweb/webmap": "20.0.0-nightly-20261001",
39
- "@opengeoweb/authentication": "20.0.0-nightly-20261001",
40
- "@opengeoweb/sigmet-airmet": "20.0.0-nightly-20261001",
37
+ "@opengeoweb/core": "20.0.1",
38
+ "@opengeoweb/webmap": "20.0.1",
39
+ "@opengeoweb/authentication": "20.0.1",
40
+ "@opengeoweb/sigmet-airmet": "20.0.1",
41
41
  "react-i18next": "^15.1.1",
42
42
  "i18next": "^25.0.1",
43
43
  "@mui/material": "^9.0.1",