imetting/frontend/src/components/DataTable.css

177 lines
3.1 KiB
CSS

.data-table-wrapper {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.table-container {
background: white;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
overflow-x: auto; /* Enable horizontal scroll */
border: 1px solid #e2e8f0;
/* 隐藏横向滚动条在 sticky 列下方 */
overflow-y: hidden;
}
.data-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
min-width: 100%;
}
.data-table tr {
background-color: white;
}
/* Sticky Right Column - 操作列固定 */
.data-table th.sticky-right,
.data-table td.sticky-right {
position: sticky;
right: 0;
z-index: 1;
background-color: white;
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
border-left: 1px solid #f1f5f9;
/* 根据按钮个数自动宽度(通过 col.width 控制) */
}
.data-table th.sticky-right {
background-color: #f8fafc;
z-index: 2;
}
.data-table tr:hover td.sticky-right {
background-color: #f8fafc;
}
.data-table th {
background: #f8fafc;
padding: 0.875rem 1rem;
text-align: left;
font-weight: 600;
color: #475569;
border-bottom: 1px solid #e2e8f0;
white-space: nowrap;
font-size: 0.875rem;
height: 48px;
}
.data-table td {
padding: 0.875rem 1rem;
border-bottom: 1px solid #f1f5f9;
color: #1e293b;
vertical-align: middle;
font-size: 0.875rem;
height: 48px;
}
.data-table tr:last-child td {
border-bottom: none;
}
.data-table tr:hover {
background-color: #f8fafc;
}
.data-table-empty {
text-align: center;
padding: 3rem !important;
color: #94a3b8;
}
/* Pagination */
.data-table-pagination {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 0.5rem;
}
.pagination-info {
color: #64748b;
font-size: 0.875rem;
}
.pagination-controls {
display: flex;
align-items: center;
gap: 0.5rem;
}
.pagination-btn {
padding: 0.375rem 0.75rem;
border: 1px solid #e2e8f0;
border-radius: 6px;
background: white;
color: #475569;
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s;
}
.pagination-btn:hover:not(:disabled) {
background: #f8fafc;
border-color: #cbd5e1;
}
.pagination-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
background: #f1f5f9;
}
.pagination-current {
font-weight: 600;
color: #1e293b;
min-width: 1.5rem;
text-align: center;
font-size: 0.875rem;
}
/* Common Utility Classes for Cells */
.cell-truncate {
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
}
.cell-mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
color: #334155;
}
.cell-actions {
display: flex;
gap: 0.5rem;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
}
/* Loading State inside table */
.table-loading {
padding: 3rem;
display: flex;
justify-content: center;
align-items: center;
color: #64748b;
gap: 0.5rem;
}
.spinner {
width: 20px;
height: 20px;
border: 2px solid #e2e8f0;
border-top-color: #667eea;
border-radius: 50%;
animation: table-spin 1s linear infinite;
}
@keyframes table-spin {
to { transform: rotate(360deg); }
}