@douyinfe/semi-foundation 2.25.3 → 2.25.4

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 (176) hide show
  1. package/lib/cjs/anchor/constants.js +1 -1
  2. package/lib/cjs/anchor/foundation.js +3 -3
  3. package/lib/cjs/autoComplete/constants.js +3 -3
  4. package/lib/cjs/avatar/constants.js +1 -1
  5. package/lib/cjs/backtop/constants.js +1 -1
  6. package/lib/cjs/badge/constants.js +1 -1
  7. package/lib/cjs/banner/constants.js +1 -1
  8. package/lib/cjs/breadcrumb/constants.js +1 -1
  9. package/lib/cjs/button/constants.js +1 -1
  10. package/lib/cjs/calendar/constants.js +1 -1
  11. package/lib/cjs/card/constants.js +1 -1
  12. package/lib/cjs/carousel/constants.js +9 -9
  13. package/lib/cjs/cascader/constants.js +2 -2
  14. package/lib/cjs/cascader/foundation.js +1 -1
  15. package/lib/cjs/cascader/util.js +2 -2
  16. package/lib/cjs/checkbox/constants.js +13 -13
  17. package/lib/cjs/collapse/constants.js +1 -1
  18. package/lib/cjs/collapsible/constants.js +1 -1
  19. package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +1 -1
  20. package/lib/cjs/datePicker/_utils/getMonthTable.js +4 -4
  21. package/lib/cjs/datePicker/_utils/getMonthsInYear.js +1 -1
  22. package/lib/cjs/datePicker/constants.js +27 -27
  23. package/lib/cjs/datePicker/foundation.js +3 -3
  24. package/lib/cjs/datePicker/inputFoundation.js +2 -2
  25. package/lib/cjs/datePicker/monthsGridFoundation.js +1 -1
  26. package/lib/cjs/descriptions/constants.js +1 -1
  27. package/lib/cjs/divider/constants.js +1 -1
  28. package/lib/cjs/dropdown/constants.js +3 -3
  29. package/lib/cjs/dropdown/menuFoundation.js +1 -1
  30. package/lib/cjs/empty/constants.js +1 -1
  31. package/lib/cjs/form/constants.js +1 -1
  32. package/lib/cjs/form/foundation.js +1 -1
  33. package/lib/cjs/form/utils.js +1 -1
  34. package/lib/cjs/grid/constants.js +1 -1
  35. package/lib/cjs/highlight/constants.js +1 -1
  36. package/lib/cjs/icons/constants.js +1 -1
  37. package/lib/cjs/image/constants.js +1 -1
  38. package/lib/cjs/input/constants.js +1 -1
  39. package/lib/cjs/input/textareaFoundation.js +1 -1
  40. package/lib/cjs/layout/constants.js +1 -1
  41. package/lib/cjs/list/constants.js +1 -1
  42. package/lib/cjs/modal/constants.js +1 -1
  43. package/lib/cjs/navigation/constants.js +1 -1
  44. package/lib/cjs/notification/constants.js +3 -3
  45. package/lib/cjs/pagination/constants.js +1 -1
  46. package/lib/cjs/popconfirm/constants.js +2 -2
  47. package/lib/cjs/popover/constants.js +2 -2
  48. package/lib/cjs/progress/constants.js +1 -1
  49. package/lib/cjs/progress/generates.js +14 -14
  50. package/lib/cjs/radio/constants.js +13 -13
  51. package/lib/cjs/rating/constants.js +1 -1
  52. package/lib/cjs/scrollList/constants.js +2 -2
  53. package/lib/cjs/select/constants.js +3 -3
  54. package/lib/cjs/select/foundation.js +2 -1
  55. package/lib/cjs/sideSheet/constants.js +2 -2
  56. package/lib/cjs/skeleton/constants.js +1 -1
  57. package/lib/cjs/slider/constants.js +7 -7
  58. package/lib/cjs/space/constants.js +1 -1
  59. package/lib/cjs/spin/constants.js +1 -1
  60. package/lib/cjs/steps/constants.js +2 -2
  61. package/lib/cjs/switch/constants.js +13 -13
  62. package/lib/cjs/table/constants.js +7 -7
  63. package/lib/cjs/table/utils.js +2 -2
  64. package/lib/cjs/tabs/constants.js +21 -21
  65. package/lib/cjs/tag/constants.js +1 -1
  66. package/lib/cjs/tagInput/constants.js +1 -1
  67. package/lib/cjs/timePicker/ComboxFoundation.js +2 -2
  68. package/lib/cjs/timePicker/constants.js +3 -3
  69. package/lib/cjs/timePicker/utils/index.js +3 -3
  70. package/lib/cjs/timeline/constants.js +2 -2
  71. package/lib/cjs/toast/constants.js +3 -3
  72. package/lib/cjs/tooltip/constants.js +1 -1
  73. package/lib/cjs/tooltip/foundation.js +13 -9
  74. package/lib/cjs/transfer/constants.js +1 -1
  75. package/lib/cjs/tree/constants.js +2 -2
  76. package/lib/cjs/tree/treeUtil.d.ts +1 -1
  77. package/lib/cjs/tree/treeUtil.js +1 -1
  78. package/lib/cjs/treeSelect/constants.js +3 -3
  79. package/lib/cjs/typography/constants.js +1 -1
  80. package/lib/cjs/typography/formatNumeral.js +6 -6
  81. package/lib/cjs/upload/constants.js +2 -2
  82. package/lib/cjs/upload/foundation.js +1 -1
  83. package/lib/cjs/upload/utils.js +4 -4
  84. package/lib/cjs/utils/getMotionObjFromProps.js +2 -2
  85. package/lib/cjs/utils/touchPolyfill.js +1 -1
  86. package/lib/cjs/utils/uuid.js +2 -2
  87. package/lib/cjs/utils/warning.js +1 -1
  88. package/lib/es/anchor/constants.js +1 -1
  89. package/lib/es/anchor/foundation.js +3 -3
  90. package/lib/es/autoComplete/constants.js +3 -3
  91. package/lib/es/avatar/constants.js +1 -1
  92. package/lib/es/backtop/constants.js +1 -1
  93. package/lib/es/badge/constants.js +1 -1
  94. package/lib/es/banner/constants.js +1 -1
  95. package/lib/es/breadcrumb/constants.js +1 -1
  96. package/lib/es/button/constants.js +1 -1
  97. package/lib/es/calendar/constants.js +1 -1
  98. package/lib/es/card/constants.js +1 -1
  99. package/lib/es/carousel/constants.js +9 -9
  100. package/lib/es/cascader/constants.js +2 -2
  101. package/lib/es/cascader/foundation.js +1 -1
  102. package/lib/es/cascader/util.js +2 -2
  103. package/lib/es/checkbox/constants.js +13 -13
  104. package/lib/es/collapse/constants.js +1 -1
  105. package/lib/es/collapsible/constants.js +1 -1
  106. package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -1
  107. package/lib/es/datePicker/_utils/getMonthTable.js +4 -4
  108. package/lib/es/datePicker/_utils/getMonthsInYear.js +1 -1
  109. package/lib/es/datePicker/constants.js +27 -27
  110. package/lib/es/datePicker/foundation.js +3 -3
  111. package/lib/es/datePicker/inputFoundation.js +2 -2
  112. package/lib/es/datePicker/monthsGridFoundation.js +1 -1
  113. package/lib/es/descriptions/constants.js +1 -1
  114. package/lib/es/divider/constants.js +1 -1
  115. package/lib/es/dropdown/constants.js +3 -3
  116. package/lib/es/dropdown/menuFoundation.js +1 -1
  117. package/lib/es/empty/constants.js +1 -1
  118. package/lib/es/form/constants.js +1 -1
  119. package/lib/es/form/foundation.js +1 -1
  120. package/lib/es/form/utils.js +1 -1
  121. package/lib/es/grid/constants.js +1 -1
  122. package/lib/es/highlight/constants.js +1 -1
  123. package/lib/es/icons/constants.js +1 -1
  124. package/lib/es/image/constants.js +1 -1
  125. package/lib/es/input/constants.js +1 -1
  126. package/lib/es/input/textareaFoundation.js +1 -1
  127. package/lib/es/layout/constants.js +1 -1
  128. package/lib/es/list/constants.js +1 -1
  129. package/lib/es/modal/constants.js +1 -1
  130. package/lib/es/navigation/constants.js +1 -1
  131. package/lib/es/notification/constants.js +3 -3
  132. package/lib/es/pagination/constants.js +1 -1
  133. package/lib/es/popconfirm/constants.js +2 -2
  134. package/lib/es/popover/constants.js +2 -2
  135. package/lib/es/progress/constants.js +1 -1
  136. package/lib/es/progress/generates.js +14 -14
  137. package/lib/es/radio/constants.js +13 -13
  138. package/lib/es/rating/constants.js +1 -1
  139. package/lib/es/scrollList/constants.js +2 -2
  140. package/lib/es/select/constants.js +3 -3
  141. package/lib/es/select/foundation.js +2 -1
  142. package/lib/es/sideSheet/constants.js +2 -2
  143. package/lib/es/skeleton/constants.js +1 -1
  144. package/lib/es/slider/constants.js +7 -7
  145. package/lib/es/space/constants.js +1 -1
  146. package/lib/es/spin/constants.js +1 -1
  147. package/lib/es/steps/constants.js +2 -2
  148. package/lib/es/switch/constants.js +13 -13
  149. package/lib/es/table/constants.js +7 -7
  150. package/lib/es/table/utils.js +2 -2
  151. package/lib/es/tabs/constants.js +21 -21
  152. package/lib/es/tag/constants.js +1 -1
  153. package/lib/es/tagInput/constants.js +1 -1
  154. package/lib/es/timePicker/ComboxFoundation.js +2 -2
  155. package/lib/es/timePicker/constants.js +3 -3
  156. package/lib/es/timePicker/utils/index.js +3 -3
  157. package/lib/es/timeline/constants.js +2 -2
  158. package/lib/es/toast/constants.js +3 -3
  159. package/lib/es/tooltip/constants.js +1 -1
  160. package/lib/es/tooltip/foundation.js +13 -9
  161. package/lib/es/transfer/constants.js +1 -1
  162. package/lib/es/tree/constants.js +2 -2
  163. package/lib/es/tree/treeUtil.d.ts +1 -1
  164. package/lib/es/tree/treeUtil.js +1 -1
  165. package/lib/es/treeSelect/constants.js +3 -3
  166. package/lib/es/typography/constants.js +1 -1
  167. package/lib/es/typography/formatNumeral.js +6 -6
  168. package/lib/es/upload/constants.js +2 -2
  169. package/lib/es/upload/foundation.js +1 -1
  170. package/lib/es/upload/utils.js +4 -4
  171. package/lib/es/utils/getMotionObjFromProps.js +2 -2
  172. package/lib/es/utils/touchPolyfill.js +1 -1
  173. package/lib/es/utils/uuid.js +2 -2
  174. package/lib/es/utils/warning.js +1 -1
  175. package/package.json +2 -2
  176. package/tooltip/foundation.ts +6 -3
@@ -118,14 +118,14 @@ export const isTimeFormatLike = (time, formatToken) => {
118
118
  let isLike = true;
119
119
  const dateFnsSupportFormatCh = 'BDEGHKLMOPQRSTXYabcehimopqstuwxyz'; // dateFns support format character
120
120
 
121
- const formatSupportChReg = new RegExp("[".concat(dateFnsSupportFormatCh, "]"), 'g');
122
- const formatNotSupportChReg = new RegExp("[^".concat(dateFnsSupportFormatCh, "]"), 'g');
121
+ const formatSupportChReg = new RegExp(`[${dateFnsSupportFormatCh}]`, 'g');
122
+ const formatNotSupportChReg = new RegExp(`[^${dateFnsSupportFormatCh}]`, 'g');
123
123
  const hmsReg = /[H|m|s]{1,2}/;
124
124
  const formatSplitted = formatToken.split(formatNotSupportChReg); // => ['HH', 'mm'];
125
125
 
126
126
  const timeSeparator = formatToken.replace(formatSupportChReg, ''); // => :
127
127
 
128
- const timeReg = new RegExp("[".concat(timeSeparator, "]"), 'g'); // => /[:]/g
128
+ const timeReg = new RegExp(`[${timeSeparator}]`, 'g'); // => /[:]/g
129
129
 
130
130
  const timeSplitted = time.split(timeReg); // => ['12', '0]
131
131
 
@@ -1,7 +1,7 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-timeline"),
4
- ITEM: "".concat(BASE_CLASS_PREFIX, "-timeline-item")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-timeline`,
4
+ ITEM: `${BASE_CLASS_PREFIX}-timeline-item`
5
5
  };
6
6
  const strings = {
7
7
  MODE: ['left', 'alternate', 'right', 'center'],
@@ -1,9 +1,9 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
- const PREFIX = "".concat(BASE_CLASS_PREFIX, "-toast");
2
+ const PREFIX = `${BASE_CLASS_PREFIX}-toast`;
3
3
  const cssClasses = {
4
4
  PREFIX,
5
- WRAPPER: "".concat(PREFIX, "-wrapper"),
6
- LIST: "".concat(PREFIX, "-list")
5
+ WRAPPER: `${PREFIX}-wrapper`,
6
+ LIST: `${PREFIX}-list`
7
7
  };
8
8
  const strings = {
9
9
  types: ['warning', 'success', 'info', 'error', 'default'],
@@ -1,6 +1,6 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-tooltip")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-tooltip`
4
4
  };
5
5
  const strings = {
6
6
  POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver', 'leftBottomOver', 'rightBottomOver'],
@@ -480,23 +480,23 @@ export default class Tooltip extends BaseFoundation {
480
480
  if (position && triggerRect && translateX != null && translateY != null) {
481
481
  if (this.getProp('transformFromCenter')) {
482
482
  if (['topLeft', 'bottomLeft'].includes(position)) {
483
- return "".concat(this._roundPixel(triggerRect.width / 2), "px ").concat(-translateY * 100, "%");
483
+ return `${this._roundPixel(triggerRect.width / 2)}px ${-translateY * 100}%`;
484
484
  }
485
485
 
486
486
  if (['topRight', 'bottomRight'].includes(position)) {
487
- return "calc(100% - ".concat(this._roundPixel(triggerRect.width / 2), "px) ").concat(-translateY * 100, "%");
487
+ return `calc(100% - ${this._roundPixel(triggerRect.width / 2)}px) ${-translateY * 100}%`;
488
488
  }
489
489
 
490
490
  if (['leftTop', 'rightTop'].includes(position)) {
491
- return "".concat(-translateX * 100, "% ").concat(this._roundPixel(triggerRect.height / 2), "px");
491
+ return `${-translateX * 100}% ${this._roundPixel(triggerRect.height / 2)}px`;
492
492
  }
493
493
 
494
494
  if (['leftBottom', 'rightBottom'].includes(position)) {
495
- return "".concat(-translateX * 100, "% calc(100% - ").concat(this._roundPixel(triggerRect.height / 2), "px)");
495
+ return `${-translateX * 100}% calc(100% - ${this._roundPixel(triggerRect.height / 2)}px)`;
496
496
  }
497
497
  }
498
498
 
499
- return "".concat(-translateX * 100, "% ").concat(-translateY * 100, "%");
499
+ return `${-translateX * 100}% ${-translateY * 100}%`;
500
500
  }
501
501
 
502
502
  return null;
@@ -507,6 +507,9 @@ export default class Tooltip extends BaseFoundation {
507
507
  spacing,
508
508
  isOverFlow
509
509
  } = props;
510
+ const {
511
+ innerWidth
512
+ } = window;
510
513
  const triggerRect = (_isEmpty(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || Object.assign({}, defaultRect);
511
514
  const containerRect = (_isEmpty(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || Object.assign({}, defaultRect);
512
515
  const wrapperRect = (_isEmpty(props.wrapperRect) ? props.wrapperRect : this._adapter.getWrapperBounding()) || Object.assign({}, defaultRect); // eslint-disable-next-line
@@ -549,6 +552,7 @@ export default class Tooltip extends BaseFoundation {
549
552
  const isWidthOverFlow = isOverFlow && isOverFlow[1];
550
553
  const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
551
554
  const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
555
+ const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
552
556
 
553
557
  switch (position) {
554
558
  case 'top':
@@ -563,7 +567,7 @@ export default class Tooltip extends BaseFoundation {
563
567
  case 'topLeft':
564
568
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
565
569
  // top = triggerRect.top - SPACING;
566
- left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
570
+ left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
567
571
  top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
568
572
  translateY = -1;
569
573
  break;
@@ -615,7 +619,7 @@ export default class Tooltip extends BaseFoundation {
615
619
  case 'bottomLeft':
616
620
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
617
621
  // top = triggerRect.bottom + SPACING;
618
- left = isWidthOverFlow ? containerRect.left : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
622
+ left = isWidthOverFlow ? isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width : pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
619
623
  top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
620
624
  break;
621
625
 
@@ -723,7 +727,7 @@ export default class Tooltip extends BaseFoundation {
723
727
  let transform = ''; // eslint-disable-next-line
724
728
 
725
729
  if (translateX != null) {
726
- transform += "translateX(".concat(translateX * 100, "%) ");
730
+ transform += `translateX(${translateX * 100}%) `;
727
731
  Object.defineProperty(style, 'translateX', {
728
732
  enumerable: false,
729
733
  value: translateX
@@ -732,7 +736,7 @@ export default class Tooltip extends BaseFoundation {
732
736
 
733
737
 
734
738
  if (translateY != null) {
735
- transform += "translateY(".concat(translateY * 100, "%) ");
739
+ transform += `translateY(${translateY * 100}%) `;
736
740
  Object.defineProperty(style, 'translateY', {
737
741
  enumerable: false,
738
742
  value: translateY
@@ -1,6 +1,6 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-transfer")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-transfer`
4
4
  };
5
5
  const strings = {
6
6
  TYPE_GROUP_LIST: 'groupList',
@@ -1,7 +1,7 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-tree"),
4
- PREFIX_OPTION: "".concat(BASE_CLASS_PREFIX, "-tree-option")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-tree`,
4
+ PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-option`
5
5
  };
6
6
  const strings = {
7
7
  EXPAND_ACTION: [false, 'click', 'doubleClick']
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
74
74
  export declare function normalizeValue(value: any, withObject: boolean): any;
75
75
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
76
76
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
77
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
77
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
78
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
79
79
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -10,7 +10,7 @@ import _difference from "lodash/difference";
10
10
  const DRAG_OFFSET = 0.45;
11
11
 
12
12
  function getPosition(level, index) {
13
- return "".concat(level, "-").concat(index);
13
+ return `${level}-${index}`;
14
14
  }
15
15
 
16
16
  function isValid(val) {
@@ -1,8 +1,8 @@
1
1
  import { VALIDATE_STATUS, BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-tree-select"),
4
- PREFIX_TREE: "".concat(BASE_CLASS_PREFIX, "-tree"),
5
- PREFIX_OPTION: "".concat(BASE_CLASS_PREFIX, "-tree-select-option")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-tree-select`,
4
+ PREFIX_TREE: `${BASE_CLASS_PREFIX}-tree`,
5
+ PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-select-option`
6
6
  };
7
7
  const strings = {
8
8
  SIZE_SET: ['small', 'large', 'default'],
@@ -1,6 +1,6 @@
1
1
  import { BASE_CLASS_PREFIX } from '../base/constants';
2
2
  const cssClasses = {
3
- PREFIX: "".concat(BASE_CLASS_PREFIX, "-typography")
3
+ PREFIX: `${BASE_CLASS_PREFIX}-typography`
4
4
  };
5
5
  const strings = {
6
6
  TYPE: ['primary', 'secondary', 'danger', 'warning', 'success', 'tertiary', 'quaternary'],
@@ -11,7 +11,7 @@ export default class FormatNumeral {
11
11
  i++;
12
12
  }
13
13
 
14
- return "".concat(this.truncatePrecision(value), " ").concat(units[i]);
14
+ return `${this.truncatePrecision(value)} ${units[i]}`;
15
15
  },
16
16
  'bytes-binary': value => {
17
17
  const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
@@ -22,21 +22,21 @@ export default class FormatNumeral {
22
22
  i++;
23
23
  }
24
24
 
25
- return "".concat(this.truncatePrecision(value), " ").concat(units[i]);
25
+ return `${this.truncatePrecision(value)} ${units[i]}`;
26
26
  },
27
27
  percentages: value => {
28
28
  const cArr = value.toString().split('.');
29
29
 
30
30
  if (Number(cArr[0]) === 0) {
31
- return "".concat(this.truncatePrecision(value * 100), "%");
31
+ return `${this.truncatePrecision(value * 100)}%`;
32
32
  }
33
33
 
34
- return "".concat(this.truncatePrecision(value), "%");
34
+ return `${this.truncatePrecision(value)}%`;
35
35
  },
36
36
  exponential: value => {
37
37
  const vExponential = value.toExponential(this.precision + 2);
38
38
  const vArr = vExponential.split('e');
39
- return "".concat(this.truncatePrecision(Number(vArr[0])), "e").concat(vArr[1]);
39
+ return `${this.truncatePrecision(Number(vArr[0]))}e${vArr[1]}`;
40
40
  }
41
41
  }; // A collection of methods for truncating numbers; Methods key: Truncate (strings.Truncate);
42
42
 
@@ -86,7 +86,7 @@ export default class FormatNumeral {
86
86
  const cTLength = cArr[1].length; // Fill in any missing `0` at the end.
87
87
 
88
88
  if (cTLength < this.precision) {
89
- return "".concat(cArr[0], ".").concat(cArr[1]).concat('0'.repeat(this.precision - cTLength));
89
+ return `${cArr[0]}.${cArr[1]}${'0'.repeat(this.precision - cTLength)}`;
90
90
  }
91
91
 
92
92
  return cTruncated.toString();
@@ -1,12 +1,12 @@
1
1
  import { VALIDATE_STATUS, BASE_CLASS_PREFIX } from '../base/constants';
2
- const PREFIX = "".concat(BASE_CLASS_PREFIX, "-upload");
2
+ const PREFIX = `${BASE_CLASS_PREFIX}-upload`;
3
3
  const FILE_LIST_PIC = 'picture';
4
4
  const FILE_LIST_DEFAULT = 'list';
5
5
  const PROGRESS_COEFFICIENT = 0.95;
6
6
  const cssClasses = {
7
7
  PREFIX,
8
8
  // WRAPPER: `${PREFIX}-wrapper`,
9
- LIST: "".concat(PREFIX, "-list")
9
+ LIST: `${PREFIX}-list`
10
10
  };
11
11
  const TRIGGER_AUTO = 'auto';
12
12
  const TRIGGER_CUSTOM = 'custom';
@@ -63,7 +63,7 @@ class UploadFoundation extends BaseFoundation {
63
63
  fileName
64
64
  } = _ref;
65
65
  const status = xhr ? xhr.status : 0;
66
- const msg = message || "cannot post ".concat(fileName, " to ").concat(action, ", xhr status: ").concat(status, "'");
66
+ const msg = message || `cannot post ${fileName} to ${action}, xhr status: ${status}'`;
67
67
  const err = new Error(msg);
68
68
  err.status = status;
69
69
  err.method = 'post';
@@ -34,11 +34,11 @@ export const byteKB = 1024;
34
34
  export const byteMB = 1048576;
35
35
  export function getFileSize(number) {
36
36
  if (number < byteKB) {
37
- return "".concat((number / byteKB).toFixed(2), "KB");
37
+ return `${(number / byteKB).toFixed(2)}KB`;
38
38
  } else if (number >= byteKB && number < byteMB) {
39
- return "".concat((number / byteKB).toFixed(1), "KB");
39
+ return `${(number / byteKB).toFixed(1)}KB`;
40
40
  } else if (number >= byteMB) {
41
- return "".concat((number / byteMB).toFixed(1), "MB");
41
+ return `${(number / byteMB).toFixed(1)}MB`;
42
42
  }
43
43
 
44
44
  return undefined;
@@ -108,7 +108,7 @@ export function mapFileTree(items) {
108
108
 
109
109
  for (let index = 0; index < entries.length; index++) {
110
110
  const entry = entries[index];
111
- yield _traverseFileTree(entry, "".concat(path).concat(item.name, "/"));
111
+ yield _traverseFileTree(entry, `${path}${item.name}/`);
112
112
  }
113
113
  }
114
114
  });
@@ -17,7 +17,7 @@ import warning from './warning';
17
17
 
18
18
  export default function getMotionObjFromProps(props) {
19
19
  if (typeof props !== 'object' || props === null) {
20
- throw new TypeError("props should be object type, got ".concat(typeof props));
20
+ throw new TypeError(`props should be object type, got ${typeof props}`);
21
21
  }
22
22
 
23
23
  const MOTION_PROPS = ['willEnter', 'didEnter', 'willLeave', 'didLeave', 'onStart', 'onRest', 'state'];
@@ -41,7 +41,7 @@ export default function getMotionObjFromProps(props) {
41
41
  };
42
42
  }
43
43
  } else {
44
- warning(true, "[Semi] duplicate motion key '".concat(key, "' from motion prop and props"));
44
+ warning(true, `[Semi] duplicate motion key '${key}' from motion prop and props`);
45
45
  }
46
46
  }
47
47
  } else if (typeof motionProp === 'function') {
@@ -21,7 +21,7 @@ const touchEventPolyfill = (touch, touchEvent) => {
21
21
  }
22
22
 
23
23
  if (touch[key]) {
24
- warning(true, "\"The key ".concat(key, "\" exist in Touch."));
24
+ warning(true, `"The key ${key}" exist in Touch.`);
25
25
  } else {
26
26
  touch[key] = value;
27
27
  }
@@ -1,5 +1,5 @@
1
1
  export default function getUuid(prefix) {
2
- return "".concat(prefix, "-").concat(new Date().getTime(), "-").concat(Math.random());
2
+ return `${prefix}-${new Date().getTime()}-${Math.random()}`;
3
3
  } // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
4
4
 
5
5
  function getUuidv4() {
@@ -39,7 +39,7 @@ function getUuidShort() {
39
39
  randomId += characters.charAt(random);
40
40
  }
41
41
 
42
- return prefix ? "".concat(prefix, "-").concat(randomId) : randomId;
42
+ return prefix ? `${prefix}-${randomId}` : randomId;
43
43
  }
44
44
 
45
45
  export { getUuid, getUuidv4, getUuidShort };
@@ -1,5 +1,5 @@
1
1
  export default function warning(flag, info) {
2
2
  if (flag) {
3
- console.warn("Warning: ".concat(info));
3
+ console.warn(`Warning: ${info}`);
4
4
  }
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.25.3",
3
+ "version": "2.25.4",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "45218733f7850d503d11390c9eeb5853e2423fdb",
26
+ "gitHead": "52220f9714b8bc8a8cc073ae8f9c463d7850511e",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -387,6 +387,8 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
387
387
 
388
388
  calcPosStyle(props: {triggerRect: DOMRect; wrapperRect: DOMRect; containerRect: PopupContainerDOMRect; position?: Position; spacing?: number; isOverFlow?: [boolean, boolean]}) {
389
389
  const { spacing, isOverFlow } = props;
390
+ const { innerWidth } = window;
391
+
390
392
  const triggerRect = (isEmpty(props.triggerRect) ? props.triggerRect : this._adapter.getTriggerBounding()) || { ...defaultRect as any };
391
393
  const containerRect = (isEmpty(props.containerRect) ? props.containerRect : this._adapter.getPopupContainerRect()) || {
392
394
  ...defaultRect,
@@ -427,7 +429,8 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
427
429
 
428
430
  const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
429
431
  const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
430
-
432
+
433
+ const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
431
434
 
432
435
  switch (position) {
433
436
  case 'top':
@@ -441,7 +444,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
441
444
  case 'topLeft':
442
445
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
443
446
  // top = triggerRect.top - SPACING;
444
- left = isWidthOverFlow ? containerRect.left : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
447
+ left = isWidthOverFlow ? (isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width ) : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
445
448
  top = isHeightOverFlow ? containerRect.bottom + offsetHeight : triggerRect.top - SPACING;
446
449
  translateY = -1;
447
450
  break;
@@ -487,7 +490,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
487
490
  case 'bottomLeft':
488
491
  // left = pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left;
489
492
  // top = triggerRect.bottom + SPACING;
490
- left = isWidthOverFlow ? containerRect.left : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
493
+ left = isWidthOverFlow ? (isWrapperWidthOverflow ? containerRect.left : containerRect.right - wrapperRect.width ) : (pointAtCenter ? middleX - offsetXWithArrow : triggerRect.left);
491
494
  top = isHeightOverFlow ? containerRect.top + offsetYWithArrow - SPACING : triggerRect.top + triggerRect.height + SPACING;
492
495
  break;
493
496
  case 'bottomRight':