_data-table-header-cell.scss 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // Copyright 2020 Google Inc.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. // stylelint-disable selector-class-pattern --
  23. // NOTE: We disable `selector-class-pattern` above to allow using `mdc-` class
  24. // selectors.
  25. @use 'sass:list';
  26. @use '@material/animation/functions';
  27. @use '@material/density/functions' as density-functions;
  28. @use '@material/dom/mixins' as dom;
  29. @use '@material/feature-targeting/feature-targeting';
  30. @use '@material/icon-button/icon-button-theme';
  31. @use '@material/rtl/rtl';
  32. @use '@material/typography/typography';
  33. @use './data-table-cell';
  34. @use './data-table-header-cell-checkbox-sorting';
  35. @use './data-table-theme';
  36. @mixin core-styles($query: feature-targeting.all()) {
  37. .mdc-data-table__header-cell {
  38. @include typography.typography(subtitle2, $query: $query);
  39. }
  40. @include static-styles($query);
  41. @include data-table-header-cell-checkbox-sorting.static-styles($query);
  42. }
  43. @mixin static-styles($query: feature-targeting.all()) {
  44. $feat-structure: feature-targeting.create-target($query, structure);
  45. $feat-animation: feature-targeting.create-target($query, animation);
  46. .mdc-data-table__header-cell {
  47. @include feature-targeting.targets($feat-structure) {
  48. box-sizing: border-box;
  49. text-overflow: ellipsis;
  50. overflow: hidden;
  51. outline: none;
  52. @include rtl.ignore-next-line();
  53. text-align: left;
  54. @include rtl.rtl {
  55. @include rtl.ignore-next-line();
  56. text-align: right;
  57. }
  58. }
  59. }
  60. .mdc-data-table__header-cell--numeric {
  61. @include feature-targeting.targets($feat-structure) {
  62. text-align: right;
  63. }
  64. @include feature-targeting.targets($feat-structure) {
  65. @include rtl.rtl {
  66. @include rtl.ignore-next-line();
  67. text-align: left;
  68. }
  69. }
  70. }
  71. .mdc-data-table__header-cell-wrapper {
  72. @include feature-targeting.targets($feat-structure) {
  73. align-items: center;
  74. display: inline-flex;
  75. vertical-align: middle;
  76. }
  77. }
  78. }
  79. /// Sets header cell in sticky position on table content vertical scroll.
  80. @mixin header-cell-sticky($query: $query) {
  81. $feat-structure: feature-targeting.create-target($query, structure);
  82. .mdc-data-table__header-cell {
  83. @include feature-targeting.targets($feat-structure) {
  84. position: sticky;
  85. top: 0;
  86. z-index: 1;
  87. }
  88. }
  89. }