@lowdefy/blocks-google-maps 4.0.0-alpha.23 → 4.0.0-alpha.24

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.
Files changed (2) hide show
  1. package/dist/blocks/Map.js +10 -1
  2. package/package.json +5 -5
@@ -39,6 +39,12 @@ const MAP_DEFAULTS = {
39
39
  lng: 0
40
40
  }
41
41
  };
42
+ const MAP_PROPS = {
43
+ center: {
44
+ lat: 0,
45
+ lng: 0
46
+ }
47
+ };
42
48
  // Implements https://react-google-maps-api-docs.netlify.app/#googlemap
43
49
  const Map = ({ blockId , children , content , methods , properties })=>{
44
50
  const [map, setMap] = useState();
@@ -72,13 +78,16 @@ const Map = ({ blockId , children , content , methods , properties })=>{
72
78
  map.fitBounds(bounds);
73
79
  }
74
80
  }
81
+ if (properties.map?.center && (properties.map.center?.lat !== MAP_PROPS.center.lat || properties.map.center?.lng !== MAP_PROPS.center.lng)) {
82
+ MAP_PROPS.center = properties.map.center;
83
+ }
75
84
  return /*#__PURE__*/ React.createElement(GoogleMap, _extends({}, properties.map, {
76
85
  id: blockId,
77
86
  mapContainerClassName: methods.makeCssClass([
78
87
  STYLE_DEFAULTS,
79
88
  properties.style
80
89
  ]),
81
- center: properties.map?.center ?? MAP_DEFAULTS.center,
90
+ center: MAP_PROPS.center,
82
91
  zoom: properties.map?.zoom ?? MAP_DEFAULTS.zoom,
83
92
  onLoad: (newMap, event)=>{
84
93
  setMap(newMap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-google-maps",
3
- "version": "4.0.0-alpha.23",
3
+ "version": "4.0.0-alpha.24",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Google Maps Blocks for Lowdefy.",
6
6
  "homepage": "https://lowdefy.com",
@@ -43,15 +43,15 @@
43
43
  "test": "jest --coverage"
44
44
  },
45
45
  "dependencies": {
46
- "@lowdefy/block-utils": "4.0.0-alpha.23",
46
+ "@lowdefy/block-utils": "4.0.0-alpha.24",
47
47
  "@react-google-maps/api": "2.12.0",
48
48
  "react": "18.1.0",
49
49
  "react-dom": "18.1.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@emotion/jest": "11.9.1",
53
- "@lowdefy/block-dev": "4.0.0-alpha.23",
54
- "@lowdefy/jest-yaml-transform": "4.0.0-alpha.23",
53
+ "@lowdefy/block-dev": "4.0.0-alpha.24",
54
+ "@lowdefy/jest-yaml-transform": "4.0.0-alpha.24",
55
55
  "@swc/cli": "0.1.57",
56
56
  "@swc/core": "1.2.194",
57
57
  "@swc/jest": "0.2.21",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "1bb110fb4432267efb199df926bae6bb735209ca"
69
+ "gitHead": "7ae69eeb9a93964e2fb0bf08b7a21bee2636a630"
70
70
  }