@heycar/heycars-map 1.0.0-coordinate7 → 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 +2 -3
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +2 -1
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +44 -17
- 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.87ea3b2f.js → BusinessRecomendPlaceMap.5be4fdcf.js} +38 -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 +8 -34
- 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 +10 -3
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +2 -1
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +44 -17
- 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.57b15c64.js → BusinessRecomendPlaceMap.39888296.js} +38 -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 +8 -34
- 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;
|
|
@@ -93,7 +100,7 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
93
100
|
"style": attrs.style,
|
|
94
101
|
"center": place2point(from),
|
|
95
102
|
"zoom": 13,
|
|
96
|
-
"mapRef":
|
|
103
|
+
"mapRef": setMap,
|
|
97
104
|
"touchEnable": touchEnable,
|
|
98
105
|
"onResize": deferedSetFitView
|
|
99
106
|
}, {
|
|
@@ -180,7 +187,24 @@ const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", funct
|
|
|
180
187
|
}, null)]
|
|
181
188
|
});
|
|
182
189
|
};
|
|
183
|
-
})
|
|
190
|
+
});
|
|
191
|
+
const BusinessTaxiServiceMap = defineLagecySetup("BusinessTaxiServiceMap", function(props, {
|
|
192
|
+
attrs
|
|
193
|
+
}) {
|
|
194
|
+
const payload = useMapSupplier();
|
|
195
|
+
const instanceNo = Date.now();
|
|
196
|
+
return () => createElement(BusinessTaxiServiceMapInner, {
|
|
197
|
+
...attrs.class ? {
|
|
198
|
+
class: attrs.class
|
|
199
|
+
} : {},
|
|
200
|
+
...attrs.style ? {
|
|
201
|
+
style: attrs.style
|
|
202
|
+
} : {},
|
|
203
|
+
attrs: props,
|
|
204
|
+
key: `${payload.supplier}${instanceNo}`
|
|
205
|
+
});
|
|
206
|
+
}).props(["bookDispatchingTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "googleSnapRoadProxyUrl", "fallback", "from", "getDriverPositionTrack", "interval", "disablePassenger", "loading", "mapContext", "renderInServiceTitle", "renderStartSerivceTitle", "to"]);
|
|
184
207
|
export {
|
|
185
|
-
BusinessTaxiServiceMap
|
|
208
|
+
BusinessTaxiServiceMap,
|
|
209
|
+
BusinessTaxiServiceMapInner
|
|
186
210
|
};
|
package/dist/v3/chunks/{BusinessRecomendPlaceMap.57b15c64.js → BusinessRecomendPlaceMap.39888296.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";
|
|
@@ -271,7 +272,7 @@ const EMPTY_PLACE = {
|
|
|
271
272
|
name: "",
|
|
272
273
|
displayName: ""
|
|
273
274
|
};
|
|
274
|
-
const
|
|
275
|
+
const BusinessRecomendPlaceMapInner = defineSetup("BusinessRecomendPlaceMapInner", function(props, {
|
|
275
276
|
emit,
|
|
276
277
|
slots,
|
|
277
278
|
attrs
|
|
@@ -287,6 +288,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
287
288
|
} = props;
|
|
288
289
|
const {
|
|
289
290
|
coordinatifyPoint,
|
|
291
|
+
unCoordinatifyPoint,
|
|
290
292
|
coordinatifyPlace,
|
|
291
293
|
unCoordinatifyPlace,
|
|
292
294
|
unCoordinatifyRecommendZonePlaces,
|
|
@@ -295,6 +297,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
295
297
|
} = useMapCoordinatify();
|
|
296
298
|
const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
|
|
297
299
|
const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
|
|
300
|
+
const {
|
|
301
|
+
apiMapDistance
|
|
302
|
+
} = useMapGeometry();
|
|
298
303
|
const {
|
|
299
304
|
mapRef,
|
|
300
305
|
mapElementRef,
|
|
@@ -413,9 +418,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
413
418
|
emitGeoErrorOnce(error);
|
|
414
419
|
}
|
|
415
420
|
});
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
421
|
+
mapContext.apiMapDistance = (from, to) => {
|
|
422
|
+
return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
|
|
423
|
+
};
|
|
419
424
|
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
420
425
|
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
421
426
|
mapContext.panToGeoPositionByRecomend = () => {
|
|
@@ -495,22 +500,19 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
495
500
|
if (!isFirstLoad)
|
|
496
501
|
updateRecommendPlaceOnlyInZone(defaultCenterPlace);
|
|
497
502
|
});
|
|
498
|
-
watch(centerPlace, () => {
|
|
503
|
+
watch(centerPlace, (place) => {
|
|
499
504
|
if (centerPlaceStatusRef.value === CenterPlaceStatus.OK) {
|
|
500
505
|
apiSaveCenterPlaceToCache(coordinatifyPlace({
|
|
501
|
-
...
|
|
506
|
+
...place
|
|
502
507
|
}));
|
|
503
508
|
}
|
|
504
|
-
mapContext.
|
|
505
|
-
...
|
|
509
|
+
equalAssign(mapContext.centerPlace, coordinatifyPlace({
|
|
510
|
+
...place
|
|
506
511
|
}));
|
|
507
512
|
}, {
|
|
508
513
|
deep: true,
|
|
509
514
|
flush: "post"
|
|
510
515
|
});
|
|
511
|
-
watchEffect(() => {
|
|
512
|
-
mapContext.onChangeRecomendPlaces(placeCandidates.value.map(coordinatifyPlace));
|
|
513
|
-
});
|
|
514
516
|
watchEffect(() => {
|
|
515
517
|
mapContext.centerPlaceStatusRef.value = centerPlaceStatusRef.value;
|
|
516
518
|
});
|
|
@@ -568,6 +570,26 @@ const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", f
|
|
|
568
570
|
}
|
|
569
571
|
});
|
|
570
572
|
};
|
|
573
|
+
});
|
|
574
|
+
const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", function(props, {
|
|
575
|
+
slots,
|
|
576
|
+
attrs,
|
|
577
|
+
emit
|
|
578
|
+
}) {
|
|
579
|
+
const payload = useMapSupplier();
|
|
580
|
+
const instanceNo = Date.now();
|
|
581
|
+
return () => createElement(BusinessRecomendPlaceMapInner, {
|
|
582
|
+
...attrs.class ? {
|
|
583
|
+
class: attrs.class
|
|
584
|
+
} : {},
|
|
585
|
+
...attrs.style ? {
|
|
586
|
+
style: attrs.style
|
|
587
|
+
} : {},
|
|
588
|
+
attrs: props,
|
|
589
|
+
scopedSlots: slots,
|
|
590
|
+
key: `${payload.supplier}${instanceNo}`,
|
|
591
|
+
on: generateCreateElementV2PropsOn(props, emit, ["loadGeoLocation", "loadDefaultGeoLocation", "changeByDrag", "changeGeoLocation", "changePlace", "changeRecomandPlace", "geoError", "geoErrorOnce", "clickLocatorText", "clickLocatorPhoto"])
|
|
592
|
+
});
|
|
571
593
|
}).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "defaultCenterPlace", "geoErrorOnceNotificationKey", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "getRecomendPlace", "getAvailable", "renderPlacePhoto", "renderPlaceTag", "loading", "mapContext"]);
|
|
572
594
|
export {
|
|
573
595
|
BusinessRecomendPlaceMap as B,
|
|
@@ -580,5 +602,6 @@ export {
|
|
|
580
602
|
RECOMMEND_PLACE_ICON_ZOOM_MIN as c,
|
|
581
603
|
RECOMMEND_PLACE_ZONE_TEXT_MIN as d,
|
|
582
604
|
RECOMMEND_PLACE_TEXT_ZOOM_MIN as e,
|
|
605
|
+
BusinessRecomendPlaceMapInner as f,
|
|
583
606
|
memoize as m
|
|
584
607
|
};
|
|
@@ -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(() => {
|
|
@@ -24,16 +24,13 @@ if (detectWebGL() === WEBGL_STATUS.ENABLED) {
|
|
|
24
24
|
const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
25
25
|
slots
|
|
26
26
|
}) {
|
|
27
|
-
const
|
|
28
|
-
statusRef,
|
|
29
|
-
readyPromise
|
|
30
|
-
} = useMapLoader(props);
|
|
27
|
+
const payload = useMapLoader(props);
|
|
31
28
|
const context = new Proxy(props, {
|
|
32
29
|
get(target, name, receiver) {
|
|
33
30
|
if (name === "status")
|
|
34
|
-
return statusRef.value;
|
|
31
|
+
return payload.statusRef.value;
|
|
35
32
|
if (name === "readyPromise")
|
|
36
|
-
return readyPromise;
|
|
33
|
+
return payload.readyPromise;
|
|
37
34
|
return Reflect.get(target, name, receiver);
|
|
38
35
|
}
|
|
39
36
|
});
|
|
@@ -70,7 +67,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
70
67
|
const handleResize = () => emit("resize");
|
|
71
68
|
loadTraditionalChineseConvertOnce(payload.language === "zh-TW");
|
|
72
69
|
return () => {
|
|
73
|
-
var _a, _b, _c, _d, _e, _f
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
74
71
|
const {
|
|
75
72
|
supplier,
|
|
76
73
|
gmapId,
|
|
@@ -85,12 +82,16 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
85
82
|
touchEnable = true,
|
|
86
83
|
touchZoomCenter
|
|
87
84
|
} = props;
|
|
88
|
-
if (status === Status.LOADING)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
if (status === Status.LOADING) {
|
|
86
|
+
const node = (_a = slots.loading) == null ? void 0 : _a.call(slots);
|
|
87
|
+
return node ? createVNode("div", null, [node]) : createVNode(Loading, null, null);
|
|
88
|
+
}
|
|
89
|
+
if (status === Status.FAILURE) {
|
|
90
|
+
const node = (_b = slots.fallback) == null ? void 0 : _b.call(slots);
|
|
91
|
+
return node ? createVNode("div", null, [node]) : createVNode(Loading, null, null);
|
|
92
|
+
}
|
|
93
|
+
const children = (_c = slots.default) == null ? void 0 : _c.call(slots);
|
|
94
|
+
const outArea = (_d = slots.outerArea) == null ? void 0 : _d.call(slots);
|
|
94
95
|
const mapId = patchGmapIdForAlipayCompatible({
|
|
95
96
|
gmapId,
|
|
96
97
|
gmapRasterId,
|
|
@@ -100,7 +101,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
100
101
|
switch (supplier) {
|
|
101
102
|
case "gmap":
|
|
102
103
|
return createVNode("div", {
|
|
103
|
-
"class": `${heycarMap} ${(
|
|
104
|
+
"class": `${heycarMap} ${(_e = attrs.class) != null ? _e : ""}`,
|
|
104
105
|
"lang": language,
|
|
105
106
|
"style": attrs.style
|
|
106
107
|
}, [createVNode(Gmap, {
|
|
@@ -125,7 +126,7 @@ const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
|
125
126
|
}, null), outArea]);
|
|
126
127
|
default:
|
|
127
128
|
return createVNode("div", {
|
|
128
|
-
"class": `${heycarMap} ${(
|
|
129
|
+
"class": `${heycarMap} ${(_f = attrs.class) != null ? _f : ""}`,
|
|
129
130
|
"lang": language,
|
|
130
131
|
"style": attrs.style
|
|
131
132
|
}, [createVNode(Amap, {
|
|
@@ -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,
|