UNPKG

@juparog/print-table

Version:

print-table is a simple library that allows you to print beautiful and customizable tables in the console using ANSI escape codes. It is ideal for displaying tabular data in a clear and visually appealing way.

165 lines 5.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BLOCK_BORDERS_THEME = exports.CURVED_LINES_THEME = exports.ROUND_EDGES_THEME = exports.STAR_BORDERS_THEME = exports.DOUBLE_MIX_LINE_THEME = exports.DOUBLE_LINE_THEME = exports.ROUNDED_BOX_THEME = exports.CLASSIC_BOX_THEME = void 0; const constants_1 = require("./constants"); /** * Theme for classic box table. (default theme) */ exports.CLASSIC_BOX_THEME = { column: { header: { bold: true, underline: true, align: constants_1.AlignmentText.LEFT_MIDDLE, }, width: 20, align: constants_1.AlignmentText.LEFT_MIDDLE, truncate: 150, }, table: { topLeftCorner: '┌', topRightCorner: '┐', topInnerCorner: '┬', bottomLeftCorner: '└', bottomRightCorner: '┘', bottomInnerCorner: '┴', sideLeftCorner: '├', sideRightCorner: '┤', centerInnerCorner: '┼', horizontalLine: '─', verticalLine: '│', paddingChar: ' ', }, }; /** * Theme for a rounded box table. */ exports.ROUNDED_BOX_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { table: { topLeftCorner: '╭', topRightCorner: '╮', topInnerCorner: '┬', bottomLeftCorner: '╰', bottomRightCorner: '╯', bottomInnerCorner: '┴', sideLeftCorner: '├', sideRightCorner: '┤', centerInnerCorner: '┼', horizontalLine: '─', verticalLine: '│', paddingChar: ' ', } }); /** * Theme for a table with double line borders. */ exports.DOUBLE_LINE_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { column: { header: { italicize: true, underline: false, }, }, table: { topLeftCorner: '╔', topRightCorner: '╗', topInnerCorner: '╦', bottomLeftCorner: '╚', bottomRightCorner: '╝', bottomInnerCorner: '╩', sideLeftCorner: '╠', sideRightCorner: '╣', centerInnerCorner: '╬', horizontalLine: '═', verticalLine: '║', paddingChar: ' ', } }); /** * Theme for a table with double and single lines borders. */ exports.DOUBLE_MIX_LINE_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { table: { topLeftCorner: '╓', topRightCorner: '╖', topInnerCorner: '╥', bottomLeftCorner: '╙', bottomRightCorner: '╜', bottomInnerCorner: '╨', sideLeftCorner: '╟', sideRightCorner: '╢', centerInnerCorner: '╫', horizontalLine: '─', verticalLine: '║', paddingChar: ' ', } }); /** * Theme for a table with star borders. */ exports.STAR_BORDERS_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { table: { topLeftCorner: '*', topRightCorner: '*', topInnerCorner: '*', bottomLeftCorner: '*', bottomRightCorner: '*', bottomInnerCorner: '*', sideLeftCorner: '*', sideRightCorner: '*', centerInnerCorner: '*', horizontalLine: '*', verticalLine: '*', paddingChar: ' ', } }); /** * Theme for table with round edges. */ exports.ROUND_EDGES_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { table: { topLeftCorner: '╭', topRightCorner: '╮', topInnerCorner: '╮', bottomLeftCorner: '╰', bottomRightCorner: '╯', bottomInnerCorner: '╰', sideLeftCorner: '│', sideRightCorner: '│', centerInnerCorner: '│', horizontalLine: '─', verticalLine: '│', paddingChar: ' ', } }); /** * Theme for a table with curved lines as border. */ exports.CURVED_LINES_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { table: { topLeftCorner: '╭', topRightCorner: '╮', topInnerCorner: '╮', bottomLeftCorner: '╰', bottomRightCorner: '╯', bottomInnerCorner: '╰', sideLeftCorner: '╰', sideRightCorner: '╯', centerInnerCorner: '╯', horizontalLine: '─', verticalLine: '│', paddingChar: ' ', } }); /** * Theme for table with block borders. */ exports.BLOCK_BORDERS_THEME = Object.assign(Object.assign({}, exports.CLASSIC_BOX_THEME), { column: { header: { underline: false, styleFullCell: true, }, underline: false, styleFullCell: true, }, table: { topLeftCorner: '█', topRightCorner: '█', topInnerCorner: '█', bottomLeftCorner: '█', bottomRightCorner: '█', bottomInnerCorner: '█', sideLeftCorner: '█', sideRightCorner: '█', centerInnerCorner: '█', horizontalLine: '█', verticalLine: '█', paddingChar: ' ', } }); //# sourceMappingURL=themes.js.map