drf-react-by-schema 0.28.11 → 0.28.12

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.
@@ -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,EAAE,MAAM,cAAc,CAAC;AA8B/D,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,qBAuCnB"}
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;AAwD/D,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"}
@@ -47,6 +47,26 @@ const utils_1 = require("../../utils");
47
47
  const geoConstants_1 = require("./geoConstants");
48
48
  // L.geoJSON point markers use L.Icon.Default; ensure it points at a servable icon.
49
49
  (0, leafletMarker_1.applyDefaultLeafletIcon)();
50
+ // Hybrid tile layer (satellite + labels) used as the default base layer.
51
+ const HYBRID_SATELLITE_URL = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}';
52
+ const HYBRID_LABELS_URL = 'https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}';
53
+ const HYBRID_SATELLITE_ATTR = 'Esri, Maxar, Earthstar Geographics, and the GIS User Community';
54
+ const HYBRID_LABELS_ATTR = 'Esri, TomTom, Garmin, FAO, NOAA, USGS, © OpenStreetMap';
55
+ /** Renders the hybrid satellite + labels base layer (static, no user interaction). */
56
+ function BaseLayer() {
57
+ const map = (0, react_leaflet_1.useMap)();
58
+ (0, react_1.useEffect)(() => {
59
+ const satellite = leaflet_1.default.tileLayer(HYBRID_SATELLITE_URL, { attribution: HYBRID_SATELLITE_ATTR });
60
+ const labels = leaflet_1.default.tileLayer(HYBRID_LABELS_URL, { attribution: HYBRID_LABELS_ATTR });
61
+ satellite.addTo(map);
62
+ labels.addTo(map);
63
+ return () => {
64
+ satellite.remove();
65
+ labels.remove();
66
+ };
67
+ }, [map]);
68
+ return null;
69
+ }
50
70
  // Fits the rendered geometry and keeps the thumb static (no pan/zoom).
51
71
  function FitGeometry({ data }) {
52
72
  const map = (0, react_leaflet_1.useMap)();
@@ -85,6 +105,6 @@ function GeoThumbCell({ geometry, value, width = geoConstants_1.GIS_THUMB_SIZE.w
85
105
  borderColor: 'divider',
86
106
  } },
87
107
  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(react_leaflet_1.TileLayer, { attribution: "\u00A9 OpenStreetMap contributors", url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }),
89
- react_1.default.createElement(FitGeometry, { data: data }))));
108
+ react_1.default.createElement(FitGeometry, { data: data }),
109
+ react_1.default.createElement(BaseLayer, null))));
90
110
  }
@@ -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;AAgWD,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"}
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 bounds = featureGroup.getBounds();
272
- if (bounds.isValid())
273
- map.fitBounds(bounds, { padding: [40, 40] });
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drf-react-by-schema",
3
- "version": "0.28.11",
3
+ "version": "0.28.12",
4
4
  "description": "Components and Tools for building a React App having Django Rest Framework (DRF) as server",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",