1 export declare type DrawLinePredicate = (index: number, size: number) => boolean;
2 export declare type DrawVerticalLine = DrawLinePredicate;
3 export declare type DrawHorizontalLine = DrawLinePredicate;
4 export declare type BorderUserConfig = {
5 readonly topLeft?: string;
6 readonly topRight?: string;
7 readonly topBody?: string;
8 readonly topJoin?: string;
9 readonly bottomLeft?: string;
10 readonly bottomRight?: string;
11 readonly bottomBody?: string;
12 readonly bottomJoin?: string;
13 readonly joinLeft?: string;
14 readonly joinRight?: string;
15 readonly joinBody?: string;
16 readonly joinJoin?: string;
17 readonly headerJoin?: string;
18 readonly bodyRight?: string;
19 readonly bodyLeft?: string;
20 readonly bodyJoin?: string;
22 export declare type BorderConfig = Required<BorderUserConfig>;
23 export declare type Alignment = 'center' | 'justify' | 'left' | 'right';
24 export declare type VerticalAlignment = 'bottom' | 'middle' | 'top';
25 export declare type ColumnUserConfig = {
27 * Cell content horizontal alignment (default: left)
29 readonly alignment?: Alignment;
31 * Cell content vertical alignment (default: top)
33 readonly verticalAlignment?: VerticalAlignment;
35 * Column width (default: auto calculation based on the cell content)
37 readonly width?: number;
39 * Number of characters are which the content will be truncated (default: Infinity)
41 readonly truncate?: number;
43 * Cell content padding width left (default: 1)
45 readonly paddingLeft?: number;
47 * Cell content padding width right (default: 1)
49 readonly paddingRight?: number;
51 * If true, the text is broken at the nearest space or one of the special characters: "\|/_.,;-"
53 readonly wrapWord?: boolean;
55 export declare type HeaderUserConfig = Omit<ColumnUserConfig, 'verticalAlignment' | 'width'> & {
56 readonly content: string;
58 export declare type BaseUserConfig = {
62 readonly border?: BorderUserConfig;
64 * Default values for all columns. Column specific settings overwrite the default values.
66 readonly columnDefault?: ColumnUserConfig;
68 * Column specific configuration.
70 readonly columns?: Indexable<ColumnUserConfig>;
72 * Used to tell whether to draw a vertical line.
73 * This callback is called for each non-content line of the table.
74 * The default behavior is to always return true.
76 readonly drawVerticalLine?: DrawVerticalLine;
78 export declare type TableUserConfig = BaseUserConfig & {
80 * The header configuration
82 readonly header?: HeaderUserConfig;
84 * Used to tell whether to draw a horizontal line.
85 * This callback is called for each non-content line of the table.
86 * The default behavior is to always return true.
88 readonly drawHorizontalLine?: DrawHorizontalLine;
90 * Horizontal lines inside the table are not drawn.
92 readonly singleLine?: boolean;
94 export declare type StreamUserConfig = BaseUserConfig & {
96 * The number of columns
98 readonly columnCount: number;
100 * Default values for all columns. Column specific settings overwrite the default values.
102 readonly columnDefault: ColumnUserConfig & {
104 * The default width for each column
106 readonly width: number;
109 export declare type WritableStream = {
110 readonly write: (rows: string[]) => void;
112 export declare type Indexable<T> = {
113 readonly [index: number]: T;