awing-library 2.1.188-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.
@@ -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, center: marker, onLoad: onLoadMap, onClick: onMapClick }, isTypeTracking && {
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,
@@ -147,6 +174,7 @@ var GGMap = function (_a) {
147
174
  streetViewControl: false,
148
175
  mapTypeControl: false,
149
176
  fullscreenControl: false,
177
+ minZoom: 2
150
178
  }
151
179
  }, { children: !markerPositions ?
152
180
  (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsx)(api_1.Marker, { position: marker }), (0, jsx_runtime_1.jsx)(api_1.Circle, { center: marker, radius: geofenceRadius, options: {
@@ -156,17 +184,16 @@ var GGMap = function (_a) {
156
184
  strokeOpacity: 1,
157
185
  strokeWeight: 2,
158
186
  } })] })
159
- : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: markerPositions === null || markerPositions === void 0 ? void 0 : markerPositions.map(function (coordinates, index, positions) {
160
- var _a, _b;
161
- // const radius =
162
- // Math.max(
163
- // 30,
164
- // (coordinates.count /
165
- // Math.max(...positions.map((p) => p.count))) *
166
- // 120
167
- // ) *
168
- // (1 / 7);
169
- 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);
170
196
  }) }) }))] }) }));
171
197
  };
172
198
  exports.default = GGMap;
199
+ var templateObject_1;
@@ -39,7 +39,7 @@ exports.mapStyles = [
39
39
  "elementType": "geometry",
40
40
  "stylers": [
41
41
  {
42
- "color": "#212225"
42
+ "color": "#f7f9fa"
43
43
  }
44
44
  ]
45
45
  },
@@ -48,7 +48,7 @@ exports.mapStyles = [
48
48
  "elementType": "labels.text.fill",
49
49
  "stylers": [
50
50
  {
51
- "color": "#212225"
51
+ "color": "#80868b"
52
52
  }
53
53
  ]
54
54
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.188-dev",
3
+ "version": "2.1.190-dev",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",