tg-map-vue3 3.4.1 → 3.4.2

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 ADDED
@@ -0,0 +1,37 @@
1
+ # 更新日志
2
+
3
+ ## 3.4.x
4
+
5
+ - feat: 添加矩形[TgRectangle]
6
+ - feat: 点/圆/矩形/多边形/多段线 在`editable`/`draggable`模式时支持双向绑定
7
+ - ***BREAKING CHANGE***: [TgPolygon].polygon, [TgPolyline].polyline 属性, 统一改成`overlay`
8
+
9
+ ## 3.3.x
10
+
11
+ - fix: 修复同时修改center和zoom可能中心点偏移的问题
12
+ - feat: [Icon]支持缩放
13
+ - ***BREAKING CHANGE***: [TgMap]的高度默认改成`100%`
14
+
15
+ ## 3.2.x
16
+
17
+ - fix: 修复google和baidu的zoom取值不一致的问题
18
+ - feat: 支持[SymbolIcon]
19
+ - feat: 支持[PlacesService], [Autocomplete], [SearchBox]
20
+
21
+ ## 3.1.x
22
+
23
+ - feat: 支持隐藏地图Logo
24
+
25
+ ## 3.0.x
26
+
27
+ - ***BREAKING CHANGE***: 迁移到Vue3
28
+
29
+ [TgMap]: src/components/TgMap.vue
30
+ [TgRectangle]: src/components/overlays/TgRectangle.vue
31
+ [TgPolygon]: src/components/overlays/TgPolygon.vue
32
+ [TgPolyline]: src/components/overlays/TgPolyline.vue
33
+ [Icon]: src/map/map/overlay/icon.ts#L18 "图标"
34
+ [SymbolIcon]: src/map/map/overlay/icon.ts#L55 "Svg图标"
35
+ [PlacesService]: src/map/map/extra/places-service.ts "位置服务"
36
+ [Autocomplete]: src/map/map/extra/autocomplete.ts "自动完成"
37
+ [SearchBox]: src/map/map/extra/search-box.ts "搜索框"
package/dist/tg-map.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var _r = Object.defineProperty;
3
3
  var br = (i, t, e) => t in i ? _r(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
4
4
  var c = (i, t, e) => (br(i, typeof t != "symbol" ? t + "" : t, e), e);
5
- import { createCommentVNode as He, computed as Dt, defineComponent as C, markRaw as Mr, watch as zt, openBlock as W, createElementBlock as j, mergeProps as ce, createElementVNode as Tr, normalizeClass as Se, renderSlot as N, normalizeStyle as Or, getCurrentInstance as Cr, inject as wr, onMounted as Er, onBeforeUnmount as xr, toRaw as Ae, withDirectives as Lr, vShow as Pr } from "vue";
5
+ import { createCommentVNode as He, computed as Dt, defineComponent as C, markRaw as Mr, watch as zt, openBlock as W, createElementBlock as j, mergeProps as ce, createElementVNode as Tr, normalizeClass as Se, renderSlot as N, normalizeStyle as Or, getCurrentInstance as Cr, inject as wr, onMounted as Er, onBeforeUnmount as Lr, toRaw as Ae, withDirectives as xr, vShow as Pr } from "vue";
6
6
  function V(i, t, e) {
7
7
  Object.keys(i).forEach((r) => {
8
8
  r.startsWith("update:") || e != null && e.includes(r) || t.addEventListener(r, i[r]);
@@ -58,12 +58,12 @@ var Gt = { exports: {} };
58
58
  return !1;
59
59
  }
60
60
  function l(g, f) {
61
- var v = g - 65e-4, O = f - 6e-3, L = Math.sqrt(v * v + O * O) - 2e-5 * Math.sin(O * t), w = Math.atan2(O, v) - 3e-6 * Math.cos(v * t), K = L * Math.cos(w), te = L * Math.sin(w);
61
+ var v = g - 65e-4, O = f - 6e-3, x = Math.sqrt(v * v + O * O) - 2e-5 * Math.sin(O * t), w = Math.atan2(O, v) - 3e-6 * Math.cos(v * t), K = x * Math.cos(w), te = x * Math.sin(w);
62
62
  return [K, te];
63
63
  }
64
64
  function d(g, f) {
65
- var v = Math.sqrt(g * g + f * f) + 2e-5 * Math.sin(f * t), O = Math.atan2(f, g) + 3e-6 * Math.cos(g * t), L = v * Math.cos(O) + 65e-4, w = v * Math.sin(O) + 6e-3;
66
- return [L, w];
65
+ var v = Math.sqrt(g * g + f * f) + 2e-5 * Math.sin(f * t), O = Math.atan2(f, g) + 3e-6 * Math.cos(g * t), x = v * Math.cos(O) + 65e-4, w = v * Math.sin(O) + 6e-3;
66
+ return [x, w];
67
67
  }
68
68
  function u(g, f) {
69
69
  return o(g, f) ? b(g, f) : [g, f];
@@ -75,10 +75,10 @@ var Gt = { exports: {} };
75
75
  return [g * 2 - v[0], f * 2 - v[1]];
76
76
  }
77
77
  function b(g, f) {
78
- var v = _(g - 105, f - 35), O = M(g - 105, f - 35), L = f / 180 * e, w = Math.sin(L);
78
+ var v = _(g - 105, f - 35), O = M(g - 105, f - 35), x = f / 180 * e, w = Math.sin(x);
79
79
  w = 1 - s * w * w;
80
80
  var K = Math.sqrt(w);
81
- v = v * 180 / (r * (1 - s) / (w * K) * e), O = O * 180 / (r / K * Math.cos(L) * e);
81
+ v = v * 180 / (r * (1 - s) / (w * K) * e), O = O * 180 / (r / K * Math.cos(x) * e);
82
82
  var te = f + v, ze = g + O;
83
83
  return [ze, te];
84
84
  }
@@ -361,7 +361,7 @@ function Wr(i) {
361
361
  return Object.propertyIsEnumerable.call(i, t);
362
362
  }) : [];
363
363
  }
364
- function xt(i) {
364
+ function Lt(i) {
365
365
  return Object.keys(i).concat(Wr(i));
366
366
  }
367
367
  function Wt(i, t) {
@@ -376,9 +376,9 @@ function Hr(i, t) {
376
376
  }
377
377
  function jr(i, t, e) {
378
378
  var r = {};
379
- return e.isMergeableObject(i) && xt(i).forEach(function(s) {
379
+ return e.isMergeableObject(i) && Lt(i).forEach(function(s) {
380
380
  r[s] = fe(i[s], e);
381
- }), xt(t).forEach(function(s) {
381
+ }), Lt(t).forEach(function(s) {
382
382
  Hr(i, s) || (Wt(i, s) && e.isMergeableObject(t[s]) ? r[s] = Zr(s, e)(i[s], t[s], e) : r[s] = fe(t[s], e));
383
383
  }), r;
384
384
  }
@@ -395,7 +395,7 @@ oe.all = function(t, e) {
395
395
  }, {});
396
396
  };
397
397
  var Vr = oe, Fr = Vr;
398
- const Ht = /* @__PURE__ */ Ke(Fr), xe = ["3.0"], Ur = {
398
+ const Ht = /* @__PURE__ */ Ke(Fr), Le = ["3.0"], Ur = {
399
399
  baidu: {
400
400
  version: "3.0",
401
401
  // 在build时会被静态替换, 导致使用者不能无法设置它
@@ -410,7 +410,7 @@ const Ht = /* @__PURE__ */ Ke(Fr), xe = ["3.0"], Ur = {
410
410
  libraries: ["places"]
411
411
  },
412
412
  here: {
413
- version: xe[0],
413
+ version: Le[0],
414
414
  key: ""
415
415
  }
416
416
  };
@@ -511,7 +511,7 @@ function Yr(i, t, e) {
511
511
  function Kr(i, t, e, r) {
512
512
  return i.addEventListener(t, e, r), () => i.removeEventListener(t, e, r);
513
513
  }
514
- function Lt(i, t, e) {
514
+ function xt(i, t, e) {
515
515
  return i.addEventListener(t, e), () => i.removeEventListener(t, e);
516
516
  }
517
517
  class Ut {
@@ -1058,7 +1058,7 @@ class si extends tr {
1058
1058
  const s = () => {
1059
1059
  this.inner.setLocation(this.map.innerMap);
1060
1060
  };
1061
- this.removeableArray.push(Lt(this.map, "center-changed", s)), this.removeableArray.push(Lt(this.map, "zoom-changed", s));
1061
+ this.removeableArray.push(xt(this.map, "center-changed", s)), this.removeableArray.push(xt(this.map, "zoom-changed", s));
1062
1062
  }
1063
1063
  }
1064
1064
  setBounds(e) {
@@ -2249,7 +2249,7 @@ $.prototype.getBounds = function() {
2249
2249
  $.prototype.getCenter = function() {
2250
2250
  return this._center;
2251
2251
  };
2252
- var Le;
2252
+ var xe;
2253
2253
  ((i) => {
2254
2254
  function t(r) {
2255
2255
  return {
@@ -2274,7 +2274,7 @@ var Le;
2274
2274
  };
2275
2275
  }
2276
2276
  i.toGoogle = e;
2277
- })(Le || (Le = {}));
2277
+ })(xe || (xe = {}));
2278
2278
  class ar {
2279
2279
  constructor(t) {
2280
2280
  c(this, "inner");
@@ -2311,7 +2311,7 @@ class hi extends ar {
2311
2311
  maxZoom: e.maxZoom,
2312
2312
  minClusterSize: e.minClusterSize,
2313
2313
  isAverageCenter: e.averageCenter,
2314
- styles: (s = e.styles) == null ? void 0 : s.map((n) => Le.toBaidu(n)),
2314
+ styles: (s = e.styles) == null ? void 0 : s.map((n) => xe.toBaidu(n)),
2315
2315
  zIndex: e.zIndex
2316
2316
  });
2317
2317
  const r = e.stylesIndexCalculator;
@@ -2333,7 +2333,7 @@ class ci extends ar {
2333
2333
  maxZoom: e.maxZoom,
2334
2334
  minimumClusterSize: e.minClusterSize,
2335
2335
  averageCenter: e.averageCenter,
2336
- styles: (n = e.styles) == null ? void 0 : n.map((a) => Le.toGoogle(a)),
2336
+ styles: (n = e.styles) == null ? void 0 : n.map((a) => xe.toGoogle(a)),
2337
2337
  zIndex: e.zIndex
2338
2338
  }
2339
2339
  );
@@ -4145,7 +4145,7 @@ class wi extends nt {
4145
4145
  c(this, "defaultLayers");
4146
4146
  this.mapOptions = r;
4147
4147
  const s = Vt().here;
4148
- xe.includes(s.version) || E(`不支持${s.version}, HereMap当前只支持如下版本: ${xe}`);
4148
+ Le.includes(s.version) || E(`不支持${s.version}, HereMap当前只支持如下版本: ${Le}`);
4149
4149
  const n = new H.service.Platform({
4150
4150
  app_id: s.key.split(",")[0],
4151
4151
  app_code: s.key.split(",")[1]
@@ -4302,7 +4302,7 @@ var z = /* @__PURE__ */ ((i) => (i.google = "google", i.baidu = "baidu", i.here
4302
4302
  i.createMap = t;
4303
4303
  })(qe || (qe = {}));
4304
4304
  function Ei({ type: i, config: t }) {
4305
- const e = window, r = xi(i);
4305
+ const e = window, r = Li(i);
4306
4306
  if (e[r])
4307
4307
  return Promise.resolve();
4308
4308
  switch (i !== z.here && !t.key && E(`请先配置${i}地图的key`), i) {
@@ -4326,10 +4326,10 @@ function Ei({ type: i, config: t }) {
4326
4326
  je(i);
4327
4327
  }
4328
4328
  }
4329
- function de(i, t = xe[0]) {
4329
+ function de(i, t = Le[0]) {
4330
4330
  return `https://js.api.here.com/v3/${t}/mapsjs-${i}.js`;
4331
4331
  }
4332
- function xi(i) {
4332
+ function Li(i) {
4333
4333
  switch (i) {
4334
4334
  case z.google:
4335
4335
  return "google";
@@ -4339,10 +4339,10 @@ function xi(i) {
4339
4339
  return "H";
4340
4340
  }
4341
4341
  }
4342
- let Li = 0;
4342
+ let xi = 0;
4343
4343
  function Rt(i, t = "callback") {
4344
4344
  return new Promise((e, r) => {
4345
- const s = `__callback${Li++}`;
4345
+ const s = `__callback${xi++}`;
4346
4346
  window[s] = e;
4347
4347
  const n = document.createElement("script");
4348
4348
  n.src = `${i}&${t}=${s}`, n.onerror = r, document.body.appendChild(n);
@@ -4453,7 +4453,7 @@ function Bi(i, t) {
4453
4453
  function F(i, t) {
4454
4454
  return Dt(() => Bi(i, t));
4455
4455
  }
4456
- function x() {
4456
+ function L() {
4457
4457
  return Function;
4458
4458
  }
4459
4459
  const Cs = () => {
@@ -4527,14 +4527,14 @@ const Cs = () => {
4527
4527
  /** 地图类型对象, 优先级比mapTypeId高 */
4528
4528
  mapType: m(Object),
4529
4529
  hideLogo: m(Boolean),
4530
- onLoad: x(),
4531
- "onUpdate:center": x(),
4532
- "onUpdate:current-center": x(),
4533
- "onUpdate:last-center": x(),
4534
- "onUpdate:map-type": x(),
4535
- "onUpdate:map-type-id": x(),
4536
- "onUpdate:zoom": x(),
4537
- onError: x()
4530
+ onLoad: L(),
4531
+ "onUpdate:center": L(),
4532
+ "onUpdate:current-center": L(),
4533
+ "onUpdate:last-center": L(),
4534
+ "onUpdate:map-type": L(),
4535
+ "onUpdate:map-type-id": L(),
4536
+ "onUpdate:zoom": L(),
4537
+ onError: L()
4538
4538
  },
4539
4539
  /** 声明事件的类型信息, 详见: {@link splitAttrs} */
4540
4540
  emits: void 0,
@@ -4746,7 +4746,7 @@ function Ni(i, t, e, r, s, n) {
4746
4746
  N(i.$slots, "default")
4747
4747
  ], 2);
4748
4748
  }
4749
- const Es = /* @__PURE__ */ U(zi, [["render", Ni]]), xs = C({
4749
+ const Es = /* @__PURE__ */ U(zi, [["render", Ni]]), Ls = C({
4750
4750
  name: "tg-map-type-control",
4751
4751
  mixins: [P],
4752
4752
  props: {
@@ -4779,7 +4779,7 @@ const Es = /* @__PURE__ */ U(zi, [["render", Ni]]), xs = C({
4779
4779
  onDestroy() {
4780
4780
  this.$map.removeControl(this.control);
4781
4781
  }
4782
- }), Ls = C({
4782
+ }), xs = C({
4783
4783
  name: "tg-scale-control",
4784
4784
  mixins: [P],
4785
4785
  props: {
@@ -4827,7 +4827,7 @@ function Gi() {
4827
4827
  },
4828
4828
  /** 地图元素销毁回调 */
4829
4829
  [Me](r) {
4830
- xr(r), e && E(`${Me}只能调用一次`), e = r;
4830
+ Lr(r), e && E(`${Me}只能调用一次`), e = r;
4831
4831
  },
4832
4832
  /** 重新创建地图元素 */
4833
4833
  recreate() {
@@ -4955,8 +4955,8 @@ const Hi = /* @__PURE__ */ U(Zi, [["render", Wi]]), ks = C({
4955
4955
  visible: m(Boolean),
4956
4956
  fillColor: m(String),
4957
4957
  fillOpacity: m(Number),
4958
- "onUpdate:center": x(),
4959
- "onUpdate:radius": x()
4958
+ "onUpdate:center": L(),
4959
+ "onUpdate:radius": L()
4960
4960
  },
4961
4961
  emits: void 0,
4962
4962
  setup(i, { attrs: t }) {
@@ -5197,7 +5197,7 @@ const Is = /* @__PURE__ */ U(Fi, [["render", Ui]]), qi = C({
5197
5197
  cursor: m(String),
5198
5198
  zIndex: m(Number),
5199
5199
  visible: m(Boolean),
5200
- "onUpdate:position": x()
5200
+ "onUpdate:position": L()
5201
5201
  },
5202
5202
  emits: void 0,
5203
5203
  setup(i, { attrs: t }) {
@@ -5290,7 +5290,7 @@ const wt = /* @__PURE__ */ U(qi, [["render", Yi]]), Ki = C({
5290
5290
  maxWidth: m(Number),
5291
5291
  borderClass: m(String),
5292
5292
  zIndex: m(Number),
5293
- "onUpdate:show": x()
5293
+ "onUpdate:show": L()
5294
5294
  },
5295
5295
  emits: void 0,
5296
5296
  setup(i, { attrs: t }) {
@@ -5369,7 +5369,7 @@ const Ss = /* @__PURE__ */ U(Ki, [["render", Xi]]), Ji = C({
5369
5369
  maxWidth: m(Number),
5370
5370
  offset: m(Object),
5371
5371
  disableAutoPan: m(Boolean),
5372
- "onUpdate:show": x()
5372
+ "onUpdate:show": L()
5373
5373
  },
5374
5374
  emits: void 0,
5375
5375
  setup(i, { attrs: t }) {
@@ -5424,7 +5424,7 @@ const Ss = /* @__PURE__ */ U(Ki, [["render", Xi]]), Ji = C({
5424
5424
  }
5425
5425
  });
5426
5426
  function Qi(i, t, e, r, s, n) {
5427
- return Lr((W(), j("div", ce({
5427
+ return xr((W(), j("div", ce({
5428
5428
  class: i.$options.name
5429
5429
  }, i.attrs.binds), [
5430
5430
  N(i.$slots, "default")
@@ -5510,7 +5510,7 @@ const Rs = /* @__PURE__ */ U(es, [["render", ts]]), $s = C({
5510
5510
  visible: m(Boolean),
5511
5511
  fillColor: m(String),
5512
5512
  fillOpacity: m(Number),
5513
- "onUpdate:paths": x()
5513
+ "onUpdate:paths": L()
5514
5514
  },
5515
5515
  emits: void 0,
5516
5516
  setup(i, { attrs: t }) {
@@ -5577,7 +5577,7 @@ const Rs = /* @__PURE__ */ U(es, [["render", ts]]), $s = C({
5577
5577
  strokeOpacity: m(Number),
5578
5578
  strokeWeight: m(Number),
5579
5579
  visible: m(Boolean),
5580
- "onUpdate:path": x()
5580
+ "onUpdate:path": L()
5581
5581
  },
5582
5582
  emits: void 0,
5583
5583
  setup(i, { attrs: t }) {
@@ -5640,7 +5640,7 @@ const Rs = /* @__PURE__ */ U(es, [["render", ts]]), $s = C({
5640
5640
  visible: m(Boolean),
5641
5641
  fillColor: m(String),
5642
5642
  fillOpacity: m(Number),
5643
- "onUpdate:bounds": x()
5643
+ "onUpdate:bounds": L()
5644
5644
  },
5645
5645
  emits: void 0,
5646
5646
  setup(i, { attrs: t }) {
@@ -5757,16 +5757,16 @@ function ss(i, t) {
5757
5757
  }
5758
5758
  function ns(i, t, e) {
5759
5759
  const s = 63567523142e-4, n = 1 / 298.257223563, a = ge(t), h = Math.sin(a), o = Math.cos(a), l = (1 - n) * Math.tan(ge(i.lat)), d = 1 / Math.sqrt(1 + l * l), u = l * d, p = Math.atan2(l, o), b = d * h, _ = 1 - b * b, M = _ * (6378137 * 6378137 - s * s) / (s * s), g = 1 + M / 16384 * (4096 + M * (-768 + M * (320 - 175 * M))), f = M / 1024 * (256 + M * (-128 + M * (74 - 47 * M)));
5760
- let v = 0, O = 0, L = 0, w = e / (s * g), K = 2 * Math.PI;
5760
+ let v = 0, O = 0, x = 0, w = e / (s * g), K = 2 * Math.PI;
5761
5761
  for (; Math.abs(w - K) > 1e-12; ) {
5762
- v = Math.cos(2 * p + w), O = Math.sin(w), L = Math.cos(w);
5763
- const vr = f * O * (v + f / 4 * (L * (-1 + 2 * v * v) - f / 6 * v * (-3 + 4 * O * O) * (-3 + 4 * v * v)));
5762
+ v = Math.cos(2 * p + w), O = Math.sin(w), x = Math.cos(w);
5763
+ const vr = f * O * (v + f / 4 * (x * (-1 + 2 * v * v) - f / 6 * v * (-3 + 4 * O * O) * (-3 + 4 * v * v)));
5764
5764
  K = w, w = e / (s * g) + vr;
5765
5765
  }
5766
- const te = u * O - d * L * o, ze = Math.atan2(
5767
- u * L + d * O * o,
5766
+ const te = u * O - d * x * o, ze = Math.atan2(
5767
+ u * x + d * O * o,
5768
5768
  (1 - n) * Math.sqrt(b * b + te * te)
5769
- ), fr = Math.atan2(O * h, d * L - u * O * o), Ne = n / 16 * _ * (4 + n * (4 - 3 * _)), yr = fr - (1 - Ne) * n * b * (w + Ne * O * (v + Ne * L * (-1 + 2 * v * v)));
5769
+ ), fr = Math.atan2(O * h, d * x - u * O * o), Ne = n / 16 * _ * (4 + n * (4 - 3 * _)), yr = fr - (1 - Ne) * n * b * (w + Ne * O * (v + Ne * x * (-1 + 2 * v * v)));
5770
5770
  return { lng: i.lng + $t(yr), lat: $t(ze) };
5771
5771
  }
5772
5772
  const Gs = {
@@ -5855,14 +5855,14 @@ export {
5855
5855
  Ai as TgMap,
5856
5856
  qe as TgMapFactory,
5857
5857
  z as TgMapType,
5858
- xs as TgMapTypeControl,
5858
+ Ls as TgMapTypeControl,
5859
5859
  ws as TgMapWidget,
5860
5860
  wt as TgMarker,
5861
5861
  Hi as TgMarkerClusterer,
5862
5862
  $s as TgPolygon,
5863
5863
  Ds as TgPolyline,
5864
5864
  zs as TgRectangle,
5865
- Ls as TgScaleControl,
5865
+ xs as TgScaleControl,
5866
5866
  ks as TgTrafficLayer,
5867
5867
  Ps as TgZoomControl,
5868
5868
  Pe as UnionIcon,
@@ -5875,7 +5875,7 @@ export {
5875
5875
  Ms as createPropertyObjectTyped,
5876
5876
  cs as debug,
5877
5877
  Zs as default,
5878
- x as eventProp,
5878
+ L as eventProp,
5879
5879
  Os as extractVNodeFromSlotsByComponent,
5880
5880
  Ts as findByComponentType,
5881
5881
  ns as getDestination,