diff --git a/table/_layout.ts b/table/_layout.ts index 3d0a4bc4..d6e39174 100644 --- a/table/_layout.ts +++ b/table/_layout.ts @@ -264,16 +264,13 @@ export class TableLayout< ); } - const cellValueParser = - (cell.getValueParser() ?? row.getCellValueParser() ?? - ( - isHeaderRow - ? column?.getHeaderValueParser() - : column?.getCellValueParser() - ) ?? - (isHeaderRow - ? this.table.getHeaderValueParser() - : this.table.getCellValueParser())) as ValueParser; + const cellValueParser = (cell.getValueParser() ?? row.getValueParser() ?? + ( + isHeaderRow ? column?.getHeaderValueParser() : column?.getValueParser() + ) ?? + (isHeaderRow + ? this.table.getHeaderValueParser() + : this.table.getValueParser())) as ValueParser; if (cellValueParser) { cell.value(cellValueParser); diff --git a/table/cell.ts b/table/cell.ts index 5e6b81b1..9e4be43a 100644 --- a/table/cell.ts +++ b/table/cell.ts @@ -31,8 +31,7 @@ export interface CellOptions { rowSpan?: number; /** Cell cell alignment direction. */ align?: Direction; - // value?: ValueParser; - value?(value: TValue): ValueParserResult; + value?: ValueParser; /** * Any unterminated ANSI formatting overflowed from previous lines of a * multi-line cell. diff --git a/table/column.ts b/table/column.ts index 60284f37..3b216898 100644 --- a/table/column.ts +++ b/table/column.ts @@ -164,7 +164,7 @@ export class Column< } /** Get value parser. */ - getCellValueParser(): ValueParser | undefined { + getValueParser(): ValueParser | undefined { return this.opts.value; } } diff --git a/table/row.ts b/table/row.ts index 6e94136f..68fd6f7d 100644 --- a/table/row.ts +++ b/table/row.ts @@ -156,7 +156,7 @@ export class Row< } /** Get value parser. */ - public getCellValueParser(): ValueParser> | undefined { + public getValueParser(): ValueParser> | undefined { return this.options.value; } } diff --git a/table/table.ts b/table/table.ts index 3aaab371..f98b9075 100644 --- a/table/table.ts +++ b/table/table.ts @@ -412,7 +412,7 @@ export class Table< } /** Get value parser. */ - public getCellValueParser(): + public getValueParser(): | ValueParser> | undefined { return this.options.value;