vue-openlayers-plugin 1.0.70 → 1.0.72

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.
@@ -464802,30 +464802,6 @@ class TileSuperMapRestHandler extends BaseLayer$2 {
464802
464802
  (_a3 = source.setExtent) == null ? void 0 : _a3.call(source, options.extent);
464803
464803
  }
464804
464804
  source.changed();
464805
- if (this.map) {
464806
- const view = this.map.getView();
464807
- const resolutions = options.tileGrid.getResolutions();
464808
- if (view && resolutions && resolutions.length) {
464809
- const currentRes = view.getResolution();
464810
- if (typeof currentRes === "number") {
464811
- let nearest = resolutions[0];
464812
- let minDiff = Math.abs(currentRes - nearest);
464813
- for (let i = 1; i < resolutions.length; i++) {
464814
- const diff = Math.abs(currentRes - resolutions[i]);
464815
- if (diff < minDiff) {
464816
- minDiff = diff;
464817
- nearest = resolutions[i];
464818
- }
464819
- }
464820
- view.setResolution(nearest);
464821
- } else {
464822
- const zoom = view.getZoom();
464823
- if (typeof zoom === "number") {
464824
- view.setZoom(Math.round(zoom));
464825
- }
464826
- }
464827
- }
464828
- }
464829
464805
  } else {
464830
464806
  console.warn("从map.json中未能获取到有效的tileGrid配置");
464831
464807
  }
@@ -466767,6 +466743,22 @@ class LayerManager {
466767
466743
  if (this.pendingLayerConfigs.has(layerId)) {
466768
466744
  this.pendingLayerConfigs.set(layerId, config);
466769
466745
  }
466746
+ if (visible) {
466747
+ const layer2 = handler.getLayer();
466748
+ const animCfg = config.locationAnimation;
466749
+ if (animCfg && animCfg.enabled) {
466750
+ this.handleLocationAnimation(layer2, config);
466751
+ } else if (config.fitToExtent) {
466752
+ const defaultAnim = {
466753
+ enabled: true,
466754
+ duration: 1e3,
466755
+ easing: "ease-out",
466756
+ maxZoom: 16,
466757
+ padding: [50, 50, 50, 50]
466758
+ };
466759
+ this.performLocationAnimation(layer2, config, defaultAnim);
466760
+ }
466761
+ }
466770
466762
  this.eventBus.emit("layer-visibility-changed", {
466771
466763
  layerId,
466772
466764
  visible,
@@ -467177,6 +467169,7 @@ class LayerManager {
467177
467169
  if (!handler || !config || !config.visible) {
467178
467170
  continue;
467179
467171
  }
467172
+ debugger;
467180
467173
  try {
467181
467174
  if (config.type === "TileSuperMapRest" || config.type === "tilesupermaprest" || config.type === "TILESUPERMAPREST") {
467182
467175
  if ("getFeatureInfoAtCoordinate" in handler) {
@@ -467561,13 +467554,15 @@ class FeatureHighlightManager {
467561
467554
  this.map.removeLayer(this.highlightLayer);
467562
467555
  }
467563
467556
  }
467557
+ const _hoisted_1$p = ["id"];
467564
467558
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
467565
467559
  __name: "BasePopup",
467566
467560
  props: {
467567
467561
  config: {},
467568
467562
  coordinate: {},
467569
467563
  feature: {},
467570
- visible: { type: Boolean, default: false }
467564
+ visible: { type: Boolean, default: false },
467565
+ id: {}
467571
467566
  },
467572
467567
  emits: ["close", "show", "hide", "content-change"],
467573
467568
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -467676,6 +467671,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
467676
467671
  ref_key: "contentElement",
467677
467672
  ref: contentElement
467678
467673
  }, [
467674
+ createElementVNode("div", {
467675
+ id: `popup-slot-${_ctx.id}`
467676
+ }, null, 8, _hoisted_1$p),
467679
467677
  renderSlot(_ctx.$slots, "default", {
467680
467678
  feature: _ctx.feature,
467681
467679
  coordinate: _ctx.coordinate,
@@ -467702,7 +467700,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
467702
467700
  config: {},
467703
467701
  coordinate: {},
467704
467702
  feature: {},
467705
- visible: { type: Boolean, default: false }
467703
+ visible: { type: Boolean, default: false },
467704
+ id: {}
467706
467705
  },
467707
467706
  emits: ["close", "show", "hide"],
467708
467707
  setup(__props, { emit: __emit }) {
@@ -467748,6 +467747,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
467748
467747
  coordinate: _ctx.coordinate,
467749
467748
  feature: _ctx.feature,
467750
467749
  visible: _ctx.visible,
467750
+ id: _ctx.id,
467751
467751
  onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")),
467752
467752
  onShow: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("show")),
467753
467753
  onHide: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
@@ -467765,7 +467765,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
467765
467765
  ];
467766
467766
  }),
467767
467767
  _: 1
467768
- }, 8, ["config", "coordinate", "feature", "visible"]);
467768
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
467769
467769
  };
467770
467770
  }
467771
467771
  });
@@ -467815,7 +467815,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
467815
467815
  config: {},
467816
467816
  coordinate: {},
467817
467817
  feature: {},
467818
- visible: { type: Boolean, default: false }
467818
+ visible: { type: Boolean, default: false },
467819
+ id: {}
467819
467820
  },
467820
467821
  emits: ["close", "show", "hide"],
467821
467822
  setup(__props, { emit: __emit }) {
@@ -467946,6 +467947,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
467946
467947
  coordinate: _ctx.coordinate,
467947
467948
  feature: _ctx.feature,
467948
467949
  visible: _ctx.visible,
467950
+ id: _ctx.id,
467949
467951
  onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close")),
467950
467952
  onShow: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("show")),
467951
467953
  onHide: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("hide"))
@@ -468057,7 +468059,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
468057
468059
  ])) : createCommentVNode("", true)
468058
468060
  ]),
468059
468061
  _: 1
468060
- }, 8, ["config", "coordinate", "feature", "visible"]);
468062
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
468061
468063
  };
468062
468064
  }
468063
468065
  });
@@ -468144,7 +468146,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
468144
468146
  config: {},
468145
468147
  coordinate: {},
468146
468148
  feature: {},
468147
- visible: { type: Boolean, default: false }
468149
+ visible: { type: Boolean, default: false },
468150
+ id: {}
468148
468151
  },
468149
468152
  emits: ["close", "show", "hide", "rowClick"],
468150
468153
  setup(__props, { emit: __emit }) {
@@ -468288,6 +468291,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
468288
468291
  coordinate: _ctx.coordinate,
468289
468292
  feature: _ctx.feature,
468290
468293
  visible: _ctx.visible,
468294
+ id: _ctx.id,
468291
468295
  onClose: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("close")),
468292
468296
  onShow: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("show")),
468293
468297
  onHide: _cache[8] || (_cache[8] = ($event) => _ctx.$emit("hide"))
@@ -468492,7 +468496,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
468492
468496
  ])
468493
468497
  ]),
468494
468498
  _: 1
468495
- }, 8, ["config", "coordinate", "feature", "visible"]);
468499
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
468496
468500
  };
468497
468501
  }
468498
468502
  });
@@ -468708,7 +468712,8 @@ class PopupManager {
468708
468712
  }
468709
468713
  },
468710
468714
  positioning: "bottom-center",
468711
- stopEvent: false,
468715
+ // 关键:阻止来自popup的事件传递到地图,避免点击关闭按钮触发地图单击
468716
+ stopEvent: true,
468712
468717
  offset: [0, -10]
468713
468718
  });
468714
468719
  let component = null;
@@ -468716,6 +468721,7 @@ class PopupManager {
468716
468721
  switch (type) {
468717
468722
  case "html":
468718
468723
  app = createApp(_sfc_main$p, {
468724
+ id: popupId,
468719
468725
  config: { ...this.config.defaultConfig, ...config },
468720
468726
  coordinate,
468721
468727
  feature: feature2,
@@ -468725,6 +468731,7 @@ class PopupManager {
468725
468731
  break;
468726
468732
  case "image":
468727
468733
  app = createApp(_sfc_main$o, {
468734
+ id: popupId,
468728
468735
  config: { ...this.config.defaultConfig, ...config },
468729
468736
  coordinate,
468730
468737
  feature: feature2,
@@ -468734,6 +468741,7 @@ class PopupManager {
468734
468741
  break;
468735
468742
  case "array":
468736
468743
  app = createApp(_sfc_main$n, {
468744
+ id: popupId,
468737
468745
  config: { ...this.config.defaultConfig, ...config },
468738
468746
  coordinate,
468739
468747
  feature: feature2,
@@ -468749,6 +468757,7 @@ class PopupManager {
468749
468757
  const allConfig = config;
468750
468758
  if (allConfig.htmlContent) {
468751
468759
  app = createApp(_sfc_main$p, {
468760
+ id: popupId,
468752
468761
  config: {
468753
468762
  ...allConfig,
468754
468763
  content: allConfig.htmlContent
@@ -468760,6 +468769,7 @@ class PopupManager {
468760
468769
  });
468761
468770
  } else if (allConfig.images) {
468762
468771
  app = createApp(_sfc_main$o, {
468772
+ id: popupId,
468763
468773
  config: {
468764
468774
  ...allConfig,
468765
468775
  images: allConfig.images
@@ -468771,6 +468781,7 @@ class PopupManager {
468771
468781
  });
468772
468782
  } else if (allConfig.data) {
468773
468783
  app = createApp(_sfc_main$n, {
468784
+ id: popupId,
468774
468785
  config: {
468775
468786
  ...allConfig,
468776
468787
  data: allConfig.data
@@ -468786,6 +468797,7 @@ class PopupManager {
468786
468797
  });
468787
468798
  } else {
468788
468799
  app = createApp(_sfc_main$q, {
468800
+ id: popupId,
468789
468801
  config: allConfig,
468790
468802
  coordinate,
468791
468803
  feature: feature2,
@@ -468794,6 +468806,28 @@ class PopupManager {
468794
468806
  });
468795
468807
  }
468796
468808
  break;
468809
+ case "custom": {
468810
+ const customConfig = config;
468811
+ const CustomComp = customConfig.component;
468812
+ const computedProps = typeof customConfig.props === "function" ? customConfig.props(feature2, coordinate) : customConfig.props || {};
468813
+ const cfg = { ...this.config.defaultConfig, ...customConfig };
468814
+ const onClose = () => this.closePopup(popupId);
468815
+ const Root = defineComponent({
468816
+ name: "CustomPopupRoot",
468817
+ setup() {
468818
+ return { cfg, coordinate, feature: feature2, CustomComp, computedProps, onClose };
468819
+ },
468820
+ render() {
468821
+ return h$4(
468822
+ _sfc_main$q,
468823
+ { config: this.cfg, coordinate: this.coordinate, feature: this.feature, visible: true, id: popupId, onClose: this.onClose },
468824
+ { default: () => h$4(this.CustomComp, { ...this.computedProps, feature: this.feature, coordinate: this.coordinate, config: this.cfg }) }
468825
+ );
468826
+ }
468827
+ });
468828
+ app = createApp(Root);
468829
+ break;
468830
+ }
468797
468831
  default:
468798
468832
  console.error(`不支持的 popup 类型: ${type}`);
468799
468833
  return null;
@@ -468822,24 +468856,26 @@ class PopupManager {
468822
468856
  * 显示 popup
468823
468857
  */
468824
468858
  showPopup(popup) {
468825
- var _a3, _b3;
468859
+ var _a3, _b3, _c2, _d;
468826
468860
  this.map.addOverlay(popup.overlay);
468827
468861
  popup.overlay.setPosition(popup.coordinate);
468828
468862
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onShow) == null ? void 0 : _b3.call(_a3);
468863
+ (_d = (_c2 = this.config).onShow) == null ? void 0 : _d.call(_c2, popup.id, popup.config, popup.feature, popup.coordinate);
468829
468864
  }
468830
468865
  /**
468831
468866
  * 隐藏 popup
468832
468867
  */
468833
468868
  hidePopup(popup) {
468834
- var _a3, _b3;
468869
+ var _a3, _b3, _c2, _d;
468835
468870
  this.map.removeOverlay(popup.overlay);
468836
468871
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onHide) == null ? void 0 : _b3.call(_a3);
468872
+ (_d = (_c2 = this.config).onHide) == null ? void 0 : _d.call(_c2, popup.id);
468837
468873
  }
468838
468874
  /**
468839
468875
  * 销毁 popup
468840
468876
  */
468841
468877
  destroyPopup(popup) {
468842
- var _a3, _b3;
468878
+ var _a3, _b3, _c2, _d;
468843
468879
  try {
468844
468880
  if (popup.app) {
468845
468881
  popup.app.unmount();
@@ -468848,6 +468884,7 @@ class PopupManager {
468848
468884
  popup.container.parentNode.removeChild(popup.container);
468849
468885
  }
468850
468886
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onClose) == null ? void 0 : _b3.call(_a3);
468887
+ (_d = (_c2 = this.config).onClose) == null ? void 0 : _d.call(_c2, popup.id);
468851
468888
  } catch (error2) {
468852
468889
  console.error("销毁 popup 失败:", error2);
468853
468890
  }
@@ -481132,7 +481169,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
481132
481169
  }
481133
481170
  return groups;
481134
481171
  });
481135
- const activeTreeType = ref("classification");
481172
+ const activeTreeType = ref("default");
481136
481173
  const classificationGroups = computed(() => {
481137
481174
  zIndexVersion.value;
481138
481175
  const vectorGroup = layerGroups.value.find((g2) => g2.id === "vectorLayers");
@@ -491462,7 +491499,7 @@ function(t3) {
491462
491499
  */
491463
491500
  function(t3) {
491464
491501
  function e8() {
491465
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-60380a58.mjs")).catch(function(t4) {
491502
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-6551e4c0.mjs")).catch(function(t4) {
491466
491503
  return Promise.reject(new Error("Could not load canvg: " + t4));
491467
491504
  }).then(function(t4) {
491468
491505
  return t4.default ? t4.default : t4;
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-5d51e04b.mjs";
1
+ import { c as commonjsGlobal, R as RGBColor, r as requestAnimationFrame, _ as _asyncToGenerator, a as _, p as processCanvasRGBA, b as _defineProperty } from "./index-034c9e0d.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  var check = function(it) {
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-5d51e04b.mjs";
1
+ import { A, B, e, d, D, a2, a3, w, z, a7, a6, I, H, Z, $, L, J, K, a4, j, M, a0, a1, X, Y, U, W, Q, S, P, C, F, G, N, O, a8, f, T, E, V, y, k, q, u, g, m, h, x, s, n, o, a5, i, t, l, v } from "./index-034c9e0d.mjs";
2
2
  import "vue";
3
3
  import "ol";
4
4
  export {
package/lib/index.umd.js CHANGED
@@ -465578,30 +465578,6 @@ ${this.attributes_.map(
465578
465578
  (_a3 = source.setExtent) == null ? void 0 : _a3.call(source, options.extent);
465579
465579
  }
465580
465580
  source.changed();
465581
- if (this.map) {
465582
- const view = this.map.getView();
465583
- const resolutions = options.tileGrid.getResolutions();
465584
- if (view && resolutions && resolutions.length) {
465585
- const currentRes = view.getResolution();
465586
- if (typeof currentRes === "number") {
465587
- let nearest = resolutions[0];
465588
- let minDiff = Math.abs(currentRes - nearest);
465589
- for (let i2 = 1; i2 < resolutions.length; i2++) {
465590
- const diff = Math.abs(currentRes - resolutions[i2]);
465591
- if (diff < minDiff) {
465592
- minDiff = diff;
465593
- nearest = resolutions[i2];
465594
- }
465595
- }
465596
- view.setResolution(nearest);
465597
- } else {
465598
- const zoom = view.getZoom();
465599
- if (typeof zoom === "number") {
465600
- view.setZoom(Math.round(zoom));
465601
- }
465602
- }
465603
- }
465604
- }
465605
465581
  } else {
465606
465582
  console.warn("从map.json中未能获取到有效的tileGrid配置");
465607
465583
  }
@@ -467543,6 +467519,22 @@ ${this.attributes_.map(
467543
467519
  if (this.pendingLayerConfigs.has(layerId)) {
467544
467520
  this.pendingLayerConfigs.set(layerId, config);
467545
467521
  }
467522
+ if (visible) {
467523
+ const layer2 = handler.getLayer();
467524
+ const animCfg = config.locationAnimation;
467525
+ if (animCfg && animCfg.enabled) {
467526
+ this.handleLocationAnimation(layer2, config);
467527
+ } else if (config.fitToExtent) {
467528
+ const defaultAnim = {
467529
+ enabled: true,
467530
+ duration: 1e3,
467531
+ easing: "ease-out",
467532
+ maxZoom: 16,
467533
+ padding: [50, 50, 50, 50]
467534
+ };
467535
+ this.performLocationAnimation(layer2, config, defaultAnim);
467536
+ }
467537
+ }
467546
467538
  this.eventBus.emit("layer-visibility-changed", {
467547
467539
  layerId,
467548
467540
  visible,
@@ -467953,6 +467945,7 @@ ${this.attributes_.map(
467953
467945
  if (!handler || !config || !config.visible) {
467954
467946
  continue;
467955
467947
  }
467948
+ debugger;
467956
467949
  try {
467957
467950
  if (config.type === "TileSuperMapRest" || config.type === "tilesupermaprest" || config.type === "TILESUPERMAPREST") {
467958
467951
  if ("getFeatureInfoAtCoordinate" in handler) {
@@ -468337,13 +468330,15 @@ ${this.attributes_.map(
468337
468330
  this.map.removeLayer(this.highlightLayer);
468338
468331
  }
468339
468332
  }
468333
+ const _hoisted_1$p = ["id"];
468340
468334
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
468341
468335
  __name: "BasePopup",
468342
468336
  props: {
468343
468337
  config: {},
468344
468338
  coordinate: {},
468345
468339
  feature: {},
468346
- visible: { type: Boolean, default: false }
468340
+ visible: { type: Boolean, default: false },
468341
+ id: {}
468347
468342
  },
468348
468343
  emits: ["close", "show", "hide", "content-change"],
468349
468344
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -468452,6 +468447,9 @@ ${this.attributes_.map(
468452
468447
  ref_key: "contentElement",
468453
468448
  ref: contentElement
468454
468449
  }, [
468450
+ vue.createElementVNode("div", {
468451
+ id: `popup-slot-${_ctx.id}`
468452
+ }, null, 8, _hoisted_1$p),
468455
468453
  vue.renderSlot(_ctx.$slots, "default", {
468456
468454
  feature: _ctx.feature,
468457
468455
  coordinate: _ctx.coordinate,
@@ -468479,7 +468477,8 @@ ${this.attributes_.map(
468479
468477
  config: {},
468480
468478
  coordinate: {},
468481
468479
  feature: {},
468482
- visible: { type: Boolean, default: false }
468480
+ visible: { type: Boolean, default: false },
468481
+ id: {}
468483
468482
  },
468484
468483
  emits: ["close", "show", "hide"],
468485
468484
  setup(__props, { emit: __emit }) {
@@ -468525,6 +468524,7 @@ ${this.attributes_.map(
468525
468524
  coordinate: _ctx.coordinate,
468526
468525
  feature: _ctx.feature,
468527
468526
  visible: _ctx.visible,
468527
+ id: _ctx.id,
468528
468528
  onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")),
468529
468529
  onShow: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("show")),
468530
468530
  onHide: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hide"))
@@ -468542,7 +468542,7 @@ ${this.attributes_.map(
468542
468542
  ];
468543
468543
  }),
468544
468544
  _: 1
468545
- }, 8, ["config", "coordinate", "feature", "visible"]);
468545
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
468546
468546
  };
468547
468547
  }
468548
468548
  });
@@ -468593,7 +468593,8 @@ ${this.attributes_.map(
468593
468593
  config: {},
468594
468594
  coordinate: {},
468595
468595
  feature: {},
468596
- visible: { type: Boolean, default: false }
468596
+ visible: { type: Boolean, default: false },
468597
+ id: {}
468597
468598
  },
468598
468599
  emits: ["close", "show", "hide"],
468599
468600
  setup(__props, { emit: __emit }) {
@@ -468724,6 +468725,7 @@ ${this.attributes_.map(
468724
468725
  coordinate: _ctx.coordinate,
468725
468726
  feature: _ctx.feature,
468726
468727
  visible: _ctx.visible,
468728
+ id: _ctx.id,
468727
468729
  onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("close")),
468728
468730
  onShow: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("show")),
468729
468731
  onHide: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("hide"))
@@ -468835,7 +468837,7 @@ ${this.attributes_.map(
468835
468837
  ])) : vue.createCommentVNode("", true)
468836
468838
  ]),
468837
468839
  _: 1
468838
- }, 8, ["config", "coordinate", "feature", "visible"]);
468840
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
468839
468841
  };
468840
468842
  }
468841
468843
  });
@@ -468923,7 +468925,8 @@ ${this.attributes_.map(
468923
468925
  config: {},
468924
468926
  coordinate: {},
468925
468927
  feature: {},
468926
- visible: { type: Boolean, default: false }
468928
+ visible: { type: Boolean, default: false },
468929
+ id: {}
468927
468930
  },
468928
468931
  emits: ["close", "show", "hide", "rowClick"],
468929
468932
  setup(__props, { emit: __emit }) {
@@ -469067,6 +469070,7 @@ ${this.attributes_.map(
469067
469070
  coordinate: _ctx.coordinate,
469068
469071
  feature: _ctx.feature,
469069
469072
  visible: _ctx.visible,
469073
+ id: _ctx.id,
469070
469074
  onClose: _cache[6] || (_cache[6] = ($event) => _ctx.$emit("close")),
469071
469075
  onShow: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("show")),
469072
469076
  onHide: _cache[8] || (_cache[8] = ($event) => _ctx.$emit("hide"))
@@ -469271,7 +469275,7 @@ ${this.attributes_.map(
469271
469275
  ])
469272
469276
  ]),
469273
469277
  _: 1
469274
- }, 8, ["config", "coordinate", "feature", "visible"]);
469278
+ }, 8, ["config", "coordinate", "feature", "visible", "id"]);
469275
469279
  };
469276
469280
  }
469277
469281
  });
@@ -469488,7 +469492,8 @@ ${this.attributes_.map(
469488
469492
  }
469489
469493
  },
469490
469494
  positioning: "bottom-center",
469491
- stopEvent: false,
469495
+ // 关键:阻止来自popup的事件传递到地图,避免点击关闭按钮触发地图单击
469496
+ stopEvent: true,
469492
469497
  offset: [0, -10]
469493
469498
  });
469494
469499
  let component = null;
@@ -469496,6 +469501,7 @@ ${this.attributes_.map(
469496
469501
  switch (type) {
469497
469502
  case "html":
469498
469503
  app = vue.createApp(_sfc_main$p, {
469504
+ id: popupId,
469499
469505
  config: { ...this.config.defaultConfig, ...config },
469500
469506
  coordinate,
469501
469507
  feature: feature2,
@@ -469505,6 +469511,7 @@ ${this.attributes_.map(
469505
469511
  break;
469506
469512
  case "image":
469507
469513
  app = vue.createApp(_sfc_main$o, {
469514
+ id: popupId,
469508
469515
  config: { ...this.config.defaultConfig, ...config },
469509
469516
  coordinate,
469510
469517
  feature: feature2,
@@ -469514,6 +469521,7 @@ ${this.attributes_.map(
469514
469521
  break;
469515
469522
  case "array":
469516
469523
  app = vue.createApp(_sfc_main$n, {
469524
+ id: popupId,
469517
469525
  config: { ...this.config.defaultConfig, ...config },
469518
469526
  coordinate,
469519
469527
  feature: feature2,
@@ -469529,6 +469537,7 @@ ${this.attributes_.map(
469529
469537
  const allConfig = config;
469530
469538
  if (allConfig.htmlContent) {
469531
469539
  app = vue.createApp(_sfc_main$p, {
469540
+ id: popupId,
469532
469541
  config: {
469533
469542
  ...allConfig,
469534
469543
  content: allConfig.htmlContent
@@ -469540,6 +469549,7 @@ ${this.attributes_.map(
469540
469549
  });
469541
469550
  } else if (allConfig.images) {
469542
469551
  app = vue.createApp(_sfc_main$o, {
469552
+ id: popupId,
469543
469553
  config: {
469544
469554
  ...allConfig,
469545
469555
  images: allConfig.images
@@ -469551,6 +469561,7 @@ ${this.attributes_.map(
469551
469561
  });
469552
469562
  } else if (allConfig.data) {
469553
469563
  app = vue.createApp(_sfc_main$n, {
469564
+ id: popupId,
469554
469565
  config: {
469555
469566
  ...allConfig,
469556
469567
  data: allConfig.data
@@ -469566,6 +469577,7 @@ ${this.attributes_.map(
469566
469577
  });
469567
469578
  } else {
469568
469579
  app = vue.createApp(_sfc_main$q, {
469580
+ id: popupId,
469569
469581
  config: allConfig,
469570
469582
  coordinate,
469571
469583
  feature: feature2,
@@ -469574,6 +469586,28 @@ ${this.attributes_.map(
469574
469586
  });
469575
469587
  }
469576
469588
  break;
469589
+ case "custom": {
469590
+ const customConfig = config;
469591
+ const CustomComp = customConfig.component;
469592
+ const computedProps = typeof customConfig.props === "function" ? customConfig.props(feature2, coordinate) : customConfig.props || {};
469593
+ const cfg = { ...this.config.defaultConfig, ...customConfig };
469594
+ const onClose = () => this.closePopup(popupId);
469595
+ const Root = vue.defineComponent({
469596
+ name: "CustomPopupRoot",
469597
+ setup() {
469598
+ return { cfg, coordinate, feature: feature2, CustomComp, computedProps, onClose };
469599
+ },
469600
+ render() {
469601
+ return vue.h(
469602
+ _sfc_main$q,
469603
+ { config: this.cfg, coordinate: this.coordinate, feature: this.feature, visible: true, id: popupId, onClose: this.onClose },
469604
+ { default: () => vue.h(this.CustomComp, { ...this.computedProps, feature: this.feature, coordinate: this.coordinate, config: this.cfg }) }
469605
+ );
469606
+ }
469607
+ });
469608
+ app = vue.createApp(Root);
469609
+ break;
469610
+ }
469577
469611
  default:
469578
469612
  console.error(`不支持的 popup 类型: ${type}`);
469579
469613
  return null;
@@ -469602,24 +469636,26 @@ ${this.attributes_.map(
469602
469636
  * 显示 popup
469603
469637
  */
469604
469638
  showPopup(popup) {
469605
- var _a3, _b3;
469639
+ var _a3, _b3, _c2, _d;
469606
469640
  this.map.addOverlay(popup.overlay);
469607
469641
  popup.overlay.setPosition(popup.coordinate);
469608
469642
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onShow) == null ? void 0 : _b3.call(_a3);
469643
+ (_d = (_c2 = this.config).onShow) == null ? void 0 : _d.call(_c2, popup.id, popup.config, popup.feature, popup.coordinate);
469609
469644
  }
469610
469645
  /**
469611
469646
  * 隐藏 popup
469612
469647
  */
469613
469648
  hidePopup(popup) {
469614
- var _a3, _b3;
469649
+ var _a3, _b3, _c2, _d;
469615
469650
  this.map.removeOverlay(popup.overlay);
469616
469651
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onHide) == null ? void 0 : _b3.call(_a3);
469652
+ (_d = (_c2 = this.config).onHide) == null ? void 0 : _d.call(_c2, popup.id);
469617
469653
  }
469618
469654
  /**
469619
469655
  * 销毁 popup
469620
469656
  */
469621
469657
  destroyPopup(popup) {
469622
- var _a3, _b3;
469658
+ var _a3, _b3, _c2, _d;
469623
469659
  try {
469624
469660
  if (popup.app) {
469625
469661
  popup.app.unmount();
@@ -469628,6 +469664,7 @@ ${this.attributes_.map(
469628
469664
  popup.container.parentNode.removeChild(popup.container);
469629
469665
  }
469630
469666
  (_b3 = (_a3 = popup.config.events) == null ? void 0 : _a3.onClose) == null ? void 0 : _b3.call(_a3);
469667
+ (_d = (_c2 = this.config).onClose) == null ? void 0 : _d.call(_c2, popup.id);
469631
469668
  } catch (error2) {
469632
469669
  console.error("销毁 popup 失败:", error2);
469633
469670
  }
@@ -481932,7 +481969,7 @@ ${this.attributes_.map(
481932
481969
  }
481933
481970
  return groups;
481934
481971
  });
481935
- const activeTreeType = vue.ref("classification");
481972
+ const activeTreeType = vue.ref("default");
481936
481973
  const classificationGroups = vue.computed(() => {
481937
481974
  zIndexVersion.value;
481938
481975
  const vectorGroup = layerGroups.value.find((g2) => g2.id === "vectorLayers");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-openlayers-plugin",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
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",
@@ -7,6 +7,7 @@ interface Props {
7
7
  coordinate: Coordinate;
8
8
  feature?: Feature;
9
9
  visible?: boolean;
10
+ id?: string;
10
11
  }
11
12
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
12
13
  visible: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayPopup.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CustomOpenlayer/components/MapPopup/ArrayPopup.vue"],"names":[],"mappings":"AAgNA;AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAc,MAAM,SAAS,CAAA;AAI3D,UAAU,KAAK;IACb,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;;;;;;;;;;;;;;;;;;AAsgCD,wBAOG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;K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AAM,CAAA;CACZ;;;;;;;;;;;;;;;;;;AAsgCD,wBAOG;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,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
@@ -7,6 +7,7 @@ interface Props {
7
7
  coordinate: Coordinate;
8
8
  feature?: Feature;
9
9
  visible?: boolean;
10
+ id?: string;
10
11
  }
11
12
  declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
12
13
  visible: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"BasePopup.vue.d.ts","sourceRoot":"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