@lcap/nasl-concepts 3.10.1-rc.1 → 3.10.2-alpha.3
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/README.md +3 -3
- package/out/common/BaseNode.d.ts +8 -16
- package/out/common/BaseNode.d.ts.map +1 -1
- package/out/common/BaseNode.js +22 -69
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +18 -8
- package/out/concepts/App__.d.ts.map +1 -1
- package/out/concepts/App__.js +78 -1
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +1 -1
- package/out/concepts/Argument__.d.ts.map +1 -1
- package/out/concepts/Argument__.js +3 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +25 -25
- package/out/concepts/BusinessComponent__.js +30 -30
- package/out/concepts/CallAuthInterface__.d.ts.map +1 -1
- package/out/concepts/CallAuthInterface__.js +7 -4
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +11 -3
- package/out/concepts/CallConnector__.d.ts.map +1 -1
- package/out/concepts/CallConnector__.js +156 -16
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts.map +1 -1
- package/out/concepts/CallInterface__.js +2 -3
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +6 -1
- package/out/concepts/CallLogic__.d.ts.map +1 -1
- package/out/concepts/CallLogic__.js +49 -41
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +2 -2
- package/out/concepts/ConnectorLogic__.d.ts +10 -1
- package/out/concepts/ConnectorLogic__.d.ts.map +1 -1
- package/out/concepts/ConnectorLogic__.js +72 -0
- package/out/concepts/ConnectorLogic__.js.map +1 -1
- package/out/concepts/Connector__.d.ts +1 -1
- package/out/concepts/Connector__.d.ts.map +1 -1
- package/out/concepts/Connector__.js +7 -1
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +5 -0
- package/out/concepts/FrontendType__.d.ts.map +1 -1
- package/out/concepts/FrontendType__.js +18 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts.map +1 -1
- package/out/concepts/Identifier__.js +3 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +4 -0
- package/out/concepts/Interface__.d.ts.map +1 -1
- package/out/concepts/Interface__.js +8 -0
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +13 -1
- package/out/concepts/Logic__.d.ts.map +1 -1
- package/out/concepts/Logic__.js +43 -2
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +1 -1
- package/out/concepts/NewComposite__.js +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/New__.d.ts +1 -0
- package/out/concepts/New__.d.ts.map +1 -1
- package/out/concepts/New__.js +7 -0
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/ProcessV2__.js +1 -1
- package/out/concepts/Structure__.d.ts +0 -6
- package/out/concepts/Structure__.d.ts.map +1 -1
- package/out/concepts/Structure__.js +0 -46
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +1 -0
- package/out/concepts/TypeAnnotation__.d.ts.map +1 -1
- package/out/concepts/TypeAnnotation__.js +8 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +5 -0
- package/out/concepts/ViewElement__.d.ts.map +1 -1
- package/out/concepts/ViewElement__.js +73 -35
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +2 -1
- package/out/concepts/View__.d.ts.map +1 -1
- package/out/concepts/View__.js +297 -259
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts.map +1 -1
- package/out/concepts/WhileStatement__.js +8 -2
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.d.ts.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js +8 -1
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/service/annotation.d.ts +2 -0
- package/out/service/annotation.d.ts.map +1 -1
- package/out/service/annotation.js +11 -7
- package/out/service/annotation.js.map +1 -1
- package/out/service/callLogicHeader.d.ts +3 -0
- package/out/service/callLogicHeader.d.ts.map +1 -0
- package/out/service/callLogicHeader.js +13 -0
- package/out/service/callLogicHeader.js.map +1 -0
- package/out/service/formatTsUtils.d.ts +3 -2
- package/out/service/formatTsUtils.d.ts.map +1 -1
- package/out/service/formatTsUtils.js +20 -9
- package/out/service/formatTsUtils.js.map +1 -1
- package/out/service/getConnector.d.ts +1 -1
- package/out/service/getConnector.d.ts.map +1 -1
- package/out/service/getConnector.js +50 -11
- package/out/service/getConnector.js.map +1 -1
- package/out/service/getMemberIdentifier.d.ts +12 -0
- package/out/service/getMemberIdentifier.d.ts.map +1 -1
- package/out/service/getMemberIdentifier.js +39 -20
- package/out/service/getMemberIdentifier.js.map +1 -1
- package/out/service/index.d.ts +1 -0
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +1 -0
- package/out/service/index.js.map +1 -1
- package/out/utils/bak-translator.d.ts.map +1 -1
- package/out/utils/bak-translator.js +38 -47
- package/out/utils/bak-translator.js.map +1 -1
- package/out/utils/constant.d.ts +1 -0
- package/out/utils/constant.d.ts.map +1 -1
- package/out/utils/constant.js +3 -1
- package/out/utils/constant.js.map +1 -1
- package/out/utils/style.d.ts +7 -0
- package/out/utils/style.d.ts.map +1 -0
- package/out/utils/style.js +119 -0
- package/out/utils/style.js.map +1 -0
- package/package.json +6 -5
package/out/concepts/View__.js
CHANGED
|
@@ -1042,271 +1042,277 @@ let View = class View extends Annotatable__1.default {
|
|
|
1042
1042
|
};
|
|
1043
1043
|
let code = '';
|
|
1044
1044
|
let mixin = '';
|
|
1045
|
-
const keyboardEventMixinCode = `const keyboardEventMixin = {
|
|
1046
|
-
mounted() {
|
|
1047
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
1048
|
-
document.addEventListener('keyup', this.onKeyUp);
|
|
1049
|
-
},
|
|
1050
|
-
beforeDestroy() {
|
|
1051
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
1052
|
-
document.removeEventListener('keyup', this.onKeyUp);
|
|
1053
|
-
},
|
|
1054
|
-
methods: {
|
|
1055
|
-
async onKeyDown(e) {
|
|
1045
|
+
const keyboardEventMixinCode = `const keyboardEventMixin = {
|
|
1046
|
+
mounted() {
|
|
1047
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
1048
|
+
document.addEventListener('keyup', this.onKeyUp);
|
|
1049
|
+
},
|
|
1050
|
+
beforeDestroy() {
|
|
1051
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
1052
|
+
document.removeEventListener('keyup', this.onKeyUp);
|
|
1053
|
+
},
|
|
1054
|
+
methods: {
|
|
1055
|
+
async onKeyDown(e) {
|
|
1056
1056
|
${this.bindEvents
|
|
1057
1057
|
.filter((event) => ['keydown'].includes(event.name))
|
|
1058
1058
|
.map((event) => `await this.${event.view.name}_${event.name}(e);`)
|
|
1059
|
-
.join('\n')}
|
|
1060
|
-
},
|
|
1061
|
-
async onKeyUp(e) {
|
|
1059
|
+
.join('\n')}
|
|
1060
|
+
},
|
|
1061
|
+
async onKeyUp(e) {
|
|
1062
1062
|
${this.bindEvents
|
|
1063
1063
|
.filter((event) => ['keyup'].includes(event.name))
|
|
1064
1064
|
.map((event) => `await this.${event.view.name}_${event.name}(e);`)
|
|
1065
|
-
.join('\n')}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1065
|
+
.join('\n')}
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
1068
|
};\n`;
|
|
1069
1069
|
code += keyboardEventMixinCode;
|
|
1070
|
-
const processDetailFrom = this.getViewProcessForm(), hasProcessDetailFrom = !!processDetailFrom, processV2 = this.getDestinationProcessV2
|
|
1070
|
+
const processDetailFrom = this.getViewProcessForm(), hasProcessDetailFrom = !!processDetailFrom, processV2 = this.getDestinationProcessV2;
|
|
1071
1071
|
if (hasProcessDetailFrom) {
|
|
1072
|
-
const processDetailFromMixinCode = `const processDetailFromMixin = {
|
|
1073
|
-
data() {
|
|
1074
|
-
return {
|
|
1075
|
-
processDetailFormData: {},
|
|
1076
|
-
${processV2.name} : {
|
|
1077
|
-
data: {},
|
|
1078
|
-
},
|
|
1079
|
-
${processDetailFrom.getBindAttribute('processPrefix')?.value} : {
|
|
1080
|
-
data: {},
|
|
1081
|
-
},
|
|
1082
|
-
formTemplate: "", // 表单模版
|
|
1083
|
-
formVM: null, // 表单实例
|
|
1084
|
-
needReplaced: false, // 是否需要替换模版
|
|
1085
|
-
}
|
|
1086
|
-
},
|
|
1087
|
-
methods: {
|
|
1088
|
-
sliceStrByTag(tag, referIndex, startIndex = 0, endIndex = Infinity) {
|
|
1089
|
-
const sliceEndIndex = this.formTemplate.indexOf(\`</\${tag}>\`, referIndex);
|
|
1090
|
-
if (sliceEndIndex > -1 && sliceEndIndex < endIndex) {
|
|
1091
|
-
const sliceStartIndex = this.formTemplate.lastIndexOf(\`<\${tag} \`,sliceEndIndex);
|
|
1092
|
-
if (sliceStartIndex > -1 && sliceStartIndex > startIndex) {
|
|
1093
|
-
return this.formTemplate.substring(sliceStartIndex, sliceEndIndex + (\`</\${tag}>\`).length);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
return '';
|
|
1097
|
-
},
|
|
1098
|
-
modifyFieldTemplateByPermission(replaceTemplateList, propertyName, fieldStr, permission, tag, relationDataName) {
|
|
1099
|
-
let startIndex = 0, endIndex = Infinity;
|
|
1100
|
-
if (relationDataName) {
|
|
1101
|
-
const tableIndexConfig = this.getRelationDataStartAndEndIndex(relationDataName)
|
|
1102
|
-
startIndex = tableIndexConfig.tableStartIndex
|
|
1103
|
-
endIndex = tableIndexConfig.tableEndIndex
|
|
1104
|
-
}
|
|
1105
|
-
let itemStr = '';
|
|
1106
|
-
const replaceStr = \`<span text=\${fieldStr}></span>\`
|
|
1107
|
-
const fieldStrIndex = this.formTemplate.indexOf(fieldStr, startIndex);
|
|
1108
|
-
if (fieldStrIndex > -1 && fieldStrIndex < endIndex) {
|
|
1109
|
-
itemStr = this.sliceStrByTag(tag, fieldStrIndex, startIndex, endIndex);
|
|
1110
|
-
if (permission === 'hidden') {
|
|
1111
|
-
this.formTemplate = this.formTemplate.replace(itemStr, '');
|
|
1112
|
-
return;
|
|
1113
|
-
} else if (['readOnly', 'preview'].includes(permission)) {
|
|
1114
|
-
const newItemStr = itemStr.replace(fieldStr, \`\${fieldStr} preview \`);
|
|
1115
|
-
this.formTemplate = this.formTemplate.replace(itemStr, newItemStr);
|
|
1116
|
-
itemStr = newItemStr;
|
|
1117
|
-
}
|
|
1118
|
-
// 先使用替换模版填充,保证初始化可渲染
|
|
1119
|
-
this.formTemplate = this.formTemplate.replace(itemStr, replaceStr);
|
|
1120
|
-
replaceTemplateList.push({
|
|
1121
|
-
propertyName,
|
|
1122
|
-
origin: itemStr,
|
|
1123
|
-
replace: replaceStr
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
return startIndex;
|
|
1127
|
-
},
|
|
1128
|
-
getRelationDataStartAndEndIndex(relationDataName) {
|
|
1129
|
-
const tag = 'u-table-view';
|
|
1130
|
-
let tableStartIndex = tableEndIndex = -1;
|
|
1131
|
-
const reg = new RegExp(\`dataSource="[^"]*processDetailFormData[^"]*\\\\.\${relationDataName}"\`, 'g');
|
|
1132
|
-
const match = this.formTemplate.match(reg);
|
|
1133
|
-
if (match && match.length) {
|
|
1134
|
-
const relationDataStr = match[0], relationDataStrIndex = this.formTemplate.indexOf(relationDataStr);
|
|
1135
|
-
tableEndIndex = this.formTemplate.indexOf('</' + tag + '>',relationDataStrIndex);
|
|
1136
|
-
if (tableEndIndex > -1) {
|
|
1137
|
-
tableStartIndex = this.formTemplate.lastIndexOf('<' + tag + ' ',tableEndIndex);
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
//
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
//
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1072
|
+
const processDetailFromMixinCode = `const processDetailFromMixin = {
|
|
1073
|
+
data() {
|
|
1074
|
+
return {
|
|
1075
|
+
processDetailFormData: {},
|
|
1076
|
+
${processV2.name} : {
|
|
1077
|
+
data: {},
|
|
1078
|
+
},
|
|
1079
|
+
${processDetailFrom.getBindAttribute('processPrefix')?.value} : {
|
|
1080
|
+
data: {},
|
|
1081
|
+
},
|
|
1082
|
+
formTemplate: "", // 表单模版
|
|
1083
|
+
formVM: null, // 表单实例
|
|
1084
|
+
needReplaced: false, // 是否需要替换模版
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
methods: {
|
|
1088
|
+
sliceStrByTag(tag, referIndex, startIndex = 0, endIndex = Infinity) {
|
|
1089
|
+
const sliceEndIndex = this.formTemplate.indexOf(\`</\${tag}>\`, referIndex);
|
|
1090
|
+
if (sliceEndIndex > -1 && sliceEndIndex < endIndex) {
|
|
1091
|
+
const sliceStartIndex = this.formTemplate.lastIndexOf(\`<\${tag} \`,sliceEndIndex);
|
|
1092
|
+
if (sliceStartIndex > -1 && sliceStartIndex > startIndex) {
|
|
1093
|
+
return this.formTemplate.substring(sliceStartIndex, sliceEndIndex + (\`</\${tag}>\`).length);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return '';
|
|
1097
|
+
},
|
|
1098
|
+
modifyFieldTemplateByPermission(replaceTemplateList, propertyName, fieldStr, permission, tag, relationDataName) {
|
|
1099
|
+
let startIndex = 0, endIndex = Infinity;
|
|
1100
|
+
if (relationDataName) {
|
|
1101
|
+
const tableIndexConfig = this.getRelationDataStartAndEndIndex(relationDataName)
|
|
1102
|
+
startIndex = tableIndexConfig.tableStartIndex
|
|
1103
|
+
endIndex = tableIndexConfig.tableEndIndex
|
|
1104
|
+
}
|
|
1105
|
+
let itemStr = '';
|
|
1106
|
+
const replaceStr = \`<span text=\${fieldStr}></span>\`
|
|
1107
|
+
const fieldStrIndex = this.formTemplate.indexOf(fieldStr, startIndex);
|
|
1108
|
+
if (fieldStrIndex > -1 && fieldStrIndex < endIndex) {
|
|
1109
|
+
itemStr = this.sliceStrByTag(tag, fieldStrIndex, startIndex, endIndex);
|
|
1110
|
+
if (permission === 'hidden') {
|
|
1111
|
+
this.formTemplate = this.formTemplate.replace(itemStr, '');
|
|
1112
|
+
return startIndex;
|
|
1113
|
+
} else if (['readOnly', 'preview'].includes(permission)) {
|
|
1114
|
+
const newItemStr = itemStr.replace(fieldStr, \`\${fieldStr} preview \`);
|
|
1115
|
+
this.formTemplate = this.formTemplate.replace(itemStr, newItemStr);
|
|
1116
|
+
itemStr = newItemStr;
|
|
1117
|
+
}
|
|
1118
|
+
// 先使用替换模版填充,保证初始化可渲染
|
|
1119
|
+
this.formTemplate = this.formTemplate.replace(itemStr, replaceStr);
|
|
1120
|
+
replaceTemplateList.push({
|
|
1121
|
+
propertyName,
|
|
1122
|
+
origin: itemStr,
|
|
1123
|
+
replace: replaceStr
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
return startIndex;
|
|
1127
|
+
},
|
|
1128
|
+
getRelationDataStartAndEndIndex(relationDataName) {
|
|
1129
|
+
const tag = 'u-table-view';
|
|
1130
|
+
let tableStartIndex = tableEndIndex = -1;
|
|
1131
|
+
const reg = new RegExp(\`dataSource="[^"]*processDetailFormData[^"]*\\\\.\${relationDataName}"\`, 'g');
|
|
1132
|
+
const match = this.formTemplate.match(reg);
|
|
1133
|
+
if (match && match.length) {
|
|
1134
|
+
const relationDataStr = match[0], relationDataStrIndex = this.formTemplate.indexOf(relationDataStr);
|
|
1135
|
+
tableEndIndex = this.formTemplate.indexOf('</' + tag + '>',relationDataStrIndex);
|
|
1136
|
+
if (tableEndIndex > -1) {
|
|
1137
|
+
tableStartIndex = this.formTemplate.lastIndexOf('<' + tag + ' ',tableEndIndex);
|
|
1138
|
+
// console.log('tableStr', this.formTemplate.slice(startIndex, endIndex + tag.length + 3));
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return { tableStartIndex, tableEndIndex };
|
|
1142
|
+
},
|
|
1143
|
+
dynamicRender(vmRoot){
|
|
1144
|
+
const Local = Vue.extend({
|
|
1145
|
+
template: this.formTemplate,
|
|
1146
|
+
data() {
|
|
1147
|
+
return {
|
|
1148
|
+
...vmRoot.$data
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
methods: Object.assign(
|
|
1152
|
+
{},
|
|
1153
|
+
...Object.entries(vmRoot.$options.methods).map(([key, method]) => ({
|
|
1154
|
+
[key]: method.bind(vmRoot)
|
|
1155
|
+
}))
|
|
1156
|
+
)
|
|
1157
|
+
})
|
|
1158
|
+
this.formVM = new Local()
|
|
1159
|
+
this.formVM.$refs = vmRoot.$refs
|
|
1160
|
+
this.formVM.$mount()
|
|
1161
|
+
this.needReplaced = !this.formVM?.$el?.firstChild // 判断当前模版是否渲染成功
|
|
1162
|
+
},
|
|
1163
|
+
renderForm ({fieldReplTemplates, vmRoot, isSubForm}) {
|
|
1164
|
+
for (let i = 0; i <= fieldReplTemplates.length; i++) {
|
|
1165
|
+
const { propertyName, origin, replace } = fieldReplTemplates[i] || {};
|
|
1166
|
+
// step1: 如果上一次渲染失败,更换为替换模版
|
|
1167
|
+
if (this.needReplaced && i > 0) {
|
|
1168
|
+
const { origin: lastOrigin, replace: lastReplace } = fieldReplTemplates[i - 1];
|
|
1169
|
+
this.formTemplate = this.formTemplate.replace(lastOrigin, lastReplace);
|
|
1170
|
+
}
|
|
1171
|
+
// step2: 如果子表单的首次渲染失败,则不在继续替换后续模版,直接取消掉该子表单的渲染
|
|
1172
|
+
if (isSubForm && this.needReplaced && i === 1) break;
|
|
1173
|
+
// step3: 尝试用原始模板渲染
|
|
1174
|
+
if (propertyName) this.formTemplate = this.formTemplate.replace(replace, origin);
|
|
1175
|
+
// step4: 动态渲染
|
|
1176
|
+
if (propertyName || this.needReplaced || i === 0) this.dynamicRender(vmRoot)
|
|
1177
|
+
}
|
|
1178
|
+
this.needReplaced = false;
|
|
1179
|
+
},
|
|
1180
|
+
cutStrByTag(template, tag, filterReferStr) {
|
|
1181
|
+
const filterReferStrIndex = template.indexOf(filterReferStr);
|
|
1182
|
+
const endIndex = template.indexOf(\`</\${tag}>\`, filterReferStrIndex);
|
|
1183
|
+
if (endIndex > -1) {
|
|
1184
|
+
const startIndex = template.lastIndexOf(\`<\${tag} \`, endIndex);
|
|
1185
|
+
if (startIndex > -1) {
|
|
1186
|
+
const targetStr = template.substring(startIndex, endIndex + (\`</\${tag}>\`).length);
|
|
1187
|
+
return template.replace(targetStr, '');
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return template;
|
|
1191
|
+
},
|
|
1192
|
+
previewSubFormTemplate(stencilStr){
|
|
1193
|
+
stencilStr = this.cutStrByTag(stencilStr, 'u-button', ':subFormBtnType="\`add\`"' )
|
|
1194
|
+
stencilStr = this.cutStrByTag(stencilStr, 'u-table-view-column', ':subFormInitialColumn="\`action\`"' )
|
|
1195
|
+
return stencilStr
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
async mounted() {
|
|
1199
|
+
try {
|
|
1200
|
+
const taskId = this.$route.query.taskId
|
|
1201
|
+
if (!taskId) return
|
|
1202
|
+
// 获取表单定义
|
|
1203
|
+
let templateProcessDetailFrom = await this.$processV2.getProcessFormDefinition({
|
|
1204
|
+
body: { taskId }
|
|
1205
|
+
})
|
|
1206
|
+
this.formTemplate = templateProcessDetailFrom?.data
|
|
1207
|
+
// 获取表单数据
|
|
1208
|
+
let formData = await this.$processV2.getTaskInstanceForm({ body: { taskId } })
|
|
1209
|
+
formData = formData?.data
|
|
1210
|
+
// 获取流程变量
|
|
1211
|
+
let processVars = await this.$processV2.getProcVariable({ body: { taskId } })
|
|
1212
|
+
processVars = processVars?.data
|
|
1213
|
+
formData = { ...formData, ...processVars }
|
|
1214
|
+
// 获取字段权限
|
|
1215
|
+
// let fieldPermission = await this.$processV2.fieldPermissionDetail({ body: { taskId } }) // 旧接口
|
|
1216
|
+
const fieldPermission = await this.$processV2.getFieldPermissionDetail({ body: { taskId } })
|
|
1217
|
+
|
|
1218
|
+
const itemTag = ${this.frontend.type === 'pc' ? `'u-form-item'` : `'van-field'`};
|
|
1219
|
+
|
|
1220
|
+
// 主表单的字段权限
|
|
1221
|
+
const mainPerms = fieldPermission?.data?.[0]?.subFieldPermissions || []
|
|
1222
|
+
// 主表字段渲染错误时的替换模版
|
|
1223
|
+
const mainReplTemplates = []
|
|
1224
|
+
mainPerms.forEach(({propertyName, permission}) => {
|
|
1225
|
+
const fieldStrReg = new RegExp(\`"[^"]*processDetailFormData[^"]*\\\\.data[^"]*\\\\.\${propertyName}"\`, "g");
|
|
1226
|
+
const fieldStr = this.formTemplate.match(fieldStrReg)?.[0];
|
|
1227
|
+
if (!fieldStr) return;
|
|
1228
|
+
this.modifyFieldTemplateByPermission(mainReplTemplates ,propertyName, fieldStr, permission,itemTag);
|
|
1229
|
+
})
|
|
1230
|
+
|
|
1231
|
+
// n个子表单的字段权限 (n>=0)
|
|
1232
|
+
const subPerms = fieldPermission?.data?.slice(1) || []
|
|
1233
|
+
// 子字段渲染错误时的替换模版
|
|
1234
|
+
const subReplTemplates = []
|
|
1235
|
+
if (subPerms.length && ${this.frontend.type === 'pc'}) {
|
|
1236
|
+
const fieldTag = 'u-table-view-column', stencilTag = 'u-grid-layout-column';
|
|
1237
|
+
// 遍历每个子表单
|
|
1238
|
+
subPerms.forEach((relationData) => {
|
|
1239
|
+
const { propertyName, subFieldPermissions, permission } = relationData;
|
|
1240
|
+
// step1: 判断是否存在当前子表单
|
|
1241
|
+
let { tableStartIndex, tableEndIndex } = this.getRelationDataStartAndEndIndex(propertyName)
|
|
1242
|
+
if (tableStartIndex === -1 || tableEndIndex === -1) return;
|
|
1243
|
+
let stencilStr = this.sliceStrByTag(stencilTag, tableStartIndex);
|
|
1244
|
+
// step2: 根据子表单整体权限,控制子表单的部分节点 或 整个子表单 的隐藏
|
|
1245
|
+
if(['readOnly', 'preview'].includes(permission)){
|
|
1246
|
+
const newStencilStr = this.previewSubFormTemplate(stencilStr)
|
|
1247
|
+
this.formTemplate = this.formTemplate.replace(stencilStr, newStencilStr)
|
|
1248
|
+
stencilStr = newStencilStr
|
|
1249
|
+
}else if(permission === 'hidden'){
|
|
1250
|
+
this.formTemplate = this.formTemplate.replace(stencilStr, '')
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
// step3: 初始化存放槽位
|
|
1254
|
+
const curReplTemplates = []
|
|
1255
|
+
subReplTemplates.push(curReplTemplates);
|
|
1256
|
+
// step4: 遍历当前子表单的字段权限
|
|
1257
|
+
subFieldPermissions.forEach(({ propertyName: fieldName, permission: fieldPermission }, index) => {
|
|
1258
|
+
const fieldStr = \`"current.item.\${fieldName}"\`;
|
|
1259
|
+
tableStartIndex = this.modifyFieldTemplateByPermission(curReplTemplates, fieldName, fieldStr, fieldPermission,fieldTag, propertyName);
|
|
1260
|
+
// step5: 当前子表单首次渲染时,会去除掉所有列,来检查当前子表单内是否有其他因素导致渲染失败
|
|
1261
|
+
if (index === subFieldPermissions.length - 1) {
|
|
1262
|
+
stencilStr = this.sliceStrByTag(stencilTag, tableStartIndex);
|
|
1263
|
+
const replaceStencilStr = \`<span text="processDetailFormData.\${propertyName}"></span>\`
|
|
1264
|
+
this.formTemplate = this.formTemplate.replace(stencilStr, replaceStencilStr)
|
|
1265
|
+
curReplTemplates.unshift({
|
|
1266
|
+
propertyName,
|
|
1267
|
+
origin: stencilStr,
|
|
1268
|
+
replace: replaceStencilStr
|
|
1269
|
+
})
|
|
1270
|
+
}
|
|
1271
|
+
})
|
|
1272
|
+
})
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
if (formData) this.processDetailFormData = formData
|
|
1276
|
+
// 使processDetailFormData内每一个key具备双向绑定能力
|
|
1277
|
+
Object.keys(this.processDetailFormData).forEach(key => {
|
|
1278
|
+
this.$set(this.processDetailFormData, key, this.processDetailFormData[key])
|
|
1279
|
+
})
|
|
1280
|
+
|
|
1281
|
+
const container = document.getElementById('dynamicRenderContainer')
|
|
1282
|
+
if (!container) return
|
|
1283
|
+
const vmRoot = this
|
|
1284
|
+
// 动态渲染主表单
|
|
1285
|
+
this.renderForm({
|
|
1286
|
+
fieldReplTemplates: mainReplTemplates,
|
|
1287
|
+
vmRoot,
|
|
1288
|
+
isSubForm: false
|
|
1289
|
+
})
|
|
1290
|
+
// 动态渲染子表单
|
|
1291
|
+
subReplTemplates.forEach((fieldReplTemplates) => {
|
|
1292
|
+
this.renderForm({
|
|
1293
|
+
fieldReplTemplates,
|
|
1294
|
+
vmRoot,
|
|
1295
|
+
isSubForm: true
|
|
1296
|
+
})
|
|
1297
|
+
})
|
|
1298
|
+
|
|
1299
|
+
var parentElement = container.parentNode
|
|
1300
|
+
const regex = /ref-name="([^"]+)"/;
|
|
1301
|
+
const match = this.formTemplate.match(regex);
|
|
1302
|
+
parentElement.replaceChild(this.formVM?.$el, container)
|
|
1303
|
+
window.__processDetailFromMixinFormVm__ = this.formVM?.$refs[match[1]]
|
|
1304
|
+
const processVarsKeys = Object.keys(processVars);
|
|
1305
|
+
const data = {};
|
|
1306
|
+
for (const key in this.processDetailFormData) {
|
|
1307
|
+
if (!processVarsKeys.includes(key)) {
|
|
1308
|
+
data[key] = this.processDetailFormData[key];
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
window.__processDetailFromMixinFormData__ = data;
|
|
1312
|
+
} catch (error) {
|
|
1313
|
+
console.warn('processDetailFromMixin warn', error)
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1310
1316
|
}; \n`;
|
|
1311
1317
|
code += processDetailFromMixinCode;
|
|
1312
1318
|
}
|
|
@@ -1449,7 +1455,7 @@ let View = class View extends Annotatable__1.default {
|
|
|
1449
1455
|
}
|
|
1450
1456
|
}
|
|
1451
1457
|
// 获取指向该页面的流程
|
|
1452
|
-
getDestinationProcessV2() {
|
|
1458
|
+
get getDestinationProcessV2() {
|
|
1453
1459
|
const processV2 = this.app?.processV2s || [];
|
|
1454
1460
|
let res;
|
|
1455
1461
|
const isM = this.frontend?.type === 'h5';
|
|
@@ -1569,6 +1575,11 @@ let View = class View extends Annotatable__1.default {
|
|
|
1569
1575
|
code += yield* variable.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true }));
|
|
1570
1576
|
return;
|
|
1571
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* HACK: 这里不对toEmbeddedTS传入state。变量提升完全不应该写入sourceMap。如果写入,则有可能覆盖节点在正文中的sourceMap项,导致重命名时findMinRange返回错误的值。
|
|
1580
|
+
* 一则逻辑重命名时误伤MemberExpression的例子:https://projectmanage.netease-official.lcap.163yun.com/dashboard/BugDetail?id=2940451268658688
|
|
1581
|
+
*/
|
|
1582
|
+
const tempState = (0, nasl_translator_1.createCompilerState)(undefined, { isVariableHost: true });
|
|
1572
1583
|
code += `${(0, nasl_translator_1.indent)((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
|
|
1573
1584
|
code += `${(0, nasl_translator_1.indent)((state?.tabSize || 0) + 1)}let `;
|
|
1574
1585
|
code += yield* variable.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true }));
|
|
@@ -1583,7 +1594,7 @@ let View = class View extends Annotatable__1.default {
|
|
|
1583
1594
|
const rightNode = rightIndex.length === 1
|
|
1584
1595
|
? assignment.rights[rightIndex[0]]?.expression
|
|
1585
1596
|
: assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1586
|
-
const rightCode = yield* rightNode?.toEmbeddedTS((0, nasl_translator_1.shiftState)(
|
|
1597
|
+
const rightCode = yield* rightNode?.toEmbeddedTS((0, nasl_translator_1.shiftState)(tempState, code, { inline: true })) ??
|
|
1587
1598
|
(0, utils_1.returnOrigin)('');
|
|
1588
1599
|
code += yield* self.getRightCode(rightCode, assignment, rightNode);
|
|
1589
1600
|
}
|
|
@@ -1601,7 +1612,7 @@ let View = class View extends Annotatable__1.default {
|
|
|
1601
1612
|
}
|
|
1602
1613
|
rightCode +=
|
|
1603
1614
|
assignment.right && assignment.right.toEmbeddedTS
|
|
1604
|
-
? yield* assignment.right.toEmbeddedTS((0, nasl_translator_1.shiftState)(
|
|
1615
|
+
? yield* assignment.right.toEmbeddedTS((0, nasl_translator_1.shiftState)(tempState, code, { inline: true }))
|
|
1605
1616
|
: '__RIGHT__';
|
|
1606
1617
|
code += yield* self.getRightCode(rightCode, assignment, assignment.right);
|
|
1607
1618
|
}
|
|
@@ -2346,6 +2357,33 @@ let View = class View extends Annotatable__1.default {
|
|
|
2346
2357
|
});
|
|
2347
2358
|
return callbackLogics;
|
|
2348
2359
|
}
|
|
2360
|
+
async delProcessViewDestination() {
|
|
2361
|
+
if (this?.concept !== 'View')
|
|
2362
|
+
return;
|
|
2363
|
+
const app = this.getAncestor('App');
|
|
2364
|
+
const naslServer = app.naslServer;
|
|
2365
|
+
const refsList = await naslServer._isHaveRef(this);
|
|
2366
|
+
refsList.forEach((record) => {
|
|
2367
|
+
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
2368
|
+
if (!fileNode)
|
|
2369
|
+
return;
|
|
2370
|
+
const minRange = naslServer._findMinRange(record, fileNode);
|
|
2371
|
+
let node = minRange.node;
|
|
2372
|
+
if (node?.concept === 'Destination' && node?.getAncestor?.('ProcessElementV2')) {
|
|
2373
|
+
node.parentNode.update({
|
|
2374
|
+
destination: {
|
|
2375
|
+
concept: 'Destination',
|
|
2376
|
+
name: '',
|
|
2377
|
+
label: '跳转页面',
|
|
2378
|
+
arguments: [],
|
|
2379
|
+
anchor: {
|
|
2380
|
+
concept: 'Anchor',
|
|
2381
|
+
},
|
|
2382
|
+
},
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2349
2387
|
getViewProcessForm() {
|
|
2350
2388
|
let res;
|
|
2351
2389
|
const excludedKeySet = new Set([
|