index.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. height: '100%',
  33. margin: 'auto'
  34. }
  35. },
  36. // 原来 &-footer 没有父子结构,现在为了外层承担我们的hashId,改成父子结果
  37. [`${componentCls}-footer`]: {
  38. marginTop: margin
  39. },
  40. '&-normal': {
  41. marginBlock: marginXL,
  42. color: token.colorTextDisabled,
  43. [`${componentCls}-image`]: {
  44. height: token.emptyImgHeightMD
  45. }
  46. },
  47. '&-small': {
  48. marginBlock: marginXS,
  49. color: token.colorTextDisabled,
  50. [`${componentCls}-image`]: {
  51. height: token.emptyImgHeightSM
  52. }
  53. }
  54. }
  55. };
  56. };
  57. // ============================== Export ==============================
  58. var _default = exports.default = (0, _internal.genComponentStyleHook)('Empty', token => {
  59. const {
  60. componentCls,
  61. controlHeightLG
  62. } = token;
  63. const emptyToken = (0, _internal.mergeToken)(token, {
  64. emptyImgCls: `${componentCls}-img`,
  65. emptyImgHeight: controlHeightLG * 2.5,
  66. emptyImgHeightMD: controlHeightLG,
  67. emptyImgHeightSM: controlHeightLG * 0.875
  68. });
  69. return [genSharedEmptyStyle(emptyToken)];
  70. });