@heycar/heycars-map 1.0.0-coordinate2 → 1.0.0-coordinate4

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 (130) hide show
  1. package/README.md +27 -2
  2. package/dist/v2/App.js +2 -2
  3. package/dist/v2/Demo/DemoBusinessQuoting.js +8 -3
  4. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +8 -3
  5. package/dist/v2/Demo/DemoBusinessReselectPlace.js +7 -2
  6. package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +3 -1
  7. package/dist/v2/Demo/DemoBusinessTaxiEnd.js +18 -2
  8. package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -0
  9. package/dist/v2/Demo/DemoBusinessTaxiService.js +11 -2
  10. package/dist/v2/api/googleConnection.d.ts +5 -0
  11. package/dist/v2/api/googleConnection.js +51 -0
  12. package/dist/v2/api/googleSnapRoad.js +26 -2
  13. package/dist/v2/business-components/AuxiliaryLine/AuxiliaryLine.d.ts +3 -3
  14. package/dist/v2/business-components/AuxiliaryLine/AuxiliaryLine.js +9 -10
  15. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +3 -1
  16. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +4 -0
  17. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +3 -1
  18. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +36 -344
  19. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +10 -10
  20. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  21. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +6 -3
  22. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +3 -1
  23. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -1
  24. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +3 -1
  25. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +6 -1
  26. package/dist/v2/chunks/BusinessRecomendPlaceMap.5a7d5831.js +582 -0
  27. package/dist/{v3/chunks/debounce.2eb371bd.js → v2/chunks/debounce.5afe7867.js} +7 -4
  28. package/dist/v2/chunks/{_baseGetTag.1b4fdfe1.js → isSymbol.555c14bf.js} +8 -0
  29. package/dist/v2/hooks/useDeviationCorrectionDrivingRoute.js +5 -3
  30. package/dist/v2/hooks/useDeviceOrientation.js +1 -2
  31. package/dist/v2/hooks/useGoogleConnection.d.ts +7 -0
  32. package/dist/v2/hooks/useGoogleConnection.js +15 -0
  33. package/dist/v2/hooks/useMapCoordinatify.js +1 -1
  34. package/dist/v2/hooks/useMapFitView.js +1 -1
  35. package/dist/v2/hooks/useMapGeometry.d.ts +3 -3
  36. package/dist/v2/hooks/useMapGeometry.js +3 -15
  37. package/dist/v2/hooks/useMapInChina.d.ts +3 -3
  38. package/dist/v2/hooks/useMapInChina.js +7 -43
  39. package/dist/v2/hooks/useMapZoom.js +1 -1
  40. package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +1 -0
  41. package/dist/v2/hooks-business/useBusinessQuotingMap.js +3 -1
  42. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +1 -0
  43. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +3 -0
  44. package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +1 -0
  45. package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +3 -0
  46. package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +7 -0
  47. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +1 -0
  48. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +3 -1
  49. package/dist/v2/index.js +2 -2
  50. package/dist/v2/types/helper.js +1 -2
  51. package/dist/v2/types/interface.d.ts +1 -0
  52. package/dist/v2/utils/geometryPolygon.d.ts +6 -0
  53. package/dist/v2/utils/geometryPolygon.js +27 -0
  54. package/dist/v2/utils/log.js +1 -1
  55. package/dist/v3/App.js +2 -2
  56. package/dist/v3/Demo/DemoBusinessQuoting.js +8 -3
  57. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +8 -3
  58. package/dist/v3/Demo/DemoBusinessReselectPlace.js +7 -2
  59. package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +3 -1
  60. package/dist/v3/Demo/DemoBusinessTaxiEnd.js +17 -3
  61. package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -0
  62. package/dist/v3/Demo/DemoBusinessTaxiService.js +10 -3
  63. package/dist/v3/api/googleConnection.d.ts +5 -0
  64. package/dist/v3/api/googleConnection.js +51 -0
  65. package/dist/v3/api/googleSnapRoad.js +26 -2
  66. package/dist/v3/business-components/AuxiliaryLine/AuxiliaryLine.d.ts +3 -3
  67. package/dist/v3/business-components/AuxiliaryLine/AuxiliaryLine.js +9 -10
  68. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +3 -1
  69. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +4 -0
  70. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +3 -1
  71. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +36 -333
  72. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +10 -10
  73. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
  74. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +6 -3
  75. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +3 -1
  76. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +6 -1
  77. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +3 -1
  78. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +6 -1
  79. package/dist/v3/chunks/BusinessRecomendPlaceMap.fbafad91.js +571 -0
  80. package/dist/{v2/chunks/debounce.2eb371bd.js → v3/chunks/debounce.5afe7867.js} +7 -4
  81. package/dist/v3/chunks/{_baseGetTag.1b4fdfe1.js → isSymbol.555c14bf.js} +8 -0
  82. package/dist/v3/hooks/useDeviationCorrectionDrivingRoute.js +5 -3
  83. package/dist/v3/hooks/useDeviceOrientation.js +1 -2
  84. package/dist/v3/hooks/useGoogleConnection.d.ts +7 -0
  85. package/dist/v3/hooks/useGoogleConnection.js +15 -0
  86. package/dist/v3/hooks/useMapCoordinatify.js +1 -1
  87. package/dist/v3/hooks/useMapFitView.js +1 -1
  88. package/dist/v3/hooks/useMapGeometry.d.ts +3 -3
  89. package/dist/v3/hooks/useMapGeometry.js +3 -15
  90. package/dist/v3/hooks/useMapInChina.d.ts +3 -3
  91. package/dist/v3/hooks/useMapInChina.js +7 -43
  92. package/dist/v3/hooks/useMapZoom.js +1 -1
  93. package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +1 -0
  94. package/dist/v3/hooks-business/useBusinessQuotingMap.js +3 -1
  95. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +1 -0
  96. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +3 -0
  97. package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +1 -0
  98. package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +3 -0
  99. package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +7 -0
  100. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +1 -0
  101. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +3 -1
  102. package/dist/v3/index.js +2 -2
  103. package/dist/v3/types/helper.js +1 -2
  104. package/dist/v3/types/interface.d.ts +1 -0
  105. package/dist/v3/utils/geometryPolygon.d.ts +6 -0
  106. package/dist/v3/utils/geometryPolygon.js +27 -0
  107. package/dist/v3/utils/log.js +1 -1
  108. package/package.json +1 -1
  109. package/dist/v2/api/driving.d.ts +0 -11
  110. package/dist/v2/api/driving.js +0 -71
  111. package/dist/v2/api/geocoder.d.ts +0 -15
  112. package/dist/v2/api/geocoder.js +0 -68
  113. package/dist/v2/api/geometry.d.ts +0 -19
  114. package/dist/v2/api/geometry.js +0 -29
  115. package/dist/v2/api/place.d.ts +0 -16
  116. package/dist/v2/api/place.js +0 -84
  117. package/dist/v2/chunks/isObject.4de2c89a.js +0 -7
  118. package/dist/v2/chunks/isSymbol.1c11fc44.js +0 -11
  119. package/dist/v2/chunks/memoize.d65d3da0.js +0 -235
  120. package/dist/v3/api/driving.d.ts +0 -11
  121. package/dist/v3/api/driving.js +0 -71
  122. package/dist/v3/api/geocoder.d.ts +0 -15
  123. package/dist/v3/api/geocoder.js +0 -68
  124. package/dist/v3/api/geometry.d.ts +0 -19
  125. package/dist/v3/api/geometry.js +0 -29
  126. package/dist/v3/api/place.d.ts +0 -16
  127. package/dist/v3/api/place.js +0 -84
  128. package/dist/v3/chunks/isObject.4de2c89a.js +0 -7
  129. package/dist/v3/chunks/isSymbol.1c11fc44.js +0 -11
  130. package/dist/v3/chunks/memoize.d65d3da0.js +0 -235
package/README.md CHANGED
@@ -92,6 +92,8 @@ export enum CenterPlaceStatus {
92
92
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
93
93
  OK = "OK",
94
94
  }
95
+
96
+ export type GoogleConnectionStatus = "pending" | "connected" | "unconnected";
95
97
  ```
96
98
 
97
99
  #### 在 入口文件添加 `MapProvider`
@@ -158,6 +160,7 @@ export default defineComponent({
158
160
  setup() {
159
161
  const {
160
162
  centerPlace,
163
+ googleConnectionStatus,
161
164
  mapContext,
162
165
  setCenterPlaceByUserSpecified,
163
166
  setCenterPlaceByUserSpecifiedInZone,
@@ -263,6 +266,10 @@ export default defineComponent({
263
266
  isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈",
264
267
  );
265
268
  }}
269
+ onChangeGoogleConnection={(status) =>
270
+ // 根据目前的产品需求,连通性检测只会被检测一次。
271
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
272
+ }
266
273
  />
267
274
  );
268
275
  },
@@ -281,6 +288,7 @@ export default defineComponent({
281
288
  setup() {
282
289
  const {
283
290
  centerPlace,
291
+ googleConnectionStatus,
284
292
  mapContext,
285
293
  setCenterPlaceByUserSpecified,
286
294
  setCenterPlaceByUserSpecifiedInZone,
@@ -411,6 +419,10 @@ export default defineComponent({
411
419
  isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈",
412
420
  );
413
421
  }}
422
+ onChangeGoogleConnection={(status) =>
423
+ // 根据目前的产品需求,连通性检测只会被检测一次。
424
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
425
+ }
414
426
  />
415
427
  );
416
428
  },
@@ -427,7 +439,7 @@ import { BusinessQuotingMap, useBusinessQuotingMap } from "@heycar/heycars-map";
427
439
 
428
440
  export default defineComponent({
429
441
  setup() {
430
- const { setMap, registerFitVeiw } = useBusinessQuotingMap();
442
+ const { googleConnectionStatus, setMap, registerFitVeiw } = useBusinessQuotingMap();
431
443
  return () => (
432
444
  <BusinessQuotingMap
433
445
  class={"demo"}
@@ -453,6 +465,10 @@ export default defineComponent({
453
465
  registerOverlay={registerFitVeiw}
454
466
  onClickStartPoint={(place) => console.log("点击起点时触发 palce = ", place)}
455
467
  onClickEndPoint={(place) => console.log("点击终点时触发 palce = ", place)}
468
+ onChangeGoogleConnection={(status) =>
469
+ // 根据目前的产品需求,连通性检测只会被检测一次。
470
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
471
+ }
456
472
  />
457
473
  );
458
474
  },
@@ -469,7 +485,7 @@ import { BusinessTaxiServiceMap, useBusinessTaxiServiceMap } from "@heycar/heyca
469
485
 
470
486
  export default defineComponent({
471
487
  setup() {
472
- const { setMap, registerFitVeiw } = useBusinessTaxiServiceMap();
488
+ const { googleConnectionStatus, setMap, registerFitVeiw } = useBusinessTaxiServiceMap();
473
489
  return () => (
474
490
  <BusinessTaxiServiceMap
475
491
  class={css.adjustedDemo}
@@ -508,6 +524,10 @@ export default defineComponent({
508
524
  interval={5000}
509
525
  mapRef={setMap}
510
526
  registerOverlay={registerFitVeiw}
527
+ onChangeGoogleConnection={(status) =>
528
+ // 根据目前的产品需求,连通性检测只会被检测一次。
529
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
530
+ }
511
531
  />
512
532
  );
513
533
  },
@@ -524,6 +544,7 @@ import { BusinessTaxiEndMap } from "@heycar/heycars-map";
524
544
 
525
545
  export default defineComponent({
526
546
  setup() {
547
+ const { googleConnectionStatus } = useBusinessTaxiEndMap();
527
548
  return () => (
528
549
  <BusinessTaxiEndMap
529
550
  class={"demo"}
@@ -541,6 +562,10 @@ export default defineComponent({
541
562
  displayName: "长城美华 Coffee Shop (CCMW)",
542
563
  type: "wgs84",
543
564
  }}
565
+ onChangeGoogleConnection={(status) =>
566
+ // 根据目前的产品需求,连通性检测只会被检测一次。
567
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
568
+ }
544
569
  />
545
570
  );
546
571
  },
package/dist/v2/App.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { h } from "vue";
2
2
  import { defineComponent } from "vue-demi";
3
- import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
3
+ import { DemoBusinessTaxiEnd } from "./Demo/DemoBusinessTaxiEnd.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCRtkaNSWMOhOXDOUpJK4OVbm5RIstYj-I";
6
6
  const gmapId = "d0af0c05331af64a";
@@ -19,7 +19,7 @@ const App = defineComponent({
19
19
  "language": "en",
20
20
  "supplier": "amap"
21
21
  }
22
- }, [h(DemoBusinessQuoting)]);
22
+ }, [h(DemoBusinessTaxiEnd)]);
23
23
  }
24
24
  });
25
25
  export {
@@ -5,10 +5,11 @@ 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
+ googleConnectionStatus,
8
9
  setMap,
9
10
  registerFitVeiw
10
11
  } = useBusinessQuotingMap();
11
- return () => h(BusinessQuotingMap, {
12
+ return () => h("div", [h("div", [googleConnectionStatus.value]), h(BusinessQuotingMap, {
12
13
  "class": demo,
13
14
  "attrs": {
14
15
  "from": {
@@ -36,9 +37,13 @@ const DemoBusinessQuoting = defineSetup("DemoBusinessQuoting", function() {
36
37
  },
37
38
  "on": {
38
39
  "clickStartPoint": (place) => console.log("点击起点时触发 palce = ", place),
39
- "clickEndPoint": (place) => console.log("点击终点时触发 palce = ", place)
40
+ "clickEndPoint": (place) => console.log("点击终点时触发 palce = ", place),
41
+ "changeGoogleConnection": (status) => (
42
+ // 根据目前的产品需求,连通性检测只会被检测一次。
43
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
44
+ )
40
45
  }
41
- });
46
+ })]);
42
47
  });
43
48
  export {
44
49
  DemoBusinessQuoting
@@ -1,5 +1,5 @@
1
1
  import { h } from "vue";
2
- import { BusinessRecomendPlaceMap } from "../business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.5a7d5831.js";
3
3
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
@@ -53,6 +53,7 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
53
53
  centerPlace,
54
54
  mapContext,
55
55
  geoPosition,
56
+ googleConnectionStatus,
56
57
  setCenterPlaceByUserSpecified,
57
58
  setCenterPlaceByUserSpecifiedInZone
58
59
  } = useBusinessRecomendPlaceMap();
@@ -104,7 +105,7 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
104
105
  }
105
106
  });
106
107
  return () => {
107
- return h("div", [h("div", [JSON.stringify(centerPlace)]), h("div", [JSON.stringify(geoPosition.value)]), h(BusinessRecomendPlaceMap, {
108
+ return h("div", [h("div", [googleConnectionStatus.value]), h("div", [JSON.stringify(centerPlace)]), h("div", [JSON.stringify(geoPosition.value)]), h(BusinessRecomendPlaceMap, {
108
109
  "class": demo,
109
110
  "attrs": {
110
111
  "geoLoadingTitle": "正在获取您当前的位置",
@@ -149,7 +150,11 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
149
150
  },
150
151
  "geoErrorOnce": (isBusinessTimeout) => {
151
152
  console.log("获取GPS失败时触发, 只触发一次, ", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
152
- }
153
+ },
154
+ "changeGoogleConnection": (status) => (
155
+ // 根据目前的产品需求,连通性检测只会被检测一次。
156
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
157
+ )
153
158
  }
154
159
  })]);
155
160
  };
@@ -52,6 +52,7 @@ const DemoBusinessReselectPlace = defineSetup("DemoBusinessReselectPlace", funct
52
52
  const {
53
53
  centerPlace,
54
54
  mapContext,
55
+ googleConnectionStatus,
55
56
  setCenterPlaceByUserSpecified,
56
57
  setCenterPlaceByUserSpecifiedInZone
57
58
  } = useBusinessRecomendPlaceMap();
@@ -109,7 +110,7 @@ const DemoBusinessReselectPlace = defineSetup("DemoBusinessReselectPlace", funct
109
110
  }
110
111
  });
111
112
  return () => {
112
- return h("div", [h("div", [JSON.stringify(centerPlace)]), h(BusinessReselectPlaceMap, {
113
+ return h("div", [h("div", [googleConnectionStatus.value]), h("div", [JSON.stringify(centerPlace)]), h(BusinessReselectPlaceMap, {
113
114
  "class": demo,
114
115
  "attrs": {
115
116
  "unavailableTitle": "当前区域暂未开通服务",
@@ -150,7 +151,11 @@ const DemoBusinessReselectPlace = defineSetup("DemoBusinessReselectPlace", funct
150
151
  },
151
152
  "geoErrorOnce": (isBusinessTimeout) => {
152
153
  console.log("获取GPS失败时触发, 只触发一次, ", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
153
- }
154
+ },
155
+ "changeGoogleConnection": (status) => (
156
+ // 根据目前的产品需求,连通性检测只会被检测一次。
157
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
158
+ )
154
159
  }
155
160
  })]);
156
161
  };
@@ -1,5 +1,7 @@
1
1
  import { type CoordinatePlace } from "../types/interface";
2
- export declare const DemoBusinessTaxiEnd: import("vue-demi").DefineComponent<{}, unknown, {
2
+ export declare const DemoBusinessTaxiEnd: import("vue-demi").DefineComponent<{}, {
3
+ googleConnectionStatus: Readonly<import("vue-demi").Ref<import("../types/interface").GoogleConnectionStatus>>;
4
+ }, {
3
5
  from: CoordinatePlace;
4
6
  to: CoordinatePlace;
5
7
  contentHeight: number;
@@ -1,9 +1,18 @@
1
1
  import { h } from "vue";
2
2
  import { defineComponent } from "vue-demi";
3
3
  import { BusinessTaxiEndMap } from "../business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
4
+ import { useBusinessTaxiEndMap } from "../hooks-business/useBusinessTaxiEndMap.js";
4
5
  import { l as layout, a as adjustedDemo } from "../chunks/Demo.css.e921a2f6.js";
5
6
  const DemoBusinessTaxiEnd = defineComponent({
6
7
  name: "DemoBusinessTaxiEnd",
8
+ setup() {
9
+ const {
10
+ googleConnectionStatus
11
+ } = useBusinessTaxiEndMap();
12
+ return {
13
+ googleConnectionStatus
14
+ };
15
+ },
7
16
  data() {
8
17
  return {
9
18
  from: {
@@ -48,15 +57,22 @@ const DemoBusinessTaxiEnd = defineComponent({
48
57
  const {
49
58
  from,
50
59
  to,
51
- contentHeight
60
+ contentHeight,
61
+ googleConnectionStatus
52
62
  } = this;
53
63
  return h("div", {
54
64
  "class": layout
55
- }, [h("div", [JSON.stringify(from), " | ", JSON.stringify(to)]), h(BusinessTaxiEndMap, {
65
+ }, [h("div", [googleConnectionStatus]), h("div", [JSON.stringify(from), " | ", JSON.stringify(to)]), h(BusinessTaxiEndMap, {
56
66
  "class": adjustedDemo,
57
67
  "attrs": {
58
68
  "from": from,
59
69
  "to": to
70
+ },
71
+ "on": {
72
+ "changeGoogleConnection": (status) => (
73
+ // 根据目前的产品需求,连通性检测只会被检测一次。
74
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
75
+ )
60
76
  }
61
77
  }), h("div", {
62
78
  "style": {
@@ -1,6 +1,7 @@
1
1
  /// <reference types="google.maps" />
2
2
  import { type CoordinatePlace, type CoordinateTrackPoint, type DriverStatus } from "../types/interface";
3
3
  export declare const DemoBusinessTaxiService: import("vue-demi").DefineComponent<Readonly<{}>, {
4
+ googleConnectionStatus: Readonly<import("vue-demi").Ref<import("../types/interface").GoogleConnectionStatus>>;
4
5
  setMap: import("../hooks/useHeycarMap").SetMap<import("../components/Amap/SafeAmap").SafeAmap> | import("../hooks/useHeycarMap").SetMap<google.maps.Map>;
5
6
  registerFitVeiw: import("../types/interface").RegisterOverlay<({
6
7
  _needUpdate: boolean;
@@ -9,10 +9,12 @@ const DemoBusinessTaxiService = defineComponent({
9
9
  name: "DemoBusinessTaxiService",
10
10
  setup() {
11
11
  const {
12
+ googleConnectionStatus,
12
13
  setMap,
13
14
  registerFitVeiw
14
15
  } = useBusinessTaxiServiceMap();
15
16
  return {
17
+ googleConnectionStatus,
16
18
  setMap,
17
19
  registerFitVeiw
18
20
  };
@@ -82,7 +84,8 @@ const DemoBusinessTaxiService = defineComponent({
82
84
  registerFitVeiw,
83
85
  from,
84
86
  to,
85
- status
87
+ status,
88
+ googleConnectionStatus
86
89
  } = this;
87
90
  const isReady = isCoordinatePoint(from) && isCoordinatePoint(to);
88
91
  if (!isReady)
@@ -92,7 +95,7 @@ const DemoBusinessTaxiService = defineComponent({
92
95
  } = this;
93
96
  return h("div", {
94
97
  "class": layout
95
- }, [h(BusinessTaxiServiceMap, {
98
+ }, [h("div", [googleConnectionStatus]), h(BusinessTaxiServiceMap, {
96
99
  "class": adjustedDemo,
97
100
  "attrs": {
98
101
  "from": from,
@@ -113,6 +116,12 @@ const DemoBusinessTaxiService = defineComponent({
113
116
  "interval": 5e3,
114
117
  "mapRef": setMap,
115
118
  "registerOverlay": registerFitVeiw
119
+ },
120
+ "on": {
121
+ "changeGoogleConnection": (status2) => (
122
+ // 根据目前的产品需求,连通性检测只会被检测一次。
123
+ console.log("谷歌连通性发生变化时触发,连通性状态是:", status2)
124
+ )
116
125
  }
117
126
  }), h("div", {
118
127
  "style": {
@@ -0,0 +1,5 @@
1
+ import type { GoogleConnectionStatus } from "../types/interface";
2
+ export type GoogleConnectionOnChangeHandler = (status: GoogleConnectionStatus) => void;
3
+ export type GoogleConnectionOnChangeCleanup = () => void;
4
+ export declare const apiGoogleConnectionStatus: () => GoogleConnectionStatus;
5
+ export declare const apiSubscribeGoogleConnectionChange: (handler: GoogleConnectionOnChangeHandler) => GoogleConnectionOnChangeCleanup;
@@ -0,0 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ const GOOGLE_DNS_RESOLVER = "https://dns.google/resolve?name=maps.googleapis.com&type=A";
8
+ const GOOGLE_CONNECTION_DEFAULT_TIMEOUT = 5e3;
9
+ const noop = () => {
10
+ };
11
+ class GoogleConnection {
12
+ constructor() {
13
+ __publicField(this, "status", "pending");
14
+ __publicField(this, "listeners", /* @__PURE__ */ new Set());
15
+ this.start();
16
+ }
17
+ async start() {
18
+ const status = await this.check();
19
+ this.status = status;
20
+ for (const handler of this.listeners) {
21
+ try {
22
+ handler(status);
23
+ } catch (err) {
24
+ console.error(err);
25
+ }
26
+ }
27
+ }
28
+ check(timeout = GOOGLE_CONNECTION_DEFAULT_TIMEOUT) {
29
+ const controller = new AbortController();
30
+ const timer = setTimeout(() => controller.abort(), timeout);
31
+ return fetch(GOOGLE_DNS_RESOLVER, { signal: controller.signal }).then(() => "connected").catch(() => "unconnected").finally(() => clearTimeout(timer));
32
+ }
33
+ onChange(handler) {
34
+ if (typeof handler !== "function")
35
+ return noop;
36
+ this.listeners.add(handler);
37
+ const clear = () => {
38
+ this.listeners.delete(handler);
39
+ };
40
+ return clear;
41
+ }
42
+ }
43
+ const googleConnection = new GoogleConnection();
44
+ const apiGoogleConnectionStatus = () => {
45
+ return googleConnection.status;
46
+ };
47
+ const apiSubscribeGoogleConnectionChange = (handler) => googleConnection.onChange(handler);
48
+ export {
49
+ apiGoogleConnectionStatus,
50
+ apiSubscribeGoogleConnectionChange
51
+ };
@@ -7,6 +7,27 @@ const point2snappedPoint = (point) => {
7
7
  const [longitude, latitude] = point;
8
8
  return { location: { longitude, latitude }, placeId: "" };
9
9
  };
10
+ function assertLatitudeLongitudeLiteral(value) {
11
+ if (value && typeof value.longitude === "number" && typeof value.latitude === "number")
12
+ return;
13
+ throw Error(`MyError: expect type LatitudeLongitudeLiteral, actual is: ${JSON.stringify(value)}`);
14
+ }
15
+ function assertSnappedPoint(value) {
16
+ if (value)
17
+ assertLatitudeLongitudeLiteral(value.location);
18
+ throw Error(`MyError: expect type SnappedPoint, actual is: ${JSON.stringify(value)}`);
19
+ }
20
+ function assertSnapToRoadsResponse(value) {
21
+ const error = Error(
22
+ `MyError: expect type SnapToRoadsResponse, actual is: ${JSON.stringify(value)}`
23
+ );
24
+ if (typeof value !== "object" || value === null)
25
+ throw error;
26
+ if (!("snappedPoints" in value) || !Array.isArray(value.snappedPoints)) {
27
+ throw "warningMessage" in value && typeof value.warningMessage === "string" ? Error(value.warningMessage) : error;
28
+ }
29
+ value.snappedPoints.forEach(assertSnappedPoint);
30
+ }
10
31
  async function apiGoogleSnapRoad(props) {
11
32
  const { interpolate, path, proxyUrl = googleSnapRoadProxyUrl } = props;
12
33
  if (!proxyUrl)
@@ -21,8 +42,11 @@ async function apiGoogleSnapRoad(props) {
21
42
  url.searchParams.set("interpolate", String(interpolate));
22
43
  url.searchParams.set("path", googleSnapRoadPointsStringify(path));
23
44
  const response = await fetch(url);
24
- if (response.ok)
25
- return await response.json();
45
+ if (response.ok) {
46
+ const result = await response.json();
47
+ assertSnapToRoadsResponse(result);
48
+ return result;
49
+ }
26
50
  const error = await response.json();
27
51
  if (isProxyError(error)) {
28
52
  const { code: code2, msg } = error;
@@ -6,6 +6,6 @@ export interface AuxiliaryLineProps {
6
6
  showDir?: boolean;
7
7
  path: [number, number][];
8
8
  }
9
- export declare const AAuxiliaryLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
10
- export declare const GAuxiliaryLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
11
- export declare const AuxiliaryLine: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
9
+ export declare const AAuxiliaryLine: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
10
+ export declare const GAuxiliaryLine: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
11
+ export declare const AuxiliaryLine: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<AuxiliaryLineProps>, 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<AuxiliaryLineProps, Required<AuxiliaryLineProps>>, never, AuxiliaryLineProps>;
@@ -1,5 +1,4 @@
1
1
  import { h } from "vue";
2
- import { computed } from "vue-demi";
3
2
  import { AMAP_DEFAULT_MARKER_ICON_URL } from "../../api/cdn.js";
4
3
  import { ZINDEX_AUXILIARY_GRASP } from "../../api/contants.js";
5
4
  import { AmapCircle } from "../../components/AmapCircle/AmapCircle.js";
@@ -32,8 +31,6 @@ const AAuxiliaryLine = defineSetup("AAuxiliaryLine", function(props) {
32
31
  opacity = 1,
33
32
  scale = 1
34
33
  } = props;
35
- if (color === "yellow")
36
- console.log("color, path = ", color, path);
37
34
  const vw = window.innerWidth * 0.01;
38
35
  const strokeWidth = 1 * vw;
39
36
  const dashLength = 0.3 * vw;
@@ -110,7 +107,6 @@ const GAuxiliaryLine = defineSetup("GAuxiliaryLine", function(props) {
110
107
  url: AMAP_DEFAULT_MARKER_ICON_URL,
111
108
  scaledSize: new google.maps.Size(defaultMarkerSize * 38 / 63, defaultMarkerSize)
112
109
  };
113
- const pathRef = computed(() => props.path.map(vec2lnglat));
114
110
  return () => {
115
111
  const {
116
112
  type = "dashed",
@@ -118,15 +114,16 @@ const GAuxiliaryLine = defineSetup("GAuxiliaryLine", function(props) {
118
114
  opacity = 1,
119
115
  scale = 1
120
116
  } = props;
117
+ const path = props.path.map(vec2lnglat);
121
118
  const vw = window.innerWidth * 0.01;
122
119
  const strokeWidth = 1.25 * vw * 0.65;
123
- if (pathRef.value.length < 2)
124
- return;
125
120
  switch (type) {
126
121
  case "solid":
122
+ if (path.length < 2)
123
+ return;
127
124
  return h(GmapPolyline, {
128
125
  "attrs": {
129
- "path": pathRef.value,
126
+ "path": path,
130
127
  "strokeWeight": strokeWidth * scale,
131
128
  "strokeOpacity": opacity,
132
129
  "strokeColor": color,
@@ -134,9 +131,11 @@ const GAuxiliaryLine = defineSetup("GAuxiliaryLine", function(props) {
134
131
  }
135
132
  });
136
133
  case "dashed":
134
+ if (path.length < 2)
135
+ return;
137
136
  return h(GmapPolyline, {
138
137
  "attrs": {
139
- "path": pathRef.value,
138
+ "path": path,
140
139
  "icons": [{
141
140
  icon: {
142
141
  path: `M 0,-0.5 0,0.5`,
@@ -153,7 +152,7 @@ const GAuxiliaryLine = defineSetup("GAuxiliaryLine", function(props) {
153
152
  }
154
153
  });
155
154
  case "marker": {
156
- const noneRepeatPath = Object.values(Object.fromEntries(pathRef.value.map((p) => [`${p.lng}|${p.lat}`, p])));
155
+ const noneRepeatPath = Object.values(Object.fromEntries(path.map((p) => [`${p.lng}|${p.lat}`, p])));
157
156
  const points = noneRepeatPath.map((point, idx, list) => idx === list.length - 1 ? h(GmapMarker, {
158
157
  "attrs": {
159
158
  "position": point
@@ -167,7 +166,7 @@ const GAuxiliaryLine = defineSetup("GAuxiliaryLine", function(props) {
167
166
  return h("div", [points]);
168
167
  }
169
168
  case "circle": {
170
- const noneRepeatPath = Object.values(Object.fromEntries(pathRef.value.map((p) => [`${p.lng}|${p.lat}`, p])));
169
+ const noneRepeatPath = Object.values(Object.fromEntries(path.map((p) => [`${p.lng}|${p.lat}`, p])));
171
170
  const points = noneRepeatPath.map((point) => h(GmapCircle, {
172
171
  "attrs": {
173
172
  "center": point,
@@ -1,3 +1,4 @@
1
+ import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
1
2
  import { type HeycarMapProps } from "../../components/MapProvider";
2
3
  import type { MROP } from "../../hooks/useOverlay";
3
4
  import type { CoordinatifyProps } from "../../types/coordinatify";
@@ -14,5 +15,6 @@ export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "ce
14
15
  }) => string;
15
16
  onClickStartPoint?: (value: CoordinatePlace) => void;
16
17
  onClickEndPoint?: (value: CoordinatePlace) => void;
18
+ onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
17
19
  };
18
- export declare const BusinessQuotingMap: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint", BusinessQuotingMapProps>;
20
+ export declare const BusinessQuotingMap: import("vue").DefineComponent<import("vue3").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changeGoogleConnection" | "clickStartPoint" | "clickEndPoint", BusinessQuotingMapProps>;
@@ -1,5 +1,6 @@
1
1
  import { h } from "vue";
2
2
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
3
+ import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
3
4
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
4
5
  import { useMapSupplier } from "../../hooks/useMapSupplier.js";
5
6
  import { defineLagecySetup } from "../../types/helper.js";
@@ -30,6 +31,9 @@ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(prop
30
31
  immediate: true
31
32
  });
32
33
  const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
34
+ useGoogleConnection({
35
+ onChange: (status) => emit("changeGoogleConnection", status)
36
+ });
33
37
  return () => {
34
38
  const {
35
39
  from: inputFromPlace,
@@ -1,3 +1,4 @@
1
+ import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
1
2
  import { type HeycarMapProps } from "../../components/MapProvider";
2
3
  import type { BusinessRecomendPlaceContext } from "../../hooks-business/useBusinessRecomendPlaceMap";
3
4
  import { type UseGeoLocationProps } from "../../hooks/useGeoLocation";
@@ -43,5 +44,6 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
43
44
  onGeoErrorOnce?: (isBusinessTimeout: boolean) => void;
44
45
  onClickLocatorText?: AbsoluteAddressBoxProps["onClickText"];
45
46
  onClickLocatorPhoto?: AbsoluteAddressBoxProps["onClickPhoto"];
47
+ onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
46
48
  }
47
- export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue3").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", BusinessRecomendPlaceMapProps>;
49
+ export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue3").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" | "changeGoogleConnection" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;