@lcap/nasl 3.3.0-alpha.1 → 3.3.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/upgrader/2.20.js.map +1 -1
- package/out/bak/translator.js +52 -1
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/shared/utils.js +0 -2
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +9 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/Abort__.js +2 -1
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.js +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +2 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +2 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +1 -1
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.js +1 -1
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +2 -2
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +2 -2
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +2 -0
- package/out/concepts/BindAttribute__.js +79 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -1
- package/out/concepts/BindEvent__.js +44 -37
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +1 -1
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.js +1 -1
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.js +2 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +2 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +69 -12
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Connection__.js +9 -10
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -2
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.js +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +2 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +2 -2
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +2 -2
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +2 -2
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +27 -37
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.js +1 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +2 -2
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +1 -1
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.js +3 -2
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +2 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +2 -2
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -0
- package/out/concepts/MemberExpression__.js +117 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -1
- package/out/concepts/Module__.js +34 -35
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +2 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +2 -2
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -2
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/Return__.js +2 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -2
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +2 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +2 -2
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +2 -2
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -2
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.js +1 -1
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +4 -3
- package/out/concepts/TypeAnnotation__.js +116 -75
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +2 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +14 -14
- package/out/concepts/ValidationRule__.js +28 -24
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +88 -87
- package/out/concepts/ViewElement__.js +268 -204
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +6 -0
- package/out/concepts/View__.js +254 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +2 -2
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.event.js +2 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -1
- package/out/generator/genBundleFiles.js +90 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +1 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.js +3 -3
- package/out/generator/permission.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/natural/genNaturalTS.js +7 -3
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/knowledgeMap.js +12 -12
- package/out/natural/knowledgeMap.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +1 -1
- package/out/natural/transformTSCode.js +115 -141
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +69 -44
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +72 -63
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +20 -23
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +149 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.d.ts +3 -3
- package/out/server/naslServer.js +182 -132
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +43 -33
- package/out/server/translator.js.map +1 -1
- package/out/service/defaultErrorMessage.json +6 -6
- package/out/service/storage/init.js +16 -0
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +12 -8
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +8 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.d.ts +1 -1
- package/out/templator/genEditTableBlock.js +12 -6
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +2 -2
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +2 -2
- package/out/templator/genGridViewBlock.js +20 -7
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +2 -2
- package/out/templator/genListViewBlock.js +13 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +2 -2
- package/out/templator/genSelectBlock.js +8 -6
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +10 -5
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/package.json +3 -1
- package/sandbox/stdlib/nasl.auth.ts +40 -44
- package/sandbox/stdlib/nasl.core.ts +8 -1
- package/sandbox/stdlib/nasl.http.ts +22 -22
- package/sandbox-natural/stdlib/nasl.util.ts +74 -15
- package/src/automate/upgrader/2.20.js +17 -13
- package/src/bak/translator.js +50 -1
- package/src/breakpoint/shared/utils.ts +0 -2
- package/src/common/Command.ts +8 -0
- package/src/concepts/Abort__.ts +2 -2
- package/src/concepts/Anchor__.ts +2 -2
- package/src/concepts/AnonymousFunction__.ts +3 -3
- package/src/concepts/Argument__.ts +2 -2
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/AssignmentLine__.ts +2 -2
- package/src/concepts/Assignment__.ts +3 -3
- package/src/concepts/BackendVariable__.ts +2 -2
- package/src/concepts/Backend__.ts +1 -1
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/BinaryExpression__.ts +3 -3
- package/src/concepts/BindAttribute__.ts +69 -4
- package/src/concepts/BindDirective__.ts +2 -2
- package/src/concepts/BindEvent__.ts +44 -64
- package/src/concepts/BindStyle__.ts +2 -2
- package/src/concepts/BooleanLiteral__.ts +2 -2
- package/src/concepts/CallAuthInterface__.ts +2 -2
- package/src/concepts/CallConnector__.ts +2 -2
- package/src/concepts/CallFunction__.ts +3 -3
- package/src/concepts/CallInterface__.ts +3 -3
- package/src/concepts/CallLogic__.ts +69 -13
- package/src/concepts/CallQueryComponent__.ts +2 -2
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/ConfigProperty__.ts +2 -2
- package/src/concepts/Connection__.ts +15 -21
- package/src/concepts/Constant__.ts +2 -2
- package/src/concepts/DataSource__.ts +1 -1
- package/src/concepts/Destination__.ts +3 -3
- package/src/concepts/End__.ts +2 -2
- package/src/concepts/EntityIndex__.ts +2 -2
- package/src/concepts/EntityProperty__.ts +3 -3
- package/src/concepts/Entity__.ts +2 -2
- package/src/concepts/EnumItem__.ts +3 -3
- package/src/concepts/Enum__.ts +2 -2
- package/src/concepts/ForEachStatement__.ts +35 -46
- package/src/concepts/Frontend__.ts +1 -1
- package/src/concepts/Function__.ts +3 -3
- package/src/concepts/Identifier__.ts +2 -2
- package/src/concepts/IfStatement__.ts +3 -3
- package/src/concepts/Interface__.ts +1 -1
- package/src/concepts/JSBlock__.ts +2 -2
- package/src/concepts/JavaLogic__.ts +2 -2
- package/src/concepts/LogicItem__.ts +3 -3
- package/src/concepts/Logic__.ts +2 -1
- package/src/concepts/MatchCase__.ts +2 -2
- package/src/concepts/Match__.ts +3 -3
- package/src/concepts/MemberExpression__.ts +112 -4
- package/src/concepts/Module__.ts +41 -58
- package/src/concepts/NewComposite__.ts +3 -3
- package/src/concepts/NewList__.ts +3 -3
- package/src/concepts/NewMap__.ts +3 -3
- package/src/concepts/New__.ts +2 -2
- package/src/concepts/NullLiteral__.ts +2 -2
- package/src/concepts/NumericLiteral__.ts +2 -2
- package/src/concepts/OqlQueryComponent__.ts +3 -3
- package/src/concepts/Param__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +2 -2
- package/src/concepts/ProcessOutcome__.ts +2 -2
- package/src/concepts/ProcessOutcomes__.ts +2 -2
- package/src/concepts/Process__.ts +1 -1
- package/src/concepts/QueryAggregateExpression__.ts +2 -2
- package/src/concepts/QueryFieldExpression__.ts +2 -2
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QueryLimitExpression__.ts +2 -2
- package/src/concepts/QueryOrderByExpression__.ts +2 -2
- package/src/concepts/Return__.ts +3 -3
- package/src/concepts/Role__.ts +1 -1
- package/src/concepts/SelectMembers__.ts +2 -2
- package/src/concepts/SqlQueryComponent__.ts +3 -3
- package/src/concepts/Start__.ts +2 -2
- package/src/concepts/StringInterpolation__.ts +3 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +3 -3
- package/src/concepts/Structure__.ts +2 -2
- package/src/concepts/SwitchCase__.ts +2 -2
- package/src/concepts/SwitchStatement__.ts +3 -3
- package/src/concepts/TriggerLauncher__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +145 -125
- package/src/concepts/TypeParam__.ts +2 -2
- package/src/concepts/UnaryExpression__.ts +3 -3
- package/src/concepts/ValidationRule__.ts +554 -524
- package/src/concepts/Variable__.ts +3 -3
- package/src/concepts/ViewElement__.ts +2445 -2498
- package/src/concepts/View__.ts +258 -10
- package/src/concepts/WhileStatement__.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.browser.ts +1 -0
- package/src/concepts/basics/stdlib/nasl.event.ts +2 -0
- package/src/generator/genBundleFiles.ts +91 -1
- package/src/generator/genReleaseBody.ts +1 -1
- package/src/generator/permission.ts +3 -3
- package/src/index.ts +1 -0
- package/src/natural/genNaturalTS.ts +8 -4
- package/src/natural/knowledgeMap.ts +12 -12
- package/src/natural/transformTSCode.ts +139 -151
- package/src/server/extendBaseNode.ts +71 -45
- package/src/server/formatTsUtils.ts +64 -64
- package/src/server/getLogics.ts +23 -30
- package/src/server/getMemberIdentifier.ts +143 -0
- package/src/server/naslServer.ts +174 -148
- package/src/server/translator.ts +40 -39
- package/src/service/defaultErrorMessage.json +6 -6
- package/src/service/storage/init.ts +17 -0
- package/src/templator/genCreateBlock.ts +5 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +12 -8
- package/src/templator/genCurdMultipleKeyBlock.ts +8 -7
- package/src/templator/genEditTableBlock.ts +12 -7
- package/src/templator/genEnumSelectBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +6 -6
- package/src/templator/genGridViewBlock.ts +22 -9
- package/src/templator/genListViewBlock.ts +14 -5
- package/src/templator/genSelectBlock.ts +8 -6
- package/src/templator/genTableBlock.ts +10 -9
- package/src/templator/genUpdateBlock.ts +5 -3
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +11 -0
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +10 -0
- package/test/concepts/validation-rule/fixtures/argument-without-keyword.json +34 -0
- package/test/concepts/validation-rule/fixtures/empty-rule.json +9 -0
- package/test/concepts/validation-rule/validation-rule.spec.ts +15 -0
|
@@ -10,10 +10,11 @@ import { NaslUITypeAnnotation, NaslCollectionTypeAnnotation, NaslLogicItem, Nasl
|
|
|
10
10
|
* @param nameGroup
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
14
|
-
|
|
13
|
+
export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup, newLogic: any) {
|
|
14
|
+
let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size)`
|
|
15
|
+
return `<u-select clearable placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" :page-size="50" data-schema="${nameGroup.structure}"
|
|
15
16
|
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
16
|
-
value-field="${nameGroup.lowerEntity}.id" :
|
|
17
|
+
value-field="${nameGroup.lowerEntity}.id" :pagination="true">
|
|
17
18
|
</u-select>`;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -23,9 +24,10 @@ export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup
|
|
|
23
24
|
* @param nameGroup
|
|
24
25
|
* @returns
|
|
25
26
|
*/
|
|
26
|
-
export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
|
|
27
|
+
export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup, newLogic: any) {
|
|
27
28
|
const label = property.label || property.name;
|
|
28
|
-
|
|
29
|
+
let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size)`
|
|
30
|
+
return `<van-pickerson type="list" :show-toolbar="true" title="请选择" placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" :page-size="50" data-schema="${nameGroup.structure}"
|
|
29
31
|
text-field="${nameGroup.lowerEntity}.${property.name}"
|
|
30
32
|
value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
|
|
31
33
|
<template #title>${label}</template>
|
|
@@ -92,7 +94,7 @@ export function genSelectBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
92
94
|
const newLogics: Array<any> = [newLogic];
|
|
93
95
|
|
|
94
96
|
return `<template>
|
|
95
|
-
${config.scope === 'h5' ? genH5SelectTemplate(displayedProperty, nameGroup) : genSelectTemplate(displayedProperty, nameGroup)}
|
|
97
|
+
${config.scope === 'h5' ? genH5SelectTemplate(displayedProperty, nameGroup, newLogic) : genSelectTemplate(displayedProperty, nameGroup, newLogic)}
|
|
96
98
|
</template>
|
|
97
99
|
|
|
98
100
|
<definition>
|
|
@@ -56,13 +56,16 @@ export function genTableColumnTemplate(property: EntityProperty, currentName: st
|
|
|
56
56
|
* @param entity 实体
|
|
57
57
|
* @param nameGroup 命名组
|
|
58
58
|
*/
|
|
59
|
-
export function genTableTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
|
|
59
|
+
export function genTableTemplate(entity: Entity, nameGroup: NameGroup,newLogic: any, modifyable?: boolean, entryFromCall?: string) {
|
|
60
60
|
const currentName = nameGroup.currentName || 'current';
|
|
61
61
|
const properties = entity.properties.filter(filterProperty('inTable'));
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
|
|
63
|
+
if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
|
|
64
|
+
dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
|
|
65
|
+
}
|
|
66
|
+
return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
|
|
64
67
|
value-field="${nameGroup.viewVariableEntity}.id"
|
|
65
|
-
:pagination="true" :show-sizer="true">
|
|
68
|
+
:pagination="true" :show-sizer="true" :page-size="20" :page-number="1">
|
|
66
69
|
<u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
|
|
67
70
|
|
|
68
71
|
${properties.map((property) => `${genTableColumnTemplate(property, currentName)}\n`).join('')}
|
|
@@ -205,7 +208,7 @@ export function genTableBlock(entity: Entity, oldNode: ViewElement) {
|
|
|
205
208
|
|
|
206
209
|
return `
|
|
207
210
|
<template>
|
|
208
|
-
${genTableTemplate(entity, nameGroup)}
|
|
211
|
+
${genTableTemplate(entity, nameGroup, entityLogic)}
|
|
209
212
|
</template>
|
|
210
213
|
<definition>
|
|
211
214
|
{
|
|
@@ -250,12 +253,10 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
|
|
|
250
253
|
const allEntities = [...entitySet];
|
|
251
254
|
const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, module);
|
|
252
255
|
newLogics.push(entityLogic);
|
|
253
|
-
|
|
256
|
+
let dataSourceValue = `(params) => ${entityLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
|
|
254
257
|
return `
|
|
255
258
|
<template>
|
|
256
|
-
<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${
|
|
257
|
-
nameGroup.viewLogicLoad
|
|
258
|
-
}" :pagination="true" :show-sizer="true" data-schema="${nameGroup.structure}">
|
|
259
|
+
<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" :pagination="true" :page-size="20" :page-number="1" :show-sizer="true" data-schema="${nameGroup.structure}">
|
|
259
260
|
${properties.map((property) => `${genTableColumnTemplate(property)}\n`).join('')}
|
|
260
261
|
</u-table-view>
|
|
261
262
|
</template>
|
|
@@ -55,9 +55,10 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
55
55
|
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
56
56
|
const key = [property.name, relationEntity.name].join('-');
|
|
57
57
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
58
|
+
let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
|
|
58
59
|
formItem += `
|
|
59
|
-
<u-select clearable placeholder="请选择${label}" :data-source="${
|
|
60
|
-
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :
|
|
60
|
+
<u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
|
|
61
|
+
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
61
62
|
</u-select>
|
|
62
63
|
`;
|
|
63
64
|
} else return '';
|
|
@@ -137,9 +138,10 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
137
138
|
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
138
139
|
const key = [property.name, relationEntity.name].join('-');
|
|
139
140
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
141
|
+
let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
|
|
140
142
|
formItem += `
|
|
141
143
|
<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-pickerson type="list" :show-toolbar="true" title="请选择${label}" placeholder="请选择${label}"
|
|
142
|
-
v-model="${vModel}" :data-source="${
|
|
144
|
+
v-model="${vModel}" :data-source="${dataSourceValue}" :page-size="50"
|
|
143
145
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
144
146
|
:notitleblock="true"
|
|
145
147
|
:pageable="true" input-align="left" :remote-paging="true"></van-pickerson></van-linear-layout></template>
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`validation-rule:toEmbeddedTS argument-without-keyword 1`] = `
|
|
4
|
+
"__IDENTIFIER__;
|
|
5
|
+
nasl.validation.max(new nasl.core.Long(10));
|
|
6
|
+
"
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`validation-rule:toEmbeddedTS empty-rule 1`] = `
|
|
10
|
+
"__ValidationRule__;
|
|
11
|
+
"
|
|
12
|
+
`;
|
|
13
|
+
|
|
3
14
|
exports[`validation-rule:toEmbeddedTS with-param-with-target 1`] = `
|
|
4
15
|
"filter.id;
|
|
5
16
|
nasl.validation.max(new nasl.core.Long(10));
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`validation-rule:toJS argument-without-keyword 1`] = `
|
|
4
|
+
"({ validate: \\"max\\", args: [10], trigger: \\"input+blur\\", message: undefined });
|
|
5
|
+
"
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
exports[`validation-rule:toJS empty-rule 1`] = `
|
|
9
|
+
"({ validate: \\"undefined\\", trigger: \\"input+blur\\", message: undefined });
|
|
10
|
+
"
|
|
11
|
+
`;
|
|
12
|
+
|
|
3
13
|
exports[`validation-rule:toJS with-param-with-target 1`] = `
|
|
4
14
|
"({ validate: \\"max\\", args: [10], trigger: \\"input+blur\\", message: undefined });
|
|
5
15
|
"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"concept": "ValidationRule",
|
|
3
|
+
"changedTime": 1691065082931,
|
|
4
|
+
"name": "",
|
|
5
|
+
"label": "验证规则",
|
|
6
|
+
"folded": false,
|
|
7
|
+
"calleeNamespace": "nasl.validation",
|
|
8
|
+
"calleeName": "max",
|
|
9
|
+
"arguments": [
|
|
10
|
+
{
|
|
11
|
+
"concept": "Argument",
|
|
12
|
+
"name": "",
|
|
13
|
+
"folded": false,
|
|
14
|
+
"keyword": "",
|
|
15
|
+
"expression": {
|
|
16
|
+
"concept": "NumericLiteral",
|
|
17
|
+
"name": "",
|
|
18
|
+
"folded": false,
|
|
19
|
+
"value": "10",
|
|
20
|
+
"typeAnnotation": {
|
|
21
|
+
"concept": "TypeAnnotation",
|
|
22
|
+
"name": "",
|
|
23
|
+
"typeKind": "primitive",
|
|
24
|
+
"typeNamespace": "nasl.core",
|
|
25
|
+
"typeName": "Long",
|
|
26
|
+
"typeArguments": null,
|
|
27
|
+
"returnType": null,
|
|
28
|
+
"properties": null
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"enableServerValidation": true
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import type { ValidationRule } from '../../../out';
|
|
3
|
+
import { readFixture, getNodeByData } from '../utils';
|
|
4
|
+
import { ConceptName } from './constant';
|
|
5
|
+
|
|
6
|
+
describe(ConceptName, () => {
|
|
7
|
+
it('The missing "keyword" props in the validation function argument should be filled after generating the ts file.', () => {
|
|
8
|
+
const data = readFixture(ConceptName, 'argument-without-keyword');
|
|
9
|
+
const node = getNodeByData<ValidationRule>(data);
|
|
10
|
+
expect(node.arguments.length).to.eq(1);
|
|
11
|
+
expect(Boolean(node.arguments[0].keyword)).to.false;
|
|
12
|
+
node.toEmbeddedTS();
|
|
13
|
+
expect(node.arguments[0].keyword).to.eq('max');
|
|
14
|
+
});
|
|
15
|
+
});
|