size.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 genSizeStyle = token => {
  9. const {
  10. componentCls
  11. } = token;
  12. const getSizeStyle = (size, paddingVertical, paddingHorizontal, fontSize) => ({
  13. [`${componentCls}${componentCls}-${size}`]: {
  14. fontSize,
  15. [`
  16. ${componentCls}-title,
  17. ${componentCls}-footer,
  18. ${componentCls}-thead > tr > th,
  19. ${componentCls}-tbody > tr > td,
  20. tfoot > tr > th,
  21. tfoot > tr > td
  22. `]: {
  23. padding: `${paddingVertical}px ${paddingHorizontal}px`
  24. },
  25. [`${componentCls}-filter-trigger`]: {
  26. marginInlineEnd: `-${paddingHorizontal / 2}px`
  27. },
  28. [`${componentCls}-expanded-row-fixed`]: {
  29. margin: `-${paddingVertical}px -${paddingHorizontal}px`
  30. },
  31. [`${componentCls}-tbody`]: {
  32. // ========================= Nest Table ===========================
  33. [`${componentCls}-wrapper:only-child ${componentCls}`]: {
  34. marginBlock: `-${paddingVertical}px`,
  35. marginInline: `${token.tableExpandColumnWidth - paddingHorizontal}px -${paddingHorizontal}px`
  36. }
  37. },
  38. // https://github.com/ant-design/ant-design/issues/35167
  39. [`${componentCls}-selection-column`]: {
  40. paddingInlineStart: `${paddingHorizontal / 4}px`
  41. }
  42. }
  43. });
  44. return {
  45. [`${componentCls}-wrapper`]: (0, _extends2.default)((0, _extends2.default)({}, getSizeStyle('middle', token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle, token.tableFontSizeMiddle)), getSizeStyle('small', token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall, token.tableFontSizeSmall))
  46. };
  47. };
  48. var _default = exports.default = genSizeStyle;