@opengeoweb/shared 4.3.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +403 -136
- package/index.umd.js +414 -148
- package/lib/components/CustomAccordion/CustomAccordion.d.ts +10 -0
- package/lib/components/CustomAccordion/CustomAccordion.spec.d.ts +1 -0
- package/lib/components/CustomAccordion/CustomAccordion.stories.d.ts +13 -0
- package/lib/components/CustomAccordion/index.d.ts +1 -0
- package/lib/components/CustomTooltip/CustomTooltip.d.ts +8 -0
- package/lib/components/CustomTooltip/CustomTooltip.spec.d.ts +1 -0
- package/lib/components/CustomTooltip/index.d.ts +1 -0
- package/lib/components/DraggableResizable/Draggable.d.ts +3 -3
- package/lib/components/DraggableResizable/Resizable.d.ts +1 -0
- package/lib/components/DraggableResizable/types.d.ts +1 -3
- package/lib/components/EnableButton/EnableButton.d.ts +2 -0
- package/lib/components/ManagerButton/ManagerButton.d.ts +1 -0
- package/lib/components/StatusTag/StatusTag.stories.d.ts +21 -1
- package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +9 -2
- package/lib/components/ToolContainer/types.d.ts +2 -1
- package/lib/components/WithEggs/WithEggs.d.ts +3 -0
- package/lib/components/WithEggs/WithEggs.spec.d.ts +1 -0
- package/lib/components/WithEggs/index.d.ts +1 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useMakeSureContainerStaysInsideWindow/useMakeSureContainerStaysInsideWindow.d.ts +4 -0
- package/lib/hooks/useMakeSureContainerStaysInsideWindow/useMakeSureContainerStaysInsideWindow.spec.d.ts +1 -0
- package/lib/utils/containerQueryHelper.d.ts +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/package.json +6 -4
package/index.esm.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useRef } from 'react';
|
|
3
|
-
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select } from '@mui/material';
|
|
4
|
-
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, Delete, VisibilityOff, Visibility } from '@opengeoweb/theme';
|
|
3
|
+
import { Box, Typography, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, CircularProgress, Alert, AlertTitle, Grid, useTheme, Link, Avatar as Avatar$1, Paper, ClickAwayListener, MenuList, MenuItem, RadioGroup, FormControlLabel, Radio, Tooltip, List, ListItem, Tabs, Tab, Backdrop, Slider, ToggleButton, Menu, ListItemIcon, Checkbox, Select, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
|
|
4
|
+
import { Close, Exclamation, Success, Info, ChevronRight, GeoWebLogo, Resize, useThemeContext, DragHandle, ArrowLeft, ArrowRight, KeyOption, ArrowUp, ArrowDown, KeyCommand, Options, Delete, VisibilityOff, Visibility, ChevronDown } from '@opengeoweb/theme';
|
|
5
5
|
import { useFormContext } from 'react-hook-form';
|
|
6
6
|
import { isEmpty, errorMessages } from '@opengeoweb/form-fields';
|
|
7
|
+
import { throttle } from 'lodash';
|
|
7
8
|
import Draggable from 'react-draggable';
|
|
8
9
|
import { Resizable } from 're-resizable';
|
|
9
|
-
import {
|
|
10
|
+
import { useStore } from 'react-redux';
|
|
10
11
|
|
|
11
12
|
/*! *****************************************************************************
|
|
12
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -36,35 +37,37 @@ function __rest(s, e) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
var bgColors = {
|
|
39
|
-
green: '
|
|
40
|
-
grey: '
|
|
41
|
-
purple: '
|
|
42
|
-
red: '
|
|
43
|
-
yellow: '
|
|
40
|
+
green: 'geowebColors.functional.successOutline.fill',
|
|
41
|
+
grey: 'geowebColors.functional.disabledOutline.fill',
|
|
42
|
+
purple: 'geowebColors.functional.summaryOutline.fill',
|
|
43
|
+
red: 'geowebColors.functional.errorOutline.fill',
|
|
44
|
+
yellow: 'geowebColors.functional.warningOutline.fill',
|
|
45
|
+
blue: 'geowebColors.functional.notificationOutline.fill'
|
|
44
46
|
};
|
|
45
47
|
var borderColors = {
|
|
46
|
-
green: '
|
|
47
|
-
grey: '
|
|
48
|
-
purple: '
|
|
49
|
-
red: '
|
|
50
|
-
yellow: '
|
|
48
|
+
green: 'geowebColors.functional.successOutline.borderColor',
|
|
49
|
+
grey: 'geowebColors.functional.disabledOutline.borderColor',
|
|
50
|
+
purple: 'geowebColors.functional.summaryOutline.borderColor',
|
|
51
|
+
red: 'geowebColors.functional.errorOutline.borderColor',
|
|
52
|
+
yellow: 'geowebColors.functional.warningOutline.borderColor',
|
|
53
|
+
blue: 'geowebColors.functional.notificationOutline.borderColor'
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
var tagStyle = function tagStyle(color) {
|
|
54
57
|
// Set color to grey for summary
|
|
55
|
-
var
|
|
58
|
+
var backgroundColor = bgColors[color];
|
|
56
59
|
var borderColor = borderColors[color];
|
|
57
60
|
return {
|
|
58
|
-
backgroundColor:
|
|
61
|
+
backgroundColor: backgroundColor,
|
|
59
62
|
m: 0,
|
|
60
|
-
p: 0
|
|
61
|
-
border:
|
|
63
|
+
p: 0,
|
|
64
|
+
border: '1px solid',
|
|
65
|
+
borderColor: borderColor,
|
|
62
66
|
borderRadius: '4px',
|
|
63
|
-
width: '
|
|
64
|
-
height: '
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
boxSizing: 'content-box'
|
|
67
|
+
width: '120px',
|
|
68
|
+
height: '18px',
|
|
69
|
+
lineHeight: '16px',
|
|
70
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
68
71
|
};
|
|
69
72
|
};
|
|
70
73
|
|
|
@@ -611,6 +614,69 @@ var useDraftFormHelpers = function useDraftFormHelpers() {
|
|
|
611
614
|
};
|
|
612
615
|
};
|
|
613
616
|
|
|
617
|
+
/* *
|
|
618
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
619
|
+
* you may not use this file except in compliance with the License.
|
|
620
|
+
* You may obtain a copy of the License at
|
|
621
|
+
*
|
|
622
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
623
|
+
*
|
|
624
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
625
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
626
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
627
|
+
* See the License for the specific language governing permissions and
|
|
628
|
+
* limitations under the License.
|
|
629
|
+
*
|
|
630
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
631
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
632
|
+
* */
|
|
633
|
+
var adjustPosition = function adjustPosition(bbox, containingView, position, setPosition) {
|
|
634
|
+
var isHorizontallyLarger = bbox.width > containingView.width;
|
|
635
|
+
var isVerticallyLarger = bbox.height > containingView.height; // left screen
|
|
636
|
+
|
|
637
|
+
if (bbox.x < containingView.x || isHorizontallyLarger) {
|
|
638
|
+
var diffX = containingView.x - bbox.x;
|
|
639
|
+
setPosition(Object.assign(Object.assign({}, position), {
|
|
640
|
+
x: position.x + diffX
|
|
641
|
+
}));
|
|
642
|
+
} // right screen
|
|
643
|
+
else if (bbox.right >= containingView.right) {
|
|
644
|
+
var _diffX = containingView.right - bbox.right;
|
|
645
|
+
|
|
646
|
+
setPosition(Object.assign(Object.assign({}, position), {
|
|
647
|
+
x: position.x + _diffX
|
|
648
|
+
}));
|
|
649
|
+
} // top screen
|
|
650
|
+
else if (bbox.y < containingView.y || isVerticallyLarger) {
|
|
651
|
+
var diffY = containingView.y - bbox.y;
|
|
652
|
+
setPosition(Object.assign(Object.assign({}, position), {
|
|
653
|
+
y: position.y + diffY
|
|
654
|
+
}));
|
|
655
|
+
} // bottom screen
|
|
656
|
+
else if (bbox.bottom >= containingView.bottom) {
|
|
657
|
+
var _diffY = containingView.bottom - bbox.bottom;
|
|
658
|
+
|
|
659
|
+
setPosition(Object.assign(Object.assign({}, position), {
|
|
660
|
+
y: position.y + _diffY
|
|
661
|
+
}));
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
|
|
665
|
+
var onResizeWindow = React__default.useCallback(function () {
|
|
666
|
+
if (!nodeRef.current) return;
|
|
667
|
+
var bbox = nodeRef.current.firstChild.getBoundingClientRect();
|
|
668
|
+
var containingView = nodeRef.current.parentElement.getBoundingClientRect();
|
|
669
|
+
adjustPosition(bbox, containingView, position, setPosition);
|
|
670
|
+
}, [nodeRef, position, setPosition]);
|
|
671
|
+
React__default.useEffect(function () {
|
|
672
|
+
var throttledResize = throttle(onResizeWindow, 100);
|
|
673
|
+
window.addEventListener('resize', throttledResize);
|
|
674
|
+
return function () {
|
|
675
|
+
window.removeEventListener('resize', throttledResize);
|
|
676
|
+
};
|
|
677
|
+
}, [onResizeWindow]);
|
|
678
|
+
};
|
|
679
|
+
|
|
614
680
|
var ConfirmationServiceContext = /*#__PURE__*/React.createContext(Promise.reject);
|
|
615
681
|
var useConfirmationDialog = function useConfirmationDialog() {
|
|
616
682
|
return React.useContext(ConfirmationServiceContext);
|
|
@@ -1003,29 +1069,26 @@ var DraggableComponent$1 = function DraggableComponent(_a) {
|
|
|
1003
1069
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1004
1070
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
1005
1071
|
* */
|
|
1072
|
+
var isDraggingClassName = 'is-dragging';
|
|
1006
1073
|
|
|
1007
1074
|
var ResizeComponent = function ResizeComponent(_a) {
|
|
1008
|
-
var
|
|
1009
|
-
startPosition = _a$startPosition === void 0 ? {
|
|
1010
|
-
left: undefined,
|
|
1011
|
-
right: undefined,
|
|
1012
|
-
top: undefined
|
|
1013
|
-
} : _a$startPosition,
|
|
1014
|
-
children = _a.children,
|
|
1075
|
+
var children = _a.children,
|
|
1015
1076
|
_a$onResizeStart = _a.onResizeStart,
|
|
1016
1077
|
onResizeStart = _a$onResizeStart === void 0 ? function () {} : _a$onResizeStart,
|
|
1078
|
+
_a$onResizeStop = _a.onResizeStop,
|
|
1079
|
+
onResizeStop = _a$onResizeStop === void 0 ? function () {} : _a$onResizeStop,
|
|
1017
1080
|
size = _a.size,
|
|
1018
1081
|
setSize = _a.setSize,
|
|
1019
1082
|
_a$minHeight = _a.minHeight,
|
|
1020
1083
|
minHeight = _a$minHeight === void 0 ? 50 : _a$minHeight,
|
|
1021
1084
|
_a$minWidth = _a.minWidth,
|
|
1022
1085
|
minWidth = _a$minWidth === void 0 ? 50 : _a$minWidth,
|
|
1023
|
-
props = __rest(_a, ["
|
|
1086
|
+
props = __rest(_a, ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth"]);
|
|
1024
1087
|
|
|
1025
1088
|
var theme = useTheme();
|
|
1026
|
-
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
1027
1089
|
var onStartResize = React__default.useCallback(function (event, _direction, node) {
|
|
1028
1090
|
event.stopPropagation();
|
|
1091
|
+
node.classList.add(isDraggingClassName);
|
|
1029
1092
|
|
|
1030
1093
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1031
1094
|
width = _node$getBoundingClie.width,
|
|
@@ -1040,32 +1103,42 @@ var ResizeComponent = function ResizeComponent(_a) {
|
|
|
1040
1103
|
node.style.height = "".concat(height, "px");
|
|
1041
1104
|
onResizeStart();
|
|
1042
1105
|
}, [onResizeStart, setSize]);
|
|
1043
|
-
var
|
|
1106
|
+
var onStopResize = React__default.useCallback(function (event, direction, node, delta) {
|
|
1107
|
+
node.classList.remove(isDraggingClassName);
|
|
1044
1108
|
var width = parseInt(size.width, 10) + delta.width;
|
|
1045
1109
|
var height = parseInt(size.height, 10) + delta.height;
|
|
1046
1110
|
setSize({
|
|
1047
1111
|
width: width,
|
|
1048
1112
|
height: height
|
|
1049
1113
|
});
|
|
1050
|
-
|
|
1114
|
+
onResizeStop(event, direction, node, delta);
|
|
1115
|
+
}, [setSize, onResizeStop, size]);
|
|
1051
1116
|
return /*#__PURE__*/React__default.createElement(Resizable // TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
1052
1117
|
, Object.assign({
|
|
1053
1118
|
// TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
1054
1119
|
minHeight: minHeight,
|
|
1055
1120
|
minWidth: minWidth,
|
|
1056
1121
|
size: size,
|
|
1057
|
-
onResizeStop:
|
|
1122
|
+
onResizeStop: onStopResize,
|
|
1058
1123
|
handleComponent: {
|
|
1059
1124
|
bottomRight: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1060
1125
|
style: {
|
|
1061
1126
|
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1062
|
-
}
|
|
1127
|
+
},
|
|
1128
|
+
sx: {
|
|
1129
|
+
display: 'none'
|
|
1130
|
+
},
|
|
1131
|
+
className: "resizableHandle"
|
|
1063
1132
|
}),
|
|
1064
1133
|
bottomLeft: /*#__PURE__*/React__default.createElement(Resize, {
|
|
1065
1134
|
isRightAligned: true,
|
|
1066
1135
|
style: {
|
|
1067
1136
|
fill: "".concat(theme.palette.geowebColors.buttons.flat["default"].color)
|
|
1068
|
-
}
|
|
1137
|
+
},
|
|
1138
|
+
sx: {
|
|
1139
|
+
display: 'none'
|
|
1140
|
+
},
|
|
1141
|
+
className: "resizableHandle"
|
|
1069
1142
|
})
|
|
1070
1143
|
},
|
|
1071
1144
|
enable: {
|
|
@@ -1074,8 +1147,8 @@ var ResizeComponent = function ResizeComponent(_a) {
|
|
|
1074
1147
|
bottom: false,
|
|
1075
1148
|
left: false,
|
|
1076
1149
|
topRight: false,
|
|
1077
|
-
bottomRight:
|
|
1078
|
-
bottomLeft:
|
|
1150
|
+
bottomRight: true,
|
|
1151
|
+
bottomLeft: true,
|
|
1079
1152
|
topLeft: false
|
|
1080
1153
|
},
|
|
1081
1154
|
onResizeStart: onStartResize
|
|
@@ -1350,6 +1423,41 @@ var ToolFooter = function ToolFooter() {
|
|
|
1350
1423
|
});
|
|
1351
1424
|
};
|
|
1352
1425
|
|
|
1426
|
+
var defaultDelay = 1000;
|
|
1427
|
+
var useControlledTooltip = function useControlledTooltip() {
|
|
1428
|
+
var _React$useState = React.useState(false),
|
|
1429
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1430
|
+
tooltipOpen = _React$useState2[0],
|
|
1431
|
+
setTooltipOpen = _React$useState2[1];
|
|
1432
|
+
|
|
1433
|
+
var _React$useState3 = React.useState(false),
|
|
1434
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
1435
|
+
delayedTooltip = _React$useState4[0],
|
|
1436
|
+
setDelayedTooltip = _React$useState4[1];
|
|
1437
|
+
|
|
1438
|
+
React.useEffect(function () {
|
|
1439
|
+
if (tooltipOpen === true) {
|
|
1440
|
+
var timer = setTimeout(function () {
|
|
1441
|
+
return setDelayedTooltip(true);
|
|
1442
|
+
}, defaultDelay);
|
|
1443
|
+
return function () {
|
|
1444
|
+
clearTimeout(timer);
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
setDelayedTooltip(false);
|
|
1449
|
+
return function () {};
|
|
1450
|
+
}, [tooltipOpen]);
|
|
1451
|
+
return [delayedTooltip, setTooltipOpen];
|
|
1452
|
+
};
|
|
1453
|
+
var CustomTooltip = function CustomTooltip(props) {
|
|
1454
|
+
return /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, props, {
|
|
1455
|
+
enterDelay: defaultDelay,
|
|
1456
|
+
enterNextDelay: defaultDelay,
|
|
1457
|
+
disableInteractive: true
|
|
1458
|
+
}));
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1353
1461
|
/* *
|
|
1354
1462
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1355
1463
|
* you may not use this file except in compliance with the License.
|
|
@@ -1391,7 +1499,8 @@ var getStyle = function getStyle(size) {
|
|
|
1391
1499
|
return {
|
|
1392
1500
|
fontSize: 20,
|
|
1393
1501
|
fontWeight: 400,
|
|
1394
|
-
padding: '8px'
|
|
1502
|
+
padding: '4px 8px',
|
|
1503
|
+
height: 40
|
|
1395
1504
|
};
|
|
1396
1505
|
}
|
|
1397
1506
|
|
|
@@ -1428,31 +1537,37 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1428
1537
|
isDraggable = _ref$isDraggable === void 0 ? false : _ref$isDraggable,
|
|
1429
1538
|
_ref$className = _ref.className,
|
|
1430
1539
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
1431
|
-
_ref$
|
|
1432
|
-
|
|
1540
|
+
_ref$leftHeaderCompon = _ref.leftHeaderComponent,
|
|
1541
|
+
leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? null : _ref$leftHeaderCompon,
|
|
1542
|
+
_ref$rightHeaderCompo = _ref.rightHeaderComponent,
|
|
1543
|
+
rightHeaderComponent = _ref$rightHeaderCompo === void 0 ? null : _ref$rightHeaderCompo;
|
|
1433
1544
|
var styles = getStyle(size);
|
|
1434
|
-
var columnSizeIcon =
|
|
1435
|
-
var columnSizeTitle =
|
|
1545
|
+
var columnSizeIcon = leftHeaderComponent || rightHeaderComponent ? 4 : 1;
|
|
1546
|
+
var columnSizeTitle = leftHeaderComponent || rightHeaderComponent ? 4 : 10;
|
|
1436
1547
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
1437
1548
|
component: "header",
|
|
1438
1549
|
className: className,
|
|
1439
1550
|
sx: {
|
|
1440
1551
|
boxShadow: 1,
|
|
1441
1552
|
backgroundColor: 'geowebColors.background.surface',
|
|
1442
|
-
padding: styles.padding,
|
|
1443
1553
|
zIndex: 2,
|
|
1444
1554
|
cursor: isDraggable ? 'move' : null
|
|
1445
1555
|
}
|
|
1446
1556
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1447
1557
|
container: true,
|
|
1448
|
-
alignItems: "center"
|
|
1558
|
+
alignItems: "center",
|
|
1559
|
+
sx: {
|
|
1560
|
+
padding: styles.padding,
|
|
1561
|
+
height: styles.height
|
|
1562
|
+
}
|
|
1449
1563
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
1564
|
+
className: "header-left",
|
|
1450
1565
|
item: true,
|
|
1451
1566
|
xs: columnSizeIcon,
|
|
1452
1567
|
sx: {
|
|
1453
1568
|
paddingRight: 1
|
|
1454
1569
|
}
|
|
1455
|
-
}, isDraggable && size !== 'xxs' && !
|
|
1570
|
+
}, isDraggable && size !== 'xxs' && !leftHeaderComponent && /*#__PURE__*/React__default.createElement(Grid, {
|
|
1456
1571
|
container: true,
|
|
1457
1572
|
justifyContent: "flex-start"
|
|
1458
1573
|
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
@@ -1462,7 +1577,8 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1462
1577
|
sx: Object.assign(Object.assign({}, iconStyle), {
|
|
1463
1578
|
pointerEvents: 'none'
|
|
1464
1579
|
})
|
|
1465
|
-
}, /*#__PURE__*/React__default.createElement(DragHandle, null))),
|
|
1580
|
+
}, /*#__PURE__*/React__default.createElement(DragHandle, null))), leftHeaderComponent && leftHeaderComponent), /*#__PURE__*/React__default.createElement(Grid, {
|
|
1581
|
+
className: "header-title",
|
|
1466
1582
|
item: true,
|
|
1467
1583
|
xs: columnSizeTitle
|
|
1468
1584
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -1486,11 +1602,12 @@ var ToolHeader = function ToolHeader(_ref) {
|
|
|
1486
1602
|
height: 12
|
|
1487
1603
|
})
|
|
1488
1604
|
}, /*#__PURE__*/React__default.createElement(DragHandle, null)))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
1605
|
+
className: "header-right",
|
|
1489
1606
|
item: true,
|
|
1490
1607
|
xs: columnSizeIcon,
|
|
1491
1608
|
container: true,
|
|
1492
1609
|
justifyContent: "flex-end"
|
|
1493
|
-
}, onClose && /*#__PURE__*/React__default.createElement(
|
|
1610
|
+
}, rightHeaderComponent && rightHeaderComponent, onClose && /*#__PURE__*/React__default.createElement(CustomTooltip, {
|
|
1494
1611
|
title: "Close",
|
|
1495
1612
|
placement: "bottom",
|
|
1496
1613
|
sx: {
|
|
@@ -1556,9 +1673,11 @@ var ToolContainer = function ToolContainer(_a) {
|
|
|
1556
1673
|
elevation = _a$elevation === void 0 ? BASE_ELEVATION : _a$elevation,
|
|
1557
1674
|
_a$headerClassName = _a.headerClassName,
|
|
1558
1675
|
headerClassName = _a$headerClassName === void 0 ? '' : _a$headerClassName,
|
|
1559
|
-
_a$
|
|
1560
|
-
|
|
1561
|
-
|
|
1676
|
+
_a$leftHeaderComponen = _a.leftHeaderComponent,
|
|
1677
|
+
leftHeaderComponent = _a$leftHeaderComponen === void 0 ? null : _a$leftHeaderComponen,
|
|
1678
|
+
_a$rightHeaderCompone = _a.rightHeaderComponent,
|
|
1679
|
+
rightHeaderComponent = _a$rightHeaderCompone === void 0 ? null : _a$rightHeaderCompone,
|
|
1680
|
+
props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftHeaderComponent", "rightHeaderComponent"]);
|
|
1562
1681
|
|
|
1563
1682
|
return /*#__PURE__*/React__default.createElement(Paper, Object.assign({
|
|
1564
1683
|
elevation: elevation,
|
|
@@ -1569,7 +1688,8 @@ var ToolContainer = function ToolContainer(_a) {
|
|
|
1569
1688
|
isDraggable: isDraggable,
|
|
1570
1689
|
onClose: onClose,
|
|
1571
1690
|
className: headerClassName,
|
|
1572
|
-
|
|
1691
|
+
leftHeaderComponent: leftHeaderComponent,
|
|
1692
|
+
rightHeaderComponent: rightHeaderComponent
|
|
1573
1693
|
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
1574
1694
|
sx: styles$2.content,
|
|
1575
1695
|
style: {
|
|
@@ -1620,16 +1740,27 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1620
1740
|
onChangeSize = _a$onChangeSize === void 0 ? function () {} : _a$onChangeSize,
|
|
1621
1741
|
_a$onMouseDown = _a.onMouseDown,
|
|
1622
1742
|
onMouseDown = _a$onMouseDown === void 0 ? function () {} : _a$onMouseDown,
|
|
1743
|
+
_a$onResizeStop = _a.onResizeStop,
|
|
1744
|
+
onResizeStop = _a$onResizeStop === void 0 ? function () {} : _a$onResizeStop,
|
|
1745
|
+
_a$onDragEnd = _a.onDragEnd,
|
|
1746
|
+
onDragEnd = _a$onDragEnd === void 0 ? function () {} : _a$onDragEnd,
|
|
1623
1747
|
_a$order = _a.order,
|
|
1624
1748
|
order = _a$order === void 0 ? 1 : _a$order,
|
|
1625
1749
|
_a$source = _a.source,
|
|
1626
1750
|
source = _a$source === void 0 ? 'app' : _a$source,
|
|
1627
|
-
_a$
|
|
1628
|
-
|
|
1629
|
-
|
|
1751
|
+
_a$leftHeaderComponen = _a.leftHeaderComponent,
|
|
1752
|
+
leftHeaderComponent = _a$leftHeaderComponen === void 0 ? null : _a$leftHeaderComponen,
|
|
1753
|
+
_a$rightHeaderCompone = _a.rightHeaderComponent,
|
|
1754
|
+
rightHeaderComponent = _a$rightHeaderCompone === void 0 ? null : _a$rightHeaderCompone,
|
|
1755
|
+
_a$hasElevation = _a.hasElevation,
|
|
1756
|
+
hasElevation = _a$hasElevation === void 0 ? true : _a$hasElevation,
|
|
1757
|
+
className = _a.className,
|
|
1758
|
+
_a$sx = _a.sx,
|
|
1759
|
+
sx = _a$sx === void 0 ? {} : _a$sx,
|
|
1760
|
+
props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "hasElevation", "className", "sx"]);
|
|
1630
1761
|
|
|
1631
1762
|
var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
|
|
1632
|
-
var elevation = BASE_ELEVATION + order;
|
|
1763
|
+
var elevation = hasElevation ? BASE_ELEVATION + order : 0;
|
|
1633
1764
|
var nodeRef = React__default.useRef(null);
|
|
1634
1765
|
|
|
1635
1766
|
var _React$useState = React__default.useState({
|
|
@@ -1645,20 +1776,28 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1645
1776
|
size = _React$useState4[0],
|
|
1646
1777
|
setSize = _React$useState4[1];
|
|
1647
1778
|
|
|
1779
|
+
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
1648
1780
|
var onStopDrag = React__default.useCallback(function (_event, position) {
|
|
1649
1781
|
setPosition(position);
|
|
1650
|
-
|
|
1782
|
+
onDragEnd(position, size);
|
|
1783
|
+
}, [setPosition, onDragEnd, size]);
|
|
1651
1784
|
|
|
1652
1785
|
var _React$useState5 = React__default.useState(defaultInitialMaxHeight),
|
|
1653
1786
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1654
1787
|
initialMaxHeight = _React$useState6[0],
|
|
1655
1788
|
setInitialMaxHeight = _React$useState6[1];
|
|
1656
1789
|
|
|
1790
|
+
var _React$useState7 = React__default.useState(0),
|
|
1791
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1792
|
+
initialDragPositionX = _React$useState8[0],
|
|
1793
|
+
setInitialDragPositionX = _React$useState8[1];
|
|
1794
|
+
|
|
1657
1795
|
var onStartResize = function onStartResize() {
|
|
1658
1796
|
setInitialMaxHeight('initial');
|
|
1797
|
+
setInitialDragPositionX(position.x);
|
|
1659
1798
|
};
|
|
1660
1799
|
|
|
1661
|
-
var onResize = React__default.useCallback(function (_event, _handle, node) {
|
|
1800
|
+
var onResize = React__default.useCallback(function (_event, _handle, node, delta) {
|
|
1662
1801
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1663
1802
|
width = _node$getBoundingClie.width,
|
|
1664
1803
|
height = _node$getBoundingClie.height;
|
|
@@ -1666,50 +1805,74 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1666
1805
|
onChangeSize({
|
|
1667
1806
|
width: width,
|
|
1668
1807
|
height: height
|
|
1669
|
-
});
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
if (!
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
y: position.y + diffY
|
|
1701
|
-
}));
|
|
1702
|
-
}
|
|
1703
|
-
}, [position]);
|
|
1704
|
-
React__default.useEffect(function () {
|
|
1705
|
-
var throttledResize = throttle(onResizeWindow, 100);
|
|
1706
|
-
window.addEventListener('resize', throttledResize);
|
|
1707
|
-
return function () {
|
|
1708
|
-
window.removeEventListener('resize', throttledResize);
|
|
1709
|
-
};
|
|
1710
|
-
}, [onResizeWindow]);
|
|
1808
|
+
}); // If dragging the same side as alignment, adjust position
|
|
1809
|
+
|
|
1810
|
+
if (isRightAligned && _handle === 'bottomRight') {
|
|
1811
|
+
var newX = initialDragPositionX + delta.width; // eslint-disable-next-line no-param-reassign
|
|
1812
|
+
|
|
1813
|
+
node.parentNode.style.transform = "translate(".concat(newX, "px, ").concat(position.y, "px)");
|
|
1814
|
+
} else if (!isRightAligned && _handle === 'bottomLeft') {
|
|
1815
|
+
var _newX = initialDragPositionX - delta.width; // eslint-disable-next-line no-param-reassign
|
|
1816
|
+
|
|
1817
|
+
|
|
1818
|
+
node.parentNode.style.transform = "translate(".concat(_newX, "px, ").concat(position.y, "px)");
|
|
1819
|
+
}
|
|
1820
|
+
}, [onChangeSize, initialDragPositionX, isRightAligned, position]);
|
|
1821
|
+
|
|
1822
|
+
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
1823
|
+
if (isRightAligned && direction === 'bottomRight') {
|
|
1824
|
+
setPosition({
|
|
1825
|
+
x: initialDragPositionX + delta.width,
|
|
1826
|
+
y: position.y
|
|
1827
|
+
});
|
|
1828
|
+
} else if (!isRightAligned && direction === 'bottomLeft') {
|
|
1829
|
+
setPosition({
|
|
1830
|
+
x: initialDragPositionX - delta.width,
|
|
1831
|
+
y: position.y
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
onResizeStop(_event, direction, node, delta);
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition);
|
|
1711
1839
|
var toolcontainerId = React__default.useRef(Date.now().toString()).current;
|
|
1712
|
-
var headerClassName = "header-".concat(toolcontainerId);
|
|
1840
|
+
var headerClassName = "header-".concat(className || toolcontainerId);
|
|
1841
|
+
React__default.useEffect(function () {
|
|
1842
|
+
var _a, _b; // update size when startSize has changed outside the component
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
if (startSize !== size) {
|
|
1846
|
+
var node = (_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.firstChild;
|
|
1847
|
+
var boundsNode = bounds === 'parent' ? (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.parentNode : document.querySelector(bounds);
|
|
1848
|
+
var startWidth = Number(startSize.width);
|
|
1849
|
+
|
|
1850
|
+
var _node$getBoundingClie2 = node.getBoundingClientRect(),
|
|
1851
|
+
currentX = _node$getBoundingClie2.x,
|
|
1852
|
+
currentWidth = _node$getBoundingClie2.width;
|
|
1853
|
+
|
|
1854
|
+
var _boundsNode$getBoundi = boundsNode.getBoundingClientRect(),
|
|
1855
|
+
maxWidth = _boundsNode$getBoundi.width; // TODO: fix screen hugging issues in https://gitlab.com/opengeoweb/opengeoweb/-/issues/2924
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
if (isRightAligned) {
|
|
1859
|
+
var newWidth = currentX + currentWidth - startWidth < 0 ? currentX + currentWidth : startWidth;
|
|
1860
|
+
var newSize = Object.assign(Object.assign({}, startSize), {
|
|
1861
|
+
width: newWidth
|
|
1862
|
+
});
|
|
1863
|
+
setSize(newSize);
|
|
1864
|
+
} else {
|
|
1865
|
+
var _newWidth = currentX + startWidth >= maxWidth ? maxWidth - currentX : startWidth;
|
|
1866
|
+
|
|
1867
|
+
var _newSize = Object.assign(Object.assign({}, startSize), {
|
|
1868
|
+
width: _newWidth
|
|
1869
|
+
});
|
|
1870
|
+
|
|
1871
|
+
setSize(_newSize);
|
|
1872
|
+
}
|
|
1873
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1874
|
+
|
|
1875
|
+
}, [startSize.width, startSize.height]);
|
|
1713
1876
|
return isOpen ? /*#__PURE__*/React__default.createElement(DraggableComponent$1, {
|
|
1714
1877
|
nodeRef: nodeRef,
|
|
1715
1878
|
bounds: bounds,
|
|
@@ -1717,18 +1880,23 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1717
1880
|
onStop: onStopDrag,
|
|
1718
1881
|
handle: ".".concat(headerClassName),
|
|
1719
1882
|
onMouseDown: onMouseDown
|
|
1720
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
1721
|
-
|
|
1883
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
1884
|
+
sx: Object.assign(Object.assign(Object.assign({
|
|
1722
1885
|
position: 'absolute',
|
|
1723
1886
|
pointerEvents: 'all',
|
|
1724
1887
|
zIndex: zIndex
|
|
1725
|
-
}, startPosition),
|
|
1726
|
-
|
|
1888
|
+
}, startPosition), sx), {
|
|
1889
|
+
'&:hover .resizableHandle': {
|
|
1890
|
+
display: 'inline'
|
|
1891
|
+
}
|
|
1892
|
+
}),
|
|
1893
|
+
ref: nodeRef,
|
|
1894
|
+
className: "toolContainerDraggable"
|
|
1727
1895
|
}, /*#__PURE__*/React__default.createElement(ResizeComponent, Object.assign({}, props, {
|
|
1728
|
-
startPosition: startPosition,
|
|
1729
1896
|
size: size,
|
|
1730
1897
|
setSize: setSize,
|
|
1731
1898
|
onResizeStart: onStartResize,
|
|
1899
|
+
onResizeStop: onStopResize,
|
|
1732
1900
|
onResize: onResize
|
|
1733
1901
|
}), /*#__PURE__*/React__default.createElement(ToolContainer, {
|
|
1734
1902
|
maxHeight: initialMaxHeight,
|
|
@@ -1739,7 +1907,9 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1739
1907
|
isResizable: true,
|
|
1740
1908
|
elevation: elevation,
|
|
1741
1909
|
headerClassName: headerClassName,
|
|
1742
|
-
|
|
1910
|
+
leftHeaderComponent: leftHeaderComponent,
|
|
1911
|
+
rightHeaderComponent: rightHeaderComponent,
|
|
1912
|
+
className: className
|
|
1743
1913
|
}, children)))) : null;
|
|
1744
1914
|
};
|
|
1745
1915
|
|
|
@@ -2411,7 +2581,7 @@ var ToggleMenu = function ToggleMenu(_ref) {
|
|
|
2411
2581
|
setAnchorEl(document.getElementById(buttonTestId));
|
|
2412
2582
|
}
|
|
2413
2583
|
}, [isDefaultOpen, buttonTestId]);
|
|
2414
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
2584
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
2415
2585
|
placement: "top",
|
|
2416
2586
|
title: tooltipTitle
|
|
2417
2587
|
}, /*#__PURE__*/React.createElement(ToolButton, {
|
|
@@ -2474,7 +2644,8 @@ var makeButtonStyles = function makeButtonStyles(isActive, isEnabled, isAccessib
|
|
|
2474
2644
|
height: '24px',
|
|
2475
2645
|
width: '24px',
|
|
2476
2646
|
borderRadius: '5px',
|
|
2477
|
-
marginTop: '
|
|
2647
|
+
marginTop: 'auto',
|
|
2648
|
+
marginBottom: 'auto',
|
|
2478
2649
|
color: function color() {
|
|
2479
2650
|
if (!isEnabled) {
|
|
2480
2651
|
return 'geowebColors.buttons.flat.disabled.color';
|
|
@@ -2522,7 +2693,8 @@ var ManagerButton = function ManagerButton(_a) {
|
|
|
2522
2693
|
_a$isAccessible = _a.isAccessible,
|
|
2523
2694
|
isAccessible = _a$isAccessible === void 0 ? false : _a$isAccessible,
|
|
2524
2695
|
sx = _a.sx,
|
|
2525
|
-
|
|
2696
|
+
children = _a.children,
|
|
2697
|
+
props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx", "children"]);
|
|
2526
2698
|
|
|
2527
2699
|
var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
|
|
2528
2700
|
|
|
@@ -2530,13 +2702,13 @@ var ManagerButton = function ManagerButton(_a) {
|
|
|
2530
2702
|
onClick(event);
|
|
2531
2703
|
};
|
|
2532
2704
|
|
|
2533
|
-
return /*#__PURE__*/React.createElement(
|
|
2705
|
+
return /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
2534
2706
|
title: tooltipTitle,
|
|
2535
2707
|
placement: "top",
|
|
2536
2708
|
sx: {
|
|
2537
2709
|
pointerEvents: 'none'
|
|
2538
2710
|
}
|
|
2539
|
-
}, /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
2711
|
+
}, children || /*#__PURE__*/React.createElement(IconButton, Object.assign({
|
|
2540
2712
|
size: "small",
|
|
2541
2713
|
onClick: handleClick,
|
|
2542
2714
|
"data-testid": testId,
|
|
@@ -2566,13 +2738,27 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
|
|
|
2566
2738
|
onClickDelete = _ref.onClickDelete,
|
|
2567
2739
|
_ref$isEnabled = _ref.isEnabled,
|
|
2568
2740
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
|
|
2569
|
-
return /*#__PURE__*/React.createElement(ManagerButton, {
|
|
2741
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ManagerButton, {
|
|
2742
|
+
tooltipTitle: tooltipTitle,
|
|
2743
|
+
onClick: onClickDelete,
|
|
2744
|
+
testId: "deleteButtonMedium",
|
|
2745
|
+
isEnabled: isEnabled,
|
|
2746
|
+
icon: /*#__PURE__*/React.createElement(Delete, null)
|
|
2747
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
2748
|
+
className: "deleteBtnMedium",
|
|
2749
|
+
variant: "tertiary",
|
|
2750
|
+
onClick: onClickDelete,
|
|
2751
|
+
startIcon: /*#__PURE__*/React.createElement(Delete, null),
|
|
2752
|
+
sx: {
|
|
2753
|
+
display: 'none'
|
|
2754
|
+
}
|
|
2755
|
+
}, "Delete")), /*#__PURE__*/React.createElement(ManagerButton, {
|
|
2570
2756
|
tooltipTitle: tooltipTitle,
|
|
2571
2757
|
onClick: onClickDelete,
|
|
2572
2758
|
icon: /*#__PURE__*/React.createElement(Delete, null),
|
|
2573
2759
|
testId: "deleteButton",
|
|
2574
2760
|
isEnabled: isEnabled
|
|
2575
|
-
});
|
|
2761
|
+
}));
|
|
2576
2762
|
};
|
|
2577
2763
|
|
|
2578
2764
|
/* *
|
|
@@ -2594,9 +2780,13 @@ var ManagerDeleteButton = function ManagerDeleteButton(_ref) {
|
|
|
2594
2780
|
var EnableButton = function EnableButton(_ref) {
|
|
2595
2781
|
var isEnabled = _ref.isEnabled,
|
|
2596
2782
|
title = _ref.title,
|
|
2597
|
-
onChangeEnableLayer = _ref.onChangeEnableLayer
|
|
2783
|
+
onChangeEnableLayer = _ref.onChangeEnableLayer,
|
|
2784
|
+
className = _ref.className,
|
|
2785
|
+
_ref$id = _ref.id,
|
|
2786
|
+
id = _ref$id === void 0 ? 'enableButton' : _ref$id;
|
|
2598
2787
|
|
|
2599
|
-
var onClick = function onClick() {
|
|
2788
|
+
var onClick = function onClick(event) {
|
|
2789
|
+
event.stopPropagation();
|
|
2600
2790
|
onChangeEnableLayer(!isEnabled);
|
|
2601
2791
|
};
|
|
2602
2792
|
|
|
@@ -2624,8 +2814,9 @@ var EnableButton = function EnableButton(_ref) {
|
|
|
2624
2814
|
disableFocusRipple: true,
|
|
2625
2815
|
tabIndex: -1
|
|
2626
2816
|
}),
|
|
2627
|
-
testId:
|
|
2628
|
-
isEnabled: isEnabled
|
|
2817
|
+
testId: id,
|
|
2818
|
+
isEnabled: isEnabled,
|
|
2819
|
+
className: className
|
|
2629
2820
|
});
|
|
2630
2821
|
};
|
|
2631
2822
|
|
|
@@ -2671,11 +2862,6 @@ var tooltipContainerStyles = function tooltipContainerStyles(isEnabled) {
|
|
|
2671
2862
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2672
2863
|
}
|
|
2673
2864
|
},
|
|
2674
|
-
'&:focus&.MuiButton-root': {
|
|
2675
|
-
outline: function outline(theme) {
|
|
2676
|
-
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2677
|
-
}
|
|
2678
|
-
},
|
|
2679
2865
|
'& .MuiSvgIcon-root': {
|
|
2680
2866
|
transition: 'none',
|
|
2681
2867
|
fill: function fill(theme) {
|
|
@@ -2701,10 +2887,11 @@ var backgroundColor = {
|
|
|
2701
2887
|
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2702
2888
|
},
|
|
2703
2889
|
'&:focus&.MuiButton-root': {
|
|
2704
|
-
|
|
2890
|
+
border: function border(theme) {
|
|
2705
2891
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2706
2892
|
},
|
|
2707
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2893
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
|
|
2894
|
+
transition: 'border'
|
|
2708
2895
|
}
|
|
2709
2896
|
};
|
|
2710
2897
|
|
|
@@ -2731,10 +2918,10 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2731
2918
|
selectOpen = _React$useState2[0],
|
|
2732
2919
|
setSelectOpen = _React$useState2[1];
|
|
2733
2920
|
|
|
2734
|
-
var
|
|
2735
|
-
|
|
2736
|
-
tooltipOpen =
|
|
2737
|
-
setTooltipOpen =
|
|
2921
|
+
var _useControlledTooltip = useControlledTooltip(),
|
|
2922
|
+
_useControlledTooltip2 = _slicedToArray(_useControlledTooltip, 2),
|
|
2923
|
+
tooltipOpen = _useControlledTooltip2[0],
|
|
2924
|
+
setTooltipOpen = _useControlledTooltip2[1];
|
|
2738
2925
|
|
|
2739
2926
|
var onWheel = React.useCallback(function (event) {
|
|
2740
2927
|
if (requiresCtrlToChange && (event.ctrlKey || event.metaKey) || !requiresCtrlToChange) {
|
|
@@ -2747,23 +2934,23 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2747
2934
|
var onOpen = React.useCallback(function () {
|
|
2748
2935
|
setSelectOpen(true);
|
|
2749
2936
|
setTooltipOpen(false);
|
|
2750
|
-
}, []);
|
|
2937
|
+
}, [setTooltipOpen]);
|
|
2751
2938
|
var onClose = React.useCallback(function () {
|
|
2752
2939
|
setSelectOpen(false);
|
|
2753
2940
|
}, []);
|
|
2754
2941
|
var onMouseEnter = React.useCallback(function () {
|
|
2755
2942
|
if (!selectOpen) setTooltipOpen(true);
|
|
2756
|
-
}, [selectOpen]);
|
|
2943
|
+
}, [selectOpen, setTooltipOpen]);
|
|
2757
2944
|
var onMouseLeave = React.useCallback(function () {
|
|
2758
2945
|
setTooltipOpen(false);
|
|
2759
|
-
}, []);
|
|
2946
|
+
}, [setTooltipOpen]);
|
|
2760
2947
|
var onFocus = React.useCallback(function () {
|
|
2761
2948
|
setTooltipOpen(true);
|
|
2762
|
-
}, []);
|
|
2949
|
+
}, [setTooltipOpen]);
|
|
2763
2950
|
var onBlur = React.useCallback(function () {
|
|
2764
2951
|
setTooltipOpen(false);
|
|
2765
|
-
}, []);
|
|
2766
|
-
return /*#__PURE__*/React.createElement(
|
|
2952
|
+
}, [setTooltipOpen]);
|
|
2953
|
+
return /*#__PURE__*/React.createElement(CustomTooltip, {
|
|
2767
2954
|
title: tooltip,
|
|
2768
2955
|
placement: "top",
|
|
2769
2956
|
open: tooltipOpen,
|
|
@@ -2822,6 +3009,66 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
2822
3009
|
}, otherProps)));
|
|
2823
3010
|
};
|
|
2824
3011
|
|
|
3012
|
+
function withEggs(eggs) {
|
|
3013
|
+
return function (Component) {
|
|
3014
|
+
var WithEggs = function WithEggs(props) {
|
|
3015
|
+
var store = useStore();
|
|
3016
|
+
|
|
3017
|
+
var _React$useState = React.useState(function () {
|
|
3018
|
+
return store.addEggs(eggs);
|
|
3019
|
+
}),
|
|
3020
|
+
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
3021
|
+
remover = _React$useState2[0];
|
|
3022
|
+
|
|
3023
|
+
React.useEffect(function () {
|
|
3024
|
+
return remover;
|
|
3025
|
+
}, [remover]);
|
|
3026
|
+
return /*#__PURE__*/React.createElement(Component, Object.assign({}, props));
|
|
3027
|
+
};
|
|
3028
|
+
|
|
3029
|
+
WithEggs.displayName = "withEggs(".concat(Component.displayName || Component.name || 'Component', ")");
|
|
3030
|
+
return WithEggs;
|
|
3031
|
+
};
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
var CustomAccordion = function CustomAccordion(_a) {
|
|
3035
|
+
var title = _a.title,
|
|
3036
|
+
_a$defaultExpanded = _a.defaultExpanded,
|
|
3037
|
+
defaultExpanded = _a$defaultExpanded === void 0 ? true : _a$defaultExpanded,
|
|
3038
|
+
_a$disableGutters = _a.disableGutters,
|
|
3039
|
+
disableGutters = _a$disableGutters === void 0 ? true : _a$disableGutters,
|
|
3040
|
+
_a$expandedElevation = _a.expandedElevation,
|
|
3041
|
+
expandedElevation = _a$expandedElevation === void 0 ? 3 : _a$expandedElevation,
|
|
3042
|
+
_a$collapsedElevation = _a.collapsedElevation,
|
|
3043
|
+
collapsedElevation = _a$collapsedElevation === void 0 ? 0 : _a$collapsedElevation,
|
|
3044
|
+
_a$transitionDuration = _a.transitionDuration,
|
|
3045
|
+
transitionDuration = _a$transitionDuration === void 0 ? 150 : _a$transitionDuration,
|
|
3046
|
+
detailsSx = _a.detailsSx,
|
|
3047
|
+
children = _a.children,
|
|
3048
|
+
props = __rest(_a, ["title", "defaultExpanded", "disableGutters", "expandedElevation", "collapsedElevation", "transitionDuration", "detailsSx", "children"]);
|
|
3049
|
+
|
|
3050
|
+
var _React$useState = React.useState(defaultExpanded),
|
|
3051
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3052
|
+
expanded = _React$useState2[0],
|
|
3053
|
+
setExpanded = _React$useState2[1];
|
|
3054
|
+
|
|
3055
|
+
return /*#__PURE__*/React.createElement(Accordion, Object.assign({}, props, {
|
|
3056
|
+
defaultExpanded: defaultExpanded,
|
|
3057
|
+
elevation: expanded ? expandedElevation : collapsedElevation,
|
|
3058
|
+
onChange: function onChange(_event, expanded) {
|
|
3059
|
+
return setExpanded(expanded);
|
|
3060
|
+
},
|
|
3061
|
+
disableGutters: disableGutters,
|
|
3062
|
+
TransitionProps: {
|
|
3063
|
+
timeout: transitionDuration
|
|
3064
|
+
}
|
|
3065
|
+
}), /*#__PURE__*/React.createElement(AccordionSummary, {
|
|
3066
|
+
expandIcon: /*#__PURE__*/React.createElement(ChevronDown, null)
|
|
3067
|
+
}, title), /*#__PURE__*/React.createElement(AccordionDetails, {
|
|
3068
|
+
sx: detailsSx
|
|
3069
|
+
}, children));
|
|
3070
|
+
};
|
|
3071
|
+
|
|
2825
3072
|
/* *
|
|
2826
3073
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2827
3074
|
* you may not use this file except in compliance with the License.
|
|
@@ -2884,4 +3131,24 @@ var getWarningMessage = function getWarningMessage(error) {
|
|
|
2884
3131
|
return '';
|
|
2885
3132
|
};
|
|
2886
3133
|
|
|
2887
|
-
|
|
3134
|
+
/* *
|
|
3135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3136
|
+
* you may not use this file except in compliance with the License.
|
|
3137
|
+
* You may obtain a copy of the License at
|
|
3138
|
+
*
|
|
3139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3140
|
+
*
|
|
3141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3144
|
+
* See the License for the specific language governing permissions and
|
|
3145
|
+
* limitations under the License.
|
|
3146
|
+
*
|
|
3147
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3148
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3149
|
+
* */
|
|
3150
|
+
// TODO: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2350
|
|
3151
|
+
// temporary check until we get the unit test passing with container queries
|
|
3152
|
+
var IS_JEST = typeof jest !== 'undefined';
|
|
3153
|
+
|
|
3154
|
+
export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomSlider, CustomToggleButton, CustomTooltip, DEFAULT_ERROR_MESSAGE, DraggableComponent$1 as Draggable, EnableButton, ErrorBoundary, HIDDEN_INPUT_HELPER_IS_DRAFT, IS_JEST, ManagerButton, ManagerDeleteButton, ResizeComponent as Resizable, StatusTag, ToggleMenu, ToolButton, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getPosition, getWarningMessage, isAxiosError, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDialogActions, useDraftFormHelpers, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
|