vue-openlayers-plugin 1.1.16 → 1.2.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/README.md +341 -0
- package/lib/{BasemapPanel-d1332546.mjs → BasemapPanel-d6e4ea88.mjs} +1 -1
- package/lib/{CoordinateLocationDialog-c2d89c1e.mjs → CoordinateLocationDialog-81d00abc.mjs} +1 -1
- package/lib/{MapPrintDialog-eea9e39e.mjs → FilterPanel-7358e3fb.mjs} +1 -1
- package/lib/{FilterPanel-d7cb1c79.mjs → LayerPanel-9bf28955.mjs} +1 -1
- package/lib/{LayerPanel-f411a32b.mjs → MapPrintDialog-64d46412.mjs} +1 -1
- package/lib/{MeasurementDialog-9914f4e9.mjs → MeasurementDialog-4e084192.mjs} +1 -1
- package/lib/{MyMarkersDialog-ef717e8c.mjs → MyMarkersDialog-aa44e5bd.mjs} +1 -1
- package/lib/{QuadCompareDialog-3d6eaf0c.mjs → QuadCompareDialog-84a88cf9.mjs} +1 -1
- package/lib/{RegionNavigationDialog-2843eedd.mjs → RegionNavigationDialog-467ad6c0.mjs} +1 -1
- package/lib/{SplitCompareDialog-1e678e69.mjs → SplitCompareDialog-50410c0b.mjs} +1 -1
- package/lib/{SwipeCompareDialog-547de7ee.mjs → SwipeCompareDialog-c322e2f6.mjs} +1 -1
- package/lib/{ViewBookmarksDialog-d3e38c53.mjs → ViewBookmarksDialog-83cf5ec4.mjs} +1 -1
- package/lib/{index-198a96d2.mjs → index-58704a25.mjs} +296 -30
- package/lib/{index-92020358.mjs → index-ee58f2f8.mjs} +1 -1
- package/lib/{index.es-dd926512.mjs → index.es-320e524d.mjs} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.umd.js +282 -16
- package/lib/style.css +13 -4
- package/package.json +1 -1
- package/types/components/OlMapSearch.vue.d.ts +20 -1
- package/types/components/OlMapSearch.vue.d.ts.map +1 -1
- package/types/core/tiandituSearchApi.d.ts.map +1 -1
- package/types/plugins/index.d.ts +90 -0
- package/types/plugins/index.d.ts.map +1 -0
- package/types/services/searchService.d.ts +21 -1
- package/types/services/searchService.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/types/map.d.ts +24 -0
- package/types/types/map.d.ts.map +1 -1
|
@@ -334989,7 +334989,7 @@ const _hoisted_15$3 = ["src", "alt"];
|
|
|
334989
334989
|
const _hoisted_16$3 = { key: 1 };
|
|
334990
334990
|
const _hoisted_17$3 = ["href"];
|
|
334991
334991
|
const _hoisted_18$3 = { key: 2 };
|
|
334992
|
-
const _hoisted_19$
|
|
334992
|
+
const _hoisted_19$3 = { key: 3 };
|
|
334993
334993
|
const _hoisted_20$2 = { key: 4 };
|
|
334994
334994
|
const _hoisted_21$2 = {
|
|
334995
334995
|
key: 6,
|
|
@@ -335279,7 +335279,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
335279
335279
|
target: "_blank",
|
|
335280
335280
|
class: "table-link"
|
|
335281
335281
|
}, toDisplayString(getFieldValue(item, field.key || field.name)), 9, _hoisted_17$3)
|
|
335282
|
-
])) : field.type === "date" ? (openBlock(), createElementBlock("span", _hoisted_18$3, toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (openBlock(), createElementBlock("span", _hoisted_19$
|
|
335282
|
+
])) : field.type === "date" ? (openBlock(), createElementBlock("span", _hoisted_18$3, toDisplayString(formatDate(getFieldValue(item, field.key || field.name))), 1)) : field.type === "number" ? (openBlock(), createElementBlock("span", _hoisted_19$3, toDisplayString(formatNumber2(getFieldValue(item, field.key || field.name))), 1)) : (openBlock(), createElementBlock("span", _hoisted_20$2, toDisplayString(getFieldValue(item, field.key || field.name)), 1))
|
|
335283
335283
|
]);
|
|
335284
335284
|
}), 128))
|
|
335285
335285
|
], 8, _hoisted_13$6);
|
|
@@ -337397,19 +337397,19 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
337397
337397
|
}
|
|
337398
337398
|
});
|
|
337399
337399
|
const defaultComponents = {
|
|
337400
|
-
measurement: () => import("./MeasurementDialog-
|
|
337401
|
-
basemap: () => import("./BasemapPanel-
|
|
337402
|
-
print: () => import("./MapPrintDialog-
|
|
337403
|
-
"layer-panel": () => import("./LayerPanel-
|
|
337404
|
-
coordinate: () => import("./CoordinateLocationDialog-
|
|
337405
|
-
"region-navigation": () => import("./RegionNavigationDialog-
|
|
337406
|
-
"my-markers": () => import("./MyMarkersDialog-
|
|
337407
|
-
"view-bookmarks": () => import("./ViewBookmarksDialog-
|
|
337408
|
-
"map-drawing": () => import("./index-
|
|
337409
|
-
"filter-panel": () => import("./FilterPanel-
|
|
337410
|
-
"swipe-compare": () => import("./SwipeCompareDialog-
|
|
337411
|
-
"split-compare": () => import("./SplitCompareDialog-
|
|
337412
|
-
"quad-compare": () => import("./QuadCompareDialog-
|
|
337400
|
+
measurement: () => import("./MeasurementDialog-4e084192.mjs"),
|
|
337401
|
+
basemap: () => import("./BasemapPanel-d6e4ea88.mjs"),
|
|
337402
|
+
print: () => import("./MapPrintDialog-64d46412.mjs"),
|
|
337403
|
+
"layer-panel": () => import("./LayerPanel-9bf28955.mjs"),
|
|
337404
|
+
coordinate: () => import("./CoordinateLocationDialog-81d00abc.mjs"),
|
|
337405
|
+
"region-navigation": () => import("./RegionNavigationDialog-467ad6c0.mjs"),
|
|
337406
|
+
"my-markers": () => import("./MyMarkersDialog-aa44e5bd.mjs"),
|
|
337407
|
+
"view-bookmarks": () => import("./ViewBookmarksDialog-83cf5ec4.mjs"),
|
|
337408
|
+
"map-drawing": () => import("./index-ee58f2f8.mjs"),
|
|
337409
|
+
"filter-panel": () => import("./FilterPanel-7358e3fb.mjs"),
|
|
337410
|
+
"swipe-compare": () => import("./SwipeCompareDialog-c322e2f6.mjs"),
|
|
337411
|
+
"split-compare": () => import("./SplitCompareDialog-50410c0b.mjs"),
|
|
337412
|
+
"quad-compare": () => import("./QuadCompareDialog-84a88cf9.mjs")
|
|
337413
337413
|
};
|
|
337414
337414
|
const _DialogRegistry = class _DialogRegistry {
|
|
337415
337415
|
constructor() {
|
|
@@ -337880,6 +337880,7 @@ class TiandituSearchApi {
|
|
|
337880
337880
|
* @param options 搜索选项
|
|
337881
337881
|
*/
|
|
337882
337882
|
async search(query, options = {}) {
|
|
337883
|
+
var _a2;
|
|
337883
337884
|
try {
|
|
337884
337885
|
const {
|
|
337885
337886
|
maxResults = 10,
|
|
@@ -337907,8 +337908,10 @@ class TiandituSearchApi {
|
|
|
337907
337908
|
throw new Error(`天地图API请求失败: ${response.status}`);
|
|
337908
337909
|
}
|
|
337909
337910
|
const data = await response.json();
|
|
337910
|
-
|
|
337911
|
-
|
|
337911
|
+
const isSuccess = data.status === "200" || data.status === "0" || typeof data.status === "object" && ((_a2 = data.status) == null ? void 0 : _a2.infocode) === 1e3;
|
|
337912
|
+
if (!isSuccess) {
|
|
337913
|
+
const errorMessage = typeof data.status === "object" ? `${data.status.cndesc || "未知错误"} (${data.status.infocode ?? "unknown"})` : data.status;
|
|
337914
|
+
throw new Error(`天地图API返回错误: ${errorMessage}`);
|
|
337912
337915
|
}
|
|
337913
337916
|
return this.transformResults(data, type);
|
|
337914
337917
|
} catch (error2) {
|
|
@@ -338075,6 +338078,20 @@ class TiandituSearchApi {
|
|
|
338075
338078
|
}
|
|
338076
338079
|
}
|
|
338077
338080
|
const tiandituSearchApi = new TiandituSearchApi();
|
|
338081
|
+
class MapSearchError extends Error {
|
|
338082
|
+
constructor(options) {
|
|
338083
|
+
super(options.message);
|
|
338084
|
+
__publicField(this, "code");
|
|
338085
|
+
__publicField(this, "userMessage");
|
|
338086
|
+
__publicField(this, "provider");
|
|
338087
|
+
__publicField(this, "cause");
|
|
338088
|
+
this.name = "MapSearchError";
|
|
338089
|
+
this.code = options.code;
|
|
338090
|
+
this.userMessage = options.userMessage;
|
|
338091
|
+
this.provider = options.provider;
|
|
338092
|
+
this.cause = options.cause;
|
|
338093
|
+
}
|
|
338094
|
+
}
|
|
338078
338095
|
class MapSearchService {
|
|
338079
338096
|
constructor(config, deps) {
|
|
338080
338097
|
__publicField(this, "config");
|
|
@@ -338128,7 +338145,7 @@ class MapSearchService {
|
|
|
338128
338145
|
return results;
|
|
338129
338146
|
} catch (error2) {
|
|
338130
338147
|
console.error("搜索失败:", error2);
|
|
338131
|
-
|
|
338148
|
+
throw this.createSearchError(query, error2);
|
|
338132
338149
|
}
|
|
338133
338150
|
}
|
|
338134
338151
|
/**
|
|
@@ -338243,7 +338260,7 @@ class MapSearchService {
|
|
|
338243
338260
|
async searchTianditu(query) {
|
|
338244
338261
|
try {
|
|
338245
338262
|
const results = await tiandituSearchApi.search(query, {
|
|
338246
|
-
...this.
|
|
338263
|
+
...this.getTiandituSearchOptions(),
|
|
338247
338264
|
maxResults: this.config.maxResults || 10,
|
|
338248
338265
|
type: this.config.type || "all"
|
|
338249
338266
|
});
|
|
@@ -338253,6 +338270,111 @@ class MapSearchService {
|
|
|
338253
338270
|
throw error2;
|
|
338254
338271
|
}
|
|
338255
338272
|
}
|
|
338273
|
+
getTiandituSearchOptions() {
|
|
338274
|
+
const {
|
|
338275
|
+
enabled: _enabled,
|
|
338276
|
+
position: _position,
|
|
338277
|
+
placeholder: _placeholder,
|
|
338278
|
+
provider: _provider,
|
|
338279
|
+
apiKey: _apiKey,
|
|
338280
|
+
customApi: _customApi,
|
|
338281
|
+
layerSearch: _layerSearch,
|
|
338282
|
+
maxResults: _maxResults,
|
|
338283
|
+
showHistory: _showHistory,
|
|
338284
|
+
enableStorage: _enableStorage,
|
|
338285
|
+
searchDelay: _searchDelay,
|
|
338286
|
+
minSearchLength: _minSearchLength,
|
|
338287
|
+
messages: _messages,
|
|
338288
|
+
resultStyle: _resultStyle,
|
|
338289
|
+
onSearch: _onSearch,
|
|
338290
|
+
onSelect: _onSelect,
|
|
338291
|
+
customSearchFn: _customSearchFn,
|
|
338292
|
+
...tiandituOptions
|
|
338293
|
+
} = this.config;
|
|
338294
|
+
return tiandituOptions;
|
|
338295
|
+
}
|
|
338296
|
+
createSearchError(query, error2) {
|
|
338297
|
+
var _a2;
|
|
338298
|
+
if (error2 instanceof MapSearchError) {
|
|
338299
|
+
return error2;
|
|
338300
|
+
}
|
|
338301
|
+
const provider = this.getResolvedProvider();
|
|
338302
|
+
const code = this.inferSearchErrorCode(error2);
|
|
338303
|
+
const technicalMessage = error2 instanceof Error ? error2.message : "搜索服务发生未知错误";
|
|
338304
|
+
const userMessage = this.resolveMessage((_a2 = this.config.messages) == null ? void 0 : _a2.searchFailed, {
|
|
338305
|
+
query,
|
|
338306
|
+
provider,
|
|
338307
|
+
error: error2,
|
|
338308
|
+
code
|
|
338309
|
+
}) || this.getDefaultSearchFailedMessage(provider, code);
|
|
338310
|
+
return new MapSearchError({
|
|
338311
|
+
code,
|
|
338312
|
+
message: technicalMessage,
|
|
338313
|
+
userMessage,
|
|
338314
|
+
provider,
|
|
338315
|
+
cause: error2
|
|
338316
|
+
});
|
|
338317
|
+
}
|
|
338318
|
+
inferSearchErrorCode(error2) {
|
|
338319
|
+
if (error2 instanceof MapSearchError) {
|
|
338320
|
+
return error2.code;
|
|
338321
|
+
}
|
|
338322
|
+
if (error2 instanceof TypeError) {
|
|
338323
|
+
return "network_error";
|
|
338324
|
+
}
|
|
338325
|
+
if (!(error2 instanceof Error)) {
|
|
338326
|
+
return "unknown_error";
|
|
338327
|
+
}
|
|
338328
|
+
const message = error2.message.toLowerCase();
|
|
338329
|
+
if (message.includes("未配置") || message.includes("not configured")) {
|
|
338330
|
+
return "config_error";
|
|
338331
|
+
}
|
|
338332
|
+
if (message.includes("failed to fetch") || message.includes("networkerror") || message.includes("网络")) {
|
|
338333
|
+
return "network_error";
|
|
338334
|
+
}
|
|
338335
|
+
if (message.includes("http error") || message.includes("请求失败") || /^http\s\d+/.test(message)) {
|
|
338336
|
+
return "http_error";
|
|
338337
|
+
}
|
|
338338
|
+
if (message.includes("api错误") || message.includes("返回错误") || message.includes("业务错误")) {
|
|
338339
|
+
return "api_error";
|
|
338340
|
+
}
|
|
338341
|
+
return "unknown_error";
|
|
338342
|
+
}
|
|
338343
|
+
getResolvedProvider() {
|
|
338344
|
+
return this.config.provider || "tianditu";
|
|
338345
|
+
}
|
|
338346
|
+
getDefaultSearchFailedMessage(provider, code) {
|
|
338347
|
+
const providerLabel = this.getProviderLabel(provider);
|
|
338348
|
+
switch (code) {
|
|
338349
|
+
case "config_error":
|
|
338350
|
+
return `${providerLabel}未完成配置,请联系管理员`;
|
|
338351
|
+
case "http_error":
|
|
338352
|
+
return `${providerLabel}服务连接失败,请稍后重试`;
|
|
338353
|
+
case "api_error":
|
|
338354
|
+
return `${providerLabel}返回业务错误,请调整关键词后重试`;
|
|
338355
|
+
case "network_error":
|
|
338356
|
+
return `网络连接异常,无法访问${providerLabel}`;
|
|
338357
|
+
default:
|
|
338358
|
+
return `${providerLabel}搜索暂不可用,请稍后重试`;
|
|
338359
|
+
}
|
|
338360
|
+
}
|
|
338361
|
+
getProviderLabel(provider) {
|
|
338362
|
+
const labelMap = {
|
|
338363
|
+
baidu: "百度地图搜索服务",
|
|
338364
|
+
amap: "高德地图搜索服务",
|
|
338365
|
+
google: "Google 地图搜索服务",
|
|
338366
|
+
tianditu: "天地图搜索服务",
|
|
338367
|
+
custom: "自定义搜索服务",
|
|
338368
|
+
layer: "图层搜索服务"
|
|
338369
|
+
};
|
|
338370
|
+
return labelMap[provider];
|
|
338371
|
+
}
|
|
338372
|
+
resolveMessage(resolver, context) {
|
|
338373
|
+
if (!resolver) {
|
|
338374
|
+
return void 0;
|
|
338375
|
+
}
|
|
338376
|
+
return typeof resolver === "function" ? resolver(context) : resolver;
|
|
338377
|
+
}
|
|
338256
338378
|
/**
|
|
338257
338379
|
* 自定义API搜索
|
|
338258
338380
|
*/
|
|
@@ -338597,6 +338719,11 @@ const defaultSearchConfig = {
|
|
|
338597
338719
|
showHistory: true,
|
|
338598
338720
|
searchDelay: 300,
|
|
338599
338721
|
minSearchLength: 2,
|
|
338722
|
+
messages: {
|
|
338723
|
+
historyTitle: "搜索历史",
|
|
338724
|
+
clearHistory: "清除",
|
|
338725
|
+
resultsTitle: "搜索结果"
|
|
338726
|
+
},
|
|
338600
338727
|
resultStyle: {
|
|
338601
338728
|
markerColor: "#409eff",
|
|
338602
338729
|
markerSize: 20,
|
|
@@ -338606,6 +338733,7 @@ const defaultSearchConfig = {
|
|
|
338606
338733
|
};
|
|
338607
338734
|
const searchService = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
338608
338735
|
__proto__: null,
|
|
338736
|
+
MapSearchError,
|
|
338609
338737
|
MapSearchService,
|
|
338610
338738
|
defaultSearchConfig
|
|
338611
338739
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -338642,6 +338770,10 @@ const _hoisted_17$2 = {
|
|
|
338642
338770
|
class: "item-confidence"
|
|
338643
338771
|
};
|
|
338644
338772
|
const _hoisted_18$2 = {
|
|
338773
|
+
key: 0,
|
|
338774
|
+
class: "search-error"
|
|
338775
|
+
};
|
|
338776
|
+
const _hoisted_19$2 = {
|
|
338645
338777
|
key: 0,
|
|
338646
338778
|
class: "no-results"
|
|
338647
338779
|
};
|
|
@@ -338658,10 +338790,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338658
338790
|
enableStorage: false,
|
|
338659
338791
|
// 默认禁用存储
|
|
338660
338792
|
searchDelay: 300,
|
|
338661
|
-
minSearchLength: 2
|
|
338793
|
+
minSearchLength: 2,
|
|
338794
|
+
messages: {
|
|
338795
|
+
historyTitle: "搜索历史",
|
|
338796
|
+
clearHistory: "清除",
|
|
338797
|
+
resultsTitle: "搜索结果"
|
|
338798
|
+
}
|
|
338662
338799
|
}) }
|
|
338663
338800
|
},
|
|
338664
|
-
emits: ["search", "select", "clear"],
|
|
338801
|
+
emits: ["search", "select", "clear", "search-error"],
|
|
338665
338802
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
338666
338803
|
const props = __props;
|
|
338667
338804
|
const emit = __emit;
|
|
@@ -338677,12 +338814,52 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338677
338814
|
const showResults = ref(false);
|
|
338678
338815
|
const selectedIndex = ref(-1);
|
|
338679
338816
|
const searchTimer = ref(null);
|
|
338817
|
+
const searchErrorMessage = ref("");
|
|
338818
|
+
const searchErrorCode = ref("");
|
|
338680
338819
|
const position2 = computed(() => props.config.position || "top-left");
|
|
338681
338820
|
const placeholder = computed(() => props.config.placeholder || "搜索地点...");
|
|
338682
338821
|
const maxResults = computed(() => props.config.maxResults || 10);
|
|
338683
338822
|
const showHistory = computed(() => props.config.showHistory !== false);
|
|
338684
338823
|
const searchDelay = computed(() => props.config.searchDelay || 300);
|
|
338685
338824
|
const minSearchLength = computed(() => props.config.minSearchLength || 2);
|
|
338825
|
+
const historyTitleText = computed(
|
|
338826
|
+
() => {
|
|
338827
|
+
var _a2;
|
|
338828
|
+
return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.historyTitle, {}, "搜索历史");
|
|
338829
|
+
}
|
|
338830
|
+
);
|
|
338831
|
+
const clearHistoryText = computed(
|
|
338832
|
+
() => {
|
|
338833
|
+
var _a2;
|
|
338834
|
+
return resolveMessage((_a2 = props.config.messages) == null ? void 0 : _a2.clearHistory, {}, "清除");
|
|
338835
|
+
}
|
|
338836
|
+
);
|
|
338837
|
+
const resultsTitleText = computed(
|
|
338838
|
+
() => {
|
|
338839
|
+
var _a2;
|
|
338840
|
+
return resolveMessage(
|
|
338841
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.resultsTitle,
|
|
338842
|
+
{
|
|
338843
|
+
query: searchQuery.value,
|
|
338844
|
+
count: searchResults.value.length
|
|
338845
|
+
},
|
|
338846
|
+
"搜索结果"
|
|
338847
|
+
);
|
|
338848
|
+
}
|
|
338849
|
+
);
|
|
338850
|
+
const noResultsText = computed(
|
|
338851
|
+
() => {
|
|
338852
|
+
var _a2;
|
|
338853
|
+
return resolveMessage(
|
|
338854
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.noResults,
|
|
338855
|
+
{
|
|
338856
|
+
query: searchQuery.value,
|
|
338857
|
+
provider: props.config.provider
|
|
338858
|
+
},
|
|
338859
|
+
getDefaultNoResultsMessage(props.config.provider || "tianditu")
|
|
338860
|
+
);
|
|
338861
|
+
}
|
|
338862
|
+
);
|
|
338686
338863
|
const displayResults = computed(() => {
|
|
338687
338864
|
return searchResults.value.slice(0, maxResults.value);
|
|
338688
338865
|
});
|
|
@@ -338696,15 +338873,65 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338696
338873
|
}
|
|
338697
338874
|
return count2;
|
|
338698
338875
|
});
|
|
338876
|
+
const resolveMessage = (resolver, context, fallback) => {
|
|
338877
|
+
if (!resolver) {
|
|
338878
|
+
return fallback;
|
|
338879
|
+
}
|
|
338880
|
+
return typeof resolver === "function" ? resolver(context) : resolver;
|
|
338881
|
+
};
|
|
338882
|
+
const getProviderLabel = (provider) => {
|
|
338883
|
+
const labelMap = {
|
|
338884
|
+
baidu: "百度地图",
|
|
338885
|
+
amap: "高德地图",
|
|
338886
|
+
google: "Google 地图",
|
|
338887
|
+
tianditu: "天地图",
|
|
338888
|
+
custom: "自定义搜索服务",
|
|
338889
|
+
layer: "图层搜索"
|
|
338890
|
+
};
|
|
338891
|
+
return labelMap[provider];
|
|
338892
|
+
};
|
|
338893
|
+
const getDefaultNoResultsMessage = (provider) => {
|
|
338894
|
+
switch (provider) {
|
|
338895
|
+
case "baidu":
|
|
338896
|
+
return "百度地图未找到相关地点,请尝试更换关键词";
|
|
338897
|
+
case "amap":
|
|
338898
|
+
return "高德地图未找到相关地点,请尝试更换关键词";
|
|
338899
|
+
case "google":
|
|
338900
|
+
return "Google 地图未找到相关地点,请尝试更换关键词";
|
|
338901
|
+
case "custom":
|
|
338902
|
+
return "自定义搜索服务未返回结果";
|
|
338903
|
+
case "layer":
|
|
338904
|
+
return "当前图层中未找到匹配结果";
|
|
338905
|
+
default:
|
|
338906
|
+
return "天地图未找到相关地点,请尝试补充行政区或 POI 名称";
|
|
338907
|
+
}
|
|
338908
|
+
};
|
|
338909
|
+
const normalizeSearchError = (error2) => {
|
|
338910
|
+
if (error2 instanceof MapSearchError) {
|
|
338911
|
+
return error2;
|
|
338912
|
+
}
|
|
338913
|
+
const provider = props.config.provider || "tianditu";
|
|
338914
|
+
return new MapSearchError({
|
|
338915
|
+
code: "unknown_error",
|
|
338916
|
+
message: error2 instanceof Error ? error2.message : "搜索服务发生未知错误",
|
|
338917
|
+
userMessage: `${getProviderLabel(provider)}搜索暂不可用,请稍后重试`,
|
|
338918
|
+
provider,
|
|
338919
|
+
cause: error2
|
|
338920
|
+
});
|
|
338921
|
+
};
|
|
338699
338922
|
const handleSearchInput = (value) => {
|
|
338700
338923
|
if (searchTimer.value) {
|
|
338701
338924
|
clearTimeout(searchTimer.value);
|
|
338702
338925
|
}
|
|
338703
338926
|
if (value.length >= minSearchLength.value) {
|
|
338927
|
+
searchErrorMessage.value = "";
|
|
338928
|
+
searchErrorCode.value = "";
|
|
338704
338929
|
searchTimer.value = setTimeout(() => {
|
|
338705
338930
|
performSearch(value);
|
|
338706
338931
|
}, searchDelay.value);
|
|
338707
338932
|
} else {
|
|
338933
|
+
searchErrorMessage.value = "";
|
|
338934
|
+
searchErrorCode.value = "";
|
|
338708
338935
|
searchResults.value = [];
|
|
338709
338936
|
showResults.value = value.length === 0 && showHistory.value;
|
|
338710
338937
|
}
|
|
@@ -338752,6 +338979,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338752
338979
|
selectedIndex.value = -1;
|
|
338753
338980
|
searchQuery.value = "";
|
|
338754
338981
|
searchResults.value = [];
|
|
338982
|
+
searchErrorMessage.value = "";
|
|
338983
|
+
searchErrorCode.value = "";
|
|
338755
338984
|
};
|
|
338756
338985
|
const getSelectableItems = () => {
|
|
338757
338986
|
const items = [];
|
|
@@ -338764,11 +338993,14 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338764
338993
|
return items;
|
|
338765
338994
|
};
|
|
338766
338995
|
const performSearch = async (query) => {
|
|
338996
|
+
var _a2;
|
|
338767
338997
|
if (!query || query.length < minSearchLength.value) {
|
|
338768
338998
|
return;
|
|
338769
338999
|
}
|
|
338770
339000
|
isLoading.value = true;
|
|
338771
339001
|
showResults.value = true;
|
|
339002
|
+
searchErrorMessage.value = "";
|
|
339003
|
+
searchErrorCode.value = "";
|
|
338772
339004
|
try {
|
|
338773
339005
|
const results = await searchService2.search(query);
|
|
338774
339006
|
searchResults.value = results;
|
|
@@ -338776,6 +339008,19 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338776
339008
|
} catch (error2) {
|
|
338777
339009
|
console.error("搜索失败:", error2);
|
|
338778
339010
|
searchResults.value = [];
|
|
339011
|
+
const normalizedError = normalizeSearchError(error2);
|
|
339012
|
+
searchErrorCode.value = normalizedError.code;
|
|
339013
|
+
searchErrorMessage.value = error2 instanceof MapSearchError ? normalizedError.userMessage : resolveMessage(
|
|
339014
|
+
(_a2 = props.config.messages) == null ? void 0 : _a2.searchFailed,
|
|
339015
|
+
{
|
|
339016
|
+
query,
|
|
339017
|
+
provider: normalizedError.provider,
|
|
339018
|
+
error: error2,
|
|
339019
|
+
code: normalizedError.code
|
|
339020
|
+
},
|
|
339021
|
+
normalizedError.userMessage
|
|
339022
|
+
);
|
|
339023
|
+
emit("search-error", normalizedError);
|
|
338779
339024
|
} finally {
|
|
338780
339025
|
isLoading.value = false;
|
|
338781
339026
|
}
|
|
@@ -338785,7 +339030,6 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338785
339030
|
showResults.value = false;
|
|
338786
339031
|
selectedIndex.value = -1;
|
|
338787
339032
|
addToHistory(result);
|
|
338788
|
-
debugger;
|
|
338789
339033
|
emit("select", result);
|
|
338790
339034
|
};
|
|
338791
339035
|
const selectHistoryItem = (item) => {
|
|
@@ -338848,12 +339092,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338848
339092
|
const updateResults = (results) => {
|
|
338849
339093
|
searchResults.value = results;
|
|
338850
339094
|
isLoading.value = false;
|
|
339095
|
+
searchErrorMessage.value = "";
|
|
339096
|
+
searchErrorCode.value = "";
|
|
338851
339097
|
};
|
|
338852
339098
|
const clearResults = () => {
|
|
338853
339099
|
searchResults.value = [];
|
|
338854
339100
|
searchQuery.value = "";
|
|
338855
339101
|
showResults.value = false;
|
|
338856
339102
|
selectedIndex.value = -1;
|
|
339103
|
+
searchErrorMessage.value = "";
|
|
339104
|
+
searchErrorCode.value = "";
|
|
338857
339105
|
emit("clear");
|
|
338858
339106
|
};
|
|
338859
339107
|
onMounted(() => {
|
|
@@ -338871,6 +339119,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338871
339119
|
(newConfig) => {
|
|
338872
339120
|
searchService2.updateConfig(newConfig);
|
|
338873
339121
|
searchResults.value = [];
|
|
339122
|
+
searchErrorMessage.value = "";
|
|
339123
|
+
searchErrorCode.value = "";
|
|
338874
339124
|
selectedIndex.value = -1;
|
|
338875
339125
|
console.log("MapSearch配置已更新:", newConfig);
|
|
338876
339126
|
},
|
|
@@ -338965,15 +339215,15 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
338965
339215
|
showHistory.value && searchHistory.value.length > 0 && !searchQuery.value ? (openBlock(), createElementBlock("div", _hoisted_3$j, [
|
|
338966
339216
|
renderSlot(_ctx.$slots, "history-title", { clearHistory }, () => [
|
|
338967
339217
|
createElementVNode("div", _hoisted_4$h, [
|
|
338968
|
-
|
|
339218
|
+
createElementVNode("span", null, toDisplayString(historyTitleText.value), 1),
|
|
338969
339219
|
createVNode$1(unref(ElButton), {
|
|
338970
339220
|
link: "",
|
|
338971
339221
|
size: "small",
|
|
338972
339222
|
onClick: clearHistory
|
|
338973
339223
|
}, {
|
|
338974
|
-
default: withCtx(() => [
|
|
338975
|
-
createTextVNode(
|
|
338976
|
-
])
|
|
339224
|
+
default: withCtx(() => [
|
|
339225
|
+
createTextVNode(toDisplayString(clearHistoryText.value), 1)
|
|
339226
|
+
]),
|
|
338977
339227
|
_: 1
|
|
338978
339228
|
})
|
|
338979
339229
|
])
|
|
@@ -339010,7 +339260,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
339010
339260
|
resultsCount: searchResults.value.length
|
|
339011
339261
|
}, () => [
|
|
339012
339262
|
searchQuery.value ? (openBlock(), createElementBlock("div", _hoisted_10$9, [
|
|
339013
|
-
|
|
339263
|
+
createElementVNode("span", null, toDisplayString(resultsTitleText.value), 1),
|
|
339014
339264
|
createElementVNode("span", _hoisted_11$7, "(" + toDisplayString(searchResults.value.length) + ")", 1)
|
|
339015
339265
|
])) : createCommentVNode("", true)
|
|
339016
339266
|
]),
|
|
@@ -339052,19 +339302,35 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
339052
339302
|
]);
|
|
339053
339303
|
}), 128))
|
|
339054
339304
|
])) : createCommentVNode("", true),
|
|
339305
|
+
renderSlot(_ctx.$slots, "search-error", {
|
|
339306
|
+
searchQuery: searchQuery.value,
|
|
339307
|
+
errorMessage: searchErrorMessage.value,
|
|
339308
|
+
errorCode: searchErrorCode.value,
|
|
339309
|
+
isLoading: isLoading.value
|
|
339310
|
+
}, () => [
|
|
339311
|
+
searchErrorMessage.value && !isLoading.value ? (openBlock(), createElementBlock("div", _hoisted_18$2, [
|
|
339312
|
+
createVNode$1(unref(ElIcon), null, {
|
|
339313
|
+
default: withCtx(() => [
|
|
339314
|
+
createVNode$1(unref(InfoFilled))
|
|
339315
|
+
]),
|
|
339316
|
+
_: 1
|
|
339317
|
+
}),
|
|
339318
|
+
createElementVNode("span", null, toDisplayString(searchErrorMessage.value), 1)
|
|
339319
|
+
])) : createCommentVNode("", true)
|
|
339320
|
+
]),
|
|
339055
339321
|
renderSlot(_ctx.$slots, "no-results", {
|
|
339056
339322
|
searchQuery: searchQuery.value,
|
|
339057
339323
|
searchResults: searchResults.value,
|
|
339058
339324
|
isLoading: isLoading.value
|
|
339059
339325
|
}, () => [
|
|
339060
|
-
searchQuery.value && searchResults.value.length === 0 && !isLoading.value ? (openBlock(), createElementBlock("div",
|
|
339326
|
+
searchQuery.value && searchResults.value.length === 0 && !isLoading.value && !searchErrorMessage.value ? (openBlock(), createElementBlock("div", _hoisted_19$2, [
|
|
339061
339327
|
createVNode$1(unref(ElIcon), null, {
|
|
339062
339328
|
default: withCtx(() => [
|
|
339063
339329
|
createVNode$1(unref(InfoFilled))
|
|
339064
339330
|
]),
|
|
339065
339331
|
_: 1
|
|
339066
339332
|
}),
|
|
339067
|
-
|
|
339333
|
+
createElementVNode("span", null, toDisplayString(noResultsText.value), 1)
|
|
339068
339334
|
])) : createCommentVNode("", true)
|
|
339069
339335
|
])
|
|
339070
339336
|
])
|
|
@@ -352437,7 +352703,7 @@ function(t3) {
|
|
|
352437
352703
|
*/
|
|
352438
352704
|
function(t3) {
|
|
352439
352705
|
function e8() {
|
|
352440
|
-
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-
|
|
352706
|
+
return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-320e524d.mjs")).catch(function(t4) {
|
|
352441
352707
|
return Promise.reject(new Error("Could not load canvg: " + t4));
|
|
352442
352708
|
}).then(function(t4) {
|
|
352443
352709
|
return t4.default ? t4.default : t4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, computed, ref, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, Fragment, renderList, createElementVNode, normalizeClass, toDisplayString, unref, createTextVNode, createCommentVNode, createBlock } from "vue";
|
|
2
2
|
import { Close } from "@element-plus/icons-vue";
|
|
3
|
-
import { b as _export_sfc, D as DrawingManager, X } from "./index-
|
|
3
|
+
import { b as _export_sfc, D as DrawingManager, X } from "./index-58704a25.mjs";
|
|
4
4
|
import "ol";
|
|
5
5
|
import "proj4";
|
|
6
6
|
import "@supermapgis/iclient-ol";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-
|
|
1
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs, _ as _asyncToGenerator, a as _defineProperty } from "./index-58704a25.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-
|
|
1
|
+
import { ad, a0, K, O, a4, D, aA, a9, ac, aF, aE, ak, al, aw, ax, Y, am, an, aD, aB, $, Z, ay, az, B, E, F, A, J, y, C, z, G, au, av, as, at, aq, ar, x, s, q, w, O as O2, p, u, v, ae, af, ai, aj, ao, ap, aG, N, ag, ah, U, ab, a1, a5, a8, Q, f, W, aa, a6, a2, a3, aC, P, a7, l, S, r, R } from "./index-58704a25.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "@element-plus/icons-vue";
|
|
4
4
|
import "ol";
|