node/deps/npm/node_modules/cli-table3/index.d.ts
Myles Borins 2e54524955
deps: update npm to 7.0.0-rc.3
PR-URL: https://github.com/nodejs/node/pull/35474
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-10-07 09:59:49 -04:00

93 lines
2.3 KiB
TypeScript

declare namespace CliTable3 {
type CharName =
"top" |
"top-mid" |
"top-left" |
"top-right" |
"bottom" |
"bottom-mid" |
"bottom-left" |
"bottom-right" |
"left" |
"left-mid" |
"mid" |
"mid-mid" |
"right" |
"right-mid" |
"middle";
type HorizontalAlignment = "left" | "center" | "right";
type VerticalAlignment = "top" | "center" | "bottom";
interface TableOptions {
truncate: string;
colWidths: Array<number | null>;
rowHeights: Array<number | null>;
colAligns: HorizontalAlignment[];
rowAligns: VerticalAlignment[];
head: string[];
wordWrap: boolean;
}
interface TableInstanceOptions extends TableOptions {
chars: Record<CharName, string>;
style: {
"padding-left": number;
"padding-right": number;
head: string[];
border: string[];
compact: boolean;
};
}
interface TableConstructorOptions extends Partial<TableOptions> {
chars?: Partial<Record<CharName, string>>;
style?: Partial<TableInstanceOptions["style"]>;
}
type CellValue = boolean | number | string | null | undefined;
interface CellOptions {
content: CellValue;
chars?: Partial<Record<CharName, string>>;
truncate?: string;
colSpan?: number;
rowSpan?: number;
hAlign?: HorizontalAlignment;
vAlign?: VerticalAlignment;
style?: {
"padding-left"?: number;
"padding-right"?: number;
head?: string[];
border?: string[];
};
}
interface GenericTable<T> extends Array<T> {
options: TableInstanceOptions;
readonly width: number;
}
type Table = GenericTable<HorizontalTableRow|VerticalTableRow|CrossTableRow>;
type Cell = CellValue | CellOptions;
type HorizontalTableRow = Cell[];
interface VerticalTableRow {
[name: string]: Cell;
}
interface CrossTableRow {
[name: string]: Cell[];
}
}
interface CliTable3 {
new (options?: CliTable3.TableConstructorOptions): CliTable3.Table;
readonly prototype: CliTable3.Table;
}
declare const CliTable3: CliTable3;
export = CliTable3;