@lcap/nasl 3.8.0-beta.6 → 3.8.0-beta.7
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/.mocharc.js +1 -0
- package/out/common/BaseNode.d.ts +19 -3
- package/out/common/BaseNode.js +85 -7
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AbstractInterface__.js.map +1 -1
- package/out/concepts/Annotation__.js +1 -1
- package/out/concepts/Annotation__.js.map +1 -1
- package/out/concepts/App__.d.ts +3 -0
- package/out/concepts/App__.js +964 -4
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +3 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +1 -1
- package/out/concepts/BatchAssignment__.js +2 -2
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +3 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +3 -4
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +2 -0
- package/out/concepts/BusinessComponent__.js +48 -0
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/BusinessLogic__.d.ts +1 -0
- package/out/concepts/BusinessLogic__.js +10 -0
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallEvent__.d.ts +2 -0
- package/out/concepts/CallEvent__.js +75 -0
- package/out/concepts/CallEvent__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +1 -0
- package/out/concepts/CallInterface__.js +26 -15
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +4 -0
- package/out/concepts/CallLogic__.js +59 -3
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +3 -3
- package/out/concepts/Entity__.js +4 -0
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Event__.d.ts +2 -0
- package/out/concepts/Event__.js +30 -0
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +2 -0
- package/out/concepts/FrontendType__.js +32 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -0
- package/out/concepts/Frontend__.js +48 -0
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/IfStatement__.js +6 -6
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +1 -0
- package/out/concepts/InterfaceParam__.js +23 -4
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +2 -1
- package/out/concepts/Interface__.js +29 -5
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +6 -0
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicDeclaration__.d.ts +1 -0
- package/out/concepts/LogicDeclaration__.js +58 -7
- package/out/concepts/LogicDeclaration__.js.map +1 -1
- package/out/concepts/Logic__.js +32 -22
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -2
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +3 -18
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +2 -0
- package/out/concepts/Module__.js +64 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +1 -1
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/Paginate__.d.ts +1 -0
- package/out/concepts/Paginate__.js +15 -7
- package/out/concepts/Paginate__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +3 -4
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +1 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +2 -0
- package/out/concepts/ViewElement__.js +8 -5
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -0
- package/out/concepts/View__.js +55 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/generator/genBundleFiles.js +14 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genHash.d.ts +2 -2
- package/out/generator/genHash.js +30 -30
- package/out/generator/genHash.js.map +1 -1
- package/out/generator/permission.d.ts +8 -1
- package/out/generator/permission.js +321 -23
- package/out/generator/permission.js.map +1 -1
- package/out/generator/release-body/body.js +18 -4
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/data.js +6 -2
- package/out/generator/release-body/data.js.map +1 -1
- package/out/generator/release-body/utils.js +3 -3
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/generator/release-body/validation.js +2 -2
- package/out/generator/release-body/validation.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js.map +1 -1
- package/out/natural/genNaturalTS.d.ts +2 -2
- package/out/natural/genNaturalTS.js +7 -7
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/index.d.ts +1 -1
- package/out/natural/getContext/index.js +15 -9
- package/out/natural/getContext/index.js.map +1 -1
- package/out/natural/transformTS2UI.js +30 -11
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/natural/transformTSCode.js +30 -11
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/entity2LogicNamespace.d.ts +2 -2
- package/out/server/entity2LogicNamespace.js +321 -310
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +25 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +23 -16
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +12 -0
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +1 -1
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +3 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js +1 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/common/BaseNode.ts +91 -11
- package/src/concepts/AbstractInterface__.ts +1 -0
- package/src/concepts/Annotation__.ts +1 -1
- package/src/concepts/App__.ts +104 -4
- package/src/concepts/Argument__.ts +3 -3
- package/src/concepts/BatchAssignment__.ts +2 -2
- package/src/concepts/BindAttribute__.ts +3 -4
- package/src/concepts/BindDirective__.ts +3 -4
- package/src/concepts/BusinessComponent__.ts +54 -1
- package/src/concepts/BusinessLogic__.ts +10 -1
- package/src/concepts/CallEvent__.ts +66 -0
- package/src/concepts/CallInterface__.ts +21 -9
- package/src/concepts/CallLogic__.ts +59 -3
- package/src/concepts/Entity__.ts +7 -1
- package/src/concepts/Event__.ts +32 -0
- package/src/concepts/FrontendType__.ts +34 -1
- package/src/concepts/Frontend__.ts +51 -0
- package/src/concepts/IfStatement__.ts +6 -6
- package/src/concepts/InterfaceParam__.ts +23 -4
- package/src/concepts/Interface__.ts +29 -5
- package/src/concepts/JSBlock__.ts +5 -0
- package/src/concepts/LogicDeclaration__.ts +65 -7
- package/src/concepts/Logic__.ts +34 -25
- package/src/concepts/MatchCase__.ts +1 -2
- package/src/concepts/Match__.ts +3 -21
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +75 -0
- package/src/concepts/NewComposite__.ts +2 -2
- package/src/concepts/Paginate__.ts +14 -7
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/StringLiteral__.ts +3 -4
- package/src/concepts/TypeAnnotation__.ts +1 -0
- package/src/concepts/ViewElement__.ts +9 -5
- package/src/concepts/View__.ts +56 -1
- package/src/generator/genBundleFiles.ts +14 -11
- package/src/generator/genHash.ts +32 -6
- package/src/generator/permission.ts +333 -23
- package/src/generator/release-body/body.ts +24 -5
- package/src/generator/release-body/data.ts +7 -2
- package/src/generator/release-body/utils.ts +3 -3
- package/src/generator/release-body/validation.ts +1 -1
- package/src/index.ts +13 -1
- package/src/natural/genNaturalTS.ts +9 -7
- package/src/natural/getContext/index.ts +17 -11
- package/src/natural/transformTS2UI.ts +28 -11
- package/src/natural/transformTSCode.ts +28 -11
- package/src/server/entity2LogicNamespace.ts +13 -1
- package/src/server/extendBaseNode.ts +31 -0
- package/src/server/naslServer.ts +32 -23
- package/src/server/translator.ts +15 -0
- package/src/templator/genCreateBlock.ts +4 -4
- package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -2
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +4 -4
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +2 -2
- package/src/templator/genSelectBlock.ts +3 -3
- package/src/templator/genTableBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +6 -6
- package/src/templator/utils.ts +1 -1
- package/test/concepts/string-literal/__snapshots__/toVue.spec.ts.snap +1 -1
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +6 -2
|
@@ -428,7 +428,7 @@ export function getFrontendViews(frontend: Frontend, state: TranslatorState, cur
|
|
|
428
428
|
return { code: wrapTSBlock(code), views: { namespace, data } };
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
export function getCurrentNodeContext(currentNode: BaseNode, focusedNodePath?: string) {
|
|
431
|
+
export function getCurrentNodeContext(currentNode: BaseNode, focusedNodePath?: string, experimental?: boolean) {
|
|
432
432
|
let code = '';
|
|
433
433
|
let view: View;
|
|
434
434
|
if (currentNode?.concept === 'View') {
|
|
@@ -456,16 +456,22 @@ export function getCurrentNodeContext(currentNode: BaseNode, focusedNodePath?: s
|
|
|
456
456
|
}),
|
|
457
457
|
function (state) {
|
|
458
458
|
let code = '';
|
|
459
|
-
code += `\n${indent(state.tabSize
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
code +=
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
|
|
459
|
+
code += `\n${indent(state.tabSize)}`;
|
|
460
|
+
|
|
461
|
+
if (experimental) {
|
|
462
|
+
code += this.elements[0].toNaturalTS(shiftState(state, code, { tabSize: state.tabSize + 1 }));
|
|
463
|
+
} else {
|
|
464
|
+
code += `const $refs = {\n`;
|
|
465
|
+
// 生成所有的name和类型定义
|
|
466
|
+
this.elements.forEach((element) => {
|
|
467
|
+
code += element.toNaturalTSDefinition(
|
|
468
|
+
shiftState(state, code, {
|
|
469
|
+
tabSize: state.tabSize + 1,
|
|
470
|
+
})
|
|
471
|
+
);
|
|
472
|
+
});
|
|
473
|
+
code += `${indent(state.tabSize + 1)}}\n`;
|
|
474
|
+
}
|
|
469
475
|
// 逻辑
|
|
470
476
|
if (currentNode?.concept === 'Logic') {
|
|
471
477
|
code += '\n';
|
|
@@ -103,7 +103,7 @@ function transformTypeAnnotation(node: babelTypes.TSType): naslTypes.TypeAnnotat
|
|
|
103
103
|
if (node?.typeName?.type === 'TSQualifiedName') {
|
|
104
104
|
const allTypeName = generate(node?.typeName?.left as any)?.code;
|
|
105
105
|
// 实体、枚举、结构体
|
|
106
|
-
if (/^app.dataSources|.enums|.structures/.test(allTypeName)) {
|
|
106
|
+
if (/^app.dataSources|.enums|.structures|nasl.ui/.test(allTypeName)) {
|
|
107
107
|
const curTypeName = (node?.typeName as any)?.right?.name;
|
|
108
108
|
return naslTypes.TypeAnnotation.createReference(curTypeName, {
|
|
109
109
|
typeNamespace: allTypeName,
|
|
@@ -141,6 +141,8 @@ function transformTypeAnnotation(node: babelTypes.TSType): naslTypes.TypeAnnotat
|
|
|
141
141
|
// 处理参数
|
|
142
142
|
function transformParam(node: babelTypes.Identifier): naslTypes.Param {
|
|
143
143
|
const typeAnnotation = (node.typeAnnotation as babelTypes.TSTypeAnnotation)?.typeAnnotation;
|
|
144
|
+
const exclude = ['event'];
|
|
145
|
+
if (exclude.includes(node.name)) return null;
|
|
144
146
|
return new naslTypes.Param({
|
|
145
147
|
name: node.name,
|
|
146
148
|
typeAnnotation: typeAnnotation ? transformTypeAnnotation(typeAnnotation) : null,
|
|
@@ -243,7 +245,7 @@ function handleNewExpression(calleeName: String, node: any, type?: string) {
|
|
|
243
245
|
if (arg?.value) {
|
|
244
246
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
245
247
|
leftIndex: [0, index],
|
|
246
|
-
rightIndex: [index,
|
|
248
|
+
rightIndex: [index, members.length - 1],
|
|
247
249
|
}));
|
|
248
250
|
}
|
|
249
251
|
} else {
|
|
@@ -300,7 +302,7 @@ function handleNewExpression(calleeName: String, node: any, type?: string) {
|
|
|
300
302
|
if (arg?.value) {
|
|
301
303
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
302
304
|
leftIndex: [0, index],
|
|
303
|
-
rightIndex: [index,
|
|
305
|
+
rightIndex: [index, members.length - 1],
|
|
304
306
|
}));
|
|
305
307
|
}
|
|
306
308
|
} else {
|
|
@@ -358,7 +360,7 @@ function handleNewExpression(calleeName: String, node: any, type?: string) {
|
|
|
358
360
|
if (arg?.value) {
|
|
359
361
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
360
362
|
leftIndex: [0, index],
|
|
361
|
-
rightIndex: [index,
|
|
363
|
+
rightIndex: [index, members.length - 1],
|
|
362
364
|
}));
|
|
363
365
|
}
|
|
364
366
|
} else {
|
|
@@ -928,14 +930,29 @@ function transformNode2Expression(node: babelTypes.Node, type?: string): any {
|
|
|
928
930
|
const assignmentLines: any = [];
|
|
929
931
|
node?.properties?.forEach((arg: any, index: number) => {
|
|
930
932
|
properties.push(transformNode2Expression(arg.key, type));
|
|
931
|
-
|
|
932
|
-
expression
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
933
|
+
if (arg.value.type === 'MemberExpression') {
|
|
934
|
+
const expression = flatMemberExpression(arg.value);
|
|
935
|
+
const members = flatMembers(transformNode2Expression(arg.value, type) as any);
|
|
936
|
+
rights.push(new naslTypes.SelectMembers({
|
|
937
|
+
expression: transformNode2Expression(expression[0]),
|
|
938
|
+
members,
|
|
939
|
+
}));
|
|
940
|
+
if (arg?.value) {
|
|
941
|
+
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
942
|
+
leftIndex: [0, index],
|
|
943
|
+
rightIndex: [index, members.length - 1],
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
} else {
|
|
947
|
+
rights.push(new naslTypes.SelectMembers({
|
|
948
|
+
expression: transformNode2Expression(arg?.value, type)
|
|
938
949
|
}));
|
|
950
|
+
if (arg?.value) {
|
|
951
|
+
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
952
|
+
leftIndex: [0, index],
|
|
953
|
+
rightIndex: [index],
|
|
954
|
+
}));
|
|
955
|
+
}
|
|
939
956
|
}
|
|
940
957
|
structureProperties.push(new naslTypes.StructureProperty({
|
|
941
958
|
name: arg?.key?.name,
|
|
@@ -117,7 +117,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
117
117
|
if (node?.typeName?.type === 'TSQualifiedName') {
|
|
118
118
|
const allTypeName = generate(node?.typeName?.left as any)?.code;
|
|
119
119
|
// 实体、枚举、结构体
|
|
120
|
-
if (/^app.dataSources|.enums|.structures/.test(allTypeName)) {
|
|
120
|
+
if (/^app.dataSources|.enums|.structures|nasl.ui/.test(allTypeName)) {
|
|
121
121
|
const curTypeName = (node?.typeName as any)?.right?.name;
|
|
122
122
|
return naslTypes.TypeAnnotation.createReference(curTypeName, {
|
|
123
123
|
typeNamespace: allTypeName,
|
|
@@ -153,6 +153,8 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
153
153
|
}
|
|
154
154
|
function transformParam(node: babelTypes.Identifier): naslTypes.Param {
|
|
155
155
|
const typeAnnotation = (node.typeAnnotation as babelTypes.TSTypeAnnotation)?.typeAnnotation;
|
|
156
|
+
const exclude = ['event'];
|
|
157
|
+
if (exclude.includes(node.name)) return null;
|
|
156
158
|
return new naslTypes.Param({
|
|
157
159
|
name: node.name,
|
|
158
160
|
typeAnnotation: typeAnnotation ? transformTypeAnnotation(typeAnnotation) : null,
|
|
@@ -228,7 +230,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
228
230
|
if (arg?.value) {
|
|
229
231
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
230
232
|
leftIndex: [0, index],
|
|
231
|
-
rightIndex: [index,
|
|
233
|
+
rightIndex: [index, members.length - 1],
|
|
232
234
|
}));
|
|
233
235
|
}
|
|
234
236
|
} else {
|
|
@@ -285,7 +287,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
285
287
|
if (arg?.value) {
|
|
286
288
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
287
289
|
leftIndex: [0, index],
|
|
288
|
-
rightIndex: [index,
|
|
290
|
+
rightIndex: [index, members.length - 1],
|
|
289
291
|
}));
|
|
290
292
|
}
|
|
291
293
|
} else {
|
|
@@ -343,7 +345,7 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
343
345
|
if (arg?.value) {
|
|
344
346
|
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
345
347
|
leftIndex: [0, index],
|
|
346
|
-
rightIndex: [index,
|
|
348
|
+
rightIndex: [index, members.length - 1],
|
|
347
349
|
}));
|
|
348
350
|
}
|
|
349
351
|
} else {
|
|
@@ -1001,14 +1003,29 @@ export function transformTSCode(tsCode: string, contextLogicName: string, type?:
|
|
|
1001
1003
|
const assignmentLines: any = [];
|
|
1002
1004
|
node?.properties?.forEach((arg: any, index: number) => {
|
|
1003
1005
|
properties.push(transformLogicNode(arg.key));
|
|
1004
|
-
|
|
1005
|
-
expression
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
rightIndex: [index],
|
|
1006
|
+
if (arg.value.type === 'MemberExpression') {
|
|
1007
|
+
const expression = flatMemberExpression(arg.value);
|
|
1008
|
+
const members = flatMembers(transformLogicNode(arg.value) as any);
|
|
1009
|
+
rights.push(new naslTypes.SelectMembers({
|
|
1010
|
+
expression: transformLogicNode(expression[0]),
|
|
1011
|
+
members,
|
|
1011
1012
|
}));
|
|
1013
|
+
if (arg?.value) {
|
|
1014
|
+
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
1015
|
+
leftIndex: [0, index],
|
|
1016
|
+
rightIndex: [index, members.length - 1],
|
|
1017
|
+
}));
|
|
1018
|
+
}
|
|
1019
|
+
} else {
|
|
1020
|
+
rights.push(new naslTypes.SelectMembers({
|
|
1021
|
+
expression: transformLogicNode(arg?.value)
|
|
1022
|
+
}));
|
|
1023
|
+
if (arg?.value) {
|
|
1024
|
+
assignmentLines.push(new naslTypes.AssignmentLine({
|
|
1025
|
+
leftIndex: [0, index],
|
|
1026
|
+
rightIndex: [index],
|
|
1027
|
+
}));
|
|
1028
|
+
}
|
|
1012
1029
|
}
|
|
1013
1030
|
structureProperties.push(new naslTypes.StructureProperty({
|
|
1014
1031
|
name: arg?.key?.name,
|
|
@@ -15,7 +15,17 @@ import {
|
|
|
15
15
|
NewList,
|
|
16
16
|
} from '..';
|
|
17
17
|
|
|
18
|
+
const entityNsMap = new Map();
|
|
19
|
+
|
|
18
20
|
export function entity2LogicNamespace(entity: Entity) {
|
|
21
|
+
let nsInfo = entityNsMap.get(entity);
|
|
22
|
+
if (!nsInfo) {
|
|
23
|
+
nsInfo = {
|
|
24
|
+
contentUniqueKey: entity.contentUniqueKey
|
|
25
|
+
};
|
|
26
|
+
entityNsMap.set(entity, nsInfo);
|
|
27
|
+
}
|
|
28
|
+
if (!nsInfo.ns || nsInfo.contentUniqueKey !== entity.contentUniqueKey) {
|
|
19
29
|
const { properties } = entity;
|
|
20
30
|
const keys = properties.filter((item) => item.primaryKey);
|
|
21
31
|
const params = keys.map(
|
|
@@ -368,7 +378,9 @@ export function entity2LogicNamespace(entity: Entity) {
|
|
|
368
378
|
],
|
|
369
379
|
});
|
|
370
380
|
ns.parentNode = entity;
|
|
371
|
-
|
|
381
|
+
nsInfo.ns = ns;
|
|
382
|
+
}
|
|
383
|
+
return nsInfo.ns;
|
|
372
384
|
}
|
|
373
385
|
|
|
374
386
|
interface entityTreeFragment {
|
|
@@ -643,6 +643,37 @@ BaseNode.prototype.prepareDelete = async function prepareDelete(cb?: Function) {
|
|
|
643
643
|
|
|
644
644
|
// 删除页面或者流程
|
|
645
645
|
if (node instanceof View || node instanceof Process || node instanceof Frontend) {
|
|
646
|
+
if ( node instanceof Frontend || node instanceof View) {
|
|
647
|
+
(this as any).app.emit('collect:start', {
|
|
648
|
+
actionMsg: `删除节点`,
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
// 删除页面或端的时候,如果存在表单设计器,需要同步删除分组内容
|
|
652
|
+
const excludedKeySet = new Set([
|
|
653
|
+
'parentNode',
|
|
654
|
+
'sourceMap',
|
|
655
|
+
'storageJSON',
|
|
656
|
+
'tsErrorDetail',
|
|
657
|
+
'NaslAnnotatedJSON',
|
|
658
|
+
'calledFrom',
|
|
659
|
+
'_events',
|
|
660
|
+
'_collectingList',
|
|
661
|
+
'_historyList',
|
|
662
|
+
]);
|
|
663
|
+
traverse(
|
|
664
|
+
(current) => {
|
|
665
|
+
const currentNode: any = current.node;
|
|
666
|
+
if (currentNode && currentNode?.concept === 'ViewElement' && currentNode?.name === currentNode?.composedBy?.[0]) {
|
|
667
|
+
currentNode.app.deleteCompose(currentNode.composedBy);
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{ node: this },
|
|
671
|
+
{ mode: 'anyObject', excludedKeySet }
|
|
672
|
+
);
|
|
673
|
+
this.delete();
|
|
674
|
+
(this as any).app.emit('collect:end');
|
|
675
|
+
}
|
|
676
|
+
|
|
646
677
|
/**
|
|
647
678
|
* 查找这个页面是不是有依赖
|
|
648
679
|
*/
|
package/src/server/naslServer.ts
CHANGED
|
@@ -4736,7 +4736,7 @@ class NaslServer {
|
|
|
4736
4736
|
const item = (resultMap as any)?.[file]?.[line]?.[offset];
|
|
4737
4737
|
const itemType = item?.[0]?.nodeType;
|
|
4738
4738
|
const nodeTypeAnnotation = yield* type2TypeAnnotation(itemType);
|
|
4739
|
-
const {node} = newQuickInfoNodes[index];
|
|
4739
|
+
const { node } = newQuickInfoNodes[index];
|
|
4740
4740
|
|
|
4741
4741
|
types.set(node, Object.freeze(nodeTypeAnnotation) as TypeAnnotation);
|
|
4742
4742
|
|
|
@@ -4919,7 +4919,13 @@ class NaslServer {
|
|
|
4919
4919
|
});
|
|
4920
4920
|
const typesMap = await this.getQuickInfoNodesTypeMap(nodes, true);
|
|
4921
4921
|
|
|
4922
|
-
|
|
4922
|
+
console.time('app toJSON');
|
|
4923
|
+
const jsonMap = new Map();
|
|
4924
|
+
const json = app._toJSON((source, instance) => {
|
|
4925
|
+
jsonMap.set(instance, source);
|
|
4926
|
+
return source;
|
|
4927
|
+
});
|
|
4928
|
+
console.timeEnd('app toJSON');
|
|
4923
4929
|
|
|
4924
4930
|
this.logger.timeEnd('全量标注');
|
|
4925
4931
|
|
|
@@ -4929,8 +4935,10 @@ class NaslServer {
|
|
|
4929
4935
|
}
|
|
4930
4936
|
|
|
4931
4937
|
if (releaseFlag) {
|
|
4938
|
+
console.time('annotationToJson');
|
|
4932
4939
|
// 全量标注后对json进行一些修改,为了服务端翻译处理
|
|
4933
|
-
this.annotationToJson(typesMap, json);
|
|
4940
|
+
this.annotationToJson(typesMap, json, jsonMap);
|
|
4941
|
+
console.timeEnd('annotationToJson');
|
|
4934
4942
|
}
|
|
4935
4943
|
|
|
4936
4944
|
return json;
|
|
@@ -4974,31 +4982,32 @@ class NaslServer {
|
|
|
4974
4982
|
BaseNode,
|
|
4975
4983
|
| TypeAnnotation
|
|
4976
4984
|
| {
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4985
|
+
typeAnnotation: TypeAnnotation;
|
|
4986
|
+
option: any;
|
|
4987
|
+
}
|
|
4980
4988
|
>,
|
|
4981
|
-
json: {}
|
|
4989
|
+
json: {},
|
|
4990
|
+
jsonMap: Map<BaseNode, any>,
|
|
4982
4991
|
) {
|
|
4983
4992
|
typesMap.forEach((value, node) => {
|
|
4984
4993
|
// 如果节点本身有类型就不去在塞一遍了
|
|
4985
4994
|
// 有值而且没有类型再去设置
|
|
4986
4995
|
// 但是Identifier 和 MemberExpression 都用标注出来的因为本身是变量,有类型也需要覆盖一下
|
|
4987
|
-
if (value && (node instanceof Argument
|
|
4988
|
-
const jsonNode =
|
|
4996
|
+
if (value && (node instanceof Argument) && node.getAncestor('Connector')?.concept === 'Connector') {
|
|
4997
|
+
const jsonNode = jsonMap.get(node);
|
|
4989
4998
|
if (jsonNode) {
|
|
4990
|
-
|
|
4999
|
+
jsonNode.typeAnnotation = (value as TypeAnnotation)?.toJSON();
|
|
4991
5000
|
}
|
|
4992
5001
|
}
|
|
4993
5002
|
if (value && (!(node as any).typeAnnotation || node instanceof Identifier || node instanceof MemberExpression)) {
|
|
4994
|
-
const jsonNode =
|
|
5003
|
+
const jsonNode = jsonMap.get(node);
|
|
4995
5004
|
if (jsonNode) {
|
|
4996
|
-
|
|
5005
|
+
jsonNode.typeAnnotation = (value as TypeAnnotation)?.toJSON();
|
|
4997
5006
|
}
|
|
4998
5007
|
}
|
|
4999
5008
|
// 旧版本数据查询需要确认是匿名数据结构的 ListTotal 类型
|
|
5000
5009
|
if (node instanceof CallQueryComponent && !node.isAutoInfer()) {
|
|
5001
|
-
const jsonNode =
|
|
5010
|
+
const jsonNode = jsonMap.get(node);
|
|
5002
5011
|
jsonNode.typeAnnotation = {
|
|
5003
5012
|
concept: 'TypeAnnotation',
|
|
5004
5013
|
typeKind: 'anonymousStructure',
|
|
@@ -5047,7 +5056,7 @@ class NaslServer {
|
|
|
5047
5056
|
if (node instanceof Param) {
|
|
5048
5057
|
// index在nasl foreach上有脏数据
|
|
5049
5058
|
if (node.parentKey === 'index' && node.parentNode instanceof ForEachStatement) {
|
|
5050
|
-
const jsonNode =
|
|
5059
|
+
const jsonNode = jsonMap.get(node);
|
|
5051
5060
|
jsonNode.typeAnnotation = TypeAnnotation.createPrimitive('Long').toJSON();
|
|
5052
5061
|
}
|
|
5053
5062
|
}
|
|
@@ -5064,7 +5073,7 @@ class NaslServer {
|
|
|
5064
5073
|
const itemCode = this.getNodeCode(fileNode, item);
|
|
5065
5074
|
|
|
5066
5075
|
if (itemNode.concept === matchExpression.concept && itemCode === currentCode) {
|
|
5067
|
-
const jsonNode =
|
|
5076
|
+
const jsonNode = jsonMap.get(itemNode);
|
|
5068
5077
|
jsonNode.typeAnnotation = matchExpression.__TypeAnnotation;
|
|
5069
5078
|
}
|
|
5070
5079
|
});
|
|
@@ -5074,12 +5083,12 @@ class NaslServer {
|
|
|
5074
5083
|
if (value && (node instanceof Param)) {
|
|
5075
5084
|
// index在nasl foreach上有脏数据
|
|
5076
5085
|
if (node.parentKey === 'index' && node.parentNode instanceof ForEachStatement) {
|
|
5077
|
-
const jsonNode =
|
|
5086
|
+
const jsonNode = jsonMap.get(node);
|
|
5078
5087
|
jsonNode.typeAnnotation = (value as TypeAnnotation).toJSON();
|
|
5079
5088
|
}
|
|
5080
5089
|
}
|
|
5081
5090
|
if (value && (node instanceof NewComposite) && (node.typeAnnotation?.typeKind === 'anonymousStructure' || node.typeAnnotation?.typeKind === 'generic')) {
|
|
5082
|
-
const jsonNode =
|
|
5091
|
+
const jsonNode = jsonMap.get(node);
|
|
5083
5092
|
jsonNode.typeAnnotation = (value as TypeAnnotation).toJSON();
|
|
5084
5093
|
}
|
|
5085
5094
|
|
|
@@ -5099,7 +5108,7 @@ class NaslServer {
|
|
|
5099
5108
|
* 特殊处理,不想去查两次类型, 因为是从函数签名上拿类型,所以直接合并在一起,先这样
|
|
5100
5109
|
*/
|
|
5101
5110
|
if (node instanceof CallLogic && node.__TypeArguments?.length) {
|
|
5102
|
-
const jsonNode =
|
|
5111
|
+
const jsonNode = jsonMap.get(node);
|
|
5103
5112
|
jsonNode.typeArguments = node.__TypeArguments.map((type) => type?.toJSON());
|
|
5104
5113
|
jsonNode.typeAnnotation = node.__TypeAnnotation?.toJSON();
|
|
5105
5114
|
}
|
|
@@ -5135,13 +5144,13 @@ class NaslServer {
|
|
|
5135
5144
|
if (itemExpression) {
|
|
5136
5145
|
const listTypeArgument = list.__TypeAnnotation?.typeArguments?.[0]?.toJSON();
|
|
5137
5146
|
if (listTypeArgument) {
|
|
5138
|
-
const jsonNode =
|
|
5147
|
+
const jsonNode = jsonMap.get(item);
|
|
5139
5148
|
jsonNode.typeAnnotation = listTypeArgument;
|
|
5140
5149
|
}
|
|
5141
5150
|
}
|
|
5142
5151
|
} else {
|
|
5143
5152
|
const mapParamIndex = mapFunctionParamIndexMaps.get(calleeName);
|
|
5144
|
-
if(mapParamIndex){
|
|
5153
|
+
if (mapParamIndex) {
|
|
5145
5154
|
const map = node.arguments[mapParamIndex.collection];
|
|
5146
5155
|
const key = node.arguments[mapParamIndex.key];
|
|
5147
5156
|
const value = node.arguments[mapParamIndex.value];
|
|
@@ -5150,14 +5159,14 @@ class NaslServer {
|
|
|
5150
5159
|
if (keyExpression) {
|
|
5151
5160
|
const mapKeyTypeArgument = map.__TypeAnnotation?.typeArguments?.[0]?.toJSON();
|
|
5152
5161
|
if (mapKeyTypeArgument) {
|
|
5153
|
-
const jsonNode =
|
|
5162
|
+
const jsonNode = jsonMap.get(key);
|
|
5154
5163
|
jsonNode.typeAnnotation = mapKeyTypeArgument;
|
|
5155
5164
|
}
|
|
5156
5165
|
}
|
|
5157
5166
|
if (valueExpression) {
|
|
5158
5167
|
const mapValueTypeArgument = map.__TypeAnnotation?.typeArguments?.[1]?.toJSON();
|
|
5159
5168
|
if (mapValueTypeArgument) {
|
|
5160
|
-
const jsonNode =
|
|
5169
|
+
const jsonNode = jsonMap.get(value);
|
|
5161
5170
|
jsonNode.typeAnnotation = mapValueTypeArgument;
|
|
5162
5171
|
}
|
|
5163
5172
|
}
|
|
@@ -5169,7 +5178,7 @@ class NaslServer {
|
|
|
5169
5178
|
|
|
5170
5179
|
// 服务端需要默认值节点有类型来判断父节点是否是日期类型
|
|
5171
5180
|
if (node instanceof DefaultValue && !value) {
|
|
5172
|
-
const jsonNode =
|
|
5181
|
+
const jsonNode = jsonMap.get(node);
|
|
5173
5182
|
const parentNodeType = (node.parentNode as any)?.typeAnnotation || (node.parentNode as any)?.__TypeAnnotation;
|
|
5174
5183
|
if (parentNodeType && jsonNode) {
|
|
5175
5184
|
jsonNode.typeAnnotation = (parentNodeType as TypeAnnotation)?.toJSON();
|
package/src/server/translator.ts
CHANGED
|
@@ -328,6 +328,10 @@ const TS_RULES: Array<{
|
|
|
328
328
|
re: /Cannot find name '__UNCERTAIN__INTERMEDIATE__FIELDS__'./,
|
|
329
329
|
result: '来自不确定结构或实体的字段',
|
|
330
330
|
},
|
|
331
|
+
{
|
|
332
|
+
re: /Cannot find name '__UNSUPPORTED__ENTITY__FIELDS__'./,
|
|
333
|
+
result: '可能为实体属性别名,动态条件中仅支持使用变量',
|
|
334
|
+
},
|
|
331
335
|
{
|
|
332
336
|
re: /No value exists in scope for the shorthand property '__(?:IDENTIFIER|LEFT|RIGHT)__'. Either declare one or provide an initializer./,
|
|
333
337
|
result: '用户任务未关联页面',
|
|
@@ -900,6 +904,17 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
900
904
|
});
|
|
901
905
|
}
|
|
902
906
|
}
|
|
907
|
+
|
|
908
|
+
if (node instanceof BindAttribute && node.parentNode instanceof ViewElement) {
|
|
909
|
+
const reg = /左边类型:\s*(.*)[,,]\s*右边类型:\s*(.*)[.。]/
|
|
910
|
+
const left = reg.exec(tsErrorDetail.message)?.[1];
|
|
911
|
+
const right = reg.exec(tsErrorDetail.message)?.[2];
|
|
912
|
+
|
|
913
|
+
if (left && right) {
|
|
914
|
+
tsErrorDetail.message = `页面组件:属性类型不一致!接收类型:${left},传入类型:${right}。`;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
903
918
|
if (node && tsErrorDetail) {
|
|
904
919
|
node.tsErrorDetail = tsErrorDetail;
|
|
905
920
|
}
|
|
@@ -94,7 +94,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
94
94
|
} else if (propertyTypeName === 'DateTime') {
|
|
95
95
|
formItem += `<u-date-time-picker :clearable="true" :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
96
96
|
} else {
|
|
97
|
-
const namespaceArr = propertyTypeNamespace
|
|
97
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
98
98
|
const type = namespaceArr.pop();
|
|
99
99
|
if (type === 'enums') {
|
|
100
100
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -211,7 +211,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
211
211
|
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-datetime-picker type="datetime" v-model="${vModel}" title="请选择${property.label || property.name
|
|
212
212
|
}" labelField="" inputAlign="left"></van-datetime-picker></van-linear-layout></template>`;
|
|
213
213
|
} else {
|
|
214
|
-
const namespaceArr = propertyTypeNamespace
|
|
214
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
215
215
|
const type = namespaceArr.pop();
|
|
216
216
|
if (type === 'enums') {
|
|
217
217
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -428,7 +428,7 @@ export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys
|
|
|
428
428
|
const module = dataSource.app;
|
|
429
429
|
const { ns } = entity;
|
|
430
430
|
const { disabledRelationEntity } = extra;
|
|
431
|
-
const createLogic = ns?.logics?.find((logic) => logic.name === `create`);
|
|
431
|
+
const createLogic = ns?.logics?.find((logic : Logic) => logic.name === `create`);
|
|
432
432
|
|
|
433
433
|
const nameGroup: NameGroup = {};
|
|
434
434
|
nameGroup.viewElementMainView = likeComponent.getViewElementUniqueName('form1');
|
|
@@ -518,7 +518,7 @@ export function genCreateBlock(entity: Entity, oldNode: ViewElement, appointKeys
|
|
|
518
518
|
})
|
|
519
519
|
)}}` : ''
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
|
|
522
522
|
]
|
|
523
523
|
${appointKeys.length ? '' : `,"viewLogics": [
|
|
524
524
|
${JSON.stringify(submitLogic)}
|
|
@@ -88,7 +88,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
88
88
|
} else if (propertyTypeName === 'DateTime') {
|
|
89
89
|
formItem += `<u-date-time-picker :clearable="true" :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
90
90
|
} else {
|
|
91
|
-
const namespaceArr = propertyTypeNamespace
|
|
91
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
92
92
|
const type = namespaceArr.pop();
|
|
93
93
|
if (type === 'enums') {
|
|
94
94
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -191,7 +191,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
191
191
|
} else if (propertyTypeName === 'DateTime') {
|
|
192
192
|
formItem += `<u-date-time-picker :clearable="true" :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
193
193
|
} else {
|
|
194
|
-
const namespaceArr = propertyTypeNamespace
|
|
194
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
195
195
|
const type = namespaceArr.pop();
|
|
196
196
|
if (type === 'enums') {
|
|
197
197
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -97,7 +97,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
97
97
|
} else if (propertyTypeName === 'DateTime') {
|
|
98
98
|
formItem += `<u-date-time-picker clearable :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
99
99
|
} else {
|
|
100
|
-
const namespaceArr = propertyTypeNamespace
|
|
100
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
101
101
|
const type = namespaceArr.pop();
|
|
102
102
|
if (type === 'enums') {
|
|
103
103
|
const Enum = dataSource.app.findNodeByCompleteName(propertyTypeNamespace + '.' + propertyTypeName) as Enum;
|
|
@@ -222,7 +222,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
222
222
|
property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''
|
|
223
223
|
}></u-date-time-picker>`;
|
|
224
224
|
} else {
|
|
225
|
-
const namespaceArr = propertyTypeNamespace
|
|
225
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
226
226
|
const type = namespaceArr.pop();
|
|
227
227
|
if (type === 'enums') {
|
|
228
228
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -318,7 +318,7 @@ function genCreateLogic(nameGroup: NameGroup, entity?: Entity ) {
|
|
|
318
318
|
|
|
319
319
|
export function genSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
320
320
|
const { ns } = entity;
|
|
321
|
-
const createLogic = ns?.logics?.find((logic) => logic.name === `create`);
|
|
321
|
+
const createLogic = ns?.logics?.find((logic : Logic) => logic.name === `create`);
|
|
322
322
|
|
|
323
323
|
return NaslNode.Logic({
|
|
324
324
|
name: nameGroup.viewLogicSubmit,
|
|
@@ -353,7 +353,7 @@ export function genSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
353
353
|
|
|
354
354
|
export function genUpdateSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
355
355
|
const { ns } = entity;
|
|
356
|
-
const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
|
|
356
|
+
const updateLogic = ns?.logics?.find((logic : Logic) => logic.name === `update`);
|
|
357
357
|
|
|
358
358
|
return NaslNode.Logic({
|
|
359
359
|
name: nameGroup.viewLogicUpdateSubmit,
|
|
@@ -929,7 +929,7 @@ function genCloseDelModalLogic(nameGroup: NameGroup) {
|
|
|
929
929
|
|
|
930
930
|
function genDelModalSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
931
931
|
const { ns } = entity;
|
|
932
|
-
const deleteLogic = ns?.logics?.find((logic) => logic.name === 'delete');
|
|
932
|
+
const deleteLogic = ns?.logics?.find((logic : Logic) => logic.name === 'delete');
|
|
933
933
|
return NaslNode.Logic({
|
|
934
934
|
name: nameGroup.viewLogicDelModalSubmit,
|
|
935
935
|
params: [],
|
|
@@ -1041,7 +1041,7 @@ export function genFilterTemplateTableDesigner(entity: Entity, nameGroup: NameGr
|
|
|
1041
1041
|
} else if (propertyTypeName === 'DateTime') {
|
|
1042
1042
|
formItem += `<u-date-time-picker :clearable="true" :value.sync="${vModel}" placeholder="请输入${label}"></u-date-time-picker>`;
|
|
1043
1043
|
} else {
|
|
1044
|
-
const namespaceArr = propertyTypeNamespace
|
|
1044
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
1045
1045
|
const type = namespaceArr.pop();
|
|
1046
1046
|
if (type === 'enums') {
|
|
1047
1047
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -1160,7 +1160,7 @@ function genSaveModalTemplateDesigner(
|
|
|
1160
1160
|
property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''
|
|
1161
1161
|
}></u-date-time-picker>`;
|
|
1162
1162
|
} else {
|
|
1163
|
-
const namespaceArr = propertyTypeNamespace
|
|
1163
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
1164
1164
|
const type = namespaceArr.pop();
|
|
1165
1165
|
if (type === 'enums') {
|
|
1166
1166
|
const Enum = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as utils from '../utils';
|
|
2
|
-
import { Entity, EntityProperty, DataSource, Enum } from '../concepts';
|
|
2
|
+
import { Entity, EntityProperty, DataSource, Enum, Logic } from '../concepts';
|
|
3
3
|
import {
|
|
4
4
|
filterProperty,
|
|
5
5
|
NameGroup,
|
|
@@ -95,7 +95,7 @@ export function genEditTableColumnTemplate(
|
|
|
95
95
|
} else if (propertyTypeName === 'DateTime') {
|
|
96
96
|
formItem = `<u-date-time-picker :clearable="true" :value.sync="${valueExpression}" placeholder="请输入${label}" appendTo="body" :autofocus="true" :opened="true" @blur="${nameGroup.viewLogicBlurUpdate}"></u-date-time-picker>`;
|
|
97
97
|
} else {
|
|
98
|
-
const namespaceArr = propertyTypeNamespace
|
|
98
|
+
const namespaceArr = propertyTypeNamespace?.split?.('.') || [];
|
|
99
99
|
const type = namespaceArr.pop();
|
|
100
100
|
if (type === 'enums') {
|
|
101
101
|
const enumeration = dataSource.app.findNodeByCompleteName(`${propertyTypeNamespace}.${propertyTypeName}`) as Enum;
|
|
@@ -240,7 +240,7 @@ export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
240
240
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
241
241
|
|
|
242
242
|
const { ns } = entity;
|
|
243
|
-
const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
|
|
243
|
+
const deleteLogic = ns?.logics?.find((logic : Logic) => logic.name === `delete`);
|
|
244
244
|
const idPropertys = entity.properties.filter((property) => property.primaryKey || property.name === 'id');
|
|
245
245
|
|
|
246
246
|
return NaslNode.Logic({
|
|
@@ -274,7 +274,7 @@ export function genBlurUpdateLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
274
274
|
if (entity.concept === 'Entity') {
|
|
275
275
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
276
276
|
const { ns } = entity;
|
|
277
|
-
const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
|
|
277
|
+
const updateLogic = ns?.logics?.find((logic : Logic) => logic.name === `update`);
|
|
278
278
|
const valuePrefixExpression = nameGroup.valuePrefixExpression ? nameGroup.valuePrefixExpression : `current.item.${lowerEntityName}`;
|
|
279
279
|
callLogics.push(
|
|
280
280
|
NaslLogicItem.CallLogic({
|
|
@@ -70,7 +70,7 @@ export function genGetBlock(entity: Entity, oldNode: ViewElement,
|
|
|
70
70
|
const likeComponent = oldNode?.likeComponent;
|
|
71
71
|
const isBusinessComponent = likeComponent.concept === 'BusinessComponent';
|
|
72
72
|
const { ns } = entity;
|
|
73
|
-
const getLogic = ns?.logics?.find((logic) => logic.name === `get`);
|
|
73
|
+
const getLogic = ns?.logics?.find((logic : Logic) => logic.name === `get`);
|
|
74
74
|
|
|
75
75
|
const nameGroup: NameGroup = {};
|
|
76
76
|
nameGroup.viewParamId = likeComponent.getParamUniqueName('id');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
|
-
import { App, Module, Namespace, Entity, EntityProperty, DataSource, ViewElement } from '../concepts';
|
|
3
|
+
import { App, Module, Namespace, Entity, EntityProperty, DataSource, ViewElement, Logic } from '../concepts';
|
|
4
4
|
import {
|
|
5
5
|
filterProperty,
|
|
6
6
|
NameGroup,
|
|
@@ -203,7 +203,7 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
|
|
|
203
203
|
export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
204
204
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
205
205
|
const { ns } = entity;
|
|
206
|
-
const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
|
|
206
|
+
const deleteLogic = ns?.logics?.find((logic : Logic) => logic.name === `delete`);
|
|
207
207
|
const idPropertys = entity.properties.filter((property) => property.primaryKey || property.name === 'id');
|
|
208
208
|
const currentName = nameGroup.currentName || 'current';
|
|
209
209
|
|