@heycar/heycars-map 0.9.19 → 0.9.20-querying
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 +4 -0
- package/dist/index.cjs +211 -101
- package/dist/index.js +211 -101
- package/dist/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -1
- package/dist/src/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +1 -1
- package/dist/src/hooks/useMapRecomendPlace.d.ts +3 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/types/wx.d.ts +12 -0
- package/dist/src/utils/helper.d.ts +1 -0
- package/dist/src/utils/mockWx.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -177,6 +177,8 @@ export default defineComponent({
|
|
|
177
177
|
geoErrorOnceNotificationKey="BusinessRecomendPlaceMap"
|
|
178
178
|
geoErrorOnceNotificationInterval={10 * 60 * 1000}
|
|
179
179
|
unavailableTitle={"当前区域暂未开通服务"}
|
|
180
|
+
emptyTitle={"当前位置"}
|
|
181
|
+
queryingTitle={"正在获取地址信息"}
|
|
180
182
|
recomendDescription={"您将在此处上车"}
|
|
181
183
|
geoDefaultPosition={[139.777777, 35.777777]}
|
|
182
184
|
mapContext={mapContext}
|
|
@@ -299,6 +301,8 @@ export default defineComponent({
|
|
|
299
301
|
<BusinessReselectPlaceMap
|
|
300
302
|
class={"demo"}
|
|
301
303
|
unavailableTitle={"当前区域暂未开通服务"}
|
|
304
|
+
emptyTitle={"当前位置"}
|
|
305
|
+
queryingTitle={"正在获取地址信息"}
|
|
302
306
|
recomendDescription={"您将在此处上车"}
|
|
303
307
|
// 对于同一个 geoErrorOnceNotificationKey
|
|
304
308
|
// 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.
|
|
166
|
+
const version = "0.9.20-querying";
|
|
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
|
|
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
|
|
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(
|
|
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 } =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6811
|
-
const inputRecommendZonePlaces =
|
|
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,
|
|
@@ -7598,7 +7697,6 @@ const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
|
|
|
7598
7697
|
const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
|
|
7599
7698
|
const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
|
|
7600
7699
|
const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
|
|
7601
|
-
const DEFAULT_PLACE_NAME = "当前位置";
|
|
7602
7700
|
const DEFAULT_ZOOM = 17;
|
|
7603
7701
|
const ZONE_ZOOM = 13.75;
|
|
7604
7702
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
@@ -7608,6 +7706,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7608
7706
|
var _a, _b;
|
|
7609
7707
|
const {
|
|
7610
7708
|
geoLoadingTitle,
|
|
7709
|
+
emptyTitle,
|
|
7710
|
+
queryingTitle,
|
|
7611
7711
|
geoDefaultPosition,
|
|
7612
7712
|
geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
|
|
7613
7713
|
geoErrorOnceNotificationInterval = 0,
|
|
@@ -7761,7 +7861,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7761
7861
|
isElectedRef
|
|
7762
7862
|
} = useMapRecomendPlace({
|
|
7763
7863
|
defaultPoint: place2point(centerPlace),
|
|
7764
|
-
emptyPlaceName:
|
|
7864
|
+
emptyPlaceName: emptyTitle,
|
|
7865
|
+
queryingPlaceName: queryingTitle,
|
|
7765
7866
|
context: centerSource,
|
|
7766
7867
|
getRecomendPlace: pipedGetRecomendPlace,
|
|
7767
7868
|
getLimit: (context2) => {
|
|
@@ -7777,6 +7878,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7777
7878
|
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
7778
7879
|
}
|
|
7779
7880
|
},
|
|
7881
|
+
onQueryingPlace: (place) => Object.assign(centerPlace, {
|
|
7882
|
+
...place
|
|
7883
|
+
}),
|
|
7780
7884
|
onChangePlace: (place) => emit("changePlace", place),
|
|
7781
7885
|
onChange: async ({
|
|
7782
7886
|
place,
|
|
@@ -7860,7 +7964,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7860
7964
|
}
|
|
7861
7965
|
})]);
|
|
7862
7966
|
};
|
|
7863
|
-
}).props(["log", "geoLoadingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
7967
|
+
}).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
7864
7968
|
const emptyPlace = {
|
|
7865
7969
|
lng: 0,
|
|
7866
7970
|
lat: 0,
|
|
@@ -7872,6 +7976,8 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
7872
7976
|
slots
|
|
7873
7977
|
}) {
|
|
7874
7978
|
const {
|
|
7979
|
+
emptyTitle,
|
|
7980
|
+
queryingTitle,
|
|
7875
7981
|
geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
|
|
7876
7982
|
geoErrorOnceNotificationInterval = 0,
|
|
7877
7983
|
getRecomendPlace,
|
|
@@ -8001,7 +8107,8 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8001
8107
|
isElectedRef
|
|
8002
8108
|
} = useMapRecomendPlace({
|
|
8003
8109
|
defaultPoint: place2point(centerPlace),
|
|
8004
|
-
emptyPlaceName:
|
|
8110
|
+
emptyPlaceName: emptyTitle,
|
|
8111
|
+
queryingPlaceName: queryingTitle,
|
|
8005
8112
|
context: centerSource,
|
|
8006
8113
|
getRecomendPlace: pipedGetRecomendPlace,
|
|
8007
8114
|
getLimit: (context2) => {
|
|
@@ -8017,6 +8124,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8017
8124
|
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
8018
8125
|
}
|
|
8019
8126
|
},
|
|
8127
|
+
onQueryingPlace: (place) => Object.assign(centerPlace, {
|
|
8128
|
+
...place
|
|
8129
|
+
}),
|
|
8020
8130
|
onChangePlace: (place) => emit("changePlace", place),
|
|
8021
8131
|
onChange: async ({
|
|
8022
8132
|
place,
|
|
@@ -8099,7 +8209,7 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8099
8209
|
}
|
|
8100
8210
|
})]);
|
|
8101
8211
|
};
|
|
8102
|
-
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
|
|
8212
|
+
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "emptyTitle", "queryingTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
|
|
8103
8213
|
const assertPropNoEmptyArray = (list, funcName, propName) => {
|
|
8104
8214
|
if (list.length > 0)
|
|
8105
8215
|
return;
|
package/dist/index.js
CHANGED
|
@@ -16,8 +16,152 @@ if (typeof GeolocationPositionError === "undefined") {
|
|
|
16
16
|
TIMEOUT: 3
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
20
|
+
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
21
|
+
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
22
|
+
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
23
|
+
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
24
|
+
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
25
|
+
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
26
|
+
return BRWOSER_PLATFORM2;
|
|
27
|
+
})(BRWOSER_PLATFORM || {});
|
|
28
|
+
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
29
|
+
OS_PLATFORM2["IOS"] = "IOS";
|
|
30
|
+
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
31
|
+
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
32
|
+
return OS_PLATFORM2;
|
|
33
|
+
})(OS_PLATFORM || {});
|
|
34
|
+
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
35
|
+
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
36
|
+
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
37
|
+
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
38
|
+
return WEBGL_STATUS2;
|
|
39
|
+
})(WEBGL_STATUS || {});
|
|
40
|
+
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
41
|
+
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
42
|
+
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
43
|
+
return ALIPAY_WALLET2;
|
|
44
|
+
})(ALIPAY_WALLET || {});
|
|
45
|
+
const detectAlipayWallet = () => {
|
|
46
|
+
if (!navigator)
|
|
47
|
+
return void 0;
|
|
48
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
49
|
+
if (!useragent.includes("alipay"))
|
|
50
|
+
return void 0;
|
|
51
|
+
if (useragent.includes("tngkit"))
|
|
52
|
+
return "TNGD";
|
|
53
|
+
if (useragent.includes("truemoney"))
|
|
54
|
+
return "TMN";
|
|
55
|
+
};
|
|
56
|
+
const detectBrowserPlatform = () => {
|
|
57
|
+
if (typeof navigator === "undefined")
|
|
58
|
+
return "NODE_JS";
|
|
59
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
60
|
+
if (useragent.includes("micromessenger")) {
|
|
61
|
+
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
62
|
+
}
|
|
63
|
+
if (useragent.includes("alipay")) {
|
|
64
|
+
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
65
|
+
}
|
|
66
|
+
return "H5";
|
|
67
|
+
};
|
|
68
|
+
const detectOSPlatform = () => {
|
|
69
|
+
if (typeof navigator === "undefined")
|
|
70
|
+
return "OTHER";
|
|
71
|
+
const userAgent = navigator.userAgent || navigator.vendor;
|
|
72
|
+
if (/android/i.test(userAgent)) {
|
|
73
|
+
return "ANDROID";
|
|
74
|
+
}
|
|
75
|
+
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
76
|
+
return "IOS";
|
|
77
|
+
}
|
|
78
|
+
return "OTHER";
|
|
79
|
+
};
|
|
80
|
+
function detectWebGL() {
|
|
81
|
+
if (typeof window === "undefined")
|
|
82
|
+
return "NOT_SUPPORTED";
|
|
83
|
+
if (window.WebGLRenderingContext) {
|
|
84
|
+
const canvas = document.createElement("canvas");
|
|
85
|
+
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
86
|
+
let context2 = null;
|
|
87
|
+
for (const name2 of names) {
|
|
88
|
+
try {
|
|
89
|
+
context2 = canvas.getContext(name2);
|
|
90
|
+
if (context2 && typeof context2.getParameter === "function") {
|
|
91
|
+
return "ENABLED";
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.error("MyError: detectWebGL catch e = ", e);
|
|
95
|
+
return "NOT_SUPPORTED";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return "DISABLED";
|
|
99
|
+
}
|
|
100
|
+
return "NOT_SUPPORTED";
|
|
101
|
+
}
|
|
102
|
+
const createMockWx = (opt) => {
|
|
103
|
+
const { timeout, lng, lat, status } = opt.getLocation;
|
|
104
|
+
const mockWx = {
|
|
105
|
+
ready(callback) {
|
|
106
|
+
callback();
|
|
107
|
+
},
|
|
108
|
+
error(callback) {
|
|
109
|
+
callback({ errCode: "mock error code", errMsg: "mock error message" });
|
|
110
|
+
},
|
|
111
|
+
getLocation(props) {
|
|
112
|
+
const { success, fail } = props;
|
|
113
|
+
if (status === "success") {
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
success({
|
|
116
|
+
longitude: String(lng),
|
|
117
|
+
latitude: String(lat),
|
|
118
|
+
accuracy: "30",
|
|
119
|
+
speed: "0",
|
|
120
|
+
errCode: "",
|
|
121
|
+
errMsg: ""
|
|
122
|
+
});
|
|
123
|
+
}, timeout);
|
|
124
|
+
}
|
|
125
|
+
if (status === "fail") {
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
fail == null ? void 0 : fail({ errCode: "mock error code", errMsg: "mock error message" });
|
|
128
|
+
}, timeout);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
config() {
|
|
132
|
+
return;
|
|
133
|
+
},
|
|
134
|
+
miniProgram: {
|
|
135
|
+
redirectTo() {
|
|
136
|
+
return;
|
|
137
|
+
},
|
|
138
|
+
getEnv() {
|
|
139
|
+
const miniprogram = detectBrowserPlatform() === BRWOSER_PLATFORM.WECHAT_MINIPROGRAM;
|
|
140
|
+
return { miniprogram };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return mockWx;
|
|
145
|
+
};
|
|
146
|
+
const mockWxByUrl = () => {
|
|
147
|
+
const searchParams = new URLSearchParams(location.search);
|
|
148
|
+
const enable = searchParams.has("enableMockWx");
|
|
149
|
+
if (!enable)
|
|
150
|
+
return;
|
|
151
|
+
const lng = Number(searchParams.get("lng"));
|
|
152
|
+
const lat = Number(searchParams.get("lat"));
|
|
153
|
+
const timeout = Number(searchParams.get("timeout")) * 1e3;
|
|
154
|
+
const status = searchParams.get("status");
|
|
155
|
+
if (status !== "success" && status !== "fail" || isNaN(timeout)) {
|
|
156
|
+
console.error("MyError: createMockWxByUrl: wrong parameter from url");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const mockWx = createMockWx({ getLocation: { lng, lat, timeout, status } });
|
|
160
|
+
window.wx = mockWx;
|
|
161
|
+
};
|
|
162
|
+
mockWxByUrl();
|
|
19
163
|
const name = "@heycar/heycars-map";
|
|
20
|
-
const version = "0.9.
|
|
164
|
+
const version = "0.9.20-querying";
|
|
21
165
|
const type = "module";
|
|
22
166
|
const bin = {
|
|
23
167
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1408,6 +1552,11 @@ const createRunOnce = (fn) => {
|
|
|
1408
1552
|
return result;
|
|
1409
1553
|
};
|
|
1410
1554
|
};
|
|
1555
|
+
const createAsyncNoFailNonNullable = (fn, defaultValue) => {
|
|
1556
|
+
return function noFailNoNullable(...args) {
|
|
1557
|
+
return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
|
|
1558
|
+
};
|
|
1559
|
+
};
|
|
1411
1560
|
const MAX_ANIMATION_DISTANCE_VW = 300;
|
|
1412
1561
|
const MIN_ANIMATION_DURATION = 300;
|
|
1413
1562
|
const ANIMATION_DURATION_FOR_100VW = 200;
|
|
@@ -1426,89 +1575,6 @@ const ZINDEX_GREEN_ZONE = 10;
|
|
|
1426
1575
|
const TRACKS_MATCH_MAX_LENGTH = 3;
|
|
1427
1576
|
const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
|
|
1428
1577
|
const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
1429
|
-
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
1430
|
-
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
1431
|
-
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
1432
|
-
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
1433
|
-
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
1434
|
-
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
1435
|
-
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
1436
|
-
return BRWOSER_PLATFORM2;
|
|
1437
|
-
})(BRWOSER_PLATFORM || {});
|
|
1438
|
-
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
1439
|
-
OS_PLATFORM2["IOS"] = "IOS";
|
|
1440
|
-
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
1441
|
-
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
1442
|
-
return OS_PLATFORM2;
|
|
1443
|
-
})(OS_PLATFORM || {});
|
|
1444
|
-
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
1445
|
-
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
1446
|
-
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
1447
|
-
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
1448
|
-
return WEBGL_STATUS2;
|
|
1449
|
-
})(WEBGL_STATUS || {});
|
|
1450
|
-
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
1451
|
-
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
1452
|
-
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
1453
|
-
return ALIPAY_WALLET2;
|
|
1454
|
-
})(ALIPAY_WALLET || {});
|
|
1455
|
-
const detectAlipayWallet = () => {
|
|
1456
|
-
if (!navigator)
|
|
1457
|
-
return void 0;
|
|
1458
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
1459
|
-
if (!useragent.includes("alipay"))
|
|
1460
|
-
return void 0;
|
|
1461
|
-
if (useragent.includes("tngkit"))
|
|
1462
|
-
return "TNGD";
|
|
1463
|
-
if (useragent.includes("truemoney"))
|
|
1464
|
-
return "TMN";
|
|
1465
|
-
};
|
|
1466
|
-
const detectBrowserPlatform = () => {
|
|
1467
|
-
if (typeof navigator === "undefined")
|
|
1468
|
-
return "NODE_JS";
|
|
1469
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
1470
|
-
if (useragent.includes("micromessenger")) {
|
|
1471
|
-
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
1472
|
-
}
|
|
1473
|
-
if (useragent.includes("alipay")) {
|
|
1474
|
-
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
1475
|
-
}
|
|
1476
|
-
return "H5";
|
|
1477
|
-
};
|
|
1478
|
-
const detectOSPlatform = () => {
|
|
1479
|
-
if (typeof navigator === "undefined")
|
|
1480
|
-
return "OTHER";
|
|
1481
|
-
const userAgent = navigator.userAgent || navigator.vendor;
|
|
1482
|
-
if (/android/i.test(userAgent)) {
|
|
1483
|
-
return "ANDROID";
|
|
1484
|
-
}
|
|
1485
|
-
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
1486
|
-
return "IOS";
|
|
1487
|
-
}
|
|
1488
|
-
return "OTHER";
|
|
1489
|
-
};
|
|
1490
|
-
function detectWebGL() {
|
|
1491
|
-
if (typeof window === "undefined")
|
|
1492
|
-
return "NOT_SUPPORTED";
|
|
1493
|
-
if (window.WebGLRenderingContext) {
|
|
1494
|
-
const canvas = document.createElement("canvas");
|
|
1495
|
-
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
1496
|
-
let context2 = null;
|
|
1497
|
-
for (const name2 of names) {
|
|
1498
|
-
try {
|
|
1499
|
-
context2 = canvas.getContext(name2);
|
|
1500
|
-
if (context2 && typeof context2.getParameter === "function") {
|
|
1501
|
-
return "ENABLED";
|
|
1502
|
-
}
|
|
1503
|
-
} catch (e) {
|
|
1504
|
-
console.error("MyError: detectWebGL catch e = ", e);
|
|
1505
|
-
return "NOT_SUPPORTED";
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
return "DISABLED";
|
|
1509
|
-
}
|
|
1510
|
-
return "NOT_SUPPORTED";
|
|
1511
|
-
}
|
|
1512
1578
|
const vec2lnglat = ([lng, lat]) => ({
|
|
1513
1579
|
lng: Number(lng),
|
|
1514
1580
|
lat: Number(lat)
|
|
@@ -6613,7 +6679,7 @@ const useAmapPlace = (props) => {
|
|
|
6613
6679
|
place.displayName = value.displayName;
|
|
6614
6680
|
};
|
|
6615
6681
|
const getPlaceByRegeo = ([lng, lat]) => {
|
|
6616
|
-
return new Promise((resolve
|
|
6682
|
+
return new Promise((resolve) => {
|
|
6617
6683
|
const geocoder = new AMap.Geocoder({ lang: language === "en" ? "en" : "zh_cn" });
|
|
6618
6684
|
const isChina = inChina([lng, lat]);
|
|
6619
6685
|
geocoder.getAddress(new AMap.LngLat(lng, lat), (status, result) => {
|
|
@@ -6625,14 +6691,13 @@ const useAmapPlace = (props) => {
|
|
|
6625
6691
|
resolve({ lng, lat, name: name2, displayName });
|
|
6626
6692
|
return;
|
|
6627
6693
|
}
|
|
6628
|
-
case "no_data":
|
|
6694
|
+
case "no_data":
|
|
6695
|
+
case "error": {
|
|
6629
6696
|
const name2 = emptyPlaceName;
|
|
6630
6697
|
const displayName = emptyPlaceName;
|
|
6631
6698
|
resolve({ lng, lat, name: name2, displayName });
|
|
6632
6699
|
return;
|
|
6633
6700
|
}
|
|
6634
|
-
case "error":
|
|
6635
|
-
reject(result);
|
|
6636
6701
|
}
|
|
6637
6702
|
});
|
|
6638
6703
|
});
|
|
@@ -6671,13 +6736,17 @@ const useGmapPlace = (props) => {
|
|
|
6671
6736
|
place.displayName = value.displayName;
|
|
6672
6737
|
};
|
|
6673
6738
|
const getPlaceByRegeo = ([lng, lat]) => {
|
|
6674
|
-
return new Promise((resolve
|
|
6739
|
+
return new Promise((resolve) => {
|
|
6675
6740
|
const geocoder = new google.maps.Geocoder();
|
|
6676
6741
|
geocoder.geocode({ language, location: { lng, lat } }).then(({ results }) => {
|
|
6677
6742
|
const name2 = results[0].formatted_address ? results[0].formatted_address : emptyPlaceName;
|
|
6678
6743
|
const displayName = name2;
|
|
6679
6744
|
resolve({ lng, lat, name: name2, displayName });
|
|
6680
|
-
}).catch(
|
|
6745
|
+
}).catch(() => {
|
|
6746
|
+
const name2 = emptyPlaceName;
|
|
6747
|
+
const displayName = emptyPlaceName;
|
|
6748
|
+
resolve({ lng, lat, name: name2, displayName });
|
|
6749
|
+
});
|
|
6681
6750
|
});
|
|
6682
6751
|
};
|
|
6683
6752
|
watch(
|
|
@@ -6715,14 +6784,16 @@ const useMapRecomendPlace = (props) => {
|
|
|
6715
6784
|
getLimit,
|
|
6716
6785
|
context: context2,
|
|
6717
6786
|
emptyPlaceName,
|
|
6787
|
+
queryingPlaceName,
|
|
6718
6788
|
onChange,
|
|
6789
|
+
onQueryingPlace,
|
|
6719
6790
|
onChangePlace
|
|
6720
6791
|
} = props;
|
|
6721
6792
|
const availableRef = ref(true);
|
|
6722
6793
|
const placeCandidatesRef = ref([]);
|
|
6723
6794
|
const zoneRef = ref();
|
|
6724
6795
|
const { apiMapIsPointInRing, apiMapDistance } = useMapGeometry();
|
|
6725
|
-
const { getPlaceByRegeo } =
|
|
6796
|
+
const { getPlaceByRegeo } = useMapPlace({
|
|
6726
6797
|
emptyPlaceName,
|
|
6727
6798
|
pointRef: ref([...defaultPoint])
|
|
6728
6799
|
});
|
|
@@ -6738,9 +6809,10 @@ const useMapRecomendPlace = (props) => {
|
|
|
6738
6809
|
(candidate) => isPointEqual(place2point(candidate), recomendPoint)
|
|
6739
6810
|
);
|
|
6740
6811
|
});
|
|
6812
|
+
const isQueryingRef = ref(false);
|
|
6813
|
+
const getRecomendPlaceNoFail = createAsyncNoFailNonNullable(getRecomendPlace, {});
|
|
6741
6814
|
const findAttachedPlace = async (place) => {
|
|
6742
|
-
|
|
6743
|
-
const inputRecommendZonePlaces = (_a = await getRecomendPlace({ ...place }, context2)) != null ? _a : {};
|
|
6815
|
+
const inputRecommendZonePlaces = await getRecomendPlaceNoFail({ ...place }, context2);
|
|
6744
6816
|
const {
|
|
6745
6817
|
places: placeCandidates,
|
|
6746
6818
|
zone,
|
|
@@ -6773,7 +6845,7 @@ const useMapRecomendPlace = (props) => {
|
|
|
6773
6845
|
const [lng, lat] = point;
|
|
6774
6846
|
const { shortestPlace: resultPlace } = findNearestPlace(
|
|
6775
6847
|
{ lng, lat, name: "", displayName: "" },
|
|
6776
|
-
|
|
6848
|
+
prevState.candidates,
|
|
6777
6849
|
apiMapDistance
|
|
6778
6850
|
);
|
|
6779
6851
|
return {
|
|
@@ -6783,7 +6855,27 @@ const useMapRecomendPlace = (props) => {
|
|
|
6783
6855
|
candidates: prevState.candidates
|
|
6784
6856
|
};
|
|
6785
6857
|
};
|
|
6858
|
+
const updateIntermediateQueryingState = (point) => {
|
|
6859
|
+
const zone = zoneRef.value;
|
|
6860
|
+
if (zone && apiMapIsPointInRing(point, zone.path))
|
|
6861
|
+
return;
|
|
6862
|
+
const [lng, lat] = point;
|
|
6863
|
+
const intermediateQueryingPlace = {
|
|
6864
|
+
lng,
|
|
6865
|
+
lat,
|
|
6866
|
+
name: queryingPlaceName,
|
|
6867
|
+
displayName: queryingPlaceName
|
|
6868
|
+
};
|
|
6869
|
+
isQueryingRef.value = true;
|
|
6870
|
+
availableRef.value = true;
|
|
6871
|
+
if (zone)
|
|
6872
|
+
zoneRef.value = void 0;
|
|
6873
|
+
placeCandidatesRef.value = [];
|
|
6874
|
+
Object.assign(recomendPlace, { ...intermediateQueryingPlace });
|
|
6875
|
+
onQueryingPlace == null ? void 0 : onQueryingPlace({ ...intermediateQueryingPlace });
|
|
6876
|
+
};
|
|
6786
6877
|
const updatePlace = async (point) => {
|
|
6878
|
+
updateIntermediateQueryingState(point);
|
|
6787
6879
|
const {
|
|
6788
6880
|
place: resultPlace,
|
|
6789
6881
|
candidates,
|
|
@@ -6796,6 +6888,7 @@ const useMapRecomendPlace = (props) => {
|
|
|
6796
6888
|
zone: zoneRef.value
|
|
6797
6889
|
});
|
|
6798
6890
|
const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
|
|
6891
|
+
isQueryingRef.value = false;
|
|
6799
6892
|
availableRef.value = available;
|
|
6800
6893
|
zoneRef.value = zone;
|
|
6801
6894
|
placeCandidatesRef.value = candidates;
|
|
@@ -6805,14 +6898,15 @@ const useMapRecomendPlace = (props) => {
|
|
|
6805
6898
|
onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace, isInZone: !!zone, isSameZone });
|
|
6806
6899
|
};
|
|
6807
6900
|
const updatePlaceCandidates = async (place) => {
|
|
6808
|
-
|
|
6809
|
-
const inputRecommendZonePlaces =
|
|
6901
|
+
updateIntermediateQueryingState(place2point(place));
|
|
6902
|
+
const inputRecommendZonePlaces = await getRecomendPlaceNoFail({ ...place }, context2);
|
|
6810
6903
|
const {
|
|
6811
6904
|
places: placeCandidates,
|
|
6812
6905
|
zone,
|
|
6813
6906
|
available = false
|
|
6814
6907
|
} = toRecommendZonePlacesType(inputRecommendZonePlaces);
|
|
6815
6908
|
const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
|
|
6909
|
+
isQueryingRef.value = false;
|
|
6816
6910
|
availableRef.value = !!available;
|
|
6817
6911
|
zoneRef.value = zone;
|
|
6818
6912
|
placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
|
|
@@ -6824,8 +6918,10 @@ const useMapRecomendPlace = (props) => {
|
|
|
6824
6918
|
};
|
|
6825
6919
|
};
|
|
6826
6920
|
const updateRecommendPlace = async (place) => {
|
|
6921
|
+
updateIntermediateQueryingState(place2point(place));
|
|
6827
6922
|
const { place: resultPlace, candidates, available, zone } = await findAttachedPlace(place);
|
|
6828
6923
|
const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
|
|
6924
|
+
isQueryingRef.value = false;
|
|
6829
6925
|
availableRef.value = available;
|
|
6830
6926
|
zoneRef.value = zone;
|
|
6831
6927
|
placeCandidatesRef.value = candidates;
|
|
@@ -6839,9 +6935,11 @@ const useMapRecomendPlace = (props) => {
|
|
|
6839
6935
|
});
|
|
6840
6936
|
};
|
|
6841
6937
|
const updateRecommendPlaceOnlyInZone = async (place) => {
|
|
6938
|
+
updateIntermediateQueryingState(place2point(place));
|
|
6842
6939
|
const { place: foundPlace, candidates, available, zone } = await findAttachedPlace(place);
|
|
6843
6940
|
const resultPlace = zone ? foundPlace : place;
|
|
6844
6941
|
const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
|
|
6942
|
+
isQueryingRef.value = false;
|
|
6845
6943
|
availableRef.value = available;
|
|
6846
6944
|
zoneRef.value = zone;
|
|
6847
6945
|
placeCandidatesRef.value = candidates;
|
|
@@ -6869,6 +6967,7 @@ const useMapRecomendPlace = (props) => {
|
|
|
6869
6967
|
placeCandidates: placeCandidatesRef,
|
|
6870
6968
|
availableRef,
|
|
6871
6969
|
isElectedRef,
|
|
6970
|
+
isQueryingRef,
|
|
6872
6971
|
updateRecommendPlace,
|
|
6873
6972
|
updateRecommendPlaceOnlyInZone,
|
|
6874
6973
|
updatePlaceCandidates,
|
|
@@ -7596,7 +7695,6 @@ const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
|
|
|
7596
7695
|
const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
|
|
7597
7696
|
const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
|
|
7598
7697
|
const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
|
|
7599
|
-
const DEFAULT_PLACE_NAME = "当前位置";
|
|
7600
7698
|
const DEFAULT_ZOOM = 17;
|
|
7601
7699
|
const ZONE_ZOOM = 13.75;
|
|
7602
7700
|
const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlaceMap2(props, {
|
|
@@ -7606,6 +7704,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7606
7704
|
var _a, _b;
|
|
7607
7705
|
const {
|
|
7608
7706
|
geoLoadingTitle,
|
|
7707
|
+
emptyTitle,
|
|
7708
|
+
queryingTitle,
|
|
7609
7709
|
geoDefaultPosition,
|
|
7610
7710
|
geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
|
|
7611
7711
|
geoErrorOnceNotificationInterval = 0,
|
|
@@ -7759,7 +7859,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7759
7859
|
isElectedRef
|
|
7760
7860
|
} = useMapRecomendPlace({
|
|
7761
7861
|
defaultPoint: place2point(centerPlace),
|
|
7762
|
-
emptyPlaceName:
|
|
7862
|
+
emptyPlaceName: emptyTitle,
|
|
7863
|
+
queryingPlaceName: queryingTitle,
|
|
7763
7864
|
context: centerSource,
|
|
7764
7865
|
getRecomendPlace: pipedGetRecomendPlace,
|
|
7765
7866
|
getLimit: (context2) => {
|
|
@@ -7775,6 +7876,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7775
7876
|
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
7776
7877
|
}
|
|
7777
7878
|
},
|
|
7879
|
+
onQueryingPlace: (place) => Object.assign(centerPlace, {
|
|
7880
|
+
...place
|
|
7881
|
+
}),
|
|
7778
7882
|
onChangePlace: (place) => emit("changePlace", place),
|
|
7779
7883
|
onChange: async ({
|
|
7780
7884
|
place,
|
|
@@ -7858,7 +7962,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
7858
7962
|
}
|
|
7859
7963
|
})]);
|
|
7860
7964
|
};
|
|
7861
|
-
}).props(["log", "geoLoadingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
7965
|
+
}).props(["log", "geoLoadingTitle", "emptyTitle", "queryingTitle", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "unavailableTitle", "recomendDescription", "disableLocator", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
7862
7966
|
const emptyPlace = {
|
|
7863
7967
|
lng: 0,
|
|
7864
7968
|
lat: 0,
|
|
@@ -7870,6 +7974,8 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
7870
7974
|
slots
|
|
7871
7975
|
}) {
|
|
7872
7976
|
const {
|
|
7977
|
+
emptyTitle,
|
|
7978
|
+
queryingTitle,
|
|
7873
7979
|
geoErrorOnceNotificationKey = `BusinessRecomendPlaceMap_${Date.now()}`,
|
|
7874
7980
|
geoErrorOnceNotificationInterval = 0,
|
|
7875
7981
|
getRecomendPlace,
|
|
@@ -7999,7 +8105,8 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
7999
8105
|
isElectedRef
|
|
8000
8106
|
} = useMapRecomendPlace({
|
|
8001
8107
|
defaultPoint: place2point(centerPlace),
|
|
8002
|
-
emptyPlaceName:
|
|
8108
|
+
emptyPlaceName: emptyTitle,
|
|
8109
|
+
queryingPlaceName: queryingTitle,
|
|
8003
8110
|
context: centerSource,
|
|
8004
8111
|
getRecomendPlace: pipedGetRecomendPlace,
|
|
8005
8112
|
getLimit: (context2) => {
|
|
@@ -8015,6 +8122,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8015
8122
|
throw new Error(`MyError: should not call getLimit on source: ${source}`);
|
|
8016
8123
|
}
|
|
8017
8124
|
},
|
|
8125
|
+
onQueryingPlace: (place) => Object.assign(centerPlace, {
|
|
8126
|
+
...place
|
|
8127
|
+
}),
|
|
8018
8128
|
onChangePlace: (place) => emit("changePlace", place),
|
|
8019
8129
|
onChange: async ({
|
|
8020
8130
|
place,
|
|
@@ -8097,7 +8207,7 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8097
8207
|
}
|
|
8098
8208
|
})]);
|
|
8099
8209
|
};
|
|
8100
|
-
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
|
|
8210
|
+
}).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "emptyTitle", "queryingTitle", "recomendDescription", "geoErrorOnceNotificationKey", "geoErrorOnceNotificationInterval", "disableLocator", "getRecomendPlace", "mapContext"]);
|
|
8101
8211
|
const assertPropNoEmptyArray = (list, funcName, propName) => {
|
|
8102
8212
|
if (list.length > 0)
|
|
8103
8213
|
return;
|
|
@@ -12,7 +12,6 @@ export declare const RECOMMEND_PLACE_ICON_ZOOM_MIN = 16.25;
|
|
|
12
12
|
export declare const RECOMMEND_PLACE_TEXT_ZOOM_MIN = 16.25;
|
|
13
13
|
export declare const RECOMMEND_PLACE_ZONE_ICON_MIN = 12.75;
|
|
14
14
|
export declare const RECOMMEND_PLACE_ZONE_TEXT_MIN = 21;
|
|
15
|
-
export declare const DEFAULT_PLACE_NAME = "\u5F53\u524D\u4F4D\u7F6E";
|
|
16
15
|
export declare const DEFAULT_ZOOM = 17;
|
|
17
16
|
export declare const ZONE_ZOOM = 13.75;
|
|
18
17
|
export interface CenterPlaceSource {
|
|
@@ -22,6 +21,8 @@ export interface BusinessRecomendPlaceMapProps extends Omit<HeycarMapProps, "cen
|
|
|
22
21
|
log?: boolean;
|
|
23
22
|
geoLoadingTitle: string;
|
|
24
23
|
unavailableTitle: string;
|
|
24
|
+
emptyTitle: string;
|
|
25
|
+
queryingTitle: string;
|
|
25
26
|
recomendDescription: string;
|
|
26
27
|
geoDefaultPosition?: Point;
|
|
27
28
|
disableLocator?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Place } from "../../types/interface";
|
|
2
2
|
import { type BusinessRecomendPlaceMapProps } from "../BusinessRecomendPlaceMap";
|
|
3
|
-
export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "geoErrorOnceNotificationInterval" | "loading" | "fallback" | "log" | "getRecomendPlace" | "unavailableTitle" | "recomendDescription" | "disableLocator" | "mapContext" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocator"> {
|
|
3
|
+
export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "geoErrorOnceNotificationInterval" | "loading" | "fallback" | "log" | "getRecomendPlace" | "unavailableTitle" | "emptyTitle" | "queryingTitle" | "recomendDescription" | "disableLocator" | "mapContext" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocator"> {
|
|
4
4
|
defaultPlace?: Place;
|
|
5
5
|
}
|
|
6
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" | "geoErrorOnce" | "clickLocator", BusinessReselectPlaceMapProps, {}>;
|
|
@@ -10,9 +10,11 @@ export interface UseMapRecomendPlaceProps<C = Record<string, any>> {
|
|
|
10
10
|
defaultPoint: Point;
|
|
11
11
|
context?: C;
|
|
12
12
|
emptyPlaceName: string;
|
|
13
|
+
queryingPlaceName: string;
|
|
13
14
|
getLimit: (context?: C) => number;
|
|
14
15
|
getRecomendPlace: (place: Place, context?: C) => Promise<RecommendZonePlaces | undefined>;
|
|
15
16
|
onChangePlace?: UseMapPlaceProps["onChange"];
|
|
17
|
+
onQueryingPlace?: UseMapPlaceProps["onChange"];
|
|
16
18
|
onChange?: (place: ValueOfOnChangeRecommendPlace) => any;
|
|
17
19
|
}
|
|
18
20
|
export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
@@ -31,6 +33,7 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
|
|
|
31
33
|
}[]>;
|
|
32
34
|
availableRef: import("vue-demi").Ref<boolean>;
|
|
33
35
|
isElectedRef: import("vue-demi").ComputedRef<boolean>;
|
|
36
|
+
isQueryingRef: import("vue-demi").Ref<boolean>;
|
|
34
37
|
updateRecommendPlace: (place: Place) => Promise<void>;
|
|
35
38
|
updateRecommendPlaceOnlyInZone: (place: Place) => Promise<void>;
|
|
36
39
|
updatePlaceCandidates: (place: Place) => Promise<ValueOfOnChangeRecommendPlace>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
import "./utils/alipayPolyfill";
|
|
3
|
+
import "./utils/mockWx";
|
|
3
4
|
export { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox";
|
|
4
5
|
export { AddressBox } from "./business-components/AddressBox";
|
|
5
6
|
export { BusinessQuotingMap } from "./business-components/BusinessQuotingMap";
|
package/dist/src/types/wx.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ export interface WxResponse {
|
|
|
2
2
|
errCode: string;
|
|
3
3
|
errMsg: string;
|
|
4
4
|
}
|
|
5
|
+
export interface WxConfigProps {
|
|
6
|
+
debug: boolean;
|
|
7
|
+
appId: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
nonceStr: string;
|
|
10
|
+
signature: string;
|
|
11
|
+
jsApiList: string[];
|
|
12
|
+
}
|
|
5
13
|
export interface WxGetLocationSuccessResponse extends WxResponse {
|
|
6
14
|
latitude: string;
|
|
7
15
|
longitude: string;
|
|
@@ -23,9 +31,13 @@ interface WxGetLocationProps {
|
|
|
23
31
|
export interface Wx {
|
|
24
32
|
ready: (callback: () => void) => void;
|
|
25
33
|
error: (callback: (response: WxResponse) => void) => void;
|
|
34
|
+
config: (props: WxConfigProps) => void;
|
|
26
35
|
getLocation: (props: WxGetLocationProps) => void;
|
|
27
36
|
miniProgram: {
|
|
28
37
|
redirectTo: (props: WxMiniProgramRedirectToProps) => void;
|
|
38
|
+
getEnv: () => {
|
|
39
|
+
miniprogram: boolean;
|
|
40
|
+
};
|
|
29
41
|
};
|
|
30
42
|
}
|
|
31
43
|
export {};
|
|
@@ -22,4 +22,5 @@ export declare const pausableSleep: (milliSeconds: number) => {
|
|
|
22
22
|
restart: () => void;
|
|
23
23
|
};
|
|
24
24
|
export declare const createRunOnce: <P extends any[], R>(fn: (...args: P) => R) => (...args: P) => R;
|
|
25
|
+
export declare const createAsyncNoFailNonNullable: <P extends any[], R>(fn: (...args: P) => Promise<R>, defaultValue: NonNullable<R>) => (...args: P) => Promise<NonNullable<R>>;
|
|
25
26
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Wx } from "../types/wx";
|
|
2
|
+
interface CreateMockWxProps {
|
|
3
|
+
getLocation: {
|
|
4
|
+
timeout: number;
|
|
5
|
+
lng?: number;
|
|
6
|
+
lat?: number;
|
|
7
|
+
status: "success" | "fail";
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare const createMockWx: (opt: CreateMockWxProps) => Wx;
|
|
11
|
+
export {};
|