@shjjs/visual-ui 1.0.36 → 1.0.38
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/core/earth/main.vue.d.ts +2 -2
- package/es/commons/core/useChart.mjs +257 -73
- package/es/components/chart/commons/components/common-chart/index.vue.mjs +213 -30
- package/es/components/chart/commons/components/common-chart-map/index.vue.mjs +210 -27
- package/es/components/chart/commons/hooks/useChart.mjs +261 -77
- package/es/components/chart/src/map/bmap-basic/index.vue.d.ts +8 -8
- package/es/components/chart/src/map/bmap-heatmap/index.vue.d.ts +6 -2
- package/es/components/chart-other-candlestick-basic/index.vue.mjs +212 -29
- package/es/components/chart-other-candlestick-demo/index.vue.mjs +213 -30
- package/es/components/chart-other-candlestick-shanghai/index.vue.mjs +214 -31
- package/es/components/chart-other-circular-graph/index.vue.mjs +214 -31
- package/es/components/chart-other-force/index.vue.mjs +212 -29
- package/es/components/chart-other-force2/index.vue.mjs +212 -29
- package/es/components/chart-other-funnel/index.vue.mjs +214 -31
- package/es/components/chart-other-funnel-contrast/index.vue.mjs +214 -31
- package/es/components/chart-other-funnel-split/index.vue.mjs +214 -31
- package/es/components/chart-other-funnel2/index.vue.mjs +214 -31
- package/es/components/chart-other-gauge/index.vue.mjs +214 -31
- package/es/components/chart-other-gauge-grade/index.vue.mjs +214 -31
- package/es/components/chart-other-gauge-stage/index.vue.mjs +214 -31
- package/es/components/chart-other-graph-basic/index.vue.mjs +214 -31
- package/es/components/chart-other-graph-basic2/index.vue.mjs +214 -31
- package/es/components/chart-other-graph-calendar/index.vue.mjs +214 -31
- package/es/components/chart-other-grid-percentage/index.vue.mjs +218 -35
- package/es/components/chart-other-heatmap/index.vue.mjs +212 -29
- package/es/components/chart-other-label-gauge/index.vue.mjs +216 -33
- package/es/components/chart-other-liquidfill/index.vue.mjs +214 -31
- package/es/components/chart-other-parallel-basic/index.vue.mjs +214 -31
- package/es/components/chart-other-parallel-mul/index.vue.mjs +211 -28
- package/es/components/chart-other-radar/index.vue.mjs +224 -41
- package/es/components/chart-other-radar-stack/index.vue.mjs +211 -28
- package/es/components/chart-other-sunburst-basic/index.vue.mjs +212 -29
- package/es/components/chart-other-sunburst-basic2/index.vue.mjs +212 -29
- package/es/components/chart-other-sunburst-basic3/index.vue.mjs +212 -29
- package/es/components/chart-other-sunburst-basic4/index.vue.mjs +212 -29
- package/es/components/chart-other-sunburst-book/index.vue.mjs +212 -29
- package/es/components/chart-other-sunburst-flavors/index.vue.mjs +214 -31
- package/es/components/chart-other-sunburst-radius/index.vue.mjs +212 -29
- package/es/components/chart-other-theme-river/index.vue.mjs +216 -33
- package/es/components/chart-other-tree/index.vue.mjs +214 -31
- package/es/components/chart-other-tree-line/index.vue.mjs +214 -31
- package/es/components/chart-other-treemap/index.vue.mjs +214 -31
- package/es/components/chart-other-treemap-basic/index.vue.mjs +214 -31
- package/es/components/chart-other-word-cloud/index.vue.mjs +216 -33
- package/es/components/commons-echarts/compileAndRunEcharts.mjs +219 -35
- package/es/components/commons-loop-iterator/index.vue.mjs +2 -2
- package/es/components/commons-loop-iterator/index.vue2.mjs +218 -35
- package/es/components/commons-product-model/index.vue.mjs +1 -1
- package/es/components/commons-product-model/index.vue2.mjs +246 -62
- package/es/components/commons-three-loader/index.vue.mjs +1 -1
- package/es/components/commons-three-loader/index.vue2.mjs +257 -73
- package/es/components/commons-three-loader3/index.vue.mjs +1 -1
- package/es/components/commons-three-loader3/index.vue2.mjs +301 -117
- package/es/components/commons-weather/index.vue.mjs +1 -1
- package/es/components/commons-weather/index.vue2.mjs +233 -48
- package/es/components/commons-weather-dynamic/index.vue.mjs +2 -2
- package/es/components/commons-weather-dynamic/index.vue2.mjs +236 -52
- package/es/components/interaction/button/index.vue.mjs +2 -2
- package/es/components/interaction/button/index.vue2.mjs +252 -68
- package/es/components/interaction/date-picker/components/common-date-picker/index.vue.mjs +1 -1
- package/es/components/interaction/date-picker/components/common-date-picker/index.vue2.mjs +324 -140
- package/es/components/interaction/tabs/index.vue.mjs +223 -39
- package/es/components/interaction/tabs-icon/index.vue.mjs +225 -41
- package/es/components/interaction-input/index.vue.mjs +1 -1
- package/es/components/interaction-input/index.vue2.mjs +244 -61
- package/es/components/interaction-select/index.vue.mjs +1 -1
- package/es/components/interaction-select/index.vue2.mjs +269 -86
- package/es/components/interaction-slider/index.vue.mjs +1 -1
- package/es/components/interaction-slider/index.vue2.mjs +248 -65
- package/es/components/interaction-switch/index.vue.mjs +2 -2
- package/es/components/interaction-switch/index.vue2.mjs +218 -34
- package/es/components/interaction-tabs/index.vue.mjs +1 -1
- package/es/components/interaction-tabs/index.vue2.mjs +221 -37
- package/es/components/interaction-tabs2/index.vue.mjs +2 -2
- package/es/components/interaction-tabs2/index.vue2.mjs +219 -35
- package/es/components/map-earth-basic/index.d.ts +2 -2
- package/es/components/map-earth-basic/index.vue.d.ts +2 -2
- package/es/components/map-earth-basic/index.vue.mjs +286 -103
- package/es/components/map-earth-cool-tech/index.d.ts +2 -2
- package/es/components/map-earth-cool-tech/index.vue.d.ts +4 -6
- package/es/components/map-earth-cool-tech/index.vue.mjs +286 -103
- package/es/components/map-earth-fly-line/index.d.ts +2 -2
- package/es/components/map-earth-fly-line/index.vue.d.ts +2 -2
- package/es/components/map-earth-fly-line/index.vue.mjs +286 -103
- package/es/components/map-earth-hacker/index.d.ts +2 -2
- package/es/components/map-earth-hacker/index.vue.d.ts +2 -2
- package/es/components/map-earth-hacker/index.vue.mjs +286 -103
- package/es/components/map-earth-particle/index.d.ts +2 -2
- package/es/components/map-earth-particle/index.vue.d.ts +2 -2
- package/es/components/map-earth-particle/index.vue.mjs +286 -103
- package/es/components/media-audio/index.vue.mjs +2 -2
- package/es/components/media-audio/index.vue2.mjs +218 -34
- package/es/components/media-audio-dynamic/index.vue.mjs +2 -2
- package/es/components/media-audio-dynamic/index.vue2.mjs +233 -50
- package/es/components/media-flv/index.vue.mjs +219 -35
- package/es/components/media-iframe/index.vue.mjs +2 -2
- package/es/components/media-iframe/index.vue2.mjs +200 -15
- package/es/components/media-iframe-dynamic/index.vue.mjs +2 -2
- package/es/components/media-iframe-dynamic/index.vue2.mjs +222 -38
- package/es/components/media-image-dynamic/index.vue.mjs +1 -1
- package/es/components/media-image-dynamic/index.vue2.mjs +207 -24
- package/es/components/media-m3u8/index.vue.mjs +221 -37
- package/es/components/media-m3u8-dynamic/index.vue.mjs +228 -45
- package/es/components/media-video/index.vue.mjs +1 -1
- package/es/components/media-video/index.vue2.mjs +216 -31
- package/es/components/media-video-dynamic/index.vue.mjs +2 -2
- package/es/components/media-video-dynamic/index.vue2.mjs +223 -40
- package/es/components/scene-amap2d/index.vue.mjs +2 -2
- package/es/components/scene-amap2d/index.vue2.mjs +376 -192
- package/es/components/scene-amap3d/index.vue.mjs +2 -2
- package/es/components/scene-amap3d/index.vue2.mjs +414 -231
- package/es/components/scene-default/index.vue.mjs +2 -2
- package/es/components/scene-default/index.vue2.mjs +201 -16
- package/es/components/scene-map3d/index.vue.mjs +2 -2
- package/es/components/scene-map3d/index.vue2.mjs +289 -106
- package/es/components/scene-ue-iframe/index.vue.mjs +1 -1
- package/es/components/scene-ue-iframe/index.vue2.mjs +212 -27
- package/es/components/scene-ue-shj/index.vue.mjs +1 -1
- package/es/components/scene-ue-shj/index.vue2.mjs +200 -15
- package/es/components/scene-unity-iframe/index.vue.mjs +2 -2
- package/es/components/scene-unity-iframe/index.vue2.mjs +204 -19
- package/es/components/scene-unity-webgl/index.vue.mjs +1 -1
- package/es/components/scene-unity-webgl/index.vue2.mjs +204 -19
- package/es/components/scene-vr/index.vue.mjs +2 -2
- package/es/components/scene-vr/index.vue2.mjs +307 -123
- package/es/components/text/list/index.vue.mjs +240 -56
- package/es/components/text-count-down/index.vue.mjs +2 -2
- package/es/components/text-count-down/index.vue2.mjs +245 -60
- package/es/components/text-over-number/index.vue.mjs +1 -1
- package/es/components/text-over-number/index.vue2.mjs +243 -60
- package/es/components/text-real-time/index.vue.mjs +1 -1
- package/es/components/text-real-time/index.vue2.mjs +212 -28
- package/es/components/text-row-scroll/index.vue.mjs +2 -2
- package/es/components/text-row-scroll/index.vue2.mjs +289 -106
- package/es/components/text-table-basic/index.vue.mjs +3 -3
- package/es/components/text-table-basic/index.vue2.mjs +286 -103
- package/es/components/text-table-scroll/index.vue.mjs +1 -1
- package/es/components/text-table-scroll/index.vue2.mjs +290 -107
- package/es/components/text-text-dynamic/index.vue.mjs +2 -2
- package/es/components/text-text-dynamic/index.vue2.mjs +218 -35
- package/es/index.d.ts +1 -0
- package/es/index.mjs +375 -361
- package/es/plugins/datasource/index.mjs +217 -0
- package/es/plugins/datasource/sources/api.mjs +32 -0
- package/es/plugins/datasource/sources/static.mjs +17 -0
- package/es/plugins/datasource/sources/storage.mjs +28 -0
- package/es/plugins/datasource/sources/url.mjs +17 -0
- package/es/plugins/datasource/sources/variable.mjs +17 -0
- package/es/plugins/datasource/sources/ws.mjs +139 -0
- package/es/plugins/datasource/utils/axios.mjs +134 -0
- package/es/plugins/datasource/utils/request.mjs +5 -0
- package/es/plugins/datasource/utils/utils.mjs +229 -0
- package/es/plugins/datasource/utils/wsManager.mjs +78 -0
- package/es/plugins/event/actions/fullScreenAction.mjs +8 -0
- package/es/plugins/event/actions/invokeAction.mjs +11 -0
- package/es/plugins/event/actions/linkAction.mjs +8 -0
- package/es/plugins/event/actions/moveAction.mjs +15 -0
- package/es/plugins/event/actions/refreshVariableAction.mjs +18 -0
- package/es/plugins/event/actions/rotateAction.mjs +19 -0
- package/es/plugins/event/actions/scaleAction.mjs +24 -0
- package/es/plugins/event/actions/sendApiAction.mjs +16 -0
- package/es/plugins/event/actions/ueCommonsWebscoketAction.mjs +31 -0
- package/es/plugins/event/actions/ueShjExecMethodAction.mjs +31 -0
- package/es/plugins/event/actions/unityIframeExecMethodAction.mjs +28 -0
- package/es/plugins/event/actions/unityWebglExecMethodAction.mjs +28 -0
- package/es/plugins/event/actions/updatePageAction.mjs +6 -0
- package/es/plugins/event/actions/updateVariableAction.mjs +25 -0
- package/es/plugins/event/actions/updateWidgetAction.mjs +14 -0
- package/es/plugins/event/actions/vrSceneMethodAction.mjs +12 -0
- package/es/plugins/event/index.mjs +161 -0
- package/es/plugins/event/utils/utils.mjs +50 -0
- package/es/plugins/utils/componentRefs.mjs +37 -0
- package/es/plugins/utils/getNextElement.mjs +12 -0
- package/es/widgets.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { isArray as g, isObject as b } from "lodash";
|
|
2
|
+
class o {
|
|
3
|
+
/**
|
|
4
|
+
* 替换URL中的变量
|
|
5
|
+
* @param url URL
|
|
6
|
+
* @param variableData 变量数据
|
|
7
|
+
* @returns 解析后的URL
|
|
8
|
+
*/
|
|
9
|
+
static replaceURLVariables(t, n) {
|
|
10
|
+
try {
|
|
11
|
+
const a = t.match(/\${(.*?)}/g);
|
|
12
|
+
if (a)
|
|
13
|
+
for (let e = 0; e < a.length; e++) {
|
|
14
|
+
const r = a[e].substring(2, a[e].length - 1), i = o.extractVariableName(r), s = n.find((l) => l.name === i);
|
|
15
|
+
if (!s)
|
|
16
|
+
continue;
|
|
17
|
+
const c = o.getNestedValue(s._value, r.substring(i.length));
|
|
18
|
+
t = t.replaceAll(a[e], c);
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
} catch {
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 替换对象中的变量
|
|
27
|
+
* @param obj 对象
|
|
28
|
+
* @param variableData 变量数据
|
|
29
|
+
* @returns 解析后的对象
|
|
30
|
+
*/
|
|
31
|
+
static replaceObjectVariables(t, n) {
|
|
32
|
+
try {
|
|
33
|
+
let a = JSON.stringify(t);
|
|
34
|
+
const e = a.match(/\$g{(.*?)}/g);
|
|
35
|
+
if (e) {
|
|
36
|
+
for (let r = 0; r < e.length; r++) {
|
|
37
|
+
const i = e[r].substring(3, e[r].length - 1), s = this.extractVariableName(i), c = n.find((u) => u.name === s);
|
|
38
|
+
if (!c)
|
|
39
|
+
continue;
|
|
40
|
+
const l = this.getNestedValue(c._value, i.substring(s.length));
|
|
41
|
+
a = a.replaceAll(e[r], l);
|
|
42
|
+
}
|
|
43
|
+
return JSON.parse(a);
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
} catch {
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 替换字符串中的变量
|
|
52
|
+
* @param str 字符串
|
|
53
|
+
* @param variableData 变量数据
|
|
54
|
+
* @returns 解析后的字符串
|
|
55
|
+
*/
|
|
56
|
+
static replaceStringVariables(t, n) {
|
|
57
|
+
try {
|
|
58
|
+
const a = t.match(/\$g{(.*?)}/g);
|
|
59
|
+
if (a)
|
|
60
|
+
for (let e = 0; e < a.length; e++) {
|
|
61
|
+
const r = a[e].substring(3, a[e].length - 1), i = this.extractVariableName(r), s = n.find((l) => l.name === i);
|
|
62
|
+
if (!s)
|
|
63
|
+
continue;
|
|
64
|
+
const c = this.getNestedValue(s._value, r.substring(i.length));
|
|
65
|
+
t = t.replaceAll(a[e], c);
|
|
66
|
+
}
|
|
67
|
+
return t;
|
|
68
|
+
} catch {
|
|
69
|
+
return t;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 获取URL中的变量名
|
|
74
|
+
* @param url URL
|
|
75
|
+
* @returns 变量名
|
|
76
|
+
*/
|
|
77
|
+
static getURLVariableNames(t) {
|
|
78
|
+
const n = [], a = t.match(/\${(.*?)}/g);
|
|
79
|
+
if (a)
|
|
80
|
+
for (let e = 0; e < a.length; e++) {
|
|
81
|
+
const r = a[e].substring(2, a[e].length - 1), i = o.extractVariableName(r);
|
|
82
|
+
n.push(i);
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 获取对象中的变量名
|
|
88
|
+
* @param obj 对象
|
|
89
|
+
* @returns 变量名
|
|
90
|
+
*/
|
|
91
|
+
static getObjectVariableNames(t) {
|
|
92
|
+
const n = [], e = JSON.stringify(t).match(/\$g{(.*?)}/g);
|
|
93
|
+
if (e)
|
|
94
|
+
for (let r = 0; r < e.length; r++) {
|
|
95
|
+
const i = e[r].substring(3, e[r].length - 1), s = this.extractVariableName(i);
|
|
96
|
+
n.push(s);
|
|
97
|
+
}
|
|
98
|
+
return n;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 获取字符串中的变量名
|
|
102
|
+
* @param str 字符串
|
|
103
|
+
* @returns 变量名
|
|
104
|
+
*/
|
|
105
|
+
static getStringVariableNames(t) {
|
|
106
|
+
const n = [], a = t.match(/\$g{(.*?)}/g);
|
|
107
|
+
if (a)
|
|
108
|
+
for (let e = 0; e < a.length; e++) {
|
|
109
|
+
const r = a[e].substring(3, a[e].length - 1), i = this.extractVariableName(r);
|
|
110
|
+
n.push(i);
|
|
111
|
+
}
|
|
112
|
+
return n;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* 解析环境变量
|
|
116
|
+
* @param url URL
|
|
117
|
+
* @param environments 环境变量
|
|
118
|
+
* @returns 解析后的环境变量
|
|
119
|
+
*/
|
|
120
|
+
static replaceEnvVariables(t, n) {
|
|
121
|
+
try {
|
|
122
|
+
let a = "";
|
|
123
|
+
if (!t.includes("http") && n) {
|
|
124
|
+
const e = n.filter((r) => r.selected);
|
|
125
|
+
e && g(e) && e.length > 0 && (a = e[0].envBaseUrl || "");
|
|
126
|
+
}
|
|
127
|
+
return a;
|
|
128
|
+
} catch {
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 返回空数据
|
|
134
|
+
* @param id 数据源 ID
|
|
135
|
+
* @returns 空数据
|
|
136
|
+
*/
|
|
137
|
+
static noneData(t) {
|
|
138
|
+
return {
|
|
139
|
+
id: t,
|
|
140
|
+
finalKeyData: [],
|
|
141
|
+
finalUserData: { id: t, data: [] },
|
|
142
|
+
filteredData: [],
|
|
143
|
+
rawData: [],
|
|
144
|
+
noMappingData: []
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* 获取环境变量
|
|
149
|
+
* @returns 环境变量
|
|
150
|
+
*/
|
|
151
|
+
static getEnvironments() {
|
|
152
|
+
let t = sessionStorage.getItem("currentApiEnvironments");
|
|
153
|
+
return t && (t = JSON.parse(t)), t;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 设置环境变量
|
|
157
|
+
* @param environments 环境变量
|
|
158
|
+
*/
|
|
159
|
+
static setEnvironments(t) {
|
|
160
|
+
sessionStorage.setItem("currentApiEnvironments", JSON.stringify(t));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 获取变量数据
|
|
164
|
+
* @returns 变量数据
|
|
165
|
+
*/
|
|
166
|
+
static getVariableData() {
|
|
167
|
+
let t = sessionStorage.getItem("currentVariableData");
|
|
168
|
+
return t && (t = JSON.parse(t)), t;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 设置变量数据
|
|
172
|
+
* @param variableData 变量数据
|
|
173
|
+
*/
|
|
174
|
+
static setVariableData(t) {
|
|
175
|
+
sessionStorage.setItem("currentVariableData", JSON.stringify(t));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 检查 WebSocket 是否已存在且有效
|
|
179
|
+
* @param wsInstances WebSocket 实例
|
|
180
|
+
* @param tId WebSocket 实例的 ID
|
|
181
|
+
* @param sourceId WebSocket 实例的源 ID
|
|
182
|
+
* @returns 是否有效
|
|
183
|
+
*/
|
|
184
|
+
static hasValidWebSocket(t, n, a) {
|
|
185
|
+
const e = t.get(n);
|
|
186
|
+
if (!e) return !1;
|
|
187
|
+
for (const r of e)
|
|
188
|
+
if (r.getId() === a && r.isConnected())
|
|
189
|
+
return !0;
|
|
190
|
+
return !1;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* 只在必要时清理 WebSocket 连接
|
|
194
|
+
* @param wsInstances WebSocket 实例
|
|
195
|
+
* @param sourceIds 源 ID
|
|
196
|
+
* @param tId WebSocket 实例的 ID
|
|
197
|
+
*/
|
|
198
|
+
static cleanupPreviousWebSockets(t, n, a) {
|
|
199
|
+
const e = t.get(a);
|
|
200
|
+
e && (e.forEach((r) => {
|
|
201
|
+
n.includes(r.getId()) || (r.disconnect(), e.delete(r));
|
|
202
|
+
}), e.size === 0 && t.delete(a));
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 使用 Function 构造函数获取对象中的嵌套值(更简洁但安全性较低)
|
|
206
|
+
* @param obj 源对象
|
|
207
|
+
* @param path 路径字符串,例如 ".a[0].value"
|
|
208
|
+
* @returns 获取到的值,如果路径不存在则返回 undefined
|
|
209
|
+
*/
|
|
210
|
+
static getNestedValue(t, n) {
|
|
211
|
+
try {
|
|
212
|
+
return n ? new Function("obj", `return obj${n}`)(t) : b(t) || g(t) ? JSON.stringify(t) : t;
|
|
213
|
+
} catch {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 从路径字符串中提取变量名
|
|
219
|
+
* @param path 路径字符串,例如 "测试.test" 或 "333[0].aa"
|
|
220
|
+
* @returns 提取出的变量名
|
|
221
|
+
*/
|
|
222
|
+
static extractVariableName(t) {
|
|
223
|
+
const n = t.match(/^([\u4e00-\u9fa5a-zA-Z0-9_][\u4e00-\u9fa5a-zA-Z0-9_]*)/);
|
|
224
|
+
return n ? n[1] : "";
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
o as DataSourceUtils
|
|
229
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (s, e, o) => e in s ? d(s, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : s[e] = o;
|
|
3
|
+
var r = (s, e, o) => h(s, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
const n = class n {
|
|
5
|
+
constructor() {
|
|
6
|
+
r(this, "connections", /* @__PURE__ */ new Set());
|
|
7
|
+
}
|
|
8
|
+
// 单例模式
|
|
9
|
+
static getInstance() {
|
|
10
|
+
return n.instance || (n.instance = new n()), n.instance;
|
|
11
|
+
}
|
|
12
|
+
// 添加 WebSocket 连接
|
|
13
|
+
add(e, o) {
|
|
14
|
+
Array.from(this.connections).filter((t) => t.componentId === o).forEach((t) => {
|
|
15
|
+
if (this.removeAllListeners(t.ws), t.ws.readyState !== WebSocket.CLOSED)
|
|
16
|
+
try {
|
|
17
|
+
t.ws.close(1e3, `Replacing connection for component ${o}`);
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
this.connections.delete(t);
|
|
21
|
+
});
|
|
22
|
+
const c = { ws: e, componentId: o };
|
|
23
|
+
this.connections.add(c), this.setupAutoRemove(e, c);
|
|
24
|
+
}
|
|
25
|
+
// 改进点:更彻底的连接关闭 + 内存泄漏防护
|
|
26
|
+
closeByComponentIds(e) {
|
|
27
|
+
const o = Array.isArray(e) ? e : [e], i = new Set(o);
|
|
28
|
+
Array.from(this.connections).filter(
|
|
29
|
+
(t) => i.has(t.componentId) && t.ws.readyState !== WebSocket.CLOSED
|
|
30
|
+
).forEach((t) => {
|
|
31
|
+
this.removeAllListeners(t.ws);
|
|
32
|
+
try {
|
|
33
|
+
t.ws.close(1e3, `Component ${t.componentId} unmounted`);
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
this.connections.delete(t);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// 辅助方法:清理事件监听器
|
|
40
|
+
removeAllListeners(e) {
|
|
41
|
+
const o = () => {
|
|
42
|
+
};
|
|
43
|
+
e.onopen = o, e.onmessage = o, e.onerror = o, e.onclose = o, "removeAllListeners" in e && e.removeAllListeners();
|
|
44
|
+
}
|
|
45
|
+
// 关闭所有连接
|
|
46
|
+
closeAll() {
|
|
47
|
+
this.connections.forEach((e) => {
|
|
48
|
+
if (e.ws.readyState === WebSocket.OPEN || e.ws.readyState === WebSocket.CONNECTING)
|
|
49
|
+
try {
|
|
50
|
+
e.ws.close(1e3, "All connections closed");
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
}), this.connections.clear();
|
|
54
|
+
}
|
|
55
|
+
// 自动移除已关闭的连接
|
|
56
|
+
setupAutoRemove(e, o) {
|
|
57
|
+
const i = e.close.bind(e);
|
|
58
|
+
e.close = (c, t) => {
|
|
59
|
+
this.connections.delete(o), i(c, t);
|
|
60
|
+
}, e.onclose = () => {
|
|
61
|
+
this.connections.delete(o);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// 用于调试的方法
|
|
65
|
+
getConnectionsInfo() {
|
|
66
|
+
return Array.from(this.connections).map((e) => ({
|
|
67
|
+
componentId: e.componentId,
|
|
68
|
+
readyState: e.ws.readyState
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// eslint-disable-next-line no-use-before-define
|
|
73
|
+
r(n, "instance");
|
|
74
|
+
let a = n;
|
|
75
|
+
const A = a.getInstance();
|
|
76
|
+
export {
|
|
77
|
+
A as wsManager
|
|
78
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useFullscreen as s } from "@vueuse/core";
|
|
2
|
+
const { enter: n, exit: o, toggle: c } = s(), i = (e, l) => {
|
|
3
|
+
const { fullscreenAction: t } = e;
|
|
4
|
+
t && t.status && (t.status === "fullscreen" && n(), t.status === "window" && o(), t.status === "toggle" && c());
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
i as executeFullScreenAction
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentRefs as r } from "../../utils/componentRefs.mjs";
|
|
2
|
+
const f = (e, n) => {
|
|
3
|
+
try {
|
|
4
|
+
const { invokeAction: o } = e, t = r.getComponentRef(o.targetLayerId);
|
|
5
|
+
t && t.ref[o.functionName](n, o.functionArgs);
|
|
6
|
+
} catch {
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
f as executeInvokeAction
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataSourceUtils as a } from "../../datasource/utils/utils.mjs";
|
|
2
|
+
const c = (e, i) => {
|
|
3
|
+
const { linkAction: t } = e, r = a.getVariableData(), o = a.replaceStringVariables(t.url, r);
|
|
4
|
+
window.open(o, t.target);
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
c as executeLinkAction
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const a = (i, s) => {
|
|
2
|
+
var n;
|
|
3
|
+
const { moveAction: t } = i;
|
|
4
|
+
(n = t.layerIds) != null && n.length && t.layerIds.forEach((r) => {
|
|
5
|
+
const e = document.getElementById(r);
|
|
6
|
+
e._transitionTimer && clearTimeout(e._transitionTimer), e.style.transform = `matrix(1, 0, 0, 1, ${t.x}, ${t.y}) `, e.style.transition = `transform ${t.duration}ms ${t.speed} ${t.delay}ms`;
|
|
7
|
+
const o = t.duration + t.delay;
|
|
8
|
+
e._transitionTimer = setTimeout(() => {
|
|
9
|
+
e.style.transition = "";
|
|
10
|
+
}, o);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
a as executeMoveAction
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as s } from "../../datasource/index.mjs";
|
|
2
|
+
import { DataSourceUtils as i } from "../../datasource/utils/utils.mjs";
|
|
3
|
+
import { EventUtils as n } from "../utils/utils.mjs";
|
|
4
|
+
const m = (o) => {
|
|
5
|
+
const { refreshVariableAction: t } = o, r = i.getVariableData(), a = r.find((e) => e.id === t.name || e.name === t.name);
|
|
6
|
+
a && s.parse({
|
|
7
|
+
sources: [a.sources],
|
|
8
|
+
isStore: !1,
|
|
9
|
+
noUseMapping: !0,
|
|
10
|
+
tId: a.id,
|
|
11
|
+
callback: (e) => {
|
|
12
|
+
a._value = e, i.setVariableData(r), n.updateWidgetVariableData(a);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
m as executeRefreshVariableAction
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const d = (o, m) => {
|
|
2
|
+
var r;
|
|
3
|
+
const { rotateAction: t } = o;
|
|
4
|
+
(r = t.layerIds) != null && r.length && t.layerIds.forEach((i) => {
|
|
5
|
+
const s = document.getElementById(i), e = s.children[0];
|
|
6
|
+
e._transitionTimer && clearTimeout(e._transitionTimer);
|
|
7
|
+
const n = e.style.transform.split(" "), a = n[0] || "", c = n[1] || "";
|
|
8
|
+
if (e.style.transform = `${a} ${c} rotateX(${t.x}deg) rotateY(${t.y}deg) rotateZ(${t.z}deg)`, (t.x > 0 || t.y > 0 || t.z > 0) && (s.style.perspective = t.perspective + "px"), t.speed !== "") {
|
|
9
|
+
e.style.transition = `transform ${t.duration}ms ${t.speed} ${t.delay}ms`;
|
|
10
|
+
const l = t.duration + t.delay;
|
|
11
|
+
e._transitionTimer = setTimeout(() => {
|
|
12
|
+
e.style.transition = "";
|
|
13
|
+
}, l);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
d as executeRotateAction
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const y = (i, c) => {
|
|
2
|
+
var a;
|
|
3
|
+
const { scaleAction: t } = i;
|
|
4
|
+
(a = t.layerIds) != null && a.length && t.layerIds.forEach((l) => {
|
|
5
|
+
const e = document.getElementById(l).children[0], s = e.style.transform.split(" ");
|
|
6
|
+
if (e._transitionTimer && clearTimeout(e._transitionTimer), s.length >= 5) {
|
|
7
|
+
const r = s[2] || "", n = s[3] || "", o = s[4] || "";
|
|
8
|
+
e.style.transform = `scaleX(${t.x / 100}) scaleY(${t.y / 100}) ${r} ${n} ${o}`;
|
|
9
|
+
} else {
|
|
10
|
+
const r = s[0] || "", n = s[1] || "", o = s[2] || "";
|
|
11
|
+
e.style.transform = `scaleX(${t.x / 100}) scaleY(${t.y / 100}) ${r} ${n} ${o}`;
|
|
12
|
+
}
|
|
13
|
+
if (e.style.transformOrigin = t.origin, t.speed !== "") {
|
|
14
|
+
e.style.transition = `transform ${t.duration}ms ${t.speed} ${t.delay}ms`;
|
|
15
|
+
const r = t.duration + t.delay;
|
|
16
|
+
e._transitionTimer = setTimeout(() => {
|
|
17
|
+
e.style.transition = "";
|
|
18
|
+
}, r);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
y as executeScaleAction
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as s } from "../../datasource/index.mjs";
|
|
2
|
+
const o = (a, t) => {
|
|
3
|
+
const { sendAPIAction: e } = a;
|
|
4
|
+
e.useDataSource && s.parse({
|
|
5
|
+
sources: [e.useDataSource],
|
|
6
|
+
callback: () => {
|
|
7
|
+
},
|
|
8
|
+
isStore: !1,
|
|
9
|
+
noUseMapping: !0,
|
|
10
|
+
tId: "",
|
|
11
|
+
isInterval: !1
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
o as executeSendApiAction
|
|
16
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as a } from "../../datasource/index.mjs";
|
|
2
|
+
import { EventUtils as o } from "../utils/utils.mjs";
|
|
3
|
+
const f = (r, n) => {
|
|
4
|
+
try {
|
|
5
|
+
const { ueCommonsWebscoketAction: e } = r;
|
|
6
|
+
if (e.dataType === "params") {
|
|
7
|
+
const t = o.toStringify(n);
|
|
8
|
+
e.escape ? window.SHJSceneUEIframeWebscoket.send(JSON.stringify(t)) : window.SHJSceneUEIframeWebscoket.send(t);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!e.useDataSource)
|
|
12
|
+
return;
|
|
13
|
+
a.parse({
|
|
14
|
+
sources: [e.useDataSource],
|
|
15
|
+
isStore: !1,
|
|
16
|
+
noUseMapping: !0,
|
|
17
|
+
tId: "",
|
|
18
|
+
isInterval: !1,
|
|
19
|
+
callback: (t) => {
|
|
20
|
+
if (t && window.SHJSceneUEIframeWebscoket) {
|
|
21
|
+
const s = o.toStringify(t);
|
|
22
|
+
e.escape ? window.SHJSceneUEIframeWebscoket.send(JSON.stringify(s)) : window.SHJSceneUEIframeWebscoket.send(s);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
f as executeUeCommonsWebscoketAction
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as n } from "../../datasource/index.mjs";
|
|
2
|
+
import { EventUtils as i } from "../utils/utils.mjs";
|
|
3
|
+
const u = (r, a) => {
|
|
4
|
+
try {
|
|
5
|
+
const { ueShjExecMethodAction: e } = r;
|
|
6
|
+
if (e.dataType === "params") {
|
|
7
|
+
const t = i.toStringify(a);
|
|
8
|
+
e.escape ? window.ue5(e.functionName, JSON.stringify(t)) : window.ue5(e.functionName, t);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!e.useDataSource)
|
|
12
|
+
return;
|
|
13
|
+
n.parse({
|
|
14
|
+
sources: [e.useDataSource],
|
|
15
|
+
isStore: !1,
|
|
16
|
+
noUseMapping: !0,
|
|
17
|
+
tId: "",
|
|
18
|
+
isInterval: !1,
|
|
19
|
+
callback: (t) => {
|
|
20
|
+
if (t) {
|
|
21
|
+
const o = i.toStringify(t);
|
|
22
|
+
e.escape ? window.ue5(e.functionName, JSON.stringify(o)) : window.ue5(e.functionName, o);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
u as executeUeShjExecMethodAction
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as o } from "../../datasource/index.mjs";
|
|
2
|
+
import { EventUtils as r } from "../utils/utils.mjs";
|
|
3
|
+
const s = (t, a) => {
|
|
4
|
+
try {
|
|
5
|
+
const { unityIframeExecMethodAction: e } = t;
|
|
6
|
+
if (e.dataType === "params") {
|
|
7
|
+
const n = r.toStringify(a);
|
|
8
|
+
window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage({ object: e.objectName, function: e.functionName, data: n }, window.SHJSceneUnityIframeInstance.url);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!e.useDataSource)
|
|
12
|
+
return;
|
|
13
|
+
o.parse({
|
|
14
|
+
sources: [e.useDataSource],
|
|
15
|
+
isStore: !1,
|
|
16
|
+
noUseMapping: !0,
|
|
17
|
+
tId: "",
|
|
18
|
+
isInterval: !1,
|
|
19
|
+
callback: (n) => {
|
|
20
|
+
window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage({ object: e.objectName, function: e.functionName, data: n }, window.SHJSceneUnityIframeInstance.url);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
s as executeUnityIframeExecMethodAction
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as o } from "../../datasource/index.mjs";
|
|
2
|
+
import { EventUtils as c } from "../utils/utils.mjs";
|
|
3
|
+
const s = (t, a) => {
|
|
4
|
+
try {
|
|
5
|
+
const { unityWebglExecMethodAction: e } = t;
|
|
6
|
+
if (e.dataType === "params") {
|
|
7
|
+
const n = c.toStringify(a);
|
|
8
|
+
window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage({ object: e.objectName, function: e.functionName, data: n }, window.SHJSceneUnityIframeInstance.url);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!e.useDataSource)
|
|
12
|
+
return;
|
|
13
|
+
o.parse({
|
|
14
|
+
sources: [e.useDataSource],
|
|
15
|
+
isStore: !1,
|
|
16
|
+
noUseMapping: !0,
|
|
17
|
+
tId: "",
|
|
18
|
+
isInterval: !1,
|
|
19
|
+
callback: (n) => {
|
|
20
|
+
window.SHJSceneUnityIframeInstance.ref && window.SHJSceneUnityIframeInstance.ref.contentWindow.postMessage({ object: e.objectName, function: e.functionName, data: n }, window.SHJSceneUnityIframeInstance.url);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
s as executeUnityWebglExecMethodAction
|
|
28
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SHJDatasourceV2 as n } from "../../datasource/index.mjs";
|
|
2
|
+
import { DataSourceUtils as i } from "../../datasource/utils/utils.mjs";
|
|
3
|
+
import { EventUtils as l } from "../utils/utils.mjs";
|
|
4
|
+
const b = (o, s) => {
|
|
5
|
+
const { updateVariableAction: t } = o, r = i.getVariableData(), a = r.find((e) => e.id === t.name || e.name === t.name);
|
|
6
|
+
if (a) {
|
|
7
|
+
if (o.updateVariableAction.dataType === "params") {
|
|
8
|
+
a._value = s, i.setVariableData(r), l.updateWidgetVariableData(a);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
n.parse({
|
|
12
|
+
sources: [t.useDataSource],
|
|
13
|
+
isStore: !1,
|
|
14
|
+
noUseMapping: !0,
|
|
15
|
+
tId: "",
|
|
16
|
+
isInterval: !1,
|
|
17
|
+
callback: (e) => {
|
|
18
|
+
a._value = e, i.setVariableData(r), l.updateWidgetVariableData(a);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
b as executeUpdateVariableAction
|
|
25
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentRefs as o } from "../../utils/componentRefs.mjs";
|
|
2
|
+
const a = (r, n) => {
|
|
3
|
+
try {
|
|
4
|
+
const { updateWidget: t } = r;
|
|
5
|
+
if (t.targetLayerId) {
|
|
6
|
+
const e = o.getComponentRef(t.targetLayerId);
|
|
7
|
+
e && e.ref && e.ref.refresh && e.ref.refresh();
|
|
8
|
+
}
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
a as executeUpdateWidgetAction
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const t = (n, r) => {
|
|
2
|
+
try {
|
|
3
|
+
const { vrSceneMethodAction: e } = n;
|
|
4
|
+
if (!window.SHJSceneVrViewer || (e.type === "vrSceneToggle" && (window.SHJSceneVrViewer.loadScene(e.sceneId), window.SHJSceneVrViewer.stopAutoRotate()), e.type === "vrSceneToggleAngle" && (window.SHJSceneVrViewer.setHfov(e.angle.hfov), window.SHJSceneVrViewer.setYaw(e.angle.yaw), window.SHJSceneVrViewer.setPitch(e.angle.pitch)), e.type === "vrSceneStartRotate" && window.SHJSceneVrViewer.startAutoRotate(), e.type === "vrScenePausedRotate" && window.SHJSceneVrViewer.stopAutoRotate(), !window.SHJSceneVrViewer.audio))
|
|
5
|
+
return;
|
|
6
|
+
e.type === "vrScenePlayMusic" && window.SHJSceneVrViewer.audio.value.play(), e.type === "vrScenePausedMusic" && window.SHJSceneVrViewer.audio.value.pause();
|
|
7
|
+
} catch {
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
t as executeVrSceneMethodAction
|
|
12
|
+
};
|