import * as React from 'react'; import './style/anchor.css'; export declare type AnchorContainer = HTMLElement | Window; export declare const ConfigContext: React.Context; export interface ConfigConsumerProps { getTargetContainer?: () => HTMLElement; getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string; } export interface AnchorProps { prefixCls?: string; className?: string; style?: React.CSSProperties; children?: React.ReactNode; /** 距离窗口顶部达到指定偏移量后触发 */ offsetTop?: number; /** 锚点区域边界 */ bounds?: number; /** 固定模式 */ affix?: boolean; /** affix={false} 时是否显示小圆点 */ showInkInFixed?: boolean; /** 指定滚动的容器 */ getContainer?: () => AnchorContainer; /** 自定义高亮的锚点 */ getCurrentAnchor?: () => string; /** click 事件的 handler */ onClick?: (e: React.MouseEvent, link: { title: React.ReactNode; href: string; }) => void; /** 锚点滚动偏移量,默认与 offsetTop 相同 */ targetOffset?: number; /** 监听锚点链接改变 */ onChange?: (currentActiveLink: string) => void; } export interface AnchorState { activeLink: null | string; } export interface AnchorDefaultProps extends AnchorProps { prefixCls: string; affix: boolean; showInkInFixed: boolean; getContainer: () => AnchorContainer; } export interface DmcAnchor { registerLink: (link: string) => void; unregisterLink: (link: string) => void; activeLink: string | null; scrollTo: (link: string) => void; onClick?: (e: React.MouseEvent, link: { title: React.ReactNode; href: string; }) => void; } declare class Anchor extends React.Component { static defaultProps: { affix: boolean; showInkInFixed: boolean; }; static contextType: React.Context; state: { activeLink: null; }; content: ConfigConsumerProps; private wrapperRef; private inkNode; private scrollContainer; private links; private scrollEvent; private animating; private prefixCls?; registerLink: (link: string) => void; unregisterLink: (link: string) => void; getContainer: () => any; componentDidMount(): void; componentDidUpdate(): void; componentWillUnmount(): void; getCurrentAnchor(offsetTop?: number, bounds?: number): string; handleScrollTo: (link: string) => void; saveInkNode: (node: HTMLSpanElement) => void; setCurrentActiveLink: (link: string) => void; handleScroll: () => void; updateInk: () => void; getMemoizedContextValue: (link: DmcAnchor['activeLink'], onClickFn: AnchorProps['onClick']) => DmcAnchor; render(): JSX.Element; } export default Anchor; declare const AnchorMemo: React.MemoExoticComponent; export { AnchorMemo };