index.less 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @image-prefix-cls: ~'@{ant-prefix}-image';
  4. @image-preview-prefix-cls: ~'@{image-prefix-cls}-preview';
  5. .@{image-prefix-cls} {
  6. position: relative;
  7. display: inline-block;
  8. &-img {
  9. width: 100%;
  10. height: auto;
  11. vertical-align: middle;
  12. &-placeholder {
  13. background-color: @image-bg;
  14. background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=');
  15. background-repeat: no-repeat;
  16. background-position: center center;
  17. background-size: 30%;
  18. }
  19. }
  20. &-mask {
  21. position: absolute;
  22. top: 0;
  23. right: 0;
  24. bottom: 0;
  25. left: 0;
  26. display: flex;
  27. align-items: center;
  28. justify-content: center;
  29. color: @text-color-inverse;
  30. background: fade(@black, 50%);
  31. cursor: pointer;
  32. opacity: 0;
  33. transition: opacity @animation-duration-slow;
  34. &-info {
  35. padding: 0 @padding-xss;
  36. overflow: hidden;
  37. white-space: nowrap;
  38. text-overflow: ellipsis;
  39. .@{iconfont-css-prefix} {
  40. margin-inline-end: @margin-xss;
  41. }
  42. }
  43. &:hover {
  44. opacity: 1;
  45. }
  46. }
  47. &-placeholder {
  48. .box();
  49. }
  50. &-preview {
  51. .modal-mask();
  52. height: 100%;
  53. text-align: center;
  54. &-body {
  55. .box();
  56. overflow: hidden;
  57. }
  58. &-img {
  59. max-width: 100%;
  60. max-height: 100%;
  61. vertical-align: middle;
  62. transform: scale3d(1, 1, 1);
  63. cursor: grab;
  64. transition: transform 0.3s @ease-out 0s;
  65. user-select: none;
  66. pointer-events: auto;
  67. &-wrapper {
  68. .box();
  69. transition: transform 0.3s @ease-out 0s;
  70. &::before {
  71. display: inline-block;
  72. width: 1px;
  73. height: 50%;
  74. margin-right: -1px;
  75. content: '';
  76. }
  77. }
  78. }
  79. &-moving {
  80. .@{image-prefix-cls}-preview-img {
  81. cursor: grabbing;
  82. &-wrapper {
  83. transition-duration: 0s;
  84. }
  85. }
  86. }
  87. &-wrap {
  88. z-index: @zindex-image;
  89. }
  90. &-operations-wrapper {
  91. position: fixed;
  92. top: 0;
  93. right: 0;
  94. z-index: @zindex-image + 1;
  95. width: 100%;
  96. }
  97. &-operations {
  98. .reset-component();
  99. display: flex;
  100. flex-direction: row-reverse;
  101. align-items: center;
  102. color: @image-preview-operation-color;
  103. list-style: none;
  104. background: fade(@modal-mask-bg, 10%);
  105. pointer-events: auto;
  106. &-operation {
  107. margin-left: @control-padding-horizontal;
  108. padding: @control-padding-horizontal;
  109. cursor: pointer;
  110. transition: all 0.3s;
  111. &:hover {
  112. background: fade(@modal-mask-bg, 20%);
  113. }
  114. &-disabled {
  115. color: @image-preview-operation-disabled-color;
  116. pointer-events: none;
  117. }
  118. &:last-of-type {
  119. margin-left: 0;
  120. }
  121. }
  122. &-progress {
  123. position: absolute;
  124. left: 50%;
  125. transform: translateX(-50%);
  126. }
  127. &-icon {
  128. font-size: @image-preview-operation-size;
  129. }
  130. }
  131. &-switch-left,
  132. &-switch-right {
  133. position: fixed;
  134. top: 50%;
  135. right: 8px;
  136. z-index: @zindex-image + 1;
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. width: 44px;
  141. height: 44px;
  142. color: @image-preview-operation-color;
  143. background: fade(@modal-mask-bg, 10%);
  144. border-radius: 50%;
  145. transform: translateY(-50%);
  146. cursor: pointer;
  147. transition: all 0.3s;
  148. pointer-events: auto;
  149. &:hover {
  150. background: fade(@modal-mask-bg, 20%);
  151. }
  152. &-disabled,
  153. &-disabled:hover {
  154. color: @image-preview-operation-disabled-color;
  155. background: fade(@modal-mask-bg, 10%);
  156. cursor: not-allowed;
  157. > .@{iconfont-css-prefix} {
  158. cursor: not-allowed;
  159. }
  160. }
  161. > .@{iconfont-css-prefix} {
  162. font-size: 18px;
  163. }
  164. }
  165. &-switch-left {
  166. left: 8px;
  167. }
  168. &-switch-right {
  169. right: 8px;
  170. }
  171. &-focus-trap {
  172. width: 0;
  173. height: 0;
  174. overflow: hidden;
  175. outline: none;
  176. }
  177. }
  178. }