bordered.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  8. const genBorderedStyle = token => {
  9. const {
  10. componentCls
  11. } = token;
  12. const tableBorder = `${token.lineWidth}px ${token.lineType} ${token.tableBorderColor}`;
  13. const getSizeBorderStyle = (size, paddingVertical, paddingHorizontal) => ({
  14. [`&${componentCls}-${size}`]: {
  15. [`> ${componentCls}-container`]: {
  16. [`> ${componentCls}-content, > ${componentCls}-body`]: {
  17. '> table > tbody > tr > td': {
  18. [`> ${componentCls}-expanded-row-fixed`]: {
  19. margin: `-${paddingVertical}px -${paddingHorizontal + token.lineWidth}px`
  20. }
  21. }
  22. }
  23. }
  24. }
  25. });
  26. return {
  27. [`${componentCls}-wrapper`]: {
  28. [`${componentCls}${componentCls}-bordered`]: (0, _extends2.default)((0, _extends2.default)((0, _extends2.default)({
  29. // ============================ Title =============================
  30. [`> ${componentCls}-title`]: {
  31. border: tableBorder,
  32. borderBottom: 0
  33. },
  34. // ============================ Content ============================
  35. [`> ${componentCls}-container`]: {
  36. borderInlineStart: tableBorder,
  37. [`
  38. > ${componentCls}-content,
  39. > ${componentCls}-header,
  40. > ${componentCls}-body,
  41. > ${componentCls}-summary
  42. `]: {
  43. '> table': {
  44. // ============================= Cell =============================
  45. [`
  46. > thead > tr > th,
  47. > tbody > tr > td,
  48. > tfoot > tr > th,
  49. > tfoot > tr > td
  50. `]: {
  51. borderInlineEnd: tableBorder
  52. },
  53. // ============================ Header ============================
  54. '> thead': {
  55. '> tr:not(:last-child) > th': {
  56. borderBottom: tableBorder
  57. },
  58. '> tr > th::before': {
  59. backgroundColor: 'transparent !important'
  60. }
  61. },
  62. // Fixed right should provides additional border
  63. [`
  64. > thead > tr,
  65. > tbody > tr,
  66. > tfoot > tr
  67. `]: {
  68. [`> ${componentCls}-cell-fix-right-first::after`]: {
  69. borderInlineEnd: tableBorder
  70. }
  71. },
  72. // ========================== Expandable ==========================
  73. '> tbody > tr > td': {
  74. [`> ${componentCls}-expanded-row-fixed`]: {
  75. margin: `-${token.tablePaddingVertical}px -${token.tablePaddingHorizontal + token.lineWidth}px`,
  76. '&::after': {
  77. position: 'absolute',
  78. top: 0,
  79. insetInlineEnd: token.lineWidth,
  80. bottom: 0,
  81. borderInlineEnd: tableBorder,
  82. content: '""'
  83. }
  84. }
  85. }
  86. }
  87. },
  88. [`
  89. > ${componentCls}-content,
  90. > ${componentCls}-header
  91. `]: {
  92. '> table': {
  93. borderTop: tableBorder
  94. }
  95. }
  96. },
  97. // ============================ Scroll ============================
  98. [`&${componentCls}-scroll-horizontal`]: {
  99. [`> ${componentCls}-container > ${componentCls}-body`]: {
  100. '> table > tbody': {
  101. [`
  102. > tr${componentCls}-expanded-row,
  103. > tr${componentCls}-placeholder
  104. `]: {
  105. '> td': {
  106. borderInlineEnd: 0
  107. }
  108. }
  109. }
  110. }
  111. }
  112. }, getSizeBorderStyle('middle', token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle)), getSizeBorderStyle('small', token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall)), {
  113. // ============================ Footer ============================
  114. [`> ${componentCls}-footer`]: {
  115. border: tableBorder,
  116. borderTop: 0
  117. }
  118. }),
  119. // ============================ Nested ============================
  120. [`${componentCls}-cell`]: {
  121. [`${componentCls}-container:first-child`]: {
  122. // :first-child to avoid the case when bordered and title is set
  123. borderTop: 0
  124. },
  125. // https://github.com/ant-design/ant-design/issues/35577
  126. '&-scrollbar:not([rowspan])': {
  127. boxShadow: `0 ${token.lineWidth}px 0 ${token.lineWidth}px ${token.tableHeaderBg}`
  128. }
  129. }
  130. }
  131. };
  132. };
  133. var _default = exports.default = genBorderedStyle;