@lcap/nasl 3.7.1-beta.1 → 3.7.2-alpha.1
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/common/BaseNode.js +3 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +9 -27
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +1 -1
- package/out/concepts/Argument__.js +2 -6
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/AssigneeV2__.js +0 -2
- package/out/concepts/AssigneeV2__.js.map +1 -1
- package/out/concepts/Assignee__.js +0 -2
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +0 -2
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +2 -4
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +1 -1
- package/out/concepts/Attribute__.js +7 -23
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthInterface__.js +1 -3
- package/out/concepts/AuthInterface__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +7 -7
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js +1 -3
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +2 -2
- package/out/concepts/BackendVariable__.js +3 -9
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.js +1 -3
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +1 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +4 -4
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +6 -58
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +6 -6
- package/out/concepts/BindDirective__.js +7 -21
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +3 -3
- package/out/concepts/BindEvent__.js +3 -13
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -3
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -3
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/BusinessComponent__.js +11 -19
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/BusinessLogic__.js +8 -10
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallConnector__.js +2 -6
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallEvent__.js +2 -6
- package/out/concepts/CallEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +1 -1
- package/out/concepts/CallFunction__.js +4 -14
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +1 -1
- package/out/concepts/CallInterface__.js +3 -9
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +4 -4
- package/out/concepts/CallLogic__.js +10 -25
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +2 -2
- package/out/concepts/CallQueryComponent__.js +2 -13
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -3
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +5 -15
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -3
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.d.ts +0 -1
- package/out/concepts/ConfigPropertyValue__.js +2 -13
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +3 -9
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.js +3 -9
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/ConnectorLogic__.js +1 -3
- package/out/concepts/ConnectorLogic__.js.map +1 -1
- package/out/concepts/ConnectorTriggerLauncher__.js +6 -9
- package/out/concepts/ConnectorTriggerLauncher__.js.map +1 -1
- package/out/concepts/ConnectorTrigger__.js +2 -6
- package/out/concepts/ConnectorTrigger__.js.map +1 -1
- package/out/concepts/Connector__.js +3 -9
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.js +2 -6
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/CountersignPolicyV2__.js +1 -3
- package/out/concepts/CountersignPolicyV2__.js.map +1 -1
- package/out/concepts/CountersignPolicy__.js +1 -3
- package/out/concepts/CountersignPolicy__.js.map +1 -1
- package/out/concepts/DataSource__.js +6 -12
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.js +6 -6
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/Destination__.js +3 -9
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +2 -2
- package/out/concepts/EntityIndex__.js +4 -13
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +10 -12
- package/out/concepts/EntityProperty__.js +27 -44
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +2 -2
- package/out/concepts/Entity__.js +11 -18
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +1 -1
- package/out/concepts/EnumItem__.js +6 -8
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +7 -10
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/EventDeclaration__.js +4 -16
- package/out/concepts/EventDeclaration__.js.map +1 -1
- package/out/concepts/Event__.js +5 -15
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +1 -1
- package/out/concepts/ExternalDestination__.js +1 -3
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/FieldPermissionV2__.js +2 -6
- package/out/concepts/FieldPermissionV2__.js.map +1 -1
- package/out/concepts/FlowConditionV2__.js +1 -3
- package/out/concepts/FlowConditionV2__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js +2 -6
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +0 -4
- package/out/concepts/FrontendType__.js +2 -15
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/FrontendVariable__.js +1 -3
- package/out/concepts/FrontendVariable__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +0 -2
- package/out/concepts/Frontend__.js +8 -31
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +2 -6
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/HistoryProcessV2__.js +4 -12
- package/out/concepts/HistoryProcessV2__.js.map +1 -1
- package/out/concepts/I18nInfo__.d.ts +1 -1
- package/out/concepts/I18nInfo__.js +5 -9
- package/out/concepts/I18nInfo__.js.map +1 -1
- package/out/concepts/IconSetter__.js +1 -7
- package/out/concepts/IconSetter__.js.map +1 -1
- package/out/concepts/Identifier__.js +7 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/ImportedInterface__.d.ts +1 -1
- package/out/concepts/ImportedInterface__.js +1 -3
- package/out/concepts/ImportedInterface__.js.map +1 -1
- package/out/concepts/InputSetter__.js +1 -7
- package/out/concepts/InputSetter__.js.map +1 -1
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +4 -12
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +12 -19
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +1 -3
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +3 -9
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicDeclaration__.js +3 -13
- package/out/concepts/LogicDeclaration__.js.map +1 -1
- package/out/concepts/LogicItem__.js +5 -31
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +6 -6
- package/out/concepts/Logic__.js +27 -36
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +11 -11
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +1 -3
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +6 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +1 -1
- package/out/concepts/MetadataType__.js +4 -12
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/MicroApp__.js +7 -21
- package/out/concepts/MicroApp__.js.map +1 -1
- package/out/concepts/Module__.d.ts +2 -2
- package/out/concepts/Module__.js +8 -24
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +4 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js +6 -10
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +1 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +1 -1
- package/out/concepts/NewMap__.js +5 -2
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumberInputSetter__.js +5 -35
- package/out/concepts/NumberInputSetter__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -3
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OperatePermissionV2__.js +4 -12
- package/out/concepts/OperatePermissionV2__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -6
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.js +12 -26
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/ParamWithGroup__.js +2 -6
- package/out/concepts/ParamWithGroup__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -1
- package/out/concepts/Param__.js +2 -14
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +2 -6
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessBindV2__.js +2 -6
- package/out/concepts/ProcessBindV2__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +4 -12
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElementV2__.js +8 -24
- package/out/concepts/ProcessElementV2__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +10 -22
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -3
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +0 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/ProcessV2__.js +6 -18
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/Process__.js +3 -9
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/PropDeclaration__.d.ts +4 -0
- package/out/concepts/PropDeclaration__.js +19 -84
- package/out/concepts/PropDeclaration__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +2 -6
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +4 -12
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +5 -11
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +6 -14
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +12 -4
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +6 -2
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +5 -7
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +4 -12
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.js +2 -10
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +4 -4
- package/out/concepts/Role__.js +6 -14
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +1 -3
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SetterOption__.js +6 -34
- package/out/concepts/SetterOption__.js.map +1 -1
- package/out/concepts/SlotDeclaration__.js +5 -23
- package/out/concepts/SlotDeclaration__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +4 -12
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StaticString__.d.ts +1 -1
- package/out/concepts/StaticString__.js +6 -10
- package/out/concepts/StaticString__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -6
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -5
- package/out/concepts/StructureProperty__.js +9 -14
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +0 -4
- package/out/concepts/Structure__.js +17 -20
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/ThemeVariable__.js +1 -3
- package/out/concepts/ThemeVariable__.js.map +1 -1
- package/out/concepts/Theme__.js +2 -6
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +2 -2
- package/out/concepts/Transactional__.js +6 -12
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +1 -3
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.js +3 -9
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +2 -2
- package/out/concepts/TypeAnnotation__.js +24 -31
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js +1 -3
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -3
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js +1 -3
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +2 -6
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -6
- package/out/concepts/ValidationRule__.js +4 -23
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -1
- package/out/concepts/Variable__.js +2 -10
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlockWithImage__.js +2 -6
- package/out/concepts/ViewBlockWithImage__.js.map +1 -1
- package/out/concepts/ViewBlock__.js +3 -13
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponentDeclaration__.d.ts +1 -1
- package/out/concepts/ViewComponentDeclaration__.js +8 -36
- package/out/concepts/ViewComponentDeclaration__.js.map +1 -1
- package/out/concepts/ViewElement__.js +92 -83
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +22 -40
- package/out/concepts/View__.js.map +1 -1
- package/out/generator/genBundleFiles.js +1 -0
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/release-body/utils.js +2 -1
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/natural/genNaturalTS.d.ts +44 -1
- package/out/natural/genNaturalTS.js +61 -5
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/index.js +3 -0
- package/out/natural/getContext/index.js.map +1 -1
- package/out/server/naslServer.js +24 -10
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +47 -0
- package/out/server/translator.js.map +1 -1
- package/out/translator/types.d.ts +4 -0
- package/out/translator/utils.d.ts +1 -0
- package/out/translator/utils.js +6 -1
- package/out/translator/utils.js.map +1 -1
- package/out/utils/env.d.ts +2 -0
- package/out/utils/env.js +3 -1
- package/out/utils/env.js.map +1 -1
- package/package.json +1 -1
- package/src/common/BaseNode.ts +3 -1
- package/src/concepts/AnonymousFunction__.ts +1 -1
- package/src/concepts/App__.ts +9 -27
- package/src/concepts/Argument__.ts +3 -7
- package/src/concepts/AssigneeV2__.ts +0 -2
- package/src/concepts/Assignee__.ts +0 -2
- package/src/concepts/AssignmentLine__.ts +0 -2
- package/src/concepts/Assignment__.ts +2 -4
- package/src/concepts/Attribute__.ts +9 -21
- package/src/concepts/AuthInterface__.ts +1 -3
- package/src/concepts/AuthLogicForCallInterface__.ts +4 -5
- package/src/concepts/AuthLogic__.ts +1 -3
- package/src/concepts/BackendVariable__.ts +5 -11
- package/src/concepts/Backend__.ts +1 -3
- package/src/concepts/BatchAssignment__.ts +4 -4
- package/src/concepts/BinaryExpression__.ts +9 -7
- package/src/concepts/BindAttribute__.ts +26 -38
- package/src/concepts/BindDirective__.ts +13 -27
- package/src/concepts/BindEvent__.ts +7 -13
- package/src/concepts/BindStyle__.ts +1 -3
- package/src/concepts/BooleanLiteral__.ts +1 -3
- package/src/concepts/BusinessComponent__.ts +16 -20
- package/src/concepts/BusinessLogic__.ts +7 -10
- package/src/concepts/CallConnector__.ts +3 -7
- package/src/concepts/CallEvent__.ts +2 -6
- package/src/concepts/CallFunction__.ts +7 -14
- package/src/concepts/CallInterface__.ts +8 -15
- package/src/concepts/CallLogic__.ts +39 -46
- package/src/concepts/CallQueryComponent__.ts +9 -22
- package/src/concepts/Comment__.ts +1 -3
- package/src/concepts/CompletionProperty__.ts +5 -15
- package/src/concepts/ConfigGroup__.ts +2 -7
- package/src/concepts/ConfigPropertyValue__.ts +3 -15
- package/src/concepts/ConfigProperty__.ts +3 -9
- package/src/concepts/Configuration__.ts +1 -4
- package/src/concepts/Connection__.ts +3 -9
- package/src/concepts/ConnectorLogic__.ts +2 -4
- package/src/concepts/ConnectorTriggerLauncher__.ts +13 -11
- package/src/concepts/ConnectorTrigger__.ts +12 -12
- package/src/concepts/Connector__.ts +3 -9
- package/src/concepts/Constant__.ts +2 -6
- package/src/concepts/CountersignPolicyV2__.ts +1 -3
- package/src/concepts/CountersignPolicy__.ts +1 -3
- package/src/concepts/DataSource__.ts +16 -18
- package/src/concepts/DatabaseTypeAnnotation__.ts +6 -11
- package/src/concepts/Destination__.ts +3 -9
- package/src/concepts/EntityIndex__.ts +6 -15
- package/src/concepts/EntityProperty__.ts +40 -56
- package/src/concepts/Entity__.ts +13 -18
- package/src/concepts/EnumItem__.ts +15 -10
- package/src/concepts/Enum__.ts +9 -10
- package/src/concepts/EventDeclaration__.ts +5 -13
- package/src/concepts/Event__.ts +5 -15
- package/src/concepts/ExternalDestination__.ts +2 -4
- package/src/concepts/FieldPermissionV2__.ts +2 -6
- package/src/concepts/FlowConditionV2__.ts +1 -3
- package/src/concepts/ForEachStatement__.ts +2 -2
- package/src/concepts/FrontendLibrary__.ts +2 -6
- package/src/concepts/FrontendType__.ts +2 -14
- package/src/concepts/FrontendVariable__.ts +1 -3
- package/src/concepts/Frontend__.ts +11 -35
- package/src/concepts/Function__.ts +2 -6
- package/src/concepts/HistoryProcessV2__.ts +4 -12
- package/src/concepts/I18nInfo__.ts +8 -15
- package/src/concepts/IconSetter__.ts +2 -4
- package/src/concepts/Identifier__.ts +9 -10
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/ImportedInterface__.ts +2 -4
- package/src/concepts/InputSetter__.ts +2 -4
- package/src/concepts/Integration__.ts +0 -1
- package/src/concepts/InterfaceParam__.ts +4 -12
- package/src/concepts/InterfaceTriggerEvent__.ts +1 -1
- package/src/concepts/Interface__.ts +16 -22
- package/src/concepts/JSBlock__.ts +1 -3
- package/src/concepts/JavaLogic__.ts +3 -9
- package/src/concepts/LogicDeclaration__.ts +4 -10
- package/src/concepts/LogicItem__.ts +9 -19
- package/src/concepts/Logic__.ts +46 -47
- package/src/concepts/MatchCase__.ts +12 -12
- package/src/concepts/Match__.ts +11 -8
- package/src/concepts/MemberExpression__.ts +8 -2
- package/src/concepts/MetadataType__.ts +9 -16
- package/src/concepts/MicroApp__.ts +7 -21
- package/src/concepts/Module__.ts +10 -26
- package/src/concepts/Namespace__.ts +4 -12
- package/src/concepts/NewComposite__.ts +18 -16
- package/src/concepts/NewList__.ts +1 -1
- package/src/concepts/NewMap__.ts +15 -6
- package/src/concepts/NumberInputSetter__.ts +10 -20
- package/src/concepts/NumericLiteral__.ts +1 -3
- package/src/concepts/OperatePermissionV2__.ts +4 -12
- package/src/concepts/OqlQueryComponent__.ts +3 -7
- package/src/concepts/OverriddenLogic__.ts +15 -25
- package/src/concepts/ParamWithGroup__.ts +2 -6
- package/src/concepts/Param__.ts +5 -9
- package/src/concepts/Point__.ts +2 -6
- package/src/concepts/ProcessBindV2__.ts +2 -6
- package/src/concepts/ProcessComponent__.ts +4 -12
- package/src/concepts/ProcessElementV2__.ts +11 -27
- package/src/concepts/ProcessElement__.ts +13 -23
- package/src/concepts/ProcessOutcome__.ts +1 -3
- package/src/concepts/ProcessOutcomes__.ts +0 -1
- package/src/concepts/ProcessV2__.ts +11 -19
- package/src/concepts/Process__.ts +3 -9
- package/src/concepts/PropDeclaration__.ts +31 -57
- package/src/concepts/QueryAggregateExpression__.ts +3 -8
- package/src/concepts/QueryFieldExpression__.ts +23 -30
- package/src/concepts/QueryFromExpression__.ts +5 -11
- package/src/concepts/QueryJoinExpression__.ts +7 -16
- package/src/concepts/QueryLimitExpression__.ts +16 -4
- package/src/concepts/QueryOrderByExpression__.ts +22 -13
- package/src/concepts/QuerySelectExpression__.ts +8 -13
- package/src/concepts/Rect__.ts +4 -12
- package/src/concepts/Return__.ts +4 -8
- package/src/concepts/Role__.ts +8 -16
- package/src/concepts/SelectMembers__.ts +1 -3
- package/src/concepts/SetterOption__.ts +10 -22
- package/src/concepts/SlotDeclaration__.ts +7 -17
- package/src/concepts/SqlQueryComponent__.ts +5 -13
- package/src/concepts/StaticString__.ts +9 -16
- package/src/concepts/StringLiteral__.ts +5 -11
- package/src/concepts/StructureProperty__.ts +16 -19
- package/src/concepts/Structure__.ts +20 -20
- package/src/concepts/SwitchCase__.ts +1 -1
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/ThemeVariable__.ts +1 -3
- package/src/concepts/Theme__.ts +2 -6
- package/src/concepts/Transactional__.ts +10 -19
- package/src/concepts/TriggerEvent__.ts +1 -3
- package/src/concepts/TriggerLauncher__.ts +11 -15
- package/src/concepts/TypeAnnotation__.ts +50 -41
- package/src/concepts/TypeParam__.ts +1 -3
- package/src/concepts/UnaryExpression__.ts +1 -3
- package/src/concepts/Unparsed__.ts +1 -3
- package/src/concepts/UseComponent__.ts +2 -6
- package/src/concepts/ValidationRule__.ts +6 -17
- package/src/concepts/Variable__.ts +4 -8
- package/src/concepts/ViewBlockWithImage__.ts +2 -6
- package/src/concepts/ViewBlock__.ts +4 -10
- package/src/concepts/ViewComponentDeclaration__.ts +11 -27
- package/src/concepts/ViewElement__.ts +232 -157
- package/src/concepts/View__.ts +40 -54
- package/src/generator/genBundleFiles.ts +2 -1
- package/src/generator/release-body/utils.ts +3 -2
- package/src/natural/genNaturalTS.ts +91 -12
- package/src/natural/getContext/index.ts +3 -0
- package/src/server/naslServer.ts +24 -10
- package/src/server/translator.ts +49 -0
- package/src/translator/types.ts +4 -0
- package/src/translator/utils.ts +6 -0
- package/src/utils/env.ts +2 -0
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -2
|
@@ -34,7 +34,22 @@ export interface ParseContext {
|
|
|
34
34
|
/**
|
|
35
35
|
* 自闭合标签
|
|
36
36
|
*/
|
|
37
|
-
const selfClosingTag = [
|
|
37
|
+
const selfClosingTag = [
|
|
38
|
+
'base',
|
|
39
|
+
'meta',
|
|
40
|
+
'area',
|
|
41
|
+
'embed',
|
|
42
|
+
'link',
|
|
43
|
+
'img',
|
|
44
|
+
'input',
|
|
45
|
+
'param',
|
|
46
|
+
'hr',
|
|
47
|
+
'br',
|
|
48
|
+
'source',
|
|
49
|
+
'track',
|
|
50
|
+
'wbr',
|
|
51
|
+
'col',
|
|
52
|
+
];
|
|
38
53
|
|
|
39
54
|
function genArgumentMemberExpression(arr: string[]) {
|
|
40
55
|
let expressionNode: any;
|
|
@@ -70,7 +85,11 @@ export interface ElementToVueOptions {
|
|
|
70
85
|
aslIdAttr?: string | boolean;
|
|
71
86
|
nodePathAttr?: string | boolean;
|
|
72
87
|
getExtraParts?: (element?: ViewElement) => Array<string>;
|
|
73
|
-
attrFormat?: (
|
|
88
|
+
attrFormat?: (
|
|
89
|
+
attr: BindAttribute | BindEvent | BindDirective,
|
|
90
|
+
element?: ViewElement,
|
|
91
|
+
defaultResult?: string,
|
|
92
|
+
) => string | false;
|
|
74
93
|
bindStylesFormat?: (bindStyles: BindStyle[], element?: ViewElement, defaultResult?: string) => string | false;
|
|
75
94
|
finalCode?: boolean;
|
|
76
95
|
currentList?: string[];
|
|
@@ -98,7 +117,9 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
|
|
|
98
117
|
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
99
118
|
}))
|
|
100
119
|
.filter((item: any) => item.expression),
|
|
101
|
-
typeArguments: astNode.arguments
|
|
120
|
+
typeArguments: astNode.arguments
|
|
121
|
+
.map((argument: any) => transAstNodeToNaslTypeNode(Object.assign({}, argument)))
|
|
122
|
+
.filter((item: any) => item),
|
|
102
123
|
};
|
|
103
124
|
} else if (astNode.type === 'MemberExpression') {
|
|
104
125
|
if (astNode.object?.name === '$global') {
|
|
@@ -226,7 +247,7 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
|
|
|
226
247
|
...tempNode,
|
|
227
248
|
},
|
|
228
249
|
undefined,
|
|
229
|
-
'logics'
|
|
250
|
+
'logics',
|
|
230
251
|
);
|
|
231
252
|
} else if (astNode.type === 'LogicalExpression' || astNode.type === 'BinaryExpression') {
|
|
232
253
|
node = {
|
|
@@ -261,7 +282,9 @@ function transAstNodeToNaslTypeNode(astNode: any, namespace?: string): any {
|
|
|
261
282
|
|
|
262
283
|
function isLockField(node?: any): boolean {
|
|
263
284
|
if (!node || node.concept !== 'ViewElement') return false;
|
|
264
|
-
const attr = node?.bindAttrs?.find((attr: any) =>
|
|
285
|
+
const attr = node?.bindAttrs?.find((attr: any) =>
|
|
286
|
+
['FormDesignerLocked', 'TableDesignerLocked'].includes(attr.name),
|
|
287
|
+
)?.value;
|
|
265
288
|
if (attr === undefined) return !!isLockField(node?.parentNode);
|
|
266
289
|
else return !!attr;
|
|
267
290
|
}
|
|
@@ -310,58 +333,44 @@ export class ViewElement extends BaseNode {
|
|
|
310
333
|
/**
|
|
311
334
|
* 元素标签
|
|
312
335
|
*/
|
|
313
|
-
@property(
|
|
314
|
-
objectRef: '',
|
|
315
|
-
})
|
|
336
|
+
@property()
|
|
316
337
|
tag: string;
|
|
317
338
|
|
|
318
339
|
/**
|
|
319
340
|
* 页面元素名称
|
|
320
341
|
*/
|
|
321
|
-
@property(
|
|
322
|
-
objectRef: '',
|
|
323
|
-
})
|
|
342
|
+
@property()
|
|
324
343
|
name: string = '';
|
|
325
344
|
|
|
326
345
|
/**
|
|
327
346
|
* 静态 class 名
|
|
328
347
|
*/
|
|
329
|
-
@property(
|
|
330
|
-
|
|
331
|
-
})
|
|
332
|
-
staticClass?: string = null;
|
|
348
|
+
@property()
|
|
349
|
+
staticClass?: string;
|
|
333
350
|
|
|
334
351
|
/**
|
|
335
352
|
* 静态 style
|
|
336
353
|
*/
|
|
337
|
-
@property(
|
|
338
|
-
|
|
339
|
-
})
|
|
340
|
-
staticStyle?: string = null;
|
|
354
|
+
@property()
|
|
355
|
+
staticStyle?: string;
|
|
341
356
|
|
|
342
357
|
/**
|
|
343
358
|
* 权限资源描述
|
|
344
359
|
*/
|
|
345
|
-
@property(
|
|
346
|
-
|
|
347
|
-
})
|
|
348
|
-
authDescription?: string = null;
|
|
360
|
+
@property()
|
|
361
|
+
authDescription?: string;
|
|
349
362
|
|
|
350
363
|
/**
|
|
351
364
|
* 插槽目标
|
|
352
365
|
*/
|
|
353
|
-
@property(
|
|
354
|
-
|
|
355
|
-
})
|
|
356
|
-
slotTarget?: string = null;
|
|
366
|
+
@property()
|
|
367
|
+
slotTarget?: string;
|
|
357
368
|
|
|
358
369
|
/**
|
|
359
370
|
* 插槽 scope 表达式
|
|
360
371
|
*/
|
|
361
|
-
@property(
|
|
362
|
-
|
|
363
|
-
})
|
|
364
|
-
slotScope?: string = null;
|
|
372
|
+
@property()
|
|
373
|
+
slotScope?: string;
|
|
365
374
|
|
|
366
375
|
/**
|
|
367
376
|
* 元素绑定属性列表
|
|
@@ -397,7 +406,6 @@ export class ViewElement extends BaseNode {
|
|
|
397
406
|
* 绑定的角色
|
|
398
407
|
*/
|
|
399
408
|
@property({
|
|
400
|
-
objectRef: '',
|
|
401
409
|
isArray: true,
|
|
402
410
|
defaultValue: [],
|
|
403
411
|
})
|
|
@@ -471,7 +479,9 @@ export class ViewElement extends BaseNode {
|
|
|
471
479
|
|
|
472
480
|
getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
|
|
473
481
|
const excludedSet = new Set(excludedList);
|
|
474
|
-
return ((this.bindAttrs as BindAttribute[]) || [])
|
|
482
|
+
return ((this.bindAttrs as BindAttribute[]) || [])
|
|
483
|
+
.filter((item) => !excludedSet.has(item))
|
|
484
|
+
.map((item) => item.name);
|
|
475
485
|
}
|
|
476
486
|
getBindAttributeUniqueName(name = 'bindAttribute1') {
|
|
477
487
|
return utils.unique(name, this.getBindAttributeExistingNames(), undefined, false);
|
|
@@ -510,7 +520,7 @@ export class ViewElement extends BaseNode {
|
|
|
510
520
|
name: this.getBindAttributeUniqueName(),
|
|
511
521
|
},
|
|
512
522
|
this,
|
|
513
|
-
'bindAttrs'
|
|
523
|
+
'bindAttrs',
|
|
514
524
|
);
|
|
515
525
|
} else if (typeof options === 'string') {
|
|
516
526
|
bindAttribute = BindAttribute.from(
|
|
@@ -519,7 +529,7 @@ export class ViewElement extends BaseNode {
|
|
|
519
529
|
name: options,
|
|
520
530
|
},
|
|
521
531
|
this,
|
|
522
|
-
'bindAttrs'
|
|
532
|
+
'bindAttrs',
|
|
523
533
|
);
|
|
524
534
|
} else if (asserts.isBindAttribute(options)) {
|
|
525
535
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
@@ -532,7 +542,7 @@ export class ViewElement extends BaseNode {
|
|
|
532
542
|
...options,
|
|
533
543
|
},
|
|
534
544
|
this,
|
|
535
|
-
'bindAttrs'
|
|
545
|
+
'bindAttrs',
|
|
536
546
|
);
|
|
537
547
|
}
|
|
538
548
|
this.bindAttrs.splice(index, 0, bindAttribute);
|
|
@@ -664,7 +674,7 @@ export class ViewElement extends BaseNode {
|
|
|
664
674
|
name: this.getBindEventUniqueName(),
|
|
665
675
|
},
|
|
666
676
|
this,
|
|
667
|
-
'bindEvents'
|
|
677
|
+
'bindEvents',
|
|
668
678
|
);
|
|
669
679
|
} else if (typeof options === 'string') {
|
|
670
680
|
bindEvent = BindEvent.from(
|
|
@@ -673,7 +683,7 @@ export class ViewElement extends BaseNode {
|
|
|
673
683
|
name: options,
|
|
674
684
|
},
|
|
675
685
|
this,
|
|
676
|
-
'bindEvents'
|
|
686
|
+
'bindEvents',
|
|
677
687
|
);
|
|
678
688
|
} else if (asserts.isBindEvent(options)) {
|
|
679
689
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
@@ -686,7 +696,7 @@ export class ViewElement extends BaseNode {
|
|
|
686
696
|
...options,
|
|
687
697
|
},
|
|
688
698
|
this,
|
|
689
|
-
'bindEvents'
|
|
699
|
+
'bindEvents',
|
|
690
700
|
);
|
|
691
701
|
}
|
|
692
702
|
this.bindEvents.splice(index, 0, bindEvent);
|
|
@@ -779,7 +789,9 @@ export class ViewElement extends BaseNode {
|
|
|
779
789
|
|
|
780
790
|
getBindDirectiveExistingNames(excludedList: Array<BindDirective> = []) {
|
|
781
791
|
const excludedSet = new Set(excludedList);
|
|
782
|
-
return ((this.bindDirectives as BindDirective[]) || [])
|
|
792
|
+
return ((this.bindDirectives as BindDirective[]) || [])
|
|
793
|
+
.filter((item) => !excludedSet.has(item))
|
|
794
|
+
.map((item) => item.name);
|
|
783
795
|
}
|
|
784
796
|
getBindDirectiveUniqueName(name = 'bindDirective1') {
|
|
785
797
|
return utils.unique(name, this.getBindDirectiveExistingNames(), undefined, false);
|
|
@@ -818,7 +830,7 @@ export class ViewElement extends BaseNode {
|
|
|
818
830
|
name: this.getBindDirectiveUniqueName(),
|
|
819
831
|
},
|
|
820
832
|
this,
|
|
821
|
-
'bindDirectives'
|
|
833
|
+
'bindDirectives',
|
|
822
834
|
);
|
|
823
835
|
} else if (typeof options === 'string') {
|
|
824
836
|
bindDirective = BindDirective.from(
|
|
@@ -827,7 +839,7 @@ export class ViewElement extends BaseNode {
|
|
|
827
839
|
name: options,
|
|
828
840
|
},
|
|
829
841
|
this,
|
|
830
|
-
'bindDirectives'
|
|
842
|
+
'bindDirectives',
|
|
831
843
|
);
|
|
832
844
|
} else if (asserts.isBindDirective(options)) {
|
|
833
845
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
@@ -840,7 +852,7 @@ export class ViewElement extends BaseNode {
|
|
|
840
852
|
...options,
|
|
841
853
|
},
|
|
842
854
|
this,
|
|
843
|
-
'bindDirectives'
|
|
855
|
+
'bindDirectives',
|
|
844
856
|
);
|
|
845
857
|
}
|
|
846
858
|
this.bindDirectives.splice(index, 0, bindDirective);
|
|
@@ -972,7 +984,7 @@ export class ViewElement extends BaseNode {
|
|
|
972
984
|
name: this.getBindStyleUniqueName(),
|
|
973
985
|
},
|
|
974
986
|
this,
|
|
975
|
-
'bindStyles'
|
|
987
|
+
'bindStyles',
|
|
976
988
|
);
|
|
977
989
|
} else if (typeof options === 'string') {
|
|
978
990
|
bindStyle = BindStyle.from(
|
|
@@ -981,7 +993,7 @@ export class ViewElement extends BaseNode {
|
|
|
981
993
|
name: options,
|
|
982
994
|
},
|
|
983
995
|
this,
|
|
984
|
-
'bindStyles'
|
|
996
|
+
'bindStyles',
|
|
985
997
|
);
|
|
986
998
|
} else if (asserts.isBindStyle(options)) {
|
|
987
999
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
@@ -994,7 +1006,7 @@ export class ViewElement extends BaseNode {
|
|
|
994
1006
|
...options,
|
|
995
1007
|
},
|
|
996
1008
|
this,
|
|
997
|
-
'bindStyles'
|
|
1009
|
+
'bindStyles',
|
|
998
1010
|
);
|
|
999
1011
|
}
|
|
1000
1012
|
this.bindStyles.splice(index, 0, bindStyle);
|
|
@@ -1118,7 +1130,7 @@ export class ViewElement extends BaseNode {
|
|
|
1118
1130
|
name: this.getViewElementUniqueName(),
|
|
1119
1131
|
},
|
|
1120
1132
|
this,
|
|
1121
|
-
'children'
|
|
1133
|
+
'children',
|
|
1122
1134
|
);
|
|
1123
1135
|
} else if (typeof options === 'string') {
|
|
1124
1136
|
viewElement = ViewElement.from(
|
|
@@ -1127,7 +1139,7 @@ export class ViewElement extends BaseNode {
|
|
|
1127
1139
|
name: options,
|
|
1128
1140
|
},
|
|
1129
1141
|
this,
|
|
1130
|
-
'children'
|
|
1142
|
+
'children',
|
|
1131
1143
|
);
|
|
1132
1144
|
} else if (asserts.isViewElement(options)) {
|
|
1133
1145
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
@@ -1140,7 +1152,7 @@ export class ViewElement extends BaseNode {
|
|
|
1140
1152
|
...options,
|
|
1141
1153
|
},
|
|
1142
1154
|
this,
|
|
1143
|
-
'children'
|
|
1155
|
+
'children',
|
|
1144
1156
|
);
|
|
1145
1157
|
}
|
|
1146
1158
|
this.children.splice(index, 0, viewElement);
|
|
@@ -1387,7 +1399,9 @@ export class ViewElement extends BaseNode {
|
|
|
1387
1399
|
get parentAuth() {
|
|
1388
1400
|
const _nameSpace = this.view.getNamespace();
|
|
1389
1401
|
const mainViewName = _nameSpace.split('.')[2];
|
|
1390
|
-
return this.view.parentNode.concept === 'App'
|
|
1402
|
+
return this.view.parentNode.concept === 'App'
|
|
1403
|
+
? this.view.auth
|
|
1404
|
+
: this.frontend.views.find((item) => item.name === mainViewName)?.auth;
|
|
1391
1405
|
}
|
|
1392
1406
|
|
|
1393
1407
|
// IDE内展示需要屏蔽掉“系统统一路径前缀”
|
|
@@ -1605,7 +1619,9 @@ export class ViewElement extends BaseNode {
|
|
|
1605
1619
|
|
|
1606
1620
|
return t;
|
|
1607
1621
|
};
|
|
1608
|
-
const hasDataSource =
|
|
1622
|
+
const hasDataSource =
|
|
1623
|
+
config?.allNodesAPI?.[self.tag]?.props?.findIndex((prop) => ['dataSource', 'data-source'].includes(prop.name)) >
|
|
1624
|
+
-1;
|
|
1609
1625
|
// 有数据源属性的组件 才需要生成 item
|
|
1610
1626
|
if (hasDataSource && T) {
|
|
1611
1627
|
const key = T1 ? '__columnItem' : '__item';
|
|
@@ -1629,9 +1645,9 @@ export class ViewElement extends BaseNode {
|
|
|
1629
1645
|
inElementsRefTree: true,
|
|
1630
1646
|
}
|
|
1631
1647
|
: {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1648
|
+
// 业务组件需要特殊处理
|
|
1649
|
+
inElementsRefTree: true,
|
|
1650
|
+
},
|
|
1635
1651
|
),
|
|
1636
1652
|
);
|
|
1637
1653
|
|
|
@@ -1739,7 +1755,11 @@ export class ViewElement extends BaseNode {
|
|
|
1739
1755
|
code += indent((state?.tabSize || 0) + 4);
|
|
1740
1756
|
code += `children: {\n`;
|
|
1741
1757
|
yield* wrapForEach(self.children, function* warpForEachGenerator(element) {
|
|
1742
|
-
code += yield* element.toEmbeddedTSRefTree(
|
|
1758
|
+
code += yield* element.toEmbeddedTSRefTree(
|
|
1759
|
+
shiftState({ ...state, tabSize: state.tabSize + 2 }, code),
|
|
1760
|
+
{ elementsPathMap },
|
|
1761
|
+
levelIndex,
|
|
1762
|
+
);
|
|
1743
1763
|
});
|
|
1744
1764
|
code += indent((state?.tabSize || 0) + 4);
|
|
1745
1765
|
code += `},\n`;
|
|
@@ -1796,14 +1816,20 @@ export class ViewElement extends BaseNode {
|
|
|
1796
1816
|
if (attr && attr.expression) {
|
|
1797
1817
|
const datasourceName = `datasourceName${element.name}`;
|
|
1798
1818
|
(element as any).__tsDataSourceTypeName = datasourceName;
|
|
1799
|
-
if (
|
|
1819
|
+
if (
|
|
1820
|
+
asserts.isMemberExpression(attr.expression) ||
|
|
1821
|
+
asserts.isIdentifier(attr.expression) ||
|
|
1822
|
+
asserts.isCallLogic(attr.expression)
|
|
1823
|
+
) {
|
|
1800
1824
|
const extraParams = {
|
|
1801
1825
|
tabSize: 4,
|
|
1802
1826
|
inline: true,
|
|
1803
1827
|
noNeedParams: true,
|
|
1804
1828
|
callLogicNoIife: true,
|
|
1805
1829
|
};
|
|
1806
|
-
const value = yield* attr.expression.toEmbeddedTS(
|
|
1830
|
+
const value = yield* attr.expression.toEmbeddedTS(
|
|
1831
|
+
shiftState(state, code, attr.expression.concept === 'CallLogic' ? extraParams : {}),
|
|
1832
|
+
);
|
|
1807
1833
|
code += `type ${datasourceName} = `;
|
|
1808
1834
|
code += `nasl.ui.GetItemTypeFromDataSource<typeof ${value}>;\n`;
|
|
1809
1835
|
} else {
|
|
@@ -1867,7 +1893,7 @@ export class ViewElement extends BaseNode {
|
|
|
1867
1893
|
},
|
|
1868
1894
|
{
|
|
1869
1895
|
node: this,
|
|
1870
|
-
}
|
|
1896
|
+
},
|
|
1871
1897
|
);
|
|
1872
1898
|
return excludedSet;
|
|
1873
1899
|
}
|
|
@@ -1887,7 +1913,9 @@ export class ViewElement extends BaseNode {
|
|
|
1887
1913
|
};
|
|
1888
1914
|
// 过滤模板的登录中的一些翻译,这里只过滤h5表格中的两个列
|
|
1889
1915
|
if (
|
|
1890
|
-
(parentNode.concept === 'ViewElement' &&
|
|
1916
|
+
(parentNode.concept === 'ViewElement' &&
|
|
1917
|
+
(parentNode as any).tag &&
|
|
1918
|
+
this.toHump((parentNode as any).tag) === 'lcapLogin') ||
|
|
1891
1919
|
staticClass === 'login-cell'
|
|
1892
1920
|
) {
|
|
1893
1921
|
return '';
|
|
@@ -1902,7 +1930,7 @@ export class ViewElement extends BaseNode {
|
|
|
1902
1930
|
code += yield* event.toEmbeddedTS(
|
|
1903
1931
|
shiftState(state, code, {
|
|
1904
1932
|
tabSize: (state?.tabSize || 0) + 2,
|
|
1905
|
-
})
|
|
1933
|
+
}),
|
|
1906
1934
|
);
|
|
1907
1935
|
code += '\n';
|
|
1908
1936
|
});
|
|
@@ -1921,7 +1949,7 @@ export class ViewElement extends BaseNode {
|
|
|
1921
1949
|
shiftState(state, code, {
|
|
1922
1950
|
tabSize: state?.tabSize || 0,
|
|
1923
1951
|
}),
|
|
1924
|
-
levelIndex
|
|
1952
|
+
levelIndex,
|
|
1925
1953
|
);
|
|
1926
1954
|
});
|
|
1927
1955
|
return code;
|
|
@@ -1966,7 +1994,7 @@ export class ViewElement extends BaseNode {
|
|
|
1966
1994
|
code += yield* event.toEmbeddedTS(
|
|
1967
1995
|
shiftState(state, code, {
|
|
1968
1996
|
tabSize: (state?.tabSize || 0) + 2,
|
|
1969
|
-
})
|
|
1997
|
+
}),
|
|
1970
1998
|
);
|
|
1971
1999
|
code += '\n';
|
|
1972
2000
|
});
|
|
@@ -2046,24 +2074,24 @@ export class ViewElement extends BaseNode {
|
|
|
2046
2074
|
// 先把插槽翻译了
|
|
2047
2075
|
yield* wrapForEach(children, function* warpForEachGenerator(element) {
|
|
2048
2076
|
if (element.tag === 'template' && element.slotTarget && element.slotTarget !== 'default') {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2077
|
+
const hasScope = element.haveScope();
|
|
2078
|
+
const slotTarget = `slot${element.toFirstUpper(element.toHump(element.slotTarget))}`;
|
|
2079
|
+
if (hasScope) {
|
|
2080
|
+
code += `${slotTarget}: (current${levelIndex === 0 ? '' : levelIndex}) => [\n`;
|
|
2081
|
+
} else {
|
|
2082
|
+
code += `${slotTarget}: () => [\n`;
|
|
2083
|
+
}
|
|
2084
|
+
const levelIndexDelta = Number(hasScope);
|
|
2085
|
+
yield* wrapForEach(element.children, function* warpForEachGenerator(e) {
|
|
2086
|
+
code += yield* e.toEmbeddedTS(
|
|
2087
|
+
shiftState(state, code, {
|
|
2088
|
+
tabSize: state?.tabSize || 0,
|
|
2089
|
+
}),
|
|
2090
|
+
levelIndex + levelIndexDelta,
|
|
2091
|
+
);
|
|
2092
|
+
});
|
|
2093
|
+
code += indent((state?.tabSize || 0) + 2);
|
|
2094
|
+
code += '\n],\n';
|
|
2067
2095
|
} else {
|
|
2068
2096
|
defaultArr.push(element);
|
|
2069
2097
|
}
|
|
@@ -2071,8 +2099,8 @@ export class ViewElement extends BaseNode {
|
|
|
2071
2099
|
// 翻译其余的子元素
|
|
2072
2100
|
if (defaultArr.length) {
|
|
2073
2101
|
code += indent((state?.tabSize || 0) + 2);
|
|
2074
|
-
const hasScope = defaultArr.some(x=>x.haveScope());
|
|
2075
|
-
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` :
|
|
2102
|
+
const hasScope = defaultArr.some((x) => x.haveScope());
|
|
2103
|
+
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` : '';
|
|
2076
2104
|
const levelIndexDelta = Number(hasScope);
|
|
2077
2105
|
code += `slotDefault: (${param}) => [\n`;
|
|
2078
2106
|
yield* wrapForEach(defaultArr, function* warpForEachGenerator(element) {
|
|
@@ -2080,7 +2108,7 @@ export class ViewElement extends BaseNode {
|
|
|
2080
2108
|
shiftState(state, code, {
|
|
2081
2109
|
tabSize: (state?.tabSize || 0) + 2,
|
|
2082
2110
|
}),
|
|
2083
|
-
levelIndex + levelIndexDelta
|
|
2111
|
+
levelIndex + levelIndexDelta,
|
|
2084
2112
|
);
|
|
2085
2113
|
code += '\n';
|
|
2086
2114
|
});
|
|
@@ -2090,8 +2118,8 @@ export class ViewElement extends BaseNode {
|
|
|
2090
2118
|
}
|
|
2091
2119
|
} else if (children?.length) {
|
|
2092
2120
|
code += indent((state?.tabSize || 0) + 2);
|
|
2093
|
-
const hasScope = children.some(x=>x.haveScope());
|
|
2094
|
-
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` :
|
|
2121
|
+
const hasScope = children.some((x) => x.haveScope());
|
|
2122
|
+
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` : '';
|
|
2095
2123
|
const levelIndexDelta = Number(hasScope);
|
|
2096
2124
|
code += `slotDefault: (${param}) => [\n`;
|
|
2097
2125
|
yield* wrapForEach(children, function* warpForEachGenerator(element) {
|
|
@@ -2099,7 +2127,7 @@ export class ViewElement extends BaseNode {
|
|
|
2099
2127
|
shiftState(state, code, {
|
|
2100
2128
|
tabSize: (state?.tabSize || 0) + 2,
|
|
2101
2129
|
}),
|
|
2102
|
-
levelIndex + levelIndexDelta
|
|
2130
|
+
levelIndex + levelIndexDelta,
|
|
2103
2131
|
);
|
|
2104
2132
|
code += '\n';
|
|
2105
2133
|
});
|
|
@@ -2128,7 +2156,7 @@ export class ViewElement extends BaseNode {
|
|
|
2128
2156
|
code += attr.toNaturalTS(
|
|
2129
2157
|
shiftState(state, code, {
|
|
2130
2158
|
tabSize: state.tabSize + 1,
|
|
2131
|
-
})
|
|
2159
|
+
}),
|
|
2132
2160
|
);
|
|
2133
2161
|
code += ',\n';
|
|
2134
2162
|
});
|
|
@@ -2137,7 +2165,7 @@ export class ViewElement extends BaseNode {
|
|
|
2137
2165
|
code += event.toNaturalTS(
|
|
2138
2166
|
shiftState(state, code, {
|
|
2139
2167
|
tabSize: state.tabSize + 1,
|
|
2140
|
-
})
|
|
2168
|
+
}),
|
|
2141
2169
|
);
|
|
2142
2170
|
code += ',\n';
|
|
2143
2171
|
});
|
|
@@ -2148,7 +2176,7 @@ export class ViewElement extends BaseNode {
|
|
|
2148
2176
|
this.children.forEach((element) => {
|
|
2149
2177
|
if (element.tag === 'template') {
|
|
2150
2178
|
if (element.children.length) {
|
|
2151
|
-
code += `${indent(state.tabSize + 1)}slot${utils.firstUpperCase(element.slotTarget)}: (${
|
|
2179
|
+
code += `${indent(state.tabSize + 1)}slot${utils.firstUpperCase(element.slotTarget || '')}: (${
|
|
2152
2180
|
element.slotScope || ''
|
|
2153
2181
|
}) => [\n`;
|
|
2154
2182
|
|
|
@@ -2156,7 +2184,7 @@ export class ViewElement extends BaseNode {
|
|
|
2156
2184
|
code += element.toNaturalTS(
|
|
2157
2185
|
shiftState(state, code, {
|
|
2158
2186
|
tabSize: state.tabSize + 2,
|
|
2159
|
-
})
|
|
2187
|
+
}),
|
|
2160
2188
|
);
|
|
2161
2189
|
code += ',\n';
|
|
2162
2190
|
});
|
|
@@ -2176,7 +2204,7 @@ export class ViewElement extends BaseNode {
|
|
|
2176
2204
|
code += element.toNaturalTS(
|
|
2177
2205
|
shiftState(state, code, {
|
|
2178
2206
|
tabSize: state.tabSize + 2,
|
|
2179
|
-
})
|
|
2207
|
+
}),
|
|
2180
2208
|
);
|
|
2181
2209
|
code += ',\n';
|
|
2182
2210
|
});
|
|
@@ -2191,7 +2219,7 @@ export class ViewElement extends BaseNode {
|
|
|
2191
2219
|
code += element.toNaturalTS(
|
|
2192
2220
|
shiftState(state, code, {
|
|
2193
2221
|
tabSize: state.tabSize + 2,
|
|
2194
|
-
})
|
|
2222
|
+
}),
|
|
2195
2223
|
);
|
|
2196
2224
|
code += ',\n';
|
|
2197
2225
|
});
|
|
@@ -2216,7 +2244,7 @@ export class ViewElement extends BaseNode {
|
|
|
2216
2244
|
code += attr.toTextualNASL(
|
|
2217
2245
|
shiftState(state, code, {
|
|
2218
2246
|
tabSize: state.tabSize + 1,
|
|
2219
|
-
})
|
|
2247
|
+
}),
|
|
2220
2248
|
);
|
|
2221
2249
|
code += ',\n';
|
|
2222
2250
|
});
|
|
@@ -2225,7 +2253,7 @@ export class ViewElement extends BaseNode {
|
|
|
2225
2253
|
code += event.toTextualNASL(
|
|
2226
2254
|
shiftState(state, code, {
|
|
2227
2255
|
tabSize: state.tabSize + 1,
|
|
2228
|
-
})
|
|
2256
|
+
}),
|
|
2229
2257
|
);
|
|
2230
2258
|
code += ',\n';
|
|
2231
2259
|
});
|
|
@@ -2235,7 +2263,7 @@ export class ViewElement extends BaseNode {
|
|
|
2235
2263
|
// 先把插槽翻译了
|
|
2236
2264
|
this.children.forEach((element) => {
|
|
2237
2265
|
if (element.tag === 'template' && element.children.length) {
|
|
2238
|
-
code += `${indent(state.tabSize + 1)}slot${utils.firstUpperCase(element.slotTarget)} = { (${
|
|
2266
|
+
code += `${indent(state.tabSize + 1)}slot${utils.firstUpperCase(element.slotTarget || '')} = { (${
|
|
2239
2267
|
element.slotScope || ''
|
|
2240
2268
|
}) => [\n`;
|
|
2241
2269
|
|
|
@@ -2248,9 +2276,10 @@ export class ViewElement extends BaseNode {
|
|
|
2248
2276
|
code += element.toTextualNASL(
|
|
2249
2277
|
shiftState(state, code, {
|
|
2250
2278
|
tabSize: state.tabSize + 2,
|
|
2251
|
-
})
|
|
2279
|
+
}),
|
|
2252
2280
|
// levelIndex,
|
|
2253
2281
|
);
|
|
2282
|
+
code += ',\n';
|
|
2254
2283
|
});
|
|
2255
2284
|
|
|
2256
2285
|
code += `${indent(state.tabSize + 1)}] },\n`;
|
|
@@ -2260,15 +2289,16 @@ export class ViewElement extends BaseNode {
|
|
|
2260
2289
|
});
|
|
2261
2290
|
// 翻译其余的子集
|
|
2262
2291
|
if (defaultArr.length) {
|
|
2263
|
-
throw new Error('多个插槽必须都在 template 内');
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2292
|
+
// throw new Error('多个插槽必须都在 template 内');
|
|
2293
|
+
defaultArr.forEach((element) => {
|
|
2294
|
+
code += element.toTextualNASL(
|
|
2295
|
+
shiftState(state, code, {
|
|
2296
|
+
tabSize: state.tabSize,
|
|
2297
|
+
}),
|
|
2298
|
+
// levelIndex,
|
|
2299
|
+
);
|
|
2300
|
+
code += ',\n';
|
|
2301
|
+
});
|
|
2272
2302
|
}
|
|
2273
2303
|
} else {
|
|
2274
2304
|
if (this.children.length) {
|
|
@@ -2278,7 +2308,7 @@ export class ViewElement extends BaseNode {
|
|
|
2278
2308
|
code += element.toTextualNASL(
|
|
2279
2309
|
shiftState(state, code, {
|
|
2280
2310
|
tabSize: state.tabSize + 2,
|
|
2281
|
-
})
|
|
2311
|
+
}),
|
|
2282
2312
|
// levelIndex,
|
|
2283
2313
|
);
|
|
2284
2314
|
code += ',\n';
|
|
@@ -2337,7 +2367,7 @@ export class ViewElement extends BaseNode {
|
|
|
2337
2367
|
}
|
|
2338
2368
|
},
|
|
2339
2369
|
{ node: element },
|
|
2340
|
-
{ mode: 'anyObject', excludedKeySet: element.JSON_EXCLUDED_KEYS }
|
|
2370
|
+
{ mode: 'anyObject', excludedKeySet: element.JSON_EXCLUDED_KEYS },
|
|
2341
2371
|
);
|
|
2342
2372
|
|
|
2343
2373
|
this.likeComponent?.existingViewElement.clear();
|
|
@@ -2359,7 +2389,7 @@ export class ViewElement extends BaseNode {
|
|
|
2359
2389
|
(current) => {
|
|
2360
2390
|
cb(current.node);
|
|
2361
2391
|
},
|
|
2362
|
-
{ node: this }
|
|
2392
|
+
{ node: this },
|
|
2363
2393
|
);
|
|
2364
2394
|
}
|
|
2365
2395
|
|
|
@@ -2398,7 +2428,10 @@ export class ViewElement extends BaseNode {
|
|
|
2398
2428
|
const ast = babelParser.parseExpression(value) as any;
|
|
2399
2429
|
const validationNamespace = getStdlibNamespace().findChild('validation');
|
|
2400
2430
|
if (ast.type === 'CallExpression') {
|
|
2401
|
-
calleeName = (ast.callee?.property?.name ?? ast.callee?.property?.value ?? ast.callee?.name).replace(
|
|
2431
|
+
calleeName = (ast.callee?.property?.name ?? ast.callee?.property?.value ?? ast.callee?.name).replace(
|
|
2432
|
+
/\(.*/,
|
|
2433
|
+
'',
|
|
2434
|
+
);
|
|
2402
2435
|
const func = validationNamespace.functions.find((item) => item.name === calleeName);
|
|
2403
2436
|
args = ast.arguments.map((argument: any, index: number) => ({
|
|
2404
2437
|
concept: 'Argument',
|
|
@@ -2430,9 +2463,18 @@ export class ViewElement extends BaseNode {
|
|
|
2430
2463
|
// 临时处理组件的 text
|
|
2431
2464
|
//h5-mock
|
|
2432
2465
|
if (
|
|
2433
|
-
[
|
|
2434
|
-
|
|
2435
|
-
|
|
2466
|
+
[
|
|
2467
|
+
'u-text',
|
|
2468
|
+
'van-text',
|
|
2469
|
+
'u-link',
|
|
2470
|
+
'u-button',
|
|
2471
|
+
'u-label',
|
|
2472
|
+
'u-radio',
|
|
2473
|
+
'u-checkbox',
|
|
2474
|
+
'u-navbar-item',
|
|
2475
|
+
'u-sidebar-item',
|
|
2476
|
+
'u-menu-item',
|
|
2477
|
+
].includes(astNode.tag) &&
|
|
2436
2478
|
astNode.children.length === 1 &&
|
|
2437
2479
|
astNode.children[0].type === 3
|
|
2438
2480
|
) {
|
|
@@ -2497,7 +2539,9 @@ export class ViewElement extends BaseNode {
|
|
|
2497
2539
|
staticStyle: astNode.attrsMap.style,
|
|
2498
2540
|
slotTarget: astNode.slotTarget && json5.parse(astNode.slotTarget),
|
|
2499
2541
|
slotScope: astNode.slotScope === '_empty_' ? '' : astNode.slotScope,
|
|
2500
|
-
children: astNode.children.map((item) =>
|
|
2542
|
+
children: astNode.children.map((item) =>
|
|
2543
|
+
this._fromASTNode(item as compiler.ASTElement, newContext),
|
|
2544
|
+
) as unknown as Array<ViewElement>,
|
|
2501
2545
|
});
|
|
2502
2546
|
const attrName2Camel = (name: string) => {
|
|
2503
2547
|
if (name.startsWith('vusion-')) return name;
|
|
@@ -2506,7 +2550,10 @@ export class ViewElement extends BaseNode {
|
|
|
2506
2550
|
astNode?.attrs?.forEach((oldAttr) => {
|
|
2507
2551
|
let attr: BindAttribute;
|
|
2508
2552
|
// 获取原始属性
|
|
2509
|
-
const orginAttrCode = (context?.code || '').substr(
|
|
2553
|
+
const orginAttrCode = (context?.code || '').substr(
|
|
2554
|
+
(oldAttr as any).start,
|
|
2555
|
+
(oldAttr as any).end - (oldAttr as any).start,
|
|
2556
|
+
);
|
|
2510
2557
|
if (oldAttr.value === '""' && orginAttrCode.trim() === oldAttr.name) {
|
|
2511
2558
|
attr = new BindAttribute({
|
|
2512
2559
|
type: 'static',
|
|
@@ -2588,7 +2635,7 @@ export class ViewElement extends BaseNode {
|
|
|
2588
2635
|
calleeName: '',
|
|
2589
2636
|
arguments: args,
|
|
2590
2637
|
logics: [currentLogic],
|
|
2591
|
-
})
|
|
2638
|
+
}),
|
|
2592
2639
|
);
|
|
2593
2640
|
}
|
|
2594
2641
|
});
|
|
@@ -2606,7 +2653,7 @@ export class ViewElement extends BaseNode {
|
|
|
2606
2653
|
value: expression ? '' : directive.value,
|
|
2607
2654
|
expression,
|
|
2608
2655
|
sync: true,
|
|
2609
|
-
})
|
|
2656
|
+
}),
|
|
2610
2657
|
);
|
|
2611
2658
|
}
|
|
2612
2659
|
} else {
|
|
@@ -2620,7 +2667,7 @@ export class ViewElement extends BaseNode {
|
|
|
2620
2667
|
expression,
|
|
2621
2668
|
arg: directive.arg,
|
|
2622
2669
|
// modifiers: directive.modifiers,
|
|
2623
|
-
})
|
|
2670
|
+
}),
|
|
2624
2671
|
);
|
|
2625
2672
|
}
|
|
2626
2673
|
});
|
|
@@ -2633,7 +2680,7 @@ export class ViewElement extends BaseNode {
|
|
|
2633
2680
|
rawName: 'v-if',
|
|
2634
2681
|
value: '',
|
|
2635
2682
|
expression: <any>this._parseExpression(astNode.if),
|
|
2636
|
-
})
|
|
2683
|
+
}),
|
|
2637
2684
|
);
|
|
2638
2685
|
}
|
|
2639
2686
|
} else if (astNode.type === 2) {
|
|
@@ -2651,7 +2698,7 @@ export class ViewElement extends BaseNode {
|
|
|
2651
2698
|
name: 'text',
|
|
2652
2699
|
value: expression ? '' : value,
|
|
2653
2700
|
expression,
|
|
2654
|
-
})
|
|
2701
|
+
}),
|
|
2655
2702
|
);
|
|
2656
2703
|
} else if (astNode.type === 3) {
|
|
2657
2704
|
const tagName = config.scope === 'h5' ? 'van-text' : 'u-text';
|
|
@@ -2665,7 +2712,7 @@ export class ViewElement extends BaseNode {
|
|
|
2665
2712
|
name: 'text',
|
|
2666
2713
|
type: 'string',
|
|
2667
2714
|
value: astNode.text?.trim(),
|
|
2668
|
-
})
|
|
2715
|
+
}),
|
|
2669
2716
|
);
|
|
2670
2717
|
}
|
|
2671
2718
|
return element;
|
|
@@ -2711,7 +2758,10 @@ export class ViewElement extends BaseNode {
|
|
|
2711
2758
|
finalCode: false,
|
|
2712
2759
|
nodePathAttr: true,
|
|
2713
2760
|
attrFormat: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) => {
|
|
2714
|
-
if (
|
|
2761
|
+
if (
|
|
2762
|
+
attr.concept === 'BindAttribute' &&
|
|
2763
|
+
!['href', 'destination', 'externalDestination', 'download'].includes(attr.name)
|
|
2764
|
+
) {
|
|
2715
2765
|
const api = config?.allNodesAPI?.[element.tag];
|
|
2716
2766
|
const apiOfAttr = api && api.props && api.props.find((_attr) => _attr.name === attr.name);
|
|
2717
2767
|
if (['u-form-item', 'u-validator', 'van-field'].includes(element.tag) && attr.name === 'rules') {
|
|
@@ -2744,7 +2794,10 @@ export class ViewElement extends BaseNode {
|
|
|
2744
2794
|
) {
|
|
2745
2795
|
return `${attr.name}="{{ ${attr.expression.toUI()} }}"`;
|
|
2746
2796
|
}
|
|
2747
|
-
if (
|
|
2797
|
+
if (
|
|
2798
|
+
(attr as BindAttribute).type === 'dynamic' &&
|
|
2799
|
+
!(element.tag === 'u-cascade-select' && attr.name === 'categories')
|
|
2800
|
+
)
|
|
2748
2801
|
return defaultResult.replace(/:?([\w-]+)(?:.*?)="([\s\S]*)"/, (m, name, value) => {
|
|
2749
2802
|
try {
|
|
2750
2803
|
const tempValue = json5.parse(value);
|
|
@@ -2778,11 +2831,14 @@ export class ViewElement extends BaseNode {
|
|
|
2778
2831
|
const parts = [];
|
|
2779
2832
|
|
|
2780
2833
|
const api = config?.allNodesAPI?.[el?.tag];
|
|
2781
|
-
const emptySlot =
|
|
2834
|
+
const emptySlot =
|
|
2835
|
+
api && api.slots && api.slots.find((slot) => slot.name === 'default' && slot['emptyBackground']);
|
|
2782
2836
|
const hasSupport = api && api.slots && api.slots.some((slot) => slot.support);
|
|
2783
2837
|
if (emptySlot || hasSupport) {
|
|
2784
2838
|
// 有些限制的组件如侧边栏分组有title插槽但要限制子元素放入
|
|
2785
|
-
const validChildren = el.children.filter(
|
|
2839
|
+
const validChildren = el.children.filter(
|
|
2840
|
+
(elem) => !(elem.tag === 'template' && elem.slotTarget !== 'default'),
|
|
2841
|
+
);
|
|
2786
2842
|
let childEmpty = !validChildren.length;
|
|
2787
2843
|
const defaultSlot = el.children.find((elem) => elem.tag === 'template' && elem.slotTarget === 'default');
|
|
2788
2844
|
if (defaultSlot) {
|
|
@@ -2930,7 +2986,8 @@ export class ViewElement extends BaseNode {
|
|
|
2930
2986
|
aslIdAttr: false,
|
|
2931
2987
|
nodePathAttr: false,
|
|
2932
2988
|
getExtraParts: () => [],
|
|
2933
|
-
attrFormat: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) =>
|
|
2989
|
+
attrFormat: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) =>
|
|
2990
|
+
defaultResult,
|
|
2934
2991
|
bindStylesFormat: (bindStyles: BindStyle[], element?: ViewElement) => {
|
|
2935
2992
|
if (bindStyles.length === 0) return false;
|
|
2936
2993
|
|
|
@@ -2943,7 +3000,7 @@ export class ViewElement extends BaseNode {
|
|
|
2943
3000
|
options,
|
|
2944
3001
|
{
|
|
2945
3002
|
currentList,
|
|
2946
|
-
}
|
|
3003
|
+
},
|
|
2947
3004
|
);
|
|
2948
3005
|
const tabString = ' '.repeat(newOptions.tabSize * newOptions.indentLevel);
|
|
2949
3006
|
const insideTabString = ' '.repeat(newOptions.tabSize * (newOptions.indentLevel + 1));
|
|
@@ -2980,27 +3037,30 @@ export class ViewElement extends BaseNode {
|
|
|
2980
3037
|
this.staticClass && parts.push(`class="${this.staticClass}"`);
|
|
2981
3038
|
|
|
2982
3039
|
const vIfs: string[] = [];
|
|
2983
|
-
[]
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3040
|
+
[]
|
|
3041
|
+
.concat(this.bindAttrs, this.bindDirectives, this.bindEvents)
|
|
3042
|
+
.forEach((attr: BindAttribute | BindDirective | BindEvent) => {
|
|
3043
|
+
let result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
|
|
3044
|
+
if (
|
|
3045
|
+
options?.isExport &&
|
|
3046
|
+
attr?.concept === 'BindAttribute' &&
|
|
3047
|
+
attr?.name === 'src' &&
|
|
3048
|
+
/^\/assets\/(.*?)$/.test(attr?.value) &&
|
|
3049
|
+
// && attr.value.includes('/assets/')
|
|
3050
|
+
this.app?.sysPrefixPath?.length > 0
|
|
3051
|
+
) {
|
|
3052
|
+
result = (result as string)?.replace('/assets/', `${this.app?.sysPrefixPath}/assets/`);
|
|
3053
|
+
}
|
|
2994
3054
|
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3055
|
+
// v-auth v-if 都翻译成 v-if
|
|
3056
|
+
if (asserts.isBindDirective(attr) && ['if', 'auth'].includes(attr.name) && result !== false) {
|
|
3057
|
+
const expr = result.replace(/v-(if|auth)="(.*)"/, (match, p1, p2) => p2);
|
|
3058
|
+
if (expr) vIfs.push(attr.name === 'if' ? expr : `$auth.has(${expr})`);
|
|
2999
3059
|
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
result && parts.push(result);
|
|
3063
|
+
});
|
|
3004
3064
|
|
|
3005
3065
|
if (vIfs.length === 2) parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
|
|
3006
3066
|
else if (vIfs.length === 1) parts.push(`v-if="${vIfs[0]}"`);
|
|
@@ -3018,7 +3078,10 @@ export class ViewElement extends BaseNode {
|
|
|
3018
3078
|
});
|
|
3019
3079
|
}
|
|
3020
3080
|
// 部分组件增加 key 唯一标识,防止 vue 判断重复节点,导致渲染异常
|
|
3021
|
-
if (
|
|
3081
|
+
if (
|
|
3082
|
+
this.name &&
|
|
3083
|
+
['u-table-view', 'u-list-view', 'u-grid-view', 'u-list-components', 'u-form', 'u-select'].includes(this.tag)
|
|
3084
|
+
) {
|
|
3022
3085
|
this.name && parts.push(`key="${this.name}"`);
|
|
3023
3086
|
}
|
|
3024
3087
|
let tag = this.tag;
|
|
@@ -3066,8 +3129,8 @@ export class ViewElement extends BaseNode {
|
|
|
3066
3129
|
color: var(--font-second-color);
|
|
3067
3130
|
text-align: center;`;
|
|
3068
3131
|
}
|
|
3069
|
-
if(options?.isExport && staticStyle?.includes(`url('/assets/`) && this.app.sysPrefixPath?.length > 0
|
|
3070
|
-
staticStyle = staticStyle.replace(/url\('\/assets\/(.*?)'\)/, `url('${this.app.sysPrefixPath}/assets/$1')`)
|
|
3132
|
+
if (options?.isExport && staticStyle?.includes(`url('/assets/`) && this.app.sysPrefixPath?.length > 0) {
|
|
3133
|
+
staticStyle = staticStyle.replace(/url\('\/assets\/(.*?)'\)/, `url('${this.app.sysPrefixPath}/assets/$1')`);
|
|
3071
3134
|
}
|
|
3072
3135
|
staticStyle && parts.push(`style="${staticStyle}"`);
|
|
3073
3136
|
if (!content.length) {
|
|
@@ -3084,7 +3147,11 @@ export class ViewElement extends BaseNode {
|
|
|
3084
3147
|
partsLength += part.length;
|
|
3085
3148
|
});
|
|
3086
3149
|
|
|
3087
|
-
let htmlContent =
|
|
3150
|
+
let htmlContent =
|
|
3151
|
+
`<${tag}${partsString.length ? partsString : ''}>` +
|
|
3152
|
+
content +
|
|
3153
|
+
(shouldIndent ? '\n' + tabString : '') +
|
|
3154
|
+
`</${tag}>`;
|
|
3088
3155
|
if (!content.trim() && selfClosingTag.includes(tag)) {
|
|
3089
3156
|
htmlContent = `<${tag}${partsString.length ? partsString : ''} />`;
|
|
3090
3157
|
}
|
|
@@ -3110,7 +3177,7 @@ export class ViewElement extends BaseNode {
|
|
|
3110
3177
|
(current) => {
|
|
3111
3178
|
if (current.node.name === name) return current.node;
|
|
3112
3179
|
},
|
|
3113
|
-
{ node: this }
|
|
3180
|
+
{ node: this },
|
|
3114
3181
|
);
|
|
3115
3182
|
}
|
|
3116
3183
|
|
|
@@ -3119,7 +3186,7 @@ export class ViewElement extends BaseNode {
|
|
|
3119
3186
|
(current) => {
|
|
3120
3187
|
if (current.node.tag === tag) return current.node;
|
|
3121
3188
|
},
|
|
3122
|
-
{ node: this }
|
|
3189
|
+
{ node: this },
|
|
3123
3190
|
);
|
|
3124
3191
|
}
|
|
3125
3192
|
|
|
@@ -3128,7 +3195,7 @@ export class ViewElement extends BaseNode {
|
|
|
3128
3195
|
(current) => {
|
|
3129
3196
|
if (current.node.bindAttrs.some((attr) => attr.name === name && attr.value === value)) return current.node;
|
|
3130
3197
|
},
|
|
3131
|
-
{ node: this }
|
|
3198
|
+
{ node: this },
|
|
3132
3199
|
);
|
|
3133
3200
|
}
|
|
3134
3201
|
// 查找element下有没有某个类型的元素,有就返回
|
|
@@ -3178,7 +3245,7 @@ export class ViewElement extends BaseNode {
|
|
|
3178
3245
|
ops: {
|
|
3179
3246
|
beforeSetStyleCb?: (newStyleObj: Record<string, any>) => void;
|
|
3180
3247
|
isUpdateConstraintRule?: boolean;
|
|
3181
|
-
} = {}
|
|
3248
|
+
} = {},
|
|
3182
3249
|
) {
|
|
3183
3250
|
if (!positionData) {
|
|
3184
3251
|
return;
|
|
@@ -3188,8 +3255,12 @@ export class ViewElement extends BaseNode {
|
|
|
3188
3255
|
const staticHeight = Math.round(nodeRect.height);
|
|
3189
3256
|
const staticLeft = Math.round(nodeRect.left - parentRect.left - parentBorder.left);
|
|
3190
3257
|
const staticTop = Math.round(nodeRect.top - parentRect.top - parentBorder.top);
|
|
3191
|
-
const staticRight = Math.round(
|
|
3192
|
-
|
|
3258
|
+
const staticRight = Math.round(
|
|
3259
|
+
parentRect.width - nodeRect.width - staticLeft - parentBorder.right - parentBorder.left,
|
|
3260
|
+
);
|
|
3261
|
+
const staticBottom = Math.round(
|
|
3262
|
+
parentRect.height - nodeRect.height - staticTop - parentBorder.bottom - parentBorder.top,
|
|
3263
|
+
);
|
|
3193
3264
|
const styleObj = this.parseStyleToObject(this.staticStyle);
|
|
3194
3265
|
let constraintX = styleObj['--constraint-x'] || 'left';
|
|
3195
3266
|
let constraintY = styleObj['--constraint-y'] || 'top';
|
|
@@ -3291,7 +3362,7 @@ export class ViewElement extends BaseNode {
|
|
|
3291
3362
|
this.stringifyStyleAttr({
|
|
3292
3363
|
...this.parseStyleToObject(this.staticStyle),
|
|
3293
3364
|
...styleObj,
|
|
3294
|
-
})
|
|
3365
|
+
}),
|
|
3295
3366
|
);
|
|
3296
3367
|
}
|
|
3297
3368
|
parseStyleToObject(styleStr: string = '') {
|
|
@@ -3337,7 +3408,11 @@ export class ViewElement extends BaseNode {
|
|
|
3337
3408
|
* 是否是流程表单
|
|
3338
3409
|
*/
|
|
3339
3410
|
isProcessForm() {
|
|
3340
|
-
return
|
|
3411
|
+
return (
|
|
3412
|
+
this.tag.endsWith('-form') &&
|
|
3413
|
+
this.getBindAttribute('id')?.value === 'dynamicRenderContainer' &&
|
|
3414
|
+
this.getBindAttribute('processPrefix')
|
|
3415
|
+
);
|
|
3341
3416
|
}
|
|
3342
3417
|
//================================================================================
|
|
3343
3418
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|