jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
73 lines (72 loc) • 1.78 kB
TypeScript
import type { Api } from 'jamis-core';
import type { BadgeObject, FormBaseControlSchema, FormOptionsSchema, IFormItemStore, IFormStore, OptionsControlProps } from '../../types';
export interface SchemaMap {
checkbox: CheckboxControlSchema;
}
/**
* 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 | number[];
/**
* 自定义选项展示
*/
menuTpl?: string;
}
export interface CheckboxesProps extends OptionsControlProps, Omit<CheckboxesControlSchema, 'options' | 'type' | 'className' | 'descriptionClassName' | 'inputClassName'> {
placeholder?: any;
itemClassName?: string;
columnsCount?: number;
labelClassName?: string;
onAdd?: () => void;
addApi?: Api;
creatable: boolean;
createBtnLabel: string;
editable?: boolean;
removable?: boolean;
optionType?: 'default' | 'button';
menuTpl?: string;
}