@blaze-cms/plugin-google-maps-fe 0.146.0-rc-eagle.0 → 0.146.0-rc-eagle-3.0
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 +5 -1
- package/lib/GoogleMaps/GoogleMaps.js +2 -1
- package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-shapes.js +2 -1
- package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMaps.js +122 -0
- package/lib-es/GoogleMaps/GoogleMaps.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsFactory.js +41 -0
- package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsHtml.js +16 -0
- package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +1 -0
- package/lib-es/GoogleMaps/GoogleMapsRender.js +72 -0
- package/lib-es/GoogleMaps/GoogleMapsRender.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +9 -0
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js +68 -0
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js +9 -0
- package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-query.js +31 -0
- package/lib-es/GoogleMaps/helpers/build-query.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +124 -0
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +29 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-image-ids.js +13 -0
- package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-path.js +13 -0
- package/lib-es/GoogleMaps/helpers/get-path.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/index.js +9 -0
- package/lib-es/GoogleMaps/helpers/index.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/set-map-options.js +69 -0
- package/lib-es/GoogleMaps/helpers/set-map-options.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/set-shapes.js +309 -0
- package/lib-es/GoogleMaps/helpers/set-shapes.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/index.js +4 -0
- package/lib-es/GoogleMaps/hooks/index.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js +20 -0
- package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -0
- package/lib-es/GoogleMaps/hooks/use-get-images.js +27 -0
- package/lib-es/GoogleMaps/hooks/use-get-images.js.map +1 -0
- package/lib-es/GoogleMaps/index.js +3 -0
- package/lib-es/GoogleMaps/index.js.map +1 -0
- package/lib-es/GoogleMaps/queries.js +47 -0
- package/lib-es/GoogleMaps/queries.js.map +1 -0
- package/lib-es/constants.js +90 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/index.js +17 -0
- package/lib-es/index.js.map +1 -0
- package/package.json +12 -8
- package/babel.config.js +0 -3
- package/jest.config.js +0 -3
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
const getLatLonValues = (keys, data) => {
|
|
5
|
+
if (keys.length === 1) return data[keys];
|
|
6
|
+
const key = keys.shift();
|
|
7
|
+
return getLatLonValues(keys, data[key]);
|
|
8
|
+
};
|
|
9
|
+
const getLatLong = (latProp, lonProp, shape, data) => {
|
|
10
|
+
const {
|
|
11
|
+
latitude,
|
|
12
|
+
longitude
|
|
13
|
+
} = shape;
|
|
14
|
+
if (!latProp || !lonProp) return {
|
|
15
|
+
latitude,
|
|
16
|
+
longitude
|
|
17
|
+
};
|
|
18
|
+
const latKeys = latProp.split('.');
|
|
19
|
+
const lonKeys = lonProp.split('.');
|
|
20
|
+
const lat = getLatLonValues(latKeys, data);
|
|
21
|
+
const lon = getLatLonValues(lonKeys, data);
|
|
22
|
+
return {
|
|
23
|
+
latitude: lat,
|
|
24
|
+
longitude: lon
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const buildMapShapes = (shapesOptions, shapesData) => {
|
|
28
|
+
if (!shapesData) return [];
|
|
29
|
+
const mapShapes = [];
|
|
30
|
+
shapesOptions.forEach(shape => {
|
|
31
|
+
const {
|
|
32
|
+
shapeKey,
|
|
33
|
+
entityOptions,
|
|
34
|
+
shapeOptions
|
|
35
|
+
} = shape;
|
|
36
|
+
const {
|
|
37
|
+
dataSummaries,
|
|
38
|
+
enableInfoPane
|
|
39
|
+
} = entityOptions;
|
|
40
|
+
const shapeData = Array.isArray(shapesData[shapeKey]) ? shapesData[shapeKey] : shapesData[shapeKey].results;
|
|
41
|
+
if (!shapeData) return;
|
|
42
|
+
const {
|
|
43
|
+
latProp,
|
|
44
|
+
lonProp
|
|
45
|
+
} = entityOptions;
|
|
46
|
+
shapeData.forEach(data => {
|
|
47
|
+
const {
|
|
48
|
+
url
|
|
49
|
+
} = data;
|
|
50
|
+
const {
|
|
51
|
+
latitude,
|
|
52
|
+
longitude
|
|
53
|
+
} = getLatLong(latProp, lonProp, shapeOptions, data);
|
|
54
|
+
const formatedShape = _objectSpread(_objectSpread({}, shapeOptions), {}, {
|
|
55
|
+
latitude,
|
|
56
|
+
longitude,
|
|
57
|
+
dataSummaries,
|
|
58
|
+
enableInfoPane,
|
|
59
|
+
url,
|
|
60
|
+
shapeData: data
|
|
61
|
+
});
|
|
62
|
+
mapShapes.push(formatedShape);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
return mapShapes;
|
|
66
|
+
};
|
|
67
|
+
export default buildMapShapes;
|
|
68
|
+
//# sourceMappingURL=build-map-shapes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-map-shapes.js","names":["getLatLonValues","keys","data","length","key","shift","getLatLong","latProp","lonProp","shape","latitude","longitude","latKeys","split","lonKeys","lat","lon","buildMapShapes","shapesOptions","shapesData","mapShapes","forEach","shapeKey","entityOptions","shapeOptions","dataSummaries","enableInfoPane","shapeData","Array","isArray","results","url","formatedShape","_objectSpread","push"],"sources":["../../../src/GoogleMaps/helpers/build-map-shapes.js"],"sourcesContent":["const getLatLonValues = (keys, data) => {\n if (keys.length === 1) return data[keys];\n const key = keys.shift();\n return getLatLonValues(keys, data[key]);\n};\n\nconst getLatLong = (latProp, lonProp, shape, data) => {\n const { latitude, longitude } = shape;\n\n if (!latProp || !lonProp) return { latitude, longitude };\n const latKeys = latProp.split('.');\n const lonKeys = lonProp.split('.');\n const lat = getLatLonValues(latKeys, data);\n const lon = getLatLonValues(lonKeys, data);\n\n return { latitude: lat, longitude: lon };\n};\n\nconst buildMapShapes = (shapesOptions, shapesData) => {\n if (!shapesData) return [];\n const mapShapes = [];\n shapesOptions.forEach(shape => {\n const { shapeKey, entityOptions, shapeOptions } = shape;\n const { dataSummaries, enableInfoPane } = entityOptions;\n\n const shapeData = Array.isArray(shapesData[shapeKey])\n ? shapesData[shapeKey]\n : shapesData[shapeKey].results;\n if (!shapeData) return;\n const { latProp, lonProp } = entityOptions;\n\n shapeData.forEach(data => {\n const { url } = data;\n const { latitude, longitude } = getLatLong(latProp, lonProp, shapeOptions, data);\n\n const formatedShape = {\n ...shapeOptions,\n latitude,\n longitude,\n dataSummaries,\n enableInfoPane,\n url,\n shapeData: data\n };\n\n mapShapes.push(formatedShape);\n });\n });\n\n return mapShapes;\n};\n\nexport default buildMapShapes;\n"],"mappings":";;;AAAA,MAAMA,eAAe,GAAGA,CAACC,IAAI,EAAEC,IAAI,KAAK;EACtC,IAAID,IAAI,CAACE,MAAM,KAAK,CAAC,EAAE,OAAOD,IAAI,CAACD,IAAI,CAAC;EACxC,MAAMG,GAAG,GAAGH,IAAI,CAACI,KAAK,CAAC,CAAC;EACxB,OAAOL,eAAe,CAACC,IAAI,EAAEC,IAAI,CAACE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAME,UAAU,GAAGA,CAACC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAEP,IAAI,KAAK;EACpD,MAAM;IAAEQ,QAAQ;IAAEC;EAAU,CAAC,GAAGF,KAAK;EAErC,IAAI,CAACF,OAAO,IAAI,CAACC,OAAO,EAAE,OAAO;IAAEE,QAAQ;IAAEC;EAAU,CAAC;EACxD,MAAMC,OAAO,GAAGL,OAAO,CAACM,KAAK,CAAC,GAAG,CAAC;EAClC,MAAMC,OAAO,GAAGN,OAAO,CAACK,KAAK,CAAC,GAAG,CAAC;EAClC,MAAME,GAAG,GAAGf,eAAe,CAACY,OAAO,EAAEV,IAAI,CAAC;EAC1C,MAAMc,GAAG,GAAGhB,eAAe,CAACc,OAAO,EAAEZ,IAAI,CAAC;EAE1C,OAAO;IAAEQ,QAAQ,EAAEK,GAAG;IAAEJ,SAAS,EAAEK;EAAI,CAAC;AAC1C,CAAC;AAED,MAAMC,cAAc,GAAGA,CAACC,aAAa,EAAEC,UAAU,KAAK;EACpD,IAAI,CAACA,UAAU,EAAE,OAAO,EAAE;EAC1B,MAAMC,SAAS,GAAG,EAAE;EACpBF,aAAa,CAACG,OAAO,CAACZ,KAAK,IAAI;IAC7B,MAAM;MAAEa,QAAQ;MAAEC,aAAa;MAAEC;IAAa,CAAC,GAAGf,KAAK;IACvD,MAAM;MAAEgB,aAAa;MAAEC;IAAe,CAAC,GAAGH,aAAa;IAEvD,MAAMI,SAAS,GAAGC,KAAK,CAACC,OAAO,CAACV,UAAU,CAACG,QAAQ,CAAC,CAAC,GACjDH,UAAU,CAACG,QAAQ,CAAC,GACpBH,UAAU,CAACG,QAAQ,CAAC,CAACQ,OAAO;IAChC,IAAI,CAACH,SAAS,EAAE;IAChB,MAAM;MAAEpB,OAAO;MAAEC;IAAQ,CAAC,GAAGe,aAAa;IAE1CI,SAAS,CAACN,OAAO,CAACnB,IAAI,IAAI;MACxB,MAAM;QAAE6B;MAAI,CAAC,GAAG7B,IAAI;MACpB,MAAM;QAAEQ,QAAQ;QAAEC;MAAU,CAAC,GAAGL,UAAU,CAACC,OAAO,EAAEC,OAAO,EAAEgB,YAAY,EAAEtB,IAAI,CAAC;MAEhF,MAAM8B,aAAa,GAAAC,aAAA,CAAAA,aAAA,KACdT,YAAY;QACfd,QAAQ;QACRC,SAAS;QACTc,aAAa;QACbC,cAAc;QACdK,GAAG;QACHJ,SAAS,EAAEzB;MAAI,EAChB;MAEDkB,SAAS,CAACc,IAAI,CAACF,aAAa,CAAC;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOZ,SAAS;AAClB,CAAC;AAED,eAAeH,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';
|
|
2
|
+
const buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {
|
|
3
|
+
const mapTypeIds = [ROADMAP];
|
|
4
|
+
if (enableSatelliteView) mapTypeIds.push(SATELLITE);
|
|
5
|
+
if (enableTerrainScreen) mapTypeIds.push(TERRAIN);
|
|
6
|
+
return mapTypeIds;
|
|
7
|
+
};
|
|
8
|
+
export default buildMapTypeIds;
|
|
9
|
+
//# sourceMappingURL=build-map-type-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-map-type-ids.js","names":["ROADMAP","SATELLITE","TERRAIN","buildMapTypeIds","enableSatelliteView","enableTerrainScreen","mapTypeIds","push"],"sources":["../../../src/GoogleMaps/helpers/build-map-type-ids.js"],"sourcesContent":["import { ROADMAP, SATELLITE, TERRAIN } from '../../constants';\n\nconst buildMapTypeIds = (enableSatelliteView, enableTerrainScreen) => {\n const mapTypeIds = [ROADMAP];\n if (enableSatelliteView) mapTypeIds.push(SATELLITE);\n if (enableTerrainScreen) mapTypeIds.push(TERRAIN);\n return mapTypeIds;\n};\n\nexport default buildMapTypeIds;\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,SAAS,EAAEC,OAAO,QAAQ,iBAAiB;AAE7D,MAAMC,eAAe,GAAGA,CAACC,mBAAmB,EAAEC,mBAAmB,KAAK;EACpE,MAAMC,UAAU,GAAG,CAACN,OAAO,CAAC;EAC5B,IAAII,mBAAmB,EAAEE,UAAU,CAACC,IAAI,CAACN,SAAS,CAAC;EACnD,IAAII,mBAAmB,EAAEC,UAAU,CAACC,IAAI,CAACL,OAAO,CAAC;EACjD,OAAOI,UAAU;AACnB,CAAC;AAED,eAAeH,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import upperFirst from 'lodash.upperfirst';
|
|
2
|
+
import camelcase from 'lodash.camelcase';
|
|
3
|
+
import { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';
|
|
4
|
+
const buildQuery = entityConfigs => {
|
|
5
|
+
const entityIds = [];
|
|
6
|
+
const rawQueryStringified = '';
|
|
7
|
+
const queryString = entityConfigs.map(entityConfig => {
|
|
8
|
+
const {
|
|
9
|
+
action,
|
|
10
|
+
ids,
|
|
11
|
+
entity,
|
|
12
|
+
propsQuery,
|
|
13
|
+
shapeKey,
|
|
14
|
+
filtersObject
|
|
15
|
+
} = entityConfig;
|
|
16
|
+
if (!action) return '';
|
|
17
|
+
const formatedEntity = upperFirst(camelcase(entity));
|
|
18
|
+
const filterQueryKey = action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;
|
|
19
|
+
entityIds.push(...ids);
|
|
20
|
+
const props = propsQuery.trim() || 'id';
|
|
21
|
+
const singleItemQuery = filtersObject ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey) : generateIdsQuery(shapeKey, props, action, ids);
|
|
22
|
+
return singleItemQuery;
|
|
23
|
+
}).join(' ');
|
|
24
|
+
return {
|
|
25
|
+
query: queryString ? generateQuery(queryString) : '',
|
|
26
|
+
ids: entityIds,
|
|
27
|
+
rawQueryStringified
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export default buildQuery;
|
|
31
|
+
//# sourceMappingURL=build-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-query.js","names":["upperFirst","camelcase","generateQuery","generateIdsQuery","generateFiltersQuery","buildQuery","entityConfigs","entityIds","rawQueryStringified","queryString","map","entityConfig","action","ids","entity","propsQuery","shapeKey","filtersObject","formatedEntity","filterQueryKey","indexOf","push","props","trim","singleItemQuery","JSON","stringify","join","query"],"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport camelcase from 'lodash.camelcase';\nimport { generateQuery, generateIdsQuery, generateFiltersQuery } from '../queries';\n\nconst buildQuery = entityConfigs => {\n const entityIds = [];\n const rawQueryStringified = '';\n const queryString = entityConfigs\n .map(entityConfig => {\n const { action, ids, entity, propsQuery, shapeKey, filtersObject } = entityConfig;\n if (!action) return '';\n const formatedEntity = upperFirst(camelcase(entity));\n const filterQueryKey =\n action.indexOf('Published') !== -1 ? `Published${formatedEntity}` : formatedEntity;\n\n entityIds.push(...ids);\n const props = propsQuery.trim() || 'id';\n const singleItemQuery = filtersObject\n ? generateFiltersQuery(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey)\n : generateIdsQuery(shapeKey, props, action, ids);\n\n return singleItemQuery;\n })\n .join(' ');\n\n return {\n query: queryString ? generateQuery(queryString) : '',\n ids: entityIds,\n rawQueryStringified\n };\n};\n\nexport default buildQuery;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,SAAS,MAAM,kBAAkB;AACxC,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,oBAAoB,QAAQ,YAAY;AAElF,MAAMC,UAAU,GAAGC,aAAa,IAAI;EAClC,MAAMC,SAAS,GAAG,EAAE;EACpB,MAAMC,mBAAmB,GAAG,EAAE;EAC9B,MAAMC,WAAW,GAAGH,aAAa,CAC9BI,GAAG,CAACC,YAAY,IAAI;IACnB,MAAM;MAAEC,MAAM;MAAEC,GAAG;MAAEC,MAAM;MAAEC,UAAU;MAAEC,QAAQ;MAAEC;IAAc,CAAC,GAAGN,YAAY;IACjF,IAAI,CAACC,MAAM,EAAE,OAAO,EAAE;IACtB,MAAMM,cAAc,GAAGlB,UAAU,CAACC,SAAS,CAACa,MAAM,CAAC,CAAC;IACpD,MAAMK,cAAc,GAClBP,MAAM,CAACQ,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,YAAYF,cAAc,EAAE,GAAGA,cAAc;IAEpFX,SAAS,CAACc,IAAI,CAAC,GAAGR,GAAG,CAAC;IACtB,MAAMS,KAAK,GAAGP,UAAU,CAACQ,IAAI,CAAC,CAAC,IAAI,IAAI;IACvC,MAAMC,eAAe,GAAGP,aAAa,GACjCb,oBAAoB,CAACY,QAAQ,EAAEM,KAAK,EAAEG,IAAI,CAACC,SAAS,CAACT,aAAa,CAAC,EAAEE,cAAc,CAAC,GACpFhB,gBAAgB,CAACa,QAAQ,EAAEM,KAAK,EAAEV,MAAM,EAAEC,GAAG,CAAC;IAElD,OAAOW,eAAe;EACxB,CAAC,CAAC,CACDG,IAAI,CAAC,GAAG,CAAC;EAEZ,OAAO;IACLC,KAAK,EAAEnB,WAAW,GAAGP,aAAa,CAACO,WAAW,CAAC,GAAG,EAAE;IACpDI,GAAG,EAAEN,SAAS;IACdC;EACF,CAAC;AACH,CAAC;AAED,eAAeH,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import flatten from 'lodash.flatten';
|
|
5
|
+
import { IMAGE_ID, URL, ID } from '../../constants';
|
|
6
|
+
const getPropValues = properties => properties.reduce((acc, property) => {
|
|
7
|
+
if (property.includes('.')) {
|
|
8
|
+
const [relationName, relationProp] = property.split('.');
|
|
9
|
+
return `${acc} ${relationName} { ${relationProp} }`;
|
|
10
|
+
}
|
|
11
|
+
return `${acc} ${property}`;
|
|
12
|
+
}, '').trim();
|
|
13
|
+
const getUpdatedPropsQuery = (propsQuery, entityData) => {
|
|
14
|
+
const {
|
|
15
|
+
properties = {},
|
|
16
|
+
dynamicProperties = {}
|
|
17
|
+
} = entityData;
|
|
18
|
+
const [url] = Object.keys(dynamicProperties).filter(prop => prop === URL);
|
|
19
|
+
const hasImage = !!Object.keys(properties).filter(prop => prop === IMAGE_ID).length;
|
|
20
|
+
let updatedPropsQuery = hasImage ? `${propsQuery} ${IMAGE_ID}` : propsQuery;
|
|
21
|
+
updatedPropsQuery = url ? `${updatedPropsQuery} ${URL}` : updatedPropsQuery;
|
|
22
|
+
return updatedPropsQuery;
|
|
23
|
+
};
|
|
24
|
+
const buildFilterQueryString = filter => {
|
|
25
|
+
const [filterKey, filterValue] = filter.split('/');
|
|
26
|
+
const filterKeyword = `${filterKey}.keyword`;
|
|
27
|
+
return {
|
|
28
|
+
bool: {
|
|
29
|
+
should: [{
|
|
30
|
+
match: {
|
|
31
|
+
[filterKeyword]: filterValue
|
|
32
|
+
}
|
|
33
|
+
}]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const buildFilters = filters => {
|
|
38
|
+
if (!filters || !filters.length) return null;
|
|
39
|
+
const filterQueryProps = filters.map(buildFilterQueryString);
|
|
40
|
+
return {
|
|
41
|
+
bool: {
|
|
42
|
+
should: filterQueryProps
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {
|
|
47
|
+
const {
|
|
48
|
+
displayItems = [],
|
|
49
|
+
filterBy
|
|
50
|
+
} = shape;
|
|
51
|
+
const {
|
|
52
|
+
latProp,
|
|
53
|
+
lonProp,
|
|
54
|
+
entity
|
|
55
|
+
} = entityGroup;
|
|
56
|
+
const {
|
|
57
|
+
actions,
|
|
58
|
+
relations
|
|
59
|
+
} = entityData;
|
|
60
|
+
const action = actions ? actions.getAllPublished || actions.getAll : '';
|
|
61
|
+
const dataSummaryProps = dataSummaries.reduce((acc, {
|
|
62
|
+
propsToDisplay
|
|
63
|
+
}) => {
|
|
64
|
+
const propsToDisplayValues = flatten(propsToDisplay.map(({
|
|
65
|
+
propertiesToDisplay
|
|
66
|
+
}) => propertiesToDisplay));
|
|
67
|
+
const propsToDisplayString = getPropValues(propsToDisplayValues);
|
|
68
|
+
return `${acc} ${propsToDisplayString}`;
|
|
69
|
+
}, '').trim();
|
|
70
|
+
const ids = [];
|
|
71
|
+
displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);
|
|
72
|
+
const filtersObject = buildFilters(filterBy);
|
|
73
|
+
let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';
|
|
74
|
+
propsQuery = getUpdatedPropsQuery(propsQuery, entityData);
|
|
75
|
+
if (latProp && lonProp) {
|
|
76
|
+
propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(lonProp, relations)}`;
|
|
77
|
+
}
|
|
78
|
+
if (ids.length && !propsQuery.includes(ID)) propsQuery = `${propsQuery.trim()} ${ID}`;
|
|
79
|
+
return {
|
|
80
|
+
shapeKey,
|
|
81
|
+
entity,
|
|
82
|
+
propsQuery,
|
|
83
|
+
ids,
|
|
84
|
+
action,
|
|
85
|
+
filtersObject
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const formatProp = (prop, relations = []) => {
|
|
89
|
+
if (!prop.includes('.')) return prop;
|
|
90
|
+
const [mainProp, nestedProp] = prop.split('.');
|
|
91
|
+
const idProp = relations.find(({
|
|
92
|
+
localField
|
|
93
|
+
}) => localField === mainProp) ? 'id ' : '';
|
|
94
|
+
return `${mainProp}{${idProp}${nestedProp}}`;
|
|
95
|
+
};
|
|
96
|
+
const buildShapesConfig = (schemas, entityGroups, parent) => {
|
|
97
|
+
if (!schemas || !entityGroups) return [];
|
|
98
|
+
const {
|
|
99
|
+
itemId,
|
|
100
|
+
itemEntity
|
|
101
|
+
} = parent;
|
|
102
|
+
const shapeGroups = [];
|
|
103
|
+
entityGroups.forEach((entityGroup, i) => {
|
|
104
|
+
const {
|
|
105
|
+
entity,
|
|
106
|
+
shapes,
|
|
107
|
+
dataSummaries = []
|
|
108
|
+
} = entityGroup;
|
|
109
|
+
const parentId = entity === itemEntity && itemId;
|
|
110
|
+
if (!entity) return null;
|
|
111
|
+
const entityData = schemas[entity] || {};
|
|
112
|
+
shapes.filter(Boolean).forEach((shape, shapeIndex) => {
|
|
113
|
+
const shapeKey = `shape${i}${shapeIndex}`;
|
|
114
|
+
const shapeValues = buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup);
|
|
115
|
+
shapeGroups.push(_objectSpread(_objectSpread({}, shapeValues), {}, {
|
|
116
|
+
shapeOptions: shape,
|
|
117
|
+
entityOptions: entityGroup
|
|
118
|
+
}));
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
return shapeGroups;
|
|
122
|
+
};
|
|
123
|
+
export default buildShapesConfig;
|
|
124
|
+
//# sourceMappingURL=build-shapes-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-shapes-configs.js","names":["flatten","IMAGE_ID","URL","ID","getPropValues","properties","reduce","acc","property","includes","relationName","relationProp","split","trim","getUpdatedPropsQuery","propsQuery","entityData","dynamicProperties","url","Object","keys","filter","prop","hasImage","length","updatedPropsQuery","buildFilterQueryString","filterKey","filterValue","filterKeyword","bool","should","match","buildFilters","filters","filterQueryProps","map","buiildShapeProps","shape","shapeKey","dataSummaries","parentId","entityGroup","displayItems","filterBy","latProp","lonProp","entity","actions","relations","action","getAllPublished","getAll","dataSummaryProps","propsToDisplay","propsToDisplayValues","propertiesToDisplay","propsToDisplayString","ids","push","filtersObject","formatProp","mainProp","nestedProp","idProp","find","localField","buildShapesConfig","schemas","entityGroups","parent","itemId","itemEntity","shapeGroups","forEach","i","shapes","Boolean","shapeIndex","shapeValues","_objectSpread","shapeOptions","entityOptions"],"sources":["../../../src/GoogleMaps/helpers/build-shapes-configs.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nimport { IMAGE_ID, URL, ID } from '../../constants';\n\nconst getPropValues = properties =>\n properties\n .reduce((acc, property) => {\n if (property.includes('.')) {\n const [relationName, relationProp] = property.split('.');\n return `${acc} ${relationName} { ${relationProp} }`;\n }\n return `${acc} ${property}`;\n }, '')\n .trim();\n\nconst getUpdatedPropsQuery = (propsQuery, entityData) => {\n const { properties = {}, dynamicProperties = {} } = entityData;\n\n const [url] = Object.keys(dynamicProperties).filter(prop => prop === URL);\n const hasImage = !!Object.keys(properties).filter(prop => prop === IMAGE_ID).length;\n\n let updatedPropsQuery = hasImage ? `${propsQuery} ${IMAGE_ID}` : propsQuery;\n updatedPropsQuery = url ? `${updatedPropsQuery} ${URL}` : updatedPropsQuery;\n\n return updatedPropsQuery;\n};\n\nconst buildFilterQueryString = filter => {\n const [filterKey, filterValue] = filter.split('/');\n const filterKeyword = `${filterKey}.keyword`;\n return { bool: { should: [{ match: { [filterKeyword]: filterValue } }] } };\n};\n\nconst buildFilters = filters => {\n if (!filters || !filters.length) return null;\n const filterQueryProps = filters.map(buildFilterQueryString);\n return { bool: { should: filterQueryProps } };\n};\n\nconst buiildShapeProps = (shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) => {\n const { displayItems = [], filterBy } = shape;\n const { latProp, lonProp, entity } = entityGroup;\n const { actions, relations } = entityData;\n const action = actions ? actions.getAllPublished || actions.getAll : '';\n\n const dataSummaryProps = dataSummaries\n .reduce((acc, { propsToDisplay }) => {\n const propsToDisplayValues = flatten(\n propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay)\n );\n const propsToDisplayString = getPropValues(propsToDisplayValues);\n\n return `${acc} ${propsToDisplayString}`;\n }, '')\n .trim();\n const ids = [];\n displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);\n\n const filtersObject = buildFilters(filterBy);\n let propsQuery = dataSummaryProps ? `${dataSummaryProps}` : '';\n propsQuery = getUpdatedPropsQuery(propsQuery, entityData);\n if (latProp && lonProp) {\n propsQuery = `${propsQuery} ${formatProp(latProp, relations)} ${formatProp(\n lonProp,\n relations\n )}`;\n }\n if (ids.length && !propsQuery.includes(ID)) propsQuery = `${propsQuery.trim()} ${ID}`;\n\n return {\n shapeKey,\n entity,\n propsQuery,\n ids,\n action,\n filtersObject\n };\n};\n\nconst formatProp = (prop, relations = []) => {\n if (!prop.includes('.')) return prop;\n\n const [mainProp, nestedProp] = prop.split('.');\n const idProp = relations.find(({ localField }) => localField === mainProp) ? 'id ' : '';\n return `${mainProp}{${idProp}${nestedProp}}`;\n};\n\nconst buildShapesConfig = (schemas, entityGroups, parent) => {\n if (!schemas || !entityGroups) return [];\n const { itemId, itemEntity } = parent;\n const shapeGroups = [];\n entityGroups.forEach((entityGroup, i) => {\n const { entity, shapes, dataSummaries = [] } = entityGroup;\n const parentId = entity === itemEntity && itemId;\n if (!entity) return null;\n const entityData = schemas[entity] || {};\n\n shapes.filter(Boolean).forEach((shape, shapeIndex) => {\n const shapeKey = `shape${i}${shapeIndex}`;\n const shapeValues = buiildShapeProps(\n shape,\n shapeKey,\n dataSummaries,\n parentId,\n entityData,\n entityGroup\n );\n shapeGroups.push({ ...shapeValues, shapeOptions: shape, entityOptions: entityGroup });\n });\n });\n\n return shapeGroups;\n};\n\nexport default buildShapesConfig;\n"],"mappings":";;;AAAA,OAAOA,OAAO,MAAM,gBAAgB;AACpC,SAASC,QAAQ,EAAEC,GAAG,EAAEC,EAAE,QAAQ,iBAAiB;AAEnD,MAAMC,aAAa,GAAGC,UAAU,IAC9BA,UAAU,CACPC,MAAM,CAAC,CAACC,GAAG,EAAEC,QAAQ,KAAK;EACzB,IAAIA,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC1B,MAAM,CAACC,YAAY,EAAEC,YAAY,CAAC,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IACxD,OAAO,GAAGL,GAAG,IAAIG,YAAY,MAAMC,YAAY,IAAI;EACrD;EACA,OAAO,GAAGJ,GAAG,IAAIC,QAAQ,EAAE;AAC7B,CAAC,EAAE,EAAE,CAAC,CACLK,IAAI,CAAC,CAAC;AAEX,MAAMC,oBAAoB,GAAGA,CAACC,UAAU,EAAEC,UAAU,KAAK;EACvD,MAAM;IAAEX,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IACxB,MAAM/B,UAAU,GAAGoD,OAAO,CAACrB,MAAM,CAAC,IAAI,CAAC,CAAC;IAExC6B,MAAM,CAACvD,MAAM,CAACwD,OAAO,CAAC,CAACH,OAAO,CAAC,CAACpC,KAAK,EAAEwC,UAAU,KAAK;MACpD,MAAMvC,QAAQ,GAAG,QAAQoC,CAAC,GAAGG,UAAU,EAAE;MACzC,MAAMC,WAAW,GAAG1C,gBAAgB,CAClCC,KAAK,EACLC,QAAQ,EACRC,aAAa,EACbC,QAAQ,EACRzB,UAAU,EACV0B,WACF,CAAC;MACD+B,WAAW,CAACd,IAAI,CAAAqB,aAAA,CAAAA,aAAA,KAAMD,WAAW;QAAEE,YAAY,EAAE3C,KAAK;QAAE4C,aAAa,EAAExC;MAAW,EAAE,CAAC;IACvF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO+B,WAAW;AACpB,CAAC;AAED,eAAeN,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import isNumber from 'lodash.isnumber';
|
|
2
|
+
const getCenterCoordinates = (mapShapes, otherProps) => {
|
|
3
|
+
const centerCoordinates = [];
|
|
4
|
+
const {
|
|
5
|
+
centerLatitude,
|
|
6
|
+
centerLongitude
|
|
7
|
+
} = otherProps;
|
|
8
|
+
const useDefaultCenter = centerLatitude !== 0 && centerLongitude !== 0 && isNumber(centerLatitude) && isNumber(centerLongitude);
|
|
9
|
+
if (useDefaultCenter) return [{
|
|
10
|
+
latitude: centerLatitude,
|
|
11
|
+
longitude: centerLongitude
|
|
12
|
+
}];
|
|
13
|
+
const useAsCenterShapes = mapShapes.filter(({
|
|
14
|
+
useAsCenter
|
|
15
|
+
}) => useAsCenter);
|
|
16
|
+
const shapesForCenter = useAsCenterShapes.length ? useAsCenterShapes : mapShapes;
|
|
17
|
+
shapesForCenter.forEach(({
|
|
18
|
+
latitude,
|
|
19
|
+
longitude
|
|
20
|
+
}) => {
|
|
21
|
+
if (isNumber(latitude) && isNumber(longitude)) centerCoordinates.push({
|
|
22
|
+
latitude,
|
|
23
|
+
longitude
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return centerCoordinates;
|
|
27
|
+
};
|
|
28
|
+
export default getCenterCoordinates;
|
|
29
|
+
//# sourceMappingURL=get-center-coordinates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-center-coordinates.js","names":["isNumber","getCenterCoordinates","mapShapes","otherProps","centerCoordinates","centerLatitude","centerLongitude","useDefaultCenter","latitude","longitude","useAsCenterShapes","filter","useAsCenter","shapesForCenter","length","forEach","push"],"sources":["../../../src/GoogleMaps/helpers/get-center-coordinates.js"],"sourcesContent":["import isNumber from 'lodash.isnumber';\n\nconst getCenterCoordinates = (mapShapes, otherProps) => {\n const centerCoordinates = [];\n\n const { centerLatitude, centerLongitude } = otherProps;\n const useDefaultCenter =\n centerLatitude !== 0 &&\n centerLongitude !== 0 &&\n isNumber(centerLatitude) &&\n isNumber(centerLongitude);\n\n if (useDefaultCenter) return [{ latitude: centerLatitude, longitude: centerLongitude }];\n\n const useAsCenterShapes = mapShapes.filter(({ useAsCenter }) => useAsCenter);\n const shapesForCenter = useAsCenterShapes.length ? useAsCenterShapes : mapShapes;\n shapesForCenter.forEach(({ latitude, longitude }) => {\n if (isNumber(latitude) && isNumber(longitude)) centerCoordinates.push({ latitude, longitude });\n });\n\n return centerCoordinates;\n};\n\nexport default getCenterCoordinates;\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,iBAAiB;AAEtC,MAAMC,oBAAoB,GAAGA,CAACC,SAAS,EAAEC,UAAU,KAAK;EACtD,MAAMC,iBAAiB,GAAG,EAAE;EAE5B,MAAM;IAAEC,cAAc;IAAEC;EAAgB,CAAC,GAAGH,UAAU;EACtD,MAAMI,gBAAgB,GACpBF,cAAc,KAAK,CAAC,IACpBC,eAAe,KAAK,CAAC,IACrBN,QAAQ,CAACK,cAAc,CAAC,IACxBL,QAAQ,CAACM,eAAe,CAAC;EAE3B,IAAIC,gBAAgB,EAAE,OAAO,CAAC;IAAEC,QAAQ,EAAEH,cAAc;IAAEI,SAAS,EAAEH;EAAgB,CAAC,CAAC;EAEvF,MAAMI,iBAAiB,GAAGR,SAAS,CAACS,MAAM,CAAC,CAAC;IAAEC;EAAY,CAAC,KAAKA,WAAW,CAAC;EAC5E,MAAMC,eAAe,GAAGH,iBAAiB,CAACI,MAAM,GAAGJ,iBAAiB,GAAGR,SAAS;EAChFW,eAAe,CAACE,OAAO,CAAC,CAAC;IAAEP,QAAQ;IAAEC;EAAU,CAAC,KAAK;IACnD,IAAIT,QAAQ,CAACQ,QAAQ,CAAC,IAAIR,QAAQ,CAACS,SAAS,CAAC,EAAEL,iBAAiB,CAACY,IAAI,CAAC;MAAER,QAAQ;MAAEC;IAAU,CAAC,CAAC;EAChG,CAAC,CAAC;EAEF,OAAOL,iBAAiB;AAC1B,CAAC;AAED,eAAeH,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const getImageIds = mapShapes => {
|
|
2
|
+
const ids = [];
|
|
3
|
+
mapShapes.forEach(({
|
|
4
|
+
shapeData,
|
|
5
|
+
imageId
|
|
6
|
+
}) => {
|
|
7
|
+
if (imageId) ids.push(imageId);
|
|
8
|
+
if (shapeData.imageId) ids.push(shapeData.imageId);
|
|
9
|
+
});
|
|
10
|
+
return [...new Set(ids)];
|
|
11
|
+
};
|
|
12
|
+
export default getImageIds;
|
|
13
|
+
//# sourceMappingURL=get-image-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-image-ids.js","names":["getImageIds","mapShapes","ids","forEach","shapeData","imageId","push","Set"],"sources":["../../../src/GoogleMaps/helpers/get-image-ids.js"],"sourcesContent":["const getImageIds = mapShapes => {\n const ids = [];\n mapShapes.forEach(({ shapeData, imageId }) => {\n if (imageId) ids.push(imageId);\n if (shapeData.imageId) ids.push(shapeData.imageId);\n });\n return [...new Set(ids)];\n};\n\nexport default getImageIds;\n"],"mappings":"AAAA,MAAMA,WAAW,GAAGC,SAAS,IAAI;EAC/B,MAAMC,GAAG,GAAG,EAAE;EACdD,SAAS,CAACE,OAAO,CAAC,CAAC;IAAEC,SAAS;IAAEC;EAAQ,CAAC,KAAK;IAC5C,IAAIA,OAAO,EAAEH,GAAG,CAACI,IAAI,CAACD,OAAO,CAAC;IAC9B,IAAID,SAAS,CAACC,OAAO,EAAEH,GAAG,CAACI,IAAI,CAACF,SAAS,CAACC,OAAO,CAAC;EACpD,CAAC,CAAC;EACF,OAAO,CAAC,GAAG,IAAIE,GAAG,CAACL,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,eAAeF,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-path.js","names":["getPath","paths","reduce","acc","path","latitude","lat","longitude","lng","push"],"sources":["../../../src/GoogleMaps/helpers/get-path.js"],"sourcesContent":["const getPath = paths =>\n paths.reduce((acc, path) => {\n const { latitude: lat, longitude: lng } = path;\n acc.push({ lat, lng });\n return acc;\n }, []);\n\nexport default getPath;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAGC,KAAK,IACnBA,KAAK,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;EAC1B,MAAM;IAAEC,QAAQ,EAAEC,GAAG;IAAEC,SAAS,EAAEC;EAAI,CAAC,GAAGJ,IAAI;EAC9CD,GAAG,CAACM,IAAI,CAAC;IAAEH,GAAG;IAAEE;EAAI,CAAC,CAAC;EACtB,OAAOL,GAAG;AACZ,CAAC,EAAE,EAAE,CAAC;AAER,eAAeH,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import addZoomListener from './add-zoom-listener';
|
|
2
|
+
import buildQuery from './build-query';
|
|
3
|
+
import getImageIds from './get-image-ids';
|
|
4
|
+
import buildShapesConfig from './build-shapes-configs';
|
|
5
|
+
import setMapOptions from './set-map-options';
|
|
6
|
+
import getCenterCoordinates from './get-center-coordinates';
|
|
7
|
+
import buildMapShapes from './build-map-shapes';
|
|
8
|
+
export { addZoomListener, buildQuery, getImageIds, buildShapesConfig, setMapOptions, getCenterCoordinates, buildMapShapes };
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["addZoomListener","buildQuery","getImageIds","buildShapesConfig","setMapOptions","getCenterCoordinates","buildMapShapes"],"sources":["../../../src/GoogleMaps/helpers/index.js"],"sourcesContent":["import addZoomListener from './add-zoom-listener';\nimport buildQuery from './build-query';\nimport getImageIds from './get-image-ids';\nimport buildShapesConfig from './build-shapes-configs';\nimport setMapOptions from './set-map-options';\nimport getCenterCoordinates from './get-center-coordinates';\nimport buildMapShapes from './build-map-shapes';\n\nexport {\n addZoomListener,\n buildQuery,\n getImageIds,\n buildShapesConfig,\n setMapOptions,\n getCenterCoordinates,\n buildMapShapes\n};\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,qBAAqB;AACjD,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,cAAc,MAAM,oBAAoB;AAE/C,SACEN,eAAe,EACfC,UAAU,EACVC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,oBAAoB,EACpBC,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import buildMapTypeIds from './build-map-type-ids';
|
|
2
|
+
import { COOPERATIVE, NONE, ELEMENT_GEOMETRY, FEATURE_TYPE_MAP, ALL, DISABLE_TRANSPORTATION_STYLES, DISABLE_POI_STYLES, DISABLE_BOUNDARIES_STYLES, DISABLE_LABELS_STYLES, DEFAULT_SELECT_VALUE } from '../../constants';
|
|
3
|
+
const setCustomColor = (featureType, color, elementType) => color ? [{
|
|
4
|
+
featureType,
|
|
5
|
+
elementType: elementType || ELEMENT_GEOMETRY,
|
|
6
|
+
stylers: [{
|
|
7
|
+
color
|
|
8
|
+
}]
|
|
9
|
+
}] : [];
|
|
10
|
+
const getFeatureStyles = ({
|
|
11
|
+
enableRoads = true,
|
|
12
|
+
enableFeatureTransportation,
|
|
13
|
+
enableFeatureLabels,
|
|
14
|
+
enableFeaturePoi,
|
|
15
|
+
enableFeatureBoundaries
|
|
16
|
+
}) => {
|
|
17
|
+
const customColors = [];
|
|
18
|
+
// todo: enableRoads is a legacy option can be removed in later updates
|
|
19
|
+
if (!enableFeatureLabels || !enableRoads) customColors.push(...DISABLE_LABELS_STYLES);
|
|
20
|
+
if (!enableFeatureBoundaries || !enableRoads) customColors.push(...DISABLE_BOUNDARIES_STYLES);
|
|
21
|
+
if (!enableFeaturePoi || !enableRoads) customColors.push(...DISABLE_POI_STYLES);
|
|
22
|
+
if (!enableFeatureTransportation || !enableRoads) {
|
|
23
|
+
customColors.push(...DISABLE_TRANSPORTATION_STYLES);
|
|
24
|
+
}
|
|
25
|
+
return customColors;
|
|
26
|
+
};
|
|
27
|
+
const setMapOptions = otherProps => {
|
|
28
|
+
const {
|
|
29
|
+
centerLatitude,
|
|
30
|
+
centerLongitude,
|
|
31
|
+
defaultZoom,
|
|
32
|
+
enableZoom,
|
|
33
|
+
maxZoom,
|
|
34
|
+
minZoom,
|
|
35
|
+
enablePan,
|
|
36
|
+
enableStreetView,
|
|
37
|
+
enableFullScreen,
|
|
38
|
+
enableSatelliteView,
|
|
39
|
+
enableTerrainScreen,
|
|
40
|
+
waterColor,
|
|
41
|
+
landscapeColor,
|
|
42
|
+
landscapeColorAll,
|
|
43
|
+
mapType
|
|
44
|
+
} = otherProps;
|
|
45
|
+
const customColors = [...getFeatureStyles(otherProps), ...setCustomColor(FEATURE_TYPE_MAP.waterColor, waterColor), ...setCustomColor(FEATURE_TYPE_MAP.landscapeColor, landscapeColor), ...setCustomColor(FEATURE_TYPE_MAP.landscapeColor, landscapeColorAll, ALL)];
|
|
46
|
+
return {
|
|
47
|
+
center: {
|
|
48
|
+
lat: centerLatitude,
|
|
49
|
+
lng: centerLongitude
|
|
50
|
+
},
|
|
51
|
+
zoom: defaultZoom,
|
|
52
|
+
maxZoom: enableZoom ? maxZoom : defaultZoom,
|
|
53
|
+
minZoom: enableZoom ? minZoom : defaultZoom,
|
|
54
|
+
gestureHandling: enablePan || enableZoom ? COOPERATIVE : NONE,
|
|
55
|
+
panControl: enablePan,
|
|
56
|
+
zoomControl: enableZoom && minZoom !== maxZoom,
|
|
57
|
+
disableDoubleClickZoom: !enableZoom,
|
|
58
|
+
streetViewControl: enableStreetView,
|
|
59
|
+
fullscreenControl: enableFullScreen,
|
|
60
|
+
mapTypeControl: enableSatelliteView || enableTerrainScreen,
|
|
61
|
+
mapTypeControlOptions: {
|
|
62
|
+
mapTypeIds: buildMapTypeIds(enableSatelliteView, enableTerrainScreen)
|
|
63
|
+
},
|
|
64
|
+
mapTypeId: !mapType || mapType === DEFAULT_SELECT_VALUE ? undefined : mapType,
|
|
65
|
+
styles: customColors
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export default setMapOptions;
|
|
69
|
+
//# sourceMappingURL=set-map-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-map-options.js","names":["buildMapTypeIds","COOPERATIVE","NONE","ELEMENT_GEOMETRY","FEATURE_TYPE_MAP","ALL","DISABLE_TRANSPORTATION_STYLES","DISABLE_POI_STYLES","DISABLE_BOUNDARIES_STYLES","DISABLE_LABELS_STYLES","DEFAULT_SELECT_VALUE","setCustomColor","featureType","color","elementType","stylers","getFeatureStyles","enableRoads","enableFeatureTransportation","enableFeatureLabels","enableFeaturePoi","enableFeatureBoundaries","customColors","push","setMapOptions","otherProps","centerLatitude","centerLongitude","defaultZoom","enableZoom","maxZoom","minZoom","enablePan","enableStreetView","enableFullScreen","enableSatelliteView","enableTerrainScreen","waterColor","landscapeColor","landscapeColorAll","mapType","center","lat","lng","zoom","gestureHandling","panControl","zoomControl","disableDoubleClickZoom","streetViewControl","fullscreenControl","mapTypeControl","mapTypeControlOptions","mapTypeIds","mapTypeId","undefined","styles"],"sources":["../../../src/GoogleMaps/helpers/set-map-options.js"],"sourcesContent":["import buildMapTypeIds from './build-map-type-ids';\nimport {\n COOPERATIVE,\n NONE,\n ELEMENT_GEOMETRY,\n FEATURE_TYPE_MAP,\n ALL,\n DISABLE_TRANSPORTATION_STYLES,\n DISABLE_POI_STYLES,\n DISABLE_BOUNDARIES_STYLES,\n DISABLE_LABELS_STYLES,\n DEFAULT_SELECT_VALUE\n} from '../../constants';\n\nconst setCustomColor = (featureType, color, elementType) =>\n color\n ? [\n {\n featureType,\n elementType: elementType || ELEMENT_GEOMETRY,\n stylers: [\n {\n color\n }\n ]\n }\n ]\n : [];\n\nconst getFeatureStyles = ({\n enableRoads = true,\n enableFeatureTransportation,\n enableFeatureLabels,\n enableFeaturePoi,\n enableFeatureBoundaries\n}) => {\n const customColors = [];\n // todo: enableRoads is a legacy option can be removed in later updates\n if (!enableFeatureLabels || !enableRoads) customColors.push(...DISABLE_LABELS_STYLES);\n if (!enableFeatureBoundaries || !enableRoads) customColors.push(...DISABLE_BOUNDARIES_STYLES);\n if (!enableFeaturePoi || !enableRoads) customColors.push(...DISABLE_POI_STYLES);\n if (!enableFeatureTransportation || !enableRoads) {\n customColors.push(...DISABLE_TRANSPORTATION_STYLES);\n }\n\n return customColors;\n};\n\nconst setMapOptions = otherProps => {\n const {\n centerLatitude,\n centerLongitude,\n defaultZoom,\n enableZoom,\n maxZoom,\n minZoom,\n enablePan,\n enableStreetView,\n enableFullScreen,\n enableSatelliteView,\n enableTerrainScreen,\n waterColor,\n landscapeColor,\n landscapeColorAll,\n mapType\n } = otherProps;\n\n const customColors = [\n ...getFeatureStyles(otherProps),\n ...setCustomColor(FEATURE_TYPE_MAP.waterColor, waterColor),\n ...setCustomColor(FEATURE_TYPE_MAP.landscapeColor, landscapeColor),\n ...setCustomColor(FEATURE_TYPE_MAP.landscapeColor, landscapeColorAll, ALL)\n ];\n\n return {\n center: { lat: centerLatitude, lng: centerLongitude },\n zoom: defaultZoom,\n maxZoom: enableZoom ? maxZoom : defaultZoom,\n minZoom: enableZoom ? minZoom : defaultZoom,\n gestureHandling: enablePan || enableZoom ? COOPERATIVE : NONE,\n panControl: enablePan,\n zoomControl: enableZoom && minZoom !== maxZoom,\n disableDoubleClickZoom: !enableZoom,\n streetViewControl: enableStreetView,\n fullscreenControl: enableFullScreen,\n mapTypeControl: enableSatelliteView || enableTerrainScreen,\n mapTypeControlOptions: {\n mapTypeIds: buildMapTypeIds(enableSatelliteView, enableTerrainScreen)\n },\n mapTypeId: !mapType || mapType === DEFAULT_SELECT_VALUE ? undefined : mapType,\n styles: customColors\n };\n};\n\nexport default setMapOptions;\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,sBAAsB;AAClD,SACEC,WAAW,EACXC,IAAI,EACJC,gBAAgB,EAChBC,gBAAgB,EAChBC,GAAG,EACHC,6BAA6B,EAC7BC,kBAAkB,EAClBC,yBAAyB,EACzBC,qBAAqB,EACrBC,oBAAoB,QACf,iBAAiB;AAExB,MAAMC,cAAc,GAAGA,CAACC,WAAW,EAAEC,KAAK,EAAEC,WAAW,KACrDD,KAAK,GACD,CACE;EACED,WAAW;EACXE,WAAW,EAAEA,WAAW,IAAIX,gBAAgB;EAC5CY,OAAO,EAAE,CACP;IACEF;EACF,CAAC;AAEL,CAAC,CACF,GACD,EAAE;AAER,MAAMG,gBAAgB,GAAGA,CAAC;EACxBC,WAAW,GAAG,IAAI;EAClBC,2BAA2B;EAC3BC,mBAAmB;EACnBC,gBAAgB;EAChBC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAG,EAAE;EACvB;EACA,IAAI,CAACH,mBAAmB,IAAI,CAACF,WAAW,EAAEK,YAAY,CAACC,IAAI,CAAC,GAAGd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