@blaze-cms/plugin-google-maps-fe 0.123.0-alpha.25 → 0.123.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/lib/GoogleMaps/GoogleMaps.js +68 -40
- package/lib/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsFactory.js +8 -4
- package/lib/GoogleMaps/GoogleMapsFactory.js.map +1 -1
- package/lib/GoogleMaps/GoogleMapsRender.js +24 -41
- package/lib/GoogleMaps/GoogleMapsRender.js.map +1 -1
- package/lib/GoogleMaps/helpers/add-zoom-listener.js +3 -50
- package/lib/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-map-shapes.js +97 -0
- package/lib/GoogleMaps/helpers/build-map-shapes.js.map +1 -0
- package/lib/GoogleMaps/helpers/build-query.js +24 -14
- package/lib/GoogleMaps/helpers/build-query.js.map +1 -1
- package/lib/GoogleMaps/helpers/build-shapes-configs.js +196 -0
- package/lib/GoogleMaps/helpers/build-shapes-configs.js.map +1 -0
- package/lib/GoogleMaps/helpers/get-center-coordinates.js +49 -0
- package/lib/GoogleMaps/helpers/get-center-coordinates.js.map +1 -0
- package/lib/GoogleMaps/helpers/get-image-ids.js +16 -14
- package/lib/GoogleMaps/helpers/get-image-ids.js.map +1 -1
- package/lib/GoogleMaps/helpers/index.js +21 -5
- package/lib/GoogleMaps/helpers/index.js.map +1 -1
- package/lib/GoogleMaps/helpers/set-shapes.js +213 -200
- package/lib/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib/GoogleMaps/hooks/use-get-images.js +3 -2
- package/lib/GoogleMaps/hooks/use-get-images.js.map +1 -1
- package/lib/GoogleMaps/queries.js +22 -4
- package/lib/GoogleMaps/queries.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMaps.js +51 -25
- package/lib-es/GoogleMaps/GoogleMaps.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMapsFactory.js +10 -6
- package/lib-es/GoogleMaps/GoogleMapsFactory.js.map +1 -1
- package/lib-es/GoogleMaps/GoogleMapsRender.js +24 -32
- package/lib-es/GoogleMaps/GoogleMapsRender.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js +3 -23
- package/lib-es/GoogleMaps/helpers/add-zoom-listener.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js +86 -0
- package/lib-es/GoogleMaps/helpers/build-map-shapes.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/build-query.js +17 -8
- package/lib-es/GoogleMaps/helpers/build-query.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js +134 -0
- package/lib-es/GoogleMaps/helpers/build-shapes-configs.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js +31 -0
- package/lib-es/GoogleMaps/helpers/get-center-coordinates.js.map +1 -0
- package/lib-es/GoogleMaps/helpers/get-image-ids.js +9 -14
- package/lib-es/GoogleMaps/helpers/get-image-ids.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/index.js +4 -2
- package/lib-es/GoogleMaps/helpers/index.js.map +1 -1
- package/lib-es/GoogleMaps/helpers/set-shapes.js +80 -125
- package/lib-es/GoogleMaps/helpers/set-shapes.js.map +1 -1
- package/lib-es/GoogleMaps/hooks/use-get-images.js +4 -3
- package/lib-es/GoogleMaps/hooks/use-get-images.js.map +1 -1
- package/lib-es/GoogleMaps/queries.js +23 -2
- package/lib-es/GoogleMaps/queries.js.map +1 -1
- package/package.json +3 -3
- package/src/GoogleMaps/GoogleMaps.js +40 -27
- package/src/GoogleMaps/GoogleMapsFactory.js +11 -4
- package/src/GoogleMaps/GoogleMapsRender.js +22 -21
- package/src/GoogleMaps/helpers/add-zoom-listener.js +3 -22
- package/src/GoogleMaps/helpers/build-map-shapes.js +70 -0
- package/src/GoogleMaps/helpers/build-query.js +25 -10
- package/src/GoogleMaps/helpers/build-shapes-configs.js +110 -0
- package/src/GoogleMaps/helpers/get-center-coordinates.js +24 -0
- package/src/GoogleMaps/helpers/get-image-ids.js +6 -15
- package/src/GoogleMaps/helpers/index.js +12 -2
- package/src/GoogleMaps/helpers/set-shapes.js +87 -123
- package/src/GoogleMaps/hooks/use-get-images.js +4 -3
- package/src/GoogleMaps/queries.js +30 -3
- package/lib/GoogleMaps/helpers/set-entity-configs.js +0 -144
- package/lib/GoogleMaps/helpers/set-entity-configs.js.map +0 -1
- package/lib-es/GoogleMaps/helpers/set-entity-configs.js +0 -94
- package/lib-es/GoogleMaps/helpers/set-entity-configs.js.map +0 -1
- package/src/GoogleMaps/helpers/set-entity-configs.js +0 -84
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/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","imageId","label","markerHeight","markerWidth","maxZoom","minZoom","type","useAsCenter","shapeData","Array","isArray","results","url","formatedShape","push"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAOC,IAAP,EAAgB;AACtC,MAAID,IAAI,CAACE,MAAL,KAAgB,CAApB,EAAuB,OAAOD,IAAI,CAACD,IAAD,CAAX;AACvB,MAAMG,GAAG,GAAGH,IAAI,CAACI,KAAL,EAAZ;AACA,SAAOL,eAAe,CAACC,IAAD,EAAOC,IAAI,CAACE,GAAD,CAAX,CAAtB;AACD,CAJD;;AAMA,IAAME,UAAU,GAAG,SAAbA,UAAa,CAACC,OAAD,EAAUC,OAAV,EAAmBC,KAAnB,EAA0BP,IAA1B,EAAmC;AACpD,MAAQQ,QAAR,GAAgCD,KAAhC,CAAQC,QAAR;AAAA,M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AACqB,IAAV,CAAeD,aAAf;AACD,KAtBD;AAuBD,GA3CD;AA6CA,SAAOpB,SAAP;AACD,CAjDD;;eAmDeH,c","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 const {\n imageId,\n label,\n markerHeight,\n markerWidth,\n maxZoom,\n minZoom,\n type,\n useAsCenter\n } = shapeOptions;\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 latitude,\n longitude,\n dataSummaries,\n enableInfoPane,\n imageId,\n label,\n markerHeight,\n markerWidth,\n maxZoom,\n minZoom,\n type,\n url,\n useAsCenter,\n shapeData: data\n };\n\n mapShapes.push(formatedShape);\n });\n });\n\n return mapShapes;\n};\n\nexport default buildMapShapes;\n"],"file":"build-map-shapes.js"}
|
|
@@ -11,32 +11,42 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
|
|
14
|
-
require("core-js/modules/es.array.
|
|
14
|
+
require("core-js/modules/es.array.join.js");
|
|
15
15
|
|
|
16
|
-
require("core-js/modules/es.
|
|
16
|
+
require("core-js/modules/es.array.map.js");
|
|
17
17
|
|
|
18
|
-
require("core-js/modules/es.
|
|
18
|
+
require("core-js/modules/es.array.concat.js");
|
|
19
19
|
|
|
20
|
-
require("core-js/modules/es.
|
|
20
|
+
require("core-js/modules/es.array.slice.js");
|
|
21
21
|
|
|
22
|
-
require("core-js/modules/es.array.
|
|
22
|
+
require("core-js/modules/es.array.index-of.js");
|
|
23
|
+
|
|
24
|
+
require("core-js/modules/es.string.trim.js");
|
|
23
25
|
|
|
24
26
|
var _queries = require("../queries");
|
|
25
27
|
|
|
26
28
|
var buildQuery = function buildQuery(entityConfigs) {
|
|
27
29
|
var entityIds = [];
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
ids =
|
|
32
|
-
|
|
30
|
+
var rawQueryStringified = '';
|
|
31
|
+
var queryString = entityConfigs.map(function (entityConfig) {
|
|
32
|
+
var action = entityConfig.action,
|
|
33
|
+
ids = entityConfig.ids,
|
|
34
|
+
entity = entityConfig.entity,
|
|
35
|
+
propsQuery = entityConfig.propsQuery,
|
|
36
|
+
shapeKey = entityConfig.shapeKey,
|
|
37
|
+
filtersObject = entityConfig.filtersObject;
|
|
38
|
+
if (!action) return '';
|
|
39
|
+
var formatedEntity = "".concat(entity[0].toUpperCase()).concat(entity.slice(1));
|
|
40
|
+
var filterQueryKey = action.indexOf('Published') !== -1 ? "Published".concat(formatedEntity) : formatedEntity;
|
|
33
41
|
entityIds.push.apply(entityIds, (0, _toConsumableArray2["default"])(ids));
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
var props = propsQuery.trim() || 'id';
|
|
43
|
+
var singleItemQuery = filtersObject ? (0, _queries.generateFiltersQuery)(shapeKey, props, JSON.stringify(filtersObject), filterQueryKey) : (0, _queries.generateIdsQuery)(shapeKey, props, action, ids);
|
|
44
|
+
return singleItemQuery;
|
|
45
|
+
}).join(' ');
|
|
37
46
|
return {
|
|
38
47
|
query: queryString ? (0, _queries.generateQuery)(queryString) : '',
|
|
39
|
-
ids: entityIds
|
|
48
|
+
ids: entityIds,
|
|
49
|
+
rawQueryStringified: rawQueryStringified
|
|
40
50
|
};
|
|
41
51
|
};
|
|
42
52
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"names":["buildQuery","entityConfigs","entityIds","queryString","
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/build-query.js"],"names":["buildQuery","entityConfigs","entityIds","rawQueryStringified","queryString","map","entityConfig","action","ids","entity","propsQuery","shapeKey","filtersObject","formatedEntity","toUpperCase","slice","filterQueryKey","indexOf","push","props","trim","singleItemQuery","JSON","stringify","join","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAAAC,aAAa,EAAI;AAClC,MAAMC,SAAS,GAAG,EAAlB;AACA,MAAMC,mBAAmB,GAAG,EAA5B;AACA,MAAMC,WAAW,GAAGH,aAAa,CAC9BI,GADiB,CACb,UAAAC,YAAY,EAAI;AACnB,QAAQC,MAAR,GAAqED,YAArE,CAAQC,MAAR;AAAA,QAAgBC,GAAhB,GAAqEF,YAArE,CAAgBE,GAAhB;AAAA,QAAqBC,MAArB,GAAqEH,YAArE,CAAqBG,MAArB;AAAA,QAA6BC,UAA7B,GAAqEJ,YAArE,CAA6BI,UAA7B;AAAA,QAAyCC,QAAzC,GAAqEL,YAArE,CAAyCK,QAAzC;AAAA,QAAmDC,aAAnD,GAAqEN,YAArE,CAAmDM,aAAnD;AACA,QAAI,CAACL,MAAL,EAAa,OAAO,EAAP;AACb,QAAMM,cAAc,aAAMJ,MAAM,CAAC,CAAD,CAAN,CAAUK,WAAV,EAAN,SAAgCL,MAAM,CAACM,KAAP,CAAa,CAAb,CAAhC,CAApB;AACA,QAAMC,cAAc,GAClBT,MAAM,CAACU,OAAP,CAAe,WAAf,MAAgC,CAAC,CAAjC,sBAAiDJ,cAAjD,IAAoEA,cADtE;AAGAX,IAAAA,SAAS,CAACgB,IAAV,OAAAhB,SAAS,sCAASM,GAAT,EAAT;AACA,QAAMW,KAAK,GAAGT,UAAU,CAACU,IAAX,MAAqB,IAAnC;AACA,QAAMC,eAAe,GAAGT,aAAa,GACjC,mCAAqBD,QAArB,EAA+BQ,KAA/B,EAAsCG,IAAI,CAACC,SAAL,CAAeX,aAAf,CAAtC,EAAqEI,cAArE,CADiC,GAEjC,+BAAiBL,QAAjB,EAA2BQ,KAA3B,EAAkCZ,MAAlC,EAA0CC,GAA1C,CAFJ;AAIA,WAAOa,eAAP;AACD,GAfiB,EAgBjBG,IAhBiB,CAgBZ,GAhBY,CAApB;AAkBA,SAAO;AACLC,IAAAA,KAAK,EAAErB,WAAW,GAAG,4BAAcA,WAAd,CAAH,GAAgC,EAD7C;AAELI,IAAAA,GAAG,EAAEN,SAFA;AAGLC,IAAAA,mBAAmB,EAAnBA;AAHK,GAAP;AAKD,CA1BD;;eA4BeH,U","sourcesContent":["import { 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 = `${entity[0].toUpperCase()}${entity.slice(1)}`;\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"],"file":"build-query.js"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.object.define-properties.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.define-property.js");
|
|
12
|
+
|
|
13
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
exports["default"] = void 0;
|
|
19
|
+
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
22
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
23
|
+
|
|
24
|
+
require("core-js/modules/es.string.trim.js");
|
|
25
|
+
|
|
26
|
+
require("core-js/modules/es.array.reduce.js");
|
|
27
|
+
|
|
28
|
+
require("core-js/modules/es.object.to-string.js");
|
|
29
|
+
|
|
30
|
+
require("core-js/modules/es.array.includes.js");
|
|
31
|
+
|
|
32
|
+
require("core-js/modules/es.string.includes.js");
|
|
33
|
+
|
|
34
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
35
|
+
|
|
36
|
+
require("core-js/modules/es.string.split.js");
|
|
37
|
+
|
|
38
|
+
require("core-js/modules/es.array.concat.js");
|
|
39
|
+
|
|
40
|
+
require("core-js/modules/es.array.filter.js");
|
|
41
|
+
|
|
42
|
+
require("core-js/modules/es.object.keys.js");
|
|
43
|
+
|
|
44
|
+
require("core-js/modules/es.array.map.js");
|
|
45
|
+
|
|
46
|
+
require("core-js/modules/es.array.for-each.js");
|
|
47
|
+
|
|
48
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
49
|
+
|
|
50
|
+
var _lodash = _interopRequireDefault(require("lodash.flatten"));
|
|
51
|
+
|
|
52
|
+
var _constants = require("../../constants");
|
|
53
|
+
|
|
54
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
55
|
+
|
|
56
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
57
|
+
|
|
58
|
+
var getPropValues = function getPropValues(properties) {
|
|
59
|
+
return properties.reduce(function (acc, property) {
|
|
60
|
+
if (property.includes('.')) {
|
|
61
|
+
var _property$split = property.split('.'),
|
|
62
|
+
_property$split2 = (0, _slicedToArray2["default"])(_property$split, 2),
|
|
63
|
+
relationName = _property$split2[0],
|
|
64
|
+
relationProp = _property$split2[1];
|
|
65
|
+
|
|
66
|
+
return "".concat(acc, " ").concat(relationName, " { ").concat(relationProp, " }");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return "".concat(acc, " ").concat(property);
|
|
70
|
+
}, '').trim();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var getUpdatedPropsQuery = function getUpdatedPropsQuery(propsQuery, entityData) {
|
|
74
|
+
var _entityData$propertie = entityData.properties,
|
|
75
|
+
properties = _entityData$propertie === void 0 ? {} : _entityData$propertie,
|
|
76
|
+
_entityData$dynamicPr = entityData.dynamicProperties,
|
|
77
|
+
dynamicProperties = _entityData$dynamicPr === void 0 ? {} : _entityData$dynamicPr;
|
|
78
|
+
|
|
79
|
+
var _Object$keys$filter = Object.keys(dynamicProperties).filter(function (prop) {
|
|
80
|
+
return prop === _constants.URL;
|
|
81
|
+
}),
|
|
82
|
+
_Object$keys$filter2 = (0, _slicedToArray2["default"])(_Object$keys$filter, 1),
|
|
83
|
+
url = _Object$keys$filter2[0];
|
|
84
|
+
|
|
85
|
+
var hasImage = !!Object.keys(properties).filter(function (prop) {
|
|
86
|
+
return prop === _constants.IMAGE_ID;
|
|
87
|
+
}).length;
|
|
88
|
+
var updatedPropsQuery = hasImage ? "".concat(propsQuery, " ").concat(_constants.IMAGE_ID) : propsQuery;
|
|
89
|
+
updatedPropsQuery = url ? "".concat(updatedPropsQuery, " ").concat(_constants.URL) : updatedPropsQuery;
|
|
90
|
+
return updatedPropsQuery;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
var buildFilterQueryString = function buildFilterQueryString(filter) {
|
|
94
|
+
var _filter$split = filter.split('/'),
|
|
95
|
+
_filter$split2 = (0, _slicedToArray2["default"])(_filter$split, 2),
|
|
96
|
+
filterKey = _filter$split2[0],
|
|
97
|
+
filterValue = _filter$split2[1];
|
|
98
|
+
|
|
99
|
+
var filterKeyword = "".concat(filterKey, ".keyword");
|
|
100
|
+
return {
|
|
101
|
+
bool: {
|
|
102
|
+
should: [{
|
|
103
|
+
match: (0, _defineProperty2["default"])({}, filterKeyword, filterValue)
|
|
104
|
+
}]
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var buildFilters = function buildFilters(filters) {
|
|
110
|
+
if (!filters || !filters.length) return null;
|
|
111
|
+
var filterQueryProps = filters.map(buildFilterQueryString);
|
|
112
|
+
return {
|
|
113
|
+
bool: {
|
|
114
|
+
should: filterQueryProps
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
var buiildShapeProps = function buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup) {
|
|
120
|
+
var _shape$displayItems = shape.displayItems,
|
|
121
|
+
displayItems = _shape$displayItems === void 0 ? [] : _shape$displayItems,
|
|
122
|
+
filterBy = shape.filterBy;
|
|
123
|
+
var latProp = entityGroup.latProp,
|
|
124
|
+
lonProp = entityGroup.lonProp,
|
|
125
|
+
entity = entityGroup.entity;
|
|
126
|
+
var actions = entityData.actions;
|
|
127
|
+
var action = actions ? actions.getAllPublished || actions.getAll : '';
|
|
128
|
+
var dataSummaryProps = dataSummaries.reduce(function (acc, _ref) {
|
|
129
|
+
var propsToDisplay = _ref.propsToDisplay;
|
|
130
|
+
var propsToDisplayValues = (0, _lodash["default"])(propsToDisplay.map(function (_ref2) {
|
|
131
|
+
var propertiesToDisplay = _ref2.propertiesToDisplay;
|
|
132
|
+
return propertiesToDisplay;
|
|
133
|
+
}));
|
|
134
|
+
var propsToDisplayString = getPropValues(propsToDisplayValues);
|
|
135
|
+
return "".concat(acc, " ").concat(propsToDisplayString);
|
|
136
|
+
}, '').trim();
|
|
137
|
+
var ids = [];
|
|
138
|
+
displayItems.length ? ids.push(displayItems[0]) : ids.push(parentId);
|
|
139
|
+
var filtersObject = buildFilters(filterBy);
|
|
140
|
+
var propsQuery = dataSummaryProps ? "".concat(dataSummaryProps) : '';
|
|
141
|
+
propsQuery = getUpdatedPropsQuery(propsQuery, entityData);
|
|
142
|
+
|
|
143
|
+
if (latProp && lonProp) {
|
|
144
|
+
propsQuery = "".concat(propsQuery, " ").concat(formatProp(latProp), " ").concat(formatProp(lonProp));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (ids.length && !propsQuery.includes(_constants.ID)) propsQuery = "".concat(propsQuery.trim(), " ").concat(_constants.ID);
|
|
148
|
+
return {
|
|
149
|
+
shapeKey: shapeKey,
|
|
150
|
+
entity: entity,
|
|
151
|
+
propsQuery: propsQuery,
|
|
152
|
+
ids: ids,
|
|
153
|
+
action: action,
|
|
154
|
+
filtersObject: filtersObject
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var formatProp = function formatProp(prop) {
|
|
159
|
+
if (!prop.includes('.')) return prop;
|
|
160
|
+
|
|
161
|
+
var _prop$split = prop.split('.'),
|
|
162
|
+
_prop$split2 = (0, _slicedToArray2["default"])(_prop$split, 2),
|
|
163
|
+
mainProp = _prop$split2[0],
|
|
164
|
+
nestedProp = _prop$split2[1];
|
|
165
|
+
|
|
166
|
+
return "".concat(mainProp, "{").concat(nestedProp, "}");
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
var buildShapesConfig = function buildShapesConfig(schemas, entityGroups, parent) {
|
|
170
|
+
if (!schemas || !entityGroups) return [];
|
|
171
|
+
var itemId = parent.itemId,
|
|
172
|
+
itemEntity = parent.itemEntity;
|
|
173
|
+
var shapeGroups = [];
|
|
174
|
+
entityGroups.forEach(function (entityGroup, i) {
|
|
175
|
+
var entity = entityGroup.entity,
|
|
176
|
+
shapes = entityGroup.shapes,
|
|
177
|
+
_entityGroup$dataSumm = entityGroup.dataSummaries,
|
|
178
|
+
dataSummaries = _entityGroup$dataSumm === void 0 ? [] : _entityGroup$dataSumm;
|
|
179
|
+
var parentId = entity === itemEntity && itemId;
|
|
180
|
+
if (!entity) return null;
|
|
181
|
+
var entityData = schemas[entity] || {};
|
|
182
|
+
shapes.filter(Boolean).forEach(function (shape, shapeIndex) {
|
|
183
|
+
var shapeKey = "shape".concat(i).concat(shapeIndex);
|
|
184
|
+
var shapeValues = buiildShapeProps(shape, shapeKey, dataSummaries, parentId, entityData, entityGroup);
|
|
185
|
+
shapeGroups.push(_objectSpread(_objectSpread({}, shapeValues), {}, {
|
|
186
|
+
shapeOptions: shape,
|
|
187
|
+
entityOptions: entityGroup
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
return shapeGroups;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
var _default = buildShapesConfig;
|
|
195
|
+
exports["default"] = _default;
|
|
196
|
+
//# sourceMappingURL=build-shapes-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/build-shapes-configs.js"],"names":["getPropValues","properties","reduce","acc","property","includes","split","relationName","relationProp","trim","getUpdatedPropsQuery","propsQuery","entityData","dynamicProperties","Object","keys","filter","prop","URL","url","hasImage","IMAGE_ID","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","action","getAllPublished","getAll","dataSummaryProps","propsToDisplay","propsToDisplayValues","propertiesToDisplay","propsToDisplayString","ids","push","filtersObject","formatProp","ID","mainProp","nestedProp","buildShapesConfig","schemas","entityGroups","parent","itemId","itemEntity","shapeGroups","forEach","i","shapes","Boolean","shapeIndex","shapeValues","shapeOptions","entityOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,UAAU;AAAA,SAC9BA,UAAU,CACPC,MADH,CACU,UAACC,GAAD,EAAMC,QAAN,EAAmB;AACzB,QAAIA,QAAQ,CAACC,QAAT,CAAkB,GAAlB,CAAJ,EAA4B;AAC1B,4BAAqCD,QAAQ,CAACE,KAAT,CAAe,GAAf,CAArC;AAAA;AAAA,UAAOC,YAAP;AAAA,UAAqBC,YAArB;;AACA,uBAAUL,GAAV,cAAiBI,YAAjB,gBAAmCC,YAAnC;AACD;;AACD,qBAAUL,GAAV,cAAiBC,QAAjB;AACD,GAPH,EAOK,EAPL,EAQGK,IARH,EAD8B;AAAA,CAAhC;;AAWA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,UAAD,EAAaC,UAAb,EAA4B;AACvD,8BAAoDA,U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,MAAgBC,UAAhB,GAA+BF,MAA/B,CAAgBE,UAAhB;AACA,MAAMC,WAAW,GAAG,EAApB;AACAJ,EAAAA,YAAY,CAACK,OAAb,CAAqB,UAAC7B,WAAD,EAAc8B,CAAd,EAAoB;AACvC,QAAQzB,MAAR,GAA+CL,WAA/C,CAAQK,MAAR;AAAA,QAAgB0B,MAAhB,GAA+C/B,WAA/C,CAAgB+B,MAAhB;AAAA,gCAA+C/B,WAA/C,CAAwBF,aAAxB;AAAA,QAAwBA,aAAxB,sCAAwC,EAAxC;AACA,QAAMC,QAAQ,GAAGM,MAAM,KAAKsB,UAAX,IAAyBD,MAA1C;AACA,QAAI,CAACrB,MAAL,EAAa,OAAO,IAAP;AACb,QAAMjC,UAAU,GAAGmD,OAAO,CAAClB,MAAD,CAAP,IAAmB,EAAtC;AAEA0B,IAAAA,MAAM,CAACvD,MAAP,CAAcwD,OAAd,EAAuBH,OAAvB,CAA+B,UAACjC,KAAD,EAAQqC,UAAR,EAAuB;AACpD,UAAMpC,QAAQ,kBAAWiC,CAAX,SAAeG,UAAf,CAAd;AACA,UAAMC,WAAW,GAAGvC,gBAAgB,CAClCC,KADkC,EAElCC,QAFkC,EAGlCC,aAHkC,EAIlCC,QAJkC,EAKlC3B,UALkC,EAMlC4B,WANkC,CAApC;AAQA4B,MAAAA,WAAW,CAACZ,IAAZ,iCAAsBkB,WAAtB;AAAmCC,QAAAA,YAAY,EAAEvC,KAAjD;AAAwDwC,QAAAA,aAAa,EAAEpC;AAAvE;AACD,KAXD;AAYD,GAlBD;AAoBA,SAAO4B,WAAP;AACD,CAzBD;;eA2BeN,iB","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 } = 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)} ${formatProp(lonProp)}`;\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 => {\n if (!prop.includes('.')) return prop;\n\n const [mainProp, nestedProp] = prop.split('.');\n return `${mainProp}{${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"],"file":"build-shapes-configs.js"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.array.filter.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.object.to-string.js");
|
|
15
|
+
|
|
16
|
+
require("core-js/modules/es.array.for-each.js");
|
|
17
|
+
|
|
18
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
19
|
+
|
|
20
|
+
var _lodash = _interopRequireDefault(require("lodash.isnumber"));
|
|
21
|
+
|
|
22
|
+
var getCenterCoordinates = function getCenterCoordinates(mapShapes, otherProps) {
|
|
23
|
+
var centerCoordinates = [];
|
|
24
|
+
var centerLatitude = otherProps.centerLatitude,
|
|
25
|
+
centerLongitude = otherProps.centerLongitude;
|
|
26
|
+
var useDefaultCenter = centerLatitude !== 0 && centerLongitude !== 0 && (0, _lodash["default"])(centerLatitude) && (0, _lodash["default"])(centerLongitude);
|
|
27
|
+
if (useDefaultCenter) return [{
|
|
28
|
+
latitude: centerLatitude,
|
|
29
|
+
longitude: centerLongitude
|
|
30
|
+
}];
|
|
31
|
+
var useAsCenterShapes = mapShapes.filter(function (_ref) {
|
|
32
|
+
var useAsCenter = _ref.useAsCenter;
|
|
33
|
+
return useAsCenter;
|
|
34
|
+
});
|
|
35
|
+
var shapesForCenter = useAsCenterShapes.length ? useAsCenterShapes : mapShapes;
|
|
36
|
+
shapesForCenter.forEach(function (_ref2) {
|
|
37
|
+
var latitude = _ref2.latitude,
|
|
38
|
+
longitude = _ref2.longitude;
|
|
39
|
+
if ((0, _lodash["default"])(latitude) && (0, _lodash["default"])(longitude)) centerCoordinates.push({
|
|
40
|
+
latitude: latitude,
|
|
41
|
+
longitude: longitude
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
return centerCoordinates;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _default = getCenterCoordinates;
|
|
48
|
+
exports["default"] = _default;
|
|
49
|
+
//# sourceMappingURL=get-center-coordinates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/get-center-coordinates.js"],"names":["getCenterCoordinates","mapShapes","otherProps","centerCoordinates","centerLatitude","centerLongitude","useDefaultCenter","latitude","longitude","useAsCenterShapes","filter","useAsCenter","shapesForCenter","length","forEach","push"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAEA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,SAAD,EAAYC,UAAZ,EAA2B;AACtD,MAAMC,iBAAiB,GAAG,EAA1B;AAEA,MAAQC,cAAR,GAA4CF,UAA5C,CAAQE,cAAR;AAAA,MAAwBC,eAAxB,GAA4CH,UAA5C,CAAwBG,eAAxB;AACA,MAAMC,gBAAgB,GACpBF,cAAc,KAAK,CAAnB,IACAC,eAAe,KAAK,CADpB,IAEA,wBAASD,cAAT,CAFA,IAGA,wBAASC,eAAT,CAJF;AAMA,MAAIC,gBAAJ,EAAsB,OAAO,CAAC;AAAEC,IAAAA,QAAQ,EAAEH,cAAZ;AAA4BI,IAAAA,SAAS,EAAEH;AAAvC,GAAD,CAAP;AAEtB,MAAMI,iBAAiB,GAAGR,SAAS,CAACS,MAAV,CAAiB;AAAA,QAAGC,WAAH,QAAGA,WAAH;AAAA,WAAqBA,WAArB;AAAA,GAAjB,CAA1B;AACA,MAAMC,eAAe,GAAGH,iBAAiB,CAACI,MAAlB,GAA2BJ,iBAA3B,GAA+CR,SAAvE;AACAW,EAAAA,eAAe,CAACE,OAAhB,CAAwB,iBAA6B;AAAA,QAA1BP,QAA0B,SAA1BA,QAA0B;AAAA,QAAhBC,SAAgB,SAAhBA,SAAgB;AACnD,QAAI,wBAASD,QAAT,KAAsB,wBAASC,SAAT,CAA1B,EAA+CL,iBAAiB,CAACY,IAAlB,CAAuB;AAAER,MAAAA,QAAQ,EAARA,QAAF;AAAYC,MAAAA,SAAS,EAATA;AAAZ,KAAvB;AAChD,GAFD;AAIA,SAAOL,iBAAP;AACD,CAnBD;;eAqBeH,oB","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"],"file":"get-center-coordinates.js"}
|
|
@@ -17,21 +17,23 @@ require("core-js/modules/es.object.to-string.js");
|
|
|
17
17
|
|
|
18
18
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
19
19
|
|
|
20
|
-
require("core-js/modules/es.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
require("core-js/modules/es.array.iterator.js");
|
|
21
|
+
|
|
22
|
+
require("core-js/modules/es.set.js");
|
|
23
|
+
|
|
24
|
+
require("core-js/modules/es.string.iterator.js");
|
|
25
|
+
|
|
26
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
27
|
+
|
|
28
|
+
var getImageIds = function getImageIds(mapShapes) {
|
|
29
|
+
var ids = [];
|
|
30
|
+
mapShapes.forEach(function (_ref) {
|
|
31
|
+
var shapeData = _ref.shapeData,
|
|
32
|
+
imageId = _ref.imageId;
|
|
33
|
+
if (imageId) ids.push(imageId);
|
|
34
|
+
if (shapeData.imageId) ids.push(shapeData.imageId);
|
|
33
35
|
});
|
|
34
|
-
return
|
|
36
|
+
return (0, _toConsumableArray2["default"])(new Set(ids));
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
var _default = getImageIds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/GoogleMaps/helpers/get-image-ids.js"],"names":["getImageIds","
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/get-image-ids.js"],"names":["getImageIds","mapShapes","ids","forEach","shapeData","imageId","push","Set"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAAAC,SAAS,EAAI;AAC/B,MAAMC,GAAG,GAAG,EAAZ;AACAD,EAAAA,SAAS,CAACE,OAAV,CAAkB,gBAA4B;AAAA,QAAzBC,SAAyB,QAAzBA,SAAyB;AAAA,QAAdC,OAAc,QAAdA,OAAc;AAC5C,QAAIA,OAAJ,EAAaH,GAAG,CAACI,IAAJ,CAASD,OAAT;AACb,QAAID,SAAS,CAACC,OAAd,EAAuBH,GAAG,CAACI,IAAJ,CAASF,SAAS,CAACC,OAAnB;AACxB,GAHD;AAIA,6CAAW,IAAIE,GAAJ,CAAQL,GAAR,CAAX;AACD,CAPD;;eASeF,W","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"],"file":"get-image-ids.js"}
|
|
@@ -13,22 +13,34 @@ Object.defineProperty(exports, "addZoomListener", {
|
|
|
13
13
|
return _addZoomListener["default"];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "buildMapShapes", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _buildMapShapes["default"];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
16
22
|
Object.defineProperty(exports, "buildQuery", {
|
|
17
23
|
enumerable: true,
|
|
18
24
|
get: function get() {
|
|
19
25
|
return _buildQuery["default"];
|
|
20
26
|
}
|
|
21
27
|
});
|
|
22
|
-
Object.defineProperty(exports, "
|
|
28
|
+
Object.defineProperty(exports, "buildShapesConfig", {
|
|
23
29
|
enumerable: true,
|
|
24
30
|
get: function get() {
|
|
25
|
-
return
|
|
31
|
+
return _buildShapesConfigs["default"];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "getCenterCoordinates", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function get() {
|
|
37
|
+
return _getCenterCoordinates["default"];
|
|
26
38
|
}
|
|
27
39
|
});
|
|
28
|
-
Object.defineProperty(exports, "
|
|
40
|
+
Object.defineProperty(exports, "getImageIds", {
|
|
29
41
|
enumerable: true,
|
|
30
42
|
get: function get() {
|
|
31
|
-
return
|
|
43
|
+
return _getImageIds["default"];
|
|
32
44
|
}
|
|
33
45
|
});
|
|
34
46
|
Object.defineProperty(exports, "setMapOptions", {
|
|
@@ -44,7 +56,11 @@ var _buildQuery = _interopRequireDefault(require("./build-query"));
|
|
|
44
56
|
|
|
45
57
|
var _getImageIds = _interopRequireDefault(require("./get-image-ids"));
|
|
46
58
|
|
|
47
|
-
var
|
|
59
|
+
var _buildShapesConfigs = _interopRequireDefault(require("./build-shapes-configs"));
|
|
48
60
|
|
|
49
61
|
var _setMapOptions = _interopRequireDefault(require("./set-map-options"));
|
|
62
|
+
|
|
63
|
+
var _getCenterCoordinates = _interopRequireDefault(require("./get-center-coordinates"));
|
|
64
|
+
|
|
65
|
+
var _buildMapShapes = _interopRequireDefault(require("./build-map-shapes"));
|
|
50
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/GoogleMaps/helpers/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/GoogleMaps/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","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"],"file":"index.js"}
|