tsp-component
Version:
提供多端和react版本的UI组件
88 lines (83 loc) • 1.73 kB
TypeScript
/// <reference path="../slider/definition.d.ts" />
/// <reference path="../date-picker/definition.d.ts" />
interface TspComponentPickerCore {
id: string;
/**
* 列数
*/
// cols?: number;
/**
* 是否是级联
*/
cascade?: boolean;
/**
* 值, 格式[value1, value2, value3], 对应数据源的N级value或索引
*/
defaultValue: TspComponentPickerValues[];
/**
* 改变之后触发
*/
onOk?: (selected: TspComponentPickerValues[]) => void;
/**
* 默认显示的文本
*/
defaultLabel?: string;
/**
* 格式化显示文本
*/
formatLabel?: (selected: TspComponentPickerValues[]) => string;
/**
* 该字段必选提示文字
*/
required?: string;
/**
* 是否禁用组件点击功能
*/
disabled?: boolean;
/**
* 数据更新时是否改变label
*/
changeLabel?: boolean;
}
interface TspComponentPickerCoreParams extends TspComponentPickerCore {
/**
* 数据源
*/
data: TspComponentPickerDataSource[][];
/**
* 滑块元素
*/
sliderElem: HTMLElement;
/**
* 主容器Element
*/
containerElem: HTMLElement;
/**
* 文本Element
*/
labelElem: HTMLElement;
}
interface TspComponentPickerProps extends TspComponentPickerCore {
/**
* 类名
*/
className?: string;
/**
* 数据源
*/
data: TspComponentPickerValues[][];
/**
* 更新ID
*/
updateId?: any;
}
interface TspComponentPickerValues {
label?: number | string;
value?: number | string;
children?: any;
index?: number;
}
interface TspComponentPickerDataSource {
value: string | number;
label: string | number;
}