@mptw/skylens-ui 1.4.97 → 1.4.99
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 +32 -37
- package/nuxt.config.ts +2 -1
- package/package.json +14 -13
- package/plugins/googlemap.ts +27 -0
- package/plugins/googlemaps.ts +0 -17
package/components/SLHeatMap.vue
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import type { PropType } from "vue";
|
|
7
|
+
import { GoogleMapsOverlay } from '@deck.gl/google-maps';
|
|
8
|
+
import { HeatmapLayer } from '@deck.gl/aggregation-layers';
|
|
9
|
+
|
|
7
10
|
const RADIUS = 30;
|
|
8
11
|
|
|
9
12
|
export default defineComponent({
|
|
@@ -24,30 +27,20 @@ export default defineComponent({
|
|
|
24
27
|
},
|
|
25
28
|
},
|
|
26
29
|
setup(props) {
|
|
30
|
+
const { LatLngBounds, LatLng, AdvancedMarkerElement, Map } = useNuxtApp();
|
|
27
31
|
const { latlons, weights, isShowMarker } = toRefs(props);
|
|
28
32
|
|
|
29
|
-
const { $googlemapsLoader } = useNuxtApp();
|
|
30
33
|
const mapEl = shallowRef<HTMLElement | null>(null);
|
|
31
34
|
|
|
32
|
-
let map:
|
|
33
|
-
let
|
|
34
|
-
let markers:
|
|
35
|
-
|
|
36
|
-
async function loadGoogleMapsApi() {
|
|
37
|
-
if (!$googlemapsLoader) return;
|
|
38
|
-
|
|
39
|
-
await $googlemapsLoader.importLibrary("core");
|
|
40
|
-
await $googlemapsLoader.importLibrary("maps");
|
|
41
|
-
await $googlemapsLoader.importLibrary("visualization");
|
|
35
|
+
let map: any | null = null;
|
|
36
|
+
let overlay: any | null = null;
|
|
37
|
+
let markers: any[] = [];
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function setupMap() {
|
|
39
|
+
async function initMap() {
|
|
47
40
|
if (!mapEl.value) return;
|
|
48
41
|
|
|
49
42
|
if (!map) {
|
|
50
|
-
map =
|
|
43
|
+
map = Map(mapEl.value, {
|
|
51
44
|
disableDefaultUI: true,
|
|
52
45
|
styles: [
|
|
53
46
|
{
|
|
@@ -63,24 +56,26 @@ export default defineComponent({
|
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
map.setCenter({ lat: 23.586114913594802, lng: 120.87814086119803 });
|
|
59
|
+
overlay = new GoogleMapsOverlay({});
|
|
60
|
+
overlay.setMap(map);
|
|
66
61
|
|
|
67
62
|
setupHeatmapData();
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
function setupMarkers() {
|
|
71
|
-
const bounds = new
|
|
66
|
+
const bounds = new LatLngBounds();
|
|
72
67
|
markers.forEach((marker) => marker.setMap(null));
|
|
73
68
|
markers = [];
|
|
74
69
|
|
|
75
70
|
latlons.value.forEach((latlon) => {
|
|
76
|
-
const position = new
|
|
71
|
+
const position = new LatLng(
|
|
77
72
|
Number(latlon.lat),
|
|
78
73
|
Number(latlon.lon)
|
|
79
74
|
);
|
|
80
75
|
bounds.extend(position);
|
|
81
76
|
|
|
82
77
|
markers.push(
|
|
83
|
-
new
|
|
78
|
+
new AdvancedMarkerElement({
|
|
84
79
|
position,
|
|
85
80
|
map: isShowMarker.value ? map : null,
|
|
86
81
|
})
|
|
@@ -93,26 +88,30 @@ export default defineComponent({
|
|
|
93
88
|
}
|
|
94
89
|
|
|
95
90
|
function setupHeatmapData() {
|
|
96
|
-
if (!map || latlons.value.length === 0) return;
|
|
91
|
+
if (!map || latlons.value.length === 0 || !overlay) return;
|
|
97
92
|
|
|
98
93
|
const heatMapData = weights.value
|
|
99
94
|
.filter((weight) => weight.weight > 0)
|
|
100
95
|
.map((weight) => ({
|
|
101
|
-
location:
|
|
102
|
-
Number(weight.
|
|
103
|
-
Number(weight.
|
|
104
|
-
|
|
96
|
+
location: [
|
|
97
|
+
Number(weight.lon).valueOf(),
|
|
98
|
+
Number(weight.lat).valueOf()
|
|
99
|
+
],
|
|
105
100
|
weight: weight.weight,
|
|
106
101
|
}));
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
overlay.setOptions({
|
|
104
|
+
layers: [
|
|
105
|
+
new HeatmapLayer({
|
|
106
|
+
id: 'HeatmapLayer',
|
|
107
|
+
data: heatMapData,
|
|
108
|
+
aggregation: 'SUM',
|
|
109
|
+
getPosition: (d: { location: number[], weight: number }) => d.location,
|
|
110
|
+
getWeight: (d: { location: number[], weight: number }) => d.weight,
|
|
111
|
+
radius: RADIUS,
|
|
112
|
+
}),
|
|
113
|
+
],
|
|
114
|
+
});
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
watch(latlons, () => {
|
|
@@ -128,14 +127,10 @@ export default defineComponent({
|
|
|
128
127
|
});
|
|
129
128
|
|
|
130
129
|
onMounted(() => {
|
|
131
|
-
|
|
130
|
+
initMap();
|
|
132
131
|
});
|
|
133
132
|
|
|
134
133
|
onBeforeUnmount(() => {
|
|
135
|
-
if (heatmap) {
|
|
136
|
-
heatmap.setMap(null);
|
|
137
|
-
heatmap = null;
|
|
138
|
-
}
|
|
139
134
|
});
|
|
140
135
|
|
|
141
136
|
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,7 @@ export default defineNuxtConfig({
|
|
|
22
23
|
],
|
|
23
24
|
modules: ['@nuxtjs/tailwindcss'],
|
|
24
25
|
plugins: [
|
|
25
|
-
'~ui/plugins/
|
|
26
|
+
'~ui/plugins/googlemap.ts',
|
|
26
27
|
'~ui/plugins/v-calendar.ts',
|
|
27
28
|
],
|
|
28
29
|
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.99",
|
|
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
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { setOptions, importLibrary } from '@googlemaps/js-api-loader';
|
|
2
|
+
|
|
3
|
+
declare module '#app' {
|
|
4
|
+
interface NuxtApp {
|
|
5
|
+
LatLngBounds: google.maps.LatLngBounds;
|
|
6
|
+
LatLng: google.maps.LatLng;
|
|
7
|
+
Map: google.maps.Map;
|
|
8
|
+
AdvancedMarkerElement: google.maps.AdvancedMarkerElement;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
14
|
+
const runtimeConfig = useRuntimeConfig();
|
|
15
|
+
setOptions({
|
|
16
|
+
key: runtimeConfig.public.googleMapsApiKey,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const { LatLngBounds, LatLng } = await importLibrary('core');
|
|
20
|
+
const { Map } = await importLibrary('maps');
|
|
21
|
+
const { AdvancedMarkerElement } = await importLibrary('marker');
|
|
22
|
+
|
|
23
|
+
nuxtApp.provide('LatLngBounds', LatLngBounds);
|
|
24
|
+
nuxtApp.provide('LatLng', LatLng);
|
|
25
|
+
nuxtApp.provide('Map', Map);
|
|
26
|
+
nuxtApp.provide('AdvancedMarkerElement', AdvancedMarkerElement);
|
|
27
|
+
});
|
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
|
-
});
|