tg-map-vue3 3.7.2 → 3.7.4

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 CHANGED
@@ -3,6 +3,7 @@
3
3
  ## 3.7.x
4
4
 
5
5
  - feat: 添加[IconSequence]到[TgPolyline]中
6
+ - ***BREAKING CHANGE***: [MapStyle]简化成纯对象, 方便使用
6
7
 
7
8
  ## 3.6.x
8
9
 
@@ -67,3 +68,4 @@
67
68
  [LatLngBounds]: src/map/lat-lng.ts#L157
68
69
  [LatLng]: src/map/lat-lng.ts#L26
69
70
  [BaiduShape]: src/map/map/overlay/shape.ts#L32
71
+ [MapStyle]: src/map/map/map-options.ts#72
@@ -20,8 +20,10 @@ export * from '../map/map/extra/marker-clusterer';
20
20
  export * from '../map/map/extra/places-service';
21
21
  export * from '../map/map/extra/search-box';
22
22
  export * from '../map/map/map';
23
+ export * from '../map/map/map-options';
23
24
  export * from '../map/map/map-type';
24
25
  export * from '../map/map/overlay/circle';
26
+ export * from '../map/map/overlay/element-overlay';
25
27
  export * from '../map/map/overlay/icon';
26
28
  export * from '../map/map/overlay/info-box';
27
29
  export * from '../map/map/overlay/info-window';
@@ -102,7 +102,7 @@ declare const TgMarker: import("vue").DefineComponent<{
102
102
  }>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
103
103
  [key: string]: any;
104
104
  }>) => void)[] | undefined;
105
- readonly mapPane?: import("../../utils/mapped-types").StringEnumValue<typeof import("../../map/map/overlay/element-overlay").MapPane> | undefined;
105
+ readonly mapPane?: import("../../utils/mapped-types").StringEnumValue<typeof import("..").MapPane> | undefined;
106
106
  };
107
107
  $attrs: {
108
108
  [x: string]: unknown;
@@ -128,7 +128,7 @@ declare const TgMarker: import("vue").DefineComponent<{
128
128
  type: PropType<number>;
129
129
  };
130
130
  mapPane: {
131
- type: PropType<import("../../utils/mapped-types").StringEnumValue<typeof import("../../map/map/overlay/element-overlay").MapPane>>;
131
+ type: PropType<import("../../utils/mapped-types").StringEnumValue<typeof import("..").MapPane>>;
132
132
  };
133
133
  }>> & {
134
134
  onClick?: ((event: import("../../map/event").Tg.Event) => any) | undefined;
@@ -177,7 +177,7 @@ declare const TgMarker: import("vue").DefineComponent<{
177
177
  type: PropType<number>;
178
178
  };
179
179
  mapPane: {
180
- type: PropType<import("../../utils/mapped-types").StringEnumValue<typeof import("../../map/map/overlay/element-overlay").MapPane>>;
180
+ type: PropType<import("../../utils/mapped-types").StringEnumValue<typeof import("..").MapPane>>;
181
181
  };
182
182
  }>> & {
183
183
  onClick?: ((event: import("../../map/event").Tg.Event) => any) | undefined;
@@ -43,7 +43,7 @@ export declare class BaiduMap extends AbstractMap {
43
43
  setZoom(zoom: number): void;
44
44
  setMinZoom(zoom: number): void;
45
45
  setMaxZoom(zoom: number): void;
46
- setMapStyle(mapStyle: MapStyle): void;
46
+ setMapStyle(mapStyle?: MapStyle): void;
47
47
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
48
48
  setMapType(mapType: MapType): void;
49
49
  getMapType(): MapType;
@@ -41,7 +41,7 @@ export declare class GoogleMap extends AbstractMap {
41
41
  setCenter(latlng: LatLng): void;
42
42
  setMinZoom(zoom: number): void;
43
43
  setMaxZoom(zoom: number): void;
44
- setMapStyle(mapStyle: MapStyle): void;
44
+ setMapStyle(mapStyle?: MapStyle): void;
45
45
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
46
46
  setMapType(mapType: MapType): void;
47
47
  getMapType(): MapType;
@@ -40,7 +40,7 @@ export declare class HereMap extends AbstractMap {
40
40
  setDoubleClickZoom(enable: boolean): void;
41
41
  setMinZoom(zoom: number): void;
42
42
  setMaxZoom(zoom: number): void;
43
- setMapStyle(mapStyle: MapStyle): void;
43
+ setMapStyle(mapStyle?: MapStyle): void;
44
44
  setBuildInMapTypeId(id: BuildInMapTypeId): void;
45
45
  setMapType(mapType: MapType): void;
46
46
  getMapType(): MapType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="baidumap-web-sdk" />
1
2
  /// <reference types="google.maps" />
2
3
  import { LatLng } from '../lat-lng';
3
4
  import type { BuildInMapTypeId } from './map-type';
@@ -43,14 +44,19 @@ export interface MapOptions {
43
44
  export declare namespace MapOptions {
44
45
  function create(options?: Partial<MapOptions>): MapOptions;
45
46
  }
47
+ /**
48
+ * ## 本地样式编辑器
49
+ * - google: https://mapstyle.withgoogle.com/
50
+ * - baidu: https://lbsyun.baidu.com/apiconsole/custommap
51
+ *
52
+ * ## 关于云端样式
53
+ * - google: mapId只有创建时有效, 之后再更改无效
54
+ * - baidu: styleId无效, 原因未知
55
+ */
46
56
  export interface MapStyle {
47
- toBaidu(): BMap.MapStyleV2;
48
- toGoogle(): google.maps.MapTypeStyle[];
49
- }
50
- export declare class SimpleMapStyle implements MapStyle {
51
57
  baidu: BMap.MapStyleV2;
52
- google: google.maps.MapTypeStyle[];
53
- constructor(baidu: BMap.MapStyleV2, google: google.maps.MapTypeStyle[]);
54
- toBaidu(): BMap.MapStyleV2;
55
- toGoogle(): google.maps.MapTypeStyle[];
58
+ google: {
59
+ styles?: google.maps.MapTypeStyle[];
60
+ mapId?: string;
61
+ };
56
62
  }
@@ -116,7 +116,7 @@ export declare abstract class AbstractMap implements CoordTypeSupplier, Tg.Event
116
116
  abstract setCenter(latlng: LatLng): void;
117
117
  abstract setMinZoom(zoom: number): void;
118
118
  abstract setMaxZoom(zoom: number): void;
119
- abstract setMapStyle(mapStyle: MapStyle): void;
119
+ abstract setMapStyle(mapStyle?: MapStyle): void;
120
120
  /** setMapType的便利版, 只能够用来设置内置地图类型 */
121
121
  abstract setBuildInMapTypeId(id: BuildInMapTypeId): void;
122
122
  abstract setMapType(mapType: MapType): void;
package/dist/tg-map.js CHANGED
@@ -4222,7 +4222,7 @@ class Gi extends Tt {
4222
4222
  mapType: r.buildInMapTypeId && ((s = this.buildInMapTypeId2BIMT.get(r.buildInMapTypeId)) == null ? void 0 : s.asBaiduMapType()),
4223
4223
  enableMapClick: !1
4224
4224
  // 关闭底图点击功能
4225
- }), this.map.centerAndZoom(r.center.toBaidu(this.coordType), r.zoom + ee), this.setGestureHandling(r.gestureHandling), r.infoWindowMode === "multi" && console.warn("baidu不支持多个InfoWindow, 可能会出现未知问题"), r.mapStyle && this.map.setMapStyleV2(r.mapStyle.toBaidu()), this.setEventTargetDelegate(new ae(this.map, this)), this.map.addEventListener("addoverlay", (n) => {
4225
+ }), this.map.centerAndZoom(r.center.toBaidu(this.coordType), r.zoom + ee), this.setGestureHandling(r.gestureHandling), r.infoWindowMode === "multi" && console.warn("baidu不支持多个InfoWindow, 可能会出现未知问题"), r.mapStyle && this.map.setMapStyleV2(r.mapStyle.baidu), this.setEventTargetDelegate(new ae(this.map, this)), this.map.addEventListener("addoverlay", (n) => {
4226
4226
  const a = n.target.__info_box__;
4227
4227
  a && (console.debug("add:info-box", a), this.map.addOverlay(a));
4228
4228
  }), this.map.addEventListener("removeoverlay", (n) => {
@@ -4297,7 +4297,7 @@ class Gi extends Tt {
4297
4297
  this.map.setMaxZoom(e + ee);
4298
4298
  }
4299
4299
  setMapStyle(e) {
4300
- this.map.setMapStyleV2(e.toBaidu());
4300
+ this.map.setMapStyleV2((e == null ? void 0 : e.baidu) ?? { styleJson: [] });
4301
4301
  }
4302
4302
  setBuildInMapTypeId(e) {
4303
4303
  var s;
@@ -4381,7 +4381,7 @@ class Gi extends Tt {
4381
4381
  }
4382
4382
  class Zi extends Tt {
4383
4383
  constructor(e, r) {
4384
- var n;
4384
+ var n, a;
4385
4385
  super(e);
4386
4386
  c(this, "buildInMapTypeId2BIMT");
4387
4387
  c(this, "googleMapTypeId2BIMT");
@@ -4407,7 +4407,8 @@ class Zi extends Tt {
4407
4407
  gestureHandling: r.gestureHandling,
4408
4408
  minZoom: r.minZoom,
4409
4409
  maxZoom: r.maxZoom,
4410
- styles: (n = r.mapStyle) == null ? void 0 : n.toGoogle(),
4410
+ styles: (n = r.mapStyle) == null ? void 0 : n.google.styles,
4411
+ mapId: (a = r.mapStyle) == null ? void 0 : a.google.mapId,
4411
4412
  mapTypeId: s == null ? void 0 : s.getGoogleMapTypeId()
4412
4413
  }), this.setEventTargetDelegate(new re(this.map, this));
4413
4414
  }
@@ -4464,7 +4465,10 @@ class Zi extends Tt {
4464
4465
  this.map.setOptions({ maxZoom: e });
4465
4466
  }
4466
4467
  setMapStyle(e) {
4467
- this.map.setOptions({ styles: e.toGoogle() });
4468
+ this.map.setOptions({
4469
+ styles: e == null ? void 0 : e.google.styles,
4470
+ mapId: e == null ? void 0 : e.google.mapId
4471
+ });
4468
4472
  }
4469
4473
  setBuildInMapTypeId(e) {
4470
4474
  var s;
@@ -6132,7 +6136,9 @@ export {
6132
6136
  z as ControlPositionConverter,
6133
6137
  x as CoordType,
6134
6138
  gi as CustomControl,
6139
+ zi as ElementOverlay,
6135
6140
  pi as FastFindValues,
6141
+ j as GestureHandlingOptions,
6136
6142
  _i as GoogleAutocomplete,
6137
6143
  Ct as GoogleCircle,
6138
6144
  gt as GoogleControl,
@@ -6154,6 +6160,7 @@ export {
6154
6160
  Ze as IconSequence,
6155
6161
  Hs as ImageMapType,
6156
6162
  wt as InfoWindow,
6163
+ Si as InfoWindowModeValues,
6157
6164
  Ht as KeyValue,
6158
6165
  y as LatLng,
6159
6166
  R as LatLngBounds,
@@ -6164,6 +6171,9 @@ export {
6164
6171
  Gt as MIXIN_MAP_NAME,
6165
6172
  ce as MVCArrays,
6166
6173
  k as MapMixin,
6174
+ lt as MapOptions,
6175
+ we as MapPane,
6176
+ Ee as MapPanes,
6167
6177
  $ as MapType,
6168
6178
  dr as MapTypeControlType,
6169
6179
  fr as MapUrls,