jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
147 lines (146 loc) • 3.1 kB
TypeScript
import type { RendererProps, SchemaClassName } from 'jamis-core';
import type { BaseSchema, SchemaObject } from '../types';
export interface TdObject {
/**
* 单元格背景色
* @deprecated 使用 className + tailwind
*/
background?: string;
/**
* 单元格文字颜色
* @deprecated 使用 className + tailwind
*/
color?: string;
/**
* 单元格文字是否加粗
* @deprecated 使用 className + tailwind
*/
bold?: boolean;
/**
* 单元格的内边距
* @deprecated 使用 className + tailwind
*/
padding?: number;
/**
* 单元格宽度
* @deprecated 使用 className + tailwind
*/
width?: number;
/**
* 单元格内的组件
*/
body?: SchemaObject;
/**
* 水平对齐
*/
align?: 'left' | 'center' | 'right' | 'justify';
/**
* 垂直对齐
*/
valign?: 'top' | 'middle' | 'bottom' | 'baseline';
/**
* 跨几行
*/
colspan?: number;
/**
* 跨几列
*/
rowspan?: number;
/**
* 自定义样式
*/
style?: React.CSSProperties;
className?: SchemaClassName;
}
/**
* 行设置
*/
export interface TrObject {
/**
* 行背景色
* @deprecated 使用 className + tailwind
*/
background?: string;
/**
* 行高度
*
* @deprecated 使用 className + tailwind
*/
height?: number;
/**
* 单元格配置
*/
tds: TdObject[];
style?: React.CSSProperties;
className?: SchemaClassName;
}
/**
* 列设置
*/
export interface ColObject {
span?: number;
style?: React.CSSProperties;
className?: SchemaClassName;
}
/**
* 表格展现渲染器
*
*/
export interface TableViewSchema extends BaseSchema {
/**
* 指定为 table-view 展示类型
*/
type: 'table-view';
/**
* table 容器宽度,默认是 auto
* @deprecated 使用 className + tailwind
*/
width?: number | string;
/**
* 默认单元格内边距
* @deprecated 使用 className + tailwind
*/
padding?: number | string;
/**
* 是否显示边框
*/
border?: boolean;
/**
* 边框颜色
* @deprecated 使用 className + tailwind
*/
borderColor?: string;
bodyClassName?: SchemaClassName;
/**
* 标题设置
*/
caption?: string;
/**
* 标题位置
*/
captionSide?: 'top' | 'bottom';
captionClassName?: SchemaClassName;
/**
* 行设置
*/
trs?: TrObject[];
/**
* 列设置
*/
cols?: ColObject[];
/**
* TableView-row 的样式类
*/
rowClassName?: SchemaClassName;
/**
* TableView-col 的样式类
*/
colClassName?: SchemaClassName;
/**
* TableView-cell 的样式类
*/
cellClassName?: SchemaClassName;
}
export interface TableViewProps extends RendererProps, Omit<TableViewSchema, 'type' | 'className'> {
itemRender?: (item: any, key: number, length: number, props: any) => JSX.Element;
}