upload.scss 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. @import './variables.scss';
  2. $module: #{$prefix}-upload;
  3. .#{$module} {
  4. display: flex;
  5. flex-wrap: wrap;
  6. &-disabled {
  7. cursor: not-allowed;
  8. .#{$module}-file-card {
  9. cursor: not-allowed;
  10. &-close {
  11. cursor: not-allowed;
  12. }
  13. }
  14. .#{$module}-drag-area {
  15. border: none;
  16. cursor: not-allowed;
  17. &:hover {
  18. background-color: $color-upload_drag_area-bg;
  19. }
  20. &-main-text,
  21. &-sub-text,
  22. &-icon {
  23. cursor: not-allowed;
  24. color: $color-upload_drag_area_disabled-text;
  25. }
  26. }
  27. }
  28. &-hidden-input {
  29. display: none;
  30. }
  31. &-hidden-input-replace {
  32. display: none;
  33. }
  34. &-add {
  35. display: flex;
  36. align-items: center;
  37. }
  38. &[x-prompt-pos='right'] {
  39. .#{$module}-add {
  40. display: inline-flex;
  41. }
  42. .#{$module}-prompt {
  43. display: inline-flex;
  44. }
  45. }
  46. &[x-prompt-pos='bottom'] {
  47. .#{$module}-add {
  48. display: flex;
  49. }
  50. .#{$module}-prompt {
  51. display: flex;
  52. flex-basis: 100%;
  53. }
  54. .#{$module}-file-list {
  55. flex-basis: 100%;
  56. }
  57. }
  58. &[x-prompt-pos='left'] {
  59. .#{$module}-add {
  60. display: inline-flex;
  61. }
  62. .#{$module}-prompt {
  63. display: inline-flex;
  64. order: -1;
  65. }
  66. .#{$module}-file-list {
  67. order: 2;
  68. }
  69. }
  70. &-file-list {
  71. flex-basis: 100%;
  72. flex-shrink: 0;
  73. display: block;
  74. margin-top: $spacing-tight;
  75. margin-bottom: $spacing-tight;
  76. &-main {
  77. display: flex;
  78. flex-wrap: wrap;
  79. flex-shrink: 0;
  80. gap: $spacing-upload_picture_file_card-gap;
  81. margin-bottom: $spacing-upload_picture_file_card-marginBottom;
  82. p {
  83. @include ver-center;
  84. }
  85. }
  86. &-title {
  87. @include font-size-small;
  88. color: $color-upload_assist-text;
  89. &-choosen {
  90. margin-right: $spacing-upload_title_choosen-marginRight;
  91. }
  92. &-clear {
  93. cursor: pointer;
  94. color: $color-upload_clear-text;
  95. }
  96. margin-bottom: $spacing-upload_title-marginBottom;
  97. }
  98. }
  99. &-file-card {
  100. // border: 1px solid $color-upload-border;
  101. border-radius: $radius-upload_file_card;
  102. display: inline-flex;
  103. align-items: center;
  104. justify-content: space-between;
  105. height: $height-upload_file_card;
  106. width: $width-upload_file_card;
  107. background-color: $color-upload_card-bg;
  108. cursor: pointer;
  109. &:hover {
  110. background-color: $color-upload_card-bg-hover;
  111. }
  112. a {
  113. text-decoration: none;
  114. // color: inherit;
  115. }
  116. &-preview {
  117. height: $height-upload_file_card_preview;
  118. width: $width-upload_file_card_preview;
  119. color: $color-upload_preview-icon;
  120. margin: $spacing-upload_file_card_preview-margin;
  121. @include all-center;
  122. border-radius: $radius-upload_file_card_preview;
  123. flex-shrink: 0;
  124. img {
  125. width: $width-upload_file_card_preview_img;
  126. height: $width-upload_file_card_preview_img;
  127. object-fit: cover;
  128. }
  129. }
  130. &-preview-placeholder {
  131. background-color: $color-upload_file_card_preview_placeholder-bg;
  132. color: $color-upload_file_card_preview_placeholder-text;
  133. }
  134. &-show-pointer {
  135. cursor: pointer;
  136. }
  137. &-info {
  138. display: flex;
  139. align-items: center;
  140. &-main {
  141. display: flex;
  142. flex-wrap: wrap;
  143. flex: 1;
  144. &-text {
  145. @include ver-center;
  146. flex-basis: 100%;
  147. }
  148. &-control {
  149. display: flex;
  150. }
  151. }
  152. &-name {
  153. // width: $width-upload_file_card_info_name;
  154. width: 0;
  155. flex: 1;
  156. overflow: hidden;
  157. text-overflow: ellipsis;
  158. white-space: nowrap;
  159. display: inline-block;
  160. @include font-size-regular;
  161. font-weight: $font-upload_file_card_info_name-fontWeight;
  162. color: $color-upload-text;
  163. }
  164. &-size {
  165. @include font-size-small;
  166. font-weight: $font-upload_file_card_info_size-fontWeight;
  167. margin-left: $spacing-upload_file_card_info_size-marginLeft;
  168. color: $color-upload_assist-text;
  169. margin-top: 1px;
  170. }
  171. &-replace {
  172. display: inline-flex;
  173. margin-left: $spacing-tight;
  174. color: var(--semi-color-text-2);
  175. }
  176. &-validate-message {
  177. @include font-size-small;
  178. @include ver-center;
  179. color: $color-upload-text;
  180. }
  181. &-retry {
  182. @include font-size-small;
  183. color: $color-upload_retry-text;
  184. cursor: pointer;
  185. margin-left: $spacing-upload_file_card_info_retry-marginLeft;
  186. }
  187. .#{$prefix}-progress {
  188. flex-basis: 100%;
  189. margin-top: $spacing-upload_file_card_info_progress-marginTop;
  190. }
  191. }
  192. &-close {
  193. margin-left: $spacing-upload_file_card_close-marginLeft;
  194. margin-right: $spacing-upload_file_card_close-marginRight;
  195. flex-shrink: 0;
  196. }
  197. &-replace {
  198. margin-left: $spacing-tight;
  199. width: 24px;
  200. flex-shrink: 0;
  201. }
  202. &-icon {
  203. &-loading,
  204. &-error {
  205. font-size: $width-upload_file_card-icon;
  206. margin-right: $spacing-upload_file_card_icon-marginRight;
  207. }
  208. &-error {
  209. position: relative;
  210. top: $spacing-upload_picture_file_card_icon_error-top;
  211. }
  212. &-loading {
  213. .#{$prefix}-spin-wrapper svg {
  214. height: $width-upload_file_card-icon;
  215. width: $width-upload_file_card-icon;
  216. }
  217. }
  218. }
  219. &-fail {
  220. background-color: $color-upload_card_fail-bg;
  221. &:hover {
  222. background-color: $color-upload_card_fail-bg-hover;
  223. }
  224. .#{$module}-file-card {
  225. &-info-validate-message {
  226. color: $color-upload_file_card_fail_info-text;
  227. }
  228. }
  229. }
  230. }
  231. // listType = 'picture'
  232. &-picture {
  233. display: flex;
  234. &[x-prompt-pos='bottom'] {
  235. flex-direction: column;
  236. .#{$module}-prompt {
  237. order: 1;
  238. }
  239. }
  240. &[x-prompt-pos='right'] {
  241. .#{$module}-prompt {
  242. order: 1;
  243. }
  244. }
  245. &-add {
  246. background-color: $color-upload_pic_add-bg;
  247. height: $height-upload_file_pic_card;
  248. width: $width-upload_file_pic_card;
  249. box-sizing: border-box;
  250. display: inline-flex;
  251. justify-content: center;
  252. align-items: center;
  253. border: $width-upload_picture_add-border dashed $color-upload-border;
  254. color: $color-upload-icon;
  255. border-radius: $radius-upload_picture_add;
  256. cursor: pointer;
  257. &:hover {
  258. background-color: $color-upload_pic_add-bg-hover;
  259. }
  260. &:active {
  261. background-color: $color-upload_pic_add-bg-active;
  262. }
  263. }
  264. &-add-disabled {
  265. cursor: not-allowed;
  266. &:hover {
  267. background-color: $color-upload_pic_add-bg;
  268. }
  269. &:active {
  270. background-color: $color-upload_pic_add-bg;
  271. }
  272. }
  273. &-file-list {
  274. flex-basis: inherit;
  275. margin-top: 0;
  276. margin-bottom: 0;
  277. // width: 100%;
  278. }
  279. &-file-card {
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. height: $height-upload_file_pic_card;
  284. width: $width-upload_file_pic_card;
  285. border-radius: $radius-upload_picture_file_card_img;
  286. position: relative;
  287. overflow: hidden;
  288. img {
  289. height: $width-upload_picture_file_card_img;
  290. width: $width-upload_picture_file_card_img;
  291. object-fit: cover;
  292. border-radius: $radius-upload_picture_file_card_img;
  293. }
  294. &-close {
  295. visibility: hidden;
  296. display: inline-flex;
  297. position: absolute;
  298. top: $spacing-upload_picture_file_card_close-top;
  299. right: $spacing-upload_picture_file_card_close-right;
  300. border-radius: $radius-upload_picture_file_card_close;
  301. cursor: pointer;
  302. transition: all 0s;
  303. }
  304. &-icon-close {
  305. font-size: $width-upload_picture_file_card_close;
  306. color: $color-upload_picture_file_card_close-icon;
  307. }
  308. &::before {
  309. visibility: hidden;
  310. background-color: $color-upload_picture_file_card_hover-bg;
  311. content: '';
  312. position: absolute;
  313. left: 0;
  314. right: 0;
  315. top: 0;
  316. bottom: 0;
  317. }
  318. &-retry {
  319. visibility: hidden;
  320. background-color: $color-upload_file_card_retry-bg;
  321. width: $width-upload_file_card_retry;
  322. height: $width-upload_file_card_retry;
  323. position: absolute;
  324. top: 50%;
  325. left: 50%;
  326. transform: translate(-50%, -50%);
  327. color: $color-upload_file_card_retry-text;
  328. border-radius: $radius-upload_file_card_retry;
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. cursor: pointer;
  333. }
  334. &-icon-retry {
  335. transform: scale(-1, 1);
  336. font-size: $width-upload_file_card_retry-icon;
  337. }
  338. &-replace {
  339. visibility: hidden;
  340. display: inline-flex;
  341. position: absolute;
  342. cursor: pointer;
  343. top: 50%;
  344. left: 50%;
  345. color: $color-upload_replace-text;
  346. transform: translate3D(-50%, -50%, 0);
  347. }
  348. &-preview {
  349. visibility: hidden;
  350. display: inline-flex;
  351. position: absolute;
  352. cursor: pointer;
  353. top: 50%;
  354. left: 50%;
  355. transform: translate3D(-50%, -50%, 0);
  356. }
  357. &-pic-info {
  358. display: inline-flex;
  359. box-sizing: border-box;
  360. justify-content: space-between;
  361. align-items: center;
  362. position: absolute;
  363. width: 100%;
  364. height: 24px;
  365. padding: 0 10px;
  366. bottom: 0;
  367. left: 0;
  368. color: $color-upload_picture_file_card_pic_info-text;
  369. font-size: $font-upload_picture_file_card_pic_info-fontSize;
  370. font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
  371. background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
  372. }
  373. &-icon-loading,
  374. &-icon-error {
  375. position: absolute;
  376. bottom: $spacing-upload_picture_file_card_loading_error-bottom;
  377. right: $spacing-upload_picture_file_card_loading_error-right;
  378. color: $color-upload_picture_file_card_loading_error-icon;
  379. }
  380. &-icon-loading {
  381. font-size: $width-upload_picture_file_card_loading-icon;
  382. }
  383. &-show-pointer {
  384. cursor: pointer;
  385. }
  386. &-error {
  387. outline: 1px solid $color-upload_picture_file_card_error-border;
  388. }
  389. &:hover {
  390. &::before {
  391. visibility: visible;
  392. }
  393. .#{$module}-picture-file-card-close {
  394. visibility: visible;
  395. }
  396. .#{$module}-picture-file-card-replace {
  397. visibility: visible;
  398. }
  399. .#{$module}-picture-file-card-retry {
  400. visibility: visible;
  401. }
  402. .#{$module}-picture-file-card-preview {
  403. visibility: visible;
  404. }
  405. }
  406. &-uploading {
  407. &::before {
  408. visibility: visible;
  409. }
  410. }
  411. .#{$prefix}-progress-circle {
  412. position: absolute;
  413. top: 50%;
  414. left: 50%;
  415. transform: translate(-50%, -50%);
  416. }
  417. }
  418. }
  419. &-drag-area {
  420. border-radius: $radius-upload_drag_area;
  421. border: $width-upload_drag_area-border dashed $color-upload-border;
  422. width: 100%;
  423. padding: $spacing-upload_drag_area-padding;
  424. background-color: $color-upload_drag_area-bg;
  425. @include all-center;
  426. flex-direction: column;
  427. cursor: pointer;
  428. &:hover {
  429. background-color: $color-upload_drag_area-bg-hover;
  430. border-color: $color-upload_drag_area-border-hover;
  431. }
  432. &-custom {
  433. border: none;
  434. padding: 0;
  435. background-color: inherit;
  436. &:hover {
  437. background-color: inherit;
  438. }
  439. }
  440. &-legal {
  441. background-color: $color-upload_drag_area-bg-hover;
  442. border-color: $color-upload_drag_area-border-hover;
  443. .#{$module}-drag-area-sub-text {
  444. display: none;
  445. }
  446. }
  447. &-icon {
  448. color: $color-upload_drag_area_icon;
  449. }
  450. &-text {
  451. text-align: center;
  452. }
  453. &-main-text {
  454. cursor: pointer;
  455. @include font-size-regular;
  456. margin-bottom: $spacing-upload_drag_area_main_text-marginBottom;
  457. color: $color-upload_drag_area_main-text-default;
  458. &:hover {
  459. color: $color-upload_drag_area_main-text-hover;
  460. }
  461. &:active {
  462. color: $color-upload_drag_area_main-text-active;
  463. }
  464. }
  465. &-sub-text {
  466. cursor: pointer;
  467. @include font-size-small;
  468. color: $color-upload_drag_area_sub-text-default;
  469. &:hover {
  470. color: $color-upload_drag_area_sub-text-hover;
  471. }
  472. &:active {
  473. color: $color-upload_drag_area_sub-text-active;
  474. }
  475. }
  476. &-tips {
  477. @include font-size-small;
  478. font-weight: $font-upload_drag_area_tips-fontWeight;
  479. &-legal {
  480. color: $color-upload_drag_area_tips-text;
  481. }
  482. }
  483. }
  484. &-validate-message {
  485. flex-basis: 100%;
  486. flex-shrink: 0;
  487. display: block;
  488. color: $color-upload_file_card_fail_info-text;
  489. }
  490. }
  491. @import './rtl.scss';