@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.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('react-draggable'), require('re-resizable'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', 'react-draggable', 're-resizable', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.Draggable, global.reResizable, global.
|
|
5
|
-
})(this, (function (exports, React, material, theme, reactHookForm, formFields, Draggable, reResizable,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('@opengeoweb/theme'), require('react-hook-form'), require('@opengeoweb/form-fields'), require('lodash'), require('react-draggable'), require('re-resizable'), require('react-redux')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', '@opengeoweb/theme', 'react-hook-form', '@opengeoweb/form-fields', 'lodash', 'react-draggable', 're-resizable', 'react-redux'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Shared = {}, global.React, global.material, global.theme, global.reactHookForm, global.formFields, global.lodash, global.Draggable, global.reResizable, global.reactRedux));
|
|
5
|
+
})(this, (function (exports, React, material, theme, reactHookForm, formFields, lodash, Draggable, reResizable, reactRedux) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -110,35 +110,37 @@
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
var bgColors = {
|
|
113
|
-
green: '
|
|
114
|
-
grey: '
|
|
115
|
-
purple: '
|
|
116
|
-
red: '
|
|
117
|
-
yellow: '
|
|
113
|
+
green: 'geowebColors.functional.successOutline.fill',
|
|
114
|
+
grey: 'geowebColors.functional.disabledOutline.fill',
|
|
115
|
+
purple: 'geowebColors.functional.summaryOutline.fill',
|
|
116
|
+
red: 'geowebColors.functional.errorOutline.fill',
|
|
117
|
+
yellow: 'geowebColors.functional.warningOutline.fill',
|
|
118
|
+
blue: 'geowebColors.functional.notificationOutline.fill'
|
|
118
119
|
};
|
|
119
120
|
var borderColors = {
|
|
120
|
-
green: '
|
|
121
|
-
grey: '
|
|
122
|
-
purple: '
|
|
123
|
-
red: '
|
|
124
|
-
yellow: '
|
|
121
|
+
green: 'geowebColors.functional.successOutline.borderColor',
|
|
122
|
+
grey: 'geowebColors.functional.disabledOutline.borderColor',
|
|
123
|
+
purple: 'geowebColors.functional.summaryOutline.borderColor',
|
|
124
|
+
red: 'geowebColors.functional.errorOutline.borderColor',
|
|
125
|
+
yellow: 'geowebColors.functional.warningOutline.borderColor',
|
|
126
|
+
blue: 'geowebColors.functional.notificationOutline.borderColor'
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
var tagStyle = function tagStyle(color) {
|
|
128
130
|
// Set color to grey for summary
|
|
129
|
-
var
|
|
131
|
+
var backgroundColor = bgColors[color];
|
|
130
132
|
var borderColor = borderColors[color];
|
|
131
133
|
return {
|
|
132
|
-
backgroundColor:
|
|
134
|
+
backgroundColor: backgroundColor,
|
|
133
135
|
m: 0,
|
|
134
|
-
p: 0
|
|
135
|
-
border:
|
|
136
|
+
p: 0,
|
|
137
|
+
border: '1px solid',
|
|
138
|
+
borderColor: borderColor,
|
|
136
139
|
borderRadius: '4px',
|
|
137
|
-
width: '
|
|
138
|
-
height: '
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
boxSizing: 'content-box'
|
|
140
|
+
width: '120px',
|
|
141
|
+
height: '18px',
|
|
142
|
+
lineHeight: '16px',
|
|
143
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
142
144
|
};
|
|
143
145
|
};
|
|
144
146
|
|
|
@@ -481,6 +483,51 @@
|
|
|
481
483
|
};
|
|
482
484
|
};
|
|
483
485
|
|
|
486
|
+
var adjustPosition = function adjustPosition(bbox, containingView, position, setPosition) {
|
|
487
|
+
var isHorizontallyLarger = bbox.width > containingView.width;
|
|
488
|
+
var isVerticallyLarger = bbox.height > containingView.height; // left screen
|
|
489
|
+
|
|
490
|
+
if (bbox.x < containingView.x || isHorizontallyLarger) {
|
|
491
|
+
var diffX = containingView.x - bbox.x;
|
|
492
|
+
setPosition(__assign(__assign({}, position), {
|
|
493
|
+
x: position.x + diffX
|
|
494
|
+
}));
|
|
495
|
+
} // right screen
|
|
496
|
+
else if (bbox.right >= containingView.right) {
|
|
497
|
+
var diffX = containingView.right - bbox.right;
|
|
498
|
+
setPosition(__assign(__assign({}, position), {
|
|
499
|
+
x: position.x + diffX
|
|
500
|
+
}));
|
|
501
|
+
} // top screen
|
|
502
|
+
else if (bbox.y < containingView.y || isVerticallyLarger) {
|
|
503
|
+
var diffY = containingView.y - bbox.y;
|
|
504
|
+
setPosition(__assign(__assign({}, position), {
|
|
505
|
+
y: position.y + diffY
|
|
506
|
+
}));
|
|
507
|
+
} // bottom screen
|
|
508
|
+
else if (bbox.bottom >= containingView.bottom) {
|
|
509
|
+
var diffY = containingView.bottom - bbox.bottom;
|
|
510
|
+
setPosition(__assign(__assign({}, position), {
|
|
511
|
+
y: position.y + diffY
|
|
512
|
+
}));
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
var useMakeSureContainerStaysInsideWindow = function useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition) {
|
|
516
|
+
var onResizeWindow = React__default["default"].useCallback(function () {
|
|
517
|
+
if (!nodeRef.current) return;
|
|
518
|
+
var bbox = nodeRef.current.firstChild.getBoundingClientRect();
|
|
519
|
+
var containingView = nodeRef.current.parentElement.getBoundingClientRect();
|
|
520
|
+
adjustPosition(bbox, containingView, position, setPosition);
|
|
521
|
+
}, [nodeRef, position, setPosition]);
|
|
522
|
+
React__default["default"].useEffect(function () {
|
|
523
|
+
var throttledResize = lodash.throttle(onResizeWindow, 100);
|
|
524
|
+
window.addEventListener('resize', throttledResize);
|
|
525
|
+
return function () {
|
|
526
|
+
window.removeEventListener('resize', throttledResize);
|
|
527
|
+
};
|
|
528
|
+
}, [onResizeWindow]);
|
|
529
|
+
};
|
|
530
|
+
|
|
484
531
|
var ConfirmationServiceContext = /*#__PURE__*/React__namespace.createContext(Promise.reject);
|
|
485
532
|
var useConfirmationDialog = function useConfirmationDialog() {
|
|
486
533
|
return React__namespace.useContext(ConfirmationServiceContext);
|
|
@@ -890,29 +937,26 @@
|
|
|
890
937
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
891
938
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
892
939
|
* */
|
|
940
|
+
var isDraggingClassName = 'is-dragging';
|
|
893
941
|
|
|
894
942
|
var ResizeComponent = function ResizeComponent(_a) {
|
|
895
|
-
var
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
} : _b,
|
|
901
|
-
children = _a.children,
|
|
902
|
-
_c = _a.onResizeStart,
|
|
903
|
-
onResizeStart = _c === void 0 ? function () {} : _c,
|
|
943
|
+
var children = _a.children,
|
|
944
|
+
_b = _a.onResizeStart,
|
|
945
|
+
onResizeStart = _b === void 0 ? function () {} : _b,
|
|
946
|
+
_c = _a.onResizeStop,
|
|
947
|
+
onResizeStop = _c === void 0 ? function () {} : _c,
|
|
904
948
|
size = _a.size,
|
|
905
949
|
setSize = _a.setSize,
|
|
906
950
|
_d = _a.minHeight,
|
|
907
951
|
minHeight = _d === void 0 ? 50 : _d,
|
|
908
952
|
_e = _a.minWidth,
|
|
909
953
|
minWidth = _e === void 0 ? 50 : _e,
|
|
910
|
-
props = __rest(_a, ["
|
|
954
|
+
props = __rest(_a, ["children", "onResizeStart", "onResizeStop", "size", "setSize", "minHeight", "minWidth"]);
|
|
911
955
|
|
|
912
956
|
var theme$1 = material.useTheme();
|
|
913
|
-
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
914
957
|
var onStartResize = React__default["default"].useCallback(function (event, _direction, node) {
|
|
915
958
|
event.stopPropagation();
|
|
959
|
+
node.classList.add(isDraggingClassName);
|
|
916
960
|
|
|
917
961
|
var _a = node.getBoundingClientRect(),
|
|
918
962
|
width = _a.width,
|
|
@@ -927,32 +971,42 @@
|
|
|
927
971
|
node.style.height = height + "px";
|
|
928
972
|
onResizeStart();
|
|
929
973
|
}, [onResizeStart, setSize]);
|
|
930
|
-
var
|
|
974
|
+
var onStopResize = React__default["default"].useCallback(function (event, direction, node, delta) {
|
|
975
|
+
node.classList.remove(isDraggingClassName);
|
|
931
976
|
var width = parseInt(size.width, 10) + delta.width;
|
|
932
977
|
var height = parseInt(size.height, 10) + delta.height;
|
|
933
978
|
setSize({
|
|
934
979
|
width: width,
|
|
935
980
|
height: height
|
|
936
981
|
});
|
|
937
|
-
|
|
982
|
+
onResizeStop(event, direction, node, delta);
|
|
983
|
+
}, [setSize, onResizeStop, size]);
|
|
938
984
|
return /*#__PURE__*/React__default["default"].createElement(reResizable.Resizable // TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
939
985
|
, __assign({
|
|
940
986
|
// TODO: implement bounds https://gitlab.com/opengeoweb/opengeoweb/-/issues/1035
|
|
941
987
|
minHeight: minHeight,
|
|
942
988
|
minWidth: minWidth,
|
|
943
989
|
size: size,
|
|
944
|
-
onResizeStop:
|
|
990
|
+
onResizeStop: onStopResize,
|
|
945
991
|
handleComponent: {
|
|
946
992
|
bottomRight: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
|
|
947
993
|
style: {
|
|
948
994
|
fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
|
|
949
|
-
}
|
|
995
|
+
},
|
|
996
|
+
sx: {
|
|
997
|
+
display: 'none'
|
|
998
|
+
},
|
|
999
|
+
className: "resizableHandle"
|
|
950
1000
|
}),
|
|
951
1001
|
bottomLeft: /*#__PURE__*/React__default["default"].createElement(theme.Resize, {
|
|
952
1002
|
isRightAligned: true,
|
|
953
1003
|
style: {
|
|
954
1004
|
fill: "" + theme$1.palette.geowebColors.buttons.flat["default"].color
|
|
955
|
-
}
|
|
1005
|
+
},
|
|
1006
|
+
sx: {
|
|
1007
|
+
display: 'none'
|
|
1008
|
+
},
|
|
1009
|
+
className: "resizableHandle"
|
|
956
1010
|
})
|
|
957
1011
|
},
|
|
958
1012
|
enable: {
|
|
@@ -961,8 +1015,8 @@
|
|
|
961
1015
|
bottom: false,
|
|
962
1016
|
left: false,
|
|
963
1017
|
topRight: false,
|
|
964
|
-
bottomRight:
|
|
965
|
-
bottomLeft:
|
|
1018
|
+
bottomRight: true,
|
|
1019
|
+
bottomLeft: true,
|
|
966
1020
|
topLeft: false
|
|
967
1021
|
},
|
|
968
1022
|
onResizeStart: onStartResize
|
|
@@ -1213,6 +1267,55 @@
|
|
|
1213
1267
|
});
|
|
1214
1268
|
};
|
|
1215
1269
|
|
|
1270
|
+
/* *
|
|
1271
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1272
|
+
* you may not use this file except in compliance with the License.
|
|
1273
|
+
* You may obtain a copy of the License at
|
|
1274
|
+
*
|
|
1275
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1276
|
+
*
|
|
1277
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1278
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1279
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1280
|
+
* See the License for the specific language governing permissions and
|
|
1281
|
+
* limitations under the License.
|
|
1282
|
+
*
|
|
1283
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1284
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1285
|
+
* */
|
|
1286
|
+
var defaultDelay = 1000;
|
|
1287
|
+
var useControlledTooltip = function useControlledTooltip() {
|
|
1288
|
+
var _a = __read(React__namespace.useState(false), 2),
|
|
1289
|
+
tooltipOpen = _a[0],
|
|
1290
|
+
setTooltipOpen = _a[1];
|
|
1291
|
+
|
|
1292
|
+
var _b = __read(React__namespace.useState(false), 2),
|
|
1293
|
+
delayedTooltip = _b[0],
|
|
1294
|
+
setDelayedTooltip = _b[1];
|
|
1295
|
+
|
|
1296
|
+
React__namespace.useEffect(function () {
|
|
1297
|
+
if (tooltipOpen === true) {
|
|
1298
|
+
var timer_1 = setTimeout(function () {
|
|
1299
|
+
return setDelayedTooltip(true);
|
|
1300
|
+
}, defaultDelay);
|
|
1301
|
+
return function () {
|
|
1302
|
+
clearTimeout(timer_1);
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
setDelayedTooltip(false);
|
|
1307
|
+
return function () {};
|
|
1308
|
+
}, [tooltipOpen]);
|
|
1309
|
+
return [delayedTooltip, setTooltipOpen];
|
|
1310
|
+
};
|
|
1311
|
+
var CustomTooltip = function CustomTooltip(props) {
|
|
1312
|
+
return /*#__PURE__*/React__namespace.createElement(material.Tooltip, __assign({}, props, {
|
|
1313
|
+
enterDelay: defaultDelay,
|
|
1314
|
+
enterNextDelay: defaultDelay,
|
|
1315
|
+
disableInteractive: true
|
|
1316
|
+
}));
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1216
1319
|
/* *
|
|
1217
1320
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1218
1321
|
* you may not use this file except in compliance with the License.
|
|
@@ -1254,7 +1357,8 @@
|
|
|
1254
1357
|
return {
|
|
1255
1358
|
fontSize: 20,
|
|
1256
1359
|
fontWeight: 400,
|
|
1257
|
-
padding: '8px'
|
|
1360
|
+
padding: '4px 8px',
|
|
1361
|
+
height: 40
|
|
1258
1362
|
};
|
|
1259
1363
|
}
|
|
1260
1364
|
|
|
@@ -1291,31 +1395,37 @@
|
|
|
1291
1395
|
isDraggable = _c === void 0 ? false : _c,
|
|
1292
1396
|
_d = _a.className,
|
|
1293
1397
|
className = _d === void 0 ? '' : _d,
|
|
1294
|
-
_e = _a.
|
|
1295
|
-
|
|
1398
|
+
_e = _a.leftHeaderComponent,
|
|
1399
|
+
leftHeaderComponent = _e === void 0 ? null : _e,
|
|
1400
|
+
_f = _a.rightHeaderComponent,
|
|
1401
|
+
rightHeaderComponent = _f === void 0 ? null : _f;
|
|
1296
1402
|
var styles = getStyle(size);
|
|
1297
|
-
var columnSizeIcon =
|
|
1298
|
-
var columnSizeTitle =
|
|
1403
|
+
var columnSizeIcon = leftHeaderComponent || rightHeaderComponent ? 4 : 1;
|
|
1404
|
+
var columnSizeTitle = leftHeaderComponent || rightHeaderComponent ? 4 : 10;
|
|
1299
1405
|
return /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
1300
1406
|
component: "header",
|
|
1301
1407
|
className: className,
|
|
1302
1408
|
sx: {
|
|
1303
1409
|
boxShadow: 1,
|
|
1304
1410
|
backgroundColor: 'geowebColors.background.surface',
|
|
1305
|
-
padding: styles.padding,
|
|
1306
1411
|
zIndex: 2,
|
|
1307
1412
|
cursor: isDraggable ? 'move' : null
|
|
1308
1413
|
}
|
|
1309
1414
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
1310
1415
|
container: true,
|
|
1311
|
-
alignItems: "center"
|
|
1416
|
+
alignItems: "center",
|
|
1417
|
+
sx: {
|
|
1418
|
+
padding: styles.padding,
|
|
1419
|
+
height: styles.height
|
|
1420
|
+
}
|
|
1312
1421
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
1422
|
+
className: "header-left",
|
|
1313
1423
|
item: true,
|
|
1314
1424
|
xs: columnSizeIcon,
|
|
1315
1425
|
sx: {
|
|
1316
1426
|
paddingRight: 1
|
|
1317
1427
|
}
|
|
1318
|
-
}, isDraggable && size !== 'xxs' && !
|
|
1428
|
+
}, isDraggable && size !== 'xxs' && !leftHeaderComponent && /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
1319
1429
|
container: true,
|
|
1320
1430
|
justifyContent: "flex-start"
|
|
1321
1431
|
}, /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
|
|
@@ -1325,7 +1435,8 @@
|
|
|
1325
1435
|
sx: __assign(__assign({}, iconStyle), {
|
|
1326
1436
|
pointerEvents: 'none'
|
|
1327
1437
|
})
|
|
1328
|
-
}, /*#__PURE__*/React__default["default"].createElement(theme.DragHandle, null))),
|
|
1438
|
+
}, /*#__PURE__*/React__default["default"].createElement(theme.DragHandle, null))), leftHeaderComponent && leftHeaderComponent), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
1439
|
+
className: "header-title",
|
|
1329
1440
|
item: true,
|
|
1330
1441
|
xs: columnSizeTitle
|
|
1331
1442
|
}, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
@@ -1349,11 +1460,12 @@
|
|
|
1349
1460
|
height: 12
|
|
1350
1461
|
})
|
|
1351
1462
|
}, /*#__PURE__*/React__default["default"].createElement(theme.DragHandle, null)))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
1463
|
+
className: "header-right",
|
|
1352
1464
|
item: true,
|
|
1353
1465
|
xs: columnSizeIcon,
|
|
1354
1466
|
container: true,
|
|
1355
1467
|
justifyContent: "flex-end"
|
|
1356
|
-
}, onClose && /*#__PURE__*/React__default["default"].createElement(
|
|
1468
|
+
}, rightHeaderComponent && rightHeaderComponent, onClose && /*#__PURE__*/React__default["default"].createElement(CustomTooltip, {
|
|
1357
1469
|
title: "Close",
|
|
1358
1470
|
placement: "bottom",
|
|
1359
1471
|
sx: {
|
|
@@ -1421,9 +1533,11 @@
|
|
|
1421
1533
|
_h = _a.headerClassName,
|
|
1422
1534
|
// elevation_06
|
|
1423
1535
|
headerClassName = _h === void 0 ? '' : _h,
|
|
1424
|
-
_j = _a.
|
|
1425
|
-
|
|
1426
|
-
|
|
1536
|
+
_j = _a.leftHeaderComponent,
|
|
1537
|
+
leftHeaderComponent = _j === void 0 ? null : _j,
|
|
1538
|
+
_k = _a.rightHeaderComponent,
|
|
1539
|
+
rightHeaderComponent = _k === void 0 ? null : _k,
|
|
1540
|
+
props = __rest(_a, ["title", "size", "children", "onClose", "isResizable", "isDraggable", "maxHeight", "elevation", "headerClassName", "leftHeaderComponent", "rightHeaderComponent"]);
|
|
1427
1541
|
|
|
1428
1542
|
return /*#__PURE__*/React__default["default"].createElement(material.Paper, __assign({
|
|
1429
1543
|
elevation: elevation,
|
|
@@ -1434,7 +1548,8 @@
|
|
|
1434
1548
|
isDraggable: isDraggable,
|
|
1435
1549
|
onClose: onClose,
|
|
1436
1550
|
className: headerClassName,
|
|
1437
|
-
|
|
1551
|
+
leftHeaderComponent: leftHeaderComponent,
|
|
1552
|
+
rightHeaderComponent: rightHeaderComponent
|
|
1438
1553
|
})), /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
1439
1554
|
sx: styles$2.content,
|
|
1440
1555
|
style: {
|
|
@@ -1502,42 +1617,60 @@
|
|
|
1502
1617
|
onChangeSize = _j === void 0 ? function () {} : _j,
|
|
1503
1618
|
_k = _a.onMouseDown,
|
|
1504
1619
|
onMouseDown = _k === void 0 ? function () {} : _k,
|
|
1505
|
-
_l = _a.
|
|
1506
|
-
|
|
1507
|
-
_m = _a.
|
|
1508
|
-
|
|
1509
|
-
_o = _a.
|
|
1510
|
-
|
|
1511
|
-
|
|
1620
|
+
_l = _a.onResizeStop,
|
|
1621
|
+
onResizeStop = _l === void 0 ? function () {} : _l,
|
|
1622
|
+
_m = _a.onDragEnd,
|
|
1623
|
+
onDragEnd = _m === void 0 ? function () {} : _m,
|
|
1624
|
+
_o = _a.order,
|
|
1625
|
+
order = _o === void 0 ? 1 : _o,
|
|
1626
|
+
_p = _a.source,
|
|
1627
|
+
source = _p === void 0 ? 'app' : _p,
|
|
1628
|
+
_q = _a.leftHeaderComponent,
|
|
1629
|
+
leftHeaderComponent = _q === void 0 ? null : _q,
|
|
1630
|
+
_r = _a.rightHeaderComponent,
|
|
1631
|
+
rightHeaderComponent = _r === void 0 ? null : _r,
|
|
1632
|
+
_s = _a.hasElevation,
|
|
1633
|
+
hasElevation = _s === void 0 ? true : _s,
|
|
1634
|
+
className = _a.className,
|
|
1635
|
+
_t = _a.sx,
|
|
1636
|
+
sx = _t === void 0 ? {} : _t,
|
|
1637
|
+
props = __rest(_a, ["title", "bounds", "headerSize", "startSize", "startPosition", "children", "isOpen", "onClose", "initialMaxHeight", "onChangeSize", "onMouseDown", "onResizeStop", "onDragEnd", "order", "source", "leftHeaderComponent", "rightHeaderComponent", "hasElevation", "className", "sx"]);
|
|
1512
1638
|
|
|
1513
1639
|
var zIndex = (source === 'app' ? BASE_Z_INDEX : 1000) + order;
|
|
1514
|
-
var elevation = BASE_ELEVATION + order;
|
|
1640
|
+
var elevation = hasElevation ? BASE_ELEVATION + order : 0;
|
|
1515
1641
|
var nodeRef = React__default["default"].useRef(null);
|
|
1516
1642
|
|
|
1517
|
-
var
|
|
1643
|
+
var _u = __read(React__default["default"].useState({
|
|
1518
1644
|
x: 0,
|
|
1519
1645
|
y: 0
|
|
1520
1646
|
}), 2),
|
|
1521
|
-
position =
|
|
1522
|
-
setPosition =
|
|
1647
|
+
position = _u[0],
|
|
1648
|
+
setPosition = _u[1];
|
|
1523
1649
|
|
|
1524
|
-
var
|
|
1525
|
-
size =
|
|
1526
|
-
setSize =
|
|
1650
|
+
var _v = __read(React__default["default"].useState(startSize), 2),
|
|
1651
|
+
size = _v[0],
|
|
1652
|
+
setSize = _v[1];
|
|
1527
1653
|
|
|
1654
|
+
var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
|
|
1528
1655
|
var onStopDrag = React__default["default"].useCallback(function (_event, position) {
|
|
1529
1656
|
setPosition(position);
|
|
1530
|
-
|
|
1657
|
+
onDragEnd(position, size);
|
|
1658
|
+
}, [setPosition, onDragEnd, size]);
|
|
1531
1659
|
|
|
1532
|
-
var
|
|
1533
|
-
initialMaxHeight =
|
|
1534
|
-
setInitialMaxHeight =
|
|
1660
|
+
var _w = __read(React__default["default"].useState(defaultInitialMaxHeight), 2),
|
|
1661
|
+
initialMaxHeight = _w[0],
|
|
1662
|
+
setInitialMaxHeight = _w[1];
|
|
1663
|
+
|
|
1664
|
+
var _x = __read(React__default["default"].useState(0), 2),
|
|
1665
|
+
initialDragPositionX = _x[0],
|
|
1666
|
+
setInitialDragPositionX = _x[1];
|
|
1535
1667
|
|
|
1536
1668
|
var onStartResize = function onStartResize() {
|
|
1537
1669
|
setInitialMaxHeight('initial');
|
|
1670
|
+
setInitialDragPositionX(position.x);
|
|
1538
1671
|
};
|
|
1539
1672
|
|
|
1540
|
-
var onResize = React__default["default"].useCallback(function (_event, _handle, node) {
|
|
1673
|
+
var onResize = React__default["default"].useCallback(function (_event, _handle, node, delta) {
|
|
1541
1674
|
var _a = node.getBoundingClientRect(),
|
|
1542
1675
|
width = _a.width,
|
|
1543
1676
|
height = _a.height;
|
|
@@ -1545,50 +1678,73 @@
|
|
|
1545
1678
|
onChangeSize({
|
|
1546
1679
|
width: width,
|
|
1547
1680
|
height: height
|
|
1548
|
-
});
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
if (!
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
setPosition(__assign(__assign({}, position), {
|
|
1579
|
-
y: position.y + diffY
|
|
1580
|
-
}));
|
|
1581
|
-
}
|
|
1582
|
-
}, [position]);
|
|
1583
|
-
React__default["default"].useEffect(function () {
|
|
1584
|
-
var throttledResize = lodash.throttle(onResizeWindow, 100);
|
|
1585
|
-
window.addEventListener('resize', throttledResize);
|
|
1586
|
-
return function () {
|
|
1587
|
-
window.removeEventListener('resize', throttledResize);
|
|
1588
|
-
};
|
|
1589
|
-
}, [onResizeWindow]);
|
|
1681
|
+
}); // If dragging the same side as alignment, adjust position
|
|
1682
|
+
|
|
1683
|
+
if (isRightAligned && _handle === 'bottomRight') {
|
|
1684
|
+
var newX = initialDragPositionX + delta.width; // eslint-disable-next-line no-param-reassign
|
|
1685
|
+
|
|
1686
|
+
node.parentNode.style.transform = "translate(" + newX + "px, " + position.y + "px)";
|
|
1687
|
+
} else if (!isRightAligned && _handle === 'bottomLeft') {
|
|
1688
|
+
var newX = initialDragPositionX - delta.width; // eslint-disable-next-line no-param-reassign
|
|
1689
|
+
|
|
1690
|
+
node.parentNode.style.transform = "translate(" + newX + "px, " + position.y + "px)";
|
|
1691
|
+
}
|
|
1692
|
+
}, [onChangeSize, initialDragPositionX, isRightAligned, position]);
|
|
1693
|
+
|
|
1694
|
+
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
1695
|
+
if (isRightAligned && direction === 'bottomRight') {
|
|
1696
|
+
setPosition({
|
|
1697
|
+
x: initialDragPositionX + delta.width,
|
|
1698
|
+
y: position.y
|
|
1699
|
+
});
|
|
1700
|
+
} else if (!isRightAligned && direction === 'bottomLeft') {
|
|
1701
|
+
setPosition({
|
|
1702
|
+
x: initialDragPositionX - delta.width,
|
|
1703
|
+
y: position.y
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
onResizeStop(_event, direction, node, delta);
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition);
|
|
1590
1711
|
var toolcontainerId = React__default["default"].useRef(Date.now().toString()).current;
|
|
1591
|
-
var headerClassName = "header-" + toolcontainerId;
|
|
1712
|
+
var headerClassName = "header-" + (className || toolcontainerId);
|
|
1713
|
+
React__default["default"].useEffect(function () {
|
|
1714
|
+
var _a, _b; // update size when startSize has changed outside the component
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
if (startSize !== size) {
|
|
1718
|
+
var node = (_a = nodeRef.current) === null || _a === void 0 ? void 0 : _a.firstChild;
|
|
1719
|
+
var boundsNode = bounds === 'parent' ? (_b = nodeRef.current) === null || _b === void 0 ? void 0 : _b.parentNode : document.querySelector(bounds);
|
|
1720
|
+
var startWidth = Number(startSize.width);
|
|
1721
|
+
|
|
1722
|
+
var _c = node.getBoundingClientRect(),
|
|
1723
|
+
currentX = _c.x,
|
|
1724
|
+
currentWidth = _c.width;
|
|
1725
|
+
|
|
1726
|
+
var maxWidth = boundsNode.getBoundingClientRect().width; // TODO: fix screen hugging issues in https://gitlab.com/opengeoweb/opengeoweb/-/issues/2924
|
|
1727
|
+
|
|
1728
|
+
if (isRightAligned) {
|
|
1729
|
+
var newWidth = currentX + currentWidth - startWidth < 0 ? currentX + currentWidth : startWidth;
|
|
1730
|
+
|
|
1731
|
+
var newSize = __assign(__assign({}, startSize), {
|
|
1732
|
+
width: newWidth
|
|
1733
|
+
});
|
|
1734
|
+
|
|
1735
|
+
setSize(newSize);
|
|
1736
|
+
} else {
|
|
1737
|
+
var newWidth = currentX + startWidth >= maxWidth ? maxWidth - currentX : startWidth;
|
|
1738
|
+
|
|
1739
|
+
var newSize = __assign(__assign({}, startSize), {
|
|
1740
|
+
width: newWidth
|
|
1741
|
+
});
|
|
1742
|
+
|
|
1743
|
+
setSize(newSize);
|
|
1744
|
+
}
|
|
1745
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1746
|
+
|
|
1747
|
+
}, [startSize.width, startSize.height]);
|
|
1592
1748
|
return isOpen ? /*#__PURE__*/React__default["default"].createElement(DraggableComponent$1, {
|
|
1593
1749
|
nodeRef: nodeRef,
|
|
1594
1750
|
bounds: bounds,
|
|
@@ -1596,18 +1752,23 @@
|
|
|
1596
1752
|
onStop: onStopDrag,
|
|
1597
1753
|
handle: "." + headerClassName,
|
|
1598
1754
|
onMouseDown: onMouseDown
|
|
1599
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
1600
|
-
|
|
1755
|
+
}, /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
1756
|
+
sx: __assign(__assign(__assign({
|
|
1601
1757
|
position: 'absolute',
|
|
1602
1758
|
pointerEvents: 'all',
|
|
1603
1759
|
zIndex: zIndex
|
|
1604
|
-
}, startPosition),
|
|
1605
|
-
|
|
1760
|
+
}, startPosition), sx), {
|
|
1761
|
+
'&:hover .resizableHandle': {
|
|
1762
|
+
display: 'inline'
|
|
1763
|
+
}
|
|
1764
|
+
}),
|
|
1765
|
+
ref: nodeRef,
|
|
1766
|
+
className: "toolContainerDraggable"
|
|
1606
1767
|
}, /*#__PURE__*/React__default["default"].createElement(ResizeComponent, __assign({}, props, {
|
|
1607
|
-
startPosition: startPosition,
|
|
1608
1768
|
size: size,
|
|
1609
1769
|
setSize: setSize,
|
|
1610
1770
|
onResizeStart: onStartResize,
|
|
1771
|
+
onResizeStop: onStopResize,
|
|
1611
1772
|
onResize: onResize
|
|
1612
1773
|
}), /*#__PURE__*/React__default["default"].createElement(ToolContainer, {
|
|
1613
1774
|
maxHeight: initialMaxHeight,
|
|
@@ -1618,7 +1779,9 @@
|
|
|
1618
1779
|
isResizable: true,
|
|
1619
1780
|
elevation: elevation,
|
|
1620
1781
|
headerClassName: headerClassName,
|
|
1621
|
-
|
|
1782
|
+
leftHeaderComponent: leftHeaderComponent,
|
|
1783
|
+
rightHeaderComponent: rightHeaderComponent,
|
|
1784
|
+
className: className
|
|
1622
1785
|
}, children)))) : null;
|
|
1623
1786
|
};
|
|
1624
1787
|
|
|
@@ -2290,7 +2453,7 @@
|
|
|
2290
2453
|
setAnchorEl(document.getElementById(buttonTestId));
|
|
2291
2454
|
}
|
|
2292
2455
|
}, [isDefaultOpen, buttonTestId]);
|
|
2293
|
-
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(
|
|
2456
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(CustomTooltip, {
|
|
2294
2457
|
placement: "top",
|
|
2295
2458
|
title: tooltipTitle
|
|
2296
2459
|
}, /*#__PURE__*/React__namespace.createElement(ToolButton, {
|
|
@@ -2353,7 +2516,8 @@
|
|
|
2353
2516
|
height: '24px',
|
|
2354
2517
|
width: '24px',
|
|
2355
2518
|
borderRadius: '5px',
|
|
2356
|
-
marginTop: '
|
|
2519
|
+
marginTop: 'auto',
|
|
2520
|
+
marginBottom: 'auto',
|
|
2357
2521
|
color: function color() {
|
|
2358
2522
|
if (!isEnabled) {
|
|
2359
2523
|
return 'geowebColors.buttons.flat.disabled.color';
|
|
@@ -2401,7 +2565,8 @@
|
|
|
2401
2565
|
_f = _a.isAccessible,
|
|
2402
2566
|
isAccessible = _f === void 0 ? false : _f,
|
|
2403
2567
|
sx = _a.sx,
|
|
2404
|
-
|
|
2568
|
+
children = _a.children,
|
|
2569
|
+
props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId", "isAccessible", "sx", "children"]);
|
|
2405
2570
|
|
|
2406
2571
|
var buttonStyles = makeButtonStyles(isActive, isEnabled, isAccessible);
|
|
2407
2572
|
|
|
@@ -2409,13 +2574,13 @@
|
|
|
2409
2574
|
onClick(event);
|
|
2410
2575
|
};
|
|
2411
2576
|
|
|
2412
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
2577
|
+
return /*#__PURE__*/React__namespace.createElement(CustomTooltip, {
|
|
2413
2578
|
title: tooltipTitle,
|
|
2414
2579
|
placement: "top",
|
|
2415
2580
|
sx: {
|
|
2416
2581
|
pointerEvents: 'none'
|
|
2417
2582
|
}
|
|
2418
|
-
}, /*#__PURE__*/React__namespace.createElement(material.IconButton, __assign({
|
|
2583
|
+
}, children || /*#__PURE__*/React__namespace.createElement(material.IconButton, __assign({
|
|
2419
2584
|
size: "small",
|
|
2420
2585
|
onClick: handleClick,
|
|
2421
2586
|
"data-testid": testId,
|
|
@@ -2445,13 +2610,27 @@
|
|
|
2445
2610
|
onClickDelete = _a.onClickDelete,
|
|
2446
2611
|
_b = _a.isEnabled,
|
|
2447
2612
|
isEnabled = _b === void 0 ? true : _b;
|
|
2448
|
-
return /*#__PURE__*/React__namespace.createElement(ManagerButton, {
|
|
2613
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ManagerButton, {
|
|
2614
|
+
tooltipTitle: tooltipTitle,
|
|
2615
|
+
onClick: onClickDelete,
|
|
2616
|
+
testId: "deleteButtonMedium",
|
|
2617
|
+
isEnabled: isEnabled,
|
|
2618
|
+
icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null)
|
|
2619
|
+
}, /*#__PURE__*/React__namespace.createElement(material.Button, {
|
|
2620
|
+
className: "deleteBtnMedium",
|
|
2621
|
+
variant: "tertiary",
|
|
2622
|
+
onClick: onClickDelete,
|
|
2623
|
+
startIcon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
|
|
2624
|
+
sx: {
|
|
2625
|
+
display: 'none'
|
|
2626
|
+
}
|
|
2627
|
+
}, "Delete")), /*#__PURE__*/React__namespace.createElement(ManagerButton, {
|
|
2449
2628
|
tooltipTitle: tooltipTitle,
|
|
2450
2629
|
onClick: onClickDelete,
|
|
2451
2630
|
icon: /*#__PURE__*/React__namespace.createElement(theme.Delete, null),
|
|
2452
2631
|
testId: "deleteButton",
|
|
2453
2632
|
isEnabled: isEnabled
|
|
2454
|
-
});
|
|
2633
|
+
}));
|
|
2455
2634
|
};
|
|
2456
2635
|
|
|
2457
2636
|
/* *
|
|
@@ -2473,9 +2652,13 @@
|
|
|
2473
2652
|
var EnableButton = function EnableButton(_a) {
|
|
2474
2653
|
var isEnabled = _a.isEnabled,
|
|
2475
2654
|
title = _a.title,
|
|
2476
|
-
onChangeEnableLayer = _a.onChangeEnableLayer
|
|
2655
|
+
onChangeEnableLayer = _a.onChangeEnableLayer,
|
|
2656
|
+
className = _a.className,
|
|
2657
|
+
_b = _a.id,
|
|
2658
|
+
id = _b === void 0 ? 'enableButton' : _b;
|
|
2477
2659
|
|
|
2478
|
-
var onClick = function onClick() {
|
|
2660
|
+
var onClick = function onClick(event) {
|
|
2661
|
+
event.stopPropagation();
|
|
2479
2662
|
onChangeEnableLayer(!isEnabled);
|
|
2480
2663
|
};
|
|
2481
2664
|
|
|
@@ -2503,8 +2686,9 @@
|
|
|
2503
2686
|
disableFocusRipple: true,
|
|
2504
2687
|
tabIndex: -1
|
|
2505
2688
|
}),
|
|
2506
|
-
testId:
|
|
2507
|
-
isEnabled: isEnabled
|
|
2689
|
+
testId: id,
|
|
2690
|
+
isEnabled: isEnabled,
|
|
2691
|
+
className: className
|
|
2508
2692
|
});
|
|
2509
2693
|
};
|
|
2510
2694
|
|
|
@@ -2553,11 +2737,6 @@
|
|
|
2553
2737
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2554
2738
|
}
|
|
2555
2739
|
},
|
|
2556
|
-
'&:focus&.MuiButton-root': {
|
|
2557
|
-
outline: function outline(theme) {
|
|
2558
|
-
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2559
|
-
}
|
|
2560
|
-
},
|
|
2561
2740
|
'& .MuiSvgIcon-root': {
|
|
2562
2741
|
transition: 'none',
|
|
2563
2742
|
fill: function fill(theme) {
|
|
@@ -2583,10 +2762,11 @@
|
|
|
2583
2762
|
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2584
2763
|
},
|
|
2585
2764
|
'&:focus&.MuiButton-root': {
|
|
2586
|
-
|
|
2765
|
+
border: function border(theme) {
|
|
2587
2766
|
return theme.palette.geowebColors.buttons.focusDefault.outline;
|
|
2588
2767
|
},
|
|
2589
|
-
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill'
|
|
2768
|
+
backgroundColor: 'geowebColors.buttons.tool.mouseOver.fill',
|
|
2769
|
+
transition: 'border'
|
|
2590
2770
|
}
|
|
2591
2771
|
};
|
|
2592
2772
|
|
|
@@ -2628,7 +2808,7 @@
|
|
|
2628
2808
|
selectOpen = _f[0],
|
|
2629
2809
|
setSelectOpen = _f[1];
|
|
2630
2810
|
|
|
2631
|
-
var _g = __read(
|
|
2811
|
+
var _g = __read(useControlledTooltip(), 2),
|
|
2632
2812
|
tooltipOpen = _g[0],
|
|
2633
2813
|
setTooltipOpen = _g[1];
|
|
2634
2814
|
|
|
@@ -2643,23 +2823,23 @@
|
|
|
2643
2823
|
var onOpen = React__namespace.useCallback(function () {
|
|
2644
2824
|
setSelectOpen(true);
|
|
2645
2825
|
setTooltipOpen(false);
|
|
2646
|
-
}, []);
|
|
2826
|
+
}, [setTooltipOpen]);
|
|
2647
2827
|
var onClose = React__namespace.useCallback(function () {
|
|
2648
2828
|
setSelectOpen(false);
|
|
2649
2829
|
}, []);
|
|
2650
2830
|
var onMouseEnter = React__namespace.useCallback(function () {
|
|
2651
2831
|
if (!selectOpen) setTooltipOpen(true);
|
|
2652
|
-
}, [selectOpen]);
|
|
2832
|
+
}, [selectOpen, setTooltipOpen]);
|
|
2653
2833
|
var onMouseLeave = React__namespace.useCallback(function () {
|
|
2654
2834
|
setTooltipOpen(false);
|
|
2655
|
-
}, []);
|
|
2835
|
+
}, [setTooltipOpen]);
|
|
2656
2836
|
var onFocus = React__namespace.useCallback(function () {
|
|
2657
2837
|
setTooltipOpen(true);
|
|
2658
|
-
}, []);
|
|
2838
|
+
}, [setTooltipOpen]);
|
|
2659
2839
|
var onBlur = React__namespace.useCallback(function () {
|
|
2660
2840
|
setTooltipOpen(false);
|
|
2661
|
-
}, []);
|
|
2662
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
2841
|
+
}, [setTooltipOpen]);
|
|
2842
|
+
return /*#__PURE__*/React__namespace.createElement(CustomTooltip, {
|
|
2663
2843
|
title: tooltip,
|
|
2664
2844
|
placement: "top",
|
|
2665
2845
|
open: tooltipOpen,
|
|
@@ -2718,6 +2898,64 @@
|
|
|
2718
2898
|
}, otherProps)));
|
|
2719
2899
|
};
|
|
2720
2900
|
|
|
2901
|
+
function withEggs(eggs) {
|
|
2902
|
+
return function (Component) {
|
|
2903
|
+
var WithEggs = function WithEggs(props) {
|
|
2904
|
+
var store = reactRedux.useStore();
|
|
2905
|
+
|
|
2906
|
+
var _a = __read(React__namespace.useState(function () {
|
|
2907
|
+
return store.addEggs(eggs);
|
|
2908
|
+
}), 1),
|
|
2909
|
+
remover = _a[0];
|
|
2910
|
+
|
|
2911
|
+
React__namespace.useEffect(function () {
|
|
2912
|
+
return remover;
|
|
2913
|
+
}, [remover]);
|
|
2914
|
+
return /*#__PURE__*/React__namespace.createElement(Component, __assign({}, props));
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
WithEggs.displayName = "withEggs(" + (Component.displayName || Component.name || 'Component') + ")";
|
|
2918
|
+
return WithEggs;
|
|
2919
|
+
};
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
var CustomAccordion = function CustomAccordion(_a) {
|
|
2923
|
+
var title = _a.title,
|
|
2924
|
+
_b = _a.defaultExpanded,
|
|
2925
|
+
defaultExpanded = _b === void 0 ? true : _b,
|
|
2926
|
+
_c = _a.disableGutters,
|
|
2927
|
+
disableGutters = _c === void 0 ? true : _c,
|
|
2928
|
+
_d = _a.expandedElevation,
|
|
2929
|
+
expandedElevation = _d === void 0 ? 3 : _d,
|
|
2930
|
+
_e = _a.collapsedElevation,
|
|
2931
|
+
collapsedElevation = _e === void 0 ? 0 : _e,
|
|
2932
|
+
_f = _a.transitionDuration,
|
|
2933
|
+
transitionDuration = _f === void 0 ? 150 : _f,
|
|
2934
|
+
detailsSx = _a.detailsSx,
|
|
2935
|
+
children = _a.children,
|
|
2936
|
+
props = __rest(_a, ["title", "defaultExpanded", "disableGutters", "expandedElevation", "collapsedElevation", "transitionDuration", "detailsSx", "children"]);
|
|
2937
|
+
|
|
2938
|
+
var _g = __read(React__namespace.useState(defaultExpanded), 2),
|
|
2939
|
+
expanded = _g[0],
|
|
2940
|
+
setExpanded = _g[1];
|
|
2941
|
+
|
|
2942
|
+
return /*#__PURE__*/React__namespace.createElement(material.Accordion, __assign({}, props, {
|
|
2943
|
+
defaultExpanded: defaultExpanded,
|
|
2944
|
+
elevation: expanded ? expandedElevation : collapsedElevation,
|
|
2945
|
+
onChange: function onChange(_event, expanded) {
|
|
2946
|
+
return setExpanded(expanded);
|
|
2947
|
+
},
|
|
2948
|
+
disableGutters: disableGutters,
|
|
2949
|
+
TransitionProps: {
|
|
2950
|
+
timeout: transitionDuration
|
|
2951
|
+
}
|
|
2952
|
+
}), /*#__PURE__*/React__namespace.createElement(material.AccordionSummary, {
|
|
2953
|
+
expandIcon: /*#__PURE__*/React__namespace.createElement(theme.ChevronDown, null)
|
|
2954
|
+
}, title), /*#__PURE__*/React__namespace.createElement(material.AccordionDetails, {
|
|
2955
|
+
sx: detailsSx
|
|
2956
|
+
}, children));
|
|
2957
|
+
};
|
|
2958
|
+
|
|
2721
2959
|
/* *
|
|
2722
2960
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2723
2961
|
* you may not use this file except in compliance with the License.
|
|
@@ -2780,6 +3018,26 @@
|
|
|
2780
3018
|
return '';
|
|
2781
3019
|
};
|
|
2782
3020
|
|
|
3021
|
+
/* *
|
|
3022
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3023
|
+
* you may not use this file except in compliance with the License.
|
|
3024
|
+
* You may obtain a copy of the License at
|
|
3025
|
+
*
|
|
3026
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3027
|
+
*
|
|
3028
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3029
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3030
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3031
|
+
* See the License for the specific language governing permissions and
|
|
3032
|
+
* limitations under the License.
|
|
3033
|
+
*
|
|
3034
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3035
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3036
|
+
* */
|
|
3037
|
+
// TODO: https://gitlab.com/opengeoweb/geoweb-assets/-/issues/2350
|
|
3038
|
+
// temporary check until we get the unit test passing with container queries
|
|
3039
|
+
var IS_JEST = typeof jest !== 'undefined';
|
|
3040
|
+
|
|
2783
3041
|
exports.AlertBanner = AlertBanner;
|
|
2784
3042
|
exports.AlertIcon = AlertIcon;
|
|
2785
3043
|
exports.AppHeader = AppHeader;
|
|
@@ -2787,13 +3045,16 @@
|
|
|
2787
3045
|
exports.Avatar = Avatar;
|
|
2788
3046
|
exports.ConfirmationDialog = ConfirmationDialog;
|
|
2789
3047
|
exports.ConfirmationServiceProvider = ConfirmationServiceProvider;
|
|
3048
|
+
exports.CustomAccordion = CustomAccordion;
|
|
2790
3049
|
exports.CustomSlider = CustomSlider;
|
|
2791
3050
|
exports.CustomToggleButton = CustomToggleButton;
|
|
3051
|
+
exports.CustomTooltip = CustomTooltip;
|
|
2792
3052
|
exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
|
|
2793
3053
|
exports.Draggable = DraggableComponent$1;
|
|
2794
3054
|
exports.EnableButton = EnableButton;
|
|
2795
3055
|
exports.ErrorBoundary = ErrorBoundary;
|
|
2796
3056
|
exports.HIDDEN_INPUT_HELPER_IS_DRAFT = HIDDEN_INPUT_HELPER_IS_DRAFT;
|
|
3057
|
+
exports.IS_JEST = IS_JEST;
|
|
2797
3058
|
exports.ManagerButton = ManagerButton;
|
|
2798
3059
|
exports.ManagerDeleteButton = ManagerDeleteButton;
|
|
2799
3060
|
exports.Resizable = ResizeComponent;
|
|
@@ -2808,7 +3069,9 @@
|
|
|
2808
3069
|
exports.UserMenu = UserMenu;
|
|
2809
3070
|
exports.UserMenuItemCheatSheet = UserMenuItemCheatSheet;
|
|
2810
3071
|
exports.UserMenuItemTheme = MenuItemTheme;
|
|
3072
|
+
exports.adjustPosition = adjustPosition;
|
|
2811
3073
|
exports.calculateDialogSizeAndPosition = calculateDialogSizeAndPosition;
|
|
3074
|
+
exports.defaultDelay = defaultDelay;
|
|
2812
3075
|
exports.getAxiosErrorMessage = getAxiosErrorMessage;
|
|
2813
3076
|
exports.getAxiosWarningMessage = getAxiosWarningMessage;
|
|
2814
3077
|
exports.getErrorMessage = getErrorMessage;
|
|
@@ -2820,13 +3083,16 @@
|
|
|
2820
3083
|
exports.sliderHeaderStyle = sliderHeaderStyle;
|
|
2821
3084
|
exports.tooltipContainerStyles = tooltipContainerStyles;
|
|
2822
3085
|
exports.useConfirmationDialog = useConfirmationDialog;
|
|
3086
|
+
exports.useControlledTooltip = useControlledTooltip;
|
|
2823
3087
|
exports.useDialogActions = useDialogActions;
|
|
2824
3088
|
exports.useDraftFormHelpers = useDraftFormHelpers;
|
|
2825
3089
|
exports.useIsMounted = useIsMounted;
|
|
3090
|
+
exports.useMakeSureContainerStaysInsideWindow = useMakeSureContainerStaysInsideWindow;
|
|
2826
3091
|
exports.usePoller = usePoller;
|
|
2827
3092
|
exports.usePreventBrowserClose = usePreventBrowserClose;
|
|
2828
3093
|
exports.usePrevious = usePrevious;
|
|
2829
3094
|
exports.useUserMenu = useUserMenu;
|
|
3095
|
+
exports.withEggs = withEggs;
|
|
2830
3096
|
|
|
2831
3097
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2832
3098
|
|