@mixd-id/web-scaffold 0.1.2301231366 → 0.1.2301231368

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.2301231366",
4
+ "version": "0.1.2301231368",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@faker-js/faker": "^7.3.0",
23
+ "@googlemaps/js-api-loader": "^1.15.1",
23
24
  "@tailwindcss/line-clamp": "^0.4.0",
24
25
  "@vueuse/core": "^9.0.2",
25
26
  "adm-zip": "^0.5.10",
@@ -0,0 +1,227 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div v-if="apiKey" ref="map" class="flex-1"></div>
4
+ <div v-else class="flex-1 flex items-center justify-center text-text-400">{{ $t('Google maps api required') }}</div>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+
10
+ import { Loader } from '@googlemaps/js-api-loader';
11
+
12
+ export default{
13
+
14
+ props: {
15
+ data: Array,
16
+ config: Object,
17
+ apiKey: String
18
+ },
19
+
20
+ data(){
21
+ return {
22
+ map: null
23
+ }
24
+ },
25
+
26
+ mounted() {
27
+ this.load()
28
+ },
29
+
30
+ methods: {
31
+
32
+ load(){
33
+ if(!this.apiKey) return
34
+
35
+ if(!Array.isArray(this.data) || this.data.length < 1)
36
+ return
37
+
38
+ const loader = new Loader({
39
+ apiKey: this.apiKey // "AIzaSyBmzMlmrR5St-njtN--64y_oLTa9FDLYfQ"
40
+ })
41
+
42
+ loader.load()
43
+ .then(async () => {
44
+
45
+ const { Map } = await google.maps.importLibrary([ "maps" ]);
46
+ await google.maps.importLibrary("visualization", ["HeatmapLayer"]);
47
+
48
+ var center = new google.maps.LatLng(
49
+ this.config.center ? this.config.center[0] : -6.2088,
50
+ this.config.center ? this.config.center[1] : 106.8456);
51
+
52
+ this.map = new Map(this.$refs.map, {
53
+ center: center,
54
+ zoom: this.config.zoom ?? 7,
55
+ mapTypeId: 'roadmap',
56
+ streetViewControl: false,
57
+ keyboardShortcuts: false,
58
+ styles: [
59
+ { elementType: "geometry", stylers: [{ color: "#242f3e" }] },
60
+ { elementType: "labels.text.stroke", stylers: [{ color: "#242f3e" }] },
61
+ { elementType: "labels.text.fill", stylers: [{ color: "#746855" }] },
62
+ {
63
+ featureType: "administrative.locality",
64
+ elementType: "labels.text.fill",
65
+ stylers: [{ color: "#d59563" }],
66
+ },
67
+ {
68
+ featureType: "poi",
69
+ elementType: "labels.text.fill",
70
+ stylers: [{ color: "#d59563" }],
71
+ },
72
+ {
73
+ featureType: "poi.park",
74
+ elementType: "geometry",
75
+ stylers: [{ color: "#263c3f" }],
76
+ },
77
+ {
78
+ featureType: "poi.park",
79
+ elementType: "labels.text.fill",
80
+ stylers: [{ color: "#6b9a76" }],
81
+ },
82
+ {
83
+ featureType: "road",
84
+ elementType: "geometry",
85
+ stylers: [{ color: "#38414e" }],
86
+ },
87
+ {
88
+ featureType: "road",
89
+ elementType: "geometry.stroke",
90
+ stylers: [{ color: "#212a37" }],
91
+ },
92
+ {
93
+ featureType: "road",
94
+ elementType: "labels.text.fill",
95
+ stylers: [{ color: "#9ca5b3" }],
96
+ },
97
+ {
98
+ featureType: "road.highway",
99
+ elementType: "geometry",
100
+ stylers: [{ color: "#746855" }],
101
+ },
102
+ {
103
+ featureType: "road.highway",
104
+ elementType: "geometry.stroke",
105
+ stylers: [{ color: "#1f2835" }],
106
+ },
107
+ {
108
+ featureType: "road.highway",
109
+ elementType: "labels.text.fill",
110
+ stylers: [{ color: "#f3d19c" }],
111
+ },
112
+ {
113
+ featureType: "transit",
114
+ elementType: "geometry",
115
+ stylers: [{ color: "#2f3948" }],
116
+ },
117
+ {
118
+ featureType: "transit.station",
119
+ elementType: "labels.text.fill",
120
+ stylers: [{ color: "#d59563" }],
121
+ },
122
+ {
123
+ featureType: "water",
124
+ elementType: "geometry",
125
+ stylers: [{ color: "#17263c" }],
126
+ },
127
+ {
128
+ featureType: "water",
129
+ elementType: "labels.text.fill",
130
+ stylers: [{ color: "#515c6d" }],
131
+ },
132
+ {
133
+ featureType: "water",
134
+ elementType: "labels.text.stroke",
135
+ stylers: [{ color: "#17263c" }],
136
+ },
137
+ ]
138
+ });
139
+
140
+ google.maps.event.addListener(this.map, 'zoom_changed', () => {
141
+ this.config.zoom = this.map.getZoom();
142
+ });
143
+
144
+ google.maps.event.addListener(this.map, 'center_changed', () => {
145
+ this.config.center = [
146
+ this.map.getCenter().lat(),
147
+ this.map.getCenter().lng()
148
+ ]
149
+ });
150
+
151
+ var heatMapData = [
152
+ /*{location: new google.maps.LatLng(37.782, -122.447), weight: 0.5},
153
+ new google.maps.LatLng(37.782, -122.445),
154
+ {location: new google.maps.LatLng(37.782, -122.443), weight: 2},
155
+ {location: new google.maps.LatLng(37.782, -122.441), weight: 3},
156
+ {location: new google.maps.LatLng(37.782, -122.439), weight: 2},
157
+ new google.maps.LatLng(37.782, -122.437),
158
+ {location: new google.maps.LatLng(37.782, -122.435), weight: 0.5},
159
+
160
+ {location: new google.maps.LatLng(37.785, -122.447), weight: 3},
161
+ {location: new google.maps.LatLng(37.785, -122.445), weight: 2},
162
+ new google.maps.LatLng(37.785, -122.443),
163
+ {location: new google.maps.LatLng(37.785, -122.441), weight: 0.5},
164
+ new google.maps.LatLng(37.785, -122.439),
165
+ {location: new google.maps.LatLng(37.785, -122.437), weight: 2},
166
+ {location: new google.maps.LatLng(37.785, -122.435), weight: 3}*/
167
+ ];
168
+
169
+ this.data.forEach((item) => {
170
+ if(item[0] && item[1] && item[2]){
171
+ heatMapData.push({
172
+ location: new google.maps.LatLng(item[0], item[1]),
173
+ weight: item[2]
174
+ })
175
+ }
176
+ })
177
+
178
+ var heatmap = new google.maps.visualization.HeatmapLayer({
179
+ data: heatMapData,
180
+ dissipating: true
181
+ });
182
+ heatmap.set('radius', parseInt(this.config.mapRadius ?? 12))
183
+ heatmap.setMap(this.map);
184
+
185
+ const gradient = [
186
+ "rgba(0, 255, 255, 0)",
187
+ "rgba(0, 255, 255, 1)",
188
+ "rgba(0, 191, 255, 1)",
189
+ "rgba(0, 127, 255, 1)",
190
+ "rgba(0, 63, 255, 1)",
191
+ "rgba(0, 0, 255, 1)",
192
+ "rgba(0, 0, 223, 1)",
193
+ "rgba(0, 0, 191, 1)",
194
+ "rgba(0, 0, 159, 1)",
195
+ "rgba(0, 0, 127, 1)",
196
+ "rgba(63, 0, 91, 1)",
197
+ "rgba(127, 0, 63, 1)",
198
+ "rgba(191, 0, 31, 1)",
199
+ "rgba(255, 0, 0, 1)",
200
+ ];
201
+ heatmap.set("gradient", gradient);
202
+
203
+ //console.log('Gmap, data count:', this.data.length)
204
+ });
205
+ }
206
+
207
+ },
208
+
209
+ watch: {
210
+
211
+ data(){
212
+ this.load()
213
+ }
214
+
215
+ }
216
+
217
+ }
218
+
219
+ </script>
220
+
221
+ <style module>
222
+
223
+ .comp{
224
+ @apply flex-1 flex flex-col;
225
+ }
226
+
227
+ </style>