@lowdefy/blocks-google-maps 4.0.0-alpha.26 → 4.0.0-alpha.29
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/package.json +7 -8
- package/dist/blocks/GoogleMaps/GoogleMaps.js +0 -30
- package/dist/blocks/GoogleMaps/GoogleMaps.json +0 -135
- package/dist/blocks/GoogleMapsHeatmap/GoogleMapsHeatmap.js +0 -63
- package/dist/blocks/GoogleMapsHeatmap/GoogleMapsHeatmap.json +0 -135
- package/dist/blocks/GoogleMapsScript/GoogleMapsScript.js +0 -44
- package/dist/blocks/GoogleMapsScript/GoogleMapsScript.json +0 -46
- package/dist/blocks/Map.js +0 -132
- package/dist/blocks.js +0 -17
- package/dist/types.js +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/blocks-google-maps",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.29",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Google Maps Blocks for Lowdefy.",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -34,24 +34,23 @@
|
|
|
34
34
|
"dist/*"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "
|
|
37
|
+
"build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && pnpm copyfiles",
|
|
38
38
|
"clean": "rm -rf dist",
|
|
39
39
|
"copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
|
|
40
|
-
"
|
|
41
|
-
"swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && yarn copyfiles",
|
|
40
|
+
"prepublishOnly": "pnpm build",
|
|
42
41
|
"test:watch": "jest --coverage --watch",
|
|
43
42
|
"test": "jest --coverage"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"@lowdefy/block-utils": "4.0.0-alpha.
|
|
45
|
+
"@lowdefy/block-utils": "4.0.0-alpha.29",
|
|
47
46
|
"@react-google-maps/api": "2.12.0",
|
|
48
47
|
"react": "18.1.0",
|
|
49
48
|
"react-dom": "18.1.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@emotion/jest": "11.9.1",
|
|
53
|
-
"@lowdefy/block-dev": "4.0.0-alpha.
|
|
54
|
-
"@lowdefy/jest-yaml-transform": "4.0.0-alpha.
|
|
52
|
+
"@lowdefy/block-dev": "4.0.0-alpha.29",
|
|
53
|
+
"@lowdefy/jest-yaml-transform": "4.0.0-alpha.29",
|
|
55
54
|
"@swc/cli": "0.1.57",
|
|
56
55
|
"@swc/core": "1.2.194",
|
|
57
56
|
"@swc/jest": "0.2.21",
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"publishConfig": {
|
|
67
66
|
"access": "public"
|
|
68
67
|
},
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
|
|
70
69
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import React from 'react';
|
|
16
|
-
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
17
|
-
import Map from '../Map.js';
|
|
18
|
-
const GoogleMaps = ({ blockId , content , methods , properties })=>/*#__PURE__*/ React.createElement(Map, {
|
|
19
|
-
blockId: blockId,
|
|
20
|
-
content: content,
|
|
21
|
-
methods: methods,
|
|
22
|
-
properties: properties
|
|
23
|
-
});
|
|
24
|
-
GoogleMaps.defaultProps = blockDefaultProps;
|
|
25
|
-
GoogleMaps.meta = {
|
|
26
|
-
category: 'container',
|
|
27
|
-
icons: [],
|
|
28
|
-
styles: []
|
|
29
|
-
};
|
|
30
|
-
export default GoogleMaps;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "object",
|
|
3
|
-
"properties": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"properties": {
|
|
7
|
-
"map": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"description": "Map settings object.",
|
|
10
|
-
"properties": {
|
|
11
|
-
"center": {
|
|
12
|
-
"type": "object",
|
|
13
|
-
"description": "A coordinate position object by which to center the map.",
|
|
14
|
-
"properties": {
|
|
15
|
-
"lat": {
|
|
16
|
-
"type": "number",
|
|
17
|
-
"description": "Lateral coordinate."
|
|
18
|
-
},
|
|
19
|
-
"lng": {
|
|
20
|
-
"type": "number",
|
|
21
|
-
"description": "Longitudinal coordinate."
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"zoom": {
|
|
26
|
-
"type": "number",
|
|
27
|
-
"description": "Map zoom level."
|
|
28
|
-
},
|
|
29
|
-
"options": {
|
|
30
|
-
"type": "object",
|
|
31
|
-
"description": "Map options, see <a href='https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions'>more</a>."
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"heatmap": {
|
|
36
|
-
"type": "object",
|
|
37
|
-
"description": "Add a heatmap layer, see more <a href='https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions'>heatmap options</a>. This will automatically load the 'visualization' library.",
|
|
38
|
-
"properties": {
|
|
39
|
-
"data": {
|
|
40
|
-
"type": "array",
|
|
41
|
-
"description": "A list of heatmap data points.",
|
|
42
|
-
"items": {
|
|
43
|
-
"type": "object",
|
|
44
|
-
"properties": {
|
|
45
|
-
"lat": {
|
|
46
|
-
"type": "number",
|
|
47
|
-
"description": "Lateral coordinate."
|
|
48
|
-
},
|
|
49
|
-
"lng": {
|
|
50
|
-
"type": "number",
|
|
51
|
-
"description": "Longitudinal coordinate."
|
|
52
|
-
},
|
|
53
|
-
"weight": {
|
|
54
|
-
"type": "number",
|
|
55
|
-
"description": "Item weight on heatmap."
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"markers": {
|
|
63
|
-
"type": "array",
|
|
64
|
-
"description": "A list of Markers with marker options.",
|
|
65
|
-
"items": {
|
|
66
|
-
"type": "object",
|
|
67
|
-
"properties": {
|
|
68
|
-
"position": {
|
|
69
|
-
"type": "object",
|
|
70
|
-
"properties": {
|
|
71
|
-
"lat": {
|
|
72
|
-
"type": "number",
|
|
73
|
-
"description": "Lateral coordinate."
|
|
74
|
-
},
|
|
75
|
-
"lng": {
|
|
76
|
-
"type": "number",
|
|
77
|
-
"description": "Longitudinal coordinate."
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"label": {
|
|
82
|
-
"type": "string",
|
|
83
|
-
"description": "Label displayed on marker."
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"infoWindow": {
|
|
89
|
-
"type": "object",
|
|
90
|
-
"description": "infoWindow options, see <a href='https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions'>more</a>.",
|
|
91
|
-
"properties": {
|
|
92
|
-
"visible": {
|
|
93
|
-
"type": "boolean",
|
|
94
|
-
"description": "When visible is true, blocks inside infoWindow content area will be rendered."
|
|
95
|
-
},
|
|
96
|
-
"position": {
|
|
97
|
-
"type": "object",
|
|
98
|
-
"properties": {
|
|
99
|
-
"lat": {
|
|
100
|
-
"type": "number",
|
|
101
|
-
"description": "Lateral coordinate."
|
|
102
|
-
},
|
|
103
|
-
"lng": {
|
|
104
|
-
"type": "number",
|
|
105
|
-
"description": "Longitudinal coordinate."
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"style": {
|
|
112
|
-
"type": "object",
|
|
113
|
-
"description": "Custom map css properties to apply to map block."
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"events": {
|
|
118
|
-
"type": "object",
|
|
119
|
-
"additionalProperties": false,
|
|
120
|
-
"properties": {
|
|
121
|
-
"onClick": {
|
|
122
|
-
"type": "array",
|
|
123
|
-
"description": "Trigger actions when the map is clicked."
|
|
124
|
-
},
|
|
125
|
-
"onMarkerClick": {
|
|
126
|
-
"type": "array",
|
|
127
|
-
"description": "Trigger actions when marker is clicked."
|
|
128
|
-
},
|
|
129
|
-
"onZoomChanged": {
|
|
130
|
-
"type": "array",
|
|
131
|
-
"description": "Trigger actions when the zoom on the map is changed."
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign || function(target) {
|
|
3
|
-
for(var i = 1; i < arguments.length; i++){
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for(var key in source){
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
-
target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
return _extends.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
/* eslint-disable react/jsx-props-no-spreading */ /*
|
|
16
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
17
|
-
|
|
18
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
you may not use this file except in compliance with the License.
|
|
20
|
-
You may obtain a copy of the License at
|
|
21
|
-
|
|
22
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
|
|
24
|
-
Unless required by applicable law or agreed to in writing, software
|
|
25
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
-
See the License for the specific language governing permissions and
|
|
28
|
-
limitations under the License.
|
|
29
|
-
*/ import React from 'react';
|
|
30
|
-
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
31
|
-
import { HeatmapLayer } from '@react-google-maps/api';
|
|
32
|
-
import Map from '../Map.js';
|
|
33
|
-
function updateHeatmap(data) {
|
|
34
|
-
if (data.location) {
|
|
35
|
-
const latLng = new window.google.maps.LatLng(data.location);
|
|
36
|
-
latLng.weight = data.weight || 1;
|
|
37
|
-
return latLng;
|
|
38
|
-
}
|
|
39
|
-
return new window.google.maps.LatLng(data);
|
|
40
|
-
}
|
|
41
|
-
const GoogleMapsHeatmap = ({ blockId , content , methods , properties })=>/*#__PURE__*/ React.createElement(Map, {
|
|
42
|
-
blockId: blockId,
|
|
43
|
-
content: content,
|
|
44
|
-
methods: methods,
|
|
45
|
-
properties: properties
|
|
46
|
-
}, (map, bounds)=>map && bounds && properties.heatmap && /*#__PURE__*/ React.createElement(HeatmapLayer, _extends({}, properties.heatmap, {
|
|
47
|
-
data: properties.heatmap?.data && window.google && (properties.heatmap?.data || []).map((item)=>updateHeatmap(item)),
|
|
48
|
-
onLoad: ()=>{
|
|
49
|
-
if (properties.autoBounds !== false && bounds && map) {
|
|
50
|
-
(properties.heatmap?.data || []).forEach((item)=>{
|
|
51
|
-
bounds.extend(item);
|
|
52
|
-
});
|
|
53
|
-
map.fitBounds(bounds);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
})));
|
|
57
|
-
GoogleMapsHeatmap.defaultProps = blockDefaultProps;
|
|
58
|
-
GoogleMapsHeatmap.meta = {
|
|
59
|
-
category: 'container',
|
|
60
|
-
icons: [],
|
|
61
|
-
styles: []
|
|
62
|
-
};
|
|
63
|
-
export default GoogleMapsHeatmap;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "object",
|
|
3
|
-
"properties": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"properties": {
|
|
7
|
-
"map": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"description": "Map settings object.",
|
|
10
|
-
"properties": {
|
|
11
|
-
"center": {
|
|
12
|
-
"type": "object",
|
|
13
|
-
"description": "A coordinate position object by which to center the map.",
|
|
14
|
-
"properties": {
|
|
15
|
-
"lat": {
|
|
16
|
-
"type": "number",
|
|
17
|
-
"description": "Lateral coordinate."
|
|
18
|
-
},
|
|
19
|
-
"lng": {
|
|
20
|
-
"type": "number",
|
|
21
|
-
"description": "Longitudinal coordinate."
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"zoom": {
|
|
26
|
-
"type": "number",
|
|
27
|
-
"description": "Map zoom level."
|
|
28
|
-
},
|
|
29
|
-
"options": {
|
|
30
|
-
"type": "object",
|
|
31
|
-
"description": "Map options, see <a href='https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions'>more</a>."
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"heatmap": {
|
|
36
|
-
"type": "object",
|
|
37
|
-
"description": "Add a heatmap layer, see more <a href='https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions'>heatmap options</a>. This will automatically load the 'visualization' library.",
|
|
38
|
-
"properties": {
|
|
39
|
-
"data": {
|
|
40
|
-
"type": "array",
|
|
41
|
-
"description": "A list of heatmap data points.",
|
|
42
|
-
"items": {
|
|
43
|
-
"type": "object",
|
|
44
|
-
"properties": {
|
|
45
|
-
"lat": {
|
|
46
|
-
"type": "number",
|
|
47
|
-
"description": "Lateral coordinate."
|
|
48
|
-
},
|
|
49
|
-
"lng": {
|
|
50
|
-
"type": "number",
|
|
51
|
-
"description": "Longitudinal coordinate."
|
|
52
|
-
},
|
|
53
|
-
"weight": {
|
|
54
|
-
"type": "number",
|
|
55
|
-
"description": "Item weight on heatmap."
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"markers": {
|
|
63
|
-
"type": "array",
|
|
64
|
-
"description": "A list of Markers with marker options.",
|
|
65
|
-
"items": {
|
|
66
|
-
"type": "object",
|
|
67
|
-
"properties": {
|
|
68
|
-
"position": {
|
|
69
|
-
"type": "object",
|
|
70
|
-
"properties": {
|
|
71
|
-
"lat": {
|
|
72
|
-
"type": "number",
|
|
73
|
-
"description": "Lateral coordinate."
|
|
74
|
-
},
|
|
75
|
-
"lng": {
|
|
76
|
-
"type": "number",
|
|
77
|
-
"description": "Longitudinal coordinate."
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"label": {
|
|
82
|
-
"type": "string",
|
|
83
|
-
"description": "Label displayed on marker."
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"infoWindow": {
|
|
89
|
-
"type": "object",
|
|
90
|
-
"description": "infoWindow options, see <a href='https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions'>more</a>.",
|
|
91
|
-
"properties": {
|
|
92
|
-
"visible": {
|
|
93
|
-
"type": "boolean",
|
|
94
|
-
"description": "When visible is true, blocks inside infoWindow content area will be rendered."
|
|
95
|
-
},
|
|
96
|
-
"position": {
|
|
97
|
-
"type": "object",
|
|
98
|
-
"properties": {
|
|
99
|
-
"lat": {
|
|
100
|
-
"type": "number",
|
|
101
|
-
"description": "Lateral coordinate."
|
|
102
|
-
},
|
|
103
|
-
"lng": {
|
|
104
|
-
"type": "number",
|
|
105
|
-
"description": "Longitudinal coordinate."
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"style": {
|
|
112
|
-
"type": "object",
|
|
113
|
-
"description": "Custom map css properties to apply to map block."
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"events": {
|
|
118
|
-
"type": "object",
|
|
119
|
-
"additionalProperties": false,
|
|
120
|
-
"properties": {
|
|
121
|
-
"onClick": {
|
|
122
|
-
"type": "array",
|
|
123
|
-
"description": "Trigger actions when the map is clicked."
|
|
124
|
-
},
|
|
125
|
-
"onMarkerClick": {
|
|
126
|
-
"type": "array",
|
|
127
|
-
"description": "Trigger actions when marker is clicked."
|
|
128
|
-
},
|
|
129
|
-
"onZoomChanged": {
|
|
130
|
-
"type": "array",
|
|
131
|
-
"description": "Trigger actions when the zoom on the map is changed."
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import React from 'react';
|
|
16
|
-
import { LoadScriptNext } from '@react-google-maps/api';
|
|
17
|
-
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
-
let GoogleMapsScript = class GoogleMapsScript extends React.Component {
|
|
19
|
-
render() {
|
|
20
|
-
const { blockId , properties , content } = this.props;
|
|
21
|
-
return /*#__PURE__*/ React.createElement(LoadScriptNext, {
|
|
22
|
-
id: blockId,
|
|
23
|
-
channel: properties.channel,
|
|
24
|
-
googleMapsApiKey: properties.apiKey,
|
|
25
|
-
language: properties.language,
|
|
26
|
-
libraries: this.libraries,
|
|
27
|
-
region: properties.region,
|
|
28
|
-
version: properties.version
|
|
29
|
-
}, content.content && content.content());
|
|
30
|
-
}
|
|
31
|
-
constructor(props){
|
|
32
|
-
super(props);
|
|
33
|
-
this.libraries = [
|
|
34
|
-
...new Set(props.properties?.libraries || [])
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
GoogleMapsScript.defaultProps = blockDefaultProps;
|
|
39
|
-
GoogleMapsScript.meta = {
|
|
40
|
-
category: 'container',
|
|
41
|
-
icons: [],
|
|
42
|
-
styles: []
|
|
43
|
-
};
|
|
44
|
-
export default GoogleMapsScript;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "object",
|
|
3
|
-
"properties": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"properties": {
|
|
7
|
-
"apiKey": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "Your Google Maps API key."
|
|
10
|
-
},
|
|
11
|
-
"libraries": {
|
|
12
|
-
"type": "array",
|
|
13
|
-
"description": "A list of Google libraries, see <a href='https://developers.google.com/maps/documentation/javascript/libraries'>more</a>.",
|
|
14
|
-
"items": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"enum": [
|
|
17
|
-
"drawing",
|
|
18
|
-
"geometry",
|
|
19
|
-
"journeySharing",
|
|
20
|
-
"localContext",
|
|
21
|
-
"places",
|
|
22
|
-
"visualization"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"events": {
|
|
29
|
-
"type": "object",
|
|
30
|
-
"additionalProperties": false,
|
|
31
|
-
"properties": {
|
|
32
|
-
"onClick": {
|
|
33
|
-
"type": "array",
|
|
34
|
-
"description": "Trigger actions when the map is clicked."
|
|
35
|
-
},
|
|
36
|
-
"onMarkerClick": {
|
|
37
|
-
"type": "array",
|
|
38
|
-
"description": "Trigger actions when marker is clicked."
|
|
39
|
-
},
|
|
40
|
-
"onZoomChanged": {
|
|
41
|
-
"type": "array",
|
|
42
|
-
"description": "Trigger actions when the zoom on the map is changed."
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
package/dist/blocks/Map.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign || function(target) {
|
|
3
|
-
for(var i = 1; i < arguments.length; i++){
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for(var key in source){
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
-
target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
return _extends.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
/* eslint-disable react/jsx-props-no-spreading */ /*
|
|
16
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
17
|
-
|
|
18
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
you may not use this file except in compliance with the License.
|
|
20
|
-
You may obtain a copy of the License at
|
|
21
|
-
|
|
22
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
|
|
24
|
-
Unless required by applicable law or agreed to in writing, software
|
|
25
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
-
See the License for the specific language governing permissions and
|
|
28
|
-
limitations under the License.
|
|
29
|
-
*/ import React, { useState, useEffect } from 'react';
|
|
30
|
-
import { GoogleMap, Marker, InfoWindow } from '@react-google-maps/api';
|
|
31
|
-
const STYLE_DEFAULTS = {
|
|
32
|
-
width: '100%',
|
|
33
|
-
height: '300px'
|
|
34
|
-
};
|
|
35
|
-
const MAP_DEFAULTS = {
|
|
36
|
-
zoom: 3,
|
|
37
|
-
center: {
|
|
38
|
-
lat: 0,
|
|
39
|
-
lng: 0
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const MAP_PROPS = {
|
|
43
|
-
center: {
|
|
44
|
-
lat: 0,
|
|
45
|
-
lng: 0
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
// Implements https://react-google-maps-api-docs.netlify.app/#googlemap
|
|
49
|
-
const Map = ({ blockId , children , content , methods , properties })=>{
|
|
50
|
-
const [map, setMap] = useState();
|
|
51
|
-
const [bounds, setBounds] = useState();
|
|
52
|
-
useEffect(()=>{
|
|
53
|
-
methods.registerMethod('fitBounds', (args)=>{
|
|
54
|
-
if (!bounds || !map) {
|
|
55
|
-
throw new Error('fitBounds can only be called once google maps has been mounted.');
|
|
56
|
-
}
|
|
57
|
-
(args?.bounds ?? []).map((position)=>{
|
|
58
|
-
bounds.extend(position);
|
|
59
|
-
});
|
|
60
|
-
map.fitBounds(bounds);
|
|
61
|
-
if (args.zoom) {
|
|
62
|
-
map.setZoom(args.zoom);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}, [
|
|
66
|
-
bounds,
|
|
67
|
-
map
|
|
68
|
-
]);
|
|
69
|
-
// by default, fit infoWindow and markers to bounds
|
|
70
|
-
if (properties.autoBounds !== false && bounds && map) {
|
|
71
|
-
if (properties.infoWindow) {
|
|
72
|
-
bounds.extend(properties.infoWindow.position ?? MAP_DEFAULTS.center);
|
|
73
|
-
}
|
|
74
|
-
(properties.markers ?? []).map((marker)=>{
|
|
75
|
-
bounds.extend(marker.position);
|
|
76
|
-
});
|
|
77
|
-
if (!properties.map?.center && !properties.map?.zoom) {
|
|
78
|
-
map.fitBounds(bounds);
|
|
79
|
-
}
|
|
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
|
-
}
|
|
84
|
-
return /*#__PURE__*/ React.createElement(GoogleMap, _extends({}, properties.map, {
|
|
85
|
-
id: blockId,
|
|
86
|
-
mapContainerClassName: methods.makeCssClass([
|
|
87
|
-
STYLE_DEFAULTS,
|
|
88
|
-
properties.style
|
|
89
|
-
]),
|
|
90
|
-
center: MAP_PROPS.center,
|
|
91
|
-
zoom: properties.map?.zoom ?? MAP_DEFAULTS.zoom,
|
|
92
|
-
onLoad: (newMap, event)=>{
|
|
93
|
-
setMap(newMap);
|
|
94
|
-
setBounds(new window.google.maps.LatLngBounds());
|
|
95
|
-
methods.triggerEvent({
|
|
96
|
-
name: 'onLoad',
|
|
97
|
-
event
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
onClick: (event)=>{
|
|
101
|
-
methods.triggerEvent({
|
|
102
|
-
name: 'onClick',
|
|
103
|
-
event
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
onZoomChanged: ()=>{
|
|
107
|
-
methods.triggerEvent({
|
|
108
|
-
name: 'onZoomChanged'
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}), (properties.markers ?? []).map((marker, i)=>/*#__PURE__*/ React.createElement(Marker, _extends({}, marker, {
|
|
112
|
-
key: i,
|
|
113
|
-
onClick: (event)=>{
|
|
114
|
-
methods.triggerEvent({
|
|
115
|
-
name: 'onMarkerClick',
|
|
116
|
-
event
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}))), properties.infoWindow?.visible === true && /*#__PURE__*/ React.createElement(InfoWindow, _extends({}, properties.infoWindow, {
|
|
120
|
-
onCloseClick: ()=>{
|
|
121
|
-
methods.triggerEvent({
|
|
122
|
-
name: 'onInfoWindowCloseClick'
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
onPositionChanged: ()=>{
|
|
126
|
-
methods.triggerEvent({
|
|
127
|
-
name: 'onInfoWindowPositionChanged'
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}), content.infoWindow && content.infoWindow()), children && children(map, bounds));
|
|
131
|
-
};
|
|
132
|
-
export default Map;
|
package/dist/blocks.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ export { default as GoogleMaps } from './blocks/GoogleMaps/GoogleMaps.js';
|
|
16
|
-
export { default as GoogleMapsHeatmap } from './blocks/GoogleMapsHeatmap/GoogleMapsHeatmap.js';
|
|
17
|
-
export { default as GoogleMapsScript } from './blocks/GoogleMapsScript/GoogleMapsScript.js';
|
package/dist/types.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/namespace */ /*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import * as blocks from './blocks.js';
|
|
16
|
-
const icons = {};
|
|
17
|
-
const styles = {};
|
|
18
|
-
Object.keys(blocks).forEach((block)=>{
|
|
19
|
-
icons[block] = blocks[block].meta.icons || [];
|
|
20
|
-
styles[block] = blocks[block].meta.styles || [];
|
|
21
|
-
});
|
|
22
|
-
export default {
|
|
23
|
-
blocks: Object.keys(blocks),
|
|
24
|
-
icons,
|
|
25
|
-
styles: {
|
|
26
|
-
default: [],
|
|
27
|
-
...styles
|
|
28
|
-
}
|
|
29
|
-
};
|