@shjjs/visual-ui 1.0.28 → 1.0.30
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.
- package/es/commons/plugins/datasource/index.mjs +24 -24
- package/es/commons/plugins/datasource/utils/utils.d.ts +1 -1
- package/es/commons/plugins/datasource/utils/utils.mjs +2 -2
- package/es/commons/plugins/event/index.mjs +55 -52
- package/es/components/scene-amap2d/index.vue.mjs +1 -1
- package/es/components/scene-amap2d/index.vue2.mjs +102 -96
- package/es/components/scene-amap3d/index.vue.mjs +2 -2
- package/es/components/scene-amap3d/index.vue2.mjs +64 -58
- package/es/widgets.css +1 -1
- package/lib/commons/plugins/datasource/index.js +2 -2
- package/lib/commons/plugins/datasource/utils/utils.js +1 -1
- package/lib/commons/plugins/event/index.js +4 -4
- package/lib/components/scene-amap2d/index.vue.js +1 -1
- package/lib/components/scene-amap2d/index.vue2.js +1 -1
- package/lib/components/scene-amap3d/index.vue.js +1 -1
- package/lib/components/scene-amap3d/index.vue2.js +4 -4
- package/lib/widgets.css +1 -1
- package/package.json +1 -1
|
@@ -29,23 +29,23 @@ const y = class y {
|
|
|
29
29
|
*/
|
|
30
30
|
static parse({ sources: t, callback: a, tId: e, isStore: s = !1, noUseMapping: i = !1, isInterval: n = !0 }) {
|
|
31
31
|
return a ?? (a = () => {
|
|
32
|
-
}), t && k(t) && t.length > 0 ? new Promise((p, o) => {
|
|
32
|
+
}), t && k(t) && t.length > 0 && t[0] ? new Promise((p, o) => {
|
|
33
33
|
P.cleanupPreviousWebSockets(this.wsInstances, t.map((r) => r.id), e);
|
|
34
|
-
const f = /* @__PURE__ */ new Set(),
|
|
34
|
+
const f = /* @__PURE__ */ new Set(), m = this.wsInstances.get(e) || /* @__PURE__ */ new Set();
|
|
35
35
|
t.forEach((r) => {
|
|
36
36
|
var w;
|
|
37
37
|
if (n) {
|
|
38
|
-
const { source: c } = r,
|
|
38
|
+
const { source: c } = r, u = `${e}-${r.id}`, D = this.datasourceTimer.findIndex((h) => h.id === u);
|
|
39
39
|
if (D !== -1 && (clearInterval(this.datasourceTimer[D].timer), this.datasourceTimer.splice(D, 1)), c.isAutoUpdate) {
|
|
40
|
-
const
|
|
40
|
+
const h = setInterval(() => {
|
|
41
41
|
var l;
|
|
42
|
-
(l = this.task(r, s, i, e, (
|
|
43
|
-
a(
|
|
44
|
-
})) == null || l.then((
|
|
45
|
-
p(
|
|
42
|
+
(l = this.task(r, s, i, e, (d) => {
|
|
43
|
+
a(d);
|
|
44
|
+
})) == null || l.then((d) => {
|
|
45
|
+
p(d);
|
|
46
46
|
});
|
|
47
47
|
}, c.autoUpdateTime * 1e3);
|
|
48
|
-
this.datasourceTimer.push({ id:
|
|
48
|
+
this.datasourceTimer.push({ id: u, timer: h });
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (r.source.type !== "ws") {
|
|
@@ -53,12 +53,12 @@ const y = class y {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
if (P.hasValidWebSocket(this.wsInstances, e, r.id))
|
|
56
|
-
|
|
56
|
+
m.forEach((c) => {
|
|
57
57
|
c.getId() === r.id && f.add(c);
|
|
58
58
|
});
|
|
59
59
|
else {
|
|
60
|
-
const c = $(r, r.id, i, e, (
|
|
61
|
-
p(
|
|
60
|
+
const c = $(r, r.id, i, e, (u) => {
|
|
61
|
+
p(u), a({ data: [{ data: u.finalUserData.data }] }), this.taskStorage(t, u.rawData.data);
|
|
62
62
|
});
|
|
63
63
|
f.add(c);
|
|
64
64
|
}
|
|
@@ -78,8 +78,8 @@ const y = class y {
|
|
|
78
78
|
}) {
|
|
79
79
|
return t ? new Promise((n, p) => {
|
|
80
80
|
let o = null;
|
|
81
|
-
const { source: f } = t,
|
|
82
|
-
|
|
81
|
+
const { source: f } = t, m = this.getParser(f.type);
|
|
82
|
+
m && (o = m(t, t.id, e)), o.then((r) => {
|
|
83
83
|
i(e ? r.noMappingData : r.finalKeyData), this.taskStorage(t, r.rawData.data), n(r);
|
|
84
84
|
});
|
|
85
85
|
}) : (i([]), Promise.resolve([]));
|
|
@@ -126,38 +126,38 @@ const y = class y {
|
|
|
126
126
|
return new Promise(function(p) {
|
|
127
127
|
const o = I({ id: s, data: a });
|
|
128
128
|
y.filterData(t, a).then((f) => {
|
|
129
|
-
const
|
|
129
|
+
const m = I({ id: s, data: f });
|
|
130
130
|
if (n)
|
|
131
131
|
p({
|
|
132
132
|
id: s,
|
|
133
133
|
finalKeyData: [],
|
|
134
134
|
finalUserData: { id: s, data: f },
|
|
135
|
-
filteredData:
|
|
135
|
+
filteredData: m,
|
|
136
136
|
rawData: o,
|
|
137
137
|
noMappingData: f
|
|
138
138
|
});
|
|
139
139
|
else {
|
|
140
140
|
let r = [];
|
|
141
|
-
k(f) && (r = f.map((
|
|
142
|
-
const
|
|
141
|
+
k(f) && (r = f.map((u, D) => {
|
|
142
|
+
const h = {};
|
|
143
143
|
if (i && i && D === 0) {
|
|
144
144
|
const l = [];
|
|
145
|
-
for (const
|
|
146
|
-
const T = e.find((b) => b.name ===
|
|
147
|
-
T ? l.push({ alias: T.alias, name:
|
|
145
|
+
for (const d in u) {
|
|
146
|
+
const T = e.find((b) => b.name === d);
|
|
147
|
+
T ? l.push({ alias: T.alias, name: d, type: "any", label: d, mapping: T.mapping, status: !0 }) : l.push({ alias: d, name: d, type: "any", label: d, mapping: d, status: !0 });
|
|
148
148
|
}
|
|
149
149
|
e.splice(0, e.length), e.push(...l);
|
|
150
150
|
}
|
|
151
151
|
return e.forEach((l) => {
|
|
152
|
-
l.alias ?
|
|
153
|
-
}),
|
|
152
|
+
l.alias ? h[l.alias] = u[l.mapping] : h[l.name] = u[l.mapping];
|
|
153
|
+
}), h.userdata = u, h;
|
|
154
154
|
}));
|
|
155
155
|
const w = I({ id: s, data: r }), c = I({ id: s, data: y.parseMappedData(r, e, s) });
|
|
156
156
|
p({
|
|
157
157
|
id: s,
|
|
158
158
|
finalKeyData: r.length === 0 ? { id: s, data: f } : c,
|
|
159
159
|
finalUserData: r.length === 0 ? { id: s, data: f } : w,
|
|
160
|
-
filteredData:
|
|
160
|
+
filteredData: m,
|
|
161
161
|
rawData: o,
|
|
162
162
|
noMappingData: []
|
|
163
163
|
});
|
|
@@ -90,7 +90,7 @@ export declare class DataSourceUtils {
|
|
|
90
90
|
static getNestedValue(obj: any, path: string): any;
|
|
91
91
|
/**
|
|
92
92
|
* 从路径字符串中提取变量名
|
|
93
|
-
* @param path 路径字符串,例如 "test
|
|
93
|
+
* @param path 路径字符串,例如 "测试.test" 或 "333[0].aa"
|
|
94
94
|
* @returns 提取出的变量名
|
|
95
95
|
*/
|
|
96
96
|
static extractVariableName(path: string): string;
|
|
@@ -174,11 +174,11 @@ class o {
|
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
176
|
* 从路径字符串中提取变量名
|
|
177
|
-
* @param path 路径字符串,例如 "test
|
|
177
|
+
* @param path 路径字符串,例如 "测试.test" 或 "333[0].aa"
|
|
178
178
|
* @returns 提取出的变量名
|
|
179
179
|
*/
|
|
180
180
|
static extractVariableName(e) {
|
|
181
|
-
const n = e.match(/^([
|
|
181
|
+
const n = e.match(/^([\u4e00-\u9fa5a-zA-Z0-9_][\u4e00-\u9fa5a-zA-Z0-9_]*)/);
|
|
182
182
|
return n ? n[1] : "";
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var f = (
|
|
3
|
-
var
|
|
4
|
-
import { cloneDeep as
|
|
5
|
-
import { executeLinkAction as
|
|
6
|
-
import { executeMoveAction as
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var f = (s, e, t) => e in s ? d(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var m = (s, e, t) => f(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { cloneDeep as y } from "lodash";
|
|
5
|
+
import { executeLinkAction as A } from "./actions/linkAction.mjs";
|
|
6
|
+
import { executeMoveAction as g } from "./actions/moveAction.mjs";
|
|
7
7
|
import { executeSendApiAction as h } from "./actions/sendApiAction.mjs";
|
|
8
8
|
import { executeScaleAction as x } from "./actions/scaleAction.mjs";
|
|
9
|
-
import { executeRotateAction as
|
|
10
|
-
import { executeUpdatePageAction as
|
|
11
|
-
import { executeInvokeAction as
|
|
12
|
-
import { executeFullScreenAction as
|
|
9
|
+
import { executeRotateAction as S } from "./actions/rotateAction.mjs";
|
|
10
|
+
import { executeUpdatePageAction as b } from "./actions/updatePageAction.mjs";
|
|
11
|
+
import { executeInvokeAction as E } from "./actions/invokeAction.mjs";
|
|
12
|
+
import { executeFullScreenAction as V } from "./actions/fullScreenAction.mjs";
|
|
13
13
|
import { executeUpdateVariableAction as w } from "./actions/updateVariableAction.mjs";
|
|
14
14
|
import { executeUpdateWidgetAction as M } from "./actions/updateWidgetAction.mjs";
|
|
15
15
|
import { executeUeCommonsWebscoketAction as U } from "./actions/ueCommonsWebscoketAction.mjs";
|
|
16
16
|
import { executeUeShjExecMethodAction as k } from "./actions/ueShjExecMethodAction.mjs";
|
|
17
17
|
import { executeUnityWebglExecMethodAction as C } from "./actions/unityWebglExecMethodAction.mjs";
|
|
18
|
-
import { executeUnityIframeExecMethodAction as
|
|
19
|
-
import { executeVrSceneMethodAction as
|
|
18
|
+
import { executeUnityIframeExecMethodAction as D } from "./actions/unityIframeExecMethodAction.mjs";
|
|
19
|
+
import { executeVrSceneMethodAction as N } from "./actions/vrSceneMethodAction.mjs";
|
|
20
|
+
import { DataSourceUtils as l } from "../datasource/utils/utils.mjs";
|
|
20
21
|
class W {
|
|
21
22
|
/**
|
|
22
23
|
* 添加事件解析器
|
|
@@ -24,8 +25,8 @@ class W {
|
|
|
24
25
|
* @param parser 事件解析器
|
|
25
26
|
*/
|
|
26
27
|
static addAction(e, t) {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const i = Array.from(this.actions).find((r) => r.type === e);
|
|
29
|
+
i && this.actions.delete(i), this.actions.add({ type: e, parser: t });
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* 获取事件解析器
|
|
@@ -33,7 +34,7 @@ class W {
|
|
|
33
34
|
* @returns 事件解析器
|
|
34
35
|
*/
|
|
35
36
|
static getAction(e) {
|
|
36
|
-
const t = Array.from(this.actions).find((
|
|
37
|
+
const t = Array.from(this.actions).find((i) => i.type === e);
|
|
37
38
|
return t == null ? void 0 : t.parser;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
@@ -42,22 +43,22 @@ class W {
|
|
|
42
43
|
* @param type 事件类型
|
|
43
44
|
* @param params 参数
|
|
44
45
|
*/
|
|
45
|
-
static parseEvents(e, t,
|
|
46
|
-
e != null && e.length && e.forEach((r,
|
|
46
|
+
static parseEvents(e, t, i) {
|
|
47
|
+
e != null && e.length && e.forEach((r, c) => {
|
|
47
48
|
r.eventType === t && setTimeout(() => {
|
|
48
49
|
const u = new CustomEvent("event-params-log", {
|
|
49
50
|
detail: {
|
|
50
51
|
eventId: r.id,
|
|
51
|
-
params:
|
|
52
|
+
params: i
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
window.dispatchEvent(u);
|
|
55
|
-
const
|
|
56
|
-
if (!this.conditionLogic(r,
|
|
56
|
+
const p = this.filterEvent(r, i);
|
|
57
|
+
if (!this.conditionLogic(r, p) || !r.actions)
|
|
57
58
|
return;
|
|
58
59
|
const n = this.getAction(r.actions);
|
|
59
|
-
n && n(r,
|
|
60
|
-
}, r.delay +
|
|
60
|
+
n && n(r, p);
|
|
61
|
+
}, r.delay + c * 10);
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
@@ -67,19 +68,20 @@ class W {
|
|
|
67
68
|
* @returns 过滤后的参数
|
|
68
69
|
*/
|
|
69
70
|
static filterEvent(e, t) {
|
|
70
|
-
let
|
|
71
|
+
let i = y(t);
|
|
71
72
|
if (e.filterCode)
|
|
72
73
|
try {
|
|
73
|
-
const r =
|
|
74
|
+
const r = l.getVariableData();
|
|
75
|
+
let c = `
|
|
74
76
|
${e.filterCode}
|
|
75
77
|
|
|
76
78
|
// 在这里调用 filter 函数,并传递 data 参数
|
|
77
79
|
return filter(data);
|
|
78
80
|
`;
|
|
79
|
-
|
|
81
|
+
c = c.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, ""), c = l.replaceStringVariables(c, r), i = new Function("data", c)(t);
|
|
80
82
|
} catch {
|
|
81
83
|
}
|
|
82
|
-
return
|
|
84
|
+
return i;
|
|
83
85
|
}
|
|
84
86
|
/**
|
|
85
87
|
* 条件逻辑判断
|
|
@@ -88,68 +90,69 @@ class W {
|
|
|
88
90
|
* @returns 是否通过
|
|
89
91
|
*/
|
|
90
92
|
static conditionLogic(e, t) {
|
|
91
|
-
var u,
|
|
92
|
-
if (!((
|
|
93
|
+
var u, p;
|
|
94
|
+
if (!((p = (u = e.condition) == null ? void 0 : u.list) != null && p.length))
|
|
93
95
|
return !0;
|
|
94
|
-
const
|
|
96
|
+
const i = (n) => {
|
|
95
97
|
if (n.type === "field") {
|
|
96
98
|
if (!n.conditionName) return !1;
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
99
|
+
const a = t[n.conditionName];
|
|
100
|
+
if (a === void 0) return !1;
|
|
101
|
+
const o = n.conditionValue;
|
|
100
102
|
switch (n.conditionExpression) {
|
|
101
103
|
case "eq":
|
|
102
|
-
return
|
|
104
|
+
return a.toString() === (o || "").toString();
|
|
103
105
|
case "neq":
|
|
104
|
-
return
|
|
106
|
+
return a !== o;
|
|
105
107
|
case "lt":
|
|
106
|
-
return
|
|
108
|
+
return a < Number(o);
|
|
107
109
|
case "gt":
|
|
108
|
-
return
|
|
110
|
+
return a > Number(o);
|
|
109
111
|
case "lte":
|
|
110
|
-
return
|
|
112
|
+
return a <= Number(o);
|
|
111
113
|
case "gte":
|
|
112
|
-
return
|
|
114
|
+
return a >= Number(o);
|
|
113
115
|
case "includes":
|
|
114
|
-
return
|
|
116
|
+
return a.includes(o);
|
|
115
117
|
case "noincludes":
|
|
116
|
-
return !
|
|
118
|
+
return !a.includes(o);
|
|
117
119
|
default:
|
|
118
120
|
return !1;
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
if (n.type === "custom")
|
|
122
124
|
try {
|
|
123
|
-
const
|
|
125
|
+
const a = l.getVariableData();
|
|
126
|
+
let o = `
|
|
124
127
|
${n.customValue}
|
|
125
128
|
return condition(data);
|
|
126
129
|
`;
|
|
127
|
-
return new Function("data",
|
|
130
|
+
return o = o.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, ""), o = l.replaceStringVariables(o, a), new Function("data", o)(t);
|
|
128
131
|
} catch {
|
|
129
132
|
return !1;
|
|
130
133
|
}
|
|
131
134
|
return !1;
|
|
132
|
-
}, r = e.condition.list.map(
|
|
135
|
+
}, r = e.condition.list.map(i);
|
|
133
136
|
return e.condition.type === "and" ? r.every(Boolean) : r.some(Boolean);
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
/** 事件动作 */
|
|
137
|
-
|
|
138
|
-
{ type: "link", parser:
|
|
140
|
+
m(W, "actions", /* @__PURE__ */ new Set([
|
|
141
|
+
{ type: "link", parser: A },
|
|
139
142
|
{ type: "sendApi", parser: h },
|
|
140
|
-
{ type: "move", parser:
|
|
143
|
+
{ type: "move", parser: g },
|
|
141
144
|
{ type: "scale", parser: x },
|
|
142
|
-
{ type: "rotate", parser:
|
|
143
|
-
{ type: "updatePage", parser:
|
|
144
|
-
{ type: "invoke", parser:
|
|
145
|
-
{ type: "fullscreen", parser:
|
|
145
|
+
{ type: "rotate", parser: S },
|
|
146
|
+
{ type: "updatePage", parser: b },
|
|
147
|
+
{ type: "invoke", parser: E },
|
|
148
|
+
{ type: "fullscreen", parser: V },
|
|
146
149
|
{ type: "updateVariable", parser: w },
|
|
147
150
|
{ type: "updateWidget", parser: M },
|
|
148
151
|
{ type: "ueCommonsWebscoket", parser: U },
|
|
149
152
|
{ type: "ueShjExecMethod", parser: k },
|
|
150
153
|
{ type: "unityWebglExecMethod", parser: C },
|
|
151
|
-
{ type: "unityIframeExecMethod", parser:
|
|
152
|
-
{ type: "vrSceneMethod", parser:
|
|
154
|
+
{ type: "unityIframeExecMethod", parser: D },
|
|
155
|
+
{ type: "vrSceneMethod", parser: N }
|
|
153
156
|
]));
|
|
154
157
|
export {
|
|
155
158
|
W as SHJParseEvent
|
|
@@ -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 p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-1a9e6290"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|