@heycar/heycars-map 0.7.11 → 0.8.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/index.cjs +309 -99
- package/dist/index.js +309 -99
- package/dist/src/Demo/DemoBusinessReselectPlace.d.ts +1 -0
- package/dist/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.d.ts +8 -1
- package/dist/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +1 -0
- package/dist/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +5 -0
- package/dist/src/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +6 -0
- package/dist/src/business-components/BusinessReselectPlaceMap/index.d.ts +1 -0
- package/dist/src/hooks-business/useBusinessRecomendPlaceMap.d.ts +0 -2
- package/dist/src/hooks-business/useBusinessReselectPlaceMap.d.ts +20 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/compare.d.ts +1 -0
- package/dist/style.css +8 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
9
9
|
const Vue = require("vue");
|
|
10
10
|
const style = "";
|
|
11
11
|
const name = "@heycar/heycars-map";
|
|
12
|
-
const version = "0.
|
|
12
|
+
const version = "0.8.0";
|
|
13
13
|
const type = "module";
|
|
14
14
|
const scripts = {
|
|
15
15
|
dev: "vite -c vite.config.dev.ts",
|
|
@@ -655,15 +655,85 @@ function defineLagecySetup(setup) {
|
|
|
655
655
|
const createElement = Vue.h;
|
|
656
656
|
const LANGUAGE = "zh-CN";
|
|
657
657
|
const AbsoluteAddressBox_css_ts_vanilla = "";
|
|
658
|
+
function _defineProperty(obj, key, value) {
|
|
659
|
+
if (key in obj) {
|
|
660
|
+
Object.defineProperty(obj, key, {
|
|
661
|
+
value,
|
|
662
|
+
enumerable: true,
|
|
663
|
+
configurable: true,
|
|
664
|
+
writable: true
|
|
665
|
+
});
|
|
666
|
+
} else {
|
|
667
|
+
obj[key] = value;
|
|
668
|
+
}
|
|
669
|
+
return obj;
|
|
670
|
+
}
|
|
671
|
+
function ownKeys(object, enumerableOnly) {
|
|
672
|
+
var keys2 = Object.keys(object);
|
|
673
|
+
if (Object.getOwnPropertySymbols) {
|
|
674
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
675
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
676
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
677
|
+
})), keys2.push.apply(keys2, symbols);
|
|
678
|
+
}
|
|
679
|
+
return keys2;
|
|
680
|
+
}
|
|
681
|
+
function _objectSpread2(target) {
|
|
682
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
683
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
684
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
685
|
+
_defineProperty(target, key, source[key]);
|
|
686
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
687
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
return target;
|
|
691
|
+
}
|
|
692
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
693
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
694
|
+
var _selections$key;
|
|
695
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return true;
|
|
700
|
+
};
|
|
701
|
+
var createRuntimeFn = (config) => (options) => {
|
|
702
|
+
var className = config.defaultClassName;
|
|
703
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
704
|
+
for (var variantName in selections) {
|
|
705
|
+
var _selections$variantNa;
|
|
706
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
707
|
+
if (variantSelection != null) {
|
|
708
|
+
var selection = variantSelection;
|
|
709
|
+
if (typeof selection === "boolean") {
|
|
710
|
+
selection = selection === true ? "true" : "false";
|
|
711
|
+
}
|
|
712
|
+
var selectionClassName = (
|
|
713
|
+
// @ts-expect-error
|
|
714
|
+
config.variantClassNames[variantName][selection]
|
|
715
|
+
);
|
|
716
|
+
if (selectionClassName) {
|
|
717
|
+
className += " " + selectionClassName;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
722
|
+
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
723
|
+
className += " " + compoundClassName;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return className;
|
|
727
|
+
};
|
|
658
728
|
var absoluteAddressBox = "n8tgem1";
|
|
659
729
|
var absoluteAddressBoxLayout = "n8tgem0";
|
|
660
|
-
var arrowRight = "
|
|
661
|
-
var boxDescription = "
|
|
662
|
-
var boxTextLayout = "n8tgem2";
|
|
663
|
-
var boxTitle = "
|
|
664
|
-
var imgDotLoading = "
|
|
665
|
-
var locatorIcon = "
|
|
666
|
-
var straightLine = "
|
|
730
|
+
var arrowRight = "n8tgem8";
|
|
731
|
+
var boxDescription = "n8tgem6";
|
|
732
|
+
var boxTextLayout = createRuntimeFn({ defaultClassName: "n8tgem2", variantClassNames: { withArrow: { true: "n8tgem3", false: "n8tgem4" } }, defaultVariants: {}, compoundVariants: [] });
|
|
733
|
+
var boxTitle = "n8tgem5";
|
|
734
|
+
var imgDotLoading = "n8tgem7";
|
|
735
|
+
var locatorIcon = "n8tgema";
|
|
736
|
+
var straightLine = "n8tgem9";
|
|
667
737
|
const MultilineTitle = defineSetup(function MultilineTitle2(props) {
|
|
668
738
|
const linesRef = Vue.computed(() => {
|
|
669
739
|
var _a;
|
|
@@ -679,7 +749,8 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
679
749
|
const {
|
|
680
750
|
type: type2,
|
|
681
751
|
title,
|
|
682
|
-
description
|
|
752
|
+
description,
|
|
753
|
+
withArrow = false
|
|
683
754
|
} = props;
|
|
684
755
|
if (type2 === "locator")
|
|
685
756
|
return Vue.h("div", {
|
|
@@ -714,7 +785,9 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
714
785
|
"click": handleClick
|
|
715
786
|
}
|
|
716
787
|
}, [Vue.h("div", {
|
|
717
|
-
"class": boxTextLayout
|
|
788
|
+
"class": boxTextLayout({
|
|
789
|
+
withArrow
|
|
790
|
+
})
|
|
718
791
|
}, [Vue.h(MultilineTitle, {
|
|
719
792
|
"class": boxTitle,
|
|
720
793
|
"attrs": {
|
|
@@ -722,7 +795,7 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
722
795
|
}
|
|
723
796
|
}), !!description && Vue.h("div", {
|
|
724
797
|
"class": boxDescription
|
|
725
|
-
}, [description])]), Vue.h("img", {
|
|
798
|
+
}, [description])]), withArrow && Vue.h("img", {
|
|
726
799
|
"class": arrowRight,
|
|
727
800
|
"attrs": {
|
|
728
801
|
"src": imgArrowRight
|
|
@@ -1250,6 +1323,9 @@ function watchPostEffectForGMapEvent(targetRef, props, emit, propertyNames) {
|
|
|
1250
1323
|
});
|
|
1251
1324
|
});
|
|
1252
1325
|
}
|
|
1326
|
+
const watchPostEffectOnce = (callback) => {
|
|
1327
|
+
Vue.watch(() => 0, callback, { immediate: true, flush: "post" });
|
|
1328
|
+
};
|
|
1253
1329
|
const AmapMarker = defineSetup(function AmapMarker2(props, { emit }) {
|
|
1254
1330
|
const { registerOverlay } = props;
|
|
1255
1331
|
const markerRef = Vue.shallowRef();
|
|
@@ -2350,76 +2426,6 @@ const useResizeObserver = (props) => {
|
|
|
2350
2426
|
});
|
|
2351
2427
|
};
|
|
2352
2428
|
const Gmap_css_ts_vanilla = "";
|
|
2353
|
-
function _defineProperty(obj, key, value) {
|
|
2354
|
-
if (key in obj) {
|
|
2355
|
-
Object.defineProperty(obj, key, {
|
|
2356
|
-
value,
|
|
2357
|
-
enumerable: true,
|
|
2358
|
-
configurable: true,
|
|
2359
|
-
writable: true
|
|
2360
|
-
});
|
|
2361
|
-
} else {
|
|
2362
|
-
obj[key] = value;
|
|
2363
|
-
}
|
|
2364
|
-
return obj;
|
|
2365
|
-
}
|
|
2366
|
-
function ownKeys(object, enumerableOnly) {
|
|
2367
|
-
var keys2 = Object.keys(object);
|
|
2368
|
-
if (Object.getOwnPropertySymbols) {
|
|
2369
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
2370
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
2371
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2372
|
-
})), keys2.push.apply(keys2, symbols);
|
|
2373
|
-
}
|
|
2374
|
-
return keys2;
|
|
2375
|
-
}
|
|
2376
|
-
function _objectSpread2(target) {
|
|
2377
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2378
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
2379
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
2380
|
-
_defineProperty(target, key, source[key]);
|
|
2381
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
2382
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2383
|
-
});
|
|
2384
|
-
}
|
|
2385
|
-
return target;
|
|
2386
|
-
}
|
|
2387
|
-
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
2388
|
-
for (var key of Object.keys(compoundCheck)) {
|
|
2389
|
-
var _selections$key;
|
|
2390
|
-
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
2391
|
-
return false;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
return true;
|
|
2395
|
-
};
|
|
2396
|
-
var createRuntimeFn = (config) => (options) => {
|
|
2397
|
-
var className = config.defaultClassName;
|
|
2398
|
-
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
2399
|
-
for (var variantName in selections) {
|
|
2400
|
-
var _selections$variantNa;
|
|
2401
|
-
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
2402
|
-
if (variantSelection != null) {
|
|
2403
|
-
var selection = variantSelection;
|
|
2404
|
-
if (typeof selection === "boolean") {
|
|
2405
|
-
selection = selection === true ? "true" : "false";
|
|
2406
|
-
}
|
|
2407
|
-
var selectionClassName = (
|
|
2408
|
-
// @ts-expect-error
|
|
2409
|
-
config.variantClassNames[variantName][selection]
|
|
2410
|
-
);
|
|
2411
|
-
if (selectionClassName) {
|
|
2412
|
-
className += " " + selectionClassName;
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
2417
|
-
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
2418
|
-
className += " " + compoundClassName;
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
return className;
|
|
2422
|
-
};
|
|
2423
2429
|
var gmap = "_7anfuo0";
|
|
2424
2430
|
const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
|
|
2425
2431
|
const setMap = props.mapRef;
|
|
@@ -6320,9 +6326,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6320
6326
|
}
|
|
6321
6327
|
},
|
|
6322
6328
|
onChange: (v) => emit("changeGeoLocation", v),
|
|
6323
|
-
onError: (e) =>
|
|
6324
|
-
emit("geoError", e);
|
|
6325
|
-
}
|
|
6329
|
+
onError: (e) => emit("geoError", e)
|
|
6326
6330
|
});
|
|
6327
6331
|
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
6328
6332
|
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
@@ -6392,14 +6396,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6392
6396
|
});
|
|
6393
6397
|
}
|
|
6394
6398
|
});
|
|
6395
|
-
Vue.watchEffect(() => {
|
|
6396
|
-
mapContext.onChangeCenterPlace({
|
|
6397
|
-
...centerPlace
|
|
6398
|
-
});
|
|
6399
|
-
});
|
|
6400
|
-
Vue.watchEffect(() => {
|
|
6401
|
-
mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
|
|
6402
|
-
});
|
|
6403
6399
|
return () => {
|
|
6404
6400
|
var _a2, _b2;
|
|
6405
6401
|
const {
|
|
@@ -6439,7 +6435,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6439
6435
|
"attrs": {
|
|
6440
6436
|
"title": title,
|
|
6441
6437
|
"description": description,
|
|
6442
|
-
"type": isDragging.value ? "locator" : "box"
|
|
6438
|
+
"type": isDragging.value ? "locator" : "box",
|
|
6439
|
+
"withArrow": true
|
|
6443
6440
|
},
|
|
6444
6441
|
"on": {
|
|
6445
6442
|
"click": () => emit("clickLocator")
|
|
@@ -6447,6 +6444,220 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6447
6444
|
})]);
|
|
6448
6445
|
};
|
|
6449
6446
|
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
6447
|
+
const emptyPlace = {
|
|
6448
|
+
lng: 0,
|
|
6449
|
+
lat: 0,
|
|
6450
|
+
name: "",
|
|
6451
|
+
displayName: ""
|
|
6452
|
+
};
|
|
6453
|
+
const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlaceMap2(props, {
|
|
6454
|
+
emit,
|
|
6455
|
+
slots
|
|
6456
|
+
}) {
|
|
6457
|
+
const {
|
|
6458
|
+
getRecomendPlace,
|
|
6459
|
+
mapContext,
|
|
6460
|
+
defaultPlace = {
|
|
6461
|
+
...emptyPlace
|
|
6462
|
+
}
|
|
6463
|
+
} = props;
|
|
6464
|
+
const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
|
|
6465
|
+
const {
|
|
6466
|
+
mapRef,
|
|
6467
|
+
mapElementRef,
|
|
6468
|
+
setMap,
|
|
6469
|
+
panTo
|
|
6470
|
+
} = useHeycarMap();
|
|
6471
|
+
const {
|
|
6472
|
+
zoomRef
|
|
6473
|
+
} = useMapZoom({
|
|
6474
|
+
mapRef,
|
|
6475
|
+
defaultValue: DEFAULT_ZOOM
|
|
6476
|
+
});
|
|
6477
|
+
const centerPlace = Vue.reactive({
|
|
6478
|
+
lng: defaultPlace.lng,
|
|
6479
|
+
lat: defaultPlace.lat,
|
|
6480
|
+
name: defaultPlace.name,
|
|
6481
|
+
displayName: defaultPlace.displayName
|
|
6482
|
+
});
|
|
6483
|
+
const centerPoint = Vue.computed(() => [centerPlace.lng, centerPlace.lat]);
|
|
6484
|
+
const centerSource = {
|
|
6485
|
+
source: "default"
|
|
6486
|
+
};
|
|
6487
|
+
const updateCenterPlaceByPoint = (point) => {
|
|
6488
|
+
centerSource.source = "api";
|
|
6489
|
+
updatePlace(point);
|
|
6490
|
+
};
|
|
6491
|
+
const setCenterPlaceByUserSpecified = async (input) => {
|
|
6492
|
+
centerSource.source = "api";
|
|
6493
|
+
const place = toPlaceType(input);
|
|
6494
|
+
centerPlace.lng = place.lng;
|
|
6495
|
+
centerPlace.lat = place.lat;
|
|
6496
|
+
centerPlace.name = place.name;
|
|
6497
|
+
centerPlace.displayName = place.displayName;
|
|
6498
|
+
emit("changePlace", {
|
|
6499
|
+
...place
|
|
6500
|
+
});
|
|
6501
|
+
updateRecommendPlace(place);
|
|
6502
|
+
};
|
|
6503
|
+
const setCenterPlaceByUserSpecifiedInZone = ({
|
|
6504
|
+
place,
|
|
6505
|
+
recommends
|
|
6506
|
+
}) => {
|
|
6507
|
+
centerPlace.lng = place.lng;
|
|
6508
|
+
centerPlace.lat = place.lat;
|
|
6509
|
+
centerPlace.name = place.name;
|
|
6510
|
+
centerPlace.displayName = place.displayName;
|
|
6511
|
+
setPlaceCandidatesAndZone(recommends);
|
|
6512
|
+
emit("changePlace", {
|
|
6513
|
+
...place
|
|
6514
|
+
});
|
|
6515
|
+
};
|
|
6516
|
+
const panToCenterByPlace = async (place) => {
|
|
6517
|
+
centerSource.source = "api";
|
|
6518
|
+
await panTo(place2point(place));
|
|
6519
|
+
centerPlace.lng = place.lng;
|
|
6520
|
+
centerPlace.lat = place.lat;
|
|
6521
|
+
centerPlace.name = place.name;
|
|
6522
|
+
centerPlace.displayName = place.displayName;
|
|
6523
|
+
emit("changePlace", {
|
|
6524
|
+
...place
|
|
6525
|
+
});
|
|
6526
|
+
emit("changeRecomandPlace", {
|
|
6527
|
+
place: {
|
|
6528
|
+
...place
|
|
6529
|
+
},
|
|
6530
|
+
inputPlace: {
|
|
6531
|
+
...place
|
|
6532
|
+
},
|
|
6533
|
+
isInZone: !!zoneRef.value
|
|
6534
|
+
});
|
|
6535
|
+
};
|
|
6536
|
+
const {
|
|
6537
|
+
orientation
|
|
6538
|
+
} = useDeviceOrientation({
|
|
6539
|
+
elementRef: mapElementRef
|
|
6540
|
+
});
|
|
6541
|
+
const {
|
|
6542
|
+
geoPosition,
|
|
6543
|
+
geoError,
|
|
6544
|
+
geoLoading
|
|
6545
|
+
} = useGeoLocation({
|
|
6546
|
+
geoDefaultPosition: place2point(defaultPlace),
|
|
6547
|
+
onError: (e) => emit("geoError", e)
|
|
6548
|
+
});
|
|
6549
|
+
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
6550
|
+
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
6551
|
+
mapContext.panToGeoPositionByRecomend = () => {
|
|
6552
|
+
if (geoError.value)
|
|
6553
|
+
return false;
|
|
6554
|
+
updateCenterPlaceByPoint(geoPosition.value);
|
|
6555
|
+
return true;
|
|
6556
|
+
};
|
|
6557
|
+
const {
|
|
6558
|
+
isDragging
|
|
6559
|
+
} = useMapDrag({
|
|
6560
|
+
mapRef,
|
|
6561
|
+
onChange: (point) => {
|
|
6562
|
+
centerSource.source = "drag";
|
|
6563
|
+
updatePlace(point);
|
|
6564
|
+
}
|
|
6565
|
+
});
|
|
6566
|
+
const {
|
|
6567
|
+
updatePlace,
|
|
6568
|
+
updateRecommendPlace,
|
|
6569
|
+
updatePlaceCandidates,
|
|
6570
|
+
setPlaceCandidatesAndZone,
|
|
6571
|
+
placeCandidates,
|
|
6572
|
+
zoneRef,
|
|
6573
|
+
availableRef,
|
|
6574
|
+
isElectedRef
|
|
6575
|
+
} = useMapRecomendPlace({
|
|
6576
|
+
pointRef: centerPoint,
|
|
6577
|
+
emptyPlaceName: DEFAULT_PLACE_NAME,
|
|
6578
|
+
context: centerSource,
|
|
6579
|
+
getRecomendPlace: pipedGetRecomendPlace,
|
|
6580
|
+
getLimit: (context2) => {
|
|
6581
|
+
const source = context2 == null ? void 0 : context2.source;
|
|
6582
|
+
switch (source) {
|
|
6583
|
+
case "drag":
|
|
6584
|
+
return RECOMMEND_PLACE_DRAG_LIMIT;
|
|
6585
|
+
case "api":
|
|
6586
|
+
case "geo":
|
|
6587
|
+
case "default":
|
|
6588
|
+
return RECOMMEND_PLACE_LARGE_LIMIT;
|
|
6589
|
+
default:
|
|
6590
|
+
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
6591
|
+
}
|
|
6592
|
+
},
|
|
6593
|
+
onChangePlace: (place) => {
|
|
6594
|
+
if (centerSource.source !== "recomend") {
|
|
6595
|
+
updateRecommendPlace(place);
|
|
6596
|
+
}
|
|
6597
|
+
emit("changePlace", place);
|
|
6598
|
+
},
|
|
6599
|
+
onChange: async ({
|
|
6600
|
+
place,
|
|
6601
|
+
inputPlace,
|
|
6602
|
+
isInZone
|
|
6603
|
+
}) => {
|
|
6604
|
+
centerSource.source = "recomend";
|
|
6605
|
+
if (isPlaceEqual(place, centerPlace))
|
|
6606
|
+
panTo(place2point(place));
|
|
6607
|
+
Object.assign(centerPlace, {
|
|
6608
|
+
...place
|
|
6609
|
+
});
|
|
6610
|
+
emit("changeRecomandPlace", {
|
|
6611
|
+
place,
|
|
6612
|
+
inputPlace,
|
|
6613
|
+
isInZone
|
|
6614
|
+
});
|
|
6615
|
+
}
|
|
6616
|
+
});
|
|
6617
|
+
watchPostEffectOnce(() => updatePlaceCandidates(defaultPlace));
|
|
6618
|
+
return () => {
|
|
6619
|
+
var _a, _b;
|
|
6620
|
+
const {
|
|
6621
|
+
recomendDescription,
|
|
6622
|
+
unavailableTitle
|
|
6623
|
+
} = props;
|
|
6624
|
+
const title = !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
6625
|
+
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
6626
|
+
return Vue.h(HeycarMap, {
|
|
6627
|
+
"attrs": {
|
|
6628
|
+
"center": centerPoint.value,
|
|
6629
|
+
"zoom": zoomRef.value,
|
|
6630
|
+
"touchZoomCenter": true,
|
|
6631
|
+
"mapRef": setMap,
|
|
6632
|
+
"fallback": slots.fallback,
|
|
6633
|
+
"loading": slots.loading
|
|
6634
|
+
}
|
|
6635
|
+
}, [((_a = zoneRef.value) == null ? void 0 : _a.path.length) && Vue.h(GreenZone, {
|
|
6636
|
+
"attrs": {
|
|
6637
|
+
"path": (_b = zoneRef.value) == null ? void 0 : _b.path
|
|
6638
|
+
}
|
|
6639
|
+
}), !geoLoading.value && !geoError.value && Vue.h(PassengerCircle, {
|
|
6640
|
+
"attrs": {
|
|
6641
|
+
"position": geoPosition.value,
|
|
6642
|
+
"angle": orientation.cssRotationVariableName
|
|
6643
|
+
}
|
|
6644
|
+
}), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && Vue.h(PickupPoints, {
|
|
6645
|
+
"attrs": {
|
|
6646
|
+
"places": placeCandidates.value,
|
|
6647
|
+
"renderLabel": (place) => isPlaceEqual(place, centerPlace) ? void 0 : place.displayName
|
|
6648
|
+
},
|
|
6649
|
+
"on": {
|
|
6650
|
+
"click": panToCenterByPlace
|
|
6651
|
+
}
|
|
6652
|
+
}), geoLoading.value ? null : Vue.h(AbsoluteAddressBox, {
|
|
6653
|
+
"attrs": {
|
|
6654
|
+
"title": title,
|
|
6655
|
+
"description": description,
|
|
6656
|
+
"type": isDragging.value ? "locator" : "box"
|
|
6657
|
+
}
|
|
6658
|
+
})]);
|
|
6659
|
+
};
|
|
6660
|
+
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "recomendDescription", "getRecomendPlace", "mapContext"]);
|
|
6450
6661
|
const useAmapGeometry = () => {
|
|
6451
6662
|
const payload = useMapSupplier();
|
|
6452
6663
|
const apiMapDistance = (from, to) => {
|
|
@@ -7579,12 +7790,6 @@ const useBusinessRecomendPlaceMap = () => {
|
|
|
7579
7790
|
},
|
|
7580
7791
|
setCenterPlaceByUserSpecifiedInZone: () => {
|
|
7581
7792
|
throw new Error("MyError: setCenterPlaceByUserSpecifiedInZone used before assigned");
|
|
7582
|
-
},
|
|
7583
|
-
onChangeCenterPlace: (place) => {
|
|
7584
|
-
Object.assign(centerPlace, { ...place });
|
|
7585
|
-
},
|
|
7586
|
-
onChangeRecomendPlaces: (places) => {
|
|
7587
|
-
placeCandidates.value = [...places];
|
|
7588
7793
|
}
|
|
7589
7794
|
};
|
|
7590
7795
|
return {
|
|
@@ -7598,6 +7803,9 @@ const useBusinessRecomendPlaceMap = () => {
|
|
|
7598
7803
|
apiMapInChina: inChina
|
|
7599
7804
|
};
|
|
7600
7805
|
};
|
|
7806
|
+
const useBusinessReselectPlaceMap = () => {
|
|
7807
|
+
return useBusinessRecomendPlaceMap();
|
|
7808
|
+
};
|
|
7601
7809
|
const useBusinessTaxiServiceMap = () => {
|
|
7602
7810
|
const { mapRef, setMap } = useHeycarMap();
|
|
7603
7811
|
const { registerFitVeiw, setFitView } = useMapFitView({
|
|
@@ -7612,6 +7820,7 @@ exports.AbsoluteAddressBox = AbsoluteAddressBox;
|
|
|
7612
7820
|
exports.AddressBox = AddressBox;
|
|
7613
7821
|
exports.BusinessQuotingMap = BusinessQuotingMap;
|
|
7614
7822
|
exports.BusinessRecomendPlaceMap = BusinessRecomendPlaceMap;
|
|
7823
|
+
exports.BusinessReselectPlaceMap = BusinessReselectPlaceMap;
|
|
7615
7824
|
exports.BusinessTaxiEndMap = BusinessTaxiEndMap;
|
|
7616
7825
|
exports.BusinessTaxiServiceMap = BusinessTaxiServiceMap;
|
|
7617
7826
|
exports.DrivingLine = DrivingLine;
|
|
@@ -7632,6 +7841,7 @@ exports.patchMiniprogramRedirectTo = patchMiniprogramRedirectTo;
|
|
|
7632
7841
|
exports.useBusinessAlarm = useBusinessAlarm;
|
|
7633
7842
|
exports.useBusinessQuotingMap = useBusinessQuotingMap;
|
|
7634
7843
|
exports.useBusinessRecomendPlaceMap = useBusinessRecomendPlaceMap;
|
|
7844
|
+
exports.useBusinessReselectPlaceMap = useBusinessReselectPlaceMap;
|
|
7635
7845
|
exports.useBusinessTaxiServiceMap = useBusinessTaxiServiceMap;
|
|
7636
7846
|
exports.useDrivingRoute = useDrivingRoute;
|
|
7637
7847
|
exports.useGeoLocation = useGeoLocation;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, ref, watchEffect, reactive, toRefs, toRef } from "vue";
|
|
8
8
|
const style = "";
|
|
9
9
|
const name = "@heycar/heycars-map";
|
|
10
|
-
const version = "0.
|
|
10
|
+
const version = "0.8.0";
|
|
11
11
|
const type = "module";
|
|
12
12
|
const scripts = {
|
|
13
13
|
dev: "vite -c vite.config.dev.ts",
|
|
@@ -653,15 +653,85 @@ function defineLagecySetup(setup) {
|
|
|
653
653
|
const createElement = h;
|
|
654
654
|
const LANGUAGE = "zh-CN";
|
|
655
655
|
const AbsoluteAddressBox_css_ts_vanilla = "";
|
|
656
|
+
function _defineProperty(obj, key, value) {
|
|
657
|
+
if (key in obj) {
|
|
658
|
+
Object.defineProperty(obj, key, {
|
|
659
|
+
value,
|
|
660
|
+
enumerable: true,
|
|
661
|
+
configurable: true,
|
|
662
|
+
writable: true
|
|
663
|
+
});
|
|
664
|
+
} else {
|
|
665
|
+
obj[key] = value;
|
|
666
|
+
}
|
|
667
|
+
return obj;
|
|
668
|
+
}
|
|
669
|
+
function ownKeys(object, enumerableOnly) {
|
|
670
|
+
var keys2 = Object.keys(object);
|
|
671
|
+
if (Object.getOwnPropertySymbols) {
|
|
672
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
673
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
674
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
675
|
+
})), keys2.push.apply(keys2, symbols);
|
|
676
|
+
}
|
|
677
|
+
return keys2;
|
|
678
|
+
}
|
|
679
|
+
function _objectSpread2(target) {
|
|
680
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
681
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
682
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
683
|
+
_defineProperty(target, key, source[key]);
|
|
684
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
685
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return target;
|
|
689
|
+
}
|
|
690
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
691
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
692
|
+
var _selections$key;
|
|
693
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
694
|
+
return false;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return true;
|
|
698
|
+
};
|
|
699
|
+
var createRuntimeFn = (config) => (options) => {
|
|
700
|
+
var className = config.defaultClassName;
|
|
701
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
702
|
+
for (var variantName in selections) {
|
|
703
|
+
var _selections$variantNa;
|
|
704
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
705
|
+
if (variantSelection != null) {
|
|
706
|
+
var selection = variantSelection;
|
|
707
|
+
if (typeof selection === "boolean") {
|
|
708
|
+
selection = selection === true ? "true" : "false";
|
|
709
|
+
}
|
|
710
|
+
var selectionClassName = (
|
|
711
|
+
// @ts-expect-error
|
|
712
|
+
config.variantClassNames[variantName][selection]
|
|
713
|
+
);
|
|
714
|
+
if (selectionClassName) {
|
|
715
|
+
className += " " + selectionClassName;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
720
|
+
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
721
|
+
className += " " + compoundClassName;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return className;
|
|
725
|
+
};
|
|
656
726
|
var absoluteAddressBox = "n8tgem1";
|
|
657
727
|
var absoluteAddressBoxLayout = "n8tgem0";
|
|
658
|
-
var arrowRight = "
|
|
659
|
-
var boxDescription = "
|
|
660
|
-
var boxTextLayout = "n8tgem2";
|
|
661
|
-
var boxTitle = "
|
|
662
|
-
var imgDotLoading = "
|
|
663
|
-
var locatorIcon = "
|
|
664
|
-
var straightLine = "
|
|
728
|
+
var arrowRight = "n8tgem8";
|
|
729
|
+
var boxDescription = "n8tgem6";
|
|
730
|
+
var boxTextLayout = createRuntimeFn({ defaultClassName: "n8tgem2", variantClassNames: { withArrow: { true: "n8tgem3", false: "n8tgem4" } }, defaultVariants: {}, compoundVariants: [] });
|
|
731
|
+
var boxTitle = "n8tgem5";
|
|
732
|
+
var imgDotLoading = "n8tgem7";
|
|
733
|
+
var locatorIcon = "n8tgema";
|
|
734
|
+
var straightLine = "n8tgem9";
|
|
665
735
|
const MultilineTitle = defineSetup(function MultilineTitle2(props) {
|
|
666
736
|
const linesRef = computed(() => {
|
|
667
737
|
var _a;
|
|
@@ -677,7 +747,8 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
677
747
|
const {
|
|
678
748
|
type: type2,
|
|
679
749
|
title,
|
|
680
|
-
description
|
|
750
|
+
description,
|
|
751
|
+
withArrow = false
|
|
681
752
|
} = props;
|
|
682
753
|
if (type2 === "locator")
|
|
683
754
|
return h("div", {
|
|
@@ -712,7 +783,9 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
712
783
|
"click": handleClick
|
|
713
784
|
}
|
|
714
785
|
}, [h("div", {
|
|
715
|
-
"class": boxTextLayout
|
|
786
|
+
"class": boxTextLayout({
|
|
787
|
+
withArrow
|
|
788
|
+
})
|
|
716
789
|
}, [h(MultilineTitle, {
|
|
717
790
|
"class": boxTitle,
|
|
718
791
|
"attrs": {
|
|
@@ -720,7 +793,7 @@ const AbsoluteAddressBox = defineSetup(function AbsoluteAddressBox2(props, {
|
|
|
720
793
|
}
|
|
721
794
|
}), !!description && h("div", {
|
|
722
795
|
"class": boxDescription
|
|
723
|
-
}, [description])]), h("img", {
|
|
796
|
+
}, [description])]), withArrow && h("img", {
|
|
724
797
|
"class": arrowRight,
|
|
725
798
|
"attrs": {
|
|
726
799
|
"src": imgArrowRight
|
|
@@ -1248,6 +1321,9 @@ function watchPostEffectForGMapEvent(targetRef, props, emit, propertyNames) {
|
|
|
1248
1321
|
});
|
|
1249
1322
|
});
|
|
1250
1323
|
}
|
|
1324
|
+
const watchPostEffectOnce = (callback) => {
|
|
1325
|
+
watch(() => 0, callback, { immediate: true, flush: "post" });
|
|
1326
|
+
};
|
|
1251
1327
|
const AmapMarker = defineSetup(function AmapMarker2(props, { emit }) {
|
|
1252
1328
|
const { registerOverlay } = props;
|
|
1253
1329
|
const markerRef = shallowRef();
|
|
@@ -2348,76 +2424,6 @@ const useResizeObserver = (props) => {
|
|
|
2348
2424
|
});
|
|
2349
2425
|
};
|
|
2350
2426
|
const Gmap_css_ts_vanilla = "";
|
|
2351
|
-
function _defineProperty(obj, key, value) {
|
|
2352
|
-
if (key in obj) {
|
|
2353
|
-
Object.defineProperty(obj, key, {
|
|
2354
|
-
value,
|
|
2355
|
-
enumerable: true,
|
|
2356
|
-
configurable: true,
|
|
2357
|
-
writable: true
|
|
2358
|
-
});
|
|
2359
|
-
} else {
|
|
2360
|
-
obj[key] = value;
|
|
2361
|
-
}
|
|
2362
|
-
return obj;
|
|
2363
|
-
}
|
|
2364
|
-
function ownKeys(object, enumerableOnly) {
|
|
2365
|
-
var keys2 = Object.keys(object);
|
|
2366
|
-
if (Object.getOwnPropertySymbols) {
|
|
2367
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
2368
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
2369
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2370
|
-
})), keys2.push.apply(keys2, symbols);
|
|
2371
|
-
}
|
|
2372
|
-
return keys2;
|
|
2373
|
-
}
|
|
2374
|
-
function _objectSpread2(target) {
|
|
2375
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2376
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
2377
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
2378
|
-
_defineProperty(target, key, source[key]);
|
|
2379
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
2380
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
return target;
|
|
2384
|
-
}
|
|
2385
|
-
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
2386
|
-
for (var key of Object.keys(compoundCheck)) {
|
|
2387
|
-
var _selections$key;
|
|
2388
|
-
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
|
|
2389
|
-
return false;
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
return true;
|
|
2393
|
-
};
|
|
2394
|
-
var createRuntimeFn = (config) => (options) => {
|
|
2395
|
-
var className = config.defaultClassName;
|
|
2396
|
-
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
2397
|
-
for (var variantName in selections) {
|
|
2398
|
-
var _selections$variantNa;
|
|
2399
|
-
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
2400
|
-
if (variantSelection != null) {
|
|
2401
|
-
var selection = variantSelection;
|
|
2402
|
-
if (typeof selection === "boolean") {
|
|
2403
|
-
selection = selection === true ? "true" : "false";
|
|
2404
|
-
}
|
|
2405
|
-
var selectionClassName = (
|
|
2406
|
-
// @ts-expect-error
|
|
2407
|
-
config.variantClassNames[variantName][selection]
|
|
2408
|
-
);
|
|
2409
|
-
if (selectionClassName) {
|
|
2410
|
-
className += " " + selectionClassName;
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
|
|
2415
|
-
if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
|
|
2416
|
-
className += " " + compoundClassName;
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
return className;
|
|
2420
|
-
};
|
|
2421
2427
|
var gmap = "_7anfuo0";
|
|
2422
2428
|
const Gmap = defineSetup(function Gmap2(props, { slots, emit }) {
|
|
2423
2429
|
const setMap = props.mapRef;
|
|
@@ -6318,9 +6324,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6318
6324
|
}
|
|
6319
6325
|
},
|
|
6320
6326
|
onChange: (v) => emit("changeGeoLocation", v),
|
|
6321
|
-
onError: (e) =>
|
|
6322
|
-
emit("geoError", e);
|
|
6323
|
-
}
|
|
6327
|
+
onError: (e) => emit("geoError", e)
|
|
6324
6328
|
});
|
|
6325
6329
|
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
6326
6330
|
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
@@ -6390,14 +6394,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6390
6394
|
});
|
|
6391
6395
|
}
|
|
6392
6396
|
});
|
|
6393
|
-
watchEffect(() => {
|
|
6394
|
-
mapContext.onChangeCenterPlace({
|
|
6395
|
-
...centerPlace
|
|
6396
|
-
});
|
|
6397
|
-
});
|
|
6398
|
-
watchEffect(() => {
|
|
6399
|
-
mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
|
|
6400
|
-
});
|
|
6401
6397
|
return () => {
|
|
6402
6398
|
var _a2, _b2;
|
|
6403
6399
|
const {
|
|
@@ -6437,7 +6433,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6437
6433
|
"attrs": {
|
|
6438
6434
|
"title": title,
|
|
6439
6435
|
"description": description,
|
|
6440
|
-
"type": isDragging.value ? "locator" : "box"
|
|
6436
|
+
"type": isDragging.value ? "locator" : "box",
|
|
6437
|
+
"withArrow": true
|
|
6441
6438
|
},
|
|
6442
6439
|
"on": {
|
|
6443
6440
|
"click": () => emit("clickLocator")
|
|
@@ -6445,6 +6442,220 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
6445
6442
|
})]);
|
|
6446
6443
|
};
|
|
6447
6444
|
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
6445
|
+
const emptyPlace = {
|
|
6446
|
+
lng: 0,
|
|
6447
|
+
lat: 0,
|
|
6448
|
+
name: "",
|
|
6449
|
+
displayName: ""
|
|
6450
|
+
};
|
|
6451
|
+
const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlaceMap2(props, {
|
|
6452
|
+
emit,
|
|
6453
|
+
slots
|
|
6454
|
+
}) {
|
|
6455
|
+
const {
|
|
6456
|
+
getRecomendPlace,
|
|
6457
|
+
mapContext,
|
|
6458
|
+
defaultPlace = {
|
|
6459
|
+
...emptyPlace
|
|
6460
|
+
}
|
|
6461
|
+
} = props;
|
|
6462
|
+
const pipedGetRecomendPlace = pipeOnlyLastEffect(getRecomendPlace);
|
|
6463
|
+
const {
|
|
6464
|
+
mapRef,
|
|
6465
|
+
mapElementRef,
|
|
6466
|
+
setMap,
|
|
6467
|
+
panTo
|
|
6468
|
+
} = useHeycarMap();
|
|
6469
|
+
const {
|
|
6470
|
+
zoomRef
|
|
6471
|
+
} = useMapZoom({
|
|
6472
|
+
mapRef,
|
|
6473
|
+
defaultValue: DEFAULT_ZOOM
|
|
6474
|
+
});
|
|
6475
|
+
const centerPlace = reactive({
|
|
6476
|
+
lng: defaultPlace.lng,
|
|
6477
|
+
lat: defaultPlace.lat,
|
|
6478
|
+
name: defaultPlace.name,
|
|
6479
|
+
displayName: defaultPlace.displayName
|
|
6480
|
+
});
|
|
6481
|
+
const centerPoint = computed(() => [centerPlace.lng, centerPlace.lat]);
|
|
6482
|
+
const centerSource = {
|
|
6483
|
+
source: "default"
|
|
6484
|
+
};
|
|
6485
|
+
const updateCenterPlaceByPoint = (point) => {
|
|
6486
|
+
centerSource.source = "api";
|
|
6487
|
+
updatePlace(point);
|
|
6488
|
+
};
|
|
6489
|
+
const setCenterPlaceByUserSpecified = async (input) => {
|
|
6490
|
+
centerSource.source = "api";
|
|
6491
|
+
const place = toPlaceType(input);
|
|
6492
|
+
centerPlace.lng = place.lng;
|
|
6493
|
+
centerPlace.lat = place.lat;
|
|
6494
|
+
centerPlace.name = place.name;
|
|
6495
|
+
centerPlace.displayName = place.displayName;
|
|
6496
|
+
emit("changePlace", {
|
|
6497
|
+
...place
|
|
6498
|
+
});
|
|
6499
|
+
updateRecommendPlace(place);
|
|
6500
|
+
};
|
|
6501
|
+
const setCenterPlaceByUserSpecifiedInZone = ({
|
|
6502
|
+
place,
|
|
6503
|
+
recommends
|
|
6504
|
+
}) => {
|
|
6505
|
+
centerPlace.lng = place.lng;
|
|
6506
|
+
centerPlace.lat = place.lat;
|
|
6507
|
+
centerPlace.name = place.name;
|
|
6508
|
+
centerPlace.displayName = place.displayName;
|
|
6509
|
+
setPlaceCandidatesAndZone(recommends);
|
|
6510
|
+
emit("changePlace", {
|
|
6511
|
+
...place
|
|
6512
|
+
});
|
|
6513
|
+
};
|
|
6514
|
+
const panToCenterByPlace = async (place) => {
|
|
6515
|
+
centerSource.source = "api";
|
|
6516
|
+
await panTo(place2point(place));
|
|
6517
|
+
centerPlace.lng = place.lng;
|
|
6518
|
+
centerPlace.lat = place.lat;
|
|
6519
|
+
centerPlace.name = place.name;
|
|
6520
|
+
centerPlace.displayName = place.displayName;
|
|
6521
|
+
emit("changePlace", {
|
|
6522
|
+
...place
|
|
6523
|
+
});
|
|
6524
|
+
emit("changeRecomandPlace", {
|
|
6525
|
+
place: {
|
|
6526
|
+
...place
|
|
6527
|
+
},
|
|
6528
|
+
inputPlace: {
|
|
6529
|
+
...place
|
|
6530
|
+
},
|
|
6531
|
+
isInZone: !!zoneRef.value
|
|
6532
|
+
});
|
|
6533
|
+
};
|
|
6534
|
+
const {
|
|
6535
|
+
orientation
|
|
6536
|
+
} = useDeviceOrientation({
|
|
6537
|
+
elementRef: mapElementRef
|
|
6538
|
+
});
|
|
6539
|
+
const {
|
|
6540
|
+
geoPosition,
|
|
6541
|
+
geoError,
|
|
6542
|
+
geoLoading
|
|
6543
|
+
} = useGeoLocation({
|
|
6544
|
+
geoDefaultPosition: place2point(defaultPlace),
|
|
6545
|
+
onError: (e) => emit("geoError", e)
|
|
6546
|
+
});
|
|
6547
|
+
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
6548
|
+
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
6549
|
+
mapContext.panToGeoPositionByRecomend = () => {
|
|
6550
|
+
if (geoError.value)
|
|
6551
|
+
return false;
|
|
6552
|
+
updateCenterPlaceByPoint(geoPosition.value);
|
|
6553
|
+
return true;
|
|
6554
|
+
};
|
|
6555
|
+
const {
|
|
6556
|
+
isDragging
|
|
6557
|
+
} = useMapDrag({
|
|
6558
|
+
mapRef,
|
|
6559
|
+
onChange: (point) => {
|
|
6560
|
+
centerSource.source = "drag";
|
|
6561
|
+
updatePlace(point);
|
|
6562
|
+
}
|
|
6563
|
+
});
|
|
6564
|
+
const {
|
|
6565
|
+
updatePlace,
|
|
6566
|
+
updateRecommendPlace,
|
|
6567
|
+
updatePlaceCandidates,
|
|
6568
|
+
setPlaceCandidatesAndZone,
|
|
6569
|
+
placeCandidates,
|
|
6570
|
+
zoneRef,
|
|
6571
|
+
availableRef,
|
|
6572
|
+
isElectedRef
|
|
6573
|
+
} = useMapRecomendPlace({
|
|
6574
|
+
pointRef: centerPoint,
|
|
6575
|
+
emptyPlaceName: DEFAULT_PLACE_NAME,
|
|
6576
|
+
context: centerSource,
|
|
6577
|
+
getRecomendPlace: pipedGetRecomendPlace,
|
|
6578
|
+
getLimit: (context2) => {
|
|
6579
|
+
const source = context2 == null ? void 0 : context2.source;
|
|
6580
|
+
switch (source) {
|
|
6581
|
+
case "drag":
|
|
6582
|
+
return RECOMMEND_PLACE_DRAG_LIMIT;
|
|
6583
|
+
case "api":
|
|
6584
|
+
case "geo":
|
|
6585
|
+
case "default":
|
|
6586
|
+
return RECOMMEND_PLACE_LARGE_LIMIT;
|
|
6587
|
+
default:
|
|
6588
|
+
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
6589
|
+
}
|
|
6590
|
+
},
|
|
6591
|
+
onChangePlace: (place) => {
|
|
6592
|
+
if (centerSource.source !== "recomend") {
|
|
6593
|
+
updateRecommendPlace(place);
|
|
6594
|
+
}
|
|
6595
|
+
emit("changePlace", place);
|
|
6596
|
+
},
|
|
6597
|
+
onChange: async ({
|
|
6598
|
+
place,
|
|
6599
|
+
inputPlace,
|
|
6600
|
+
isInZone
|
|
6601
|
+
}) => {
|
|
6602
|
+
centerSource.source = "recomend";
|
|
6603
|
+
if (isPlaceEqual(place, centerPlace))
|
|
6604
|
+
panTo(place2point(place));
|
|
6605
|
+
Object.assign(centerPlace, {
|
|
6606
|
+
...place
|
|
6607
|
+
});
|
|
6608
|
+
emit("changeRecomandPlace", {
|
|
6609
|
+
place,
|
|
6610
|
+
inputPlace,
|
|
6611
|
+
isInZone
|
|
6612
|
+
});
|
|
6613
|
+
}
|
|
6614
|
+
});
|
|
6615
|
+
watchPostEffectOnce(() => updatePlaceCandidates(defaultPlace));
|
|
6616
|
+
return () => {
|
|
6617
|
+
var _a, _b;
|
|
6618
|
+
const {
|
|
6619
|
+
recomendDescription,
|
|
6620
|
+
unavailableTitle
|
|
6621
|
+
} = props;
|
|
6622
|
+
const title = !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
6623
|
+
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
6624
|
+
return h(HeycarMap, {
|
|
6625
|
+
"attrs": {
|
|
6626
|
+
"center": centerPoint.value,
|
|
6627
|
+
"zoom": zoomRef.value,
|
|
6628
|
+
"touchZoomCenter": true,
|
|
6629
|
+
"mapRef": setMap,
|
|
6630
|
+
"fallback": slots.fallback,
|
|
6631
|
+
"loading": slots.loading
|
|
6632
|
+
}
|
|
6633
|
+
}, [((_a = zoneRef.value) == null ? void 0 : _a.path.length) && h(GreenZone, {
|
|
6634
|
+
"attrs": {
|
|
6635
|
+
"path": (_b = zoneRef.value) == null ? void 0 : _b.path
|
|
6636
|
+
}
|
|
6637
|
+
}), !geoLoading.value && !geoError.value && h(PassengerCircle, {
|
|
6638
|
+
"attrs": {
|
|
6639
|
+
"position": geoPosition.value,
|
|
6640
|
+
"angle": orientation.cssRotationVariableName
|
|
6641
|
+
}
|
|
6642
|
+
}), zoomRef.value >= RECOMMEND_PLACE_ZOOM_MIN && h(PickupPoints, {
|
|
6643
|
+
"attrs": {
|
|
6644
|
+
"places": placeCandidates.value,
|
|
6645
|
+
"renderLabel": (place) => isPlaceEqual(place, centerPlace) ? void 0 : place.displayName
|
|
6646
|
+
},
|
|
6647
|
+
"on": {
|
|
6648
|
+
"click": panToCenterByPlace
|
|
6649
|
+
}
|
|
6650
|
+
}), geoLoading.value ? null : h(AbsoluteAddressBox, {
|
|
6651
|
+
"attrs": {
|
|
6652
|
+
"title": title,
|
|
6653
|
+
"description": description,
|
|
6654
|
+
"type": isDragging.value ? "locator" : "box"
|
|
6655
|
+
}
|
|
6656
|
+
})]);
|
|
6657
|
+
};
|
|
6658
|
+
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "recomendDescription", "getRecomendPlace", "mapContext"]);
|
|
6448
6659
|
const useAmapGeometry = () => {
|
|
6449
6660
|
const payload = useMapSupplier();
|
|
6450
6661
|
const apiMapDistance = (from, to) => {
|
|
@@ -7577,12 +7788,6 @@ const useBusinessRecomendPlaceMap = () => {
|
|
|
7577
7788
|
},
|
|
7578
7789
|
setCenterPlaceByUserSpecifiedInZone: () => {
|
|
7579
7790
|
throw new Error("MyError: setCenterPlaceByUserSpecifiedInZone used before assigned");
|
|
7580
|
-
},
|
|
7581
|
-
onChangeCenterPlace: (place) => {
|
|
7582
|
-
Object.assign(centerPlace, { ...place });
|
|
7583
|
-
},
|
|
7584
|
-
onChangeRecomendPlaces: (places) => {
|
|
7585
|
-
placeCandidates.value = [...places];
|
|
7586
7791
|
}
|
|
7587
7792
|
};
|
|
7588
7793
|
return {
|
|
@@ -7596,6 +7801,9 @@ const useBusinessRecomendPlaceMap = () => {
|
|
|
7596
7801
|
apiMapInChina: inChina
|
|
7597
7802
|
};
|
|
7598
7803
|
};
|
|
7804
|
+
const useBusinessReselectPlaceMap = () => {
|
|
7805
|
+
return useBusinessRecomendPlaceMap();
|
|
7806
|
+
};
|
|
7599
7807
|
const useBusinessTaxiServiceMap = () => {
|
|
7600
7808
|
const { mapRef, setMap } = useHeycarMap();
|
|
7601
7809
|
const { registerFitVeiw, setFitView } = useMapFitView({
|
|
@@ -7611,6 +7819,7 @@ export {
|
|
|
7611
7819
|
AddressBox,
|
|
7612
7820
|
BusinessQuotingMap,
|
|
7613
7821
|
BusinessRecomendPlaceMap,
|
|
7822
|
+
BusinessReselectPlaceMap,
|
|
7614
7823
|
BusinessTaxiEndMap,
|
|
7615
7824
|
BusinessTaxiServiceMap,
|
|
7616
7825
|
DrivingLine,
|
|
@@ -7631,6 +7840,7 @@ export {
|
|
|
7631
7840
|
useBusinessAlarm,
|
|
7632
7841
|
useBusinessQuotingMap,
|
|
7633
7842
|
useBusinessRecomendPlaceMap,
|
|
7843
|
+
useBusinessReselectPlaceMap,
|
|
7634
7844
|
useBusinessTaxiServiceMap,
|
|
7635
7845
|
useDrivingRoute,
|
|
7636
7846
|
useGeoLocation,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DemoBusinessReselectPlace: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").Empty, import("../types/helper").EmitByProps<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export declare const absoluteAddressBoxLayout: string;
|
|
2
2
|
export declare const absoluteAddressBox: string;
|
|
3
|
-
export declare const boxTextLayout:
|
|
3
|
+
export declare const boxTextLayout: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
4
|
+
withArrow: {
|
|
5
|
+
true: {
|
|
6
|
+
paddingRight: "2.67vw";
|
|
7
|
+
};
|
|
8
|
+
false: {};
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
4
11
|
export declare const boxTitle: string;
|
|
5
12
|
export declare const boxDescription: string;
|
|
6
13
|
export declare const imgDotLoading: string;
|
|
@@ -2,6 +2,7 @@ export interface AbsoluteAddressBoxProps {
|
|
|
2
2
|
type: "box" | "locator" | "loading";
|
|
3
3
|
title: string;
|
|
4
4
|
description?: string;
|
|
5
|
+
withArrow?: boolean;
|
|
5
6
|
onClick?: () => any;
|
|
6
7
|
}
|
|
7
8
|
export declare const AbsoluteAddressBox: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AbsoluteAddressBoxProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<AbsoluteAddressBoxProps, Required<AbsoluteAddressBoxProps>>, "click", AbsoluteAddressBoxProps, {}>;
|
|
@@ -6,6 +6,11 @@ import type { UseMapPlaceProps } from "../../hooks/useMapPlace";
|
|
|
6
6
|
import { UseMapRecomendPlaceProps } from "../../hooks/useMapRecomendPlace";
|
|
7
7
|
import type { Place, Point } from "../../types/interface";
|
|
8
8
|
import { AbsoluteAddressBoxProps } from "../AbsoluteAddressBox";
|
|
9
|
+
export declare const RECOMMEND_PLACE_DRAG_LIMIT = 10;
|
|
10
|
+
export declare const RECOMMEND_PLACE_LARGE_LIMIT = 100;
|
|
11
|
+
export declare const RECOMMEND_PLACE_ZOOM_MIN = 13;
|
|
12
|
+
export declare const DEFAULT_PLACE_NAME = "\u5F53\u524D\u4F4D\u7F6E";
|
|
13
|
+
export declare const DEFAULT_ZOOM = 17;
|
|
9
14
|
export interface CenterPlaceSource {
|
|
10
15
|
source: "default" | "geo" | "drag" | "recomend" | "api";
|
|
11
16
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Place } from "../../types/interface";
|
|
2
|
+
import { type BusinessRecomendPlaceMapProps } from "../BusinessRecomendPlaceMap";
|
|
3
|
+
export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "loading" | "fallback" | "log" | "getRecomendPlace" | "unavailableTitle" | "recomendDescription" | "mapContext" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError"> {
|
|
4
|
+
defaultPlace?: Place;
|
|
5
|
+
}
|
|
6
|
+
export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeRecomandPlace" | "geoError", BusinessReselectPlaceMapProps, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BusinessReselectPlaceMap";
|
|
@@ -7,8 +7,6 @@ export interface BusinessRecomendPlaceContext {
|
|
|
7
7
|
panToGeoPositionByRecomend: (value: Point) => void;
|
|
8
8
|
setCenterPlaceByUserSpecified: (value: Place) => void;
|
|
9
9
|
setCenterPlaceByUserSpecifiedInZone: (value: SetCenterPlaceByUserSpecifiedInZoneProps) => void;
|
|
10
|
-
onChangeCenterPlace: (value: Place) => void;
|
|
11
|
-
onChangeRecomendPlaces: (value: Place[]) => void;
|
|
12
10
|
}
|
|
13
11
|
export declare const useBusinessRecomendPlaceMap: () => {
|
|
14
12
|
mapContext: BusinessRecomendPlaceContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const useBusinessReselectPlaceMap: () => {
|
|
2
|
+
mapContext: import("./useBusinessRecomendPlaceMap").BusinessRecomendPlaceContext;
|
|
3
|
+
centerPlace: {
|
|
4
|
+
lng: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
name: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
placeCandidates: import("vue").Ref<{
|
|
10
|
+
lng: number;
|
|
11
|
+
lat: number;
|
|
12
|
+
name: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
}[]>;
|
|
15
|
+
panToGeoPositionByRecomend: (value: import("..").Point) => void;
|
|
16
|
+
setCenterPlaceByUserSpecified: (value: import("..").Place) => void;
|
|
17
|
+
setCenterPlaceByUserSpecifiedInZone: (value: import("./useBusinessRecomendPlaceMap").SetCenterPlaceByUserSpecifiedInZoneProps) => void;
|
|
18
|
+
apiMapDistance: (from: import("..").Point, to: import("..").Point) => number | undefined;
|
|
19
|
+
apiMapInChina: (point: import("..").Point) => boolean;
|
|
20
|
+
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox";
|
|
|
3
3
|
export { AddressBox } from "./business-components/AddressBox";
|
|
4
4
|
export { BusinessQuotingMap } from "./business-components/BusinessQuotingMap";
|
|
5
5
|
export { BusinessRecomendPlaceMap } from "./business-components/BusinessRecomendPlaceMap";
|
|
6
|
+
export { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap";
|
|
6
7
|
export { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap";
|
|
7
8
|
export { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap";
|
|
8
9
|
export { DrivingLine } from "./business-components/DrivingLine";
|
|
@@ -19,6 +20,7 @@ export * from "./components/MapProvider";
|
|
|
19
20
|
export * from "./hooks-business/useBusinessAlarm";
|
|
20
21
|
export * from "./hooks-business/useBusinessQuotingMap";
|
|
21
22
|
export * from "./hooks-business/useBusinessRecomendPlaceMap";
|
|
23
|
+
export * from "./hooks-business/useBusinessReselectPlaceMap";
|
|
22
24
|
export * from "./hooks-business/useBusinessTaxiServiceMap";
|
|
23
25
|
export { useDrivingRoute } from "./hooks/useDrivingRoute";
|
|
24
26
|
export { useGeoLocation } from "./hooks/useGeoLocation";
|
|
@@ -19,4 +19,5 @@ export declare function watchNoneImmediatePostEffectForMapProperty<T, P>(targetR
|
|
|
19
19
|
type NamesRestrict<N, S extends string> = N extends `on${string}` ? Lowercase<N> extends `on${S}` ? N : never : never;
|
|
20
20
|
export declare function watchPostEffectForAMapEvent<T extends AMap.Event, P, E extends string = AMap.EventType>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, E>[]): void;
|
|
21
21
|
export declare function watchPostEffectForGMapEvent<T extends google.maps.MVCObject | google.maps.marker.AdvancedMarkerView, P>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, string>[]): void;
|
|
22
|
+
export declare const watchPostEffectOnce: (callback: WatchCallback) => void;
|
|
22
23
|
export {};
|
package/dist/style.css
CHANGED
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
align-items: center;
|
|
21
21
|
}
|
|
22
22
|
.n8tgem2 {
|
|
23
|
-
padding-right: 2.67vw;
|
|
24
23
|
max-width: 41.33vw;
|
|
25
24
|
}
|
|
26
25
|
.n8tgem3 {
|
|
26
|
+
padding-right: 2.67vw;
|
|
27
|
+
}
|
|
28
|
+
.n8tgem5 {
|
|
27
29
|
display: -webkit-box;
|
|
28
30
|
font-size: 3.47vw;
|
|
29
31
|
font-family: PingFangSC-Semibold, PingFang SC;
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
-webkit-box-orient: vertical;
|
|
35
37
|
overflow: hidden;
|
|
36
38
|
}
|
|
37
|
-
.
|
|
39
|
+
.n8tgem6 {
|
|
38
40
|
margin-top: 0.53vw;
|
|
39
41
|
font-size: 2.93vw;
|
|
40
42
|
font-family: PingFangSC-Regular, PingFang SC;
|
|
@@ -43,22 +45,22 @@
|
|
|
43
45
|
line-height: 4.27vw;
|
|
44
46
|
opacity: 0.8;
|
|
45
47
|
}
|
|
46
|
-
.
|
|
48
|
+
.n8tgem7 {
|
|
47
49
|
margin: 1.865vw 0;
|
|
48
50
|
width: 7.467vw;
|
|
49
51
|
height: 1.6vw;
|
|
50
52
|
}
|
|
51
|
-
.
|
|
53
|
+
.n8tgem8 {
|
|
52
54
|
width: 1.758vw;
|
|
53
55
|
height: 2.93vw;
|
|
54
56
|
}
|
|
55
|
-
.
|
|
57
|
+
.n8tgem9 {
|
|
56
58
|
width: 0.8vw;
|
|
57
59
|
height: 4vw;
|
|
58
60
|
background: #4C80FF;
|
|
59
61
|
border-radius: 0vw 0vw 26.67vw 26.67vw;
|
|
60
62
|
}
|
|
61
|
-
.
|
|
63
|
+
.n8tgema {
|
|
62
64
|
width: 6.9355vw;
|
|
63
65
|
height: 10.67vw;
|
|
64
66
|
}.rgf09w0 {
|