@linkdesign/screen
Version:
屏组件库,但使用场景又不局限于屏。主要用于BI、大盘和屏
125 lines (124 loc) • 2.63 kB
TypeScript
import React, { Component } from 'react';
import { SliderProps } from '@alifd/next/types/slider';
import { ITitle, UniversalStyle } from '../title';
interface IColumn extends ITitle {
/**
* 字段名
* 内置 $index 序号
*/
key: string;
/**
* 类型
*/
type?: 'data' | 'time';
/**
* 时间格式 同 momentjs
* 默认:'HH:mm:ss'
*/
format?: string;
/**
* 显示名
*/
alias?: React.ReactNode;
/**
* 列宽占比
*/
widthRate: number;
/**
* 自定义渲染逻辑
*
* @param value 当前值
* @param index 索引
* @param record 当前数据对象
* @memberof IColumn
*/
cell?: (value: any, index: number, record: any) => React.ReactNode;
}
export interface ICarouselTable {
/**
* 类名
*/
className?: string;
/**
* 标题
*/
title?: React.ReactNode;
/**
* 数据源
*/
dataSource: Array<{
[key: string]: any;
}>;
/**
* 通用样式
*/
universalStyle?: UniversalStyle;
/**
* 全局样式
*/
global?: {
textStyle?: React.CSSProperties;
};
/**
* 轮播配置
*/
sliderOptions?: SliderProps;
/**
* 表头配置
*/
headerOptions?: ITitle;
/**
* 序列号配置
*/
titleOptions?: ITitle;
/**
* 行配置
*
* @type {{
* oddBackgroundColor?: string; // 奇行背景色
* evenBackgroundColor?: string; // 偶行背景色
* primaryKey?: string; // 主键id
* }}
* @memberof ICarouselTable
*/
rowOptions?: {
oddBackgroundColor?: string;
evenBackgroundColor?: string;
primaryKey?: string;
height?: number;
};
/**
* 自定义列
*/
column?: IColumn[];
/**
* 设置数据为空的时候的表格内容展现
*/
emptyContent?: React.ReactNode;
}
interface IState {
containerHeight: number;
}
/**
* 轮播表格
*
* @class CarouselTable
* @extends {Component<ICarouselTable, IState>}
*/
declare class CarouselTable extends Component<ICarouselTable, IState> {
private containerRef;
private headerRef;
private titleRef;
constructor(props: ICarouselTable);
componentDidMount(): void;
shouldComponentUpdate(nextProps: ICarouselTable, nextState: IState): boolean;
componentWillUnmount(): void;
/**
* resize
*
* @memberof CarouselTable
*/
handlerResize: () => void;
render(): React.ReactNode;
}
export default CarouselTable;