@opengeoweb/warnings 9.25.3 → 9.26.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 +298 -226
- package/package.json +1 -1
- package/src/lib/components/PublicWarningsForm/LevelField/LevelField.d.ts +4 -5
- package/src/lib/components/PublicWarningsForm/PhenomenonField/PhenomenonField.d.ts +4 -6
- package/src/lib/components/PublicWarningsForm/PhenomenonField/PhenomenonField.spec.d.ts +1 -0
- package/src/lib/store/publicWarnings/utils.d.ts +3 -0
- package/src/lib/storybookUtils/defaultStorySettings.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons, Share, ExitDomain, Edit, Delete,
|
|
3
|
+
import { Polygons, Share, ExitDomain, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, DrawPolygon, Visibility, Add, breakpoints, Close, Options, Copy, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, useSetupDialog } from '@opengeoweb/store';
|
|
5
5
|
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, MapView, MapViewLayer, defaultLayers, getFeatureExtent } from '@opengeoweb/webmap-react';
|
|
6
|
-
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, getPosition, FilterChip, FilterListItem, LastUpdateTime, StatusTag, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, getPosition, FilterChip, FilterListItem, FilterLabel, LastUpdateTime, StatusTag, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
8
8
|
import i18n from 'i18next';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import '@opengeoweb/core';
|
|
11
|
-
import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates,
|
|
11
|
+
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormSelect, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
12
12
|
import { snackbarActions } from '@opengeoweb/snackbar';
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
15
|
-
import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack, LinearProgress, Button,
|
|
15
|
+
import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack, LinearProgress, Button, MenuItem, ListItemIcon, FormHelperText, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch, List } from '@mui/material';
|
|
16
16
|
import { VariableSizeList } from 'react-window';
|
|
17
17
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
18
18
|
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
@@ -3683,28 +3683,218 @@ $$c({ target: 'Array', proto: true, forced: FORCED$2 }, {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
});
|
|
3685
3685
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3686
|
+
const getWarningPhenomenaIcon = key => {
|
|
3687
|
+
switch (key) {
|
|
3688
|
+
case 'wind':
|
|
3689
|
+
return jsx(Wind, {});
|
|
3690
|
+
case 'fog':
|
|
3691
|
+
return jsx(Fog, {});
|
|
3692
|
+
case 'thunderstorm':
|
|
3693
|
+
return jsx(Lightning, {});
|
|
3694
|
+
case 'snowIce':
|
|
3695
|
+
return jsx(Snow, {});
|
|
3696
|
+
case 'rain':
|
|
3697
|
+
return jsx(Rain, {});
|
|
3698
|
+
case 'highTemp':
|
|
3699
|
+
return jsx(TemperatureHigh, {});
|
|
3700
|
+
case 'lowTemp':
|
|
3701
|
+
return jsx(TemperatureLow, {});
|
|
3702
|
+
case 'coastalEvent':
|
|
3703
|
+
return jsx(CoastalEvent, {});
|
|
3704
|
+
default:
|
|
3705
|
+
return undefined;
|
|
3706
|
+
}
|
|
3707
|
+
};
|
|
3708
|
+
const warningPhenomena = [{
|
|
3709
|
+
translationKey: 'warning-phenomenon-wind',
|
|
3710
|
+
key: 'wind'
|
|
3711
|
+
}, {
|
|
3712
|
+
translationKey: 'warning-phenomenon-fog',
|
|
3713
|
+
key: 'fog'
|
|
3714
|
+
}, {
|
|
3715
|
+
translationKey: 'warning-phenomenon-thunderstorm',
|
|
3716
|
+
key: 'thunderstorm'
|
|
3717
|
+
}, {
|
|
3718
|
+
translationKey: 'warning-phenomenon-snow-ice',
|
|
3719
|
+
key: 'snowIce'
|
|
3720
|
+
}, {
|
|
3721
|
+
translationKey: 'warning-phenomenon-rain',
|
|
3722
|
+
key: 'rain'
|
|
3723
|
+
}, {
|
|
3724
|
+
translationKey: 'warning-phenomenon-high-temp',
|
|
3725
|
+
key: 'highTemp'
|
|
3726
|
+
},
|
|
3727
|
+
// {
|
|
3728
|
+
// title: 'warning-phenomenon-funnel-cloud',
|
|
3729
|
+
// key: 'funnelCloud',
|
|
3730
|
+
// },
|
|
3731
|
+
{
|
|
3732
|
+
translationKey: 'warning-phenomenon-low-temp',
|
|
3733
|
+
key: 'lowTemp'
|
|
3734
|
+
}, {
|
|
3735
|
+
translationKey: 'warning-phenomenon-coastal-event',
|
|
3736
|
+
key: 'coastalEvent'
|
|
3737
|
+
}];
|
|
3738
|
+
const Phenomenon = ({
|
|
3739
|
+
isDisabled,
|
|
3740
|
+
isReadOnly
|
|
3741
|
+
}) => {
|
|
3742
|
+
const {
|
|
3743
|
+
t
|
|
3744
|
+
} = useWarningsTranslation();
|
|
3745
|
+
const {
|
|
3746
|
+
isRequired
|
|
3747
|
+
} = useDraftFormHelpers();
|
|
3748
|
+
return jsx(ReactHookFormSelect, Object.assign({
|
|
3749
|
+
name: "phenomenon",
|
|
3750
|
+
label: t('warning-phenomenon'),
|
|
3751
|
+
rules: {
|
|
3752
|
+
validate: {
|
|
3753
|
+
isRequired
|
|
3754
|
+
}
|
|
3755
|
+
},
|
|
3756
|
+
disabled: isDisabled || isReadOnly,
|
|
3757
|
+
isReadOnly: isReadOnly
|
|
3758
|
+
}, {
|
|
3759
|
+
children: warningPhenomena.map(phenomenon => {
|
|
3760
|
+
return jsx(MenuItem, Object.assign({
|
|
3761
|
+
value: phenomenon.key
|
|
3762
|
+
}, {
|
|
3763
|
+
children: jsxs(Grid, Object.assign({
|
|
3764
|
+
container: true,
|
|
3765
|
+
justifyContent: "space-between"
|
|
3766
|
+
}, {
|
|
3767
|
+
children: [jsx(Grid, Object.assign({
|
|
3768
|
+
item: true
|
|
3769
|
+
}, {
|
|
3770
|
+
children: t(phenomenon.translationKey)
|
|
3771
|
+
})), jsx(Grid, Object.assign({
|
|
3772
|
+
item: true
|
|
3773
|
+
}, {
|
|
3774
|
+
children: jsx(ListItemIcon, {
|
|
3775
|
+
children: getWarningPhenomenaIcon(phenomenon.key)
|
|
3776
|
+
})
|
|
3777
|
+
}))]
|
|
3778
|
+
}))
|
|
3779
|
+
}), phenomenon.key);
|
|
3780
|
+
})
|
|
3781
|
+
}));
|
|
3782
|
+
};
|
|
3783
|
+
|
|
3784
|
+
var WarningLevel;
|
|
3785
|
+
(function (WarningLevel) {
|
|
3786
|
+
WarningLevel["moderate"] = "moderate";
|
|
3787
|
+
WarningLevel["severe"] = "severe";
|
|
3788
|
+
WarningLevel["extreme"] = "extreme";
|
|
3789
|
+
})(WarningLevel || (WarningLevel = {}));
|
|
3790
|
+
const LevelColors = {
|
|
3791
|
+
moderate: {
|
|
3792
|
+
color: '#FAE21E',
|
|
3793
|
+
textColor: '#051039'
|
|
3794
|
+
},
|
|
3795
|
+
severe: {
|
|
3796
|
+
color: '#E27000',
|
|
3797
|
+
textColor: '#051039'
|
|
3798
|
+
},
|
|
3799
|
+
extreme: {
|
|
3800
|
+
color: '#D62A20',
|
|
3801
|
+
textColor: '#ffffff'
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
const getLevelStyle = levelColor => ({
|
|
3805
|
+
color: levelColor && levelColor.textColor,
|
|
3806
|
+
backgroundColor: levelColor && levelColor.color,
|
|
3807
|
+
paddingLeft: 0.5,
|
|
3808
|
+
paddingRight: 0.5,
|
|
3809
|
+
paddingBottom: '1px',
|
|
3810
|
+
marginLeft: -0.5
|
|
3811
|
+
});
|
|
3812
|
+
const levelOptions = [Object.assign({
|
|
3813
|
+
translationKey: 'warning-level-moderate',
|
|
3814
|
+
key: WarningLevel.moderate
|
|
3815
|
+
}, LevelColors[WarningLevel.moderate]), Object.assign({
|
|
3816
|
+
translationKey: 'warning-level-severe',
|
|
3817
|
+
key: WarningLevel.severe
|
|
3818
|
+
}, LevelColors[WarningLevel.severe]), Object.assign({
|
|
3819
|
+
translationKey: 'warning-level-extreme',
|
|
3820
|
+
key: WarningLevel.extreme
|
|
3821
|
+
}, LevelColors[WarningLevel.extreme])];
|
|
3822
|
+
const LevelField = ({
|
|
3823
|
+
isDisabled: _isDisabled = false,
|
|
3824
|
+
isReadOnly: _isReadOnly = false
|
|
3825
|
+
}) => {
|
|
3826
|
+
const {
|
|
3827
|
+
t
|
|
3828
|
+
} = useWarningsTranslation();
|
|
3829
|
+
const {
|
|
3830
|
+
isRequired
|
|
3831
|
+
} = useDraftFormHelpers();
|
|
3832
|
+
const {
|
|
3833
|
+
watch,
|
|
3834
|
+
trigger
|
|
3835
|
+
} = useFormContext();
|
|
3836
|
+
const selectedLevel = watch('level');
|
|
3837
|
+
const levelDetails = levelOptions.find(level => level.key === selectedLevel);
|
|
3838
|
+
const onChangeLevel = () => {
|
|
3839
|
+
trigger(['level', 'probability']);
|
|
3840
|
+
};
|
|
3841
|
+
return jsx(ReactHookFormSelect, Object.assign({
|
|
3842
|
+
name: "level",
|
|
3843
|
+
label: t('warning-level'),
|
|
3844
|
+
rules: {
|
|
3845
|
+
validate: {
|
|
3846
|
+
isRequired
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3849
|
+
sx: {
|
|
3850
|
+
'& .MuiSelect-select.MuiSelect-filled': {
|
|
3851
|
+
color: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.textColor) || 'none',
|
|
3852
|
+
backgroundColor: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.color) || 'none',
|
|
3853
|
+
backgroundClip: 'content-box'
|
|
3854
|
+
}
|
|
3855
|
+
},
|
|
3856
|
+
disabled: _isDisabled || _isReadOnly,
|
|
3857
|
+
isReadOnly: _isReadOnly,
|
|
3858
|
+
onChange: onChangeLevel
|
|
3859
|
+
}, {
|
|
3860
|
+
children: levelOptions.map(level => jsxs(MenuItem, Object.assign({
|
|
3861
|
+
value: level.key,
|
|
3862
|
+
sx: {
|
|
3863
|
+
'&.MuiMenuItem-root ': {
|
|
3864
|
+
color: level.textColor,
|
|
3865
|
+
background: level.color,
|
|
3866
|
+
backgroundClip: 'content-box',
|
|
3867
|
+
padding: '12px 8px',
|
|
3868
|
+
'&:hover': {
|
|
3869
|
+
backgroundColor: `${level.color}`,
|
|
3870
|
+
backgroundClip: 'content-box',
|
|
3871
|
+
boxShadow: theme => `inset -8px -12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}, inset 8px 12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}`
|
|
3872
|
+
},
|
|
3873
|
+
'&.Mui-selected': {
|
|
3874
|
+
backgroundColor: `${level.color}`,
|
|
3875
|
+
'&:hover': {
|
|
3876
|
+
boxShadow: theme => `inset 4px 0px 0px 0px ${theme.palette.geowebColors.typographyAndIcons.iconLinkActive}, inset -8px -12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}, inset 8px 12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}`
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
}, {
|
|
3882
|
+
children: ["\u00A0", t(level.translationKey)]
|
|
3883
|
+
}), level.key))
|
|
3884
|
+
}));
|
|
3885
|
+
};
|
|
3886
|
+
|
|
3703
3887
|
const emptyFilter = {
|
|
3704
3888
|
id: 'empty',
|
|
3705
3889
|
name: '(not specified)',
|
|
3706
3890
|
checked: true
|
|
3707
3891
|
};
|
|
3892
|
+
const getFilterlistWithTranslationKeys = filterList => filterList.reduce((fiterList, {
|
|
3893
|
+
key,
|
|
3894
|
+
translationKey
|
|
3895
|
+
}) => Object.assign(Object.assign({}, fiterList), {
|
|
3896
|
+
[key]: translationKey
|
|
3897
|
+
}), {});
|
|
3708
3898
|
const defaultFilters = [{
|
|
3709
3899
|
key: 'incident',
|
|
3710
3900
|
translationKey: 'filter-incident'
|
|
@@ -3713,10 +3903,12 @@ const defaultFilters = [{
|
|
|
3713
3903
|
translationKey: 'filter-domain'
|
|
3714
3904
|
}, {
|
|
3715
3905
|
key: 'phenomenon',
|
|
3716
|
-
translationKey: 'filter-phenomenon'
|
|
3906
|
+
translationKey: 'filter-phenomenon',
|
|
3907
|
+
translations: getFilterlistWithTranslationKeys(warningPhenomena)
|
|
3717
3908
|
}, {
|
|
3718
3909
|
key: 'level',
|
|
3719
|
-
translationKey: 'filter-level'
|
|
3910
|
+
translationKey: 'filter-level',
|
|
3911
|
+
translations: getFilterlistWithTranslationKeys(levelOptions)
|
|
3720
3912
|
}, {
|
|
3721
3913
|
key: 'warningProposalSource',
|
|
3722
3914
|
translationKey: 'filter-source'
|
|
@@ -3737,15 +3929,18 @@ const getFiltersFromWarnings = warnings => {
|
|
|
3737
3929
|
}
|
|
3738
3930
|
const filledFilters = defaultFilters.map(({
|
|
3739
3931
|
key,
|
|
3740
|
-
translationKey
|
|
3932
|
+
translationKey,
|
|
3933
|
+
translations
|
|
3741
3934
|
}) => {
|
|
3742
3935
|
const filterOptions = [];
|
|
3743
3936
|
warnings.forEach(warning => {
|
|
3744
|
-
const
|
|
3745
|
-
if (
|
|
3937
|
+
const id = warning.warningDetail[key];
|
|
3938
|
+
if (id && filterOptions.findIndex(option => option.filter.id === id) === -1) {
|
|
3939
|
+
const translationKey = translations && translations[id];
|
|
3940
|
+
const label = translationKey ? translateKeyOutsideComponents(translationKey) : id;
|
|
3746
3941
|
const filter = {
|
|
3747
|
-
id
|
|
3748
|
-
name,
|
|
3942
|
+
id,
|
|
3943
|
+
name: label,
|
|
3749
3944
|
checked: true
|
|
3750
3945
|
};
|
|
3751
3946
|
filterOptions.push({
|
|
@@ -10485,6 +10680,28 @@ const DescriptionField = ({
|
|
|
10485
10680
|
setActiveTab(1);
|
|
10486
10681
|
}
|
|
10487
10682
|
}, [formState.errors, formState.submitCount]);
|
|
10683
|
+
const focusForwards = fieldName => {
|
|
10684
|
+
if (fieldName === 'descriptionOriginal') {
|
|
10685
|
+
setActiveTab(1);
|
|
10686
|
+
}
|
|
10687
|
+
};
|
|
10688
|
+
const focusBackwards = fieldName => {
|
|
10689
|
+
if (fieldName === 'descriptionTranslation') {
|
|
10690
|
+
setActiveTab(0);
|
|
10691
|
+
}
|
|
10692
|
+
};
|
|
10693
|
+
const onKeyDown = event => {
|
|
10694
|
+
const target = event.target;
|
|
10695
|
+
const {
|
|
10696
|
+
name
|
|
10697
|
+
} = target;
|
|
10698
|
+
event.stopPropagation();
|
|
10699
|
+
if (event.code === 'Tab' && event.shiftKey) {
|
|
10700
|
+
focusBackwards(name);
|
|
10701
|
+
} else if (event.code === 'Tab') {
|
|
10702
|
+
focusForwards(name);
|
|
10703
|
+
}
|
|
10704
|
+
};
|
|
10488
10705
|
return jsxs(Fragment, {
|
|
10489
10706
|
children: [jsxs(Tabs, Object.assign({
|
|
10490
10707
|
value: activeTab,
|
|
@@ -10501,11 +10718,13 @@ const DescriptionField = ({
|
|
|
10501
10718
|
children: [jsx(Tab, Object.assign({
|
|
10502
10719
|
sx: tabStyle,
|
|
10503
10720
|
label: t('warning-description-original'),
|
|
10504
|
-
disabled: _isDisabled
|
|
10721
|
+
disabled: _isDisabled,
|
|
10722
|
+
tabIndex: -1
|
|
10505
10723
|
}, a11yProps(0))), jsx(Tab, Object.assign({
|
|
10506
10724
|
sx: tabStyle,
|
|
10507
10725
|
label: t('warning-description-translation'),
|
|
10508
|
-
disabled: _isDisabled
|
|
10726
|
+
disabled: _isDisabled,
|
|
10727
|
+
tabIndex: -1
|
|
10509
10728
|
}, a11yProps(1)))]
|
|
10510
10729
|
})), jsx(CustomTabPanel, Object.assign({
|
|
10511
10730
|
value: activeTab,
|
|
@@ -10522,7 +10741,7 @@ const DescriptionField = ({
|
|
|
10522
10741
|
multiline: true,
|
|
10523
10742
|
disabled: _isDisabled,
|
|
10524
10743
|
isReadOnly: _isReadOnly,
|
|
10525
|
-
onKeyDown:
|
|
10744
|
+
onKeyDown: onKeyDown
|
|
10526
10745
|
})
|
|
10527
10746
|
})), jsx(CustomTabPanel, Object.assign({
|
|
10528
10747
|
value: activeTab,
|
|
@@ -10539,7 +10758,7 @@ const DescriptionField = ({
|
|
|
10539
10758
|
multiline: true,
|
|
10540
10759
|
disabled: _isDisabled,
|
|
10541
10760
|
isReadOnly: _isReadOnly,
|
|
10542
|
-
onKeyDown:
|
|
10761
|
+
onKeyDown: onKeyDown
|
|
10543
10762
|
})
|
|
10544
10763
|
}))]
|
|
10545
10764
|
});
|
|
@@ -10672,186 +10891,6 @@ const AreaField = ({
|
|
|
10672
10891
|
});
|
|
10673
10892
|
};
|
|
10674
10893
|
|
|
10675
|
-
const warningPhenomena = t => [{
|
|
10676
|
-
title: t('warning-phenomenon-wind'),
|
|
10677
|
-
key: 'wind',
|
|
10678
|
-
icon: jsx(Wind, {})
|
|
10679
|
-
}, {
|
|
10680
|
-
title: t('warning-phenomenon-fog'),
|
|
10681
|
-
key: 'fog',
|
|
10682
|
-
icon: jsx(Fog, {})
|
|
10683
|
-
}, {
|
|
10684
|
-
title: t('warning-phenomenon-thunderstorm'),
|
|
10685
|
-
key: 'thunderstorm',
|
|
10686
|
-
icon: jsx(Lightning, {})
|
|
10687
|
-
}, {
|
|
10688
|
-
title: t('warning-phenomenon-snow-ice'),
|
|
10689
|
-
key: 'snowIce',
|
|
10690
|
-
icon: jsx(Snow, {})
|
|
10691
|
-
}, {
|
|
10692
|
-
title: t('warning-phenomenon-rain'),
|
|
10693
|
-
key: 'rain',
|
|
10694
|
-
icon: jsx(Rain, {})
|
|
10695
|
-
}, {
|
|
10696
|
-
title: t('warning-phenomenon-high-temp'),
|
|
10697
|
-
key: 'highTemp',
|
|
10698
|
-
icon: jsx(TemperatureHigh, {})
|
|
10699
|
-
},
|
|
10700
|
-
// {
|
|
10701
|
-
// title: t('warning-phenomenon-funnel-cloud'),
|
|
10702
|
-
// key: 'funnelCloud',
|
|
10703
|
-
// icon: <FunnelCloud />,
|
|
10704
|
-
// },
|
|
10705
|
-
{
|
|
10706
|
-
title: t('warning-phenomenon-low-temp'),
|
|
10707
|
-
key: 'lowTemp',
|
|
10708
|
-
icon: jsx(TemperatureLow, {})
|
|
10709
|
-
}, {
|
|
10710
|
-
title: t('warning-phenomenon-coastal-event'),
|
|
10711
|
-
key: 'coastalEvent',
|
|
10712
|
-
icon: jsx(CoastalEvent, {})
|
|
10713
|
-
}];
|
|
10714
|
-
const Phenomenon = ({
|
|
10715
|
-
isDisabled,
|
|
10716
|
-
isReadOnly
|
|
10717
|
-
}) => {
|
|
10718
|
-
const {
|
|
10719
|
-
t
|
|
10720
|
-
} = useWarningsTranslation();
|
|
10721
|
-
const {
|
|
10722
|
-
isRequired
|
|
10723
|
-
} = useDraftFormHelpers();
|
|
10724
|
-
return jsx(ReactHookFormSelect, Object.assign({
|
|
10725
|
-
name: "phenomenon",
|
|
10726
|
-
label: t('warning-phenomenon'),
|
|
10727
|
-
rules: {
|
|
10728
|
-
validate: {
|
|
10729
|
-
isRequired
|
|
10730
|
-
}
|
|
10731
|
-
},
|
|
10732
|
-
disabled: isDisabled || isReadOnly,
|
|
10733
|
-
isReadOnly: isReadOnly
|
|
10734
|
-
}, {
|
|
10735
|
-
children: warningPhenomena(t).map(phenomenon => {
|
|
10736
|
-
return jsx(MenuItem, Object.assign({
|
|
10737
|
-
value: phenomenon.key
|
|
10738
|
-
}, {
|
|
10739
|
-
children: jsxs(Grid, Object.assign({
|
|
10740
|
-
container: true,
|
|
10741
|
-
justifyContent: "space-between"
|
|
10742
|
-
}, {
|
|
10743
|
-
children: [jsx(Grid, Object.assign({
|
|
10744
|
-
item: true
|
|
10745
|
-
}, {
|
|
10746
|
-
children: phenomenon.title
|
|
10747
|
-
})), jsx(Grid, Object.assign({
|
|
10748
|
-
item: true
|
|
10749
|
-
}, {
|
|
10750
|
-
children: jsx(ListItemIcon, {
|
|
10751
|
-
children: phenomenon.icon
|
|
10752
|
-
})
|
|
10753
|
-
}))]
|
|
10754
|
-
}))
|
|
10755
|
-
}), phenomenon.key);
|
|
10756
|
-
})
|
|
10757
|
-
}));
|
|
10758
|
-
};
|
|
10759
|
-
|
|
10760
|
-
var WarningLevel;
|
|
10761
|
-
(function (WarningLevel) {
|
|
10762
|
-
WarningLevel["moderate"] = "moderate";
|
|
10763
|
-
WarningLevel["severe"] = "severe";
|
|
10764
|
-
WarningLevel["extreme"] = "extreme";
|
|
10765
|
-
})(WarningLevel || (WarningLevel = {}));
|
|
10766
|
-
const LevelColors = {
|
|
10767
|
-
moderate: {
|
|
10768
|
-
color: '#FAE21E',
|
|
10769
|
-
textColor: '#051039'
|
|
10770
|
-
},
|
|
10771
|
-
severe: {
|
|
10772
|
-
color: '#E27000',
|
|
10773
|
-
textColor: '#051039'
|
|
10774
|
-
},
|
|
10775
|
-
extreme: {
|
|
10776
|
-
color: '#D62A20',
|
|
10777
|
-
textColor: '#ffffff'
|
|
10778
|
-
}
|
|
10779
|
-
};
|
|
10780
|
-
const levelOptions = t => [Object.assign({
|
|
10781
|
-
title: t('warning-level-moderate'),
|
|
10782
|
-
key: WarningLevel.moderate
|
|
10783
|
-
}, LevelColors[WarningLevel.moderate]), Object.assign({
|
|
10784
|
-
title: t('warning-level-severe'),
|
|
10785
|
-
key: WarningLevel.severe
|
|
10786
|
-
}, LevelColors[WarningLevel.severe]), Object.assign({
|
|
10787
|
-
title: t('warning-level-extreme'),
|
|
10788
|
-
key: WarningLevel.extreme
|
|
10789
|
-
}, LevelColors[WarningLevel.extreme])];
|
|
10790
|
-
const LevelField = ({
|
|
10791
|
-
isDisabled: _isDisabled = false,
|
|
10792
|
-
isReadOnly: _isReadOnly = false
|
|
10793
|
-
}) => {
|
|
10794
|
-
const {
|
|
10795
|
-
t
|
|
10796
|
-
} = useWarningsTranslation();
|
|
10797
|
-
const {
|
|
10798
|
-
isRequired
|
|
10799
|
-
} = useDraftFormHelpers();
|
|
10800
|
-
const {
|
|
10801
|
-
watch,
|
|
10802
|
-
trigger
|
|
10803
|
-
} = useFormContext();
|
|
10804
|
-
const selectedLevel = watch('level');
|
|
10805
|
-
const levelDetails = levelOptions(t).find(level => level.key === selectedLevel);
|
|
10806
|
-
const onChangeLevel = () => {
|
|
10807
|
-
trigger(['level', 'probability']);
|
|
10808
|
-
};
|
|
10809
|
-
return jsx(ReactHookFormSelect, Object.assign({
|
|
10810
|
-
name: "level",
|
|
10811
|
-
label: t('warning-level'),
|
|
10812
|
-
rules: {
|
|
10813
|
-
validate: {
|
|
10814
|
-
isRequired
|
|
10815
|
-
}
|
|
10816
|
-
},
|
|
10817
|
-
sx: {
|
|
10818
|
-
'& .MuiSelect-select.MuiSelect-filled': {
|
|
10819
|
-
color: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.textColor) || 'none',
|
|
10820
|
-
backgroundColor: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.color) || 'none',
|
|
10821
|
-
backgroundClip: 'content-box'
|
|
10822
|
-
}
|
|
10823
|
-
},
|
|
10824
|
-
disabled: _isDisabled || _isReadOnly,
|
|
10825
|
-
isReadOnly: _isReadOnly,
|
|
10826
|
-
onChange: onChangeLevel
|
|
10827
|
-
}, {
|
|
10828
|
-
children: levelOptions(t).map(level => jsxs(MenuItem, Object.assign({
|
|
10829
|
-
value: level.key,
|
|
10830
|
-
sx: {
|
|
10831
|
-
'&.MuiMenuItem-root ': {
|
|
10832
|
-
color: level.textColor,
|
|
10833
|
-
background: level.color,
|
|
10834
|
-
backgroundClip: 'content-box',
|
|
10835
|
-
padding: '12px 8px',
|
|
10836
|
-
'&:hover': {
|
|
10837
|
-
backgroundColor: `${level.color}`,
|
|
10838
|
-
backgroundClip: 'content-box',
|
|
10839
|
-
boxShadow: theme => `inset -8px -12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}, inset 8px 12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}`
|
|
10840
|
-
},
|
|
10841
|
-
'&.Mui-selected': {
|
|
10842
|
-
backgroundColor: `${level.color}`,
|
|
10843
|
-
'&:hover': {
|
|
10844
|
-
boxShadow: theme => `inset 4px 0px 0px 0px ${theme.palette.geowebColors.typographyAndIcons.iconLinkActive}, inset -8px -12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}, inset 8px 12px ${theme.palette.geowebColors.cards.cardContainerMouseOver}`
|
|
10845
|
-
}
|
|
10846
|
-
}
|
|
10847
|
-
}
|
|
10848
|
-
}
|
|
10849
|
-
}, {
|
|
10850
|
-
children: ["\u00A0", level.title]
|
|
10851
|
-
}), level.key))
|
|
10852
|
-
}));
|
|
10853
|
-
};
|
|
10854
|
-
|
|
10855
10894
|
const VALID_FROM_MAX_HOURS_AFTER_CURRENT = 168;
|
|
10856
10895
|
const isValueBeforeCurrentTime$1 = (value, t) => {
|
|
10857
10896
|
return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('warning-valid-from-error-before-current');
|
|
@@ -13603,7 +13642,47 @@ const FilterChipWithOptions = ({
|
|
|
13603
13642
|
marginLeft: '-12px'
|
|
13604
13643
|
}
|
|
13605
13644
|
}, {
|
|
13606
|
-
children: _filterList.map(filterItem =>
|
|
13645
|
+
children: _filterList.map(filterItem => {
|
|
13646
|
+
switch (id) {
|
|
13647
|
+
case 'level':
|
|
13648
|
+
{
|
|
13649
|
+
const warningColor = LevelColors[filterItem.filter.id];
|
|
13650
|
+
return jsx(FilterListItem, Object.assign({}, filterItem, {
|
|
13651
|
+
children: warningColor ? jsx(Box, Object.assign({
|
|
13652
|
+
component: "span",
|
|
13653
|
+
sx: Object.assign(Object.assign({}, getLevelStyle(warningColor)), {
|
|
13654
|
+
fontSize: '16px'
|
|
13655
|
+
}),
|
|
13656
|
+
"data-testid": `icon-${filterItem.filter.id}`
|
|
13657
|
+
}, {
|
|
13658
|
+
children: filterItem.filter.name
|
|
13659
|
+
})) : jsx(FilterLabel, {
|
|
13660
|
+
name: filterItem.filter.name
|
|
13661
|
+
})
|
|
13662
|
+
}), filterItem.filter.id);
|
|
13663
|
+
}
|
|
13664
|
+
case 'phenomenon':
|
|
13665
|
+
{
|
|
13666
|
+
const icon = getWarningPhenomenaIcon(filterItem.filter.id);
|
|
13667
|
+
return jsxs(FilterListItem, Object.assign({}, filterItem, {
|
|
13668
|
+
children: [icon && jsx(Box, Object.assign({
|
|
13669
|
+
"data-testid": `icon-${filterItem.filter.id}`,
|
|
13670
|
+
sx: {
|
|
13671
|
+
marginRight: 1
|
|
13672
|
+
}
|
|
13673
|
+
}, {
|
|
13674
|
+
children: icon
|
|
13675
|
+
})), jsx(FilterLabel, {
|
|
13676
|
+
name: filterItem.filter.name
|
|
13677
|
+
})]
|
|
13678
|
+
}), filterItem.filter.id);
|
|
13679
|
+
}
|
|
13680
|
+
default:
|
|
13681
|
+
{
|
|
13682
|
+
return jsx(FilterListItem, Object.assign({}, filterItem), filterItem.filter.id);
|
|
13683
|
+
}
|
|
13684
|
+
}
|
|
13685
|
+
})
|
|
13607
13686
|
}))]
|
|
13608
13687
|
}))]
|
|
13609
13688
|
}))]
|
|
@@ -13963,8 +14042,8 @@ const WarningsOnStatus = ({
|
|
|
13963
14042
|
}, {
|
|
13964
14043
|
children: warnings.map(warning => {
|
|
13965
14044
|
var _a;
|
|
13966
|
-
const phenomenonDetails = warningPhenomena
|
|
13967
|
-
const levelDetails = levelOptions
|
|
14045
|
+
const phenomenonDetails = warningPhenomena.find(phenomenon => phenomenon.key === warning.warningDetail.phenomenon);
|
|
14046
|
+
const levelDetails = levelOptions.find(level => level.key === warning.warningDetail.level);
|
|
13968
14047
|
return jsx(ListItem, Object.assign({
|
|
13969
14048
|
sx: {
|
|
13970
14049
|
marginBottom: 0.25,
|
|
@@ -14046,14 +14125,14 @@ const WarningsOnStatus = ({
|
|
|
14046
14125
|
position: 'relative'
|
|
14047
14126
|
}
|
|
14048
14127
|
}, {
|
|
14049
|
-
children: [(phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.
|
|
14128
|
+
children: [(phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.translationKey) ? t(phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.translationKey) : '-', jsx(Box, Object.assign({
|
|
14050
14129
|
sx: {
|
|
14051
14130
|
position: 'absolute',
|
|
14052
14131
|
right: 0,
|
|
14053
14132
|
bottom: -6
|
|
14054
14133
|
}
|
|
14055
14134
|
}, {
|
|
14056
|
-
children: phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.
|
|
14135
|
+
children: getWarningPhenomenaIcon(phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.key)
|
|
14057
14136
|
}))]
|
|
14058
14137
|
})), jsx(WarningListColumnContent, Object.assign({
|
|
14059
14138
|
title: t('warning-list-header-level'),
|
|
@@ -14061,16 +14140,9 @@ const WarningsOnStatus = ({
|
|
|
14061
14140
|
}, {
|
|
14062
14141
|
children: jsx(Box, Object.assign({
|
|
14063
14142
|
component: "span",
|
|
14064
|
-
sx:
|
|
14065
|
-
color: levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.textColor,
|
|
14066
|
-
backgroundColor: levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.color,
|
|
14067
|
-
paddingLeft: 0.5,
|
|
14068
|
-
paddingRight: 0.5,
|
|
14069
|
-
paddingBottom: '1px',
|
|
14070
|
-
marginLeft: -0.5
|
|
14071
|
-
}
|
|
14143
|
+
sx: getLevelStyle(levelDetails)
|
|
14072
14144
|
}, {
|
|
14073
|
-
children: ((_a = warning.warningDetail) === null || _a === void 0 ? void 0 : _a.level) && (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.
|
|
14145
|
+
children: ((_a = warning.warningDetail) === null || _a === void 0 ? void 0 : _a.level) && (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.translationKey) ? t(levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.translationKey) : '-'
|
|
14074
14146
|
}))
|
|
14075
14147
|
})), jsx(WarningListColumnContent, Object.assign({
|
|
14076
14148
|
title: t('warning-list-header-status'),
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TFunction } from 'i18next';
|
|
3
2
|
export interface LevelColor {
|
|
4
3
|
color: string;
|
|
5
4
|
textColor: string;
|
|
6
5
|
}
|
|
7
|
-
interface LevelDetails extends LevelColor {
|
|
8
|
-
|
|
6
|
+
export interface LevelDetails extends LevelColor {
|
|
7
|
+
translationKey: string;
|
|
9
8
|
key: string;
|
|
10
9
|
}
|
|
11
10
|
export declare enum WarningLevel {
|
|
@@ -14,9 +13,9 @@ export declare enum WarningLevel {
|
|
|
14
13
|
extreme = "extreme"
|
|
15
14
|
}
|
|
16
15
|
export declare const LevelColors: Record<WarningLevel, LevelColor>;
|
|
17
|
-
export declare const
|
|
16
|
+
export declare const getLevelStyle: (levelColor?: LevelColor) => React.CSSProperties;
|
|
17
|
+
export declare const levelOptions: LevelDetails[];
|
|
18
18
|
export declare const LevelField: React.FC<{
|
|
19
19
|
isDisabled?: boolean;
|
|
20
20
|
isReadOnly?: boolean;
|
|
21
21
|
}>;
|
|
22
|
-
export {};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
interface PhenomenonDetails {
|
|
4
|
-
|
|
2
|
+
export declare const getWarningPhenomenaIcon: (key: string) => JSX.Element | undefined;
|
|
3
|
+
export interface PhenomenonDetails {
|
|
4
|
+
translationKey: string;
|
|
5
5
|
key: string;
|
|
6
|
-
icon: JSX.Element;
|
|
7
6
|
}
|
|
8
|
-
export declare const warningPhenomena:
|
|
7
|
+
export declare const warningPhenomena: PhenomenonDetails[];
|
|
9
8
|
export declare const Phenomenon: React.FC<{
|
|
10
9
|
isDisabled?: boolean;
|
|
11
10
|
isReadOnly?: boolean;
|
|
12
11
|
}>;
|
|
13
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,9 +7,11 @@ export declare const emptyFilter: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
checked: boolean;
|
|
9
9
|
};
|
|
10
|
+
type TranslateListDict = Record<string, string>;
|
|
10
11
|
export declare const defaultFilters: {
|
|
11
12
|
key: string;
|
|
12
13
|
translationKey: string;
|
|
14
|
+
translations?: TranslateListDict;
|
|
13
15
|
}[];
|
|
14
16
|
export declare const getFiltersFromWarnings: (warnings: PublicWarning[]) => WarningListFilter[];
|
|
15
17
|
export declare const isWarningMatchingFilter: (filters: OptionListItem[], filterId: EntityId, warningDetailValue: string) => boolean;
|
|
@@ -18,3 +20,4 @@ export declare const getUpdatedFilters: (filters: EntityState<WarningListFilter>
|
|
|
18
20
|
changes: WarningListFilter;
|
|
19
21
|
}[];
|
|
20
22
|
export declare const getUpdatedFilterList: (oldList: FilterListItemProps[], newList: FilterListItemProps[]) => FilterListItemProps[];
|
|
23
|
+
export {};
|