Rename Column key to be clearer
This commit is contained in:
@@ -85,7 +85,7 @@ export abstract class Table<TRow extends object> {
|
||||
|
||||
return keys.map(key => ({
|
||||
key, // Raw property name from TRow
|
||||
value: displayNamesAndOrder?.[key] ?? String(key), // The value of the th html element, with a nullish coalescing operator for if its null
|
||||
headerValue: displayNamesAndOrder?.[key] ?? String(key), // The value of the th html element, with a nullish coalescing operator for if its null
|
||||
type: typeof exampleObject[key], // The type of the column
|
||||
}));
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export abstract class Table<TRow extends object> {
|
||||
|
||||
for (const column of this.columns) {
|
||||
const th = document.createElement("th")
|
||||
th.textContent = column.value;
|
||||
th.textContent = column.headerValue; // Header value;
|
||||
headerRow.appendChild(th);
|
||||
}
|
||||
|
||||
@@ -272,6 +272,6 @@ export abstract class Table<TRow extends object> {
|
||||
|
||||
export type Column<TRow> = {
|
||||
key: keyof TRow; // The name of the field.
|
||||
value: string; // The name of the header cell
|
||||
headerValue: string; // The name of the header cell
|
||||
type: string; // The type of the field, can be string since typesof are returned as strings.
|
||||
}
|
||||
Reference in New Issue
Block a user