@opengeoweb/shared 4.9.1 → 4.10.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 +36 -37
- package/index.umd.js +36 -35
- package/lib/components/ToolContainer/ToolContainerDraggable.d.ts +2 -0
- package/package.json +3 -3
package/index.esm.js
CHANGED
|
@@ -1172,10 +1172,10 @@ var ResizeComponent = function ResizeComponent(_a) {
|
|
|
1172
1172
|
right: false,
|
|
1173
1173
|
bottom: false,
|
|
1174
1174
|
left: false,
|
|
1175
|
-
topRight:
|
|
1175
|
+
topRight: true,
|
|
1176
1176
|
bottomRight: true,
|
|
1177
1177
|
bottomLeft: true,
|
|
1178
|
-
topLeft:
|
|
1178
|
+
topLeft: true
|
|
1179
1179
|
},
|
|
1180
1180
|
onResizeStart: onStartResize
|
|
1181
1181
|
}, props), children);
|
|
@@ -1882,6 +1882,31 @@ var calculateDialogSizeAndPosition = function calculateDialogSizeAndPosition() {
|
|
|
1882
1882
|
};
|
|
1883
1883
|
};
|
|
1884
1884
|
var BASE_Z_INDEX = 100;
|
|
1885
|
+
var calculateNewPosition = function calculateNewPosition(position, isRightAligned, handle, delta) {
|
|
1886
|
+
var x = position.x,
|
|
1887
|
+
y = position.y; // If dragging the same side as alignment, adjust position
|
|
1888
|
+
|
|
1889
|
+
if (isRightAligned && handle === 'bottomRight') {
|
|
1890
|
+
x = position.x + delta.width;
|
|
1891
|
+
} else if (!isRightAligned && handle === 'bottomLeft') {
|
|
1892
|
+
x = position.x - delta.width;
|
|
1893
|
+
} else if (isRightAligned && handle === 'topRight') {
|
|
1894
|
+
x = position.x + delta.width;
|
|
1895
|
+
y = position.y - delta.height;
|
|
1896
|
+
} else if (isRightAligned && handle === 'topLeft') {
|
|
1897
|
+
y = position.y - delta.height;
|
|
1898
|
+
} else if (!isRightAligned && handle === 'topRight') {
|
|
1899
|
+
y = position.y - delta.height;
|
|
1900
|
+
} else if (!isRightAligned && handle === 'topLeft') {
|
|
1901
|
+
x = position.x - delta.width;
|
|
1902
|
+
y = position.y - delta.height;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
return {
|
|
1906
|
+
x: x,
|
|
1907
|
+
y: y
|
|
1908
|
+
};
|
|
1909
|
+
};
|
|
1885
1910
|
|
|
1886
1911
|
var DraggableComponent = function DraggableComponent(_a) {
|
|
1887
1912
|
var title = _a.title,
|
|
@@ -1956,17 +1981,11 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1956
1981
|
initialMaxHeight = _React$useState6[0],
|
|
1957
1982
|
setInitialMaxHeight = _React$useState6[1];
|
|
1958
1983
|
|
|
1959
|
-
var _React$useState7 = React__default.useState(0),
|
|
1960
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1961
|
-
initialDragPositionX = _React$useState8[0],
|
|
1962
|
-
setInitialDragPositionX = _React$useState8[1];
|
|
1963
|
-
|
|
1964
1984
|
var onStartResize = function onStartResize() {
|
|
1965
1985
|
setInitialMaxHeight('initial');
|
|
1966
|
-
setInitialDragPositionX(position.x);
|
|
1967
1986
|
};
|
|
1968
1987
|
|
|
1969
|
-
var onResize = React__default.useCallback(function (_event,
|
|
1988
|
+
var onResize = React__default.useCallback(function (_event, handle, node, delta) {
|
|
1970
1989
|
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1971
1990
|
width = _node$getBoundingClie.width,
|
|
1972
1991
|
height = _node$getBoundingClie.height;
|
|
@@ -1974,33 +1993,14 @@ var DraggableComponent = function DraggableComponent(_a) {
|
|
|
1974
1993
|
onChangeSize({
|
|
1975
1994
|
width: width,
|
|
1976
1995
|
height: height
|
|
1977
|
-
});
|
|
1978
|
-
|
|
1979
|
-
if (isRightAligned && _handle === 'bottomRight') {
|
|
1980
|
-
var newX = initialDragPositionX + delta.width; // eslint-disable-next-line no-param-reassign
|
|
1981
|
-
|
|
1982
|
-
node.parentNode.style.transform = "translate(".concat(newX, "px, ").concat(position.y, "px)");
|
|
1983
|
-
} else if (!isRightAligned && _handle === 'bottomLeft') {
|
|
1984
|
-
var _newX = initialDragPositionX - delta.width; // eslint-disable-next-line no-param-reassign
|
|
1985
|
-
|
|
1996
|
+
});
|
|
1997
|
+
var newPos = calculateNewPosition(position, isRightAligned, handle, delta); // eslint-disable-next-line no-param-reassign
|
|
1986
1998
|
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
}, [onChangeSize, initialDragPositionX, isRightAligned, position]);
|
|
1999
|
+
node.parentNode.style.transform = "translate(".concat(newPos.x, "px, ").concat(newPos.y, "px)");
|
|
2000
|
+
}, [onChangeSize, position, isRightAligned]);
|
|
1990
2001
|
|
|
1991
2002
|
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
1992
|
-
|
|
1993
|
-
setPosition({
|
|
1994
|
-
x: initialDragPositionX + delta.width,
|
|
1995
|
-
y: position.y
|
|
1996
|
-
});
|
|
1997
|
-
} else if (!isRightAligned && direction === 'bottomLeft') {
|
|
1998
|
-
setPosition({
|
|
1999
|
-
x: initialDragPositionX - delta.width,
|
|
2000
|
-
y: position.y
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2003
|
+
setPosition(calculateNewPosition(position, isRightAligned, direction, delta));
|
|
2004
2004
|
onResizeStop(_event, direction, node, delta);
|
|
2005
2005
|
};
|
|
2006
2006
|
|
|
@@ -3105,9 +3105,6 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
3105
3105
|
hasBackgroundColor = _a.hasBackgroundColor,
|
|
3106
3106
|
props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
|
|
3107
3107
|
|
|
3108
|
-
props.disableUnderline;
|
|
3109
|
-
var otherProps = __rest(props, ["disableUnderline"]);
|
|
3110
|
-
|
|
3111
3108
|
var _React$useState = React.useState(false),
|
|
3112
3109
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3113
3110
|
selectOpen = _React$useState2[0],
|
|
@@ -3155,6 +3152,8 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
3155
3152
|
placement: "top",
|
|
3156
3153
|
open: tooltipOpen
|
|
3157
3154
|
}, /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
3155
|
+
variant: "standard",
|
|
3156
|
+
disableUnderline: true,
|
|
3158
3157
|
onOpen: onOpen,
|
|
3159
3158
|
onClose: onClose,
|
|
3160
3159
|
onMouseEnter: onMouseEnter,
|
|
@@ -3206,7 +3205,7 @@ var TooltipSelect = function TooltipSelect(_a) {
|
|
|
3206
3205
|
}
|
|
3207
3206
|
},
|
|
3208
3207
|
sx: noStyling ? undefined : tooltipContainerStyles(!!isEnabled, hasBackgroundColor)
|
|
3209
|
-
},
|
|
3208
|
+
}, props)));
|
|
3210
3209
|
};
|
|
3211
3210
|
|
|
3212
3211
|
function withEggs(eggs) {
|
package/index.umd.js
CHANGED
|
@@ -1035,10 +1035,10 @@
|
|
|
1035
1035
|
right: false,
|
|
1036
1036
|
bottom: false,
|
|
1037
1037
|
left: false,
|
|
1038
|
-
topRight:
|
|
1038
|
+
topRight: true,
|
|
1039
1039
|
bottomRight: true,
|
|
1040
1040
|
bottomLeft: true,
|
|
1041
|
-
topLeft:
|
|
1041
|
+
topLeft: true
|
|
1042
1042
|
},
|
|
1043
1043
|
onResizeStart: onStartResize
|
|
1044
1044
|
}, props), children);
|
|
@@ -1739,6 +1739,31 @@
|
|
|
1739
1739
|
};
|
|
1740
1740
|
};
|
|
1741
1741
|
var BASE_Z_INDEX = 100;
|
|
1742
|
+
var calculateNewPosition = function calculateNewPosition(position, isRightAligned, handle, delta) {
|
|
1743
|
+
var x = position.x,
|
|
1744
|
+
y = position.y; // If dragging the same side as alignment, adjust position
|
|
1745
|
+
|
|
1746
|
+
if (isRightAligned && handle === 'bottomRight') {
|
|
1747
|
+
x = position.x + delta.width;
|
|
1748
|
+
} else if (!isRightAligned && handle === 'bottomLeft') {
|
|
1749
|
+
x = position.x - delta.width;
|
|
1750
|
+
} else if (isRightAligned && handle === 'topRight') {
|
|
1751
|
+
x = position.x + delta.width;
|
|
1752
|
+
y = position.y - delta.height;
|
|
1753
|
+
} else if (isRightAligned && handle === 'topLeft') {
|
|
1754
|
+
y = position.y - delta.height;
|
|
1755
|
+
} else if (!isRightAligned && handle === 'topRight') {
|
|
1756
|
+
y = position.y - delta.height;
|
|
1757
|
+
} else if (!isRightAligned && handle === 'topLeft') {
|
|
1758
|
+
x = position.x - delta.width;
|
|
1759
|
+
y = position.y - delta.height;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
return {
|
|
1763
|
+
x: x,
|
|
1764
|
+
y: y
|
|
1765
|
+
};
|
|
1766
|
+
};
|
|
1742
1767
|
|
|
1743
1768
|
var DraggableComponent = function DraggableComponent(_a) {
|
|
1744
1769
|
var title = _a.title,
|
|
@@ -1810,16 +1835,11 @@
|
|
|
1810
1835
|
initialMaxHeight = _v[0],
|
|
1811
1836
|
setInitialMaxHeight = _v[1];
|
|
1812
1837
|
|
|
1813
|
-
var _w = __read(React__default["default"].useState(0), 2),
|
|
1814
|
-
initialDragPositionX = _w[0],
|
|
1815
|
-
setInitialDragPositionX = _w[1];
|
|
1816
|
-
|
|
1817
1838
|
var onStartResize = function onStartResize() {
|
|
1818
1839
|
setInitialMaxHeight('initial');
|
|
1819
|
-
setInitialDragPositionX(position.x);
|
|
1820
1840
|
};
|
|
1821
1841
|
|
|
1822
|
-
var onResize = React__default["default"].useCallback(function (_event,
|
|
1842
|
+
var onResize = React__default["default"].useCallback(function (_event, handle, node, delta) {
|
|
1823
1843
|
var _a = node.getBoundingClientRect(),
|
|
1824
1844
|
width = _a.width,
|
|
1825
1845
|
height = _a.height;
|
|
@@ -1827,32 +1847,14 @@
|
|
|
1827
1847
|
onChangeSize({
|
|
1828
1848
|
width: width,
|
|
1829
1849
|
height: height
|
|
1830
|
-
});
|
|
1831
|
-
|
|
1832
|
-
if (isRightAligned && _handle === 'bottomRight') {
|
|
1833
|
-
var newX = initialDragPositionX + delta.width; // eslint-disable-next-line no-param-reassign
|
|
1850
|
+
});
|
|
1851
|
+
var newPos = calculateNewPosition(position, isRightAligned, handle, delta); // eslint-disable-next-line no-param-reassign
|
|
1834
1852
|
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
var newX = initialDragPositionX - delta.width; // eslint-disable-next-line no-param-reassign
|
|
1838
|
-
|
|
1839
|
-
node.parentNode.style.transform = "translate(" + newX + "px, " + position.y + "px)";
|
|
1840
|
-
}
|
|
1841
|
-
}, [onChangeSize, initialDragPositionX, isRightAligned, position]);
|
|
1853
|
+
node.parentNode.style.transform = "translate(" + newPos.x + "px, " + newPos.y + "px)";
|
|
1854
|
+
}, [onChangeSize, position, isRightAligned]);
|
|
1842
1855
|
|
|
1843
1856
|
var onStopResize = function onStopResize(_event, direction, node, delta) {
|
|
1844
|
-
|
|
1845
|
-
setPosition({
|
|
1846
|
-
x: initialDragPositionX + delta.width,
|
|
1847
|
-
y: position.y
|
|
1848
|
-
});
|
|
1849
|
-
} else if (!isRightAligned && direction === 'bottomLeft') {
|
|
1850
|
-
setPosition({
|
|
1851
|
-
x: initialDragPositionX - delta.width,
|
|
1852
|
-
y: position.y
|
|
1853
|
-
});
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1857
|
+
setPosition(calculateNewPosition(position, isRightAligned, direction, delta));
|
|
1856
1858
|
onResizeStop(_event, direction, node, delta);
|
|
1857
1859
|
};
|
|
1858
1860
|
|
|
@@ -2976,9 +2978,6 @@
|
|
|
2976
2978
|
hasBackgroundColor = _a.hasBackgroundColor,
|
|
2977
2979
|
props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
|
|
2978
2980
|
|
|
2979
|
-
props.disableUnderline;
|
|
2980
|
-
var otherProps = __rest(props, ["disableUnderline"]);
|
|
2981
|
-
|
|
2982
2981
|
var _f = __read(React__namespace.useState(false), 2),
|
|
2983
2982
|
selectOpen = _f[0],
|
|
2984
2983
|
setSelectOpen = _f[1];
|
|
@@ -3024,6 +3023,8 @@
|
|
|
3024
3023
|
placement: "top",
|
|
3025
3024
|
open: tooltipOpen
|
|
3026
3025
|
}, /*#__PURE__*/React__namespace.createElement(material.Select, __assign({
|
|
3026
|
+
variant: "standard",
|
|
3027
|
+
disableUnderline: true,
|
|
3027
3028
|
onOpen: onOpen,
|
|
3028
3029
|
onClose: onClose,
|
|
3029
3030
|
onMouseEnter: onMouseEnter,
|
|
@@ -3075,7 +3076,7 @@
|
|
|
3075
3076
|
}
|
|
3076
3077
|
},
|
|
3077
3078
|
sx: noStyling ? undefined : tooltipContainerStyles(!!isEnabled, hasBackgroundColor)
|
|
3078
|
-
},
|
|
3079
|
+
}, props)));
|
|
3079
3080
|
};
|
|
3080
3081
|
|
|
3081
3082
|
function withEggs(eggs) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/material';
|
|
3
|
+
import { NumberSize } from 're-resizable';
|
|
3
4
|
import { DraggablePosition } from '../DraggableResizable/Draggable';
|
|
4
5
|
import { Position, ResizableComponentProps, Size } from '../DraggableResizable/types';
|
|
5
6
|
import { HeaderSize } from './types';
|
|
@@ -27,5 +28,6 @@ interface DraggableComponentProps extends Omit<ResizableComponentProps, 'bounds'
|
|
|
27
28
|
rightHeaderComponent?: React.ReactNode;
|
|
28
29
|
sx?: SxProps;
|
|
29
30
|
}
|
|
31
|
+
export declare const calculateNewPosition: (position: DraggablePosition, isRightAligned: boolean, handle: string, delta: NumberSize) => DraggablePosition;
|
|
30
32
|
declare const DraggableComponent: React.FC<DraggableComponentProps>;
|
|
31
33
|
export default DraggableComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/shared",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^17.0.2",
|
|
16
16
|
"@mui/material": "^5.10.8",
|
|
17
|
-
"@opengeoweb/theme": "4.
|
|
17
|
+
"@opengeoweb/theme": "4.10.0",
|
|
18
18
|
"react-draggable": "^4.4.5",
|
|
19
19
|
"re-resizable": "^6.9.0",
|
|
20
20
|
"@redux-eggs/core": "^2.2.0",
|
|
21
21
|
"react-redux": "^8.0.4",
|
|
22
|
-
"@opengeoweb/form-fields": "4.
|
|
22
|
+
"@opengeoweb/form-fields": "4.10.0",
|
|
23
23
|
"react-hook-form": "^7.41.5",
|
|
24
24
|
"moment": "^2.29.0",
|
|
25
25
|
"moment-timezone": "^0.5.31",
|