@opengeoweb/shared 4.21.0 → 4.22.1
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.js +25306 -0
- package/package.json +15 -16
- package/{lib → src/lib}/components/ConfirmationDialog/ConfirmationDialog.d.ts +5 -2
- package/{lib → src/lib}/utils/axiosErrorUtils/axiosErrorUtils.d.ts +1 -1
- package/{lib → src/lib}/utils/dateUtils/dateUtils.d.ts +28 -0
- package/index.esm.js +0 -3538
- package/index.umd.js +0 -3537
- /package/{index.d.ts → src/index.d.ts} +0 -0
- /package/{lib → src/lib}/components/AlertBanner/AlertBanner.d.ts +0 -0
- /package/{lib → src/lib}/components/AlertBanner/AlertBanner.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/AlertBanner/AlertBanner.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/AlertBanner/index.d.ts +0 -0
- /package/{lib → src/lib}/components/AlertIcon/AlertIcon.d.ts +0 -0
- /package/{lib → src/lib}/components/AlertIcon/index.d.ts +0 -0
- /package/{lib → src/lib}/components/AppHeader/AppHeader.d.ts +0 -0
- /package/{lib → src/lib}/components/AppHeader/AppHeader.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/AppHeader/AppHeader.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/AppHeader/index.d.ts +0 -0
- /package/{lib → src/lib}/components/AppLayout/AppLayout.d.ts +0 -0
- /package/{lib → src/lib}/components/AppLayout/AppLayout.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/AppLayout/AppLayout.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/AppLayout/index.d.ts +0 -0
- /package/{lib → src/lib}/components/Avatar/Avatar.d.ts +0 -0
- /package/{lib → src/lib}/components/Avatar/Avatar.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/Avatar/index.d.ts +0 -0
- /package/{lib → src/lib}/components/ConfirmationDialog/ConfirmationDialog.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ConfirmationDialog/ConfirmationDialog.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ConfirmationDialog/ConfirmationService.d.ts +0 -0
- /package/{lib → src/lib}/components/ConfirmationDialog/ConfirmationService.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ConfirmationDialog/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomAccordion/CustomAccordion.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomAccordion/CustomAccordion.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomAccordion/CustomAccordion.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomAccordion/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomDialog/CustomDialog.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomDialog/CustomDialog.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomDialog/CustomDialog.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomDialog/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomIconButton/CustomIconButton.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomIconButton/CustomIconButton.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomIconButton/CustomIconButton.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomIconButton/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomSlider/CustomSlider.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomSlider/CustomSlider.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomSlider/CustomSlider.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomSlider/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomToggleButton/CustomToggleButton.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomToggleButton/CustomToggleButton.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomToggleButton/CustomToggleButton.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomToggleButton/index.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomTooltip/CustomTooltip.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomTooltip/CustomTooltip.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/CustomTooltip/index.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/Draggable.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/Draggable.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/Resizable.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/Resizable.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/index.d.ts +0 -0
- /package/{lib → src/lib}/components/DraggableResizable/types.d.ts +0 -0
- /package/{lib → src/lib}/components/ErrorBoundary/ErrorBoundary.d.ts +0 -0
- /package/{lib → src/lib}/components/ErrorBoundary/ErrorBoundary.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ErrorBoundary/ErrorBoundary.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ErrorBoundary/index.d.ts +0 -0
- /package/{lib → src/lib}/components/Providers/Providers.d.ts +0 -0
- /package/{lib → src/lib}/components/Providers/index.d.ts +0 -0
- /package/{lib → src/lib}/components/SearchHighlight/SearchHighlight.d.ts +0 -0
- /package/{lib → src/lib}/components/SearchHighlight/SearchHighlight.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/SearchHighlight/SearchHighlight.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/SearchHighlight/index.d.ts +0 -0
- /package/{lib → src/lib}/components/StatusTag/StatusTag.d.ts +0 -0
- /package/{lib → src/lib}/components/StatusTag/StatusTag.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/StatusTag/StatusTag.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/StatusTag/index.d.ts +0 -0
- /package/{lib → src/lib}/components/ToggleMenu/ToggleMenu.d.ts +0 -0
- /package/{lib → src/lib}/components/ToggleMenu/ToggleMenu.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ToggleMenu/ToggleMenu.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ToggleMenu/index.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainer.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainer.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainer.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainerDraggable.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainerDraggable.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainerDraggable.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolContainerSnapShots.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolFooter.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolFooter.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolHeader.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolHeader.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/ToolHeader.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/index.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/types.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/useHandleSizeFromOutsideComponent.d.ts +0 -0
- /package/{lib → src/lib}/components/ToolContainer/useHandleSizeFromOutsideComponent.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/TooltipSelect/TooltipSelect.d.ts +0 -0
- /package/{lib → src/lib}/components/TooltipSelect/TooltipSelect.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/TooltipSelect/TooltipSelect.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/TooltipSelect/index.d.ts +0 -0
- /package/{lib → src/lib}/components/TooltipSelect/tooltipContainerStyles.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/CheatSheet.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/CheatSheet.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/CheatSheet.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/ShortcutList.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/ShortcutList.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/ShortcutSegment.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/CheatSheet/ShortcutSegment.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenu.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenu.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenu.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenuItemCheatSheet.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenuItemCheatSheet.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenuItemTheme.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/UserMenuItemTheme.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/index.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/useUserMenu.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/useUserMenu.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/UserMenu/utils.d.ts +0 -0
- /package/{lib → src/lib}/components/WithEggs/WithEggs.d.ts +0 -0
- /package/{lib → src/lib}/components/WithEggs/WithEggs.spec.d.ts +0 -0
- /package/{lib → src/lib}/components/WithEggs/index.d.ts +0 -0
- /package/{lib → src/lib}/components/components.stories.d.ts +0 -0
- /package/{lib → src/lib}/components/index.d.ts +0 -0
- /package/{lib → src/lib}/hooks/index.d.ts +0 -0
- /package/{lib → src/lib}/hooks/useIsMounted/useIsMounted.d.ts +0 -0
- /package/{lib → src/lib}/hooks/useIsMounted/useIsMounted.spec.d.ts +0 -0
- /package/{lib → src/lib}/hooks/useMakeSureContainerStaysInsideWindow/useMakeSureContainerStaysInsideWindow.d.ts +0 -0
- /package/{lib → src/lib}/hooks/useMakeSureContainerStaysInsideWindow/useMakeSureContainerStaysInsideWindow.spec.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePoller/usePoller.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePoller/usePoller.spec.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePoller/usePoller.stories.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePreventBrowserClose/usePreventBrowserClose.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePreventBrowserClose/usePreventBrowserClose.spec.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePreventBrowserClose/usePreventBrowserClose.stories.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePrevious/usePrevious.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePrevious/usePrevious.spec.d.ts +0 -0
- /package/{lib → src/lib}/hooks/usePrevious/usePrevious.stories.d.ts +0 -0
- /package/{lib → src/lib}/storyshots/Storyshots.spec.d.ts +0 -0
- /package/{lib → src/lib}/utils/axiosErrorUtils/axiosErrorUtils.spec.d.ts +0 -0
- /package/{lib → src/lib}/utils/axiosErrorUtils/index.d.ts +0 -0
- /package/{lib → src/lib}/utils/dateUtils/dateUtils.spec.d.ts +0 -0
- /package/{lib → src/lib}/utils/dateUtils/index.d.ts +0 -0
- /package/{lib → src/lib}/utils/index.d.ts +0 -0
package/index.esm.js
DELETED
|
@@ -1,3538 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import React__default, { useRef } from 'react';
|
|
3
|
-
import { Box, Typography, Tooltip, IconButton, Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, useTheme, Drawer, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, Grid, RadioGroup, FormControlLabel, Radio, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListSubheader, ListItemIcon, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
|
|
4
|
-
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, HamburgerMenu, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, ChevronDown } from '@opengeoweb/theme';
|
|
5
|
-
import { throttle, escapeRegExp } from 'lodash';
|
|
6
|
-
import Draggable from 'react-draggable';
|
|
7
|
-
import { Resizable } from 're-resizable';
|
|
8
|
-
import { useStore } from 'react-redux';
|
|
9
|
-
import { parseISO, parse, format, isEqual, isBefore, isAfter, add as add$1, sub as sub$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1 } from 'date-fns';
|
|
10
|
-
|
|
11
|
-
/*! *****************************************************************************
|
|
12
|
-
Copyright (c) Microsoft Corporation.
|
|
13
|
-
|
|
14
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
15
|
-
purpose with or without fee is hereby granted.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
19
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
20
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
21
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
22
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
-
***************************************************************************** */
|
|
25
|
-
|
|
26
|
-
function __rest(s, e) {
|
|
27
|
-
var t = {};
|
|
28
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
31
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
33
|
-
t[p[i]] = s[p[i]];
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var bgColors = {
|
|
39
|
-
green: 'geowebColors.functional.successOutline.fill',
|
|
40
|
-
grey: 'geowebColors.functional.disabledOutline.fill',
|
|
41
|
-
purple: 'geowebColors.functional.summaryOutline.fill',
|
|
42
|
-
red: 'geowebColors.functional.errorOutline.fill',
|
|
43
|
-
yellow: 'geowebColors.functional.warningOutline.fill',
|
|
44
|
-
blue: 'geowebColors.functional.notificationOutline.fill'
|
|
45
|
-
};
|
|
46
|
-
var borderColors = {
|
|
47
|
-
green: 'geowebColors.functional.successOutline.borderColor',
|
|
48
|
-
grey: 'geowebColors.functional.disabledOutline.borderColor',
|
|
49
|
-
purple: 'geowebColors.functional.summaryOutline.borderColor',
|
|
50
|
-
red: 'geowebColors.functional.errorOutline.borderColor',
|
|
51
|
-
yellow: 'geowebColors.functional.warningOutline.borderColor',
|
|
52
|
-
blue: 'geowebColors.functional.notificationOutline.borderColor'
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
var tagStyle = function tagStyle(color) {
|
|
56
|
-
// Set color to grey for summary
|
|
57
|
-
var backgroundColor = Object.assign({}, bgColors)[color];
|
|
58
|
-
var borderColor = Object.assign({}, borderColors)[color];
|
|
59
|
-
return {
|
|
60
|
-
backgroundColor: backgroundColor,
|
|
61
|
-
m: 0,
|
|
62
|
-
p: 0,
|
|
63
|
-
border: '1px solid',
|
|
64
|
-
borderColor: borderColor,
|
|
65
|
-
borderRadius: '4px',
|
|
66
|
-
width: '120px',
|
|
67
|
-
height: '18px',
|
|
68
|
-
lineHeight: '16px',
|
|
69
|
-
color: 'geowebColors.captions.captionStatus.rgba'
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var StatusTag = function StatusTag(_a) {
|
|
74
|
-
var content = _a.content,
|
|
75
|
-
color = _a.color,
|
|
76
|
-
props = __rest(_a, ["content", "color"]);
|
|
77
|
-
|
|
78
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
79
|
-
display: "flex",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
justifyContent: "center",
|
|
82
|
-
"data-testid": "statusTag",
|
|
83
|
-
className: "statusTag",
|
|
84
|
-
sx: Object.assign(Object.assign({}, tagStyle(color)), props.sx)
|
|
85
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
86
|
-
variant: "caption"
|
|
87
|
-
}, content));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
function _classCallCheck(instance, Constructor) {
|
|
91
|
-
if (!(instance instanceof Constructor)) {
|
|
92
|
-
throw new TypeError("Cannot call a class as a function");
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _defineProperties(target, props) {
|
|
97
|
-
for (var i = 0; i < props.length; i++) {
|
|
98
|
-
var descriptor = props[i];
|
|
99
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
100
|
-
descriptor.configurable = true;
|
|
101
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
102
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
107
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
108
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
109
|
-
return Constructor;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function _defineProperty(obj, key, value) {
|
|
113
|
-
if (key in obj) {
|
|
114
|
-
Object.defineProperty(obj, key, {
|
|
115
|
-
value: value,
|
|
116
|
-
enumerable: true,
|
|
117
|
-
configurable: true,
|
|
118
|
-
writable: true
|
|
119
|
-
});
|
|
120
|
-
} else {
|
|
121
|
-
obj[key] = value;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return obj;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function _inherits(subClass, superClass) {
|
|
128
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
129
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
133
|
-
constructor: {
|
|
134
|
-
value: subClass,
|
|
135
|
-
writable: true,
|
|
136
|
-
configurable: true
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function _getPrototypeOf(o) {
|
|
143
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
144
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
145
|
-
};
|
|
146
|
-
return _getPrototypeOf(o);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function _setPrototypeOf(o, p) {
|
|
150
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
151
|
-
o.__proto__ = p;
|
|
152
|
-
return o;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return _setPrototypeOf(o, p);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function _isNativeReflectConstruct() {
|
|
159
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
160
|
-
if (Reflect.construct.sham) return false;
|
|
161
|
-
if (typeof Proxy === "function") return true;
|
|
162
|
-
|
|
163
|
-
try {
|
|
164
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
165
|
-
return true;
|
|
166
|
-
} catch (e) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function _assertThisInitialized(self) {
|
|
172
|
-
if (self === void 0) {
|
|
173
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return self;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function _possibleConstructorReturn(self, call) {
|
|
180
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
181
|
-
return call;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return _assertThisInitialized(self);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function _createSuper(Derived) {
|
|
188
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
189
|
-
|
|
190
|
-
return function _createSuperInternal() {
|
|
191
|
-
var Super = _getPrototypeOf(Derived),
|
|
192
|
-
result;
|
|
193
|
-
|
|
194
|
-
if (hasNativeReflectConstruct) {
|
|
195
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
196
|
-
|
|
197
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
198
|
-
} else {
|
|
199
|
-
result = Super.apply(this, arguments);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return _possibleConstructorReturn(this, result);
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function _slicedToArray(arr, i) {
|
|
207
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function _toArray(arr) {
|
|
211
|
-
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function _toConsumableArray(arr) {
|
|
215
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function _arrayWithoutHoles(arr) {
|
|
219
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function _arrayWithHoles(arr) {
|
|
223
|
-
if (Array.isArray(arr)) return arr;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function _iterableToArray(iter) {
|
|
227
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function _iterableToArrayLimit(arr, i) {
|
|
231
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
232
|
-
var _arr = [];
|
|
233
|
-
var _n = true;
|
|
234
|
-
var _d = false;
|
|
235
|
-
var _e = undefined;
|
|
236
|
-
|
|
237
|
-
try {
|
|
238
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
239
|
-
_arr.push(_s.value);
|
|
240
|
-
|
|
241
|
-
if (i && _arr.length === i) break;
|
|
242
|
-
}
|
|
243
|
-
} catch (err) {
|
|
244
|
-
_d = true;
|
|
245
|
-
_e = err;
|
|
246
|
-
} finally {
|
|
247
|
-
try {
|
|
248
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
249
|
-
} finally {
|
|
250
|
-
if (_d) throw _e;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return _arr;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
258
|
-
if (!o) return;
|
|
259
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
260
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
261
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
262
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
263
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function _arrayLikeToArray(arr, len) {
|
|
267
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
268
|
-
|
|
269
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
270
|
-
|
|
271
|
-
return arr2;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function _nonIterableSpread() {
|
|
275
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function _nonIterableRest() {
|
|
279
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
var defaultDelay = 1000;
|
|
283
|
-
var useControlledTooltip = function useControlledTooltip() {
|
|
284
|
-
var _React$useState = React.useState(false),
|
|
285
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
286
|
-
tooltipOpen = _React$useState2[0],
|
|
287
|
-
setTooltipOpen = _React$useState2[1];
|
|
288
|
-
|
|
289
|
-
var _React$useState3 = React.useState(false),
|
|
290
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
291
|
-
delayedTooltip = _React$useState4[0],
|
|
292
|
-
setDelayedTooltip = _React$useState4[1];
|
|
293
|
-
|
|
294
|
-
React.useEffect(function () {
|
|
295
|
-
if (tooltipOpen === true) {
|
|
296
|
-
var timer = setTimeout(function () {
|
|
297
|
-
return setDelayedTooltip(true);
|
|
298
|
-
}, defaultDelay);
|
|
299
|
-
return function () {
|
|
300
|
-
clearTimeout(timer);
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
setDelayedTooltip(false);
|
|
305
|
-
return function () {};
|
|
306
|
-
}, [tooltipOpen]);
|
|
307
|
-
return [delayedTooltip, setTooltipOpen];
|
|
308
|
-
};
|
|
309
|
-
var CustomTooltip = function CustomTooltip(props) {
|
|
310
|
-
return /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, props, {
|
|
311
|
-
enterDelay: defaultDelay,
|
|
312
|
-
enterNextDelay: defaultDelay,
|
|
313
|
-
disableInteractive: true
|
|
314
|
-
}));
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
var CustomIconButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
318
|
-
var _a$tooltipTitle = _a.tooltipTitle,
|
|
319
|
-
defaultTooltipTitle = _a$tooltipTitle === void 0 ? '' : _a$tooltipTitle,
|
|
320
|
-
_a$variant = _a.variant,
|
|
321
|
-
variant = _a$variant === void 0 ? 'flat' : _a$variant,
|
|
322
|
-
_a$isSelected = _a.isSelected,
|
|
323
|
-
isSelected = _a$isSelected === void 0 ? false : _a$isSelected,
|
|
324
|
-
_a$shouldShowAsDisabl = _a.shouldShowAsDisabled,
|
|
325
|
-
shouldShowAsDisabled = _a$shouldShowAsDisabl === void 0 ? false : _a$shouldShowAsDisabl,
|
|
326
|
-
_a$size = _a.size,
|
|
327
|
-
size = _a$size === void 0 ? 'small' : _a$size,
|
|
328
|
-
children = _a.children,
|
|
329
|
-
className = _a.className,
|
|
330
|
-
defaultTooltipProps = _a.tooltipProps,
|
|
331
|
-
props = __rest(_a, ["tooltipTitle", "variant", "isSelected", "shouldShowAsDisabled", "size", "children", "className", "tooltipProps"]);
|
|
332
|
-
|
|
333
|
-
var classNames = [].concat(_toConsumableArray(className ? [className] : []), _toConsumableArray(isSelected ? ['Mui-selected'] : []), [variant]).join(' ');
|
|
334
|
-
var tooltipTitle = (defaultTooltipProps === null || defaultTooltipProps === void 0 ? void 0 : defaultTooltipProps.title) || defaultTooltipTitle;
|
|
335
|
-
var tooltipProps = Object.assign(Object.assign({}, defaultTooltipProps), {
|
|
336
|
-
title: tooltipTitle,
|
|
337
|
-
placement: (defaultTooltipProps === null || defaultTooltipProps === void 0 ? void 0 : defaultTooltipProps.placement) || 'top',
|
|
338
|
-
sx: {
|
|
339
|
-
pointerEvents: 'none'
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
var renderIconButton = function renderIconButton() {
|
|
344
|
-
return /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
345
|
-
"aria-label": tooltipTitle
|
|
346
|
-
}, props, {
|
|
347
|
-
size: size,
|
|
348
|
-
className: classNames,
|
|
349
|
-
ref: ref,
|
|
350
|
-
sx: Object.assign(Object.assign({}, props.sx), shouldShowAsDisabled && {
|
|
351
|
-
'&.MuiIconButton-root': {
|
|
352
|
-
color: "geowebColors.iconButtons.".concat(variant, ".disabled.color")
|
|
353
|
-
},
|
|
354
|
-
'&.Mui-focusVisible': {
|
|
355
|
-
color: "geowebColors.iconButtons.".concat(variant, ".default.color")
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
}), children);
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
return tooltipTitle && !props.disabled ? /*#__PURE__*/React.createElement(CustomTooltip, Object.assign({}, tooltipProps), renderIconButton()) : renderIconButton();
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
var CustomDialog = function CustomDialog(_a) {
|
|
365
|
-
var title = _a.title,
|
|
366
|
-
_onClose = _a.onClose,
|
|
367
|
-
_a$description = _a.description,
|
|
368
|
-
description = _a$description === void 0 ? '' : _a$description,
|
|
369
|
-
_a$actions = _a.actions,
|
|
370
|
-
actions = _a$actions === void 0 ? null : _a$actions,
|
|
371
|
-
children = _a.children,
|
|
372
|
-
sx = _a.sx,
|
|
373
|
-
other = __rest(_a, ["title", "onClose", "description", "actions", "children", "sx"]);
|
|
374
|
-
|
|
375
|
-
return /*#__PURE__*/React.createElement(Dialog, Object.assign({
|
|
376
|
-
"data-testid": "customDialog",
|
|
377
|
-
PaperProps: {
|
|
378
|
-
sx: Object.assign({
|
|
379
|
-
width: '560px',
|
|
380
|
-
margin: 2.5
|
|
381
|
-
}, sx)
|
|
382
|
-
},
|
|
383
|
-
// fix for briefly showing default options when closing dialog
|
|
384
|
-
transitionDuration: 0,
|
|
385
|
-
onClose: function onClose() {
|
|
386
|
-
_onClose('CLOSED');
|
|
387
|
-
},
|
|
388
|
-
"aria-labelledby": "dialog-title"
|
|
389
|
-
}, other), /*#__PURE__*/React.createElement(DialogTitle, {
|
|
390
|
-
id: "dialog-title",
|
|
391
|
-
sx: {
|
|
392
|
-
zIndex: 1,
|
|
393
|
-
padding: 2,
|
|
394
|
-
display: 'flex',
|
|
395
|
-
justifyContent: 'space-between',
|
|
396
|
-
alignItems: 'center'
|
|
397
|
-
}
|
|
398
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
399
|
-
sx: {
|
|
400
|
-
fontSize: '16px',
|
|
401
|
-
fontWeight: 500
|
|
402
|
-
},
|
|
403
|
-
"data-testid": "customDialog-title",
|
|
404
|
-
component: "span"
|
|
405
|
-
}, title), /*#__PURE__*/React.createElement(CustomIconButton, {
|
|
406
|
-
"data-testid": "customDialog-close",
|
|
407
|
-
"aria-label": "close",
|
|
408
|
-
onClick: function onClick() {
|
|
409
|
-
return _onClose('CLOSED');
|
|
410
|
-
},
|
|
411
|
-
sx: {
|
|
412
|
-
'&.MuiIconButton-root': {
|
|
413
|
-
color: 'geowebColors.greys.accessible'
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}, /*#__PURE__*/React.createElement(Close, {
|
|
417
|
-
"data-testid": "CloseIcon"
|
|
418
|
-
}))), /*#__PURE__*/React.createElement(DialogContent, {
|
|
419
|
-
sx: {
|
|
420
|
-
padding: '8px 16px'
|
|
421
|
-
}
|
|
422
|
-
}, description && /*#__PURE__*/React.createElement(Typography, {
|
|
423
|
-
variant: "body1"
|
|
424
|
-
}, description), children), /*#__PURE__*/React.createElement(DialogActions, {
|
|
425
|
-
sx: {
|
|
426
|
-
padding: 2,
|
|
427
|
-
flexDirection: {
|
|
428
|
-
xs: 'column',
|
|
429
|
-
sm: 'row'
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}, actions));
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
var confirmStyle = {
|
|
436
|
-
width: {
|
|
437
|
-
xs: '100%',
|
|
438
|
-
sm: '150px'
|
|
439
|
-
},
|
|
440
|
-
marginLeft: {
|
|
441
|
-
xs: '0px!important',
|
|
442
|
-
sm: '8px!important'
|
|
443
|
-
},
|
|
444
|
-
marginTop: {
|
|
445
|
-
xs: 2,
|
|
446
|
-
sm: 0
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
var ConfirmationDialog = function ConfirmationDialog(_a) {
|
|
450
|
-
var open = _a.open,
|
|
451
|
-
title = _a.title,
|
|
452
|
-
_a$description = _a.description,
|
|
453
|
-
description = _a$description === void 0 ? 'Are you sure?' : _a$description,
|
|
454
|
-
_a$confirmLabel = _a.confirmLabel,
|
|
455
|
-
confirmLabel = _a$confirmLabel === void 0 ? 'Submit' : _a$confirmLabel,
|
|
456
|
-
_a$cancelLabel = _a.cancelLabel,
|
|
457
|
-
cancelLabel = _a$cancelLabel === void 0 ? 'Go back' : _a$cancelLabel,
|
|
458
|
-
onSubmit = _a.onSubmit,
|
|
459
|
-
onClose = _a.onClose,
|
|
460
|
-
_a$content = _a.content,
|
|
461
|
-
content = _a$content === void 0 ? null : _a$content,
|
|
462
|
-
_a$disableAutoFocus = _a.disableAutoFocus,
|
|
463
|
-
disableAutoFocus = _a$disableAutoFocus === void 0 ? false : _a$disableAutoFocus,
|
|
464
|
-
_a$isLoading = _a.isLoading,
|
|
465
|
-
isLoading = _a$isLoading === void 0 ? false : _a$isLoading,
|
|
466
|
-
other = __rest(_a, ["open", "title", "description", "confirmLabel", "cancelLabel", "onSubmit", "onClose", "content", "disableAutoFocus", "isLoading"]);
|
|
467
|
-
|
|
468
|
-
other.catchOnCancel;
|
|
469
|
-
var rest = __rest(other, ["catchOnCancel"]); // remove unwanted props
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
return /*#__PURE__*/React.createElement(CustomDialog, Object.assign({
|
|
473
|
-
"data-testid": "confirmationDialog",
|
|
474
|
-
open: open,
|
|
475
|
-
title: title,
|
|
476
|
-
description: description,
|
|
477
|
-
onClose: onClose,
|
|
478
|
-
actions: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
479
|
-
"data-testid": "confirmationDialog-cancel",
|
|
480
|
-
variant: "tertiary",
|
|
481
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
482
|
-
sx: function sx(theme) {
|
|
483
|
-
return {
|
|
484
|
-
width: {
|
|
485
|
-
xs: '100%',
|
|
486
|
-
sm: '150px'
|
|
487
|
-
},
|
|
488
|
-
'&:focus': {
|
|
489
|
-
outline: theme.palette.geowebColors.buttons.primary.focus.outline,
|
|
490
|
-
borderColor: 'transparent'
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
},
|
|
494
|
-
onClick: function onClick() {
|
|
495
|
-
return onClose('CANCELLED');
|
|
496
|
-
}
|
|
497
|
-
}, cancelLabel), isLoading ? /*#__PURE__*/React.createElement(Box, {
|
|
498
|
-
"data-testid": "confirm-dialog-spinner",
|
|
499
|
-
sx: Object.assign(Object.assign({}, confirmStyle), {
|
|
500
|
-
height: '40px',
|
|
501
|
-
display: 'flex',
|
|
502
|
-
justifyContent: 'center',
|
|
503
|
-
alignItems: 'center'
|
|
504
|
-
})
|
|
505
|
-
}, /*#__PURE__*/React.createElement(CircularProgress, {
|
|
506
|
-
size: 40,
|
|
507
|
-
color: "secondary"
|
|
508
|
-
})) : /*#__PURE__*/React.createElement(Button, {
|
|
509
|
-
"data-testid": "confirmationDialog-confirm",
|
|
510
|
-
variant: "primary",
|
|
511
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
512
|
-
sx: function sx(theme) {
|
|
513
|
-
return Object.assign(Object.assign({}, confirmStyle), {
|
|
514
|
-
'&:focus': {
|
|
515
|
-
outline: theme.palette.geowebColors.buttons.primary.focus.outline,
|
|
516
|
-
borderColor: 'transparent'
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
},
|
|
520
|
-
onClick: onSubmit,
|
|
521
|
-
autoFocus: !disableAutoFocus
|
|
522
|
-
}, confirmLabel))
|
|
523
|
-
}, rest), content);
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
/* *
|
|
527
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
528
|
-
* you may not use this file except in compliance with the License.
|
|
529
|
-
* You may obtain a copy of the License at
|
|
530
|
-
*
|
|
531
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
532
|
-
*
|
|
533
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
534
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
535
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
536
|
-
* See the License for the specific language governing permissions and
|
|
537
|
-
* limitations under the License.
|
|
538
|
-
*
|
|
539
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
540
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
541
|
-
* */
|
|
542
|
-
var showPrompt = function showPrompt(event) {
|
|
543
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
544
|
-
// @ts-ignore
|
|
545
|
-
// eslint-disable-next-line no-param-reassign
|
|
546
|
-
event.returnValue = 'Changes that you made may not be saved.'; // changes are your browser have default text to overrule this
|
|
547
|
-
};
|
|
548
|
-
function usePreventBrowserClose(shouldPreventClose) {
|
|
549
|
-
React.useEffect(function () {
|
|
550
|
-
if (shouldPreventClose) {
|
|
551
|
-
window.addEventListener('beforeunload', showPrompt);
|
|
552
|
-
} else {
|
|
553
|
-
window.removeEventListener('beforeunload', showPrompt);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
return function () {
|
|
557
|
-
window.removeEventListener('beforeunload', showPrompt);
|
|
558
|
-
};
|
|
559
|
-
}, [shouldPreventClose]);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
/* *
|
|
563
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
564
|
-
* you may not use this file except in compliance with the License.
|
|
565
|
-
* You may obtain a copy of the License at
|
|
566
|
-
*
|
|
567
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
568
|
-
*
|
|
569
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
570
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
571
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
572
|
-
* See the License for the specific language governing permissions and
|
|
573
|
-
* limitations under the License.
|
|
574
|
-
*
|
|
575
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
576
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
577
|
-
* */
|
|
578
|
-
var usePoller = function usePoller(deps, callback) {
|
|
579
|
-
var pollingInterval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300000;
|
|
580
|
-
var interval = useRef(null);
|
|
581
|
-
React.useEffect(function () {
|
|
582
|
-
if (deps.filter(function (dep) {
|
|
583
|
-
return dep !== null;
|
|
584
|
-
}).length > 0) {
|
|
585
|
-
if (interval.current) {
|
|
586
|
-
clearInterval(interval.current);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
interval.current = setInterval(function () {
|
|
590
|
-
callback();
|
|
591
|
-
}, pollingInterval);
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
return function () {
|
|
595
|
-
if (interval.current) {
|
|
596
|
-
clearInterval(interval.current);
|
|
597
|
-
}
|
|
598
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
599
|
-
}, [deps]);
|
|
600
|
-
return interval;
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
/* *
|
|
604
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
605
|
-
* you may not use this file except in compliance with the License.
|
|
606
|
-
* You may obtain a copy of the License at
|
|
607
|
-
*
|
|
608
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
609
|
-
*
|
|
610
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
611
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
612
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
613
|
-
* See the License for the specific language governing permissions and
|
|
614
|
-
* limitations under the License.
|
|
615
|
-
*
|
|
616
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
617
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
618
|
-
* */
|
|
619
|
-
function usePrevious(value) {
|
|
620
|
-
var ref = React.useRef();
|
|
621
|
-
React.useEffect(function () {
|
|
622
|
-
ref.current = value;
|
|
623
|
-
});
|
|
624
|
-
return ref.current;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
/* *
|
|
628
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
629
|
-
* you may not use this file except in compliance with the License.
|
|
630
|
-
* You may obtain a copy of the License at
|
|
631
|
-
*
|
|
632
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
633
|
-
*
|
|
634
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
635
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
636
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
637
|
-
* See the License for the specific language governing permissions and
|
|
638
|
-
* limitations under the License.
|
|
639
|
-
*
|
|
640
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
641
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
642
|
-
* */
|
|
643
|
-
var useIsMounted = function useIsMounted() {
|
|
644
|
-
var isMounted = React.useRef(false);
|
|
645
|
-
React.useEffect(function () {
|
|
646
|
-
isMounted.current = true;
|
|
647
|
-
return function () {
|
|
648
|
-
isMounted.current = false;
|
|
649
|
-
};
|
|
650
|
-
}, []);
|
|
651
|
-
return {
|
|
652
|
-
isMounted: isMounted
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
/* *
|
|
657
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
658
|
-
* you may not use this file except in compliance with the License.
|
|
659
|
-
* You may obtain a copy of the License at
|
|
660
|
-
*
|
|
661
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
662
|
-
*
|
|
663
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
664
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
665
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
666
|
-
* See the License for the specific language governing permissions and
|
|
667
|
-
* limitations under the License.
|
|
668
|
-
*
|
|
669
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
670
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
671
|
-
* */
|
|
672
|
-
var adjustPosition = function adjustPosition(bbox, containingView, position, setPosition) {
|
|
673
|
-
var isHorizontallyLarger = bbox.width > containingView.width;
|
|
674
|
-
var isVerticallyLarger = bbox.height > containingView.height; // Check corner cases first
|
|
675
|
-
// bottom left
|
|
676
|
-
|
|
677
|
-
if (bbox.x < containingView.x && bbox.bottom >= containingView.bottom) {
|
|
678
|
-
var diffX = containingView.x - bbox.x;
|
|
679
|
-
var diffY = containingView.bottom - bbox.bottom;
|
|
680
|
-
setPosition({
|
|
681
|
-
x: position.x + diffX,
|
|
682
|
-
y: position.y + diffY
|
|
683
|
-
});
|
|
684
|
-
} else if ( // bottom right
|
|
685
|
-
bbox.right >= containingView.right && bbox.bottom >= containingView.bottom) {
|
|
686
|
-
var _diffX = containingView.right - bbox.right;
|
|
687
|
-
|
|
688
|
-
var _diffY = containingView.bottom - bbox.bottom;
|
|
689
|
-
|
|
690
|
-
setPosition({
|
|
691
|
-
x: position.x + _diffX,
|
|
692
|
-
y: position.y + _diffY
|
|
693
|
-
});
|
|
694
|
-
} else if (bbox.x < containingView.x || isHorizontallyLarger) {
|
|
695
|
-
// left screen
|
|
696
|
-
var _diffX2 = containingView.x - bbox.x;
|
|
697
|
-
|
|
698
|
-
setPosition(Object.assign(Object.assign({}, position), {
|
|
699
|
-
x: position.x + _diffX2
|
|
700
|
-
}));
|
|
701
|
-
} else if (bbox.right >= containingView.right) {
|
|
702
|
-
// right screen
|
|
703
|
-
var _diffX3 = containingView.right - bbox.right;
|
|
704
|
-
|
|
705
|
-
setPosition(Object.assign(Object.assign({}, position), {
|
|
706
|
-
x: position.x + _diffX3
|
|
707
|
-
}));
|
|
708
|
-
} else if (bbox.y < containingView.y || isVerticallyLarger) {
|
|
709
|
-
// top screen
|
|
710
|
-
var _diffY2 = containingView.y - bbox.y;
|
|
711
|
-
|
|
712
|
-
setPosition(Object.assign(Object.assign({}, position), {
|
|
713
|
-
y: position.y + _diffY2
|
|
714
|
-
}));
|
|
715
|
-
} else if (bbox.bottom >= containingView.bottom) {
|
|
716
|
-
// bottom screen
|
|
717
|
-
var _diffY3 = containingView.bottom - bbox.bottom;
|
|
718
|
-
|
|
719
|
-
setPosition(Object.assign(Object.assign({}, position), {
|
|
720
|
-
y: position.y + _diffY3
|
|
721
|
-
}));
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
|
|
725
|
-
var onResizeWindow = React__default.useCallback(function () {
|
|
726
|
-
if (!nodeRef.current) {
|
|
727
|
-
return;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
var bbox = nodeRef.current.firstChild.getBoundingClientRect();
|
|
731
|
-
var containingView = nodeRef.current.parentElement.getBoundingClientRect();
|
|
732
|
-
adjustPosition(bbox, containingView, position, setPosition);
|
|
733
|
-
}, [nodeRef, position, setPosition]);
|
|
734
|
-
React__default.useEffect(function () {
|
|
735
|
-
var throttledResize = throttle(onResizeWindow, 100);
|
|
736
|
-
window.addEventListener('resize', throttledResize);
|
|
737
|
-
return function () {
|
|
738
|
-
window.removeEventListener('resize', throttledResize);
|
|
739
|
-
};
|
|
740
|
-
}, [onResizeWindow]);
|
|
741
|
-
};
|
|
742
|
-
|
|
743
|
-
var ConfirmationServiceContext = /*#__PURE__*/React.createContext(Promise.reject);
|
|
744
|
-
var useConfirmationDialog = function useConfirmationDialog() {
|
|
745
|
-
return React.useContext(ConfirmationServiceContext);
|
|
746
|
-
};
|
|
747
|
-
var useDialogActions = function useDialogActions(awaitingPromiseRef) {
|
|
748
|
-
var defaultOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
749
|
-
|
|
750
|
-
var _useIsMounted = useIsMounted(),
|
|
751
|
-
isMounted = _useIsMounted.isMounted;
|
|
752
|
-
|
|
753
|
-
var _React$useState = React.useState(defaultOptions),
|
|
754
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
755
|
-
confirmationState = _React$useState2[0],
|
|
756
|
-
setConfirmationState = _React$useState2[1];
|
|
757
|
-
|
|
758
|
-
var openConfirmation = function openConfirmation(options) {
|
|
759
|
-
setConfirmationState(options);
|
|
760
|
-
return new Promise(function (resolve, reject) {
|
|
761
|
-
// since this is a React.ref it's safe to reassign it, although eslint says no
|
|
762
|
-
// eslint-disable-next-line no-param-reassign
|
|
763
|
-
awaitingPromiseRef.current = {
|
|
764
|
-
resolve: resolve,
|
|
765
|
-
reject: reject
|
|
766
|
-
};
|
|
767
|
-
});
|
|
768
|
-
}; // clears state with timeout delay so optional values provided by the prop 'content' of ConfirmationDialog can be read
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var clearState = function clearState() {
|
|
772
|
-
return setTimeout(function () {
|
|
773
|
-
if (isMounted.current) {
|
|
774
|
-
setConfirmationState(null);
|
|
775
|
-
}
|
|
776
|
-
}, 0);
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
var handleClose = function handleClose(reason) {
|
|
780
|
-
if (confirmationState && confirmationState.catchOnCancel && awaitingPromiseRef.current) {
|
|
781
|
-
awaitingPromiseRef.current.reject(reason);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
clearState();
|
|
785
|
-
};
|
|
786
|
-
|
|
787
|
-
var handleSubmit = function handleSubmit() {
|
|
788
|
-
if (awaitingPromiseRef.current) {
|
|
789
|
-
awaitingPromiseRef.current.resolve();
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
clearState();
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
return {
|
|
796
|
-
openConfirmation: openConfirmation,
|
|
797
|
-
confirmationState: confirmationState,
|
|
798
|
-
handleSubmit: handleSubmit,
|
|
799
|
-
handleClose: handleClose
|
|
800
|
-
};
|
|
801
|
-
};
|
|
802
|
-
var ConfirmationServiceProvider = function ConfirmationServiceProvider(_ref) {
|
|
803
|
-
var children = _ref.children;
|
|
804
|
-
var awaitingPromiseRef = React.useRef({
|
|
805
|
-
resolve: function resolve() {
|
|
806
|
-
return Promise.resolve();
|
|
807
|
-
},
|
|
808
|
-
reject: function reject() {
|
|
809
|
-
return Promise.reject();
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
|
|
813
|
-
var _useDialogActions = useDialogActions(awaitingPromiseRef),
|
|
814
|
-
openConfirmation = _useDialogActions.openConfirmation,
|
|
815
|
-
confirmationState = _useDialogActions.confirmationState,
|
|
816
|
-
handleSubmit = _useDialogActions.handleSubmit,
|
|
817
|
-
handleClose = _useDialogActions.handleClose;
|
|
818
|
-
|
|
819
|
-
return /*#__PURE__*/React.createElement(ConfirmationServiceContext.Provider, {
|
|
820
|
-
value: openConfirmation
|
|
821
|
-
}, children, /*#__PURE__*/React.createElement(ConfirmationDialog, Object.assign({
|
|
822
|
-
open: Boolean(confirmationState),
|
|
823
|
-
onSubmit: handleSubmit,
|
|
824
|
-
onClose: handleClose
|
|
825
|
-
}, confirmationState)));
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
/* *
|
|
829
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
830
|
-
* you may not use this file except in compliance with the License.
|
|
831
|
-
* You may obtain a copy of the License at
|
|
832
|
-
*
|
|
833
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
834
|
-
*
|
|
835
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
836
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
837
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
838
|
-
* See the License for the specific language governing permissions and
|
|
839
|
-
* limitations under the License.
|
|
840
|
-
*
|
|
841
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
842
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
843
|
-
* */
|
|
844
|
-
|
|
845
|
-
var AlertIcon = function AlertIcon(_ref) {
|
|
846
|
-
var _ref$severity = _ref.severity,
|
|
847
|
-
severity = _ref$severity === void 0 ? 'error' : _ref$severity,
|
|
848
|
-
_ref$dataTestId = _ref.dataTestId,
|
|
849
|
-
dataTestId = _ref$dataTestId === void 0 ? 'alert-icon' : _ref$dataTestId;
|
|
850
|
-
|
|
851
|
-
switch (severity) {
|
|
852
|
-
case 'info':
|
|
853
|
-
return /*#__PURE__*/React.createElement(Info, {
|
|
854
|
-
sx: {
|
|
855
|
-
color: 'geowebColors.functional.notification'
|
|
856
|
-
},
|
|
857
|
-
"data-testid": dataTestId
|
|
858
|
-
});
|
|
859
|
-
|
|
860
|
-
case 'success':
|
|
861
|
-
return /*#__PURE__*/React.createElement(Success, {
|
|
862
|
-
sx: {
|
|
863
|
-
color: 'geowebColors.functional.success'
|
|
864
|
-
},
|
|
865
|
-
"data-testid": dataTestId
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
case 'warning':
|
|
869
|
-
return /*#__PURE__*/React.createElement(Exclamation, {
|
|
870
|
-
sx: {
|
|
871
|
-
color: 'geowebColors.functional.warning'
|
|
872
|
-
},
|
|
873
|
-
"data-testid": dataTestId
|
|
874
|
-
});
|
|
875
|
-
|
|
876
|
-
case 'error':
|
|
877
|
-
default:
|
|
878
|
-
return /*#__PURE__*/React.createElement(Exclamation, {
|
|
879
|
-
sx: {
|
|
880
|
-
color: 'geowebColors.functional.error'
|
|
881
|
-
},
|
|
882
|
-
"data-testid": dataTestId
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
var AlertBanner = function AlertBanner(_ref) {
|
|
888
|
-
var title = _ref.title,
|
|
889
|
-
_ref$severity = _ref.severity,
|
|
890
|
-
severity = _ref$severity === void 0 ? 'error' : _ref$severity,
|
|
891
|
-
_ref$info = _ref.info,
|
|
892
|
-
info = _ref$info === void 0 ? '' : _ref$info,
|
|
893
|
-
_ref$dataTestId = _ref.dataTestId,
|
|
894
|
-
dataTestId = _ref$dataTestId === void 0 ? 'alert-banner' : _ref$dataTestId,
|
|
895
|
-
_ref$isCompact = _ref.isCompact,
|
|
896
|
-
isCompact = _ref$isCompact === void 0 ? false : _ref$isCompact,
|
|
897
|
-
_ref$shouldClose = _ref.shouldClose,
|
|
898
|
-
shouldClose = _ref$shouldClose === void 0 ? false : _ref$shouldClose,
|
|
899
|
-
_ref$actionButtonProp = _ref.actionButtonProps,
|
|
900
|
-
actionButtonProps = _ref$actionButtonProp === void 0 ? undefined : _ref$actionButtonProp;
|
|
901
|
-
|
|
902
|
-
var _React$useState = React.useState(true),
|
|
903
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
904
|
-
isOpen = _React$useState2[0],
|
|
905
|
-
setIsOpen = _React$useState2[1];
|
|
906
|
-
|
|
907
|
-
if (!isOpen) {
|
|
908
|
-
return null;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
return /*#__PURE__*/React.createElement(Alert, {
|
|
912
|
-
"data-testid": dataTestId,
|
|
913
|
-
severity: severity,
|
|
914
|
-
icon: /*#__PURE__*/React.createElement(AlertIcon, {
|
|
915
|
-
severity: severity
|
|
916
|
-
}),
|
|
917
|
-
action: shouldClose ? /*#__PURE__*/React.createElement(Button, {
|
|
918
|
-
variant: "flat",
|
|
919
|
-
onClick: function onClick() {
|
|
920
|
-
return setIsOpen(false);
|
|
921
|
-
},
|
|
922
|
-
sx: {
|
|
923
|
-
backgroundColor: 'transparent!important'
|
|
924
|
-
}
|
|
925
|
-
}, "CLOSE") : undefined,
|
|
926
|
-
sx: isCompact ? {
|
|
927
|
-
height: '32px',
|
|
928
|
-
boxSizing: 'border-box',
|
|
929
|
-
'& .MuiAlert-message': {
|
|
930
|
-
padding: '0px',
|
|
931
|
-
whiteSpace: 'nowrap',
|
|
932
|
-
overflow: 'hidden',
|
|
933
|
-
textOverflow: 'ellipsis',
|
|
934
|
-
'& .MuiTypography-root': {
|
|
935
|
-
display: 'inline'
|
|
936
|
-
}
|
|
937
|
-
},
|
|
938
|
-
'& .MuiAlert-icon': {
|
|
939
|
-
marginTop: '-3px',
|
|
940
|
-
padding: '0px'
|
|
941
|
-
}
|
|
942
|
-
} : {
|
|
943
|
-
padding: '3px 16px',
|
|
944
|
-
'& .MuiAlert-message': {
|
|
945
|
-
padding: '8px 0'
|
|
946
|
-
},
|
|
947
|
-
'& .MuiAlert-icon': {
|
|
948
|
-
padding: '8px 0'
|
|
949
|
-
},
|
|
950
|
-
'& .MuiAlert-action': {
|
|
951
|
-
padding: 0
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}, /*#__PURE__*/React.createElement(AlertTitle, {
|
|
955
|
-
sx: {
|
|
956
|
-
fontSize: '14px',
|
|
957
|
-
fontWeight: 'normal',
|
|
958
|
-
marginTop: '0px!important',
|
|
959
|
-
paddingTop: '0px!important',
|
|
960
|
-
marginBottom: '0px!important',
|
|
961
|
-
lineHeight: isCompact ? '18px' : '24px'
|
|
962
|
-
}
|
|
963
|
-
}, title), info && /*#__PURE__*/React.createElement(Box, {
|
|
964
|
-
sx: {
|
|
965
|
-
fontSize: '16px',
|
|
966
|
-
marginTop: 1,
|
|
967
|
-
wordBreak: 'break-word',
|
|
968
|
-
lineHeight: '22px'
|
|
969
|
-
}
|
|
970
|
-
}, info), actionButtonProps && /*#__PURE__*/React.createElement(Button, {
|
|
971
|
-
variant: "flat",
|
|
972
|
-
onClick: function onClick(event) {
|
|
973
|
-
setIsOpen(false);
|
|
974
|
-
actionButtonProps.onClick(event);
|
|
975
|
-
},
|
|
976
|
-
sx: {
|
|
977
|
-
backgroundColor: 'transparent!important'
|
|
978
|
-
},
|
|
979
|
-
startIcon: /*#__PURE__*/React.createElement(ChevronRight, null)
|
|
980
|
-
}, actionButtonProps.title.toUpperCase()));
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
/* *
|
|
984
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
985
|
-
* you may not use this file except in compliance with the License.
|
|
986
|
-
* You may obtain a copy of the License at
|
|
987
|
-
*
|
|
988
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
989
|
-
*
|
|
990
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
991
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
992
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
993
|
-
* See the License for the specific language governing permissions and
|
|
994
|
-
* limitations under the License.
|
|
995
|
-
*
|
|
996
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
997
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
998
|
-
* */
|
|
999
|
-
|
|
1000
|
-
var AppLayout = function AppLayout(_ref) {
|
|
1001
|
-
var header = _ref.header,
|
|
1002
|
-
children = _ref.children;
|
|
1003
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1004
|
-
sx: {
|
|
1005
|
-
height: '100vh',
|
|
1006
|
-
display: 'flex',
|
|
1007
|
-
flexDirection: 'column'
|
|
1008
|
-
},
|
|
1009
|
-
"data-testid": "appLayout"
|
|
1010
|
-
}, header, /*#__PURE__*/React__default.createElement(Box, {
|
|
1011
|
-
component: "main",
|
|
1012
|
-
sx: {
|
|
1013
|
-
flex: 1,
|
|
1014
|
-
position: 'relative'
|
|
1015
|
-
}
|
|
1016
|
-
}, children));
|
|
1017
|
-
};
|
|
1018
|
-
|
|
1019
|
-
var AppHeader = function AppHeader(_ref) {
|
|
1020
|
-
var _sx;
|
|
1021
|
-
|
|
1022
|
-
var menu = _ref.menu,
|
|
1023
|
-
userMenu = _ref.userMenu,
|
|
1024
|
-
workspaceTopBar = _ref.workspaceTopBar,
|
|
1025
|
-
_ref$title = _ref.title,
|
|
1026
|
-
title = _ref$title === void 0 ? 'GeoWeb' : _ref$title,
|
|
1027
|
-
onClick = _ref.onClick;
|
|
1028
|
-
var theme = useTheme();
|
|
1029
|
-
|
|
1030
|
-
var _React$useState = React__default.useState(false),
|
|
1031
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1032
|
-
isDrawerOpen = _React$useState2[0],
|
|
1033
|
-
toggleDrawer = _React$useState2[1];
|
|
1034
|
-
|
|
1035
|
-
var onToggleDrawer = function onToggleDrawer(isOpen) {
|
|
1036
|
-
return toggleDrawer(isOpen);
|
|
1037
|
-
};
|
|
1038
|
-
|
|
1039
|
-
var onKeyDown = function onKeyDown(event) {
|
|
1040
|
-
if (event.key === 'Tab' || event.key === 'Shift') {
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
toggleDrawer(false);
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1048
|
-
component: "header",
|
|
1049
|
-
role: "heading",
|
|
1050
|
-
sx: (_sx = {
|
|
1051
|
-
height: 40,
|
|
1052
|
-
backgroundColor: theme.palette.geowebColors.brand.brand,
|
|
1053
|
-
color: theme.palette.common.white,
|
|
1054
|
-
boxShadow: theme.shadows[1],
|
|
1055
|
-
zIndex: 1000,
|
|
1056
|
-
display: 'flex',
|
|
1057
|
-
padding: '0 16px'
|
|
1058
|
-
}, _defineProperty(_sx, theme.breakpoints.up('md'), {
|
|
1059
|
-
padding: '0 24px'
|
|
1060
|
-
}), _defineProperty(_sx, theme.breakpoints.up('sm'), {
|
|
1061
|
-
'.workspace-topbar': {
|
|
1062
|
-
marginLeft: 3,
|
|
1063
|
-
maxWidth: 260
|
|
1064
|
-
},
|
|
1065
|
-
'.hamburger-btn': {
|
|
1066
|
-
marginLeft: 4
|
|
1067
|
-
},
|
|
1068
|
-
h1: {
|
|
1069
|
-
maxWidth: 'initial',
|
|
1070
|
-
display: 'block'
|
|
1071
|
-
}
|
|
1072
|
-
}), _sx)
|
|
1073
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
1074
|
-
onClick: onClick,
|
|
1075
|
-
sx: {
|
|
1076
|
-
display: 'inherit',
|
|
1077
|
-
alignItems: 'center',
|
|
1078
|
-
cursor: onClick ? 'pointer' : 'auto'
|
|
1079
|
-
}
|
|
1080
|
-
}, /*#__PURE__*/React__default.createElement(GeoWebLogo, {
|
|
1081
|
-
style: {
|
|
1082
|
-
position: 'relative',
|
|
1083
|
-
top: '-1px',
|
|
1084
|
-
right: '-1px'
|
|
1085
|
-
}
|
|
1086
|
-
}), /*#__PURE__*/React__default.createElement(Typography, {
|
|
1087
|
-
variant: "h1",
|
|
1088
|
-
sx: {
|
|
1089
|
-
display: 'none',
|
|
1090
|
-
fontSize: '20px',
|
|
1091
|
-
fontWeight: 500,
|
|
1092
|
-
fontStretch: 'normal',
|
|
1093
|
-
fontStyle: 'normal',
|
|
1094
|
-
lineHeight: 'normal',
|
|
1095
|
-
letterSpacing: '0.15px',
|
|
1096
|
-
overflow: 'hidden',
|
|
1097
|
-
whiteSpace: 'nowrap',
|
|
1098
|
-
textOverflow: 'ellipsis',
|
|
1099
|
-
color: 'geowebColors.typographyAndIcons.text',
|
|
1100
|
-
marginLeft: 1,
|
|
1101
|
-
maxWidth: 130
|
|
1102
|
-
}
|
|
1103
|
-
}, title)), menu && /*#__PURE__*/React__default.createElement(Box, {
|
|
1104
|
-
className: "hamburger-btn",
|
|
1105
|
-
sx: {
|
|
1106
|
-
display: 'flex',
|
|
1107
|
-
alignItems: 'center',
|
|
1108
|
-
marginLeft: 1
|
|
1109
|
-
}
|
|
1110
|
-
}, /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
1111
|
-
"data-testid": "menuButton",
|
|
1112
|
-
onClick: function onClick() {
|
|
1113
|
-
return onToggleDrawer(true);
|
|
1114
|
-
},
|
|
1115
|
-
isSelected: isDrawerOpen
|
|
1116
|
-
}, /*#__PURE__*/React__default.createElement(HamburgerMenu, null)), /*#__PURE__*/React__default.createElement(Drawer, {
|
|
1117
|
-
"data-testid": "app-drawer",
|
|
1118
|
-
anchor: "left",
|
|
1119
|
-
open: isDrawerOpen,
|
|
1120
|
-
onClose: function onClose() {
|
|
1121
|
-
return onToggleDrawer(false);
|
|
1122
|
-
},
|
|
1123
|
-
onClick: function onClick() {
|
|
1124
|
-
return onToggleDrawer(false);
|
|
1125
|
-
},
|
|
1126
|
-
onKeyDown: onKeyDown,
|
|
1127
|
-
sx: {
|
|
1128
|
-
'& .MuiDrawer-paper': {
|
|
1129
|
-
top: '40px'
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
1133
|
-
role: "presentation",
|
|
1134
|
-
sx: {
|
|
1135
|
-
width: '250px',
|
|
1136
|
-
overflowY: 'auto'
|
|
1137
|
-
}
|
|
1138
|
-
}, menu))), /*#__PURE__*/React__default.createElement(Box, {
|
|
1139
|
-
className: "workspace-topbar",
|
|
1140
|
-
sx: {
|
|
1141
|
-
flexGrow: 1,
|
|
1142
|
-
display: 'flex',
|
|
1143
|
-
marginLeft: 1,
|
|
1144
|
-
alignItems: 'center',
|
|
1145
|
-
maxWidth: 168
|
|
1146
|
-
}
|
|
1147
|
-
}, workspaceTopBar), /*#__PURE__*/React__default.createElement(Box, {
|
|
1148
|
-
sx: {
|
|
1149
|
-
display: 'flex',
|
|
1150
|
-
alignItems: 'center',
|
|
1151
|
-
flexGrow: 1,
|
|
1152
|
-
justifyContent: 'flex-end'
|
|
1153
|
-
}
|
|
1154
|
-
}, userMenu));
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
/* *
|
|
1158
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1159
|
-
* you may not use this file except in compliance with the License.
|
|
1160
|
-
* You may obtain a copy of the License at
|
|
1161
|
-
*
|
|
1162
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1163
|
-
*
|
|
1164
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1165
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1166
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1167
|
-
* See the License for the specific language governing permissions and
|
|
1168
|
-
* limitations under the License.
|
|
1169
|
-
*
|
|
1170
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1171
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1172
|
-
* */
|
|
1173
|
-
|
|
1174
|
-
var DraggableComponent$1 = function DraggableComponent(_a) {
|
|
1175
|
-
var _a$bounds = _a.bounds,
|
|
1176
|
-
bounds = _a$bounds === void 0 ? 'body' : _a$bounds,
|
|
1177
|
-
children = _a.children,
|
|
1178
|
-
props = __rest(_a, ["bounds", "children"]);
|
|
1179
|
-
|
|
1180
|
-
return /*#__PURE__*/React__default.createElement(Draggable, Object.assign({
|
|
1181
|
-
bounds: bounds
|
|
1182
|
-
}, props), children);
|
|
1183
|
-
};
|
|
1184
|
-
|
|
1185
|
-
/* *
|
|
1186
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1187
|
-
* you may not use this file except in compliance with the License.
|
|
1188
|
-
* You may obtain a copy of the License at
|
|
1189
|
-
*
|
|
1190
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1191
|
-
*
|
|
1192
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1193
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1194
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1195
|
-
* See the License for the specific language governing permissions and
|
|
1196
|
-
* limitations under the License.
|
|
1197
|
-
*
|
|
1198
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1199
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1200
|
-
* */
|
|
1201
|
-
var isDraggingClassName = 'is-dragging';
|
|
1202
|
-
|
|
1203
|
-
var ResizeComponent = function ResizeComponent(_a) {
|
|
1204
|
-
var children = _a.children,
|
|
1205
|
-
_a$onResizeStart = _a.onResizeStart,
|
|
1206
|
-
onResizeStart = _a$onResizeStart === void 0 ? function () {} : _a$onResizeStart,
|
|
1207
|
-
_a$onResizeStop = _a.onResizeStop,
|
|
1208
|
-
onResizeStop = _a$onResizeStop === void 0 ? function () {} : _a$onResizeStop,
|
|
1209
|
-
size = _a.size,
|
|
1210
|
-
setSize = _a.setSize,
|
|
1211
|
-
_a$minHeight = _a.minHeight,
|
|
1212
|
-
minHeight = _a$minHeight === void 0 ? 50 : _a$minHeight,
|
|
1213
|
-
_a$minWidth = _a.minWidth,
|
|
1214
|
-
minWidth = _a$minWidth === void 0 ? 50 : _a$minWidth,
|
|
1215
|
-
props = __rest(_a, ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth"]);
|
|
1216
|
-
|
|
1217
|
-
var theme = useTheme();
|
|
1218
|
-
var onStartResize = React__default.useCallback(function (event, _direction, node) {
|
|
1219
|
-
event.stopPropagation();
|
|
1220
|
-
node.classList.add(isDraggingClassName);
|
|
1221
|
-
|
|
1222
|
-
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1223
|
-
width = _node$getBoundingClie.width,
|
|
1224
|
-
height = _node$getBoundingClie.height;
|
|
1225
|
-
|
|
1226
|
-
setSize({
|
|
1227
|
-
width: width,
|
|
1228
|
-
height: height
|
|
1229
|
-
}); // fix for when initial maxHeight gets cleared
|
|
1230
|
-
// eslint-disable-next-line no-param-reassign
|
|
1231
|
-
|
|
1232
|
-
node.style.height = "".concat(height, "px");
|
|
1233
|
-
onResizeStart();
|
|
1234
|
-
}, [onResizeStart, setSize]);
|
|
1235
|
-
var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
|
|
1236
|
-
node.classList.remove(isDraggingClassName);
|
|
1237
|
-
var width = parseInt(size.width, 10) + delta.width;
|
|
1238
|
-
var height = parseInt(size.height, 10) + delta.height;
|
|
1239
|
-
setSize({
|
|
1240
|
-
width: width,
|
|
1241
|
-
height: height
|
|
1242
|
-
});
|
|
1243
|
-
onResizeStop(event, direction, node, delta);
|
|
1244
|
-
}, [setSize, onResizeStop, size]);
|
|
1245
|
-
return /*#__PURE__*/React__default.createElement(Resizable // TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
1246
|
-
, Object.assign({
|
|
1247
|
-
// TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
1248
|
-
minHeight: minHeight,
|
|
1249
|
-
minWidth: minWidth,
|
|
1250
|
-
size: size,
|
|
1251
|
-
onResizeStop: onStopResize,
|
|
1252
|
-
handleComponent: {
|
|
1253
|
-
bottomRight: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1254
|
-
style: {
|
|
1255
|
-
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1256
|
-
},
|
|
1257
|
-
sx: {
|
|
1258
|
-
display: 'none'
|
|
1259
|
-
},
|
|
1260
|
-
className: "resizableHandle"
|
|
1261
|
-
}),
|
|
1262
|
-
bottomLeft: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1263
|
-
isRightAligned: true,
|
|
1264
|
-
style: {
|
|
1265
|
-
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1266
|
-
},
|
|
1267
|
-
sx: {
|
|
1268
|
-
display: 'none'
|
|
1269
|
-
},
|
|
1270
|
-
className: "resizableHandle"
|
|
1271
|
-
})
|
|
1272
|
-
},
|
|
1273
|
-
enable: {
|
|
1274
|
-
top: false,
|
|
1275
|
-
right: false,
|
|
1276
|
-
bottom: false,
|
|
1277
|
-
left: false,
|
|
1278
|
-
topRight: true,
|
|
1279
|
-
bottomRight: true,
|
|
1280
|
-
bottomLeft: true,
|
|
1281
|
-
topLeft: true
|
|
1282
|
-
},
|
|
1283
|
-
onResizeStart: onStartResize
|
|
1284
|
-
}, props), children);
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
|
-
/**
|
|
1288
|
-
* ErrorBoundary
|
|
1289
|
-
* Wrap this component around parts of your application. It will catch any uncaught errors and display an alert, and allows you to continue using the rest of your application.
|
|
1290
|
-
*
|
|
1291
|
-
* @example
|
|
1292
|
-
* ``` <ErrorBoundary><ExampleComponent /></ErrorBoundary> ```
|
|
1293
|
-
*/
|
|
1294
|
-
|
|
1295
|
-
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
1296
|
-
_inherits(ErrorBoundary, _React$Component);
|
|
1297
|
-
|
|
1298
|
-
var _super = _createSuper(ErrorBoundary);
|
|
1299
|
-
|
|
1300
|
-
function ErrorBoundary(props) {
|
|
1301
|
-
var _this;
|
|
1302
|
-
|
|
1303
|
-
_classCallCheck(this, ErrorBoundary);
|
|
1304
|
-
|
|
1305
|
-
_this = _super.call(this, props);
|
|
1306
|
-
_this.state = {
|
|
1307
|
-
error: undefined,
|
|
1308
|
-
errorInfo: undefined
|
|
1309
|
-
};
|
|
1310
|
-
return _this;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
_createClass(ErrorBoundary, [{
|
|
1314
|
-
key: "componentDidCatch",
|
|
1315
|
-
value: function componentDidCatch(error, errorInfo) {
|
|
1316
|
-
var onError = this.props.onError;
|
|
1317
|
-
this.setState({
|
|
1318
|
-
error: error,
|
|
1319
|
-
errorInfo: errorInfo
|
|
1320
|
-
});
|
|
1321
|
-
onError(error, errorInfo);
|
|
1322
|
-
}
|
|
1323
|
-
}, {
|
|
1324
|
-
key: "render",
|
|
1325
|
-
value: function render() {
|
|
1326
|
-
var _this$state = this.state,
|
|
1327
|
-
error = _this$state.error,
|
|
1328
|
-
errorInfo = _this$state.errorInfo;
|
|
1329
|
-
var children = this.props.children;
|
|
1330
|
-
|
|
1331
|
-
if (error) {
|
|
1332
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
1333
|
-
sx: {
|
|
1334
|
-
whiteSpace: 'pre-wrap',
|
|
1335
|
-
width: '100%',
|
|
1336
|
-
height: '100%',
|
|
1337
|
-
overflowY: 'scroll'
|
|
1338
|
-
}
|
|
1339
|
-
}, /*#__PURE__*/React.createElement(AlertBanner, {
|
|
1340
|
-
severity: "error",
|
|
1341
|
-
title: "Woops, an error has occurred. Please report the error shown below and reload the page if needed.",
|
|
1342
|
-
info: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null), error.toString(), /*#__PURE__*/React.createElement("br", null), errorInfo && errorInfo.componentStack, /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Link, {
|
|
1343
|
-
underline: "always",
|
|
1344
|
-
style: {
|
|
1345
|
-
cursor: 'pointer'
|
|
1346
|
-
},
|
|
1347
|
-
onClick: function onClick() {
|
|
1348
|
-
return window.location.reload();
|
|
1349
|
-
}
|
|
1350
|
-
}, "Reload page"))
|
|
1351
|
-
}));
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
return children;
|
|
1355
|
-
}
|
|
1356
|
-
}], [{
|
|
1357
|
-
key: "getDerivedStateFromError",
|
|
1358
|
-
value: function getDerivedStateFromError(error) {
|
|
1359
|
-
return {
|
|
1360
|
-
error: error
|
|
1361
|
-
};
|
|
1362
|
-
}
|
|
1363
|
-
}]);
|
|
1364
|
-
|
|
1365
|
-
return ErrorBoundary;
|
|
1366
|
-
}(React.Component);
|
|
1367
|
-
ErrorBoundary.defaultProps = {
|
|
1368
|
-
onError: function onError() {}
|
|
1369
|
-
};
|
|
1370
|
-
|
|
1371
|
-
/* *
|
|
1372
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1373
|
-
* you may not use this file except in compliance with the License.
|
|
1374
|
-
* You may obtain a copy of the License at
|
|
1375
|
-
*
|
|
1376
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1377
|
-
*
|
|
1378
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1379
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1380
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1381
|
-
* See the License for the specific language governing permissions and
|
|
1382
|
-
* limitations under the License.
|
|
1383
|
-
*
|
|
1384
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1385
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1386
|
-
* */
|
|
1387
|
-
var styles$4 = {
|
|
1388
|
-
small: {
|
|
1389
|
-
height: 16,
|
|
1390
|
-
width: 16,
|
|
1391
|
-
fontSize: '0.5rem'
|
|
1392
|
-
},
|
|
1393
|
-
large: {}
|
|
1394
|
-
};
|
|
1395
|
-
|
|
1396
|
-
var Avatar = function Avatar(_ref) {
|
|
1397
|
-
var children = _ref.children,
|
|
1398
|
-
_ref$size = _ref.size,
|
|
1399
|
-
size = _ref$size === void 0 ? 'large' : _ref$size;
|
|
1400
|
-
return /*#__PURE__*/React.createElement(Avatar$1, {
|
|
1401
|
-
"data-testid": "avatar",
|
|
1402
|
-
sx: Object.assign({}, styles$4[size])
|
|
1403
|
-
}, children);
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
/* *
|
|
1407
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1408
|
-
* you may not use this file except in compliance with the License.
|
|
1409
|
-
* You may obtain a copy of the License at
|
|
1410
|
-
*
|
|
1411
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1412
|
-
*
|
|
1413
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1414
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1415
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1416
|
-
* See the License for the specific language governing permissions and
|
|
1417
|
-
* limitations under the License.
|
|
1418
|
-
*
|
|
1419
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1420
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1421
|
-
* */
|
|
1422
|
-
var styles$3 = {
|
|
1423
|
-
container: {
|
|
1424
|
-
position: 'absolute',
|
|
1425
|
-
top: 38,
|
|
1426
|
-
right: 20,
|
|
1427
|
-
width: 256,
|
|
1428
|
-
borderRadius: 0,
|
|
1429
|
-
boxShadow: 5,
|
|
1430
|
-
backgroundColor: 'geowebColors.background.surface'
|
|
1431
|
-
},
|
|
1432
|
-
userMenu: {
|
|
1433
|
-
padding: 0,
|
|
1434
|
-
'& > li': {
|
|
1435
|
-
paddingTop: 3,
|
|
1436
|
-
paddingBottom: 3,
|
|
1437
|
-
paddingLeft: 2,
|
|
1438
|
-
paddingRight: 2
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
};
|
|
1442
|
-
|
|
1443
|
-
var UserMenu = function UserMenu(_ref) {
|
|
1444
|
-
var _ref$isOpen = _ref.isOpen,
|
|
1445
|
-
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
1446
|
-
_ref$onToggle = _ref.onToggle,
|
|
1447
|
-
onToggle = _ref$onToggle === void 0 ? function () {} : _ref$onToggle,
|
|
1448
|
-
_ref$onClose = _ref.onClose,
|
|
1449
|
-
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
1450
|
-
children = _ref.children,
|
|
1451
|
-
initials = _ref.initials;
|
|
1452
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
1453
|
-
"data-testid": "userButton",
|
|
1454
|
-
onClick: onToggle,
|
|
1455
|
-
sx: {
|
|
1456
|
-
'&.MuiButtonBase-root': {
|
|
1457
|
-
background: 'transparent',
|
|
1458
|
-
'&:hover': {
|
|
1459
|
-
border: 'none',
|
|
1460
|
-
background: 'transparent'
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
},
|
|
1464
|
-
size: "medium"
|
|
1465
|
-
}, /*#__PURE__*/React__default.createElement(Avatar, null, initials)), isOpen && /*#__PURE__*/React__default.createElement(Paper, {
|
|
1466
|
-
sx: styles$3.container,
|
|
1467
|
-
"data-testid": "userMenu"
|
|
1468
|
-
}, /*#__PURE__*/React__default.createElement(ClickAwayListener, {
|
|
1469
|
-
onClickAway: onClose,
|
|
1470
|
-
mouseEvent: "onMouseDown"
|
|
1471
|
-
}, /*#__PURE__*/React__default.createElement(MenuList, {
|
|
1472
|
-
sx: styles$3.userMenu,
|
|
1473
|
-
variant: "menu"
|
|
1474
|
-
}, children))));
|
|
1475
|
-
};
|
|
1476
|
-
|
|
1477
|
-
/* *
|
|
1478
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1479
|
-
* you may not use this file except in compliance with the License.
|
|
1480
|
-
* You may obtain a copy of the License at
|
|
1481
|
-
*
|
|
1482
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1483
|
-
*
|
|
1484
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1485
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1486
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1487
|
-
* See the License for the specific language governing permissions and
|
|
1488
|
-
* limitations under the License.
|
|
1489
|
-
*
|
|
1490
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1491
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1492
|
-
* */
|
|
1493
|
-
|
|
1494
|
-
var MenuItemTheme = function MenuItemTheme() {
|
|
1495
|
-
var _useThemeContext = useThemeContext(),
|
|
1496
|
-
isDark = _useThemeContext.isDark,
|
|
1497
|
-
toggleTheme = _useThemeContext.toggleTheme;
|
|
1498
|
-
|
|
1499
|
-
return /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
1500
|
-
divider: true
|
|
1501
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1502
|
-
container: true
|
|
1503
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1504
|
-
item: true
|
|
1505
|
-
}, "Choose your default app mode"), /*#__PURE__*/React__default.createElement(Grid, {
|
|
1506
|
-
item: true
|
|
1507
|
-
}, /*#__PURE__*/React__default.createElement(RadioGroup, {
|
|
1508
|
-
onChange: toggleTheme
|
|
1509
|
-
}, /*#__PURE__*/React__default.createElement(FormControlLabel, {
|
|
1510
|
-
value: true,
|
|
1511
|
-
control: /*#__PURE__*/React__default.createElement(Radio, {
|
|
1512
|
-
checked: !isDark
|
|
1513
|
-
}),
|
|
1514
|
-
label: "Light"
|
|
1515
|
-
}), /*#__PURE__*/React__default.createElement(FormControlLabel, {
|
|
1516
|
-
value: false,
|
|
1517
|
-
control: /*#__PURE__*/React__default.createElement(Radio, {
|
|
1518
|
-
checked: isDark
|
|
1519
|
-
}),
|
|
1520
|
-
label: "Dark"
|
|
1521
|
-
})))));
|
|
1522
|
-
};
|
|
1523
|
-
|
|
1524
|
-
/* *
|
|
1525
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1526
|
-
* you may not use this file except in compliance with the License.
|
|
1527
|
-
* You may obtain a copy of the License at
|
|
1528
|
-
*
|
|
1529
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1530
|
-
*
|
|
1531
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1532
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1533
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1534
|
-
* See the License for the specific language governing permissions and
|
|
1535
|
-
* limitations under the License.
|
|
1536
|
-
*
|
|
1537
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1538
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1539
|
-
* */
|
|
1540
|
-
|
|
1541
|
-
var ToolFooter = function ToolFooter() {
|
|
1542
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1543
|
-
component: "footer",
|
|
1544
|
-
sx: {
|
|
1545
|
-
boxShadow: 1,
|
|
1546
|
-
backgroundColor: 'geowebColors.background.surface',
|
|
1547
|
-
textAlign: 'right',
|
|
1548
|
-
height: 18,
|
|
1549
|
-
zIndex: 1
|
|
1550
|
-
}
|
|
1551
|
-
});
|
|
1552
|
-
};
|
|
1553
|
-
|
|
1554
|
-
/* *
|
|
1555
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1556
|
-
* you may not use this file except in compliance with the License.
|
|
1557
|
-
* You may obtain a copy of the License at
|
|
1558
|
-
*
|
|
1559
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1560
|
-
*
|
|
1561
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1562
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1563
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1564
|
-
* See the License for the specific language governing permissions and
|
|
1565
|
-
* limitations under the License.
|
|
1566
|
-
*
|
|
1567
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1568
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1569
|
-
* */
|
|
1570
|
-
|
|
1571
|
-
var getStyle = function getStyle(size) {
|
|
1572
|
-
switch (size) {
|
|
1573
|
-
case 'xs':
|
|
1574
|
-
{
|
|
1575
|
-
return {
|
|
1576
|
-
fontSize: 10,
|
|
1577
|
-
fontWeight: 500
|
|
1578
|
-
};
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
case 'small':
|
|
1582
|
-
{
|
|
1583
|
-
return {
|
|
1584
|
-
fontSize: 16,
|
|
1585
|
-
fontWeight: 500,
|
|
1586
|
-
padding: '4px'
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
case 'medium':
|
|
1591
|
-
{
|
|
1592
|
-
return {
|
|
1593
|
-
fontSize: 20,
|
|
1594
|
-
fontWeight: 400,
|
|
1595
|
-
padding: '4px 8px',
|
|
1596
|
-
height: 40
|
|
1597
|
-
};
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
case 'large':
|
|
1601
|
-
{
|
|
1602
|
-
return {
|
|
1603
|
-
fontSize: 16,
|
|
1604
|
-
fontWeight: 500,
|
|
1605
|
-
padding: '12px'
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
default:
|
|
1610
|
-
{
|
|
1611
|
-
return {};
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
};
|
|
1615
|
-
|
|
1616
|
-
var iconStyle = {
|
|
1617
|
-
color: 'geowebColors.greys.accessible',
|
|
1618
|
-
padding: 0,
|
|
1619
|
-
'&:hover': {
|
|
1620
|
-
background: 'action.hover'
|
|
1621
|
-
}
|
|
1622
|
-
};
|
|
1623
|
-
|
|
1624
|
-
var ToolHeader = function ToolHeader(_ref) {
|
|
1625
|
-
var size = _ref.size,
|
|
1626
|
-
title = _ref.title,
|
|
1627
|
-
_ref$onClose = _ref.onClose,
|
|
1628
|
-
onClose = _ref$onClose === void 0 ? null : _ref$onClose,
|
|
1629
|
-
_ref$isDraggable = _ref.isDraggable,
|
|
1630
|
-
isDraggable = _ref$isDraggable === void 0 ? false : _ref$isDraggable,
|
|
1631
|
-
_ref$className = _ref.className,
|
|
1632
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1633
|
-
_ref$leftHeaderCompon = _ref.leftHeaderComponent,
|
|
1634
|
-
leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? null : _ref$leftHeaderCompon,
|
|
1635
|
-
_ref$rightHeaderCompo = _ref.rightHeaderComponent,
|
|
1636
|
-
rightHeaderComponent = _ref$rightHeaderCompo === void 0 ? null : _ref$rightHeaderCompo,
|
|
1637
|
-
_ref$dragHandleIcon = _ref.dragHandleIcon,
|
|
1638
|
-
dragHandleIcon = _ref$dragHandleIcon === void 0 ? /*#__PURE__*/React__default.createElement(DragHandle, null) : _ref$dragHandleIcon,
|
|
1639
|
-
_ref$closeIcon = _ref.closeIcon,
|
|
1640
|
-
closeIcon = _ref$closeIcon === void 0 ? /*#__PURE__*/React__default.createElement(Close, {
|
|
1641
|
-
"data-testid": "CloseIcon"
|
|
1642
|
-
}) : _ref$closeIcon;
|
|
1643
|
-
var styles = getStyle(size);
|
|
1644
|
-
var columnSizeIcon = leftHeaderComponent || rightHeaderComponent ? 4 : 1;
|
|
1645
|
-
var columnSizeTitle = leftHeaderComponent || rightHeaderComponent ? 4 : 10;
|
|
1646
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1647
|
-
component: "header",
|
|
1648
|
-
className: className,
|
|
1649
|
-
sx: {
|
|
1650
|
-
boxShadow: 1,
|
|
1651
|
-
backgroundColor: 'geowebColors.background.surface',
|
|
1652
|
-
zIndex: 2,
|
|
1653
|
-
cursor: isDraggable ? 'move' : null
|
|
1654
|
-
}
|
|
1655
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1656
|
-
container: true,
|
|
1657
|
-
alignItems: "center",
|
|
1658
|
-
sx: {
|
|
1659
|
-
padding: styles.padding,
|
|
1660
|
-
height: styles.height
|
|
1661
|
-
}
|
|
1662
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1663
|
-
className: "header-left",
|
|
1664
|
-
item: true,
|
|
1665
|
-
xs: columnSizeIcon,
|
|
1666
|
-
sx: {
|
|
1667
|
-
paddingRight: 1
|
|
1668
|
-
}
|
|
1669
|
-
}, isDraggable && size !== 'xxs' && !leftHeaderComponent && /*#__PURE__*/React__default.createElement(Grid, {
|
|
1670
|
-
container: true,
|
|
1671
|
-
justifyContent: "flex-start"
|
|
1672
|
-
}, /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
1673
|
-
"data-testid": "dragBtn",
|
|
1674
|
-
disableRipple: true,
|
|
1675
|
-
sx: {
|
|
1676
|
-
pointerEvents: 'none',
|
|
1677
|
-
'&.MuiIconButton-root': iconStyle
|
|
1678
|
-
}
|
|
1679
|
-
}, dragHandleIcon)), leftHeaderComponent && leftHeaderComponent), /*#__PURE__*/React__default.createElement(Grid, {
|
|
1680
|
-
className: "header-title",
|
|
1681
|
-
item: true,
|
|
1682
|
-
xs: columnSizeTitle
|
|
1683
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1684
|
-
container: true,
|
|
1685
|
-
justifyContent: "center",
|
|
1686
|
-
alignItems: "center"
|
|
1687
|
-
}, title && /*#__PURE__*/React__default.createElement(Typography, {
|
|
1688
|
-
variant: "h2",
|
|
1689
|
-
noWrap: true,
|
|
1690
|
-
sx: {
|
|
1691
|
-
fontSize: styles.fontSize,
|
|
1692
|
-
fontWeight: styles.fontWeight
|
|
1693
|
-
}
|
|
1694
|
-
}, title), size === 'xxs' && /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
1695
|
-
"data-testid": "dragBtn-xxs",
|
|
1696
|
-
disableRipple: true,
|
|
1697
|
-
sx: {
|
|
1698
|
-
pointerEvents: 'none',
|
|
1699
|
-
transform: 'rotate(90deg)',
|
|
1700
|
-
'&.MuiButtonBase-root.MuiIconButton-root': Object.assign(Object.assign({}, iconStyle), {
|
|
1701
|
-
height: 12
|
|
1702
|
-
})
|
|
1703
|
-
}
|
|
1704
|
-
}, dragHandleIcon))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
1705
|
-
className: "header-right",
|
|
1706
|
-
item: true,
|
|
1707
|
-
xs: columnSizeIcon,
|
|
1708
|
-
container: true,
|
|
1709
|
-
justifyContent: "flex-end"
|
|
1710
|
-
}, rightHeaderComponent && rightHeaderComponent, onClose && /*#__PURE__*/React__default.createElement(CustomTooltip, {
|
|
1711
|
-
title: "Close",
|
|
1712
|
-
placement: "bottom",
|
|
1713
|
-
sx: {
|
|
1714
|
-
pointerEvents: 'none'
|
|
1715
|
-
}
|
|
1716
|
-
}, /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
1717
|
-
"data-testid": "closeBtn",
|
|
1718
|
-
onClick: onClose,
|
|
1719
|
-
onTouchEnd: onClose,
|
|
1720
|
-
sx: {
|
|
1721
|
-
'&.MuiButtonBase-root.MuiIconButton-root': iconStyle
|
|
1722
|
-
}
|
|
1723
|
-
}, closeIcon)))));
|
|
1724
|
-
};
|
|
1725
|
-
|
|
1726
|
-
/* *
|
|
1727
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1728
|
-
* you may not use this file except in compliance with the License.
|
|
1729
|
-
* You may obtain a copy of the License at
|
|
1730
|
-
*
|
|
1731
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1732
|
-
*
|
|
1733
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1734
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1735
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1736
|
-
* See the License for the specific language governing permissions and
|
|
1737
|
-
* limitations under the License.
|
|
1738
|
-
*
|
|
1739
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1740
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1741
|
-
* */
|
|
1742
|
-
var styles$2 = {
|
|
1743
|
-
container: {
|
|
1744
|
-
overflow: 'hidden',
|
|
1745
|
-
borderRadius: 0,
|
|
1746
|
-
display: 'flex',
|
|
1747
|
-
flexDirection: 'column',
|
|
1748
|
-
height: '100%'
|
|
1749
|
-
},
|
|
1750
|
-
content: {
|
|
1751
|
-
flex: 1,
|
|
1752
|
-
overflowY: 'auto',
|
|
1753
|
-
position: 'relative'
|
|
1754
|
-
}
|
|
1755
|
-
};
|
|
1756
|
-
var BASE_ELEVATION = 5;
|
|
1757
|
-
|
|
1758
|
-
var ToolContainer = function ToolContainer(_a) {
|
|
1759
|
-
var _a$title = _a.title,
|
|
1760
|
-
title = _a$title === void 0 ? '' : _a$title,
|
|
1761
|
-
_a$size = _a.size,
|
|
1762
|
-
size = _a$size === void 0 ? 'medium' : _a$size,
|
|
1763
|
-
children = _a.children,
|
|
1764
|
-
onClose = _a.onClose,
|
|
1765
|
-
_a$isResizable = _a.isResizable,
|
|
1766
|
-
isResizable = _a$isResizable === void 0 ? false : _a$isResizable,
|
|
1767
|
-
_a$isDraggable = _a.isDraggable,
|
|
1768
|
-
isDraggable = _a$isDraggable === void 0 ? false : _a$isDraggable,
|
|
1769
|
-
_a$maxHeight = _a.maxHeight,
|
|
1770
|
-
maxHeight = _a$maxHeight === void 0 ? 'initial' : _a$maxHeight,
|
|
1771
|
-
_a$elevation = _a.elevation,
|
|
1772
|
-
elevation = _a$elevation === void 0 ? BASE_ELEVATION : _a$elevation,
|
|
1773
|
-
_a$headerClassName = _a.headerClassName,
|
|
1774
|
-
headerClassName = _a$headerClassName === void 0 ? '' : _a$headerClassName,
|
|
1775
|
-
_a$leftHeaderComponen = _a.leftHeaderComponent,
|
|
1776
|
-
leftHeaderComponent = _a$leftHeaderComponen === void 0 ? null : _a$leftHeaderComponen,
|
|
1777
|
-
_a$rightHeaderCompone = _a.rightHeaderComponent,
|
|
1778
|
-
rightHeaderComponent = _a$rightHeaderCompone === void 0 ? null : _a$rightHeaderCompone,
|
|
1779
|
-
dragHandleIcon = _a.dragHandleIcon,
|
|
1780
|
-
closeIcon = _a.closeIcon,
|
|
1781
|
-
props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftHeaderComponent", "rightHeaderComponent", "dragHandleIcon", "closeIcon"]);
|
|
1782
|
-
|
|
1783
|
-
return /*#__PURE__*/React__default.createElement(Paper, Object.assign({
|
|
1784
|
-
elevation: elevation,
|
|
1785
|
-
sx: styles$2.container
|
|
1786
|
-
}, props), /*#__PURE__*/React__default.createElement(ErrorBoundary, null, /*#__PURE__*/React__default.createElement(ToolHeader, {
|
|
1787
|
-
title: title,
|
|
1788
|
-
size: size,
|
|
1789
|
-
isDraggable: isDraggable,
|
|
1790
|
-
onClose: onClose,
|
|
1791
|
-
className: headerClassName,
|
|
1792
|
-
leftHeaderComponent: leftHeaderComponent,
|
|
1793
|
-
rightHeaderComponent: rightHeaderComponent,
|
|
1794
|
-
dragHandleIcon: dragHandleIcon,
|
|
1795
|
-
closeIcon: closeIcon
|
|
1796
|
-
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
1797
|
-
sx: styles$2.content,
|
|
1798
|
-
style: {
|
|
1799
|
-
maxHeight: maxHeight
|
|
1800
|
-
}
|
|
1801
|
-
}, children), isResizable && /*#__PURE__*/React__default.createElement(ToolFooter, null));
|
|
1802
|
-
};
|
|
1803
|
-
|
|
1804
|
-
/* *
|
|
1805
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1806
|
-
* you may not use this file except in compliance with the License.
|
|
1807
|
-
* You may obtain a copy of the License at
|
|
1808
|
-
*
|
|
1809
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1810
|
-
*
|
|
1811
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1812
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1813
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1814
|
-
* See the License for the specific language governing permissions and
|
|
1815
|
-
* limitations under the License.
|
|
1816
|
-
*
|
|
1817
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1818
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1819
|
-
* */
|
|
1820
|
-
var getRightPositionAndSize = function getRightPositionAndSize(_ref) {
|
|
1821
|
-
var currentX = _ref.currentX,
|
|
1822
|
-
currentWidth = _ref.currentWidth,
|
|
1823
|
-
newWidth = _ref.newWidth,
|
|
1824
|
-
maxWidth = _ref.maxWidth,
|
|
1825
|
-
position = _ref.position,
|
|
1826
|
-
startSize = _ref.startSize;
|
|
1827
|
-
var newSize = Object.assign(Object.assign({}, startSize), {
|
|
1828
|
-
width: newWidth
|
|
1829
|
-
}); // if new size is bigger than the window
|
|
1830
|
-
|
|
1831
|
-
if (newWidth >= maxWidth) {
|
|
1832
|
-
return {
|
|
1833
|
-
size: Object.assign(Object.assign({}, newSize), {
|
|
1834
|
-
width: maxWidth
|
|
1835
|
-
}),
|
|
1836
|
-
position: Object.assign(Object.assign({}, position), {
|
|
1837
|
-
x: position.x + (maxWidth - (currentX + currentWidth))
|
|
1838
|
-
})
|
|
1839
|
-
};
|
|
1840
|
-
} // if new size overlaps left side of screen
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
var newStartX = currentX - (newWidth - currentWidth);
|
|
1844
|
-
|
|
1845
|
-
if (newStartX <= 0) {
|
|
1846
|
-
return {
|
|
1847
|
-
size: newSize,
|
|
1848
|
-
position: Object.assign(Object.assign({}, position), {
|
|
1849
|
-
x: position.x - newStartX
|
|
1850
|
-
})
|
|
1851
|
-
};
|
|
1852
|
-
} // there is room to grow
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
return {
|
|
1856
|
-
size: newSize,
|
|
1857
|
-
position: position
|
|
1858
|
-
};
|
|
1859
|
-
};
|
|
1860
|
-
var getLeftPositionAndSize = function getLeftPositionAndSize(_ref2) {
|
|
1861
|
-
var currentX = _ref2.currentX,
|
|
1862
|
-
newWidth = _ref2.newWidth,
|
|
1863
|
-
maxWidth = _ref2.maxWidth,
|
|
1864
|
-
position = _ref2.position,
|
|
1865
|
-
startSize = _ref2.startSize;
|
|
1866
|
-
var newSize = Object.assign(Object.assign({}, startSize), {
|
|
1867
|
-
width: newWidth
|
|
1868
|
-
}); // if new size is bigger than the window
|
|
1869
|
-
|
|
1870
|
-
if (newWidth >= maxWidth) {
|
|
1871
|
-
return {
|
|
1872
|
-
size: Object.assign(Object.assign({}, newSize), {
|
|
1873
|
-
width: maxWidth
|
|
1874
|
-
}),
|
|
1875
|
-
position: Object.assign(Object.assign({}, position), {
|
|
1876
|
-
x: position.x - currentX
|
|
1877
|
-
})
|
|
1878
|
-
};
|
|
1879
|
-
} // if new size overlaps right side of screen
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
var newEndX = currentX + newWidth;
|
|
1883
|
-
|
|
1884
|
-
if (newEndX >= maxWidth) {
|
|
1885
|
-
return {
|
|
1886
|
-
size: newSize,
|
|
1887
|
-
position: Object.assign(Object.assign({}, position), {
|
|
1888
|
-
x: position.x + (maxWidth - newEndX)
|
|
1889
|
-
})
|
|
1890
|
-
};
|
|
1891
|
-
} // there is room to grow
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
return {
|
|
1895
|
-
size: newSize,
|
|
1896
|
-
position: position
|
|
1897
|
-
};
|
|
1898
|
-
};
|
|
1899
|
-
var useHandleSizeFromOutsideComponent = function useHandleSizeFromOutsideComponent(_ref3) {
|
|
1900
|
-
var nodeRef = _ref3.nodeRef,
|
|
1901
|
-
startSize = _ref3.startSize,
|
|
1902
|
-
bounds = _ref3.bounds,
|
|
1903
|
-
isRightAligned = _ref3.isRightAligned,
|
|
1904
|
-
size = _ref3.size,
|
|
1905
|
-
setSize = _ref3.setSize,
|
|
1906
|
-
position = _ref3.position,
|
|
1907
|
-
setPosition = _ref3.setPosition;
|
|
1908
|
-
React__default.useEffect(function () {
|
|
1909
|
-
var _a, _b; // update size when startSize has changed outside the component
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
if (startSize !== size) {
|
|
1913
|
-
var node = (_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.firstChild;
|
|
1914
|
-
var boundsNode = bounds === 'parent' ? (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.parentNode : document.querySelector(bounds);
|
|
1915
|
-
|
|
1916
|
-
var _boundsNode$getBoundi = boundsNode.getBoundingClientRect(),
|
|
1917
|
-
maxWidth = _boundsNode$getBoundi.width;
|
|
1918
|
-
|
|
1919
|
-
var newWidth = Number(startSize.width);
|
|
1920
|
-
|
|
1921
|
-
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1922
|
-
currentX = _node$getBoundingClie.x,
|
|
1923
|
-
currentWidth = _node$getBoundingClie.width;
|
|
1924
|
-
|
|
1925
|
-
var _ref4 = isRightAligned ? getRightPositionAndSize({
|
|
1926
|
-
currentX: currentX,
|
|
1927
|
-
currentWidth: currentWidth,
|
|
1928
|
-
newWidth: newWidth,
|
|
1929
|
-
maxWidth: maxWidth,
|
|
1930
|
-
position: position,
|
|
1931
|
-
startSize: startSize
|
|
1932
|
-
}) : getLeftPositionAndSize({
|
|
1933
|
-
currentX: currentX,
|
|
1934
|
-
newWidth: newWidth,
|
|
1935
|
-
maxWidth: maxWidth,
|
|
1936
|
-
position: position,
|
|
1937
|
-
startSize: startSize
|
|
1938
|
-
}),
|
|
1939
|
-
newPosition = _ref4.position,
|
|
1940
|
-
newSize = _ref4.size;
|
|
1941
|
-
|
|
1942
|
-
setSize(newSize);
|
|
1943
|
-
setPosition(newPosition);
|
|
1944
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1945
|
-
|
|
1946
|
-
}, [startSize.width, startSize.height]);
|
|
1947
|
-
};
|
|
1948
|
-
|
|
1949
|
-
var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
|
|
1950
|
-
var width = window.innerWidth * 0.85;
|
|
1951
|
-
var height = window.innerHeight * 0.85;
|
|
1952
|
-
var top = window.innerHeight * 0.15 / 2;
|
|
1953
|
-
var left = window.innerWidth * 0.15 / 2;
|
|
1954
|
-
return {
|
|
1955
|
-
width: width,
|
|
1956
|
-
height: height,
|
|
1957
|
-
top: top,
|
|
1958
|
-
left: left
|
|
1959
|
-
};
|
|
1960
|
-
};
|
|
1961
|
-
var BASE_Z_INDEX = 100;
|
|
1962
|
-
var calculateNewPosition = function calculateNewPosition(position, isRightAligned, handle, delta) {
|
|
1963
|
-
var x = position.x,
|
|
1964
|
-
y = position.y; // If dragging the same side as alignment, adjust position
|
|
1965
|
-
|
|
1966
|
-
if (isRightAligned && handle === 'bottomRight') {
|
|
1967
|
-
x = position.x + delta.width;
|
|
1968
|
-
} else if (!isRightAligned && handle === 'bottomLeft') {
|
|
1969
|
-
x = position.x - delta.width;
|
|
1970
|
-
} else if (isRightAligned && handle === 'topRight') {
|
|
1971
|
-
x = position.x + delta.width;
|
|
1972
|
-
y = position.y - delta.height;
|
|
1973
|
-
} else if (isRightAligned && handle === 'topLeft') {
|
|
1974
|
-
y = position.y - delta.height;
|
|
1975
|
-
} else if (!isRightAligned && handle === 'topRight') {
|
|
1976
|
-
y = position.y - delta.height;
|
|
1977
|
-
} else if (!isRightAligned && handle === 'topLeft') {
|
|
1978
|
-
x = position.x - delta.width;
|
|
1979
|
-
y = position.y - delta.height;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
return {
|
|
1983
|
-
x: x,
|
|
1984
|
-
y: y
|
|
1985
|
-
};
|
|
1986
|
-
};
|
|
1987
|
-
|
|
1988
|
-
var DraggableComponent = function DraggableComponent(_a) {
|
|
1989
|
-
var title = _a.title,
|
|
1990
|
-
_a$bounds = _a.bounds,
|
|
1991
|
-
bounds = _a$bounds === void 0 ? 'body' : _a$bounds,
|
|
1992
|
-
_a$cancel = _a.cancel,
|
|
1993
|
-
cancel = _a$cancel === void 0 ? '.MuiButtonBase-root' : _a$cancel,
|
|
1994
|
-
_a$headerSize = _a.headerSize,
|
|
1995
|
-
headerSize = _a$headerSize === void 0 ? 'small' : _a$headerSize,
|
|
1996
|
-
_a$startSize = _a.startSize,
|
|
1997
|
-
startSize = _a$startSize === void 0 ? {
|
|
1998
|
-
width: 'auto',
|
|
1999
|
-
height: 'auto'
|
|
2000
|
-
} : _a$startSize,
|
|
2001
|
-
_a$startPosition = _a.startPosition,
|
|
2002
|
-
startPosition = _a$startPosition === void 0 ? {
|
|
2003
|
-
left: undefined,
|
|
2004
|
-
right: undefined,
|
|
2005
|
-
top: undefined
|
|
2006
|
-
} : _a$startPosition,
|
|
2007
|
-
children = _a.children,
|
|
2008
|
-
_a$isOpen = _a.isOpen,
|
|
2009
|
-
isOpen = _a$isOpen === void 0 ? true : _a$isOpen,
|
|
2010
|
-
_a$onClose = _a.onClose,
|
|
2011
|
-
onClose = _a$onClose === void 0 ? function () {} : _a$onClose,
|
|
2012
|
-
_a$initialMaxHeight = _a.initialMaxHeight,
|
|
2013
|
-
defaultInitialMaxHeight = _a$initialMaxHeight === void 0 ? 'initial' : _a$initialMaxHeight,
|
|
2014
|
-
_a$onChangeSize = _a.onChangeSize,
|
|
2015
|
-
onChangeSize = _a$onChangeSize === void 0 ? function () {} : _a$onChangeSize,
|
|
2016
|
-
_a$onMouseDown = _a.onMouseDown,
|
|
2017
|
-
onMouseDown = _a$onMouseDown === void 0 ? function () {} : _a$onMouseDown,
|
|
2018
|
-
_a$onResizeStop = _a.onResizeStop,
|
|
2019
|
-
onResizeStop = _a$onResizeStop === void 0 ? function () {} : _a$onResizeStop,
|
|
2020
|
-
_a$onDragEnd = _a.onDragEnd,
|
|
2021
|
-
onDragEnd = _a$onDragEnd === void 0 ? function () {} : _a$onDragEnd,
|
|
2022
|
-
_a$onFocus = _a.onFocus,
|
|
2023
|
-
onFocus = _a$onFocus === void 0 ? function () {} : _a$onFocus,
|
|
2024
|
-
_a$onBlur = _a.onBlur,
|
|
2025
|
-
onBlur = _a$onBlur === void 0 ? function () {} : _a$onBlur,
|
|
2026
|
-
_a$order = _a.order,
|
|
2027
|
-
order = _a$order === void 0 ? 1 : _a$order,
|
|
2028
|
-
_a$source = _a.source,
|
|
2029
|
-
source = _a$source === void 0 ? 'app' : _a$source,
|
|
2030
|
-
_a$leftHeaderComponen = _a.leftHeaderComponent,
|
|
2031
|
-
leftHeaderComponent = _a$leftHeaderComponen === void 0 ? null : _a$leftHeaderComponen,
|
|
2032
|
-
_a$rightHeaderCompone = _a.rightHeaderComponent,
|
|
2033
|
-
rightHeaderComponent = _a$rightHeaderCompone === void 0 ? null : _a$rightHeaderCompone,
|
|
2034
|
-
dragHandleIcon = _a.dragHandleIcon,
|
|
2035
|
-
closeIcon = _a.closeIcon,
|
|
2036
|
-
className = _a.className,
|
|
2037
|
-
_a$sx = _a.sx,
|
|
2038
|
-
sx = _a$sx === void 0 ? {} : _a$sx,
|
|
2039
|
-
props = __rest(_a, ["title", "bounds", "cancel", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "onFocus", "onBlur", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "dragHandleIcon", "closeIcon", "className", "sx"]);
|
|
2040
|
-
|
|
2041
|
-
var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
|
|
2042
|
-
var elevation = BASE_ELEVATION + order;
|
|
2043
|
-
var nodeRef = React__default.useRef(null);
|
|
2044
|
-
|
|
2045
|
-
var _React$useState = React__default.useState({
|
|
2046
|
-
x: 0,
|
|
2047
|
-
y: 0
|
|
2048
|
-
}),
|
|
2049
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2050
|
-
position = _React$useState2[0],
|
|
2051
|
-
setPosition = _React$useState2[1];
|
|
2052
|
-
|
|
2053
|
-
var _React$useState3 = React__default.useState(startSize),
|
|
2054
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2055
|
-
size = _React$useState4[0],
|
|
2056
|
-
setSize = _React$useState4[1];
|
|
2057
|
-
|
|
2058
|
-
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
2059
|
-
var onStopDrag = React__default.useCallback(function (_event, position) {
|
|
2060
|
-
setPosition(position);
|
|
2061
|
-
onDragEnd(position, size);
|
|
2062
|
-
}, [setPosition, onDragEnd, size]);
|
|
2063
|
-
|
|
2064
|
-
var _React$useState5 = React__default.useState(defaultInitialMaxHeight),
|
|
2065
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2066
|
-
initialMaxHeight = _React$useState6[0],
|
|
2067
|
-
setInitialMaxHeight = _React$useState6[1];
|
|
2068
|
-
|
|
2069
|
-
var onStartResize = function onStartResize() {
|
|
2070
|
-
setInitialMaxHeight('initial');
|
|
2071
|
-
};
|
|
2072
|
-
|
|
2073
|
-
var onResize = React__default.useCallback(function (_event, handle, node, delta) {
|
|
2074
|
-
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
2075
|
-
width = _node$getBoundingClie.width,
|
|
2076
|
-
height = _node$getBoundingClie.height;
|
|
2077
|
-
|
|
2078
|
-
onChangeSize({
|
|
2079
|
-
width: width,
|
|
2080
|
-
height: height
|
|
2081
|
-
});
|
|
2082
|
-
var newPos = calculateNewPosition(position, isRightAligned, handle, delta); // eslint-disable-next-line no-param-reassign
|
|
2083
|
-
|
|
2084
|
-
var parent = node.parentNode;
|
|
2085
|
-
parent.style.transform = "translate(".concat(newPos.x, "px, ").concat(newPos.y, "px)");
|
|
2086
|
-
}, [onChangeSize, position, isRightAligned]);
|
|
2087
|
-
|
|
2088
|
-
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
2089
|
-
setPosition(calculateNewPosition(position, isRightAligned, direction, delta));
|
|
2090
|
-
onResizeStop(_event, direction, node, delta);
|
|
2091
|
-
};
|
|
2092
|
-
|
|
2093
|
-
useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition);
|
|
2094
|
-
useHandleSizeFromOutsideComponent({
|
|
2095
|
-
nodeRef: nodeRef,
|
|
2096
|
-
startSize: startSize,
|
|
2097
|
-
bounds: bounds,
|
|
2098
|
-
isRightAligned: isRightAligned,
|
|
2099
|
-
size: size,
|
|
2100
|
-
setSize: setSize,
|
|
2101
|
-
position: position,
|
|
2102
|
-
setPosition: setPosition
|
|
2103
|
-
});
|
|
2104
|
-
var toolcontainerId = React__default.useRef(Date.now().toString()).current;
|
|
2105
|
-
var headerClassName = "header-".concat(className || toolcontainerId);
|
|
2106
|
-
return isOpen ? /*#__PURE__*/React__default.createElement(DraggableComponent$1, {
|
|
2107
|
-
nodeRef: nodeRef,
|
|
2108
|
-
bounds: bounds,
|
|
2109
|
-
cancel: cancel,
|
|
2110
|
-
position: position,
|
|
2111
|
-
onStop: onStopDrag,
|
|
2112
|
-
handle: ".".concat(headerClassName),
|
|
2113
|
-
onMouseDown: onMouseDown
|
|
2114
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
2115
|
-
tabIndex: -1,
|
|
2116
|
-
onFocus: onFocus,
|
|
2117
|
-
onBlur: onBlur,
|
|
2118
|
-
sx: Object.assign(Object.assign(Object.assign({
|
|
2119
|
-
position: 'absolute',
|
|
2120
|
-
pointerEvents: 'all',
|
|
2121
|
-
zIndex: zIndex
|
|
2122
|
-
}, startPosition), sx), {
|
|
2123
|
-
'&:hover .resizableHandle': {
|
|
2124
|
-
display: 'inline'
|
|
2125
|
-
}
|
|
2126
|
-
}),
|
|
2127
|
-
ref: nodeRef,
|
|
2128
|
-
className: "toolContainerDraggable"
|
|
2129
|
-
}, /*#__PURE__*/React__default.createElement(ResizeComponent, Object.assign({}, props, {
|
|
2130
|
-
size: size,
|
|
2131
|
-
setSize: setSize,
|
|
2132
|
-
onResizeStart: onStartResize,
|
|
2133
|
-
onResizeStop: onStopResize,
|
|
2134
|
-
onResize: onResize
|
|
2135
|
-
}), /*#__PURE__*/React__default.createElement(ToolContainer, {
|
|
2136
|
-
maxHeight: initialMaxHeight,
|
|
2137
|
-
onClose: onClose,
|
|
2138
|
-
title: title,
|
|
2139
|
-
size: headerSize,
|
|
2140
|
-
isDraggable: true,
|
|
2141
|
-
isResizable: true,
|
|
2142
|
-
elevation: elevation,
|
|
2143
|
-
headerClassName: headerClassName,
|
|
2144
|
-
leftHeaderComponent: leftHeaderComponent,
|
|
2145
|
-
rightHeaderComponent: rightHeaderComponent,
|
|
2146
|
-
dragHandleIcon: dragHandleIcon,
|
|
2147
|
-
closeIcon: closeIcon,
|
|
2148
|
-
className: className
|
|
2149
|
-
}, children)))) : null;
|
|
2150
|
-
};
|
|
2151
|
-
|
|
2152
|
-
/* *
|
|
2153
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2154
|
-
* you may not use this file except in compliance with the License.
|
|
2155
|
-
* You may obtain a copy of the License at
|
|
2156
|
-
*
|
|
2157
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2158
|
-
*
|
|
2159
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2160
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2161
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2162
|
-
* See the License for the specific language governing permissions and
|
|
2163
|
-
* limitations under the License.
|
|
2164
|
-
*
|
|
2165
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2166
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2167
|
-
* */
|
|
2168
|
-
var segmentStyle = {
|
|
2169
|
-
margin: '0 2px',
|
|
2170
|
-
verticalAlign: 'middle',
|
|
2171
|
-
fontSize: 14,
|
|
2172
|
-
fontWeight: 500,
|
|
2173
|
-
letterSpacing: 0.25,
|
|
2174
|
-
justifyContent: 'center'
|
|
2175
|
-
};
|
|
2176
|
-
var styles$1 = {
|
|
2177
|
-
icon: Object.assign(Object.assign({}, segmentStyle), {
|
|
2178
|
-
backgroundColor: 'geowebColors.textInputField.default.rgba',
|
|
2179
|
-
width: 40,
|
|
2180
|
-
height: 40,
|
|
2181
|
-
display: 'inline-flex',
|
|
2182
|
-
alignItems: 'center',
|
|
2183
|
-
borderRadius: 1
|
|
2184
|
-
}),
|
|
2185
|
-
connect: Object.assign(Object.assign({}, segmentStyle), {
|
|
2186
|
-
fontSize: 18
|
|
2187
|
-
}),
|
|
2188
|
-
divider: Object.assign(Object.assign({}, segmentStyle), {
|
|
2189
|
-
margin: '0 6px',
|
|
2190
|
-
fontSize: 18
|
|
2191
|
-
})
|
|
2192
|
-
};
|
|
2193
|
-
|
|
2194
|
-
var ShortCutSegment = function ShortCutSegment(_ref) {
|
|
2195
|
-
var _ref$type = _ref.type,
|
|
2196
|
-
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
2197
|
-
children = _ref.children;
|
|
2198
|
-
|
|
2199
|
-
if (type === 'divider') {
|
|
2200
|
-
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
2201
|
-
sx: styles$1.divider,
|
|
2202
|
-
"data-testid": "segment-divider",
|
|
2203
|
-
component: "span"
|
|
2204
|
-
}, children);
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
if (type === 'icon') {
|
|
2208
|
-
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
2209
|
-
sx: styles$1.icon,
|
|
2210
|
-
"data-testid": "segment-icon",
|
|
2211
|
-
component: "span"
|
|
2212
|
-
}, children);
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
if (type === 'connect') {
|
|
2216
|
-
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
2217
|
-
sx: styles$1.connect,
|
|
2218
|
-
"data-testid": "segment-connect",
|
|
2219
|
-
component: "span"
|
|
2220
|
-
}, children);
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
2224
|
-
sx: segmentStyle,
|
|
2225
|
-
"data-testid": "segment-text",
|
|
2226
|
-
component: "span"
|
|
2227
|
-
}, children);
|
|
2228
|
-
};
|
|
2229
|
-
|
|
2230
|
-
/* *
|
|
2231
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2232
|
-
* you may not use this file except in compliance with the License.
|
|
2233
|
-
* You may obtain a copy of the License at
|
|
2234
|
-
*
|
|
2235
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2236
|
-
*
|
|
2237
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2238
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2239
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2240
|
-
* See the License for the specific language governing permissions and
|
|
2241
|
-
* limitations under the License.
|
|
2242
|
-
*
|
|
2243
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2244
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2245
|
-
* */
|
|
2246
|
-
var shortcuts = [{
|
|
2247
|
-
title: 'Choose a selected time',
|
|
2248
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "Left click on the time slider rail")
|
|
2249
|
-
}, {
|
|
2250
|
-
title: 'Move backwards/forwards in selected time',
|
|
2251
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "Mouse scroll over the time slider rail")
|
|
2252
|
-
}, {
|
|
2253
|
-
title: 'Move 1 step backwards/forwards in selected time',
|
|
2254
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2255
|
-
type: "icon"
|
|
2256
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2257
|
-
type: "connect"
|
|
2258
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2259
|
-
type: "icon"
|
|
2260
|
-
}, /*#__PURE__*/React__default.createElement(ArrowLeft, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2261
|
-
type: "divider"
|
|
2262
|
-
}, "or"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2263
|
-
type: "icon"
|
|
2264
|
-
}, /*#__PURE__*/React__default.createElement(ArrowRight, null))),
|
|
2265
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2266
|
-
type: "icon"
|
|
2267
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2268
|
-
type: "connect"
|
|
2269
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2270
|
-
type: "icon"
|
|
2271
|
-
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2272
|
-
type: "connect"
|
|
2273
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2274
|
-
type: "icon"
|
|
2275
|
-
}, /*#__PURE__*/React__default.createElement(ArrowLeft, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2276
|
-
type: "divider"
|
|
2277
|
-
}, "or"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2278
|
-
type: "icon"
|
|
2279
|
-
}, /*#__PURE__*/React__default.createElement(ArrowRight, null)))
|
|
2280
|
-
}, {
|
|
2281
|
-
title: 'Toggle hide/show time slider',
|
|
2282
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2283
|
-
type: "icon"
|
|
2284
|
-
}, "t")
|
|
2285
|
-
}, {
|
|
2286
|
-
title: 'Change time slider scale (visible timespan)',
|
|
2287
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "Hold left click over Time Slider legend + drag left or right")
|
|
2288
|
-
}, {
|
|
2289
|
-
title: 'Expand/shrink time slider scale (visible timespan)',
|
|
2290
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2291
|
-
type: "icon"
|
|
2292
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "+ Scroll the slider rail"))
|
|
2293
|
-
}, {
|
|
2294
|
-
title: 'Mouseover to change selected time',
|
|
2295
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "Hover over Time Slider rail or time indicator")
|
|
2296
|
-
}, {
|
|
2297
|
-
title: 'Mouseover switch on/off',
|
|
2298
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2299
|
-
type: "icon"
|
|
2300
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2301
|
-
type: "connect"
|
|
2302
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2303
|
-
type: "icon"
|
|
2304
|
-
}, "Alt"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2305
|
-
type: "connect"
|
|
2306
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2307
|
-
type: "icon"
|
|
2308
|
-
}, "h")),
|
|
2309
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2310
|
-
type: "icon"
|
|
2311
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2312
|
-
type: "connect"
|
|
2313
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2314
|
-
type: "icon"
|
|
2315
|
-
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2316
|
-
type: "connect"
|
|
2317
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2318
|
-
type: "icon"
|
|
2319
|
-
}, "h"))
|
|
2320
|
-
}, {
|
|
2321
|
-
title: 'Change time step or animation speed',
|
|
2322
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2323
|
-
type: "icon"
|
|
2324
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2325
|
-
type: "connect"
|
|
2326
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2327
|
-
type: "icon"
|
|
2328
|
-
}, /*#__PURE__*/React__default.createElement(ArrowUp, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2329
|
-
type: "divider"
|
|
2330
|
-
}, "or"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2331
|
-
type: "icon"
|
|
2332
|
-
}, /*#__PURE__*/React__default.createElement(ArrowDown, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "(when slider active)")),
|
|
2333
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2334
|
-
type: "icon"
|
|
2335
|
-
}, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2336
|
-
type: "connect"
|
|
2337
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2338
|
-
type: "icon"
|
|
2339
|
-
}, /*#__PURE__*/React__default.createElement(ArrowUp, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2340
|
-
type: "divider"
|
|
2341
|
-
}, "or"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2342
|
-
type: "icon"
|
|
2343
|
-
}, /*#__PURE__*/React__default.createElement(ArrowDown, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, "(when slider active)"))
|
|
2344
|
-
}, {
|
|
2345
|
-
title: 'Return to current time',
|
|
2346
|
-
description: /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2347
|
-
type: "icon"
|
|
2348
|
-
}, "Home"),
|
|
2349
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2350
|
-
type: "icon"
|
|
2351
|
-
}, "fn"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2352
|
-
type: "connect"
|
|
2353
|
-
}, "+"), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2354
|
-
type: "icon"
|
|
2355
|
-
}, /*#__PURE__*/React__default.createElement(ArrowLeft, null)))
|
|
2356
|
-
}, {
|
|
2357
|
-
title: 'Change layer manager values by scrolling',
|
|
2358
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2359
|
-
type: "icon"
|
|
2360
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll")),
|
|
2361
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2362
|
-
type: "icon"
|
|
2363
|
-
}, /*#__PURE__*/React__default.createElement(KeyCommand, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + Mouse scroll"))
|
|
2364
|
-
}, {
|
|
2365
|
-
title: 'Change size of layer manager to small',
|
|
2366
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2367
|
-
type: "icon"
|
|
2368
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2369
|
-
type: "icon"
|
|
2370
|
-
}, "Alt"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2371
|
-
type: "icon"
|
|
2372
|
-
}, "s")),
|
|
2373
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2374
|
-
type: "icon"
|
|
2375
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2376
|
-
type: "icon"
|
|
2377
|
-
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2378
|
-
type: "icon"
|
|
2379
|
-
}, "s"))
|
|
2380
|
-
}, {
|
|
2381
|
-
title: 'Change size of layer manager to medium',
|
|
2382
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2383
|
-
type: "icon"
|
|
2384
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2385
|
-
type: "icon"
|
|
2386
|
-
}, "Alt"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2387
|
-
type: "icon"
|
|
2388
|
-
}, "m")),
|
|
2389
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2390
|
-
type: "icon"
|
|
2391
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2392
|
-
type: "icon"
|
|
2393
|
-
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2394
|
-
type: "icon"
|
|
2395
|
-
}, "m"))
|
|
2396
|
-
}, {
|
|
2397
|
-
title: 'Change size of layer manager to large',
|
|
2398
|
-
description: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2399
|
-
type: "icon"
|
|
2400
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2401
|
-
type: "icon"
|
|
2402
|
-
}, "Alt"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2403
|
-
type: "icon"
|
|
2404
|
-
}, "l")),
|
|
2405
|
-
descriptionMac: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2406
|
-
type: "icon"
|
|
2407
|
-
}, "Ctrl"), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2408
|
-
type: "icon"
|
|
2409
|
-
}, /*#__PURE__*/React__default.createElement(KeyOption, null)), /*#__PURE__*/React__default.createElement(ShortCutSegment, null, " + "), /*#__PURE__*/React__default.createElement(ShortCutSegment, {
|
|
2410
|
-
type: "icon"
|
|
2411
|
-
}, "l"))
|
|
2412
|
-
}];
|
|
2413
|
-
var getShortcutList = function getShortcutList(shortcutList) {
|
|
2414
|
-
var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'windows';
|
|
2415
|
-
return shortcutList.map(function (_ref) {
|
|
2416
|
-
var title = _ref.title,
|
|
2417
|
-
description = _ref.description,
|
|
2418
|
-
descriptionMac = _ref.descriptionMac;
|
|
2419
|
-
return Object.assign({
|
|
2420
|
-
title: title,
|
|
2421
|
-
description: description
|
|
2422
|
-
}, platform === 'windows' ? {
|
|
2423
|
-
description: description
|
|
2424
|
-
} : {
|
|
2425
|
-
description: descriptionMac || description
|
|
2426
|
-
});
|
|
2427
|
-
});
|
|
2428
|
-
};
|
|
2429
|
-
|
|
2430
|
-
var ShortcutList = function ShortcutList(_ref2) {
|
|
2431
|
-
var _ref2$platform = _ref2.platform,
|
|
2432
|
-
platform = _ref2$platform === void 0 ? 'windows' : _ref2$platform;
|
|
2433
|
-
var rows = getShortcutList(shortcuts, platform);
|
|
2434
|
-
return /*#__PURE__*/React__default.createElement(List, {
|
|
2435
|
-
"data-testid": "list-".concat(platform)
|
|
2436
|
-
}, rows.map(function (row, index) {
|
|
2437
|
-
return /*#__PURE__*/React__default.createElement(ListItem, {
|
|
2438
|
-
sx: {
|
|
2439
|
-
minHeight: 56
|
|
2440
|
-
},
|
|
2441
|
-
divider: index !== rows.length - 1,
|
|
2442
|
-
key: row.title
|
|
2443
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
2444
|
-
container: true,
|
|
2445
|
-
direction: "row",
|
|
2446
|
-
justifyContent: "space-between",
|
|
2447
|
-
alignItems: "center"
|
|
2448
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
2449
|
-
item: true,
|
|
2450
|
-
sx: {
|
|
2451
|
-
fontSize: 12,
|
|
2452
|
-
fontWeight: 300,
|
|
2453
|
-
letterSpacing: 0.4,
|
|
2454
|
-
opacity: 0.67
|
|
2455
|
-
}
|
|
2456
|
-
}, row.title), /*#__PURE__*/React__default.createElement(Grid, {
|
|
2457
|
-
item: true
|
|
2458
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
2459
|
-
sx: {
|
|
2460
|
-
alignItems: 'center'
|
|
2461
|
-
}
|
|
2462
|
-
}, row.description))));
|
|
2463
|
-
}));
|
|
2464
|
-
};
|
|
2465
|
-
|
|
2466
|
-
var TabPanel = function TabPanel(_ref) {
|
|
2467
|
-
var children = _ref.children,
|
|
2468
|
-
value = _ref.value,
|
|
2469
|
-
index = _ref.index;
|
|
2470
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
2471
|
-
role: "tabpanel",
|
|
2472
|
-
hidden: value !== index,
|
|
2473
|
-
id: "tabpanel-".concat(index),
|
|
2474
|
-
"aria-labelledby": "tab-".concat(index)
|
|
2475
|
-
}, value === index && children);
|
|
2476
|
-
};
|
|
2477
|
-
|
|
2478
|
-
var styles = {
|
|
2479
|
-
container: {
|
|
2480
|
-
margin: '0px 20px',
|
|
2481
|
-
maxHeight: '90vh'
|
|
2482
|
-
},
|
|
2483
|
-
tab: {
|
|
2484
|
-
fontSize: 12
|
|
2485
|
-
}
|
|
2486
|
-
};
|
|
2487
|
-
|
|
2488
|
-
var CheatSheet = function CheatSheet() {
|
|
2489
|
-
var _React$useState = React__default.useState(0),
|
|
2490
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2491
|
-
activeTab = _React$useState2[0],
|
|
2492
|
-
onChangeActiveTab = _React$useState2[1];
|
|
2493
|
-
|
|
2494
|
-
var onChangeTab = function onChangeTab(_event, newValue) {
|
|
2495
|
-
onChangeActiveTab(newValue);
|
|
2496
|
-
};
|
|
2497
|
-
|
|
2498
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
2499
|
-
sx: styles.container
|
|
2500
|
-
}, /*#__PURE__*/React__default.createElement(Tabs, {
|
|
2501
|
-
value: activeTab,
|
|
2502
|
-
onChange: onChangeTab,
|
|
2503
|
-
"aria-label": "platform"
|
|
2504
|
-
}, /*#__PURE__*/React__default.createElement(Tab, {
|
|
2505
|
-
sx: styles.tab,
|
|
2506
|
-
label: "Windows"
|
|
2507
|
-
}), /*#__PURE__*/React__default.createElement(Tab, {
|
|
2508
|
-
sx: styles.tab,
|
|
2509
|
-
label: "Mac"
|
|
2510
|
-
})), /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
2511
|
-
value: activeTab,
|
|
2512
|
-
index: 0
|
|
2513
|
-
}, /*#__PURE__*/React__default.createElement(ShortcutList, null)), /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
2514
|
-
value: activeTab,
|
|
2515
|
-
index: 1
|
|
2516
|
-
}, /*#__PURE__*/React__default.createElement(ShortcutList, {
|
|
2517
|
-
platform: "mac"
|
|
2518
|
-
})));
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
|
-
var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
|
|
2522
|
-
var _React$useState = React__default.useState(false),
|
|
2523
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2524
|
-
open = _React$useState2[0],
|
|
2525
|
-
setOpen = _React$useState2[1];
|
|
2526
|
-
|
|
2527
|
-
var onClose = function onClose() {
|
|
2528
|
-
setOpen(false);
|
|
2529
|
-
};
|
|
2530
|
-
|
|
2531
|
-
var onOpen = function onOpen() {
|
|
2532
|
-
setOpen(true);
|
|
2533
|
-
};
|
|
2534
|
-
|
|
2535
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
2536
|
-
"data-testid": "cheatsheet-btn",
|
|
2537
|
-
onClick: onOpen,
|
|
2538
|
-
divider: true
|
|
2539
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
2540
|
-
container: true
|
|
2541
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
2542
|
-
item: true
|
|
2543
|
-
}, "Cheat sheet"))), /*#__PURE__*/React__default.createElement(Backdrop, {
|
|
2544
|
-
"data-testid": "cheatsheet-content",
|
|
2545
|
-
open: open,
|
|
2546
|
-
sx: {
|
|
2547
|
-
zIndex: 1
|
|
2548
|
-
}
|
|
2549
|
-
}, /*#__PURE__*/React__default.createElement(DraggableComponent, {
|
|
2550
|
-
startSize: {
|
|
2551
|
-
width: 700
|
|
2552
|
-
},
|
|
2553
|
-
minHeight: 300,
|
|
2554
|
-
minWidth: 500,
|
|
2555
|
-
title: "Cheat sheet",
|
|
2556
|
-
headerSize: "small",
|
|
2557
|
-
isOpen: true,
|
|
2558
|
-
onClose: onClose,
|
|
2559
|
-
bounds: "parent"
|
|
2560
|
-
}, /*#__PURE__*/React__default.createElement(CheatSheet, null))));
|
|
2561
|
-
};
|
|
2562
|
-
|
|
2563
|
-
var useUserMenu = function useUserMenu() {
|
|
2564
|
-
var open = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2565
|
-
|
|
2566
|
-
var _React$useState = React__default.useState(open),
|
|
2567
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2568
|
-
isOpen = _React$useState2[0],
|
|
2569
|
-
setOpen = _React$useState2[1];
|
|
2570
|
-
|
|
2571
|
-
var onClose = function onClose() {
|
|
2572
|
-
return setOpen(false);
|
|
2573
|
-
};
|
|
2574
|
-
|
|
2575
|
-
var onToggle = function onToggle() {
|
|
2576
|
-
return setOpen(!isOpen);
|
|
2577
|
-
};
|
|
2578
|
-
|
|
2579
|
-
return {
|
|
2580
|
-
isOpen: isOpen,
|
|
2581
|
-
onClose: onClose,
|
|
2582
|
-
onToggle: onToggle
|
|
2583
|
-
};
|
|
2584
|
-
};
|
|
2585
|
-
|
|
2586
|
-
/* *
|
|
2587
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2588
|
-
* you may not use this file except in compliance with the License.
|
|
2589
|
-
* You may obtain a copy of the License at
|
|
2590
|
-
*
|
|
2591
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2592
|
-
*
|
|
2593
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2594
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2595
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2596
|
-
* See the License for the specific language governing permissions and
|
|
2597
|
-
* limitations under the License.
|
|
2598
|
-
*
|
|
2599
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2600
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2601
|
-
* */
|
|
2602
|
-
var getInitials = function getInitials(name) {
|
|
2603
|
-
if (!name) {
|
|
2604
|
-
return '';
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
var nameWithoutEmail = name.split('@')[0];
|
|
2608
|
-
var array = nameWithoutEmail.split('.');
|
|
2609
|
-
|
|
2610
|
-
switch (array.length) {
|
|
2611
|
-
case 1:
|
|
2612
|
-
return array[0].charAt(0).toUpperCase();
|
|
2613
|
-
|
|
2614
|
-
default:
|
|
2615
|
-
return array[0].charAt(0).toUpperCase() + array[array.length - 1].charAt(0).toUpperCase();
|
|
2616
|
-
}
|
|
2617
|
-
};
|
|
2618
|
-
|
|
2619
|
-
var sliderHeaderStyle = {
|
|
2620
|
-
fontFamily: 'Roboto-Black, Roboto',
|
|
2621
|
-
fontSize: 12,
|
|
2622
|
-
color: 'geowebColors.typographyAndIcons.text',
|
|
2623
|
-
padding: '11px 0 11px 16px'
|
|
2624
|
-
};
|
|
2625
|
-
var sliderStyle = {
|
|
2626
|
-
'& span.selectedLabel': {
|
|
2627
|
-
fontWeight: 'bold'
|
|
2628
|
-
},
|
|
2629
|
-
'& .MuiSlider-thumb': {
|
|
2630
|
-
backgroundColor: 'geowebColors.customSlider.thumb',
|
|
2631
|
-
boxShadow: '0px 3px 5px 1px rgba(0,0,0,0.3)',
|
|
2632
|
-
'&.Mui-focusVisible, &:hover, &:active': {
|
|
2633
|
-
boxShadow: '0px 3px 5px 2px rgba(0,0,0,0.4)'
|
|
2634
|
-
}
|
|
2635
|
-
},
|
|
2636
|
-
'& .MuiSlider-mark': {
|
|
2637
|
-
backgroundColor: 'geowebColors.customSlider.mark'
|
|
2638
|
-
},
|
|
2639
|
-
'& .MuiSlider-markLabel': {
|
|
2640
|
-
fontFamily: 'Roboto-Black, Roboto',
|
|
2641
|
-
fontSize: 12,
|
|
2642
|
-
color: 'geowebColors.typographyAndIcons.text'
|
|
2643
|
-
},
|
|
2644
|
-
'& .MuiSlider-track': {
|
|
2645
|
-
color: 'geowebColors.customSlider.track',
|
|
2646
|
-
backgroundColor: 'geowebColors.customSlider.track'
|
|
2647
|
-
},
|
|
2648
|
-
'& .MuiSlider-rail': {
|
|
2649
|
-
backgroundColor: 'geowebColors.customSlider.rail',
|
|
2650
|
-
opacity: 1
|
|
2651
|
-
},
|
|
2652
|
-
'&.Mui-disabled': {
|
|
2653
|
-
'& .MuiSlider-thumb': {
|
|
2654
|
-
backgroundColor: 'geowebColors.customSlider.thumbDisabled'
|
|
2655
|
-
},
|
|
2656
|
-
'& .MuiSlider-mark': {
|
|
2657
|
-
backgroundColor: 'geowebColors.customSlider.markDisabled'
|
|
2658
|
-
},
|
|
2659
|
-
'& .MuiSlider-track': {
|
|
2660
|
-
backgroundColor: 'geowebColors.customSlider.trackDisabled',
|
|
2661
|
-
color: 'geowebColors.customSlider.trackDisabled'
|
|
2662
|
-
},
|
|
2663
|
-
'& .MuiSlider-rail': {
|
|
2664
|
-
backgroundColor: 'geowebColors.customSlider.railDisabled',
|
|
2665
|
-
opacity: 1
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
};
|
|
2669
|
-
var CustomSlider = function CustomSlider(_a) {
|
|
2670
|
-
var value = _a.value,
|
|
2671
|
-
_a$orientation = _a.orientation,
|
|
2672
|
-
orientation = _a$orientation === void 0 ? 'vertical' : _a$orientation,
|
|
2673
|
-
_a$shouldAutoFocus = _a.shouldAutoFocus,
|
|
2674
|
-
shouldAutoFocus = _a$shouldAutoFocus === void 0 ? false : _a$shouldAutoFocus,
|
|
2675
|
-
props = __rest(_a, ["value", "orientation", "shouldAutoFocus"]); // Add custom class (for bold text) to label adjacent to thumb component.
|
|
2676
|
-
// Material UI doesn't support highlighing only adjacent label
|
|
2677
|
-
// when track is highlighted everywhere below selected value.
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
var element = React.useRef(null);
|
|
2681
|
-
var themeContext = useThemeContext();
|
|
2682
|
-
React.useEffect(function () {
|
|
2683
|
-
var activeMarkLabelElements = element.current.getElementsByClassName('MuiSlider-markLabelActive');
|
|
2684
|
-
|
|
2685
|
-
var _reverse = _toConsumableArray(activeMarkLabelElements).reverse(),
|
|
2686
|
-
_reverse2 = _toArray(_reverse),
|
|
2687
|
-
first = _reverse2[0],
|
|
2688
|
-
rest = _reverse2.slice(1);
|
|
2689
|
-
|
|
2690
|
-
if (first) {
|
|
2691
|
-
first.classList.add('selectedLabel');
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
rest.forEach(function (element) {
|
|
2695
|
-
return element.classList.remove('selectedLabel');
|
|
2696
|
-
});
|
|
2697
|
-
}, [value, themeContext.isDark]); // autofocus
|
|
2698
|
-
|
|
2699
|
-
React.useEffect(function () {
|
|
2700
|
-
if (shouldAutoFocus && element.current) {
|
|
2701
|
-
var thumb = element.current.querySelector('.MuiSlider-thumb input');
|
|
2702
|
-
thumb.focus();
|
|
2703
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2704
|
-
|
|
2705
|
-
}, []);
|
|
2706
|
-
return /*#__PURE__*/React.createElement(Slider, Object.assign({
|
|
2707
|
-
sx: sliderStyle,
|
|
2708
|
-
ref: element,
|
|
2709
|
-
value: value,
|
|
2710
|
-
orientation: orientation
|
|
2711
|
-
}, props));
|
|
2712
|
-
};
|
|
2713
|
-
|
|
2714
|
-
/* *
|
|
2715
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2716
|
-
* you may not use this file except in compliance with the License.
|
|
2717
|
-
* You may obtain a copy of the License at
|
|
2718
|
-
*
|
|
2719
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2720
|
-
*
|
|
2721
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2722
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2723
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2724
|
-
* See the License for the specific language governing permissions and
|
|
2725
|
-
* limitations under the License.
|
|
2726
|
-
*
|
|
2727
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2728
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2729
|
-
* */
|
|
2730
|
-
|
|
2731
|
-
var CustomToggleButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
2732
|
-
var _a$variant = _a.variant,
|
|
2733
|
-
variant = _a$variant === void 0 ? 'primary' : _a$variant,
|
|
2734
|
-
className = _a.className,
|
|
2735
|
-
_a$value = _a.value,
|
|
2736
|
-
value = _a$value === void 0 ? 0 : _a$value,
|
|
2737
|
-
props = __rest(_a, ["variant", "className", "value"]);
|
|
2738
|
-
|
|
2739
|
-
return /*#__PURE__*/React.createElement(ToggleButton, Object.assign({
|
|
2740
|
-
ref: ref,
|
|
2741
|
-
className: "".concat(variant, " ").concat(className),
|
|
2742
|
-
value: value
|
|
2743
|
-
}, props));
|
|
2744
|
-
});
|
|
2745
|
-
|
|
2746
|
-
var getPosition = function getPosition(menuPosition) {
|
|
2747
|
-
switch (menuPosition) {
|
|
2748
|
-
case 'bottom':
|
|
2749
|
-
return {
|
|
2750
|
-
anchorOrigin: {
|
|
2751
|
-
vertical: 'bottom',
|
|
2752
|
-
horizontal: 'center'
|
|
2753
|
-
},
|
|
2754
|
-
transformOrigin: {
|
|
2755
|
-
vertical: 'top',
|
|
2756
|
-
horizontal: 'center'
|
|
2757
|
-
}
|
|
2758
|
-
};
|
|
2759
|
-
|
|
2760
|
-
default:
|
|
2761
|
-
case 'left':
|
|
2762
|
-
return {
|
|
2763
|
-
anchorOrigin: {
|
|
2764
|
-
vertical: 'center',
|
|
2765
|
-
horizontal: 'left'
|
|
2766
|
-
},
|
|
2767
|
-
transformOrigin: {
|
|
2768
|
-
vertical: 'center',
|
|
2769
|
-
horizontal: 'right'
|
|
2770
|
-
}
|
|
2771
|
-
};
|
|
2772
|
-
|
|
2773
|
-
case 'right':
|
|
2774
|
-
return {
|
|
2775
|
-
anchorOrigin: {
|
|
2776
|
-
vertical: 'center',
|
|
2777
|
-
horizontal: 'right'
|
|
2778
|
-
},
|
|
2779
|
-
transformOrigin: {
|
|
2780
|
-
vertical: 'center',
|
|
2781
|
-
horizontal: 'left'
|
|
2782
|
-
}
|
|
2783
|
-
};
|
|
2784
|
-
}
|
|
2785
|
-
};
|
|
2786
|
-
var ToggleMenu = function ToggleMenu(_ref) {
|
|
2787
|
-
var _ref$buttonTestId = _ref.buttonTestId,
|
|
2788
|
-
buttonTestId = _ref$buttonTestId === void 0 ? 'toggleMenuButton' : _ref$buttonTestId,
|
|
2789
|
-
_ref$menuPosition = _ref.menuPosition,
|
|
2790
|
-
menuPosition = _ref$menuPosition === void 0 ? 'left' : _ref$menuPosition,
|
|
2791
|
-
menuItems = _ref.menuItems,
|
|
2792
|
-
children = _ref.children,
|
|
2793
|
-
buttonSx = _ref.buttonSx,
|
|
2794
|
-
_ref$tooltipTitle = _ref.tooltipTitle,
|
|
2795
|
-
tooltipTitle = _ref$tooltipTitle === void 0 ? '' : _ref$tooltipTitle,
|
|
2796
|
-
_ref$menuTitle = _ref.menuTitle,
|
|
2797
|
-
menuTitle = _ref$menuTitle === void 0 ? '' : _ref$menuTitle,
|
|
2798
|
-
_ref$variant = _ref.variant,
|
|
2799
|
-
variant = _ref$variant === void 0 ? 'tool' : _ref$variant,
|
|
2800
|
-
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
2801
|
-
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen,
|
|
2802
|
-
_ref$buttonIcon = _ref.buttonIcon,
|
|
2803
|
-
buttonIcon = _ref$buttonIcon === void 0 ? /*#__PURE__*/React.createElement(Options, null) : _ref$buttonIcon;
|
|
2804
|
-
|
|
2805
|
-
var _React$useState = React.useState(null),
|
|
2806
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2807
|
-
anchorEl = _React$useState2[0],
|
|
2808
|
-
setAnchorEl = _React$useState2[1];
|
|
2809
|
-
|
|
2810
|
-
var isOpen = Boolean(anchorEl);
|
|
2811
|
-
|
|
2812
|
-
var _getPosition = getPosition(menuPosition),
|
|
2813
|
-
anchorOrigin = _getPosition.anchorOrigin,
|
|
2814
|
-
transformOrigin = _getPosition.transformOrigin;
|
|
2815
|
-
|
|
2816
|
-
var handleClick = function handleClick(event) {
|
|
2817
|
-
event.stopPropagation();
|
|
2818
|
-
setAnchorEl(event.currentTarget);
|
|
2819
|
-
};
|
|
2820
|
-
|
|
2821
|
-
var handleClose = function handleClose(event) {
|
|
2822
|
-
event.stopPropagation();
|
|
2823
|
-
setAnchorEl(null);
|
|
2824
|
-
};
|
|
2825
|
-
|
|
2826
|
-
React.useEffect(function () {
|
|
2827
|
-
if (isDefaultOpen) {
|
|
2828
|
-
setAnchorEl(document.getElementById(buttonTestId));
|
|
2829
|
-
}
|
|
2830
|
-
}, [isDefaultOpen, buttonTestId]);
|
|
2831
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomIconButton, {
|
|
2832
|
-
tooltipProps: {
|
|
2833
|
-
placement: 'top',
|
|
2834
|
-
title: tooltipTitle
|
|
2835
|
-
},
|
|
2836
|
-
isSelected: isOpen,
|
|
2837
|
-
sx: buttonSx,
|
|
2838
|
-
onClick: handleClick,
|
|
2839
|
-
"data-testid": buttonTestId,
|
|
2840
|
-
variant: variant,
|
|
2841
|
-
id: buttonTestId
|
|
2842
|
-
}, buttonIcon), /*#__PURE__*/React.createElement(Menu, {
|
|
2843
|
-
anchorEl: anchorEl,
|
|
2844
|
-
open: isOpen,
|
|
2845
|
-
onClose: function onClose(event, reason) {
|
|
2846
|
-
if (reason === 'tabKeyDown') {
|
|
2847
|
-
return;
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
handleClose(event);
|
|
2851
|
-
},
|
|
2852
|
-
anchorOrigin: anchorOrigin,
|
|
2853
|
-
transformOrigin: transformOrigin,
|
|
2854
|
-
BackdropProps: {
|
|
2855
|
-
style: {
|
|
2856
|
-
opacity: 0,
|
|
2857
|
-
transition: 'none'
|
|
2858
|
-
}
|
|
2859
|
-
},
|
|
2860
|
-
MenuListProps: Object.assign({}, children && {
|
|
2861
|
-
style: {
|
|
2862
|
-
padding: '0px'
|
|
2863
|
-
}
|
|
2864
|
-
})
|
|
2865
|
-
}, menuTitle && /*#__PURE__*/React.createElement(ListSubheader, {
|
|
2866
|
-
"data-testid": "toggleMenuTitle"
|
|
2867
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
2868
|
-
sx: {
|
|
2869
|
-
fontSize: '12px'
|
|
2870
|
-
}
|
|
2871
|
-
}, menuTitle)), menuItems && menuItems.length ? menuItems.map(function (menuItem) {
|
|
2872
|
-
var text = menuItem.text,
|
|
2873
|
-
icon = menuItem.icon,
|
|
2874
|
-
action = menuItem.action;
|
|
2875
|
-
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
2876
|
-
key: text,
|
|
2877
|
-
onClick: function onClick(event) {
|
|
2878
|
-
action(event);
|
|
2879
|
-
handleClose(event);
|
|
2880
|
-
}
|
|
2881
|
-
}, icon && /*#__PURE__*/React.createElement(ListItemIcon, null, icon), /*#__PURE__*/React.createElement(Typography, null, text));
|
|
2882
|
-
}) : /*#__PURE__*/React.createElement("div", null) // Needed to make the menu work without any menuItems
|
|
2883
|
-
, children));
|
|
2884
|
-
};
|
|
2885
|
-
|
|
2886
|
-
/* *
|
|
2887
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2888
|
-
* you may not use this file except in compliance with the License.
|
|
2889
|
-
* You may obtain a copy of the License at
|
|
2890
|
-
*
|
|
2891
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2892
|
-
*
|
|
2893
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2894
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2895
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2896
|
-
* See the License for the specific language governing permissions and
|
|
2897
|
-
* limitations under the License.
|
|
2898
|
-
*
|
|
2899
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2900
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2901
|
-
* */
|
|
2902
|
-
var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
2903
|
-
var hasBackgroundColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2904
|
-
return Object.assign({
|
|
2905
|
-
width: '100%',
|
|
2906
|
-
height: 32,
|
|
2907
|
-
fontWeight: 500,
|
|
2908
|
-
fontSize: function fontSize(theme) {
|
|
2909
|
-
return theme.palette.geowebColors.layerManager.tableRowDefaultText.fontSize;
|
|
2910
|
-
},
|
|
2911
|
-
color: isEnabled ? 'geowebColors.layerManager.tableRowDefaultText.rgba' : 'geowebColors.layerManager.tableRowDisabledText.rgba',
|
|
2912
|
-
'& .MuiOutlinedInput-input': {
|
|
2913
|
-
padding: '6px 24px 6px 8px'
|
|
2914
|
-
},
|
|
2915
|
-
'& .MuiOutlinedInput-notchedOutline': {
|
|
2916
|
-
borderColor: 'transparent!important'
|
|
2917
|
-
},
|
|
2918
|
-
'&:hover': {
|
|
2919
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
|
|
2920
|
-
borderRadius: 0
|
|
2921
|
-
},
|
|
2922
|
-
'&.Mui-focused .MuiSelect-select': {
|
|
2923
|
-
outline: function outline(theme) {
|
|
2924
|
-
return theme.palette.geowebColors.buttons.tool.focus.outline;
|
|
2925
|
-
},
|
|
2926
|
-
borderRadius: 0
|
|
2927
|
-
},
|
|
2928
|
-
'& .MuiSvgIcon-root': {
|
|
2929
|
-
transition: 'none',
|
|
2930
|
-
fill: function fill(theme) {
|
|
2931
|
-
return isEnabled ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color;
|
|
2932
|
-
}
|
|
2933
|
-
},
|
|
2934
|
-
'&>div': {
|
|
2935
|
-
paddingLeft: '8px!important'
|
|
2936
|
-
}
|
|
2937
|
-
}, hasBackgroundColor && backgroundColor);
|
|
2938
|
-
};
|
|
2939
|
-
var backgroundColor = {
|
|
2940
|
-
'&:hover .MuiSelect-select': {
|
|
2941
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
|
|
2942
|
-
borderRadius: 0
|
|
2943
|
-
},
|
|
2944
|
-
'&.Mui-focused .MuiSelect-select': {
|
|
2945
|
-
outline: function outline(theme) {
|
|
2946
|
-
return theme.palette.geowebColors.buttons.tool.focus.outline;
|
|
2947
|
-
},
|
|
2948
|
-
borderRadius: 0,
|
|
2949
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2950
|
-
},
|
|
2951
|
-
'&:hover&.MuiButton-root': {
|
|
2952
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2953
|
-
},
|
|
2954
|
-
'&:focus&.MuiButton-root': {
|
|
2955
|
-
border: function border(theme) {
|
|
2956
|
-
return theme.palette.geowebColors.buttons.tool.focus.outline;
|
|
2957
|
-
},
|
|
2958
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
|
|
2959
|
-
transition: 'border'
|
|
2960
|
-
}
|
|
2961
|
-
};
|
|
2962
|
-
|
|
2963
|
-
var TooltipSelect = function TooltipSelect(_a) {
|
|
2964
|
-
var tooltip = _a.tooltip,
|
|
2965
|
-
_a$list = _a.list,
|
|
2966
|
-
list = _a$list === void 0 ? [] : _a$list,
|
|
2967
|
-
_a$currentIndex = _a.currentIndex,
|
|
2968
|
-
currentIndex = _a$currentIndex === void 0 ? -1 : _a$currentIndex,
|
|
2969
|
-
_a$onChangeMouseWheel = _a.onChangeMouseWheel,
|
|
2970
|
-
onChangeMouseWheel = _a$onChangeMouseWheel === void 0 ? function () {} : _a$onChangeMouseWheel,
|
|
2971
|
-
_a$requiresCtrlToChan = _a.requiresCtrlToChange,
|
|
2972
|
-
requiresCtrlToChange = _a$requiresCtrlToChan === void 0 ? false : _a$requiresCtrlToChan,
|
|
2973
|
-
isEnabled = _a.isEnabled,
|
|
2974
|
-
noStyling = _a.noStyling,
|
|
2975
|
-
hasBackgroundColor = _a.hasBackgroundColor,
|
|
2976
|
-
props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
|
|
2977
|
-
|
|
2978
|
-
var _React$useState = React.useState(false),
|
|
2979
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2980
|
-
selectOpen = _React$useState2[0],
|
|
2981
|
-
setSelectOpen = _React$useState2[1];
|
|
2982
|
-
|
|
2983
|
-
var _useControlledTooltip = useControlledTooltip(),
|
|
2984
|
-
_useControlledTooltip2 = _slicedToArray(_useControlledTooltip, 2),
|
|
2985
|
-
tooltipOpen = _useControlledTooltip2[0],
|
|
2986
|
-
setTooltipOpen = _useControlledTooltip2[1];
|
|
2987
|
-
|
|
2988
|
-
var theme = useTheme();
|
|
2989
|
-
var onWheel = React.useCallback(function (event) {
|
|
2990
|
-
if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
|
|
2991
|
-
if (selectOpen) {
|
|
2992
|
-
return;
|
|
2993
|
-
}
|
|
2994
|
-
|
|
2995
|
-
var direction = event.deltaY < 0 ? 1 : -1;
|
|
2996
|
-
var newIndex = currentIndex - direction;
|
|
2997
|
-
|
|
2998
|
-
if (newIndex < 0 || newIndex >= list.length) {
|
|
2999
|
-
return;
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
onChangeMouseWheel(list[newIndex]);
|
|
3003
|
-
}
|
|
3004
|
-
}, [selectOpen, currentIndex, list, onChangeMouseWheel, requiresCtrlToChange]);
|
|
3005
|
-
var onOpen = React.useCallback(function () {
|
|
3006
|
-
setSelectOpen(true);
|
|
3007
|
-
setTooltipOpen(false);
|
|
3008
|
-
}, [setTooltipOpen]);
|
|
3009
|
-
var onClose = React.useCallback(function () {
|
|
3010
|
-
setSelectOpen(false);
|
|
3011
|
-
}, []);
|
|
3012
|
-
var onMouseEnter = React.useCallback(function () {
|
|
3013
|
-
if (!selectOpen) {
|
|
3014
|
-
setTooltipOpen(true);
|
|
3015
|
-
}
|
|
3016
|
-
}, [selectOpen, setTooltipOpen]);
|
|
3017
|
-
var onMouseLeave = React.useCallback(function () {
|
|
3018
|
-
setTooltipOpen(false);
|
|
3019
|
-
}, [setTooltipOpen]);
|
|
3020
|
-
var onFocus = React.useCallback(function () {
|
|
3021
|
-
setTooltipOpen(true);
|
|
3022
|
-
}, [setTooltipOpen]);
|
|
3023
|
-
var onBlur = React.useCallback(function () {
|
|
3024
|
-
setTooltipOpen(false);
|
|
3025
|
-
}, [setTooltipOpen]);
|
|
3026
|
-
var selectStyles = noStyling ? {} : tooltipContainerStyles(!!isEnabled, hasBackgroundColor);
|
|
3027
|
-
return /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
3028
|
-
title: tooltip,
|
|
3029
|
-
placement: "top",
|
|
3030
|
-
open: tooltipOpen
|
|
3031
|
-
}, /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
3032
|
-
variant: "standard",
|
|
3033
|
-
disableUnderline: true,
|
|
3034
|
-
onOpen: onOpen,
|
|
3035
|
-
onClose: onClose,
|
|
3036
|
-
onMouseEnter: onMouseEnter,
|
|
3037
|
-
onMouseLeave: onMouseLeave,
|
|
3038
|
-
onFocus: onFocus,
|
|
3039
|
-
onBlur: onBlur,
|
|
3040
|
-
onWheel: onWheel,
|
|
3041
|
-
MenuProps: {
|
|
3042
|
-
BackdropProps: {
|
|
3043
|
-
sx: {
|
|
3044
|
-
'&.MuiBackdrop-root': {
|
|
3045
|
-
backgroundColor: 'transparent'
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
},
|
|
3049
|
-
sx: Object.assign({
|
|
3050
|
-
'& ul': {
|
|
3051
|
-
backgroundColor: 'geowebColors.background.surface'
|
|
3052
|
-
},
|
|
3053
|
-
'& li': {
|
|
3054
|
-
fontSize: '16px',
|
|
3055
|
-
padding: '12px',
|
|
3056
|
-
'&:hover': {
|
|
3057
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
3058
|
-
},
|
|
3059
|
-
'&.Mui-selected': {
|
|
3060
|
-
color: 'geowebColors.buttons.tool.active.color',
|
|
3061
|
-
backgroundColor: 'geowebColors.buttons.tool.active.fill',
|
|
3062
|
-
boxShadow: "none",
|
|
3063
|
-
'&:hover': {
|
|
3064
|
-
backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
|
|
3065
|
-
},
|
|
3066
|
-
'&:focus': {
|
|
3067
|
-
backgroundColor: 'geowebColors.buttons.tool.activeMouseOver.fill'
|
|
3068
|
-
},
|
|
3069
|
-
'.MuiListItemIcon-root': {
|
|
3070
|
-
color: 'geowebColors.buttons.tool.active.color'
|
|
3071
|
-
}
|
|
3072
|
-
},
|
|
3073
|
-
'&:after': {
|
|
3074
|
-
background: 'none!important'
|
|
3075
|
-
},
|
|
3076
|
-
'&.Mui-disabled': {
|
|
3077
|
-
fontSize: '12px',
|
|
3078
|
-
opacity: 0.67,
|
|
3079
|
-
padding: '0px 12px',
|
|
3080
|
-
'&.MuiMenuItem-root': {
|
|
3081
|
-
minHeight: '30px!important'
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
}
|
|
3085
|
-
}, theme.palette.geowebColors.tooltips.tooltipSelect.menu)
|
|
3086
|
-
},
|
|
3087
|
-
sx: Object.assign(Object.assign({}, selectStyles), theme.palette.geowebColors.tooltips.tooltipSelect.select)
|
|
3088
|
-
}, props)));
|
|
3089
|
-
};
|
|
3090
|
-
|
|
3091
|
-
function withEggs(eggs) {
|
|
3092
|
-
return function (Component) {
|
|
3093
|
-
var WithEggs = function WithEggs(props) {
|
|
3094
|
-
var store = useStore();
|
|
3095
|
-
|
|
3096
|
-
var _React$useState = React.useState(function () {
|
|
3097
|
-
return store.addEggs(eggs);
|
|
3098
|
-
}),
|
|
3099
|
-
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
3100
|
-
remover = _React$useState2[0];
|
|
3101
|
-
|
|
3102
|
-
React.useEffect(function () {
|
|
3103
|
-
return remover;
|
|
3104
|
-
}, [remover]);
|
|
3105
|
-
return /*#__PURE__*/React.createElement(Component, Object.assign({}, props));
|
|
3106
|
-
};
|
|
3107
|
-
|
|
3108
|
-
WithEggs.displayName = "withEggs(".concat(Component.displayName || Component.name || 'Component', ")");
|
|
3109
|
-
return WithEggs;
|
|
3110
|
-
};
|
|
3111
|
-
}
|
|
3112
|
-
|
|
3113
|
-
var CustomAccordion = function CustomAccordion(_a) {
|
|
3114
|
-
var title = _a.title,
|
|
3115
|
-
_a$defaultExpanded = _a.defaultExpanded,
|
|
3116
|
-
defaultExpanded = _a$defaultExpanded === void 0 ? true : _a$defaultExpanded,
|
|
3117
|
-
_a$disableGutters = _a.disableGutters,
|
|
3118
|
-
disableGutters = _a$disableGutters === void 0 ? true : _a$disableGutters,
|
|
3119
|
-
_a$expandedElevation = _a.expandedElevation,
|
|
3120
|
-
expandedElevation = _a$expandedElevation === void 0 ? 3 : _a$expandedElevation,
|
|
3121
|
-
_a$collapsedElevation = _a.collapsedElevation,
|
|
3122
|
-
collapsedElevation = _a$collapsedElevation === void 0 ? 0 : _a$collapsedElevation,
|
|
3123
|
-
_a$transitionDuration = _a.transitionDuration,
|
|
3124
|
-
transitionDuration = _a$transitionDuration === void 0 ? 150 : _a$transitionDuration,
|
|
3125
|
-
detailsSx = _a.detailsSx,
|
|
3126
|
-
children = _a.children,
|
|
3127
|
-
props = __rest(_a, ["title", "defaultExpanded", "disableGutters", "expandedElevation", "collapsedElevation", "transitionDuration", "detailsSx", "children"]);
|
|
3128
|
-
|
|
3129
|
-
var _React$useState = React.useState(defaultExpanded),
|
|
3130
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3131
|
-
expanded = _React$useState2[0],
|
|
3132
|
-
setExpanded = _React$useState2[1];
|
|
3133
|
-
|
|
3134
|
-
return /*#__PURE__*/React.createElement(Accordion, Object.assign({}, props, {
|
|
3135
|
-
defaultExpanded: defaultExpanded,
|
|
3136
|
-
elevation: expanded ? expandedElevation : collapsedElevation,
|
|
3137
|
-
onChange: function onChange(_event, expanded) {
|
|
3138
|
-
return setExpanded(expanded);
|
|
3139
|
-
},
|
|
3140
|
-
disableGutters: disableGutters,
|
|
3141
|
-
TransitionProps: {
|
|
3142
|
-
timeout: transitionDuration
|
|
3143
|
-
}
|
|
3144
|
-
}), /*#__PURE__*/React.createElement(AccordionSummary, {
|
|
3145
|
-
expandIcon: /*#__PURE__*/React.createElement(ChevronDown, null)
|
|
3146
|
-
}, title), /*#__PURE__*/React.createElement(AccordionDetails, {
|
|
3147
|
-
sx: detailsSx
|
|
3148
|
-
}, children));
|
|
3149
|
-
};
|
|
3150
|
-
|
|
3151
|
-
var highlightStyle = {
|
|
3152
|
-
background: '#ffeecc'
|
|
3153
|
-
};
|
|
3154
|
-
|
|
3155
|
-
var SearchHighlight = function SearchHighlight(_ref) {
|
|
3156
|
-
var _ref$text = _ref.text,
|
|
3157
|
-
text = _ref$text === void 0 ? '' : _ref$text,
|
|
3158
|
-
search = _ref.search;
|
|
3159
|
-
|
|
3160
|
-
if (search === '') {
|
|
3161
|
-
return /*#__PURE__*/React__default.createElement("span", null, text);
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
var searchWords = search.split(' ').reduce(function (words, word) {
|
|
3165
|
-
return word ? [].concat(_toConsumableArray(words), [word.toLocaleLowerCase()]) : words;
|
|
3166
|
-
}, []);
|
|
3167
|
-
var searchRegex = searchWords.map(function (word) {
|
|
3168
|
-
return escapeRegExp(word);
|
|
3169
|
-
}).join('|');
|
|
3170
|
-
var textParts = text.split(new RegExp("(".concat(searchRegex, ")"), 'gi'));
|
|
3171
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, textParts.map(function (part, index) {
|
|
3172
|
-
var key = "".concat(part, "-").concat(index);
|
|
3173
|
-
|
|
3174
|
-
if (searchWords.some(function (search) {
|
|
3175
|
-
return part.toLocaleLowerCase().includes(search);
|
|
3176
|
-
})) {
|
|
3177
|
-
return /*#__PURE__*/React__default.createElement("mark", {
|
|
3178
|
-
key: key,
|
|
3179
|
-
style: highlightStyle
|
|
3180
|
-
}, part);
|
|
3181
|
-
}
|
|
3182
|
-
|
|
3183
|
-
return /*#__PURE__*/React__default.createElement("span", {
|
|
3184
|
-
key: key
|
|
3185
|
-
}, part);
|
|
3186
|
-
}));
|
|
3187
|
-
};
|
|
3188
|
-
|
|
3189
|
-
/* *
|
|
3190
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3191
|
-
* you may not use this file except in compliance with the License.
|
|
3192
|
-
* You may obtain a copy of the License at
|
|
3193
|
-
*
|
|
3194
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3195
|
-
*
|
|
3196
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3197
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3198
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3199
|
-
* See the License for the specific language governing permissions and
|
|
3200
|
-
* limitations under the License.
|
|
3201
|
-
*
|
|
3202
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3203
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3204
|
-
* */
|
|
3205
|
-
var DEFAULT_ERROR_MESSAGE = 'An error has occurred'; // Guard function for detecting an AxiosError (typically the kind of error returned by the backend)
|
|
3206
|
-
|
|
3207
|
-
var isAxiosError = function isAxiosError(error) {
|
|
3208
|
-
return error.isAxiosError !== undefined;
|
|
3209
|
-
};
|
|
3210
|
-
var getAxiosErrorMessage = function getAxiosErrorMessage(error) {
|
|
3211
|
-
var data = error.response && error.response.data;
|
|
3212
|
-
|
|
3213
|
-
if (data && typeof data === 'string') {
|
|
3214
|
-
return data;
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
if (data && data.message && typeof data.message === 'string') {
|
|
3218
|
-
return data.message;
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
if (error.message) {
|
|
3222
|
-
return error.message;
|
|
3223
|
-
}
|
|
3224
|
-
|
|
3225
|
-
return DEFAULT_ERROR_MESSAGE;
|
|
3226
|
-
};
|
|
3227
|
-
var getErrorMessage = function getErrorMessage(error) {
|
|
3228
|
-
if (isAxiosError(error)) {
|
|
3229
|
-
return getAxiosErrorMessage(error);
|
|
3230
|
-
}
|
|
3231
|
-
|
|
3232
|
-
return error.message || DEFAULT_ERROR_MESSAGE;
|
|
3233
|
-
};
|
|
3234
|
-
var getAxiosWarningMessage = function getAxiosWarningMessage(error) {
|
|
3235
|
-
var data = error.response && error.response.data;
|
|
3236
|
-
|
|
3237
|
-
if (data && data.WarningMessage && typeof data.WarningMessage === 'string') {
|
|
3238
|
-
return data.WarningMessage;
|
|
3239
|
-
}
|
|
3240
|
-
|
|
3241
|
-
return '';
|
|
3242
|
-
};
|
|
3243
|
-
var getWarningMessage = function getWarningMessage(error) {
|
|
3244
|
-
if (isAxiosError(error)) {
|
|
3245
|
-
return getAxiosWarningMessage(error);
|
|
3246
|
-
}
|
|
3247
|
-
|
|
3248
|
-
return '';
|
|
3249
|
-
};
|
|
3250
|
-
|
|
3251
|
-
/* *
|
|
3252
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3253
|
-
* you may not use this file except in compliance with the License.
|
|
3254
|
-
* You may obtain a copy of the License at
|
|
3255
|
-
*
|
|
3256
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3257
|
-
*
|
|
3258
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3259
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3260
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3261
|
-
* See the License for the specific language governing permissions and
|
|
3262
|
-
* limitations under the License.
|
|
3263
|
-
*
|
|
3264
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3265
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3266
|
-
* */
|
|
3267
|
-
/**
|
|
3268
|
-
* Parsing date strings with geoweb dateUtils:
|
|
3269
|
-
*
|
|
3270
|
-
* An ISO String *with timezone* can safely be parsed directly to a date:
|
|
3271
|
-
*
|
|
3272
|
-
* date = new Date('2022-10-10T15:30:00Z')
|
|
3273
|
-
* date = new Date('2022-10-10T15:30:00+00:00')
|
|
3274
|
-
* date = new Date('2022-10-10T15:30:00+02:00')
|
|
3275
|
-
*
|
|
3276
|
-
* or using the dateUtils isoStringToDate function *with utc=false*
|
|
3277
|
-
*
|
|
3278
|
-
* date = isoStringToDate('2022-10-10T15:30:00Z', false)
|
|
3279
|
-
*
|
|
3280
|
-
* An ISO String *without a timezone* can be parsed with isoStringToDate
|
|
3281
|
-
*
|
|
3282
|
-
* date = isoStringToDate('2022-10-10T15:30:00')
|
|
3283
|
-
*
|
|
3284
|
-
* *Do not parse ISO without timezone using `new Date()` unless you correct for the local timezone*
|
|
3285
|
-
*
|
|
3286
|
-
* To parse an arbitrary date string with timezone use:
|
|
3287
|
-
*
|
|
3288
|
-
* date = stringToDate('2022.11.10, 11:15 +01:00', 'yyyy.MM.dd, HH:mm xxx', false)
|
|
3289
|
-
*
|
|
3290
|
-
* To parse an arbitrary date string without timezone use:
|
|
3291
|
-
*
|
|
3292
|
-
* date = stringToDate('2022.11.10, 11:15', 'yyyy.MM.dd, HH:mm')
|
|
3293
|
-
*
|
|
3294
|
-
*
|
|
3295
|
-
* To safely convert dates to utc strings use:
|
|
3296
|
-
*
|
|
3297
|
-
* date.toISOString()
|
|
3298
|
-
*
|
|
3299
|
-
* To get parts of UTC time use
|
|
3300
|
-
*
|
|
3301
|
-
* date.getUTCHours()
|
|
3302
|
-
* date.getUTCMins()
|
|
3303
|
-
*
|
|
3304
|
-
* To parse an arbitrary date string to a UTC string use:
|
|
3305
|
-
*
|
|
3306
|
-
* dateToString(new Date('2022-10-10T15:30:00Z', 'HH:ss dd MMM yyyy')
|
|
3307
|
-
*
|
|
3308
|
-
*/
|
|
3309
|
-
|
|
3310
|
-
/**
|
|
3311
|
-
* Parse an ISO string to a date
|
|
3312
|
-
*
|
|
3313
|
-
* Expects the following props:
|
|
3314
|
-
* @param {string} input - string containing date
|
|
3315
|
-
*
|
|
3316
|
-
* @returns {Date} Date
|
|
3317
|
-
* @example
|
|
3318
|
-
* ``` isoStringToDate("2022-5-10T20:32:00+00:00")) ```
|
|
3319
|
-
*/
|
|
3320
|
-
|
|
3321
|
-
var isoStringToDate = function isoStringToDate(input) {
|
|
3322
|
-
var utc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
3323
|
-
var parsed = parseISO(input);
|
|
3324
|
-
|
|
3325
|
-
if (utc) {
|
|
3326
|
-
return setUTCDate(parsed);
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
return parsed;
|
|
3330
|
-
};
|
|
3331
|
-
/**
|
|
3332
|
-
* Parse a string to a date
|
|
3333
|
-
*
|
|
3334
|
-
* ***NOTE: String will be parsed in local time if utc is set to false***
|
|
3335
|
-
*
|
|
3336
|
-
* Expects the following props:
|
|
3337
|
-
* @param {string} input - string containing date
|
|
3338
|
-
* @param {string} strFormat - format of the string, see: https://date-fns.org/v2.29.3/docs/parse
|
|
3339
|
-
* @param {boolean} utc [ default = true ] - boolean indicating whether to parse as UTC
|
|
3340
|
-
* @param {Date} referenceDate [ default = new Date() ] - defines values missing from the parsed dateString
|
|
3341
|
-
*
|
|
3342
|
-
* @returns {Date} Date
|
|
3343
|
-
* @example
|
|
3344
|
-
* ``` stringToDate("2022 5 10 20:32", 'yyyy M d HH:mm')) ```
|
|
3345
|
-
*/
|
|
3346
|
-
|
|
3347
|
-
var stringToDate = function stringToDate(input, strFormat) {
|
|
3348
|
-
var utc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
3349
|
-
var referenceDate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Date();
|
|
3350
|
-
var parsed = parse(input, strFormat, referenceDate);
|
|
3351
|
-
|
|
3352
|
-
if (utc) {
|
|
3353
|
-
return setUTCDate(parsed);
|
|
3354
|
-
}
|
|
3355
|
-
|
|
3356
|
-
return parsed;
|
|
3357
|
-
};
|
|
3358
|
-
/**
|
|
3359
|
-
* Use this if you initialise a date without a timezone to set it to utc correctly
|
|
3360
|
-
* eg.
|
|
3361
|
-
* new Date(2022, 10, 12, 15, 30)
|
|
3362
|
-
* should be:
|
|
3363
|
-
* setUTCDate(new Date(2022, 10, 12, 15, 30))
|
|
3364
|
-
*
|
|
3365
|
-
* Expects the following props:
|
|
3366
|
-
* @param {Date} inDate - date to be set to UTC
|
|
3367
|
-
*
|
|
3368
|
-
* @returns {Date} - Date in UTC
|
|
3369
|
-
* @example
|
|
3370
|
-
* ``` setUTCDate(new Date(2022, 10, 12, 15, 30)) ```
|
|
3371
|
-
*/
|
|
3372
|
-
|
|
3373
|
-
var setUTCDate = function setUTCDate(inDate) {
|
|
3374
|
-
var utcDate = new Date(inDate);
|
|
3375
|
-
utcDate.setUTCFullYear(inDate.getFullYear(), inDate.getMonth(), inDate.getDate());
|
|
3376
|
-
utcDate.setUTCHours(inDate.getHours(), inDate.getMinutes(), inDate.getSeconds(), inDate.getMilliseconds());
|
|
3377
|
-
return utcDate;
|
|
3378
|
-
};
|
|
3379
|
-
/**
|
|
3380
|
-
* Format a date to a string
|
|
3381
|
-
*
|
|
3382
|
-
* Expects the following props:
|
|
3383
|
-
* @param {Date} inDate - date to be formatted
|
|
3384
|
-
* @param {string} strFormat - format of string
|
|
3385
|
-
* @param {boolean} utc - [default: true] true to return in utc otherwise return in local timezone
|
|
3386
|
-
*
|
|
3387
|
-
* @returns {string} - formatted date string
|
|
3388
|
-
* @example
|
|
3389
|
-
* ``` dateToString(new Date(2022, 10, 12, 15, 30), 'dd MMM yyyy') ```
|
|
3390
|
-
*/
|
|
3391
|
-
|
|
3392
|
-
var dateToString = function dateToString(inDate, strFormat) {
|
|
3393
|
-
var utc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
3394
|
-
|
|
3395
|
-
if (utc) {
|
|
3396
|
-
return format(new Date(inDate.getUTCFullYear(), inDate.getUTCMonth(), inDate.getUTCDate(), inDate.getUTCHours(), inDate.getUTCMinutes(), inDate.getUTCSeconds()), strFormat);
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3399
|
-
return format(inDate, strFormat);
|
|
3400
|
-
};
|
|
3401
|
-
/**
|
|
3402
|
-
* Find out if a date is between two other dates.
|
|
3403
|
-
*
|
|
3404
|
-
* Inclusivity parameter matches that used in momentjs where '[' indicates inclusion and '(' indicates exclusion.
|
|
3405
|
-
*
|
|
3406
|
-
* Expects the following props:
|
|
3407
|
-
* @param {Date} date - date to be tested
|
|
3408
|
-
* @param {Date} from - first date
|
|
3409
|
-
* @param {Date} to - last date
|
|
3410
|
-
* @param {string} inclusivity - [default: '()'] Must be one of : '()', '[]', '(]', '[)'
|
|
3411
|
-
*
|
|
3412
|
-
* @returns {boolen} - true if date is between, otherwise false
|
|
3413
|
-
*
|
|
3414
|
-
*/
|
|
3415
|
-
|
|
3416
|
-
var isBetween = function isBetween(date, from, to) {
|
|
3417
|
-
var inclusivity = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '()';
|
|
3418
|
-
|
|
3419
|
-
if (!['()', '[]', '(]', '[)'].includes(inclusivity)) {
|
|
3420
|
-
throw new Error('Inclusivity parameter must be one of (), [], (], [)');
|
|
3421
|
-
}
|
|
3422
|
-
|
|
3423
|
-
var isBeforeEqual = inclusivity[0] === '[';
|
|
3424
|
-
var isAfterEqual = inclusivity[1] === ']';
|
|
3425
|
-
return (isBeforeEqual ? isEqual(from, date) || isBefore(from, date) : isBefore(from, date)) && (isAfterEqual ? isEqual(to, date) || isAfter(to, date) : isAfter(to, date));
|
|
3426
|
-
};
|
|
3427
|
-
/**
|
|
3428
|
-
* Creates a new Date object with the specified date and time, or the current date and time if no arguments are provided.
|
|
3429
|
-
*
|
|
3430
|
-
* @param yearOrIsoString The year for the new Date object, or an ISO-formatted string representing the date and time.
|
|
3431
|
-
* @param month The month for the new Date object (0-11).
|
|
3432
|
-
* @param day The day for the new Date object (1-31).
|
|
3433
|
-
* @param hours The hour for the new Date object (0-23).
|
|
3434
|
-
* @param minutes The minute for the new Date object (0-59).
|
|
3435
|
-
* @param seconds The second for the new Date object (0-59).
|
|
3436
|
-
* @param milliseconds The millisecond for the new Date object (0-999).
|
|
3437
|
-
* @returns A new Date object with the specified date and time, or the current date and time if no arguments are provided.
|
|
3438
|
-
*
|
|
3439
|
-
* @example
|
|
3440
|
-
* createDate(2022, 11, 13);
|
|
3441
|
-
* // => 2022-12-13T00:00:00.000Z
|
|
3442
|
-
*
|
|
3443
|
-
* @example
|
|
3444
|
-
* createDate('2022-12-13T00:00:00.000Z');
|
|
3445
|
-
* // => 2022-12-13T00:00:00.000Z
|
|
3446
|
-
*/
|
|
3447
|
-
|
|
3448
|
-
var createDate = function createDate(yearOrIsoString, month, day) {
|
|
3449
|
-
var hours = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3450
|
-
var minutes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
3451
|
-
var seconds = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
|
|
3452
|
-
var milliseconds = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
|
|
3453
|
-
|
|
3454
|
-
if (yearOrIsoString === undefined) {
|
|
3455
|
-
return new Date();
|
|
3456
|
-
}
|
|
3457
|
-
|
|
3458
|
-
if (typeof yearOrIsoString === 'string') {
|
|
3459
|
-
return new Date(yearOrIsoString);
|
|
3460
|
-
}
|
|
3461
|
-
|
|
3462
|
-
return new Date(yearOrIsoString, month, day, hours, minutes, seconds, milliseconds);
|
|
3463
|
-
};
|
|
3464
|
-
/**
|
|
3465
|
-
*
|
|
3466
|
-
* @param date
|
|
3467
|
-
* @param duration
|
|
3468
|
-
* @returns {Date} the new Date
|
|
3469
|
-
*/
|
|
3470
|
-
|
|
3471
|
-
var add = function add(date, duration) {
|
|
3472
|
-
return add$1(date, duration);
|
|
3473
|
-
};
|
|
3474
|
-
/**
|
|
3475
|
-
*
|
|
3476
|
-
* @param date
|
|
3477
|
-
* @param duration
|
|
3478
|
-
* @returns {Date} the new Date
|
|
3479
|
-
*/
|
|
3480
|
-
|
|
3481
|
-
var sub = function sub(date, duration) {
|
|
3482
|
-
return sub$1(date, duration);
|
|
3483
|
-
};
|
|
3484
|
-
/**
|
|
3485
|
-
* Finds the number of minuts between to dates
|
|
3486
|
-
*
|
|
3487
|
-
* @param dateLeft - the later date
|
|
3488
|
-
* @param dateRight - the earlier date
|
|
3489
|
-
* @returns {number} the number of minutes
|
|
3490
|
-
*/
|
|
3491
|
-
|
|
3492
|
-
var differenceInMinutes = function differenceInMinutes(dateLeft, dateRight) {
|
|
3493
|
-
return differenceInMinutes$1(dateLeft, dateRight);
|
|
3494
|
-
};
|
|
3495
|
-
/**
|
|
3496
|
-
* Finds the number of hours between to dates
|
|
3497
|
-
*
|
|
3498
|
-
* @param dateLeft - the later date
|
|
3499
|
-
* @param dateRight - the earlier date
|
|
3500
|
-
* @returns {number} the number of hours
|
|
3501
|
-
*/
|
|
3502
|
-
|
|
3503
|
-
var differenceInHours = function differenceInHours(dateLeft, dateRight) {
|
|
3504
|
-
return differenceInHours$1(dateLeft, dateRight);
|
|
3505
|
-
};
|
|
3506
|
-
|
|
3507
|
-
/* *
|
|
3508
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3509
|
-
* you may not use this file except in compliance with the License.
|
|
3510
|
-
* You may obtain a copy of the License at
|
|
3511
|
-
*
|
|
3512
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3513
|
-
*
|
|
3514
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3515
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3516
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3517
|
-
* See the License for the specific language governing permissions and
|
|
3518
|
-
* limitations under the License.
|
|
3519
|
-
*
|
|
3520
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3521
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3522
|
-
* */
|
|
3523
|
-
|
|
3524
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
3525
|
-
__proto__: null,
|
|
3526
|
-
isoStringToDate: isoStringToDate,
|
|
3527
|
-
stringToDate: stringToDate,
|
|
3528
|
-
setUTCDate: setUTCDate,
|
|
3529
|
-
dateToString: dateToString,
|
|
3530
|
-
isBetween: isBetween,
|
|
3531
|
-
createDate: createDate,
|
|
3532
|
-
add: add,
|
|
3533
|
-
sub: sub,
|
|
3534
|
-
differenceInMinutes: differenceInMinutes,
|
|
3535
|
-
differenceInHours: differenceInHours
|
|
3536
|
-
});
|
|
3537
|
-
|
|
3538
|
-
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, ErrorBoundary, ResizeComponent as Resizable, SearchHighlight, StatusTag, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
|