@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
package/src/concepts/View__.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1
2
|
import Namespace from './Namespace__';
|
|
2
3
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
3
4
|
import translator from '../bak/translator';
|
|
4
|
-
import { ElementToVueOptions } from './ViewElement__';
|
|
5
|
+
import ViewElement, { ElementToVueOptions } from './ViewElement__';
|
|
5
6
|
import { Structure } from './Structure__';
|
|
6
7
|
import MemberExpression from './MemberExpression__';
|
|
7
8
|
import Identifier from './Identifier__';
|
|
@@ -11,18 +12,16 @@ import BatchAssignment from './BatchAssignment__';
|
|
|
11
12
|
import CallInterface from './CallInterface__';
|
|
12
13
|
import CallLogic from './CallLogic__';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
//= ===============================================================================
|
|
15
16
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
16
17
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
17
|
-
|
|
18
|
+
//= ===============================================================================
|
|
18
19
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
19
20
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
20
21
|
|
|
21
22
|
import * as utils from '../utils';
|
|
22
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
23
23
|
import BaseNode from '../common/BaseNode';
|
|
24
24
|
import classMap from '../common/classMap';
|
|
25
|
-
import ViewElement from './ViewElement__';
|
|
26
25
|
import Param from './Param__';
|
|
27
26
|
import Variable from './Variable__';
|
|
28
27
|
import Logic from './Logic__';
|
|
@@ -37,1630 +36,1716 @@ import TypeAnnotation from './TypeAnnotation__';
|
|
|
37
36
|
*/
|
|
38
37
|
@concept('页面')
|
|
39
38
|
export class View extends BaseNode {
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
this
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
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
|
-
|
|
883
|
-
|
|
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
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 产品概念
|
|
41
|
+
*/
|
|
42
|
+
@property()
|
|
43
|
+
concept: 'View' = 'View';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 页面模板 Id
|
|
47
|
+
*/
|
|
48
|
+
@property()
|
|
49
|
+
pageTemplateId: string = undefined;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 页面名称
|
|
53
|
+
*/
|
|
54
|
+
@property()
|
|
55
|
+
name: string = undefined;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 唯一标识
|
|
59
|
+
*/
|
|
60
|
+
@property()
|
|
61
|
+
uuid: string = undefined;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 页面标题
|
|
65
|
+
*/
|
|
66
|
+
@property()
|
|
67
|
+
title: string = undefined;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 面包屑
|
|
71
|
+
*/
|
|
72
|
+
@property()
|
|
73
|
+
crumb: string = undefined;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 权限控制
|
|
77
|
+
*/
|
|
78
|
+
@property()
|
|
79
|
+
auth: boolean = undefined;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 权限资源描述
|
|
83
|
+
*/
|
|
84
|
+
@property()
|
|
85
|
+
authDescription: string = undefined;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 是否是默认跳转的页面
|
|
89
|
+
*/
|
|
90
|
+
@property()
|
|
91
|
+
isIndex: boolean = undefined;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 未解析的模板代码
|
|
95
|
+
*/
|
|
96
|
+
@property()
|
|
97
|
+
template: string = undefined;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 未解析的逻辑代码
|
|
101
|
+
*/
|
|
102
|
+
@property()
|
|
103
|
+
script: string = undefined;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 未解析的样式代码
|
|
107
|
+
*/
|
|
108
|
+
@property()
|
|
109
|
+
style: string = undefined;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 页面元素列表
|
|
113
|
+
*/
|
|
114
|
+
@property('ViewElement')
|
|
115
|
+
elements: Array<ViewElement> = [];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 输入参数列表
|
|
119
|
+
*/
|
|
120
|
+
@property('Param')
|
|
121
|
+
params: Array<Param> = [];
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 变量列表
|
|
125
|
+
*/
|
|
126
|
+
@property('Variable')
|
|
127
|
+
variables: Array<Variable> = [];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 逻辑列表
|
|
131
|
+
*/
|
|
132
|
+
@property('Logic')
|
|
133
|
+
logics: Array<Logic> = [];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 元素绑定事件列表
|
|
137
|
+
*/
|
|
138
|
+
@property('BindEvent')
|
|
139
|
+
bindEvents: Array<BindEvent> = [];
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* 绑定的角色
|
|
143
|
+
*/
|
|
144
|
+
@property()
|
|
145
|
+
bindRoles: Array<string> = [];
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 页面列表
|
|
149
|
+
*/
|
|
150
|
+
@property('View')
|
|
151
|
+
children: Array<View> = [];
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 祖先 Module
|
|
155
|
+
*/
|
|
156
|
+
get module() {
|
|
157
|
+
return this.getAncestor('Module') as Module;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 祖先 App
|
|
162
|
+
*/
|
|
163
|
+
get app() {
|
|
164
|
+
return this.getAncestor('App') as App;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 祖先 Frontend
|
|
169
|
+
*/
|
|
170
|
+
get frontend() {
|
|
171
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param source 需要合并的部分参数
|
|
176
|
+
*/
|
|
177
|
+
constructor(source?: Partial<View>) {
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
source = { ...View.getDefaultOptions(), ...source };
|
|
180
|
+
super(source);
|
|
181
|
+
super.subConstructor(source);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getClassName() {
|
|
185
|
+
return 'View';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
static from(source: any, parentNode?: any, parentKey?: string): View {
|
|
189
|
+
return super.from(source, parentNode, parentKey) as View;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 从父级删除该节点
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
_delete() {
|
|
197
|
+
let params: Params = null;
|
|
198
|
+
if (this.parentNode) {
|
|
199
|
+
params = (this.parentNode as any)?.__removeView?.(this);
|
|
200
|
+
}
|
|
201
|
+
return params;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 设置页面名称
|
|
206
|
+
*/
|
|
207
|
+
setName(name: string) {
|
|
208
|
+
const object = {
|
|
209
|
+
name,
|
|
210
|
+
};
|
|
211
|
+
this.update({
|
|
212
|
+
...object,
|
|
213
|
+
field: 'name',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 设置页面标题
|
|
219
|
+
*/
|
|
220
|
+
setTitle(title: string) {
|
|
221
|
+
const object = {
|
|
222
|
+
title,
|
|
223
|
+
};
|
|
224
|
+
this.update({
|
|
225
|
+
...object,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* 设置面包屑
|
|
231
|
+
*/
|
|
232
|
+
setCrumb(crumb: string) {
|
|
233
|
+
const object = {
|
|
234
|
+
crumb,
|
|
235
|
+
};
|
|
236
|
+
this.update({
|
|
237
|
+
...object,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* 设置权限控制
|
|
243
|
+
*/
|
|
244
|
+
setAuth(auth: boolean) {
|
|
245
|
+
const object = {
|
|
246
|
+
auth,
|
|
247
|
+
};
|
|
248
|
+
this.update({
|
|
249
|
+
...object,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* 设置权限资源描述
|
|
255
|
+
*/
|
|
256
|
+
setAuthDescription(authDescription: string) {
|
|
257
|
+
const object = {
|
|
258
|
+
authDescription,
|
|
259
|
+
};
|
|
260
|
+
this.update({
|
|
261
|
+
...object,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 设置是否是默认跳转的页面
|
|
267
|
+
*/
|
|
268
|
+
setIsIndex(isIndex: boolean) {
|
|
269
|
+
const object = {
|
|
270
|
+
isIndex,
|
|
271
|
+
};
|
|
272
|
+
this.update({
|
|
273
|
+
...object,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* 插入页面元素
|
|
279
|
+
* @internal
|
|
280
|
+
* @param name 页面元素名称,如果不填会自动生成一个唯一名称
|
|
281
|
+
*/
|
|
282
|
+
_insertViewElementAt(name: string, index: number): ViewElement;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 插入页面元素
|
|
286
|
+
* @internal
|
|
287
|
+
* @param viewElementOptions 页面元素参数
|
|
288
|
+
*/
|
|
289
|
+
_insertViewElementAt(viewElementOptions: Partial<ViewElement>, index: number): ViewElement;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 插入页面元素
|
|
293
|
+
* @internal
|
|
294
|
+
* @param viewElement 已有的页面元素实例
|
|
295
|
+
*/
|
|
296
|
+
_insertViewElementAt(viewElement: ViewElement, index: number): ViewElement;
|
|
297
|
+
|
|
298
|
+
_insertViewElementAt(options: string | Partial<ViewElement> | ViewElement, index: number) {
|
|
299
|
+
const viewElementOptions: any = {};
|
|
300
|
+
const relationOptions = { parentNode: this, parentKey: 'elements' };
|
|
301
|
+
let viewElement: ViewElement;
|
|
302
|
+
if (!options) {
|
|
303
|
+
viewElement = ViewElement.from(
|
|
304
|
+
{
|
|
305
|
+
...viewElementOptions,
|
|
306
|
+
name: this.getViewElementUniqueName(),
|
|
307
|
+
},
|
|
308
|
+
this,
|
|
309
|
+
'elements'
|
|
310
|
+
);
|
|
311
|
+
} else if (typeof options === 'string') {
|
|
312
|
+
viewElement = ViewElement.from(
|
|
313
|
+
{
|
|
314
|
+
...viewElementOptions,
|
|
315
|
+
name: options,
|
|
316
|
+
},
|
|
317
|
+
this,
|
|
318
|
+
'elements'
|
|
319
|
+
);
|
|
320
|
+
} else if (options instanceof ViewElement) {
|
|
321
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
322
|
+
viewElement = options;
|
|
323
|
+
Object.assign(viewElement, relationOptions);
|
|
324
|
+
} else {
|
|
325
|
+
viewElement = ViewElement.from(
|
|
326
|
+
{
|
|
327
|
+
...viewElementOptions,
|
|
328
|
+
...options,
|
|
329
|
+
},
|
|
330
|
+
this,
|
|
331
|
+
'elements'
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
this.elements.splice(index, 0, viewElement);
|
|
335
|
+
return viewElement;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* 插入页面元素
|
|
340
|
+
* @param name 页面元素名称,如果不填会自动生成一个唯一名称
|
|
341
|
+
*/
|
|
342
|
+
insertViewElementAt(name: string, index: number): ViewElement;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* 插入页面元素
|
|
346
|
+
* @param viewElementOptions 页面元素参数
|
|
347
|
+
*/
|
|
348
|
+
insertViewElementAt(viewElementOptions: Partial<ViewElement>, index: number): ViewElement;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* 插入页面元素
|
|
352
|
+
* @param viewElement 已有的页面元素实例
|
|
353
|
+
*/
|
|
354
|
+
insertViewElementAt(viewElement: ViewElement, index: number): ViewElement;
|
|
355
|
+
|
|
356
|
+
insertViewElementAt(options: string | Partial<ViewElement> | ViewElement, index: number) {
|
|
357
|
+
const node = this._insertViewElementAt(options as any, index);
|
|
358
|
+
node.create({
|
|
359
|
+
index,
|
|
360
|
+
parentNode: this,
|
|
361
|
+
parentKey: 'elements',
|
|
362
|
+
});
|
|
363
|
+
return node;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 添加页面元素
|
|
368
|
+
* @internal
|
|
369
|
+
* @param name 页面元素名称,如果不填会自动生成一个唯一名称
|
|
370
|
+
*/
|
|
371
|
+
_addViewElement(name?: string): ViewElement;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* 添加页面元素
|
|
375
|
+
* @internal
|
|
376
|
+
* @param viewElementOptions 页面元素参数
|
|
377
|
+
*/
|
|
378
|
+
_addViewElement(viewElementOptions: Partial<ViewElement>): ViewElement;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* 添加页面元素
|
|
382
|
+
* @internal
|
|
383
|
+
* @param viewElement 已有的页面元素实例
|
|
384
|
+
*/
|
|
385
|
+
_addViewElement(viewElement: ViewElement): ViewElement;
|
|
386
|
+
|
|
387
|
+
_addViewElement(options?: string | Partial<ViewElement> | ViewElement) {
|
|
388
|
+
const index = this.elements.length;
|
|
389
|
+
return this._insertViewElementAt(options as any, index);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* 添加页面元素
|
|
394
|
+
* @internal
|
|
395
|
+
* @param name 页面元素名称,如果不填会自动生成一个唯一名称
|
|
396
|
+
*/
|
|
397
|
+
addViewElement(name?: string): ViewElement;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* 添加页面元素
|
|
401
|
+
* @param viewElementOptions 页面元素参数
|
|
402
|
+
*/
|
|
403
|
+
addViewElement(viewElementOptions: Partial<ViewElement>): ViewElement;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* 添加页面元素
|
|
407
|
+
* @param viewElement 已有的页面元素实例
|
|
408
|
+
*/
|
|
409
|
+
addViewElement(viewElement: ViewElement): ViewElement;
|
|
410
|
+
|
|
411
|
+
addViewElement(options?: string | Partial<ViewElement> | ViewElement) {
|
|
412
|
+
const node = this._addViewElement(options as any);
|
|
413
|
+
const index = this.elements.indexOf(node);
|
|
414
|
+
node.create({
|
|
415
|
+
index,
|
|
416
|
+
parentNode: this,
|
|
417
|
+
parentKey: 'elements',
|
|
418
|
+
});
|
|
419
|
+
return node;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
getParamUniqueName(name = 'param1') {
|
|
423
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 插入输入参数
|
|
428
|
+
* @internal
|
|
429
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
430
|
+
*/
|
|
431
|
+
_insertParamAt(name: string, index: number): Param;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* 插入输入参数
|
|
435
|
+
* @internal
|
|
436
|
+
* @param paramOptions 输入参数参数
|
|
437
|
+
*/
|
|
438
|
+
_insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* 插入输入参数
|
|
442
|
+
* @internal
|
|
443
|
+
* @param param 已有的输入参数实例
|
|
444
|
+
*/
|
|
445
|
+
_insertParamAt(param: Param, index: number): Param;
|
|
446
|
+
|
|
447
|
+
_insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
448
|
+
const paramOptions: any = {};
|
|
449
|
+
const relationOptions = { parentNode: this, parentKey: 'params' };
|
|
450
|
+
let param: Param;
|
|
451
|
+
if (!options) {
|
|
452
|
+
param = Param.from(
|
|
453
|
+
{
|
|
454
|
+
...paramOptions,
|
|
455
|
+
name: this.getParamUniqueName(),
|
|
456
|
+
},
|
|
457
|
+
this,
|
|
458
|
+
'params'
|
|
459
|
+
);
|
|
460
|
+
} else if (typeof options === 'string') {
|
|
461
|
+
param = Param.from(
|
|
462
|
+
{
|
|
463
|
+
...paramOptions,
|
|
464
|
+
name: options,
|
|
465
|
+
},
|
|
466
|
+
this,
|
|
467
|
+
'params'
|
|
468
|
+
);
|
|
469
|
+
} else if (options instanceof Param) {
|
|
470
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
471
|
+
param = options;
|
|
472
|
+
Object.assign(param, relationOptions);
|
|
473
|
+
} else {
|
|
474
|
+
param = Param.from(
|
|
475
|
+
{
|
|
476
|
+
...paramOptions,
|
|
477
|
+
...options,
|
|
478
|
+
},
|
|
479
|
+
this,
|
|
480
|
+
'params'
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
this.params.splice(index, 0, param);
|
|
484
|
+
return param;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* 插入输入参数
|
|
489
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
490
|
+
*/
|
|
491
|
+
insertParamAt(name: string, index: number): Param;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* 插入输入参数
|
|
495
|
+
* @param paramOptions 输入参数参数
|
|
496
|
+
*/
|
|
497
|
+
insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* 插入输入参数
|
|
501
|
+
* @param param 已有的输入参数实例
|
|
502
|
+
*/
|
|
503
|
+
insertParamAt(param: Param, index: number): Param;
|
|
504
|
+
|
|
505
|
+
insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
506
|
+
const node = this._insertParamAt(options as any, index);
|
|
507
|
+
node.create({
|
|
508
|
+
index,
|
|
509
|
+
parentNode: this,
|
|
510
|
+
parentKey: 'params',
|
|
511
|
+
});
|
|
512
|
+
return node;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* 添加输入参数
|
|
517
|
+
* @internal
|
|
518
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
519
|
+
*/
|
|
520
|
+
_addParam(name?: string): Param;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* 添加输入参数
|
|
524
|
+
* @internal
|
|
525
|
+
* @param paramOptions 输入参数参数
|
|
526
|
+
*/
|
|
527
|
+
_addParam(paramOptions: Partial<Param>): Param;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* 添加输入参数
|
|
531
|
+
* @internal
|
|
532
|
+
* @param param 已有的输入参数实例
|
|
533
|
+
*/
|
|
534
|
+
_addParam(param: Param): Param;
|
|
535
|
+
|
|
536
|
+
_addParam(options?: string | Partial<Param> | Param) {
|
|
537
|
+
const index = this.params.length;
|
|
538
|
+
return this._insertParamAt(options as any, index);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* 添加输入参数
|
|
543
|
+
* @internal
|
|
544
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
545
|
+
*/
|
|
546
|
+
addParam(name?: string): Param;
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* 添加输入参数
|
|
550
|
+
* @param paramOptions 输入参数参数
|
|
551
|
+
*/
|
|
552
|
+
addParam(paramOptions: Partial<Param>): Param;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* 添加输入参数
|
|
556
|
+
* @param param 已有的输入参数实例
|
|
557
|
+
*/
|
|
558
|
+
addParam(param: Param): Param;
|
|
559
|
+
|
|
560
|
+
addParam(options?: string | Partial<Param> | Param) {
|
|
561
|
+
const node = this._addParam(options as any);
|
|
562
|
+
const index = this.params.indexOf(node);
|
|
563
|
+
node.create({
|
|
564
|
+
index,
|
|
565
|
+
parentNode: this,
|
|
566
|
+
parentKey: 'params',
|
|
567
|
+
});
|
|
568
|
+
return node;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
getVariableUniqueName(name = 'variable1') {
|
|
572
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* 插入变量
|
|
577
|
+
* @internal
|
|
578
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
579
|
+
*/
|
|
580
|
+
_insertVariableAt(name: string, index: number): Variable;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* 插入变量
|
|
584
|
+
* @internal
|
|
585
|
+
* @param variableOptions 变量参数
|
|
586
|
+
*/
|
|
587
|
+
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* 插入变量
|
|
591
|
+
* @internal
|
|
592
|
+
* @param variable 已有的变量实例
|
|
593
|
+
*/
|
|
594
|
+
_insertVariableAt(variable: Variable, index: number): Variable;
|
|
595
|
+
|
|
596
|
+
_insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
597
|
+
const variableOptions: any = {};
|
|
598
|
+
const relationOptions = { parentNode: this, parentKey: 'variables' };
|
|
599
|
+
let variable: Variable;
|
|
600
|
+
if (!options) {
|
|
601
|
+
variable = Variable.from(
|
|
602
|
+
{
|
|
603
|
+
...variableOptions,
|
|
604
|
+
name: this.getVariableUniqueName(),
|
|
605
|
+
},
|
|
606
|
+
this,
|
|
607
|
+
'variables'
|
|
608
|
+
);
|
|
609
|
+
} else if (typeof options === 'string') {
|
|
610
|
+
variable = Variable.from(
|
|
611
|
+
{
|
|
612
|
+
...variableOptions,
|
|
613
|
+
name: options,
|
|
614
|
+
},
|
|
615
|
+
this,
|
|
616
|
+
'variables'
|
|
617
|
+
);
|
|
618
|
+
} else if (options instanceof Variable) {
|
|
619
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
620
|
+
variable = options;
|
|
621
|
+
Object.assign(variable, relationOptions);
|
|
622
|
+
} else {
|
|
623
|
+
variable = Variable.from(
|
|
624
|
+
{
|
|
625
|
+
...variableOptions,
|
|
626
|
+
...options,
|
|
627
|
+
},
|
|
628
|
+
this,
|
|
629
|
+
'variables'
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
this.variables.splice(index, 0, variable);
|
|
633
|
+
return variable;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* 插入变量
|
|
638
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
639
|
+
*/
|
|
640
|
+
insertVariableAt(name: string, index: number): Variable;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* 插入变量
|
|
644
|
+
* @param variableOptions 变量参数
|
|
645
|
+
*/
|
|
646
|
+
insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* 插入变量
|
|
650
|
+
* @param variable 已有的变量实例
|
|
651
|
+
*/
|
|
652
|
+
insertVariableAt(variable: Variable, index: number): Variable;
|
|
653
|
+
|
|
654
|
+
insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
655
|
+
const node = this._insertVariableAt(options as any, index);
|
|
656
|
+
node.create({
|
|
657
|
+
index,
|
|
658
|
+
parentNode: this,
|
|
659
|
+
parentKey: 'variables',
|
|
660
|
+
});
|
|
661
|
+
return node;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* 添加变量
|
|
666
|
+
* @internal
|
|
667
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
668
|
+
*/
|
|
669
|
+
_addVariable(name?: string): Variable;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* 添加变量
|
|
673
|
+
* @internal
|
|
674
|
+
* @param variableOptions 变量参数
|
|
675
|
+
*/
|
|
676
|
+
_addVariable(variableOptions: Partial<Variable>): Variable;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* 添加变量
|
|
680
|
+
* @internal
|
|
681
|
+
* @param variable 已有的变量实例
|
|
682
|
+
*/
|
|
683
|
+
_addVariable(variable: Variable): Variable;
|
|
684
|
+
|
|
685
|
+
_addVariable(options?: string | Partial<Variable> | Variable) {
|
|
686
|
+
const index = this.variables.length;
|
|
687
|
+
return this._insertVariableAt(options as any, index);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* 添加变量
|
|
692
|
+
* @internal
|
|
693
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
694
|
+
*/
|
|
695
|
+
addVariable(name?: string): Variable;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* 添加变量
|
|
699
|
+
* @param variableOptions 变量参数
|
|
700
|
+
*/
|
|
701
|
+
addVariable(variableOptions: Partial<Variable>): Variable;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* 添加变量
|
|
705
|
+
* @param variable 已有的变量实例
|
|
706
|
+
*/
|
|
707
|
+
addVariable(variable: Variable): Variable;
|
|
708
|
+
|
|
709
|
+
addVariable(options?: string | Partial<Variable> | Variable) {
|
|
710
|
+
const node = this._addVariable(options as any);
|
|
711
|
+
const index = this.variables.indexOf(node);
|
|
712
|
+
node.create({
|
|
713
|
+
index,
|
|
714
|
+
parentNode: this,
|
|
715
|
+
parentKey: 'variables',
|
|
716
|
+
});
|
|
717
|
+
return node;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
getLogicUniqueName(name = 'logic1') {
|
|
721
|
+
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* 插入逻辑
|
|
726
|
+
* @internal
|
|
727
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
728
|
+
*/
|
|
729
|
+
_insertLogicAt(name: string, index: number): Logic;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* 插入逻辑
|
|
733
|
+
* @internal
|
|
734
|
+
* @param logicOptions 逻辑参数
|
|
735
|
+
*/
|
|
736
|
+
_insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* 插入逻辑
|
|
740
|
+
* @internal
|
|
741
|
+
* @param logic 已有的逻辑实例
|
|
742
|
+
*/
|
|
743
|
+
_insertLogicAt(logic: Logic, index: number): Logic;
|
|
744
|
+
|
|
745
|
+
_insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
|
|
746
|
+
const logicOptions: any = {};
|
|
747
|
+
const relationOptions = { parentNode: this, parentKey: 'logics' };
|
|
748
|
+
let logic: Logic;
|
|
749
|
+
if (!options) {
|
|
750
|
+
logic = Logic.from(
|
|
751
|
+
{
|
|
752
|
+
...logicOptions,
|
|
753
|
+
name: this.getLogicUniqueName(),
|
|
754
|
+
},
|
|
755
|
+
this,
|
|
756
|
+
'logics'
|
|
757
|
+
);
|
|
758
|
+
} else if (typeof options === 'string') {
|
|
759
|
+
logic = Logic.from(
|
|
760
|
+
{
|
|
761
|
+
...logicOptions,
|
|
762
|
+
name: options,
|
|
763
|
+
},
|
|
764
|
+
this,
|
|
765
|
+
'logics'
|
|
766
|
+
);
|
|
767
|
+
} else if (options instanceof Logic) {
|
|
768
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
769
|
+
logic = options;
|
|
770
|
+
Object.assign(logic, relationOptions);
|
|
771
|
+
} else {
|
|
772
|
+
logic = Logic.from(
|
|
773
|
+
{
|
|
774
|
+
...logicOptions,
|
|
775
|
+
...options,
|
|
776
|
+
},
|
|
777
|
+
this,
|
|
778
|
+
'logics'
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
this.logics.splice(index, 0, logic);
|
|
782
|
+
return logic;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* 插入逻辑
|
|
787
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
788
|
+
*/
|
|
789
|
+
insertLogicAt(name: string, index: number): Logic;
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* 插入逻辑
|
|
793
|
+
* @param logicOptions 逻辑参数
|
|
794
|
+
*/
|
|
795
|
+
insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* 插入逻辑
|
|
799
|
+
* @param logic 已有的逻辑实例
|
|
800
|
+
*/
|
|
801
|
+
insertLogicAt(logic: Logic, index: number): Logic;
|
|
802
|
+
|
|
803
|
+
insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
|
|
804
|
+
const node = this._insertLogicAt(options as any, index);
|
|
805
|
+
node.create({
|
|
806
|
+
index,
|
|
807
|
+
parentNode: this,
|
|
808
|
+
parentKey: 'logics',
|
|
809
|
+
});
|
|
810
|
+
return node;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* 添加逻辑
|
|
815
|
+
* @internal
|
|
816
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
817
|
+
*/
|
|
818
|
+
_addLogic(name?: string): Logic;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* 添加逻辑
|
|
822
|
+
* @internal
|
|
823
|
+
* @param logicOptions 逻辑参数
|
|
824
|
+
*/
|
|
825
|
+
_addLogic(logicOptions: Partial<Logic>): Logic;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* 添加逻辑
|
|
829
|
+
* @internal
|
|
830
|
+
* @param logic 已有的逻辑实例
|
|
831
|
+
*/
|
|
832
|
+
_addLogic(logic: Logic): Logic;
|
|
833
|
+
|
|
834
|
+
_addLogic(options?: string | Partial<Logic> | Logic) {
|
|
835
|
+
const index = this.logics.length;
|
|
836
|
+
return this._insertLogicAt(options as any, index);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* 添加逻辑
|
|
841
|
+
* @internal
|
|
842
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
843
|
+
*/
|
|
844
|
+
addLogic(name?: string): Logic;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* 添加逻辑
|
|
848
|
+
* @param logicOptions 逻辑参数
|
|
849
|
+
*/
|
|
850
|
+
addLogic(logicOptions: Partial<Logic>): Logic;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* 添加逻辑
|
|
854
|
+
* @param logic 已有的逻辑实例
|
|
855
|
+
*/
|
|
856
|
+
addLogic(logic: Logic): Logic;
|
|
857
|
+
|
|
858
|
+
addLogic(options?: string | Partial<Logic> | Logic) {
|
|
859
|
+
const node = this._addLogic(options as any);
|
|
860
|
+
const index = this.logics.indexOf(node);
|
|
861
|
+
node.create({
|
|
862
|
+
index,
|
|
863
|
+
parentNode: this,
|
|
864
|
+
parentKey: 'logics',
|
|
865
|
+
});
|
|
866
|
+
return node;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
870
|
+
const excludedSet = new Set(excludedList);
|
|
871
|
+
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
getBindEventUniqueName(name = 'bindEvent1') {
|
|
875
|
+
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* 插入元素绑定事件
|
|
880
|
+
* @internal
|
|
881
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
882
|
+
*/
|
|
883
|
+
_insertBindEventAt(name: string, index: number): BindEvent;
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* 插入元素绑定事件
|
|
887
|
+
* @internal
|
|
888
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
889
|
+
*/
|
|
890
|
+
_insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* 插入元素绑定事件
|
|
894
|
+
* @internal
|
|
895
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
896
|
+
*/
|
|
897
|
+
_insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
898
|
+
|
|
899
|
+
_insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
900
|
+
const bindEventOptions: any = {};
|
|
901
|
+
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
902
|
+
let bindEvent: BindEvent;
|
|
903
|
+
if (!options) {
|
|
904
|
+
bindEvent = BindEvent.from(
|
|
905
|
+
{
|
|
906
|
+
...bindEventOptions,
|
|
907
|
+
name: this.getBindEventUniqueName(),
|
|
908
|
+
},
|
|
909
|
+
this,
|
|
910
|
+
'bindEvents'
|
|
911
|
+
);
|
|
912
|
+
} else if (typeof options === 'string') {
|
|
913
|
+
bindEvent = BindEvent.from(
|
|
914
|
+
{
|
|
915
|
+
...bindEventOptions,
|
|
916
|
+
name: options,
|
|
917
|
+
},
|
|
918
|
+
this,
|
|
919
|
+
'bindEvents'
|
|
920
|
+
);
|
|
921
|
+
} else if (options instanceof BindEvent) {
|
|
922
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
923
|
+
bindEvent = options;
|
|
924
|
+
Object.assign(bindEvent, relationOptions);
|
|
925
|
+
} else {
|
|
926
|
+
bindEvent = BindEvent.from(
|
|
927
|
+
{
|
|
928
|
+
...bindEventOptions,
|
|
929
|
+
...options,
|
|
930
|
+
},
|
|
931
|
+
this,
|
|
932
|
+
'bindEvents'
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
this.bindEvents.splice(index, 0, bindEvent);
|
|
936
|
+
return bindEvent;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* 插入元素绑定事件
|
|
941
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
942
|
+
*/
|
|
943
|
+
insertBindEventAt(name: string, index: number): BindEvent;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* 插入元素绑定事件
|
|
947
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
948
|
+
*/
|
|
949
|
+
insertBindEventAt(bindEventOptions: Partial<BindEvent>, index: number): BindEvent;
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* 插入元素绑定事件
|
|
953
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
954
|
+
*/
|
|
955
|
+
insertBindEventAt(bindEvent: BindEvent, index: number): BindEvent;
|
|
956
|
+
|
|
957
|
+
insertBindEventAt(options: string | Partial<BindEvent> | BindEvent, index: number) {
|
|
958
|
+
const node = this._insertBindEventAt(options as any, index);
|
|
959
|
+
node.create({
|
|
960
|
+
index,
|
|
961
|
+
parentNode: this,
|
|
962
|
+
parentKey: 'bindEvents',
|
|
963
|
+
});
|
|
964
|
+
return node;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* 添加元素绑定事件
|
|
969
|
+
* @internal
|
|
970
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
971
|
+
*/
|
|
972
|
+
_addBindEvent(name?: string): BindEvent;
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* 添加元素绑定事件
|
|
976
|
+
* @internal
|
|
977
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
978
|
+
*/
|
|
979
|
+
_addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* 添加元素绑定事件
|
|
983
|
+
* @internal
|
|
984
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
985
|
+
*/
|
|
986
|
+
_addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
987
|
+
|
|
988
|
+
_addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
989
|
+
const index = this.bindEvents.length;
|
|
990
|
+
return this._insertBindEventAt(options as any, index);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* 添加元素绑定事件
|
|
995
|
+
* @internal
|
|
996
|
+
* @param name 元素绑定事件名称,如果不填会自动生成一个唯一名称
|
|
997
|
+
*/
|
|
998
|
+
addBindEvent(name?: string): BindEvent;
|
|
999
|
+
|
|
1000
|
+
/**
|
|
1001
|
+
* 添加元素绑定事件
|
|
1002
|
+
* @param bindEventOptions 元素绑定事件参数
|
|
1003
|
+
*/
|
|
1004
|
+
addBindEvent(bindEventOptions: Partial<BindEvent>): BindEvent;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* 添加元素绑定事件
|
|
1008
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
1009
|
+
*/
|
|
1010
|
+
addBindEvent(bindEvent: BindEvent): BindEvent;
|
|
1011
|
+
|
|
1012
|
+
addBindEvent(options?: string | Partial<BindEvent> | BindEvent) {
|
|
1013
|
+
const node = this._addBindEvent(options as any);
|
|
1014
|
+
const index = this.bindEvents.indexOf(node);
|
|
1015
|
+
node.create({
|
|
1016
|
+
index,
|
|
1017
|
+
parentNode: this,
|
|
1018
|
+
parentKey: 'bindEvents',
|
|
1019
|
+
});
|
|
1020
|
+
return node;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
getViewExistingNames(excludedList: Array<View> = []) {
|
|
1024
|
+
const excludedSet = new Set(excludedList);
|
|
1025
|
+
return ((this.children as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
getViewUniqueName(name = 'view1') {
|
|
1029
|
+
return utils.unique(name, this.getViewExistingNames(), undefined, false);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* 插入页面
|
|
1034
|
+
* @internal
|
|
1035
|
+
* @param name 页面名称,如果不填会自动生成一个唯一名称
|
|
1036
|
+
*/
|
|
1037
|
+
_insertViewAt(name: string, index: number): View;
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* 插入页面
|
|
1041
|
+
* @internal
|
|
1042
|
+
* @param viewOptions 页面参数
|
|
1043
|
+
*/
|
|
1044
|
+
_insertViewAt(viewOptions: Partial<View>, index: number): View;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* 插入页面
|
|
1048
|
+
* @internal
|
|
1049
|
+
* @param view 已有的页面实例
|
|
1050
|
+
*/
|
|
1051
|
+
_insertViewAt(view: View, index: number): View;
|
|
1052
|
+
|
|
1053
|
+
_insertViewAt(options: string | Partial<View> | View, index: number) {
|
|
1054
|
+
const viewOptions: any = {};
|
|
1055
|
+
const relationOptions = { parentNode: this, parentKey: 'children' };
|
|
1056
|
+
let view: View;
|
|
1057
|
+
if (!options) {
|
|
1058
|
+
view = View.from(
|
|
1059
|
+
{
|
|
1060
|
+
...viewOptions,
|
|
1061
|
+
name: this.getViewUniqueName(),
|
|
1062
|
+
},
|
|
1063
|
+
this,
|
|
1064
|
+
'children'
|
|
1065
|
+
);
|
|
1066
|
+
} else if (typeof options === 'string') {
|
|
1067
|
+
view = View.from(
|
|
1068
|
+
{
|
|
1069
|
+
...viewOptions,
|
|
1070
|
+
name: options,
|
|
1071
|
+
},
|
|
1072
|
+
this,
|
|
1073
|
+
'children'
|
|
1074
|
+
);
|
|
1075
|
+
} else if (options instanceof View) {
|
|
1076
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1077
|
+
view = options;
|
|
1078
|
+
Object.assign(view, relationOptions);
|
|
1079
|
+
} else {
|
|
1080
|
+
view = View.from(
|
|
1081
|
+
{
|
|
1082
|
+
...viewOptions,
|
|
1083
|
+
...options,
|
|
1084
|
+
},
|
|
1085
|
+
this,
|
|
1086
|
+
'children'
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
this.children.splice(index, 0, view);
|
|
1090
|
+
return view;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* 插入页面
|
|
1095
|
+
* @param name 页面名称,如果不填会自动生成一个唯一名称
|
|
1096
|
+
*/
|
|
1097
|
+
insertViewAt(name: string, index: number): View;
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* 插入页面
|
|
1101
|
+
* @param viewOptions 页面参数
|
|
1102
|
+
*/
|
|
1103
|
+
insertViewAt(viewOptions: Partial<View>, index: number): View;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* 插入页面
|
|
1107
|
+
* @param view 已有的页面实例
|
|
1108
|
+
*/
|
|
1109
|
+
insertViewAt(view: View, index: number): View;
|
|
1110
|
+
|
|
1111
|
+
insertViewAt(options: string | Partial<View> | View, index: number) {
|
|
1112
|
+
const node = this._insertViewAt(options as any, index);
|
|
1113
|
+
node.create({
|
|
1114
|
+
index,
|
|
1115
|
+
parentNode: this,
|
|
1116
|
+
parentKey: 'children',
|
|
1117
|
+
});
|
|
1118
|
+
return node;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* 添加页面
|
|
1123
|
+
* @internal
|
|
1124
|
+
* @param name 页面名称,如果不填会自动生成一个唯一名称
|
|
1125
|
+
*/
|
|
1126
|
+
_addView(name?: string): View;
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* 添加页面
|
|
1130
|
+
* @internal
|
|
1131
|
+
* @param viewOptions 页面参数
|
|
1132
|
+
*/
|
|
1133
|
+
_addView(viewOptions: Partial<View>): View;
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* 添加页面
|
|
1137
|
+
* @internal
|
|
1138
|
+
* @param view 已有的页面实例
|
|
1139
|
+
*/
|
|
1140
|
+
_addView(view: View): View;
|
|
1141
|
+
|
|
1142
|
+
_addView(options?: string | Partial<View> | View) {
|
|
1143
|
+
const index = this.children.length;
|
|
1144
|
+
return this._insertViewAt(options as any, index);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* 添加页面
|
|
1149
|
+
* @internal
|
|
1150
|
+
* @param name 页面名称,如果不填会自动生成一个唯一名称
|
|
1151
|
+
*/
|
|
1152
|
+
addView(name?: string): View;
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* 添加页面
|
|
1156
|
+
* @param viewOptions 页面参数
|
|
1157
|
+
*/
|
|
1158
|
+
addView(viewOptions: Partial<View>): View;
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* 添加页面
|
|
1162
|
+
* @param view 已有的页面实例
|
|
1163
|
+
*/
|
|
1164
|
+
addView(view: View): View;
|
|
1165
|
+
|
|
1166
|
+
addView(options?: string | Partial<View> | View) {
|
|
1167
|
+
const node = this._addView(options as any);
|
|
1168
|
+
const index = this.children.indexOf(node);
|
|
1169
|
+
node.create({
|
|
1170
|
+
index,
|
|
1171
|
+
parentNode: this,
|
|
1172
|
+
parentKey: 'children',
|
|
1173
|
+
});
|
|
1174
|
+
return node;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* 删除页面元素
|
|
1179
|
+
* @param name 页面元素名称
|
|
1180
|
+
*/
|
|
1181
|
+
removeViewElement(name: string): void;
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* 删除页面元素
|
|
1185
|
+
* @param viewElement 已有的页面元素实例
|
|
1186
|
+
*/
|
|
1187
|
+
removeViewElement(viewElement: ViewElement): void;
|
|
1188
|
+
|
|
1189
|
+
removeViewElement(options: string | ViewElement) {
|
|
1190
|
+
let viewElement: ViewElement;
|
|
1191
|
+
if (typeof options === 'string') {
|
|
1192
|
+
viewElement = (this.elements as ViewElement[]).find((item) => item.name === options);
|
|
1193
|
+
if (!viewElement) {
|
|
1194
|
+
throw new Error(`找不到页面元素 ${options}`);
|
|
1195
|
+
}
|
|
1196
|
+
} else {
|
|
1197
|
+
viewElement = options;
|
|
1198
|
+
}
|
|
1199
|
+
return viewElement.delete();
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
__removeViewElement(viewElement: ViewElement) {
|
|
1203
|
+
const { parentKey } = viewElement;
|
|
1204
|
+
const params: Params = {
|
|
1205
|
+
parentNode: this,
|
|
1206
|
+
parentKey,
|
|
1207
|
+
index: -1,
|
|
1208
|
+
object: null,
|
|
1209
|
+
oldObject: viewElement,
|
|
1210
|
+
};
|
|
1211
|
+
if (parentKey) {
|
|
1212
|
+
params.parentKey = parentKey;
|
|
1213
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1214
|
+
const index = (this as any)[parentKey].indexOf(viewElement);
|
|
1215
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1216
|
+
params.index = index;
|
|
1217
|
+
} else if ((this as any)[parentKey] === viewElement) {
|
|
1218
|
+
params.index = 0;
|
|
1219
|
+
(this as any)[parentKey] = undefined;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
return params;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* 删除输入参数
|
|
1227
|
+
* @param name 输入参数名称
|
|
1228
|
+
*/
|
|
1229
|
+
removeParam(name: string): void;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* 删除输入参数
|
|
1233
|
+
* @param param 已有的输入参数实例
|
|
1234
|
+
*/
|
|
1235
|
+
removeParam(param: Param): void;
|
|
1236
|
+
|
|
1237
|
+
removeParam(options: string | Param) {
|
|
1238
|
+
let param: Param;
|
|
1239
|
+
if (typeof options === 'string') {
|
|
1240
|
+
param = (this.params as Param[]).find((item) => item.name === options);
|
|
1241
|
+
if (!param) {
|
|
1242
|
+
throw new Error(`找不到输入参数 ${options}`);
|
|
1243
|
+
}
|
|
1244
|
+
} else {
|
|
1245
|
+
param = options;
|
|
1246
|
+
}
|
|
1247
|
+
return param.delete();
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
__removeParam(param: Param) {
|
|
1251
|
+
const { parentKey } = param;
|
|
1252
|
+
const params: Params = {
|
|
1253
|
+
parentNode: this,
|
|
1254
|
+
parentKey,
|
|
1255
|
+
index: -1,
|
|
1256
|
+
object: null,
|
|
1257
|
+
oldObject: param,
|
|
1258
|
+
};
|
|
1259
|
+
if (parentKey) {
|
|
1260
|
+
params.parentKey = parentKey;
|
|
1261
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1262
|
+
const index = (this as any)[parentKey].indexOf(param);
|
|
1263
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1264
|
+
params.index = index;
|
|
1265
|
+
} else if ((this as any)[parentKey] === param) {
|
|
1266
|
+
params.index = 0;
|
|
1267
|
+
(this as any)[parentKey] = undefined;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
return params;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* 删除变量
|
|
1275
|
+
* @param name 变量名称
|
|
1276
|
+
*/
|
|
1277
|
+
removeVariable(name: string): void;
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* 删除变量
|
|
1281
|
+
* @param variable 已有的变量实例
|
|
1282
|
+
*/
|
|
1283
|
+
removeVariable(variable: Variable): void;
|
|
1284
|
+
|
|
1285
|
+
removeVariable(options: string | Variable) {
|
|
1286
|
+
let variable: Variable;
|
|
1287
|
+
if (typeof options === 'string') {
|
|
1288
|
+
variable = (this.variables as Variable[]).find((item) => item.name === options);
|
|
1289
|
+
if (!variable) {
|
|
1290
|
+
throw new Error(`找不到变量 ${options}`);
|
|
1291
|
+
}
|
|
1292
|
+
} else {
|
|
1293
|
+
variable = options;
|
|
1294
|
+
}
|
|
1295
|
+
return variable.delete();
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
__removeVariable(variable: Variable) {
|
|
1299
|
+
const { parentKey } = variable;
|
|
1300
|
+
const params: Params = {
|
|
1301
|
+
parentNode: this,
|
|
1302
|
+
parentKey,
|
|
1303
|
+
index: -1,
|
|
1304
|
+
object: null,
|
|
1305
|
+
oldObject: variable,
|
|
1306
|
+
};
|
|
1307
|
+
if (parentKey) {
|
|
1308
|
+
params.parentKey = parentKey;
|
|
1309
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1310
|
+
const index = (this as any)[parentKey].indexOf(variable);
|
|
1311
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1312
|
+
params.index = index;
|
|
1313
|
+
} else if ((this as any)[parentKey] === variable) {
|
|
1314
|
+
params.index = 0;
|
|
1315
|
+
(this as any)[parentKey] = undefined;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
return params;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* 删除逻辑
|
|
1323
|
+
* @param name 逻辑名称
|
|
1324
|
+
*/
|
|
1325
|
+
removeLogic(name: string): void;
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* 删除逻辑
|
|
1329
|
+
* @param logic 已有的逻辑实例
|
|
1330
|
+
*/
|
|
1331
|
+
removeLogic(logic: Logic): void;
|
|
1332
|
+
|
|
1333
|
+
removeLogic(options: string | Logic) {
|
|
1334
|
+
let logic: Logic;
|
|
1335
|
+
if (typeof options === 'string') {
|
|
1336
|
+
logic = (this.logics as Logic[]).find((item) => item.name === options);
|
|
1337
|
+
if (!logic) {
|
|
1338
|
+
throw new Error(`找不到逻辑 ${options}`);
|
|
1339
|
+
}
|
|
1340
|
+
} else {
|
|
1341
|
+
logic = options;
|
|
1342
|
+
}
|
|
1343
|
+
return logic.delete();
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
__removeLogic(logic: Logic) {
|
|
1347
|
+
const { parentKey } = logic;
|
|
1348
|
+
const params: Params = {
|
|
1349
|
+
parentNode: this,
|
|
1350
|
+
parentKey,
|
|
1351
|
+
index: -1,
|
|
1352
|
+
object: null,
|
|
1353
|
+
oldObject: logic,
|
|
1354
|
+
};
|
|
1355
|
+
if (parentKey) {
|
|
1356
|
+
params.parentKey = parentKey;
|
|
1357
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1358
|
+
const index = (this as any)[parentKey].indexOf(logic);
|
|
1359
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1360
|
+
params.index = index;
|
|
1361
|
+
} else if ((this as any)[parentKey] === logic) {
|
|
1362
|
+
params.index = 0;
|
|
1363
|
+
(this as any)[parentKey] = undefined;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return params;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* 删除元素绑定事件
|
|
1371
|
+
* @param name 元素绑定事件名称
|
|
1372
|
+
*/
|
|
1373
|
+
removeBindEvent(name: string): void;
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* 删除元素绑定事件
|
|
1377
|
+
* @param bindEvent 已有的元素绑定事件实例
|
|
1378
|
+
*/
|
|
1379
|
+
removeBindEvent(bindEvent: BindEvent): void;
|
|
1380
|
+
|
|
1381
|
+
removeBindEvent(options: string | BindEvent) {
|
|
1382
|
+
let bindEvent: BindEvent;
|
|
1383
|
+
if (typeof options === 'string') {
|
|
1384
|
+
bindEvent = (this.bindEvents as BindEvent[]).find((item) => item.name === options);
|
|
1385
|
+
if (!bindEvent) {
|
|
1386
|
+
throw new Error(`找不到元素绑定事件 ${options}`);
|
|
1387
|
+
}
|
|
1388
|
+
} else {
|
|
1389
|
+
bindEvent = options;
|
|
1390
|
+
}
|
|
1391
|
+
return bindEvent.delete();
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
__removeBindEvent(bindEvent: BindEvent) {
|
|
1395
|
+
const { parentKey } = bindEvent;
|
|
1396
|
+
const params: Params = {
|
|
1397
|
+
parentNode: this,
|
|
1398
|
+
parentKey,
|
|
1399
|
+
index: -1,
|
|
1400
|
+
object: null,
|
|
1401
|
+
oldObject: bindEvent,
|
|
1402
|
+
};
|
|
1403
|
+
if (parentKey) {
|
|
1404
|
+
params.parentKey = parentKey;
|
|
1405
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1406
|
+
const index = (this as any)[parentKey].indexOf(bindEvent);
|
|
1407
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1408
|
+
params.index = index;
|
|
1409
|
+
} else if ((this as any)[parentKey] === bindEvent) {
|
|
1410
|
+
params.index = 0;
|
|
1411
|
+
(this as any)[parentKey] = undefined;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return params;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* 删除页面
|
|
1419
|
+
* @param name 页面名称
|
|
1420
|
+
*/
|
|
1421
|
+
removeView(name: string): void;
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* 删除页面
|
|
1425
|
+
* @param view 已有的页面实例
|
|
1426
|
+
*/
|
|
1427
|
+
removeView(view: View): void;
|
|
1428
|
+
|
|
1429
|
+
removeView(options: string | View) {
|
|
1430
|
+
let view: View;
|
|
1431
|
+
if (typeof options === 'string') {
|
|
1432
|
+
view = (this.children as View[]).find((item) => item.name === options);
|
|
1433
|
+
if (!view) {
|
|
1434
|
+
throw new Error(`找不到页面 ${options}`);
|
|
1435
|
+
}
|
|
1436
|
+
} else {
|
|
1437
|
+
view = options;
|
|
1438
|
+
}
|
|
1439
|
+
return view.delete();
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
__removeView(view: View) {
|
|
1443
|
+
const { parentKey } = view;
|
|
1444
|
+
const params: Params = {
|
|
1445
|
+
parentNode: this,
|
|
1446
|
+
parentKey,
|
|
1447
|
+
index: -1,
|
|
1448
|
+
object: null,
|
|
1449
|
+
oldObject: view,
|
|
1450
|
+
};
|
|
1451
|
+
if (parentKey) {
|
|
1452
|
+
params.parentKey = parentKey;
|
|
1453
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1454
|
+
const index = (this as any)[parentKey].indexOf(view);
|
|
1455
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1456
|
+
params.index = index;
|
|
1457
|
+
} else if ((this as any)[parentKey] === view) {
|
|
1458
|
+
params.index = 0;
|
|
1459
|
+
(this as any)[parentKey] = undefined;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
return params;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
//= ===============================================================================
|
|
1466
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1467
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
1468
|
+
//= ===============================================================================
|
|
1469
|
+
|
|
1470
|
+
/* 主页面有没有权限 */
|
|
1471
|
+
get parentAuth() {
|
|
1472
|
+
const _nameSpace = this.getTsNamespace();
|
|
1473
|
+
const _nameSpaceArr = _nameSpace.split('.');
|
|
1474
|
+
const viewsIndex = _nameSpaceArr.findIndex((item) => item === 'views');
|
|
1475
|
+
const mainViewName = _nameSpaceArr[viewsIndex + 1];
|
|
1476
|
+
return mainViewName ? this.frontend.views.find((item) => item.name === mainViewName)?.auth : this.auth;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* 设置页面权限
|
|
1481
|
+
*/
|
|
1482
|
+
setBindRoles(bindRoles: string[]) {
|
|
1483
|
+
const object = {
|
|
1484
|
+
bindRoles,
|
|
1485
|
+
};
|
|
1486
|
+
this.update({
|
|
1487
|
+
...object,
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
findLogicByName(name: string) {
|
|
1492
|
+
return this.logics.find((logic) => logic.name === name);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
existingViewElement: Set<string> = new Set<string>();
|
|
1496
|
+
|
|
1497
|
+
// 收集已经存在的ViewElement
|
|
1498
|
+
collectExistingViewElementName(excludedList: Array<ViewElement> = []) {
|
|
1499
|
+
const excludedSet = new Set(excludedList);
|
|
1500
|
+
this.elements.forEach((element) => {
|
|
1501
|
+
utils.traverse(
|
|
1502
|
+
({ node }) => {
|
|
1503
|
+
if (!excludedSet.has(node)) {
|
|
1504
|
+
this.existingViewElement.add(node.name);
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
node: element,
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
// 获取当前页面的所有组件的名字
|
|
1515
|
+
getViewElementExistingNames(excludedList: Array<ViewElement> = []) {
|
|
1516
|
+
if (!this.existingViewElement.size) {
|
|
1517
|
+
this.collectExistingViewElementName();
|
|
1518
|
+
}
|
|
1519
|
+
return Array.from(this.existingViewElement);
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
getViewElementUniqueName(name = 'viewElement1') {
|
|
1523
|
+
this.collectExistingViewElementName();
|
|
1524
|
+
const viewElementUniqueName = utils.unique(name, this.existingViewElement);
|
|
1525
|
+
this.existingViewElement.add(viewElementUniqueName);
|
|
1526
|
+
return viewElementUniqueName;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// 组件名是否有效
|
|
1530
|
+
isValidElementName(name: string): boolean {
|
|
1531
|
+
if (name) {
|
|
1532
|
+
return !this.getViewElementExistingNames().find((existingName) => existingName === name);
|
|
1533
|
+
}
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
public static readonly TAG_NAME_PREFIX_REG?: RegExp = /^([lieu]|van)[-_]/;
|
|
1538
|
+
|
|
1539
|
+
mergeBlock({ code, nodePath, position, cb }: { code: string; nodePath: string; position: string; cb?: Function }) {
|
|
1540
|
+
const template = utils.sliceTagContent(code, 'template');
|
|
1541
|
+
let targetNode = this.app.findNodeByPath(nodePath);
|
|
1542
|
+
let parentNode = position === 'append' ? targetNode : targetNode.parentNode;
|
|
1543
|
+
if (parentNode.concept === 'View') {
|
|
1544
|
+
parentNode = targetNode;
|
|
1545
|
+
if (position === 'insertBefore') {
|
|
1546
|
+
targetNode = parentNode.children[0];
|
|
1547
|
+
} else if (position === 'insertAfter') {
|
|
1548
|
+
const len = parentNode.children.length;
|
|
1549
|
+
targetNode = parentNode.children[len - 1];
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
const definitionStr = utils.sliceTagContent(code, 'definition') || '{}';
|
|
1553
|
+
const definition: any = JSON.parse(definitionStr);
|
|
1554
|
+
let node = null;
|
|
1555
|
+
if (template) {
|
|
1556
|
+
node = ViewElement.fromHTML(template, {
|
|
1557
|
+
view: this,
|
|
1558
|
+
definition,
|
|
1559
|
+
});
|
|
1560
|
+
if (!parentNode) {
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
if (position === 'append') {
|
|
1564
|
+
parentNode.addViewElement(node);
|
|
1565
|
+
cb && cb(parentNode, node);
|
|
1566
|
+
} else {
|
|
1567
|
+
const index = targetNode.getIndexOfParent();
|
|
1568
|
+
if (position === 'insertBefore') {
|
|
1569
|
+
parentNode.insertViewElementAt(node, index);
|
|
1570
|
+
} else if (position === 'insertAfter') {
|
|
1571
|
+
parentNode.insertViewElementAt(node, index + 1);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
// 服务端逻辑
|
|
1577
|
+
if (Array.isArray(definition.logics)) {
|
|
1578
|
+
definition.logics.forEach((logicOption: any) => {
|
|
1579
|
+
const logic = Logic.from(
|
|
1580
|
+
{
|
|
1581
|
+
...logicOption,
|
|
1582
|
+
},
|
|
1583
|
+
this.rootNode,
|
|
1584
|
+
'logics'
|
|
1585
|
+
);
|
|
1586
|
+
(this.rootNode as App).addLogic(logic);
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// 全局结构体
|
|
1591
|
+
if (Array.isArray(definition.structures)) {
|
|
1592
|
+
definition.structures.forEach((structureOption: any) => {
|
|
1593
|
+
const structure = Structure.from(
|
|
1594
|
+
{
|
|
1595
|
+
...structureOption,
|
|
1596
|
+
},
|
|
1597
|
+
this.rootNode,
|
|
1598
|
+
'structures'
|
|
1599
|
+
);
|
|
1600
|
+
(this.rootNode as App).addStructure(structure);
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
// 页面入参
|
|
1605
|
+
if (Array.isArray(definition.viewParams)) {
|
|
1606
|
+
definition.viewParams.forEach((paramsOption: any) => {
|
|
1607
|
+
const param = Param.from(
|
|
1608
|
+
{
|
|
1609
|
+
...paramsOption,
|
|
1610
|
+
},
|
|
1611
|
+
this,
|
|
1612
|
+
'params'
|
|
1613
|
+
);
|
|
1614
|
+
this._addParam(param);
|
|
1615
|
+
param.addParamsPrepare();
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
// 页面变量
|
|
1619
|
+
if (Array.isArray(definition.viewVariables)) {
|
|
1620
|
+
definition.viewVariables.forEach((variableOption: any) => {
|
|
1621
|
+
const variable = Variable.from(
|
|
1622
|
+
{
|
|
1623
|
+
...variableOption,
|
|
1624
|
+
},
|
|
1625
|
+
this,
|
|
1626
|
+
'variables'
|
|
1627
|
+
);
|
|
1628
|
+
this.addVariable(variable);
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
// 页面逻辑
|
|
1633
|
+
if (Array.isArray(definition.viewLogics)) {
|
|
1634
|
+
definition.viewLogics.forEach((logicOption: any) => {
|
|
1635
|
+
// 页面逻辑只有load函数的走之前的逻辑其余不用创建
|
|
1636
|
+
if (logicOption.name.startsWith('load')) {
|
|
1637
|
+
const logic = Logic.from(
|
|
1638
|
+
{
|
|
1639
|
+
...logicOption,
|
|
1640
|
+
},
|
|
1641
|
+
this,
|
|
1642
|
+
'logics'
|
|
1643
|
+
);
|
|
1644
|
+
this.addLogic(logic);
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
// 页面事件
|
|
1649
|
+
if (Array.isArray(definition.viewBindEvents)) {
|
|
1650
|
+
definition.viewBindEvents.forEach((eventOption: any) => {
|
|
1651
|
+
const newLogic = definition.viewLogics.find((logic: Logic) => eventOption.calleeName === logic.name);
|
|
1652
|
+
const bindEvent = this.bindEvents.find((currentEventItem) => currentEventItem.name === eventOption.name);
|
|
1653
|
+
|
|
1654
|
+
// 如果没有event对象就先新增一个,如果已经有了就在内部添加logic
|
|
1655
|
+
if (!bindEvent) {
|
|
1656
|
+
const event = BindEvent.from(
|
|
1657
|
+
{
|
|
1658
|
+
...eventOption,
|
|
1659
|
+
calleeName: '',
|
|
1660
|
+
logics: [newLogic],
|
|
1661
|
+
},
|
|
1662
|
+
this,
|
|
1663
|
+
'events'
|
|
1664
|
+
);
|
|
1665
|
+
this.addBindEvent(event);
|
|
1380
1666
|
} else {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
const viewElementUniqueName = utils.unique(name, this.existingViewElement);
|
|
1464
|
-
this.existingViewElement.add(viewElementUniqueName);
|
|
1465
|
-
return viewElementUniqueName;
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
// 组件名是否有效
|
|
1469
|
-
isValidElementName(name: string): boolean {
|
|
1470
|
-
if (name) {
|
|
1471
|
-
return !this.getViewElementExistingNames().find((existingName) => existingName === name);
|
|
1472
|
-
}
|
|
1473
|
-
return false;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
public static readonly TAG_NAME_PREFIX_REG?: RegExp = /^([lieu]|van)[-_]/;
|
|
1477
|
-
|
|
1478
|
-
mergeBlock({ code, nodePath, position, cb }: { code: string; nodePath: string; position: string; cb?: Function }) {
|
|
1479
|
-
const template = utils.sliceTagContent(code, 'template');
|
|
1480
|
-
let targetNode = this.app.findNodeByPath(nodePath);
|
|
1481
|
-
let parentNode = position === 'append' ? targetNode : targetNode.parentNode;
|
|
1482
|
-
if (parentNode.concept === 'View') {
|
|
1483
|
-
parentNode = targetNode;
|
|
1484
|
-
if (position === 'insertBefore') {
|
|
1485
|
-
targetNode = parentNode.children[0];
|
|
1486
|
-
} else if (position === 'insertAfter') {
|
|
1487
|
-
const len = parentNode.children.length;
|
|
1488
|
-
targetNode = parentNode.children[len - 1];
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
const definitionStr = utils.sliceTagContent(code, 'definition') || '{}';
|
|
1492
|
-
const definition: any = JSON.parse(definitionStr);
|
|
1493
|
-
let node = null;
|
|
1494
|
-
if (template) {
|
|
1495
|
-
node = ViewElement.fromHTML(template, {
|
|
1496
|
-
view: this,
|
|
1497
|
-
definition,
|
|
1498
|
-
});
|
|
1499
|
-
if (!parentNode) {
|
|
1500
|
-
return;
|
|
1501
|
-
}
|
|
1502
|
-
if (position === 'append') {
|
|
1503
|
-
parentNode.addViewElement(node);
|
|
1504
|
-
cb && cb(parentNode, node);
|
|
1505
|
-
} else {
|
|
1506
|
-
const index = targetNode.getIndexOfParent();
|
|
1507
|
-
if (position === 'insertBefore') {
|
|
1508
|
-
parentNode.insertViewElementAt(node, index);
|
|
1509
|
-
} else if (position === 'insertAfter') {
|
|
1510
|
-
parentNode.insertViewElementAt(node, index + 1);
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
// 服务端逻辑
|
|
1516
|
-
if (Array.isArray(definition.logics)) {
|
|
1517
|
-
definition.logics.forEach((logicOption: any) => {
|
|
1518
|
-
const logic = Logic.from({
|
|
1519
|
-
...logicOption,
|
|
1520
|
-
}, this.rootNode, 'logics');
|
|
1521
|
-
(this.rootNode as App).addLogic(logic);
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
// 全局结构体
|
|
1526
|
-
if (Array.isArray(definition.structures)) {
|
|
1527
|
-
definition.structures.forEach((structureOption: any) => {
|
|
1528
|
-
const structure = Structure.from({
|
|
1529
|
-
...structureOption,
|
|
1530
|
-
}, this.rootNode, 'structures');
|
|
1531
|
-
(this.rootNode as App).addStructure(structure);
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
// 页面入参
|
|
1536
|
-
if (Array.isArray(definition.viewParams)) {
|
|
1537
|
-
definition.viewParams.forEach((paramsOption: any) => {
|
|
1538
|
-
const param = Param.from({
|
|
1539
|
-
...paramsOption,
|
|
1540
|
-
}, this, 'params');
|
|
1541
|
-
this._addParam(param);
|
|
1542
|
-
param.addParamsPrepare();
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
// 页面变量
|
|
1546
|
-
if (Array.isArray(definition.viewVariables)) {
|
|
1547
|
-
definition.viewVariables.forEach((variableOption: any) => {
|
|
1548
|
-
const variable = Variable.from({
|
|
1549
|
-
...variableOption,
|
|
1550
|
-
}, this, 'variables');
|
|
1551
|
-
this.addVariable(variable);
|
|
1552
|
-
});
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
// 页面逻辑
|
|
1556
|
-
if (Array.isArray(definition.viewLogics)) {
|
|
1557
|
-
definition.viewLogics.forEach((logicOption: any) => {
|
|
1558
|
-
// 页面逻辑只有load函数的走之前的逻辑其余不用创建
|
|
1559
|
-
if (logicOption.name.startsWith('load')) {
|
|
1560
|
-
const logic = Logic.from({
|
|
1561
|
-
...logicOption,
|
|
1562
|
-
}, this, 'logics');
|
|
1563
|
-
this.addLogic(logic);
|
|
1564
|
-
}
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
// 页面事件
|
|
1568
|
-
if (Array.isArray(definition.viewBindEvents)) {
|
|
1569
|
-
definition.viewBindEvents.forEach((eventOption: any) => {
|
|
1570
|
-
const newLogic = definition.viewLogics.find((logic: Logic) => eventOption.calleeName === logic.name);
|
|
1571
|
-
const bindEvent = this.bindEvents.find((currentEventItem) => currentEventItem.name === eventOption.name);
|
|
1572
|
-
|
|
1573
|
-
// 如果没有event对象就先新增一个,如果已经有了就在内部添加logic
|
|
1574
|
-
if (!bindEvent) {
|
|
1575
|
-
const event = BindEvent.from({
|
|
1576
|
-
...eventOption,
|
|
1577
|
-
calleeName: '',
|
|
1578
|
-
logics: [newLogic],
|
|
1579
|
-
}, this, 'events');
|
|
1580
|
-
this.addBindEvent(event);
|
|
1581
|
-
} else {
|
|
1582
|
-
const index = bindEvent.logics.length;
|
|
1583
|
-
newLogic.name = newLogic.name + index;
|
|
1584
|
-
bindEvent.addLogic(newLogic);
|
|
1585
|
-
}
|
|
1586
|
-
});
|
|
1587
|
-
}
|
|
1588
|
-
return node;
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
onChange($event?: EventPayload): void {
|
|
1592
|
-
this.emit('change', $event);
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
1596
|
-
const excludedSet = new Set(excludedList);
|
|
1597
|
-
const varList: any[] = [];
|
|
1598
|
-
if (Array.isArray(this.params)) {
|
|
1599
|
-
varList.push(...this.params);
|
|
1600
|
-
}
|
|
1601
|
-
if (Array.isArray(this.variables)) {
|
|
1602
|
-
varList.push(...this.variables);
|
|
1603
|
-
}
|
|
1604
|
-
if (Array.isArray(this.logics)) {
|
|
1605
|
-
varList.push(...this.logics);
|
|
1606
|
-
}
|
|
1607
|
-
return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
getVarExistingNames(excludedList: Array<Param | Variable> = []) {
|
|
1611
|
-
const excludedSet = new Set(excludedList);
|
|
1612
|
-
const varList: any[] = [];
|
|
1613
|
-
if (Array.isArray(this.params)) {
|
|
1614
|
-
varList.push(...this.params);
|
|
1615
|
-
}
|
|
1616
|
-
if (Array.isArray(this.variables)) {
|
|
1617
|
-
varList.push(...this.variables);
|
|
1618
|
-
}
|
|
1619
|
-
if (Array.isArray(this.logics)) {
|
|
1620
|
-
this.logics.forEach((logic) => {
|
|
1621
|
-
varList.push(logic);
|
|
1622
|
-
if (Array.isArray(logic.params)) {
|
|
1623
|
-
varList.push(...logic.params);
|
|
1624
|
-
}
|
|
1625
|
-
if (Array.isArray(logic.returns)) {
|
|
1626
|
-
varList.push(...logic.returns);
|
|
1627
|
-
}
|
|
1628
|
-
if (Array.isArray(logic.variables)) {
|
|
1629
|
-
varList.push(...logic.variables);
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
// 事件逻辑的变量不允许和页面逻辑下的重复
|
|
1634
|
-
if (Array.isArray(this.elementLogicRoot) && this.elementLogicRoot.length) {
|
|
1635
|
-
this.elementLogicRoot[0]?.children.forEach((logic: Logic) => {
|
|
1636
|
-
if (Array.isArray(logic.variables)) {
|
|
1637
|
-
varList.push(...logic.variables);
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
}
|
|
1641
|
-
return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
/**
|
|
1645
|
-
* 生成 Vue 中需要的 JS 代码
|
|
1646
|
-
* @TODO 这一版先做成 componentOptions 式的,后面再美化
|
|
1647
|
-
*/
|
|
1648
|
-
genScript() {
|
|
1649
|
-
const definition = {
|
|
1650
|
-
params: this.params,
|
|
1651
|
-
variables: this.variables,
|
|
1652
|
-
logics: this.logics,
|
|
1653
|
-
events: this.bindEvents,
|
|
1654
|
-
title: this.title,
|
|
1655
|
-
crumb: this.crumb,
|
|
1656
|
-
first: this.children.find((child) => child.isIndex)?.name,
|
|
1657
|
-
auth: this.auth ? 'loginAuth' : undefined,
|
|
1658
|
-
viewBindEvents: this.getViewBindEvents(),
|
|
1659
|
-
viewExpressions: this.getViewExpressions(),
|
|
1660
|
-
};
|
|
1661
|
-
let code = '';
|
|
1662
|
-
let mixin = '';
|
|
1663
|
-
const keyboardEventMixinCode = `const keyboardEventMixin = {
|
|
1667
|
+
const index = bindEvent.logics.length;
|
|
1668
|
+
newLogic.name += index;
|
|
1669
|
+
bindEvent.addLogic(newLogic);
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
return node;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
onChange($event?: EventPayload): void {
|
|
1677
|
+
this.emit('change', $event);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
1681
|
+
const excludedSet = new Set(excludedList);
|
|
1682
|
+
const varList: any[] = [];
|
|
1683
|
+
if (Array.isArray(this.params)) {
|
|
1684
|
+
varList.push(...this.params);
|
|
1685
|
+
}
|
|
1686
|
+
if (Array.isArray(this.variables)) {
|
|
1687
|
+
varList.push(...this.variables);
|
|
1688
|
+
}
|
|
1689
|
+
if (Array.isArray(this.logics)) {
|
|
1690
|
+
varList.push(...this.logics);
|
|
1691
|
+
}
|
|
1692
|
+
return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
getVarExistingNames(excludedList: Array<Param | Variable> = []) {
|
|
1696
|
+
const excludedSet = new Set(excludedList);
|
|
1697
|
+
const varList: any[] = [];
|
|
1698
|
+
if (Array.isArray(this.params)) {
|
|
1699
|
+
varList.push(...this.params);
|
|
1700
|
+
}
|
|
1701
|
+
if (Array.isArray(this.variables)) {
|
|
1702
|
+
varList.push(...this.variables);
|
|
1703
|
+
}
|
|
1704
|
+
if (Array.isArray(this.logics)) {
|
|
1705
|
+
this.logics.forEach((logic) => {
|
|
1706
|
+
varList.push(logic);
|
|
1707
|
+
if (Array.isArray(logic.params)) {
|
|
1708
|
+
varList.push(...logic.params);
|
|
1709
|
+
}
|
|
1710
|
+
if (Array.isArray(logic.returns)) {
|
|
1711
|
+
varList.push(...logic.returns);
|
|
1712
|
+
}
|
|
1713
|
+
if (Array.isArray(logic.variables)) {
|
|
1714
|
+
varList.push(...logic.variables);
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
// 事件逻辑的变量不允许和页面逻辑下的重复
|
|
1719
|
+
if (Array.isArray(this.elementLogicRoot) && this.elementLogicRoot.length) {
|
|
1720
|
+
this.elementLogicRoot[0]?.children.forEach((logic: Logic) => {
|
|
1721
|
+
if (Array.isArray(logic.variables)) {
|
|
1722
|
+
varList.push(...logic.variables);
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* 生成 Vue 中需要的 JS 代码
|
|
1731
|
+
* @TODO 这一版先做成 componentOptions 式的,后面再美化
|
|
1732
|
+
*/
|
|
1733
|
+
genScript() {
|
|
1734
|
+
const definition = {
|
|
1735
|
+
params: this.params,
|
|
1736
|
+
variables: this.variables,
|
|
1737
|
+
logics: this.logics,
|
|
1738
|
+
events: this.bindEvents,
|
|
1739
|
+
title: this.title,
|
|
1740
|
+
crumb: this.crumb,
|
|
1741
|
+
first: this.children.find((child) => child.isIndex)?.name,
|
|
1742
|
+
auth: this.auth ? 'loginAuth' : undefined,
|
|
1743
|
+
viewBindEvents: this.getViewBindEvents(),
|
|
1744
|
+
viewExpressions: this.getViewExpressions(),
|
|
1745
|
+
};
|
|
1746
|
+
let code = '';
|
|
1747
|
+
let mixin = '';
|
|
1748
|
+
const keyboardEventMixinCode = `const keyboardEventMixin = {
|
|
1664
1749
|
mounted() {
|
|
1665
1750
|
document.addEventListener('keydown', this.onKeyDown);
|
|
1666
1751
|
document.addEventListener('keyup', this.onKeyUp);
|
|
@@ -1671,661 +1756,755 @@ export class View extends BaseNode {
|
|
|
1671
1756
|
},
|
|
1672
1757
|
methods: {
|
|
1673
1758
|
async onKeyDown(e) {
|
|
1674
|
-
${this.bindEvents
|
|
1759
|
+
${this.bindEvents
|
|
1760
|
+
.filter((event) => ['keydown'].includes(event.name))
|
|
1761
|
+
.map((event) => `await this.${event.view.name}_${event.name}(e);`)
|
|
1762
|
+
.join('\n')}
|
|
1675
1763
|
},
|
|
1676
1764
|
async onKeyUp(e) {
|
|
1677
|
-
${this.bindEvents
|
|
1765
|
+
${this.bindEvents
|
|
1766
|
+
.filter((event) => ['keyup'].includes(event.name))
|
|
1767
|
+
.map((event) => `await this.${event.view.name}_${event.name}(e);`)
|
|
1768
|
+
.join('\n')}
|
|
1678
1769
|
}
|
|
1679
1770
|
}
|
|
1680
1771
|
};`;
|
|
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
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
});
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
@withSourceMap()
|
|
1801
|
-
toEmbeddedTS(state?: TranslatorState): string {
|
|
1802
|
-
function chineseTsName(name: string) {
|
|
1803
|
-
let tsName = name;
|
|
1804
|
-
// 匹配所有特殊字符都转为_
|
|
1805
|
-
tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
|
|
1806
|
-
return tsName;
|
|
1807
|
-
}
|
|
1808
|
-
// 获取虚拟logic的参数和内容
|
|
1809
|
-
// 用作展示和tots查找引用
|
|
1810
|
-
this.getElementLogicRoot();
|
|
1811
|
-
|
|
1812
|
-
let code = `export namespace ${this.tsName} {\n`;
|
|
1813
|
-
// 角色
|
|
1814
|
-
if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
|
|
1815
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1816
|
-
code += 'export let __bindRoles = [\n';
|
|
1817
|
-
this.bindRoles.forEach((role) => {
|
|
1818
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1819
|
-
code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
|
|
1820
|
-
code += '\n';
|
|
1821
|
-
});
|
|
1822
|
-
code += '\n';
|
|
1823
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1824
|
-
code += '];\n';
|
|
1825
|
-
}
|
|
1826
|
-
// 需要类型推导的局部变量/返回值需要调整申明顺序
|
|
1827
|
-
const advanceMap: Map<Variable, Assignment | BatchAssignment> = new Map();
|
|
1828
|
-
this.traverseChildren((el) => {
|
|
1829
|
-
if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
|
|
1830
|
-
// 子页面内部逻辑过滤
|
|
1831
|
-
if (el.view !== this)
|
|
1832
|
-
return;
|
|
1833
|
-
if (el instanceof Assignment) {
|
|
1834
|
-
const advanceVar = this.variables?.find((variable) =>
|
|
1835
|
-
!variable.typeAnnotation && el.left?.name === variable.name);
|
|
1836
|
-
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1837
|
-
advanceMap.set(advanceVar, el);
|
|
1838
|
-
}
|
|
1839
|
-
} else if (el instanceof BatchAssignment) {
|
|
1840
|
-
el.assignmentLines.forEach(({ leftIndex }) => {
|
|
1841
|
-
const leftCode
|
|
1842
|
-
= leftIndex.length === 1 ? el.left?.expression?.toEmbeddedTS(shiftState(state, code, { inline: true })) : el.left?.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1843
|
-
const advanceVar = this.variables?.find((variable) =>
|
|
1844
|
-
!variable.typeAnnotation && leftCode === variable.name);
|
|
1845
|
-
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1846
|
-
advanceMap.set(advanceVar, el);
|
|
1847
|
-
}
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1772
|
+
code += keyboardEventMixinCode;
|
|
1773
|
+
if (this.script) {
|
|
1774
|
+
mixin = this.script.trim().replace(/export default |module\.exports +=/, 'const mixin = ');
|
|
1775
|
+
}
|
|
1776
|
+
if (mixin) {
|
|
1777
|
+
code += mixin;
|
|
1778
|
+
}
|
|
1779
|
+
code += 'export default {\n';
|
|
1780
|
+
code += 'mixins: [';
|
|
1781
|
+
const mixins = [];
|
|
1782
|
+
// mixin
|
|
1783
|
+
if (mixin) {
|
|
1784
|
+
mixins.push('mixin');
|
|
1785
|
+
}
|
|
1786
|
+
// 键盘事件mixin
|
|
1787
|
+
mixins.push('keyboardEventMixin');
|
|
1788
|
+
code += mixins.join(',');
|
|
1789
|
+
code += '],';
|
|
1790
|
+
|
|
1791
|
+
code += translator(definition);
|
|
1792
|
+
code += '};\n';
|
|
1793
|
+
return code;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
genVueTemplate(options?: ElementToVueOptions) {
|
|
1797
|
+
return this.elements?.map((element) => `${element?.toVue(options)}\n`).join('');
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* 转换成 Vue 文件
|
|
1802
|
+
*/
|
|
1803
|
+
toVue(options?: ElementToVueOptions) {
|
|
1804
|
+
let result = '';
|
|
1805
|
+
result += `<template>\n${this.genVueTemplate(options)}\n</template>\n`;
|
|
1806
|
+
result += `<script>\n${this.genScript()}\n</script>\n`;
|
|
1807
|
+
return result;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* 转换成设计器中使用的 Vue template 内容
|
|
1812
|
+
* @param options
|
|
1813
|
+
*/
|
|
1814
|
+
genDesignerVueTemplate() {
|
|
1815
|
+
return this.elements.map((element) => `${element.toDesignerVue()}\n`).join('');
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
/**
|
|
1819
|
+
* 转换成设计器中使用的 Vue 文件
|
|
1820
|
+
* 目前不需要 script 和 style
|
|
1821
|
+
* @param options
|
|
1822
|
+
*/
|
|
1823
|
+
toDesignerVue() {
|
|
1824
|
+
return `<template>\n${this.genDesignerVueTemplate()}</template>`;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* 转换成 VueOptions
|
|
1829
|
+
* @TODO 后面 template 可以优化成 render 函数
|
|
1830
|
+
*/
|
|
1831
|
+
toVueOptions(options?: ElementToVueOptions) {
|
|
1832
|
+
return {
|
|
1833
|
+
template: this.genVueTemplate(options),
|
|
1834
|
+
script: this.genScript(),
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* 生成宿主语言的文件路径
|
|
1840
|
+
* @param name 一般不用传,用于 rename
|
|
1841
|
+
*/
|
|
1842
|
+
getEmbeddedFilePath(name = this.name) {
|
|
1843
|
+
let pathName = name;
|
|
1844
|
+
let parent = this.parentNode;
|
|
1845
|
+
if (parent) {
|
|
1846
|
+
while (parent && parent instanceof View) {
|
|
1847
|
+
pathName = `${parent.name}/${pathName}`;
|
|
1848
|
+
parent = parent.parentNode;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
return `/embedded/${this.app.name}/frontends/${this.frontend.name}/views/${pathName}.ts`;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
getNamespace(): string {
|
|
1855
|
+
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
1856
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
1857
|
+
const parentName = this.parentNode.name;
|
|
1858
|
+
const arr = [parentNamespace];
|
|
1859
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1860
|
+
arr.push(parentName);
|
|
1861
|
+
}
|
|
1862
|
+
return `${arr.join('.')}.views`;
|
|
1863
|
+
}
|
|
1864
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
getTsNamespace() {
|
|
1868
|
+
const parentNodeNamespace = this.getNamespace();
|
|
1869
|
+
let tsCalleeNamespace = parentNodeNamespace.replace(/\.[0-9]/g, (m) => m.replace('.', '.$'));
|
|
1870
|
+
tsCalleeNamespace = tsCalleeNamespace.replace(/-/g, '_');
|
|
1871
|
+
return tsCalleeNamespace;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// 获取当前element,铺平
|
|
1875
|
+
elementsMethods(elements: Array<ViewElement>, allMethods: Array<ViewElement>, parentNodeNames: Array<string>) {
|
|
1876
|
+
if (elements) {
|
|
1877
|
+
elements.forEach((item: ViewElement) => {
|
|
1878
|
+
const { bindAttrs = [], name } = item;
|
|
1879
|
+
const isDataSource = bindAttrs.some((attr) => attr.name === 'data-source');
|
|
1880
|
+
const isInclude = parentNodeNames.includes(name);
|
|
1881
|
+
|
|
1882
|
+
allMethods.push(item);
|
|
1883
|
+
if (item.children) {
|
|
1884
|
+
if (isDataSource) {
|
|
1885
|
+
if (isInclude) {
|
|
1886
|
+
this.elementsMethods(item.children, allMethods, parentNodeNames);
|
|
1850
1887
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1888
|
+
} else {
|
|
1889
|
+
this.elementsMethods(item.children, allMethods, parentNodeNames);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
@withSourceMap()
|
|
1897
|
+
toEmbeddedTS(state?: TranslatorState): string {
|
|
1898
|
+
function chineseTsName(name: string) {
|
|
1899
|
+
let tsName = name;
|
|
1900
|
+
// 匹配所有特殊字符都转为_
|
|
1901
|
+
tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
|
|
1902
|
+
return tsName;
|
|
1903
|
+
}
|
|
1904
|
+
// 获取虚拟logic的参数和内容
|
|
1905
|
+
// 用作展示和tots查找引用
|
|
1906
|
+
this.getElementLogicRoot();
|
|
1907
|
+
|
|
1908
|
+
let code = `export namespace ${this.tsName} {\n`;
|
|
1909
|
+
// 角色
|
|
1910
|
+
if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
|
|
1911
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1912
|
+
code += 'export let __bindRoles = [\n';
|
|
1913
|
+
this.bindRoles.forEach((role) => {
|
|
1914
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1915
|
+
code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
|
|
1916
|
+
code += '\n';
|
|
1917
|
+
});
|
|
1918
|
+
code += '\n';
|
|
1919
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1920
|
+
code += '];\n';
|
|
1921
|
+
}
|
|
1922
|
+
// 需要类型推导的局部变量/返回值需要调整申明顺序
|
|
1923
|
+
const advanceMap: Map<Variable, Assignment | BatchAssignment> = new Map();
|
|
1924
|
+
this.traverseChildren((el) => {
|
|
1925
|
+
if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
|
|
1926
|
+
// 子页面内部逻辑过滤
|
|
1927
|
+
if (el.view !== this) return;
|
|
1928
|
+
if (el instanceof Assignment) {
|
|
1929
|
+
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && el.left?.name === variable.name);
|
|
1930
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1931
|
+
advanceMap.set(advanceVar, el);
|
|
1932
|
+
}
|
|
1933
|
+
} else if (el instanceof BatchAssignment) {
|
|
1934
|
+
el.assignmentLines.forEach(({ leftIndex }) => {
|
|
1935
|
+
const leftCode =
|
|
1936
|
+
leftIndex.length === 1
|
|
1937
|
+
? el.left?.expression?.toEmbeddedTS(shiftState(state, code, { inline: true }))
|
|
1938
|
+
: el.left?.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1939
|
+
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && leftCode === variable.name);
|
|
1940
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1941
|
+
advanceMap.set(advanceVar, el);
|
|
1890
1942
|
}
|
|
1891
|
-
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
});
|
|
1947
|
+
if (Array.isArray(this.params)) {
|
|
1948
|
+
this.params.forEach((param) => {
|
|
1949
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1950
|
+
code += param.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1951
|
+
code += ';\n';
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
if (Array.isArray(this.variables)) {
|
|
1955
|
+
this.variables.forEach((variable) => {
|
|
1956
|
+
if (!advanceMap.get(variable)) {
|
|
1957
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1958
|
+
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1959
|
+
code += ';\n';
|
|
1960
|
+
}
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
advanceMap.forEach((assignment, variable) => {
|
|
1964
|
+
code += `${indent((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
|
|
1965
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1966
|
+
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1967
|
+
code += ' = ';
|
|
1968
|
+
if (assignment instanceof BatchAssignment) {
|
|
1969
|
+
assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
|
|
1970
|
+
const leftCode =
|
|
1971
|
+
leftIndex.length === 1
|
|
1972
|
+
? assignment.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true }))
|
|
1973
|
+
: assignment.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1974
|
+
if (leftCode === variable.name) {
|
|
1975
|
+
const rightNode =
|
|
1976
|
+
rightIndex.length === 1 ? assignment.rights[rightIndex[0]]?.expression : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1977
|
+
const rightCode = rightNode?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1978
|
+
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1979
|
+
}
|
|
1892
1980
|
});
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
code +=
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
code +=
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
1981
|
+
} else {
|
|
1982
|
+
let rightCode = '';
|
|
1983
|
+
// 因为右侧枚举要赋值就得new 一下;
|
|
1984
|
+
if (
|
|
1985
|
+
assignment.right &&
|
|
1986
|
+
assignment.right instanceof Identifier &&
|
|
1987
|
+
assignment.right.namespace &&
|
|
1988
|
+
assignment.right.namespace.endsWith('enums')
|
|
1989
|
+
) {
|
|
1990
|
+
rightCode += 'new ';
|
|
1991
|
+
}
|
|
1992
|
+
rightCode +=
|
|
1993
|
+
assignment.right && assignment.right.toEmbeddedTS ? assignment.right.toEmbeddedTS(shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1994
|
+
code += this.getRightCode(rightCode, assignment, assignment.right);
|
|
1995
|
+
}
|
|
1996
|
+
code += ';\n';
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1999
|
+
// elements类型声明定义
|
|
2000
|
+
code += `interface __elements {\n`;
|
|
2001
|
+
// 生成所有的name和类型定义
|
|
2002
|
+
this.elements.forEach((element) => {
|
|
2003
|
+
code += element.toEmbeddedTSDefinition(
|
|
2004
|
+
shiftState(state, code, {
|
|
2005
|
+
tabSize: (state?.tabSize || 0) + 1,
|
|
2006
|
+
})
|
|
2007
|
+
);
|
|
2008
|
+
});
|
|
2009
|
+
code += `${indent((state?.tabSize || 0) + 1)}}\n`;
|
|
2010
|
+
code += `let __elements: __elements;\n`;
|
|
2011
|
+
// 逻辑
|
|
2012
|
+
if (Array.isArray(this.logics) && this.logics.length) {
|
|
2013
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
2014
|
+
this.logics.forEach((logic) => {
|
|
2015
|
+
code += logic.toEmbeddedTS(
|
|
2016
|
+
shiftState(state, code, {
|
|
2017
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
2018
|
+
}),
|
|
2019
|
+
'noExport'
|
|
2020
|
+
);
|
|
2021
|
+
code += '\n';
|
|
2022
|
+
});
|
|
2023
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
2024
|
+
}
|
|
2025
|
+
// 事件
|
|
2026
|
+
if (Array.isArray(this.bindEvents)) {
|
|
2027
|
+
this.bindEvents.forEach((event) => {
|
|
2028
|
+
code += event.toEmbeddedTS(
|
|
2029
|
+
shiftState(state, code, {
|
|
2030
|
+
tabSize: state?.tabSize || 0,
|
|
2031
|
+
}),
|
|
2032
|
+
true
|
|
2033
|
+
);
|
|
2034
|
+
code += '\n';
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
// render函数
|
|
2039
|
+
code += `\n${indent((state?.tabSize || 0) + 1)}`;
|
|
2040
|
+
code += `export function __render(`;
|
|
2041
|
+
code += `){\n`;
|
|
2042
|
+
code += indent(state?.tabSize || 0);
|
|
2043
|
+
|
|
2044
|
+
// elements 元素
|
|
2045
|
+
if (Array.isArray(this.elements)) {
|
|
2046
|
+
// 生成嵌套式的内容
|
|
2047
|
+
this.elements.forEach((element) => {
|
|
2048
|
+
code += element.toEmbeddedTS(
|
|
2049
|
+
shiftState(state, code, {
|
|
2050
|
+
tabSize: (state?.tabSize || 0) + 3,
|
|
2051
|
+
})
|
|
2052
|
+
);
|
|
2053
|
+
code += '\n';
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
code += `\n${indent((state?.tabSize || 0) + 1)}}\n`;
|
|
2058
|
+
|
|
2059
|
+
if (Array.isArray(this.params)) {
|
|
2060
|
+
code += `${indent((state?.tabSize || 0) + 1)}export function $destination(options: {`;
|
|
2061
|
+
this.params.forEach((param, index) => {
|
|
2062
|
+
code += `${param.name}?: `;
|
|
2063
|
+
code += param.typeAnnotation.toEmbeddedTS(shiftState(state, code));
|
|
2064
|
+
code += ', ';
|
|
2065
|
+
});
|
|
2066
|
+
|
|
2067
|
+
// 锚点
|
|
2068
|
+
code += `_anchor?: nasl.core.String`;
|
|
2069
|
+
|
|
2070
|
+
code += '}){}\n';
|
|
2071
|
+
}
|
|
2072
|
+
code += `${indent(state?.tabSize || 0)}}\n`;
|
|
2073
|
+
return code;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
@withSourceMap()
|
|
2077
|
+
toNaturalTS(state?: TranslatorState, currentNode?: BaseNode): string {
|
|
2078
|
+
let code = `export function ${this.tsName}_view`;
|
|
2079
|
+
const advanceMap: Map<Variable, Assignment | BatchAssignment> = new Map();
|
|
2080
|
+
this.traverseChildren((el) => {
|
|
2081
|
+
if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
|
|
2082
|
+
// 子页面内部逻辑过滤
|
|
2083
|
+
if (el.view !== this)
|
|
2084
|
+
return;
|
|
2085
|
+
const jsCode = el.toJS();
|
|
2086
|
+
const advanceVar = this.variables?.find((variable) =>
|
|
2087
|
+
!variable.typeAnnotation && jsCode.includes(`this.${variable.name} = `));
|
|
2088
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
2089
|
+
advanceMap.set(advanceVar, el);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
|
|
2094
|
+
// 有参数长度
|
|
2095
|
+
code += '(';
|
|
2096
|
+
this.params.forEach((param, index) => {
|
|
2097
|
+
code += param.toNaturalTS(shiftState(state, code, { inline: true }));
|
|
2098
|
+
if (index !== this.params.length - 1)
|
|
2099
|
+
code += ', ';
|
|
2100
|
+
});
|
|
2101
|
+
code += ')';
|
|
2102
|
+
code += ' {\n';
|
|
2103
|
+
|
|
2104
|
+
this.variables.forEach((variable) => {
|
|
2105
|
+
if (!advanceMap.get(variable)) {
|
|
2106
|
+
code += `${indent(state.tabSize + 1)}let `;
|
|
2107
|
+
code += variable.toNaturalTS(shiftState(state, code, { inline: true }));
|
|
2108
|
+
code += ';\n';
|
|
2109
|
+
}
|
|
2110
|
+
});
|
|
2111
|
+
code += `\n${indent(state.tabSize + 1)}const $refs = {\n`;
|
|
2112
|
+
// 生成所有的name和类型定义
|
|
2113
|
+
this.elements.forEach((element) => {
|
|
2114
|
+
code += element.toNaturalTSDefinition(shiftState(state, code, {
|
|
2115
|
+
tabSize: state.tabSize + 1,
|
|
2116
|
+
}));
|
|
2117
|
+
});
|
|
2118
|
+
code += `${indent(state.tabSize + 1)}}\n`;
|
|
2119
|
+
// 逻辑
|
|
2120
|
+
if (currentNode?.concept === 'Logic') {
|
|
2121
|
+
code += '\n';
|
|
2122
|
+
code += (currentNode as Logic).toNaturalTS(shiftState(state, code, {
|
|
2123
|
+
tabSize: state.tabSize + 1,
|
|
2124
|
+
}), 'noExport');
|
|
2125
|
+
code += '\n';
|
|
2126
|
+
} else if (this.logics.length) {
|
|
2127
|
+
code += '\n';
|
|
2128
|
+
this.logics.forEach((logic) => {
|
|
2129
|
+
code += logic.toNaturalTS(shiftState(state, code, {
|
|
2130
|
+
tabSize: state.tabSize + 1,
|
|
2131
|
+
}), 'noExport');
|
|
2132
|
+
code += '\n';
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
code += `${indent(state.tabSize)}}\n`;
|
|
2136
|
+
return code;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
toEmbeddedTSFile() {
|
|
2140
|
+
let code = `namespace ${this.getTsNamespace()} {\n`;
|
|
2141
|
+
const state = createCompilerState(code, {
|
|
2142
|
+
tabSize: 1,
|
|
2143
|
+
});
|
|
2144
|
+
|
|
2145
|
+
try {
|
|
2146
|
+
code += this.toEmbeddedTS(state);
|
|
2147
|
+
} catch (err) {
|
|
2148
|
+
code += '';
|
|
2149
|
+
console.log(err);
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
code += '}\n';
|
|
2153
|
+
|
|
2154
|
+
return {
|
|
2155
|
+
code,
|
|
2156
|
+
filePath: this.getEmbeddedFilePath(),
|
|
2157
|
+
sourceMap: state.sourceMap,
|
|
2158
|
+
};
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// IDE内展示需要屏蔽掉“系统统一路径前缀”
|
|
2162
|
+
get uiPath() {
|
|
2163
|
+
const { basePath } = this.frontend;
|
|
2164
|
+
const _path = [];
|
|
2165
|
+
let view: View = this;
|
|
2166
|
+
while (view.concept === 'View') {
|
|
2167
|
+
_path.push(view.name);
|
|
2168
|
+
view = view.parentNode as View;
|
|
2169
|
+
}
|
|
2170
|
+
let path = '/';
|
|
2171
|
+
if (_path.length) {
|
|
2172
|
+
path += `${_path.reverse().join('/')}`;
|
|
2173
|
+
}
|
|
2174
|
+
return `${basePath}${path}`;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
get path() {
|
|
2178
|
+
const { prefixPath } = this.frontend;
|
|
2179
|
+
const _path = [];
|
|
2180
|
+
let view: View = this;
|
|
2181
|
+
while (view.concept === 'View') {
|
|
2182
|
+
_path.push(view.name);
|
|
2183
|
+
view = view.parentNode as View;
|
|
2184
|
+
}
|
|
2185
|
+
let path = '/';
|
|
2186
|
+
if (_path.length) {
|
|
2187
|
+
path += `${_path.reverse().join('/')}`;
|
|
2188
|
+
}
|
|
2189
|
+
return `${prefixPath}${path}`;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* 权限领域的资源路径
|
|
2194
|
+
*/
|
|
2195
|
+
get authPath() {
|
|
2196
|
+
return this.path;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* 获取当前页面下所有elements上bindEvents下的logic
|
|
2201
|
+
*/
|
|
2202
|
+
elementLogicRoot: any[] = [];
|
|
2203
|
+
|
|
2204
|
+
getElementLogicRoot() {
|
|
2205
|
+
const logics: Array<Logic> = [];
|
|
2206
|
+
// 页面上的绑定的事件
|
|
2207
|
+
this.bindEvents.forEach((bindEvent) => {
|
|
2208
|
+
bindEvent.logics.forEach((logic) => {
|
|
2209
|
+
// 键盘事件
|
|
2210
|
+
if (['keydown', 'keyup'].includes(bindEvent.name)) {
|
|
2211
|
+
logic.virtualParams = [
|
|
2212
|
+
Param.from(
|
|
2213
|
+
{
|
|
2214
|
+
name: 'event',
|
|
2215
|
+
typeAnnotation: null,
|
|
2216
|
+
},
|
|
2217
|
+
logic,
|
|
2218
|
+
'virtualParams'
|
|
2219
|
+
),
|
|
2220
|
+
];
|
|
2221
|
+
}
|
|
2222
|
+
// 生命周期没有event
|
|
2223
|
+
logics.push(logic);
|
|
2224
|
+
});
|
|
2225
|
+
});
|
|
2226
|
+
this.elements.forEach((item) => {
|
|
2227
|
+
utils.traverse(
|
|
2228
|
+
(current) => {
|
|
2229
|
+
current.node.bindEvents.forEach((bindEvent) => {
|
|
2029
2230
|
bindEvent.logics.forEach((logic) => {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
}, logic, 'virtualParams')
|
|
2037
|
-
]
|
|
2038
|
-
}
|
|
2039
|
-
// 生命周期没有event
|
|
2040
|
-
logics.push(logic);
|
|
2231
|
+
if (logic.name.startsWith('__')) {
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
// 绑定参数才有 event 的 current
|
|
2235
|
+
logic.virtualParams = bindEvent.getContextRenderLogicParams(logic);
|
|
2236
|
+
logics.push(logic);
|
|
2041
2237
|
});
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
// 页面上的绑定的事件
|
|
2072
|
-
this.bindEvents.forEach((bindEvent) => {
|
|
2238
|
+
});
|
|
2239
|
+
},
|
|
2240
|
+
{ node: item }
|
|
2241
|
+
);
|
|
2242
|
+
});
|
|
2243
|
+
if (logics.length) {
|
|
2244
|
+
const expanded = (this.elementLogicRoot.length && this.elementLogicRoot[0].expanded) || false;
|
|
2245
|
+
this.elementLogicRoot = [
|
|
2246
|
+
{
|
|
2247
|
+
concept: 'elementLogicRoot',
|
|
2248
|
+
expanded,
|
|
2249
|
+
children: logics,
|
|
2250
|
+
},
|
|
2251
|
+
];
|
|
2252
|
+
} else {
|
|
2253
|
+
this.elementLogicRoot = [];
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
getViewBindEvents() {
|
|
2258
|
+
const bindEvents: Array<BindEvent> = [];
|
|
2259
|
+
// 页面上的绑定的事件
|
|
2260
|
+
this.bindEvents.forEach((bindEvent) => {
|
|
2261
|
+
bindEvents.push(bindEvent);
|
|
2262
|
+
});
|
|
2263
|
+
this.elements.forEach((item) => {
|
|
2264
|
+
utils.traverse(
|
|
2265
|
+
(current) => {
|
|
2266
|
+
current.node.bindEvents.forEach((bindEvent) => {
|
|
2073
2267
|
bindEvents.push(bindEvent);
|
|
2268
|
+
});
|
|
2269
|
+
},
|
|
2270
|
+
{ node: item }
|
|
2271
|
+
);
|
|
2272
|
+
});
|
|
2273
|
+
return bindEvents;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
// 获取页面上需要替换的表达式
|
|
2277
|
+
getViewExpressions() {
|
|
2278
|
+
const bindExpressions: any[] = [];
|
|
2279
|
+
this.elements.forEach((item) => {
|
|
2280
|
+
utils.traverse(
|
|
2281
|
+
(current) => {
|
|
2282
|
+
const { node } = current as any;
|
|
2283
|
+
/// / 处理三种情况
|
|
2284
|
+
// if (
|
|
2285
|
+
// ['BindAttribute', 'BindDirective', 'BindStyle'].includes(node.concept)
|
|
2286
|
+
// && node.needReplaceWithIdentifier
|
|
2287
|
+
// ) {
|
|
2288
|
+
// bindExpressions.push(node);
|
|
2289
|
+
// }
|
|
2290
|
+
if (node.concept === 'Match') {
|
|
2291
|
+
bindExpressions.push(node as Match);
|
|
2292
|
+
}
|
|
2293
|
+
},
|
|
2294
|
+
{
|
|
2295
|
+
node: item,
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
mode: 'anyObject',
|
|
2299
|
+
depthFirst: true,
|
|
2300
|
+
excludedKeySet: new Set([
|
|
2301
|
+
'bindEvents',
|
|
2302
|
+
'parentNode',
|
|
2303
|
+
'sourceMap',
|
|
2304
|
+
'storageJSON',
|
|
2305
|
+
'tsErrorDetail',
|
|
2306
|
+
'NaslAnnotatedJSON',
|
|
2307
|
+
'calledFrom',
|
|
2308
|
+
'_events',
|
|
2309
|
+
'_collectingList',
|
|
2310
|
+
'_historyList',
|
|
2311
|
+
]),
|
|
2312
|
+
}
|
|
2313
|
+
);
|
|
2314
|
+
});
|
|
2315
|
+
return bindExpressions;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* @param path 子路径
|
|
2320
|
+
* 比如当前页面路径为:/dashboard
|
|
2321
|
+
* path 为要查找子路径:如 /student/list、student/list
|
|
2322
|
+
*/
|
|
2323
|
+
findViewByPath(path: string): View {
|
|
2324
|
+
const arr = path.split('/');
|
|
2325
|
+
if (arr[0] === '') arr.shift();
|
|
2326
|
+
|
|
2327
|
+
if (!arr.length) return this;
|
|
2328
|
+
const childName = arr.shift();
|
|
2329
|
+
const subView = this.children.find((child) => child.name === childName);
|
|
2330
|
+
return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
findViewByName(name: string): View {
|
|
2334
|
+
return utils.traverse(
|
|
2335
|
+
(current) => {
|
|
2336
|
+
if (current.node.name === name) return current.node;
|
|
2337
|
+
},
|
|
2338
|
+
{ node: this }
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
findElementByName(name: string): ViewElement {
|
|
2343
|
+
return this.elements[0]?.findElementByName(name);
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
findElementByTag(tag: string): ViewElement {
|
|
2347
|
+
return this.elements[0]?.findElementByName(tag);
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
findElementByAttr(name: string, value: string): ViewElement {
|
|
2351
|
+
return this.elements[0]?.findElementByAttr(name, value);
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
_setAsIndexView(isIndex: boolean) {
|
|
2355
|
+
let views: View[] = [];
|
|
2356
|
+
if (this.parentNode.concept !== 'View') {
|
|
2357
|
+
views = (this.parentNode as Frontend).views;
|
|
2358
|
+
} else if (this.parentNode.concept === 'View') {
|
|
2359
|
+
views = (this.parentNode as View).children;
|
|
2360
|
+
}
|
|
2361
|
+
if (views.length) {
|
|
2362
|
+
if (this.isIndex !== isIndex) {
|
|
2363
|
+
this.setIsIndex(isIndex);
|
|
2364
|
+
}
|
|
2365
|
+
// 设为默认跳转页时,将之前的默认跳转页取消设置
|
|
2366
|
+
if (isIndex) {
|
|
2367
|
+
views.forEach((view) => {
|
|
2368
|
+
if (view !== this && view.id !== this.id && view.isIndex) {
|
|
2369
|
+
view.setIsIndex(false);
|
|
2370
|
+
}
|
|
2074
2371
|
});
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
// 调用服务端逻辑,参数替换成 null
|
|
2210
|
-
if (rightNode instanceof CallLogic && rightNode.calleeNamespace === 'app.logics') {
|
|
2211
|
-
const calleeName = rightNode?.calleeName;
|
|
2212
|
-
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
2213
|
-
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
// view 局部变量,申明提升前增加判断,使用 logic 内的 result 直接替换成对应 logic,logic 内部变量替换成 null
|
|
2217
|
-
if (logicRtn && code.includes(logicRtn.name)) {
|
|
2218
|
-
if (code === logicRtn.name)
|
|
2219
|
-
return `${logic.name}(${logic.params.map(() => 'null').join(',')})`;
|
|
2220
|
-
|
|
2221
|
-
code = this.handleReplaceCode(code, logicRtn.name, `${logic.name}(${logic.params.map(() => 'null').join(',')})`);
|
|
2222
|
-
logic.params.forEach((param) => {
|
|
2223
|
-
if (code.includes(param.name))
|
|
2224
|
-
code = this.handleReplaceCode(code, param.name, 'null');
|
|
2225
|
-
});
|
|
2226
|
-
logic.variables.forEach((variable) => {
|
|
2227
|
-
if (code.includes(variable.name))
|
|
2228
|
-
code = this.handleReplaceCode(code, variable.name, 'null');
|
|
2229
|
-
});
|
|
2230
|
-
return code;
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
// 处理 current.item、current1.item 等数据
|
|
2234
|
-
if (/current(\d)*\.item/.test(code)) {
|
|
2235
|
-
code = this.handleCurrentItemCode(code, logic);
|
|
2236
|
-
return code;
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
// 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
|
|
2240
|
-
const useLogicVar = logic.params.find((param) => (code.includes(param.name)))
|
|
2241
|
-
|| logic.variables.find((variable) => (code.includes(variable.name)));
|
|
2242
|
-
return useLogicVar ? 'null' : code;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
handleReplaceCode(code: string, variable: string, replaceCode: string) {
|
|
2246
|
-
return code.replace(/\S+/g, ($1) => {
|
|
2247
|
-
if ($1 === `${variable},`)
|
|
2248
|
-
return `${replaceCode},`;
|
|
2249
|
-
if ($1 === variable)
|
|
2250
|
-
return replaceCode;
|
|
2251
|
-
|
|
2252
|
-
let fnCode = $1;
|
|
2253
|
-
if ($1.startsWith(`${variable}.`))
|
|
2254
|
-
fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
2255
|
-
if ($1.startsWith(`${variable},`))
|
|
2256
|
-
fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
2257
|
-
if ($1.includes(`(${variable},`))
|
|
2258
|
-
fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
2259
|
-
if ($1.includes(`(${variable}.`))
|
|
2260
|
-
fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
|
|
2261
|
-
if ($1.includes(`(${variable})`))
|
|
2262
|
-
fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
|
|
2263
|
-
if ($1.includes(`,${variable},`))
|
|
2264
|
-
fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
|
|
2265
|
-
if ($1.includes(`,${variable}.`))
|
|
2266
|
-
fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
|
|
2267
|
-
if ($1.includes(`,${variable})`))
|
|
2268
|
-
fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
|
|
2269
|
-
return fnCode;
|
|
2270
|
-
});
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
getAncestorViewElementsWithDataSource(logic: Logic): ViewElement[] {
|
|
2274
|
-
let element: BaseNode = logic;
|
|
2275
|
-
const viewElements: ViewElement[] = [];
|
|
2276
|
-
while (element) {
|
|
2277
|
-
if (element.concept
|
|
2278
|
-
&& element.concept === 'ViewElement'
|
|
2279
|
-
&& (element as ViewElement).bindAttrs.find((bAttr) => bAttr.name === 'data-source')) {
|
|
2280
|
-
viewElements.push(element as ViewElement);
|
|
2281
|
-
}
|
|
2282
|
-
element = element.parentNode;
|
|
2283
|
-
}
|
|
2284
|
-
return viewElements;
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
handleCurrentItemCode(code: string, logic: Logic): string {
|
|
2288
|
-
const viewElementsWithDataSource: ViewElement[] = this.getAncestorViewElementsWithDataSource(logic);
|
|
2289
|
-
viewElementsWithDataSource.forEach((viewElement, index) => {
|
|
2290
|
-
const currentIndex = viewElementsWithDataSource.length - 1 - index;
|
|
2291
|
-
const currentItemCode = `current${currentIndex === 0 ? '' : currentIndex}.item`;
|
|
2292
|
-
if (code.includes(currentItemCode)) {
|
|
2293
|
-
const dataSource = viewElement.bindAttrs.find((bAttr) => bAttr.name === 'data-source');
|
|
2294
|
-
if (dataSource) {
|
|
2295
|
-
const view = viewElement.getAncestor('View') as View;
|
|
2296
|
-
const dataSourceTS = dataSource.expression.toEmbeddedTS();
|
|
2297
|
-
const logic = view.logics.find((logic) => logic.name === dataSourceTS);
|
|
2298
|
-
if (logic) {
|
|
2299
|
-
code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${dataSourceTS}(${logic.params.map(() => 'null').join(',')}))`);
|
|
2300
|
-
} else {
|
|
2301
|
-
const variable = view.variables.find((variable) => variable.name === dataSourceTS);
|
|
2302
|
-
code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${variable ? variable.name : dataSourceTS})`);
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
});
|
|
2307
|
-
return code;
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
getViewCallLogics(): string[] {
|
|
2311
|
-
const callbackLogics: string[] = [];
|
|
2312
|
-
this.traverseChildren((el) => {
|
|
2313
|
-
if (el instanceof Identifier && el.namespace?.endsWith('logics')) {
|
|
2314
|
-
callbackLogics.push(el.namespace + '.' + el.name);
|
|
2315
|
-
}
|
|
2316
|
-
});
|
|
2317
|
-
return callbackLogics;
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
//================================================================================
|
|
2321
|
-
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2322
|
-
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
2323
|
-
//================================================================================
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
setAsIndexView(isIndex: boolean) {
|
|
2377
|
+
let actionMsg = `设置页面“${this.name}”为默认跳转页`;
|
|
2378
|
+
if (this.parentNode.concept !== 'View') {
|
|
2379
|
+
actionMsg = `设置页面“${this.name}”为首页`;
|
|
2380
|
+
}
|
|
2381
|
+
this.rootNode.emit('collect:start', {
|
|
2382
|
+
actionMsg,
|
|
2383
|
+
});
|
|
2384
|
+
this._setAsIndexView(isIndex);
|
|
2385
|
+
this.rootNode.emit('collect:end');
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
removeExistingViewElement(viewElement: ViewElement) {
|
|
2389
|
+
if (this.existingViewElement.has(viewElement.name)) {
|
|
2390
|
+
this.existingViewElement.delete(viewElement.name);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
getRightCode(code: string, assignment: Assignment | BatchAssignment, rightNode: any): string {
|
|
2395
|
+
code = code.replaceAll('\n', ' ');
|
|
2396
|
+
const { logic } = assignment;
|
|
2397
|
+
const logicRtn = logic?.returns[0];
|
|
2398
|
+
// 调用接口,参数替换成 null
|
|
2399
|
+
if (rightNode instanceof CallInterface) {
|
|
2400
|
+
const { _interface } = rightNode.getModuleInterface();
|
|
2401
|
+
return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
// 调用服务端逻辑,参数替换成 null
|
|
2405
|
+
if (rightNode instanceof CallLogic && rightNode.calleeNamespace === 'app.logics') {
|
|
2406
|
+
const calleeName = rightNode?.calleeName;
|
|
2407
|
+
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
2408
|
+
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
// view 局部变量,申明提升前增加判断,使用 logic 内的 result 直接替换成对应 logic,logic 内部变量替换成 null
|
|
2412
|
+
if (logicRtn && code.includes(logicRtn.name)) {
|
|
2413
|
+
if (code === logicRtn.name) return `${logic.name}(${logic.params.map(() => 'null').join(',')})`;
|
|
2414
|
+
|
|
2415
|
+
code = this.handleReplaceCode(code, logicRtn.name, `${logic.name}(${logic.params.map(() => 'null').join(',')})`);
|
|
2416
|
+
logic.params.forEach((param) => {
|
|
2417
|
+
if (code.includes(param.name)) code = this.handleReplaceCode(code, param.name, 'null');
|
|
2418
|
+
});
|
|
2419
|
+
logic.variables.forEach((variable) => {
|
|
2420
|
+
if (code.includes(variable.name)) code = this.handleReplaceCode(code, variable.name, 'null');
|
|
2421
|
+
});
|
|
2422
|
+
return code;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
// 处理 current.item、current1.item 等数据
|
|
2426
|
+
if (/current(\d)*\.item/.test(code)) {
|
|
2427
|
+
code = this.handleCurrentItemCode(code, logic);
|
|
2428
|
+
return code;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
// 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
|
|
2432
|
+
const useLogicVar = logic.params.find((param) => code.includes(param.name)) || logic.variables.find((variable) => code.includes(variable.name));
|
|
2433
|
+
return useLogicVar ? 'null' : code;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
handleReplaceCode(code: string, variable: string, replaceCode: string) {
|
|
2437
|
+
return code.replace(/\S+/g, ($1) => {
|
|
2438
|
+
if ($1 === `${variable},`) return `${replaceCode},`;
|
|
2439
|
+
if ($1 === variable) return replaceCode;
|
|
2440
|
+
|
|
2441
|
+
let fnCode = $1;
|
|
2442
|
+
if ($1.startsWith(`${variable}.`)) fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
2443
|
+
if ($1.startsWith(`${variable},`)) fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
2444
|
+
if ($1.includes(`(${variable},`)) fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
2445
|
+
if ($1.includes(`(${variable}.`)) fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
|
|
2446
|
+
if ($1.includes(`(${variable})`)) fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
|
|
2447
|
+
if ($1.includes(`,${variable},`)) fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
|
|
2448
|
+
if ($1.includes(`,${variable}.`)) fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
|
|
2449
|
+
if ($1.includes(`,${variable})`)) fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
|
|
2450
|
+
return fnCode;
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
getAncestorViewElementsWithDataSource(logic: Logic): ViewElement[] {
|
|
2455
|
+
let element: BaseNode = logic;
|
|
2456
|
+
const viewElements: ViewElement[] = [];
|
|
2457
|
+
while (element) {
|
|
2458
|
+
if (element.concept && element.concept === 'ViewElement' && (element as ViewElement).bindAttrs.find((bAttr) => bAttr.name === 'data-source')) {
|
|
2459
|
+
viewElements.push(element as ViewElement);
|
|
2460
|
+
}
|
|
2461
|
+
element = element.parentNode;
|
|
2462
|
+
}
|
|
2463
|
+
return viewElements;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
handleCurrentItemCode(code: string, logic: Logic): string {
|
|
2467
|
+
const viewElementsWithDataSource: ViewElement[] = this.getAncestorViewElementsWithDataSource(logic);
|
|
2468
|
+
viewElementsWithDataSource.forEach((viewElement, index) => {
|
|
2469
|
+
const currentIndex = viewElementsWithDataSource.length - 1 - index;
|
|
2470
|
+
const currentItemCode = `current${currentIndex === 0 ? '' : currentIndex}.item`;
|
|
2471
|
+
if (code.includes(currentItemCode)) {
|
|
2472
|
+
const dataSource = viewElement.bindAttrs.find((bAttr) => bAttr.name === 'data-source');
|
|
2473
|
+
if (dataSource) {
|
|
2474
|
+
const view = viewElement.getAncestor('View') as View;
|
|
2475
|
+
const dataSourceTS = dataSource.expression.toEmbeddedTS();
|
|
2476
|
+
const logic = view.logics.find((logic) => logic.name === dataSourceTS);
|
|
2477
|
+
if (logic) {
|
|
2478
|
+
code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${dataSourceTS}(${logic.params.map(() => 'null').join(',')}))`);
|
|
2479
|
+
} else {
|
|
2480
|
+
const variable = view.variables.find((variable) => variable.name === dataSourceTS);
|
|
2481
|
+
code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${variable ? variable.name : dataSourceTS})`);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
});
|
|
2486
|
+
return code;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
getViewCallLogics(): string[] {
|
|
2490
|
+
const callbackLogics: string[] = [];
|
|
2491
|
+
this.traverseChildren((el) => {
|
|
2492
|
+
if (el instanceof Identifier && el.namespace?.endsWith('logics')) {
|
|
2493
|
+
callbackLogics.push(`${el.namespace}.${el.name}`);
|
|
2494
|
+
}
|
|
2495
|
+
});
|
|
2496
|
+
return callbackLogics;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
//= ===============================================================================
|
|
2500
|
+
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2501
|
+
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
2502
|
+
//= ===============================================================================
|
|
2324
2503
|
}
|
|
2325
2504
|
|
|
2326
2505
|
classMap.View = View;
|
|
2327
2506
|
export default View;
|
|
2328
|
-
|
|
2507
|
+
//= ===============================================================================
|
|
2329
2508
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
2330
2509
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
2331
|
-
|
|
2510
|
+
//= ===============================================================================
|