@summeruse/ol 0.0.0 → 0.0.1-beta.2

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 (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.js +273 -31
  3. package/dist/ol.css +1 -0
  4. package/es/components/common/render-v-node.vue.d.ts +17 -0
  5. package/es/components/common/render-v-node.vue.mjs +22 -0
  6. package/es/components/common/render-v-node.vue2.mjs +4 -0
  7. package/es/components/index.d.ts +3 -3
  8. package/es/components/n-ol-contextmenu/index.d.ts +3 -0
  9. package/es/components/n-ol-contextmenu/index.vue.d.ts +3 -0
  10. package/es/components/n-ol-contextmenu/index.vue.mjs +47 -0
  11. package/es/components/n-ol-contextmenu/index.vue2.mjs +4 -0
  12. package/{lib/components/ol-contextmenu → es/components/n-ol-contextmenu}/props.d.ts +5 -3
  13. package/es/components/n-ol-pointermove/index.d.ts +3 -0
  14. package/es/components/n-ol-pointermove/index.vue.d.ts +3 -0
  15. package/es/components/n-ol-pointermove/index.vue.mjs +47 -0
  16. package/es/components/n-ol-pointermove/index.vue3.mjs +5 -0
  17. package/es/components/n-ol-pointermove/props.d.ts +20 -0
  18. package/es/components/ol-map/index.d.ts +4 -0
  19. package/es/components/ol-map/index.vue.d.ts +44 -0
  20. package/es/components/ol-map/index.vue.mjs +124 -0
  21. package/es/components/ol-map/index.vue2.mjs +4 -0
  22. package/es/components/ol-map/props.d.ts +27 -0
  23. package/es/components/ol-map/props.mjs +4 -0
  24. package/es/composables/index.d.ts +2 -0
  25. package/es/composables/useGraticule/index.d.ts +12 -0
  26. package/es/composables/useGraticule/index.mjs +44 -0
  27. package/es/composables/useSwitchBaseLayer/index.d.ts +11 -0
  28. package/es/composables/useSwitchBaseLayer/index.mjs +25 -0
  29. package/es/constants/distance.d.ts +1 -0
  30. package/es/constants/index.d.ts +2 -0
  31. package/es/constants/projection.d.ts +4 -0
  32. package/es/index.d.ts +1 -0
  33. package/es/index.mjs +13 -2
  34. package/es/ol.css +1 -0
  35. package/es/types/index.d.ts +2 -0
  36. package/es/utils/calculate/index.d.ts +22 -0
  37. package/es/utils/distance/index.d.ts +4 -0
  38. package/es/utils/draw/index.d.ts +109 -0
  39. package/es/utils/format/index.d.ts +4 -0
  40. package/es/utils/index.d.ts +6 -0
  41. package/es/utils/layer/index.d.ts +28 -0
  42. package/es/utils/projection/index.d.ts +10 -0
  43. package/es/utils/realCircle/index.d.ts +10 -0
  44. package/lib/components/common/render-v-node.vue.d.ts +17 -0
  45. package/lib/components/common/render-v-node.vue.js +1 -0
  46. package/lib/components/common/render-v-node.vue2.js +1 -0
  47. package/lib/components/index.d.ts +3 -3
  48. package/lib/components/n-ol-contextmenu/index.d.ts +3 -0
  49. package/lib/components/n-ol-contextmenu/index.vue.d.ts +3 -0
  50. package/lib/components/n-ol-contextmenu/index.vue.js +1 -0
  51. package/lib/components/n-ol-contextmenu/index.vue2.js +1 -0
  52. package/{es/components/ol-contextmenu → lib/components/n-ol-contextmenu}/props.d.ts +5 -3
  53. package/lib/components/n-ol-pointermove/index.d.ts +3 -0
  54. package/lib/components/n-ol-pointermove/index.vue.d.ts +3 -0
  55. package/lib/components/n-ol-pointermove/index.vue.js +1 -0
  56. package/lib/components/n-ol-pointermove/index.vue3.js +1 -0
  57. package/lib/components/n-ol-pointermove/props.d.ts +20 -0
  58. package/lib/components/ol-map/index.d.ts +4 -0
  59. package/lib/components/ol-map/index.vue.d.ts +44 -0
  60. package/lib/components/ol-map/index.vue.js +1 -0
  61. package/lib/components/ol-map/index.vue2.js +1 -0
  62. package/lib/components/ol-map/props.d.ts +27 -0
  63. package/lib/components/ol-map/props.js +1 -0
  64. package/lib/composables/index.d.ts +2 -0
  65. package/lib/composables/useGraticule/index.d.ts +12 -0
  66. package/lib/composables/useGraticule/index.js +1 -0
  67. package/lib/composables/useSwitchBaseLayer/index.d.ts +11 -0
  68. package/lib/composables/useSwitchBaseLayer/index.js +1 -0
  69. package/lib/constants/distance.d.ts +1 -0
  70. package/lib/constants/index.d.ts +2 -0
  71. package/lib/constants/projection.d.ts +4 -0
  72. package/lib/index.d.ts +1 -0
  73. package/lib/index.js +1 -1
  74. package/lib/ol.css +1 -0
  75. package/lib/types/index.d.ts +2 -0
  76. package/lib/utils/calculate/index.d.ts +22 -0
  77. package/lib/utils/distance/index.d.ts +4 -0
  78. package/lib/utils/draw/index.d.ts +109 -0
  79. package/lib/utils/format/index.d.ts +4 -0
  80. package/lib/utils/index.d.ts +6 -0
  81. package/lib/utils/layer/index.d.ts +28 -0
  82. package/lib/utils/projection/index.d.ts +10 -0
  83. package/lib/utils/realCircle/index.d.ts +10 -0
  84. package/package.json +7 -4
  85. package/es/components/ol-contextmenu/n-ol-contextmenu.vue.d.ts +0 -3
  86. package/es/components/ol-contextmenu/n-ol-contextmenu.vue.mjs +0 -44
  87. package/es/components/ol-contextmenu/n-ol-contextmenu.vue2.mjs +0 -4
  88. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue.d.ts +0 -3
  89. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue.js +0 -1
  90. package/lib/components/ol-contextmenu/n-ol-contextmenu.vue2.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # @summeruse/ol
2
+
3
+ ## 0.0.1-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 添加 ol-map 组件
8
+ - 添加 useGraticule
9
+ - 添加 useSwitchBaseLayer
10
+ - 添加 n-ol-pointermove
11
+
12
+ ## 0.0.1-beta.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 更新 ol-contextmenu Props 类型
package/dist/index.js CHANGED
@@ -1,44 +1,286 @@
1
- import { defineComponent as d, ref as c, createBlock as f, openBlock as m, unref as v } from "vue";
2
- import { NDropdown as x } from "naive-ui";
3
- const _ = /* @__PURE__ */ d({
4
- __name: "n-ol-contextmenu",
1
+ import { defineComponent as y, ref as d, onMounted as X, createBlock as $, openBlock as _, unref as C, watch as a, provide as Y, createElementBlock as T, renderSlot as q, h as H, isVNode as S, shallowRef as J, withCtx as Q, createVNode as U, toValue as ee } from "vue";
2
+ import { NDropdown as te, NPopover as oe } from "naive-ui";
3
+ import { Map as ne, View as ae } from "ol";
4
+ import { Zoom as k, Attribution as I, Rotate as R, FullScreen as B, OverviewMap as N, ScaleLine as A } from "ol/control";
5
+ import { DragPan as O, MouseWheelZoom as V, DoubleClickZoom as P, PinchRotate as D, PinchZoom as j, DragRotate as F, KeyboardPan as L, KeyboardZoom as z } from "ol/interaction";
6
+ import { Graticule as E } from "ol/layer";
7
+ import { Stroke as W } from "ol/style";
8
+ const we = /* @__PURE__ */ y({
9
+ __name: "index",
5
10
  props: {
6
11
  olMap: {},
7
- createDropdownOptions: { type: Function }
12
+ createOptions: { type: Function }
8
13
  },
9
- setup(a) {
10
- const s = a, { olMap: n } = s, o = c({
14
+ setup(n) {
15
+ const i = n, { olMap: t } = i, l = d({
11
16
  visible: !1,
12
17
  x: 0,
13
18
  y: 0
14
- }), r = () => {
15
- o.value.visible = !1;
16
- }, l = c();
17
- n.getViewport().oncontextmenu = (e) => {
18
- e.preventDefault();
19
- const t = n.getEventPixel(e), i = n.getEventCoordinate(e), u = n.getFeaturesAtPixel(t);
20
- l.value = s.createDropdownOptions({ event: e, pixel: t, coordinate: i, features: u }), o.value = {
21
- visible: !0,
22
- x: e.clientX,
23
- y: e.clientY
24
- };
19
+ }), o = () => {
20
+ l.value.visible = !1;
21
+ }, s = d();
22
+ X(() => {
23
+ const u = t.getViewport();
24
+ u && (u.oncontextmenu = (r) => {
25
+ r.preventDefault();
26
+ const m = t.getEventPixel(r), w = t.getEventCoordinate(r), v = t.getFeaturesAtPixel(m);
27
+ s.value = i.createOptions({ event: r, pixel: m, coordinate: w, features: v }), l.value = {
28
+ visible: !0,
29
+ x: r.clientX,
30
+ y: r.clientY
31
+ };
32
+ });
33
+ });
34
+ const c = (u, r) => {
35
+ const { onClick: m } = r;
36
+ m && m(), l.value.visible = !1;
25
37
  };
26
- const p = (e, t) => {
27
- const { onClick: i } = t;
28
- i && i(), o.value.visible = !1;
29
- };
30
- return (e, t) => (m(), f(v(x), {
38
+ return (u, r) => (_(), $(C(te), {
31
39
  placement: "bottom-start",
32
40
  trigger: "manual",
33
- show: l.value && l.value.length > 0 && o.value.visible,
34
- x: o.value.x,
35
- y: o.value.y,
36
- options: l.value,
37
- "on-clickoutside": r,
38
- onSelect: p
41
+ show: s.value && s.value.length > 0 && l.value.visible,
42
+ x: l.value.x,
43
+ y: l.value.y,
44
+ options: s.value,
45
+ "on-clickoutside": o,
46
+ onSelect: c
39
47
  }, null, 8, ["show", "x", "y", "options"]));
40
48
  }
41
- });
49
+ }), ie = Symbol(), ve = /* @__PURE__ */ y({
50
+ __name: "index",
51
+ props: {
52
+ olMap: { default: () => new ne() },
53
+ center: { default: () => [0, 0] },
54
+ zoom: { default: 2 },
55
+ minZoom: { default: 2 },
56
+ maxZoom: { default: 18 },
57
+ constrainResolution: { type: Boolean, default: !0 },
58
+ projection: {},
59
+ extent: {},
60
+ showZoom: { type: Boolean, default: !1 },
61
+ showAttribution: { type: Boolean, default: !1 },
62
+ showRotate: { type: Boolean, default: !1 },
63
+ showFullScreen: { type: Boolean, default: !1 },
64
+ showOverview: { type: Boolean, default: !1 },
65
+ showScale: { type: Boolean, default: !1 },
66
+ dragPan: { type: Boolean, default: !0 },
67
+ mouseWheelZoom: { type: Boolean, default: !0 },
68
+ doubleClickZoom: { type: Boolean, default: !1 },
69
+ pinchRotate: { type: Boolean },
70
+ pinchZoom: { type: Boolean },
71
+ altShiftDragRotate: { type: Boolean }
72
+ },
73
+ setup(n, { expose: i }) {
74
+ const t = n, l = d(), o = t.olMap, s = new ae({
75
+ projection: t.projection,
76
+ extent: t.extent
77
+ });
78
+ o.setView(s), a(() => t.zoom, (e) => {
79
+ s.setZoom(e);
80
+ }, {
81
+ immediate: !0
82
+ }), a(() => t.center, (e) => {
83
+ s.setCenter(e);
84
+ }, {
85
+ immediate: !0
86
+ }), a(() => t.constrainResolution, (e) => {
87
+ s.setConstrainResolution(e);
88
+ }, {
89
+ immediate: !0
90
+ }), a(() => t.minZoom, (e) => {
91
+ e && s.setMinZoom(e);
92
+ }, {
93
+ immediate: !0
94
+ }), a(() => t.maxZoom, (e) => {
95
+ e && s.setMaxZoom(e);
96
+ }, {
97
+ immediate: !0
98
+ }), a(l, (e) => {
99
+ e && o.setTarget(e);
100
+ }), i({
101
+ olMap: o
102
+ }), Y(ie, o);
103
+ const c = o.getControls().getArray(), u = c.find((e) => e instanceof k) || new k(), r = c.find((e) => e instanceof I) || new I(), m = c.find((e) => e instanceof R) || new R(), w = c.find((e) => e instanceof B) || new B(), v = c.find((e) => e instanceof N) || new N(), p = c.find((e) => e instanceof A) || new A();
104
+ a(() => t.showZoom, (e) => {
105
+ u.setMap(e ? o : null);
106
+ }, {
107
+ immediate: !0
108
+ }), a(() => t.showAttribution, (e) => {
109
+ r.setMap(e ? o : null);
110
+ }, {
111
+ immediate: !0
112
+ }), a(() => t.showRotate, (e) => {
113
+ m.setMap(e ? o : null);
114
+ }, {
115
+ immediate: !0
116
+ }), a(() => t.showFullScreen, (e) => {
117
+ w.setMap(e ? o : null);
118
+ }, {
119
+ immediate: !0
120
+ }), a(() => t.showOverview, (e) => {
121
+ v.setMap(e ? o : null);
122
+ }, {
123
+ immediate: !0
124
+ }), a(() => t.showScale, (e) => {
125
+ p.setMap(e ? o : null);
126
+ }, {
127
+ immediate: !0
128
+ });
129
+ const f = o.getInteractions().getArray(), h = f.find((e) => e instanceof O) || new O(), x = f.find((e) => e instanceof V) || new V(), b = f.find((e) => e instanceof P) || new P(), g = f.find((e) => e instanceof D) || new D(), M = f.find((e) => e instanceof j) || new j(), Z = f.find((e) => e instanceof F) || new F(), G = f.find((e) => e instanceof L) || new L(), K = f.find((e) => e instanceof z) || new z();
130
+ return o.removeInteraction(h), o.addInteraction(h), o.removeInteraction(x), o.addInteraction(x), o.removeInteraction(b), o.addInteraction(b), o.removeInteraction(g), o.addInteraction(g), o.removeInteraction(M), o.addInteraction(M), o.removeInteraction(Z), o.addInteraction(Z), o.removeInteraction(G), o.removeInteraction(K), a(() => t.dragPan, (e) => {
131
+ h.setActive(e);
132
+ }, {
133
+ immediate: !0
134
+ }), a(() => t.mouseWheelZoom, (e) => {
135
+ x.setActive(e);
136
+ }, {
137
+ immediate: !0
138
+ }), a(() => t.doubleClickZoom, (e) => {
139
+ b.setActive(e);
140
+ }, {
141
+ immediate: !0
142
+ }), a(() => t.pinchRotate, (e) => {
143
+ g.setActive(e);
144
+ }, {
145
+ immediate: !0
146
+ }), a(() => t.pinchZoom, (e) => {
147
+ M.setActive(e);
148
+ }, {
149
+ immediate: !0
150
+ }), a(() => t.altShiftDragRotate, (e) => {
151
+ Z.setActive(e);
152
+ }, {
153
+ immediate: !0
154
+ }), (e, re) => (_(), T("div", {
155
+ ref_key: "mapRef",
156
+ ref: l
157
+ }, [
158
+ q(e.$slots, "default", {
159
+ olMap: C(o),
160
+ mapRef: l.value
161
+ })
162
+ ], 512));
163
+ }
164
+ }), le = y({
165
+ props: {
166
+ dynamicVNode: {
167
+ type: [Function, String, Object],
168
+ default: void 0
169
+ }
170
+ },
171
+ setup(n) {
172
+ return () => {
173
+ if (!n.dynamicVNode) return H("span");
174
+ if (typeof n.dynamicVNode == "string" || S(n.dynamicVNode)) return n.dynamicVNode;
175
+ if (typeof n.dynamicVNode == "function") {
176
+ const i = n.dynamicVNode();
177
+ return S(i), i;
178
+ }
179
+ };
180
+ }
181
+ }), ye = /* @__PURE__ */ y({
182
+ __name: "index",
183
+ props: {
184
+ olMap: {},
185
+ createOptions: { type: Function }
186
+ },
187
+ setup(n) {
188
+ const i = n, t = d({
189
+ visible: !1,
190
+ x: 0,
191
+ y: 0
192
+ }), l = J(), o = d("bottom-start"), s = d(!1), c = d(!1);
193
+ return X(() => {
194
+ var u;
195
+ (u = i.olMap) == null || u.on("pointermove", (r) => {
196
+ const m = i.olMap.getFeaturesAtPixel(r.pixel), { clientX: w, clientY: v } = r.originalEvent;
197
+ t.value.visible = !1;
198
+ const p = i.createOptions({
199
+ pixel: r.pixel,
200
+ coordinate: r.coordinate,
201
+ features: m
202
+ });
203
+ p && (l.value = p.content, o.value = p.placement || "bottom-start", c.value = p.showArrow || !1, s.value = p.raw || !1, t.value.visible = !0, t.value.x = w, t.value.y = v);
204
+ });
205
+ }), (u, r) => (_(), $(C(oe), {
206
+ "show-arrow": c.value,
207
+ raw: s.value,
208
+ placement: o.value,
209
+ show: t.value.visible,
210
+ x: t.value.x,
211
+ y: t.value.y,
212
+ trigger: "manual",
213
+ class: "n-ol-pointermove"
214
+ }, {
215
+ default: Q(() => [
216
+ U(le, { "dynamic-v-node": l.value }, null, 8, ["dynamic-v-node"])
217
+ ]),
218
+ _: 1
219
+ }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
220
+ }
221
+ }), he = (n) => {
222
+ const i = d(n.defaultShow || !1);
223
+ let t = new E({
224
+ strokeStyle: n.strokeStyle || new W({
225
+ color: "#000",
226
+ width: 1.5,
227
+ lineDash: [4, 4]
228
+ }),
229
+ showLabels: !0,
230
+ wrapX: !1,
231
+ zIndex: 1
232
+ });
233
+ return a(
234
+ i,
235
+ (l) => {
236
+ if (t.setMap(null), l) {
237
+ t = new E({
238
+ strokeStyle: new W({
239
+ color: "#555",
240
+ width: 1.5,
241
+ lineDash: [4, 4]
242
+ }),
243
+ showLabels: !0,
244
+ wrapX: !1,
245
+ zIndex: 1
246
+ });
247
+ const o = ee(n.olMap);
248
+ o && t.setMap(o);
249
+ }
250
+ },
251
+ {
252
+ immediate: !0,
253
+ deep: !0
254
+ }
255
+ ), {
256
+ showGraticule: i
257
+ };
258
+ }, xe = (n) => {
259
+ const i = d(n.defaultLayerName || Object.keys(n.layers)[0]);
260
+ return Object.values(n.layers).map((t) => {
261
+ t.map((l) => {
262
+ n.olMap.addLayer(l);
263
+ });
264
+ }), a(
265
+ i,
266
+ () => {
267
+ Object.entries(n.layers).map(([t, l]) => {
268
+ const o = t === i.value;
269
+ l.map((s) => {
270
+ s.setVisible(o);
271
+ });
272
+ });
273
+ },
274
+ {
275
+ immediate: !0
276
+ }
277
+ ), { visibleLayerName: i };
278
+ };
42
279
  export {
43
- _ as NOlContextmenu
280
+ we as NOlContextmenu,
281
+ ye as NOlPointermove,
282
+ ve as OlMap,
283
+ ie as olMapInjectionKey,
284
+ he as useGraticule,
285
+ xe as useSwitchBaseLayer
44
286
  };
package/dist/ol.css ADDED
@@ -0,0 +1 @@
1
+ .n-ol-pointermove.n-popover{box-shadow:none!important}
@@ -0,0 +1,17 @@
1
+ import { PropType, VNodeChild } from 'vue';
2
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
+ dynamicVNode: {
4
+ type: PropType<(() => VNodeChild) | VNodeChild | string>;
5
+ default: undefined;
6
+ };
7
+ }>, () => string | number | boolean | void | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
8
+ [key: string]: any;
9
+ }> | import('vue').VNodeArrayChildren | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ dynamicVNode: {
11
+ type: PropType<(() => VNodeChild) | VNodeChild | string>;
12
+ default: undefined;
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ dynamicVNode: VNodeChild | (() => VNodeChild);
16
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
17
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { defineComponent as i, h as t, isVNode as d } from "vue";
2
+ const c = i({
3
+ props: {
4
+ dynamicVNode: {
5
+ type: [Function, String, Object],
6
+ default: void 0
7
+ }
8
+ },
9
+ setup(e) {
10
+ return () => {
11
+ if (!e.dynamicVNode) return t("span");
12
+ if (typeof e.dynamicVNode == "string" || d(e.dynamicVNode)) return e.dynamicVNode;
13
+ if (typeof e.dynamicVNode == "function") {
14
+ const n = e.dynamicVNode();
15
+ return d(n), n;
16
+ }
17
+ };
18
+ }
19
+ });
20
+ export {
21
+ c as default
22
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./render-v-node.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -1,3 +1,3 @@
1
- import { default as NOlContextmenu } from './ol-contextmenu/n-ol-contextmenu.vue';
2
- export { NOlContextmenu };
3
- export * from './ol-contextmenu/props';
1
+ export * from './n-ol-contextmenu';
2
+ export * from './ol-map';
3
+ export * from './n-ol-pointermove';
@@ -0,0 +1,3 @@
1
+ import { default as NOlContextmenu } from './index.vue';
2
+ export { NOlContextmenu };
3
+ export * from './props';
@@ -0,0 +1,3 @@
1
+ import { NOlContextmenuProps } from './props';
2
+ declare const _default: import('vue').DefineComponent<NOlContextmenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlContextmenuProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { defineComponent as d, ref as a, onMounted as v, createBlock as x, openBlock as m, unref as g } from "vue";
2
+ import { NDropdown as w } from "naive-ui";
3
+ const y = /* @__PURE__ */ d({
4
+ __name: "index",
5
+ props: {
6
+ olMap: {},
7
+ createOptions: { type: Function }
8
+ },
9
+ setup(c) {
10
+ const s = c, { olMap: n } = s, o = a({
11
+ visible: !1,
12
+ x: 0,
13
+ y: 0
14
+ }), r = () => {
15
+ o.value.visible = !1;
16
+ }, l = a();
17
+ v(() => {
18
+ const i = n.getViewport();
19
+ i && (i.oncontextmenu = (e) => {
20
+ e.preventDefault();
21
+ const t = n.getEventPixel(e), u = n.getEventCoordinate(e), f = n.getFeaturesAtPixel(t);
22
+ l.value = s.createOptions({ event: e, pixel: t, coordinate: u, features: f }), o.value = {
23
+ visible: !0,
24
+ x: e.clientX,
25
+ y: e.clientY
26
+ };
27
+ });
28
+ });
29
+ const p = (i, e) => {
30
+ const { onClick: t } = e;
31
+ t && t(), o.value.visible = !1;
32
+ };
33
+ return (i, e) => (m(), x(g(w), {
34
+ placement: "bottom-start",
35
+ trigger: "manual",
36
+ show: l.value && l.value.length > 0 && o.value.visible,
37
+ x: o.value.x,
38
+ y: o.value.y,
39
+ options: l.value,
40
+ "on-clickoutside": r,
41
+ onSelect: p
42
+ }, null, 8, ["show", "x", "y", "options"]));
43
+ }
44
+ });
45
+ export {
46
+ y as default
47
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -3,13 +3,15 @@ import { DropdownMixedOption } from 'naive-ui/es/dropdown/src/interface';
3
3
  import { Pixel } from 'ol/pixel';
4
4
  import { Coordinate } from 'ol/coordinate';
5
5
  import { FeatureLike } from 'ol/Feature';
6
- export interface Options {
6
+ export interface NOlContextmenuOptions {
7
7
  event: MouseEvent;
8
8
  pixel: Pixel;
9
9
  coordinate: Coordinate;
10
10
  features: FeatureLike[];
11
11
  }
12
- export interface Props {
12
+ export interface NOlContextmenuProps {
13
13
  olMap: OLMap;
14
- createDropdownOptions: (options: Options) => DropdownMixedOption[];
14
+ createOptions: (options: NOlContextmenuOptions) => (DropdownMixedOption & {
15
+ onClick?: (options: NOlContextmenuOptions) => void;
16
+ })[];
15
17
  }
@@ -0,0 +1,3 @@
1
+ import { default as NOlPointermove } from './index.vue';
2
+ export { NOlPointermove };
3
+ export * from './props';
@@ -0,0 +1,3 @@
1
+ import { NOlPointermoveProps } from './props';
2
+ declare const _default: import('vue').DefineComponent<NOlPointermoveProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NOlPointermoveProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { defineComponent as f, ref as t, shallowRef as w, onMounted as d, createBlock as x, openBlock as h, unref as _, withCtx as y, createVNode as b } from "vue";
2
+ import { NPopover as g } from "naive-ui";
3
+ import M from "../common/render-v-node.vue.mjs";
4
+ const B = /* @__PURE__ */ f({
5
+ __name: "index",
6
+ props: {
7
+ olMap: {},
8
+ createOptions: { type: Function }
9
+ },
10
+ setup(p) {
11
+ const l = p, e = t({
12
+ visible: !1,
13
+ x: 0,
14
+ y: 0
15
+ }), r = w(), s = t("bottom-start"), i = t(!1), c = t(!1);
16
+ return d(() => {
17
+ var n;
18
+ (n = l.olMap) == null || n.on("pointermove", (o) => {
19
+ const u = l.olMap.getFeaturesAtPixel(o.pixel), { clientX: v, clientY: m } = o.originalEvent;
20
+ e.value.visible = !1;
21
+ const a = l.createOptions({
22
+ pixel: o.pixel,
23
+ coordinate: o.coordinate,
24
+ features: u
25
+ });
26
+ a && (r.value = a.content, s.value = a.placement || "bottom-start", c.value = a.showArrow || !1, i.value = a.raw || !1, e.value.visible = !0, e.value.x = v, e.value.y = m);
27
+ });
28
+ }), (n, o) => (h(), x(_(g), {
29
+ "show-arrow": c.value,
30
+ raw: i.value,
31
+ placement: s.value,
32
+ show: e.value.visible,
33
+ x: e.value.x,
34
+ y: e.value.y,
35
+ trigger: "manual",
36
+ class: "n-ol-pointermove"
37
+ }, {
38
+ default: y(() => [
39
+ b(M, { "dynamic-v-node": r.value }, null, 8, ["dynamic-v-node"])
40
+ ]),
41
+ _: 1
42
+ }, 8, ["show-arrow", "raw", "placement", "show", "x", "y"]));
43
+ }
44
+ });
45
+ export {
46
+ B as default
47
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./index.vue.mjs";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,20 @@
1
+ import { PopoverPlacement } from 'naive-ui';
2
+ import { Map as OLMap } from 'ol';
3
+ import { Coordinate } from 'ol/coordinate';
4
+ import { FeatureLike } from 'ol/Feature';
5
+ import { Pixel } from 'ol/pixel';
6
+ import { VNodeChild } from 'vue';
7
+ export interface NOlPointermoveOptions {
8
+ pixel: Pixel;
9
+ coordinate: Coordinate;
10
+ features: FeatureLike[];
11
+ }
12
+ export interface NOlPointermoveProps {
13
+ olMap: OLMap;
14
+ createOptions: (data: NOlPointermoveOptions) => {
15
+ content: (() => VNodeChild) | VNodeChild | string;
16
+ raw?: boolean;
17
+ showArrow?: boolean;
18
+ placement?: PopoverPlacement;
19
+ } | undefined;
20
+ }
@@ -0,0 +1,4 @@
1
+ import { default as OlMap } from './index.vue';
2
+ export { OlMap };
3
+ export * from './props';
4
+ export type OlMapInst = InstanceType<typeof OlMap>;
@@ -0,0 +1,44 @@
1
+ import { Map as OLMap } from 'ol';
2
+ import { OlMapProps } from './props';
3
+ declare function __VLS_template(): {
4
+ attrs: Partial<{}>;
5
+ slots: {
6
+ default?(_: {
7
+ olMap: OLMap;
8
+ mapRef: HTMLDivElement | undefined;
9
+ }): any;
10
+ };
11
+ refs: {
12
+ mapRef: HTMLDivElement;
13
+ };
14
+ rootEl: HTMLDivElement;
15
+ };
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
17
+ declare const __VLS_component: import('vue').DefineComponent<OlMapProps, {
18
+ olMap: OLMap;
19
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<OlMapProps> & Readonly<{}>, {
20
+ olMap: OLMap;
21
+ center: import('ol/coordinate').Coordinate;
22
+ zoom: number;
23
+ minZoom: number;
24
+ maxZoom: number;
25
+ constrainResolution: boolean;
26
+ showZoom: boolean;
27
+ showAttribution: boolean;
28
+ showRotate: boolean;
29
+ showFullScreen: boolean;
30
+ showOverview: boolean;
31
+ showScale: boolean;
32
+ dragPan: boolean;
33
+ mouseWheelZoom: boolean;
34
+ doubleClickZoom: boolean;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
36
+ mapRef: HTMLDivElement;
37
+ }, HTMLDivElement>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };