/**
* @file Tabs
* @description 选项卡
* @author fex
*/
///
///
import React from 'react';
import { ClassName, LocaleProps, Schema } from 'amis-core';
import { ThemeProps } from 'amis-core';
import Sortable from 'sortablejs';
export type TabsMode = '' | 'line' | 'card' | 'radio' | 'vertical' | 'chrome' | 'simple' | 'strong' | 'tiled' | 'sidebar';
export interface TabProps extends ThemeProps {
title?: string | React.ReactNode;
icon?: string;
iconPosition?: 'left' | 'right';
disabled?: boolean | string;
eventKey: string | number;
tab?: Schema;
className?: string;
activeKey?: string | number;
reload?: boolean;
mountOnEnter?: boolean;
unmountOnExit?: boolean;
toolbar?: React.ReactNode;
}
export declare const Tab: {
new (props: Omit & import("amis-core/lib/theme").ThemeOutterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): JSX.Element;
context: any;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly & import("amis-core/lib/theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly & import("amis-core/lib/theme").ThemeOutterProps> & Readonly<{
children?: import("react").ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: import("react").ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: import("react").Context;
ComposedComponent: import("react").ComponentType & {
themeKey?: string | undefined;
}>;
} & import("hoist-non-react-statics").NonReactStatics & {
themeKey?: string | undefined;
}, {}> & {
ComposedComponent: import("react").ComponentType & {
themeKey?: string | undefined;
};
};
export interface TabsProps extends ThemeProps, LocaleProps {
mode: TabsMode;
tabsMode?: TabsMode;
additionBtns?: React.ReactNode;
onSelect?: (key: string | number) => void;
activeKey?: string | number;
contentClassName: string;
linksClassName?: ClassName;
className?: string;
tabs?: Array;
tabRender?: (tab: TabProps, props?: TabsProps) => JSX.Element;
toolbar?: React.ReactNode;
addable?: boolean;
onAdd?: () => void;
closable?: boolean;
onClose?: (index: number, key: string | number) => void;
draggable?: boolean;
onDragChange?: (e: any) => void;
showTip?: boolean;
showTipClassName?: string;
scrollable?: boolean;
editable?: boolean;
onEdit?: (index: number, text: string) => void;
sidePosition?: 'left' | 'right';
addBtnText?: string;
collapseOnExceed?: number;
collapseBtnLabel?: string;
popOverContainer?: any;
}
export interface IDragInfo {
nodeId: string;
}
export declare class Tabs extends React.Component {
static defaultProps: Pick;
static Tab: {
new (props: Omit & import("amis-core/lib/theme").ThemeOutterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): JSX.Element;
context: any;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly & import("amis-core/lib/theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly & import("amis-core/lib/theme").ThemeOutterProps> & Readonly<{
children?: import("react").ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: import("react").ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: import("react").Context;
ComposedComponent: import("react").ComponentType & {
themeKey?: string | undefined;
}>;
} & import("hoist-non-react-statics").NonReactStatics & {
themeKey?: string | undefined;
}, {}> & {
ComposedComponent: import("react").ComponentType & {
themeKey?: string | undefined;
};
};
navMain: React.RefObject;
scroll: boolean;
sortable?: Sortable;
dragTip?: HTMLElement;
id: string;
draging: boolean;
toDispose: Array<() => void>;
resizeDom: React.RefObject;
checkArrowStatus: import("lodash").DebouncedFunc<() => void>;
constructor(props: TabsProps);
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
/**
* 处理内容与容器之间的位置关系
*/
computedWidth(): void;
/**
* 保证选中的tab始终显示在可视区域
*/
showSelected(key?: string | number): void;
handleSelect(key: string | number): void;
handleStartEdit(index: number, title: string): void;
handleEditInputChange(e: React.ChangeEvent): void;
handleEdit(): void;
dragTipRef(ref: any): void;
destroyDragging(): void;
initDragging(): void;
handleArrow(type: 'left' | 'right'): void;
/**
* 监听导航上的滚动事件
*/
handleWheel(e: WheelEvent): void;
renderNav(child: any, index: number, showClose: boolean): JSX.Element | undefined;
renderTab(child: any, index: number): React.DetailedReactHTMLElement | undefined;
renderArrow(type: 'left' | 'right'): JSX.Element | null | undefined;
handleAddBtn(): void;
renderNavs(showClose?: boolean): any[] | null;
render(): JSX.Element | null;
}
declare const _default: {
new (props: Omit & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): JSX.Element;
context: any;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}> & Readonly<{
children?: import("react").ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: import("react").ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps, keyof LocaleProps> & {
locale?: string | undefined;
translate?: ((str: string, ...args: any[]) => string) | undefined;
}>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: import("react").Context;
ComposedComponent: import("react").ComponentType & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps>>;
} & import("hoist-non-react-statics").NonReactStatics & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps>, {}> & {
ComposedComponent: import("react").ComponentType & import("amis-core/lib/theme").ThemeOutterProps & LocaleProps>;
} & {
Tab: typeof Tab;
};
export default _default;