@douyinfe/semi-foundation 2.4.1 → 2.5.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 (93) hide show
  1. package/button/constants.ts +2 -2
  2. package/cascader/cascader.scss +3 -2
  3. package/cascader/variables.scss +6 -3
  4. package/datePicker/foundation.ts +12 -0
  5. package/form/form.scss +7 -1
  6. package/form/foundation.ts +40 -36
  7. package/form/interface.ts +1 -1
  8. package/input/input.scss +2 -1
  9. package/lib/cjs/autoComplete/constants.d.ts +1 -1
  10. package/lib/cjs/button/constants.d.ts +9 -1
  11. package/lib/cjs/cascader/cascader.css +2 -1
  12. package/lib/cjs/cascader/cascader.scss +3 -2
  13. package/lib/cjs/cascader/variables.scss +6 -3
  14. package/lib/cjs/datePicker/foundation.d.ts +5 -0
  15. package/lib/cjs/datePicker/foundation.js +18 -0
  16. package/lib/cjs/dropdown/constants.d.ts +1 -1
  17. package/lib/cjs/form/form.css +4 -0
  18. package/lib/cjs/form/form.scss +7 -1
  19. package/lib/cjs/form/foundation.d.ts +6 -6
  20. package/lib/cjs/form/foundation.js +51 -52
  21. package/lib/cjs/form/interface.d.ts +1 -1
  22. package/lib/cjs/input/input.css +1 -0
  23. package/lib/cjs/input/input.scss +2 -1
  24. package/lib/cjs/select/constants.d.ts +1 -1
  25. package/lib/cjs/select/foundation.d.ts +1 -1
  26. package/lib/cjs/select/foundation.js +2 -1
  27. package/lib/cjs/select/optionFoundation.d.ts +1 -1
  28. package/lib/cjs/select/optionFoundation.js +3 -3
  29. package/lib/cjs/slider/foundation.js +2 -2
  30. package/lib/cjs/table/foundation.d.ts +2 -0
  31. package/lib/cjs/table/foundation.js +16 -4
  32. package/lib/cjs/table/table.css +0 -1
  33. package/lib/cjs/table/table.scss +3 -4
  34. package/lib/cjs/table/utils.js +4 -1
  35. package/lib/cjs/tooltip/constants.d.ts +1 -1
  36. package/lib/cjs/tooltip/constants.js +1 -1
  37. package/lib/cjs/tooltip/foundation.js +65 -4
  38. package/lib/cjs/tree/foundation.d.ts +4 -1
  39. package/lib/cjs/tree/foundation.js +69 -20
  40. package/lib/cjs/treeSelect/foundation.d.ts +3 -3
  41. package/lib/cjs/treeSelect/foundation.js +103 -35
  42. package/lib/cjs/upload/upload.css +49 -27
  43. package/lib/cjs/upload/upload.scss +66 -41
  44. package/lib/cjs/upload/variables.scss +3 -1
  45. package/lib/es/autoComplete/constants.d.ts +1 -1
  46. package/lib/es/button/constants.d.ts +9 -1
  47. package/lib/es/cascader/cascader.css +2 -1
  48. package/lib/es/cascader/cascader.scss +3 -2
  49. package/lib/es/cascader/variables.scss +6 -3
  50. package/lib/es/datePicker/foundation.d.ts +5 -0
  51. package/lib/es/datePicker/foundation.js +18 -0
  52. package/lib/es/dropdown/constants.d.ts +1 -1
  53. package/lib/es/form/form.css +4 -0
  54. package/lib/es/form/form.scss +7 -1
  55. package/lib/es/form/foundation.d.ts +6 -6
  56. package/lib/es/form/foundation.js +51 -52
  57. package/lib/es/form/interface.d.ts +1 -1
  58. package/lib/es/input/input.css +1 -0
  59. package/lib/es/input/input.scss +2 -1
  60. package/lib/es/select/constants.d.ts +1 -1
  61. package/lib/es/select/foundation.d.ts +1 -1
  62. package/lib/es/select/foundation.js +2 -1
  63. package/lib/es/select/optionFoundation.d.ts +1 -1
  64. package/lib/es/select/optionFoundation.js +3 -3
  65. package/lib/es/slider/foundation.js +2 -2
  66. package/lib/es/table/foundation.d.ts +2 -0
  67. package/lib/es/table/foundation.js +16 -4
  68. package/lib/es/table/table.css +0 -1
  69. package/lib/es/table/table.scss +3 -4
  70. package/lib/es/table/utils.js +4 -1
  71. package/lib/es/tooltip/constants.d.ts +1 -1
  72. package/lib/es/tooltip/constants.js +1 -1
  73. package/lib/es/tooltip/foundation.js +65 -4
  74. package/lib/es/tree/foundation.d.ts +4 -1
  75. package/lib/es/tree/foundation.js +69 -20
  76. package/lib/es/treeSelect/foundation.d.ts +3 -3
  77. package/lib/es/treeSelect/foundation.js +102 -35
  78. package/lib/es/upload/upload.css +49 -27
  79. package/lib/es/upload/upload.scss +66 -41
  80. package/lib/es/upload/variables.scss +3 -1
  81. package/package.json +3 -3
  82. package/select/foundation.ts +3 -2
  83. package/select/optionFoundation.ts +3 -3
  84. package/slider/foundation.ts +2 -2
  85. package/table/foundation.ts +23 -10
  86. package/table/table.scss +3 -4
  87. package/table/utils.ts +3 -1
  88. package/tooltip/constants.ts +2 -0
  89. package/tooltip/foundation.ts +52 -4
  90. package/tree/foundation.ts +56 -17
  91. package/treeSelect/foundation.ts +89 -41
  92. package/upload/upload.scss +66 -41
  93. package/upload/variables.scss +3 -1
@@ -124,6 +124,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
124
124
  selectedKeys = [],
125
125
  checkedKeys = new _Set([]),
126
126
  halfCheckedKeys = new _Set([]),
127
+ realCheckedKeys = new _Set([]),
127
128
  keyEntities = {},
128
129
  filteredKeys = new _Set([]),
129
130
  inputValue = '',
@@ -133,13 +134,26 @@ export default class TreeSelectFoundation extends BaseFoundation {
133
134
  disabledKeys = new _Set([])
134
135
  } = this.getStates();
135
136
  const {
136
- treeNodeFilterProp
137
+ treeNodeFilterProp,
138
+ checkRelation
137
139
  } = this.getProps();
138
140
  const entity = keyEntities[key];
139
141
  const notExist = !entity;
140
142
 
141
143
  if (notExist) {
142
144
  return null;
145
+ } // if checkRelation is invalid, the checked status of node will be false
146
+
147
+
148
+ let realChecked = false;
149
+ let realHalfChecked = false;
150
+
151
+ if (checkRelation === 'related') {
152
+ realChecked = checkedKeys.has(key);
153
+ realHalfChecked = halfCheckedKeys.has(key);
154
+ } else if (checkRelation === 'unRelated') {
155
+ realChecked = realCheckedKeys.has(key);
156
+ realHalfChecked = false;
143
157
  }
144
158
 
145
159
  const isSearching = Boolean(inputValue);
@@ -147,8 +161,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
147
161
  eventKey: key,
148
162
  expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
149
163
  selected: _includesInstanceProperty(selectedKeys).call(selectedKeys, key),
150
- checked: checkedKeys.has(key),
151
- halfChecked: halfCheckedKeys.has(key),
164
+ checked: realChecked,
165
+ halfChecked: realHalfChecked,
152
166
  pos: String(entity ? entity.pos : ''),
153
167
  level: entity.level,
154
168
  filtered: filteredKeys.has(key),
@@ -214,9 +228,16 @@ export default class TreeSelectFoundation extends BaseFoundation {
214
228
  keyEntities
215
229
  } = this.getStates();
216
230
  const {
217
- leafOnly
231
+ leafOnly,
232
+ checkRelation
218
233
  } = this.getProps();
219
- const keyList = normalizeKeyList(key, keyEntities, leafOnly);
234
+ let keyList = [];
235
+
236
+ if (checkRelation === 'related') {
237
+ keyList = normalizeKeyList(key, keyEntities, leafOnly);
238
+ } else if (checkRelation === 'unRelated') {
239
+ keyList = key;
240
+ }
220
241
 
221
242
  const nodes = _mapInstanceProperty(keyList).call(keyList, i => keyEntities[i].data);
222
243
 
@@ -343,7 +364,8 @@ export default class TreeSelectFoundation extends BaseFoundation {
343
364
  this._adapter.updateState({
344
365
  selectedKeys: [],
345
366
  checkedKeys: new _Set(),
346
- halfCheckedKeys: new _Set()
367
+ halfCheckedKeys: new _Set(),
368
+ realCheckedKeys: new _Set([])
347
369
  });
348
370
  } // When triggerSearch, clicking the clear button will trigger to clear Input
349
371
 
@@ -371,11 +393,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
371
393
 
372
394
  removeTag(eventKey) {
373
395
  const {
374
- disableStrictly
396
+ disableStrictly,
397
+ checkRelation
375
398
  } = this.getProps();
376
399
  const {
377
400
  keyEntities,
378
- disabledKeys
401
+ disabledKeys,
402
+ realCheckedKeys
379
403
  } = this.getStates();
380
404
  const item = keyEntities[eventKey].data;
381
405
 
@@ -383,20 +407,35 @@ export default class TreeSelectFoundation extends BaseFoundation {
383
407
  return;
384
408
  }
385
409
 
386
- const {
387
- checkedKeys,
388
- halfCheckedKeys
389
- } = this.calcCheckedKeys(eventKey, false);
410
+ if (checkRelation === 'unRelated') {
411
+ const newRealCheckedKeys = new _Set(realCheckedKeys);
412
+ newRealCheckedKeys.delete(eventKey);
390
413
 
391
- this._notifyChange([...checkedKeys], null);
414
+ this._notifyChange([...newRealCheckedKeys], null);
392
415
 
393
- if (!this._isControlledComponent()) {
394
- this._adapter.updateState({
416
+ if (!this._isControlledComponent()) {
417
+ this._adapter.updateState({
418
+ realCheckedKeys: newRealCheckedKeys
419
+ });
420
+
421
+ this._adapter.rePositionDropdown();
422
+ }
423
+ } else if (checkRelation === 'related') {
424
+ const {
395
425
  checkedKeys,
396
426
  halfCheckedKeys
397
- });
427
+ } = this.calcCheckedKeys(eventKey, false);
398
428
 
399
- this._adapter.rePositionDropdown();
429
+ this._notifyChange([...checkedKeys], null);
430
+
431
+ if (!this._isControlledComponent()) {
432
+ this._adapter.updateState({
433
+ checkedKeys,
434
+ halfCheckedKeys
435
+ });
436
+
437
+ this._adapter.rePositionDropdown();
438
+ }
400
439
  }
401
440
 
402
441
  this._adapter.notifySelect(eventKey, false, item); // reposition dropdown when selected values change
@@ -547,39 +586,67 @@ export default class TreeSelectFoundation extends BaseFoundation {
547
586
  handleMultipleSelect(e, treeNode) {
548
587
  const {
549
588
  searchPosition,
550
- disableStrictly
589
+ disableStrictly,
590
+ checkRelation
551
591
  } = this.getProps();
552
592
  const {
553
- inputValue
593
+ inputValue,
594
+ realCheckedKeys
554
595
  } = this.getStates();
555
596
  const {
556
597
  checked,
557
598
  eventKey,
558
599
  data
559
600
  } = treeNode;
560
- const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
561
- const {
562
- checkedKeys,
563
- halfCheckedKeys
564
- } = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
565
601
 
566
- this._adapter.notifySelect(eventKey, targetStatus, data);
602
+ if (checkRelation === 'related') {
603
+ const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
604
+ const {
605
+ checkedKeys,
606
+ halfCheckedKeys
607
+ } = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
567
608
 
568
- this._notifyChange([...checkedKeys], e);
609
+ this._adapter.notifySelect(eventKey, targetStatus, data);
569
610
 
570
- if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
571
- this._adapter.updateState({
572
- inputValue: ''
573
- });
611
+ this._notifyChange([...checkedKeys], e);
612
+
613
+ if (!this._isControlledComponent()) {
614
+ this._adapter.updateState({
615
+ checkedKeys,
616
+ halfCheckedKeys
617
+ });
618
+
619
+ this._adapter.rePositionDropdown();
620
+ }
621
+ } else if (checkRelation === 'unRelated') {
622
+ const newRealCheckedKeys = new _Set(realCheckedKeys);
623
+ let targetStatus;
624
+
625
+ if (realCheckedKeys.has(eventKey)) {
626
+ newRealCheckedKeys.delete(eventKey);
627
+ targetStatus = false;
628
+ } else {
629
+ newRealCheckedKeys.add(eventKey);
630
+ targetStatus = true;
631
+ }
632
+
633
+ this._adapter.notifySelect(eventKey, targetStatus, data);
634
+
635
+ this._notifyChange([...newRealCheckedKeys], e);
636
+
637
+ if (!this._isControlledComponent()) {
638
+ this._adapter.updateState({
639
+ realCheckedKeys: newRealCheckedKeys
640
+ });
641
+
642
+ this._adapter.rePositionDropdown();
643
+ }
574
644
  }
575
645
 
576
- if (!this._isControlledComponent()) {
646
+ if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
577
647
  this._adapter.updateState({
578
- checkedKeys,
579
- halfCheckedKeys
648
+ inputValue: ''
580
649
  });
581
-
582
- this._adapter.rePositionDropdown();
583
650
  }
584
651
  }
585
652
 
@@ -53,11 +53,10 @@
53
53
  }
54
54
  .semi-upload[x-prompt-pos=left] .semi-upload-add {
55
55
  display: inline-flex;
56
- order: 2;
57
56
  }
58
57
  .semi-upload[x-prompt-pos=left] .semi-upload-prompt {
59
58
  display: inline-flex;
60
- order: 1;
59
+ order: -1;
61
60
  }
62
61
  .semi-upload[x-prompt-pos=left] .semi-upload-file-list {
63
62
  order: 2;
@@ -237,15 +236,9 @@
237
236
  .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-prompt {
238
237
  order: 1;
239
238
  }
240
- .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-add {
241
- order: 0;
242
- }
243
239
  .semi-upload-picture[x-prompt-pos=right] .semi-upload-prompt {
244
240
  order: 1;
245
241
  }
246
- .semi-upload-picture[x-prompt-pos=right] .semi-upload-add {
247
- order: 0;
248
- }
249
242
  .semi-upload-picture-add {
250
243
  background-color: var(--semi-color-fill-0);
251
244
  height: 96px;
@@ -257,7 +250,6 @@
257
250
  border: 2px dashed var(--semi-color-border);
258
251
  color: var(--semi-color-tertiary);
259
252
  border-radius: var(--semi-border-radius-small);
260
- order: 2;
261
253
  cursor: pointer;
262
254
  }
263
255
  .semi-upload-picture-add:hover {
@@ -297,35 +289,32 @@
297
289
  border-radius: var(--semi-border-radius-small);
298
290
  }
299
291
  .semi-upload-picture-file-card-close {
300
- width: 16px;
301
- height: 16px;
302
- background-color: var(--semi-color-overlay-bg);
292
+ visibility: hidden;
293
+ display: inline-flex;
303
294
  position: absolute;
304
295
  top: 8px;
305
296
  right: 8px;
306
- display: flex;
307
- justify-content: center;
308
- align-items: center;
309
- display: none;
310
297
  border-radius: var(--semi-border-radius-circle);
311
- color: white;
312
298
  cursor: pointer;
313
299
  transition: all 0s;
314
300
  }
315
- .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-close {
316
- display: flex;
317
- }
318
- .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-replace {
319
- visibility: visible;
301
+ .semi-upload-picture-file-card-icon-close {
302
+ font-size: 16px;
303
+ color: var(--semi-color-white);
320
304
  }
321
- .semi-upload-picture-file-card .semi-progress-circle {
305
+ .semi-upload-picture-file-card::before {
306
+ visibility: hidden;
307
+ background-color: var(--semi-color-overlay-bg);
308
+ content: "";
322
309
  position: absolute;
323
- top: 50%;
324
- left: 50%;
325
- transform: translate(-50%, -50%);
310
+ left: 0;
311
+ right: 0;
312
+ top: 0;
313
+ bottom: 0;
326
314
  }
327
315
  .semi-upload-picture-file-card-retry {
328
- background-color: #fff;
316
+ visibility: hidden;
317
+ background-color: var(--semi-color-white);
329
318
  width: 24px;
330
319
  height: 24px;
331
320
  position: absolute;
@@ -353,6 +342,15 @@
353
342
  color: var(--semi-color-white);
354
343
  transform: translate3D(-50%, -50%, 0);
355
344
  }
345
+ .semi-upload-picture-file-card-preview {
346
+ visibility: hidden;
347
+ display: inline-flex;
348
+ position: absolute;
349
+ cursor: pointer;
350
+ top: 50%;
351
+ left: 50%;
352
+ transform: translate3D(-50%, -50%, 0);
353
+ }
356
354
  .semi-upload-picture-file-card-pic-info {
357
355
  display: inline-flex;
358
356
  box-sizing: border-box;
@@ -384,6 +382,30 @@
384
382
  .semi-upload-picture-file-card-error {
385
383
  outline: 1px solid var(--semi-color-danger);
386
384
  }
385
+ .semi-upload-picture-file-card:hover::before {
386
+ visibility: visible;
387
+ }
388
+ .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-close {
389
+ visibility: visible;
390
+ }
391
+ .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-replace {
392
+ visibility: visible;
393
+ }
394
+ .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-retry {
395
+ visibility: visible;
396
+ }
397
+ .semi-upload-picture-file-card:hover .semi-upload-picture-file-card-preview {
398
+ visibility: visible;
399
+ }
400
+ .semi-upload-picture-file-card-uploading::before {
401
+ visibility: visible;
402
+ }
403
+ .semi-upload-picture-file-card .semi-progress-circle {
404
+ position: absolute;
405
+ top: 50%;
406
+ left: 50%;
407
+ transform: translate(-50%, -50%);
408
+ }
387
409
  .semi-upload-drag-area {
388
410
  border-radius: var(--semi-border-radius-small);
389
411
  border: 2px dashed var(--semi-color-border);
@@ -1,4 +1,4 @@
1
- @import "./variables.scss";
1
+ @import './variables.scss';
2
2
 
3
3
  $module: #{$prefix}-upload;
4
4
 
@@ -47,7 +47,7 @@ $module: #{$prefix}-upload;
47
47
  align-items: center;
48
48
  }
49
49
 
50
- &[x-prompt-pos="right"] {
50
+ &[x-prompt-pos='right'] {
51
51
  .#{$module}-add {
52
52
  display: inline-flex;
53
53
  }
@@ -57,7 +57,7 @@ $module: #{$prefix}-upload;
57
57
  }
58
58
  }
59
59
 
60
- &[x-prompt-pos="bottom"] {
60
+ &[x-prompt-pos='bottom'] {
61
61
  .#{$module}-add {
62
62
  display: flex;
63
63
  }
@@ -72,15 +72,14 @@ $module: #{$prefix}-upload;
72
72
  }
73
73
  }
74
74
 
75
- &[x-prompt-pos="left"] {
75
+ &[x-prompt-pos='left'] {
76
76
  .#{$module}-add {
77
77
  display: inline-flex;
78
- order: 2;
79
78
  }
80
79
 
81
80
  .#{$module}-prompt {
82
81
  display: inline-flex;
83
- order: 1;
82
+ order: -1;
84
83
  }
85
84
 
86
85
  .#{$module}-file-list {
@@ -247,7 +246,6 @@ $module: #{$prefix}-upload;
247
246
  }
248
247
 
249
248
  &-icon {
250
-
251
249
  &-loading,
252
250
  &-error {
253
251
  font-size: $width-upload_file_card-icon;
@@ -275,7 +273,6 @@ $module: #{$prefix}-upload;
275
273
  }
276
274
 
277
275
  .#{$module}-file-card {
278
-
279
276
  &-info-validate-message {
280
277
  color: $color-upload_file_card_fail_info-text;
281
278
  }
@@ -288,26 +285,18 @@ $module: #{$prefix}-upload;
288
285
  &-picture {
289
286
  display: flex;
290
287
 
291
- &[x-prompt-pos="bottom"] {
288
+ &[x-prompt-pos='bottom'] {
292
289
  flex-direction: column;
293
290
 
294
291
  .#{$module}-prompt {
295
292
  order: 1;
296
293
  }
297
-
298
- .#{$module}-add {
299
- order: 0;
300
- }
301
294
  }
302
295
 
303
- &[x-prompt-pos="right"] {
296
+ &[x-prompt-pos='right'] {
304
297
  .#{$module}-prompt {
305
298
  order: 1;
306
299
  }
307
-
308
- .#{$module}-add {
309
- order: 0;
310
- }
311
300
  }
312
301
 
313
302
  &-add {
@@ -321,7 +310,6 @@ $module: #{$prefix}-upload;
321
310
  border: $width-upload_picture_add-border dashed $color-upload-border;
322
311
  color: $color-upload-icon;
323
312
  border-radius: $radius-upload_picture_add;
324
- order: 2;
325
313
  cursor: pointer;
326
314
 
327
315
  &:hover {
@@ -370,38 +358,32 @@ $module: #{$prefix}-upload;
370
358
  }
371
359
 
372
360
  &-close {
373
- width: $width-upload_picture_file_card_close;
374
- height: $width-upload_picture_file_card_close;
375
- background-color: $color-upload_pic_remove-bg;
361
+ visibility: hidden;
362
+ display: inline-flex;
376
363
  position: absolute;
377
364
  top: $spacing-upload_picture_file_card_close-top;
378
365
  right: $spacing-upload_picture_file_card_close-right;
379
- @include all-center;
380
- display: none;
381
366
  border-radius: $radius-upload_picture_file_card_close;
382
- color: white;
383
367
  cursor: pointer;
384
368
  transition: all 0s;
385
369
  }
386
-
387
- &:hover {
388
- .#{$module}-picture-file-card-close {
389
- display: flex;
390
- }
391
-
392
- .#{$module}-picture-file-card-replace {
393
- visibility: visible;
394
- }
370
+ &-icon-close {
371
+ font-size: $width-upload_picture_file_card_close;
372
+ color: $color-upload_picture_file_card_close-icon;
395
373
  }
396
374
 
397
- .#{$prefix}-progress-circle {
375
+ &::before {
376
+ visibility: hidden;
377
+ background-color: $color-upload_picture_file_card_hover-bg;
378
+ content: '';
398
379
  position: absolute;
399
- top: 50%;
400
- left: 50%;
401
- transform: translate(-50%, -50%);
380
+ left: 0;
381
+ right: 0;
382
+ top: 0;
383
+ bottom: 0;
402
384
  }
403
-
404
385
  &-retry {
386
+ visibility: hidden;
405
387
  background-color: $color-upload_file_card_retry-bg;
406
388
  width: $width-upload_file_card_retry;
407
389
  height: $width-upload_file_card_retry;
@@ -416,7 +398,6 @@ $module: #{$prefix}-upload;
416
398
  justify-content: center;
417
399
  cursor: pointer;
418
400
  }
419
-
420
401
  &-icon-retry {
421
402
  transform: scale(-1, 1);
422
403
  font-size: $width-upload_file_card_retry-icon;
@@ -432,6 +413,17 @@ $module: #{$prefix}-upload;
432
413
  color: $color-upload_replace-text;
433
414
  transform: translate3D(-50%, -50%, 0);
434
415
  }
416
+
417
+ &-preview {
418
+ visibility: hidden;
419
+ display: inline-flex;
420
+ position: absolute;
421
+ cursor: pointer;
422
+ top: 50%;
423
+ left: 50%;
424
+ transform: translate3D(-50%, -50%, 0);
425
+ }
426
+
435
427
  &-pic-info {
436
428
  display: inline-flex;
437
429
  box-sizing: border-box;
@@ -468,6 +460,39 @@ $module: #{$prefix}-upload;
468
460
  &-error {
469
461
  outline: 1px solid $color-upload_picture_file_card_error-border;
470
462
  }
463
+
464
+ &:hover {
465
+ &::before {
466
+ visibility: visible;
467
+ }
468
+
469
+ .#{$module}-picture-file-card-close {
470
+ visibility: visible;
471
+ }
472
+ .#{$module}-picture-file-card-replace {
473
+ visibility: visible;
474
+ }
475
+
476
+ .#{$module}-picture-file-card-retry {
477
+ visibility: visible;
478
+ }
479
+ .#{$module}-picture-file-card-preview {
480
+ visibility: visible;
481
+ }
482
+ }
483
+
484
+ &-uploading {
485
+ &::before {
486
+ visibility: visible;
487
+ }
488
+ }
489
+
490
+ .#{$prefix}-progress-circle {
491
+ position: absolute;
492
+ top: 50%;
493
+ left: 50%;
494
+ transform: translate(-50%, -50%);
495
+ }
471
496
  }
472
497
  }
473
498
 
@@ -542,4 +567,4 @@ $module: #{$prefix}-upload;
542
567
  }
543
568
  }
544
569
 
545
- @import "./rtl.scss";
570
+ @import './rtl.scss';
@@ -16,7 +16,7 @@ $color-upload_drag_area_tips-text: var(--semi-color-primary); // 上传可拖拽
16
16
  $color-upload_file_card_fail_info-text: var(--semi-color-danger); // 上传文件卡片失败提示信息文本颜色
17
17
  $color-upload_file_card_preview_placeholder-bg: rgba(var(--semi-grey-3), 1); // 文件卡片默认预览背景颜色
18
18
  $color-upload_file_card_preview_placeholder-text: rgba(var(--semi-white), 1); // 文件卡片默认预览图颜色
19
- $color-upload_file_card_retry-bg: #fff; // 重新上传按钮背景颜色
19
+ $color-upload_file_card_retry-bg: var(--semi-color-white); // 重新上传按钮背景颜色
20
20
  $color-upload_file_card_retry-text: var(--semi-color-primary); // 重新上传按钮文本颜色
21
21
  $color-upload-icon: var(--semi-color-tertiary); // 图片墙上传图标加号颜色
22
22
  $color-upload_pic_add-bg-active: var(--semi-color-fill-2); // 图片墙上传背景色 - 按下
@@ -26,6 +26,8 @@ $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
27
  $color-upload_picture_file_card_error-border: var(--semi-color-danger); // 图片墙上传移除图标颜色
28
28
  $color-upload_picture_file_card_pic_info-text: var(--semi-color-white); // 图片墙图片信息(序号)文字颜色
29
+ $color-upload_picture_file_card_close-icon: var(--semi-color-white); // 图片墙关闭图标颜色
30
+ $color-upload_picture_file_card_hover-bg: var(--semi-color-overlay-bg); // 图片墙预览悬浮背景色
29
31
  $color-upload_preview-icon: var(--semi-color-text-2); // 上传文件卡片文本颜色
30
32
  $color-upload_retry-text: var(--semi-color-primary); // 上传文件卡片重新上传按钮文本颜色
31
33
  $color-upload_replace-text: var(--semi-color-white); // 上传文件卡片重新替换按钮文本颜色
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.4.1",
3
+ "version": "2.5.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.4.1",
11
+ "@douyinfe/semi-animation": "2.5.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": "c69c466ecd14aeeda847473e97dad2ec313f09fa",
27
+ "gitHead": "3f83639f8a4fff7f912a237bf2842cb0944d993c",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -44,7 +44,7 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
44
44
  notifyMouseLeave(event: any): void;
45
45
  notifyMouseEnter(event: any): void;
46
46
  updateHovering(isHover: boolean): void;
47
- updateScrollTop(): void;
47
+ updateScrollTop(index?: number): void;
48
48
  }
49
49
 
50
50
  type LabelValue = string | number;
@@ -704,7 +704,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
704
704
  }
705
705
  // console.log('new:' + index);
706
706
  this._adapter.updateFocusIndex(index);
707
- // TODO requires scrollIntoView
707
+ this._adapter.updateScrollTop(index);
708
708
  }
709
709
 
710
710
  _handleArrowKeyDown(offset: number) {
@@ -954,4 +954,5 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
954
954
  updateScrollTop() {
955
955
  this._adapter.updateScrollTop();
956
956
  }
957
+
957
958
  }
@@ -29,13 +29,13 @@ export default class OptionFoundation extends BaseFoundation<OptionDefaultAdapte
29
29
  destroy() {}
30
30
 
31
31
  onOptionClick(option: BasicOptionProps) {
32
- const isDisbled = this.isDisbled_();
33
- if (!isDisbled) {
32
+ const isDisabled = this._isDisabled();
33
+ if (!isDisabled) {
34
34
  this._adapter.notifyClick(option);
35
35
  }
36
36
  }
37
37
 
38
- isDisbled_() {
38
+ _isDisabled() {
39
39
  return this.getProp('disabled');
40
40
  }
41
41
  }
@@ -240,7 +240,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
240
240
  const scroll = (node: Element) => regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
241
241
 
242
242
  const scrollParent = (node: Element): Element => (
243
- !node || node === document.body ? document.body : scroll(node) ? node : scrollParent(node.parentNode as Element)
243
+ !node || (node === document.body || !(node instanceof Element)) ? document.body : scroll(node) ? node : scrollParent(node.parentNode as Element)
244
244
  );
245
245
 
246
246
  return scrollParent(el);
@@ -320,7 +320,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
320
320
  } else {
321
321
  compareValue = currentValue;
322
322
  }
323
- if (step !== 1) { // Find nearest step point
323
+ if (step !== 1) { // Find nearest step point
324
324
  stepValue = Math.round(stepValue / step) * step;
325
325
  }
326
326
  if (range && stepValue !== compareValue) {