tg-map-vue3 4.1.4 → 4.1.6
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/CHANGELOG.md +7 -0
- package/README.md +9 -6
- package/dist/src/components/TgMap.vue.d.ts +161 -153
- package/dist/src/components/controls/TgZoomControl.vue.d.ts +6 -0
- package/dist/src/components/overlays/TgInfoBox.vue.d.ts +2 -0
- package/dist/tg-map.cjs +1 -1
- package/dist/tg-map.cjs.map +1 -1
- package/dist/tg-map.js +196 -177
- package/dist/tg-map.js.map +1 -1
- package/package.json +6 -4
package/dist/tg-map.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { noop as S, typed as
|
|
2
|
-
import { Strings as F, TgMapType as D, unwrapStringEnumValue as d, loadCachedMap as te, TgMapFactory as se, BuildInMapTypeId as z, GestureHandlingOptions as W, bindEvents as v, MapType as re, Objects as
|
|
1
|
+
import { noop as S, typed as L, lateinit as l, path as Y, throwError as w, Arrays as Q, deepEqual as ee } from "tg-commons";
|
|
2
|
+
import { Strings as F, TgMapType as D, unwrapStringEnumValue as d, loadCachedMap as te, TgMapFactory as se, BuildInMapTypeId as z, GestureHandlingOptions as W, bindEvents as v, MapType as re, Objects as oe, InfoWindowModeValues as ie, LatLng as y, dimen as ae, ControlPosition as c, CustomControl as ne, MapTypeControlType as le, TrafficLayer as he, MapPane as x, ElementOverlay as de, BaiduMarker as G, setTgMapConfig as pe } from "tg-map-core";
|
|
3
3
|
export * from "tg-map-core";
|
|
4
|
-
import { createCommentVNode as
|
|
4
|
+
import { createCommentVNode as Z, computed as q, defineComponent as n, markRaw as ce, watch as k, createElementBlock as $, openBlock as C, mergeProps as I, createElementVNode as me, renderSlot as f, normalizeClass as A, normalizeStyle as ue, getCurrentInstance as fe, inject as ye, onBeforeUnmount as ve, onMounted as ge, toRaw as B, withDirectives as be, vShow as $e } from "vue";
|
|
5
5
|
import "tg-map-core/dist/tg-map-core.css";
|
|
6
6
|
function u(e, t) {
|
|
7
7
|
return {
|
|
@@ -31,22 +31,22 @@ function s(e, t) {
|
|
|
31
31
|
}
|
|
32
32
|
function Qe(e) {
|
|
33
33
|
const t = {};
|
|
34
|
-
return Object.entries(e).forEach(([r,
|
|
35
|
-
const
|
|
34
|
+
return Object.entries(e).forEach(([r, o]) => {
|
|
35
|
+
const i = `__${r}`;
|
|
36
36
|
t[r] = {
|
|
37
37
|
get() {
|
|
38
|
-
const a = this[
|
|
39
|
-
return a === void 0 ?
|
|
38
|
+
const a = this[i];
|
|
39
|
+
return a === void 0 ? o : a;
|
|
40
40
|
},
|
|
41
41
|
set(a) {
|
|
42
|
-
this[
|
|
42
|
+
this[i] = a;
|
|
43
43
|
}
|
|
44
44
|
// Vue3已经不支持该属性
|
|
45
45
|
// cache: false
|
|
46
46
|
};
|
|
47
47
|
}), t;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const T = {
|
|
50
50
|
enumerable: !0,
|
|
51
51
|
configurable: !0,
|
|
52
52
|
get: S,
|
|
@@ -55,21 +55,21 @@ const k = {
|
|
|
55
55
|
function _e(e) {
|
|
56
56
|
return Object.keys(e).forEach((t) => {
|
|
57
57
|
const r = e[t];
|
|
58
|
-
let
|
|
59
|
-
typeof r == "function" ? (
|
|
58
|
+
let o = !1;
|
|
59
|
+
typeof r == "function" ? (T.get = r, T.set = S, o = !0) : typeof r == "object" && typeof r.get == "function" && (T.get = r.get, T.set = r.set, o = !0), o && (e[t] = Object.defineProperty(e, t, T));
|
|
60
60
|
}), e;
|
|
61
61
|
}
|
|
62
62
|
function et(e) {
|
|
63
63
|
return _e(e);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
65
|
+
function E() {
|
|
66
|
+
return Z();
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function M(e, t) {
|
|
69
69
|
const r = e.$options[t];
|
|
70
70
|
if (r)
|
|
71
|
-
for (const
|
|
72
|
-
|
|
71
|
+
for (const o of r)
|
|
72
|
+
o.call(e);
|
|
73
73
|
}
|
|
74
74
|
function tt(e, t) {
|
|
75
75
|
for (const r of e)
|
|
@@ -79,23 +79,23 @@ function tt(e, t) {
|
|
|
79
79
|
function st(e, t) {
|
|
80
80
|
if (!e.default) return;
|
|
81
81
|
const r = e.default();
|
|
82
|
-
for (const
|
|
83
|
-
if ((
|
|
84
|
-
return
|
|
82
|
+
for (const o of r)
|
|
83
|
+
if ((o == null ? void 0 : o.type).name === t.name)
|
|
84
|
+
return o;
|
|
85
85
|
}
|
|
86
86
|
function ke(e, t) {
|
|
87
|
-
const r = {},
|
|
87
|
+
const r = {}, o = {}, i = {};
|
|
88
88
|
return Object.keys(e).forEach((a) => {
|
|
89
|
-
a.startsWith("on") ? r[F.pascal2kebab(a.substring(2))] = e[a] :
|
|
89
|
+
a.startsWith("on") ? r[F.pascal2kebab(a.substring(2))] = e[a] : o[a] = e[a];
|
|
90
90
|
}), t && Object.keys(t).forEach((a) => {
|
|
91
|
-
a.startsWith("on") && (
|
|
91
|
+
a.startsWith("on") && (i[F.pascal2kebab(a.substring(2))] = t[a]);
|
|
92
92
|
}), {
|
|
93
93
|
/** class/style/未声明的属性 等 */
|
|
94
|
-
binds:
|
|
94
|
+
binds: o,
|
|
95
95
|
/** 未声明的事件 */
|
|
96
96
|
listeners: r,
|
|
97
97
|
/** 声明在`props`中的事件 */
|
|
98
|
-
listenerProps:
|
|
98
|
+
listenerProps: i
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function g(e, t) {
|
|
@@ -106,45 +106,45 @@ function h() {
|
|
|
106
106
|
}
|
|
107
107
|
const rt = () => {
|
|
108
108
|
let e, t;
|
|
109
|
-
function r(
|
|
110
|
-
console.log(
|
|
109
|
+
function r(i) {
|
|
110
|
+
console.log(i), e = i && i.type, t = Date.now();
|
|
111
111
|
}
|
|
112
|
-
function i
|
|
113
|
-
((
|
|
112
|
+
function o(i) {
|
|
113
|
+
((i && i.type) !== e || Date.now() - (t ?? 0) > 1e3) && r(i);
|
|
114
114
|
}
|
|
115
|
-
return { eventLog: r, eventLogLess:
|
|
115
|
+
return { eventLog: r, eventLogLess: o };
|
|
116
116
|
};
|
|
117
|
-
function
|
|
117
|
+
function R(e, t) {
|
|
118
118
|
return (e == null ? void 0 : e.$options.name) === t.name;
|
|
119
119
|
}
|
|
120
120
|
function X(e, t) {
|
|
121
|
-
return
|
|
121
|
+
return R(e, t) ? e : void 0;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
let
|
|
125
|
-
for (;
|
|
126
|
-
if (
|
|
127
|
-
return
|
|
128
|
-
if (r &&
|
|
123
|
+
function U(e, t, r) {
|
|
124
|
+
let o = t;
|
|
125
|
+
for (; o; ) {
|
|
126
|
+
if (R(o, e))
|
|
127
|
+
return o;
|
|
128
|
+
if (r && R(o, r))
|
|
129
129
|
return;
|
|
130
|
-
|
|
130
|
+
o = o.$parent;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
134
134
|
inject: [j],
|
|
135
135
|
mounted() {
|
|
136
|
-
|
|
136
|
+
M(this, O);
|
|
137
137
|
},
|
|
138
138
|
beforeUnmount() {
|
|
139
|
-
|
|
139
|
+
M(this, P);
|
|
140
140
|
},
|
|
141
141
|
methods: {
|
|
142
142
|
recreate() {
|
|
143
|
-
|
|
143
|
+
M(this, P), M(this, O);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
render() {
|
|
147
|
-
return
|
|
147
|
+
return E();
|
|
148
148
|
}
|
|
149
149
|
}), Te = {
|
|
150
150
|
/** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
|
|
@@ -157,7 +157,7 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
157
157
|
* - :last-center.sync="center": 获取tg-map销毁时的最后的center的值, 使用这种方式可以做到type切换时保留中心点位置
|
|
158
158
|
* @see AbstractMapEventMap.center-changed
|
|
159
159
|
*/
|
|
160
|
-
center: m(
|
|
160
|
+
center: m(y),
|
|
161
161
|
/**
|
|
162
162
|
* 同步center的延时
|
|
163
163
|
* @default 300
|
|
@@ -169,20 +169,21 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
169
169
|
* @see center
|
|
170
170
|
* @deprecated 用的太少, 故maptalks未实现该属性, 要实时获取中心点, 请将{@link centerSyncDelay}设为0
|
|
171
171
|
*/
|
|
172
|
-
currentCenter: s(
|
|
172
|
+
currentCenter: s(y),
|
|
173
173
|
/**
|
|
174
174
|
* 仅用于获取tg-map销毁时的最后的center的值
|
|
175
175
|
* @see center
|
|
176
176
|
* @deprecated 用的太少, 故maptalks未实现该属性
|
|
177
177
|
*/
|
|
178
|
-
lastCenter: s(
|
|
178
|
+
lastCenter: s(y),
|
|
179
179
|
zoom: m(Number),
|
|
180
180
|
/**
|
|
181
181
|
* 该属性不会响应式更新, 要让它立即生效, 请参考{@link file://./../views/map/InfoDemo.vue#L3}
|
|
182
182
|
* @see MapOptions.infoWindowMode
|
|
183
183
|
*/
|
|
184
|
-
infoWindowMode: Ce(
|
|
184
|
+
infoWindowMode: Ce(ie),
|
|
185
185
|
gestureHandling: u(W),
|
|
186
|
+
fractionalZoom: s(Boolean),
|
|
186
187
|
minZoom: s(Number),
|
|
187
188
|
maxZoom: s(Number),
|
|
188
189
|
mapStyle: s(Object),
|
|
@@ -217,13 +218,13 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
217
218
|
},
|
|
218
219
|
data() {
|
|
219
220
|
return {
|
|
220
|
-
map:
|
|
221
|
+
map: L(),
|
|
221
222
|
isDestroyed: !1
|
|
222
223
|
};
|
|
223
224
|
},
|
|
224
225
|
computed: {
|
|
225
226
|
propsJson() {
|
|
226
|
-
return
|
|
227
|
+
return oe.toJsonSafely(this.$props);
|
|
227
228
|
}
|
|
228
229
|
},
|
|
229
230
|
watch: {
|
|
@@ -250,14 +251,22 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
250
251
|
mapType(e) {
|
|
251
252
|
var t;
|
|
252
253
|
(t = this.map) == null || t.setMapType(e ?? re.NORMAL);
|
|
254
|
+
},
|
|
255
|
+
hideLogo(e) {
|
|
256
|
+
var t;
|
|
257
|
+
(t = this.map) == null || t.setHideLogo(e ?? !1);
|
|
258
|
+
},
|
|
259
|
+
fractionalZoom(e) {
|
|
260
|
+
var t;
|
|
261
|
+
(t = this.map) == null || t.setFractionalZoom(e ?? !1);
|
|
253
262
|
}
|
|
254
263
|
},
|
|
255
264
|
async mounted() {
|
|
256
265
|
const e = d(this.type, D);
|
|
257
266
|
try {
|
|
258
267
|
await te(e);
|
|
259
|
-
} catch (
|
|
260
|
-
this.$emit("error",
|
|
268
|
+
} catch (i) {
|
|
269
|
+
this.$emit("error", i);
|
|
261
270
|
return;
|
|
262
271
|
}
|
|
263
272
|
if (this.isDestroyed) {
|
|
@@ -276,7 +285,9 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
276
285
|
minZoom: this.minZoom,
|
|
277
286
|
maxZoom: this.maxZoom,
|
|
278
287
|
mapStyle: this.mapStyle,
|
|
279
|
-
buildInMapTypeId: d(this.mapTypeId, z)
|
|
288
|
+
buildInMapTypeId: d(this.mapTypeId, z),
|
|
289
|
+
hideLogo: this.hideLogo,
|
|
290
|
+
fractionalZoom: this.fractionalZoom
|
|
280
291
|
}
|
|
281
292
|
);
|
|
282
293
|
if (this.map = ce(t), this.mapType && t.setMapType(this.mapType), "ready" in this.attrs.listeners && console.error("地图载入完成的事件已经从ready改为了load, 请手动修改"), v(
|
|
@@ -284,16 +295,16 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
284
295
|
t,
|
|
285
296
|
/* excludes: */
|
|
286
297
|
["load"]
|
|
287
|
-
), this.$emit("load", t),
|
|
298
|
+
), this.$emit("load", t), k([
|
|
288
299
|
() => this.zoom,
|
|
289
300
|
() => this.center
|
|
290
301
|
//
|
|
291
|
-
], ([
|
|
292
|
-
|
|
302
|
+
], ([i, a], [_, J]) => {
|
|
303
|
+
i !== _ && t.setZoom(i), a !== J && (t.getCenter().equals(a) || t.setCenter(a));
|
|
293
304
|
}), this.attrs.listenerProps["update:center"]) {
|
|
294
|
-
const
|
|
305
|
+
const i = () => this.$emit("update:center", t.getCenter());
|
|
295
306
|
t.addEventListener("center-changed", () => {
|
|
296
|
-
this.centerSyncDelay > 0 ? (clearTimeout(this.centerSyncTimeoutId), this.centerSyncTimeoutId = setTimeout(
|
|
307
|
+
this.centerSyncDelay > 0 ? (clearTimeout(this.centerSyncTimeoutId), this.centerSyncTimeoutId = setTimeout(i, this.centerSyncDelay)) : i();
|
|
297
308
|
});
|
|
298
309
|
}
|
|
299
310
|
this.attrs.listenerProps["update:current-center"] && (this.$emit("update:current-center", this.center), t.addEventListener("center-changed", () => {
|
|
@@ -301,24 +312,24 @@ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
|
|
|
301
312
|
})), this.attrs.listenerProps["update:zoom"] && t.addEventListener("zoom-changed", () => {
|
|
302
313
|
this.$emit("update:zoom", t.getZoom());
|
|
303
314
|
});
|
|
304
|
-
const r = this.attrs.listenerProps["update:map-type"],
|
|
305
|
-
(r ||
|
|
306
|
-
const
|
|
307
|
-
r && this.$emit("update:map-type",
|
|
315
|
+
const r = this.attrs.listenerProps["update:map-type"], o = this.attrs.listenerProps["update:map-type-id"];
|
|
316
|
+
(r || o) && t.addEventListener("map-type-changed", () => {
|
|
317
|
+
const i = t.getMapType();
|
|
318
|
+
r && this.$emit("update:map-type", i), o && this.$emit("update:map-type-id", i.id);
|
|
308
319
|
});
|
|
309
320
|
},
|
|
310
321
|
unmounted() {
|
|
311
322
|
this.isDestroyed = !0, this.map && (this.attrs.listenerProps["update:last-center"] && this.$emit("update:last-center", this.map.getCenter()), this.attrs.listenerProps["update:center"] && (clearTimeout(this.centerSyncTimeoutId), this.$emit("update:center", this.map.getCenter())));
|
|
312
323
|
},
|
|
313
324
|
methods: {}
|
|
314
|
-
}),
|
|
325
|
+
}), b = (e, t) => {
|
|
315
326
|
const r = e.__vccOpts || e;
|
|
316
|
-
for (const [
|
|
317
|
-
r[
|
|
327
|
+
for (const [o, i] of t)
|
|
328
|
+
r[o] = i;
|
|
318
329
|
return r;
|
|
319
330
|
};
|
|
320
|
-
function Pe(e, t, r,
|
|
321
|
-
return C(),
|
|
331
|
+
function Pe(e, t, r, o, i, a) {
|
|
332
|
+
return C(), $("div", I({ class: "tg-map" }, e.attrs.binds), [
|
|
322
333
|
me("div", {
|
|
323
334
|
ref: "map",
|
|
324
335
|
class: A({
|
|
@@ -326,12 +337,12 @@ function Pe(e, t, r, i, o, a) {
|
|
|
326
337
|
[`tg-map__map--hide-logo-${e.type}`]: e.hideLogo
|
|
327
338
|
})
|
|
328
339
|
}, null, 2),
|
|
329
|
-
|
|
330
|
-
e.map ?
|
|
331
|
-
|
|
340
|
+
Z("", !0),
|
|
341
|
+
e.map ? f(e.$slots, "default", { key: 1 }) : Z("", !0),
|
|
342
|
+
f(e.$slots, "overlay")
|
|
332
343
|
], 16);
|
|
333
344
|
}
|
|
334
|
-
const N = /* @__PURE__ */
|
|
345
|
+
const N = /* @__PURE__ */ b(Oe, [["render", Pe]]), Ie = n({
|
|
335
346
|
name: "tg-map-widget",
|
|
336
347
|
props: {
|
|
337
348
|
left: {
|
|
@@ -360,15 +371,15 @@ const N = /* @__PURE__ */ $(Oe, [["render", Pe]]), Ie = n({
|
|
|
360
371
|
dimen: ae
|
|
361
372
|
}
|
|
362
373
|
});
|
|
363
|
-
function
|
|
364
|
-
return C(),
|
|
374
|
+
function we(e, t, r, o, i, a) {
|
|
375
|
+
return C(), $("div", {
|
|
365
376
|
class: A(e.$options.name),
|
|
366
377
|
style: ue({ left: e.dimen(e.left), top: e.dimen(e.topValue), right: e.dimen(e.right), bottom: e.dimen(e.bottom) })
|
|
367
378
|
}, [
|
|
368
|
-
|
|
379
|
+
f(e.$slots, "default")
|
|
369
380
|
], 6);
|
|
370
381
|
}
|
|
371
|
-
const
|
|
382
|
+
const ot = /* @__PURE__ */ b(Ie, [["render", we]]), Me = n({
|
|
372
383
|
name: "tg-custom-control",
|
|
373
384
|
mixins: [p],
|
|
374
385
|
props: {
|
|
@@ -397,14 +408,14 @@ const it = /* @__PURE__ */ $(Ie, [["render", Me]]), we = n({
|
|
|
397
408
|
this.$map.removeCustomControl(this.control);
|
|
398
409
|
}
|
|
399
410
|
});
|
|
400
|
-
function Se(e, t, r,
|
|
401
|
-
return C(),
|
|
411
|
+
function Se(e, t, r, o, i, a) {
|
|
412
|
+
return C(), $("div", {
|
|
402
413
|
class: A(e.$options.name)
|
|
403
414
|
}, [
|
|
404
|
-
|
|
415
|
+
f(e.$slots, "default")
|
|
405
416
|
], 2);
|
|
406
417
|
}
|
|
407
|
-
const
|
|
418
|
+
const it = /* @__PURE__ */ b(Me, [["render", Se]]), at = n({
|
|
408
419
|
name: "tg-map-type-control",
|
|
409
420
|
mixins: [p],
|
|
410
421
|
props: {
|
|
@@ -462,30 +473,30 @@ const ot = /* @__PURE__ */ $(we, [["render", Se]]), at = n({
|
|
|
462
473
|
});
|
|
463
474
|
function K() {
|
|
464
475
|
var r;
|
|
465
|
-
const e = (r =
|
|
476
|
+
const e = (r = fe()) == null ? void 0 : r.type;
|
|
466
477
|
let t = (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.__name);
|
|
467
478
|
if (!t) {
|
|
468
|
-
const
|
|
469
|
-
|
|
479
|
+
const o = e == null ? void 0 : e.__file;
|
|
480
|
+
o && (t = Y.basename(o, ".vue"));
|
|
470
481
|
}
|
|
471
482
|
return t;
|
|
472
483
|
}
|
|
473
|
-
function
|
|
474
|
-
const e =
|
|
484
|
+
function H() {
|
|
485
|
+
const e = ye(j);
|
|
475
486
|
let t, r;
|
|
476
|
-
return e == null &&
|
|
487
|
+
return e == null && w(`<${K() || "unknown"}>必须作为<tg-map>的子代组件`), {
|
|
477
488
|
mapRef: e,
|
|
478
489
|
/** 读取map对象, 只要放在<tg-map>里面的组件(除#overlay插槽外)都能够立即读取到map对象 */
|
|
479
490
|
get map() {
|
|
480
|
-
return e.value ??
|
|
491
|
+
return e.value ?? w("map尚未初始化");
|
|
481
492
|
},
|
|
482
493
|
/** 地图元素创建回调 */
|
|
483
|
-
[O](
|
|
484
|
-
ge(
|
|
494
|
+
[O](o) {
|
|
495
|
+
ge(o), t && w(`${O}只能调用一次`), t = o;
|
|
485
496
|
},
|
|
486
497
|
/** 地图元素销毁回调 */
|
|
487
|
-
[P](
|
|
488
|
-
ve(
|
|
498
|
+
[P](o) {
|
|
499
|
+
ve(o), r && w(`${P}只能调用一次`), r = o;
|
|
489
500
|
},
|
|
490
501
|
/** 重新创建地图元素 */
|
|
491
502
|
recreate() {
|
|
@@ -500,30 +511,33 @@ const lt = n({
|
|
|
500
511
|
},
|
|
501
512
|
setup(e) {
|
|
502
513
|
let t = l();
|
|
503
|
-
const { map: r, onCreate:
|
|
504
|
-
return
|
|
514
|
+
const { map: r, onCreate: o, onDestroy: i } = H();
|
|
515
|
+
return o(() => {
|
|
505
516
|
t = r.createStreetViewControl(d(e)), r.addControl(t);
|
|
506
|
-
}),
|
|
517
|
+
}), i(() => {
|
|
507
518
|
r.removeControl(t);
|
|
508
|
-
}),
|
|
519
|
+
}), k(() => e.position, (a) => {
|
|
509
520
|
t.setPosition(d(a, c));
|
|
510
|
-
}),
|
|
521
|
+
}), E;
|
|
511
522
|
}
|
|
512
523
|
}), ht = n({
|
|
513
524
|
name: "tg-zoom-control",
|
|
514
525
|
props: {
|
|
515
|
-
position: u(c, c.RIGHT_BOTTOM)
|
|
526
|
+
position: u(c, c.RIGHT_BOTTOM),
|
|
527
|
+
showZoomLevel: s(Boolean)
|
|
516
528
|
},
|
|
517
529
|
setup(e) {
|
|
518
530
|
let t = l();
|
|
519
|
-
const { map: r, onCreate:
|
|
520
|
-
return
|
|
531
|
+
const { map: r, onCreate: o, onDestroy: i } = H();
|
|
532
|
+
return o(() => {
|
|
521
533
|
t = r.createZoomControl(d(e)), r.addControl(t);
|
|
522
|
-
}),
|
|
534
|
+
}), i(() => {
|
|
523
535
|
r.removeControl(t);
|
|
524
|
-
}),
|
|
536
|
+
}), k(() => e.position, (a) => {
|
|
525
537
|
t.setPosition(d(a, c));
|
|
526
|
-
}),
|
|
538
|
+
}), k(() => e.showZoomLevel, (a) => {
|
|
539
|
+
t.setShowZoomLevel(a ?? !0);
|
|
540
|
+
}), E;
|
|
527
541
|
}
|
|
528
542
|
}), dt = n({
|
|
529
543
|
name: "tg-heatmap",
|
|
@@ -535,18 +549,18 @@ const lt = n({
|
|
|
535
549
|
data: m(Array)
|
|
536
550
|
},
|
|
537
551
|
setup(e) {
|
|
538
|
-
const { map: t, onCreate: r, onDestroy:
|
|
539
|
-
let
|
|
552
|
+
const { map: t, onCreate: r, onDestroy: o } = H();
|
|
553
|
+
let i = l();
|
|
540
554
|
return r(() => {
|
|
541
|
-
|
|
542
|
-
}),
|
|
543
|
-
|
|
544
|
-
}),
|
|
555
|
+
i = t.createHeatmap(e);
|
|
556
|
+
}), o(() => {
|
|
557
|
+
i.remove();
|
|
558
|
+
}), k(() => e.data, (a) => i.setData(a)), k(
|
|
545
559
|
[() => e.maxIntensity, () => e.gradient, () => e.opacity, () => e.radius],
|
|
546
|
-
() =>
|
|
547
|
-
),
|
|
560
|
+
() => i.setOptions(e)
|
|
561
|
+
), E;
|
|
548
562
|
}
|
|
549
|
-
}),
|
|
563
|
+
}), Le = n({
|
|
550
564
|
name: "tg-marker-clusterer",
|
|
551
565
|
mixins: [p],
|
|
552
566
|
// markers从this.$children中读取, 故需要省略(Omit)
|
|
@@ -562,7 +576,7 @@ const lt = n({
|
|
|
562
576
|
setup() {
|
|
563
577
|
return {
|
|
564
578
|
clusterer: l(),
|
|
565
|
-
markers:
|
|
579
|
+
markers: L([])
|
|
566
580
|
};
|
|
567
581
|
},
|
|
568
582
|
watch: {
|
|
@@ -595,7 +609,7 @@ const lt = n({
|
|
|
595
609
|
this.clusterer = this.$map.createMarkerClusterer(this);
|
|
596
610
|
},
|
|
597
611
|
onDestroy() {
|
|
598
|
-
this.clusterer.clearMarkers();
|
|
612
|
+
this.clusterer.clearMarkers(!0);
|
|
599
613
|
},
|
|
600
614
|
methods: {
|
|
601
615
|
/** TgMarker有可能在该组件未初始化之前调用, 需要通过该方法判断 */
|
|
@@ -610,14 +624,14 @@ const lt = n({
|
|
|
610
624
|
}
|
|
611
625
|
}
|
|
612
626
|
});
|
|
613
|
-
function
|
|
614
|
-
return C(),
|
|
627
|
+
function xe(e, t, r, o, i, a) {
|
|
628
|
+
return C(), $("div", {
|
|
615
629
|
class: A(e.$options.name)
|
|
616
630
|
}, [
|
|
617
|
-
|
|
631
|
+
f(e.$slots, "default")
|
|
618
632
|
], 2);
|
|
619
633
|
}
|
|
620
|
-
const Ae = /* @__PURE__ */
|
|
634
|
+
const Ae = /* @__PURE__ */ b(Le, [["render", xe]]), pt = n({
|
|
621
635
|
name: "tg-traffic-layer",
|
|
622
636
|
mixins: [p],
|
|
623
637
|
// 请直接使用v-if来控制它的显隐
|
|
@@ -640,7 +654,7 @@ const Ae = /* @__PURE__ */ $(xe, [["render", Be]]), pt = n({
|
|
|
640
654
|
mixins: [p],
|
|
641
655
|
inheritAttrs: !1,
|
|
642
656
|
props: {
|
|
643
|
-
center: m(
|
|
657
|
+
center: m(y),
|
|
644
658
|
radius: m(Number),
|
|
645
659
|
clickable: s(Boolean),
|
|
646
660
|
editable: s(Boolean),
|
|
@@ -667,7 +681,7 @@ const Ae = /* @__PURE__ */ $(xe, [["render", Be]]), pt = n({
|
|
|
667
681
|
center(e) {
|
|
668
682
|
if (this.emittedCenter != null) {
|
|
669
683
|
const t = this.emittedCenter;
|
|
670
|
-
if (this.emittedCenter = void 0, t ===
|
|
684
|
+
if (this.emittedCenter = void 0, t === B(e))
|
|
671
685
|
return;
|
|
672
686
|
}
|
|
673
687
|
this.overlay.setCenter(e);
|
|
@@ -719,9 +733,9 @@ const Ae = /* @__PURE__ */ $(xe, [["render", Be]]), pt = n({
|
|
|
719
733
|
this.$map.removeOverlay(this.overlay);
|
|
720
734
|
}
|
|
721
735
|
});
|
|
722
|
-
class
|
|
723
|
-
constructor(t, r,
|
|
724
|
-
super(t, r), this.content =
|
|
736
|
+
class Be extends de {
|
|
737
|
+
constructor(t, r, o, i) {
|
|
738
|
+
super(t, r), this.content = o, this.position = i;
|
|
725
739
|
}
|
|
726
740
|
onCreate() {
|
|
727
741
|
return this.content;
|
|
@@ -734,12 +748,12 @@ class Ee extends de {
|
|
|
734
748
|
this.position = t, this.draw();
|
|
735
749
|
}
|
|
736
750
|
}
|
|
737
|
-
const
|
|
751
|
+
const Ee = n({
|
|
738
752
|
name: "tg-element-overlay",
|
|
739
753
|
mixins: [p],
|
|
740
754
|
props: {
|
|
741
|
-
mapPane: u(
|
|
742
|
-
position: m(
|
|
755
|
+
mapPane: u(x, x.overlayMouseTarget),
|
|
756
|
+
position: m(y)
|
|
743
757
|
},
|
|
744
758
|
setup() {
|
|
745
759
|
return {
|
|
@@ -760,21 +774,21 @@ const Le = n({
|
|
|
760
774
|
}
|
|
761
775
|
},
|
|
762
776
|
onCreate() {
|
|
763
|
-
this.overlay = new
|
|
777
|
+
this.overlay = new Be(this.$map, d(this), this.content(), this.position), this.$map.addElementOverlay(this.overlay);
|
|
764
778
|
},
|
|
765
779
|
onDestroy() {
|
|
766
780
|
this.$map.removeElementOverlay(this.overlay);
|
|
767
781
|
}
|
|
768
782
|
});
|
|
769
|
-
function Ne(e, t, r,
|
|
770
|
-
return C(),
|
|
783
|
+
function Ne(e, t, r, o, i, a) {
|
|
784
|
+
return C(), $("div", I({
|
|
771
785
|
class: e.$options.name
|
|
772
786
|
}, e.$attrs), [
|
|
773
|
-
|
|
787
|
+
f(e.$slots, "default")
|
|
774
788
|
], 16);
|
|
775
789
|
}
|
|
776
|
-
const mt = /* @__PURE__ */
|
|
777
|
-
position: m(
|
|
790
|
+
const mt = /* @__PURE__ */ b(Ee, [["render", Ne]]), De = {
|
|
791
|
+
position: m(y),
|
|
778
792
|
title: s(String),
|
|
779
793
|
label: s(Object),
|
|
780
794
|
icon: s(Object),
|
|
@@ -801,8 +815,8 @@ const mt = /* @__PURE__ */ $(Le, [["render", Ne]]), De = {
|
|
|
801
815
|
return {
|
|
802
816
|
attrs: g(t, e),
|
|
803
817
|
marker: l(),
|
|
804
|
-
labelOverlay:
|
|
805
|
-
info:
|
|
818
|
+
labelOverlay: L(),
|
|
819
|
+
info: L(),
|
|
806
820
|
emittedPosition: void 0,
|
|
807
821
|
autoAddToClustererWhenCreate: e.autoAddToClusterer
|
|
808
822
|
};
|
|
@@ -811,7 +825,7 @@ const mt = /* @__PURE__ */ $(Le, [["render", Ne]]), De = {
|
|
|
811
825
|
position(e) {
|
|
812
826
|
if (this.emittedPosition != null) {
|
|
813
827
|
const t = this.emittedPosition;
|
|
814
|
-
if (this.emittedPosition = void 0, t ===
|
|
828
|
+
if (this.emittedPosition = void 0, t === B(e))
|
|
815
829
|
return;
|
|
816
830
|
}
|
|
817
831
|
this.marker.setPosition(e);
|
|
@@ -879,20 +893,21 @@ const mt = /* @__PURE__ */ $(Le, [["render", Ne]]), De = {
|
|
|
879
893
|
}
|
|
880
894
|
}
|
|
881
895
|
});
|
|
882
|
-
function We(e, t, r,
|
|
883
|
-
return
|
|
896
|
+
function We(e, t, r, o, i, a) {
|
|
897
|
+
return f(e.$slots, "default");
|
|
884
898
|
}
|
|
885
|
-
const
|
|
899
|
+
const V = /* @__PURE__ */ b(ze, [["render", We]]), Ze = n({
|
|
886
900
|
name: "tg-info-box",
|
|
887
901
|
mixins: [p],
|
|
888
902
|
inheritAttrs: !1,
|
|
889
903
|
props: {
|
|
890
904
|
show: m(Boolean),
|
|
891
|
-
position: s(
|
|
905
|
+
position: s(y),
|
|
892
906
|
offset: s(Object),
|
|
893
907
|
maxWidth: s(Number),
|
|
894
908
|
borderClass: s(String),
|
|
895
909
|
zIndex: s(Number),
|
|
910
|
+
disableAutoPan: s(Boolean),
|
|
896
911
|
"onUpdate:show": h()
|
|
897
912
|
},
|
|
898
913
|
emits: void 0,
|
|
@@ -920,6 +935,9 @@ const H = /* @__PURE__ */ $(ze, [["render", We]]), Re = n({
|
|
|
920
935
|
},
|
|
921
936
|
zIndex(e) {
|
|
922
937
|
this.overlay.setZIndex(e);
|
|
938
|
+
},
|
|
939
|
+
disableAutoPan() {
|
|
940
|
+
this.recreate();
|
|
923
941
|
}
|
|
924
942
|
},
|
|
925
943
|
onCreate() {
|
|
@@ -938,14 +956,15 @@ const H = /* @__PURE__ */ $(ze, [["render", We]]), Re = n({
|
|
|
938
956
|
offset: this.offset,
|
|
939
957
|
zIndex: this.zIndex,
|
|
940
958
|
maxWidth: this.maxWidth,
|
|
941
|
-
borderClass: this.borderClass
|
|
959
|
+
borderClass: this.borderClass,
|
|
960
|
+
disableAutoPan: this.disableAutoPan
|
|
942
961
|
};
|
|
943
962
|
},
|
|
944
963
|
content() {
|
|
945
964
|
return this.$el;
|
|
946
965
|
},
|
|
947
966
|
$marker() {
|
|
948
|
-
return
|
|
967
|
+
return U(V, this.$parent, N);
|
|
949
968
|
},
|
|
950
969
|
open(e) {
|
|
951
970
|
this.overlay.open(e);
|
|
@@ -955,20 +974,20 @@ const H = /* @__PURE__ */ $(ze, [["render", We]]), Re = n({
|
|
|
955
974
|
}
|
|
956
975
|
}
|
|
957
976
|
});
|
|
958
|
-
function
|
|
959
|
-
return C(),
|
|
977
|
+
function Re(e, t, r, o, i, a) {
|
|
978
|
+
return C(), $("div", I({
|
|
960
979
|
class: e.$options.name
|
|
961
980
|
}, e.attrs.binds), [
|
|
962
|
-
|
|
981
|
+
f(e.$slots, "default")
|
|
963
982
|
], 16);
|
|
964
983
|
}
|
|
965
|
-
const ut = /* @__PURE__ */
|
|
984
|
+
const ut = /* @__PURE__ */ b(Ze, [["render", Re]]), Ue = n({
|
|
966
985
|
name: "tg-info-window",
|
|
967
986
|
mixins: [p],
|
|
968
987
|
inheritAttrs: !1,
|
|
969
988
|
props: {
|
|
970
989
|
show: m(Boolean),
|
|
971
|
-
position: s(
|
|
990
|
+
position: s(y),
|
|
972
991
|
maxWidth: s(Number),
|
|
973
992
|
offset: s(Object),
|
|
974
993
|
disableAutoPan: s(Boolean),
|
|
@@ -1003,7 +1022,7 @@ const ut = /* @__PURE__ */ $(Re, [["render", Ue]]), Ze = n({
|
|
|
1003
1022
|
return this.$el;
|
|
1004
1023
|
},
|
|
1005
1024
|
$marker() {
|
|
1006
|
-
return
|
|
1025
|
+
return U(V, this.$parent, N);
|
|
1007
1026
|
},
|
|
1008
1027
|
getOptions() {
|
|
1009
1028
|
return {
|
|
@@ -1026,24 +1045,24 @@ const ut = /* @__PURE__ */ $(Re, [["render", Ue]]), Ze = n({
|
|
|
1026
1045
|
this.$marker() ? this.$marker().onRemoveInfo(this) : this.overlay.close();
|
|
1027
1046
|
}
|
|
1028
1047
|
});
|
|
1029
|
-
function je(e, t, r,
|
|
1030
|
-
return
|
|
1048
|
+
function je(e, t, r, o, i, a) {
|
|
1049
|
+
return be((C(), $("div", I({
|
|
1031
1050
|
class: e.$options.name
|
|
1032
1051
|
}, e.attrs.binds), [
|
|
1033
|
-
|
|
1052
|
+
f(e.$slots, "default")
|
|
1034
1053
|
], 16)), [
|
|
1035
|
-
[
|
|
1054
|
+
[$e, e.show]
|
|
1036
1055
|
]);
|
|
1037
1056
|
}
|
|
1038
|
-
const
|
|
1057
|
+
const ft = /* @__PURE__ */ b(Ue, [["render", je]]), He = n({
|
|
1039
1058
|
name: "tg-label",
|
|
1040
1059
|
mixins: [p],
|
|
1041
1060
|
inheritAttrs: !1,
|
|
1042
1061
|
props: {
|
|
1043
|
-
position: s(
|
|
1062
|
+
position: s(y),
|
|
1044
1063
|
offset: s(Object),
|
|
1045
1064
|
zIndex: s(Number),
|
|
1046
|
-
mapPane: u(
|
|
1065
|
+
mapPane: u(x)
|
|
1047
1066
|
},
|
|
1048
1067
|
emits: void 0,
|
|
1049
1068
|
setup(e, { attrs: t }) {
|
|
@@ -1078,7 +1097,7 @@ const yt = /* @__PURE__ */ $(Ze, [["render", je]]), Ve = n({
|
|
|
1078
1097
|
return (e = this.$marker()) == null ? void 0 : e.marker;
|
|
1079
1098
|
},
|
|
1080
1099
|
$marker() {
|
|
1081
|
-
return
|
|
1100
|
+
return U(V, this.$parent, N);
|
|
1082
1101
|
},
|
|
1083
1102
|
getOptions() {
|
|
1084
1103
|
return {
|
|
@@ -1086,7 +1105,7 @@ const yt = /* @__PURE__ */ $(Ze, [["render", je]]), Ve = n({
|
|
|
1086
1105
|
position: this.position,
|
|
1087
1106
|
offset: this.offset,
|
|
1088
1107
|
zIndex: this.zIndex,
|
|
1089
|
-
mapPane: d(this.mapPane,
|
|
1108
|
+
mapPane: d(this.mapPane, x)
|
|
1090
1109
|
};
|
|
1091
1110
|
}
|
|
1092
1111
|
},
|
|
@@ -1097,14 +1116,14 @@ const yt = /* @__PURE__ */ $(Ze, [["render", je]]), Ve = n({
|
|
|
1097
1116
|
this.$marker() ? this.$marker().onRemoveLabel(this) : this.$map.removeOverlay(this.overlay);
|
|
1098
1117
|
}
|
|
1099
1118
|
});
|
|
1100
|
-
function
|
|
1101
|
-
return C(),
|
|
1119
|
+
function Ve(e, t, r, o, i, a) {
|
|
1120
|
+
return C(), $("div", I({
|
|
1102
1121
|
class: e.$options.name
|
|
1103
1122
|
}, e.attrs.binds), [
|
|
1104
|
-
|
|
1123
|
+
f(e.$slots, "default")
|
|
1105
1124
|
], 16);
|
|
1106
1125
|
}
|
|
1107
|
-
const
|
|
1126
|
+
const yt = /* @__PURE__ */ b(He, [["render", Ve]]), Fe = {
|
|
1108
1127
|
paths: m(Array),
|
|
1109
1128
|
clickable: s(Boolean),
|
|
1110
1129
|
editable: s(Boolean),
|
|
@@ -1134,7 +1153,7 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1134
1153
|
handler(e) {
|
|
1135
1154
|
if (this.emittedPaths != null) {
|
|
1136
1155
|
const t = this.emittedPaths;
|
|
1137
|
-
if (this.emittedPaths = void 0, t.length === e.length && t.every((r,
|
|
1156
|
+
if (this.emittedPaths = void 0, t.length === e.length && t.every((r, o) => r === B(e[o])))
|
|
1138
1157
|
return;
|
|
1139
1158
|
}
|
|
1140
1159
|
this.overlay.setPaths(e);
|
|
@@ -1206,7 +1225,7 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1206
1225
|
handler(e) {
|
|
1207
1226
|
if (this.emittedPath != null) {
|
|
1208
1227
|
const t = this.emittedPath;
|
|
1209
|
-
if (this.emittedPath = void 0, t ===
|
|
1228
|
+
if (this.emittedPath = void 0, t === B(e))
|
|
1210
1229
|
return;
|
|
1211
1230
|
}
|
|
1212
1231
|
this.overlay.setPath(e);
|
|
@@ -1249,7 +1268,7 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1249
1268
|
onDestroy() {
|
|
1250
1269
|
this.overlay.remove();
|
|
1251
1270
|
}
|
|
1252
|
-
}),
|
|
1271
|
+
}), bt = n({
|
|
1253
1272
|
name: "tg-rectangle",
|
|
1254
1273
|
mixins: [p],
|
|
1255
1274
|
inheritAttrs: !1,
|
|
@@ -1319,13 +1338,13 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1319
1338
|
onDestroy() {
|
|
1320
1339
|
this.$map.removeOverlay(this.overlay);
|
|
1321
1340
|
}
|
|
1322
|
-
}), Ge = ["beforeUpdate", "updated"],
|
|
1341
|
+
}), Ge = ["beforeUpdate", "updated"], $t = {
|
|
1323
1342
|
install(e, t = {}) {
|
|
1324
1343
|
if (t.enable !== !1) {
|
|
1325
1344
|
const r = n({
|
|
1326
1345
|
beforeCreate() {
|
|
1327
|
-
const
|
|
1328
|
-
t.hookNames ? t.hookNames.includes(_) && console.debug("[lifecycle]",
|
|
1346
|
+
const o = K() ?? "", a = (t.nameRegex || /^[A-Z]/).test(o) ? (_) => {
|
|
1347
|
+
t.hookNames ? t.hookNames.includes(_) && console.debug("[lifecycle]", o, _) : Ge.includes(_) || console.debug("[lifecycle]", o, _);
|
|
1329
1348
|
} : S;
|
|
1330
1349
|
a("beforeCreate"), this.__life_impl = a;
|
|
1331
1350
|
},
|
|
@@ -1351,8 +1370,8 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1351
1370
|
this.__life("unmounted");
|
|
1352
1371
|
},
|
|
1353
1372
|
methods: {
|
|
1354
|
-
__life(
|
|
1355
|
-
this.__life_impl(
|
|
1373
|
+
__life(o) {
|
|
1374
|
+
this.__life_impl(o);
|
|
1356
1375
|
}
|
|
1357
1376
|
},
|
|
1358
1377
|
onCreate() {
|
|
@@ -1369,45 +1388,45 @@ const ft = /* @__PURE__ */ $(Ve, [["render", He]]), Fe = {
|
|
|
1369
1388
|
install(e, t) {
|
|
1370
1389
|
pe(t);
|
|
1371
1390
|
const r = e.config.optionMergeStrategies;
|
|
1372
|
-
r[O] = r[P] = (
|
|
1391
|
+
r[O] = r[P] = (o, i) => o ? [...new Set([].concat(o, i))] : Array.isArray(i) ? i : [i];
|
|
1373
1392
|
}
|
|
1374
1393
|
};
|
|
1375
1394
|
export {
|
|
1376
|
-
|
|
1395
|
+
$t as LifecycleLogPlugin,
|
|
1377
1396
|
O as MIXIN_HOOK_CREATE,
|
|
1378
1397
|
P as MIXIN_HOOK_DESTROY,
|
|
1379
1398
|
j as MIXIN_MAP_NAME,
|
|
1380
1399
|
p as MapMixin,
|
|
1381
1400
|
ct as TgCircle,
|
|
1382
|
-
|
|
1401
|
+
it as TgCustomControl,
|
|
1383
1402
|
mt as TgElementOverlay,
|
|
1384
1403
|
dt as TgHeatmap,
|
|
1385
1404
|
ut as TgInfoBox,
|
|
1386
|
-
|
|
1387
|
-
|
|
1405
|
+
ft as TgInfoWindow,
|
|
1406
|
+
yt as TgLabel,
|
|
1388
1407
|
N as TgMap,
|
|
1389
1408
|
at as TgMapTypeControl,
|
|
1390
|
-
|
|
1391
|
-
|
|
1409
|
+
ot as TgMapWidget,
|
|
1410
|
+
V as TgMarker,
|
|
1392
1411
|
Ae as TgMarkerClusterer,
|
|
1393
1412
|
vt as TgPolygon,
|
|
1394
1413
|
gt as TgPolyline,
|
|
1395
|
-
|
|
1414
|
+
bt as TgRectangle,
|
|
1396
1415
|
nt as TgScaleControl,
|
|
1397
1416
|
lt as TgStreetViewControl,
|
|
1398
1417
|
pt as TgTrafficLayer,
|
|
1399
1418
|
ht as TgZoomControl,
|
|
1400
|
-
|
|
1419
|
+
M as callHook,
|
|
1401
1420
|
Qe as computedSaveOnThis,
|
|
1402
|
-
|
|
1421
|
+
E as createEmptyVNode,
|
|
1403
1422
|
_e as createPropertyObject,
|
|
1404
1423
|
et as createPropertyObjectTyped,
|
|
1405
1424
|
Ct as default,
|
|
1406
1425
|
h as eventProp,
|
|
1407
1426
|
st as extractVNodeFromSlotsByComponent,
|
|
1408
|
-
|
|
1427
|
+
U as findAncestorComponentByType,
|
|
1409
1428
|
tt as findByComponentType,
|
|
1410
|
-
|
|
1429
|
+
R as isComponentByType,
|
|
1411
1430
|
s as optionalProp,
|
|
1412
1431
|
m as requiredProp,
|
|
1413
1432
|
X as safeAsComponent,
|
|
@@ -1416,6 +1435,6 @@ export {
|
|
|
1416
1435
|
Ce as stringUnionPropFromValues,
|
|
1417
1436
|
rt as useEventLogMethods,
|
|
1418
1437
|
g as useSplittedAttrs,
|
|
1419
|
-
|
|
1438
|
+
H as useTgMapInner
|
|
1420
1439
|
};
|
|
1421
1440
|
//# sourceMappingURL=tg-map.js.map
|