@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
67 lines (66 loc) • 1.44 kB
TypeScript
export type ObjectExpressionFunction = (target: string, param: any, value: any, context: Record<string, any>) => boolean;
/**
* 解析对象表达式描述的布尔值
* @param valueSchema 布尔值对象描述
* @param context 解析表达式对象值所需的上下文对象
* @returns boolean
* @example
* // 简化形式表示数组长度为0
* {"sibling":0}
* @example
* // 数组长度不等于1
* {
* "children":{
* "length":{
* "not":1
* }
* }
* }
* @example
* // 存在某元素
* {
* "children":{
* "f-page-content":false
* }
* }
* {
* "parent":{
* "f-page-main":true
* }
* }
* @example
* // 与条件
* {
* "allOf":[
* {
* "sibling":0,
* "parent":{
* "f-page-main":true
* }
* }
* ]
* }
* // 或条件
* {
* "anyOf":[
* {
* "children":{
* "length":{
* "equal":1
* },
* "f-struct-like-card":true
* }
* },
* {
* "children":{
* "scroll-spy":false,
* "f-page-content":false,
* "f-struct-like-card":false
* }
* }
* ]
* }
*/
export declare function useObjectExpression(extendFunctions?: Record<string, ObjectExpressionFunction>): {
parseValueSchema: (valueSchema: Record<string, any>, context: Record<string, any>) => boolean;
};