jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
109 lines (108 loc) • 2.48 kB
TypeScript
import type { ReactPropsBase, SchemaClassName } from 'jamis-core';
import type { FormBaseControlSchema, FormControlProps } from '../types';
export type TextAreaRendererEvent = 'blur' | 'focus' | 'change';
/**
* TextArea 多行文本输入框。
*
*/
export interface TextareaControlSchema extends FormBaseControlSchema {
/**
* 指定为多行文本输入框
*/
type: 'textarea';
/**
* 最大行数
*/
maxRows?: number;
/**
* 最小行数
*/
minRows?: number;
/**
* 是否只读
*/
readOnly?: boolean;
/**
* 边框模式,全边框或者没边框。
*/
borderMode?: 'full' | 'half' | 'none';
/**
* 限制文字个数
*/
maxLength?: number;
/**
* 是否显示计数
*/
showCounter?: boolean;
/**
* 输入内容是否可清除
*/
clearable?: boolean;
/**
* 重置值
*/
resetValue?: string;
trimContents?: boolean;
/**
* 是否可缩放, 默认是true
*/
resizable?: boolean;
/**
* 键盘快捷键. 支持`hotkey-js`里的写法, 快捷键触发时会发出`hotKey`事件
*/
hotKey?: string;
}
export interface TextAreaProps extends ReactPropsBase {
/**
* 最大行数
*/
maxRows?: number;
/**
* 最小行数
*/
minRows?: number;
/**
* 是否只读
*/
readOnly?: boolean;
/**
* 边框模式,全边框或者没边框。
*/
borderMode?: 'full' | 'half' | 'none';
/**
* 限制文字个数
*/
maxLength?: number;
/**
* 是否显示计数
*/
showCounter?: boolean;
/**
* 输入内容是否可清除
*/
clearable?: boolean;
/**
* 重置值
*/
resetValue?: string;
trimContents?: boolean;
value?: any;
placeholder?: string;
name?: string;
disabled?: boolean;
resizable?: boolean;
hasError?: boolean;
hotKey?: string;
inputClassName?: SchemaClassName;
onHotKey?: (ev: React.KeyboardEvent<HTMLTextAreaElement>, val: any) => void;
onChange?: (value: any) => void;
onFocus?: (e: any) => void;
onBlur?: (e: any) => void;
}
export interface TextAreaControlProps extends FormControlProps, Omit<TextareaControlSchema, 'className' | 'descriptionClassName' | 'inputClassName'> {
placeholder?: string;
minRows?: number;
maxRows?: number;
clearable?: boolean;
resetValue?: string;
}