UNPKG

@orca-fe/antd-plus

Version:
40 lines (39 loc) 1.42 kB
import React from 'react'; export type TabCloseListener = () => Promise<boolean> | Promise<void> | boolean; export type TabConfigType = { key: string; title: React.ReactNode; content: React.ReactNode; params?: unknown; onClose?: () => void; closable?: boolean; order?: number; }; export type TabsLayoutContextType = { tabs: TabConfigType[]; setTabs: (tabs: TabConfigType[]) => void; add: (tabConfig: TabConfigType, active?: boolean) => void; update: (tabConfig: Partial<TabConfigType> & { key: string; }) => void; remove: (key: string) => void; activeKey: string; active: (key: string, force?: boolean) => void; setRenderRoot: (dom: HTMLElement | null) => void; extraRef?: React.RefObject<HTMLDivElement>; }; export declare const TabsLayoutContext: React.Context<TabsLayoutContextType>; export default TabsLayoutContext; export type TabConfigContextType = { index: number; current: TabConfigType | null; isActive: boolean; active: () => void; close: () => void; update: (tabConfig: Partial<Omit<TabConfigType, 'key'>>) => void; params: any; addCloseListener: (key: TabCloseListener) => void; removeCloseListener: (key: TabCloseListener) => void; }; export declare const TabConfigContext: React.Context<TabConfigContextType>; export declare const useTabCloseListener: (callback: TabCloseListener) => void;