tg-map-vue3 4.2.9 → 4.2.11

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/tg-map.js CHANGED
@@ -1,7 +1,7 @@
1
- import { noop as x, typed as O, lateinit as l, path as te, throwError as w, Arrays as V, deepEqual as se } from "tg-commons";
2
- import { Strings as G, TgMapType as D, unwrapStringEnumValue as d, loadCachedMap as ie, TgMapFactory as re, BuildInMapTypeId as z, GestureHandlingOptions as W, bindEvents as v, MapType as oe, Objects as ae, InfoWindowModeValues as ne, LatLng as y, dimen as le, ControlPosition as m, CustomControl as he, MapTypeControlType as de, TrafficLayer as pe, MapPane as A, ElementOverlay as me, BaiduMarker as q, GoogleMap as X, wrapComponentElementForGoogle as K, setTgMapConfig as ce } from "tg-map-core";
1
+ import { noop as L, typed as M, lateinit as l, path as te, throwError as S, Arrays as V, deepEqual as se } from "tg-commons";
2
+ import { Strings as G, TgMapType as D, unwrapStringEnumValue as d, loadCachedMap as ie, TgMapFactory as re, BuildInMapTypeId as z, GestureHandlingOptions as W, bindEvents as v, MapType as oe, Objects as ae, InfoWindowModeValues as ne, LatLng as y, dimen as le, ControlPosition as m, CustomControl as he, MapTypeControlType as de, TrafficLayer as pe, MapPane as x, ElementOverlay as me, BaiduMarker as q, GoogleMap as X, wrapComponentElementForGoogle as K, setTgMapConfig as ce } from "tg-map-core";
3
3
  export * from "tg-map-core";
4
- import { createCommentVNode as Z, computed as J, defineComponent as n, markRaw as ue, watch as k, createElementBlock as b, openBlock as C, mergeProps as M, createElementVNode as fe, renderSlot as f, normalizeClass as L, normalizeStyle as ye, getCurrentInstance as ve, inject as ge, onBeforeUnmount as $e, onMounted as be, toRaw as B, withDirectives as Ce, vShow as _e } from "vue";
4
+ import { createCommentVNode as Z, computed as J, defineComponent as n, markRaw as ue, watch as T, createElementBlock as b, openBlock as C, mergeProps as w, createElementVNode as fe, renderSlot as f, normalizeClass as A, normalizeStyle as ye, getCurrentInstance as ve, inject as ge, onBeforeUnmount as $e, onMounted as be, toRaw as B, withDirectives as Ce, 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 {
@@ -46,17 +46,17 @@ function tt(e) {
46
46
  };
47
47
  }), t;
48
48
  }
49
- const T = {
49
+ const I = {
50
50
  enumerable: !0,
51
51
  configurable: !0,
52
- get: x,
53
- set: x
52
+ get: L,
53
+ set: L
54
54
  };
55
55
  function Te(e) {
56
56
  return Object.keys(e).forEach((t) => {
57
57
  const i = e[t];
58
58
  let r = !1;
59
- typeof i == "function" ? (T.get = i, T.set = x, r = !0) : typeof i == "object" && typeof i.get == "function" && (T.get = i.get, T.set = i.set, r = !0), r && (e[t] = Object.defineProperty(e, t, T));
59
+ typeof i == "function" ? (I.get = i, I.set = L, r = !0) : typeof i == "object" && typeof i.get == "function" && (I.get = i.get, I.set = i.set, r = !0), r && (e[t] = Object.defineProperty(e, t, I));
60
60
  }), e;
61
61
  }
62
62
  function st(e) {
@@ -65,7 +65,7 @@ function st(e) {
65
65
  function E() {
66
66
  return Z();
67
67
  }
68
- function S(e, t) {
68
+ function k(e, t) {
69
69
  const i = e.$options[t];
70
70
  if (i)
71
71
  for (const r of i)
@@ -130,17 +130,17 @@ function U(e, t, i) {
130
130
  r = r.$parent;
131
131
  }
132
132
  }
133
- const j = "$map", P = "onCreate", I = "onDestroy", p = n({
133
+ const j = "$map", O = "onCreate", P = "onDestroy", p = n({
134
134
  inject: [j],
135
135
  mounted() {
136
- S(this, P);
136
+ k(this, O);
137
137
  },
138
138
  beforeUnmount() {
139
- S(this, I);
139
+ k(this, P);
140
140
  },
141
141
  methods: {
142
142
  recreate() {
143
- S(this, I), S(this, P);
143
+ k(this, P), k(this, O);
144
144
  }
145
145
  },
146
146
  render() {
@@ -218,7 +218,7 @@ const j = "$map", P = "onCreate", I = "onDestroy", p = n({
218
218
  },
219
219
  data() {
220
220
  return {
221
- map: O(),
221
+ map: M(),
222
222
  isDestroyed: !1
223
223
  };
224
224
  },
@@ -296,7 +296,7 @@ const j = "$map", P = "onCreate", I = "onDestroy", p = n({
296
296
  this.$emit,
297
297
  /* excludes: */
298
298
  ["load"]
299
- ), this.$emit("load", t), k([
299
+ ), this.$emit("load", t), T([
300
300
  () => this.zoom,
301
301
  () => this.center
302
302
  //
@@ -330,10 +330,10 @@ const j = "$map", P = "onCreate", I = "onDestroy", p = n({
330
330
  return i;
331
331
  };
332
332
  function Me(e, t, i, r, o, a) {
333
- return C(), b("div", M({ class: "tg-map" }, e.attrs.binds), [
333
+ return C(), b("div", w({ class: "tg-map" }, e.attrs.binds), [
334
334
  fe("div", {
335
335
  ref: "map",
336
- class: L({
336
+ class: A({
337
337
  "tg-map__map": !0,
338
338
  [`tg-map__map--hide-logo-${e.type}`]: e.hideLogo
339
339
  })
@@ -374,13 +374,13 @@ const N = /* @__PURE__ */ $(Ie, [["render", Me]]), we = n({
374
374
  });
375
375
  function Se(e, t, i, r, o, a) {
376
376
  return C(), b("div", {
377
- class: L(e.$options.name),
377
+ class: A(e.$options.name),
378
378
  style: ye({ left: e.dimen(e.left), top: e.dimen(e.topValue), right: e.dimen(e.right), bottom: e.dimen(e.bottom) })
379
379
  }, [
380
380
  f(e.$slots, "default")
381
381
  ], 6);
382
382
  }
383
- const at = /* @__PURE__ */ $(we, [["render", Se]]), xe = n({
383
+ const at = /* @__PURE__ */ $(we, [["render", Se]]), Le = n({
384
384
  name: "tg-custom-control",
385
385
  mixins: [p],
386
386
  props: {
@@ -409,14 +409,14 @@ const at = /* @__PURE__ */ $(we, [["render", Se]]), xe = n({
409
409
  this.$map.removeCustomControl(this.control);
410
410
  }
411
411
  });
412
- function Ae(e, t, i, r, o, a) {
412
+ function xe(e, t, i, r, o, a) {
413
413
  return C(), b("div", {
414
- class: L(e.$options.name)
414
+ class: A(e.$options.name)
415
415
  }, [
416
416
  f(e.$slots, "default")
417
417
  ], 2);
418
418
  }
419
- const nt = /* @__PURE__ */ $(xe, [["render", Ae]]), lt = n({
419
+ const nt = /* @__PURE__ */ $(Le, [["render", xe]]), lt = n({
420
420
  name: "tg-map-type-control",
421
421
  mixins: [p],
422
422
  props: {
@@ -485,19 +485,19 @@ function Q() {
485
485
  function F() {
486
486
  const e = ge(j);
487
487
  let t, i;
488
- return e == null && w(`<${Q() || "unknown"}>必须作为<tg-map>的子代组件`), {
488
+ return e == null && S(`<${Q() || "unknown"}>必须作为<tg-map>的子代组件`), {
489
489
  mapRef: e,
490
490
  /** 读取map对象, 只要放在<tg-map>里面的组件(除#overlay插槽外)都能够立即读取到map对象 */
491
491
  get map() {
492
- return e.value ?? w("map尚未初始化");
492
+ return e.value ?? S("map尚未初始化");
493
493
  },
494
494
  /** 地图元素创建回调 */
495
- [P](r) {
496
- be(r), t && w(`${P}只能调用一次`), t = r;
495
+ [O](r) {
496
+ be(r), t && S(`${O}只能调用一次`), t = r;
497
497
  },
498
498
  /** 地图元素销毁回调 */
499
- [I](r) {
500
- $e(r), i && w(`${I}只能调用一次`), i = r;
499
+ [P](r) {
500
+ $e(r), i && S(`${P}只能调用一次`), i = r;
501
501
  },
502
502
  /** 重新创建地图元素 */
503
503
  recreate() {
@@ -517,7 +517,7 @@ const dt = n({
517
517
  t = i.createStreetViewControl(d(e)), i.addControl(t);
518
518
  }), o(() => {
519
519
  i.removeControl(t);
520
- }), k(() => e.position, (a) => {
520
+ }), T(() => e.position, (a) => {
521
521
  t.setPosition(d(a, m));
522
522
  }), E;
523
523
  }
@@ -534,9 +534,9 @@ const dt = n({
534
534
  t = i.createZoomControl(d(e)), i.addControl(t);
535
535
  }), o(() => {
536
536
  i.removeControl(t);
537
- }), k(() => e.position, (a) => {
537
+ }), T(() => e.position, (a) => {
538
538
  t.setPosition(d(a, m));
539
- }), k(() => e.showZoomLevel, (a) => {
539
+ }), T(() => e.showZoomLevel, (a) => {
540
540
  t.setShowZoomLevel(a ?? !0);
541
541
  }), E;
542
542
  }
@@ -556,12 +556,12 @@ const dt = n({
556
556
  o = t.createHeatmap(e);
557
557
  }), r(() => {
558
558
  o.remove();
559
- }), k(() => e.data, (a) => o.setData(a)), k(
559
+ }), T(() => e.data, (a) => o.setData(a)), T(
560
560
  [() => e.maxIntensity, () => e.gradient, () => e.opacity, () => e.radius],
561
561
  () => o.setOptions(e)
562
562
  ), E;
563
563
  }
564
- }), Le = n({
564
+ }), Ae = n({
565
565
  name: "tg-marker-clusterer",
566
566
  mixins: [p],
567
567
  // markers从this.$children中读取, 故需要省略(Omit)
@@ -577,8 +577,8 @@ const dt = n({
577
577
  setup() {
578
578
  return {
579
579
  clusterer: l(),
580
- markers: O([]),
581
- pendingMarkers: O([])
580
+ markers: M([]),
581
+ pendingMarkers: M([])
582
582
  };
583
583
  },
584
584
  watch: {
@@ -631,12 +631,12 @@ const dt = n({
631
631
  });
632
632
  function Be(e, t, i, r, o, a) {
633
633
  return C(), b("div", {
634
- class: L(e.$options.name)
634
+ class: A(e.$options.name)
635
635
  }, [
636
636
  f(e.$slots, "default")
637
637
  ], 2);
638
638
  }
639
- const Ee = /* @__PURE__ */ $(Le, [["render", Be]]), ct = n({
639
+ const Ee = /* @__PURE__ */ $(Ae, [["render", Be]]), ct = n({
640
640
  name: "tg-traffic-layer",
641
641
  mixins: [p],
642
642
  // 请直接使用v-if来控制它的显隐
@@ -757,7 +757,7 @@ const De = n({
757
757
  name: "tg-element-overlay",
758
758
  mixins: [p],
759
759
  props: {
760
- mapPane: u(A, A.overlayMouseTarget),
760
+ mapPane: u(x, x.overlayMouseTarget),
761
761
  position: c(y)
762
762
  },
763
763
  setup() {
@@ -786,7 +786,7 @@ const De = n({
786
786
  }
787
787
  });
788
788
  function ze(e, t, i, r, o, a) {
789
- return C(), b("div", M({
789
+ return C(), b("div", w({
790
790
  class: e.$options.name
791
791
  }, e.$attrs), [
792
792
  f(e.$slots, "default")
@@ -820,8 +820,8 @@ const ft = /* @__PURE__ */ $(De, [["render", ze]]), We = {
820
820
  return {
821
821
  attrs: g(t, e),
822
822
  marker: l(),
823
- labelOverlay: O(),
824
- info: O(),
823
+ labelOverlay: M(),
824
+ info: M(),
825
825
  emittedPosition: void 0,
826
826
  autoAddToClustererWhenCreate: e.autoAddToClusterer
827
827
  };
@@ -842,7 +842,8 @@ const ft = /* @__PURE__ */ $(De, [["render", ze]]), We = {
842
842
  se(e, t) || (e ? this.marker.setLabel(e) : this.recreate());
843
843
  },
844
844
  icon(e) {
845
- e ? this.marker.setIcon(e) : this.recreate();
845
+ var t;
846
+ e ? (t = this.marker) == null || t.setIcon(e) : this.recreate();
846
847
  },
847
848
  clickable(e) {
848
849
  this.marker instanceof q ? this.recreate() : this.marker.setClickable(e);
@@ -878,6 +879,9 @@ const ft = /* @__PURE__ */ $(De, [["render", ze]]), We = {
878
879
  this.$clusterer() && this.autoAddToClustererWhenCreate ? this.$clusterer().onRemoveMarker(this.marker) : this.$map.removeOverlay(this.marker);
879
880
  },
880
881
  methods: {
882
+ recreate() {
883
+ k(this, P), this.labelOverlay && this.marker.attachLabelOverlay(void 0), this.info && this.info.overlay.close(), k(this, O);
884
+ },
881
885
  $clusterer() {
882
886
  return Y(this.$parent, Ee);
883
887
  },
@@ -980,7 +984,7 @@ const H = /* @__PURE__ */ $(Ze, [["render", Re]]), Ue = n({
980
984
  }
981
985
  });
982
986
  function je(e, t, i, r, o, a) {
983
- return C(), b("div", M({
987
+ return C(), b("div", w({
984
988
  class: e.$options.name
985
989
  }, e.attrs.binds), [
986
990
  f(e.$slots, "default")
@@ -1051,7 +1055,7 @@ const yt = /* @__PURE__ */ $(Ue, [["render", je]]), Fe = n({
1051
1055
  }
1052
1056
  });
1053
1057
  function He(e, t, i, r, o, a) {
1054
- return Ce((C(), b("div", M({
1058
+ return Ce((C(), b("div", w({
1055
1059
  class: e.$options.name
1056
1060
  }, e.attrs.binds), [
1057
1061
  f(e.$slots, "default")
@@ -1067,7 +1071,7 @@ const vt = /* @__PURE__ */ $(Fe, [["render", He]]), Ve = n({
1067
1071
  position: s(y),
1068
1072
  offset: s(Object),
1069
1073
  zIndex: s(Number),
1070
- mapPane: u(A)
1074
+ mapPane: u(x)
1071
1075
  },
1072
1076
  emits: void 0,
1073
1077
  setup(e, { attrs: t }) {
@@ -1081,7 +1085,8 @@ const vt = /* @__PURE__ */ $(Fe, [["render", He]]), Ve = n({
1081
1085
  this.overlay.setPosition(e);
1082
1086
  },
1083
1087
  offset(e) {
1084
- this.overlay.setOffset(e);
1088
+ var t;
1089
+ (t = this.overlay) == null || t.setOffset(e);
1085
1090
  },
1086
1091
  zIndex(e) {
1087
1092
  this.overlay.setZIndex(e);
@@ -1110,7 +1115,7 @@ const vt = /* @__PURE__ */ $(Fe, [["render", He]]), Ve = n({
1110
1115
  position: this.position,
1111
1116
  offset: this.offset,
1112
1117
  zIndex: this.zIndex,
1113
- mapPane: d(this.mapPane, A)
1118
+ mapPane: d(this.mapPane, x)
1114
1119
  };
1115
1120
  }
1116
1121
  },
@@ -1122,7 +1127,7 @@ const vt = /* @__PURE__ */ $(Fe, [["render", He]]), Ve = n({
1122
1127
  }
1123
1128
  });
1124
1129
  function Ge(e, t, i, r, o, a) {
1125
- return C(), b("div", M({
1130
+ return C(), b("div", w({
1126
1131
  class: e.$options.name
1127
1132
  }, e.attrs.binds), [
1128
1133
  f(e.$slots, "default")
@@ -1350,7 +1355,7 @@ const gt = /* @__PURE__ */ $(Ve, [["render", Ge]]), qe = {
1350
1355
  beforeCreate() {
1351
1356
  const r = Q() ?? "", a = (t.nameRegex || /^[A-Z]/).test(r) ? (_) => {
1352
1357
  t.hookNames ? t.hookNames.includes(_) && console.debug("[lifecycle]", r, _) : Xe.includes(_) || console.debug("[lifecycle]", r, _);
1353
- } : x;
1358
+ } : L;
1354
1359
  a("beforeCreate"), this.__life_impl = a;
1355
1360
  },
1356
1361
  created() {
@@ -1393,13 +1398,13 @@ const gt = /* @__PURE__ */ $(Ve, [["render", Ge]]), qe = {
1393
1398
  install(e, t) {
1394
1399
  ce(t);
1395
1400
  const i = e.config.optionMergeStrategies;
1396
- i[P] = i[I] = (r, o) => r ? [...new Set([].concat(r, o))] : Array.isArray(o) ? o : [o];
1401
+ i[O] = i[P] = (r, o) => r ? [...new Set([].concat(r, o))] : Array.isArray(o) ? o : [o];
1397
1402
  }
1398
1403
  };
1399
1404
  export {
1400
1405
  _t as LifecycleLogPlugin,
1401
- P as MIXIN_HOOK_CREATE,
1402
- I as MIXIN_HOOK_DESTROY,
1406
+ O as MIXIN_HOOK_CREATE,
1407
+ P as MIXIN_HOOK_DESTROY,
1403
1408
  j as MIXIN_MAP_NAME,
1404
1409
  p as MapMixin,
1405
1410
  ut as TgCircle,
@@ -1421,7 +1426,7 @@ export {
1421
1426
  dt as TgStreetViewControl,
1422
1427
  ct as TgTrafficLayer,
1423
1428
  pt as TgZoomControl,
1424
- S as callHook,
1429
+ k as callHook,
1425
1430
  tt as computedSaveOnThis,
1426
1431
  E as createEmptyVNode,
1427
1432
  Te as createPropertyObject,