@opengeoweb/warnings 8.2.0 → 8.3.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.
Files changed (23) hide show
  1. package/index.esm.js +527 -219
  2. package/package.json +11 -10
  3. package/src/lib/components/DrawingTool/DrawingTool.stories.d.ts +2 -2
  4. package/src/lib/components/DrawingTool/DrawingToolConnect.d.ts +1 -2
  5. package/src/lib/components/DrawingTool/DrawingToolDialog.d.ts +0 -1
  6. package/src/lib/components/ObjectManager/ObjectManager.d.ts +3 -0
  7. package/src/lib/components/ObjectManager/Objects.d.ts +8 -0
  8. package/src/lib/components/PublicWarnings/PublicWarnings.d.ts +1 -0
  9. package/src/lib/components/PublicWarnings/PublicWarningsConnect.d.ts +0 -1
  10. package/src/lib/components/PublicWarningsForm/AreaField.d.ts +5 -0
  11. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +13 -2
  12. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +8 -0
  13. package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnect.d.ts +2 -0
  14. package/src/lib/components/PublicWarningsForm/index.d.ts +1 -0
  15. package/src/lib/store/config.d.ts +3 -0
  16. package/src/lib/store/drawings/types.d.ts +14 -1
  17. package/src/lib/store/publicWarningForm/reducer.d.ts +12 -0
  18. package/src/lib/store/publicWarningForm/reducer.spec.d.ts +1 -0
  19. package/src/lib/store/publicWarningForm/selectors.d.ts +8 -0
  20. package/src/lib/store/publicWarningForm/selectors.spec.d.ts +1 -0
  21. package/src/lib/store/publicWarningForm/utils.d.ts +2 -0
  22. package/src/lib/utils/constants.d.ts +2 -0
  23. /package/src/lib/components/{DrawingToolForm/DrawingToolFormConnect.spec.d.ts → PublicWarningsForm/PublicWarningsFormConnect.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useContext, useRef, useCallback, useDebugValue, Fragment, useState, useEffect } from 'react';
3
3
  import 'react-dom';
4
- import { Polygons, Edit, Delete, DrawPolygon, Visibility, Add, breakpoints } from '@opengeoweb/theme';
5
- import { uiActions, uiTypes, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, snackbarActions, getGeoJSONPropertyValue } from '@opengeoweb/store';
6
- import { emptyGeoJSON, MapControlButton, getIcon, currentlySupportedDrawModes } from '@opengeoweb/webmap-react';
4
+ import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, breakpoints, CoastalEvent, Fog, TemperatureHigh, TemperatureLow, Rain, Snow, Lightning, Wind } from '@opengeoweb/theme';
5
+ import { uiActions, uiTypes, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, snackbarActions } from '@opengeoweb/store';
6
+ import { emptyGeoJSON, MapControlButton, getGeoJSONPropertyValue, getIcon, currentlySupportedDrawModes } from '@opengeoweb/webmap-react';
7
7
  import { useSetupDialog } from '@opengeoweb/core';
8
8
  import { dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, CustomIconButton, SwitchButton, isAxiosError } from '@opengeoweb/shared';
9
- import { Typography, List, ListItem, Paper, ListItemButton, Box, Stack, LinearProgress, Grid, FormHelperText, MenuItem, Button, Tabs, Tab, FormControl, Card, CardContent, styled, FormControlLabel, Radio } from '@mui/material';
9
+ import { Typography, List, ListItem, Paper, ListItemButton, Stack, LinearProgress, Box, Button, Grid, FormHelperText, MenuItem, Tabs, Tab, FormControl, Card, CardContent, styled, ListItemIcon, FormControlLabel, Radio } from '@mui/material';
10
10
  import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
11
11
  import { ReactHookFormProvider, defaultFormOptions, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormDateTime, ReactHookFormRadioGroup } from '@opengeoweb/form-fields';
12
12
 
@@ -2439,9 +2439,9 @@ var drawAdapter = createEntityAdapter({
2439
2439
  return draw.drawingInstanceId;
2440
2440
  }
2441
2441
  });
2442
- var initialState = drawAdapter.getInitialState();
2443
- var slice = createSlice({
2444
- initialState: initialState,
2442
+ var initialState$1 = drawAdapter.getInitialState();
2443
+ var slice$1 = createSlice({
2444
+ initialState: initialState$1,
2445
2445
  name: 'draw',
2446
2446
  reducers: {
2447
2447
  setDrawValues: function setDrawValues(draft, action) {
@@ -2474,8 +2474,8 @@ var slice = createSlice({
2474
2474
  });
2475
2475
  }
2476
2476
  });
2477
- var reducer = slice.reducer;
2478
- var drawActions = slice.actions;
2477
+ var reducer$1 = slice$1.reducer;
2478
+ var drawActions = slice$1.actions;
2479
2479
 
2480
2480
  /* *
2481
2481
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3215,6 +3215,25 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
3215
3215
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3216
3216
  };
3217
3217
 
3218
+ /* *
3219
+ * Licensed under the Apache License, Version 2.0 (the "License");
3220
+ * you may not use this file except in compliance with the License.
3221
+ * You may obtain a copy of the License at
3222
+ *
3223
+ * http://www.apache.org/licenses/LICENSE-2.0
3224
+ *
3225
+ * Unless required by applicable law or agreed to in writing, software
3226
+ * distributed under the License is distributed on an "AS IS" BASIS,
3227
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3228
+ * See the License for the specific language governing permissions and
3229
+ * limitations under the License.
3230
+ *
3231
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3232
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3233
+ * */
3234
+ var DATE_FORMAT = 'dd/MM/yyyy HH:mm';
3235
+ var DATE_FORMAT_UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";
3236
+
3218
3237
  /* *
3219
3238
  * Licensed under the Apache License, Version 2.0 (the "License");
3220
3239
  * you may not use this file except in compliance with the License.
@@ -3232,11 +3251,19 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
3232
3251
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
3233
3252
  * */
3234
3253
  var NO_OBJECTS_FOUND = 'No objects found';
3254
+ var BUTTON_EDIT$1 = 'Edit';
3255
+ var BUTTON_DELETE$1 = 'Delete';
3256
+ var BUTTON_SHARE = 'Share';
3257
+ var BUTTON_AIRMET = 'AIRMET';
3258
+ var BUTTON_SIGMET = 'SIGMET';
3259
+ var BUTTON_PUBLIC_WARNING = 'PUBLIC WARNING';
3260
+ var MENU_SHARE = 'Share object to';
3235
3261
  var Objects = function Objects(_ref) {
3236
3262
  var objects = _ref.objects,
3237
3263
  onClickObject = _ref.onClickObject,
3238
3264
  onClickEdit = _ref.onClickEdit,
3239
3265
  onClickDelete = _ref.onClickDelete,
3266
+ onClickShare = _ref.onClickShare,
3240
3267
  activeObject = _ref.activeObject,
3241
3268
  _ref$isLoading = _ref.isLoading,
3242
3269
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
@@ -3250,7 +3277,12 @@ var Objects = function Objects(_ref) {
3250
3277
  variant: "body1"
3251
3278
  }, NO_OBJECTS_FOUND);
3252
3279
  }
3253
- return /*#__PURE__*/React__default.createElement(List, null, objects.map(function (object) {
3280
+ return /*#__PURE__*/React__default.createElement(List, {
3281
+ sx: {
3282
+ height: 'calc( 100% - 80px )',
3283
+ overflow: 'auto'
3284
+ }
3285
+ }, objects.map(function (object) {
3254
3286
  var objectDate = dateUtils.isoStringToDate(object.lastUpdatedTime);
3255
3287
  var header = dateUtils.dateToString(objectDate, 'EEEE, MMMM dd', true);
3256
3288
  var isNewDay = !headerList.find(function (item) {
@@ -3263,56 +3295,88 @@ var Objects = function Objects(_ref) {
3263
3295
  key: object.id
3264
3296
  }, isNewDay && /*#__PURE__*/React__default.createElement(Typography, {
3265
3297
  sx: {
3266
- paddingLeft: '20px'
3298
+ paddingLeft: 2.5,
3299
+ opacity: 0.67
3267
3300
  },
3268
3301
  variant: "caption"
3269
- }, header), /*#__PURE__*/React__default.createElement(ListItem, Object.assign({
3270
- disablePadding: true
3271
- }, object.scope === 'user' && {
3272
- secondaryAction: /*#__PURE__*/React__default.createElement(ToggleMenu, {
3302
+ }, header), /*#__PURE__*/React__default.createElement(ListItem, {
3303
+ disablePadding: true,
3304
+ sx: {
3305
+ '& .MuiListItemSecondaryAction-root': {
3306
+ right: '8px'
3307
+ }
3308
+ },
3309
+ secondaryAction: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ToggleMenu, {
3310
+ buttonSx: {
3311
+ marginRight: object.scope === 'user' ? 1 : 4
3312
+ },
3313
+ buttonIcon: /*#__PURE__*/React__default.createElement(Share, null),
3314
+ menuTitle: MENU_SHARE,
3315
+ tooltipTitle: BUTTON_SHARE,
3316
+ menuPosition: "bottom",
3317
+ "aria-label": BUTTON_SHARE,
3318
+ menuItems: [{
3319
+ text: BUTTON_AIRMET,
3320
+ action: function action() {},
3321
+ icon: /*#__PURE__*/React__default.createElement(ExitDomain, null),
3322
+ isDisabled: true
3323
+ }, {
3324
+ text: BUTTON_SIGMET,
3325
+ action: function action() {},
3326
+ icon: /*#__PURE__*/React__default.createElement(ExitDomain, null),
3327
+ isDisabled: true
3328
+ }, {
3329
+ text: BUTTON_PUBLIC_WARNING,
3330
+ action: function action() {
3331
+ onClickShare(object);
3332
+ },
3333
+ icon: /*#__PURE__*/React__default.createElement(ExitDomain, null)
3334
+ }]
3335
+ }), object.scope === 'user' && /*#__PURE__*/React__default.createElement(ToggleMenu, {
3273
3336
  menuTitle: "Object options",
3274
3337
  tooltipTitle: "Object options",
3275
3338
  menuPosition: "bottom",
3276
3339
  "aria-label": "Options",
3277
3340
  menuItems: [{
3278
- text: 'Edit',
3341
+ text: BUTTON_EDIT$1,
3279
3342
  action: function action() {
3280
3343
  onClickEdit(object.id);
3281
3344
  },
3282
3345
  icon: /*#__PURE__*/React__default.createElement(Edit, null)
3283
3346
  }, {
3284
- text: 'Delete',
3347
+ text: BUTTON_DELETE$1,
3285
3348
  action: function action() {
3286
3349
  onClickDelete(object.id);
3287
3350
  },
3288
3351
  icon: /*#__PURE__*/React__default.createElement(Delete, null)
3289
3352
  }]
3290
- })
3291
- }), /*#__PURE__*/React__default.createElement(Paper, {
3292
- elevation: 1,
3353
+ }))
3354
+ }, /*#__PURE__*/React__default.createElement(Paper, {
3355
+ elevation: 0,
3293
3356
  sx: {
3294
3357
  width: '100%',
3295
- margin: 0.5,
3296
- backgroundColor: 'geowebColors.background.surface'
3358
+ margin: 0.25,
3359
+ backgroundColor: 'geowebColors.background.surface',
3360
+ border: 'solid 1px',
3361
+ borderColor: 'geowebColors.cards.cardContainerBorder'
3297
3362
  }
3298
3363
  }, /*#__PURE__*/React__default.createElement(ListItemButton, {
3299
3364
  onClick: function onClick() {
3300
3365
  onClickObject(object);
3301
- }
3302
- }, activeObject === object.id && /*#__PURE__*/React__default.createElement(Box, {
3303
- sx: {
3304
- backgroundColor: 'geowebColors.captions.captionInformation.color',
3305
- width: '4px',
3306
- height: '100%',
3307
- position: 'absolute',
3308
- left: 0
3309
3366
  },
3310
- className: "active"
3311
- }), /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Typography, {
3367
+ selected: activeObject === object.id,
3368
+ sx: {
3369
+ padding: 1,
3370
+ height: '44px'
3371
+ }
3372
+ }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Typography, {
3312
3373
  variant: "caption"
3313
- }, object.scope === 'global' && 'Global: ', dateUtils.dateToString(objectDate, 'dd/MM/yyyy HH:ss', true), ' ', "UTC"), /*#__PURE__*/React__default.createElement(Typography, {
3314
- variant: "body2"
3315
- }, object.objectName))))));
3374
+ }, object.objectName), /*#__PURE__*/React__default.createElement(Typography, {
3375
+ variant: "caption",
3376
+ sx: {
3377
+ opacity: 0.67
3378
+ }
3379
+ }, object.scope === 'global' && 'Global: ', dateUtils.dateToString(objectDate, DATE_FORMAT, true), ' ', "UTC"))))));
3316
3380
  }));
3317
3381
  };
3318
3382
 
@@ -3328,6 +3392,7 @@ var DEFAULT_OBJECT_MANAGER_MIN_SIZE = {
3328
3392
  width: 160,
3329
3393
  height: 300
3330
3394
  };
3395
+ var BUTTON_ADD_OBJECT$1 = 'Add a new object';
3331
3396
  var ObjectManager = function ObjectManager(_ref) {
3332
3397
  var bounds = _ref.bounds,
3333
3398
  onClose = _ref.onClose,
@@ -3355,6 +3420,10 @@ var ObjectManager = function ObjectManager(_ref) {
3355
3420
  onEditDrawing = _ref$onEditDrawing === void 0 ? function () {} : _ref$onEditDrawing,
3356
3421
  _ref$onDeleteDrawing = _ref.onDeleteDrawing,
3357
3422
  onDeleteDrawing = _ref$onDeleteDrawing === void 0 ? function () {} : _ref$onDeleteDrawing,
3423
+ _ref$onShareObject = _ref.onShareObject,
3424
+ onShareObject = _ref$onShareObject === void 0 ? function () {} : _ref$onShareObject,
3425
+ _ref$onCreateNewObjec = _ref.onCreateNewObject,
3426
+ onCreateNewObject = _ref$onCreateNewObjec === void 0 ? function () {} : _ref$onCreateNewObjec,
3358
3427
  _ref$activeDrawingId = _ref.activeDrawingId,
3359
3428
  activeDrawingId = _ref$activeDrawingId === void 0 ? '' : _ref$activeDrawingId,
3360
3429
  error = _ref.error,
@@ -3397,6 +3466,12 @@ var ObjectManager = function ObjectManager(_ref) {
3397
3466
  if (dragSize !== sizeInState) {
3398
3467
  setSizeInState(dragSize);
3399
3468
  }
3469
+ },
3470
+ sx: {
3471
+ footer: {
3472
+ backgroundColor: 'inherit',
3473
+ boxShadow: 'none'
3474
+ }
3400
3475
  }
3401
3476
  }, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
3402
3477
  "data-testid": "loading-bar",
@@ -3414,9 +3489,28 @@ var ObjectManager = function ObjectManager(_ref) {
3414
3489
  onClickObject: onClickDrawing,
3415
3490
  onClickEdit: onEditDrawing,
3416
3491
  onClickDelete: onDeleteDrawing,
3492
+ onClickShare: onShareObject,
3417
3493
  activeObject: activeDrawingId,
3418
3494
  isLoading: isLoading
3419
- }));
3495
+ }), /*#__PURE__*/React.createElement(Box, {
3496
+ sx: {
3497
+ padding: '24px 8px 16px 8px',
3498
+ position: 'absolute',
3499
+ bottom: 0,
3500
+ width: '100%',
3501
+ backgroundColor: 'geowebColors.background.surfaceApp',
3502
+ boxShadow: '0 2px 4px 0 rgba(0, 0, 0, 0.5)',
3503
+ zIndex: 1
3504
+ }
3505
+ }, /*#__PURE__*/React.createElement(Button, {
3506
+ variant: "tertiary",
3507
+ onClick: onCreateNewObject,
3508
+ sx: {
3509
+ width: '100%',
3510
+ textTransform: 'none',
3511
+ fontSize: '12px'
3512
+ }
3513
+ }, BUTTON_ADD_OBJECT$1)));
3420
3514
  };
3421
3515
 
3422
3516
  /* *
@@ -3573,6 +3667,63 @@ var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
3573
3667
  }));
3574
3668
  };
3575
3669
 
3670
+ /* *
3671
+ * Licensed under the Apache License, Version 2.0 (the "License");
3672
+ * you may not use this file except in compliance with the License.
3673
+ * You may obtain a copy of the License at
3674
+ *
3675
+ * http://www.apache.org/licenses/LICENSE-2.0
3676
+ *
3677
+ * Unless required by applicable law or agreed to in writing, software
3678
+ * distributed under the License is distributed on an "AS IS" BASIS,
3679
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3680
+ * See the License for the specific language governing permissions and
3681
+ * limitations under the License.
3682
+ *
3683
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3684
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3685
+ * */
3686
+ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
3687
+
3688
+ /* *
3689
+ * Licensed under the Apache License, Version 2.0 (the "License");
3690
+ * you may not use this file except in compliance with the License.
3691
+ * You may obtain a copy of the License at
3692
+ *
3693
+ * http://www.apache.org/licenses/LICENSE-2.0
3694
+ *
3695
+ * Unless required by applicable law or agreed to in writing, software
3696
+ * distributed under the License is distributed on an "AS IS" BASIS,
3697
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3698
+ * See the License for the specific language governing permissions and
3699
+ * limitations under the License.
3700
+ *
3701
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3702
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
3703
+ * */
3704
+ var initialState = {};
3705
+ var slice = createSlice({
3706
+ initialState: initialState,
3707
+ name: 'publicWarningForm',
3708
+ reducers: {
3709
+ setFormValues: function setFormValues(draft, action) {
3710
+ draft.object = action.payload.object;
3711
+ }
3712
+ },
3713
+ extraReducers: function extraReducers(builder) {
3714
+ builder.addCase(uiActions.setToggleOpenDialog, function (draft, action) {
3715
+ var _action$payload = action.payload,
3716
+ type = _action$payload.type,
3717
+ setOpen = _action$payload.setOpen;
3718
+ if (type === publicWarningDialogType && setOpen === false) {
3719
+ delete draft.object;
3720
+ }
3721
+ });
3722
+ }
3723
+ });
3724
+ var reducer = slice.reducer;
3725
+ var publicWarningActions = slice.actions;
3726
+
3576
3727
  var getDeleteSucces = function getDeleteSucces(objectName) {
3577
3728
  return "".concat(objectName, " has been deleted");
3578
3729
  };
@@ -3758,6 +3909,23 @@ var ObjectManagerConnect = function ObjectManagerConnect(_ref) {
3758
3909
  var onClose = function onClose() {
3759
3910
  closeObjectDialog();
3760
3911
  };
3912
+ var onShareObject = function onShareObject(object) {
3913
+ dispatch(publicWarningActions.setFormValues({
3914
+ object: {
3915
+ id: object.id,
3916
+ lastUpdatedTime: object.lastUpdatedTime,
3917
+ objectName: object.objectName
3918
+ }
3919
+ }));
3920
+ dispatch(uiActions.setToggleOpenDialog({
3921
+ setOpen: true,
3922
+ type: publicWarningDialogType
3923
+ }));
3924
+ };
3925
+ var onCreateNewObject = function onCreateNewObject() {
3926
+ closeObjectDialog();
3927
+ openDrawDialog();
3928
+ };
3761
3929
  var onDeleteSuccess = function onDeleteSuccess(objectId, objectName) {
3762
3930
  // close confirm dialog
3763
3931
  setConfirmDialogOptions(undefined);
@@ -3799,6 +3967,8 @@ var ObjectManagerConnect = function ObjectManagerConnect(_ref) {
3799
3967
  onClickDrawing: onClickDrawing,
3800
3968
  onEditDrawing: onEditDrawing,
3801
3969
  onDeleteDrawing: onDeleteDrawing,
3970
+ onShareObject: onShareObject,
3971
+ onCreateNewObject: onCreateNewObject,
3802
3972
  activeDrawingId: activeDrawingId,
3803
3973
  error: uiError,
3804
3974
  isLoading: loading
@@ -4825,8 +4995,6 @@ var DrawingTool = function DrawingTool(_ref) {
4825
4995
  source = _ref$source === void 0 ? 'app' : _ref$source,
4826
4996
  _ref$isLoading = _ref.isLoading,
4827
4997
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
4828
- _ref$isDocked = _ref.isDocked,
4829
- isDocked = _ref$isDocked === void 0 ? false : _ref$isDocked,
4830
4998
  _ref$size = _ref.size,
4831
4999
  size = _ref$size === void 0 ? DERFAULT_DRAW_TOOL_SIZE : _ref$size,
4832
5000
  _ref$startPosition = _ref.startPosition,
@@ -4842,12 +5010,6 @@ var DrawingTool = function DrawingTool(_ref) {
4842
5010
  _React$useState2 = _slicedToArray(_React$useState, 2),
4843
5011
  sizeInState = _React$useState2[0],
4844
5012
  setSizeInState = _React$useState2[1];
4845
- React.useEffect(function () {
4846
- if (size !== sizeInState && isDocked && isOpen) {
4847
- setSizeInState(size);
4848
- }
4849
- // eslint-disable-next-line react-hooks/exhaustive-deps
4850
- }, [size, isOpen]);
4851
5013
  return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
4852
5014
  title: title,
4853
5015
  startSize: sizeInState,
@@ -4874,21 +5036,6 @@ var DrawingTool = function DrawingTool(_ref) {
4874
5036
  boxShadow: 'none'
4875
5037
  }
4876
5038
  },
4877
- // TODO: Re-enable when we put back in the floating version when drawing tools become available: https://gitlab.com/opengeoweb/opengeoweb/-/issues/3872
4878
- // rightHeaderComponent={
4879
- // <CustomIconButton
4880
- // tooltipTitle={isDocked ? 'Undock' : 'Dock'}
4881
- // data-testid="dockedBtn"
4882
- // disableRipple
4883
- // onClick={(): void => onToggleDock()}
4884
- // >
4885
- // {isDocked ? (
4886
- // <CollapseWindow data-testid="dockedDrawingTool-collapse" />
4887
- // ) : (
4888
- // <ExpandWindow data-testid="dockedDrawingTool-uncollapse" />
4889
- // )}
4890
- // </CustomIconButton>
4891
- // }
4892
5039
  onResizeStop: function onResizeStop(_event, _direction, node) {
4893
5040
  var width = node.offsetWidth,
4894
5041
  height = node.offsetHeight;
@@ -22155,7 +22302,7 @@ var lodash = {exports: {}};
22155
22302
 
22156
22303
  var opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
22157
22304
  var getObjectName = function getObjectName(objectName) {
22158
- return objectName || "".concat(dateUtils.dateToString(new Date(), 'dd/MM/yyyy HH:mm', true), " UTC");
22305
+ return objectName || "".concat(dateUtils.dateToString(new Date(), DATE_FORMAT, true), " UTC");
22159
22306
  };
22160
22307
  var SAVE_OBJECT_BUTTON = 'Save new object';
22161
22308
  var UPDATE_OBJECT_BUTTON = 'Update object';
@@ -22283,7 +22430,8 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
22283
22430
  },
22284
22431
  "data-testid": mode.drawModeId,
22285
22432
  onKeyDown: onKeyDown,
22286
- disabled: isLoading
22433
+ disabled: isLoading,
22434
+ size: "medium"
22287
22435
  }, getIcon(mode.drawModeId));
22288
22436
  }), isInEditMode && /*#__PURE__*/React.createElement(Typography, {
22289
22437
  component: "span",
@@ -22359,7 +22507,8 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
22359
22507
  onClick: onSubmit,
22360
22508
  sx: {
22361
22509
  width: '100%',
22362
- textTransform: 'none'
22510
+ textTransform: 'none',
22511
+ fontSize: '12px'
22363
22512
  },
22364
22513
  "data-testid": "saveDrawingFormButton",
22365
22514
  disabled: isLoading || hasErrors
@@ -22499,10 +22648,7 @@ var DrawingToolFormConnect = function DrawingToolFormConnect() {
22499
22648
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
22500
22649
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
22501
22650
  * */
22502
- var getDialogType = function getDialogType(mapId, isMultiMap, isDocked) {
22503
- if (isDocked) {
22504
- return "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
22505
- }
22651
+ var getDialogType = function getDialogType(mapId, isMultiMap) {
22506
22652
  if (isMultiMap) {
22507
22653
  return "".concat(uiTypes.DialogTypes.DrawingTool, "-").concat(mapId);
22508
22654
  }
@@ -22518,15 +22664,13 @@ var DrawingToolConnect = function DrawingToolConnect(_ref) {
22518
22664
  initialMapId = _ref$mapId === void 0 ? null : _ref$mapId,
22519
22665
  _ref$isMultiMap = _ref.isMultiMap,
22520
22666
  isMultiMap = _ref$isMultiMap === void 0 ? false : _ref$isMultiMap,
22521
- _ref$isDocked = _ref.isDocked,
22522
- isDocked = _ref$isDocked === void 0 ? false : _ref$isDocked,
22523
22667
  _ref$source = _ref.source,
22524
22668
  source = _ref$source === void 0 ? 'app' : _ref$source;
22525
- var dialogType = getDialogType(initialMapId, isMultiMap, isDocked);
22669
+ var dialogType = getDialogType(initialMapId, isMultiMap);
22526
22670
  var activeMapId = useSelector(function (store) {
22527
22671
  return uiSelectors.getDialogMapId(store, dialogType);
22528
22672
  });
22529
- // In case of a docked drawing toolbox or multimap, use the map id that is passed
22673
+ // In case of a multimap, use the map id that is passed
22530
22674
  // For floating drawingtoolbox, use the currently active, selected mapid
22531
22675
  var mapId = initialMapId || activeMapId;
22532
22676
  var _useCloseDrawDialog = useCloseDrawDialog({
@@ -22541,29 +22685,6 @@ var DrawingToolConnect = function DrawingToolConnect(_ref) {
22541
22685
  uiSource = _useSetupDialog.uiSource,
22542
22686
  uiIsLoading = _useSetupDialog.uiIsLoading,
22543
22687
  setFocused = _useSetupDialog.setFocused;
22544
- // TODO: Re-enable when we put back in the floating version when drawing tools become available: https://gitlab.com/opengeoweb/opengeoweb/-/issues/3872
22545
- // const onToggleDock = (): void => {
22546
- // onCloseDialog();
22547
- // if (isDocked) {
22548
- // // Close docked drawingtool and open the floating drawingtool
22549
- // dispatch(
22550
- // uiActions.setActiveMapIdForDialog({
22551
- // type: uiTypes.DialogTypes.DrawingTool,
22552
- // mapId,
22553
- // setOpen: true,
22554
- // source,
22555
- // }),
22556
- // );
22557
- // } else {
22558
- // // Close the floating drawingtool and open docked drawingtool
22559
- // dispatch(
22560
- // uiActions.setToggleOpenDialog({
22561
- // type: `${uiTypes.DialogTypes.DockedDrawingTool}-${mapId}`,
22562
- // setOpen: true,
22563
- // }),
22564
- // );
22565
- // }
22566
- // };
22567
22688
  var shownTitle = showMapIdInTitle ? "".concat(title, " ").concat(mapId) : title;
22568
22689
  var onClose = function onClose() {
22569
22690
  closeDrawDialog();
@@ -22593,10 +22714,8 @@ var DrawingToolConnect = function DrawingToolConnect(_ref) {
22593
22714
  order: dialogOrder,
22594
22715
  source: uiSource,
22595
22716
  isLoading: uiIsLoading,
22596
- // onToggleDock={onToggleDock}
22597
22717
  setFocused: setFocused,
22598
22718
  headerSize: "xs",
22599
- isDocked: isDocked,
22600
22719
  startPosition: {
22601
22720
  top: 134,
22602
22721
  left: 50
@@ -22604,6 +22723,106 @@ var DrawingToolConnect = function DrawingToolConnect(_ref) {
22604
22723
  }, /*#__PURE__*/React.createElement(DrawingToolFormConnect, null));
22605
22724
  };
22606
22725
 
22726
+ var DEFAULT_WARNING_DIALOG_SIZE = {
22727
+ width: 320,
22728
+ height: 800
22729
+ };
22730
+ var DEFAULT_WARNING_DIALOG_POSITION = {
22731
+ top: 8,
22732
+ left: 60
22733
+ };
22734
+ var DEFAULT_WARNING_DIALOG_MIN_SIZE = {
22735
+ width: 320,
22736
+ height: 300
22737
+ };
22738
+ var DIALOG_TITLE = 'Public Warning';
22739
+ var PublicWarnings = function PublicWarnings(_ref) {
22740
+ var bounds = _ref.bounds,
22741
+ onClose = _ref.onClose,
22742
+ _ref$title = _ref.title,
22743
+ title = _ref$title === void 0 ? DIALOG_TITLE : _ref$title,
22744
+ isOpen = _ref.isOpen,
22745
+ _ref$onMouseDown = _ref.onMouseDown,
22746
+ onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
22747
+ _ref$order = _ref.order,
22748
+ order = _ref$order === void 0 ? 0 : _ref$order,
22749
+ _ref$source = _ref.source,
22750
+ source = _ref$source === void 0 ? 'app' : _ref$source,
22751
+ _ref$size = _ref.size,
22752
+ size = _ref$size === void 0 ? DEFAULT_WARNING_DIALOG_SIZE : _ref$size,
22753
+ _ref$startPosition = _ref.startPosition,
22754
+ startPosition = _ref$startPosition === void 0 ? DEFAULT_WARNING_DIALOG_POSITION : _ref$startPosition,
22755
+ _ref$setFocused = _ref.setFocused,
22756
+ setFocused = _ref$setFocused === void 0 ? function () {} : _ref$setFocused,
22757
+ _ref$headerSize = _ref.headerSize,
22758
+ headerSize = _ref$headerSize === void 0 ? 'xs' : _ref$headerSize,
22759
+ children = _ref.children;
22760
+ var minSize = DEFAULT_WARNING_DIALOG_MIN_SIZE;
22761
+ var startSizeCalc = calculateStartSize(minSize, size, startPosition);
22762
+ var _React$useState = React.useState(startSizeCalc),
22763
+ _React$useState2 = _slicedToArray(_React$useState, 2),
22764
+ sizeInState = _React$useState2[0],
22765
+ setSizeInState = _React$useState2[1];
22766
+ return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
22767
+ title: title,
22768
+ startSize: sizeInState,
22769
+ minWidth: minSize.width,
22770
+ minHeight: minSize.height,
22771
+ startPosition: startPosition,
22772
+ isOpen: isOpen,
22773
+ onClose: onClose,
22774
+ headerSize: headerSize,
22775
+ bounds: bounds,
22776
+ onMouseDown: onMouseDown,
22777
+ onFocus: function onFocus() {
22778
+ return setFocused(true);
22779
+ },
22780
+ onBlur: function onBlur() {
22781
+ return setFocused(false);
22782
+ },
22783
+ order: order,
22784
+ source: source,
22785
+ onResizeStop: function onResizeStop(_event, _direction, node) {
22786
+ var width = node.offsetWidth,
22787
+ height = node.offsetHeight;
22788
+ setSizeInState({
22789
+ width: width,
22790
+ height: height
22791
+ });
22792
+ },
22793
+ onDragEnd: function onDragEnd(_position, dragSize) {
22794
+ if (dragSize !== sizeInState) {
22795
+ setSizeInState(dragSize);
22796
+ }
22797
+ },
22798
+ leftHeaderComponent: /*#__PURE__*/React.createElement("div", null),
22799
+ rightHeaderComponent: /*#__PURE__*/React.createElement(Box, {
22800
+ sx: {
22801
+ flex: 1,
22802
+ overflow: 'hidden',
22803
+ display: 'flex',
22804
+ justifyContent: 'flex-end',
22805
+ position: 'absolute',
22806
+ right: 32,
22807
+ backgroundColor: 'geowebColors.background.surface',
22808
+ height: 24,
22809
+ paddingLeft: 1
22810
+ }
22811
+ }, /*#__PURE__*/React.createElement(Box, {
22812
+ sx: {
22813
+ position: 'relative',
22814
+ top: -7
22815
+ }
22816
+ }, /*#__PURE__*/React.createElement(SwitchButton, null))),
22817
+ sx: {
22818
+ footer: {
22819
+ backgroundColor: 'inherit',
22820
+ boxShadow: 'none'
22821
+ }
22822
+ }
22823
+ }, children);
22824
+ };
22825
+
22607
22826
  var LABEL_DESCRIPTION_ORIGINAL = 'Description original';
22608
22827
  var LABEL_DESCRIPTION_TRANSLATION = 'Description translation';
22609
22828
  function a11yProps(index) {
@@ -22636,7 +22855,8 @@ var CustomTabPanel = function CustomTabPanel(props) {
22636
22855
  sx: {
22637
22856
  position: 'absolute',
22638
22857
  zIndex: 1,
22639
- width: 122,
22858
+ width: '50%',
22859
+ maxWidth: '360px',
22640
22860
  paddingLeft: 1.5,
22641
22861
  '.MuiInputBase-root': {
22642
22862
  marginTop: 0,
@@ -22717,6 +22937,10 @@ var BUTTON_DELETE = 'Delete';
22717
22937
  var BUTTON_VIEW = 'View';
22718
22938
  var BUTTON_EDIT = 'Edit';
22719
22939
  var OBJECTS_MENU = 'Object options';
22940
+ var NO_OBJECT = 'No object selected';
22941
+ var formatDate = function formatDate(lastUpdatedTime) {
22942
+ return dateUtils.dateToString(dateUtils.isoStringToDate(lastUpdatedTime), "".concat(DATE_FORMAT, " 'UTC'"));
22943
+ };
22720
22944
  var AreaField = function AreaField(_ref) {
22721
22945
  var _ref$onEditObject = _ref.onEditObject,
22722
22946
  onEditObject = _ref$onEditObject === void 0 ? function () {} : _ref$onEditObject,
@@ -22727,7 +22951,13 @@ var AreaField = function AreaField(_ref) {
22727
22951
  _ref$onAddObject = _ref.onAddObject,
22728
22952
  onAddObject = _ref$onAddObject === void 0 ? function () {} : _ref$onAddObject,
22729
22953
  _ref$isDisabled = _ref.isDisabled,
22730
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
22954
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
22955
+ _ref$id = _ref.id,
22956
+ id = _ref$id === void 0 ? '' : _ref$id,
22957
+ _ref$lastUpdatedTime = _ref.lastUpdatedTime,
22958
+ lastUpdatedTime = _ref$lastUpdatedTime === void 0 ? '' : _ref$lastUpdatedTime,
22959
+ _ref$objectName = _ref.objectName,
22960
+ objectName = _ref$objectName === void 0 ? NO_OBJECT : _ref$objectName;
22731
22961
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography, {
22732
22962
  variant: "h3",
22733
22963
  color: "text.secondary",
@@ -22754,11 +22984,12 @@ var AreaField = function AreaField(_ref) {
22754
22984
  fontSize: '0.75rem',
22755
22985
  fontWeight: 'normal',
22756
22986
  lineHeight: 1.83
22757
- }
22758
- }, "Object name"), /*#__PURE__*/React__default.createElement(Typography, {
22987
+ },
22988
+ role: "heading"
22989
+ }, objectName), /*#__PURE__*/React__default.createElement(Typography, {
22759
22990
  variant: "body2",
22760
22991
  color: "text.secondary"
22761
- }, "09/01/2023 21:00 UTC"), /*#__PURE__*/React__default.createElement(ToggleMenu, {
22992
+ }, lastUpdatedTime ? formatDate(lastUpdatedTime) : ''), id ? /*#__PURE__*/React__default.createElement(ToggleMenu, {
22762
22993
  menuTitle: OBJECTS_MENU,
22763
22994
  tooltipTitle: OBJECTS_MENU,
22764
22995
  buttonSx: {
@@ -22784,7 +23015,9 @@ var AreaField = function AreaField(_ref) {
22784
23015
  action: onDeleteObject,
22785
23016
  icon: /*#__PURE__*/React__default.createElement(Delete, null)
22786
23017
  }]
22787
- }))), /*#__PURE__*/React__default.createElement(Button, {
23018
+ }) : null)), /*#__PURE__*/React__default.createElement(ReactHookFormHiddenInput, {
23019
+ name: "objectId"
23020
+ }), /*#__PURE__*/React__default.createElement(Button, {
22788
23021
  sx: {
22789
23022
  marginTop: 1
22790
23023
  },
@@ -22796,6 +23029,23 @@ var AreaField = function AreaField(_ref) {
22796
23029
  }, BUTTON_ADD_OBJECT));
22797
23030
  };
22798
23031
 
23032
+ var getEmptyPublicWarning = function getEmptyPublicWarning(object) {
23033
+ var currentTime = new Date();
23034
+ var validToTime = dateUtils.add(currentTime, {
23035
+ hours: 6
23036
+ });
23037
+ return {
23038
+ phenomenon: '',
23039
+ validFrom: dateUtils.dateToString(currentTime, DATE_FORMAT_UTC, true),
23040
+ validUntil: dateUtils.dateToString(validToTime, DATE_FORMAT_UTC, true),
23041
+ leadtime: LABEL_CURRENT,
23042
+ level: '',
23043
+ probability: 30,
23044
+ descriptionOriginal: '',
23045
+ descriptionTranslation: '',
23046
+ objectId: (object === null || object === void 0 ? void 0 : object.id) || ''
23047
+ };
23048
+ };
22799
23049
  // tablet breakpoint - 2 padding * 2 for both sides
22800
23050
  var containerQueryBreakpoint = "@container (min-width: ".concat(breakpoints.tablet - 32, "px)");
22801
23051
  var LABEL_PHENOMENON = 'Phenomenon';
@@ -22805,10 +23055,57 @@ var LABEL_CURRENT = 'Current';
22805
23055
  var LABEL_EARLY = 'Early';
22806
23056
  var LABEL_LEVEL = 'Level';
22807
23057
  var LABEL_PROBABILITY = 'Probability';
22808
- var BUTTON_CANCEL = 'Cancel';
23058
+ var BUTTON_CLEAR = 'Clear';
22809
23059
  var BUTTON_SAVE = 'Save';
22810
23060
  var BUTTON_PUBLISH = 'Publish';
22811
23061
  var dateFormat = 'DD/MM/YYYY HH:mm';
23062
+ var probablityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
23063
+ var levelOptions = [{
23064
+ title: 'Moderate',
23065
+ key: 'moderate',
23066
+ color: '#FAE21E'
23067
+ }, {
23068
+ title: 'Severe',
23069
+ key: 'severe',
23070
+ color: '#E27000'
23071
+ }, {
23072
+ title: 'Extreme',
23073
+ key: 'extreme',
23074
+ color: '#D62A20'
23075
+ }];
23076
+ var warningPhenomena = [{
23077
+ title: 'Coastal event',
23078
+ key: 'coastalEvent',
23079
+ icon: /*#__PURE__*/React.createElement(CoastalEvent, null)
23080
+ }, {
23081
+ title: 'Fog',
23082
+ key: 'fog',
23083
+ icon: /*#__PURE__*/React.createElement(Fog, null)
23084
+ }, {
23085
+ title: 'High temperature',
23086
+ key: 'highTemp',
23087
+ icon: /*#__PURE__*/React.createElement(TemperatureHigh, null)
23088
+ }, {
23089
+ title: 'Low temperature',
23090
+ key: 'lowTemp',
23091
+ icon: /*#__PURE__*/React.createElement(TemperatureLow, null)
23092
+ }, {
23093
+ title: 'Rain',
23094
+ key: 'rain',
23095
+ icon: /*#__PURE__*/React.createElement(Rain, null)
23096
+ }, {
23097
+ title: 'Snow/ice',
23098
+ key: 'snowIce',
23099
+ icon: /*#__PURE__*/React.createElement(Snow, null)
23100
+ }, {
23101
+ title: 'Thunderstorm',
23102
+ key: 'thunderstorm',
23103
+ icon: /*#__PURE__*/React.createElement(Lightning, null)
23104
+ }, {
23105
+ title: 'Wind',
23106
+ key: 'wind',
23107
+ icon: /*#__PURE__*/React.createElement(Wind, null)
23108
+ }];
22812
23109
  var ContainerWrapper = styled('div')(function () {
22813
23110
  return {
22814
23111
  containerType: 'size',
@@ -22846,7 +23143,14 @@ var ContainerGrid = styled('div')(function (_ref3) {
22846
23143
  });
22847
23144
  var Form = function Form(_ref5) {
22848
23145
  var _ref5$isDisabled = _ref5.isDisabled,
22849
- isDisabled = _ref5$isDisabled === void 0 ? false : _ref5$isDisabled;
23146
+ isDisabled = _ref5$isDisabled === void 0 ? false : _ref5$isDisabled,
23147
+ object = _ref5.object;
23148
+ var _useFormContext = useFormContext(),
23149
+ watch = _useFormContext.watch;
23150
+ var selectedLevel = watch('level');
23151
+ var levelDetails = levelOptions.find(function (level) {
23152
+ return level.key === selectedLevel;
23153
+ });
22850
23154
  return /*#__PURE__*/React.createElement(ContainerWrapper, null, /*#__PURE__*/React.createElement(ContainerFormWrapper, null, /*#__PURE__*/React.createElement(ContainerGrid, null, /*#__PURE__*/React.createElement(Grid, {
22851
23155
  container: true,
22852
23156
  rowSpacing: 2
@@ -22857,9 +23161,19 @@ var Form = function Form(_ref5) {
22857
23161
  name: "phenomenon",
22858
23162
  label: LABEL_PHENOMENON,
22859
23163
  rules: {}
22860
- }, /*#__PURE__*/React.createElement(MenuItem, {
22861
- value: "undefined"
22862
- }, "(undefined)"))), /*#__PURE__*/React.createElement(Grid, {
23164
+ }, warningPhenomena.map(function (phenomenon) {
23165
+ return /*#__PURE__*/React.createElement(MenuItem, {
23166
+ key: phenomenon.key,
23167
+ value: phenomenon.key
23168
+ }, /*#__PURE__*/React.createElement(Grid, {
23169
+ container: true,
23170
+ justifyContent: "space-between"
23171
+ }, /*#__PURE__*/React.createElement(Grid, {
23172
+ item: true
23173
+ }, phenomenon.title), /*#__PURE__*/React.createElement(Grid, {
23174
+ item: true
23175
+ }, /*#__PURE__*/React.createElement(ListItemIcon, null, phenomenon.icon))));
23176
+ }))), /*#__PURE__*/React.createElement(Grid, {
22863
23177
  item: true,
22864
23178
  xs: 12
22865
23179
  }, /*#__PURE__*/React.createElement(Grid, {
@@ -22870,7 +23184,10 @@ var Form = function Form(_ref5) {
22870
23184
  onEditObject: function onEditObject() {},
22871
23185
  onViewObject: function onViewObject() {},
22872
23186
  onDeleteObject: function onDeleteObject() {},
22873
- onAddObject: function onAddObject() {}
23187
+ onAddObject: function onAddObject() {},
23188
+ id: object === null || object === void 0 ? void 0 : object.id,
23189
+ objectName: object === null || object === void 0 ? void 0 : object.objectName,
23190
+ lastUpdatedTime: object === null || object === void 0 ? void 0 : object.lastUpdatedTime
22874
23191
  }))), /*#__PURE__*/React.createElement(Grid, {
22875
23192
  item: true,
22876
23193
  xs: 12,
@@ -22947,20 +23264,53 @@ var Form = function Form(_ref5) {
22947
23264
  }, /*#__PURE__*/React.createElement(ReactHookFormSelect, {
22948
23265
  name: "level",
22949
23266
  label: LABEL_LEVEL,
22950
- rules: {}
22951
- }, /*#__PURE__*/React.createElement(MenuItem, {
22952
- value: "undefined"
22953
- }, "(undefined)"))), /*#__PURE__*/React.createElement(Grid, {
23267
+ rules: {},
23268
+ sx: {
23269
+ '& .MuiSelect-select.MuiSelect-filled': {
23270
+ backgroundColor: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.color) || 'none',
23271
+ backgroundClip: 'content-box'
23272
+ }
23273
+ }
23274
+ }, levelOptions.map(function (level) {
23275
+ return /*#__PURE__*/React.createElement(MenuItem, {
23276
+ value: level.key,
23277
+ key: level.key,
23278
+ sx: {
23279
+ '&.MuiMenuItem-root ': {
23280
+ background: level.color,
23281
+ backgroundClip: 'content-box',
23282
+ '&:hover': {
23283
+ backgroundColor: "".concat(level.color),
23284
+ backgroundClip: 'content-box',
23285
+ boxShadow: function boxShadow(theme) {
23286
+ return "inset -16px -6px ".concat(theme.palette.geowebColors.cards.cardContainerMouseOver, ", inset 16px 6px ").concat(theme.palette.geowebColors.cards.cardContainerMouseOver);
23287
+ }
23288
+ },
23289
+ '&.Mui-selected': {
23290
+ backgroundColor: "".concat(level.color),
23291
+ '&:hover': {
23292
+ boxShadow: function boxShadow(theme) {
23293
+ return "inset 4px 0px 0px 0px ".concat(theme.palette.geowebColors.typographyAndIcons.iconLinkActive, ", inset -16px -6px ").concat(theme.palette.geowebColors.cards.cardContainerMouseOver, ", inset 16px 6px ").concat(theme.palette.geowebColors.cards.cardContainerMouseOver);
23294
+ }
23295
+ }
23296
+ }
23297
+ }
23298
+ }
23299
+ }, "\xA0", level.title);
23300
+ }))), /*#__PURE__*/React.createElement(Grid, {
22954
23301
  item: true,
22955
23302
  xs: 12,
22956
23303
  sm: 6
22957
23304
  }, /*#__PURE__*/React.createElement(ReactHookFormSelect, {
22958
- name: "probabilty",
23305
+ name: "probability",
22959
23306
  label: LABEL_PROBABILITY,
22960
23307
  rules: {}
22961
- }, /*#__PURE__*/React.createElement(MenuItem, {
22962
- value: "undefined"
22963
- }, "(undefined)")))), /*#__PURE__*/React.createElement(Grid, {
23308
+ }, probablityOptions.map(function (probability) {
23309
+ return /*#__PURE__*/React.createElement(MenuItem, {
23310
+ value: probability,
23311
+ key: probability
23312
+ }, probability, " %");
23313
+ })))), /*#__PURE__*/React.createElement(Grid, {
22964
23314
  item: true,
22965
23315
  xs: 12,
22966
23316
  container: true,
@@ -22992,7 +23342,7 @@ var Form = function Form(_ref5) {
22992
23342
  marginBottom: 1
22993
23343
  },
22994
23344
  disabled: isDisabled
22995
- }, BUTTON_CANCEL)), /*#__PURE__*/React.createElement(Grid, {
23345
+ }, BUTTON_CLEAR)), /*#__PURE__*/React.createElement(Grid, {
22996
23346
  item: true,
22997
23347
  xs: 12,
22998
23348
  sm: 4
@@ -23016,108 +23366,66 @@ var Form = function Form(_ref5) {
23016
23366
  }, BUTTON_PUBLISH))))));
23017
23367
  };
23018
23368
  var PublicWarningsForm = function PublicWarningsForm(props) {
23019
- return /*#__PURE__*/React.createElement(ReactHookFormProvider, null, /*#__PURE__*/React.createElement(Form, Object.assign({}, props)));
23369
+ var object = props.object,
23370
+ publicWarningDetails = props.publicWarningDetails;
23371
+ var publicWarningFormData = publicWarningDetails || getEmptyPublicWarning(object);
23372
+ return /*#__PURE__*/React.createElement(ReactHookFormProvider, {
23373
+ options: Object.assign(Object.assign({}, defaultFormOptions), {
23374
+ defaultValues: publicWarningFormData
23375
+ })
23376
+ }, /*#__PURE__*/React.createElement(Form, Object.assign({}, props)));
23020
23377
  };
23021
23378
 
23022
- var DEFAULT_WARNING_DIALOG_SIZE = {
23023
- width: 320,
23024
- height: 800
23025
- };
23026
- var DEFAULT_WARNING_DIALOG_POSITION = {
23027
- top: 8,
23028
- left: 60
23029
- };
23030
- var DEFAULT_WARNING_DIALOG_MIN_SIZE = {
23031
- width: 320,
23032
- height: 300
23379
+ /* *
23380
+ * Licensed under the Apache License, Version 2.0 (the "License");
23381
+ * you may not use this file except in compliance with the License.
23382
+ * You may obtain a copy of the License at
23383
+ *
23384
+ * http://www.apache.org/licenses/LICENSE-2.0
23385
+ *
23386
+ * Unless required by applicable law or agreed to in writing, software
23387
+ * distributed under the License is distributed on an "AS IS" BASIS,
23388
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23389
+ * See the License for the specific language governing permissions and
23390
+ * limitations under the License.
23391
+ *
23392
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
23393
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
23394
+ * */
23395
+ var getPublicWarningStore = function getPublicWarningStore(store) {
23396
+ if (store && store.publicWarningForm) {
23397
+ return store.publicWarningForm;
23398
+ }
23399
+ return null;
23033
23400
  };
23034
- var DIALOG_TITLE = 'Public Warning';
23035
- var PublicWarnings = function PublicWarnings(_ref) {
23036
- var bounds = _ref.bounds,
23037
- onClose = _ref.onClose,
23038
- _ref$title = _ref.title,
23039
- title = _ref$title === void 0 ? DIALOG_TITLE : _ref$title,
23040
- isOpen = _ref.isOpen,
23041
- _ref$onMouseDown = _ref.onMouseDown,
23042
- onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
23043
- _ref$order = _ref.order,
23044
- order = _ref$order === void 0 ? 0 : _ref$order,
23045
- _ref$source = _ref.source,
23046
- source = _ref$source === void 0 ? 'app' : _ref$source,
23047
- _ref$size = _ref.size,
23048
- size = _ref$size === void 0 ? DEFAULT_WARNING_DIALOG_SIZE : _ref$size,
23049
- _ref$startPosition = _ref.startPosition,
23050
- startPosition = _ref$startPosition === void 0 ? DEFAULT_WARNING_DIALOG_POSITION : _ref$startPosition,
23051
- _ref$setFocused = _ref.setFocused,
23052
- setFocused = _ref$setFocused === void 0 ? function () {} : _ref$setFocused,
23053
- _ref$headerSize = _ref.headerSize,
23054
- headerSize = _ref$headerSize === void 0 ? 'xs' : _ref$headerSize;
23055
- var minSize = DEFAULT_WARNING_DIALOG_MIN_SIZE;
23056
- var startSizeCalc = calculateStartSize(minSize, size, startPosition);
23057
- var _React$useState = React.useState(startSizeCalc),
23058
- _React$useState2 = _slicedToArray(_React$useState, 2),
23059
- sizeInState = _React$useState2[0],
23060
- setSizeInState = _React$useState2[1];
23061
- return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
23062
- title: title,
23063
- startSize: sizeInState,
23064
- minWidth: minSize.width,
23065
- minHeight: minSize.height,
23066
- startPosition: startPosition,
23067
- isOpen: isOpen,
23068
- onClose: onClose,
23069
- headerSize: headerSize,
23070
- bounds: bounds,
23071
- onMouseDown: onMouseDown,
23072
- onFocus: function onFocus() {
23073
- return setFocused(true);
23074
- },
23075
- onBlur: function onBlur() {
23076
- return setFocused(false);
23077
- },
23078
- order: order,
23079
- source: source,
23080
- onResizeStop: function onResizeStop(_event, _direction, node) {
23081
- var width = node.offsetWidth,
23082
- height = node.offsetHeight;
23083
- setSizeInState({
23084
- width: width,
23085
- height: height
23086
- });
23087
- },
23088
- onDragEnd: function onDragEnd(_position, dragSize) {
23089
- if (dragSize !== sizeInState) {
23090
- setSizeInState(dragSize);
23091
- }
23092
- },
23093
- leftHeaderComponent: /*#__PURE__*/React.createElement("div", null),
23094
- rightHeaderComponent: /*#__PURE__*/React.createElement(Box, {
23095
- sx: {
23096
- flex: 1,
23097
- overflow: 'hidden',
23098
- display: 'flex',
23099
- justifyContent: 'flex-end',
23100
- position: 'absolute',
23101
- right: 32,
23102
- backgroundColor: 'geowebColors.background.surface',
23103
- height: 24,
23104
- paddingLeft: 1
23105
- }
23106
- }, /*#__PURE__*/React.createElement(Box, {
23107
- sx: {
23108
- position: 'relative',
23109
- top: -7
23110
- }
23111
- }, /*#__PURE__*/React.createElement(SwitchButton, null))),
23112
- sx: {
23113
- footer: {
23114
- backgroundColor: 'inherit',
23115
- boxShadow: 'none'
23116
- }
23117
- }
23118
- }, /*#__PURE__*/React.createElement(PublicWarningsForm, {
23119
- isDisabled: true
23120
- }));
23401
+ var getPublicWarningObject = createSelector(getPublicWarningStore, function (publicWarningStore) {
23402
+ return publicWarningStore.object;
23403
+ });
23404
+
23405
+ /* *
23406
+ * Licensed under the Apache License, Version 2.0 (the "License");
23407
+ * you may not use this file except in compliance with the License.
23408
+ * You may obtain a copy of the License at
23409
+ *
23410
+ * http://www.apache.org/licenses/LICENSE-2.0
23411
+ *
23412
+ * Unless required by applicable law or agreed to in writing, software
23413
+ * distributed under the License is distributed on an "AS IS" BASIS,
23414
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23415
+ * See the License for the specific language governing permissions and
23416
+ * limitations under the License.
23417
+ *
23418
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
23419
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
23420
+ * */
23421
+ var PublicWarningsFormConnect = function PublicWarningsFormConnect() {
23422
+ var publicWarningObject = useSelector(function (store) {
23423
+ return getPublicWarningObject(store);
23424
+ });
23425
+ return /*#__PURE__*/React.createElement(PublicWarningsForm, {
23426
+ isDisabled: true,
23427
+ object: publicWarningObject
23428
+ });
23121
23429
  };
23122
23430
 
23123
23431
  /* *
@@ -23136,7 +23444,6 @@ var PublicWarnings = function PublicWarnings(_ref) {
23136
23444
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
23137
23445
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
23138
23446
  * */
23139
- var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
23140
23447
  var PublicWarningsConnect = function PublicWarningsConnect(_ref) {
23141
23448
  var bounds = _ref.bounds,
23142
23449
  _ref$source = _ref.source,
@@ -23159,7 +23466,7 @@ var PublicWarningsConnect = function PublicWarningsConnect(_ref) {
23159
23466
  source: uiSource,
23160
23467
  bounds: bounds,
23161
23468
  startPosition: startPosition
23162
- });
23469
+ }, /*#__PURE__*/React__default.createElement(PublicWarningsFormConnect, null));
23163
23470
  };
23164
23471
 
23165
23472
  var createSymbol = function createSymbol(name) {
@@ -23729,9 +24036,10 @@ function drawingSaga() {
23729
24036
  var drawingModuleConfig = {
23730
24037
  id: 'drawing-module',
23731
24038
  reducersMap: {
23732
- drawings: reducer
24039
+ drawings: reducer$1,
24040
+ publicWarningForm: reducer
23733
24041
  },
23734
24042
  sagas: [drawingSaga]
23735
24043
  };
23736
24044
 
23737
- export { DIALOG_TITLE, DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarnings, PublicWarningsConnect, WarningsModuleProvider, drawingModuleConfig, publicWarningDialogType, useObjectDrawDialogAction };
24045
+ export { DIALOG_TITLE, DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarnings, PublicWarningsConnect, WarningsModuleProvider, drawingModuleConfig, useObjectDrawDialogAction };