@heycar/heycars-map 1.0.0-coordinate6 → 2.0.0-switchMap1
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.
- package/README.md +4 -25
- package/dist/v2/App.js +6 -4
- package/dist/v2/Demo/DemoBusinessQuoting.js +4 -11
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v2/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v2/Demo/DemoBusinessTaxiEnd.js +2 -18
- package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v2/Demo/DemoBusinessTaxiService.js +6 -19
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +42 -11
- package/dist/v2/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +3 -3
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +5 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +3 -1
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +47 -25
- package/dist/v2/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -3
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v2/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +5 -5
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +42 -18
- package/dist/v2/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v2/chunks/{BusinessRecomendPlaceMap.ca62e565.js → BusinessRecomendPlaceMap.5be4fdcf.js} +46 -15
- package/dist/v2/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v2/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v2/components/MapProvider/MapProvider.js +16 -15
- package/dist/v2/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v2/hooks/useMapLoader.d.ts +5 -3
- package/dist/v2/hooks/useMapLoader.js +29 -14
- package/dist/v2/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +5 -2393
- package/dist/v2/hooks-business/useBusinessQuotingMap.js +5 -10
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +9 -40
- package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v2/index.js +1 -1
- package/dist/v2/utils/compare.d.ts +4 -0
- package/dist/v2/utils/compare.js +6 -0
- package/dist/v2/utils/helper.d.ts +4 -0
- package/dist/v2/utils/helper.js +14 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v3/App.js +6 -4
- package/dist/v3/Demo/DemoBusinessQuoting.js +4 -11
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +3 -8
- package/dist/v3/Demo/DemoBusinessReselectPlace.js +2 -7
- package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
- package/dist/v3/Demo/DemoBusinessTaxiEnd.js +3 -17
- package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -2392
- package/dist/v3/Demo/DemoBusinessTaxiService.js +6 -17
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +16 -7
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +42 -11
- package/dist/v3/business-components/BusinessQuotingMap/index.js +3 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +11 -3
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +5 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +3 -1
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +47 -25
- package/dist/v3/business-components/BusinessReselectPlaceMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
- package/dist/v3/business-components/BusinessTaxiEndMap/index.js +3 -2
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +19 -7
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +42 -18
- package/dist/v3/business-components/BusinessTaxiServiceMap/index.js +3 -2
- package/dist/v3/chunks/{BusinessRecomendPlaceMap.c957231c.js → BusinessRecomendPlaceMap.39888296.js} +46 -15
- package/dist/v3/components/AmapMarker/AmapMarker.js +2 -1
- package/dist/v3/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
- package/dist/v3/components/MapProvider/MapProvider.js +16 -15
- package/dist/v3/demi-polyfill/demi-polyfill.d.ts +1 -0
- package/dist/v3/hooks/useMapLoader.d.ts +5 -3
- package/dist/v3/hooks/useMapLoader.js +29 -14
- package/dist/v3/hooks-business/useBusinessAlarm.d.ts +3 -0
- package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +5 -2393
- package/dist/v3/hooks-business/useBusinessQuotingMap.js +5 -10
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +9 -40
- package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
- package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +5 -10
- package/dist/v3/index.js +1 -1
- package/dist/v3/utils/compare.d.ts +4 -0
- package/dist/v3/utils/compare.js +6 -0
- package/dist/v3/utils/helper.d.ts +4 -0
- package/dist/v3/utils/helper.js +14 -0
- package/dist/v3/utils/log.js +1 -1
- package/package.json +1 -1
- package/dist/v2/Demo/Demo.d.ts +0 -3
- package/dist/v2/Demo/Demo.js +0 -1634
- package/dist/v2/components/AmapLoader/AmapLoader.d.ts +0 -5
- package/dist/v2/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v2/components/AmapLoader/index.d.ts +0 -1
- package/dist/v2/components/AmapLoader/index.js +0 -4
- package/dist/v2/components/GmapLoader/GmapLoader.d.ts +0 -5
- package/dist/v2/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v2/components/GmapLoader/index.d.ts +0 -1
- package/dist/v2/components/GmapLoader/index.js +0 -4
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +0 -7
- package/dist/v3/Demo/Demo.d.ts +0 -9
- package/dist/v3/Demo/Demo.js +0 -1612
- package/dist/v3/components/AmapLoader/AmapLoader.d.ts +0 -10
- package/dist/v3/components/AmapLoader/AmapLoader.js +0 -21
- package/dist/v3/components/AmapLoader/index.d.ts +0 -1
- package/dist/v3/components/AmapLoader/index.js +0 -4
- package/dist/v3/components/GmapLoader/GmapLoader.d.ts +0 -10
- package/dist/v3/components/GmapLoader/GmapLoader.js +0 -21
- package/dist/v3/components/GmapLoader/index.d.ts +0 -1
- package/dist/v3/components/GmapLoader/index.js +0 -4
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
- package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +0 -7
|
@@ -3,42 +3,52 @@ import { ref, watch } 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 {
|
|
10
|
+
import { useMapFitView } from "../../hooks/useMapFitView.js";
|
|
11
|
+
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
12
|
+
import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
11
13
|
import { assertNotEmptyArray } from "../../utils/helper.js";
|
|
12
|
-
import { place2point,
|
|
14
|
+
import { place2point, pipeDefer, lnglat2point } from "../../utils/transform.js";
|
|
13
15
|
import { toCoordinatePlaceType, toCoordinateTrackPoint } from "../../utils/typeChecking.js";
|
|
14
16
|
import { AuxiliaryGraspRoad } from "../AuxiliaryGraspRoad/AuxiliaryGraspRoad.js";
|
|
15
17
|
import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
|
|
16
18
|
import { SectionDispatching, SectionConfirmed, SectionDriverStartService, SectionBookDispatched, SectionInService, SectionDriverArrived, SectionCanceled, SectionEndService } from "./BusinessTaxiServiceSection.js";
|
|
17
19
|
const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
|
|
20
|
+
const BUSINESS_TAXI_SERVICE_FITVIEW_PANDING = [19, 36, 19, 26];
|
|
18
21
|
const IS_ENABLE_AUXILIARY_GRASP_ROAD = apiGetAuxiliaryGrapStatus();
|
|
19
|
-
const
|
|
20
|
-
attrs
|
|
21
|
-
emit
|
|
22
|
+
const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", function(props, {
|
|
23
|
+
attrs
|
|
22
24
|
}) {
|
|
23
25
|
const {
|
|
24
26
|
interval,
|
|
25
27
|
disablePassenger,
|
|
26
|
-
|
|
27
|
-
mapRef: outerSetMap,
|
|
28
|
+
mapContext,
|
|
28
29
|
getDriverPositionTrack,
|
|
29
30
|
renderStartSerivceTitle,
|
|
30
31
|
renderInServiceTitle
|
|
31
32
|
} = props;
|
|
32
33
|
setGlobalGoogleSnapRoadProxyUrl(props.googleSnapRoadProxyUrl);
|
|
34
|
+
const {
|
|
35
|
+
mapRef,
|
|
36
|
+
setMap,
|
|
37
|
+
mapElementRef
|
|
38
|
+
} = useHeycarMap();
|
|
33
39
|
const {
|
|
34
40
|
unCoordinatifyPlace,
|
|
35
41
|
unCoordinatifyTrackPoint
|
|
36
42
|
} = useMapCoordinatify();
|
|
37
|
-
const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
|
|
38
43
|
const {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} =
|
|
44
|
+
registerFitVeiw: registerOverlay,
|
|
45
|
+
setFitView
|
|
46
|
+
} = useMapFitView({
|
|
47
|
+
mapRef,
|
|
48
|
+
padding: BUSINESS_TAXI_SERVICE_FITVIEW_PANDING
|
|
49
|
+
});
|
|
50
|
+
mapContext.setFitView = () => setFitView(false);
|
|
51
|
+
const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
|
|
42
52
|
const {
|
|
43
53
|
geoLoading,
|
|
44
54
|
geoPosition,
|
|
@@ -49,9 +59,6 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
49
59
|
const carPositionRef = ref();
|
|
50
60
|
const carAngleRef = ref();
|
|
51
61
|
const carTrackPositionsRef = ref([]);
|
|
52
|
-
useGoogleConnection({
|
|
53
|
-
onChange: (status) => emit("changeGoogleConnection", status)
|
|
54
|
-
});
|
|
55
62
|
watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
56
63
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
57
64
|
return;
|
|
@@ -94,7 +101,7 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
94
101
|
"attrs": {
|
|
95
102
|
"center": place2point(from),
|
|
96
103
|
"zoom": 13,
|
|
97
|
-
"mapRef":
|
|
104
|
+
"mapRef": setMap,
|
|
98
105
|
"touchEnable": touchEnable
|
|
99
106
|
},
|
|
100
107
|
"on": {
|
|
@@ -212,7 +219,24 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
212
219
|
}
|
|
213
220
|
})]);
|
|
214
221
|
};
|
|
215
|
-
})
|
|
222
|
+
});
|
|
223
|
+
const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", function(props, {
|
|
224
|
+
attrs
|
|
225
|
+
}) {
|
|
226
|
+
const payload = useMapSupplier();
|
|
227
|
+
const instanceNo = Date.now();
|
|
228
|
+
return () => createElement(BusinessTaxiServiceMapInner, {
|
|
229
|
+
...attrs.class ? {
|
|
230
|
+
class: attrs.class
|
|
231
|
+
} : {},
|
|
232
|
+
...attrs.style ? {
|
|
233
|
+
style: attrs.style
|
|
234
|
+
} : {},
|
|
235
|
+
attrs: props,
|
|
236
|
+
key: `${payload.supplier}${instanceNo}`
|
|
237
|
+
});
|
|
238
|
+
}).props(["bookDispatchingTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "googleSnapRoadProxyUrl", "fallback", "from", "getDriverPositionTrack", "interval", "disablePassenger", "loading", "mapContext", "renderInServiceTitle", "renderStartSerivceTitle", "to"]);
|
|
216
239
|
export {
|
|
217
|
-
BusinessTaxiServiceMap
|
|
240
|
+
BusinessTaxiServiceMap,
|
|
241
|
+
BusinessTaxiServiceMapInner
|
|
218
242
|
};
|
package/dist/v2/chunks/{BusinessRecomendPlaceMap.ca62e565.js → BusinessRecomendPlaceMap.5be4fdcf.js}
RENAMED
|
@@ -3,21 +3,22 @@ import { computed, watch, watchEffect } 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";
|
|
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
10
|
import { useMapDrag } from "../hooks/useMapDrag.js";
|
|
11
|
+
import { useMapGeometry } from "../hooks/useMapGeometry.js";
|
|
11
12
|
import { useMapRecomendPlace } from "../hooks/useMapRecomendPlace.js";
|
|
12
13
|
import { useMapSupplier } from "../hooks/useMapSupplier.js";
|
|
13
14
|
import { useMapZoom } from "../hooks/useMapZoom.js";
|
|
14
|
-
import { defineLagecySetup } from "../types/helper.js";
|
|
15
|
+
import { defineSetup, defineLagecySetup } from "../types/helper.js";
|
|
15
16
|
import { CenterPlaceStatus } from "../types/interface.js";
|
|
16
|
-
import { watchPostEffectOnce } from "../utils/compare.js";
|
|
17
|
+
import { watchPostEffectOnce, generateCreateElementV2PropsOn } from "../utils/compare.js";
|
|
17
18
|
import { equalAssign, isPlacesInclude } from "../utils/helper.js";
|
|
18
19
|
import { detectBrowserPlatform } from "../utils/platform.js";
|
|
19
20
|
import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../utils/transform.js";
|
|
20
|
-
import { toCoordinateRecommendZonePlacesType, toCoordinatePlaceType } from "../utils/typeChecking.js";
|
|
21
|
+
import { toCoordinatePointType, toCoordinateRecommendZonePlacesType, toCoordinatePlaceType } from "../utils/typeChecking.js";
|
|
21
22
|
import { AbsoluteAddressBox } from "../business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
22
23
|
import { DeviceOrientation } from "../business-components/DeviceOrientation/DeviceOrientation.js";
|
|
23
24
|
import { GreenZone } from "../business-components/GreenZone/GreenZone.js";
|
|
@@ -264,7 +265,14 @@ const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
|
|
|
264
265
|
const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
|
|
265
266
|
const DEFAULT_ZOOM = 17;
|
|
266
267
|
const ZONE_ZOOM = 13.75;
|
|
267
|
-
const
|
|
268
|
+
const EMPTY_PLACE = {
|
|
269
|
+
lng: 0,
|
|
270
|
+
lat: 0,
|
|
271
|
+
type: "wgs84",
|
|
272
|
+
name: "",
|
|
273
|
+
displayName: ""
|
|
274
|
+
};
|
|
275
|
+
const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner", function(props, {
|
|
268
276
|
emit,
|
|
269
277
|
slots,
|
|
270
278
|
attrs
|
|
@@ -280,6 +288,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
280
288
|
} = props;
|
|
281
289
|
const {
|
|
282
290
|
coordinatifyPoint,
|
|
291
|
+
unCoordinatifyPoint,
|
|
283
292
|
coordinatifyPlace,
|
|
284
293
|
unCoordinatifyPlace,
|
|
285
294
|
unCoordinatifyRecommendZonePlaces,
|
|
@@ -288,6 +297,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
288
297
|
} = useMapCoordinatify();
|
|
289
298
|
const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
|
|
290
299
|
const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
|
|
300
|
+
const {
|
|
301
|
+
apiMapDistance
|
|
302
|
+
} = useMapGeometry();
|
|
291
303
|
const {
|
|
292
304
|
mapRef,
|
|
293
305
|
mapElementRef,
|
|
@@ -406,9 +418,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
406
418
|
emitGeoErrorOnce(error);
|
|
407
419
|
}
|
|
408
420
|
});
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
421
|
+
mapContext.apiMapDistance = (from, to) => {
|
|
422
|
+
return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
|
|
423
|
+
};
|
|
412
424
|
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
413
425
|
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
414
426
|
mapContext.panToGeoPositionByRecomend = () => {
|
|
@@ -488,22 +500,19 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
488
500
|
if (!isFirstLoad)
|
|
489
501
|
updateRecommendPlaceOnlyInZone(defaultCenterPlace);
|
|
490
502
|
});
|
|
491
|
-
watch(centerPlace, () => {
|
|
503
|
+
watch(centerPlace, (place) => {
|
|
492
504
|
if (centerPlaceStatusRef.value === CenterPlaceStatus.OK) {
|
|
493
505
|
apiSaveCenterPlaceToCache(coordinatifyPlace({
|
|
494
|
-
...
|
|
506
|
+
...place
|
|
495
507
|
}));
|
|
496
508
|
}
|
|
497
|
-
mapContext.
|
|
498
|
-
...
|
|
509
|
+
equalAssign(mapContext.centerPlace, coordinatifyPlace({
|
|
510
|
+
...place
|
|
499
511
|
}));
|
|
500
512
|
}, {
|
|
501
513
|
deep: true,
|
|
502
514
|
flush: "post"
|
|
503
515
|
});
|
|
504
|
-
watchEffect(() => {
|
|
505
|
-
mapContext.onChangeRecomendPlaces(placeCandidates.value.map(coordinatifyPlace));
|
|
506
|
-
});
|
|
507
516
|
watchEffect(() => {
|
|
508
517
|
mapContext.centerPlaceStatusRef.value = centerPlaceStatusRef.value;
|
|
509
518
|
});
|
|
@@ -572,10 +581,31 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
572
581
|
}
|
|
573
582
|
})]);
|
|
574
583
|
};
|
|
584
|
+
});
|
|
585
|
+
const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", function(props, {
|
|
586
|
+
slots,
|
|
587
|
+
attrs,
|
|
588
|
+
emit
|
|
589
|
+
}) {
|
|
590
|
+
const payload = useMapSupplier();
|
|
591
|
+
const instanceNo = Date.now();
|
|
592
|
+
return () => createElement(BusinessRecomendPlaceMapInner, {
|
|
593
|
+
...attrs.class ? {
|
|
594
|
+
class: attrs.class
|
|
595
|
+
} : {},
|
|
596
|
+
...attrs.style ? {
|
|
597
|
+
style: attrs.style
|
|
598
|
+
} : {},
|
|
599
|
+
attrs: props,
|
|
600
|
+
scopedSlots: slots,
|
|
601
|
+
key: `${payload.supplier}${instanceNo}`,
|
|
602
|
+
on: generateCreateElementV2PropsOn(props, emit, ["loadGeoLocation", "loadDefaultGeoLocation", "changeByDrag", "changeGeoLocation", "changePlace", "changeRecomandPlace", "geoError", "geoErrorOnce", "clickLocatorText", "clickLocatorPhoto"])
|
|
603
|
+
});
|
|
575
604
|
}).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "defaultCenterPlace", "geoErrorOnceNotificationKey", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "getRecomendPlace", "getAvailable", "renderPlacePhoto", "renderPlaceTag", "loading", "mapContext"]);
|
|
576
605
|
export {
|
|
577
606
|
BusinessRecomendPlaceMap as B,
|
|
578
607
|
DEFAULT_ZOOM as D,
|
|
608
|
+
EMPTY_PLACE as E,
|
|
579
609
|
RECOMMEND_PLACE_LARGE_LIMIT as R,
|
|
580
610
|
ZONE_ZOOM as Z,
|
|
581
611
|
RECOMMEND_PLACE_DRAG_LIMIT as a,
|
|
@@ -583,5 +613,6 @@ export {
|
|
|
583
613
|
RECOMMEND_PLACE_ICON_ZOOM_MIN as c,
|
|
584
614
|
RECOMMEND_PLACE_ZONE_TEXT_MIN as d,
|
|
585
615
|
RECOMMEND_PLACE_TEXT_ZOOM_MIN as e,
|
|
616
|
+
BusinessRecomendPlaceMapInner as f,
|
|
586
617
|
memoize as m
|
|
587
618
|
};
|
|
@@ -11,7 +11,8 @@ const AmapMarker = defineSetup("AmapMarker", function(props, { emit }) {
|
|
|
11
11
|
const mapRef = useAmap();
|
|
12
12
|
onMounted(() => {
|
|
13
13
|
referenceCount.add();
|
|
14
|
-
|
|
14
|
+
const { registerOverlay: registerOverlay2, onClick, ...option } = props;
|
|
15
|
+
markerRef.value = new AMap.Marker({ ...option });
|
|
15
16
|
});
|
|
16
17
|
useMapOverlay({ registerOverlay, overlayRef: markerRef });
|
|
17
18
|
onUnmounted(() => {
|
|
@@ -11,7 +11,7 @@ const GmapAdvancedMarkerElement = defineSetup(
|
|
|
11
11
|
const mapRef = useGmap();
|
|
12
12
|
const handleGmpClick = (name) => emit(name, { target: markerRef.value });
|
|
13
13
|
onMounted(() => {
|
|
14
|
-
const { registerOverlay: registerOverlay2, ...markerViewProps } = props;
|
|
14
|
+
const { registerOverlay: registerOverlay2, onClick, ...markerViewProps } = props;
|
|
15
15
|
markerRef.value = new google.maps.marker.AdvancedMarkerElement({ ...markerViewProps });
|
|
16
16
|
});
|
|
17
17
|
onUnmounted(() => {
|
|
@@ -21,16 +21,13 @@ if (detectWebGL() === WEBGL_STATUS.ENABLED) {
|
|
|
21
21
|
const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
22
22
|
slots
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
25
|
-
statusRef,
|
|
26
|
-
readyPromise
|
|
27
|
-
} = useMapLoader(props);
|
|
24
|
+
const payload = useMapLoader(props);
|
|
28
25
|
const context = new Proxy(props, {
|
|
29
26
|
get(target, name, receiver) {
|
|
30
27
|
if (name === "status")
|
|
31
|
-
return statusRef.value;
|
|
28
|
+
return payload.statusRef.value;
|
|
32
29
|
if (name === "readyPromise")
|
|
33
|
-
return readyPromise;
|
|
30
|
+
return payload.readyPromise;
|
|
34
31
|
return Reflect.get(target, name, receiver);
|
|
35
32
|
}
|
|
36
33
|
});
|
|
@@ -67,7 +64,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
67
64
|
const handleResize = () => emit("resize");
|
|
68
65
|
loadTraditionalChineseConvertOnce(payload.language === "zh-TW");
|
|
69
66
|
return () => {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f
|
|
67
|
+
var _a, _b, _c, _d, _e, _f;
|
|
71
68
|
const {
|
|
72
69
|
supplier,
|
|
73
70
|
gmapId,
|
|
@@ -82,12 +79,16 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
82
79
|
touchEnable = true,
|
|
83
80
|
touchZoomCenter
|
|
84
81
|
} = props;
|
|
85
|
-
if (status === Status.LOADING)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
+
}
|
|
86
|
+
if (status === Status.FAILURE) {
|
|
87
|
+
const node = (_b = slots.fallback) == null ? void 0 : _b.call(slots);
|
|
88
|
+
return node ? h("div", [node]) : h(Loading);
|
|
89
|
+
}
|
|
90
|
+
const children = (_c = slots.default) == null ? void 0 : _c.call(slots);
|
|
91
|
+
const outArea = (_d = slots.outerArea) == null ? void 0 : _d.call(slots);
|
|
91
92
|
const mapId = patchGmapIdForAlipayCompatible({
|
|
92
93
|
gmapId,
|
|
93
94
|
gmapRasterId,
|
|
@@ -97,7 +98,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
97
98
|
switch (supplier) {
|
|
98
99
|
case "gmap":
|
|
99
100
|
return h("div", {
|
|
100
|
-
"class": `${heycarMap} ${(
|
|
101
|
+
"class": `${heycarMap} ${(_e = attrs.class) != null ? _e : ""}`,
|
|
101
102
|
"attrs": {
|
|
102
103
|
"lang": language
|
|
103
104
|
},
|
|
@@ -128,7 +129,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
128
129
|
}), outArea]);
|
|
129
130
|
default:
|
|
130
131
|
return h("div", {
|
|
131
|
-
"class": `${heycarMap} ${(
|
|
132
|
+
"class": `${heycarMap} ${(_f = attrs.class) != null ? _f : ""}`,
|
|
132
133
|
"attrs": {
|
|
133
134
|
"lang": language
|
|
134
135
|
},
|
|
@@ -6,6 +6,7 @@ import type { Slot as Slot_V2 } from "vue2/types/v3-setup-context";
|
|
|
6
6
|
import type { ScopedSlot as ScopedSlot_V2 } from "vue2/types/vnode";
|
|
7
7
|
import type { DefineComponent as DefineComponent_V3, HTMLAttributes as HTMLAttributes_V3, ImgHTMLAttributes as ImgHTMLAttributes_V3, Ref as Ref_V3, Slot as Slot_V3, StyleValue as StyleValue_V3, VNodeArrayChildren as VNodeArrayChildren_V3, VNodeChild as VNodeChild_V3, VNode as VNode_V3, WatchOptions as WatchOptions_V3 } from "vue3";
|
|
8
8
|
export * from "vue-demi";
|
|
9
|
+
export type { StyleValue_V2 };
|
|
9
10
|
export type { Data } from "vue2";
|
|
10
11
|
export type { EmitFn } from "vue2/types/v3-setup-context";
|
|
11
12
|
export type { ComponentObjectPropsOptions, ObjectEmitsOptions, PublicProps, SlotsType } from "vue3";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { load as loadAmap } from "@amap/amap-jsapi-loader";
|
|
2
2
|
import { type LoaderOptions } from "@googlemaps/js-api-loader";
|
|
3
3
|
import { type Ref } from "vue-demi";
|
|
4
|
-
import type {
|
|
4
|
+
import type { VNodeChild } from "../demi-polyfill";
|
|
5
5
|
import type { Language } from "../types/interface";
|
|
6
6
|
export declare const DEFAULT_AMAP_PLUGINS: AmapLoaderProps["plugins"];
|
|
7
7
|
export declare const DEFAULT_GMAP_LIBRARIES: LoaderOptions["libraries"];
|
|
@@ -25,20 +25,22 @@ export interface AmapLoaderProps extends Pick<GmapLoaderProps, "fallback" | "loa
|
|
|
25
25
|
apiServiceHost?: string;
|
|
26
26
|
version?: string;
|
|
27
27
|
plugins?: `AMap.${AMap.PluginName}`[];
|
|
28
|
+
disableRef?: Ref<boolean>;
|
|
28
29
|
}
|
|
29
30
|
export declare const useAmapLoader: (props: AmapLoaderProps) => {
|
|
30
31
|
statusRef: import("vue-demi").ShallowRef<Status>;
|
|
31
32
|
readyPromise: Promise<undefined>;
|
|
32
33
|
};
|
|
33
34
|
export interface GmapLoaderProps extends LoaderOptions {
|
|
35
|
+
disableRef?: Ref<boolean>;
|
|
34
36
|
/**
|
|
35
37
|
* Render prop used to switch to loading component.
|
|
36
38
|
*/
|
|
37
|
-
loading?: () =>
|
|
39
|
+
loading?: () => VNodeChild;
|
|
38
40
|
/**
|
|
39
41
|
* Render prop used to switch to error fallback component.
|
|
40
42
|
*/
|
|
41
|
-
fallback?: () =>
|
|
43
|
+
fallback?: () => VNodeChild;
|
|
42
44
|
/**
|
|
43
45
|
* Callback prop used to access `@googlemaps/js-api-loader` and `Status`.
|
|
44
46
|
*
|
|
@@ -551,7 +551,7 @@ var Status = /* @__PURE__ */ ((Status2) => {
|
|
|
551
551
|
return Status2;
|
|
552
552
|
})(Status || {});
|
|
553
553
|
const useAmapLoader = (props) => {
|
|
554
|
-
const { onChange } = props;
|
|
554
|
+
const { disableRef, onChange } = props;
|
|
555
555
|
let resolveLoader;
|
|
556
556
|
let rejectLoader;
|
|
557
557
|
const readyPromise = new Promise((resolve, reject) => {
|
|
@@ -567,8 +567,10 @@ const useAmapLoader = (props) => {
|
|
|
567
567
|
return { ...options, key: apiKey, version: version != null ? version : "2.0" };
|
|
568
568
|
});
|
|
569
569
|
watchPostEffectForDeepOption(
|
|
570
|
-
() => optionsRef.value,
|
|
571
|
-
(options) => {
|
|
570
|
+
() => [optionsRef.value, disableRef == null ? void 0 : disableRef.value],
|
|
571
|
+
([options, disable]) => {
|
|
572
|
+
if (disable)
|
|
573
|
+
return;
|
|
572
574
|
const setStatusAndExecuteCallback = (status) => {
|
|
573
575
|
statusRef.value = status;
|
|
574
576
|
if (status === "SUCCESS")
|
|
@@ -603,7 +605,7 @@ const loadGmapOnce = createRunOnce((opts) => {
|
|
|
603
605
|
return loader.load();
|
|
604
606
|
});
|
|
605
607
|
const useGmapLoader = (props) => {
|
|
606
|
-
const { onChange } = props;
|
|
608
|
+
const { disableRef, onChange } = props;
|
|
607
609
|
let resolveLoader;
|
|
608
610
|
let rejectLoader;
|
|
609
611
|
const readyPromise = new Promise((resolve, reject) => {
|
|
@@ -619,8 +621,10 @@ const useGmapLoader = (props) => {
|
|
|
619
621
|
return options;
|
|
620
622
|
});
|
|
621
623
|
watchPostEffectForDeepOption(
|
|
622
|
-
() => optionsRef.value,
|
|
623
|
-
(options) => {
|
|
624
|
+
() => [optionsRef.value, disableRef == null ? void 0 : disableRef.value],
|
|
625
|
+
([options, disable]) => {
|
|
626
|
+
if (disable)
|
|
627
|
+
return;
|
|
624
628
|
const language = navigator.language;
|
|
625
629
|
const setStatusAndExecuteCallback = (status) => {
|
|
626
630
|
statusRef.value = status;
|
|
@@ -649,22 +653,33 @@ const useGmapLoader = (props) => {
|
|
|
649
653
|
return { statusRef, readyPromise };
|
|
650
654
|
};
|
|
651
655
|
const useMapLoader = (props) => {
|
|
652
|
-
const { gmapKey, amapKey, amapSecret, amapServiceHost,
|
|
653
|
-
|
|
656
|
+
const { gmapKey, amapKey, amapSecret, amapServiceHost, language, onChange } = props;
|
|
657
|
+
const { statusRef: amapStatusRef, readyPromise: amapReadyPromise } = useAmapLoader({
|
|
658
|
+
apiKey: amapKey,
|
|
659
|
+
apiSecret: amapSecret,
|
|
660
|
+
apiServiceHost: amapServiceHost,
|
|
661
|
+
plugins: DEFAULT_AMAP_PLUGINS,
|
|
662
|
+
disableRef: computed(() => props.supplier !== "amap"),
|
|
663
|
+
onChange
|
|
664
|
+
});
|
|
665
|
+
const { statusRef: gmapStatusRef, readyPromise: gmapReadyPromise } = useGmapLoader({
|
|
654
666
|
apiKey: gmapKey,
|
|
655
667
|
language,
|
|
656
668
|
version: "weekly",
|
|
657
669
|
// todo: 需要提前设置 region
|
|
658
670
|
// region: "CN",
|
|
659
671
|
libraries: DEFAULT_GMAP_LIBRARIES,
|
|
660
|
-
|
|
661
|
-
}) : useAmapLoader({
|
|
662
|
-
apiKey: amapKey,
|
|
663
|
-
apiSecret: amapSecret,
|
|
664
|
-
apiServiceHost: amapServiceHost,
|
|
665
|
-
plugins: DEFAULT_AMAP_PLUGINS,
|
|
672
|
+
disableRef: computed(() => props.supplier !== "gmap"),
|
|
666
673
|
onChange
|
|
667
674
|
});
|
|
675
|
+
return {
|
|
676
|
+
get statusRef() {
|
|
677
|
+
return props.supplier === "gmap" ? gmapStatusRef : amapStatusRef;
|
|
678
|
+
},
|
|
679
|
+
get readyPromise() {
|
|
680
|
+
return props.supplier === "gmap" ? gmapReadyPromise : amapReadyPromise;
|
|
681
|
+
}
|
|
682
|
+
};
|
|
668
683
|
};
|
|
669
684
|
export {
|
|
670
685
|
DEFAULT_AMAP_PLUGINS,
|