@alilc/lowcode-renderer-core
Version:
renderer core
120 lines (119 loc) • 4.02 kB
TypeScript
import { IPublicTypeRootSchema, IPublicTypeNodeSchema, IPublicTypeJSSlot } from '@alilc/lowcode-types';
export { pick, isEqualWith as deepEqual, cloneDeep as clone, isEmpty, throttle, debounce } from 'lodash';
/**
* check if schema passed in is a valid schema
* @name isSchema
* @returns boolean
*/
export declare function isSchema(schema: any): schema is IPublicTypeNodeSchema;
/**
* check if schema passed in is a container type, including : Component Block Page
* @param schema
* @returns boolean
*/
export declare function isFileSchema(schema: IPublicTypeNodeSchema): schema is IPublicTypeRootSchema;
/**
* check if current page is nested within another page with same host
* @returns boolean
*/
export declare function inSameDomain(): boolean;
/**
* get css styled name from schema`s fileName
* FileName -> lce-file-name
* @returns string
*/
export declare function getFileCssName(fileName: string): string;
/**
* check if a object is type of JSSlot
* @returns string
*/
export declare function isJSSlot(obj: any): obj is IPublicTypeJSSlot;
/**
* get value from an object
* @returns string
*/
export declare function getValue(obj: any, path: string, defaultValue?: {}): any;
/**
* 用于处理国际化字符串
* @param {*} key 语料标识
* @param {*} values 字符串模版变量
* @param {*} locale 国际化标识,例如 zh-CN、en-US
* @param {*} messages 国际化语言包
*/
export declare function getI18n(key: string, values?: {}, locale?: string, messages?: Record<string, any>): string | void | (string | void)[];
/**
* 判断当前组件是否能够设置ref
* @param {*} Comp 需要判断的组件
*/
export declare function canAcceptsRef(Comp: any): any;
/**
* transform array to a object
* @param arr array to be transformed
* @param key key of array item, which`s value will be used as key in result map
* @param overwrite overwrite existing item in result or not
* @returns object result map
*/
export declare function transformArrayToMap(arr: any[], key: string, overwrite?: boolean): any;
/**
* transform string to a function
* @param str function in string form
* @returns funtion
*/
export declare function transformStringToFunction(str: string): any;
/**
* 对象类型JSExpression,支持省略this
* @param str expression in string form
* @param self scope object
* @returns funtion
*/
declare function parseExpression(options: {
str: any;
self: any;
thisRequired?: boolean;
logScope?: string;
}): any;
declare function parseExpression(str: any, self: any, thisRequired?: boolean): any;
export { parseExpression, };
export declare function parseThisRequiredExpression(str: any, self: any): any;
/**
* capitalize first letter
* @param word string to be proccessed
* @returns string capitalized string
*/
export declare function capitalizeFirstLetter(word: string): string;
/**
* check str passed in is a string type of not
* @param str obj to be checked
* @returns boolean
*/
export declare function isString(str: any): boolean;
/**
* check if obj is type of variable structure
* @param obj object to be checked
* @returns boolean
*/
export declare function isVariable(obj: any): boolean;
/**
* 将 i18n 结构,降级解释为对 i18n 接口的调用
* @param i18nInfo object
* @param self context
*/
export declare function parseI18n(i18nInfo: any, self: any): any;
/**
* for each key in targetObj, run fn with the value of the value, and the context paased in.
* @param targetObj object that keys will be for each
* @param fn function that process each item
* @param context
*/
export declare function forEach(targetObj: any, fn: any, context?: any): void;
interface IParseOptions {
thisRequiredInJSE?: boolean;
logScope?: string;
}
export declare function parseData(schema: unknown, self: any, options?: IParseOptions): any;
/**
* process params for using in a url query
* @param obj params to be processed
* @returns string
*/
export declare function serializeParams(obj: any): any;