venus-design 1.1.21 → 1.1.24
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/dist/Config/api.d.ts +6 -0
- package/dist/Config/api.js +154 -118
- package/dist/DataView/index.js +0 -1
- package/dist/DataView/resizable/index.js +14 -5
- package/dist/Drawer/index.js +6 -3
- package/dist/ProForm/index.d.ts +14 -2
- package/dist/ProForm/index.js +122 -35
- package/dist/RadioAndInput/index.js +1 -0
- package/dist/SelectCompoments/SelectUserOrDeptBySeclevel/selectPanel/dept.js +4 -4
- package/dist/SelectCompoments/SelectUserOrDeptBySeclevel/selectPanel/user.js +19 -15
- package/dist/SelectCompoments/SelectUserOrDeptBySeclevel/styles.less +1 -0
- package/dist/VenusAdjust/index.js +8 -4
- package/dist/VenusAdjust/interface.d.ts +10 -9
- package/dist/VenusDesignCom/components/Form.js +1 -1
- package/dist/VenusDetail/handleVenusDetailFunctions.js +6 -4
- package/dist/VenusDetail/staticAttr.js +74 -26
- package/dist/VenusForm/VenusFormScriptEngine.d.ts +96 -0
- package/dist/VenusForm/VenusFormScriptEngine.js +207 -0
- package/dist/VenusForm/VenusFormScriptUtils.d.ts +7 -0
- package/dist/VenusForm/VenusFormScriptUtils.js +190 -0
- package/dist/VenusForm/index.js +226 -37
- package/dist/VenusForm/interface.d.ts +4 -2
- package/dist/VenusForm/staticAttr.d.ts +1 -0
- package/dist/VenusForm/staticAttr.js +90 -62
- package/dist/VenusTable/components/filterDrawer/index.js +6 -3
- package/dist/VenusTable/components/filterDrawer/staticAttr.js +5 -4
- package/dist/VenusTable/index.js +46 -39
- package/dist/VenusTable/staticAttr.js +16 -10
- package/dist/VenusTable/style.css +2 -6
- package/dist/VenusUploadSecLevel/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Descriptions, VENUS_DETAIL_ITEM_TYPE, handleDataIndex } from "./..";
|
|
3
4
|
|
|
@@ -53,22 +54,23 @@ export var handleDetailItems = function handleDetailItems(detailData, data, data
|
|
|
53
54
|
//20240222调整后颜色对比
|
|
54
55
|
if (dataAfter != undefined) {
|
|
55
56
|
var textAfter = dataAfter[handleDataIndex(detailData[i].fieldId, detailData[i])] != null && dataAfter[handleDataIndex(detailData[i].fieldId, detailData[i])] != undefined ? dataAfter[handleDataIndex(detailData[i].fieldId, detailData[i])] : undefined;
|
|
56
|
-
if (textAfter != null && textAfter != "" && textAfter != undefined && JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
57
|
+
if (textAfter != null && textAfter != "" && textAfter != undefined && JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined) {
|
|
57
58
|
color = "red";
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
//@ts-ignore
|
|
61
|
-
detailDataList.push( /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
62
|
+
detailDataList.push( /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
62
63
|
span: ((_detailData$i$paramet = detailData[i].parameterSource) === null || _detailData$i$paramet === void 0 ? void 0 : _detailData$i$paramet.detailSpan) || 1,
|
|
63
64
|
key: detailData[i].fieldId,
|
|
64
65
|
labelStyle: {
|
|
65
66
|
color: color
|
|
66
67
|
},
|
|
67
68
|
contentStyle: {
|
|
68
|
-
color: color
|
|
69
|
+
color: color,
|
|
70
|
+
textAlign: "left"
|
|
69
71
|
},
|
|
70
72
|
label: detailData[i].fieldName
|
|
71
|
-
}, text, " "));
|
|
73
|
+
}, detailData[i].parameterSource), text, " "));
|
|
72
74
|
} catch (err) {
|
|
73
75
|
console.log(err);
|
|
74
76
|
console.log("错误!" + detailData[i].fieldName);
|
|
@@ -2,6 +2,7 @@ import "antd/es/image/style";
|
|
|
2
2
|
import _Image from "antd/es/image";
|
|
3
3
|
import "antd/es/tag/style";
|
|
4
4
|
import _Tag from "antd/es/tag";
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { DownLoadFile } from "./..";
|
|
7
8
|
import { Descriptions, dataToEnum, downloadFile } from "./..";
|
|
@@ -16,25 +17,27 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
16
17
|
try {
|
|
17
18
|
var _column$parameterSour;
|
|
18
19
|
var text = data[column.fieldId] != null && data[column.fieldId] != undefined ? data[column.fieldId] : undefined;
|
|
20
|
+
console.log(text);
|
|
19
21
|
var color = "#848f9b";
|
|
20
22
|
//20240222调整后颜色对比
|
|
21
23
|
if (dataAfter != undefined) {
|
|
22
24
|
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
23
|
-
if (JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
25
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
24
26
|
color = "red";
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
return /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
29
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
28
30
|
labelStyle: {
|
|
29
31
|
color: color
|
|
30
32
|
},
|
|
31
33
|
span: ((_column$parameterSour = column.parameterSource) === null || _column$parameterSour === void 0 ? void 0 : _column$parameterSour.detailSpan) || 1,
|
|
32
34
|
key: data[column.fieldId],
|
|
33
35
|
contentStyle: {
|
|
34
|
-
color: color
|
|
36
|
+
color: color,
|
|
37
|
+
textAlign: "left"
|
|
35
38
|
},
|
|
36
39
|
label: column.fieldName
|
|
37
|
-
}, dataToEnum(column.selectSource)[text], " ");
|
|
40
|
+
}, column.parameterSource), dataToEnum(column.selectSource)[text], " ");
|
|
38
41
|
} catch (err) {
|
|
39
42
|
console.log(err);
|
|
40
43
|
console.log("下拉属性错误");
|
|
@@ -49,21 +52,22 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
49
52
|
//20240222调整后颜色对比
|
|
50
53
|
if (dataAfter != undefined) {
|
|
51
54
|
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? moment(dataAfter[column.fieldId]).format('YYYY-MM-DD') : undefined;
|
|
52
|
-
if (JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
55
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
53
56
|
color = "red";
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
|
-
return /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
59
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
57
60
|
labelStyle: {
|
|
58
61
|
color: color
|
|
59
62
|
},
|
|
60
63
|
span: ((_column$parameterSour2 = column.parameterSource) === null || _column$parameterSour2 === void 0 ? void 0 : _column$parameterSour2.detailSpan) || 1,
|
|
61
64
|
key: data[column.fieldId],
|
|
62
65
|
contentStyle: {
|
|
63
|
-
color: color
|
|
66
|
+
color: color,
|
|
67
|
+
textAlign: "left"
|
|
64
68
|
},
|
|
65
69
|
label: column.fieldName
|
|
66
|
-
}, text, " ");
|
|
70
|
+
}, column.parameterSource), text, " ");
|
|
67
71
|
} catch (err) {
|
|
68
72
|
console.log(err);
|
|
69
73
|
console.log("日期属性错误");
|
|
@@ -77,21 +81,22 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
77
81
|
//20240222调整后颜色对比
|
|
78
82
|
if (dataAfter != undefined) {
|
|
79
83
|
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
80
|
-
if (JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
84
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
81
85
|
color = "red";
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
|
-
return /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
88
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
85
89
|
labelStyle: {
|
|
86
90
|
color: color
|
|
87
91
|
},
|
|
88
92
|
span: ((_column$parameterSour3 = column.parameterSource) === null || _column$parameterSour3 === void 0 ? void 0 : _column$parameterSour3.detailSpan) || 1,
|
|
89
93
|
key: data[column.fieldId],
|
|
90
94
|
contentStyle: {
|
|
91
|
-
color: color
|
|
95
|
+
color: color,
|
|
96
|
+
textAlign: "left"
|
|
92
97
|
},
|
|
93
98
|
label: column.fieldName
|
|
94
|
-
}, text, " ");
|
|
99
|
+
}, column.parameterSource), text, " ");
|
|
95
100
|
} catch (err) {
|
|
96
101
|
console.log(err);
|
|
97
102
|
console.log("文本属性错误");
|
|
@@ -105,24 +110,25 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
105
110
|
//20240222调整后颜色对比
|
|
106
111
|
if (dataAfter != undefined) {
|
|
107
112
|
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
108
|
-
if (JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
113
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
109
114
|
color = "red";
|
|
110
115
|
}
|
|
111
116
|
}
|
|
112
117
|
if (text != undefined && text.indexOf("@") != -1) {
|
|
113
118
|
text = text.substring(0, text.indexOf("@"));
|
|
114
119
|
}
|
|
115
|
-
return /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
120
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
116
121
|
labelStyle: {
|
|
117
122
|
color: color
|
|
118
123
|
},
|
|
119
124
|
span: ((_column$parameterSour4 = column.parameterSource) === null || _column$parameterSour4 === void 0 ? void 0 : _column$parameterSour4.detailSpan) || 1,
|
|
120
125
|
key: data[column.fieldId],
|
|
121
126
|
contentStyle: {
|
|
122
|
-
color: color
|
|
127
|
+
color: color,
|
|
128
|
+
textAlign: "left"
|
|
123
129
|
},
|
|
124
130
|
label: column.fieldName
|
|
125
|
-
}, dataToEnum(column.selectSource)[text], " ");
|
|
131
|
+
}, column.parameterSource), dataToEnum(column.selectSource)[text], " ");
|
|
126
132
|
} catch (err) {
|
|
127
133
|
console.log(err);
|
|
128
134
|
console.log("单选属性错误");
|
|
@@ -136,21 +142,22 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
136
142
|
//20240222调整后颜色对比
|
|
137
143
|
if (dataAfter != undefined) {
|
|
138
144
|
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
139
|
-
if (JSON.stringify(textAfter) != JSON.stringify(text)) {
|
|
145
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
140
146
|
color = "red";
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
|
-
return /*#__PURE__*/React.createElement(Descriptions.Item, {
|
|
149
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
144
150
|
labelStyle: {
|
|
145
151
|
color: color
|
|
146
152
|
},
|
|
147
153
|
span: ((_column$parameterSour5 = column.parameterSource) === null || _column$parameterSour5 === void 0 ? void 0 : _column$parameterSour5.detailSpan) || 1,
|
|
148
154
|
key: data[column.fieldId],
|
|
149
155
|
contentStyle: {
|
|
150
|
-
color: color
|
|
156
|
+
color: color,
|
|
157
|
+
textAlign: "left"
|
|
151
158
|
},
|
|
152
159
|
label: column.fieldName
|
|
153
|
-
}, dataToEnum(column.selectSource)[text], " ");
|
|
160
|
+
}, column.parameterSource), dataToEnum(column.selectSource)[text], " ");
|
|
154
161
|
} catch (err) {
|
|
155
162
|
console.log(err);
|
|
156
163
|
console.log("单选属性错误");
|
|
@@ -160,11 +167,24 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
160
167
|
try {
|
|
161
168
|
var _column$parameterSour6;
|
|
162
169
|
var dataFile = data[column.fieldId] != null && data[column.fieldId] != undefined ? JSON.parse(data[column.fieldId]) : undefined;
|
|
163
|
-
|
|
170
|
+
var text = data[column.fieldId] != null && data[column.fieldId] != undefined ? data[column.fieldId] : undefined;
|
|
171
|
+
var color = "#848f9b";
|
|
172
|
+
//20240222调整后颜色对比
|
|
173
|
+
if (dataAfter != undefined) {
|
|
174
|
+
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
175
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
176
|
+
color = "red";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
164
180
|
key: data[column.fieldId],
|
|
165
181
|
span: ((_column$parameterSour6 = column.parameterSource) === null || _column$parameterSour6 === void 0 ? void 0 : _column$parameterSour6.detailSpan) || 1,
|
|
182
|
+
contentStyle: {
|
|
183
|
+
color: color,
|
|
184
|
+
textAlign: "left"
|
|
185
|
+
},
|
|
166
186
|
label: column.fieldName
|
|
167
|
-
}, dataFile.map(function (v, n) {
|
|
187
|
+
}, column.parameterSource), dataFile.map(function (v, n) {
|
|
168
188
|
return /*#__PURE__*/React.createElement(DownLoadFile
|
|
169
189
|
//@ts-ignore
|
|
170
190
|
, {
|
|
@@ -191,11 +211,25 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
191
211
|
try {
|
|
192
212
|
var _column$parameterSour7;
|
|
193
213
|
var dataFile = data[column.fieldId] != null && data[column.fieldId] != undefined ? JSON.parse(data[column.fieldId]) : undefined;
|
|
194
|
-
|
|
214
|
+
var text = data[column.fieldId] != null && data[column.fieldId] != undefined ? data[column.fieldId] : undefined;
|
|
215
|
+
var color = "#848f9b";
|
|
216
|
+
//20240222调整后颜色对比
|
|
217
|
+
if (dataAfter != undefined) {
|
|
218
|
+
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
219
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
220
|
+
color = "red";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
195
224
|
key: column.fieldId,
|
|
196
225
|
span: ((_column$parameterSour7 = column.parameterSource) === null || _column$parameterSour7 === void 0 ? void 0 : _column$parameterSour7.detailSpan) || 1,
|
|
226
|
+
contentStyle: {
|
|
227
|
+
color: color,
|
|
228
|
+
textAlign: "left"
|
|
229
|
+
}
|
|
230
|
+
}, column.parameterSource, {
|
|
197
231
|
label: column.fieldName
|
|
198
|
-
}, dataFile.map(function (v) {
|
|
232
|
+
}), dataFile.map(function (v) {
|
|
199
233
|
return /*#__PURE__*/React.createElement("div", {
|
|
200
234
|
key: v.fileId,
|
|
201
235
|
style: {
|
|
@@ -233,11 +267,25 @@ export var VENUS_DETAIL_ITEM_TYPE = {
|
|
|
233
267
|
"uploadImage": function uploadImage(column, data, dataAfter) {
|
|
234
268
|
var _column$parameterSour8;
|
|
235
269
|
var textImageBase64 = data[column.fieldId] != null && data[column.fieldId] != undefined ? data[column.fieldId] : undefined;
|
|
236
|
-
|
|
270
|
+
var text = data[column.fieldId] != null && data[column.fieldId] != undefined ? data[column.fieldId] : undefined;
|
|
271
|
+
var color = "#848f9b";
|
|
272
|
+
//20240222调整后颜色对比
|
|
273
|
+
if (dataAfter != undefined) {
|
|
274
|
+
var textAfter = dataAfter[column.fieldId] != null && dataAfter[column.fieldId] != undefined ? dataAfter[column.fieldId] : undefined;
|
|
275
|
+
if (JSON.stringify(textAfter) != JSON.stringify(text) && text != undefined && textAfter != undefined) {
|
|
276
|
+
color = "red";
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return /*#__PURE__*/React.createElement(Descriptions.Item, _extends({
|
|
237
280
|
key: data[column.fieldId],
|
|
238
281
|
span: ((_column$parameterSour8 = column.parameterSource) === null || _column$parameterSour8 === void 0 ? void 0 : _column$parameterSour8.detailSpan) || 1,
|
|
282
|
+
contentStyle: {
|
|
283
|
+
color: color,
|
|
284
|
+
textAlign: "left"
|
|
285
|
+
}
|
|
286
|
+
}, column.parameterSource, {
|
|
239
287
|
label: column.fieldName
|
|
240
|
-
}, /*#__PURE__*/React.createElement(StyleProvider, {
|
|
288
|
+
}), /*#__PURE__*/React.createElement(StyleProvider, {
|
|
241
289
|
hashPriority: "high",
|
|
242
290
|
transformers: [legacyLogicalPropertiesTransformer]
|
|
243
291
|
}, /*#__PURE__*/React.createElement(_Image, {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { VenusFormGroupInterface, VenusFormItemInterface } from './interface';
|
|
3
|
+
/**
|
|
4
|
+
* 脚本执行上下文 - 暴露给脚本的 API
|
|
5
|
+
*/
|
|
6
|
+
export interface ScriptContext {
|
|
7
|
+
form: FormInstance;
|
|
8
|
+
formData: Record<string, any>;
|
|
9
|
+
changedField?: string;
|
|
10
|
+
changedValue?: any;
|
|
11
|
+
fields: VenusFormItemInterface[];
|
|
12
|
+
utils: ScriptUtils;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 脚本工具方法
|
|
16
|
+
*/
|
|
17
|
+
export interface ScriptUtils {
|
|
18
|
+
getValue: (fieldId: string) => any;
|
|
19
|
+
setValue: (fieldId: string, value: any) => void;
|
|
20
|
+
setValues: (values: Record<string, any>) => void;
|
|
21
|
+
setVisible: (fieldId: string, visible: boolean) => void;
|
|
22
|
+
setDisabled: (fieldId: string, disabled: boolean) => void;
|
|
23
|
+
setRequired: (fieldId: string, required: boolean) => void;
|
|
24
|
+
setOptions: (fieldId: string, options: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
value: any;
|
|
27
|
+
}>) => void;
|
|
28
|
+
getField: (fieldId: string) => VenusFormItemInterface | undefined;
|
|
29
|
+
message: {
|
|
30
|
+
success: (msg: string) => void;
|
|
31
|
+
error: (msg: string) => void;
|
|
32
|
+
warning: (msg: string) => void;
|
|
33
|
+
info: (msg: string) => void;
|
|
34
|
+
};
|
|
35
|
+
confirm: (title: string, content?: string) => Promise<boolean>;
|
|
36
|
+
sleep: (ms: number) => Promise<void>;
|
|
37
|
+
request: (url: string, options?: RequestInit) => Promise<any>;
|
|
38
|
+
console: {
|
|
39
|
+
log: (...args: any[]) => void;
|
|
40
|
+
error: (...args: any[]) => void;
|
|
41
|
+
warn: (...args: any[]) => void;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 脚本执行结果
|
|
46
|
+
*/
|
|
47
|
+
export interface ScriptResult {
|
|
48
|
+
success: boolean;
|
|
49
|
+
error?: string;
|
|
50
|
+
modifiedFormData?: VenusFormGroupInterface[];
|
|
51
|
+
setFieldValues?: Record<string, any>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 脚本引擎配置
|
|
55
|
+
*/
|
|
56
|
+
export interface ScriptEngineOptions {
|
|
57
|
+
debug?: boolean;
|
|
58
|
+
timeout?: number;
|
|
59
|
+
globals?: Record<string, any>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 表单脚本引擎
|
|
63
|
+
*/
|
|
64
|
+
export declare class VenusFormScriptEngine {
|
|
65
|
+
private options;
|
|
66
|
+
private scriptCache;
|
|
67
|
+
constructor(options?: ScriptEngineOptions);
|
|
68
|
+
/**
|
|
69
|
+
* 编译脚本(缓存编译结果)
|
|
70
|
+
*/
|
|
71
|
+
compile(scriptContent: string, scriptId?: string): Function;
|
|
72
|
+
/**
|
|
73
|
+
* 执行脚本
|
|
74
|
+
*/
|
|
75
|
+
execute(scriptContent: string, context: ScriptContext, scriptId?: string): Promise<ScriptResult>;
|
|
76
|
+
/**
|
|
77
|
+
* 批量执行脚本
|
|
78
|
+
*/
|
|
79
|
+
executeBatch(scripts: Array<{
|
|
80
|
+
id: string;
|
|
81
|
+
content: string;
|
|
82
|
+
eventType: string;
|
|
83
|
+
}>, context: ScriptContext, filterEvent?: string): Promise<ScriptResult[]>;
|
|
84
|
+
/**
|
|
85
|
+
* 清除缓存
|
|
86
|
+
*/
|
|
87
|
+
clearCache(): void;
|
|
88
|
+
}
|
|
89
|
+
export interface FormScript {
|
|
90
|
+
id: string;
|
|
91
|
+
scriptName: string;
|
|
92
|
+
scriptContent: string;
|
|
93
|
+
eventType: 'onLoad' | 'onChange' | 'onSubmit' | 'onValidate' | 'afterRender';
|
|
94
|
+
sortOrder: number;
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
/**
|
|
17
|
+
* 脚本执行上下文 - 暴露给脚本的 API
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 脚本工具方法
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 脚本执行结果
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 脚本引擎配置
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 表单脚本引擎
|
|
34
|
+
*/
|
|
35
|
+
export var VenusFormScriptEngine = /*#__PURE__*/function () {
|
|
36
|
+
function VenusFormScriptEngine() {
|
|
37
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
38
|
+
_classCallCheck(this, VenusFormScriptEngine);
|
|
39
|
+
_defineProperty(this, "options", void 0);
|
|
40
|
+
_defineProperty(this, "scriptCache", new Map());
|
|
41
|
+
this.options = _objectSpread({
|
|
42
|
+
debug: false,
|
|
43
|
+
timeout: 5000,
|
|
44
|
+
globals: {}
|
|
45
|
+
}, options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 编译脚本(缓存编译结果)
|
|
50
|
+
*/
|
|
51
|
+
_createClass(VenusFormScriptEngine, [{
|
|
52
|
+
key: "compile",
|
|
53
|
+
value: function compile(scriptContent) {
|
|
54
|
+
var scriptId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'anonymous';
|
|
55
|
+
if (this.scriptCache.has(scriptId)) {
|
|
56
|
+
return this.scriptCache.get(scriptId);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 创建安全的函数:只暴露 context 参数
|
|
60
|
+
var wrappedScript = "\n return async function(context) {\n \"use strict\";\n const { form, formData, changedField, changedValue, fields, utils } = context;\n const { getValue, setValue, setValues, setVisible, setDisabled, setRequired, setOptions, getField, message, confirm, sleep, request, console } = utils;\n \n try {\n ".concat(scriptContent, "\n } catch (e) {\n throw e;\n }\n }\n ");
|
|
61
|
+
try {
|
|
62
|
+
// 使用 new Function 创建函数,不暴露 window/document 等全局对象
|
|
63
|
+
var fn = new Function(wrappedScript)();
|
|
64
|
+
this.scriptCache.set(scriptId, fn);
|
|
65
|
+
return fn;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
throw new Error("\u811A\u672C\u7F16\u8BD1\u5931\u8D25 [".concat(scriptId, "]: ").concat(e instanceof Error ? e.message : String(e)));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 执行脚本
|
|
73
|
+
*/
|
|
74
|
+
}, {
|
|
75
|
+
key: "execute",
|
|
76
|
+
value: (function () {
|
|
77
|
+
var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(scriptContent, context) {
|
|
78
|
+
var _this = this;
|
|
79
|
+
var scriptId,
|
|
80
|
+
startTime,
|
|
81
|
+
fn,
|
|
82
|
+
executePromise,
|
|
83
|
+
timeoutPromise,
|
|
84
|
+
errorMsg,
|
|
85
|
+
_args = arguments;
|
|
86
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
87
|
+
while (1) switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
scriptId = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'anonymous';
|
|
90
|
+
startTime = Date.now();
|
|
91
|
+
_context.prev = 2;
|
|
92
|
+
fn = this.compile(scriptContent, scriptId); // 创建带超时的 Promise
|
|
93
|
+
executePromise = fn(context);
|
|
94
|
+
timeoutPromise = new Promise(function (_, reject) {
|
|
95
|
+
setTimeout(function () {
|
|
96
|
+
return reject(new Error('脚本执行超时'));
|
|
97
|
+
}, _this.options.timeout);
|
|
98
|
+
});
|
|
99
|
+
_context.next = 8;
|
|
100
|
+
return Promise.race([executePromise, timeoutPromise]);
|
|
101
|
+
case 8:
|
|
102
|
+
if (this.options.debug) {
|
|
103
|
+
console.log("[\u811A\u672C\u5F15\u64CE] [".concat(scriptId, "] \u6267\u884C\u6210\u529F\uFF0C\u8017\u65F6 ").concat(Date.now() - startTime, "ms"));
|
|
104
|
+
}
|
|
105
|
+
return _context.abrupt("return", {
|
|
106
|
+
success: true
|
|
107
|
+
});
|
|
108
|
+
case 12:
|
|
109
|
+
_context.prev = 12;
|
|
110
|
+
_context.t0 = _context["catch"](2);
|
|
111
|
+
errorMsg = _context.t0 instanceof Error ? _context.t0.message : String(_context.t0);
|
|
112
|
+
console.error("[\u811A\u672C\u5F15\u64CE] [".concat(scriptId, "] \u6267\u884C\u5931\u8D25:"), errorMsg);
|
|
113
|
+
return _context.abrupt("return", {
|
|
114
|
+
success: false,
|
|
115
|
+
error: errorMsg
|
|
116
|
+
});
|
|
117
|
+
case 17:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}, _callee, this, [[2, 12]]);
|
|
122
|
+
}));
|
|
123
|
+
function execute(_x, _x2) {
|
|
124
|
+
return _execute.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
return execute;
|
|
127
|
+
}()
|
|
128
|
+
/**
|
|
129
|
+
* 批量执行脚本
|
|
130
|
+
*/
|
|
131
|
+
)
|
|
132
|
+
}, {
|
|
133
|
+
key: "executeBatch",
|
|
134
|
+
value: (function () {
|
|
135
|
+
var _executeBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(scripts, context, filterEvent) {
|
|
136
|
+
var results, filteredScripts, _iterator, _step, script, result;
|
|
137
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
138
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
results = [];
|
|
141
|
+
filteredScripts = filterEvent ? scripts.filter(function (s) {
|
|
142
|
+
return s.eventType === filterEvent;
|
|
143
|
+
}) : scripts; // 按 sortOrder 排序
|
|
144
|
+
filteredScripts.sort(function (a, b) {
|
|
145
|
+
return a.sortOrder - b.sortOrder;
|
|
146
|
+
});
|
|
147
|
+
_iterator = _createForOfIteratorHelper(filteredScripts);
|
|
148
|
+
_context2.prev = 4;
|
|
149
|
+
_iterator.s();
|
|
150
|
+
case 6:
|
|
151
|
+
if ((_step = _iterator.n()).done) {
|
|
152
|
+
_context2.next = 16;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
script = _step.value;
|
|
156
|
+
_context2.next = 10;
|
|
157
|
+
return this.execute(script.content, context, script.id);
|
|
158
|
+
case 10:
|
|
159
|
+
result = _context2.sent;
|
|
160
|
+
results.push(result);
|
|
161
|
+
|
|
162
|
+
// 如果脚本执行失败且配置了严格模式,中断后续执行
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
if (!(!result.success && this.options.strict)) {
|
|
165
|
+
_context2.next = 14;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
return _context2.abrupt("break", 16);
|
|
169
|
+
case 14:
|
|
170
|
+
_context2.next = 6;
|
|
171
|
+
break;
|
|
172
|
+
case 16:
|
|
173
|
+
_context2.next = 21;
|
|
174
|
+
break;
|
|
175
|
+
case 18:
|
|
176
|
+
_context2.prev = 18;
|
|
177
|
+
_context2.t0 = _context2["catch"](4);
|
|
178
|
+
_iterator.e(_context2.t0);
|
|
179
|
+
case 21:
|
|
180
|
+
_context2.prev = 21;
|
|
181
|
+
_iterator.f();
|
|
182
|
+
return _context2.finish(21);
|
|
183
|
+
case 24:
|
|
184
|
+
return _context2.abrupt("return", results);
|
|
185
|
+
case 25:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context2.stop();
|
|
188
|
+
}
|
|
189
|
+
}, _callee2, this, [[4, 18, 21, 24]]);
|
|
190
|
+
}));
|
|
191
|
+
function executeBatch(_x3, _x4, _x5) {
|
|
192
|
+
return _executeBatch.apply(this, arguments);
|
|
193
|
+
}
|
|
194
|
+
return executeBatch;
|
|
195
|
+
}()
|
|
196
|
+
/**
|
|
197
|
+
* 清除缓存
|
|
198
|
+
*/
|
|
199
|
+
)
|
|
200
|
+
}, {
|
|
201
|
+
key: "clearCache",
|
|
202
|
+
value: function clearCache() {
|
|
203
|
+
this.scriptCache.clear();
|
|
204
|
+
}
|
|
205
|
+
}]);
|
|
206
|
+
return VenusFormScriptEngine;
|
|
207
|
+
}();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FormInstance, message } from 'antd';
|
|
2
|
+
import { VenusFormGroupInterface } from './interface';
|
|
3
|
+
import { ScriptUtils } from './VenusFormScriptEngine';
|
|
4
|
+
/**
|
|
5
|
+
* 创建脚本工具方法实例
|
|
6
|
+
*/
|
|
7
|
+
export declare const createScriptUtils: (form: FormInstance, formDataConfig: VenusFormGroupInterface[], setFormDataConfig: (data: VenusFormGroupInterface[]) => void, messageApi: typeof message) => ScriptUtils;
|