@shjjs/visual-ui 3.0.8 → 3.0.9

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,21 +1,21 @@
1
- var w = Object.defineProperty;
2
- var x = (p, t, e) => t in p ? w(p, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : p[t] = e;
3
- var f = (p, t, e) => x(p, typeof t != "symbol" ? t + "" : t, e);
4
- import { cloneDeep as k, isString as C } from "lodash";
5
- import { parseStaticData as M } from "./sources/static.mjs";
6
- import { parseUrlData as v } from "./sources/url.mjs";
7
- import { parseVariableData as A } from "./sources/variable.mjs";
8
- import { parseAPIPort as E } from "./sources/api.mjs";
9
- import { DataSourceUtils as U } from "./utils/utils.mjs";
10
- import { parseStorage as B } from "./sources/storage.mjs";
11
- import { parseMqttData as T } from "./sources/mqtt.mjs";
12
- import { parseWebSocketData as W } from "./sources/websocket.mjs";
13
- import { MqttConnectionPoolManager as d } from "./utils/mqttConnectionPool.mjs";
14
- import { WebSocketConnectionPoolManager as S } from "./utils/websocketConnectionPool.mjs";
15
- import { mappingData as q } from "./utils/mappingData.mjs";
16
- import { groupData as K } from "./utils/groupData.mjs";
17
- import { storageData as m } from "./utils/storageData.mjs";
18
- const l = class l {
1
+ var x = Object.defineProperty;
2
+ var k = (l, t, e) => t in l ? x(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
+ var h = (l, t, e) => k(l, typeof t != "symbol" ? t + "" : t, e);
4
+ import { cloneDeep as C, isString as M } from "lodash";
5
+ import { parseStaticData as v } from "./sources/static.mjs";
6
+ import { parseUrlData as A } from "./sources/url.mjs";
7
+ import { parseVariableData as E } from "./sources/variable.mjs";
8
+ import { parseAPIPort as U } from "./sources/api.mjs";
9
+ import { DataSourceUtils as B } from "./utils/utils.mjs";
10
+ import { parseStorage as T } from "./sources/storage.mjs";
11
+ import { parseMqttData as W } from "./sources/mqtt.mjs";
12
+ import { parseWebSocketData as q } from "./sources/websocket.mjs";
13
+ import { MqttConnectionPoolManager as S } from "./utils/mqttConnectionPool.mjs";
14
+ import { WebSocketConnectionPoolManager as D } from "./utils/websocketConnectionPool.mjs";
15
+ import { mappingData as K } from "./utils/mappingData.mjs";
16
+ import { groupData as b } from "./utils/groupData.mjs";
17
+ import { storageData as g } from "./utils/storageData.mjs";
18
+ const c = class c {
19
19
  /**
20
20
  * 添加数据源解析器
21
21
  * @param type - 数据源类型
@@ -224,7 +224,7 @@ const l = class l {
224
224
  r(s);
225
225
  return;
226
226
  }
227
- e ? (m(o.source.storage, s.noMappingData), r(s.noMappingData)) : (m(o.source.storage, s.finalKeyData), r(s.finalKeyData));
227
+ e ? (g(o.source.storage, s.noMappingData), r(s.noMappingData)) : (g(o.source.storage, s.finalKeyData), r(s.finalKeyData));
228
228
  });
229
229
  }
230
230
  /**
@@ -236,31 +236,32 @@ const l = class l {
236
236
  * @returns
237
237
  */
238
238
  static processData(t, e, a, r) {
239
- const { filter: o, mapping: i, dynamicMapping: n, isUserdata: s } = k(t);
240
- return new Promise(function(P) {
241
- const D = e;
242
- l.filterData(o, e).then(
243
- (u) => {
244
- const h = {
239
+ const { filter: o, mapping: i, dynamicMapping: n, isUserdata: s } = C(t);
240
+ return new Promise(function(y) {
241
+ const w = e;
242
+ c.filterData(o, e).then(
243
+ (p) => {
244
+ var d;
245
+ const u = {
245
246
  id: a,
246
247
  finalKeyData: { id: a, data: null },
247
248
  finalUserData: { id: a, data: null },
248
- filteredData: { id: a, data: u },
249
- rawData: { id: a, data: D },
249
+ filteredData: { id: a, data: p },
250
+ rawData: { id: a, data: w },
250
251
  noMappingData: null
251
252
  };
252
253
  if (r)
253
- h.finalUserData.data = u, h.noMappingData = u;
254
+ u.finalUserData.data = u.noMappingData = p;
254
255
  else {
255
- const { mappedData: c, finalMapping: y } = q(
256
- u,
256
+ const f = K(
257
+ p,
257
258
  i,
258
259
  n,
259
260
  s
260
- );
261
- h.finalKeyData.data = c != null && c.length ? K(c, y) : u, h.finalUserData.data = c != null && c.length ? c : u;
261
+ ), m = !!((d = f.mappedData) != null && d.length);
262
+ u.finalKeyData.data = m ? b(f.mappedData, f.finalMapping) : p, u.finalUserData.data = m ? f.mappedData : p;
262
263
  }
263
- P(h);
264
+ y(u);
264
265
  }
265
266
  );
266
267
  });
@@ -272,11 +273,11 @@ const l = class l {
272
273
  * @returns
273
274
  */
274
275
  static async filterData(t, e) {
275
- if (!C(t))
276
+ if (!M(t))
276
277
  return e;
277
278
  try {
278
279
  let a = t.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, "");
279
- a = U.replaceStringVariables(a);
280
+ a = B.replaceStringVariables(a);
280
281
  const r = `
281
282
  ${a}
282
283
  if (typeof filter !== 'function') {
@@ -295,38 +296,38 @@ const l = class l {
295
296
  static destroy() {
296
297
  this.timerPool.forEach((t) => {
297
298
  clearInterval(t);
298
- }), this.timerPool.clear(), this.dataSourceStatePool.clear(), this.dataSourceStatePool = /* @__PURE__ */ new Map(), this.waitingPool.clear(), this.waitingPool = /* @__PURE__ */ new Map(), d.closeAllConnections(), S.closeAllConnections();
299
+ }), this.timerPool.clear(), this.dataSourceStatePool.clear(), this.dataSourceStatePool = /* @__PURE__ */ new Map(), this.waitingPool.clear(), this.waitingPool = /* @__PURE__ */ new Map(), S.closeAllConnections(), D.closeAllConnections();
299
300
  }
300
301
  static clearMqttConnectionById(t) {
301
- d.removeConnectionByUUID(t);
302
+ S.removeConnectionByUUID(t);
302
303
  }
303
304
  static clearWebSocketConnectionById(t) {
304
- S.removeConnectionByUUID(t);
305
+ D.removeConnectionByUUID(t);
305
306
  }
306
307
  };
307
308
  /**
308
309
  * 定时器池
309
310
  */
310
- f(l, "timerPool", /* @__PURE__ */ new Map()), /**
311
+ h(c, "timerPool", /* @__PURE__ */ new Map()), /**
311
312
  * 数据源状态池 - 跟踪所有数据源的执行状态
312
313
  */
313
- f(l, "dataSourceStatePool", /* @__PURE__ */ new Map()), /**
314
+ h(c, "dataSourceStatePool", /* @__PURE__ */ new Map()), /**
314
315
  * 等待执行的数据源池 - 存储因依赖关系而等待的数据源
315
316
  */
316
- f(l, "waitingPool", /* @__PURE__ */ new Map()), /**
317
+ h(c, "waitingPool", /* @__PURE__ */ new Map()), /**
317
318
  * 数据源解析器
318
319
  */
319
- f(l, "parsers", /* @__PURE__ */ new Set([
320
- { type: "url", parser: v },
321
- { type: "static", parser: M },
322
- { type: "variable", parser: A },
323
- { type: "api", parser: E },
324
- { type: "storage", parser: B },
325
- { type: "mqtt", parser: T },
326
- { type: "ws", parser: W }
320
+ h(c, "parsers", /* @__PURE__ */ new Set([
321
+ { type: "url", parser: A },
322
+ { type: "static", parser: v },
323
+ { type: "variable", parser: E },
324
+ { type: "api", parser: U },
325
+ { type: "storage", parser: T },
326
+ { type: "mqtt", parser: W },
327
+ { type: "ws", parser: q }
327
328
  ]));
328
- let g = l;
329
+ let P = c;
329
330
  export {
330
- U as DataSourceUtils,
331
- g as SHJDatasourceV2
331
+ B as DataSourceUtils,
332
+ P as SHJDatasourceV2
332
333
  };
@@ -5,7 +5,7 @@ import { cloneDeep as g } from "lodash";
5
5
  import { SHJDatasourceV2 as u } from "../index.mjs";
6
6
  import { storageData as V } from "./storageData.mjs";
7
7
  import "../../event/actions/fullScreenAction.mjs";
8
- import { EventUtils as m } from "../../event/utils/utils.mjs";
8
+ import { EventUtils as h } from "../../event/utils/utils.mjs";
9
9
  const i = class i {
10
10
  static executeAllVariable(a) {
11
11
  a.forEach((e) => {
@@ -87,7 +87,7 @@ const i = class i {
87
87
  }
88
88
  r._callbacks ?? (r._callbacks = /* @__PURE__ */ new Map()), r._callbacks.forEach(
89
89
  (n) => n(a._value)
90
- ), t && m.updateWidgetVariableData(r);
90
+ ), t && h.updateWidgetVariableData(r);
91
91
  }
92
92
  }
93
93
  static getVariableById(a) {
@@ -96,8 +96,8 @@ const i = class i {
96
96
  static getVariableByName(a) {
97
97
  return window._variables.find((e) => e.name === a);
98
98
  }
99
- static getVariableValueByName(a) {
100
- const e = window._variables.find((t) => t.name === a);
99
+ static getVariableValueById(a) {
100
+ const e = window._variables.find((t) => t.id === a);
101
101
  return e ? e._value : null;
102
102
  }
103
103
  static noneData(a) {
@@ -124,7 +124,7 @@ d(i, "addVariable", (a) => {
124
124
  sources: [a.sources],
125
125
  noUseMapping: !0,
126
126
  callback: (e) => {
127
- i.setVariableById(a, e, !1);
127
+ i.setVariableById(a, e, !0);
128
128
  }
129
129
  });
130
130
  }), d(i, "deleteVariableById", (a) => {
@@ -1,7 +1,7 @@
1
1
  var W = Object.defineProperty;
2
- var U = (A, B, e) => B in A ? W(A, B, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[B] = e;
3
- var l = (A, B, e) => U(A, typeof B != "symbol" ? B + "" : B, e);
4
- import { BufferGeometry as E, Mesh as S, Sprite as X, Color as M, AxesHelper as Y, Raycaster as q, Vector2 as H, Group as L, PlaneGeometry as z, TextureLoader as R, sRGBEncoding as _, MeshBasicMaterial as v, DoubleSide as C, RepeatWrapping as k, AdditiveBlending as T, Vector3 as F, MeshStandardMaterial as O, BoxGeometry as V, NearestFilter as J, Shape as Z, ShapeGeometry as K, LineBasicMaterial as ee, Box3Helper as te } from "three";
2
+ var U = (A, w, e) => w in A ? W(A, w, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[w] = e;
3
+ var l = (A, w, e) => U(A, typeof w != "symbol" ? w + "" : w, e);
4
+ import { BufferGeometry as Q, Mesh as S, Sprite as X, Color as M, AxesHelper as Y, Raycaster as q, Vector2 as H, Group as L, PlaneGeometry as z, TextureLoader as R, sRGBEncoding as _, MeshBasicMaterial as v, DoubleSide as C, RepeatWrapping as k, AdditiveBlending as T, Vector3 as F, MeshStandardMaterial as O, BoxGeometry as V, NearestFilter as J, Shape as Z, ShapeGeometry as K, LineBasicMaterial as ee, Box3Helper as te } from "three";
5
5
  import { computeBoundsTree as ae, disposeBoundsTree as ie, acceleratedRaycast as $ } from "three-mesh-bvh";
6
6
  import { pinyin as se } from "pinyin-pro";
7
7
  import { Mini3d as re } from "./mini3d/core/index.mjs";
@@ -17,18 +17,18 @@ import { PathLine as he } from "./mini3d/components/PathLine.mjs";
17
17
  import { Assets as pe } from "./map/assets.mjs";
18
18
  import { ExtrudeMap as ue } from "./map/extrudeMap.mjs";
19
19
  import m from "gsap";
20
- import { isEmpty as Q, isArray as j, isNumber as de, cloneDeep as me } from "lodash";
20
+ import { isEmpty as E, isArray as j, isNumber as de, cloneDeep as me } from "lodash";
21
21
  import { createFloorGaoGuang as fe } from "./module/FloorGaoGuang.mjs";
22
22
  import { createFloorRotateBorder as be } from "./module/FloorRotateBorder.mjs";
23
23
  import { createFloorGridRipple as ye } from "./module/FloorGridRipple.mjs";
24
24
  import { createMirror as ge } from "./module/MapMirror.mjs";
25
25
  import { createTimeLine as Me } from "./module/Timeline.mjs";
26
26
  import { createParticles as Le } from "./module/Particles.mjs";
27
- import { getMapDataByAdcode as Ge, getMapDataByUrl as xe, getTextureResource as I, getMapDataByAdcode2 as we, setScaleArea as Be, calcUv2 as ve } from "./map/utils.mjs";
27
+ import { getMapDataByAdcode as Ge, getMapDataByUrl as xe, getTextureResource as I, getMapDataByAdcode2 as Be, setScaleArea as we, calcUv2 as ve } from "./map/utils.mjs";
28
28
  import { createEnvironment as Se } from "./module/Environment.mjs";
29
29
  import { Utils as D } from "../../../../../commons/utils/utils.mjs";
30
- E.prototype.computeBoundsTree = ae;
31
- E.prototype.disposeBoundsTree = ie;
30
+ Q.prototype.computeBoundsTree = ae;
31
+ Q.prototype.disposeBoundsTree = ie;
32
32
  S.prototype.raycast = $;
33
33
  X.prototype.raycast = $;
34
34
  class et extends re {
@@ -196,7 +196,7 @@ class et extends re {
196
196
  lineMaterial: this.provinceLineMaterial,
197
197
  renderOrder: 9
198
198
  });
199
- this.option.scene.defaultMapAdcode !== 1e5 && Be(this, s), this.areaData = s.coordinates, this.time.on("tick", () => {
199
+ this.option.scene.defaultMapAdcode !== 1e5 && we(this, s), this.areaData = s.coordinates, this.time.on("tick", () => {
200
200
  i.map && (i.map.offset.y += 2e-3);
201
201
  });
202
202
  const o = N(s.mapGroup);
@@ -236,11 +236,11 @@ class et extends re {
236
236
  e.texture,
237
237
  "texture"
238
238
  );
239
- if (Q(s))
239
+ if (E(s))
240
240
  a(!0);
241
241
  else {
242
242
  let o = s.texture;
243
- o.wrapS = o.wrapT = k, o.repeat.set(1, 1), this.pathLineTexture = o, we(
243
+ o.wrapS = o.wrapT = k, o.repeat.set(1, 1), this.pathLineTexture = o, Be(
244
244
  this.option.scene.defaultMapAdcode,
245
245
  (h) => {
246
246
  try {
@@ -404,7 +404,7 @@ class et extends re {
404
404
  transparent: !0,
405
405
  opacity: e.opacity
406
406
  }), s = I(this, "sideMap", t.map, "map");
407
- Q(s) || (s.map.repeat.set(1, 0.2), s.map.offset.y += 0.01);
407
+ E(s) || (s.map.repeat.set(1, 0.2), s.map.offset.y += 0.01);
408
408
  let o = new O({
409
409
  ...s,
410
410
  color: new M(t.color || "#061e47"),
@@ -487,23 +487,23 @@ class et extends re {
487
487
  d.translate(0, 0, p / 2);
488
488
  const g = new S(d, u);
489
489
  g.renderOrder = 22, g.geometry.computeBoundsTree();
490
- let b = g, [x, w] = this.geoProjection(n.coords);
491
- b.position.set(x, -w, (this.depth + 0.46) / this.scale), r ? b.scale.set(1 / this.scale, 1 / this.scale, 0) : b.scale.set(
490
+ let b = g, [x, B] = this.geoProjection(n.coords);
491
+ b.position.set(x, -B, (this.depth + 0.46) / this.scale), r ? b.scale.set(1 / this.scale, 1 / this.scale, 0) : b.scale.set(
492
492
  1 / this.scale,
493
493
  1 / this.scale,
494
494
  1 / this.scale
495
495
  ), b.userData.name = n.name, b.userData.adcode = n.adcode, b.userData.value = n.value, b.userData.position = [
496
496
  x,
497
- -w,
497
+ -B,
498
498
  (this.depth + 0.46) / this.scale
499
499
  ];
500
500
  let G = this.createBarGuangQuan(
501
501
  e.bottom,
502
502
  r
503
503
  );
504
- if (G.position.set(x, -w, (this.depth + 0.46) / this.scale), G.userData.name = n.name, G.userData.adcode = n.adcode, G.userData.position = [
504
+ if (G.position.set(x, -B, (this.depth + 0.46) / this.scale), G.userData.name = n.name, G.userData.adcode = n.adcode, G.userData.position = [
505
505
  x,
506
- -w,
506
+ -B,
507
507
  (this.depth + 0.46) / this.scale
508
508
  ], G.name = "bar-" + e.id, this.barGuangQuanGroup.add(G), e.huiguang.show && p > 0) {
509
509
  let f = this.createBarHUIGUANG(p, e.huiguang);
@@ -513,7 +513,7 @@ class et extends re {
513
513
  let y = i(
514
514
  n,
515
515
  c,
516
- new F(x, -w, (this.depth + 0.9 + p) / this.scale)
516
+ new F(x, -B, (this.depth + 0.9 + p) / this.scale)
517
517
  );
518
518
  this.allBar.push(b), this.allBarMaterial.push(u), this.allBarGuangquan.push(G), this.allBarLabel.push(y);
519
519
  }
@@ -746,7 +746,9 @@ class et extends re {
746
746
  <img src="${e.map}" style="width:${e.width}px; height:${e.height}px;" >
747
747
  </div>`,
748
748
  h
749
- ), this.label3d.setLabelStyle(c, 0.08 / this.scale, "x"), e.rotation && (c.rotation.x = e.rotation[0] * (Math.PI / 180), c.rotation.y = e.rotation[1] * (Math.PI / 180), c.rotation.z = e.rotation[2] * (Math.PI / 180)), c.name = "scatter-" + e.id, c.setParent(this.scatterLabelGroup), c.userData.adcode = s.adcode, c.userData.scale = s, c.userData.name = s.name, c.userData.labelShow = e.label.show, c.userData.value = s.value, c.userData.position = [h.x, h.y, h.z], c;
749
+ ), this.label3d.setLabelStyle(c, 0.08 / this.scale, "x", "auto"), e.rotation && (c.rotation.x = e.rotation[0] * (Math.PI / 180), c.rotation.y = e.rotation[1] * (Math.PI / 180), c.rotation.z = e.rotation[2] * (Math.PI / 180)), c.name = "scatter-" + e.id, c.setParent(this.scatterLabelGroup), c.userData.adcode = s.adcode, c.userData.scale = s, c.userData.name = s.name, c.userData.labelShow = e.label.show, c.userData.value = s.value, c.userData.position = [h.x, h.y, h.z], c.element.style.cursor = "pointer", c.element.addEventListener("click", () => {
750
+ this.onCallBack.onClickScatter(c.userData);
751
+ }), c;
750
752
  };
751
753
  t.map((s, o) => {
752
754
  let [h, n] = this.geoProjection([s.lng, s.lat]), c = i(
@@ -930,12 +932,12 @@ class et extends re {
930
932
  const [f, P] = this.geoProjection(g[y]);
931
933
  y === 0 && x.moveTo(f, -P), x.lineTo(f, -P);
932
934
  }
933
- const w = t.find((y) => y.name === h);
935
+ const B = t.find((y) => y.name === h);
934
936
  let G = e.defaultColor;
935
- if (w)
937
+ if (B)
936
938
  for (let y = 0; y < e.rules.length; y++) {
937
939
  const f = e.rules[y];
938
- w.value >= f.min && w.value <= f.max && (G = f.color || e.defaultColor);
940
+ B.value >= f.min && B.value <= f.max && (G = f.color || e.defaultColor);
939
941
  }
940
942
  try {
941
943
  const y = new K(me(x)), f = new S(
@@ -22,7 +22,7 @@ export declare class DataSourceUtils {
22
22
  static setVariableById(variable: any, value: any, updateWidget?: boolean): void;
23
23
  static getVariableById(id: string): any;
24
24
  static getVariableByName(name: string): any;
25
- static getVariableValueByName(name: string): any;
25
+ static getVariableValueById(id: string): any;
26
26
  static addVariable: (variable: any) => void;
27
27
  static updateVariable: (variable: any) => void;
28
28
  static deleteVariableById: (id: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shjjs/visual-ui",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "国产自研零代码可视化源码工具",
5
5
  "keywords": [
6
6
  "three",