index.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _internal = require("../../theme/internal");
  7. // ============================== Shared ==============================
  8. const genSharedEmptyStyle = token => {
  9. const {
  10. componentCls,
  11. margin,
  12. marginXS,
  13. marginXL,
  14. fontSize,
  15. lineHeight
  16. } = token;
  17. return {
  18. [componentCls]: {
  19. marginInline: marginXS,
  20. fontSize,
  21. lineHeight,
  22. textAlign: 'center',
  23. // 原来 &-image 没有父子结构,现在为了外层承担我们的 hashId,改成父子结构
  24. [`${componentCls}-image`]: {
  25. height: token.emptyImgHeight,
  26. marginBottom: marginXS,
  27. opacity: token.opacityImage,
  28. img: {
  29. height: '100%'
  30. },
  31. svg: {
  32. maxWidth: '100%',
  33. height: '100%',
  34. margin: 'auto'
  35. }
  36. },
  37. [`${componentCls}-description`]: {
  38. color: token.colorTextDescription
  39. },
  40. // 原来 &-footer 没有父子结构,现在为了外层承担我们的 hashId,改成父子结构
  41. [`${componentCls}-footer`]: {
  42. marginTop: margin
  43. },
  44. '&-normal': {
  45. marginBlock: marginXL,
  46. color: token.colorTextDescription,
  47. [`${componentCls}-description`]: {
  48. color: token.colorTextDescription
  49. },
  50. [`${componentCls}-image`]: {
  51. height: token.emptyImgHeightMD
  52. }
  53. },
  54. '&-small': {
  55. marginBlock: marginXS,
  56. color: token.colorTextDescription,
  57. [`${componentCls}-image`]: {
  58. height: token.emptyImgHeightSM
  59. }
  60. }
  61. }
  62. };
  63. };
  64. // ============================== Export ==============================
  65. var _default = exports.default = (0, _internal.genStyleHooks)('Empty', token => {
  66. const {
  67. componentCls,
  68. controlHeightLG,
  69. calc
  70. } = token;
  71. const emptyToken = (0, _internal.mergeToken)(token, {
  72. emptyImgCls: `${componentCls}-img`,
  73. emptyImgHeight: calc(controlHeightLG).mul(2.5).equal(),
  74. emptyImgHeightMD: controlHeightLG,
  75. emptyImgHeightSM: calc(controlHeightLG).mul(0.875).equal()
  76. });
  77. return genSharedEmptyStyle(emptyToken);
  78. });