@lcap/nasl 1.0.0-alpha.2 → 1.0.0-alpha.5
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/docs/assets/search.js +1 -1
- package/docs/classes/Entity.html +2832 -204
- package/docs/classes/View.html +4567 -365
- package/out/common/BaseNode.d.ts +1 -1
- package/out/common/BaseNode.js +38 -23
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +22 -0
- package/out/concepts/App__.js +77 -15
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +2 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +2 -1
- package/out/concepts/Assignment__.js +3 -8
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -1
- package/out/concepts/BinaryExpression__.js +5 -5
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +2 -1
- package/out/concepts/BindAttribute__.js +9 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +2 -1
- package/out/concepts/BindDirective__.js +2 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -1
- package/out/concepts/BindEvent__.js +4 -3
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +57 -1
- package/out/concepts/CallFunction__.js +119 -11
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -1
- package/out/concepts/CallInterface__.js +2 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +57 -1
- package/out/concepts/CallLogic__.js +117 -10
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +120 -0
- package/out/concepts/ConfigGroup__.js +214 -0
- package/out/concepts/ConfigGroup__.js.map +1 -0
- package/out/concepts/ConfigPropertyValue__.d.ts +43 -0
- package/out/concepts/ConfigPropertyValue__.js +103 -0
- package/out/concepts/ConfigPropertyValue__.js.map +1 -0
- package/out/concepts/ConfigProperty__.d.ts +128 -0
- package/out/concepts/ConfigProperty__.js +236 -0
- package/out/concepts/ConfigProperty__.js.map +1 -0
- package/out/concepts/Configuration__.d.ts +120 -0
- package/out/concepts/Configuration__.js +210 -0
- package/out/concepts/Configuration__.js.map +1 -0
- package/out/concepts/Constant__.d.ts +2 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +2 -1
- package/out/concepts/Destination__.js +4 -3
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +8 -0
- package/out/concepts/EntityIndex__.js +18 -0
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +5 -5
- package/out/concepts/EntityProperty__.js +10 -9
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +30 -26
- package/out/concepts/Entity__.js +44 -36
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +8 -8
- package/out/concepts/Enum__.js +10 -4
- 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__.d.ts +35 -33
- package/out/concepts/ForEachStatement__.js +103 -36
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -1
- package/out/concepts/Identifier__.js +15 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +5 -1
- package/out/concepts/Interface__.js +19 -5
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +2 -2
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +9 -7
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -5
- package/out/concepts/MemberExpression__.js +12 -18
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +121 -126
- package/out/concepts/Module__.js +10 -17
- 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/NullLiteral__.d.ts +2 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +2 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -1
- package/out/concepts/Param__.js +2 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +82 -81
- package/out/concepts/ProcessElement__.js +19 -6
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +1 -0
- package/out/concepts/Process__.js +10 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.js +2 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +5 -0
- package/out/concepts/Role__.js +19 -2
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -0
- package/out/concepts/SqlQueryComponent__.js +16 -0
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +2 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +1 -1
- package/out/concepts/StructureProperty__.js +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -1
- package/out/concepts/Structure__.js +4 -4
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +3 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +2 -1
- package/out/concepts/UnaryExpression__.js +3 -3
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +2 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -1
- package/out/concepts/ValidationRule__.js +2 -2
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +6 -5
- package/out/concepts/Variable__.js +3 -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 +5 -4
- package/out/concepts/ViewElement__.js +109 -65
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +97 -90
- package/out/concepts/View__.js +153 -118
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +2 -2
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +3 -137
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +21 -5
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.validation.js +527 -0
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -0
- package/out/concepts/index__.d.ts +4 -0
- package/out/concepts/index__.js +4 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/data/Module.d.ts +34 -0
- package/out/data/Module.js +53 -0
- package/out/data/Module.js.map +1 -0
- package/out/generator/compileComponent.d.ts +1 -1
- package/out/generator/genBundleFiles.d.ts +0 -1
- package/out/generator/genBundleFiles.js +1 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +35 -0
- package/out/generator/genMetaData.js +78 -0
- package/out/generator/genMetaData.js.map +1 -0
- package/out/generator/index.d.ts +1 -0
- package/out/generator/index.js +1 -0
- package/out/generator/index.js.map +1 -1
- package/out/index.d.ts +2 -2
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/server/createUiTs.d.ts +7 -0
- package/out/server/createUiTs.js +157 -0
- package/out/server/createUiTs.js.map +1 -0
- package/out/server/entity2LogicNamespace.d.ts +9 -1
- package/out/server/entity2LogicNamespace.js +11 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.d.ts +3 -0
- package/out/server/getExtensionModules.js +18 -0
- package/out/server/getExtensionModules.js.map +1 -0
- package/out/server/getLogics.js +18 -15
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +3 -2
- package/out/server/getMemberIdentifier.js +47 -15
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +4 -1
- package/out/server/getProcesses.js +16 -7
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getValidates.js +1 -1
- package/out/server/getValidates.js.map +1 -1
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +23 -5
- package/out/server/naslServer.js +199 -25
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +15 -1
- package/out/server/process2LogicNamespace.js +30 -3
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +28 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +5 -0
- package/out/service/storage/init.js +60 -52
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCallComponentLogic.js +2 -2
- package/out/templator/genCallComponentLogic.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +3 -3
- 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 +3 -3
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +2 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +8 -12
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +20 -20
- package/out/templator/utils.js +22 -22
- package/out/templator/utils.js.map +1 -1
- package/package.json +3 -1
- package/src/automate/engine/index.js +37 -3
- package/src/automate/engine/utils.js +68 -64
- package/src/common/BaseNode.ts +43 -28
- package/src/concepts/App__.ts +93 -17
- package/src/concepts/Argument__.ts +4 -2
- package/src/concepts/Assignment__.ts +5 -7
- package/src/concepts/Attribute__.ts +1 -0
- package/src/concepts/BinaryExpression__.ts +7 -5
- package/src/concepts/BindAttribute__.ts +9 -4
- package/src/concepts/BindDirective__.ts +4 -2
- package/src/concepts/BindEvent__.ts +6 -4
- package/src/concepts/BooleanLiteral__.ts +3 -1
- package/src/concepts/CallFunction__.ts +195 -11
- package/src/concepts/CallInterface__.ts +4 -2
- package/src/concepts/CallLogic__.ts +211 -12
- package/src/concepts/CallQueryComponent__.ts +2 -1
- package/src/concepts/Comment__.ts +1 -0
- package/src/concepts/CompletionProperty__.ts +1 -0
- package/src/concepts/ConfigGroup__.ts +290 -0
- package/src/concepts/ConfigPropertyValue__.ts +112 -0
- package/src/concepts/ConfigProperty__.ts +306 -0
- package/src/concepts/Configuration__.ts +286 -0
- package/src/concepts/Constant__.ts +3 -1
- package/src/concepts/DataElement__.ts +1 -0
- package/src/concepts/Destination__.ts +7 -5
- package/src/concepts/End__.ts +1 -0
- package/src/concepts/EntityIndex__.ts +19 -0
- package/src/concepts/EntityProperty__.ts +9 -8
- package/src/concepts/Entity__.ts +66 -59
- package/src/concepts/EnumItem__.ts +1 -0
- package/src/concepts/Enum__.ts +32 -12
- package/src/concepts/Event__.ts +2 -1
- package/src/concepts/ForEachStatement__.ts +115 -69
- package/src/concepts/Function__.ts +2 -1
- package/src/concepts/Identifier__.ts +18 -1
- package/src/concepts/IfStatement__.ts +1 -0
- package/src/concepts/InterfaceParam__.ts +2 -1
- package/src/concepts/Interface__.ts +21 -5
- package/src/concepts/JSBlock__.ts +1 -0
- package/src/concepts/LogicItem__.ts +9 -40
- package/src/concepts/Logic__.ts +48 -9
- package/src/concepts/MemberExpression__.ts +14 -17
- package/src/concepts/Module__.ts +158 -139
- package/src/concepts/Namespace__.ts +13 -12
- package/src/concepts/NullLiteral__.ts +3 -1
- package/src/concepts/NumericLiteral__.ts +3 -1
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Point__.ts +1 -0
- package/src/concepts/ProcessComponent__.ts +3 -2
- package/src/concepts/ProcessElement__.ts +102 -107
- package/src/concepts/ProcessOutcome__.ts +1 -0
- package/src/concepts/Process__.ts +12 -4
- package/src/concepts/QueryAggregateExpression__.ts +1 -0
- package/src/concepts/QueryFieldExpression__.ts +2 -1
- package/src/concepts/QueryFromExpression__.ts +1 -0
- package/src/concepts/QueryGroupByExpression__.ts +1 -0
- package/src/concepts/QueryJoinExpression__.ts +2 -1
- package/src/concepts/QueryLimitExpression__.ts +1 -0
- package/src/concepts/QueryOrderByExpression__.ts +1 -0
- package/src/concepts/QuerySelectExpression__.ts +2 -1
- package/src/concepts/Rect__.ts +1 -0
- package/src/concepts/Return__.ts +3 -2
- package/src/concepts/Role__.ts +19 -2
- package/src/concepts/Slot__.ts +1 -0
- package/src/concepts/SqlQueryComponent__.ts +11 -1
- package/src/concepts/Start__.ts +1 -0
- package/src/concepts/StringLiteral__.ts +3 -1
- package/src/concepts/StructureProperty__.ts +2 -1
- package/src/concepts/Structure__.ts +5 -4
- package/src/concepts/SwitchCase__.ts +1 -0
- package/src/concepts/SwitchStatement__.ts +1 -0
- package/src/concepts/Theme__.ts +1 -0
- package/src/concepts/Transactional__.ts +1 -0
- package/src/concepts/TypeAnnotation__.ts +4 -0
- package/src/concepts/TypeParam__.ts +1 -0
- package/src/concepts/UnaryExpression__.ts +6 -3
- package/src/concepts/Unparsed__.ts +3 -1
- package/src/concepts/UseComponent__.ts +1 -0
- package/src/concepts/ValidationRule__.ts +5 -2
- package/src/concepts/Variable__.ts +12 -6
- package/src/concepts/ViewComponent__.ts +6 -5
- package/src/concepts/ViewElement__.ts +109 -80
- package/src/concepts/View__.ts +245 -206
- package/src/concepts/WhileStatement__.ts +1 -0
- package/src/concepts/basics/stdlib/index.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.ui.ts +3 -137
- package/src/concepts/basics/stdlib/nasl.util.ts +21 -5
- package/src/concepts/basics/stdlib/{nasl.validate.ts → nasl.validation.ts} +28 -28
- package/src/concepts/index__.ts +4 -0
- package/src/generator/compileComponent.ts +1 -1
- package/src/generator/genBundleFiles.ts +1 -2
- package/src/generator/genMetaData.ts +111 -0
- package/src/generator/index.ts +1 -0
- package/src/index.ts +2 -2
- package/src/server/createUiTs.ts +153 -0
- package/src/server/entity2LogicNamespace.ts +17 -1
- package/src/server/getExtensionModules.ts +13 -0
- package/src/server/getLogics.ts +19 -18
- package/src/server/getMemberIdentifier.ts +60 -19
- package/src/server/getProcesses.ts +15 -8
- package/src/server/getValidates.ts +1 -1
- package/src/server/index.ts +2 -1
- package/src/server/naslServer.ts +204 -24
- package/src/server/process2LogicNamespace.ts +44 -3
- package/src/server/translator.ts +121 -97
- package/src/service/config/api.js +32 -0
- package/src/service/config/index.js +6 -0
- package/src/service/creator/index.js +2 -2
- package/src/service/logic/checktypeSocket.js +49 -0
- package/src/service/modules/api.js +20 -0
- package/src/service/modules/index.js +6 -0
- package/src/service/storage/init.ts +62 -54
- package/src/templator/genCallComponentLogic.ts +2 -2
- package/src/templator/genCreateBlock.ts +19 -25
- package/src/templator/genCurdEditMultipleKeyBlock.ts +3 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +3 -3
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genListViewBlock.ts +2 -2
- package/src/templator/genSelectBlock.ts +1 -1
- package/src/templator/genUpdateBlock.ts +19 -25
- package/src/templator/utils.ts +25 -153
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import Function from './Function__';
|
|
3
|
+
import { ElementToVueOptions } from './ViewElement__';
|
|
3
4
|
//================================================================================
|
|
4
5
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
5
6
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -8,8 +9,10 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
8
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
9
10
|
|
|
10
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
13
|
import BaseNode from '../common/BaseNode';
|
|
12
14
|
import classMap from '../common/classMap';
|
|
15
|
+
import TypeAnnotation from './TypeAnnotation__';
|
|
13
16
|
import Argument from './Argument__';
|
|
14
17
|
import LogicItem from './LogicItem__';
|
|
15
18
|
|
|
@@ -48,6 +51,12 @@ export class CallFunction extends LogicItem {
|
|
|
48
51
|
@property()
|
|
49
52
|
shortcut: boolean = undefined;
|
|
50
53
|
|
|
54
|
+
/**
|
|
55
|
+
* 类型参数
|
|
56
|
+
*/
|
|
57
|
+
@property('TypeAnnotation')
|
|
58
|
+
typeArguments?: Array<TypeAnnotation> = null;
|
|
59
|
+
|
|
51
60
|
/**
|
|
52
61
|
* 实际参数
|
|
53
62
|
*/
|
|
@@ -76,6 +85,113 @@ export class CallFunction extends LogicItem {
|
|
|
76
85
|
|
|
77
86
|
|
|
78
87
|
|
|
88
|
+
/**
|
|
89
|
+
* 插入类型标注
|
|
90
|
+
* @internal
|
|
91
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
92
|
+
*/
|
|
93
|
+
_insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 插入类型标注
|
|
97
|
+
* @internal
|
|
98
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
99
|
+
*/
|
|
100
|
+
_insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
|
|
101
|
+
|
|
102
|
+
_insertTypeAnnotationAt(options: Partial<TypeAnnotation> | TypeAnnotation, index: number) {
|
|
103
|
+
const typeAnnotationOptions: any = {};
|
|
104
|
+
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
105
|
+
let typeAnnotation: TypeAnnotation;
|
|
106
|
+
if (options instanceof TypeAnnotation) {
|
|
107
|
+
options.delete(); // 同一实例不支持多处存在
|
|
108
|
+
typeAnnotation = options;
|
|
109
|
+
Object.assign(typeAnnotation, relationOptions);
|
|
110
|
+
} else {
|
|
111
|
+
typeAnnotation = TypeAnnotation.from({
|
|
112
|
+
...typeAnnotationOptions,
|
|
113
|
+
...options,
|
|
114
|
+
}, this, 'typeArguments');
|
|
115
|
+
}
|
|
116
|
+
this.typeArguments.splice(index, 0, typeAnnotation);
|
|
117
|
+
return typeAnnotation;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 插入类型标注
|
|
124
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
125
|
+
*/
|
|
126
|
+
insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 插入类型标注
|
|
130
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
131
|
+
*/
|
|
132
|
+
insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
|
|
133
|
+
|
|
134
|
+
insertTypeAnnotationAt(options: Partial<TypeAnnotation> | TypeAnnotation, index: number) {
|
|
135
|
+
const node = this._insertTypeAnnotationAt(options as any, index);
|
|
136
|
+
node.create({
|
|
137
|
+
index,
|
|
138
|
+
parentNode: this,
|
|
139
|
+
parentKey: 'typeArguments',
|
|
140
|
+
});
|
|
141
|
+
return node;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 添加类型标注
|
|
148
|
+
* @internal
|
|
149
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
150
|
+
*/
|
|
151
|
+
_addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 添加类型标注
|
|
155
|
+
* @internal
|
|
156
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
157
|
+
*/
|
|
158
|
+
_addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
|
|
159
|
+
|
|
160
|
+
_addTypeAnnotation(options?: Partial<TypeAnnotation> | TypeAnnotation) {
|
|
161
|
+
const index = this.typeArguments.length;
|
|
162
|
+
return this._insertTypeAnnotationAt(options as any, index);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 添加类型标注
|
|
169
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
170
|
+
*/
|
|
171
|
+
addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 添加类型标注
|
|
175
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
176
|
+
*/
|
|
177
|
+
addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
|
|
178
|
+
|
|
179
|
+
addTypeAnnotation(options?: Partial<TypeAnnotation> | TypeAnnotation) {
|
|
180
|
+
const node = this._addTypeAnnotation(options as any);
|
|
181
|
+
const index = this.typeArguments.length;
|
|
182
|
+
node.create({
|
|
183
|
+
index,
|
|
184
|
+
parentNode: this,
|
|
185
|
+
parentKey: 'typeArguments',
|
|
186
|
+
});
|
|
187
|
+
return node;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
79
195
|
/**
|
|
80
196
|
* 插入实际参数
|
|
81
197
|
* @internal
|
|
@@ -181,6 +297,42 @@ export class CallFunction extends LogicItem {
|
|
|
181
297
|
|
|
182
298
|
|
|
183
299
|
|
|
300
|
+
/**
|
|
301
|
+
* 删除类型标注
|
|
302
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
303
|
+
*/
|
|
304
|
+
removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
|
|
305
|
+
|
|
306
|
+
removeTypeAnnotation(options: TypeAnnotation) {
|
|
307
|
+
let typeAnnotation: TypeAnnotation = options;
|
|
308
|
+
return typeAnnotation.delete();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
__removeTypeAnnotation(typeAnnotation: TypeAnnotation) {
|
|
312
|
+
const parentKey = typeAnnotation.parentKey;
|
|
313
|
+
const params: Params = {
|
|
314
|
+
parentNode: this,
|
|
315
|
+
parentKey,
|
|
316
|
+
index: -1,
|
|
317
|
+
object: null,
|
|
318
|
+
oldObject: typeAnnotation,
|
|
319
|
+
};
|
|
320
|
+
if (parentKey) {
|
|
321
|
+
params.parentKey = parentKey;
|
|
322
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
323
|
+
const index = (this as any)[parentKey].indexOf(typeAnnotation);
|
|
324
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
325
|
+
params.index = index;
|
|
326
|
+
} else if ((this as any)[parentKey] === typeAnnotation) {
|
|
327
|
+
params.index = 0;
|
|
328
|
+
(this as any)[parentKey] = undefined;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return params;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
184
336
|
/**
|
|
185
337
|
* 删除实际参数
|
|
186
338
|
* @param argument 已有的实际参数实例
|
|
@@ -219,11 +371,11 @@ export class CallFunction extends LogicItem {
|
|
|
219
371
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
220
372
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
221
373
|
//================================================================================
|
|
222
|
-
toVue(): string {
|
|
374
|
+
toVue(options?: ElementToVueOptions): string {
|
|
223
375
|
let code = `$utils['${this.calleeName}']`;
|
|
224
376
|
code += '(';
|
|
225
377
|
this.arguments.forEach((arg, index) => {
|
|
226
|
-
code += arg.toVue();
|
|
378
|
+
code += arg.toVue(options);
|
|
227
379
|
if (index !== this.arguments.length - 1)
|
|
228
380
|
code += ', ';
|
|
229
381
|
});
|
|
@@ -256,7 +408,7 @@ export class CallFunction extends LogicItem {
|
|
|
256
408
|
}
|
|
257
409
|
|
|
258
410
|
get calleeKey(): string {
|
|
259
|
-
return `${this.calleeNamespace}
|
|
411
|
+
return this.calleeName ? `${this.calleeNamespace ? this.calleeNamespace + '.' : ''}${this.calleeName}` : '__IDENTIFIER__';
|
|
260
412
|
}
|
|
261
413
|
|
|
262
414
|
_setCallee(func: Function) {
|
|
@@ -279,23 +431,55 @@ export class CallFunction extends LogicItem {
|
|
|
279
431
|
Object.assign(argument, relationOptions);
|
|
280
432
|
return argument;
|
|
281
433
|
});
|
|
434
|
+
let typeArguments = null;
|
|
435
|
+
if(func.typeParams) {
|
|
436
|
+
typeArguments = func.typeParams.map(() => {
|
|
437
|
+
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
438
|
+
const typeArgu = new TypeAnnotation();
|
|
439
|
+
Object.assign(typeArgu, relationOptions);
|
|
440
|
+
return typeArgu;
|
|
441
|
+
})
|
|
442
|
+
}
|
|
282
443
|
this.update({
|
|
283
444
|
calleeNamespace,
|
|
284
445
|
calleeName,
|
|
285
446
|
arguments: params,
|
|
447
|
+
typeArguments
|
|
286
448
|
});
|
|
287
449
|
}
|
|
288
450
|
|
|
289
451
|
@withSourceMap()
|
|
290
452
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
291
|
-
let code =
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
453
|
+
let code = '';
|
|
454
|
+
const calleeKey = this.calleeKey;
|
|
455
|
+
if (calleeKey === 'nasl.util.Convert') {
|
|
456
|
+
// nasl.util.Convert(variable1)<nasl.core.String>();
|
|
457
|
+
// 单独处理
|
|
458
|
+
|
|
459
|
+
code = calleeKey;
|
|
460
|
+
code += '(';
|
|
461
|
+
this.arguments.forEach((arg, index) => {
|
|
462
|
+
code += arg.toEmbeddedTS(shiftState(state, code));
|
|
463
|
+
if (index !== this.arguments.length - 1)
|
|
464
|
+
code += ', ';
|
|
465
|
+
});
|
|
466
|
+
code += ')';
|
|
467
|
+
// 如果有内容
|
|
468
|
+
const typeAnnotation = this.typeArguments[0];
|
|
469
|
+
if (typeAnnotation.typeNamespace && typeAnnotation.typeName) {
|
|
470
|
+
code += `<${typeAnnotation.typeNamespace}.${typeAnnotation.typeName}>()`;
|
|
471
|
+
}
|
|
472
|
+
code += '\n';
|
|
473
|
+
} else {
|
|
474
|
+
code = this.calleeKey;
|
|
475
|
+
code += '(';
|
|
476
|
+
this.arguments.forEach((arg, index) => {
|
|
477
|
+
code += arg.toEmbeddedTS(shiftState(state, code));
|
|
478
|
+
if (index !== this.arguments.length - 1)
|
|
479
|
+
code += ', ';
|
|
480
|
+
});
|
|
481
|
+
code += ')\n';
|
|
482
|
+
}
|
|
299
483
|
return code;
|
|
300
484
|
}
|
|
301
485
|
//================================================================================
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import Interface from './Interface__';
|
|
3
|
+
import { ElementToVueOptions } from './ViewElement__';
|
|
3
4
|
//================================================================================
|
|
4
5
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
5
6
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -8,6 +9,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
8
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
9
10
|
|
|
10
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
13
|
import BaseNode from '../common/BaseNode';
|
|
12
14
|
import classMap from '../common/classMap';
|
|
13
15
|
import Argument from './Argument__';
|
|
@@ -219,11 +221,11 @@ export class CallInterface extends LogicItem {
|
|
|
219
221
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
220
222
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
221
223
|
//================================================================================
|
|
222
|
-
toVue(): string {
|
|
224
|
+
toVue(options?: ElementToVueOptions): string {
|
|
223
225
|
let code = this.calleeName;
|
|
224
226
|
code += '(';
|
|
225
227
|
this.arguments.forEach((arg, index) => {
|
|
226
|
-
code += arg.toVue();
|
|
228
|
+
code += arg.toVue(options);
|
|
227
229
|
if (index !== this.arguments.length - 1)
|
|
228
230
|
code += ', ';
|
|
229
231
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import Logic from './Logic__';
|
|
3
3
|
import Param from './Param__';
|
|
4
|
+
import { ElementToVueOptions } from './ViewElement__';
|
|
4
5
|
//================================================================================
|
|
5
6
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
6
7
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -9,8 +10,10 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
9
10
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
10
11
|
|
|
11
12
|
import * as utils from '../utils';
|
|
13
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
14
|
import BaseNode from '../common/BaseNode';
|
|
13
15
|
import classMap from '../common/classMap';
|
|
16
|
+
import TypeAnnotation from './TypeAnnotation__';
|
|
14
17
|
import Argument from './Argument__';
|
|
15
18
|
import LogicItem from './LogicItem__';
|
|
16
19
|
|
|
@@ -49,12 +52,20 @@ export class CallLogic extends LogicItem {
|
|
|
49
52
|
@property()
|
|
50
53
|
shortcut: boolean = undefined;
|
|
51
54
|
|
|
55
|
+
/**
|
|
56
|
+
* 类型参数
|
|
57
|
+
*/
|
|
58
|
+
@property('TypeAnnotation')
|
|
59
|
+
typeArguments?: Array<TypeAnnotation> = null;
|
|
60
|
+
|
|
52
61
|
/**
|
|
53
62
|
* 实际参数
|
|
54
63
|
*/
|
|
55
64
|
@property('Argument')
|
|
56
65
|
arguments: Array<Argument> = [];
|
|
57
66
|
|
|
67
|
+
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* @param source 需要合并的部分参数
|
|
60
71
|
*/
|
|
@@ -68,6 +79,120 @@ export class CallLogic extends LogicItem {
|
|
|
68
79
|
return super.from(source, parentNode, parentKey) as CallLogic;
|
|
69
80
|
}
|
|
70
81
|
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 插入类型标注
|
|
91
|
+
* @internal
|
|
92
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
93
|
+
*/
|
|
94
|
+
_insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 插入类型标注
|
|
98
|
+
* @internal
|
|
99
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
100
|
+
*/
|
|
101
|
+
_insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
|
|
102
|
+
|
|
103
|
+
_insertTypeAnnotationAt(options: Partial<TypeAnnotation> | TypeAnnotation, index: number) {
|
|
104
|
+
const typeAnnotationOptions: any = {};
|
|
105
|
+
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
106
|
+
let typeAnnotation: TypeAnnotation;
|
|
107
|
+
if (options instanceof TypeAnnotation) {
|
|
108
|
+
options.delete(); // 同一实例不支持多处存在
|
|
109
|
+
typeAnnotation = options;
|
|
110
|
+
Object.assign(typeAnnotation, relationOptions);
|
|
111
|
+
} else {
|
|
112
|
+
typeAnnotation = TypeAnnotation.from({
|
|
113
|
+
...typeAnnotationOptions,
|
|
114
|
+
...options,
|
|
115
|
+
}, this, 'typeArguments');
|
|
116
|
+
}
|
|
117
|
+
this.typeArguments.splice(index, 0, typeAnnotation);
|
|
118
|
+
return typeAnnotation;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 插入类型标注
|
|
125
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
126
|
+
*/
|
|
127
|
+
insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 插入类型标注
|
|
131
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
132
|
+
*/
|
|
133
|
+
insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
|
|
134
|
+
|
|
135
|
+
insertTypeAnnotationAt(options: Partial<TypeAnnotation> | TypeAnnotation, index: number) {
|
|
136
|
+
const node = this._insertTypeAnnotationAt(options as any, index);
|
|
137
|
+
node.create({
|
|
138
|
+
index,
|
|
139
|
+
parentNode: this,
|
|
140
|
+
parentKey: 'typeArguments',
|
|
141
|
+
});
|
|
142
|
+
return node;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 添加类型标注
|
|
149
|
+
* @internal
|
|
150
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
151
|
+
*/
|
|
152
|
+
_addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 添加类型标注
|
|
156
|
+
* @internal
|
|
157
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
158
|
+
*/
|
|
159
|
+
_addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
|
|
160
|
+
|
|
161
|
+
_addTypeAnnotation(options?: Partial<TypeAnnotation> | TypeAnnotation) {
|
|
162
|
+
const index = this.typeArguments.length;
|
|
163
|
+
return this._insertTypeAnnotationAt(options as any, index);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 添加类型标注
|
|
170
|
+
* @param typeAnnotationOptions 类型标注参数
|
|
171
|
+
*/
|
|
172
|
+
addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 添加类型标注
|
|
176
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
177
|
+
*/
|
|
178
|
+
addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
|
|
179
|
+
|
|
180
|
+
addTypeAnnotation(options?: Partial<TypeAnnotation> | TypeAnnotation) {
|
|
181
|
+
const node = this._addTypeAnnotation(options as any);
|
|
182
|
+
const index = this.typeArguments.length;
|
|
183
|
+
node.create({
|
|
184
|
+
index,
|
|
185
|
+
parentNode: this,
|
|
186
|
+
parentKey: 'typeArguments',
|
|
187
|
+
});
|
|
188
|
+
return node;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
71
196
|
/**
|
|
72
197
|
* 插入实际参数
|
|
73
198
|
* @internal
|
|
@@ -100,6 +225,8 @@ export class CallLogic extends LogicItem {
|
|
|
100
225
|
return argument;
|
|
101
226
|
}
|
|
102
227
|
|
|
228
|
+
|
|
229
|
+
|
|
103
230
|
/**
|
|
104
231
|
* 插入实际参数
|
|
105
232
|
* @param argumentOptions 实际参数参数
|
|
@@ -122,6 +249,8 @@ export class CallLogic extends LogicItem {
|
|
|
122
249
|
return node;
|
|
123
250
|
}
|
|
124
251
|
|
|
252
|
+
|
|
253
|
+
|
|
125
254
|
/**
|
|
126
255
|
* 添加实际参数
|
|
127
256
|
* @internal
|
|
@@ -141,6 +270,8 @@ export class CallLogic extends LogicItem {
|
|
|
141
270
|
return this._insertArgumentAt(options as any, index);
|
|
142
271
|
}
|
|
143
272
|
|
|
273
|
+
|
|
274
|
+
|
|
144
275
|
/**
|
|
145
276
|
* 添加实际参数
|
|
146
277
|
* @param argumentOptions 实际参数参数
|
|
@@ -164,6 +295,45 @@ export class CallLogic extends LogicItem {
|
|
|
164
295
|
return node;
|
|
165
296
|
}
|
|
166
297
|
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* 删除类型标注
|
|
303
|
+
* @param typeAnnotation 已有的类型标注实例
|
|
304
|
+
*/
|
|
305
|
+
removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
|
|
306
|
+
|
|
307
|
+
removeTypeAnnotation(options: TypeAnnotation) {
|
|
308
|
+
let typeAnnotation: TypeAnnotation = options;
|
|
309
|
+
return typeAnnotation.delete();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
__removeTypeAnnotation(typeAnnotation: TypeAnnotation) {
|
|
313
|
+
const parentKey = typeAnnotation.parentKey;
|
|
314
|
+
const params: Params = {
|
|
315
|
+
parentNode: this,
|
|
316
|
+
parentKey,
|
|
317
|
+
index: -1,
|
|
318
|
+
object: null,
|
|
319
|
+
oldObject: typeAnnotation,
|
|
320
|
+
};
|
|
321
|
+
if (parentKey) {
|
|
322
|
+
params.parentKey = parentKey;
|
|
323
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
324
|
+
const index = (this as any)[parentKey].indexOf(typeAnnotation);
|
|
325
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
326
|
+
params.index = index;
|
|
327
|
+
} else if ((this as any)[parentKey] === typeAnnotation) {
|
|
328
|
+
params.index = 0;
|
|
329
|
+
(this as any)[parentKey] = undefined;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return params;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
167
337
|
/**
|
|
168
338
|
* 删除实际参数
|
|
169
339
|
* @param argument 已有的实际参数实例
|
|
@@ -171,7 +341,7 @@ export class CallLogic extends LogicItem {
|
|
|
171
341
|
removeArgument(argument: Argument): void;
|
|
172
342
|
|
|
173
343
|
removeArgument(options: Argument) {
|
|
174
|
-
|
|
344
|
+
let argument: Argument = options;
|
|
175
345
|
return argument.delete();
|
|
176
346
|
}
|
|
177
347
|
|
|
@@ -214,15 +384,16 @@ export class CallLogic extends LogicItem {
|
|
|
214
384
|
}
|
|
215
385
|
get calleeKey(): string {
|
|
216
386
|
const tsCalleeNamespace = this.tsCalleeNamespace;
|
|
387
|
+
const calleeName = this.calleeName;
|
|
217
388
|
if (!tsCalleeNamespace) {
|
|
218
|
-
return `logics.${
|
|
389
|
+
return calleeName ? `logics.${calleeName}` : '__IDENTIFIER__';
|
|
219
390
|
}
|
|
220
391
|
// elements单独处理相对路径,和后缀的问题
|
|
221
392
|
if (tsCalleeNamespace.startsWith('elements') && tsCalleeNamespace.endsWith('logics')) {
|
|
222
393
|
const methodName = tsCalleeNamespace.substring(0, tsCalleeNamespace.length - '.logics'.length);
|
|
223
|
-
return '__' + methodName + `.${
|
|
394
|
+
return '__' + methodName + `.${calleeName}`;
|
|
224
395
|
}
|
|
225
|
-
return `${tsCalleeNamespace}.${
|
|
396
|
+
return calleeName ? `${tsCalleeNamespace}.${calleeName}` : '__IDENTIFIER__';
|
|
226
397
|
}
|
|
227
398
|
|
|
228
399
|
/**
|
|
@@ -265,6 +436,12 @@ export class CallLogic extends LogicItem {
|
|
|
265
436
|
keyword: param.name,
|
|
266
437
|
});
|
|
267
438
|
});
|
|
439
|
+
if (logic.typeParams) {
|
|
440
|
+
this.typeArguments = [];
|
|
441
|
+
logic.typeParams.forEach(() => {
|
|
442
|
+
this._addTypeAnnotation({});
|
|
443
|
+
});
|
|
444
|
+
}
|
|
268
445
|
}
|
|
269
446
|
|
|
270
447
|
setCallee(logic: Logic) {
|
|
@@ -278,10 +455,20 @@ export class CallLogic extends LogicItem {
|
|
|
278
455
|
Object.assign(argument, relationOptions);
|
|
279
456
|
return argument;
|
|
280
457
|
});
|
|
458
|
+
let typeArguments = null;
|
|
459
|
+
if (logic.typeParams) {
|
|
460
|
+
typeArguments = logic.typeParams.map(() => {
|
|
461
|
+
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
462
|
+
const typeArgu = new TypeAnnotation();
|
|
463
|
+
Object.assign(typeArgu, relationOptions);
|
|
464
|
+
return typeArgu;
|
|
465
|
+
});
|
|
466
|
+
}
|
|
281
467
|
this.update({
|
|
282
468
|
calleeNamespace,
|
|
283
469
|
calleeName,
|
|
284
470
|
arguments: params,
|
|
471
|
+
typeArguments,
|
|
285
472
|
});
|
|
286
473
|
}
|
|
287
474
|
|
|
@@ -330,11 +517,11 @@ export class CallLogic extends LogicItem {
|
|
|
330
517
|
});
|
|
331
518
|
}
|
|
332
519
|
|
|
333
|
-
toVue(): string {
|
|
520
|
+
toVue(options?: ElementToVueOptions): string {
|
|
334
521
|
let code = this.calleeName;
|
|
335
522
|
code += '(';
|
|
336
523
|
this.arguments.forEach((arg, index) => {
|
|
337
|
-
code += arg.toVue();
|
|
524
|
+
code += arg.toVue(options);
|
|
338
525
|
if (index !== this.arguments.length - 1)
|
|
339
526
|
code += ', ';
|
|
340
527
|
});
|
|
@@ -357,7 +544,11 @@ export class CallLogic extends LogicItem {
|
|
|
357
544
|
|
|
358
545
|
toJS(state?: TranslatorState): string {
|
|
359
546
|
let code = 'await ';
|
|
547
|
+
// 页面逻辑
|
|
360
548
|
let isViewLogic = true;
|
|
549
|
+
// 组件逻辑
|
|
550
|
+
let isComponentLogic = false;
|
|
551
|
+
let componentName = '';
|
|
361
552
|
const calleeNamespace = this.calleeNamespace;
|
|
362
553
|
// calleeNamespace不存在,一定是页面逻辑
|
|
363
554
|
if (calleeNamespace) {
|
|
@@ -368,6 +559,9 @@ export class CallLogic extends LogicItem {
|
|
|
368
559
|
if (!keywordViews) {
|
|
369
560
|
isViewLogic = false;
|
|
370
561
|
}
|
|
562
|
+
} else if (start === 'elements' && namespaceArr.length === 2 && namespaceArr[1] === 'logics') {
|
|
563
|
+
isComponentLogic = true;
|
|
564
|
+
componentName = namespaceArr[0];
|
|
371
565
|
}
|
|
372
566
|
}
|
|
373
567
|
// 全局逻辑
|
|
@@ -383,10 +577,13 @@ export class CallLogic extends LogicItem {
|
|
|
383
577
|
const namespaceArr = calleeNamespace.split('.');
|
|
384
578
|
// 去掉app
|
|
385
579
|
namespaceArr.shift();
|
|
386
|
-
const keywordEntities = namespaceArr
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
580
|
+
const keywordEntities = namespaceArr
|
|
581
|
+
.map((namespaceItem, index) => ({
|
|
582
|
+
key: namespaceItem,
|
|
583
|
+
index,
|
|
584
|
+
}))
|
|
585
|
+
.filter((namespaceItem, index) => index % 2 === 0)
|
|
586
|
+
.find((namespaceItem) => namespaceItem.key === 'entities');
|
|
390
587
|
const entityName = namespaceArr[keywordEntities?.index + 1];
|
|
391
588
|
|
|
392
589
|
if (entityName) {
|
|
@@ -429,7 +626,9 @@ export class CallLogic extends LogicItem {
|
|
|
429
626
|
}
|
|
430
627
|
code += '\n})';
|
|
431
628
|
} else {
|
|
432
|
-
if (
|
|
629
|
+
if (isComponentLogic) {
|
|
630
|
+
code += `this.$refs.${componentName}.${this.calleeName}`;
|
|
631
|
+
} else if (calleeNamespace === 'nasl.ui' || calleeNamespace === 'nasl.util') {
|
|
433
632
|
switch (this.calleeName) {
|
|
434
633
|
case 'showMessage':
|
|
435
634
|
code += `this.$toast.show`;
|
|
@@ -478,7 +677,7 @@ export class CallLogic extends LogicItem {
|
|
|
478
677
|
//================================================================================
|
|
479
678
|
}
|
|
480
679
|
|
|
481
|
-
classMap
|
|
680
|
+
classMap['CallLogic'] = CallLogic;
|
|
482
681
|
export default CallLogic;
|
|
483
682
|
//================================================================================
|
|
484
683
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -12,6 +12,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
12
12
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
13
13
|
|
|
14
14
|
import * as utils from '../utils';
|
|
15
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
15
16
|
import BaseNode from '../common/BaseNode';
|
|
16
17
|
import classMap from '../common/classMap';
|
|
17
18
|
import TypeAnnotation from './TypeAnnotation__';
|
|
@@ -198,7 +199,7 @@ export class CallQueryComponent extends LogicItem {
|
|
|
198
199
|
|
|
199
200
|
getQueryGroupByExpressionExistingNames(excludedList: Array<QueryGroupByExpression> = []) {
|
|
200
201
|
const excludedSet = new Set(excludedList);
|
|
201
|
-
return this.groupBy.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
202
|
+
return (this.groupBy || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
202
203
|
}
|
|
203
204
|
getQueryGroupByExpressionUniqueName(name = 'queryGroupByExpression1') {
|
|
204
205
|
return utils.unique(name, this.getQueryGroupByExpressionExistingNames());
|
|
@@ -7,6 +7,7 @@ import { EventPayload, Params } from '../common/EventEmitter';
|
|
|
7
7
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
8
8
|
|
|
9
9
|
import * as utils from '../utils';
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
11
|
import BaseNode from '../common/BaseNode';
|
|
11
12
|
import classMap from '../common/classMap';
|
|
12
13
|
import LogicItem from './LogicItem__';
|