@lcap/nasl 1.0.2 → 2.12.0-beta
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.js +11 -0
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.js +1 -1
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.d.ts +1 -0
- package/out/automate/engine/utils.js +89 -67
- package/out/automate/engine/utils.js.map +1 -1
- package/out/concepts/App__.d.ts +51 -49
- package/out/concepts/App__.js +86 -54
- 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 +3 -3
- 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__.js +11 -6
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +8 -3
- 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 +23 -21
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +9 -8
- package/out/concepts/CallQueryComponent__.js +89 -79
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +2 -2
- 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__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +8 -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__.d.ts +1 -0
- package/out/concepts/ConfigProperty__.js +4 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +4 -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__.d.ts +143 -0
- package/out/concepts/DataSource__.js +316 -0
- package/out/concepts/DataSource__.js.map +1 -0
- package/out/concepts/Destination__.js +8 -8
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +3 -3
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +5 -0
- package/out/concepts/EntityIndex__.js +7 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +9 -0
- package/out/concepts/EntityProperty__.js +20 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -0
- package/out/concepts/Entity__.js +21 -11
- 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 +11 -5
- 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 +3 -3
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.d.ts +18 -0
- package/out/concepts/Function__.js +96 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -13
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +9 -9
- 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 +19 -12
- 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/LogicItem__.js +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +41 -42
- 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 +1 -85
- package/out/concepts/Module__.js +6 -107
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +0 -86
- package/out/concepts/Namespace__.js +1 -108
- 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__.d.ts +2 -1
- package/out/concepts/Param__.js +1 -1
- 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 +26 -11
- 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__.js +17 -10
- 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 +9 -2
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +4 -0
- package/out/concepts/QueryFromExpression__.js +14 -3
- 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__.d.ts +4 -0
- package/out/concepts/QueryJoinExpression__.js +15 -4
- 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 +1 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +11 -4
- 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 +10 -0
- package/out/concepts/SqlQueryComponent__.js +32 -5
- 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__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +20 -13
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +6 -6
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +1 -1
- 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__.d.ts +8 -0
- package/out/concepts/TypeAnnotation__.js +46 -4
- 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 +1 -1
- 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 +18 -18
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +25 -23
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +5 -5
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +278 -0
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genBundleFiles.js +8 -3
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +13 -12
- package/out/generator/genMetaData.js.map +1 -1
- package/out/server/createUiTs.js +1 -0
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +9 -1
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +3 -0
- package/out/server/getProcesses.js +61 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +128 -6
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.js +10 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +19 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +2 -2
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +15 -11
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +15 -12
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +25 -21
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +12 -12
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +21 -20
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +6 -3
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +5 -5
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +8 -7
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +17 -15
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +15 -11
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/connect-file.js +6 -6
- package/out/test/integration/connect-file.js.map +1 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +4 -0
- package/out/utils/index.js +32 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +12 -1
- package/src/automate/engine/uniqueName.js +1 -1
- package/src/automate/engine/utils.js +92 -67
- package/src/concepts/App__.ts +165 -95
- 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 +3 -3
- package/src/concepts/BindDirective__.ts +1 -1
- package/src/concepts/BindEvent__.ts +10 -6
- package/src/concepts/BooleanLiteral__.ts +1 -1
- package/src/concepts/CallFunction__.ts +19 -16
- package/src/concepts/CallInterface__.ts +1 -1
- package/src/concepts/CallLogic__.ts +23 -23
- package/src/concepts/CallQueryComponent__.ts +96 -113
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/CompletionProperty__.ts +1 -1
- package/src/concepts/ConfigGroup__.ts +4 -2
- package/src/concepts/ConfigPropertyValue__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +5 -1
- package/src/concepts/Configuration__.ts +4 -1
- package/src/concepts/Constant__.ts +1 -1
- package/src/concepts/DataElement__.ts +1 -1
- package/src/concepts/DataSource__.ts +389 -0
- package/src/concepts/Destination__.ts +24 -8
- package/src/concepts/End__.ts +3 -3
- package/src/concepts/EntityIndex__.ts +8 -1
- package/src/concepts/EntityProperty__.ts +21 -3
- package/src/concepts/Entity__.ts +24 -12
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Enum__.ts +24 -5
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +3 -3
- package/src/concepts/Function__.ts +97 -3
- package/src/concepts/Identifier__.ts +12 -13
- package/src/concepts/IfStatement__.ts +10 -10
- package/src/concepts/InterfaceParam__.ts +1 -1
- package/src/concepts/Interface__.ts +20 -12
- package/src/concepts/JSBlock__.ts +1 -1
- package/src/concepts/LogicItem__.ts +1 -1
- package/src/concepts/Logic__.ts +41 -39
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +9 -204
- package/src/concepts/Namespace__.ts +1 -204
- package/src/concepts/NullLiteral__.ts +1 -1
- package/src/concepts/NumericLiteral__.ts +1 -1
- package/src/concepts/Param__.ts +3 -2
- package/src/concepts/Point__.ts +1 -1
- package/src/concepts/ProcessComponent__.ts +1 -1
- package/src/concepts/ProcessElement__.ts +29 -13
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +17 -11
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +10 -2
- package/src/concepts/QueryFromExpression__.ts +14 -3
- package/src/concepts/QueryGroupByExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +15 -4
- 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 +1 -1
- package/src/concepts/Role__.ts +11 -5
- package/src/concepts/Slot__.ts +1 -1
- package/src/concepts/SqlQueryComponent__.ts +30 -11
- package/src/concepts/Start__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +1 -1
- package/src/concepts/StructureProperty__.ts +1 -1
- package/src/concepts/Structure__.ts +20 -12
- package/src/concepts/SwitchCase__.ts +6 -6
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/Theme__.ts +1 -1
- package/src/concepts/Transactional__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +45 -23
- 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 +1 -1
- package/src/concepts/ViewComponent__.ts +1 -1
- package/src/concepts/ViewElement__.ts +19 -19
- package/src/concepts/View__.ts +25 -23
- package/src/concepts/WhileStatement__.ts +5 -5
- package/src/concepts/basics/stdlib/nasl.util.ts +279 -0
- package/src/concepts/index__.ts +1 -0
- package/src/generator/genBundleFiles.ts +8 -3
- package/src/generator/genMetaData.ts +13 -13
- package/src/server/createUiTs.ts +1 -0
- package/src/server/getLogics.ts +11 -3
- package/src/server/getProcesses.ts +61 -0
- package/src/server/naslServer.ts +124 -6
- package/src/server/process2LogicNamespace.ts +29 -19
- package/src/server/translator.ts +22 -1
- package/src/service/storage/init.ts +2 -2
- package/src/templator/genCreateBlock.ts +16 -13
- package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -13
- package/src/templator/genCurdMultipleKeyBlock.ts +26 -22
- package/src/templator/genEditTableBlock.ts +14 -13
- package/src/templator/genGridViewBlock.ts +22 -21
- package/src/templator/genListViewBlock.ts +9 -5
- package/src/templator/genQueryComponent.ts +6 -6
- package/src/templator/genSelectBlock.ts +9 -8
- package/src/templator/genTableBlock.ts +18 -16
- package/src/templator/genUpdateBlock.ts +16 -12
- package/src/templator/utils.ts +2 -2
- package/src/test/integration/connect-file.ts +6 -6
- package/src/translator/index.ts +1 -1
- package/src/utils/index.ts +32 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 4. 主键目前支持 Long String Double 类型接口所以只禁用了对应的三个类型
|
|
6
6
|
*/
|
|
7
7
|
import * as utils from '../utils';
|
|
8
|
-
import { App, Namespace, Entity, View, Enum } from '../concepts';
|
|
8
|
+
import { App, Module, Namespace, Entity, View, Enum, DataSource } from '../concepts';
|
|
9
9
|
import {
|
|
10
10
|
NaslCoreTypeAnnotation, NaslUITypeAnnotation,
|
|
11
11
|
NaslTypeAnnotation, NaslLogicItem, NaslNode,
|
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
} from '.';
|
|
19
19
|
|
|
20
20
|
function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) {
|
|
21
|
-
const
|
|
21
|
+
const dataSource = entity.parentNode as DataSource;
|
|
22
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
22
23
|
const properties = entity.properties.filter(filterProperty('inFilter'));
|
|
23
24
|
return `
|
|
24
25
|
<u-linear-layout justify="space-between">
|
|
@@ -36,7 +37,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
36
37
|
} = typeAnnotation || {};
|
|
37
38
|
if (property.relationEntity) {
|
|
38
39
|
// 有外键关联
|
|
39
|
-
const relationEntity =
|
|
40
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
40
41
|
if (relationEntity) {
|
|
41
42
|
const relationProperty = relationEntity.properties.find((prop) => prop.name === property.relationProperty);
|
|
42
43
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
@@ -75,7 +76,7 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
75
76
|
const namespaceArr = propertyTypeNamespace.split('.');
|
|
76
77
|
const type = namespaceArr.pop();
|
|
77
78
|
if (type === 'enums') {
|
|
78
|
-
formItem += genEnumSelectBlock(
|
|
79
|
+
formItem += genEnumSelectBlock(module.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true);
|
|
79
80
|
} else {
|
|
80
81
|
formItem += `<u-input v-model="${vModel}" placeholder="请输入${label}"></u-input>`;
|
|
81
82
|
}
|
|
@@ -97,7 +98,8 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap: Map<string, NameGroup>) {
|
|
100
|
-
const
|
|
101
|
+
const dataSource = entity.parentNode as DataSource;
|
|
102
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
101
103
|
const properties = entity.properties.filter(filterProperty('inForm'));
|
|
102
104
|
|
|
103
105
|
return `
|
|
@@ -129,7 +131,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
129
131
|
} = typeAnnotation || {};
|
|
130
132
|
if (property.relationEntity) {
|
|
131
133
|
// 有外键关联
|
|
132
|
-
const relationEntity =
|
|
134
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
133
135
|
if (relationEntity) {
|
|
134
136
|
const relationProperty = relationEntity.properties.find((prop) => prop.name === property.relationProperty);
|
|
135
137
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
@@ -175,7 +177,7 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
|
|
|
175
177
|
const namespaceArr = propertyTypeNamespace.split('.');
|
|
176
178
|
const type = namespaceArr.pop();
|
|
177
179
|
if (type === 'enums') {
|
|
178
|
-
formItem += genEnumSelectBlock(
|
|
180
|
+
formItem += genEnumSelectBlock(module.findEnumByName(propertyTypeName) as Enum, `${vModel}`, '', `请选择${label}`, true);
|
|
179
181
|
} else {
|
|
180
182
|
formItem += `<u-input v-model="${vModel}" placeholder="请输入${label}" ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}></u-input>`;
|
|
181
183
|
}
|
|
@@ -338,8 +340,8 @@ function genSubmitLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
338
340
|
|
|
339
341
|
function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
340
342
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
344
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
343
345
|
|
|
344
346
|
return NaslNode.Logic({
|
|
345
347
|
name: nameGroup.viewLogicModify,
|
|
@@ -353,7 +355,7 @@ function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
353
355
|
name: 'scope',
|
|
354
356
|
typeAnnotation: NaslUITypeAnnotation.ScopeOf([
|
|
355
357
|
NaslTypeAnnotation.Reference({
|
|
356
|
-
typeNamespace: `${
|
|
358
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
357
359
|
typeName: nameGroup.structure,
|
|
358
360
|
}),
|
|
359
361
|
]),
|
|
@@ -406,10 +408,11 @@ function genModifyLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
406
408
|
|
|
407
409
|
// 列表(全)
|
|
408
410
|
export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
409
|
-
const
|
|
411
|
+
const dataSource = entity.parentNode as DataSource;
|
|
412
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
410
413
|
|
|
411
414
|
const viewElementMainView = view.getViewElementUniqueName('tableView');
|
|
412
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
415
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
413
416
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
414
417
|
nameGroup.viewElementSaveModal = view.getViewElementUniqueName('saveModal');
|
|
415
418
|
nameGroup.viewElementSaveModalForm = view.getViewElementUniqueName('saveModalForm');
|
|
@@ -432,17 +435,17 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
432
435
|
entity.properties.forEach((property) => {
|
|
433
436
|
// 有外键关联
|
|
434
437
|
if (property.relationEntity) {
|
|
435
|
-
const relationEntity =
|
|
438
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
436
439
|
if (relationEntity) {
|
|
437
440
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
438
441
|
if (displayedProperty) {
|
|
439
442
|
allEntities.push(relationEntity);
|
|
440
443
|
const viewElementSelect = view.getViewElementUniqueName('select');
|
|
441
|
-
const selectNameGroup = genUniqueQueryNameGroup(
|
|
444
|
+
const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
|
|
442
445
|
selectNameGroup.viewElementSelect = viewElementSelect;
|
|
443
446
|
selectNameGroupMap.set(relationEntity.name, selectNameGroup);
|
|
444
447
|
const newStructure = genQueryStructure([relationEntity], selectNameGroup);
|
|
445
|
-
const newLogic = genQueryLogic([relationEntity], selectNameGroup, false, false,
|
|
448
|
+
const newLogic = genQueryLogic([relationEntity], selectNameGroup, false, false, module);
|
|
446
449
|
newStructures.push(newStructure);
|
|
447
450
|
newLogics.push(newLogic);
|
|
448
451
|
newLoadSelectLogics.push(genLoadSelectLogic(relationEntity, selectNameGroup, newLogic));
|
|
@@ -453,7 +456,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
453
456
|
|
|
454
457
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
455
458
|
newStructures.push(entityStructure);
|
|
456
|
-
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true,
|
|
459
|
+
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, module);
|
|
457
460
|
newLogics.push(entityLogic);
|
|
458
461
|
|
|
459
462
|
return `<template>
|
|
@@ -525,10 +528,11 @@ export function genCurdMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
525
528
|
|
|
526
529
|
// 数据网格(全)
|
|
527
530
|
export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
528
|
-
const
|
|
531
|
+
const dataSource = entity.parentNode as DataSource;
|
|
532
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
529
533
|
|
|
530
534
|
const viewElementMainView = view.getViewElementUniqueName('gridView');
|
|
531
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
535
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
532
536
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
533
537
|
nameGroup.viewElementSaveModal = view.getViewElementUniqueName('saveModal');
|
|
534
538
|
nameGroup.viewElementSaveModalForm = view.getViewElementUniqueName('saveModalForm');
|
|
@@ -551,13 +555,13 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
551
555
|
entity.properties.forEach((property) => {
|
|
552
556
|
// 有外键关联
|
|
553
557
|
if (property.relationEntity) {
|
|
554
|
-
const relationEntity =
|
|
558
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
555
559
|
if (relationEntity) {
|
|
556
560
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
557
561
|
if (displayedProperty) {
|
|
558
562
|
allEntities.push(relationEntity);
|
|
559
563
|
const viewElementSelect = view.getViewElementUniqueName('select');
|
|
560
|
-
const selectNameGroup = genUniqueQueryNameGroup(
|
|
564
|
+
const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
|
|
561
565
|
selectNameGroup.viewElementSelect = viewElementSelect;
|
|
562
566
|
selectNameGroupMap.set(relationEntity.name, selectNameGroup);
|
|
563
567
|
const newStructure = genQueryStructure([
|
|
@@ -565,7 +569,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
565
569
|
], selectNameGroup);
|
|
566
570
|
const newLogic = genQueryLogic([
|
|
567
571
|
relationEntity,
|
|
568
|
-
], selectNameGroup, false, false,
|
|
572
|
+
], selectNameGroup, false, false, module);
|
|
569
573
|
newStructures.push(newStructure);
|
|
570
574
|
newLogics.push(newLogic);
|
|
571
575
|
newLoadSelectLogics.push(genLoadSelectLogic(relationEntity, selectNameGroup, newLogic));
|
|
@@ -575,7 +579,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, view: View) {
|
|
|
575
579
|
});
|
|
576
580
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
577
581
|
newStructures.push(entityStructure);
|
|
578
|
-
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true,
|
|
582
|
+
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, module);
|
|
579
583
|
newLogics.push(entityLogic);
|
|
580
584
|
|
|
581
585
|
return `<template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as utils from '../utils';
|
|
2
|
-
import { App, Namespace, Entity, EntityProperty } from '../concepts';
|
|
2
|
+
import { App, Module, Namespace, Entity, EntityProperty, DataSource } from '../concepts';
|
|
3
3
|
import {
|
|
4
4
|
getExpression, filterProperty, NameGroup,
|
|
5
5
|
getFirstDisplayedProperty, getParamFromLogic, genCallComponentLogic,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
* @param property 实体属性
|
|
16
16
|
*/
|
|
17
17
|
export function genEditTableColumnTemplate(entity: Entity, property: EntityProperty, nameGroup: NameGroup, selectNameGroupMap?: Map<string, NameGroup>) {
|
|
18
|
-
const
|
|
18
|
+
const dataSource = entity.parentNode as DataSource;
|
|
19
19
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
20
20
|
const valueExpression = `scope.item.${lowerEntityName}.${property.name}`;
|
|
21
21
|
const title = property.label || property.name;
|
|
@@ -45,7 +45,7 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
|
|
|
45
45
|
const propertyTypeName = property.typeAnnotation.typeName;
|
|
46
46
|
if (property.relationEntity && selectNameGroupMap) {
|
|
47
47
|
// 有外键关联
|
|
48
|
-
const relationEntity =
|
|
48
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
49
49
|
if (relationEntity) {
|
|
50
50
|
const relationProperty = relationEntity.properties.find((prop) => prop.name === property.relationProperty);
|
|
51
51
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
@@ -135,8 +135,9 @@ export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selec
|
|
|
135
135
|
* @param entity 实体
|
|
136
136
|
*/
|
|
137
137
|
export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newLogic: any, supportFilter: boolean) {
|
|
138
|
-
const
|
|
139
|
-
const
|
|
138
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
139
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
140
|
+
|
|
140
141
|
const params = [
|
|
141
142
|
genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
|
|
142
143
|
genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
|
|
@@ -160,7 +161,7 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
|
|
|
160
161
|
name: 'result',
|
|
161
162
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
162
163
|
NaslTypeAnnotation.Reference({
|
|
163
|
-
typeNamespace: `${
|
|
164
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
164
165
|
typeName: nameGroup.structure,
|
|
165
166
|
}),
|
|
166
167
|
]),
|
|
@@ -174,7 +175,7 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
|
|
|
174
175
|
name: 'result',
|
|
175
176
|
}),
|
|
176
177
|
right: NaslLogicItem.CallLogic({
|
|
177
|
-
calleeNamespace: `${
|
|
178
|
+
calleeNamespace: `${moduleNamespace}.logics`,
|
|
178
179
|
calleeName: newLogic.name,
|
|
179
180
|
arguments: params,
|
|
180
181
|
}),
|
|
@@ -190,8 +191,8 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
|
|
|
190
191
|
*/
|
|
191
192
|
export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
192
193
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
193
|
-
const
|
|
194
|
-
const
|
|
194
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
195
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
195
196
|
|
|
196
197
|
const ns = entity.ns;
|
|
197
198
|
const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
|
|
@@ -208,7 +209,7 @@ export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
208
209
|
name: 'scope',
|
|
209
210
|
typeAnnotation: NaslUITypeAnnotation.ScopeOf([
|
|
210
211
|
NaslTypeAnnotation.Reference({
|
|
211
|
-
typeNamespace: `${
|
|
212
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
212
213
|
typeName: nameGroup.structure,
|
|
213
214
|
}),
|
|
214
215
|
]),
|
|
@@ -239,8 +240,8 @@ export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
239
240
|
|
|
240
241
|
export function genBlurUpdateLogic(entity: Entity, nameGroup: NameGroup) {
|
|
241
242
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
242
|
-
const
|
|
243
|
-
const
|
|
243
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
244
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
244
245
|
const ns = entity.ns;
|
|
245
246
|
const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
|
|
246
247
|
return NaslNode.Logic({
|
|
@@ -255,7 +256,7 @@ export function genBlurUpdateLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
255
256
|
name: 'scope',
|
|
256
257
|
typeAnnotation: NaslUITypeAnnotation.ScopeOf([
|
|
257
258
|
NaslTypeAnnotation.Reference({
|
|
258
|
-
typeNamespace: `${
|
|
259
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
259
260
|
typeName: nameGroup.structure,
|
|
260
261
|
}),
|
|
261
262
|
]),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
|
-
import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
|
|
3
|
+
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
|
|
4
4
|
import {
|
|
5
5
|
getExpression,
|
|
6
6
|
filterProperty,
|
|
@@ -21,14 +21,14 @@ import { NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslCollectionTypeAnnotat
|
|
|
21
21
|
*/
|
|
22
22
|
export function genGridViewCardTemplate(property: EntityProperty) {
|
|
23
23
|
const entity = property.entity;
|
|
24
|
-
const
|
|
24
|
+
const dataSource = entity.parentNode as DataSource;
|
|
25
25
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
26
26
|
let expression = `scope.item.${lowerEntityName}.${property.name}`;
|
|
27
27
|
const title = property.label || property.name;
|
|
28
28
|
|
|
29
29
|
if (property.relationEntity) {
|
|
30
30
|
// 有外键关联
|
|
31
|
-
const relationEntity =
|
|
31
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
32
32
|
if (relationEntity) {
|
|
33
33
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
34
34
|
if (displayedProperty) {
|
|
@@ -60,14 +60,13 @@ export function genGridViewCardTemplate(property: EntityProperty) {
|
|
|
60
60
|
|
|
61
61
|
export function genH5GridViewCardTemplate(property: EntityProperty) {
|
|
62
62
|
const entity = property.entity;
|
|
63
|
-
const
|
|
63
|
+
const dataSource = entity.parentNode as DataSource;
|
|
64
64
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
65
65
|
let expression = `scope.item.${lowerEntityName}.${property.name}`;
|
|
66
|
-
const title = property.label || property.name;
|
|
67
66
|
|
|
68
67
|
if (property.relationEntity) {
|
|
69
68
|
// 有外键关联
|
|
70
|
-
const relationEntity =
|
|
69
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
71
70
|
if (relationEntity) {
|
|
72
71
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
73
72
|
if (displayedProperty) {
|
|
@@ -149,8 +148,8 @@ export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup) {
|
|
|
149
148
|
* @param entity 实体
|
|
150
149
|
*/
|
|
151
150
|
export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLogic: any, supportFilter: boolean) {
|
|
152
|
-
const
|
|
153
|
-
const
|
|
151
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
152
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
154
153
|
const params = [
|
|
155
154
|
genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
|
|
156
155
|
genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
|
|
@@ -174,7 +173,7 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
|
|
|
174
173
|
name: 'result',
|
|
175
174
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
176
175
|
NaslTypeAnnotation.Reference({
|
|
177
|
-
typeNamespace: `${
|
|
176
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
178
177
|
typeName: nameGroup.structure,
|
|
179
178
|
}),
|
|
180
179
|
]),
|
|
@@ -188,7 +187,7 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
|
|
|
188
187
|
name: 'result',
|
|
189
188
|
}),
|
|
190
189
|
right: NaslLogicItem.CallLogic({
|
|
191
|
-
calleeNamespace: `${
|
|
190
|
+
calleeNamespace: `${moduleNamespace}.logics`,
|
|
192
191
|
calleeName: newLogic.name,
|
|
193
192
|
arguments: params,
|
|
194
193
|
}),
|
|
@@ -204,8 +203,8 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
|
|
|
204
203
|
*/
|
|
205
204
|
export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
206
205
|
const lowerEntityName = utils.firstLowerCase(entity.name);
|
|
207
|
-
const
|
|
208
|
-
const
|
|
206
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
207
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
209
208
|
const ns = entity.ns;
|
|
210
209
|
const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
|
|
211
210
|
const idPropertys = entity.properties.filter((property) => property.primaryKey || property.name === 'id');
|
|
@@ -221,7 +220,7 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
221
220
|
name: 'scope',
|
|
222
221
|
typeAnnotation: NaslUITypeAnnotation.ScopeOf([
|
|
223
222
|
NaslTypeAnnotation.Reference({
|
|
224
|
-
typeNamespace: `${
|
|
223
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
225
224
|
typeName: nameGroup.structure,
|
|
226
225
|
}),
|
|
227
226
|
]),
|
|
@@ -260,10 +259,11 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
|
|
|
260
259
|
*/
|
|
261
260
|
// 数据网格(简)
|
|
262
261
|
export function genGridViewBlock(entity: Entity, view: View) {
|
|
263
|
-
const
|
|
262
|
+
const dataSource = entity.parentNode as DataSource;
|
|
263
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
264
264
|
|
|
265
265
|
const viewElementMainView = view.getViewElementUniqueName('gridView');
|
|
266
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
266
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
267
267
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
268
268
|
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
269
269
|
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
@@ -275,7 +275,7 @@ export function genGridViewBlock(entity: Entity, view: View) {
|
|
|
275
275
|
entity.properties.forEach((property) => {
|
|
276
276
|
if (property.relationEntity) {
|
|
277
277
|
// 有外键关联
|
|
278
|
-
const relationEntity =
|
|
278
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
279
279
|
if (relationEntity) {
|
|
280
280
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
281
281
|
if (displayedProperty)
|
|
@@ -285,7 +285,7 @@ export function genGridViewBlock(entity: Entity, view: View) {
|
|
|
285
285
|
});
|
|
286
286
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
287
287
|
newStructures.push(entityStructure);
|
|
288
|
-
const entityLogic = genQueryLogic(allEntities, nameGroup, false, true,
|
|
288
|
+
const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, module);
|
|
289
289
|
newLogics.push(entityLogic);
|
|
290
290
|
|
|
291
291
|
return `
|
|
@@ -308,10 +308,11 @@ export function genGridViewBlock(entity: Entity, view: View) {
|
|
|
308
308
|
|
|
309
309
|
export function genGridViewCardBlock(property: EntityProperty, view: View) {
|
|
310
310
|
const entity = property.entity;
|
|
311
|
-
const
|
|
311
|
+
const dataSource = entity.parentNode as DataSource;
|
|
312
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
312
313
|
|
|
313
314
|
const viewElementMainView = view.getViewElementUniqueName('gridView');
|
|
314
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
315
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
|
|
315
316
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
316
317
|
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
317
318
|
nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
|
|
@@ -323,7 +324,7 @@ export function genGridViewCardBlock(property: EntityProperty, view: View) {
|
|
|
323
324
|
entity.properties.forEach((property) => {
|
|
324
325
|
if (property.relationEntity) {
|
|
325
326
|
// 有外键关联
|
|
326
|
-
const relationEntity =
|
|
327
|
+
const relationEntity = dataSource?.findEntityByName(property.relationEntity);
|
|
327
328
|
if (relationEntity) {
|
|
328
329
|
const displayedProperty = getFirstDisplayedProperty(relationEntity);
|
|
329
330
|
if (displayedProperty)
|
|
@@ -333,7 +334,7 @@ export function genGridViewCardBlock(property: EntityProperty, view: View) {
|
|
|
333
334
|
});
|
|
334
335
|
const entityStructure = genQueryStructure(allEntities, nameGroup);
|
|
335
336
|
newStructures.push(entityStructure);
|
|
336
|
-
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true,
|
|
337
|
+
const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, module);
|
|
337
338
|
newLogics.push(entityLogic);
|
|
338
339
|
|
|
339
340
|
return `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
|
-
import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
|
|
3
|
+
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
|
|
4
4
|
import { getExpression, genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genQueryStructure, genLogicParam } from '.';
|
|
5
5
|
import {
|
|
6
6
|
NameGroup, NaslUITypeAnnotation, NaslCollectionTypeAnnotation,
|
|
@@ -39,9 +39,12 @@ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameG
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newStructures: Array<any>, newLogics: Array<any>) {
|
|
42
|
-
const parentNode = entity.parentNode as App | Namespace;
|
|
42
|
+
const parentNode = entity.parentNode as App | Module | Namespace;
|
|
43
43
|
const parentNamespace = parentNode?.getNamespace();
|
|
44
44
|
|
|
45
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
46
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
47
|
+
|
|
45
48
|
// Select 和 table 不一样,直接在内部产生了
|
|
46
49
|
const entityStructure = genQueryStructure([entity], nameGroup);
|
|
47
50
|
const entityLogic = genQueryLogic([entity], nameGroup, false, false, parentNode);
|
|
@@ -61,7 +64,7 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newSt
|
|
|
61
64
|
name: 'result',
|
|
62
65
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
63
66
|
NaslTypeAnnotation.Reference({
|
|
64
|
-
typeNamespace: `${
|
|
67
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
65
68
|
typeName: nameGroup.structure,
|
|
66
69
|
}),
|
|
67
70
|
]),
|
|
@@ -92,10 +95,11 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newSt
|
|
|
92
95
|
* 生成实体选择框区块
|
|
93
96
|
*/
|
|
94
97
|
export function genListViewBlock(entity: Entity, view: View, property: EntityProperty) {
|
|
95
|
-
const
|
|
98
|
+
const dataSource = entity.parentNode as DataSource;
|
|
99
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
96
100
|
|
|
97
101
|
const viewElementMainView = view.getViewElementUniqueName('listView');
|
|
98
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
102
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
|
|
99
103
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
100
104
|
nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
|
|
101
105
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as utils from '../utils';
|
|
2
|
-
import { App, Namespace, Entity, Structure, QueryJoinExpression, CallQueryComponent, StructureProperty } from '../concepts';
|
|
2
|
+
import { App, Module, Namespace, Entity, Structure, QueryJoinExpression, CallQueryComponent, StructureProperty, DataSource } from '../concepts';
|
|
3
3
|
import { NameGroup, NaslCoreTypeAnnotation, NaslCollectionTypeAnnotation, NaslTypeAnnotation, NaslQueryExpression, NaslLogicItem, NaslNode } from './utils';
|
|
4
4
|
|
|
5
5
|
export function genQueryStructure(allEntities: Array<Entity>, nameGroup: NameGroup) {
|
|
@@ -66,8 +66,8 @@ function genWhereExpression(entity: Entity) {
|
|
|
66
66
|
export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGroup, supportFilter: boolean, supportSort: boolean) {
|
|
67
67
|
allEntities = Array.from(allEntities);
|
|
68
68
|
const entity = allEntities.shift();
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
70
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
71
71
|
|
|
72
72
|
const from = NaslQueryExpression.QueryFromExpression({
|
|
73
73
|
entityNamespace: entity.getNamespace(),
|
|
@@ -109,7 +109,7 @@ export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGr
|
|
|
109
109
|
ideVersion: '2.11', // 2.11版本新创建的数据查询组件,返回类型将自动推断
|
|
110
110
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
111
111
|
NaslTypeAnnotation.Reference({
|
|
112
|
-
typeNamespace: `${
|
|
112
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
113
113
|
typeName: nameGroup.structure,
|
|
114
114
|
}),
|
|
115
115
|
]),
|
|
@@ -202,11 +202,11 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
export async function joinEntity(callQueryComponent: CallQueryComponent, entity: Entity, recordStructure: Structure) {
|
|
205
|
-
const
|
|
205
|
+
const dataSource = entity.parentNode as DataSource;
|
|
206
206
|
const from = callQueryComponent.from;
|
|
207
207
|
let joinInfo;
|
|
208
208
|
// 无法判断用户行为,优先加有关系的
|
|
209
|
-
const lastEntity =
|
|
209
|
+
const lastEntity = dataSource.findEntityByName(from.entityName);
|
|
210
210
|
// lastEntity 和 entity Join
|
|
211
211
|
// 判断要不要自动关联 onExpression
|
|
212
212
|
// 一般左联是自动有的了
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from '../config';
|
|
2
2
|
import * as utils from '../utils';
|
|
3
|
-
import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
|
|
3
|
+
import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
|
|
4
4
|
import { NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genQueryStructure, genLogicParam } from '.';
|
|
5
5
|
import {
|
|
6
6
|
NaslUITypeAnnotation, NaslCollectionTypeAnnotation, NaslLogicItem,
|
|
@@ -35,8 +35,8 @@ export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGro
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogic: any) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const moduleNode = utils.findClosestModule(entity) as App | Module;
|
|
39
|
+
const moduleNamespace = moduleNode?.getNamespace();
|
|
40
40
|
const params = [
|
|
41
41
|
genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
|
|
42
42
|
genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
|
|
@@ -54,7 +54,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
54
54
|
name: 'result',
|
|
55
55
|
typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
|
|
56
56
|
NaslTypeAnnotation.Reference({
|
|
57
|
-
typeNamespace: `${
|
|
57
|
+
typeNamespace: `${moduleNamespace}.structures`,
|
|
58
58
|
typeName: nameGroup.structure,
|
|
59
59
|
}),
|
|
60
60
|
]),
|
|
@@ -68,7 +68,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
68
68
|
name: 'result',
|
|
69
69
|
}),
|
|
70
70
|
right: NaslLogicItem.CallLogic({
|
|
71
|
-
calleeNamespace: `${
|
|
71
|
+
calleeNamespace: `${moduleNamespace}.logics`,
|
|
72
72
|
calleeName: newLogic.name,
|
|
73
73
|
arguments: params,
|
|
74
74
|
}),
|
|
@@ -85,10 +85,11 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
|
|
|
85
85
|
* @returns
|
|
86
86
|
*/
|
|
87
87
|
export function genSelectBlock(entity: Entity, view: View) {
|
|
88
|
-
const
|
|
88
|
+
const dataSource = entity.parentNode as DataSource;
|
|
89
|
+
const module = dataSource.parentNode as App | Module | Namespace;
|
|
89
90
|
|
|
90
91
|
const viewElementMainView = view.getViewElementUniqueName('select');
|
|
91
|
-
const nameGroup = genUniqueQueryNameGroup(
|
|
92
|
+
const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
|
|
92
93
|
nameGroup.viewElementMainView = viewElementMainView;
|
|
93
94
|
nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
|
|
94
95
|
|
|
@@ -101,7 +102,7 @@ export function genSelectBlock(entity: Entity, view: View) {
|
|
|
101
102
|
const newStructures: Array<any> = [
|
|
102
103
|
genQueryStructure(allEntities, nameGroup),
|
|
103
104
|
];
|
|
104
|
-
const newLogic = genQueryLogic(allEntities, nameGroup, false, false,
|
|
105
|
+
const newLogic = genQueryLogic(allEntities, nameGroup, false, false, module);
|
|
105
106
|
const newLogics: Array<any> = [
|
|
106
107
|
newLogic,
|
|
107
108
|
];
|