/**
* @file AnchorNav
* @description 锚点导航
* @author hsm-lv
*/
///
import React from 'react';
import { ThemeProps } from 'amis-core';
import type { Schema } from 'amis-core';
export interface AnchorNavSectionProps extends ThemeProps {
title?: string;
name: string | number;
body?: Schema;
className?: string;
style?: any;
children?: React.ReactNode | Array;
}
declare class AnchorNavSectionComponent extends React.PureComponent {
contentDom: any;
contentRef: (ref: any) => any;
render(): React.JSX.Element;
}
export declare const AnchorNavSection: {
new (props: Omit & import("packages/amis-core/lib/theme").ThemeOuterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof AnchorNavSectionComponent;
};
export interface AnchorNavProps extends ThemeProps {
links?: Array;
active?: string | number;
linkClassName?: string;
sectionClassName?: string;
sectionRender?: (section: AnchorNavSectionProps, props?: AnchorNavProps) => JSX.Element;
onSelect?: (key: string | number) => void;
direction?: 'vertical' | 'horizontal';
children?: React.ReactNode | Array;
}
interface SectionOffset {
key: string | number;
offsetTop: number;
}
export interface AnchorNavState {
offsetArr: SectionOffset[];
fromSelect: boolean;
}
export declare class AnchorNav extends React.Component {
static defaultProps: Pick;
contentDom: React.RefObject;
observer: MutationObserver;
componentDidMount(): void;
componentWillUnmount(): void;
updateSectionOffset(parentNode: HTMLElement, inited: boolean): void;
scrollToNav(e: Event): void;
scrollToSection(key: string | number): void;
handleSelect(key: string | number): void;
fireSelect(key: string | number): void;
renderLink(link: any, index: number): React.JSX.Element | undefined;
renderSection(section: any, index: number): React.DetailedReactHTMLElement | undefined;
render(): React.JSX.Element | null;
}
declare const _default: {
new (props: Pick, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, "children" | "links" | "active" | "onSelect" | "sectionRender"> & {
direction?: "vertical" | "horizontal" | undefined;
linkClassName?: string | undefined;
sectionClassName?: string | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof AnchorNav;
} & {
AnchorNavSection: typeof AnchorNavSection;
};
export default _default;