@mptw/skylens-ui 1.4.97 → 1.4.98
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/components/SLHeatMap.vue +43 -34
- package/nuxt.config.ts +1 -1
- package/package.json +14 -13
- package/plugins/googlemaps.ts +0 -17
package/components/SLHeatMap.vue
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import type { PropType } from "vue";
|
|
7
|
+
import { setOptions, importLibrary } from '@googlemaps/js-api-loader';
|
|
8
|
+
import { GoogleMapsOverlay } from '@deck.gl/google-maps';
|
|
9
|
+
import { HeapmapLayer } from '@deck.gl/aggregation-layers';
|
|
10
|
+
|
|
7
11
|
const RADIUS = 30;
|
|
8
12
|
|
|
9
13
|
export default defineComponent({
|
|
@@ -24,30 +28,34 @@ export default defineComponent({
|
|
|
24
28
|
},
|
|
25
29
|
},
|
|
26
30
|
setup(props) {
|
|
31
|
+
const runtimeConfig = useRuntimeConfig();
|
|
27
32
|
const { latlons, weights, isShowMarker } = toRefs(props);
|
|
28
33
|
|
|
29
|
-
const { $googlemapsLoader } = useNuxtApp();
|
|
30
34
|
const mapEl = shallowRef<HTMLElement | null>(null);
|
|
31
35
|
|
|
32
|
-
let
|
|
33
|
-
let
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
let LatLngBounds: any | null = null;
|
|
37
|
+
let LatLng: any | null = null;
|
|
38
|
+
let AdvancedMarkerElement: any | null = null;
|
|
39
|
+
let map: any | null = null;
|
|
40
|
+
let overlay: any | null = null;
|
|
41
|
+
let markers: any[] = [];
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
await $googlemapsLoader.importLibrary("visualization");
|
|
43
|
+
async function initMap() {
|
|
44
|
+
if (!mapEl.value) return;
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
setOptions({
|
|
47
|
+
key: runtimeConfig.public.googleMapsApiKey,
|
|
48
|
+
});
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const { LatLng: LatLngClass, LatLngBounds: LatLngBoundsClass } = await importLibrary("core");
|
|
51
|
+
const { Map } = await importLibrary("maps");
|
|
52
|
+
const { AdvancedMarkerElement: AdvancedMarkerElementClass } = await importLibrary('marker');
|
|
53
|
+
LatLng = LatLngClass;
|
|
54
|
+
LatLngBounds = LatLngBoundsClass;
|
|
55
|
+
AdvancedMarkerElement = AdvancedMarkerElementClass;
|
|
48
56
|
|
|
49
57
|
if (!map) {
|
|
50
|
-
map =
|
|
58
|
+
map = Map(mapEl.value, {
|
|
51
59
|
disableDefaultUI: true,
|
|
52
60
|
styles: [
|
|
53
61
|
{
|
|
@@ -63,24 +71,26 @@ export default defineComponent({
|
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
map.setCenter({ lat: 23.586114913594802, lng: 120.87814086119803 });
|
|
74
|
+
overlay = new GoogleMapsOverlay();
|
|
75
|
+
overlay.setMap(map);
|
|
66
76
|
|
|
67
77
|
setupHeatmapData();
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
function setupMarkers() {
|
|
71
|
-
const bounds = new
|
|
81
|
+
const bounds = new LatLngBounds();
|
|
72
82
|
markers.forEach((marker) => marker.setMap(null));
|
|
73
83
|
markers = [];
|
|
74
84
|
|
|
75
85
|
latlons.value.forEach((latlon) => {
|
|
76
|
-
const position = new
|
|
86
|
+
const position = new LatLng(
|
|
77
87
|
Number(latlon.lat),
|
|
78
88
|
Number(latlon.lon)
|
|
79
89
|
);
|
|
80
90
|
bounds.extend(position);
|
|
81
91
|
|
|
82
92
|
markers.push(
|
|
83
|
-
new
|
|
93
|
+
new AdvancedMarkerElement({
|
|
84
94
|
position,
|
|
85
95
|
map: isShowMarker.value ? map : null,
|
|
86
96
|
})
|
|
@@ -93,26 +103,29 @@ export default defineComponent({
|
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
function setupHeatmapData() {
|
|
96
|
-
if (!map || latlons.value.length === 0) return;
|
|
106
|
+
if (!map || latlons.value.length === 0 || !overlay) return;
|
|
97
107
|
|
|
98
108
|
const heatMapData = weights.value
|
|
99
109
|
.filter((weight) => weight.weight > 0)
|
|
100
110
|
.map((weight) => ({
|
|
101
|
-
location:
|
|
111
|
+
location: [
|
|
102
112
|
Number(weight.lat),
|
|
103
113
|
Number(weight.lon)
|
|
104
|
-
|
|
114
|
+
],
|
|
105
115
|
weight: weight.weight,
|
|
106
116
|
}));
|
|
107
117
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
overlay.setOptions({
|
|
119
|
+
layers: [
|
|
120
|
+
new HeatmapLayer({
|
|
121
|
+
id: 'HeatmapLayer',
|
|
122
|
+
data: heatMapData,
|
|
123
|
+
aggregation: 'SUM',
|
|
124
|
+
getPosition: (d: { location: number[], weight: number }) => d.location,
|
|
125
|
+
getWeight: (d: { location: number[], weight: number }) => d.weight,
|
|
126
|
+
}),
|
|
127
|
+
],
|
|
128
|
+
});
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
watch(latlons, () => {
|
|
@@ -128,14 +141,10 @@ export default defineComponent({
|
|
|
128
141
|
});
|
|
129
142
|
|
|
130
143
|
onMounted(() => {
|
|
131
|
-
|
|
144
|
+
initMap();
|
|
132
145
|
});
|
|
133
146
|
|
|
134
147
|
onBeforeUnmount(() => {
|
|
135
|
-
if (heatmap) {
|
|
136
|
-
heatmap.setMap(null);
|
|
137
|
-
heatmap = null;
|
|
138
|
-
}
|
|
139
148
|
});
|
|
140
149
|
|
|
141
150
|
return {
|
package/nuxt.config.ts
CHANGED
|
@@ -11,6 +11,7 @@ export default defineNuxtConfig({
|
|
|
11
11
|
public: {
|
|
12
12
|
defaultMobileEndDateBeforeNow: 4,
|
|
13
13
|
icoUrl: 'https://skylens-mng-dev-1087511617183.asia-east1.run.app',
|
|
14
|
+
googleMapsApiKey: 'AIzaSyDFNjeGBtbW-BdLKMb78cUR4F_OtUl0tlg',
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
components: [
|
|
@@ -22,7 +23,6 @@ export default defineNuxtConfig({
|
|
|
22
23
|
],
|
|
23
24
|
modules: ['@nuxtjs/tailwindcss'],
|
|
24
25
|
plugins: [
|
|
25
|
-
'~ui/plugins/googlemaps.ts',
|
|
26
26
|
'~ui/plugins/v-calendar.ts',
|
|
27
27
|
],
|
|
28
28
|
tailwindcss: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mptw/skylens-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.98",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "nuxi dev .playground",
|
|
@@ -12,16 +12,17 @@
|
|
|
12
12
|
"postinstall": "nuxt prepare .playground"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@nuxt/eslint-config": "^1.
|
|
16
|
-
"eslint": "^9.
|
|
15
|
+
"@nuxt/eslint-config": "^1.12.1",
|
|
16
|
+
"eslint": "^9.39.2",
|
|
17
17
|
"nuxt": "^3.20.0",
|
|
18
18
|
"typescript": "^5.9.3"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@deck.gl/core": "^
|
|
22
|
-
"@deck.gl/
|
|
23
|
-
"@deck.gl/layers": "^
|
|
24
|
-
"@
|
|
21
|
+
"@deck.gl/core": "^9.2.5",
|
|
22
|
+
"@deck.gl/layers": "^9.2.5",
|
|
23
|
+
"@deck.gl/aggregation-layers": "^9.2.5",
|
|
24
|
+
"@deck.gl/google-maps": "^9.2.5",
|
|
25
|
+
"@googlemaps/js-api-loader": "^2.0.2",
|
|
25
26
|
"@gtm-support/vue-gtm": "^3.1.0",
|
|
26
27
|
"@nuxtjs/tailwindcss": "^6.14.0",
|
|
27
28
|
"@popperjs/core": "^2.11.8",
|
|
@@ -30,24 +31,24 @@
|
|
|
30
31
|
"@types/google.maps": "^3.58.1",
|
|
31
32
|
"@types/lodash-es": "^4.17.12",
|
|
32
33
|
"@types/sortablejs": "^1.15.9",
|
|
33
|
-
"@vue/language-plugin-pug": "^3.
|
|
34
|
+
"@vue/language-plugin-pug": "^3.2.2",
|
|
34
35
|
"commonmark": "^0.31.2",
|
|
35
36
|
"date-fns": "^4.1.0",
|
|
36
|
-
"dompurify": "^3.3.
|
|
37
|
+
"dompurify": "^3.3.1",
|
|
37
38
|
"echarts": "^5.6.0",
|
|
38
39
|
"echarts-wordcloud": "^2.1.0",
|
|
39
40
|
"exceljs": "^4.4.0",
|
|
40
|
-
"gsap": "^3.
|
|
41
|
+
"gsap": "^3.14.2",
|
|
41
42
|
"html-to-image": "^1.11.13",
|
|
42
|
-
"lodash-es": "^4.17.
|
|
43
|
+
"lodash-es": "^4.17.22",
|
|
43
44
|
"pug": "^3.0.3",
|
|
44
45
|
"rxjs": "^7.8.2",
|
|
45
46
|
"sortablejs": "^1.15.6",
|
|
46
47
|
"stylus": "^0.64.0",
|
|
47
|
-
"swiper": "^
|
|
48
|
+
"swiper": "^12.0.3",
|
|
48
49
|
"tailwindcss-textshadow": "^2.1.3",
|
|
49
50
|
"v-calendar": "^3.1.2",
|
|
50
|
-
"vue": "^3.5.
|
|
51
|
+
"vue": "^3.5.26",
|
|
51
52
|
"vue-3-slider-component": "^1.0.2",
|
|
52
53
|
"vue-echarts": "^7.0.3"
|
|
53
54
|
}
|
package/plugins/googlemaps.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Loader } from "@googlemaps/js-api-loader";
|
|
2
|
-
|
|
3
|
-
declare module '#app' {
|
|
4
|
-
interface NuxtApp {
|
|
5
|
-
$googlemapsLoader: Loader;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default defineNuxtPlugin((nuxtApp) => {
|
|
10
|
-
const loader = new Loader({
|
|
11
|
-
apiKey: MAP_API_KEY,
|
|
12
|
-
version: "weekly",
|
|
13
|
-
libraries: ["core", "maps", "marker", "visualization"],
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
nuxtApp.provide('googlemapsLoader', loader);
|
|
17
|
-
});
|