@heycar/heycars-map 2.0.0-switchMap1 → 2.0.0-switchMap2

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.
Files changed (60) hide show
  1. package/README.md +43 -29
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/v2/App.js +5 -3
  5. package/dist/v2/Demo/DemoBusinessQuoting.js +3 -2
  6. package/dist/v2/api/cdn.d.ts +1 -0
  7. package/dist/v2/api/cdn.js +2 -0
  8. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
  9. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  10. package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.da68a2a6.js} +31 -1
  11. package/dist/v2/chunks/throttle.8bdd8d3b.js +20 -0
  12. package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
  13. package/dist/v2/components/Loading/Loading.d.ts +6 -0
  14. package/dist/v2/components/Loading/Loading.js +3 -1
  15. package/dist/v2/components/Loading/index.js +2 -1
  16. package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
  17. package/dist/v2/components/MapProvider/MapProvider.js +16 -9
  18. package/dist/v2/css/Loading-0e058b68.css +51 -0
  19. package/dist/v2/hooks/useDeviceOrientation.js +1 -17
  20. package/dist/v2/hooks/useMapGCJ02.js +1 -3
  21. package/dist/v2/hooks/useMapGraspRoad.js +1 -2
  22. package/dist/v2/hooks/useMapInChina.d.ts +3 -15
  23. package/dist/v2/hooks/useMapInChina.js +11 -16
  24. package/dist/v2/hooks/useMapLoader.d.ts +10 -6
  25. package/dist/v2/hooks/useMapLoader.js +85 -59
  26. package/dist/v2/hooks/useMapPlace.js +1 -2
  27. package/dist/v2/hooks/useMapSupplier.d.ts +2 -0
  28. package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +2 -0
  29. package/dist/v2/hooks-business/useBusinessQuotingMap.js +7 -2
  30. package/dist/v2/utils/log.js +1 -1
  31. package/dist/v3/App.js +5 -3
  32. package/dist/v3/Demo/DemoBusinessQuoting.js +4 -3
  33. package/dist/v3/api/cdn.d.ts +1 -0
  34. package/dist/v3/api/cdn.js +2 -0
  35. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
  36. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  37. package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.98d687c0.js} +27 -1
  38. package/dist/v3/chunks/throttle.8bdd8d3b.js +20 -0
  39. package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
  40. package/dist/v3/components/Loading/Loading.d.ts +8 -0
  41. package/dist/v3/components/Loading/Loading.js +3 -1
  42. package/dist/v3/components/Loading/index.js +2 -1
  43. package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
  44. package/dist/v3/components/MapProvider/MapProvider.js +14 -9
  45. package/dist/v3/css/Loading-0e058b68.css +51 -0
  46. package/dist/v3/hooks/useDeviceOrientation.js +1 -17
  47. package/dist/v3/hooks/useMapGCJ02.js +1 -3
  48. package/dist/v3/hooks/useMapGraspRoad.js +1 -2
  49. package/dist/v3/hooks/useMapInChina.d.ts +3 -15
  50. package/dist/v3/hooks/useMapInChina.js +11 -16
  51. package/dist/v3/hooks/useMapLoader.d.ts +10 -6
  52. package/dist/v3/hooks/useMapLoader.js +85 -59
  53. package/dist/v3/hooks/useMapPlace.js +1 -2
  54. package/dist/v3/hooks/useMapSupplier.d.ts +2 -0
  55. package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +2 -0
  56. package/dist/v3/hooks-business/useBusinessQuotingMap.js +7 -2
  57. package/dist/v3/utils/log.js +1 -1
  58. package/package.json +1 -1
  59. package/dist/v2/css/Loading-523061b9.css +0 -9
  60. package/dist/v3/css/Loading-523061b9.css +0 -9
@@ -0,0 +1,51 @@
1
+ ._17ify490 {
2
+ position: relative;
3
+ background-color: #EDF1F5;
4
+ }
5
+ ._17ify491 {
6
+ width: 100%;
7
+ height: 100%;
8
+ object-fit: cover;
9
+ }
10
+ ._17ify492 {
11
+ position: absolute;
12
+ margin: auto;
13
+ top: 0;
14
+ left: 0;
15
+ right: 0;
16
+ bottom: 0;
17
+ width: fit-content;
18
+ height: fit-content;
19
+ }
20
+ ._17ify493 {
21
+ width: 40.8vw;
22
+ height: 24.53vw;
23
+ }
24
+ ._17ify494 {
25
+ position: absolute;
26
+ top: 100%;
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ width: max-content;
31
+ left: 50%;
32
+ transform: translate(-50%, 0);
33
+ }
34
+ ._17ify495 {
35
+ margin-top: 1.6vw;
36
+ font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
37
+ font-weight: 500;
38
+ font-size: 4vw;
39
+ color: #1E1E1E;
40
+ line-height: 6.4vw;
41
+ }
42
+ ._17ify496 {
43
+ margin-top: 1.6vw;
44
+ font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
45
+ font-weight: 400;
46
+ font-size: 3.73vw;
47
+ color: #999BA1;
48
+ line-height: 6.4vw;
49
+ white-space: pre-line;
50
+ text-align: center;
51
+ }
@@ -1,23 +1,7 @@
1
1
  import { reactive, watch } from "vue-demi";
2
2
  import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT } from "../utils/patchMiniprogram.js";
3
3
  import { OS_PLATFORM, detectOSPlatform } from "../utils/platform.js";
4
- import { i as isObject, d as debounce } from "../chunks/debounce.5afe7867.js";
5
- var FUNC_ERROR_TEXT = "Expected a function";
6
- function throttle(func, wait, options) {
7
- var leading = true, trailing = true;
8
- if (typeof func != "function") {
9
- throw new TypeError(FUNC_ERROR_TEXT);
10
- }
11
- if (isObject(options)) {
12
- leading = "leading" in options ? !!options.leading : leading;
13
- trailing = "trailing" in options ? !!options.trailing : trailing;
14
- }
15
- return debounce(func, wait, {
16
- "leading": leading,
17
- "maxWait": wait,
18
- "trailing": trailing
19
- });
20
- }
4
+ import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
21
5
  const DEVICE_ORIENTATION_INTERVAL = 200;
22
6
  const CSS_DEVICE_ORIENTATION_VAR_PREFIX = "--CSS_DEVICE_ORIENTATION_VAR_ROTATION_DEGREE_";
23
7
  const useDeviceOrientation = (props) => {
@@ -1,6 +1,6 @@
1
1
  import { AMAP_TO_GCJ02_TIMEOUT } from "../api/contants.js";
2
2
  import { lnglat2point } from "../utils/transform.js";
3
- import { useMapInChina } from "./useMapInChina.js";
3
+ import { inChina, inHongkong, inMacau } from "./useMapInChina.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
5
5
  /**
6
6
  * @preserve
@@ -515,7 +515,6 @@ const exported = Object.assign(Object.assign({}, CRSTypes), {
515
515
  });
516
516
  const useAmapGCJ02 = () => {
517
517
  const { readyPromise } = useMapSupplier();
518
- const { inChina } = useMapInChina();
519
518
  const toCoordinateType = (p) => {
520
519
  return inChina(p) ? "gcj02" : "wgs84";
521
520
  };
@@ -567,7 +566,6 @@ const useAmapGCJ02 = () => {
567
566
  };
568
567
  const useGmapGCJ02 = () => {
569
568
  const { readyPromise } = useMapSupplier();
570
- const { inChina, inHongkong, inMacau } = useMapInChina();
571
569
  const toCoordinateType = (p) => {
572
570
  return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
573
571
  };
@@ -3,7 +3,7 @@ import { apiGoogleSnapRoad } from "../api/googleSnapRoad.js";
3
3
  import { watchEffectForDeepOption } from "../utils/compare.js";
4
4
  import { lnglat2point, trackPoints2amapGraspRoadPoints } from "../utils/transform.js";
5
5
  import { useMapAngle } from "./useMapAngle.js";
6
- import { useMapInChina } from "./useMapInChina.js";
6
+ import { inChina } from "./useMapInChina.js";
7
7
  import { useMapSupplier } from "./useMapSupplier.js";
8
8
  const GRASP_ROAD_INPUT_MIN_AMOUNT = 2;
9
9
  const GRASP_ROAD_INPUT_MAX_AMOUNT = 500;
@@ -12,7 +12,6 @@ const useAmapGraspRoad = (props) => {
12
12
  const pathRef = ref([]);
13
13
  const angleRef = ref(0);
14
14
  const { apiMapComputeHeading } = useMapAngle();
15
- const { inChina } = useMapInChina();
16
15
  const apiMapToGraspRoadPath = (tracks) => {
17
16
  return new Promise((resolve) => {
18
17
  var _a, _b, _c;
@@ -1,16 +1,4 @@
1
1
  import { type Point } from "../types/interface";
2
- export declare const useMapInChina: () => {
3
- inChina: (point: Point) => boolean;
4
- inHongkong: (point: Point) => boolean;
5
- inMacau: (point: Point) => boolean;
6
- };
7
- export declare const useAmapInChina: () => {
8
- inChina: (point: Point) => boolean;
9
- inHongkong: (point: Point) => boolean;
10
- inMacau: (point: Point) => boolean;
11
- };
12
- export declare const useGmapInChina: () => {
13
- inChina: (point: Point) => boolean;
14
- inHongkong: (point: Point) => boolean;
15
- inMacau: (point: Point) => boolean;
16
- };
2
+ export declare const inChina: (point: Point) => boolean;
3
+ export declare const inHongkong: (point: Point) => boolean;
4
+ export declare const inMacau: (point: Point) => boolean;
@@ -2593,22 +2593,17 @@ const macauBounds = [
2593
2593
  22.19885
2594
2594
  ]
2595
2595
  ];
2596
- const useMapInChina = () => {
2597
- const inChina = (point) => {
2598
- return pointInPolygon(point, chinaBounds) >= 0;
2599
- };
2600
- const inHongkong = (point) => {
2601
- return pointInPolygon(point, hongkongBounds) >= 0;
2602
- };
2603
- const inMacau = (point) => {
2604
- return pointInPolygon(point, macauBounds) >= 0;
2605
- };
2606
- return { inChina, inHongkong, inMacau };
2596
+ const inChina = (point) => {
2597
+ return pointInPolygon(point, chinaBounds) >= 0;
2598
+ };
2599
+ const inHongkong = (point) => {
2600
+ return pointInPolygon(point, hongkongBounds) >= 0;
2601
+ };
2602
+ const inMacau = (point) => {
2603
+ return pointInPolygon(point, macauBounds) >= 0;
2607
2604
  };
2608
- const useAmapInChina = useMapInChina;
2609
- const useGmapInChina = useMapInChina;
2610
2605
  export {
2611
- useAmapInChina,
2612
- useGmapInChina,
2613
- useMapInChina
2606
+ inChina,
2607
+ inHongkong,
2608
+ inMacau
2614
2609
  };
@@ -7,6 +7,7 @@ export declare const DEFAULT_AMAP_PLUGINS: AmapLoaderProps["plugins"];
7
7
  export declare const DEFAULT_GMAP_LIBRARIES: LoaderOptions["libraries"];
8
8
  export declare enum Status {
9
9
  LOADING = "LOADING",
10
+ TIMEOUT = "TIMEOUT",
10
11
  FAILURE = "FAILURE",
11
12
  SUCCESS = "SUCCESS"
12
13
  }
@@ -19,7 +20,7 @@ declare global {
19
20
  };
20
21
  }
21
22
  }
22
- export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loading" | "onChange">, Omit<AMapLoaderOptions, "key" | "version" | "plugins"> {
23
+ export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loading" | "onSuccess" | "onFail">, Omit<AMapLoaderOptions, "key" | "version" | "plugins"> {
23
24
  apiKey: string;
24
25
  apiSecret?: string;
25
26
  apiServiceHost?: string;
@@ -42,11 +43,13 @@ export interface GmapLoaderProps extends LoaderOptions {
42
43
  */
43
44
  fallback?: () => VNodeChild;
44
45
  /**
45
- * Callback prop used to access `@googlemaps/js-api-loader` and `Status`.
46
- *
47
- * Note: The callback be executed multiple times in the lifecycle of the component.
46
+ * 成功回调只会触发一次
48
47
  */
49
- onChange?: (status: Status) => void;
48
+ onSuccess?: () => void;
49
+ /**
50
+ * 失败回调可能会触发多次
51
+ */
52
+ onFail?: () => void;
50
53
  }
51
54
  export declare const useGmapLoader: (props: GmapLoaderProps) => {
52
55
  statusRef: import("vue-demi").ShallowRef<Status>;
@@ -64,7 +67,8 @@ export interface UseMapLoaderProps {
64
67
  amapServiceHost?: string;
65
68
  supplier: MapSupplier;
66
69
  language: Language;
67
- onChange?: (status: Status) => any;
70
+ onSuccess?: () => void;
71
+ onFail?: () => void;
68
72
  }
69
73
  export declare const useMapLoader: (props: UseMapLoaderProps) => UseMapLoaderOutput;
70
74
  export {};
@@ -1,6 +1,7 @@
1
- import { shallowRef, computed } from "vue-demi";
1
+ import { shallowRef, computed, ref } from "vue-demi";
2
2
  import { watchPostEffectForDeepOption } from "../utils/compare.js";
3
3
  import { createRunOnce } from "../utils/helper.js";
4
+ import { t as throttle } from "../chunks/throttle.8bdd8d3b.js";
4
5
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
5
6
  var distExports = {};
6
7
  var dist = {
@@ -537,6 +538,8 @@ class Loader {
537
538
  }
538
539
  }
539
540
  }
541
+ const MIN_MAP_RELOAD_INTERVAL = 5e3;
542
+ const GMAP_LOAD_TIMEOUT = 1e4;
540
543
  const DEFAULT_AMAP_PLUGINS = [
541
544
  "AMap.Geocoder",
542
545
  "AMap.Driving",
@@ -546,12 +549,13 @@ const DEFAULT_AMAP_PLUGINS = [
546
549
  const DEFAULT_GMAP_LIBRARIES = ["marker", "geometry"];
547
550
  var Status = /* @__PURE__ */ ((Status2) => {
548
551
  Status2["LOADING"] = "LOADING";
552
+ Status2["TIMEOUT"] = "TIMEOUT";
549
553
  Status2["FAILURE"] = "FAILURE";
550
554
  Status2["SUCCESS"] = "SUCCESS";
551
555
  return Status2;
552
556
  })(Status || {});
553
557
  const useAmapLoader = (props) => {
554
- const { disableRef, onChange } = props;
558
+ const { disableRef, onSuccess, onFail } = props;
555
559
  let resolveLoader;
556
560
  let rejectLoader;
557
561
  const readyPromise = new Promise((resolve, reject) => {
@@ -563,49 +567,58 @@ const useAmapLoader = (props) => {
563
567
  /* LOADING */
564
568
  );
565
569
  const optionsRef = computed(() => {
566
- const { onChange: onChange2, loading, fallback, apiKey, apiSecret, apiServiceHost, version, ...options } = props;
570
+ const {
571
+ onSuccess: onSuccess2,
572
+ onFail: onFail2,
573
+ loading,
574
+ fallback,
575
+ apiKey,
576
+ apiSecret,
577
+ apiServiceHost,
578
+ version,
579
+ ...options
580
+ } = props;
567
581
  return { ...options, key: apiKey, version: version != null ? version : "2.0" };
568
582
  });
583
+ const defineSecurityOnce = createRunOnce(() => {
584
+ window._AMapSecurityConfig = props.apiServiceHost ? {
585
+ serviceHost: props.apiServiceHost
586
+ } : { securityJsCode: props.apiSecret };
587
+ });
588
+ const reload = throttle(
589
+ (options) => {
590
+ if (statusRef.value === "SUCCESS")
591
+ return;
592
+ statusRef.value = "LOADING";
593
+ defineSecurityOnce();
594
+ return distExports.load(options).then(
595
+ () => {
596
+ statusRef.value = "SUCCESS";
597
+ resolveLoader();
598
+ onSuccess == null ? void 0 : onSuccess();
599
+ },
600
+ () => {
601
+ statusRef.value = "FAILURE";
602
+ rejectLoader();
603
+ onFail == null ? void 0 : onFail();
604
+ }
605
+ );
606
+ },
607
+ MIN_MAP_RELOAD_INTERVAL,
608
+ { trailing: false }
609
+ );
569
610
  watchPostEffectForDeepOption(
570
611
  () => [optionsRef.value, disableRef == null ? void 0 : disableRef.value],
571
612
  ([options, disable]) => {
572
613
  if (disable)
573
614
  return;
574
- const setStatusAndExecuteCallback = (status) => {
575
- statusRef.value = status;
576
- if (status === "SUCCESS")
577
- resolveLoader();
578
- if (status === "FAILURE")
579
- rejectLoader();
580
- onChange == null ? void 0 : onChange(statusRef.value);
581
- };
582
- setStatusAndExecuteCallback(
583
- "LOADING"
584
- /* LOADING */
585
- );
586
- window._AMapSecurityConfig = props.apiServiceHost ? {
587
- serviceHost: props.apiServiceHost
588
- } : { securityJsCode: props.apiSecret };
589
- distExports.load(options).then(
590
- () => setStatusAndExecuteCallback(
591
- "SUCCESS"
592
- /* SUCCESS */
593
- ),
594
- () => setStatusAndExecuteCallback(
595
- "FAILURE"
596
- /* FAILURE */
597
- )
598
- );
615
+ reload(options);
599
616
  }
600
617
  );
601
618
  return { statusRef, readyPromise };
602
619
  };
603
- const loadGmapOnce = createRunOnce((opts) => {
604
- const loader = new Loader(opts);
605
- return loader.load();
606
- });
607
620
  const useGmapLoader = (props) => {
608
- const { disableRef, onChange } = props;
621
+ const { disableRef, onSuccess, onFail } = props;
609
622
  let resolveLoader;
610
623
  let rejectLoader;
611
624
  const readyPromise = new Promise((resolve, reject) => {
@@ -617,50 +630,62 @@ const useGmapLoader = (props) => {
617
630
  /* LOADING */
618
631
  );
619
632
  const optionsRef = computed(() => {
620
- const { onChange: onChange2, fallback, loading, language, ...options } = props;
633
+ const { onSuccess: onSuccess2, onFail: onFail2, fallback, loading, language, ...options } = props;
621
634
  return options;
622
635
  });
636
+ const timerRef = ref();
637
+ const reload = throttle(
638
+ (options) => {
639
+ if (statusRef.value === "SUCCESS")
640
+ return;
641
+ const loader = new Loader(options);
642
+ clearTimeout(timerRef.value);
643
+ timerRef.value = window.setTimeout(() => {
644
+ statusRef.value = "TIMEOUT";
645
+ }, GMAP_LOAD_TIMEOUT);
646
+ if (loader.status !== LoaderStatus.INITIALIZED) {
647
+ loader.reset();
648
+ }
649
+ statusRef.value = "LOADING";
650
+ return loader.load().then(
651
+ () => {
652
+ clearTimeout(timerRef.value);
653
+ statusRef.value = "SUCCESS";
654
+ resolveLoader();
655
+ onSuccess == null ? void 0 : onSuccess();
656
+ },
657
+ () => {
658
+ clearTimeout(timerRef.value);
659
+ statusRef.value = "FAILURE";
660
+ rejectLoader();
661
+ onFail == null ? void 0 : onFail();
662
+ }
663
+ );
664
+ },
665
+ MIN_MAP_RELOAD_INTERVAL,
666
+ { trailing: false }
667
+ );
623
668
  watchPostEffectForDeepOption(
624
669
  () => [optionsRef.value, disableRef == null ? void 0 : disableRef.value],
625
670
  ([options, disable]) => {
626
671
  if (disable)
627
672
  return;
628
673
  const language = navigator.language;
629
- const setStatusAndExecuteCallback = (status) => {
630
- statusRef.value = status;
631
- if (status === "SUCCESS")
632
- resolveLoader();
633
- if (status === "FAILURE")
634
- rejectLoader();
635
- onChange == null ? void 0 : onChange(statusRef.value);
636
- };
637
- setStatusAndExecuteCallback(
638
- "LOADING"
639
- /* LOADING */
640
- );
641
- loadGmapOnce({ ...options, language }).then(
642
- () => setStatusAndExecuteCallback(
643
- "SUCCESS"
644
- /* SUCCESS */
645
- ),
646
- () => setStatusAndExecuteCallback(
647
- "FAILURE"
648
- /* FAILURE */
649
- )
650
- );
674
+ reload({ ...options, language });
651
675
  }
652
676
  );
653
677
  return { statusRef, readyPromise };
654
678
  };
655
679
  const useMapLoader = (props) => {
656
- const { gmapKey, amapKey, amapSecret, amapServiceHost, language, onChange } = props;
680
+ const { gmapKey, amapKey, amapSecret, amapServiceHost, language, onSuccess, onFail } = props;
657
681
  const { statusRef: amapStatusRef, readyPromise: amapReadyPromise } = useAmapLoader({
658
682
  apiKey: amapKey,
659
683
  apiSecret: amapSecret,
660
684
  apiServiceHost: amapServiceHost,
661
685
  plugins: DEFAULT_AMAP_PLUGINS,
662
686
  disableRef: computed(() => props.supplier !== "amap"),
663
- onChange
687
+ onSuccess,
688
+ onFail
664
689
  });
665
690
  const { statusRef: gmapStatusRef, readyPromise: gmapReadyPromise } = useGmapLoader({
666
691
  apiKey: gmapKey,
@@ -670,7 +695,8 @@ const useMapLoader = (props) => {
670
695
  // region: "CN",
671
696
  libraries: DEFAULT_GMAP_LIBRARIES,
672
697
  disableRef: computed(() => props.supplier !== "gmap"),
673
- onChange
698
+ onSuccess,
699
+ onFail
674
700
  });
675
701
  return {
676
702
  get statusRef() {
@@ -3,7 +3,7 @@ import { REGEO_TIMEOUT } from "../api/contants.js";
3
3
  import { createPipeTw } from "../utils/cn2tw.js";
4
4
  import { equalAssign } from "../utils/helper.js";
5
5
  import { amapPlaceName2DisplayName, gmapPlaceName2DisplayName } from "../utils/transform.js";
6
- import { useAmapInChina } from "./useMapInChina.js";
6
+ import { inChina } from "./useMapInChina.js";
7
7
  import { useMapSupplier } from "./useMapSupplier.js";
8
8
  import { useUpdate } from "./useUdate.js";
9
9
  const useAmapPlace = (props) => {
@@ -11,7 +11,6 @@ const useAmapPlace = (props) => {
11
11
  const defaultPoint = [...props.pointRef.value];
12
12
  const pointRef = ref(defaultPoint);
13
13
  const { readyPromise, language } = useMapSupplier();
14
- const { inChina } = useAmapInChina();
15
14
  const place = reactive({
16
15
  lng: pointRef.value[0],
17
16
  lat: pointRef.value[1],
@@ -4,6 +4,8 @@ export interface MapSupplierPayolad extends UseMapLoaderProps {
4
4
  gmapId: string;
5
5
  readyPromise: UseMapLoaderOutput["readyPromise"];
6
6
  status: Status;
7
+ renderLoadFailedTitle?: (status: Status) => string | undefined;
8
+ renderLoadFailedDescription?: (status: Status) => string | undefined;
7
9
  }
8
10
  export declare const useMapSupplier: () => MapSupplierPayolad;
9
11
  export declare const provideMapSupplier: (payload: MapSupplierPayolad) => void;
@@ -1,7 +1,9 @@
1
+ import type { CoordinateType, Point } from "../types/interface";
1
2
  export type BusinessQuotingContext = {
2
3
  setFitView: () => void;
3
4
  };
4
5
  export declare const useBusinessQuotingMap: () => {
5
6
  setFitView: () => void;
6
7
  mapContext: BusinessQuotingContext;
8
+ toAmapCoordinateType: (point: Point) => CoordinateType;
7
9
  };
@@ -1,9 +1,14 @@
1
- import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
1
+ import { inChina } from "../hooks/useMapInChina.js";
2
+ import { proxyFunctionalProperty, assertAssingedBeforeUsed, assertPoint } from "../utils/helper.js";
2
3
  const useBusinessQuotingMap = () => {
3
4
  const mapContext = {
4
5
  setFitView: assertAssingedBeforeUsed
5
6
  };
6
- return { mapContext, ...proxyFunctionalProperty(mapContext) };
7
+ const toAmapCoordinateType = (point) => {
8
+ assertPoint(point);
9
+ return inChina(point) ? "gcj02" : "wgs84";
10
+ };
11
+ return { mapContext, toAmapCoordinateType, ...proxyFunctionalProperty(mapContext) };
7
12
  };
8
13
  export {
9
14
  useBusinessQuotingMap
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.0.0-switchMap1";
3
+ const pkgVersion = "2.0.0-switchMap2";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.0.0-switchMap1",
3
+ "version": "2.0.0-switchMap2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",
@@ -1,9 +0,0 @@
1
- ._17ify490 {
2
- position: relative;
3
- background-color: #EDF1F5;
4
- }
5
- ._17ify491 {
6
- width: 100%;
7
- height: 100%;
8
- object-fit: cover;
9
- }
@@ -1,9 +0,0 @@
1
- ._17ify490 {
2
- position: relative;
3
- background-color: #EDF1F5;
4
- }
5
- ._17ify491 {
6
- width: 100%;
7
- height: 100%;
8
- object-fit: cover;
9
- }