@aptre/flex-layout
    Preparing search index...

    Interface IOptimizedLayoutProps

    Props for OptimizedLayout - similar to Layout but with renderTab instead of factory

    interface IOptimizedLayoutProps {
        classNameMapper?: (defaultClassName: string) => string;
        i18nMapper?: (id: I18nLabel, param?: string) => string | undefined;
        icons?: IIcons;
        model: Model;
        onAction?: (action: Action) => Action | undefined;
        onAuxMouseClick?: NodeMouseEvent;
        onContextMenu?: NodeMouseEvent;
        onDragStateChange?: (isDragging: boolean) => void;
        onExternalDrag?: (
            event: DragEvent<HTMLElement>,
        ) =>
            | {
                json: IJsonTabNode;
                onDrop?: (node?: Node, event?: DragEvent<HTMLElement>) => void;
            }
            | undefined;
        onModelChange?: (model: Model, action: Action) => void;
        onRenderDragRect?: DragRectRenderCallback;
        onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void;
        onRenderTabSet?: (
            tabSetNode: TabSetNode | BorderNode,
            renderValues: ITabSetRenderValues,
        ) => void;
        onShowOverflowMenu?: ShowOverflowMenuCallback;
        onTabSetPlaceHolder?: TabSetPlaceHolderCallback;
        realtimeResize?: boolean;
        renderTab: (node: TabNode) => ReactNode;
    }

    Hierarchy

    Index

    Properties

    classNameMapper?: (defaultClassName: string) => string

    function called with default css class name, return value is class name that will be used. Mainly for use with css modules.

    i18nMapper?: (id: I18nLabel, param?: string) => string | undefined

    function called for each I18nLabel to allow user translation, currently used for tab and tabset move messages, return undefined to use default values

    icons?: IIcons

    object mapping keys among close, maximize, restore, more to React nodes to use in place of the default icons, can alternatively return functions for creating the React nodes

    model: Model

    the model for this layout

    onAction?: (action: Action) => Action | undefined

    function called whenever the layout generates an action to update the model (allows for intercepting actions before they are dispatched to the model, for example, asking the user to confirm a tab close.) Returning undefined from the function will halt the action, otherwise return the action to continue

    onAuxMouseClick?: NodeMouseEvent

    callback for handling mouse clicks on tabs and tabsets with alt, meta, shift keys, also handles center mouse clicks

    onContextMenu?: NodeMouseEvent

    callback for handling context actions on tabs and tabsets

    onDragStateChange?: (isDragging: boolean) => void

    callback for when drag state changes, useful for OptimizedLayout to set pointer-events: none on external tab container during drag

    onExternalDrag?: (
        event: DragEvent<HTMLElement>,
    ) =>
        | {
            json: IJsonTabNode;
            onDrop?: (node?: Node, event?: DragEvent<HTMLElement>) => void;
        }
        | undefined

    function called when an external object (not a tab) gets dragged onto the layout, with a single dragenter argument. Should return either undefined to reject the drag/drop or an object with keys dragText, jsonDrop, to create a tab via drag (similar to a call to addTabToTabSet). Function onDropis passed the added tabNodeand thedrop DragEvent`, unless the drag was canceled.

    onModelChange?: (model: Model, action: Action) => void

    function called when model has changed

    onRenderDragRect?: DragRectRenderCallback

    callback for rendering the drag rectangles

    onRenderTab?: (node: TabNode, renderValues: ITabRenderValues) => void

    function called when rendering a tab, allows leading (icon), content section, buttons and name used in overflow menu to be customized

    onRenderTabSet?: (
        tabSetNode: TabSetNode | BorderNode,
        renderValues: ITabSetRenderValues,
    ) => void

    function called when rendering a tabset, allows header and buttons to be customized

    onShowOverflowMenu?: ShowOverflowMenuCallback

    callback for handling the display of the tab overflow menu

    onTabSetPlaceHolder?: TabSetPlaceHolderCallback

    callback for rendering a placeholder when a tabset is empty

    realtimeResize?: boolean

    boolean value, defaults to false, resize tabs as splitters are dragged. Warning: this can cause resizing to become choppy when tabs are slow to draw

    renderTab: (node: TabNode) => ReactNode

    Function to render tab content - receives TabNode, returns React element