@shjjs/visual-ui 2.0.6 → 2.0.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.
@@ -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 e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ea4ce3db"]]);
5
5
  export {
6
- m as default
6
+ e 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 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";
5
5
  /* empty css */
6
6
  /* empty css */
7
7
  import "../../../Interaction/components/Tabs/index.mjs";
@@ -156,15 +156,15 @@ 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 re } 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 = {
162
+ import { upgradeAmap2d as ae } from "./version.mjs";
163
+ const oe = {
164
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,
165
+ class: "empty-wrap"
166
+ }, le = A({ name: "ShjAmap2d" }), sa = /* @__PURE__ */ A({
167
+ ...le,
168
168
  props: {
169
169
  option: {},
170
170
  sources: {},
@@ -179,11 +179,21 @@ const re = {
179
179
  "amap2d-scene-dragging",
180
180
  "amap2d-scene-dragend"
181
181
  ],
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 = {
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 = {
185
195
  securityJsCode: t.basic.securityJsCode
186
- }, Y.load({
196
+ }, _.load({
187
197
  key: t.basic.key,
188
198
  // 申请好的Web端开发者Key,首次调用 load 时必填
189
199
  version: "2.0",
@@ -200,9 +210,9 @@ const re = {
200
210
  "AMap.ImageLayer",
201
211
  "AMap.TileLayer"
202
212
  ]
203
- }).then((e) => {
204
- u.value = e;
205
- const r = new u.value.createDefaultLayer({
213
+ }).then((a) => {
214
+ u.value = a;
215
+ const l = new u.value.createDefaultLayer({
206
216
  visible: !0,
207
217
  // 是否可见
208
218
  opacity: 1,
@@ -210,7 +220,7 @@ const re = {
210
220
  zIndex: 0
211
221
  // 叠加层级
212
222
  });
213
- o.value = new e.Map("zerov-amap-2d", {
223
+ o.value = new a.Map(S.value, {
214
224
  rotateEnable: t.config.rotateEnable,
215
225
  // 是否开启地图旋转交互 鼠标右键 + 鼠标画圈移动 或 键盘Ctrl + 鼠标画圈移动
216
226
  pitchEnable: t.config.pitchEnable,
@@ -227,8 +237,8 @@ const re = {
227
237
  // 初始地图中心经纬度
228
238
  mapStyle: t.config.mapStyle,
229
239
  features: t.config.features,
230
- layers: [r]
231
- }), c.value = new window.Loca.Container({
240
+ layers: [l]
241
+ }), m.value = new window.Loca.Container({
232
242
  map: o.value
233
243
  }), b.value = new u.value.Scale({
234
244
  visible: t.config.plugin.scale.visible,
@@ -236,55 +246,55 @@ const re = {
236
246
  left: t.config.plugin.scale.position.left + "px",
237
247
  bottom: t.config.plugin.scale.position.bottom + "px"
238
248
  }
239
- }), o.value.addControl(b.value), g.value = new e.ControlBar({
249
+ }), o.value.addControl(b.value), g.value = new a.ControlBar({
240
250
  visible: t.config.plugin.controlBar.visible,
241
251
  showControlButton: t.config.plugin.controlBar.showControlButton,
242
252
  position: {
243
253
  right: t.config.plugin.controlBar.position.right + "px",
244
254
  top: t.config.plugin.controlBar.position.top + "px"
245
255
  }
246
- }), o.value.addControl(g.value), h.value = new e.ToolBar({
256
+ }), o.value.addControl(g.value), h.value = new a.ToolBar({
247
257
  visible: t.config.plugin.toolBar.visible,
248
258
  position: {
249
259
  left: t.config.plugin.toolBar.position.left + "px",
250
260
  top: t.config.plugin.toolBar.position.top + "px"
251
261
  }
252
- }), o.value.addControl(h.value), C(e), o.value.on("complete", () => {
262
+ }), o.value.addControl(h.value), L(a), o.value.on("complete", () => {
253
263
  setTimeout(() => {
254
- z.value = !0, d("amap2d-scene-success"), y.parseEvents(m.useEvents, "amap2d-scene-success", null);
264
+ z.value = !0, d("amap2d-scene-success"), v.parseEvents(c.useEvents, "amap2d-scene-success", null);
255
265
  }, 666);
256
266
  }), o.value.on("zoomstart", () => {
257
- d("amap2d-scene-zoomstart"), y.parseEvents(m.useEvents, "amap2d-scene-zoomstart", null);
267
+ d("amap2d-scene-zoomstart"), v.parseEvents(c.useEvents, "amap2d-scene-zoomstart", null);
258
268
  }), o.value.on("zoomend", () => {
259
- d("amap2d-scene-zoomend"), y.parseEvents(m.useEvents, "amap2d-scene-zoomend", null);
260
- }), o.value.on("click", (a) => {
261
- d("amap2d-scene-mapclick", a.lnglat), y.parseEvents(m.useEvents, "amap2d-scene-mapclick", a.lnglat);
262
- }), o.value.on("dragstart", (a) => {
263
- d("amap2d-scene-dragstart", a.lnglat), y.parseEvents(
264
- m.useEvents,
269
+ 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(
274
+ c.useEvents,
265
275
  "amap2d-scene-dragstart",
266
- a.lnglat
276
+ i.lnglat
267
277
  );
268
- }), o.value.on("dragend", (a) => {
269
- d("amap2d-scene-dragend", a.lnglat), y.parseEvents(m.useEvents, "amap2d-scene-dragend", a.lnglat);
278
+ }), o.value.on("dragend", (i) => {
279
+ d("amap2d-scene-dragend", i.lnglat), v.parseEvents(c.useEvents, "amap2d-scene-dragend", i.lnglat);
270
280
  });
271
- }).catch((e) => {
281
+ }).catch((a) => {
272
282
  });
273
- }, C = (t) => {
274
- m.sources && m.sources.length > 0 ? s.value.widgets.forEach((r, a) => {
275
- ee.parse({
276
- sources: [m.sources[a]],
283
+ }, L = (t) => {
284
+ c.sources && c.sources.length > 0 ? s.value.widgets.forEach((r, a) => {
285
+ re.parse({
286
+ sources: [c.sources[a]],
277
287
  callback: (l) => {
278
288
  try {
279
- r && r.type === "heatmap" && P(t, r, l.data[0].data), r && r.type === "dotlayers" && N(
289
+ r && r.type === "heatmap" && F(t, r, l.data[0].data), r && r.type === "dotlayers" && G(
280
290
  window.Loca,
281
291
  r,
282
292
  w(l.data[0].data)
283
- ), r && r.type === "scatter" && j(
293
+ ), r && r.type === "scatter" && H(
284
294
  window.Loca,
285
295
  r,
286
296
  w(l.data[0].data)
287
- ), r && r.type === "labelsLayer" && F(
297
+ ), r && r.type === "labelsLayer" && R(
288
298
  window.Loca,
289
299
  r,
290
300
  w(l.data[0].data)
@@ -292,34 +302,34 @@ const re = {
292
302
  } catch {
293
303
  }
294
304
  s.value.widgets.filter((i) => i.type === "boundary").forEach((i) => {
295
- S(t, i);
305
+ E(t, i);
296
306
  });
297
307
  }
298
308
  });
299
309
  }) : s.value.widgets.filter((r) => r.type === "boundary").forEach((r) => {
300
- S(t, r);
310
+ E(t, r);
301
311
  });
302
312
  const e = o.value.getLayers();
303
313
  for (let r = 0; r < e.length; r++)
304
314
  (e[r].type === "sketchTileLayer" || e[r]._opts.type === "sketchImageLayer") && o.value.removeLayer(e[r]);
305
315
  s.value.widgets.filter((r) => r.type === "sketchTile").forEach((r) => {
306
- const a = T(r);
316
+ const a = N(r);
307
317
  a && o.value.addLayer(a);
308
318
  }), s.value.widgets.filter((r) => r.type === "sketchImage").forEach((r) => {
309
- const a = J(r);
319
+ const a = j(r);
310
320
  o.value.addLayer(a);
311
321
  });
312
- }, D = (t) => {
322
+ }, P = (t) => {
313
323
  const r = t.slice(
314
324
  t.indexOf("(") + 1,
315
325
  t.lastIndexOf(")")
316
326
  ).split(",").map((l) => l.trim()), a = {};
317
327
  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;
328
+ const i = r[l].split(" "), n = i[0], k = parseFloat(i[1]) / 100, q = Math.round(k * 100) / 100;
329
+ a[q] = n;
320
330
  }
321
331
  return a;
322
- }, T = (t) => {
332
+ }, N = (t) => {
323
333
  try {
324
334
  return new u.value.TileLayer({
325
335
  bounds: new u.value.Bounds(
@@ -341,7 +351,7 @@ const re = {
341
351
  } catch {
342
352
  }
343
353
  return null;
344
- }, J = (t) => {
354
+ }, j = (t) => {
345
355
  try {
346
356
  return new u.value.ImageLayer({
347
357
  bounds: new u.value.Bounds(
@@ -360,13 +370,13 @@ const re = {
360
370
  } catch {
361
371
  }
362
372
  return null;
363
- }, P = (t, e, r) => {
373
+ }, F = (t, e, r) => {
364
374
  try {
365
375
  const a = new t.HeatMap(o.value, {
366
376
  radius: e.radius,
367
377
  // 给定半径
368
378
  opacity: e.opacity,
369
- gradient: D(e.gradient)
379
+ gradient: P(e.gradient)
370
380
  });
371
381
  setTimeout(() => {
372
382
  a.setDataSet({
@@ -376,9 +386,9 @@ const re = {
376
386
  }, 0);
377
387
  } catch {
378
388
  }
379
- }, S = async (t, e) => {
389
+ }, E = async (t, e) => {
380
390
  try {
381
- const r = await $.get(e.geojson);
391
+ const r = await ee.get(e.geojson);
382
392
  if (r.status === 200) {
383
393
  const a = new t.GeoJSON({
384
394
  geoJSON: r.data,
@@ -430,7 +440,7 @@ const re = {
430
440
  }
431
441
  } catch {
432
442
  }
433
- }, N = (t, e, r) => {
443
+ }, G = (t, e, r) => {
434
444
  try {
435
445
  const a = new t.GeoJSONSource({
436
446
  data: r
@@ -447,7 +457,7 @@ const re = {
447
457
  blurWidth: e.style.blurWidth,
448
458
  borderColor: e.style.borderColor
449
459
  };
450
- l.setSource(a), l.setStyle(i), c.value.add(l), l.addAnimate({
460
+ l.setSource(a), l.setStyle(i), m.value.add(l), l.addAnimate({
451
461
  key: e.animate.key,
452
462
  value: e.animate.value,
453
463
  duration: e.animate.duration,
@@ -460,12 +470,12 @@ const re = {
460
470
  });
461
471
  } catch {
462
472
  }
463
- }, j = (t, e, r) => {
473
+ }, H = (t, e, r) => {
464
474
  try {
465
475
  const a = new t.GeoJSONSource({
466
476
  data: r
467
477
  }), l = new t.ScatterLayer({
468
- loca: c.value,
478
+ loca: m.value,
469
479
  zIndex: e.zIndex,
470
480
  opacity: e.opacity,
471
481
  visible: e.visible,
@@ -478,10 +488,10 @@ const re = {
478
488
  texture: e.style.texture,
479
489
  duration: e.style.duration,
480
490
  animate: e.style.animate
481
- }), c.value.animate.start();
491
+ }), m.value.animate.start();
482
492
  } catch {
483
493
  }
484
- }, F = (t, e, r) => {
494
+ }, R = (t, e, r) => {
485
495
  try {
486
496
  const a = new t.GeoJSONSource({
487
497
  data: r
@@ -528,7 +538,7 @@ const re = {
528
538
  }), n.on("mouseover", (k) => {
529
539
  }), n.on("mouseout", (k) => {
530
540
  });
531
- }), c.value.add(l);
541
+ }), m.value.add(l);
532
542
  } catch {
533
543
  }
534
544
  }, w = (t) => {
@@ -539,7 +549,7 @@ const re = {
539
549
  return t.forEach((r) => {
540
550
  const a = {
541
551
  type: "Feature",
542
- id: _(),
552
+ id: te(),
543
553
  properties: {
544
554
  name: r.name || "",
545
555
  _draw_type: "point"
@@ -551,90 +561,91 @@ const re = {
551
561
  };
552
562
  e.features.push(a);
553
563
  }), e;
554
- }, L = (t) => {
555
- o.value.setFeatures(t.config.features), o.value.setStatus({
564
+ }, O = (t) => {
565
+ o.value && (o.value.setFeatures(t.config.features), o.value.setStatus({
556
566
  dragEnable: t.config.dragEnable,
557
567
  zoomEnable: t.config.zoomEnable,
558
568
  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
- }, 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));
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());
570
+ }, V = () => {
571
+ o.value && (o.value.clearMap(), m.value.clear(), L(u.value));
572
+ }, K = (t) => {
573
+ o.value && o.value.setMapStyle(t.config.mapStyle);
574
+ }, U = (t) => {
575
+ o.value && o.value.setZoom(t.config.zoom, !1, 200);
576
+ }, Z = (t) => {
577
+ o.value && o.value.setCenter(t.config.center, !1, 200);
578
+ }, x = () => {
579
+ o.value && (o.value.clearMap(), o.value.destroy(), o.value = null, m.value && (m.value.clear(), m.value.destroy(), m.value = null));
570
580
  };
571
- return K(() => {
572
- q(() => {
573
- v(s.value);
581
+ return Q(() => {
582
+ X(() => {
583
+ f(s.value);
574
584
  });
575
- }), Q(() => E()), p(
585
+ }), Y(() => x()), p(
576
586
  () => s.value.config,
577
587
  () => {
578
- L(s.value);
588
+ O(s.value);
579
589
  },
580
590
  { deep: !0 }
581
591
  ), p(
582
592
  () => s.value.config.zoom,
583
593
  () => {
584
- R(s.value);
594
+ U(s.value);
585
595
  },
586
596
  { deep: !0 }
587
597
  ), p(
588
598
  () => s.value.config.center,
589
599
  () => {
590
- V(s.value);
600
+ Z(s.value);
591
601
  },
592
602
  { deep: !0 }
593
603
  ), p(
594
604
  () => s.value.widgets,
595
605
  () => {
596
- G();
606
+ V();
597
607
  },
598
608
  { deep: !0 }
599
609
  ), p(
600
610
  () => s.value.config.mapStyle,
601
611
  () => {
602
- H(s.value);
612
+ K(s.value);
603
613
  },
604
614
  { deep: !0 }
605
615
  ), p(
606
616
  () => s.value.basic,
607
617
  () => {
608
- v(s.value);
618
+ f(s.value);
609
619
  },
610
620
  { deep: !0 }
611
621
  ), p(
612
- () => m.sources,
622
+ () => c.sources,
613
623
  () => {
614
- v(s.value);
624
+ f(s.value);
615
625
  },
616
626
  { 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", {
627
+ ), D({
628
+ refresh: () => f(s.value),
629
+ refreshView: () => O(s.value),
630
+ refreshData: () => f(s.value)
631
+ }), (t, e) => T.value ? (W(), M("div", {
622
632
  key: 0,
623
- class: X(["amap-2d-wrap", { show: z.value }])
624
- }, e[0] || (e[0] = [
625
- x("div", {
626
- id: "zerov-amap-2d",
633
+ class: $(["amap-2d-wrap", { show: z.value }])
634
+ }, [
635
+ C("div", {
636
+ ref_key: "amap2dContainer",
637
+ ref: S,
627
638
  class: "zerov-amap-container"
628
- }, null, -1)
629
- ]), 2)) : (I(), B("div", re, e[1] || (e[1] = [
630
- x("i", {
639
+ }, null, 512)
640
+ ], 2)) : (W(), M("div", oe, e[0] || (e[0] = [
641
+ C("i", {
631
642
  class: "iconfont shj-gaodeditu",
632
643
  style: { "font-size": "48px" }
633
644
  }, null, -1),
634
- x("p", { class: "text-gray-500" }, " 缺少必要的Key和密钥,请先在右侧配置面板中进行配置 ", -1)
645
+ C("p", { class: "text-gray-500" }, " 缺少必要的Key和密钥,请先在右侧配置面板中进行配置 ", -1)
635
646
  ])));
636
647
  }
637
648
  });
638
649
  export {
639
- oa as default
650
+ sa as default
640
651
  };
@@ -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 c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-94bc752d"]]);
5
5
  export {
6
- a as default
6
+ c as default
7
7
  };