office-ui-fabric-react
Version: 
Reusable React components for building experiences for Office 365.
58 lines (57 loc) • 2.46 kB
TypeScript
/// <reference types="react" />
import { BaseComponent } from '../../Utilities';
import { IResizeGroupProps } from './ResizeGroup.types';
export interface IResizeGroupState {
    /**
     * Final data used to render proper sized component
    */
    renderedData?: any;
    /**
     * Data to render in a hidden div for measurement
     */
    dataToMeasure?: any;
    /**
     * Set to true when the content container might have new dimensions and should
     * be remeasured.
     */
    measureContainer?: boolean;
    /**
     * Are we resizing to accommodate having more or less available space?
     * The 'grow' direction is when the container may have more room than the last render,
     * such as when a window resize occurs. This means we will try to fit more content in the window.
     * The 'shrink' direction is when the contents don't fit in the container and we need
     * to find a transformation of the data that makes everything fit.
     */
    resizeDirection?: 'grow' | 'shrink';
}
/**
 * Returns a simple object is able to store measurements with a given key.
 */
export declare const getMeasurementCache: () => {
    getCachedMeasurement: (data: any) => number | undefined;
    addMeasurementToCache: (data: any, measurement: number) => void;
};
/**
 * Returns a function that is able to compute the next state for the ResizeGroup given the current
 * state and any measurement updates.
 */
export declare const getNextResizeGroupStateProvider: (measurementCache?: {
    getCachedMeasurement: (data: any) => number | undefined;
    addMeasurementToCache: (data: any, measurement: number) => void;
}) => {
    getNextState: (props: IResizeGroupProps, currentState: IResizeGroupState, getElementToMeasureWidth: () => number, newContainerWidth?: number | undefined) => IResizeGroupState | undefined;
    shouldRenderDataToMeasureInHiddenDiv: (dataToMeasure: any) => boolean;
};
export declare class ResizeGroupBase extends BaseComponent<IResizeGroupProps, IResizeGroupState> {
    private _nextResizeGroupStateProvider;
    private _root;
    private _measured;
    constructor(props: IResizeGroupProps);
    render(): JSX.Element;
    componentDidMount(): void;
    componentWillReceiveProps(nextProps: IResizeGroupProps): void;
    componentDidUpdate(prevProps: IResizeGroupProps): void;
    remeasure(): void;
    private _afterComponentRendered();
    private _onResize();
}