@douyinfe/semi-foundation 2.4.1 → 2.5.0-beta.0
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.
- package/cascader/cascader.scss +1 -0
- package/cascader/variables.scss +4 -2
- package/lib/cjs/autoComplete/constants.d.ts +1 -1
- package/lib/cjs/cascader/cascader.css +1 -0
- package/lib/cjs/cascader/cascader.scss +1 -0
- package/lib/cjs/cascader/variables.scss +4 -2
- package/lib/cjs/dropdown/constants.d.ts +1 -1
- package/lib/cjs/select/constants.d.ts +1 -1
- package/lib/cjs/select/optionFoundation.d.ts +1 -1
- package/lib/cjs/select/optionFoundation.js +3 -3
- package/lib/cjs/slider/foundation.js +2 -2
- package/lib/cjs/table/foundation.d.ts +2 -0
- package/lib/cjs/table/foundation.js +16 -4
- package/lib/cjs/tooltip/constants.d.ts +1 -1
- package/lib/cjs/tooltip/constants.js +1 -1
- package/lib/cjs/tooltip/foundation.js +65 -4
- package/lib/cjs/tree/foundation.d.ts +4 -1
- package/lib/cjs/tree/foundation.js +69 -20
- package/lib/cjs/treeSelect/foundation.d.ts +3 -3
- package/lib/cjs/treeSelect/foundation.js +103 -35
- package/lib/cjs/upload/upload.css +49 -27
- package/lib/cjs/upload/upload.scss +66 -41
- package/lib/cjs/upload/variables.scss +3 -1
- package/lib/es/autoComplete/constants.d.ts +1 -1
- package/lib/es/cascader/cascader.css +1 -0
- package/lib/es/cascader/cascader.scss +1 -0
- package/lib/es/cascader/variables.scss +4 -2
- package/lib/es/dropdown/constants.d.ts +1 -1
- package/lib/es/select/constants.d.ts +1 -1
- package/lib/es/select/optionFoundation.d.ts +1 -1
- package/lib/es/select/optionFoundation.js +3 -3
- package/lib/es/slider/foundation.js +2 -2
- package/lib/es/table/foundation.d.ts +2 -0
- package/lib/es/table/foundation.js +16 -4
- package/lib/es/tooltip/constants.d.ts +1 -1
- package/lib/es/tooltip/constants.js +1 -1
- package/lib/es/tooltip/foundation.js +65 -4
- package/lib/es/tree/foundation.d.ts +4 -1
- package/lib/es/tree/foundation.js +69 -20
- package/lib/es/treeSelect/foundation.d.ts +3 -3
- package/lib/es/treeSelect/foundation.js +102 -35
- package/lib/es/upload/upload.css +49 -27
- package/lib/es/upload/upload.scss +66 -41
- package/lib/es/upload/variables.scss +3 -1
- package/package.json +3 -3
- package/select/optionFoundation.ts +3 -3
- package/slider/foundation.ts +2 -2
- package/table/foundation.ts +23 -10
- package/tooltip/constants.ts +2 -0
- package/tooltip/foundation.ts +52 -4
- package/tree/foundation.ts +56 -17
- package/treeSelect/foundation.ts +89 -41
- package/upload/upload.scss +66 -41
- package/upload/variables.scss +3 -1
package/lib/es/upload/upload.css
CHANGED
|
@@ -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
|
-
|
|
301
|
-
|
|
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
|
|
316
|
-
|
|
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
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
310
|
+
left: 0;
|
|
311
|
+
right: 0;
|
|
312
|
+
top: 0;
|
|
313
|
+
bottom: 0;
|
|
326
314
|
}
|
|
327
315
|
.semi-upload-picture-file-card-retry {
|
|
328
|
-
|
|
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
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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
|
-
|
|
374
|
-
|
|
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
|
-
|
|
388
|
-
|
|
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
|
-
|
|
375
|
+
&::before {
|
|
376
|
+
visibility: hidden;
|
|
377
|
+
background-color: $color-upload_picture_file_card_hover-bg;
|
|
378
|
+
content: '';
|
|
398
379
|
position: absolute;
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
|
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:
|
|
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.
|
|
3
|
+
"version": "2.5.0-beta.0",
|
|
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.
|
|
11
|
+
"@douyinfe/semi-animation": "2.5.0-beta.0",
|
|
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": "
|
|
27
|
+
"gitHead": "d71dddacba0c96004c19103f2e0d3cb59ac52857",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
@@ -29,13 +29,13 @@ export default class OptionFoundation extends BaseFoundation<OptionDefaultAdapte
|
|
|
29
29
|
destroy() {}
|
|
30
30
|
|
|
31
31
|
onOptionClick(option: BasicOptionProps) {
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
32
|
+
const isDisabled = this._isDisabled();
|
|
33
|
+
if (!isDisabled) {
|
|
34
34
|
this._adapter.notifyClick(option);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
_isDisabled() {
|
|
39
39
|
return this.getProp('disabled');
|
|
40
40
|
}
|
|
41
41
|
}
|
package/slider/foundation.ts
CHANGED
|
@@ -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) {
|
package/table/foundation.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface BaseColumnProps<RecordType> {
|
|
|
34
34
|
className?: string;
|
|
35
35
|
colSpan?: number;
|
|
36
36
|
dataIndex?: string;
|
|
37
|
+
defaultFilteredValue?: any[];
|
|
37
38
|
defaultSortOrder?: BaseSortOrder;
|
|
38
39
|
filterChildrenRecord?: boolean;
|
|
39
40
|
filterDropdown?: any;
|
|
@@ -200,13 +201,23 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
200
201
|
*/
|
|
201
202
|
getFilteredSortedDataSource(dataSource: RecordType[], queries: BaseColumnProps<RecordType>[]) {
|
|
202
203
|
const filteredDataSource = this.filterDataSource(dataSource, queries.filter(
|
|
203
|
-
query =>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
query => {
|
|
205
|
+
/**
|
|
206
|
+
* 这里无需判断 filteredValue 是否为数组,初始化时它是 `undefined`,点击选择空时为 `[]`
|
|
207
|
+
* 初始化时我们应该用 `defaultFilteredValue`,点击后我们应该用 `filteredValue`
|
|
208
|
+
*
|
|
209
|
+
* There is no need to judge whether `filteredValue` is an array here, because it is `undefined` when initialized, and `[]` when you click to select empty
|
|
210
|
+
* When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
|
|
211
|
+
*/
|
|
212
|
+
const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
|
|
213
|
+
return (
|
|
214
|
+
isFunction(query.onFilter) &&
|
|
215
|
+
Array.isArray(query.filters) &&
|
|
216
|
+
query.filters.length &&
|
|
217
|
+
Array.isArray(currentFilteredValue) &&
|
|
218
|
+
currentFilteredValue.length
|
|
219
|
+
);
|
|
220
|
+
}
|
|
210
221
|
));
|
|
211
222
|
const sortedDataSource = this.sortDataSource(filteredDataSource, queries.filter(query => query && isFunction(query.sorter)));
|
|
212
223
|
return sortedDataSource;
|
|
@@ -371,8 +382,9 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
371
382
|
const childrenRecordName = this.getProp('childrenRecordName');
|
|
372
383
|
|
|
373
384
|
each(filters, filterObj => {
|
|
374
|
-
const { onFilter, filteredValue, filterChildrenRecord } = filterObj;
|
|
375
|
-
|
|
385
|
+
const { onFilter, filteredValue, filterChildrenRecord, defaultFilteredValue } = filterObj;
|
|
386
|
+
const currentFilteredValue = Array.isArray(filteredValue) ? filteredValue : defaultFilteredValue;
|
|
387
|
+
if (typeof onFilter === 'function' && Array.isArray(currentFilteredValue) && currentFilteredValue.length) {
|
|
376
388
|
hasValidFilters = true;
|
|
377
389
|
|
|
378
390
|
if (filteredData === null) {
|
|
@@ -381,7 +393,7 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
|
|
|
381
393
|
dataSource = Array.from(filteredData && filteredData.values());
|
|
382
394
|
filteredData = new Map();
|
|
383
395
|
}
|
|
384
|
-
each(
|
|
396
|
+
each(currentFilteredValue, value => {
|
|
385
397
|
each(dataSource, record => {
|
|
386
398
|
const childrenRecords = get(record, childrenRecordName);
|
|
387
399
|
const recordKey = this.getRecordKey(record);
|
|
@@ -1165,6 +1177,7 @@ export interface BaseChangeInfoFilter<RecordType> {
|
|
|
1165
1177
|
filters?: BaseFilter[];
|
|
1166
1178
|
onFilter?: (filteredValue?: any, record?: RecordType) => boolean;
|
|
1167
1179
|
filteredValue?: any[];
|
|
1180
|
+
defaultFilteredValue?: any[];
|
|
1168
1181
|
children?: BaseFilter[];
|
|
1169
1182
|
filterChildrenRecord?: boolean;
|
|
1170
1183
|
}
|
package/tooltip/constants.ts
CHANGED
package/tooltip/foundation.ts
CHANGED
|
@@ -434,6 +434,17 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
434
434
|
top = triggerRect.top;
|
|
435
435
|
translateX = -1;
|
|
436
436
|
break;
|
|
437
|
+
case 'leftBottomOver':
|
|
438
|
+
left = triggerRect.left;
|
|
439
|
+
top = triggerRect.bottom;
|
|
440
|
+
translateY = -1;
|
|
441
|
+
break;
|
|
442
|
+
case 'rightBottomOver':
|
|
443
|
+
left = triggerRect.right;
|
|
444
|
+
top = triggerRect.bottom;
|
|
445
|
+
translateX = -1;
|
|
446
|
+
translateY = -1;
|
|
447
|
+
break;
|
|
437
448
|
default:
|
|
438
449
|
break;
|
|
439
450
|
}
|
|
@@ -602,14 +613,19 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
602
613
|
|
|
603
614
|
const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
|
|
604
615
|
const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
|
|
605
|
-
const
|
|
616
|
+
const shouldReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
|
|
606
617
|
const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
|
|
618
|
+
const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
|
|
619
|
+
const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
|
|
607
620
|
|
|
608
621
|
const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
|
|
609
622
|
const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
|
|
610
623
|
const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
611
624
|
const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
612
625
|
|
|
626
|
+
const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
|
|
627
|
+
const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
|
|
628
|
+
|
|
613
629
|
switch (position) {
|
|
614
630
|
case 'top':
|
|
615
631
|
if (shouldReverseTop) {
|
|
@@ -654,12 +670,12 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
654
670
|
}
|
|
655
671
|
break;
|
|
656
672
|
case 'bottom':
|
|
657
|
-
if (
|
|
673
|
+
if (shouldReverseBottom) {
|
|
658
674
|
position = this._reversePos(position, true);
|
|
659
675
|
}
|
|
660
676
|
break;
|
|
661
677
|
case 'bottomLeft':
|
|
662
|
-
if (
|
|
678
|
+
if (shouldReverseBottom) {
|
|
663
679
|
position = this._reversePos(position, true);
|
|
664
680
|
}
|
|
665
681
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
@@ -667,7 +683,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
667
683
|
}
|
|
668
684
|
break;
|
|
669
685
|
case 'bottomRight':
|
|
670
|
-
if (
|
|
686
|
+
if (shouldReverseBottom) {
|
|
671
687
|
position = this._reversePos(position, true);
|
|
672
688
|
}
|
|
673
689
|
if (shouldReverseRightSide && widthIsBigger) {
|
|
@@ -695,6 +711,38 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
695
711
|
position = this._reversePos(position, true);
|
|
696
712
|
}
|
|
697
713
|
break;
|
|
714
|
+
case 'leftTopOver':
|
|
715
|
+
if (shouldReverseTopOver) {
|
|
716
|
+
position = this._reversePos(position, true);
|
|
717
|
+
}
|
|
718
|
+
if (shouldReverseLeftOver) {
|
|
719
|
+
position = this._reversePos(position);
|
|
720
|
+
}
|
|
721
|
+
break;
|
|
722
|
+
case 'leftBottomOver':
|
|
723
|
+
if (shouldReverseBottomOver) {
|
|
724
|
+
position = this._reversePos(position, true);
|
|
725
|
+
}
|
|
726
|
+
if (shouldReverseLeftOver) {
|
|
727
|
+
position = this._reversePos(position);
|
|
728
|
+
}
|
|
729
|
+
break;
|
|
730
|
+
case 'rightTopOver':
|
|
731
|
+
if (shouldReverseTopOver) {
|
|
732
|
+
position = this._reversePos(position, true);
|
|
733
|
+
}
|
|
734
|
+
if (shouldReverseRightOver) {
|
|
735
|
+
position = this._reversePos(position);
|
|
736
|
+
}
|
|
737
|
+
break;
|
|
738
|
+
case 'rightBottomOver':
|
|
739
|
+
if (shouldReverseBottomOver) {
|
|
740
|
+
position = this._reversePos(position, true);
|
|
741
|
+
}
|
|
742
|
+
if (shouldReverseRightOver) {
|
|
743
|
+
position = this._reversePos(position);
|
|
744
|
+
}
|
|
745
|
+
break;
|
|
698
746
|
default:
|
|
699
747
|
break;
|
|
700
748
|
}
|