@happy-table/vue3
Version:
A high-performance Vue 3 table component for B2B systems with TypeScript support
60 lines (59 loc) • 1.8 kB
TypeScript
import { TableColumn, TableRow, BorderConfig, StripeConfig } from '../types';
/**
* 单一职责: 单元格类型识别
*/
export declare function getCellType(column: TableColumn): 'header' | 'seq' | 'selection' | 'content';
/**
* 单一职责: 边框样式计算
*/
export declare function getCellBorderClasses(borderConfig: BorderConfig, column: TableColumn): string[];
/**
* 单一职责: 背景样式计算
*/
export declare function getCellBackgroundClasses(stripeConfig: StripeConfig, rowIndex: number, cellType: ReturnType<typeof getCellType>, states?: {
selected?: boolean;
editing?: boolean;
hover?: boolean;
}): string[];
/**
* 单一职责: 位置样式计算
*/
export declare function getCellPositionStyles(column: TableColumn, getFixedColumnBorder?: (column: TableColumn) => {
classes: string[];
styles: Record<string, string>;
}): Record<string, string>;
/**
* 开放/封闭原则: 可扩展的样式组合器
*/
export interface CellStyleOptions {
column: TableColumn;
row?: TableRow;
rowIndex: number;
borderConfig: BorderConfig;
stripeConfig: StripeConfig;
states?: {
selected?: boolean;
editing?: boolean;
hover?: boolean;
disabled?: boolean;
};
getFixedColumnBorder?: (column: TableColumn) => {
classes: string[];
styles: Record<string, string>;
};
}
/**
* 主要样式计算函数 - 依赖倒置原则
*/
export declare function calculateCellClasses(options: CellStyleOptions): string[];
/**
* 样式计算结果接口
*/
export interface CellStyleResult {
classes: string[];
styles: Record<string, string>;
}
/**
* 统一样式计算入口 - 接口隔离原则
*/
export declare function calculateCellStyle(options: CellStyleOptions): CellStyleResult;