Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix width of date table column #1046

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions src/components/table/TimeSeriesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@
<tr>
<template v-for="(column, index) in columns" :key="column.key">
<th
:style="{ minWidth: column.minWidth }"
:class="[
(column as unknown as TableHeaders).class,
{
'table-header--editing': isEditingTimeSeries(
column.key as string,
),
},
]"
v-if="column.key === 'date'"
class="table-date sticky-column mb-4"
>
<span>{{ column.title }}</span>
</th>
<th
v-else
class="table-header"
:class="{
'table-header--editing': isEditingTimeSeries(
column.key as string,
),
}"
>
<div class="table-header-indicator">
<div class="table-header-indicator-text">
Expand Down Expand Up @@ -120,7 +124,7 @@
:class="{ highlighted: selected?.date === item.date }"
@click="(e) => handleRowClick(e, item)"
>
<td class="sticky-column">
<td class="table-date sticky-column">
<v-text-field
v-if="isEditing && item.isNewRow"
:modelValue="toISOString(item.date)"
Expand Down Expand Up @@ -483,17 +487,28 @@ function onUpdateItem(event: TableData) {
width: 100%;
}

th.table-date {
vertical-align: top;
min-width: 24ch;
width: 24ch;
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
align-items: center;
}

th.sticky-column {
position: sticky;
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
left: 0;
}

td.table-date {
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
align-items: center;
}

td.sticky-column {
position: sticky;
left: 0;
background-color: rgb(var(--v-theme-surface));
border-right: thin solid rgba(var(--v-border-color), var(--v-border-opacity));
}

:deep(.v-select .v-select__selection-text) {
Expand Down
3 changes: 0 additions & 3 deletions src/lib/table/createTableHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export function createTableHeaders(
tableHeaders.push({
key: 'date',
title: 'Date',
minWidth: '24ch',
class: 'table-header sticky-column',
editable: false,
})
seriesIds.forEach((seriesId) => {
Expand All @@ -21,7 +19,6 @@ export function createTableHeaders(
key: chartSeries.id,
title: formatHeader(chartSeries),
color: chartSeries.style.stroke?.toString(),
class: 'table-header',
editable: true,
})
}
Expand Down
1 change: 0 additions & 1 deletion src/lib/table/types/TableHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ type ReadonlyDataTableHeader = (typeof VDataTable)['headers']

export interface TableHeaders extends ReadonlyDataTableHeader {
color?: string
class?: string
editable: boolean
}
Loading