@lcap/nasl 2.12.0-beta → 2.12.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/out/automate/engine/index.d.ts +1 -0
- package/out/automate/engine/index.js +23 -12
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/operators.d.ts +10 -2
- package/out/automate/engine/operators.js +105 -7
- package/out/automate/engine/operators.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +8 -2
- package/out/automate/engine/uniqueName.js +72 -4
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.js +4 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/process.d.ts +9 -0
- package/out/automate/template/process.js +10976 -0
- package/out/automate/template/process.js.map +1 -0
- package/out/bak/translator.js +1 -0
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -0
- package/out/common/BaseNode.js +24 -3
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.js +3 -2
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/Assignment__.js +1 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +1 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +1 -1
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +9 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +6 -2
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +4 -0
- package/out/concepts/BooleanLiteral__.js +12 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +2 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +1 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +27 -11
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +1 -1
- package/out/concepts/CallQueryComponent__.js +3 -3
- 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/CompletionProperty__.js +1 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.js +1 -1
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.js +2 -0
- package/out/concepts/DataSource__.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 +1 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +1 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +2 -2
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -2
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +1 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +2 -2
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +2 -4
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.js +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +7 -6
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +118 -112
- package/out/concepts/Module__.js +25 -7
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +2 -2
- package/out/concepts/Namespace__.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/Param__.js +2 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +1 -1
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +7 -2
- 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/Process__.d.ts +1 -1
- package/out/concepts/Process__.js +2 -2
- 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/QueryGroupByExpression__.js +1 -1
- package/out/concepts/QueryGroupByExpression__.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/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +1 -1
- package/out/concepts/Rect__.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/Slot__.js +1 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +4 -0
- package/out/concepts/SqlQueryComponent__.js +16 -0
- 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/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +5 -4
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +1 -1
- package/out/concepts/SwitchCase__.js +19 -21
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -7
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js +1 -1
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js +1 -1
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +2 -2
- 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 +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +1 -1
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +1 -1
- 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/ViewComponent__.js +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +9 -4
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +0 -2
- package/out/concepts/View__.js +4 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
- package/out/concepts/basics/stdlib/nasl.process.js +410 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +25 -25
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +4 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +3 -1
- package/out/generator/genBundleFiles.js +16 -3
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +1 -0
- package/out/generator/genMetaData.js +7 -0
- package/out/generator/genMetaData.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/server/getLogics.js +18 -0
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +5 -0
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -0
- package/out/server/getProcesses.js +9 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -0
- package/out/server/naslServer.js +98 -23
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +21 -3
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.d.ts +1 -0
- package/out/service/storage/init.js +94 -83
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +20 -14
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +13 -6
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +20 -8
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +3 -1
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +1 -1
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +8 -4
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +1 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +20 -21
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.js +14 -6
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +20 -14
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.js +19 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +21 -7
- package/src/automate/engine/operators.js +114 -17
- package/src/automate/engine/uniqueName.js +77 -9
- package/src/automate/engine/utils.js +4 -2
- package/src/automate/template/process.js +10999 -0
- package/src/bak/translator.js +1 -0
- package/src/common/BaseNode.ts +21 -4
- package/src/concepts/App__.ts +4 -40
- package/src/concepts/Argument__.ts +1 -1
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/Assignment__.ts +1 -1
- package/src/concepts/Attribute__.ts +1 -1
- package/src/concepts/BinaryExpression__.ts +1 -1
- package/src/concepts/BindAttribute__.ts +1 -1
- package/src/concepts/BindDirective__.ts +8 -6
- package/src/concepts/BindEvent__.ts +6 -2
- package/src/concepts/BooleanLiteral__.ts +13 -1
- package/src/concepts/CallFunction__.ts +15 -14
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +26 -11
- package/src/concepts/CallQueryComponent__.ts +32 -4
- package/src/concepts/Comment__.ts +1 -1
- package/src/concepts/CompletionProperty__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigPropertyValue__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Constant__.ts +1 -1
- package/src/concepts/DataElement__.ts +1 -1
- package/src/concepts/DataSource__.ts +2 -0
- package/src/concepts/End__.ts +1 -1
- package/src/concepts/EntityIndex__.ts +1 -1
- package/src/concepts/EntityProperty__.ts +1 -1
- package/src/concepts/Entity__.ts +1 -1
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Enum__.ts +1 -1
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +1 -1
- package/src/concepts/Function__.ts +5 -5
- package/src/concepts/Identifier__.ts +3 -2
- package/src/concepts/IfStatement__.ts +1 -1
- package/src/concepts/InterfaceParam__.ts +1 -1
- package/src/concepts/Interface__.ts +2 -2
- package/src/concepts/JSBlock__.ts +2 -11
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +8 -44
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +141 -147
- package/src/concepts/Namespace__.ts +2 -2
- package/src/concepts/NullLiteral__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -1
- package/src/concepts/Param__.ts +2 -2
- package/src/concepts/Point__.ts +1 -1
- package/src/concepts/ProcessComponent__.ts +1 -1
- package/src/concepts/ProcessElement__.ts +8 -3
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +3 -3
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +1 -1
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryGroupByExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +1 -1
- package/src/concepts/QueryLimitExpression__.ts +1 -1
- package/src/concepts/QueryOrderByExpression__.ts +1 -1
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Rect__.ts +1 -1
- package/src/concepts/Return__.ts +2 -2
- package/src/concepts/Role__.ts +1 -1
- package/src/concepts/Slot__.ts +1 -1
- package/src/concepts/SqlQueryComponent__.ts +17 -0
- package/src/concepts/Start__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +5 -8
- package/src/concepts/Structure__.ts +1 -1
- package/src/concepts/SwitchCase__.ts +19 -23
- package/src/concepts/SwitchStatement__.ts +2 -6
- package/src/concepts/Theme__.ts +1 -1
- package/src/concepts/Transactional__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +21 -2
- package/src/concepts/TypeParam__.ts +1 -1
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/Unparsed__.ts +1 -1
- package/src/concepts/UseComponent__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +1 -1
- package/src/concepts/Variable__.ts +2 -2
- package/src/concepts/ViewComponent__.ts +1 -1
- package/src/concepts/ViewElement__.ts +10 -23
- package/src/concepts/View__.ts +6 -13
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
- package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
- package/src/concepts/basics/stdlib/nasl.util.ts +25 -25
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/generator/genBundleFiles.ts +21 -5
- package/src/generator/genMetaData.ts +10 -1
- package/src/index.ts +1 -1
- package/src/server/getLogics.ts +18 -1
- package/src/server/getMemberIdentifier.ts +4 -0
- package/src/server/getProcesses.ts +8 -1
- package/src/server/naslServer.ts +107 -28
- package/src/server/translator.ts +20 -3
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +96 -85
- package/src/templator/genCreateBlock.ts +20 -14
- package/src/templator/genCurdEditMultipleKeyBlock.ts +13 -8
- package/src/templator/genCurdMultipleKeyBlock.ts +20 -9
- package/src/templator/genEditTableBlock.ts +3 -1
- package/src/templator/genEnumSelectBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +8 -4
- package/src/templator/genListViewBlock.ts +1 -2
- package/src/templator/genQueryComponent.ts +22 -21
- package/src/templator/genTableBlock.ts +14 -7
- package/src/templator/genUpdateBlock.ts +20 -14
- package/src/utils/index.ts +19 -0
|
@@ -73,28 +73,26 @@ export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGr
|
|
|
73
73
|
entityNamespace: entity.getNamespace(),
|
|
74
74
|
entityName: entity.name,
|
|
75
75
|
joinParts: allEntities.map((relationEntity) => {
|
|
76
|
-
const
|
|
76
|
+
const onExpressions = entity.properties?.filter((property) => property.relationEntity === relationEntity.name).map((leftProperty) => NaslLogicItem.BinaryExpression({
|
|
77
|
+
operator: '==',
|
|
78
|
+
left: NaslQueryExpression.QueryFieldExpression({
|
|
79
|
+
label: '查询组件实体属性',
|
|
80
|
+
isDotStar: false,
|
|
81
|
+
entityAsName: entity.name,
|
|
82
|
+
propertyName: leftProperty.name,
|
|
83
|
+
}),
|
|
84
|
+
right: NaslQueryExpression.QueryFieldExpression({
|
|
85
|
+
label: '查询组件实体属性',
|
|
86
|
+
isDotStar: false,
|
|
87
|
+
entityAsName: relationEntity.name,
|
|
88
|
+
propertyName: leftProperty.relationProperty,
|
|
89
|
+
}),
|
|
90
|
+
}));
|
|
77
91
|
return NaslQueryExpression.QueryJoinExpression({
|
|
78
92
|
entityNamespace: relationEntity.getNamespace(),
|
|
79
93
|
entityName: relationEntity.name,
|
|
80
94
|
joinType: 'LEFT',
|
|
81
|
-
onExpressions
|
|
82
|
-
NaslLogicItem.BinaryExpression({
|
|
83
|
-
operator: '==',
|
|
84
|
-
left: NaslQueryExpression.QueryFieldExpression({
|
|
85
|
-
label: '查询组件实体属性',
|
|
86
|
-
isDotStar: false,
|
|
87
|
-
entityAsName: entity.name,
|
|
88
|
-
propertyName: leftProperty.name,
|
|
89
|
-
}),
|
|
90
|
-
right: NaslQueryExpression.QueryFieldExpression({
|
|
91
|
-
label: '查询组件实体属性',
|
|
92
|
-
isDotStar: false,
|
|
93
|
-
entityAsName: relationEntity.name,
|
|
94
|
-
propertyName: leftProperty.relationProperty,
|
|
95
|
-
}),
|
|
96
|
-
}),
|
|
97
|
-
],
|
|
95
|
+
onExpressions,
|
|
98
96
|
joinParts: [],
|
|
99
97
|
});
|
|
100
98
|
}),
|
|
@@ -150,7 +148,10 @@ export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGr
|
|
|
150
148
|
}
|
|
151
149
|
|
|
152
150
|
export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup, supportFilter: boolean, supportSort: boolean, parentNode: any) {
|
|
153
|
-
const
|
|
151
|
+
const entity = allEntities?.[0];
|
|
152
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
153
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
154
|
+
|
|
154
155
|
const logic = NaslNode.Logic({
|
|
155
156
|
name: nameGroup.logic,
|
|
156
157
|
description: '',
|
|
@@ -169,7 +170,7 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
|
|
|
169
170
|
name: 'result',
|
|
170
171
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
171
172
|
NaslTypeAnnotation.Reference({
|
|
172
|
-
typeNamespace: `${
|
|
173
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
173
174
|
typeName: nameGroup.structure,
|
|
174
175
|
}),
|
|
175
176
|
]),
|
|
@@ -188,7 +189,7 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
|
|
|
188
189
|
typeAnnotation: NaslCoreTypeAnnotation.String,
|
|
189
190
|
}));
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
+
|
|
192
193
|
if (supportFilter && entity) {
|
|
193
194
|
logic.params.push(NaslNode.Param({
|
|
194
195
|
name: 'filter',
|
|
@@ -20,16 +20,20 @@ import { NaslCoreTypeAnnotation, NaslCollectionTypeAnnotation, NaslUITypeAnnotat
|
|
|
20
20
|
*/
|
|
21
21
|
export function genTableColumnTemplate(property: EntityProperty) {
|
|
22
22
|
const entity = property.entity;
|
|
23
|
+
const dataSource = entity.parentNode as DataSource;
|
|
23
24
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
24
25
|
let expression = `scope.item.${lowerEntityName}.${property.name}`;
|
|
25
26
|
const title = property.label || property.name;
|
|
26
27
|
|
|
27
28
|
if (property.relationEntity) {
|
|
28
29
|
const relationLowerEntityName = utils.firstLowerCase(property.relationEntity);
|
|
30
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
31
|
+
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
29
32
|
// 有外键关联
|
|
30
|
-
expression = getExpression(property, `scope.item.${relationLowerEntityName}.${property.relationProperty}`);
|
|
31
|
-
} else
|
|
33
|
+
expression = getExpression(property, `scope.item.${relationLowerEntityName}.${displayedProperty?.name || property.relationProperty}`);
|
|
34
|
+
} else {
|
|
32
35
|
expression = getExpression(property, `scope.item.${lowerEntityName}.${property.name}`);
|
|
36
|
+
}
|
|
33
37
|
|
|
34
38
|
const getText = (property: EntityProperty) => {
|
|
35
39
|
if (property.typeAnnotation.typeName === 'Boolean') {
|
|
@@ -202,7 +206,8 @@ export function genTableBlock(entity: Entity, view: View) {
|
|
|
202
206
|
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
203
207
|
|
|
204
208
|
// 收集所有和本实体关联的实体
|
|
205
|
-
const
|
|
209
|
+
const entitySet: Set<Entity> = new Set();
|
|
210
|
+
entitySet.add(entity);
|
|
206
211
|
const newStructures: any[] = [];
|
|
207
212
|
const newLogics: any[] = [];
|
|
208
213
|
entity.properties.forEach((property) => {
|
|
@@ -212,10 +217,11 @@ export function genTableBlock(entity: Entity, view: View) {
|
|
|
212
217
|
if (relationEntity) {
|
|
213
218
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
214
219
|
if (displayedProperty)
|
|
215
|
-
|
|
220
|
+
entitySet.add(relationEntity);
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
});
|
|
224
|
+
const allEntities = [...entitySet];
|
|
219
225
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
220
226
|
newStructures.push(entityStructure);
|
|
221
227
|
const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, module);
|
|
@@ -251,7 +257,8 @@ export function genTableColumnBlock(property: EntityProperty, view: View) {
|
|
|
251
257
|
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
252
258
|
|
|
253
259
|
// 收集所有和本实体关联的实体
|
|
254
|
-
const
|
|
260
|
+
const entitySet: Set<Entity> = new Set();
|
|
261
|
+
entitySet.add(entity);
|
|
255
262
|
const newStructures: any[] = [];
|
|
256
263
|
const newLogics: any[] = [];
|
|
257
264
|
const properties = [property];
|
|
@@ -262,11 +269,11 @@ export function genTableColumnBlock(property: EntityProperty, view: View) {
|
|
|
262
269
|
if (relationEntity) {
|
|
263
270
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
264
271
|
if (displayedProperty)
|
|
265
|
-
|
|
272
|
+
entitySet.add(relationEntity);
|
|
266
273
|
}
|
|
267
274
|
}
|
|
268
275
|
});
|
|
269
|
-
|
|
276
|
+
const allEntities = [...entitySet];
|
|
270
277
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
271
278
|
newStructures.push(entityStructure);
|
|
272
279
|
const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, module);
|
|
@@ -46,7 +46,9 @@ export function genUpdateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
46
46
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
47
47
|
if (displayedProperty) {
|
|
48
48
|
const lowerEntityName = utils.firstLowerCase(relationEntity.name);
|
|
49
|
-
|
|
49
|
+
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
50
|
+
const key = [property.name, relationEntity.name].join('-');
|
|
51
|
+
const selectNameGroup = selectNameGroupMap.get(key);
|
|
50
52
|
formItem += `
|
|
51
53
|
<u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
52
54
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${vModel}">
|
|
@@ -121,40 +123,42 @@ export function genH5UpdateFormTemplate(entity: Entity, nameGroup: NameGroup, se
|
|
|
121
123
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
122
124
|
if (displayedProperty) {
|
|
123
125
|
const lowerEntityName = utils.firstLowerCase(relationEntity.name);
|
|
124
|
-
|
|
126
|
+
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
127
|
+
const key = [property.name, relationEntity.name].join('-');
|
|
128
|
+
const selectNameGroup = selectNameGroupMap.get(key);
|
|
125
129
|
formItem += `
|
|
126
|
-
<template #input><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
130
|
+
<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-cascader title="请选择${label}" placeholder="请选择${label}"
|
|
127
131
|
v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
|
|
128
132
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
|
|
129
133
|
:notitleblock="true"
|
|
130
|
-
:pageable="true" :remote-paging="true"></van-cascader></template>
|
|
134
|
+
:pageable="true" input-align="left" :remote-paging="true"></van-cascader></van-linear-layout></template>
|
|
131
135
|
`;
|
|
132
136
|
} else
|
|
133
137
|
return '';
|
|
134
138
|
} else
|
|
135
139
|
return '';
|
|
136
140
|
} else if (propertyTypeName === 'Boolean') {
|
|
137
|
-
formItem += `<template #input><van-switch v-model="${vModel}"></van-switch></template>`;
|
|
141
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-switch v-model="${vModel}"></van-switch></van-linear-layout></template>`;
|
|
138
142
|
} else if (propertyTypeName === 'Integer' || propertyTypeName === 'Long') {
|
|
139
|
-
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
143
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-stepper-new v-model="${vModel}" placeholder="请输入${label}" :showPlus="false" :showMinus="false" align="left"></van-stepper-new></van-linear-layout></template>`;
|
|
140
144
|
} else if (propertyTypeName === 'Double') {
|
|
141
|
-
formItem += `<template #input><van-stepper v-model="${vModel}" placeholder="请输入${label}"></van-stepper></template>`;
|
|
145
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-stepper-new v-model="${vModel}" placeholder="请输入${label}" :showPlus="false" :showMinus="false" align="left"></van-stepper-new></van-linear-layout></template>`;
|
|
142
146
|
} else if (propertyTypeName === 'Text') {
|
|
143
|
-
formItem += `<template #input><van-fieldtextarea v-model="${vModel}" placeholder="请输入${label}"></van-fieldtextarea></template>`;
|
|
147
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-fieldtextarea v-model="${vModel}" placeholder="请输入${label}"></van-fieldtextarea></van-linear-layout></template>`;
|
|
144
148
|
// @TODO
|
|
145
149
|
} else if (propertyTypeName === 'Date') {
|
|
146
|
-
formItem += `<template #input><van-calendar clearable :default-date.sync="${vModel}" placeholder="请输入${label}"></van-calendar></template>`;
|
|
150
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-calendar clearable :default-date.sync="${vModel}" placeholder="请输入${label}" input-align="left"></van-calendar></van-linear-layout></template>`;
|
|
147
151
|
} else if (propertyTypeName === 'Time') {
|
|
148
|
-
formItem += `<template #input><van-datetime-picker type="time" v-model="${vModel}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
|
|
152
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-datetime-picker type="time" v-model="${vModel}" title="请选择${label}" label-field="" input-align="left"></van-datetime-picker></van-linear-layout></template>`;
|
|
149
153
|
} else if (propertyTypeName === 'DateTime') {
|
|
150
|
-
formItem += `<template #input><van-datetime-picker type="datetime" v-model="${vModel}" title="请选择${label}" label-field=""></van-datetime-picker></template>`;
|
|
154
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-datetime-picker type="datetime" v-model="${vModel}" title="请选择${label}" label-field="" input-align="left"></van-datetime-picker></van-linear-layout></template>`;
|
|
151
155
|
} else {
|
|
152
156
|
const namespaceArr = propertyTypeNamespace.split('.');
|
|
153
157
|
const type = namespaceArr.pop();
|
|
154
158
|
if (type === 'enums') {
|
|
155
|
-
formItem += '<template #input>' + genEnumSelectBlock(module.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true) + '</template>';
|
|
159
|
+
formItem += '<template #input><van-linear-layout style="width:100%;" direction="horizontal">' + genEnumSelectBlock(module.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true) + '</van-linear-layout></template>';
|
|
156
160
|
} else {
|
|
157
|
-
formItem += `<template #input><van-fieldinput v-model="${vModel}" placeholder="请输入${label}"></van-fieldinput></template>`;
|
|
161
|
+
formItem += `<template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-fieldinput v-model="${vModel}" placeholder="请输入${label}"></van-fieldinput></van-linear-layout></template>`;
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
|
|
@@ -282,7 +286,9 @@ export function genUpdateBlock(entity: Entity, view: View) {
|
|
|
282
286
|
const viewElementSelect = view.getViewElementUniqueName('select');
|
|
283
287
|
const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
|
|
284
288
|
selectNameGroup.viewElementSelect = viewElementSelect;
|
|
285
|
-
|
|
289
|
+
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
290
|
+
const key = [property.name, relationEntity.name].join('-');
|
|
291
|
+
selectNameGroupMap.set(key, selectNameGroup);
|
|
286
292
|
const newStructure = genQueryStructure([relationEntity], selectNameGroup);
|
|
287
293
|
const newLogic = genQueryLogic([relationEntity], selectNameGroup, false, false, module);
|
|
288
294
|
newStructures.push(newStructure);
|
package/src/utils/index.ts
CHANGED
|
@@ -37,6 +37,25 @@ export function findConceptKeyWordIndexFromNamespace(namespace: string, keyword:
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// 从namespace中查找concept,返回找到类型对应的值
|
|
41
|
+
// 如 namespace : app.datasource.defaultDS keyword: datasource
|
|
42
|
+
// 返回 defaultDS
|
|
43
|
+
export function findConceptValueFromNamespace(namespace: string, keyword: string) {
|
|
44
|
+
const namespaceArr = namespace?.split('.') || [];
|
|
45
|
+
const start = namespaceArr[0];
|
|
46
|
+
const mod = start === 'app' ? 1 : 0;
|
|
47
|
+
const findIndex = namespaceArr.findIndex((namespaceItem, index) => {
|
|
48
|
+
if (index % 2 === mod) {
|
|
49
|
+
return namespaceItem === keyword;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (findIndex)
|
|
55
|
+
return namespaceArr[findIndex + 1];
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
|
|
40
59
|
export function getGlobalEnv() {
|
|
41
60
|
return typeof window !== 'undefined' ? (window as any).appInfo.env : (global as any).appInfoEnv;
|
|
42
61
|
}
|