@heycar/heycars-map 1.0.0-coordinate7 → 2.0.0-switchMap10
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/README.md +45 -52
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/v2/App.js +8 -4
- package/dist/v2/Demo/DemoBusinessQuoting.js +6 -12
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v2/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v2/Demo/DemoBusinessTaxiEnd.js +2 -18
- package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v2/Demo/DemoBusinessTaxiService.js +6 -19
- package/dist/v2/api/cdn.d.ts +1 -0
- package/dist/v2/api/cdn.js +2 -0
- package/dist/v2/api/googleSnapRoad.js +7 -2
- package/dist/v2/api/pingConnection.d.ts +9 -0
- package/dist/v2/api/pingConnection.js +111 -0
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
- package/dist/v2/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -3
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +4 -3
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
- package/dist/v2/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -3
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v2/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
- package/dist/v2/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v2/chunks/{BusinessRecomendPlaceMap.87ea3b2f.js → BusinessRecomendPlaceMap.b4d45108.js} +65 -30
- package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
- package/dist/v2/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v2/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v2/components/Loading/Loading.d.ts +6 -0
- package/dist/v2/components/Loading/Loading.js +4 -2
- package/dist/v2/components/Loading/index.js +3 -2
- package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
- package/dist/v2/components/MapProvider/MapProvider.js +24 -13
- package/dist/v2/css/Loading-49e58ced.css +46 -0
- package/dist/v2/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v2/hooks/useDrivingRoute.js +4 -0
- package/dist/v2/hooks/useMapGCJ02.js +4 -37
- package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v2/hooks/useMapGeometry.js +4 -4
- package/dist/v2/hooks/useMapGraspRoad.js +1 -2
- package/dist/v2/hooks/useMapInChina.d.ts +3 -15
- package/dist/v2/hooks/useMapInChina.js +11 -16
- package/dist/v2/hooks/useMapLoader.d.ts +18 -10
- package/dist/v2/hooks/useMapLoader.js +159 -82
- package/dist/v2/hooks/useMapPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapPlace.js +52 -44
- package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v2/hooks/useMapSupplier.js +17 -0
- package/dist/v2/hooks/usePingConnection.d.ts +10 -0
- package/dist/v2/hooks/usePingConnection.js +26 -0
- package/dist/v2/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
- package/dist/v2/hooks-business/useBusinessQuotingMap.js +10 -10
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
- package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v2/index.js +1 -1
- package/dist/v2/types/global.d.ts +3 -0
- package/dist/v2/types/interface.d.ts +1 -1
- package/dist/v2/utils/ManualAbortError.d.ts +3 -0
- package/dist/v2/utils/ManualAbortError.js +14 -0
- package/dist/v2/utils/compare.d.ts +4 -0
- package/dist/v2/utils/compare.js +6 -0
- package/dist/v2/utils/helper.d.ts +6 -0
- package/dist/v2/utils/helper.js +43 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
- package/dist/v3/App.js +8 -4
- package/dist/v3/Demo/DemoBusinessQuoting.js +7 -13
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v3/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v3/Demo/DemoBusinessTaxiEnd.js +3 -17
- package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v3/Demo/DemoBusinessTaxiService.js +6 -17
- package/dist/v3/api/cdn.d.ts +1 -0
- package/dist/v3/api/cdn.js +2 -0
- package/dist/v3/api/googleSnapRoad.js +7 -2
- package/dist/v3/api/pingConnection.d.ts +9 -0
- package/dist/v3/api/pingConnection.js +111 -0
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +16 -7
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
- package/dist/v3/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +10 -3
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +4 -3
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
- package/dist/v3/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v3/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +19 -7
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
- package/dist/v3/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v3/chunks/{BusinessRecomendPlaceMap.57b15c64.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +65 -30
- package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
- package/dist/v3/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v3/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v3/components/Loading/Loading.d.ts +8 -0
- package/dist/v3/components/Loading/Loading.js +4 -2
- package/dist/v3/components/Loading/index.js +3 -2
- package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
- package/dist/v3/components/MapProvider/MapProvider.js +22 -13
- package/dist/v3/css/Loading-49e58ced.css +46 -0
- package/dist/v3/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v3/hooks/useDrivingRoute.js +4 -0
- package/dist/v3/hooks/useMapGCJ02.js +4 -37
- package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v3/hooks/useMapGeometry.js +4 -4
- package/dist/v3/hooks/useMapGraspRoad.js +1 -2
- package/dist/v3/hooks/useMapInChina.d.ts +3 -15
- package/dist/v3/hooks/useMapInChina.js +11 -16
- package/dist/v3/hooks/useMapLoader.d.ts +18 -10
- package/dist/v3/hooks/useMapLoader.js +159 -82
- package/dist/v3/hooks/useMapPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapPlace.js +52 -44
- package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v3/hooks/useMapSupplier.js +17 -0
- package/dist/v3/hooks/usePingConnection.d.ts +10 -0
- package/dist/v3/hooks/usePingConnection.js +26 -0
- package/dist/v3/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
- package/dist/v3/hooks-business/useBusinessQuotingMap.js +10 -10
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
- package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v3/index.js +1 -1
- package/dist/v3/types/global.d.ts +3 -0
- package/dist/v3/types/interface.d.ts +1 -1
- package/dist/v3/utils/ManualAbortError.d.ts +3 -0
- package/dist/v3/utils/ManualAbortError.js +14 -0
- package/dist/v3/utils/compare.d.ts +4 -0
- package/dist/v3/utils/compare.js +6 -0
- package/dist/v3/utils/helper.d.ts +6 -0
- package/dist/v3/utils/helper.js +43 -0
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
- package/package.json +2 -2
- package/dist/v2/Demo/Demo.d.ts +0 -3
- package/dist/v2/Demo/Demo.js +0 -1634
- package/dist/v2/api/googleConnection.d.ts +0 -5
- package/dist/v2/api/googleConnection.js +0 -51
- package/dist/v2/components/AmapLoader/AmapLoader.d.ts +0 -5
- package/dist/v2/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v2/components/AmapLoader/index.d.ts +0 -1
- package/dist/v2/components/AmapLoader/index.js +0 -4
- package/dist/v2/components/GmapLoader/GmapLoader.d.ts +0 -5
- package/dist/v2/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v2/components/GmapLoader/index.d.ts +0 -1
- package/dist/v2/components/GmapLoader/index.js +0 -4
- package/dist/v2/css/Loading-523061b9.css +0 -9
- package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v2/hooks/useGoogleConnection.js +0 -15
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +0 -7
- package/dist/v3/Demo/Demo.d.ts +0 -9
- package/dist/v3/Demo/Demo.js +0 -1612
- package/dist/v3/api/googleConnection.d.ts +0 -5
- package/dist/v3/api/googleConnection.js +0 -51
- package/dist/v3/components/AmapLoader/AmapLoader.d.ts +0 -10
- package/dist/v3/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v3/components/AmapLoader/index.d.ts +0 -1
- package/dist/v3/components/AmapLoader/index.js +0 -4
- package/dist/v3/components/GmapLoader/GmapLoader.d.ts +0 -10
- package/dist/v3/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v3/components/GmapLoader/index.d.ts +0 -1
- package/dist/v3/components/GmapLoader/index.js +0 -4
- package/dist/v3/css/Loading-523061b9.css +0 -9
- package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v3/hooks/useGoogleConnection.js +0 -15
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +0 -7
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useHeycarMap } from "../hooks/useHeycarMap.js";
|
|
3
|
-
import { useMapFitView } from "../hooks/useMapFitView.js";
|
|
1
|
+
import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
|
|
4
2
|
const useBusinessTaxiServiceMap = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
const { googleConnectionStatus } = useGoogleConnection();
|
|
11
|
-
return { googleConnectionStatus, setMap, registerFitVeiw, setFitView };
|
|
3
|
+
const mapContext = {
|
|
4
|
+
setFitView: assertAssingedBeforeUsed
|
|
5
|
+
};
|
|
6
|
+
return { mapContext, ...proxyFunctionalProperty(mapContext) };
|
|
12
7
|
};
|
|
13
8
|
export {
|
|
14
9
|
useBusinessTaxiServiceMap
|
package/dist/v3/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import "./utils/alipayPolyfill.js";
|
|
|
2
2
|
import { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
3
3
|
import { AddressBox } from "./business-components/AddressBox/AddressBox.js";
|
|
4
4
|
import { BusinessQuotingMap } from "./business-components/BusinessQuotingMap/BusinessQuotingMap.js";
|
|
5
|
-
import { B } from "./chunks/BusinessRecomendPlaceMap.
|
|
5
|
+
import { B } from "./chunks/BusinessRecomendPlaceMap.6ba5dbb1.js";
|
|
6
6
|
import { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js";
|
|
7
7
|
import { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
|
|
8
8
|
import { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js";
|
|
@@ -93,7 +93,7 @@ export declare enum CenterPlaceStatus {
|
|
|
93
93
|
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
94
94
|
OK = "OK"
|
|
95
95
|
}
|
|
96
|
-
export type
|
|
96
|
+
export type ConnectionStatus = "pending" | "connected" | "unconnected";
|
|
97
97
|
export interface BusinessGeolocationPositionError extends GeolocationPositionError {
|
|
98
98
|
isBusinessTimeout: boolean;
|
|
99
99
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const MANUAL_ABORT_MESSAGE = "MANUAL_ABORT_MESSAGE";
|
|
2
|
+
const throwNoneManualAbortError = (e) => {
|
|
3
|
+
if (e !== MANUAL_ABORT_MESSAGE)
|
|
4
|
+
throw e;
|
|
5
|
+
};
|
|
6
|
+
const logNoneManualAbortError = (e) => {
|
|
7
|
+
if (e !== MANUAL_ABORT_MESSAGE)
|
|
8
|
+
console.error(e);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
MANUAL_ABORT_MESSAGE,
|
|
12
|
+
logNoneManualAbortError,
|
|
13
|
+
throwNoneManualAbortError
|
|
14
|
+
};
|
|
@@ -19,4 +19,8 @@ export declare function watchPostEffectForAMapEvent<T extends AMap.Event, P, E e
|
|
|
19
19
|
export declare function watchPostEffectForGMapEvent<T extends google.maps.MVCObject | google.maps.marker.AdvancedMarkerElement, P>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, string>[]): void;
|
|
20
20
|
export declare const watchPostEffectOnce: (callback: WatchCallback) => void;
|
|
21
21
|
export declare const computedByDeps: <T>(deps: (() => unknown)[] | (() => unknown), computedFn: () => T) => ComputedRef<T>;
|
|
22
|
+
type EventNameRestrict<P, N extends keyof P = keyof P> = N extends `on${infer UE}` ? Uncapitalize<UE> : never;
|
|
23
|
+
export declare function generateCreateElementV2PropsOn<P>(props: P, emit: EmitFn<EmitByProps<P>>, eventNames: EventNameRestrict<P>[]): {
|
|
24
|
+
[k: string]: (value: any) => void;
|
|
25
|
+
};
|
|
22
26
|
export {};
|
package/dist/v3/utils/compare.js
CHANGED
|
@@ -371,10 +371,16 @@ const computedByDeps = (deps, computedFn) => {
|
|
|
371
371
|
return result;
|
|
372
372
|
});
|
|
373
373
|
};
|
|
374
|
+
function generateCreateElementV2PropsOn(props, emit, eventNames) {
|
|
375
|
+
return Object.fromEntries(
|
|
376
|
+
eventNames.map((name) => [name, (value) => emit(name, value)])
|
|
377
|
+
);
|
|
378
|
+
}
|
|
374
379
|
export {
|
|
375
380
|
computedByDeps,
|
|
376
381
|
createDeepCompareMemoize,
|
|
377
382
|
deepCompareEqualsForMaps,
|
|
383
|
+
generateCreateElementV2PropsOn,
|
|
378
384
|
watchEffectForDeepOption,
|
|
379
385
|
watchNoneImmediatePostEffectForDeepOption,
|
|
380
386
|
watchNoneImmediatePostEffectForMapProperty,
|
|
@@ -22,6 +22,7 @@ export declare const pausableSleep: (milliSeconds: number) => {
|
|
|
22
22
|
restart: () => void;
|
|
23
23
|
};
|
|
24
24
|
export declare const createRunOnce: <P extends any[], R>(fn: (...args: P) => R) => (...args: P) => R;
|
|
25
|
+
export declare const createOneConcurrent: <P extends any[], R>(fn: (...args: P) => Promise<R>) => (...args: P) => Promise<R> | undefined;
|
|
25
26
|
export declare const createReadOnce: <T>(value: T) => () => T | undefined;
|
|
26
27
|
export declare const createAsyncNoFailNonNullable: <P extends any[], R>(fn: (...args: P) => Promise<R>, defaultValue: NonNullable<R>) => (...args: P) => Promise<NonNullable<R>>;
|
|
27
28
|
export declare const pipeTimeout: <P extends any[], R>(fn: (...args: P) => Promise<R>, defaultValue: R, timeout: number) => (...args: P) => Promise<R>;
|
|
@@ -29,4 +30,9 @@ export declare const retryUntilSuccess: <P extends any[], R>(fn: (...args: P) =>
|
|
|
29
30
|
export declare const equalAssign: <T extends {
|
|
30
31
|
[k: string]: any;
|
|
31
32
|
}>(base: T, target: T) => T;
|
|
33
|
+
export declare const assertAssingedBeforeUsed: () => never;
|
|
34
|
+
type PickFunctionalPropertyName<T, K extends keyof T = keyof T> = K extends any ? T[K] extends (...args: any) => any ? K : never : never;
|
|
35
|
+
type PickFunctionalProperty<T> = Pick<T, PickFunctionalPropertyName<T>>;
|
|
36
|
+
export declare const proxyFunctionalProperty: <T extends object>(target: T) => PickFunctionalProperty<T>;
|
|
37
|
+
export declare const createAbortable: (signal?: AbortSignal) => <F extends ((...args: any) => Promise<any>) | undefined>(fn: F) => F;
|
|
32
38
|
export {};
|
package/dist/v3/utils/helper.js
CHANGED
|
@@ -93,6 +93,17 @@ const createRunOnce = (fn) => {
|
|
|
93
93
|
return result;
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
+
const createOneConcurrent = (fn) => {
|
|
97
|
+
let isRunning = false;
|
|
98
|
+
return function runOneConcurrent(...args) {
|
|
99
|
+
if (isRunning)
|
|
100
|
+
return;
|
|
101
|
+
isRunning = true;
|
|
102
|
+
const result = fn(...args);
|
|
103
|
+
result.finally(() => isRunning = false);
|
|
104
|
+
return result;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
96
107
|
const createReadOnce = (value) => {
|
|
97
108
|
let isRead = false;
|
|
98
109
|
return function read() {
|
|
@@ -135,12 +146,43 @@ const equalAssign = (base, target) => {
|
|
|
135
146
|
}
|
|
136
147
|
return base;
|
|
137
148
|
};
|
|
149
|
+
const assertAssingedBeforeUsed = () => {
|
|
150
|
+
throw Error("MyError: used before assigned");
|
|
151
|
+
};
|
|
152
|
+
const proxyFunctionalProperty = (target) => {
|
|
153
|
+
const result = {};
|
|
154
|
+
for (const key of Object.keys(target)) {
|
|
155
|
+
if (typeof target[key] !== "function")
|
|
156
|
+
continue;
|
|
157
|
+
result[key] = (...args) => target[key](...args);
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
};
|
|
161
|
+
const createAbortable = (signal) => {
|
|
162
|
+
return function abortable(fn) {
|
|
163
|
+
if (!fn || !signal)
|
|
164
|
+
return fn;
|
|
165
|
+
return function abrotableFn(...args) {
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
if (signal.aborted)
|
|
168
|
+
return reject(signal.reason);
|
|
169
|
+
signal.addEventListener("abort", () => reject(signal.reason));
|
|
170
|
+
fn(...args).then((result) => {
|
|
171
|
+
signal.aborted ? reject(signal.reason) : resolve(result);
|
|
172
|
+
}, reject);
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
138
177
|
export {
|
|
139
178
|
assertAngle,
|
|
179
|
+
assertAssingedBeforeUsed,
|
|
140
180
|
assertNotEmptyArray,
|
|
141
181
|
assertPoint,
|
|
142
182
|
assertZone,
|
|
183
|
+
createAbortable,
|
|
143
184
|
createAsyncNoFailNonNullable,
|
|
185
|
+
createOneConcurrent,
|
|
144
186
|
createReadOnce,
|
|
145
187
|
createRunOnce,
|
|
146
188
|
defered,
|
|
@@ -149,6 +191,7 @@ export {
|
|
|
149
191
|
isPlacesInclude,
|
|
150
192
|
pausableSleep,
|
|
151
193
|
pipeTimeout,
|
|
194
|
+
proxyFunctionalProperty,
|
|
152
195
|
resettableSleep,
|
|
153
196
|
retryUntilSuccess,
|
|
154
197
|
sleep
|
package/dist/v3/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "
|
|
3
|
+
const pkgVersion = "2.0.0-switchMap10";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const patchGoogleMapLoader = (loader) => {
|
|
2
|
+
loader.setScript = setScript;
|
|
3
|
+
};
|
|
4
|
+
function setScript() {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if (document.getElementById(this.id)) {
|
|
7
|
+
this.callback();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const params = {
|
|
11
|
+
key: this.apiKey,
|
|
12
|
+
channel: this.channel,
|
|
13
|
+
client: this.client,
|
|
14
|
+
libraries: this.libraries.length && this.libraries,
|
|
15
|
+
v: this.version,
|
|
16
|
+
mapIds: this.mapIds,
|
|
17
|
+
language: this.language,
|
|
18
|
+
region: this.region,
|
|
19
|
+
authReferrerPolicy: this.authReferrerPolicy
|
|
20
|
+
};
|
|
21
|
+
Object.keys(params).forEach((key) => !params[key] && delete params[key]);
|
|
22
|
+
if (!((_b = (_a = window == null ? void 0 : window.google) == null ? void 0 : _a.maps) == null ? void 0 : _b.importLibrary)) {
|
|
23
|
+
((g) => {
|
|
24
|
+
let h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
|
|
25
|
+
b = b[c] || (b[c] = {});
|
|
26
|
+
const d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => (
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
h || (h = new Promise(async (f, n) => {
|
|
29
|
+
var _a2;
|
|
30
|
+
await (a = m.createElement("script"));
|
|
31
|
+
a.id = this.id;
|
|
32
|
+
e.set("libraries", [...r] + "");
|
|
33
|
+
for (k in g)
|
|
34
|
+
e.set(
|
|
35
|
+
k.replace(/[A-Z]/g, (t) => "_" + t[0].toLowerCase()),
|
|
36
|
+
g[k]
|
|
37
|
+
);
|
|
38
|
+
e.set("callback", c + ".maps." + q);
|
|
39
|
+
e.set("t", Date.now().toString());
|
|
40
|
+
a.src = this.url + `?` + e;
|
|
41
|
+
d[q] = f;
|
|
42
|
+
a.onerror = () => h = n(Error(p + " could not load."));
|
|
43
|
+
a.nonce = this.nonce || ((_a2 = m.querySelector("script[nonce]")) == null ? void 0 : _a2.nonce) || "";
|
|
44
|
+
m.head.append(a);
|
|
45
|
+
}))
|
|
46
|
+
);
|
|
47
|
+
d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
|
|
48
|
+
})(params);
|
|
49
|
+
}
|
|
50
|
+
const libraryPromises = this.libraries.map((library) => this.importLibrary(library));
|
|
51
|
+
if (!libraryPromises.length) {
|
|
52
|
+
libraryPromises.push(this.importLibrary("core"));
|
|
53
|
+
}
|
|
54
|
+
Promise.all(libraryPromises).then(
|
|
55
|
+
() => this.callback(),
|
|
56
|
+
(error) => {
|
|
57
|
+
const event = new ErrorEvent("error", { error });
|
|
58
|
+
this.loadErrorCallback(event);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
patchGoogleMapLoader
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heycar/heycars-map",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-switchMap10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"checkVersion": "./bin/checkVersion.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
39
39
|
"@amap/amap-jsapi-types": "^0.0.13",
|
|
40
|
-
"@googlemaps/js-api-loader": "
|
|
40
|
+
"@googlemaps/js-api-loader": "1.16.6",
|
|
41
41
|
"@googlemaps/typescript-guards": "^2.0.3",
|
|
42
42
|
"@types/google.maps": "^3.54.10",
|
|
43
43
|
"@types/lodash-es": "^4.17.6",
|
package/dist/v2/Demo/Demo.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const DemoGmap: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<unknown>, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").EmitByProps<unknown, Required<unknown>>, never, unknown>;
|
|
2
|
-
export declare const DemoAmap: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<unknown>, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").EmitByProps<unknown, Required<unknown>>, never, unknown>;
|
|
3
|
-
export declare const DemoChina: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<unknown>, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").EmitByProps<unknown, Required<unknown>>, never, unknown>;
|