UNPKG

amis

Version:

一种MIS页面生成工具

145 lines (144 loc) 7.33 kB
/// <reference types="hoist-non-react-statics" /> import React from 'react'; import { RendererProps } from '../factory'; import { IScopedContext } from '../Scoped'; import { ThemeProps } from '../theme'; import { BaseSchema, SchemaApi, SchemaIcon, SchemaUrlPath } from '../Schema'; export declare type NavItemSchema = { /** * 文字说明 */ label?: string; /** * 图标类名,参考 fontawesome 4。 */ icon?: SchemaIcon; to?: SchemaUrlPath; children?: Array<NavItemSchema>; } & Omit<BaseSchema, 'type'>; /** * Nav 导航渲染器 * 文档:https://baidu.gitee.io/amis/docs/components/nav */ export interface NavSchema extends BaseSchema { /** * 指定为 Nav 导航渲染器 */ type: 'nav'; /** * 链接地址集合 */ links?: Array<NavItemSchema>; /** * 可以通过 API 拉取。 */ source?: SchemaApi; /** * true 为垂直排列,false 为水平排列类似如 tabs。 */ stacked?: boolean; } export interface Link { className?: string; label?: string; to?: string; icon?: string; active?: boolean; activeOn?: string; unfolded?: boolean; children?: Links; [propName: string]: any; } export interface Links extends Array<Link> { } export interface NavigationState { links: Links; error?: string; } export interface NavigationProps extends RendererProps, ThemeProps, NavSchema { onSelect?: (item: Link) => any; } export declare class Navigation extends React.Component<NavigationProps, NavigationState> { static defaultProps: Partial<NavigationProps>; mounted: boolean; constructor(props: NavigationProps); componentDidMount(): void; componentWillReceiveProps(nextProps: NavigationProps): void; componentDidUpdate(prevProps: NavigationProps): void; componentWillUnmount(): void; reload(target?: string, query?: any, values?: object): void; receive(values: object): void; syncLinks(props: NavigationProps, links?: NavItemSchema[] | undefined, clearActive?: boolean): Links; handleClick(link: { label?: string; to?: string; icon?: string; children?: Links; }): void; toggleLink(target: Link): void; renderItem(link: Link, index: number): JSX.Element | null; render(): JSX.Element; } declare const _default: { new (props: (Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps) | Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>): { render(): JSX.Element; context: any; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void; }; new (props: Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps, context: any): { render(): JSX.Element; context: any; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<NavigationProps, string | number> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void; }; displayName: string; contextType: React.Context<string>; ComposedComponent: typeof Navigation; } & import("hoist-non-react-statics").NonReactStatics<typeof Navigation, {}> & { ComposedComponent: typeof Navigation; }; export default _default; export declare class NavigationRenderer extends Navigation { static contextType: React.Context<IScopedContext>; componentWillMount(): void; componentWillUnmount(): void; }