@mptw/skylens-ui 1.4.96 → 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.
@@ -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 map: google.maps.Map | null = null;
33
- let heatmap: google.maps.visualization.HeatmapLayer | null = null;
34
- let markers: google.maps.Marker[] = [];
35
-
36
- async function loadGoogleMapsApi() {
37
- if (!$googlemapsLoader) return;
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
- await $googlemapsLoader.importLibrary("core");
40
- await $googlemapsLoader.importLibrary("maps");
41
- await $googlemapsLoader.importLibrary("visualization");
43
+ async function initMap() {
44
+ if (!mapEl.value) return;
42
45
 
43
- setupMap();
44
- }
46
+ setOptions({
47
+ key: runtimeConfig.public.googleMapsApiKey,
48
+ });
45
49
 
46
- function setupMap() {
47
- if (!mapEl.value) return;
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 = new google.maps.Map(mapEl.value, {
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 google.maps.LatLngBounds();
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 google.maps.LatLng(
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 google.maps.Marker({
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: new google.maps.LatLng(
111
+ location: [
102
112
  Number(weight.lat),
103
113
  Number(weight.lon)
104
- ),
114
+ ],
105
115
  weight: weight.weight,
106
116
  }));
107
117
 
108
- if (!heatmap) {
109
- heatmap = new google.maps.visualization.HeatmapLayer({
110
- radius: RADIUS,
111
- });
112
- heatmap.setMap(map);
113
- }
114
-
115
- heatmap.setData(heatMapData);
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
- loadGoogleMapsApi();
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 {
@@ -73,7 +73,6 @@ export default defineComponent({
73
73
  const tabsContentBody = shallowRef<HTMLElement | null>(null);
74
74
  const tabsNavLeftEl = shallowRef<HTMLElement | null>(null);
75
75
  const navComp = shallowRef<SLDistributorType | null>(null);
76
- const activeTabIndex = ref(activeTab.value || 0);
77
76
  const tabTitles = ref<Array<string>>([]);
78
77
  const showDropdown = ref(false);
79
78
  const tabItemsOversizeProxy = ref(false);
@@ -81,6 +80,7 @@ export default defineComponent({
81
80
  let observer: MutationObserver | null = null;
82
81
  let resizeSubscriber: Subscription | null = null;
83
82
 
83
+ const activeTabIndex = computed(() => activeTab.value || 0);
84
84
  const tabsClass = computed(() => {
85
85
  const classes: Array<string> = [`tabs-type-${type.value}`];
86
86
 
@@ -130,7 +130,6 @@ export default defineComponent({
130
130
  }
131
131
 
132
132
  function changeTabTo(newTab: number) {
133
- activeTabIndex.value = newTab;
134
133
  emit("update:activeTab", newTab);
135
134
  }
136
135
 
@@ -138,10 +137,6 @@ export default defineComponent({
138
137
  changeTabTo(i);
139
138
  }
140
139
 
141
- watch(activeTab, () => {
142
- activeTabIndex.value = activeTab.value || 0;
143
- });
144
-
145
140
  onMounted(() => {
146
141
  resizeSubscriber = fromEvent(window, "resize")
147
142
  .pipe(debounce(() => interval(500)))
@@ -477,5 +472,4 @@ export default defineComponent({
477
472
  .tabs
478
473
  & > .tabs-content
479
474
  @apply shadow-md
480
- </style>
481
-
475
+ </style>
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.96",
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.10.0",
16
- "eslint": "^9.38.0",
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": "^8.9.35",
22
- "@deck.gl/google-maps": "^8.9.35",
23
- "@deck.gl/layers": "^8.9.35",
24
- "@googlemaps/js-api-loader": "^1.16.10",
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.1.2",
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.0",
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.13.0",
41
+ "gsap": "^3.14.2",
41
42
  "html-to-image": "^1.11.13",
42
- "lodash-es": "^4.17.21",
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": "^11.2.10",
48
+ "swiper": "^12.0.3",
48
49
  "tailwindcss-textshadow": "^2.1.3",
49
50
  "v-calendar": "^3.1.2",
50
- "vue": "^3.5.22",
51
+ "vue": "^3.5.26",
51
52
  "vue-3-slider-component": "^1.0.2",
52
53
  "vue-echarts": "^7.0.3"
53
54
  }
@@ -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
- });