jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
62 lines (61 loc) • 1.47 kB
TypeScript
import type { SchemaClassName } from 'jamis-core';
import type { BadgeObject, FormBaseControlSchema, FormOptionsSchema, IFormItemStore, IFormStore, OptionsControlProps } from '../../types';
/**
* Checkbox 勾选框。
*
*/
export interface CheckboxControlSchema extends FormBaseControlSchema {
type: 'checkbox';
/**
* 勾选值
*/
trueValue?: boolean | string | number;
/**
* 未勾选值
*/
falseValue?: boolean | string | number;
/**
* 选项说明
*/
option?: string;
/**
* 角标
*/
badge?: BadgeObject;
partial?: boolean;
optionType?: 'default' | 'button';
checked?: boolean;
/**
* 表单项value改变事件监听
*/
onChange?: (curr: any, prev: any, itemStore: IFormItemStore, formStore: IFormStore) => any;
}
/**
* 复选框
*
*/
export interface CheckboxesControlSchema extends FormOptionsSchema {
type: 'checkboxes';
/**
* 是否开启全选功能
*/
checkAll?: boolean;
/**
* 是否默认全选
*/
defaultCheckAll?: boolean;
/**
* 每行显示多少个
*/
columnsCount?: number;
/**
* 自定义选项展示
*/
menuTpl?: string;
itemClassName?: SchemaClassName;
}
export interface CheckboxesProps extends OptionsControlProps, Omit<CheckboxesControlSchema, 'options' | 'type'> {
onAdd?: () => void;
optionType?: 'default' | 'button';
menuTpl?: string;
}