@heycar/heycars-map 1.0.0-coordinate3 → 1.0.0-coordinate5
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 +12 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +5 -3
- package/dist/v2/Demo/DemoBusinessReselectPlace.js +4 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +36 -348
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +10 -10
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +8 -4
- package/dist/v2/chunks/BusinessRecomendPlaceMap.ca62e565.js +587 -0
- package/dist/{v3/chunks/debounce.2eb371bd.js → v2/chunks/debounce.5afe7867.js} +7 -4
- package/dist/v2/chunks/{_baseGetTag.1b4fdfe1.js → isSymbol.555c14bf.js} +8 -0
- package/dist/v2/hooks/useDeviceOrientation.js +1 -2
- package/dist/v2/hooks/useMapFitView.js +1 -1
- package/dist/v2/hooks/useMapGeometry.js +1 -24
- package/dist/v2/hooks/useMapInChina.d.ts +3 -3
- package/dist/v2/hooks/useMapInChina.js +7 -43
- package/dist/v2/hooks/useMapZoom.js +1 -1
- package/dist/v2/index.js +2 -2
- package/dist/v2/types/helper.js +1 -2
- package/dist/v2/types/interface.d.ts +3 -0
- package/dist/v2/utils/geometryPolygon.d.ts +6 -0
- package/dist/v2/utils/geometryPolygon.js +27 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +5 -3
- package/dist/v3/Demo/DemoBusinessReselectPlace.js +4 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +36 -337
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +10 -10
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +8 -4
- package/dist/v3/chunks/BusinessRecomendPlaceMap.c957231c.js +576 -0
- package/dist/{v2/chunks/debounce.2eb371bd.js → v3/chunks/debounce.5afe7867.js} +7 -4
- package/dist/v3/chunks/{_baseGetTag.1b4fdfe1.js → isSymbol.555c14bf.js} +8 -0
- package/dist/v3/hooks/useDeviceOrientation.js +1 -2
- package/dist/v3/hooks/useMapFitView.js +1 -1
- package/dist/v3/hooks/useMapGeometry.js +1 -24
- package/dist/v3/hooks/useMapInChina.d.ts +3 -3
- package/dist/v3/hooks/useMapInChina.js +7 -43
- package/dist/v3/hooks/useMapZoom.js +1 -1
- package/dist/v3/index.js +2 -2
- package/dist/v3/types/helper.js +1 -2
- package/dist/v3/types/interface.d.ts +3 -0
- package/dist/v3/utils/geometryPolygon.d.ts +6 -0
- package/dist/v3/utils/geometryPolygon.js +27 -0
- package/dist/v3/utils/log.js +1 -1
- package/package.json +1 -1
- package/dist/v2/api/driving.d.ts +0 -11
- package/dist/v2/api/driving.js +0 -71
- package/dist/v2/api/geocoder.d.ts +0 -15
- package/dist/v2/api/geocoder.js +0 -68
- package/dist/v2/api/geometry.d.ts +0 -19
- package/dist/v2/api/geometry.js +0 -29
- package/dist/v2/api/place.d.ts +0 -16
- package/dist/v2/api/place.js +0 -84
- package/dist/v2/chunks/isObject.4de2c89a.js +0 -7
- package/dist/v2/chunks/isSymbol.1c11fc44.js +0 -11
- package/dist/v2/chunks/memoize.d65d3da0.js +0 -235
- package/dist/v3/api/driving.d.ts +0 -11
- package/dist/v3/api/driving.js +0 -71
- package/dist/v3/api/geocoder.d.ts +0 -15
- package/dist/v3/api/geocoder.js +0 -68
- package/dist/v3/api/geometry.d.ts +0 -19
- package/dist/v3/api/geometry.js +0 -29
- package/dist/v3/api/place.d.ts +0 -16
- package/dist/v3/api/place.js +0 -84
- package/dist/v3/chunks/isObject.4de2c89a.js +0 -7
- package/dist/v3/chunks/isSymbol.1c11fc44.js +0 -11
- package/dist/v3/chunks/memoize.d65d3da0.js +0 -235
package/README.md
CHANGED
|
@@ -94,6 +94,14 @@ export enum CenterPlaceStatus {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export type GoogleConnectionStatus = "pending" | "connected" | "unconnected";
|
|
97
|
+
|
|
98
|
+
// GeolocationPositionError 类型参考 [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError)
|
|
99
|
+
export interface BusinessGeolocationPositionError extends GeolocationPositionError {
|
|
100
|
+
// isBusinessTimeout 是产品定义的 业务超时,不同于标准 GeolocationPositionError 的TIMEOUT
|
|
101
|
+
// 参考 http://p.heycars.cn/zentaopms/www/index.php?m=story&f=view&storyID=1212
|
|
102
|
+
// 参考 https://doc.weixin.qq.com/doc/w3_AZIAowasAIcGieCNESnQZe1rhTyaK?scode=ACcAmge7AAou1TTqYiAZIAowasAIc
|
|
103
|
+
isBusinessTimeout: boolean;
|
|
104
|
+
}
|
|
97
105
|
```
|
|
98
106
|
|
|
99
107
|
#### 在 入口文件添加 `MapProvider`
|
|
@@ -257,12 +265,9 @@ export default defineComponent({
|
|
|
257
265
|
onClickLocatorPhoto={() =>
|
|
258
266
|
console.log("用户点击了蓝色光标图片触发,此时可以执行用户点击起点输入框相同的逻辑")
|
|
259
267
|
}
|
|
260
|
-
onGeoError={() => {
|
|
261
|
-
console.log("获取GPS失败时触发,此时可以弹框告诉用户");
|
|
262
|
-
}}
|
|
263
|
-
onGeoErrorOnce={(isBusinessTimeout) => {
|
|
268
|
+
onGeoError={({ isBusinessTimeout }) => {
|
|
264
269
|
console.log(
|
|
265
|
-
"获取GPS
|
|
270
|
+
"获取GPS失败时触发,此时可以弹框告诉用户",
|
|
266
271
|
isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈",
|
|
267
272
|
);
|
|
268
273
|
}}
|
|
@@ -410,12 +415,9 @@ export default defineComponent({
|
|
|
410
415
|
onClickLocatorPhoto={() =>
|
|
411
416
|
console.log("用户点击了蓝色光标图片触发,此时可以执行用户点击起点输入框相同的逻辑")
|
|
412
417
|
}
|
|
413
|
-
onGeoError={() => {
|
|
414
|
-
console.log("获取GPS失败时触发,此时可以弹框告诉用户");
|
|
415
|
-
}}
|
|
416
|
-
onGeoErrorOnce={(isBusinessTimeout) => {
|
|
418
|
+
onGeoError={({ isBusinessTimeout }) => {
|
|
417
419
|
console.log(
|
|
418
|
-
"获取GPS
|
|
420
|
+
"获取GPS失败时触发,此时可以弹框告诉用户",
|
|
419
421
|
isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈",
|
|
420
422
|
);
|
|
421
423
|
}}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./v3"
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./v3"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import { BusinessRecomendPlaceMap } from "../
|
|
2
|
+
import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.ca62e565.js";
|
|
3
3
|
import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
|
|
4
4
|
import { defineSetup } from "../types/helper.js";
|
|
5
5
|
import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
|
|
@@ -145,8 +145,10 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
|
|
|
145
145
|
},
|
|
146
146
|
"clickLocatorText": () => console.log("用户点击了蓝色光标文字触发,此时可以执行用户点击起点输入框相同的逻辑"),
|
|
147
147
|
"clickLocatorPhoto": () => console.log("用户点击了蓝色光标图片触发,此时可以执行用户点击起点输入框相同的逻辑"),
|
|
148
|
-
"geoError": (
|
|
149
|
-
|
|
148
|
+
"geoError": ({
|
|
149
|
+
isBusinessTimeout
|
|
150
|
+
}) => {
|
|
151
|
+
console.log("获取GPS失败时触发,此时可以弹框告诉用户", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
|
|
150
152
|
},
|
|
151
153
|
"geoErrorOnce": (isBusinessTimeout) => {
|
|
152
154
|
console.log("获取GPS失败时触发, 只触发一次, ", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
|
|
@@ -146,8 +146,10 @@ const DemoBusinessReselectPlace = defineSetup("DemoBusinessReselectPlace", funct
|
|
|
146
146
|
},
|
|
147
147
|
"clickLocatorText": () => console.log("用户点击了蓝色光标文字触发,此时可以执行用户点击起点输入框相同的逻辑"),
|
|
148
148
|
"clickLocatorPhoto": () => console.log("用户点击了蓝色光标图片触发,此时可以执行用户点击起点输入框相同的逻辑"),
|
|
149
|
-
"geoError": (
|
|
150
|
-
|
|
149
|
+
"geoError": ({
|
|
150
|
+
isBusinessTimeout
|
|
151
|
+
}) => {
|
|
152
|
+
console.log("获取GPS失败时触发,此时可以弹框告诉用户", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
|
|
151
153
|
},
|
|
152
154
|
"geoErrorOnce": (isBusinessTimeout) => {
|
|
153
155
|
console.log("获取GPS失败时触发, 只触发一次, ", isBusinessTimeout ? "给用户超时提示" : "给用户无权限反馈");
|
|
@@ -6,7 +6,7 @@ import { type UseMapDragProps } from "../../hooks/useMapDrag";
|
|
|
6
6
|
import type { UseMapPlaceProps } from "../../hooks/useMapPlace";
|
|
7
7
|
import { type UseMapRecomendPlaceProps } from "../../hooks/useMapRecomendPlace";
|
|
8
8
|
import type { Coordinatify, CoordinatifyProps } from "../../types/coordinatify";
|
|
9
|
-
import { type CoordinatePlace } from "../../types/interface";
|
|
9
|
+
import { type BusinessGeolocationPositionError, type CoordinatePlace } from "../../types/interface";
|
|
10
10
|
import { type AbsoluteAddressBoxProps } from "../AbsoluteAddressBox";
|
|
11
11
|
import { type PickupPointsProps } from "../PickupPoints";
|
|
12
12
|
export declare const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
@@ -40,7 +40,7 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
|
|
|
40
40
|
onChangeGeoLocation?: Coordinatify<UseGeoLocationProps["onChange"]>;
|
|
41
41
|
onChangePlace?: Coordinatify<UseMapPlaceProps["onChange"]>;
|
|
42
42
|
onChangeRecomandPlace?: Coordinatify<UseMapRecomendPlaceProps["onChange"]>;
|
|
43
|
-
onGeoError?:
|
|
43
|
+
onGeoError?: (error: BusinessGeolocationPositionError) => void;
|
|
44
44
|
onGeoErrorOnce?: (isBusinessTimeout: boolean) => void;
|
|
45
45
|
onClickLocatorText?: AbsoluteAddressBoxProps["onClickText"];
|
|
46
46
|
onClickLocatorPhoto?: AbsoluteAddressBoxProps["onClickPhoto"];
|
|
@@ -1,350 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
29
|
-
const RECOMMEND_PLACE_LARGE_LIMIT = 100;
|
|
30
|
-
const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
|
|
31
|
-
const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
|
|
32
|
-
const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
|
|
33
|
-
const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
|
|
34
|
-
const DEFAULT_ZOOM = 17;
|
|
35
|
-
const ZONE_ZOOM = 13.75;
|
|
36
|
-
const BusinessRecomendPlaceMap = defineLagecySetup("BusinessRecomendPlaceMap", function(props, {
|
|
37
|
-
emit,
|
|
38
|
-
slots,
|
|
39
|
-
attrs
|
|
40
|
-
}) {
|
|
41
|
-
const {
|
|
42
|
-
geoLoadingTitle,
|
|
43
|
-
emptyTitle,
|
|
44
|
-
queryingTitle,
|
|
45
|
-
geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
|
|
46
|
-
getAvailable,
|
|
47
|
-
getRecomendPlace,
|
|
48
|
-
mapContext
|
|
49
|
-
} = props;
|
|
50
|
-
const {
|
|
51
|
-
coordinatifyPoint,
|
|
52
|
-
coordinatifyPlace,
|
|
53
|
-
unCoordinatifyPlace,
|
|
54
|
-
unCoordinatifyRecommendZonePlaces,
|
|
55
|
-
coordinatifyValueOfOnChangeRecommendPlace,
|
|
56
|
-
coordinatifyGeoPosition
|
|
57
|
-
} = useMapCoordinatify();
|
|
58
|
-
const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
|
|
59
|
-
const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
|
|
60
|
-
const {
|
|
61
|
-
mapRef,
|
|
62
|
-
mapElementRef,
|
|
63
|
-
setMap,
|
|
64
|
-
panTo
|
|
65
|
-
} = useHeycarMap();
|
|
66
|
-
const {
|
|
67
|
-
zoomRef,
|
|
68
|
-
setZoom
|
|
69
|
-
} = useMapZoom({
|
|
70
|
-
mapRef,
|
|
71
|
-
defaultValue: DEFAULT_ZOOM
|
|
72
|
-
});
|
|
73
|
-
const {
|
|
74
|
-
readyPromise
|
|
75
|
-
} = useMapSupplier();
|
|
76
|
-
const {
|
|
77
|
-
centerPlace,
|
|
78
|
-
isFirstLoad,
|
|
79
|
-
geoDefaultPosition,
|
|
80
|
-
defaultCenterPlace
|
|
81
|
-
} = useCacheCenterPlace({
|
|
82
|
-
defaultCenterPlace: props.defaultCenterPlace,
|
|
83
|
-
emptyTitle,
|
|
84
|
-
geoLoadingTitle
|
|
85
|
-
});
|
|
86
|
-
const centerSource = {
|
|
87
|
-
source: "geo"
|
|
88
|
-
};
|
|
89
|
-
const updateCenterPlaceByPoint = (point, context) => {
|
|
90
|
-
var _a;
|
|
91
|
-
centerSource.source = (_a = context == null ? void 0 : context.source) != null ? _a : "api";
|
|
92
|
-
updatePlace(point);
|
|
93
|
-
};
|
|
94
|
-
const setCenterPlaceByUserSpecified = async (input, context) => {
|
|
95
|
-
var _a;
|
|
96
|
-
centerSource.source = (_a = context == null ? void 0 : context.source) != null ? _a : "api";
|
|
97
|
-
const place = unCoordinatifyPlace(toCoordinatePlaceType(input));
|
|
98
|
-
equalAssign(centerPlace, place);
|
|
99
|
-
updateRecommendPlaceOnlyInZone(place);
|
|
100
|
-
};
|
|
101
|
-
const setCenterPlaceByUserSpecifiedInZone = async ({
|
|
102
|
-
place: inputPlace,
|
|
103
|
-
recommends: inputRecommends
|
|
104
|
-
}) => {
|
|
105
|
-
const place = unCoordinatifyPlace(toCoordinatePlaceType(inputPlace));
|
|
106
|
-
const recommends = unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(inputRecommends));
|
|
107
|
-
const isSameZone = recommends.zone && isZoneEqual(recommends.zone, zoneRef.value);
|
|
108
|
-
if (!isSameZone)
|
|
109
|
-
setZoom(ZONE_ZOOM);
|
|
110
|
-
equalAssign(centerPlace, place);
|
|
111
|
-
setPlaceCandidatesAndZone(recommends);
|
|
112
|
-
emit("changePlace", coordinatifyPlace({
|
|
113
|
-
...place
|
|
114
|
-
}));
|
|
115
|
-
};
|
|
116
|
-
const panToCenterByPlace = async (place) => {
|
|
117
|
-
centerSource.source = "api";
|
|
118
|
-
await panTo(place2point(place));
|
|
119
|
-
equalAssign(centerPlace, place);
|
|
120
|
-
emit("changePlace", coordinatifyPlace({
|
|
121
|
-
...place
|
|
122
|
-
}));
|
|
123
|
-
emit("changeRecomandPlace", coordinatifyValueOfOnChangeRecommendPlace({
|
|
124
|
-
place: {
|
|
125
|
-
...place
|
|
126
|
-
},
|
|
127
|
-
inputPlace: {
|
|
128
|
-
...place
|
|
129
|
-
},
|
|
130
|
-
isInZone: !!zoneRef.value,
|
|
131
|
-
isSameZone: !!zoneRef.value
|
|
132
|
-
}));
|
|
133
|
-
};
|
|
134
|
-
const emitGeoErrorOnce = memoize((e) => {
|
|
135
|
-
if (apiMemoryShouldSkipByKey(geoErrorOnceNotificationKey))
|
|
136
|
-
return;
|
|
137
|
-
emit("geoErrorOnce", geoPositionError2businessTimeout(e, detectBrowserPlatform()));
|
|
138
|
-
}, () => 0);
|
|
139
|
-
const {
|
|
140
|
-
geoPosition,
|
|
141
|
-
geoError,
|
|
142
|
-
geoLoading
|
|
143
|
-
} = useGeoLocation({
|
|
144
|
-
geoDefaultPosition,
|
|
145
|
-
onLoad: async (value) => {
|
|
146
|
-
emit("loadGeoLocation", coordinatifyGeoPosition(value));
|
|
147
|
-
if (!isFirstLoad)
|
|
148
|
-
return;
|
|
149
|
-
const [lng, lat] = value.position;
|
|
150
|
-
await readyPromise;
|
|
151
|
-
centerSource.source = "geo";
|
|
152
|
-
centerPlace.lng = lng;
|
|
153
|
-
centerPlace.lat = lat;
|
|
154
|
-
updatePlace(value.position);
|
|
155
|
-
},
|
|
156
|
-
onLoadDefault: async (value) => {
|
|
157
|
-
emit("loadDefaultGeoLocation", coordinatifyGeoPosition(value));
|
|
158
|
-
if (!isFirstLoad)
|
|
159
|
-
return;
|
|
160
|
-
await readyPromise;
|
|
161
|
-
centerSource.source = "geo";
|
|
162
|
-
updatePlace(value.position);
|
|
163
|
-
},
|
|
164
|
-
onChange: (v) => {
|
|
165
|
-
mapContext.geoPositionRef.value = coordinatifyPoint(v.position);
|
|
166
|
-
emit("changeGeoLocation", coordinatifyGeoPosition(v));
|
|
167
|
-
},
|
|
168
|
-
onError: (error) => {
|
|
169
|
-
emit("geoError", error);
|
|
170
|
-
emitGeoErrorOnce(error);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
useGoogleConnection({
|
|
174
|
-
onChange: (status) => emit("changeGoogleConnection", status)
|
|
175
|
-
});
|
|
176
|
-
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
177
|
-
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
178
|
-
mapContext.panToGeoPositionByRecomend = () => {
|
|
179
|
-
if (geoError.value)
|
|
180
|
-
return false;
|
|
181
|
-
updateCenterPlaceByPoint(geoPosition.value, {
|
|
182
|
-
source: "geo"
|
|
183
|
-
});
|
|
184
|
-
return true;
|
|
185
|
-
};
|
|
186
|
-
const {
|
|
187
|
-
isDragging
|
|
188
|
-
} = useMapDrag({
|
|
189
|
-
mapRef,
|
|
190
|
-
onChange: (point) => {
|
|
191
|
-
centerSource.source = "drag";
|
|
192
|
-
updatePlace(point);
|
|
193
|
-
emit("changeByDrag", coordinatifyPoint(point));
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
const {
|
|
197
|
-
updatePlace,
|
|
198
|
-
updateRecommendPlaceOnlyInZone,
|
|
199
|
-
setPlaceCandidatesAndZone,
|
|
200
|
-
placeCandidates,
|
|
201
|
-
zoneRef,
|
|
202
|
-
availableRef,
|
|
203
|
-
isQueryingRef
|
|
204
|
-
} = useMapRecomendPlace({
|
|
205
|
-
defaultPoint: place2point(centerPlace),
|
|
206
|
-
emptyPlaceName: emptyTitle,
|
|
207
|
-
queryingPlaceName: queryingTitle,
|
|
208
|
-
context: centerSource,
|
|
209
|
-
getAvailable: pipedGetAvailable,
|
|
210
|
-
getRecomendPlace: pipedGetRecomendPlace,
|
|
211
|
-
getLimit: (context) => {
|
|
212
|
-
const source = context == null ? void 0 : context.source;
|
|
213
|
-
switch (source) {
|
|
214
|
-
case "drag":
|
|
215
|
-
return RECOMMEND_PLACE_DRAG_LIMIT;
|
|
216
|
-
case "api":
|
|
217
|
-
case "geo":
|
|
218
|
-
case "default":
|
|
219
|
-
return RECOMMEND_PLACE_LARGE_LIMIT;
|
|
220
|
-
default:
|
|
221
|
-
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
onQueryingPlace: (place) => equalAssign(centerPlace, {
|
|
225
|
-
...place
|
|
226
|
-
}),
|
|
227
|
-
onChangePlace: (place) => emit("changePlace", coordinatifyPlace(place)),
|
|
228
|
-
onChange: async ({
|
|
229
|
-
place,
|
|
230
|
-
inputPlace,
|
|
231
|
-
isInZone,
|
|
232
|
-
isSameZone
|
|
233
|
-
}) => {
|
|
234
|
-
centerSource.source = "recomend";
|
|
235
|
-
if (isPlaceEqual(place, centerPlace))
|
|
236
|
-
panTo(place2point(place));
|
|
237
|
-
equalAssign(centerPlace, {
|
|
238
|
-
...place
|
|
239
|
-
});
|
|
240
|
-
if (isInZone && !isSameZone)
|
|
241
|
-
setZoom(ZONE_ZOOM);
|
|
242
|
-
emit("changeRecomandPlace", coordinatifyValueOfOnChangeRecommendPlace({
|
|
243
|
-
place,
|
|
244
|
-
inputPlace,
|
|
245
|
-
isInZone,
|
|
246
|
-
isSameZone
|
|
247
|
-
}));
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
const centerPlaceStatusRef = computed(() => isFirstLoad && geoLoading.value ? CenterPlaceStatus.GEO_LOADING : isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK);
|
|
251
|
-
watchPostEffectOnce(() => {
|
|
252
|
-
if (!isFirstLoad)
|
|
253
|
-
updateRecommendPlaceOnlyInZone(defaultCenterPlace);
|
|
254
|
-
});
|
|
255
|
-
watch(centerPlace, () => {
|
|
256
|
-
if (centerPlaceStatusRef.value === CenterPlaceStatus.OK) {
|
|
257
|
-
apiSaveCenterPlaceToCache(coordinatifyPlace({
|
|
258
|
-
...centerPlace
|
|
259
|
-
}));
|
|
260
|
-
}
|
|
261
|
-
mapContext.onChangeCenterPlace(coordinatifyPlace({
|
|
262
|
-
...centerPlace
|
|
263
|
-
}));
|
|
264
|
-
}, {
|
|
265
|
-
deep: true,
|
|
266
|
-
flush: "post"
|
|
267
|
-
});
|
|
268
|
-
watchEffect(() => {
|
|
269
|
-
mapContext.onChangeRecomendPlaces(placeCandidates.value.map(coordinatifyPlace));
|
|
270
|
-
});
|
|
271
|
-
watchEffect(() => {
|
|
272
|
-
mapContext.centerPlaceStatusRef.value = centerPlaceStatusRef.value;
|
|
273
|
-
});
|
|
274
|
-
return () => {
|
|
275
|
-
var _a, _b, _c;
|
|
276
|
-
const {
|
|
277
|
-
geoLoadingTitle: geoLoadingTitle2,
|
|
278
|
-
recomendDescription,
|
|
279
|
-
unavailableTitle,
|
|
280
|
-
disableLocator,
|
|
281
|
-
renderPlacePhoto,
|
|
282
|
-
renderPlaceTag
|
|
283
|
-
} = props;
|
|
284
|
-
const isElected = isPlacesInclude(placeCandidates.value, centerPlace);
|
|
285
|
-
const title = isFirstLoad && geoLoading.value ? geoLoadingTitle2 : !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
286
|
-
const description = !availableRef.value ? void 0 : isElected ? (_a = renderPlaceTag == null ? void 0 : renderPlaceTag(centerPlace)) != null ? _a : recomendDescription : void 0;
|
|
287
|
-
return h(HeycarMap, {
|
|
288
|
-
"class": attrs.class,
|
|
289
|
-
"style": attrs.style,
|
|
290
|
-
"attrs": {
|
|
291
|
-
"center": place2point(centerPlace),
|
|
292
|
-
"zoom": zoomRef.value,
|
|
293
|
-
"touchZoomCenter": true,
|
|
294
|
-
"mapRef": setMap,
|
|
295
|
-
"fallback": slots.fallback,
|
|
296
|
-
"loading": slots.loading,
|
|
297
|
-
"outerArea": () => h(AbsoluteAddressBox, {
|
|
298
|
-
"attrs": {
|
|
299
|
-
"title": title,
|
|
300
|
-
"description": description,
|
|
301
|
-
"photo": renderPlacePhoto == null ? void 0 : renderPlacePhoto(coordinatifyPlace(centerPlace)),
|
|
302
|
-
"type": isDragging.value ? "locator" : "box",
|
|
303
|
-
"withArrow": !disableLocator
|
|
304
|
-
},
|
|
305
|
-
"on": {
|
|
306
|
-
"clickText": () => disableLocator ? null : emit("clickLocatorText"),
|
|
307
|
-
"clickPhoto": () => emit("clickLocatorPhoto")
|
|
308
|
-
}
|
|
309
|
-
})
|
|
310
|
-
}
|
|
311
|
-
}, [((_b = zoneRef.value) == null ? void 0 : _b.path.length) && h(GreenZone, {
|
|
312
|
-
"attrs": {
|
|
313
|
-
"path": (_c = zoneRef.value) == null ? void 0 : _c.path
|
|
314
|
-
}
|
|
315
|
-
}), !geoLoading.value && !geoError.value && h(DeviceOrientation, {
|
|
316
|
-
"attrs": {
|
|
317
|
-
"elementRef": mapElementRef,
|
|
318
|
-
"render": (orientation) => h(PassengerCircle, {
|
|
319
|
-
"attrs": {
|
|
320
|
-
"position": geoPosition.value,
|
|
321
|
-
"angle": orientation == null ? void 0 : orientation.cssRotationVariableName
|
|
322
|
-
}
|
|
323
|
-
})
|
|
324
|
-
}
|
|
325
|
-
}), h(PickupPoints, {
|
|
326
|
-
"attrs": {
|
|
327
|
-
"basePlace": centerPlace,
|
|
328
|
-
"places": placeCandidates.value,
|
|
329
|
-
"noLabel": !!zoneRef.value,
|
|
330
|
-
"renderPlaceTag": renderPlaceTag,
|
|
331
|
-
"zoomIconMin": zoneRef.value ? RECOMMEND_PLACE_ZONE_ICON_MIN : RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
332
|
-
"zoomTextMin": zoneRef.value ? RECOMMEND_PLACE_ZONE_TEXT_MIN : RECOMMEND_PLACE_TEXT_ZOOM_MIN
|
|
333
|
-
},
|
|
334
|
-
"on": {
|
|
335
|
-
"click": panToCenterByPlace
|
|
336
|
-
}
|
|
337
|
-
})]);
|
|
338
|
-
};
|
|
339
|
-
}).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "defaultCenterPlace", "geoErrorOnceNotificationKey", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "getRecomendPlace", "getAvailable", "renderPlacePhoto", "renderPlaceTag", "loading", "mapContext"]);
|
|
1
|
+
import "vue";
|
|
2
|
+
import "vue-demi";
|
|
3
|
+
import "../../api/browser.js";
|
|
4
|
+
import "../../api/memory.js";
|
|
5
|
+
import "../../components/MapProvider/MapProvider.js";
|
|
6
|
+
import "../../hooks/useGeoLocation.js";
|
|
7
|
+
import "../../hooks/useGoogleConnection.js";
|
|
8
|
+
import "../../hooks/useHeycarMap.js";
|
|
9
|
+
import "../../hooks/useMapCoordinatify.js";
|
|
10
|
+
import "../../hooks/useMapDrag.js";
|
|
11
|
+
import "../../hooks/useMapRecomendPlace.js";
|
|
12
|
+
import "../../hooks/useMapSupplier.js";
|
|
13
|
+
import "../../hooks/useMapZoom.js";
|
|
14
|
+
import "../../types/helper.js";
|
|
15
|
+
import "../../types/interface.js";
|
|
16
|
+
import "../../utils/compare.js";
|
|
17
|
+
import "../../utils/helper.js";
|
|
18
|
+
import "../../utils/platform.js";
|
|
19
|
+
import "../../utils/transform.js";
|
|
20
|
+
import "../../utils/typeChecking.js";
|
|
21
|
+
import "../AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
22
|
+
import "../DeviceOrientation/DeviceOrientation.js";
|
|
23
|
+
import "../GreenZone/GreenZone.js";
|
|
24
|
+
import "../PassengerCircle/PassengerCircle.js";
|
|
25
|
+
import "../PickupPoints/PickupPoints.js";
|
|
26
|
+
import "./useCacheCenterPlace.js";
|
|
27
|
+
import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
|
|
340
28
|
export {
|
|
341
|
-
BusinessRecomendPlaceMap,
|
|
342
|
-
DEFAULT_ZOOM,
|
|
343
|
-
RECOMMEND_PLACE_DRAG_LIMIT,
|
|
344
|
-
RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
345
|
-
RECOMMEND_PLACE_LARGE_LIMIT,
|
|
346
|
-
RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
347
|
-
RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
348
|
-
RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
349
|
-
ZONE_ZOOM
|
|
29
|
+
B as BusinessRecomendPlaceMap,
|
|
30
|
+
D as DEFAULT_ZOOM,
|
|
31
|
+
a as RECOMMEND_PLACE_DRAG_LIMIT,
|
|
32
|
+
c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
33
|
+
R as RECOMMEND_PLACE_LARGE_LIMIT,
|
|
34
|
+
e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
35
|
+
b as RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
36
|
+
d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
37
|
+
Z as ZONE_ZOOM
|
|
350
38
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B, D, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
|
|
2
2
|
export {
|
|
3
|
-
BusinessRecomendPlaceMap,
|
|
4
|
-
DEFAULT_ZOOM,
|
|
5
|
-
RECOMMEND_PLACE_DRAG_LIMIT,
|
|
6
|
-
RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
7
|
-
RECOMMEND_PLACE_LARGE_LIMIT,
|
|
8
|
-
RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
9
|
-
RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
10
|
-
RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
11
|
-
ZONE_ZOOM
|
|
3
|
+
B as BusinessRecomendPlaceMap,
|
|
4
|
+
D as DEFAULT_ZOOM,
|
|
5
|
+
a as RECOMMEND_PLACE_DRAG_LIMIT,
|
|
6
|
+
c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
7
|
+
R as RECOMMEND_PLACE_LARGE_LIMIT,
|
|
8
|
+
e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
9
|
+
b as RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
10
|
+
d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
11
|
+
Z as ZONE_ZOOM
|
|
12
12
|
};
|
|
@@ -14,15 +14,14 @@ import { CenterPlaceStatus } from "../../types/interface.js";
|
|
|
14
14
|
import { watchPostEffectOnce } from "../../utils/compare.js";
|
|
15
15
|
import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
|
|
16
16
|
import { detectBrowserPlatform } from "../../utils/platform.js";
|
|
17
|
-
import {
|
|
17
|
+
import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
|
|
18
18
|
import { toCoordinateRecommendZonePlacesType, toCoordinatePlaceType } from "../../utils/typeChecking.js";
|
|
19
19
|
import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
20
|
-
import { RECOMMEND_PLACE_LARGE_LIMIT, RECOMMEND_PLACE_DRAG_LIMIT, ZONE_ZOOM, RECOMMEND_PLACE_ZONE_ICON_MIN, RECOMMEND_PLACE_ICON_ZOOM_MIN, RECOMMEND_PLACE_ZONE_TEXT_MIN, RECOMMEND_PLACE_TEXT_ZOOM_MIN, DEFAULT_ZOOM } from "
|
|
20
|
+
import { m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.ca62e565.js";
|
|
21
21
|
import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
|
|
22
22
|
import { GreenZone } from "../GreenZone/GreenZone.js";
|
|
23
23
|
import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
|
|
24
24
|
import { PickupPoints } from "../PickupPoints/PickupPoints.js";
|
|
25
|
-
import { m as memoize } from "../../chunks/memoize.d65d3da0.js";
|
|
26
25
|
const emptyPlace = {
|
|
27
26
|
lng: 0,
|
|
28
27
|
lat: 0,
|
|
@@ -128,6 +127,11 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
|
|
|
128
127
|
return;
|
|
129
128
|
emit("geoErrorOnce", geoPositionError2businessTimeout(e, detectBrowserPlatform()));
|
|
130
129
|
}, () => 0);
|
|
130
|
+
const emitBusinessGeoError = (e) => {
|
|
131
|
+
const error = e;
|
|
132
|
+
error.isBusinessTimeout = geoPositionError2businessTimeout(e, detectBrowserPlatform());
|
|
133
|
+
emit("geoError", error);
|
|
134
|
+
};
|
|
131
135
|
const {
|
|
132
136
|
geoPosition,
|
|
133
137
|
geoError,
|
|
@@ -139,7 +143,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
|
|
|
139
143
|
emit("changeGeoLocation", coordinatifyGeoPosition(v));
|
|
140
144
|
},
|
|
141
145
|
onError: (error) => {
|
|
142
|
-
|
|
146
|
+
emitBusinessGeoError(error);
|
|
143
147
|
emitGeoErrorOnce(error);
|
|
144
148
|
}
|
|
145
149
|
});
|