choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
65 lines (64 loc) • 2.35 kB
TypeScript
import { ReactNode } from 'react';
import { IReactionDisposer } from 'mobx';
import { EditorConfiguration } from 'codemirror';
import { IInstance } from 'react-codemirror2';
import { FormField, FormFieldProps } from '../field/FormField';
import { CodeAreaFormatter } from './CodeAreaFormatter';
export declare enum ThemeSwitch {
idea = "idea",
material = "material"
}
export interface CodeAreaProps extends FormFieldProps {
options?: EditorConfiguration;
formatHotKey?: string;
unFormatHotKey?: string;
formatter?: CodeAreaFormatter;
editorDidMount?: (editor: IInstance, value: string, cb: () => void) => void;
themeSwitch?: ThemeSwitch;
}
export default class CodeArea extends FormField<CodeAreaProps> {
static displayName: string;
static defaultProps: {
suffixCls: string;
formatHotKey: string;
unFormatHotKey: string;
readOnly: boolean;
disabled: boolean;
noValidate: boolean;
trim: import("../data-set/enum").FieldTrim;
};
cmOptions: EditorConfiguration;
text?: string;
midText: string;
disposer: IReactionDisposer;
theme?: string;
constructor(props: any, content: any);
componentWillUnmount(): void;
handleBeforeChange(_editor: any, _data: any, value: any): void;
handleCodeMirrorKeyDown(cm: any, e: any): void;
getCodeMirrorOptions(options?: EditorConfiguration): EditorConfiguration;
getOmitPropsKeys(): string[];
getOtherProps(): any;
getOtherClassName(otherProps: any): string;
setThemeWrapper(nextProps: any): void;
componentWillReceiveProps(nextProps: any, nextContext: any): void;
handleThemeChange: (value: any) => void;
getHeader: () => JSX.Element | null;
renderWrapper(): ReactNode;
setTheme(theme?: string): void;
setText(text?: string): void;
getTextNode(value?: any): ReactNode;
processValue(value: any): ReactNode;
/**
* 编辑器失去焦点时,调用父类方法,同步DataSet中的内容
*
* @memberof CodeArea
*/
handleCodeMirrorBlur: ((codeMirrorInstance: IInstance) => void) & import("mobx").IAction;
/**
* 在CodeMirror编辑器实例挂载前添加额外配置
*
* @memberof CodeArea
*/
handleCodeMirrorDidMount: (editor: IInstance, value: string, cb: () => void) => void;
}