@heycar/heycars-map 0.3.7 → 0.3.9
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/DemoBusinessRecomendPlace.d.ts +9 -0
- 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 +2 -0
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -8
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +46 -0
- 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.d.ts +0 -2
- package/dist/components/MapProvider/MapProvider.d.ts +1 -4
- package/dist/hooks/useMapAutoComplete.d.ts +1 -2
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -2
- package/dist/index.cjs +54 -54
- package/dist/index.js +1867 -1959
- package/package.json +2 -3
- package/todo.md +27 -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 -218
- 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 -10
- package/src/components/Gmap/Gmap.ts +0 -54
- 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 -83
- 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 -138
- 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
package/src/api/contants.ts
DELETED
package/src/api/driving.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { memoize } from "lodash-es";
|
|
2
|
-
import type { ApiMapMeta } from "./geometry";
|
|
3
|
-
|
|
4
|
-
const getGmapDirectionsService = memoize(() => {
|
|
5
|
-
return new google.maps.DirectionsService();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const getAmapDriving = memoize((options: AMap.DrivingOptions) => {
|
|
9
|
-
return new AMap.Driving(options);
|
|
10
|
-
}, JSON.stringify);
|
|
11
|
-
|
|
12
|
-
const getAmapWalking = memoize((options: AMap.WalkingOptions) => {
|
|
13
|
-
return new AMap.Walking(options);
|
|
14
|
-
}, JSON.stringify);
|
|
15
|
-
|
|
16
|
-
export interface ApiDrivingGetAddressProps extends ApiMapMeta {
|
|
17
|
-
origin: [number, number];
|
|
18
|
-
destination: [number, number];
|
|
19
|
-
// ferry?: 0 | 1,
|
|
20
|
-
// policy?: 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20;
|
|
21
|
-
}
|
|
22
|
-
export const apiDrivingGetAddress = async (
|
|
23
|
-
props: ApiDrivingGetAddressProps
|
|
24
|
-
): Promise<AMap.DrivingResult | undefined | google.maps.DirectionsResult> => {
|
|
25
|
-
const { isGoogle, origin, destination } = props;
|
|
26
|
-
if (!isGoogle) {
|
|
27
|
-
const amapDriving = getAmapDriving({});
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
amapDriving.search(
|
|
30
|
-
AMap.LngLat.from(origin),
|
|
31
|
-
AMap.LngLat.from(destination),
|
|
32
|
-
{ waypoints: [] },
|
|
33
|
-
(status, result) => {
|
|
34
|
-
switch (status) {
|
|
35
|
-
case "complete":
|
|
36
|
-
return resolve(result as AMap.DrivingResult);
|
|
37
|
-
case "no_data":
|
|
38
|
-
return resolve(undefined);
|
|
39
|
-
default:
|
|
40
|
-
reject(result as Error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const gmapDirectionsService = getGmapDirectionsService();
|
|
47
|
-
return await gmapDirectionsService.route({
|
|
48
|
-
origin: { lng: origin[0], lat: origin[1] },
|
|
49
|
-
destination: { lng: destination[0], lat: destination[1] },
|
|
50
|
-
travelMode: google.maps.TravelMode.DRIVING,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export interface ApiWalkingGetAddressProps extends ApiMapMeta {
|
|
55
|
-
origin: [number, number];
|
|
56
|
-
destination: [number, number];
|
|
57
|
-
}
|
|
58
|
-
export const apiWalkingGetAddress = async (
|
|
59
|
-
props: ApiWalkingGetAddressProps
|
|
60
|
-
): Promise<AMap.WalkingResult | undefined | google.maps.DirectionsResult> => {
|
|
61
|
-
const { isGoogle, origin, destination } = props;
|
|
62
|
-
if (!isGoogle) {
|
|
63
|
-
const amapWalking = getAmapWalking({});
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
amapWalking.search(
|
|
66
|
-
AMap.LngLat.from(origin),
|
|
67
|
-
AMap.LngLat.from(destination),
|
|
68
|
-
(status, result) => {
|
|
69
|
-
switch (status) {
|
|
70
|
-
case "complete":
|
|
71
|
-
return resolve(result as AMap.WalkingResult);
|
|
72
|
-
case "no_data":
|
|
73
|
-
return resolve(undefined);
|
|
74
|
-
default:
|
|
75
|
-
reject(result as Error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
const gmapDirectionsService = getGmapDirectionsService();
|
|
82
|
-
return await gmapDirectionsService.route({
|
|
83
|
-
origin: { lng: origin[0], lat: origin[1] },
|
|
84
|
-
destination: { lng: destination[0], lat: destination[1] },
|
|
85
|
-
travelMode: google.maps.TravelMode.WALKING,
|
|
86
|
-
});
|
|
87
|
-
};
|
package/src/api/geocoder.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { memoize } from "lodash-es";
|
|
2
|
-
import type { ApiMapMeta } from "./geometry";
|
|
3
|
-
|
|
4
|
-
const getGmapGeocoder = memoize(() => {
|
|
5
|
-
return new google.maps.Geocoder();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const getAmapGeocoder = memoize((options: AMap.GeocoderOptions) => {
|
|
9
|
-
return new AMap.Geocoder(options);
|
|
10
|
-
}, JSON.stringify);
|
|
11
|
-
|
|
12
|
-
// todo: 谷歌大部分接口都是用 placeId
|
|
13
|
-
export interface ApiGeocoderGetAddressProps extends ApiMapMeta {
|
|
14
|
-
location: [number, number];
|
|
15
|
-
country?: string;
|
|
16
|
-
// todo: 谷歌用的是邮政编码
|
|
17
|
-
city?: string;
|
|
18
|
-
lang?: string;
|
|
19
|
-
}
|
|
20
|
-
export const apiGeocoderGetAddress = async (
|
|
21
|
-
props: ApiGeocoderGetAddressProps
|
|
22
|
-
): Promise<AMap.ReGeocoderResult | undefined | google.maps.GeocoderResult[]> => {
|
|
23
|
-
const { isGoogle, location, country, city, lang } = props;
|
|
24
|
-
if (!isGoogle) {
|
|
25
|
-
const amapGeocoder = getAmapGeocoder({ city, lang });
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
amapGeocoder.getAddress(AMap.LngLat.from(location), (status, result) => {
|
|
28
|
-
switch (status) {
|
|
29
|
-
case "complete":
|
|
30
|
-
return resolve(result as AMap.ReGeocoderResult);
|
|
31
|
-
case "no_data":
|
|
32
|
-
return resolve(undefined);
|
|
33
|
-
default:
|
|
34
|
-
reject(result as Error);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const gmapGeocoder = getGmapGeocoder();
|
|
40
|
-
const [lng, lat] = location;
|
|
41
|
-
const { results } = await gmapGeocoder.geocode({
|
|
42
|
-
location: new google.maps.LatLng({ lng, lat }),
|
|
43
|
-
language: lang,
|
|
44
|
-
componentRestrictions: {
|
|
45
|
-
country,
|
|
46
|
-
postalCode: city,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
return results;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export interface ApiGeocoderGetAddressProps extends ApiMapMeta {
|
|
53
|
-
address: string;
|
|
54
|
-
country?: string;
|
|
55
|
-
// todo: 谷歌用的是邮政编码
|
|
56
|
-
city?: string;
|
|
57
|
-
lang?: string;
|
|
58
|
-
}
|
|
59
|
-
export const apiGeocoderGetLocation = async (
|
|
60
|
-
props: ApiGeocoderGetAddressProps
|
|
61
|
-
): Promise<AMap.GeocoderResult | undefined | google.maps.GeocoderResult[]> => {
|
|
62
|
-
const { isGoogle, address, country, city, lang } = props;
|
|
63
|
-
if (!isGoogle) {
|
|
64
|
-
const amapGeocoder = getAmapGeocoder({ city, lang });
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
amapGeocoder.getLocation(address, (status, result) => {
|
|
67
|
-
switch (status) {
|
|
68
|
-
case "complete":
|
|
69
|
-
return resolve(result as AMap.GeocoderResult);
|
|
70
|
-
case "no_data":
|
|
71
|
-
return resolve(undefined);
|
|
72
|
-
default:
|
|
73
|
-
reject(result as Error);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const gmapGeocoder = getGmapGeocoder();
|
|
79
|
-
const { results } = await gmapGeocoder.geocode({
|
|
80
|
-
address,
|
|
81
|
-
language: lang,
|
|
82
|
-
componentRestrictions: {
|
|
83
|
-
country,
|
|
84
|
-
postalCode: city,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
return results;
|
|
88
|
-
};
|
package/src/api/geometry.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Point } from "../types/interface";
|
|
2
|
-
|
|
3
|
-
export interface ApiMapMeta {
|
|
4
|
-
isGoogle: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const point2latlng = ([lng, lat]: Point): google.maps.LatLngLiteral => ({ lng, lat });
|
|
8
|
-
export interface DistanceOfLineProps extends ApiMapMeta {
|
|
9
|
-
path: Point[];
|
|
10
|
-
}
|
|
11
|
-
export function apiMapDistanceOfLine(props: DistanceOfLineProps): number {
|
|
12
|
-
const { path, isGoogle } = props;
|
|
13
|
-
if (!isGoogle) {
|
|
14
|
-
return AMap.GeometryUtil.distanceOfLine(path);
|
|
15
|
-
}
|
|
16
|
-
return google.maps.geometry.spherical.computeLength(path.map(point2latlng));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IsPointInRingProps extends ApiMapMeta {
|
|
20
|
-
point: Point;
|
|
21
|
-
path: Point[];
|
|
22
|
-
}
|
|
23
|
-
export function apiMapIsPointInRing(props: IsPointInRingProps): boolean {
|
|
24
|
-
const { point, path, isGoogle } = props;
|
|
25
|
-
if (!isGoogle) {
|
|
26
|
-
return AMap.GeometryUtil.isPointInRing(point, path);
|
|
27
|
-
}
|
|
28
|
-
const polygon = new google.maps.Polygon({ paths: path.map(point2latlng) });
|
|
29
|
-
return google.maps.geometry.poly.containsLocation(point2latlng(point), polygon);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface IsPointInLineProps extends ApiMapMeta {
|
|
33
|
-
point: Point;
|
|
34
|
-
path: Point[];
|
|
35
|
-
tolerance: number;
|
|
36
|
-
}
|
|
37
|
-
export function apiMapIsPointInLine(props: IsPointInLineProps): boolean {
|
|
38
|
-
const { point, path, tolerance, isGoogle } = props;
|
|
39
|
-
if (!isGoogle) {
|
|
40
|
-
return AMap.GeometryUtil.isPointOnLine(point, path, tolerance);
|
|
41
|
-
}
|
|
42
|
-
const polyline = new google.maps.Polyline({ path: path.map(point2latlng) });
|
|
43
|
-
return google.maps.geometry.poly.isLocationOnEdge(point2latlng(point), polyline, tolerance);
|
|
44
|
-
}
|
package/src/api/place.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { memoize } from "lodash-es";
|
|
2
|
-
import type { ApiMapMeta } from "./geometry";
|
|
3
|
-
|
|
4
|
-
const getGmapAutoCompleteService = memoize(() => {
|
|
5
|
-
return new google.maps.places.AutocompleteService();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const getAmapAutoComplete = memoize((options: AMap.AutoCompleteOptions) => {
|
|
9
|
-
return new AMap.AutoComplete(options);
|
|
10
|
-
}, JSON.stringify);
|
|
11
|
-
|
|
12
|
-
const getGmapPlacesService = memoize((map: google.maps.Map) => {
|
|
13
|
-
return new google.maps.places.PlacesService(map);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const getAmapPlaceSearch = memoize((options: AMap.PlaceSearchOptions) => {
|
|
17
|
-
return new AMap.PlaceSearch(options);
|
|
18
|
-
}, JSON.stringify);
|
|
19
|
-
|
|
20
|
-
export interface ApiAutoCompleteSearchProps extends ApiMapMeta {
|
|
21
|
-
keyword: string;
|
|
22
|
-
country?: string;
|
|
23
|
-
city?: string;
|
|
24
|
-
lang?: string;
|
|
25
|
-
}
|
|
26
|
-
export const apiAutoCompleteSearch = async (
|
|
27
|
-
props: ApiAutoCompleteSearchProps
|
|
28
|
-
): Promise<AMap.AutocompleteResult | undefined | google.maps.places.AutocompletePrediction[]> => {
|
|
29
|
-
const { country, city, keyword, lang, isGoogle } = props;
|
|
30
|
-
if (!isGoogle) {
|
|
31
|
-
const amapAutoComplete = getAmapAutoComplete({ lang, city });
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
// todo 高德海外怎么传 country ?
|
|
34
|
-
amapAutoComplete.search(keyword, (status, result) => {
|
|
35
|
-
switch (status) {
|
|
36
|
-
case "complete":
|
|
37
|
-
return resolve(result as AMap.AutocompleteResult);
|
|
38
|
-
case "no_data":
|
|
39
|
-
return resolve(undefined);
|
|
40
|
-
default:
|
|
41
|
-
reject(result as Error);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const gmapAutoCompleteService = getGmapAutoCompleteService();
|
|
47
|
-
const { predictions } = await gmapAutoCompleteService.getPlacePredictions({
|
|
48
|
-
input: keyword,
|
|
49
|
-
language: lang,
|
|
50
|
-
componentRestrictions: {
|
|
51
|
-
country,
|
|
52
|
-
postalCode: city,
|
|
53
|
-
} as google.maps.places.ComponentRestrictions,
|
|
54
|
-
});
|
|
55
|
-
return predictions;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export interface ApiPlaceSearchInBoundsProps extends ApiMapMeta {
|
|
59
|
-
keyword: string;
|
|
60
|
-
// 基于矩形的 southWest 和 northEast 的点构造矩形。
|
|
61
|
-
bounds: [[number, number], [number, number]];
|
|
62
|
-
// 只有谷歌支持
|
|
63
|
-
lang?: string;
|
|
64
|
-
// 谷歌地图必须提供 map 对象
|
|
65
|
-
map?: google.maps.Map;
|
|
66
|
-
}
|
|
67
|
-
export const apiPlaceSearchInBounds = async (
|
|
68
|
-
props: ApiPlaceSearchInBoundsProps
|
|
69
|
-
): Promise<AMap.PlaceSearchResult | undefined | google.maps.places.PlaceResult[]> => {
|
|
70
|
-
const { map, keyword, bounds, lang, isGoogle } = props;
|
|
71
|
-
const pageSize = 20;
|
|
72
|
-
if (!isGoogle) {
|
|
73
|
-
const amapPlaceSearch = getAmapPlaceSearch({ pageSize });
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
amapPlaceSearch.searchInBounds(keyword, new AMap.Bounds(bounds), (status, result) => {
|
|
76
|
-
switch (status) {
|
|
77
|
-
case "complete":
|
|
78
|
-
return resolve(result as AMap.PlaceSearchResult);
|
|
79
|
-
case "no_data":
|
|
80
|
-
return resolve(undefined);
|
|
81
|
-
default:
|
|
82
|
-
reject(result as Error);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (!map) throw new Error("MyError: should provide google map");
|
|
88
|
-
const gmapPlacesService = getGmapPlacesService(map);
|
|
89
|
-
return new Promise<google.maps.places.PlaceResult[]>((resolve, reject) => {
|
|
90
|
-
const [[south, west], [north, east]] = bounds;
|
|
91
|
-
gmapPlacesService.textSearch(
|
|
92
|
-
{
|
|
93
|
-
bounds: { north, east, south, west },
|
|
94
|
-
language: lang,
|
|
95
|
-
query: keyword,
|
|
96
|
-
},
|
|
97
|
-
(result, status) => {
|
|
98
|
-
if (status === google.maps.places.PlacesServiceStatus.NOT_FOUND) return resolve([]);
|
|
99
|
-
if (status === google.maps.places.PlacesServiceStatus.OK)
|
|
100
|
-
return resolve(result as google.maps.places.PlaceResult[]);
|
|
101
|
-
reject(status);
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="26" height="40" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="-39.719%" y1="50%" x2="126.093%" y2="50%" id="prefix__a"><stop stop-color="#79AFFF" offset="0%"/><stop stop-color="#5C8DFF" offset="32.342%"/><stop stop-color="#507FFF" offset="74.853%"/><stop stop-color="#4471FF" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M11.5 24h3v14.5a1.5 1.5 0 01-3 0V24z" fill="#4C80FF"/><g><circle fill="url(#prefix__a)" cx="13" cy="13" r="13"/><circle fill="#FFF" cx="13" cy="13" r="4"/></g></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="6" height="10" xmlns="http://www.w3.org/2000/svg"><path d="M1 1l4 4-4 4" stroke="#FFF" stroke-width="2" fill="none" fill-rule="evenodd" opacity=".8"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="31" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="72.339%" y1="50%" x2="0%" y2="50%" id="prefix__a"><stop stop-color="#FF8447" offset="0%"/><stop stop-color="#FF8B4A" offset="50.596%"/><stop stop-color="#FFA95A" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M12 30.215c2.134 0 3.863-.893 3.863-1.995 0-1.1-1.73-1.994-3.863-1.994-2.134 0-3.863.893-3.863 1.994 0 1.102 1.73 1.995 3.863 1.995z" fill-opacity=".5" fill="#43485A"/><path d="M11 27.006c2.128 0-.9-3.743 5.621-6.643C19.842 18.453 22 14.953 22 10.95 22 4.902 17.075 0 11 0S0 4.902 0 10.95c0 3.918 2.068 7.356 5.177 9.29C11.75 23.284 9.06 27.007 11 27.007z" stroke="#FFF" fill="url(#prefix__a)" transform="translate(1 1.215)"/><text font-family="PingFangSC-Semibold, PingFang SC" font-size="12" font-weight="500" fill="#FFF" transform="translate(1 1.215)"><tspan x="5" y="15.449">终</tspan></text></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="61" height="61" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><filter x="-7.1%" y="-7.1%" width="114.3%" height="114.3%" filterUnits="objectBoundingBox" id="prefix__a"><feOffset in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation=".5" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.277453016 0" in="shadowBlurOuter1"/></filter><circle id="prefix__b" cx="30" cy="30" r="10.5"/></defs><g transform="translate(.405 .264)" fill="none" fill-rule="evenodd"><circle stroke-opacity=".1" stroke="#003DFF" fill-opacity=".15" fill="#4873FE" cx="30" cy="30" r="29.5"/><use fill="#000" filter="url(#prefix__a)" xlink:href="#prefix__b"/><circle stroke="#FFF" stroke-width="2.4" stroke-linejoin="square" fill="#4871F1" cx="30" cy="30" r="9.3"/></g></svg>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="17px" height="17px" viewBox="0 0 17 17" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>椭圆形</title>
|
|
4
|
-
<defs>
|
|
5
|
-
<circle id="path-1" cx="4.5" cy="9.5" r="4.5"></circle>
|
|
6
|
-
<filter x="-61.1%" y="-61.1%" width="222.2%" height="222.2%" filterUnits="objectBoundingBox" id="filter-2">
|
|
7
|
-
<feMorphology radius="1" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"></feMorphology>
|
|
8
|
-
<feOffset dx="0" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"></feOffset>
|
|
9
|
-
<feGaussianBlur stdDeviation="1.5" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
|
10
|
-
<feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"></feComposite>
|
|
11
|
-
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.20435424 0" type="matrix" in="shadowBlurOuter1"></feColorMatrix>
|
|
12
|
-
</filter>
|
|
13
|
-
</defs>
|
|
14
|
-
<g id="1.0" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
15
|
-
<g id="首页-即时用车-拖动光标" transform="translate(-228.000000, -322.000000)">
|
|
16
|
-
<g id="椭圆形" transform="translate(232.000000, 321.000000)">
|
|
17
|
-
<use fill="black" fill-opacity="1" filter="url(#filter-2)" xlink:href="#path-1"></use>
|
|
18
|
-
<use stroke="#FFFFFF" stroke-width="2" fill="#346EFF" fill-rule="evenodd" xlink:href="#path-1"></use>
|
|
19
|
-
</g>
|
|
20
|
-
</g>
|
|
21
|
-
</g>
|
|
22
|
-
</svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="31" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient x1="0%" y1="50%" x2="129.599%" y2="50%" id="prefix__a"><stop stop-color="#36A8FF" offset="0%"/><stop stop-color="#4871F1" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path d="M12 30.215c1.95 0 3.532-.816 3.532-1.823 0-1.007-1.581-1.823-3.532-1.823-1.95 0-3.532.816-3.532 1.823 0 1.007 1.581 1.823 3.532 1.823z" fill-opacity=".5" fill="#43485A"/><path d="M11 27c2.128 0-.9-3.742 5.621-6.641 3.221-1.91 5.379-5.41 5.379-9.412C22 4.901 17.075 0 11 0S0 4.901 0 10.947c0 3.918 2.068 7.355 5.177 9.29C11.75 23.277 9.06 27 11 27z" stroke="#FFF" fill="url(#prefix__a)" transform="translate(1 1.215)"/><text font-family="PingFangSC-Semibold, PingFang SC" font-size="12" font-weight="500" fill="#FFF" transform="translate(1 1.215)"><tspan x="5" y="15.624">起</tspan></text></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="44" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><path d="M34.087 10.96c0 2.369-.054 2.98-.782 3.704-.793.79-5.236.833-5.236.833l-4.116.192-9.896-.144s-7.79-.026-9.131-.026c-1.342 0-2.406-.847-2.406-.847C.14 12.932 0 11.09 0 11.09V5.86s.14-1.842 2.52-3.583c0 0 1.064-.846 2.406-.846 1.341 0 9.13-.026 9.13-.026l9.897-.144 4.116.192s4.484 0 5.236.833c.778.86.782 1.37.782 3.74v4.934z" id="prefix__b"/><path d="M0 1.493S5.7.18 8.719.05c3.02-.131 3.47.017 5.282.21.507.051 3.26.91 3.26.91l-7.303.3L0 1.494z" id="prefix__c"/><path d="M10.08 2.815C9.295 4.483 8.85 6.423 8.85 8.494c0 2.062.442 3.994 1.22 5.657l5.698-1.157a15.601 15.601 0 01-.667-4.552c0-1.659.204-3.065.659-4.505L10.08 2.815z" id="prefix__e"/><path d="M25.753 8.455c0 1.92-.22 3.364-.601 4.891l2.626.35c1.178-.005 2.132-2.335 2.132-5.215s-.954-5.21-2.132-5.21l-2.614.35c.372 1.513.589 2.94.589 4.834z" id="prefix__g"/><path d="M.064.015L.158.002C.188-.016.371.106.4.124c.188.126.321.244.43.76.054.252.207 1.465.198 1.496l-.633.833.119 3.17-.094.076L0 .137c0-.052.025-.1.064-.122z" id="prefix__i"/><path d="M.064 6.515l.094.013c.03.018.213-.104.242-.122.188-.126.321-.244.43-.76.054-.252.207-1.465.198-1.496l-.633-.833L.42 0v.07L0 6.394c0 .052.025.1.064.122z" id="prefix__k"/><linearGradient x1="125.264%" y1="49.626%" x2="0%" y2="50%" id="prefix__d"><stop stop-color="#FFF" stop-opacity=".5" offset="0%"/><stop stop-opacity=".5" offset="100%"/></linearGradient><linearGradient x1="22.712%" y1="73.133%" x2="68.62%" y2="66.194%" id="prefix__f"><stop stop-color="#FFF" stop-opacity=".5" offset="0%"/><stop stop-opacity=".5" offset="100%"/></linearGradient><linearGradient x1="128.768%" y1="50%" x2="0%" y2="50%" id="prefix__h"><stop stop-color="#FFF" stop-opacity=".5" offset="0%"/><stop stop-opacity=".5" offset="100%"/></linearGradient><linearGradient x1="100%" y1="100%" x2="28.4%" y2="100%" id="prefix__j"><stop stop-color="#FFBEBE" stop-opacity=".5" offset="0%"/><stop stop-color="#352222" stop-opacity=".5" offset="100%"/></linearGradient><linearGradient x1="100%" y1="100%" x2="28.4%" y2="100%" id="prefix__l"><stop stop-color="#FFBEBE" stop-opacity=".5" offset="0%"/><stop stop-color="#352222" stop-opacity=".5" offset="100%"/></linearGradient><filter x="-17.6%" y="-41.6%" width="135.2%" height="183.2%" filterUnits="objectBoundingBox" id="prefix__a"><feOffset in="SourceAlpha" result="shadowOffsetOuter1"/><feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/><feColorMatrix values="0 0 0 0 0.0862745098 0 0 0 0 0.0862745098 0 0 0 0 0.0862745098 0 0 0 0.5 0" in="shadowBlurOuter1"/></filter></defs><g fill="none" fill-rule="evenodd"><path d="M0 0h24v44H0z"/><g fill-rule="nonzero"><g transform="matrix(0 1 1 0 3.498 4.642)"><use fill="#000" filter="url(#prefix__a)" xlink:href="#prefix__b"/><use fill="#DFECF2" xlink:href="#prefix__b"/></g><path d="M14.458 38.728c2.369 0 2.98-.053 3.704-.781.79-.794.834-5.237.834-5.237l.191-4.115-.144-9.896s-.026-7.79-.026-9.132c0-1.342-.846-2.405-.846-2.405-1.741-2.381-3.582-2.52-3.582-2.52H9.357s-1.841.139-3.582 2.52c0 0-.847 1.063-.847 2.405 0 1.342-.026 9.132-.026 9.132l-.144 9.896.192 4.115s0 4.484.833 5.237c.86.777 1.37.781 3.74.781h4.935z" fill="#EFF5F8"/><g transform="matrix(0 1 1 0 17.093 15.062)" opacity=".9"><use fill="#161616" xlink:href="#prefix__c"/><use fill="url(#prefix__d)" xlink:href="#prefix__c"/></g><path d="M5.826 14.53c1.806-.937 3.915-1.465 6.17-1.465 2.243 0 4.339.528 6.141 1.452l-1.278 6.489a15.375 15.375 0 00-4.915-.794c-1.793 0-3.324.254-4.873.794L5.826 14.53z" fill="#161616"/><g transform="matrix(0 1 1 0 3.498 4.642)"><use fill="#3C4242" xlink:href="#prefix__e"/><use fill="url(#prefix__f)" xlink:href="#prefix__e"/></g><g opacity=".9" transform="matrix(0 1 1 0 3.498 4.642)"><use fill="#161616" xlink:href="#prefix__g"/><use fill="url(#prefix__h)" xlink:href="#prefix__g"/></g><path d="M3.87 17.651l.876-.462a.313.313 0 00.17-.274v-.188l-1.317.695v.082c.004.127.152.209.27.147z" fill="#303435"/><path d="M3.564 17.45l1.082-.568c.1-.053.21-.09.327-.106a.108.108 0 00.096-.107v-.552c0-.09-.078-.164-.174-.164H4.85c-.11 0-.502.062-1 .528-.222.209-.353.638-.353.933 0 .033.035.053.066.037z" fill="#DFECF2"/><path d="M5.434 15.062s1.095 4.467 1.226 7.486c.131 3.02-.017 3.47-.21 5.282-.051.507-.937 3.813-.937 3.813L5.36 25.17l.074-10.11z" fill="#161616" opacity=".9"/><path d="M20.13 17.651l-.876-.462a.313.313 0 01-.17-.274v-.188l1.317.695v.082c-.004.127-.152.209-.27.147z" fill="#303435"/><path d="M20.436 17.45l-1.082-.568a.984.984 0 00-.327-.106.108.108 0 01-.096-.107v-.552c0-.09.078-.164.174-.164h.044c.11 0 .502.062 1 .528.222.209.353.638.353.933 0 .033-.035.053-.066.037z" fill="#DFECF2"/><path d="M9.296 38.524h5.375c2.252 0 2.806-.458 3.434-1.15-.104.287-.218.52-.344.659-.712.781-1.026 1.325-3.356 1.325H9.558c-2.33 0-2.544-.486-3.39-1.325-.149-.147-.276-.405-.389-.732.755.777 1.165 1.223 3.517 1.223z" fill="#95A4AD"/><path d="M8.881 37.922h6.052c1.911 0 2.736-.298 3.33-.781a3.075 3.075 0 01-.297.72c-.585.618-1.23 1.019-3.334 1.019H9.178c-1.48 0-2.2-.176-2.718-.504-.118-.11-.24-.237-.384-.384-.14-.147-.266-.405-.376-.74.59.433 1.38.67 3.181.67z" fill="#CBD8DE"/><path d="M11.818 38.037c1.65 0 3.115-.066 4.04-.164-.07.193-.152.344-.24.426-.035.037-.113.07-.148.098-.925.082-2.195.13-3.652.13a46.22 46.22 0 01-3.539-.118c-.04-.033-.126-.07-.17-.11-.096-.082-.179-.23-.253-.418.934.099 2.36.156 3.962.156z" fill="#F2FAFF"/><path d="M11.988 12.194c-2.203 0-4.285.446-6.109 1.227.787-6.961 3.5-7.18 3.5-7.18h5.192s3.125.319 3.5 7.172a15.493 15.493 0 00-6.083-1.22z" fill="#F9FDFF"/><g transform="matrix(0 1 1 0 5.834 37.517)"><use fill="#B92E4D" xlink:href="#prefix__i"/><use fill-opacity=".7" fill="url(#prefix__j)" xlink:href="#prefix__i"/></g><g transform="matrix(0 1 1 0 11.438 37.517)"><use fill="#B92E4D" xlink:href="#prefix__k"/><use fill-opacity=".7" fill="url(#prefix__l)" xlink:href="#prefix__k"/></g><path d="M18.41 36.274c-.038.25-.082.454-.13.642-.092.372-.419.655-.82.712-1.475.208-3.434.421-5.581.421-2.086 0-3.988-.204-5.446-.405a.975.975 0 01-.824-.708 8.903 8.903 0 01-.135-.642c1.522.25 3.826.41 6.405.41 2.648 0 5.009-.168 6.532-.43z" fill="#DFECF2"/><path d="M16.216 36.711c-.947.487-2.487.7-4.232.7-1.698 0-3.207-.196-4.159-.663-.44-.83-.663-2.643-.663-2.643l-.009-.184c.773.708 2.645 1.203 4.83 1.203 2.243 0 4.159-.524 4.892-1.26l-.013.241c0-.004-.218 1.764-.646 2.606zM7.447 23.93a20.12 20.12 0 00-.294-2.442v-.065c1.538-.32 3.167-.649 4.862-.649 1.675 0 3.294.326 4.816.637a22.673 22.673 0 00-.303 2.52c-.147 2.884.02 3.314.232 5.048.006.057.026.152.056.274-1.513.278-3 .54-4.912.54-1.847 0-3.289-.25-4.75-.511v-.008c.03-.131.055-.233.06-.29.218-1.744.38-2.173.233-5.053z" fill="#F2FAFF"/><path d="M12.067 19.716l-4.645.692c-.431-2.92-.832-4.36-1.202-4.324l-.21-1.297a11.732 11.732 0 016.026-1.673c.386 0-.137.05-1.569.147l1.6 6.455z" fill="#161616"/></g></g></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="119" height="118" xmlns="http://www.w3.org/2000/svg"><defs><radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="50%" id="prefix__a"><stop stop-color="#FFF" offset="0%"/><stop stop-color="#4471FF" offset="100%"/></radialGradient></defs><circle cx="191.394" cy="238" r="59" transform="translate(-132 -179)" fill="url(#prefix__a)" fill-rule="evenodd" opacity=".2"/></svg>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { style } from "@vanilla-extract/css";
|
|
2
|
-
|
|
3
|
-
export const absoluteAddressBoxLayout = style({
|
|
4
|
-
pointerEvents: "none",
|
|
5
|
-
position: "absolute",
|
|
6
|
-
bottom: "50%",
|
|
7
|
-
left: 0,
|
|
8
|
-
right: 0,
|
|
9
|
-
marginLeft: "auto",
|
|
10
|
-
marginRight: "auto",
|
|
11
|
-
display: "flex",
|
|
12
|
-
flexDirection: "column",
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
zIndex: 1,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const absoluteAddressBox = style({
|
|
18
|
-
pointerEvents: "auto",
|
|
19
|
-
padding: "2.67vw 4.27vw",
|
|
20
|
-
background: "linear-gradient(90deg, #79AFFF 0%, #5C8DFF 32%, #507FFF 75%, #4471FF 100%)",
|
|
21
|
-
borderRadius: "3.2vw",
|
|
22
|
-
display: "flex",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const boxTextLayout = style({
|
|
27
|
-
paddingRight: "2.67vw",
|
|
28
|
-
maxWidth: "41.33vw",
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const boxTitle = style({
|
|
32
|
-
display: "-webkit-box",
|
|
33
|
-
fontSize: "3.47vw",
|
|
34
|
-
fontFamily: "PingFangSC-Semibold, PingFang SC",
|
|
35
|
-
fontWeight: 600,
|
|
36
|
-
color: "#FFFFFF",
|
|
37
|
-
lineHeight: "4.8vw",
|
|
38
|
-
WebkitLineClamp: 2,
|
|
39
|
-
WebkitBoxOrient: "vertical",
|
|
40
|
-
overflow: "hidden",
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export const boxDescription = style({
|
|
44
|
-
marginTop: "0.53vw",
|
|
45
|
-
fontSize: "2.93vw",
|
|
46
|
-
fontFamily: "PingFangSC-Regular, PingFang SC",
|
|
47
|
-
fontWeight: 400,
|
|
48
|
-
color: "#FFFFFF",
|
|
49
|
-
lineHeight: "4.27vw",
|
|
50
|
-
opacity: 0.8,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export const arrowRight = style({
|
|
54
|
-
width: "1.758vw",
|
|
55
|
-
height: "2.93vw",
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const straightLine = style({
|
|
59
|
-
width: "0.8vw",
|
|
60
|
-
height: "4vw",
|
|
61
|
-
background: "#4C80FF",
|
|
62
|
-
borderRadius: "0vw 0vw 26.67vw 26.67vw",
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export const locatorIcon = style({
|
|
66
|
-
width: "6.9355vw",
|
|
67
|
-
height: "10.67vw",
|
|
68
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue-demi";
|
|
2
|
-
import imgAddressLocator from "../../assets/icons/svg/address-locator.svg";
|
|
3
|
-
import imgArrowRight from "../../assets/icons/svg/arrow-right.svg";
|
|
4
|
-
import type { MapLogProps } from "../../hooks/useMapLog";
|
|
5
|
-
import { defineSetup } from "../../types/helper";
|
|
6
|
-
import * as css from "./AbsoluteAddressBox.css";
|
|
7
|
-
|
|
8
|
-
interface MultilineTitleProps {
|
|
9
|
-
value?: string;
|
|
10
|
-
}
|
|
11
|
-
const MultilineTitle = defineSetup(function MultilineTitle(props: MultilineTitleProps) {
|
|
12
|
-
const linesRef = computed(() => {
|
|
13
|
-
return props.value?.split("\n").flatMap((line, idx) => (idx === 0 ? line : [<br />, line]));
|
|
14
|
-
});
|
|
15
|
-
return () => <div>{linesRef.value}</div>;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export interface AbsoluteAddressBoxProps extends MapLogProps {
|
|
19
|
-
type: "box" | "locator";
|
|
20
|
-
title: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
onClick?: () => any;
|
|
23
|
-
}
|
|
24
|
-
export const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox(
|
|
25
|
-
props: AbsoluteAddressBoxProps,
|
|
26
|
-
{ emit }
|
|
27
|
-
) {
|
|
28
|
-
const handleClick = () => emit("click");
|
|
29
|
-
return () => {
|
|
30
|
-
const { type, title, description } = props;
|
|
31
|
-
if (type === "locator")
|
|
32
|
-
return (
|
|
33
|
-
<div class={css.absoluteAddressBoxLayout}>
|
|
34
|
-
<img class={css.locatorIcon} src={imgAddressLocator} />
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
return (
|
|
38
|
-
<div class={css.absoluteAddressBoxLayout}>
|
|
39
|
-
<div class={css.absoluteAddressBox} onClick={handleClick}>
|
|
40
|
-
<div class={css.boxTextLayout}>
|
|
41
|
-
<MultilineTitle class={css.boxTitle} value={title} />
|
|
42
|
-
{!!description && <div class={css.boxDescription}>{description}</div>}
|
|
43
|
-
</div>
|
|
44
|
-
<img class={css.arrowRight} src={imgArrowRight} />
|
|
45
|
-
</div>
|
|
46
|
-
<i class={css.straightLine} />
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AbsoluteAddressBox";
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { style } from "@vanilla-extract/css";
|
|
2
|
-
|
|
3
|
-
export const addressBoxLayout = style({
|
|
4
|
-
display: "flex",
|
|
5
|
-
flexDirection: "column",
|
|
6
|
-
alignItems: "center",
|
|
7
|
-
marginBottom: "-1.6vw",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const addressBox = style({
|
|
11
|
-
padding: "2.13vw 4.5vw 2.67vw 4.27vw",
|
|
12
|
-
display: "flex",
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
background: "linear-gradient(90deg, #79AFFF 0%, #5C8DFF 32%, #507FFF 75%, #4471FF 100%)",
|
|
15
|
-
borderRadius: "3.2vw",
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const addressTitle = style({
|
|
19
|
-
fontSize: "3.47vw",
|
|
20
|
-
fontFamily: "PingFangSC-Semibold, PingFang SC",
|
|
21
|
-
fontWeight: 600,
|
|
22
|
-
color: "#FFFFFF",
|
|
23
|
-
lineHeight: "4.8vw",
|
|
24
|
-
whiteSpace: "nowrap",
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export const addressDescription = style({
|
|
28
|
-
fontSize: "2.93vw",
|
|
29
|
-
fontFamily: "PingFangSC-Regular, PingFang SC",
|
|
30
|
-
fontWeight: 400,
|
|
31
|
-
color: "#EAFAF8",
|
|
32
|
-
lineHeight: "4.27vw",
|
|
33
|
-
whiteSpace: "nowrap",
|
|
34
|
-
opacity: 0.8,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const arrowIcon = style({
|
|
38
|
-
marginLeft: "3.2vw",
|
|
39
|
-
width: "1.44vw",
|
|
40
|
-
height: "2.4vw",
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export const verticalLine = style({
|
|
44
|
-
width: "0.8vw",
|
|
45
|
-
height: "4vw",
|
|
46
|
-
background: "#4C80FF",
|
|
47
|
-
borderRadius: "0vw 0vw 26.67vw 26.67vw",
|
|
48
|
-
zIndex: 1,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const circleIcon = style({
|
|
52
|
-
marginTop: "-1.5vw",
|
|
53
|
-
width: "3.2vw",
|
|
54
|
-
height: "3.2vw",
|
|
55
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue-demi";
|
|
2
|
-
import imgArrowRight from "../../assets/icons/svg/arrow-right.svg";
|
|
3
|
-
import imgPlaceCircle from "../../assets/icons/svg/place-circle.svg";
|
|
4
|
-
import { AmapMarker } from "../../components/AmapMarker";
|
|
5
|
-
import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView/GmapAdvancedMarkerView";
|
|
6
|
-
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
7
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
8
|
-
import { createElement, defineSetup } from "../../types/helper";
|
|
9
|
-
import type { Point } from "../../types/interface";
|
|
10
|
-
import { createDom } from "../../utils/dom";
|
|
11
|
-
import { vec2lnglat } from "../../utils/transform";
|
|
12
|
-
import type { AbsoluteAddressBoxProps } from "../AbsoluteAddressBox";
|
|
13
|
-
import { AAddressLocator, GAddressLocator } from "../AddressLocator";
|
|
14
|
-
import * as css from "./AddressBox.css";
|
|
15
|
-
|
|
16
|
-
export interface AddressBoxProps extends MapLogProps, AbsoluteAddressBoxProps {
|
|
17
|
-
position: Point;
|
|
18
|
-
}
|
|
19
|
-
export const AAddressBox = defineSetup(function AAddressBox(props: AddressBoxProps) {
|
|
20
|
-
useMapLog(props, "AAddressBox");
|
|
21
|
-
const contentRef = computed(
|
|
22
|
-
() => `
|
|
23
|
-
<div class="${css.addressBoxLayout}">
|
|
24
|
-
<div class="${css.addressBox}">
|
|
25
|
-
<div>
|
|
26
|
-
<div class="${css.addressTitle}">${props.title}</div>
|
|
27
|
-
<div class="${css.addressDescription}">${props.description ?? ""}</div>
|
|
28
|
-
</div>
|
|
29
|
-
<img class="${css.arrowIcon}" src="${imgArrowRight}" >
|
|
30
|
-
</div>
|
|
31
|
-
<div class="${css.verticalLine}"></div>
|
|
32
|
-
<img src="${imgPlaceCircle}" class="${css.circleIcon}">
|
|
33
|
-
</div>
|
|
34
|
-
`
|
|
35
|
-
);
|
|
36
|
-
return () => {
|
|
37
|
-
if (props.type === "locator") return <AAddressLocator position={props.position} />;
|
|
38
|
-
return (
|
|
39
|
-
<AmapMarker position={props.position} content={contentRef.value} anchor={"bottom-center"} />
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const GAddressBox = defineSetup(function GAddressBox(props: AddressBoxProps) {
|
|
45
|
-
useMapLog(props, "GAddressBox");
|
|
46
|
-
const contentRef = computed(() =>
|
|
47
|
-
createDom(
|
|
48
|
-
"div",
|
|
49
|
-
{ class: css.addressBoxLayout },
|
|
50
|
-
`
|
|
51
|
-
<div class="${css.addressBox}">
|
|
52
|
-
<div>
|
|
53
|
-
<div class="${css.addressTitle}">${props.title}</div>
|
|
54
|
-
<div class="${css.addressDescription}">${props.description ?? ""}</div>
|
|
55
|
-
</div>
|
|
56
|
-
<img class="${css.arrowIcon}" src="${imgArrowRight}" >
|
|
57
|
-
</div>
|
|
58
|
-
<div class="${css.verticalLine}"></div>
|
|
59
|
-
<img src="${imgPlaceCircle}" class="${css.circleIcon}">
|
|
60
|
-
`
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
return () => {
|
|
64
|
-
if (props.type === "locator") return <GAddressLocator position={props.position} />;
|
|
65
|
-
return (
|
|
66
|
-
<GmapAdvancedMarkerView position={vec2lnglat(props.position)} content={contentRef.value} />
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
export const AddressBox = defineSetup(function AddressBox(props: AddressBoxProps) {
|
|
72
|
-
const payload = useMapSupplier();
|
|
73
|
-
return () => {
|
|
74
|
-
return createElement(payload.supplier === "gmap" ? GAddressBox : AAddressBox, { attrs: props });
|
|
75
|
-
};
|
|
76
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./AddressBox";
|