@heycar/heycars-map 0.3.6 → 0.3.8
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/dist/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +1 -2
- package/dist/business-components/AddressBox/AddressBox.d.ts +1 -2
- package/dist/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +1 -0
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -3
- package/dist/business-components/DrivingLine/DrivingLine.d.ts +1 -2
- package/dist/business-components/DrivingRoute/DrivingRoute.d.ts +1 -2
- package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +1 -2
- package/dist/business-components/PickupPoints/PickupPoints.d.ts +1 -2
- package/dist/business-components/PlaceCircle/PlaceCircle.d.ts +1 -2
- package/dist/business-components/StartEndPoint/StartEndPoint.d.ts +1 -2
- package/dist/business-components/TaxiCar/TaxiCar.d.ts +1 -2
- package/dist/business-components/WalkingLine/WalkingLine.d.ts +1 -2
- package/dist/business-components/WalkingRoute/WalkingRoute.d.ts +1 -2
- package/dist/business-components/WaveCircle/WaveCircle.d.ts +1 -2
- package/dist/components/Gmap/Gmap.css.d.ts +1 -0
- package/dist/components/MapProvider/MapProvider.d.ts +1 -2
- package/dist/hooks/useMapAutoComplete.d.ts +1 -2
- package/dist/hooks/useMapPlace.d.ts +2 -1
- package/dist/hooks/useMapRecomendPlace.d.ts +1 -1
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -2
- package/dist/index.cjs +55 -55
- package/dist/index.js +1923 -1999
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/todo.md +16 -4
- package/dist/Demo/CityBound/SearchDemo.d.ts +0 -1
- package/dist/Demo/CityBound/country.d.ts +0 -5
- package/dist/Demo/CityBound/searchResult.d.ts +0 -8
- package/dist/hooks/useMapLog.d.ts +0 -5
- package/src/App.tsx +0 -27
- package/src/Demo/CityBound/SearchDemo.tsx +0 -142
- package/src/Demo/CityBound/country.ts +0 -4179
- package/src/Demo/CityBound/searchResult.ts +0 -21122
- package/src/Demo/Demo.css.ts +0 -6
- package/src/Demo/Demo.tsx +0 -97
- package/src/Demo/DemoBusinessQuoting.tsx +0 -18
- package/src/Demo/DemoBusinessRecomendPlace.tsx +0 -89
- package/src/Demo/DemoBusinessTaxiEnd.tsx +0 -38
- package/src/Demo/DemoBusinessTaxiService.tsx +0 -58
- package/src/Demo/sample.json +0 -793
- package/src/api/contants.ts +0 -3
- package/src/api/driving.ts +0 -87
- package/src/api/geocoder.ts +0 -88
- package/src/api/geometry.ts +0 -44
- package/src/api/place.ts +0 -105
- package/src/assets/icons/svg/address-locator.svg +0 -1
- package/src/assets/icons/svg/arrow-right.svg +0 -1
- package/src/assets/icons/svg/end-point.svg +0 -1
- package/src/assets/icons/svg/passenger-circle.svg +0 -1
- package/src/assets/icons/svg/place-circle.svg +0 -22
- package/src/assets/icons/svg/start-point.svg +0 -1
- package/src/assets/icons/svg/taxi-car.svg +0 -1
- package/src/assets/icons/svg/wave-circle.svg +0 -1
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.ts +0 -68
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +0 -50
- package/src/business-components/AbsoluteAddressBox/index.ts +0 -1
- package/src/business-components/AddressBox/AddressBox.css.ts +0 -55
- package/src/business-components/AddressBox/AddressBox.tsx +0 -76
- package/src/business-components/AddressBox/index.ts +0 -1
- package/src/business-components/AddressLocator/AddressLocator.css.ts +0 -7
- package/src/business-components/AddressLocator/AddressLocator.tsx +0 -40
- package/src/business-components/AddressLocator/index.ts +0 -1
- package/src/business-components/BusinessQuotingMap/BusinessQuotingMap.tsx +0 -49
- package/src/business-components/BusinessQuotingMap/index.ts +0 -1
- package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +0 -200
- package/src/business-components/BusinessRecomendPlaceMap/index.ts +0 -1
- package/src/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.tsx +0 -43
- package/src/business-components/BusinessTaxiEndMap/index.ts +0 -1
- package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +0 -453
- package/src/business-components/BusinessTaxiServiceMap/index.ts +0 -1
- package/src/business-components/DrivingLine/DrivingLine.css.ts +0 -10
- package/src/business-components/DrivingLine/DrivingLine.tsx +0 -135
- package/src/business-components/DrivingLine/index.ts +0 -1
- package/src/business-components/DrivingRoute/DrivingRoute.tsx +0 -52
- package/src/business-components/DrivingRoute/index.ts +0 -1
- package/src/business-components/FitView/FitView.tsx +0 -22
- package/src/business-components/FitView/index.ts +0 -1
- package/src/business-components/PassengerCircle/PassengerCircle.css.ts +0 -21
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +0 -69
- package/src/business-components/PassengerCircle/index.ts +0 -1
- package/src/business-components/PickupPoints/PickupPoints.tsx +0 -38
- package/src/business-components/PickupPoints/index.ts +0 -1
- package/src/business-components/PlaceCircle/PlaceCircle.css.ts +0 -76
- package/src/business-components/PlaceCircle/PlaceCircle.tsx +0 -110
- package/src/business-components/PlaceCircle/index.ts +0 -1
- package/src/business-components/StartEndPoint/StartEndPoint.css.ts +0 -70
- package/src/business-components/StartEndPoint/StartEndPoint.tsx +0 -122
- package/src/business-components/StartEndPoint/index.ts +0 -1
- package/src/business-components/TaxiCar/TaxiCar.css.ts +0 -16
- package/src/business-components/TaxiCar/TaxiCar.tsx +0 -93
- package/src/business-components/TaxiCar/index.ts +0 -1
- package/src/business-components/WalkingLine/WalkingLine.tsx +0 -80
- package/src/business-components/WalkingLine/index.ts +0 -1
- package/src/business-components/WalkingRoute/WalkingRoute.tsx +0 -43
- package/src/business-components/WalkingRoute/index.ts +0 -1
- package/src/business-components/WaveCircle/WaveCircle.css.ts +0 -54
- package/src/business-components/WaveCircle/WaveCircle.tsx +0 -59
- package/src/business-components/WaveCircle/index.ts +0 -1
- package/src/components/Amap/Amap.css.ts +0 -5
- package/src/components/Amap/Amap.ts +0 -76
- package/src/components/Amap/index.ts +0 -1
- package/src/components/AmapInfoWindow/AmapInfoWindow.ts +0 -45
- package/src/components/AmapInfoWindow/index.ts +0 -1
- package/src/components/AmapLoader/AmapLoader.ts +0 -20
- package/src/components/AmapLoader/index.ts +0 -1
- package/src/components/AmapMarker/AmapMarker.ts +0 -48
- package/src/components/AmapMarker/index.ts +0 -1
- package/src/components/AmapPolygon/AmapPolygon.ts +0 -41
- package/src/components/AmapPolygon/index.ts +0 -1
- package/src/components/AmapPolyline/AmapPolyline.ts +0 -40
- package/src/components/AmapPolyline/index.ts +0 -1
- package/src/components/AmapText/AmapText.ts +0 -39
- package/src/components/AmapText/index.ts +0 -1
- package/src/components/Gmap/Gmap.css.ts +0 -5
- package/src/components/Gmap/Gmap.ts +0 -56
- package/src/components/Gmap/index.ts +0 -1
- package/src/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.ts +0 -63
- package/src/components/GmapAdvancedMarkerView/index.ts +0 -1
- package/src/components/GmapInfoWindow/GmapInfoWindow.ts +0 -38
- package/src/components/GmapInfoWindow/index.ts +0 -1
- package/src/components/GmapLoader/GmapLoader.ts +0 -21
- package/src/components/GmapLoader/index.ts +0 -1
- package/src/components/GmapMarker/GmapMarker.ts +0 -34
- package/src/components/GmapMarker/index.ts +0 -1
- package/src/components/GmapPolygon/GmapPolygon.ts +0 -29
- package/src/components/GmapPolygon/index.ts +0 -1
- package/src/components/GmapPolyline/GmapPolyline.ts +0 -29
- package/src/components/GmapPolyline/index.ts +0 -1
- package/src/components/MapProvider/MapProvider.tsx +0 -81
- package/src/components/MapProvider/index.ts +0 -1
- package/src/hooks/useDrivingRoute.ts +0 -106
- package/src/hooks/useGeoLocation.ts +0 -70
- package/src/hooks/useHeycarMap.ts +0 -28
- package/src/hooks/useMap.ts +0 -43
- package/src/hooks/useMapAngle.ts +0 -42
- package/src/hooks/useMapAutoComplete.ts +0 -130
- package/src/hooks/useMapCityBound.ts +0 -64
- package/src/hooks/useMapDrag.ts +0 -72
- package/src/hooks/useMapEventSource.ts +0 -20
- package/src/hooks/useMapFitView.ts +0 -135
- package/src/hooks/useMapGeometry.ts +0 -27
- package/src/hooks/useMapLngLatToVw.ts +0 -31
- package/src/hooks/useMapLoader.ts +0 -164
- package/src/hooks/useMapLog.ts +0 -24
- package/src/hooks/useMapPlace.ts +0 -130
- package/src/hooks/useMapRecomendPlace.ts +0 -150
- package/src/hooks/useMapSupplier.ts +0 -16
- package/src/hooks/useOverlay.ts +0 -23
- package/src/hooks/usePlacesLabelDirection.ts +0 -61
- package/src/hooks/useUdate.ts +0 -9
- package/src/hooks/useWaitTimer.ts +0 -25
- package/src/hooks/useWalkingRoute.ts +0 -87
- package/src/hooks-business/useBusinessMapAutoComplete.ts +0 -22
- package/src/hooks-business/useBusinessQuotingMap.ts +0 -11
- package/src/hooks-business/useBusinessRecomendPlaceMap.ts +0 -45
- package/src/hooks-business/useBusinessTaxiServiceMap.ts +0 -12
- package/src/index.ts +0 -33
- package/src/main.ts +0 -6
- package/src/style.css +0 -0
- package/src/types/amap/autocomplete.d.ts +0 -64
- package/src/types/amap/driving.d.ts +0 -170
- package/src/types/amap/geocoder.d.ts +0 -217
- package/src/types/amap/marker.ts +0 -11
- package/src/types/amap/place.d.ts +0 -114
- package/src/types/amap/plugin.d.ts +0 -27
- package/src/types/amap/walking.d.ts +0 -78
- package/src/types/global.d.ts +0 -10
- package/src/types/helper.ts +0 -172
- package/src/types/interface.ts +0 -62
- package/src/types/mapHelper.ts +0 -1
- package/src/utils/compare.ts +0 -189
- package/src/utils/dom.ts +0 -14
- package/src/utils/helper.ts +0 -5
- package/src/utils/transform.ts +0 -68
- package/src/vite-env.d.ts +0 -12
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue-demi";
|
|
2
|
-
import imgAddressLocator from "../../assets/icons/svg/address-locator.svg";
|
|
3
|
-
import { AmapMarker } from "../../components/AmapMarker";
|
|
4
|
-
import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView";
|
|
5
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
6
|
-
import { createElement, defineSetup } from "../../types/helper";
|
|
7
|
-
import { createDom } from "../../utils/dom";
|
|
8
|
-
import { vec2lnglat } from "../../utils/transform";
|
|
9
|
-
import * as css from "./AddressLocator.css";
|
|
10
|
-
interface AddressLocatorProps {
|
|
11
|
-
position: [number, number];
|
|
12
|
-
}
|
|
13
|
-
export const AAddressLocator = defineSetup(function AAddressLocator(props: AddressLocatorProps) {
|
|
14
|
-
const contentRef = computed(
|
|
15
|
-
() => `
|
|
16
|
-
<img src="${imgAddressLocator}" class="${css.addressLocator}">
|
|
17
|
-
`
|
|
18
|
-
);
|
|
19
|
-
return () => (
|
|
20
|
-
<AmapMarker position={props.position} content={contentRef.value} anchor={"bottom-center"} />
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const GAddressLocator = defineSetup(function GAddressLocator(props: AddressLocatorProps) {
|
|
25
|
-
const contentRef = computed(() =>
|
|
26
|
-
createDom("img", { class: css.addressLocator, src: imgAddressLocator })
|
|
27
|
-
);
|
|
28
|
-
return () => (
|
|
29
|
-
<GmapAdvancedMarkerView position={vec2lnglat(props.position)} content={contentRef.value} />
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const AddressLocator = defineSetup(function AddressLocator(props: AddressLocatorProps) {
|
|
34
|
-
const payload = useMapSupplier();
|
|
35
|
-
return () => {
|
|
36
|
-
return createElement(payload.supplier === "gmap" ? GAddressLocator : AAddressLocator, {
|
|
37
|
-
attrs: props,
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AddressLocator";
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
2
|
-
import type { MROP } from "../../hooks/useOverlay";
|
|
3
|
-
import { defineLagecySetup } from "../../types/helper";
|
|
4
|
-
import type { Place } from "../../types/interface";
|
|
5
|
-
import { place2point } from "../../utils/transform";
|
|
6
|
-
import { DrivingLine } from "../DrivingLine";
|
|
7
|
-
import { DrivingRoute } from "../DrivingRoute";
|
|
8
|
-
import { FitViewOnce } from "../FitView";
|
|
9
|
-
import { StartEndPoint } from "../StartEndPoint";
|
|
10
|
-
|
|
11
|
-
export type BusinessQuotingMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
12
|
-
Required<MROP> & {
|
|
13
|
-
from: Place;
|
|
14
|
-
to: Place;
|
|
15
|
-
renderDescription: (titleProps: { distance: number; duration: number }) => string;
|
|
16
|
-
};
|
|
17
|
-
export const BusinessQuotingMap = defineLagecySetup((props: BusinessQuotingMapProps) => {
|
|
18
|
-
const { registerOverlay, mapRef, renderDescription } = props;
|
|
19
|
-
return () => {
|
|
20
|
-
const { from: fromPlace, to: toPlace } = props;
|
|
21
|
-
const from = place2point(fromPlace);
|
|
22
|
-
const to = place2point(toPlace);
|
|
23
|
-
return (
|
|
24
|
-
<HeycarMap mapRef={mapRef} center={from} zoom={13}>
|
|
25
|
-
<StartEndPoint
|
|
26
|
-
type="start"
|
|
27
|
-
registerOverlay={registerOverlay}
|
|
28
|
-
position={from}
|
|
29
|
-
title={fromPlace.name}
|
|
30
|
-
/>
|
|
31
|
-
<DrivingRoute
|
|
32
|
-
to={to}
|
|
33
|
-
from={from}
|
|
34
|
-
render={({ path, distance, duration }) => [
|
|
35
|
-
<DrivingLine path={path} />,
|
|
36
|
-
<StartEndPoint
|
|
37
|
-
type="end"
|
|
38
|
-
registerOverlay={registerOverlay}
|
|
39
|
-
position={to}
|
|
40
|
-
title={toPlace.name}
|
|
41
|
-
description={renderDescription({ distance, duration })}
|
|
42
|
-
/>,
|
|
43
|
-
]}
|
|
44
|
-
/>
|
|
45
|
-
<FitViewOnce registerOverlay={registerOverlay} />
|
|
46
|
-
</HeycarMap>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
}).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to"]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./BusinessQuotingMap";
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { computed, reactive, watchEffect } from "vue";
|
|
2
|
-
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
3
|
-
import type { BusinessRecomendPlaceContext } from "../../hooks-business/useBusinessRecomendPlaceMap";
|
|
4
|
-
import { useGeoLocation, UseGeoLocationProps } from "../../hooks/useGeoLocation";
|
|
5
|
-
import { useHeycarMap } from "../../hooks/useHeycarMap";
|
|
6
|
-
import { useMapDrag, UseMapDragProps } from "../../hooks/useMapDrag";
|
|
7
|
-
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
8
|
-
import type { UseMapPlaceProps } from "../../hooks/useMapPlace";
|
|
9
|
-
import { useMapRecomendPlace, UseMapRecomendPlaceProps } from "../../hooks/useMapRecomendPlace";
|
|
10
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
11
|
-
import { useWaitTimer } from "../../hooks/useWaitTimer";
|
|
12
|
-
import { defineLagecySetup } from "../../types/helper";
|
|
13
|
-
import type { Place, Point } from "../../types/interface";
|
|
14
|
-
import { isPlaceEqual } from "../../utils/transform";
|
|
15
|
-
import { AbsoluteAddressBox, AbsoluteAddressBoxProps } from "../AbsoluteAddressBox";
|
|
16
|
-
import { PassengerCircle } from "../PassengerCircle";
|
|
17
|
-
import { PickupPoints } from "../PickupPoints";
|
|
18
|
-
|
|
19
|
-
const RECOMMEND_PLACE_LIMIT = 30;
|
|
20
|
-
const MAP_DRAG_END_WAIT_ANIMATION = 500;
|
|
21
|
-
|
|
22
|
-
export interface CenterPlaceSource {
|
|
23
|
-
source: "default" | "geo" | "drag" | "recomend" | "api";
|
|
24
|
-
}
|
|
25
|
-
export interface BusinessRecomendPlaceMapProps
|
|
26
|
-
extends Omit<HeycarMapProps, "center" | "zoom" | "mapRef">,
|
|
27
|
-
Pick<UseMapRecomendPlaceProps<CenterPlaceSource>, "getRecomendPlace">,
|
|
28
|
-
MapLogProps {
|
|
29
|
-
geoLoadingTitle: string;
|
|
30
|
-
unavailableTitle: string;
|
|
31
|
-
recomendDescription: string;
|
|
32
|
-
noRecomendDescription: string;
|
|
33
|
-
geoDefaultPosition?: Point;
|
|
34
|
-
mapContext: BusinessRecomendPlaceContext;
|
|
35
|
-
onLoadGeoLocation?: UseGeoLocationProps["onLoad"];
|
|
36
|
-
onLoadDefaultGeoLocation?: UseGeoLocationProps["onLoadDefault"];
|
|
37
|
-
onChangeByDrag?: UseMapDragProps["onChange"];
|
|
38
|
-
onChangeGeoLocation?: UseGeoLocationProps["onChange"];
|
|
39
|
-
onChangePlace?: UseMapPlaceProps["onChange"];
|
|
40
|
-
onChangeCity?: UseMapPlaceProps["onChangeCity"];
|
|
41
|
-
onChangeRecomandPlace?: UseMapRecomendPlaceProps["onChange"];
|
|
42
|
-
onGeoError?: UseGeoLocationProps["onError"];
|
|
43
|
-
onClickLocator?: AbsoluteAddressBoxProps["onClick"];
|
|
44
|
-
}
|
|
45
|
-
export const BusinessRecomendPlaceMap = defineLagecySetup(
|
|
46
|
-
(props: BusinessRecomendPlaceMapProps, { emit }) => {
|
|
47
|
-
useMapLog(props, "BusinessRecomendPlaceMap");
|
|
48
|
-
const { geoDefaultPosition, getRecomendPlace, mapContext } = props;
|
|
49
|
-
const { mapRef, setMap } = useHeycarMap();
|
|
50
|
-
const { readyPromise } = useMapSupplier();
|
|
51
|
-
const { timerStart, timerStop } = useWaitTimer({ interval: MAP_DRAG_END_WAIT_ANIMATION });
|
|
52
|
-
const centerPlace = reactive<Place>({
|
|
53
|
-
lng: geoDefaultPosition?.[0] ?? 0,
|
|
54
|
-
lat: geoDefaultPosition?.[1] ?? 0,
|
|
55
|
-
name: "",
|
|
56
|
-
});
|
|
57
|
-
const centerPoint = computed<Point>(() => [centerPlace.lng, centerPlace.lat]);
|
|
58
|
-
const centerSource: CenterPlaceSource = { source: "geo" };
|
|
59
|
-
const setCenterPlaceByRecomand = (point: Point) => {
|
|
60
|
-
centerSource.source = "api";
|
|
61
|
-
updatePlace(point);
|
|
62
|
-
};
|
|
63
|
-
const setCenterPlaceByUserSpecified = (place: Place) => {
|
|
64
|
-
centerSource.source = "api";
|
|
65
|
-
setPlace(place);
|
|
66
|
-
updateCity(place);
|
|
67
|
-
updateRecomandPlace();
|
|
68
|
-
};
|
|
69
|
-
const setCenterByPlace = (place: Place) => {
|
|
70
|
-
centerSource.source = "api";
|
|
71
|
-
centerPlace.lng = place.lng;
|
|
72
|
-
centerPlace.lat = place.lat;
|
|
73
|
-
centerPlace.name = place.name;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const { geoPosition, geoError, geoLoading } = useGeoLocation({
|
|
77
|
-
geoDefaultPosition,
|
|
78
|
-
onLoad: async (value) => {
|
|
79
|
-
// geo 主入口
|
|
80
|
-
await readyPromise;
|
|
81
|
-
centerSource.source = "geo";
|
|
82
|
-
updatePlace(value.position);
|
|
83
|
-
emit("loadGeoLocation", value);
|
|
84
|
-
},
|
|
85
|
-
onLoadDefault: async (value) => {
|
|
86
|
-
// geo default position 主入口
|
|
87
|
-
await readyPromise;
|
|
88
|
-
centerSource.source = "geo";
|
|
89
|
-
updatePlace(value.position);
|
|
90
|
-
emit("loadDefaultGeoLocation", value);
|
|
91
|
-
},
|
|
92
|
-
onChange: (v) => emit("changeGeoLocation", v),
|
|
93
|
-
onError: (e) => emit("geoError", e),
|
|
94
|
-
});
|
|
95
|
-
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
96
|
-
mapContext.panToGeoPositionByRecomend = () => {
|
|
97
|
-
if (geoError.value) return false;
|
|
98
|
-
setCenterPlaceByRecomand(geoPosition.value);
|
|
99
|
-
return true;
|
|
100
|
-
};
|
|
101
|
-
const { isDragging } = useMapDrag({
|
|
102
|
-
mapRef,
|
|
103
|
-
onChange: (point) => {
|
|
104
|
-
centerSource.source = "drag";
|
|
105
|
-
timerStart();
|
|
106
|
-
updatePlace(point);
|
|
107
|
-
emit("changeByDrag", point);
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
const {
|
|
111
|
-
updatePlace,
|
|
112
|
-
setPlace,
|
|
113
|
-
updateCity,
|
|
114
|
-
updateRecomandPlace,
|
|
115
|
-
placeCandidates,
|
|
116
|
-
availableRef,
|
|
117
|
-
isElectedRef,
|
|
118
|
-
} = useMapRecomendPlace({
|
|
119
|
-
pointRef: centerPoint,
|
|
120
|
-
context: centerSource,
|
|
121
|
-
getRecomendPlace,
|
|
122
|
-
getLimit: (context) => {
|
|
123
|
-
const source = context?.source;
|
|
124
|
-
switch (source) {
|
|
125
|
-
case "drag":
|
|
126
|
-
case "api":
|
|
127
|
-
return RECOMMEND_PLACE_LIMIT;
|
|
128
|
-
case "geo":
|
|
129
|
-
case "default":
|
|
130
|
-
return Infinity;
|
|
131
|
-
default:
|
|
132
|
-
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
onChangePlace: (place) => {
|
|
136
|
-
if (centerSource.source !== "recomend") {
|
|
137
|
-
updateRecomandPlace();
|
|
138
|
-
}
|
|
139
|
-
emit("changePlace", place);
|
|
140
|
-
},
|
|
141
|
-
onChange: async (place) => {
|
|
142
|
-
await timerStop.promise;
|
|
143
|
-
centerSource.source = "recomend";
|
|
144
|
-
Object.assign(centerPlace, { ...place });
|
|
145
|
-
emit("changeRecomandPlace", place);
|
|
146
|
-
},
|
|
147
|
-
onChangeCity: (value) => {
|
|
148
|
-
emit("changeCity", value);
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
watchEffect(() => {
|
|
152
|
-
mapContext.onChangeCenterPlace({ ...centerPlace });
|
|
153
|
-
});
|
|
154
|
-
watchEffect(() => {
|
|
155
|
-
mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
|
|
156
|
-
});
|
|
157
|
-
return () => {
|
|
158
|
-
const title = geoLoading.value
|
|
159
|
-
? props.geoLoadingTitle
|
|
160
|
-
: availableRef.value
|
|
161
|
-
? centerPlace.name
|
|
162
|
-
: props.unavailableTitle;
|
|
163
|
-
const description =
|
|
164
|
-
!availableRef.value || geoLoading.value
|
|
165
|
-
? undefined
|
|
166
|
-
: isElectedRef.value
|
|
167
|
-
? props.recomendDescription
|
|
168
|
-
: props.noRecomendDescription;
|
|
169
|
-
return (
|
|
170
|
-
<HeycarMap center={centerPoint.value} zoom={18} mapRef={setMap} log={props.log}>
|
|
171
|
-
{!geoError.value && <PassengerCircle position={geoPosition.value} />}
|
|
172
|
-
<PickupPoints
|
|
173
|
-
places={placeCandidates.value}
|
|
174
|
-
renderLabel={(place) => (isPlaceEqual(place, centerPlace) ? undefined : place.name)}
|
|
175
|
-
onClick={setCenterByPlace}
|
|
176
|
-
log={props.log}
|
|
177
|
-
/>
|
|
178
|
-
<AbsoluteAddressBox
|
|
179
|
-
title={title}
|
|
180
|
-
description={description}
|
|
181
|
-
type={isDragging.value ? "locator" : "box"}
|
|
182
|
-
log={props.log}
|
|
183
|
-
onClick={() => emit("clickLocator")}
|
|
184
|
-
/>
|
|
185
|
-
</HeycarMap>
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
).props([
|
|
190
|
-
"log",
|
|
191
|
-
"geoLoadingTitle",
|
|
192
|
-
"unavailableTitle",
|
|
193
|
-
"recomendDescription",
|
|
194
|
-
"noRecomendDescription",
|
|
195
|
-
"fallback",
|
|
196
|
-
"geoDefaultPosition",
|
|
197
|
-
"getRecomendPlace",
|
|
198
|
-
"loading",
|
|
199
|
-
"mapContext",
|
|
200
|
-
]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./BusinessRecomendPlaceMap";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BEIJIN_POINT } from "../../api/contants";
|
|
2
|
-
import { HeycarMap } from "../../components/MapProvider";
|
|
3
|
-
import { useHeycarMap } from "../../hooks/useHeycarMap";
|
|
4
|
-
import { useMapFitView } from "../../hooks/useMapFitView";
|
|
5
|
-
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
6
|
-
import { defineSetup } from "../../types/helper";
|
|
7
|
-
import type { Place, Point } from "../../types/interface";
|
|
8
|
-
import { isPlace } from "../../utils/helper";
|
|
9
|
-
import { place2point } from "../../utils/transform";
|
|
10
|
-
import { SectionEndService } from "../BusinessTaxiServiceMap";
|
|
11
|
-
|
|
12
|
-
export interface BusinessTaxiEndMapProps extends MapLogProps {
|
|
13
|
-
from: Partial<Place>;
|
|
14
|
-
to: Partial<Place>;
|
|
15
|
-
}
|
|
16
|
-
export const BusinessTaxiEndMap = defineSetup((props: BusinessTaxiEndMapProps) => {
|
|
17
|
-
useMapLog(props, "BusinessTaxiEndMap");
|
|
18
|
-
const { mapRef, setMap } = useHeycarMap();
|
|
19
|
-
const { registerFitVeiw, setFitView } = useMapFitView({
|
|
20
|
-
mapRef,
|
|
21
|
-
autoFitTimeout: 5000,
|
|
22
|
-
padding: [25, 20, 15, 15],
|
|
23
|
-
});
|
|
24
|
-
return () => {
|
|
25
|
-
const { from, to } = props;
|
|
26
|
-
const isReady = isPlace(from) && isPlace(to);
|
|
27
|
-
const center = isReady ? place2point(from) : ([...BEIJIN_POINT] as Point);
|
|
28
|
-
const zoom = isReady ? 13 : 3;
|
|
29
|
-
return (
|
|
30
|
-
<HeycarMap center={center} zoom={zoom} mapRef={setMap} log={props.log}>
|
|
31
|
-
{isReady && (
|
|
32
|
-
<SectionEndService
|
|
33
|
-
from={from}
|
|
34
|
-
to={to}
|
|
35
|
-
registerOverlay={registerFitVeiw}
|
|
36
|
-
onMapMounted={setFitView}
|
|
37
|
-
log={props.log}
|
|
38
|
-
/>
|
|
39
|
-
)}
|
|
40
|
-
</HeycarMap>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./BusinessTaxiEndMap";
|