@shjjs/visual-ui 2.0.7 → 3.0.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.
@@ -1,7 +1,7 @@
1
1
  import o from "./index.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ea4ce3db"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-56e45189"]]);
5
5
  export {
6
- e as default
6
+ p as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as A, computed as B, shallowRef as I, ref as y, onMounted as Q, nextTick as X, onUnmounted as Y, watch as p, createElementBlock as M, openBlock as W, normalizeClass as $, createElementVNode as C } from "vue";
2
- import _ from "@amap/amap-jsapi-loader";
3
- import ee from "axios";
4
- import { nanoid as te } from "nanoid";
1
+ import { defineComponent as A, computed as q, shallowRef as M, ref as y, onMounted as Q, nextTick as X, onUnmounted as Y, watch as p, createElementBlock as C, openBlock as S, createElementVNode as L, createCommentVNode as W, normalizeClass as $, toDisplayString as _ } from "vue";
2
+ import ee from "@amap/amap-jsapi-loader";
3
+ import te from "axios";
4
+ import { nanoid as re } from "nanoid";
5
5
  /* empty css */
6
6
  /* empty css */
7
7
  import "../../../Interaction/components/Tabs/index.mjs";
@@ -156,15 +156,19 @@ import "../UnityIframe/index.mjs";
156
156
  import "../UnityWebgl/index.mjs";
157
157
  import "../Vr/index.mjs";
158
158
  import "../Earth/index.mjs";
159
- import { SHJDatasourceV2 as re } from "../../../../commons/plugins/datasource/index.mjs";
159
+ import { SHJDatasourceV2 as ae } from "../../../../commons/plugins/datasource/index.mjs";
160
160
  import { SHJParseEvent as v } from "../../../../commons/plugins/event/index.mjs";
161
161
  import "lodash";
162
- import { upgradeAmap2d as ae } from "./version.mjs";
163
- const oe = {
164
- key: 1,
162
+ import { upgradeAmap2d as oe } from "./version.mjs";
163
+ const le = { class: "relative w-full h-full" }, se = {
164
+ key: 0,
165
165
  class: "empty-wrap"
166
- }, le = A({ name: "ShjAmap2d" }), sa = /* @__PURE__ */ A({
167
- ...le,
166
+ }, ie = {
167
+ key: 0,
168
+ class: "iconfont shj-gaodeditu",
169
+ style: { "font-size": "48px" }
170
+ }, ne = { class: "text-gray-500" }, ce = A({ name: "ShjAmap2d" }), ma = /* @__PURE__ */ A({
171
+ ...ce,
168
172
  props: {
169
173
  option: {},
170
174
  sources: {},
@@ -179,21 +183,11 @@ const oe = {
179
183
  "amap2d-scene-dragging",
180
184
  "amap2d-scene-dragend"
181
185
  ],
182
- setup(c, { expose: D, emit: J }) {
183
- const s = B(() => ae(c.option)), T = B(
184
- () => {
185
- var t, e;
186
- return !!((t = s.value.basic) != null && t.key && ((e = s.value.basic) != null && e.securityJsCode));
187
- }
188
- ), d = J, o = I(), m = I(), z = y(!1), S = y(), g = y(), h = y(), b = y(), u = y(), f = (t) => {
189
- var e, r;
190
- if (!((e = t.basic) != null && e.key) || !((r = t.basic) != null && r.securityJsCode)) {
191
- z.value = !1, x();
192
- return;
193
- }
194
- x(), window._AMapSecurityConfig = {
186
+ setup(c, { expose: D, emit: T }) {
187
+ const s = q(() => oe(c.option)), d = T, o = M(), m = M(), g = y(!1), h = y(), b = y(), k = y(), u = y(), w = y(""), f = (t) => {
188
+ I(), window._AMapSecurityConfig = {
195
189
  securityJsCode: t.basic.securityJsCode
196
- }, _.load({
190
+ }, ee.load({
197
191
  key: t.basic.key,
198
192
  // 申请好的Web端开发者Key,首次调用 load 时必填
199
193
  version: "2.0",
@@ -210,9 +204,9 @@ const oe = {
210
204
  "AMap.ImageLayer",
211
205
  "AMap.TileLayer"
212
206
  ]
213
- }).then((a) => {
214
- u.value = a;
215
- const l = new u.value.createDefaultLayer({
207
+ }).then((e) => {
208
+ u.value = e;
209
+ const r = new u.value.createDefaultLayer({
216
210
  visible: !0,
217
211
  // 是否可见
218
212
  opacity: 1,
@@ -220,7 +214,7 @@ const oe = {
220
214
  zIndex: 0
221
215
  // 叠加层级
222
216
  });
223
- o.value = new a.Map(S.value, {
217
+ o.value = new e.Map("zerov-amap-2d", {
224
218
  rotateEnable: t.config.rotateEnable,
225
219
  // 是否开启地图旋转交互 鼠标右键 + 鼠标画圈移动 或 键盘Ctrl + 鼠标画圈移动
226
220
  pitchEnable: t.config.pitchEnable,
@@ -237,99 +231,100 @@ const oe = {
237
231
  // 初始地图中心经纬度
238
232
  mapStyle: t.config.mapStyle,
239
233
  features: t.config.features,
240
- layers: [l]
234
+ layers: [r]
241
235
  }), m.value = new window.Loca.Container({
242
236
  map: o.value
243
- }), b.value = new u.value.Scale({
237
+ }), k.value = new u.value.Scale({
244
238
  visible: t.config.plugin.scale.visible,
245
239
  position: {
246
240
  left: t.config.plugin.scale.position.left + "px",
247
241
  bottom: t.config.plugin.scale.position.bottom + "px"
248
242
  }
249
- }), o.value.addControl(b.value), g.value = new a.ControlBar({
243
+ }), o.value.addControl(k.value), h.value = new e.ControlBar({
250
244
  visible: t.config.plugin.controlBar.visible,
251
245
  showControlButton: t.config.plugin.controlBar.showControlButton,
252
246
  position: {
253
247
  right: t.config.plugin.controlBar.position.right + "px",
254
248
  top: t.config.plugin.controlBar.position.top + "px"
255
249
  }
256
- }), o.value.addControl(g.value), h.value = new a.ToolBar({
250
+ }), o.value.addControl(h.value), b.value = new e.ToolBar({
257
251
  visible: t.config.plugin.toolBar.visible,
258
252
  position: {
259
253
  left: t.config.plugin.toolBar.position.left + "px",
260
254
  top: t.config.plugin.toolBar.position.top + "px"
261
255
  }
262
- }), o.value.addControl(h.value), L(a), o.value.on("complete", () => {
256
+ }), o.value.addControl(b.value), E(e), o.value.on("complete", () => {
263
257
  setTimeout(() => {
264
- z.value = !0, d("amap2d-scene-success"), v.parseEvents(c.useEvents, "amap2d-scene-success", null);
258
+ g.value = !0, d("amap2d-scene-success"), v.parseEvents(c.useEvents, "amap2d-scene-success", null);
265
259
  }, 666);
266
260
  }), o.value.on("zoomstart", () => {
267
261
  d("amap2d-scene-zoomstart"), v.parseEvents(c.useEvents, "amap2d-scene-zoomstart", null);
268
262
  }), o.value.on("zoomend", () => {
269
263
  d("amap2d-scene-zoomend"), v.parseEvents(c.useEvents, "amap2d-scene-zoomend", null);
270
- }), o.value.on("click", (i) => {
271
- d("amap2d-scene-mapclick", i.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-mapclick", i.lnglat);
272
- }), o.value.on("dragstart", (i) => {
273
- d("amap2d-scene-dragstart", i.lnglat), v.parseEvents(
264
+ }), o.value.on("click", (a) => {
265
+ d("amap2d-scene-mapclick", a.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-mapclick", a.lnglat);
266
+ }), o.value.on("dragstart", (a) => {
267
+ d("amap2d-scene-dragstart", a.lnglat), v.parseEvents(
274
268
  c.useEvents,
275
269
  "amap2d-scene-dragstart",
276
- i.lnglat
270
+ a.lnglat
277
271
  );
278
- }), o.value.on("dragend", (i) => {
279
- d("amap2d-scene-dragend", i.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-dragend", i.lnglat);
272
+ }), o.value.on("dragend", (a) => {
273
+ d("amap2d-scene-dragend", a.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-dragend", a.lnglat);
280
274
  });
281
- }).catch((a) => {
275
+ }).catch((e) => {
276
+ g.value = !1, w.value = "缺少必要的Key和密钥,请先在右侧配置面板中进行配置";
282
277
  });
283
- }, L = (t) => {
278
+ }, E = (t) => {
284
279
  c.sources && c.sources.length > 0 ? s.value.widgets.forEach((r, a) => {
285
- re.parse({
280
+ ae.parse({
286
281
  sources: [c.sources[a]],
287
282
  callback: (l) => {
288
283
  try {
289
- r && r.type === "heatmap" && F(t, r, l.data[0].data), r && r.type === "dotlayers" && G(
284
+ r && r.type === "heatmap" && j(t, r, l.data[0].data), r && r.type === "dotlayers" && F(
290
285
  window.Loca,
291
286
  r,
292
- w(l.data[0].data)
293
- ), r && r.type === "scatter" && H(
287
+ x(l.data[0].data)
288
+ ), r && r.type === "scatter" && G(
294
289
  window.Loca,
295
290
  r,
296
- w(l.data[0].data)
297
- ), r && r.type === "labelsLayer" && R(
291
+ x(l.data[0].data)
292
+ ), r && r.type === "labelsLayer" && H(
298
293
  window.Loca,
299
294
  r,
300
- w(l.data[0].data)
295
+ x(l.data[0].data)
301
296
  );
302
297
  } catch {
303
298
  }
304
299
  s.value.widgets.filter((i) => i.type === "boundary").forEach((i) => {
305
- E(t, i);
300
+ O(t, i);
306
301
  });
307
302
  }
308
303
  });
309
304
  }) : s.value.widgets.filter((r) => r.type === "boundary").forEach((r) => {
310
- E(t, r);
305
+ O(t, r);
311
306
  });
312
307
  const e = o.value.getLayers();
313
308
  for (let r = 0; r < e.length; r++)
314
309
  (e[r].type === "sketchTileLayer" || e[r]._opts.type === "sketchImageLayer") && o.value.removeLayer(e[r]);
315
310
  s.value.widgets.filter((r) => r.type === "sketchTile").forEach((r) => {
316
- const a = N(r);
311
+ const a = P(r);
317
312
  a && o.value.addLayer(a);
318
313
  }), s.value.widgets.filter((r) => r.type === "sketchImage").forEach((r) => {
319
- const a = j(r);
314
+ const a = N(r);
320
315
  o.value.addLayer(a);
321
316
  });
322
- }, P = (t) => {
317
+ }, J = (t) => {
323
318
  const r = t.slice(
324
319
  t.indexOf("(") + 1,
325
320
  t.lastIndexOf(")")
326
321
  ).split(",").map((l) => l.trim()), a = {};
327
322
  for (let l = 1; l < r.length; l++) {
328
- const i = r[l].split(" "), n = i[0], k = parseFloat(i[1]) / 100, q = Math.round(k * 100) / 100;
329
- a[q] = n;
323
+ const i = r[l].split(" "), n = i[0], z = parseFloat(i[1]) / 100, K = Math.round(z * 100) / 100;
324
+ a[K] = n;
330
325
  }
331
326
  return a;
332
- }, N = (t) => {
327
+ }, P = (t) => {
333
328
  try {
334
329
  return new u.value.TileLayer({
335
330
  bounds: new u.value.Bounds(
@@ -351,7 +346,7 @@ const oe = {
351
346
  } catch {
352
347
  }
353
348
  return null;
354
- }, j = (t) => {
349
+ }, N = (t) => {
355
350
  try {
356
351
  return new u.value.ImageLayer({
357
352
  bounds: new u.value.Bounds(
@@ -370,13 +365,13 @@ const oe = {
370
365
  } catch {
371
366
  }
372
367
  return null;
373
- }, F = (t, e, r) => {
368
+ }, j = (t, e, r) => {
374
369
  try {
375
370
  const a = new t.HeatMap(o.value, {
376
371
  radius: e.radius,
377
372
  // 给定半径
378
373
  opacity: e.opacity,
379
- gradient: P(e.gradient)
374
+ gradient: J(e.gradient)
380
375
  });
381
376
  setTimeout(() => {
382
377
  a.setDataSet({
@@ -386,9 +381,9 @@ const oe = {
386
381
  }, 0);
387
382
  } catch {
388
383
  }
389
- }, E = async (t, e) => {
384
+ }, O = async (t, e) => {
390
385
  try {
391
- const r = await ee.get(e.geojson);
386
+ const r = await te.get(e.geojson);
392
387
  if (r.status === 200) {
393
388
  const a = new t.GeoJSON({
394
389
  geoJSON: r.data,
@@ -440,7 +435,7 @@ const oe = {
440
435
  }
441
436
  } catch {
442
437
  }
443
- }, G = (t, e, r) => {
438
+ }, F = (t, e, r) => {
444
439
  try {
445
440
  const a = new t.GeoJSONSource({
446
441
  data: r
@@ -470,7 +465,7 @@ const oe = {
470
465
  });
471
466
  } catch {
472
467
  }
473
- }, H = (t, e, r) => {
468
+ }, G = (t, e, r) => {
474
469
  try {
475
470
  const a = new t.GeoJSONSource({
476
471
  data: r
@@ -491,7 +486,7 @@ const oe = {
491
486
  }), m.value.animate.start();
492
487
  } catch {
493
488
  }
494
- }, R = (t, e, r) => {
489
+ }, H = (t, e, r) => {
495
490
  try {
496
491
  const a = new t.GeoJSONSource({
497
492
  data: r
@@ -534,14 +529,14 @@ const oe = {
534
529
  }), l.on("complete", () => {
535
530
  const i = l.getLabelsLayer().getAllOverlays();
536
531
  for (const n of i)
537
- n.on("click", (k) => {
538
- }), n.on("mouseover", (k) => {
539
- }), n.on("mouseout", (k) => {
532
+ n.on("click", (z) => {
533
+ }), n.on("mouseover", (z) => {
534
+ }), n.on("mouseout", (z) => {
540
535
  });
541
536
  }), m.value.add(l);
542
537
  } catch {
543
538
  }
544
- }, w = (t) => {
539
+ }, x = (t) => {
545
540
  const e = {
546
541
  type: "FeatureCollection",
547
542
  features: []
@@ -549,7 +544,7 @@ const oe = {
549
544
  return t.forEach((r) => {
550
545
  const a = {
551
546
  type: "Feature",
552
- id: te(),
547
+ id: re(),
553
548
  properties: {
554
549
  name: r.name || "",
555
550
  _draw_type: "point"
@@ -561,31 +556,31 @@ const oe = {
561
556
  };
562
557
  e.features.push(a);
563
558
  }), e;
564
- }, O = (t) => {
559
+ }, B = (t) => {
565
560
  o.value && (o.value.setFeatures(t.config.features), o.value.setStatus({
566
561
  dragEnable: t.config.dragEnable,
567
562
  zoomEnable: t.config.zoomEnable,
568
563
  rotateEnable: t.config.rotateEnable
569
- }), t.config.plugin.scale.visible ? b.value.show() : b.value.hide(), t.config.plugin.toolBar.visible ? h.value.show() : h.value.hide(), t.config.plugin.controlBar.visible ? g.value.show() : g.value.hide());
564
+ }), t.config.plugin.scale.visible ? k.value.show() : k.value.hide(), t.config.plugin.toolBar.visible ? b.value.show() : b.value.hide(), t.config.plugin.controlBar.visible ? h.value.show() : h.value.hide());
570
565
  }, V = () => {
571
- o.value && (o.value.clearMap(), m.value.clear(), L(u.value));
572
- }, K = (t) => {
566
+ o.value && (o.value.clearMap(), m.value.clear(), E(u.value));
567
+ }, R = (t) => {
573
568
  o.value && o.value.setMapStyle(t.config.mapStyle);
574
569
  }, U = (t) => {
575
570
  o.value && o.value.setZoom(t.config.zoom, !1, 200);
576
571
  }, Z = (t) => {
577
572
  o.value && o.value.setCenter(t.config.center, !1, 200);
578
- }, x = () => {
573
+ }, I = () => {
579
574
  o.value && (o.value.clearMap(), o.value.destroy(), o.value = null, m.value && (m.value.clear(), m.value.destroy(), m.value = null));
580
575
  };
581
576
  return Q(() => {
582
577
  X(() => {
583
578
  f(s.value);
584
579
  });
585
- }), Y(() => x()), p(
580
+ }), Y(() => I()), p(
586
581
  () => s.value.config,
587
582
  () => {
588
- O(s.value);
583
+ B(s.value);
589
584
  },
590
585
  { deep: !0 }
591
586
  ), p(
@@ -609,7 +604,7 @@ const oe = {
609
604
  ), p(
610
605
  () => s.value.config.mapStyle,
611
606
  () => {
612
- K(s.value);
607
+ R(s.value);
613
608
  },
614
609
  { deep: !0 }
615
610
  ), p(
@@ -626,26 +621,24 @@ const oe = {
626
621
  { deep: !0 }
627
622
  ), D({
628
623
  refresh: () => f(s.value),
629
- refreshView: () => O(s.value),
624
+ refreshView: () => B(s.value),
630
625
  refreshData: () => f(s.value)
631
- }), (t, e) => T.value ? (W(), M("div", {
632
- key: 0,
633
- class: $(["amap-2d-wrap", { show: z.value }])
634
- }, [
635
- C("div", {
636
- ref_key: "amap2dContainer",
637
- ref: S,
638
- class: "zerov-amap-container"
639
- }, null, 512)
640
- ], 2)) : (W(), M("div", oe, e[0] || (e[0] = [
641
- C("i", {
642
- class: "iconfont shj-gaodeditu",
643
- style: { "font-size": "48px" }
644
- }, null, -1),
645
- C("p", { class: "text-gray-500" }, " 缺少必要的Key和密钥,请先在右侧配置面板中进行配置 ", -1)
646
- ])));
626
+ }), (t, e) => (S(), C("div", le, [
627
+ L("div", {
628
+ class: $(["amap-2d-wrap", { show: g.value }])
629
+ }, e[0] || (e[0] = [
630
+ L("div", {
631
+ id: "zerov-amap-2d",
632
+ class: "zerov-amap-container"
633
+ }, null, -1)
634
+ ]), 2),
635
+ g.value ? W("", !0) : (S(), C("div", se, [
636
+ w.value !== "" ? (S(), C("i", ie)) : W("", !0),
637
+ L("p", ne, _(w.value), 1)
638
+ ]))
639
+ ]));
647
640
  }
648
641
  });
649
642
  export {
650
- sa as default
643
+ ma as default
651
644
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./index.vue2.mjs";
2
2
  /* empty css */
3
3
  import t from "../../../../_virtual/_plugin-vue_export-helper.mjs";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-94bc752d"]]);
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-add171b8"]]);
5
5
  export {
6
- c as default
6
+ a as default
7
7
  };