@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.14
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/out/automate/engine/index.js +1 -1
- package/out/automate/engine/index.js.map +1 -1
- package/out/common/BaseNode.d.ts +4 -4
- package/out/common/BaseNode.js +45 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +17 -0
- package/out/concepts/App__.js +54 -12
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +8 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +21 -21
- package/out/concepts/BindAttribute__.js +4 -3
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +3 -3
- package/out/concepts/BindDirective__.js +22 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +9 -8
- package/out/concepts/BindEvent__.js +17 -7
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +10 -5
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +11 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +0 -1
- package/out/concepts/CallQueryComponent__.js +5 -8
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.js +10 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +3 -0
- package/out/concepts/EntityProperty__.js +38 -0
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +34 -31
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +4 -4
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +13 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +10 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +3 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -0
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +16 -11
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.js +8 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +12 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -0
- package/out/concepts/Param__.js +3 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +5 -5
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.js +4 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +6 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +3 -6
- package/out/concepts/StructureProperty__.js +38 -32
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +3 -3
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +10 -2
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +6 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +63 -60
- package/out/concepts/ViewElement__.js +123 -88
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +26 -10
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +0 -29
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +98 -72
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +15 -1
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +27 -45
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +3 -3
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/getProcesses.js +2 -2
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -3
- package/out/server/naslServer.js +73 -57
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.d.ts +0 -3
- package/out/server/translator.js +16 -7
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -12
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -5
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +1 -1
- package/src/common/BaseNode.ts +46 -42
- package/src/concepts/App__.ts +54 -12
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/BinaryExpression__.ts +8 -6
- package/src/concepts/BindAttribute__.ts +26 -32
- package/src/concepts/BindDirective__.ts +24 -9
- package/src/concepts/BindEvent__.ts +25 -29
- package/src/concepts/CallFunction__.ts +11 -6
- package/src/concepts/CallInterface__.ts +11 -1
- package/src/concepts/CallLogic__.ts +21 -40
- package/src/concepts/CallQueryComponent__.ts +6 -10
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +9 -7
- package/src/concepts/EntityProperty__.ts +36 -0
- package/src/concepts/Entity__.ts +63 -50
- package/src/concepts/Enum__.ts +1 -1
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +4 -4
- package/src/concepts/Identifier__.ts +15 -18
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +11 -0
- package/src/concepts/Interface__.ts +3 -3
- package/src/concepts/LogicItem__.ts +15 -0
- package/src/concepts/Logic__.ts +34 -50
- package/src/concepts/Module__.ts +8 -8
- package/src/concepts/Namespace__.ts +12 -12
- package/src/concepts/Param__.ts +3 -0
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +5 -5
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +4 -4
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +6 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +36 -29
- package/src/concepts/Structure__.ts +3 -3
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +8 -2
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +6 -3
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +183 -147
- package/src/concepts/View__.ts +30 -32
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/genBundleFiles.ts +102 -74
- package/src/server/createUiTs.ts +18 -3
- package/src/server/getLogics.ts +29 -47
- package/src/server/getMemberIdentifier.ts +3 -3
- package/src/server/getProcesses.ts +2 -2
- package/src/server/naslServer.ts +84 -62
- package/src/server/translator.ts +18 -6
- package/src/service/storage/init.ts +20 -13
- package/src/templator/genCreateBlock.ts +3 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genUpdateBlock.ts +5 -6
- package/src/templator/utils.ts +2 -1
package/src/server/naslServer.ts
CHANGED
|
@@ -39,10 +39,11 @@ import {
|
|
|
39
39
|
CallInterface,
|
|
40
40
|
Return,
|
|
41
41
|
ProcessElement,
|
|
42
|
+
NullLiteral,
|
|
42
43
|
} from '../concepts';
|
|
43
44
|
import { lsp2tspNumber, SourceMap, SourceMapItem, embeddedTSEmitter } from '../translator';
|
|
44
45
|
import axios from '../service/storage';
|
|
45
|
-
import {
|
|
46
|
+
import { translateDiagnosticMessage } from './translator';
|
|
46
47
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
47
48
|
import { DiagnosticRecord, Diagnostic, default as diagnosticManager } from '../manager/diagnostic';
|
|
48
49
|
import formatUiTs from './createUiTs';
|
|
@@ -66,7 +67,6 @@ interface setNameNode extends BaseNode {
|
|
|
66
67
|
[propname: string]: any;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
export { transformType, translateDiagnosticMessage };
|
|
70
70
|
const worker = new Worker('/ts-worker.js');
|
|
71
71
|
const messager = new Messager({
|
|
72
72
|
protocol: 'ts-worker',
|
|
@@ -110,12 +110,18 @@ const naslServer = {
|
|
|
110
110
|
return this.messager.requestCommand('start');
|
|
111
111
|
},
|
|
112
112
|
async createUiTs(allComponent: any) {
|
|
113
|
-
const { code, elementsLogic } = await formatUiTs(allComponent);
|
|
113
|
+
const { code, elementsLogic, naslStdlibMap } = await formatUiTs(allComponent);
|
|
114
114
|
// 放入生產的uits文件
|
|
115
115
|
await naslServer.addFile({
|
|
116
116
|
file: 'nasl.ui.definition.ts',
|
|
117
117
|
fileContent: code,
|
|
118
118
|
});
|
|
119
|
+
Object.keys(naslStdlibMap).forEach(async (libFileName: string) => {
|
|
120
|
+
await naslServer.addFile({
|
|
121
|
+
file: '/' + libFileName,
|
|
122
|
+
fileContent: naslStdlibMap[libFileName],
|
|
123
|
+
});
|
|
124
|
+
});
|
|
119
125
|
naslServer.elementsLogic = elementsLogic;
|
|
120
126
|
// 全部文件加载完毕开始初始化
|
|
121
127
|
await naslServer.getDiagnosticRecordsAndPushAll();
|
|
@@ -294,20 +300,18 @@ const naslServer = {
|
|
|
294
300
|
return this.messager.requestCommand('updateFiles', args);
|
|
295
301
|
},
|
|
296
302
|
_debugInFileStorage(node: BaseNode, openFiles: Array<tsProtocol.OpenRequestArgs>) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
app = (node as any).rootNode || (node as any).app;
|
|
302
|
-
}
|
|
303
|
-
return Promise.all(openFiles.map(async (file) => {
|
|
304
|
-
const res = await axios.post('/api/App/debugEmbedded?id=' + app.id, file);
|
|
305
|
-
return res.data;
|
|
306
|
-
}));
|
|
307
|
-
}
|
|
308
|
-
} catch (err) {
|
|
309
|
-
console.log(err);
|
|
303
|
+
/// #if process.env.NODE_ENV === 'development'
|
|
304
|
+
let app = node;
|
|
305
|
+
if (node.concept !== 'App') {
|
|
306
|
+
app = (node as any).rootNode || (node as any).app;
|
|
310
307
|
}
|
|
308
|
+
return Promise.all(openFiles.map(async (file) => {
|
|
309
|
+
const res = await axios.post('/api/App/debugEmbedded?id=' + app.id, file);
|
|
310
|
+
return res.data;
|
|
311
|
+
})).catch((e) => {
|
|
312
|
+
console.error(e);
|
|
313
|
+
});
|
|
314
|
+
/// #endif
|
|
311
315
|
},
|
|
312
316
|
open() {
|
|
313
317
|
return this.messager.requestCommand('open');
|
|
@@ -398,6 +402,11 @@ const naslServer = {
|
|
|
398
402
|
}> = [{ title: '基础类型', children: res }];
|
|
399
403
|
return dataTypeList;
|
|
400
404
|
}
|
|
405
|
+
} else if (node instanceof NullLiteral) {
|
|
406
|
+
return [{ title: '基础类型', children: primitiveTypeList }];
|
|
407
|
+
} else {
|
|
408
|
+
// 字符串 和 inter
|
|
409
|
+
return [{ title: '基础类型', children: [primitiveTypeList[1], primitiveTypeList[4]] }];
|
|
401
410
|
}
|
|
402
411
|
},
|
|
403
412
|
_getTypeQuickinfo(args: any) {
|
|
@@ -446,7 +455,7 @@ const naslServer = {
|
|
|
446
455
|
|
|
447
456
|
// 语义诊断
|
|
448
457
|
record.semanticDiagnostics = record.semanticDiagnostics
|
|
449
|
-
.map((diag) => this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
458
|
+
.map((diag) => this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, node as FileNode))
|
|
450
459
|
.filter((diag) => !!diag);
|
|
451
460
|
|
|
452
461
|
// 建议诊断
|
|
@@ -480,7 +489,6 @@ const naslServer = {
|
|
|
480
489
|
};
|
|
481
490
|
|
|
482
491
|
if (minRange) {
|
|
483
|
-
// let message = this.translateDiagnosticMessage(diagnostic.text);
|
|
484
492
|
// 节点的error要置为true
|
|
485
493
|
return naslServer._diagnosticSpecialTreatment(minRange, tsErrorDetail);
|
|
486
494
|
} else {
|
|
@@ -531,6 +539,16 @@ const naslServer = {
|
|
|
531
539
|
}
|
|
532
540
|
}
|
|
533
541
|
|
|
542
|
+
if (minRange.node instanceof Identifier || minRange.node instanceof MemberExpression) {
|
|
543
|
+
if (/Cannot find name '(.+?)'. Did you mean '(.+?)'\?/.exec(text) && minRange.node.parentNode instanceof MemberExpression) {
|
|
544
|
+
let parentNode: BaseNode = minRange.node;
|
|
545
|
+
while (parentNode && parentNode.concept && parentNode.parentNode.concept === 'MemberExpression') {
|
|
546
|
+
parentNode = parentNode.parentNode;
|
|
547
|
+
}
|
|
548
|
+
minRange.node = parentNode || minRange.node;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
534
552
|
if (/'(.+?)' has no exported member(?: named)? '(.+?)'/.exec(text) || /Property '(.+?)' does not exist on type '(.+?)'./.exec(text)) {
|
|
535
553
|
if (minRange.node instanceof TypeAnnotation) {
|
|
536
554
|
// 变量type的报错放到内部
|
|
@@ -611,7 +629,7 @@ const naslServer = {
|
|
|
611
629
|
|
|
612
630
|
if (node instanceof Return) {
|
|
613
631
|
// 过滤一下最后出去的值
|
|
614
|
-
refsList = refsList.filter((item) => !
|
|
632
|
+
refsList = refsList.filter((item) => !item.lineText.includes('return '));
|
|
615
633
|
}
|
|
616
634
|
|
|
617
635
|
// 如果是参数, 就需要把logic的引用 都查找出来就需要把他的父级的引用全部查找出来
|
|
@@ -701,7 +719,7 @@ const naslServer = {
|
|
|
701
719
|
const fileNode = this.file2NodeMap.get(record.file);
|
|
702
720
|
if (!fileNode)
|
|
703
721
|
return null;
|
|
704
|
-
const minRange: reNameMinRange = this._findMinRange(record,
|
|
722
|
+
const minRange: reNameMinRange = this._findMinRange(record, fileNode as FileNode);
|
|
705
723
|
if (minRange) {
|
|
706
724
|
// 如果节点是TypeAnnotation类型,
|
|
707
725
|
// 很复杂,可能是多级嵌套结构
|
|
@@ -906,14 +924,14 @@ const naslServer = {
|
|
|
906
924
|
const newBindRoles = str.split(',');
|
|
907
925
|
minRange.newValue = newBindRoles;
|
|
908
926
|
}
|
|
909
|
-
if (
|
|
927
|
+
if (minRange.node instanceof QueryFieldExpression && node instanceof Entity) {
|
|
910
928
|
minRange.setTypeMethods = 'setEntityAsName';
|
|
911
929
|
}
|
|
912
930
|
|
|
913
|
-
if (
|
|
931
|
+
if (minRange.node instanceof QueryFromExpression && node instanceof Entity) {
|
|
914
932
|
minRange.setTypeMethods = 'setEntityName';
|
|
915
933
|
}
|
|
916
|
-
if (
|
|
934
|
+
if (minRange.node instanceof QueryFieldExpression && node instanceof EntityProperty) {
|
|
917
935
|
minRange.setTypeMethods = 'setPropertyName';
|
|
918
936
|
}
|
|
919
937
|
if (minRange.node instanceof Destination && node instanceof Process) {
|
|
@@ -969,7 +987,7 @@ const naslServer = {
|
|
|
969
987
|
const fileNode = this.file2NodeMap.get(record.file);
|
|
970
988
|
if (!fileNode)
|
|
971
989
|
return null;
|
|
972
|
-
const minRange: MinRange = this._findMinRange(record,
|
|
990
|
+
const minRange: MinRange = this._findMinRange(record, fileNode as FileNode);
|
|
973
991
|
if (minRange) {
|
|
974
992
|
// 如果找到节点是callLogic就去更新
|
|
975
993
|
if (minRange.node instanceof CallLogic && node instanceof Param) {
|
|
@@ -998,7 +1016,7 @@ const naslServer = {
|
|
|
998
1016
|
const fileNode = this.file2NodeMap.get(record.file);
|
|
999
1017
|
if (!fileNode)
|
|
1000
1018
|
return;
|
|
1001
|
-
const minRange = this._findMinRange(record,
|
|
1019
|
+
const minRange = this._findMinRange(record, fileNode as FileNode);
|
|
1002
1020
|
// 过滤一把不需要改的信息
|
|
1003
1021
|
if (minRange) {
|
|
1004
1022
|
// 拼装树
|
|
@@ -1034,7 +1052,9 @@ const naslServer = {
|
|
|
1034
1052
|
// 排除一些不放入集合的节点
|
|
1035
1053
|
let isNeedPush = true;
|
|
1036
1054
|
// 如果不是ViewElement 或者 Assignment , 或者如果是的话, 排除l-root
|
|
1037
|
-
if (currentNode instanceof ViewElement && (currentNode as ViewElement).tag
|
|
1055
|
+
if (currentNode instanceof ViewElement && (currentNode as ViewElement).tag === 'l-root')
|
|
1056
|
+
isNeedPush = false;
|
|
1057
|
+
else if (currentNode instanceof Argument)
|
|
1038
1058
|
isNeedPush = false;
|
|
1039
1059
|
else if (currentNode instanceof Assignment)
|
|
1040
1060
|
isNeedPush = false;
|
|
@@ -1137,6 +1157,8 @@ const naslServer = {
|
|
|
1137
1157
|
* 当前this上下文 的Source 和 父级文件级别的节点
|
|
1138
1158
|
*/
|
|
1139
1159
|
getCurrentSource(node: BaseNode) {
|
|
1160
|
+
if (node instanceof App)
|
|
1161
|
+
return { fileNode: null };
|
|
1140
1162
|
let sourceMap = node.sourceMap;
|
|
1141
1163
|
let fileNode = node;
|
|
1142
1164
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
@@ -1327,6 +1349,21 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1327
1349
|
// 如果有依赖就有一个查找引用提示
|
|
1328
1350
|
confirmParms.tipFlag = true;
|
|
1329
1351
|
const node = this;
|
|
1352
|
+
|
|
1353
|
+
// 删除页面或者流程
|
|
1354
|
+
if (node instanceof View || node instanceof Process) {
|
|
1355
|
+
/**
|
|
1356
|
+
* 查找这个页面是不是有依赖
|
|
1357
|
+
*/
|
|
1358
|
+
let viewPath = (this as FileNode).getEmbeddedFilePath();
|
|
1359
|
+
viewPath = viewPath.slice(0, viewPath.length - 3);
|
|
1360
|
+
const find = refsList.find((record) => !record.file.includes(viewPath));
|
|
1361
|
+
// 如果没有别的文件的依赖,就直接delete
|
|
1362
|
+
if (!find) {
|
|
1363
|
+
this.delete();
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1330
1367
|
callback = () => {
|
|
1331
1368
|
// removeParam
|
|
1332
1369
|
// 跟rename 还不太一样,部分修改依赖修改好的值,然后在下面的修改需要把自己传递进去
|
|
@@ -1342,7 +1379,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1342
1379
|
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
1343
1380
|
if (!fileNode)
|
|
1344
1381
|
return null;
|
|
1345
|
-
const minRange: MinRange = naslServer._findMinRange(record,
|
|
1382
|
+
const minRange: MinRange = naslServer._findMinRange(record, fileNode as FileNode);
|
|
1346
1383
|
if (minRange) {
|
|
1347
1384
|
if (minRange.node instanceof CallLogic) {
|
|
1348
1385
|
minRange.node.setCalleeArgName(logicNode as Logic);
|
|
@@ -1365,7 +1402,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1365
1402
|
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
1366
1403
|
if (!fileNode)
|
|
1367
1404
|
return null;
|
|
1368
|
-
const minRange: MinRange = naslServer._findMinRange(record,
|
|
1405
|
+
const minRange: MinRange = naslServer._findMinRange(record, fileNode as FileNode);
|
|
1369
1406
|
if (minRange) {
|
|
1370
1407
|
if (minRange.node instanceof Interface) {
|
|
1371
1408
|
minRange.node.delete();
|
|
@@ -1387,7 +1424,7 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1387
1424
|
const fileNode = naslServer.file2NodeMap.get(record.file);
|
|
1388
1425
|
if (!fileNode)
|
|
1389
1426
|
return null;
|
|
1390
|
-
const minRange: MinRange = naslServer._findMinRange(record,
|
|
1427
|
+
const minRange: MinRange = naslServer._findMinRange(record, fileNode as FileNode);
|
|
1391
1428
|
if (minRange) {
|
|
1392
1429
|
if (minRange.node instanceof View || minRange.node instanceof ViewElement) {
|
|
1393
1430
|
// oldName旧的节点存的值
|
|
@@ -1404,6 +1441,10 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
1404
1441
|
return;
|
|
1405
1442
|
}
|
|
1406
1443
|
|
|
1444
|
+
// 删除页面或者流程,如果上一步没有return 就说明他是有别的引用的,会有引用弹框
|
|
1445
|
+
if (node instanceof View || node instanceof Process) {
|
|
1446
|
+
this.delete();
|
|
1447
|
+
}
|
|
1407
1448
|
// 其余的都直接调用删除
|
|
1408
1449
|
// Structure 和 Interface是内部有delete方法
|
|
1409
1450
|
if (node instanceof Structure || node instanceof Interface) {
|
|
@@ -1434,30 +1475,6 @@ BaseNode.prototype.addParamsPrepare = async function addParamsPrepare() {
|
|
|
1434
1475
|
}
|
|
1435
1476
|
};
|
|
1436
1477
|
|
|
1437
|
-
/**
|
|
1438
|
-
* 页面的删除同步他的子页面要一起删除
|
|
1439
|
-
*/
|
|
1440
|
-
BaseNode.prototype.viewPrepareDelete = async function viewPrepareDelete() {
|
|
1441
|
-
try {
|
|
1442
|
-
/**
|
|
1443
|
-
* 查找这个页面是不是有依赖
|
|
1444
|
-
*/
|
|
1445
|
-
const refsList = await naslServer._isHaveRef(this);
|
|
1446
|
-
let viewPath = (this as FileNode).getEmbeddedFilePath();
|
|
1447
|
-
viewPath = viewPath.slice(0, viewPath.length - 3);
|
|
1448
|
-
const find = refsList.find((record) => !record.file.includes(viewPath));
|
|
1449
|
-
// 如果有别的文件的依赖
|
|
1450
|
-
if (find) {
|
|
1451
|
-
// 就展示弹框
|
|
1452
|
-
this.prepareDelete();
|
|
1453
|
-
} else {
|
|
1454
|
-
this.delete();
|
|
1455
|
-
}
|
|
1456
|
-
} catch (err) {
|
|
1457
|
-
console.log(err);
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
|
|
1461
1478
|
/**
|
|
1462
1479
|
* 除去rename场景下的更新
|
|
1463
1480
|
* @param fileNode 文件级别的节点
|
|
@@ -1482,14 +1499,19 @@ async function handleChange(fileNode: BaseNode, targetNode: BaseNode, result: Re
|
|
|
1482
1499
|
newRefs.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
1483
1500
|
// 唤起建立连接弹框
|
|
1484
1501
|
// 文件级别的建立连接采取提醒
|
|
1485
|
-
if (
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1502
|
+
if (action === 'create' && (targetNode as any).__init) {
|
|
1503
|
+
// 清除临时状态, 完成本次创建
|
|
1504
|
+
delete (targetNode as any).__init;
|
|
1505
|
+
if (fileNode === targetNode && filesToCheck.size > 1) {
|
|
1506
|
+
const confirmParms = {
|
|
1507
|
+
actionType: 'createEstablishConnection',
|
|
1508
|
+
node: fileNode,
|
|
1509
|
+
icon: 'success',
|
|
1510
|
+
};
|
|
1511
|
+
invokeCommand('tsConfirm.open', confirmParms, () => {});
|
|
1512
|
+
}
|
|
1492
1513
|
}
|
|
1514
|
+
|
|
1493
1515
|
// console.log('filesToCheck', filesToCheck, filesToCheck.size);
|
|
1494
1516
|
await naslServer.getDiagnosticRecordsAndPushAll(Array.from(filesToCheck));
|
|
1495
1517
|
}
|
|
@@ -1546,7 +1568,7 @@ async function handleRename(fileNode: BaseNode, targetNode: BaseNode, result: Re
|
|
|
1546
1568
|
node: fileNode,
|
|
1547
1569
|
icon: 'success',
|
|
1548
1570
|
};
|
|
1549
|
-
invokeCommand('tsConfirm.open', confirmParms, () => {
|
|
1571
|
+
invokeCommand('tsConfirm.open', confirmParms, () => {});
|
|
1550
1572
|
}
|
|
1551
1573
|
} else {
|
|
1552
1574
|
// 查一下当前属性依赖的文件
|
|
@@ -1582,7 +1604,7 @@ async function receiveHandleChange($event: EventPayload) {
|
|
|
1582
1604
|
// 当前操作的文件节点
|
|
1583
1605
|
const { fileNode } = naslServer.getCurrentSource(targetNode);
|
|
1584
1606
|
// 如果是导入模块就,就引入对应模块,先不处理module和Configuration,下面的内容会自动创建
|
|
1585
|
-
if (fileNode instanceof Module || fileNode instanceof Configuration) {
|
|
1607
|
+
if (!fileNode || fileNode instanceof Module || fileNode instanceof Configuration) {
|
|
1586
1608
|
return;
|
|
1587
1609
|
}
|
|
1588
1610
|
|
package/src/server/translator.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import naslServer from './naslServer';
|
|
2
|
-
|
|
2
|
+
function transformType(tsType: string): string {
|
|
3
3
|
if (tsType === 'string' || tsType === 'String')
|
|
4
4
|
return '字符串';
|
|
5
5
|
else if (tsType === 'number')
|
|
@@ -24,6 +24,8 @@ export function transformType(tsType: string): string {
|
|
|
24
24
|
return '枚举';
|
|
25
25
|
else if (tsType === 'views')
|
|
26
26
|
return '页面';
|
|
27
|
+
else if (tsType === 'void')
|
|
28
|
+
return '无返回值';
|
|
27
29
|
else if (tsType === '__elements')
|
|
28
30
|
return '页面元素';
|
|
29
31
|
else if (tsType === 'Promise<void>')
|
|
@@ -44,7 +46,7 @@ export function transformType(tsType: string): string {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
function transformNamespace(tsNamespace: string): string {
|
|
48
50
|
if (tsNamespace.endsWith('.structures'))
|
|
49
51
|
return '数据结构';
|
|
50
52
|
else if (tsNamespace.endsWith('.logics'))
|
|
@@ -53,7 +55,7 @@ export function transformNamespace(tsNamespace: string): string {
|
|
|
53
55
|
return tsNamespace;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
function transformMethod(tsMethod: string): string {
|
|
57
59
|
if (tsMethod === 'forEach')
|
|
58
60
|
return 'ForEach';
|
|
59
61
|
return tsMethod;
|
|
@@ -79,9 +81,14 @@ export function translateDiagnosticMessage(message: string) {
|
|
|
79
81
|
transforms: [transformType, transformType],
|
|
80
82
|
},
|
|
81
83
|
{
|
|
82
|
-
re: /^This condition will always return '
|
|
83
|
-
result: '类型不一致!左边类型:$
|
|
84
|
-
transforms: [transformType, transformType],
|
|
84
|
+
re: /^This condition will always return '(.+?)' since the types '(.+?)' and '(.+?)' have no overlap./,
|
|
85
|
+
result: '类型不一致!左边类型:$2,右边类型:$3。',
|
|
86
|
+
transforms: [transformType, transformType, transformType],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
re: /(.+?) Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'.$/,
|
|
90
|
+
result: '类型不一致!传入类型:$2,接收类型:$3。',
|
|
91
|
+
transforms: [transformType, transformType, transformType],
|
|
85
92
|
},
|
|
86
93
|
{
|
|
87
94
|
re: /^Type '(.+?)' is missing the following properties from type '(.+?)'/,
|
|
@@ -160,6 +167,11 @@ export function translateDiagnosticMessage(message: string) {
|
|
|
160
167
|
result: '找不到 $1,您是想要 $2 吗?',
|
|
161
168
|
transforms: [outOriginalvalue, outOriginalvalue],
|
|
162
169
|
},
|
|
170
|
+
{
|
|
171
|
+
re: /Expected (.+?) type arguments, but got (.+?)./,
|
|
172
|
+
result: '预期 $1 个类型参数,但传入了 $2 个。',
|
|
173
|
+
transforms: [outOriginalvalue, outOriginalvalue],
|
|
174
|
+
},
|
|
163
175
|
{
|
|
164
176
|
re: /Expected (.+?) arguments, but got (.+?)./,
|
|
165
177
|
result: '预期 $1 个参数,但传入了 $2 个。',
|
|
@@ -72,6 +72,7 @@ function getStatement(state: any, app: any, diffLogicList: string[]) {
|
|
|
72
72
|
* 执行更新
|
|
73
73
|
*/
|
|
74
74
|
async function doAction(app: any, actionItem: any) {
|
|
75
|
+
app.emit('saving');
|
|
75
76
|
let hasFrontEnd = false;
|
|
76
77
|
let hasBackEnd = false;
|
|
77
78
|
const actionList: any[] = [];
|
|
@@ -84,7 +85,6 @@ async function doAction(app: any, actionItem: any) {
|
|
|
84
85
|
if (['entities', 'processes', 'logics'].some((item) => _root.startsWith(item))) {
|
|
85
86
|
hasBackEnd = true;
|
|
86
87
|
}
|
|
87
|
-
// console.log(emitTarget, action, actionItem);
|
|
88
88
|
const itemloop = (_i: LogicItem, app: any, diffArr: string[]) => {
|
|
89
89
|
const _l = getStatement(_i, app, diffArr);
|
|
90
90
|
if (_l.length) {
|
|
@@ -173,16 +173,21 @@ async function doAction(app: any, actionItem: any) {
|
|
|
173
173
|
} else if (hasBackEnd) {
|
|
174
174
|
ChangedNASLType = 'backend';
|
|
175
175
|
}
|
|
176
|
+
let err;
|
|
176
177
|
if (config.storage.protocol === 'http') {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
try {
|
|
179
|
+
await storageService.batchAction({
|
|
180
|
+
body: actionList,
|
|
181
|
+
headers: {
|
|
182
|
+
appId: app.id,
|
|
183
|
+
ChangedNASLType,
|
|
184
|
+
'request-appBaseVersion': (window as any).appData?.baseVersion || '',
|
|
185
|
+
'request-versionChangedTime': (window as any).appData?.versionChangedTime || '',
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
} catch (error) {
|
|
189
|
+
err = error;
|
|
190
|
+
}
|
|
186
191
|
} else if (config.storage.protocol === 'mock') {
|
|
187
192
|
// Do nothing
|
|
188
193
|
} else {
|
|
@@ -192,7 +197,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
192
197
|
spaces: 4,
|
|
193
198
|
});
|
|
194
199
|
}
|
|
195
|
-
|
|
200
|
+
app.emit('saved', err);
|
|
196
201
|
if (!app._historying) {
|
|
197
202
|
if (app._historyIndex !== app._historyList.length) {
|
|
198
203
|
app._historyList = app._historyList.splice(0, app._historyIndex);
|
|
@@ -233,9 +238,11 @@ function handleApp(app: any) {
|
|
|
233
238
|
* 开启收集
|
|
234
239
|
*/
|
|
235
240
|
app.on('collect:start', (event: any) => {
|
|
241
|
+
if (!app._isCollectingCount) {
|
|
242
|
+
app._actionMsg = event?.actionMsg;
|
|
243
|
+
app._action = event?.action;
|
|
244
|
+
}
|
|
236
245
|
app._isCollectingCount++;
|
|
237
|
-
app._actionMsg = event?.actionMsg;
|
|
238
|
-
app._action = event?.action;
|
|
239
246
|
});
|
|
240
247
|
|
|
241
248
|
/**
|
|
@@ -122,6 +122,7 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
122
122
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
123
123
|
v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
124
124
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
125
|
+
:notitleblock="true"
|
|
125
126
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
126
127
|
`;
|
|
127
128
|
} else
|
|
@@ -135,10 +136,9 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
135
136
|
} else if (propertyTypeName === 'Decimal') {
|
|
136
137
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-stepper></template>`;
|
|
137
138
|
} else if (propertyTypeName === 'Text') {
|
|
138
|
-
formItem =
|
|
139
|
-
formItem += `<template #input><van-input v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-input></template>`;
|
|
139
|
+
formItem += `<template #input><van-fieldtextarea v-model="${vModel}" placeholder="请输入${property.label || property.name}"></van-fieldtextarea></template>`;
|
|
140
140
|
} else if (propertyTypeName === 'Date') {
|
|
141
|
-
formItem += `<template #input><van-calendar
|
|
141
|
+
formItem += `<template #input><van-calendar :default-date.sync="${vModel}" title="选择日期"></van-calendar></template>`;
|
|
142
142
|
} else if (propertyTypeName === 'Time') {
|
|
143
143
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${vModel}" title="请选择${property.label || property.name}" label-field=""></van-datetime-picker></template>`;
|
|
144
144
|
} else if (propertyTypeName === 'DateTime') {
|
|
@@ -5,14 +5,23 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as utils from '../utils';
|
|
7
7
|
import { App, Namespace, Entity, View, Enum } from '../concepts';
|
|
8
|
+
import { NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslTypeAnnotation, NaslLogicItem, NaslNode } from './utils';
|
|
8
9
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
genQueryLogic,
|
|
15
|
-
|
|
10
|
+
filterProperty,
|
|
11
|
+
NameGroup,
|
|
12
|
+
genUniqueQueryNameGroup,
|
|
13
|
+
getFirstDisplayedProperty,
|
|
14
|
+
genCallComponentLogic,
|
|
15
|
+
genQueryLogic,
|
|
16
|
+
genEditTableTemplate,
|
|
17
|
+
genEditTableLoadLogic,
|
|
18
|
+
genTableRemoveLogic,
|
|
19
|
+
genEnumSelectBlock,
|
|
20
|
+
genLoadSelectLogic,
|
|
21
|
+
genBlurUpdateLogic,
|
|
22
|
+
genEditQueryStructure,
|
|
23
|
+
genQueryStructure,
|
|
24
|
+
genLogicParam,
|
|
16
25
|
} from '.';
|
|
17
26
|
|
|
18
27
|
function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) {
|
|
@@ -29,10 +38,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
29
38
|
let formItem = `<u-form-item label="${label}">`;
|
|
30
39
|
|
|
31
40
|
const { typeAnnotation } = property || {};
|
|
32
|
-
const {
|
|
33
|
-
typeName: propertyTypeName,
|
|
34
|
-
typeNamespace: propertyTypeNamespace,
|
|
35
|
-
} = typeAnnotation || {};
|
|
41
|
+
const { typeName: propertyTypeName, typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
36
42
|
if (property.relationEntity) {
|
|
37
43
|
// 有外键关联
|
|
38
44
|
const relationEntity = parentNode?.findEntityByName(property.relationEntity);
|
|
@@ -127,10 +133,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
127
133
|
>`;
|
|
128
134
|
|
|
129
135
|
const { typeAnnotation } = property || {};
|
|
130
|
-
const {
|
|
131
|
-
typeName: propertyTypeName,
|
|
132
|
-
typeNamespace: propertyTypeNamespace,
|
|
133
|
-
} = typeAnnotation || {};
|
|
136
|
+
const { typeName: propertyTypeName, typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|
|
134
137
|
if (property.relationEntity) {
|
|
135
138
|
// 有外键关联
|
|
136
139
|
const relationEntity = parentNode?.findEntityByName(property.relationEntity);
|
|
@@ -306,18 +309,14 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
306
309
|
NaslLogicItem.CallLogic({
|
|
307
310
|
calleeNamespace: updateLogic.getNamespace(),
|
|
308
311
|
calleeName: updateLogic.name,
|
|
309
|
-
arguments: [
|
|
310
|
-
genLogicParam(`${updateLogic.params[0].name}`, nameGroup.viewVariableInput),
|
|
311
|
-
],
|
|
312
|
+
arguments: [genLogicParam(`${updateLogic.params[0].name}`, nameGroup.viewVariableInput)],
|
|
312
313
|
}),
|
|
313
314
|
],
|
|
314
315
|
alternate: [
|
|
315
316
|
NaslLogicItem.CallLogic({
|
|
316
317
|
calleeNamespace: createLogic.getNamespace(),
|
|
317
318
|
calleeName: createLogic.name,
|
|
318
|
-
arguments: [
|
|
319
|
-
genLogicParam(`${createLogic.params[0].name}`, nameGroup.viewVariableInput),
|
|
320
|
-
],
|
|
319
|
+
arguments: [genLogicParam(`${createLogic.params[0].name}`, nameGroup.viewVariableInput)],
|
|
321
320
|
}),
|
|
322
321
|
],
|
|
323
322
|
}),
|
|
@@ -382,7 +381,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
382
381
|
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, parentNode);
|
|
383
382
|
newLogics.push(entityLogic);
|
|
384
383
|
|
|
385
|
-
console.log(entityStructure);
|
|
384
|
+
// console.log(entityStructure);
|
|
386
385
|
|
|
387
386
|
return `<template>
|
|
388
387
|
<u-linear-layout direction="vertical">
|
|
@@ -439,7 +438,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
439
438
|
"concept": "BindEvent",
|
|
440
439
|
"arguments": [],
|
|
441
440
|
"name": "created",
|
|
442
|
-
"calleeNamespace": "
|
|
441
|
+
"calleeNamespace": "",
|
|
443
442
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
444
443
|
}
|
|
445
444
|
],
|
|
@@ -511,7 +511,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
511
511
|
"concept": "BindEvent",
|
|
512
512
|
"arguments": [],
|
|
513
513
|
"name": "created",
|
|
514
|
-
"calleeNamespace": "
|
|
514
|
+
"calleeNamespace": "",
|
|
515
515
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
516
516
|
}
|
|
517
517
|
],
|
|
@@ -633,7 +633,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
633
633
|
"concept": "BindEvent",
|
|
634
634
|
"arguments": [],
|
|
635
635
|
"name": "created",
|
|
636
|
-
"calleeNamespace": "
|
|
636
|
+
"calleeNamespace": "",
|
|
637
637
|
"calleeName": "${nameGroup.viewLogicInit}"
|
|
638
638
|
}
|
|
639
639
|
],
|
|
@@ -109,7 +109,7 @@ export function genGetBlock(entity: Entity, view: View) {
|
|
|
109
109
|
"concept": "BindEvent",
|
|
110
110
|
"arguments": [],
|
|
111
111
|
"name": "created",
|
|
112
|
-
"calleeNamespace": "
|
|
112
|
+
"calleeNamespace": "",
|
|
113
113
|
"calleeName": "${nameGroup.viewLogicLoad}"
|
|
114
114
|
}
|
|
115
115
|
]
|
|
@@ -6,6 +6,7 @@ export function genQueryStructure(allEntities: Array<Entity>, nameGroup: NameGro
|
|
|
6
6
|
allEntities = Array.from(new Set(allEntities));
|
|
7
7
|
return NaslNode.Structure({
|
|
8
8
|
name: nameGroup.structure,
|
|
9
|
+
origin: 'CallQueryComponent',
|
|
9
10
|
properties: allEntities.map((entity) =>
|
|
10
11
|
NaslNode.StructureProperty({
|
|
11
12
|
name: utils.firstLowerCase(entity.name),
|
|
@@ -124,6 +124,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
124
124
|
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
125
125
|
v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
126
126
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
127
|
+
:notitleblock="true"
|
|
127
128
|
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
128
129
|
`;
|
|
129
130
|
} else
|
|
@@ -137,12 +138,10 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
137
138
|
} else if (propertyTypeName === 'Decimal') {
|
|
138
139
|
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
139
140
|
} else if (propertyTypeName === 'Text') {
|
|
140
|
-
formItem =
|
|
141
|
-
formItem += `<van-input v-model="${vModel}" placeholder="请输入${label}"></van-input>`;
|
|
142
|
-
|
|
141
|
+
formItem += `<template #input><van-fieldtextarea v-model="${vModel}" placeholder="请输入${label}"></van-fieldtextarea></template>`;
|
|
143
142
|
// @TODO
|
|
144
143
|
} else if (propertyTypeName === 'Date') {
|
|
145
|
-
formItem += `<template #input><van-calendar clearable :date.sync="${vModel}" placeholder="请输入${label}"></van-calendar></template>`;
|
|
144
|
+
formItem += `<template #input><van-calendar clearable :default-date.sync="${vModel}" placeholder="请输入${label}"></van-calendar></template>`;
|
|
146
145
|
} else if (propertyTypeName === 'Time') {
|
|
147
146
|
formItem += `<template #input><van-datetime-picker type="time" v-model="${vModel}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
|
|
148
147
|
} else if (propertyTypeName === 'DateTime') {
|
|
@@ -151,7 +150,7 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
151
150
|
const namespaceArr = propertyTypeNamespace.split('.');
|
|
152
151
|
const type = namespaceArr.pop();
|
|
153
152
|
if (type === 'enums') {
|
|
154
|
-
formItem += genEnumSelectBlock(parentNode.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true);
|
|
153
|
+
formItem += '<template #input>' + genEnumSelectBlock(parentNode.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true) + '</template>';
|
|
155
154
|
} else {
|
|
156
155
|
formItem += `<template #input><van-fieldinput v-model="${vModel}" placeholder="请输入${label}"></van-fieldinput></template>`;
|
|
157
156
|
}
|
|
@@ -323,7 +322,7 @@ export function genUpdateBlock(entity: Entity, view: View) {
|
|
|
323
322
|
"concept": "BindEvent",
|
|
324
323
|
"arguments": [],
|
|
325
324
|
"name": "created",
|
|
326
|
-
"calleeNamespace": "
|
|
325
|
+
"calleeNamespace": "",
|
|
327
326
|
"calleeName": "${nameGroup.viewLogicLoad}"
|
|
328
327
|
}
|
|
329
328
|
],
|