@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.
Files changed (112) hide show
  1. package/button/button.scss +11 -0
  2. package/button/variables.scss +4 -0
  3. package/cascader/cascader.scss +3 -2
  4. package/cascader/foundation.ts +19 -0
  5. package/cascader/variables.scss +6 -3
  6. package/datePicker/foundation.ts +16 -4
  7. package/datePicker/inputFoundation.ts +0 -1
  8. package/datePicker/monthFoundation.ts +1 -0
  9. package/form/form.scss +7 -1
  10. package/form/foundation.ts +40 -36
  11. package/form/interface.ts +1 -1
  12. package/input/input.scss +2 -1
  13. package/lib/cjs/autoComplete/constants.d.ts +1 -1
  14. package/lib/cjs/button/button.css +9 -0
  15. package/lib/cjs/button/button.scss +11 -0
  16. package/lib/cjs/button/variables.scss +4 -0
  17. package/lib/cjs/cascader/cascader.css +2 -1
  18. package/lib/cjs/cascader/cascader.scss +3 -2
  19. package/lib/cjs/cascader/foundation.d.ts +19 -0
  20. package/lib/cjs/cascader/foundation.js +22 -0
  21. package/lib/cjs/cascader/variables.scss +6 -3
  22. package/lib/cjs/datePicker/foundation.d.ts +9 -4
  23. package/lib/cjs/datePicker/foundation.js +18 -0
  24. package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
  25. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
  26. package/lib/cjs/dropdown/constants.d.ts +1 -1
  27. package/lib/cjs/form/form.css +4 -0
  28. package/lib/cjs/form/form.scss +7 -1
  29. package/lib/cjs/form/foundation.d.ts +6 -6
  30. package/lib/cjs/form/foundation.js +51 -52
  31. package/lib/cjs/form/interface.d.ts +1 -1
  32. package/lib/cjs/input/input.css +1 -0
  33. package/lib/cjs/input/input.scss +2 -1
  34. package/lib/cjs/select/constants.d.ts +1 -1
  35. package/lib/cjs/select/foundation.d.ts +1 -1
  36. package/lib/cjs/select/foundation.js +2 -1
  37. package/lib/cjs/select/optionFoundation.d.ts +1 -1
  38. package/lib/cjs/select/optionFoundation.js +3 -3
  39. package/lib/cjs/slider/foundation.js +2 -2
  40. package/lib/cjs/table/foundation.d.ts +2 -0
  41. package/lib/cjs/table/foundation.js +16 -4
  42. package/lib/cjs/table/table.css +1 -2
  43. package/lib/cjs/table/table.scss +4 -5
  44. package/lib/cjs/table/utils.js +4 -1
  45. package/lib/cjs/table/variables.scss +1 -0
  46. package/lib/cjs/tooltip/constants.d.ts +1 -1
  47. package/lib/cjs/tooltip/constants.js +1 -1
  48. package/lib/cjs/tooltip/foundation.js +65 -4
  49. package/lib/cjs/tree/foundation.d.ts +4 -1
  50. package/lib/cjs/tree/foundation.js +69 -20
  51. package/lib/cjs/treeSelect/foundation.d.ts +3 -3
  52. package/lib/cjs/treeSelect/foundation.js +103 -35
  53. package/lib/cjs/upload/upload.css +49 -27
  54. package/lib/cjs/upload/upload.scss +66 -41
  55. package/lib/cjs/upload/variables.scss +3 -1
  56. package/lib/es/autoComplete/constants.d.ts +1 -1
  57. package/lib/es/button/button.css +9 -0
  58. package/lib/es/button/button.scss +11 -0
  59. package/lib/es/button/variables.scss +4 -0
  60. package/lib/es/cascader/cascader.css +2 -1
  61. package/lib/es/cascader/cascader.scss +3 -2
  62. package/lib/es/cascader/foundation.d.ts +19 -0
  63. package/lib/es/cascader/foundation.js +22 -1
  64. package/lib/es/cascader/variables.scss +6 -3
  65. package/lib/es/datePicker/foundation.d.ts +9 -4
  66. package/lib/es/datePicker/foundation.js +18 -0
  67. package/lib/es/datePicker/inputFoundation.d.ts +0 -1
  68. package/lib/es/datePicker/monthFoundation.d.ts +1 -0
  69. package/lib/es/dropdown/constants.d.ts +1 -1
  70. package/lib/es/form/form.css +4 -0
  71. package/lib/es/form/form.scss +7 -1
  72. package/lib/es/form/foundation.d.ts +6 -6
  73. package/lib/es/form/foundation.js +51 -52
  74. package/lib/es/form/interface.d.ts +1 -1
  75. package/lib/es/input/input.css +1 -0
  76. package/lib/es/input/input.scss +2 -1
  77. package/lib/es/select/constants.d.ts +1 -1
  78. package/lib/es/select/foundation.d.ts +1 -1
  79. package/lib/es/select/foundation.js +2 -1
  80. package/lib/es/select/optionFoundation.d.ts +1 -1
  81. package/lib/es/select/optionFoundation.js +3 -3
  82. package/lib/es/slider/foundation.js +2 -2
  83. package/lib/es/table/foundation.d.ts +2 -0
  84. package/lib/es/table/foundation.js +16 -4
  85. package/lib/es/table/table.css +1 -2
  86. package/lib/es/table/table.scss +4 -5
  87. package/lib/es/table/utils.js +4 -1
  88. package/lib/es/table/variables.scss +1 -0
  89. package/lib/es/tooltip/constants.d.ts +1 -1
  90. package/lib/es/tooltip/constants.js +1 -1
  91. package/lib/es/tooltip/foundation.js +65 -4
  92. package/lib/es/tree/foundation.d.ts +4 -1
  93. package/lib/es/tree/foundation.js +69 -20
  94. package/lib/es/treeSelect/foundation.d.ts +3 -3
  95. package/lib/es/treeSelect/foundation.js +102 -35
  96. package/lib/es/upload/upload.css +49 -27
  97. package/lib/es/upload/upload.scss +66 -41
  98. package/lib/es/upload/variables.scss +3 -1
  99. package/package.json +3 -3
  100. package/select/foundation.ts +3 -2
  101. package/select/optionFoundation.ts +3 -3
  102. package/slider/foundation.ts +2 -2
  103. package/table/foundation.ts +23 -10
  104. package/table/table.scss +4 -5
  105. package/table/utils.ts +3 -1
  106. package/table/variables.scss +1 -0
  107. package/tooltip/constants.ts +2 -0
  108. package/tooltip/foundation.ts +52 -4
  109. package/tree/foundation.ts +56 -17
  110. package/treeSelect/foundation.ts +89 -41
  111. package/upload/upload.scss +66 -41
  112. package/upload/variables.scss +3 -1
@@ -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.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.4.1",
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": "c69c466ecd14aeeda847473e97dad2ec313f09fa",
27
+ "gitHead": "49d107f759f3610a471c34bb9568ad9408aa2cb0",
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) {
@@ -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
- isFunction(query.onFilter) &&
205
- Array.isArray(query.filters) &&
206
- query.filters.length &&
207
- Array.isArray(query.filteredValue) &&
208
- query.filteredValue.length
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
- if (typeof onFilter === 'function' && Array.isArray(filteredValue) && filteredValue.length) {
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(filteredValue, value => {
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-table_disabled-bg-default;
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.key = `${level}-${index}`;
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]);
@@ -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; // 表格默认文本字号
@@ -20,6 +20,8 @@ const strings = {
20
20
  'bottomRight',
21
21
  'leftTopOver',
22
22
  'rightTopOver',
23
+ 'leftBottomOver',
24
+ 'rightBottomOver',
23
25
  ],
24
26
  TRIGGER_SET: ['hover', 'focus', 'click', 'custom'],
25
27
  STATUS_DISABLED: 'disabled',
@@ -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 sholdReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
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 (sholdReverseBottom) {
673
+ if (shouldReverseBottom) {
658
674
  position = this._reversePos(position, true);
659
675
  }
660
676
  break;
661
677
  case 'bottomLeft':
662
- if (sholdReverseBottom) {
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 (sholdReverseBottom) {
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
  }