@blaze-cms/plugin-google-maps-fe 0.124.0-alpha.3 → 0.124.0-alpha.32
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 +238 -0
- package/lib/GoogleMaps/GoogleMaps.js +9 -6
- package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsFactory.js +3 -1
- package/lib/GoogleMaps/GoogleMapsFactory.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsHtml.js +32 -0
- package/lib/GoogleMaps/GoogleMapsHtml.js.map +1 -0
- package/lib/GoogleMaps/GoogleMapsRender.js +3 -1
- package/lib/GoogleMaps/GoogleMapsRender.js.map +1 -1
- package/lib/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-map-shapes.js +23 -18
- package/lib/GoogleMaps/helpers/build-map-shapes.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-map-type-ids.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-query.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-shapes-configs.js +11 -3
- package/lib/GoogleMaps/helpers/build-shapes-configs.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-center-coordinates.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-image-ids.js.map +1 -1
- package/lib/GoogleMaps/helpers/get-path.js.map +1 -1
- package/lib/GoogleMaps/helpers/index.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-map-options.js +3 -1
- package/lib/GoogleMaps/helpers/set-map-options.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-shapes.js +35 -11
- package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib/GoogleMaps/hooks/index.js.map +1 -1
- package/lib/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -1
- package/lib/GoogleMaps/hooks/use-get-images.js.map +1 -1
- package/lib/GoogleMaps/index.js.map +1 -1
- package/lib/GoogleMaps/queries.js +4 -4
- package/lib/GoogleMaps/queries.js.map +1 -1
- package/lib/constants.js +5 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMaps.js +3 -3
- package/lib-es/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMapsFactory.js +2 -1
- package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMapsHtml.js +18 -0
- package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsRender.js +2 -1
- package/lib-es/GoogleMaps/GoogleMapsRender.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js +10 -20
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-query.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +8 -4
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/get-path.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/index.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/set-map-options.js +4 -2
- package/lib-es/GoogleMaps/helpers/set-map-options.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/set-shapes.js +37 -11
- package/lib-es/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib-es/GoogleMaps/hooks/index.js.map +1 -1
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -1
- package/lib-es/GoogleMaps/hooks/use-get-images.js.map +1 -1
- package/lib-es/GoogleMaps/index.js.map +1 -1
- package/lib-es/GoogleMaps/queries.js +5 -0
- package/lib-es/GoogleMaps/queries.js.map +1 -1
- package/lib-es/constants.js +3 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +4 -4
- package/src/GoogleMaps/GoogleMaps.js +2 -1
- package/src/GoogleMaps/GoogleMapsFactory.js +2 -1
- package/src/GoogleMaps/GoogleMapsHtml.js +16 -0
- package/src/GoogleMaps/GoogleMapsRender.js +2 -1
- package/src/GoogleMaps/helpers/build-map-shapes.js +1 -18
- package/src/GoogleMaps/helpers/build-shapes-configs.js +8 -4
- package/src/GoogleMaps/helpers/set-map-options.js +5 -2
- package/src/GoogleMaps/helpers/set-shapes.js +43 -11
- package/src/GoogleMaps/queries.js +5 -0
- package/src/constants.js +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["GoogleMapsFactory"],"sources":["../../src/GoogleMaps/index.js"],"sourcesContent":["import GoogleMapsFactory from './GoogleMapsFactory';\n\nexport default GoogleMapsFactory;\n"],"mappings":"AAAA,OAAOA,iBAAP,MAA8B,qBAA9B;AAEA,eAAeA,iBAAf"}
|
|
@@ -2,10 +2,12 @@ import { gql } from '@apollo/client';
|
|
|
2
2
|
const GET_ENTITY_SCHEMAS = gql`
|
|
3
3
|
query getEntitySchemas($identifier: String) {
|
|
4
4
|
getEntitySchemas(identifier: $identifier) {
|
|
5
|
+
id
|
|
5
6
|
identifier
|
|
6
7
|
actions
|
|
7
8
|
dynamicProperties
|
|
8
9
|
properties
|
|
10
|
+
relations
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
`;
|
|
@@ -24,12 +26,14 @@ const generateWhereQuery = queryString => gql`
|
|
|
24
26
|
|
|
25
27
|
const generateQueryString = (action, query, props) => `
|
|
26
28
|
${query}: ${action}(where: $where){
|
|
29
|
+
id
|
|
27
30
|
${props}
|
|
28
31
|
}
|
|
29
32
|
`;
|
|
30
33
|
|
|
31
34
|
const generateIdsQuery = (query, props, action, ids) => `
|
|
32
35
|
${query}: ${action}(where: { id: { _in: ${JSON.stringify(ids)} } }){
|
|
36
|
+
id
|
|
33
37
|
${props}
|
|
34
38
|
}
|
|
35
39
|
`;
|
|
@@ -38,6 +42,7 @@ const generateFiltersQuery = (query, props, rawQUery, filterQueryKey) => `
|
|
|
38
42
|
${query}: searchPublishedContent(rawQueryStringified: ${JSON.stringify(rawQUery)}){
|
|
39
43
|
results {
|
|
40
44
|
...on ${filterQueryKey} {
|
|
45
|
+
id
|
|
41
46
|
${props}
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"queries.js","names":["gql","GET_ENTITY_SCHEMAS","generateQuery","queryString","generateWhereQuery","generateQueryString","action","query","props","generateIdsQuery","ids","JSON","stringify","generateFiltersQuery","rawQUery","filterQueryKey"],"sources":["../../src/GoogleMaps/queries.js"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst GET_ENTITY_SCHEMAS = gql`\n query getEntitySchemas($identifier: String) {\n getEntitySchemas(identifier: $identifier) {\n id\n identifier\n actions\n dynamicProperties\n properties\n relations\n }\n }\n`;\n\nconst generateQuery = queryString => gql`\n query getEntityData {\n ${queryString}\n }\n`;\n\nconst generateWhereQuery = queryString => gql`\n query getEntityData($where: JSON){\n ${queryString}\n }\n`;\nconst generateQueryString = (action, query, props) => `\n ${query}: ${action}(where: $where){\n id\n ${props}\n }\n`;\n\nconst generateIdsQuery = (query, props, action, ids) => `\n ${query}: ${action}(where: { id: { _in: ${JSON.stringify(ids)} } }){\n id\n ${props}\n }\n`;\n\nconst generateFiltersQuery = (query, props, rawQUery, filterQueryKey) => `\n ${query}: searchPublishedContent(rawQueryStringified: ${JSON.stringify(rawQUery)}){\n results {\n ...on ${filterQueryKey} {\n id\n ${props}\n }\n }\n }\n`;\n\nexport {\n GET_ENTITY_SCHEMAS,\n generateQuery,\n generateQueryString,\n generateIdsQuery,\n generateFiltersQuery,\n generateWhereQuery\n};\n"],"mappings":"AAAA,SAASA,GAAT,QAAoB,gBAApB;AAEA,MAAMC,kBAAkB,GAAGD,GAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAXA;;AAaA,MAAME,aAAa,GAAGC,WAAW,IAAIH,GAAI;AACzC;AACA,MAAMG,WAAY;AAClB;AACA,CAJA;;AAMA,MAAMC,kBAAkB,GAAGD,WAAW,IAAIH,GAAI;AAC9C;AACA,MAAMG,WAAY;AAClB;AACA,CAJA;;AAKA,MAAME,mBAAmB,GAAG,CAACC,MAAD,EAASC,KAAT,EAAgBC,KAAhB,KAA2B;AACvD,IAAID,KAAM,KAAID,MAAO;AACrB;AACA,MAAME,KAAM;AACZ;AACA,CALA;;AAOA,MAAMC,gBAAgB,GAAG,CAACF,KAAD,EAAQC,KAAR,EAAeF,MAAf,EAAuBI,GAAvB,KAAgC;AACzD,IAAIH,KAAM,KAAID,MAAO,wBAAuBK,IAAI,CAACC,SAAL,CAAeF,GAAf,CAAoB;AAChE;AACA,MAAMF,KAAM;AACZ;AACA,CALA;;AAOA,MAAMK,oBAAoB,GAAG,CAACN,KAAD,EAAQC,KAAR,EAAeM,QAAf,EAAyBC,cAAzB,KAA6C;AAC1E,IAAIR,KAAM,kDAAiDI,IAAI,CAACC,SAAL,CAAeE,QAAf,CAAyB;AACpF;AACA,cAAcC,cAAe;AAC7B;AACA,UAAUP,KAAM;AAChB;AACA;AACA;AACA,CATA;;AAWA,SACEP,kBADF,EAEEC,aAFF,EAGEG,mBAHF,EAIEI,gBAJF,EAKEI,oBALF,EAMET,kBANF"}
|
package/lib-es/constants.js
CHANGED
|
@@ -84,5 +84,7 @@ const IN_VIEW_CONFIG = {
|
|
|
84
84
|
once: true,
|
|
85
85
|
offset: '200px'
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
const DEFAULT_SELECT_VALUE = 'Default';
|
|
88
|
+
const DEFAULT_CUSTOM_MARKER_PATH = 'M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z';
|
|
89
|
+
export { PLUGIN_NAME, GOOGLE_MAPS_SCRIPT, COOPERATIVE, NONE, LOAD, SCRIPT, ROADMAP, SATELLITE, TERRAIN, MARKER, POLYLINE, POLYGON, RECTANGLE, CIRCLE, DEFAULT_OPTIONS, FILL_OPTIONS, DEFAULT_COLOR, ZOOM_CHANGED, COLOR, IMAGE_ID, URL, ID, CLICK, ELEMENT_GEOMETRY, FEATURE_TYPE_MAP, ALL, HEADING_LARGE, LIST, IN_VIEW_CONFIG, DISABLE_TRANSPORTATION_STYLES, DISABLE_POI_STYLES, DISABLE_BOUNDARIES_STYLES, DISABLE_LABELS_STYLES, DEFAULT_SELECT_VALUE, DEFAULT_CUSTOM_MARKER_PATH };
|
|
88
90
|
//# sourceMappingURL=constants.js.map
|
package/lib-es/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"constants.js","names":["PLUGIN_NAME","GOOGLE_MAPS_SCRIPT","COOPERATIVE","NONE","LOAD","SCRIPT","ROADMAP","SATELLITE","TERRAIN","MARKER","POLYLINE","POLYGON","RECTANGLE","CIRCLE","DEFAULT_COLOR","DEFAULT_OPTIONS","strokeOpacity","strokeWeight","FILL_OPTIONS","fillOpacity","DISABLE_LABELS_STYLES","elementType","stylers","visibility","DISABLE_BOUNDARIES_STYLES","featureType","DISABLE_POI_STYLES","DISABLE_TRANSPORTATION_STYLES","ZOOM_CHANGED","COLOR","IMAGE_ID","URL","ID","CLICK","ELEMENT_GEOMETRY","FEATURE_TYPE_MAP","waterColor","landscapeColor","ALL","HEADING_LARGE","LIST","IN_VIEW_CONFIG","once","offset","DEFAULT_SELECT_VALUE","DEFAULT_CUSTOM_MARKER_PATH"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'google-maps-fe';\nconst GOOGLE_MAPS_SCRIPT = 'https://maps.googleapis.com/maps/api/js?key=';\nconst COOPERATIVE = 'cooperative';\nconst NONE = 'none';\nconst LOAD = 'load';\nconst SCRIPT = 'script';\nconst ROADMAP = 'roadmap';\nconst SATELLITE = 'satellite';\nconst TERRAIN = 'terrain';\nconst MARKER = 'marker';\nconst POLYLINE = 'polyline';\nconst POLYGON = 'polygon';\nconst RECTANGLE = 'rectangle';\nconst CIRCLE = 'circle';\nconst DEFAULT_COLOR = '#FF0000';\nconst DEFAULT_OPTIONS = {\n strokeOpacity: 1.0,\n strokeWeight: 2\n};\nconst FILL_OPTIONS = {\n fillOpacity: 0.35\n};\n\nconst DISABLE_LABELS_STYLES = [\n {\n elementType: 'labels',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n }\n];\n\nconst DISABLE_BOUNDARIES_STYLES = [\n {\n featureType: 'administrative',\n elementType: 'geometry',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n },\n {\n featureType: 'administrative.land_parcel',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n },\n {\n featureType: 'administrative.neighborhood',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n }\n];\n\nconst DISABLE_POI_STYLES = [\n {\n featureType: 'poi',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n }\n];\n\nconst DISABLE_TRANSPORTATION_STYLES = [\n {\n featureType: 'road',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n },\n {\n featureType: 'road',\n elementType: 'labels.icon',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n },\n {\n featureType: 'transit',\n stylers: [\n {\n visibility: 'off'\n }\n ]\n }\n];\n\nconst ZOOM_CHANGED = 'zoom_changed';\nconst COLOR = 'Color';\nconst IMAGE_ID = 'imageId';\nconst URL = 'url';\nconst ID = 'id';\nconst CLICK = 'click';\nconst ELEMENT_GEOMETRY = 'geometry.fill';\n\nconst FEATURE_TYPE_MAP = {\n waterColor: 'water',\n landscapeColor: 'landscape'\n};\n\nconst ALL = 'all';\n\nconst HEADING_LARGE = 'heading_large';\nconst LIST = 'list';\n\nconst IN_VIEW_CONFIG = {\n once: true,\n offset: '200px'\n};\n\nconst DEFAULT_SELECT_VALUE = 'Default';\n\nconst DEFAULT_CUSTOM_MARKER_PATH =\n 'M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z';\n\nexport {\n PLUGIN_NAME,\n GOOGLE_MAPS_SCRIPT,\n COOPERATIVE,\n NONE,\n LOAD,\n SCRIPT,\n ROADMAP,\n SATELLITE,\n TERRAIN,\n MARKER,\n POLYLINE,\n POLYGON,\n RECTANGLE,\n CIRCLE,\n DEFAULT_OPTIONS,\n FILL_OPTIONS,\n DEFAULT_COLOR,\n ZOOM_CHANGED,\n COLOR,\n IMAGE_ID,\n URL,\n ID,\n CLICK,\n ELEMENT_GEOMETRY,\n FEATURE_TYPE_MAP,\n ALL,\n HEADING_LARGE,\n LIST,\n IN_VIEW_CONFIG,\n DISABLE_TRANSPORTATION_STYLES,\n DISABLE_POI_STYLES,\n DISABLE_BOUNDARIES_STYLES,\n DISABLE_LABELS_STYLES,\n DEFAULT_SELECT_VALUE,\n DEFAULT_CUSTOM_MARKER_PATH\n};\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,gBAApB;AACA,MAAMC,kBAAkB,GAAG,8CAA3B;AACA,MAAMC,WAAW,GAAG,aAApB;AACA,MAAMC,IAAI,GAAG,MAAb;AACA,MAAMC,IAAI,GAAG,MAAb;AACA,MAAMC,MAAM,GAAG,QAAf;AACA,MAAMC,OAAO,GAAG,SAAhB;AACA,MAAMC,SAAS,G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|
1
|
+
{"version":3,"file":"index.js","names":["dynamic","pkg","PLUGIN_NAME","load","app","events","once","addComponent","key","component","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'googlemaps',\n component: dynamic(() => import(/* webpackChunkName: \"blazePbGoogleMaps\" */ './GoogleMaps'))\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,cAApB;AACA,OAAOC,GAAP,MAAgB,iBAAhB;AACA,SAASC,WAAT,QAA4B,aAA5B;AAEA,eAAe,eAAeC,IAAf,CAAoBC,GAApB,EAAyB;EACtCA,GAAG,CAACC,MAAJ,CAAWC,IAAX,CAAgB,oCAAhB,EAAsDC,YAAY,IAAI;IACpEA,YAAY,CAAC;MACXC,GAAG,EAAE,YADM;MAEXC,SAAS,EAAET,OAAO,CAAC,MAAM;MAAO;MAA4C,cAAnD,CAAP;IAFP,CAAD,CAAZ;EAID,CALD;EAOA,OAAO;IACLU,IAAI,EAAER,WADD;IAELS,OAAO,EAAEV,GAAG,CAACU;EAFR,CAAP;AAID;AAEDR,IAAI,CAACS,UAAL,GAAkBV,WAAlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-google-maps-fe",
|
|
3
|
-
"version": "0.124.0-alpha.
|
|
3
|
+
"version": "0.124.0-alpha.32",
|
|
4
4
|
"description": "Blaze Google maps plugin fe",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/nextjs-components": "^0.124.0-alpha.
|
|
31
|
-
"@blaze-cms/react-page-builder": "^0.124.0-alpha.
|
|
30
|
+
"@blaze-cms/nextjs-components": "^0.124.0-alpha.30",
|
|
31
|
+
"@blaze-cms/react-page-builder": "^0.124.0-alpha.32",
|
|
32
32
|
"@blaze-cms/setup-ui": "^0.92.0",
|
|
33
33
|
"core-js": "^3.2.1",
|
|
34
34
|
"lodash.isnumber": "^3.0.3",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"lib/*",
|
|
45
45
|
"lib-es/*"
|
|
46
46
|
],
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "93bbbb662e2b34607a1302233b43648034640432"
|
|
48
48
|
}
|
|
@@ -6,6 +6,7 @@ import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
|
6
6
|
import { functions, isEqual, omit } from 'lodash';
|
|
7
7
|
import { setMapOptions, addZoomListener } from './helpers';
|
|
8
8
|
import { GOOGLE_MAPS_SCRIPT, LOAD, SCRIPT, IN_VIEW_CONFIG } from '../constants';
|
|
9
|
+
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
9
10
|
|
|
10
11
|
const shouldNotUpdate = (props, nextProps) => {
|
|
11
12
|
const [funcs, nextFuncs] = [functions(props), functions(nextProps)];
|
|
@@ -86,7 +87,7 @@ const GoogleMaps = ({
|
|
|
86
87
|
if (map && typeof onMount === `function`) onMount(map, onMountProps);
|
|
87
88
|
if (isIntersecting) addZoomListener(map, router, mapShapes, imageData);
|
|
88
89
|
|
|
89
|
-
return <
|
|
90
|
+
return <GoogleMapsHtml mapRef={mapRef} />;
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
GoogleMaps.propTypes = {
|
|
@@ -3,13 +3,14 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { useGetEntitySchemasAsObj } from '@blaze-cms/react-page-builder';
|
|
4
4
|
import { buildShapesConfig } from './helpers';
|
|
5
5
|
import GoogleMapsRender from './GoogleMapsRender';
|
|
6
|
+
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
6
7
|
|
|
7
8
|
const GoogleMapsFactory = ({ entityGroups, parent, ...otherProps }) => {
|
|
8
9
|
const { data, loading, error } = useGetEntitySchemasAsObj(
|
|
9
10
|
entityGroups.map(({ entity }) => entity)
|
|
10
11
|
);
|
|
11
12
|
|
|
12
|
-
if (loading) return
|
|
13
|
+
if (loading) return <GoogleMapsHtml />;
|
|
13
14
|
if (error) return error.message;
|
|
14
15
|
|
|
15
16
|
const shapeConfigs = buildShapesConfig(data, entityGroups, parent);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const GoogleMapsFactory = ({ mapRef }) => (
|
|
5
|
+
<div className={`google-maps ${!mapRef ? 'loading' : ''}`} ref={mapRef} />
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
GoogleMapsFactory.propTypes = {
|
|
9
|
+
mapRef: PropTypes.object
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
GoogleMapsFactory.defaultProps = {
|
|
13
|
+
mapRef: null
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default GoogleMapsFactory;
|
|
@@ -6,6 +6,7 @@ import { getAction } from '@blaze-cms/react-page-builder';
|
|
|
6
6
|
import { useGetImages } from './hooks';
|
|
7
7
|
import { buildQuery, getImageIds, getCenterCoordinates, buildMapShapes } from './helpers';
|
|
8
8
|
import GoogleMaps from './GoogleMaps';
|
|
9
|
+
import GoogleMapsHtml from './GoogleMapsHtml';
|
|
9
10
|
|
|
10
11
|
const defaultQuery = getAction('getPublishedPages', 'id');
|
|
11
12
|
|
|
@@ -22,7 +23,7 @@ const GoogleMapsRender = ({ shapeConfigs, entityGroups, id, ...otherProps }) =>
|
|
|
22
23
|
loading: imagesLoading,
|
|
23
24
|
error: imagesError
|
|
24
25
|
} = useGetImages(imageIds);
|
|
25
|
-
if (loading || imagesLoading) return
|
|
26
|
+
if (loading || imagesLoading) return <GoogleMapsHtml />;
|
|
26
27
|
if (error || imagesError) return null;
|
|
27
28
|
|
|
28
29
|
const centerCoordinates = getCenterCoordinates(mapShapes, otherProps);
|
|
@@ -22,16 +22,6 @@ const buildMapShapes = (shapesOptions, shapesData) => {
|
|
|
22
22
|
shapesOptions.forEach(shape => {
|
|
23
23
|
const { shapeKey, entityOptions, shapeOptions } = shape;
|
|
24
24
|
const { dataSummaries, enableInfoPane } = entityOptions;
|
|
25
|
-
const {
|
|
26
|
-
imageId,
|
|
27
|
-
label,
|
|
28
|
-
markerHeight,
|
|
29
|
-
markerWidth,
|
|
30
|
-
maxZoom,
|
|
31
|
-
minZoom,
|
|
32
|
-
type,
|
|
33
|
-
useAsCenter
|
|
34
|
-
} = shapeOptions;
|
|
35
25
|
|
|
36
26
|
const shapeData = Array.isArray(shapesData[shapeKey])
|
|
37
27
|
? shapesData[shapeKey]
|
|
@@ -44,19 +34,12 @@ const buildMapShapes = (shapesOptions, shapesData) => {
|
|
|
44
34
|
const { latitude, longitude } = getLatLong(latProp, lonProp, shapeOptions, data);
|
|
45
35
|
|
|
46
36
|
const formatedShape = {
|
|
37
|
+
...shapeOptions,
|
|
47
38
|
latitude,
|
|
48
39
|
longitude,
|
|
49
40
|
dataSummaries,
|
|
50
41
|
enableInfoPane,
|
|
51
|
-
imageId,
|
|
52
|
-
label,
|
|
53
|
-
markerHeight,
|
|
54
|
-
markerWidth,
|
|
55
|
-
maxZoom,
|
|
56
|
-
minZoom,
|
|
57
|
-
type,
|
|
58
42
|
url,
|
|
59
|
-
useAsCenter,
|
|
60
43
|
shapeData: data
|
|
61
44
|
};
|
|
62
45
|
|
|
@@ -39,7 +39,7 @@ const buildFilters = filters => {
|
|
|
39
39
|
const buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {
|
|
40
40
|
const { displayItems = [], filterBy } = shape;
|
|
41
41
|
const { latProp, lonProp, entity } = entityGroup;
|
|
42
|
-
const { actions } = entityData;
|
|
42
|
+
const { actions, relations } = entityData;
|
|
43
43
|
const action = actions ? actions.getAllPublished || actions.getAll : '';
|
|
44
44
|
|
|
45
45
|
const dataSummaryProps = dataSummaries
|
|
@@ -59,7 +59,10 @@ const buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData,
|
|
|
59
59
|
let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';
|
|
60
60
|
propsQuery = getUpdatedPropsQuery(propsQuery, entityData);
|
|
61
61
|
if (latProp && lonProp) {
|
|
62
|
-
propsQuery = `${propsQuery} ${formatProp(latProp)} ${formatProp(
|
|
62
|
+
propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(
|
|
63
|
+
lonProp,
|
|
64
|
+
relations
|
|
65
|
+
)}`;
|
|
63
66
|
}
|
|
64
67
|
if (ids.length && !propsQuery.includes(ID)) propsQuery = `${propsQuery.trim()} ${ID}`;
|
|
65
68
|
|
|
@@ -73,11 +76,12 @@ const buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData,
|
|
|
73
76
|
};
|
|
74
77
|
};
|
|
75
78
|
|
|
76
|
-
const formatProp = prop => {
|
|
79
|
+
const formatProp = (prop, relations = []) => {
|
|
77
80
|
if (!prop.includes('.')) return prop;
|
|
78
81
|
|
|
79
82
|
const [mainProp, nestedProp] = prop.split('.');
|
|
80
|
-
|
|
83
|
+
const idProp = relations.find(({ localField }) => localField === mainProp) ? 'id ' : '';
|
|
84
|
+
return `${mainProp}{${idProp}${nestedProp}}`;
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
const buildShapesConfig = (schemas, entityGroups, parent) => {
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
DISABLE_TRANSPORTATION_STYLES,
|
|
9
9
|
DISABLE_POI_STYLES,
|
|
10
10
|
DISABLE_BOUNDARIES_STYLES,
|
|
11
|
-
DISABLE_LABELS_STYLES
|
|
11
|
+
DISABLE_LABELS_STYLES,
|
|
12
|
+
DEFAULT_SELECT_VALUE
|
|
12
13
|
} from '../../constants';
|
|
13
14
|
|
|
14
15
|
const setCustomColor = (featureType, color, elementType) =>
|
|
@@ -60,7 +61,8 @@ const setMapOptions = otherProps => {
|
|
|
60
61
|
enableTerrainScreen,
|
|
61
62
|
waterColor,
|
|
62
63
|
landscapeColor,
|
|
63
|
-
landscapeColorAll
|
|
64
|
+
landscapeColorAll,
|
|
65
|
+
mapType
|
|
64
66
|
} = otherProps;
|
|
65
67
|
|
|
66
68
|
const customColors = [
|
|
@@ -85,6 +87,7 @@ const setMapOptions = otherProps => {
|
|
|
85
87
|
mapTypeControlOptions: {
|
|
86
88
|
mapTypeIds: buildMapTypeIds(enableSatelliteView, enableTerrainScreen)
|
|
87
89
|
},
|
|
90
|
+
mapTypeId: !mapType || mapType === DEFAULT_SELECT_VALUE ? undefined : mapType,
|
|
88
91
|
styles: customColors
|
|
89
92
|
};
|
|
90
93
|
};
|
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
COLOR,
|
|
18
18
|
CLICK,
|
|
19
19
|
HEADING_LARGE,
|
|
20
|
-
LIST
|
|
20
|
+
LIST,
|
|
21
|
+
DEFAULT_CUSTOM_MARKER_PATH
|
|
21
22
|
} from '../../constants';
|
|
22
23
|
|
|
23
24
|
const shapesArray = [];
|
|
@@ -142,23 +143,54 @@ const infoWindowContent = async (imageData, dataSummaries, url, shapeData) => {
|
|
|
142
143
|
);
|
|
143
144
|
};
|
|
144
145
|
|
|
146
|
+
function getIcon(imageData, shape) {
|
|
147
|
+
const {
|
|
148
|
+
imageId,
|
|
149
|
+
markerWidth = 50,
|
|
150
|
+
markerHeight = 50,
|
|
151
|
+
strokeColor,
|
|
152
|
+
strokeOpacity,
|
|
153
|
+
strokeWeight,
|
|
154
|
+
fillColor,
|
|
155
|
+
fillOpacity,
|
|
156
|
+
svgPath
|
|
157
|
+
} = shape;
|
|
158
|
+
const iconUrl = getIconUrl(imageId, imageData);
|
|
159
|
+
|
|
160
|
+
const icon = iconUrl
|
|
161
|
+
? {
|
|
162
|
+
url: iconUrl,
|
|
163
|
+
scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)
|
|
164
|
+
}
|
|
165
|
+
: null;
|
|
166
|
+
|
|
167
|
+
if (icon) return icon;
|
|
168
|
+
|
|
169
|
+
if (!svgPath && !fillColor && !strokeColor) return {}; // any can be true for custom marker
|
|
170
|
+
|
|
171
|
+
const svgMarker = {
|
|
172
|
+
path: svgPath || DEFAULT_CUSTOM_MARKER_PATH,
|
|
173
|
+
strokeColor,
|
|
174
|
+
strokeOpacity,
|
|
175
|
+
strokeWeight,
|
|
176
|
+
fillColor,
|
|
177
|
+
fillOpacity,
|
|
178
|
+
rotation: 0,
|
|
179
|
+
scale: 2
|
|
180
|
+
};
|
|
181
|
+
return svgMarker;
|
|
182
|
+
}
|
|
183
|
+
|
|
145
184
|
const setMarker = (map, router, shape, imageData) => {
|
|
146
|
-
const { label = '',
|
|
185
|
+
const { label = '', latitude, longitude } = shape;
|
|
147
186
|
|
|
148
187
|
if (isPositionCorrect(latitude, longitude)) {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
const icon = iconUrl
|
|
152
|
-
? {
|
|
153
|
-
url: iconUrl,
|
|
154
|
-
scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)
|
|
155
|
-
}
|
|
156
|
-
: {};
|
|
188
|
+
const svgMarker = getIcon(imageData, shape);
|
|
157
189
|
|
|
158
190
|
const marker = new window.google.maps.Marker({
|
|
159
191
|
position: { lat: latitude, lng: longitude },
|
|
160
192
|
map,
|
|
161
|
-
icon,
|
|
193
|
+
icon: svgMarker,
|
|
162
194
|
title: label || ''
|
|
163
195
|
});
|
|
164
196
|
|
|
@@ -3,10 +3,12 @@ import { gql } from '@apollo/client';
|
|
|
3
3
|
const GET_ENTITY_SCHEMAS = gql`
|
|
4
4
|
query getEntitySchemas($identifier: String) {
|
|
5
5
|
getEntitySchemas(identifier: $identifier) {
|
|
6
|
+
id
|
|
6
7
|
identifier
|
|
7
8
|
actions
|
|
8
9
|
dynamicProperties
|
|
9
10
|
properties
|
|
11
|
+
relations
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
`;
|
|
@@ -24,12 +26,14 @@ const generateWhereQuery = queryString => gql`
|
|
|
24
26
|
`;
|
|
25
27
|
const generateQueryString = (action, query, props) => `
|
|
26
28
|
${query}: ${action}(where: $where){
|
|
29
|
+
id
|
|
27
30
|
${props}
|
|
28
31
|
}
|
|
29
32
|
`;
|
|
30
33
|
|
|
31
34
|
const generateIdsQuery = (query, props, action, ids) => `
|
|
32
35
|
${query}: ${action}(where: { id: { _in: ${JSON.stringify(ids)} } }){
|
|
36
|
+
id
|
|
33
37
|
${props}
|
|
34
38
|
}
|
|
35
39
|
`;
|
|
@@ -38,6 +42,7 @@ const generateFiltersQuery = (query, props, rawQUery, filterQueryKey) => `
|
|
|
38
42
|
${query}: searchPublishedContent(rawQueryStringified: ${JSON.stringify(rawQUery)}){
|
|
39
43
|
results {
|
|
40
44
|
...on ${filterQueryKey} {
|
|
45
|
+
id
|
|
41
46
|
${props}
|
|
42
47
|
}
|
|
43
48
|
}
|
package/src/constants.js
CHANGED
|
@@ -122,6 +122,11 @@ const IN_VIEW_CONFIG = {
|
|
|
122
122
|
offset: '200px'
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
+
const DEFAULT_SELECT_VALUE = 'Default';
|
|
126
|
+
|
|
127
|
+
const DEFAULT_CUSTOM_MARKER_PATH =
|
|
128
|
+
'M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z';
|
|
129
|
+
|
|
125
130
|
export {
|
|
126
131
|
PLUGIN_NAME,
|
|
127
132
|
GOOGLE_MAPS_SCRIPT,
|
|
@@ -155,5 +160,7 @@ export {
|
|
|
155
160
|
DISABLE_TRANSPORTATION_STYLES,
|
|
156
161
|
DISABLE_POI_STYLES,
|
|
157
162
|
DISABLE_BOUNDARIES_STYLES,
|
|
158
|
-
DISABLE_LABELS_STYLES
|
|
163
|
+
DISABLE_LABELS_STYLES,
|
|
164
|
+
DEFAULT_SELECT_VALUE,
|
|
165
|
+
DEFAULT_CUSTOM_MARKER_PATH
|
|
159
166
|
};
|