@opengeoweb/shared 2.14.0 → 4.0.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 +306 -303
- package/index.umd.js +291 -315
- package/lib/components/AppHeader/AppHeader.stories.d.ts +12 -1
- package/lib/components/Avatar/Avatar.d.ts +7 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +13 -0
- package/lib/components/Avatar/index.d.ts +1 -0
- package/lib/components/CustomSlider/CustomSlider.d.ts +6 -1
- package/lib/components/CustomSlider/CustomSlider.stories.d.ts +0 -1
- package/lib/components/CustomSlider/index.d.ts +1 -1
- package/lib/components/ErrorBoundary/ErrorBoundary.stories.d.ts +0 -1
- package/lib/components/ManagerButton/ManagerButton.d.ts +1 -7
- package/lib/components/components.stories.d.ts +0 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/utils/axiosErrorUtils/axiosErrorUtils.d.ts +4 -0
- package/package.json +3 -4
package/index.esm.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
|
|
3
|
+
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
|
|
4
4
|
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, Delete, VisibilityOff, Visibility } from '@opengeoweb/theme';
|
|
5
5
|
import { useFormContext } from 'react-hook-form';
|
|
6
6
|
import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
|
|
7
|
-
import makeStyles from '@mui/styles/makeStyles';
|
|
8
7
|
import Draggable from 'react-draggable';
|
|
9
8
|
import { Resizable } from 're-resizable';
|
|
10
9
|
import { throttle } from 'lodash';
|
|
11
|
-
import withStyles from '@mui/styles/withStyles';
|
|
12
|
-
import createStyles from '@mui/styles/createStyles';
|
|
13
10
|
|
|
14
11
|
/* *
|
|
15
12
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -812,7 +809,7 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
812
809
|
}
|
|
813
810
|
},
|
|
814
811
|
'& .MuiAlert-icon': {
|
|
815
|
-
|
|
812
|
+
marginTop: '-3px',
|
|
816
813
|
padding: '0px'
|
|
817
814
|
}
|
|
818
815
|
} : {
|
|
@@ -833,13 +830,15 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
833
830
|
fontWeight: 'normal',
|
|
834
831
|
marginTop: '0px!important',
|
|
835
832
|
paddingTop: '0px!important',
|
|
836
|
-
marginBottom: '0px!important'
|
|
833
|
+
marginBottom: '0px!important',
|
|
834
|
+
lineHeight: isCompact ? '18px' : '24px'
|
|
837
835
|
}
|
|
838
836
|
}, title), info && /*#__PURE__*/React.createElement(Box, {
|
|
839
837
|
sx: {
|
|
840
838
|
fontSize: '16px',
|
|
841
839
|
marginTop: 1,
|
|
842
|
-
wordBreak: 'break-word'
|
|
840
|
+
wordBreak: 'break-word',
|
|
841
|
+
lineHeight: '22px'
|
|
843
842
|
}
|
|
844
843
|
}, info), actionButtonProps && /*#__PURE__*/React.createElement(Button, {
|
|
845
844
|
variant: "flat",
|
|
@@ -870,70 +869,66 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
870
869
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
871
870
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
872
871
|
* */
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
872
|
+
|
|
873
|
+
var AppLayout = function AppLayout(_ref) {
|
|
874
|
+
var header = _ref.header,
|
|
875
|
+
children = _ref.children;
|
|
876
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
877
|
+
sx: {
|
|
876
878
|
height: '100vh',
|
|
877
879
|
display: 'flex',
|
|
878
880
|
flexDirection: 'column'
|
|
879
881
|
},
|
|
880
|
-
|
|
882
|
+
"data-testid": "appLayout"
|
|
883
|
+
}, header, /*#__PURE__*/React__default.createElement(Box, {
|
|
884
|
+
component: "main",
|
|
885
|
+
sx: {
|
|
881
886
|
flex: 1,
|
|
882
887
|
position: 'relative'
|
|
883
888
|
}
|
|
884
|
-
};
|
|
885
|
-
});
|
|
886
|
-
|
|
887
|
-
var AppLayout = function AppLayout(_ref) {
|
|
888
|
-
var header = _ref.header,
|
|
889
|
-
children = _ref.children;
|
|
890
|
-
var classes = useStyles$7();
|
|
891
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
892
|
-
className: classes.wrapper
|
|
893
|
-
}, header, /*#__PURE__*/React__default.createElement("main", {
|
|
894
|
-
className: classes.main
|
|
895
889
|
}, children));
|
|
896
890
|
};
|
|
897
891
|
|
|
898
|
-
var
|
|
899
|
-
|
|
892
|
+
var styles$5 = {
|
|
893
|
+
header: function header(theme) {
|
|
894
|
+
var _ref;
|
|
900
895
|
|
|
901
|
-
|
|
902
|
-
header: (_header = {
|
|
896
|
+
return _ref = {
|
|
903
897
|
height: 40,
|
|
904
|
-
|
|
898
|
+
backgroundColor: theme.palette.geowebColors.brand.brand,
|
|
905
899
|
color: theme.palette.common.white,
|
|
906
900
|
boxShadow: theme.shadows[1],
|
|
907
901
|
zIndex: 1000
|
|
908
|
-
}, _defineProperty(
|
|
902
|
+
}, _defineProperty(_ref, theme.breakpoints.down('sm'), {
|
|
909
903
|
padding: '0 8px'
|
|
910
|
-
}), _defineProperty(
|
|
904
|
+
}), _defineProperty(_ref, theme.breakpoints.up('sm'), {
|
|
911
905
|
padding: '0 24px'
|
|
912
|
-
}),
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}
|
|
906
|
+
}), _ref;
|
|
907
|
+
},
|
|
908
|
+
title: {
|
|
909
|
+
marginLeft: 1,
|
|
910
|
+
fontSize: '1.25rem',
|
|
911
|
+
fontWeight: 400,
|
|
912
|
+
overflow: 'hidden',
|
|
913
|
+
whiteSpace: 'nowrap',
|
|
914
|
+
textOverflow: 'ellipsis',
|
|
915
|
+
letterSpacing: '0.15px'
|
|
916
|
+
},
|
|
917
|
+
container: {
|
|
918
|
+
height: '100%'
|
|
919
|
+
}
|
|
920
|
+
};
|
|
926
921
|
|
|
927
|
-
var AppHeader = function AppHeader(
|
|
928
|
-
var menu =
|
|
929
|
-
userMenu =
|
|
930
|
-
|
|
931
|
-
title =
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
922
|
+
var AppHeader = function AppHeader(_ref2) {
|
|
923
|
+
var menu = _ref2.menu,
|
|
924
|
+
userMenu = _ref2.userMenu,
|
|
925
|
+
_ref2$title = _ref2.title,
|
|
926
|
+
title = _ref2$title === void 0 ? 'GeoWeb' : _ref2$title;
|
|
927
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
928
|
+
component: "header",
|
|
929
|
+
sx: styles$5.header
|
|
935
930
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
936
|
-
|
|
931
|
+
sx: styles$5.container,
|
|
937
932
|
container: true,
|
|
938
933
|
alignItems: "center"
|
|
939
934
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -954,7 +949,7 @@ var AppHeader = function AppHeader(_ref) {
|
|
|
954
949
|
wrap: "nowrap"
|
|
955
950
|
}, /*#__PURE__*/React__default.createElement(GeoWebLogo, null), /*#__PURE__*/React__default.createElement(Typography, {
|
|
956
951
|
variant: "h1",
|
|
957
|
-
|
|
952
|
+
sx: styles$5.title
|
|
958
953
|
}, title))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
959
954
|
item: true,
|
|
960
955
|
xs: 1,
|
|
@@ -1175,6 +1170,51 @@ ErrorBoundary.defaultProps = {
|
|
|
1175
1170
|
}
|
|
1176
1171
|
};
|
|
1177
1172
|
|
|
1173
|
+
/* *
|
|
1174
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1175
|
+
* you may not use this file except in compliance with the License.
|
|
1176
|
+
* You may obtain a copy of the License at
|
|
1177
|
+
*
|
|
1178
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1179
|
+
*
|
|
1180
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1181
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1182
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1183
|
+
* See the License for the specific language governing permissions and
|
|
1184
|
+
* limitations under the License.
|
|
1185
|
+
*
|
|
1186
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1187
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1188
|
+
* */
|
|
1189
|
+
var styles$4 = {
|
|
1190
|
+
small: {
|
|
1191
|
+
height: 16,
|
|
1192
|
+
width: 16,
|
|
1193
|
+
fontSize: '0.5rem'
|
|
1194
|
+
},
|
|
1195
|
+
large: {
|
|
1196
|
+
height: 32,
|
|
1197
|
+
width: 32,
|
|
1198
|
+
fontSize: '0.938rem'
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
var Avatar = function Avatar(_ref) {
|
|
1203
|
+
var children = _ref.children,
|
|
1204
|
+
_ref$size = _ref.size,
|
|
1205
|
+
size = _ref$size === void 0 ? 'large' : _ref$size;
|
|
1206
|
+
return /*#__PURE__*/React.createElement(Avatar$1, {
|
|
1207
|
+
"data-testid": "avatar",
|
|
1208
|
+
sx: Object.assign(Object.assign({}, styles$4[size]), {
|
|
1209
|
+
fontWeight: 500,
|
|
1210
|
+
color: 'geowebColors.brand.brand',
|
|
1211
|
+
backgroundColor: 'common.white',
|
|
1212
|
+
border: '0.1px solid',
|
|
1213
|
+
borderColor: 'geowebColors.brand.brand'
|
|
1214
|
+
})
|
|
1215
|
+
}, children);
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1178
1218
|
/* *
|
|
1179
1219
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1180
1220
|
* you may not use this file except in compliance with the License.
|
|
@@ -1191,40 +1231,30 @@ ErrorBoundary.defaultProps = {
|
|
|
1191
1231
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1192
1232
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1193
1233
|
* */
|
|
1194
|
-
var
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
paddingRight: 16
|
|
1212
|
-
}
|
|
1213
|
-
},
|
|
1214
|
-
button: {
|
|
1215
|
-
color: theme.palette.common.white,
|
|
1216
|
-
padding: 0
|
|
1217
|
-
},
|
|
1218
|
-
avatar: {
|
|
1219
|
-
height: 32,
|
|
1220
|
-
width: 32,
|
|
1221
|
-
fontSize: '0.938rem',
|
|
1222
|
-
fontWeight: 500,
|
|
1223
|
-
color: theme.palette.geowebColors.brand.brand,
|
|
1224
|
-
backgroundColor: theme.palette.common.white
|
|
1234
|
+
var styles$3 = {
|
|
1235
|
+
container: {
|
|
1236
|
+
position: 'absolute',
|
|
1237
|
+
top: 38,
|
|
1238
|
+
right: 20,
|
|
1239
|
+
width: 256,
|
|
1240
|
+
borderRadius: 0,
|
|
1241
|
+
boxShadow: 5,
|
|
1242
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
1243
|
+
},
|
|
1244
|
+
userMenu: {
|
|
1245
|
+
padding: 0,
|
|
1246
|
+
'& > li': {
|
|
1247
|
+
paddingTop: 3,
|
|
1248
|
+
paddingBottom: 3,
|
|
1249
|
+
paddingLeft: 2,
|
|
1250
|
+
paddingRight: 2
|
|
1225
1251
|
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1252
|
+
},
|
|
1253
|
+
button: {
|
|
1254
|
+
color: 'common.white',
|
|
1255
|
+
padding: 0
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1228
1258
|
|
|
1229
1259
|
var UserMenu = function UserMenu(_ref) {
|
|
1230
1260
|
var _ref$isOpen = _ref.isOpen,
|
|
@@ -1239,22 +1269,19 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
1239
1269
|
} : _ref$onClose,
|
|
1240
1270
|
children = _ref.children,
|
|
1241
1271
|
initials = _ref.initials;
|
|
1242
|
-
var classes = useStyles$5();
|
|
1243
1272
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
1244
1273
|
"data-testid": "userButton",
|
|
1245
1274
|
onClick: onToggle,
|
|
1246
|
-
|
|
1275
|
+
sx: styles$3.button,
|
|
1247
1276
|
size: "large"
|
|
1248
|
-
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
1249
|
-
|
|
1250
|
-
}, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1251
|
-
className: classes.container,
|
|
1277
|
+
}, /*#__PURE__*/React__default.createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1278
|
+
sx: styles$3.container,
|
|
1252
1279
|
"data-testid": "userMenu"
|
|
1253
1280
|
}, /*#__PURE__*/React__default.createElement(ClickAwayListener, {
|
|
1254
1281
|
onClickAway: onClose,
|
|
1255
1282
|
mouseEvent: "onMouseDown"
|
|
1256
1283
|
}, /*#__PURE__*/React__default.createElement(MenuList, {
|
|
1257
|
-
|
|
1284
|
+
sx: styles$3.userMenu,
|
|
1258
1285
|
variant: "menu"
|
|
1259
1286
|
}, children))));
|
|
1260
1287
|
};
|
|
@@ -1322,22 +1349,17 @@ var MenuItemTheme = function MenuItemTheme() {
|
|
|
1322
1349
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1323
1350
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1324
1351
|
* */
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1352
|
+
|
|
1353
|
+
var ToolFooter = function ToolFooter() {
|
|
1354
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1355
|
+
component: "footer",
|
|
1356
|
+
sx: {
|
|
1357
|
+
boxShadow: 1,
|
|
1358
|
+
backgroundColor: 'geowebColors.background.surface',
|
|
1330
1359
|
textAlign: 'right',
|
|
1331
1360
|
height: 18,
|
|
1332
1361
|
zIndex: 1
|
|
1333
1362
|
}
|
|
1334
|
-
};
|
|
1335
|
-
}); // drag handles will be handled by DraggableResizable/Resizable
|
|
1336
|
-
|
|
1337
|
-
var ToolFooter = function ToolFooter() {
|
|
1338
|
-
var classes = useStyles$4();
|
|
1339
|
-
return /*#__PURE__*/React__default.createElement("footer", {
|
|
1340
|
-
className: classes.footer
|
|
1341
1363
|
});
|
|
1342
1364
|
};
|
|
1343
1365
|
|
|
@@ -1514,7 +1536,7 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1514
1536
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1515
1537
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1516
1538
|
* */
|
|
1517
|
-
var styles$
|
|
1539
|
+
var styles$2 = {
|
|
1518
1540
|
container: {
|
|
1519
1541
|
overflow: 'hidden',
|
|
1520
1542
|
borderRadius: 0,
|
|
@@ -1553,7 +1575,7 @@ var ToolContainer = function ToolContainer(_a) {
|
|
|
1553
1575
|
|
|
1554
1576
|
return /*#__PURE__*/React__default.createElement(Paper, Object.assign({
|
|
1555
1577
|
elevation: elevation,
|
|
1556
|
-
sx: styles$
|
|
1578
|
+
sx: styles$2.container
|
|
1557
1579
|
}, props), /*#__PURE__*/React__default.createElement(ErrorBoundary, null, /*#__PURE__*/React__default.createElement(ToolHeader, {
|
|
1558
1580
|
title: title,
|
|
1559
1581
|
size: size,
|
|
@@ -1562,7 +1584,7 @@ var ToolContainer = function ToolContainer(_a) {
|
|
|
1562
1584
|
className: headerClassName,
|
|
1563
1585
|
leftComponent: leftComponent
|
|
1564
1586
|
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
1565
|
-
sx: styles$
|
|
1587
|
+
sx: styles$2.content,
|
|
1566
1588
|
style: {
|
|
1567
1589
|
maxHeight: maxHeight
|
|
1568
1590
|
}
|
|
@@ -1756,75 +1778,63 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1756
1778
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1757
1779
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1758
1780
|
* */
|
|
1759
|
-
var
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
},
|
|
1785
|
-
connect: {
|
|
1786
|
-
fontSize: 18
|
|
1787
|
-
},
|
|
1788
|
-
divider: {
|
|
1789
|
-
margin: '0 6px',
|
|
1790
|
-
fontSize: 18
|
|
1791
|
-
}
|
|
1792
|
-
};
|
|
1793
|
-
});
|
|
1781
|
+
var segmentStyle = {
|
|
1782
|
+
margin: '0 2px',
|
|
1783
|
+
verticalAlign: 'middle',
|
|
1784
|
+
fontSize: 14,
|
|
1785
|
+
fontWeight: 500,
|
|
1786
|
+
letterSpacing: 0.25,
|
|
1787
|
+
justifyContent: 'center'
|
|
1788
|
+
};
|
|
1789
|
+
var styles$1 = {
|
|
1790
|
+
icon: Object.assign(Object.assign({}, segmentStyle), {
|
|
1791
|
+
backgroundColor: 'geowebColors.textInputField.default.rgba',
|
|
1792
|
+
width: 40,
|
|
1793
|
+
height: 40,
|
|
1794
|
+
display: 'inline-flex',
|
|
1795
|
+
alignItems: 'center',
|
|
1796
|
+
borderRadius: 1
|
|
1797
|
+
}),
|
|
1798
|
+
connect: Object.assign(Object.assign({}, segmentStyle), {
|
|
1799
|
+
fontSize: 18
|
|
1800
|
+
}),
|
|
1801
|
+
divider: Object.assign(Object.assign({}, segmentStyle), {
|
|
1802
|
+
margin: '0 6px',
|
|
1803
|
+
fontSize: 18
|
|
1804
|
+
})
|
|
1805
|
+
};
|
|
1794
1806
|
|
|
1795
1807
|
var ShortCutSegment = function ShortCutSegment(_ref) {
|
|
1796
1808
|
var _ref$type = _ref.type,
|
|
1797
1809
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
1798
1810
|
children = _ref.children;
|
|
1799
|
-
var classes = useStyles$3();
|
|
1800
1811
|
|
|
1801
1812
|
if (type === 'divider') {
|
|
1802
1813
|
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
1814
|
+
sx: styles$1.divider,
|
|
1803
1815
|
"data-testid": "segment-divider",
|
|
1804
|
-
className: "".concat(classes.segment, " ").concat(classes.divider),
|
|
1805
1816
|
component: "span"
|
|
1806
1817
|
}, children);
|
|
1807
1818
|
}
|
|
1808
1819
|
|
|
1809
1820
|
if (type === 'icon') {
|
|
1810
|
-
return /*#__PURE__*/React__default.createElement(
|
|
1821
|
+
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
1822
|
+
sx: styles$1.icon,
|
|
1811
1823
|
"data-testid": "segment-icon",
|
|
1812
|
-
className: "".concat(classes.segment, " ").concat(classes.icon)
|
|
1813
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
1814
1824
|
component: "span"
|
|
1815
|
-
}, children)
|
|
1825
|
+
}, children);
|
|
1816
1826
|
}
|
|
1817
1827
|
|
|
1818
1828
|
if (type === 'connect') {
|
|
1819
1829
|
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
1820
|
-
|
|
1830
|
+
sx: styles$1.connect,
|
|
1821
1831
|
"data-testid": "segment-connect",
|
|
1822
1832
|
component: "span"
|
|
1823
1833
|
}, children);
|
|
1824
1834
|
}
|
|
1825
1835
|
|
|
1826
1836
|
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
1827
|
-
|
|
1837
|
+
sx: segmentStyle,
|
|
1828
1838
|
"data-testid": "segment-text",
|
|
1829
1839
|
component: "span"
|
|
1830
1840
|
}, children);
|
|
@@ -1981,33 +1991,18 @@ var getShortcutList = function getShortcutList(shortcutList) {
|
|
|
1981
1991
|
});
|
|
1982
1992
|
});
|
|
1983
1993
|
};
|
|
1984
|
-
var useStyles$2 = makeStyles(function () {
|
|
1985
|
-
return {
|
|
1986
|
-
row: {
|
|
1987
|
-
minHeight: 56
|
|
1988
|
-
},
|
|
1989
|
-
title: {
|
|
1990
|
-
fontSize: 12,
|
|
1991
|
-
fontWeight: 300,
|
|
1992
|
-
letterSpacing: 0.4,
|
|
1993
|
-
opacity: 0.67
|
|
1994
|
-
},
|
|
1995
|
-
description: {
|
|
1996
|
-
alignItems: 'center'
|
|
1997
|
-
}
|
|
1998
|
-
};
|
|
1999
|
-
});
|
|
2000
1994
|
|
|
2001
1995
|
var ShortcutList = function ShortcutList(_ref2) {
|
|
2002
1996
|
var _ref2$platform = _ref2.platform,
|
|
2003
1997
|
platform = _ref2$platform === void 0 ? 'windows' : _ref2$platform;
|
|
2004
|
-
var classes = useStyles$2();
|
|
2005
1998
|
var rows = getShortcutList(shortcuts, platform);
|
|
2006
1999
|
return /*#__PURE__*/React__default.createElement(List, {
|
|
2007
2000
|
"data-testid": "list-".concat(platform)
|
|
2008
2001
|
}, rows.map(function (row, index) {
|
|
2009
2002
|
return /*#__PURE__*/React__default.createElement(ListItem, {
|
|
2010
|
-
|
|
2003
|
+
sx: {
|
|
2004
|
+
minHeight: 56
|
|
2005
|
+
},
|
|
2011
2006
|
divider: index !== rows.length - 1,
|
|
2012
2007
|
key: row.title
|
|
2013
2008
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -2017,11 +2012,18 @@ var ShortcutList = function ShortcutList(_ref2) {
|
|
|
2017
2012
|
alignItems: "center"
|
|
2018
2013
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
2019
2014
|
item: true,
|
|
2020
|
-
|
|
2015
|
+
sx: {
|
|
2016
|
+
fontSize: 12,
|
|
2017
|
+
fontWeight: 300,
|
|
2018
|
+
letterSpacing: 0.4,
|
|
2019
|
+
opacity: 0.67
|
|
2020
|
+
}
|
|
2021
2021
|
}, row.title), /*#__PURE__*/React__default.createElement(Grid, {
|
|
2022
2022
|
item: true
|
|
2023
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
2024
|
-
|
|
2023
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
2024
|
+
sx: {
|
|
2025
|
+
alignItems: 'center'
|
|
2026
|
+
}
|
|
2025
2027
|
}, row.description))));
|
|
2026
2028
|
}));
|
|
2027
2029
|
};
|
|
@@ -2080,17 +2082,7 @@ var CheatSheet = function CheatSheet() {
|
|
|
2080
2082
|
})));
|
|
2081
2083
|
};
|
|
2082
2084
|
|
|
2083
|
-
var useStyles$1 = makeStyles(function () {
|
|
2084
|
-
return {
|
|
2085
|
-
backdrop: {
|
|
2086
|
-
zIndex: 1
|
|
2087
|
-
}
|
|
2088
|
-
};
|
|
2089
|
-
});
|
|
2090
|
-
|
|
2091
2085
|
var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
|
|
2092
|
-
var classes = useStyles$1();
|
|
2093
|
-
|
|
2094
2086
|
var _React$useState = React__default.useState(false),
|
|
2095
2087
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2096
2088
|
open = _React$useState2[0],
|
|
@@ -2115,7 +2107,9 @@ var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
|
|
|
2115
2107
|
}, "Cheat sheet"))), /*#__PURE__*/React__default.createElement(Backdrop, {
|
|
2116
2108
|
"data-testid": "cheatsheet-content",
|
|
2117
2109
|
open: open,
|
|
2118
|
-
|
|
2110
|
+
sx: {
|
|
2111
|
+
zIndex: 1
|
|
2112
|
+
}
|
|
2119
2113
|
}, /*#__PURE__*/React__default.createElement(DraggableComponent, {
|
|
2120
2114
|
startSize: {
|
|
2121
2115
|
width: 700
|
|
@@ -2183,65 +2177,56 @@ var getInitials = function getInitials(name) {
|
|
|
2183
2177
|
}
|
|
2184
2178
|
};
|
|
2185
2179
|
|
|
2186
|
-
var
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2180
|
+
var sliderHeaderStyle = {
|
|
2181
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2182
|
+
fontSize: 12,
|
|
2183
|
+
color: 'geowebColors.typographyAndIcons.text',
|
|
2184
|
+
padding: '11px 0 11px 16px'
|
|
2185
|
+
};
|
|
2186
|
+
var sliderStyle = {
|
|
2187
|
+
'& span.selectedLabel': {
|
|
2188
|
+
fontWeight: 'bold'
|
|
2189
|
+
},
|
|
2190
|
+
'& .MuiSlider-thumb': {
|
|
2191
|
+
backgroundColor: 'geowebColors.customSlider.thumb',
|
|
2192
|
+
boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
|
|
2193
|
+
'&.Mui-focusVisible, &:hover, &:active': {
|
|
2194
|
+
boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
|
|
2193
2195
|
}
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
mark: {
|
|
2215
|
-
backgroundColor: theme.palette.geowebColors.customSlider.mark,
|
|
2216
|
-
'$disabled &': {
|
|
2217
|
-
backgroundColor: theme.palette.geowebColors.customSlider.markDisabled
|
|
2218
|
-
}
|
|
2219
|
-
},
|
|
2220
|
-
markLabel: {
|
|
2221
|
-
fontFamily: 'Roboto-Black, Roboto',
|
|
2222
|
-
fontSize: 12,
|
|
2223
|
-
color: theme.palette.geowebColors.typographyAndIcons.text
|
|
2196
|
+
},
|
|
2197
|
+
'& .MuiSlider-mark': {
|
|
2198
|
+
backgroundColor: 'geowebColors.customSlider.mark'
|
|
2199
|
+
},
|
|
2200
|
+
'& .MuiSlider-markLabel': {
|
|
2201
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2202
|
+
fontSize: 12,
|
|
2203
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
2204
|
+
},
|
|
2205
|
+
'& .MuiSlider-track': {
|
|
2206
|
+
color: 'geowebColors.customSlider.track',
|
|
2207
|
+
backgroundColor: 'geowebColors.customSlider.track'
|
|
2208
|
+
},
|
|
2209
|
+
'& .MuiSlider-rail': {
|
|
2210
|
+
backgroundColor: 'geowebColors.customSlider.rail',
|
|
2211
|
+
opacity: 1
|
|
2212
|
+
},
|
|
2213
|
+
'&.Mui-disabled': {
|
|
2214
|
+
'& .MuiSlider-thumb': {
|
|
2215
|
+
backgroundColor: 'geowebColors.customSlider.thumbDisabled'
|
|
2224
2216
|
},
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
backgroundColor: theme.palette.geowebColors.customSlider.track,
|
|
2228
|
-
'$disabled &': {
|
|
2229
|
-
backgroundColor: theme.palette.geowebColors.customSlider.trackDisabled,
|
|
2230
|
-
color: theme.palette.geowebColors.customSlider.trackDisabled
|
|
2231
|
-
}
|
|
2217
|
+
'& .MuiSlider-mark': {
|
|
2218
|
+
backgroundColor: 'geowebColors.customSlider.markDisabled'
|
|
2232
2219
|
},
|
|
2233
|
-
|
|
2234
|
-
backgroundColor:
|
|
2235
|
-
|
|
2236
|
-
'$disabled &': {
|
|
2237
|
-
backgroundColor: theme.palette.geowebColors.customSlider.railDisabled,
|
|
2238
|
-
opacity: 1
|
|
2239
|
-
}
|
|
2220
|
+
'& .MuiSlider-track': {
|
|
2221
|
+
backgroundColor: 'geowebColors.customSlider.trackDisabled',
|
|
2222
|
+
color: 'geowebColors.customSlider.trackDisabled'
|
|
2240
2223
|
},
|
|
2241
|
-
|
|
2224
|
+
'& .MuiSlider-rail': {
|
|
2225
|
+
backgroundColor: 'geowebColors.customSlider.railDisabled',
|
|
2226
|
+
opacity: 1
|
|
2242
2227
|
}
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2245
2230
|
var CustomSlider = function CustomSlider(_a) {
|
|
2246
2231
|
var value = _a.value,
|
|
2247
2232
|
_a$orientation = _a.orientation,
|
|
@@ -2276,7 +2261,8 @@ var CustomSlider = function CustomSlider(_a) {
|
|
|
2276
2261
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2277
2262
|
|
|
2278
2263
|
}, []);
|
|
2279
|
-
return /*#__PURE__*/React.createElement(
|
|
2264
|
+
return /*#__PURE__*/React.createElement(Slider, Object.assign({
|
|
2265
|
+
sx: sliderStyle,
|
|
2280
2266
|
ref: element,
|
|
2281
2267
|
value: value,
|
|
2282
2268
|
orientation: orientation
|
|
@@ -2300,18 +2286,20 @@ var CustomSlider = function CustomSlider(_a) {
|
|
|
2300
2286
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2301
2287
|
* */
|
|
2302
2288
|
|
|
2303
|
-
var CustomToggleButton = function
|
|
2289
|
+
var CustomToggleButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2304
2290
|
var _a$variant = _a.variant,
|
|
2305
2291
|
variant = _a$variant === void 0 ? 'primary' : _a$variant,
|
|
2292
|
+
className = _a.className,
|
|
2306
2293
|
_a$value = _a.value,
|
|
2307
2294
|
value = _a$value === void 0 ? 0 : _a$value,
|
|
2308
|
-
props = __rest(_a, ["variant", "value"]);
|
|
2295
|
+
props = __rest(_a, ["variant", "className", "value"]);
|
|
2309
2296
|
|
|
2310
2297
|
return /*#__PURE__*/React.createElement(ToggleButton, Object.assign({
|
|
2311
|
-
|
|
2298
|
+
ref: ref,
|
|
2299
|
+
className: "".concat(variant, " ").concat(className),
|
|
2312
2300
|
value: value
|
|
2313
2301
|
}, props));
|
|
2314
|
-
};
|
|
2302
|
+
});
|
|
2315
2303
|
|
|
2316
2304
|
/* *
|
|
2317
2305
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2329,7 +2317,7 @@ var CustomToggleButton = function CustomToggleButton(_a) {
|
|
|
2329
2317
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2330
2318
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2331
2319
|
* */
|
|
2332
|
-
var ToolButton = function
|
|
2320
|
+
var ToolButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2333
2321
|
var active = _a.active,
|
|
2334
2322
|
_a$width = _a.width,
|
|
2335
2323
|
width = _a$width === void 0 ? '24px' : _a$width,
|
|
@@ -2345,6 +2333,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2345
2333
|
props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
|
|
2346
2334
|
|
|
2347
2335
|
return /*#__PURE__*/React.createElement(CustomToggleButton, Object.assign({
|
|
2336
|
+
ref: ref,
|
|
2348
2337
|
variant: variant,
|
|
2349
2338
|
disableRipple: true,
|
|
2350
2339
|
selected: active,
|
|
@@ -2359,7 +2348,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2359
2348
|
}
|
|
2360
2349
|
}, sx)
|
|
2361
2350
|
}, props), children);
|
|
2362
|
-
};
|
|
2351
|
+
});
|
|
2363
2352
|
|
|
2364
2353
|
var getPosition = function getPosition(menuPosition) {
|
|
2365
2354
|
switch (menuPosition) {
|
|
@@ -2444,14 +2433,14 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2444
2433
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
2445
2434
|
placement: "top",
|
|
2446
2435
|
title: tooltipTitle
|
|
2447
|
-
}, /*#__PURE__*/React.createElement(
|
|
2436
|
+
}, /*#__PURE__*/React.createElement(ToolButton, {
|
|
2448
2437
|
active: isOpen,
|
|
2449
2438
|
sx: buttonSx,
|
|
2450
2439
|
onClick: handleClick,
|
|
2451
2440
|
"data-testid": buttonTestId,
|
|
2452
2441
|
variant: variant,
|
|
2453
2442
|
id: buttonTestId
|
|
2454
|
-
}, /*#__PURE__*/React.createElement(Options, null)))
|
|
2443
|
+
}, /*#__PURE__*/React.createElement(Options, null))), /*#__PURE__*/React.createElement(Menu, {
|
|
2455
2444
|
anchorEl: anchorEl,
|
|
2456
2445
|
open: isOpen,
|
|
2457
2446
|
onClose: handleClose,
|
|
@@ -2498,56 +2487,46 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2498
2487
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2499
2488
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2500
2489
|
* */
|
|
2501
|
-
var useStyles = makeStyles(function (theme) {
|
|
2502
|
-
return createStyles({
|
|
2503
|
-
button: {
|
|
2504
|
-
height: 24,
|
|
2505
|
-
width: 24,
|
|
2506
|
-
borderRadius: 5,
|
|
2507
|
-
marginTop: 4,
|
|
2508
|
-
color: function color(_ref) {
|
|
2509
|
-
var isActive = _ref.isActive,
|
|
2510
|
-
isAccessible = _ref.isAccessible,
|
|
2511
|
-
isEnabled = _ref.isEnabled;
|
|
2512
|
-
|
|
2513
|
-
if (!isEnabled) {
|
|
2514
|
-
return theme.palette.geowebColors.buttons.flat.disabled.color;
|
|
2515
|
-
}
|
|
2516
2490
|
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2491
|
+
var makeButtonStyles = function makeButtonStyles(isActive, isEnabled, isAccessible) {
|
|
2492
|
+
return {
|
|
2493
|
+
height: '24px',
|
|
2494
|
+
width: '24px',
|
|
2495
|
+
borderRadius: '5px',
|
|
2496
|
+
marginTop: '4px',
|
|
2497
|
+
color: function color() {
|
|
2498
|
+
if (!isEnabled) {
|
|
2499
|
+
return 'geowebColors.buttons.flat.disabled.color';
|
|
2500
|
+
}
|
|
2520
2501
|
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2502
|
+
if (isAccessible) {
|
|
2503
|
+
return 'geowebColors.greys.accessible';
|
|
2504
|
+
}
|
|
2524
2505
|
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
backgroundColor: function backgroundColor(_ref2) {
|
|
2528
|
-
var isActive = _ref2.isActive;
|
|
2529
|
-
return isActive ? theme.palette.geowebColors.buttons.primary.active.fill : 'inherit';
|
|
2530
|
-
},
|
|
2531
|
-
'&:focus': {
|
|
2532
|
-
backgroundColor: function backgroundColor(_ref3) {
|
|
2533
|
-
var isActive = _ref3.isActive;
|
|
2534
|
-
return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
|
|
2535
|
-
},
|
|
2536
|
-
outline: theme.palette.geowebColors.buttons.focusDefault.outline,
|
|
2537
|
-
borderRadius: 0
|
|
2538
|
-
},
|
|
2539
|
-
'&:hover': {
|
|
2540
|
-
backgroundColor: function backgroundColor(_ref4) {
|
|
2541
|
-
var isActive = _ref4.isActive;
|
|
2542
|
-
return isActive ? theme.palette.geowebColors.buttons.primary.mouseOver.fill : theme.palette.geowebColors.buttons.flat.mouseOver.fill;
|
|
2543
|
-
}
|
|
2506
|
+
if (isActive) {
|
|
2507
|
+
return 'common.white';
|
|
2544
2508
|
}
|
|
2509
|
+
|
|
2510
|
+
return 'geowebColors.buttons.flat.default.color';
|
|
2545
2511
|
},
|
|
2546
|
-
|
|
2547
|
-
|
|
2512
|
+
backgroundColor: function backgroundColor() {
|
|
2513
|
+
return isActive ? 'geowebColors.buttons.primary.active.fill' : 'inherit';
|
|
2514
|
+
},
|
|
2515
|
+
'&:focus': {
|
|
2516
|
+
backgroundColor: function backgroundColor() {
|
|
2517
|
+
return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
|
|
2518
|
+
},
|
|
2519
|
+
outline: 'geowebColors.buttons.focusDefault.outline',
|
|
2520
|
+
borderRadius: 0
|
|
2521
|
+
},
|
|
2522
|
+
'&:hover': {
|
|
2523
|
+
backgroundColor: function backgroundColor() {
|
|
2524
|
+
return isActive ? 'geowebColors.buttons.primary.mouseOver.fill' : 'geowebColors.buttons.flat.mouseOver.fill';
|
|
2525
|
+
}
|
|
2548
2526
|
}
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2551
2530
|
var ManagerButton = function ManagerButton(_a) {
|
|
2552
2531
|
var _a$tooltipTitle = _a.tooltipTitle,
|
|
2553
2532
|
tooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
|
|
@@ -2561,14 +2540,10 @@ var ManagerButton = function ManagerButton(_a) {
|
|
|
2561
2540
|
testId = _a.testId,
|
|
2562
2541
|
_a$isAccessible = _a.isAccessible,
|
|
2563
2542
|
isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
|
|
2564
|
-
|
|
2565
|
-
props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "
|
|
2543
|
+
sx = _a.sx,
|
|
2544
|
+
props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx"]);
|
|
2566
2545
|
|
|
2567
|
-
var
|
|
2568
|
-
isActive: isActive,
|
|
2569
|
-
isEnabled: isEnabled,
|
|
2570
|
-
isAccessible: isAccessible
|
|
2571
|
-
});
|
|
2546
|
+
var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
|
|
2572
2547
|
|
|
2573
2548
|
var handleClick = function handleClick(event) {
|
|
2574
2549
|
onClick(event);
|
|
@@ -2577,14 +2552,14 @@ var ManagerButton = function ManagerButton(_a) {
|
|
|
2577
2552
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
2578
2553
|
title: tooltipTitle,
|
|
2579
2554
|
placement: "top",
|
|
2580
|
-
|
|
2581
|
-
|
|
2555
|
+
sx: {
|
|
2556
|
+
pointerEvents: 'none'
|
|
2582
2557
|
}
|
|
2583
2558
|
}, /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
2584
2559
|
size: "small",
|
|
2585
2560
|
onClick: handleClick,
|
|
2586
2561
|
"data-testid": testId,
|
|
2587
|
-
|
|
2562
|
+
sx: Object.assign(Object.assign({}, buttonStyles), sx),
|
|
2588
2563
|
disableFocusRipple: true
|
|
2589
2564
|
}, props), icon));
|
|
2590
2565
|
};
|
|
@@ -2882,7 +2857,8 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2882
2857
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2883
2858
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2884
2859
|
* */
|
|
2885
|
-
// Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2860
|
+
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2861
|
+
|
|
2886
2862
|
var isAxiosError = function isAxiosError(error) {
|
|
2887
2863
|
return error.isAxiosError !== undefined;
|
|
2888
2864
|
};
|
|
@@ -2897,7 +2873,34 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
|
|
|
2897
2873
|
return data.message;
|
|
2898
2874
|
}
|
|
2899
2875
|
|
|
2900
|
-
|
|
2876
|
+
if (error.message) {
|
|
2877
|
+
return error.message;
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
return DEFAULT_ERROR_MESSAGE;
|
|
2881
|
+
};
|
|
2882
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
2883
|
+
if (isAxiosError(error)) {
|
|
2884
|
+
return getAxiosErrorMessage(error);
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
2888
|
+
};
|
|
2889
|
+
var getAxiosWarningMessage = function getAxiosWarningMessage(error) {
|
|
2890
|
+
var data = error.response && error.response.data;
|
|
2891
|
+
|
|
2892
|
+
if (data && data.WarningMessage && typeof data.WarningMessage === 'string') {
|
|
2893
|
+
return data.WarningMessage;
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
return '';
|
|
2897
|
+
};
|
|
2898
|
+
var getWarningMessage = function getWarningMessage(error) {
|
|
2899
|
+
if (isAxiosError(error)) {
|
|
2900
|
+
return getAxiosWarningMessage(error);
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
return '';
|
|
2901
2904
|
};
|
|
2902
2905
|
|
|
2903
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getInitials, getPosition, isAxiosError, showPrompt,
|
|
2906
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomSlider, CustomToggleButton, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, calculateDialogSizeAndPosition, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
|