@heycar/heycars-map 0.2.9 → 0.2.11
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/Demo/DemoBusinessTaxiEnd.d.ts +4 -1
- package/dist/Demo/DemoBusinessTaxiService.d.ts +2054 -1
- package/dist/api/contants.d.ts +2 -0
- package/dist/business-components/AddressBox/AddressBox.d.ts +2 -1
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -1
- package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +3 -2
- package/dist/business-components/DrivingLine/DrivingLine.d.ts +2 -1
- package/dist/business-components/DrivingRoute/DrivingRoute.d.ts +2 -1
- package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +2 -1
- package/dist/business-components/PickupPoints/PickupPoints.d.ts +2 -1
- package/dist/business-components/PlaceCircle/PlaceCircle.d.ts +2 -1
- package/dist/business-components/StartEndPoint/StartEndPoint.d.ts +2 -1
- package/dist/business-components/TaxiCar/TaxiCar.d.ts +2 -1
- package/dist/business-components/WalkingLine/WalkingLine.d.ts +2 -1
- package/dist/business-components/WalkingRoute/WalkingRoute.d.ts +2 -1
- package/dist/business-components/WaveCircle/WaveCircle.d.ts +2 -1
- package/dist/components/MapProvider/MapProvider.d.ts +2 -1
- package/dist/hooks/useMapAutoComplete.d.ts +3 -3
- package/dist/hooks/useMapLog.d.ts +4 -0
- package/dist/hooks/useMapPlace.d.ts +3 -3
- package/dist/hooks/useMapRecomendPlace.d.ts +6 -6
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -1
- package/dist/hooks-business/useBusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/hooks-business/useLagecyMapRecomendPlace.d.ts +2 -2
- package/dist/index.cjs +56 -56
- package/dist/index.js +1431 -1356
- package/dist/types/interface.d.ts +1 -1
- package/dist/utils/helper.d.ts +2 -0
- package/package.json +2 -2
- package/src/App.tsx +3 -3
- package/src/Demo/DemoBusinessRecomendPlace.tsx +42 -12
- package/src/Demo/DemoBusinessTaxiEnd.tsx +34 -9
- package/src/Demo/DemoBusinessTaxiService.tsx +53 -27
- package/src/api/contants.ts +3 -0
- package/src/business-components/AddressBox/AddressBox.tsx +4 -1
- package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +8 -3
- package/src/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.tsx +21 -11
- package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +109 -28
- package/src/business-components/DrivingLine/DrivingLine.tsx +4 -1
- package/src/business-components/DrivingRoute/DrivingRoute.tsx +4 -1
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +4 -1
- package/src/business-components/PickupPoints/PickupPoints.tsx +3 -1
- package/src/business-components/PlaceCircle/PlaceCircle.tsx +4 -1
- package/src/business-components/StartEndPoint/StartEndPoint.tsx +9 -6
- package/src/business-components/TaxiCar/TaxiCar.tsx +4 -1
- package/src/business-components/WalkingLine/WalkingLine.tsx +4 -1
- package/src/business-components/WalkingRoute/WalkingRoute.tsx +4 -1
- package/src/business-components/WaveCircle/WaveCircle.tsx +4 -1
- package/src/components/MapProvider/MapProvider.tsx +4 -1
- package/src/hooks/useMapLog.ts +12 -0
- package/src/hooks/useMapPlace.ts +8 -3
- package/src/types/amap/geocoder.d.ts +2 -0
- package/src/types/interface.ts +1 -1
- package/src/utils/helper.ts +5 -0
|
@@ -2,16 +2,18 @@ import { computed } from "vue-demi";
|
|
|
2
2
|
import imgWaveCircle from "../../assets/icons/svg/wave-circle.svg";
|
|
3
3
|
import { AmapMarker } from "../../components/AmapMarker";
|
|
4
4
|
import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView";
|
|
5
|
+
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
5
6
|
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
6
7
|
import { createElement, defineSetup } from "../../types/helper";
|
|
7
8
|
import { createDom } from "../../utils/dom";
|
|
8
9
|
import { vec2lnglat } from "../../utils/transform";
|
|
9
10
|
import * as css from "./WaveCircle.css";
|
|
10
11
|
|
|
11
|
-
export interface WaveCircleProps {
|
|
12
|
+
export interface WaveCircleProps extends MapLogProps {
|
|
12
13
|
position: [number, number];
|
|
13
14
|
}
|
|
14
15
|
export const AWaveCircle = defineSetup(function AWaveCircle(props: WaveCircleProps) {
|
|
16
|
+
useMapLog(props, "AWaveCircle");
|
|
15
17
|
const contentRef = computed(() => `<img src="${imgWaveCircle}" class="${css.waveCircle}">`);
|
|
16
18
|
const contentAnotherRef = computed(
|
|
17
19
|
() => `<img src="${imgWaveCircle}" class="${css.waveCircle} ${css.secondCircle}">`
|
|
@@ -29,6 +31,7 @@ export const AWaveCircle = defineSetup(function AWaveCircle(props: WaveCirclePro
|
|
|
29
31
|
});
|
|
30
32
|
|
|
31
33
|
export const GWaveCircle = defineSetup(function AWaveCircle(props: WaveCircleProps) {
|
|
34
|
+
useMapLog(props, "GWaveCircle");
|
|
32
35
|
const contentRef = computed(() =>
|
|
33
36
|
createDom("img", { class: css.waveCircle, src: imgWaveCircle })
|
|
34
37
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SetMap } from "../../hooks/useHeycarMap";
|
|
2
2
|
import { GmapLoaderProps, Status, useMapLoader, UseMapLoaderProps } from "../../hooks/useMapLoader";
|
|
3
|
+
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
3
4
|
import { MapSupplierPayolad, provideMapSupplier, useMapSupplier } from "../../hooks/useMapSupplier";
|
|
4
5
|
import { defineLagecySetup } from "../../types/helper";
|
|
5
6
|
import { language2vectorMapForeign, vec2lnglat } from "../../utils/transform";
|
|
@@ -25,7 +26,8 @@ export const MapProvider = defineLagecySetup(function MapProvider(
|
|
|
25
26
|
|
|
26
27
|
export interface HeycarMapProps
|
|
27
28
|
extends Pick<GmapLoaderProps, "fallback" | "loading">,
|
|
28
|
-
Pick<AmapProps, "center" | "zoom"
|
|
29
|
+
Pick<AmapProps, "center" | "zoom">,
|
|
30
|
+
MapLogProps {
|
|
29
31
|
mapRef?: SetMap<AMap.Map> | SetMap<google.maps.Map>;
|
|
30
32
|
onDragEnd?: (value: [number, number]) => any;
|
|
31
33
|
}
|
|
@@ -33,6 +35,7 @@ export const HeycarMap = defineLagecySetup(function HeycarMap(
|
|
|
33
35
|
props: HeycarMapProps,
|
|
34
36
|
{ slots, emit }
|
|
35
37
|
) {
|
|
38
|
+
useMapLog(props, "HeycarMap");
|
|
36
39
|
const payload = useMapSupplier();
|
|
37
40
|
const gmapDebouncedEmit: GmapProps["onDragEnd"] = ({ target }) => {
|
|
38
41
|
const { lng, lat } = target.getCenter() as google.maps.LatLng;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { watchEffect } from "vue-demi";
|
|
2
|
+
|
|
3
|
+
export interface MapLogProps {
|
|
4
|
+
log?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const useMapLog = <P extends MapLogProps>(props: P, name: string) => {
|
|
8
|
+
watchEffect(() => {
|
|
9
|
+
if (!props.log) return;
|
|
10
|
+
console.log(`log ${name} props = `, { ...props });
|
|
11
|
+
});
|
|
12
|
+
};
|
package/src/hooks/useMapPlace.ts
CHANGED
|
@@ -33,11 +33,13 @@ export const useAmapPlace = (props: UseMapPlaceProps) => {
|
|
|
33
33
|
const cityName = addressComponent.city
|
|
34
34
|
? addressComponent.city
|
|
35
35
|
: addressComponent.province;
|
|
36
|
+
const countryName = addressComponent.country;
|
|
36
37
|
place.name = name;
|
|
37
38
|
place.lng = lng;
|
|
38
39
|
place.lat = lat;
|
|
39
40
|
place.cityName = cityName;
|
|
40
|
-
|
|
41
|
+
place.countryName = countryName;
|
|
42
|
+
onChange?.({ lng, lat, name, cityName, countryName });
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -68,10 +70,13 @@ export const useGmapPlace = (props: UseMapPlaceProps) => {
|
|
|
68
70
|
const { results } = await geocoder.geocode({ language: LANGUAGE, location: { lng, lat } });
|
|
69
71
|
const name = results[0].formatted_address;
|
|
70
72
|
const cityName = geocoderResult2cityName(results[0]);
|
|
71
|
-
|
|
73
|
+
const countryName = results.slice(-1)[0].address_components[0].long_name;
|
|
72
74
|
place.lng = lng;
|
|
73
75
|
place.lat = lat;
|
|
74
|
-
|
|
76
|
+
place.name = name;
|
|
77
|
+
place.cityName = cityName;
|
|
78
|
+
place.countryName = countryName;
|
|
79
|
+
onChange?.({ lng, lat, name, cityName, countryName });
|
|
75
80
|
}
|
|
76
81
|
);
|
|
77
82
|
return { place, updatePlace };
|
package/src/types/interface.ts
CHANGED