jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
40 lines (39 loc) • 1.56 kB
TypeScript
import React from 'react';
import type { LocaleProps, SchemaClassName, ThemeProps } from 'jamis-core';
import type { ConditionBuilderConfig, ConditionBuilderField, ConditionBuilderFuncs, ExpressionComplex, FieldSimple, FormulaPickerProps, OperatorType } from '../../types';
/**
* 支持4中表达式设置方式
*
* 1. 直接就是值,由用户直接填写。
* 2. 选择字段,让用户选一个字段。
* 3. 选择一个函数,然后会参数里面的输入情况是个递归。
* 4. 粗暴点,函数让用户自己书写。
*/
export interface ExpressionProps extends ThemeProps, LocaleProps {
value: ExpressionComplex;
data?: any;
index?: number;
valueField?: FieldSimple;
fields?: ConditionBuilderField[];
funcs?: ConditionBuilderFuncs;
allowedTypes?: Array<'value' | 'field' | 'func' | 'formula'>;
op?: OperatorType;
config: ConditionBuilderConfig;
disabled?: boolean;
searchable?: boolean;
fieldClassName?: string;
formula?: FormulaPickerProps;
popOverContainer?: any;
renderEtrValue?: any;
valueClassName?: SchemaClassName;
onChange: (value: ExpressionComplex, index?: number) => void;
}
export declare class Expression extends React.Component<ExpressionProps> {
handleInputTypeChange(type: 'value' | 'field' | 'func' | 'formula'): void;
handleValueChange(data: any): void;
handleFieldChange(field: string): void;
handleFuncChange(func: any): void;
handleFormulaChange(formula: string): void;
render(): JSX.Element;
}
export default Expression;