drf-react-by-schema 0.28.11 → 0.28.13
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/dist/components/DataGridBySchemaEditable/GeoThumbCell.d.ts.map +1 -1
- package/dist/components/DataGridBySchemaEditable/GeoThumbCell.js +25 -2
- package/dist/components/forms/inputs/MapGeometryPicker.d.ts.map +1 -1
- package/dist/components/forms/inputs/MapGeometryPicker.js +12 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeoThumbCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoThumbCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAQzC,OAAO,EAAE,iBAAiB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"GeoThumbCell.d.ts","sourceRoot":"","sources":["../../../src/components/DataGridBySchemaEditable/GeoThumbCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAQzC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAyD5E,UAAU,iBAAiB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,QAAQ,EACR,KAAK,EACL,KAAwB,EACxB,MAAyB,GAC1B,EAAE,iBAAiB,qBAoCnB"}
|
|
@@ -44,9 +44,32 @@ const styles_1 = require("@mui/material/styles");
|
|
|
44
44
|
const leaflet_1 = __importDefault(require("leaflet"));
|
|
45
45
|
const leafletMarker_1 = require("../forms/inputs/leafletMarker");
|
|
46
46
|
const utils_1 = require("../../utils");
|
|
47
|
+
const MapGeometryPicker_1 = require("../forms/inputs/MapGeometryPicker");
|
|
47
48
|
const geoConstants_1 = require("./geoConstants");
|
|
48
49
|
// L.geoJSON point markers use L.Icon.Default; ensure it points at a servable icon.
|
|
49
50
|
(0, leafletMarker_1.applyDefaultLeafletIcon)();
|
|
51
|
+
/** Renders the base tile layer for the thumbnail.
|
|
52
|
+
* Reads the first entry from theme.mapLayers (same array the picker uses);
|
|
53
|
+
* falls back to DEFAULT_LAYERS[0] (hybrid satellite + labels) when absent. */
|
|
54
|
+
function BaseLayer() {
|
|
55
|
+
const map = (0, react_leaflet_1.useMap)();
|
|
56
|
+
const theme = (0, styles_1.useTheme)();
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
const layers = theme.mapLayers;
|
|
59
|
+
const cfg = layers && layers.length > 0 ? layers[0] : MapGeometryPicker_1.DEFAULT_LAYERS[0];
|
|
60
|
+
if (cfg.title === 'Hybrid') {
|
|
61
|
+
const satellite = leaflet_1.default.tileLayer(cfg.url, { attribution: cfg.attribution });
|
|
62
|
+
const labels = leaflet_1.default.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', { attribution: 'Esri, TomTom, Garmin, FAO, NOAA, USGS, © OpenStreetMap' });
|
|
63
|
+
satellite.addTo(map);
|
|
64
|
+
labels.addTo(map);
|
|
65
|
+
return () => { satellite.remove(); labels.remove(); };
|
|
66
|
+
}
|
|
67
|
+
const tl = leaflet_1.default.tileLayer(cfg.url, { attribution: cfg.attribution });
|
|
68
|
+
tl.addTo(map);
|
|
69
|
+
return () => { tl.remove(); };
|
|
70
|
+
}, [map, theme]);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
50
73
|
// Fits the rendered geometry and keeps the thumb static (no pan/zoom).
|
|
51
74
|
function FitGeometry({ data }) {
|
|
52
75
|
const map = (0, react_leaflet_1.useMap)();
|
|
@@ -85,6 +108,6 @@ function GeoThumbCell({ geometry, value, width = geoConstants_1.GIS_THUMB_SIZE.w
|
|
|
85
108
|
borderColor: 'divider',
|
|
86
109
|
} },
|
|
87
110
|
react_1.default.createElement(react_leaflet_1.MapContainer, { center: [-14.2, -51.9], zoom: 4, style: { width: '100%', height: '100%' }, zoomControl: false, attributionControl: false, dragging: false, scrollWheelZoom: false, doubleClickZoom: false, boxZoom: false, keyboard: false, touchZoom: false },
|
|
88
|
-
react_1.default.createElement(
|
|
89
|
-
react_1.default.createElement(
|
|
111
|
+
react_1.default.createElement(FitGeometry, { data: data }),
|
|
112
|
+
react_1.default.createElement(BaseLayer, null))));
|
|
90
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapGeometryPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/inputs/MapGeometryPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAOxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,sBAAsB,CAAC;AAGhE,OAAO,0BAA0B,CAAC;AAElC,OAAO,cAAc,CAAC;AACtB,OAAO,oCAAoC,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiBjE,eAAO,MAAM,cAAc,EAAE,WAAW,EAgBvC,CAAC;AASF,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"MapGeometryPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/inputs/MapGeometryPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAOxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,sBAAsB,CAAC;AAGhE,OAAO,0BAA0B,CAAC;AAElC,OAAO,cAAc,CAAC;AACtB,OAAO,oCAAoC,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiBjE,eAAO,MAAM,cAAc,EAAE,WAAW,EAgBvC,CAAC;AASF,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuWD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,EAAE,EACF,MAAY,GACb,EAAE,sBAAsB,qBA+HxB"}
|
|
@@ -268,9 +268,18 @@ function DrawEditor({ geometry, value, onChange, }) {
|
|
|
268
268
|
featureGroup.addLayer(layer);
|
|
269
269
|
applyBehaviors(layer);
|
|
270
270
|
});
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
|
|
271
|
+
const g = geometryRef.current;
|
|
272
|
+
if (g === 'point') {
|
|
273
|
+
// Center on the marker at a contextual zoom, not tight-fit.
|
|
274
|
+
const center = featureGroup.getBounds().getCenter();
|
|
275
|
+
if (center)
|
|
276
|
+
map.setView(center, 14);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const bounds = featureGroup.getBounds();
|
|
280
|
+
if (bounds.isValid())
|
|
281
|
+
map.fitBounds(bounds, { padding: [40, 40] });
|
|
282
|
+
}
|
|
274
283
|
};
|
|
275
284
|
(0, react_1.useEffect)(() => {
|
|
276
285
|
applyLeafletDrawLocalization(texts.geometry);
|
package/package.json
CHANGED