@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.14
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 +1 -1
- package/out/automate/engine/index.js.map +1 -1
- package/out/common/BaseNode.d.ts +4 -4
- package/out/common/BaseNode.js +45 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +17 -0
- package/out/concepts/App__.js +54 -12
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +2 -2
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +8 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +21 -21
- package/out/concepts/BindAttribute__.js +4 -3
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +3 -3
- package/out/concepts/BindDirective__.js +22 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +9 -8
- package/out/concepts/BindEvent__.js +17 -7
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +10 -5
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +11 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +1 -0
- package/out/concepts/CallLogic__.js +17 -7
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +0 -1
- package/out/concepts/CallQueryComponent__.js +5 -8
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Destination__.js +10 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +3 -0
- package/out/concepts/EntityProperty__.js +38 -0
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +34 -31
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +8 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +4 -4
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +13 -7
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -0
- package/out/concepts/InterfaceParam__.js +10 -0
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +3 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -0
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -0
- package/out/concepts/Logic__.js +16 -11
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Module__.js +8 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js +12 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -0
- package/out/concepts/Param__.js +3 -0
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +2 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +5 -5
- 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 +4 -4
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -0
- package/out/concepts/Return__.js +6 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +2 -2
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +3 -6
- package/out/concepts/StructureProperty__.js +38 -32
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +3 -3
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +3 -3
- 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/TypeAnnotation__.js +10 -2
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +1 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +27 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -0
- package/out/concepts/Variable__.js +6 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +5 -5
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +63 -60
- package/out/concepts/ViewElement__.js +123 -88
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +26 -10
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +3 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
- package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.util.js +0 -29
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +98 -72
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +15 -1
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/getLogics.js +27 -45
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +3 -3
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/getProcesses.js +2 -2
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.d.ts +1 -3
- package/out/server/naslServer.js +73 -57
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.d.ts +0 -3
- package/out/server/translator.js +16 -7
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -12
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +3 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -2
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +1 -0
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -5
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +3 -1
- package/out/templator/utils.js +2 -1
- package/out/templator/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/automate/engine/index.js +1 -1
- package/src/common/BaseNode.ts +46 -42
- package/src/concepts/App__.ts +54 -12
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/BinaryExpression__.ts +8 -6
- package/src/concepts/BindAttribute__.ts +26 -32
- package/src/concepts/BindDirective__.ts +24 -9
- package/src/concepts/BindEvent__.ts +25 -29
- package/src/concepts/CallFunction__.ts +11 -6
- package/src/concepts/CallInterface__.ts +11 -1
- package/src/concepts/CallLogic__.ts +21 -40
- package/src/concepts/CallQueryComponent__.ts +6 -10
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/ConfigGroup__.ts +1 -1
- package/src/concepts/ConfigProperty__.ts +1 -1
- package/src/concepts/Configuration__.ts +1 -1
- package/src/concepts/Destination__.ts +9 -7
- package/src/concepts/EntityProperty__.ts +36 -0
- package/src/concepts/Entity__.ts +63 -50
- package/src/concepts/Enum__.ts +1 -1
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +4 -4
- package/src/concepts/Identifier__.ts +15 -18
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +11 -0
- package/src/concepts/Interface__.ts +3 -3
- package/src/concepts/LogicItem__.ts +15 -0
- package/src/concepts/Logic__.ts +34 -50
- package/src/concepts/Module__.ts +8 -8
- package/src/concepts/Namespace__.ts +12 -12
- package/src/concepts/Param__.ts +3 -0
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +5 -5
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +4 -4
- package/src/concepts/QueryFromExpression__.ts +1 -1
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +1 -1
- package/src/concepts/Return__.ts +6 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +36 -29
- package/src/concepts/Structure__.ts +3 -3
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +8 -2
- package/src/concepts/UnaryExpression__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +6 -3
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +183 -147
- package/src/concepts/View__.ts +30 -32
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/genBundleFiles.ts +102 -74
- package/src/server/createUiTs.ts +18 -3
- package/src/server/getLogics.ts +29 -47
- package/src/server/getMemberIdentifier.ts +3 -3
- package/src/server/getProcesses.ts +2 -2
- package/src/server/naslServer.ts +84 -62
- package/src/server/translator.ts +18 -6
- package/src/service/storage/init.ts +20 -13
- package/src/templator/genCreateBlock.ts +3 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genUpdateBlock.ts +5 -6
- package/src/templator/utils.ts +2 -1
package/src/concepts/App__.ts
CHANGED
|
@@ -85,6 +85,18 @@ export class App extends BaseNode {
|
|
|
85
85
|
@property()
|
|
86
86
|
scope: 'pc' | 'h5' = undefined;
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* 制品应用标题
|
|
90
|
+
*/
|
|
91
|
+
@property()
|
|
92
|
+
documentTitle: string = undefined;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 制品应用图标
|
|
96
|
+
*/
|
|
97
|
+
@property()
|
|
98
|
+
documentIcon: string = undefined;
|
|
99
|
+
|
|
88
100
|
/**
|
|
89
101
|
* 是否有用户中心
|
|
90
102
|
*/
|
|
@@ -199,6 +211,29 @@ export class App extends BaseNode {
|
|
|
199
211
|
}
|
|
200
212
|
return params;
|
|
201
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* 设置制品应用标题
|
|
216
|
+
*/
|
|
217
|
+
setDocumentTitle(documentTitle: string) {
|
|
218
|
+
const object = {
|
|
219
|
+
documentTitle,
|
|
220
|
+
};
|
|
221
|
+
this.update({
|
|
222
|
+
...object,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* 设置制品应用图标
|
|
228
|
+
*/
|
|
229
|
+
setDocumentIcon(documentIcon: string) {
|
|
230
|
+
const object = {
|
|
231
|
+
documentIcon,
|
|
232
|
+
};
|
|
233
|
+
this.update({
|
|
234
|
+
...object,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
202
237
|
|
|
203
238
|
getEntityExistingNames(excludedList: Array<Entity> = []) {
|
|
204
239
|
const excludedSet = new Set(excludedList);
|
|
@@ -244,7 +279,7 @@ export class App extends BaseNode {
|
|
|
244
279
|
name: options,
|
|
245
280
|
}, this, 'entities');
|
|
246
281
|
} else if (options instanceof Entity) {
|
|
247
|
-
options.
|
|
282
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
248
283
|
entity = options;
|
|
249
284
|
Object.assign(entity, relationOptions);
|
|
250
285
|
} else {
|
|
@@ -385,7 +420,7 @@ export class App extends BaseNode {
|
|
|
385
420
|
name: options,
|
|
386
421
|
}, this, 'structures');
|
|
387
422
|
} else if (options instanceof Structure) {
|
|
388
|
-
options.
|
|
423
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
389
424
|
structure = options;
|
|
390
425
|
Object.assign(structure, relationOptions);
|
|
391
426
|
} else {
|
|
@@ -526,7 +561,7 @@ export class App extends BaseNode {
|
|
|
526
561
|
name: options,
|
|
527
562
|
}, this, 'enums');
|
|
528
563
|
} else if (options instanceof Enum) {
|
|
529
|
-
options.
|
|
564
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
530
565
|
enumeration = options;
|
|
531
566
|
Object.assign(enumeration, relationOptions);
|
|
532
567
|
} else {
|
|
@@ -667,7 +702,7 @@ export class App extends BaseNode {
|
|
|
667
702
|
name: options,
|
|
668
703
|
}, this, 'logics');
|
|
669
704
|
} else if (options instanceof Logic) {
|
|
670
|
-
options.
|
|
705
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
671
706
|
logic = options;
|
|
672
707
|
Object.assign(logic, relationOptions);
|
|
673
708
|
} else {
|
|
@@ -808,7 +843,7 @@ export class App extends BaseNode {
|
|
|
808
843
|
name: options,
|
|
809
844
|
}, this, 'interfaces');
|
|
810
845
|
} else if (options instanceof Interface) {
|
|
811
|
-
options.
|
|
846
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
812
847
|
itface = options;
|
|
813
848
|
Object.assign(itface, relationOptions);
|
|
814
849
|
} else {
|
|
@@ -949,7 +984,7 @@ export class App extends BaseNode {
|
|
|
949
984
|
name: options,
|
|
950
985
|
}, this, 'views');
|
|
951
986
|
} else if (options instanceof View) {
|
|
952
|
-
options.
|
|
987
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
953
988
|
view = options;
|
|
954
989
|
Object.assign(view, relationOptions);
|
|
955
990
|
} else {
|
|
@@ -1090,7 +1125,7 @@ export class App extends BaseNode {
|
|
|
1090
1125
|
name: options,
|
|
1091
1126
|
}, this, 'processes');
|
|
1092
1127
|
} else if (options instanceof Process) {
|
|
1093
|
-
options.
|
|
1128
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1094
1129
|
process = options;
|
|
1095
1130
|
Object.assign(process, relationOptions);
|
|
1096
1131
|
} else {
|
|
@@ -1231,7 +1266,7 @@ export class App extends BaseNode {
|
|
|
1231
1266
|
name: options,
|
|
1232
1267
|
}, this, 'roles');
|
|
1233
1268
|
} else if (options instanceof Role) {
|
|
1234
|
-
options.
|
|
1269
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1235
1270
|
role = options;
|
|
1236
1271
|
Object.assign(role, relationOptions);
|
|
1237
1272
|
} else {
|
|
@@ -1372,7 +1407,7 @@ export class App extends BaseNode {
|
|
|
1372
1407
|
name: options,
|
|
1373
1408
|
}, this, 'dependencies');
|
|
1374
1409
|
} else if (options instanceof Module) {
|
|
1375
|
-
options.
|
|
1410
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1376
1411
|
module = options;
|
|
1377
1412
|
Object.assign(module, relationOptions);
|
|
1378
1413
|
} else {
|
|
@@ -1505,7 +1540,7 @@ export class App extends BaseNode {
|
|
|
1505
1540
|
name: options,
|
|
1506
1541
|
}, this, 'interfaceDependencies');
|
|
1507
1542
|
} else if (options instanceof Module) {
|
|
1508
|
-
options.
|
|
1543
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1509
1544
|
module = options;
|
|
1510
1545
|
Object.assign(module, relationOptions);
|
|
1511
1546
|
} else {
|
|
@@ -1638,7 +1673,7 @@ export class App extends BaseNode {
|
|
|
1638
1673
|
name: options,
|
|
1639
1674
|
}, this, 'componentDependencies');
|
|
1640
1675
|
} else if (options instanceof Module) {
|
|
1641
|
-
options.
|
|
1676
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1642
1677
|
module = options;
|
|
1643
1678
|
Object.assign(module, relationOptions);
|
|
1644
1679
|
} else {
|
|
@@ -2438,6 +2473,13 @@ export class App extends BaseNode {
|
|
|
2438
2473
|
return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
|
|
2439
2474
|
}
|
|
2440
2475
|
|
|
2476
|
+
findViewByName(name: string): View {
|
|
2477
|
+
return utils.traverse((current) => {
|
|
2478
|
+
if (current.node.name === name)
|
|
2479
|
+
return current.node;
|
|
2480
|
+
}, { node: { name: '', children: this.views } });
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2441
2483
|
loadEnvList() {
|
|
2442
2484
|
this.envList = ['dev', 'online'];
|
|
2443
2485
|
}
|
|
@@ -2483,7 +2525,7 @@ export class App extends BaseNode {
|
|
|
2483
2525
|
|
|
2484
2526
|
scope === 'h5' ? `${prefix}/packages/@lcap/mobile-ui@${packageInfo.ui.version}/dist-theme/index.js` : `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.js`,
|
|
2485
2527
|
|
|
2486
|
-
scope === 'h5' ? `${prefix}/packages/@lcap/mobile-template
|
|
2528
|
+
scope === 'h5' ? `${prefix}/packages/@lcap/mobile-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js` : `${prefix}/packages/lcap-pc-template@${packageInfo.template.version}/cloudAdminDesigner.umd.min.js`,
|
|
2487
2529
|
],
|
|
2488
2530
|
css: [
|
|
2489
2531
|
scope === 'h5' ? `${prefix}/packages/@lcap/mobile-ui@${packageInfo.ui.version}/dist-theme/index.css` : `${prefix}/packages/cloud-ui.vusion@${packageInfo.ui.version}/dist-theme/index.css`,
|
|
@@ -12,6 +12,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
12
12
|
import BaseNode from '../common/BaseNode';
|
|
13
13
|
import classMap from '../common/classMap';
|
|
14
14
|
import LogicItem from './LogicItem__';
|
|
15
|
+
import StringLiteral from './StringLiteral__';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* 实际参数
|
|
@@ -189,13 +190,13 @@ export class Argument extends LogicItem {
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
@withSourceMap()
|
|
192
|
-
toEmbeddedTS(state?: TranslatorState, isRequired
|
|
193
|
+
toEmbeddedTS(state?: TranslatorState, isRequired: boolean = true, isHaveKeyWord?: boolean): string {
|
|
193
194
|
let code = this.spread ? '...' : '';
|
|
194
195
|
if (isHaveKeyWord) {
|
|
195
196
|
code += `${this.tsKeyword}:`;
|
|
196
197
|
}
|
|
197
198
|
if (this.expression) {
|
|
198
|
-
code += this.expression.toEmbeddedTS(shiftState(state, code));
|
|
199
|
+
code += (this.expression as StringLiteral).toEmbeddedTS(shiftState(state, code), isRequired);
|
|
199
200
|
} else {
|
|
200
201
|
code += isRequired ? '__IDENTIFIER__' : 'undefined';
|
|
201
202
|
}
|
|
@@ -188,9 +188,9 @@ export class BinaryExpression extends LogicItem {
|
|
|
188
188
|
return code;
|
|
189
189
|
}
|
|
190
190
|
let code = '';
|
|
191
|
-
code +=
|
|
191
|
+
code += '(' + (this.left?.toVue() || '') + ')';
|
|
192
192
|
code += ` ${this.operator} `;
|
|
193
|
-
code +=
|
|
193
|
+
code += '(' + (this.right?.toVue() || '') + ')';
|
|
194
194
|
return code;
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -206,12 +206,14 @@ export class BinaryExpression extends LogicItem {
|
|
|
206
206
|
code += '.' + fnName + '(';
|
|
207
207
|
code += this.right?.toUI ? this.right.toUI(shiftState(state, code, { inline: true })) : '';
|
|
208
208
|
code += ')';
|
|
209
|
+
console.log(code);
|
|
209
210
|
return code;
|
|
210
211
|
}
|
|
211
212
|
let code = '';
|
|
212
|
-
code +=
|
|
213
|
+
code += '(' + (this.left?.toUI(shiftState(state, code, { inline: true })) || '') + ')';
|
|
213
214
|
code += ` ${this.operator} `;
|
|
214
|
-
code +=
|
|
215
|
+
code += '(' + (this.right?.toUI(shiftState(state, code, { inline: true })) || '') + ')';
|
|
216
|
+
console.log(code);
|
|
215
217
|
return code;
|
|
216
218
|
}
|
|
217
219
|
|
|
@@ -230,9 +232,9 @@ export class BinaryExpression extends LogicItem {
|
|
|
230
232
|
return code;
|
|
231
233
|
}
|
|
232
234
|
let code = '';
|
|
233
|
-
code += '(' + this.left?.toJS
|
|
235
|
+
code += '(' + (this.left?.toJS(shiftState(state, code, { inline: true })) || '') + ')';
|
|
234
236
|
code += ` ${this.operator} `;
|
|
235
|
-
code += '(' + this.right?.toJS
|
|
237
|
+
code += '(' + (this.right?.toJS(shiftState(state, code, { inline: true })) || '') + ')';
|
|
236
238
|
return code;
|
|
237
239
|
}
|
|
238
240
|
|
|
@@ -196,7 +196,7 @@ export class BindAttribute extends BaseNode {
|
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
getValidationRuleExistingNames(excludedList: Array<ValidationRule> = []) {
|
|
200
200
|
const excludedSet = new Set(excludedList);
|
|
201
201
|
return (this.rules || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
202
202
|
}
|
|
@@ -205,24 +205,24 @@ export class BindAttribute extends BaseNode {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
* 插入验证规则
|
|
209
|
+
* @internal
|
|
210
|
+
* @param name 验证规则名称,如果不填会自动生成一个唯一名称
|
|
211
|
+
*/
|
|
212
212
|
_insertValidationRuleAt(name: string, index: number): ValidationRule;
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
* 插入验证规则
|
|
216
|
+
* @internal
|
|
217
|
+
* @param validationRuleOptions 验证规则参数
|
|
218
|
+
*/
|
|
219
219
|
_insertValidationRuleAt(validationRuleOptions: Partial<ValidationRule>, index: number): ValidationRule;
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
* 插入验证规则
|
|
223
|
+
* @internal
|
|
224
|
+
* @param validationRule 已有的验证规则实例
|
|
225
|
+
*/
|
|
226
226
|
_insertValidationRuleAt(validationRule: ValidationRule, index: number): ValidationRule;
|
|
227
227
|
|
|
228
228
|
_insertValidationRuleAt(options: string | Partial<ValidationRule> | ValidationRule, index: number) {
|
|
@@ -240,7 +240,7 @@ export class BindAttribute extends BaseNode {
|
|
|
240
240
|
name: options,
|
|
241
241
|
}, this, 'rules');
|
|
242
242
|
} else if (options instanceof ValidationRule) {
|
|
243
|
-
options.
|
|
243
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
244
244
|
validationRule = options;
|
|
245
245
|
Object.assign(validationRule, relationOptions);
|
|
246
246
|
} else {
|
|
@@ -337,13 +337,10 @@ export class BindAttribute extends BaseNode {
|
|
|
337
337
|
return node;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
340
|
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
341
|
+
* 删除逻辑项
|
|
342
|
+
* @param name 逻辑项名称
|
|
343
|
+
*/
|
|
347
344
|
removeExpression(name: string): void;
|
|
348
345
|
|
|
349
346
|
/**
|
|
@@ -365,12 +362,10 @@ export class BindAttribute extends BaseNode {
|
|
|
365
362
|
return expression.delete();
|
|
366
363
|
}
|
|
367
364
|
|
|
368
|
-
|
|
369
|
-
|
|
370
365
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
366
|
+
* 删除跳转页面
|
|
367
|
+
* @param name 跳转页面名称
|
|
368
|
+
*/
|
|
374
369
|
removeDestination(name: string): void;
|
|
375
370
|
|
|
376
371
|
/**
|
|
@@ -392,12 +387,10 @@ export class BindAttribute extends BaseNode {
|
|
|
392
387
|
return destination.delete();
|
|
393
388
|
}
|
|
394
389
|
|
|
395
|
-
|
|
396
|
-
|
|
397
390
|
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
391
|
+
* 删除验证规则
|
|
392
|
+
* @param name 验证规则名称
|
|
393
|
+
*/
|
|
401
394
|
removeValidationRuleInRules(name: string): void;
|
|
402
395
|
|
|
403
396
|
/**
|
|
@@ -472,8 +465,9 @@ export class BindAttribute extends BaseNode {
|
|
|
472
465
|
value = value.replace(/"/g, "'");
|
|
473
466
|
}
|
|
474
467
|
if (this.name === 'destination' && this.type === 'dynamic') {
|
|
475
|
-
return this.destination.toVue(options);
|
|
468
|
+
return this.destination ? this.destination.toVue(options) : '';
|
|
476
469
|
} else if (this.name === 'rules' && this.rules) {
|
|
470
|
+
console.log('this.rules: ', this.rules);
|
|
477
471
|
const ruleStrs = this.rules.map((rule) => rule.toVue());
|
|
478
472
|
value = ruleStrs.join(' | ');
|
|
479
473
|
return value !== undefined && value !== null ? `${this.name}="${value}"` : '';
|
|
@@ -500,7 +494,7 @@ export class BindAttribute extends BaseNode {
|
|
|
500
494
|
//================================================================================
|
|
501
495
|
}
|
|
502
496
|
|
|
503
|
-
classMap
|
|
497
|
+
classMap.BindAttribute = BindAttribute;
|
|
504
498
|
export default BindAttribute;
|
|
505
499
|
//================================================================================
|
|
506
500
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -133,14 +133,10 @@ export class BindDirective extends BaseNode {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
136
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
* 删除逻辑项
|
|
138
|
+
* @param name 逻辑项名称
|
|
139
|
+
*/
|
|
144
140
|
removeExpression(name: string): void;
|
|
145
141
|
|
|
146
142
|
/**
|
|
@@ -223,7 +219,26 @@ export class BindDirective extends BaseNode {
|
|
|
223
219
|
value = value?.replace(/"/g, "'");
|
|
224
220
|
}
|
|
225
221
|
if (this.name === 'auth' && !!this.value) {
|
|
226
|
-
|
|
222
|
+
const regex = /(.\w+\[name=\w+\])/g;
|
|
223
|
+
const paths = this.element.nodePath.match(regex);
|
|
224
|
+
const regex1 = /\s*=(\w+)\]/;
|
|
225
|
+
let pathArr: string[] = [];
|
|
226
|
+
const isElement = paths.find((item) => {
|
|
227
|
+
if (item.startsWith('.elements')) {
|
|
228
|
+
return true;
|
|
229
|
+
} else {
|
|
230
|
+
pathArr.push(item);
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
if (isElement) {
|
|
235
|
+
pathArr = [...pathArr, ...paths.slice(-1)];
|
|
236
|
+
}
|
|
237
|
+
const _path = pathArr.reduce((str, item) => {
|
|
238
|
+
const c = item.match(regex1);
|
|
239
|
+
return str + '/' + c[1];
|
|
240
|
+
}, '');
|
|
241
|
+
value = `'${_path}'`;
|
|
227
242
|
}
|
|
228
243
|
return value !== '' && value !== undefined && value !== null ? `v-${this.name}${modifiersString}${this.arg ? ':' + this.arg : ''}="${value}"` : '';
|
|
229
244
|
}
|
|
@@ -234,7 +249,7 @@ export class BindDirective extends BaseNode {
|
|
|
234
249
|
//================================================================================
|
|
235
250
|
}
|
|
236
251
|
|
|
237
|
-
classMap
|
|
252
|
+
classMap.BindDirective = BindDirective;
|
|
238
253
|
export default BindDirective;
|
|
239
254
|
//================================================================================
|
|
240
255
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -142,22 +142,18 @@ export class BindEvent extends BaseNode {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
145
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
* 插入实际参数
|
|
147
|
+
* @internal
|
|
148
|
+
* @param argumentOptions 实际参数参数
|
|
149
|
+
*/
|
|
154
150
|
_insertArgumentAt(argumentOptions: Partial<Argument>, index: number): Argument;
|
|
155
151
|
|
|
156
152
|
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
* 插入实际参数
|
|
154
|
+
* @internal
|
|
155
|
+
* @param argument 已有的实际参数实例
|
|
156
|
+
*/
|
|
161
157
|
_insertArgumentAt(argument: Argument, index: number): Argument;
|
|
162
158
|
|
|
163
159
|
_insertArgumentAt(options: Partial<Argument> | Argument, index: number) {
|
|
@@ -165,7 +161,7 @@ export class BindEvent extends BaseNode {
|
|
|
165
161
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
166
162
|
let argument: Argument;
|
|
167
163
|
if (options instanceof Argument) {
|
|
168
|
-
options.
|
|
164
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
169
165
|
argument = options;
|
|
170
166
|
Object.assign(argument, relationOptions);
|
|
171
167
|
} else {
|
|
@@ -178,8 +174,6 @@ export class BindEvent extends BaseNode {
|
|
|
178
174
|
return argument;
|
|
179
175
|
}
|
|
180
176
|
|
|
181
|
-
|
|
182
|
-
|
|
183
177
|
/**
|
|
184
178
|
* 插入实际参数
|
|
185
179
|
* @param argumentOptions 实际参数参数
|
|
@@ -202,8 +196,6 @@ export class BindEvent extends BaseNode {
|
|
|
202
196
|
return node;
|
|
203
197
|
}
|
|
204
198
|
|
|
205
|
-
|
|
206
|
-
|
|
207
199
|
/**
|
|
208
200
|
* 添加实际参数
|
|
209
201
|
* @internal
|
|
@@ -223,8 +215,6 @@ export class BindEvent extends BaseNode {
|
|
|
223
215
|
return this._insertArgumentAt(options as any, index);
|
|
224
216
|
}
|
|
225
217
|
|
|
226
|
-
|
|
227
|
-
|
|
228
218
|
/**
|
|
229
219
|
* 添加实际参数
|
|
230
220
|
* @param argumentOptions 实际参数参数
|
|
@@ -248,9 +238,6 @@ export class BindEvent extends BaseNode {
|
|
|
248
238
|
return node;
|
|
249
239
|
}
|
|
250
240
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
241
|
/**
|
|
255
242
|
* 删除实际参数
|
|
256
243
|
* @param argument 已有的实际参数实例
|
|
@@ -258,7 +245,7 @@ export class BindEvent extends BaseNode {
|
|
|
258
245
|
removeArgument(argument: Argument): void;
|
|
259
246
|
|
|
260
247
|
removeArgument(options: Argument) {
|
|
261
|
-
|
|
248
|
+
const argument: Argument = options;
|
|
262
249
|
return argument.delete();
|
|
263
250
|
}
|
|
264
251
|
|
|
@@ -289,7 +276,10 @@ export class BindEvent extends BaseNode {
|
|
|
289
276
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
290
277
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
291
278
|
//================================================================================
|
|
292
|
-
|
|
279
|
+
// 用于logic回填
|
|
280
|
+
get calleewholeKey(): string {
|
|
281
|
+
return this.calleeNamespace + '.' + this.calleeName;
|
|
282
|
+
}
|
|
293
283
|
get tsCalleeNamespace() {
|
|
294
284
|
if (this.calleeNamespace) {
|
|
295
285
|
let tsCalleeNamespace = this.calleeNamespace;
|
|
@@ -326,7 +316,7 @@ export class BindEvent extends BaseNode {
|
|
|
326
316
|
return `${randerNameSpace}.${this.calleeName}`;
|
|
327
317
|
}
|
|
328
318
|
// 绑定事件转驼峰
|
|
329
|
-
toHump = (name: string) => name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '';
|
|
319
|
+
toHump = (name: string) => (name ? name.replace(/\-(\w)/g, (all, letter) => letter.toUpperCase()) : '');
|
|
330
320
|
|
|
331
321
|
@withSourceMap()
|
|
332
322
|
toEmbeddedTS(state?: TranslatorState, isPageCycle?: Boolean): string {
|
|
@@ -388,10 +378,16 @@ export class BindEvent extends BaseNode {
|
|
|
388
378
|
componentName = namespaceArr[0];
|
|
389
379
|
}
|
|
390
380
|
}
|
|
391
|
-
|
|
381
|
+
let callee = '';
|
|
382
|
+
if (isComponentLogic)
|
|
383
|
+
callee = `$refs.${componentName}.${this.calleeName}`;
|
|
384
|
+
else if (calleeNamespace?.startsWith('nasl.'))
|
|
385
|
+
callee = `$global.${this.calleeName}`;
|
|
386
|
+
else
|
|
387
|
+
callee = this.calleeName;
|
|
392
388
|
let code = '';
|
|
393
|
-
if (
|
|
394
|
-
code += `@${this.name}="${
|
|
389
|
+
if (callee) {
|
|
390
|
+
code += `@${this.name}="${callee}`;
|
|
395
391
|
if (Array.isArray(this.arguments) && this.arguments.length) {
|
|
396
392
|
code += '(';
|
|
397
393
|
this.arguments.forEach((arg, index) => {
|
|
@@ -413,7 +409,7 @@ export class BindEvent extends BaseNode {
|
|
|
413
409
|
//================================================================================
|
|
414
410
|
}
|
|
415
411
|
|
|
416
|
-
classMap
|
|
412
|
+
classMap.BindEvent = BindEvent;
|
|
417
413
|
export default BindEvent;
|
|
418
414
|
//================================================================================
|
|
419
415
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
@@ -105,7 +105,7 @@ export class CallFunction extends LogicItem {
|
|
|
105
105
|
const relationOptions = { parentNode: this, parentKey: 'typeArguments' };
|
|
106
106
|
let typeAnnotation: TypeAnnotation;
|
|
107
107
|
if (options instanceof TypeAnnotation) {
|
|
108
|
-
options.
|
|
108
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
109
109
|
typeAnnotation = options;
|
|
110
110
|
Object.assign(typeAnnotation, relationOptions);
|
|
111
111
|
} else {
|
|
@@ -212,7 +212,7 @@ export class CallFunction extends LogicItem {
|
|
|
212
212
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
213
213
|
let argument: Argument;
|
|
214
214
|
if (options instanceof Argument) {
|
|
215
|
-
options.
|
|
215
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
216
216
|
argument = options;
|
|
217
217
|
Object.assign(argument, relationOptions);
|
|
218
218
|
} else {
|
|
@@ -429,7 +429,7 @@ export class CallFunction extends LogicItem {
|
|
|
429
429
|
const argument = Argument.from({
|
|
430
430
|
keyword: param.name,
|
|
431
431
|
}, this);
|
|
432
|
-
if(param.defaultExpression instanceof Identifier) {
|
|
432
|
+
if (param.defaultExpression instanceof Identifier) {
|
|
433
433
|
argument.expression = BaseNode.from(param.defaultExpression, argument, 'expression') as Identifier;
|
|
434
434
|
}
|
|
435
435
|
Object.assign(argument, relationOptions);
|
|
@@ -470,12 +470,17 @@ export class CallFunction extends LogicItem {
|
|
|
470
470
|
code += ')';
|
|
471
471
|
// 如果有内容
|
|
472
472
|
const typeAnnotation = this.typeArguments[0];
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
473
|
+
code += `<`;
|
|
474
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>()`;
|
|
476
475
|
code += '\n';
|
|
477
476
|
} else {
|
|
478
477
|
code = this.calleeKey;
|
|
478
|
+
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
479
|
+
// 如果有内容
|
|
480
|
+
const typeAnnotation = this.typeArguments[0];
|
|
481
|
+
code += `<`;
|
|
482
|
+
code += `${typeAnnotation.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }))}>`;
|
|
483
|
+
}
|
|
479
484
|
code += '(';
|
|
480
485
|
this.arguments.forEach((arg, index) => {
|
|
481
486
|
code += arg.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
|
|
@@ -97,7 +97,7 @@ export class CallInterface extends LogicItem {
|
|
|
97
97
|
const relationOptions = { parentNode: this, parentKey: 'arguments' };
|
|
98
98
|
let argument: Argument;
|
|
99
99
|
if (options instanceof Argument) {
|
|
100
|
-
options.
|
|
100
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
101
101
|
argument = options;
|
|
102
102
|
Object.assign(argument, relationOptions);
|
|
103
103
|
} else {
|
|
@@ -317,6 +317,16 @@ export class CallInterface extends LogicItem {
|
|
|
317
317
|
const _interface = _module?.interfaces?.find((item) => item.name === _keys[3]);
|
|
318
318
|
if (_interface) {
|
|
319
319
|
params = _interface.params.filter((item) => item.required).map((item) => item.name) || [];
|
|
320
|
+
const _bodyParams = _interface.params.find((item) => item.name === 'Body');
|
|
321
|
+
if (_bodyParams) {
|
|
322
|
+
const _typeKey = _bodyParams.typeAnnotation.typeKey;
|
|
323
|
+
const _list = _typeKey.split('.');
|
|
324
|
+
const _structure = _module.structures.find((item) => item.name === _list[3]);
|
|
325
|
+
const isBodyRequired = _structure.properties.some((item) => item.required === true);
|
|
326
|
+
if (isBodyRequired) {
|
|
327
|
+
params.push('Body');
|
|
328
|
+
}
|
|
329
|
+
}
|
|
320
330
|
}
|
|
321
331
|
code += '({';
|
|
322
332
|
this.arguments.forEach((arg, index) => {
|