import * as React from "react"; import { AnchorContext } from "./AnchorContext"; import { ConfigConsumerProps } from "../Config"; export declare type AnchorContainer = HTMLElement | Window; interface IAnchorProps { /** * 默认前缀 * * @default "lg" **/ prefixCls?: string; /** * 自定义组件类名 * * @default "" **/ className?: string; /** * 组件子内容 * * **/ children: React.ReactNode; /** * 自定义组件样式 * * @default **/ style?: React.CSSProperties; /** * 距离窗口顶部达到指定偏移量后触发 fixed * * @default 0 **/ offsetTop?: number; /** * 距离窗口底部达到指定偏移量后触发 fiexed * * @default **/ offsetBottom?: number; /** * 锚点区域边界 * * @default 5 **/ bounds?: number; /** * 是否fixed * * @default true **/ affix?: boolean; /** * 指定滚动的容器 * * @default () => HTMLElement **/ getContainer?: () => AnchorContainer; /** * 点击时的回调 * * @default (e,link) =>void **/ onClick?: (e: React.MouseEvent, link: { title: React.ReactNode; href: string; }) => void; /** * 展示样式 'horizontal', 'vertical' * * @default "vertical" **/ type?: string; } interface IAnchorState { activeLink: null | string; } declare class Anchor extends React.PureComponent { inkNode: HTMLSpanElement; links: string[]; animating: boolean; scrollEvent: any; private scrollContainer; childContextTypes: { anchorContext: AnchorContext; }; static Link: any; static defaultProps: { affix: boolean; getContainer: () => Window & typeof globalThis; className: string; offsetTop: number; bounds: number; type: string; }; constructor(props: IAnchorProps); getContext(): { anchorContext: AnchorContext; }; componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(): void; handleScrollTo(link: string): void; handleScroll(): void; getCurrentAnchor(offsetTop?: number, bounds?: number): string; saveInkNode(node: HTMLSpanElement): void; renderAnchor(prefixCls: any): JSX.Element; renderAnchorWrap: ({ getPrefixCls }: ConfigConsumerProps) => JSX.Element; render(): JSX.Element; } export default Anchor;