jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
38 lines (37 loc) • 1.12 kB
TypeScript
import type { FormBaseControlSchema, FormControlProps, IFormItemStore, IFormStore, IconSchema, SizeUnit } from '../../types';
export interface SwitchControlSchema extends FormBaseControlSchema {
/**
* 指定为多行文本输入框
*/
type: 'switch';
/**
* 勾选值
*/
trueValue?: boolean | string | number;
/**
* 未勾选值
*/
falseValue?: boolean | string | number;
/**
* 选项说明
*/
option?: string;
/**
* 开启时显示的内容
*/
onText?: string | IconSchema;
/**
* 关闭时显示的内容
*/
offText?: string | IconSchema;
/** 开关尺寸 */
size?: SizeUnit;
onChange?: (curr: boolean, prev: boolean, itemStore: IFormItemStore, formStore: IFormStore) => any;
optionAtLeft?: boolean;
}
export interface SwitchProps extends FormControlProps, Omit<SwitchControlSchema, 'options' | 'className' | 'descriptionClassName' | 'inputClassName' | 'onChange' | 'onText' | 'offText'> {
option?: string;
trueValue?: any;
falseValue?: any;
}
export type SwitchRendererEvent = 'change';