@lcap/nasl 3.2.0-beta.3 → 3.3.0-alpha
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/utils.js +4 -0
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/upgrader/2.20.js +1 -1
- package/out/automate/upgrader/2.20.js.map +1 -1
- package/out/bak/translator.js +11 -15
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/generator/AfterStartNode.js +3 -1
- package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
- package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
- package/out/breakpoint/generator/BreakpointNode.d.ts +1 -0
- package/out/breakpoint/generator/BreakpointNode.js +48 -15
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
- package/out/breakpoint/generator/CallbackNode.d.ts +4 -0
- package/out/breakpoint/generator/CallbackNode.js +22 -0
- package/out/breakpoint/generator/CallbackNode.js.map +1 -0
- package/out/breakpoint/generator/FragmentNode.d.ts +4 -0
- package/out/breakpoint/generator/FragmentNode.js +18 -0
- package/out/breakpoint/generator/FragmentNode.js.map +1 -0
- package/out/breakpoint/generator/index.js +25 -4
- package/out/breakpoint/generator/index.js.map +1 -1
- package/out/breakpoint/shared/constants.d.ts +3 -0
- package/out/breakpoint/shared/constants.js +6 -1
- package/out/breakpoint/shared/constants.js.map +1 -1
- package/out/breakpoint/shared/operations.js.map +1 -1
- package/out/breakpoint/shared/socket.d.ts +1 -1
- package/out/breakpoint/shared/socket.js +36 -7
- package/out/breakpoint/shared/socket.js.map +1 -1
- package/out/breakpoint/shared/utils.d.ts +2 -0
- package/out/breakpoint/shared/utils.js +15 -2
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/breakpoint/store/core.d.ts +48 -2
- package/out/breakpoint/store/core.js +58 -32
- package/out/breakpoint/store/core.js.map +1 -1
- package/out/breakpoint/store/dock.js +1 -1
- package/out/breakpoint/store/dock.js.map +1 -1
- package/out/common/BaseNode.d.ts +2 -2
- package/out/common/BaseNode.js +110 -53
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +13 -2
- package/out/common/Command.js +37 -9
- package/out/common/Command.js.map +1 -1
- package/out/common/EventEmitter.js.map +1 -1
- package/out/common/Messager.d.ts +3 -3
- package/out/common/Messager.js +6 -7
- package/out/common/Messager.js.map +1 -1
- package/out/common/asyncFuncMap.js.map +1 -1
- package/out/concepts/Abort__.js +6 -5
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +4 -3
- package/out/concepts/Anchor__.js +24 -7
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +22 -21
- package/out/concepts/AnonymousFunction__.js +48 -22
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +421 -247
- package/out/concepts/App__.js +288 -54
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +4 -3
- package/out/concepts/Argument__.js +42 -11
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +45 -45
- package/out/concepts/Assignee__.js +15 -15
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +6 -5
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +7 -6
- package/out/concepts/Assignment__.js +41 -23
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +3 -3
- package/out/concepts/Attribute__.js +8 -7
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthInterface__.js +4 -3
- package/out/concepts/AuthInterface__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +15 -15
- package/out/concepts/AuthLogicForCallInterface__.js +46 -27
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js +27 -13
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +5 -5
- package/out/concepts/BackendVariable__.js +23 -26
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +18 -18
- package/out/concepts/Backend__.js +13 -13
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +34 -33
- package/out/concepts/BatchAssignment__.js +83 -43
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +7 -6
- package/out/concepts/BinaryExpression__.js +60 -24
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +37 -37
- package/out/concepts/BindAttribute__.js +102 -58
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +13 -13
- package/out/concepts/BindDirective__.js +23 -21
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +28 -28
- package/out/concepts/BindEvent__.js +150 -57
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +14 -15
- package/out/concepts/BindStyle__.js +16 -16
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +1 -0
- package/out/concepts/BooleanLiteral__.js +12 -5
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +15 -15
- package/out/concepts/CallAuthInterface__.js +23 -22
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +11 -9
- package/out/concepts/CallConnector__.js +79 -36
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +17 -16
- package/out/concepts/CallFunction__.js +95 -63
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +9 -8
- package/out/concepts/CallInterface__.js +109 -80
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +24 -20
- package/out/concepts/CallLogic__.js +209 -162
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +51 -51
- package/out/concepts/CallQueryComponent__.js +66 -63
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +1 -0
- package/out/concepts/Comment__.js +13 -6
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.d.ts +3 -3
- package/out/concepts/CompletionProperty__.js +16 -8
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +15 -15
- package/out/concepts/ConfigGroup__.js +9 -9
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js +4 -3
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +15 -15
- package/out/concepts/ConfigProperty__.js +10 -10
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +15 -15
- package/out/concepts/Configuration__.js +9 -9
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +166 -0
- package/out/concepts/Connection__.js +332 -0
- package/out/concepts/Connection__.js.map +1 -0
- package/out/concepts/ConnectorTrigger__.js +4 -3
- package/out/concepts/ConnectorTrigger__.js.map +1 -1
- package/out/concepts/Connector__.d.ts +66 -66
- package/out/concepts/Connector__.js +16 -15
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +3 -3
- package/out/concepts/Constant__.js +8 -7
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.d.ts +3 -3
- package/out/concepts/DataElement__.js +6 -5
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +15 -15
- package/out/concepts/DataSource__.js +55 -39
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.js +4 -3
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +12 -11
- package/out/concepts/Destination__.js +93 -36
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +15 -13
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js +6 -5
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +8 -7
- package/out/concepts/EntityProperty__.js +39 -24
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +31 -30
- package/out/concepts/Entity__.js +40 -16
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +1 -0
- package/out/concepts/EnumItem__.js +12 -5
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +9 -8
- package/out/concepts/Enum__.js +24 -11
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.d.ts +15 -15
- package/out/concepts/Event__.js +6 -5
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +6 -6
- package/out/concepts/ExternalDestination__.js +12 -11
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +25 -24
- package/out/concepts/ForEachStatement__.js +101 -36
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +30 -30
- package/out/concepts/FrontendLibrary__.js +12 -13
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendVariable__.js +4 -3
- package/out/concepts/FrontendVariable__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +64 -65
- package/out/concepts/Frontend__.js +23 -27
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +64 -63
- package/out/concepts/Function__.js +49 -21
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +37 -31
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +20 -19
- package/out/concepts/IfStatement__.js +64 -34
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +3 -3
- package/out/concepts/Integration__.js +8 -7
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +3 -3
- package/out/concepts/InterfaceParam__.js +7 -6
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +33 -33
- package/out/concepts/Interface__.js +19 -20
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +12 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +10 -9
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +6 -0
- package/out/concepts/LogicItem__.js +14 -5
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +80 -79
- package/out/concepts/Logic__.js +204 -58
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +39 -38
- package/out/concepts/MatchCase__.js +122 -37
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +13 -11
- package/out/concepts/Match__.js +128 -60
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +7 -6
- package/out/concepts/MemberExpression__.js +52 -22
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.js +4 -3
- package/out/concepts/MicroApp__.js.map +1 -1
- package/out/concepts/Module__.d.ts +242 -154
- package/out/concepts/Module__.js +139 -33
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.d.ts +15 -15
- package/out/concepts/MsgTriggerEvent__.js +6 -5
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.d.ts +23 -15
- package/out/concepts/MsgTriggerLauncher__.js +24 -5
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +180 -180
- package/out/concepts/Namespace__.js +33 -34
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +49 -48
- package/out/concepts/NewComposite__.js +164 -49
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +19 -18
- package/out/concepts/NewList__.js +29 -12
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +34 -33
- package/out/concepts/NewMap__.js +81 -72
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js +6 -5
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +6 -5
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +4 -3
- package/out/concepts/NumericLiteral__.js +15 -8
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +4 -3
- package/out/concepts/OqlQueryComponent__.js +25 -16
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +79 -79
- package/out/concepts/OverriddenLogic__.js +79 -58
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +6 -5
- package/out/concepts/Param__.js +66 -29
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +4 -3
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.d.ts +30 -30
- package/out/concepts/ProcessComponent__.js +8 -7
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +96 -96
- package/out/concepts/ProcessElement__.js +34 -34
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +6 -5
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +6 -5
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +75 -75
- package/out/concepts/Process__.js +33 -30
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +3 -3
- package/out/concepts/QueryAggregateExpression__.js +8 -7
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +7 -6
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +8 -8
- package/out/concepts/QueryFromExpression__.js +8 -7
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +3 -3
- package/out/concepts/QueryGroupByExpression__.js +9 -10
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +23 -23
- package/out/concepts/QueryJoinExpression__.js +11 -10
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +6 -6
- package/out/concepts/QueryLimitExpression__.js +9 -8
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +6 -6
- package/out/concepts/QueryOrderByExpression__.js +9 -8
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +30 -30
- package/out/concepts/QuerySelectExpression__.js +9 -8
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +4 -3
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +4 -3
- package/out/concepts/Return__.js +37 -18
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +9 -9
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +18 -18
- package/out/concepts/SelectMembers__.js +10 -9
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +3 -3
- package/out/concepts/Slot__.js +6 -5
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +4 -3
- package/out/concepts/SqlQueryComponent__.js +21 -12
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +6 -5
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +16 -15
- package/out/concepts/StringInterpolation__.js +37 -14
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -0
- package/out/concepts/StringLiteral__.js +13 -8
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +4 -3
- package/out/concepts/StructureProperty__.js +22 -9
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +31 -30
- package/out/concepts/Structure__.js +27 -15
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +12 -11
- package/out/concepts/SwitchCase__.js +69 -31
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +9 -8
- package/out/concepts/SwitchStatement__.js +27 -7
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js +4 -3
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js +4 -3
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TriggerEvent__.d.ts +15 -15
- package/out/concepts/TriggerEvent__.js +6 -5
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +15 -10
- package/out/concepts/TriggerLauncher__.js +54 -32
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +28 -27
- package/out/concepts/TypeAnnotation__.js +144 -124
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js +12 -5
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +4 -3
- package/out/concepts/UnaryExpression__.js +31 -20
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +1 -0
- package/out/concepts/Unparsed__.js +12 -5
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +4 -3
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +14 -14
- package/out/concepts/ValidationRule__.js +19 -17
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +4 -3
- package/out/concepts/Variable__.js +39 -23
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.js +4 -3
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +90 -90
- package/out/concepts/ViewComponent__.js +16 -15
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +92 -86
- package/out/concepts/ViewElement__.js +258 -200
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +92 -92
- package/out/concepts/View__.js +173 -63
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +12 -11
- package/out/concepts/WhileStatement__.js +46 -23
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +17 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +36 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.event.js +23 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.ui.js +45 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +6 -22
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +2 -1
- package/out/concepts/index__.js +2 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -1
- package/out/decorators/index.d.ts +1 -1
- package/out/decorators/index.js +20 -7
- package/out/decorators/index.js.map +1 -1
- package/out/decorators/promise.d.ts +7 -0
- package/out/decorators/promise.js +28 -0
- package/out/decorators/promise.js.map +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/enums/LEVEL_NAME_MAP.js.map +1 -1
- package/out/generator/compileComponent.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +4 -1
- package/out/generator/genBundleFiles.js +15 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genHash.js.map +1 -1
- package/out/generator/genMetaData.js +12 -8
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.js +33 -35
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/microApp.js +2 -1
- package/out/generator/microApp.js.map +1 -1
- package/out/generator/permission.js +31 -30
- package/out/generator/permission.js.map +1 -1
- package/out/generator/styleReplacer.js +4 -7
- package/out/generator/styleReplacer.js.map +1 -1
- package/out/index.d.ts +0 -2
- package/out/index.js +0 -3
- package/out/index.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/manager/diagnostic.js.map +1 -1
- package/out/manager/stepRecorder.js +13 -9
- package/out/manager/stepRecorder.js.map +1 -1
- package/out/natural/RequirementAnalyzer.d.ts +22 -0
- package/out/natural/RequirementAnalyzer.js +196 -0
- package/out/natural/RequirementAnalyzer.js.map +1 -0
- package/out/natural/RequirementExecutor.d.ts +51 -0
- package/out/natural/RequirementExecutor.js +692 -0
- package/out/natural/RequirementExecutor.js.map +1 -0
- package/out/natural/componentData.d.ts +31 -0
- package/out/natural/componentData.js +85 -0
- package/out/natural/componentData.js.map +1 -0
- package/out/natural/genNaturalTS.d.ts +3 -0
- package/out/natural/genNaturalTS.js +76 -0
- package/out/natural/genNaturalTS.js.map +1 -0
- package/out/natural/index.d.ts +4 -0
- package/out/natural/index.js +21 -0
- package/out/natural/index.js.map +1 -0
- package/out/natural/knowledgeMap.d.ts +4 -0
- package/out/natural/knowledgeMap.js +40 -0
- package/out/natural/knowledgeMap.js.map +1 -0
- package/out/natural/naslStdlibMap.d.ts +2 -0
- package/out/natural/naslStdlibMap.js +26 -0
- package/out/natural/naslStdlibMap.js.map +1 -0
- package/out/natural/transformTSCode.d.ts +7 -0
- package/out/natural/transformTSCode.js +760 -0
- package/out/natural/transformTSCode.js.map +1 -0
- package/out/sentry/index.d.ts +2 -1
- package/out/sentry/index.js.map +1 -1
- package/out/server/createUiTs.js +28 -16
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -22
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/event.d.ts +12 -0
- package/out/server/event.js +52 -28
- package/out/server/event.js.map +1 -1
- package/out/server/extendBaseNode.js +55 -70
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +46 -50
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getConnector.d.ts +3 -3
- package/out/server/getConnector.js +7 -8
- package/out/server/getConnector.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -2
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getFunctions.js.map +1 -1
- package/out/server/getInterfaces.js.map +1 -1
- package/out/server/getLogging.js.map +1 -1
- package/out/server/getLogics.d.ts +1 -1
- package/out/server/getLogics.js +55 -8
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +13 -10
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcessComponents.js.map +1 -1
- package/out/server/getProcesses.js +21 -29
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getScope.js.map +1 -1
- package/out/server/getValidates.js.map +1 -1
- package/out/server/index.js +0 -1
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +99 -94
- package/out/server/naslServer.js +490 -469
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +6 -2
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +1 -1
- package/out/server/translator.js +52 -47
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +15 -1
- package/out/service/storage/init.js +65 -56
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCallComponentLogic.js +1 -2
- package/out/templator/genCallComponentLogic.js.map +1 -1
- package/out/templator/genCreateBlock.js +14 -9
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +23 -14
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +26 -30
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.d.ts +1 -1
- package/out/templator/genEditTableBlock.js +14 -19
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +1 -1
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +2 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +2 -2
- package/out/templator/genGridViewBlock.js +18 -28
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +2 -2
- package/out/templator/genListViewBlock.js +9 -16
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +22 -15
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +2 -2
- package/out/templator/genSelectBlock.js +21 -48
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +11 -17
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +13 -8
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/index.d.ts +4 -2
- package/out/templator/index.js +2 -2
- package/out/templator/index.js.map +1 -1
- package/out/templator/utils.d.ts +9 -2
- package/out/templator/utils.js +22 -22
- package/out/templator/utils.js.map +1 -1
- package/out/translator/index.js +27 -28
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +2 -1
- package/out/utils/index.js +8 -14
- package/out/utils/index.js.map +1 -1
- package/out/utils/logger.js.map +1 -1
- package/out/utils/sortTsString.js +3 -1
- package/out/utils/sortTsString.js.map +1 -1
- package/out/utils/string.js +8 -11
- package/out/utils/string.js.map +1 -1
- package/out/utils/time-slicing.d.ts +41 -0
- package/out/utils/time-slicing.js +81 -0
- package/out/utils/time-slicing.js.map +1 -0
- package/out/utils/traverse.js +4 -6
- package/out/utils/traverse.js.map +1 -1
- package/package.json +22 -20
- package/sandbox/stdlib/nasl.auth.ts +49 -46
- package/sandbox/stdlib/nasl.browser.ts +1 -0
- package/sandbox/stdlib/nasl.event.ts +4 -0
- package/sandbox/stdlib/nasl.http.ts +29 -31
- package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
- package/sandbox/stdlib/nasl.ui.ts +11 -0
- package/sandbox-natural/stdlib/nasl.core.ts +36 -0
- package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
- package/sandbox-natural/stdlib/nasl.ui.ts +56 -0
- package/sandbox-natural/stdlib/nasl.util.ts +26 -0
- package/sandbox-natural/tsconfig.json +12 -0
- package/src/automate/engine/utils.js +3 -0
- package/src/automate/upgrader/2.20.js +1 -1
- package/src/bak/translator.js +92 -99
- package/src/breakpoint/generator/AfterStartNode.ts +19 -17
- package/src/breakpoint/generator/BeforeEndNode.ts +17 -17
- package/src/breakpoint/generator/BreakpointNode.ts +243 -195
- package/src/breakpoint/generator/CallbackNode.ts +20 -0
- package/src/breakpoint/generator/FragmentNode.ts +14 -0
- package/src/breakpoint/generator/index.ts +107 -80
- package/src/breakpoint/shared/constants.ts +59 -53
- package/src/breakpoint/shared/operations.ts +6 -6
- package/src/breakpoint/shared/socket.ts +277 -223
- package/src/breakpoint/shared/utils.ts +166 -146
- package/src/breakpoint/store/core.ts +326 -297
- package/src/breakpoint/store/dock.ts +103 -103
- package/src/breakpoint/types/index.d.ts +11 -11
- package/src/common/BaseNode.ts +1103 -1020
- package/src/common/Command.ts +46 -16
- package/src/common/ComponentAPI.ts +72 -72
- package/src/common/EventEmitter.ts +80 -76
- package/src/common/Messager.ts +223 -224
- package/src/common/asyncFuncMap.ts +12 -12
- package/src/concepts/Abort__.ts +53 -60
- package/src/concepts/Anchor__.ts +158 -149
- package/src/concepts/AnonymousFunction__.ts +584 -551
- package/src/concepts/App__.ts +4278 -3669
- package/src/concepts/Argument__.ts +234 -210
- package/src/concepts/Assignee__.ts +680 -656
- package/src/concepts/AssignmentLine__.ts +80 -84
- package/src/concepts/Assignment__.ts +276 -264
- package/src/concepts/Attribute__.ts +183 -184
- package/src/concepts/AuthInterface__.ts +61 -63
- package/src/concepts/AuthLogicForCallInterface__.ts +540 -511
- package/src/concepts/AuthLogic__.ts +210 -194
- package/src/concepts/BackendVariable__.ts +414 -415
- package/src/concepts/Backend__.ts +317 -303
- package/src/concepts/BatchAssignment__.ts +987 -939
- package/src/concepts/BinaryExpression__.ts +370 -341
- package/src/concepts/BindAttribute__.ts +1056 -1011
- package/src/concepts/BindDirective__.ts +540 -542
- package/src/concepts/BindEvent__.ts +992 -866
- package/src/concepts/BindStyle__.ts +442 -451
- package/src/concepts/BooleanLiteral__.ts +89 -90
- package/src/concepts/CallAuthInterface__.ts +458 -433
- package/src/concepts/CallConnector__.ts +209 -164
- package/src/concepts/CallFunction__.ts +600 -600
- package/src/concepts/CallInterface__.ts +752 -725
- package/src/concepts/CallLogic__.ts +1328 -1236
- package/src/concepts/CallQueryComponent__.ts +1580 -1501
- package/src/concepts/Comment__.ts +69 -68
- package/src/concepts/CompletionProperty__.ts +250 -250
- package/src/concepts/ConfigGroup__.ts +312 -296
- package/src/concepts/ConfigPropertyValue__.ts +81 -82
- package/src/concepts/ConfigProperty__.ts +374 -357
- package/src/concepts/Configuration__.ts +288 -276
- package/src/concepts/Connection__.ts +426 -0
- package/src/concepts/ConnectorTrigger__.ts +146 -142
- package/src/concepts/Connector__.ts +1090 -1048
- package/src/concepts/Constant__.ts +226 -219
- package/src/concepts/DataElement__.ts +108 -115
- package/src/concepts/DataSource__.ts +508 -472
- package/src/concepts/DatabaseTypeAnnotation__.ts +53 -59
- package/src/concepts/Destination__.ts +808 -746
- package/src/concepts/End__.ts +85 -89
- package/src/concepts/EntityIndex__.ts +206 -202
- package/src/concepts/EntityProperty__.ts +825 -791
- package/src/concepts/Entity__.ts +921 -864
- package/src/concepts/EnumItem__.ts +133 -125
- package/src/concepts/Enum__.ts +347 -337
- package/src/concepts/Event__.ts +305 -292
- package/src/concepts/ExternalDestination__.ts +269 -280
- package/src/concepts/ForEachStatement__.ts +583 -531
- package/src/concepts/FrontendLibrary__.ts +507 -485
- package/src/concepts/FrontendVariable__.ts +44 -49
- package/src/concepts/Frontend__.ts +1239 -1187
- package/src/concepts/Function__.ts +1110 -1045
- package/src/concepts/Identifier__.ts +276 -272
- package/src/concepts/IfStatement__.ts +467 -436
- package/src/concepts/Integration__.ts +136 -137
- package/src/concepts/InterfaceParam__.ts +239 -238
- package/src/concepts/Interface__.ts +969 -948
- package/src/concepts/JSBlock__.ts +83 -83
- package/src/concepts/JavaLogic__.ts +101 -106
- package/src/concepts/LogicItem__.ts +307 -237
- package/src/concepts/Logic__.ts +2301 -2088
- package/src/concepts/MatchCase__.ts +886 -779
- package/src/concepts/Match__.ts +728 -659
- package/src/concepts/MemberExpression__.ts +330 -311
- package/src/concepts/MicroApp__.ts +91 -97
- package/src/concepts/Module__.ts +2590 -2275
- package/src/concepts/MsgTriggerEvent__.ts +297 -281
- package/src/concepts/MsgTriggerLauncher__.ts +286 -256
- package/src/concepts/Namespace__.ts +2579 -2466
- package/src/concepts/NewComposite__.ts +1487 -1350
- package/src/concepts/NewList__.ts +464 -450
- package/src/concepts/NewMap__.ts +691 -674
- package/src/concepts/New__.ts +42 -49
- package/src/concepts/NullLiteral__.ts +66 -72
- package/src/concepts/NumericLiteral__.ts +169 -169
- package/src/concepts/OqlQueryComponent__.ts +282 -279
- package/src/concepts/OverriddenLogic__.ts +2142 -2097
- package/src/concepts/Param__.ts +500 -442
- package/src/concepts/Point__.ts +53 -59
- package/src/concepts/ProcessComponent__.ts +497 -475
- package/src/concepts/ProcessElement__.ts +1852 -1780
- package/src/concepts/ProcessOutcome__.ts +59 -64
- package/src/concepts/ProcessOutcomes__.ts +59 -64
- package/src/concepts/Process__.ts +1491 -1428
- package/src/concepts/QueryAggregateExpression__.ts +135 -142
- package/src/concepts/QueryFieldExpression__.ts +138 -142
- package/src/concepts/QueryFromExpression__.ts +246 -254
- package/src/concepts/QueryGroupByExpression__.ts +130 -136
- package/src/concepts/QueryJoinExpression__.ts +441 -438
- package/src/concepts/QueryLimitExpression__.ts +159 -166
- package/src/concepts/QueryOrderByExpression__.ts +173 -180
- package/src/concepts/QuerySelectExpression__.ts +464 -439
- package/src/concepts/Rect__.ts +73 -79
- package/src/concepts/Return__.ts +366 -345
- package/src/concepts/Role__.ts +146 -147
- package/src/concepts/SelectMembers__.ts +358 -350
- package/src/concepts/Slot__.ts +152 -153
- package/src/concepts/SqlQueryComponent__.ts +230 -228
- package/src/concepts/Start__.ts +45 -52
- package/src/concepts/StringInterpolation__.ts +323 -296
- package/src/concepts/StringLiteral__.ts +113 -115
- package/src/concepts/StructureProperty__.ts +306 -295
- package/src/concepts/Structure__.ts +615 -578
- package/src/concepts/SwitchCase__.ts +326 -290
- package/src/concepts/SwitchStatement__.ts +236 -229
- package/src/concepts/Theme__.ts +64 -68
- package/src/concepts/Transactional__.ts +159 -153
- package/src/concepts/TriggerEvent__.ts +285 -274
- package/src/concepts/TriggerLauncher__.ts +232 -196
- package/src/concepts/TypeAnnotation__.ts +1049 -1011
- package/src/concepts/TypeParam__.ts +48 -50
- package/src/concepts/UnaryExpression__.ts +163 -153
- package/src/concepts/Unparsed__.ts +81 -82
- package/src/concepts/UseComponent__.ts +53 -59
- package/src/concepts/ValidationRule__.ts +524 -544
- package/src/concepts/Variable__.ts +419 -397
- package/src/concepts/ViewBlock__.ts +58 -64
- package/src/concepts/ViewComponent__.ts +1323 -1261
- package/src/concepts/ViewElement__.ts +2537 -2351
- package/src/concepts/View__.ts +2461 -2245
- package/src/concepts/WhileStatement__.ts +293 -272
- package/src/concepts/basics/stdlib/index.ts +17 -1
- package/src/concepts/basics/stdlib/nasl.browser.ts +36 -0
- package/src/concepts/basics/stdlib/nasl.event.ts +18 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +45 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +6 -22
- package/src/concepts/index__.ts +2 -1
- package/src/concepts/types__.ts +123 -121
- package/src/decorators/index.ts +75 -77
- package/src/decorators/promise.ts +28 -0
- package/src/enums/KEYWORDS.ts +1228 -1228
- package/src/enums/LEVEL_NAME_MAP.ts +24 -24
- package/src/generator/compileComponent.ts +10 -10
- package/src/generator/genBundleFiles.ts +300 -291
- package/src/generator/genHash.ts +2 -2
- package/src/generator/genMetaData.ts +280 -261
- package/src/generator/genReleaseBody.ts +312 -291
- package/src/generator/icestark.ts +1 -1
- package/src/generator/microApp.ts +17 -20
- package/src/generator/permission.ts +241 -232
- package/src/generator/qiankun.ts +1 -1
- package/src/generator/styleReplacer.ts +28 -31
- package/src/index.ts +0 -3
- package/src/manager/diagnostic.ts +84 -82
- package/src/manager/stepRecorder.ts +106 -94
- package/src/natural/RequirementAnalyzer.ts +208 -0
- package/src/natural/RequirementExecutor.ts +685 -0
- package/src/natural/componentData.ts +81 -0
- package/src/natural/genNaturalTS.ts +77 -0
- package/src/natural/index.ts +4 -0
- package/src/natural/knowledgeMap.ts +39 -0
- package/src/natural/naslStdlibMap.ts +24 -0
- package/src/natural/transformTSCode.ts +692 -0
- package/src/sentry/index.ts +109 -104
- package/src/server/createUiTs.ts +190 -184
- package/src/server/entity2LogicNamespace.ts +379 -359
- package/src/server/event.js +145 -121
- package/src/server/extendBaseNode.ts +461 -456
- package/src/server/formatTsUtils.ts +712 -713
- package/src/server/getConnector.ts +33 -33
- package/src/server/getExtensionModules.ts +23 -22
- package/src/server/getFunctions.ts +6 -6
- package/src/server/getInterfaces.ts +38 -37
- package/src/server/getLogging.ts +1 -1
- package/src/server/getLogics.ts +391 -312
- package/src/server/getMemberIdentifier.ts +286 -281
- package/src/server/getProcessComponents.ts +2 -2
- package/src/server/getProcesses.ts +548 -534
- package/src/server/getScope.ts +51 -51
- package/src/server/getValidates.ts +3 -3
- package/src/server/index.ts +29 -30
- package/src/server/naslServer.ts +4303 -4222
- package/src/server/naslStdlibMap.ts +43 -39
- package/src/server/process2LogicNamespace.ts +97 -97
- package/src/server/translator.ts +740 -746
- package/src/service/storage/init.ts +761 -728
- package/src/templator/genCallComponentLogic.ts +14 -15
- package/src/templator/genCreateBlock.ts +257 -229
- package/src/templator/genCurdEditMultipleKeyBlock.ts +333 -317
- package/src/templator/genCurdMultipleKeyBlock.ts +503 -475
- package/src/templator/genEditTableBlock.ts +194 -187
- package/src/templator/genEnumSelectBlock.ts +13 -7
- package/src/templator/genGetBlock.ts +57 -55
- package/src/templator/genGridViewBlock.ts +195 -211
- package/src/templator/genListViewBlock.ts +62 -72
- package/src/templator/genQueryComponent.ts +337 -287
- package/src/templator/genSelectBlock.ts +283 -297
- package/src/templator/genTableBlock.ts +160 -166
- package/src/templator/genUpdateBlock.ts +269 -255
- package/src/templator/index.ts +4 -4
- package/src/templator/utils.ts +491 -463
- package/src/translator/index.ts +84 -84
- package/src/translator/lsp.ts +22 -22
- package/src/translator/tsp.ts +6 -6
- package/src/utils/index.ts +115 -117
- package/src/utils/logger.ts +3 -4
- package/src/utils/sortTsString.ts +34 -32
- package/src/utils/string.ts +47 -48
- package/src/utils/time-slicing.ts +109 -0
- package/src/utils/traverse.ts +114 -126
- package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +71 -0
- package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +140 -0
- package/test/concepts/call-interface/constant.ts +5 -0
- package/test/concepts/call-interface/fixtures/only-interface.json +158 -0
- package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +455 -0
- package/test/concepts/call-interface/fixtures/with-body-no-argument.json +187 -0
- package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +225 -0
- package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +213 -0
- package/test/concepts/call-interface/fixtures/with-headers.json +192 -0
- package/test/concepts/call-interface/fixtures/with-query-no-argument.json +213 -0
- package/test/concepts/call-interface/fixtures/with-query.json +192 -0
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/call-interface/toJS.spec.ts +14 -0
- package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
- package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +141 -0
- package/test/concepts/call-logic/constant.ts +5 -0
- package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +223 -0
- package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +359 -0
- package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +209 -0
- package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +311 -0
- package/test/concepts/call-logic/fixtures/only-call-logic.json +10 -0
- package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +128 -0
- package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +126 -0
- package/test/concepts/call-logic/fixtures/view-component-with-validation.json +244 -0
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/call-logic/toJS.spec.ts +14 -0
- package/test/concepts/match/__snapshots__/toEmbeddedTS.spec.ts.snap +66 -0
- package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +40 -0
- package/test/concepts/match/constant.ts +5 -0
- package/test/concepts/match/fixtures/isExpression.json +259 -0
- package/test/concepts/match/fixtures/lastBodyIf.json +268 -0
- package/test/concepts/match/fixtures/noExpression.json +176 -0
- package/test/concepts/match/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/match/toJS.spec.ts +14 -0
- package/test/concepts/utils.ts +76 -3
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +16 -0
- package/test/concepts/validation-rule/constant.ts +5 -0
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +10 -17
- package/test/concepts/validation-rule/toJS.spec.ts +14 -0
- package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +68 -0
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +44 -0
- package/test/concepts/view-element/constant.ts +5 -0
- package/test/concepts/view-element/fixtures/default-not-found.json +322 -0
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/view-element/toVue.spec.ts +14 -0
- package/test/setup.ts +7 -0
- package/ts-worker/src/index.js +0 -2
- package/tsconfig.json +21 -21
- package/bin/naslc +0 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1
2
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
2
3
|
import { genLaunchProcess, syncMemberExpression } from '../server/getProcesses';
|
|
3
4
|
import { process2LogicNamespace } from '../server/process2LogicNamespace';
|
|
@@ -5,15 +6,14 @@ import Namespace from './Namespace__';
|
|
|
5
6
|
import Logic from './Logic__';
|
|
6
7
|
import Variable from './Variable__';
|
|
7
8
|
import Identifier from './Identifier__';
|
|
8
|
-
|
|
9
|
+
//= ===============================================================================
|
|
9
10
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
10
11
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
11
|
-
|
|
12
|
+
//= ===============================================================================
|
|
12
13
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
13
14
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
14
15
|
|
|
15
16
|
import * as utils from '../utils';
|
|
16
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
17
17
|
import BaseNode from '../common/BaseNode';
|
|
18
18
|
import classMap from '../common/classMap';
|
|
19
19
|
import BindEvent from './BindEvent__';
|
|
@@ -29,1464 +29,1527 @@ import App from './App__';
|
|
|
29
29
|
*/
|
|
30
30
|
@concept('流程')
|
|
31
31
|
export class Process extends BaseNode {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* 设置流程名称
|
|
128
|
-
*/
|
|
129
|
-
setName(name: string) {
|
|
130
|
-
const object = {
|
|
131
|
-
name,
|
|
132
|
-
};
|
|
133
|
-
this.update({
|
|
134
|
-
...object,
|
|
135
|
-
field: 'name',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* 设置流程标题
|
|
141
|
-
*/
|
|
142
|
-
setTitle(title: string) {
|
|
143
|
-
const object = {
|
|
144
|
-
title,
|
|
145
|
-
};
|
|
146
|
-
this.update({
|
|
147
|
-
...object,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* 设置流程描述
|
|
153
|
-
*/
|
|
154
|
-
setDescription(description: string) {
|
|
155
|
-
const object = {
|
|
156
|
-
description,
|
|
157
|
-
};
|
|
158
|
-
this.update({
|
|
159
|
-
...object,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
164
|
-
const excludedSet = new Set(excludedList);
|
|
165
|
-
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
166
|
-
}
|
|
167
|
-
getBindEventUniqueName(name = 'bindEvent1') {
|
|
168
|
-
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* 插入元素绑定事件
|
|
173
|
-
* @internal
|
|
174
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
175
|
-
*/
|
|
176
|
-
_insertBindEventAt(name: string, index: number): BindEvent;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* 插入元素绑定事件
|
|
180
|
-
* @internal
|
|
181
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
182
|
-
*/
|
|
183
|
-
_insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* 插入元素绑定事件
|
|
187
|
-
* @internal
|
|
188
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
189
|
-
*/
|
|
190
|
-
_insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
191
|
-
|
|
192
|
-
_insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
193
|
-
const bindEventOptions: any = {};
|
|
194
|
-
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
195
|
-
let bindEvent: BindEvent;
|
|
196
|
-
if (!options) {
|
|
197
|
-
bindEvent = BindEvent.from({
|
|
198
|
-
...bindEventOptions,
|
|
199
|
-
name: this.getBindEventUniqueName(),
|
|
200
|
-
}, this, 'bindEvents');
|
|
201
|
-
} else if (typeof options === 'string') {
|
|
202
|
-
bindEvent = BindEvent.from({
|
|
203
|
-
...bindEventOptions,
|
|
204
|
-
name: options,
|
|
205
|
-
}, this, 'bindEvents');
|
|
206
|
-
} else if (options instanceof BindEvent) {
|
|
207
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
208
|
-
bindEvent = options;
|
|
209
|
-
Object.assign(bindEvent, relationOptions);
|
|
210
|
-
} else {
|
|
211
|
-
bindEvent = BindEvent.from({
|
|
212
|
-
...bindEventOptions,
|
|
213
|
-
...options,
|
|
214
|
-
}, this, 'bindEvents');
|
|
215
|
-
}
|
|
216
|
-
this.bindEvents.splice(index, 0, bindEvent);
|
|
217
|
-
return bindEvent;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* 插入元素绑定事件
|
|
222
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
223
|
-
*/
|
|
224
|
-
insertBindEventAt(name: string, index: number): BindEvent;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* 插入元素绑定事件
|
|
228
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
229
|
-
*/
|
|
230
|
-
insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* 插入元素绑定事件
|
|
234
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
235
|
-
*/
|
|
236
|
-
insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
237
|
-
|
|
238
|
-
insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
239
|
-
const node = this._insertBindEventAt(options as any, index);
|
|
240
|
-
node.create({
|
|
241
|
-
index,
|
|
242
|
-
parentNode: this,
|
|
243
|
-
parentKey: 'bindEvents',
|
|
244
|
-
});
|
|
245
|
-
return node;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* 添加元素绑定事件
|
|
250
|
-
* @internal
|
|
251
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
252
|
-
*/
|
|
253
|
-
_addBindEvent(name?: string): BindEvent;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* 添加元素绑定事件
|
|
257
|
-
* @internal
|
|
258
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
259
|
-
*/
|
|
260
|
-
_addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* 添加元素绑定事件
|
|
264
|
-
* @internal
|
|
265
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
266
|
-
*/
|
|
267
|
-
_addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
268
|
-
|
|
269
|
-
_addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
270
|
-
const index = this.bindEvents.length;
|
|
271
|
-
return this._insertBindEventAt(options as any, index);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* 添加元素绑定事件
|
|
276
|
-
* @internal
|
|
277
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
278
|
-
*/
|
|
279
|
-
addBindEvent(name?: string): BindEvent;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* 添加元素绑定事件
|
|
283
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
284
|
-
*/
|
|
285
|
-
addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* 添加元素绑定事件
|
|
289
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
290
|
-
*/
|
|
291
|
-
addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
292
|
-
|
|
293
|
-
addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
294
|
-
const node = this._addBindEvent(options as any);
|
|
295
|
-
const index = this.bindEvents.indexOf(node);
|
|
296
|
-
node.create({
|
|
297
|
-
index,
|
|
298
|
-
parentNode: this,
|
|
299
|
-
parentKey: 'bindEvents',
|
|
300
|
-
});
|
|
301
|
-
return node;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
getParamExistingNames(excludedList: Array<Param> = []) {
|
|
306
|
-
const excludedSet = new Set(excludedList);
|
|
307
|
-
return ((this.params as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
308
|
-
}
|
|
309
|
-
getParamUniqueName(name = 'param1') {
|
|
310
|
-
return utils.unique(name, this.getParamExistingNames(), undefined, false);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* 插入输入参数
|
|
315
|
-
* @internal
|
|
316
|
-
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
317
|
-
*/
|
|
318
|
-
_insertParamAt(name: string, index: number): Param;
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* 插入输入参数
|
|
322
|
-
* @internal
|
|
323
|
-
* @param paramOptions 输入参数参数
|
|
324
|
-
*/
|
|
325
|
-
_insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* 插入输入参数
|
|
329
|
-
* @internal
|
|
330
|
-
* @param param 已有的输入参数实例
|
|
331
|
-
*/
|
|
332
|
-
_insertParamAt(param: Param, index: number): Param;
|
|
333
|
-
|
|
334
|
-
_insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
335
|
-
const paramOptions: any = {};
|
|
336
|
-
const relationOptions = { parentNode: this, parentKey: 'params' };
|
|
337
|
-
let param: Param;
|
|
338
|
-
if (!options) {
|
|
339
|
-
param = Param.from({
|
|
340
|
-
...paramOptions,
|
|
341
|
-
name: this.getParamUniqueName(),
|
|
342
|
-
}, this, 'params');
|
|
343
|
-
} else if (typeof options === 'string') {
|
|
344
|
-
param = Param.from({
|
|
345
|
-
...paramOptions,
|
|
346
|
-
name: options,
|
|
347
|
-
}, this, 'params');
|
|
348
|
-
} else if (options instanceof Param) {
|
|
349
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
350
|
-
param = options;
|
|
351
|
-
Object.assign(param, relationOptions);
|
|
352
|
-
} else {
|
|
353
|
-
param = Param.from({
|
|
354
|
-
...paramOptions,
|
|
355
|
-
...options,
|
|
356
|
-
}, this, 'params');
|
|
357
|
-
}
|
|
358
|
-
this.params.splice(index, 0, param);
|
|
359
|
-
return param;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* 插入输入参数
|
|
364
|
-
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
365
|
-
*/
|
|
366
|
-
insertParamAt(name: string, index: number): Param;
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* 插入输入参数
|
|
370
|
-
* @param paramOptions 输入参数参数
|
|
371
|
-
*/
|
|
372
|
-
insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* 插入输入参数
|
|
376
|
-
* @param param 已有的输入参数实例
|
|
377
|
-
*/
|
|
378
|
-
insertParamAt(param: Param, index: number): Param;
|
|
379
|
-
|
|
380
|
-
insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
381
|
-
const node = this._insertParamAt(options as any, index);
|
|
382
|
-
node.create({
|
|
383
|
-
index,
|
|
384
|
-
parentNode: this,
|
|
385
|
-
parentKey: 'params',
|
|
386
|
-
});
|
|
387
|
-
return node;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* 添加输入参数
|
|
392
|
-
* @internal
|
|
393
|
-
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
394
|
-
*/
|
|
395
|
-
_addParam(name?: string): Param;
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* 添加输入参数
|
|
399
|
-
* @internal
|
|
400
|
-
* @param paramOptions 输入参数参数
|
|
401
|
-
*/
|
|
402
|
-
_addParam(paramOptions: Partial<Param>): Param;
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* 添加输入参数
|
|
406
|
-
* @internal
|
|
407
|
-
* @param param 已有的输入参数实例
|
|
408
|
-
*/
|
|
409
|
-
_addParam(param: Param): Param;
|
|
410
|
-
|
|
411
|
-
_addParam(options?: string | Partial<Param> | Param) {
|
|
412
|
-
const index = this.params.length;
|
|
413
|
-
return this._insertParamAt(options as any, index);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* 添加输入参数
|
|
418
|
-
* @internal
|
|
419
|
-
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
420
|
-
*/
|
|
421
|
-
addParam(name?: string): Param;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* 添加输入参数
|
|
425
|
-
* @param paramOptions 输入参数参数
|
|
426
|
-
*/
|
|
427
|
-
addParam(paramOptions: Partial<Param>): Param;
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* 添加输入参数
|
|
431
|
-
* @param param 已有的输入参数实例
|
|
432
|
-
*/
|
|
433
|
-
addParam(param: Param): Param;
|
|
434
|
-
|
|
435
|
-
addParam(options?: string | Partial<Param> | Param) {
|
|
436
|
-
const node = this._addParam(options as any);
|
|
437
|
-
const index = this.params.indexOf(node);
|
|
438
|
-
node.create({
|
|
439
|
-
index,
|
|
440
|
-
parentNode: this,
|
|
441
|
-
parentKey: 'params',
|
|
442
|
-
});
|
|
443
|
-
return node;
|
|
32
|
+
/**
|
|
33
|
+
* 产品概念
|
|
34
|
+
*/
|
|
35
|
+
@property()
|
|
36
|
+
concept: 'Process' = 'Process';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 流程名称
|
|
40
|
+
*/
|
|
41
|
+
@property()
|
|
42
|
+
name: string = undefined;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 流程标题
|
|
46
|
+
*/
|
|
47
|
+
@property()
|
|
48
|
+
title: string = undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 流程描述
|
|
52
|
+
*/
|
|
53
|
+
@property()
|
|
54
|
+
description: string = undefined;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 元素绑定事件列表
|
|
58
|
+
*/
|
|
59
|
+
@property('BindEvent')
|
|
60
|
+
bindEvents: Array<BindEvent> = [];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 输入参数列表
|
|
64
|
+
*/
|
|
65
|
+
@property('Param')
|
|
66
|
+
params: Array<Param> = [];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 输出参数列表
|
|
70
|
+
*/
|
|
71
|
+
@property('Return')
|
|
72
|
+
returns: Array<Return> = [];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 常量列表
|
|
76
|
+
*/
|
|
77
|
+
@property('Constant')
|
|
78
|
+
constants: Array<Constant> = [];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 流程元素列表
|
|
82
|
+
*/
|
|
83
|
+
@property('ProcessElement')
|
|
84
|
+
elements: Array<ProcessElement> = [];
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 祖先 Module
|
|
88
|
+
*/
|
|
89
|
+
get module() {
|
|
90
|
+
return this.getAncestor('Module') as Module;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 祖先 App
|
|
95
|
+
*/
|
|
96
|
+
get app() {
|
|
97
|
+
return this.getAncestor('App') as App;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param source 需要合并的部分参数
|
|
102
|
+
*/
|
|
103
|
+
constructor(source?: Partial<Process>) {
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
source = { ...Process.getDefaultOptions(), ...source };
|
|
106
|
+
super(source);
|
|
107
|
+
super.subConstructor(source);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
getClassName() {
|
|
111
|
+
return 'Process';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static from(source: any, parentNode?: any, parentKey?: string): Process {
|
|
115
|
+
return super.from(source, parentNode, parentKey) as Process;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 从父级删除该节点
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
_delete() {
|
|
123
|
+
let params: Params = null;
|
|
124
|
+
if (this.parentNode) {
|
|
125
|
+
params = (this.parentNode as any)?.__removeProcess?.(this);
|
|
444
126
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
*/
|
|
551
|
-
_addReturn(ret: Return): Return;
|
|
552
|
-
|
|
553
|
-
_addReturn(options?: string | Partial<Return> | Return) {
|
|
554
|
-
const index = this.returns.length;
|
|
555
|
-
return this._insertReturnAt(options as any, index);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* 添加输出参数
|
|
560
|
-
* @internal
|
|
561
|
-
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
562
|
-
*/
|
|
563
|
-
addReturn(name?: string): Return;
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* 添加输出参数
|
|
567
|
-
* @param retOptions 输出参数参数
|
|
568
|
-
*/
|
|
569
|
-
addReturn(retOptions: Partial<Return>): Return;
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* 添加输出参数
|
|
573
|
-
* @param ret 已有的输出参数实例
|
|
574
|
-
*/
|
|
575
|
-
addReturn(ret: Return): Return;
|
|
576
|
-
|
|
577
|
-
addReturn(options?: string | Partial<Return> | Return) {
|
|
578
|
-
const node = this._addReturn(options as any);
|
|
579
|
-
const index = this.returns.indexOf(node);
|
|
580
|
-
node.create({
|
|
581
|
-
index,
|
|
582
|
-
parentNode: this,
|
|
583
|
-
parentKey: 'returns',
|
|
584
|
-
});
|
|
585
|
-
return node;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
getConstantExistingNames(excludedList: Array<Constant> = []) {
|
|
590
|
-
const excludedSet = new Set(excludedList);
|
|
591
|
-
return ((this.constants as Constant[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
592
|
-
}
|
|
593
|
-
getConstantUniqueName(name = 'constant1') {
|
|
594
|
-
return utils.unique(name, this.getConstantExistingNames(), undefined, false);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* 插入常量
|
|
599
|
-
* @internal
|
|
600
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
601
|
-
*/
|
|
602
|
-
_insertConstantAt(name: string, index: number): Constant;
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* 插入常量
|
|
606
|
-
* @internal
|
|
607
|
-
* @param constantOptions 常量参数
|
|
608
|
-
*/
|
|
609
|
-
_insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* 插入常量
|
|
613
|
-
* @internal
|
|
614
|
-
* @param constant 已有的常量实例
|
|
615
|
-
*/
|
|
616
|
-
_insertConstantAt(constant: Constant, index: number): Constant;
|
|
617
|
-
|
|
618
|
-
_insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
619
|
-
const constantOptions: any = {};
|
|
620
|
-
const relationOptions = { parentNode: this, parentKey: 'constants' };
|
|
621
|
-
let constant: Constant;
|
|
622
|
-
if (!options) {
|
|
623
|
-
constant = Constant.from({
|
|
624
|
-
...constantOptions,
|
|
625
|
-
name: this.getConstantUniqueName(),
|
|
626
|
-
}, this, 'constants');
|
|
627
|
-
} else if (typeof options === 'string') {
|
|
628
|
-
constant = Constant.from({
|
|
629
|
-
...constantOptions,
|
|
630
|
-
name: options,
|
|
631
|
-
}, this, 'constants');
|
|
632
|
-
} else if (options instanceof Constant) {
|
|
633
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
634
|
-
constant = options;
|
|
635
|
-
Object.assign(constant, relationOptions);
|
|
636
|
-
} else {
|
|
637
|
-
constant = Constant.from({
|
|
638
|
-
...constantOptions,
|
|
639
|
-
...options,
|
|
640
|
-
}, this, 'constants');
|
|
641
|
-
}
|
|
642
|
-
this.constants.splice(index, 0, constant);
|
|
643
|
-
return constant;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* 插入常量
|
|
648
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
649
|
-
*/
|
|
650
|
-
insertConstantAt(name: string, index: number): Constant;
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* 插入常量
|
|
654
|
-
* @param constantOptions 常量参数
|
|
655
|
-
*/
|
|
656
|
-
insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* 插入常量
|
|
660
|
-
* @param constant 已有的常量实例
|
|
661
|
-
*/
|
|
662
|
-
insertConstantAt(constant: Constant, index: number): Constant;
|
|
663
|
-
|
|
664
|
-
insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
665
|
-
const node = this._insertConstantAt(options as any, index);
|
|
666
|
-
node.create({
|
|
667
|
-
index,
|
|
668
|
-
parentNode: this,
|
|
669
|
-
parentKey: 'constants',
|
|
670
|
-
});
|
|
671
|
-
return node;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* 添加常量
|
|
676
|
-
* @internal
|
|
677
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
678
|
-
*/
|
|
679
|
-
_addConstant(name?: string): Constant;
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* 添加常量
|
|
683
|
-
* @internal
|
|
684
|
-
* @param constantOptions 常量参数
|
|
685
|
-
*/
|
|
686
|
-
_addConstant(constantOptions: Partial<Constant>): Constant;
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* 添加常量
|
|
690
|
-
* @internal
|
|
691
|
-
* @param constant 已有的常量实例
|
|
692
|
-
*/
|
|
693
|
-
_addConstant(constant: Constant): Constant;
|
|
694
|
-
|
|
695
|
-
_addConstant(options?: string | Partial<Constant> | Constant) {
|
|
696
|
-
const index = this.constants.length;
|
|
697
|
-
return this._insertConstantAt(options as any, index);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* 添加常量
|
|
702
|
-
* @internal
|
|
703
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
704
|
-
*/
|
|
705
|
-
addConstant(name?: string): Constant;
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* 添加常量
|
|
709
|
-
* @param constantOptions 常量参数
|
|
710
|
-
*/
|
|
711
|
-
addConstant(constantOptions: Partial<Constant>): Constant;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* 添加常量
|
|
715
|
-
* @param constant 已有的常量实例
|
|
716
|
-
*/
|
|
717
|
-
addConstant(constant: Constant): Constant;
|
|
718
|
-
|
|
719
|
-
addConstant(options?: string | Partial<Constant> | Constant) {
|
|
720
|
-
const node = this._addConstant(options as any);
|
|
721
|
-
const index = this.constants.indexOf(node);
|
|
722
|
-
node.create({
|
|
723
|
-
index,
|
|
724
|
-
parentNode: this,
|
|
725
|
-
parentKey: 'constants',
|
|
726
|
-
});
|
|
727
|
-
return node;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
getElementExistingNames(excludedList: Array<ProcessElement> = []) {
|
|
732
|
-
const excludedSet = new Set(excludedList);
|
|
733
|
-
return ((this.elements as ProcessElement[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
734
|
-
}
|
|
735
|
-
getElementUniqueName(name = 'element1') {
|
|
736
|
-
return utils.unique(name, this.getElementExistingNames(), undefined, false);
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* 插入流程元素
|
|
741
|
-
* @internal
|
|
742
|
-
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
743
|
-
*/
|
|
744
|
-
_insertElementAt(name: string, index: number): ProcessElement;
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* 插入流程元素
|
|
748
|
-
* @internal
|
|
749
|
-
* @param elementOptions 流程元素参数
|
|
750
|
-
*/
|
|
751
|
-
_insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* 插入流程元素
|
|
755
|
-
* @internal
|
|
756
|
-
* @param element 已有的流程元素实例
|
|
757
|
-
*/
|
|
758
|
-
_insertElementAt(element: ProcessElement, index: number): ProcessElement;
|
|
759
|
-
|
|
760
|
-
_insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
|
|
761
|
-
const elementOptions: any = {};
|
|
762
|
-
const relationOptions = { parentNode: this, parentKey: 'elements' };
|
|
763
|
-
let element: ProcessElement;
|
|
764
|
-
if (!options) {
|
|
765
|
-
element = ProcessElement.from({
|
|
766
|
-
...elementOptions,
|
|
767
|
-
name: this.getElementUniqueName(),
|
|
768
|
-
}, this, 'elements');
|
|
769
|
-
} else if (typeof options === 'string') {
|
|
770
|
-
element = ProcessElement.from({
|
|
771
|
-
...elementOptions,
|
|
772
|
-
name: options,
|
|
773
|
-
}, this, 'elements');
|
|
774
|
-
} else if (options instanceof ProcessElement) {
|
|
775
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
776
|
-
element = options;
|
|
777
|
-
Object.assign(element, relationOptions);
|
|
778
|
-
} else {
|
|
779
|
-
element = ProcessElement.from({
|
|
780
|
-
...elementOptions,
|
|
781
|
-
...options,
|
|
782
|
-
}, this, 'elements');
|
|
783
|
-
}
|
|
784
|
-
this.elements.splice(index, 0, element);
|
|
785
|
-
return element;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* 插入流程元素
|
|
790
|
-
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
791
|
-
*/
|
|
792
|
-
insertElementAt(name: string, index: number): ProcessElement;
|
|
793
|
-
|
|
794
|
-
/**
|
|
795
|
-
* 插入流程元素
|
|
796
|
-
* @param elementOptions 流程元素参数
|
|
797
|
-
*/
|
|
798
|
-
insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
* 插入流程元素
|
|
802
|
-
* @param element 已有的流程元素实例
|
|
803
|
-
*/
|
|
804
|
-
insertElementAt(element: ProcessElement, index: number): ProcessElement;
|
|
805
|
-
|
|
806
|
-
insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
|
|
807
|
-
const node = this._insertElementAt(options as any, index);
|
|
808
|
-
node.create({
|
|
809
|
-
index,
|
|
810
|
-
parentNode: this,
|
|
811
|
-
parentKey: 'elements',
|
|
812
|
-
});
|
|
813
|
-
return node;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* 添加流程元素
|
|
818
|
-
* @internal
|
|
819
|
-
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
820
|
-
*/
|
|
821
|
-
_addElement(name?: string): ProcessElement;
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* 添加流程元素
|
|
825
|
-
* @internal
|
|
826
|
-
* @param elementOptions 流程元素参数
|
|
827
|
-
*/
|
|
828
|
-
_addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* 添加流程元素
|
|
832
|
-
* @internal
|
|
833
|
-
* @param element 已有的流程元素实例
|
|
834
|
-
*/
|
|
835
|
-
_addElement(element: ProcessElement): ProcessElement;
|
|
836
|
-
|
|
837
|
-
_addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
|
|
838
|
-
const index = this.elements.length;
|
|
839
|
-
return this._insertElementAt(options as any, index);
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* 添加流程元素
|
|
844
|
-
* @internal
|
|
845
|
-
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
846
|
-
*/
|
|
847
|
-
addElement(name?: string): ProcessElement;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* 添加流程元素
|
|
851
|
-
* @param elementOptions 流程元素参数
|
|
852
|
-
*/
|
|
853
|
-
addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* 添加流程元素
|
|
857
|
-
* @param element 已有的流程元素实例
|
|
858
|
-
*/
|
|
859
|
-
addElement(element: ProcessElement): ProcessElement;
|
|
860
|
-
|
|
861
|
-
addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
|
|
862
|
-
const node = this._addElement(options as any);
|
|
863
|
-
const index = this.elements.indexOf(node);
|
|
864
|
-
node.create({
|
|
865
|
-
index,
|
|
866
|
-
parentNode: this,
|
|
867
|
-
parentKey: 'elements',
|
|
868
|
-
});
|
|
869
|
-
return node;
|
|
127
|
+
return params;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 设置流程名称
|
|
132
|
+
*/
|
|
133
|
+
setName(name: string) {
|
|
134
|
+
const object = {
|
|
135
|
+
name,
|
|
136
|
+
};
|
|
137
|
+
this.update({
|
|
138
|
+
...object,
|
|
139
|
+
field: 'name',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 设置流程标题
|
|
145
|
+
*/
|
|
146
|
+
setTitle(title: string) {
|
|
147
|
+
const object = {
|
|
148
|
+
title,
|
|
149
|
+
};
|
|
150
|
+
this.update({
|
|
151
|
+
...object,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 设置流程描述
|
|
157
|
+
*/
|
|
158
|
+
setDescription(description: string) {
|
|
159
|
+
const object = {
|
|
160
|
+
description,
|
|
161
|
+
};
|
|
162
|
+
this.update({
|
|
163
|
+
...object,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
168
|
+
const excludedSet = new Set(excludedList);
|
|
169
|
+
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getBindEventUniqueName(name = 'bindEvent1') {
|
|
173
|
+
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 插入元素绑定事件
|
|
178
|
+
* @internal
|
|
179
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
180
|
+
*/
|
|
181
|
+
_insertBindEventAt(name: string, index: number): BindEvent;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 插入元素绑定事件
|
|
185
|
+
* @internal
|
|
186
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
187
|
+
*/
|
|
188
|
+
_insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 插入元素绑定事件
|
|
192
|
+
* @internal
|
|
193
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
194
|
+
*/
|
|
195
|
+
_insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
196
|
+
|
|
197
|
+
_insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
198
|
+
const bindEventOptions: any = {};
|
|
199
|
+
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
200
|
+
let bindEvent: BindEvent;
|
|
201
|
+
if (!options) {
|
|
202
|
+
bindEvent = BindEvent.from(
|
|
203
|
+
{
|
|
204
|
+
...bindEventOptions,
|
|
205
|
+
name: this.getBindEventUniqueName(),
|
|
206
|
+
},
|
|
207
|
+
this,
|
|
208
|
+
'bindEvents'
|
|
209
|
+
);
|
|
210
|
+
} else if (typeof options === 'string') {
|
|
211
|
+
bindEvent = BindEvent.from(
|
|
212
|
+
{
|
|
213
|
+
...bindEventOptions,
|
|
214
|
+
name: options,
|
|
215
|
+
},
|
|
216
|
+
this,
|
|
217
|
+
'bindEvents'
|
|
218
|
+
);
|
|
219
|
+
} else if (options instanceof BindEvent) {
|
|
220
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
221
|
+
bindEvent = options;
|
|
222
|
+
Object.assign(bindEvent, relationOptions);
|
|
223
|
+
} else {
|
|
224
|
+
bindEvent = BindEvent.from(
|
|
225
|
+
{
|
|
226
|
+
...bindEventOptions,
|
|
227
|
+
...options,
|
|
228
|
+
},
|
|
229
|
+
this,
|
|
230
|
+
'bindEvents'
|
|
231
|
+
);
|
|
870
232
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
233
|
+
this.bindEvents.splice(index, 0, bindEvent);
|
|
234
|
+
return bindEvent;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* 插入元素绑定事件
|
|
239
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
240
|
+
*/
|
|
241
|
+
insertBindEventAt(name: string, index: number): BindEvent;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 插入元素绑定事件
|
|
245
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
246
|
+
*/
|
|
247
|
+
insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* 插入元素绑定事件
|
|
251
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
252
|
+
*/
|
|
253
|
+
insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
254
|
+
|
|
255
|
+
insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
256
|
+
const node = this._insertBindEventAt(options as any, index);
|
|
257
|
+
node.create({
|
|
258
|
+
index,
|
|
259
|
+
parentNode: this,
|
|
260
|
+
parentKey: 'bindEvents',
|
|
261
|
+
});
|
|
262
|
+
return node;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 添加元素绑定事件
|
|
267
|
+
* @internal
|
|
268
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
269
|
+
*/
|
|
270
|
+
_addBindEvent(name?: string): BindEvent;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* 添加元素绑定事件
|
|
274
|
+
* @internal
|
|
275
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
276
|
+
*/
|
|
277
|
+
_addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* 添加元素绑定事件
|
|
281
|
+
* @internal
|
|
282
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
283
|
+
*/
|
|
284
|
+
_addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
285
|
+
|
|
286
|
+
_addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
287
|
+
const index = this.bindEvents.length;
|
|
288
|
+
return this._insertBindEventAt(options as any, index);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 添加元素绑定事件
|
|
293
|
+
* @internal
|
|
294
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
295
|
+
*/
|
|
296
|
+
addBindEvent(name?: string): BindEvent;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* 添加元素绑定事件
|
|
300
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
301
|
+
*/
|
|
302
|
+
addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 添加元素绑定事件
|
|
306
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
307
|
+
*/
|
|
308
|
+
addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
309
|
+
|
|
310
|
+
addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
311
|
+
const node = this._addBindEvent(options as any);
|
|
312
|
+
const index = this.bindEvents.indexOf(node);
|
|
313
|
+
node.create({
|
|
314
|
+
index,
|
|
315
|
+
parentNode: this,
|
|
316
|
+
parentKey: 'bindEvents',
|
|
317
|
+
});
|
|
318
|
+
return node;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
getParamExistingNames(excludedList: Array<Param> = []) {
|
|
322
|
+
const excludedSet = new Set(excludedList);
|
|
323
|
+
return ((this.params as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
getParamUniqueName(name = 'param1') {
|
|
327
|
+
return utils.unique(name, this.getParamExistingNames(), undefined, false);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* 插入输入参数
|
|
332
|
+
* @internal
|
|
333
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
334
|
+
*/
|
|
335
|
+
_insertParamAt(name: string, index: number): Param;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 插入输入参数
|
|
339
|
+
* @internal
|
|
340
|
+
* @param paramOptions 输入参数参数
|
|
341
|
+
*/
|
|
342
|
+
_insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* 插入输入参数
|
|
346
|
+
* @internal
|
|
347
|
+
* @param param 已有的输入参数实例
|
|
348
|
+
*/
|
|
349
|
+
_insertParamAt(param: Param, index: number): Param;
|
|
350
|
+
|
|
351
|
+
_insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
352
|
+
const paramOptions: any = {};
|
|
353
|
+
const relationOptions = { parentNode: this, parentKey: 'params' };
|
|
354
|
+
let param: Param;
|
|
355
|
+
if (!options) {
|
|
356
|
+
param = Param.from(
|
|
357
|
+
{
|
|
358
|
+
...paramOptions,
|
|
359
|
+
name: this.getParamUniqueName(),
|
|
360
|
+
},
|
|
361
|
+
this,
|
|
362
|
+
'params'
|
|
363
|
+
);
|
|
364
|
+
} else if (typeof options === 'string') {
|
|
365
|
+
param = Param.from(
|
|
366
|
+
{
|
|
367
|
+
...paramOptions,
|
|
368
|
+
name: options,
|
|
369
|
+
},
|
|
370
|
+
this,
|
|
371
|
+
'params'
|
|
372
|
+
);
|
|
373
|
+
} else if (options instanceof Param) {
|
|
374
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
375
|
+
param = options;
|
|
376
|
+
Object.assign(param, relationOptions);
|
|
377
|
+
} else {
|
|
378
|
+
param = Param.from(
|
|
379
|
+
{
|
|
380
|
+
...paramOptions,
|
|
381
|
+
...options,
|
|
382
|
+
},
|
|
383
|
+
this,
|
|
384
|
+
'params'
|
|
385
|
+
);
|
|
898
386
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
387
|
+
this.params.splice(index, 0, param);
|
|
388
|
+
return param;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* 插入输入参数
|
|
393
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
394
|
+
*/
|
|
395
|
+
insertParamAt(name: string, index: number): Param;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* 插入输入参数
|
|
399
|
+
* @param paramOptions 输入参数参数
|
|
400
|
+
*/
|
|
401
|
+
insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* 插入输入参数
|
|
405
|
+
* @param param 已有的输入参数实例
|
|
406
|
+
*/
|
|
407
|
+
insertParamAt(param: Param, index: number): Param;
|
|
408
|
+
|
|
409
|
+
insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
410
|
+
const node = this._insertParamAt(options as any, index);
|
|
411
|
+
node.create({
|
|
412
|
+
index,
|
|
413
|
+
parentNode: this,
|
|
414
|
+
parentKey: 'params',
|
|
415
|
+
});
|
|
416
|
+
return node;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 添加输入参数
|
|
421
|
+
* @internal
|
|
422
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
423
|
+
*/
|
|
424
|
+
_addParam(name?: string): Param;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 添加输入参数
|
|
428
|
+
* @internal
|
|
429
|
+
* @param paramOptions 输入参数参数
|
|
430
|
+
*/
|
|
431
|
+
_addParam(paramOptions: Partial<Param>): Param;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* 添加输入参数
|
|
435
|
+
* @internal
|
|
436
|
+
* @param param 已有的输入参数实例
|
|
437
|
+
*/
|
|
438
|
+
_addParam(param: Param): Param;
|
|
439
|
+
|
|
440
|
+
_addParam(options?: string | Partial<Param> | Param) {
|
|
441
|
+
const index = this.params.length;
|
|
442
|
+
return this._insertParamAt(options as any, index);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 添加输入参数
|
|
447
|
+
* @internal
|
|
448
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
449
|
+
*/
|
|
450
|
+
addParam(name?: string): Param;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* 添加输入参数
|
|
454
|
+
* @param paramOptions 输入参数参数
|
|
455
|
+
*/
|
|
456
|
+
addParam(paramOptions: Partial<Param>): Param;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* 添加输入参数
|
|
460
|
+
* @param param 已有的输入参数实例
|
|
461
|
+
*/
|
|
462
|
+
addParam(param: Param): Param;
|
|
463
|
+
|
|
464
|
+
addParam(options?: string | Partial<Param> | Param) {
|
|
465
|
+
const node = this._addParam(options as any);
|
|
466
|
+
const index = this.params.indexOf(node);
|
|
467
|
+
node.create({
|
|
468
|
+
index,
|
|
469
|
+
parentNode: this,
|
|
470
|
+
parentKey: 'params',
|
|
471
|
+
});
|
|
472
|
+
return node;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
getReturnExistingNames(excludedList: Array<Return> = []) {
|
|
476
|
+
const excludedSet = new Set(excludedList);
|
|
477
|
+
return ((this.returns as Return[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
getReturnUniqueName(name = 'ret1') {
|
|
481
|
+
return utils.unique(name, this.getReturnExistingNames(), undefined, false);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* 插入输出参数
|
|
486
|
+
* @internal
|
|
487
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
488
|
+
*/
|
|
489
|
+
_insertReturnAt(name: string, index: number): Return;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* 插入输出参数
|
|
493
|
+
* @internal
|
|
494
|
+
* @param retOptions 输出参数参数
|
|
495
|
+
*/
|
|
496
|
+
_insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* 插入输出参数
|
|
500
|
+
* @internal
|
|
501
|
+
* @param ret 已有的输出参数实例
|
|
502
|
+
*/
|
|
503
|
+
_insertReturnAt(ret: Return, index: number): Return;
|
|
504
|
+
|
|
505
|
+
_insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
506
|
+
const retOptions: any = {};
|
|
507
|
+
const relationOptions = { parentNode: this, parentKey: 'returns' };
|
|
508
|
+
let ret: Return;
|
|
509
|
+
if (!options) {
|
|
510
|
+
ret = Return.from(
|
|
511
|
+
{
|
|
512
|
+
...retOptions,
|
|
513
|
+
name: this.getReturnUniqueName(),
|
|
514
|
+
},
|
|
515
|
+
this,
|
|
516
|
+
'returns'
|
|
517
|
+
);
|
|
518
|
+
} else if (typeof options === 'string') {
|
|
519
|
+
ret = Return.from(
|
|
520
|
+
{
|
|
521
|
+
...retOptions,
|
|
522
|
+
name: options,
|
|
523
|
+
},
|
|
524
|
+
this,
|
|
525
|
+
'returns'
|
|
526
|
+
);
|
|
527
|
+
} else if (options instanceof Return) {
|
|
528
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
529
|
+
ret = options;
|
|
530
|
+
Object.assign(ret, relationOptions);
|
|
531
|
+
} else {
|
|
532
|
+
ret = Return.from(
|
|
533
|
+
{
|
|
534
|
+
...retOptions,
|
|
535
|
+
...options,
|
|
536
|
+
},
|
|
537
|
+
this,
|
|
538
|
+
'returns'
|
|
539
|
+
);
|
|
921
540
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
541
|
+
this.returns.splice(index, 0, ret);
|
|
542
|
+
return ret;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* 插入输出参数
|
|
547
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
548
|
+
*/
|
|
549
|
+
insertReturnAt(name: string, index: number): Return;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* 插入输出参数
|
|
553
|
+
* @param retOptions 输出参数参数
|
|
554
|
+
*/
|
|
555
|
+
insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* 插入输出参数
|
|
559
|
+
* @param ret 已有的输出参数实例
|
|
560
|
+
*/
|
|
561
|
+
insertReturnAt(ret: Return, index: number): Return;
|
|
562
|
+
|
|
563
|
+
insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
564
|
+
const node = this._insertReturnAt(options as any, index);
|
|
565
|
+
node.create({
|
|
566
|
+
index,
|
|
567
|
+
parentNode: this,
|
|
568
|
+
parentKey: 'returns',
|
|
569
|
+
});
|
|
570
|
+
return node;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* 添加输出参数
|
|
575
|
+
* @internal
|
|
576
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
577
|
+
*/
|
|
578
|
+
_addReturn(name?: string): Return;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* 添加输出参数
|
|
582
|
+
* @internal
|
|
583
|
+
* @param retOptions 输出参数参数
|
|
584
|
+
*/
|
|
585
|
+
_addReturn(retOptions: Partial<Return>): Return;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* 添加输出参数
|
|
589
|
+
* @internal
|
|
590
|
+
* @param ret 已有的输出参数实例
|
|
591
|
+
*/
|
|
592
|
+
_addReturn(ret: Return): Return;
|
|
593
|
+
|
|
594
|
+
_addReturn(options?: string | Partial<Return> | Return) {
|
|
595
|
+
const index = this.returns.length;
|
|
596
|
+
return this._insertReturnAt(options as any, index);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* 添加输出参数
|
|
601
|
+
* @internal
|
|
602
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
603
|
+
*/
|
|
604
|
+
addReturn(name?: string): Return;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* 添加输出参数
|
|
608
|
+
* @param retOptions 输出参数参数
|
|
609
|
+
*/
|
|
610
|
+
addReturn(retOptions: Partial<Return>): Return;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* 添加输出参数
|
|
614
|
+
* @param ret 已有的输出参数实例
|
|
615
|
+
*/
|
|
616
|
+
addReturn(ret: Return): Return;
|
|
617
|
+
|
|
618
|
+
addReturn(options?: string | Partial<Return> | Return) {
|
|
619
|
+
const node = this._addReturn(options as any);
|
|
620
|
+
const index = this.returns.indexOf(node);
|
|
621
|
+
node.create({
|
|
622
|
+
index,
|
|
623
|
+
parentNode: this,
|
|
624
|
+
parentKey: 'returns',
|
|
625
|
+
});
|
|
626
|
+
return node;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
getConstantExistingNames(excludedList: Array<Constant> = []) {
|
|
630
|
+
const excludedSet = new Set(excludedList);
|
|
631
|
+
return ((this.constants as Constant[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
getConstantUniqueName(name = 'constant1') {
|
|
635
|
+
return utils.unique(name, this.getConstantExistingNames(), undefined, false);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* 插入常量
|
|
640
|
+
* @internal
|
|
641
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
642
|
+
*/
|
|
643
|
+
_insertConstantAt(name: string, index: number): Constant;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* 插入常量
|
|
647
|
+
* @internal
|
|
648
|
+
* @param constantOptions 常量参数
|
|
649
|
+
*/
|
|
650
|
+
_insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* 插入常量
|
|
654
|
+
* @internal
|
|
655
|
+
* @param constant 已有的常量实例
|
|
656
|
+
*/
|
|
657
|
+
_insertConstantAt(constant: Constant, index: number): Constant;
|
|
658
|
+
|
|
659
|
+
_insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
660
|
+
const constantOptions: any = {};
|
|
661
|
+
const relationOptions = { parentNode: this, parentKey: 'constants' };
|
|
662
|
+
let constant: Constant;
|
|
663
|
+
if (!options) {
|
|
664
|
+
constant = Constant.from(
|
|
665
|
+
{
|
|
666
|
+
...constantOptions,
|
|
667
|
+
name: this.getConstantUniqueName(),
|
|
668
|
+
},
|
|
669
|
+
this,
|
|
670
|
+
'constants'
|
|
671
|
+
);
|
|
672
|
+
} else if (typeof options === 'string') {
|
|
673
|
+
constant = Constant.from(
|
|
674
|
+
{
|
|
675
|
+
...constantOptions,
|
|
676
|
+
name: options,
|
|
677
|
+
},
|
|
678
|
+
this,
|
|
679
|
+
'constants'
|
|
680
|
+
);
|
|
681
|
+
} else if (options instanceof Constant) {
|
|
682
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
683
|
+
constant = options;
|
|
684
|
+
Object.assign(constant, relationOptions);
|
|
685
|
+
} else {
|
|
686
|
+
constant = Constant.from(
|
|
687
|
+
{
|
|
688
|
+
...constantOptions,
|
|
689
|
+
...options,
|
|
690
|
+
},
|
|
691
|
+
this,
|
|
692
|
+
'constants'
|
|
693
|
+
);
|
|
948
694
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
695
|
+
this.constants.splice(index, 0, constant);
|
|
696
|
+
return constant;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* 插入常量
|
|
701
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
702
|
+
*/
|
|
703
|
+
insertConstantAt(name: string, index: number): Constant;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* 插入常量
|
|
707
|
+
* @param constantOptions 常量参数
|
|
708
|
+
*/
|
|
709
|
+
insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* 插入常量
|
|
713
|
+
* @param constant 已有的常量实例
|
|
714
|
+
*/
|
|
715
|
+
insertConstantAt(constant: Constant, index: number): Constant;
|
|
716
|
+
|
|
717
|
+
insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
718
|
+
const node = this._insertConstantAt(options as any, index);
|
|
719
|
+
node.create({
|
|
720
|
+
index,
|
|
721
|
+
parentNode: this,
|
|
722
|
+
parentKey: 'constants',
|
|
723
|
+
});
|
|
724
|
+
return node;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* 添加常量
|
|
729
|
+
* @internal
|
|
730
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
731
|
+
*/
|
|
732
|
+
_addConstant(name?: string): Constant;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* 添加常量
|
|
736
|
+
* @internal
|
|
737
|
+
* @param constantOptions 常量参数
|
|
738
|
+
*/
|
|
739
|
+
_addConstant(constantOptions: Partial<Constant>): Constant;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* 添加常量
|
|
743
|
+
* @internal
|
|
744
|
+
* @param constant 已有的常量实例
|
|
745
|
+
*/
|
|
746
|
+
_addConstant(constant: Constant): Constant;
|
|
747
|
+
|
|
748
|
+
_addConstant(options?: string | Partial<Constant> | Constant) {
|
|
749
|
+
const index = this.constants.length;
|
|
750
|
+
return this._insertConstantAt(options as any, index);
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* 添加常量
|
|
755
|
+
* @internal
|
|
756
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
757
|
+
*/
|
|
758
|
+
addConstant(name?: string): Constant;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* 添加常量
|
|
762
|
+
* @param constantOptions 常量参数
|
|
763
|
+
*/
|
|
764
|
+
addConstant(constantOptions: Partial<Constant>): Constant;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* 添加常量
|
|
768
|
+
* @param constant 已有的常量实例
|
|
769
|
+
*/
|
|
770
|
+
addConstant(constant: Constant): Constant;
|
|
771
|
+
|
|
772
|
+
addConstant(options?: string | Partial<Constant> | Constant) {
|
|
773
|
+
const node = this._addConstant(options as any);
|
|
774
|
+
const index = this.constants.indexOf(node);
|
|
775
|
+
node.create({
|
|
776
|
+
index,
|
|
777
|
+
parentNode: this,
|
|
778
|
+
parentKey: 'constants',
|
|
779
|
+
});
|
|
780
|
+
return node;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
getElementExistingNames(excludedList: Array<ProcessElement> = []) {
|
|
784
|
+
const excludedSet = new Set(excludedList);
|
|
785
|
+
return ((this.elements as ProcessElement[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
getElementUniqueName(name = 'element1') {
|
|
789
|
+
return utils.unique(name, this.getElementExistingNames(), undefined, false);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* 插入流程元素
|
|
794
|
+
* @internal
|
|
795
|
+
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
796
|
+
*/
|
|
797
|
+
_insertElementAt(name: string, index: number): ProcessElement;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* 插入流程元素
|
|
801
|
+
* @internal
|
|
802
|
+
* @param elementOptions 流程元素参数
|
|
803
|
+
*/
|
|
804
|
+
_insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* 插入流程元素
|
|
808
|
+
* @internal
|
|
809
|
+
* @param element 已有的流程元素实例
|
|
810
|
+
*/
|
|
811
|
+
_insertElementAt(element: ProcessElement, index: number): ProcessElement;
|
|
812
|
+
|
|
813
|
+
_insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
|
|
814
|
+
const elementOptions: any = {};
|
|
815
|
+
const relationOptions = { parentNode: this, parentKey: 'elements' };
|
|
816
|
+
let element: ProcessElement;
|
|
817
|
+
if (!options) {
|
|
818
|
+
element = ProcessElement.from(
|
|
819
|
+
{
|
|
820
|
+
...elementOptions,
|
|
821
|
+
name: this.getElementUniqueName(),
|
|
822
|
+
},
|
|
823
|
+
this,
|
|
824
|
+
'elements'
|
|
825
|
+
);
|
|
826
|
+
} else if (typeof options === 'string') {
|
|
827
|
+
element = ProcessElement.from(
|
|
828
|
+
{
|
|
829
|
+
...elementOptions,
|
|
830
|
+
name: options,
|
|
831
|
+
},
|
|
832
|
+
this,
|
|
833
|
+
'elements'
|
|
834
|
+
);
|
|
835
|
+
} else if (options instanceof ProcessElement) {
|
|
836
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
837
|
+
element = options;
|
|
838
|
+
Object.assign(element, relationOptions);
|
|
839
|
+
} else {
|
|
840
|
+
element = ProcessElement.from(
|
|
841
|
+
{
|
|
842
|
+
...elementOptions,
|
|
843
|
+
...options,
|
|
844
|
+
},
|
|
845
|
+
this,
|
|
846
|
+
'elements'
|
|
847
|
+
);
|
|
971
848
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
849
|
+
this.elements.splice(index, 0, element);
|
|
850
|
+
return element;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* 插入流程元素
|
|
855
|
+
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
856
|
+
*/
|
|
857
|
+
insertElementAt(name: string, index: number): ProcessElement;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* 插入流程元素
|
|
861
|
+
* @param elementOptions 流程元素参数
|
|
862
|
+
*/
|
|
863
|
+
insertElementAt(elementOptions: Partial<ProcessElement>, index: number): ProcessElement;
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* 插入流程元素
|
|
867
|
+
* @param element 已有的流程元素实例
|
|
868
|
+
*/
|
|
869
|
+
insertElementAt(element: ProcessElement, index: number): ProcessElement;
|
|
870
|
+
|
|
871
|
+
insertElementAt(options: string | Partial<ProcessElement> | ProcessElement, index: number) {
|
|
872
|
+
const node = this._insertElementAt(options as any, index);
|
|
873
|
+
node.create({
|
|
874
|
+
index,
|
|
875
|
+
parentNode: this,
|
|
876
|
+
parentKey: 'elements',
|
|
877
|
+
});
|
|
878
|
+
return node;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* 添加流程元素
|
|
883
|
+
* @internal
|
|
884
|
+
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
885
|
+
*/
|
|
886
|
+
_addElement(name?: string): ProcessElement;
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* 添加流程元素
|
|
890
|
+
* @internal
|
|
891
|
+
* @param elementOptions 流程元素参数
|
|
892
|
+
*/
|
|
893
|
+
_addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* 添加流程元素
|
|
897
|
+
* @internal
|
|
898
|
+
* @param element 已有的流程元素实例
|
|
899
|
+
*/
|
|
900
|
+
_addElement(element: ProcessElement): ProcessElement;
|
|
901
|
+
|
|
902
|
+
_addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
|
|
903
|
+
const index = this.elements.length;
|
|
904
|
+
return this._insertElementAt(options as any, index);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* 添加流程元素
|
|
909
|
+
* @internal
|
|
910
|
+
* @param name 流程元素名称,如果不填会自动生成一个唯一名称
|
|
911
|
+
*/
|
|
912
|
+
addElement(name?: string): ProcessElement;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* 添加流程元素
|
|
916
|
+
* @param elementOptions 流程元素参数
|
|
917
|
+
*/
|
|
918
|
+
addElement(elementOptions: Partial<ProcessElement>): ProcessElement;
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* 添加流程元素
|
|
922
|
+
* @param element 已有的流程元素实例
|
|
923
|
+
*/
|
|
924
|
+
addElement(element: ProcessElement): ProcessElement;
|
|
925
|
+
|
|
926
|
+
addElement(options?: string | Partial<ProcessElement> | ProcessElement) {
|
|
927
|
+
const node = this._addElement(options as any);
|
|
928
|
+
const index = this.elements.indexOf(node);
|
|
929
|
+
node.create({
|
|
930
|
+
index,
|
|
931
|
+
parentNode: this,
|
|
932
|
+
parentKey: 'elements',
|
|
933
|
+
});
|
|
934
|
+
return node;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* 删除元素绑定事件
|
|
939
|
+
* @param name 元素绑定事件名称
|
|
940
|
+
*/
|
|
941
|
+
removeBindEvent(name: string): void;
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* 删除元素绑定事件
|
|
945
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
946
|
+
*/
|
|
947
|
+
removeBindEvent(bindEvent: BindEvent): void;
|
|
948
|
+
|
|
949
|
+
removeBindEvent(options: string | BindEvent) {
|
|
950
|
+
let bindEvent: BindEvent;
|
|
951
|
+
if (typeof options === 'string') {
|
|
952
|
+
bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
|
|
953
|
+
if (!bindEvent) {
|
|
954
|
+
throw new Error(`找不到元素绑定事件 ${options}`);
|
|
955
|
+
}
|
|
956
|
+
} else {
|
|
957
|
+
bindEvent = options;
|
|
998
958
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
959
|
+
return bindEvent.delete();
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
__removeBindEvent(bindEvent: BindEvent) {
|
|
963
|
+
const { parentKey } = bindEvent;
|
|
964
|
+
const params: Params = {
|
|
965
|
+
parentNode: this,
|
|
966
|
+
parentKey,
|
|
967
|
+
index: -1,
|
|
968
|
+
object: null,
|
|
969
|
+
oldObject: bindEvent,
|
|
970
|
+
};
|
|
971
|
+
if (parentKey) {
|
|
972
|
+
params.parentKey = parentKey;
|
|
973
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
974
|
+
const index = (this as any)[parentKey].indexOf(bindEvent);
|
|
975
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
976
|
+
params.index = index;
|
|
977
|
+
} else if ((this as any)[parentKey] === bindEvent) {
|
|
978
|
+
params.index = 0;
|
|
979
|
+
(this as any)[parentKey] = undefined;
|
|
980
|
+
}
|
|
1021
981
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
}
|
|
1047
|
-
return constant.delete();
|
|
982
|
+
return params;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* 删除输入参数
|
|
987
|
+
* @param name 输入参数名称
|
|
988
|
+
*/
|
|
989
|
+
removeParam(name: string): void;
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* 删除输入参数
|
|
993
|
+
* @param param 已有的输入参数实例
|
|
994
|
+
*/
|
|
995
|
+
removeParam(param: Param): void;
|
|
996
|
+
|
|
997
|
+
removeParam(options: string | Param) {
|
|
998
|
+
let param: Param;
|
|
999
|
+
if (typeof options === 'string') {
|
|
1000
|
+
param = (this.params as Param[]).find((item) => item.name === options);
|
|
1001
|
+
if (!param) {
|
|
1002
|
+
throw new Error(`找不到输入参数 ${options}`);
|
|
1003
|
+
}
|
|
1004
|
+
} else {
|
|
1005
|
+
param = options;
|
|
1048
1006
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1007
|
+
return param.delete();
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
__removeParam(param: Param) {
|
|
1011
|
+
const { parentKey } = param;
|
|
1012
|
+
const params: Params = {
|
|
1013
|
+
parentNode: this,
|
|
1014
|
+
parentKey,
|
|
1015
|
+
index: -1,
|
|
1016
|
+
object: null,
|
|
1017
|
+
oldObject: param,
|
|
1018
|
+
};
|
|
1019
|
+
if (parentKey) {
|
|
1020
|
+
params.parentKey = parentKey;
|
|
1021
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1022
|
+
const index = (this as any)[parentKey].indexOf(param);
|
|
1023
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1024
|
+
params.index = index;
|
|
1025
|
+
} else if ((this as any)[parentKey] === param) {
|
|
1026
|
+
params.index = 0;
|
|
1027
|
+
(this as any)[parentKey] = undefined;
|
|
1028
|
+
}
|
|
1071
1029
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
}
|
|
1097
|
-
return element.delete();
|
|
1030
|
+
return params;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* 删除输出参数
|
|
1035
|
+
* @param name 输出参数名称
|
|
1036
|
+
*/
|
|
1037
|
+
removeReturn(name: string): void;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* 删除输出参数
|
|
1041
|
+
* @param ret 已有的输出参数实例
|
|
1042
|
+
*/
|
|
1043
|
+
removeReturn(ret: Return): void;
|
|
1044
|
+
|
|
1045
|
+
removeReturn(options: string | Return) {
|
|
1046
|
+
let ret: Return;
|
|
1047
|
+
if (typeof options === 'string') {
|
|
1048
|
+
ret = (this.returns as Return[]).find((item) => item.name === options);
|
|
1049
|
+
if (!ret) {
|
|
1050
|
+
throw new Error(`找不到输出参数 ${options}`);
|
|
1051
|
+
}
|
|
1052
|
+
} else {
|
|
1053
|
+
ret = options;
|
|
1098
1054
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1055
|
+
return ret.delete();
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
__removeReturn(ret: Return) {
|
|
1059
|
+
const { parentKey } = ret;
|
|
1060
|
+
const params: Params = {
|
|
1061
|
+
parentNode: this,
|
|
1062
|
+
parentKey,
|
|
1063
|
+
index: -1,
|
|
1064
|
+
object: null,
|
|
1065
|
+
oldObject: ret,
|
|
1066
|
+
};
|
|
1067
|
+
if (parentKey) {
|
|
1068
|
+
params.parentKey = parentKey;
|
|
1069
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1070
|
+
const index = (this as any)[parentKey].indexOf(ret);
|
|
1071
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1072
|
+
params.index = index;
|
|
1073
|
+
} else if ((this as any)[parentKey] === ret) {
|
|
1074
|
+
params.index = 0;
|
|
1075
|
+
(this as any)[parentKey] = undefined;
|
|
1076
|
+
}
|
|
1121
1077
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1078
|
+
return params;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* 删除常量
|
|
1083
|
+
* @param name 常量名称
|
|
1084
|
+
*/
|
|
1085
|
+
removeConstant(name: string): void;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* 删除常量
|
|
1089
|
+
* @param constant 已有的常量实例
|
|
1090
|
+
*/
|
|
1091
|
+
removeConstant(constant: Constant): void;
|
|
1092
|
+
|
|
1093
|
+
removeConstant(options: string | Constant) {
|
|
1094
|
+
let constant: Constant;
|
|
1095
|
+
if (typeof options === 'string') {
|
|
1096
|
+
constant = (this.constants as Constant[]).find((item) => item.name === options);
|
|
1097
|
+
if (!constant) {
|
|
1098
|
+
throw new Error(`找不到常量 ${options}`);
|
|
1099
|
+
}
|
|
1100
|
+
} else {
|
|
1101
|
+
constant = options;
|
|
1129
1102
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
l.delete();
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1103
|
+
return constant.delete();
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
__removeConstant(constant: Constant) {
|
|
1107
|
+
const { parentKey } = constant;
|
|
1108
|
+
const params: Params = {
|
|
1109
|
+
parentNode: this,
|
|
1110
|
+
parentKey,
|
|
1111
|
+
index: -1,
|
|
1112
|
+
object: null,
|
|
1113
|
+
oldObject: constant,
|
|
1114
|
+
};
|
|
1115
|
+
if (parentKey) {
|
|
1116
|
+
params.parentKey = parentKey;
|
|
1117
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1118
|
+
const index = (this as any)[parentKey].indexOf(constant);
|
|
1119
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1150
1120
|
params.index = index;
|
|
1151
|
-
|
|
1121
|
+
} else if ((this as any)[parentKey] === constant) {
|
|
1122
|
+
params.index = 0;
|
|
1123
|
+
(this as any)[parentKey] = undefined;
|
|
1124
|
+
}
|
|
1152
1125
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1126
|
+
return params;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* 删除流程元素
|
|
1131
|
+
* @param name 流程元素名称
|
|
1132
|
+
*/
|
|
1133
|
+
removeElement(name: string): void;
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* 删除流程元素
|
|
1137
|
+
* @param element 已有的流程元素实例
|
|
1138
|
+
*/
|
|
1139
|
+
removeElement(element: ProcessElement): void;
|
|
1140
|
+
|
|
1141
|
+
removeElement(options: string | ProcessElement) {
|
|
1142
|
+
let element: ProcessElement;
|
|
1143
|
+
if (typeof options === 'string') {
|
|
1144
|
+
element = (this.elements as ProcessElement[]).find((item) => item.name === options);
|
|
1145
|
+
if (!element) {
|
|
1146
|
+
throw new Error(`找不到流程元素 ${options}`);
|
|
1147
|
+
}
|
|
1148
|
+
} else {
|
|
1149
|
+
element = options;
|
|
1157
1150
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1151
|
+
return element.delete();
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
__removeProcessElement(element: ProcessElement) {
|
|
1155
|
+
const { parentKey } = element;
|
|
1156
|
+
const params: Params = {
|
|
1157
|
+
parentNode: this,
|
|
1158
|
+
parentKey,
|
|
1159
|
+
index: -1,
|
|
1160
|
+
object: null,
|
|
1161
|
+
oldObject: element,
|
|
1162
|
+
};
|
|
1163
|
+
if (parentKey) {
|
|
1164
|
+
params.parentKey = parentKey;
|
|
1165
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1166
|
+
const index = (this as any)[parentKey].indexOf(element);
|
|
1167
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1168
|
+
params.index = index;
|
|
1169
|
+
} else if ((this as any)[parentKey] === element) {
|
|
1170
|
+
params.index = 0;
|
|
1171
|
+
(this as any)[parentKey] = undefined;
|
|
1172
|
+
}
|
|
1170
1173
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
+
return params;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
//= ===============================================================================
|
|
1178
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1179
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
1180
|
+
//= ===============================================================================
|
|
1181
|
+
onChange($event?: EventPayload): void {
|
|
1182
|
+
this.emit('change', $event);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
_removeElement(element: ProcessElement) {
|
|
1186
|
+
const params = {
|
|
1187
|
+
propertyName: 'elements',
|
|
1188
|
+
index: -1,
|
|
1189
|
+
};
|
|
1190
|
+
const { id } = element;
|
|
1191
|
+
const index = this.elements.indexOf(element);
|
|
1192
|
+
~index && this.elements.splice(index, 1);
|
|
1193
|
+
if (element.type !== 'SequenceFlow') {
|
|
1194
|
+
const links: Array<ProcessElement> = [];
|
|
1195
|
+
this.elements.forEach((c) => {
|
|
1196
|
+
if (c.type === 'SequenceFlow' && (c.sourceRef === id || c.targetRef === id)) {
|
|
1197
|
+
links.push(c);
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
links.forEach((l) => {
|
|
1201
|
+
l.delete();
|
|
1202
|
+
});
|
|
1174
1203
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1204
|
+
params.index = index;
|
|
1205
|
+
return params;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
getVarExistingNames(excludedList: Array<Param | Return | Constant | ProcessElement> = []) {
|
|
1209
|
+
const excludedSet = new Set(excludedList);
|
|
1210
|
+
return [...this.params, ...this.returns, ...this.constants, ...this.elements].filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
getNamespace(ns: string) {
|
|
1214
|
+
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
1215
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
1216
|
+
const parentName = this.parentNode.name;
|
|
1217
|
+
const arr = [parentNamespace];
|
|
1218
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1219
|
+
arr.push(parentName);
|
|
1220
|
+
}
|
|
1221
|
+
return `${arr.join('.')}.${ns || 'processes'}`;
|
|
1183
1222
|
}
|
|
1223
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
getEmbeddedFilePath(name = this.name) {
|
|
1227
|
+
return `/embedded/${this.app.name}/processes/${name}.ts`;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
genExclusiveGatewayLogic(elem: ProcessElement) {
|
|
1231
|
+
const l = BaseNode.from(elem.logic) as Logic;
|
|
1232
|
+
elem.variables.forEach((v) => {
|
|
1233
|
+
const pv = BaseNode.from(v) as Variable;
|
|
1234
|
+
l._addVariable(pv);
|
|
1235
|
+
});
|
|
1236
|
+
return l;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
get logics() {
|
|
1240
|
+
// return [
|
|
1241
|
+
// genLaunchProcess(this),
|
|
1242
|
+
// ...this.elements.filter(el => el.type === 'UserTask').map(el => {
|
|
1243
|
+
// return {
|
|
1244
|
+
// name: el.name,
|
|
1245
|
+
// complete: genUserTaskLogic(el),
|
|
1246
|
+
// }
|
|
1247
|
+
// })
|
|
1248
|
+
// ];
|
|
1249
|
+
const ns = process2LogicNamespace(this);
|
|
1250
|
+
let logics: Logic[] = [];
|
|
1251
|
+
ns.children.map((subns) => {
|
|
1252
|
+
logics = logics.concat(subns.logics);
|
|
1253
|
+
});
|
|
1184
1254
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* 获取当前逻辑下所有elements上bindEvents下的logic
|
|
1208
|
-
*/
|
|
1209
|
-
get elementLogicRoot() {
|
|
1210
|
-
const logics: Array<Logic> = [];
|
|
1211
|
-
// 页面上的绑定的事件
|
|
1212
|
-
this.bindEvents.forEach((bindEvent) => {
|
|
1213
|
-
bindEvent.logics.forEach((logic) => {
|
|
1255
|
+
return [...ns.logics, ...logics];
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* 获取当前逻辑下所有elements上bindEvents下的logic
|
|
1260
|
+
*/
|
|
1261
|
+
get elementLogicRoot() {
|
|
1262
|
+
const logics: Array<Logic> = [];
|
|
1263
|
+
// 页面上的绑定的事件
|
|
1264
|
+
this.bindEvents.forEach((bindEvent) => {
|
|
1265
|
+
bindEvent.logics.forEach((logic) => {
|
|
1266
|
+
logics.push(logic);
|
|
1267
|
+
});
|
|
1268
|
+
});
|
|
1269
|
+
this.elements.forEach((item) => {
|
|
1270
|
+
if (item.concept === 'ProcessElement' && item.isUserTask) {
|
|
1271
|
+
utils.traverse(
|
|
1272
|
+
(current) => {
|
|
1273
|
+
current.node.bindEvents.forEach((bindEvent) => {
|
|
1274
|
+
bindEvent.logics.forEach((logic) => {
|
|
1214
1275
|
logics.push(logic);
|
|
1276
|
+
});
|
|
1215
1277
|
});
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
this.params.forEach((property) => {
|
|
1257
|
-
code += `${tab1}export let `;
|
|
1258
|
-
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1259
|
-
code += ';\n';
|
|
1260
|
-
});
|
|
1261
|
-
|
|
1262
|
-
this.returns.forEach((property) => {
|
|
1263
|
-
code += `${tab1}export let `;
|
|
1264
|
-
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1265
|
-
code += ';\n';
|
|
1266
|
-
});
|
|
1267
|
-
this.constants.forEach((property) => {
|
|
1268
|
-
code += `${tab1}export let `;
|
|
1269
|
-
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1270
|
-
code += ';\n';
|
|
1271
|
-
});
|
|
1272
|
-
|
|
1273
|
-
code += `${tab1}export const elements = {\n`;
|
|
1274
|
-
|
|
1275
|
-
this.elements.forEach((ele) => {
|
|
1276
|
-
code += '\n';
|
|
1277
|
-
if (ele.type !== 'EndNoneEvent' && ele.type !== 'SequenceFlow') {
|
|
1278
|
-
code += ele.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1279
|
-
}
|
|
1280
|
-
});
|
|
1281
|
-
code += `${tab1}}\n`;
|
|
1282
|
-
// 流程逻辑提示错误信息
|
|
1283
|
-
if (Array.isArray(this.bindEvents)) {
|
|
1284
|
-
this.bindEvents.forEach((event) => {
|
|
1285
|
-
code += event.toEmbeddedTS(shiftState(state, code, {
|
|
1286
|
-
tabSize: (state?.tabSize || 0),
|
|
1287
|
-
}));
|
|
1288
|
-
code += '\n';
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
|
-
code += `}\n`;
|
|
1292
|
-
return code;
|
|
1293
|
-
}
|
|
1278
|
+
},
|
|
1279
|
+
{ node: item }
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
return [
|
|
1284
|
+
{
|
|
1285
|
+
concept: 'elementLogicRoot',
|
|
1286
|
+
expanded: false,
|
|
1287
|
+
children: logics,
|
|
1288
|
+
},
|
|
1289
|
+
];
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
toUserTaskPropertyGetterTS(userTask: ProcessElement) {
|
|
1293
|
+
return `let ${userTask.name} = elements.${userTask.name};`;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
@withSourceMap()
|
|
1297
|
+
toEmbeddedTS(state?: TranslatorState): string {
|
|
1298
|
+
let code = `export namespace ${this.name} {\n`;
|
|
1299
|
+
const tab0 = indent(state?.tabSize || 0);
|
|
1300
|
+
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
1301
|
+
const tab2 = indent((state?.tabSize || 0) + 2);
|
|
1302
|
+
const tab3 = indent((state?.tabSize || 0) + 3);
|
|
1303
|
+
// code += `${tab1}namespace variables{\n`;
|
|
1304
|
+
|
|
1305
|
+
code += `${tab1}let __ProcessIdentification__: string;\n`;
|
|
1306
|
+
code += `${tab1}export namespace logics {\n`;
|
|
1307
|
+
const logic = genLaunchProcess(this);
|
|
1308
|
+
// sourceMap 映射
|
|
1309
|
+
logic.parentNode = this;
|
|
1310
|
+
code += logic.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
|
|
1311
|
+
code += `${tab1}}\n`;
|
|
1312
|
+
|
|
1313
|
+
this.params.forEach((property) => {
|
|
1314
|
+
code += `${tab1}export let `;
|
|
1315
|
+
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1316
|
+
code += ';\n';
|
|
1317
|
+
});
|
|
1294
1318
|
|
|
1295
|
-
|
|
1296
|
-
|
|
1319
|
+
this.returns.forEach((property) => {
|
|
1320
|
+
code += `${tab1}export let `;
|
|
1321
|
+
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1322
|
+
code += ';\n';
|
|
1323
|
+
});
|
|
1324
|
+
this.constants.forEach((property) => {
|
|
1325
|
+
code += `${tab1}export let `;
|
|
1326
|
+
code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1327
|
+
code += ';\n';
|
|
1328
|
+
});
|
|
1297
1329
|
|
|
1298
|
-
|
|
1299
|
-
try {
|
|
1300
|
-
code += this.toEmbeddedTS(state);
|
|
1301
|
-
} catch (err) {
|
|
1302
|
-
code += '';
|
|
1303
|
-
console.log(err);
|
|
1304
|
-
}
|
|
1305
|
-
code += '}\n';
|
|
1330
|
+
code += `${tab1}export const elements = {\n`;
|
|
1306
1331
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1332
|
+
this.elements.forEach((ele) => {
|
|
1333
|
+
code += '\n';
|
|
1334
|
+
if (ele.type !== 'EndNoneEvent' && ele.type !== 'SequenceFlow') {
|
|
1335
|
+
code += ele.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
code += `${tab1}}\n`;
|
|
1339
|
+
// 流程逻辑提示错误信息
|
|
1340
|
+
if (Array.isArray(this.bindEvents)) {
|
|
1341
|
+
this.bindEvents.forEach((event) => {
|
|
1342
|
+
code += event.toEmbeddedTS(
|
|
1343
|
+
shiftState(state, code, {
|
|
1344
|
+
tabSize: state?.tabSize || 0,
|
|
1345
|
+
})
|
|
1346
|
+
);
|
|
1347
|
+
code += '\n';
|
|
1348
|
+
});
|
|
1312
1349
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
{
|
|
1327
|
-
concept: 'Constant',
|
|
1328
|
-
name: 'taskId',
|
|
1329
|
-
typeAnnotation: {
|
|
1330
|
-
concept: 'TypeAnnotation',
|
|
1331
|
-
typeKind: 'primitive',
|
|
1332
|
-
typeNamespace: 'nasl.core',
|
|
1333
|
-
typeName: 'String',
|
|
1334
|
-
},
|
|
1335
|
-
},
|
|
1336
|
-
],
|
|
1337
|
-
};
|
|
1338
|
-
return {
|
|
1339
|
-
constants: [
|
|
1340
|
-
{
|
|
1341
|
-
concept: 'Constant',
|
|
1342
|
-
name: 'processId',
|
|
1343
|
-
typeAnnotation: {
|
|
1344
|
-
concept: 'TypeAnnotation',
|
|
1345
|
-
typeKind: 'primitive',
|
|
1346
|
-
typeNamespace: 'nasl.core',
|
|
1347
|
-
typeName: 'String',
|
|
1348
|
-
},
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
concept: 'Constant',
|
|
1352
|
-
name: 'startBy',
|
|
1353
|
-
typeAnnotation: {
|
|
1354
|
-
concept: 'TypeAnnotation',
|
|
1355
|
-
typeKind: 'primitive',
|
|
1356
|
-
typeNamespace: 'nasl.core',
|
|
1357
|
-
typeName: 'String',
|
|
1358
|
-
},
|
|
1359
|
-
},
|
|
1360
|
-
],
|
|
1361
|
-
elements: [
|
|
1362
|
-
{
|
|
1363
|
-
concept: 'ProcessElement',
|
|
1364
|
-
name: 'Start',
|
|
1365
|
-
type: 'StartNoneEvent',
|
|
1366
|
-
bounds: {
|
|
1367
|
-
concept: 'Rect',
|
|
1368
|
-
x: 0, y: 0,
|
|
1369
|
-
},
|
|
1370
|
-
},
|
|
1371
|
-
{
|
|
1372
|
-
concept: 'ProcessElement',
|
|
1373
|
-
name: 'InitiateTask',
|
|
1374
|
-
type: 'InitiateTask',
|
|
1375
|
-
title: '发起任务',
|
|
1376
|
-
...userTaskAttr,
|
|
1377
|
-
bounds: {
|
|
1378
|
-
concept: 'Rect',
|
|
1379
|
-
x: 0, y: 90,
|
|
1380
|
-
},
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
concept: 'ProcessElement',
|
|
1384
|
-
name: 'ApprovalTask',
|
|
1385
|
-
type: 'ApprovalTask',
|
|
1386
|
-
title: '审批任务',
|
|
1387
|
-
returns: [
|
|
1388
|
-
{
|
|
1389
|
-
concept: 'Return',
|
|
1390
|
-
description: '审批意见',
|
|
1391
|
-
name: 'approvalComment',
|
|
1392
|
-
typeAnnotation: {
|
|
1393
|
-
concept: 'TypeAnnotation',
|
|
1394
|
-
typeKind: 'primitive',
|
|
1395
|
-
typeNamespace: 'nasl.core',
|
|
1396
|
-
typeName: 'String',
|
|
1397
|
-
},
|
|
1398
|
-
},
|
|
1399
|
-
{
|
|
1400
|
-
concept: 'Return',
|
|
1401
|
-
description: '审批结果',
|
|
1402
|
-
name: 'approvalResult',
|
|
1403
|
-
typeAnnotation: {
|
|
1404
|
-
concept: 'TypeAnnotation',
|
|
1405
|
-
typeKind: 'primitive',
|
|
1406
|
-
typeNamespace: 'nasl.core',
|
|
1407
|
-
typeName: 'String',
|
|
1408
|
-
},
|
|
1409
|
-
},
|
|
1410
|
-
],
|
|
1411
|
-
...userTaskAttr,
|
|
1412
|
-
bounds: {
|
|
1413
|
-
concept: 'Rect',
|
|
1414
|
-
x: 0, y: 250,
|
|
1415
|
-
},
|
|
1416
|
-
},
|
|
1417
|
-
{
|
|
1418
|
-
concept: 'ProcessElement',
|
|
1419
|
-
name: 'End',
|
|
1420
|
-
type: 'EndNoneEvent',
|
|
1421
|
-
bounds: {
|
|
1422
|
-
concept: 'Rect',
|
|
1423
|
-
x: 0, y: 500,
|
|
1424
|
-
},
|
|
1425
|
-
},
|
|
1426
|
-
{
|
|
1427
|
-
concept: 'ProcessElement',
|
|
1428
|
-
name: 'SequenceFlow',
|
|
1429
|
-
type: 'SequenceFlow',
|
|
1430
|
-
sourceRef: 'Start',
|
|
1431
|
-
targetRef: 'InitiateTask',
|
|
1432
|
-
waypoints: [
|
|
1433
|
-
{ x: 0, y: 1 },
|
|
1434
|
-
{ x: 0, y: -1 },
|
|
1435
|
-
],
|
|
1436
|
-
},
|
|
1437
|
-
{
|
|
1438
|
-
concept: 'ProcessElement',
|
|
1439
|
-
name: 'SequenceFlow1',
|
|
1440
|
-
type: 'SequenceFlow',
|
|
1441
|
-
sourceRef: 'InitiateTask',
|
|
1442
|
-
targetRef: 'ApprovalTask',
|
|
1443
|
-
waypoints: [
|
|
1444
|
-
{ x: 0, y: 1 },
|
|
1445
|
-
{ x: 0, y: -1 },
|
|
1446
|
-
],
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
concept: 'ProcessElement',
|
|
1450
|
-
name: 'SequenceFlow2',
|
|
1451
|
-
type: 'SequenceFlow',
|
|
1452
|
-
sourceRef: 'ApprovalTask',
|
|
1453
|
-
targetRef: 'End',
|
|
1454
|
-
waypoints: [
|
|
1455
|
-
{ x: 0, y: 1 },
|
|
1456
|
-
{ x: 0, y: -1 },
|
|
1457
|
-
],
|
|
1458
|
-
},
|
|
1459
|
-
],
|
|
1460
|
-
};
|
|
1350
|
+
code += `}\n`;
|
|
1351
|
+
return code;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
toEmbeddedTSFile() {
|
|
1355
|
+
let code = `namespace ${this.getNamespace('processes')} {\n`;
|
|
1356
|
+
|
|
1357
|
+
const state = createCompilerState(code, { tabSize: 1 });
|
|
1358
|
+
try {
|
|
1359
|
+
code += this.toEmbeddedTS(state);
|
|
1360
|
+
} catch (err) {
|
|
1361
|
+
code += '';
|
|
1362
|
+
console.log(err);
|
|
1461
1363
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1364
|
+
code += '}\n';
|
|
1365
|
+
|
|
1366
|
+
return {
|
|
1367
|
+
code,
|
|
1368
|
+
filePath: this.getEmbeddedFilePath(),
|
|
1369
|
+
sourceMap: state.sourceMap,
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
public static getDefaultOptions() {
|
|
1374
|
+
const userTaskAttr = {
|
|
1375
|
+
bindAttrs: [
|
|
1376
|
+
{
|
|
1377
|
+
concept: 'BindAttribute',
|
|
1378
|
+
name: 'assignee',
|
|
1379
|
+
assignee: {
|
|
1380
|
+
concept: 'Assignee',
|
|
1381
|
+
},
|
|
1382
|
+
},
|
|
1383
|
+
],
|
|
1384
|
+
constants: [
|
|
1385
|
+
{
|
|
1386
|
+
concept: 'Constant',
|
|
1387
|
+
name: 'taskId',
|
|
1388
|
+
typeAnnotation: {
|
|
1389
|
+
concept: 'TypeAnnotation',
|
|
1390
|
+
typeKind: 'primitive',
|
|
1391
|
+
typeNamespace: 'nasl.core',
|
|
1392
|
+
typeName: 'String',
|
|
1393
|
+
},
|
|
1394
|
+
},
|
|
1395
|
+
],
|
|
1396
|
+
};
|
|
1397
|
+
return {
|
|
1398
|
+
constants: [
|
|
1399
|
+
{
|
|
1400
|
+
concept: 'Constant',
|
|
1401
|
+
name: 'processId',
|
|
1402
|
+
typeAnnotation: {
|
|
1403
|
+
concept: 'TypeAnnotation',
|
|
1404
|
+
typeKind: 'primitive',
|
|
1405
|
+
typeNamespace: 'nasl.core',
|
|
1406
|
+
typeName: 'String',
|
|
1407
|
+
},
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
concept: 'Constant',
|
|
1411
|
+
name: 'startBy',
|
|
1412
|
+
typeAnnotation: {
|
|
1413
|
+
concept: 'TypeAnnotation',
|
|
1414
|
+
typeKind: 'primitive',
|
|
1415
|
+
typeNamespace: 'nasl.core',
|
|
1416
|
+
typeName: 'String',
|
|
1417
|
+
},
|
|
1418
|
+
},
|
|
1419
|
+
],
|
|
1420
|
+
elements: [
|
|
1421
|
+
{
|
|
1422
|
+
concept: 'ProcessElement',
|
|
1423
|
+
name: 'Start',
|
|
1424
|
+
type: 'StartNoneEvent',
|
|
1425
|
+
bounds: {
|
|
1426
|
+
concept: 'Rect',
|
|
1427
|
+
x: 0,
|
|
1428
|
+
y: 0,
|
|
1429
|
+
},
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
concept: 'ProcessElement',
|
|
1433
|
+
name: 'InitiateTask',
|
|
1434
|
+
type: 'InitiateTask',
|
|
1435
|
+
title: '发起任务',
|
|
1436
|
+
...userTaskAttr,
|
|
1437
|
+
bounds: {
|
|
1438
|
+
concept: 'Rect',
|
|
1439
|
+
x: 0,
|
|
1440
|
+
y: 90,
|
|
1441
|
+
},
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
concept: 'ProcessElement',
|
|
1445
|
+
name: 'ApprovalTask',
|
|
1446
|
+
type: 'ApprovalTask',
|
|
1447
|
+
title: '审批任务',
|
|
1448
|
+
returns: [
|
|
1449
|
+
{
|
|
1450
|
+
concept: 'Return',
|
|
1451
|
+
description: '审批意见',
|
|
1452
|
+
name: 'approvalComment',
|
|
1453
|
+
typeAnnotation: {
|
|
1454
|
+
concept: 'TypeAnnotation',
|
|
1455
|
+
typeKind: 'primitive',
|
|
1456
|
+
typeNamespace: 'nasl.core',
|
|
1457
|
+
typeName: 'String',
|
|
1458
|
+
},
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
concept: 'Return',
|
|
1462
|
+
description: '审批结果',
|
|
1463
|
+
name: 'approvalResult',
|
|
1464
|
+
typeAnnotation: {
|
|
1465
|
+
concept: 'TypeAnnotation',
|
|
1466
|
+
typeKind: 'primitive',
|
|
1467
|
+
typeNamespace: 'nasl.core',
|
|
1468
|
+
typeName: 'String',
|
|
1469
|
+
},
|
|
1470
|
+
},
|
|
1471
|
+
],
|
|
1472
|
+
...userTaskAttr,
|
|
1473
|
+
bounds: {
|
|
1474
|
+
concept: 'Rect',
|
|
1475
|
+
x: 0,
|
|
1476
|
+
y: 250,
|
|
1477
|
+
},
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
concept: 'ProcessElement',
|
|
1481
|
+
name: 'End',
|
|
1482
|
+
type: 'EndNoneEvent',
|
|
1483
|
+
bounds: {
|
|
1484
|
+
concept: 'Rect',
|
|
1485
|
+
x: 0,
|
|
1486
|
+
y: 500,
|
|
1487
|
+
},
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
concept: 'ProcessElement',
|
|
1491
|
+
name: 'SequenceFlow',
|
|
1492
|
+
type: 'SequenceFlow',
|
|
1493
|
+
sourceRef: 'Start',
|
|
1494
|
+
targetRef: 'InitiateTask',
|
|
1495
|
+
waypoints: [
|
|
1496
|
+
{ x: 0, y: 1 },
|
|
1497
|
+
{ x: 0, y: -1 },
|
|
1498
|
+
],
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
concept: 'ProcessElement',
|
|
1502
|
+
name: 'SequenceFlow1',
|
|
1503
|
+
type: 'SequenceFlow',
|
|
1504
|
+
sourceRef: 'InitiateTask',
|
|
1505
|
+
targetRef: 'ApprovalTask',
|
|
1506
|
+
waypoints: [
|
|
1507
|
+
{ x: 0, y: 1 },
|
|
1508
|
+
{ x: 0, y: -1 },
|
|
1509
|
+
],
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
concept: 'ProcessElement',
|
|
1513
|
+
name: 'SequenceFlow2',
|
|
1514
|
+
type: 'SequenceFlow',
|
|
1515
|
+
sourceRef: 'ApprovalTask',
|
|
1516
|
+
targetRef: 'End',
|
|
1517
|
+
waypoints: [
|
|
1518
|
+
{ x: 0, y: 1 },
|
|
1519
|
+
{ x: 0, y: -1 },
|
|
1520
|
+
],
|
|
1521
|
+
},
|
|
1522
|
+
],
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
//= ===============================================================================
|
|
1526
|
+
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1527
|
+
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
1528
|
+
//= ===============================================================================
|
|
1466
1529
|
}
|
|
1467
1530
|
|
|
1468
1531
|
classMap.Process = Process;
|
|
1469
1532
|
export default Process;
|
|
1470
|
-
|
|
1533
|
+
//= ===============================================================================
|
|
1471
1534
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1472
1535
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
1473
|
-
|
|
1536
|
+
//= ===============================================================================
|
|
1474
1537
|
Process.prototype.setName = function (name: string) {
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
name,
|
|
1484
|
-
});
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
this.update({
|
|
1538
|
+
const App = this.rootNode;
|
|
1539
|
+
const oldName = this.name;
|
|
1540
|
+
App.emit('collect:start', {
|
|
1541
|
+
actionMsg: '设置名称',
|
|
1542
|
+
});
|
|
1543
|
+
syncMemberExpression(this, (node) => {
|
|
1544
|
+
if (node.object instanceof Identifier && node.object.name === oldName) {
|
|
1545
|
+
node.object.update({
|
|
1488
1546
|
name,
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
this.update({
|
|
1551
|
+
name,
|
|
1552
|
+
field: 'name',
|
|
1553
|
+
});
|
|
1554
|
+
App.emit('collect:end');
|
|
1492
1555
|
};
|