@lcap/nasl-concepts 3.9.0-beta.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/README.md +3 -0
- package/out/breakpoint/index.d.ts +2 -0
- package/out/breakpoint/index.d.ts.map +1 -0
- package/out/breakpoint/index.js +18 -0
- package/out/breakpoint/index.js.map +1 -0
- package/out/breakpoint/operation.d.ts +11 -0
- package/out/breakpoint/operation.d.ts.map +1 -0
- package/out/breakpoint/operation.js +24 -0
- package/out/breakpoint/operation.js.map +1 -0
- package/out/common/BaseNode.d.ts +427 -0
- package/out/common/BaseNode.d.ts.map +1 -0
- package/out/common/BaseNode.js +1721 -0
- package/out/common/BaseNode.js.map +1 -0
- package/out/common/EventEmitter.d.ts +30 -0
- package/out/common/EventEmitter.d.ts.map +1 -0
- package/out/common/EventEmitter.js +70 -0
- package/out/common/EventEmitter.js.map +1 -0
- package/out/common/index.d.ts +3 -0
- package/out/common/index.d.ts.map +1 -0
- package/out/common/index.js +19 -0
- package/out/common/index.js.map +1 -0
- package/out/common/types.d.ts +5 -0
- package/out/common/types.d.ts.map +1 -0
- package/out/common/types.js +3 -0
- package/out/common/types.js.map +1 -0
- package/out/concepts/Abort__.d.ts +32 -0
- package/out/concepts/Abort__.d.ts.map +1 -0
- package/out/concepts/Abort__.js +94 -0
- package/out/concepts/Abort__.js.map +1 -0
- package/out/concepts/AbstractInterface__.d.ts +29 -0
- package/out/concepts/AbstractInterface__.d.ts.map +1 -0
- package/out/concepts/AbstractInterface__.js +62 -0
- package/out/concepts/AbstractInterface__.js.map +1 -0
- package/out/concepts/Anchor__.d.ts +44 -0
- package/out/concepts/Anchor__.d.ts.map +1 -0
- package/out/concepts/Anchor__.js +179 -0
- package/out/concepts/Anchor__.js.map +1 -0
- package/out/concepts/Annotatable__.d.ts +111 -0
- package/out/concepts/Annotatable__.d.ts.map +1 -0
- package/out/concepts/Annotatable__.js +163 -0
- package/out/concepts/Annotatable__.js.map +1 -0
- package/out/concepts/AnnotationProperty__.d.ts +49 -0
- package/out/concepts/AnnotationProperty__.d.ts.map +1 -0
- package/out/concepts/AnnotationProperty__.js +76 -0
- package/out/concepts/AnnotationProperty__.js.map +1 -0
- package/out/concepts/Annotation__.d.ts +129 -0
- package/out/concepts/Annotation__.d.ts.map +1 -0
- package/out/concepts/Annotation__.js +249 -0
- package/out/concepts/Annotation__.js.map +1 -0
- package/out/concepts/AnonymousFunction__.d.ts +141 -0
- package/out/concepts/AnonymousFunction__.d.ts.map +1 -0
- package/out/concepts/AnonymousFunction__.js +428 -0
- package/out/concepts/AnonymousFunction__.js.map +1 -0
- package/out/concepts/App__.d.ts +1794 -0
- package/out/concepts/App__.d.ts.map +1 -0
- package/out/concepts/App__.js +3475 -0
- package/out/concepts/App__.js.map +1 -0
- package/out/concepts/ApplyAnnotation__.d.ts +88 -0
- package/out/concepts/ApplyAnnotation__.d.ts.map +1 -0
- package/out/concepts/ApplyAnnotation__.js +142 -0
- package/out/concepts/ApplyAnnotation__.js.map +1 -0
- package/out/concepts/ApprovalPolicyV2__.d.ts +27 -0
- package/out/concepts/ApprovalPolicyV2__.d.ts.map +1 -0
- package/out/concepts/ApprovalPolicyV2__.js +55 -0
- package/out/concepts/ApprovalPolicyV2__.js.map +1 -0
- package/out/concepts/Argument__.d.ts +85 -0
- package/out/concepts/Argument__.d.ts.map +1 -0
- package/out/concepts/Argument__.js +390 -0
- package/out/concepts/Argument__.js.map +1 -0
- package/out/concepts/AssigneeV2__.d.ts +380 -0
- package/out/concepts/AssigneeV2__.d.ts.map +1 -0
- package/out/concepts/AssigneeV2__.js +517 -0
- package/out/concepts/AssigneeV2__.js.map +1 -0
- package/out/concepts/Assignee__.d.ts +296 -0
- package/out/concepts/Assignee__.d.ts.map +1 -0
- package/out/concepts/Assignee__.js +404 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/AssignmentLine__.d.ts +44 -0
- package/out/concepts/AssignmentLine__.d.ts.map +1 -0
- package/out/concepts/AssignmentLine__.js +110 -0
- package/out/concepts/AssignmentLine__.js.map +1 -0
- package/out/concepts/Assignment__.d.ts +59 -0
- package/out/concepts/Assignment__.d.ts.map +1 -0
- package/out/concepts/Assignment__.js +288 -0
- package/out/concepts/Assignment__.js.map +1 -0
- package/out/concepts/Attribute__.d.ts +77 -0
- package/out/concepts/Attribute__.d.ts.map +1 -0
- package/out/concepts/Attribute__.js +103 -0
- package/out/concepts/Attribute__.js.map +1 -0
- package/out/concepts/AuthInterface__.d.ts +39 -0
- package/out/concepts/AuthInterface__.d.ts.map +1 -0
- package/out/concepts/AuthInterface__.js +79 -0
- package/out/concepts/AuthInterface__.js.map +1 -0
- package/out/concepts/AuthLogicForCallInterface__.d.ts +148 -0
- package/out/concepts/AuthLogicForCallInterface__.d.ts.map +1 -0
- package/out/concepts/AuthLogicForCallInterface__.js +597 -0
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -0
- package/out/concepts/AuthLogic__.d.ts +70 -0
- package/out/concepts/AuthLogic__.d.ts.map +1 -0
- package/out/concepts/AuthLogic__.js +211 -0
- package/out/concepts/AuthLogic__.js.map +1 -0
- package/out/concepts/BackendVariable__.d.ts +120 -0
- package/out/concepts/BackendVariable__.d.ts.map +1 -0
- package/out/concepts/BackendVariable__.js +432 -0
- package/out/concepts/BackendVariable__.js.map +1 -0
- package/out/concepts/Backend__.d.ts +128 -0
- package/out/concepts/Backend__.d.ts.map +1 -0
- package/out/concepts/Backend__.js +238 -0
- package/out/concepts/Backend__.js.map +1 -0
- package/out/concepts/BaseSetter__.d.ts +27 -0
- package/out/concepts/BaseSetter__.d.ts.map +1 -0
- package/out/concepts/BaseSetter__.js +55 -0
- package/out/concepts/BaseSetter__.js.map +1 -0
- package/out/concepts/BatchAssignment__.d.ts +246 -0
- package/out/concepts/BatchAssignment__.d.ts.map +1 -0
- package/out/concepts/BatchAssignment__.js +831 -0
- package/out/concepts/BatchAssignment__.js.map +1 -0
- package/out/concepts/BinaryExpression__.d.ts +64 -0
- package/out/concepts/BinaryExpression__.d.ts.map +1 -0
- package/out/concepts/BinaryExpression__.js +508 -0
- package/out/concepts/BinaryExpression__.js.map +1 -0
- package/out/concepts/BindAttribute__.d.ts +294 -0
- package/out/concepts/BindAttribute__.d.ts.map +1 -0
- package/out/concepts/BindAttribute__.js +1023 -0
- package/out/concepts/BindAttribute__.js.map +1 -0
- package/out/concepts/BindDirective__.d.ts +157 -0
- package/out/concepts/BindDirective__.d.ts.map +1 -0
- package/out/concepts/BindDirective__.js +492 -0
- package/out/concepts/BindDirective__.js.map +1 -0
- package/out/concepts/BindEvent__.d.ts +247 -0
- package/out/concepts/BindEvent__.d.ts.map +1 -0
- package/out/concepts/BindEvent__.js +833 -0
- package/out/concepts/BindEvent__.js.map +1 -0
- package/out/concepts/BindStyle__.d.ts +128 -0
- package/out/concepts/BindStyle__.d.ts.map +1 -0
- package/out/concepts/BindStyle__.js +412 -0
- package/out/concepts/BindStyle__.js.map +1 -0
- package/out/concepts/Block__.d.ts +90 -0
- package/out/concepts/Block__.d.ts.map +1 -0
- package/out/concepts/Block__.js +204 -0
- package/out/concepts/Block__.js.map +1 -0
- package/out/concepts/BooleanLiteral__.d.ts +46 -0
- package/out/concepts/BooleanLiteral__.d.ts.map +1 -0
- package/out/concepts/BooleanLiteral__.js +119 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -0
- package/out/concepts/BusinessComponent__.d.ts +648 -0
- package/out/concepts/BusinessComponent__.d.ts.map +1 -0
- package/out/concepts/BusinessComponent__.js +1785 -0
- package/out/concepts/BusinessComponent__.js.map +1 -0
- package/out/concepts/BusinessLogic__.d.ts +46 -0
- package/out/concepts/BusinessLogic__.d.ts.map +1 -0
- package/out/concepts/BusinessLogic__.js +485 -0
- package/out/concepts/BusinessLogic__.js.map +1 -0
- package/out/concepts/CallAuthInterface__.d.ts +134 -0
- package/out/concepts/CallAuthInterface__.d.ts.map +1 -0
- package/out/concepts/CallAuthInterface__.js +426 -0
- package/out/concepts/CallAuthInterface__.js.map +1 -0
- package/out/concepts/CallConnector__.d.ts +56 -0
- package/out/concepts/CallConnector__.d.ts.map +1 -0
- package/out/concepts/CallConnector__.js +296 -0
- package/out/concepts/CallConnector__.js.map +1 -0
- package/out/concepts/CallEvent__.d.ts +103 -0
- package/out/concepts/CallEvent__.d.ts.map +1 -0
- package/out/concepts/CallEvent__.js +326 -0
- package/out/concepts/CallEvent__.js.map +1 -0
- package/out/concepts/CallFunction__.d.ts +173 -0
- package/out/concepts/CallFunction__.d.ts.map +1 -0
- package/out/concepts/CallFunction__.js +679 -0
- package/out/concepts/CallFunction__.js.map +1 -0
- package/out/concepts/CallInterface__.d.ts +145 -0
- package/out/concepts/CallInterface__.d.ts.map +1 -0
- package/out/concepts/CallInterface__.js +882 -0
- package/out/concepts/CallInterface__.js.map +1 -0
- package/out/concepts/CallLogic__.d.ts +247 -0
- package/out/concepts/CallLogic__.d.ts.map +1 -0
- package/out/concepts/CallLogic__.js +1583 -0
- package/out/concepts/CallLogic__.js.map +1 -0
- package/out/concepts/CallQueryComponent__.d.ts +380 -0
- package/out/concepts/CallQueryComponent__.d.ts.map +1 -0
- package/out/concepts/CallQueryComponent__.js +1227 -0
- package/out/concepts/CallQueryComponent__.js.map +1 -0
- package/out/concepts/CapsulesSetter__.d.ts +114 -0
- package/out/concepts/CapsulesSetter__.d.ts.map +1 -0
- package/out/concepts/CapsulesSetter__.js +172 -0
- package/out/concepts/CapsulesSetter__.js.map +1 -0
- package/out/concepts/Comment__.d.ts +42 -0
- package/out/concepts/Comment__.d.ts.map +1 -0
- package/out/concepts/Comment__.js +107 -0
- package/out/concepts/Comment__.js.map +1 -0
- package/out/concepts/CompletionProperty__.d.ts +88 -0
- package/out/concepts/CompletionProperty__.d.ts.map +1 -0
- package/out/concepts/CompletionProperty__.js +175 -0
- package/out/concepts/CompletionProperty__.js.map +1 -0
- package/out/concepts/ConfigGroup__.d.ts +122 -0
- package/out/concepts/ConfigGroup__.d.ts.map +1 -0
- package/out/concepts/ConfigGroup__.js +228 -0
- package/out/concepts/ConfigGroup__.js.map +1 -0
- package/out/concepts/ConfigPropertyValue__.d.ts +42 -0
- package/out/concepts/ConfigPropertyValue__.d.ts.map +1 -0
- package/out/concepts/ConfigPropertyValue__.js +83 -0
- package/out/concepts/ConfigPropertyValue__.js.map +1 -0
- package/out/concepts/ConfigProperty__.d.ts +148 -0
- package/out/concepts/ConfigProperty__.d.ts.map +1 -0
- package/out/concepts/ConfigProperty__.js +294 -0
- package/out/concepts/ConfigProperty__.js.map +1 -0
- package/out/concepts/Configuration__.d.ts +121 -0
- package/out/concepts/Configuration__.d.ts.map +1 -0
- package/out/concepts/Configuration__.js +202 -0
- package/out/concepts/Configuration__.js.map +1 -0
- package/out/concepts/Connection__.d.ts +165 -0
- package/out/concepts/Connection__.d.ts.map +1 -0
- package/out/concepts/Connection__.js +330 -0
- package/out/concepts/Connection__.js.map +1 -0
- package/out/concepts/ConnectorLogic__.d.ts +34 -0
- package/out/concepts/ConnectorLogic__.d.ts.map +1 -0
- package/out/concepts/ConnectorLogic__.js +69 -0
- package/out/concepts/ConnectorLogic__.js.map +1 -0
- package/out/concepts/ConnectorTriggerLauncher__.d.ts +45 -0
- package/out/concepts/ConnectorTriggerLauncher__.d.ts.map +1 -0
- package/out/concepts/ConnectorTriggerLauncher__.js +98 -0
- package/out/concepts/ConnectorTriggerLauncher__.js.map +1 -0
- package/out/concepts/ConnectorTrigger__.d.ts +94 -0
- package/out/concepts/ConnectorTrigger__.d.ts.map +1 -0
- package/out/concepts/ConnectorTrigger__.js +339 -0
- package/out/concepts/ConnectorTrigger__.js.map +1 -0
- package/out/concepts/Connector__.d.ts +533 -0
- package/out/concepts/Connector__.d.ts.map +1 -0
- package/out/concepts/Connector__.js +670 -0
- package/out/concepts/Connector__.js.map +1 -0
- package/out/concepts/Constant__.d.ts +95 -0
- package/out/concepts/Constant__.d.ts.map +1 -0
- package/out/concepts/Constant__.js +243 -0
- package/out/concepts/Constant__.js.map +1 -0
- package/out/concepts/CountersignPolicyV2__.d.ts +30 -0
- package/out/concepts/CountersignPolicyV2__.d.ts.map +1 -0
- package/out/concepts/CountersignPolicyV2__.js +58 -0
- package/out/concepts/CountersignPolicyV2__.js.map +1 -0
- package/out/concepts/CountersignPolicy__.d.ts +30 -0
- package/out/concepts/CountersignPolicy__.d.ts.map +1 -0
- package/out/concepts/CountersignPolicy__.js +58 -0
- package/out/concepts/CountersignPolicy__.js.map +1 -0
- package/out/concepts/DataSource__.d.ts +166 -0
- package/out/concepts/DataSource__.d.ts.map +1 -0
- package/out/concepts/DataSource__.js +516 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +36 -0
- package/out/concepts/DatabaseTypeAnnotation__.d.ts.map +1 -0
- package/out/concepts/DatabaseTypeAnnotation__.js +81 -0
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
- package/out/concepts/DefaultValue__.d.ts +96 -0
- package/out/concepts/DefaultValue__.d.ts.map +1 -0
- package/out/concepts/DefaultValue__.js +212 -0
- package/out/concepts/DefaultValue__.js.map +1 -0
- package/out/concepts/DepartmentManagerV2__.d.ts +30 -0
- package/out/concepts/DepartmentManagerV2__.d.ts.map +1 -0
- package/out/concepts/DepartmentManagerV2__.js +58 -0
- package/out/concepts/DepartmentManagerV2__.js.map +1 -0
- package/out/concepts/DepartmentV2__.d.ts +34 -0
- package/out/concepts/DepartmentV2__.d.ts.map +1 -0
- package/out/concepts/DepartmentV2__.js +65 -0
- package/out/concepts/DepartmentV2__.js.map +1 -0
- package/out/concepts/Destination__.d.ts +151 -0
- package/out/concepts/Destination__.d.ts.map +1 -0
- package/out/concepts/Destination__.js +771 -0
- package/out/concepts/Destination__.js.map +1 -0
- package/out/concepts/DirectManagerV2__.d.ts +26 -0
- package/out/concepts/DirectManagerV2__.d.ts.map +1 -0
- package/out/concepts/DirectManagerV2__.js +55 -0
- package/out/concepts/DirectManagerV2__.js.map +1 -0
- package/out/concepts/End__.d.ts +31 -0
- package/out/concepts/End__.d.ts.map +1 -0
- package/out/concepts/End__.js +150 -0
- package/out/concepts/End__.js.map +1 -0
- package/out/concepts/EntityIndex__.d.ts +94 -0
- package/out/concepts/EntityIndex__.d.ts.map +1 -0
- package/out/concepts/EntityIndex__.js +201 -0
- package/out/concepts/EntityIndex__.js.map +1 -0
- package/out/concepts/EntityProperty__.d.ts +254 -0
- package/out/concepts/EntityProperty__.d.ts.map +1 -0
- package/out/concepts/EntityProperty__.js +715 -0
- package/out/concepts/EntityProperty__.js.map +1 -0
- package/out/concepts/Entity__.d.ts +341 -0
- package/out/concepts/Entity__.d.ts.map +1 -0
- package/out/concepts/Entity__.js +783 -0
- package/out/concepts/Entity__.js.map +1 -0
- package/out/concepts/EnumItem__.d.ts +93 -0
- package/out/concepts/EnumItem__.d.ts.map +1 -0
- package/out/concepts/EnumItem__.js +235 -0
- package/out/concepts/EnumItem__.js.map +1 -0
- package/out/concepts/EnumSelectSetter__.d.ts +114 -0
- package/out/concepts/EnumSelectSetter__.d.ts.map +1 -0
- package/out/concepts/EnumSelectSetter__.js +172 -0
- package/out/concepts/EnumSelectSetter__.js.map +1 -0
- package/out/concepts/Enum__.d.ts +129 -0
- package/out/concepts/Enum__.d.ts.map +1 -0
- package/out/concepts/Enum__.js +342 -0
- package/out/concepts/Enum__.js.map +1 -0
- package/out/concepts/EventDeclaration__.d.ts +43 -0
- package/out/concepts/EventDeclaration__.d.ts.map +1 -0
- package/out/concepts/EventDeclaration__.js +109 -0
- package/out/concepts/EventDeclaration__.js.map +1 -0
- package/out/concepts/Event__.d.ts +156 -0
- package/out/concepts/Event__.d.ts.map +1 -0
- package/out/concepts/Event__.js +291 -0
- package/out/concepts/Event__.js.map +1 -0
- package/out/concepts/ExternalDestination__.d.ts +65 -0
- package/out/concepts/ExternalDestination__.d.ts.map +1 -0
- package/out/concepts/ExternalDestination__.js +285 -0
- package/out/concepts/ExternalDestination__.js.map +1 -0
- package/out/concepts/FieldPermissionV2__.d.ts +40 -0
- package/out/concepts/FieldPermissionV2__.d.ts.map +1 -0
- package/out/concepts/FieldPermissionV2__.js +85 -0
- package/out/concepts/FieldPermissionV2__.js.map +1 -0
- package/out/concepts/FlowConditionItemV2__.d.ts +45 -0
- package/out/concepts/FlowConditionItemV2__.d.ts.map +1 -0
- package/out/concepts/FlowConditionItemV2__.js +107 -0
- package/out/concepts/FlowConditionItemV2__.js.map +1 -0
- package/out/concepts/FlowConditionV2__.d.ts +116 -0
- package/out/concepts/FlowConditionV2__.d.ts.map +1 -0
- package/out/concepts/FlowConditionV2__.js +181 -0
- package/out/concepts/FlowConditionV2__.js.map +1 -0
- package/out/concepts/ForEachStatement__.d.ts +128 -0
- package/out/concepts/ForEachStatement__.d.ts.map +1 -0
- package/out/concepts/ForEachStatement__.js +398 -0
- package/out/concepts/ForEachStatement__.js.map +1 -0
- package/out/concepts/FrontendLibrary__.d.ts +213 -0
- package/out/concepts/FrontendLibrary__.d.ts.map +1 -0
- package/out/concepts/FrontendLibrary__.js +303 -0
- package/out/concepts/FrontendLibrary__.js.map +1 -0
- package/out/concepts/FrontendType__.d.ts +312 -0
- package/out/concepts/FrontendType__.d.ts.map +1 -0
- package/out/concepts/FrontendType__.js +550 -0
- package/out/concepts/FrontendType__.js.map +1 -0
- package/out/concepts/FrontendVariable__.d.ts +42 -0
- package/out/concepts/FrontendVariable__.d.ts.map +1 -0
- package/out/concepts/FrontendVariable__.js +81 -0
- package/out/concepts/FrontendVariable__.js.map +1 -0
- package/out/concepts/Frontend__.d.ts +395 -0
- package/out/concepts/Frontend__.d.ts.map +1 -0
- package/out/concepts/Frontend__.js +870 -0
- package/out/concepts/Frontend__.js.map +1 -0
- package/out/concepts/Function__.d.ts +400 -0
- package/out/concepts/Function__.d.ts.map +1 -0
- package/out/concepts/Function__.js +631 -0
- package/out/concepts/Function__.js.map +1 -0
- package/out/concepts/HistoryProcessV2__.d.ts +229 -0
- package/out/concepts/HistoryProcessV2__.d.ts.map +1 -0
- package/out/concepts/HistoryProcessV2__.js +345 -0
- package/out/concepts/HistoryProcessV2__.js.map +1 -0
- package/out/concepts/I18nInfo__.d.ts +48 -0
- package/out/concepts/I18nInfo__.d.ts.map +1 -0
- package/out/concepts/I18nInfo__.js +100 -0
- package/out/concepts/I18nInfo__.js.map +1 -0
- package/out/concepts/IconSetter__.d.ts +30 -0
- package/out/concepts/IconSetter__.d.ts.map +1 -0
- package/out/concepts/IconSetter__.js +58 -0
- package/out/concepts/IconSetter__.js.map +1 -0
- package/out/concepts/Identifier__.d.ts +69 -0
- package/out/concepts/Identifier__.d.ts.map +1 -0
- package/out/concepts/Identifier__.js +437 -0
- package/out/concepts/Identifier__.js.map +1 -0
- package/out/concepts/IfStatement__.d.ts +157 -0
- package/out/concepts/IfStatement__.d.ts.map +1 -0
- package/out/concepts/IfStatement__.js +365 -0
- package/out/concepts/IfStatement__.js.map +1 -0
- package/out/concepts/ImageSetter__.d.ts +26 -0
- package/out/concepts/ImageSetter__.d.ts.map +1 -0
- package/out/concepts/ImageSetter__.js +55 -0
- package/out/concepts/ImageSetter__.js.map +1 -0
- package/out/concepts/ImportedInterface__.d.ts +31 -0
- package/out/concepts/ImportedInterface__.d.ts.map +1 -0
- package/out/concepts/ImportedInterface__.js +58 -0
- package/out/concepts/ImportedInterface__.js.map +1 -0
- package/out/concepts/InputSetter__.d.ts +30 -0
- package/out/concepts/InputSetter__.d.ts.map +1 -0
- package/out/concepts/InputSetter__.js +58 -0
- package/out/concepts/InputSetter__.js.map +1 -0
- package/out/concepts/Integration__.d.ts +129 -0
- package/out/concepts/Integration__.d.ts.map +1 -0
- package/out/concepts/Integration__.js +215 -0
- package/out/concepts/Integration__.js.map +1 -0
- package/out/concepts/InterfaceParam__.d.ts +121 -0
- package/out/concepts/InterfaceParam__.d.ts.map +1 -0
- package/out/concepts/InterfaceParam__.js +285 -0
- package/out/concepts/InterfaceParam__.js.map +1 -0
- package/out/concepts/InterfaceTriggerEvent__.d.ts +35 -0
- package/out/concepts/InterfaceTriggerEvent__.d.ts.map +1 -0
- package/out/concepts/InterfaceTriggerEvent__.js +74 -0
- package/out/concepts/InterfaceTriggerEvent__.js.map +1 -0
- package/out/concepts/Interface__.d.ts +406 -0
- package/out/concepts/Interface__.d.ts.map +1 -0
- package/out/concepts/Interface__.js +994 -0
- package/out/concepts/Interface__.js.map +1 -0
- package/out/concepts/JSBlock__.d.ts +40 -0
- package/out/concepts/JSBlock__.d.ts.map +1 -0
- package/out/concepts/JSBlock__.js +110 -0
- package/out/concepts/JSBlock__.js.map +1 -0
- package/out/concepts/JavaLogic__.d.ts +51 -0
- package/out/concepts/JavaLogic__.d.ts.map +1 -0
- package/out/concepts/JavaLogic__.js +116 -0
- package/out/concepts/JavaLogic__.js.map +1 -0
- package/out/concepts/LogicDeclaration__.d.ts +292 -0
- package/out/concepts/LogicDeclaration__.d.ts.map +1 -0
- package/out/concepts/LogicDeclaration__.js +421 -0
- package/out/concepts/LogicDeclaration__.js.map +1 -0
- package/out/concepts/LogicItem__.d.ts +188 -0
- package/out/concepts/LogicItem__.d.ts.map +1 -0
- package/out/concepts/LogicItem__.js +322 -0
- package/out/concepts/LogicItem__.js.map +1 -0
- package/out/concepts/Logic__.d.ts +657 -0
- package/out/concepts/Logic__.d.ts.map +1 -0
- package/out/concepts/Logic__.js +2280 -0
- package/out/concepts/Logic__.js.map +1 -0
- package/out/concepts/ManagerV2__.d.ts +36 -0
- package/out/concepts/ManagerV2__.d.ts.map +1 -0
- package/out/concepts/ManagerV2__.js +63 -0
- package/out/concepts/ManagerV2__.js.map +1 -0
- package/out/concepts/MatchCase__.d.ts +266 -0
- package/out/concepts/MatchCase__.d.ts.map +1 -0
- package/out/concepts/MatchCase__.js +677 -0
- package/out/concepts/MatchCase__.js.map +1 -0
- package/out/concepts/Match__.d.ts +125 -0
- package/out/concepts/Match__.d.ts.map +1 -0
- package/out/concepts/Match__.js +685 -0
- package/out/concepts/Match__.js.map +1 -0
- package/out/concepts/MemberExpression__.d.ts +66 -0
- package/out/concepts/MemberExpression__.d.ts.map +1 -0
- package/out/concepts/MemberExpression__.js +514 -0
- package/out/concepts/MemberExpression__.js.map +1 -0
- package/out/concepts/MetadataType__.d.ts +222 -0
- package/out/concepts/MetadataType__.d.ts.map +1 -0
- package/out/concepts/MetadataType__.js +422 -0
- package/out/concepts/MetadataType__.js.map +1 -0
- package/out/concepts/MicroApp__.d.ts +54 -0
- package/out/concepts/MicroApp__.d.ts.map +1 -0
- package/out/concepts/MicroApp__.js +80 -0
- package/out/concepts/MicroApp__.js.map +1 -0
- package/out/concepts/Module__.d.ts +1314 -0
- package/out/concepts/Module__.d.ts.map +1 -0
- package/out/concepts/Module__.js +1580 -0
- package/out/concepts/Module__.js.map +1 -0
- package/out/concepts/MsgTriggerEvent__.d.ts +139 -0
- package/out/concepts/MsgTriggerEvent__.d.ts.map +1 -0
- package/out/concepts/MsgTriggerEvent__.js +210 -0
- package/out/concepts/MsgTriggerEvent__.js.map +1 -0
- package/out/concepts/MsgTriggerLauncher__.d.ts +120 -0
- package/out/concepts/MsgTriggerLauncher__.d.ts.map +1 -0
- package/out/concepts/MsgTriggerLauncher__.js +189 -0
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -0
- package/out/concepts/MultiApprovalPolicy__.d.ts +27 -0
- package/out/concepts/MultiApprovalPolicy__.d.ts.map +1 -0
- package/out/concepts/MultiApprovalPolicy__.js +55 -0
- package/out/concepts/MultiApprovalPolicy__.js.map +1 -0
- package/out/concepts/Namespace__.d.ts +1146 -0
- package/out/concepts/Namespace__.d.ts.map +1 -0
- package/out/concepts/Namespace__.js +1256 -0
- package/out/concepts/Namespace__.js.map +1 -0
- package/out/concepts/NewComposite__.d.ts +341 -0
- package/out/concepts/NewComposite__.d.ts.map +1 -0
- package/out/concepts/NewComposite__.js +1225 -0
- package/out/concepts/NewComposite__.js.map +1 -0
- package/out/concepts/NewList__.d.ts +128 -0
- package/out/concepts/NewList__.d.ts.map +1 -0
- package/out/concepts/NewList__.js +408 -0
- package/out/concepts/NewList__.js.map +1 -0
- package/out/concepts/NewMap__.d.ts +219 -0
- package/out/concepts/NewMap__.d.ts.map +1 -0
- package/out/concepts/NewMap__.js +558 -0
- package/out/concepts/NewMap__.js.map +1 -0
- package/out/concepts/New__.d.ts +32 -0
- package/out/concepts/New__.d.ts.map +1 -0
- package/out/concepts/New__.js +80 -0
- package/out/concepts/New__.js.map +1 -0
- package/out/concepts/NullLiteral__.d.ts +37 -0
- package/out/concepts/NullLiteral__.d.ts.map +1 -0
- package/out/concepts/NullLiteral__.js +102 -0
- package/out/concepts/NullLiteral__.js.map +1 -0
- package/out/concepts/NumberInputSetter__.d.ts +46 -0
- package/out/concepts/NumberInputSetter__.d.ts.map +1 -0
- package/out/concepts/NumberInputSetter__.js +70 -0
- package/out/concepts/NumberInputSetter__.js.map +1 -0
- package/out/concepts/NumericLiteral__.d.ts +49 -0
- package/out/concepts/NumericLiteral__.d.ts.map +1 -0
- package/out/concepts/NumericLiteral__.js +141 -0
- package/out/concepts/NumericLiteral__.js.map +1 -0
- package/out/concepts/OperatePermissionV2__.d.ts +44 -0
- package/out/concepts/OperatePermissionV2__.d.ts.map +1 -0
- package/out/concepts/OperatePermissionV2__.js +82 -0
- package/out/concepts/OperatePermissionV2__.js.map +1 -0
- package/out/concepts/OqlQueryComponent__.d.ts +63 -0
- package/out/concepts/OqlQueryComponent__.d.ts.map +1 -0
- package/out/concepts/OqlQueryComponent__.js +313 -0
- package/out/concepts/OqlQueryComponent__.js.map +1 -0
- package/out/concepts/OrSignPolicyV2__.d.ts +26 -0
- package/out/concepts/OrSignPolicyV2__.d.ts.map +1 -0
- package/out/concepts/OrSignPolicyV2__.js +55 -0
- package/out/concepts/OrSignPolicyV2__.js.map +1 -0
- package/out/concepts/OverriddenLogic__.d.ts +618 -0
- package/out/concepts/OverriddenLogic__.d.ts.map +1 -0
- package/out/concepts/OverriddenLogic__.js +1657 -0
- package/out/concepts/OverriddenLogic__.js.map +1 -0
- package/out/concepts/Paginate__.d.ts +57 -0
- package/out/concepts/Paginate__.d.ts.map +1 -0
- package/out/concepts/Paginate__.js +163 -0
- package/out/concepts/Paginate__.js.map +1 -0
- package/out/concepts/ParamWithGroup__.d.ts +44 -0
- package/out/concepts/ParamWithGroup__.d.ts.map +1 -0
- package/out/concepts/ParamWithGroup__.js +161 -0
- package/out/concepts/ParamWithGroup__.js.map +1 -0
- package/out/concepts/Param__.d.ts +145 -0
- package/out/concepts/Param__.d.ts.map +1 -0
- package/out/concepts/Param__.js +453 -0
- package/out/concepts/Param__.js.map +1 -0
- package/out/concepts/Point__.d.ts +34 -0
- package/out/concepts/Point__.d.ts.map +1 -0
- package/out/concepts/Point__.js +61 -0
- package/out/concepts/Point__.js.map +1 -0
- package/out/concepts/ProcessBindV2__.d.ts +53 -0
- package/out/concepts/ProcessBindV2__.d.ts.map +1 -0
- package/out/concepts/ProcessBindV2__.js +114 -0
- package/out/concepts/ProcessBindV2__.js.map +1 -0
- package/out/concepts/ProcessComponentV2__.d.ts +126 -0
- package/out/concepts/ProcessComponentV2__.d.ts.map +1 -0
- package/out/concepts/ProcessComponentV2__.js +186 -0
- package/out/concepts/ProcessComponentV2__.js.map +1 -0
- package/out/concepts/ProcessComponent__.d.ts +215 -0
- package/out/concepts/ProcessComponent__.d.ts.map +1 -0
- package/out/concepts/ProcessComponent__.js +276 -0
- package/out/concepts/ProcessComponent__.js.map +1 -0
- package/out/concepts/ProcessElementV2__.d.ts +552 -0
- package/out/concepts/ProcessElementV2__.d.ts.map +1 -0
- package/out/concepts/ProcessElementV2__.js +954 -0
- package/out/concepts/ProcessElementV2__.js.map +1 -0
- package/out/concepts/ProcessElement__.d.ts +628 -0
- package/out/concepts/ProcessElement__.d.ts.map +1 -0
- package/out/concepts/ProcessElement__.js +1079 -0
- package/out/concepts/ProcessElement__.js.map +1 -0
- package/out/concepts/ProcessOutcome__.d.ts +36 -0
- package/out/concepts/ProcessOutcome__.d.ts.map +1 -0
- package/out/concepts/ProcessOutcome__.js +97 -0
- package/out/concepts/ProcessOutcome__.js.map +1 -0
- package/out/concepts/ProcessOutcomes__.d.ts +36 -0
- package/out/concepts/ProcessOutcomes__.d.ts.map +1 -0
- package/out/concepts/ProcessOutcomes__.js +104 -0
- package/out/concepts/ProcessOutcomes__.js.map +1 -0
- package/out/concepts/ProcessV2__.d.ts +433 -0
- package/out/concepts/ProcessV2__.d.ts.map +1 -0
- package/out/concepts/ProcessV2__.js +732 -0
- package/out/concepts/ProcessV2__.js.map +1 -0
- package/out/concepts/Process__.d.ts +615 -0
- package/out/concepts/Process__.d.ts.map +1 -0
- package/out/concepts/Process__.js +985 -0
- package/out/concepts/Process__.js.map +1 -0
- package/out/concepts/PropDeclaration__.d.ts +109 -0
- package/out/concepts/PropDeclaration__.d.ts.map +1 -0
- package/out/concepts/PropDeclaration__.js +137 -0
- package/out/concepts/PropDeclaration__.js.map +1 -0
- package/out/concepts/PropertySelectSetter__.d.ts +26 -0
- package/out/concepts/PropertySelectSetter__.d.ts.map +1 -0
- package/out/concepts/PropertySelectSetter__.js +55 -0
- package/out/concepts/PropertySelectSetter__.js.map +1 -0
- package/out/concepts/QueryAggregateExpression__.d.ts +51 -0
- package/out/concepts/QueryAggregateExpression__.d.ts.map +1 -0
- package/out/concepts/QueryAggregateExpression__.js +126 -0
- package/out/concepts/QueryAggregateExpression__.js.map +1 -0
- package/out/concepts/QueryFieldExpression__.d.ts +67 -0
- package/out/concepts/QueryFieldExpression__.d.ts.map +1 -0
- package/out/concepts/QueryFieldExpression__.js +207 -0
- package/out/concepts/QueryFieldExpression__.js.map +1 -0
- package/out/concepts/QueryFromExpression__.d.ts +108 -0
- package/out/concepts/QueryFromExpression__.d.ts.map +1 -0
- package/out/concepts/QueryFromExpression__.js +244 -0
- package/out/concepts/QueryFromExpression__.js.map +1 -0
- package/out/concepts/QueryGroupByExpression__.d.ts +48 -0
- package/out/concepts/QueryGroupByExpression__.d.ts.map +1 -0
- package/out/concepts/QueryGroupByExpression__.js +123 -0
- package/out/concepts/QueryGroupByExpression__.js.map +1 -0
- package/out/concepts/QueryJoinExpression__.d.ts +195 -0
- package/out/concepts/QueryJoinExpression__.d.ts.map +1 -0
- package/out/concepts/QueryJoinExpression__.js +357 -0
- package/out/concepts/QueryJoinExpression__.js.map +1 -0
- package/out/concepts/QueryLimitExpression__.d.ts +48 -0
- package/out/concepts/QueryLimitExpression__.d.ts.map +1 -0
- package/out/concepts/QueryLimitExpression__.js +141 -0
- package/out/concepts/QueryLimitExpression__.js.map +1 -0
- package/out/concepts/QueryOrderByExpression__.d.ts +59 -0
- package/out/concepts/QueryOrderByExpression__.d.ts.map +1 -0
- package/out/concepts/QueryOrderByExpression__.js +158 -0
- package/out/concepts/QueryOrderByExpression__.js.map +1 -0
- package/out/concepts/QuerySelectExpression__.d.ts +213 -0
- package/out/concepts/QuerySelectExpression__.d.ts.map +1 -0
- package/out/concepts/QuerySelectExpression__.js +346 -0
- package/out/concepts/QuerySelectExpression__.js.map +1 -0
- package/out/concepts/Rect__.d.ts +42 -0
- package/out/concepts/Rect__.d.ts.map +1 -0
- package/out/concepts/Rect__.js +67 -0
- package/out/concepts/Rect__.js.map +1 -0
- package/out/concepts/Return__.d.ts +122 -0
- package/out/concepts/Return__.d.ts.map +1 -0
- package/out/concepts/Return__.js +359 -0
- package/out/concepts/Return__.js.map +1 -0
- package/out/concepts/Role__.d.ts +60 -0
- package/out/concepts/Role__.d.ts.map +1 -0
- package/out/concepts/Role__.js +188 -0
- package/out/concepts/Role__.js.map +1 -0
- package/out/concepts/SelectMembers__.d.ts +136 -0
- package/out/concepts/SelectMembers__.d.ts.map +1 -0
- package/out/concepts/SelectMembers__.js +259 -0
- package/out/concepts/SelectMembers__.js.map +1 -0
- package/out/concepts/SequentialPolicyV2__.d.ts +26 -0
- package/out/concepts/SequentialPolicyV2__.d.ts.map +1 -0
- package/out/concepts/SequentialPolicyV2__.js +55 -0
- package/out/concepts/SequentialPolicyV2__.js.map +1 -0
- package/out/concepts/SequentialPolicy__.d.ts +26 -0
- package/out/concepts/SequentialPolicy__.d.ts.map +1 -0
- package/out/concepts/SequentialPolicy__.js +55 -0
- package/out/concepts/SequentialPolicy__.js.map +1 -0
- package/out/concepts/SetterOption__.d.ts +50 -0
- package/out/concepts/SetterOption__.d.ts.map +1 -0
- package/out/concepts/SetterOption__.js +73 -0
- package/out/concepts/SetterOption__.js.map +1 -0
- package/out/concepts/SlotDeclaration__.d.ts +215 -0
- package/out/concepts/SlotDeclaration__.d.ts.map +1 -0
- package/out/concepts/SlotDeclaration__.js +285 -0
- package/out/concepts/SlotDeclaration__.js.map +1 -0
- package/out/concepts/Slot__.d.ts +54 -0
- package/out/concepts/Slot__.d.ts.map +1 -0
- package/out/concepts/Slot__.js +95 -0
- package/out/concepts/Slot__.js.map +1 -0
- package/out/concepts/SqlQueryComponent__.d.ts +59 -0
- package/out/concepts/SqlQueryComponent__.d.ts.map +1 -0
- package/out/concepts/SqlQueryComponent__.js +220 -0
- package/out/concepts/SqlQueryComponent__.js.map +1 -0
- package/out/concepts/Start__.d.ts +31 -0
- package/out/concepts/Start__.d.ts.map +1 -0
- package/out/concepts/Start__.js +75 -0
- package/out/concepts/Start__.js.map +1 -0
- package/out/concepts/StaticString__.d.ts +50 -0
- package/out/concepts/StaticString__.d.ts.map +1 -0
- package/out/concepts/StaticString__.js +114 -0
- package/out/concepts/StaticString__.js.map +1 -0
- package/out/concepts/StringInterpolation__.d.ts +124 -0
- package/out/concepts/StringInterpolation__.d.ts.map +1 -0
- package/out/concepts/StringInterpolation__.js +279 -0
- package/out/concepts/StringInterpolation__.js.map +1 -0
- package/out/concepts/StringLiteral__.d.ts +52 -0
- package/out/concepts/StringLiteral__.d.ts.map +1 -0
- package/out/concepts/StringLiteral__.js +185 -0
- package/out/concepts/StringLiteral__.js.map +1 -0
- package/out/concepts/StructureProperty__.d.ts +134 -0
- package/out/concepts/StructureProperty__.d.ts.map +1 -0
- package/out/concepts/StructureProperty__.js +292 -0
- package/out/concepts/StructureProperty__.js.map +1 -0
- package/out/concepts/Structure__.d.ts +241 -0
- package/out/concepts/Structure__.d.ts.map +1 -0
- package/out/concepts/Structure__.js +485 -0
- package/out/concepts/Structure__.js.map +1 -0
- package/out/concepts/SubLogic__.d.ts +418 -0
- package/out/concepts/SubLogic__.d.ts.map +1 -0
- package/out/concepts/SubLogic__.js +1002 -0
- package/out/concepts/SubLogic__.js.map +1 -0
- package/out/concepts/SwitchCase__.d.ts +93 -0
- package/out/concepts/SwitchCase__.d.ts.map +1 -0
- package/out/concepts/SwitchCase__.js +282 -0
- package/out/concepts/SwitchCase__.js.map +1 -0
- package/out/concepts/SwitchSetter__.d.ts +26 -0
- package/out/concepts/SwitchSetter__.d.ts.map +1 -0
- package/out/concepts/SwitchSetter__.js +55 -0
- package/out/concepts/SwitchSetter__.js.map +1 -0
- package/out/concepts/SwitchStatement__.d.ts +92 -0
- package/out/concepts/SwitchStatement__.d.ts.map +1 -0
- package/out/concepts/SwitchStatement__.js +221 -0
- package/out/concepts/SwitchStatement__.js.map +1 -0
- package/out/concepts/ThemeVariable__.d.ts +30 -0
- package/out/concepts/ThemeVariable__.d.ts.map +1 -0
- package/out/concepts/ThemeVariable__.js +58 -0
- package/out/concepts/ThemeVariable__.js.map +1 -0
- package/out/concepts/Theme__.d.ts +44 -0
- package/out/concepts/Theme__.d.ts.map +1 -0
- package/out/concepts/Theme__.js +83 -0
- package/out/concepts/Theme__.js.map +1 -0
- package/out/concepts/Transactional__.d.ts +86 -0
- package/out/concepts/Transactional__.d.ts.map +1 -0
- package/out/concepts/Transactional__.js +150 -0
- package/out/concepts/Transactional__.js.map +1 -0
- package/out/concepts/TriggerEvent__.d.ts +44 -0
- package/out/concepts/TriggerEvent__.d.ts.map +1 -0
- package/out/concepts/TriggerEvent__.js +93 -0
- package/out/concepts/TriggerEvent__.js.map +1 -0
- package/out/concepts/TriggerLauncher__.d.ts +77 -0
- package/out/concepts/TriggerLauncher__.d.ts.map +1 -0
- package/out/concepts/TriggerLauncher__.js +232 -0
- package/out/concepts/TriggerLauncher__.js.map +1 -0
- package/out/concepts/TypeAnnotation__.d.ts +310 -0
- package/out/concepts/TypeAnnotation__.d.ts.map +1 -0
- package/out/concepts/TypeAnnotation__.js +1169 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -0
- package/out/concepts/TypeParam__.d.ts +40 -0
- package/out/concepts/TypeParam__.d.ts.map +1 -0
- package/out/concepts/TypeParam__.js +91 -0
- package/out/concepts/TypeParam__.js.map +1 -0
- package/out/concepts/UnaryExpression__.d.ts +48 -0
- package/out/concepts/UnaryExpression__.d.ts.map +1 -0
- package/out/concepts/UnaryExpression__.js +176 -0
- package/out/concepts/UnaryExpression__.js.map +1 -0
- package/out/concepts/Unparsed__.d.ts +42 -0
- package/out/concepts/Unparsed__.d.ts.map +1 -0
- package/out/concepts/Unparsed__.js +98 -0
- package/out/concepts/Unparsed__.js.map +1 -0
- package/out/concepts/UseComponent__.d.ts +34 -0
- package/out/concepts/UseComponent__.d.ts.map +1 -0
- package/out/concepts/UseComponent__.js +61 -0
- package/out/concepts/UseComponent__.js.map +1 -0
- package/out/concepts/ValidationRule__.d.ts +130 -0
- package/out/concepts/ValidationRule__.d.ts.map +1 -0
- package/out/concepts/ValidationRule__.js +542 -0
- package/out/concepts/ValidationRule__.js.map +1 -0
- package/out/concepts/Variable__.d.ts +140 -0
- package/out/concepts/Variable__.d.ts.map +1 -0
- package/out/concepts/Variable__.js +457 -0
- package/out/concepts/Variable__.js.map +1 -0
- package/out/concepts/ViewBlockWithImage__.d.ts +34 -0
- package/out/concepts/ViewBlockWithImage__.d.ts.map +1 -0
- package/out/concepts/ViewBlockWithImage__.js +61 -0
- package/out/concepts/ViewBlockWithImage__.js.map +1 -0
- package/out/concepts/ViewBlock__.d.ts +38 -0
- package/out/concepts/ViewBlock__.d.ts.map +1 -0
- package/out/concepts/ViewBlock__.js +64 -0
- package/out/concepts/ViewBlock__.js.map +1 -0
- package/out/concepts/ViewComponentDeclaration__.d.ts +727 -0
- package/out/concepts/ViewComponentDeclaration__.d.ts.map +1 -0
- package/out/concepts/ViewComponentDeclaration__.js +833 -0
- package/out/concepts/ViewComponentDeclaration__.js.map +1 -0
- package/out/concepts/ViewElement__.d.ts +666 -0
- package/out/concepts/ViewElement__.d.ts.map +1 -0
- package/out/concepts/ViewElement__.js +2929 -0
- package/out/concepts/ViewElement__.js.map +1 -0
- package/out/concepts/View__.d.ts +754 -0
- package/out/concepts/View__.d.ts.map +1 -0
- package/out/concepts/View__.js +2907 -0
- package/out/concepts/View__.js.map +1 -0
- package/out/concepts/WhileStatement__.d.ts +96 -0
- package/out/concepts/WhileStatement__.d.ts.map +1 -0
- package/out/concepts/WhileStatement__.js +256 -0
- package/out/concepts/WhileStatement__.js.map +1 -0
- package/out/concepts/basics/index.d.ts +16 -0
- package/out/concepts/basics/index.d.ts.map +1 -0
- package/out/concepts/basics/index.js +54 -0
- package/out/concepts/basics/index.js.map +1 -0
- package/out/concepts/basics/stdlib/index.d.ts +16 -0
- package/out/concepts/basics/stdlib/index.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/index.js +93 -0
- package/out/concepts/basics/stdlib/index.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.auth.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +206 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.d.ts +6 -0
- package/out/concepts/basics/stdlib/nasl.browser.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +200 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.collection.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.collection.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.collection.js +57 -0
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +97 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.core.d.ts +8 -0
- package/out/concepts/basics/stdlib/nasl.core.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.core.js +47 -0
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.event.d.ts +6 -0
- package/out/concepts/basics/stdlib/nasl.event.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.event.js +34 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.http.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.http.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.http.js +174 -0
- package/out/concepts/basics/stdlib/nasl.http.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.interface.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.interface.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.interface.js +49 -0
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.io.d.ts +6 -0
- package/out/concepts/basics/stdlib/nasl.io.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.io.js +61 -0
- package/out/concepts/basics/stdlib/nasl.io.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.logging.d.ts +6 -0
- package/out/concepts/basics/stdlib/nasl.logging.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.logging.js +65 -0
- package/out/concepts/basics/stdlib/nasl.logging.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.process.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.process.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.process.js +741 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts +12 -0
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.processV2.js +967 -0
- package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.ui.d.ts +10 -0
- package/out/concepts/basics/stdlib/nasl.ui.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.ui.js +1038 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.d.ts +7 -0
- package/out/concepts/basics/stdlib/nasl.util.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +2501 -0
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.validation.d.ts +6 -0
- package/out/concepts/basics/stdlib/nasl.validation.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/nasl.validation.js +680 -0
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -0
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.d.ts +5 -0
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +47 -0
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -0
- package/out/concepts/basics/stdlib/timeZone.d.ts +6 -0
- package/out/concepts/basics/stdlib/timeZone.d.ts.map +1 -0
- package/out/concepts/basics/stdlib/timeZone.js +196 -0
- package/out/concepts/basics/stdlib/timeZone.js.map +1 -0
- package/out/concepts/basics/types/coreTypeList.d.ts +5 -0
- package/out/concepts/basics/types/coreTypeList.d.ts.map +1 -0
- package/out/concepts/basics/types/coreTypeList.js +14 -0
- package/out/concepts/basics/types/coreTypeList.js.map +1 -0
- package/out/concepts/basics/types/dataTypes.d.ts +9 -0
- package/out/concepts/basics/types/dataTypes.d.ts.map +1 -0
- package/out/concepts/basics/types/dataTypes.js +18 -0
- package/out/concepts/basics/types/dataTypes.js.map +1 -0
- package/out/concepts/basics/types/index.d.ts +5 -0
- package/out/concepts/basics/types/index.d.ts.map +1 -0
- package/out/concepts/basics/types/index.js +17 -0
- package/out/concepts/basics/types/index.js.map +1 -0
- package/out/concepts/index.d.ts +6 -0
- package/out/concepts/index.d.ts.map +1 -0
- package/out/concepts/index.js +36 -0
- package/out/concepts/index.js.map +1 -0
- package/out/concepts/index__.d.ts +178 -0
- package/out/concepts/index__.d.ts.map +1 -0
- package/out/concepts/index__.js +194 -0
- package/out/concepts/index__.js.map +1 -0
- package/out/concepts/types__.d.ts +2 -0
- package/out/concepts/types__.d.ts.map +1 -0
- package/out/concepts/types__.js +3 -0
- package/out/concepts/types__.js.map +1 -0
- package/out/concepts/utils/asserts.d.ts +8822 -0
- package/out/concepts/utils/asserts.d.ts.map +1 -0
- package/out/concepts/utils/asserts.js +11727 -0
- package/out/concepts/utils/asserts.js.map +1 -0
- package/out/concepts/utils/quick-info.d.ts +21 -0
- package/out/concepts/utils/quick-info.d.ts.map +1 -0
- package/out/concepts/utils/quick-info.js +108 -0
- package/out/concepts/utils/quick-info.js.map +1 -0
- package/out/concepts/utils/types.d.ts +580 -0
- package/out/concepts/utils/types.d.ts.map +1 -0
- package/out/concepts/utils/types.js +3 -0
- package/out/concepts/utils/types.js.map +1 -0
- package/out/decorators/constant.d.ts +12 -0
- package/out/decorators/constant.d.ts.map +1 -0
- package/out/decorators/constant.js +6 -0
- package/out/decorators/constant.js.map +1 -0
- package/out/decorators/index.d.ts +34 -0
- package/out/decorators/index.d.ts.map +1 -0
- package/out/decorators/index.js +123 -0
- package/out/decorators/index.js.map +1 -0
- package/out/decorators/utils.d.ts +22 -0
- package/out/decorators/utils.d.ts.map +1 -0
- package/out/decorators/utils.js +50 -0
- package/out/decorators/utils.js.map +1 -0
- package/out/index.d.ts +13 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +49 -0
- package/out/index.js.map +1 -0
- package/out/service/actionable.d.ts +3 -0
- package/out/service/actionable.d.ts.map +1 -0
- package/out/service/actionable.js +9 -0
- package/out/service/actionable.js.map +1 -0
- package/out/service/engine.d.ts +7 -0
- package/out/service/engine.d.ts.map +1 -0
- package/out/service/engine.js +120 -0
- package/out/service/engine.js.map +1 -0
- package/out/service/entity2LogicNamespace.d.ts +11 -0
- package/out/service/entity2LogicNamespace.d.ts.map +1 -0
- package/out/service/entity2LogicNamespace.js +379 -0
- package/out/service/entity2LogicNamespace.js.map +1 -0
- package/out/service/formatTsUtils.d.ts +37 -0
- package/out/service/formatTsUtils.d.ts.map +1 -0
- package/out/service/formatTsUtils.js +876 -0
- package/out/service/formatTsUtils.js.map +1 -0
- package/out/service/getConnector.d.ts +13 -0
- package/out/service/getConnector.d.ts.map +1 -0
- package/out/service/getConnector.js +117 -0
- package/out/service/getConnector.js.map +1 -0
- package/out/service/getExtensionModules.d.ts +4 -0
- package/out/service/getExtensionModules.d.ts.map +1 -0
- package/out/service/getExtensionModules.js +34 -0
- package/out/service/getExtensionModules.js.map +1 -0
- package/out/service/getFunctions.d.ts +4 -0
- package/out/service/getFunctions.d.ts.map +1 -0
- package/out/service/getFunctions.js +20 -0
- package/out/service/getFunctions.js.map +1 -0
- package/out/service/getInterfaces.d.ts +3 -0
- package/out/service/getInterfaces.d.ts.map +1 -0
- package/out/service/getInterfaces.js +48 -0
- package/out/service/getInterfaces.js.map +1 -0
- package/out/service/getLogging.d.ts +2 -0
- package/out/service/getLogging.d.ts.map +1 -0
- package/out/service/getLogging.js +9 -0
- package/out/service/getLogging.js.map +1 -0
- package/out/service/getLogics.d.ts +6 -0
- package/out/service/getLogics.d.ts.map +1 -0
- package/out/service/getLogics.js +509 -0
- package/out/service/getLogics.js.map +1 -0
- package/out/service/getMemberIdentifier.d.ts +18 -0
- package/out/service/getMemberIdentifier.d.ts.map +1 -0
- package/out/service/getMemberIdentifier.js +489 -0
- package/out/service/getMemberIdentifier.js.map +1 -0
- package/out/service/getProcessComponents.d.ts +3 -0
- package/out/service/getProcessComponents.d.ts.map +1 -0
- package/out/service/getProcessComponents.js +13 -0
- package/out/service/getProcessComponents.js.map +1 -0
- package/out/service/getProcesses.d.ts +34 -0
- package/out/service/getProcesses.d.ts.map +1 -0
- package/out/service/getProcesses.js +644 -0
- package/out/service/getProcesses.js.map +1 -0
- package/out/service/getProcessesV2.d.ts +91 -0
- package/out/service/getProcessesV2.d.ts.map +1 -0
- package/out/service/getProcessesV2.js +687 -0
- package/out/service/getProcessesV2.js.map +1 -0
- package/out/service/getValidates.d.ts +4 -0
- package/out/service/getValidates.d.ts.map +1 -0
- package/out/service/getValidates.js +14 -0
- package/out/service/getValidates.js.map +1 -0
- package/out/service/index.d.ts +19 -0
- package/out/service/index.d.ts.map +1 -0
- package/out/service/index.js +48 -0
- package/out/service/index.js.map +1 -0
- package/out/service/modules.d.ts +9 -0
- package/out/service/modules.d.ts.map +1 -0
- package/out/service/modules.js +88 -0
- package/out/service/modules.js.map +1 -0
- package/out/service/process2LogicNamespace.d.ts +27 -0
- package/out/service/process2LogicNamespace.d.ts.map +1 -0
- package/out/service/process2LogicNamespace.js +109 -0
- package/out/service/process2LogicNamespace.js.map +1 -0
- package/out/service/transform.d.ts +9 -0
- package/out/service/transform.d.ts.map +1 -0
- package/out/service/transform.js +36 -0
- package/out/service/transform.js.map +1 -0
- package/out/store/event.d.ts +14 -0
- package/out/store/event.d.ts.map +1 -0
- package/out/store/event.js +19 -0
- package/out/store/event.js.map +1 -0
- package/out/store/index.d.ts +8 -0
- package/out/store/index.d.ts.map +1 -0
- package/out/store/index.js +25 -0
- package/out/store/index.js.map +1 -0
- package/out/store/lib.d.ts +16 -0
- package/out/store/lib.d.ts.map +1 -0
- package/out/store/lib.js +21 -0
- package/out/store/lib.js.map +1 -0
- package/out/store/store.d.ts +16 -0
- package/out/store/store.d.ts.map +1 -0
- package/out/store/store.js +18 -0
- package/out/store/store.js.map +1 -0
- package/out/utils/bak-translator.d.ts +2 -0
- package/out/utils/bak-translator.d.ts.map +1 -0
- package/out/utils/bak-translator.js +334 -0
- package/out/utils/bak-translator.js.map +1 -0
- package/out/utils/constant.d.ts +4 -0
- package/out/utils/constant.d.ts.map +1 -0
- package/out/utils/constant.js +34 -0
- package/out/utils/constant.js.map +1 -0
- package/out/utils/index.d.ts +6 -0
- package/out/utils/index.d.ts.map +1 -0
- package/out/utils/index.js +22 -0
- package/out/utils/index.js.map +1 -0
- package/out/utils/node.d.ts +14 -0
- package/out/utils/node.d.ts.map +1 -0
- package/out/utils/node.js +85 -0
- package/out/utils/node.js.map +1 -0
- package/out/utils/utils.d.ts +13 -0
- package/out/utils/utils.d.ts.map +1 -0
- package/out/utils/utils.js +77 -0
- package/out/utils/utils.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,2929 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
+
};
|
|
34
|
+
var ViewElement_1;
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ViewElement = void 0;
|
|
37
|
+
const utils_1 = require("../utils");
|
|
38
|
+
const nasl_translator_1 = require("@lcap/nasl-translator");
|
|
39
|
+
const concepts_1 = require("../concepts");
|
|
40
|
+
const store_1 = require("../store");
|
|
41
|
+
const json5 = __importStar(require("json5"));
|
|
42
|
+
const BooleanLiteral__1 = require("./BooleanLiteral__");
|
|
43
|
+
const StringLiteral__1 = require("./StringLiteral__");
|
|
44
|
+
const LogicItem__1 = require("./LogicItem__");
|
|
45
|
+
const Logic__1 = require("./Logic__");
|
|
46
|
+
const store_2 = require("../store");
|
|
47
|
+
const utils_2 = require("../utils");
|
|
48
|
+
/**
|
|
49
|
+
* 自闭合标签
|
|
50
|
+
*/
|
|
51
|
+
const selfClosingTag = [
|
|
52
|
+
'base',
|
|
53
|
+
'meta',
|
|
54
|
+
'area',
|
|
55
|
+
'embed',
|
|
56
|
+
'link',
|
|
57
|
+
'img',
|
|
58
|
+
'input',
|
|
59
|
+
'param',
|
|
60
|
+
'hr',
|
|
61
|
+
'br',
|
|
62
|
+
'source',
|
|
63
|
+
'track',
|
|
64
|
+
'wbr',
|
|
65
|
+
'col',
|
|
66
|
+
];
|
|
67
|
+
function genArgumentMemberExpression(arr) {
|
|
68
|
+
let expressionNode;
|
|
69
|
+
const propertyName = arr.pop();
|
|
70
|
+
if (arr.length >= 1) {
|
|
71
|
+
expressionNode = {
|
|
72
|
+
concept: 'MemberExpression',
|
|
73
|
+
name: '',
|
|
74
|
+
kind: 'Expression',
|
|
75
|
+
object: genArgumentMemberExpression(arr),
|
|
76
|
+
property: {
|
|
77
|
+
concept: 'Identifier',
|
|
78
|
+
kind: 'Expression',
|
|
79
|
+
name: propertyName,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return {
|
|
85
|
+
concept: 'Identifier',
|
|
86
|
+
kind: 'Expression',
|
|
87
|
+
name: propertyName,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return expressionNode;
|
|
91
|
+
}
|
|
92
|
+
function transAstNodeToNaslNode(astNode, namespace) {
|
|
93
|
+
let node = null;
|
|
94
|
+
if (astNode.type === 'CallExpression' && astNode.callee.object.name === '$utils') {
|
|
95
|
+
const calleeName = astNode.callee.property.name || astNode.callee.property.value;
|
|
96
|
+
const _arguments = astNode.arguments
|
|
97
|
+
.map((argument) => ({
|
|
98
|
+
concept: 'Argument',
|
|
99
|
+
name: '',
|
|
100
|
+
kind: 'Statement',
|
|
101
|
+
keyword: '',
|
|
102
|
+
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
103
|
+
}))
|
|
104
|
+
.filter((item) => item.expression), _typeArguments = astNode.arguments
|
|
105
|
+
.map((argument) => transAstNodeToNaslTypeNode(Object.assign({}, argument)))
|
|
106
|
+
.filter((item) => item);
|
|
107
|
+
node = {
|
|
108
|
+
concept: 'CallFunction',
|
|
109
|
+
name: '',
|
|
110
|
+
label: '调用内置函数',
|
|
111
|
+
kind: 'Expression',
|
|
112
|
+
calleeNamespace: 'nasl.util',
|
|
113
|
+
calleeName,
|
|
114
|
+
arguments: _arguments,
|
|
115
|
+
typeArguments: _typeArguments,
|
|
116
|
+
};
|
|
117
|
+
if (calleeName === 'Convert') {
|
|
118
|
+
node.arguments = [_arguments[0]];
|
|
119
|
+
if (_typeArguments.length === 0 && _arguments?.length === 2) {
|
|
120
|
+
node.typeArguments = [_arguments?.[1].expression];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (astNode.type === 'MemberExpression') {
|
|
125
|
+
if (astNode.object?.name === '$global') {
|
|
126
|
+
if (astNode.property?.name === 'userInfo') {
|
|
127
|
+
// 目前只有权限相关的
|
|
128
|
+
node = transAstNodeToNaslNode(astNode.property, 'nasl.auth');
|
|
129
|
+
}
|
|
130
|
+
else if (astNode.property?.name === 'frontendVariables') {
|
|
131
|
+
node = 'app.frontendVariables';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (astNode.object?.name === 'frontendVariables') {
|
|
135
|
+
node = transAstNodeToNaslNode(astNode.property, 'app.frontendVariables');
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const object = transAstNodeToNaslNode(astNode.object);
|
|
139
|
+
// object如果返回字符串,则将它当成namespace处理
|
|
140
|
+
if (Object.prototype.toString.call(object) === '[object String]') {
|
|
141
|
+
node = transAstNodeToNaslNode(astNode.property, object);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const property = transAstNodeToNaslNode(astNode.property);
|
|
145
|
+
node = {
|
|
146
|
+
concept: 'MemberExpression',
|
|
147
|
+
name: '',
|
|
148
|
+
kind: 'Expression',
|
|
149
|
+
object,
|
|
150
|
+
property,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else if (astNode.type === 'Identifier') {
|
|
156
|
+
node = {
|
|
157
|
+
concept: 'Identifier',
|
|
158
|
+
namespace: namespace || '',
|
|
159
|
+
name: astNode.name,
|
|
160
|
+
kind: 'Expression',
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
else if (astNode.type === 'ArrayExpression') {
|
|
164
|
+
node = {
|
|
165
|
+
concept: 'Unparsed',
|
|
166
|
+
label: '原子项',
|
|
167
|
+
code: astNode.value,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
else if (astNode.type === 'ObjectExpression') {
|
|
171
|
+
const properties = astNode.properties.map((property) => ({
|
|
172
|
+
key: property.key.value,
|
|
173
|
+
value: property.value.value,
|
|
174
|
+
}));
|
|
175
|
+
node = {};
|
|
176
|
+
properties.forEach((property) => {
|
|
177
|
+
node[property.key] = property.value;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else if (astNode.type === 'TemplateLiteral') {
|
|
181
|
+
// 模板字符串翻译成字符串插值
|
|
182
|
+
const { expressions, quasis } = astNode;
|
|
183
|
+
node = {
|
|
184
|
+
concept: 'StringInterpolation',
|
|
185
|
+
kind: 'Expression',
|
|
186
|
+
name: '',
|
|
187
|
+
expressions: [...(quasis || []), ...(expressions || [])]
|
|
188
|
+
.sort((node1, node2) => {
|
|
189
|
+
return node1.start - node2.start;
|
|
190
|
+
})
|
|
191
|
+
.map((node) => {
|
|
192
|
+
return transAstNodeToNaslNode(node);
|
|
193
|
+
}),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
else if (astNode.type === 'TemplateElement') {
|
|
197
|
+
node = {
|
|
198
|
+
concept: 'StringLiteral',
|
|
199
|
+
kind: 'Expression',
|
|
200
|
+
name: '',
|
|
201
|
+
value: astNode.value?.raw,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
else if (astNode.type === 'StringLiteral') {
|
|
205
|
+
// 单独特殊处理枚举因为他不是MemberExpression,而是Identifier_
|
|
206
|
+
if (astNode?.value?.startsWith('__enumTypeAnnotation_')) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
node = {
|
|
211
|
+
concept: 'StringLiteral',
|
|
212
|
+
kind: 'Expression',
|
|
213
|
+
name: '',
|
|
214
|
+
value: astNode.value,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else if (astNode.type === 'UnaryExpression') {
|
|
219
|
+
const argument = astNode.argument;
|
|
220
|
+
if (argument.type === 'NumericLiteral') {
|
|
221
|
+
node = {
|
|
222
|
+
concept: 'NumericLiteral',
|
|
223
|
+
value: astNode.operator + argument.value,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
node = {
|
|
228
|
+
concept: 'UnaryExpression',
|
|
229
|
+
kind: 'Expression',
|
|
230
|
+
name: '',
|
|
231
|
+
operator: astNode.operator,
|
|
232
|
+
argument: transAstNodeToNaslNode(astNode.argument),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else if (astNode.type === 'NumericLiteral') {
|
|
237
|
+
const numberString = typeof astNode.value === 'number' ? astNode.value.toString() : astNode.value;
|
|
238
|
+
node = {
|
|
239
|
+
concept: 'NumericLiteral',
|
|
240
|
+
value: numberString,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
else if (astNode.type === 'ArrowFunctionExpression') {
|
|
244
|
+
if (astNode.body?.callee?.name) {
|
|
245
|
+
astNode.name = astNode.body.callee.name;
|
|
246
|
+
}
|
|
247
|
+
let tempNode = {
|
|
248
|
+
calleeNamespace: 'app.logics',
|
|
249
|
+
concept: 'CallLogic',
|
|
250
|
+
namespace: namespace || '',
|
|
251
|
+
name: astNode.name,
|
|
252
|
+
calleeName: astNode.name,
|
|
253
|
+
kind: 'Expression',
|
|
254
|
+
parentNode: astNode.parentNode,
|
|
255
|
+
parentKey: astNode.parentKey,
|
|
256
|
+
arguments: astNode?.body?.arguments
|
|
257
|
+
?.map((argument) => ({
|
|
258
|
+
concept: 'Argument',
|
|
259
|
+
name: '',
|
|
260
|
+
kind: 'Statement',
|
|
261
|
+
keyword: '',
|
|
262
|
+
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
263
|
+
}))
|
|
264
|
+
.filter((item) => item.expression),
|
|
265
|
+
typeArguments: astNode?.body?.arguments
|
|
266
|
+
?.map((argument) => transAstNodeToNaslTypeNode(Object.assign({}, argument)))
|
|
267
|
+
.filter((item) => item),
|
|
268
|
+
};
|
|
269
|
+
node = Logic__1.Logic.from({
|
|
270
|
+
...tempNode,
|
|
271
|
+
}, undefined, 'logics');
|
|
272
|
+
}
|
|
273
|
+
else if (astNode.type === 'LogicalExpression' || astNode.type === 'BinaryExpression') {
|
|
274
|
+
node = {
|
|
275
|
+
concept: 'BinaryExpression',
|
|
276
|
+
operator: astNode.operator,
|
|
277
|
+
left: transAstNodeToNaslNode(astNode.left),
|
|
278
|
+
right: transAstNodeToNaslNode(astNode.right),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
node = astNode;
|
|
283
|
+
node.concept = astNode.type;
|
|
284
|
+
}
|
|
285
|
+
return node;
|
|
286
|
+
}
|
|
287
|
+
function transAstNodeToNaslTypeNode(astNode, namespace) {
|
|
288
|
+
let node = null;
|
|
289
|
+
// 单独特殊处理枚举因为他不是MemberExpression,而是Identifier_
|
|
290
|
+
if (astNode?.value?.startsWith?.('__enumTypeAnnotation_')) {
|
|
291
|
+
const valueArr = astNode.value.replace('__enumTypeAnnotation_', '')?.split('.');
|
|
292
|
+
const name = valueArr.pop();
|
|
293
|
+
const namespace = valueArr.join('.');
|
|
294
|
+
node = {
|
|
295
|
+
concept: 'TypeAnnotation',
|
|
296
|
+
typeNamespace: namespace || '',
|
|
297
|
+
typeName: name || '',
|
|
298
|
+
typeKind: 'reference',
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return node;
|
|
302
|
+
}
|
|
303
|
+
function isLockField(node) {
|
|
304
|
+
if (!node || node.concept !== 'ViewElement')
|
|
305
|
+
return false;
|
|
306
|
+
const attr = node?.bindAttrs?.find((attr) => ['FormDesignerLocked', 'TableDesignerLocked'].includes(attr.name))?.value;
|
|
307
|
+
if (attr === undefined)
|
|
308
|
+
return !!isLockField(node?.parentNode);
|
|
309
|
+
else
|
|
310
|
+
return !!attr;
|
|
311
|
+
}
|
|
312
|
+
const decorators_1 = require("../decorators");
|
|
313
|
+
const utils_3 = require("../utils");
|
|
314
|
+
const utils = __importStar(require("../utils"));
|
|
315
|
+
const asserts = __importStar(require("./utils/asserts"));
|
|
316
|
+
const Annotatable__1 = __importDefault(require("./Annotatable__"));
|
|
317
|
+
/**
|
|
318
|
+
* 页面元素
|
|
319
|
+
*/
|
|
320
|
+
let ViewElement = class ViewElement extends Annotatable__1.default {
|
|
321
|
+
static { ViewElement_1 = this; }
|
|
322
|
+
/** 类名 */
|
|
323
|
+
static { this.ConceptName = 'ViewElement'; }
|
|
324
|
+
/**
|
|
325
|
+
* 是否为抽象类
|
|
326
|
+
* 抽象类不能产生 concept: string
|
|
327
|
+
*/
|
|
328
|
+
static { this.isAbstract = false; }
|
|
329
|
+
/** 继承链 */
|
|
330
|
+
static { this.inheritanceChain = ['Annotatable', 'BaseNode']; }
|
|
331
|
+
/**
|
|
332
|
+
* @param source 需要合并的部分参数
|
|
333
|
+
*/
|
|
334
|
+
constructor(source) {
|
|
335
|
+
source = Object.assign({}, ViewElement_1.getDefaultOptions(), source);
|
|
336
|
+
super(source);
|
|
337
|
+
/**
|
|
338
|
+
* 页面元素名称
|
|
339
|
+
*/
|
|
340
|
+
this.name = '';
|
|
341
|
+
/**
|
|
342
|
+
* 元素绑定属性列表
|
|
343
|
+
*/
|
|
344
|
+
this.bindAttrs = [];
|
|
345
|
+
/**
|
|
346
|
+
* 元素绑定事件列表
|
|
347
|
+
*/
|
|
348
|
+
this.bindEvents = [];
|
|
349
|
+
/**
|
|
350
|
+
* 元素指令列表
|
|
351
|
+
*/
|
|
352
|
+
this.bindDirectives = [];
|
|
353
|
+
/**
|
|
354
|
+
* 绑定的角色
|
|
355
|
+
*/
|
|
356
|
+
this.bindRoles = [];
|
|
357
|
+
/**
|
|
358
|
+
* 元素绑定样式列表
|
|
359
|
+
*/
|
|
360
|
+
this.bindStyles = [];
|
|
361
|
+
/**
|
|
362
|
+
* 子元素列表
|
|
363
|
+
*/
|
|
364
|
+
this.children = [];
|
|
365
|
+
this.computedStyle = {};
|
|
366
|
+
super.subConstructor(source);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* 设置页面元素名称
|
|
370
|
+
*/
|
|
371
|
+
setName(name) {
|
|
372
|
+
const object = {
|
|
373
|
+
name,
|
|
374
|
+
};
|
|
375
|
+
this.update({
|
|
376
|
+
...object,
|
|
377
|
+
field: 'name',
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* 设置静态 style
|
|
382
|
+
*/
|
|
383
|
+
setStaticStyle(staticStyle) {
|
|
384
|
+
const object = {
|
|
385
|
+
staticStyle,
|
|
386
|
+
};
|
|
387
|
+
this.update({
|
|
388
|
+
...object,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* 设置权限资源描述
|
|
393
|
+
*/
|
|
394
|
+
setAuthDescription(authDescription) {
|
|
395
|
+
const object = {
|
|
396
|
+
authDescription,
|
|
397
|
+
};
|
|
398
|
+
this.update({
|
|
399
|
+
...object,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
getBindAttributeExistingNames(excludedList = []) {
|
|
403
|
+
const excludedSet = new Set(excludedList);
|
|
404
|
+
return (this.bindAttrs || [])
|
|
405
|
+
.filter((item) => !excludedSet.has(item))
|
|
406
|
+
.map((item) => item.name);
|
|
407
|
+
}
|
|
408
|
+
getBindAttributeUniqueName(name = 'bindAttribute1') {
|
|
409
|
+
return utils.unique(name, this.getBindAttributeExistingNames(), undefined, false);
|
|
410
|
+
}
|
|
411
|
+
_insertBindAttributeAt(options, index) {
|
|
412
|
+
const bindAttributeOptions = {};
|
|
413
|
+
const relationOptions = { parentNode: this, parentKey: 'bindAttrs' };
|
|
414
|
+
const BindAttribute = (0, decorators_1.getConceptConstructor)('BindAttribute');
|
|
415
|
+
let bindAttribute;
|
|
416
|
+
if (!options) {
|
|
417
|
+
bindAttribute = BindAttribute.from({
|
|
418
|
+
...bindAttributeOptions,
|
|
419
|
+
name: this.getBindAttributeUniqueName(),
|
|
420
|
+
}, this, 'bindAttrs');
|
|
421
|
+
}
|
|
422
|
+
else if (typeof options === 'string') {
|
|
423
|
+
bindAttribute = BindAttribute.from({
|
|
424
|
+
...bindAttributeOptions,
|
|
425
|
+
name: options,
|
|
426
|
+
}, this, 'bindAttrs');
|
|
427
|
+
}
|
|
428
|
+
else if (asserts.isBindAttribute(options)) {
|
|
429
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
430
|
+
bindAttribute = options;
|
|
431
|
+
Object.assign(bindAttribute, relationOptions);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
bindAttribute = BindAttribute.from({
|
|
435
|
+
...bindAttributeOptions,
|
|
436
|
+
...options,
|
|
437
|
+
}, this, 'bindAttrs');
|
|
438
|
+
}
|
|
439
|
+
this.bindAttrs.splice(index, 0, bindAttribute);
|
|
440
|
+
return bindAttribute;
|
|
441
|
+
}
|
|
442
|
+
insertBindAttributeAt(options, index) {
|
|
443
|
+
const node = this._insertBindAttributeAt(options, index);
|
|
444
|
+
node.create({
|
|
445
|
+
index,
|
|
446
|
+
parentNode: this,
|
|
447
|
+
parentKey: 'bindAttrs',
|
|
448
|
+
});
|
|
449
|
+
return node;
|
|
450
|
+
}
|
|
451
|
+
_addBindAttribute(options) {
|
|
452
|
+
const index = this.bindAttrs.length;
|
|
453
|
+
return this._insertBindAttributeAt(options, index);
|
|
454
|
+
}
|
|
455
|
+
addBindAttribute(options) {
|
|
456
|
+
const node = this._addBindAttribute(options);
|
|
457
|
+
const index = this.bindAttrs.indexOf(node);
|
|
458
|
+
node.create({
|
|
459
|
+
index,
|
|
460
|
+
parentNode: this,
|
|
461
|
+
parentKey: 'bindAttrs',
|
|
462
|
+
});
|
|
463
|
+
return node;
|
|
464
|
+
}
|
|
465
|
+
getBindEventExistingNames(excludedList = []) {
|
|
466
|
+
const excludedSet = new Set(excludedList);
|
|
467
|
+
return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
468
|
+
}
|
|
469
|
+
getBindEventUniqueName(name = 'bindEvent1') {
|
|
470
|
+
return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
|
|
471
|
+
}
|
|
472
|
+
_insertBindEventAt(options, index) {
|
|
473
|
+
const bindEventOptions = {};
|
|
474
|
+
const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
|
|
475
|
+
const BindEvent = (0, decorators_1.getConceptConstructor)('BindEvent');
|
|
476
|
+
let bindEvent;
|
|
477
|
+
if (!options) {
|
|
478
|
+
bindEvent = BindEvent.from({
|
|
479
|
+
...bindEventOptions,
|
|
480
|
+
name: this.getBindEventUniqueName(),
|
|
481
|
+
}, this, 'bindEvents');
|
|
482
|
+
}
|
|
483
|
+
else if (typeof options === 'string') {
|
|
484
|
+
bindEvent = BindEvent.from({
|
|
485
|
+
...bindEventOptions,
|
|
486
|
+
name: options,
|
|
487
|
+
}, this, 'bindEvents');
|
|
488
|
+
}
|
|
489
|
+
else if (asserts.isBindEvent(options)) {
|
|
490
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
491
|
+
bindEvent = options;
|
|
492
|
+
Object.assign(bindEvent, relationOptions);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
bindEvent = BindEvent.from({
|
|
496
|
+
...bindEventOptions,
|
|
497
|
+
...options,
|
|
498
|
+
}, this, 'bindEvents');
|
|
499
|
+
}
|
|
500
|
+
this.bindEvents.splice(index, 0, bindEvent);
|
|
501
|
+
return bindEvent;
|
|
502
|
+
}
|
|
503
|
+
insertBindEventAt(options, index) {
|
|
504
|
+
const node = this._insertBindEventAt(options, index);
|
|
505
|
+
node.create({
|
|
506
|
+
index,
|
|
507
|
+
parentNode: this,
|
|
508
|
+
parentKey: 'bindEvents',
|
|
509
|
+
});
|
|
510
|
+
return node;
|
|
511
|
+
}
|
|
512
|
+
_addBindEvent(options) {
|
|
513
|
+
const index = this.bindEvents.length;
|
|
514
|
+
return this._insertBindEventAt(options, index);
|
|
515
|
+
}
|
|
516
|
+
addBindEvent(options) {
|
|
517
|
+
const node = this._addBindEvent(options);
|
|
518
|
+
const index = this.bindEvents.indexOf(node);
|
|
519
|
+
node.create({
|
|
520
|
+
index,
|
|
521
|
+
parentNode: this,
|
|
522
|
+
parentKey: 'bindEvents',
|
|
523
|
+
});
|
|
524
|
+
return node;
|
|
525
|
+
}
|
|
526
|
+
getBindDirectiveExistingNames(excludedList = []) {
|
|
527
|
+
const excludedSet = new Set(excludedList);
|
|
528
|
+
return (this.bindDirectives || [])
|
|
529
|
+
.filter((item) => !excludedSet.has(item))
|
|
530
|
+
.map((item) => item.name);
|
|
531
|
+
}
|
|
532
|
+
getBindDirectiveUniqueName(name = 'bindDirective1') {
|
|
533
|
+
return utils.unique(name, this.getBindDirectiveExistingNames(), undefined, false);
|
|
534
|
+
}
|
|
535
|
+
_insertBindDirectiveAt(options, index) {
|
|
536
|
+
const bindDirectiveOptions = {};
|
|
537
|
+
const relationOptions = { parentNode: this, parentKey: 'bindDirectives' };
|
|
538
|
+
const BindDirective = (0, decorators_1.getConceptConstructor)('BindDirective');
|
|
539
|
+
let bindDirective;
|
|
540
|
+
if (!options) {
|
|
541
|
+
bindDirective = BindDirective.from({
|
|
542
|
+
...bindDirectiveOptions,
|
|
543
|
+
name: this.getBindDirectiveUniqueName(),
|
|
544
|
+
}, this, 'bindDirectives');
|
|
545
|
+
}
|
|
546
|
+
else if (typeof options === 'string') {
|
|
547
|
+
bindDirective = BindDirective.from({
|
|
548
|
+
...bindDirectiveOptions,
|
|
549
|
+
name: options,
|
|
550
|
+
}, this, 'bindDirectives');
|
|
551
|
+
}
|
|
552
|
+
else if (asserts.isBindDirective(options)) {
|
|
553
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
554
|
+
bindDirective = options;
|
|
555
|
+
Object.assign(bindDirective, relationOptions);
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
bindDirective = BindDirective.from({
|
|
559
|
+
...bindDirectiveOptions,
|
|
560
|
+
...options,
|
|
561
|
+
}, this, 'bindDirectives');
|
|
562
|
+
}
|
|
563
|
+
this.bindDirectives.splice(index, 0, bindDirective);
|
|
564
|
+
return bindDirective;
|
|
565
|
+
}
|
|
566
|
+
insertBindDirectiveAt(options, index) {
|
|
567
|
+
const node = this._insertBindDirectiveAt(options, index);
|
|
568
|
+
node.create({
|
|
569
|
+
index,
|
|
570
|
+
parentNode: this,
|
|
571
|
+
parentKey: 'bindDirectives',
|
|
572
|
+
});
|
|
573
|
+
return node;
|
|
574
|
+
}
|
|
575
|
+
_addBindDirective(options) {
|
|
576
|
+
const index = this.bindDirectives.length;
|
|
577
|
+
return this._insertBindDirectiveAt(options, index);
|
|
578
|
+
}
|
|
579
|
+
addBindDirective(options) {
|
|
580
|
+
const node = this._addBindDirective(options);
|
|
581
|
+
const index = this.bindDirectives.indexOf(node);
|
|
582
|
+
node.create({
|
|
583
|
+
index,
|
|
584
|
+
parentNode: this,
|
|
585
|
+
parentKey: 'bindDirectives',
|
|
586
|
+
});
|
|
587
|
+
return node;
|
|
588
|
+
}
|
|
589
|
+
getBindStyleExistingNames(excludedList = []) {
|
|
590
|
+
const excludedSet = new Set(excludedList);
|
|
591
|
+
return (this.bindStyles || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
592
|
+
}
|
|
593
|
+
getBindStyleUniqueName(name = 'bindStyle1') {
|
|
594
|
+
return utils.unique(name, this.getBindStyleExistingNames(), undefined, false);
|
|
595
|
+
}
|
|
596
|
+
_insertBindStyleAt(options, index) {
|
|
597
|
+
const bindStyleOptions = {};
|
|
598
|
+
const relationOptions = { parentNode: this, parentKey: 'bindStyles' };
|
|
599
|
+
const BindStyle = (0, decorators_1.getConceptConstructor)('BindStyle');
|
|
600
|
+
let bindStyle;
|
|
601
|
+
if (!options) {
|
|
602
|
+
bindStyle = BindStyle.from({
|
|
603
|
+
...bindStyleOptions,
|
|
604
|
+
name: this.getBindStyleUniqueName(),
|
|
605
|
+
}, this, 'bindStyles');
|
|
606
|
+
}
|
|
607
|
+
else if (typeof options === 'string') {
|
|
608
|
+
bindStyle = BindStyle.from({
|
|
609
|
+
...bindStyleOptions,
|
|
610
|
+
name: options,
|
|
611
|
+
}, this, 'bindStyles');
|
|
612
|
+
}
|
|
613
|
+
else if (asserts.isBindStyle(options)) {
|
|
614
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
615
|
+
bindStyle = options;
|
|
616
|
+
Object.assign(bindStyle, relationOptions);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
bindStyle = BindStyle.from({
|
|
620
|
+
...bindStyleOptions,
|
|
621
|
+
...options,
|
|
622
|
+
}, this, 'bindStyles');
|
|
623
|
+
}
|
|
624
|
+
this.bindStyles.splice(index, 0, bindStyle);
|
|
625
|
+
return bindStyle;
|
|
626
|
+
}
|
|
627
|
+
insertBindStyleAt(options, index) {
|
|
628
|
+
const node = this._insertBindStyleAt(options, index);
|
|
629
|
+
node.create({
|
|
630
|
+
index,
|
|
631
|
+
parentNode: this,
|
|
632
|
+
parentKey: 'bindStyles',
|
|
633
|
+
});
|
|
634
|
+
return node;
|
|
635
|
+
}
|
|
636
|
+
_addBindStyle(options) {
|
|
637
|
+
const index = this.bindStyles.length;
|
|
638
|
+
return this._insertBindStyleAt(options, index);
|
|
639
|
+
}
|
|
640
|
+
addBindStyle(options) {
|
|
641
|
+
const node = this._addBindStyle(options);
|
|
642
|
+
const index = this.bindStyles.indexOf(node);
|
|
643
|
+
node.create({
|
|
644
|
+
index,
|
|
645
|
+
parentNode: this,
|
|
646
|
+
parentKey: 'bindStyles',
|
|
647
|
+
});
|
|
648
|
+
return node;
|
|
649
|
+
}
|
|
650
|
+
_insertViewElementAt(options, index) {
|
|
651
|
+
const viewElementOptions = {};
|
|
652
|
+
const relationOptions = { parentNode: this, parentKey: 'children' };
|
|
653
|
+
const ViewElement = (0, decorators_1.getConceptConstructor)('ViewElement');
|
|
654
|
+
let viewElement;
|
|
655
|
+
if (!options) {
|
|
656
|
+
viewElement = ViewElement.from({
|
|
657
|
+
...viewElementOptions,
|
|
658
|
+
name: this.getViewElementUniqueName(),
|
|
659
|
+
}, this, 'children');
|
|
660
|
+
}
|
|
661
|
+
else if (typeof options === 'string') {
|
|
662
|
+
viewElement = ViewElement.from({
|
|
663
|
+
...viewElementOptions,
|
|
664
|
+
name: options,
|
|
665
|
+
}, this, 'children');
|
|
666
|
+
}
|
|
667
|
+
else if (asserts.isViewElement(options)) {
|
|
668
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
669
|
+
viewElement = options;
|
|
670
|
+
Object.assign(viewElement, relationOptions);
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
viewElement = ViewElement.from({
|
|
674
|
+
...viewElementOptions,
|
|
675
|
+
...options,
|
|
676
|
+
}, this, 'children');
|
|
677
|
+
}
|
|
678
|
+
this.children.splice(index, 0, viewElement);
|
|
679
|
+
return viewElement;
|
|
680
|
+
}
|
|
681
|
+
insertViewElementAt(options, index) {
|
|
682
|
+
const node = this._insertViewElementAt(options, index);
|
|
683
|
+
node.create({
|
|
684
|
+
index,
|
|
685
|
+
parentNode: this,
|
|
686
|
+
parentKey: 'children',
|
|
687
|
+
});
|
|
688
|
+
return node;
|
|
689
|
+
}
|
|
690
|
+
_addViewElement(options) {
|
|
691
|
+
const index = this.children.length;
|
|
692
|
+
return this._insertViewElementAt(options, index);
|
|
693
|
+
}
|
|
694
|
+
addViewElement(options) {
|
|
695
|
+
const node = this._addViewElement(options);
|
|
696
|
+
const index = this.children.indexOf(node);
|
|
697
|
+
node.create({
|
|
698
|
+
index,
|
|
699
|
+
parentNode: this,
|
|
700
|
+
parentKey: 'children',
|
|
701
|
+
});
|
|
702
|
+
return node;
|
|
703
|
+
}
|
|
704
|
+
removeBindAttribute(options) {
|
|
705
|
+
let bindAttribute;
|
|
706
|
+
if (typeof options === 'string') {
|
|
707
|
+
bindAttribute = this.bindAttrs.find((item) => item.name === options);
|
|
708
|
+
if (!bindAttribute) {
|
|
709
|
+
throw new Error('找不到元素绑定属性 ' + options);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
bindAttribute = options;
|
|
714
|
+
}
|
|
715
|
+
return bindAttribute.delete();
|
|
716
|
+
}
|
|
717
|
+
removeBindEvent(options) {
|
|
718
|
+
let bindEvent;
|
|
719
|
+
if (typeof options === 'string') {
|
|
720
|
+
bindEvent = this.bindEvents.find((item) => item.name === options);
|
|
721
|
+
if (!bindEvent) {
|
|
722
|
+
throw new Error('找不到元素绑定事件 ' + options);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
bindEvent = options;
|
|
727
|
+
}
|
|
728
|
+
return bindEvent.delete();
|
|
729
|
+
}
|
|
730
|
+
removeBindDirective(options) {
|
|
731
|
+
let bindDirective;
|
|
732
|
+
if (typeof options === 'string') {
|
|
733
|
+
bindDirective = this.bindDirectives.find((item) => item.name === options);
|
|
734
|
+
if (!bindDirective) {
|
|
735
|
+
throw new Error('找不到元素指令 ' + options);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
bindDirective = options;
|
|
740
|
+
}
|
|
741
|
+
return bindDirective.delete();
|
|
742
|
+
}
|
|
743
|
+
removeBindStyle(options) {
|
|
744
|
+
let bindStyle;
|
|
745
|
+
if (typeof options === 'string') {
|
|
746
|
+
bindStyle = this.bindStyles.find((item) => item.name === options);
|
|
747
|
+
if (!bindStyle) {
|
|
748
|
+
throw new Error('找不到元素绑定样式 ' + options);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
bindStyle = options;
|
|
753
|
+
}
|
|
754
|
+
return bindStyle.delete();
|
|
755
|
+
}
|
|
756
|
+
removeViewElement(options) {
|
|
757
|
+
let viewElement;
|
|
758
|
+
if (typeof options === 'string') {
|
|
759
|
+
viewElement = this.children.find((item) => item.name === options);
|
|
760
|
+
if (!viewElement) {
|
|
761
|
+
throw new Error('找不到页面元素 ' + options);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
viewElement = options;
|
|
766
|
+
}
|
|
767
|
+
return viewElement.delete();
|
|
768
|
+
}
|
|
769
|
+
//================================================================================
|
|
770
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
771
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
772
|
+
//================================================================================
|
|
773
|
+
/**
|
|
774
|
+
* 祖先 View
|
|
775
|
+
*/
|
|
776
|
+
get view() {
|
|
777
|
+
return this.getAncestor('View');
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* 祖先 Module
|
|
781
|
+
*/
|
|
782
|
+
get module() {
|
|
783
|
+
return this.getAncestor('Module');
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* 祖先 Frontend
|
|
787
|
+
*/
|
|
788
|
+
get frontend() {
|
|
789
|
+
return this.getAncestor('Frontend');
|
|
790
|
+
}
|
|
791
|
+
get likeComponent() {
|
|
792
|
+
return this.view || this?.getAncestor('BusinessComponent');
|
|
793
|
+
}
|
|
794
|
+
/* 主页面有没有权限 */
|
|
795
|
+
get parentAuth() {
|
|
796
|
+
const _nameSpace = this.view.getNamespace();
|
|
797
|
+
const mainViewName = _nameSpace.split('.')[2];
|
|
798
|
+
return this.view.parentNode.concept === 'App'
|
|
799
|
+
? this.view.auth
|
|
800
|
+
: this.frontend.views.find((item) => item.name === mainViewName)?.auth;
|
|
801
|
+
}
|
|
802
|
+
// IDE内展示需要屏蔽掉“系统统一路径前缀”
|
|
803
|
+
get uiPath() {
|
|
804
|
+
return `${this.view.uiPath}/${this.name}`;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* 权限领域的资源路径
|
|
808
|
+
*/
|
|
809
|
+
get authPath() {
|
|
810
|
+
return `${this.view.path}/${this.name}`;
|
|
811
|
+
}
|
|
812
|
+
get auth() {
|
|
813
|
+
return this.bindDirectives.find((directive) => directive.name === 'auth');
|
|
814
|
+
}
|
|
815
|
+
getViewElementUniqueName(name = 'viewElement1') {
|
|
816
|
+
return this.likeComponent?.getViewElementUniqueName(name);
|
|
817
|
+
}
|
|
818
|
+
getViewElementUniqueNameOld(name = 'viewElement1') {
|
|
819
|
+
return this.likeComponent?.getViewElementUniqueNameOld(name);
|
|
820
|
+
}
|
|
821
|
+
static { this.TAG_NAME_PREFIX_REG = /^([lieu]|van)[-_]/; }
|
|
822
|
+
static from(source, parentNode, parentKey) {
|
|
823
|
+
const node = super.from(source, parentNode, parentKey);
|
|
824
|
+
if (!node.name) {
|
|
825
|
+
const tagName = node.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
826
|
+
node.name = node.getViewElementUniqueName(`${tagName}1`);
|
|
827
|
+
}
|
|
828
|
+
return node;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* 设置组件权限
|
|
832
|
+
*/
|
|
833
|
+
setBindRoles(bindRoles) {
|
|
834
|
+
const object = {
|
|
835
|
+
bindRoles,
|
|
836
|
+
};
|
|
837
|
+
this.update({
|
|
838
|
+
...object,
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
getBindAttribute(name) {
|
|
842
|
+
return this.bindAttrs.find((bindAttr) => bindAttr.name === name);
|
|
843
|
+
}
|
|
844
|
+
getBindDirective(name) {
|
|
845
|
+
return this.bindDirectives.find((bindDirective) => bindDirective.name === name);
|
|
846
|
+
}
|
|
847
|
+
getBindStyle(name) {
|
|
848
|
+
return this.bindStyles.find((bindStyle) => bindStyle.name === name);
|
|
849
|
+
}
|
|
850
|
+
toHump(name) {
|
|
851
|
+
return name.replace(/-(\w)/g, (all, letter) => letter.toUpperCase());
|
|
852
|
+
}
|
|
853
|
+
toFirstUpper(name) {
|
|
854
|
+
return name.replace(/^\S/, (s) => s.toUpperCase());
|
|
855
|
+
}
|
|
856
|
+
haveScope() {
|
|
857
|
+
return Boolean(this.slotScope);
|
|
858
|
+
}
|
|
859
|
+
getGenericTypes(tag) {
|
|
860
|
+
let T;
|
|
861
|
+
let V;
|
|
862
|
+
let P;
|
|
863
|
+
let M;
|
|
864
|
+
let T1;
|
|
865
|
+
let C;
|
|
866
|
+
const genericTypes = [];
|
|
867
|
+
const config = (0, store_2.getConfig)();
|
|
868
|
+
if (config?.allNodesAPI[tag]) {
|
|
869
|
+
const { tsTypeParams = '', props } = config?.allNodesAPI[tag];
|
|
870
|
+
const hasDataSource = props?.findIndex((prop) => ['dataSource', 'data-source'].includes(prop.name)) > -1;
|
|
871
|
+
let tsTypes = [];
|
|
872
|
+
if (tsTypeParams) {
|
|
873
|
+
tsTypes = tsTypeParams?.split(',');
|
|
874
|
+
}
|
|
875
|
+
else if (hasDataSource) {
|
|
876
|
+
tsTypes = ['T'];
|
|
877
|
+
}
|
|
878
|
+
tsTypes.forEach((item) => {
|
|
879
|
+
const reg = /^(\w+)\s?/;
|
|
880
|
+
const result = reg.exec(item.trim());
|
|
881
|
+
const t = result?.[1];
|
|
882
|
+
if (t === 'T') {
|
|
883
|
+
T = true;
|
|
884
|
+
genericTypes.push('__item');
|
|
885
|
+
}
|
|
886
|
+
if (t === 'V') {
|
|
887
|
+
V = true;
|
|
888
|
+
genericTypes.push('__V');
|
|
889
|
+
}
|
|
890
|
+
if (t === 'P') {
|
|
891
|
+
P = true;
|
|
892
|
+
genericTypes.push('__pageable');
|
|
893
|
+
}
|
|
894
|
+
if (t === 'M') {
|
|
895
|
+
M = true;
|
|
896
|
+
genericTypes.push('__multiple');
|
|
897
|
+
}
|
|
898
|
+
if (t === 'C') {
|
|
899
|
+
C = true;
|
|
900
|
+
genericTypes.push('__converter');
|
|
901
|
+
}
|
|
902
|
+
if (t === 'T1') {
|
|
903
|
+
T1 = true;
|
|
904
|
+
genericTypes.push('__columnItem');
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
return {
|
|
909
|
+
T,
|
|
910
|
+
V,
|
|
911
|
+
P,
|
|
912
|
+
M,
|
|
913
|
+
T1,
|
|
914
|
+
C,
|
|
915
|
+
genericTypes,
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
*toEmbeddedTSDefinition(state = (0, nasl_translator_1.createCompilerState)()) {
|
|
919
|
+
const self = this;
|
|
920
|
+
const config = (0, store_2.getConfig)();
|
|
921
|
+
let code = '';
|
|
922
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
|
|
923
|
+
if (self.isCorrespondingBusinessComponent) {
|
|
924
|
+
code += `${self.name}: ${self.correspondingBusinessComponentNamespace}.${self.tag.replace('bs-', '')};\n`;
|
|
925
|
+
}
|
|
926
|
+
else if (self.toHump(self.tag) === 'lcapLogin' || self.staticClass === 'login-form') {
|
|
927
|
+
// 登录组件不翻译
|
|
928
|
+
code += `${self.name}: nasl.ui.Div;\n`;
|
|
929
|
+
}
|
|
930
|
+
else if (config?.allNodesAPI[self.tag]) {
|
|
931
|
+
const { T, V, P, M, T1, C, genericTypes } = this.getGenericTypes(self.tag);
|
|
932
|
+
code += `${self.name}: nasl.ui.${utils.kebab2Pascal(self.tag)}`;
|
|
933
|
+
if (genericTypes.length > 0) {
|
|
934
|
+
code += `<`;
|
|
935
|
+
code += genericTypes.map((i) => `typeof __elementsRef.${self.name}.${i}`).join(', ');
|
|
936
|
+
code += `>`;
|
|
937
|
+
}
|
|
938
|
+
code += ';\n';
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
code += `${self.name}: nasl.ui.${utils.kebab2Pascal(self.tag)};\n`;
|
|
942
|
+
}
|
|
943
|
+
if (Array.isArray(self.children)) {
|
|
944
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.children, function* warpForEachGenerator(element) {
|
|
945
|
+
code += yield* element.toEmbeddedTSDefinition((0, nasl_translator_1.shiftState)(state, code));
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
return code;
|
|
949
|
+
}
|
|
950
|
+
toEmbeddedTSRefPath(elementsPathMap) {
|
|
951
|
+
const self = this;
|
|
952
|
+
if (asserts.isViewElement(self.parentNode)) {
|
|
953
|
+
elementsPathMap[self.name] = `${elementsPathMap[self.parentNode.name]}.${self.name}`;
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
elementsPathMap[self.name] = `${self.name}`;
|
|
957
|
+
}
|
|
958
|
+
if (Array.isArray(self.children)) {
|
|
959
|
+
self.children.forEach((element) => {
|
|
960
|
+
element.toEmbeddedTSRefPath(elementsPathMap);
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
*toEmbeddedTSRefTree(state = (0, nasl_translator_1.createCompilerState)(), options, parentLevel) {
|
|
965
|
+
const self = this;
|
|
966
|
+
const { elementsPathMap } = options;
|
|
967
|
+
const { T, V, P, M, T1, C } = this.getGenericTypes(self.tag);
|
|
968
|
+
let code = '';
|
|
969
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
970
|
+
let levelIndex = parentLevel || 0;
|
|
971
|
+
code += `${self.name}: () => {\n`;
|
|
972
|
+
const getPropInitialValue = (name) => {
|
|
973
|
+
let v = 'new nasl.core.BooleanFalse()';
|
|
974
|
+
const attr = self.bindAttrs?.find((attr) => attr.name === name);
|
|
975
|
+
if (['static', 'string'].includes(attr?.type)) {
|
|
976
|
+
v = attr.value ? 'new nasl.core.BooleanTrue()' : 'new nasl.core.BooleanFalse()';
|
|
977
|
+
}
|
|
978
|
+
return v;
|
|
979
|
+
};
|
|
980
|
+
const getConverterDefaultValue = (name) => {
|
|
981
|
+
let v = 'new nasl.core.StringLiteral<``>()';
|
|
982
|
+
const attr = self.bindAttrs?.find((attr) => attr.name === name);
|
|
983
|
+
if (['static', 'string'].includes(attr?.type)) {
|
|
984
|
+
if ([true, 'true'].includes(attr.value)) {
|
|
985
|
+
v = 'new nasl.core.BooleanTrue()';
|
|
986
|
+
}
|
|
987
|
+
else if ([false, 'false'].includes(attr.value)) {
|
|
988
|
+
v = 'new nasl.core.BooleanFalse()';
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
v = `new nasl.core.StringLiteral<\`${attr.value}\`>()`;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return v;
|
|
995
|
+
};
|
|
996
|
+
const config = (0, store_2.getConfig)();
|
|
997
|
+
const hasDataSource = config?.allNodesAPI?.[self.tag]?.props?.findIndex((prop) => ['dataSource', 'data-source'].includes(prop.name)) >
|
|
998
|
+
-1;
|
|
999
|
+
let dataSourceSetted = false;
|
|
1000
|
+
let staticItem = '';
|
|
1001
|
+
// 有数据源属性的组件 才需要生成 item
|
|
1002
|
+
if (hasDataSource && T) {
|
|
1003
|
+
const key = T1 ? '__columnItem' : '__item';
|
|
1004
|
+
const dataSourceAttr = self.bindAttrs?.find((attr) => attr.name === 'dataSource');
|
|
1005
|
+
if (dataSourceAttr?.expression) {
|
|
1006
|
+
dataSourceSetted = true;
|
|
1007
|
+
if (asserts.isMemberExpression(dataSourceAttr.expression) ||
|
|
1008
|
+
asserts.isIdentifier(dataSourceAttr.expression) ||
|
|
1009
|
+
(asserts.isCallLogic(dataSourceAttr.expression) &&
|
|
1010
|
+
!dataSourceAttr.expression?.calleeNamespace?.startsWith('extensions'))) {
|
|
1011
|
+
const value = yield* dataSourceAttr.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, dataSourceAttr.expression.concept === 'CallLogic'
|
|
1012
|
+
? {
|
|
1013
|
+
tabSize: 4,
|
|
1014
|
+
inline: true,
|
|
1015
|
+
noNeedParams: true,
|
|
1016
|
+
// 业务组件需要特殊处理
|
|
1017
|
+
inElementsRefTree: true,
|
|
1018
|
+
isVariableHost: true,
|
|
1019
|
+
isDataSource: true,
|
|
1020
|
+
}
|
|
1021
|
+
: {
|
|
1022
|
+
// 业务组件需要特殊处理
|
|
1023
|
+
inElementsRefTree: true,
|
|
1024
|
+
isVariableHost: true,
|
|
1025
|
+
isDataSource: true,
|
|
1026
|
+
}));
|
|
1027
|
+
// 用别的组件的data当数据源
|
|
1028
|
+
if (dataSourceAttr.expression?.property?.name === 'data' &&
|
|
1029
|
+
dataSourceAttr.expression?.object?.namespace?.startsWith('elements.')) {
|
|
1030
|
+
const componentName = (dataSourceAttr.expression?.object).name;
|
|
1031
|
+
const componentPath = elementsPathMap[componentName]?.split('.');
|
|
1032
|
+
const component = componentPath?.reduce((prev, cur) => {
|
|
1033
|
+
return `${prev}.children.${cur}()`;
|
|
1034
|
+
}, 'elementsRefTree()');
|
|
1035
|
+
if (component) {
|
|
1036
|
+
code += `let t = ${component}.__item;\n`;
|
|
1037
|
+
code += `let ${key}: typeof t;\n`;
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
code += `let ${key}: any;\n`;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
else {
|
|
1044
|
+
// 业务组件需要特殊处理
|
|
1045
|
+
if (self.businessComponent) {
|
|
1046
|
+
code += `let __${this.businessComponent.name}: ${this.businessComponent.name};\n`;
|
|
1047
|
+
}
|
|
1048
|
+
code += `let ${key}: nasl.ui.GetItemTypeFromDataSource<typeof ${value}>;\n`;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
else {
|
|
1052
|
+
const returnCode = yield* dataSourceAttr.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code));
|
|
1053
|
+
code += `const _load = () => { return `;
|
|
1054
|
+
code += returnCode;
|
|
1055
|
+
code += '};\n';
|
|
1056
|
+
code += `let ${key}: nasl.ui.GetItemTypeFromDataSource<ReturnType<typeof _load>>;\n`;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
// 根据静态子节点生成类型
|
|
1061
|
+
const attrs = {
|
|
1062
|
+
'u-checkbox': 'label',
|
|
1063
|
+
'u-radio': 'label',
|
|
1064
|
+
'van-radio': 'name',
|
|
1065
|
+
'van-checkbox': 'label',
|
|
1066
|
+
};
|
|
1067
|
+
const child = self.children?.filter((item) => item.tag !== 'template')[0];
|
|
1068
|
+
if (child) {
|
|
1069
|
+
const valueAttr = child.bindAttrs?.find((attr) => attr.name === (attrs[child.tag] || 'value'));
|
|
1070
|
+
if (valueAttr) {
|
|
1071
|
+
// 开启了绑定
|
|
1072
|
+
if (valueAttr.expression) {
|
|
1073
|
+
const attrCode = yield* valueAttr.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, '', { tabSize: 0 }));
|
|
1074
|
+
staticItem = `${attrCode}`;
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
try {
|
|
1078
|
+
if (valueAttr.type === 'static') {
|
|
1079
|
+
const value = json5.parse(String(valueAttr.value));
|
|
1080
|
+
const map = {
|
|
1081
|
+
string: 'new nasl.core.String("")',
|
|
1082
|
+
number: 'new nasl.core.Long(1)',
|
|
1083
|
+
boolean: 'new nasl.core.Boolean(false)',
|
|
1084
|
+
};
|
|
1085
|
+
staticItem = map[typeof value] || 'new nasl.core.String("")';
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
staticItem = 'new nasl.core.String("")';
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
catch (error) {
|
|
1092
|
+
// @ts-ignore
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
staticItem = 'new nasl.core.String("")';
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
code += `let __staticItem = ${staticItem};\n`;
|
|
1101
|
+
code += `let ${key}: typeof __staticItem;\n`;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
// 值
|
|
1105
|
+
let valueType;
|
|
1106
|
+
if (hasDataSource && V && !T1) {
|
|
1107
|
+
const valueFieldAttr = self.bindAttrs?.find((attr) => attr.name === 'valueField');
|
|
1108
|
+
if (dataSourceSetted && ['static', 'string'].includes(valueFieldAttr?.type)) {
|
|
1109
|
+
valueType = `nasl.util._formatEnum<typeof __item.${valueFieldAttr.value}>`;
|
|
1110
|
+
}
|
|
1111
|
+
else {
|
|
1112
|
+
valueType = `nasl.util._formatEnum<typeof __staticItem>`;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
// 分页
|
|
1116
|
+
let pageableDefaultValue;
|
|
1117
|
+
if (hasDataSource && P && !T1) {
|
|
1118
|
+
pageableDefaultValue = getPropInitialValue('pageable');
|
|
1119
|
+
code += `let __pageable = ${pageableDefaultValue};\n`;
|
|
1120
|
+
}
|
|
1121
|
+
// 多选
|
|
1122
|
+
let multipleDefaultValue;
|
|
1123
|
+
if (hasDataSource && M && !T1) {
|
|
1124
|
+
const name = config?.allNodesAPI?.[self.tag]?.props?.find((prop) => ['M'].includes(prop.tsType))?.name;
|
|
1125
|
+
multipleDefaultValue = getPropInitialValue(name || 'multiple');
|
|
1126
|
+
code += `let __multiple = ${multipleDefaultValue};\n`;
|
|
1127
|
+
}
|
|
1128
|
+
if (hasDataSource && V && !T1) {
|
|
1129
|
+
code += `// @ts-ignore
|
|
1130
|
+
let __value: typeof __multiple extends nasl.core.BooleanTrue ? nasl.collection.List<${valueType}> : ${valueType};\n`;
|
|
1131
|
+
code += `// @ts-ignore
|
|
1132
|
+
let __V: ${valueType};\n`;
|
|
1133
|
+
}
|
|
1134
|
+
let converterDefaultValue;
|
|
1135
|
+
if (C) {
|
|
1136
|
+
converterDefaultValue = getConverterDefaultValue('converter');
|
|
1137
|
+
code += `let __converter = ${converterDefaultValue};\n`;
|
|
1138
|
+
}
|
|
1139
|
+
if (self.tag === 'template' && self.haveScope() && asserts.isViewElement(self.parentNode)) {
|
|
1140
|
+
const currentType = self.parentNode.tag === 'u-table-view-column-dynamic' ? 'CurrentDynamic' : 'Current';
|
|
1141
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 3);
|
|
1142
|
+
code += `let current${levelIndex === 0 ? '' : levelIndex}: nasl.ui.${currentType}<typeof __item${currentType === 'CurrentDynamic' ? ', typeof __columnItem' : ''}>;\n`;
|
|
1143
|
+
levelIndex++;
|
|
1144
|
+
}
|
|
1145
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 3);
|
|
1146
|
+
code += `return {\n`;
|
|
1147
|
+
if (T) {
|
|
1148
|
+
code += `__item,\n`;
|
|
1149
|
+
}
|
|
1150
|
+
if (V) {
|
|
1151
|
+
code += `__value, __V,\n`;
|
|
1152
|
+
}
|
|
1153
|
+
if (P) {
|
|
1154
|
+
code += `__pageable,\n`;
|
|
1155
|
+
}
|
|
1156
|
+
if (M) {
|
|
1157
|
+
code += `__multiple,\n`;
|
|
1158
|
+
}
|
|
1159
|
+
if (T1) {
|
|
1160
|
+
code += `__columnItem,\n`;
|
|
1161
|
+
}
|
|
1162
|
+
if (C) {
|
|
1163
|
+
code += `__converter,\n`;
|
|
1164
|
+
}
|
|
1165
|
+
if (Array.isArray(self.children)) {
|
|
1166
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 4);
|
|
1167
|
+
code += `children: {\n`;
|
|
1168
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.children, function* warpForEachGenerator(element) {
|
|
1169
|
+
code += yield* element.toEmbeddedTSRefTree((0, nasl_translator_1.shiftState)({ ...state, tabSize: state.tabSize + 2 }, code), { elementsPathMap }, levelIndex);
|
|
1170
|
+
});
|
|
1171
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 4);
|
|
1172
|
+
code += `},\n`;
|
|
1173
|
+
}
|
|
1174
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 3);
|
|
1175
|
+
code += `};\n`;
|
|
1176
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1177
|
+
code += `},\n`;
|
|
1178
|
+
return code;
|
|
1179
|
+
}
|
|
1180
|
+
getTypeArgmentsStr(state, currentNode) {
|
|
1181
|
+
// 登录组件不翻译
|
|
1182
|
+
if (this.toHump(this.tag) === 'lcapLogin' || this.staticClass === 'login-form')
|
|
1183
|
+
return '<any>';
|
|
1184
|
+
let code = '';
|
|
1185
|
+
// formItem的单独处理
|
|
1186
|
+
if (this.tag === 'u-form-item') {
|
|
1187
|
+
if (Array.isArray(this.children) && this.children.length) {
|
|
1188
|
+
const tag = this.children[0].tag;
|
|
1189
|
+
if (tag === 'u-input') {
|
|
1190
|
+
code += '<nasl.core.String>';
|
|
1191
|
+
}
|
|
1192
|
+
else if (tag === 'u-input-number') {
|
|
1193
|
+
code += '<nasl.core.Long>';
|
|
1194
|
+
}
|
|
1195
|
+
else {
|
|
1196
|
+
code += '<any>';
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
return code;
|
|
1200
|
+
}
|
|
1201
|
+
if (this.tag === 'u-table-view-column-group') {
|
|
1202
|
+
code += `<${this.parentNode.__tsDataSourceTypeName}>`;
|
|
1203
|
+
return code;
|
|
1204
|
+
}
|
|
1205
|
+
const bindAttrs = this.bindAttrs;
|
|
1206
|
+
if (bindAttrs && bindAttrs.length) {
|
|
1207
|
+
const attr = bindAttrs.find((item) => item.name === 'dataSource');
|
|
1208
|
+
if (attr && attr.expression) {
|
|
1209
|
+
if (this.tag === 'u-table-view-column-dynamic') {
|
|
1210
|
+
code += `<${this.parentNode.__tsDataSourceTypeName}, ${this.__tsDataSourceTypeName}>`;
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
code += `<${this.__tsDataSourceTypeName}>`;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return code;
|
|
1218
|
+
}
|
|
1219
|
+
// 应该没有再使用了
|
|
1220
|
+
*getDatasourceTypeCodeStr(state, eleArr) {
|
|
1221
|
+
let code = '';
|
|
1222
|
+
yield* (0, utils_1.wrapForEachToGenerator)(eleArr ?? [], function* wrapForEach(element, index) {
|
|
1223
|
+
const bindAttrs = element.bindAttrs;
|
|
1224
|
+
if (bindAttrs && bindAttrs.length) {
|
|
1225
|
+
const attr = bindAttrs.find((item) => item.name === 'dataSource');
|
|
1226
|
+
if (attr && attr.expression) {
|
|
1227
|
+
const datasourceName = `datasourceName${element.name}`;
|
|
1228
|
+
element.__tsDataSourceTypeName = datasourceName;
|
|
1229
|
+
if (asserts.isMemberExpression(attr.expression) ||
|
|
1230
|
+
asserts.isIdentifier(attr.expression) ||
|
|
1231
|
+
asserts.isCallLogic(attr.expression)) {
|
|
1232
|
+
const extraParams = {
|
|
1233
|
+
tabSize: 4,
|
|
1234
|
+
inline: true,
|
|
1235
|
+
noNeedParams: true,
|
|
1236
|
+
callLogicNoIife: true,
|
|
1237
|
+
};
|
|
1238
|
+
debugger;
|
|
1239
|
+
const value = yield* attr.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, attr.expression.concept === 'CallLogic' ? extraParams : {}));
|
|
1240
|
+
code += `type ${datasourceName} = `;
|
|
1241
|
+
code += `nasl.ui.GetItemTypeFromDataSource<typeof ${value}>;\n`;
|
|
1242
|
+
}
|
|
1243
|
+
else {
|
|
1244
|
+
code += `const __funcName${index} = () => { return`;
|
|
1245
|
+
code += yield* attr.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code));
|
|
1246
|
+
code += '};\n';
|
|
1247
|
+
code += `type ${datasourceName} = `;
|
|
1248
|
+
code += `nasl.ui.GetItemTypeFromDataSource<ReturnType<typeof __funcName${index}>>;\n`;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
code += '\n';
|
|
1254
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1255
|
+
return code;
|
|
1256
|
+
}
|
|
1257
|
+
// 获取端类型
|
|
1258
|
+
get frontendType() {
|
|
1259
|
+
return this.getAncestor('FrontendType');
|
|
1260
|
+
}
|
|
1261
|
+
// 对应业务组件
|
|
1262
|
+
get isCorrespondingBusinessComponent() {
|
|
1263
|
+
return this.tag.startsWith('bs-');
|
|
1264
|
+
}
|
|
1265
|
+
// 对应的业务组件的Namespace
|
|
1266
|
+
get correspondingBusinessComponentNamespace() {
|
|
1267
|
+
return `${this.frontendType?.getNamespace()}.${this.frontendType?.name}.businessComponents`;
|
|
1268
|
+
}
|
|
1269
|
+
// 获取对应的业务组件
|
|
1270
|
+
get correspondingBusinessComponent() {
|
|
1271
|
+
if (this.isCorrespondingBusinessComponent) {
|
|
1272
|
+
// 端下的业务组件
|
|
1273
|
+
const businessComponents = this.frontendType?.businessComponents;
|
|
1274
|
+
const businessComponent = businessComponents.find((businessComponent) => {
|
|
1275
|
+
return `bs-${businessComponent?.name}` === this.tag;
|
|
1276
|
+
});
|
|
1277
|
+
return businessComponent;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
// 收集页面元素中的业务组件
|
|
1281
|
+
collectExistingBusinessComponent() {
|
|
1282
|
+
const excludedSet = new Set();
|
|
1283
|
+
utils.traverse(({ node }) => {
|
|
1284
|
+
const correspondingBusinessComponent = node.correspondingBusinessComponent;
|
|
1285
|
+
if (correspondingBusinessComponent && !excludedSet.has(correspondingBusinessComponent)) {
|
|
1286
|
+
const set = correspondingBusinessComponent.collectExistingBusinessComponent();
|
|
1287
|
+
if (set.size) {
|
|
1288
|
+
set.forEach((value) => {
|
|
1289
|
+
if (!excludedSet.has(value)) {
|
|
1290
|
+
excludedSet.add(value);
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}, {
|
|
1296
|
+
node: this,
|
|
1297
|
+
});
|
|
1298
|
+
return excludedSet;
|
|
1299
|
+
}
|
|
1300
|
+
*toEmbeddedTS(state = (0, nasl_translator_1.createCompilerState)(), parentLevel) {
|
|
1301
|
+
const self = this;
|
|
1302
|
+
const { parentNode, app, tag, staticClass, name, bindRoles, bindEvents, children } = self;
|
|
1303
|
+
const chineseTsName = (name) => {
|
|
1304
|
+
let tsName = name;
|
|
1305
|
+
// 匹配所有特殊字符都转为_
|
|
1306
|
+
tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
|
|
1307
|
+
if (/^\d/.test(tsName)) {
|
|
1308
|
+
tsName = '$' + tsName;
|
|
1309
|
+
}
|
|
1310
|
+
return tsName;
|
|
1311
|
+
};
|
|
1312
|
+
// 过滤模板的登录中的一些翻译,这里只过滤h5表格中的两个列
|
|
1313
|
+
if ((parentNode.concept === 'ViewElement' &&
|
|
1314
|
+
parentNode.tag &&
|
|
1315
|
+
this.toHump(parentNode.tag) === 'lcapLogin') ||
|
|
1316
|
+
staticClass === 'login-cell') {
|
|
1317
|
+
return '';
|
|
1318
|
+
}
|
|
1319
|
+
// pc事件翻译
|
|
1320
|
+
if (self.toHump(tag) === 'lcapLogin') {
|
|
1321
|
+
let code = `new nasl.ui.Div({_name: __elements.${self.name},\n`;
|
|
1322
|
+
// 事件
|
|
1323
|
+
if (Array.isArray(self.bindEvents)) {
|
|
1324
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.bindEvents, function* warpForEachGenerator(event) {
|
|
1325
|
+
code += yield* event.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1326
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1327
|
+
}));
|
|
1328
|
+
code += '\n';
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
code += `}),\n`;
|
|
1332
|
+
return code;
|
|
1333
|
+
}
|
|
1334
|
+
const levelIndex = parentLevel || 0;
|
|
1335
|
+
if (tag === 'template') {
|
|
1336
|
+
// 若是template,应当在父节点的slot数组中,因此无需输出形如slotDefault: ()=>[ 的代码,直接输出子元素即可
|
|
1337
|
+
let code = '';
|
|
1338
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.children, function* warpForEachGenerator(element) {
|
|
1339
|
+
code += yield* element.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1340
|
+
tabSize: state?.tabSize || 0,
|
|
1341
|
+
}), levelIndex);
|
|
1342
|
+
});
|
|
1343
|
+
return code;
|
|
1344
|
+
}
|
|
1345
|
+
let namespace = `nasl.ui.${utils.kebab2Pascal(tag)}`;
|
|
1346
|
+
if (self.isCorrespondingBusinessComponent) {
|
|
1347
|
+
namespace = `${self.correspondingBusinessComponentNamespace}.${self.tag.replace('bs-', '')}`;
|
|
1348
|
+
}
|
|
1349
|
+
const { T, V, P, M, T1, C, genericTypes } = this.getGenericTypes(self.tag);
|
|
1350
|
+
let code = `new ${namespace}`;
|
|
1351
|
+
if (genericTypes.length > 0) {
|
|
1352
|
+
code += `<`;
|
|
1353
|
+
code += genericTypes.map((i) => `typeof __elementsRef.${self.name}.${i}`).join(', ');
|
|
1354
|
+
code += `>`;
|
|
1355
|
+
}
|
|
1356
|
+
// 增加唯一name 后面那个name是为了查找引用的时候用的
|
|
1357
|
+
code += `({_name: __elements.${self.name},\n`;
|
|
1358
|
+
// 是否开启权限
|
|
1359
|
+
// const hasAuth = Array.isArray(bindDirectives)
|
|
1360
|
+
// ? !!bindDirectives.filter((directive) => directive.name === 'auth').length
|
|
1361
|
+
// : false;
|
|
1362
|
+
// 角色
|
|
1363
|
+
if (Array.isArray(bindRoles) && bindRoles.length) {
|
|
1364
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1365
|
+
code += 'roles: [\n';
|
|
1366
|
+
yield* (0, utils_1.wrapForEachToGenerator)(bindRoles, function* warpForEachGenerator(role) {
|
|
1367
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 3);
|
|
1368
|
+
code += `${app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
|
|
1369
|
+
code += '\n';
|
|
1370
|
+
});
|
|
1371
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1372
|
+
code += '],\n';
|
|
1373
|
+
}
|
|
1374
|
+
// 事件
|
|
1375
|
+
if (Array.isArray(bindEvents)) {
|
|
1376
|
+
yield* (0, utils_1.wrapForEachToGenerator)(bindEvents, function* warpForEachGenerator(event) {
|
|
1377
|
+
code += yield* event.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1378
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1379
|
+
}));
|
|
1380
|
+
code += '\n';
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
// 属性
|
|
1384
|
+
const validAttrs = (self.bindAttrs || []).filter((attr) => {
|
|
1385
|
+
// 特殊的一些属性不过滤
|
|
1386
|
+
if (['destination', 'externalDestination', 'download', 'rules', 'url'].includes(attr.name)) {
|
|
1387
|
+
return true;
|
|
1388
|
+
}
|
|
1389
|
+
const config = (0, store_2.getConfig)();
|
|
1390
|
+
const com = config.allNodesAPI[self.tag];
|
|
1391
|
+
if (com) {
|
|
1392
|
+
const { props } = com;
|
|
1393
|
+
const prop = props?.find((item) => item.name === attr.name);
|
|
1394
|
+
if (prop) {
|
|
1395
|
+
return true;
|
|
1396
|
+
}
|
|
1397
|
+
return false;
|
|
1398
|
+
}
|
|
1399
|
+
return true;
|
|
1400
|
+
});
|
|
1401
|
+
yield* (0, utils_1.wrapForEachToGenerator)(validAttrs, function* warpForEachGenerator(attr) {
|
|
1402
|
+
// 过滤业务组件的非表达式模式的翻译
|
|
1403
|
+
const shouldFilter = self.isCorrespondingBusinessComponent && attr.type !== 'dynamic';
|
|
1404
|
+
if (shouldFilter) {
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
let attrCode = yield* attr.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }), { carryName: true });
|
|
1408
|
+
if (attrCode.trim()) {
|
|
1409
|
+
attrCode = yield* attr.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }), { carryName: true });
|
|
1410
|
+
code += attrCode;
|
|
1411
|
+
code += `,\n`;
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
// 指令v-if等
|
|
1415
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.bindDirectives || [], function* warpForEachGenerator(directive) {
|
|
1416
|
+
let directiveCode = yield* directive.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }));
|
|
1417
|
+
if (directiveCode.trim()) {
|
|
1418
|
+
code += `_${directive.name}: `;
|
|
1419
|
+
directiveCode = yield* directive.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }));
|
|
1420
|
+
code += directiveCode;
|
|
1421
|
+
code += `,\n`;
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
// 样式绑定
|
|
1425
|
+
yield* (0, utils_1.wrapForEachToGenerator)(self.bindStyles || [], function* warpForEachGenerator(bindStyle) {
|
|
1426
|
+
let styleCode = yield* bindStyle.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }));
|
|
1427
|
+
if (styleCode.trim()) {
|
|
1428
|
+
const humpName = self.toHump(bindStyle.name).replace(/^-+/, '');
|
|
1429
|
+
code += `_${humpName}: `;
|
|
1430
|
+
styleCode = yield* bindStyle.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { tabSize: 1 }));
|
|
1431
|
+
code += styleCode;
|
|
1432
|
+
code += `,\n`;
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
// 子元素
|
|
1436
|
+
if (Array.isArray(children)) {
|
|
1437
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1438
|
+
// 如果子元素中有插槽
|
|
1439
|
+
if (children.find((item) => item.tag === 'template' && item.slotTarget)) {
|
|
1440
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1441
|
+
const defaultArr = [];
|
|
1442
|
+
// 先把插槽翻译了
|
|
1443
|
+
yield* (0, utils_1.wrapForEachToGenerator)(children, function* warpForEachGenerator(element) {
|
|
1444
|
+
if (element.tag === 'template' && element.slotTarget && element.slotTarget !== 'default') {
|
|
1445
|
+
const hasScope = element.haveScope();
|
|
1446
|
+
const slotTarget = `slot${element.toFirstUpper(element.toHump(element.slotTarget))}`;
|
|
1447
|
+
if (hasScope) {
|
|
1448
|
+
code += `${slotTarget}: (current${levelIndex === 0 ? '' : levelIndex}) => [\n`;
|
|
1449
|
+
}
|
|
1450
|
+
else {
|
|
1451
|
+
code += `${slotTarget}: () => [\n`;
|
|
1452
|
+
}
|
|
1453
|
+
const levelIndexDelta = Number(hasScope);
|
|
1454
|
+
yield* (0, utils_1.wrapForEachToGenerator)(element.children, function* warpForEachGenerator(e) {
|
|
1455
|
+
code += yield* e.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1456
|
+
tabSize: state?.tabSize || 0,
|
|
1457
|
+
}), levelIndex + levelIndexDelta);
|
|
1458
|
+
});
|
|
1459
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1460
|
+
code += '\n],\n';
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
defaultArr.push(element);
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
// 翻译其余的子元素
|
|
1467
|
+
if (defaultArr.length) {
|
|
1468
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1469
|
+
const hasScope = defaultArr.some((x) => x.haveScope());
|
|
1470
|
+
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` : '';
|
|
1471
|
+
const levelIndexDelta = Number(hasScope);
|
|
1472
|
+
code += `slotDefault: (${param}) => [\n`;
|
|
1473
|
+
yield* (0, utils_1.wrapForEachToGenerator)(defaultArr, function* warpForEachGenerator(element) {
|
|
1474
|
+
code += yield* element.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1475
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1476
|
+
}), levelIndex + levelIndexDelta);
|
|
1477
|
+
code += '\n';
|
|
1478
|
+
});
|
|
1479
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1480
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1481
|
+
code += ']\n';
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
else if (children?.length) {
|
|
1485
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1486
|
+
const hasScope = children.some((x) => x.haveScope());
|
|
1487
|
+
const param = hasScope ? `current${levelIndex === 0 ? '' : levelIndex}` : '';
|
|
1488
|
+
const levelIndexDelta = Number(hasScope);
|
|
1489
|
+
code += `slotDefault: (${param}) => [\n`;
|
|
1490
|
+
const defaultArr = self.shouldHandleChildren(self) ? children : [];
|
|
1491
|
+
yield* (0, utils_1.wrapForEachToGenerator)(defaultArr, function* warpForEachGenerator(element) {
|
|
1492
|
+
code += yield* element.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1493
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1494
|
+
}), levelIndex + levelIndexDelta);
|
|
1495
|
+
code += '\n';
|
|
1496
|
+
});
|
|
1497
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 2);
|
|
1498
|
+
code += (0, nasl_translator_1.indent)((state?.tabSize || 0) + 1);
|
|
1499
|
+
code += ']\n';
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
code += (0, nasl_translator_1.indent)(state?.tabSize || 0) + '})';
|
|
1503
|
+
// 顶层元素是单独的表达式
|
|
1504
|
+
if (parentNode.concept === 'View' || asserts.isBusinessComponent(parentNode)) {
|
|
1505
|
+
code += ';\n';
|
|
1506
|
+
}
|
|
1507
|
+
else {
|
|
1508
|
+
code += ',\n';
|
|
1509
|
+
}
|
|
1510
|
+
return code;
|
|
1511
|
+
}
|
|
1512
|
+
shouldHandleChildren(element) {
|
|
1513
|
+
// 数据源与静态子节点不共存的组件
|
|
1514
|
+
const tags = ['u-tabs', 'u-selectable-steps', 'van-swipe', 'van-steps']; // 数据源与静态子节点不共存的组件
|
|
1515
|
+
// 判断当前是否配置了数据源
|
|
1516
|
+
const isDataSourceConfigured = () => element.bindAttrs.some((attr) => {
|
|
1517
|
+
if (['data-source', 'dataSource'].includes(attr.name)) {
|
|
1518
|
+
if (attr.type === 'dynamic' && attr.expression) {
|
|
1519
|
+
return true;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
return false;
|
|
1523
|
+
});
|
|
1524
|
+
return !tags.includes(element.tag) || !isDataSourceConfigured();
|
|
1525
|
+
}
|
|
1526
|
+
toNaturalTS(state = (0, nasl_translator_1.createCompilerState)(), parentLevel) {
|
|
1527
|
+
let code = '';
|
|
1528
|
+
code += `$refs.${this.name} = new ${(0, utils_2.kebab2Camel)(this.tag)}({\n`;
|
|
1529
|
+
this.bindAttrs.forEach((attr) => {
|
|
1530
|
+
code += attr.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1531
|
+
tabSize: state.tabSize + 1,
|
|
1532
|
+
}));
|
|
1533
|
+
code += ',\n';
|
|
1534
|
+
});
|
|
1535
|
+
this.bindEvents.forEach((event) => {
|
|
1536
|
+
code += event.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1537
|
+
tabSize: state.tabSize + 1,
|
|
1538
|
+
}));
|
|
1539
|
+
code += ',\n';
|
|
1540
|
+
});
|
|
1541
|
+
if (this.children.find((item) => item.tag === 'template' && item.slotTarget)) {
|
|
1542
|
+
const defaultArr = [];
|
|
1543
|
+
// 先把插槽翻译了
|
|
1544
|
+
this.children.forEach((element) => {
|
|
1545
|
+
if (element.tag === 'template') {
|
|
1546
|
+
if (element.children.length) {
|
|
1547
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slot${utils.firstUpperCase((0, utils_2.kebab2Camel)(element.slotTarget || ''))}: (${element.slotScope || ''}) => [\n`;
|
|
1548
|
+
element.children.forEach((element) => {
|
|
1549
|
+
code += element.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1550
|
+
tabSize: state.tabSize + 2,
|
|
1551
|
+
}));
|
|
1552
|
+
code += ',\n';
|
|
1553
|
+
});
|
|
1554
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}],\n`;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
else {
|
|
1558
|
+
defaultArr.push(element);
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
// 翻译其余的子集
|
|
1562
|
+
if (defaultArr.length) {
|
|
1563
|
+
// throw new Error('多个插槽必须都在 template 内');
|
|
1564
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slotDefault: () => [\n`;
|
|
1565
|
+
defaultArr.forEach((element) => {
|
|
1566
|
+
code += element.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1567
|
+
tabSize: state.tabSize + 2,
|
|
1568
|
+
}));
|
|
1569
|
+
code += ',\n';
|
|
1570
|
+
});
|
|
1571
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}],\n`;
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
if (this.children.length) {
|
|
1576
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slotDefault: () => [\n`;
|
|
1577
|
+
this.children.forEach((element) => {
|
|
1578
|
+
code += element.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1579
|
+
tabSize: state.tabSize + 2,
|
|
1580
|
+
}));
|
|
1581
|
+
code += ',\n';
|
|
1582
|
+
});
|
|
1583
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}],\n`;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize)}})`;
|
|
1587
|
+
return code;
|
|
1588
|
+
}
|
|
1589
|
+
toTextualNASL(state = (0, nasl_translator_1.createCompilerState)(), parentLevel) {
|
|
1590
|
+
let code = '';
|
|
1591
|
+
code += (0, nasl_translator_1.createDecoratorCode)(state, this, ['name']);
|
|
1592
|
+
code += `${(0, utils_2.kebab2Camel)(this.tag)} {\n`;
|
|
1593
|
+
this.bindAttrs.forEach((attr) => {
|
|
1594
|
+
code += attr.toTextualNASL((0, nasl_translator_1.shiftState)(state, code, {
|
|
1595
|
+
tabSize: state.tabSize + 1,
|
|
1596
|
+
}));
|
|
1597
|
+
code += ',\n';
|
|
1598
|
+
});
|
|
1599
|
+
this.bindEvents.forEach((event) => {
|
|
1600
|
+
code += event.toTextualNASL((0, nasl_translator_1.shiftState)(state, code, {
|
|
1601
|
+
tabSize: state.tabSize + 1,
|
|
1602
|
+
}));
|
|
1603
|
+
code += ',\n';
|
|
1604
|
+
});
|
|
1605
|
+
if (this.children.find((item) => item.tag === 'template' && item.slotTarget)) {
|
|
1606
|
+
const defaultArr = [];
|
|
1607
|
+
// 先把插槽翻译了
|
|
1608
|
+
this.children.forEach((element) => {
|
|
1609
|
+
if (element.tag === 'template' && element.children.length) {
|
|
1610
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slot${utils.firstUpperCase((0, utils_2.kebab2Camel)(element.slotTarget || ''))} = { (${element.slotScope || ''}) => [\n`;
|
|
1611
|
+
// code += element.toTextualNASL(
|
|
1612
|
+
// shiftState(state, code, {
|
|
1613
|
+
// tabSize: state.tabSize + 2,
|
|
1614
|
+
// }),
|
|
1615
|
+
// );
|
|
1616
|
+
element.children.forEach((element) => {
|
|
1617
|
+
code += element.toTextualNASL((0, nasl_translator_1.shiftState)(state, code, {
|
|
1618
|
+
tabSize: state.tabSize + 2,
|
|
1619
|
+
}));
|
|
1620
|
+
code += ',\n';
|
|
1621
|
+
});
|
|
1622
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}] },\n`;
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
defaultArr.push(element);
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
// 翻译其余的子集
|
|
1629
|
+
if (defaultArr.length) {
|
|
1630
|
+
// throw new Error('多个插槽必须都在 template 内');
|
|
1631
|
+
defaultArr.forEach((element) => {
|
|
1632
|
+
code += element.toTextualNASL((0, nasl_translator_1.shiftState)(state, code, {
|
|
1633
|
+
tabSize: state.tabSize,
|
|
1634
|
+
}));
|
|
1635
|
+
code += ',\n';
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
else {
|
|
1640
|
+
if (this.children.length) {
|
|
1641
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slotDefault = { () => [\n`;
|
|
1642
|
+
this.children.forEach((element) => {
|
|
1643
|
+
code += element.toTextualNASL((0, nasl_translator_1.shiftState)(state, code, {
|
|
1644
|
+
tabSize: state.tabSize + 2,
|
|
1645
|
+
}));
|
|
1646
|
+
code += ',\n';
|
|
1647
|
+
});
|
|
1648
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}] },\n`;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize)}}`;
|
|
1652
|
+
return code;
|
|
1653
|
+
}
|
|
1654
|
+
toNaturalTSDefinition(state) {
|
|
1655
|
+
let code = '';
|
|
1656
|
+
if (['u-button', 'u-form', 'u-modal', 'u-table-view', 'u-select', 'u-input', 'u-number-input'].includes(this.tag)) {
|
|
1657
|
+
code += (0, nasl_translator_1.indent)(state.tabSize + 1);
|
|
1658
|
+
// 登录组件不翻译
|
|
1659
|
+
// if (this.toHump(this.tag) === 'lcapLogin' || this.staticClass === 'login-form') {
|
|
1660
|
+
// code += `${this.name}: nasl.ui.div;\n`;
|
|
1661
|
+
// } else {
|
|
1662
|
+
code += `${this.name}: nasl.ui.${(0, utils_2.kebab2Camel)(this.tag.replace(/^\w-/, ''))},\n`;
|
|
1663
|
+
// }
|
|
1664
|
+
}
|
|
1665
|
+
if (Array.isArray(this.children)) {
|
|
1666
|
+
this.children.forEach((element) => {
|
|
1667
|
+
code += element.toNaturalTSDefinition((0, nasl_translator_1.shiftState)(state, code));
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
return code;
|
|
1671
|
+
}
|
|
1672
|
+
_duplicate() {
|
|
1673
|
+
const element = ViewElement_1.from(this.toTemplateJSON());
|
|
1674
|
+
const nameMap = element.deepRenameElements(this);
|
|
1675
|
+
utils.traverse((current) => {
|
|
1676
|
+
const node = current.node;
|
|
1677
|
+
if (node.concept === 'CallLogic') {
|
|
1678
|
+
node.uuid = (0, utils_3.createUUID)();
|
|
1679
|
+
if (/elements.(.+).logics/.test(node.calleeNamespace)) {
|
|
1680
|
+
const oldName = node.calleeNamespace.split('.')[1];
|
|
1681
|
+
if (nameMap.has(oldName)) {
|
|
1682
|
+
const newName = nameMap.get(oldName);
|
|
1683
|
+
node.calleeNamespace = `elements.${newName}.logics`;
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
// 如果创建副本,内部的国际化标识都要去掉
|
|
1688
|
+
if (node.i18nKey) {
|
|
1689
|
+
delete node.i18nKey;
|
|
1690
|
+
}
|
|
1691
|
+
}, { node: element }, { mode: 'anyObject', excludedKeySet: element.JSON_EXCLUDED_KEYS });
|
|
1692
|
+
this.likeComponent?.existingViewElement.clear();
|
|
1693
|
+
return element;
|
|
1694
|
+
}
|
|
1695
|
+
setTag(tag) {
|
|
1696
|
+
const object = {
|
|
1697
|
+
tag,
|
|
1698
|
+
};
|
|
1699
|
+
this.update({
|
|
1700
|
+
...object,
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
// 递归遍历组件
|
|
1704
|
+
traverseChildren(cb) {
|
|
1705
|
+
utils.traverse((current) => {
|
|
1706
|
+
cb(current.node);
|
|
1707
|
+
}, { node: this });
|
|
1708
|
+
}
|
|
1709
|
+
// 递归生成组件名
|
|
1710
|
+
deepRenameElements(node) {
|
|
1711
|
+
const map = new Map();
|
|
1712
|
+
this.traverseChildren((ele) => {
|
|
1713
|
+
const oldName = ele.name;
|
|
1714
|
+
const tagName = ele.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1715
|
+
ele.name = node.getViewElementUniqueName(`${tagName}1`);
|
|
1716
|
+
map.set(oldName, ele.name);
|
|
1717
|
+
});
|
|
1718
|
+
return map;
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* 解析属性中的表达式
|
|
1722
|
+
* @param value
|
|
1723
|
+
* @param $def 目前 $def 只用来查找 $def.variables 和 $def.structures
|
|
1724
|
+
* @param dataSchema
|
|
1725
|
+
*/
|
|
1726
|
+
static _parseExpression(value) {
|
|
1727
|
+
try {
|
|
1728
|
+
const ast = (0, store_1.getBabelParser)().parseExpression(value);
|
|
1729
|
+
const node = transAstNodeToNaslNode(ast);
|
|
1730
|
+
return LogicItem__1.LogicItem.from(node, null, null);
|
|
1731
|
+
}
|
|
1732
|
+
catch (e) {
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
static _parseValidationRule(value) {
|
|
1737
|
+
let calleeName = value;
|
|
1738
|
+
let args = [];
|
|
1739
|
+
try {
|
|
1740
|
+
const ast = (0, store_1.getBabelParser)().parseExpression(value);
|
|
1741
|
+
const validationNamespace = (0, concepts_1.getStdlibNamespace)().findChild('validation');
|
|
1742
|
+
if (ast.type === 'CallExpression') {
|
|
1743
|
+
calleeName = (ast.callee?.property?.name ?? ast.callee?.property?.value ?? ast.callee?.name).replace(/\(.*/, '');
|
|
1744
|
+
const func = validationNamespace.functions.find((item) => item.name === calleeName);
|
|
1745
|
+
args = ast.arguments.map((argument, index) => ({
|
|
1746
|
+
concept: 'Argument',
|
|
1747
|
+
name: '',
|
|
1748
|
+
kind: 'Statement',
|
|
1749
|
+
keyword: func?.params?.[index]?.name ?? '',
|
|
1750
|
+
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
1751
|
+
}));
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
catch (error) { }
|
|
1755
|
+
return {
|
|
1756
|
+
concept: 'ValidationRule',
|
|
1757
|
+
name: '',
|
|
1758
|
+
label: '验证规则',
|
|
1759
|
+
kind: 'Expression',
|
|
1760
|
+
calleeNamespace: 'nasl.validation',
|
|
1761
|
+
arguments: args,
|
|
1762
|
+
calleeName,
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* 从 Vue 的 ASTNode 转换成 ASL 元素
|
|
1767
|
+
* @param astNode Vue 的 ASTNode
|
|
1768
|
+
*/
|
|
1769
|
+
static _fromASTNode(astNode, context) {
|
|
1770
|
+
const view = context?.view;
|
|
1771
|
+
// 临时处理组件的 text
|
|
1772
|
+
//h5-mock
|
|
1773
|
+
if ([
|
|
1774
|
+
'u-text',
|
|
1775
|
+
'van-text',
|
|
1776
|
+
'u-link',
|
|
1777
|
+
'u-button',
|
|
1778
|
+
'u-label',
|
|
1779
|
+
'u-radio',
|
|
1780
|
+
'u-checkbox',
|
|
1781
|
+
'u-navbar-item',
|
|
1782
|
+
'u-sidebar-item',
|
|
1783
|
+
'u-menu-item',
|
|
1784
|
+
].includes(astNode.tag) &&
|
|
1785
|
+
astNode.children.length === 1 &&
|
|
1786
|
+
astNode.children[0].type === 3) {
|
|
1787
|
+
astNode.attrs = astNode.attrs || [];
|
|
1788
|
+
astNode.attrs.push({
|
|
1789
|
+
name: 'text',
|
|
1790
|
+
value: JSON.stringify(astNode.children[0].text),
|
|
1791
|
+
});
|
|
1792
|
+
astNode.children = [];
|
|
1793
|
+
}
|
|
1794
|
+
// 将 scopedSlots 合并到 children 中
|
|
1795
|
+
if (astNode.scopedSlots) {
|
|
1796
|
+
astNode.children = astNode.children || [];
|
|
1797
|
+
Object.keys(astNode.scopedSlots).forEach((key) => {
|
|
1798
|
+
if (!astNode.children.find((child) => key === child.slotTarget)) {
|
|
1799
|
+
astNode.children.unshift(astNode.scopedSlots[key]);
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
delete astNode.scopedSlots;
|
|
1803
|
+
}
|
|
1804
|
+
// 提示不支持的属性
|
|
1805
|
+
[
|
|
1806
|
+
'component',
|
|
1807
|
+
'inlineTemplate',
|
|
1808
|
+
'pre',
|
|
1809
|
+
'ns',
|
|
1810
|
+
'transition',
|
|
1811
|
+
'transitionOnAppear',
|
|
1812
|
+
'transitionMode',
|
|
1813
|
+
'slotName',
|
|
1814
|
+
'classBinding',
|
|
1815
|
+
'styleBinding',
|
|
1816
|
+
].forEach((key) => {
|
|
1817
|
+
if (astNode[key])
|
|
1818
|
+
console.warn(`[warn] ViewElement NASL unsupports '${key}' field in node `, astNode);
|
|
1819
|
+
});
|
|
1820
|
+
const BindAttribute = (0, decorators_1.getConceptConstructor)('BindAttribute');
|
|
1821
|
+
const BindDirective = (0, decorators_1.getConceptConstructor)('BindDirective');
|
|
1822
|
+
const BindEvent = (0, decorators_1.getConceptConstructor)('BindEvent');
|
|
1823
|
+
let element;
|
|
1824
|
+
if (astNode.type === 1) {
|
|
1825
|
+
if (astNode.tag === 'router-view') {
|
|
1826
|
+
if (view.frontend.type === 'h5') {
|
|
1827
|
+
astNode.tag = 'van-router-view';
|
|
1828
|
+
}
|
|
1829
|
+
else {
|
|
1830
|
+
astNode.tag = 'u-router-view';
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
const tagName = astNode.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1834
|
+
let newContext = {};
|
|
1835
|
+
if (context) {
|
|
1836
|
+
newContext = {
|
|
1837
|
+
...context,
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
element = new ViewElement_1({
|
|
1841
|
+
tag: astNode.tag,
|
|
1842
|
+
name: astNode.attrsMap.ref || view.getViewElementUniqueName(`${tagName}1`),
|
|
1843
|
+
staticClass: astNode.attrsMap.class,
|
|
1844
|
+
staticStyle: astNode.attrsMap.style,
|
|
1845
|
+
slotTarget: astNode.slotTarget && json5.parse(astNode.slotTarget),
|
|
1846
|
+
slotScope: astNode.slotScope === '_empty_' ? '' : astNode.slotScope,
|
|
1847
|
+
children: astNode.children.map((item) => this._fromASTNode(item, newContext)),
|
|
1848
|
+
});
|
|
1849
|
+
const attrName2Camel = (name) => {
|
|
1850
|
+
if (name.startsWith('vusion-'))
|
|
1851
|
+
return name;
|
|
1852
|
+
return name.replace(/(?:-)([a-zA-Z0-9])/g, (m, $1) => $1.toUpperCase());
|
|
1853
|
+
};
|
|
1854
|
+
astNode?.attrs?.forEach((oldAttr) => {
|
|
1855
|
+
let attr;
|
|
1856
|
+
// 获取原始属性
|
|
1857
|
+
const orginAttrCode = (context?.code || '').substr(oldAttr.start, oldAttr.end - oldAttr.start);
|
|
1858
|
+
if (oldAttr.value === '""' && orginAttrCode.trim() === oldAttr.name) {
|
|
1859
|
+
attr = new BindAttribute({
|
|
1860
|
+
type: 'static',
|
|
1861
|
+
name: attrName2Camel(oldAttr.name),
|
|
1862
|
+
value: 'true',
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
try {
|
|
1867
|
+
const tmp = json5.parse(oldAttr.value);
|
|
1868
|
+
const source = {
|
|
1869
|
+
type: typeof tmp === 'string' ? 'string' : 'static',
|
|
1870
|
+
name: attrName2Camel(oldAttr.name),
|
|
1871
|
+
value: typeof tmp === 'string' ? tmp : oldAttr.value,
|
|
1872
|
+
};
|
|
1873
|
+
if (oldAttr.name === 'rules') {
|
|
1874
|
+
if (Array.isArray(tmp)) {
|
|
1875
|
+
source.rules = tmp.map((rule) => ({
|
|
1876
|
+
concept: 'ValidationRule',
|
|
1877
|
+
name: '',
|
|
1878
|
+
label: '验证规则',
|
|
1879
|
+
calleeNamespace: 'nasl.validation',
|
|
1880
|
+
arguments: [],
|
|
1881
|
+
calleeName: rule?.validate,
|
|
1882
|
+
}));
|
|
1883
|
+
}
|
|
1884
|
+
else {
|
|
1885
|
+
source.rules = tmp?.split('|').map((ruleStr) => this._parseValidationRule(ruleStr.trim()));
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
else if (['page-number', 'page-size', 'pageNumber', 'pageSize'].includes(oldAttr.name)) {
|
|
1889
|
+
source.value = Number(source.value);
|
|
1890
|
+
}
|
|
1891
|
+
attr = new BindAttribute(source);
|
|
1892
|
+
}
|
|
1893
|
+
catch (e) {
|
|
1894
|
+
const expression = this._parseExpression(oldAttr.value);
|
|
1895
|
+
attr = new BindAttribute({
|
|
1896
|
+
type: 'dynamic',
|
|
1897
|
+
name: attrName2Camel(oldAttr.name),
|
|
1898
|
+
value: expression ? '' : oldAttr.value,
|
|
1899
|
+
expression,
|
|
1900
|
+
});
|
|
1901
|
+
if (astNode.attrsMap[`:${attr.name}.sync`]) {
|
|
1902
|
+
attr.sync = true;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
element.addBindAttribute(attr);
|
|
1907
|
+
});
|
|
1908
|
+
// compiler 处理:value.sync 时会加上update:value事件,需要过滤
|
|
1909
|
+
astNode.events &&
|
|
1910
|
+
Object.keys(astNode.events)
|
|
1911
|
+
.filter((name) => !name.startsWith('update:'))
|
|
1912
|
+
.forEach((name) => {
|
|
1913
|
+
const oldEvent = astNode.events[name];
|
|
1914
|
+
const str = oldEvent.value;
|
|
1915
|
+
const calleeName = str.split('(')[0];
|
|
1916
|
+
const matchArr = str.match(/\(([^)]*)\)/) || [];
|
|
1917
|
+
let argsStr = '';
|
|
1918
|
+
if (matchArr?.length >= 2) {
|
|
1919
|
+
argsStr = matchArr[1];
|
|
1920
|
+
}
|
|
1921
|
+
let args = [];
|
|
1922
|
+
const argStrs = argsStr.split(',');
|
|
1923
|
+
args = argStrs
|
|
1924
|
+
.filter((argStr) => !!argStr)
|
|
1925
|
+
.map((argStr) => {
|
|
1926
|
+
const keyword = argStr.trim().split('.');
|
|
1927
|
+
return {
|
|
1928
|
+
concept: 'Argument',
|
|
1929
|
+
expression: genArgumentMemberExpression(keyword),
|
|
1930
|
+
};
|
|
1931
|
+
});
|
|
1932
|
+
const viewLogics = context?.definition?.viewLogics || [];
|
|
1933
|
+
const currentLogic = viewLogics.find((item) => item.name === calleeName);
|
|
1934
|
+
if (currentLogic) {
|
|
1935
|
+
element.addBindEvent(new BindEvent({
|
|
1936
|
+
name,
|
|
1937
|
+
calleeNamespace: '',
|
|
1938
|
+
calleeName: '',
|
|
1939
|
+
arguments: args,
|
|
1940
|
+
logics: [currentLogic],
|
|
1941
|
+
}));
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
astNode.directives &&
|
|
1945
|
+
astNode.directives.forEach((directive) => {
|
|
1946
|
+
if (directive.name === 'model') {
|
|
1947
|
+
const valueAttr = astNode.attrs && astNode.attrs.find((attr) => attr.name === 'value');
|
|
1948
|
+
if (!valueAttr) {
|
|
1949
|
+
const expression = this._parseExpression(directive.value);
|
|
1950
|
+
element.addBindAttribute(new BindAttribute({
|
|
1951
|
+
type: 'dynamic',
|
|
1952
|
+
name: 'value',
|
|
1953
|
+
value: expression ? '' : directive.value,
|
|
1954
|
+
expression,
|
|
1955
|
+
sync: true,
|
|
1956
|
+
}));
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
else {
|
|
1960
|
+
const expression = this._parseExpression(directive.value);
|
|
1961
|
+
element.addBindDirective(new BindDirective({
|
|
1962
|
+
type: expression ? 'string' : 'dynamic',
|
|
1963
|
+
name: directive.name,
|
|
1964
|
+
rawName: directive.rawName,
|
|
1965
|
+
value: expression ? '' : directive.value,
|
|
1966
|
+
expression,
|
|
1967
|
+
arg: directive.arg,
|
|
1968
|
+
// modifiers: directive.modifiers,
|
|
1969
|
+
}));
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
if (astNode.if) {
|
|
1973
|
+
element.addBindDirective(new BindDirective({
|
|
1974
|
+
type: 'dynamic',
|
|
1975
|
+
name: 'if',
|
|
1976
|
+
rawName: 'v-if',
|
|
1977
|
+
value: '',
|
|
1978
|
+
expression: this._parseExpression(astNode.if),
|
|
1979
|
+
}));
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
else if (astNode.type === 2) {
|
|
1983
|
+
const config = (0, store_2.getConfig)();
|
|
1984
|
+
const tagName = config.scope === 'h5' ? 'van-text' : 'u-text';
|
|
1985
|
+
const baseName = tagName.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1986
|
+
element = new ViewElement_1({
|
|
1987
|
+
tag: tagName,
|
|
1988
|
+
name: view.getViewElementUniqueName(`${baseName}1`),
|
|
1989
|
+
});
|
|
1990
|
+
const value = astNode.text?.match(/{{(.*?)}}/)[1].trim();
|
|
1991
|
+
const expression = this._parseExpression(value);
|
|
1992
|
+
element.addBindAttribute(new BindAttribute({
|
|
1993
|
+
type: 'dynamic',
|
|
1994
|
+
name: 'text',
|
|
1995
|
+
value: expression ? '' : value,
|
|
1996
|
+
expression,
|
|
1997
|
+
}));
|
|
1998
|
+
}
|
|
1999
|
+
else if (astNode.type === 3) {
|
|
2000
|
+
const config = (0, store_2.getConfig)();
|
|
2001
|
+
const tagName = config.scope === 'h5' ? 'van-text' : 'u-text';
|
|
2002
|
+
const baseName = tagName.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
2003
|
+
element = new ViewElement_1({
|
|
2004
|
+
tag: tagName,
|
|
2005
|
+
name: view.getViewElementUniqueName(`${baseName}1`),
|
|
2006
|
+
});
|
|
2007
|
+
element.addBindAttribute(new BindAttribute({
|
|
2008
|
+
name: 'text',
|
|
2009
|
+
type: 'string',
|
|
2010
|
+
value: astNode.text?.trim(),
|
|
2011
|
+
}));
|
|
2012
|
+
}
|
|
2013
|
+
return element;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* 解析 Vue 模板
|
|
2017
|
+
* 该方法不会绑定 view 和 parent,如果是添加元素优先使用 fromHTML
|
|
2018
|
+
* @param html Vue 的模板
|
|
2019
|
+
* @TODO 处理多个元素的问题
|
|
2020
|
+
*/
|
|
2021
|
+
static parse(code, context) {
|
|
2022
|
+
code = code || '<div></div>';
|
|
2023
|
+
const compilerOptions = {
|
|
2024
|
+
preserveWhitespace: false,
|
|
2025
|
+
outputSourceRange: true,
|
|
2026
|
+
};
|
|
2027
|
+
let ast = (0, store_1.getVueCompiler)().compile(code, compilerOptions).ast;
|
|
2028
|
+
if (ast.tag === 'template' && !ast.slotTarget)
|
|
2029
|
+
ast = ast.children[0];
|
|
2030
|
+
return this._fromASTNode(ast, {
|
|
2031
|
+
...context,
|
|
2032
|
+
code,
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* 从模板生成规范的 ViewElement 对象
|
|
2037
|
+
*/
|
|
2038
|
+
static fromHTML(html, context) {
|
|
2039
|
+
return this.parse(html, context);
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* 转换成设计器中使用的 Vue 文件
|
|
2043
|
+
* @param options
|
|
2044
|
+
*/
|
|
2045
|
+
toDesignerVue(options) {
|
|
2046
|
+
return this.toVue({
|
|
2047
|
+
isRoot: options?.isRoot,
|
|
2048
|
+
asCompontent: options?.asCompontent,
|
|
2049
|
+
finalCode: false,
|
|
2050
|
+
nodePathAttr: true,
|
|
2051
|
+
attrFormat: (attr, element, defaultResult) => {
|
|
2052
|
+
if (attr.concept === 'BindAttribute' &&
|
|
2053
|
+
!['href', 'destination', 'externalDestination', 'download'].includes(attr.name)) {
|
|
2054
|
+
const config = (0, store_2.getConfig)();
|
|
2055
|
+
const api = config?.allNodesAPI?.[element.tag];
|
|
2056
|
+
const apiOfAttr = api && api.props && api.props.find((_attr) => _attr.name === attr.name);
|
|
2057
|
+
if (['u-form-item', 'u-validator', 'van-field'].includes(element.tag) && attr.name === 'rules') {
|
|
2058
|
+
return `${attr.name}=""`;
|
|
2059
|
+
}
|
|
2060
|
+
if (apiOfAttr && apiOfAttr['designerValue'] !== undefined) {
|
|
2061
|
+
let designerValue = apiOfAttr['designerValue'];
|
|
2062
|
+
//对流程模板拖拽进行特判
|
|
2063
|
+
element.bindAttrs.forEach((property) => {
|
|
2064
|
+
if (property.name === 'repeat' && property.value === '1')
|
|
2065
|
+
designerValue = '[{}, {}]';
|
|
2066
|
+
});
|
|
2067
|
+
if (typeof designerValue === 'string') {
|
|
2068
|
+
designerValue = designerValue.replace(/"/g, "'");
|
|
2069
|
+
}
|
|
2070
|
+
try {
|
|
2071
|
+
if (Array.isArray(designerValue)) {
|
|
2072
|
+
return `:${attr.name}="${JSON.stringify(designerValue)}"`;
|
|
2073
|
+
}
|
|
2074
|
+
json5.parse(designerValue);
|
|
2075
|
+
return `:${attr.name}="${designerValue}"`;
|
|
2076
|
+
}
|
|
2077
|
+
catch (e) {
|
|
2078
|
+
return `${attr.name}="${designerValue}"`;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
if (attr.name === 'text' &&
|
|
2082
|
+
asserts.isMemberExpression(attr?.expression) &&
|
|
2083
|
+
attr?.expression?.object?.namespace?.startsWith('elements.') &&
|
|
2084
|
+
attr?.expression?.object?.namespace?.endsWith('.property')) {
|
|
2085
|
+
return `${attr.name}="{{ ${attr.expression.toUI()} }}"`;
|
|
2086
|
+
}
|
|
2087
|
+
if (attr.type === 'dynamic' &&
|
|
2088
|
+
!(element.tag === 'u-cascade-select' && attr.name === 'categories'))
|
|
2089
|
+
return defaultResult.replace(/:?([\w-]+)(?:.*?)="([\s\S]*)"/, (m, name, value) => {
|
|
2090
|
+
try {
|
|
2091
|
+
const tempValue = json5.parse(value);
|
|
2092
|
+
if (typeof tempValue === 'boolean' || typeof tempValue === 'number') {
|
|
2093
|
+
// 简单类型走属性
|
|
2094
|
+
return `:${name}="${value.replace(/"/g, "'")}"`;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
catch (e) {
|
|
2098
|
+
if (apiOfAttr && apiOfAttr.type && !apiOfAttr.type.includes('string'))
|
|
2099
|
+
return '';
|
|
2100
|
+
if (apiOfAttr && apiOfAttr.tsType && !apiOfAttr.tsType.includes('nasl.core.String'))
|
|
2101
|
+
return '';
|
|
2102
|
+
}
|
|
2103
|
+
value = value
|
|
2104
|
+
.replace(/"/g, "'")
|
|
2105
|
+
.replace(/\$utils\['(.+?)'\]/g, '$1')
|
|
2106
|
+
.replace(/\$refs./g, 'elements.')
|
|
2107
|
+
.replace(/\$global.userInfo/g, 'nasl.auth.userInfo')
|
|
2108
|
+
.replace(/\$global./g, 'nasl.')
|
|
2109
|
+
.replace(/\bscope\.item\.\b/g, '')
|
|
2110
|
+
.replace(/\bcurrent\.item\.\b/g, '');
|
|
2111
|
+
if (isLockField(element)) {
|
|
2112
|
+
return element.tag === 'u-text' ? `${name}="--"` : `${name}=""`;
|
|
2113
|
+
}
|
|
2114
|
+
return `${name}="{{ ${value} }}"`;
|
|
2115
|
+
});
|
|
2116
|
+
else
|
|
2117
|
+
return defaultResult;
|
|
2118
|
+
}
|
|
2119
|
+
return false;
|
|
2120
|
+
},
|
|
2121
|
+
bindStylesFormat: (bindStyles, element) => false,
|
|
2122
|
+
getExtraParts: (el) => {
|
|
2123
|
+
const parts = [];
|
|
2124
|
+
const config = (0, store_2.getConfig)();
|
|
2125
|
+
const api = config?.allNodesAPI?.[el?.tag];
|
|
2126
|
+
const emptySlot = api && api.slots && api.slots.find((slot) => slot.name === 'default' && slot['emptyBackground']);
|
|
2127
|
+
const hasSupport = api && api.slots && api.slots.some((slot) => slot.support);
|
|
2128
|
+
if (emptySlot || hasSupport) {
|
|
2129
|
+
// 有些限制的组件如侧边栏分组有title插槽但要限制子元素放入
|
|
2130
|
+
const validChildren = el.children.filter((elem) => !(elem.tag === 'template' && elem.slotTarget !== 'default'));
|
|
2131
|
+
let childEmpty = !validChildren.length;
|
|
2132
|
+
const defaultSlot = el.children.find((elem) => elem.tag === 'template' && elem.slotTarget === 'default');
|
|
2133
|
+
if (defaultSlot) {
|
|
2134
|
+
childEmpty = !defaultSlot.children.length;
|
|
2135
|
+
}
|
|
2136
|
+
if (childEmpty) {
|
|
2137
|
+
let addEmpty = true;
|
|
2138
|
+
if (['u-grid-view', 'u-list-view', 'van-list-view', 'van-grid-view', 'u-carousel'].includes(el.tag)) {
|
|
2139
|
+
const hasDataSource = el.bindAttrs.find((attr) => attr.name === 'dataSource');
|
|
2140
|
+
addEmpty = !hasDataSource;
|
|
2141
|
+
}
|
|
2142
|
+
if (el.tag === 'u-crumb') {
|
|
2143
|
+
const attrList = el.bindAttrs;
|
|
2144
|
+
const hasAuto = attrList.some((attr) => attr.name === 'auto' && String(attr.value) === 'true');
|
|
2145
|
+
if (hasAuto)
|
|
2146
|
+
addEmpty = false;
|
|
2147
|
+
}
|
|
2148
|
+
if ([
|
|
2149
|
+
'u-select',
|
|
2150
|
+
'u-dropdown',
|
|
2151
|
+
'u-panel',
|
|
2152
|
+
'u-toc',
|
|
2153
|
+
'u-toc-item',
|
|
2154
|
+
'u-tree-view-new',
|
|
2155
|
+
'u-tree-view-node-new',
|
|
2156
|
+
'u-tree-select',
|
|
2157
|
+
'u-tree-select-new',
|
|
2158
|
+
'u-anchor',
|
|
2159
|
+
'u-drawer',
|
|
2160
|
+
'u-timeline',
|
|
2161
|
+
'u-tabs',
|
|
2162
|
+
].includes(el.tag)) {
|
|
2163
|
+
addEmpty = false;
|
|
2164
|
+
}
|
|
2165
|
+
const background = (emptySlot && emptySlot['emptyBackground']) || (hasSupport ? 'add-sub' : '');
|
|
2166
|
+
addEmpty && parts.push(`vusion-empty-background="${background}"`);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
if (['u-router-view', 'van-router-view'].includes(el.tag)) {
|
|
2170
|
+
const excludes = ['background-color:', 'background:', 'background-image:'];
|
|
2171
|
+
if (excludes.some((key) => el.staticStyle && el.staticStyle.includes(key))) {
|
|
2172
|
+
parts.push(':designer="false"');
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
return parts;
|
|
2176
|
+
},
|
|
2177
|
+
isDev: true,
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
isLikeComponent(node) {
|
|
2181
|
+
return ['View', 'BusinessComponent'].includes(node?.concept);
|
|
2182
|
+
}
|
|
2183
|
+
// 获取currentList
|
|
2184
|
+
getCurrentList() {
|
|
2185
|
+
const argsList = [];
|
|
2186
|
+
let parent = this.parentNode;
|
|
2187
|
+
let index = 0;
|
|
2188
|
+
while (parent && !this.isLikeComponent(parent)) {
|
|
2189
|
+
if (parent.slotScope) {
|
|
2190
|
+
argsList.push(index === 0 ? 'current' : 'current' + index);
|
|
2191
|
+
index++;
|
|
2192
|
+
}
|
|
2193
|
+
parent = parent.parentNode;
|
|
2194
|
+
}
|
|
2195
|
+
return argsList;
|
|
2196
|
+
}
|
|
2197
|
+
get refName() {
|
|
2198
|
+
let refName = this.name;
|
|
2199
|
+
const list = this.getCurrentList();
|
|
2200
|
+
if (Array.isArray(list) && list.length) {
|
|
2201
|
+
list.forEach((item) => {
|
|
2202
|
+
refName += `_\${(${item} || {}).__nodeKey || (${item} || {}).index}`;
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
return refName;
|
|
2206
|
+
}
|
|
2207
|
+
get keyName() {
|
|
2208
|
+
// 是否配置了v-if
|
|
2209
|
+
const isDefineIf = this.bindDirectives.some((directive) => directive.name === 'if' && directive.expression);
|
|
2210
|
+
if (isDefineIf) {
|
|
2211
|
+
let key = this.name;
|
|
2212
|
+
const list = this.getCurrentList();
|
|
2213
|
+
// v-for中需要加上nodeKey
|
|
2214
|
+
if (Array.isArray(list) && list.length) {
|
|
2215
|
+
list.forEach((item) => {
|
|
2216
|
+
key += `_\${(${item} || {}).__nodeKey || (${item} || {}).index}`;
|
|
2217
|
+
});
|
|
2218
|
+
}
|
|
2219
|
+
return key;
|
|
2220
|
+
}
|
|
2221
|
+
return null;
|
|
2222
|
+
}
|
|
2223
|
+
get businessComponent() {
|
|
2224
|
+
return this.getAncestor('BusinessComponent');
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* 转换成 Vue 的模板格式
|
|
2228
|
+
*/
|
|
2229
|
+
toVue(options) {
|
|
2230
|
+
// lockField 不翻译modal
|
|
2231
|
+
if (options?.isDev && this?.tag === 'u-modal' && isLockField(this)) {
|
|
2232
|
+
return ``;
|
|
2233
|
+
}
|
|
2234
|
+
const { finalCode, asCompontent } = options || {};
|
|
2235
|
+
const parts = [];
|
|
2236
|
+
if (finalCode === false) {
|
|
2237
|
+
const isRoot = options.isRoot;
|
|
2238
|
+
if (isRoot && !options?.asCompontent) {
|
|
2239
|
+
parts.push('type="root"');
|
|
2240
|
+
if (this.frontendType?.kind === 'h5') {
|
|
2241
|
+
parts.push('class="l-root-h5"');
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
parts.push('style="height:100%; --custom-start: auto; min-height: 200px;"');
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
if (options) {
|
|
2249
|
+
options.isRoot = false;
|
|
2250
|
+
}
|
|
2251
|
+
let currentList = [];
|
|
2252
|
+
if (Array.isArray(options?.currentList)) {
|
|
2253
|
+
currentList = [...options?.currentList];
|
|
2254
|
+
}
|
|
2255
|
+
if (this.slotScope) {
|
|
2256
|
+
currentList.unshift(this.slotScope);
|
|
2257
|
+
}
|
|
2258
|
+
const newOptions = Object.assign({
|
|
2259
|
+
indentStyle: 'space',
|
|
2260
|
+
tabSize: 4,
|
|
2261
|
+
indentLevel: 0,
|
|
2262
|
+
aslIdAttr: false,
|
|
2263
|
+
nodePathAttr: false,
|
|
2264
|
+
getExtraParts: () => [],
|
|
2265
|
+
attrFormat: (attr, element, defaultResult) => defaultResult,
|
|
2266
|
+
bindStylesFormat: (bindStyles, element) => {
|
|
2267
|
+
if (bindStyles.length === 0)
|
|
2268
|
+
return false;
|
|
2269
|
+
return `:style="{${bindStyles
|
|
2270
|
+
.map((item) => item.toVue())
|
|
2271
|
+
.filter((item) => item !== undefined)
|
|
2272
|
+
.join(', ')}}"`;
|
|
2273
|
+
},
|
|
2274
|
+
}, options, {
|
|
2275
|
+
currentList,
|
|
2276
|
+
});
|
|
2277
|
+
const tabString = ' '.repeat(newOptions.tabSize * newOptions.indentLevel);
|
|
2278
|
+
const insideTabString = ' '.repeat(newOptions.tabSize * (newOptions.indentLevel + 1));
|
|
2279
|
+
let shouldIndent = true;
|
|
2280
|
+
let content = !this.children
|
|
2281
|
+
? ''
|
|
2282
|
+
: this.children
|
|
2283
|
+
.map((element) => {
|
|
2284
|
+
const childOptions = Object.assign({}, newOptions);
|
|
2285
|
+
childOptions.indentLevel++;
|
|
2286
|
+
return (shouldIndent ? '\n' + insideTabString : '') + element?.toVue(childOptions);
|
|
2287
|
+
})
|
|
2288
|
+
.join('');
|
|
2289
|
+
if (newOptions.aslIdAttr) {
|
|
2290
|
+
if (newOptions.aslIdAttr === true) {
|
|
2291
|
+
newOptions.aslIdAttr = 'asl-id';
|
|
2292
|
+
}
|
|
2293
|
+
parts.push(`${newOptions.aslIdAttr}="${this.id}"`);
|
|
2294
|
+
}
|
|
2295
|
+
if (newOptions.nodePathAttr) {
|
|
2296
|
+
// 注入 asl 的 node-path
|
|
2297
|
+
parts.push(`vusion-node-path="${this.nodePath}"`);
|
|
2298
|
+
}
|
|
2299
|
+
// 模板里解析时候,可能会有多级嵌套的 current,所以当前有多少的长度,当前就是多大的下标
|
|
2300
|
+
this.slotTarget &&
|
|
2301
|
+
parts.push(`#${this.slotTarget}` +
|
|
2302
|
+
(this.slotScope
|
|
2303
|
+
? `="${currentList.length > 1 ? this.slotScope + (currentList.length - 1) : this.slotScope}"`
|
|
2304
|
+
: ''));
|
|
2305
|
+
this.refName && parts.push(`:ref="\`${this.refName}\`"`);
|
|
2306
|
+
this.keyName && parts.push(`:key="\`${this.keyName}\`"`);
|
|
2307
|
+
this.staticClass && parts.push(`class="${this.staticClass}"`);
|
|
2308
|
+
let dataRefList = [];
|
|
2309
|
+
const vIfs = [];
|
|
2310
|
+
[]
|
|
2311
|
+
.concat(this.bindAttrs, this.bindDirectives, this.bindEvents)
|
|
2312
|
+
.forEach((attr) => {
|
|
2313
|
+
let result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
|
|
2314
|
+
// 属性翻译为指令 :仅封闭态流程表单内使用
|
|
2315
|
+
if (options?.filterAttr &&
|
|
2316
|
+
options?.filterAttr?.length > 0 &&
|
|
2317
|
+
attr.concept === 'BindAttribute' &&
|
|
2318
|
+
attr.name === 'processHidden') {
|
|
2319
|
+
options?.filterAttr.map((filterAttrName) => {
|
|
2320
|
+
if (attr.name === filterAttrName) {
|
|
2321
|
+
result = null;
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
if ((options?.isExport || options?.isRelease) &&
|
|
2326
|
+
attr?.concept === 'BindAttribute' &&
|
|
2327
|
+
attr?.name === 'src' &&
|
|
2328
|
+
/^\/assets\/(.*?)$/.test(String(attr?.value ?? '')) &&
|
|
2329
|
+
// && attr.value.includes('/assets/')
|
|
2330
|
+
this.app?.sysPrefixPath?.length > 0) {
|
|
2331
|
+
result = result?.replace('/assets/', `${this.app?.sysPrefixPath}/assets/`);
|
|
2332
|
+
}
|
|
2333
|
+
// v-auth v-if 都翻译成 v-if
|
|
2334
|
+
if (asserts.isBindDirective(attr) && ['if', 'auth'].includes(attr.name) && result !== false) {
|
|
2335
|
+
const expr = result.replace(/v-(if|auth)="(.*)"/, (match, p1, p2) => p2);
|
|
2336
|
+
if (expr)
|
|
2337
|
+
vIfs.push(attr.name === 'if' ? expr : `$auth.has(${expr})`);
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2340
|
+
result && parts.push(result);
|
|
2341
|
+
});
|
|
2342
|
+
const genDirectiveByAnno = (viewElement) => {
|
|
2343
|
+
if (viewElement?.applyAnnotations?.length > 0) {
|
|
2344
|
+
// todo: 根据注解生成自定义指令 v-annoName="context"
|
|
2345
|
+
// 血缘算法要生成一个所有的 Entity-ViewElement 的映射map
|
|
2346
|
+
// context 从 血缘算法映射获取 getRelataionByElement()
|
|
2347
|
+
return viewElement.applyAnnotations.map((aa) => {
|
|
2348
|
+
const getExpressionValue = (expression) => {
|
|
2349
|
+
if (expression?.concept === 'BooleanLiteral') {
|
|
2350
|
+
return BooleanLiteral__1.BooleanLiteral.from(expression)?.toBoolean();
|
|
2351
|
+
}
|
|
2352
|
+
if (expression?.concept === 'NewList') {
|
|
2353
|
+
return eval(expression.toUI().replace('新建:', ''));
|
|
2354
|
+
}
|
|
2355
|
+
return expression?.value;
|
|
2356
|
+
};
|
|
2357
|
+
let argsList = aa.arguments.map((arg) => getExpressionValue(arg.expression));
|
|
2358
|
+
let annoArgs = {
|
|
2359
|
+
argsList,
|
|
2360
|
+
dataRefList,
|
|
2361
|
+
};
|
|
2362
|
+
// 所有参数序列化之后当字符串传进指令参数 (目前不支持<div v-demo="{ color: 'white', text: 'hello!' }"></div>
|
|
2363
|
+
let expression = StringLiteral__1.StringLiteral.from({
|
|
2364
|
+
concept: 'StringLiteral',
|
|
2365
|
+
kind: 'Expression',
|
|
2366
|
+
name: '',
|
|
2367
|
+
value: JSON.stringify(annoArgs),
|
|
2368
|
+
});
|
|
2369
|
+
const BindDirective = (0, decorators_1.getConceptConstructor)('BindDirective');
|
|
2370
|
+
let annoDirective = BindDirective.from({
|
|
2371
|
+
name: aa.annotationName,
|
|
2372
|
+
// arg:'arg',
|
|
2373
|
+
expression,
|
|
2374
|
+
});
|
|
2375
|
+
return annoDirective;
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
};
|
|
2379
|
+
let isH5ListViewLayout = this?.tag === 'van-cell' && this.getAncestorByTag('ViewElement', 'van-list-view');
|
|
2380
|
+
let isListViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-list-view');
|
|
2381
|
+
let isGridViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-grid-view');
|
|
2382
|
+
const getLogicDataRef = (viewElement) => {
|
|
2383
|
+
// 自上向下查找, 指令需要翻译到绑定值元素的上级父元素
|
|
2384
|
+
// 这个元素需要满足 1 向下能找到 绑定了值的表单子元素
|
|
2385
|
+
// 2 向上能找到 固定的几种表单元素 且带有dataSource 并找到对应的calllogic name
|
|
2386
|
+
let targetTag = ['u-table-view-column']; //'u-form-item' 逻辑无法感知到表单绑定值的变更
|
|
2387
|
+
let logicName;
|
|
2388
|
+
const addDataRefDriective = (ve) => {
|
|
2389
|
+
const addDataRefDriectiveInner = (attr, type) => {
|
|
2390
|
+
let { typeKind, typeName, typeNamespace } = type || {};
|
|
2391
|
+
if (['anonymousStructure', 'reference'].includes(typeKind)) {
|
|
2392
|
+
let parent = this.getAncestorByTag('ViewElement', 'u-table-view') ||
|
|
2393
|
+
this.getAncestorByTag('ViewElement', 'u-list-view') ||
|
|
2394
|
+
this.getAncestorByTag('ViewElement', 'u-grid-view') ||
|
|
2395
|
+
this.getAncestorByTag('ViewElement', 'van-grid-view') ||
|
|
2396
|
+
this.getAncestorByTag('ViewElement', 'van-list-view');
|
|
2397
|
+
let canAdd = parent?.tag;
|
|
2398
|
+
if (isGridViewLayout || isListViewLayout) {
|
|
2399
|
+
let nestLinearLayout = this.children.find((c) => c.tag === 'u-linear-layout');
|
|
2400
|
+
canAdd = canAdd && !nestLinearLayout;
|
|
2401
|
+
}
|
|
2402
|
+
if (canAdd) {
|
|
2403
|
+
let dataSourceAttr = parent?.bindAttrs?.find((it) => it?.name === 'dataSource');
|
|
2404
|
+
if (dataSourceAttr?.expression?.concept === 'CallLogic') {
|
|
2405
|
+
if (dataSourceAttr?.expression?.calleeNamespace === 'app.logics') {
|
|
2406
|
+
logicName = dataSourceAttr?.expression?.calleeName;
|
|
2407
|
+
let ref = {
|
|
2408
|
+
typeNamespace: 'app.logics',
|
|
2409
|
+
typeName: logicName,
|
|
2410
|
+
propName: attr?.expression.toUI()?.replace('current.item.', ''),
|
|
2411
|
+
};
|
|
2412
|
+
dataRefList.push(ref);
|
|
2413
|
+
// 要考虑 多个元素 每个元素有多个注解的情况
|
|
2414
|
+
let result = genDirectiveByAnno(viewElement)?.map((d) => d?.toVue());
|
|
2415
|
+
result && result?.length > 0 && parts.push(...result);
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
// 特殊的表格列 实体属性boolean 会转为 带if(实体属性) {展示 '是' text}
|
|
2422
|
+
ve?.bindDirectives?.find((direct) => {
|
|
2423
|
+
let type = direct?.expression?.object?.__TypeAnnotation;
|
|
2424
|
+
type && addDataRefDriectiveInner(direct, type);
|
|
2425
|
+
});
|
|
2426
|
+
ve?.bindAttrs?.find((attr) => {
|
|
2427
|
+
let type = attr?.expression?.object?.__TypeAnnotation;
|
|
2428
|
+
type && addDataRefDriectiveInner(attr, type);
|
|
2429
|
+
});
|
|
2430
|
+
};
|
|
2431
|
+
// 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
|
|
2432
|
+
if (viewElement?.tag === 'van-text') {
|
|
2433
|
+
addDataRefDriective(viewElement);
|
|
2434
|
+
}
|
|
2435
|
+
if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
|
|
2436
|
+
this.traverseChildren((ve) => {
|
|
2437
|
+
addDataRefDriective(ve);
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
};
|
|
2441
|
+
// 已知问题: 逻辑的表格可以推导 表单无法推导(如果是实体拖过来的 还是指向实体)
|
|
2442
|
+
// 已知问题: 目前采用隐藏父元素的方式; 后续有任何 tag 或者结构更改都不生效
|
|
2443
|
+
getLogicDataRef(this);
|
|
2444
|
+
const getEntityDataRef = (viewElement) => {
|
|
2445
|
+
// 这个类型都是 默认找到子元素的数据引用 然后加到自己的指令上
|
|
2446
|
+
let targetTag = ['u-table-view-column', 'u-form-item'];
|
|
2447
|
+
const addDataRefDriective = (ve) => {
|
|
2448
|
+
const getEntityDataRefInner = (attr, type) => {
|
|
2449
|
+
let canAdd = type;
|
|
2450
|
+
if (isGridViewLayout || isListViewLayout) {
|
|
2451
|
+
let nestLinearLayout = this.children.find((c) => c.tag === 'u-linear-layout');
|
|
2452
|
+
canAdd = canAdd && !nestLinearLayout;
|
|
2453
|
+
}
|
|
2454
|
+
if (canAdd) {
|
|
2455
|
+
let { typeKind, typeName, typeNamespace } = type || {};
|
|
2456
|
+
if (typeKind === 'reference' && typeNamespace) {
|
|
2457
|
+
let entityPropName = attr?.expression?.property?.name;
|
|
2458
|
+
let ref = {
|
|
2459
|
+
typeNamespace,
|
|
2460
|
+
typeName,
|
|
2461
|
+
propName: entityPropName,
|
|
2462
|
+
};
|
|
2463
|
+
dataRefList.push(ref);
|
|
2464
|
+
let result = genDirectiveByAnno(viewElement)?.map((d) => d?.toVue());
|
|
2465
|
+
result && result?.length > 0 && parts.push(...result);
|
|
2466
|
+
}
|
|
2467
|
+
// typeName "Entity1"
|
|
2468
|
+
// typeNamespace "app.dataSources.defaultDS.entities"
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
ve?.bindDirectives?.find((direct) => {
|
|
2472
|
+
let type = direct?.expression?.object?.__TypeAnnotation;
|
|
2473
|
+
type && getEntityDataRefInner(direct, type);
|
|
2474
|
+
});
|
|
2475
|
+
ve?.bindAttrs?.find((attr) => {
|
|
2476
|
+
let type = attr?.expression?.object?.__TypeAnnotation;
|
|
2477
|
+
type && getEntityDataRefInner(attr, type);
|
|
2478
|
+
});
|
|
2479
|
+
};
|
|
2480
|
+
// 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
|
|
2481
|
+
if (viewElement?.tag === 'van-text') {
|
|
2482
|
+
addDataRefDriective(viewElement);
|
|
2483
|
+
}
|
|
2484
|
+
if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
|
|
2485
|
+
this.traverseChildren((ve) => addDataRefDriective(ve));
|
|
2486
|
+
}
|
|
2487
|
+
// 数据网格: 指令单元是线性布局 (数据列表结构也一样)
|
|
2488
|
+
// 1 向下能找到 一个绑定了数据源的元素
|
|
2489
|
+
// 2 向上是线性布局 卡片 template gridView
|
|
2490
|
+
};
|
|
2491
|
+
getEntityDataRef(this);
|
|
2492
|
+
if (vIfs.length === 2)
|
|
2493
|
+
parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
|
|
2494
|
+
else if (vIfs.length === 1)
|
|
2495
|
+
parts.push(`v-if="${vIfs[0]}"`);
|
|
2496
|
+
const bindStyles = newOptions.bindStylesFormat(this.bindStyles, this);
|
|
2497
|
+
if (bindStyles)
|
|
2498
|
+
parts.push(bindStyles);
|
|
2499
|
+
newOptions.getExtraParts(this).forEach((part) => parts.push(part));
|
|
2500
|
+
if (['u-modal', 'u-drawer'].includes(this.tag)) {
|
|
2501
|
+
this.children.forEach((citem) => {
|
|
2502
|
+
if (citem.tag === 'template' && !citem.children.length) {
|
|
2503
|
+
parts.push(`:is-${citem.slotTarget}-slot-empty=true`);
|
|
2504
|
+
}
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
// 部分组件增加 key 唯一标识,防止 vue 判断重复节点,导致渲染异常
|
|
2508
|
+
if (this.name &&
|
|
2509
|
+
['u-table-view', 'u-list-view', 'u-grid-view', 'u-list-components', 'u-form', 'u-select'].includes(this.tag)) {
|
|
2510
|
+
this.name && parts.push(`key="${this.name}"`);
|
|
2511
|
+
}
|
|
2512
|
+
let tag = this.tag;
|
|
2513
|
+
let staticStyle = this.staticStyle ?? '';
|
|
2514
|
+
if (this.tag === 'slot') {
|
|
2515
|
+
this.name && parts.push(`name="${this.name}"`);
|
|
2516
|
+
if (finalCode === false) {
|
|
2517
|
+
tag = 'div';
|
|
2518
|
+
if (asCompontent) {
|
|
2519
|
+
parts.push(`vusion-slot-name="${this.name}"`);
|
|
2520
|
+
content = `<slot name="${this.name}">
|
|
2521
|
+
<div s-empty="true" bs-empty="true" style="background: #f7f8fa;
|
|
2522
|
+
border: 1px dashed #c3c3c3;
|
|
2523
|
+
text-align: center;
|
|
2524
|
+
color: #999;
|
|
2525
|
+
min-height: 32px;
|
|
2526
|
+
min-width: 32px;
|
|
2527
|
+
width: 100%;
|
|
2528
|
+
align-items: center;
|
|
2529
|
+
display: inline-flex;
|
|
2530
|
+
justify-content: center;">
|
|
2531
|
+
+
|
|
2532
|
+
</div>
|
|
2533
|
+
</slot>`;
|
|
2534
|
+
}
|
|
2535
|
+
else {
|
|
2536
|
+
parts.push(`vusion-node-path="${this.nodePath}"`);
|
|
2537
|
+
content = `组件占位,可在使用业务组件时插入任意组件`;
|
|
2538
|
+
staticStyle += `background: linear-gradient(-45deg,#fff 25%,#f3f5fa 0,#f3f5fa 50%,#fff 0,#fff 75%,#f3f5fa 0);
|
|
2539
|
+
background-size: 45px 45px;
|
|
2540
|
+
background-repeat: repeat;
|
|
2541
|
+
line-height: 32px;
|
|
2542
|
+
min-height: 32px;
|
|
2543
|
+
color: var(--font-second-color);
|
|
2544
|
+
text-align: center;`;
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
else if (finalCode === false && this.isCorrespondingBusinessComponent && !this.correspondingBusinessComponent) {
|
|
2549
|
+
content = `未找到组件定义,请手动移除`;
|
|
2550
|
+
staticStyle += `display: block;
|
|
2551
|
+
background: linear-gradient(-45deg,#fff 25%,#f3f5fa 0,#f3f5fa 50%,#fff 0,#fff 75%,#f3f5fa 0);
|
|
2552
|
+
background-size: 45px 45px;
|
|
2553
|
+
background-repeat: repeat;
|
|
2554
|
+
line-height: 32px;
|
|
2555
|
+
min-height: 32px;
|
|
2556
|
+
color: var(--font-second-color);
|
|
2557
|
+
text-align: center;`;
|
|
2558
|
+
}
|
|
2559
|
+
if ((options?.isExport || options?.isRelease) &&
|
|
2560
|
+
staticStyle?.includes(`url('/assets/`) &&
|
|
2561
|
+
this.app.sysPrefixPath?.length > 0) {
|
|
2562
|
+
staticStyle = staticStyle.replace(/url\('\/assets\/(.*?)'\)/, `url('${this.app.sysPrefixPath}/assets/$1')`);
|
|
2563
|
+
}
|
|
2564
|
+
staticStyle && parts.push(`style="${staticStyle}"`);
|
|
2565
|
+
// input hidden属性 要翻译到上级元素的 栅格列的if指令
|
|
2566
|
+
// 从父查子 若有hidden 直接输出null
|
|
2567
|
+
if (this?.name?.includes('grid_layout_column') && !(options?.filterAttr && options?.filterAttr?.length > 0)) {
|
|
2568
|
+
let checkHiddenAttr = (it) => it?.bindAttrs?.find((attr) => attr?.name === 'processHidden');
|
|
2569
|
+
let getHiddenChild = (el) => {
|
|
2570
|
+
return el.children?.find((it) => {
|
|
2571
|
+
return it.children?.find((item) => checkHiddenAttr(item));
|
|
2572
|
+
//return checkHiddenAttr(it)
|
|
2573
|
+
});
|
|
2574
|
+
};
|
|
2575
|
+
if (getHiddenChild(this)) {
|
|
2576
|
+
parts.push(`v-show="window.Vue.prototype.$env.VUE_APP_DESIGNER"`);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
if (!content.length) {
|
|
2580
|
+
shouldIndent = false;
|
|
2581
|
+
}
|
|
2582
|
+
let partsLength = 0;
|
|
2583
|
+
let partsString = '';
|
|
2584
|
+
parts.forEach((part) => {
|
|
2585
|
+
if (partsLength >= 120 || part.length >= 120) {
|
|
2586
|
+
partsString += '\n' + tabString + ' '.repeat(3); // ' '.repeat(el.tag.length + 1);
|
|
2587
|
+
partsLength = 0;
|
|
2588
|
+
}
|
|
2589
|
+
partsString += ' ' + part;
|
|
2590
|
+
partsLength += part.length;
|
|
2591
|
+
});
|
|
2592
|
+
let htmlContent = `<${tag}${partsString.length ? partsString : ''}>` +
|
|
2593
|
+
content +
|
|
2594
|
+
(shouldIndent ? '\n' + tabString : '') +
|
|
2595
|
+
`</${tag}>`;
|
|
2596
|
+
if (!content.trim() && selfClosingTag.includes(tag)) {
|
|
2597
|
+
htmlContent = `<${tag}${partsString.length ? partsString : ''} />`;
|
|
2598
|
+
}
|
|
2599
|
+
return htmlContent;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* 从父级删除该节点
|
|
2603
|
+
* @internal
|
|
2604
|
+
*/
|
|
2605
|
+
delete() {
|
|
2606
|
+
super.delete();
|
|
2607
|
+
if (this.parentNode) {
|
|
2608
|
+
this.traverseChildren((ele) => {
|
|
2609
|
+
this.likeComponent?.removeExistingViewElement(ele);
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2613
|
+
findElementByName(name) {
|
|
2614
|
+
return utils.traverse((current) => {
|
|
2615
|
+
if (current.node.name === name)
|
|
2616
|
+
return current.node;
|
|
2617
|
+
}, { node: this });
|
|
2618
|
+
}
|
|
2619
|
+
findElementByTag(tag) {
|
|
2620
|
+
return utils.traverse((current) => {
|
|
2621
|
+
if (current.node.tag === tag)
|
|
2622
|
+
return current.node;
|
|
2623
|
+
}, { node: this });
|
|
2624
|
+
}
|
|
2625
|
+
findElementByAttr(name, value) {
|
|
2626
|
+
return utils.traverse((current) => {
|
|
2627
|
+
if (current.node.bindAttrs.some((attr) => attr.name === name && attr.value === value))
|
|
2628
|
+
return current.node;
|
|
2629
|
+
}, { node: this });
|
|
2630
|
+
}
|
|
2631
|
+
// 查找element下有没有某个类型的元素,有就返回
|
|
2632
|
+
findElementItem(conceptName) {
|
|
2633
|
+
return utils.traverse((current) => {
|
|
2634
|
+
if (current.node.concept === conceptName)
|
|
2635
|
+
return current.node;
|
|
2636
|
+
}, { node: this }, { mode: 'anyObject', excludedKeySet: this.JSON_EXCLUDED_KEYS });
|
|
2637
|
+
}
|
|
2638
|
+
getCurrentName() {
|
|
2639
|
+
let current = 'current';
|
|
2640
|
+
let parent = this.parentNode;
|
|
2641
|
+
let index = 0;
|
|
2642
|
+
while (parent && !this.isLikeComponent(parent)) {
|
|
2643
|
+
if (parent.slotScope) {
|
|
2644
|
+
index++;
|
|
2645
|
+
}
|
|
2646
|
+
parent = parent.parentNode;
|
|
2647
|
+
}
|
|
2648
|
+
current = index === 0 ? 'current' : 'current' + index;
|
|
2649
|
+
return current;
|
|
2650
|
+
}
|
|
2651
|
+
/**
|
|
2652
|
+
* 计算约束样式
|
|
2653
|
+
* @param positionData 位置数据
|
|
2654
|
+
* @param ops 配置项
|
|
2655
|
+
* @param ops.beforeSetStyleCb 设置样式前的回调
|
|
2656
|
+
* @param ops.isUpdateConstraintRule 是否修改约束规则
|
|
2657
|
+
*/
|
|
2658
|
+
computeConstraintStyle(positionData, ops = {}) {
|
|
2659
|
+
if (!positionData) {
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
const { nodeRect, parentRect, parentBorder } = positionData;
|
|
2663
|
+
const staticWidth = Math.round(nodeRect.width);
|
|
2664
|
+
const staticHeight = Math.round(nodeRect.height);
|
|
2665
|
+
const staticLeft = Math.round(nodeRect.left - parentRect.left - parentBorder.left);
|
|
2666
|
+
const staticTop = Math.round(nodeRect.top - parentRect.top - parentBorder.top);
|
|
2667
|
+
const staticRight = Math.round(parentRect.width - nodeRect.width - staticLeft - parentBorder.right - parentBorder.left);
|
|
2668
|
+
const staticBottom = Math.round(parentRect.height - nodeRect.height - staticTop - parentBorder.bottom - parentBorder.top);
|
|
2669
|
+
const styleObj = this.parseStyleToObject(this.staticStyle);
|
|
2670
|
+
let constraintX = styleObj['--constraint-x'] || 'left';
|
|
2671
|
+
let constraintY = styleObj['--constraint-y'] || 'top';
|
|
2672
|
+
const rawWidth = styleObj.width || '';
|
|
2673
|
+
const rawHeight = styleObj.height || '';
|
|
2674
|
+
let left = '';
|
|
2675
|
+
let right = '';
|
|
2676
|
+
let top = '';
|
|
2677
|
+
let bottom = '';
|
|
2678
|
+
let transform = '';
|
|
2679
|
+
let width = ops.isUpdateConstraintRule ? `${staticWidth}px` : rawWidth;
|
|
2680
|
+
let height = ops.isUpdateConstraintRule ? `${staticHeight}px` : rawHeight;
|
|
2681
|
+
const parentWidth = staticLeft + staticWidth + staticRight;
|
|
2682
|
+
const parentHeight = staticTop + staticHeight + staticBottom;
|
|
2683
|
+
// 如果没有修改过约束规则,且非正在修改规则,则根据元素在父容器的位置自动判断约束规则
|
|
2684
|
+
// 中心固定判定阈值
|
|
2685
|
+
const threshold = 3;
|
|
2686
|
+
if (!styleObj['--constraint-modified'] && !ops.isUpdateConstraintRule) {
|
|
2687
|
+
if (Math.abs(staticLeft - staticRight) < threshold) {
|
|
2688
|
+
constraintX = 'center';
|
|
2689
|
+
}
|
|
2690
|
+
else if (staticLeft > parentWidth / 2) {
|
|
2691
|
+
constraintX = 'right';
|
|
2692
|
+
}
|
|
2693
|
+
else if (staticRight > parentWidth / 2) {
|
|
2694
|
+
constraintX = 'left';
|
|
2695
|
+
}
|
|
2696
|
+
if (Math.abs(staticTop - staticBottom) < threshold) {
|
|
2697
|
+
constraintY = 'center';
|
|
2698
|
+
}
|
|
2699
|
+
else if (staticTop > parentHeight / 2) {
|
|
2700
|
+
constraintY = 'bottom';
|
|
2701
|
+
}
|
|
2702
|
+
else if (staticBottom > parentHeight / 2) {
|
|
2703
|
+
constraintY = 'top';
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
if (constraintX === 'left') {
|
|
2707
|
+
left = staticLeft + 'px';
|
|
2708
|
+
right = '';
|
|
2709
|
+
}
|
|
2710
|
+
else if (constraintX === 'right') {
|
|
2711
|
+
left = '';
|
|
2712
|
+
right = staticRight + 'px';
|
|
2713
|
+
}
|
|
2714
|
+
else if (constraintX === 'center') {
|
|
2715
|
+
const offset = staticLeft + staticWidth / 2 - parentWidth / 2;
|
|
2716
|
+
left = `calc(50% ${offset > 0 ? '+' : '-'} ${Math.abs(offset)}px)`;
|
|
2717
|
+
right = '';
|
|
2718
|
+
transform = 'translateX(-50%)';
|
|
2719
|
+
}
|
|
2720
|
+
else if (constraintX === 'scale') {
|
|
2721
|
+
left = (staticLeft * 100) / parentWidth + '%';
|
|
2722
|
+
right = '';
|
|
2723
|
+
width = (staticWidth * 100) / parentWidth + '%';
|
|
2724
|
+
}
|
|
2725
|
+
else if (constraintX === 'left-right') {
|
|
2726
|
+
left = staticLeft + 'px';
|
|
2727
|
+
right = staticRight + 'px';
|
|
2728
|
+
width = 'auto';
|
|
2729
|
+
}
|
|
2730
|
+
if (constraintY === 'top') {
|
|
2731
|
+
top = staticTop + 'px';
|
|
2732
|
+
bottom = '';
|
|
2733
|
+
}
|
|
2734
|
+
else if (constraintY === 'bottom') {
|
|
2735
|
+
top = '';
|
|
2736
|
+
bottom = staticBottom + 'px';
|
|
2737
|
+
}
|
|
2738
|
+
else if (constraintY === 'center') {
|
|
2739
|
+
const offset = staticTop + staticHeight / 2 - parentHeight / 2;
|
|
2740
|
+
top = `calc(50% ${offset > 0 ? '+' : '-'} ${Math.abs(offset)}px)`;
|
|
2741
|
+
bottom = '';
|
|
2742
|
+
transform = transform ? 'translate(-50%, -50%)' : 'translateY(-50%)';
|
|
2743
|
+
}
|
|
2744
|
+
else if (constraintY === 'scale') {
|
|
2745
|
+
top = (staticTop * 100) / parentHeight + '%';
|
|
2746
|
+
bottom = '';
|
|
2747
|
+
height = (staticHeight * 100) / parentHeight + '%';
|
|
2748
|
+
}
|
|
2749
|
+
else if (constraintY === 'top-bottom') {
|
|
2750
|
+
top = staticTop + 'px';
|
|
2751
|
+
bottom = staticBottom + 'px';
|
|
2752
|
+
height = 'auto';
|
|
2753
|
+
}
|
|
2754
|
+
const newStyleObj = {
|
|
2755
|
+
...styleObj,
|
|
2756
|
+
left,
|
|
2757
|
+
right,
|
|
2758
|
+
top,
|
|
2759
|
+
bottom,
|
|
2760
|
+
transform,
|
|
2761
|
+
width,
|
|
2762
|
+
height,
|
|
2763
|
+
'--constraint-x': constraintX,
|
|
2764
|
+
'--constraint-y': constraintY,
|
|
2765
|
+
};
|
|
2766
|
+
if (ops.isUpdateConstraintRule) {
|
|
2767
|
+
newStyleObj['--constraint-modified'] = 1;
|
|
2768
|
+
}
|
|
2769
|
+
ops.beforeSetStyleCb?.(newStyleObj);
|
|
2770
|
+
const newStaticStyle = this.stringifyStyleAttr(newStyleObj);
|
|
2771
|
+
this.setStaticStyle(newStaticStyle);
|
|
2772
|
+
}
|
|
2773
|
+
updateStyleObj(styleObj) {
|
|
2774
|
+
this.setStaticStyle(this.stringifyStyleAttr({
|
|
2775
|
+
...this.parseStyleToObject(this.staticStyle),
|
|
2776
|
+
...styleObj,
|
|
2777
|
+
}));
|
|
2778
|
+
}
|
|
2779
|
+
parseStyleToObject(styleStr = '') {
|
|
2780
|
+
const [styleStr1, styleStr2] = (styleStr || '').split('--custom-start: auto;');
|
|
2781
|
+
const styleObj = styleStr1.split(/;/gim).reduce((obj, item) => {
|
|
2782
|
+
// background-image:url(http://www...)
|
|
2783
|
+
item = item.trim();
|
|
2784
|
+
const pos = item.indexOf(':');
|
|
2785
|
+
if (pos >= 0) {
|
|
2786
|
+
const key = item.slice(0, pos).trim();
|
|
2787
|
+
const value = item.slice(pos + 1).trim();
|
|
2788
|
+
obj[key] = value;
|
|
2789
|
+
}
|
|
2790
|
+
return obj;
|
|
2791
|
+
}, {});
|
|
2792
|
+
styleObj['customStyle'] = styleStr2;
|
|
2793
|
+
return styleObj;
|
|
2794
|
+
}
|
|
2795
|
+
stringifyStyleAttr(styleObj) {
|
|
2796
|
+
const customStyle = styleObj['customStyle'] || '';
|
|
2797
|
+
delete styleObj['customStyle'];
|
|
2798
|
+
const styleStr = Object.keys(styleObj)
|
|
2799
|
+
// 空字符串是允许的,因为有时候想要覆盖之前的样式。undefined 则不允许
|
|
2800
|
+
.filter((key) => styleObj[key] !== undefined)
|
|
2801
|
+
.map((key) => `${key}:${String(styleObj[key]).trim()};`)
|
|
2802
|
+
.join('');
|
|
2803
|
+
if (!customStyle) {
|
|
2804
|
+
return styleStr;
|
|
2805
|
+
}
|
|
2806
|
+
return styleStr + '--custom-start: auto;' + customStyle;
|
|
2807
|
+
}
|
|
2808
|
+
// 批量更新绑定属性
|
|
2809
|
+
batchUpdateBindAttrs(attrOptions) {
|
|
2810
|
+
const BindAttribute = (0, decorators_1.getConceptConstructor)('BindAttribute');
|
|
2811
|
+
const oldBindAttrs = this.bindAttrs.filter((it) => !attrOptions.some((item) => item.name === it.name));
|
|
2812
|
+
const newBindAttrs = attrOptions.map((it) => BindAttribute.from(it, this, 'bindAttrs'));
|
|
2813
|
+
this.update({
|
|
2814
|
+
bindAttrs: [...oldBindAttrs, ...newBindAttrs],
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* 是否是流程表单
|
|
2819
|
+
*/
|
|
2820
|
+
isProcessForm() {
|
|
2821
|
+
return (this.tag.endsWith('-form') &&
|
|
2822
|
+
this.getBindAttribute('id')?.value === 'dynamicRenderContainer' &&
|
|
2823
|
+
this.getBindAttribute('processPrefix'));
|
|
2824
|
+
}
|
|
2825
|
+
getAncestorByTag(concept, tag) {
|
|
2826
|
+
let parentNode = this?.parentNode;
|
|
2827
|
+
while (parentNode && parentNode.concept && !(parentNode.concept === concept && parentNode?.tag === tag)) {
|
|
2828
|
+
parentNode = parentNode.parentNode;
|
|
2829
|
+
}
|
|
2830
|
+
return parentNode;
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
exports.ViewElement = ViewElement;
|
|
2834
|
+
__decorate([
|
|
2835
|
+
(0, decorators_1.property)()
|
|
2836
|
+
// @ts-ignore
|
|
2837
|
+
], ViewElement.prototype, "concept", void 0);
|
|
2838
|
+
__decorate([
|
|
2839
|
+
(0, decorators_1.property)()
|
|
2840
|
+
], ViewElement.prototype, "tag", void 0);
|
|
2841
|
+
__decorate([
|
|
2842
|
+
(0, decorators_1.property)()
|
|
2843
|
+
], ViewElement.prototype, "refNamespace", void 0);
|
|
2844
|
+
__decorate([
|
|
2845
|
+
(0, decorators_1.property)()
|
|
2846
|
+
], ViewElement.prototype, "name", void 0);
|
|
2847
|
+
__decorate([
|
|
2848
|
+
(0, decorators_1.property)()
|
|
2849
|
+
], ViewElement.prototype, "staticClass", void 0);
|
|
2850
|
+
__decorate([
|
|
2851
|
+
(0, decorators_1.property)()
|
|
2852
|
+
], ViewElement.prototype, "staticStyle", void 0);
|
|
2853
|
+
__decorate([
|
|
2854
|
+
(0, decorators_1.property)()
|
|
2855
|
+
], ViewElement.prototype, "authDescription", void 0);
|
|
2856
|
+
__decorate([
|
|
2857
|
+
(0, decorators_1.property)()
|
|
2858
|
+
], ViewElement.prototype, "slotTarget", void 0);
|
|
2859
|
+
__decorate([
|
|
2860
|
+
(0, decorators_1.property)()
|
|
2861
|
+
], ViewElement.prototype, "slotScope", void 0);
|
|
2862
|
+
__decorate([
|
|
2863
|
+
(0, decorators_1.property)({
|
|
2864
|
+
objectRef: 'BindAttribute',
|
|
2865
|
+
isArray: true,
|
|
2866
|
+
defaultValue: [],
|
|
2867
|
+
})
|
|
2868
|
+
], ViewElement.prototype, "bindAttrs", void 0);
|
|
2869
|
+
__decorate([
|
|
2870
|
+
(0, decorators_1.property)({
|
|
2871
|
+
objectRef: 'BindEvent',
|
|
2872
|
+
isArray: true,
|
|
2873
|
+
defaultValue: [],
|
|
2874
|
+
})
|
|
2875
|
+
], ViewElement.prototype, "bindEvents", void 0);
|
|
2876
|
+
__decorate([
|
|
2877
|
+
(0, decorators_1.property)({
|
|
2878
|
+
objectRef: 'BindDirective',
|
|
2879
|
+
isArray: true,
|
|
2880
|
+
defaultValue: [],
|
|
2881
|
+
})
|
|
2882
|
+
], ViewElement.prototype, "bindDirectives", void 0);
|
|
2883
|
+
__decorate([
|
|
2884
|
+
(0, decorators_1.property)({
|
|
2885
|
+
isArray: true,
|
|
2886
|
+
defaultValue: [],
|
|
2887
|
+
})
|
|
2888
|
+
], ViewElement.prototype, "bindRoles", void 0);
|
|
2889
|
+
__decorate([
|
|
2890
|
+
(0, decorators_1.property)({
|
|
2891
|
+
objectRef: 'BindStyle',
|
|
2892
|
+
isArray: true,
|
|
2893
|
+
defaultValue: [],
|
|
2894
|
+
})
|
|
2895
|
+
], ViewElement.prototype, "bindStyles", void 0);
|
|
2896
|
+
__decorate([
|
|
2897
|
+
(0, decorators_1.property)({
|
|
2898
|
+
objectRef: 'ViewElement',
|
|
2899
|
+
isArray: true,
|
|
2900
|
+
defaultValue: [],
|
|
2901
|
+
})
|
|
2902
|
+
], ViewElement.prototype, "children", void 0);
|
|
2903
|
+
__decorate([
|
|
2904
|
+
nasl_translator_1.withGenerator
|
|
2905
|
+
], ViewElement.prototype, "toEmbeddedTSDefinition", null);
|
|
2906
|
+
__decorate([
|
|
2907
|
+
nasl_translator_1.withGenerator
|
|
2908
|
+
], ViewElement.prototype, "toEmbeddedTSRefTree", null);
|
|
2909
|
+
__decorate([
|
|
2910
|
+
nasl_translator_1.withSourceMapGenerator
|
|
2911
|
+
], ViewElement.prototype, "toEmbeddedTS", null);
|
|
2912
|
+
__decorate([
|
|
2913
|
+
(0, nasl_translator_1.withSourceMap)()
|
|
2914
|
+
], ViewElement.prototype, "toNaturalTS", null);
|
|
2915
|
+
__decorate([
|
|
2916
|
+
(0, nasl_translator_1.withSourceMap)()
|
|
2917
|
+
], ViewElement.prototype, "toTextualNASL", null);
|
|
2918
|
+
__decorate([
|
|
2919
|
+
(0, decorators_1.excludedInJSON)()
|
|
2920
|
+
], ViewElement.prototype, "computedStyle", void 0);
|
|
2921
|
+
exports.ViewElement = ViewElement = ViewElement_1 = __decorate([
|
|
2922
|
+
(0, decorators_1.concept)('页面元素')
|
|
2923
|
+
], ViewElement);
|
|
2924
|
+
exports.default = ViewElement;
|
|
2925
|
+
//================================================================================
|
|
2926
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
2927
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
2928
|
+
//================================================================================
|
|
2929
|
+
//# sourceMappingURL=ViewElement__.js.map
|