@lcap/asl
Version:
NetEase Application Specific Language
93 lines (92 loc) • 2.96 kB
TypeScript
import { Schema, Entity, EntityProperty, LEVEL_ENUM } from '../..';
import { Resolver } from '../Entity';
import { Display } from '../EntityProperty';
export declare const filterProperty: (key: 'inTable' | 'inFilter' | 'inForm' | 'inDetail') => (property: EntityProperty) => boolean;
/**
* 生成格式器的代码
* 后来没有用到
* @param property 实体属性
*/
export declare function getFormatter(property: EntityProperty): string;
/**
* 生成表达式的代码
* @param property 实体属性
* @param expression 表达式
*/
export declare function getExpression(property: EntityProperty, expression: string): string;
/**
* 根据数据结构名称获取数据结构实例
* @param structureName 数据结构名称
*/
export declare function getStructureByName(structureName: string): Schema;
/**
* 获取数据结构的 schema
* @param structureName 数据结构名称
*/
export declare function getSchemaOfStructure(structureName: string): {
$ref: string;
typeKey: string;
};
/**
* 从 Resolver 中获取变量
* @param resolver
* @param paramName
*/
export declare function getParamFromResolver(resolver: Resolver, paramName: string): import("../..").Param;
/**
* 生成泛型 Schema
* @param {String} name 泛型名称,如 ScopeOf
* @param {*} typeParamMap {'T': {$ref:'#/**'}}
* @param {*} dataTypesMap
* @returns 泛型
*/
export declare function genGenericTypeSchema(name: string, typeParamMap: {
[name: string]: {
$ref: string;
};
}): Schema;
export declare function genVariable(name: string, schema: Schema | string, level: LEVEL_ENUM): {
level: LEVEL_ENUM;
type: string;
name: string;
schema: Schema;
};
export declare function getFirstDisplayedProperty(entity: Entity, display?: keyof Display): EntityProperty;
/**
* 生成接口 Param
* @param paramIdOrName 参数 id 或引用名称
* @param expression 表达式
* @param schemaChildren 数据结构
*/
export declare function genInterParam(paramIdOrName: string, expression: string, schemaRefs?: Array<string>): {
parentAttr: string;
level: LEVEL_ENUM;
type: string;
callInterParam: string;
callInterParamValue: any;
};
/**
* 命名组,主要承载一次 mergeBlock 中的逻辑名称
*/
export interface NameGroup {
interface?: string;
structure?: string;
load?: string;
remove?: string;
modify?: string;
submit?: string;
lowerEntity?: string;
[key: string]: string;
}
/**
* 生成数据查询唯一的命名组
* @param viewName 页面名称
* @param componentName 组件名称
* @param suffix 其它后缀,比如实体名等等
* @param defaultInView 是否在页面逻辑中用 load 简写
*/
export declare function genUniqueQueryNameGroup(existingNameSets: {
viewLogic: Set<string>;
interface: Set<string>;
structure: Set<string>;
}, viewName: string, componentName?: string, defaultInView?: boolean, suffix?: string): NameGroup;