@mapcomponents/react-maplibre 0.1.72 → 0.1.73
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/CHANGELOG.md
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -703,7 +703,6 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
703
703
|
_a.label = 2;
|
|
704
704
|
case 2:
|
|
705
705
|
self.map = new maplibreGl.Map(props.mapOptions);
|
|
706
|
-
window['_map'] = self.map;
|
|
707
706
|
self.addNativeMaplibreFunctionsAndProps();
|
|
708
707
|
self.wrapper.refreshViewport();
|
|
709
708
|
self.wrapper.fire('viewportchange');
|
|
@@ -992,6 +991,8 @@ var MapLibreMap = function (props) {
|
|
|
992
991
|
onReady: function (map, wrapper) {
|
|
993
992
|
map.once('load', function () {
|
|
994
993
|
if (!(wrapper === null || wrapper === void 0 ? void 0 : wrapper.cancelled)) {
|
|
994
|
+
// add maplibre instance to window for debugging purposes
|
|
995
|
+
window['_map'] = map;
|
|
995
996
|
if (props.mapId) {
|
|
996
997
|
mapContext.registerMap(props.mapId, wrapper);
|
|
997
998
|
}
|
|
@@ -6909,7 +6910,7 @@ function LayerListFolder(_a) {
|
|
|
6909
6910
|
}
|
|
6910
6911
|
|
|
6911
6912
|
function LayerListItemVectorLayer(_a) {
|
|
6912
|
-
var configurable = _a.configurable, vtProps = _a.vtProps, setVtProps = _a.setVtProps, id = _a.id;
|
|
6913
|
+
var configurable = _a.configurable, vtProps = _a.vtProps, setVtProps = _a.setVtProps, id = _a.id, props = __rest(_a, ["configurable", "vtProps", "setVtProps", "id"]);
|
|
6913
6914
|
var _b = React.useState(false), paintPropsFormVisible = _b[0], setPaintPropsFormVisible = _b[1];
|
|
6914
6915
|
var _c = React.useState(true), visible = _c[0], setVisible = _c[1];
|
|
6915
6916
|
var _d = React.useState(vtProps.layers[id].paint), paintProps = _d[0], setPaintProps = _d[1];
|
|
@@ -6925,6 +6926,9 @@ function LayerListItemVectorLayer(_a) {
|
|
|
6925
6926
|
}
|
|
6926
6927
|
setVtProps(__assign(__assign({}, vtProps), { layers: _layers }));
|
|
6927
6928
|
}, [visible, id, setVtProps, vtProps]);
|
|
6929
|
+
React.useEffect(function () {
|
|
6930
|
+
setVisible(!!props.visibleMaster);
|
|
6931
|
+
}, [props.visibleMaster]);
|
|
6928
6932
|
React.useEffect(function () {
|
|
6929
6933
|
if (!setVtProps)
|
|
6930
6934
|
return;
|
|
@@ -6972,20 +6976,22 @@ function LayerListItem(_a) {
|
|
|
6972
6976
|
return localVisible;
|
|
6973
6977
|
}, [visible, localVisible]);
|
|
6974
6978
|
React.useEffect(function () {
|
|
6975
|
-
var _a, _b;
|
|
6979
|
+
var _a, _b, _c;
|
|
6976
6980
|
if (!setLayerState || !((_a = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _a === void 0 ? void 0 : _a.layers) || _visible === visibleRef.current)
|
|
6977
6981
|
return;
|
|
6978
6982
|
visibleRef.current = _visible;
|
|
6979
6983
|
var state = __assign({}, layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props);
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
el.layout
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6984
|
+
if ((_b = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _b === void 0 ? void 0 : _b.layers) {
|
|
6985
|
+
state.layers = (_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.layers.map(function (el) {
|
|
6986
|
+
if (el.layout) {
|
|
6987
|
+
el.layout['visibility'] = _visible ? 'visible' : 'none';
|
|
6988
|
+
}
|
|
6989
|
+
else {
|
|
6990
|
+
el.layout = { visibility: _visible ? 'visible' : 'none' };
|
|
6991
|
+
}
|
|
6992
|
+
return el;
|
|
6993
|
+
});
|
|
6994
|
+
}
|
|
6989
6995
|
setLayerState(state);
|
|
6990
6996
|
}, [_visible, setLayerState, (_d = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _d === void 0 ? void 0 : _d.layers]);
|
|
6991
6997
|
React.useEffect(function () {
|
|
@@ -6996,7 +7002,7 @@ function LayerListItem(_a) {
|
|
|
6996
7002
|
var _layerComponent = React.useMemo(function () {
|
|
6997
7003
|
var _a;
|
|
6998
7004
|
if (layerComponent && type === 'layer') {
|
|
6999
|
-
switch (layerComponent.type.
|
|
7005
|
+
switch (layerComponent.type.name) {
|
|
7000
7006
|
case 'MlWmsLayer':
|
|
7001
7007
|
return React__default["default"].cloneElement(layerComponent, __assign(__assign({}, layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props), { visible: _visible }));
|
|
7002
7008
|
case 'MlVectorTileLayer':
|
|
@@ -7040,7 +7046,7 @@ function LayerListItem(_a) {
|
|
|
7040
7046
|
React__default["default"].createElement(material.ListItemText, { primary: name, primaryTypographyProps: { sx: { fontSize: '0.9rem' } }, secondary: description, secondaryTypographyProps: { sx: { fontSize: '0.7rem' } } }))),
|
|
7041
7047
|
_layerComponent,
|
|
7042
7048
|
!((_g = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _g === void 0 ? void 0 : _g.layers) && configurable && paintPropsFormVisible && (React__default["default"].createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType })),
|
|
7043
|
-
((_h = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _h === void 0 ? void 0 : _h.layers) && (React__default["default"].createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_l = (_k = (_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) === null || _k === void 0 ? void 0 : _k.map) === null || _l === void 0 ? void 0 : _l.call(_k, function (_el, idx) { return (React__default["default"].createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx })); })))));
|
|
7049
|
+
((_h = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _h === void 0 ? void 0 : _h.layers) && (React__default["default"].createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_l = (_k = (_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) === null || _k === void 0 ? void 0 : _k.map) === null || _l === void 0 ? void 0 : _l.call(_k, function (_el, idx) { return (React__default["default"].createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
7044
7050
|
}
|
|
7045
7051
|
LayerListItem.defaultProps = {
|
|
7046
7052
|
type: 'layer',
|