@heycar/heycars-map 0.9.19 → 0.9.20-querying2

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 CHANGED
@@ -59,6 +59,13 @@ export interface RecommendZonePlaces {
59
59
  zone?: Zone;
60
60
  places?: Place[];
61
61
  }
62
+
63
+ export enum CenterPlaceStatus {
64
+ GEO_LOADING = "GEO_LOADING",
65
+ QUERYING_INFO = "QUERYING_INFO",
66
+ SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
67
+ OK = "OK",
68
+ }
62
69
  ```
63
70
 
64
71
  #### 在 入口文件添加 `MapProvider`
@@ -177,6 +184,8 @@ export default defineComponent({
177
184
  geoErrorOnceNotificationKey="BusinessRecomendPlaceMap"
178
185
  geoErrorOnceNotificationInterval={10 * 60 * 1000}
179
186
  unavailableTitle={"当前区域暂未开通服务"}
187
+ emptyTitle={"当前位置"}
188
+ queryingTitle={"正在获取地址信息"}
180
189
  recomendDescription={"您将在此处上车"}
181
190
  geoDefaultPosition={[139.777777, 35.777777]}
182
191
  mapContext={mapContext}
@@ -299,6 +308,8 @@ export default defineComponent({
299
308
  <BusinessReselectPlaceMap
300
309
  class={"demo"}
301
310
  unavailableTitle={"当前区域暂未开通服务"}
311
+ emptyTitle={"当前位置"}
312
+ queryingTitle={"正在获取地址信息"}
302
313
  recomendDescription={"您将在此处上车"}
303
314
  // 对于同一个 geoErrorOnceNotificationKey
304
315
  // geoErrorOnce 事件在 geoErrorOnceNotificationInterval 时间间隔内全局只会触发一次
package/dist/index.cjs CHANGED
@@ -18,8 +18,152 @@ if (typeof GeolocationPositionError === "undefined") {
18
18
  TIMEOUT: 3
19
19
  };
20
20
  }
21
+ var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
22
+ BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
23
+ BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
24
+ BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
25
+ BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
26
+ BRWOSER_PLATFORM2["H5"] = "H5";
27
+ BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
28
+ return BRWOSER_PLATFORM2;
29
+ })(BRWOSER_PLATFORM || {});
30
+ var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
31
+ OS_PLATFORM2["IOS"] = "IOS";
32
+ OS_PLATFORM2["ANDROID"] = "ANDROID";
33
+ OS_PLATFORM2["OTHER"] = "OTHER";
34
+ return OS_PLATFORM2;
35
+ })(OS_PLATFORM || {});
36
+ var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
37
+ WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
38
+ WEBGL_STATUS2["DISABLED"] = "DISABLED";
39
+ WEBGL_STATUS2["ENABLED"] = "ENABLED";
40
+ return WEBGL_STATUS2;
41
+ })(WEBGL_STATUS || {});
42
+ var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
43
+ ALIPAY_WALLET2["TNGD"] = "TNGD";
44
+ ALIPAY_WALLET2["TMN"] = "TMN";
45
+ return ALIPAY_WALLET2;
46
+ })(ALIPAY_WALLET || {});
47
+ const detectAlipayWallet = () => {
48
+ if (!navigator)
49
+ return void 0;
50
+ const useragent = navigator.userAgent.toLowerCase();
51
+ if (!useragent.includes("alipay"))
52
+ return void 0;
53
+ if (useragent.includes("tngkit"))
54
+ return "TNGD";
55
+ if (useragent.includes("truemoney"))
56
+ return "TMN";
57
+ };
58
+ const detectBrowserPlatform = () => {
59
+ if (typeof navigator === "undefined")
60
+ return "NODE_JS";
61
+ const useragent = navigator.userAgent.toLowerCase();
62
+ if (useragent.includes("micromessenger")) {
63
+ return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
64
+ }
65
+ if (useragent.includes("alipay")) {
66
+ return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
67
+ }
68
+ return "H5";
69
+ };
70
+ const detectOSPlatform = () => {
71
+ if (typeof navigator === "undefined")
72
+ return "OTHER";
73
+ const userAgent = navigator.userAgent || navigator.vendor;
74
+ if (/android/i.test(userAgent)) {
75
+ return "ANDROID";
76
+ }
77
+ if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
78
+ return "IOS";
79
+ }
80
+ return "OTHER";
81
+ };
82
+ function detectWebGL() {
83
+ if (typeof window === "undefined")
84
+ return "NOT_SUPPORTED";
85
+ if (window.WebGLRenderingContext) {
86
+ const canvas = document.createElement("canvas");
87
+ const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
88
+ let context2 = null;
89
+ for (const name2 of names) {
90
+ try {
91
+ context2 = canvas.getContext(name2);
92
+ if (context2 && typeof context2.getParameter === "function") {
93
+ return "ENABLED";
94
+ }
95
+ } catch (e) {
96
+ console.error("MyError: detectWebGL catch e = ", e);
97
+ return "NOT_SUPPORTED";
98
+ }
99
+ }
100
+ return "DISABLED";
101
+ }
102
+ return "NOT_SUPPORTED";
103
+ }
104
+ const createMockWx = (opt) => {
105
+ const { timeout, lng, lat, status } = opt.getLocation;
106
+ const mockWx = {
107
+ ready(callback) {
108
+ callback();
109
+ },
110
+ error(callback) {
111
+ callback({ errCode: "mock error code", errMsg: "mock error message" });
112
+ },
113
+ getLocation(props) {
114
+ const { success, fail } = props;
115
+ if (status === "success") {
116
+ setTimeout(() => {
117
+ success({
118
+ longitude: String(lng),
119
+ latitude: String(lat),
120
+ accuracy: "30",
121
+ speed: "0",
122
+ errCode: "",
123
+ errMsg: ""
124
+ });
125
+ }, timeout);
126
+ }
127
+ if (status === "fail") {
128
+ setTimeout(() => {
129
+ fail == null ? void 0 : fail({ errCode: "mock error code", errMsg: "mock error message" });
130
+ }, timeout);
131
+ }
132
+ },
133
+ config() {
134
+ return;
135
+ },
136
+ miniProgram: {
137
+ redirectTo() {
138
+ return;
139
+ },
140
+ getEnv() {
141
+ const miniprogram = detectBrowserPlatform() === BRWOSER_PLATFORM.WECHAT_MINIPROGRAM;
142
+ return { miniprogram };
143
+ }
144
+ }
145
+ };
146
+ return mockWx;
147
+ };
148
+ const mockWxByUrl = () => {
149
+ const searchParams = new URLSearchParams(location.search);
150
+ const enable = searchParams.has("enableMockWx");
151
+ if (!enable)
152
+ return;
153
+ const lng = Number(searchParams.get("lng"));
154
+ const lat = Number(searchParams.get("lat"));
155
+ const timeout = Number(searchParams.get("timeout")) * 1e3;
156
+ const status = searchParams.get("status");
157
+ if (status !== "success" && status !== "fail" || isNaN(timeout)) {
158
+ console.error("MyError: createMockWxByUrl: wrong parameter from url");
159
+ return;
160
+ }
161
+ const mockWx = createMockWx({ getLocation: { lng, lat, timeout, status } });
162
+ window.wx = mockWx;
163
+ };
164
+ mockWxByUrl();
21
165
  const name = "@heycar/heycars-map";
22
- const version = "0.9.19";
166
+ const version = "0.9.20-querying2";
23
167
  const type = "module";
24
168
  const bin = {
25
169
  checkVersion: "./bin/checkVersion.js"
@@ -1410,6 +1554,11 @@ const createRunOnce = (fn) => {
1410
1554
  return result;
1411
1555
  };
1412
1556
  };
1557
+ const createAsyncNoFailNonNullable = (fn, defaultValue) => {
1558
+ return function noFailNoNullable(...args) {
1559
+ return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
1560
+ };
1561
+ };
1413
1562
  const MAX_ANIMATION_DISTANCE_VW = 300;
1414
1563
  const MIN_ANIMATION_DURATION = 300;
1415
1564
  const ANIMATION_DURATION_FOR_100VW = 200;
@@ -1428,89 +1577,6 @@ const ZINDEX_GREEN_ZONE = 10;
1428
1577
  const TRACKS_MATCH_MAX_LENGTH = 3;
1429
1578
  const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
1430
1579
  const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
1431
- var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
1432
- BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
1433
- BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
1434
- BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
1435
- BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
1436
- BRWOSER_PLATFORM2["H5"] = "H5";
1437
- BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
1438
- return BRWOSER_PLATFORM2;
1439
- })(BRWOSER_PLATFORM || {});
1440
- var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1441
- OS_PLATFORM2["IOS"] = "IOS";
1442
- OS_PLATFORM2["ANDROID"] = "ANDROID";
1443
- OS_PLATFORM2["OTHER"] = "OTHER";
1444
- return OS_PLATFORM2;
1445
- })(OS_PLATFORM || {});
1446
- var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1447
- WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
1448
- WEBGL_STATUS2["DISABLED"] = "DISABLED";
1449
- WEBGL_STATUS2["ENABLED"] = "ENABLED";
1450
- return WEBGL_STATUS2;
1451
- })(WEBGL_STATUS || {});
1452
- var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
1453
- ALIPAY_WALLET2["TNGD"] = "TNGD";
1454
- ALIPAY_WALLET2["TMN"] = "TMN";
1455
- return ALIPAY_WALLET2;
1456
- })(ALIPAY_WALLET || {});
1457
- const detectAlipayWallet = () => {
1458
- if (!navigator)
1459
- return void 0;
1460
- const useragent = navigator.userAgent.toLowerCase();
1461
- if (!useragent.includes("alipay"))
1462
- return void 0;
1463
- if (useragent.includes("tngkit"))
1464
- return "TNGD";
1465
- if (useragent.includes("truemoney"))
1466
- return "TMN";
1467
- };
1468
- const detectBrowserPlatform = () => {
1469
- if (typeof navigator === "undefined")
1470
- return "NODE_JS";
1471
- const useragent = navigator.userAgent.toLowerCase();
1472
- if (useragent.includes("micromessenger")) {
1473
- return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
1474
- }
1475
- if (useragent.includes("alipay")) {
1476
- return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
1477
- }
1478
- return "H5";
1479
- };
1480
- const detectOSPlatform = () => {
1481
- if (typeof navigator === "undefined")
1482
- return "OTHER";
1483
- const userAgent = navigator.userAgent || navigator.vendor;
1484
- if (/android/i.test(userAgent)) {
1485
- return "ANDROID";
1486
- }
1487
- if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
1488
- return "IOS";
1489
- }
1490
- return "OTHER";
1491
- };
1492
- function detectWebGL() {
1493
- if (typeof window === "undefined")
1494
- return "NOT_SUPPORTED";
1495
- if (window.WebGLRenderingContext) {
1496
- const canvas = document.createElement("canvas");
1497
- const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
1498
- let context2 = null;
1499
- for (const name2 of names) {
1500
- try {
1501
- context2 = canvas.getContext(name2);
1502
- if (context2 && typeof context2.getParameter === "function") {
1503
- return "ENABLED";
1504
- }
1505
- } catch (e) {
1506
- console.error("MyError: detectWebGL catch e = ", e);
1507
- return "NOT_SUPPORTED";
1508
- }
1509
- }
1510
- return "DISABLED";
1511
- }
1512
- return "NOT_SUPPORTED";
1513
- }
1514
1580
  const vec2lnglat = ([lng, lat]) => ({
1515
1581
  lng: Number(lng),
1516
1582
  lat: Number(lat)
@@ -6615,7 +6681,7 @@ const useAmapPlace = (props) => {
6615
6681
  place.displayName = value.displayName;
6616
6682
  };
6617
6683
  const getPlaceByRegeo = ([lng, lat]) => {
6618
- return new Promise((resolve, reject) => {
6684
+ return new Promise((resolve) => {
6619
6685
  const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
6620
6686
  const isChina = inChina([lng, lat]);
6621
6687
  geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
@@ -6627,14 +6693,13 @@ const useAmapPlace = (props) => {
6627
6693
  resolve({ lng, lat, name: name2, displayName });
6628
6694
  return;
6629
6695
  }
6630
- case "no_data": {
6696
+ case "no_data":
6697
+ case "error": {
6631
6698
  const name2 = emptyPlaceName;
6632
6699
  const displayName = emptyPlaceName;
6633
6700
  resolve({ lng, lat, name: name2, displayName });
6634
6701
  return;
6635
6702
  }
6636
- case "error":
6637
- reject(result);
6638
6703
  }
6639
6704
  });
6640
6705
  });
@@ -6673,13 +6738,17 @@ const useGmapPlace = (props) => {
6673
6738
  place.displayName = value.displayName;
6674
6739
  };
6675
6740
  const getPlaceByRegeo = ([lng, lat]) => {
6676
- return new Promise((resolve, reject) => {
6741
+ return new Promise((resolve) => {
6677
6742
  const geocoder = new google.maps.Geocoder();
6678
6743
  geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
6679
6744
  const name2 = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
6680
6745
  const displayName = name2;
6681
6746
  resolve({ lng, lat, name: name2, displayName });
6682
- }).catch(reject);
6747
+ }).catch(() => {
6748
+ const name2 = emptyPlaceName;
6749
+ const displayName = emptyPlaceName;
6750
+ resolve({ lng, lat, name: name2, displayName });
6751
+ });
6683
6752
  });
6684
6753
  };
6685
6754
  Vue.watch(
@@ -6717,14 +6786,16 @@ const useMapRecomendPlace = (props) => {
6717
6786
  getLimit,
6718
6787
  context: context2,
6719
6788
  emptyPlaceName,
6789
+ queryingPlaceName,
6720
6790
  onChange,
6791
+ onQueryingPlace,
6721
6792
  onChangePlace
6722
6793
  } = props;
6723
6794
  const availableRef = Vue.ref(true);
6724
6795
  const placeCandidatesRef = Vue.ref([]);
6725
6796
  const zoneRef = Vue.ref();
6726
6797
  const { apiMapIsPointInRing, apiMapDistance } = useMapGeometry();
6727
- const { getPlaceByRegeo } = useAmapPlace({
6798
+ const { getPlaceByRegeo } = useMapPlace({
6728
6799
  emptyPlaceName,
6729
6800
  pointRef: Vue.ref([...defaultPoint])
6730
6801
  });
@@ -6740,9 +6811,10 @@ const useMapRecomendPlace = (props) => {
6740
6811
  (candidate) => isPointEqual(place2point(candidate), recomendPoint)
6741
6812
  );
6742
6813
  });
6814
+ const isQueryingRef = Vue.ref(false);
6815
+ const getRecomendPlaceNoFail = createAsyncNoFailNonNullable(getRecomendPlace, {});
6743
6816
  const findAttachedPlace = async (place) => {
6744
- var _a;
6745
- const inputRecommendZonePlaces = (_a = await getRecomendPlace({ ...place }, context2)) != null ? _a : {};
6817
+ const inputRecommendZonePlaces = await getRecomendPlaceNoFail({ ...place }, context2);
6746
6818
  const {
6747
6819
  places: placeCandidates,
6748
6820
  zone,
@@ -6775,7 +6847,7 @@ const useMapRecomendPlace = (props) => {
6775
6847
  const [lng, lat] = point;
6776
6848
  const { shortestPlace: resultPlace } = findNearestPlace(
6777
6849
  { lng, lat, name: "", displayName: "" },
6778
- placeCandidatesRef.value,
6850
+ prevState.candidates,
6779
6851
  apiMapDistance
6780
6852
  );
6781
6853
  return {
@@ -6785,7 +6857,27 @@ const useMapRecomendPlace = (props) => {
6785
6857
  candidates: prevState.candidates
6786
6858
  };
6787
6859
  };
6860
+ const updateIntermediateQueryingState = (point) => {
6861
+ const zone = zoneRef.value;
6862
+ if (zone && apiMapIsPointInRing(point, zone.path))
6863
+ return;
6864
+ const [lng, lat] = point;
6865
+ const intermediateQueryingPlace = {
6866
+ lng,
6867
+ lat,
6868
+ name: queryingPlaceName,
6869
+ displayName: queryingPlaceName
6870
+ };
6871
+ isQueryingRef.value = true;
6872
+ availableRef.value = true;
6873
+ if (zone)
6874
+ zoneRef.value = void 0;
6875
+ placeCandidatesRef.value = [];
6876
+ Object.assign(recomendPlace, { ...intermediateQueryingPlace });
6877
+ onQueryingPlace == null ? void 0 : onQueryingPlace({ ...intermediateQueryingPlace });
6878
+ };
6788
6879
  const updatePlace = async (point) => {
6880
+ updateIntermediateQueryingState(point);
6789
6881
  const {
6790
6882
  place: resultPlace,
6791
6883
  candidates,
@@ -6798,6 +6890,7 @@ const useMapRecomendPlace = (props) => {
6798
6890
  zone: zoneRef.value
6799
6891
  });
6800
6892
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
6893
+ isQueryingRef.value = false;
6801
6894
  availableRef.value = available;
6802
6895
  zoneRef.value = zone;
6803
6896
  placeCandidatesRef.value = candidates;
@@ -6807,14 +6900,15 @@ const useMapRecomendPlace = (props) => {
6807
6900
  onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace, isInZone: !!zone, isSameZone });
6808
6901
  };
6809
6902
  const updatePlaceCandidates = async (place) => {
6810
- var _a;
6811
- const inputRecommendZonePlaces = (_a = await getRecomendPlace({ ...place }, context2)) != null ? _a : {};
6903
+ updateIntermediateQueryingState(place2point(place));
6904
+ const inputRecommendZonePlaces = await getRecomendPlaceNoFail({ ...place }, context2);
6812
6905
  const {
6813
6906
  places: placeCandidates,
6814
6907
  zone,
6815
6908
  available = false
6816
6909
  } = toRecommendZonePlacesType(inputRecommendZonePlaces);
6817
6910
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
6911
+ isQueryingRef.value = false;
6818
6912
  availableRef.value = !!available;
6819
6913
  zoneRef.value = zone;
6820
6914
  placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
@@ -6826,8 +6920,10 @@ const useMapRecomendPlace = (props) => {
6826
6920
  };
6827
6921
  };
6828
6922
  const updateRecommendPlace = async (place) => {
6923
+ updateIntermediateQueryingState(place2point(place));
6829
6924
  const { place: resultPlace, candidates, available, zone } = await findAttachedPlace(place);
6830
6925
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
6926
+ isQueryingRef.value = false;
6831
6927
  availableRef.value = available;
6832
6928
  zoneRef.value = zone;
6833
6929
  placeCandidatesRef.value = candidates;
@@ -6841,9 +6937,11 @@ const useMapRecomendPlace = (props) => {
6841
6937
  });
6842
6938
  };
6843
6939
  const updateRecommendPlaceOnlyInZone = async (place) => {
6940
+ updateIntermediateQueryingState(place2point(place));
6844
6941
  const { place: foundPlace, candidates, available, zone } = await findAttachedPlace(place);
6845
6942
  const resultPlace = zone ? foundPlace : place;
6846
6943
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
6944
+ isQueryingRef.value = false;
6847
6945
  availableRef.value = available;
6848
6946
  zoneRef.value = zone;
6849
6947
  placeCandidatesRef.value = candidates;
@@ -6871,6 +6969,7 @@ const useMapRecomendPlace = (props) => {
6871
6969
  placeCandidates: placeCandidatesRef,
6872
6970
  availableRef,
6873
6971
  isElectedRef,
6972
+ isQueryingRef,
6874
6973
  updateRecommendPlace,
6875
6974
  updateRecommendPlaceOnlyInZone,
6876
6975
  updatePlaceCandidates,
@@ -6944,6 +7043,13 @@ const useMapZoom = (props) => {
6944
7043
  const { supplier } = useMapSupplier();
6945
7044
  return supplier === "gmap" ? useGmapZoom(props) : useAmapZoom(props);
6946
7045
  };
7046
+ var CenterPlaceStatus = /* @__PURE__ */ ((CenterPlaceStatus2) => {
7047
+ CenterPlaceStatus2["GEO_LOADING"] = "GEO_LOADING";
7048
+ CenterPlaceStatus2["QUERYING_INFO"] = "QUERYING_INFO";
7049
+ CenterPlaceStatus2["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
7050
+ CenterPlaceStatus2["OK"] = "OK";
7051
+ return CenterPlaceStatus2;
7052
+ })(CenterPlaceStatus || {});
6947
7053
  const AmapPolygon = defineSetup(function AmapPolygon2(props) {
6948
7054
  const polygonRef = Vue.shallowRef();
6949
7055
  const mapRef = useAmap();
@@ -7598,7 +7704,6 @@ const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
7598
7704
  const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
7599
7705
  const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
7600
7706
  const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
7601
- const DEFAULT_PLACE_NAME = "当前位置";
7602
7707
  const DEFAULT_ZOOM = 17;
7603
7708
  const ZONE_ZOOM = 13.75;
7604
7709
  const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
@@ -7608,6 +7713,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7608
7713
  var _a, _b;
7609
7714
  const {
7610
7715
  geoLoadingTitle,
7716
+ emptyTitle,
7717
+ queryingTitle,
7611
7718
  geoDefaultPosition,
7612
7719
  geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
7613
7720
  geoErrorOnceNotificationInterval = 0,
@@ -7758,10 +7865,12 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7758
7865
  placeCandidates,
7759
7866
  zoneRef,
7760
7867
  availableRef,
7761
- isElectedRef
7868
+ isElectedRef,
7869
+ isQueryingRef
7762
7870
  } = useMapRecomendPlace({
7763
7871
  defaultPoint: place2point(centerPlace),
7764
- emptyPlaceName: DEFAULT_PLACE_NAME,
7872
+ emptyPlaceName: emptyTitle,
7873
+ queryingPlaceName: queryingTitle,
7765
7874
  context: centerSource,
7766
7875
  getRecomendPlace: pipedGetRecomendPlace,
7767
7876
  getLimit: (context2) => {
@@ -7777,6 +7886,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7777
7886
  throw new Error(`MyError: should not call getLimit on source: ${source}`);
7778
7887
  }
7779
7888
  },
7889
+ onQueryingPlace: (place) => Object.assign(centerPlace, {
7890
+ ...place
7891
+ }),
7780
7892
  onChangePlace: (place) => emit("changePlace", place),
7781
7893
  onChange: async ({
7782
7894
  place,
@@ -7808,6 +7920,11 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7808
7920
  Vue.watchEffect(() => {
7809
7921
  mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
7810
7922
  });
7923
+ Vue.watchEffect(() => {
7924
+ const centerPlaceStatus = geoLoading.value ? CenterPlaceStatus.GEO_LOADING : isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK;
7925
+ mapContext.centerPlaceStatusRef.value = centerPlaceStatus;
7926
+ console.log("centerPlaceStatus = ", centerPlaceStatus);
7927
+ });
7811
7928
  return () => {
7812
7929
  var _a2, _b2;
7813
7930
  const {
@@ -7860,7 +7977,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7860
7977
  }
7861
7978
  })]);
7862
7979
  };
7863
- }).props(["log", "geoLoadingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
7980
+ }).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
7864
7981
  const emptyPlace = {
7865
7982
  lng: 0,
7866
7983
  lat: 0,
@@ -7872,6 +7989,8 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7872
7989
  slots
7873
7990
  }) {
7874
7991
  const {
7992
+ emptyTitle,
7993
+ queryingTitle,
7875
7994
  geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
7876
7995
  geoErrorOnceNotificationInterval = 0,
7877
7996
  getRecomendPlace,
@@ -7998,10 +8117,12 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
7998
8117
  placeCandidates,
7999
8118
  zoneRef,
8000
8119
  availableRef,
8001
- isElectedRef
8120
+ isElectedRef,
8121
+ isQueryingRef
8002
8122
  } = useMapRecomendPlace({
8003
8123
  defaultPoint: place2point(centerPlace),
8004
- emptyPlaceName: DEFAULT_PLACE_NAME,
8124
+ emptyPlaceName: emptyTitle,
8125
+ queryingPlaceName: queryingTitle,
8005
8126
  context: centerSource,
8006
8127
  getRecomendPlace: pipedGetRecomendPlace,
8007
8128
  getLimit: (context2) => {
@@ -8017,6 +8138,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
8017
8138
  throw new Error(`MyError: should not call getLimit on source: ${source}`);
8018
8139
  }
8019
8140
  },
8141
+ onQueryingPlace: (place) => Object.assign(centerPlace, {
8142
+ ...place
8143
+ }),
8020
8144
  onChangePlace: (place) => emit("changePlace", place),
8021
8145
  onChange: async ({
8022
8146
  place,
@@ -8049,6 +8173,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
8049
8173
  Vue.watchEffect(() => {
8050
8174
  mapContext.onChangeRecomendPlaces([...placeCandidates.value]);
8051
8175
  });
8176
+ Vue.watchEffect(() => {
8177
+ mapContext.centerPlaceStatusRef.value = isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK;
8178
+ });
8052
8179
  return () => {
8053
8180
  var _a, _b;
8054
8181
  const {
@@ -8099,7 +8226,7 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
8099
8226
  }
8100
8227
  })]);
8101
8228
  };
8102
- }).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
8229
+ }).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "emptyTitle", "queryingTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
8103
8230
  const assertPropNoEmptyArray = (list, funcName, propName) => {
8104
8231
  if (list.length > 0)
8105
8232
  return;
@@ -10147,6 +10274,7 @@ const useBusinessRecomendPlaceMap = () => {
10147
10274
  });
10148
10275
  const placeCandidates = Vue.ref([]);
10149
10276
  const geoPositionRef = Vue.ref();
10277
+ const centerPlaceStatusRef = Vue.ref(CenterPlaceStatus.GEO_LOADING);
10150
10278
  const { apiMapDistance } = useMapGeometry();
10151
10279
  const { inChina } = useMapInChina();
10152
10280
  const panToGeoPositionByRecomend = (value) => mapContext.panToGeoPositionByRecomend(value);
@@ -10155,6 +10283,7 @@ const useBusinessRecomendPlaceMap = () => {
10155
10283
  const setCenterPlaceByUserSpecifiedInZone = (value) => mapContext.setCenterPlaceByUserSpecifiedInZone(value);
10156
10284
  const mapContext = {
10157
10285
  geoPositionRef,
10286
+ centerPlaceStatusRef,
10158
10287
  panToGeoPositionByRecomend: () => {
10159
10288
  throw new Error("MyError: panToGeoPositionByRecomend used before assigned");
10160
10289
  },
@@ -10179,6 +10308,7 @@ const useBusinessRecomendPlaceMap = () => {
10179
10308
  centerPlace,
10180
10309
  placeCandidates,
10181
10310
  geoPosition: Vue.readonly(geoPositionRef),
10311
+ centerPlaceStatus: Vue.readonly(centerPlaceStatusRef),
10182
10312
  panToGeoPositionByRecomend,
10183
10313
  setCenterPlaceDisplayNameOnce,
10184
10314
  setCenterPlaceByUserSpecified,
@@ -10206,6 +10336,7 @@ exports.BusinessRecomendPlaceMap = BusinessRecomendPlaceMap;
10206
10336
  exports.BusinessReselectPlaceMap = BusinessReselectPlaceMap;
10207
10337
  exports.BusinessTaxiEndMap = BusinessTaxiEndMap;
10208
10338
  exports.BusinessTaxiServiceMap = BusinessTaxiServiceMap;
10339
+ exports.CenterPlaceStatus = CenterPlaceStatus;
10209
10340
  exports.DrivingLine = DrivingLine;
10210
10341
  exports.DrivingRoute = DrivingRoute;
10211
10342
  exports.HeycarMap = HeycarMap;