import * as React from 'react'; import { AffixProps as NextAffixProps } from '@alifd/next/types/affix'; export interface LinkItemData { htmlId: string; label: string; /** * 嵌套层级 * 仅在 direction="ver" 生效,且最大层级不超过二级 */ children?: LinkItemData[]; } export interface AnchorProps extends Omit, 'onChange'> { /** * 自定义样式名 */ className?: string; /** * 自定义样式 */ style?: React.CSSProperties; /** * 锚点方向 * 水平方向 dataSource 不支持属性 */ direction?: 'ver' | 'hoz'; /** * 锚点列表数据源 */ dataSource: LinkItemData[]; /** * 设置是否为财鲸页面的锚点 * 设置后会修改 container 为 () => document.querySelector('#fusion-ui-page > div.fusion-ui-page-content-wrapper'); */ isWhalePageAnchor?: boolean; /** * 容器,默认是 window */ container?: () => React.ReactElement> | Element; /** * direction="hoz" 生效 * 开启可在滚动超出屏幕后固定在屏幕 */ hasAffix?: boolean; /** * hasAffix={true} 后使用 * 用于覆盖 Affix 的属性值 */ affixProps?: NextAffixProps; /** * 点击不同锚点时的自定义触发函数 * 默认跳转到对应 htmlId 节点 * 可返回布尔值,如返回 false,则阻止默认跳转操作 */ onChange?: (htmlId: string) => boolean; /** * 垂直跳转偏移量 */ offsetY?: number; /** * [方向垂直可用] * 用于设定悬浮锚点的菜单是否默认展开 * @default true */ defaultVisible?: boolean; /** * 自定义滚动到页首的方法 */ scrollTop?: () => void; containerRef?: any; } export declare class Anchor extends React.Component { static displayName: string; static defaultProps: { direction: string; isWhalePageAnchor: boolean; offsetY: number; scrollTop: () => void; }; ref: React.RefObject; render(): React.JSX.Element; }