2025-04-29 14:22:40 +01:00

82 lines
2.4 KiB
TypeScript

import { TableData, RowOptionData, EmbedField, TableToFieldOptions, TableToStringOptions } from '../typings/index.js';
export declare class Table {
/**
* An array of titles for the Table
*/
private readonly titles;
/**
* The starting indexes for each column title in the title string
*/
private readonly titleIndexes;
/**
* The starting indexes for each column of data
*/
private readonly columnIndexes;
/**
* A string to add to the start of every row
*/
readonly start: string;
/**
* A string to add to the end of every row
*/
readonly end: string;
/**
* A pad for the end of each row, before the end
* @see [String.prototype.padEnd()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd)
*/
readonly padEnd: number;
/**
* The Table's generated rows. Do not modify unless you know what you're doing.
*/
readonly rows: string[];
/**
* The Table's generated title string
*/
readonly titleString: string;
/**
* Whether or not to include the Whitespace character (\u200b) in spacing (not required if using backticks for the start and end)
*/
private readonly whiteSpace;
/**
* Create a new Table
* @param {TableData} options
*/
constructor(options: TableData);
/**
* Add a row with data to the Table
* @param {string[]} columns
* @param {RowOptionData} options
* @returns {this}
*/
addRow(columns: string[], options?: RowOptionData): this;
/**
* Convert the Table to an EmbedField object
* @param {TableToFieldOptions} options Whether or not the field is inline
* @returns {EmbedField} Use this when creating a MessageEmbed
*/
toField(options?: TableToFieldOptions): EmbedField;
/**
* Convert the Table to a nice string
* @param {TableToStringOptions} options
* @returns
*/
toString(options?: TableToStringOptions): string;
/**
* Clear the rows out of the Table
* @returns {void}
*/
private clear;
/**
* Adds the spacing to the titles in the title string
* @param {number} i
* @returns {string} The padded title
*/
private padTitle;
/**
* Checks if the title texts are greater than the indexes provided
* Returns true if less than, false if greater than.
* @returns {boolean}
*/
private checkTitles;
}