tg-map-vue3 3.9.8 → 4.0.0
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 +8 -0
- package/README.md +4 -1
- package/dist/src/components/TgMap.vue.d.ts +1877 -83
- package/dist/src/components/TgMapWidget.vue.d.ts +3 -3
- package/dist/src/components/controls/TgCustomControl.vue.d.ts +1 -2
- package/dist/src/components/controls/TgMapTypeControl.vue.d.ts +8 -9
- package/dist/src/components/controls/TgScaleControl.vue.d.ts +4 -5
- package/dist/src/components/controls/TgStreetViewControl.vue.d.ts +4 -4
- package/dist/src/components/controls/TgZoomControl.vue.d.ts +4 -4
- package/dist/src/components/extra/TgHeatmap.vue.d.ts +2 -2
- package/dist/src/components/extra/TgMarkerClusterer.vue.d.ts +3 -4
- package/dist/src/components/index.d.ts +4 -40
- package/dist/src/components/layers/TgTrafficLayer.vue.d.ts +1 -1
- package/dist/src/components/map-hooks.d.ts +4 -4
- package/dist/src/components/map-mixin.d.ts +2 -2
- package/dist/src/components/overlays/TgCircle.vue.d.ts +19 -14
- package/dist/src/components/overlays/TgElementOverlay.vue.d.ts +5 -7
- package/dist/src/components/overlays/TgInfoBox.vue.d.ts +5 -7
- package/dist/src/components/overlays/TgInfoWindow.vue.d.ts +16 -17
- package/dist/src/components/overlays/TgLabel.vue.d.ts +4 -7
- package/dist/src/components/overlays/TgMarker.vue.d.ts +89 -45
- package/dist/src/components/overlays/TgPolygon.vue.d.ts +64 -27
- package/dist/src/components/overlays/TgPolyline.vue.d.ts +16 -12
- package/dist/src/components/overlays/TgRectangle.vue.d.ts +28 -27
- package/dist/src/utils/hooks.d.ts +4 -0
- package/dist/src/utils/vue-utils.d.ts +13 -2
- package/dist/tg-map.cjs +2 -17
- package/dist/tg-map.cjs.map +1 -1
- package/dist/tg-map.js +683 -6142
- package/dist/tg-map.js.map +1 -1
- package/package.json +14 -12
- package/dist/src/map/event-target.d.ts +0 -71
- package/dist/src/map/event.d.ts +0 -46
- package/dist/src/map/lat-lng.d.ts +0 -157
- package/dist/src/map/map/baidu-map.d.ts +0 -82
- package/dist/src/map/map/controls/control.d.ts +0 -112
- package/dist/src/map/map/controls/map-type.control.d.ts +0 -29
- package/dist/src/map/map/controls/scale.control.d.ts +0 -15
- package/dist/src/map/map/controls/street-view.control.d.ts +0 -20
- package/dist/src/map/map/controls/zoom.control.d.ts +0 -15
- package/dist/src/map/map/extra/autocomplete.d.ts +0 -41
- package/dist/src/map/map/extra/heatmap.d.ts +0 -71
- package/dist/src/map/map/extra/map-urls.d.ts +0 -59
- package/dist/src/map/map/extra/marker-clusterer.d.ts +0 -73
- package/dist/src/map/map/extra/places-service.d.ts +0 -46
- package/dist/src/map/map/extra/search-box.d.ts +0 -38
- package/dist/src/map/map/google-map.d.ts +0 -81
- package/dist/src/map/map/here-map.d.ts +0 -78
- package/dist/src/map/map/map-options.d.ts +0 -60
- package/dist/src/map/map/map-type.d.ts +0 -110
- package/dist/src/map/map/map.d.ts +0 -168
- package/dist/src/map/map/overlay/baidu-info-box.d.ts +0 -82
- package/dist/src/map/map/overlay/circle.d.ts +0 -51
- package/dist/src/map/map/overlay/element-overlay.d.ts +0 -37
- package/dist/src/map/map/overlay/google-label.d.ts +0 -68
- package/dist/src/map/map/overlay/icon.d.ts +0 -122
- package/dist/src/map/map/overlay/info-box.d.ts +0 -60
- package/dist/src/map/map/overlay/info-window.d.ts +0 -111
- package/dist/src/map/map/overlay/label.d.ts +0 -102
- package/dist/src/map/map/overlay/marker-label.d.ts +0 -19
- package/dist/src/map/map/overlay/marker.d.ts +0 -143
- package/dist/src/map/map/overlay/overlay.d.ts +0 -46
- package/dist/src/map/map/overlay/polygon.d.ts +0 -42
- package/dist/src/map/map/overlay/polyline.d.ts +0 -71
- package/dist/src/map/map/overlay/rectangle.d.ts +0 -50
- package/dist/src/map/map/overlay/shape.d.ts +0 -65
- package/dist/src/map/map-config.d.ts +0 -25
- package/dist/src/map/map-factory.d.ts +0 -10
- package/dist/src/map/map-loader.d.ts +0 -19
- package/dist/src/map/types.d.ts +0 -17
- package/dist/src/map/unions.d.ts +0 -19
- package/dist/src/utils/arrays.d.ts +0 -19
- package/dist/src/utils/baidu-utils.d.ts +0 -23
- package/dist/src/utils/elements.d.ts +0 -4
- package/dist/src/utils/formatter.d.ts +0 -1
- package/dist/src/utils/google-utils.d.ts +0 -34
- package/dist/src/utils/here-utils.d.ts +0 -10
- package/dist/src/utils/mapped-types.d.ts +0 -90
- package/dist/src/utils/objects.d.ts +0 -27
- package/dist/src/utils/spherical-utils.d.ts +0 -20
- package/dist/src/utils/strings.d.ts +0 -21
- package/dist/src/utils/utils.d.ts +0 -13
- package/dist/src/utils/values.d.ts +0 -34
- package/src/map/dts/baidu.d.ts +0 -53
- package/src/map/dts/google.d.ts +0 -10
- package/src/map/dts/here-v31.d.ts +0 -16
- package/src/map/dts/index.d.ts +0 -4
- package/src/map/dts/js-modules.d.ts +0 -15
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AbstractMap } from './map/map';
|
|
2
|
-
import { MapOptions } from './map/map-options';
|
|
3
|
-
export declare enum TgMapType {
|
|
4
|
-
google = "google",
|
|
5
|
-
baidu = "baidu",
|
|
6
|
-
here = "here"
|
|
7
|
-
}
|
|
8
|
-
export declare namespace TgMapFactory {
|
|
9
|
-
function createMap(type: TgMapType, $map: HTMLElement, mapOptions?: Partial<MapOptions>): AbstractMap;
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type TgMapConfig } from './map-config';
|
|
2
|
-
import { TgMapType } from './map-factory';
|
|
3
|
-
/**
|
|
4
|
-
* 使用类型映射的方式`TgMapConfig[T]`, 确定`type`的类型之后, 不会自动推断`config`的类型,
|
|
5
|
-
* 故另外声明了一个联合类型{@link LoadMapOptionsImpl}, 在实现代码中使用它来自动推断类型
|
|
6
|
-
*/
|
|
7
|
-
type LoadMapOptions<T extends TgMapType> = {
|
|
8
|
-
type: T;
|
|
9
|
-
config: TgMapConfig[T];
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* 加载缓存的地图, 保证一种地图只加载一次
|
|
13
|
-
*/
|
|
14
|
-
export declare function loadCachedMap(type: TgMapType): Promise<unknown>;
|
|
15
|
-
/** 载入地图库 */
|
|
16
|
-
export declare function loadMap<T extends TgMapType>(options: LoadMapOptions<T>): Promise<unknown>;
|
|
17
|
-
export declare function loadJsonp(url: string, callbackParamName?: string): Promise<unknown>;
|
|
18
|
-
export declare function loadJs(url: string): Promise<unknown>;
|
|
19
|
-
export {};
|
package/dist/src/map/types.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface Size {
|
|
2
|
-
readonly width: number;
|
|
3
|
-
readonly height: number;
|
|
4
|
-
}
|
|
5
|
-
export interface Point {
|
|
6
|
-
readonly x: number;
|
|
7
|
-
readonly y: number;
|
|
8
|
-
}
|
|
9
|
-
export declare namespace Point {
|
|
10
|
-
const ZERO: Point;
|
|
11
|
-
}
|
|
12
|
-
export interface Padding {
|
|
13
|
-
top: number;
|
|
14
|
-
right: number;
|
|
15
|
-
bottom: number;
|
|
16
|
-
left: number;
|
|
17
|
-
}
|
package/dist/src/map/unions.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BaiduInfoBox } from './map/overlay/baidu-info-box';
|
|
2
|
-
import type { GoogleLabel } from './map/overlay/google-label';
|
|
3
|
-
/**
|
|
4
|
-
* Map相关的各种类型的联合, 可以用来简化一部分代码的书写
|
|
5
|
-
*/
|
|
6
|
-
export type UnionMap = google.maps.Map | BMap.Map | H.Map;
|
|
7
|
-
export type UnionBaiduIcon = BMap.Icon | BMap.Symbol;
|
|
8
|
-
export type UnionGoogleIcon = google.maps.Icon | google.maps.Symbol | google.maps.UrlIcon;
|
|
9
|
-
export type UnionInfoWindow = google.maps.InfoWindow | BMap.InfoWindow;
|
|
10
|
-
export type UnionAutocomplete = google.maps.places.Autocomplete | BMap.Autocomplete;
|
|
11
|
-
export type UnionPlacesService = google.maps.places.PlacesService | BMap.LocalSearch;
|
|
12
|
-
export type UnionGoogleOverlay = google.maps.Marker | google.maps.Polyline | google.maps.Polygon | google.maps.Circle | google.maps.Rectangle | GoogleLabel;
|
|
13
|
-
export type UnionBaiduOverlay = BMap.Marker | BMap.Polyline | BMap.Polygon | BMap.Circle | BMap.Label | BaiduInfoBox;
|
|
14
|
-
export type UnionGoogleEventTarget = google.maps.MVCObject;
|
|
15
|
-
export type UnionBaiduEventTarget = UnionBaiduOverlay | BMap.InfoWindow | BMap.Autocomplete | BMap.Map;
|
|
16
|
-
export type UnionBaiduShape = BMap.Polyline | BMap.Polygon | BMap.Circle;
|
|
17
|
-
export type UnionGoogleShape = google.maps.Polyline | google.maps.Polygon | google.maps.Circle | google.maps.Rectangle;
|
|
18
|
-
export type UnionControl = BMap.Control | HTMLElement;
|
|
19
|
-
export type GoogleLayer = google.maps.TrafficLayer | google.maps.TransitLayer | google.maps.KmlLayer | google.maps.BicyclingLayer;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AnyFunction, Constructor } from './mapped-types';
|
|
2
|
-
export declare namespace Arrays {
|
|
3
|
-
function findByType<T>(arr: any[], constructor: Constructor<T>): T | undefined;
|
|
4
|
-
/** 自动推断item的类型的{@link Array.includes} */
|
|
5
|
-
function includesTyped<T extends E, E>(arr: T[], item: E): item is T;
|
|
6
|
-
/** 设置 指定位置的值 */
|
|
7
|
-
function at<T>(arr: T[], index: number, value: T): void;
|
|
8
|
-
/** 获取 指定位置的值 */
|
|
9
|
-
function at<T>(arr: T[], index: number): T | undefined;
|
|
10
|
-
}
|
|
11
|
-
export declare namespace MVCArrays {
|
|
12
|
-
function indexOf<T>(arr: google.maps.MVCArray<T>, item: T): number;
|
|
13
|
-
function remove<T>(arr: google.maps.MVCArray<T>, item: T): T | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* 监听数组内容变化
|
|
16
|
-
* @see https://developers.google.com/maps/documentation/javascript/shapes#editable_events
|
|
17
|
-
* */
|
|
18
|
-
function listenChanged<T>(path: google.maps.MVCArray<T>, handler: AnyFunction): google.maps.MapsEventListener[];
|
|
19
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 3.0版的Overlay是类
|
|
3
|
-
* @see http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a3b0
|
|
4
|
-
*/
|
|
5
|
-
export declare function ensureBaiduV3(): void;
|
|
6
|
-
/**
|
|
7
|
-
* 尝试修复baidu内存占用会越来越大的问题
|
|
8
|
-
*
|
|
9
|
-
* 当前版本的baidu源码中, 存在如下代码:
|
|
10
|
-
* ```
|
|
11
|
-
* A.lang.qx = function(a) {
|
|
12
|
-
* var b = window[A.da]; // A.da等于'$BAIDU$'
|
|
13
|
-
* b.kT && delete b.kT[a] // kT属性不存在, 故永远无法移除成功
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
* 最终会导致`$BAIDU$._instances`对象不断增长, 故我们把`$BAIDU$`对象的`kT`属性重定向到`_instances`
|
|
17
|
-
* 保证该方法能够执行成功
|
|
18
|
-
*/
|
|
19
|
-
export declare function tryFixBaiduOutOfMemory(): void;
|
|
20
|
-
export declare const BMapPoints: {
|
|
21
|
-
/** {@link BMap.Point.equals} 无效, 故需要自己写一个 */
|
|
22
|
-
equals(a: BMap.Point, b: BMap.Point): boolean;
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function dimen(value: string | number | null | undefined): string | undefined;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type CoordTypeSupplier } from '../map/lat-lng';
|
|
2
|
-
import type { Place } from '../map/map/extra/places-service';
|
|
3
|
-
/**
|
|
4
|
-
* Google地图官方提供的载入方式, 使用{@link google.map.importLibrary}动态载入依赖
|
|
5
|
-
*
|
|
6
|
-
* 实验性的特性, 实测当前只有`3.52`版支持
|
|
7
|
-
*
|
|
8
|
-
* @see https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import
|
|
9
|
-
*/
|
|
10
|
-
export declare function initGoogleMapDynamicLibraryImport(args: {
|
|
11
|
-
key: string;
|
|
12
|
-
v?: string;
|
|
13
|
-
}): void;
|
|
14
|
-
export declare const GoogleConst: {
|
|
15
|
-
/** Google的坐标0点 */
|
|
16
|
-
readonly LATLNG_ZERO: google.maps.LatLng;
|
|
17
|
-
readonly BOUNDS_ZERO: google.maps.LatLngBounds;
|
|
18
|
-
};
|
|
19
|
-
export interface AddressFields {
|
|
20
|
-
/** 国家 */
|
|
21
|
-
country: string;
|
|
22
|
-
/** 省 */
|
|
23
|
-
province: string;
|
|
24
|
-
/** 市 */
|
|
25
|
-
city: string;
|
|
26
|
-
/** 区 */
|
|
27
|
-
district: string;
|
|
28
|
-
/** 街道 */
|
|
29
|
-
street: string;
|
|
30
|
-
/** 门牌号 */
|
|
31
|
-
streetNumber: string;
|
|
32
|
-
}
|
|
33
|
-
export declare function parseGoogleAddressComponents(addressComponents: google.maps.GeocoderAddressComponent[], outResult?: AddressFields): AddressFields;
|
|
34
|
-
export declare function parseGooglePlace(place: google.maps.places.PlaceResult, coordTypeSupplier: CoordTypeSupplier): Place;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 最新是3.1版, 但@types/heremaps和以前的项目都用的是3.0版, 故当前先用3.0...
|
|
3
|
-
* TODO: 改成使用3.1版实现
|
|
4
|
-
**/
|
|
5
|
-
export declare const HERE_SUPPORTED_VERSIONS: readonly ["3.0"];
|
|
6
|
-
/**
|
|
7
|
-
* 当前@types/heremaps是v3.0版, 和v3.1版api有区别, 若要使用3.1版, 需要用这个方法来做到类型注解兼容...
|
|
8
|
-
* @see https://developer.here.com/documentation/maps/topics/migration.html
|
|
9
|
-
*/
|
|
10
|
-
export declare function ensureHereV31(): void;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Component, ComponentPublicInstance } from 'vue';
|
|
2
|
-
/** deep版的 `Partial` */
|
|
3
|
-
export type DeepPartial<T> = {
|
|
4
|
-
[U in keyof T]?: T[U] extends object ? DeepPartial<T[U]> : T[U];
|
|
5
|
-
};
|
|
6
|
-
/** 表示一个函数 */
|
|
7
|
-
export type AnyFunction = (...args: any[]) => any;
|
|
8
|
-
/**
|
|
9
|
-
* 表示一个构造器
|
|
10
|
-
* {@link import('vue/types/options').Constructor}
|
|
11
|
-
* */
|
|
12
|
-
export type Constructor<T = {}> = new (...args: any[]) => T;
|
|
13
|
-
/**
|
|
14
|
-
* 抽象构造器类型, 相比{@link Constructor}, 不能直接用new创建对象
|
|
15
|
-
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures
|
|
16
|
-
*/
|
|
17
|
-
export type AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;
|
|
18
|
-
/** 原始类型=>包装类型 */
|
|
19
|
-
export type PrimitiveToWrapper<T> = T extends boolean ? boolean : T extends string ? string : T extends number ? number : T;
|
|
20
|
-
/** 包装类型=>原始类型 */
|
|
21
|
-
export type WrapperToPrimitive<T> = T extends boolean ? boolean : T extends string ? string : T extends number ? number : T;
|
|
22
|
-
/**
|
|
23
|
-
* `vue instanceof VueConstructor`时`vue`并不会自动转换成`VueConstructor`的子类, 用该方法可以实现这种转换
|
|
24
|
-
*/
|
|
25
|
-
export declare function isInstanceOf<T>(obj: any, constructor: Constructor<T>): obj is T;
|
|
26
|
-
/** @see isInstanceOf */
|
|
27
|
-
export declare function safeAs<T>(obj: any, constructor: Constructor<T>): T | undefined;
|
|
28
|
-
/** 判断{@link instance}是否是{@link component}的实例 */
|
|
29
|
-
export declare function isComponentByType<C extends Component & AbstractConstructor>(instance: ComponentPublicInstance | null, component: C): instance is InstanceType<C>;
|
|
30
|
-
/** 安全转换组件类型, 若不能转换会返回`undefined` */
|
|
31
|
-
export declare function safeAsComponent<C extends Component & AbstractConstructor>(instance: ComponentPublicInstance | null, component: C): InstanceType<C> | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* 查找[startInstance, endComponent)之间的第一个类型为{@link component}的父组件
|
|
34
|
-
* @param component 查找的组件
|
|
35
|
-
* @param startInstance 查找的开始实例, 包含
|
|
36
|
-
* @param endComponent 查找的终止组件, 不包含
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export declare function findAncestorComponentByType<C extends Component & AbstractConstructor>(component: C, startInstance: ComponentPublicInstance | null, endComponent?: Component & AbstractConstructor): InstanceType<C> | undefined;
|
|
40
|
-
/** {@link NonNullable} 的反义词 */
|
|
41
|
-
export type Nullable<T> = T | null | undefined;
|
|
42
|
-
/** T的所有value的联合类型 */
|
|
43
|
-
export type ValueOf<T> = T[keyof T];
|
|
44
|
-
/**
|
|
45
|
-
* 提取出T中value为V的子类的所有key
|
|
46
|
-
* @see https://stackoverflow.com/questions/54520676/in-typescript-how-to-specify-only-keys-of-a-generic-object-whose-values-are-stri
|
|
47
|
-
* */
|
|
48
|
-
export type KeysMatching<T, V> = {
|
|
49
|
-
[K in keyof T]: T[K] extends V ? K : never;
|
|
50
|
-
}[keyof T];
|
|
51
|
-
/**
|
|
52
|
-
* 并不存在可以精确表示一个枚举类型, 该类只能近似表示一个字符枚举
|
|
53
|
-
* */
|
|
54
|
-
export type StringEnumLike = {
|
|
55
|
-
[k: string]: string;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* String枚举的值, 包括`string`类型
|
|
59
|
-
* @see https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum
|
|
60
|
-
*/
|
|
61
|
-
export type StringEnumValue<E extends StringEnumLike> = ValueOf<E> | `${ValueOf<E>}`;
|
|
62
|
-
/**
|
|
63
|
-
* 包装`T`中的部分枚举字段的值为{@link StringEnumValue}
|
|
64
|
-
*
|
|
65
|
-
* 会校验{@link EnumObjects}中的类型是否书写正确, 若写错, 会推断成`never`
|
|
66
|
-
* */
|
|
67
|
-
export type WrapStringEnumValue<T, EnumObjects extends {
|
|
68
|
-
[k in keyof T]?: StringEnumLike;
|
|
69
|
-
}> = {
|
|
70
|
-
[P in keyof T]: P extends keyof EnumObjects ? EnumObjects[P] extends StringEnumLike ? T[P] extends ValueOf<EnumObjects[P]> | undefined ? StringEnumValue<EnumObjects[P]> : never : never : T[P];
|
|
71
|
-
};
|
|
72
|
-
/** 取消包装`T`中的{@link StringEnumValue}字段 */
|
|
73
|
-
export declare function unwrapStringEnumValue<T extends object>(value: T): {
|
|
74
|
-
[K in keyof T]: T[K] extends StringEnumValue<infer Enum> ? StringEnumLike extends Enum ? T[K] : Enum[keyof Enum] : Exclude<T[K], undefined> extends StringEnumValue<infer Enum> ? StringEnumLike extends Enum ? T[K] : Enum[keyof Enum] | undefined : T[K];
|
|
75
|
-
};
|
|
76
|
-
export declare function unwrapStringEnumValue<E extends StringEnumLike>(value: StringEnumValue<E>, enumObject?: E): E[keyof E];
|
|
77
|
-
export declare function unwrapStringEnumValue<E extends StringEnumLike>(value: StringEnumValue<E> | undefined, enumObject?: E): E[keyof E] | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* 非空的值
|
|
80
|
-
*
|
|
81
|
-
* 类型`{}`也表示"任何非空的值", 但由于它看起来像空对象, 所以一般更推荐用Thing
|
|
82
|
-
*
|
|
83
|
-
* @see https://github.com/microsoft/TypeScript/issues/7648#issuecomment-541625573
|
|
84
|
-
* @see https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492
|
|
85
|
-
*/
|
|
86
|
-
export type Thing = string | number | boolean | bigint | object | symbol;
|
|
87
|
-
/** 除T指定的类型外, 其他参数 */
|
|
88
|
-
export type TypedAny<T> = T & {
|
|
89
|
-
[k: string]: any;
|
|
90
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare namespace Objects {
|
|
2
|
-
function fromArray<T>(arr: T[], keySelector: (it: T) => string): {
|
|
3
|
-
[key: string]: T;
|
|
4
|
-
};
|
|
5
|
-
function fromEntries<V>(entries: [string, V][]): {
|
|
6
|
-
[k: string]: V;
|
|
7
|
-
};
|
|
8
|
-
function toJsonSafely(value: any): string;
|
|
9
|
-
/** 删除obj中纯对象上的值为undefined的属性 */
|
|
10
|
-
function deleteUndefinedPropertyOnPlainObjectDeeply(obj: any): void;
|
|
11
|
-
/** 存在则返回, 不存在则新建 */
|
|
12
|
-
function putIfAbsent<K extends keyof any, V>(obj: Record<K, V>, key: K, ifAbsent: () => Exclude<V, undefined>): Exclude<V, undefined>;
|
|
13
|
-
/** @see Omit */
|
|
14
|
-
function omit<T, K extends keyof any>(obj: T, ...keys: K[]): Omit<T, K>;
|
|
15
|
-
/** @see Pick */
|
|
16
|
-
function pick<T, K extends keyof T>(obj: T, ...keys: K[]): Pick<T, K>;
|
|
17
|
-
/**
|
|
18
|
-
* 使用{@link keyPath}读取`obj`的字段
|
|
19
|
-
*
|
|
20
|
-
* @param keyPath `.`分隔的字段名 或 字段名数组
|
|
21
|
-
* @returns 若字段不存在, 则返回`undefined`
|
|
22
|
-
*/
|
|
23
|
-
function get(obj: any, keyPath: string | string[]): any;
|
|
24
|
-
function del(obj: any, keyPath: string | string[]): any;
|
|
25
|
-
}
|
|
26
|
-
/** 用于替代Vue2中的filter, 直接交给模板使用 */
|
|
27
|
-
export declare const stringify: typeof Objects.toJsonSafely;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { LatLngLiteral } from '../components';
|
|
2
|
-
/**
|
|
3
|
-
* 球面两点之间距离(米)
|
|
4
|
-
* @param p1
|
|
5
|
-
* @param p2
|
|
6
|
-
*/
|
|
7
|
-
declare function getDistance(p1: LatLngLiteral, p2: LatLngLiteral): number;
|
|
8
|
-
/**
|
|
9
|
-
* 已知一点经纬度,方位角,距离求另一点
|
|
10
|
-
* @param pt 点
|
|
11
|
-
* @param angle 角度
|
|
12
|
-
* @param dist 距离
|
|
13
|
-
*/
|
|
14
|
-
export declare function getDestination(pt: LatLngLiteral, angle: number, dist: number): LatLngLiteral;
|
|
15
|
-
/** 球面工具 */
|
|
16
|
-
export declare const SphericalUtils: {
|
|
17
|
-
getDistance: typeof getDistance;
|
|
18
|
-
getDestination: typeof getDestination;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { StringEnumLike } from './mapped-types';
|
|
2
|
-
export declare namespace Strings {
|
|
3
|
-
/**
|
|
4
|
-
* 将string转换成字符枚举, 转换失败返回undefined
|
|
5
|
-
* @see {@link import('./vue-utils.ts').stringEnumProp} 由于使用了Object.values(enumObject), 应该避免在enumObject上添加其他属性/方法
|
|
6
|
-
* @deprecated 使用{@link import('./mapped-types.ts').unwrapStringEnumValue}替代
|
|
7
|
-
*/
|
|
8
|
-
function toEnumOrNull<E extends StringEnumLike>(value: string | undefined, enumObject: E): E[keyof E] | undefined;
|
|
9
|
-
function trimIndent(str: string): string;
|
|
10
|
-
/** 转换: `FuckYou` -> `fuck-you` */
|
|
11
|
-
function pascal2kebab(str: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* 简单判断字符串是否表示一个整数
|
|
14
|
-
* - `10` : ✅️
|
|
15
|
-
* - `-10`: ✅️
|
|
16
|
-
* - `+10`: ❌️
|
|
17
|
-
* - `2e2`: ❌️
|
|
18
|
-
* @see https://stackoverflow.com/questions/175739/how-can-i-check-if-a-string-is-a-valid-number
|
|
19
|
-
* */
|
|
20
|
-
function isInt(str: string): boolean;
|
|
21
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function todo(msg?: string): never;
|
|
2
|
-
export declare function debug(msg?: any): any;
|
|
3
|
-
/**
|
|
4
|
-
* entry的value是否定义了
|
|
5
|
-
*
|
|
6
|
-
* 可以用在Array.filter(isEntryValueDef)中, 用来过滤值为空的元素
|
|
7
|
-
* @see isNotNull
|
|
8
|
-
*/
|
|
9
|
-
export declare function isEntryValueDef<K, V>(entry: [K, V]): entry is [K, NonNullable<V>];
|
|
10
|
-
/**
|
|
11
|
-
* 创建一个异步初始化的单例, 保证只初始化成功一次
|
|
12
|
-
*/
|
|
13
|
-
export declare function createAsyncSingleton<T>(creator: () => Promise<T>): () => Promise<T>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** 键值对 */
|
|
2
|
-
export declare class KeyValue<K, V> {
|
|
3
|
-
private keyToValue;
|
|
4
|
-
private valueToKey;
|
|
5
|
-
/**
|
|
6
|
-
* `keys`和`values`数组中可以有相同的值, 若存在相同值, 则index越小的优先级越高
|
|
7
|
-
*/
|
|
8
|
-
constructor(keys: K[], values: V[]);
|
|
9
|
-
toKey(value: V): K;
|
|
10
|
-
toValue(key: K): V;
|
|
11
|
-
}
|
|
12
|
-
export type KeySelector<T, K> = (this: T) => K;
|
|
13
|
-
/** 用key快速查找元素的数组 */
|
|
14
|
-
export declare class FastFindValues<T> {
|
|
15
|
-
values: readonly T[];
|
|
16
|
-
private maxSize4Debug;
|
|
17
|
-
private map;
|
|
18
|
-
constructor(values: readonly T[], maxSize4Debug?: number);
|
|
19
|
-
/** 获取保存key-value映射的Map */
|
|
20
|
-
getValueMap<K>(keySelector: KeySelector<T, K>): Map<K, T>;
|
|
21
|
-
/**
|
|
22
|
-
* 直接用key获取value
|
|
23
|
-
* @param keySelector 从T中读取key的方法, 会用它当key, 缓存结果, 故多次调用需要使用相同的keySelector对象, 不要每次创建新的, 推荐直接使用T.prototype.getXxx作为keySelector
|
|
24
|
-
*/
|
|
25
|
-
getOrNull<K>(keySelector: KeySelector<T, K>, key: K): T | undefined;
|
|
26
|
-
get<K>(keySelector: KeySelector<T, K>, key: K): T;
|
|
27
|
-
}
|
|
28
|
-
/** 缓存的值 */
|
|
29
|
-
export declare class CachedValue<T> {
|
|
30
|
-
private creator;
|
|
31
|
-
private value;
|
|
32
|
-
constructor(creator: () => T);
|
|
33
|
-
get(): T;
|
|
34
|
-
}
|
package/src/map/dts/baidu.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
declare namespace BMap {
|
|
2
|
-
class OverlayV3 {
|
|
3
|
-
initialize(map: Map): HTMLElement
|
|
4
|
-
isVisible(): boolean
|
|
5
|
-
draw(): void
|
|
6
|
-
show(): void
|
|
7
|
-
hide(): void
|
|
8
|
-
// 这些方法文档中都没写, 但确实可以调用...
|
|
9
|
-
addEventListener(event: string, handler: Callback): void
|
|
10
|
-
removeEventListener(event: string, handler: Callback): void
|
|
11
|
-
/** @param event type名要以'on'开头 */
|
|
12
|
-
dispatchEvent(event: { type: string }): void
|
|
13
|
-
}
|
|
14
|
-
interface Map {
|
|
15
|
-
addEventListener(event: string, handler: Callback): void
|
|
16
|
-
removeEventListener(event: string, handler: Callback): void
|
|
17
|
-
}
|
|
18
|
-
interface Autocomplete {
|
|
19
|
-
addEventListener(event: string, handler: Callback): void
|
|
20
|
-
removeEventListener(event: string, handler: Callback): void
|
|
21
|
-
}
|
|
22
|
-
interface AutocompleteResultPoi {
|
|
23
|
-
city: string
|
|
24
|
-
}
|
|
25
|
-
interface LocalSearchOptions {
|
|
26
|
-
onSearchComplete?: ((results: LocalResult[] | LocalResult) => void) | undefined;
|
|
27
|
-
}
|
|
28
|
-
interface LocalResultPoi {
|
|
29
|
-
uid: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface MarkerOptions {
|
|
33
|
-
icon?: BMap.Symbol | Icon
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface Marker {
|
|
37
|
-
setIcon(icon: Icon | BMap.Symbol): void;
|
|
38
|
-
getIcon(): Icon | BMap.Symbol;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface Symbol {
|
|
42
|
-
/** 实际的锚点, 第一次添加到地图上时会为undefined */
|
|
43
|
-
anchor?: Size
|
|
44
|
-
style: {
|
|
45
|
-
/** 设置的锚点 */
|
|
46
|
-
anchor: Size
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface IconOptions {
|
|
51
|
-
imageSize?: Size
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/map/dts/google.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// v3.1
|
|
2
|
-
declare namespace H {
|
|
3
|
-
namespace service {
|
|
4
|
-
interface PlatformV31Constructor {
|
|
5
|
-
new(options: { apikey: string }): Platform
|
|
6
|
-
}
|
|
7
|
-
interface PlatformV31 extends Platform {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
let PlatformV31: PlatformV31Constructor
|
|
11
|
-
interface DefaultLayers {
|
|
12
|
-
raster: { normal: H.service.MapType, satellite: H.service.MapType, terrain: H.service.MapType }
|
|
13
|
-
vector: { normal: { map: H.map.layer.TileLayer, traffic: H.map.layer.TileLayer, trafficincidents: H.map.layer.MarkerTileLayer } }
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/map/dts/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 当前版本, tsconfig中`allowJs:true`和`declaration:true`不兼容, 导致引用第三方js库时, 无法利用JSDoc的类型注解
|
|
3
|
-
* 未来貌似会增加允许两者同时为true的功能, 详见{@link https://github.com/microsoft/TypeScript/pull/32372}
|
|
4
|
-
*
|
|
5
|
-
* 当前使用两个tsconfig, 达到类似效果:
|
|
6
|
-
* 1. tsconfig.json: `allowJs:true`+`declaration:false`, 用来在VSCode中利用第三方JS库的JSDoc注解
|
|
7
|
-
* 2. tsconfig.types.json: `allowJs:false`+`declaration:true`, 用来在编译时正常输出.d.ts文件
|
|
8
|
-
*
|
|
9
|
-
* 而该文件(`js-modules.d.ts`)的作用就是声明用到的第三方js库, 让tsconfig.types.json能够正常编译
|
|
10
|
-
*
|
|
11
|
-
* typescript 3.7 之后已支持两者同时为true, 该文件暂时没有用, 可以移除
|
|
12
|
-
*/
|
|
13
|
-
// cSpell:ignore bmaplib, markerclusterer
|
|
14
|
-
// declare module 'bmaplib.markerclusterer'
|
|
15
|
-
// declare module '@google/markerclusterer'
|