@lcap/nasl 3.2.0-beta.4 → 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/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 +1 -1
- package/out/common/BaseNode.js +105 -51
- 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 +286 -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 +40 -22
- 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 +101 -48
- 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 +99 -48
- 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 +71 -30
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +20 -19
- package/out/concepts/CallLogic__.js +155 -52
- 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 +8 -7
- 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 +239 -155
- 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 +91 -86
- package/out/concepts/ViewElement__.js +218 -146
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +92 -92
- package/out/concepts/View__.js +135 -60
- 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/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 +16 -14
- 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.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 +34 -16
- 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 +485 -465
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +4 -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 +13 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +19 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +22 -26
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +11 -12
- 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.js +10 -14
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +4 -7
- 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.js +12 -33
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +8 -10
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +12 -7
- 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 +2 -2
- package/out/templator/utils.js +21 -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 +11 -7
- package/sandbox/stdlib/nasl.auth.ts +49 -46
- package/sandbox/stdlib/nasl.http.ts +29 -31
- package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
- 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/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 +1102 -1024
- 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 -3671
- 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 +275 -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 +1057 -1007
- package/src/concepts/BindDirective__.ts +540 -542
- package/src/concepts/BindEvent__.ts +992 -911
- 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 -721
- package/src/concepts/CallLogic__.ts +1324 -1200
- package/src/concepts/CallQueryComponent__.ts +1580 -1501
- package/src/concepts/Comment__.ts +69 -68
- package/src/concepts/CompletionProperty__.ts +250 -255
- package/src/concepts/ConfigGroup__.ts +312 -296
- package/src/concepts/ConfigPropertyValue__.ts +92 -93
- 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 -2278
- 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 +2538 -2350
- package/src/concepts/View__.ts +2447 -2268
- package/src/concepts/WhileStatement__.ts +293 -272
- 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 +227 -218
- 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 -145
- 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 +390 -344
- 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 +4302 -4225
- package/src/server/naslStdlibMap.ts +43 -41
- 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 +332 -316
- package/src/templator/genCurdMultipleKeyBlock.ts +501 -473
- package/src/templator/genEditTableBlock.ts +192 -182
- package/src/templator/genEnumSelectBlock.ts +13 -7
- package/src/templator/genGetBlock.ts +57 -55
- package/src/templator/genGridViewBlock.ts +191 -201
- package/src/templator/genListViewBlock.ts +59 -64
- package/src/templator/genQueryComponent.ts +337 -287
- package/src/templator/genSelectBlock.ts +276 -285
- package/src/templator/genTableBlock.ts +157 -160
- package/src/templator/genUpdateBlock.ts +269 -255
- package/src/templator/index.ts +4 -4
- package/src/templator/utils.ts +490 -464
- 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/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/setup.ts +2 -1
- package/ts-worker/src/index.js +0 -2
- package/tsconfig.json +21 -21
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1
2
|
import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
|
|
2
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
genUserTaskLogic,
|
|
5
|
+
getPreviousTask,
|
|
6
|
+
syncMemberExpression,
|
|
7
|
+
getFlowAfterElements,
|
|
8
|
+
isFromStartNode,
|
|
9
|
+
getFlowBeforeElements,
|
|
10
|
+
} from '../server/getProcesses';
|
|
3
11
|
import Namespace from './Namespace__';
|
|
4
12
|
import View from './View__';
|
|
5
|
-
|
|
13
|
+
//= ===============================================================================
|
|
6
14
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
7
15
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
8
|
-
|
|
16
|
+
//= ===============================================================================
|
|
9
17
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
10
18
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
11
19
|
|
|
12
20
|
import * as utils from '../utils';
|
|
13
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
14
21
|
import BaseNode from '../common/BaseNode';
|
|
15
22
|
import classMap from '../common/classMap';
|
|
16
23
|
import BindEvent from './BindEvent__';
|
|
@@ -30,1804 +37,1869 @@ import App from './App__';
|
|
|
30
37
|
*/
|
|
31
38
|
@concept('流程元素')
|
|
32
39
|
export class ProcessElement extends BaseNode {
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const object = {
|
|
193
|
-
title,
|
|
194
|
-
};
|
|
195
|
-
this.update({
|
|
196
|
-
...object,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* 设置流程元素描述
|
|
202
|
-
*/
|
|
203
|
-
setDescription(description: string) {
|
|
204
|
-
const object = {
|
|
205
|
-
description,
|
|
206
|
-
};
|
|
207
|
-
this.update({
|
|
208
|
-
...object,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* 设置sourceRef
|
|
214
|
-
*/
|
|
215
|
-
setSourceRef(sourceRef: string) {
|
|
216
|
-
const object = {
|
|
217
|
-
sourceRef,
|
|
218
|
-
};
|
|
219
|
-
this.update({
|
|
220
|
-
...object,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* 设置targetRef
|
|
226
|
-
*/
|
|
227
|
-
setTargetRef(targetRef: string) {
|
|
228
|
-
const object = {
|
|
229
|
-
targetRef,
|
|
230
|
-
};
|
|
231
|
-
this.update({
|
|
232
|
-
...object,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* 设置矩形信息
|
|
238
|
-
*/
|
|
239
|
-
setBounds(bounds: Rect) {
|
|
240
|
-
bounds._delete();
|
|
241
|
-
const relationOptions = { parentNode: this, parentKey: 'bounds' };
|
|
242
|
-
Object.assign(bounds, relationOptions);
|
|
243
|
-
const object = {
|
|
244
|
-
bounds,
|
|
245
|
-
};
|
|
246
|
-
this.update({
|
|
247
|
-
...object,
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* 设置flowValue
|
|
253
|
-
*/
|
|
254
|
-
setFlowValue(flowValue: string) {
|
|
255
|
-
const object = {
|
|
256
|
-
flowValue,
|
|
257
|
-
};
|
|
258
|
-
this.update({
|
|
259
|
-
...object,
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
264
|
-
const excludedSet = new Set(excludedList);
|
|
265
|
-
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
266
|
-
}
|
|
267
|
-
getBindEventUniqueName(name = 'bindEvent1') {
|
|
268
|
-
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* 插入元素绑定事件
|
|
273
|
-
* @internal
|
|
274
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
275
|
-
*/
|
|
276
|
-
_insertBindEventAt(name: string, index: number): BindEvent;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 插入元素绑定事件
|
|
280
|
-
* @internal
|
|
281
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
282
|
-
*/
|
|
283
|
-
_insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 插入元素绑定事件
|
|
287
|
-
* @internal
|
|
288
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
289
|
-
*/
|
|
290
|
-
_insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
291
|
-
|
|
292
|
-
_insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
293
|
-
const bindEventOptions: any = {};
|
|
294
|
-
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
295
|
-
let bindEvent: BindEvent;
|
|
296
|
-
if (!options) {
|
|
297
|
-
bindEvent = BindEvent.from({
|
|
298
|
-
...bindEventOptions,
|
|
299
|
-
name: this.getBindEventUniqueName(),
|
|
300
|
-
}, this, 'bindEvents');
|
|
301
|
-
} else if (typeof options === 'string') {
|
|
302
|
-
bindEvent = BindEvent.from({
|
|
303
|
-
...bindEventOptions,
|
|
304
|
-
name: options,
|
|
305
|
-
}, this, 'bindEvents');
|
|
306
|
-
} else if (options instanceof BindEvent) {
|
|
307
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
308
|
-
bindEvent = options;
|
|
309
|
-
Object.assign(bindEvent, relationOptions);
|
|
310
|
-
} else {
|
|
311
|
-
bindEvent = BindEvent.from({
|
|
312
|
-
...bindEventOptions,
|
|
313
|
-
...options,
|
|
314
|
-
}, this, 'bindEvents');
|
|
315
|
-
}
|
|
316
|
-
this.bindEvents.splice(index, 0, bindEvent);
|
|
317
|
-
return bindEvent;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* 插入元素绑定事件
|
|
322
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
323
|
-
*/
|
|
324
|
-
insertBindEventAt(name: string, index: number): BindEvent;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* 插入元素绑定事件
|
|
328
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
329
|
-
*/
|
|
330
|
-
insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* 插入元素绑定事件
|
|
334
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
335
|
-
*/
|
|
336
|
-
insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
337
|
-
|
|
338
|
-
insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
339
|
-
const node = this._insertBindEventAt(options as any, index);
|
|
340
|
-
node.create({
|
|
341
|
-
index,
|
|
342
|
-
parentNode: this,
|
|
343
|
-
parentKey: 'bindEvents',
|
|
344
|
-
});
|
|
345
|
-
return node;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* 添加元素绑定事件
|
|
350
|
-
* @internal
|
|
351
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
352
|
-
*/
|
|
353
|
-
_addBindEvent(name?: string): BindEvent;
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* 添加元素绑定事件
|
|
357
|
-
* @internal
|
|
358
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
359
|
-
*/
|
|
360
|
-
_addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* 添加元素绑定事件
|
|
364
|
-
* @internal
|
|
365
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
366
|
-
*/
|
|
367
|
-
_addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
368
|
-
|
|
369
|
-
_addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
370
|
-
const index = this.bindEvents.length;
|
|
371
|
-
return this._insertBindEventAt(options as any, index);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* 添加元素绑定事件
|
|
376
|
-
* @internal
|
|
377
|
-
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
378
|
-
*/
|
|
379
|
-
addBindEvent(name?: string): BindEvent;
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* 添加元素绑定事件
|
|
383
|
-
* @param bindEventOptions 元素绑定事件参数
|
|
384
|
-
*/
|
|
385
|
-
addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* 添加元素绑定事件
|
|
389
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
390
|
-
*/
|
|
391
|
-
addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
392
|
-
|
|
393
|
-
addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
394
|
-
const node = this._addBindEvent(options as any);
|
|
395
|
-
const index = this.bindEvents.indexOf(node);
|
|
396
|
-
node.create({
|
|
397
|
-
index,
|
|
398
|
-
parentNode: this,
|
|
399
|
-
parentKey: 'bindEvents',
|
|
400
|
-
});
|
|
401
|
-
return node;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
getPointExistingNames(excludedList: Array<Point> = []) {
|
|
406
|
-
const excludedSet = new Set(excludedList);
|
|
407
|
-
return ((this.waypoints as Point[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
408
|
-
}
|
|
409
|
-
getPointUniqueName(name = 'point1') {
|
|
410
|
-
return utils.unique(name, this.getPointExistingNames(), undefined, false);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* 插入点信息
|
|
415
|
-
* @internal
|
|
416
|
-
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
417
|
-
*/
|
|
418
|
-
_insertPointAt(name: string, index: number): Point;
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* 插入点信息
|
|
422
|
-
* @internal
|
|
423
|
-
* @param pointOptions 点信息参数
|
|
424
|
-
*/
|
|
425
|
-
_insertPointAt(pointOptions: Partial<Point>, index: number): Point;
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* 插入点信息
|
|
429
|
-
* @internal
|
|
430
|
-
* @param point 已有的点信息实例
|
|
431
|
-
*/
|
|
432
|
-
_insertPointAt(point: Point, index: number): Point;
|
|
433
|
-
|
|
434
|
-
_insertPointAt(options: string | Partial<Point> | Point, index: number) {
|
|
435
|
-
const pointOptions: any = {};
|
|
436
|
-
const relationOptions = { parentNode: this, parentKey: 'waypoints' };
|
|
437
|
-
let point: Point;
|
|
438
|
-
if (!options) {
|
|
439
|
-
point = Point.from({
|
|
440
|
-
...pointOptions,
|
|
441
|
-
name: this.getPointUniqueName(),
|
|
442
|
-
}, this, 'waypoints');
|
|
443
|
-
} else if (typeof options === 'string') {
|
|
444
|
-
point = Point.from({
|
|
445
|
-
...pointOptions,
|
|
446
|
-
name: options,
|
|
447
|
-
}, this, 'waypoints');
|
|
448
|
-
} else if (options instanceof Point) {
|
|
449
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
450
|
-
point = options;
|
|
451
|
-
Object.assign(point, relationOptions);
|
|
452
|
-
} else {
|
|
453
|
-
point = Point.from({
|
|
454
|
-
...pointOptions,
|
|
455
|
-
...options,
|
|
456
|
-
}, this, 'waypoints');
|
|
457
|
-
}
|
|
458
|
-
this.waypoints.splice(index, 0, point);
|
|
459
|
-
return point;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* 插入点信息
|
|
464
|
-
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
465
|
-
*/
|
|
466
|
-
insertPointAt(name: string, index: number): Point;
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* 插入点信息
|
|
470
|
-
* @param pointOptions 点信息参数
|
|
471
|
-
*/
|
|
472
|
-
insertPointAt(pointOptions: Partial<Point>, index: number): Point;
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* 插入点信息
|
|
476
|
-
* @param point 已有的点信息实例
|
|
477
|
-
*/
|
|
478
|
-
insertPointAt(point: Point, index: number): Point;
|
|
479
|
-
|
|
480
|
-
insertPointAt(options: string | Partial<Point> | Point, index: number) {
|
|
481
|
-
const node = this._insertPointAt(options as any, index);
|
|
482
|
-
node.create({
|
|
483
|
-
index,
|
|
484
|
-
parentNode: this,
|
|
485
|
-
parentKey: 'waypoints',
|
|
486
|
-
});
|
|
487
|
-
return node;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* 添加点信息
|
|
492
|
-
* @internal
|
|
493
|
-
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
494
|
-
*/
|
|
495
|
-
_addPoint(name?: string): Point;
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* 添加点信息
|
|
499
|
-
* @internal
|
|
500
|
-
* @param pointOptions 点信息参数
|
|
501
|
-
*/
|
|
502
|
-
_addPoint(pointOptions: Partial<Point>): Point;
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* 添加点信息
|
|
506
|
-
* @internal
|
|
507
|
-
* @param point 已有的点信息实例
|
|
508
|
-
*/
|
|
509
|
-
_addPoint(point: Point): Point;
|
|
510
|
-
|
|
511
|
-
_addPoint(options?: string | Partial<Point> | Point) {
|
|
512
|
-
const index = this.waypoints.length;
|
|
513
|
-
return this._insertPointAt(options as any, index);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* 添加点信息
|
|
518
|
-
* @internal
|
|
519
|
-
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
520
|
-
*/
|
|
521
|
-
addPoint(name?: string): Point;
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* 添加点信息
|
|
525
|
-
* @param pointOptions 点信息参数
|
|
526
|
-
*/
|
|
527
|
-
addPoint(pointOptions: Partial<Point>): Point;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* 添加点信息
|
|
531
|
-
* @param point 已有的点信息实例
|
|
532
|
-
*/
|
|
533
|
-
addPoint(point: Point): Point;
|
|
534
|
-
|
|
535
|
-
addPoint(options?: string | Partial<Point> | Point) {
|
|
536
|
-
const node = this._addPoint(options as any);
|
|
537
|
-
const index = this.waypoints.indexOf(node);
|
|
538
|
-
node.create({
|
|
539
|
-
index,
|
|
540
|
-
parentNode: this,
|
|
541
|
-
parentKey: 'waypoints',
|
|
542
|
-
});
|
|
543
|
-
return node;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
getVariableExistingNames(excludedList: Array<Variable> = []) {
|
|
548
|
-
const excludedSet = new Set(excludedList);
|
|
549
|
-
return ((this.variables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
550
|
-
}
|
|
551
|
-
getVariableUniqueName(name = 'variable1') {
|
|
552
|
-
return utils.unique(name, this.getVariableExistingNames(), undefined, false);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* 插入变量
|
|
557
|
-
* @internal
|
|
558
|
-
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
559
|
-
*/
|
|
560
|
-
_insertVariableAt(name: string, index: number): Variable;
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* 插入变量
|
|
564
|
-
* @internal
|
|
565
|
-
* @param variableOptions 变量参数
|
|
566
|
-
*/
|
|
567
|
-
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* 插入变量
|
|
571
|
-
* @internal
|
|
572
|
-
* @param variable 已有的变量实例
|
|
573
|
-
*/
|
|
574
|
-
_insertVariableAt(variable: Variable, index: number): Variable;
|
|
575
|
-
|
|
576
|
-
_insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
577
|
-
const variableOptions: any = {};
|
|
578
|
-
const relationOptions = { parentNode: this, parentKey: 'variables' };
|
|
579
|
-
let variable: Variable;
|
|
580
|
-
if (!options) {
|
|
581
|
-
variable = Variable.from({
|
|
582
|
-
...variableOptions,
|
|
583
|
-
name: this.getVariableUniqueName(),
|
|
584
|
-
}, this, 'variables');
|
|
585
|
-
} else if (typeof options === 'string') {
|
|
586
|
-
variable = Variable.from({
|
|
587
|
-
...variableOptions,
|
|
588
|
-
name: options,
|
|
589
|
-
}, this, 'variables');
|
|
590
|
-
} else if (options instanceof Variable) {
|
|
591
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
592
|
-
variable = options;
|
|
593
|
-
Object.assign(variable, relationOptions);
|
|
594
|
-
} else {
|
|
595
|
-
variable = Variable.from({
|
|
596
|
-
...variableOptions,
|
|
597
|
-
...options,
|
|
598
|
-
}, this, 'variables');
|
|
599
|
-
}
|
|
600
|
-
this.variables.splice(index, 0, variable);
|
|
601
|
-
return variable;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* 插入变量
|
|
606
|
-
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
607
|
-
*/
|
|
608
|
-
insertVariableAt(name: string, index: number): Variable;
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* 插入变量
|
|
612
|
-
* @param variableOptions 变量参数
|
|
613
|
-
*/
|
|
614
|
-
insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* 插入变量
|
|
618
|
-
* @param variable 已有的变量实例
|
|
619
|
-
*/
|
|
620
|
-
insertVariableAt(variable: Variable, index: number): Variable;
|
|
621
|
-
|
|
622
|
-
insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
623
|
-
const node = this._insertVariableAt(options as any, index);
|
|
624
|
-
node.create({
|
|
625
|
-
index,
|
|
626
|
-
parentNode: this,
|
|
627
|
-
parentKey: 'variables',
|
|
628
|
-
});
|
|
629
|
-
return node;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* 添加变量
|
|
634
|
-
* @internal
|
|
635
|
-
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
636
|
-
*/
|
|
637
|
-
_addVariable(name?: string): Variable;
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* 添加变量
|
|
641
|
-
* @internal
|
|
642
|
-
* @param variableOptions 变量参数
|
|
643
|
-
*/
|
|
644
|
-
_addVariable(variableOptions: Partial<Variable>): Variable;
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* 添加变量
|
|
648
|
-
* @internal
|
|
649
|
-
* @param variable 已有的变量实例
|
|
650
|
-
*/
|
|
651
|
-
_addVariable(variable: Variable): Variable;
|
|
652
|
-
|
|
653
|
-
_addVariable(options?: string | Partial<Variable> | Variable) {
|
|
654
|
-
const index = this.variables.length;
|
|
655
|
-
return this._insertVariableAt(options as any, index);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* 添加变量
|
|
660
|
-
* @internal
|
|
661
|
-
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
662
|
-
*/
|
|
663
|
-
addVariable(name?: string): Variable;
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* 添加变量
|
|
667
|
-
* @param variableOptions 变量参数
|
|
668
|
-
*/
|
|
669
|
-
addVariable(variableOptions: Partial<Variable>): Variable;
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* 添加变量
|
|
673
|
-
* @param variable 已有的变量实例
|
|
674
|
-
*/
|
|
675
|
-
addVariable(variable: Variable): Variable;
|
|
676
|
-
|
|
677
|
-
addVariable(options?: string | Partial<Variable> | Variable) {
|
|
678
|
-
const node = this._addVariable(options as any);
|
|
679
|
-
const index = this.variables.indexOf(node);
|
|
680
|
-
node.create({
|
|
681
|
-
index,
|
|
682
|
-
parentNode: this,
|
|
683
|
-
parentKey: 'variables',
|
|
684
|
-
});
|
|
685
|
-
return node;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
getReturnExistingNames(excludedList: Array<Return> = []) {
|
|
690
|
-
const excludedSet = new Set(excludedList);
|
|
691
|
-
return ((this.returns as Return[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
692
|
-
}
|
|
693
|
-
getReturnUniqueName(name = 'ret1') {
|
|
694
|
-
return utils.unique(name, this.getReturnExistingNames(), undefined, false);
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* 插入输出参数
|
|
699
|
-
* @internal
|
|
700
|
-
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
701
|
-
*/
|
|
702
|
-
_insertReturnAt(name: string, index: number): Return;
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* 插入输出参数
|
|
706
|
-
* @internal
|
|
707
|
-
* @param retOptions 输出参数参数
|
|
708
|
-
*/
|
|
709
|
-
_insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
* 插入输出参数
|
|
713
|
-
* @internal
|
|
714
|
-
* @param ret 已有的输出参数实例
|
|
715
|
-
*/
|
|
716
|
-
_insertReturnAt(ret: Return, index: number): Return;
|
|
717
|
-
|
|
718
|
-
_insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
719
|
-
const retOptions: any = {};
|
|
720
|
-
const relationOptions = { parentNode: this, parentKey: 'returns' };
|
|
721
|
-
let ret: Return;
|
|
722
|
-
if (!options) {
|
|
723
|
-
ret = Return.from({
|
|
724
|
-
...retOptions,
|
|
725
|
-
name: this.getReturnUniqueName(),
|
|
726
|
-
}, this, 'returns');
|
|
727
|
-
} else if (typeof options === 'string') {
|
|
728
|
-
ret = Return.from({
|
|
729
|
-
...retOptions,
|
|
730
|
-
name: options,
|
|
731
|
-
}, this, 'returns');
|
|
732
|
-
} else if (options instanceof Return) {
|
|
733
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
734
|
-
ret = options;
|
|
735
|
-
Object.assign(ret, relationOptions);
|
|
736
|
-
} else {
|
|
737
|
-
ret = Return.from({
|
|
738
|
-
...retOptions,
|
|
739
|
-
...options,
|
|
740
|
-
}, this, 'returns');
|
|
741
|
-
}
|
|
742
|
-
this.returns.splice(index, 0, ret);
|
|
743
|
-
return ret;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* 插入输出参数
|
|
748
|
-
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
749
|
-
*/
|
|
750
|
-
insertReturnAt(name: string, index: number): Return;
|
|
751
|
-
|
|
752
|
-
/**
|
|
753
|
-
* 插入输出参数
|
|
754
|
-
* @param retOptions 输出参数参数
|
|
755
|
-
*/
|
|
756
|
-
insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* 插入输出参数
|
|
760
|
-
* @param ret 已有的输出参数实例
|
|
761
|
-
*/
|
|
762
|
-
insertReturnAt(ret: Return, index: number): Return;
|
|
763
|
-
|
|
764
|
-
insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
765
|
-
const node = this._insertReturnAt(options as any, index);
|
|
766
|
-
node.create({
|
|
767
|
-
index,
|
|
768
|
-
parentNode: this,
|
|
769
|
-
parentKey: 'returns',
|
|
770
|
-
});
|
|
771
|
-
return node;
|
|
772
|
-
}
|
|
40
|
+
/**
|
|
41
|
+
* 产品概念
|
|
42
|
+
*/
|
|
43
|
+
@property()
|
|
44
|
+
concept: 'ProcessElement' = 'ProcessElement';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 流程元素名称
|
|
48
|
+
*/
|
|
49
|
+
@property()
|
|
50
|
+
name: string = undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 流程元素标题
|
|
54
|
+
*/
|
|
55
|
+
@property()
|
|
56
|
+
title: string = undefined;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 流程元素描述
|
|
60
|
+
*/
|
|
61
|
+
@property()
|
|
62
|
+
description: string = undefined;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 元素绑定事件列表
|
|
66
|
+
*/
|
|
67
|
+
@property('BindEvent')
|
|
68
|
+
bindEvents: Array<BindEvent> = [];
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* type
|
|
72
|
+
*/
|
|
73
|
+
@property()
|
|
74
|
+
type: string = undefined;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* sourceRef
|
|
78
|
+
*/
|
|
79
|
+
@property()
|
|
80
|
+
sourceRef: string = undefined;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* targetRef
|
|
84
|
+
*/
|
|
85
|
+
@property()
|
|
86
|
+
targetRef: string = undefined;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 矩形信息
|
|
90
|
+
*/
|
|
91
|
+
@property('Rect')
|
|
92
|
+
bounds: Rect = undefined;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 点信息列表
|
|
96
|
+
*/
|
|
97
|
+
@property('Point')
|
|
98
|
+
waypoints: Array<Point> = [];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* flowValue
|
|
102
|
+
*/
|
|
103
|
+
@property()
|
|
104
|
+
flowValue: string = undefined;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 逻辑
|
|
108
|
+
*/
|
|
109
|
+
@property('Logic')
|
|
110
|
+
logic: Logic = undefined;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 变量列表
|
|
114
|
+
*/
|
|
115
|
+
@property('Variable')
|
|
116
|
+
variables: Array<Variable> = [];
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 输出参数列表
|
|
120
|
+
*/
|
|
121
|
+
@property('Return')
|
|
122
|
+
returns: Array<Return> = [];
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 常量列表
|
|
126
|
+
*/
|
|
127
|
+
@property('Constant')
|
|
128
|
+
constants: Array<Constant> = [];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 元素绑定属性列表
|
|
132
|
+
*/
|
|
133
|
+
@property('BindAttribute')
|
|
134
|
+
bindAttrs: Array<BindAttribute> = [];
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 祖先 Process
|
|
138
|
+
*/
|
|
139
|
+
get process() {
|
|
140
|
+
return this.getAncestor('Process') as Process;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 祖先 Module
|
|
145
|
+
*/
|
|
146
|
+
get module() {
|
|
147
|
+
return this.getAncestor('Module') as Module;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 祖先 App
|
|
152
|
+
*/
|
|
153
|
+
get app() {
|
|
154
|
+
return this.getAncestor('App') as App;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @param source 需要合并的部分参数
|
|
159
|
+
*/
|
|
160
|
+
constructor(source?: Partial<ProcessElement>) {
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
source = { ...ProcessElement.getDefaultOptions(), ...source };
|
|
163
|
+
super(source);
|
|
164
|
+
super.subConstructor(source);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
getClassName() {
|
|
168
|
+
return 'ProcessElement';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static from(source: any, parentNode?: any, parentKey?: string): ProcessElement {
|
|
172
|
+
return super.from(source, parentNode, parentKey) as ProcessElement;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 从父级删除该节点
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
_delete() {
|
|
180
|
+
let params: Params = null;
|
|
181
|
+
if (this.parentNode) {
|
|
182
|
+
params = (this.parentNode as any)?.__removeProcessElement?.(this);
|
|
183
|
+
}
|
|
184
|
+
return params;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 设置流程元素名称
|
|
189
|
+
*/
|
|
190
|
+
setName(name: string) {
|
|
191
|
+
const object = {
|
|
192
|
+
name,
|
|
193
|
+
};
|
|
194
|
+
this.update({
|
|
195
|
+
...object,
|
|
196
|
+
field: 'name',
|
|
197
|
+
});
|
|
198
|
+
}
|
|
773
199
|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
*/
|
|
786
|
-
_addReturn(retOptions: Partial<Return>): Return;
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* 添加输出参数
|
|
790
|
-
* @internal
|
|
791
|
-
* @param ret 已有的输出参数实例
|
|
792
|
-
*/
|
|
793
|
-
_addReturn(ret: Return): Return;
|
|
794
|
-
|
|
795
|
-
_addReturn(options?: string | Partial<Return> | Return) {
|
|
796
|
-
const index = this.returns.length;
|
|
797
|
-
return this._insertReturnAt(options as any, index);
|
|
798
|
-
}
|
|
200
|
+
/**
|
|
201
|
+
* 设置流程元素标题
|
|
202
|
+
*/
|
|
203
|
+
setTitle(title: string) {
|
|
204
|
+
const object = {
|
|
205
|
+
title,
|
|
206
|
+
};
|
|
207
|
+
this.update({
|
|
208
|
+
...object,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
799
211
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
addReturn(retOptions: Partial<Return>): Return;
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* 添加输出参数
|
|
815
|
-
* @param ret 已有的输出参数实例
|
|
816
|
-
*/
|
|
817
|
-
addReturn(ret: Return): Return;
|
|
818
|
-
|
|
819
|
-
addReturn(options?: string | Partial<Return> | Return) {
|
|
820
|
-
const node = this._addReturn(options as any);
|
|
821
|
-
const index = this.returns.indexOf(node);
|
|
822
|
-
node.create({
|
|
823
|
-
index,
|
|
824
|
-
parentNode: this,
|
|
825
|
-
parentKey: 'returns',
|
|
826
|
-
});
|
|
827
|
-
return node;
|
|
828
|
-
}
|
|
212
|
+
/**
|
|
213
|
+
* 设置流程元素描述
|
|
214
|
+
*/
|
|
215
|
+
setDescription(description: string) {
|
|
216
|
+
const object = {
|
|
217
|
+
description,
|
|
218
|
+
};
|
|
219
|
+
this.update({
|
|
220
|
+
...object,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
829
223
|
|
|
224
|
+
/**
|
|
225
|
+
* 设置sourceRef
|
|
226
|
+
*/
|
|
227
|
+
setSourceRef(sourceRef: string) {
|
|
228
|
+
const object = {
|
|
229
|
+
sourceRef,
|
|
230
|
+
};
|
|
231
|
+
this.update({
|
|
232
|
+
...object,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
830
235
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
236
|
+
/**
|
|
237
|
+
* 设置targetRef
|
|
238
|
+
*/
|
|
239
|
+
setTargetRef(targetRef: string) {
|
|
240
|
+
const object = {
|
|
241
|
+
targetRef,
|
|
242
|
+
};
|
|
243
|
+
this.update({
|
|
244
|
+
...object,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* 设置矩形信息
|
|
250
|
+
*/
|
|
251
|
+
setBounds(bounds: Rect) {
|
|
252
|
+
bounds._delete();
|
|
253
|
+
const relationOptions = { parentNode: this, parentKey: 'bounds' };
|
|
254
|
+
Object.assign(bounds, relationOptions);
|
|
255
|
+
const object = {
|
|
256
|
+
bounds,
|
|
257
|
+
};
|
|
258
|
+
this.update({
|
|
259
|
+
...object,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
838
262
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
263
|
+
/**
|
|
264
|
+
* 设置flowValue
|
|
265
|
+
*/
|
|
266
|
+
setFlowValue(flowValue: string) {
|
|
267
|
+
const object = {
|
|
268
|
+
flowValue,
|
|
269
|
+
};
|
|
270
|
+
this.update({
|
|
271
|
+
...object,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
276
|
+
const excludedSet = new Set(excludedList);
|
|
277
|
+
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
getBindEventUniqueName(name = 'bindEvent1') {
|
|
281
|
+
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 插入元素绑定事件
|
|
286
|
+
* @internal
|
|
287
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
288
|
+
*/
|
|
289
|
+
_insertBindEventAt(name: string, index: number): BindEvent;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 插入元素绑定事件
|
|
293
|
+
* @internal
|
|
294
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
295
|
+
*/
|
|
296
|
+
_insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* 插入元素绑定事件
|
|
300
|
+
* @internal
|
|
301
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
302
|
+
*/
|
|
303
|
+
_insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
304
|
+
|
|
305
|
+
_insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
306
|
+
const bindEventOptions: any = {};
|
|
307
|
+
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
308
|
+
let bindEvent: BindEvent;
|
|
309
|
+
if (!options) {
|
|
310
|
+
bindEvent = BindEvent.from(
|
|
311
|
+
{
|
|
312
|
+
...bindEventOptions,
|
|
313
|
+
name: this.getBindEventUniqueName(),
|
|
314
|
+
},
|
|
315
|
+
this,
|
|
316
|
+
'bindEvents'
|
|
317
|
+
);
|
|
318
|
+
} else if (typeof options === 'string') {
|
|
319
|
+
bindEvent = BindEvent.from(
|
|
320
|
+
{
|
|
321
|
+
...bindEventOptions,
|
|
322
|
+
name: options,
|
|
323
|
+
},
|
|
324
|
+
this,
|
|
325
|
+
'bindEvents'
|
|
326
|
+
);
|
|
327
|
+
} else if (options instanceof BindEvent) {
|
|
328
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
329
|
+
bindEvent = options;
|
|
330
|
+
Object.assign(bindEvent, relationOptions);
|
|
331
|
+
} else {
|
|
332
|
+
bindEvent = BindEvent.from(
|
|
333
|
+
{
|
|
334
|
+
...bindEventOptions,
|
|
335
|
+
...options,
|
|
336
|
+
},
|
|
337
|
+
this,
|
|
338
|
+
'bindEvents'
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
this.bindEvents.splice(index, 0, bindEvent);
|
|
342
|
+
return bindEvent;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* 插入元素绑定事件
|
|
347
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
348
|
+
*/
|
|
349
|
+
insertBindEventAt(name: string, index: number): BindEvent;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* 插入元素绑定事件
|
|
353
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
354
|
+
*/
|
|
355
|
+
insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* 插入元素绑定事件
|
|
359
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
360
|
+
*/
|
|
361
|
+
insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
362
|
+
|
|
363
|
+
insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
364
|
+
const node = this._insertBindEventAt(options as any, index);
|
|
365
|
+
node.create({
|
|
366
|
+
index,
|
|
367
|
+
parentNode: this,
|
|
368
|
+
parentKey: 'bindEvents',
|
|
369
|
+
});
|
|
370
|
+
return node;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* 添加元素绑定事件
|
|
375
|
+
* @internal
|
|
376
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
377
|
+
*/
|
|
378
|
+
_addBindEvent(name?: string): BindEvent;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* 添加元素绑定事件
|
|
382
|
+
* @internal
|
|
383
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
384
|
+
*/
|
|
385
|
+
_addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* 添加元素绑定事件
|
|
389
|
+
* @internal
|
|
390
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
391
|
+
*/
|
|
392
|
+
_addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
393
|
+
|
|
394
|
+
_addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
395
|
+
const index = this.bindEvents.length;
|
|
396
|
+
return this._insertBindEventAt(options as any, index);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* 添加元素绑定事件
|
|
401
|
+
* @internal
|
|
402
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
403
|
+
*/
|
|
404
|
+
addBindEvent(name?: string): BindEvent;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* 添加元素绑定事件
|
|
408
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
409
|
+
*/
|
|
410
|
+
addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* 添加元素绑定事件
|
|
414
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
415
|
+
*/
|
|
416
|
+
addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
417
|
+
|
|
418
|
+
addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
419
|
+
const node = this._addBindEvent(options as any);
|
|
420
|
+
const index = this.bindEvents.indexOf(node);
|
|
421
|
+
node.create({
|
|
422
|
+
index,
|
|
423
|
+
parentNode: this,
|
|
424
|
+
parentKey: 'bindEvents',
|
|
425
|
+
});
|
|
426
|
+
return node;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
getPointExistingNames(excludedList: Array<Point> = []) {
|
|
430
|
+
const excludedSet = new Set(excludedList);
|
|
431
|
+
return ((this.waypoints as Point[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
getPointUniqueName(name = 'point1') {
|
|
435
|
+
return utils.unique(name, this.getPointExistingNames(), undefined, false);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* 插入点信息
|
|
440
|
+
* @internal
|
|
441
|
+
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
442
|
+
*/
|
|
443
|
+
_insertPointAt(name: string, index: number): Point;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 插入点信息
|
|
447
|
+
* @internal
|
|
448
|
+
* @param pointOptions 点信息参数
|
|
449
|
+
*/
|
|
450
|
+
_insertPointAt(pointOptions: Partial<Point>, index: number): Point;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* 插入点信息
|
|
454
|
+
* @internal
|
|
455
|
+
* @param point 已有的点信息实例
|
|
456
|
+
*/
|
|
457
|
+
_insertPointAt(point: Point, index: number): Point;
|
|
458
|
+
|
|
459
|
+
_insertPointAt(options: string | Partial<Point> | Point, index: number) {
|
|
460
|
+
const pointOptions: any = {};
|
|
461
|
+
const relationOptions = { parentNode: this, parentKey: 'waypoints' };
|
|
462
|
+
let point: Point;
|
|
463
|
+
if (!options) {
|
|
464
|
+
point = Point.from(
|
|
465
|
+
{
|
|
466
|
+
...pointOptions,
|
|
467
|
+
name: this.getPointUniqueName(),
|
|
468
|
+
},
|
|
469
|
+
this,
|
|
470
|
+
'waypoints'
|
|
471
|
+
);
|
|
472
|
+
} else if (typeof options === 'string') {
|
|
473
|
+
point = Point.from(
|
|
474
|
+
{
|
|
475
|
+
...pointOptions,
|
|
476
|
+
name: options,
|
|
477
|
+
},
|
|
478
|
+
this,
|
|
479
|
+
'waypoints'
|
|
480
|
+
);
|
|
481
|
+
} else if (options instanceof Point) {
|
|
482
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
483
|
+
point = options;
|
|
484
|
+
Object.assign(point, relationOptions);
|
|
485
|
+
} else {
|
|
486
|
+
point = Point.from(
|
|
487
|
+
{
|
|
488
|
+
...pointOptions,
|
|
489
|
+
...options,
|
|
490
|
+
},
|
|
491
|
+
this,
|
|
492
|
+
'waypoints'
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
this.waypoints.splice(index, 0, point);
|
|
496
|
+
return point;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* 插入点信息
|
|
501
|
+
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
502
|
+
*/
|
|
503
|
+
insertPointAt(name: string, index: number): Point;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* 插入点信息
|
|
507
|
+
* @param pointOptions 点信息参数
|
|
508
|
+
*/
|
|
509
|
+
insertPointAt(pointOptions: Partial<Point>, index: number): Point;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* 插入点信息
|
|
513
|
+
* @param point 已有的点信息实例
|
|
514
|
+
*/
|
|
515
|
+
insertPointAt(point: Point, index: number): Point;
|
|
516
|
+
|
|
517
|
+
insertPointAt(options: string | Partial<Point> | Point, index: number) {
|
|
518
|
+
const node = this._insertPointAt(options as any, index);
|
|
519
|
+
node.create({
|
|
520
|
+
index,
|
|
521
|
+
parentNode: this,
|
|
522
|
+
parentKey: 'waypoints',
|
|
523
|
+
});
|
|
524
|
+
return node;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* 添加点信息
|
|
529
|
+
* @internal
|
|
530
|
+
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
531
|
+
*/
|
|
532
|
+
_addPoint(name?: string): Point;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* 添加点信息
|
|
536
|
+
* @internal
|
|
537
|
+
* @param pointOptions 点信息参数
|
|
538
|
+
*/
|
|
539
|
+
_addPoint(pointOptions: Partial<Point>): Point;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* 添加点信息
|
|
543
|
+
* @internal
|
|
544
|
+
* @param point 已有的点信息实例
|
|
545
|
+
*/
|
|
546
|
+
_addPoint(point: Point): Point;
|
|
547
|
+
|
|
548
|
+
_addPoint(options?: string | Partial<Point> | Point) {
|
|
549
|
+
const index = this.waypoints.length;
|
|
550
|
+
return this._insertPointAt(options as any, index);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* 添加点信息
|
|
555
|
+
* @internal
|
|
556
|
+
* @param name 点信息名称,如果不填会自动生成一个唯一名称
|
|
557
|
+
*/
|
|
558
|
+
addPoint(name?: string): Point;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* 添加点信息
|
|
562
|
+
* @param pointOptions 点信息参数
|
|
563
|
+
*/
|
|
564
|
+
addPoint(pointOptions: Partial<Point>): Point;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* 添加点信息
|
|
568
|
+
* @param point 已有的点信息实例
|
|
569
|
+
*/
|
|
570
|
+
addPoint(point: Point): Point;
|
|
571
|
+
|
|
572
|
+
addPoint(options?: string | Partial<Point> | Point) {
|
|
573
|
+
const node = this._addPoint(options as any);
|
|
574
|
+
const index = this.waypoints.indexOf(node);
|
|
575
|
+
node.create({
|
|
576
|
+
index,
|
|
577
|
+
parentNode: this,
|
|
578
|
+
parentKey: 'waypoints',
|
|
579
|
+
});
|
|
580
|
+
return node;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
getVariableExistingNames(excludedList: Array<Variable> = []) {
|
|
584
|
+
const excludedSet = new Set(excludedList);
|
|
585
|
+
return ((this.variables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
getVariableUniqueName(name = 'variable1') {
|
|
589
|
+
return utils.unique(name, this.getVariableExistingNames(), undefined, false);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* 插入变量
|
|
594
|
+
* @internal
|
|
595
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
596
|
+
*/
|
|
597
|
+
_insertVariableAt(name: string, index: number): Variable;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* 插入变量
|
|
601
|
+
* @internal
|
|
602
|
+
* @param variableOptions 变量参数
|
|
603
|
+
*/
|
|
604
|
+
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* 插入变量
|
|
608
|
+
* @internal
|
|
609
|
+
* @param variable 已有的变量实例
|
|
610
|
+
*/
|
|
611
|
+
_insertVariableAt(variable: Variable, index: number): Variable;
|
|
612
|
+
|
|
613
|
+
_insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
614
|
+
const variableOptions: any = {};
|
|
615
|
+
const relationOptions = { parentNode: this, parentKey: 'variables' };
|
|
616
|
+
let variable: Variable;
|
|
617
|
+
if (!options) {
|
|
618
|
+
variable = Variable.from(
|
|
619
|
+
{
|
|
620
|
+
...variableOptions,
|
|
621
|
+
name: this.getVariableUniqueName(),
|
|
622
|
+
},
|
|
623
|
+
this,
|
|
624
|
+
'variables'
|
|
625
|
+
);
|
|
626
|
+
} else if (typeof options === 'string') {
|
|
627
|
+
variable = Variable.from(
|
|
628
|
+
{
|
|
629
|
+
...variableOptions,
|
|
630
|
+
name: options,
|
|
631
|
+
},
|
|
632
|
+
this,
|
|
633
|
+
'variables'
|
|
634
|
+
);
|
|
635
|
+
} else if (options instanceof Variable) {
|
|
636
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
637
|
+
variable = options;
|
|
638
|
+
Object.assign(variable, relationOptions);
|
|
639
|
+
} else {
|
|
640
|
+
variable = Variable.from(
|
|
641
|
+
{
|
|
642
|
+
...variableOptions,
|
|
643
|
+
...options,
|
|
644
|
+
},
|
|
645
|
+
this,
|
|
646
|
+
'variables'
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
this.variables.splice(index, 0, variable);
|
|
650
|
+
return variable;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* 插入变量
|
|
655
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
656
|
+
*/
|
|
657
|
+
insertVariableAt(name: string, index: number): Variable;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* 插入变量
|
|
661
|
+
* @param variableOptions 变量参数
|
|
662
|
+
*/
|
|
663
|
+
insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* 插入变量
|
|
667
|
+
* @param variable 已有的变量实例
|
|
668
|
+
*/
|
|
669
|
+
insertVariableAt(variable: Variable, index: number): Variable;
|
|
670
|
+
|
|
671
|
+
insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
672
|
+
const node = this._insertVariableAt(options as any, index);
|
|
673
|
+
node.create({
|
|
674
|
+
index,
|
|
675
|
+
parentNode: this,
|
|
676
|
+
parentKey: 'variables',
|
|
677
|
+
});
|
|
678
|
+
return node;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* 添加变量
|
|
683
|
+
* @internal
|
|
684
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
685
|
+
*/
|
|
686
|
+
_addVariable(name?: string): Variable;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* 添加变量
|
|
690
|
+
* @internal
|
|
691
|
+
* @param variableOptions 变量参数
|
|
692
|
+
*/
|
|
693
|
+
_addVariable(variableOptions: Partial<Variable>): Variable;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* 添加变量
|
|
697
|
+
* @internal
|
|
698
|
+
* @param variable 已有的变量实例
|
|
699
|
+
*/
|
|
700
|
+
_addVariable(variable: Variable): Variable;
|
|
701
|
+
|
|
702
|
+
_addVariable(options?: string | Partial<Variable> | Variable) {
|
|
703
|
+
const index = this.variables.length;
|
|
704
|
+
return this._insertVariableAt(options as any, index);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* 添加变量
|
|
709
|
+
* @internal
|
|
710
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
711
|
+
*/
|
|
712
|
+
addVariable(name?: string): Variable;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* 添加变量
|
|
716
|
+
* @param variableOptions 变量参数
|
|
717
|
+
*/
|
|
718
|
+
addVariable(variableOptions: Partial<Variable>): Variable;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* 添加变量
|
|
722
|
+
* @param variable 已有的变量实例
|
|
723
|
+
*/
|
|
724
|
+
addVariable(variable: Variable): Variable;
|
|
725
|
+
|
|
726
|
+
addVariable(options?: string | Partial<Variable> | Variable) {
|
|
727
|
+
const node = this._addVariable(options as any);
|
|
728
|
+
const index = this.variables.indexOf(node);
|
|
729
|
+
node.create({
|
|
730
|
+
index,
|
|
731
|
+
parentNode: this,
|
|
732
|
+
parentKey: 'variables',
|
|
733
|
+
});
|
|
734
|
+
return node;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
getReturnExistingNames(excludedList: Array<Return> = []) {
|
|
738
|
+
const excludedSet = new Set(excludedList);
|
|
739
|
+
return ((this.returns as Return[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
getReturnUniqueName(name = 'ret1') {
|
|
743
|
+
return utils.unique(name, this.getReturnExistingNames(), undefined, false);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* 插入输出参数
|
|
748
|
+
* @internal
|
|
749
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
750
|
+
*/
|
|
751
|
+
_insertReturnAt(name: string, index: number): Return;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* 插入输出参数
|
|
755
|
+
* @internal
|
|
756
|
+
* @param retOptions 输出参数参数
|
|
757
|
+
*/
|
|
758
|
+
_insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* 插入输出参数
|
|
762
|
+
* @internal
|
|
763
|
+
* @param ret 已有的输出参数实例
|
|
764
|
+
*/
|
|
765
|
+
_insertReturnAt(ret: Return, index: number): Return;
|
|
766
|
+
|
|
767
|
+
_insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
768
|
+
const retOptions: any = {};
|
|
769
|
+
const relationOptions = { parentNode: this, parentKey: 'returns' };
|
|
770
|
+
let ret: Return;
|
|
771
|
+
if (!options) {
|
|
772
|
+
ret = Return.from(
|
|
773
|
+
{
|
|
774
|
+
...retOptions,
|
|
775
|
+
name: this.getReturnUniqueName(),
|
|
776
|
+
},
|
|
777
|
+
this,
|
|
778
|
+
'returns'
|
|
779
|
+
);
|
|
780
|
+
} else if (typeof options === 'string') {
|
|
781
|
+
ret = Return.from(
|
|
782
|
+
{
|
|
783
|
+
...retOptions,
|
|
784
|
+
name: options,
|
|
785
|
+
},
|
|
786
|
+
this,
|
|
787
|
+
'returns'
|
|
788
|
+
);
|
|
789
|
+
} else if (options instanceof Return) {
|
|
790
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
791
|
+
ret = options;
|
|
792
|
+
Object.assign(ret, relationOptions);
|
|
793
|
+
} else {
|
|
794
|
+
ret = Return.from(
|
|
795
|
+
{
|
|
796
|
+
...retOptions,
|
|
797
|
+
...options,
|
|
798
|
+
},
|
|
799
|
+
this,
|
|
800
|
+
'returns'
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
this.returns.splice(index, 0, ret);
|
|
804
|
+
return ret;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* 插入输出参数
|
|
809
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
810
|
+
*/
|
|
811
|
+
insertReturnAt(name: string, index: number): Return;
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* 插入输出参数
|
|
815
|
+
* @param retOptions 输出参数参数
|
|
816
|
+
*/
|
|
817
|
+
insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* 插入输出参数
|
|
821
|
+
* @param ret 已有的输出参数实例
|
|
822
|
+
*/
|
|
823
|
+
insertReturnAt(ret: Return, index: number): Return;
|
|
824
|
+
|
|
825
|
+
insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
826
|
+
const node = this._insertReturnAt(options as any, index);
|
|
827
|
+
node.create({
|
|
828
|
+
index,
|
|
829
|
+
parentNode: this,
|
|
830
|
+
parentKey: 'returns',
|
|
831
|
+
});
|
|
832
|
+
return node;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* 添加输出参数
|
|
837
|
+
* @internal
|
|
838
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
839
|
+
*/
|
|
840
|
+
_addReturn(name?: string): Return;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* 添加输出参数
|
|
844
|
+
* @internal
|
|
845
|
+
* @param retOptions 输出参数参数
|
|
846
|
+
*/
|
|
847
|
+
_addReturn(retOptions: Partial<Return>): Return;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* 添加输出参数
|
|
851
|
+
* @internal
|
|
852
|
+
* @param ret 已有的输出参数实例
|
|
853
|
+
*/
|
|
854
|
+
_addReturn(ret: Return): Return;
|
|
855
|
+
|
|
856
|
+
_addReturn(options?: string | Partial<Return> | Return) {
|
|
857
|
+
const index = this.returns.length;
|
|
858
|
+
return this._insertReturnAt(options as any, index);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* 添加输出参数
|
|
863
|
+
* @internal
|
|
864
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
865
|
+
*/
|
|
866
|
+
addReturn(name?: string): Return;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* 添加输出参数
|
|
870
|
+
* @param retOptions 输出参数参数
|
|
871
|
+
*/
|
|
872
|
+
addReturn(retOptions: Partial<Return>): Return;
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* 添加输出参数
|
|
876
|
+
* @param ret 已有的输出参数实例
|
|
877
|
+
*/
|
|
878
|
+
addReturn(ret: Return): Return;
|
|
879
|
+
|
|
880
|
+
addReturn(options?: string | Partial<Return> | Return) {
|
|
881
|
+
const node = this._addReturn(options as any);
|
|
882
|
+
const index = this.returns.indexOf(node);
|
|
883
|
+
node.create({
|
|
884
|
+
index,
|
|
885
|
+
parentNode: this,
|
|
886
|
+
parentKey: 'returns',
|
|
887
|
+
});
|
|
888
|
+
return node;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
getConstantExistingNames(excludedList: Array<Constant> = []) {
|
|
892
|
+
const excludedSet = new Set(excludedList);
|
|
893
|
+
return ((this.constants as Constant[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
getConstantUniqueName(name = 'constant1') {
|
|
897
|
+
return utils.unique(name, this.getConstantExistingNames(), undefined, false);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* 插入常量
|
|
902
|
+
* @internal
|
|
903
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
904
|
+
*/
|
|
905
|
+
_insertConstantAt(name: string, index: number): Constant;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* 插入常量
|
|
909
|
+
* @internal
|
|
910
|
+
* @param constantOptions 常量参数
|
|
911
|
+
*/
|
|
912
|
+
_insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* 插入常量
|
|
916
|
+
* @internal
|
|
917
|
+
* @param constant 已有的常量实例
|
|
918
|
+
*/
|
|
919
|
+
_insertConstantAt(constant: Constant, index: number): Constant;
|
|
920
|
+
|
|
921
|
+
_insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
922
|
+
const constantOptions: any = {};
|
|
923
|
+
const relationOptions = { parentNode: this, parentKey: 'constants' };
|
|
924
|
+
let constant: Constant;
|
|
925
|
+
if (!options) {
|
|
926
|
+
constant = Constant.from(
|
|
927
|
+
{
|
|
928
|
+
...constantOptions,
|
|
929
|
+
name: this.getConstantUniqueName(),
|
|
930
|
+
},
|
|
931
|
+
this,
|
|
932
|
+
'constants'
|
|
933
|
+
);
|
|
934
|
+
} else if (typeof options === 'string') {
|
|
935
|
+
constant = Constant.from(
|
|
936
|
+
{
|
|
937
|
+
...constantOptions,
|
|
938
|
+
name: options,
|
|
939
|
+
},
|
|
940
|
+
this,
|
|
941
|
+
'constants'
|
|
942
|
+
);
|
|
943
|
+
} else if (options instanceof Constant) {
|
|
944
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
945
|
+
constant = options;
|
|
946
|
+
Object.assign(constant, relationOptions);
|
|
947
|
+
} else {
|
|
948
|
+
constant = Constant.from(
|
|
949
|
+
{
|
|
950
|
+
...constantOptions,
|
|
951
|
+
...options,
|
|
952
|
+
},
|
|
953
|
+
this,
|
|
954
|
+
'constants'
|
|
955
|
+
);
|
|
956
|
+
}
|
|
957
|
+
this.constants.splice(index, 0, constant);
|
|
958
|
+
return constant;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* 插入常量
|
|
963
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
964
|
+
*/
|
|
965
|
+
insertConstantAt(name: string, index: number): Constant;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* 插入常量
|
|
969
|
+
* @param constantOptions 常量参数
|
|
970
|
+
*/
|
|
971
|
+
insertConstantAt(constantOptions: Partial<Constant>, index: number): Constant;
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* 插入常量
|
|
975
|
+
* @param constant 已有的常量实例
|
|
976
|
+
*/
|
|
977
|
+
insertConstantAt(constant: Constant, index: number): Constant;
|
|
978
|
+
|
|
979
|
+
insertConstantAt(options: string | Partial<Constant> | Constant, index: number) {
|
|
980
|
+
const node = this._insertConstantAt(options as any, index);
|
|
981
|
+
node.create({
|
|
982
|
+
index,
|
|
983
|
+
parentNode: this,
|
|
984
|
+
parentKey: 'constants',
|
|
985
|
+
});
|
|
986
|
+
return node;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* 添加常量
|
|
991
|
+
* @internal
|
|
992
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
993
|
+
*/
|
|
994
|
+
_addConstant(name?: string): Constant;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* 添加常量
|
|
998
|
+
* @internal
|
|
999
|
+
* @param constantOptions 常量参数
|
|
1000
|
+
*/
|
|
1001
|
+
_addConstant(constantOptions: Partial<Constant>): Constant;
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* 添加常量
|
|
1005
|
+
* @internal
|
|
1006
|
+
* @param constant 已有的常量实例
|
|
1007
|
+
*/
|
|
1008
|
+
_addConstant(constant: Constant): Constant;
|
|
1009
|
+
|
|
1010
|
+
_addConstant(options?: string | Partial<Constant> | Constant) {
|
|
1011
|
+
const index = this.constants.length;
|
|
1012
|
+
return this._insertConstantAt(options as any, index);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* 添加常量
|
|
1017
|
+
* @internal
|
|
1018
|
+
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
1019
|
+
*/
|
|
1020
|
+
addConstant(name?: string): Constant;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* 添加常量
|
|
1024
|
+
* @param constantOptions 常量参数
|
|
1025
|
+
*/
|
|
1026
|
+
addConstant(constantOptions: Partial<Constant>): Constant;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* 添加常量
|
|
1030
|
+
* @param constant 已有的常量实例
|
|
1031
|
+
*/
|
|
1032
|
+
addConstant(constant: Constant): Constant;
|
|
1033
|
+
|
|
1034
|
+
addConstant(options?: string | Partial<Constant> | Constant) {
|
|
1035
|
+
const node = this._addConstant(options as any);
|
|
1036
|
+
const index = this.constants.indexOf(node);
|
|
1037
|
+
node.create({
|
|
1038
|
+
index,
|
|
1039
|
+
parentNode: this,
|
|
1040
|
+
parentKey: 'constants',
|
|
1041
|
+
});
|
|
1042
|
+
return node;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
|
|
1046
|
+
const excludedSet = new Set(excludedList);
|
|
1047
|
+
return ((this.bindAttrs as BindAttribute[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
getBindAttributeUniqueName(name = 'bindAttribute1') {
|
|
1051
|
+
return utils.unique(name, this.getBindAttributeExistingNames(), undefined, false);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* 插入元素绑定属性
|
|
1056
|
+
* @internal
|
|
1057
|
+
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1058
|
+
*/
|
|
1059
|
+
_insertBindAttributeAt(name: string, index: number): BindAttribute;
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* 插入元素绑定属性
|
|
1063
|
+
* @internal
|
|
1064
|
+
* @param bindAttributeOptions 元素绑定属性参数
|
|
1065
|
+
*/
|
|
1066
|
+
_insertBindAttributeAt(bindAttributeOptions: Partial<BindAttribute>, index: number): BindAttribute;
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* 插入元素绑定属性
|
|
1070
|
+
* @internal
|
|
1071
|
+
* @param bindAttribute 已有的元素绑定属性实例
|
|
1072
|
+
*/
|
|
1073
|
+
_insertBindAttributeAt(bindAttribute: BindAttribute, index: number): BindAttribute;
|
|
1074
|
+
|
|
1075
|
+
_insertBindAttributeAt(options: string | Partial<BindAttribute> | BindAttribute, index: number) {
|
|
1076
|
+
const bindAttributeOptions: any = {};
|
|
1077
|
+
const relationOptions = { parentNode: this, parentKey: 'bindAttrs' };
|
|
1078
|
+
let bindAttribute: BindAttribute;
|
|
1079
|
+
if (!options) {
|
|
1080
|
+
bindAttribute = BindAttribute.from(
|
|
1081
|
+
{
|
|
1082
|
+
...bindAttributeOptions,
|
|
1083
|
+
name: this.getBindAttributeUniqueName(),
|
|
1084
|
+
},
|
|
1085
|
+
this,
|
|
1086
|
+
'bindAttrs'
|
|
1087
|
+
);
|
|
1088
|
+
} else if (typeof options === 'string') {
|
|
1089
|
+
bindAttribute = BindAttribute.from(
|
|
1090
|
+
{
|
|
1091
|
+
...bindAttributeOptions,
|
|
1092
|
+
name: options,
|
|
1093
|
+
},
|
|
1094
|
+
this,
|
|
1095
|
+
'bindAttrs'
|
|
1096
|
+
);
|
|
1097
|
+
} else if (options instanceof BindAttribute) {
|
|
1098
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1099
|
+
bindAttribute = options;
|
|
1100
|
+
Object.assign(bindAttribute, relationOptions);
|
|
1101
|
+
} else {
|
|
1102
|
+
bindAttribute = BindAttribute.from(
|
|
1103
|
+
{
|
|
1104
|
+
...bindAttributeOptions,
|
|
1105
|
+
...options,
|
|
1106
|
+
},
|
|
1107
|
+
this,
|
|
1108
|
+
'bindAttrs'
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
this.bindAttrs.splice(index, 0, bindAttribute);
|
|
1112
|
+
return bindAttribute;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* 插入元素绑定属性
|
|
1117
|
+
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1118
|
+
*/
|
|
1119
|
+
insertBindAttributeAt(name: string, index: number): BindAttribute;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* 插入元素绑定属性
|
|
1123
|
+
* @param bindAttributeOptions 元素绑定属性参数
|
|
1124
|
+
*/
|
|
1125
|
+
insertBindAttributeAt(bindAttributeOptions: Partial<BindAttribute>, index: number): BindAttribute;
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* 插入元素绑定属性
|
|
1129
|
+
* @param bindAttribute 已有的元素绑定属性实例
|
|
1130
|
+
*/
|
|
1131
|
+
insertBindAttributeAt(bindAttribute: BindAttribute, index: number): BindAttribute;
|
|
1132
|
+
|
|
1133
|
+
insertBindAttributeAt(options: string | Partial<BindAttribute> | BindAttribute, index: number) {
|
|
1134
|
+
const node = this._insertBindAttributeAt(options as any, index);
|
|
1135
|
+
node.create({
|
|
1136
|
+
index,
|
|
1137
|
+
parentNode: this,
|
|
1138
|
+
parentKey: 'bindAttrs',
|
|
1139
|
+
});
|
|
1140
|
+
return node;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* 添加元素绑定属性
|
|
1145
|
+
* @internal
|
|
1146
|
+
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1147
|
+
*/
|
|
1148
|
+
_addBindAttribute(name?: string): BindAttribute;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* 添加元素绑定属性
|
|
1152
|
+
* @internal
|
|
1153
|
+
* @param bindAttributeOptions 元素绑定属性参数
|
|
1154
|
+
*/
|
|
1155
|
+
_addBindAttribute(bindAttributeOptions: Partial<BindAttribute>): BindAttribute;
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* 添加元素绑定属性
|
|
1159
|
+
* @internal
|
|
1160
|
+
* @param bindAttribute 已有的元素绑定属性实例
|
|
1161
|
+
*/
|
|
1162
|
+
_addBindAttribute(bindAttribute: BindAttribute): BindAttribute;
|
|
1163
|
+
|
|
1164
|
+
_addBindAttribute(options?: string | Partial<BindAttribute> | BindAttribute) {
|
|
1165
|
+
const index = this.bindAttrs.length;
|
|
1166
|
+
return this._insertBindAttributeAt(options as any, index);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* 添加元素绑定属性
|
|
1171
|
+
* @internal
|
|
1172
|
+
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1173
|
+
*/
|
|
1174
|
+
addBindAttribute(name?: string): BindAttribute;
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* 添加元素绑定属性
|
|
1178
|
+
* @param bindAttributeOptions 元素绑定属性参数
|
|
1179
|
+
*/
|
|
1180
|
+
addBindAttribute(bindAttributeOptions: Partial<BindAttribute>): BindAttribute;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* 添加元素绑定属性
|
|
1184
|
+
* @param bindAttribute 已有的元素绑定属性实例
|
|
1185
|
+
*/
|
|
1186
|
+
addBindAttribute(bindAttribute: BindAttribute): BindAttribute;
|
|
1187
|
+
|
|
1188
|
+
addBindAttribute(options?: string | Partial<BindAttribute> | BindAttribute) {
|
|
1189
|
+
const node = this._addBindAttribute(options as any);
|
|
1190
|
+
const index = this.bindAttrs.indexOf(node);
|
|
1191
|
+
node.create({
|
|
1192
|
+
index,
|
|
1193
|
+
parentNode: this,
|
|
1194
|
+
parentKey: 'bindAttrs',
|
|
1195
|
+
});
|
|
1196
|
+
return node;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* 删除元素绑定事件
|
|
1201
|
+
* @param name 元素绑定事件名称
|
|
1202
|
+
*/
|
|
1203
|
+
removeBindEvent(name: string): void;
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* 删除元素绑定事件
|
|
1207
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
1208
|
+
*/
|
|
1209
|
+
removeBindEvent(bindEvent: BindEvent): void;
|
|
1210
|
+
|
|
1211
|
+
removeBindEvent(options: string | BindEvent) {
|
|
1212
|
+
let bindEvent: BindEvent;
|
|
1213
|
+
if (typeof options === 'string') {
|
|
1214
|
+
bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
|
|
1215
|
+
if (!bindEvent) {
|
|
1216
|
+
throw new Error(`找不到元素绑定事件 ${options}`);
|
|
1217
|
+
}
|
|
1218
|
+
} else {
|
|
1219
|
+
bindEvent = options;
|
|
1220
|
+
}
|
|
1221
|
+
return bindEvent.delete();
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
__removeBindEvent(bindEvent: BindEvent) {
|
|
1225
|
+
const { parentKey } = bindEvent;
|
|
1226
|
+
const params: Params = {
|
|
1227
|
+
parentNode: this,
|
|
1228
|
+
parentKey,
|
|
1229
|
+
index: -1,
|
|
1230
|
+
object: null,
|
|
1231
|
+
oldObject: bindEvent,
|
|
1232
|
+
};
|
|
1233
|
+
if (parentKey) {
|
|
1234
|
+
params.parentKey = parentKey;
|
|
1235
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1236
|
+
const index = (this as any)[parentKey].indexOf(bindEvent);
|
|
1237
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1238
|
+
params.index = index;
|
|
1239
|
+
} else if ((this as any)[parentKey] === bindEvent) {
|
|
1240
|
+
params.index = 0;
|
|
1241
|
+
(this as any)[parentKey] = undefined;
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
return params;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* 删除矩形信息
|
|
1249
|
+
* @param name 矩形信息名称
|
|
1250
|
+
*/
|
|
1251
|
+
removeBounds(name: string): void;
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* 删除矩形信息
|
|
1255
|
+
* @param bounds 已有的矩形信息实例
|
|
1256
|
+
*/
|
|
1257
|
+
removeBounds(bounds: Rect): void;
|
|
1258
|
+
|
|
1259
|
+
removeBounds(options: string | Rect) {
|
|
1260
|
+
let bounds: Rect;
|
|
1261
|
+
if (typeof options === 'string') {
|
|
1262
|
+
bounds = this.bounds;
|
|
1263
|
+
if (!bounds) {
|
|
1264
|
+
throw new Error(`找不到矩形信息 ${options}`);
|
|
1265
|
+
}
|
|
1266
|
+
} else {
|
|
1267
|
+
bounds = options;
|
|
1268
|
+
}
|
|
1269
|
+
return bounds.delete();
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
__removeRect(rect: Rect) {
|
|
1273
|
+
const { parentKey } = rect;
|
|
1274
|
+
const params: Params = {
|
|
1275
|
+
parentNode: this,
|
|
1276
|
+
parentKey,
|
|
1277
|
+
index: -1,
|
|
1278
|
+
object: null,
|
|
1279
|
+
oldObject: rect,
|
|
1280
|
+
};
|
|
1281
|
+
if (parentKey) {
|
|
1282
|
+
params.parentKey = parentKey;
|
|
1283
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1284
|
+
const index = (this as any)[parentKey].indexOf(rect);
|
|
1285
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1286
|
+
params.index = index;
|
|
1287
|
+
} else if ((this as any)[parentKey] === rect) {
|
|
1288
|
+
params.index = 0;
|
|
1289
|
+
(this as any)[parentKey] = undefined;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return params;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* 删除点信息
|
|
1297
|
+
* @param name 点信息名称
|
|
1298
|
+
*/
|
|
1299
|
+
removePoint(name: string): void;
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* 删除点信息
|
|
1303
|
+
* @param point 已有的点信息实例
|
|
1304
|
+
*/
|
|
1305
|
+
removePoint(point: Point): void;
|
|
1306
|
+
|
|
1307
|
+
removePoint(options: string | Point) {
|
|
1308
|
+
let point: Point;
|
|
1309
|
+
if (typeof options === 'string') {
|
|
1310
|
+
point = (this.waypoints as Point[]).find((item) => item.name === options);
|
|
1311
|
+
if (!point) {
|
|
1312
|
+
throw new Error(`找不到点信息 ${options}`);
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
point = options;
|
|
1316
|
+
}
|
|
1317
|
+
return point.delete();
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
__removePoint(point: Point) {
|
|
1321
|
+
const { parentKey } = point;
|
|
1322
|
+
const params: Params = {
|
|
1323
|
+
parentNode: this,
|
|
1324
|
+
parentKey,
|
|
1325
|
+
index: -1,
|
|
1326
|
+
object: null,
|
|
1327
|
+
oldObject: point,
|
|
1328
|
+
};
|
|
1329
|
+
if (parentKey) {
|
|
1330
|
+
params.parentKey = parentKey;
|
|
1331
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1332
|
+
const index = (this as any)[parentKey].indexOf(point);
|
|
1333
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1334
|
+
params.index = index;
|
|
1335
|
+
} else if ((this as any)[parentKey] === point) {
|
|
1336
|
+
params.index = 0;
|
|
1337
|
+
(this as any)[parentKey] = undefined;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return params;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* 删除逻辑
|
|
1345
|
+
* @param name 逻辑名称
|
|
1346
|
+
*/
|
|
1347
|
+
removeLogic(name: string): void;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* 删除逻辑
|
|
1351
|
+
* @param logic 已有的逻辑实例
|
|
1352
|
+
*/
|
|
1353
|
+
removeLogic(logic: Logic): void;
|
|
1354
|
+
|
|
1355
|
+
removeLogic(options: string | Logic) {
|
|
1356
|
+
let logic: Logic;
|
|
1357
|
+
if (typeof options === 'string') {
|
|
1358
|
+
logic = this.logic;
|
|
1359
|
+
if (!logic) {
|
|
1360
|
+
throw new Error(`找不到逻辑 ${options}`);
|
|
1361
|
+
}
|
|
1362
|
+
} else {
|
|
1363
|
+
logic = options;
|
|
1364
|
+
}
|
|
1365
|
+
return logic.delete();
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
__removeLogic(logic: Logic) {
|
|
1369
|
+
const { parentKey } = logic;
|
|
1370
|
+
const params: Params = {
|
|
1371
|
+
parentNode: this,
|
|
1372
|
+
parentKey,
|
|
1373
|
+
index: -1,
|
|
1374
|
+
object: null,
|
|
1375
|
+
oldObject: logic,
|
|
1376
|
+
};
|
|
1377
|
+
if (parentKey) {
|
|
1378
|
+
params.parentKey = parentKey;
|
|
1379
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1380
|
+
const index = (this as any)[parentKey].indexOf(logic);
|
|
1381
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1382
|
+
params.index = index;
|
|
1383
|
+
} else if ((this as any)[parentKey] === logic) {
|
|
1384
|
+
params.index = 0;
|
|
1385
|
+
(this as any)[parentKey] = undefined;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
return params;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* 删除变量
|
|
1393
|
+
* @param name 变量名称
|
|
1394
|
+
*/
|
|
1395
|
+
removeVariable(name: string): void;
|
|
1396
|
+
|
|
1397
|
+
/**
|
|
1398
|
+
* 删除变量
|
|
1399
|
+
* @param variable 已有的变量实例
|
|
1400
|
+
*/
|
|
1401
|
+
removeVariable(variable: Variable): void;
|
|
1402
|
+
|
|
1403
|
+
removeVariable(options: string | Variable) {
|
|
1404
|
+
let variable: Variable;
|
|
1405
|
+
if (typeof options === 'string') {
|
|
1406
|
+
variable = (this.variables as Variable[]).find((item) => item.name === options);
|
|
1407
|
+
if (!variable) {
|
|
1408
|
+
throw new Error(`找不到变量 ${options}`);
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
variable = options;
|
|
1412
|
+
}
|
|
1413
|
+
return variable.delete();
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
__removeVariable(variable: Variable) {
|
|
1417
|
+
const { parentKey } = variable;
|
|
1418
|
+
const params: Params = {
|
|
1419
|
+
parentNode: this,
|
|
1420
|
+
parentKey,
|
|
1421
|
+
index: -1,
|
|
1422
|
+
object: null,
|
|
1423
|
+
oldObject: variable,
|
|
1424
|
+
};
|
|
1425
|
+
if (parentKey) {
|
|
1426
|
+
params.parentKey = parentKey;
|
|
1427
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1428
|
+
const index = (this as any)[parentKey].indexOf(variable);
|
|
1429
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1430
|
+
params.index = index;
|
|
1431
|
+
} else if ((this as any)[parentKey] === variable) {
|
|
1432
|
+
params.index = 0;
|
|
1433
|
+
(this as any)[parentKey] = undefined;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
return params;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* 删除输出参数
|
|
1441
|
+
* @param name 输出参数名称
|
|
1442
|
+
*/
|
|
1443
|
+
removeReturn(name: string): void;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* 删除输出参数
|
|
1447
|
+
* @param ret 已有的输出参数实例
|
|
1448
|
+
*/
|
|
1449
|
+
removeReturn(ret: Return): void;
|
|
1450
|
+
|
|
1451
|
+
removeReturn(options: string | Return) {
|
|
1452
|
+
let ret: Return;
|
|
1453
|
+
if (typeof options === 'string') {
|
|
1454
|
+
ret = (this.returns as Return[]).find((item) => item.name === options);
|
|
1455
|
+
if (!ret) {
|
|
1456
|
+
throw new Error(`找不到输出参数 ${options}`);
|
|
1457
|
+
}
|
|
1458
|
+
} else {
|
|
1459
|
+
ret = options;
|
|
1460
|
+
}
|
|
1461
|
+
return ret.delete();
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
__removeReturn(ret: Return) {
|
|
1465
|
+
const { parentKey } = ret;
|
|
1466
|
+
const params: Params = {
|
|
1467
|
+
parentNode: this,
|
|
1468
|
+
parentKey,
|
|
1469
|
+
index: -1,
|
|
1470
|
+
object: null,
|
|
1471
|
+
oldObject: ret,
|
|
1472
|
+
};
|
|
1473
|
+
if (parentKey) {
|
|
1474
|
+
params.parentKey = parentKey;
|
|
1475
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1476
|
+
const index = (this as any)[parentKey].indexOf(ret);
|
|
1477
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1478
|
+
params.index = index;
|
|
1479
|
+
} else if ((this as any)[parentKey] === ret) {
|
|
1480
|
+
params.index = 0;
|
|
1481
|
+
(this as any)[parentKey] = undefined;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
return params;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* 删除常量
|
|
1489
|
+
* @param name 常量名称
|
|
1490
|
+
*/
|
|
1491
|
+
removeConstant(name: string): void;
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* 删除常量
|
|
1495
|
+
* @param constant 已有的常量实例
|
|
1496
|
+
*/
|
|
1497
|
+
removeConstant(constant: Constant): void;
|
|
1498
|
+
|
|
1499
|
+
removeConstant(options: string | Constant) {
|
|
1500
|
+
let constant: Constant;
|
|
1501
|
+
if (typeof options === 'string') {
|
|
1502
|
+
constant = (this.constants as Constant[]).find((item) => item.name === options);
|
|
1503
|
+
if (!constant) {
|
|
1504
|
+
throw new Error(`找不到常量 ${options}`);
|
|
1505
|
+
}
|
|
1506
|
+
} else {
|
|
1507
|
+
constant = options;
|
|
1508
|
+
}
|
|
1509
|
+
return constant.delete();
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
__removeConstant(constant: Constant) {
|
|
1513
|
+
const { parentKey } = constant;
|
|
1514
|
+
const params: Params = {
|
|
1515
|
+
parentNode: this,
|
|
1516
|
+
parentKey,
|
|
1517
|
+
index: -1,
|
|
1518
|
+
object: null,
|
|
1519
|
+
oldObject: constant,
|
|
1520
|
+
};
|
|
1521
|
+
if (parentKey) {
|
|
1522
|
+
params.parentKey = parentKey;
|
|
1523
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1524
|
+
const index = (this as any)[parentKey].indexOf(constant);
|
|
1525
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1526
|
+
params.index = index;
|
|
1527
|
+
} else if ((this as any)[parentKey] === constant) {
|
|
1528
|
+
params.index = 0;
|
|
1529
|
+
(this as any)[parentKey] = undefined;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
return params;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* 删除元素绑定属性
|
|
1537
|
+
* @param name 元素绑定属性名称
|
|
1538
|
+
*/
|
|
1539
|
+
removeBindAttribute(name: string): void;
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* 删除元素绑定属性
|
|
1543
|
+
* @param bindAttribute 已有的元素绑定属性实例
|
|
1544
|
+
*/
|
|
1545
|
+
removeBindAttribute(bindAttribute: BindAttribute): void;
|
|
1546
|
+
|
|
1547
|
+
removeBindAttribute(options: string | BindAttribute) {
|
|
1548
|
+
let bindAttribute: BindAttribute;
|
|
1549
|
+
if (typeof options === 'string') {
|
|
1550
|
+
bindAttribute = (this.bindAttrs as BindAttribute[]).find((item) => item.name === options);
|
|
1551
|
+
if (!bindAttribute) {
|
|
1552
|
+
throw new Error(`找不到元素绑定属性 ${options}`);
|
|
1553
|
+
}
|
|
1554
|
+
} else {
|
|
1555
|
+
bindAttribute = options;
|
|
1556
|
+
}
|
|
1557
|
+
return bindAttribute.delete();
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
__removeBindAttribute(bindAttribute: BindAttribute) {
|
|
1561
|
+
const { parentKey } = bindAttribute;
|
|
1562
|
+
const params: Params = {
|
|
1563
|
+
parentNode: this,
|
|
1564
|
+
parentKey,
|
|
1565
|
+
index: -1,
|
|
1566
|
+
object: null,
|
|
1567
|
+
oldObject: bindAttribute,
|
|
1568
|
+
};
|
|
1569
|
+
if (parentKey) {
|
|
1570
|
+
params.parentKey = parentKey;
|
|
1571
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1572
|
+
const index = (this as any)[parentKey].indexOf(bindAttribute);
|
|
1573
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1574
|
+
params.index = index;
|
|
1575
|
+
} else if ((this as any)[parentKey] === bindAttribute) {
|
|
1576
|
+
params.index = 0;
|
|
1577
|
+
(this as any)[parentKey] = undefined;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
return params;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
//= ===============================================================================
|
|
1584
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1585
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
1586
|
+
//= ===============================================================================
|
|
1587
|
+
getVarExistingNames(excludedList: Array<Variable | Return | Constant> = []) {
|
|
1588
|
+
const excludedSet = new Set(excludedList);
|
|
1589
|
+
return [...this.variables, ...this.returns, ...this.constants].filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
get isUserTask() {
|
|
1593
|
+
return this.type === 'UserTask' || this.type === 'ApprovalTask' || this.type === 'InitiateTask';
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
get logics() {
|
|
1597
|
+
return [...genUserTaskLogic(this)];
|
|
1598
|
+
// const ns = entity2LogicNamespace(this);
|
|
1599
|
+
// ns.path = this.getNamespace() + '.' + ns.name;
|
|
1600
|
+
// return ns;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
get assigneeLogics() {
|
|
1604
|
+
let logics: Array<Logic> = [];
|
|
1605
|
+
this.bindAttrs.forEach((bindAttr) => {
|
|
1606
|
+
if (bindAttr.assignee) {
|
|
1607
|
+
logics = bindAttr.assignee.logicUsers;
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
return logics;
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
getNamespace(ns: string) {
|
|
1614
|
+
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
1615
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
1616
|
+
const parentName = this.parentNode.name;
|
|
1617
|
+
const arr = [parentNamespace];
|
|
1618
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1619
|
+
arr.push(parentName);
|
|
1620
|
+
}
|
|
1621
|
+
return `${arr.join('.')}.${ns || 'bindEvent'}`;
|
|
1622
|
+
}
|
|
1623
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
async cancelBindDelete(processDelete: boolean) {
|
|
1627
|
+
if (!processDelete) this.delete();
|
|
1628
|
+
await Promise.all(
|
|
1629
|
+
this.bindAttrs.map(async ({ destination }) => {
|
|
1630
|
+
if (destination && destination.viewNode) {
|
|
1631
|
+
const view = destination.viewNode;
|
|
1632
|
+
const name = this.uniqueTaskId(view);
|
|
1633
|
+
const node = view.params.find((param: any) => param.name === name);
|
|
1634
|
+
if (!node) return;
|
|
1635
|
+
const UsageMap = await node.findUsage();
|
|
1636
|
+
const usageNodes = UsageMap.get(this.process);
|
|
1637
|
+
// console.log(UsageMap, usageNodes)
|
|
1638
|
+
if (!UsageMap.size || (UsageMap.size === 1 && usageNodes && (!usageNodes.children || usageNodes.children.length === 1)))
|
|
1639
|
+
view.removeParam(name);
|
|
883
1640
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1641
|
+
})
|
|
1642
|
+
);
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
// 获取当前页面类型为String的taskId参数
|
|
1646
|
+
uniqueTaskId(view: View) {
|
|
1647
|
+
let count = 0;
|
|
1648
|
+
let uniqueName = 'taskId0';
|
|
1649
|
+
let param = view.params.find((param) => param.name === 'taskId');
|
|
1650
|
+
if (!param || param.typeAnnotation.typeName === 'String') return 'taskId';
|
|
1651
|
+
do {
|
|
1652
|
+
count++;
|
|
1653
|
+
uniqueName = uniqueName.substring(0, uniqueName.length - 1) + count;
|
|
1654
|
+
param = view.params.find((param) => param.name === uniqueName);
|
|
1655
|
+
if (!param) {
|
|
1656
|
+
return uniqueName;
|
|
1657
|
+
}
|
|
1658
|
+
} while (param.typeAnnotation.typeName !== 'String');
|
|
1659
|
+
return uniqueName;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
@withSourceMap()
|
|
1663
|
+
toEmbeddedTS(state?: TranslatorState): string {
|
|
1664
|
+
// this.syncLogic();
|
|
1665
|
+
const tab0 = indent(state?.tabSize || 0);
|
|
1666
|
+
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
1667
|
+
const tab3 = indent((state?.tabSize || 0) + 2);
|
|
1668
|
+
const tab4 = indent((state?.tabSize || 0) + 3);
|
|
1669
|
+
const tab5 = indent((state?.tabSize || 0) + 4);
|
|
1670
|
+
const tab6 = indent((state?.tabSize || 0) + 5);
|
|
1671
|
+
const constantsArr: any = [];
|
|
1672
|
+
const returnsArr: any = [];
|
|
1673
|
+
let code = `${this.name}: {\n`;
|
|
1674
|
+
this.variables.forEach((property) => {
|
|
1675
|
+
code += `${tab1}`;
|
|
1676
|
+
code += `${property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true }))},\n`;
|
|
1677
|
+
});
|
|
1678
|
+
this.returns.forEach((property, index) => {
|
|
1679
|
+
code += `${tab1}`;
|
|
1680
|
+
returnsArr.push(property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true })));
|
|
1681
|
+
code += `${returnsArr[index]},\n`;
|
|
1682
|
+
});
|
|
1683
|
+
this.constants.forEach((property, index) => {
|
|
1684
|
+
code += `${tab1}`;
|
|
1685
|
+
constantsArr.push(property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true })));
|
|
1686
|
+
code += `${constantsArr[index]},\n`;
|
|
1687
|
+
});
|
|
1688
|
+
const afterLinks = getFlowAfterElements(this);
|
|
1689
|
+
const beforeLinks = getFlowBeforeElements(this);
|
|
1690
|
+
if (this.isUserTask || this.type === 'ExclusiveGateway' || this.type === 'AutoTask' || this.type === 'InclusiveGateway') {
|
|
1691
|
+
const prevTasks = getPreviousTask(this);
|
|
1692
|
+
let prevCode = `${tab4}__ProcessIdentification__;\n`;
|
|
1693
|
+
prevCode += `${tab4}const ${this.process.name} = {\n`;
|
|
1694
|
+
const processName = this.process.name;
|
|
1695
|
+
this.process.params.forEach((p) => {
|
|
1696
|
+
prevCode += `${tab5}${p.name}: app.processes.${processName}.${p.name},\n`;
|
|
1697
|
+
});
|
|
1698
|
+
this.process.returns.forEach((p) => {
|
|
1699
|
+
prevCode += `${tab5}${p.name}: app.processes.${processName}.${p.name},\n`;
|
|
1700
|
+
});
|
|
1701
|
+
this.process.constants.forEach((p) => {
|
|
1702
|
+
prevCode += `${tab5}${p.name}: app.processes.${processName}.${p.name},\n`;
|
|
1703
|
+
});
|
|
1704
|
+
// prevCode += `${tab4}elements: {\n`
|
|
1705
|
+
prevCode += prevTasks.map((t) => `${tab5}${t.name}: elements.${t.name},\n`).join(``);
|
|
1706
|
+
|
|
1707
|
+
// prevCode += `${tab4}}\n`
|
|
1708
|
+
|
|
1709
|
+
if (this.isUserTask) {
|
|
1710
|
+
// 任务完成时可以拿到输出参数,prevCodeClose包含输出参数
|
|
1711
|
+
let prevCodeClose = `${prevCode}\n${tab5}${this.name}: { \n`;
|
|
1712
|
+
this.constants.forEach((c, index) => {
|
|
1713
|
+
prevCodeClose += tab6;
|
|
1714
|
+
prevCodeClose += constantsArr[index];
|
|
1715
|
+
prevCodeClose += ',';
|
|
912
1716
|
});
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
* 添加常量
|
|
918
|
-
* @internal
|
|
919
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
920
|
-
*/
|
|
921
|
-
_addConstant(name?: string): Constant;
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* 添加常量
|
|
925
|
-
* @internal
|
|
926
|
-
* @param constantOptions 常量参数
|
|
927
|
-
*/
|
|
928
|
-
_addConstant(constantOptions: Partial<Constant>): Constant;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* 添加常量
|
|
932
|
-
* @internal
|
|
933
|
-
* @param constant 已有的常量实例
|
|
934
|
-
*/
|
|
935
|
-
_addConstant(constant: Constant): Constant;
|
|
936
|
-
|
|
937
|
-
_addConstant(options?: string | Partial<Constant> | Constant) {
|
|
938
|
-
const index = this.constants.length;
|
|
939
|
-
return this._insertConstantAt(options as any, index);
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* 添加常量
|
|
944
|
-
* @internal
|
|
945
|
-
* @param name 常量名称,如果不填会自动生成一个唯一名称
|
|
946
|
-
*/
|
|
947
|
-
addConstant(name?: string): Constant;
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* 添加常量
|
|
951
|
-
* @param constantOptions 常量参数
|
|
952
|
-
*/
|
|
953
|
-
addConstant(constantOptions: Partial<Constant>): Constant;
|
|
954
|
-
|
|
955
|
-
/**
|
|
956
|
-
* 添加常量
|
|
957
|
-
* @param constant 已有的常量实例
|
|
958
|
-
*/
|
|
959
|
-
addConstant(constant: Constant): Constant;
|
|
960
|
-
|
|
961
|
-
addConstant(options?: string | Partial<Constant> | Constant) {
|
|
962
|
-
const node = this._addConstant(options as any);
|
|
963
|
-
const index = this.constants.indexOf(node);
|
|
964
|
-
node.create({
|
|
965
|
-
index,
|
|
966
|
-
parentNode: this,
|
|
967
|
-
parentKey: 'constants',
|
|
1717
|
+
this.returns.forEach((c, index) => {
|
|
1718
|
+
prevCodeClose += `\n${tab6}`;
|
|
1719
|
+
prevCodeClose += returnsArr[index];
|
|
1720
|
+
prevCodeClose += ',';
|
|
968
1721
|
});
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
getBindAttributeUniqueName(name = 'bindAttribute1') {
|
|
978
|
-
return utils.unique(name, this.getBindAttributeExistingNames(), undefined, false);
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
* 插入元素绑定属性
|
|
983
|
-
* @internal
|
|
984
|
-
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
985
|
-
*/
|
|
986
|
-
_insertBindAttributeAt(name: string, index: number): BindAttribute;
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* 插入元素绑定属性
|
|
990
|
-
* @internal
|
|
991
|
-
* @param bindAttributeOptions 元素绑定属性参数
|
|
992
|
-
*/
|
|
993
|
-
_insertBindAttributeAt(bindAttributeOptions: Partial<BindAttribute>, index: number): BindAttribute;
|
|
994
|
-
|
|
995
|
-
/**
|
|
996
|
-
* 插入元素绑定属性
|
|
997
|
-
* @internal
|
|
998
|
-
* @param bindAttribute 已有的元素绑定属性实例
|
|
999
|
-
*/
|
|
1000
|
-
_insertBindAttributeAt(bindAttribute: BindAttribute, index: number): BindAttribute;
|
|
1001
|
-
|
|
1002
|
-
_insertBindAttributeAt(options: string | Partial<BindAttribute> | BindAttribute, index: number) {
|
|
1003
|
-
const bindAttributeOptions: any = {};
|
|
1004
|
-
const relationOptions = { parentNode: this, parentKey: 'bindAttrs' };
|
|
1005
|
-
let bindAttribute: BindAttribute;
|
|
1006
|
-
if (!options) {
|
|
1007
|
-
bindAttribute = BindAttribute.from({
|
|
1008
|
-
...bindAttributeOptions,
|
|
1009
|
-
name: this.getBindAttributeUniqueName(),
|
|
1010
|
-
}, this, 'bindAttrs');
|
|
1011
|
-
} else if (typeof options === 'string') {
|
|
1012
|
-
bindAttribute = BindAttribute.from({
|
|
1013
|
-
...bindAttributeOptions,
|
|
1014
|
-
name: options,
|
|
1015
|
-
}, this, 'bindAttrs');
|
|
1016
|
-
} else if (options instanceof BindAttribute) {
|
|
1017
|
-
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1018
|
-
bindAttribute = options;
|
|
1019
|
-
Object.assign(bindAttribute, relationOptions);
|
|
1020
|
-
} else {
|
|
1021
|
-
bindAttribute = BindAttribute.from({
|
|
1022
|
-
...bindAttributeOptions,
|
|
1023
|
-
...options,
|
|
1024
|
-
}, this, 'bindAttrs');
|
|
1025
|
-
}
|
|
1026
|
-
this.bindAttrs.splice(index, 0, bindAttribute);
|
|
1027
|
-
return bindAttribute;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* 插入元素绑定属性
|
|
1032
|
-
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1033
|
-
*/
|
|
1034
|
-
insertBindAttributeAt(name: string, index: number): BindAttribute;
|
|
1035
|
-
|
|
1036
|
-
/**
|
|
1037
|
-
* 插入元素绑定属性
|
|
1038
|
-
* @param bindAttributeOptions 元素绑定属性参数
|
|
1039
|
-
*/
|
|
1040
|
-
insertBindAttributeAt(bindAttributeOptions: Partial<BindAttribute>, index: number): BindAttribute;
|
|
1041
|
-
|
|
1042
|
-
/**
|
|
1043
|
-
* 插入元素绑定属性
|
|
1044
|
-
* @param bindAttribute 已有的元素绑定属性实例
|
|
1045
|
-
*/
|
|
1046
|
-
insertBindAttributeAt(bindAttribute: BindAttribute, index: number): BindAttribute;
|
|
1047
|
-
|
|
1048
|
-
insertBindAttributeAt(options: string | Partial<BindAttribute> | BindAttribute, index: number) {
|
|
1049
|
-
const node = this._insertBindAttributeAt(options as any, index);
|
|
1050
|
-
node.create({
|
|
1051
|
-
index,
|
|
1052
|
-
parentNode: this,
|
|
1053
|
-
parentKey: 'bindAttrs',
|
|
1722
|
+
prevCodeClose += ` \n${tab5}}\n`;
|
|
1723
|
+
prevCodeClose += `${tab4}}\n`;
|
|
1724
|
+
|
|
1725
|
+
prevCode += `\n${tab5}${this.name}: { \n`;
|
|
1726
|
+
this.constants.forEach((c, index) => {
|
|
1727
|
+
prevCode += `${tab6}`;
|
|
1728
|
+
prevCode += constantsArr[index];
|
|
1729
|
+
prevCode += ',';
|
|
1054
1730
|
});
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
* @internal
|
|
1068
|
-
* @param bindAttributeOptions 元素绑定属性参数
|
|
1069
|
-
*/
|
|
1070
|
-
_addBindAttribute(bindAttributeOptions: Partial<BindAttribute>): BindAttribute;
|
|
1071
|
-
|
|
1072
|
-
/**
|
|
1073
|
-
* 添加元素绑定属性
|
|
1074
|
-
* @internal
|
|
1075
|
-
* @param bindAttribute 已有的元素绑定属性实例
|
|
1076
|
-
*/
|
|
1077
|
-
_addBindAttribute(bindAttribute: BindAttribute): BindAttribute;
|
|
1078
|
-
|
|
1079
|
-
_addBindAttribute(options?: string | Partial<BindAttribute> | BindAttribute) {
|
|
1080
|
-
const index = this.bindAttrs.length;
|
|
1081
|
-
return this._insertBindAttributeAt(options as any, index);
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
/**
|
|
1085
|
-
* 添加元素绑定属性
|
|
1086
|
-
* @internal
|
|
1087
|
-
* @param name 元素绑定属性名称,如果不填会自动生成一个唯一名称
|
|
1088
|
-
*/
|
|
1089
|
-
addBindAttribute(name?: string): BindAttribute;
|
|
1090
|
-
|
|
1091
|
-
/**
|
|
1092
|
-
* 添加元素绑定属性
|
|
1093
|
-
* @param bindAttributeOptions 元素绑定属性参数
|
|
1094
|
-
*/
|
|
1095
|
-
addBindAttribute(bindAttributeOptions: Partial<BindAttribute>): BindAttribute;
|
|
1096
|
-
|
|
1097
|
-
/**
|
|
1098
|
-
* 添加元素绑定属性
|
|
1099
|
-
* @param bindAttribute 已有的元素绑定属性实例
|
|
1100
|
-
*/
|
|
1101
|
-
addBindAttribute(bindAttribute: BindAttribute): BindAttribute;
|
|
1102
|
-
|
|
1103
|
-
addBindAttribute(options?: string | Partial<BindAttribute> | BindAttribute) {
|
|
1104
|
-
const node = this._addBindAttribute(options as any);
|
|
1105
|
-
const index = this.bindAttrs.indexOf(node);
|
|
1106
|
-
node.create({
|
|
1107
|
-
index,
|
|
1108
|
-
parentNode: this,
|
|
1109
|
-
parentKey: 'bindAttrs',
|
|
1110
|
-
});
|
|
1111
|
-
return node;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* 删除元素绑定事件
|
|
1119
|
-
* @param name 元素绑定事件名称
|
|
1120
|
-
*/
|
|
1121
|
-
removeBindEvent(name: string): void;
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
* 删除元素绑定事件
|
|
1125
|
-
* @param bindEvent 已有的元素绑定事件实例
|
|
1126
|
-
*/
|
|
1127
|
-
removeBindEvent(bindEvent: BindEvent): void;
|
|
1128
|
-
|
|
1129
|
-
removeBindEvent(options: string | BindEvent) {
|
|
1130
|
-
let bindEvent: BindEvent;
|
|
1131
|
-
if (typeof options === 'string') {
|
|
1132
|
-
bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
|
|
1133
|
-
if (!bindEvent) {
|
|
1134
|
-
throw new Error('找不到元素绑定事件 ' + options);
|
|
1135
|
-
}
|
|
1136
|
-
} else {
|
|
1137
|
-
bindEvent = options;
|
|
1138
|
-
}
|
|
1139
|
-
return bindEvent.delete();
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
__removeBindEvent(bindEvent: BindEvent) {
|
|
1143
|
-
const parentKey = bindEvent.parentKey;
|
|
1144
|
-
const params: Params = {
|
|
1145
|
-
parentNode: this,
|
|
1146
|
-
parentKey,
|
|
1147
|
-
index: -1,
|
|
1148
|
-
object: null,
|
|
1149
|
-
oldObject: bindEvent,
|
|
1150
|
-
};
|
|
1151
|
-
if (parentKey) {
|
|
1152
|
-
params.parentKey = parentKey;
|
|
1153
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1154
|
-
const index = (this as any)[parentKey].indexOf(bindEvent);
|
|
1155
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1156
|
-
params.index = index;
|
|
1157
|
-
} else if ((this as any)[parentKey] === bindEvent) {
|
|
1158
|
-
params.index = 0;
|
|
1159
|
-
(this as any)[parentKey] = undefined;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
return params;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* 删除矩形信息
|
|
1169
|
-
* @param name 矩形信息名称
|
|
1170
|
-
*/
|
|
1171
|
-
removeBounds(name: string): void;
|
|
1172
|
-
|
|
1173
|
-
/**
|
|
1174
|
-
* 删除矩形信息
|
|
1175
|
-
* @param bounds 已有的矩形信息实例
|
|
1176
|
-
*/
|
|
1177
|
-
removeBounds(bounds: Rect): void;
|
|
1178
|
-
|
|
1179
|
-
removeBounds(options: string | Rect) {
|
|
1180
|
-
let bounds: Rect;
|
|
1181
|
-
if (typeof options === 'string') {
|
|
1182
|
-
bounds = this.bounds;
|
|
1183
|
-
if (!bounds) {
|
|
1184
|
-
throw new Error('找不到矩形信息 ' + options);
|
|
1185
|
-
}
|
|
1186
|
-
} else {
|
|
1187
|
-
bounds = options;
|
|
1188
|
-
}
|
|
1189
|
-
return bounds.delete();
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
__removeRect(rect: Rect) {
|
|
1193
|
-
const parentKey = rect.parentKey;
|
|
1194
|
-
const params: Params = {
|
|
1195
|
-
parentNode: this,
|
|
1196
|
-
parentKey,
|
|
1197
|
-
index: -1,
|
|
1198
|
-
object: null,
|
|
1199
|
-
oldObject: rect,
|
|
1200
|
-
};
|
|
1201
|
-
if (parentKey) {
|
|
1202
|
-
params.parentKey = parentKey;
|
|
1203
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1204
|
-
const index = (this as any)[parentKey].indexOf(rect);
|
|
1205
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1206
|
-
params.index = index;
|
|
1207
|
-
} else if ((this as any)[parentKey] === rect) {
|
|
1208
|
-
params.index = 0;
|
|
1209
|
-
(this as any)[parentKey] = undefined;
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
return params;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
/**
|
|
1218
|
-
* 删除点信息
|
|
1219
|
-
* @param name 点信息名称
|
|
1220
|
-
*/
|
|
1221
|
-
removePoint(name: string): void;
|
|
1222
|
-
|
|
1223
|
-
/**
|
|
1224
|
-
* 删除点信息
|
|
1225
|
-
* @param point 已有的点信息实例
|
|
1226
|
-
*/
|
|
1227
|
-
removePoint(point: Point): void;
|
|
1228
|
-
|
|
1229
|
-
removePoint(options: string | Point) {
|
|
1230
|
-
let point: Point;
|
|
1231
|
-
if (typeof options === 'string') {
|
|
1232
|
-
point = (this.waypoints as Point[]).find((item) => item.name === options);
|
|
1233
|
-
if (!point) {
|
|
1234
|
-
throw new Error('找不到点信息 ' + options);
|
|
1235
|
-
}
|
|
1236
|
-
} else {
|
|
1237
|
-
point = options;
|
|
1238
|
-
}
|
|
1239
|
-
return point.delete();
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
__removePoint(point: Point) {
|
|
1243
|
-
const parentKey = point.parentKey;
|
|
1244
|
-
const params: Params = {
|
|
1245
|
-
parentNode: this,
|
|
1246
|
-
parentKey,
|
|
1247
|
-
index: -1,
|
|
1248
|
-
object: null,
|
|
1249
|
-
oldObject: point,
|
|
1250
|
-
};
|
|
1251
|
-
if (parentKey) {
|
|
1252
|
-
params.parentKey = parentKey;
|
|
1253
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1254
|
-
const index = (this as any)[parentKey].indexOf(point);
|
|
1255
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1256
|
-
params.index = index;
|
|
1257
|
-
} else if ((this as any)[parentKey] === point) {
|
|
1258
|
-
params.index = 0;
|
|
1259
|
-
(this as any)[parentKey] = undefined;
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
return params;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
* 删除逻辑
|
|
1269
|
-
* @param name 逻辑名称
|
|
1270
|
-
*/
|
|
1271
|
-
removeLogic(name: string): void;
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* 删除逻辑
|
|
1275
|
-
* @param logic 已有的逻辑实例
|
|
1276
|
-
*/
|
|
1277
|
-
removeLogic(logic: Logic): void;
|
|
1278
|
-
|
|
1279
|
-
removeLogic(options: string | Logic) {
|
|
1280
|
-
let logic: Logic;
|
|
1281
|
-
if (typeof options === 'string') {
|
|
1282
|
-
logic = this.logic;
|
|
1283
|
-
if (!logic) {
|
|
1284
|
-
throw new Error('找不到逻辑 ' + options);
|
|
1285
|
-
}
|
|
1286
|
-
} else {
|
|
1287
|
-
logic = options;
|
|
1288
|
-
}
|
|
1289
|
-
return logic.delete();
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
__removeLogic(logic: Logic) {
|
|
1293
|
-
const parentKey = logic.parentKey;
|
|
1294
|
-
const params: Params = {
|
|
1295
|
-
parentNode: this,
|
|
1296
|
-
parentKey,
|
|
1297
|
-
index: -1,
|
|
1298
|
-
object: null,
|
|
1299
|
-
oldObject: logic,
|
|
1300
|
-
};
|
|
1301
|
-
if (parentKey) {
|
|
1302
|
-
params.parentKey = parentKey;
|
|
1303
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1304
|
-
const index = (this as any)[parentKey].indexOf(logic);
|
|
1305
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1306
|
-
params.index = index;
|
|
1307
|
-
} else if ((this as any)[parentKey] === logic) {
|
|
1308
|
-
params.index = 0;
|
|
1309
|
-
(this as any)[parentKey] = undefined;
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
return params;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
/**
|
|
1318
|
-
* 删除变量
|
|
1319
|
-
* @param name 变量名称
|
|
1320
|
-
*/
|
|
1321
|
-
removeVariable(name: string): void;
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* 删除变量
|
|
1325
|
-
* @param variable 已有的变量实例
|
|
1326
|
-
*/
|
|
1327
|
-
removeVariable(variable: Variable): void;
|
|
1328
|
-
|
|
1329
|
-
removeVariable(options: string | Variable) {
|
|
1330
|
-
let variable: Variable;
|
|
1331
|
-
if (typeof options === 'string') {
|
|
1332
|
-
variable = (this.variables as Variable[]).find((item) => item.name === options);
|
|
1333
|
-
if (!variable) {
|
|
1334
|
-
throw new Error('找不到变量 ' + options);
|
|
1335
|
-
}
|
|
1336
|
-
} else {
|
|
1337
|
-
variable = options;
|
|
1338
|
-
}
|
|
1339
|
-
return variable.delete();
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
__removeVariable(variable: Variable) {
|
|
1343
|
-
const parentKey = variable.parentKey;
|
|
1344
|
-
const params: Params = {
|
|
1345
|
-
parentNode: this,
|
|
1346
|
-
parentKey,
|
|
1347
|
-
index: -1,
|
|
1348
|
-
object: null,
|
|
1349
|
-
oldObject: variable,
|
|
1350
|
-
};
|
|
1351
|
-
if (parentKey) {
|
|
1352
|
-
params.parentKey = parentKey;
|
|
1353
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1354
|
-
const index = (this as any)[parentKey].indexOf(variable);
|
|
1355
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1356
|
-
params.index = index;
|
|
1357
|
-
} else if ((this as any)[parentKey] === variable) {
|
|
1358
|
-
params.index = 0;
|
|
1359
|
-
(this as any)[parentKey] = undefined;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
return params;
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
/**
|
|
1368
|
-
* 删除输出参数
|
|
1369
|
-
* @param name 输出参数名称
|
|
1370
|
-
*/
|
|
1371
|
-
removeReturn(name: string): void;
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
* 删除输出参数
|
|
1375
|
-
* @param ret 已有的输出参数实例
|
|
1376
|
-
*/
|
|
1377
|
-
removeReturn(ret: Return): void;
|
|
1378
|
-
|
|
1379
|
-
removeReturn(options: string | Return) {
|
|
1380
|
-
let ret: Return;
|
|
1381
|
-
if (typeof options === 'string') {
|
|
1382
|
-
ret = (this.returns as Return[]).find((item) => item.name === options);
|
|
1383
|
-
if (!ret) {
|
|
1384
|
-
throw new Error('找不到输出参数 ' + options);
|
|
1385
|
-
}
|
|
1386
|
-
} else {
|
|
1387
|
-
ret = options;
|
|
1388
|
-
}
|
|
1389
|
-
return ret.delete();
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
__removeReturn(ret: Return) {
|
|
1393
|
-
const parentKey = ret.parentKey;
|
|
1394
|
-
const params: Params = {
|
|
1395
|
-
parentNode: this,
|
|
1396
|
-
parentKey,
|
|
1397
|
-
index: -1,
|
|
1398
|
-
object: null,
|
|
1399
|
-
oldObject: ret,
|
|
1400
|
-
};
|
|
1401
|
-
if (parentKey) {
|
|
1402
|
-
params.parentKey = parentKey;
|
|
1403
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1404
|
-
const index = (this as any)[parentKey].indexOf(ret);
|
|
1405
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1406
|
-
params.index = index;
|
|
1407
|
-
} else if ((this as any)[parentKey] === ret) {
|
|
1408
|
-
params.index = 0;
|
|
1409
|
-
(this as any)[parentKey] = undefined;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
return params;
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* 删除常量
|
|
1419
|
-
* @param name 常量名称
|
|
1420
|
-
*/
|
|
1421
|
-
removeConstant(name: string): void;
|
|
1422
|
-
|
|
1423
|
-
/**
|
|
1424
|
-
* 删除常量
|
|
1425
|
-
* @param constant 已有的常量实例
|
|
1426
|
-
*/
|
|
1427
|
-
removeConstant(constant: Constant): void;
|
|
1428
|
-
|
|
1429
|
-
removeConstant(options: string | Constant) {
|
|
1430
|
-
let constant: Constant;
|
|
1431
|
-
if (typeof options === 'string') {
|
|
1432
|
-
constant = (this.constants as Constant[]).find((item) => item.name === options);
|
|
1433
|
-
if (!constant) {
|
|
1434
|
-
throw new Error('找不到常量 ' + options);
|
|
1435
|
-
}
|
|
1436
|
-
} else {
|
|
1437
|
-
constant = options;
|
|
1438
|
-
}
|
|
1439
|
-
return constant.delete();
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
__removeConstant(constant: Constant) {
|
|
1443
|
-
const parentKey = constant.parentKey;
|
|
1444
|
-
const params: Params = {
|
|
1445
|
-
parentNode: this,
|
|
1446
|
-
parentKey,
|
|
1447
|
-
index: -1,
|
|
1448
|
-
object: null,
|
|
1449
|
-
oldObject: constant,
|
|
1450
|
-
};
|
|
1451
|
-
if (parentKey) {
|
|
1452
|
-
params.parentKey = parentKey;
|
|
1453
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1454
|
-
const index = (this as any)[parentKey].indexOf(constant);
|
|
1455
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1456
|
-
params.index = index;
|
|
1457
|
-
} else if ((this as any)[parentKey] === constant) {
|
|
1458
|
-
params.index = 0;
|
|
1459
|
-
(this as any)[parentKey] = undefined;
|
|
1460
|
-
}
|
|
1731
|
+
prevCode += ` \n${tab5}}\n`;
|
|
1732
|
+
prevCode += `${tab4}}\n`;
|
|
1733
|
+
if (Array.isArray(this.bindEvents)) {
|
|
1734
|
+
this.bindEvents.forEach((bindEvent) => {
|
|
1735
|
+
// 任务完成时可以拿到输出参数
|
|
1736
|
+
const currentPrevCode = bindEvent.name === 'OnClose' ? prevCodeClose : prevCode;
|
|
1737
|
+
code += `${tab1}${bindEvent.name}: () => [\n`;
|
|
1738
|
+
bindEvent.logics.forEach((logic) => {
|
|
1739
|
+
code += `${logic.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: 0 }), currentPrevCode, true, true)}${tab3},\n`;
|
|
1740
|
+
});
|
|
1741
|
+
code += `${tab1}],\n`;
|
|
1742
|
+
});
|
|
1461
1743
|
}
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
*/
|
|
1471
|
-
removeBindAttribute(name: string): void;
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* 删除元素绑定属性
|
|
1475
|
-
* @param bindAttribute 已有的元素绑定属性实例
|
|
1476
|
-
*/
|
|
1477
|
-
removeBindAttribute(bindAttribute: BindAttribute): void;
|
|
1478
|
-
|
|
1479
|
-
removeBindAttribute(options: string | BindAttribute) {
|
|
1480
|
-
let bindAttribute: BindAttribute;
|
|
1481
|
-
if (typeof options === 'string') {
|
|
1482
|
-
bindAttribute = (this.bindAttrs as BindAttribute[]).find((item) => item.name === options);
|
|
1483
|
-
if (!bindAttribute) {
|
|
1484
|
-
throw new Error('找不到元素绑定属性 ' + options);
|
|
1485
|
-
}
|
|
1744
|
+
code += `${tab1}logics: {\n`;
|
|
1745
|
+
let destinationAttrs = this.bindAttrs.filter((attr) => attr.name === 'destination' || attr.name.startsWith('destination-'));
|
|
1746
|
+
const destinationAllEmpty = destinationAttrs.length && destinationAttrs.every((attr) => !attr.destination.viewNamespace);
|
|
1747
|
+
if (destinationAllEmpty) {
|
|
1748
|
+
code += `${destinationAttrs[0].destination.toEmbeddedTSInProcess(
|
|
1749
|
+
shiftState(state, code, { tabSize: (state?.tabSize || 0) + 3 }),
|
|
1750
|
+
prevCode
|
|
1751
|
+
)},\n`;
|
|
1486
1752
|
} else {
|
|
1487
|
-
|
|
1753
|
+
destinationAttrs = destinationAttrs.filter((attr) => attr.destination.viewNamespace);
|
|
1754
|
+
destinationAttrs.forEach((attr) => {
|
|
1755
|
+
code += `${attr.destination.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 3 }), prevCode)},\n`;
|
|
1756
|
+
});
|
|
1488
1757
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
parentNode: this,
|
|
1496
|
-
parentKey,
|
|
1497
|
-
index: -1,
|
|
1498
|
-
object: null,
|
|
1499
|
-
oldObject: bindAttribute,
|
|
1500
|
-
};
|
|
1501
|
-
if (parentKey) {
|
|
1502
|
-
params.parentKey = parentKey;
|
|
1503
|
-
if (Array.isArray((this as any)[parentKey])) {
|
|
1504
|
-
const index = (this as any)[parentKey].indexOf(bindAttribute);
|
|
1505
|
-
~index && (this as any)[parentKey].splice(index, 1);
|
|
1506
|
-
params.index = index;
|
|
1507
|
-
} else if ((this as any)[parentKey] === bindAttribute) {
|
|
1508
|
-
params.index = 0;
|
|
1509
|
-
(this as any)[parentKey] = undefined;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
return params;
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
//================================================================================
|
|
1516
|
-
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1517
|
-
// 自动生成的代码已结束。下面可以手动编写。
|
|
1518
|
-
//================================================================================
|
|
1519
|
-
getVarExistingNames(excludedList: Array<Variable | Return | Constant> = []) {
|
|
1520
|
-
const excludedSet = new Set(excludedList);
|
|
1521
|
-
return [...this.variables, ...this.returns, ...this.constants].filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
get isUserTask() {
|
|
1525
|
-
return this.type === 'UserTask' || this.type === 'ApprovalTask' || this.type === 'InitiateTask';
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
get logics() {
|
|
1529
|
-
return [...genUserTaskLogic(this)];
|
|
1530
|
-
// const ns = entity2LogicNamespace(this);
|
|
1531
|
-
// ns.path = this.getNamespace() + '.' + ns.name;
|
|
1532
|
-
// return ns;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
get assigneeLogics() {
|
|
1536
|
-
let logics: Array<Logic> = [];
|
|
1537
|
-
this.bindAttrs.forEach((bindAttr) => {
|
|
1538
|
-
if (bindAttr.assignee) {
|
|
1539
|
-
logics = bindAttr.assignee.logicUsers;
|
|
1540
|
-
}
|
|
1758
|
+
this.bindAttrs.forEach((attr) => {
|
|
1759
|
+
if (attr.name === 'assignee') {
|
|
1760
|
+
code += `${tab3}assignee: function(): string[] {\n`;
|
|
1761
|
+
code += `${attr.assignee.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: state.tabSize + 3 }), prevCode)}\n`;
|
|
1762
|
+
code += `${tab3}},\n`;
|
|
1763
|
+
}
|
|
1541
1764
|
});
|
|
1542
|
-
|
|
1543
|
-
|
|
1765
|
+
const logics = genUserTaskLogic(this);
|
|
1766
|
+
// sourceMap 映射
|
|
1544
1767
|
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
1548
|
-
const parentName = this.parentNode.name;
|
|
1549
|
-
const arr = [parentNamespace];
|
|
1550
|
-
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1551
|
-
arr.push(parentName);
|
|
1552
|
-
}
|
|
1553
|
-
return `${arr.join('.')}.${ns || 'bindEvent'}`;
|
|
1554
|
-
} else
|
|
1555
|
-
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1556
|
-
}
|
|
1557
|
-
async cancelBindDelete(processDelete: boolean) {
|
|
1558
|
-
if (!processDelete)
|
|
1559
|
-
this.delete();
|
|
1560
|
-
await Promise.all(this.bindAttrs.map(async ({ destination }) => {
|
|
1561
|
-
if (destination && destination.viewNode) {
|
|
1562
|
-
const view = destination.viewNode;
|
|
1563
|
-
const name = this.uniqueTaskId(view);
|
|
1564
|
-
const node = view.params.find((param: any) => param.name === name);
|
|
1565
|
-
if (!node)
|
|
1566
|
-
return;
|
|
1567
|
-
const UsageMap = await node.findUsage();
|
|
1568
|
-
const usageNodes = UsageMap.get(this.process);
|
|
1569
|
-
// console.log(UsageMap, usageNodes)
|
|
1570
|
-
if (!UsageMap.size || (UsageMap.size === 1 && usageNodes && (!usageNodes.children || usageNodes.children.length === 1)))
|
|
1571
|
-
view.removeParam(name);
|
|
1572
|
-
}
|
|
1573
|
-
}));
|
|
1574
|
-
}
|
|
1575
|
-
//获取当前页面类型为String的taskId参数
|
|
1576
|
-
uniqueTaskId(view: View) {
|
|
1577
|
-
let count = 0;
|
|
1578
|
-
let uniqueName = 'taskId0';
|
|
1579
|
-
let param = view.params.find((param) => param.name === 'taskId');
|
|
1580
|
-
if (!param || param.typeAnnotation.typeName === 'String')
|
|
1581
|
-
return 'taskId';
|
|
1582
|
-
do {
|
|
1583
|
-
count++;
|
|
1584
|
-
uniqueName = uniqueName.substring(0, uniqueName.length - 1) + count;
|
|
1585
|
-
param = view.params.find((param) => param.name === uniqueName);
|
|
1586
|
-
if (!param) {
|
|
1587
|
-
return uniqueName;
|
|
1588
|
-
}
|
|
1589
|
-
} while (param.typeAnnotation.typeName !== 'String');
|
|
1590
|
-
return uniqueName;
|
|
1591
|
-
}
|
|
1768
|
+
logics.forEach((logic) => {
|
|
1769
|
+
logic.parentNode = this.process;
|
|
1592
1770
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
// this.syncLogic();
|
|
1596
|
-
const tab0 = indent((state?.tabSize || 0));
|
|
1597
|
-
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
1598
|
-
const tab3 = indent((state?.tabSize || 0) + 2);
|
|
1599
|
-
const tab4 = indent((state?.tabSize || 0) + 3);
|
|
1600
|
-
const tab5 = indent((state?.tabSize || 0) + 4);
|
|
1601
|
-
const tab6 = indent((state?.tabSize || 0) + 5);
|
|
1602
|
-
const constantsArr: any = [];
|
|
1603
|
-
const returnsArr: any = [];
|
|
1604
|
-
let code = `${this.name}: {\n`;
|
|
1605
|
-
this.variables.forEach((property) => {
|
|
1606
|
-
code += `${tab1}`;
|
|
1607
|
-
code += `${property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true }))},\n`;
|
|
1608
|
-
});
|
|
1609
|
-
this.returns.forEach((property, index) => {
|
|
1610
|
-
code += `${tab1}`;
|
|
1611
|
-
returnsArr.push(property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true })));
|
|
1612
|
-
code += `${returnsArr[index]},\n`;
|
|
1613
|
-
});
|
|
1614
|
-
this.constants.forEach((property, index) => {
|
|
1615
|
-
code += `${tab1}`;
|
|
1616
|
-
constantsArr.push(property.toEmbeddedTSInProcess(shiftState(state, code, { inline: true })));
|
|
1617
|
-
code += `${constantsArr[index]},\n`;
|
|
1771
|
+
code += logic.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 3 }));
|
|
1772
|
+
code += ',\n';
|
|
1618
1773
|
});
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
if (['ExclusiveGateway', 'AutoTask', 'InclusiveGateway'].includes(this.type)) {
|
|
1709
|
-
prevCode += `\n${tab5}${this.name}: elements.${this.name},\n`;
|
|
1710
|
-
prevCode += `${tab3}}\n`;
|
|
1711
|
-
code += `${tab1}logic: `;
|
|
1712
|
-
code += `${this.logic.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 3 }), prevCode, true)},\n`;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
if (this.isUserTask || this.type === 'AutoTask' || this.type === 'StartNoneEvent') {
|
|
1716
|
-
code += '_constraints: function() {\n';
|
|
1717
|
-
code += `${tab1}nasl.process.oneOutcomeFlow(${afterLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1718
|
-
code += '},\n';
|
|
1719
|
-
}
|
|
1720
|
-
if (['ExclusiveGateway', 'ParallelGateway', 'InclusiveGateway'].includes(this.type)) {
|
|
1721
|
-
code += '_constraints: function() {\n';
|
|
1722
|
-
code += `${tab1}nasl.process.atLeastOneOutcomeFlow(${afterLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1723
|
-
code += `${tab1}nasl.process.atLeastOneOutcomeFlow(${beforeLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1724
|
-
if (afterLinks.length > 0 && beforeLinks.length > 0) {
|
|
1725
|
-
code += `${tab1}nasl.process.atLeastThreeOutcomeFlow(${beforeLinks.concat(afterLinks).map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1726
|
-
}
|
|
1727
|
-
code += '},\n';
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
if (!isFromStartNode(this)) {
|
|
1731
|
-
code += '__outOfProcess__,';
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
code += `${tab0}\n},`;
|
|
1735
|
-
// let code = '';
|
|
1736
|
-
// this.variables.forEach((property) => {
|
|
1737
|
-
// code += `${tab0}export let `;
|
|
1738
|
-
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1739
|
-
// code += ';\n';
|
|
1740
|
-
// });
|
|
1741
|
-
|
|
1742
|
-
// this.returns.forEach((property) => {
|
|
1743
|
-
// code += `${tab0}export let `;
|
|
1744
|
-
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1745
|
-
// code += ';\n';
|
|
1746
|
-
// });
|
|
1747
|
-
// this.constants.forEach((property) => {
|
|
1748
|
-
// code += `${tab0}export let `;
|
|
1749
|
-
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1750
|
-
// code += ';\n';
|
|
1751
|
-
// });
|
|
1752
|
-
return code;
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
// syncLogic() {
|
|
1756
|
-
// if (this.type === 'UserTask') {
|
|
1757
|
-
// if (!this.logic) {
|
|
1758
|
-
// this.logic = new Logic({
|
|
1759
|
-
// name: `complete`,
|
|
1760
|
-
// });
|
|
1761
|
-
// }
|
|
1762
|
-
// this.logic.params = [...this.constants.map(constantToParam), ...this.returns.map(returnToParam)];
|
|
1763
|
-
// }
|
|
1764
|
-
// }
|
|
1765
|
-
|
|
1766
|
-
/**
|
|
1767
|
-
* 设置流程元素名称
|
|
1768
|
-
*/
|
|
1769
|
-
// setNameWithFlowChange(name: string) {
|
|
1770
|
-
// this.app.emit('collect:start', {
|
|
1771
|
-
// actionMsg: '设置流程元素名称',
|
|
1772
|
-
// });
|
|
1773
|
-
// const oldName = this.name;
|
|
1774
|
-
// this.setName(name);
|
|
1775
|
-
// const process = this.process;
|
|
1776
|
-
// process.elements.forEach((el) => {
|
|
1777
|
-
// if (el.sourceRef === oldName) {
|
|
1778
|
-
// el.setSourceRef(name);
|
|
1779
|
-
// }
|
|
1780
|
-
// if (el.targetRef === oldName) {
|
|
1781
|
-
// el.setTargetRef(name);
|
|
1782
|
-
// }
|
|
1783
|
-
// });
|
|
1784
|
-
// this.app.emit('collect:end');
|
|
1785
|
-
// }
|
|
1786
|
-
//================================================================================
|
|
1787
|
-
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1788
|
-
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
1789
|
-
//================================================================================
|
|
1774
|
+
code += `${tab1}},\n`;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
if (['ExclusiveGateway', 'AutoTask', 'InclusiveGateway'].includes(this.type)) {
|
|
1778
|
+
prevCode += `\n${tab5}${this.name}: elements.${this.name},\n`;
|
|
1779
|
+
prevCode += `${tab3}}\n`;
|
|
1780
|
+
code += `${tab1}logic: `;
|
|
1781
|
+
code += `${this.logic.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 3 }), prevCode, true)},\n`;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (this.isUserTask || this.type === 'AutoTask' || this.type === 'StartNoneEvent') {
|
|
1785
|
+
code += '_constraints: function() {\n';
|
|
1786
|
+
code += `${tab1}nasl.process.oneOutcomeFlow(${afterLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1787
|
+
code += '},\n';
|
|
1788
|
+
}
|
|
1789
|
+
if (['ExclusiveGateway', 'ParallelGateway', 'InclusiveGateway'].includes(this.type)) {
|
|
1790
|
+
code += '_constraints: function() {\n';
|
|
1791
|
+
code += `${tab1}nasl.process.atLeastOneOutcomeFlow(${afterLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1792
|
+
code += `${tab1}nasl.process.atLeastOneOutcomeFlow(${beforeLinks.map((l) => `'${l.name}'`).join(',')})\n`;
|
|
1793
|
+
if (afterLinks.length > 0 && beforeLinks.length > 0) {
|
|
1794
|
+
code += `${tab1}nasl.process.atLeastThreeOutcomeFlow(${beforeLinks
|
|
1795
|
+
.concat(afterLinks)
|
|
1796
|
+
.map((l) => `'${l.name}'`)
|
|
1797
|
+
.join(',')})\n`;
|
|
1798
|
+
}
|
|
1799
|
+
code += '},\n';
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
if (!isFromStartNode(this)) {
|
|
1803
|
+
code += '__outOfProcess__,';
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
code += `${tab0}\n},`;
|
|
1807
|
+
// let code = '';
|
|
1808
|
+
// this.variables.forEach((property) => {
|
|
1809
|
+
// code += `${tab0}export let `;
|
|
1810
|
+
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1811
|
+
// code += ';\n';
|
|
1812
|
+
// });
|
|
1813
|
+
|
|
1814
|
+
// this.returns.forEach((property) => {
|
|
1815
|
+
// code += `${tab0}export let `;
|
|
1816
|
+
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1817
|
+
// code += ';\n';
|
|
1818
|
+
// });
|
|
1819
|
+
// this.constants.forEach((property) => {
|
|
1820
|
+
// code += `${tab0}export let `;
|
|
1821
|
+
// code += property.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1822
|
+
// code += ';\n';
|
|
1823
|
+
// });
|
|
1824
|
+
return code;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
// syncLogic() {
|
|
1828
|
+
// if (this.type === 'UserTask') {
|
|
1829
|
+
// if (!this.logic) {
|
|
1830
|
+
// this.logic = new Logic({
|
|
1831
|
+
// name: `complete`,
|
|
1832
|
+
// });
|
|
1833
|
+
// }
|
|
1834
|
+
// this.logic.params = [...this.constants.map(constantToParam), ...this.returns.map(returnToParam)];
|
|
1835
|
+
// }
|
|
1836
|
+
// }
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* 设置流程元素名称
|
|
1840
|
+
*/
|
|
1841
|
+
// setNameWithFlowChange(name: string) {
|
|
1842
|
+
// this.app.emit('collect:start', {
|
|
1843
|
+
// actionMsg: '设置流程元素名称',
|
|
1844
|
+
// });
|
|
1845
|
+
// const oldName = this.name;
|
|
1846
|
+
// this.setName(name);
|
|
1847
|
+
// const process = this.process;
|
|
1848
|
+
// process.elements.forEach((el) => {
|
|
1849
|
+
// if (el.sourceRef === oldName) {
|
|
1850
|
+
// el.setSourceRef(name);
|
|
1851
|
+
// }
|
|
1852
|
+
// if (el.targetRef === oldName) {
|
|
1853
|
+
// el.setTargetRef(name);
|
|
1854
|
+
// }
|
|
1855
|
+
// });
|
|
1856
|
+
// this.app.emit('collect:end');
|
|
1857
|
+
// }
|
|
1858
|
+
//= ===============================================================================
|
|
1859
|
+
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1860
|
+
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
1861
|
+
//= ===============================================================================
|
|
1790
1862
|
}
|
|
1791
1863
|
|
|
1792
1864
|
classMap.ProcessElement = ProcessElement;
|
|
1793
1865
|
export default ProcessElement;
|
|
1794
|
-
|
|
1866
|
+
//= ===============================================================================
|
|
1795
1867
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1796
1868
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
1797
|
-
|
|
1869
|
+
//= ===============================================================================
|
|
1798
1870
|
ProcessElement.prototype.setName = function (name: string) {
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1871
|
+
const App = this.rootNode;
|
|
1872
|
+
const oldName = this.name;
|
|
1873
|
+
const processName = this.parentNode.name;
|
|
1874
|
+
|
|
1875
|
+
App.emit('collect:start', {
|
|
1876
|
+
actionMsg: '设置名称',
|
|
1877
|
+
});
|
|
1878
|
+
const object = {
|
|
1879
|
+
name,
|
|
1880
|
+
};
|
|
1881
|
+
this.update({
|
|
1882
|
+
...object,
|
|
1883
|
+
field: 'name',
|
|
1884
|
+
});
|
|
1885
|
+
syncMemberExpression(this, (node) => {
|
|
1886
|
+
if (node.object.name === processName && node.property.name === oldName) {
|
|
1887
|
+
node.property.update({
|
|
1807
1888
|
name,
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
}
|
|
1825
|
-
if (el.targetRef === oldName) {
|
|
1826
|
-
el.setTargetRef(name);
|
|
1827
|
-
}
|
|
1828
|
-
});
|
|
1829
|
-
if (this.logic) {
|
|
1830
|
-
this.logic.setName(name);
|
|
1831
|
-
}
|
|
1832
|
-
App.emit('collect:end');
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
const { process } = this;
|
|
1893
|
+
process.elements.forEach((el) => {
|
|
1894
|
+
if (el.sourceRef === oldName) {
|
|
1895
|
+
el.setSourceRef(name);
|
|
1896
|
+
}
|
|
1897
|
+
if (el.targetRef === oldName) {
|
|
1898
|
+
el.setTargetRef(name);
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
if (this.logic) {
|
|
1902
|
+
this.logic.setName(name);
|
|
1903
|
+
}
|
|
1904
|
+
App.emit('collect:end');
|
|
1833
1905
|
};
|