@heycar/heycars-map 0.3.0 → 0.3.2

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.
Files changed (31) hide show
  1. package/README.md +1 -1
  2. package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +3 -1
  3. package/dist/hooks/useMapAutoComplete.d.ts +10 -6
  4. package/dist/hooks/useMapCityBound.d.ts +5 -5
  5. package/dist/hooks/useMapLog.d.ts +2 -1
  6. package/dist/hooks/useMapPlace.d.ts +13 -2
  7. package/dist/hooks/useMapRecomendPlace.d.ts +12 -2
  8. package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +4 -2
  9. package/dist/hooks-business/useBusinessRecomendPlaceMap.d.ts +4 -2
  10. package/dist/index.cjs +52 -52
  11. package/dist/index.js +1095 -1064
  12. package/dist/style.css +1 -1
  13. package/dist/types/interface.d.ts +2 -1
  14. package/package.json +1 -1
  15. package/src/Demo/DemoBusinessRecomendPlace.tsx +16 -8
  16. package/src/Demo/sample.json +793 -0
  17. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.ts +2 -0
  18. package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +5 -3
  19. package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +26 -22
  20. package/src/hooks/useGeoLocation.ts +6 -2
  21. package/src/hooks/useMapAutoComplete.ts +7 -5
  22. package/src/hooks/useMapCityBound.ts +5 -5
  23. package/src/hooks/useMapDrag.ts +7 -2
  24. package/src/hooks/useMapLog.ts +14 -2
  25. package/src/hooks/useMapPlace.ts +39 -16
  26. package/src/hooks/useMapRecomendPlace.ts +17 -4
  27. package/src/hooks-business/useBusinessMapAutoComplete.ts +3 -2
  28. package/src/hooks-business/useBusinessRecomendPlaceMap.ts +5 -5
  29. package/src/types/interface.ts +2 -1
  30. package/dist/hooks-business/useLagecyMapRecomendPlace.d.ts +0 -55
  31. package/src/hooks-business/useLagecyMapRecomendPlace.ts +0 -152
package/README.md CHANGED
@@ -122,7 +122,7 @@ export interface AutoCompletePlace extends Place {
122
122
  description: string;
123
123
  }
124
124
 
125
- export type City = {
125
+ export type Region = {
126
126
  bound?: {
127
127
  east: number;
128
128
  north: number;
@@ -11,6 +11,7 @@ export interface CenterPlaceSource {
11
11
  source: "default" | "geo" | "drag" | "recomend" | "api";
12
12
  }
13
13
  export interface BusinessRecomendPlaceMapProps extends Omit<HeycarMapProps, "center" | "zoom" | "mapRef">, Pick<UseMapRecomendPlaceProps<CenterPlaceSource>, "getRecomendPlace">, MapLogProps {
14
+ geoLoadingTitle: string;
14
15
  unavailableTitle: string;
15
16
  recomendDescription: string;
16
17
  noRecomendDescription: string;
@@ -21,8 +22,9 @@ export interface BusinessRecomendPlaceMapProps extends Omit<HeycarMapProps, "cen
21
22
  onChangeByDrag?: UseMapDragProps["onChange"];
22
23
  onChangeGeoLocation?: UseGeoLocationProps["onChange"];
23
24
  onChangePlace?: UseMapPlaceProps["onChange"];
25
+ onChangeCity?: UseMapPlaceProps["onChangeCity"];
24
26
  onChangeRecomandPlace?: UseMapRecomendPlaceProps["onChange"];
25
27
  onGeoError?: UseGeoLocationProps["onError"];
26
28
  onClickLocator?: AbsoluteAddressBoxProps["onClick"];
27
29
  }
28
- export declare const BusinessRecomendPlaceMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "dragEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "clickLocator", BusinessRecomendPlaceMapProps, {}>;
30
+ export declare const BusinessRecomendPlaceMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "dragEnd" | "changeCity" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "clickLocator", BusinessRecomendPlaceMapProps, {}>;
@@ -1,10 +1,11 @@
1
- import type { City } from "../types/interface";
2
- export interface UseMapAutoCompleteProps {
3
- city: City;
1
+ import type { Region } from "../types/interface";
2
+ import { MapLogProps } from "./useMapLog";
3
+ export interface UseMapAutoCompleteProps extends MapLogProps {
4
+ city: Region;
4
5
  }
5
6
  export declare const useAmapAutoComplete: (props: UseMapAutoCompleteProps) => {
6
7
  setKeyword: (value: string) => void;
7
- setCity: (value: City) => void;
8
+ setCity: (value: Region) => void;
8
9
  autoCompletePlaces: import("vue-demi").Ref<{
9
10
  placeId?: string | undefined;
10
11
  description: string;
@@ -12,12 +13,13 @@ export declare const useAmapAutoComplete: (props: UseMapAutoCompleteProps) => {
12
13
  lat: number;
13
14
  name: string;
14
15
  cityName?: string | undefined;
16
+ cityParentName?: string | undefined;
15
17
  countryName?: string | undefined;
16
18
  }[]>;
17
19
  };
18
20
  export declare const useGmapAutoComplete: (props: UseMapAutoCompleteProps) => {
19
21
  setKeyword: (value: string) => void;
20
- setCity: (value: City) => void;
22
+ setCity: (value: Region) => void;
21
23
  autoCompletePlaces: import("vue-demi").Ref<{
22
24
  placeId?: string | undefined;
23
25
  description: string;
@@ -25,12 +27,13 @@ export declare const useGmapAutoComplete: (props: UseMapAutoCompleteProps) => {
25
27
  lat: number;
26
28
  name: string;
27
29
  cityName?: string | undefined;
30
+ cityParentName?: string | undefined;
28
31
  countryName?: string | undefined;
29
32
  }[]>;
30
33
  };
31
34
  export declare const useMapAutoComplete: (props: UseMapAutoCompleteProps) => {
32
35
  setKeyword: (value: string) => void;
33
- setCity: (value: City) => void;
36
+ setCity: (value: Region) => void;
34
37
  autoCompletePlaces: import("vue-demi").Ref<{
35
38
  placeId?: string | undefined;
36
39
  description: string;
@@ -38,6 +41,7 @@ export declare const useMapAutoComplete: (props: UseMapAutoCompleteProps) => {
38
41
  lat: number;
39
42
  name: string;
40
43
  cityName?: string | undefined;
44
+ cityParentName?: string | undefined;
41
45
  countryName?: string | undefined;
42
46
  }[]>;
43
47
  };
@@ -1,9 +1,9 @@
1
1
  import { Ref } from "vue-demi";
2
- import type { City } from "../types/interface";
2
+ import type { Region } from "../types/interface";
3
3
  export interface UseMapCityBoundProps {
4
4
  cityNameRef: Ref<string | undefined>;
5
- onChange?: (value: City) => any;
5
+ onChange?: (value: Region) => any;
6
6
  }
7
- export declare const useAmapBoundCity: (props: UseMapCityBoundProps) => City;
8
- export declare const useGmapBoundCity: (props: UseMapCityBoundProps) => City;
9
- export declare const useMapBoundCity: (props: UseMapCityBoundProps) => City;
7
+ export declare const useAmapBoundCity: (props: UseMapCityBoundProps) => Region;
8
+ export declare const useGmapBoundCity: (props: UseMapCityBoundProps) => Region;
9
+ export declare const useMapBoundCity: (props: UseMapCityBoundProps) => Region;
@@ -1,4 +1,5 @@
1
1
  export interface MapLogProps {
2
2
  log?: boolean;
3
3
  }
4
- export declare const useMapLog: <P extends MapLogProps>(props: P, name: string) => void;
4
+ export declare const useMapLog: <P extends MapLogProps>(props: P, prefix: string) => void;
5
+ export declare const useMapLogVariable: <P extends MapLogProps>(props: P, prefix: string, variable: any, name: string) => void;
@@ -1,8 +1,13 @@
1
1
  import { Ref } from "vue-demi";
2
2
  import type { Place, Point } from "../types/interface";
3
+ export interface UseMapPlaceOnChangeCityProps {
4
+ cityName?: string;
5
+ cityParentName?: string;
6
+ }
3
7
  export interface UseMapPlaceProps {
4
8
  pointRef: Ref<Point>;
5
9
  onChange?: (value: Place) => any;
10
+ onChangeCity?: (value: UseMapPlaceOnChangeCityProps) => any;
6
11
  }
7
12
  export declare const useAmapPlace: (props: UseMapPlaceProps) => {
8
13
  place: {
@@ -10,9 +15,11 @@ export declare const useAmapPlace: (props: UseMapPlaceProps) => {
10
15
  lat: number;
11
16
  name: string;
12
17
  cityName?: string | undefined;
18
+ cityParentName?: string | undefined;
13
19
  countryName?: string | undefined;
14
20
  };
15
- updatePlace: () => void;
21
+ updatePlace: (value: Point) => void;
22
+ setPlace: (value: Place) => void;
16
23
  };
17
24
  export declare const useGmapPlace: (props: UseMapPlaceProps) => {
18
25
  place: {
@@ -20,9 +27,11 @@ export declare const useGmapPlace: (props: UseMapPlaceProps) => {
20
27
  lat: number;
21
28
  name: string;
22
29
  cityName?: string | undefined;
30
+ cityParentName?: string | undefined;
23
31
  countryName?: string | undefined;
24
32
  };
25
33
  updatePlace: () => void;
34
+ setPlace: (value: Place) => void;
26
35
  };
27
36
  export declare const useMapPlace: (props: UseMapPlaceProps) => {
28
37
  place: {
@@ -30,7 +39,9 @@ export declare const useMapPlace: (props: UseMapPlaceProps) => {
30
39
  lat: number;
31
40
  name: string;
32
41
  cityName?: string | undefined;
42
+ cityParentName?: string | undefined;
33
43
  countryName?: string | undefined;
34
44
  };
35
- updatePlace: () => void;
45
+ updatePlace: (value: Point) => void;
46
+ setPlace: (value: Place) => void;
36
47
  };
@@ -6,6 +6,7 @@ export interface UseMapRecomendPlaceProps<C = Record<string, any>> {
6
6
  context?: C;
7
7
  getLimit: (context?: C) => number;
8
8
  getRecomendPlace: (place: Place, context?: C) => Promise<Place[] | undefined>;
9
+ onChangeCity?: UseMapPlaceProps["onChangeCity"];
9
10
  onChangePlace?: UseMapPlaceProps["onChange"];
10
11
  onChange?: (place: Place) => any;
11
12
  }
@@ -15,6 +16,7 @@ export declare const useAmapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C
15
16
  lat: number;
16
17
  name: string;
17
18
  cityName?: string | undefined;
19
+ cityParentName?: string | undefined;
18
20
  countryName?: string | undefined;
19
21
  };
20
22
  placeCandidates: Ref<{
@@ -22,11 +24,13 @@ export declare const useAmapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C
22
24
  lat: number;
23
25
  name: string;
24
26
  cityName?: string | undefined;
27
+ cityParentName?: string | undefined;
25
28
  countryName?: string | undefined;
26
29
  }[]>;
27
30
  availableRef: Ref<boolean>;
28
31
  updateRecomandPlace: () => void;
29
- updatePlace: () => void;
32
+ updatePlace: (value: Point) => void;
33
+ setPlace: (value: Place) => void;
30
34
  };
31
35
  export declare const useGmapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>) => {
32
36
  recomendPlace: {
@@ -34,6 +38,7 @@ export declare const useGmapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C
34
38
  lat: number;
35
39
  name: string;
36
40
  cityName?: string | undefined;
41
+ cityParentName?: string | undefined;
37
42
  countryName?: string | undefined;
38
43
  };
39
44
  placeCandidates: Ref<{
@@ -41,11 +46,13 @@ export declare const useGmapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C
41
46
  lat: number;
42
47
  name: string;
43
48
  cityName?: string | undefined;
49
+ cityParentName?: string | undefined;
44
50
  countryName?: string | undefined;
45
51
  }[]>;
46
52
  availableRef: Ref<boolean>;
47
53
  updateRecomandPlace: () => void;
48
54
  updatePlace: () => void;
55
+ setPlace: (value: Place) => void;
49
56
  };
50
57
  export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>) => {
51
58
  recomendPlace: {
@@ -53,6 +60,7 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
53
60
  lat: number;
54
61
  name: string;
55
62
  cityName?: string | undefined;
63
+ cityParentName?: string | undefined;
56
64
  countryName?: string | undefined;
57
65
  };
58
66
  placeCandidates: Ref<{
@@ -60,9 +68,11 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
60
68
  lat: number;
61
69
  name: string;
62
70
  cityName?: string | undefined;
71
+ cityParentName?: string | undefined;
63
72
  countryName?: string | undefined;
64
73
  }[]>;
65
74
  availableRef: Ref<boolean>;
66
75
  updateRecomandPlace: () => void;
67
- updatePlace: () => void;
76
+ updatePlace: (value: Point) => void;
77
+ setPlace: (value: Place) => void;
68
78
  };
@@ -1,5 +1,6 @@
1
1
  import type { Ref } from "vue-demi";
2
- export interface UseBusinessMapAutoCompleteProps {
2
+ import type { MapLogProps } from "../hooks/useMapLog";
3
+ export interface UseBusinessMapAutoCompleteProps extends MapLogProps {
3
4
  cityNameRef: Ref<string>;
4
5
  }
5
6
  export declare const useBusinessMapAutoComplete: (props: UseBusinessMapAutoCompleteProps) => {
@@ -10,9 +11,10 @@ export declare const useBusinessMapAutoComplete: (props: UseBusinessMapAutoCompl
10
11
  lat: number;
11
12
  name: string;
12
13
  cityName?: string | undefined;
14
+ cityParentName?: string | undefined;
13
15
  countryName?: string | undefined;
14
16
  }[]>;
15
17
  setKeyword: (value: string) => void;
16
- setCity: (value: import("..").City) => void;
18
+ setCity: (value: import("..").Region) => void;
17
19
  handleKeywordInput: (e: Event) => void;
18
20
  };
@@ -1,7 +1,7 @@
1
1
  import type { Place, Point } from "../types/interface";
2
2
  export interface BusinessRecomendPlaceContext {
3
3
  panToGeoPositionByRecomend: (value: Point) => void;
4
- setCenterPlaceByRecomand: (value: Point) => void;
4
+ setCenterPlaceByUserSpecified: (value: Place) => void;
5
5
  onChangeCenterPlace: (value: Place) => void;
6
6
  onChangeRecomendPlaces: (value: Place[]) => void;
7
7
  }
@@ -12,6 +12,7 @@ export declare const useBusinessRecomendPlaceMap: () => {
12
12
  lat: number;
13
13
  name: string;
14
14
  cityName?: string | undefined;
15
+ cityParentName?: string | undefined;
15
16
  countryName?: string | undefined;
16
17
  };
17
18
  placeCandidates: import("vue-demi").Ref<{
@@ -19,9 +20,10 @@ export declare const useBusinessRecomendPlaceMap: () => {
19
20
  lat: number;
20
21
  name: string;
21
22
  cityName?: string | undefined;
23
+ cityParentName?: string | undefined;
22
24
  countryName?: string | undefined;
23
25
  }[]>;
24
26
  panToGeoPositionByRecomend: (value: Point) => void;
25
- setCenterPlaceByRecomand: (value: Point) => void;
27
+ setCenterPlaceByUserSpecified: (value: Place) => void;
26
28
  apiMapDistance: (from: Point, to: Point) => number | undefined;
27
29
  };