jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
37 lines (36 loc) • 1.29 kB
TypeScript
/**
* @file 公式编辑器
*/
import React from 'react';
import type { FormulaEditorProps, FuncGroup, FuncItem, VariableItem } from '../../types';
import { FormulaPlugin } from './plugin';
interface FormulaState {
focused: boolean;
docs: Array<{
namespace: string;
name: string;
[propName: string]: any;
}>;
}
export declare class FormulaEditor extends React.Component<FormulaEditorProps, FormulaState> {
state: FormulaState;
editorPlugin?: FormulaPlugin;
static buildDefaultFunctions(doc: FormulaState['docs']): FuncGroup[];
static defaultProps: Pick<FormulaEditorProps, 'variables' | 'evalMode'>;
static highlightValue(value: string, variables: Array<VariableItem>, evalMode?: boolean): {
html: string;
} | undefined;
componentDidMount(): void;
componentWillUnmount(): void;
handleFocus(): void;
handleBlur(): void;
insertValue(value: any, type: 'variable' | 'func'): void;
handleEditorMounted(cm: any, editor: any): void;
validate(): any;
handleFunctionSelect(item: FuncItem): void;
handleVariableSelect(item: VariableItem): void;
handleOnChange(value: any): void;
editorFactory(dom: HTMLElement, cm: any): import("codemirror").Editor;
render(): JSX.Element;
}
export {};