@shjjs/visual-ui 3.0.3 → 3.0.4
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 +2 -2
- package/es/commons/plugins/datasource/sources/api.mjs +61 -40
- package/es/commons/plugins/datasource/utils/mappingData.mjs +28 -27
- package/es/commons/plugins/datasource/utils/utils.mjs +93 -239
- package/es/packages/commons/plugins/datasource/sources/api.d.ts +1 -1
- package/es/packages/commons/plugins/datasource/utils/mappingData.d.ts +6 -0
- package/es/packages/commons/plugins/datasource/utils/utils.d.ts +6 -96
- package/package.json +1 -1
- package/umd/index.js +361 -361
|
@@ -3,119 +3,29 @@ import { IVariable } from "../types";
|
|
|
3
3
|
* 数据源工具类
|
|
4
4
|
*/
|
|
5
5
|
export declare class DataSourceUtils {
|
|
6
|
-
static
|
|
6
|
+
static executeAllVariable(variableData: IVariable[]): void;
|
|
7
7
|
static replaceObjectVariables(obj: any): any;
|
|
8
8
|
static replaceStringVariables(str: string): string;
|
|
9
|
-
static getURLVariableNames(url: string): string[];
|
|
10
9
|
static getObjectVariableNames(obj: any): string[];
|
|
11
10
|
static getStringVariableNames(str: string): string[];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
static parseVariablePath(path: any): {
|
|
12
|
+
varName: any;
|
|
13
|
+
propPath: any;
|
|
14
|
+
};
|
|
16
15
|
static getEnvironments(): {
|
|
17
16
|
envName: string;
|
|
18
17
|
envBaseUrl: string;
|
|
19
18
|
};
|
|
20
|
-
/**
|
|
21
|
-
* 设置环境变量
|
|
22
|
-
* @param environments 环境变量
|
|
23
|
-
*/
|
|
24
19
|
static setEnvironments(environments: any[]): void;
|
|
25
|
-
/**
|
|
26
|
-
* 获取变量数据
|
|
27
|
-
* @returns 变量数据
|
|
28
|
-
*/
|
|
29
20
|
static getVariables(): any[];
|
|
30
|
-
/**
|
|
31
|
-
* 设置变量数据
|
|
32
|
-
* @param variable 变量数据
|
|
33
|
-
*/
|
|
34
21
|
static setVariables(variable: any[]): void;
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
* @param id
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
22
|
+
static setVariableById(variable: any, value: any, updateWidget?: boolean): void;
|
|
40
23
|
static getVariableById(id: string): any;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param name
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
24
|
static getVariableByName(name: string): any;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param name
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
25
|
static getVariableValueByName(name: string): any;
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param name
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
static getVariableInitialStateByName(name: string): any;
|
|
59
|
-
/**
|
|
60
|
-
* 设置变量数据
|
|
61
|
-
* @param id 变量 ID
|
|
62
|
-
* @param variable 变量数据
|
|
63
|
-
*/
|
|
64
|
-
static setVariableById(variable: any, value: any, updateWidget?: boolean): void;
|
|
65
|
-
/**
|
|
66
|
-
* 新增变量
|
|
67
|
-
* @param data
|
|
68
|
-
*/
|
|
69
26
|
static addVariable: (variable: any) => void;
|
|
70
|
-
/**
|
|
71
|
-
* 更新变量
|
|
72
|
-
* @param data
|
|
73
|
-
*/
|
|
74
27
|
static updateVariable: (variable: any) => void;
|
|
75
|
-
/**
|
|
76
|
-
* 更新变量
|
|
77
|
-
* @param data
|
|
78
|
-
*/
|
|
79
28
|
static deleteVariableById: (id: any) => void;
|
|
80
|
-
/**
|
|
81
|
-
* 检查 WebSocket 是否已存在且有效
|
|
82
|
-
* @param wsInstances WebSocket 实例
|
|
83
|
-
* @param tId WebSocket 实例的 ID
|
|
84
|
-
* @param sourceId WebSocket 实例的源 ID
|
|
85
|
-
* @returns 是否有效
|
|
86
|
-
*/
|
|
87
|
-
static hasValidWebSocket(wsInstances: any, tId: string, sourceId: string): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* 只在必要时清理 WebSocket 连接
|
|
90
|
-
* @param wsInstances WebSocket 实例
|
|
91
|
-
* @param sourceIds 源 ID
|
|
92
|
-
* @param tId WebSocket 实例的 ID
|
|
93
|
-
*/
|
|
94
|
-
static cleanupPreviousWebSockets(wsInstances: any, sourceIds: string[], tId: string): void;
|
|
95
|
-
/**
|
|
96
|
-
* 使用 Function 构造函数获取对象中的嵌套值(更简洁但安全性较低)
|
|
97
|
-
* @param obj 源对象
|
|
98
|
-
* @param path 路径字符串,例如 ".a[0].value"
|
|
99
|
-
* @returns 获取到的值,如果路径不存在则返回 undefined
|
|
100
|
-
*/
|
|
101
|
-
static getNestedValue(obj: any, path: string): any;
|
|
102
|
-
/**
|
|
103
|
-
* 从路径字符串中提取变量名
|
|
104
|
-
* @param path 路径字符串,例如 "测试.test" 或 "333[0].aa"
|
|
105
|
-
* @returns 提取出的变量名
|
|
106
|
-
*/
|
|
107
|
-
static extractVariableName(path: string): string;
|
|
108
|
-
/**
|
|
109
|
-
* 初始化所有变量
|
|
110
|
-
* @param variableData
|
|
111
|
-
* @returns
|
|
112
|
-
*/
|
|
113
|
-
static executeAllVariable(variableData: IVariable[]): void;
|
|
114
|
-
/**
|
|
115
|
-
* 返回空数据
|
|
116
|
-
* @param id 数据源 ID
|
|
117
|
-
* @returns 空数据
|
|
118
|
-
*/
|
|
119
29
|
static noneData(id: string): {
|
|
120
30
|
id: string;
|
|
121
31
|
finalKeyData: {
|