awing-library 2.1.189-dev → 2.1.190-dev
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/lib/AWING/GoogleMap/GGMap.js +38 -12
- package/package.json +1 -1
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -25,6 +29,7 @@ var mapContainerStyle = {
|
|
|
25
29
|
height: '320px',
|
|
26
30
|
width: '100%',
|
|
27
31
|
};
|
|
32
|
+
var myEffectExit = (0, material_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n transform: scale(1);\n border: 0px solid #fff;\n opacity: 1;\n }\n 25% {\n transform: scale(1.1);\n border: 10px solid #1a78fc;\n opacity: 0.8;\n }\n 50% {\n transform: scale(1.12);\n\tborder: 8px solid #1a78fc;\n opacity: 0.5;\n }\n 75% {\n transform: scale(1.14);\n\tborder: 6px solid #1a78fc;\n opacity: 0.3;\n }\n 100% {\n transform: scale(1.16);\n\tborder: 4px solid #1a78fc;\n opacity: 0.2;\n }\n"], ["\n 0% {\n transform: scale(1);\n border: 0px solid #fff;\n opacity: 1;\n }\n 25% {\n transform: scale(1.1);\n border: 10px solid #1a78fc;\n opacity: 0.8;\n }\n 50% {\n transform: scale(1.12);\n\tborder: 8px solid #1a78fc;\n opacity: 0.5;\n }\n 75% {\n transform: scale(1.14);\n\tborder: 6px solid #1a78fc;\n opacity: 0.3;\n }\n 100% {\n transform: scale(1.16);\n\tborder: 4px solid #1a78fc;\n opacity: 0.2;\n }\n"])));
|
|
28
33
|
var libraries = ['places'];
|
|
29
34
|
var stylesDefault = {
|
|
30
35
|
position: 'relative',
|
|
@@ -44,6 +49,22 @@ var GGMap = function (_a) {
|
|
|
44
49
|
var onLoad = function (autocomplete) {
|
|
45
50
|
autocompleteRef.current = autocomplete;
|
|
46
51
|
};
|
|
52
|
+
var markerConvert = (0, react_1.useMemo)(function () {
|
|
53
|
+
var _a;
|
|
54
|
+
var coordMap = (_a = markerPositions === null || markerPositions === void 0 ? void 0 : markerPositions.reduce(function (acc, _a) {
|
|
55
|
+
var longitude = _a.longitude, latitude = _a.latitude;
|
|
56
|
+
var key = "".concat(longitude, ",").concat(latitude);
|
|
57
|
+
if (acc[key]) {
|
|
58
|
+
acc[key].count += 1;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
acc[key] = { longitude: longitude, latitude: latitude, count: 1 };
|
|
62
|
+
}
|
|
63
|
+
return acc;
|
|
64
|
+
}, {})) !== null && _a !== void 0 ? _a : {};
|
|
65
|
+
// Convert the object to an array
|
|
66
|
+
return Object.values(coordMap);
|
|
67
|
+
}, [markerPosition]);
|
|
47
68
|
var onPlaceChanged = function () {
|
|
48
69
|
var _a, _b, _c, _d;
|
|
49
70
|
if (autocompleteRef.current !== null) {
|
|
@@ -116,6 +137,9 @@ var GGMap = function (_a) {
|
|
|
116
137
|
lng: (_b = Number(markerPosition === null || markerPosition === void 0 ? void 0 : markerPosition.longitude)) !== null && _b !== void 0 ? _b : 0,
|
|
117
138
|
};
|
|
118
139
|
}, [markerPosition]);
|
|
140
|
+
var calculateRadius = function (currentZoom) {
|
|
141
|
+
return 100000 * Math.pow(2, 5 - currentZoom);
|
|
142
|
+
};
|
|
119
143
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: sxMap ? sxMap : stylesDefault, ref: boxRef, children: (0, jsx_runtime_1.jsxs)(api_1.LoadScript, { googleMapsApiKey: apiKey || '', libraries: libraries, children: [!isDisplayAutoComplete &&
|
|
120
144
|
((0, jsx_runtime_1.jsx)(api_1.Autocomplete, { onPlaceChanged: onPlaceChanged, onLoad: onLoad, children: (0, jsx_runtime_1.jsx)("input", { type: "text", placeholder: t('Common.PlaceHolderLocation'), onFocus: function () {
|
|
121
145
|
var _a;
|
|
@@ -139,7 +163,10 @@ var GGMap = function (_a) {
|
|
|
139
163
|
margin: '10px 0',
|
|
140
164
|
zIndex: 99,
|
|
141
165
|
top: '50px',
|
|
142
|
-
} }) })), (0, jsx_runtime_1.jsx)(api_1.GoogleMap, __assign({ id: "map", mapContainerStyle: sizeMap !== null && sizeMap !== void 0 ? sizeMap : mapContainerStyle, zoom: zoom,
|
|
166
|
+
} }) })), (0, jsx_runtime_1.jsx)(api_1.GoogleMap, __assign({ id: "map", mapContainerStyle: sizeMap !== null && sizeMap !== void 0 ? sizeMap : mapContainerStyle, zoom: zoom, onZoomChanged: function () {
|
|
167
|
+
var _a;
|
|
168
|
+
setZoom((_a = map === null || map === void 0 ? void 0 : map.getZoom()) !== null && _a !== void 0 ? _a : 0);
|
|
169
|
+
}, center: marker, onLoad: onLoadMap, onClick: onMapClick }, isTypeTracking && {
|
|
143
170
|
options: {
|
|
144
171
|
disableDefaultUI: true,
|
|
145
172
|
styles: utils_1.mapStyles,
|
|
@@ -157,17 +184,16 @@ var GGMap = function (_a) {
|
|
|
157
184
|
strokeOpacity: 1,
|
|
158
185
|
strokeWeight: 2,
|
|
159
186
|
} })] })
|
|
160
|
-
: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children:
|
|
161
|
-
var _a, _b;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// (1 / 7);
|
|
170
|
-
return (0, jsx_runtime_1.jsx)(api_1.Marker, { position: { lat: (_a = coordinates.latitude) !== null && _a !== void 0 ? _a : 0, lng: (_b = coordinates.longitude) !== null && _b !== void 0 ? _b : 0 } }, index);
|
|
187
|
+
: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: markerConvert === null || markerConvert === void 0 ? void 0 : markerConvert.map(function (coordinates, index, positions) {
|
|
188
|
+
var _a, _b, _c;
|
|
189
|
+
return (0, jsx_runtime_1.jsx)(api_1.CircleF, { center: { lat: (_a = coordinates.latitude) !== null && _a !== void 0 ? _a : 0, lng: (_b = coordinates.longitude) !== null && _b !== void 0 ? _b : 0 }, radius: calculateRadius(zoom * (((_c = coordinates === null || coordinates === void 0 ? void 0 : coordinates.count) !== null && _c !== void 0 ? _c : 0))), options: {
|
|
190
|
+
strokeColor: '#4285F4',
|
|
191
|
+
strokeOpacity: 0.8,
|
|
192
|
+
strokeWeight: 2,
|
|
193
|
+
fillColor: "#4285F4",
|
|
194
|
+
fillOpacity: 0.35,
|
|
195
|
+
} }, index);
|
|
171
196
|
}) }) }))] }) }));
|
|
172
197
|
};
|
|
173
198
|
exports.default = GGMap;
|
|
199
|
+
var templateObject_1;
|