@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
@@ -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/dist/v3/App.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createVNode } from "vue";
2
2
  import { defineComponent, ref } from "vue-demi";
3
- import { DemoBusinessTaxiService } from "./Demo/DemoBusinessTaxiService.js";
3
+ import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCRtkaNSWMOhOXDOUpJK4OVbm5RIstYj-I";
6
6
  const gmapId = "d0af0c05331af64a";
@@ -18,9 +18,11 @@ const App = /* @__PURE__ */ defineComponent({
18
18
  "gmapRasterId": gmapRasterId,
19
19
  "gmapKey": gmapApiKey,
20
20
  "language": "en",
21
- "supplier": supplierRef.value
21
+ "supplier": supplierRef.value,
22
+ "renderLoadFailedTitle": () => supplierRef.value === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败",
23
+ "renderLoadFailedDescription": () => supplierRef.value === "gmap" ? "请确认您的网络能正常访问谷歌地图, \n或切回高德地图" : void 0
22
24
  }, {
23
- default: () => [createVNode(DemoBusinessTaxiService, null, null)]
25
+ default: () => [createVNode(DemoBusinessQuoting, null, null)]
24
26
  });
25
27
  }
26
28
  });
@@ -1,11 +1,12 @@
1
- import { createVNode } from "vue";
1
+ import { createVNode, createTextVNode } from "vue";
2
2
  import { BusinessQuotingMap } from "../business-components/BusinessQuotingMap/BusinessQuotingMap.js";
3
3
  import { useBusinessQuotingMap } from "../hooks-business/useBusinessQuotingMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
6
6
  const DemoBusinessQuoting = defineSetup("DemoBusinessQuoting", function() {
7
7
  const {
8
- mapContext
8
+ mapContext,
9
+ toAmapCoordinateType
9
10
  } = useBusinessQuotingMap();
10
11
  return () => createVNode("div", null, [createVNode(BusinessQuotingMap, {
11
12
  "class": demo,
@@ -32,7 +33,7 @@ const DemoBusinessQuoting = defineSetup("DemoBusinessQuoting", function() {
32
33
  "mapContext": mapContext,
33
34
  "onClickStartPoint": (place) => console.log("点击起点时触发 palce = ", place),
34
35
  "onClickEndPoint": (place) => console.log("点击终点时触发 palce = ", place)
35
- }, null)]);
36
+ }, null), createVNode("div", null, [createTextVNode("经度 103.841974, 纬度 1.311295 在高德地图上的坐标类型是:"), toAmapCoordinateType([103.841974, 1.311295])])]);
36
37
  });
37
38
  export {
38
39
  DemoBusinessQuoting
@@ -5,3 +5,4 @@ export declare const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/he
5
5
  export declare const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
6
6
  export declare const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
7
7
  export declare const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
8
+ export declare const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
@@ -5,12 +5,14 @@ const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/en
5
5
  const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
6
6
  const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
7
7
  const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
8
+ const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
8
9
  export {
9
10
  AMAP_DEFAULT_MARKER_ICON_URL,
10
11
  ICON_DOT_LOADING_URL,
11
12
  ICON_END_POINT_EN_URL,
12
13
  ICON_END_POINT_ZH_TW_URL,
13
14
  ICON_FULL_SCREEN_URL,
15
+ ICON_LOAD_FAILED_URL,
14
16
  ICON_START_POINT_EN_URL,
15
17
  ICON_TAXI_CAR_URL
16
18
  };
@@ -45,7 +45,7 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
45
45
  onClickLocatorText?: AbsoluteAddressBoxProps["onClickText"];
46
46
  onClickLocatorPhoto?: AbsoluteAddressBoxProps["onClickPhoto"];
47
47
  }
48
- export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "geoError" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessRecomendPlaceMapProps, BusinessRecomendPlaceMapProps, import("vue-demi").SlotsType<{
48
+ export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessRecomendPlaceMapProps, BusinessRecomendPlaceMapProps, import("vue-demi").SlotsType<{
49
49
  renderPlacePhoto?: ((place: CoordinatePlace) => string | undefined) | undefined;
50
50
  renderPlaceTag?: PickupPointsProps["renderPlaceTag"];
51
51
  fallback?: (() => import("vue-demi").VNodeChild) | undefined;
@@ -54,7 +54,7 @@ export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineCom
54
54
  } & {
55
55
  default?: import("../../demi-polyfill").Slot | undefined;
56
56
  }>>;
57
- export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "geoError" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessRecomendPlaceMapProps, BusinessRecomendPlaceMapProps, import("vue-demi").SlotsType<{
57
+ export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessRecomendPlaceMapProps, BusinessRecomendPlaceMapProps, import("vue-demi").SlotsType<{
58
58
  renderPlacePhoto?: ((place: CoordinatePlace) => string | undefined) | undefined;
59
59
  renderPlaceTag?: PickupPointsProps["renderPlaceTag"];
60
60
  fallback?: (() => import("vue-demi").VNodeChild) | undefined;
@@ -3,7 +3,7 @@ import { type BusinessRecomendPlaceMapProps } from "../BusinessRecomendPlaceMap"
3
3
  export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "loading" | "fallback" | "log" | "getAvailable" | "getRecomendPlace" | "unavailableTitle" | "emptyTitle" | "queryingTitle" | "recomendDescription" | "disableLocator" | "disableLocatorPhoto" | "mapContext" | "renderPlacePhoto" | "renderPlaceTag" | "onChangeGeoLocation" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocatorText" | "onClickLocatorPhoto"> {
4
4
  defaultPlace?: CoordinatePlace;
5
5
  }
6
- export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "geoError" | "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessReselectPlaceMapProps, BusinessReselectPlaceMapProps, import("vue-demi").SlotsType<{
6
+ export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessReselectPlaceMapProps, BusinessReselectPlaceMapProps, import("vue-demi").SlotsType<{
7
7
  fallback?: (() => import("vue-demi").VNodeChild) | undefined;
8
8
  loading?: (() => import("vue-demi").VNodeChild) | undefined;
9
9
  renderPlaceTag?: ((place: Place) => string | undefined) | undefined;
@@ -11,7 +11,7 @@ export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineCom
11
11
  } & {
12
12
  default?: import("../../demi-polyfill").Slot | undefined;
13
13
  }>>;
14
- export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "geoError" | "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessReselectPlaceMapProps, BusinessReselectPlaceMapProps, import("vue-demi").SlotsType<{
14
+ export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", import("vue-demi").PublicProps, BusinessReselectPlaceMapProps, BusinessReselectPlaceMapProps, import("vue-demi").SlotsType<{
15
15
  fallback?: (() => import("vue-demi").VNodeChild) | undefined;
16
16
  loading?: (() => import("vue-demi").VNodeChild) | undefined;
17
17
  renderPlaceTag?: ((place: Place) => string | undefined) | undefined;
@@ -1,11 +1,17 @@
1
- import "../css/Loading-523061b9.css";
1
+ import "../css/Loading-0e058b68.css";
2
2
  import { createVNode } from "vue";
3
+ import { ICON_LOAD_FAILED_URL } from "../api/cdn.js";
3
4
  import { AbsoluteAddressBox } from "../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
4
5
  import { defineSetup } from "../types/helper.js";
5
6
  const imgGrid = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzg1IiBoZWlnaHQ9IjgxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBzdHJva2U9IiNEOERCRTIiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLWRhc2hhcnJheT0iMSI+PHBhdGggZD0iTS41IDgxN1YwTTI0LjUgODE3VjBNNDguNSA4MTdWME03Mi41IDgxN1YwTTk2LjUgODE3VjBNMTIwLjUgODE3VjBNMTQ0LjUgODE3VjBNMTY4LjUgODE3VjBNMTkyLjUgODE3VjBNMjE2LjUgODE3VjBNMjQwLjUgODE3VjBNMjY0LjUgODE3VjBNMjg4LjUgODE3VjBNMzEyLjUgODE3VjBNMzM2LjUgODE3VjBNMzYwLjUgODE3VjBNMzg0LjUgODE3VjBNMCAuNWgzODVNMCAyNC41aDM4NU0wIDQ4LjVoMzg1TTAgNzIuNWgzODVNMCA5Ni41aDM4NU0wIDEyMC41aDM4NU0wIDE0NC41aDM4NU0wIDE2OC41aDM4NU0wIDE5Mi41aDM4NU0wIDIxNi41aDM4NU0wIDI0MC41aDM4NU0wIDI2NC41aDM4NU0wIDI4OC41aDM4NU0wIDMxMi41aDM4NU0wIDMzNi41aDM4NU0wIDM2MC41aDM4NU0wIDM4NC41aDM4NU0wIDQwOC41aDM4NU0wIDQzMi41aDM4NU0wIDQ1Ni41aDM4NU0wIDQ4MC41aDM4NU0wIDUwNC41aDM4NU0wIDUyOC41aDM4NU0wIDU1Mi41aDM4NU0wIDU3Ni41aDM4NU0wIDYwMC41aDM4NU0wIDYyNC41aDM4NU0wIDY0OC41aDM4NU0wIDY3Mi41aDM4NU0wIDY5Ni41aDM4NU0wIDcyMC41aDM4NU0wIDc0NC41aDM4NU0wIDc2OC41aDM4NU0wIDc5Mi41aDM4NU0wIDgxNi41aDM4NSIvPjwvZz48L3N2Zz4=";
6
7
  const Loading_css_ts_vanilla = "";
8
+ var description = "_17ify496";
9
+ var iconLayout = "_17ify492";
10
+ var iconLoadFailed = "_17ify493";
7
11
  var loadingBg = "_17ify491";
8
12
  var loadingLayout = "_17ify490";
13
+ var textLayout = "_17ify494";
14
+ var title = "_17ify495";
9
15
  const Loading = defineSetup("Loading", function() {
10
16
  return () => createVNode("div", {
11
17
  "class": loadingLayout
@@ -17,7 +23,27 @@ const Loading = defineSetup("Loading", function() {
17
23
  "title": ""
18
24
  }, null)]);
19
25
  });
26
+ const LoadFailed = defineSetup("LoadFailed", function(props) {
27
+ return () => createVNode("div", {
28
+ "class": loadingLayout
29
+ }, [createVNode("img", {
30
+ "class": loadingBg,
31
+ "src": imgGrid
32
+ }, null), createVNode("div", {
33
+ "class": iconLayout
34
+ }, [createVNode("img", {
35
+ "class": iconLoadFailed,
36
+ "src": ICON_LOAD_FAILED_URL
37
+ }, null), createVNode("div", {
38
+ "class": textLayout
39
+ }, [createVNode("span", {
40
+ "class": title
41
+ }, [props.title]), createVNode("span", {
42
+ "class": description
43
+ }, [props.description])])])]);
44
+ });
20
45
  export {
21
46
  Loading as L,
47
+ LoadFailed as a,
22
48
  imgGrid as i
23
49
  };
@@ -0,0 +1,20 @@
1
+ import { i as isObject, d as debounce } from "./debounce.5afe7867.js";
2
+ var FUNC_ERROR_TEXT = "Expected a function";
3
+ function throttle(func, wait, options) {
4
+ var leading = true, trailing = true;
5
+ if (typeof func != "function") {
6
+ throw new TypeError(FUNC_ERROR_TEXT);
7
+ }
8
+ if (isObject(options)) {
9
+ leading = "leading" in options ? !!options.leading : leading;
10
+ trailing = "trailing" in options ? !!options.trailing : trailing;
11
+ }
12
+ return debounce(func, wait, {
13
+ "leading": leading,
14
+ "maxWait": wait,
15
+ "trailing": trailing
16
+ });
17
+ }
18
+ export {
19
+ throttle as t
20
+ };
@@ -1,2 +1,7 @@
1
1
  export declare const loadingLayout: string;
2
2
  export declare const loadingBg: string;
3
+ export declare const iconLayout: string;
4
+ export declare const iconLoadFailed: string;
5
+ export declare const textLayout: string;
6
+ export declare const title: string;
7
+ export declare const description: string;
@@ -1,3 +1,11 @@
1
1
  export declare const Loading: import("vue").DefineComponent<import("vue").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, import("vue").PublicProps, unknown, unknown, import("vue").SlotsType<{} & {
2
2
  default?: import("../../demi-polyfill").Slot | undefined;
3
3
  }>>;
4
+ interface LoadFailedProps {
5
+ title?: string;
6
+ description?: string;
7
+ }
8
+ export declare const LoadFailed: import("vue").DefineComponent<import("vue").ComponentObjectPropsOptions<LoadFailedProps>, 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<LoadFailedProps, Required<LoadFailedProps>>, never, import("vue").PublicProps, LoadFailedProps, LoadFailedProps, import("vue").SlotsType<{} & {
9
+ default?: import("../../demi-polyfill").Slot | undefined;
10
+ }>>;
11
+ export {};
@@ -1,7 +1,9 @@
1
1
  import "vue";
2
- import { L } from "../../chunks/Loading.a8e2f26a.js";
2
+ import "../../api/cdn.js";
3
+ import { a, L } from "../../chunks/Loading.98d687c0.js";
3
4
  import "../../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
4
5
  import "../../types/helper.js";
5
6
  export {
7
+ a as LoadFailed,
6
8
  L as Loading
7
9
  };
@@ -1,4 +1,5 @@
1
- import { L } from "../../chunks/Loading.a8e2f26a.js";
1
+ import { a, L } from "../../chunks/Loading.98d687c0.js";
2
2
  export {
3
+ a as LoadFailed,
3
4
  L as Loading
4
5
  };
@@ -1,12 +1,15 @@
1
1
  /// <reference types="google.maps" />
2
2
  import type { VueNode } from "../../demi-polyfill";
3
3
  import type { SetMap } from "../../hooks/useHeycarMap";
4
- import { type GmapLoaderProps, type UseMapLoaderProps } from "../../hooks/useMapLoader";
4
+ import { Status, type GmapLoaderProps, type UseMapLoaderProps } from "../../hooks/useMapLoader";
5
5
  import { type MapSupplierPayolad } from "../../hooks/useMapSupplier";
6
6
  import type { AmapMap } from "../../types/interface";
7
7
  import { type AmapProps } from "../Amap";
8
- export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId">;
9
- export declare const MapProvider: import("vue").DefineComponent<import("vue").ComponentObjectPropsOptions<MapProviderProps>, 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<MapProviderProps, Required<MapProviderProps>>, "change", import("vue").PublicProps, MapProviderProps, MapProviderProps, import("vue").SlotsType<{} & {
8
+ export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
9
+ export declare const MapProvider: import("vue").DefineComponent<import("vue").ComponentObjectPropsOptions<MapProviderProps>, 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<MapProviderProps, Required<MapProviderProps>>, "success" | "fail", import("vue").PublicProps, MapProviderProps, MapProviderProps, import("vue").SlotsType<{
10
+ renderLoadFailedTitle?: ((status: Status) => string | undefined) | undefined;
11
+ renderLoadFailedDescription?: ((status: Status) => string | undefined) | undefined;
12
+ } & {
10
13
  default?: import("../../demi-polyfill").Slot | undefined;
11
14
  }>>;
12
15
  export interface HeycarMapProps extends Pick<GmapLoaderProps, "fallback" | "loading">, Pick<AmapProps, "center" | "zoom"> {
@@ -1,6 +1,6 @@
1
1
  import "../../css/MapProvider-156bfd53.css";
2
2
  import { createVNode, isVNode } from "vue";
3
- import { L as Loading, i as imgGrid } from "../../chunks/Loading.a8e2f26a.js";
3
+ import { L as Loading, a as LoadFailed, i as imgGrid } from "../../chunks/Loading.98d687c0.js";
4
4
  import { useMapLoader, Status } from "../../hooks/useMapLoader.js";
5
5
  import { provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
6
6
  import { defineLagecySetup } from "../../types/helper.js";
@@ -39,7 +39,7 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
39
39
  var _a;
40
40
  return createVNode("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
41
41
  };
42
- }).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language"]);
42
+ }).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
43
43
  const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
44
44
  slots,
45
45
  emit,
@@ -67,7 +67,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
67
67
  const handleResize = () => emit("resize");
68
68
  loadTraditionalChineseConvertOnce(payload.language === "zh-TW");
69
69
  return () => {
70
- var _a, _b, _c, _d, _e, _f;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h;
71
71
  const {
72
72
  supplier,
73
73
  gmapId,
@@ -86,12 +86,17 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
86
86
  const node = (_a = slots.loading) == null ? void 0 : _a.call(slots);
87
87
  return node ? createVNode("div", null, [node]) : createVNode(Loading, null, null);
88
88
  }
89
- if (status === Status.FAILURE) {
89
+ if (status === Status.FAILURE || status === Status.TIMEOUT) {
90
90
  const node = (_b = slots.fallback) == null ? void 0 : _b.call(slots);
91
- return node ? createVNode("div", null, [node]) : createVNode(Loading, null, null);
91
+ const title = (_c = payload.renderLoadFailedTitle) == null ? void 0 : _c.call(payload, status);
92
+ const description = (_d = payload.renderLoadFailedDescription) == null ? void 0 : _d.call(payload, status);
93
+ return node ? createVNode("div", null, [node]) : createVNode(LoadFailed, {
94
+ "title": title,
95
+ "description": description
96
+ }, null);
92
97
  }
93
- const children = (_c = slots.default) == null ? void 0 : _c.call(slots);
94
- const outArea = (_d = slots.outerArea) == null ? void 0 : _d.call(slots);
98
+ const children = (_e = slots.default) == null ? void 0 : _e.call(slots);
99
+ const outArea = (_f = slots.outerArea) == null ? void 0 : _f.call(slots);
95
100
  const mapId = patchGmapIdForAlipayCompatible({
96
101
  gmapId,
97
102
  gmapRasterId,
@@ -101,7 +106,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
101
106
  switch (supplier) {
102
107
  case "gmap":
103
108
  return createVNode("div", {
104
- "class": `${heycarMap} ${(_e = attrs.class) != null ? _e : ""}`,
109
+ "class": `${heycarMap} ${(_g = attrs.class) != null ? _g : ""}`,
105
110
  "lang": language,
106
111
  "style": attrs.style
107
112
  }, [createVNode(Gmap, {
@@ -126,7 +131,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
126
131
  }, null), outArea]);
127
132
  default:
128
133
  return createVNode("div", {
129
- "class": `${heycarMap} ${(_f = attrs.class) != null ? _f : ""}`,
134
+ "class": `${heycarMap} ${(_h = attrs.class) != null ? _h : ""}`,
130
135
  "lang": language,
131
136
  "style": attrs.style
132
137
  }, [createVNode(Amap, {