@lcap/nasl 3.3.3-beta.7 → 3.3.5-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/.nyc_output/b920244d-8d01-4e76-be5a-95132217c5a1.json +1 -0
- package/.nyc_output/processinfo/b920244d-8d01-4e76-be5a-95132217c5a1.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +461 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/automate/engine/index.html +116 -0
- package/coverage/src/automate/engine/utils.js.html +1414 -0
- package/coverage/src/bak/index.html +116 -0
- package/coverage/src/bak/translator.js.html +631 -0
- package/coverage/src/breakpoint/generator/AfterStartNode.ts.html +175 -0
- package/coverage/src/breakpoint/generator/BeforeEndNode.ts.html +169 -0
- package/coverage/src/breakpoint/generator/BreakpointNode.ts.html +1246 -0
- package/coverage/src/breakpoint/generator/CallbackNode.ts.html +145 -0
- package/coverage/src/breakpoint/generator/index.html +176 -0
- package/coverage/src/breakpoint/generator/index.ts.html +508 -0
- package/coverage/src/breakpoint/index.html +116 -0
- package/coverage/src/breakpoint/index.ts.html +94 -0
- package/coverage/src/breakpoint/shared/constants.ts.html +436 -0
- package/coverage/src/breakpoint/shared/index.html +176 -0
- package/coverage/src/breakpoint/shared/index.ts.html +94 -0
- package/coverage/src/breakpoint/shared/operations.ts.html +160 -0
- package/coverage/src/breakpoint/shared/socket.ts.html +1297 -0
- package/coverage/src/breakpoint/shared/utils.ts.html +1087 -0
- package/coverage/src/breakpoint/store/core.ts.html +1600 -0
- package/coverage/src/breakpoint/store/dock.ts.html +733 -0
- package/coverage/src/breakpoint/store/index.html +146 -0
- package/coverage/src/breakpoint/store/index.ts.html +91 -0
- package/coverage/src/common/BaseNode.ts.html +4081 -0
- package/coverage/src/common/Command.ts.html +310 -0
- package/coverage/src/common/EventEmitter.ts.html +373 -0
- package/coverage/src/common/Messager.ts.html +820 -0
- package/coverage/src/common/asyncFuncMap.ts.html +127 -0
- package/coverage/src/common/index.html +191 -0
- package/coverage/src/common/index.ts.html +94 -0
- package/coverage/src/concepts/Abort__.ts.html +331 -0
- package/coverage/src/concepts/Anchor__.ts.html +667 -0
- package/coverage/src/concepts/AnonymousFunction__.ts.html +2092 -0
- package/coverage/src/concepts/App__.ts.html +13651 -0
- package/coverage/src/concepts/Argument__.ts.html +907 -0
- package/coverage/src/concepts/Assignee__.ts.html +2317 -0
- package/coverage/src/concepts/AssignmentLine__.ts.html +430 -0
- package/coverage/src/concepts/Assignment__.ts.html +1174 -0
- package/coverage/src/concepts/Attribute__.ts.html +919 -0
- package/coverage/src/concepts/AuthInterface__.ts.html +370 -0
- package/coverage/src/concepts/AuthLogicForCallInterface__.ts.html +2011 -0
- package/coverage/src/concepts/AuthLogic__.ts.html +793 -0
- package/coverage/src/concepts/BackendVariable__.ts.html +1690 -0
- package/coverage/src/concepts/Backend__.ts.html +1192 -0
- package/coverage/src/concepts/BatchAssignment__.ts.html +3376 -0
- package/coverage/src/concepts/BinaryExpression__.ts.html +1468 -0
- package/coverage/src/concepts/BindAttribute__.ts.html +3931 -0
- package/coverage/src/concepts/BindDirective__.ts.html +2002 -0
- package/coverage/src/concepts/BindEvent__.ts.html +3487 -0
- package/coverage/src/concepts/BindStyle__.ts.html +1645 -0
- package/coverage/src/concepts/BooleanLiteral__.ts.html +421 -0
- package/coverage/src/concepts/CallAuthInterface__.ts.html +1642 -0
- package/coverage/src/concepts/CallConnector__.ts.html +925 -0
- package/coverage/src/concepts/CallFunction__.ts.html +2164 -0
- package/coverage/src/concepts/CallInterface__.ts.html +2776 -0
- package/coverage/src/concepts/CallLogic__.ts.html +4693 -0
- package/coverage/src/concepts/CallQueryComponent__.ts.html +5419 -0
- package/coverage/src/concepts/Comment__.ts.html +397 -0
- package/coverage/src/concepts/CompletionProperty__.ts.html +946 -0
- package/coverage/src/concepts/ConfigGroup__.ts.html +1132 -0
- package/coverage/src/concepts/ConfigPropertyValue__.ts.html +427 -0
- package/coverage/src/concepts/ConfigProperty__.ts.html +1375 -0
- package/coverage/src/concepts/Configuration__.ts.html +1054 -0
- package/coverage/src/concepts/Connection__.ts.html +1387 -0
- package/coverage/src/concepts/ConnectorTrigger__.ts.html +598 -0
- package/coverage/src/concepts/Connector__.ts.html +4390 -0
- package/coverage/src/concepts/Constant__.ts.html +1123 -0
- package/coverage/src/concepts/DataSource__.ts.html +1798 -0
- package/coverage/src/concepts/DatabaseTypeAnnotation__.ts.html +334 -0
- package/coverage/src/concepts/DefaultValue__.ts.html +946 -0
- package/coverage/src/concepts/Destination__.ts.html +2761 -0
- package/coverage/src/concepts/End__.ts.html +436 -0
- package/coverage/src/concepts/EntityIndex__.ts.html +799 -0
- package/coverage/src/concepts/EntityProperty__.ts.html +2866 -0
- package/coverage/src/concepts/Entity__.ts.html +3070 -0
- package/coverage/src/concepts/EnumItem__.ts.html +553 -0
- package/coverage/src/concepts/Enum__.ts.html +1258 -0
- package/coverage/src/concepts/Event__.ts.html +1111 -0
- package/coverage/src/concepts/ExternalDestination__.ts.html +1060 -0
- package/coverage/src/concepts/ForEachStatement__.ts.html +2023 -0
- package/coverage/src/concepts/FrontendLibrary__.ts.html +1762 -0
- package/coverage/src/concepts/FrontendVariable__.ts.html +292 -0
- package/coverage/src/concepts/Frontend__.ts.html +4078 -0
- package/coverage/src/concepts/Function__.ts.html +3718 -0
- package/coverage/src/concepts/Identifier__.ts.html +1060 -0
- package/coverage/src/concepts/IfStatement__.ts.html +1636 -0
- package/coverage/src/concepts/Integration__.ts.html +1273 -0
- package/coverage/src/concepts/InterfaceParam__.ts.html +1258 -0
- package/coverage/src/concepts/Interface__.ts.html +3463 -0
- package/coverage/src/concepts/JSBlock__.ts.html +424 -0
- package/coverage/src/concepts/JavaLogic__.ts.html +463 -0
- package/coverage/src/concepts/LogicItem__.ts.html +1174 -0
- package/coverage/src/concepts/Logic__.ts.html +7732 -0
- package/coverage/src/concepts/MatchCase__.ts.html +2974 -0
- package/coverage/src/concepts/Match__.ts.html +2494 -0
- package/coverage/src/concepts/MemberExpression__.ts.html +1744 -0
- package/coverage/src/concepts/MicroApp__.ts.html +439 -0
- package/coverage/src/concepts/Module__.ts.html +9385 -0
- package/coverage/src/concepts/MsgTriggerEvent__.ts.html +1072 -0
- package/coverage/src/concepts/MsgTriggerLauncher__.ts.html +1045 -0
- package/coverage/src/concepts/Namespace__.ts.html +8221 -0
- package/coverage/src/concepts/NewComposite__.ts.html +4765 -0
- package/coverage/src/concepts/NewList__.ts.html +1702 -0
- package/coverage/src/concepts/NewMap__.ts.html +2470 -0
- package/coverage/src/concepts/New__.ts.html +289 -0
- package/coverage/src/concepts/NullLiteral__.ts.html +352 -0
- package/coverage/src/concepts/NumericLiteral__.ts.html +697 -0
- package/coverage/src/concepts/OqlQueryComponent__.ts.html +1237 -0
- package/coverage/src/concepts/OverriddenLogic__.ts.html +6970 -0
- package/coverage/src/concepts/Param__.ts.html +1798 -0
- package/coverage/src/concepts/Point__.ts.html +334 -0
- package/coverage/src/concepts/ProcessComponent__.ts.html +1717 -0
- package/coverage/src/concepts/ProcessElement__.ts.html +6187 -0
- package/coverage/src/concepts/ProcessOutcome__.ts.html +355 -0
- package/coverage/src/concepts/ProcessOutcomes__.ts.html +355 -0
- package/coverage/src/concepts/Process__.ts.html +5071 -0
- package/coverage/src/concepts/QueryAggregateExpression__.ts.html +589 -0
- package/coverage/src/concepts/QueryFieldExpression__.ts.html +586 -0
- package/coverage/src/concepts/QueryFromExpression__.ts.html +937 -0
- package/coverage/src/concepts/QueryGroupByExpression__.ts.html +580 -0
- package/coverage/src/concepts/QueryJoinExpression__.ts.html +1606 -0
- package/coverage/src/concepts/QueryLimitExpression__.ts.html +664 -0
- package/coverage/src/concepts/QueryOrderByExpression__.ts.html +706 -0
- package/coverage/src/concepts/QuerySelectExpression__.ts.html +1741 -0
- package/coverage/src/concepts/Rect__.ts.html +376 -0
- package/coverage/src/concepts/Return__.ts.html +1471 -0
- package/coverage/src/concepts/Role__.ts.html +604 -0
- package/coverage/src/concepts/SelectMembers__.ts.html +1279 -0
- package/coverage/src/concepts/Slot__.ts.html +649 -0
- package/coverage/src/concepts/SqlQueryComponent__.ts.html +1003 -0
- package/coverage/src/concepts/Start__.ts.html +307 -0
- package/coverage/src/concepts/StringInterpolation__.ts.html +1156 -0
- package/coverage/src/concepts/StringLiteral__.ts.html +508 -0
- package/coverage/src/concepts/StructureProperty__.ts.html +1300 -0
- package/coverage/src/concepts/Structure__.ts.html +2182 -0
- package/coverage/src/concepts/SwitchCase__.ts.html +1204 -0
- package/coverage/src/concepts/SwitchStatement__.ts.html +904 -0
- package/coverage/src/concepts/Theme__.ts.html +361 -0
- package/coverage/src/concepts/Transactional__.ts.html +631 -0
- package/coverage/src/concepts/TriggerEvent__.ts.html +1039 -0
- package/coverage/src/concepts/TriggerLauncher__.ts.html +778 -0
- package/coverage/src/concepts/TypeAnnotation__.ts.html +3832 -0
- package/coverage/src/concepts/TypeParam__.ts.html +322 -0
- package/coverage/src/concepts/UnaryExpression__.ts.html +730 -0
- package/coverage/src/concepts/Unparsed__.ts.html +397 -0
- package/coverage/src/concepts/UseComponent__.ts.html +334 -0
- package/coverage/src/concepts/ValidationRule__.ts.html +1876 -0
- package/coverage/src/concepts/Variable__.ts.html +1705 -0
- package/coverage/src/concepts/ViewBlock__.ts.html +355 -0
- package/coverage/src/concepts/ViewComponent__.ts.html +4327 -0
- package/coverage/src/concepts/ViewElement__.ts.html +8992 -0
- package/coverage/src/concepts/View__.ts.html +9019 -0
- package/coverage/src/concepts/WhileStatement__.ts.html +1105 -0
- package/coverage/src/concepts/basics/stdlib/index.html +356 -0
- package/coverage/src/concepts/basics/stdlib/index.ts.html +208 -0
- package/coverage/src/concepts/basics/stdlib/nasl.auth.ts.html +565 -0
- package/coverage/src/concepts/basics/stdlib/nasl.browser.ts.html +517 -0
- package/coverage/src/concepts/basics/stdlib/nasl.collection.ts.html +226 -0
- package/coverage/src/concepts/basics/stdlib/nasl.configuration.ts.html +172 -0
- package/coverage/src/concepts/basics/stdlib/nasl.core.ts.html +214 -0
- package/coverage/src/concepts/basics/stdlib/nasl.event.ts.html +145 -0
- package/coverage/src/concepts/basics/stdlib/nasl.http.ts.html +589 -0
- package/coverage/src/concepts/basics/stdlib/nasl.interface.ts.html +214 -0
- package/coverage/src/concepts/basics/stdlib/nasl.io.ts.html +229 -0
- package/coverage/src/concepts/basics/stdlib/nasl.logging.ts.html +268 -0
- package/coverage/src/concepts/basics/stdlib/nasl.process.ts.html +1999 -0
- package/coverage/src/concepts/basics/stdlib/nasl.ui.ts.html +3259 -0
- package/coverage/src/concepts/basics/stdlib/nasl.util.ts.html +6955 -0
- package/coverage/src/concepts/basics/stdlib/nasl.validation.ts.html +1768 -0
- package/coverage/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts.html +163 -0
- package/coverage/src/concepts/basics/stdlib/timeZone.ts.html +664 -0
- package/coverage/src/concepts/basics/types/coreTypeList.ts.html +121 -0
- package/coverage/src/concepts/basics/types/index.html +131 -0
- package/coverage/src/concepts/basics/types/index.ts.html +160 -0
- package/coverage/src/concepts/index.html +1976 -0
- package/coverage/src/concepts/index.ts.html +103 -0
- package/coverage/src/concepts/index__.ts.html +454 -0
- package/coverage/src/config.ts.html +325 -0
- package/coverage/src/decorators/index.html +131 -0
- package/coverage/src/decorators/index.ts.html +583 -0
- package/coverage/src/decorators/promise.ts.html +169 -0
- package/coverage/src/eventBus.ts.html +100 -0
- package/coverage/src/generator/compileComponent.ts.html +142 -0
- package/coverage/src/generator/genBundleFiles.ts.html +1828 -0
- package/coverage/src/generator/genHash.ts.html +124 -0
- package/coverage/src/generator/genMetaData.ts.html +1084 -0
- package/coverage/src/generator/genReleaseBody.ts.html +1282 -0
- package/coverage/src/generator/icestark.ts.html +220 -0
- package/coverage/src/generator/index.html +266 -0
- package/coverage/src/generator/index.ts.html +106 -0
- package/coverage/src/generator/microApp.ts.html +172 -0
- package/coverage/src/generator/permission.ts.html +1036 -0
- package/coverage/src/generator/qiankun.ts.html +232 -0
- package/coverage/src/generator/styleReplacer.ts.html +199 -0
- package/coverage/src/index.html +146 -0
- package/coverage/src/index.ts.html +124 -0
- package/coverage/src/manager/diagnostic.ts.html +442 -0
- package/coverage/src/manager/index.html +131 -0
- package/coverage/src/manager/stepRecorder.ts.html +457 -0
- package/coverage/src/natural/genNaturalTS.ts.html +355 -0
- package/coverage/src/natural/index.html +161 -0
- package/coverage/src/natural/index.ts.html +91 -0
- package/coverage/src/natural/naslStdlibMap.ts.html +157 -0
- package/coverage/src/natural/transformTSCode.ts.html +2707 -0
- package/coverage/src/sentry/index.html +116 -0
- package/coverage/src/sentry/index.ts.html +676 -0
- package/coverage/src/server/createUiTs.ts.html +919 -0
- package/coverage/src/server/entity2LogicNamespace.ts.html +1294 -0
- package/coverage/src/server/event.js.html +526 -0
- package/coverage/src/server/extendBaseNode.ts.html +1762 -0
- package/coverage/src/server/formatTsUtils.ts.html +2689 -0
- package/coverage/src/server/getConnector.ts.html +316 -0
- package/coverage/src/server/getExtensionModules.ts.html +178 -0
- package/coverage/src/server/getFunctions.ts.html +133 -0
- package/coverage/src/server/getInterfaces.ts.html +229 -0
- package/coverage/src/server/getLogging.ts.html +100 -0
- package/coverage/src/server/getLogics.ts.html +1363 -0
- package/coverage/src/server/getMemberIdentifier.ts.html +1606 -0
- package/coverage/src/server/getProcessComponents.ts.html +112 -0
- package/coverage/src/server/getProcesses.ts.html +2023 -0
- package/coverage/src/server/getValidates.ts.html +115 -0
- package/coverage/src/server/index.html +401 -0
- package/coverage/src/server/index.ts.html +229 -0
- package/coverage/src/server/naslServer.ts.html +14356 -0
- package/coverage/src/server/naslStdlibMap.ts.html +241 -0
- package/coverage/src/server/process2LogicNamespace.ts.html +454 -0
- package/coverage/src/server/translator.ts.html +2566 -0
- package/coverage/src/service/creator/add.configs.js.html +397 -0
- package/coverage/src/service/creator/errHandles.js.html +304 -0
- package/coverage/src/service/creator/index.html +146 -0
- package/coverage/src/service/creator/index.js.html +352 -0
- package/coverage/src/service/datasource/api.js.html +118 -0
- package/coverage/src/service/datasource/index.html +131 -0
- package/coverage/src/service/datasource/index.js.html +103 -0
- package/coverage/src/service/logic/api.js.html +109 -0
- package/coverage/src/service/logic/index.html +131 -0
- package/coverage/src/service/logic/index.js.html +103 -0
- package/coverage/src/service/storage/api.js.html +202 -0
- package/coverage/src/service/storage/index.html +206 -0
- package/coverage/src/service/storage/index.ts.html +103 -0
- package/coverage/src/service/storage/init.ts.html +3721 -0
- package/coverage/src/service/storage/jsoner.ts.html +502 -0
- package/coverage/src/service/storage/map.ts.html +256 -0
- package/coverage/src/service/storage/service.ts.html +331 -0
- package/coverage/src/service/storage/storagePoint.ts.html +304 -0
- package/coverage/src/templator/genCallComponentLogic.ts.html +163 -0
- package/coverage/src/templator/genCreateBlock.ts.html +1093 -0
- package/coverage/src/templator/genCurdEditMultipleKeyBlock.ts.html +1609 -0
- package/coverage/src/templator/genCurdMultipleKeyBlock.ts.html +2254 -0
- package/coverage/src/templator/genEditTableBlock.ts.html +1021 -0
- package/coverage/src/templator/genEnumSelectBlock.ts.html +178 -0
- package/coverage/src/templator/genGetBlock.ts.html +451 -0
- package/coverage/src/templator/genGridViewBlock.ts.html +1114 -0
- package/coverage/src/templator/genListViewBlock.ts.html +475 -0
- package/coverage/src/templator/genQueryComponent.ts.html +1207 -0
- package/coverage/src/templator/genSelectBlock.ts.html +1243 -0
- package/coverage/src/templator/genTableBlock.ts.html +973 -0
- package/coverage/src/templator/genUpdateBlock.ts.html +1192 -0
- package/coverage/src/templator/index.html +326 -0
- package/coverage/src/templator/index.ts.html +154 -0
- package/coverage/src/templator/utils.ts.html +1861 -0
- package/coverage/src/translator/constant.ts.html +106 -0
- package/coverage/src/translator/index.html +146 -0
- package/coverage/src/translator/index.ts.html +94 -0
- package/coverage/src/translator/utils.ts.html +436 -0
- package/coverage/src/utils/cookie.ts.html +265 -0
- package/coverage/src/utils/env.ts.html +91 -0
- package/coverage/src/utils/index.html +236 -0
- package/coverage/src/utils/index.ts.html +694 -0
- package/coverage/src/utils/logger.ts.html +145 -0
- package/coverage/src/utils/sortTsString.ts.html +187 -0
- package/coverage/src/utils/string.ts.html +400 -0
- package/coverage/src/utils/time-slicing.ts.html +418 -0
- package/coverage/src/utils/traverse.ts.html +568 -0
- package/coverage/src/utils/window.ts.html +112 -0
- package/out/bak/translator.js +18 -99
- package/out/bak/translator.js.map +1 -1
- package/out/common/Command.js +1 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/Argument__.js +2 -7
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignment__.js +3 -20
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +2 -24
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +13 -40
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +0 -6
- package/out/concepts/BindAttribute__.js +11 -105
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/CallLogic__.js +21 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Identifier__.js +0 -3
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/JSBlock__.js +0 -56
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Match__.js +1 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -2
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/Param__.js +2 -24
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Return__.js +2 -24
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -24
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +0 -1
- package/out/concepts/ViewElement__.js +4 -75
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +0 -2
- package/out/concepts/View__.js +3 -12
- package/out/concepts/View__.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -9
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +9 -15
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +5 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -3
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +9 -12
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.core.ts +0 -2
- package/sandbox/stdlib/nasl.util.ts +1 -1
- package/src/bak/translator.js +20 -99
- package/src/common/Command.ts +1 -1
- package/src/concepts/Argument__.ts +2 -7
- package/src/concepts/Assignment__.ts +13 -31
- package/src/concepts/BackendVariable__.ts +3 -22
- package/src/concepts/BinaryExpression__.ts +13 -39
- package/src/concepts/BindAttribute__.ts +11 -108
- package/src/concepts/CallLogic__.ts +12 -0
- package/src/concepts/Identifier__.ts +1 -4
- package/src/concepts/JSBlock__.ts +0 -58
- package/src/concepts/Match__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -2
- package/src/concepts/Param__.ts +2 -24
- package/src/concepts/Return__.ts +3 -23
- package/src/concepts/Variable__.ts +3 -23
- package/src/concepts/ViewElement__.ts +8 -83
- package/src/concepts/View__.ts +18 -32
- package/src/templator/genCreateBlock.ts +5 -9
- package/src/templator/genCurdEditMultipleKeyBlock.ts +10 -16
- package/src/templator/genCurdMultipleKeyBlock.ts +8 -11
- package/src/templator/genEditTableBlock.ts +2 -4
- package/src/templator/genUpdateBlock.ts +12 -15
- package/src/templator/utils.ts +7 -8
- package/test/concepts/anonymous-function/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/assignment/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/batch-assignment/__snapshots__/toJS.spec.ts.snap +2 -2
- package/test/concepts/binary-expression/__snapshots__/toJS.spec.ts.snap +2 -3
- package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +2 -2
- package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +3 -3
- package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/numeric-literal/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +3 -3
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -2
package/src/bak/translator.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PAGE_COMPONENT_INCLUDE_TAG_MAP } from '..'
|
|
2
2
|
import { attrConvertCamelCase } from '../utils/index'
|
|
3
|
+
|
|
3
4
|
function safeCodeAsKey(name) {
|
|
4
5
|
return `['${name}']`;
|
|
5
6
|
}
|
|
@@ -57,20 +58,9 @@ export default function (definition, view) {
|
|
|
57
58
|
|
|
58
59
|
const { defaultValue } = viewVariable;
|
|
59
60
|
const defaultValueType = Object.prototype.toString.call(defaultValue);
|
|
61
|
+
// const { typeKind, typeNamespace, typeName } = typeAnnotation || {};
|
|
60
62
|
// 设置成null,才能同步给后端清除该值,但是null对checkbox组件是一种特殊状态
|
|
61
63
|
let parsedValue = defaultValue ?? undefined;
|
|
62
|
-
const isDecimal = typeKind === 'primitive' && ['Decimal', "Double"].includes(typeName)
|
|
63
|
-
const isInteger = typeKind === 'primitive' && ['Long', "Integer"].includes(typeName)
|
|
64
|
-
function parseNumberValue(defaultValue, typeAnnotation) {
|
|
65
|
-
const { typeKind, typeName } = typeAnnotation;
|
|
66
|
-
const isNaslNumber = typeKind === 'primitive' && ['Decimal', 'Long', 'Double', 'Int'].includes(typeName);
|
|
67
|
-
if (isNaslNumber) {
|
|
68
|
-
return String(defaultValue);
|
|
69
|
-
} else {
|
|
70
|
-
return tryJSONParse(defaultValue) ?? defaultValue;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
64
|
if (
|
|
75
65
|
defaultValueType === '[object String]' &&
|
|
76
66
|
!(typeKind === 'primitive' && typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) &&
|
|
@@ -82,20 +72,10 @@ export default function (definition, view) {
|
|
|
82
72
|
if ([''].includes(defaultValue)) {
|
|
83
73
|
parsedValue = undefined;
|
|
84
74
|
} else {
|
|
85
|
-
parsedValue =
|
|
75
|
+
parsedValue = tryJSONParse(defaultValue) ?? defaultValue;
|
|
86
76
|
}
|
|
87
77
|
}
|
|
88
|
-
|
|
89
|
-
const isNil = val => val === undefined || val === null;
|
|
90
|
-
if (isDecimal) {
|
|
91
|
-
parsedValue = isNil(parsedValue) ? parsedValue : `new NaslDecimal('${parsedValue}')`
|
|
92
|
-
code += `${parsedValue} `;
|
|
93
|
-
} else if (isInteger) {
|
|
94
|
-
parsedValue = isNil(parsedValue) ? parsedValue : `new NaslLong('${parsedValue}')`
|
|
95
|
-
code += `${parsedValue} `;
|
|
96
|
-
} else {
|
|
97
|
-
code += `${JSON.stringify(parsedValue)} `;
|
|
98
|
-
}
|
|
78
|
+
code += `${JSON.stringify(parsedValue)}`;
|
|
99
79
|
if (needGenInitFromSchema) {
|
|
100
80
|
code += `)`;
|
|
101
81
|
}
|
|
@@ -107,41 +87,20 @@ export default function (definition, view) {
|
|
|
107
87
|
*/
|
|
108
88
|
const viewComputedData = []
|
|
109
89
|
const viewMethodData = []
|
|
110
|
-
definition.elementsAll.forEach(
|
|
111
|
-
|
|
90
|
+
definition.elementsAll.forEach(el => {
|
|
91
|
+
el.bindAttrs.forEach(attr => {
|
|
112
92
|
let variable = '';
|
|
113
93
|
if (attr.expression) {
|
|
114
94
|
variable += `${attr.expression?.toJS()}`
|
|
115
95
|
} else if (attr.type === 'static') {
|
|
116
96
|
variable = `${attr.value}`
|
|
117
97
|
}
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
)
|
|
124
|
-
) {
|
|
125
|
-
let codeLoad = `async '__${element.name}_dataSourceLoad'(params) {`;
|
|
126
|
-
if (attr.expression?.concept === 'CallLogic') {
|
|
127
|
-
if (attr.expression.calleeNamespace) {
|
|
128
|
-
codeLoad += `this['__${element.name}_params'] = {...params};`;
|
|
129
|
-
} else {
|
|
130
|
-
variable = `await this.${attr?.expression?.calleeName}(params)`;
|
|
131
|
-
}
|
|
132
|
-
} else {
|
|
133
|
-
variable = `await this.${attr?.expression?.name}(params)`;
|
|
134
|
-
}
|
|
135
|
-
if (attr.parentNode.tag !== 'u-table-view') {
|
|
136
|
-
codeLoad += `return this.$utils['RmWrapClass'](${variable});
|
|
137
|
-
}`;
|
|
138
|
-
} else {
|
|
139
|
-
codeLoad += `return ${variable};
|
|
140
|
-
}`;
|
|
141
|
-
}
|
|
142
|
-
// codeLoad += `return this.$utils['RmWrapClass'](${variable});
|
|
143
|
-
// }`;
|
|
144
|
-
viewMethodData.push(codeLoad);
|
|
98
|
+
if (attr.expression?.concept === 'CallLogic' && attr.name === 'data-source') {
|
|
99
|
+
const codeLoad = `async '__${el.name}_dataSourceLoad'(params) {
|
|
100
|
+
this['__${el.name}_params'] = {...params};
|
|
101
|
+
return ${variable}
|
|
102
|
+
}`
|
|
103
|
+
viewMethodData.push(codeLoad)
|
|
145
104
|
}
|
|
146
105
|
})
|
|
147
106
|
})
|
|
@@ -155,9 +114,14 @@ export default function (definition, view) {
|
|
|
155
114
|
variable = `${attr.value}`
|
|
156
115
|
// attrsData.push(code)
|
|
157
116
|
}
|
|
158
|
-
if (attr.expression?.concept === 'CallLogic' && attr.name === 'data-source'
|
|
117
|
+
if (attr.expression?.concept === 'CallLogic' && attr.name === 'data-source') {
|
|
118
|
+
const codeLoad = `async '__${element.name}_dataSourceLoad'(params) {
|
|
119
|
+
this['__${element.name}_params'] = {...params};
|
|
120
|
+
return ${variable}
|
|
121
|
+
}`
|
|
122
|
+
viewMethodData.push(codeLoad)
|
|
159
123
|
const code = `async '__${element.name}_dataSource'(params) {
|
|
160
|
-
return
|
|
124
|
+
return ${variable}
|
|
161
125
|
}`
|
|
162
126
|
viewMethodData.push(code)
|
|
163
127
|
} else {
|
|
@@ -222,40 +186,6 @@ export default function (definition, view) {
|
|
|
222
186
|
tabSize: 1,
|
|
223
187
|
})
|
|
224
188
|
);
|
|
225
|
-
const syncAtrrWatchMap = {};
|
|
226
|
-
const syncAttrLogics = [];
|
|
227
|
-
// 双向绑定的属性对应的修改逻辑
|
|
228
|
-
(definition.viewBindSyncAttrs || []).forEach((bindSyncAttr) => {
|
|
229
|
-
const syncVariableName = bindSyncAttr?.syncVariableName;
|
|
230
|
-
const expressionName = bindSyncAttr?.expression?.toVue();
|
|
231
|
-
if (expressionName && syncVariableName) {
|
|
232
|
-
viewVariablesData.push(`['${syncVariableName}']: undefined`);
|
|
233
|
-
if (!syncAtrrWatchMap[expressionName]) {
|
|
234
|
-
syncAtrrWatchMap[expressionName] = [];
|
|
235
|
-
}
|
|
236
|
-
syncAtrrWatchMap[expressionName].push(bindSyncAttr);
|
|
237
|
-
}
|
|
238
|
-
syncAttrLogics.push(bindSyncAttr.toJS({
|
|
239
|
-
tabSize: 1,
|
|
240
|
-
}));
|
|
241
|
-
});
|
|
242
|
-
const syncAtrrWatchs = [];
|
|
243
|
-
for (let expressionName in syncAtrrWatchMap) {
|
|
244
|
-
const viewBindSyncAttrs = syncAtrrWatchMap[expressionName];
|
|
245
|
-
let code = `['${expressionName}']: {
|
|
246
|
-
handler(val, oldVal) {\n`;
|
|
247
|
-
if (Array.isArray(viewBindSyncAttrs)) {
|
|
248
|
-
viewBindSyncAttrs.forEach((bindSyncAttr) => {
|
|
249
|
-
const syncVariableName = bindSyncAttr?.syncVariableName;
|
|
250
|
-
code += `this.${syncVariableName} = this.$utils['RmWrapClass'](val, this.${syncVariableName}, val === oldVal);\n`;
|
|
251
|
-
});
|
|
252
|
-
code += `},
|
|
253
|
-
immediate: true,
|
|
254
|
-
deep: true,
|
|
255
|
-
}`;
|
|
256
|
-
}
|
|
257
|
-
syncAtrrWatchs.push(code);
|
|
258
|
-
}
|
|
259
189
|
|
|
260
190
|
const output = `
|
|
261
191
|
data() {
|
|
@@ -263,9 +193,6 @@ export default function (definition, view) {
|
|
|
263
193
|
${viewVariablesData.join(',\n').trim()}
|
|
264
194
|
};
|
|
265
195
|
},
|
|
266
|
-
watch: {
|
|
267
|
-
${syncAtrrWatchs.join(',\n').trim()}
|
|
268
|
-
},
|
|
269
196
|
computed: {
|
|
270
197
|
${viewComputedData.join(',\n').trim()}
|
|
271
198
|
},
|
|
@@ -276,13 +203,7 @@ meta: {
|
|
|
276
203
|
auth: ${JSON.stringify(definition.auth)},
|
|
277
204
|
},
|
|
278
205
|
methods: {
|
|
279
|
-
${[
|
|
280
|
-
...(methods || []),
|
|
281
|
-
...(eventLogic || []),
|
|
282
|
-
...(syncAttrLogics || []),
|
|
283
|
-
...(viewExpressionMethods || []),
|
|
284
|
-
...(viewMethodData || [])
|
|
285
|
-
].join(',\n\n')}
|
|
206
|
+
${[...(methods || []), ...(eventLogic || []), ...(viewExpressionMethods || []), ...(viewMethodData || [])].join(',\n\n')}
|
|
286
207
|
},
|
|
287
208
|
${events.join(',\n\n')}
|
|
288
209
|
`;
|
package/src/common/Command.ts
CHANGED
|
@@ -67,7 +67,7 @@ export function invokeOnlyCommand(command: string, ...args: any[]) {
|
|
|
67
67
|
if (process.env.NODE === 'development') {
|
|
68
68
|
console.log('invokeOnlyCommand', command);
|
|
69
69
|
}
|
|
70
|
-
return cmds[0]?.execute(...args);
|
|
70
|
+
return cmds?.[0]?.execute(...args);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export function hasCommand(command: string) {
|
|
@@ -215,12 +215,7 @@ export class Argument extends LogicItem {
|
|
|
215
215
|
toJS(state?: TranslatorState): string {
|
|
216
216
|
let code = this.spread ? '...' : '';
|
|
217
217
|
if (this.expression) {
|
|
218
|
-
|
|
219
|
-
let { typeName, typeNamespace } = (this.expression as any)?.__nodeType || {};
|
|
220
|
-
if (['Long', 'Decimal'].includes(typeName) && typeNamespace === 'nasl.core') {
|
|
221
|
-
resultCode = `(${resultCode} === undefined || ${resultCode} === null || this.$global.isEqual(${resultCode}, undefined)) ? ${resultCode} :String(${resultCode})`;
|
|
222
|
-
}
|
|
223
|
-
code += resultCode;
|
|
218
|
+
code += this.expression.toJS(shiftState(state, code));
|
|
224
219
|
} else if (this.paramTypeAnnotation && this.paramDefaultValue) {
|
|
225
220
|
if (this.paramTypeAnnotation.typeName === 'Boolean') code += this.paramDefaultValue === 'true' ? 'true' : 'false';
|
|
226
221
|
else if (
|
|
@@ -229,7 +224,7 @@ export class Argument extends LogicItem {
|
|
|
229
224
|
this.paramTypeAnnotation.typeName === 'Long' ||
|
|
230
225
|
this.paramTypeAnnotation.typeName === 'Decimal'
|
|
231
226
|
)
|
|
232
|
-
code += `
|
|
227
|
+
code += `Number(${this.paramDefaultValue})`;
|
|
233
228
|
else code += `'${this.paramDefaultValue}'`;
|
|
234
229
|
} else {
|
|
235
230
|
code += 'undefined';
|
|
@@ -244,15 +244,15 @@ export class Assignment extends LogicItem {
|
|
|
244
244
|
});
|
|
245
245
|
const batchObject = this.right
|
|
246
246
|
? {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
left: leftSelect,
|
|
248
|
+
rights: [rightSelect],
|
|
249
|
+
assignmentLines: [assignmentLine],
|
|
250
|
+
}
|
|
251
251
|
: {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
left: leftSelect,
|
|
253
|
+
rights: [],
|
|
254
|
+
assignmentLines: [],
|
|
255
|
+
};
|
|
256
256
|
const batchAssignment = new BatchAssignment({
|
|
257
257
|
...batchObject,
|
|
258
258
|
offsetX: this.offsetX,
|
|
@@ -304,29 +304,11 @@ export class Assignment extends LogicItem {
|
|
|
304
304
|
code += this.left ? this.left.toJS(shiftState(state, code, { inline: true })) : '';
|
|
305
305
|
if (this.right) {
|
|
306
306
|
code += ' = ';
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (typeNamespace === 'nasl.core' && typeKind === 'primitive' && ['Long', 'Decimal'].includes(typeName)) {
|
|
313
|
-
isNaslNumber = true;
|
|
314
|
-
consName = `Nasl${typeName}`;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (isNaslNumber) {
|
|
318
|
-
code += `new ${consName}(${this.right.toJS(
|
|
319
|
-
shiftState(state, code, {
|
|
320
|
-
inline: true,
|
|
321
|
-
}),
|
|
322
|
-
)})`;
|
|
323
|
-
} else {
|
|
324
|
-
code += this.right.toJS(
|
|
325
|
-
shiftState(state, code, {
|
|
326
|
-
inline: true,
|
|
327
|
-
}),
|
|
328
|
-
);
|
|
329
|
-
}
|
|
307
|
+
code += this.right.toJS(
|
|
308
|
+
shiftState(state, code, {
|
|
309
|
+
inline: true,
|
|
310
|
+
}),
|
|
311
|
+
);
|
|
330
312
|
}
|
|
331
313
|
return code;
|
|
332
314
|
}
|
|
@@ -20,7 +20,7 @@ function tryJSONParse(str: string) {
|
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
22
|
result = JSON.parse(str);
|
|
23
|
-
} catch (e) {}
|
|
23
|
+
} catch (e) { }
|
|
24
24
|
|
|
25
25
|
return result;
|
|
26
26
|
}
|
|
@@ -284,8 +284,6 @@ export class BackendVariable extends BaseNode {
|
|
|
284
284
|
const { defaultValue } = this;
|
|
285
285
|
const defaultValueType = Object.prototype.toString.call(defaultValue);
|
|
286
286
|
const { typeKind, typeNamespace, typeName } = typeAnnotation || {};
|
|
287
|
-
const isDecimal = typeKind === 'primitive' && ['Decimal', 'Double'].includes(typeName);
|
|
288
|
-
const isInteger = typeKind === 'primitive' && ['Long', 'Integer'].includes(typeName);
|
|
289
287
|
// 设置成null,才能同步给后端清除该值,但是null对checkbox组件是一种特殊状态
|
|
290
288
|
let parsedValue = defaultValue ?? undefined;
|
|
291
289
|
if (
|
|
@@ -299,27 +297,10 @@ export class BackendVariable extends BaseNode {
|
|
|
299
297
|
if ([''].includes(defaultValue)) {
|
|
300
298
|
parsedValue = undefined;
|
|
301
299
|
} else {
|
|
302
|
-
|
|
303
|
-
const { typeKind, typeName } = typeAnnotation;
|
|
304
|
-
const isNaslNumber = typeKind === 'primitive' && ['Decimal', 'Long', 'Double', 'Int'].includes(typeName);
|
|
305
|
-
if (isNaslNumber) {
|
|
306
|
-
return String(defaultValue);
|
|
307
|
-
} else {
|
|
308
|
-
return tryJSONParse(defaultValue) ?? defaultValue;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
parsedValue = parseNumberValue(defaultValue, typeAnnotation);
|
|
300
|
+
parsedValue = tryJSONParse(defaultValue) ?? defaultValue;
|
|
312
301
|
}
|
|
313
302
|
}
|
|
314
|
-
|
|
315
|
-
parsedValue = `new NaslDecimal('${defaultValue}')`;
|
|
316
|
-
code += `${parsedValue}`;
|
|
317
|
-
} else if (isInteger) {
|
|
318
|
-
parsedValue = `new NaslLong('${defaultValue}')`;
|
|
319
|
-
code += `${parsedValue}`;
|
|
320
|
-
} else {
|
|
321
|
-
code += `${JSON.stringify(parsedValue)}`;
|
|
322
|
-
}
|
|
303
|
+
code += JSON.stringify(parsedValue);
|
|
323
304
|
if (needGenInitFromSchema) {
|
|
324
305
|
code += `)`;
|
|
325
306
|
}
|
|
@@ -10,24 +10,6 @@ import {
|
|
|
10
10
|
} from '../translator';
|
|
11
11
|
import { ElementToVueOptions } from './ViewElement__';
|
|
12
12
|
|
|
13
|
-
const operatorMap = {
|
|
14
|
-
'&&': 'and',
|
|
15
|
-
'||': 'or',
|
|
16
|
-
'+': 'add',
|
|
17
|
-
'-': 'minus',
|
|
18
|
-
'*': 'multiply',
|
|
19
|
-
'/': 'divide',
|
|
20
|
-
'%': 'remainder',
|
|
21
|
-
// '==': 'equal',
|
|
22
|
-
// '!=': 'notEqual',
|
|
23
|
-
'==': 'isEqual',
|
|
24
|
-
'!=': 'isNotEqual',
|
|
25
|
-
'>': 'greaterThan',
|
|
26
|
-
'<': 'lessThan',
|
|
27
|
-
'>=': 'greaterThanOrEqual',
|
|
28
|
-
'<=': 'lessThanOrEqual',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
13
|
//================================================================================
|
|
32
14
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
33
15
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -340,25 +322,22 @@ export class BinaryExpression extends LogicItem {
|
|
|
340
322
|
// code += right;
|
|
341
323
|
// code += ')';
|
|
342
324
|
// return code;
|
|
343
|
-
|
|
325
|
+
|
|
326
|
+
if (['+', '-', '*', '/'].includes(this.operator)) {
|
|
327
|
+
const operatorMap: any = {
|
|
328
|
+
'+': 'add',
|
|
329
|
+
'-': 'minus',
|
|
330
|
+
'*': 'multiply',
|
|
331
|
+
'/': 'divide',
|
|
332
|
+
};
|
|
344
333
|
code += `this.$global.${operatorMap[this.operator as keyof typeof operatorMap]}(`;
|
|
345
334
|
code += left;
|
|
346
335
|
code += `,`;
|
|
347
336
|
code += right;
|
|
348
337
|
code += ')';
|
|
349
338
|
return code;
|
|
350
|
-
};
|
|
351
|
-
if (['+', '-', '*', '/', '%'].includes(this.operator)) {
|
|
352
|
-
// 之前一年都没有 % 取模 操作符的处理 本次补上
|
|
353
|
-
// code += `this.$global.${operatorMap[this.operator as keyof typeof operatorMap]}(`;
|
|
354
|
-
// code += left;
|
|
355
|
-
// code += `,`;
|
|
356
|
-
// code += right;
|
|
357
|
-
// code += ')';
|
|
358
|
-
// return code
|
|
359
|
-
return getOperatorCode(code);
|
|
360
339
|
}
|
|
361
|
-
if (['>', '>=', '<', '<='
|
|
340
|
+
if (['>', '>=', '<', '<='].includes(this.operator)) {
|
|
362
341
|
const leftType = this.left?.getCurrentAnnotatedJSON();
|
|
363
342
|
const rightType = this.right?.getCurrentAnnotatedJSON();
|
|
364
343
|
// 如果两边类型一致可以做一些特殊比较
|
|
@@ -371,20 +350,15 @@ export class BinaryExpression extends LogicItem {
|
|
|
371
350
|
code += `Date.parse(${left})`;
|
|
372
351
|
code += ` ${this.operator} `;
|
|
373
352
|
code += `Date.parse(${right})`;
|
|
374
|
-
} else {
|
|
375
|
-
// code += `(${left})`;
|
|
376
|
-
// code += ` ${this.operator} `;
|
|
377
|
-
// code += `(${right})`;
|
|
378
|
-
code = getOperatorCode(code);
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
if (['==', '!='].includes(this.operator)) {
|
|
382
|
-
code = getOperatorCode(code);
|
|
383
353
|
} else {
|
|
384
354
|
code += `(${left})`;
|
|
385
355
|
code += ` ${this.operator} `;
|
|
386
356
|
code += `(${right})`;
|
|
387
357
|
}
|
|
358
|
+
} else {
|
|
359
|
+
code += `(${left})`;
|
|
360
|
+
code += ` ${this.operator} `;
|
|
361
|
+
code += `(${right})`;
|
|
388
362
|
}
|
|
389
363
|
|
|
390
364
|
return code;
|
|
@@ -952,64 +952,12 @@ export class BindAttribute extends BaseNode {
|
|
|
952
952
|
return code;
|
|
953
953
|
}
|
|
954
954
|
|
|
955
|
-
get shouldExcluded() {
|
|
956
|
-
// 暂时过滤掉插槽内的变量
|
|
957
|
-
const args = this.getArgsList() || [];
|
|
958
|
-
return args.length || (this.name === 'value' && ["u-number-input", 'u-input'].includes((this?.parentNode as any)?.tag));
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
get syncVariableName() {
|
|
962
|
-
if (this.sync) {
|
|
963
|
-
const newName = this.name.replace(/-/g, '');
|
|
964
|
-
// 名称规则:组件的名称 + sync + 属性的名称 + change 用下划线链接
|
|
965
|
-
return `${this.parentNode?.name}_sync_${newName}`;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
// 双向绑定属性的方法名
|
|
970
|
-
get syncMethodName() {
|
|
971
|
-
if (this.sync) {
|
|
972
|
-
const newName = this.name.replace(/-/g, '');
|
|
973
|
-
// 名称规则:组件的名称 + sync + 属性的名称 + change 用下划线链接
|
|
974
|
-
return `${this.parentNode?.name}_sync_${newName}_change`;
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
// 双向绑定属性的事件名
|
|
979
|
-
get syncEventName() {
|
|
980
|
-
if (this.sync) {
|
|
981
|
-
return `update:${this.name}`;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
// 数据源绑定了页面逻辑变量
|
|
986
|
-
get isExpressionViewLogicIdentifier() {
|
|
987
|
-
let flag = false;
|
|
988
|
-
const expTypeAnnotation = (this.expression as any)?.typeAnnotation || this.expression?.__TypeAnnotation;
|
|
989
|
-
const { typeName } = expTypeAnnotation || {};
|
|
990
|
-
if (this.expression?.concept === 'Identifier') {
|
|
991
|
-
const view = this.getAncestor('View') as View;
|
|
992
|
-
const viewLogic = view.logics?.find((logic) => {
|
|
993
|
-
return logic.name === this.expression?.name;
|
|
994
|
-
});
|
|
995
|
-
if (viewLogic && typeName === this.expression.name) {
|
|
996
|
-
flag = true;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
return flag;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
955
|
/**
|
|
1003
956
|
* 转换成 Vue 的模板格式
|
|
1004
957
|
*/
|
|
1005
958
|
toVue(options?: ElementToVueOptions) {
|
|
1006
959
|
let str = '';
|
|
1007
960
|
let { value } = this;
|
|
1008
|
-
if (value === 'undefined') {
|
|
1009
|
-
value = undefined;
|
|
1010
|
-
}
|
|
1011
|
-
// 已经转换了data-source
|
|
1012
|
-
let hasTransDataSource = false;
|
|
1013
961
|
if (this.type === 'dynamic' || (this.name === 'rules' && this.rules)) {
|
|
1014
962
|
// 需要用标识符替换
|
|
1015
963
|
// if (options?.finalCode !== false && this.needReplaceWithIdentifier) {
|
|
@@ -1021,19 +969,6 @@ export class BindAttribute extends BaseNode {
|
|
|
1021
969
|
value = `[${ruleStrs.join(' , ')}]`;
|
|
1022
970
|
} else if (['destination', 'externalDestination'].includes(this.name)) {
|
|
1023
971
|
value = (this as any)?.[this.name]?.toVue(options) || '';
|
|
1024
|
-
} else if ('ArrowFunctionExpression'.includes(this.expression?.concept)) {
|
|
1025
|
-
value = this.value;
|
|
1026
|
-
} else if (this.name === 'data-source') {
|
|
1027
|
-
if (
|
|
1028
|
-
this.isExpressionViewLogicIdentifier
|
|
1029
|
-
|| (this.expression as any)?.concept === 'CallLogic'
|
|
1030
|
-
) {
|
|
1031
|
-
hasTransDataSource = true;
|
|
1032
|
-
const currentElement = this.getAncestor('ViewElement') as ViewElement;
|
|
1033
|
-
value = `__${currentElement?.name}_dataSourceLoad`;
|
|
1034
|
-
} else {
|
|
1035
|
-
value = this.expression?.toVue(options) || '';
|
|
1036
|
-
}
|
|
1037
972
|
} else {
|
|
1038
973
|
value = this.expression?.toVue(options) || '';
|
|
1039
974
|
}
|
|
@@ -1085,35 +1020,16 @@ export class BindAttribute extends BaseNode {
|
|
|
1085
1020
|
name = 'href';
|
|
1086
1021
|
}
|
|
1087
1022
|
// 文本默认要经过toString转换
|
|
1088
|
-
if (options?.finalCode !== false && this.type === 'dynamic') {
|
|
1023
|
+
if (options?.finalCode !== false && name === 'text' && !this.sync && this.type === 'dynamic') {
|
|
1089
1024
|
const expTypeAnnotation = (this.expression as any)?.typeAnnotation || this.expression?.__TypeAnnotation;
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
if (expTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
1099
|
-
const referenceNode =
|
|
1100
|
-
this.app.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName)
|
|
1101
|
-
?.typeAnnotation || {};
|
|
1102
|
-
value = `$utils['ToString']('${referenceNode?.typeNamespace}.${referenceNode.typeName}', ${value})`;
|
|
1103
|
-
} else {
|
|
1104
|
-
value = `$utils['ToString']('${expTypeAnnotation?.sortedTypeKey}', ${value})`;
|
|
1105
|
-
}
|
|
1106
|
-
} else if (
|
|
1107
|
-
// 除去基础类型和枚举,其他均需要去除包装类的包裹
|
|
1108
|
-
!(isPrimitive || isEnums || hasTransDataSource)
|
|
1109
|
-
) {
|
|
1110
|
-
if (this.shouldExcluded) {
|
|
1111
|
-
value = `${value}`;
|
|
1112
|
-
} else if (this.sync) {
|
|
1113
|
-
value = this.syncVariableName;
|
|
1114
|
-
} else {
|
|
1115
|
-
value = `$utils['RmWrapClass'](${value})`;
|
|
1116
|
-
}
|
|
1025
|
+
transfromUnionTypeAnnotation(expTypeAnnotation, this.app);
|
|
1026
|
+
if (expTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
1027
|
+
const referenceNode =
|
|
1028
|
+
this.app.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName)
|
|
1029
|
+
?.typeAnnotation || {};
|
|
1030
|
+
value = `$utils['ToString']('${referenceNode?.typeNamespace}.${referenceNode.typeName}', ${value})`;
|
|
1031
|
+
} else {
|
|
1032
|
+
value = `$utils['ToString']('${expTypeAnnotation?.sortedTypeKey}', ${value})`;
|
|
1117
1033
|
}
|
|
1118
1034
|
}
|
|
1119
1035
|
if (this.type === 'string' && name !== 'rules') {
|
|
@@ -1122,14 +1038,14 @@ export class BindAttribute extends BaseNode {
|
|
|
1122
1038
|
} else {
|
|
1123
1039
|
str += `${name}="${value}"`;
|
|
1124
1040
|
}
|
|
1041
|
+
} else if (this.sync) {
|
|
1042
|
+
str += `:${name}.sync="${value}"`;
|
|
1125
1043
|
} else if (name === 'destination') {
|
|
1126
1044
|
str += `:destination="${value}"`;
|
|
1127
1045
|
} else if (name === 'externalDestination') {
|
|
1128
1046
|
str += `:link="${value}"`;
|
|
1129
1047
|
} else if (name === 'rules') {
|
|
1130
1048
|
str += `:${name}="${value}"`;
|
|
1131
|
-
} else if (this.sync && this.shouldExcluded) {
|
|
1132
|
-
str += `:${name}.sync="${value}"`;
|
|
1133
1049
|
} else {
|
|
1134
1050
|
str += `:${name}="${value}"`;
|
|
1135
1051
|
}
|
|
@@ -1140,19 +1056,6 @@ export class BindAttribute extends BaseNode {
|
|
|
1140
1056
|
return str;
|
|
1141
1057
|
}
|
|
1142
1058
|
|
|
1143
|
-
toJS(state?: TranslatorState): string {
|
|
1144
|
-
// 暂时过滤掉插槽内的变量
|
|
1145
|
-
const args = this.getArgsList() || [];
|
|
1146
|
-
if (!args.length && this.sync && ['Identifier', 'MemberExpression'].includes(this.expression?.concept)) {
|
|
1147
|
-
const argsList =['$event', ...args];
|
|
1148
|
-
const expTypeAnnotation = (this.expression as any)?.typeAnnotation || this.expression?.__TypeAnnotation;
|
|
1149
|
-
const code = `${this.syncMethodName} (${argsList.join(', ')}) {
|
|
1150
|
-
${this.expression.toJS()} = this.$utils['AddWrapClass']('${expTypeAnnotation.sortedTypeKey}', $event, ${this.expression.toJS()});
|
|
1151
|
-
}`;
|
|
1152
|
-
return code;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
1059
|
@withSourceMapGenerator
|
|
1157
1060
|
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
1158
1061
|
const self = this;
|
|
@@ -744,12 +744,24 @@ export class CallLogic extends LogicItem {
|
|
|
744
744
|
}
|
|
745
745
|
const { completeArguments } = this;
|
|
746
746
|
|
|
747
|
+
if (this.concept === 'CallLogic' && this.getAncestor('BindAttribute')?.name === 'data-source') {
|
|
748
|
+
if (this.calleeNamespace) {
|
|
749
|
+
const currentElement = this.getAncestor('ViewElement') as ViewElement;
|
|
750
|
+
code += `__${currentElement.name}_dataSourceLoad`;
|
|
751
|
+
return code;
|
|
752
|
+
} else {
|
|
753
|
+
// 前端逻辑的calleeNamespace一直为空字符串
|
|
754
|
+
code += this.calleeName;
|
|
755
|
+
return code;
|
|
756
|
+
}
|
|
757
|
+
} else {
|
|
747
758
|
code += this.calleeName;
|
|
748
759
|
code += '(';
|
|
749
760
|
completeArguments.forEach((arg, index) => {
|
|
750
761
|
code += arg?.toVue(options);
|
|
751
762
|
if (index !== completeArguments.length - 1) code += ', ';
|
|
752
763
|
});
|
|
764
|
+
}
|
|
753
765
|
code += ')';
|
|
754
766
|
return code;
|
|
755
767
|
}
|
|
@@ -90,9 +90,6 @@ export class Identifier extends LogicItem {
|
|
|
90
90
|
toVue(options?: ElementToVueOptions): string {
|
|
91
91
|
let { name } = this;
|
|
92
92
|
const { namespace } = this;
|
|
93
|
-
if (this?.parentNode?.parentKey === 'bindAttrs' && ["decimalLength", "decimal-length"].includes(this?.parentNode?.name) && name === 'undefined') {
|
|
94
|
-
name = undefined
|
|
95
|
-
}
|
|
96
93
|
if (namespace) {
|
|
97
94
|
if (
|
|
98
95
|
this.namespace.endsWith('nasl.browser') ||
|
|
@@ -212,7 +209,7 @@ export class Identifier extends LogicItem {
|
|
|
212
209
|
*toEmbeddedTS(state = createCompilerState(), options?: any): TranslatorGenerator {
|
|
213
210
|
const self = this;
|
|
214
211
|
// new实体,连线修改实体字段,无法同步到new实体的字段上,因为解构赋值后的property查找不回去,所以改成obj.
|
|
215
|
-
if (options?.isNewcomposite){
|
|
212
|
+
if (options?.isNewcomposite) {
|
|
216
213
|
return `__obj.${this.name}`;
|
|
217
214
|
}
|
|
218
215
|
// 只有data-source可以是函数 ,也可能是属性
|