@opensig/opendesign
Version:
43 lines (42 loc) • 1.68 kB
TypeScript
import { MaybeRef } from 'vue';
type CellT = {
el: HTMLTableCellElement;
colStart: number;
rowStart: number;
colEnd: number;
rowEnd: number;
/** 该单元格是否为最后一列 */
lastCol: boolean;
/** 该单元格是否为最后一行 */
lastRow: boolean;
section: TableSection;
};
type TableSection = {
data: (CellT | null)[][];
totalCols: number;
totalRows: number;
rows: HTMLTableRowElement[];
sectionEl: HTMLTableSectionElement;
scope: 'head' | 'body' | 'foot';
};
type TableMetaOptions = {
/** 通过 class 在 td 或 th 元素上标记是否为最后一行 */
markCellLastRow?: boolean | string;
/** 通过 class 在 td 或 th 元素上标记是否为最后一列 */
markCellLastCol?: boolean | string;
/** 通过 class 在 tr 元素上标记是否为最后一行 */
markRowLast?: boolean | string;
/** 最后一列的标记是否区分不同的 section */
splitBySection?: boolean;
};
export declare const DEFAULT_CELL_FIRST_COL_MARKER = "o-cell-first-col";
export declare const DEFAULT_CELL_LAST_COL_MARKER = "o-cell-last-col";
export declare const DEFAULT_CELL_LAST_ROW_MARKER = "o-cell-last-row";
export declare const DEFAULT_ROW_LAST_MARKER = "o-row-last";
export declare function useTableMeta(elRef: MaybeRef<HTMLTableElement | undefined>, options?: TableMetaOptions): {
head: import('vue').ShallowRef<TableSection | null, TableSection | null>;
bodies: import('vue').ShallowRef<TableSection[], TableSection[]>;
foot: import('vue').ShallowRef<TableSection | null, TableSection | null>;
getMeta: (cellEl: HTMLTableCellElement) => CellT | null;
};
export {};