tg-map-vue3 3.0.6 → 3.0.8
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 +73 -72
- package/dist/tg-map.js.map +1 -1
- package/dist/tg-map.umd.cjs +2 -2
- package/dist/tg-map.umd.cjs.map +1 -1
- package/package.json +19 -9
|
@@ -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
|
@@ -314,7 +314,7 @@ const Ee = "wgs84", S = class {
|
|
|
314
314
|
* @throws 若当前coord和targetCoord相同, 会抛异常, 故请在外部判断
|
|
315
315
|
*/
|
|
316
316
|
// TODO: 2023/03/14 ipcjs 这里设成private, 有些地方会报类型错误...
|
|
317
|
-
/*private*/
|
|
317
|
+
/* private */
|
|
318
318
|
convert(e) {
|
|
319
319
|
switch (this.coord) {
|
|
320
320
|
case "bd09":
|
|
@@ -452,7 +452,7 @@ class Ze {
|
|
|
452
452
|
h(this, "latestInfoWindow");
|
|
453
453
|
/** 使用{@link setEventTargetDelegate}初始化 */
|
|
454
454
|
h(this, "delegate", void 0);
|
|
455
|
-
this.element = e,
|
|
455
|
+
this.element = e, process.env.NODE_ENV !== "production" && setTimeout(() => {
|
|
456
456
|
this.delegate || console.warn(`${this.constructor.name}继承了AbstractMap, 但未调用setEventTargetDelegate(delegate)`);
|
|
457
457
|
});
|
|
458
458
|
}
|
|
@@ -2292,7 +2292,7 @@ class Or {
|
|
|
2292
2292
|
const s = this.values[r];
|
|
2293
2293
|
t.set(e.call(s), s);
|
|
2294
2294
|
}
|
|
2295
|
-
this.map.set(e, t),
|
|
2295
|
+
this.map.set(e, t), process.env.NODE_ENV !== "production" && this.map.size > this.maxSize4Debug && console.warn(`this.map的大小(${this.map.size})超过了设置的最大大小(${this.maxSize4Debug}), 这可能是由于你每次都创建新的keySelector造成的, 请保证相同功能的keySelector只创建一个对象`);
|
|
2296
2296
|
}
|
|
2297
2297
|
return t;
|
|
2298
2298
|
}
|
|
@@ -3477,8 +3477,9 @@ class Lr extends Ze {
|
|
|
3477
3477
|
const Te = ["3.0"], Br = {
|
|
3478
3478
|
baidu: {
|
|
3479
3479
|
version: "3.0",
|
|
3480
|
-
//
|
|
3481
|
-
//
|
|
3480
|
+
// 在build时会被静态替换, 导致使用者不能无法设置它
|
|
3481
|
+
// @see https://cn.vitejs.dev/guide/build.html#library-mode:~:text=%E6%A8%A1%E5%BC%8F%E4%B8%8B%EF%BC%8C%E6%89%80%E6%9C%89-,({}).*,-%E7%94%A8%E6%B3%95%E5%9C%A8%E6%9E%84
|
|
3482
|
+
// @see @vite_process_env_detail
|
|
3482
3483
|
key: {}.VITE_APP_DEV_KEY_BAIDU,
|
|
3483
3484
|
language: ""
|
|
3484
3485
|
},
|
|
@@ -3656,7 +3657,7 @@ function Ar(i, e) {
|
|
|
3656
3657
|
const t = window, r = zr(i);
|
|
3657
3658
|
if (t[r])
|
|
3658
3659
|
return Promise.resolve();
|
|
3659
|
-
switch (i
|
|
3660
|
+
switch (i !== $.here && !e.key && x(`请先配置${i}地图的key`), i) {
|
|
3660
3661
|
case $.google:
|
|
3661
3662
|
return Mt(`https://maps.googleapis.com/maps/api/js?key=${e.key}&language=${e.language}`);
|
|
3662
3663
|
case $.baidu:
|
|
@@ -3700,8 +3701,13 @@ function ne(i) {
|
|
|
3700
3701
|
});
|
|
3701
3702
|
}
|
|
3702
3703
|
const Rr = C({
|
|
3703
|
-
inheritAttrs: !1,
|
|
3704
3704
|
name: "tg-map",
|
|
3705
|
+
provide() {
|
|
3706
|
+
return {
|
|
3707
|
+
[bt]: Vt(() => this.map)
|
|
3708
|
+
};
|
|
3709
|
+
},
|
|
3710
|
+
inheritAttrs: !1,
|
|
3705
3711
|
props: {
|
|
3706
3712
|
/** type没做响应式, 但外部可以把type作为tg-map的key, 让type修改时完全重建tg-map */
|
|
3707
3713
|
type: W($, $.google),
|
|
@@ -3742,18 +3748,18 @@ const Rr = C({
|
|
|
3742
3748
|
/** 优先级比mapTypeId高 */
|
|
3743
3749
|
mapType: m(Object)
|
|
3744
3750
|
},
|
|
3745
|
-
data() {
|
|
3746
|
-
return {
|
|
3747
|
-
map: void 0,
|
|
3748
|
-
isDestroyed: !1
|
|
3749
|
-
};
|
|
3750
|
-
},
|
|
3751
3751
|
setup(i, { attrs: e }) {
|
|
3752
3752
|
return {
|
|
3753
3753
|
attrs: V(e),
|
|
3754
3754
|
centerSyncTimeoutId: 0
|
|
3755
3755
|
};
|
|
3756
3756
|
},
|
|
3757
|
+
data() {
|
|
3758
|
+
return {
|
|
3759
|
+
map: void 0,
|
|
3760
|
+
isDestroyed: !1
|
|
3761
|
+
};
|
|
3762
|
+
},
|
|
3757
3763
|
computed: {
|
|
3758
3764
|
propsJson() {
|
|
3759
3765
|
return le.toJsonSafely(this.$props);
|
|
@@ -3794,11 +3800,6 @@ const Rr = C({
|
|
|
3794
3800
|
(e = this.map) == null || e.setMapType(i ?? I.NORMAL);
|
|
3795
3801
|
}
|
|
3796
3802
|
},
|
|
3797
|
-
provide() {
|
|
3798
|
-
return {
|
|
3799
|
-
[bt]: Vt(() => this.map)
|
|
3800
|
-
};
|
|
3801
|
-
},
|
|
3802
3803
|
async created() {
|
|
3803
3804
|
const { type: i } = this;
|
|
3804
3805
|
try {
|
|
@@ -4123,9 +4124,9 @@ const Zt = /* @__PURE__ */ Z(Xr, [["render", Jr]]), Qr = C({
|
|
|
4123
4124
|
this.$map.removeLayer(this.layer);
|
|
4124
4125
|
}
|
|
4125
4126
|
}), ei = C({
|
|
4126
|
-
inheritAttrs: !1,
|
|
4127
4127
|
name: "tg-circle",
|
|
4128
4128
|
mixins: [w],
|
|
4129
|
+
inheritAttrs: !1,
|
|
4129
4130
|
props: {
|
|
4130
4131
|
center: z(y),
|
|
4131
4132
|
radius: z(Number),
|
|
@@ -4319,11 +4320,6 @@ const ii = C({
|
|
|
4319
4320
|
overlay: void 0
|
|
4320
4321
|
};
|
|
4321
4322
|
},
|
|
4322
|
-
methods: {
|
|
4323
|
-
content() {
|
|
4324
|
-
return this.$el;
|
|
4325
|
-
}
|
|
4326
|
-
},
|
|
4327
4323
|
watch: {
|
|
4328
4324
|
position(i) {
|
|
4329
4325
|
this.overlay.setPosition(i);
|
|
@@ -4332,6 +4328,11 @@ const ii = C({
|
|
|
4332
4328
|
this.recreate();
|
|
4333
4329
|
}
|
|
4334
4330
|
},
|
|
4331
|
+
methods: {
|
|
4332
|
+
content() {
|
|
4333
|
+
return this.$el;
|
|
4334
|
+
}
|
|
4335
|
+
},
|
|
4335
4336
|
onCreate() {
|
|
4336
4337
|
this.overlay = new ri(this.$map, this, this.content(), this.position), this.$map.addElementOverlay(this.overlay);
|
|
4337
4338
|
},
|
|
@@ -4347,9 +4348,9 @@ function si(i, e, t, r, s, n) {
|
|
|
4347
4348
|
], 16);
|
|
4348
4349
|
}
|
|
4349
4350
|
const ni = /* @__PURE__ */ Z(ii, [["render", si]]), oi = C({
|
|
4350
|
-
inheritAttrs: !1,
|
|
4351
4351
|
name: "tg-marker",
|
|
4352
4352
|
mixins: [w],
|
|
4353
|
+
inheritAttrs: !1,
|
|
4353
4354
|
props: {
|
|
4354
4355
|
position: z(y),
|
|
4355
4356
|
title: m(String),
|
|
@@ -4433,9 +4434,9 @@ function ai(i, e, t, r, s, n) {
|
|
|
4433
4434
|
], 16);
|
|
4434
4435
|
}
|
|
4435
4436
|
const we = /* @__PURE__ */ Z(oi, [["render", ai]]), li = C({
|
|
4436
|
-
inheritAttrs: !1,
|
|
4437
4437
|
name: "tg-info-box",
|
|
4438
4438
|
mixins: [w],
|
|
4439
|
+
inheritAttrs: !1,
|
|
4439
4440
|
props: {
|
|
4440
4441
|
show: z(Boolean),
|
|
4441
4442
|
position: m(y),
|
|
@@ -4511,9 +4512,9 @@ function hi(i, e, t, r, s, n) {
|
|
|
4511
4512
|
], 16);
|
|
4512
4513
|
}
|
|
4513
4514
|
const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
4514
|
-
inheritAttrs: !1,
|
|
4515
4515
|
name: "tg-info-window",
|
|
4516
4516
|
mixins: [w],
|
|
4517
|
+
inheritAttrs: !1,
|
|
4517
4518
|
props: {
|
|
4518
4519
|
show: z(Boolean),
|
|
4519
4520
|
position: m(y),
|
|
@@ -4527,23 +4528,6 @@ const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
|
4527
4528
|
overlay: void 0
|
|
4528
4529
|
};
|
|
4529
4530
|
},
|
|
4530
|
-
methods: {
|
|
4531
|
-
content() {
|
|
4532
|
-
return this.$el;
|
|
4533
|
-
},
|
|
4534
|
-
$marker() {
|
|
4535
|
-
return de(this.$parent, we);
|
|
4536
|
-
},
|
|
4537
|
-
getOptions() {
|
|
4538
|
-
return {
|
|
4539
|
-
content: this.content(),
|
|
4540
|
-
position: this.position,
|
|
4541
|
-
maxWidth: this.maxWidth,
|
|
4542
|
-
offset: this.offset,
|
|
4543
|
-
disableAutoPan: this.disableAutoPan
|
|
4544
|
-
};
|
|
4545
|
-
}
|
|
4546
|
-
},
|
|
4547
4531
|
watch: {
|
|
4548
4532
|
show(i) {
|
|
4549
4533
|
this.$marker() ? this.$marker().onInfoShowChanged(this, i) : i ? this.overlay.open() : this.overlay.close();
|
|
@@ -4561,6 +4545,23 @@ const ci = /* @__PURE__ */ Z(li, [["render", hi]]), di = C({
|
|
|
4561
4545
|
this.recreate();
|
|
4562
4546
|
}
|
|
4563
4547
|
},
|
|
4548
|
+
methods: {
|
|
4549
|
+
content() {
|
|
4550
|
+
return this.$el;
|
|
4551
|
+
},
|
|
4552
|
+
$marker() {
|
|
4553
|
+
return de(this.$parent, we);
|
|
4554
|
+
},
|
|
4555
|
+
getOptions() {
|
|
4556
|
+
return {
|
|
4557
|
+
content: this.content(),
|
|
4558
|
+
position: this.position,
|
|
4559
|
+
maxWidth: this.maxWidth,
|
|
4560
|
+
offset: this.offset,
|
|
4561
|
+
disableAutoPan: this.disableAutoPan
|
|
4562
|
+
};
|
|
4563
|
+
}
|
|
4564
|
+
},
|
|
4564
4565
|
onCreate() {
|
|
4565
4566
|
this.overlay = this.$map.createInfoWindow(this.getOptions()), this.$marker() ? this.$marker().onAddInfo(this) : this.show && this.overlay.open(), this.overlay.addEventListener("open", () => {
|
|
4566
4567
|
this.$emit("update:show", !0);
|
|
@@ -4582,9 +4583,9 @@ function pi(i, e, t, r, s, n) {
|
|
|
4582
4583
|
]);
|
|
4583
4584
|
}
|
|
4584
4585
|
const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
4585
|
-
inheritAttrs: !1,
|
|
4586
4586
|
name: "tg-label",
|
|
4587
4587
|
mixins: [w],
|
|
4588
|
+
inheritAttrs: !1,
|
|
4588
4589
|
props: {
|
|
4589
4590
|
position: m(y),
|
|
4590
4591
|
offset: m(Object),
|
|
@@ -4596,6 +4597,20 @@ const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
|
4596
4597
|
overlay: void 0
|
|
4597
4598
|
};
|
|
4598
4599
|
},
|
|
4600
|
+
watch: {
|
|
4601
|
+
position(i) {
|
|
4602
|
+
this.overlay.setPosition(i);
|
|
4603
|
+
},
|
|
4604
|
+
offset(i) {
|
|
4605
|
+
this.overlay.setOffset(i);
|
|
4606
|
+
},
|
|
4607
|
+
zIndex(i) {
|
|
4608
|
+
this.overlay.setZIndex(i);
|
|
4609
|
+
},
|
|
4610
|
+
visible(i) {
|
|
4611
|
+
this.overlay.setVisible(i);
|
|
4612
|
+
}
|
|
4613
|
+
},
|
|
4599
4614
|
methods: {
|
|
4600
4615
|
content() {
|
|
4601
4616
|
return this.$el;
|
|
@@ -4616,20 +4631,6 @@ const ui = /* @__PURE__ */ Z(di, [["render", pi]]), gi = C({
|
|
|
4616
4631
|
};
|
|
4617
4632
|
}
|
|
4618
4633
|
},
|
|
4619
|
-
watch: {
|
|
4620
|
-
position(i) {
|
|
4621
|
-
this.overlay.setPosition(i);
|
|
4622
|
-
},
|
|
4623
|
-
offset(i) {
|
|
4624
|
-
this.overlay.setOffset(i);
|
|
4625
|
-
},
|
|
4626
|
-
zIndex(i) {
|
|
4627
|
-
this.overlay.setZIndex(i);
|
|
4628
|
-
},
|
|
4629
|
-
visible(i) {
|
|
4630
|
-
this.overlay.setVisible(i);
|
|
4631
|
-
}
|
|
4632
|
-
},
|
|
4633
4634
|
onCreate() {
|
|
4634
4635
|
this.overlay = this.$map.createLabel(this.getOptions()), this.$marker() ? this.$marker().onAddLabel(this) : this.$map.addOverlay(this.overlay), F(this.attrs.listeners, this.overlay);
|
|
4635
4636
|
},
|
|
@@ -4645,9 +4646,9 @@ function mi(i, e, t, r, s, n) {
|
|
|
4645
4646
|
], 16);
|
|
4646
4647
|
}
|
|
4647
4648
|
const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
4648
|
-
inheritAttrs: !1,
|
|
4649
4649
|
name: "tg-polygon",
|
|
4650
4650
|
mixins: [w],
|
|
4651
|
+
inheritAttrs: !1,
|
|
4651
4652
|
props: {
|
|
4652
4653
|
paths: z(Array),
|
|
4653
4654
|
clickable: m(Boolean),
|
|
@@ -4704,9 +4705,9 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4704
4705
|
this.$map.removeOverlay(this.polygon);
|
|
4705
4706
|
}
|
|
4706
4707
|
}), vi = C({
|
|
4707
|
-
inheritAttrs: !1,
|
|
4708
4708
|
name: "tg-polyline",
|
|
4709
4709
|
mixins: [w],
|
|
4710
|
+
inheritAttrs: !1,
|
|
4710
4711
|
props: {
|
|
4711
4712
|
path: z(Array),
|
|
4712
4713
|
clickable: m(Boolean),
|
|
@@ -4758,11 +4759,6 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4758
4759
|
install(i, e = {}) {
|
|
4759
4760
|
if (e.enable !== !1) {
|
|
4760
4761
|
const t = C({
|
|
4761
|
-
methods: {
|
|
4762
|
-
__life(r) {
|
|
4763
|
-
this.__life_impl(r);
|
|
4764
|
-
}
|
|
4765
|
-
},
|
|
4766
4762
|
beforeCreate() {
|
|
4767
4763
|
const r = this.$options.name || this.$options._componentTag || "", n = (e.nameRegex || /^[A-Z]/).test(r) ? (a) => {
|
|
4768
4764
|
e.hookNames ? e.hookNames.includes(a) && console.debug("[lifecycle]", r, a) : _i.includes(a) || console.debug("[lifecycle]", r, a);
|
|
@@ -4778,12 +4774,6 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4778
4774
|
mounted() {
|
|
4779
4775
|
this.__life("mounted");
|
|
4780
4776
|
},
|
|
4781
|
-
onCreate() {
|
|
4782
|
-
this.__life("onCreate");
|
|
4783
|
-
},
|
|
4784
|
-
onDestroy() {
|
|
4785
|
-
this.__life("onDestroy");
|
|
4786
|
-
},
|
|
4787
4777
|
beforeUpdate() {
|
|
4788
4778
|
this.__life("beforeUpdate");
|
|
4789
4779
|
},
|
|
@@ -4795,6 +4785,17 @@ const fi = /* @__PURE__ */ Z(gi, [["render", mi]]), yi = C({
|
|
|
4795
4785
|
},
|
|
4796
4786
|
unmounted() {
|
|
4797
4787
|
this.__life("unmounted");
|
|
4788
|
+
},
|
|
4789
|
+
methods: {
|
|
4790
|
+
__life(r) {
|
|
4791
|
+
this.__life_impl(r);
|
|
4792
|
+
}
|
|
4793
|
+
},
|
|
4794
|
+
onCreate() {
|
|
4795
|
+
this.__life("onCreate");
|
|
4796
|
+
},
|
|
4797
|
+
onDestroy() {
|
|
4798
|
+
this.__life("onDestroy");
|
|
4798
4799
|
}
|
|
4799
4800
|
});
|
|
4800
4801
|
i.mixin(t);
|