@opengeoweb/shared 2.12.0 → 2.15.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 +144 -91
- package/index.umd.js +128 -88
- 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/ConfirmationDialog/ConfirmationDialog.d.ts +1 -0
- package/lib/components/ConfirmationDialog/ConfirmationDialog.stories.d.ts +1 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/utils/axiosErrorUtils/axiosErrorUtils.d.ts +2 -0
- package/package.json +3 -3
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, 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';
|
|
4
|
-
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight,
|
|
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
|
+
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
7
|
import makeStyles from '@mui/styles/makeStyles';
|
|
@@ -101,6 +101,20 @@ function __rest(s, e) {
|
|
|
101
101
|
return t;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
var confirmStyle = {
|
|
105
|
+
width: {
|
|
106
|
+
xs: '100%',
|
|
107
|
+
sm: '150px'
|
|
108
|
+
},
|
|
109
|
+
marginLeft: {
|
|
110
|
+
xs: '0px!important',
|
|
111
|
+
sm: '8px!important'
|
|
112
|
+
},
|
|
113
|
+
marginTop: {
|
|
114
|
+
xs: 2,
|
|
115
|
+
sm: 0
|
|
116
|
+
}
|
|
117
|
+
};
|
|
104
118
|
var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
105
119
|
var open = _a.open,
|
|
106
120
|
title = _a.title,
|
|
@@ -116,7 +130,9 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
|
116
130
|
content = _a$content === void 0 ? null : _a$content,
|
|
117
131
|
_a$disableAutoFocus = _a.disableAutoFocus,
|
|
118
132
|
disableAutoFocus = _a$disableAutoFocus === void 0 ? false : _a$disableAutoFocus,
|
|
119
|
-
|
|
133
|
+
_a$isLoading = _a.isLoading,
|
|
134
|
+
isLoading = _a$isLoading === void 0 ? false : _a$isLoading,
|
|
135
|
+
other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
|
|
120
136
|
|
|
121
137
|
other.catchOnCancel;
|
|
122
138
|
var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
|
|
@@ -200,29 +216,28 @@ var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
|
200
216
|
return _onClose('CANCELLED');
|
|
201
217
|
},
|
|
202
218
|
disableFocusRipple: true
|
|
203
|
-
}, cancelLabel), /*#__PURE__*/React.createElement(
|
|
219
|
+
}, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
|
|
220
|
+
"data-testid": "confirm-dialog-spinner",
|
|
221
|
+
sx: Object.assign(Object.assign({}, confirmStyle), {
|
|
222
|
+
height: '40px',
|
|
223
|
+
display: 'flex',
|
|
224
|
+
justifyContent: 'center',
|
|
225
|
+
alignItems: 'center'
|
|
226
|
+
})
|
|
227
|
+
}, /*#__PURE__*/React.createElement(CircularProgress, {
|
|
228
|
+
size: 40,
|
|
229
|
+
color: "secondary"
|
|
230
|
+
})) : /*#__PURE__*/React.createElement(Button, {
|
|
204
231
|
"data-testid": "confirmationDialog-confirm",
|
|
205
232
|
variant: "primary",
|
|
206
233
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
207
234
|
sx: function sx(theme) {
|
|
208
|
-
return {
|
|
209
|
-
width: {
|
|
210
|
-
xs: '100%',
|
|
211
|
-
sm: '150px'
|
|
212
|
-
},
|
|
213
|
-
marginLeft: {
|
|
214
|
-
xs: '0px!important',
|
|
215
|
-
sm: '8px!important'
|
|
216
|
-
},
|
|
217
|
-
marginTop: {
|
|
218
|
-
xs: 2,
|
|
219
|
-
sm: 0
|
|
220
|
-
},
|
|
235
|
+
return Object.assign(Object.assign({}, confirmStyle), {
|
|
221
236
|
'&:focus': {
|
|
222
237
|
outline: theme.palette.geowebColors.buttons.focusDefault.outline,
|
|
223
238
|
borderColor: 'transparent'
|
|
224
239
|
}
|
|
225
|
-
};
|
|
240
|
+
});
|
|
226
241
|
},
|
|
227
242
|
onClick: onSubmit,
|
|
228
243
|
autoFocus: !disableAutoFocus,
|
|
@@ -855,7 +870,7 @@ var AlertBanner = function AlertBanner(_ref) {
|
|
|
855
870
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
856
871
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
857
872
|
* */
|
|
858
|
-
var useStyles$
|
|
873
|
+
var useStyles$6 = makeStyles(function () {
|
|
859
874
|
return {
|
|
860
875
|
wrapper: {
|
|
861
876
|
height: '100vh',
|
|
@@ -872,7 +887,7 @@ var useStyles$7 = makeStyles(function () {
|
|
|
872
887
|
var AppLayout = function AppLayout(_ref) {
|
|
873
888
|
var header = _ref.header,
|
|
874
889
|
children = _ref.children;
|
|
875
|
-
var classes = useStyles$
|
|
890
|
+
var classes = useStyles$6();
|
|
876
891
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
877
892
|
className: classes.wrapper
|
|
878
893
|
}, header, /*#__PURE__*/React__default.createElement("main", {
|
|
@@ -880,7 +895,7 @@ var AppLayout = function AppLayout(_ref) {
|
|
|
880
895
|
}, children));
|
|
881
896
|
};
|
|
882
897
|
|
|
883
|
-
var useStyles$
|
|
898
|
+
var useStyles$5 = makeStyles(function (theme) {
|
|
884
899
|
var _header;
|
|
885
900
|
|
|
886
901
|
return {
|
|
@@ -914,7 +929,7 @@ var AppHeader = function AppHeader(_ref) {
|
|
|
914
929
|
userMenu = _ref.userMenu,
|
|
915
930
|
_ref$title = _ref.title,
|
|
916
931
|
title = _ref$title === void 0 ? 'GeoWeb' : _ref$title;
|
|
917
|
-
var classes = useStyles$
|
|
932
|
+
var classes = useStyles$5();
|
|
918
933
|
return /*#__PURE__*/React__default.createElement("header", {
|
|
919
934
|
className: classes.header
|
|
920
935
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -1049,12 +1064,12 @@ var ResizeComponent = function ResizeComponent(_a) {
|
|
|
1049
1064
|
onResizeStop: onResizeStop,
|
|
1050
1065
|
handleComponent: {
|
|
1051
1066
|
bottomRight: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1052
|
-
isRightAligned: true,
|
|
1053
1067
|
style: {
|
|
1054
1068
|
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1055
1069
|
}
|
|
1056
1070
|
}),
|
|
1057
1071
|
bottomLeft: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1072
|
+
isRightAligned: true,
|
|
1058
1073
|
style: {
|
|
1059
1074
|
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1060
1075
|
}
|
|
@@ -1160,6 +1175,51 @@ ErrorBoundary.defaultProps = {
|
|
|
1160
1175
|
}
|
|
1161
1176
|
};
|
|
1162
1177
|
|
|
1178
|
+
/* *
|
|
1179
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1180
|
+
* you may not use this file except in compliance with the License.
|
|
1181
|
+
* You may obtain a copy of the License at
|
|
1182
|
+
*
|
|
1183
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1184
|
+
*
|
|
1185
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1186
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1187
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1188
|
+
* See the License for the specific language governing permissions and
|
|
1189
|
+
* limitations under the License.
|
|
1190
|
+
*
|
|
1191
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1192
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1193
|
+
* */
|
|
1194
|
+
var styles$3 = {
|
|
1195
|
+
small: {
|
|
1196
|
+
height: 16,
|
|
1197
|
+
width: 16,
|
|
1198
|
+
fontSize: '0.5rem'
|
|
1199
|
+
},
|
|
1200
|
+
large: {
|
|
1201
|
+
height: 32,
|
|
1202
|
+
width: 32,
|
|
1203
|
+
fontSize: '0.938rem'
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
var Avatar = function Avatar(_ref) {
|
|
1208
|
+
var children = _ref.children,
|
|
1209
|
+
_ref$size = _ref.size,
|
|
1210
|
+
size = _ref$size === void 0 ? 'large' : _ref$size;
|
|
1211
|
+
return /*#__PURE__*/React.createElement(Avatar$1, {
|
|
1212
|
+
"data-testid": "avatar",
|
|
1213
|
+
sx: Object.assign(Object.assign({}, styles$3[size]), {
|
|
1214
|
+
fontWeight: 500,
|
|
1215
|
+
color: 'geowebColors.brand.brand',
|
|
1216
|
+
backgroundColor: 'common.white',
|
|
1217
|
+
border: '0.1px solid',
|
|
1218
|
+
borderColor: 'geowebColors.brand.brand'
|
|
1219
|
+
})
|
|
1220
|
+
}, children);
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1163
1223
|
/* *
|
|
1164
1224
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1165
1225
|
* you may not use this file except in compliance with the License.
|
|
@@ -1176,40 +1236,30 @@ ErrorBoundary.defaultProps = {
|
|
|
1176
1236
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1177
1237
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1178
1238
|
* */
|
|
1179
|
-
var
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
paddingRight: 16
|
|
1197
|
-
}
|
|
1198
|
-
},
|
|
1199
|
-
button: {
|
|
1200
|
-
color: theme.palette.common.white,
|
|
1201
|
-
padding: 0
|
|
1202
|
-
},
|
|
1203
|
-
avatar: {
|
|
1204
|
-
height: 32,
|
|
1205
|
-
width: 32,
|
|
1206
|
-
fontSize: '0.938rem',
|
|
1207
|
-
fontWeight: 500,
|
|
1208
|
-
color: theme.palette.geowebColors.brand.brand,
|
|
1209
|
-
backgroundColor: theme.palette.common.white
|
|
1239
|
+
var styles$2 = {
|
|
1240
|
+
container: {
|
|
1241
|
+
position: 'absolute',
|
|
1242
|
+
top: 38,
|
|
1243
|
+
right: 20,
|
|
1244
|
+
width: 256,
|
|
1245
|
+
borderRadius: 0,
|
|
1246
|
+
boxShadow: 5,
|
|
1247
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
1248
|
+
},
|
|
1249
|
+
userMenu: {
|
|
1250
|
+
padding: 0,
|
|
1251
|
+
'& > li': {
|
|
1252
|
+
paddingTop: 3,
|
|
1253
|
+
paddingBottom: 3,
|
|
1254
|
+
paddingLeft: 2,
|
|
1255
|
+
paddingRight: 2
|
|
1210
1256
|
}
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1257
|
+
},
|
|
1258
|
+
button: {
|
|
1259
|
+
color: 'common.white',
|
|
1260
|
+
padding: 0
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1213
1263
|
|
|
1214
1264
|
var UserMenu = function UserMenu(_ref) {
|
|
1215
1265
|
var _ref$isOpen = _ref.isOpen,
|
|
@@ -1224,22 +1274,19 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
1224
1274
|
} : _ref$onClose,
|
|
1225
1275
|
children = _ref.children,
|
|
1226
1276
|
initials = _ref.initials;
|
|
1227
|
-
var classes = useStyles$5();
|
|
1228
1277
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
1229
1278
|
"data-testid": "userButton",
|
|
1230
1279
|
onClick: onToggle,
|
|
1231
|
-
|
|
1280
|
+
sx: styles$2.button,
|
|
1232
1281
|
size: "large"
|
|
1233
|
-
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
1234
|
-
|
|
1235
|
-
}, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1236
|
-
className: classes.container,
|
|
1282
|
+
}, /*#__PURE__*/React__default.createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1283
|
+
sx: styles$2.container,
|
|
1237
1284
|
"data-testid": "userMenu"
|
|
1238
1285
|
}, /*#__PURE__*/React__default.createElement(ClickAwayListener, {
|
|
1239
1286
|
onClickAway: onClose,
|
|
1240
1287
|
mouseEvent: "onMouseDown"
|
|
1241
1288
|
}, /*#__PURE__*/React__default.createElement(MenuList, {
|
|
1242
|
-
|
|
1289
|
+
sx: styles$2.userMenu,
|
|
1243
1290
|
variant: "menu"
|
|
1244
1291
|
}, children))));
|
|
1245
1292
|
};
|
|
@@ -1407,11 +1454,6 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1407
1454
|
_ref$leftComponent = _ref.leftComponent,
|
|
1408
1455
|
leftComponent = _ref$leftComponent === void 0 ? null : _ref$leftComponent;
|
|
1409
1456
|
var styles = getStyle(size);
|
|
1410
|
-
|
|
1411
|
-
var onClickClose = function onClickClose() {
|
|
1412
|
-
return onClose();
|
|
1413
|
-
};
|
|
1414
|
-
|
|
1415
1457
|
var columnSizeIcon = leftComponent ? 3 : 1;
|
|
1416
1458
|
var columnSizeTitle = leftComponent ? 6 : 10;
|
|
1417
1459
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -1479,7 +1521,8 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1479
1521
|
}
|
|
1480
1522
|
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
1481
1523
|
"data-testid": "closeBtn",
|
|
1482
|
-
onClick:
|
|
1524
|
+
onClick: onClose,
|
|
1525
|
+
onTouchEnd: onClose,
|
|
1483
1526
|
size: "large",
|
|
1484
1527
|
sx: iconStyle
|
|
1485
1528
|
}, /*#__PURE__*/React__default.createElement(Close, {
|
|
@@ -1860,7 +1903,7 @@ var shortcuts = [{
|
|
|
1860
1903
|
type: "connect"
|
|
1861
1904
|
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1862
1905
|
type: "icon"
|
|
1863
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1906
|
+
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1864
1907
|
type: "connect"
|
|
1865
1908
|
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1866
1909
|
type: "icon"
|
|
@@ -1904,7 +1947,7 @@ var shortcuts = [{
|
|
|
1904
1947
|
type: "connect"
|
|
1905
1948
|
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1906
1949
|
type: "icon"
|
|
1907
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1950
|
+
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1908
1951
|
type: "connect"
|
|
1909
1952
|
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1910
1953
|
type: "icon"
|
|
@@ -1924,7 +1967,7 @@ var shortcuts = [{
|
|
|
1924
1967
|
}, /*#__PURE__*/React__default.createElement(ArrowDown, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "(when slider active)")),
|
|
1925
1968
|
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1926
1969
|
type: "icon"
|
|
1927
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1970
|
+
}, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1928
1971
|
type: "connect"
|
|
1929
1972
|
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1930
1973
|
type: "icon"
|
|
@@ -1952,7 +1995,7 @@ var shortcuts = [{
|
|
|
1952
1995
|
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll")),
|
|
1953
1996
|
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
1954
1997
|
type: "icon"
|
|
1955
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1998
|
+
}, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll"))
|
|
1956
1999
|
}];
|
|
1957
2000
|
var getShortcutList = function getShortcutList(shortcutList) {
|
|
1958
2001
|
var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'windows';
|
|
@@ -2289,18 +2332,20 @@ var CustomSlider = function CustomSlider(_a) {
|
|
|
2289
2332
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2290
2333
|
* */
|
|
2291
2334
|
|
|
2292
|
-
var CustomToggleButton = function
|
|
2335
|
+
var CustomToggleButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2293
2336
|
var _a$variant = _a.variant,
|
|
2294
2337
|
variant = _a$variant === void 0 ? 'primary' : _a$variant,
|
|
2338
|
+
className = _a.className,
|
|
2295
2339
|
_a$value = _a.value,
|
|
2296
2340
|
value = _a$value === void 0 ? 0 : _a$value,
|
|
2297
|
-
props = __rest(_a, ["variant", "value"]);
|
|
2341
|
+
props = __rest(_a, ["variant", "className", "value"]);
|
|
2298
2342
|
|
|
2299
2343
|
return /*#__PURE__*/React.createElement(ToggleButton, Object.assign({
|
|
2300
|
-
|
|
2344
|
+
ref: ref,
|
|
2345
|
+
className: "".concat(variant, " ").concat(className),
|
|
2301
2346
|
value: value
|
|
2302
2347
|
}, props));
|
|
2303
|
-
};
|
|
2348
|
+
});
|
|
2304
2349
|
|
|
2305
2350
|
/* *
|
|
2306
2351
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2318,7 +2363,7 @@ var CustomToggleButton = function CustomToggleButton(_a) {
|
|
|
2318
2363
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2319
2364
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2320
2365
|
* */
|
|
2321
|
-
var ToolButton = function
|
|
2366
|
+
var ToolButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2322
2367
|
var active = _a.active,
|
|
2323
2368
|
_a$width = _a.width,
|
|
2324
2369
|
width = _a$width === void 0 ? '24px' : _a$width,
|
|
@@ -2334,6 +2379,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2334
2379
|
props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
|
|
2335
2380
|
|
|
2336
2381
|
return /*#__PURE__*/React.createElement(CustomToggleButton, Object.assign({
|
|
2382
|
+
ref: ref,
|
|
2337
2383
|
variant: variant,
|
|
2338
2384
|
disableRipple: true,
|
|
2339
2385
|
selected: active,
|
|
@@ -2348,7 +2394,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2348
2394
|
}
|
|
2349
2395
|
}, sx)
|
|
2350
2396
|
}, props), children);
|
|
2351
|
-
};
|
|
2397
|
+
});
|
|
2352
2398
|
|
|
2353
2399
|
var getPosition = function getPosition(menuPosition) {
|
|
2354
2400
|
switch (menuPosition) {
|
|
@@ -2490,10 +2536,10 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2490
2536
|
var useStyles = makeStyles(function (theme) {
|
|
2491
2537
|
return createStyles({
|
|
2492
2538
|
button: {
|
|
2493
|
-
height:
|
|
2494
|
-
width:
|
|
2539
|
+
height: 24,
|
|
2540
|
+
width: 24,
|
|
2495
2541
|
borderRadius: 5,
|
|
2496
|
-
marginTop:
|
|
2542
|
+
marginTop: 4,
|
|
2497
2543
|
color: function color(_ref) {
|
|
2498
2544
|
var isActive = _ref.isActive,
|
|
2499
2545
|
isAccessible = _ref.isAccessible,
|
|
@@ -2602,12 +2648,7 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
|
|
|
2602
2648
|
return /*#__PURE__*/React.createElement(ManagerButton, {
|
|
2603
2649
|
tooltipTitle: tooltipTitle,
|
|
2604
2650
|
onClick: onClickDelete,
|
|
2605
|
-
icon: /*#__PURE__*/React.createElement(Delete,
|
|
2606
|
-
sx: {
|
|
2607
|
-
width: 20,
|
|
2608
|
-
height: 20
|
|
2609
|
-
}
|
|
2610
|
-
}),
|
|
2651
|
+
icon: /*#__PURE__*/React.createElement(Delete, null),
|
|
2611
2652
|
testId: "deleteButton",
|
|
2612
2653
|
isEnabled: isEnabled
|
|
2613
2654
|
});
|
|
@@ -2876,7 +2917,8 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2876
2917
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2877
2918
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2878
2919
|
* */
|
|
2879
|
-
// Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2920
|
+
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2921
|
+
|
|
2880
2922
|
var isAxiosError = function isAxiosError(error) {
|
|
2881
2923
|
return error.isAxiosError !== undefined;
|
|
2882
2924
|
};
|
|
@@ -2891,7 +2933,18 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
|
|
|
2891
2933
|
return data.message;
|
|
2892
2934
|
}
|
|
2893
2935
|
|
|
2894
|
-
|
|
2936
|
+
if (error.message) {
|
|
2937
|
+
return error.message;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
return DEFAULT_ERROR_MESSAGE;
|
|
2941
|
+
};
|
|
2942
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
2943
|
+
if (isAxiosError(error)) {
|
|
2944
|
+
return getAxiosErrorMessage(error);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
2895
2948
|
};
|
|
2896
2949
|
|
|
2897
|
-
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, sliderStyles, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
|
|
2950
|
+
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, getErrorMessage, getInitials, getPosition, isAxiosError, showPrompt, sliderStyles, tooltipContainerStyles, useConfirmationDialog, useDialogActions, useDraftFormHelpers, useIsMounted, usePoller, usePreventBrowserClose, usePrevious, useUserMenu };
|
package/index.umd.js
CHANGED
|
@@ -159,6 +159,20 @@
|
|
|
159
159
|
}, content));
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
+
var confirmStyle = {
|
|
163
|
+
width: {
|
|
164
|
+
xs: '100%',
|
|
165
|
+
sm: '150px'
|
|
166
|
+
},
|
|
167
|
+
marginLeft: {
|
|
168
|
+
xs: '0px!important',
|
|
169
|
+
sm: '8px!important'
|
|
170
|
+
},
|
|
171
|
+
marginTop: {
|
|
172
|
+
xs: 2,
|
|
173
|
+
sm: 0
|
|
174
|
+
}
|
|
175
|
+
};
|
|
162
176
|
var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
163
177
|
var open = _a.open,
|
|
164
178
|
title = _a.title,
|
|
@@ -174,7 +188,9 @@
|
|
|
174
188
|
content = _e === void 0 ? null : _e,
|
|
175
189
|
_f = _a.disableAutoFocus,
|
|
176
190
|
disableAutoFocus = _f === void 0 ? false : _f,
|
|
177
|
-
|
|
191
|
+
_g = _a.isLoading,
|
|
192
|
+
isLoading = _g === void 0 ? false : _g,
|
|
193
|
+
other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
|
|
178
194
|
|
|
179
195
|
other.catchOnCancel;
|
|
180
196
|
var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
|
|
@@ -258,29 +274,28 @@
|
|
|
258
274
|
return _onClose('CANCELLED');
|
|
259
275
|
},
|
|
260
276
|
disableFocusRipple: true
|
|
261
|
-
}, cancelLabel), /*#__PURE__*/React__namespace.createElement(material.
|
|
277
|
+
}, cancelLabel), isLoading ? /*#__PURE__*/React__namespace.createElement(material.Box, {
|
|
278
|
+
"data-testid": "confirm-dialog-spinner",
|
|
279
|
+
sx: __assign(__assign({}, confirmStyle), {
|
|
280
|
+
height: '40px',
|
|
281
|
+
display: 'flex',
|
|
282
|
+
justifyContent: 'center',
|
|
283
|
+
alignItems: 'center'
|
|
284
|
+
})
|
|
285
|
+
}, /*#__PURE__*/React__namespace.createElement(material.CircularProgress, {
|
|
286
|
+
size: 40,
|
|
287
|
+
color: "secondary"
|
|
288
|
+
})) : /*#__PURE__*/React__namespace.createElement(material.Button, {
|
|
262
289
|
"data-testid": "confirmationDialog-confirm",
|
|
263
290
|
variant: "primary",
|
|
264
291
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
265
292
|
sx: function sx(theme) {
|
|
266
|
-
return {
|
|
267
|
-
width: {
|
|
268
|
-
xs: '100%',
|
|
269
|
-
sm: '150px'
|
|
270
|
-
},
|
|
271
|
-
marginLeft: {
|
|
272
|
-
xs: '0px!important',
|
|
273
|
-
sm: '8px!important'
|
|
274
|
-
},
|
|
275
|
-
marginTop: {
|
|
276
|
-
xs: 2,
|
|
277
|
-
sm: 0
|
|
278
|
-
},
|
|
293
|
+
return __assign(__assign({}, confirmStyle), {
|
|
279
294
|
'&:focus': {
|
|
280
295
|
outline: theme.palette.geowebColors.buttons.focusDefault.outline,
|
|
281
296
|
borderColor: 'transparent'
|
|
282
297
|
}
|
|
283
|
-
};
|
|
298
|
+
});
|
|
284
299
|
},
|
|
285
300
|
onClick: onSubmit,
|
|
286
301
|
autoFocus: !disableAutoFocus,
|
|
@@ -708,7 +723,7 @@
|
|
|
708
723
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
709
724
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
710
725
|
* */
|
|
711
|
-
var useStyles$
|
|
726
|
+
var useStyles$6 = makeStyles__default["default"](function () {
|
|
712
727
|
return {
|
|
713
728
|
wrapper: {
|
|
714
729
|
height: '100vh',
|
|
@@ -725,7 +740,7 @@
|
|
|
725
740
|
var AppLayout = function AppLayout(_a) {
|
|
726
741
|
var header = _a.header,
|
|
727
742
|
children = _a.children;
|
|
728
|
-
var classes = useStyles$
|
|
743
|
+
var classes = useStyles$6();
|
|
729
744
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
730
745
|
className: classes.wrapper
|
|
731
746
|
}, header, /*#__PURE__*/React__default["default"].createElement("main", {
|
|
@@ -749,7 +764,7 @@
|
|
|
749
764
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
750
765
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
751
766
|
* */
|
|
752
|
-
var useStyles$
|
|
767
|
+
var useStyles$5 = makeStyles__default["default"](function (theme) {
|
|
753
768
|
var _a;
|
|
754
769
|
|
|
755
770
|
return {
|
|
@@ -783,7 +798,7 @@
|
|
|
783
798
|
userMenu = _a.userMenu,
|
|
784
799
|
_b = _a.title,
|
|
785
800
|
title = _b === void 0 ? 'GeoWeb' : _b;
|
|
786
|
-
var classes = useStyles$
|
|
801
|
+
var classes = useStyles$5();
|
|
787
802
|
return /*#__PURE__*/React__default["default"].createElement("header", {
|
|
788
803
|
className: classes.header
|
|
789
804
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
@@ -918,12 +933,12 @@
|
|
|
918
933
|
onResizeStop: onResizeStop,
|
|
919
934
|
handleComponent: {
|
|
920
935
|
bottomRight: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
|
|
921
|
-
isRightAligned: true,
|
|
922
936
|
style: {
|
|
923
937
|
fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
|
|
924
938
|
}
|
|
925
939
|
}),
|
|
926
940
|
bottomLeft: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
|
|
941
|
+
isRightAligned: true,
|
|
927
942
|
style: {
|
|
928
943
|
fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
|
|
929
944
|
}
|
|
@@ -1021,6 +1036,35 @@
|
|
|
1021
1036
|
return ErrorBoundary;
|
|
1022
1037
|
}(React__namespace.Component);
|
|
1023
1038
|
|
|
1039
|
+
var styles$3 = {
|
|
1040
|
+
small: {
|
|
1041
|
+
height: 16,
|
|
1042
|
+
width: 16,
|
|
1043
|
+
fontSize: '0.5rem'
|
|
1044
|
+
},
|
|
1045
|
+
large: {
|
|
1046
|
+
height: 32,
|
|
1047
|
+
width: 32,
|
|
1048
|
+
fontSize: '0.938rem'
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
var Avatar = function Avatar(_a) {
|
|
1053
|
+
var children = _a.children,
|
|
1054
|
+
_b = _a.size,
|
|
1055
|
+
size = _b === void 0 ? 'large' : _b;
|
|
1056
|
+
return /*#__PURE__*/React__namespace.createElement(material.Avatar, {
|
|
1057
|
+
"data-testid": "avatar",
|
|
1058
|
+
sx: __assign(__assign({}, styles$3[size]), {
|
|
1059
|
+
fontWeight: 500,
|
|
1060
|
+
color: 'geowebColors.brand.brand',
|
|
1061
|
+
backgroundColor: 'common.white',
|
|
1062
|
+
border: '0.1px solid',
|
|
1063
|
+
borderColor: 'geowebColors.brand.brand'
|
|
1064
|
+
})
|
|
1065
|
+
}, children);
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1024
1068
|
/* *
|
|
1025
1069
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1026
1070
|
* you may not use this file except in compliance with the License.
|
|
@@ -1037,40 +1081,30 @@
|
|
|
1037
1081
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1038
1082
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1039
1083
|
* */
|
|
1040
|
-
var
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
paddingRight: 16
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
button: {
|
|
1061
|
-
color: theme.palette.common.white,
|
|
1062
|
-
padding: 0
|
|
1063
|
-
},
|
|
1064
|
-
avatar: {
|
|
1065
|
-
height: 32,
|
|
1066
|
-
width: 32,
|
|
1067
|
-
fontSize: '0.938rem',
|
|
1068
|
-
fontWeight: 500,
|
|
1069
|
-
color: theme.palette.geowebColors.brand.brand,
|
|
1070
|
-
backgroundColor: theme.palette.common.white
|
|
1084
|
+
var styles$2 = {
|
|
1085
|
+
container: {
|
|
1086
|
+
position: 'absolute',
|
|
1087
|
+
top: 38,
|
|
1088
|
+
right: 20,
|
|
1089
|
+
width: 256,
|
|
1090
|
+
borderRadius: 0,
|
|
1091
|
+
boxShadow: 5,
|
|
1092
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
1093
|
+
},
|
|
1094
|
+
userMenu: {
|
|
1095
|
+
padding: 0,
|
|
1096
|
+
'& > li': {
|
|
1097
|
+
paddingTop: 3,
|
|
1098
|
+
paddingBottom: 3,
|
|
1099
|
+
paddingLeft: 2,
|
|
1100
|
+
paddingRight: 2
|
|
1071
1101
|
}
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1102
|
+
},
|
|
1103
|
+
button: {
|
|
1104
|
+
color: 'common.white',
|
|
1105
|
+
padding: 0
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1074
1108
|
|
|
1075
1109
|
var UserMenu = function UserMenu(_a) {
|
|
1076
1110
|
var _b = _a.isOpen,
|
|
@@ -1085,22 +1119,19 @@
|
|
|
1085
1119
|
} : _d,
|
|
1086
1120
|
children = _a.children,
|
|
1087
1121
|
initials = _a.initials;
|
|
1088
|
-
var classes = useStyles$5();
|
|
1089
1122
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
1090
1123
|
"data-testid": "userButton",
|
|
1091
1124
|
onClick: onToggle,
|
|
1092
|
-
|
|
1125
|
+
sx: styles$2.button,
|
|
1093
1126
|
size: "large"
|
|
1094
|
-
}, /*#__PURE__*/React__default["default"].createElement(material.
|
|
1095
|
-
|
|
1096
|
-
}, initials)), isOpen && /*#__PURE__*/React__default["default"].createElement(material.Paper, {
|
|
1097
|
-
className: classes.container,
|
|
1127
|
+
}, /*#__PURE__*/React__default["default"].createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default["default"].createElement(material.Paper, {
|
|
1128
|
+
sx: styles$2.container,
|
|
1098
1129
|
"data-testid": "userMenu"
|
|
1099
1130
|
}, /*#__PURE__*/React__default["default"].createElement(material.ClickAwayListener, {
|
|
1100
1131
|
onClickAway: onClose,
|
|
1101
1132
|
mouseEvent: "onMouseDown"
|
|
1102
1133
|
}, /*#__PURE__*/React__default["default"].createElement(material.MenuList, {
|
|
1103
|
-
|
|
1134
|
+
sx: styles$2.userMenu,
|
|
1104
1135
|
variant: "menu"
|
|
1105
1136
|
}, children))));
|
|
1106
1137
|
};
|
|
@@ -1268,11 +1299,6 @@
|
|
|
1268
1299
|
_e = _a.leftComponent,
|
|
1269
1300
|
leftComponent = _e === void 0 ? null : _e;
|
|
1270
1301
|
var styles = getStyle(size);
|
|
1271
|
-
|
|
1272
|
-
var onClickClose = function onClickClose() {
|
|
1273
|
-
return onClose();
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
1302
|
var columnSizeIcon = leftComponent ? 3 : 1;
|
|
1277
1303
|
var columnSizeTitle = leftComponent ? 6 : 10;
|
|
1278
1304
|
return /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
@@ -1340,7 +1366,8 @@
|
|
|
1340
1366
|
}
|
|
1341
1367
|
}, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
1342
1368
|
"data-testid": "closeBtn",
|
|
1343
|
-
onClick:
|
|
1369
|
+
onClick: onClose,
|
|
1370
|
+
onTouchEnd: onClose,
|
|
1344
1371
|
size: "large",
|
|
1345
1372
|
sx: iconStyle
|
|
1346
1373
|
}, /*#__PURE__*/React__default["default"].createElement(theme.Close, {
|
|
@@ -1721,7 +1748,7 @@
|
|
|
1721
1748
|
type: "connect"
|
|
1722
1749
|
}, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1723
1750
|
type: "icon"
|
|
1724
|
-
}, /*#__PURE__*/React__default["default"].createElement(theme.
|
|
1751
|
+
}, /*#__PURE__*/React__default["default"].createElement(theme.KeyOption, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1725
1752
|
type: "connect"
|
|
1726
1753
|
}, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1727
1754
|
type: "icon"
|
|
@@ -1765,7 +1792,7 @@
|
|
|
1765
1792
|
type: "connect"
|
|
1766
1793
|
}, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1767
1794
|
type: "icon"
|
|
1768
|
-
}, /*#__PURE__*/React__default["default"].createElement(theme.
|
|
1795
|
+
}, /*#__PURE__*/React__default["default"].createElement(theme.KeyOption, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1769
1796
|
type: "connect"
|
|
1770
1797
|
}, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1771
1798
|
type: "icon"
|
|
@@ -1785,7 +1812,7 @@
|
|
|
1785
1812
|
}, /*#__PURE__*/React__default["default"].createElement(theme.ArrowDown, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, "(when slider active)")),
|
|
1786
1813
|
descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1787
1814
|
type: "icon"
|
|
1788
|
-
}, /*#__PURE__*/React__default["default"].createElement(theme.
|
|
1815
|
+
}, /*#__PURE__*/React__default["default"].createElement(theme.KeyCommand, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1789
1816
|
type: "connect"
|
|
1790
1817
|
}, "+"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1791
1818
|
type: "icon"
|
|
@@ -1813,7 +1840,7 @@
|
|
|
1813
1840
|
}, "Ctrl"), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, " + Mouse scroll")),
|
|
1814
1841
|
descriptionMac: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, {
|
|
1815
1842
|
type: "icon"
|
|
1816
|
-
}, /*#__PURE__*/React__default["default"].createElement(theme.
|
|
1843
|
+
}, /*#__PURE__*/React__default["default"].createElement(theme.KeyCommand, null)), /*#__PURE__*/React__default["default"].createElement(ShortCutSegment, null, " + Mouse scroll"))
|
|
1817
1844
|
}];
|
|
1818
1845
|
var getShortcutList = function getShortcutList(shortcutList, platform) {
|
|
1819
1846
|
if (platform === void 0) {
|
|
@@ -2183,18 +2210,20 @@
|
|
|
2183
2210
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2184
2211
|
* */
|
|
2185
2212
|
|
|
2186
|
-
var CustomToggleButton = function
|
|
2213
|
+
var CustomToggleButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
|
|
2187
2214
|
var _b = _a.variant,
|
|
2188
2215
|
variant = _b === void 0 ? 'primary' : _b,
|
|
2216
|
+
className = _a.className,
|
|
2189
2217
|
_c = _a.value,
|
|
2190
2218
|
value = _c === void 0 ? 0 : _c,
|
|
2191
|
-
props = __rest(_a, ["variant", "value"]);
|
|
2219
|
+
props = __rest(_a, ["variant", "className", "value"]);
|
|
2192
2220
|
|
|
2193
2221
|
return /*#__PURE__*/React__namespace.createElement(material.ToggleButton, __assign({
|
|
2194
|
-
|
|
2222
|
+
ref: ref,
|
|
2223
|
+
className: variant + " " + className,
|
|
2195
2224
|
value: value
|
|
2196
2225
|
}, props));
|
|
2197
|
-
};
|
|
2226
|
+
});
|
|
2198
2227
|
|
|
2199
2228
|
/* *
|
|
2200
2229
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2212,7 +2241,7 @@
|
|
|
2212
2241
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2213
2242
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2214
2243
|
* */
|
|
2215
|
-
var ToolButton = function
|
|
2244
|
+
var ToolButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
|
|
2216
2245
|
var active = _a.active,
|
|
2217
2246
|
_b = _a.width,
|
|
2218
2247
|
width = _b === void 0 ? '24px' : _b,
|
|
@@ -2228,6 +2257,7 @@
|
|
|
2228
2257
|
props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
|
|
2229
2258
|
|
|
2230
2259
|
return /*#__PURE__*/React__namespace.createElement(CustomToggleButton, __assign({
|
|
2260
|
+
ref: ref,
|
|
2231
2261
|
variant: variant,
|
|
2232
2262
|
disableRipple: true,
|
|
2233
2263
|
selected: active,
|
|
@@ -2242,7 +2272,7 @@
|
|
|
2242
2272
|
}
|
|
2243
2273
|
}, sx)
|
|
2244
2274
|
}, props), children);
|
|
2245
|
-
};
|
|
2275
|
+
});
|
|
2246
2276
|
|
|
2247
2277
|
var getPosition = function getPosition(menuPosition) {
|
|
2248
2278
|
switch (menuPosition) {
|
|
@@ -2383,10 +2413,10 @@
|
|
|
2383
2413
|
var useStyles = makeStyles__default["default"](function (theme) {
|
|
2384
2414
|
return createStyles__default["default"]({
|
|
2385
2415
|
button: {
|
|
2386
|
-
height:
|
|
2387
|
-
width:
|
|
2416
|
+
height: 24,
|
|
2417
|
+
width: 24,
|
|
2388
2418
|
borderRadius: 5,
|
|
2389
|
-
marginTop:
|
|
2419
|
+
marginTop: 4,
|
|
2390
2420
|
color: function color(_a) {
|
|
2391
2421
|
var isActive = _a.isActive,
|
|
2392
2422
|
isAccessible = _a.isAccessible,
|
|
@@ -2495,12 +2525,7 @@
|
|
|
2495
2525
|
return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
|
|
2496
2526
|
tooltipTitle: tooltipTitle,
|
|
2497
2527
|
onClick: onClickDelete,
|
|
2498
|
-
icon: /*#__PURE__*/React__namespace.createElement(theme.Delete,
|
|
2499
|
-
sx: {
|
|
2500
|
-
width: 20,
|
|
2501
|
-
height: 20
|
|
2502
|
-
}
|
|
2503
|
-
}),
|
|
2528
|
+
icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
|
|
2504
2529
|
testId: "deleteButton",
|
|
2505
2530
|
isEnabled: isEnabled
|
|
2506
2531
|
});
|
|
@@ -2786,7 +2811,8 @@
|
|
|
2786
2811
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2787
2812
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2788
2813
|
* */
|
|
2789
|
-
// Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2814
|
+
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2815
|
+
|
|
2790
2816
|
var isAxiosError = function isAxiosError(error) {
|
|
2791
2817
|
return error.isAxiosError !== undefined;
|
|
2792
2818
|
};
|
|
@@ -2801,17 +2827,30 @@
|
|
|
2801
2827
|
return data.message;
|
|
2802
2828
|
}
|
|
2803
2829
|
|
|
2804
|
-
|
|
2830
|
+
if (error.message) {
|
|
2831
|
+
return error.message;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
return DEFAULT_ERROR_MESSAGE;
|
|
2835
|
+
};
|
|
2836
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
2837
|
+
if (isAxiosError(error)) {
|
|
2838
|
+
return getAxiosErrorMessage(error);
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
2805
2842
|
};
|
|
2806
2843
|
|
|
2807
2844
|
exports.AlertBanner = AlertBanner;
|
|
2808
2845
|
exports.AlertIcon = AlertIcon;
|
|
2809
2846
|
exports.AppHeader = AppHeader;
|
|
2810
2847
|
exports.AppLayout = AppLayout;
|
|
2848
|
+
exports.Avatar = Avatar;
|
|
2811
2849
|
exports.ConfirmationDialog = ConfirmationDialog;
|
|
2812
2850
|
exports.ConfirmationServiceProvider = ConfirmationServiceProvider;
|
|
2813
2851
|
exports.CustomSlider = CustomSlider;
|
|
2814
2852
|
exports.CustomToggleButton = CustomToggleButton;
|
|
2853
|
+
exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
|
|
2815
2854
|
exports.Draggable = DraggableComponent$1;
|
|
2816
2855
|
exports.EnableButton = EnableButton;
|
|
2817
2856
|
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -2832,6 +2871,7 @@
|
|
|
2832
2871
|
exports.UserMenuItemTheme = MenuItemTheme;
|
|
2833
2872
|
exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
|
|
2834
2873
|
exports.getAxiosErrorMessage = getAxiosErrorMessage;
|
|
2874
|
+
exports.getErrorMessage = getErrorMessage;
|
|
2835
2875
|
exports.getInitials = getInitials;
|
|
2836
2876
|
exports.getPosition = getPosition;
|
|
2837
2877
|
exports.isAxiosError = isAxiosError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const AvatarLight: {
|
|
7
|
+
(): React.ReactElement;
|
|
8
|
+
storyName: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const AvatarDark: {
|
|
11
|
+
(): React.ReactElement;
|
|
12
|
+
storyName: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from './Avatar';
|
|
@@ -13,6 +13,7 @@ interface ConfirmationDialogProps extends ConfirmationOptions {
|
|
|
13
13
|
open: boolean;
|
|
14
14
|
onSubmit: () => void;
|
|
15
15
|
onClose: (reason: ConfirmationAction) => void;
|
|
16
|
+
isLoading?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare const ConfirmationDialog: React.FC<ConfirmationDialogProps>;
|
|
18
19
|
export default ConfirmationDialog;
|
|
@@ -4,6 +4,7 @@ declare const _default: {
|
|
|
4
4
|
};
|
|
5
5
|
export default _default;
|
|
6
6
|
export declare const ConfirmationDialogCustom: () => React.ReactElement;
|
|
7
|
+
export declare const ConfirmationDialogLoading: () => React.ReactElement;
|
|
7
8
|
export declare const ConfirmationDialogLight: {
|
|
8
9
|
(): React.ReactElement;
|
|
9
10
|
storyName: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AxiosError } from 'axios';
|
|
2
|
+
export declare const DEFAULT_ERROR_MESSAGE = "An error has occurred";
|
|
2
3
|
export declare const isAxiosError: (error: AxiosError | Error) => error is AxiosError<any, any>;
|
|
3
4
|
export declare const getAxiosErrorMessage: (error: AxiosError) => string;
|
|
5
|
+
export declare const getErrorMessage: (error: Error | AxiosError) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^17.0.2",
|
|
16
16
|
"@mui/material": "^5.2.8",
|
|
17
|
-
"@opengeoweb/theme": "2.
|
|
17
|
+
"@opengeoweb/theme": "2.15.0",
|
|
18
18
|
"@mui/styles": "^5.2.3",
|
|
19
19
|
"react-draggable": "^4.4.3",
|
|
20
20
|
"re-resizable": "^6.9.0",
|
|
21
21
|
"lodash": "^4.17.20",
|
|
22
|
-
"@opengeoweb/form-fields": "2.
|
|
22
|
+
"@opengeoweb/form-fields": "2.15.0",
|
|
23
23
|
"react-hook-form": "^6.12.1",
|
|
24
24
|
"moment": "^2.29.0",
|
|
25
25
|
"moment-timezone": "^0.5.31",
|