@shjjs/visual-ui 2.0.6 → 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,6 +1,6 @@
1
- var d = Object.defineProperty;
2
- var f = (l, e, a) => e in l ? d(l, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : l[e] = a;
3
- var c = (l, e, a) => f(l, typeof e != "symbol" ? e + "" : e, a);
1
+ var f = Object.defineProperty;
2
+ var d = (l, e, a) => e in l ? f(l, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : l[e] = a;
3
+ var c = (l, e, a) => d(l, typeof e != "symbol" ? e + "" : e, a);
4
4
  import { cloneDeep as h } from "lodash";
5
5
  import { SHJDatasourceV2 as b } from "../index.mjs";
6
6
  import "../../event/actions/fullScreenAction.mjs";
@@ -86,10 +86,10 @@ const r = class r {
86
86
  */
87
87
  static setEnvironments(e) {
88
88
  const a = e.find((t) => t.selected);
89
- window._apiEnvironment = {
89
+ a && (window._apiEnvironment = {
90
90
  envName: a.envName,
91
91
  envBaseUrl: a.envBaseUrl
92
- };
92
+ });
93
93
  }
94
94
  /**
95
95
  * 获取变量数据
@@ -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 m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c412c185"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-56e45189"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as M, computed as Z, shallowRef as O, ref as f, onMounted as K, nextTick as q, onUnmounted as Q, watch as p, createElementBlock as B, openBlock as I, normalizeClass as X, createElementVNode as x } from "vue";
2
- import Y from "@amap/amap-jsapi-loader";
3
- import $ from "axios";
4
- import { nanoid as _ } 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 ee } from "../../../../commons/plugins/datasource/index.mjs";
160
- import { SHJParseEvent as y } from "../../../../commons/plugins/event/index.mjs";
159
+ import { SHJDatasourceV2 as ae } from "../../../../commons/plugins/datasource/index.mjs";
160
+ import { SHJParseEvent as v } from "../../../../commons/plugins/event/index.mjs";
161
161
  import "lodash";
162
- import { upgradeAmap2d as te } from "./version.mjs";
163
- const re = {
164
- key: 1,
165
- class: "w-full h-full flex flex-col items-center justify-center"
166
- }, ae = M({ name: "ShjAmap2d" }), oa = /* @__PURE__ */ M({
167
- ...ae,
162
+ import { upgradeAmap2d as oe } from "./version.mjs";
163
+ const le = { class: "relative w-full h-full" }, se = {
164
+ key: 0,
165
+ class: "empty-wrap"
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,11 +183,11 @@ const re = {
179
183
  "amap2d-scene-dragging",
180
184
  "amap2d-scene-dragend"
181
185
  ],
182
- setup(m, { expose: W, emit: A }) {
183
- const s = Z(() => te(m.option)), d = A, o = O(), c = O(), z = f(!1), g = f(), h = f(), b = f(), u = f(), v = (t) => {
184
- E(), 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 = {
185
189
  securityJsCode: t.basic.securityJsCode
186
- }, Y.load({
190
+ }, ee.load({
187
191
  key: t.basic.key,
188
192
  // 申请好的Web端开发者Key,首次调用 load 时必填
189
193
  version: "2.0",
@@ -228,98 +232,99 @@ const re = {
228
232
  mapStyle: t.config.mapStyle,
229
233
  features: t.config.features,
230
234
  layers: [r]
231
- }), c.value = new window.Loca.Container({
235
+ }), m.value = new window.Loca.Container({
232
236
  map: o.value
233
- }), b.value = new u.value.Scale({
237
+ }), k.value = new u.value.Scale({
234
238
  visible: t.config.plugin.scale.visible,
235
239
  position: {
236
240
  left: t.config.plugin.scale.position.left + "px",
237
241
  bottom: t.config.plugin.scale.position.bottom + "px"
238
242
  }
239
- }), o.value.addControl(b.value), g.value = new e.ControlBar({
243
+ }), o.value.addControl(k.value), h.value = new e.ControlBar({
240
244
  visible: t.config.plugin.controlBar.visible,
241
245
  showControlButton: t.config.plugin.controlBar.showControlButton,
242
246
  position: {
243
247
  right: t.config.plugin.controlBar.position.right + "px",
244
248
  top: t.config.plugin.controlBar.position.top + "px"
245
249
  }
246
- }), o.value.addControl(g.value), h.value = new e.ToolBar({
250
+ }), o.value.addControl(h.value), b.value = new e.ToolBar({
247
251
  visible: t.config.plugin.toolBar.visible,
248
252
  position: {
249
253
  left: t.config.plugin.toolBar.position.left + "px",
250
254
  top: t.config.plugin.toolBar.position.top + "px"
251
255
  }
252
- }), o.value.addControl(h.value), C(e), o.value.on("complete", () => {
256
+ }), o.value.addControl(b.value), E(e), o.value.on("complete", () => {
253
257
  setTimeout(() => {
254
- z.value = !0, d("amap2d-scene-success"), y.parseEvents(m.useEvents, "amap2d-scene-success", null);
258
+ g.value = !0, d("amap2d-scene-success"), v.parseEvents(c.useEvents, "amap2d-scene-success", null);
255
259
  }, 666);
256
260
  }), o.value.on("zoomstart", () => {
257
- d("amap2d-scene-zoomstart"), y.parseEvents(m.useEvents, "amap2d-scene-zoomstart", null);
261
+ d("amap2d-scene-zoomstart"), v.parseEvents(c.useEvents, "amap2d-scene-zoomstart", null);
258
262
  }), o.value.on("zoomend", () => {
259
- d("amap2d-scene-zoomend"), y.parseEvents(m.useEvents, "amap2d-scene-zoomend", null);
263
+ d("amap2d-scene-zoomend"), v.parseEvents(c.useEvents, "amap2d-scene-zoomend", null);
260
264
  }), o.value.on("click", (a) => {
261
- d("amap2d-scene-mapclick", a.lnglat), y.parseEvents(m.useEvents, "amap2d-scene-mapclick", a.lnglat);
265
+ d("amap2d-scene-mapclick", a.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-mapclick", a.lnglat);
262
266
  }), o.value.on("dragstart", (a) => {
263
- d("amap2d-scene-dragstart", a.lnglat), y.parseEvents(
264
- m.useEvents,
267
+ d("amap2d-scene-dragstart", a.lnglat), v.parseEvents(
268
+ c.useEvents,
265
269
  "amap2d-scene-dragstart",
266
270
  a.lnglat
267
271
  );
268
272
  }), o.value.on("dragend", (a) => {
269
- d("amap2d-scene-dragend", a.lnglat), y.parseEvents(m.useEvents, "amap2d-scene-dragend", a.lnglat);
273
+ d("amap2d-scene-dragend", a.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-dragend", a.lnglat);
270
274
  });
271
275
  }).catch((e) => {
276
+ g.value = !1, w.value = "缺少必要的Key和密钥,请先在右侧配置面板中进行配置";
272
277
  });
273
- }, C = (t) => {
274
- m.sources && m.sources.length > 0 ? s.value.widgets.forEach((r, a) => {
275
- ee.parse({
276
- sources: [m.sources[a]],
278
+ }, E = (t) => {
279
+ c.sources && c.sources.length > 0 ? s.value.widgets.forEach((r, a) => {
280
+ ae.parse({
281
+ sources: [c.sources[a]],
277
282
  callback: (l) => {
278
283
  try {
279
- r && r.type === "heatmap" && P(t, r, l.data[0].data), r && r.type === "dotlayers" && N(
284
+ r && r.type === "heatmap" && j(t, r, l.data[0].data), r && r.type === "dotlayers" && F(
280
285
  window.Loca,
281
286
  r,
282
- w(l.data[0].data)
283
- ), r && r.type === "scatter" && j(
287
+ x(l.data[0].data)
288
+ ), r && r.type === "scatter" && G(
284
289
  window.Loca,
285
290
  r,
286
- w(l.data[0].data)
287
- ), r && r.type === "labelsLayer" && F(
291
+ x(l.data[0].data)
292
+ ), r && r.type === "labelsLayer" && H(
288
293
  window.Loca,
289
294
  r,
290
- w(l.data[0].data)
295
+ x(l.data[0].data)
291
296
  );
292
297
  } catch {
293
298
  }
294
299
  s.value.widgets.filter((i) => i.type === "boundary").forEach((i) => {
295
- S(t, i);
300
+ O(t, i);
296
301
  });
297
302
  }
298
303
  });
299
304
  }) : s.value.widgets.filter((r) => r.type === "boundary").forEach((r) => {
300
- S(t, r);
305
+ O(t, r);
301
306
  });
302
307
  const e = o.value.getLayers();
303
308
  for (let r = 0; r < e.length; r++)
304
309
  (e[r].type === "sketchTileLayer" || e[r]._opts.type === "sketchImageLayer") && o.value.removeLayer(e[r]);
305
310
  s.value.widgets.filter((r) => r.type === "sketchTile").forEach((r) => {
306
- const a = T(r);
311
+ const a = P(r);
307
312
  a && o.value.addLayer(a);
308
313
  }), s.value.widgets.filter((r) => r.type === "sketchImage").forEach((r) => {
309
- const a = J(r);
314
+ const a = N(r);
310
315
  o.value.addLayer(a);
311
316
  });
312
- }, D = (t) => {
317
+ }, J = (t) => {
313
318
  const r = t.slice(
314
319
  t.indexOf("(") + 1,
315
320
  t.lastIndexOf(")")
316
321
  ).split(",").map((l) => l.trim()), a = {};
317
322
  for (let l = 1; l < r.length; l++) {
318
- const i = r[l].split(" "), n = i[0], k = parseFloat(i[1]) / 100, U = Math.round(k * 100) / 100;
319
- a[U] = 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;
320
325
  }
321
326
  return a;
322
- }, T = (t) => {
327
+ }, P = (t) => {
323
328
  try {
324
329
  return new u.value.TileLayer({
325
330
  bounds: new u.value.Bounds(
@@ -341,7 +346,7 @@ const re = {
341
346
  } catch {
342
347
  }
343
348
  return null;
344
- }, J = (t) => {
349
+ }, N = (t) => {
345
350
  try {
346
351
  return new u.value.ImageLayer({
347
352
  bounds: new u.value.Bounds(
@@ -360,13 +365,13 @@ const re = {
360
365
  } catch {
361
366
  }
362
367
  return null;
363
- }, P = (t, e, r) => {
368
+ }, j = (t, e, r) => {
364
369
  try {
365
370
  const a = new t.HeatMap(o.value, {
366
371
  radius: e.radius,
367
372
  // 给定半径
368
373
  opacity: e.opacity,
369
- gradient: D(e.gradient)
374
+ gradient: J(e.gradient)
370
375
  });
371
376
  setTimeout(() => {
372
377
  a.setDataSet({
@@ -376,9 +381,9 @@ const re = {
376
381
  }, 0);
377
382
  } catch {
378
383
  }
379
- }, S = async (t, e) => {
384
+ }, O = async (t, e) => {
380
385
  try {
381
- const r = await $.get(e.geojson);
386
+ const r = await te.get(e.geojson);
382
387
  if (r.status === 200) {
383
388
  const a = new t.GeoJSON({
384
389
  geoJSON: r.data,
@@ -430,7 +435,7 @@ const re = {
430
435
  }
431
436
  } catch {
432
437
  }
433
- }, N = (t, e, r) => {
438
+ }, F = (t, e, r) => {
434
439
  try {
435
440
  const a = new t.GeoJSONSource({
436
441
  data: r
@@ -447,7 +452,7 @@ const re = {
447
452
  blurWidth: e.style.blurWidth,
448
453
  borderColor: e.style.borderColor
449
454
  };
450
- l.setSource(a), l.setStyle(i), c.value.add(l), l.addAnimate({
455
+ l.setSource(a), l.setStyle(i), m.value.add(l), l.addAnimate({
451
456
  key: e.animate.key,
452
457
  value: e.animate.value,
453
458
  duration: e.animate.duration,
@@ -460,12 +465,12 @@ const re = {
460
465
  });
461
466
  } catch {
462
467
  }
463
- }, j = (t, e, r) => {
468
+ }, G = (t, e, r) => {
464
469
  try {
465
470
  const a = new t.GeoJSONSource({
466
471
  data: r
467
472
  }), l = new t.ScatterLayer({
468
- loca: c.value,
473
+ loca: m.value,
469
474
  zIndex: e.zIndex,
470
475
  opacity: e.opacity,
471
476
  visible: e.visible,
@@ -478,10 +483,10 @@ const re = {
478
483
  texture: e.style.texture,
479
484
  duration: e.style.duration,
480
485
  animate: e.style.animate
481
- }), c.value.animate.start();
486
+ }), m.value.animate.start();
482
487
  } catch {
483
488
  }
484
- }, F = (t, e, r) => {
489
+ }, H = (t, e, r) => {
485
490
  try {
486
491
  const a = new t.GeoJSONSource({
487
492
  data: r
@@ -524,14 +529,14 @@ const re = {
524
529
  }), l.on("complete", () => {
525
530
  const i = l.getLabelsLayer().getAllOverlays();
526
531
  for (const n of i)
527
- n.on("click", (k) => {
528
- }), n.on("mouseover", (k) => {
529
- }), n.on("mouseout", (k) => {
532
+ n.on("click", (z) => {
533
+ }), n.on("mouseover", (z) => {
534
+ }), n.on("mouseout", (z) => {
530
535
  });
531
- }), c.value.add(l);
536
+ }), m.value.add(l);
532
537
  } catch {
533
538
  }
534
- }, w = (t) => {
539
+ }, x = (t) => {
535
540
  const e = {
536
541
  type: "FeatureCollection",
537
542
  features: []
@@ -539,7 +544,7 @@ const re = {
539
544
  return t.forEach((r) => {
540
545
  const a = {
541
546
  type: "Feature",
542
- id: _(),
547
+ id: re(),
543
548
  properties: {
544
549
  name: r.name || "",
545
550
  _draw_type: "point"
@@ -551,90 +556,89 @@ const re = {
551
556
  };
552
557
  e.features.push(a);
553
558
  }), e;
554
- }, L = (t) => {
555
- o.value.setFeatures(t.config.features), o.value.setStatus({
559
+ }, B = (t) => {
560
+ o.value && (o.value.setFeatures(t.config.features), o.value.setStatus({
556
561
  dragEnable: t.config.dragEnable,
557
562
  zoomEnable: t.config.zoomEnable,
558
563
  rotateEnable: t.config.rotateEnable
559
- }), 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();
560
- }, G = () => {
561
- o.value && (o.value.clearMap(), c.value.clear(), C(u.value));
562
- }, H = (t) => {
563
- o.value.setMapStyle(t.config.mapStyle);
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());
565
+ }, V = () => {
566
+ o.value && (o.value.clearMap(), m.value.clear(), E(u.value));
564
567
  }, R = (t) => {
565
- o.value.setZoom(t.config.zoom, !1, 200);
566
- }, V = (t) => {
567
- o.value.setCenter(t.config.center, !1, 200);
568
- }, E = () => {
569
- o.value && (o.value.clearMap(), o.value.destroy(), o.value = null, c.value && (c.value.clear(), c.value.destroy(), c.value = null));
568
+ o.value && o.value.setMapStyle(t.config.mapStyle);
569
+ }, U = (t) => {
570
+ o.value && o.value.setZoom(t.config.zoom, !1, 200);
571
+ }, Z = (t) => {
572
+ o.value && o.value.setCenter(t.config.center, !1, 200);
573
+ }, I = () => {
574
+ o.value && (o.value.clearMap(), o.value.destroy(), o.value = null, m.value && (m.value.clear(), m.value.destroy(), m.value = null));
570
575
  };
571
- return K(() => {
572
- q(() => {
573
- v(s.value);
576
+ return Q(() => {
577
+ X(() => {
578
+ f(s.value);
574
579
  });
575
- }), Q(() => E()), p(
580
+ }), Y(() => I()), p(
576
581
  () => s.value.config,
577
582
  () => {
578
- L(s.value);
583
+ B(s.value);
579
584
  },
580
585
  { deep: !0 }
581
586
  ), p(
582
587
  () => s.value.config.zoom,
583
588
  () => {
584
- R(s.value);
589
+ U(s.value);
585
590
  },
586
591
  { deep: !0 }
587
592
  ), p(
588
593
  () => s.value.config.center,
589
594
  () => {
590
- V(s.value);
595
+ Z(s.value);
591
596
  },
592
597
  { deep: !0 }
593
598
  ), p(
594
599
  () => s.value.widgets,
595
600
  () => {
596
- G();
601
+ V();
597
602
  },
598
603
  { deep: !0 }
599
604
  ), p(
600
605
  () => s.value.config.mapStyle,
601
606
  () => {
602
- H(s.value);
607
+ R(s.value);
603
608
  },
604
609
  { deep: !0 }
605
610
  ), p(
606
611
  () => s.value.basic,
607
612
  () => {
608
- v(s.value);
613
+ f(s.value);
609
614
  },
610
615
  { deep: !0 }
611
616
  ), p(
612
- () => m.sources,
617
+ () => c.sources,
613
618
  () => {
614
- v(s.value);
619
+ f(s.value);
615
620
  },
616
621
  { deep: !0 }
617
- ), W({
618
- refresh: () => v(s.value),
619
- refreshView: () => L(s.value),
620
- refreshData: () => v(s.value)
621
- }), (t, e) => z.value ? (I(), B("div", {
622
- key: 0,
623
- class: X(["amap-2d-wrap", { show: z.value }])
624
- }, e[0] || (e[0] = [
625
- x("div", {
626
- id: "zerov-amap-2d",
627
- class: "zerov-amap-container"
628
- }, null, -1)
629
- ]), 2)) : (I(), B("div", re, e[1] || (e[1] = [
630
- x("i", {
631
- class: "iconfont shj-gaodeditu",
632
- style: { "font-size": "48px" }
633
- }, null, -1),
634
- x("p", { class: "text-gray-500" }, " 缺少必要的Key和密钥,请先在右侧配置面板中进行配置 ", -1)
635
- ])));
622
+ ), D({
623
+ refresh: () => f(s.value),
624
+ refreshView: () => B(s.value),
625
+ refreshData: () => f(s.value)
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
+ ]));
636
640
  }
637
641
  });
638
642
  export {
639
- oa as default
643
+ ma as default
640
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 a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5f8abb3e"]]);
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-add171b8"]]);
5
5
  export {
6
6
  a as default
7
7
  };