Skip to content

Commit 13357b9

Browse files
authored
refactor(table): rename value parser getter (#667)
1 parent 393daf4 commit 13357b9

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

table/_layout.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,13 @@ export class TableLayout<
264264
);
265265
}
266266

267-
const cellValueParser =
268-
(cell.getValueParser() ?? row.getCellValueParser() ??
269-
(
270-
isHeaderRow
271-
? column?.getHeaderValueParser()
272-
: column?.getCellValueParser()
273-
) ??
274-
(isHeaderRow
275-
? this.table.getHeaderValueParser()
276-
: this.table.getCellValueParser())) as ValueParser<CellValue>;
267+
const cellValueParser = (cell.getValueParser() ?? row.getValueParser() ??
268+
(
269+
isHeaderRow ? column?.getHeaderValueParser() : column?.getValueParser()
270+
) ??
271+
(isHeaderRow
272+
? this.table.getHeaderValueParser()
273+
: this.table.getValueParser())) as ValueParser<CellValue>;
277274

278275
if (cellValueParser) {
279276
cell.value(cellValueParser);

table/cell.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export interface CellOptions<TValue extends CellValue> {
3131
rowSpan?: number;
3232
/** Cell cell alignment direction. */
3333
align?: Direction;
34-
// value?: ValueParser<TValue>;
35-
value?(value: TValue): ValueParserResult;
34+
value?: ValueParser<TValue>;
3635
/**
3736
* Any unterminated ANSI formatting overflowed from previous lines of a
3837
* multi-line cell.

table/column.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class Column<
164164
}
165165

166166
/** Get value parser. */
167-
getCellValueParser(): ValueParser<TValue> | undefined {
167+
getValueParser(): ValueParser<TValue> | undefined {
168168
return this.opts.value;
169169
}
170170
}

table/row.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class Row<
156156
}
157157

158158
/** Get value parser. */
159-
public getCellValueParser(): ValueParser<GetCellValue<TCell>> | undefined {
159+
public getValueParser(): ValueParser<GetCellValue<TCell>> | undefined {
160160
return this.options.value;
161161
}
162162
}

table/table.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export class Table<
412412
}
413413

414414
/** Get value parser. */
415-
public getCellValueParser():
415+
public getValueParser():
416416
| ValueParser<GetRowInnerValue<TRow>>
417417
| undefined {
418418
return this.options.value;

0 commit comments

Comments
 (0)