@heycar/heycars-map 0.5.8 → 0.6.0
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 +1 -10
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -2
- package/dist/components/Amap/Amap.d.ts +2 -1
- package/dist/hooks/useMapDrag.d.ts +1 -0
- package/dist/hooks/useMapPlace.d.ts +0 -18
- package/dist/hooks/useMapRecomendPlace.d.ts +0 -22
- package/dist/hooks-business/useBusinessRecomendPlaceMap.d.ts +0 -6
- package/dist/index.cjs +52 -312
- package/dist/index.d.ts +0 -1
- package/dist/index.js +52 -312
- package/dist/types/interface.d.ts +0 -17
- package/dist/utils/transform.d.ts +0 -1
- package/package.json +1 -1
- package/todo.md +5 -0
- package/dist/hooks/useMapAutoComplete.d.ts +0 -49
- package/dist/hooks/useMapCityBound.d.ts +0 -9
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +0 -20
package/dist/index.cjs
CHANGED
|
@@ -937,18 +937,6 @@ const pipeOnlyLastEffect = (fn) => {
|
|
|
937
937
|
});
|
|
938
938
|
};
|
|
939
939
|
};
|
|
940
|
-
const geocoderResult2cityName = (value) => {
|
|
941
|
-
const { address_components } = value;
|
|
942
|
-
const address = address_components.find(
|
|
943
|
-
(item) => item.types[0] === "administrative_area_level_1" || item.types[0] === "administrative_area_level_2"
|
|
944
|
-
);
|
|
945
|
-
if (address)
|
|
946
|
-
return address.long_name;
|
|
947
|
-
const countryIdx = address_components.findIndex((item) => item.types[0] === "country");
|
|
948
|
-
if (countryIdx > 0)
|
|
949
|
-
return address_components[countryIdx - 1].long_name;
|
|
950
|
-
return void 0;
|
|
951
|
-
};
|
|
952
940
|
const isPlaceEqual = (p1, p2) => {
|
|
953
941
|
return p1.lng === (p2 == null ? void 0 : p2.lng) && p1.lat === (p2 == null ? void 0 : p2.lat);
|
|
954
942
|
};
|
|
@@ -2113,7 +2101,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2113
2101
|
"disableDoubleClickZoom": touchEnable,
|
|
2114
2102
|
"gestureHandling": touchEnable ? "auto" : "none",
|
|
2115
2103
|
"keyboardShortcuts": touchEnable,
|
|
2116
|
-
"rotateControl":
|
|
2104
|
+
"rotateControl": false,
|
|
2117
2105
|
"zoomControl": touchEnable,
|
|
2118
2106
|
"scaleControl": touchEnable,
|
|
2119
2107
|
"panControl": touchEnable
|
|
@@ -2131,7 +2119,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2131
2119
|
"zoom": zoom,
|
|
2132
2120
|
"dragEnable": touchEnable,
|
|
2133
2121
|
"zoomEnable": touchEnable,
|
|
2134
|
-
"rotateEnable":
|
|
2122
|
+
"rotateEnable": false,
|
|
2135
2123
|
"doubleClickZoom": touchEnable,
|
|
2136
2124
|
"scrollWheel": touchEnable,
|
|
2137
2125
|
"touchZoom": touchEnable,
|
|
@@ -3164,29 +3152,56 @@ const useHeycarMap = () => {
|
|
|
3164
3152
|
const { supplier } = useMapSupplier();
|
|
3165
3153
|
return supplier === "gmap" ? useHeycarGamp() : useHeycarAmap();
|
|
3166
3154
|
};
|
|
3155
|
+
const DRAGEND_DETECTING_ANIMATION_DELAY = 50;
|
|
3167
3156
|
const useAmapDrag = (props) => {
|
|
3168
3157
|
const { mapRef, onChange } = props;
|
|
3169
3158
|
const centerRef = Vue.ref([0, 0]);
|
|
3170
3159
|
const isDragging = Vue.ref(false);
|
|
3160
|
+
const isDragEndWaitingMovingEndRef = Vue.ref(false);
|
|
3161
|
+
let watchId = void 0;
|
|
3171
3162
|
const emitDragStart = () => {
|
|
3172
3163
|
pipeAsync(() => {
|
|
3173
3164
|
isDragging.value = true;
|
|
3174
3165
|
})();
|
|
3175
3166
|
};
|
|
3176
|
-
const
|
|
3167
|
+
const handleDragEndWithAnimationEnd = (target) => {
|
|
3177
3168
|
var _a;
|
|
3169
|
+
isDragEndWaitingMovingEndRef.value = false;
|
|
3178
3170
|
isDragging.value = false;
|
|
3179
3171
|
const { lng, lat } = target.getCenter();
|
|
3180
|
-
spaceLog("
|
|
3172
|
+
spaceLog("onDragEndWithAnimationEnd", "[lng, lat] = ", [lng, lat]);
|
|
3181
3173
|
centerRef.value = [lng, lat];
|
|
3182
3174
|
(_a = pipeAsync(onChange)) == null ? void 0 : _a([lng, lat]);
|
|
3183
3175
|
};
|
|
3176
|
+
const emitDragEnd = (_, { target }) => {
|
|
3177
|
+
const { lng: baseLng, lat: baseLat } = target.getCenter();
|
|
3178
|
+
isDragEndWaitingMovingEndRef.value = true;
|
|
3179
|
+
if (watchId)
|
|
3180
|
+
clearTimeout(watchId);
|
|
3181
|
+
watchId = setTimeout(() => {
|
|
3182
|
+
watchId = void 0;
|
|
3183
|
+
const { lng, lat } = target.getCenter();
|
|
3184
|
+
if (!isDragEndWaitingMovingEndRef.value)
|
|
3185
|
+
return;
|
|
3186
|
+
if (baseLng !== lng || baseLat !== lat)
|
|
3187
|
+
return;
|
|
3188
|
+
handleDragEndWithAnimationEnd(target);
|
|
3189
|
+
}, DRAGEND_DETECTING_ANIMATION_DELAY);
|
|
3190
|
+
};
|
|
3191
|
+
const handleMoveEnd = (_, { target }) => {
|
|
3192
|
+
if (!isDragEndWaitingMovingEndRef.value)
|
|
3193
|
+
return;
|
|
3194
|
+
handleDragEndWithAnimationEnd(target);
|
|
3195
|
+
};
|
|
3184
3196
|
watchPostEffectForAMapEvent(mapRef, {}, emitDragStart, [
|
|
3185
3197
|
"onDragStart"
|
|
3186
3198
|
]);
|
|
3187
3199
|
watchPostEffectForAMapEvent(mapRef, {}, emitDragEnd, [
|
|
3188
3200
|
"onDragEnd"
|
|
3189
3201
|
]);
|
|
3202
|
+
watchPostEffectForAMapEvent(mapRef, {}, handleMoveEnd, [
|
|
3203
|
+
"onMoveend"
|
|
3204
|
+
]);
|
|
3190
3205
|
return { centerRef, isDragging };
|
|
3191
3206
|
};
|
|
3192
3207
|
const useGmapDrag = (props) => {
|
|
@@ -3227,7 +3242,7 @@ const useUpdate = () => {
|
|
|
3227
3242
|
return { idx, update };
|
|
3228
3243
|
};
|
|
3229
3244
|
const useAmapPlace = (props) => {
|
|
3230
|
-
const { onChange,
|
|
3245
|
+
const { onChange, emptyPlaceName } = props;
|
|
3231
3246
|
const defaultPoint = [...props.pointRef.value];
|
|
3232
3247
|
const pointRef = Vue.ref(defaultPoint);
|
|
3233
3248
|
const { readyPromise } = useMapSupplier();
|
|
@@ -3237,19 +3252,6 @@ const useAmapPlace = (props) => {
|
|
|
3237
3252
|
name: ""
|
|
3238
3253
|
});
|
|
3239
3254
|
const { idx: placeKey, update } = useUpdate();
|
|
3240
|
-
const updateCity = (value) => {
|
|
3241
|
-
const geocoder = new AMap.Geocoder({ lang: LANGUAGE });
|
|
3242
|
-
const { lng, lat } = value;
|
|
3243
|
-
geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
|
|
3244
|
-
if (status !== "complete")
|
|
3245
|
-
return;
|
|
3246
|
-
const { formattedAddress, addressComponent } = result.regeocode;
|
|
3247
|
-
const name = formattedAddress ? formattedAddress : emptyPlaceName;
|
|
3248
|
-
const cityName = addressComponent.city ? addressComponent.city : addressComponent.province;
|
|
3249
|
-
const cityParentName = addressComponent.province;
|
|
3250
|
-
onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
|
|
3251
|
-
});
|
|
3252
|
-
};
|
|
3253
3255
|
const updatePlace = (value) => {
|
|
3254
3256
|
pointRef.value = value;
|
|
3255
3257
|
update();
|
|
@@ -3268,15 +3270,12 @@ const useAmapPlace = (props) => {
|
|
|
3268
3270
|
geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
|
|
3269
3271
|
switch (status) {
|
|
3270
3272
|
case "complete": {
|
|
3271
|
-
const { formattedAddress
|
|
3272
|
-
const cityName = addressComponent.city ? addressComponent.city : addressComponent.province;
|
|
3273
|
-
const cityParentName = addressComponent.province;
|
|
3273
|
+
const { formattedAddress } = result.regeocode;
|
|
3274
3274
|
const name = formattedAddress ? formattedAddress : emptyPlaceName;
|
|
3275
3275
|
place.name = name;
|
|
3276
3276
|
place.lng = lng;
|
|
3277
3277
|
place.lat = lat;
|
|
3278
3278
|
onChange == null ? void 0 : onChange({ lng, lat, name });
|
|
3279
|
-
onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName: "" });
|
|
3280
3279
|
return;
|
|
3281
3280
|
}
|
|
3282
3281
|
case "no_data":
|
|
@@ -3284,14 +3283,6 @@ const useAmapPlace = (props) => {
|
|
|
3284
3283
|
place.lng = lng;
|
|
3285
3284
|
place.lat = lat;
|
|
3286
3285
|
onChange == null ? void 0 : onChange({ lng, lat, name: "" });
|
|
3287
|
-
onChangeCity == null ? void 0 : onChangeCity({
|
|
3288
|
-
name: "",
|
|
3289
|
-
lng,
|
|
3290
|
-
lat,
|
|
3291
|
-
cityName: "",
|
|
3292
|
-
cityParentName: "",
|
|
3293
|
-
countryName: ""
|
|
3294
|
-
});
|
|
3295
3286
|
return;
|
|
3296
3287
|
case "error":
|
|
3297
3288
|
throw result;
|
|
@@ -3299,10 +3290,10 @@ const useAmapPlace = (props) => {
|
|
|
3299
3290
|
});
|
|
3300
3291
|
}
|
|
3301
3292
|
);
|
|
3302
|
-
return { place, updatePlace, setPlace
|
|
3293
|
+
return { place, updatePlace, setPlace };
|
|
3303
3294
|
};
|
|
3304
3295
|
const useGmapPlace = (props) => {
|
|
3305
|
-
const { onChange,
|
|
3296
|
+
const { onChange, emptyPlaceName } = props;
|
|
3306
3297
|
const defaultPoint = [...props.pointRef.value];
|
|
3307
3298
|
const pointRef = Vue.ref(defaultPoint);
|
|
3308
3299
|
const { readyPromise } = useMapSupplier();
|
|
@@ -3321,16 +3312,6 @@ const useGmapPlace = (props) => {
|
|
|
3321
3312
|
place.lat = value.lat;
|
|
3322
3313
|
place.name = value.name;
|
|
3323
3314
|
};
|
|
3324
|
-
const updateCity = async (value) => {
|
|
3325
|
-
const geocoder = new google.maps.Geocoder();
|
|
3326
|
-
const { lng, lat } = value;
|
|
3327
|
-
const { results } = await geocoder.geocode({ language: LANGUAGE, location: { lng, lat } });
|
|
3328
|
-
const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
|
|
3329
|
-
const cityName = geocoderResult2cityName(results[0]);
|
|
3330
|
-
const cityParentName = results.slice(-2)[0].address_components[0].long_name;
|
|
3331
|
-
const countryName = results.slice(-1)[0].address_components[0].long_name;
|
|
3332
|
-
onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
|
|
3333
|
-
};
|
|
3334
3315
|
Vue.watch(
|
|
3335
3316
|
() => placeKey.value,
|
|
3336
3317
|
async () => {
|
|
@@ -3339,17 +3320,13 @@ const useGmapPlace = (props) => {
|
|
|
3339
3320
|
const [lng, lat] = pointRef.value;
|
|
3340
3321
|
const { results } = await geocoder.geocode({ language: LANGUAGE, location: { lng, lat } });
|
|
3341
3322
|
const name = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
|
|
3342
|
-
const cityName = geocoderResult2cityName(results[0]);
|
|
3343
|
-
const cityParentName = results.slice(-2)[0].address_components[0].long_name;
|
|
3344
|
-
const countryName = results.slice(-1)[0].address_components[0].long_name;
|
|
3345
3323
|
place.lng = lng;
|
|
3346
3324
|
place.lat = lat;
|
|
3347
3325
|
place.name = name;
|
|
3348
3326
|
onChange == null ? void 0 : onChange({ lng, lat, name });
|
|
3349
|
-
onChangeCity == null ? void 0 : onChangeCity({ name, lng, lat, cityName, cityParentName, countryName });
|
|
3350
3327
|
}
|
|
3351
3328
|
);
|
|
3352
|
-
return { place, updatePlace, setPlace
|
|
3329
|
+
return { place, updatePlace, setPlace };
|
|
3353
3330
|
};
|
|
3354
3331
|
const useMapPlace = (props) => {
|
|
3355
3332
|
const { supplier } = useMapSupplier();
|
|
@@ -3380,25 +3357,15 @@ const findGmapNearestPlace = (place, candidates) => {
|
|
|
3380
3357
|
return { shortestPlace, shortestDistance };
|
|
3381
3358
|
};
|
|
3382
3359
|
const useAmapRecomendPlace = (props) => {
|
|
3383
|
-
const {
|
|
3384
|
-
pointRef,
|
|
3385
|
-
getRecomendPlace,
|
|
3386
|
-
getLimit,
|
|
3387
|
-
context: context2,
|
|
3388
|
-
emptyPlaceName,
|
|
3389
|
-
onChange,
|
|
3390
|
-
onChangePlace,
|
|
3391
|
-
onChangeCity
|
|
3392
|
-
} = props;
|
|
3360
|
+
const { pointRef, getRecomendPlace, getLimit, context: context2, emptyPlaceName, onChange, onChangePlace } = props;
|
|
3393
3361
|
const availableRef = Vue.ref(true);
|
|
3394
3362
|
const placeCandidatesRef = Vue.ref([]);
|
|
3395
3363
|
const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
|
|
3396
3364
|
const { readyPromise } = useMapSupplier();
|
|
3397
|
-
const { place, updatePlace, setPlace
|
|
3365
|
+
const { place, updatePlace, setPlace } = useAmapPlace({
|
|
3398
3366
|
emptyPlaceName,
|
|
3399
3367
|
pointRef,
|
|
3400
|
-
onChange: onChangePlace
|
|
3401
|
-
onChangeCity
|
|
3368
|
+
onChange: onChangePlace
|
|
3402
3369
|
});
|
|
3403
3370
|
const recomendPlace = Vue.reactive({ ...place });
|
|
3404
3371
|
const isElectedRef = Vue.computed(() => {
|
|
@@ -3441,30 +3408,19 @@ const useAmapRecomendPlace = (props) => {
|
|
|
3441
3408
|
updateRecomandPlace,
|
|
3442
3409
|
updatePlaceCandidates,
|
|
3443
3410
|
updatePlace,
|
|
3444
|
-
setPlace
|
|
3445
|
-
updateCity
|
|
3411
|
+
setPlace
|
|
3446
3412
|
};
|
|
3447
3413
|
};
|
|
3448
3414
|
const useGmapRecomendPlace = (props) => {
|
|
3449
|
-
const {
|
|
3450
|
-
pointRef,
|
|
3451
|
-
getRecomendPlace,
|
|
3452
|
-
getLimit,
|
|
3453
|
-
context: context2,
|
|
3454
|
-
emptyPlaceName,
|
|
3455
|
-
onChange,
|
|
3456
|
-
onChangePlace,
|
|
3457
|
-
onChangeCity
|
|
3458
|
-
} = props;
|
|
3415
|
+
const { pointRef, getRecomendPlace, getLimit, context: context2, emptyPlaceName, onChange, onChangePlace } = props;
|
|
3459
3416
|
const availableRef = Vue.ref(true);
|
|
3460
3417
|
const placeCandidatesRef = Vue.ref([]);
|
|
3461
3418
|
const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
|
|
3462
3419
|
const { readyPromise } = useMapSupplier();
|
|
3463
|
-
const { place, updatePlace, setPlace
|
|
3420
|
+
const { place, updatePlace, setPlace } = useGmapPlace({
|
|
3464
3421
|
emptyPlaceName,
|
|
3465
3422
|
pointRef,
|
|
3466
|
-
onChange: onChangePlace
|
|
3467
|
-
onChangeCity
|
|
3423
|
+
onChange: onChangePlace
|
|
3468
3424
|
});
|
|
3469
3425
|
const recomendPlace = Vue.reactive({ ...place });
|
|
3470
3426
|
const isElectedRef = Vue.computed(() => {
|
|
@@ -3507,8 +3463,7 @@ const useGmapRecomendPlace = (props) => {
|
|
|
3507
3463
|
updateRecomandPlace,
|
|
3508
3464
|
updatePlaceCandidates,
|
|
3509
3465
|
updatePlace,
|
|
3510
|
-
setPlace
|
|
3511
|
-
updateCity
|
|
3466
|
+
setPlace
|
|
3512
3467
|
};
|
|
3513
3468
|
};
|
|
3514
3469
|
const useMapRecomendPlace = (props) => {
|
|
@@ -3558,25 +3513,6 @@ const useMapZoom = (props) => {
|
|
|
3558
3513
|
const { supplier } = useMapSupplier();
|
|
3559
3514
|
return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
|
|
3560
3515
|
};
|
|
3561
|
-
const useWaitTimer = (props) => {
|
|
3562
|
-
const { interval } = props;
|
|
3563
|
-
let timer = void 0;
|
|
3564
|
-
const timerStop = {
|
|
3565
|
-
promise: Promise.resolve(),
|
|
3566
|
-
resolve: void 0
|
|
3567
|
-
};
|
|
3568
|
-
const timerStart = () => {
|
|
3569
|
-
var _a;
|
|
3570
|
-
if (timer)
|
|
3571
|
-
clearTimeout(timer);
|
|
3572
|
-
(_a = timerStop.resolve) == null ? void 0 : _a.call(timerStop);
|
|
3573
|
-
timerStop.promise = new Promise((resolve) => {
|
|
3574
|
-
timerStop.resolve = resolve;
|
|
3575
|
-
timer = setTimeout(resolve, interval);
|
|
3576
|
-
});
|
|
3577
|
-
};
|
|
3578
|
-
return { timerStart, timerStop };
|
|
3579
|
-
};
|
|
3580
3516
|
const imgPassengerCircle = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjEiIGhlaWdodD0iNjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTcuMSUiIHk9Ii03LjElIiB3aWR0aD0iMTE0LjMlIiBoZWlnaHQ9IjExNC4zJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249Ii41IiBpbj0ic2hhZG93T2Zmc2V0T3V0ZXIxIiByZXN1bHQ9InNoYWRvd0JsdXJPdXRlcjEiLz48ZmVDb21wb3NpdGUgaW49InNoYWRvd0JsdXJPdXRlcjEiIGluMj0iU291cmNlQWxwaGEiIG9wZXJhdG9yPSJvdXQiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbG9yTWF0cml4IHZhbHVlcz0iMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMC4yNzc0NTMwMTYgMCIgaW49InNoYWRvd0JsdXJPdXRlcjEiLz48L2ZpbHRlcj48Y2lyY2xlIGlkPSJwcmVmaXhfX2IiIGN4PSIzMCIgY3k9IjMwIiByPSIxMC41Ii8+PC9kZWZzPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC40MDUgLjI2NCkiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+PGNpcmNsZSBzdHJva2Utb3BhY2l0eT0iLjEiIHN0cm9rZT0iIzAwM0RGRiIgZmlsbC1vcGFjaXR5PSIuMTUiIGZpbGw9IiM0ODczRkUiIGN4PSIzMCIgY3k9IjMwIiByPSIyOS41Ii8+PHVzZSBmaWxsPSIjMDAwIiBmaWx0ZXI9InVybCgjcHJlZml4X19hKSIgeGxpbms6aHJlZj0iI3ByZWZpeF9fYiIvPjxjaXJjbGUgc3Ryb2tlPSIjRkZGIiBzdHJva2Utd2lkdGg9IjIuNCIgc3Ryb2tlLWxpbmVqb2luPSJzcXVhcmUiIGZpbGw9IiM0ODcxRjEiIGN4PSIzMCIgY3k9IjMwIiByPSI5LjMiLz48L2c+PC9zdmc+";
|
|
3581
3517
|
const imgPassengerSmall = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxmaWx0ZXIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSIgZmlsdGVyVW5pdHM9Im9iamVjdEJvdW5kaW5nQm94IiBpZD0icHJlZml4X19hIj48ZmVPZmZzZXQgaW49IlNvdXJjZUFscGhhIiByZXN1bHQ9InNoYWRvd09mZnNldE91dGVyMSIvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249IjIiIGluPSJzaGFkb3dPZmZzZXRPdXRlcjEiIHJlc3VsdD0ic2hhZG93Qmx1ck91dGVyMSIvPjxmZUNvbXBvc2l0ZSBpbj0ic2hhZG93Qmx1ck91dGVyMSIgaW4yPSJTb3VyY2VBbHBoYSIgb3BlcmF0b3I9Im91dCIgcmVzdWx0PSJzaGFkb3dCbHVyT3V0ZXIxIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI0IDAiIGluPSJzaGFkb3dCbHVyT3V0ZXIxIi8+PC9maWx0ZXI+PGNpcmNsZSBpZD0icHJlZml4X19iIiBjeD0iMTU3IiBjeT0iMzUyIiByPSIxMCIvPjwvZGVmcz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTQzIC0zMzgpIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iIzAwMCIgZmlsdGVyPSJ1cmwoI3ByZWZpeF9fYSkiIHhsaW5rOmhyZWY9IiNwcmVmaXhfX2IiLz48Y2lyY2xlIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIyLjQiIHN0cm9rZS1saW5lam9pbj0ic3F1YXJlIiBmaWxsPSIjNDg3MUYxIiBjeD0iMTU3IiBjeT0iMzUyIiByPSI4LjgiLz48L2c+PC9zdmc+";
|
|
3582
3518
|
const PassengerCircle_css_ts_vanilla = "";
|
|
@@ -3910,7 +3846,6 @@ const useFirstWorkflowRecomendLoading = () => {
|
|
|
3910
3846
|
};
|
|
3911
3847
|
const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
3912
3848
|
const RECOMMEND_PLACE_LARGE_LIMIT = 100;
|
|
3913
|
-
const MAP_DRAG_END_WAIT_ANIMATION = 500;
|
|
3914
3849
|
const RECOMMEND_PLACE_ZOOM_MIN = 13;
|
|
3915
3850
|
const DEFAULT_PLACE_NAME = "当前位置";
|
|
3916
3851
|
const DEFAULT_ZOOM = 8;
|
|
@@ -3924,6 +3859,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3924
3859
|
geoDefaultPosition,
|
|
3925
3860
|
getRecomendPlace,
|
|
3926
3861
|
getDefaultCenterPlace,
|
|
3862
|
+
onChangePlace,
|
|
3927
3863
|
mapContext
|
|
3928
3864
|
} = props;
|
|
3929
3865
|
const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
|
|
@@ -3942,12 +3878,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3942
3878
|
mapRef,
|
|
3943
3879
|
defaultValue: DEFAULT_ZOOM
|
|
3944
3880
|
});
|
|
3945
|
-
const {
|
|
3946
|
-
timerStart,
|
|
3947
|
-
timerStop
|
|
3948
|
-
} = useWaitTimer({
|
|
3949
|
-
interval: MAP_DRAG_END_WAIT_ANIMATION
|
|
3950
|
-
});
|
|
3951
3881
|
const {
|
|
3952
3882
|
isFirstWorkflowRecomendLoadingRef,
|
|
3953
3883
|
completeFirstWorkflowRecomend
|
|
@@ -3970,7 +3900,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3970
3900
|
centerPlace.lng = place.lng;
|
|
3971
3901
|
centerPlace.lat = place.lat;
|
|
3972
3902
|
centerPlace.name = place.name;
|
|
3973
|
-
|
|
3903
|
+
onChangePlace == null ? void 0 : onChangePlace({
|
|
3904
|
+
...place
|
|
3905
|
+
});
|
|
3974
3906
|
updatePlaceCandidates(place);
|
|
3975
3907
|
await pipeDefer(setZoom)(READY_ZOOM);
|
|
3976
3908
|
};
|
|
@@ -4026,14 +3958,12 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
4026
3958
|
mapRef,
|
|
4027
3959
|
onChange: (point) => {
|
|
4028
3960
|
centerSource.source = "drag";
|
|
4029
|
-
timerStart();
|
|
4030
3961
|
updatePlace(point);
|
|
4031
3962
|
emit("changeByDrag", point);
|
|
4032
3963
|
}
|
|
4033
3964
|
});
|
|
4034
3965
|
const {
|
|
4035
3966
|
updatePlace,
|
|
4036
|
-
updateCity,
|
|
4037
3967
|
updateRecomandPlace,
|
|
4038
3968
|
updatePlaceCandidates,
|
|
4039
3969
|
placeCandidates,
|
|
@@ -4064,7 +3994,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
4064
3994
|
emit("changePlace", place);
|
|
4065
3995
|
},
|
|
4066
3996
|
onChange: async (place) => {
|
|
4067
|
-
await timerStop.promise;
|
|
4068
3997
|
centerSource.source = "recomend";
|
|
4069
3998
|
Object.assign(centerPlace, {
|
|
4070
3999
|
...place
|
|
@@ -4074,9 +4003,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
4074
4003
|
if (isFirstWorkflowRecomendLoadingRef.value)
|
|
4075
4004
|
await pipeDefer(setZoom)(READY_ZOOM);
|
|
4076
4005
|
completeFirstWorkflowRecomend();
|
|
4077
|
-
},
|
|
4078
|
-
onChangeCity: (value) => {
|
|
4079
|
-
emit("changeCity", value);
|
|
4080
4006
|
}
|
|
4081
4007
|
});
|
|
4082
4008
|
Vue.watchEffect(() => {
|
|
@@ -4642,6 +4568,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4642
4568
|
distance,
|
|
4643
4569
|
duration
|
|
4644
4570
|
}) => {
|
|
4571
|
+
var _a;
|
|
4645
4572
|
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4646
4573
|
return [Vue.h(DrivingLine, {
|
|
4647
4574
|
"attrs": {
|
|
@@ -4649,7 +4576,7 @@ const SectionDriverStartService = defineSetup(function SectionDriverStartService
|
|
|
4649
4576
|
}
|
|
4650
4577
|
}), Vue.h(TaxiCar, {
|
|
4651
4578
|
"attrs": {
|
|
4652
|
-
"position": carPosition,
|
|
4579
|
+
"position": (_a = path[0]) != null ? _a : carPosition,
|
|
4653
4580
|
"angle": angle,
|
|
4654
4581
|
"title": renderTitle({
|
|
4655
4582
|
distance,
|
|
@@ -4862,6 +4789,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4862
4789
|
distance,
|
|
4863
4790
|
duration
|
|
4864
4791
|
}) => {
|
|
4792
|
+
var _a;
|
|
4865
4793
|
spaceLog("angleDifference", "carPosition, routeAngle, driverAngle = ", carPosition, angle, carAngle);
|
|
4866
4794
|
return [Vue.h(DrivingLine, {
|
|
4867
4795
|
"attrs": {
|
|
@@ -4869,7 +4797,7 @@ const SectionInService = defineSetup(function SectionInService2(props) {
|
|
|
4869
4797
|
}
|
|
4870
4798
|
}), Vue.h(TaxiCar, {
|
|
4871
4799
|
"attrs": {
|
|
4872
|
-
"position": carPosition,
|
|
4800
|
+
"position": (_a = path[0]) != null ? _a : carPosition,
|
|
4873
4801
|
"angle": angle,
|
|
4874
4802
|
"title": renderTitle({
|
|
4875
4803
|
distance,
|
|
@@ -5190,193 +5118,6 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
5190
5118
|
)]);
|
|
5191
5119
|
};
|
|
5192
5120
|
}).props(["bookDispatchingTitle", "dispatchingTitle", "driverArrivedTitle", "driverStatus", "fallback", "from", "getDriverPosition", "interval", "loading", "mapRef", "renderInServiceTitle", "renderStartSerivceTitle", "to", "registerOverlay"]);
|
|
5193
|
-
const useAmapAutoComplete = (props) => {
|
|
5194
|
-
const { city } = props;
|
|
5195
|
-
const cityRef = Vue.ref(city);
|
|
5196
|
-
const { readyPromise } = useMapSupplier();
|
|
5197
|
-
const { apiMapDistance } = useMapGeometry();
|
|
5198
|
-
const { geoPosition } = useGeoLocation();
|
|
5199
|
-
const keywordRef = Vue.ref("");
|
|
5200
|
-
const autoCompletePlacesRef = Vue.ref([]);
|
|
5201
|
-
const { update, idx: updateKey } = useUpdate();
|
|
5202
|
-
const setCity = (value) => {
|
|
5203
|
-
cityRef.value = value;
|
|
5204
|
-
update();
|
|
5205
|
-
};
|
|
5206
|
-
const setKeyword = (value) => {
|
|
5207
|
-
keywordRef.value = value;
|
|
5208
|
-
update();
|
|
5209
|
-
};
|
|
5210
|
-
Vue.watch(
|
|
5211
|
-
() => updateKey.value,
|
|
5212
|
-
async () => {
|
|
5213
|
-
if (!keywordRef.value)
|
|
5214
|
-
return;
|
|
5215
|
-
await readyPromise;
|
|
5216
|
-
const amapPlaceSearch = new AMap.PlaceSearch({ city: cityRef.value.name });
|
|
5217
|
-
amapPlaceSearch.search(keywordRef.value, (status, result) => {
|
|
5218
|
-
const from = geoPosition.value;
|
|
5219
|
-
switch (status) {
|
|
5220
|
-
case "complete": {
|
|
5221
|
-
autoCompletePlacesRef.value = result.poiList.pois.map(
|
|
5222
|
-
(poi) => {
|
|
5223
|
-
const { lat, lng } = poi.location;
|
|
5224
|
-
return {
|
|
5225
|
-
lat,
|
|
5226
|
-
lng,
|
|
5227
|
-
name: poi.name,
|
|
5228
|
-
description: poi.address,
|
|
5229
|
-
distance: from ? apiMapDistance(from, [lng, lat]) : void 0
|
|
5230
|
-
};
|
|
5231
|
-
}
|
|
5232
|
-
);
|
|
5233
|
-
return;
|
|
5234
|
-
}
|
|
5235
|
-
case "no_data":
|
|
5236
|
-
autoCompletePlacesRef.value = [];
|
|
5237
|
-
return;
|
|
5238
|
-
default:
|
|
5239
|
-
throw result;
|
|
5240
|
-
}
|
|
5241
|
-
});
|
|
5242
|
-
},
|
|
5243
|
-
{
|
|
5244
|
-
immediate: true
|
|
5245
|
-
}
|
|
5246
|
-
);
|
|
5247
|
-
return { setKeyword, setCity, autoCompletePlaces: autoCompletePlacesRef };
|
|
5248
|
-
};
|
|
5249
|
-
const useGmapAutoComplete = (props) => {
|
|
5250
|
-
const { city } = props;
|
|
5251
|
-
const cityRef = Vue.ref({ ...city });
|
|
5252
|
-
const { readyPromise } = useMapSupplier();
|
|
5253
|
-
const { apiMapDistance } = useMapGeometry();
|
|
5254
|
-
const { geoPosition } = useGeoLocation();
|
|
5255
|
-
const keywordRef = Vue.ref("");
|
|
5256
|
-
const autoCompletePlacesRef = Vue.ref([]);
|
|
5257
|
-
const { update, idx: updateKey } = useUpdate();
|
|
5258
|
-
const setCity = (value) => {
|
|
5259
|
-
cityRef.value = value;
|
|
5260
|
-
update();
|
|
5261
|
-
};
|
|
5262
|
-
const setKeyword = (value) => {
|
|
5263
|
-
keywordRef.value = value;
|
|
5264
|
-
update();
|
|
5265
|
-
};
|
|
5266
|
-
const div = document.createElement("div");
|
|
5267
|
-
Vue.watch(
|
|
5268
|
-
() => updateKey.value,
|
|
5269
|
-
async () => {
|
|
5270
|
-
if (!keywordRef.value)
|
|
5271
|
-
return;
|
|
5272
|
-
await readyPromise;
|
|
5273
|
-
const gmapPlacesService = new google.maps.places.PlacesService(div);
|
|
5274
|
-
gmapPlacesService.textSearch(
|
|
5275
|
-
{
|
|
5276
|
-
query: keywordRef.value,
|
|
5277
|
-
bounds: cityRef.value.bound
|
|
5278
|
-
},
|
|
5279
|
-
(result, status) => {
|
|
5280
|
-
const from = geoPosition.value;
|
|
5281
|
-
switch (status) {
|
|
5282
|
-
case google.maps.places.PlacesServiceStatus.OK:
|
|
5283
|
-
autoCompletePlacesRef.value = result.map(({ geometry, name, formatted_address }) => {
|
|
5284
|
-
var _a, _b, _c, _d;
|
|
5285
|
-
const lng = (_b = (_a = geometry == null ? void 0 : geometry.location) == null ? void 0 : _a.lng()) != null ? _b : 0;
|
|
5286
|
-
const lat = (_d = (_c = geometry == null ? void 0 : geometry.location) == null ? void 0 : _c.lat()) != null ? _d : 0;
|
|
5287
|
-
return {
|
|
5288
|
-
lng,
|
|
5289
|
-
lat,
|
|
5290
|
-
name: name != null ? name : "",
|
|
5291
|
-
description: formatted_address != null ? formatted_address : "",
|
|
5292
|
-
distance: from ? apiMapDistance(from, [lng, lat]) : void 0
|
|
5293
|
-
};
|
|
5294
|
-
});
|
|
5295
|
-
return;
|
|
5296
|
-
case google.maps.places.PlacesServiceStatus.ZERO_RESULTS:
|
|
5297
|
-
case google.maps.places.PlacesServiceStatus.NOT_FOUND:
|
|
5298
|
-
autoCompletePlacesRef.value = [];
|
|
5299
|
-
return;
|
|
5300
|
-
}
|
|
5301
|
-
}
|
|
5302
|
-
);
|
|
5303
|
-
}
|
|
5304
|
-
);
|
|
5305
|
-
return { setKeyword, setCity, autoCompletePlaces: autoCompletePlacesRef };
|
|
5306
|
-
};
|
|
5307
|
-
const useMapAutoComplete = (props) => {
|
|
5308
|
-
const { supplier } = useMapSupplier();
|
|
5309
|
-
return supplier === "gmap" ? useGmapAutoComplete(props) : useAmapAutoComplete(props);
|
|
5310
|
-
};
|
|
5311
|
-
const useAmapBoundCity = (props) => {
|
|
5312
|
-
var _a;
|
|
5313
|
-
const { cityNameRef, onChange } = props;
|
|
5314
|
-
const city = Vue.reactive({ name: (_a = cityNameRef.value) != null ? _a : "" });
|
|
5315
|
-
Vue.watch(
|
|
5316
|
-
() => cityNameRef.value,
|
|
5317
|
-
(cityName) => {
|
|
5318
|
-
const name = cityName != null ? cityName : "";
|
|
5319
|
-
city.name = name;
|
|
5320
|
-
onChange == null ? void 0 : onChange({ name });
|
|
5321
|
-
}
|
|
5322
|
-
);
|
|
5323
|
-
return city;
|
|
5324
|
-
};
|
|
5325
|
-
const useGmapBoundCity = (props) => {
|
|
5326
|
-
var _a;
|
|
5327
|
-
const { cityNameRef, onChange } = props;
|
|
5328
|
-
const { readyPromise } = useMapSupplier();
|
|
5329
|
-
const city = Vue.reactive({
|
|
5330
|
-
name: (_a = cityNameRef.value) != null ? _a : "",
|
|
5331
|
-
bound: {
|
|
5332
|
-
east: 0,
|
|
5333
|
-
north: 0,
|
|
5334
|
-
south: 0,
|
|
5335
|
-
west: 0
|
|
5336
|
-
}
|
|
5337
|
-
});
|
|
5338
|
-
Vue.watchEffect(async () => {
|
|
5339
|
-
var _a2, _b;
|
|
5340
|
-
const cityName = cityNameRef.value;
|
|
5341
|
-
if (!cityName)
|
|
5342
|
-
return;
|
|
5343
|
-
await readyPromise;
|
|
5344
|
-
const geocoder = new google.maps.Geocoder();
|
|
5345
|
-
const { results } = await geocoder.geocode({
|
|
5346
|
-
address: cityName,
|
|
5347
|
-
componentRestrictions: {
|
|
5348
|
-
administrativeArea: "administrative_area_level_1"
|
|
5349
|
-
},
|
|
5350
|
-
language: LANGUAGE
|
|
5351
|
-
});
|
|
5352
|
-
if (results.length !== 1) {
|
|
5353
|
-
throw new Error("MyError: multiple city found");
|
|
5354
|
-
}
|
|
5355
|
-
const { geometry } = results[0];
|
|
5356
|
-
const cityBound = (_b = (_a2 = geometry.bounds) == null ? void 0 : _a2.toJSON()) != null ? _b : geometry.viewport.toJSON();
|
|
5357
|
-
city.name = cityName;
|
|
5358
|
-
city.bound = cityBound;
|
|
5359
|
-
onChange == null ? void 0 : onChange({ name: cityName, bound: cityBound });
|
|
5360
|
-
});
|
|
5361
|
-
return city;
|
|
5362
|
-
};
|
|
5363
|
-
const useMapBoundCity = (props) => {
|
|
5364
|
-
const { supplier } = useMapSupplier();
|
|
5365
|
-
return supplier === "gmap" ? useGmapBoundCity(props) : useAmapBoundCity(props);
|
|
5366
|
-
};
|
|
5367
|
-
const useBusinessMapAutoComplete = (props) => {
|
|
5368
|
-
const { cityNameRef } = props;
|
|
5369
|
-
const city = useMapBoundCity({
|
|
5370
|
-
cityNameRef,
|
|
5371
|
-
onChange: (v) => setCity(v)
|
|
5372
|
-
});
|
|
5373
|
-
const { autoCompletePlaces, setKeyword, setCity } = useMapAutoComplete({ city });
|
|
5374
|
-
const handleKeywordInput = (e) => {
|
|
5375
|
-
const target = e.target;
|
|
5376
|
-
setKeyword(target.value);
|
|
5377
|
-
};
|
|
5378
|
-
return { autoCompletePlaces, setKeyword, setCity, handleKeywordInput };
|
|
5379
|
-
};
|
|
5380
5121
|
const useBusinessQuotingMap = () => {
|
|
5381
5122
|
const { setMap, mapRef } = useHeycarMap();
|
|
5382
5123
|
const { registerFitVeiw, setFitView } = useMapFitView({
|
|
@@ -5445,7 +5186,6 @@ exports.TaxiCar = TaxiCar;
|
|
|
5445
5186
|
exports.WalkingLine = WalkingLine;
|
|
5446
5187
|
exports.WalkingRoute = WalkingRoute;
|
|
5447
5188
|
exports.WaveCircle = WaveCircle;
|
|
5448
|
-
exports.useBusinessMapAutoComplete = useBusinessMapAutoComplete;
|
|
5449
5189
|
exports.useBusinessQuotingMap = useBusinessQuotingMap;
|
|
5450
5190
|
exports.useBusinessRecomendPlaceMap = useBusinessRecomendPlaceMap;
|
|
5451
5191
|
exports.useBusinessTaxiServiceMap = useBusinessTaxiServiceMap;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ export { WalkingLine } from "./business-components/WalkingLine";
|
|
|
16
16
|
export { WalkingRoute } from "./business-components/WalkingRoute";
|
|
17
17
|
export { WaveCircle } from "./business-components/WaveCircle";
|
|
18
18
|
export * from "./components/MapProvider";
|
|
19
|
-
export * from "./hooks-business/useBusinessMapAutoComplete";
|
|
20
19
|
export * from "./hooks-business/useBusinessQuotingMap";
|
|
21
20
|
export * from "./hooks-business/useBusinessRecomendPlaceMap";
|
|
22
21
|
export * from "./hooks-business/useBusinessTaxiServiceMap";
|