| 1 |
// TODO: Many of these rules could be applied to all bslib themes |
| 2 |
.table.dataTable { |
| 3 |
// CSS variables are scoped to datatables in Bootstrap |
| 4 |
--dt-row-selected: var(--bs-primary-rgb, "0,123,194"); |
| 5 |
--dt-row-selected-text: var(--bs-white-rgb, "255,255,255"); |
| 6 |
--dt-row-selected-link: var(--bs-light-rgh, "248,248,248"); |
| 7 |
} |
| 8 |
|
| 9 |
// Note CSS specificity hack because DT's CSS deps are loaded after the theme |
| 10 |
.table.dataTable.dataTable { |
| 11 |
$class-stripe: "even"; |
| 12 |
$class-unstriped: "odd"; |
| 13 |
|
| 14 |
@if $table-striped-order == odd { |
| 15 |
$class-stripe: "odd"; |
| 16 |
$class-unstriped: "even"; |
| 17 |
} |
| 18 |
|
| 19 |
&.table-striped > tbody > tr.#{$class-unstriped}:not(.selected) > * { |
| 20 |
box-shadow: none; |
| 21 |
} |
| 22 |
|
| 23 |
&.table-striped > tbody > tr.#{$class-stripe}:not(.selected) > * { |
| 24 |
box-shadow: inset 0 0 0 9999px var(--bs-table-striped-bg); |
| 25 |
} |
| 26 |
|
| 27 |
tbody td.active, |
| 28 |
tbody tr.active td { |
| 29 |
background-color: var(--bs-table-active-bg); |
| 30 |
} |
| 31 |
|
| 32 |
&.table-hover > tbody > tr:hover:not(.selected) > * { |
| 33 |
box-shadow: inset 0 0 0 9999px var(--bs-table-hover-bg); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
thead, tbody, tfoot, tr, td, th { |
| 38 |
border: none; |
| 39 |
} |
| 40 |
|
| 41 |
.table > thead { |
| 42 |
border-bottom: 1px solid var(--bs-table-color); |
| 43 |
} |
| 44 |
|
| 45 |
th { |
| 46 |
font-weight: 600; |
| 47 |
} |
| 48 |
|
| 49 |
.datatables { |
| 50 |
// Table pagination row tweaks |
| 51 |
.dataTables_wrapper div.dataTables_info { |
| 52 |
padding-top: 1.65rem; |
| 53 |
font-size: .95rem; |
| 54 |
} |
| 55 |
|
| 56 |
.dataTables_paginate { |
| 57 |
padding-top: 1rem; |
| 58 |
} |
| 59 |
|
| 60 |
.paginate_button a { |
| 61 |
font-size: .95rem; |
| 62 |
} |
| 63 |
|
| 64 |
// create space between 'show ___ entries' and 'search' above table |
| 65 |
.dataTables_length, .dataTables_filter { |
| 66 |
padding-bottom: 1rem; |
| 67 |
} |
| 68 |
|
| 69 |
// Scroll the data table container, not the entire wrapper |
| 70 |
.dataTables_wrapper .dt-row { |
| 71 |
max-width: 100%; |
| 72 |
overflow: auto; |
| 73 |
} |
| 74 |
|
| 75 |
// Style the length and search inputs |
| 76 |
.dataTables_wrapper .dataTables_length select, |
| 77 |
.dataTables_wrapper .dataTables_filter input { |
| 78 |
border: none; |
| 79 |
border-bottom: 1px solid var(--bs-body-color); |
| 80 |
border-radius: 0; |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
// TODO: This could be applied more generally via the card scss |
| 85 |
.bslib-card-table-sm { |
| 86 |
&.bslib-card[data-full-screen="false"] .datatables .dataTables_wrapper { |
| 87 |
font-size: 85%; |
| 88 |
|
| 89 |
// hide the supporting elements when inside a non-full-screen card |
| 90 |
.dataTables_length, // show ___ entries |
| 91 |
.dataTables_filter, // search |
| 92 |
// .dataTables_info, // showing 1 to 10 of 100 entries |
| 93 |
.dataTables_paginate { |
| 94 |
display: none; |
| 95 |
} |
| 96 |
} |
| 97 |
} |