@douyinfe/semi-foundation 2.36.0 → 2.36.1-alpha.1

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.
@@ -425,6 +425,7 @@ class Tooltip extends _foundation.default {
425
425
  return null;
426
426
  }
427
427
  calcPosStyle(props) {
428
+ var _a, _b;
428
429
  const {
429
430
  spacing,
430
431
  isOverFlow
@@ -585,6 +586,12 @@ class Tooltip extends _foundation.default {
585
586
  // Calculate container positioning relative to window
586
587
  left = left - containerRect.left;
587
588
  top = top - containerRect.top;
589
+ if (Math.abs((wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.width) - ((_a = this._adapter.getContainer()) === null || _a === void 0 ? void 0 : _a.clientWidth)) > 1) {
590
+ left /= wrapperRect.width / this._adapter.getContainer().clientWidth;
591
+ }
592
+ if (Math.abs((wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.height) - ((_b = this._adapter.getContainer()) === null || _b === void 0 ? void 0 : _b.clientHeight)) > 1) {
593
+ top /= wrapperRect.height / this._adapter.getContainer().clientHeight;
594
+ }
588
595
  /**
589
596
  * container为body时,如果position不为relative或absolute,这时trigger计算出的top/left会根据html定位(initial containing block)
590
597
  * 此时如果body有margin,则计算出的位置相对于body会有问题 fix issue #1368
@@ -417,6 +417,7 @@ export default class Tooltip extends BaseFoundation {
417
417
  return null;
418
418
  }
419
419
  calcPosStyle(props) {
420
+ var _a, _b;
420
421
  const {
421
422
  spacing,
422
423
  isOverFlow
@@ -577,6 +578,12 @@ export default class Tooltip extends BaseFoundation {
577
578
  // Calculate container positioning relative to window
578
579
  left = left - containerRect.left;
579
580
  top = top - containerRect.top;
581
+ if (Math.abs((wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.width) - ((_a = this._adapter.getContainer()) === null || _a === void 0 ? void 0 : _a.clientWidth)) > 1) {
582
+ left /= wrapperRect.width / this._adapter.getContainer().clientWidth;
583
+ }
584
+ if (Math.abs((wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.height) - ((_b = this._adapter.getContainer()) === null || _b === void 0 ? void 0 : _b.clientHeight)) > 1) {
585
+ top /= wrapperRect.height / this._adapter.getContainer().clientHeight;
586
+ }
580
587
  /**
581
588
  * container为body时,如果position不为relative或absolute,这时trigger计算出的top/left会根据html定位(initial containing block)
582
589
  * 此时如果body有margin,则计算出的位置相对于body会有问题 fix issue #1368
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.36.0",
3
+ "version": "2.36.1-alpha.1",
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": "597a4a6279411ed623d2072f1bcde3f2f3983985",
26
+ "gitHead": "b2000172b77908a6cdd53447b5bbd68ac0761ec0",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -559,6 +559,14 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
559
559
  left = left - containerRect.left;
560
560
  top = top - containerRect.top;
561
561
 
562
+ if (Math.abs(wrapperRect?.width - this._adapter.getContainer()?.clientWidth) > 1) {
563
+ left/= wrapperRect.width/this._adapter.getContainer().clientWidth;
564
+ }
565
+
566
+ if (Math.abs(wrapperRect?.height - this._adapter.getContainer()?.clientHeight) > 1) {
567
+ top/= wrapperRect.height/this._adapter.getContainer().clientHeight;
568
+ }
569
+
562
570
  /**
563
571
  * container为body时,如果position不为relative或absolute,这时trigger计算出的top/left会根据html定位(initial containing block)
564
572
  * 此时如果body有margin,则计算出的位置相对于body会有问题 fix issue #1368