tg-map-vue3 3.0.5 → 3.0.7
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/dist/src/components/TgMap.vue.d.ts +1 -2
- package/dist/src/map/map/overlay/baidu-info-box.d.ts +2 -2
- package/dist/src/utils/mapped-types.d.ts +1 -1
- package/dist/src/utils/vue-utils.d.ts +1 -0
- package/dist/tg-map.js +69 -68
- package/dist/tg-map.js.map +1 -1
- package/dist/tg-map.umd.cjs +2 -1
- package/dist/tg-map.umd.cjs.map +1 -1
- package/package.json +21 -11
- package/dist/style.css +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
1
|
+
import { type PropType, type Prop } from 'vue';
|
|
2
2
|
import type { AbstractMap } from '../map/map/map';
|
|
3
3
|
import { TgMapType } from '../map/map-factory';
|
|
4
4
|
import { LatLng } from '../map/lat-lng';
|
|
5
5
|
import { type InfoWindowMode, GestureHandlingOptions } from '../map/map/map-options';
|
|
6
|
-
import type { Prop } from 'vue';
|
|
7
6
|
declare const _default: import("vue").DefineComponent<{
|
|
8
7
|
/** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
|
|
9
8
|
type: {
|
|
@@ -3,7 +3,7 @@ import { Point } from '../../types';
|
|
|
3
3
|
import type { BMarker } from './marker';
|
|
4
4
|
import './baidu-info-box.scss';
|
|
5
5
|
export type BaiduInfoBox = InstanceType<ReturnType<typeof createBaiduInfoBoxClass>>;
|
|
6
|
-
export declare function createBaiduInfoBox(content: HTMLElement, position?: BMap.Point, offset?: Point, zIndex?: number, maxWidth?: number, borderClass?:
|
|
6
|
+
export declare function createBaiduInfoBox(content: HTMLElement, position?: BMap.Point, offset?: Point, zIndex?: number, maxWidth?: number, borderClass?: string): {
|
|
7
7
|
container: HTMLElement;
|
|
8
8
|
border: HTMLElement;
|
|
9
9
|
inner: HTMLElement;
|
|
@@ -44,7 +44,7 @@ export declare function createBaiduInfoBox(content: HTMLElement, position?: BMap
|
|
|
44
44
|
* 3. 和MarkerClusterer的配合并不好, 重建聚合时会使InfoWindow消失
|
|
45
45
|
*/
|
|
46
46
|
declare function createBaiduInfoBoxClass(): {
|
|
47
|
-
new (content: HTMLElement, position?: BMap.Point, offset?: Point, zIndex?: number, maxWidth?: number, borderClass?:
|
|
47
|
+
new (content: HTMLElement, position?: BMap.Point, offset?: Point, zIndex?: number, maxWidth?: number, borderClass?: string): {
|
|
48
48
|
container: HTMLElement;
|
|
49
49
|
border: HTMLElement;
|
|
50
50
|
inner: HTMLElement;
|
|
@@ -4,6 +4,7 @@ import type { AbstractConstructor, KeysMatching, StringEnumLike, Thing } from '.
|
|
|
4
4
|
export type VueHookName = ExcludeSubtype<KeysMatching<OmitStartsWith<RemoveIndex<ComponentOptions>, '_'>, {
|
|
5
5
|
(): void;
|
|
6
6
|
} | undefined>, 'serverPrefetch' | 'emits' | 'computed' | 'extends' | 'methods' | 'call' | undefined>;
|
|
7
|
+
export type VueHookFunction = (this: ComponentPublicInstance) => void;
|
|
7
8
|
/**
|
|
8
9
|
* 模仿Vue的计算属性的写法
|
|
9
10
|
* @see ComputedOptions
|
package/dist/tg-map.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.baidu-info-box-container{transform:translateY(-11px);font-size:13px;font-weight:300;width:100vw}.baidu-info-box-container__border{position:absolute;padding:12px;background-color:#fff;box-shadow:0 2px 7px 1px #0000004d;border-radius:8px;transform:translate(-50%,-100%)}.baidu-info-box-container__inner{overflow:auto}.baidu-info-box-container__close{position:absolute;right:-6px;top:-6px;width:14px;height:14px;margin:8px;opacity:.6;cursor:pointer}.baidu-info-box-container__close:hover{opacity:1}.baidu-info-box-container:after{position:absolute;background-color:#fff;content:"";width:15px;height:15px;left:0px;top:0px;box-shadow:-2px 2px 2px #b2b2b266;transform:translate(-50%,-50%) rotate(-45deg)}.tg-map{height:100vh;position:relative}.tg-map__map{width:100%;height:100%}.tg-map-widget{position:absolute}.tg-map>.tg-custom-control{display:none}.element-overlay{position:absolute}.tg-map .tg-element-overlay{display:none}.tg-map__map .tg-element-overlay{display:block}.tg-map .tg-info-box{display:none}.tg-map__map .tg-info-box{display:block}.tg-map .tg-label{display:none}.tg-map__map .tg-label{display:block}')),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
1
2
|
var jt = Object.defineProperty;
|
|
2
3
|
var Wt = (i, e, t) => e in i ? jt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
4
|
var h = (i, e, t) => (Wt(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
@@ -313,7 +314,7 @@ const Ee = "wgs84", S = class {
|
|
|
313
314
|
* @throws 若当前coord和targetCoord相同, 会抛异常, 故请在外部判断
|
|
314
315
|
*/
|
|
315
316
|
// TODO: 2023/03/14 ipcjs 这里设成private, 有些地方会报类型错误...
|
|
316
|
-
/*private*/
|
|
317
|
+
/* private */
|
|
317
318
|
convert(e) {
|
|
318
319
|
switch (this.coord) {
|
|
319
320
|
case "bd09":
|
|
@@ -3655,7 +3656,7 @@ function Ar(i, e) {
|
|
|
3655
3656
|
const t = window, r = zr(i);
|
|
3656
3657
|
if (t[r])
|
|
3657
3658
|
return Promise.resolve();
|
|
3658
|
-
switch (i
|
|
3659
|
+
switch (i !== $.here && !e.key && x(`请先配置${i}地图的key`), i) {
|
|
3659
3660
|
case $.google:
|
|
3660
3661
|
return Mt(`https://maps.googleapis.com/maps/api/js?key=${e.key}&language=${e.language}`);
|
|
3661
3662
|
case $.baidu:
|
|
@@ -3699,8 +3700,13 @@ function ne(i) {
|
|
|
3699
3700
|
});
|
|
3700
3701
|
}
|
|
3701
3702
|
const Rr = C({
|
|
3702
|
-
inheritAttrs: !1,
|
|
3703
3703
|
name: "tg-map",
|
|
3704
|
+
provide() {
|
|
3705
|
+
return {
|
|
3706
|
+
[bt]: Vt(() => this.map)
|
|
3707
|
+
};
|
|
3708
|
+
},
|
|
3709
|
+
inheritAttrs: !1,
|
|
3704
3710
|
props: {
|
|
3705
3711
|
/** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
|
|
3706
3712
|
type: W($, $.google),
|
|
@@ -3741,18 +3747,18 @@ const Rr = C({
|
|
|
3741
3747
|
/** 优先级比mapTypeId高 */
|
|
3742
3748
|
mapType: m(Object)
|
|
3743
3749
|
},
|
|
3744
|
-
data() {
|
|
3745
|
-
return {
|
|
3746
|
-
map: void 0,
|
|
3747
|
-
isDestroyed: !1
|
|
3748
|
-
};
|
|
3749
|
-
},
|
|
3750
3750
|
setup(i, { attrs: e }) {
|
|
3751
3751
|
return {
|
|
3752
3752
|
attrs: V(e),
|
|
3753
3753
|
centerSyncTimeoutId: 0
|
|
3754
3754
|
};
|
|
3755
3755
|
},
|
|
3756
|
+
data() {
|
|
3757
|
+
return {
|
|
3758
|
+
map: void 0,
|
|
3759
|
+
isDestroyed: !1
|
|
3760
|
+
};
|
|
3761
|
+
},
|
|
3756
3762
|
computed: {
|
|
3757
3763
|
propsJson() {
|
|
3758
3764
|
return le.toJsonSafely(this.$props);
|
|
@@ -3793,11 +3799,6 @@ const Rr = C({
|
|
|
3793
3799
|
(e = this.map) == null || e.setMapType(i ?? I.NORMAL);
|
|
3794
3800
|
}
|
|
3795
3801
|
},
|
|
3796
|
-
provide() {
|
|
3797
|
-
return {
|
|
3798
|
-
[bt]: Vt(() => this.map)
|
|
3799
|
-
};
|
|
3800
|
-
},
|
|
3801
3802
|
async created() {
|
|
3802
3803
|
const { type: i } = this;
|
|
3803
3804
|
try {
|
|
@@ -4122,9 +4123,9 @@ const Zt = /* @__PURE__ */ Z(Xr, [["render", Jr]]), Qr = C({
|
|
|
4122
4123
|
this.$map.removeLayer(this.layer);
|
|
4123
4124
|
}
|
|
4124
4125
|
}), ei = C({
|
|
4125
|
-
inheritAttrs: !1,
|
|
4126
4126
|
name: "tg-circle",
|
|
4127
4127
|
mixins: [w],
|
|
4128
|
+
inheritAttrs: !1,
|
|
4128
4129
|
props: {
|
|
4129
4130
|
center: z(y),
|
|
4130
4131
|
radius: z(Number),
|
|
@@ -4318,11 +4319,6 @@ const ii = C({
|
|
|
4318
4319
|
overlay: void 0
|
|
4319
4320
|
};
|
|
4320
4321
|
},
|
|
4321
|
-
methods: {
|
|
4322
|
-
content() {
|
|
4323
|
-
return this.$el;
|
|
4324
|
-
}
|
|
4325
|
-
},
|
|
4326
4322
|
watch: {
|
|
4327
4323
|
position(i) {
|
|
4328
4324
|
this.overlay.setPosition(i);
|
|
@@ -4331,6 +4327,11 @@ const ii = C({
|
|
|
4331
4327
|
this.recreate();
|
|
4332
4328
|
}
|
|
4333
4329
|
},
|
|
4330
|
+
methods: {
|
|
4331
|
+
content() {
|
|
4332
|
+
return this.$el;
|
|
4333
|
+
}
|
|
4334
|
+
},
|
|
4334
4335
|
onCreate() {
|
|
4335
4336
|
this.overlay = new ri(this.$map, this, this.content(), this.position), this.$map.addElementOverlay(this.overlay);
|
|
4336
4337
|
},
|
|
@@ -4346,9 +4347,9 @@ function si(i, e, t, r, s, n) {
|
|
|
4346
4347
|
], 16);
|
|
4347
4348
|
}
|
|
4348
4349
|
const ni = /* @__PURE__ */ Z(ii, [["render", si]]), oi = C({
|
|
4349
|
-
inheritAttrs: !1,
|
|
4350
4350
|
name: "tg-marker",
|
|
4351
4351
|
mixins: [w],
|
|
4352
|
+
inheritAttrs: !1,
|
|
4352
4353
|
props: {
|
|
4353
4354
|
position: z(y),
|
|
4354
4355
|
title: m(String),
|
|
@@ -4432,9 +4433,9 @@ function ai(i, e, t, r, s, n) {
|
|
|
4432
4433
|
], 16);
|
|
4433
4434
|
}
|
|
4434
4435
|
const we = /* @__PURE__ */ Z(oi, [["render", ai]]), li = C({
|
|
4435
|
-
inheritAttrs: !1,
|
|
4436
4436
|
name: "tg-info-box",
|
|
4437
4437
|
mixins: [w],
|
|
4438
|
+
inheritAttrs: !1,
|
|
4438
4439
|
props: {
|
|
4439
4440
|
show: z(Boolean),
|
|
4440
4441
|
position: m(y),
|
|
@@ -4510,9 +4511,9 @@ function hi(i, e, t, r, s, n) {
|
|
|
4510
4511
|
], 16);
|
|
4511
4512
|
}
|
|
4512
4513
|
const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
4513
|
-
inheritAttrs: !1,
|
|
4514
4514
|
name: "tg-info-window",
|
|
4515
4515
|
mixins: [w],
|
|
4516
|
+
inheritAttrs: !1,
|
|
4516
4517
|
props: {
|
|
4517
4518
|
show: z(Boolean),
|
|
4518
4519
|
position: m(y),
|
|
@@ -4526,23 +4527,6 @@ const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
|
4526
4527
|
overlay: void 0
|
|
4527
4528
|
};
|
|
4528
4529
|
},
|
|
4529
|
-
methods: {
|
|
4530
|
-
content() {
|
|
4531
|
-
return this.$el;
|
|
4532
|
-
},
|
|
4533
|
-
$marker() {
|
|
4534
|
-
return de(this.$parent, we);
|
|
4535
|
-
},
|
|
4536
|
-
getOptions() {
|
|
4537
|
-
return {
|
|
4538
|
-
content: this.content(),
|
|
4539
|
-
position: this.position,
|
|
4540
|
-
maxWidth: this.maxWidth,
|
|
4541
|
-
offset: this.offset,
|
|
4542
|
-
disableAutoPan: this.disableAutoPan
|
|
4543
|
-
};
|
|
4544
|
-
}
|
|
4545
|
-
},
|
|
4546
4530
|
watch: {
|
|
4547
4531
|
show(i) {
|
|
4548
4532
|
this.$marker() ? this.$marker().onInfoShowChanged(this, i) : i ? this.overlay.open() : this.overlay.close();
|
|
@@ -4560,6 +4544,23 @@ const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
|
4560
4544
|
this.recreate();
|
|
4561
4545
|
}
|
|
4562
4546
|
},
|
|
4547
|
+
methods: {
|
|
4548
|
+
content() {
|
|
4549
|
+
return this.$el;
|
|
4550
|
+
},
|
|
4551
|
+
$marker() {
|
|
4552
|
+
return de(this.$parent, we);
|
|
4553
|
+
},
|
|
4554
|
+
getOptions() {
|
|
4555
|
+
return {
|
|
4556
|
+
content: this.content(),
|
|
4557
|
+
position: this.position,
|
|
4558
|
+
maxWidth: this.maxWidth,
|
|
4559
|
+
offset: this.offset,
|
|
4560
|
+
disableAutoPan: this.disableAutoPan
|
|
4561
|
+
};
|
|
4562
|
+
}
|
|
4563
|
+
},
|
|
4563
4564
|
onCreate() {
|
|
4564
4565
|
this.overlay = this.$map.createInfoWindow(this.getOptions()), this.$marker() ? this.$marker().onAddInfo(this) : this.show && this.overlay.open(), this.overlay.addEventListener("open", () => {
|
|
4565
4566
|
this.$emit("update:show", !0);
|
|
@@ -4581,9 +4582,9 @@ function pi(i, e, t, r, s, n) {
|
|
|
4581
4582
|
]);
|
|
4582
4583
|
}
|
|
4583
4584
|
const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
4584
|
-
inheritAttrs: !1,
|
|
4585
4585
|
name: "tg-label",
|
|
4586
4586
|
mixins: [w],
|
|
4587
|
+
inheritAttrs: !1,
|
|
4587
4588
|
props: {
|
|
4588
4589
|
position: m(y),
|
|
4589
4590
|
offset: m(Object),
|
|
@@ -4595,6 +4596,20 @@ const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
|
4595
4596
|
overlay: void 0
|
|
4596
4597
|
};
|
|
4597
4598
|
},
|
|
4599
|
+
watch: {
|
|
4600
|
+
position(i) {
|
|
4601
|
+
this.overlay.setPosition(i);
|
|
4602
|
+
},
|
|
4603
|
+
offset(i) {
|
|
4604
|
+
this.overlay.setOffset(i);
|
|
4605
|
+
},
|
|
4606
|
+
zIndex(i) {
|
|
4607
|
+
this.overlay.setZIndex(i);
|
|
4608
|
+
},
|
|
4609
|
+
visible(i) {
|
|
4610
|
+
this.overlay.setVisible(i);
|
|
4611
|
+
}
|
|
4612
|
+
},
|
|
4598
4613
|
methods: {
|
|
4599
4614
|
content() {
|
|
4600
4615
|
return this.$el;
|
|
@@ -4615,20 +4630,6 @@ const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
|
4615
4630
|
};
|
|
4616
4631
|
}
|
|
4617
4632
|
},
|
|
4618
|
-
watch: {
|
|
4619
|
-
position(i) {
|
|
4620
|
-
this.overlay.setPosition(i);
|
|
4621
|
-
},
|
|
4622
|
-
offset(i) {
|
|
4623
|
-
this.overlay.setOffset(i);
|
|
4624
|
-
},
|
|
4625
|
-
zIndex(i) {
|
|
4626
|
-
this.overlay.setZIndex(i);
|
|
4627
|
-
},
|
|
4628
|
-
visible(i) {
|
|
4629
|
-
this.overlay.setVisible(i);
|
|
4630
|
-
}
|
|
4631
|
-
},
|
|
4632
4633
|
onCreate() {
|
|
4633
4634
|
this.overlay = this.$map.createLabel(this.getOptions()), this.$marker() ? this.$marker().onAddLabel(this) : this.$map.addOverlay(this.overlay), F(this.attrs.listeners, this.overlay);
|
|
4634
4635
|
},
|
|
@@ -4644,9 +4645,9 @@ function mi(i, e, t, r, s, n) {
|
|
|
4644
4645
|
], 16);
|
|
4645
4646
|
}
|
|
4646
4647
|
const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
4647
|
-
inheritAttrs: !1,
|
|
4648
4648
|
name: "tg-polygon",
|
|
4649
4649
|
mixins: [w],
|
|
4650
|
+
inheritAttrs: !1,
|
|
4650
4651
|
props: {
|
|
4651
4652
|
paths: z(Array),
|
|
4652
4653
|
clickable: m(Boolean),
|
|
@@ -4703,9 +4704,9 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4703
4704
|
this.$map.removeOverlay(this.polygon);
|
|
4704
4705
|
}
|
|
4705
4706
|
}), vi = C({
|
|
4706
|
-
inheritAttrs: !1,
|
|
4707
4707
|
name: "tg-polyline",
|
|
4708
4708
|
mixins: [w],
|
|
4709
|
+
inheritAttrs: !1,
|
|
4709
4710
|
props: {
|
|
4710
4711
|
path: z(Array),
|
|
4711
4712
|
clickable: m(Boolean),
|
|
@@ -4757,11 +4758,6 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4757
4758
|
install(i, e = {}) {
|
|
4758
4759
|
if (e.enable !== !1) {
|
|
4759
4760
|
const t = C({
|
|
4760
|
-
methods: {
|
|
4761
|
-
__life(r) {
|
|
4762
|
-
this.__life_impl(r);
|
|
4763
|
-
}
|
|
4764
|
-
},
|
|
4765
4761
|
beforeCreate() {
|
|
4766
4762
|
const r = this.$options.name || this.$options._componentTag || "", n = (e.nameRegex || /^[A-Z]/).test(r) ? (a) => {
|
|
4767
4763
|
e.hookNames ? e.hookNames.includes(a) && console.debug("[lifecycle]", r, a) : _i.includes(a) || console.debug("[lifecycle]", r, a);
|
|
@@ -4777,12 +4773,6 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4777
4773
|
mounted() {
|
|
4778
4774
|
this.__life("mounted");
|
|
4779
4775
|
},
|
|
4780
|
-
onCreate() {
|
|
4781
|
-
this.__life("onCreate");
|
|
4782
|
-
},
|
|
4783
|
-
onDestroy() {
|
|
4784
|
-
this.__life("onDestroy");
|
|
4785
|
-
},
|
|
4786
4776
|
beforeUpdate() {
|
|
4787
4777
|
this.__life("beforeUpdate");
|
|
4788
4778
|
},
|
|
@@ -4794,6 +4784,17 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4794
4784
|
},
|
|
4795
4785
|
unmounted() {
|
|
4796
4786
|
this.__life("unmounted");
|
|
4787
|
+
},
|
|
4788
|
+
methods: {
|
|
4789
|
+
__life(r) {
|
|
4790
|
+
this.__life_impl(r);
|
|
4791
|
+
}
|
|
4792
|
+
},
|
|
4793
|
+
onCreate() {
|
|
4794
|
+
this.__life("onCreate");
|
|
4795
|
+
},
|
|
4796
|
+
onDestroy() {
|
|
4797
|
+
this.__life("onDestroy");
|
|
4797
4798
|
}
|
|
4798
4799
|
});
|
|
4799
4800
|
i.mixin(t);
|