@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/index.d.ts +1 -1
- package/out/automate/engine/index.js +73 -25
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/utils.js +7 -6
- package/out/automate/engine/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +5 -4
- package/out/common/BaseNode.js +48 -41
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +18 -1
- package/out/concepts/App__.js +64 -24
- 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/Assignee__.d.ts +190 -0
- package/out/concepts/Assignee__.js +264 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/BinaryExpression__.js +6 -6
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +19 -0
- package/out/concepts/BindAttribute__.js +36 -2
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +21 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +1 -0
- package/out/concepts/BindEvent__.js +38 -14
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js +20 -7
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +11 -8
- package/out/concepts/CallInterface__.js +160 -23
- 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 +5 -1
- package/out/concepts/CallQueryComponent__.js +15 -11
- 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__.d.ts +11 -0
- package/out/concepts/Destination__.js +59 -19
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +10 -2
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +7 -0
- package/out/concepts/EntityProperty__.js +60 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -1
- package/out/concepts/Entity__.js +29 -12
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -0
- package/out/concepts/Enum__.js +9 -6
- 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 +5 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +26 -24
- 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 +41 -21
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +3 -0
- package/out/concepts/Interface__.js +105 -9
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +3 -0
- package/out/concepts/Logic__.js +57 -16
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +13 -6
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +6 -0
- package/out/concepts/Module__.js +18 -8
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +4 -0
- package/out/concepts/Namespace__.js +23 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/Param__.d.ts +2 -1
- package/out/concepts/Param__.js +35 -22
- 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 +20 -18
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +6 -1
- package/out/concepts/Process__.js +18 -14
- 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/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 +38 -25
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +1 -1
- package/out/concepts/SqlQueryComponent__.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 +5 -4
- package/out/concepts/StructureProperty__.js +54 -31
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -0
- package/out/concepts/Structure__.js +18 -5
- 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__.d.ts +3 -5
- package/out/concepts/TypeAnnotation__.js +36 -14
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +4 -2
- 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 +38 -25
- 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 +7 -1
- package/out/concepts/ViewElement__.js +154 -117
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -0
- package/out/concepts/View__.js +38 -25
- 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 +30 -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 +49 -41
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +11 -11
- package/out/concepts/basics/types/coreTypeList.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/enums/KEYWORDS.js +1 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +122 -93
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +19 -2
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -9
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -0
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getLogics.js +40 -56
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +4 -0
- package/out/server/getMemberIdentifier.js +90 -48
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +2 -2
- package/out/server/getProcesses.js +34 -11
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/index.js +4 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +11 -30
- package/out/server/naslServer.js +410 -199
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +10 -0
- package/out/server/process2LogicNamespace.js +16 -0
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +22 -3
- package/out/server/translator.js +336 -130
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +29 -15
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -5
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +7 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +4 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +1 -1
- package/out/templator/genGridViewBlock.js +3 -3
- package/out/templator/genGridViewBlock.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/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +3 -3
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +7 -7
- 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/out/utils/index.d.ts +6 -0
- package/out/utils/index.js +20 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +2 -1
- package/src/automate/engine/index.js +73 -25
- package/src/automate/engine/utils.js +7 -6
- package/src/common/BaseNode.ts +51 -42
- package/src/concepts/App__.ts +104 -26
- package/src/concepts/Argument__.ts +3 -2
- package/src/concepts/Assignee__.ts +437 -0
- package/src/concepts/BinaryExpression__.ts +7 -6
- package/src/concepts/BindAttribute__.ts +51 -2
- package/src/concepts/BindDirective__.ts +20 -1
- package/src/concepts/BindEvent__.ts +39 -16
- package/src/concepts/CallFunction__.ts +21 -8
- package/src/concepts/CallInterface__.ts +161 -42
- package/src/concepts/CallLogic__.ts +21 -9
- package/src/concepts/CallQueryComponent__.ts +15 -13
- 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 +57 -19
- package/src/concepts/End__.ts +9 -11
- package/src/concepts/EntityProperty__.ts +56 -3
- package/src/concepts/Entity__.ts +33 -20
- package/src/concepts/Enum__.ts +8 -7
- package/src/concepts/Event__.ts +1 -1
- package/src/concepts/ForEachStatement__.ts +8 -13
- package/src/concepts/Function__.ts +5 -5
- package/src/concepts/Identifier__.ts +31 -26
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/InterfaceParam__.ts +39 -20
- package/src/concepts/Interface__.ts +103 -9
- package/src/concepts/LogicItem__.ts +16 -1
- package/src/concepts/Logic__.ts +60 -18
- package/src/concepts/MemberExpression__.ts +18 -6
- package/src/concepts/Module__.ts +19 -8
- package/src/concepts/Namespace__.ts +24 -12
- package/src/concepts/Param__.ts +34 -23
- package/src/concepts/ProcessComponent__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +51 -50
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +32 -28
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- 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 +35 -25
- package/src/concepts/SqlQueryComponent__.ts +1 -1
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +49 -29
- package/src/concepts/Structure__.ts +17 -5
- package/src/concepts/SwitchCase__.ts +3 -3
- package/src/concepts/SwitchStatement__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +34 -12
- package/src/concepts/UnaryExpression__.ts +4 -2
- package/src/concepts/ValidationRule__.ts +24 -1
- package/src/concepts/Variable__.ts +35 -24
- package/src/concepts/ViewComponent__.ts +5 -5
- package/src/concepts/ViewElement__.ts +168 -113
- package/src/concepts/View__.ts +44 -25
- package/src/concepts/WhileStatement__.ts +1 -1
- package/src/concepts/basics/stdlib/index.ts +3 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +26 -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 +49 -41
- package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
- package/src/concepts/basics/types/coreTypeList.ts +11 -11
- package/src/concepts/index__.ts +1 -0
- package/src/enums/KEYWORDS.ts +1 -1
- package/src/generator/genBundleFiles.ts +131 -112
- package/src/manager/diagnostic.ts +1 -1
- package/src/server/createUiTs.ts +22 -4
- package/src/server/entity2LogicNamespace.ts +25 -9
- package/src/server/getExtensionModules.ts +2 -0
- package/src/server/getLogics.ts +42 -58
- package/src/server/getMemberIdentifier.ts +88 -46
- package/src/server/getProcesses.ts +32 -9
- package/src/server/index.ts +12 -1
- package/src/server/naslServer.ts +422 -215
- package/src/server/process2LogicNamespace.ts +17 -1
- package/src/server/translator.ts +392 -134
- package/src/service/storage/init.ts +27 -16
- package/src/templator/genCreateBlock.ts +5 -5
- package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
- package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +5 -7
- package/src/templator/genGridViewBlock.ts +4 -7
- package/src/templator/genQueryComponent.ts +1 -0
- package/src/templator/genTableBlock.ts +4 -7
- package/src/templator/genUpdateBlock.ts +7 -8
- package/src/templator/utils.ts +2 -1
- package/src/utils/index.ts +19 -0
|
@@ -46,6 +46,7 @@ export interface ElementToVueOptions {
|
|
|
46
46
|
getExtraParts?: (element?: ViewElement) => Array<string>;
|
|
47
47
|
attrFormat?: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) => string | false;
|
|
48
48
|
finalCode?: boolean;
|
|
49
|
+
scopeList?: string[];
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
|
|
@@ -86,7 +87,8 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
|
|
|
86
87
|
}
|
|
87
88
|
} else if (astNode.type === 'MemberExpression') {
|
|
88
89
|
if (astNode.object?.name === '$global') {
|
|
89
|
-
|
|
90
|
+
// 目前只有权限相关的
|
|
91
|
+
node = transAstNodeToNaslNode(astNode.property, 'nasl.auth');
|
|
90
92
|
} else {
|
|
91
93
|
node = {
|
|
92
94
|
concept: 'MemberExpression',
|
|
@@ -260,17 +262,19 @@ export class ViewElement extends BaseNode {
|
|
|
260
262
|
super.subConstructor(source);
|
|
261
263
|
}
|
|
262
264
|
|
|
265
|
+
|
|
266
|
+
|
|
263
267
|
/**
|
|
264
268
|
* 从父级删除该节点
|
|
265
269
|
* @internal
|
|
266
270
|
*/
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
_delete() {
|
|
272
|
+
let params: Params = null;
|
|
273
|
+
if (this.parentNode) {
|
|
274
|
+
params = (this.parentNode as any)?.__removeViewElement?.(this);
|
|
275
|
+
}
|
|
276
|
+
return params;
|
|
277
|
+
}
|
|
274
278
|
/**
|
|
275
279
|
* 设置页面元素名称
|
|
276
280
|
*/
|
|
@@ -296,7 +300,7 @@ export class ViewElement extends BaseNode {
|
|
|
296
300
|
});
|
|
297
301
|
}
|
|
298
302
|
|
|
299
|
-
|
|
303
|
+
getBindAttributeExistingNames(excludedList: Array<BindAttribute> = []) {
|
|
300
304
|
const excludedSet = new Set(excludedList);
|
|
301
305
|
return (this.bindAttrs || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
302
306
|
}
|
|
@@ -340,7 +344,7 @@ export class ViewElement extends BaseNode {
|
|
|
340
344
|
name: options,
|
|
341
345
|
}, this, 'bindAttrs');
|
|
342
346
|
} else if (options instanceof BindAttribute) {
|
|
343
|
-
options.
|
|
347
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
344
348
|
bindAttribute = options;
|
|
345
349
|
Object.assign(bindAttribute, relationOptions);
|
|
346
350
|
} else {
|
|
@@ -437,6 +441,7 @@ export class ViewElement extends BaseNode {
|
|
|
437
441
|
return node;
|
|
438
442
|
}
|
|
439
443
|
|
|
444
|
+
|
|
440
445
|
getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
|
|
441
446
|
const excludedSet = new Set(excludedList);
|
|
442
447
|
return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -481,7 +486,7 @@ export class ViewElement extends BaseNode {
|
|
|
481
486
|
name: options,
|
|
482
487
|
}, this, 'bindEvents');
|
|
483
488
|
} else if (options instanceof BindEvent) {
|
|
484
|
-
options.
|
|
489
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
485
490
|
bindEvent = options;
|
|
486
491
|
Object.assign(bindEvent, relationOptions);
|
|
487
492
|
} else {
|
|
@@ -578,6 +583,7 @@ export class ViewElement extends BaseNode {
|
|
|
578
583
|
return node;
|
|
579
584
|
}
|
|
580
585
|
|
|
586
|
+
|
|
581
587
|
getBindDirectiveExistingNames(excludedList: Array<BindDirective> = []) {
|
|
582
588
|
const excludedSet = new Set(excludedList);
|
|
583
589
|
return (this.bindDirectives || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
@@ -622,7 +628,7 @@ export class ViewElement extends BaseNode {
|
|
|
622
628
|
name: options,
|
|
623
629
|
}, this, 'bindDirectives');
|
|
624
630
|
} else if (options instanceof BindDirective) {
|
|
625
|
-
options.
|
|
631
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
626
632
|
bindDirective = options;
|
|
627
633
|
Object.assign(bindDirective, relationOptions);
|
|
628
634
|
} else {
|
|
@@ -719,6 +725,11 @@ export class ViewElement extends BaseNode {
|
|
|
719
725
|
return node;
|
|
720
726
|
}
|
|
721
727
|
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
722
733
|
/**
|
|
723
734
|
* 插入页面元素
|
|
724
735
|
* @internal
|
|
@@ -755,7 +766,7 @@ export class ViewElement extends BaseNode {
|
|
|
755
766
|
name: options,
|
|
756
767
|
}, this, 'children');
|
|
757
768
|
} else if (options instanceof ViewElement) {
|
|
758
|
-
options.
|
|
769
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
759
770
|
viewElement = options;
|
|
760
771
|
Object.assign(viewElement, relationOptions);
|
|
761
772
|
} else {
|
|
@@ -852,6 +863,9 @@ export class ViewElement extends BaseNode {
|
|
|
852
863
|
return node;
|
|
853
864
|
}
|
|
854
865
|
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
855
869
|
/**
|
|
856
870
|
* 删除元素绑定属性
|
|
857
871
|
* @param name 元素绑定属性名称
|
|
@@ -900,6 +914,8 @@ export class ViewElement extends BaseNode {
|
|
|
900
914
|
return params;
|
|
901
915
|
}
|
|
902
916
|
|
|
917
|
+
|
|
918
|
+
|
|
903
919
|
/**
|
|
904
920
|
* 删除元素绑定事件
|
|
905
921
|
* @param name 元素绑定事件名称
|
|
@@ -948,6 +964,8 @@ export class ViewElement extends BaseNode {
|
|
|
948
964
|
return params;
|
|
949
965
|
}
|
|
950
966
|
|
|
967
|
+
|
|
968
|
+
|
|
951
969
|
/**
|
|
952
970
|
* 删除元素指令
|
|
953
971
|
* @param name 元素指令名称
|
|
@@ -996,6 +1014,8 @@ export class ViewElement extends BaseNode {
|
|
|
996
1014
|
return params;
|
|
997
1015
|
}
|
|
998
1016
|
|
|
1017
|
+
|
|
1018
|
+
|
|
999
1019
|
/**
|
|
1000
1020
|
* 删除页面元素
|
|
1001
1021
|
* @param name 页面元素名称
|
|
@@ -1053,7 +1073,7 @@ export class ViewElement extends BaseNode {
|
|
|
1053
1073
|
get parentAuth() {
|
|
1054
1074
|
const _nameSpace = this.view.getNamespace();
|
|
1055
1075
|
const mainViewName = _nameSpace.split('.')[2];
|
|
1056
|
-
return this.app.views.find((item) => item.name === mainViewName)?.auth;
|
|
1076
|
+
return this.view.parentNode.concept === 'App' ? this.view.auth : this.app.views.find((item) => item.name === mainViewName)?.auth;
|
|
1057
1077
|
}
|
|
1058
1078
|
|
|
1059
1079
|
getViewElementUniqueName(name = 'viewElement1') {
|
|
@@ -1092,8 +1112,9 @@ export class ViewElement extends BaseNode {
|
|
|
1092
1112
|
}
|
|
1093
1113
|
|
|
1094
1114
|
haveScope(node: ViewElement): boolean {
|
|
1095
|
-
|
|
1096
|
-
const
|
|
1115
|
+
// uGallery 没有子集不需要scope
|
|
1116
|
+
const dataSourcePcList = ['uTableView', 'uListView', 'uGridView', 'uCalendarView', 'uListComponents', 'uSelect'];
|
|
1117
|
+
const dataSourceH5List = ['vanRadioGroup', 'vanCheckboxGroup', 'vanListView', 'vanGridView', 'vanForComponents', 'lcapEchartsLine', 'lcapEchartsBar', 'lcapEchartsPie'];
|
|
1097
1118
|
const dataSourceList = [...dataSourcePcList, ...dataSourceH5List];
|
|
1098
1119
|
return dataSourceList.includes(node.toHump(node.tag));
|
|
1099
1120
|
}
|
|
@@ -1135,7 +1156,11 @@ export class ViewElement extends BaseNode {
|
|
|
1135
1156
|
while (!haveScopeFlag && parentNode.concept !== 'View') {
|
|
1136
1157
|
if (this.haveScope(parentNode as ViewElement)) {
|
|
1137
1158
|
// type d = nasl.ui.GetItemTypeFromDataSource<typeof listStructure>['tableRelation']
|
|
1138
|
-
const tsArr = expressionTs.split('.');
|
|
1159
|
+
const tsArr = expressionTs.replace('scope.item.', '').split('.');
|
|
1160
|
+
let itemStr = '';
|
|
1161
|
+
tsArr.forEach((item) => {
|
|
1162
|
+
itemStr += `['${item}']`;
|
|
1163
|
+
});
|
|
1139
1164
|
const parentbindAttrs = (parentNode as ViewElement).bindAttrs;
|
|
1140
1165
|
if (parentbindAttrs && parentbindAttrs.length) {
|
|
1141
1166
|
const parentAttr = parentbindAttrs.find((item) => item.name === 'data-source');
|
|
@@ -1143,7 +1168,7 @@ export class ViewElement extends BaseNode {
|
|
|
1143
1168
|
let parentExpressionTs = parentAttr.expression.toEmbeddedTS(shiftState(state, code));
|
|
1144
1169
|
parentExpressionTs = parentExpressionTs.replaceAll(' ', '');
|
|
1145
1170
|
// 如果是逻辑就推导出逻辑类型
|
|
1146
|
-
genericType = `nasl.ui.GetItemTypeFromDataSource<nasl.ui.GetItemTypeFromDataSource<typeof ${parentExpressionTs}
|
|
1171
|
+
genericType = `nasl.ui.GetItemTypeFromDataSource<nasl.ui.GetItemTypeFromDataSource<typeof ${parentExpressionTs}>${itemStr}>`;
|
|
1147
1172
|
}
|
|
1148
1173
|
}
|
|
1149
1174
|
haveScopeFlag = true;
|
|
@@ -1184,7 +1209,7 @@ export class ViewElement extends BaseNode {
|
|
|
1184
1209
|
hasAuth = !!this.bindDirectives.filter((directive) => directive.name === 'auth').length;
|
|
1185
1210
|
}
|
|
1186
1211
|
// 角色
|
|
1187
|
-
if (
|
|
1212
|
+
if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
|
|
1188
1213
|
code += indent(state.tabSize + 2);
|
|
1189
1214
|
code += 'roles = [\n';
|
|
1190
1215
|
this.bindRoles.forEach((role) => {
|
|
@@ -1231,6 +1256,11 @@ export class ViewElement extends BaseNode {
|
|
|
1231
1256
|
tabSize: state.tabSize + 2,
|
|
1232
1257
|
})) + ',\n';
|
|
1233
1258
|
}
|
|
1259
|
+
if (Array.isArray(attr.rules) && attr.rules.length) {
|
|
1260
|
+
attr.rules.forEach((item) => {
|
|
1261
|
+
code += item.toEmbeddedTS(shiftState(state, code)) + ',\n';
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1234
1264
|
});
|
|
1235
1265
|
this.bindDirectives.forEach((directive) => {
|
|
1236
1266
|
if (directive.expression) {
|
|
@@ -1350,13 +1380,13 @@ export class ViewElement extends BaseNode {
|
|
|
1350
1380
|
});
|
|
1351
1381
|
astNode.children = [];
|
|
1352
1382
|
}
|
|
1353
|
-
|
|
1354
1383
|
// 将 scopedSlots 合并到 children 中
|
|
1355
1384
|
if (astNode.scopedSlots) {
|
|
1356
1385
|
astNode.children = astNode.children || [];
|
|
1357
1386
|
Object.keys(astNode.scopedSlots).forEach((key) => {
|
|
1358
|
-
if (!astNode.children.find((child) => key === (child as compiler.ASTElement).slotTarget))
|
|
1387
|
+
if (!astNode.children.find((child) => key === (child as compiler.ASTElement).slotTarget)) {
|
|
1359
1388
|
astNode.children.unshift(astNode.scopedSlots[key]);
|
|
1389
|
+
}
|
|
1360
1390
|
});
|
|
1361
1391
|
delete astNode.scopedSlots;
|
|
1362
1392
|
}
|
|
@@ -1377,6 +1407,12 @@ export class ViewElement extends BaseNode {
|
|
|
1377
1407
|
}
|
|
1378
1408
|
}
|
|
1379
1409
|
const tagName = astNode.tag.replace(ViewElement.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1410
|
+
let newContext: any = {};
|
|
1411
|
+
if (context) {
|
|
1412
|
+
newContext = {
|
|
1413
|
+
...context,
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1380
1416
|
element = new ViewElement({
|
|
1381
1417
|
tag: astNode.tag,
|
|
1382
1418
|
name: astNode.attrsMap.ref || view.getViewElementUniqueName(`${tagName}1`),
|
|
@@ -1384,45 +1420,43 @@ export class ViewElement extends BaseNode {
|
|
|
1384
1420
|
staticStyle: astNode.attrsMap.style,
|
|
1385
1421
|
slotTarget: astNode.slotTarget && json5.parse(astNode.slotTarget),
|
|
1386
1422
|
slotScope: astNode.slotScope === '_empty_' ? '' : astNode.slotScope,
|
|
1387
|
-
children: astNode.children.map((item) => this._fromASTNode(item as compiler.ASTElement,
|
|
1423
|
+
children: astNode.children.map((item) => this._fromASTNode(item as compiler.ASTElement, newContext)) as unknown as Array<ViewElement>,
|
|
1388
1424
|
});
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
&&
|
|
1392
|
-
|
|
1393
|
-
|
|
1425
|
+
astNode?.attrs?.forEach((oldAttr) => {
|
|
1426
|
+
let attr: BindAttribute;
|
|
1427
|
+
if (oldAttr.value === '""' && (oldAttr as any).end - (oldAttr as any).start === oldAttr.name.length) {
|
|
1428
|
+
attr = new BindAttribute({
|
|
1429
|
+
type: 'static',
|
|
1430
|
+
name: oldAttr.name,
|
|
1431
|
+
value: 'true',
|
|
1432
|
+
});
|
|
1433
|
+
} else {
|
|
1434
|
+
try {
|
|
1435
|
+
const tmp = json5.parse(oldAttr.value);
|
|
1436
|
+
const source: any = {
|
|
1437
|
+
type: typeof tmp === 'string' ? 'string' : 'static',
|
|
1438
|
+
name: oldAttr.name,
|
|
1439
|
+
value: typeof tmp === 'string' ? tmp : oldAttr.value,
|
|
1440
|
+
};
|
|
1441
|
+
if (oldAttr.name === 'rules') {
|
|
1442
|
+
source.rules = tmp?.split('|').map((ruleStr: string) => this._parseValidationRule(ruleStr.trim()));
|
|
1443
|
+
}
|
|
1444
|
+
attr = new BindAttribute(source);
|
|
1445
|
+
} catch (e) {
|
|
1446
|
+
const expression = <any> this._parseExpression(oldAttr.value);
|
|
1394
1447
|
attr = new BindAttribute({
|
|
1395
|
-
type: '
|
|
1448
|
+
type: 'dynamic',
|
|
1396
1449
|
name: oldAttr.name,
|
|
1397
|
-
value: '
|
|
1450
|
+
value: expression ? '' : oldAttr.value,
|
|
1451
|
+
expression,
|
|
1398
1452
|
});
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
const tmp = json5.parse(oldAttr.value);
|
|
1402
|
-
const source: any = {
|
|
1403
|
-
type: typeof tmp === 'string' ? 'string' : 'static',
|
|
1404
|
-
name: oldAttr.name,
|
|
1405
|
-
value: typeof tmp === 'string' ? tmp : oldAttr.value,
|
|
1406
|
-
};
|
|
1407
|
-
if (oldAttr.name === 'rules') {
|
|
1408
|
-
source.rules = tmp?.split('|').map((ruleStr: string) => this._parseValidationRule(ruleStr.trim()));
|
|
1409
|
-
}
|
|
1410
|
-
attr = new BindAttribute(source);
|
|
1411
|
-
} catch (e) {
|
|
1412
|
-
const expression = <any> this._parseExpression(oldAttr.value);
|
|
1413
|
-
attr = new BindAttribute({
|
|
1414
|
-
type: 'dynamic',
|
|
1415
|
-
name: oldAttr.name,
|
|
1416
|
-
value: expression ? '' : oldAttr.value,
|
|
1417
|
-
expression,
|
|
1418
|
-
});
|
|
1419
|
-
if (astNode.attrsMap[`:${attr.name}.sync`]) {
|
|
1420
|
-
attr.sync = true;
|
|
1421
|
-
}
|
|
1453
|
+
if (astNode.attrsMap[`:${attr.name}.sync`]) {
|
|
1454
|
+
attr.sync = true;
|
|
1422
1455
|
}
|
|
1423
1456
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1457
|
+
}
|
|
1458
|
+
element.addBindAttribute(attr);
|
|
1459
|
+
});
|
|
1426
1460
|
|
|
1427
1461
|
// compiler 处理:value.sync 时会加上update:value事件,需要过滤
|
|
1428
1462
|
astNode.events
|
|
@@ -1438,18 +1472,17 @@ export class ViewElement extends BaseNode {
|
|
|
1438
1472
|
argsStr = matchArr[1];
|
|
1439
1473
|
}
|
|
1440
1474
|
let args: any[] = [];
|
|
1441
|
-
|
|
1442
|
-
|
|
1475
|
+
const argStrs: string[] = argsStr.split(',');
|
|
1476
|
+
args = argStrs
|
|
1477
|
+
.filter((argStr) => !!argStr && argStr !== '_empty_')
|
|
1478
|
+
.map((argStr) => {
|
|
1443
1479
|
const keyword = argStr.trim().split('.');
|
|
1444
1480
|
return {
|
|
1445
1481
|
concept: 'Argument',
|
|
1446
1482
|
expression: genArgumentMemberExpression(keyword),
|
|
1447
1483
|
};
|
|
1448
1484
|
});
|
|
1449
|
-
|
|
1450
|
-
const viewNamespace = view?.getNamespace();
|
|
1451
|
-
const viewName = `${view?.name}`;
|
|
1452
|
-
let calleeNamespace = `${viewNamespace}.${viewName}.logics`;
|
|
1485
|
+
let calleeNamespace = '';
|
|
1453
1486
|
if (calleeName) {
|
|
1454
1487
|
const namespaceArr = calleeName.split('.');
|
|
1455
1488
|
const start = namespaceArr.shift();
|
|
@@ -1504,15 +1537,12 @@ export class ViewElement extends BaseNode {
|
|
|
1504
1537
|
}));
|
|
1505
1538
|
}
|
|
1506
1539
|
} else if (astNode.type === 2) {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
tag: 'u-text',
|
|
1514
|
-
});
|
|
1515
|
-
}
|
|
1540
|
+
const tagName = config.scope === 'h5' ? 'van-text' : 'u-text';
|
|
1541
|
+
const baseName = tagName.replace(ViewElement.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1542
|
+
element = new ViewElement({
|
|
1543
|
+
tag: tagName,
|
|
1544
|
+
name: view.getViewElementUniqueName(`${baseName}1`),
|
|
1545
|
+
});
|
|
1516
1546
|
const value = astNode.text.match(/{{(.*?)}}/)[1].trim();
|
|
1517
1547
|
const expression = <any> this._parseExpression(value);
|
|
1518
1548
|
element.addBindAttribute(new BindAttribute({
|
|
@@ -1522,15 +1552,12 @@ export class ViewElement extends BaseNode {
|
|
|
1522
1552
|
expression,
|
|
1523
1553
|
}));
|
|
1524
1554
|
} else if (astNode.type === 3) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
tag: 'u-text',
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1555
|
+
const tagName = config.scope === 'h5' ? 'van-text' : 'u-text';
|
|
1556
|
+
const baseName = tagName.replace(ViewElement.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
|
|
1557
|
+
element = new ViewElement({
|
|
1558
|
+
tag: tagName,
|
|
1559
|
+
name: view.getViewElementUniqueName(`${baseName}1`),
|
|
1560
|
+
});
|
|
1534
1561
|
element.addBindAttribute(new BindAttribute({
|
|
1535
1562
|
name: 'text',
|
|
1536
1563
|
type: 'string',
|
|
@@ -1557,24 +1584,14 @@ export class ViewElement extends BaseNode {
|
|
|
1557
1584
|
let ast = compiler.compile(html, compilerOptions).ast;
|
|
1558
1585
|
if (ast.tag === 'template' && !ast.slotTarget)
|
|
1559
1586
|
ast = ast.children[0] as compiler.ASTElement;
|
|
1560
|
-
|
|
1561
|
-
let root: ViewElement;
|
|
1562
|
-
utils.traverse((current) => {
|
|
1563
|
-
// 处理 scopedSlots;
|
|
1564
|
-
if (!current.parent)
|
|
1565
|
-
root = this._fromASTNode(current.node, context);
|
|
1566
|
-
else
|
|
1567
|
-
(current.parent.children as any)[current.index] = this._fromASTNode(current.node, context);
|
|
1568
|
-
}, { node: ast });
|
|
1569
|
-
return root;
|
|
1587
|
+
return this._fromASTNode(ast, context);
|
|
1570
1588
|
}
|
|
1571
1589
|
|
|
1572
1590
|
/**
|
|
1573
1591
|
* 从模板生成规范的 ViewElement 对象
|
|
1574
1592
|
*/
|
|
1575
1593
|
public static fromHTML(html: string, context?: ParseContext) {
|
|
1576
|
-
|
|
1577
|
-
return element;
|
|
1594
|
+
return this.parse(html, context);
|
|
1578
1595
|
}
|
|
1579
1596
|
|
|
1580
1597
|
/**
|
|
@@ -1602,7 +1619,7 @@ export class ViewElement extends BaseNode {
|
|
|
1602
1619
|
}
|
|
1603
1620
|
}
|
|
1604
1621
|
if ((attr as BindAttribute).type === 'dynamic' && !(element.tag === 'u-cascade-select' && attr.name === 'categories'))
|
|
1605
|
-
return defaultResult.replace(/:?(\w+)(?:.*?)="(.*)"/, (m, name, value) => {
|
|
1622
|
+
return defaultResult.replace(/:?([\w-]+)(?:.*?)="(.*)"/, (m, name, value) => {
|
|
1606
1623
|
try {
|
|
1607
1624
|
const tempValue = json5.parse(value);
|
|
1608
1625
|
if (typeof tempValue === 'boolean' || typeof tempValue === 'number') {
|
|
@@ -1613,7 +1630,12 @@ export class ViewElement extends BaseNode {
|
|
|
1613
1630
|
if (apiOfAttr && !apiOfAttr.type.includes('string'))
|
|
1614
1631
|
return '';
|
|
1615
1632
|
}
|
|
1616
|
-
|
|
1633
|
+
value = value
|
|
1634
|
+
.replace(/"/g, "'")
|
|
1635
|
+
.replace(/\$utils\['(.+?)'\]/g, '$1')
|
|
1636
|
+
.replace(/\$refs./g, 'elements.')
|
|
1637
|
+
.replace(/\$global./g, 'nasl.auth.');
|
|
1638
|
+
return `${name}="{{ ${value} }}"`;
|
|
1617
1639
|
});
|
|
1618
1640
|
else
|
|
1619
1641
|
return defaultResult;
|
|
@@ -1661,7 +1683,14 @@ export class ViewElement extends BaseNode {
|
|
|
1661
1683
|
* 转换成 Vue 的模板格式
|
|
1662
1684
|
*/
|
|
1663
1685
|
toVue(options?: ElementToVueOptions) {
|
|
1664
|
-
|
|
1686
|
+
let scopeList: string[] = [];
|
|
1687
|
+
if (Array.isArray(options?.scopeList)) {
|
|
1688
|
+
scopeList = [...options?.scopeList];
|
|
1689
|
+
}
|
|
1690
|
+
if (this.slotScope) {
|
|
1691
|
+
scopeList.unshift(this.slotScope);
|
|
1692
|
+
}
|
|
1693
|
+
const newOptions: ElementToVueOptions = Object.assign({
|
|
1665
1694
|
indentStyle: 'space',
|
|
1666
1695
|
tabSize: 4,
|
|
1667
1696
|
indentLevel: 0,
|
|
@@ -1669,27 +1698,30 @@ export class ViewElement extends BaseNode {
|
|
|
1669
1698
|
nodePathAttr: false,
|
|
1670
1699
|
getExtraParts: () => [],
|
|
1671
1700
|
attrFormat: (attr: BindAttribute | BindEvent | BindDirective, element?: ViewElement, defaultResult?: string) => defaultResult,
|
|
1672
|
-
}, options
|
|
1673
|
-
|
|
1674
|
-
|
|
1701
|
+
}, options, {
|
|
1702
|
+
scopeList,
|
|
1703
|
+
});
|
|
1704
|
+
const tabString = ' '.repeat(newOptions.tabSize * newOptions.indentLevel);
|
|
1705
|
+
const insideTabString = ' '.repeat(newOptions.tabSize * (newOptions.indentLevel + 1));
|
|
1675
1706
|
let shouldIndent = true;
|
|
1676
1707
|
const content: string = !this.children ? '' : this.children
|
|
1677
1708
|
.map((element) => {
|
|
1678
|
-
const childOptions = Object.assign({},
|
|
1709
|
+
const childOptions = Object.assign({}, newOptions);
|
|
1679
1710
|
childOptions.indentLevel++;
|
|
1680
1711
|
return (shouldIndent ? '\n' + insideTabString : '') + element.toVue(childOptions);
|
|
1681
1712
|
})
|
|
1682
1713
|
.join('');
|
|
1683
|
-
if (!content.length)
|
|
1714
|
+
if (!content.length) {
|
|
1684
1715
|
shouldIndent = false;
|
|
1685
|
-
|
|
1716
|
+
}
|
|
1686
1717
|
const parts = [];
|
|
1687
|
-
if (
|
|
1688
|
-
if (
|
|
1689
|
-
|
|
1690
|
-
|
|
1718
|
+
if (newOptions.aslIdAttr) {
|
|
1719
|
+
if (newOptions.aslIdAttr === true) {
|
|
1720
|
+
newOptions.aslIdAttr = 'asl-id';
|
|
1721
|
+
}
|
|
1722
|
+
parts.push(`${newOptions.aslIdAttr}="${this.id}"`);
|
|
1691
1723
|
}
|
|
1692
|
-
if (
|
|
1724
|
+
if (newOptions.nodePathAttr) {
|
|
1693
1725
|
// 注入 asl 的 node-path
|
|
1694
1726
|
parts.push(`vusion-node-path="${this.nodePath}"`);
|
|
1695
1727
|
}
|
|
@@ -1700,11 +1732,10 @@ export class ViewElement extends BaseNode {
|
|
|
1700
1732
|
this.staticStyle && parts.push(`style="${this.staticStyle}"`);
|
|
1701
1733
|
|
|
1702
1734
|
[].concat(this.bindAttrs, this.bindDirectives, this.bindEvents).forEach((attr: BindAttribute | BindDirective | BindEvent) => {
|
|
1703
|
-
const result =
|
|
1735
|
+
const result = newOptions.attrFormat(attr, this, attr.toVue(newOptions));
|
|
1704
1736
|
result && parts.push(result);
|
|
1705
1737
|
});
|
|
1706
|
-
|
|
1707
|
-
options.getExtraParts(this).forEach((part) => parts.push(part));
|
|
1738
|
+
newOptions.getExtraParts(this).forEach((part) => parts.push(part));
|
|
1708
1739
|
|
|
1709
1740
|
let partsLength = 0;
|
|
1710
1741
|
let partsString = '';
|
|
@@ -1724,22 +1755,46 @@ export class ViewElement extends BaseNode {
|
|
|
1724
1755
|
* 从父级删除该节点
|
|
1725
1756
|
* @internal
|
|
1726
1757
|
*/
|
|
1727
|
-
|
|
1728
|
-
|
|
1758
|
+
delete() {
|
|
1759
|
+
super.delete();
|
|
1729
1760
|
if (this.parentNode) {
|
|
1730
|
-
|
|
1731
|
-
|
|
1761
|
+
this.traverseChildren((ele: ViewElement) => {
|
|
1762
|
+
(this.view as any)?.removeExistingViewElement(ele);
|
|
1763
|
+
});
|
|
1732
1764
|
}
|
|
1733
|
-
return params;
|
|
1734
1765
|
}
|
|
1735
1766
|
|
|
1767
|
+
findElementByName(name: string): ViewElement {
|
|
1768
|
+
return utils.traverse((current) => {
|
|
1769
|
+
if (current.node.name === name)
|
|
1770
|
+
return current.node;
|
|
1771
|
+
}, { node: this });
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
findElementByTag(tag: string): ViewElement {
|
|
1775
|
+
return utils.traverse((current) => {
|
|
1776
|
+
if (current.node.tag === tag)
|
|
1777
|
+
return current.node;
|
|
1778
|
+
}, { node: this });
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
findElementByAttr(name: string, value: string): ViewElement {
|
|
1782
|
+
return utils.traverse((current) => {
|
|
1783
|
+
if (current.node.bindAttrs.some((attr) => attr.name === name && attr.value === value))
|
|
1784
|
+
return current.node;
|
|
1785
|
+
}, { node: this });
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
@excludedInJSON()
|
|
1789
|
+
computedStyle: object = {};
|
|
1790
|
+
|
|
1736
1791
|
//================================================================================
|
|
1737
1792
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1738
1793
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
1739
1794
|
//================================================================================
|
|
1740
1795
|
}
|
|
1741
1796
|
|
|
1742
|
-
classMap
|
|
1797
|
+
classMap['ViewElement'] = ViewElement;
|
|
1743
1798
|
export default ViewElement;
|
|
1744
1799
|
//================================================================================
|
|
1745
1800
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|