@rc-component/trigger 1.14.3 → 1.14.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.
- package/es/hooks/useAction.d.ts +1 -1
- package/es/hooks/useAlign.js +2 -2
- package/es/interface.d.ts +11 -11
- package/lib/hooks/useAction.d.ts +1 -1
- package/lib/hooks/useAlign.js +2 -2
- package/lib/interface.d.ts +11 -11
- package/package.json +1 -1
package/es/hooks/useAction.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ActionType } from '../interface';
|
|
2
|
-
|
|
2
|
+
type ActionTypes = ActionType | ActionType[];
|
|
3
3
|
export default function useAction(mobile: boolean, action: ActionTypes, showAction?: ActionTypes, hideAction?: ActionTypes): [showAction: Set<ActionType>, hideAction: Set<ActionType>];
|
|
4
4
|
export {};
|
package/es/hooks/useAlign.js
CHANGED
|
@@ -413,7 +413,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
413
413
|
if (typeof numShiftY === 'number') {
|
|
414
414
|
// Top
|
|
415
415
|
if (nextPopupY < visibleRegionArea.top) {
|
|
416
|
-
nextOffsetY -= nextPopupY - visibleRegionArea.top;
|
|
416
|
+
nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
|
|
417
417
|
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
418
418
|
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
419
419
|
}
|
|
@@ -421,7 +421,7 @@ export default function useAlign(open, popupEle, target, placement, builtinPlace
|
|
|
421
421
|
|
|
422
422
|
// Bottom
|
|
423
423
|
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
424
|
-
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom;
|
|
424
|
+
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
425
425
|
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
426
426
|
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
427
427
|
}
|
package/es/interface.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CSSMotionProps } from 'rc-motion';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type Placement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
4
|
+
export type AlignPointTopBottom = 't' | 'b' | 'c';
|
|
5
|
+
export type AlignPointLeftRight = 'l' | 'r' | 'c';
|
|
6
6
|
/** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type AlignPoint = `${AlignPointTopBottom}${AlignPointLeftRight}`;
|
|
8
|
+
export type OffsetType = number | `${number}%`;
|
|
9
9
|
export interface AlignType {
|
|
10
10
|
/**
|
|
11
11
|
* move point of source node to align with point of target node.
|
|
@@ -75,15 +75,15 @@ export interface ArrowTypeOuter {
|
|
|
75
75
|
className?: string;
|
|
76
76
|
content?: React.ReactNode;
|
|
77
77
|
}
|
|
78
|
-
export
|
|
78
|
+
export type ArrowPos = {
|
|
79
79
|
x?: number;
|
|
80
80
|
y?: number;
|
|
81
81
|
};
|
|
82
|
-
export
|
|
83
|
-
export
|
|
84
|
-
export
|
|
85
|
-
export
|
|
86
|
-
export
|
|
82
|
+
export type BuildInPlacements = Record<string, AlignType>;
|
|
83
|
+
export type StretchType = string;
|
|
84
|
+
export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu';
|
|
85
|
+
export type AnimationType = string;
|
|
86
|
+
export type TransitionNameType = string;
|
|
87
87
|
export interface Point {
|
|
88
88
|
pageX: number;
|
|
89
89
|
pageY: number;
|
package/lib/hooks/useAction.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ActionType } from '../interface';
|
|
2
|
-
|
|
2
|
+
type ActionTypes = ActionType | ActionType[];
|
|
3
3
|
export default function useAction(mobile: boolean, action: ActionTypes, showAction?: ActionTypes, hideAction?: ActionTypes): [showAction: Set<ActionType>, hideAction: Set<ActionType>];
|
|
4
4
|
export {};
|
package/lib/hooks/useAlign.js
CHANGED
|
@@ -421,7 +421,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
421
421
|
if (typeof numShiftY === 'number') {
|
|
422
422
|
// Top
|
|
423
423
|
if (nextPopupY < visibleRegionArea.top) {
|
|
424
|
-
nextOffsetY -= nextPopupY - visibleRegionArea.top;
|
|
424
|
+
nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
|
|
425
425
|
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
|
|
426
426
|
nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
|
|
427
427
|
}
|
|
@@ -429,7 +429,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
|
|
|
429
429
|
|
|
430
430
|
// Bottom
|
|
431
431
|
if (nextPopupBottom > visibleRegionArea.bottom) {
|
|
432
|
-
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom;
|
|
432
|
+
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
|
|
433
433
|
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
|
|
434
434
|
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
|
|
435
435
|
}
|
package/lib/interface.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CSSMotionProps } from 'rc-motion';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type Placement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
4
|
+
export type AlignPointTopBottom = 't' | 'b' | 'c';
|
|
5
|
+
export type AlignPointLeftRight = 'l' | 'r' | 'c';
|
|
6
6
|
/** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type AlignPoint = `${AlignPointTopBottom}${AlignPointLeftRight}`;
|
|
8
|
+
export type OffsetType = number | `${number}%`;
|
|
9
9
|
export interface AlignType {
|
|
10
10
|
/**
|
|
11
11
|
* move point of source node to align with point of target node.
|
|
@@ -75,15 +75,15 @@ export interface ArrowTypeOuter {
|
|
|
75
75
|
className?: string;
|
|
76
76
|
content?: React.ReactNode;
|
|
77
77
|
}
|
|
78
|
-
export
|
|
78
|
+
export type ArrowPos = {
|
|
79
79
|
x?: number;
|
|
80
80
|
y?: number;
|
|
81
81
|
};
|
|
82
|
-
export
|
|
83
|
-
export
|
|
84
|
-
export
|
|
85
|
-
export
|
|
86
|
-
export
|
|
82
|
+
export type BuildInPlacements = Record<string, AlignType>;
|
|
83
|
+
export type StretchType = string;
|
|
84
|
+
export type ActionType = 'hover' | 'focus' | 'click' | 'contextMenu';
|
|
85
|
+
export type AnimationType = string;
|
|
86
|
+
export type TransitionNameType = string;
|
|
87
87
|
export interface Point {
|
|
88
88
|
pageX: number;
|
|
89
89
|
pageY: number;
|