@heycar/heycars-map 0.1.4 → 0.1.6
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 +6 -2
- package/dist/business-components/AddressBox/AddressBox.d.ts +1 -0
- package/dist/business-components/DrivingRoute/DrivingRoute.d.ts +5 -5
- package/dist/hooks/useGeoLocation.d.ts +22 -0
- package/dist/hooks/useMapAngle.d.ts +8 -9
- package/dist/hooks/useMapDrag.d.ts +10 -23
- package/dist/hooks/useMapPlace.d.ts +32 -0
- package/dist/hooks/useMapReady.d.ts +4 -0
- package/dist/hooks/useMapRecomendPlace.d.ts +830 -0
- package/dist/hooks/useUdate.d.ts +4 -0
- package/dist/hooks-business/useBusinessMapRecomendPlace.d.ts +29 -0
- package/dist/index.cjs +56 -56
- package/dist/index.d.ts +4 -1
- package/dist/index.js +995 -809
- package/dist/style.css +1 -1
- package/dist/types/interface.d.ts +5 -0
- package/dist/utils/compare.d.ts +1 -0
- package/dist/utils/transform.d.ts +3 -0
- package/package.json +2 -2
- package/src/business-components/AddressBox/AddressBox.tsx +9 -3
- package/src/business-components/DrivingRoute/DrivingRoute.tsx +14 -14
- package/src/components/Demo/HeycarDemo.tsx +34 -8
- package/src/hooks/useDrivingRoute.ts +24 -21
- package/src/hooks/useGeoLocation.ts +53 -0
- package/src/hooks/useMapAngle.ts +12 -13
- package/src/hooks/useMapDrag.ts +31 -44
- package/src/hooks/useMapPlace.ts +82 -0
- package/src/hooks/useMapReady.ts +14 -0
- package/src/hooks/useMapRecomendPlace.ts +98 -0
- package/src/hooks/useUdate.ts +9 -0
- package/src/hooks-business/useBusinessMapRecomendPlace.ts +94 -0
- package/src/index.ts +4 -1
- package/src/types/interface.ts +5 -0
- package/src/utils/compare.ts +12 -0
- package/src/utils/transform.ts +10 -0
- package/todo.md +9 -0
package/README.md
CHANGED
|
@@ -100,10 +100,14 @@ npm install @heycar/heycars-map --save
|
|
|
100
100
|
|
|
101
101
|
目前有下列组件可以使用下列 hooks
|
|
102
102
|
|
|
103
|
+
- `useBusinessMapRecomendPlace`
|
|
104
|
+
- `useDrivingRoute`
|
|
105
|
+
- `useGeoLocation`
|
|
103
106
|
- `useHeycarMap`
|
|
104
|
-
- `useMapDrag`
|
|
105
107
|
- `useMapAngle`
|
|
106
|
-
- `
|
|
108
|
+
- `useMapDrag`
|
|
109
|
+
- `useMapPlace`
|
|
110
|
+
- `useMapRecomendPlace`
|
|
107
111
|
|
|
108
112
|
#### 在地图里使用 `AddressBox` ,需要放在 `HeycarMap` 内部
|
|
109
113
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Ref, ShallowRef } from "vue-demi";
|
|
2
1
|
import { UseDrivingRouteProps } from "../../hooks/useDrivingRoute";
|
|
3
2
|
import { VNodeChild } from "../../types/helper";
|
|
4
3
|
import type { Point } from "../../types/interface";
|
|
4
|
+
export type DrivingRouteRenderProps = {
|
|
5
|
+
path: Point[];
|
|
6
|
+
angle?: number;
|
|
7
|
+
};
|
|
5
8
|
export interface DrivingRouteProps extends UseDrivingRouteProps {
|
|
6
|
-
render?: (props:
|
|
7
|
-
pathRef: ShallowRef<Point[]>;
|
|
8
|
-
angleRef: Ref<number | undefined>;
|
|
9
|
-
}) => VNodeChild;
|
|
9
|
+
render?: (props: DrivingRouteRenderProps) => VNodeChild;
|
|
10
10
|
}
|
|
11
11
|
export declare const ADrivingRoute: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<DrivingRouteProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<DrivingRouteProps, Required<DrivingRouteProps>>, never, DrivingRouteProps, {}>;
|
|
12
12
|
export declare const GDrivingRoute: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<DrivingRouteProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<DrivingRouteProps, Required<DrivingRouteProps>>, never, DrivingRouteProps, {}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MapShallowRef, Point } from "../types/interface";
|
|
2
|
+
export interface UseGeoLocationProps {
|
|
3
|
+
mapRef: MapShallowRef;
|
|
4
|
+
onChange?: (value: {
|
|
5
|
+
position: Point;
|
|
6
|
+
coordinate: GeolocationCoordinates;
|
|
7
|
+
}) => any;
|
|
8
|
+
}
|
|
9
|
+
export declare const useGeoLocation: (props: UseGeoLocationProps) => {
|
|
10
|
+
errorRef: import("vue-demi").Ref<GeolocationPositionError | undefined>;
|
|
11
|
+
positionRef: import("vue-demi").Ref<[number, number]>;
|
|
12
|
+
coordinateRef: import("vue-demi").Ref<{
|
|
13
|
+
readonly accuracy: number;
|
|
14
|
+
readonly altitude: number | null;
|
|
15
|
+
readonly altitudeAccuracy: number | null;
|
|
16
|
+
readonly heading: number | null;
|
|
17
|
+
readonly latitude: number;
|
|
18
|
+
readonly longitude: number;
|
|
19
|
+
readonly speed: number | null;
|
|
20
|
+
}>;
|
|
21
|
+
loading: import("vue-demi").Ref<boolean>;
|
|
22
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const useMapAngle: (props: UseMapAngleProps) => import("vue").ComputedRef<number | undefined>;
|
|
2
|
+
import type { Point } from "../types/interface";
|
|
3
|
+
export type UseMapAngleProps<M = AMap.Map | google.maps.Map> = {
|
|
4
|
+
path: Point[];
|
|
5
|
+
map?: M;
|
|
6
|
+
};
|
|
7
|
+
export declare const useAmapAngle: (props: UseMapAngleProps<AMap.Map>) => import("vue-demi").ComputedRef<number | undefined>;
|
|
8
|
+
export declare const useGmapAngle: (props: UseMapAngleProps<google.maps.Map>) => import("vue-demi").ComputedRef<number | undefined>;
|
|
9
|
+
export declare const useMapAngle: (props: UseMapAngleProps) => import("vue-demi").ComputedRef<number | undefined>;
|
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
2
|
import { type ShallowRef } from "vue-demi";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Point } from "../types/interface";
|
|
4
4
|
export declare const ON_CHANGE_CENTER_INTERVAL = 200;
|
|
5
|
-
export interface
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
name: string;
|
|
5
|
+
export interface UseMapDragProps<M = AMap.Map | google.maps.Map> {
|
|
6
|
+
mapRef: ShallowRef<M | undefined>;
|
|
7
|
+
onChange?: (value: Point) => any;
|
|
9
8
|
}
|
|
10
|
-
export declare const useAmapDrag: (
|
|
11
|
-
|
|
12
|
-
lng: number;
|
|
13
|
-
lat: number;
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
9
|
+
export declare const useAmapDrag: (props: UseMapDragProps<AMap.Map>) => {
|
|
10
|
+
centerRef: import("vue-demi").Ref<[number, number]>;
|
|
16
11
|
isDragging: import("vue-demi").Ref<boolean>;
|
|
17
12
|
};
|
|
18
|
-
export declare const useGmapDrag: (
|
|
19
|
-
|
|
20
|
-
lng: number;
|
|
21
|
-
lat: number;
|
|
22
|
-
name: string;
|
|
23
|
-
};
|
|
13
|
+
export declare const useGmapDrag: (props: UseMapDragProps<google.maps.Map>) => {
|
|
14
|
+
centerRef: import("vue-demi").Ref<[number, number]>;
|
|
24
15
|
isDragging: import("vue-demi").Ref<boolean>;
|
|
25
16
|
};
|
|
26
|
-
export declare const useMapDrag: (
|
|
27
|
-
|
|
28
|
-
lng: number;
|
|
29
|
-
lat: number;
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
17
|
+
export declare const useMapDrag: (props: UseMapDragProps) => {
|
|
18
|
+
centerRef: import("vue-demi").Ref<[number, number]>;
|
|
32
19
|
isDragging: import("vue-demi").Ref<boolean>;
|
|
33
20
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import { Ref } from "vue-demi";
|
|
3
|
+
import type { MapShallowRef, Place, Point } from "../types/interface";
|
|
4
|
+
export interface UseMapPlaceProps<M = AMap.Map | google.maps.Map> {
|
|
5
|
+
pointRef: Ref<Point>;
|
|
6
|
+
mapRef: MapShallowRef<M>;
|
|
7
|
+
onChange?: (value: Place) => any;
|
|
8
|
+
}
|
|
9
|
+
export declare const useAmapPlace: (props: UseMapPlaceProps<AMap.Map>) => {
|
|
10
|
+
place: {
|
|
11
|
+
lng: number;
|
|
12
|
+
lat: number;
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
updatePlace: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const useGmapPlace: (props: UseMapPlaceProps<google.maps.Map>) => {
|
|
18
|
+
place: {
|
|
19
|
+
lng: number;
|
|
20
|
+
lat: number;
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
updatePlace: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const useMapPlace: (props: UseMapPlaceProps) => {
|
|
26
|
+
place: {
|
|
27
|
+
lng: number;
|
|
28
|
+
lat: number;
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
updatePlace: () => void;
|
|
32
|
+
};
|