@douyinfe/semi-foundation 2.4.1 → 2.6.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/button/button.scss +11 -0
- package/button/variables.scss +4 -0
- package/cascader/cascader.scss +3 -2
- package/cascader/foundation.ts +19 -0
- package/cascader/variables.scss +6 -3
- package/datePicker/foundation.ts +16 -4
- package/datePicker/inputFoundation.ts +0 -1
- package/datePicker/monthFoundation.ts +1 -0
- package/form/form.scss +7 -1
- package/form/foundation.ts +40 -36
- package/form/interface.ts +1 -1
- package/input/input.scss +2 -1
- package/lib/cjs/autoComplete/constants.d.ts +1 -1
- package/lib/cjs/button/button.css +9 -0
- package/lib/cjs/button/button.scss +11 -0
- package/lib/cjs/button/variables.scss +4 -0
- package/lib/cjs/cascader/cascader.css +2 -1
- package/lib/cjs/cascader/cascader.scss +3 -2
- package/lib/cjs/cascader/foundation.d.ts +19 -0
- package/lib/cjs/cascader/foundation.js +22 -0
- package/lib/cjs/cascader/variables.scss +6 -3
- package/lib/cjs/datePicker/foundation.d.ts +9 -4
- package/lib/cjs/datePicker/foundation.js +18 -0
- package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
- package/lib/cjs/dropdown/constants.d.ts +1 -1
- package/lib/cjs/form/form.css +4 -0
- package/lib/cjs/form/form.scss +7 -1
- package/lib/cjs/form/foundation.d.ts +6 -6
- package/lib/cjs/form/foundation.js +51 -52
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/input/input.css +1 -0
- package/lib/cjs/input/input.scss +2 -1
- package/lib/cjs/select/constants.d.ts +1 -1
- package/lib/cjs/select/foundation.d.ts +1 -1
- package/lib/cjs/select/foundation.js +2 -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/table/table.css +1 -2
- package/lib/cjs/table/table.scss +4 -5
- package/lib/cjs/table/utils.js +4 -1
- package/lib/cjs/table/variables.scss +1 -0
- 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/button/button.css +9 -0
- package/lib/es/button/button.scss +11 -0
- package/lib/es/button/variables.scss +4 -0
- package/lib/es/cascader/cascader.css +2 -1
- package/lib/es/cascader/cascader.scss +3 -2
- package/lib/es/cascader/foundation.d.ts +19 -0
- package/lib/es/cascader/foundation.js +22 -1
- package/lib/es/cascader/variables.scss +6 -3
- package/lib/es/datePicker/foundation.d.ts +9 -4
- package/lib/es/datePicker/foundation.js +18 -0
- package/lib/es/datePicker/inputFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthFoundation.d.ts +1 -0
- package/lib/es/dropdown/constants.d.ts +1 -1
- package/lib/es/form/form.css +4 -0
- package/lib/es/form/form.scss +7 -1
- package/lib/es/form/foundation.d.ts +6 -6
- package/lib/es/form/foundation.js +51 -52
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/input/input.css +1 -0
- package/lib/es/input/input.scss +2 -1
- package/lib/es/select/constants.d.ts +1 -1
- package/lib/es/select/foundation.d.ts +1 -1
- package/lib/es/select/foundation.js +2 -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/table/table.css +1 -2
- package/lib/es/table/table.scss +4 -5
- package/lib/es/table/utils.js +4 -1
- package/lib/es/table/variables.scss +1 -0
- 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/foundation.ts +3 -2
- package/select/optionFoundation.ts +3 -3
- package/slider/foundation.ts +2 -2
- package/table/foundation.ts +23 -10
- package/table/table.scss +4 -5
- package/table/utils.ts +3 -1
- package/table/variables.scss +1 -0
- 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
|
@@ -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.6.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.6.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": "49d107f759f3610a471c34bb9568ad9408aa2cb0",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/select/foundation.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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/table/table.scss
CHANGED
|
@@ -100,7 +100,6 @@ $module: #{$prefix}-table;
|
|
|
100
100
|
word-break: break-all;
|
|
101
101
|
word-wrap: break-word;
|
|
102
102
|
position: relative;
|
|
103
|
-
user-select: none;
|
|
104
103
|
|
|
105
104
|
&.#{$module}-cell-fixed {
|
|
106
105
|
|
|
@@ -199,11 +198,11 @@ $module: #{$prefix}-table;
|
|
|
199
198
|
background-color: $color-table_body-bg-hover;
|
|
200
199
|
|
|
201
200
|
&.#{$module}-cell-fixed {
|
|
202
|
-
|
|
201
|
+
|
|
203
202
|
&-left,
|
|
204
203
|
&-right {
|
|
205
204
|
background-color: $color-table_body-bg-default;
|
|
206
|
-
|
|
205
|
+
|
|
207
206
|
&::before {
|
|
208
207
|
background-color: $color-table_body-bg-hover;
|
|
209
208
|
content: "";
|
|
@@ -327,7 +326,7 @@ $module: #{$prefix}-table;
|
|
|
327
326
|
&-wrap {
|
|
328
327
|
// inline-flex vertical-align baseline 会导致父元素高度异常
|
|
329
328
|
display: inline-flex;
|
|
330
|
-
vertical-align: bottom;
|
|
329
|
+
vertical-align: bottom;
|
|
331
330
|
}
|
|
332
331
|
|
|
333
332
|
&-disabled {
|
|
@@ -467,7 +466,7 @@ $module: #{$prefix}-table;
|
|
|
467
466
|
position: relative;
|
|
468
467
|
z-index: 1;
|
|
469
468
|
padding: #{$spacing-table-paddingY} #{$spacing-table-paddingX};
|
|
470
|
-
color: $color-
|
|
469
|
+
color: $color-table_placeholder-text-default;
|
|
471
470
|
font-size: #{$font-table_base-fontSize};
|
|
472
471
|
text-align: center;
|
|
473
472
|
background: $color-table_pl-bg-default;
|
package/table/utils.ts
CHANGED
|
@@ -281,7 +281,9 @@ export function assignColumnKeys(columns: Record<string, any>[], childrenColumnN
|
|
|
281
281
|
const sameLevelCols: Record<string, any>[] = [];
|
|
282
282
|
each(columns, (column, index) => {
|
|
283
283
|
if (column.key == null) {
|
|
284
|
-
column
|
|
284
|
+
// if user give column a dataIndex, use it for backup
|
|
285
|
+
const _index = column.dataIndex || index;
|
|
286
|
+
column.key = `${level}-${_index}`;
|
|
285
287
|
}
|
|
286
288
|
if (Array.isArray(column[childrenColumnName]) && column[childrenColumnName].length) {
|
|
287
289
|
sameLevelCols.push(...column[childrenColumnName]);
|
package/table/variables.scss
CHANGED
|
@@ -73,6 +73,7 @@ $color-table_sorter-text-hover: var(--semi-color-text-2); // 表格排序按钮
|
|
|
73
73
|
$color-table_page-text-default: var(--semi-color-text-2); // 表格翻页器文本颜色
|
|
74
74
|
$color-table_resizer-bg-default: var(--semi-color-primary); // 表格拉伸标示线颜色
|
|
75
75
|
$color-table_selection-bg-default: rgba(var(--semi-grey-0), 1); // 表格分组背景色
|
|
76
|
+
$color-table_placeholder-text-default: var(--semi-color-text-2); // 表格空数据文本颜色
|
|
76
77
|
|
|
77
78
|
// Other
|
|
78
79
|
$font-table_base-fontSize: 14px; // 表格默认文本字号
|
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
|
}
|