@blaze-cms/plugin-google-maps-fe 0.146.0-node18.0 → 0.146.0-rc-eagle.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +3 -5
  2. package/lib/GoogleMaps/GoogleMaps.js +67 -90
  3. package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
  4. package/lib/GoogleMaps/GoogleMapsFactory.js +21 -22
  5. package/lib/GoogleMaps/GoogleMapsFactory.js.map +1 -1
  6. package/lib/GoogleMaps/GoogleMapsHtml.js +9 -11
  7. package/lib/GoogleMaps/GoogleMapsHtml.js.map +1 -1
  8. package/lib/GoogleMaps/GoogleMapsRender.js +43 -37
  9. package/lib/GoogleMaps/GoogleMapsRender.js.map +1 -1
  10. package/lib/GoogleMaps/helpers/add-zoom-listener.js +5 -8
  11. package/lib/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
  12. package/lib/GoogleMaps/helpers/build-map-shapes.js +48 -48
  13. package/lib/GoogleMaps/helpers/build-map-shapes.js.map +1 -1
  14. package/lib/GoogleMaps/helpers/build-map-type-ids.js +4 -5
  15. package/lib/GoogleMaps/helpers/build-map-type-ids.js.map +1 -1
  16. package/lib/GoogleMaps/helpers/build-query.js +22 -28
  17. package/lib/GoogleMaps/helpers/build-query.js.map +1 -1
  18. package/lib/GoogleMaps/helpers/build-shapes-configs.js +84 -111
  19. package/lib/GoogleMaps/helpers/build-shapes-configs.js.map +1 -1
  20. package/lib/GoogleMaps/helpers/get-center-coordinates.js +20 -23
  21. package/lib/GoogleMaps/helpers/get-center-coordinates.js.map +1 -1
  22. package/lib/GoogleMaps/helpers/get-image-ids.js +9 -18
  23. package/lib/GoogleMaps/helpers/get-image-ids.js.map +1 -1
  24. package/lib/GoogleMaps/helpers/get-path.js +13 -16
  25. package/lib/GoogleMaps/helpers/get-path.js.map +1 -1
  26. package/lib/GoogleMaps/helpers/index.js +14 -15
  27. package/lib/GoogleMaps/helpers/index.js.map +1 -1
  28. package/lib/GoogleMaps/helpers/set-map-options.js +41 -44
  29. package/lib/GoogleMaps/helpers/set-map-options.js.map +1 -1
  30. package/lib/GoogleMaps/helpers/set-shapes.js +174 -245
  31. package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
  32. package/lib/GoogleMaps/hooks/index.js +4 -5
  33. package/lib/GoogleMaps/hooks/index.js.map +1 -1
  34. package/lib/GoogleMaps/hooks/use-get-entity-schemas.js +14 -20
  35. package/lib/GoogleMaps/hooks/use-get-entity-schemas.js.map +1 -1
  36. package/lib/GoogleMaps/hooks/use-get-images.js +21 -22
  37. package/lib/GoogleMaps/hooks/use-get-images.js.map +1 -1
  38. package/lib/GoogleMaps/index.js +2 -3
  39. package/lib/GoogleMaps/index.js.map +1 -1
  40. package/lib/GoogleMaps/queries.js +49 -22
  41. package/lib/GoogleMaps/queries.js.map +1 -1
  42. package/lib/constants.js +35 -36
  43. package/lib/constants.js.map +1 -1
  44. package/lib/index.js +13 -43
  45. package/lib/index.js.map +1 -1
  46. package/package.json +10 -9
  47. package/src/GoogleMaps/GoogleMaps.js +4 -1
  48. package/src/GoogleMaps/helpers/add-zoom-listener.js +1 -1
  49. package/src/GoogleMaps/helpers/build-query.js +3 -1
  50. package/lib-es/GoogleMaps/GoogleMaps.js +0 -120
  51. package/lib-es/GoogleMaps/GoogleMaps.js.map +0 -1
  52. package/lib-es/GoogleMaps/GoogleMapsFactory.js +0 -41
  53. package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +0 -1
  54. package/lib-es/GoogleMaps/GoogleMapsHtml.js +0 -16
  55. package/lib-es/GoogleMaps/GoogleMapsHtml.js.map +0 -1
  56. package/lib-es/GoogleMaps/GoogleMapsRender.js +0 -72
  57. package/lib-es/GoogleMaps/GoogleMapsRender.js.map +0 -1
  58. package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +0 -9
  59. package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +0 -1
  60. package/lib-es/GoogleMaps/helpers/build-map-shapes.js +0 -68
  61. package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +0 -1
  62. package/lib-es/GoogleMaps/helpers/build-map-type-ids.js +0 -9
  63. package/lib-es/GoogleMaps/helpers/build-map-type-ids.js.map +0 -1
  64. package/lib-es/GoogleMaps/helpers/build-query.js +0 -29
  65. package/lib-es/GoogleMaps/helpers/build-query.js.map +0 -1
  66. package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +0 -124
  67. package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +0 -1
  68. package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +0 -29
  69. package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +0 -1
  70. package/lib-es/GoogleMaps/helpers/get-image-ids.js +0 -13
  71. package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +0 -1
  72. package/lib-es/GoogleMaps/helpers/get-path.js +0 -13
  73. package/lib-es/GoogleMaps/helpers/get-path.js.map +0 -1
  74. package/lib-es/GoogleMaps/helpers/index.js +0 -9
  75. package/lib-es/GoogleMaps/helpers/index.js.map +0 -1
  76. package/lib-es/GoogleMaps/helpers/set-map-options.js +0 -69
  77. package/lib-es/GoogleMaps/helpers/set-map-options.js.map +0 -1
  78. package/lib-es/GoogleMaps/helpers/set-shapes.js +0 -309
  79. package/lib-es/GoogleMaps/helpers/set-shapes.js.map +0 -1
  80. package/lib-es/GoogleMaps/hooks/index.js +0 -4
  81. package/lib-es/GoogleMaps/hooks/index.js.map +0 -1
  82. package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js +0 -20
  83. package/lib-es/GoogleMaps/hooks/use-get-entity-schemas.js.map +0 -1
  84. package/lib-es/GoogleMaps/hooks/use-get-images.js +0 -27
  85. package/lib-es/GoogleMaps/hooks/use-get-images.js.map +0 -1
  86. package/lib-es/GoogleMaps/index.js +0 -3
  87. package/lib-es/GoogleMaps/index.js.map +0 -1
  88. package/lib-es/GoogleMaps/queries.js +0 -47
  89. package/lib-es/GoogleMaps/queries.js.map +0 -1
  90. package/lib-es/constants.js +0 -90
  91. package/lib-es/constants.js.map +0 -1
  92. package/lib-es/index.js +0 -17
  93. package/lib-es/index.js.map +0 -1
@@ -1,124 +0,0 @@
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
@@ -1 +0,0 @@
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,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;IAChD,IAAI,CAACxB,MAAM,EAAE,OAAO,IAAI;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":[]}
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,13 +0,0 @@
1
- const getPath = paths => paths.reduce((acc, path) => {
2
- const {
3
- latitude: lat,
4
- longitude: lng
5
- } = path;
6
- acc.push({
7
- lat,
8
- lng
9
- });
10
- return acc;
11
- }, []);
12
- export default getPath;
13
- //# sourceMappingURL=get-path.js.map
@@ -1 +0,0 @@
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":[]}
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,69 +0,0 @@
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
@@ -1 +0,0 @@
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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AElC,GAAG,CAAC,CAC3E;EAED,OAAO;IACLoC,MAAM,EAAE;MAAEC,GAAG,EAAEhB,cAAc;MAAEiB,GAAG,EAAEhB;IAAgB,CAAC;IACrDiB,IAAI,EAAEhB,WAAW;IACjBE,OAAO,EAAED,UAAU,GAAGC,OAAO,GAAGF,WAAW;IAC3CG,OAAO,EAAEF,UAAU,GAAGE,OAAO,GAAGH,WAAW;IAC3CiB,eAAe,EAAEb,SAAS,IAAIH,UAAU,GAAG5B,WAAW,GAAGC,IAAI;IAC7D4C,UAAU,EAAEd,SAAS;IACrBe,WAAW,EAAElB,UAAU,IAAIE,OAAO,KAAKD,OAAO;IAC9CkB,sBAAsB,EAAE,CAACnB,UAAU;IACnCoB,iBAAiB,EAAEhB,gBAAgB;IACnCiB,iBAAiB,EAAEhB,gBAAgB;IACnCiB,cAAc,EAAEhB,mBAAmB,IAAIC,mBAAmB;IAC1DgB,qBAAqB,EAAE;MACrBC,UAAU,EAAErD,eAAe,CAACmC,mBAAmB,EAAEC,mBAAmB;IACtE,CAAC;IACDkB,SAAS,EAAE,CAACd,OAAO,IAAIA,OAAO,KAAK9B,oBAAoB,GAAG6C,SAAS,GAAGf,OAAO;IAC7EgB,MAAM,EAAElC;EACV,CAAC;AACH,CAAC;AAED,eAAeE,aAAa","ignoreList":[]}
@@ -1,309 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- const _excluded = ["elementTitle", "type", "propsToDisplay"];
4
- 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; }
5
- 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; }
6
- import React from 'react';
7
- import isNumber from 'lodash.isnumber';
8
- import * as ReactDOMServer from 'react-dom/server';
9
- import { Link } from '@blaze-cms/nextjs-components';
10
- import { ApolloProvider } from '@apollo/client';
11
- import { buildPropsToDisplayWithContent, summaryComponents, getClassModifiers } from '@blaze-cms/react-page-builder';
12
- import getPath from './get-path';
13
- import { MARKER, POLYLINE, POLYGON, RECTANGLE, CIRCLE, COLOR, CLICK, HEADING_LARGE, LIST, DEFAULT_CUSTOM_MARKER_PATH } from '../../constants';
14
- const shapesArray = [];
15
- const infoWindowArray = [];
16
- const clearShapes = () => {
17
- if (shapesArray.length) {
18
- shapesArray.forEach(shape => shape.setMap(null));
19
- shapesArray.length = 0;
20
- }
21
- };
22
- const closeInfoWindows = () => {
23
- if (infoWindowArray.length) {
24
- infoWindowArray.forEach(infoWindow => infoWindow.close());
25
- infoWindowArray.length = 0;
26
- }
27
- };
28
- const addShapeListeners = (map, router, shape, imageData, shapeInstance, client) => {
29
- const {
30
- enableInfoPane = false,
31
- dataSummaries = [],
32
- url,
33
- shapeData
34
- } = shape;
35
- if (enableInfoPane) {
36
- const infoWindow = new window.google.maps.InfoWindow({
37
- content: ''
38
- });
39
- shapeInstance.addListener(CLICK, async event => {
40
- closeInfoWindows();
41
- const content = ReactDOMServer.renderToString(await infoWindowContent(imageData, dataSummaries, url, shapeData, client));
42
- infoWindow.setContent(content);
43
- infoWindow.setPosition(event.latLng);
44
- infoWindow.open(map, shapeInstance);
45
- infoWindowArray.push(infoWindow);
46
- });
47
- } else if (url) {
48
- shapeInstance.addListener(CLICK, () => {
49
- router.push(url);
50
- });
51
- }
52
- };
53
- const setStyleOptions = shape => {
54
- const {
55
- strokeColor,
56
- strokeOpacity,
57
- strokeWeight,
58
- fillColor,
59
- fillOpacity
60
- } = shape;
61
- const styleSettings = {
62
- strokeColor,
63
- fillColor,
64
- strokeOpacity,
65
- strokeWeight,
66
- fillOpacity
67
- };
68
- return _objectSpread({}, Object.keys(styleSettings).reduce((acc, key) => {
69
- const settingValue = styleSettings[key];
70
- const shouldValueBeNumber = !key.includes(COLOR);
71
- const hasValuePassedCondition = shouldValueBeNumber ? isNumber(settingValue) : settingValue;
72
- if (hasValuePassedCondition) acc[key] = settingValue;
73
- return acc;
74
- }, {}));
75
- };
76
- const areRectangleBoundsNumbers = bounds => bounds.every(bound => isNumber(bound));
77
- const isPositionCorrect = (lat, lng) => isNumber(lat) && isNumber(lng);
78
- const getIconUrl = (imageId, imageData) => {
79
- if (!imageId) return '';
80
- const image = imageData.find(({
81
- id
82
- }) => id === imageId);
83
- if (!image || !image.url) return '';
84
- return image.url;
85
- };
86
- const infoWindowContent = async (imageData, dataSummaries, url, shapeData, client) => {
87
- const summariesWithContent = await Promise.all(dataSummaries.map(async dataSummary => {
88
- const {
89
- elementTitle,
90
- type,
91
- propsToDisplay
92
- } = dataSummary,
93
- otherProps = _objectWithoutProperties(dataSummary, _excluded);
94
- const isTypeHeading = type === HEADING_LARGE;
95
- const summaryPropsWithContent = buildPropsToDisplayWithContent(shapeData, propsToDisplay);
96
- const modifier = getClassModifiers(LIST, otherProps);
97
- const SummaryComponent = summaryComponents[type];
98
- await SummaryComponent.render.preload(); // preload dynamic nextjs component
99
-
100
- if (!summaryPropsWithContent.length) return null;
101
- const getDataSummaryComponent = () => {
102
- const component = /*#__PURE__*/React.createElement(ApolloProvider, {
103
- client: client
104
- }, /*#__PURE__*/React.createElement(SummaryComponent, {
105
- key: type,
106
- modifier: modifier,
107
- elementTitle: elementTitle,
108
- summaryPropsWithContent: summaryPropsWithContent
109
- }));
110
- if (isTypeHeading && url) return /*#__PURE__*/React.createElement(Link, {
111
- href: url
112
- }, component);
113
- return component;
114
- };
115
- return getDataSummaryComponent();
116
- }));
117
- const {
118
- imageId
119
- } = shapeData || {};
120
- const image = imageData.find(({
121
- id
122
- }) => id === imageId);
123
- const shouldShowImage = image && image.url;
124
- const getImageElement = () => {
125
- const {
126
- url: imageUrl,
127
- data
128
- } = image;
129
- const imageElement = /*#__PURE__*/React.createElement("img", {
130
- className: "info__window",
131
- src: imageUrl,
132
- alt: data && data.altText ? data.altText : ''
133
- });
134
- if (url) return /*#__PURE__*/React.createElement(Link, {
135
- href: url
136
- }, imageElement);
137
- return imageElement;
138
- };
139
- return /*#__PURE__*/React.createElement(React.Fragment, null, shouldShowImage && getImageElement(), summariesWithContent);
140
- };
141
- function getIcon(imageData, shape) {
142
- const {
143
- imageId,
144
- markerWidth = 50,
145
- markerHeight = 50,
146
- strokeColor,
147
- strokeOpacity,
148
- strokeWeight,
149
- fillColor,
150
- fillOpacity,
151
- svgPath
152
- } = shape;
153
- const iconUrl = getIconUrl(imageId, imageData);
154
- const icon = iconUrl ? {
155
- url: iconUrl,
156
- scaledSize: new window.google.maps.Size(markerWidth || 50, markerHeight || 50)
157
- } : null;
158
- if (icon) return icon;
159
- if (!svgPath && !fillColor && !strokeColor) return {}; // any can be true for custom marker
160
-
161
- const svgMarker = {
162
- path: svgPath || DEFAULT_CUSTOM_MARKER_PATH,
163
- strokeColor,
164
- strokeOpacity,
165
- strokeWeight,
166
- fillColor,
167
- fillOpacity,
168
- rotation: 0,
169
- scale: 2
170
- };
171
- return svgMarker;
172
- }
173
- const setMarker = (map, router, shape, imageData, client) => {
174
- const {
175
- label = '',
176
- latitude,
177
- longitude
178
- } = shape;
179
- if (isPositionCorrect(latitude, longitude)) {
180
- const svgMarker = getIcon(imageData, shape);
181
- const marker = new window.google.maps.Marker({
182
- position: {
183
- lat: latitude,
184
- lng: longitude
185
- },
186
- map,
187
- icon: svgMarker,
188
- title: label || ''
189
- });
190
- addShapeListeners(map, router, shape, imageData, marker, client);
191
- shapesArray.push(marker);
192
- marker.setMap(map);
193
- }
194
- };
195
- const setPolyline = (map, router, shape, imageData) => {
196
- const {
197
- paths
198
- } = shape;
199
- const path = getPath(paths);
200
- if (path.length) {
201
- const polyline = new window.google.maps.Polyline(_objectSpread({
202
- path,
203
- geodesic: true
204
- }, setStyleOptions(shape)));
205
- addShapeListeners(map, router, shape, imageData, polyline);
206
- shapesArray.push(polyline);
207
- polyline.setMap(map);
208
- }
209
- };
210
- const setPolygon = (map, router, shape, imageData) => {
211
- const {
212
- paths: unParsedPaths
213
- } = shape;
214
- const paths = getPath(unParsedPaths);
215
- if (paths.length) {
216
- const polygon = new window.google.maps.Polygon(_objectSpread({
217
- paths
218
- }, setStyleOptions(shape)));
219
- addShapeListeners(map, router, shape, imageData, polygon);
220
- shapesArray.push(polygon);
221
- polygon.setMap(map);
222
- }
223
- };
224
- const setRectangle = (map, router, shape, imageData) => {
225
- const {
226
- northBound,
227
- southBound,
228
- eastBound,
229
- westBound
230
- } = shape;
231
- if (areRectangleBoundsNumbers([northBound, southBound, eastBound, westBound])) {
232
- const rectangle = new window.google.maps.Rectangle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
233
- map,
234
- bounds: {
235
- north: northBound,
236
- south: southBound,
237
- east: eastBound,
238
- west: westBound
239
- }
240
- }));
241
- addShapeListeners(map, router, shape, imageData, rectangle);
242
- shapesArray.push(rectangle);
243
- rectangle.setMap(map);
244
- }
245
- };
246
- const setCircle = (map, router, shape, imageData) => {
247
- const {
248
- latitude,
249
- longitude,
250
- radius
251
- } = shape;
252
- if (isPositionCorrect(latitude, longitude) && isNumber(radius)) {
253
- const circle = new window.google.maps.Circle(_objectSpread(_objectSpread({}, setStyleOptions(shape)), {}, {
254
- map,
255
- center: {
256
- lat: latitude,
257
- lng: longitude
258
- },
259
- radius
260
- }));
261
- addShapeListeners(map, router, shape, imageData, circle);
262
- shapesArray.push(circle);
263
- circle.setMap(map);
264
- }
265
- };
266
- const setShapes = (map, router, shapes, imageData, client) => {
267
- const mapZoom = map.getZoom();
268
- clearShapes();
269
- shapes.forEach(shape => {
270
- const {
271
- type,
272
- minZoom,
273
- maxZoom
274
- } = shape;
275
- if (mapZoom >= minZoom && mapZoom <= maxZoom) {
276
- switch (type) {
277
- case MARKER:
278
- {
279
- setMarker(map, router, shape, imageData, client);
280
- break;
281
- }
282
- case POLYLINE:
283
- {
284
- setPolyline(map, router, shape, imageData);
285
- break;
286
- }
287
- case POLYGON:
288
- {
289
- setPolygon(map, router, shape, imageData);
290
- break;
291
- }
292
- case RECTANGLE:
293
- {
294
- setRectangle(map, router, shape, imageData);
295
- break;
296
- }
297
- case CIRCLE:
298
- {
299
- setCircle(map, router, shape, imageData);
300
- break;
301
- }
302
- default:
303
- break;
304
- }
305
- }
306
- });
307
- };
308
- export default setShapes;
309
- //# sourceMappingURL=set-shapes.js.map