354 lines
8.2 KiB
CSS
354 lines
8.2 KiB
CSS
/**
|
||
* DataTable - Универсальные стили для интерактивных таблиц
|
||
*
|
||
* Подключение: <link rel="stylesheet" href="/css/components/data-table.css">
|
||
*/
|
||
|
||
/* Основной контейнер таблицы */
|
||
.data-table {
|
||
width: 100%;
|
||
}
|
||
|
||
/* Интерактивные заголовки */
|
||
.data-table thead th {
|
||
vertical-align: middle;
|
||
white-space: nowrap;
|
||
padding: 0.5rem 0.75rem;
|
||
position: relative;
|
||
}
|
||
|
||
.data-table .header-content {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
width: 100%;
|
||
min-width: 0;
|
||
position: relative;
|
||
}
|
||
|
||
/* Текст заголовка */
|
||
.data-table .header-text {
|
||
cursor: pointer;
|
||
flex: 1 1 auto;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
min-width: 0;
|
||
transition: color 0.2s ease;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.data-table .header-text:hover {
|
||
color: var(--bs-primary, #0d6efd);
|
||
}
|
||
|
||
/* Иконки в заголовке */
|
||
.data-table .search-trigger,
|
||
.data-table .sort-icon {
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.data-table .search-trigger {
|
||
cursor: pointer;
|
||
opacity: 0.5;
|
||
transition: opacity 0.2s ease, color 0.2s ease;
|
||
font-size: 0.875rem;
|
||
}
|
||
|
||
.data-table .search-trigger:hover {
|
||
opacity: 1;
|
||
color: var(--bs-primary, #0d6efd);
|
||
}
|
||
|
||
.data-table .sort-icon {
|
||
cursor: pointer;
|
||
transition: color 0.2s ease;
|
||
font-size: 0.875rem;
|
||
}
|
||
|
||
.data-table .sort-icon:hover {
|
||
color: var(--bs-primary, #0d6efd) !important;
|
||
}
|
||
|
||
.data-table .sort-icon.active {
|
||
color: var(--bs-primary, #0d6efd) !important;
|
||
}
|
||
|
||
/* Поле ввода - абсолютное позиционирование */
|
||
.data-table .header-search-input {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
font-size: 0.875rem;
|
||
padding: 0.25rem 0.5rem;
|
||
border: 1px solid transparent;
|
||
border-radius: 0.25rem;
|
||
background-color: #fff;
|
||
box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
|
||
z-index: 10;
|
||
display: none;
|
||
}
|
||
|
||
.data-table .header-search-input.visible {
|
||
display: block;
|
||
}
|
||
|
||
/* Скрываем элементы заголовка при активном поиске */
|
||
.data-table .header-search-input.visible ~ .search-trigger,
|
||
.data-table .header-search-input.visible ~ .header-text,
|
||
.data-table .header-search-input.visible ~ .sort-icon {
|
||
visibility: hidden;
|
||
}
|
||
|
||
/* Пагинация - исправленная структура */
|
||
.data-table .pagination-wrapper {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
flex-wrap: nowrap;
|
||
gap: 1rem;
|
||
padding: 0.75rem 1rem;
|
||
border-top: 1px solid var(--bs-border-color, #dee2e6);
|
||
width: 100%;
|
||
margin: 0;
|
||
background-color: #fff;
|
||
border-bottom-left-radius: 0.375rem;
|
||
border-bottom-right-radius: 0.375rem;
|
||
}
|
||
|
||
/* Информация слева */
|
||
.data-table .pagination-info {
|
||
font-size: 0.875rem;
|
||
color: var(--bs-secondary-color, #6c757d);
|
||
white-space: nowrap;
|
||
flex-shrink: 0;
|
||
margin: 0;
|
||
}
|
||
|
||
/* Навигация по центру */
|
||
.data-table .pagination-wrapper > nav.pagination {
|
||
flex: 1 1 auto;
|
||
display: flex;
|
||
justify-content: center;
|
||
margin: 0;
|
||
}
|
||
|
||
.data-table .pagination-wrapper > nav.pagination .pagination {
|
||
margin-bottom: 0;
|
||
flex-wrap: nowrap;
|
||
}
|
||
|
||
/* Селектор справа */
|
||
.data-table .per-page-selector {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 0.5rem;
|
||
flex-shrink: 0;
|
||
white-space: nowrap;
|
||
margin: 0;
|
||
}
|
||
|
||
/* Компактный селектор */
|
||
.data-table .per-page-selector .per-page-select,
|
||
.data-table .per-page-selector select {
|
||
appearance: none;
|
||
-webkit-appearance: none;
|
||
-moz-appearance: none;
|
||
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
|
||
background-repeat: no-repeat;
|
||
background-position: right 0.5rem center;
|
||
background-size: 16px 12px;
|
||
padding-right: 2rem !important;
|
||
width: 80px !important;
|
||
font-size: 0.875rem !important;
|
||
padding: 0.25rem 0.5rem !important;
|
||
border: 1px solid #dee2e6;
|
||
border-radius: 0.25rem;
|
||
background-color: #fff;
|
||
cursor: pointer;
|
||
margin: 0;
|
||
}
|
||
|
||
/* Убираем отступы у ячейки футера */
|
||
.data-table tfoot td {
|
||
padding: 0 !important;
|
||
border-top: 1px solid var(--bs-border-color, #dee2e6);
|
||
}
|
||
|
||
/* Убираем границы у строки футера */
|
||
.data-table tfoot tr {
|
||
border: none;
|
||
}
|
||
|
||
/* Кнопки пагинации */
|
||
.data-table .page-link {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-width: 2rem;
|
||
height: 2rem;
|
||
padding: 0 0.5rem;
|
||
border-radius: 0.375rem;
|
||
font-size: 0.875rem;
|
||
text-decoration: none;
|
||
transition: all 0.2s ease;
|
||
margin: 0 0.125rem;
|
||
}
|
||
|
||
.data-table .page-link:hover:not(.disabled):not(.active) {
|
||
background-color: var(--bs-primary-bg-subtle, #e9ecef);
|
||
}
|
||
|
||
.data-table .page-link.active {
|
||
background-color: var(--bs-primary, #0d6efd);
|
||
color: #fff;
|
||
border-color: var(--bs-primary, #0d6efd);
|
||
}
|
||
|
||
.data-table .page-link.disabled {
|
||
color: var(--bs-secondary-color, #6c757d);
|
||
pointer-events: none;
|
||
opacity: 0.5;
|
||
}
|
||
|
||
/* Контейнер селектора не должен растягиваться */
|
||
.data-table .per-page-selector {
|
||
width: auto !important;
|
||
max-width: none !important;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.data-table .per-page-selector label {
|
||
font-size: 0.875rem;
|
||
color: var(--bs-secondary-color, #6c757d);
|
||
margin-bottom: 0;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
/* Стили для ячеек с действиями */
|
||
.data-table .actions-cell {
|
||
white-space: nowrap;
|
||
text-align: end;
|
||
}
|
||
|
||
.data-table .action-btn {
|
||
padding: 0.25rem 0.5rem;
|
||
font-size: 0.875rem;
|
||
border-radius: 0.25rem;
|
||
margin-left: 0.25rem;
|
||
}
|
||
|
||
/* Hover эффекты для строк */
|
||
.data-table tbody tr {
|
||
transition: background-color 0.15s ease;
|
||
}
|
||
|
||
.data-table tbody tr:hover {
|
||
background-color: var(--bs-table-hover-bg, rgba(0, 0, 0, 0.02));
|
||
}
|
||
|
||
/* Статус активной сортировки в заголовке */
|
||
.data-table th.sorted-asc .sort-icon::before {
|
||
content: '\f160';
|
||
font-weight: 900;
|
||
}
|
||
|
||
.data-table th.sorted-desc .sort-icon::before {
|
||
content: '\f161';
|
||
font-weight: 900;
|
||
}
|
||
|
||
/* Анимация появления */
|
||
@keyframes data-table-fade-in {
|
||
from {
|
||
opacity: 0;
|
||
transform: translateY(-2px);
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
.data-table .header-search-input {
|
||
animation: data-table-fade-in 0.15s ease-in-out;
|
||
}
|
||
|
||
/* Стили для загрузки */
|
||
.data-table .loading {
|
||
position: relative;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.data-table .loading::after {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background: rgba(255, 255, 255, 0.7);
|
||
z-index: 1;
|
||
}
|
||
|
||
/* Пустое состояние */
|
||
.data-table .empty-state {
|
||
text-align: center;
|
||
padding: 3rem 1rem;
|
||
color: var(--bs-secondary-color, #6c757d);
|
||
}
|
||
|
||
.data-table .empty-state i {
|
||
font-size: 3rem;
|
||
opacity: 0.3;
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
.data-table .empty-state h5 {
|
||
margin-bottom: 0.5rem;
|
||
}
|
||
|
||
.data-table .empty-state p {
|
||
margin-bottom: 0;
|
||
opacity: 0.8;
|
||
}
|
||
|
||
/* Адаптивность для мобильных */
|
||
@media (max-width: 768px) {
|
||
.data-table .header-content {
|
||
gap: 4px;
|
||
}
|
||
|
||
.data-table .header-text {
|
||
font-size: 0.875rem;
|
||
}
|
||
|
||
.data-table .search-trigger,
|
||
.data-table .sort-icon {
|
||
font-size: 0.875rem;
|
||
}
|
||
|
||
.data-table .pagination-wrapper {
|
||
flex-wrap: wrap;
|
||
justify-content: center;
|
||
gap: 0.5rem;
|
||
padding: 0.5rem;
|
||
}
|
||
|
||
.data-table .pagination-info,
|
||
.data-table .per-page-selector {
|
||
flex: 1 1 100%;
|
||
justify-content: center;
|
||
text-align: center;
|
||
}
|
||
|
||
.data-table .per-page-selector {
|
||
justify-content: center;
|
||
}
|
||
}
|
||
|
||
/* Исправляем Bootstrap стили для пагинации внутри таблицы */
|
||
.table .pagination {
|
||
margin-bottom: 0;
|
||
} |