Skip to content

Commit

Permalink
Revert "refactor(table): rename value parser getter (#667)"
Browse files Browse the repository at this point in the history
This reverts commit 13357b9.
  • Loading branch information
c4spar committed Apr 7, 2024
1 parent da56395 commit fb75b6c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
17 changes: 10 additions & 7 deletions table/_layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,16 @@ export class TableLayout<
);
}

const cellValueParser = (cell.getValueParser() ?? row.getValueParser() ??
(
isHeaderRow ? column?.getHeaderValueParser() : column?.getValueParser()
) ??
(isHeaderRow
? this.table.getHeaderValueParser()
: this.table.getValueParser())) as ValueParser<CellValue>;
const cellValueParser =
(cell.getValueParser() ?? row.getCellValueParser() ??
(
isHeaderRow
? column?.getHeaderValueParser()
: column?.getCellValueParser()
) ??
(isHeaderRow
? this.table.getHeaderValueParser()
: this.table.getCellValueParser())) as ValueParser<CellValue>;

if (cellValueParser) {
cell.value(cellValueParser);
Expand Down
3 changes: 2 additions & 1 deletion table/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export interface CellOptions<TValue extends CellValue> {
rowSpan?: number;
/** Cell cell alignment direction. */
align?: Direction;
value?: ValueParser<TValue>;
// value?: ValueParser<TValue>;
value?(value: TValue): ValueParserResult;
/**
* Any unterminated ANSI formatting overflowed from previous lines of a
* multi-line cell.
Expand Down
2 changes: 1 addition & 1 deletion table/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class Column<
}

/** Get value parser. */
getValueParser(): ValueParser<TValue> | undefined {
getCellValueParser(): ValueParser<TValue> | undefined {
return this.opts.value;
}
}
2 changes: 1 addition & 1 deletion table/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class Row<
}

/** Get value parser. */
public getValueParser(): ValueParser<GetCellValue<TCell>> | undefined {
public getCellValueParser(): ValueParser<GetCellValue<TCell>> | undefined {
return this.options.value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export class Table<
}

/** Get value parser. */
public getValueParser():
public getCellValueParser():
| ValueParser<GetRowInnerValue<TRow>>
| undefined {
return this.options.value;
Expand Down

0 comments on commit fb75b6c

Please sign in to comment.