index.less 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @upload-prefix-cls: ~'@{ant-prefix}-upload';
  4. @upload-item: ~'@{ant-prefix}-upload-list-item';
  5. @upload-picture-card-size: 104px;
  6. @upload-picture-card-border-style: @border-style-base;
  7. .@{upload-prefix-cls} {
  8. .reset-component();
  9. outline: 0;
  10. p {
  11. margin: 0;
  12. }
  13. &-btn {
  14. display: block;
  15. width: 100%;
  16. outline: none;
  17. }
  18. input[type='file'] {
  19. cursor: pointer;
  20. }
  21. &&-select {
  22. display: inline-block;
  23. }
  24. &&-disabled {
  25. color: @disabled-color;
  26. cursor: not-allowed;
  27. }
  28. &&-select-picture-card {
  29. width: @upload-picture-card-size;
  30. height: @upload-picture-card-size;
  31. margin-right: 8px;
  32. margin-bottom: 8px;
  33. text-align: center;
  34. vertical-align: top;
  35. background-color: @background-color-light;
  36. border: @border-width-base dashed @border-color-base;
  37. border-radius: @border-radius-base;
  38. cursor: pointer;
  39. transition: border-color 0.3s;
  40. > .@{upload-prefix-cls} {
  41. display: flex;
  42. align-items: center;
  43. justify-content: center;
  44. height: 100%;
  45. text-align: center;
  46. }
  47. &:hover {
  48. border-color: @primary-color;
  49. .@{upload-prefix-cls}-disabled& {
  50. border-color: @border-color-base;
  51. }
  52. }
  53. }
  54. &&-drag {
  55. position: relative;
  56. width: 100%;
  57. height: 100%;
  58. text-align: center;
  59. background: @background-color-light;
  60. border: @border-width-base dashed @border-color-base;
  61. border-radius: @border-radius-base;
  62. cursor: pointer;
  63. transition: border-color 0.3s;
  64. .@{upload-prefix-cls} {
  65. padding: @padding-md 0;
  66. }
  67. &.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
  68. border-color: @primary-7;
  69. }
  70. &.@{upload-prefix-cls}-disabled {
  71. cursor: not-allowed;
  72. }
  73. .@{upload-prefix-cls}-btn {
  74. display: table;
  75. height: 100%;
  76. }
  77. .@{upload-prefix-cls}-drag-container {
  78. display: table-cell;
  79. vertical-align: middle;
  80. }
  81. &:not(.@{upload-prefix-cls}-disabled):hover {
  82. border-color: @primary-5;
  83. }
  84. p.@{upload-prefix-cls}-drag-icon {
  85. .@{iconfont-css-prefix} {
  86. color: @primary-5;
  87. font-size: 48px;
  88. }
  89. margin-bottom: 20px;
  90. }
  91. p.@{upload-prefix-cls}-text {
  92. margin: 0 0 4px;
  93. color: @heading-color;
  94. font-size: @font-size-lg;
  95. }
  96. p.@{upload-prefix-cls}-hint {
  97. color: @text-color-secondary;
  98. font-size: @font-size-base;
  99. }
  100. .@{iconfont-css-prefix}-plus {
  101. color: @disabled-color;
  102. font-size: 30px;
  103. transition: all 0.3s;
  104. &:hover {
  105. color: @text-color-secondary;
  106. }
  107. }
  108. &:hover .@{iconfont-css-prefix}-plus {
  109. color: @text-color-secondary;
  110. }
  111. }
  112. &-picture-card-wrapper {
  113. .clearfix();
  114. display: inline-block;
  115. width: 100%;
  116. }
  117. }
  118. .@{upload-prefix-cls}-list {
  119. .reset-component();
  120. .clearfix();
  121. line-height: @line-height-base;
  122. // ============================ Item ============================
  123. &-item {
  124. position: relative;
  125. height: @line-height-base * @font-size-base;
  126. margin-top: @margin-xs;
  127. font-size: @font-size-base;
  128. &-name {
  129. display: inline-block;
  130. width: 100%;
  131. padding-left: @font-size-base + 8px;
  132. overflow: hidden;
  133. line-height: @line-height-base;
  134. white-space: nowrap;
  135. text-overflow: ellipsis;
  136. }
  137. &-card-actions {
  138. position: absolute;
  139. right: 0;
  140. &-btn {
  141. opacity: 0;
  142. }
  143. &-btn.@{ant-prefix}-btn-sm {
  144. height: @line-height-base * @font-size-base;
  145. line-height: 1;
  146. vertical-align: top;
  147. }
  148. &.picture {
  149. top: 22px;
  150. line-height: 0;
  151. }
  152. &-btn:focus,
  153. &.picture &-btn {
  154. opacity: 1;
  155. }
  156. .@{iconfont-css-prefix} {
  157. color: @upload-actions-color;
  158. transition: all 0.3s;
  159. }
  160. &:hover .@{iconfont-css-prefix} {
  161. color: @text-color;
  162. }
  163. }
  164. &-info {
  165. height: 100%;
  166. transition: background-color 0.3s;
  167. > span {
  168. display: block;
  169. width: 100%;
  170. height: 100%;
  171. }
  172. .@{iconfont-css-prefix}-loading,
  173. .@{upload-prefix-cls}-text-icon {
  174. .@{iconfont-css-prefix} {
  175. position: absolute;
  176. top: (@font-size-base / 2) - 2px;
  177. color: @text-color-secondary;
  178. font-size: @font-size-base;
  179. }
  180. }
  181. }
  182. &:hover &-info {
  183. background-color: @item-hover-bg;
  184. }
  185. &:hover &-card-actions-btn {
  186. opacity: 1;
  187. }
  188. &-error,
  189. &-error .@{upload-prefix-cls}-text-icon > .@{iconfont-css-prefix},
  190. &-error &-name {
  191. color: @error-color;
  192. }
  193. &-error &-card-actions {
  194. .@{iconfont-css-prefix} {
  195. color: @error-color;
  196. }
  197. &-btn {
  198. opacity: 1;
  199. }
  200. }
  201. &-progress {
  202. position: absolute;
  203. bottom: -12px;
  204. width: 100%;
  205. padding-left: @font-size-base + 12px;
  206. font-size: @font-size-base;
  207. line-height: 0;
  208. }
  209. }
  210. // =================== Picture & Picture Card ===================
  211. &-picture,
  212. &-picture-card {
  213. .@{upload-item} {
  214. position: relative;
  215. height: 66px;
  216. padding: @padding-xs;
  217. border: @border-width-base @upload-picture-card-border-style @border-color-base;
  218. border-radius: @border-radius-base;
  219. &:hover {
  220. background: transparent;
  221. }
  222. &-error {
  223. border-color: @error-color;
  224. }
  225. }
  226. .@{upload-item}-info {
  227. padding: 0;
  228. }
  229. .@{upload-item}:hover .@{upload-item}-info {
  230. background: transparent;
  231. }
  232. .@{upload-item}-uploading {
  233. border-style: dashed;
  234. }
  235. .@{upload-item}-thumbnail {
  236. width: 48px;
  237. height: 48px;
  238. line-height: 60px;
  239. text-align: center;
  240. opacity: 0.8;
  241. .@{iconfont-css-prefix} {
  242. font-size: 26px;
  243. }
  244. }
  245. // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
  246. .@{upload-item}-error .@{upload-item}-thumbnail {
  247. .@{iconfont-css-prefix} {
  248. svg path {
  249. &[fill='#e6f7ff'] {
  250. fill: @error-color-deprecated-bg;
  251. }
  252. &[fill='#1890ff'] {
  253. fill: @error-color;
  254. }
  255. }
  256. }
  257. }
  258. .@{upload-item}-icon {
  259. position: absolute;
  260. top: 50%;
  261. left: 50%;
  262. font-size: 26px;
  263. transform: translate(-50%, -50%);
  264. .@{iconfont-css-prefix} {
  265. font-size: 26px;
  266. }
  267. }
  268. .@{upload-item}-image {
  269. max-width: 100%;
  270. }
  271. .@{upload-item}-thumbnail img {
  272. display: block;
  273. width: 48px;
  274. height: 48px;
  275. overflow: hidden;
  276. }
  277. .@{upload-item}-name {
  278. display: inline-block;
  279. box-sizing: border-box;
  280. max-width: 100%;
  281. margin: 0 0 0 8px;
  282. padding-right: 8px;
  283. padding-left: 48px;
  284. overflow: hidden;
  285. line-height: 44px;
  286. white-space: nowrap;
  287. text-overflow: ellipsis;
  288. transition: all 0.3s;
  289. }
  290. .@{upload-item}-uploading .@{upload-item}-name {
  291. margin-bottom: 12px;
  292. }
  293. .@{upload-item}-progress {
  294. bottom: 14px;
  295. width: ~'calc(100% - 24px)';
  296. margin-top: 0;
  297. padding-left: 56px;
  298. }
  299. }
  300. // ======================== Picture Card ========================
  301. &-picture-card {
  302. &-container {
  303. display: inline-block;
  304. width: @upload-picture-card-size;
  305. height: @upload-picture-card-size;
  306. margin: 0 @margin-xs @margin-xs 0;
  307. vertical-align: top;
  308. }
  309. .@{upload-item} {
  310. height: 100%;
  311. margin: 0;
  312. }
  313. .@{upload-item}-info {
  314. position: relative;
  315. height: 100%;
  316. overflow: hidden;
  317. &::before {
  318. position: absolute;
  319. z-index: 1;
  320. width: 100%;
  321. height: 100%;
  322. background-color: fade(@black, 50%);
  323. opacity: 0;
  324. transition: all 0.3s;
  325. content: ' ';
  326. }
  327. }
  328. .@{upload-item}:hover .@{upload-item}-info::before {
  329. opacity: 1;
  330. }
  331. .@{upload-item}-actions {
  332. position: absolute;
  333. top: 50%;
  334. left: 50%;
  335. z-index: 10;
  336. white-space: nowrap;
  337. transform: translate(-50%, -50%);
  338. opacity: 0;
  339. transition: all 0.3s;
  340. .@{iconfont-css-prefix}-eye,
  341. .@{iconfont-css-prefix}-download,
  342. .@{iconfont-css-prefix}-delete {
  343. z-index: 10;
  344. width: 16px;
  345. margin: 0 4px;
  346. color: @text-color-dark;
  347. font-size: 16px;
  348. cursor: pointer;
  349. transition: all 0.3s;
  350. &:hover {
  351. color: @text-color-inverse;
  352. }
  353. }
  354. }
  355. .@{upload-item}-info:hover + .@{upload-item}-actions,
  356. .@{upload-item}-actions:hover {
  357. opacity: 1;
  358. }
  359. .@{upload-item}-thumbnail,
  360. .@{upload-item}-thumbnail img {
  361. position: static;
  362. display: block;
  363. width: 100%;
  364. height: 100%;
  365. object-fit: contain;
  366. }
  367. .@{upload-item}-name {
  368. display: none;
  369. margin: 8px 0 0;
  370. padding: 0;
  371. line-height: @line-height-base;
  372. text-align: center;
  373. }
  374. .@{upload-item}-file + .@{upload-item}-name {
  375. position: absolute;
  376. bottom: 10px;
  377. display: block;
  378. }
  379. .@{upload-item}-uploading {
  380. &.@{upload-item} {
  381. background-color: @background-color-light;
  382. }
  383. .@{upload-item}-info {
  384. height: auto;
  385. &::before,
  386. .@{iconfont-css-prefix}-eye,
  387. .@{iconfont-css-prefix}-delete {
  388. display: none;
  389. }
  390. }
  391. }
  392. .@{upload-item}-progress {
  393. bottom: 32px;
  394. width: calc(100% - 14px);
  395. padding-left: 0;
  396. }
  397. }
  398. // ======================= Picture & Text =======================
  399. &-text,
  400. &-picture {
  401. &-container {
  402. transition: opacity @animation-duration-slow, height @animation-duration-slow;
  403. &::before {
  404. display: table;
  405. width: 0;
  406. height: 0;
  407. content: '';
  408. }
  409. // Don't know why span here, just stretch it
  410. .@{upload-prefix-cls}-span {
  411. display: block;
  412. flex: auto;
  413. }
  414. }
  415. // text & picture no need this additional element.
  416. // But it used for picture-card, let's keep it.
  417. .@{upload-prefix-cls}-span {
  418. display: flex;
  419. align-items: center;
  420. > * {
  421. flex: none;
  422. }
  423. }
  424. .@{upload-item}-name {
  425. flex: auto;
  426. margin: 0;
  427. padding: 0 @padding-xs;
  428. }
  429. .@{upload-item}-card-actions {
  430. position: static;
  431. }
  432. }
  433. // ============================ Text ============================
  434. &-text {
  435. .@{upload-prefix-cls}-text-icon {
  436. .@{iconfont-css-prefix} {
  437. position: static;
  438. }
  439. }
  440. }
  441. // =========================== Motion ===========================
  442. .@{upload-prefix-cls}-animate-inline-appear,
  443. .@{upload-prefix-cls}-animate-inline-enter,
  444. .@{upload-prefix-cls}-animate-inline-leave {
  445. animation-duration: @animation-duration-slow;
  446. animation-timing-function: @ease-in-out-circ;
  447. animation-fill-mode: forwards;
  448. }
  449. .@{upload-prefix-cls}-animate-inline-appear,
  450. .@{upload-prefix-cls}-animate-inline-enter {
  451. animation-name: uploadAnimateInlineIn;
  452. }
  453. .@{upload-prefix-cls}-animate-inline-leave {
  454. animation-name: uploadAnimateInlineOut;
  455. }
  456. }
  457. @keyframes uploadAnimateInlineIn {
  458. from {
  459. width: 0;
  460. height: 0;
  461. margin: 0;
  462. padding: 0;
  463. opacity: 0;
  464. }
  465. }
  466. @keyframes uploadAnimateInlineOut {
  467. to {
  468. width: 0;
  469. height: 0;
  470. margin: 0;
  471. padding: 0;
  472. opacity: 0;
  473. }
  474. }
  475. @import './rtl';