Skip to content

Commit abd31ba

Browse files
committed
chore: add missing prop & interface
1 parent 7d61c89 commit abd31ba

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/hooks/useAlign.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import useEvent from 'rc-util/lib/hooks/useEvent';
22
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
33
import * as React from 'react';
4+
import type { TriggerProps } from '..';
45
import type {
56
AlignPointLeftRight,
67
AlignPointTopBottom,
@@ -73,6 +74,7 @@ export default function useAlign(
7374
placement: string,
7475
builtinPlacements: any,
7576
popupAlign?: AlignType,
77+
onPopupAlign?: TriggerProps['onPopupAlign'],
7678
): [
7779
ready: boolean,
7880
offsetX: number,
@@ -306,6 +308,8 @@ export default function useAlign(
306308
const yCenter = (maxTop + minBottom) / 2;
307309
const nextArrowY = yCenter - popupTop;
308310

311+
onPopupAlign?.(popupEle, nextAlignInfo);
312+
309313
setOffsetInfo({
310314
ready: true,
311315
offsetX: nextOffsetX / scaleX,

src/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import Popup from './Popup';
2222
import TriggerWrapper from './TriggerWrapper';
2323
import { getAlignPopupClassName, getMotion, getWin } from './util';
2424

25+
export type { BuildInPlacements, AlignType, ActionType };
26+
2527
export interface TriggerRef {
2628
forceAlign: VoidFunction;
2729
}
@@ -42,7 +44,7 @@ export interface TriggerProps {
4244

4345
zIndex?: number;
4446

45-
// onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
47+
onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
4648

4749
stretch?: string;
4850

@@ -166,6 +168,7 @@ const Trigger = React.forwardRef<TriggerRef, TriggerProps>((props, ref) => {
166168
alignPoint,
167169

168170
onPopupClick,
171+
onPopupAlign,
169172

170173
// Arrow
171174
arrow,
@@ -332,6 +335,7 @@ const Trigger = React.forwardRef<TriggerRef, TriggerProps>((props, ref) => {
332335
popupPlacement,
333336
builtinPlacements,
334337
popupAlign,
338+
onPopupAlign,
335339
);
336340

337341
const triggerAlign = useEvent(() => {

0 commit comments

Comments
 (0)