Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lcap/nasl-concepts

Package Overview
Dependencies
Maintainers
21
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lcap/nasl-concepts - npm Package Compare versions

Comparing version 3.9.0-beta.15 to 3.9.0-beta.16

8

out/common/BaseNode.d.ts

@@ -34,2 +34,6 @@ import { Translator, Embedded } from '@lcap/nasl-types';

/**
* 用于AI指标的uuid
*/
_aiUUID: undefined | string;
/**
* 变动时间

@@ -140,3 +144,3 @@ */

*/
breakpoint: 'ENABLED' | 'DISABLED' | null | undefined;
breakpoint?: 'ENABLED' | 'DISABLED' | null | undefined;
/**

@@ -361,3 +365,3 @@ * @param source 需要合并的部分参数

*/
traverseStrictChildrenDoMultiTasks(tasks: Array<(_: BaseNode) => Generator<any, any, any>>, cleanups: Array<(_: BaseNode) => Generator<any, any, any>>): Generator<any, any, any>;
traverseStrictChildrenDoMultiTasks(tasks: Array<(_: SyntaxNode) => Generator<any, any, any>>, cleanups: Array<(_: SyntaxNode) => Generator<any, any, any>>): Generator<any, any, any>;
/**

@@ -364,0 +368,0 @@ * 带剪枝的迭先序遍历

import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';
import { ElementToVueOptions } from './ViewElement__';
import type BatchAssignment from './BatchAssignment__';
import type View from './View__';
import type BusinessComponent from './BusinessComponent__';
import * as types from './utils/types';

@@ -54,2 +56,3 @@ import LogicItem from './LogicItem__';

toJS(state?: TranslatorState): string;
get likeComponent(): View | BusinessComponent;
toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;

@@ -56,0 +59,0 @@ toNaturalTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): string;

@@ -206,2 +206,6 @@ "use strict";

let code = '';
// 给组件赋值时,不翻译
if (this.left?.concept === 'Identifier' && this.left?.isViewElement) {
return code;
}
code += this.left ? this.left.toJS(state) : '';

@@ -214,8 +218,44 @@ if (this.right) {

}
let isSetProp = this.left.concept === 'MemberExpression' && this.left.isViewElementProperty;
if (isSetProp) {
code += '\nawait this.$sleep();\n';
}
return code;
}
get likeComponent() {
return this.view || this?.getAncestor('BusinessComponent');
}
*toEmbeddedTS(state = (0, nasl_translator_1.createCompilerState)()) {
const self = this;
let code = 'nasl.core.assign(';
code += self.left ? yield* self.left.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) : '__LEFT__';
let code = '';
const left = self.left;
let isSetProp = left.concept === 'MemberExpression' && left.isViewElementProperty;
if (isSetProp) {
code += 'nasl.ui.setProp(';
}
else {
code = 'nasl.core.assign(';
}
if (!isSetProp) {
code += self.left ? yield* self.left.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) : '__LEFT__';
}
else {
const elementName = left.getViewElementName();
const element = self.likeComponent.getViewElementByName(elementName);
const prop = left.property.name;
let attr;
if (prop === '_if') {
attr = element.bindDirectives.find((item) => `_${item.name}` === prop);
}
else {
attr = element.bindAttrs.find((item) => item.name === prop);
}
// 判断当前组件属性是否有动态绑定值
if (attr?.type === 'dynamic' && attr?.expression) {
code += '__SET_PROP_RISK__';
}
else {
code += self.left ? yield* self.left.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) : '__LEFT__';
}
}
code += ',';

@@ -222,0 +262,0 @@ // 因为右侧枚举要赋值就得new 一下;

@@ -41,2 +41,3 @@ "use strict";

const utils_3 = require("../utils");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -46,3 +47,2 @@ const utils = __importStar(require("../utils"));

const AuthLogic__1 = __importDefault(require("./AuthLogic__"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -49,0 +49,0 @@ * 调用接口的鉴权逻辑

import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';
import { ElementToVueOptions } from './ViewElement__';
import type MemberExpression from './MemberExpression__';
import type View from './View__';
import type BusinessComponent from './BusinessComponent__';
import * as types from './utils/types';

@@ -241,2 +243,3 @@ import LogicItem from './LogicItem__';

toJS(state?: TranslatorState): string;
get likeComponent(): View | BusinessComponent;
toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): TranslatorGenerator;

@@ -243,0 +246,0 @@ toNaturalTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): string;

@@ -677,2 +677,6 @@ "use strict";

let code = '';
// 给组件赋值时,不翻译
if (this.left.expression?.concept === 'Identifier' && this.left.expression?.isViewElement && !this.left.members?.length) {
return code;
}
const rightMap = new Map();

@@ -703,6 +707,56 @@ this.assignmentLines.forEach(({ leftIndex, rightIndex }) => {

});
let isSetProp = this.left.expression?.concept === 'Identifier' && this.left.expression?.isViewElement;
if (isSetProp) {
code += '\nawait this.$sleep();\n';
}
return code;
}
get likeComponent() {
return this.view || this?.getAncestor('BusinessComponent');
}
*toEmbeddedTS(state = (0, nasl_translator_1.createCompilerState)()) {
const self = this;
// 特殊处理组件属性(开始)
let isSetProp = self.left.expression?.concept === 'Identifier' && self.left.expression?.isViewElement;
if (isSetProp) {
let code = '';
yield* (0, utils_1.wrapForEachToGenerator)(self.assignmentLines, function* warpForEachGenerator({ leftIndex, rightIndex }) {
if (leftIndex.length === 1) {
code += 'nasl.core.assign(';
code += yield* self.left.expression.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true }));
}
else {
const member = self.left.members[leftIndex[1]];
code += 'nasl.ui.setProp(';
const elementName = member.getViewElementName();
const element = self.likeComponent.getViewElementByName(elementName);
const prop = member.property.name;
let attr;
if (prop === '_if') {
attr = element.bindDirectives.find((item) => `_${item.name}` === prop);
}
else {
attr = element.bindAttrs.find((item) => item.name === prop);
}
// 判断当前组件属性是否有动态绑定值
if (attr?.type === 'dynamic' && attr?.expression) {
code += '__SET_PROP_RISK__';
}
else {
code += member ? yield* member.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) : '__LEFT__';
}
}
code += ', ';
const rightValue = rightIndex.length === 1
? yield* self.rights[rightIndex[0]]?.expression?.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) ??
(0, utils_1.returnOrigin)('')
: yield* self.rights[rightIndex[0]]?.members[rightIndex[1]]?.toEmbeddedTS((0, nasl_translator_1.shiftState)(state, code, { inline: true })) ?? (0, utils_1.returnOrigin)('');
code += `${rightValue});\n`;
});
if (!self.assignmentLines.length) {
code += `__assignmentLineEmpty__\n`;
}
return code;
}
// 特殊处理组件属性(结束)
let code = '// 以下是批量赋值的翻译代码\n';

@@ -709,0 +763,0 @@ // 提供sourcemap,获取类型标注和上下文可选变量

@@ -671,2 +671,5 @@ "use strict";

}
else if (name === 'dataSourceWatch') { // 特殊处理数据源监听
options?.finalCode !== false && (str += `v-dependencies.reload="${value}"`);
}
else {

@@ -763,3 +766,3 @@ str += `:${name}="${value}"`;

const ignore = ignoreCheckProps.includes(humpName);
const start = `nasl.util._bindAttrWrap(() => {\n`;
const start = `nasl.ui._bindAttrWrap(() => {\n`;
const end = `}, ${ignore ? 'true' : 'false'})`;

@@ -766,0 +769,0 @@ code += start;

@@ -593,2 +593,4 @@ import type { Embedded } from '@lcap/nasl-types';

}): ViewElement;
mergeDefinitions(code: string): void;
mergeDefinitions2(code: string): void;
onChange($event?: EventPayload): void;

@@ -637,2 +639,10 @@ /**

getViewExpressions(): any[];
viewElementPropertyUsage: {
getter: Record<string, string[]>;
setter: Record<string, string[]>;
};
getViewElementPropertyUsage(): {
getter: Record<string, string[]>;
setter: Record<string, string[]>;
};
/**

@@ -639,0 +649,0 @@ * 生成 Vue 中需要的 JS 代码

@@ -40,2 +40,3 @@ "use strict";

const nasl_translator_1 = require("@lcap/nasl-translator");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -45,3 +46,2 @@ const utils = __importStar(require("../utils"));

const Logic__1 = __importDefault(require("./Logic__"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -48,0 +48,0 @@ * 业务组件逻辑

@@ -690,3 +690,3 @@ "use strict";

genStructure(structureName, properties = []) {
const logic = this.logic || this.AuthLogic || this.AuthLogicForCallInterface;
const logic = this.logic || this.subLogic || this.AuthLogic || this.AuthLogicForCallInterface;
const Structure = (0, decorators_1.getConceptConstructor)('Structure');

@@ -728,3 +728,3 @@ return Structure.from({

}
const logic = this.logic || this.AuthLogic || this.AuthLogicForCallInterface || this.OverriddenLogic;
const logic = this.logic || this.subLogic || this.AuthLogic || this.AuthLogicForCallInterface || this.OverriddenLogic;
structureName =

@@ -731,0 +731,0 @@ structureName ||

@@ -606,3 +606,5 @@ "use strict";

if (this.tsCalleeNamespace && this.tsName) {
const viewPath = `${`${this.tsCalleeNamespace}.${this.tsName}`.replace(/^app\..+?.views\./, '').replace(/\.views\./g, '_view.')}_view`;
const viewPath = `${`${this.tsCalleeNamespace}.${this.tsName}`
.replace(/^app\..+?.views\./, '')
.replace(/\.views\./g, '_view.')}_view`;
code += `nasl.ui.destination('${this?.frontend?.name}.${viewPath}'`;

@@ -609,0 +611,0 @@ if (logicParamLength > 0) {

@@ -23,4 +23,2 @@ import BaseSetter from './BaseSetter__';

title?: string;
useCustomIconFont?: string;
disableOnlySvg?: boolean;
/**

@@ -27,0 +25,0 @@ * @param source 需要合并的部分参数

@@ -50,8 +50,2 @@ "use strict";

], IconSetter.prototype, "title", void 0);
__decorate([
(0, decorators_1.property)()
], IconSetter.prototype, "useCustomIconFont", void 0);
__decorate([
(0, decorators_1.property)()
], IconSetter.prototype, "disableOnlySvg", void 0);
exports.IconSetter = IconSetter = IconSetter_1 = __decorate([

@@ -58,0 +52,0 @@ (0, decorators_1.concept)('图标设置器')

@@ -54,2 +54,4 @@ import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';

get businessComponent(): BusinessComponent;
get isViewElement(): boolean;
getViewElementName(): string;
toEmbeddedTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>, options?: any): TranslatorGenerator;

@@ -60,2 +62,3 @@ toNaturalTS(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>): string;

get completeName(): string;
private get viewElementCompleteName();
/**

@@ -62,0 +65,0 @@ * 设置函数名称

@@ -40,6 +40,6 @@ "use strict";

const service_1 = require("../service");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");
const asserts = __importStar(require("./utils/asserts"));
const LogicItem__1 = __importDefault(require("./LogicItem__"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -234,3 +234,3 @@ * 标识符

const nameInComponentLike = semanticData_1.varScopeCtx.varInViewOrComponent.has(name) || semanticData_1.varScopeCtx.logicInViewOrComponent.has(name);
return nameInComponentLike ||
return (nameInComponentLike ||
this.globalDataMap[name] ||

@@ -242,3 +242,3 @@ namespace?.endsWith('nasl.browser') ||

this.isEnum() ||
this.isFrontendVariables;
this.isFrontendVariables);
}

@@ -251,2 +251,20 @@ toBrief() {

}
get isViewElement() {
if (this.namespace?.startsWith('elements.') && this.namespace?.endsWith('.property')) {
return true;
}
return false;
}
getViewElementName() {
let elementName;
if (this.isViewElement) {
if (this.namespace?.startsWith('elements.$ce')) {
elementName = this.getAncestor('ViewElement')?.name;
}
else {
elementName = this.name;
}
}
return elementName;
}
*toEmbeddedTS(state = (0, nasl_translator_1.createCompilerState)(), options) {

@@ -358,2 +376,6 @@ const self = this;

}
// 组件属性
if (this.isViewElement) {
return `__elements.${this.getViewElementName()}`;
}
return self.namespace ? `${self.namespace}.${self.name}` : self.name || '__IDENTIFIER__';

@@ -401,2 +423,5 @@ }

get completeName() {
if (this.isViewElement) {
return this.viewElementCompleteName;
}
const arr = [this.name];

@@ -408,2 +433,12 @@ if (this.namespace) {

}
get viewElementCompleteName() {
let name;
if (this.namespace?.startsWith('elements.$ce')) {
name = '$ce';
}
else {
name = this.name;
}
return `elements_${name}`;
}
/**

@@ -410,0 +445,0 @@ * 设置函数名称

@@ -64,8 +64,4 @@ import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';

* 断点状态
* undefined ==> 未设置
* null ==> 已删除
* 'ENABLED' ==> 启用断点
* 'DISABLED' ==> 禁用断点
*/
breakpoint: 'ENABLED' | 'DISABLED' | null | undefined;
breakpoint?: 'ENABLED' | 'DISABLED';
/**

@@ -72,0 +68,0 @@ * @param source 需要合并的部分参数

@@ -55,3 +55,3 @@ import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';

*/
_insertLogicItemAt(name: string, index: number): types.LogicItemNode;
_insertLogicItemInPatternsAt(name: string, index: number): types.LogicItemNode;
/**

@@ -62,3 +62,3 @@ * 插入逻辑项

*/
_insertLogicItemAt(logicItemOptions: Partial<types.LogicItemNode>, index: number): types.LogicItemNode;
_insertLogicItemInPatternsAt(logicItemOptions: Partial<types.LogicItemNode>, index: number): types.LogicItemNode;
/**

@@ -69,3 +69,3 @@ * 插入逻辑项

*/
_insertLogicItemAt(logicItem: types.LogicItemNode, index: number): types.LogicItemNode;
_insertLogicItemInPatternsAt(logicItem: types.LogicItemNode, index: number): types.LogicItemNode;
/**

@@ -75,3 +75,3 @@ * 插入逻辑项

*/
insertLogicItemAt(name: string, index: number): types.LogicItemNode;
insertLogicItemInPatternsAt(name: string, index: number): types.LogicItemNode;
/**

@@ -81,3 +81,3 @@ * 插入逻辑项

*/
insertLogicItemAt(logicItemOptions: Partial<types.LogicItemNode>, index: number): types.LogicItemNode;
insertLogicItemInPatternsAt(logicItemOptions: Partial<types.LogicItemNode>, index: number): types.LogicItemNode;
/**

@@ -87,3 +87,3 @@ * 插入逻辑项

*/
insertLogicItemAt(logicItem: types.LogicItemNode, index: number): types.LogicItemNode;
insertLogicItemInPatternsAt(logicItem: types.LogicItemNode, index: number): types.LogicItemNode;
/**

@@ -94,3 +94,3 @@ * 添加逻辑项

*/
_addLogicItem(name?: string): types.LogicItemNode;
_addLogicItemInPatterns(name?: string): types.LogicItemNode;
/**

@@ -101,3 +101,3 @@ * 添加逻辑项

*/
_addLogicItem(logicItemOptions: Partial<types.LogicItemNode>): types.LogicItemNode;
_addLogicItemInPatterns(logicItemOptions: Partial<types.LogicItemNode>): types.LogicItemNode;
/**

@@ -108,3 +108,3 @@ * 添加逻辑项

*/
_addLogicItem(logicItem: types.LogicItemNode): types.LogicItemNode;
_addLogicItemInPatterns(logicItem: types.LogicItemNode): types.LogicItemNode;
/**

@@ -115,3 +115,3 @@ * 添加逻辑项

*/
addLogicItem(name?: string): types.LogicItemNode;
addLogicItemInPatterns(name?: string): types.LogicItemNode;
/**

@@ -121,3 +121,3 @@ * 添加逻辑项

*/
addLogicItem(logicItemOptions: Partial<types.LogicItemNode>): types.LogicItemNode;
addLogicItemInPatterns(logicItemOptions: Partial<types.LogicItemNode>): types.LogicItemNode;
/**

@@ -127,3 +127,3 @@ * 添加逻辑项

*/
addLogicItem(logicItem: types.LogicItemNode): types.LogicItemNode;
addLogicItemInPatterns(logicItem: types.LogicItemNode): types.LogicItemNode;
/**

@@ -180,3 +180,3 @@ * 插入逻辑项

*/
_insertTypeAnnotationAt(name: string, index: number): TypeAnnotation;
_insertTypeAnnotationInPatternsAt(name: string, index: number): TypeAnnotation;
/**

@@ -187,3 +187,3 @@ * 插入类型标注

*/
_insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
_insertTypeAnnotationInPatternsAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
/**

@@ -194,3 +194,3 @@ * 插入类型标注

*/
_insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
_insertTypeAnnotationInPatternsAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
/**

@@ -200,3 +200,3 @@ * 插入类型标注

*/
insertTypeAnnotationAt(name: string, index: number): TypeAnnotation;
insertTypeAnnotationInPatternsAt(name: string, index: number): TypeAnnotation;
/**

@@ -206,3 +206,3 @@ * 插入类型标注

*/
insertTypeAnnotationAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
insertTypeAnnotationInPatternsAt(typeAnnotationOptions: Partial<TypeAnnotation>, index: number): TypeAnnotation;
/**

@@ -212,3 +212,3 @@ * 插入类型标注

*/
insertTypeAnnotationAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
insertTypeAnnotationInPatternsAt(typeAnnotation: TypeAnnotation, index: number): TypeAnnotation;
/**

@@ -219,3 +219,3 @@ * 添加类型标注

*/
_addTypeAnnotation(name?: string): TypeAnnotation;
_addTypeAnnotationInPatterns(name?: string): TypeAnnotation;
/**

@@ -226,3 +226,3 @@ * 添加类型标注

*/
_addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
_addTypeAnnotationInPatterns(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
/**

@@ -233,3 +233,3 @@ * 添加类型标注

*/
_addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
_addTypeAnnotationInPatterns(typeAnnotation: TypeAnnotation): TypeAnnotation;
/**

@@ -240,3 +240,3 @@ * 添加类型标注

*/
addTypeAnnotation(name?: string): TypeAnnotation;
addTypeAnnotationInPatterns(name?: string): TypeAnnotation;
/**

@@ -246,3 +246,3 @@ * 添加类型标注

*/
addTypeAnnotation(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
addTypeAnnotationInPatterns(typeAnnotationOptions: Partial<TypeAnnotation>): TypeAnnotation;
/**

@@ -252,3 +252,3 @@ * 添加类型标注

*/
addTypeAnnotation(typeAnnotation: TypeAnnotation): TypeAnnotation;
addTypeAnnotationInPatterns(typeAnnotation: TypeAnnotation): TypeAnnotation;
/**

@@ -258,3 +258,3 @@ * 删除逻辑项

*/
removeLogicItem(name: string): void;
removeLogicItemInPatterns(name: string): void;
/**

@@ -264,3 +264,3 @@ * 删除逻辑项

*/
removeLogicItem(logicItem: types.LogicItemNode): void;
removeLogicItemInPatterns(logicItem: types.LogicItemNode): void;
/**

@@ -275,3 +275,3 @@ * 删除逻辑项

*/
removeTypeAnnotation(name: string): void;
removeTypeAnnotationInPatterns(name: string): void;
/**

@@ -281,3 +281,3 @@ * 删除类型标注

*/
removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
removeTypeAnnotationInPatterns(typeAnnotation: TypeAnnotation): void;
get isDisabled(): boolean;

@@ -284,0 +284,0 @@ get isSlotTypeError(): boolean;

@@ -109,3 +109,3 @@ "use strict";

}
_insertLogicItemAt(options, index) {
_insertLogicItemInPatternsAt(options, index) {
const logicItemOptions = {};

@@ -141,4 +141,4 @@ const relationOptions = { parentNode: this, parentKey: 'patterns' };

}
insertLogicItemAt(options, index) {
const node = this._insertLogicItemAt(options, index);
insertLogicItemInPatternsAt(options, index) {
const node = this._insertLogicItemInPatternsAt(options, index);
node.create({

@@ -151,8 +151,8 @@ index,

}
_addLogicItem(options) {
_addLogicItemInPatterns(options) {
const index = this.patterns.length;
return this._insertLogicItemAt(options, index);
return this._insertLogicItemInPatternsAt(options, index);
}
addLogicItem(options) {
const node = this._addLogicItem(options);
addLogicItemInPatterns(options) {
const node = this._addLogicItemInPatterns(options);
const index = this.patterns.indexOf(node);

@@ -217,3 +217,3 @@ node.create({

}
_insertTypeAnnotationAt(options, index) {
_insertTypeAnnotationInPatternsAt(options, index) {
const typeAnnotationOptions = {};

@@ -249,4 +249,4 @@ const relationOptions = { parentNode: this, parentKey: 'patterns' };

}
insertTypeAnnotationAt(options, index) {
const node = this._insertTypeAnnotationAt(options, index);
insertTypeAnnotationInPatternsAt(options, index) {
const node = this._insertTypeAnnotationInPatternsAt(options, index);
node.create({

@@ -259,8 +259,8 @@ index,

}
_addTypeAnnotation(options) {
_addTypeAnnotationInPatterns(options) {
const index = this.patterns.length;
return this._insertTypeAnnotationAt(options, index);
return this._insertTypeAnnotationInPatternsAt(options, index);
}
addTypeAnnotation(options) {
const node = this._addTypeAnnotation(options);
addTypeAnnotationInPatterns(options) {
const node = this._addTypeAnnotationInPatterns(options);
const index = this.patterns.indexOf(node);

@@ -274,3 +274,3 @@ node.create({

}
removeLogicItem(options) {
removeLogicItemInPatterns(options) {
let logicItem;

@@ -292,3 +292,3 @@ if (typeof options === 'string') {

}
removeTypeAnnotation(options) {
removeTypeAnnotationInPatterns(options) {
let typeAnnotation;

@@ -295,0 +295,0 @@ if (typeof options === 'string') {

import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';
import { TypeAnnotation } from '..';
import { TypeAnnotation, BusinessComponent, View } from '..';
import { ElementToVueOptions } from './ViewElement__';

@@ -37,2 +37,5 @@ import * as types from './utils/types';

typeAnnotation: TypeAnnotation;
get isViewElementProperty(): boolean;
private get viewElementPropertyCompleteName();
getViewElementName(): string;
toVue(options?: ElementToVueOptions): string;

@@ -50,3 +53,3 @@ toUI(state?: TranslatorState, hideDetails?: boolean): string;

getValue(): string;
transformAtrrLogic(options?: {
transfromAttrLogic(options?: {
type: 'toVue' | 'toJS';

@@ -56,2 +59,3 @@ }): string;

get rootName(): string;
get likeComponent(): View | BusinessComponent;
/**

@@ -58,0 +62,0 @@ * 翻译

@@ -37,5 +37,3 @@ "use strict";

exports.MemberExpression = void 0;
const nasl_utils_1 = require("@lcap/nasl-utils");
const nasl_translator_1 = require("@lcap/nasl-translator");
const store_1 = require("../store");
const Identifier_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;

@@ -76,61 +74,70 @@ const decorators_1 = require("../decorators");

}
toVue(options) {
// 如果是枚举取值
if (this.object?.concept === 'Identifier' &&
this.object?.isEnum() &&
this.property?.concept === 'Identifier') {
return `"${this.property?.name}"`;
get isViewElementProperty() {
if (asserts.isIdentifier(this.object) &&
this.object?.namespace?.startsWith('elements.') &&
this.object?.namespace?.endsWith('.property')) {
return true;
}
if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') &&
this.property?.name === 'length') {
return `Object.keys(${this.object?.toJS()}).length`;
if (asserts.isMemberExpression(this.object) &&
this.object?.object?.name === 'elements' &&
this.object?.property?.name === '$ce') {
return true;
}
return false;
}
get viewElementPropertyCompleteName() {
let name;
if (asserts.isIdentifier(this.object) &&
this.object?.namespace?.startsWith('elements.') &&
this.object?.namespace?.endsWith('.property')) {
let elementName;
let element;
let elementTag;
if (this.object?.namespace?.startsWith('elements.$ce')) {
elementName = this.getAncestor('ViewElement')?.name;
name = '$ce';
}
else {
elementName = this.object.name;
name = this.object.name;
}
// 根据elementName获取组件tag
const view = this.getAncestor('BusinessComponent') || this.getAncestor('View');
if (view) {
element = view?.getViewElementByName(elementName);
elementTag = element?.tag;
}
const config = (0, store_1.getConfig)();
if (config?.allNodesAPI &&
config?.allNodesAPI[elementTag] &&
config?.allNodesAPI[elementTag].readablePropsMap &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name] &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name].state) {
const { prop } = config?.allNodesAPI[elementTag].readablePropsMap[this.property.name];
if (!['data'].includes(this.property.name)) {
return `this && this.__${elementName}_params && this.__${elementName}_params.${this.property.name}`;
}
else if (asserts.isMemberExpression(this.object) &&
this.object?.object?.name === 'elements' &&
this.object?.property?.name === '$ce') {
name = '$ce';
}
return `elements_${name}.${this.property.name}`;
}
getViewElementName() {
let elementName;
if (this.isViewElementProperty) {
if (asserts.isIdentifier(this.object) &&
this.object?.namespace?.startsWith('elements.') &&
this.object?.namespace?.endsWith('.property')) {
if (this.object?.namespace?.startsWith('elements.$ce')) {
elementName = this.getAncestor('ViewElement')?.name;
}
return `__${elementName}_${prop}`;
else {
elementName = this.object.name;
}
}
if (['size', 'page', 'sort', 'order', 'filterText'].includes(this.property.name)) {
return `__${elementName}_param && __${elementName}_params.${this.property.name}`;
else if (asserts.isMemberExpression(this.object) &&
this.object?.object?.name === 'elements' &&
this.object?.property?.name === '$ce') {
elementName = this.getAncestor('ViewElement')?.name;
}
let propertyName = '';
let subProperty = '';
if (asserts.isIdentifier(this.property) && this.property?.namespace) {
const namespace = this.property?.namespace ?? '';
const namespaceList = namespace?.includes('.') ? namespace?.split('.') : [namespace];
[propertyName] = namespaceList;
subProperty = namespaceList?.[1] ? `?.()['${namespaceList?.[1]}']` : '';
}
return `__${elementName}_${(0, nasl_utils_1.attrConvertCamelCase)(propertyName)}${subProperty}`;
}
if (asserts.isMemberExpression(this.object) &&
this.object?.object?.name === 'elements' &&
this.object?.property?.name === '$ce') {
return this.transformAtrrLogic({ type: 'toVue' });
return elementName;
}
toVue(options) {
// 如果是枚举取值
if (this.object?.concept === 'Identifier' &&
this.object?.isEnum() &&
this.property?.concept === 'Identifier') {
return `"${this.property?.name}"`;
}
if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') &&
this.property?.name === 'length') {
return `Object.keys(${this.object?.toJS()}).length`;
}
// 组件属性
if (this.isViewElementProperty) {
return this.transfromAttrLogic({ type: 'toVue' });
}
const object = String(this.object?.toVue(options)); // undefined 也让正常展示

@@ -187,52 +194,6 @@ const property = String(this.property?.toVue(options));

}
if (asserts.isIdentifier(this.object) &&
asserts.isIdentifier(this.property) &&
/^elements.(.+).property$/.test(this.object?.namespace)) {
let elementName;
let element;
let elementTag;
if (this.object?.namespace?.startsWith('elements.$ce')) {
elementName = this.getAncestor('ViewElement')?.name;
}
else {
elementName = this.object.name;
}
// 根据elementName获取组件tag
const view = this.getAncestor('BusinessComponent') || this.getAncestor('View');
if (view) {
element = view?.getViewElementByName(elementName);
elementTag = element?.tag;
}
const config = (0, store_1.getConfig)();
if (config?.allNodesAPI &&
config?.allNodesAPI[elementTag] &&
config?.allNodesAPI[elementTag].readablePropsMap &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name] &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name].state) {
const { prop } = config?.allNodesAPI[elementTag].readablePropsMap[this.property.name];
if (!['data'].includes(this.property.name)) {
return `this['__${elementName}_params'] && this['__${elementName}_params'].${this.property.name}`;
}
return `this.__${elementName}_${prop}`;
}
if (['size', 'page', 'sort', 'order', 'filterText'].includes(this.property.name)) {
return `this.__${elementName}_params && this.__${elementName}_params.${this.property.name}`;
}
let propertyName = '';
let subProperty = '';
if (asserts.isIdentifier(this.property) && this.property?.namespace) {
const namespace = this.property?.namespace ?? '';
const namespaceList = namespace?.includes('.') ? namespace?.split('.') : [namespace];
[propertyName] = namespaceList;
subProperty = namespaceList?.[1] ? `?.()['${namespaceList?.[1]}']` : '';
}
return `this.__${elementName}_${(0, nasl_utils_1.attrConvertCamelCase)(propertyName)}${subProperty}`;
// 组件属性
if (this.isViewElementProperty) {
return this.transfromAttrLogic({ type: 'toJS' });
}
if (
// template 拖入生成的nasl节点
asserts.isMemberExpression(this.object) &&
this.object?.object?.name === 'elements' &&
this.object?.property?.name === '$ce') {
return this.transformAtrrLogic();
}
const object = this.object?.toJS(state);

@@ -334,32 +295,27 @@ const property = this.property?.toJS(state);

}
transformAtrrLogic(options) {
transfromAttrLogic(options) {
const { type = 'toJS' } = options || {};
const elementName = this.getAncestor('ViewElement')?.name;
// varScopeCtx.isFirstScreen
// ? varScopeCtx.memExprToViewElem.get(this)?.name
// : this.getAncestor('ViewElement')?.name;
let element;
let elementTag;
// 根据elementName获取组件tag
const view = this.getAncestor('BusinessComponent') || this.getAncestor('View');
if (view) {
element = view?.getViewElementByName(elementName);
elementTag = element?.tag;
}
const prefix = type === 'toVue' ? '' : 'this.';
const config = (0, store_1.getConfig)();
if (config?.allNodesAPI &&
config?.allNodesAPI[elementTag] &&
config?.allNodesAPI[elementTag].readablePropsMap &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name] &&
config?.allNodesAPI[elementTag].readablePropsMap[this.property.name].state) {
const { prop } = config?.allNodesAPI[elementTag].readablePropsMap[this.property.name];
if (!['data'].includes(this.property.name)) {
return `${prefix}__${elementName}_params && ${prefix}__${elementName}_params.${this.property.name}`;
}
return `${prefix}__${elementName}_${prop}`;
const self = this;
const elementName = self.getViewElementName();
let middwareVariableName = `${prefix}${elementName}`;
// 赋值情况
const isAssignment = self.upperNode?.concept === 'Assignment' && self.upperNode?.left === self;
const isBatchAssignment = self.upperNode?.concept === 'SelectMembers' && self.upperNode?.upperNode?.concept === 'BatchAssignment' && self.upperNode?.upperNode?.left === self.upperNode;
if (self.property.name === '_if') { // _if取值也从prop里取
middwareVariableName += '_';
}
return `${prefix}__${elementName}_params && ${prefix}__${elementName}_params.${this.property.name}`;
else if (isAssignment || isBatchAssignment) {
middwareVariableName += '_prop_';
}
else {
middwareVariableName += '_state_';
}
middwareVariableName += self.property.name;
return middwareVariableName;
}
get completeName() {
if (this.isViewElementProperty) {
return this.viewElementPropertyCompleteName;
}
const object = this.object?.completeName;

@@ -402,2 +358,5 @@ const property = this.property?.completeName;

}
get likeComponent() {
return this.view || this?.getAncestor('BusinessComponent');
}
/**

@@ -436,31 +395,22 @@ * 翻译

}
if (asserts.isIdentifier(self.object) &&
self.object?.namespace?.startsWith('elements.') &&
self.object?.namespace?.endsWith('.property')) {
// 组件属性
if (this.isViewElementProperty) {
let newCode = '';
if (self.object?.namespace?.startsWith('elements.$ce')) {
const elementName = self.getAncestor('ViewElement')?.name;
newCode += `__elements['${elementName}']`;
if (asserts.isIdentifier(self.property) && self.property?.name) {
newCode += `['${self.property?.name}']`;
}
let elementName = self.getViewElementName();
// 赋值情况
const isAssignment = self.upperNode?.concept === 'Assignment' && self.upperNode?.left === self;
const isBatchAssignment = self.upperNode?.concept === 'SelectMembers' && self.upperNode?.upperNode?.concept === 'BatchAssignment' && self.upperNode?.upperNode?.left === self.upperNode;
if (isAssignment || isBatchAssignment) {
const element = self.likeComponent.getViewElementByName(elementName);
// FIXME: 这里的代码可能有问题,依赖库的不在nasl.ui下
newCode += 'new nasl.ui.' + element?.tag.replace(/^\S/, (s) => s.toUpperCase())
.replace(/-(\w)/g, (all, letter) => letter.toUpperCase()) + 'Options()';
newCode += `.${self.property.name}`;
}
else {
newCode += `__elements['${self.object?.name}']`;
if (asserts.isIdentifier(self.property) && self.property?.name) {
newCode += `['${self.property?.name}']`;
}
newCode += `__elements['${elementName}']`;
newCode += `.${self.property?.name}`;
}
return newCode;
}
// 实体模板拖出来时生成的nasl节点情况
if (asserts.isMemberExpression(self.object) &&
self.object?.object?.name === 'elements' &&
self.object?.property?.name === '$ce') {
let newCode = '';
const elementName = self.getAncestor('ViewElement')?.name;
newCode += `__elements['${elementName}']`;
newCode += `.${self.property?.name}`;
return newCode;
}
return code;

@@ -467,0 +417,0 @@ }

@@ -589,3 +589,3 @@ type PropertyType = 'structures' | 'enums' | 'entities' | 'interfaces' | 'processes' | 'views';

*/
_insertVariableAt(name: string, index: number): Variable;
_insertVariableInFrontendVariablesAt(name: string, index: number): Variable;
/**

@@ -596,3 +596,3 @@ * 插入变量

*/
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
_insertVariableInFrontendVariablesAt(variableOptions: Partial<Variable>, index: number): Variable;
/**

@@ -603,3 +603,3 @@ * 插入变量

*/
_insertVariableAt(variable: Variable, index: number): Variable;
_insertVariableInFrontendVariablesAt(variable: Variable, index: number): Variable;
/**

@@ -609,3 +609,3 @@ * 插入变量

*/
insertVariableAt(name: string, index: number): Variable;
insertVariableInFrontendVariablesAt(name: string, index: number): Variable;
/**

@@ -615,3 +615,3 @@ * 插入变量

*/
insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
insertVariableInFrontendVariablesAt(variableOptions: Partial<Variable>, index: number): Variable;
/**

@@ -621,3 +621,3 @@ * 插入变量

*/
insertVariableAt(variable: Variable, index: number): Variable;
insertVariableInFrontendVariablesAt(variable: Variable, index: number): Variable;
/**

@@ -628,3 +628,3 @@ * 添加变量

*/
_addVariable(name?: string): Variable;
_addVariableInFrontendVariables(name?: string): Variable;
/**

@@ -635,3 +635,3 @@ * 添加变量

*/
_addVariable(variableOptions: Partial<Variable>): Variable;
_addVariableInFrontendVariables(variableOptions: Partial<Variable>): Variable;
/**

@@ -642,3 +642,3 @@ * 添加变量

*/
_addVariable(variable: Variable): Variable;
_addVariableInFrontendVariables(variable: Variable): Variable;
/**

@@ -649,3 +649,3 @@ * 添加变量

*/
addVariable(name?: string): Variable;
addVariableInFrontendVariables(name?: string): Variable;
/**

@@ -655,3 +655,3 @@ * 添加变量

*/
addVariable(variableOptions: Partial<Variable>): Variable;
addVariableInFrontendVariables(variableOptions: Partial<Variable>): Variable;
/**

@@ -661,3 +661,3 @@ * 添加变量

*/
addVariable(variable: Variable): Variable;
addVariableInFrontendVariables(variable: Variable): Variable;
getProcessExistingNames(excludedList?: Array<Process>): string[];

@@ -1210,3 +1210,3 @@ getProcessUniqueName(name?: string): string;

*/
removeVariable(name: string): void;
removeVariableInFrontendVariables(name: string): void;
/**

@@ -1216,3 +1216,3 @@ * 删除变量

*/
removeVariable(variable: Variable): void;
removeVariableInFrontendVariables(variable: Variable): void;
/**

@@ -1219,0 +1219,0 @@ * 删除流程

@@ -548,3 +548,3 @@ "use strict";

}
_insertVariableAt(options, index) {
_insertVariableInFrontendVariablesAt(options, index) {
const variableOptions = {};

@@ -580,4 +580,4 @@ const relationOptions = { parentNode: this, parentKey: 'frontendVariables' };

}
insertVariableAt(options, index) {
const node = this._insertVariableAt(options, index);
insertVariableInFrontendVariablesAt(options, index) {
const node = this._insertVariableInFrontendVariablesAt(options, index);
node.create({

@@ -590,8 +590,8 @@ index,

}
_addVariable(options) {
_addVariableInFrontendVariables(options) {
const index = this.frontendVariables.length;
return this._insertVariableAt(options, index);
return this._insertVariableInFrontendVariablesAt(options, index);
}
addVariable(options) {
const node = this._addVariable(options);
addVariableInFrontendVariables(options) {
const node = this._addVariableInFrontendVariables(options);
const index = this.frontendVariables.indexOf(node);

@@ -1116,3 +1116,3 @@ node.create({

}
removeVariable(options) {
removeVariableInFrontendVariables(options) {
let variable;

@@ -1119,0 +1119,0 @@ if (typeof options === 'string') {

@@ -41,2 +41,3 @@ "use strict";

const process2LogicNamespace_1 = require("../service/process2LogicNamespace");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -46,3 +47,2 @@ const utils = __importStar(require("../utils"));

const BaseNode_1 = __importDefault(require("../common/BaseNode"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -49,0 +49,0 @@ * 流程

@@ -40,2 +40,3 @@ "use strict";

const getProcesses_1 = require("../service/getProcesses");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -45,3 +46,2 @@ const utils = __importStar(require("../utils"));

const BaseNode_1 = __importDefault(require("../common/BaseNode"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -48,0 +48,0 @@ * 流程元素

@@ -41,2 +41,3 @@ "use strict";

const getProcessesV2_1 = require("../service/getProcessesV2");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -46,3 +47,2 @@ const utils = __importStar(require("../utils"));

const BaseNode_1 = __importDefault(require("../common/BaseNode"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -49,0 +49,0 @@ * 流程元素

@@ -42,2 +42,3 @@ "use strict";

const utils_2 = require("../utils");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -47,3 +48,2 @@ const utils = __importStar(require("../utils"));

const BaseNode_1 = __importDefault(require("../common/BaseNode"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -50,0 +50,0 @@ * 流程

@@ -1,2 +0,1 @@

import type { BaseNode } from '../common/BaseNode';
import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';

@@ -9,3 +8,2 @@ import type ForEachStatement from './ForEachStatement__';

import type CallFunction from './CallFunction__';
import type Logic from './Logic__';
import * as types from './utils/types';

@@ -414,3 +412,3 @@ import LogicItem from './LogicItem__';

toEmbeddedTSInProcess(state?: import("@lcap/nasl-types/out/translator").TranslatorState<import("@lcap/nasl-types/out/concept").BaseNode>, prependCode?: string, noName?: boolean, prefix?: boolean): TranslatorGenerator;
saveStructureOfCallQueryComponents(root?: BaseNode | Logic): Promise<void>;
saveStructureOfCallQueryComponents(root?: SubLogic): Promise<void>;
subLogics: SubLogic[];

@@ -417,0 +415,0 @@ getSubLogics(): void;

@@ -39,2 +39,3 @@ "use strict";

const nasl_translator_1 = require("@lcap/nasl-translator");
const semanticData_1 = require("../semantics/semanticData");
const decorators_1 = require("../decorators");

@@ -44,3 +45,2 @@ const utils = __importStar(require("../utils"));

const LogicItem__1 = __importDefault(require("./LogicItem__"));
const semanticData_1 = require("../semantics/semanticData");
/**

@@ -47,0 +47,0 @@ * 子逻辑

@@ -702,2 +702,10 @@ import type { Embedded } from '@lcap/nasl-types';

getViewExpressions(): any[];
viewElementPropertyUsage: {
getter: Record<string, string[]>;
setter: Record<string, string[]>;
};
getViewElementPropertyUsage(): {
getter: Record<string, string[]>;
setter: Record<string, string[]>;
};
/**

@@ -704,0 +712,0 @@ * @param path 子路径

@@ -666,4 +666,5 @@ import { TranslatorState, TranslatorGenerator } from '@lcap/nasl-translator';

getAncestorByTag<Node extends types.SyntaxNode = types.SyntaxNode>(concept: types.SyntaxNode['concept'], tag: string): Node;
getMaxZIndex(): number;
}
export default ViewElement;
//# sourceMappingURL=ViewElement__.d.ts.map
import type { BaseNode } from '../common';
import type { LogicItem } from '../concepts/LogicItem__';
import type { SyntaxNode } from '../concepts/utils/types';

@@ -10,3 +11,3 @@ export * from './utils';

*/
export declare function property(params?: any): (target: SyntaxNode | BaseNode, key: string) => void;
export declare function property(params?: any): (target: SyntaxNode | LogicItem | BaseNode, key: string) => void;
/**

@@ -17,3 +18,3 @@ * 实例化的白名单属性

*/
export declare function whiteProperty(params?: any): (target: SyntaxNode | BaseNode, key: string) => void;
export declare function whiteProperty(params?: any): (target: SyntaxNode | LogicItem | BaseNode, key: string) => void;
/**

@@ -20,0 +21,0 @@ * 该属性排除于 JSON 中

import { CompletionProperty, Identifier, Enum, SyntaxNode } from '../concepts';
import { BaseNode } from '../common';
export declare function formatEnums(enums: Array<Enum>): CompletionProperty[];
export declare function getMemberIdentifier(node: SyntaxNode): Promise<{
export declare function getMemberIdentifier(node: SyntaxNode, params?: {
elemPropKey?: 'readablePropsMap' | 'propsMap';
}): Promise<{
name: string;

@@ -18,3 +20,5 @@ children: CompletionProperty[];

export declare function getConfigsIdentifier(node: BaseNode): CompletionProperty[];
export declare function getPageComponentsIdentifier(node: SyntaxNode): CompletionProperty[];
export declare function getPageComponentsIdentifier(node: SyntaxNode, params: {
elemPropKey?: 'readablePropsMap' | 'propsMap';
}): CompletionProperty[];
//# sourceMappingURL=getMemberIdentifier.d.ts.map

@@ -195,3 +195,3 @@ "use strict";

}
async function getMemberIdentifier(node) {
async function getMemberIdentifier(node, params) {
if (node) {

@@ -225,3 +225,3 @@ // 获取字面量

// 获取页面组件
const pageComponents = await getPageComponentsIdentifier(node);
const pageComponents = await getPageComponentsIdentifier(node, params);
result.push({ name: '页面组件', children: pageComponents, expanded: true, icon: 'category' });

@@ -231,3 +231,3 @@ }

// 获取页面组件
const pageComponents = await getPageComponentsIdentifier(node);
const pageComponents = await getPageComponentsIdentifier(node, params);
result.push({ name: '组件元素', children: pageComponents, expanded: true, icon: 'category' });

@@ -386,7 +386,7 @@ }

exports.getConfigsIdentifier = getConfigsIdentifier;
function flatElements(elements, componentList, nodeParentElement, currentAttriBute, parentNodeNames) {
function flatElements(elements, componentList, nodeParentElement, currentAttriBute, parentNodeNames, elemPropKey) {
const config = (0, store_1.getConfig)();
elements?.forEach((item) => {
// 根据readablePropsMap添加
if (config?.allNodesAPI[item.tag] && config?.allNodesAPI[item.tag].readablePropsMap) {
if (config?.allNodesAPI[item.tag] && config?.allNodesAPI[item.tag][elemPropKey]) {
// 是否当前组件

@@ -403,5 +403,5 @@ const isCurrent = item.name === nodeParentElement;

};
for (const key in config?.allNodesAPI[item.tag].readablePropsMap) {
if (Object.prototype.hasOwnProperty.call(config?.allNodesAPI[item.tag].readablePropsMap, key)) {
const property = config?.allNodesAPI[item.tag].readablePropsMap[key];
for (const key in config?.allNodesAPI[item.tag][elemPropKey]) {
if (Object.prototype.hasOwnProperty.call(config?.allNodesAPI[item.tag][elemPropKey], key)) {
const property = config?.allNodesAPI[item.tag][elemPropKey][key];
// 如果是当前组件,过滤掉当前属性

@@ -440,7 +440,7 @@ if (!isCurrent || currentAttriBute !== property.prop) {

if (isInclude) {
flatElements(item.children, componentList, nodeParentElement, currentAttriBute, parentNodeNames);
flatElements(item.children, componentList, nodeParentElement, currentAttriBute, parentNodeNames, elemPropKey);
}
}
else {
flatElements(item.children, componentList, nodeParentElement, currentAttriBute, parentNodeNames);
flatElements(item.children, componentList, nodeParentElement, currentAttriBute, parentNodeNames, elemPropKey);
}

@@ -451,3 +451,3 @@ }

// 获取页面组件
function getPageComponentsIdentifier(node) {
function getPageComponentsIdentifier(node, params) {
const { fileNode } = node.getCurrentSource();

@@ -461,3 +461,3 @@ const stashElements = fileNode.elements;

getViewElementPath(node.parentNode, parentNodeNames);
flatElements(stashElements, componentList, nodeParentElement, currentAttriBute, parentNodeNames);
flatElements(stashElements, componentList, nodeParentElement, currentAttriBute, parentNodeNames, params?.elemPropKey || 'readablePropsMap');
return componentList;

@@ -464,0 +464,0 @@ }

@@ -148,3 +148,2 @@ "use strict";

const codeLoad = `async '__${element.name}_handleDataSourceLoad'(params${currentParamList.join('')}) {
this['__${element.name}_params'] = {...params};
return ${variable}

@@ -184,3 +183,2 @@ }`;

const codeLoad = `async '__${element.name}_handleDataSourceLoad'(params${currentParamList.join('')}) {
this['__${element.name}_params'] = {...params};
return ${variable}

@@ -192,71 +190,40 @@ }`;

});
definition.elements.forEach(element => {
element.bindAttrs
.forEach((attr) => {
let variable = '';
if (attr.expression) {
variable += `${attr.expression.toJS()}`;
// attrsData.push(code)
const { getter = {}, setter = {} } = definition.elementProperties || {};
Object.keys(getter).forEach((key) => {
for (let i = 0; i < getter[key].length; i++) {
const state = getter[key][i];
if (state === '_if') {
viewVariablesData.push(`${key}_${state}: true`);
}
else if (attr.type === 'static') {
variable = `${attr.value}`;
// attrsData.push(code)
else {
viewVariablesData.push(`${key}_state_${state}: undefined`);
}
if (attr.expression?.concept === 'CallLogic' && attr.name === 'dataSource') {
const code = `async '__${element.name}_dataSource'(params) {
return ${variable}
}`;
viewMethodData.push(code);
}
});
Object.keys(setter).forEach((key) => {
const element = definition.elementsAll.find((item) => item.name === key);
for (let i = 0; i < setter[key].length; i++) {
const prop = setter[key][i];
if (prop === '_if') {
viewVariablesData.push(`${key}_${prop}: true`);
}
else {
const code = `'__${element.name}_${(0, nasl_utils_1.attrConvertCamelCase)(attr.name)}'(${variable.includes('(current || {}).item') ? 'current' : ''}) {
return ${variable?.trim()?.length > 0 ? variable : undefined}
}`;
viewMethodData.push(code);
let defaultValue = 'undefined';
for (let i = 0; i < element.bindAttrs.length; i++) {
const attr = element.bindAttrs[i];
if (attr.name === prop) {
if (attr.type === 'string') {
defaultValue = `\'${attr.value}\'`;
}
else if (attr.type === 'static') {
defaultValue = attr.value;
}
break;
}
}
viewVariablesData.push(`${key}_prop_${prop}: ${defaultValue}`);
}
});
// .filter((attr) => PAGE_COMPONENT_INCLUDE_TAG_MAP[element.tag]?.[attr.name])
// .forEach(attr => {
// let variable = '';
// if (attr.expression) {
// variable += `${attr.expression.toJS()}`
// // attrsData.push(code)
// } else if (attr.type === 'static') {
// variable = `${attr.value}`
// // attrsData.push(code)
// }
// if (attr.expression?.concept === 'CallLogic' && attr.name === 'dataSource') {
// const codeLoad = `async '__${element.name}_dataSourceLoad'(params) {
// this['__${element.name}_params'] = {...params};
// return ${variable}
// }`
// viewMethodData.push(codeLoad)
// const code = `async '__${element.name}_dataSource'(params) {
// return ${variable}
// }`
// viewMethodData.push(code)
// } else {
// const code = `'__${element.name}_${attrConvertCamelCase(attr.name)}'(${variable.includes('(current || {}).item') ? 'current' : ''}) {
// return ${variable?.trim()?.length > 0 ? variable : undefined}
// }`
// viewMethodData.push(code)
// }
// });
viewVariablesData.push(`['__${element.name}_params']: {}`);
// if (['u-select', 'van-pickerson'].includes(element.tag)) {
// viewMethodData.push(`['__${element.name}_page-number']() {
// return this['__${element.name}_params']?.page ?? 1
// }`)
// viewMethodData.push(`['__${element.name}_filterText']() {
// return this['__${element.name}_params']?.filterText ?? ''
// }`)
// } else if (['u-list-view', 'u-grid-view', 'u-table-view', 'van-list-view', 'van-grid-view'].includes(element.tag) && element.bindAttrs?.findIndex((attr) => attr.name === 'sorting') === -1) {
// viewMethodData.push(`['__${element.name}_sorting']() {
// return {
// field: undefined,
// order: undefined
// }
// }`)
// }
}
});
viewMethodData.push('onSync_State(elem, key, val) { this[`${elem}_state_${key}`] = val; }');
let viewExpressionMethods;

@@ -263,0 +230,0 @@ if (hasViewExpressions) {

{
"name": "@lcap/nasl-concepts",
"description": "NetEase Application Specific Language",
"version": "3.9.0-beta.15",
"version": "3.9.0-beta.16",
"author": "Forrest <rainforest92@126.com>",

@@ -40,6 +40,6 @@ "main": "./out",

"uuid": "8.3.2",
"@lcap/nasl-sentry": "3.9.0-beta.15",
"@lcap/nasl-translator": "3.9.0-beta.15",
"@lcap/nasl-utils": "3.9.0-beta.15",
"@lcap/nasl-types": "3.9.0-beta.15"
"@lcap/nasl-sentry": "3.9.0-beta.16",
"@lcap/nasl-translator": "3.9.0-beta.16",
"@lcap/nasl-utils": "3.9.0-beta.16",
"@lcap/nasl-types": "3.9.0-beta.16"
},

@@ -46,0 +46,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc