@opengeoweb/shared 2.13.0 → 3.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 +194 -139
- package/index.umd.js +179 -135
- 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/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 -3
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
@@ -8,7 +8,6 @@ import makeStyles from '@mui/styles/makeStyles';
|
|
|
8
8
|
import Draggable from 'react-draggable';
|
|
9
9
|
import { Resizable } from 're-resizable';
|
|
10
10
|
import { throttle } from 'lodash';
|
|
11
|
-
import withStyles from '@mui/styles/withStyles';
|
|
12
11
|
import createStyles from '@mui/styles/createStyles';
|
|
13
12
|
|
|
14
13
|
/* *
|
|
@@ -870,7 +869,7 @@ 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
|
-
var useStyles$
|
|
872
|
+
var useStyles$5 = makeStyles(function () {
|
|
874
873
|
return {
|
|
875
874
|
wrapper: {
|
|
876
875
|
height: '100vh',
|
|
@@ -887,7 +886,7 @@ var useStyles$7 = makeStyles(function () {
|
|
|
887
886
|
var AppLayout = function AppLayout(_ref) {
|
|
888
887
|
var header = _ref.header,
|
|
889
888
|
children = _ref.children;
|
|
890
|
-
var classes = useStyles$
|
|
889
|
+
var classes = useStyles$5();
|
|
891
890
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
892
891
|
className: classes.wrapper
|
|
893
892
|
}, header, /*#__PURE__*/React__default.createElement("main", {
|
|
@@ -895,45 +894,46 @@ var AppLayout = function AppLayout(_ref) {
|
|
|
895
894
|
}, children));
|
|
896
895
|
};
|
|
897
896
|
|
|
898
|
-
var
|
|
899
|
-
|
|
897
|
+
var styles$4 = {
|
|
898
|
+
header: function header(theme) {
|
|
899
|
+
var _ref;
|
|
900
900
|
|
|
901
|
-
|
|
902
|
-
header: (_header = {
|
|
901
|
+
return _ref = {
|
|
903
902
|
height: 40,
|
|
904
|
-
|
|
903
|
+
backgroundColor: theme.palette.geowebColors.brand.brand,
|
|
905
904
|
color: theme.palette.common.white,
|
|
906
905
|
boxShadow: theme.shadows[1],
|
|
907
906
|
zIndex: 1000
|
|
908
|
-
}, _defineProperty(
|
|
907
|
+
}, _defineProperty(_ref, theme.breakpoints.down('sm'), {
|
|
909
908
|
padding: '0 8px'
|
|
910
|
-
}), _defineProperty(
|
|
909
|
+
}), _defineProperty(_ref, theme.breakpoints.up('sm'), {
|
|
911
910
|
padding: '0 24px'
|
|
912
|
-
}),
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
}
|
|
911
|
+
}), _ref;
|
|
912
|
+
},
|
|
913
|
+
title: {
|
|
914
|
+
marginLeft: 1,
|
|
915
|
+
fontSize: '1.25rem',
|
|
916
|
+
fontWeight: 400,
|
|
917
|
+
overflow: 'hidden',
|
|
918
|
+
whiteSpace: 'nowrap',
|
|
919
|
+
textOverflow: 'ellipsis',
|
|
920
|
+
letterSpacing: '0.15px'
|
|
921
|
+
},
|
|
922
|
+
container: {
|
|
923
|
+
height: '100%'
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
926
|
|
|
927
|
-
var AppHeader = function AppHeader(
|
|
928
|
-
var menu =
|
|
929
|
-
userMenu =
|
|
930
|
-
|
|
931
|
-
title =
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
927
|
+
var AppHeader = function AppHeader(_ref2) {
|
|
928
|
+
var menu = _ref2.menu,
|
|
929
|
+
userMenu = _ref2.userMenu,
|
|
930
|
+
_ref2$title = _ref2.title,
|
|
931
|
+
title = _ref2$title === void 0 ? 'GeoWeb' : _ref2$title;
|
|
932
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
933
|
+
component: "header",
|
|
934
|
+
sx: styles$4.header
|
|
935
935
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
936
|
-
|
|
936
|
+
sx: styles$4.container,
|
|
937
937
|
container: true,
|
|
938
938
|
alignItems: "center"
|
|
939
939
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -954,7 +954,7 @@ var AppHeader = function AppHeader(_ref) {
|
|
|
954
954
|
wrap: "nowrap"
|
|
955
955
|
}, /*#__PURE__*/React__default.createElement(GeoWebLogo, null), /*#__PURE__*/React__default.createElement(Typography, {
|
|
956
956
|
variant: "h1",
|
|
957
|
-
|
|
957
|
+
sx: styles$4.title
|
|
958
958
|
}, title))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
959
959
|
item: true,
|
|
960
960
|
xs: 1,
|
|
@@ -1175,6 +1175,51 @@ ErrorBoundary.defaultProps = {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
};
|
|
1177
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
|
+
|
|
1178
1223
|
/* *
|
|
1179
1224
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1180
1225
|
* you may not use this file except in compliance with the License.
|
|
@@ -1191,40 +1236,30 @@ ErrorBoundary.defaultProps = {
|
|
|
1191
1236
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1192
1237
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1193
1238
|
* */
|
|
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
|
|
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
|
|
1225
1256
|
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1257
|
+
},
|
|
1258
|
+
button: {
|
|
1259
|
+
color: 'common.white',
|
|
1260
|
+
padding: 0
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1228
1263
|
|
|
1229
1264
|
var UserMenu = function UserMenu(_ref) {
|
|
1230
1265
|
var _ref$isOpen = _ref.isOpen,
|
|
@@ -1239,22 +1274,19 @@ var UserMenu = function UserMenu(_ref) {
|
|
|
1239
1274
|
} : _ref$onClose,
|
|
1240
1275
|
children = _ref.children,
|
|
1241
1276
|
initials = _ref.initials;
|
|
1242
|
-
var classes = useStyles$5();
|
|
1243
1277
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
1244
1278
|
"data-testid": "userButton",
|
|
1245
1279
|
onClick: onToggle,
|
|
1246
|
-
|
|
1280
|
+
sx: styles$2.button,
|
|
1247
1281
|
size: "large"
|
|
1248
|
-
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
1249
|
-
|
|
1250
|
-
}, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1251
|
-
className: classes.container,
|
|
1282
|
+
}, /*#__PURE__*/React__default.createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1283
|
+
sx: styles$2.container,
|
|
1252
1284
|
"data-testid": "userMenu"
|
|
1253
1285
|
}, /*#__PURE__*/React__default.createElement(ClickAwayListener, {
|
|
1254
1286
|
onClickAway: onClose,
|
|
1255
1287
|
mouseEvent: "onMouseDown"
|
|
1256
1288
|
}, /*#__PURE__*/React__default.createElement(MenuList, {
|
|
1257
|
-
|
|
1289
|
+
sx: styles$2.userMenu,
|
|
1258
1290
|
variant: "menu"
|
|
1259
1291
|
}, children))));
|
|
1260
1292
|
};
|
|
@@ -2183,65 +2215,56 @@ var getInitials = function getInitials(name) {
|
|
|
2183
2215
|
}
|
|
2184
2216
|
};
|
|
2185
2217
|
|
|
2186
|
-
var
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2218
|
+
var sliderHeaderStyle = {
|
|
2219
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2220
|
+
fontSize: 12,
|
|
2221
|
+
color: 'geowebColors.typographyAndIcons.text',
|
|
2222
|
+
padding: '11px 0 11px 16px'
|
|
2223
|
+
};
|
|
2224
|
+
var sliderStyle = {
|
|
2225
|
+
'& span.selectedLabel': {
|
|
2226
|
+
fontWeight: 'bold'
|
|
2227
|
+
},
|
|
2228
|
+
'& .MuiSlider-thumb': {
|
|
2229
|
+
backgroundColor: 'geowebColors.customSlider.thumb',
|
|
2230
|
+
boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
|
|
2231
|
+
'&.Mui-focusVisible, &:hover, &:active': {
|
|
2232
|
+
boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
|
|
2193
2233
|
}
|
|
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
|
|
2234
|
+
},
|
|
2235
|
+
'& .MuiSlider-mark': {
|
|
2236
|
+
backgroundColor: 'geowebColors.customSlider.mark'
|
|
2237
|
+
},
|
|
2238
|
+
'& .MuiSlider-markLabel': {
|
|
2239
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2240
|
+
fontSize: 12,
|
|
2241
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
2242
|
+
},
|
|
2243
|
+
'& .MuiSlider-track': {
|
|
2244
|
+
color: 'geowebColors.customSlider.track',
|
|
2245
|
+
backgroundColor: 'geowebColors.customSlider.track'
|
|
2246
|
+
},
|
|
2247
|
+
'& .MuiSlider-rail': {
|
|
2248
|
+
backgroundColor: 'geowebColors.customSlider.rail',
|
|
2249
|
+
opacity: 1
|
|
2250
|
+
},
|
|
2251
|
+
'&.Mui-disabled': {
|
|
2252
|
+
'& .MuiSlider-thumb': {
|
|
2253
|
+
backgroundColor: 'geowebColors.customSlider.thumbDisabled'
|
|
2224
2254
|
},
|
|
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
|
-
}
|
|
2255
|
+
'& .MuiSlider-mark': {
|
|
2256
|
+
backgroundColor: 'geowebColors.customSlider.markDisabled'
|
|
2232
2257
|
},
|
|
2233
|
-
|
|
2234
|
-
backgroundColor:
|
|
2235
|
-
|
|
2236
|
-
'$disabled &': {
|
|
2237
|
-
backgroundColor: theme.palette.geowebColors.customSlider.railDisabled,
|
|
2238
|
-
opacity: 1
|
|
2239
|
-
}
|
|
2258
|
+
'& .MuiSlider-track': {
|
|
2259
|
+
backgroundColor: 'geowebColors.customSlider.trackDisabled',
|
|
2260
|
+
color: 'geowebColors.customSlider.trackDisabled'
|
|
2240
2261
|
},
|
|
2241
|
-
|
|
2262
|
+
'& .MuiSlider-rail': {
|
|
2263
|
+
backgroundColor: 'geowebColors.customSlider.railDisabled',
|
|
2264
|
+
opacity: 1
|
|
2242
2265
|
}
|
|
2243
|
-
}
|
|
2244
|
-
}
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2245
2268
|
var CustomSlider = function CustomSlider(_a) {
|
|
2246
2269
|
var value = _a.value,
|
|
2247
2270
|
_a$orientation = _a.orientation,
|
|
@@ -2276,7 +2299,8 @@ var CustomSlider = function CustomSlider(_a) {
|
|
|
2276
2299
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2277
2300
|
|
|
2278
2301
|
}, []);
|
|
2279
|
-
return /*#__PURE__*/React.createElement(
|
|
2302
|
+
return /*#__PURE__*/React.createElement(Slider, Object.assign({
|
|
2303
|
+
sx: sliderStyle,
|
|
2280
2304
|
ref: element,
|
|
2281
2305
|
value: value,
|
|
2282
2306
|
orientation: orientation
|
|
@@ -2300,18 +2324,20 @@ var CustomSlider = function CustomSlider(_a) {
|
|
|
2300
2324
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2301
2325
|
* */
|
|
2302
2326
|
|
|
2303
|
-
var CustomToggleButton = function
|
|
2327
|
+
var CustomToggleButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2304
2328
|
var _a$variant = _a.variant,
|
|
2305
2329
|
variant = _a$variant === void 0 ? 'primary' : _a$variant,
|
|
2330
|
+
className = _a.className,
|
|
2306
2331
|
_a$value = _a.value,
|
|
2307
2332
|
value = _a$value === void 0 ? 0 : _a$value,
|
|
2308
|
-
props = __rest(_a, ["variant", "value"]);
|
|
2333
|
+
props = __rest(_a, ["variant", "className", "value"]);
|
|
2309
2334
|
|
|
2310
2335
|
return /*#__PURE__*/React.createElement(ToggleButton, Object.assign({
|
|
2311
|
-
|
|
2336
|
+
ref: ref,
|
|
2337
|
+
className: "".concat(variant, " ").concat(className),
|
|
2312
2338
|
value: value
|
|
2313
2339
|
}, props));
|
|
2314
|
-
};
|
|
2340
|
+
});
|
|
2315
2341
|
|
|
2316
2342
|
/* *
|
|
2317
2343
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2329,7 +2355,7 @@ var CustomToggleButton = function CustomToggleButton(_a) {
|
|
|
2329
2355
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2330
2356
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2331
2357
|
* */
|
|
2332
|
-
var ToolButton = function
|
|
2358
|
+
var ToolButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2333
2359
|
var active = _a.active,
|
|
2334
2360
|
_a$width = _a.width,
|
|
2335
2361
|
width = _a$width === void 0 ? '24px' : _a$width,
|
|
@@ -2345,6 +2371,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2345
2371
|
props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
|
|
2346
2372
|
|
|
2347
2373
|
return /*#__PURE__*/React.createElement(CustomToggleButton, Object.assign({
|
|
2374
|
+
ref: ref,
|
|
2348
2375
|
variant: variant,
|
|
2349
2376
|
disableRipple: true,
|
|
2350
2377
|
selected: active,
|
|
@@ -2359,7 +2386,7 @@ var ToolButton = function ToolButton(_a) {
|
|
|
2359
2386
|
}
|
|
2360
2387
|
}, sx)
|
|
2361
2388
|
}, props), children);
|
|
2362
|
-
};
|
|
2389
|
+
});
|
|
2363
2390
|
|
|
2364
2391
|
var getPosition = function getPosition(menuPosition) {
|
|
2365
2392
|
switch (menuPosition) {
|
|
@@ -2882,7 +2909,8 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2882
2909
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2883
2910
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2884
2911
|
* */
|
|
2885
|
-
// Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2912
|
+
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2913
|
+
|
|
2886
2914
|
var isAxiosError = function isAxiosError(error) {
|
|
2887
2915
|
return error.isAxiosError !== undefined;
|
|
2888
2916
|
};
|
|
@@ -2897,7 +2925,34 @@ var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
|
|
|
2897
2925
|
return data.message;
|
|
2898
2926
|
}
|
|
2899
2927
|
|
|
2900
|
-
|
|
2928
|
+
if (error.message) {
|
|
2929
|
+
return error.message;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
return DEFAULT_ERROR_MESSAGE;
|
|
2933
|
+
};
|
|
2934
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
2935
|
+
if (isAxiosError(error)) {
|
|
2936
|
+
return getAxiosErrorMessage(error);
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
2940
|
+
};
|
|
2941
|
+
var getAxiosWarningMessage = function getAxiosWarningMessage(error) {
|
|
2942
|
+
var data = error.response && error.response.data;
|
|
2943
|
+
|
|
2944
|
+
if (data && data.WarningMessage && typeof data.WarningMessage === 'string') {
|
|
2945
|
+
return data.WarningMessage;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
return '';
|
|
2949
|
+
};
|
|
2950
|
+
var getWarningMessage = function getWarningMessage(error) {
|
|
2951
|
+
if (isAxiosError(error)) {
|
|
2952
|
+
return getAxiosWarningMessage(error);
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
return '';
|
|
2901
2956
|
};
|
|
2902
2957
|
|
|
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,
|
|
2958
|
+
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 };
|
package/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('@mui/styles/makeStyles'), require('react-draggable'), require('re-resizable'), require('lodash'), require('@mui/styles/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', '@mui/styles/makeStyles', 'react-draggable', 're-resizable', 'lodash', '@mui/styles/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.makeStyles, global.Draggable, global.reResizable, global.lodash, global.
|
|
5
|
-
})(this, (function (exports, React, material, theme, reactHookForm, formFields, makeStyles, Draggable, reResizable, lodash,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('@mui/styles/makeStyles'), require('react-draggable'), require('re-resizable'), require('lodash'), require('@mui/styles/createStyles')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', '@mui/styles/makeStyles', 'react-draggable', 're-resizable', 'lodash', '@mui/styles/createStyles'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.makeStyles, global.Draggable, global.reResizable, global.lodash, global.createStyles));
|
|
5
|
+
})(this, (function (exports, React, material, theme, reactHookForm, formFields, makeStyles, Draggable, reResizable, lodash, createStyles) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
29
29
|
var makeStyles__default = /*#__PURE__*/_interopDefaultLegacy(makeStyles);
|
|
30
30
|
var Draggable__default = /*#__PURE__*/_interopDefaultLegacy(Draggable);
|
|
31
|
-
var withStyles__default = /*#__PURE__*/_interopDefaultLegacy(withStyles);
|
|
32
31
|
var createStyles__default = /*#__PURE__*/_interopDefaultLegacy(createStyles);
|
|
33
32
|
|
|
34
33
|
/*! *****************************************************************************
|
|
@@ -723,7 +722,7 @@
|
|
|
723
722
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
724
723
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
725
724
|
* */
|
|
726
|
-
var useStyles$
|
|
725
|
+
var useStyles$5 = makeStyles__default["default"](function () {
|
|
727
726
|
return {
|
|
728
727
|
wrapper: {
|
|
729
728
|
height: '100vh',
|
|
@@ -740,7 +739,7 @@
|
|
|
740
739
|
var AppLayout = function AppLayout(_a) {
|
|
741
740
|
var header = _a.header,
|
|
742
741
|
children = _a.children;
|
|
743
|
-
var classes = useStyles$
|
|
742
|
+
var classes = useStyles$5();
|
|
744
743
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
745
744
|
className: classes.wrapper
|
|
746
745
|
}, header, /*#__PURE__*/React__default["default"].createElement("main", {
|
|
@@ -764,13 +763,13 @@
|
|
|
764
763
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
765
764
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
766
765
|
* */
|
|
767
|
-
var
|
|
768
|
-
|
|
766
|
+
var styles$4 = {
|
|
767
|
+
header: function header(theme) {
|
|
768
|
+
var _a;
|
|
769
769
|
|
|
770
|
-
|
|
771
|
-
header: (_a = {
|
|
770
|
+
return _a = {
|
|
772
771
|
height: 40,
|
|
773
|
-
|
|
772
|
+
backgroundColor: theme.palette.geowebColors.brand.brand,
|
|
774
773
|
color: theme.palette.common.white,
|
|
775
774
|
boxShadow: theme.shadows[1],
|
|
776
775
|
zIndex: 1000
|
|
@@ -778,31 +777,32 @@
|
|
|
778
777
|
padding: '0 8px'
|
|
779
778
|
}, _a[theme.breakpoints.up('sm')] = {
|
|
780
779
|
padding: '0 24px'
|
|
781
|
-
}, _a
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
780
|
+
}, _a;
|
|
781
|
+
},
|
|
782
|
+
title: {
|
|
783
|
+
marginLeft: 1,
|
|
784
|
+
fontSize: '1.25rem',
|
|
785
|
+
fontWeight: 400,
|
|
786
|
+
overflow: 'hidden',
|
|
787
|
+
whiteSpace: 'nowrap',
|
|
788
|
+
textOverflow: 'ellipsis',
|
|
789
|
+
letterSpacing: '0.15px'
|
|
790
|
+
},
|
|
791
|
+
container: {
|
|
792
|
+
height: '100%'
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
795
|
|
|
796
796
|
var AppHeader = function AppHeader(_a) {
|
|
797
797
|
var menu = _a.menu,
|
|
798
798
|
userMenu = _a.userMenu,
|
|
799
799
|
_b = _a.title,
|
|
800
800
|
title = _b === void 0 ? 'GeoWeb' : _b;
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
801
|
+
return /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
802
|
+
component: "header",
|
|
803
|
+
sx: styles$4.header
|
|
804
804
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
805
|
-
|
|
805
|
+
sx: styles$4.container,
|
|
806
806
|
container: true,
|
|
807
807
|
alignItems: "center"
|
|
808
808
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
@@ -823,7 +823,7 @@
|
|
|
823
823
|
wrap: "nowrap"
|
|
824
824
|
}, /*#__PURE__*/React__default["default"].createElement(theme.GeoWebLogo, null), /*#__PURE__*/React__default["default"].createElement(material.Typography, {
|
|
825
825
|
variant: "h1",
|
|
826
|
-
|
|
826
|
+
sx: styles$4.title
|
|
827
827
|
}, title))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
828
828
|
item: true,
|
|
829
829
|
xs: 1,
|
|
@@ -1036,6 +1036,35 @@
|
|
|
1036
1036
|
return ErrorBoundary;
|
|
1037
1037
|
}(React__namespace.Component);
|
|
1038
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
|
+
|
|
1039
1068
|
/* *
|
|
1040
1069
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1041
1070
|
* you may not use this file except in compliance with the License.
|
|
@@ -1052,40 +1081,30 @@
|
|
|
1052
1081
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1053
1082
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1054
1083
|
* */
|
|
1055
|
-
var
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
paddingRight: 16
|
|
1073
|
-
}
|
|
1074
|
-
},
|
|
1075
|
-
button: {
|
|
1076
|
-
color: theme.palette.common.white,
|
|
1077
|
-
padding: 0
|
|
1078
|
-
},
|
|
1079
|
-
avatar: {
|
|
1080
|
-
height: 32,
|
|
1081
|
-
width: 32,
|
|
1082
|
-
fontSize: '0.938rem',
|
|
1083
|
-
fontWeight: 500,
|
|
1084
|
-
color: theme.palette.geowebColors.brand.brand,
|
|
1085
|
-
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
|
|
1086
1101
|
}
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1102
|
+
},
|
|
1103
|
+
button: {
|
|
1104
|
+
color: 'common.white',
|
|
1105
|
+
padding: 0
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1089
1108
|
|
|
1090
1109
|
var UserMenu = function UserMenu(_a) {
|
|
1091
1110
|
var _b = _a.isOpen,
|
|
@@ -1100,22 +1119,19 @@
|
|
|
1100
1119
|
} : _d,
|
|
1101
1120
|
children = _a.children,
|
|
1102
1121
|
initials = _a.initials;
|
|
1103
|
-
var classes = useStyles$5();
|
|
1104
1122
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
1105
1123
|
"data-testid": "userButton",
|
|
1106
1124
|
onClick: onToggle,
|
|
1107
|
-
|
|
1125
|
+
sx: styles$2.button,
|
|
1108
1126
|
size: "large"
|
|
1109
|
-
}, /*#__PURE__*/React__default["default"].createElement(material.
|
|
1110
|
-
|
|
1111
|
-
}, initials)), isOpen && /*#__PURE__*/React__default["default"].createElement(material.Paper, {
|
|
1112
|
-
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,
|
|
1113
1129
|
"data-testid": "userMenu"
|
|
1114
1130
|
}, /*#__PURE__*/React__default["default"].createElement(material.ClickAwayListener, {
|
|
1115
1131
|
onClickAway: onClose,
|
|
1116
1132
|
mouseEvent: "onMouseDown"
|
|
1117
1133
|
}, /*#__PURE__*/React__default["default"].createElement(material.MenuList, {
|
|
1118
|
-
|
|
1134
|
+
sx: styles$2.userMenu,
|
|
1119
1135
|
variant: "menu"
|
|
1120
1136
|
}, children))));
|
|
1121
1137
|
};
|
|
@@ -2078,65 +2094,56 @@
|
|
|
2078
2094
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2079
2095
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2080
2096
|
* */
|
|
2081
|
-
var
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2097
|
+
var sliderHeaderStyle = {
|
|
2098
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2099
|
+
fontSize: 12,
|
|
2100
|
+
color: 'geowebColors.typographyAndIcons.text',
|
|
2101
|
+
padding: '11px 0 11px 16px'
|
|
2102
|
+
};
|
|
2103
|
+
var sliderStyle = {
|
|
2104
|
+
'& span.selectedLabel': {
|
|
2105
|
+
fontWeight: 'bold'
|
|
2106
|
+
},
|
|
2107
|
+
'& .MuiSlider-thumb': {
|
|
2108
|
+
backgroundColor: 'geowebColors.customSlider.thumb',
|
|
2109
|
+
boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
|
|
2110
|
+
'&.Mui-focusVisible, &:hover, &:active': {
|
|
2111
|
+
boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
|
|
2088
2112
|
}
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
mark: {
|
|
2110
|
-
backgroundColor: theme.palette.geowebColors.customSlider.mark,
|
|
2111
|
-
'$disabled &': {
|
|
2112
|
-
backgroundColor: theme.palette.geowebColors.customSlider.markDisabled
|
|
2113
|
-
}
|
|
2114
|
-
},
|
|
2115
|
-
markLabel: {
|
|
2116
|
-
fontFamily: 'Roboto-Black, Roboto',
|
|
2117
|
-
fontSize: 12,
|
|
2118
|
-
color: theme.palette.geowebColors.typographyAndIcons.text
|
|
2113
|
+
},
|
|
2114
|
+
'& .MuiSlider-mark': {
|
|
2115
|
+
backgroundColor: 'geowebColors.customSlider.mark'
|
|
2116
|
+
},
|
|
2117
|
+
'& .MuiSlider-markLabel': {
|
|
2118
|
+
fontFamily: 'Roboto-Black, Roboto',
|
|
2119
|
+
fontSize: 12,
|
|
2120
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
2121
|
+
},
|
|
2122
|
+
'& .MuiSlider-track': {
|
|
2123
|
+
color: 'geowebColors.customSlider.track',
|
|
2124
|
+
backgroundColor: 'geowebColors.customSlider.track'
|
|
2125
|
+
},
|
|
2126
|
+
'& .MuiSlider-rail': {
|
|
2127
|
+
backgroundColor: 'geowebColors.customSlider.rail',
|
|
2128
|
+
opacity: 1
|
|
2129
|
+
},
|
|
2130
|
+
'&.Mui-disabled': {
|
|
2131
|
+
'& .MuiSlider-thumb': {
|
|
2132
|
+
backgroundColor: 'geowebColors.customSlider.thumbDisabled'
|
|
2119
2133
|
},
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
backgroundColor: theme.palette.geowebColors.customSlider.track,
|
|
2123
|
-
'$disabled &': {
|
|
2124
|
-
backgroundColor: theme.palette.geowebColors.customSlider.trackDisabled,
|
|
2125
|
-
color: theme.palette.geowebColors.customSlider.trackDisabled
|
|
2126
|
-
}
|
|
2134
|
+
'& .MuiSlider-mark': {
|
|
2135
|
+
backgroundColor: 'geowebColors.customSlider.markDisabled'
|
|
2127
2136
|
},
|
|
2128
|
-
|
|
2129
|
-
backgroundColor:
|
|
2130
|
-
|
|
2131
|
-
'$disabled &': {
|
|
2132
|
-
backgroundColor: theme.palette.geowebColors.customSlider.railDisabled,
|
|
2133
|
-
opacity: 1
|
|
2134
|
-
}
|
|
2137
|
+
'& .MuiSlider-track': {
|
|
2138
|
+
backgroundColor: 'geowebColors.customSlider.trackDisabled',
|
|
2139
|
+
color: 'geowebColors.customSlider.trackDisabled'
|
|
2135
2140
|
},
|
|
2136
|
-
|
|
2141
|
+
'& .MuiSlider-rail': {
|
|
2142
|
+
backgroundColor: 'geowebColors.customSlider.railDisabled',
|
|
2143
|
+
opacity: 1
|
|
2137
2144
|
}
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2140
2147
|
var CustomSlider = function CustomSlider(_a) {
|
|
2141
2148
|
var value = _a.value,
|
|
2142
2149
|
_b = _a.orientation,
|
|
@@ -2170,7 +2177,8 @@
|
|
|
2170
2177
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2171
2178
|
|
|
2172
2179
|
}, []);
|
|
2173
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
2180
|
+
return /*#__PURE__*/React__namespace.createElement(material.Slider, __assign({
|
|
2181
|
+
sx: sliderStyle,
|
|
2174
2182
|
ref: element,
|
|
2175
2183
|
value: value,
|
|
2176
2184
|
orientation: orientation
|
|
@@ -2194,18 +2202,20 @@
|
|
|
2194
2202
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2195
2203
|
* */
|
|
2196
2204
|
|
|
2197
|
-
var CustomToggleButton = function
|
|
2205
|
+
var CustomToggleButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
|
|
2198
2206
|
var _b = _a.variant,
|
|
2199
2207
|
variant = _b === void 0 ? 'primary' : _b,
|
|
2208
|
+
className = _a.className,
|
|
2200
2209
|
_c = _a.value,
|
|
2201
2210
|
value = _c === void 0 ? 0 : _c,
|
|
2202
|
-
props = __rest(_a, ["variant", "value"]);
|
|
2211
|
+
props = __rest(_a, ["variant", "className", "value"]);
|
|
2203
2212
|
|
|
2204
2213
|
return /*#__PURE__*/React__namespace.createElement(material.ToggleButton, __assign({
|
|
2205
|
-
|
|
2214
|
+
ref: ref,
|
|
2215
|
+
className: variant + " " + className,
|
|
2206
2216
|
value: value
|
|
2207
2217
|
}, props));
|
|
2208
|
-
};
|
|
2218
|
+
});
|
|
2209
2219
|
|
|
2210
2220
|
/* *
|
|
2211
2221
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2223,7 +2233,7 @@
|
|
|
2223
2233
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2224
2234
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2225
2235
|
* */
|
|
2226
|
-
var ToolButton = function
|
|
2236
|
+
var ToolButton = /*#__PURE__*/React__namespace.forwardRef(function (_a, ref) {
|
|
2227
2237
|
var active = _a.active,
|
|
2228
2238
|
_b = _a.width,
|
|
2229
2239
|
width = _b === void 0 ? '24px' : _b,
|
|
@@ -2239,6 +2249,7 @@
|
|
|
2239
2249
|
props = __rest(_a, ["active", "width", "height", "children", "value", "sx", "variant"]);
|
|
2240
2250
|
|
|
2241
2251
|
return /*#__PURE__*/React__namespace.createElement(CustomToggleButton, __assign({
|
|
2252
|
+
ref: ref,
|
|
2242
2253
|
variant: variant,
|
|
2243
2254
|
disableRipple: true,
|
|
2244
2255
|
selected: active,
|
|
@@ -2253,7 +2264,7 @@
|
|
|
2253
2264
|
}
|
|
2254
2265
|
}, sx)
|
|
2255
2266
|
}, props), children);
|
|
2256
|
-
};
|
|
2267
|
+
});
|
|
2257
2268
|
|
|
2258
2269
|
var getPosition = function getPosition(menuPosition) {
|
|
2259
2270
|
switch (menuPosition) {
|
|
@@ -2792,7 +2803,8 @@
|
|
|
2792
2803
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2793
2804
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2794
2805
|
* */
|
|
2795
|
-
// Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2806
|
+
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
2807
|
+
|
|
2796
2808
|
var isAxiosError = function isAxiosError(error) {
|
|
2797
2809
|
return error.isAxiosError !== undefined;
|
|
2798
2810
|
};
|
|
@@ -2807,17 +2819,46 @@
|
|
|
2807
2819
|
return data.message;
|
|
2808
2820
|
}
|
|
2809
2821
|
|
|
2810
|
-
|
|
2822
|
+
if (error.message) {
|
|
2823
|
+
return error.message;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
return DEFAULT_ERROR_MESSAGE;
|
|
2827
|
+
};
|
|
2828
|
+
var getErrorMessage = function getErrorMessage(error) {
|
|
2829
|
+
if (isAxiosError(error)) {
|
|
2830
|
+
return getAxiosErrorMessage(error);
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
2834
|
+
};
|
|
2835
|
+
var getAxiosWarningMessage = function getAxiosWarningMessage(error) {
|
|
2836
|
+
var data = error.response && error.response.data;
|
|
2837
|
+
|
|
2838
|
+
if (data && data.WarningMessage && typeof data.WarningMessage === 'string') {
|
|
2839
|
+
return data.WarningMessage;
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
return '';
|
|
2843
|
+
};
|
|
2844
|
+
var getWarningMessage = function getWarningMessage(error) {
|
|
2845
|
+
if (isAxiosError(error)) {
|
|
2846
|
+
return getAxiosWarningMessage(error);
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
return '';
|
|
2811
2850
|
};
|
|
2812
2851
|
|
|
2813
2852
|
exports.AlertBanner = AlertBanner;
|
|
2814
2853
|
exports.AlertIcon = AlertIcon;
|
|
2815
2854
|
exports.AppHeader = AppHeader;
|
|
2816
2855
|
exports.AppLayout = AppLayout;
|
|
2856
|
+
exports.Avatar = Avatar;
|
|
2817
2857
|
exports.ConfirmationDialog = ConfirmationDialog;
|
|
2818
2858
|
exports.ConfirmationServiceProvider = ConfirmationServiceProvider;
|
|
2819
2859
|
exports.CustomSlider = CustomSlider;
|
|
2820
2860
|
exports.CustomToggleButton = CustomToggleButton;
|
|
2861
|
+
exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
|
|
2821
2862
|
exports.Draggable = DraggableComponent$1;
|
|
2822
2863
|
exports.EnableButton = EnableButton;
|
|
2823
2864
|
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -2838,11 +2879,14 @@
|
|
|
2838
2879
|
exports.UserMenuItemTheme = MenuItemTheme;
|
|
2839
2880
|
exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
|
|
2840
2881
|
exports.getAxiosErrorMessage = getAxiosErrorMessage;
|
|
2882
|
+
exports.getAxiosWarningMessage = getAxiosWarningMessage;
|
|
2883
|
+
exports.getErrorMessage = getErrorMessage;
|
|
2841
2884
|
exports.getInitials = getInitials;
|
|
2842
2885
|
exports.getPosition = getPosition;
|
|
2886
|
+
exports.getWarningMessage = getWarningMessage;
|
|
2843
2887
|
exports.isAxiosError = isAxiosError;
|
|
2844
2888
|
exports.showPrompt = showPrompt;
|
|
2845
|
-
exports.
|
|
2889
|
+
exports.sliderHeaderStyle = sliderHeaderStyle;
|
|
2846
2890
|
exports.tooltipContainerStyles = tooltipContainerStyles;
|
|
2847
2891
|
exports.useConfirmationDialog = useConfirmationDialog;
|
|
2848
2892
|
exports.useDialogActions = useDialogActions;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const AppHeaderDark: {
|
|
7
|
+
(): React.ReactElement;
|
|
8
|
+
storyName: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const AppHeaderLight: {
|
|
11
|
+
(): React.ReactElement;
|
|
12
|
+
storyName: string;
|
|
13
|
+
};
|
|
@@ -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';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SliderProps } from '@mui/material';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const sliderHeaderStyle: {
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
fontSize: number;
|
|
6
|
+
color: string;
|
|
7
|
+
padding: string;
|
|
8
|
+
};
|
|
4
9
|
interface CustomSliderProps extends Omit<SliderProps, 'onChange'> {
|
|
5
10
|
onChange: (event: Event, newValue: number) => void;
|
|
6
11
|
shouldAutoFocus?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CustomSlider,
|
|
1
|
+
export { CustomSlider, sliderHeaderStyle } from './CustomSlider';
|
|
@@ -1,3 +1,7 @@
|
|
|
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;
|
|
6
|
+
export declare const getAxiosWarningMessage: (error: AxiosError) => string;
|
|
7
|
+
export declare const getWarningMessage: (error: AxiosError | Error) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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": "
|
|
17
|
+
"@opengeoweb/theme": "3.0.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": "
|
|
22
|
+
"@opengeoweb/form-fields": "3.0.0",
|
|
23
23
|
"react-hook-form": "^6.12.1",
|
|
24
24
|
"moment": "^2.29.0",
|
|
25
25
|
"moment-timezone": "^0.5.31",
|