_table.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //
  2. // Component: Table
  3. //
  4. .table {
  5. &:not(.table-dark) {
  6. color: inherit;
  7. }
  8. // fixed table head
  9. &.table-head-fixed {
  10. thead tr:nth-child(1) th {
  11. background-color: $white;
  12. border-bottom: 0;
  13. box-shadow: inset 0 1px 0 $table-border-color, inset 0 -1px 0 $table-border-color;
  14. position: sticky;
  15. top: 0;
  16. z-index: 10;
  17. }
  18. &.table-dark {
  19. thead tr {
  20. &:nth-child(1) th {
  21. background-color: $table-dark-bg;
  22. box-shadow: inset 0 1px 0 $table-dark-border-color, inset 0 -1px 0 $table-dark-border-color;
  23. }
  24. }
  25. }
  26. }
  27. // no border
  28. &.no-border {
  29. &,
  30. td,
  31. th {
  32. border: 0;
  33. }
  34. }
  35. // .text-center in tables
  36. &.text-center {
  37. &,
  38. td,
  39. th {
  40. text-align: center;
  41. }
  42. }
  43. &.table-valign-middle {
  44. thead > tr > th,
  45. thead > tr > td,
  46. tbody > tr > th,
  47. tbody > tr > td {
  48. vertical-align: middle;
  49. }
  50. }
  51. .card-body.p-0 & {
  52. thead > tr > th,
  53. thead > tr > td,
  54. tfoot > tr > th,
  55. tfoot > tr > td,
  56. tbody > tr > th,
  57. tbody > tr > td {
  58. &:first-of-type {
  59. padding-left: map-get($spacers, 4);
  60. }
  61. &:last-of-type {
  62. padding-right: map-get($spacers, 4);
  63. }
  64. }
  65. }
  66. }
  67. // Expandable Table
  68. .table-hover tbody tr.expandable-body:hover {
  69. background-color: inherit !important;
  70. }
  71. [data-widget="expandable-table"] {
  72. cursor: pointer;
  73. i.expandable-table-caret {
  74. transition: transform $transition-speed linear;
  75. }
  76. &[aria-expanded="true"] {
  77. td i.expandable-table-caret {
  78. // stylelint-disable selector-max-attribute
  79. &[class*="right"] {
  80. transform: rotate(90deg);
  81. }
  82. &[class*="left"] {
  83. transform: rotate(-90deg);
  84. }
  85. // stylelint-enable selector-max-attribute
  86. }
  87. }
  88. }
  89. .expandable-body {
  90. > td {
  91. padding: 0 !important;
  92. width: 100%;
  93. > div,
  94. > p {
  95. padding: $table-cell-padding;
  96. }
  97. }
  98. .table {
  99. width: calc(100% - #{$table-cell-padding});
  100. margin: 0 0 0 $table-cell-padding;
  101. tr:first-child {
  102. td,
  103. th {
  104. border-top: none;
  105. }
  106. }
  107. }
  108. }
  109. @include dark-mode () {
  110. .table-bordered {
  111. &,
  112. td,
  113. th {
  114. border-color: $gray-600;
  115. }
  116. }
  117. .table-hover {
  118. tbody tr:hover {
  119. color: $gray-300;
  120. background-color: lighten($dark, 2.5%);
  121. border-color: $gray-600;
  122. }
  123. }
  124. .table {
  125. thead th {
  126. border-bottom-color: $gray-600;
  127. }
  128. th,
  129. td {
  130. border-top-color: $gray-600;
  131. }
  132. &.table-head-fixed {
  133. thead tr:nth-child(1) th {
  134. background-color: lighten($dark, 5%);
  135. }
  136. }
  137. }
  138. }