@douyinfe/semi-foundation 2.30.2 → 2.31.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 (58) hide show
  1. package/carousel/foundation.ts +8 -2
  2. package/cascader/cascader.scss +8 -0
  3. package/cascader/foundation.ts +11 -3
  4. package/cascader/variables.scss +3 -1
  5. package/image/previewImageFoundation.ts +1 -2
  6. package/image/previewInnerFoundation.ts +0 -6
  7. package/lib/cjs/carousel/foundation.d.ts +2 -0
  8. package/lib/cjs/carousel/foundation.js +8 -3
  9. package/lib/cjs/cascader/cascader.css +6 -0
  10. package/lib/cjs/cascader/cascader.scss +8 -0
  11. package/lib/cjs/cascader/foundation.js +10 -2
  12. package/lib/cjs/cascader/variables.scss +3 -1
  13. package/lib/cjs/image/previewImageFoundation.js +1 -3
  14. package/lib/cjs/image/previewInnerFoundation.d.ts +0 -1
  15. package/lib/cjs/image/previewInnerFoundation.js +0 -6
  16. package/lib/cjs/select/foundation.d.ts +3 -3
  17. package/lib/cjs/select/foundation.js +14 -13
  18. package/lib/cjs/table/foundation.d.ts +4 -0
  19. package/lib/cjs/table/foundation.js +13 -2
  20. package/lib/cjs/table/rtl.scss +33 -2
  21. package/lib/cjs/table/table.css +50 -51
  22. package/lib/cjs/table/table.scss +8 -0
  23. package/lib/cjs/table/utils.d.ts +2 -0
  24. package/lib/cjs/table/utils.js +18 -0
  25. package/lib/cjs/tag/tag.css +10 -0
  26. package/lib/cjs/tag/tag.scss +13 -3
  27. package/lib/cjs/tooltip/foundation.d.ts +2 -0
  28. package/lib/cjs/tooltip/foundation.js +10 -1
  29. package/lib/es/carousel/foundation.d.ts +2 -0
  30. package/lib/es/carousel/foundation.js +8 -3
  31. package/lib/es/cascader/cascader.css +6 -0
  32. package/lib/es/cascader/cascader.scss +8 -0
  33. package/lib/es/cascader/foundation.js +10 -2
  34. package/lib/es/cascader/variables.scss +3 -1
  35. package/lib/es/image/previewImageFoundation.js +1 -3
  36. package/lib/es/image/previewInnerFoundation.d.ts +0 -1
  37. package/lib/es/image/previewInnerFoundation.js +0 -6
  38. package/lib/es/select/foundation.d.ts +3 -3
  39. package/lib/es/select/foundation.js +14 -13
  40. package/lib/es/table/foundation.d.ts +4 -0
  41. package/lib/es/table/foundation.js +13 -2
  42. package/lib/es/table/rtl.scss +33 -2
  43. package/lib/es/table/table.css +50 -51
  44. package/lib/es/table/table.scss +8 -0
  45. package/lib/es/table/utils.d.ts +2 -0
  46. package/lib/es/table/utils.js +16 -0
  47. package/lib/es/tag/tag.css +10 -0
  48. package/lib/es/tag/tag.scss +13 -3
  49. package/lib/es/tooltip/foundation.d.ts +2 -0
  50. package/lib/es/tooltip/foundation.js +10 -1
  51. package/package.json +2 -2
  52. package/select/foundation.ts +15 -13
  53. package/table/foundation.ts +13 -2
  54. package/table/rtl.scss +33 -2
  55. package/table/table.scss +8 -0
  56. package/table/utils.ts +14 -0
  57. package/tag/tag.scss +13 -3
  58. package/tooltip/foundation.ts +15 -7
package/table/table.scss CHANGED
@@ -28,6 +28,14 @@ $module: #{$prefix}-table;
28
28
  &[data-column-fixed='true'] {
29
29
  z-index: 1;
30
30
  }
31
+
32
+ &-ltr {
33
+ direction: ltr;
34
+
35
+ .#{$prefix}-spin {
36
+ direction: ltr;
37
+ }
38
+ }
31
39
  }
32
40
 
33
41
  &-middle {
package/table/utils.ts CHANGED
@@ -502,4 +502,18 @@ export function isTreeTable({ dataSource, childrenRecordName = 'children' }: { d
502
502
  }
503
503
  }
504
504
  return flag;
505
+ }
506
+
507
+ export function getRTLAlign(align: typeof strings.ALIGNS[number], direction?: 'ltr' | 'rtl'): typeof strings.ALIGNS[number] {
508
+ if (direction === 'rtl') {
509
+ switch (align) {
510
+ case 'left':
511
+ return 'right';
512
+ case 'right':
513
+ return 'left';
514
+ default:
515
+ return align;
516
+ }
517
+ }
518
+ return align;
505
519
  }
package/tag/tag.scss CHANGED
@@ -53,9 +53,19 @@ $types: "ghost", "solid", "light";
53
53
 
54
54
  &-content {
55
55
  flex: 1;
56
- overflow: hidden;
57
- white-space: nowrap;
58
- text-overflow: ellipsis;
56
+
57
+ &-ellipsis {
58
+ overflow: hidden;
59
+ white-space: nowrap;
60
+ text-overflow: ellipsis;
61
+ }
62
+
63
+ &-center {
64
+ display: flex;
65
+ @include all-center;
66
+ height: 100%;
67
+ min-width: 0;
68
+ }
59
69
  }
60
70
 
61
71
  &-close {
@@ -38,6 +38,7 @@ export interface TooltipAdapter<P = Record<string, any>, S = Record<string, any>
38
38
  unregisterScrollHandler(): void;
39
39
  insertPortal(...args: any[]): void;
40
40
  removePortal(...args: any[]): void;
41
+ setDisplayNone: (displayNone: boolean, cb?: () => void) => void;
41
42
  getEventName(): {
42
43
  mouseEnter: string;
43
44
  mouseLeave: string;
@@ -138,6 +139,10 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
138
139
  this._adapter.removePortal();
139
140
  }
140
141
 
142
+ setDisplayNone: (displayNone: boolean, cb?: () => void) => void = (displayNone, cb) => {
143
+ this._adapter.setDisplayNone(displayNone, cb);
144
+ }
145
+
141
146
  _adjustPos(position = '', isVertical = false, adjustType = 'reverse', concatPos?: any) {
142
147
  switch (adjustType) {
143
148
  case 'reverse':
@@ -266,7 +271,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
266
271
  this.calcPosition();
267
272
  };
268
273
 
269
- _shouldShow() {
274
+ _shouldShow() {
270
275
  const visible = this.getProp('visible');
271
276
  if (visible) {
272
277
  this.show();
@@ -294,7 +299,10 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
294
299
  const content = this.getProp('content');
295
300
  const trigger = this.getProp('trigger');
296
301
  const clickTriggerToHide = this.getProp('clickTriggerToHide');
297
- const { visible } = this.getStates();
302
+ const { visible, displayNone } = this.getStates();
303
+ if (displayNone) {
304
+ this.setDisplayNone(false);
305
+ }
298
306
  if (visible) {
299
307
  return ;
300
308
  }
@@ -679,19 +687,19 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
679
687
  return rowSpace < size && reverseSpace > size;
680
688
  }
681
689
 
682
- isOverFlow(rowSpace: number, reverseSpace: number, size: number){
690
+ isOverFlow(rowSpace: number, reverseSpace: number, size: number) {
683
691
  // 原空间且反向空间都不足
684
692
  // The original space and the reverse space are not enough
685
693
  return rowSpace < size && reverseSpace < size;
686
694
  }
687
695
 
688
- isHalfOverFlow(posSpace: number, negSpace: number, size: number){
696
+ isHalfOverFlow(posSpace: number, negSpace: number, size: number) {
689
697
  // 正半空间或者负半空间不足,即表示有遮挡,需要偏移
690
698
  // Insufficient positive half space or negative half space means that there is occlusion and needs to be offset
691
699
  return posSpace < size || negSpace < size;
692
700
  }
693
701
 
694
- isHalfAllEnough(posSpace: number, negSpace: number, size: number){
702
+ isHalfAllEnough(posSpace: number, negSpace: number, size: number) {
695
703
  // 正半空间和负半空间都足够,即表示可以从 topLeft/topRight 变成 top
696
704
  // Both positive and negative half-spaces are sufficient, which means you can change from topLeft/topRight to top
697
705
  return posSpace >= size || negSpace >= size;
@@ -1003,7 +1011,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
1003
1011
 
1004
1012
  // 判断溢出 Judgment overflow
1005
1013
  // 上下方向 top and bottom
1006
- if (this.isTB(position)){
1014
+ if (this.isTB(position)) {
1007
1015
  isHeightOverFlow = isViewYOverFlow && isContainerYOverFlow;
1008
1016
  // Related PR: https://github.com/DouyinFE/semi-design/pull/1297
1009
1017
  // If clientRight or restClientRight less than 0, means that the left and right parts of the trigger are blocked
@@ -1015,7 +1023,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
1015
1023
  }
1016
1024
  }
1017
1025
  // 左右方向 left and right
1018
- if (this.isLR(position)){
1026
+ if (this.isLR(position)) {
1019
1027
  isWidthOverFlow = isViewXOverFlow && isContainerXOverFlow;
1020
1028
  // If clientTop or restClientTop less than 0, means that the top and bottom parts of the trigger are blocked
1021
1029
  // Then the display of the wrapper will also be affected, make height overflow to offset the wrapper