@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
package/src/concepts/Role__.ts
CHANGED
|
@@ -104,7 +104,7 @@ export class Role extends BaseNode {
|
|
|
104
104
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
105
105
|
let code = `export enum ${this.tsName} {\n`;
|
|
106
106
|
code += ` ${this.tsName}='${this.tsName}'\n`;
|
|
107
|
-
code += indent(state
|
|
107
|
+
code += indent((state?.tabSize || 0)) + '}\n';
|
|
108
108
|
|
|
109
109
|
return code;
|
|
110
110
|
}
|
|
@@ -117,9 +117,15 @@ export class Role extends BaseNode {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
getNamespace() {
|
|
120
|
-
if (this.parentNode && (this.parentNode as Namespace).getNamespace)
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
121
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
122
|
+
const parentName = this.parentNode.name;
|
|
123
|
+
const arr = [parentNamespace];
|
|
124
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
125
|
+
arr.push(parentName);
|
|
126
|
+
}
|
|
127
|
+
return `${arr.join('.')}.roles`;
|
|
128
|
+
} else
|
|
123
129
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
124
130
|
}
|
|
125
131
|
|
|
@@ -155,7 +161,7 @@ export class Role extends BaseNode {
|
|
|
155
161
|
//================================================================================
|
|
156
162
|
}
|
|
157
163
|
|
|
158
|
-
classMap
|
|
164
|
+
classMap.Role = Role;
|
|
159
165
|
export default Role;
|
|
160
166
|
//================================================================================
|
|
161
167
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Slot__.ts
CHANGED
|
@@ -114,7 +114,7 @@ export class Slot extends BaseNode {
|
|
|
114
114
|
//================================================================================
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
classMap
|
|
117
|
+
classMap.Slot = Slot;
|
|
118
118
|
export default Slot;
|
|
119
119
|
//================================================================================
|
|
120
120
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -42,7 +42,11 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
42
42
|
@property('TypeAnnotation')
|
|
43
43
|
typeAnnotation: TypeAnnotation = undefined;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* 局部版本
|
|
47
|
+
*/
|
|
48
|
+
@property()
|
|
49
|
+
ideVersion: string = undefined;
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* @param source 需要合并的部分参数
|
|
@@ -57,7 +61,6 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
57
61
|
return super.from(source, parentNode, parentKey) as SqlQueryComponent;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
|
|
61
64
|
/**
|
|
62
65
|
* 设置SQL 查询
|
|
63
66
|
*/
|
|
@@ -70,10 +73,6 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
70
73
|
});
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
76
|
/**
|
|
78
77
|
* 删除类型标注
|
|
79
78
|
* @param name 类型标注名称
|
|
@@ -126,22 +125,42 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
126
125
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
127
126
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
128
127
|
//================================================================================
|
|
128
|
+
|
|
129
|
+
@property()
|
|
130
|
+
dataSource: string = undefined;
|
|
131
|
+
|
|
129
132
|
@withSourceMap()
|
|
130
133
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
131
|
-
let code
|
|
132
|
-
|
|
134
|
+
let code;
|
|
135
|
+
if (this.ideVersion === '2.11') {
|
|
136
|
+
code = `(function(): `;
|
|
137
|
+
code += `${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__'} {\n`;
|
|
138
|
+
} else {
|
|
139
|
+
code = `(function(): nasl.collection.List<`;
|
|
140
|
+
code += `${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__'}> {\n`;
|
|
141
|
+
}
|
|
133
142
|
code += '\n';
|
|
134
|
-
code += indent(state
|
|
135
|
-
code += indent(state
|
|
143
|
+
code += indent((state?.tabSize || 0) + 1) + 'return;\n';
|
|
144
|
+
code += indent((state?.tabSize || 0)) + '})();\n';
|
|
136
145
|
return code;
|
|
137
146
|
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 获取添加时的默认选项
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
public static getDefaultOptions(): any {
|
|
153
|
+
return {
|
|
154
|
+
dataSource: 'defaultDS',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
138
157
|
//================================================================================
|
|
139
158
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
140
159
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
141
160
|
//================================================================================
|
|
142
161
|
}
|
|
143
162
|
|
|
144
|
-
classMap
|
|
163
|
+
classMap.SqlQueryComponent = SqlQueryComponent;
|
|
145
164
|
export default SqlQueryComponent;
|
|
146
165
|
//================================================================================
|
|
147
166
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Start__.ts
CHANGED
|
@@ -71,7 +71,7 @@ export class Start extends LogicItem {
|
|
|
71
71
|
//================================================================================
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
classMap
|
|
74
|
+
classMap.Start = Start;
|
|
75
75
|
export default Start;
|
|
76
76
|
//================================================================================
|
|
77
77
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -125,7 +125,7 @@ export class StringLiteral extends LogicItem {
|
|
|
125
125
|
//================================================================================
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
classMap
|
|
128
|
+
classMap.StringLiteral = StringLiteral;
|
|
129
129
|
export default StringLiteral;
|
|
130
130
|
//================================================================================
|
|
131
131
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -345,7 +345,7 @@ export class StructureProperty extends BaseNode {
|
|
|
345
345
|
//================================================================================
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
classMap
|
|
348
|
+
classMap.StructureProperty = StructureProperty;
|
|
349
349
|
export default StructureProperty;
|
|
350
350
|
//================================================================================
|
|
351
351
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -531,34 +531,42 @@ export class Structure extends BaseNode {
|
|
|
531
531
|
@withSourceMap()
|
|
532
532
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
533
533
|
let code = `export class ${this.tsName} {\n`;
|
|
534
|
-
code += indent(state
|
|
534
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
535
535
|
code += `__name: '${this.getTsNamespace()}.${this.tsName}';\n`;
|
|
536
536
|
this.properties.forEach((property) => {
|
|
537
|
-
code += indent(state
|
|
537
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
538
538
|
code += property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
539
539
|
code += ';\n';
|
|
540
540
|
});
|
|
541
|
-
code += indent(state
|
|
541
|
+
code += indent((state?.tabSize || 0)) + '}\n';
|
|
542
542
|
|
|
543
543
|
return code;
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
getNamespace() {
|
|
547
547
|
if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
|
|
548
|
-
|
|
548
|
+
const parentNamespace = (this.parentNode as Namespace).getNamespace();
|
|
549
|
+
const parentName = this.parentNode.name;
|
|
550
|
+
const arr = [parentNamespace];
|
|
551
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
552
|
+
arr.push(parentName);
|
|
553
|
+
}
|
|
554
|
+
return `${arr.join('.')}.structures`;
|
|
549
555
|
} else
|
|
550
556
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
551
557
|
}
|
|
552
558
|
|
|
553
559
|
getTsNamespace() {
|
|
554
|
-
if (this.parentNode.
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
560
|
+
if (this.parentNode && (this.parentNode as Namespace).getTsNamespace) {
|
|
561
|
+
const parentNamespace = (this.parentNode as Namespace).getTsNamespace();
|
|
562
|
+
const parentName = this.parentNode.tsName || this.parentNode.name;
|
|
563
|
+
const arr = [parentNamespace];
|
|
564
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
565
|
+
arr.push(parentName);
|
|
561
566
|
}
|
|
567
|
+
return `${arr.join('.')}.structures`;
|
|
568
|
+
} else {
|
|
569
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
562
570
|
}
|
|
563
571
|
}
|
|
564
572
|
|
|
@@ -595,7 +603,7 @@ export class Structure extends BaseNode {
|
|
|
595
603
|
//================================================================================
|
|
596
604
|
}
|
|
597
605
|
|
|
598
|
-
classMap
|
|
606
|
+
classMap.Structure = Structure;
|
|
599
607
|
export default Structure;
|
|
600
608
|
//================================================================================
|
|
601
609
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -281,7 +281,7 @@ export class SwitchCase extends LogicItem {
|
|
|
281
281
|
if (!isLast) {
|
|
282
282
|
code += 'if (nasl.core.ensureBoolean(';
|
|
283
283
|
code += this.test ? this.test.toEmbeddedTS(shiftState(state, code, {
|
|
284
|
-
tabSize: state
|
|
284
|
+
tabSize: (state?.tabSize || 0) + 1,
|
|
285
285
|
})) : '__IDENTIFIER__';
|
|
286
286
|
|
|
287
287
|
code += ')) {\n';
|
|
@@ -290,22 +290,22 @@ export class SwitchCase extends LogicItem {
|
|
|
290
290
|
this.consequent.forEach((logicItem) => {
|
|
291
291
|
code
|
|
292
292
|
+= logicItem.toEmbeddedTS(shiftState(state, code, {
|
|
293
|
-
tabSize: state
|
|
293
|
+
tabSize: (state?.tabSize || 0) + 1,
|
|
294
294
|
})) + '\n';
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
code += indent(state
|
|
297
|
+
code += indent((state?.tabSize || 0)) + '}\n';
|
|
298
298
|
} else {
|
|
299
299
|
code += 'else {\n';
|
|
300
300
|
if (Array.isArray(this.consequent)) {
|
|
301
301
|
this.consequent.forEach((logicItem) => {
|
|
302
302
|
code
|
|
303
303
|
+= logicItem.toEmbeddedTS(shiftState(state, code, {
|
|
304
|
-
tabSize: state
|
|
304
|
+
tabSize: (state?.tabSize || 0) + 1,
|
|
305
305
|
})) + '\n';
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
code += indent(state
|
|
308
|
+
code += indent((state?.tabSize || 0)) + '}\n';
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
return code;
|
|
@@ -317,7 +317,7 @@ export class SwitchCase extends LogicItem {
|
|
|
317
317
|
//================================================================================
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
classMap
|
|
320
|
+
classMap.SwitchCase = SwitchCase;
|
|
321
321
|
export default SwitchCase;
|
|
322
322
|
//================================================================================
|
|
323
323
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -248,7 +248,7 @@ export class SwitchStatement extends LogicItem {
|
|
|
248
248
|
//================================================================================
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
classMap
|
|
251
|
+
classMap.SwitchStatement = SwitchStatement;
|
|
252
252
|
export default SwitchStatement;
|
|
253
253
|
//================================================================================
|
|
254
254
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Theme__.ts
CHANGED
|
@@ -87,7 +87,7 @@ export class Theme extends BaseNode {
|
|
|
87
87
|
//================================================================================
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
classMap
|
|
90
|
+
classMap.Theme = Theme;
|
|
91
91
|
export default Theme;
|
|
92
92
|
//================================================================================
|
|
93
93
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -157,7 +157,7 @@ export class Transactional extends BaseNode {
|
|
|
157
157
|
//================================================================================
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
classMap
|
|
160
|
+
classMap.Transactional = Transactional;
|
|
161
161
|
export default Transactional;
|
|
162
162
|
//================================================================================
|
|
163
163
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -40,7 +40,6 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
40
40
|
import BaseNode from '../common/BaseNode';
|
|
41
41
|
import classMap from '../common/classMap';
|
|
42
42
|
|
|
43
|
-
|
|
44
43
|
/**
|
|
45
44
|
* 类型标注
|
|
46
45
|
*/
|
|
@@ -82,8 +81,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
82
81
|
@property()
|
|
83
82
|
inferred?: boolean = undefined;
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
|
|
87
84
|
/**
|
|
88
85
|
* @param source 需要合并的部分参数
|
|
89
86
|
*/
|
|
@@ -97,13 +94,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
97
94
|
return super.from(source, parentNode, parentKey) as TypeAnnotation;
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
97
|
/**
|
|
108
98
|
* 插入类型标注
|
|
109
99
|
* @internal
|
|
@@ -136,8 +126,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
136
126
|
return typeAnnotation;
|
|
137
127
|
}
|
|
138
128
|
|
|
139
|
-
|
|
140
|
-
|
|
141
129
|
/**
|
|
142
130
|
* 插入类型标注
|
|
143
131
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -160,8 +148,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
160
148
|
return node;
|
|
161
149
|
}
|
|
162
150
|
|
|
163
|
-
|
|
164
|
-
|
|
165
151
|
/**
|
|
166
152
|
* 添加类型标注
|
|
167
153
|
* @internal
|
|
@@ -181,8 +167,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
181
167
|
return this._insertTypeAnnotationAt(options as any, index);
|
|
182
168
|
}
|
|
183
169
|
|
|
184
|
-
|
|
185
|
-
|
|
186
170
|
/**
|
|
187
171
|
* 添加类型标注
|
|
188
172
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -206,9 +190,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
206
190
|
return node;
|
|
207
191
|
}
|
|
208
192
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
193
|
/**
|
|
213
194
|
* 删除类型标注
|
|
214
195
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -216,7 +197,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
216
197
|
removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
|
|
217
198
|
|
|
218
199
|
removeTypeAnnotation(options: TypeAnnotation) {
|
|
219
|
-
|
|
200
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
220
201
|
return typeAnnotation.delete();
|
|
221
202
|
}
|
|
222
203
|
|
|
@@ -258,6 +239,35 @@ export class TypeAnnotation extends BaseNode {
|
|
|
258
239
|
}
|
|
259
240
|
}
|
|
260
241
|
|
|
242
|
+
/**
|
|
243
|
+
* 用于展示的 type 标题
|
|
244
|
+
*/
|
|
245
|
+
get headTitle(): string {
|
|
246
|
+
if (this.typeKind === 'primitive') {
|
|
247
|
+
return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName]}`;
|
|
248
|
+
} else if (this.typeKind === 'reference') {
|
|
249
|
+
const typeNamespace = this?.typeNamespace;
|
|
250
|
+
let typeTitle = this.typeName;
|
|
251
|
+
if (typeNamespace && this.rootNode) {
|
|
252
|
+
const entity = (this.rootNode as any).findNodeByCompleteName([typeNamespace, this?.typeName].join('.'));
|
|
253
|
+
if (entity?.concept === 'Entity') {
|
|
254
|
+
const dataSourceName = entity.dataSource?.name;
|
|
255
|
+
if (dataSourceName) {
|
|
256
|
+
typeTitle += `(${dataSourceName})`;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return typeTitle;
|
|
261
|
+
} else if (this.typeKind === 'generic') {
|
|
262
|
+
if (this.typeArguments && this.typeArguments.length)
|
|
263
|
+
return `${this.typeName}<${(this.typeArguments || []).map((arg) => arg.headTitle || 'T')}>`;
|
|
264
|
+
else
|
|
265
|
+
return this.typeName;
|
|
266
|
+
} else {
|
|
267
|
+
return this.typeName;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
261
271
|
/**
|
|
262
272
|
* 用于展示的 type 标题
|
|
263
273
|
*/
|
|
@@ -265,11 +275,11 @@ export class TypeAnnotation extends BaseNode {
|
|
|
265
275
|
if (this.typeKind === 'primitive') {
|
|
266
276
|
return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName]}`;
|
|
267
277
|
} else if (this.typeKind === 'reference') {
|
|
268
|
-
return
|
|
278
|
+
return this.typeName;
|
|
269
279
|
} else if (this.typeKind === 'generic') {
|
|
270
280
|
let str = `${this.typeName}`;
|
|
271
281
|
const loop = (typeArguments: Array<TypeAnnotation>) => {
|
|
272
|
-
str += '<' + (typeArguments[0].
|
|
282
|
+
str += '<' + (typeArguments[0].typeTitle || 'T');
|
|
273
283
|
if (typeArguments[0].typeKind === 'generic') {
|
|
274
284
|
if (this.typeArguments && this.typeArguments.length) {
|
|
275
285
|
loop(typeArguments[0].typeArguments);
|
|
@@ -329,6 +339,18 @@ export class TypeAnnotation extends BaseNode {
|
|
|
329
339
|
});
|
|
330
340
|
}
|
|
331
341
|
|
|
342
|
+
/**
|
|
343
|
+
* 设置类型字段名称
|
|
344
|
+
*/
|
|
345
|
+
setTypeNamespace(typeNamespace: string) {
|
|
346
|
+
const object = {
|
|
347
|
+
typeNamespace,
|
|
348
|
+
};
|
|
349
|
+
this.update({
|
|
350
|
+
...object,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
|
|
332
354
|
get tsCalleeNamespace() {
|
|
333
355
|
if (this.typeNamespace) {
|
|
334
356
|
let tsCalleeNamespace = this.typeNamespace;
|
|
@@ -430,7 +452,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
430
452
|
//================================================================================
|
|
431
453
|
}
|
|
432
454
|
|
|
433
|
-
classMap
|
|
455
|
+
classMap.TypeAnnotation = TypeAnnotation;
|
|
434
456
|
export default TypeAnnotation;
|
|
435
457
|
//================================================================================
|
|
436
458
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -61,7 +61,7 @@ export class TypeParam extends BaseNode {
|
|
|
61
61
|
//================================================================================
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
classMap
|
|
64
|
+
classMap.TypeParam = TypeParam;
|
|
65
65
|
export default TypeParam;
|
|
66
66
|
//================================================================================
|
|
67
67
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -176,7 +176,7 @@ export class UnaryExpression extends LogicItem {
|
|
|
176
176
|
//================================================================================
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
classMap
|
|
179
|
+
classMap.UnaryExpression = UnaryExpression;
|
|
180
180
|
export default UnaryExpression;
|
|
181
181
|
//================================================================================
|
|
182
182
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -90,7 +90,7 @@ export class Unparsed extends LogicItem {
|
|
|
90
90
|
//================================================================================
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
classMap
|
|
93
|
+
classMap.Unparsed = Unparsed;
|
|
94
94
|
export default Unparsed;
|
|
95
95
|
//================================================================================
|
|
96
96
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -77,7 +77,7 @@ export class UseComponent extends BaseNode {
|
|
|
77
77
|
//================================================================================
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
classMap
|
|
80
|
+
classMap.UseComponent = UseComponent;
|
|
81
81
|
export default UseComponent;
|
|
82
82
|
//================================================================================
|
|
83
83
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -324,7 +324,7 @@ export class ValidationRule extends LogicItem {
|
|
|
324
324
|
//================================================================================
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
classMap
|
|
327
|
+
classMap.ValidationRule = ValidationRule;
|
|
328
328
|
export default ValidationRule;
|
|
329
329
|
//================================================================================
|
|
330
330
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -365,7 +365,7 @@ export class Variable extends BaseNode {
|
|
|
365
365
|
//================================================================================
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
classMap
|
|
368
|
+
classMap.Variable = Variable;
|
|
369
369
|
export default Variable;
|
|
370
370
|
//================================================================================
|
|
371
371
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -1091,7 +1091,7 @@ export class ViewComponent extends BaseNode {
|
|
|
1091
1091
|
//================================================================================
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
|
-
classMap
|
|
1094
|
+
classMap.ViewComponent = ViewComponent;
|
|
1095
1095
|
export default ViewComponent;
|
|
1096
1096
|
//================================================================================
|
|
1097
1097
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -864,7 +864,7 @@ export class ViewElement extends BaseNode {
|
|
|
864
864
|
}
|
|
865
865
|
|
|
866
866
|
|
|
867
|
-
|
|
867
|
+
|
|
868
868
|
|
|
869
869
|
/**
|
|
870
870
|
* 删除元素绑定属性
|
|
@@ -1120,7 +1120,7 @@ export class ViewElement extends BaseNode {
|
|
|
1120
1120
|
|
|
1121
1121
|
haveScope(node: ViewElement): boolean {
|
|
1122
1122
|
// uGallery 没有子集不需要scope
|
|
1123
|
-
const dataSourcePcList = ['uTableView', 'uListView', 'uGridView', 'uCalendarView', 'uListComponents', 'uSelect', 'devopsDragTable'];
|
|
1123
|
+
const dataSourcePcList = ['uTableView', 'uListView', 'uGridView', 'uCalendarView', 'uListComponents', 'uSelect', 'devopsDragTable', 'uTreeViewNew'];
|
|
1124
1124
|
const dataSourceH5List = ['vanRadioGroup', 'vanCheckboxGroup', 'vanListView', 'vanGridView', 'vanForComponents', 'lcapEchartsLine', 'lcapEchartsBar', 'lcapEchartsPie'];
|
|
1125
1125
|
const dataSourceList = [...dataSourcePcList, ...dataSourceH5List];
|
|
1126
1126
|
return dataSourceList.includes(node.toHump(node.tag));
|
|
@@ -1132,7 +1132,7 @@ export class ViewElement extends BaseNode {
|
|
|
1132
1132
|
let code = '';
|
|
1133
1133
|
// formItem的单独处理
|
|
1134
1134
|
if (this.tag === 'u-form-item') {
|
|
1135
|
-
code = indent(state
|
|
1135
|
+
code = indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}`;
|
|
1136
1136
|
if (Array.isArray(this.children) && this.children.length) {
|
|
1137
1137
|
const tag = this.children[0].tag;
|
|
1138
1138
|
if (tag === 'u-input') {
|
|
@@ -1185,9 +1185,9 @@ export class ViewElement extends BaseNode {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
-
code += indent(state
|
|
1188
|
+
code += indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<${genericType}>;\n`;
|
|
1189
1189
|
} else {
|
|
1190
|
-
code = indent(state
|
|
1190
|
+
code = indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<any>;\n`;
|
|
1191
1191
|
}
|
|
1192
1192
|
if (Array.isArray(this.children)) {
|
|
1193
1193
|
this.children.forEach((element) => {
|
|
@@ -1217,14 +1217,14 @@ export class ViewElement extends BaseNode {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
// 角色
|
|
1219
1219
|
if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
|
|
1220
|
-
code += indent(state
|
|
1220
|
+
code += indent((state?.tabSize || 0) + 2);
|
|
1221
1221
|
code += 'roles = [\n';
|
|
1222
1222
|
this.bindRoles.forEach((role) => {
|
|
1223
|
-
code += indent(state
|
|
1223
|
+
code += indent((state?.tabSize || 0) + 3);
|
|
1224
1224
|
code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
|
|
1225
1225
|
code += '\n';
|
|
1226
1226
|
});
|
|
1227
|
-
code += indent(state
|
|
1227
|
+
code += indent((state?.tabSize || 0) + 2);
|
|
1228
1228
|
code += '],\n';
|
|
1229
1229
|
}
|
|
1230
1230
|
// 绑定属性
|
|
@@ -1233,7 +1233,7 @@ export class ViewElement extends BaseNode {
|
|
|
1233
1233
|
// 跳转页面
|
|
1234
1234
|
if (attr.destination) {
|
|
1235
1235
|
code += attr.destination.toEmbeddedTS(shiftState(state, code, {
|
|
1236
|
-
tabSize: state
|
|
1236
|
+
tabSize: (state?.tabSize || 0),
|
|
1237
1237
|
}));
|
|
1238
1238
|
}
|
|
1239
1239
|
});
|
|
@@ -1244,7 +1244,7 @@ export class ViewElement extends BaseNode {
|
|
|
1244
1244
|
if (Array.isArray(this.bindEvents)) {
|
|
1245
1245
|
this.bindEvents.forEach((event) => {
|
|
1246
1246
|
code += event.toEmbeddedTS(shiftState(state, code, {
|
|
1247
|
-
tabSize: state
|
|
1247
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1248
1248
|
}));
|
|
1249
1249
|
code += '\n';
|
|
1250
1250
|
});
|
|
@@ -1252,7 +1252,7 @@ export class ViewElement extends BaseNode {
|
|
|
1252
1252
|
|
|
1253
1253
|
// 子元素
|
|
1254
1254
|
if (Array.isArray(this.children)) {
|
|
1255
|
-
code += indent(state
|
|
1255
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1256
1256
|
|
|
1257
1257
|
if (Array.isArray(this.bindAttrs)) {
|
|
1258
1258
|
code += `bindAttr: () => [\n`;
|
|
@@ -1260,7 +1260,7 @@ export class ViewElement extends BaseNode {
|
|
|
1260
1260
|
if (attr.expression) {
|
|
1261
1261
|
code
|
|
1262
1262
|
+= attr.expression.toEmbeddedTS(shiftState(state, code, {
|
|
1263
|
-
tabSize: state
|
|
1263
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1264
1264
|
})) + ',\n';
|
|
1265
1265
|
}
|
|
1266
1266
|
if (Array.isArray(attr.rules) && attr.rules.length) {
|
|
@@ -1273,11 +1273,11 @@ export class ViewElement extends BaseNode {
|
|
|
1273
1273
|
if (directive.expression) {
|
|
1274
1274
|
code
|
|
1275
1275
|
+= directive.expression.toEmbeddedTS(shiftState(state, code, {
|
|
1276
|
-
tabSize: state
|
|
1276
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1277
1277
|
})) + ',\n';
|
|
1278
1278
|
}
|
|
1279
1279
|
});
|
|
1280
|
-
code += indent(state
|
|
1280
|
+
code += indent((state?.tabSize || 0) + 2) + '],\n';
|
|
1281
1281
|
}
|
|
1282
1282
|
|
|
1283
1283
|
let levelIndex = parentLevel || 0;
|
|
@@ -1290,15 +1290,15 @@ export class ViewElement extends BaseNode {
|
|
|
1290
1290
|
|
|
1291
1291
|
this.children.forEach((element) => {
|
|
1292
1292
|
code += element.toEmbeddedTS(shiftState(state, code, {
|
|
1293
|
-
tabSize: state
|
|
1293
|
+
tabSize: (state?.tabSize || 0) + 2,
|
|
1294
1294
|
}), levelIndex);
|
|
1295
1295
|
code += '\n';
|
|
1296
1296
|
});
|
|
1297
|
-
code += indent(state
|
|
1297
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1298
1298
|
code += ']\n';
|
|
1299
1299
|
}
|
|
1300
1300
|
|
|
1301
|
-
code += indent(state
|
|
1301
|
+
code += indent((state?.tabSize || 0)) + '}),\n';
|
|
1302
1302
|
|
|
1303
1303
|
return code;
|
|
1304
1304
|
}
|
|
@@ -1673,7 +1673,7 @@ export class ViewElement extends BaseNode {
|
|
|
1673
1673
|
if (hasAuto)
|
|
1674
1674
|
addEmpty = false;
|
|
1675
1675
|
}
|
|
1676
|
-
if (['u-select', 'u-dropdown', 'u-panel'].includes(el.tag)) {
|
|
1676
|
+
if (['u-select', 'u-dropdown', 'u-panel','u-toc','u-toc-item', 'u-tree-view-new','u-tree-view-node-new', 'u-tree-select', 'u-anchor'].includes(el.tag)) {
|
|
1677
1677
|
addEmpty = false;
|
|
1678
1678
|
}
|
|
1679
1679
|
const background = (emptySlot && emptySlot['empty-background']) || (hasSupport ? 'add-sub' : '');
|
|
@@ -1801,7 +1801,7 @@ export class ViewElement extends BaseNode {
|
|
|
1801
1801
|
//================================================================================
|
|
1802
1802
|
}
|
|
1803
1803
|
|
|
1804
|
-
classMap
|
|
1804
|
+
classMap.ViewElement = ViewElement;
|
|
1805
1805
|
export default ViewElement;
|
|
1806
1806
|
//================================================================================
|
|
1807
1807
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|