@heycar/heycars-map 1.0.0-coordinate7 → 2.0.0-switchMap10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +45 -52
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/v2/App.js +8 -4
  5. package/dist/v2/Demo/DemoBusinessQuoting.js +6 -12
  6. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +3 -8
  7. package/dist/v2/Demo/DemoBusinessReselectPlace.js +2 -7
  8. package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
  9. package/dist/v2/Demo/DemoBusinessTaxiEnd.js +2 -18
  10. package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -2392
  11. package/dist/v2/Demo/DemoBusinessTaxiService.js +6 -19
  12. package/dist/v2/api/cdn.d.ts +1 -0
  13. package/dist/v2/api/cdn.js +2 -0
  14. package/dist/v2/api/googleSnapRoad.js +7 -2
  15. package/dist/v2/api/pingConnection.d.ts +9 -0
  16. package/dist/v2/api/pingConnection.js +111 -0
  17. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +5 -5
  18. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
  19. package/dist/v2/business-components/BusinessQuotingMap/index.js +3 -2
  20. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -3
  21. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
  22. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +4 -3
  23. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
  24. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
  25. package/dist/v2/business-components/BusinessReselectPlaceMap/index.js +3 -2
  26. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -3
  27. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
  28. package/dist/v2/business-components/BusinessTaxiEndMap/index.js +3 -2
  29. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +5 -5
  30. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
  31. package/dist/v2/business-components/BusinessTaxiServiceMap/index.js +3 -2
  32. package/dist/v2/chunks/{BusinessRecomendPlaceMap.87ea3b2f.js → BusinessRecomendPlaceMap.b4d45108.js} +65 -30
  33. package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
  34. package/dist/v2/components/AmapMarker/AmapMarker.js +2 -1
  35. package/dist/v2/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
  36. package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
  37. package/dist/v2/components/Loading/Loading.d.ts +6 -0
  38. package/dist/v2/components/Loading/Loading.js +4 -2
  39. package/dist/v2/components/Loading/index.js +3 -2
  40. package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
  41. package/dist/v2/components/MapProvider/MapProvider.js +24 -13
  42. package/dist/v2/css/Loading-49e58ced.css +46 -0
  43. package/dist/v2/demi-polyfill/demi-polyfill.d.ts +1 -0
  44. package/dist/v2/hooks/useDrivingRoute.js +4 -0
  45. package/dist/v2/hooks/useMapGCJ02.js +4 -37
  46. package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
  47. package/dist/v2/hooks/useMapGeometry.js +4 -4
  48. package/dist/v2/hooks/useMapGraspRoad.js +1 -2
  49. package/dist/v2/hooks/useMapInChina.d.ts +3 -15
  50. package/dist/v2/hooks/useMapInChina.js +11 -16
  51. package/dist/v2/hooks/useMapLoader.d.ts +18 -10
  52. package/dist/v2/hooks/useMapLoader.js +159 -82
  53. package/dist/v2/hooks/useMapPlace.d.ts +1 -0
  54. package/dist/v2/hooks/useMapPlace.js +52 -44
  55. package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
  56. package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
  57. package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
  58. package/dist/v2/hooks/useMapSupplier.js +17 -0
  59. package/dist/v2/hooks/usePingConnection.d.ts +10 -0
  60. package/dist/v2/hooks/usePingConnection.js +26 -0
  61. package/dist/v2/hooks-business/useBusinessAlarm.d.ts +3 -0
  62. package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
  63. package/dist/v2/hooks-business/useBusinessQuotingMap.js +10 -10
  64. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
  65. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
  66. package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
  67. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
  68. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +5 -10
  69. package/dist/v2/index.js +1 -1
  70. package/dist/v2/types/global.d.ts +3 -0
  71. package/dist/v2/types/interface.d.ts +1 -1
  72. package/dist/v2/utils/ManualAbortError.d.ts +3 -0
  73. package/dist/v2/utils/ManualAbortError.js +14 -0
  74. package/dist/v2/utils/compare.d.ts +4 -0
  75. package/dist/v2/utils/compare.js +6 -0
  76. package/dist/v2/utils/helper.d.ts +6 -0
  77. package/dist/v2/utils/helper.js +43 -0
  78. package/dist/v2/utils/log.js +1 -1
  79. package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
  80. package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
  81. package/dist/v3/App.js +8 -4
  82. package/dist/v3/Demo/DemoBusinessQuoting.js +7 -13
  83. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +3 -8
  84. package/dist/v3/Demo/DemoBusinessReselectPlace.js +2 -7
  85. package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
  86. package/dist/v3/Demo/DemoBusinessTaxiEnd.js +3 -17
  87. package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -2392
  88. package/dist/v3/Demo/DemoBusinessTaxiService.js +6 -17
  89. package/dist/v3/api/cdn.d.ts +1 -0
  90. package/dist/v3/api/cdn.js +2 -0
  91. package/dist/v3/api/googleSnapRoad.js +7 -2
  92. package/dist/v3/api/pingConnection.d.ts +9 -0
  93. package/dist/v3/api/pingConnection.js +111 -0
  94. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +16 -7
  95. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
  96. package/dist/v3/business-components/BusinessQuotingMap/index.js +3 -2
  97. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +10 -3
  98. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
  99. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +4 -3
  100. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
  101. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
  102. package/dist/v3/business-components/BusinessReselectPlaceMap/index.js +3 -2
  103. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
  104. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
  105. package/dist/v3/business-components/BusinessTaxiEndMap/index.js +3 -2
  106. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +19 -7
  107. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
  108. package/dist/v3/business-components/BusinessTaxiServiceMap/index.js +3 -2
  109. package/dist/v3/chunks/{BusinessRecomendPlaceMap.57b15c64.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +65 -30
  110. package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
  111. package/dist/v3/components/AmapMarker/AmapMarker.js +2 -1
  112. package/dist/v3/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
  113. package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
  114. package/dist/v3/components/Loading/Loading.d.ts +8 -0
  115. package/dist/v3/components/Loading/Loading.js +4 -2
  116. package/dist/v3/components/Loading/index.js +3 -2
  117. package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
  118. package/dist/v3/components/MapProvider/MapProvider.js +22 -13
  119. package/dist/v3/css/Loading-49e58ced.css +46 -0
  120. package/dist/v3/demi-polyfill/demi-polyfill.d.ts +1 -0
  121. package/dist/v3/hooks/useDrivingRoute.js +4 -0
  122. package/dist/v3/hooks/useMapGCJ02.js +4 -37
  123. package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
  124. package/dist/v3/hooks/useMapGeometry.js +4 -4
  125. package/dist/v3/hooks/useMapGraspRoad.js +1 -2
  126. package/dist/v3/hooks/useMapInChina.d.ts +3 -15
  127. package/dist/v3/hooks/useMapInChina.js +11 -16
  128. package/dist/v3/hooks/useMapLoader.d.ts +18 -10
  129. package/dist/v3/hooks/useMapLoader.js +159 -82
  130. package/dist/v3/hooks/useMapPlace.d.ts +1 -0
  131. package/dist/v3/hooks/useMapPlace.js +52 -44
  132. package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
  133. package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
  134. package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
  135. package/dist/v3/hooks/useMapSupplier.js +17 -0
  136. package/dist/v3/hooks/usePingConnection.d.ts +10 -0
  137. package/dist/v3/hooks/usePingConnection.js +26 -0
  138. package/dist/v3/hooks-business/useBusinessAlarm.d.ts +3 -0
  139. package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
  140. package/dist/v3/hooks-business/useBusinessQuotingMap.js +10 -10
  141. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
  142. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
  143. package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
  144. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
  145. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +5 -10
  146. package/dist/v3/index.js +1 -1
  147. package/dist/v3/types/global.d.ts +3 -0
  148. package/dist/v3/types/interface.d.ts +1 -1
  149. package/dist/v3/utils/ManualAbortError.d.ts +3 -0
  150. package/dist/v3/utils/ManualAbortError.js +14 -0
  151. package/dist/v3/utils/compare.d.ts +4 -0
  152. package/dist/v3/utils/compare.js +6 -0
  153. package/dist/v3/utils/helper.d.ts +6 -0
  154. package/dist/v3/utils/helper.js +43 -0
  155. package/dist/v3/utils/log.js +1 -1
  156. package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
  157. package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
  158. package/package.json +2 -2
  159. package/dist/v2/Demo/Demo.d.ts +0 -3
  160. package/dist/v2/Demo/Demo.js +0 -1634
  161. package/dist/v2/api/googleConnection.d.ts +0 -5
  162. package/dist/v2/api/googleConnection.js +0 -51
  163. package/dist/v2/components/AmapLoader/AmapLoader.d.ts +0 -5
  164. package/dist/v2/components/AmapLoader/AmapLoader.js +0 -21
  165. package/dist/v2/components/AmapLoader/index.d.ts +0 -1
  166. package/dist/v2/components/AmapLoader/index.js +0 -4
  167. package/dist/v2/components/GmapLoader/GmapLoader.d.ts +0 -5
  168. package/dist/v2/components/GmapLoader/GmapLoader.js +0 -21
  169. package/dist/v2/components/GmapLoader/index.d.ts +0 -1
  170. package/dist/v2/components/GmapLoader/index.js +0 -4
  171. package/dist/v2/css/Loading-523061b9.css +0 -9
  172. package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
  173. package/dist/v2/hooks/useGoogleConnection.js +0 -15
  174. package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
  175. package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +0 -7
  176. package/dist/v3/Demo/Demo.d.ts +0 -9
  177. package/dist/v3/Demo/Demo.js +0 -1612
  178. package/dist/v3/api/googleConnection.d.ts +0 -5
  179. package/dist/v3/api/googleConnection.js +0 -51
  180. package/dist/v3/components/AmapLoader/AmapLoader.d.ts +0 -10
  181. package/dist/v3/components/AmapLoader/AmapLoader.js +0 -21
  182. package/dist/v3/components/AmapLoader/index.d.ts +0 -1
  183. package/dist/v3/components/AmapLoader/index.js +0 -4
  184. package/dist/v3/components/GmapLoader/GmapLoader.d.ts +0 -10
  185. package/dist/v3/components/GmapLoader/GmapLoader.js +0 -21
  186. package/dist/v3/components/GmapLoader/index.d.ts +0 -1
  187. package/dist/v3/components/GmapLoader/index.js +0 -4
  188. package/dist/v3/css/Loading-523061b9.css +0 -9
  189. package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
  190. package/dist/v3/hooks/useGoogleConnection.js +0 -15
  191. package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
  192. package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +0 -7
@@ -1,28 +1,31 @@
1
1
  import { createVNode } from "vue";
2
- import { reactive, watchEffect } from "vue-demi";
2
+ import { reactive, watch, watchEffect, onUnmounted } from "vue-demi";
3
3
  import { apiMemoryShouldSkipByKey } from "../../api/memory.js";
4
4
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
5
+ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
5
6
  import { useGeoLocation } from "../../hooks/useGeoLocation.js";
6
- import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
7
7
  import { useHeycarMap } from "../../hooks/useHeycarMap.js";
8
8
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
9
9
  import { useMapDrag } from "../../hooks/useMapDrag.js";
10
+ import { useMapGeometry } from "../../hooks/useMapGeometry.js";
10
11
  import { useMapRecomendPlace } from "../../hooks/useMapRecomendPlace.js";
12
+ import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
11
13
  import { useMapZoom } from "../../hooks/useMapZoom.js";
12
- import { defineLagecySetup } from "../../types/helper.js";
14
+ import { defineSetup, defineLagecySetup } from "../../types/helper.js";
13
15
  import { CenterPlaceStatus } from "../../types/interface.js";
14
- import { watchPostEffectOnce } from "../../utils/compare.js";
16
+ import { throwNoneManualAbortError, MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
17
+ import { watchPostEffectOnce, generateCreateElementV2PropsOn } from "../../utils/compare.js";
15
18
  import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
16
19
  import { detectBrowserPlatform } from "../../utils/platform.js";
17
20
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
18
- import { toCoordinatePlaceType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
21
+ import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
19
22
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
20
- import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.57b15c64.js";
23
+ import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_DRAG_LIMIT, a as RECOMMEND_PLACE_LARGE_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.6ba5dbb1.js";
21
24
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
22
25
  import { GreenZone } from "../GreenZone/GreenZone.js";
23
26
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
24
27
  import { PickupPoints } from "../PickupPoints/PickupPoints.js";
25
- const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
28
+ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner", function(props, {
26
29
  emit,
27
30
  slots,
28
31
  attrs
@@ -39,8 +42,10 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
39
42
  ...EMPTY_PLACE
40
43
  }
41
44
  } = props;
45
+ const abortController = new AbortController();
42
46
  const {
43
47
  coordinatifyPoint,
48
+ unCoordinatifyPoint,
44
49
  coordinatifyPlace,
45
50
  unCoordinatifyPlace,
46
51
  unCoordinatifyRecommendZonePlaces,
@@ -48,7 +53,10 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
48
53
  coordinatifyGeoPosition
49
54
  } = useMapCoordinatify();
50
55
  const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
51
- const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
56
+ const pipedGetRecomendPlace = pipeOnlyLastEffect((p, context) => getRecomendPlace(coordinatifyPlace(p), context).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
57
+ const {
58
+ apiMapDistance
59
+ } = useMapGeometry();
52
60
  const {
53
61
  mapRef,
54
62
  mapElementRef,
@@ -62,6 +70,9 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
62
70
  mapRef,
63
71
  defaultValue: DEFAULT_ZOOM
64
72
  });
73
+ const {
74
+ assertSupplier
75
+ } = useMapAssertSupplier();
65
76
  const defaultPlace = unCoordinatifyPlace(toCoordinatePlaceType(inputDefaultPlace));
66
77
  const centerPlace = reactive({
67
78
  lng: defaultPlace.lng,
@@ -88,6 +99,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
88
99
  place: inputPlace,
89
100
  recommends: inputRecommends
90
101
  }) => {
102
+ centerSource.source = "api";
91
103
  const place = unCoordinatifyPlace(toCoordinatePlaceType(inputPlace));
92
104
  const recommends = unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(inputRecommends));
93
105
  const isSameZone = recommends.zone && isZoneEqual(recommends.zone, zoneRef.value);
@@ -142,19 +154,19 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
142
154
  emitGeoErrorOnce(error);
143
155
  }
144
156
  });
145
- useGoogleConnection({
146
- onChange: (status) => emit("changeGoogleConnection", status)
157
+ mapContext.apiMapDistance = assertSupplier((from, to) => {
158
+ return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
147
159
  });
148
- mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
149
- mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
150
- mapContext.panToGeoPositionByRecomend = () => {
160
+ mapContext.setCenterPlaceByUserSpecified = assertSupplier(setCenterPlaceByUserSpecified);
161
+ mapContext.setCenterPlaceByUserSpecifiedInZone = assertSupplier(setCenterPlaceByUserSpecifiedInZone);
162
+ mapContext.panToGeoPositionByRecomend = assertSupplier(() => {
151
163
  if (geoError.value)
152
164
  return false;
153
165
  updateCenterPlaceByPoint(geoPosition.value, {
154
166
  source: "geo"
155
167
  });
156
168
  return true;
157
- };
169
+ });
158
170
  const {
159
171
  isDragging
160
172
  } = useMapDrag({
@@ -177,6 +189,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
177
189
  emptyPlaceName: emptyTitle,
178
190
  queryingPlaceName: queryingTitle,
179
191
  context: centerSource,
192
+ signal: abortController.signal,
180
193
  getAvailable: pipedGetAvailable,
181
194
  getRecomendPlace: pipedGetRecomendPlace,
182
195
  getLimit: (context) => {
@@ -189,14 +202,15 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
189
202
  case "default":
190
203
  return RECOMMEND_PLACE_LARGE_LIMIT;
191
204
  default:
192
- throw new Error(`MyError: should not call getLimit on source: ${source}`);
205
+ console.error(new Error(`MyError: should not call getLimit on source: ${source}`));
206
+ return RECOMMEND_PLACE_DRAG_LIMIT;
193
207
  }
194
208
  },
195
209
  onQueryingPlace: (place) => equalAssign(centerPlace, {
196
210
  ...place
197
211
  }),
198
212
  onChangePlace: (place) => emit("changePlace", coordinatifyPlace(place)),
199
- onChange: async ({
213
+ onChange: ({
200
214
  place,
201
215
  inputPlace,
202
216
  isInZone,
@@ -218,18 +232,19 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
218
232
  }));
219
233
  }
220
234
  });
221
- watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace));
222
- watchEffect(() => {
223
- mapContext.onChangeCenterPlace(coordinatifyPlace({
224
- ...centerPlace
235
+ watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace).catch(throwNoneManualAbortError));
236
+ watch(centerPlace, (place) => {
237
+ equalAssign(mapContext.centerPlace, coordinatifyPlace({
238
+ ...place
225
239
  }));
226
- });
227
- watchEffect(() => {
228
- mapContext.onChangeRecomendPlaces(placeCandidates.value.map(coordinatifyPlace));
240
+ }, {
241
+ deep: true,
242
+ flush: "post"
229
243
  });
230
244
  watchEffect(() => {
231
245
  mapContext.centerPlaceStatusRef.value = isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK;
232
246
  });
247
+ onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
233
248
  return () => {
234
249
  var _a;
235
250
  const {
@@ -281,7 +296,28 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
281
296
  }
282
297
  });
283
298
  };
299
+ });
300
+ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
301
+ slots,
302
+ attrs,
303
+ emit
304
+ }) {
305
+ const payload = useMapSupplier();
306
+ const instanceNo = Date.now();
307
+ return () => createElement(BusinessReselectPlaceMapInner, {
308
+ ...attrs.class ? {
309
+ class: attrs.class
310
+ } : {},
311
+ ...attrs.style ? {
312
+ style: attrs.style
313
+ } : {},
314
+ attrs: props,
315
+ scopedSlots: slots,
316
+ key: `${payload.supplier}${instanceNo}`,
317
+ on: generateCreateElementV2PropsOn(props, emit, ["changeGeoLocation", "changePlace", "changeRecomandPlace", "geoError", "geoErrorOnce", "clickLocatorText", "clickLocatorPhoto"])
318
+ });
284
319
  }).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "emptyTitle", "queryingTitle", "recomendDescription", "geoErrorOnceNotificationKey", "disableLocator", "getAvailable", "getRecomendPlace", "renderPlacePhoto", "renderPlaceTag", "mapContext"]);
285
320
  export {
286
- BusinessReselectPlaceMap
321
+ BusinessReselectPlaceMap,
322
+ BusinessReselectPlaceMapInner
287
323
  };
@@ -1,4 +1,5 @@
1
- import { BusinessReselectPlaceMap } from "./BusinessReselectPlaceMap.js";
1
+ import { BusinessReselectPlaceMap, BusinessReselectPlaceMapInner } from "./BusinessReselectPlaceMap.js";
2
2
  export {
3
- BusinessReselectPlaceMap
3
+ BusinessReselectPlaceMap,
4
+ BusinessReselectPlaceMapInner
4
5
  };
@@ -1,10 +1,11 @@
1
- import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
2
1
  import type { Place } from "../../types/interface";
3
2
  export interface BusinessTaxiEndMapProps {
4
3
  from: Partial<Place>;
5
4
  to: Partial<Place>;
6
- onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
7
5
  }
8
- export declare const BusinessTaxiEndMap: import("vue").DefineComponent<import("vue").ComponentObjectPropsOptions<BusinessTaxiEndMapProps>, 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<BusinessTaxiEndMapProps, Required<BusinessTaxiEndMapProps>>, "changeGoogleConnection", import("vue").PublicProps, BusinessTaxiEndMapProps, BusinessTaxiEndMapProps, import("vue").SlotsType<{} & {
6
+ export declare const BusinessTaxiEndMapInner: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiEndMapProps>, 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<BusinessTaxiEndMapProps, Required<BusinessTaxiEndMapProps>>, never, import("@vue/runtime-core").PublicProps, BusinessTaxiEndMapProps, BusinessTaxiEndMapProps, import("@vue/runtime-core").SlotsType<{} & {
7
+ default?: import("../../demi-polyfill").Slot | undefined;
8
+ }>>;
9
+ export declare const BusinessTaxiEndMap: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessTaxiEndMapProps>, 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<BusinessTaxiEndMapProps, Required<BusinessTaxiEndMapProps>>, never, import("@vue/runtime-core").PublicProps, BusinessTaxiEndMapProps, BusinessTaxiEndMapProps, import("@vue/runtime-core").SlotsType<{} & {
9
10
  default?: import("../../demi-polyfill").Slot | undefined;
10
11
  }>>;
@@ -1,17 +1,17 @@
1
1
  import { createVNode } from "vue";
2
2
  import { BEIJIN_POINT } from "../../api/contants.js";
3
3
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
4
- import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
4
+ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
5
5
  import { useHeycarMap } from "../../hooks/useHeycarMap.js";
6
6
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
7
7
  import { useMapFitView } from "../../hooks/useMapFitView.js";
8
+ import { useMapSupplier } from "../../hooks/useMapSupplier.js";
8
9
  import { defineSetup } from "../../types/helper.js";
9
10
  import { place2point, pipeDefer } from "../../utils/transform.js";
10
11
  import { isCoordinatePoint, toCoordinatePlaceType } from "../../utils/typeChecking.js";
11
12
  import { SectionEndService } from "../BusinessTaxiServiceMap/BusinessTaxiServiceSection.js";
12
- const BusinessTaxiEndMap = defineSetup("BusinessTaxiEndMap", function(props, {
13
- attrs,
14
- emit
13
+ const BusinessTaxiEndMapInner = defineSetup("BusinessTaxiEndMapInner", function(props, {
14
+ attrs
15
15
  }) {
16
16
  const {
17
17
  mapRef,
@@ -28,9 +28,6 @@ const BusinessTaxiEndMap = defineSetup("BusinessTaxiEndMap", function(props, {
28
28
  padding: [19, 36, 19, 26]
29
29
  });
30
30
  const deferedSetFitView = pipeDefer(() => registerFitVeiw.setFitView(true));
31
- useGoogleConnection({
32
- onChange: (status) => emit("changeGoogleConnection", status)
33
- });
34
31
  return () => {
35
32
  const {
36
33
  from: inputFrom,
@@ -57,6 +54,23 @@ const BusinessTaxiEndMap = defineSetup("BusinessTaxiEndMap", function(props, {
57
54
  });
58
55
  };
59
56
  });
57
+ const BusinessTaxiEndMap = defineSetup("BusinessTaxiEndMap", function(props, {
58
+ attrs
59
+ }) {
60
+ const payload = useMapSupplier();
61
+ const instanceNo = Date.now();
62
+ return () => createElement(BusinessTaxiEndMapInner, {
63
+ ...attrs.class ? {
64
+ class: attrs.class
65
+ } : {},
66
+ ...attrs.style ? {
67
+ style: attrs.style
68
+ } : {},
69
+ attrs: props,
70
+ key: `${payload.supplier}${instanceNo}`
71
+ });
72
+ });
60
73
  export {
61
- BusinessTaxiEndMap
74
+ BusinessTaxiEndMap,
75
+ BusinessTaxiEndMapInner
62
76
  };
@@ -1,4 +1,5 @@
1
- import { BusinessTaxiEndMap } from "./BusinessTaxiEndMap.js";
1
+ import { BusinessTaxiEndMap, BusinessTaxiEndMapInner } from "./BusinessTaxiEndMap.js";
2
2
  export {
3
- BusinessTaxiEndMap
3
+ BusinessTaxiEndMap,
4
+ BusinessTaxiEndMapInner
4
5
  };
@@ -1,10 +1,8 @@
1
- /// <reference types="google.maps" />
2
- import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
3
1
  import { type HeycarMapProps } from "../../components/MapProvider";
4
- import type { MROP } from "../../hooks/useOverlay";
2
+ import type { BusinessTaxiServiceContext } from "../../hooks-business/useBusinessTaxiServiceMap";
5
3
  import type { CoordinatifyProps } from "../../types/coordinatify";
6
4
  import type { CoordinatePlace, CoordinateTrackPoint, DriverStatus } from "../../types/interface";
7
- export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps, "center" | "zoom">> & Required<MROP> & {
5
+ export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps, "center" | "zoom" | "mapRef">> & {
8
6
  from: CoordinatePlace;
9
7
  to: CoordinatePlace;
10
8
  log?: boolean;
@@ -15,6 +13,7 @@ export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps,
15
13
  interval: number;
16
14
  disablePassenger?: boolean;
17
15
  googleSnapRoadProxyUrl?: string;
16
+ mapContext: CoordinatifyProps<BusinessTaxiServiceContext>;
18
17
  renderStartSerivceTitle: (titleProps: {
19
18
  distance: number;
20
19
  duration: number;
@@ -24,12 +23,25 @@ export type BusinessTaxiServiceMapProps = CoordinatifyProps<Omit<HeycarMapProps,
24
23
  duration: number;
25
24
  }) => string;
26
25
  getDriverPositionTrack?: () => Promise<CoordinateTrackPoint[]>;
27
- onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
28
26
  };
29
- export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changeGoogleConnection", import("vue-demi").PublicProps, BusinessTaxiServiceMapProps, BusinessTaxiServiceMapProps, import("vue-demi").SlotsType<{
27
+ export declare const BusinessTaxiServiceMapInner: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", import("vue-demi").PublicProps, BusinessTaxiServiceMapProps, BusinessTaxiServiceMapProps, import("vue-demi").SlotsType<{
28
+ fallback?: (() => import("vue-demi").VNodeChild) | undefined;
29
+ loading?: (() => import("vue-demi").VNodeChild) | undefined;
30
+ outerArea?: (() => import("vue-demi").VNodeChild) | undefined;
31
+ renderStartSerivceTitle: (titleProps: {
32
+ distance: number;
33
+ duration: number;
34
+ }) => string;
35
+ renderInServiceTitle: (titleProps: {
36
+ distance: number;
37
+ duration: number;
38
+ }) => string;
39
+ } & {
40
+ default?: import("../../demi-polyfill").Slot | undefined;
41
+ }>>;
42
+ export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", import("vue-demi").PublicProps, BusinessTaxiServiceMapProps, BusinessTaxiServiceMapProps, import("vue-demi").SlotsType<{
30
43
  fallback?: (() => import("vue-demi").VNodeChild) | undefined;
31
44
  loading?: (() => import("vue-demi").VNodeChild) | undefined;
32
- mapRef?: ((map: import("../../components/Amap/SafeAmap").SafeAmap | undefined) => void) | ((map: google.maps.Map | undefined) => void) | undefined;
33
45
  outerArea?: (() => import("vue-demi").VNodeChild) | undefined;
34
46
  renderStartSerivceTitle: (titleProps: {
35
47
  distance: number;
@@ -1,44 +1,60 @@
1
1
  import { createVNode } from "vue";
2
- import { ref, watch } from "vue-demi";
2
+ import { ref, watch, onUnmounted } from "vue-demi";
3
3
  import { apiGetAuxiliaryGrapStatus } from "../../api/browser.js";
4
4
  import { setGlobalGoogleSnapRoadProxyUrl } from "../../api/googleSnapRoad.js";
5
5
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
6
+ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
6
7
  import { useGeoLocation } from "../../hooks/useGeoLocation.js";
7
- import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
8
8
  import { useHeycarMap } from "../../hooks/useHeycarMap.js";
9
9
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
10
- import { defineLagecySetup } from "../../types/helper.js";
11
- import { assertNotEmptyArray } from "../../utils/helper.js";
12
- import { place2point, combineHandler, pipeDefer, lnglat2point } from "../../utils/transform.js";
10
+ import { useMapFitView } from "../../hooks/useMapFitView.js";
11
+ import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
12
+ import { defineSetup, defineLagecySetup } from "../../types/helper.js";
13
+ import { MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
14
+ import { createAbortable, assertNotEmptyArray } from "../../utils/helper.js";
15
+ import { place2point, pipeDefer, lnglat2point } from "../../utils/transform.js";
13
16
  import { toCoordinatePlaceType, toCoordinateTrackPoint } from "../../utils/typeChecking.js";
14
17
  import { AuxiliaryGraspRoad } from "../AuxiliaryGraspRoad/AuxiliaryGraspRoad.js";
15
18
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
16
19
  import { SectionDispatching, SectionConfirmed, SectionDriverStartService, SectionBookDispatched, SectionInService, SectionDriverArrived, SectionCanceled, SectionEndService } from "./BusinessTaxiServiceSection.js";
17
20
  const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
21
+ const BUSINESS_TAXI_SERVICE_FITVIEW_PANDING = [19, 36, 19, 26];
18
22
  const IS_ENABLE_AUXILIARY_GRASP_ROAD = apiGetAuxiliaryGrapStatus();
19
- const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", function(props, {
20
- attrs,
21
- emit
23
+ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", function(props, {
24
+ attrs
22
25
  }) {
23
26
  const {
24
27
  interval,
25
28
  disablePassenger,
26
- registerOverlay,
27
- mapRef: outerSetMap,
28
- getDriverPositionTrack,
29
+ mapContext,
29
30
  renderStartSerivceTitle,
30
31
  renderInServiceTitle
31
32
  } = props;
32
33
  setGlobalGoogleSnapRoadProxyUrl(props.googleSnapRoadProxyUrl);
34
+ const {
35
+ mapRef,
36
+ setMap,
37
+ mapElementRef
38
+ } = useHeycarMap();
39
+ const {
40
+ assertSupplier
41
+ } = useMapAssertSupplier();
42
+ const abortController = new AbortController();
43
+ const abortable = createAbortable(abortController.signal);
44
+ const getDriverPositionTrack = abortable(props.getDriverPositionTrack);
33
45
  const {
34
46
  unCoordinatifyPlace,
35
47
  unCoordinatifyTrackPoint
36
48
  } = useMapCoordinatify();
37
- const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
38
49
  const {
39
- setMap,
40
- mapElementRef
41
- } = useHeycarMap();
50
+ registerFitVeiw: registerOverlay,
51
+ setFitView
52
+ } = useMapFitView({
53
+ mapRef,
54
+ padding: BUSINESS_TAXI_SERVICE_FITVIEW_PANDING
55
+ });
56
+ mapContext.setFitView = assertSupplier(() => setFitView(false));
57
+ const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
42
58
  const {
43
59
  geoLoading,
44
60
  geoPosition,
@@ -49,9 +65,6 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
49
65
  const carPositionRef = ref();
50
66
  const carAngleRef = ref();
51
67
  const carTrackPositionsRef = ref([]);
52
- useGoogleConnection({
53
- onChange: (status) => emit("changeGoogleConnection", status)
54
- });
55
68
  watch(() => props.driverStatus, (status, _, onCleanup) => {
56
69
  if (!STATUS_NEED_CAR_POSITION.includes(status))
57
70
  return;
@@ -72,6 +85,7 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
72
85
  }, {
73
86
  immediate: true
74
87
  });
88
+ onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
75
89
  return () => {
76
90
  const {
77
91
  driverStatus,
@@ -93,7 +107,7 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
93
107
  "style": attrs.style,
94
108
  "center": place2point(from),
95
109
  "zoom": 13,
96
- "mapRef": combineHandler(outerSetMap, setMap),
110
+ "mapRef": setMap,
97
111
  "touchEnable": touchEnable,
98
112
  "onResize": deferedSetFitView
99
113
  }, {
@@ -180,7 +194,24 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
180
194
  }, null)]
181
195
  });
182
196
  };
183
- }).props(["bookDispatchingTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "googleSnapRoadProxyUrl", "fallback", "from", "getDriverPositionTrack", "interval", "disablePassenger", "loading", "mapRef", "renderInServiceTitle", "renderStartSerivceTitle", "to", "registerOverlay"]);
197
+ });
198
+ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", function(props, {
199
+ attrs
200
+ }) {
201
+ const payload = useMapSupplier();
202
+ const instanceNo = Date.now();
203
+ return () => createElement(BusinessTaxiServiceMapInner, {
204
+ ...attrs.class ? {
205
+ class: attrs.class
206
+ } : {},
207
+ ...attrs.style ? {
208
+ style: attrs.style
209
+ } : {},
210
+ attrs: props,
211
+ key: `${payload.supplier}${instanceNo}`
212
+ });
213
+ }).props(["bookDispatchingTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "googleSnapRoadProxyUrl", "fallback", "from", "getDriverPositionTrack", "interval", "disablePassenger", "loading", "mapContext", "renderInServiceTitle", "renderStartSerivceTitle", "to"]);
184
214
  export {
185
- BusinessTaxiServiceMap
215
+ BusinessTaxiServiceMap,
216
+ BusinessTaxiServiceMapInner
186
217
  };
@@ -1,4 +1,5 @@
1
- import { BusinessTaxiServiceMap } from "./BusinessTaxiServiceMap.js";
1
+ import { BusinessTaxiServiceMap, BusinessTaxiServiceMapInner } from "./BusinessTaxiServiceMap.js";
2
2
  export {
3
- BusinessTaxiServiceMap
3
+ BusinessTaxiServiceMap,
4
+ BusinessTaxiServiceMapInner
4
5
  };