@lcap/nasl 2.18.0 → 2.20.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/index.js +3 -3
- package/out/automate/engine/index.js.map +1 -1
- package/out/bak/translator.js +85 -37
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +6 -10
- package/out/common/BaseNode.js +7 -52
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +0 -10
- package/out/concepts/App__.js +0 -74
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +5 -5
- package/out/concepts/AssignmentLine__.js +6 -6
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +2 -1
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +60 -60
- package/out/concepts/BatchAssignment__.js +11 -21
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +0 -19
- package/out/concepts/BindAttribute__.js +2 -39
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +2 -2
- package/out/concepts/BindStyle__.js +3 -3
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +8 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +25 -58
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +0 -7
- package/out/concepts/CallInterface__.js +7 -53
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +14 -63
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -13
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +0 -3
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +0 -6
- package/out/concepts/DataSource__.js +0 -41
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +1 -9
- package/out/concepts/Destination__.js +29 -61
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +8 -21
- package/out/concepts/EntityProperty__.js +23 -109
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +0 -32
- package/out/concepts/Entity__.js +2 -117
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +4 -0
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +4 -0
- package/out/concepts/ForEachStatement__.js +8 -4
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +4 -16
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +0 -8
- package/out/concepts/IfStatement__.js +0 -22
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -6
- package/out/concepts/Logic__.js +43 -144
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +1 -1
- package/out/concepts/MatchCase__.js +8 -15
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +19 -21
- package/out/concepts/Match__.js +25 -112
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -4
- package/out/concepts/MemberExpression__.js +15 -30
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +3 -7
- package/out/concepts/OqlQueryComponent__.js +95 -56
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +1 -1
- package/out/concepts/Param__.js +4 -40
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +3 -3
- package/out/concepts/QueryOrderByExpression__.js +3 -3
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.js +2 -38
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +1 -1
- package/out/concepts/SelectMembers__.js +2 -2
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +4 -2
- package/out/concepts/SqlQueryComponent__.js +88 -9
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +7 -0
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +0 -1
- package/out/concepts/TypeAnnotation__.js +12 -25
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +0 -1
- package/out/concepts/TypeParam__.js +0 -2
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +9 -6
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +23 -88
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -38
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +29 -30
- package/out/concepts/ViewElement__.js +51 -117
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +3 -4
- package/out/concepts/View__.js +83 -93
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +1 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +0 -50
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +4 -36
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +43 -63
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -2
- package/out/concepts/index__.js +0 -2
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +2 -5
- package/out/generator/genBundleFiles.js +45 -148
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/index.d.ts +0 -1
- package/out/generator/index.js +0 -1
- package/out/generator/index.js.map +1 -1
- package/out/index.d.ts +2 -3
- package/out/index.js +1 -5
- package/out/index.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +11 -11
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +17 -10
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +6 -13
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +7 -7
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +1 -1
- package/out/server/index.d.ts +1 -0
- package/out/server/index.js +27 -2
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +7 -47
- package/out/server/naslServer.js +393 -591
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +28 -30
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/translator.js +7 -40
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +3 -33
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +4 -6
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +4 -7
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +5 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +2 -5
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +2 -2
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +2 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -2
- package/out/templator/genQueryComponent.js +1 -4
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genTableBlock.js +2 -2
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +3 -4
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js +1 -1
- package/out/templator/utils.js.map +1 -1
- package/out/test/integration/node-nasl-server.js +38 -10
- package/out/test/integration/node-nasl-server.js.map +1 -1
- package/out/translator/index.d.ts +0 -1
- package/out/translator/index.js +1 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +0 -1
- package/out/utils/index.js +1 -38
- package/out/utils/index.js.map +1 -1
- package/out/utils/string.d.ts +2 -15
- package/out/utils/string.js +3 -18
- package/out/utils/string.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.auth.ts +1 -1
- package/sandbox/stdlib/nasl.core.ts +1 -0
- package/sandbox/stdlib/nasl.logging.ts +4 -4
- package/sandbox/stdlib/nasl.util.ts +9 -5
- package/src/automate/engine/index.js +4 -4
- package/src/automate/engine/uniqueName.js +3 -3
- package/src/automate/template/myProcess.js +1 -1
- package/src/automate/upgrader/2.20.js +41 -0
- package/src/bak/translator.js +4 -1
- package/src/common/BaseNode.ts +1 -0
- package/src/concepts/AnonymousFunction__.ts +48 -2
- package/src/concepts/App__.ts +288 -615
- package/src/concepts/BatchAssignment__.ts +111 -51
- package/src/concepts/BindAttribute__.ts +18 -25
- package/src/concepts/BindDirective__.ts +7 -0
- package/src/concepts/BindEvent__.ts +7 -0
- package/src/concepts/BindStyle__.ts +7 -0
- package/src/concepts/CallFunction__.ts +34 -45
- package/src/concepts/CallInterface__.ts +2 -1
- package/src/concepts/CallLogic__.ts +87 -55
- package/src/concepts/CallQueryComponent__.ts +4 -1
- package/src/concepts/Constant__.ts +7 -0
- package/src/concepts/DataSource__.ts +57 -5
- package/src/concepts/Destination__.ts +100 -43
- package/src/concepts/Frontend__.ts +937 -0
- package/src/concepts/Identifier__.ts +18 -16
- package/src/concepts/LogicItem__.ts +8 -1
- package/src/concepts/Logic__.ts +134 -149
- package/src/concepts/Match__.ts +13 -29
- package/src/concepts/NewComposite__.ts +1357 -0
- package/src/concepts/NewList__.ts +440 -0
- package/src/concepts/NewMap__.ts +666 -0
- package/src/concepts/New__.ts +73 -0
- package/src/concepts/Param__.ts +245 -199
- package/src/concepts/ProcessElement__.ts +43 -36
- package/src/concepts/ProcessOutcomes__.ts +90 -0
- package/src/concepts/Process__.ts +1 -23
- package/src/concepts/Return__.ts +11 -1
- package/src/concepts/SelectMembers__.ts +3 -3
- package/src/concepts/Transactional__.ts +7 -0
- package/src/concepts/TypeAnnotation__.ts +54 -49
- package/src/concepts/ValidationRule__.ts +19 -1
- package/src/concepts/Variable__.ts +12 -6
- package/src/concepts/ViewElement__.ts +26 -3
- package/src/concepts/View__.ts +25 -25
- package/src/concepts/basics/stdlib/nasl.auth.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.logging.ts +5 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +2 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +153 -19
- package/src/concepts/index__.ts +7 -0
- package/src/enums/KEYWORDS.ts +9 -0
- package/src/generator/genBundleFiles.ts +74 -245
- package/src/generator/genMetaData.ts +178 -78
- package/src/generator/genReleaseBody.ts +87 -44
- package/src/generator/index.ts +1 -0
- package/src/generator/permission.ts +261 -0
- package/src/index.ts +1 -1
- package/src/server/entity2LogicNamespace.ts +90 -10
- package/src/server/extendBaseNode.ts +33 -22
- package/src/server/formatTsUtils.ts +36 -46
- package/src/server/getLogics.ts +13 -1
- package/src/server/getMemberIdentifier.ts +5 -5
- package/src/server/getProcesses.ts +1 -1
- package/src/server/naslServer.ts +254 -71
- package/src/server/process2LogicNamespace.ts +8 -0
- package/src/server/translator.ts +51 -5
- package/src/service/creator/add.configs.js +4 -0
- package/src/service/datasource/api.js +11 -0
- package/src/service/datasource/index.js +6 -0
- package/src/service/storage/init.ts +12 -0
- package/src/service/video/VideoTranscribe.js +1 -0
- package/src/templator/genEditTableBlock.ts +8 -16
- package/src/templator/genGetBlock.ts +18 -19
- package/src/templator/genGridViewBlock.ts +18 -18
- package/src/templator/genListViewBlock.ts +8 -11
- package/src/templator/genTableBlock.ts +6 -10
- package/ts-worker/lib/tsserver.js +8 -1
- package/out/automate/engine/2.14-components.d.ts +0 -1115
- package/out/automate/engine/2.14-components.js +0 -1087
- package/out/automate/engine/2.14-components.js.map +0 -1
- package/out/concepts/ExternalDestination__.d.ts +0 -73
- package/out/concepts/ExternalDestination__.js +0 -264
- package/out/concepts/ExternalDestination__.js.map +0 -1
- package/out/concepts/MatchExpression__.d.ts +0 -97
- package/out/concepts/MatchExpression__.js +0 -281
- package/out/concepts/MatchExpression__.js.map +0 -1
- package/out/concepts/StringInterpolation__.d.ts +0 -113
- package/out/concepts/StringInterpolation__.js +0 -227
- package/out/concepts/StringInterpolation__.js.map +0 -1
- package/out/generator/genReleaseBody.d.ts +0 -41
- package/out/generator/genReleaseBody.js +0 -340
- package/out/generator/genReleaseBody.js.map +0 -1
- package/out/service/defaultErrorMessage.json +0 -97
- package/out/service/logic/api.d.ts +0 -9
- package/out/service/logic/api.js +0 -11
- package/out/service/logic/api.js.map +0 -1
- package/out/service/logic/index.d.ts +0 -2
- package/out/service/logic/index.js +0 -10
- package/out/service/logic/index.js.map +0 -1
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/Anchor__.js +0 -179
- package/src/concepts/dist/Assignment__.js +0 -301
- package/src/concepts/dist/CallFunction__.js +0 -473
- package/src/concepts/dist/CallInterface__.js +0 -533
- package/src/concepts/dist/CallLogic__.js +0 -864
- package/src/concepts/dist/ForEachStatement__.js +0 -426
- package/src/concepts/dist/MatchCase__.js +0 -587
- package/src/concepts/dist/MemberExpression__.js +0 -348
- package/src/concepts/dist/Param__.js +0 -537
- package/src/concepts/dist/Return__.js +0 -493
- package/src/generator/dist/genBundleFiles.js +0 -414
- package/src/server/dist/formatTsUtils.js +0 -683
- package/src/server/dist/naslServer.js +0 -3396
- package/src/service/storage/dist/init.js +0 -541
- package/ts-worker/dist/webpack.config.dev.js +0 -104
- package/ts-worker/lib/dist/tsserver.dev.js +0 -22953
- package/ts-worker/sources/lib/dist/tsserver.dev.js +0 -22912
|
@@ -121,8 +121,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
121
121
|
@property()
|
|
122
122
|
ruleMap: Object = undefined;
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
124
|
/**
|
|
127
125
|
* @param source 需要合并的部分参数
|
|
128
126
|
*/
|
|
@@ -159,10 +157,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
159
157
|
});
|
|
160
158
|
}
|
|
161
159
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
160
|
/**
|
|
167
161
|
* 插入类型标注
|
|
168
162
|
* @internal
|
|
@@ -195,8 +189,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
195
189
|
return typeAnnotation;
|
|
196
190
|
}
|
|
197
191
|
|
|
198
|
-
|
|
199
|
-
|
|
200
192
|
/**
|
|
201
193
|
* 插入类型标注
|
|
202
194
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -219,8 +211,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
219
211
|
return node;
|
|
220
212
|
}
|
|
221
213
|
|
|
222
|
-
|
|
223
|
-
|
|
224
214
|
/**
|
|
225
215
|
* 添加类型标注
|
|
226
216
|
* @internal
|
|
@@ -240,8 +230,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
240
230
|
return this._insertTypeAnnotationInTypeArgumentsAt(options as any, index);
|
|
241
231
|
}
|
|
242
232
|
|
|
243
|
-
|
|
244
|
-
|
|
245
233
|
/**
|
|
246
234
|
* 添加类型标注
|
|
247
235
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -265,8 +253,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
265
253
|
return node;
|
|
266
254
|
}
|
|
267
255
|
|
|
268
|
-
|
|
269
|
-
|
|
270
256
|
/**
|
|
271
257
|
* 插入类型标注
|
|
272
258
|
* @internal
|
|
@@ -299,8 +285,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
299
285
|
return typeAnnotation;
|
|
300
286
|
}
|
|
301
287
|
|
|
302
|
-
|
|
303
|
-
|
|
304
288
|
/**
|
|
305
289
|
* 插入类型标注
|
|
306
290
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -323,8 +307,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
323
307
|
return node;
|
|
324
308
|
}
|
|
325
309
|
|
|
326
|
-
|
|
327
|
-
|
|
328
310
|
/**
|
|
329
311
|
* 添加类型标注
|
|
330
312
|
* @internal
|
|
@@ -344,8 +326,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
344
326
|
return this._insertTypeAnnotationInReturnTypeAt(options as any, index);
|
|
345
327
|
}
|
|
346
328
|
|
|
347
|
-
|
|
348
|
-
|
|
349
329
|
/**
|
|
350
330
|
* 添加类型标注
|
|
351
331
|
* @param typeAnnotationOptions 类型标注参数
|
|
@@ -369,11 +349,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
369
349
|
return node;
|
|
370
350
|
}
|
|
371
351
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
352
|
/**
|
|
378
353
|
* 插入数据结构属性
|
|
379
354
|
* @internal
|
|
@@ -406,8 +381,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
406
381
|
return structureProperty;
|
|
407
382
|
}
|
|
408
383
|
|
|
409
|
-
|
|
410
|
-
|
|
411
384
|
/**
|
|
412
385
|
* 插入数据结构属性
|
|
413
386
|
* @param structurePropertyOptions 数据结构属性参数
|
|
@@ -430,8 +403,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
430
403
|
return node;
|
|
431
404
|
}
|
|
432
405
|
|
|
433
|
-
|
|
434
|
-
|
|
435
406
|
/**
|
|
436
407
|
* 添加数据结构属性
|
|
437
408
|
* @internal
|
|
@@ -451,8 +422,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
451
422
|
return this._insertStructurePropertyAt(options as any, index);
|
|
452
423
|
}
|
|
453
424
|
|
|
454
|
-
|
|
455
|
-
|
|
456
425
|
/**
|
|
457
426
|
* 添加数据结构属性
|
|
458
427
|
* @param structurePropertyOptions 数据结构属性参数
|
|
@@ -476,9 +445,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
476
445
|
return node;
|
|
477
446
|
}
|
|
478
447
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
448
|
/**
|
|
483
449
|
* 删除类型标注
|
|
484
450
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -486,12 +452,10 @@ export class TypeAnnotation extends BaseNode {
|
|
|
486
452
|
removeTypeAnnotationInTypeArguments(typeAnnotation: TypeAnnotation): void;
|
|
487
453
|
|
|
488
454
|
removeTypeAnnotationInTypeArguments(options: TypeAnnotation) {
|
|
489
|
-
|
|
455
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
490
456
|
return typeAnnotation.delete();
|
|
491
457
|
}
|
|
492
458
|
|
|
493
|
-
|
|
494
|
-
|
|
495
459
|
/**
|
|
496
460
|
* 删除类型标注
|
|
497
461
|
* @param typeAnnotation 已有的类型标注实例
|
|
@@ -499,7 +463,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
499
463
|
removeTypeAnnotationInReturnType(typeAnnotation: TypeAnnotation): void;
|
|
500
464
|
|
|
501
465
|
removeTypeAnnotationInReturnType(options: TypeAnnotation) {
|
|
502
|
-
|
|
466
|
+
const typeAnnotation: TypeAnnotation = options;
|
|
503
467
|
return typeAnnotation.delete();
|
|
504
468
|
}
|
|
505
469
|
|
|
@@ -526,8 +490,6 @@ export class TypeAnnotation extends BaseNode {
|
|
|
526
490
|
return params;
|
|
527
491
|
}
|
|
528
492
|
|
|
529
|
-
|
|
530
|
-
|
|
531
493
|
/**
|
|
532
494
|
* 删除数据结构属性
|
|
533
495
|
* @param structureProperty 已有的数据结构属性实例
|
|
@@ -535,7 +497,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
535
497
|
removeStructureProperty(structureProperty: StructureProperty): void;
|
|
536
498
|
|
|
537
499
|
removeStructureProperty(options: StructureProperty) {
|
|
538
|
-
|
|
500
|
+
const structureProperty: StructureProperty = options;
|
|
539
501
|
return structureProperty.delete();
|
|
540
502
|
}
|
|
541
503
|
|
|
@@ -571,6 +533,24 @@ export class TypeAnnotation extends BaseNode {
|
|
|
571
533
|
return this.headTitle;
|
|
572
534
|
}
|
|
573
535
|
|
|
536
|
+
traverse(callback: (arg: TypeAnnotation) => void,
|
|
537
|
+
enter: (arg: TypeAnnotation) => void,
|
|
538
|
+
leave: (arg: TypeAnnotation) => void,
|
|
539
|
+
onJoin: (arg: TypeAnnotation, arg2: TypeAnnotation) => void) {
|
|
540
|
+
enter(this);
|
|
541
|
+
callback(this);
|
|
542
|
+
if (this.typeArguments && ['generic', 'union'].includes(this.typeKind)) {
|
|
543
|
+
const l = this.typeArguments.length;
|
|
544
|
+
this.typeArguments.forEach((arg, idx) => {
|
|
545
|
+
arg.traverse(callback, enter, leave, onJoin);
|
|
546
|
+
if (idx < l - 1) {
|
|
547
|
+
onJoin(this, arg);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
leave(this);
|
|
552
|
+
}
|
|
553
|
+
|
|
574
554
|
get typeKey(): string {
|
|
575
555
|
if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
|
|
576
556
|
return `${this.typeNamespace}.${this.typeName}`;
|
|
@@ -578,7 +558,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
578
558
|
return `${this.typeNamespace}.${this.typeName}<${(this.typeArguments || []).map((arg) => arg.typeKey)}>`;
|
|
579
559
|
} else if (this.typeKind === 'anonymousStructure') {
|
|
580
560
|
return `{ ${this.properties.map(({ name, typeAnnotation }) =>
|
|
581
|
-
(`${name}: ${typeAnnotation.typeKey}`)).join(', ')} }`;
|
|
561
|
+
(`${name}: ${typeAnnotation ? typeAnnotation.typeKey : 'any'}`)).join(', ')} }`;
|
|
582
562
|
} else if (this.typeKind === 'union') {
|
|
583
563
|
return `${this.typeArguments.map((arg) => arg.typeKey).join(' | ')}`;
|
|
584
564
|
} else {
|
|
@@ -591,7 +571,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
591
571
|
if (this.typeKind === 'anonymousStructure') {
|
|
592
572
|
// 按匿名数据结构的key排序
|
|
593
573
|
return `{${this.properties.sort(({ name: name1 }, { name: name2 }) => name1 > name2 ? 1 : -1).map(({ name, typeAnnotation }) =>
|
|
594
|
-
(`${name}: ${typeAnnotation.sortedTypeKey}`)).join(', ')}}`;
|
|
574
|
+
(`${name}: ${typeAnnotation ? typeAnnotation.sortedTypeKey : 'any'}`)).join(', ')}}`;
|
|
595
575
|
} else if (this.typeKind === 'union') {
|
|
596
576
|
// 按返回的每个具体项排序
|
|
597
577
|
return `${this.typeArguments.map((arg) => arg.sortedTypeKey).sort((name1, name2) => name1 > name2 ? 1 : -1).join(' | ')}`;
|
|
@@ -606,10 +586,12 @@ export class TypeAnnotation extends BaseNode {
|
|
|
606
586
|
const typeKey = typeArr.join('.');
|
|
607
587
|
if (this.typeKind === 'generic') {
|
|
608
588
|
let code = typeKey;
|
|
589
|
+
code += '<';
|
|
609
590
|
if (Array.isArray(this.typeArguments) && this.typeArguments.length) {
|
|
610
591
|
// 必须按typeArguments定义的顺序,否则实参位置不对
|
|
611
|
-
code +=
|
|
592
|
+
code += `${(this.typeArguments || []).map((arg) => arg.sortedTypeKey).join(', ')}`;
|
|
612
593
|
}
|
|
594
|
+
code += '>';
|
|
613
595
|
return code;
|
|
614
596
|
}
|
|
615
597
|
return typeKey;
|
|
@@ -661,7 +643,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
661
643
|
return `${this.typeName}<${this.typeArguments.map((arg) => arg.typeTitle || arg.name || 'T').join(', ')}>`;
|
|
662
644
|
} else if (this.typeKind === 'anonymousStructure') {
|
|
663
645
|
return `{ ${this.properties?.map(({ name, typeAnnotation }) =>
|
|
664
|
-
(`${name}: ${typeAnnotation.typeTitle}`)).join(', ')} }`;
|
|
646
|
+
(`${name}: ${typeAnnotation ? typeAnnotation.typeTitle : 'any'}`)).join(', ')} }`;
|
|
665
647
|
} else if (this.typeKind === 'union') {
|
|
666
648
|
return `${this.typeArguments.map((arg) => arg.typeTitle || arg.name).join(' 或 ')}`;
|
|
667
649
|
} else {
|
|
@@ -676,9 +658,9 @@ export class TypeAnnotation extends BaseNode {
|
|
|
676
658
|
const length = this.properties?.length;
|
|
677
659
|
this.properties?.forEach(({ name, typeAnnotation }, index) => {
|
|
678
660
|
if (index === length - 1) {
|
|
679
|
-
typeTitleList.push({ key: name, value: typeAnnotation.typeTitle });
|
|
661
|
+
typeTitleList.push({ key: name, value: `${typeAnnotation ? typeAnnotation.typeTitle : 'any'}` });
|
|
680
662
|
} else {
|
|
681
|
-
typeTitleList.push({ key: name, value: typeAnnotation.typeTitle
|
|
663
|
+
typeTitleList.push({ key: name, value: `${typeAnnotation ? typeAnnotation.typeTitle : 'any'}`, dot: ',' });
|
|
682
664
|
}
|
|
683
665
|
});
|
|
684
666
|
typeTitleList.push({ key: '}' });
|
|
@@ -797,7 +779,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
797
779
|
let code = `{ __name: "AStructure_${this.hash}", `;
|
|
798
780
|
(this.properties || []).forEach((property, i) => {
|
|
799
781
|
code += `${property.name}: `;
|
|
800
|
-
code += `${property.typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true, tabSize: (state?.tabSize || 0) + 1 }))}`;
|
|
782
|
+
code += `${property.typeAnnotation ? property.typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true, tabSize: (state?.tabSize || 0) + 1 })) : 'any'}`;
|
|
801
783
|
code += i < this.properties?.length - 1 ? ', ' : ' }';
|
|
802
784
|
});
|
|
803
785
|
return code;
|
|
@@ -824,7 +806,7 @@ export class TypeAnnotation extends BaseNode {
|
|
|
824
806
|
return 1;
|
|
825
807
|
return aName < bName ? -1 : 0;
|
|
826
808
|
}).map(({ name, typeAnnotation }) =>
|
|
827
|
-
(`${name}: ${typeAnnotation.anonymousStructureTypeDesc}`)).join(', ')} }`;
|
|
809
|
+
(`${name}: ${typeAnnotation ? typeAnnotation.anonymousStructureTypeDesc : 'any'}`)).join(', ')} }`;
|
|
828
810
|
} else {
|
|
829
811
|
return this.typeName;
|
|
830
812
|
}
|
|
@@ -907,6 +889,29 @@ export class TypeAnnotation extends BaseNode {
|
|
|
907
889
|
}
|
|
908
890
|
}
|
|
909
891
|
|
|
892
|
+
// 是否是复合类型 List|Map|entities|structures
|
|
893
|
+
isComplexType() {
|
|
894
|
+
const namespaceType = this.typeNamespace.split('.').pop();
|
|
895
|
+
return ['Map', 'List'].includes(this.typeName) || (this.typeKind === 'reference' && ['entities', 'structures'].includes(namespaceType));
|
|
896
|
+
}
|
|
897
|
+
/* 类型签名 */
|
|
898
|
+
get sign() {
|
|
899
|
+
let str: string = '';
|
|
900
|
+
if (['Map', 'List'].includes(this.typeName)) {
|
|
901
|
+
str += this.typeName + '<';
|
|
902
|
+
(this.typeArguments || []).forEach((item, index) => {
|
|
903
|
+
str += item.sign;
|
|
904
|
+
if (index + 1 !== this.typeArguments.length) {
|
|
905
|
+
str += ',';
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
str += '>';
|
|
909
|
+
} else {
|
|
910
|
+
str += this.typeName;
|
|
911
|
+
}
|
|
912
|
+
return str;
|
|
913
|
+
}
|
|
914
|
+
|
|
910
915
|
//================================================================================
|
|
911
916
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
912
917
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -60,6 +60,8 @@ export class ValidationRule extends LogicItem {
|
|
|
60
60
|
@property('LogicItem')
|
|
61
61
|
errorMessage: LogicItem = undefined;
|
|
62
62
|
|
|
63
|
+
|
|
64
|
+
|
|
63
65
|
/**
|
|
64
66
|
* @param source 需要合并的部分参数
|
|
65
67
|
*/
|
|
@@ -73,6 +75,7 @@ export class ValidationRule extends LogicItem {
|
|
|
73
75
|
return super.from(source, parentNode, parentKey) as ValidationRule;
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
|
|
76
79
|
/**
|
|
77
80
|
* 设置错误信息
|
|
78
81
|
*/
|
|
@@ -88,6 +91,10 @@ export class ValidationRule extends LogicItem {
|
|
|
88
91
|
});
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
91
98
|
/**
|
|
92
99
|
* 插入实际参数
|
|
93
100
|
* @internal
|
|
@@ -120,6 +127,8 @@ export class ValidationRule extends LogicItem {
|
|
|
120
127
|
return argument;
|
|
121
128
|
}
|
|
122
129
|
|
|
130
|
+
|
|
131
|
+
|
|
123
132
|
/**
|
|
124
133
|
* 插入实际参数
|
|
125
134
|
* @param argumentOptions 实际参数参数
|
|
@@ -142,6 +151,8 @@ export class ValidationRule extends LogicItem {
|
|
|
142
151
|
return node;
|
|
143
152
|
}
|
|
144
153
|
|
|
154
|
+
|
|
155
|
+
|
|
145
156
|
/**
|
|
146
157
|
* 添加实际参数
|
|
147
158
|
* @internal
|
|
@@ -161,6 +172,8 @@ export class ValidationRule extends LogicItem {
|
|
|
161
172
|
return this._insertArgumentAt(options as any, index);
|
|
162
173
|
}
|
|
163
174
|
|
|
175
|
+
|
|
176
|
+
|
|
164
177
|
/**
|
|
165
178
|
* 添加实际参数
|
|
166
179
|
* @param argumentOptions 实际参数参数
|
|
@@ -184,6 +197,9 @@ export class ValidationRule extends LogicItem {
|
|
|
184
197
|
return node;
|
|
185
198
|
}
|
|
186
199
|
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
187
203
|
/**
|
|
188
204
|
* 删除实际参数
|
|
189
205
|
* @param argument 已有的实际参数实例
|
|
@@ -191,10 +207,12 @@ export class ValidationRule extends LogicItem {
|
|
|
191
207
|
removeArgumentInArguments(argument: Argument): void;
|
|
192
208
|
|
|
193
209
|
removeArgumentInArguments(options: Argument) {
|
|
194
|
-
|
|
210
|
+
let argument: Argument = options;
|
|
195
211
|
return argument.delete();
|
|
196
212
|
}
|
|
197
213
|
|
|
214
|
+
|
|
215
|
+
|
|
198
216
|
/**
|
|
199
217
|
* 删除逻辑项
|
|
200
218
|
* @param name 逻辑项名称
|
|
@@ -32,6 +32,7 @@ import Logic from './Logic__';
|
|
|
32
32
|
import View from './View__';
|
|
33
33
|
import Module from './Module__';
|
|
34
34
|
import App from './App__';
|
|
35
|
+
import Frontend from './Frontend__';
|
|
35
36
|
import ProcessElement from './ProcessElement__';
|
|
36
37
|
import Process from './Process__';
|
|
37
38
|
|
|
@@ -94,6 +95,12 @@ export class Variable extends BaseNode {
|
|
|
94
95
|
get view() {
|
|
95
96
|
return this.getAncestor('View') as View;
|
|
96
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* 祖先 Frontend
|
|
100
|
+
*/
|
|
101
|
+
get frontend() {
|
|
102
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
103
|
+
}
|
|
97
104
|
/**
|
|
98
105
|
* 祖先 ProcessElement
|
|
99
106
|
*/
|
|
@@ -168,10 +175,6 @@ export class Variable extends BaseNode {
|
|
|
168
175
|
});
|
|
169
176
|
}
|
|
170
177
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
178
|
/**
|
|
176
179
|
* 删除类型标注
|
|
177
180
|
* @param name 类型标注名称
|
|
@@ -240,7 +243,10 @@ export class Variable extends BaseNode {
|
|
|
240
243
|
toJS(state?: TranslatorState): string {
|
|
241
244
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
242
245
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
243
|
-
const needGenInitFromSchema = typeAnnotation &&
|
|
246
|
+
const needGenInitFromSchema = typeAnnotation && (
|
|
247
|
+
!['primitive', 'union'].includes(typeAnnotation.typeKind)
|
|
248
|
+
|| typeAnnotation.typeName === 'DateTime'
|
|
249
|
+
);
|
|
244
250
|
let code = `${this.name} =`;
|
|
245
251
|
if (needGenInitFromSchema) {
|
|
246
252
|
code += `${context}.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}',`;
|
|
@@ -315,7 +321,7 @@ export class Variable extends BaseNode {
|
|
|
315
321
|
* @param name 一般不用传,用于 rename
|
|
316
322
|
*/
|
|
317
323
|
getEmbeddedFilePath(name = this.name) {
|
|
318
|
-
return `/embedded/${this.app.name}/
|
|
324
|
+
return `/embedded/${this.app.name}/frontends/${this.parentNode.name}/variables/${name}.ts`;
|
|
319
325
|
}
|
|
320
326
|
|
|
321
327
|
toEmbeddedTSFile() {
|
|
@@ -191,6 +191,7 @@ import BindStyle from './BindStyle__';
|
|
|
191
191
|
import View from './View__';
|
|
192
192
|
import Module from './Module__';
|
|
193
193
|
import App from './App__';
|
|
194
|
+
import Frontend from './Frontend__';
|
|
194
195
|
|
|
195
196
|
/**
|
|
196
197
|
* 页面元素
|
|
@@ -305,6 +306,12 @@ export class ViewElement extends BaseNode {
|
|
|
305
306
|
get app() {
|
|
306
307
|
return this.getAncestor('App') as App;
|
|
307
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* 祖先 Frontend
|
|
311
|
+
*/
|
|
312
|
+
get frontend() {
|
|
313
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
314
|
+
}
|
|
308
315
|
|
|
309
316
|
/**
|
|
310
317
|
* @param source 需要合并的部分参数
|
|
@@ -1669,7 +1676,7 @@ export class ViewElement extends BaseNode {
|
|
|
1669
1676
|
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
1670
1677
|
}));
|
|
1671
1678
|
}
|
|
1672
|
-
} catch (error) {}
|
|
1679
|
+
} catch (error) { }
|
|
1673
1680
|
return {
|
|
1674
1681
|
concept: 'ValidationRule',
|
|
1675
1682
|
name: '',
|
|
@@ -1721,7 +1728,7 @@ export class ViewElement extends BaseNode {
|
|
|
1721
1728
|
let element: ViewElement;
|
|
1722
1729
|
if (astNode.type === 1) {
|
|
1723
1730
|
if (astNode.tag === 'router-view') {
|
|
1724
|
-
if (
|
|
1731
|
+
if (view.frontend.type === 'h5') {
|
|
1725
1732
|
astNode.tag = 'van-router-view';
|
|
1726
1733
|
} else {
|
|
1727
1734
|
astNode.tag = 'u-router-view';
|
|
@@ -1925,7 +1932,7 @@ export class ViewElement extends BaseNode {
|
|
|
1925
1932
|
finalCode: false,
|
|
1926
1933
|
nodePathAttr: true,
|
|
1927
1934
|
attrFormat: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) => {
|
|
1928
|
-
if (attr.concept === 'BindAttribute') {
|
|
1935
|
+
if (attr.concept === 'BindAttribute' && !['href', 'destination', 'externalDestination', 'download'].includes(attr.name)) {
|
|
1929
1936
|
const api = config.allNodesAPI[element.tag];
|
|
1930
1937
|
const apiOfAttr = api && api.attrs && api.attrs.find((_attr) => _attr.name === attr.name);
|
|
1931
1938
|
if (['u-form-item', 'u-validator', 'van-field'].includes(element.tag) && attr.name === 'rules') {
|
|
@@ -2084,11 +2091,27 @@ export class ViewElement extends BaseNode {
|
|
|
2084
2091
|
this.staticClass && parts.push(`class="${this.staticClass}"`);
|
|
2085
2092
|
this.staticStyle && parts.push(`style="${this.staticStyle}"`);
|
|
2086
2093
|
|
|
2094
|
+
const vIfs: string[] = [];
|
|
2087
2095
|
[].concat(this.bindAttrs, this.bindDirectives, this.bindEvents).forEach((attr: BindAttribute | BindDirective | BindEvent) => {
|
|
2088
2096
|
const result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
|
|
2097
|
+
|
|
2098
|
+
// v-auth v-if 都翻译成 v-if
|
|
2099
|
+
if(attr instanceof BindDirective && ['if', 'auth'].includes(attr.name) && result !== false) {
|
|
2100
|
+
const expr = result.replace(/v-(if|auth)="(.*)"/, (match, p1, p2) => p2);
|
|
2101
|
+
if(expr)
|
|
2102
|
+
vIfs.push(attr.name === 'if' ? expr : `$auth.has(${expr})`);
|
|
2103
|
+
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2089
2107
|
result && parts.push(result);
|
|
2090
2108
|
});
|
|
2091
2109
|
|
|
2110
|
+
if(vIfs.length === 2)
|
|
2111
|
+
parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
|
|
2112
|
+
else if(vIfs.length === 1)
|
|
2113
|
+
parts.push(`v-if="${vIfs[0]}"`)
|
|
2114
|
+
|
|
2092
2115
|
const bindStyles = newOptions.bindStylesFormat(this.bindStyles, this);
|
|
2093
2116
|
if (bindStyles)
|
|
2094
2117
|
parts.push(bindStyles);
|
package/src/concepts/View__.ts
CHANGED
|
@@ -28,6 +28,7 @@ import Variable from './Variable__';
|
|
|
28
28
|
import Logic from './Logic__';
|
|
29
29
|
import BindEvent from './BindEvent__';
|
|
30
30
|
import Module from './Module__';
|
|
31
|
+
import Frontend from './Frontend__';
|
|
31
32
|
import App from './App__';
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -161,6 +162,12 @@ export class View extends BaseNode {
|
|
|
161
162
|
get app() {
|
|
162
163
|
return this.getAncestor('App') as App;
|
|
163
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* 祖先 Frontend
|
|
167
|
+
*/
|
|
168
|
+
get frontend() {
|
|
169
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
170
|
+
}
|
|
164
171
|
|
|
165
172
|
/**
|
|
166
173
|
* @param source 需要合并的部分参数
|
|
@@ -259,8 +266,6 @@ export class View extends BaseNode {
|
|
|
259
266
|
});
|
|
260
267
|
}
|
|
261
268
|
|
|
262
|
-
|
|
263
|
-
|
|
264
269
|
/**
|
|
265
270
|
* 插入页面元素
|
|
266
271
|
* @internal
|
|
@@ -394,7 +399,6 @@ export class View extends BaseNode {
|
|
|
394
399
|
return node;
|
|
395
400
|
}
|
|
396
401
|
|
|
397
|
-
|
|
398
402
|
getParamUniqueName(name = 'param1') {
|
|
399
403
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
400
404
|
}
|
|
@@ -532,7 +536,6 @@ export class View extends BaseNode {
|
|
|
532
536
|
return node;
|
|
533
537
|
}
|
|
534
538
|
|
|
535
|
-
|
|
536
539
|
getVariableUniqueName(name = 'variable1') {
|
|
537
540
|
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
538
541
|
}
|
|
@@ -670,7 +673,6 @@ export class View extends BaseNode {
|
|
|
670
673
|
return node;
|
|
671
674
|
}
|
|
672
675
|
|
|
673
|
-
|
|
674
676
|
getLogicUniqueName(name = 'logic1') {
|
|
675
677
|
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
676
678
|
}
|
|
@@ -808,7 +810,6 @@ export class View extends BaseNode {
|
|
|
808
810
|
return node;
|
|
809
811
|
}
|
|
810
812
|
|
|
811
|
-
|
|
812
813
|
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
813
814
|
const excludedSet = new Set(excludedList);
|
|
814
815
|
return ((this.bindEvents as BindEvent[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -950,9 +951,6 @@ export class View extends BaseNode {
|
|
|
950
951
|
return node;
|
|
951
952
|
}
|
|
952
953
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
954
|
getViewExistingNames(excludedList: Array<View> = []) {
|
|
957
955
|
const excludedSet = new Set(excludedList);
|
|
958
956
|
return ((this.children as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -1094,9 +1092,6 @@ export class View extends BaseNode {
|
|
|
1094
1092
|
return node;
|
|
1095
1093
|
}
|
|
1096
1094
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
1095
|
/**
|
|
1101
1096
|
* 删除页面元素
|
|
1102
1097
|
* @param name 页面元素名称
|
|
@@ -1145,8 +1140,6 @@ export class View extends BaseNode {
|
|
|
1145
1140
|
return params;
|
|
1146
1141
|
}
|
|
1147
1142
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
1143
|
/**
|
|
1151
1144
|
* 删除输入参数
|
|
1152
1145
|
* @param name 输入参数名称
|
|
@@ -1195,8 +1188,6 @@ export class View extends BaseNode {
|
|
|
1195
1188
|
return params;
|
|
1196
1189
|
}
|
|
1197
1190
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
1191
|
/**
|
|
1201
1192
|
* 删除变量
|
|
1202
1193
|
* @param name 变量名称
|
|
@@ -1245,8 +1236,6 @@ export class View extends BaseNode {
|
|
|
1245
1236
|
return params;
|
|
1246
1237
|
}
|
|
1247
1238
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
1239
|
/**
|
|
1251
1240
|
* 删除逻辑
|
|
1252
1241
|
* @param name 逻辑名称
|
|
@@ -1295,8 +1284,6 @@ export class View extends BaseNode {
|
|
|
1295
1284
|
return params;
|
|
1296
1285
|
}
|
|
1297
1286
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
1287
|
/**
|
|
1301
1288
|
* 删除元素绑定事件
|
|
1302
1289
|
* @param name 元素绑定事件名称
|
|
@@ -1345,8 +1332,6 @@ export class View extends BaseNode {
|
|
|
1345
1332
|
return params;
|
|
1346
1333
|
}
|
|
1347
1334
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
1335
|
/**
|
|
1351
1336
|
* 删除页面
|
|
1352
1337
|
* @param name 页面名称
|
|
@@ -1404,7 +1389,7 @@ export class View extends BaseNode {
|
|
|
1404
1389
|
get parentAuth() {
|
|
1405
1390
|
const _nameSpace = this.getTsNamespace();
|
|
1406
1391
|
const mainViewName = _nameSpace.split('.')[2];
|
|
1407
|
-
return mainViewName ? this.
|
|
1392
|
+
return mainViewName ? this.frontend.views.find((item) => item.name === mainViewName)?.auth : this.auth;
|
|
1408
1393
|
}
|
|
1409
1394
|
/**
|
|
1410
1395
|
* 设置页面权限
|
|
@@ -1710,7 +1695,7 @@ export class View extends BaseNode {
|
|
|
1710
1695
|
parent = parent.parentNode;
|
|
1711
1696
|
}
|
|
1712
1697
|
}
|
|
1713
|
-
return `/embedded/${this.app.name}/views/${pathName}.ts`;
|
|
1698
|
+
return `/embedded/${this.app.name}/frontends/${this.frontend.name}/views/${pathName}.ts`;
|
|
1714
1699
|
}
|
|
1715
1700
|
|
|
1716
1701
|
getNamespace(): string {
|
|
@@ -1918,6 +1903,7 @@ export class View extends BaseNode {
|
|
|
1918
1903
|
}
|
|
1919
1904
|
|
|
1920
1905
|
get path() {
|
|
1906
|
+
const basePath = this.frontend.basePath;
|
|
1921
1907
|
const _path = [];
|
|
1922
1908
|
let view: View = this;
|
|
1923
1909
|
while (view.concept === 'View') {
|
|
@@ -1928,7 +1914,7 @@ export class View extends BaseNode {
|
|
|
1928
1914
|
if (_path.length) {
|
|
1929
1915
|
path += `${_path.reverse().join('/')}`;
|
|
1930
1916
|
}
|
|
1931
|
-
return path
|
|
1917
|
+
return `${basePath}${path}`;
|
|
1932
1918
|
}
|
|
1933
1919
|
|
|
1934
1920
|
/**
|
|
@@ -2153,6 +2139,10 @@ export class View extends BaseNode {
|
|
|
2153
2139
|
return replaceCode;
|
|
2154
2140
|
|
|
2155
2141
|
let fnCode = $1;
|
|
2142
|
+
if ($1.startsWith(`${variable}.`))
|
|
2143
|
+
fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
2144
|
+
if ($1.startsWith(`${variable},`))
|
|
2145
|
+
fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
2156
2146
|
if ($1.includes(`(${variable},`))
|
|
2157
2147
|
fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
2158
2148
|
if ($1.includes(`(${variable}.`))
|
|
@@ -2206,6 +2196,16 @@ export class View extends BaseNode {
|
|
|
2206
2196
|
return code;
|
|
2207
2197
|
}
|
|
2208
2198
|
|
|
2199
|
+
getViewCallLogics():string[] {
|
|
2200
|
+
const callbackLogics :string[] = [];
|
|
2201
|
+
this.traverseChildren((el) => {
|
|
2202
|
+
if (el instanceof Identifier && el.namespace?.endsWith('logics')) {
|
|
2203
|
+
callbackLogics.push(el.namespace + '.' + el.name);
|
|
2204
|
+
}
|
|
2205
|
+
});
|
|
2206
|
+
return callbackLogics;
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
2209
|
//================================================================================
|
|
2210
2210
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2211
2211
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|