@douyinfe/semi-foundation 2.1.6-alpha.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/cascader/cascader.scss +1 -1
  2. package/cascader/constants.ts +4 -0
  3. package/cascader/foundation.ts +29 -15
  4. package/cascader/util.ts +13 -0
  5. package/datePicker/_utils/parser.ts +4 -3
  6. package/datePicker/datePicker.scss +29 -0
  7. package/datePicker/foundation.ts +31 -11
  8. package/datePicker/inputFoundation.ts +2 -0
  9. package/datePicker/monthsGridFoundation.ts +101 -8
  10. package/datePicker/rtl.scss +15 -1
  11. package/datePicker/variables.scss +2 -0
  12. package/gulpfile.js +3 -1
  13. package/lib/cjs/cascader/cascader.css +2 -2
  14. package/lib/cjs/cascader/cascader.scss +1 -1
  15. package/lib/cjs/cascader/constants.d.ts +3 -0
  16. package/lib/cjs/cascader/constants.js +6 -1
  17. package/lib/cjs/cascader/foundation.d.ts +4 -1
  18. package/lib/cjs/cascader/foundation.js +24 -11
  19. package/lib/cjs/cascader/util.d.ts +1 -0
  20. package/lib/cjs/cascader/util.js +17 -0
  21. package/lib/cjs/datePicker/_utils/parser.d.ts +6 -1
  22. package/lib/cjs/datePicker/_utils/parser.js +3 -1
  23. package/lib/cjs/datePicker/datePicker.css +32 -3
  24. package/lib/cjs/datePicker/datePicker.scss +29 -0
  25. package/lib/cjs/datePicker/foundation.d.ts +6 -3
  26. package/lib/cjs/datePicker/foundation.js +40 -14
  27. package/lib/cjs/datePicker/inputFoundation.js +3 -0
  28. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +35 -3
  29. package/lib/cjs/datePicker/monthsGridFoundation.js +139 -6
  30. package/lib/cjs/datePicker/rtl.scss +15 -1
  31. package/lib/cjs/datePicker/variables.scss +2 -0
  32. package/lib/cjs/navigation/navigation.css +0 -1
  33. package/lib/cjs/notification/notification.css +8 -4
  34. package/lib/cjs/notification/notification.scss +9 -5
  35. package/lib/cjs/notification/variables.scss +1 -0
  36. package/lib/cjs/select/foundation.d.ts +10 -1
  37. package/lib/cjs/select/foundation.js +11 -9
  38. package/lib/cjs/table/table.css +0 -2
  39. package/lib/cjs/table/table.scss +0 -2
  40. package/lib/cjs/tree/treeUtil.js +14 -14
  41. package/lib/cjs/upload/foundation.d.ts +1 -0
  42. package/lib/cjs/upload/foundation.js +106 -0
  43. package/lib/cjs/upload/rtl.scss +0 -4
  44. package/lib/cjs/upload/upload.css +30 -18
  45. package/lib/cjs/upload/upload.scss +31 -8
  46. package/lib/cjs/upload/variables.scss +5 -1
  47. package/lib/es/cascader/cascader.css +2 -2
  48. package/lib/es/cascader/cascader.scss +1 -1
  49. package/lib/es/cascader/constants.d.ts +3 -0
  50. package/lib/es/cascader/constants.js +6 -1
  51. package/lib/es/cascader/foundation.d.ts +4 -1
  52. package/lib/es/cascader/foundation.js +24 -12
  53. package/lib/es/cascader/util.d.ts +1 -0
  54. package/lib/es/cascader/util.js +14 -0
  55. package/lib/es/datePicker/_utils/parser.d.ts +6 -1
  56. package/lib/es/datePicker/_utils/parser.js +3 -1
  57. package/lib/es/datePicker/datePicker.css +32 -3
  58. package/lib/es/datePicker/datePicker.scss +29 -0
  59. package/lib/es/datePicker/foundation.d.ts +6 -3
  60. package/lib/es/datePicker/foundation.js +40 -14
  61. package/lib/es/datePicker/inputFoundation.js +3 -0
  62. package/lib/es/datePicker/monthsGridFoundation.d.ts +35 -3
  63. package/lib/es/datePicker/monthsGridFoundation.js +139 -6
  64. package/lib/es/datePicker/rtl.scss +15 -1
  65. package/lib/es/datePicker/variables.scss +2 -0
  66. package/lib/es/navigation/navigation.css +0 -1
  67. package/lib/es/notification/notification.css +8 -4
  68. package/lib/es/notification/notification.scss +9 -5
  69. package/lib/es/notification/variables.scss +1 -0
  70. package/lib/es/select/foundation.d.ts +10 -1
  71. package/lib/es/select/foundation.js +12 -9
  72. package/lib/es/table/table.css +0 -2
  73. package/lib/es/table/table.scss +0 -2
  74. package/lib/es/tree/treeUtil.js +13 -12
  75. package/lib/es/upload/foundation.d.ts +1 -0
  76. package/lib/es/upload/foundation.js +107 -0
  77. package/lib/es/upload/rtl.scss +0 -4
  78. package/lib/es/upload/upload.css +30 -18
  79. package/lib/es/upload/upload.scss +31 -8
  80. package/lib/es/upload/variables.scss +5 -1
  81. package/notification/notification.scss +9 -5
  82. package/notification/variables.scss +1 -0
  83. package/package.json +4 -4
  84. package/select/foundation.ts +11 -9
  85. package/table/table.scss +0 -2
  86. package/tree/treeUtil.ts +6 -2
  87. package/upload/foundation.ts +81 -0
  88. package/upload/rtl.scss +0 -4
  89. package/upload/upload.scss +31 -8
  90. package/upload/variables.scss +5 -1
@@ -73,6 +73,8 @@
73
73
  display: flex;
74
74
  flex-wrap: wrap;
75
75
  flex-shrink: 0;
76
+ gap: 8px;
77
+ margin-bottom: 8px;
76
78
  }
77
79
  .semi-upload-file-list-main p {
78
80
  display: flex;
@@ -99,8 +101,6 @@
99
101
  justify-content: space-between;
100
102
  height: 52px;
101
103
  width: 250px;
102
- margin-right: 8px;
103
- margin-bottom: 8px;
104
104
  background-color: var(--semi-color-fill-0);
105
105
  cursor: pointer;
106
106
  }
@@ -235,16 +235,16 @@
235
235
  flex-direction: column;
236
236
  }
237
237
  .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-prompt {
238
- order: 2;
238
+ order: 1;
239
239
  }
240
240
  .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-add {
241
- order: 1;
241
+ order: 0;
242
242
  }
243
243
  .semi-upload-picture[x-prompt-pos=right] .semi-upload-prompt {
244
- order: 2;
244
+ order: 1;
245
245
  }
246
246
  .semi-upload-picture[x-prompt-pos=right] .semi-upload-add {
247
- order: 1;
247
+ order: 0;
248
248
  }
249
249
  .semi-upload-picture-add {
250
250
  background-color: var(--semi-color-fill-0);
@@ -281,11 +281,14 @@
281
281
  margin-bottom: 0;
282
282
  }
283
283
  .semi-upload-picture-file-card {
284
+ display: flex;
285
+ align-items: center;
286
+ justify-content: center;
284
287
  height: 96px;
285
288
  width: 96px;
289
+ border-radius: var(--semi-border-radius-small);
286
290
  position: relative;
287
- margin-right: 8px;
288
- margin-bottom: 8px;
291
+ overflow: hidden;
289
292
  }
290
293
  .semi-upload-picture-file-card img {
291
294
  height: 96px;
@@ -350,6 +353,22 @@
350
353
  color: var(--semi-color-white);
351
354
  transform: translate3D(-50%, -50%, 0);
352
355
  }
356
+ .semi-upload-picture-file-card-pic-info {
357
+ display: inline-flex;
358
+ box-sizing: border-box;
359
+ justify-content: space-between;
360
+ align-items: center;
361
+ position: absolute;
362
+ width: 100%;
363
+ height: 24px;
364
+ padding: 0 10px;
365
+ bottom: 0;
366
+ left: 0;
367
+ color: var(--semi-color-white);
368
+ font-size: 12px;
369
+ font-weight: 600;
370
+ background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
371
+ }
353
372
  .semi-upload-picture-file-card-icon-loading, .semi-upload-picture-file-card-icon-error {
354
373
  position: absolute;
355
374
  bottom: 6px;
@@ -362,6 +381,9 @@
362
381
  .semi-upload-picture-file-card-show-pointer {
363
382
  cursor: pointer;
364
383
  }
384
+ .semi-upload-picture-file-card-error {
385
+ outline: 1px solid var(--semi-color-danger);
386
+ }
365
387
  .semi-upload-drag-area {
366
388
  border-radius: var(--semi-border-radius-small);
367
389
  border: 2px dashed var(--semi-color-border);
@@ -442,11 +464,6 @@
442
464
  .semi-portal-rtl .semi-upload-file-list-title-clear {
443
465
  display: inline-block;
444
466
  }
445
- .semi-rtl .semi-upload-file-card,
446
- .semi-portal-rtl .semi-upload-file-card {
447
- margin-right: 0;
448
- margin-left: 8px;
449
- }
450
467
  .semi-rtl .semi-upload-file-card-info-size,
451
468
  .semi-portal-rtl .semi-upload-file-card-info-size {
452
469
  margin-left: 0;
@@ -463,11 +480,6 @@
463
480
  margin-right: 0;
464
481
  margin-left: 2px;
465
482
  }
466
- .semi-rtl .semi-upload-picture-file-card,
467
- .semi-portal-rtl .semi-upload-picture-file-card {
468
- margin-right: 0;
469
- margin-left: 8px;
470
- }
471
483
  .semi-rtl .semi-upload-picture-file-card-close,
472
484
  .semi-portal-rtl .semi-upload-picture-file-card-close {
473
485
  right: auto;
@@ -99,6 +99,8 @@ $module: #{$prefix}-upload;
99
99
  display: flex;
100
100
  flex-wrap: wrap;
101
101
  flex-shrink: 0;
102
+ gap: $spacing-upload_picture_file_card-gap;
103
+ margin-bottom: $spacing-upload_picture_file_card-marginBottom;
102
104
 
103
105
  p {
104
106
  @include ver-center;
@@ -130,8 +132,6 @@ $module: #{$prefix}-upload;
130
132
  justify-content: space-between;
131
133
  height: $height-upload_file_card;
132
134
  width: $width-upload_file_card;
133
- margin-right: $spacing-tight;
134
- margin-bottom: $spacing-tight;
135
135
  background-color: $color-upload_card-bg;
136
136
  cursor: pointer;
137
137
 
@@ -292,21 +292,21 @@ $module: #{$prefix}-upload;
292
292
  flex-direction: column;
293
293
 
294
294
  .#{$module}-prompt {
295
- order: 2;
295
+ order: 1;
296
296
  }
297
297
 
298
298
  .#{$module}-add {
299
- order: 1;
299
+ order: 0;
300
300
  }
301
301
  }
302
302
 
303
303
  &[x-prompt-pos="right"] {
304
304
  .#{$module}-prompt {
305
- order: 2;
305
+ order: 1;
306
306
  }
307
307
 
308
308
  .#{$module}-add {
309
- order: 1;
309
+ order: 0;
310
310
  }
311
311
  }
312
312
 
@@ -353,11 +353,14 @@ $module: #{$prefix}-upload;
353
353
  }
354
354
 
355
355
  &-file-card {
356
+ display: flex;
357
+ align-items: center;
358
+ justify-content: center;
356
359
  height: $height-upload_file_pic_card;
357
360
  width: $width-upload_file_pic_card;
361
+ border-radius: $radius-upload_picture_file_card_img;
358
362
  position: relative;
359
- margin-right: $spacing-upload_picture_file_card-marginRight;
360
- margin-bottom: $spacing-upload_picture_file_card-marginBottom;
363
+ overflow: hidden;
361
364
 
362
365
  img {
363
366
  height: $width-upload_picture_file_card_img;
@@ -429,6 +432,22 @@ $module: #{$prefix}-upload;
429
432
  color: $color-upload_replace-text;
430
433
  transform: translate3D(-50%, -50%, 0);
431
434
  }
435
+ &-pic-info {
436
+ display: inline-flex;
437
+ box-sizing: border-box;
438
+ justify-content: space-between;
439
+ align-items: center;
440
+ position: absolute;
441
+ width: 100%;
442
+ height: 24px;
443
+ padding: 0 10px;
444
+ bottom: 0;
445
+ left: 0;
446
+ color: $color-upload_picture_file_card_pic_info-text;
447
+ font-size: $font-upload_picture_file_card_pic_info-fontSize;
448
+ font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
449
+ background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
450
+ }
432
451
 
433
452
  &-icon-loading,
434
453
  &-icon-error {
@@ -445,6 +464,10 @@ $module: #{$prefix}-upload;
445
464
  &-show-pointer {
446
465
  cursor: pointer;
447
466
  }
467
+
468
+ &-error {
469
+ outline: 1px solid $color-upload_picture_file_card_error-border;
470
+ }
448
471
  }
449
472
  }
450
473
 
@@ -24,6 +24,8 @@ $color-upload_pic_add-bg-hover: var(--semi-color-fill-1); // 图片墙上传背
24
24
  $color-upload_pic_add-bg: var(--semi-color-fill-0); // 图片墙上传背景色 - 默认
25
25
  $color-upload_pic_remove-bg: var(--semi-color-overlay-bg); // 图片墙上传移除图标颜色
26
26
  $color-upload_picture_file_card_loading_error-icon: var(--semi-color-danger); // 图片墙上传移除图标颜色
27
+ $color-upload_picture_file_card_error-border: var(--semi-color-danger); // 图片墙上传移除图标颜色
28
+ $color-upload_picture_file_card_pic_info-text: var(--semi-color-white); // 图片墙图片信息(序号)文字颜色
27
29
  $color-upload_preview-icon: var(--semi-color-text-2); // 上传文件卡片文本颜色
28
30
  $color-upload_retry-text: var(--semi-color-primary); // 上传文件卡片重新上传按钮文本颜色
29
31
  $color-upload_replace-text: var(--semi-color-white); // 上传文件卡片重新替换按钮文本颜色
@@ -56,7 +58,7 @@ $spacing-upload_file_card_info_progress-marginTop: 4px; // 上传文件卡片进
56
58
  $spacing-upload_file_card_close-marginLeft: $spacing-tight; // 上传文件卡片删除按钮左侧外边距
57
59
  $spacing-upload_file_card_close-marginRight: $spacing-tight; // 上传文件卡片删除按钮右侧外边距
58
60
  $spacing-upload_file_card_icon-marginRight: $spacing-super-tight; // 上传文件卡片图标右侧外边距
59
- $spacing-upload_picture_file_card-marginRight: $spacing-tight; // 图片墙上传卡片右侧外边距
61
+ $spacing-upload_picture_file_card-gap: $spacing-tight; // 图片墙卡片之间边距
60
62
  $spacing-upload_picture_file_card-marginBottom: $spacing-tight; // 图片墙上传卡片底部外边距
61
63
  $spacing-upload_picture_file_card_close-top: 8px; // 图片墙上传卡片删除按钮顶部位置
62
64
  $spacing-upload_picture_file_card_close-right: 8px; // 图片墙上传卡片删除右侧位置
@@ -79,3 +81,5 @@ $radius-upload_drag_area: var(--semi-border-radius-small); // 可拖拽上传拖
79
81
  $font-upload_file_card_info_name-fontWeight: $font-weight-bold; // 上传文件卡片文件名字重
80
82
  $font-upload_file_card_info_size-fontWeight: $font-weight-regular; // 上传文件卡片文件尺寸字重
81
83
  $font-upload_drag_area_tips-fontWeight: 600; // 可拖拽上传提示文本字重
84
+ $font-upload_picture_file_card_pic_info-fontSize: 12px; // 图片墙图片信息字体大小
85
+ $font-upload_picture_file_card_pic_info-fontWeight: 600; // 图片墙图片信息文本字重
@@ -93,23 +93,27 @@ $module: #{$prefix}-notification;
93
93
 
94
94
  &-light {
95
95
  &.#{$module}-notice-warning {
96
- background-color: $color-notification_warning_light-bg;
96
+ background-image: linear-gradient(0deg, $color-notification_warning_light-bg, $color-notification_warning_light-bg);
97
+ background-color: $color-notification_ambient-bg;
97
98
  border: $width-notification_notice-border solid $color-notification_warning_light-border;
98
99
  }
99
100
 
100
101
  &.#{$module}-notice-success {
101
- background-color: $color-notification_success_light-bg;
102
+ background-image: linear-gradient(0deg, $color-notification_success_light-bg, $color-notification_success_light-bg);
103
+ background-color: $color-notification_ambient-bg;
102
104
  border: $width-notification_notice-border solid $color-notification_success_light-border;
103
105
  }
104
106
 
105
107
  &.#{$module}-notice-info,
106
108
  &.#{$module}-notice-default {
107
- background-color: $color-notification_info_light-bg;
109
+ background-image: linear-gradient(0deg, $color-notification_info_light-bg, $color-notification_info_light-bg);
110
+ background-color: $color-notification_ambient-bg;
108
111
  border: $width-notification_notice-border solid $color-notification_info_light-border;
109
112
  }
110
113
 
111
114
  &.#{$module}-notice-error {
112
- background-color: $color-notification_danger_light-bg;
115
+ background-image: linear-gradient(0deg, $color-notification_danger_light-bg, $color-notification_danger_light-bg);
116
+ background-color: $color-notification_ambient-bg;
113
117
  border: $width-notification_notice-border solid $color-notification_danger_light-border;
114
118
  }
115
119
  }
@@ -165,4 +169,4 @@ $module: #{$prefix}-notification;
165
169
  }
166
170
  }
167
171
 
168
- @import "./rtl.scss";
172
+ @import "./rtl.scss";
@@ -15,6 +15,7 @@ $color-notification_info_light-bg: var(--semi-color-info-light-default); // 彩
15
15
  $color-notification_info_light-border: var(--semi-color-info); // 彩色通知信息描边色
16
16
  $color-notification_danger_light-bg: var(--semi-color-danger-light-default); // 彩色通知危险背景色
17
17
  $color-notification_danger_light-border: var(--semi-color-danger); // 彩色通知危险描边色
18
+ $color-notification_ambient-bg: var(--semi-color-bg-0); // 透明背景色叠加层(与bg0保持一致不建议修改)
18
19
 
19
20
  // Width/Height
20
21
  $width-notification_notice: auto; // 通知宽度
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.1.6-alpha.0",
3
+ "version": "2.2.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/runtime-corejs3": "^7.15.4",
11
- "@douyinfe/semi-animation": "2.1.5",
11
+ "@douyinfe/semi-animation": "2.2.1",
12
12
  "async-validator": "^3.5.0",
13
13
  "classnames": "^2.2.6",
14
14
  "date-fns": "^2.9.0",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "6721f8e4f803913529db3c51d6d0af5dfe616938",
27
+ "gitHead": "6d8bb9dd22bf199225fa2a0dda4f8524a4b97f6f",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -38,7 +38,7 @@
38
38
  "gulp-sass": "^5.0.0",
39
39
  "gulp-typescript": "^6.0.0-alpha.1",
40
40
  "merge2": "^1.4.1",
41
- "sass": "1.32.13",
41
+ "sass": "1.45.0",
42
42
  "through2": "^4.0.2"
43
43
  }
44
44
  }
@@ -785,15 +785,17 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
785
785
  }
786
786
 
787
787
  _removeInternalKey(option: BasicOptionProps) {
788
- delete option._parentGroup;
789
- delete option._show;
790
- delete option._selected;
791
- delete option._scrollIndex;
792
- if ('_keyInOptionList' in option) {
793
- option.key = option._keyInOptionList;
794
- delete option._keyInOptionList;
795
- }
796
- return option;
788
+ // eslint-disable-next-line
789
+ let newOption = { ...option };
790
+ delete newOption._parentGroup;
791
+ delete newOption._show;
792
+ delete newOption._selected;
793
+ delete newOption._scrollIndex;
794
+ if ('_keyInOptionList' in newOption) {
795
+ newOption.key = newOption._keyInOptionList;
796
+ delete newOption._keyInOptionList;
797
+ }
798
+ return newOption;
797
799
  }
798
800
 
799
801
  _notifySelect(value: BasicOptionProps['value'], option: BasicOptionProps) {
package/table/table.scss CHANGED
@@ -25,7 +25,6 @@ $module: #{$prefix}-table;
25
25
  }
26
26
 
27
27
  &-middle {
28
- .#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
29
28
  .#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
30
29
  padding-top: $spacing-table_middle-paddingY;
31
30
  padding-bottom: $spacing-table_middle-paddingY;
@@ -33,7 +32,6 @@ $module: #{$prefix}-table;
33
32
  }
34
33
 
35
34
  &-small {
36
- .#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
37
35
  .#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
38
36
  padding-top: $spacing-table_small-paddingY;
39
37
  padding-bottom: $spacing-table_small-paddingY;
package/tree/treeUtil.ts CHANGED
@@ -427,7 +427,7 @@ export function normalizedArr(val: any) {
427
427
  }
428
428
 
429
429
  export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnly = false) {
430
- let res: string[] = [];
430
+ const res: string[] = [];
431
431
  const keyListSet = new Set(keyList);
432
432
  if (!leafOnly) {
433
433
  keyList.forEach((key: string) => {
@@ -441,7 +441,11 @@ export function normalizeKeyList(keyList: any, keyEntities: KeyEntities, leafOnl
441
441
  res.push(key);
442
442
  });
443
443
  } else {
444
- res = (Array.from(keyList) as string[]).filter(key => keyEntities[key] && !isValid(keyEntities[key].children));
444
+ keyList.forEach(key => {
445
+ if (keyEntities[key] && !isValid(keyEntities[key].children)) {
446
+ res.push(key);
447
+ }
448
+ });
445
449
  }
446
450
  return res;
447
451
  }
@@ -320,6 +320,87 @@ class UploadFoundation<P = Record<string, any>, S = Record<string, any>> extends
320
320
  });
321
321
  }
322
322
 
323
+ // 插入多个文件到指定位置
324
+ // Insert files to the specified location
325
+ insertFileToList(files: Array<CustomFile>, index:number): void {
326
+ const { limit, transformFile, accept, uploadTrigger } = this.getProps();
327
+ const { fileList } = this.getStates();
328
+
329
+ const unAcceptFileList = [];
330
+
331
+ // 当次选中的文件
332
+ // current selected file
333
+ let currentFileList = Array.from(files);
334
+ if (typeof accept !== 'undefined') {
335
+ currentFileList = currentFileList.filter(item => {
336
+ const isValid = this.checkFileFormat(accept, item);
337
+ if (!isValid) {
338
+ unAcceptFileList.push(item);
339
+ }
340
+ return isValid;
341
+ });
342
+ if (unAcceptFileList.length !== 0) {
343
+ this._adapter.notifyAcceptInvalid(unAcceptFileList);
344
+ }
345
+ if (currentFileList.length === 0) {
346
+ return;
347
+ }
348
+ }
349
+ currentFileList = currentFileList.map(file => {
350
+ if (!file.uid) {
351
+ file.uid = getUuidv4();
352
+ }
353
+
354
+ if (this.checkFileSize(file)) {
355
+ file._sizeInvalid = true;
356
+ file.status = FILE_STATUS_VALID_FAIL;
357
+ this._adapter.notifySizeError(file, fileList);
358
+ }
359
+
360
+ if (transformFile) {
361
+ file = transformFile(file);
362
+ }
363
+ return file;
364
+ });
365
+ const total = fileList.length + currentFileList.length;
366
+ if (typeof limit !== 'undefined') {
367
+ // 判断是否超出限制
368
+ // Determine whether the limit is exceeded
369
+ if (total > limit) {
370
+ if (limit === 1) {
371
+ // 使用最后面的文件对当前文件进行替换
372
+ // Use the last file to replace the current file
373
+ currentFileList = currentFileList.slice(-1);
374
+ this._adapter.notifyFileSelect(currentFileList);
375
+ this._adapter.resetInput();
376
+ this.replaceFileList(currentFileList);
377
+ return;
378
+ }
379
+ // 如果超出了限制,则计算还能添加几个文件,将剩余的文件继续上传
380
+ // If the limit is exceeded, several files can be added to the calculation, and the remaining files will continue to be uploaded
381
+ const restNum = limit - fileList.length;
382
+ currentFileList = currentFileList.slice(0, restNum);
383
+ this._adapter.notifyExceed(currentFileList);
384
+ }
385
+ }
386
+
387
+ const fileItemList = currentFileList.map(file => this.buildFileItem(file, uploadTrigger));
388
+ const newFileList = fileList.slice();
389
+ if (typeof index !== 'undefined') {
390
+ newFileList.splice(index, 0, ...fileItemList);
391
+ } else {
392
+ newFileList.push(...fileItemList);
393
+ }
394
+
395
+ this._adapter.notifyFileSelect(currentFileList);
396
+ this._adapter.notifyChange({ fileList: newFileList, currentFile: null });
397
+ this._adapter.updateFileList(newFileList, () => {
398
+ if (uploadTrigger === TRIGGER_AUTO) {
399
+ this.startUpload(fileItemList);
400
+ }
401
+ });
402
+ }
403
+
323
404
  manualUpload(): void {
324
405
  // find the list of files that have not been uploaded
325
406
  const waitToUploadFileList = this.getState('fileList').filter((item: BaseFileItem) => item.status === FILE_STATUS_WAIT_UPLOAD);
package/upload/rtl.scss CHANGED
@@ -22,8 +22,6 @@ $module: #{$prefix}-upload;
22
22
  }
23
23
 
24
24
  &-file-card {
25
- margin-right: 0;
26
- margin-left: $spacing-upload_picture_file_card-marginRight;
27
25
 
28
26
  &-info {
29
27
 
@@ -53,8 +51,6 @@ $module: #{$prefix}-upload;
53
51
  &-picture {
54
52
 
55
53
  &-file-card {
56
- margin-right: 0;
57
- margin-left: $spacing-upload_picture_file_card-marginRight;
58
54
 
59
55
  &-close {
60
56
  right: auto;
@@ -99,6 +99,8 @@ $module: #{$prefix}-upload;
99
99
  display: flex;
100
100
  flex-wrap: wrap;
101
101
  flex-shrink: 0;
102
+ gap: $spacing-upload_picture_file_card-gap;
103
+ margin-bottom: $spacing-upload_picture_file_card-marginBottom;
102
104
 
103
105
  p {
104
106
  @include ver-center;
@@ -130,8 +132,6 @@ $module: #{$prefix}-upload;
130
132
  justify-content: space-between;
131
133
  height: $height-upload_file_card;
132
134
  width: $width-upload_file_card;
133
- margin-right: $spacing-tight;
134
- margin-bottom: $spacing-tight;
135
135
  background-color: $color-upload_card-bg;
136
136
  cursor: pointer;
137
137
 
@@ -292,21 +292,21 @@ $module: #{$prefix}-upload;
292
292
  flex-direction: column;
293
293
 
294
294
  .#{$module}-prompt {
295
- order: 2;
295
+ order: 1;
296
296
  }
297
297
 
298
298
  .#{$module}-add {
299
- order: 1;
299
+ order: 0;
300
300
  }
301
301
  }
302
302
 
303
303
  &[x-prompt-pos="right"] {
304
304
  .#{$module}-prompt {
305
- order: 2;
305
+ order: 1;
306
306
  }
307
307
 
308
308
  .#{$module}-add {
309
- order: 1;
309
+ order: 0;
310
310
  }
311
311
  }
312
312
 
@@ -353,11 +353,14 @@ $module: #{$prefix}-upload;
353
353
  }
354
354
 
355
355
  &-file-card {
356
+ display: flex;
357
+ align-items: center;
358
+ justify-content: center;
356
359
  height: $height-upload_file_pic_card;
357
360
  width: $width-upload_file_pic_card;
361
+ border-radius: $radius-upload_picture_file_card_img;
358
362
  position: relative;
359
- margin-right: $spacing-upload_picture_file_card-marginRight;
360
- margin-bottom: $spacing-upload_picture_file_card-marginBottom;
363
+ overflow: hidden;
361
364
 
362
365
  img {
363
366
  height: $width-upload_picture_file_card_img;
@@ -429,6 +432,22 @@ $module: #{$prefix}-upload;
429
432
  color: $color-upload_replace-text;
430
433
  transform: translate3D(-50%, -50%, 0);
431
434
  }
435
+ &-pic-info {
436
+ display: inline-flex;
437
+ box-sizing: border-box;
438
+ justify-content: space-between;
439
+ align-items: center;
440
+ position: absolute;
441
+ width: 100%;
442
+ height: 24px;
443
+ padding: 0 10px;
444
+ bottom: 0;
445
+ left: 0;
446
+ color: $color-upload_picture_file_card_pic_info-text;
447
+ font-size: $font-upload_picture_file_card_pic_info-fontSize;
448
+ font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
449
+ background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
450
+ }
432
451
 
433
452
  &-icon-loading,
434
453
  &-icon-error {
@@ -445,6 +464,10 @@ $module: #{$prefix}-upload;
445
464
  &-show-pointer {
446
465
  cursor: pointer;
447
466
  }
467
+
468
+ &-error {
469
+ outline: 1px solid $color-upload_picture_file_card_error-border;
470
+ }
448
471
  }
449
472
  }
450
473
 
@@ -24,6 +24,8 @@ $color-upload_pic_add-bg-hover: var(--semi-color-fill-1); // 图片墙上传背
24
24
  $color-upload_pic_add-bg: var(--semi-color-fill-0); // 图片墙上传背景色 - 默认
25
25
  $color-upload_pic_remove-bg: var(--semi-color-overlay-bg); // 图片墙上传移除图标颜色
26
26
  $color-upload_picture_file_card_loading_error-icon: var(--semi-color-danger); // 图片墙上传移除图标颜色
27
+ $color-upload_picture_file_card_error-border: var(--semi-color-danger); // 图片墙上传移除图标颜色
28
+ $color-upload_picture_file_card_pic_info-text: var(--semi-color-white); // 图片墙图片信息(序号)文字颜色
27
29
  $color-upload_preview-icon: var(--semi-color-text-2); // 上传文件卡片文本颜色
28
30
  $color-upload_retry-text: var(--semi-color-primary); // 上传文件卡片重新上传按钮文本颜色
29
31
  $color-upload_replace-text: var(--semi-color-white); // 上传文件卡片重新替换按钮文本颜色
@@ -56,7 +58,7 @@ $spacing-upload_file_card_info_progress-marginTop: 4px; // 上传文件卡片进
56
58
  $spacing-upload_file_card_close-marginLeft: $spacing-tight; // 上传文件卡片删除按钮左侧外边距
57
59
  $spacing-upload_file_card_close-marginRight: $spacing-tight; // 上传文件卡片删除按钮右侧外边距
58
60
  $spacing-upload_file_card_icon-marginRight: $spacing-super-tight; // 上传文件卡片图标右侧外边距
59
- $spacing-upload_picture_file_card-marginRight: $spacing-tight; // 图片墙上传卡片右侧外边距
61
+ $spacing-upload_picture_file_card-gap: $spacing-tight; // 图片墙卡片之间边距
60
62
  $spacing-upload_picture_file_card-marginBottom: $spacing-tight; // 图片墙上传卡片底部外边距
61
63
  $spacing-upload_picture_file_card_close-top: 8px; // 图片墙上传卡片删除按钮顶部位置
62
64
  $spacing-upload_picture_file_card_close-right: 8px; // 图片墙上传卡片删除右侧位置
@@ -79,3 +81,5 @@ $radius-upload_drag_area: var(--semi-border-radius-small); // 可拖拽上传拖
79
81
  $font-upload_file_card_info_name-fontWeight: $font-weight-bold; // 上传文件卡片文件名字重
80
82
  $font-upload_file_card_info_size-fontWeight: $font-weight-regular; // 上传文件卡片文件尺寸字重
81
83
  $font-upload_drag_area_tips-fontWeight: 600; // 可拖拽上传提示文本字重
84
+ $font-upload_picture_file_card_pic_info-fontSize: 12px; // 图片墙图片信息字体大小
85
+ $font-upload_picture_file_card_pic_info-fontWeight: 600; // 图片墙图片信息文本字重