virtual.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _cssinjs = require("@ant-design/cssinjs");
  7. const genVirtualStyle = token => {
  8. const {
  9. componentCls,
  10. motionDurationMid,
  11. lineWidth,
  12. lineType,
  13. tableBorderColor,
  14. calc
  15. } = token;
  16. const tableBorder = `${(0, _cssinjs.unit)(lineWidth)} ${lineType} ${tableBorderColor}`;
  17. const rowCellCls = `${componentCls}-expanded-row-cell`;
  18. return {
  19. [`${componentCls}-wrapper`]: {
  20. // ========================== Row ==========================
  21. [`${componentCls}-tbody-virtual`]: {
  22. [`${componentCls}-tbody-virtual-holder-inner`]: {
  23. [`
  24. & > ${componentCls}-row,
  25. & > div:not(${componentCls}-row) > ${componentCls}-row
  26. `]: {
  27. display: 'flex',
  28. boxSizing: 'border-box',
  29. width: '100%'
  30. }
  31. },
  32. [`${componentCls}-cell`]: {
  33. borderBottom: tableBorder,
  34. transition: `background ${motionDurationMid}`
  35. },
  36. [`${componentCls}-expanded-row`]: {
  37. [`${rowCellCls}${rowCellCls}-fixed`]: {
  38. position: 'sticky',
  39. insetInlineStart: 0,
  40. overflow: 'hidden',
  41. width: `calc(var(--virtual-width) - ${(0, _cssinjs.unit)(lineWidth)})`,
  42. borderInlineEnd: 'none'
  43. }
  44. }
  45. },
  46. // ======================== Border =========================
  47. [`${componentCls}-bordered`]: {
  48. [`${componentCls}-tbody-virtual`]: {
  49. '&:after': {
  50. content: '""',
  51. insetInline: 0,
  52. bottom: 0,
  53. borderBottom: tableBorder,
  54. position: 'absolute'
  55. },
  56. [`${componentCls}-cell`]: {
  57. borderInlineEnd: tableBorder,
  58. [`&${componentCls}-cell-fix-right-first:before`]: {
  59. content: '""',
  60. position: 'absolute',
  61. insetBlock: 0,
  62. insetInlineStart: calc(lineWidth).mul(-1).equal(),
  63. borderInlineStart: tableBorder
  64. }
  65. }
  66. },
  67. // Empty placeholder
  68. [`&${componentCls}-virtual`]: {
  69. [`${componentCls}-placeholder ${componentCls}-cell`]: {
  70. borderInlineEnd: tableBorder,
  71. borderBottom: tableBorder
  72. }
  73. }
  74. }
  75. }
  76. };
  77. };
  78. var _default = exports.default = genVirtualStyle;