@heycar/heycars-map 2.0.0-switchMap1 → 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.
Files changed (122) 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/Demo/DemoBusinessRecomendPlace.js +1 -1
  7. package/dist/v2/api/cdn.d.ts +1 -0
  8. package/dist/v2/api/cdn.js +2 -0
  9. package/dist/v2/api/googleSnapRoad.js +7 -2
  10. package/dist/v2/api/pingConnection.d.ts +9 -0
  11. package/dist/v2/api/pingConnection.js +111 -0
  12. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +5 -2
  13. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
  14. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -3
  15. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +3 -3
  16. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  17. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +22 -13
  18. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +12 -5
  19. package/dist/v2/chunks/{BusinessRecomendPlaceMap.5be4fdcf.js → BusinessRecomendPlaceMap.b4d45108.js} +30 -18
  20. package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
  21. package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
  22. package/dist/v2/components/Loading/Loading.d.ts +6 -0
  23. package/dist/v2/components/Loading/Loading.js +4 -2
  24. package/dist/v2/components/Loading/index.js +3 -2
  25. package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
  26. package/dist/v2/components/MapProvider/MapProvider.js +23 -13
  27. package/dist/v2/css/Loading-49e58ced.css +46 -0
  28. package/dist/v2/hooks/useDrivingRoute.js +4 -0
  29. package/dist/v2/hooks/useMapGCJ02.js +4 -37
  30. package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
  31. package/dist/v2/hooks/useMapGeometry.js +4 -4
  32. package/dist/v2/hooks/useMapGraspRoad.js +1 -2
  33. package/dist/v2/hooks/useMapInChina.d.ts +3 -15
  34. package/dist/v2/hooks/useMapInChina.js +11 -16
  35. package/dist/v2/hooks/useMapLoader.d.ts +13 -7
  36. package/dist/v2/hooks/useMapLoader.js +144 -82
  37. package/dist/v2/hooks/useMapPlace.d.ts +1 -0
  38. package/dist/v2/hooks/useMapPlace.js +52 -44
  39. package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
  40. package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
  41. package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
  42. package/dist/v2/hooks/useMapSupplier.js +17 -0
  43. package/dist/v2/hooks/usePingConnection.d.ts +10 -0
  44. package/dist/v2/hooks/usePingConnection.js +26 -0
  45. package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +2 -0
  46. package/dist/v2/hooks-business/useBusinessQuotingMap.js +7 -2
  47. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  48. package/dist/v2/index.js +1 -1
  49. package/dist/v2/types/global.d.ts +3 -0
  50. package/dist/v2/types/interface.d.ts +1 -1
  51. package/dist/v2/utils/ManualAbortError.d.ts +3 -0
  52. package/dist/v2/utils/ManualAbortError.js +14 -0
  53. package/dist/v2/utils/helper.d.ts +2 -0
  54. package/dist/v2/utils/helper.js +29 -0
  55. package/dist/v2/utils/log.js +1 -1
  56. package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
  57. package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
  58. package/dist/v3/App.js +5 -3
  59. package/dist/v3/Demo/DemoBusinessQuoting.js +4 -3
  60. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +1 -1
  61. package/dist/v3/api/cdn.d.ts +1 -0
  62. package/dist/v3/api/cdn.js +2 -0
  63. package/dist/v3/api/googleSnapRoad.js +7 -2
  64. package/dist/v3/api/pingConnection.d.ts +9 -0
  65. package/dist/v3/api/pingConnection.js +111 -0
  66. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +5 -2
  67. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
  68. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -3
  69. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +3 -3
  70. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  71. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +22 -13
  72. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +12 -5
  73. package/dist/v3/chunks/{BusinessRecomendPlaceMap.39888296.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +30 -18
  74. package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
  75. package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
  76. package/dist/v3/components/Loading/Loading.d.ts +8 -0
  77. package/dist/v3/components/Loading/Loading.js +4 -2
  78. package/dist/v3/components/Loading/index.js +3 -2
  79. package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
  80. package/dist/v3/components/MapProvider/MapProvider.js +21 -13
  81. package/dist/v3/css/Loading-49e58ced.css +46 -0
  82. package/dist/v3/hooks/useDrivingRoute.js +4 -0
  83. package/dist/v3/hooks/useMapGCJ02.js +4 -37
  84. package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
  85. package/dist/v3/hooks/useMapGeometry.js +4 -4
  86. package/dist/v3/hooks/useMapGraspRoad.js +1 -2
  87. package/dist/v3/hooks/useMapInChina.d.ts +3 -15
  88. package/dist/v3/hooks/useMapInChina.js +11 -16
  89. package/dist/v3/hooks/useMapLoader.d.ts +13 -7
  90. package/dist/v3/hooks/useMapLoader.js +144 -82
  91. package/dist/v3/hooks/useMapPlace.d.ts +1 -0
  92. package/dist/v3/hooks/useMapPlace.js +52 -44
  93. package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
  94. package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
  95. package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
  96. package/dist/v3/hooks/useMapSupplier.js +17 -0
  97. package/dist/v3/hooks/usePingConnection.d.ts +10 -0
  98. package/dist/v3/hooks/usePingConnection.js +26 -0
  99. package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +2 -0
  100. package/dist/v3/hooks-business/useBusinessQuotingMap.js +7 -2
  101. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  102. package/dist/v3/index.js +1 -1
  103. package/dist/v3/types/global.d.ts +3 -0
  104. package/dist/v3/types/interface.d.ts +1 -1
  105. package/dist/v3/utils/ManualAbortError.d.ts +3 -0
  106. package/dist/v3/utils/ManualAbortError.js +14 -0
  107. package/dist/v3/utils/helper.d.ts +2 -0
  108. package/dist/v3/utils/helper.js +29 -0
  109. package/dist/v3/utils/log.js +1 -1
  110. package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
  111. package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
  112. package/package.json +2 -2
  113. package/dist/v2/api/googleConnection.d.ts +0 -5
  114. package/dist/v2/api/googleConnection.js +0 -51
  115. package/dist/v2/css/Loading-523061b9.css +0 -9
  116. package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
  117. package/dist/v2/hooks/useGoogleConnection.js +0 -15
  118. package/dist/v3/api/googleConnection.d.ts +0 -5
  119. package/dist/v3/api/googleConnection.js +0 -51
  120. package/dist/v3/css/Loading-523061b9.css +0 -9
  121. package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
  122. package/dist/v3/hooks/useGoogleConnection.js +0 -15
@@ -1,5 +1,5 @@
1
1
  import { h } from "vue";
2
- import { computed, watch, watchEffect } from "vue-demi";
2
+ import { computed, watch, watchEffect, onUnmounted } from "vue-demi";
3
3
  import { apiSaveCenterPlaceToCache } from "../api/browser.js";
4
4
  import { apiMemoryShouldSkipByKey } from "../api/memory.js";
5
5
  import { HeycarMap } from "../components/MapProvider/MapProvider.js";
@@ -10,10 +10,11 @@ import { useMapCoordinatify } from "../hooks/useMapCoordinatify.js";
10
10
  import { useMapDrag } from "../hooks/useMapDrag.js";
11
11
  import { useMapGeometry } from "../hooks/useMapGeometry.js";
12
12
  import { useMapRecomendPlace } from "../hooks/useMapRecomendPlace.js";
13
- import { useMapSupplier } from "../hooks/useMapSupplier.js";
13
+ import { useMapSupplier, useMapAssertSupplier } from "../hooks/useMapSupplier.js";
14
14
  import { useMapZoom } from "../hooks/useMapZoom.js";
15
15
  import { defineSetup, defineLagecySetup } from "../types/helper.js";
16
16
  import { CenterPlaceStatus } from "../types/interface.js";
17
+ import { throwNoneManualAbortError, MANUAL_ABORT_MESSAGE } from "../utils/ManualAbortError.js";
17
18
  import { watchPostEffectOnce, generateCreateElementV2PropsOn } from "../utils/compare.js";
18
19
  import { equalAssign, isPlacesInclude } from "../utils/helper.js";
19
20
  import { detectBrowserPlatform } from "../utils/platform.js";
@@ -286,6 +287,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
286
287
  getRecomendPlace,
287
288
  mapContext
288
289
  } = props;
290
+ const abortController = new AbortController();
289
291
  const {
290
292
  coordinatifyPoint,
291
293
  unCoordinatifyPoint,
@@ -296,7 +298,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
296
298
  coordinatifyGeoPosition
297
299
  } = useMapCoordinatify();
298
300
  const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
299
- const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
301
+ const pipedGetRecomendPlace = pipeOnlyLastEffect((p, context) => getRecomendPlace(coordinatifyPlace(p), context).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
300
302
  const {
301
303
  apiMapDistance
302
304
  } = useMapGeometry();
@@ -314,8 +316,12 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
314
316
  defaultValue: DEFAULT_ZOOM
315
317
  });
316
318
  const {
317
- readyPromise
319
+ readyPromise,
320
+ supplier
318
321
  } = useMapSupplier();
322
+ const {
323
+ assertSupplier
324
+ } = useMapAssertSupplier();
319
325
  const {
320
326
  centerPlace,
321
327
  isFirstLoad,
@@ -327,7 +333,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
327
333
  geoLoadingTitle
328
334
  });
329
335
  const centerSource = {
330
- source: "geo"
336
+ source: "default"
331
337
  };
332
338
  const updateCenterPlaceByPoint = (point, context) => {
333
339
  var _a;
@@ -345,6 +351,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
345
351
  place: inputPlace,
346
352
  recommends: inputRecommends
347
353
  }) => {
354
+ centerSource.source = "api";
348
355
  const place = unCoordinatifyPlace(toCoordinatePlaceType(inputPlace));
349
356
  const recommends = unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(inputRecommends));
350
357
  const isSameZone = recommends.zone && isZoneEqual(recommends.zone, zoneRef.value);
@@ -395,7 +402,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
395
402
  if (!isFirstLoad)
396
403
  return;
397
404
  const [lng, lat] = value.position;
398
- await readyPromise;
405
+ if (supplier === "amap")
406
+ await readyPromise;
399
407
  centerSource.source = "geo";
400
408
  centerPlace.lng = lng;
401
409
  centerPlace.lat = lat;
@@ -405,7 +413,8 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
405
413
  emit("loadDefaultGeoLocation", coordinatifyGeoPosition(value));
406
414
  if (!isFirstLoad)
407
415
  return;
408
- await readyPromise;
416
+ if (supplier === "amap")
417
+ await readyPromise;
409
418
  centerSource.source = "geo";
410
419
  updatePlace(value.position);
411
420
  },
@@ -418,19 +427,19 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
418
427
  emitGeoErrorOnce(error);
419
428
  }
420
429
  });
421
- mapContext.apiMapDistance = (from, to) => {
430
+ mapContext.apiMapDistance = assertSupplier((from, to) => {
422
431
  return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
423
- };
424
- mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
425
- mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
426
- mapContext.panToGeoPositionByRecomend = () => {
432
+ });
433
+ mapContext.setCenterPlaceByUserSpecified = assertSupplier(setCenterPlaceByUserSpecified);
434
+ mapContext.setCenterPlaceByUserSpecifiedInZone = assertSupplier(setCenterPlaceByUserSpecifiedInZone);
435
+ mapContext.panToGeoPositionByRecomend = assertSupplier(() => {
427
436
  if (geoError.value)
428
437
  return false;
429
438
  updateCenterPlaceByPoint(geoPosition.value, {
430
439
  source: "geo"
431
440
  });
432
441
  return true;
433
- };
442
+ });
434
443
  const {
435
444
  isDragging
436
445
  } = useMapDrag({
@@ -454,6 +463,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
454
463
  emptyPlaceName: emptyTitle,
455
464
  queryingPlaceName: queryingTitle,
456
465
  context: centerSource,
466
+ signal: abortController.signal,
457
467
  getAvailable: pipedGetAvailable,
458
468
  getRecomendPlace: pipedGetRecomendPlace,
459
469
  getLimit: (context) => {
@@ -466,14 +476,15 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
466
476
  case "default":
467
477
  return RECOMMEND_PLACE_LARGE_LIMIT;
468
478
  default:
469
- throw new Error(`MyError: should not call getLimit on source: ${source}`);
479
+ console.error(new Error(`MyError: should not call getLimit on source: ${source}`));
480
+ return RECOMMEND_PLACE_DRAG_LIMIT;
470
481
  }
471
482
  },
472
483
  onQueryingPlace: (place) => equalAssign(centerPlace, {
473
484
  ...place
474
485
  }),
475
486
  onChangePlace: (place) => emit("changePlace", coordinatifyPlace(place)),
476
- onChange: async ({
487
+ onChange: ({
477
488
  place,
478
489
  inputPlace,
479
490
  isInZone,
@@ -498,7 +509,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
498
509
  const centerPlaceStatusRef = computed(() => isFirstLoad && geoLoading.value ? CenterPlaceStatus.GEO_LOADING : isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK);
499
510
  watchPostEffectOnce(() => {
500
511
  if (!isFirstLoad)
501
- updateRecommendPlaceOnlyInZone(defaultCenterPlace);
512
+ updateRecommendPlaceOnlyInZone(defaultCenterPlace).catch(throwNoneManualAbortError);
502
513
  });
503
514
  watch(centerPlace, (place) => {
504
515
  if (centerPlaceStatusRef.value === CenterPlaceStatus.OK) {
@@ -516,6 +527,7 @@ const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner
516
527
  watchEffect(() => {
517
528
  mapContext.centerPlaceStatusRef.value = centerPlaceStatusRef.value;
518
529
  });
530
+ onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
519
531
  return () => {
520
532
  var _a, _b, _c;
521
533
  const {
@@ -606,9 +618,9 @@ export {
606
618
  BusinessRecomendPlaceMap as B,
607
619
  DEFAULT_ZOOM as D,
608
620
  EMPTY_PLACE as E,
609
- RECOMMEND_PLACE_LARGE_LIMIT as R,
621
+ RECOMMEND_PLACE_DRAG_LIMIT as R,
610
622
  ZONE_ZOOM as Z,
611
- RECOMMEND_PLACE_DRAG_LIMIT as a,
623
+ RECOMMEND_PLACE_LARGE_LIMIT as a,
612
624
  RECOMMEND_PLACE_ZONE_ICON_MIN as b,
613
625
  RECOMMEND_PLACE_ICON_ZOOM_MIN as c,
614
626
  RECOMMEND_PLACE_ZONE_TEXT_MIN as d,
@@ -1,11 +1,17 @@
1
- import "../css/Loading-523061b9.css";
1
+ import "../css/Loading-49e58ced.css";
2
2
  import { h } 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 contentLayout = "_17ify492";
9
+ var description = "_17ify496";
10
+ var iconLoadFailed = "_17ify493";
7
11
  var loadingBg = "_17ify491";
8
12
  var loadingLayout = "_17ify490";
13
+ var title = "_17ify495";
14
+ var verticalGap = "_17ify494";
9
15
  const Loading = defineSetup("Loading", function() {
10
16
  return () => h("div", {
11
17
  "class": loadingLayout
@@ -21,7 +27,29 @@ const Loading = defineSetup("Loading", function() {
21
27
  }
22
28
  })]);
23
29
  });
30
+ const LoadFailed = defineSetup("LoadFailed", function(props) {
31
+ return () => h("div", {
32
+ "class": loadingLayout
33
+ }, [h("img", {
34
+ "class": loadingBg,
35
+ "attrs": {
36
+ "src": imgGrid
37
+ }
38
+ }), h("div", {
39
+ "class": contentLayout
40
+ }, [h("img", {
41
+ "class": iconLoadFailed,
42
+ "attrs": {
43
+ "src": ICON_LOAD_FAILED_URL
44
+ }
45
+ }), h("span", {
46
+ "class": `${title} ${verticalGap}`
47
+ }, [props.title]), h("span", {
48
+ "class": `${description} ${verticalGap}`
49
+ }, [props.description])])]);
50
+ });
24
51
  export {
25
- Loading as L,
52
+ LoadFailed as L,
53
+ Loading as a,
26
54
  imgGrid as i
27
55
  };
@@ -1,2 +1,7 @@
1
1
  export declare const loadingLayout: string;
2
2
  export declare const loadingBg: string;
3
+ export declare const contentLayout: string;
4
+ export declare const iconLoadFailed: string;
5
+ export declare const verticalGap: string;
6
+ export declare const title: string;
7
+ export declare const description: string;
@@ -1 +1,7 @@
1
1
  export declare const Loading: import("vue").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
+ interface LoadFailedProps {
3
+ title?: string;
4
+ description?: string;
5
+ }
6
+ export declare const LoadFailed: import("vue").DefineComponent<import("vue3").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, LoadFailedProps>;
7
+ export {};
@@ -1,7 +1,9 @@
1
1
  import "vue";
2
- import { L } from "../../chunks/Loading.fc6e75d0.js";
2
+ import "../../api/cdn.js";
3
+ import { L, a } from "../../chunks/Loading.492acbc2.js";
3
4
  import "../../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
4
5
  import "../../types/helper.js";
5
6
  export {
6
- L as Loading
7
+ L as LoadFailed,
8
+ a as Loading
7
9
  };
@@ -1,4 +1,5 @@
1
- import { L } from "../../chunks/Loading.fc6e75d0.js";
1
+ import { L, a } from "../../chunks/Loading.492acbc2.js";
2
2
  export {
3
- L as Loading
3
+ L as LoadFailed,
4
+ a as Loading
4
5
  };
@@ -5,8 +5,8 @@ import { type GmapLoaderProps, type UseMapLoaderProps } from "../../hooks/useMap
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("vue3").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", MapProviderProps>;
8
+ export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
9
+ export declare const MapProvider: import("vue").DefineComponent<import("vue3").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", MapProviderProps>;
10
10
  export interface HeycarMapProps extends Pick<GmapLoaderProps, "fallback" | "loading">, Pick<AmapProps, "center" | "zoom"> {
11
11
  mapRef?: SetMap<AmapMap> | SetMap<google.maps.Map>;
12
12
  outerArea?: () => VueNode;
@@ -1,6 +1,6 @@
1
1
  import "../../css/MapProvider-156bfd53.css";
2
2
  import { h } from "vue";
3
- import { L as Loading, i as imgGrid } from "../../chunks/Loading.fc6e75d0.js";
3
+ import { L as LoadFailed, a as Loading, i as imgGrid } from "../../chunks/Loading.492acbc2.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";
@@ -26,6 +26,8 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
26
26
  get(target, name, receiver) {
27
27
  if (name === "status")
28
28
  return payload.statusRef.value;
29
+ if (name === "pingStatus")
30
+ return payload.pingStatusRef.value;
29
31
  if (name === "readyPromise")
30
32
  return payload.readyPromise;
31
33
  return Reflect.get(target, name, receiver);
@@ -36,7 +38,7 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
36
38
  var _a;
37
39
  return h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
38
40
  };
39
- }).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language"]);
41
+ }).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
40
42
  const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
41
43
  slots,
42
44
  emit,
@@ -64,13 +66,14 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
64
66
  const handleResize = () => emit("resize");
65
67
  loadTraditionalChineseConvertOnce(payload.language === "zh-TW");
66
68
  return () => {
67
- var _a, _b, _c, _d, _e, _f;
69
+ var _a, _b, _c, _d, _e, _f, _g, _h;
68
70
  const {
69
71
  supplier,
70
72
  gmapId,
71
73
  gmapRasterId,
72
74
  language = "zh",
73
- status
75
+ status,
76
+ pingStatus
74
77
  } = payload;
75
78
  const {
76
79
  mapRef: setMap,
@@ -79,16 +82,23 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
79
82
  touchEnable = true,
80
83
  touchZoomCenter
81
84
  } = props;
82
- if (status === Status.LOADING) {
83
- const node = (_a = slots.loading) == null ? void 0 : _a.call(slots);
84
- return node ? h("div", [node]) : h(Loading);
85
+ if (status === Status.FAILURE || pingStatus === "unconnected") {
86
+ const node = (_a = slots.fallback) == null ? void 0 : _a.call(slots);
87
+ const title = (_b = payload.renderLoadFailedTitle) == null ? void 0 : _b.call(payload, status);
88
+ const description = (_c = payload.renderLoadFailedDescription) == null ? void 0 : _c.call(payload, status);
89
+ return node ? h("div", [node]) : h(LoadFailed, {
90
+ "attrs": {
91
+ "title": title,
92
+ "description": description
93
+ }
94
+ });
85
95
  }
86
- if (status === Status.FAILURE) {
87
- const node = (_b = slots.fallback) == null ? void 0 : _b.call(slots);
96
+ if (status === Status.LOADING || status === Status.SUCCESS && pingStatus === "pending") {
97
+ const node = (_d = slots.loading) == null ? void 0 : _d.call(slots);
88
98
  return node ? h("div", [node]) : h(Loading);
89
99
  }
90
- const children = (_c = slots.default) == null ? void 0 : _c.call(slots);
91
- const outArea = (_d = slots.outerArea) == null ? void 0 : _d.call(slots);
100
+ const children = (_e = slots.default) == null ? void 0 : _e.call(slots);
101
+ const outArea = (_f = slots.outerArea) == null ? void 0 : _f.call(slots);
92
102
  const mapId = patchGmapIdForAlipayCompatible({
93
103
  gmapId,
94
104
  gmapRasterId,
@@ -98,7 +108,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
98
108
  switch (supplier) {
99
109
  case "gmap":
100
110
  return h("div", {
101
- "class": `${heycarMap} ${(_e = attrs.class) != null ? _e : ""}`,
111
+ "class": `${heycarMap} ${(_g = attrs.class) != null ? _g : ""}`,
102
112
  "attrs": {
103
113
  "lang": language
104
114
  },
@@ -129,7 +139,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
129
139
  }), outArea]);
130
140
  default:
131
141
  return h("div", {
132
- "class": `${heycarMap} ${(_f = attrs.class) != null ? _f : ""}`,
142
+ "class": `${heycarMap} ${(_h = attrs.class) != null ? _h : ""}`,
133
143
  "attrs": {
134
144
  "lang": language
135
145
  },
@@ -0,0 +1,46 @@
1
+ ._17ify490 {
2
+ position: relative;
3
+ background-color: #EDF1F5;
4
+ }
5
+ ._17ify491 {
6
+ position: absolute;
7
+ width: 100%;
8
+ height: 100%;
9
+ object-fit: cover;
10
+ }
11
+ ._17ify492 {
12
+ position: absolute;
13
+ margin: auto;
14
+ top: -5vh;
15
+ left: 0;
16
+ right: 0;
17
+ bottom: 0;
18
+ width: fit-content;
19
+ height: fit-content;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ }
24
+ ._17ify493 {
25
+ width: 40.8vw;
26
+ height: 24.53vw;
27
+ }
28
+ ._17ify494 {
29
+ margin-top: 1.6vw;
30
+ }
31
+ ._17ify495 {
32
+ font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
33
+ font-weight: 500;
34
+ font-size: 4vw;
35
+ color: #1E1E1E;
36
+ line-height: 6.4vw;
37
+ }
38
+ ._17ify496 {
39
+ font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
40
+ font-weight: 400;
41
+ font-size: 3.73vw;
42
+ color: #999BA1;
43
+ line-height: 6.4vw;
44
+ white-space: pre-line;
45
+ text-align: center;
46
+ }
@@ -23,6 +23,8 @@ const useADrivingRoute = (props) => {
23
23
  const drivingResult = result;
24
24
  const routeSteps = [];
25
25
  const firstRoute = drivingResult.routes[0];
26
+ if (!firstRoute)
27
+ return resolve({ path: [], distance: 0, duration: 0, steps: [] });
26
28
  for (const step of firstRoute.steps) {
27
29
  const basicStep = step;
28
30
  const stepPath = basicStep.path.map(({ lng, lat }) => [lng, lat]);
@@ -83,6 +85,8 @@ const useGDrivingRoute = (props) => {
83
85
  let duration = 0;
84
86
  const routeSteps = [];
85
87
  const firstRoute = result.routes[0];
88
+ if (!firstRoute)
89
+ return resolve({ path: [], distance: 0, duration: 0, steps: [] });
86
90
  for (const leg of firstRoute.legs) {
87
91
  distance += (_b = (_a = leg.distance) == null ? void 0 : _a.value) != null ? _b : 0;
88
92
  duration += (_d = (_c = leg.duration) == null ? void 0 : _c.value) != null ? _d : 0;
@@ -1,6 +1,4 @@
1
- import { AMAP_TO_GCJ02_TIMEOUT } from "../api/contants.js";
2
- import { lnglat2point } from "../utils/transform.js";
3
- import { useMapInChina } from "./useMapInChina.js";
1
+ import { inChina, inHongkong, inMacau } from "./useMapInChina.js";
4
2
  import { useMapSupplier } from "./useMapSupplier.js";
5
3
  /**
6
4
  * @preserve
@@ -514,8 +512,6 @@ const exported = Object.assign(Object.assign({}, CRSTypes), {
514
512
  transform
515
513
  });
516
514
  const useAmapGCJ02 = () => {
517
- const { readyPromise } = useMapSupplier();
518
- const { inChina } = useMapInChina();
519
515
  const toCoordinateType = (p) => {
520
516
  return inChina(p) ? "gcj02" : "wgs84";
521
517
  };
@@ -532,42 +528,15 @@ const useAmapGCJ02 = () => {
532
528
  }
533
529
  };
534
530
  const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
535
- async function toGcj02Points(points) {
536
- await readyPromise;
537
- return new Promise((resolve) => {
538
- let isHandled = false;
539
- AMap.convertFrom(
540
- [...points],
541
- "gps",
542
- (_, result) => {
543
- if (isHandled)
544
- return;
545
- isHandled = true;
546
- if (result.info === "ok") {
547
- resolve(result.locations.map(lnglat2point));
548
- } else {
549
- console.warn("警告: 高德坐标转换请求失败,启用本地转换");
550
- resolve(toLocalGcj02Points(points));
551
- }
552
- }
553
- );
554
- setTimeout(() => {
555
- if (isHandled)
556
- return;
557
- isHandled = true;
558
- console.warn("警告: 高德坐标转换请求超时,启用本地转换");
559
- resolve(toLocalGcj02Points(points));
560
- }, AMAP_TO_GCJ02_TIMEOUT);
561
- });
562
- }
531
+ const toGcj02Points = async (points) => {
532
+ return toLocalGcj02Points(points);
533
+ };
563
534
  function toGcj02(point) {
564
535
  return toGcj02Points([point]).then(([result]) => result);
565
536
  }
566
537
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
567
538
  };
568
539
  const useGmapGCJ02 = () => {
569
- const { readyPromise } = useMapSupplier();
570
- const { inChina, inHongkong, inMacau } = useMapInChina();
571
540
  const toCoordinateType = (p) => {
572
541
  return inChina(p) && !inHongkong(p) && !inMacau(p) ? "gcj02" : "wgs84";
573
542
  };
@@ -585,11 +554,9 @@ const useGmapGCJ02 = () => {
585
554
  };
586
555
  const toLocalGcj02Points = (points) => points.map(toLocalGcj02);
587
556
  const toGcj02 = async (point) => {
588
- await readyPromise;
589
557
  return toLocalGcj02Points([point])[0];
590
558
  };
591
559
  const toGcj02Points = async (points) => {
592
- await readyPromise;
593
560
  return toLocalGcj02Points(points);
594
561
  };
595
562
  return { toCoordinateType, toGcj02, toGcj02Points, toLocalGcj02, toLocalGcj02Points };
@@ -1,19 +1,17 @@
1
1
  import type { Point } from "../types/interface";
2
+ export declare const apiLocalIsPointInRing: (point: Point, path: Point[]) => boolean;
2
3
  export declare const useAmapGeometry: () => {
3
4
  apiMapDistance: (from: Point, to: Point) => number | undefined;
4
5
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
5
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
6
6
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
7
7
  };
8
8
  export declare const useGmapGeometry: () => {
9
9
  apiMapDistance: (from: Point, to: Point) => number | undefined;
10
10
  apiMapDistanceToLine: (from: Point, line: Point[]) => 0 | undefined;
11
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
12
11
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
13
12
  };
14
13
  export declare const useMapGeometry: () => {
15
14
  apiMapDistance: (from: Point, to: Point) => number | undefined;
16
15
  apiMapDistanceToLine: (from: Point, line: Point[]) => number | undefined;
17
- apiMapIsPointInRing: (point: Point, path: Point[]) => boolean;
18
16
  apiMapDistanceOfLine: (line: Point[]) => number | undefined;
19
17
  };
@@ -2,6 +2,7 @@ import { pointInPolygon } from "../utils/geometryPolygon.js";
2
2
  import { vec2lnglat } from "../utils/transform.js";
3
3
  import { Status } from "./useMapLoader.js";
4
4
  import { useMapSupplier } from "./useMapSupplier.js";
5
+ const apiLocalIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
5
6
  const useAmapGeometry = () => {
6
7
  const payload = useMapSupplier();
7
8
  const apiMapDistance = (from, to) => {
@@ -19,8 +20,7 @@ const useAmapGeometry = () => {
19
20
  return void 0;
20
21
  return AMap.GeometryUtil.distanceOfLine(line);
21
22
  };
22
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
23
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
23
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
24
24
  };
25
25
  const useGmapGeometry = () => {
26
26
  const payload = useMapSupplier();
@@ -39,14 +39,14 @@ const useGmapGeometry = () => {
39
39
  return void 0;
40
40
  return google.maps.geometry.spherical.computeLength(line.map(vec2lnglat));
41
41
  };
42
- const apiMapIsPointInRing = (point, path) => pointInPolygon(point, path) >= 0;
43
- return { apiMapDistance, apiMapDistanceToLine, apiMapIsPointInRing, apiMapDistanceOfLine };
42
+ return { apiMapDistance, apiMapDistanceToLine, apiMapDistanceOfLine };
44
43
  };
45
44
  const useMapGeometry = () => {
46
45
  const { supplier } = useMapSupplier();
47
46
  return supplier === "gmap" ? useGmapGeometry() : useAmapGeometry();
48
47
  };
49
48
  export {
49
+ apiLocalIsPointInRing,
50
50
  useAmapGeometry,
51
51
  useGmapGeometry,
52
52
  useMapGeometry
@@ -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
  };