upload.scss 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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. 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. position: relative;
  288. overflow: hidden;
  289. img {
  290. height: $width-upload_picture_file_card_img;
  291. width: $width-upload_picture_file_card_img;
  292. object-fit: cover;
  293. border-radius: $radius-upload_picture_file_card_img;
  294. }
  295. &-close {
  296. visibility: hidden;
  297. display: inline-flex;
  298. position: absolute;
  299. top: $spacing-upload_picture_file_card_close-top;
  300. right: $spacing-upload_picture_file_card_close-right;
  301. border-radius: $radius-upload_picture_file_card_close;
  302. cursor: pointer;
  303. transition: all 0s;
  304. }
  305. &-icon-close {
  306. font-size: $width-upload_picture_file_card_close;
  307. color: $color-upload_picture_file_card_close-icon;
  308. }
  309. &::before {
  310. visibility: hidden;
  311. background-color: $color-upload_picture_file_card_hover-bg;
  312. content: '';
  313. position: absolute;
  314. left: 0;
  315. right: 0;
  316. top: 0;
  317. bottom: 0;
  318. }
  319. &-retry {
  320. visibility: hidden;
  321. background-color: $color-upload_file_card_retry-bg;
  322. width: $width-upload_file_card_retry;
  323. height: $width-upload_file_card_retry;
  324. position: absolute;
  325. top: 50%;
  326. left: 50%;
  327. transform: translate(-50%, -50%);
  328. color: $color-upload_file_card_retry-text;
  329. border-radius: $radius-upload_file_card_retry;
  330. display: flex;
  331. align-items: center;
  332. justify-content: center;
  333. cursor: pointer;
  334. }
  335. &-icon-retry {
  336. transform: scale(-1, 1);
  337. font-size: $width-upload_file_card_retry-icon;
  338. }
  339. &-replace {
  340. visibility: hidden;
  341. display: inline-flex;
  342. position: absolute;
  343. cursor: pointer;
  344. top: 50%;
  345. left: 50%;
  346. color: $color-upload_replace-text;
  347. transform: translate3D(-50%, -50%, 0);
  348. }
  349. &-preview {
  350. visibility: hidden;
  351. display: inline-flex;
  352. position: absolute;
  353. cursor: pointer;
  354. top: 50%;
  355. left: 50%;
  356. transform: translate3D(-50%, -50%, 0);
  357. }
  358. &-pic-info {
  359. display: inline-flex;
  360. box-sizing: border-box;
  361. justify-content: space-between;
  362. align-items: center;
  363. position: absolute;
  364. width: 100%;
  365. height: 24px;
  366. padding: 0 10px;
  367. bottom: 0;
  368. left: 0;
  369. color: $color-upload_picture_file_card_pic_info-text;
  370. font-size: $font-upload_picture_file_card_pic_info-fontSize;
  371. font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
  372. background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
  373. }
  374. &-icon-loading,
  375. &-icon-error {
  376. position: absolute;
  377. bottom: $spacing-upload_picture_file_card_loading_error-bottom;
  378. right: $spacing-upload_picture_file_card_loading_error-right;
  379. color: $color-upload_picture_file_card_loading_error-icon;
  380. }
  381. &-icon-loading {
  382. font-size: $width-upload_picture_file_card_loading-icon;
  383. }
  384. &-show-pointer {
  385. cursor: pointer;
  386. }
  387. &-error {
  388. outline: 1px solid $color-upload_picture_file_card_error-border;
  389. }
  390. &:hover {
  391. &::before {
  392. visibility: visible;
  393. }
  394. .#{$module}-picture-file-card-close {
  395. visibility: visible;
  396. }
  397. .#{$module}-picture-file-card-replace {
  398. visibility: visible;
  399. }
  400. .#{$module}-picture-file-card-retry {
  401. visibility: visible;
  402. }
  403. .#{$module}-picture-file-card-preview {
  404. visibility: visible;
  405. }
  406. }
  407. &-uploading {
  408. &::before {
  409. visibility: visible;
  410. }
  411. }
  412. .#{$prefix}-progress-circle {
  413. position: absolute;
  414. top: 50%;
  415. left: 50%;
  416. transform: translate(-50%, -50%);
  417. }
  418. }
  419. }
  420. &-drag-area {
  421. border-radius: $radius-upload_drag_area;
  422. border: $width-upload_drag_area-border dashed $color-upload-border;
  423. width: 100%;
  424. padding: $spacing-upload_drag_area-padding;
  425. background-color: $color-upload_drag_area-bg;
  426. @include all-center;
  427. flex-direction: column;
  428. cursor: pointer;
  429. &:hover {
  430. background-color: $color-upload_drag_area-bg-hover;
  431. border-color: $color-upload_drag_area-border-hover;
  432. }
  433. &-custom {
  434. border: none;
  435. padding: 0;
  436. background-color: inherit;
  437. &:hover {
  438. background-color: inherit;
  439. }
  440. }
  441. &-legal {
  442. background-color: $color-upload_drag_area-bg-hover;
  443. border-color: $color-upload_drag_area-border-hover;
  444. .#{$module}-drag-area-sub-text {
  445. display: none;
  446. }
  447. }
  448. &-icon {
  449. color: $color-upload_drag_area_icon;
  450. }
  451. &-text {
  452. text-align: center;
  453. }
  454. &-main-text {
  455. cursor: pointer;
  456. @include font-size-regular;
  457. margin-bottom: $spacing-upload_drag_area_main_text-marginBottom;
  458. color: $color-upload_drag_area_main-text-default;
  459. &:hover {
  460. color: $color-upload_drag_area_main-text-hover;
  461. }
  462. &:active {
  463. color: $color-upload_drag_area_main-text-active;
  464. }
  465. }
  466. &-sub-text {
  467. cursor: pointer;
  468. @include font-size-small;
  469. color: $color-upload_drag_area_sub-text-default;
  470. &:hover {
  471. color: $color-upload_drag_area_sub-text-hover;
  472. }
  473. &:active {
  474. color: $color-upload_drag_area_sub-text-active;
  475. }
  476. }
  477. &-tips {
  478. @include font-size-small;
  479. font-weight: $font-upload_drag_area_tips-fontWeight;
  480. &-legal {
  481. color: $color-upload_drag_area_tips-text;
  482. }
  483. }
  484. }
  485. &-validate-message {
  486. flex-basis: 100%;
  487. flex-shrink: 0;
  488. display: block;
  489. color: $color-upload_file_card_fail_info-text;
  490. }
  491. }
  492. @import './rtl.scss';