@mptw/skylens-ui 1.4.101 → 1.4.103
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/nuxt.config.ts +0 -2
- package/package.json +1 -7
- package/pages/index.vue +1 -27
- package/components/SLHeatMap.vue +0 -143
- package/plugins/googlemap.ts +0 -29
package/nuxt.config.ts
CHANGED
|
@@ -11,7 +11,6 @@ export default defineNuxtConfig({
|
|
|
11
11
|
public: {
|
|
12
12
|
defaultMobileEndDateBeforeNow: 4,
|
|
13
13
|
icoUrl: 'https://skylens-mng-dev-1087511617183.asia-east1.run.app',
|
|
14
|
-
googleMapsApiKey: 'AIzaSyDMNNizDMizdxJd3oAhsbkx1kL5Gyicnns',
|
|
15
14
|
},
|
|
16
15
|
},
|
|
17
16
|
components: [
|
|
@@ -23,7 +22,6 @@ export default defineNuxtConfig({
|
|
|
23
22
|
],
|
|
24
23
|
modules: ['@nuxtjs/tailwindcss'],
|
|
25
24
|
plugins: [
|
|
26
|
-
'~ui/plugins/googlemap.ts',
|
|
27
25
|
'~ui/plugins/v-calendar.ts',
|
|
28
26
|
],
|
|
29
27
|
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.103",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "nuxi dev .playground",
|
|
@@ -18,17 +18,11 @@
|
|
|
18
18
|
"typescript": "^5.9.3"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
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",
|
|
26
21
|
"@gtm-support/vue-gtm": "^3.1.0",
|
|
27
22
|
"@nuxtjs/tailwindcss": "^6.14.0",
|
|
28
23
|
"@popperjs/core": "^2.11.8",
|
|
29
24
|
"@types/commonmark": "^0.27.10",
|
|
30
25
|
"@types/dompurify": "^3.2.0",
|
|
31
|
-
"@types/google.maps": "^3.58.1",
|
|
32
26
|
"@types/lodash-es": "^4.17.12",
|
|
33
27
|
"@types/sortablejs": "^1.15.9",
|
|
34
28
|
"@vue/language-plugin-pug": "^3.2.2",
|
package/pages/index.vue
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.main
|
|
3
|
-
a(href='javascript:;', @click='onClickedToggle') toggle
|
|
4
|
-
.container
|
|
5
|
-
SLHeatMap(:latlons="latlons", :weights="latlons", :is-show-marker="isShowMarker")
|
|
6
3
|
</template>
|
|
7
4
|
|
|
8
5
|
<script lang="ts">
|
|
9
6
|
export default defineComponent({
|
|
10
7
|
name: 'IndexPage',
|
|
11
8
|
setup() {
|
|
12
|
-
|
|
13
|
-
const latlons = computed(() => {
|
|
14
|
-
return [
|
|
15
|
-
{ weight: 4, lon: -122.42177834, lat: 37.78346622 },
|
|
16
|
-
{ weight: 2, lon: -122.414411, lat: 37.774458 },
|
|
17
|
-
{ weight: 2, lon: -122.438887, lat: 37.772737 },
|
|
18
|
-
{ weight: 2, lon: -122.42019976, lat: 37.75087429 },
|
|
19
|
-
{ weight: 2, lon: -122.392606, lat: 37.779369 },
|
|
20
|
-
{ weight: 2, lon: -122.43065953, lat: 37.77185018 },
|
|
21
|
-
{ weight: 2, lon: -122.43065953, lat: 37.77185018 },
|
|
22
|
-
{ weight: 4, lon: -122.418974, lat: 37.754029 },
|
|
23
|
-
{ weight: 14, lon: -122.419014, lat: 37.780519 },
|
|
24
|
-
{ weight: 2, lon: -122.404719, lat: 37.770128 },
|
|
25
|
-
{ weight: 2, lon: -122.390466, lat: 37.780226 },
|
|
26
|
-
];
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
function onClickedToggle() {
|
|
30
|
-
isShowMarker.value = !isShowMarker.value;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return { latlons, isShowMarker, onClickedToggle };
|
|
9
|
+
return {};
|
|
34
10
|
},
|
|
35
11
|
});
|
|
36
12
|
</script>
|
|
37
13
|
|
|
38
14
|
<style lang="stylus" scoped>
|
|
39
|
-
.container
|
|
40
|
-
@apply s('w-[600px]') s('h-[480px]')
|
|
41
15
|
</style>
|
package/components/SLHeatMap.vue
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
.heat-map(ref="mapEl")
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import type { PropType } from "vue";
|
|
7
|
-
import { GoogleMapsOverlay } from '@deck.gl/google-maps';
|
|
8
|
-
import { HeatmapLayer } from '@deck.gl/aggregation-layers';
|
|
9
|
-
|
|
10
|
-
const RADIUS = 30;
|
|
11
|
-
|
|
12
|
-
export default defineComponent({
|
|
13
|
-
name: "SLHeatMap",
|
|
14
|
-
components: {},
|
|
15
|
-
props: {
|
|
16
|
-
latlons: {
|
|
17
|
-
type: Array as PropType<{ lat: string; lon: string }[]>,
|
|
18
|
-
default: () => [],
|
|
19
|
-
},
|
|
20
|
-
weights: {
|
|
21
|
-
type: Array as PropType<{ lat: string; lon: string; weight: number }[]>,
|
|
22
|
-
default: () => [],
|
|
23
|
-
},
|
|
24
|
-
isShowMarker: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
setup(props) {
|
|
30
|
-
const { $LatLngBounds, $LatLng, $AdvancedMarkerElement, $Map } = useNuxtApp();
|
|
31
|
-
const { latlons, weights, isShowMarker } = toRefs(props);
|
|
32
|
-
|
|
33
|
-
const mapEl = shallowRef<HTMLElement | null>(null);
|
|
34
|
-
|
|
35
|
-
let map: any | null = null;
|
|
36
|
-
let overlay: any | null = null;
|
|
37
|
-
let markers: any[] = [];
|
|
38
|
-
|
|
39
|
-
async function initMap() {
|
|
40
|
-
if (!mapEl.value) return;
|
|
41
|
-
|
|
42
|
-
if (!map) {
|
|
43
|
-
map = new $Map(mapEl.value, {
|
|
44
|
-
zoom: 11,
|
|
45
|
-
mapId: '160f8be79f87792deee048cf',
|
|
46
|
-
center: { lat: 37.77325660358167, lng: -122.41712341793448 },
|
|
47
|
-
disableDefaultUI: true,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
overlay = new GoogleMapsOverlay({});
|
|
52
|
-
overlay.setMap(map);
|
|
53
|
-
|
|
54
|
-
setupMarkers();
|
|
55
|
-
setupHeatmapData();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function setupMarkers() {
|
|
59
|
-
const bounds = new $LatLngBounds();
|
|
60
|
-
markers.forEach((marker) => marker.setMap(null));
|
|
61
|
-
markers = [];
|
|
62
|
-
|
|
63
|
-
latlons.value.forEach((latlon) => {
|
|
64
|
-
const position = new $LatLng(
|
|
65
|
-
Number(latlon.lat),
|
|
66
|
-
Number(latlon.lon)
|
|
67
|
-
);
|
|
68
|
-
bounds.extend(position);
|
|
69
|
-
|
|
70
|
-
markers.push(
|
|
71
|
-
new $AdvancedMarkerElement({
|
|
72
|
-
position,
|
|
73
|
-
map: isShowMarker.value ? map : null,
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (map) {
|
|
79
|
-
map.fitBounds(bounds, 0);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function setupHeatmapData() {
|
|
84
|
-
if (!map || latlons.value.length === 0 || !overlay) return;
|
|
85
|
-
|
|
86
|
-
const heatMapData = weights.value
|
|
87
|
-
.filter((weight) => weight.weight > 0)
|
|
88
|
-
.map((weight) => ({
|
|
89
|
-
location: [
|
|
90
|
-
Number(weight.lon).valueOf(),
|
|
91
|
-
Number(weight.lat).valueOf()
|
|
92
|
-
],
|
|
93
|
-
weight: weight.weight,
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
|
-
overlay.setProps({
|
|
97
|
-
layers: [
|
|
98
|
-
new HeatmapLayer({
|
|
99
|
-
id: 'HeatmapLayer',
|
|
100
|
-
data: heatMapData,
|
|
101
|
-
aggregation: 'SUM',
|
|
102
|
-
getPosition: (d: { location: number[], weight: number }) => d.location,
|
|
103
|
-
getWeight: (d: { location: number[], weight: number }) => d.weight,
|
|
104
|
-
radius: RADIUS,
|
|
105
|
-
}),
|
|
106
|
-
],
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
watch(latlons, () => {
|
|
111
|
-
setupMarkers();
|
|
112
|
-
});
|
|
113
|
-
watch(weights, () => {
|
|
114
|
-
setupHeatmapData();
|
|
115
|
-
});
|
|
116
|
-
watch(isShowMarker, () => {
|
|
117
|
-
markers.forEach((marker) => {
|
|
118
|
-
marker.setMap(isShowMarker.value ? map : null);
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
onMounted(() => {
|
|
123
|
-
initMap();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
onBeforeUnmount(() => {
|
|
127
|
-
if (overlay) {
|
|
128
|
-
overlay.finalize();
|
|
129
|
-
}
|
|
130
|
-
overlay = null;
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
mapEl,
|
|
135
|
-
};
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
</script>
|
|
139
|
-
|
|
140
|
-
<style lang="stylus" scoped>
|
|
141
|
-
.heat-map
|
|
142
|
-
@apply w-full h-full
|
|
143
|
-
</style>
|
package/plugins/googlemap.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
if (!import.meta.client) return;
|
|
15
|
-
|
|
16
|
-
const runtimeConfig = useRuntimeConfig();
|
|
17
|
-
setOptions({
|
|
18
|
-
key: runtimeConfig.public.googleMapsApiKey,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const { LatLngBounds, LatLng } = await importLibrary('core');
|
|
22
|
-
const { Map } = await importLibrary('maps');
|
|
23
|
-
const { AdvancedMarkerElement } = await importLibrary('marker');
|
|
24
|
-
|
|
25
|
-
nuxtApp.provide('LatLngBounds', LatLngBounds);
|
|
26
|
-
nuxtApp.provide('LatLng', LatLng);
|
|
27
|
-
nuxtApp.provide('Map', Map);
|
|
28
|
-
nuxtApp.provide('AdvancedMarkerElement', AdvancedMarkerElement);
|
|
29
|
-
});
|