vue-openlayers-plugin 1.2.5 → 1.2.7

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.
Files changed (29) hide show
  1. package/lib/{BasemapPanel-c74c3819.mjs → BasemapPanel-ebe413da.mjs} +1 -1
  2. package/lib/{CoordinateLocationDialog-4e8ce1ff.mjs → CoordinateLocationDialog-ba72d9ea.mjs} +1 -1
  3. package/lib/{MapPrintDialog-d472ac5b.mjs → FilterPanel-22070c3b.mjs} +1 -1
  4. package/lib/{FilterPanel-af354b93.mjs → LayerPanel-1398051d.mjs} +1 -1
  5. package/lib/{LayerPanel-bc36c426.mjs → MapPrintDialog-d071ff8b.mjs} +1 -1
  6. package/lib/{MeasurementDialog-aab00e44.mjs → MeasurementDialog-e078d1c1.mjs} +1 -1
  7. package/lib/{MyMarkersDialog-73bbc54e.mjs → MyMarkersDialog-e0441cb0.mjs} +1 -1
  8. package/lib/{QuadCompareDialog-07ae0711.mjs → QuadCompareDialog-b6315ab1.mjs} +1 -1
  9. package/lib/{RegionNavigationDialog-095d3280.mjs → RegionNavigationDialog-d533c521.mjs} +1 -1
  10. package/lib/{SplitCompareDialog-5cff9362.mjs → SplitCompareDialog-2d49fbc6.mjs} +1 -1
  11. package/lib/{SwipeCompareDialog-1d9a0af3.mjs → SwipeCompareDialog-50dfd6b1.mjs} +1 -1
  12. package/lib/{ViewBookmarksDialog-17a8ba20.mjs → ViewBookmarksDialog-8c3f5a5b.mjs} +1 -1
  13. package/lib/{index-9a3b8ffa.mjs → index-b7a615a7.mjs} +232 -42
  14. package/lib/{index-37fe6cc1.mjs → index-ee2fa791.mjs} +1 -1
  15. package/lib/{index.es-eff5b793.mjs → index.es-dcd9031f.mjs} +1 -1
  16. package/lib/index.esm.js +1 -1
  17. package/lib/index.umd.js +218 -28
  18. package/lib/style.css +33 -26
  19. package/package.json +1 -1
  20. package/types/components/OlControlPanel.vue.d.ts +3 -1
  21. package/types/components/OlControlPanel.vue.d.ts.map +1 -1
  22. package/types/components/OlMap.vue.d.ts +3 -1
  23. package/types/components/OlMap.vue.d.ts.map +1 -1
  24. package/types/core/drawing/DrawingManager.d.ts +4 -0
  25. package/types/core/drawing/DrawingManager.d.ts.map +1 -1
  26. package/types/lowcode-entry.d.ts +5 -0
  27. package/types/lowcode-entry.d.ts.map +1 -1
  28. package/types/types/map.d.ts +20 -0
  29. package/types/types/map.d.ts.map +1 -1
package/lib/index.umd.js CHANGED
@@ -51540,6 +51540,12 @@ ${this.attributes_.map(
51540
51540
  if (interaction === this._drawInteraction || interaction === this._selectInteraction || interaction === this._modifyInteraction || interaction === this._snapInteraction) {
51541
51541
  return;
51542
51542
  }
51543
+ if (!enable && this.shouldKeepInteractionActiveDuringDrawing(interaction)) {
51544
+ if (interaction.setActive) {
51545
+ interaction.setActive(true);
51546
+ }
51547
+ return;
51548
+ }
51543
51549
  if (interaction.setActive) {
51544
51550
  interaction.setActive(enable);
51545
51551
  }
@@ -51547,6 +51553,12 @@ ${this.attributes_.map(
51547
51553
  this.toggleMapEventListeners(enable);
51548
51554
  console.log(`地图其他交互已${enable ? "启用" : "禁用"}`);
51549
51555
  }
51556
+ /**
51557
+ * 判断绘制期间是否需要保留地图交互
51558
+ */
51559
+ shouldKeepInteractionActiveDuringDrawing(interaction) {
51560
+ return interaction instanceof MouseWheelZoom$1 || interaction instanceof PinchZoom$1;
51561
+ }
51550
51562
  /**
51551
51563
  * 控制地图事件监听器的启用/禁用
51552
51564
  */
@@ -335083,7 +335095,7 @@ ${indentData}`);
335083
335095
  };
335084
335096
  const _hoisted_12$b = ["onClick"];
335085
335097
  const _hoisted_13$a = ["src", "alt"];
335086
- const _hoisted_14$7 = {
335098
+ const _hoisted_14$8 = {
335087
335099
  key: 3,
335088
335100
  class: "slideshow-controls"
335089
335101
  };
@@ -335299,7 +335311,7 @@ ${indentData}`);
335299
335311
  ], 10, _hoisted_12$b);
335300
335312
  }), 128))
335301
335313
  ])) : vue.createCommentVNode("", true),
335302
- _ctx.config.slideshow && imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$7, [
335314
+ _ctx.config.slideshow && imageList.value.length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$8, [
335303
335315
  vue.createVNode(vue.unref(elementPlus.ElButton), {
335304
335316
  class: vue.normalizeClass(["slideshow-btn", { active: isSlideshow.value }]),
335305
335317
  type: isSlideshow.value ? "primary" : "default",
@@ -335381,7 +335393,7 @@ ${indentData}`);
335381
335393
  class: "sort-indicator"
335382
335394
  };
335383
335395
  const _hoisted_13$9 = ["onClick"];
335384
- const _hoisted_14$6 = { key: 0 };
335396
+ const _hoisted_14$7 = { key: 0 };
335385
335397
  const _hoisted_15$5 = ["src", "alt"];
335386
335398
  const _hoisted_16$5 = { key: 1 };
335387
335399
  const _hoisted_17$5 = ["href"];
@@ -335664,7 +335676,7 @@ ${indentData}`);
335664
335676
  return vue.openBlock(), vue.createElementBlock("td", {
335665
335677
  key: field.key
335666
335678
  }, [
335667
- field.type === "image" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$6, [
335679
+ field.type === "image" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14$7, [
335668
335680
  vue.createElementVNode("img", {
335669
335681
  src: getFieldValue(item, field.key || field.name),
335670
335682
  alt: field.label,
@@ -339189,7 +339201,7 @@ ${indentData}`);
339189
339201
  const _hoisted_11$b = { class: "result-count" };
339190
339202
  const _hoisted_12$9 = ["onClick"];
339191
339203
  const _hoisted_13$8 = { class: "item-content" };
339192
- const _hoisted_14$5 = ["innerHTML"];
339204
+ const _hoisted_14$6 = ["innerHTML"];
339193
339205
  const _hoisted_15$4 = ["innerHTML"];
339194
339206
  const _hoisted_16$4 = {
339195
339207
  key: 0,
@@ -339720,7 +339732,7 @@ ${indentData}`);
339720
339732
  vue.createElementVNode("div", {
339721
339733
  class: "item-name",
339722
339734
  innerHTML: highlightText(result.name, searchQuery.value)
339723
- }, null, 8, _hoisted_14$5),
339735
+ }, null, 8, _hoisted_14$6),
339724
339736
  vue.createElementVNode("div", {
339725
339737
  class: "item-address",
339726
339738
  innerHTML: highlightText(result.address, searchQuery.value)
@@ -339909,17 +339921,21 @@ ${indentData}`);
339909
339921
  const _hoisted_9$c = { class: "drawing-tool-list" };
339910
339922
  const _hoisted_10$c = {
339911
339923
  key: 0,
339912
- class: "drawing-menu-divider"
339924
+ class: "drawing-import-row"
339913
339925
  };
339914
339926
  const _hoisted_11$a = {
339915
339927
  key: 1,
339916
- class: "drawing-toggle-row"
339928
+ class: "drawing-menu-divider"
339917
339929
  };
339918
339930
  const _hoisted_12$8 = {
339931
+ key: 2,
339932
+ class: "drawing-toggle-row"
339933
+ };
339934
+ const _hoisted_13$7 = {
339919
339935
  key: 7,
339920
339936
  class: "control-divider"
339921
339937
  };
339922
- const _hoisted_13$7 = {
339938
+ const _hoisted_14$5 = {
339923
339939
  key: 8,
339924
339940
  class: "control-section"
339925
339941
  };
@@ -339935,7 +339951,7 @@ ${indentData}`);
339935
339951
  bottomOffset: {},
339936
339952
  viewBookmarks: {}
339937
339953
  },
339938
- emits: ["drawing-complete", "drawing-clear"],
339954
+ emits: ["drawing-complete", "drawing-clear", "drawing-import"],
339939
339955
  setup(__props, { expose: __expose, emit: __emit }) {
339940
339956
  const props = __props;
339941
339957
  const emit = __emit;
@@ -340063,7 +340079,7 @@ ${indentData}`);
340063
340079
  return !!((tools == null ? void 0 : tools.viewBookmarks) || props.config.viewBookmarks);
340064
340080
  });
340065
340081
  const drawingControlConfig = vue.computed(() => {
340066
- var _a2;
340082
+ var _a2, _b2, _c2, _d;
340067
340083
  const rawConfig = ((_a2 = props.config.tools) == null ? void 0 : _a2.drawing) ?? props.config.drawing;
340068
340084
  if (rawConfig === false) {
340069
340085
  return {
@@ -340071,8 +340087,15 @@ ${indentData}`);
340071
340087
  trigger: "hover",
340072
340088
  continuous: false,
340073
340089
  showContinuousToggle: true,
340090
+ showImportButton: false,
340091
+ importOptions: {
340092
+ clearBeforeImport: false,
340093
+ fitToImported: true,
340094
+ accept: ".json,.geojson"
340095
+ },
340074
340096
  tools: DEFAULT_DRAWING_TOOLS,
340075
- onDrawEnd: void 0
340097
+ onDrawEnd: void 0,
340098
+ onImportEnd: void 0
340076
340099
  };
340077
340100
  }
340078
340101
  if (rawConfig === true || rawConfig === void 0) {
@@ -340081,8 +340104,15 @@ ${indentData}`);
340081
340104
  trigger: "hover",
340082
340105
  continuous: false,
340083
340106
  showContinuousToggle: true,
340107
+ showImportButton: false,
340108
+ importOptions: {
340109
+ clearBeforeImport: false,
340110
+ fitToImported: true,
340111
+ accept: ".json,.geojson"
340112
+ },
340084
340113
  tools: DEFAULT_DRAWING_TOOLS,
340085
- onDrawEnd: void 0
340114
+ onDrawEnd: void 0,
340115
+ onImportEnd: void 0
340086
340116
  };
340087
340117
  }
340088
340118
  const config = rawConfig;
@@ -340094,8 +340124,15 @@ ${indentData}`);
340094
340124
  trigger: config.trigger || "hover",
340095
340125
  continuous: config.continuous ?? false,
340096
340126
  showContinuousToggle: config.showContinuousToggle !== false,
340127
+ showImportButton: config.showImportButton === true,
340128
+ importOptions: {
340129
+ clearBeforeImport: ((_b2 = config.importOptions) == null ? void 0 : _b2.clearBeforeImport) ?? false,
340130
+ fitToImported: ((_c2 = config.importOptions) == null ? void 0 : _c2.fitToImported) ?? true,
340131
+ accept: ((_d = config.importOptions) == null ? void 0 : _d.accept) || ".json,.geojson"
340132
+ },
340097
340133
  tools: tools.length > 0 ? Array.from(new Set(tools)) : DEFAULT_DRAWING_TOOLS,
340098
- onDrawEnd: config.onDrawEnd
340134
+ onDrawEnd: config.onDrawEnd,
340135
+ onImportEnd: config.onImportEnd
340099
340136
  };
340100
340137
  });
340101
340138
  const isDrawingEnabled = vue.computed(() => drawingControlConfig.value.enabled);
@@ -340313,6 +340350,136 @@ ${indentData}`);
340313
340350
  source: "controls"
340314
340351
  };
340315
340352
  };
340353
+ const normalizeImportedGeoJSON = (rawData) => {
340354
+ if (typeof rawData === "string") {
340355
+ const trimmed = rawData.trim();
340356
+ if (!trimmed) {
340357
+ throw new Error("文件内容为空");
340358
+ }
340359
+ return normalizeImportedGeoJSON(
340360
+ JSON.parse(trimmed)
340361
+ );
340362
+ }
340363
+ if (!rawData || typeof rawData !== "object") {
340364
+ throw new Error("仅支持导入 GeoJSON 对象");
340365
+ }
340366
+ const geoJson = rawData;
340367
+ if (geoJson.type === "FeatureCollection" && Array.isArray(geoJson.features)) {
340368
+ return geoJson;
340369
+ }
340370
+ if (geoJson.type === "Feature") {
340371
+ return geoJson;
340372
+ }
340373
+ if ("coordinates" in geoJson && typeof geoJson.type === "string") {
340374
+ return geoJson;
340375
+ }
340376
+ throw new Error("文件不是有效的 GeoJSON 格式");
340377
+ };
340378
+ const collectImportedExtent = (geojson) => {
340379
+ var _a2;
340380
+ if (!currentMap.value)
340381
+ return null;
340382
+ try {
340383
+ const features2 = geoJsonFormat.readFeatures(geojson, {
340384
+ dataProjection: "EPSG:4326",
340385
+ featureProjection: currentMap.value.getView().getProjection()
340386
+ });
340387
+ if (!features2.length) {
340388
+ return null;
340389
+ }
340390
+ let extent3 = (_a2 = features2[0].getGeometry()) == null ? void 0 : _a2.getExtent();
340391
+ if (!extent3) {
340392
+ return null;
340393
+ }
340394
+ for (let i2 = 1; i2 < features2.length; i2 += 1) {
340395
+ const geometry = features2[i2].getGeometry();
340396
+ if (!geometry)
340397
+ continue;
340398
+ const currentExtent = geometry.getExtent();
340399
+ extent3 = [
340400
+ Math.min(extent3[0], currentExtent[0]),
340401
+ Math.min(extent3[1], currentExtent[1]),
340402
+ Math.max(extent3[2], currentExtent[2]),
340403
+ Math.max(extent3[3], currentExtent[3])
340404
+ ];
340405
+ }
340406
+ return extent3;
340407
+ } catch (error2) {
340408
+ console.warn("解析导入图形范围失败:", error2);
340409
+ return null;
340410
+ }
340411
+ };
340412
+ const fitToImportedGeoJSON = (geojson) => {
340413
+ if (!currentMap.value)
340414
+ return;
340415
+ const extent3 = collectImportedExtent(geojson);
340416
+ if (!extent3)
340417
+ return;
340418
+ currentMap.value.getView().fit(extent3, {
340419
+ duration: 500,
340420
+ padding: [30, 30, 30, 30],
340421
+ maxZoom: 18
340422
+ });
340423
+ };
340424
+ const importDrawings = () => {
340425
+ var _a2;
340426
+ const drawingManager = (_a2 = mapManager == null ? void 0 : mapManager.value) == null ? void 0 : _a2.getDrawingManager();
340427
+ if (!drawingManager) {
340428
+ elementPlus.ElMessage.warning("绘制管理器未初始化");
340429
+ return;
340430
+ }
340431
+ const input = document.createElement("input");
340432
+ input.type = "file";
340433
+ input.accept = drawingControlConfig.value.importOptions.accept;
340434
+ input.onchange = (event) => {
340435
+ var _a3;
340436
+ const file = (_a3 = event.target.files) == null ? void 0 : _a3[0];
340437
+ if (!file) {
340438
+ return;
340439
+ }
340440
+ const reader = new FileReader();
340441
+ reader.onload = (loadEvent) => {
340442
+ var _a4, _b2, _c2;
340443
+ try {
340444
+ const parsedGeojson = normalizeImportedGeoJSON(
340445
+ ((_a4 = loadEvent.target) == null ? void 0 : _a4.result) ?? ""
340446
+ );
340447
+ if (drawingControlConfig.value.importOptions.clearBeforeImport) {
340448
+ drawingManager.clearAll();
340449
+ }
340450
+ const drawings = drawingManager.addGeoJSONData(parsedGeojson);
340451
+ if (!drawings.length) {
340452
+ elementPlus.ElMessage.warning("未识别到可导入的图形");
340453
+ return;
340454
+ }
340455
+ if (drawingControlConfig.value.importOptions.fitToImported) {
340456
+ fitToImportedGeoJSON(parsedGeojson);
340457
+ }
340458
+ const result = {
340459
+ fileName: file.name,
340460
+ importedCount: drawings.length,
340461
+ geojson: parsedGeojson,
340462
+ drawings: drawings.map((drawing) => buildDrawingResult(drawing)),
340463
+ source: "controls"
340464
+ };
340465
+ (_c2 = (_b2 = drawingControlConfig.value).onImportEnd) == null ? void 0 : _c2.call(_b2, result);
340466
+ emit("drawing-import", result);
340467
+ elementPlus.ElMessage.success(`成功导入 ${drawings.length} 个图形`);
340468
+ isDrawingMenuOpen.value = false;
340469
+ } catch (error2) {
340470
+ console.error("导入图形失败:", error2);
340471
+ elementPlus.ElMessage.error(
340472
+ error2 instanceof Error ? error2.message : "导入图形失败"
340473
+ );
340474
+ }
340475
+ };
340476
+ reader.onerror = () => {
340477
+ elementPlus.ElMessage.error("读取文件失败");
340478
+ };
340479
+ reader.readAsText(file);
340480
+ };
340481
+ input.click();
340482
+ };
340316
340483
  const cleanupDrawingListeners = () => {
340317
340484
  if (boundDrawingManager && boundDrawingEndHandler && boundModeChangeHandler) {
340318
340485
  boundDrawingManager.off("drawing-end", boundDrawingEndHandler);
@@ -340727,7 +340894,7 @@ ${indentData}`);
340727
340894
  ]),
340728
340895
  default: vue.withCtx(() => [
340729
340896
  vue.createElementVNode("div", _hoisted_8$d, [
340730
- _cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "drawing-menu-title" }, "快捷绘制", -1)),
340897
+ _cache[6] || (_cache[6] = vue.createElementVNode("div", { class: "drawing-menu-title" }, "快捷绘制", -1)),
340731
340898
  vue.createElementVNode("div", _hoisted_9$c, [
340732
340899
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(drawingControlConfig.value.tools, (tool) => {
340733
340900
  return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
@@ -340778,26 +340945,45 @@ ${indentData}`);
340778
340945
  }, 1032, ["content"]);
340779
340946
  }), 128))
340780
340947
  ]),
340781
- drawingControlConfig.value.showContinuousToggle || isDrawingActive.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$c)) : vue.createCommentVNode("", true),
340782
- drawingControlConfig.value.showContinuousToggle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$a, [
340948
+ drawingControlConfig.value.showImportButton ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10$c, [
340949
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
340950
+ size: "small",
340951
+ text: "",
340952
+ class: "drawing-import-btn",
340953
+ onClick: importDrawings
340954
+ }, {
340955
+ default: vue.withCtx(() => [
340956
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
340957
+ default: vue.withCtx(() => [
340958
+ vue.createVNode(vue.unref(iconsVue.Upload))
340959
+ ]),
340960
+ _: 1
340961
+ }),
340962
+ _cache[3] || (_cache[3] = vue.createElementVNode("span", null, "导入图形", -1))
340963
+ ]),
340964
+ _: 1
340965
+ })
340966
+ ])) : vue.createCommentVNode("", true),
340967
+ drawingControlConfig.value.showContinuousToggle || isDrawingActive.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$a)) : vue.createCommentVNode("", true),
340968
+ drawingControlConfig.value.showContinuousToggle ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$8, [
340783
340969
  vue.createVNode(vue.unref(elementPlus.ElCheckbox), {
340784
340970
  modelValue: continuousDrawing.value,
340785
340971
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => continuousDrawing.value = $event)
340786
340972
  }, {
340787
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
340973
+ default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
340788
340974
  vue.createTextVNode(" 是否连续绘制 ", -1)
340789
340975
  ])]),
340790
340976
  _: 1
340791
340977
  }, 8, ["modelValue"])
340792
340978
  ])) : vue.createCommentVNode("", true),
340793
340979
  isDrawingActive.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
340794
- key: 2,
340980
+ key: 3,
340795
340981
  size: "small",
340796
340982
  text: "",
340797
340983
  class: "drawing-stop-btn",
340798
340984
  onClick: stopQuickDrawing
340799
340985
  }, {
340800
- default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
340986
+ default: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
340801
340987
  vue.createTextVNode(" 停止绘制 ", -1)
340802
340988
  ])]),
340803
340989
  _: 1
@@ -340807,8 +340993,8 @@ ${indentData}`);
340807
340993
  _: 1
340808
340994
  }, 8, ["placement", "trigger", "visible", "disabled"])
340809
340995
  ])) : vue.createCommentVNode("", true),
340810
- (((_o2 = _ctx.config.tools) == null ? void 0 : _o2.clearAll) || _ctx.config.clearAll) && (hasOtherTools.value || isDrawingEnabled.value || ((_p = _ctx.config.tools) == null ? void 0 : _p.zoom) || _ctx.config.zoom || ((_q = _ctx.config.tools) == null ? void 0 : _q.rotate) || _ctx.config.rotate) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$8)) : vue.createCommentVNode("", true),
340811
- ((_r2 = _ctx.config.tools) == null ? void 0 : _r2.clearAll) || _ctx.config.clearAll ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$7, [
340996
+ (((_o2 = _ctx.config.tools) == null ? void 0 : _o2.clearAll) || _ctx.config.clearAll) && (hasOtherTools.value || isDrawingEnabled.value || ((_p = _ctx.config.tools) == null ? void 0 : _p.zoom) || _ctx.config.zoom || ((_q = _ctx.config.tools) == null ? void 0 : _q.rotate) || _ctx.config.rotate) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$7)) : vue.createCommentVNode("", true),
340997
+ ((_r2 = _ctx.config.tools) == null ? void 0 : _r2.clearAll) || _ctx.config.clearAll ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$5, [
340812
340998
  vue.createVNode(vue.unref(elementPlus.ElButton), {
340813
340999
  class: "control-btn",
340814
341000
  title: "清空绘制内容",
@@ -340832,8 +341018,8 @@ ${indentData}`);
340832
341018
  };
340833
341019
  }
340834
341020
  });
340835
- const OlControlPanel_vue_vue_type_style_index_0_scoped_2ee216d4_lang = "";
340836
- const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-2ee216d4"]]);
341021
+ const OlControlPanel_vue_vue_type_style_index_0_scoped_5317d890_lang = "";
341022
+ const OlControlPanel = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-5317d890"]]);
340837
341023
  const _hoisted_1$u = {
340838
341024
  key: 0,
340839
341025
  class: "ol-legend-header"
@@ -366118,7 +366304,7 @@ ${indentData}`);
366118
366304
  popupConfig: {},
366119
366305
  enableGeolocation: { type: Boolean, default: true }
366120
366306
  },
366121
- emits: ["map-ready", "map-click", "map-dblclick", "map-contextmenu", "map-move", "zoom-change", "feature-click", "tooltip-show", "tooltip-hide", "layer-change", "measurement-change", "measurement-start", "measurement-end", "measurement-result", "context-menu", "bookmark-action", "marker-action", "tool-action", "drawing-complete", "drawing-clear", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
366307
+ emits: ["map-ready", "map-click", "map-dblclick", "map-contextmenu", "map-move", "zoom-change", "feature-click", "tooltip-show", "tooltip-hide", "layer-change", "measurement-change", "measurement-start", "measurement-end", "measurement-result", "context-menu", "bookmark-action", "marker-action", "tool-action", "drawing-complete", "drawing-clear", "drawing-import", "search", "search-select", "search-clear", "popup-show", "popup-hide", "popup-close"],
366122
366308
  setup(__props, { expose: __expose, emit: __emit }) {
366123
366309
  const currentLegends = vue.ref([]);
366124
366310
  const currentLayers = vue.ref([]);
@@ -366990,6 +367176,9 @@ ${indentData}`);
366990
367176
  const onDrawingClear = (event) => {
366991
367177
  emit("drawing-clear", event);
366992
367178
  };
367179
+ const onDrawingImport = (result) => {
367180
+ emit("drawing-import", result);
367181
+ };
366993
367182
  const onPrintAction = (data2) => {
366994
367183
  console.log("打印操作:", data2);
366995
367184
  switch (data2.action) {
@@ -367678,7 +367867,8 @@ ${indentData}`);
367678
367867
  "bottom-offset": finalControlsConfig.value.bottomOffset,
367679
367868
  "view-bookmarks": props.viewBookmarks,
367680
367869
  onDrawingComplete,
367681
- onDrawingClear
367870
+ onDrawingClear,
367871
+ onDrawingImport
367682
367872
  }, {
367683
367873
  custom: vue.withCtx(({ controls }) => [
367684
367874
  vue.renderSlot(_ctx.$slots, "controls", {
@@ -367815,8 +368005,8 @@ ${indentData}`);
367815
368005
  };
367816
368006
  }
367817
368007
  });
367818
- const OlMap_vue_vue_type_style_index_0_scoped_610dbb17_lang = "";
367819
- const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-610dbb17"]]);
368008
+ const OlMap_vue_vue_type_style_index_0_scoped_984651bc_lang = "";
368009
+ const OlMap = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-984651bc"]]);
367820
368010
  const ol = "";
367821
368011
  const Property$1 = {
367822
368012
  ACCURACY: "accuracy",
package/lib/style.css CHANGED
@@ -888,7 +888,7 @@ to {
888
888
  .position-bottom-right {
889
889
  bottom: 5px;
890
890
  }
891
- }.control-bar[data-v-2ee216d4] {
891
+ }.control-bar[data-v-5317d890] {
892
892
  display: flex;
893
893
  align-items: center;
894
894
  gap: 0;
@@ -901,77 +901,77 @@ to {
901
901
  border: 1px solid var(--el-border-color-light);
902
902
  transition: all 0.3s ease;
903
903
  }
904
- .control-bar[data-v-2ee216d4]:hover {
904
+ .control-bar[data-v-5317d890]:hover {
905
905
  box-shadow: var(--el-box-shadow);
906
906
  border-color: var(--el-border-color-hover);
907
907
  }
908
- .control-bar.flex-col[data-v-2ee216d4] {
908
+ .control-bar.flex-col[data-v-5317d890] {
909
909
  flex-direction: column;
910
910
  width: fit-content;
911
911
  }
912
- .control-bar.flex-row[data-v-2ee216d4] {
912
+ .control-bar.flex-row[data-v-5317d890] {
913
913
  flex-direction: row;
914
914
  height: fit-content;
915
915
  }
916
- .control-section[data-v-2ee216d4] {
916
+ .control-section[data-v-5317d890] {
917
917
  display: flex;
918
918
  align-items: center;
919
919
  justify-content: center;
920
920
  gap: 4px;
921
921
  /* Inherit direction from parent implicitly via flex layout */
922
922
  }
923
- .flex-col .control-section[data-v-2ee216d4] {
923
+ .flex-col .control-section[data-v-5317d890] {
924
924
  flex-direction: column;
925
925
  width: 100%;
926
926
  }
927
- .flex-row .control-section[data-v-2ee216d4] {
927
+ .flex-row .control-section[data-v-5317d890] {
928
928
  flex-direction: row;
929
929
  height: 100%;
930
930
  }
931
- .control-divider[data-v-2ee216d4] {
931
+ .control-divider[data-v-5317d890] {
932
932
  background-color: var(--el-border-color-light);
933
933
  }
934
- .flex-col .control-divider[data-v-2ee216d4] {
934
+ .flex-col .control-divider[data-v-5317d890] {
935
935
  width: 80%;
936
936
  height: 1px;
937
937
  margin: 4px 0;
938
938
  }
939
- .flex-row .control-divider[data-v-2ee216d4] {
939
+ .flex-row .control-divider[data-v-5317d890] {
940
940
  width: 1px;
941
941
  height: 16px; /* Explicit height for horizontal mode */
942
942
  margin: 0 4px;
943
943
  }
944
944
 
945
945
  /* ensure buttons themselves are interactive */
946
- .control-btn[data-v-2ee216d4] {
946
+ .control-btn[data-v-5317d890] {
947
947
  pointer-events: auto;
948
948
  margin: 0 !important; /* Ensure no margin interferes */
949
949
  transition: transform 0.1s;
950
950
  }
951
- .control-btn[data-v-2ee216d4]:active {
951
+ .control-btn[data-v-5317d890]:active {
952
952
  transform: scale(0.95);
953
953
  }
954
954
 
955
955
  /* reset Element Plus button default adjacent margin and use our gap instead */
956
- [data-v-2ee216d4] .el-button + .el-button {
956
+ [data-v-5317d890] .el-button + .el-button {
957
957
  margin-left: 0 !important;
958
958
  }
959
959
 
960
960
  /* make sure all EP interactive widgets are clickable */
961
- [data-v-2ee216d4] .el-button,[data-v-2ee216d4] .el-slider,[data-v-2ee216d4] .el-icon {
961
+ [data-v-5317d890] .el-button,[data-v-5317d890] .el-slider,[data-v-5317d890] .el-icon {
962
962
  pointer-events: auto;
963
963
  }
964
- .drawing-menu-panel-content[data-v-2ee216d4] {
964
+ .drawing-menu-panel-content[data-v-5317d890] {
965
965
  display: flex;
966
966
  flex-direction: column;
967
967
  }
968
- .drawing-menu-title[data-v-2ee216d4] {
968
+ .drawing-menu-title[data-v-5317d890] {
969
969
  margin-bottom: 8px;
970
970
  font-size: 12px;
971
971
  font-weight: 600;
972
972
  color: var(--el-text-color-primary);
973
973
  }
974
- .drawing-tool-list[data-v-2ee216d4] {
974
+ .drawing-tool-list[data-v-5317d890] {
975
975
  display: grid;
976
976
  grid-template-columns: repeat(4, 1fr);
977
977
  gap: 8px;
@@ -979,7 +979,7 @@ to {
979
979
  overflow-y: auto;
980
980
  padding: 4px;
981
981
  }
982
- .drawing-tool-btn[data-v-2ee216d4] {
982
+ .drawing-tool-btn[data-v-5317d890] {
983
983
  width: 32px;
984
984
  height: 32px;
985
985
  margin: 0 !important;
@@ -988,17 +988,24 @@ to {
988
988
  align-items: center;
989
989
  font-size: 16px; /* Icon size */
990
990
  }
991
- .drawing-menu-divider[data-v-2ee216d4] {
991
+ .drawing-import-row[data-v-5317d890] {
992
+ margin-top: 8px;
993
+ }
994
+ .drawing-import-btn[data-v-5317d890] {
995
+ width: 100%;
996
+ justify-content: flex-start;
997
+ }
998
+ .drawing-menu-divider[data-v-5317d890] {
992
999
  height: 1px;
993
1000
  margin: 8px 0;
994
1001
  background: var(--el-border-color-light);
995
1002
  }
996
- .drawing-toggle-row[data-v-2ee216d4] {
1003
+ .drawing-toggle-row[data-v-5317d890] {
997
1004
  display: flex;
998
1005
  align-items: center;
999
1006
  justify-content: space-between;
1000
1007
  }
1001
- .drawing-stop-btn[data-v-2ee216d4] {
1008
+ .drawing-stop-btn[data-v-5317d890] {
1002
1009
  justify-content: flex-start;
1003
1010
  width: 100%;
1004
1011
  margin-top: 6px !important;
@@ -1725,7 +1732,7 @@ label {
1725
1732
  width: 100% !important;
1726
1733
  height: 100% !important;
1727
1734
  }
1728
- .context-menu[data-v-610dbb17] {
1735
+ .context-menu[data-v-984651bc] {
1729
1736
  background: var(--el-bg-color-overlay);
1730
1737
  border: 1px solid var(--el-border-color-light);
1731
1738
  border-radius: var(--el-border-radius-base);
@@ -1734,7 +1741,7 @@ label {
1734
1741
  min-width: 140px;
1735
1742
  overflow: hidden;
1736
1743
  }
1737
- .context-menu .context-menu-item[data-v-610dbb17] {
1744
+ .context-menu .context-menu-item[data-v-984651bc] {
1738
1745
  display: flex;
1739
1746
  align-items: center;
1740
1747
  padding: 8px 16px;
@@ -1743,14 +1750,14 @@ label {
1743
1750
  color: var(--el-text-color-primary);
1744
1751
  transition: all 0.2s;
1745
1752
  }
1746
- .context-menu .context-menu-item[data-v-610dbb17]:hover {
1753
+ .context-menu .context-menu-item[data-v-984651bc]:hover {
1747
1754
  background-color: var(--el-fill-color-light);
1748
1755
  color: var(--el-color-primary);
1749
1756
  }
1750
- .context-menu .context-menu-item:hover .el-icon[data-v-610dbb17] {
1757
+ .context-menu .context-menu-item:hover .el-icon[data-v-984651bc] {
1751
1758
  color: var(--el-color-primary);
1752
1759
  }
1753
- .context-menu .context-menu-item .el-icon[data-v-610dbb17] {
1760
+ .context-menu .context-menu-item .el-icon[data-v-984651bc] {
1754
1761
  margin-right: 8px;
1755
1762
  font-size: 16px;
1756
1763
  color: var(--el-text-color-secondary);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-openlayers-plugin",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "A Vue 3 plugin for OpenLayers with custom components and utilities",
5
5
  "main": "lib/index.umd.js",
6
6
  "module": "lib/index.esm.js",
@@ -1,6 +1,6 @@
1
1
  import { Ref } from 'vue';
2
2
  import { Map } from 'ol';
3
- import { MapControlsConfig, MapControlDrawingClearEvent, MapControlDrawingResult, ViewBookmark } from '../types';
3
+ import { MapControlsConfig, MapControlDrawingClearEvent, MapControlDrawingImportResult, MapControlDrawingResult, ViewBookmark } from '../types';
4
4
 
5
5
  interface Props {
6
6
  config: MapControlsConfig;
@@ -39,12 +39,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
39
39
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
40
40
  "drawing-complete": (result: MapControlDrawingResult) => void;
41
41
  "drawing-clear": (event: MapControlDrawingClearEvent) => void;
42
+ "drawing-import": (result: MapControlDrawingImportResult) => void;
42
43
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
43
44
  position: string;
44
45
  direction: string;
45
46
  }>>> & Readonly<{
46
47
  "onDrawing-complete"?: (result: MapControlDrawingResult) => any;
47
48
  "onDrawing-clear"?: (event: MapControlDrawingClearEvent) => any;
49
+ "onDrawing-import"?: (result: MapControlDrawingImportResult) => any;
48
50
  }>, {
49
51
  position: "bottom-left" | "bottom-right" | "top-left" | "top-right";
50
52
  direction: "horizontal" | "vertical";
@@ -1 +1 @@
1
- {"version":3,"file":"OlControlPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/OlControlPanel.vue"],"names":[],"mappings":"AAmUA;AAsBA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,IAAI,CAAC;AAkB9B,OAAO,KAAK,EACV,iBAAiB,EAEjB,2BAA2B,EAC3B,uBAAuB,EAEvB,YAAY,EACb,MAAM,UAAU,CAAC;AAKlB,UAAU,KAAK;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACrE,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAo2DD,wBAQG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAA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
3
  import { PopupManager, PopupConfig, PopupType, PopupManagerConfig } from './OlMapPopup';
4
4
  import { GeoJSONInput } from '../core/geoJsonLocationTool';
5
- import { MapConfig, LayerConfig, LegendConfig, MeasurementResult, MapEventCallbacks, MapClickEvent, TooltipTemplate, TooltipData, SearchResult, FeatureInput, LayerInput, MapControlsConfig, MapControlDrawingClearEvent, MapControlDrawingResult, MapSearchConfig, ViewBookmark, BookmarkAction } from '../types';
5
+ import { MapConfig, LayerConfig, LegendConfig, MeasurementResult, MapEventCallbacks, MapClickEvent, TooltipTemplate, TooltipData, SearchResult, FeatureInput, LayerInput, MapControlsConfig, MapControlDrawingClearEvent, MapControlDrawingImportResult, MapControlDrawingResult, MapSearchConfig, ViewBookmark, BookmarkAction } from '../types';
6
6
  import { DrawingManagerConfig } from '../core/drawing/DrawingManager';
7
7
 
8
8
  interface Props {
@@ -238,6 +238,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
238
238
  "tool-action": (data: Record<string, any>) => void;
239
239
  "drawing-complete": (result: MapControlDrawingResult) => void;
240
240
  "drawing-clear": (event: MapControlDrawingClearEvent) => void;
241
+ "drawing-import": (result: MapControlDrawingImportResult) => void;
241
242
  search: (query: string) => void;
242
243
  "search-select": (result: SearchResult) => void;
243
244
  "search-clear": () => void;
@@ -283,6 +284,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<im
283
284
  "onBookmark-action"?: (data: BookmarkAction) => any;
284
285
  "onDrawing-complete"?: (result: MapControlDrawingResult) => any;
285
286
  "onDrawing-clear"?: (event: MapControlDrawingClearEvent) => any;
287
+ "onDrawing-import"?: (result: MapControlDrawingImportResult) => any;
286
288
  "onTool-action"?: (data: Record<string, any>) => any;
287
289
  "onMap-dblclick"?: (event: MapClickEvent) => any;
288
290
  "onMap-contextmenu"?: (event: MapClickEvent) => any;