upload.scss 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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. margin-bottom: $spacing-upload_title-marginBottom;
  90. &-choosen {
  91. margin-right: $spacing-upload_title_choosen-marginRight;
  92. }
  93. &-clear {
  94. cursor: pointer;
  95. color: $color-upload_clear-text;
  96. }
  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.#{$prefix}-icon {
  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. line-height: 0; // make the spin icon in the center
  214. .#{$prefix}-spin-wrapper svg {
  215. height: $width-upload_file_card-icon;
  216. width: $width-upload_file_card-icon;
  217. }
  218. }
  219. }
  220. &-fail {
  221. background-color: $color-upload_card_fail-bg;
  222. &:hover {
  223. background-color: $color-upload_card_fail-bg-hover;
  224. }
  225. .#{$module}-file-card {
  226. &-info-validate-message {
  227. color: $color-upload_file_card_fail_info-text;
  228. }
  229. }
  230. }
  231. }
  232. // listType = 'picture'
  233. &-picture {
  234. display: flex;
  235. &[x-prompt-pos='bottom'] {
  236. flex-direction: column;
  237. .#{$module}-prompt {
  238. order: 1;
  239. }
  240. }
  241. &[x-prompt-pos='right'] {
  242. .#{$module}-prompt {
  243. order: 1;
  244. }
  245. }
  246. &-add {
  247. background-color: $color-upload_pic_add-bg;
  248. height: $height-upload_file_pic_card;
  249. width: $width-upload_file_pic_card;
  250. box-sizing: border-box;
  251. display: inline-flex;
  252. justify-content: center;
  253. align-items: center;
  254. border: $width-upload_picture_add-border dashed $color-upload-border;
  255. color: $color-upload-icon;
  256. border-radius: $radius-upload_picture_add;
  257. cursor: pointer;
  258. &:hover {
  259. background-color: $color-upload_pic_add-bg-hover;
  260. }
  261. &:active {
  262. background-color: $color-upload_pic_add-bg-active;
  263. }
  264. }
  265. &-add-disabled {
  266. cursor: not-allowed;
  267. &:hover {
  268. background-color: $color-upload_pic_add-bg;
  269. }
  270. &:active {
  271. background-color: $color-upload_pic_add-bg;
  272. }
  273. }
  274. &-file-list {
  275. flex-basis: inherit;
  276. margin-top: 0;
  277. margin-bottom: 0;
  278. // width: 100%;
  279. }
  280. &-file-card {
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. height: $height-upload_file_pic_card;
  285. width: $width-upload_file_pic_card;
  286. border-radius: $radius-upload_picture_file_card_img;
  287. box-sizing: border-box;
  288. position: relative;
  289. overflow: hidden;
  290. img {
  291. height: $width-upload_picture_file_card_img;
  292. width: $width-upload_picture_file_card_img;
  293. object-fit: cover;
  294. border-radius: $radius-upload_picture_file_card_img;
  295. }
  296. &-custom-thumbnail {
  297. .#{$prefix}-image {
  298. img {
  299. width: inherit;
  300. height: inherit;
  301. }
  302. }
  303. }
  304. &-close {
  305. visibility: hidden;
  306. display: inline-flex;
  307. position: absolute;
  308. top: $spacing-upload_picture_file_card_close-top;
  309. right: $spacing-upload_picture_file_card_close-right;
  310. border-radius: $radius-upload_picture_file_card_close;
  311. cursor: pointer;
  312. transition: all 0s;
  313. }
  314. &-icon-close {
  315. font-size: $width-upload_picture_file_card_close;
  316. color: $color-upload_picture_file_card_close-icon;
  317. }
  318. &::before {
  319. visibility: hidden;
  320. background-color: $color-upload_picture_file_card_hover-bg;
  321. content: '';
  322. position: absolute;
  323. left: 0;
  324. right: 0;
  325. top: 0;
  326. bottom: 0;
  327. }
  328. &-retry {
  329. visibility: hidden;
  330. background-color: $color-upload_file_card_retry-bg;
  331. width: $width-upload_file_card_retry;
  332. height: $width-upload_file_card_retry;
  333. position: absolute;
  334. top: 50%;
  335. left: 50%;
  336. transform: translate(-50%, -50%);
  337. color: $color-upload_file_card_retry-text;
  338. border-radius: $radius-upload_file_card_retry;
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. cursor: pointer;
  343. }
  344. &-icon-retry {
  345. transform: scale(-1, 1);
  346. font-size: $width-upload_file_card_retry-icon;
  347. }
  348. &-replace {
  349. visibility: hidden;
  350. display: inline-flex;
  351. position: absolute;
  352. cursor: pointer;
  353. top: 50%;
  354. left: 50%;
  355. color: $color-upload_replace-text;
  356. transform: translate3D(-50%, -50%, 0);
  357. }
  358. &-preview {
  359. visibility: hidden;
  360. display: inline-flex;
  361. position: absolute;
  362. cursor: pointer;
  363. top: 50%;
  364. left: 50%;
  365. transform: translate3D(-50%, -50%, 0);
  366. }
  367. &-preview-fallback {
  368. background-color: $color-upload_pic_add-bg;
  369. border: $width-upload_picture_add-border $color-upload-border;
  370. color: $color-upload-icon;
  371. border-radius: $radius-upload_picture_add;
  372. }
  373. &-pic-info {
  374. display: inline-flex;
  375. box-sizing: border-box;
  376. justify-content: space-between;
  377. align-items: center;
  378. position: absolute;
  379. width: 100%;
  380. height: 24px;
  381. padding: 0 10px;
  382. bottom: 0;
  383. left: 0;
  384. color: $color-upload_picture_file_card_pic_info-text;
  385. font-size: $font-upload_picture_file_card_pic_info-fontSize;
  386. font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
  387. background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
  388. }
  389. &-icon-loading,
  390. &-icon-error {
  391. position: absolute;
  392. bottom: $spacing-upload_picture_file_card_loading_error-bottom;
  393. right: $spacing-upload_picture_file_card_loading_error-right;
  394. color: $color-upload_picture_file_card_loading_error-icon;
  395. }
  396. &-icon-loading {
  397. font-size: $width-upload_picture_file_card_loading-icon;
  398. }
  399. &-show-pointer {
  400. cursor: pointer;
  401. }
  402. &-error {
  403. border: 1px solid $color-upload_picture_file_card_error-border;
  404. outline: 1px solid $color-upload_picture_file_card_error-border;
  405. }
  406. &:hover {
  407. &::before {
  408. visibility: visible;
  409. }
  410. .#{$module}-picture-file-card-close {
  411. visibility: visible;
  412. }
  413. .#{$module}-picture-file-card-replace {
  414. visibility: visible;
  415. }
  416. .#{$module}-picture-file-card-retry {
  417. visibility: visible;
  418. }
  419. .#{$module}-picture-file-card-preview {
  420. visibility: visible;
  421. }
  422. }
  423. &-uploading {
  424. &::before {
  425. visibility: visible;
  426. }
  427. }
  428. .#{$prefix}-progress-circle {
  429. position: absolute;
  430. top: 50%;
  431. left: 50%;
  432. transform: translate(-50%, -50%);
  433. }
  434. }
  435. }
  436. &-drag-area {
  437. border-radius: $radius-upload_drag_area;
  438. border: $width-upload_drag_area-border dashed $color-upload-border;
  439. width: 100%;
  440. padding: $spacing-upload_drag_area-padding;
  441. background-color: $color-upload_drag_area-bg;
  442. @include all-center;
  443. flex-direction: column;
  444. cursor: pointer;
  445. &:hover {
  446. background-color: $color-upload_drag_area-bg-hover;
  447. border-color: $color-upload_drag_area-border-hover;
  448. }
  449. &-custom {
  450. border: none;
  451. padding: 0;
  452. background-color: inherit;
  453. &:hover {
  454. background-color: inherit;
  455. }
  456. }
  457. &-legal {
  458. background-color: $color-upload_drag_area-bg-hover;
  459. border-color: $color-upload_drag_area-border-hover;
  460. .#{$module}-drag-area-sub-text {
  461. display: none;
  462. }
  463. }
  464. &-icon {
  465. color: $color-upload_drag_area_icon;
  466. }
  467. &-text {
  468. text-align: center;
  469. }
  470. &-main-text {
  471. cursor: pointer;
  472. @include font-size-regular;
  473. margin-bottom: $spacing-upload_drag_area_main_text-marginBottom;
  474. color: $color-upload_drag_area_main-text-default;
  475. &:hover {
  476. color: $color-upload_drag_area_main-text-hover;
  477. }
  478. &:active {
  479. color: $color-upload_drag_area_main-text-active;
  480. }
  481. }
  482. &-sub-text {
  483. cursor: pointer;
  484. @include font-size-small;
  485. color: $color-upload_drag_area_sub-text-default;
  486. &:hover {
  487. color: $color-upload_drag_area_sub-text-hover;
  488. }
  489. &:active {
  490. color: $color-upload_drag_area_sub-text-active;
  491. }
  492. }
  493. &-tips {
  494. @include font-size-small;
  495. font-weight: $font-upload_drag_area_tips-fontWeight;
  496. &-legal {
  497. color: $color-upload_drag_area_tips-text;
  498. }
  499. }
  500. }
  501. &-validate-message {
  502. flex-basis: 100%;
  503. flex-shrink: 0;
  504. display: block;
  505. color: $color-upload_file_card_fail_info-text;
  506. }
  507. }
  508. @import './rtl.scss';