@adaptabletools/adaptable
Version: 
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
100 lines (99 loc) • 3.1 kB
TypeScript
import { AdaptableButton } from '../AdaptableState/Common/AdaptableButton';
import { AdaptableObject } from '../AdaptableState/Common/AdaptableObject';
import { DashboardState } from '../AdaptableState/DashboardState';
import { BaseContext, CustomRenderContext } from '../types';
import { AdaptableFrameworkComponent } from '../agGrid/AdaptableFrameworkComponent';
/**
 * Options related to the Dashboard in Adaptable.
 */
export interface DashboardOptions {
    /**
     * Whether the Dashboard can be floated; if true (the default), double-clicking Dashboard puts it in float mode
     *
     * @defaultValue true
     * @gridInfoItem
     * @noCodeItem
     */
    canFloat?: boolean;
    /**
     * Shows Quick Search textbox in the Dashboard Header
     *
     * @defaultValue true
     * @gridInfoItem
     * @noCodeItem
     */
    showQuickSearchInHeader?: boolean;
    /**
     * Custom Adaptable Buttons to appear in Dashboard (alongside Module Buttons)
     */
    customDashboardButtons?: AdaptableButton<DashboardButtonContext>[];
    /**
     * Toolbars provided by Users which contain custom content
     */
    customToolbars?: CustomToolbar[];
    /**
     * Where in Dashboard to display Module and Custom Buttons
     * @defaultValue 'right'
     * @noCodeItem
     */
    buttonsLocation?: DashboardButtonsLocation;
}
/**
 * Custom Toolbar (which AdapTable will manage) enabling devs to populate Dashboard with bepoke content
 */
export interface CustomToolbar extends AdaptableObject {
    /**
     * How Toolbar is referenced (e.g. in Dashboard Popup when managing toolbars)
     */
    name: string;
    /**
     * Title to display in Toolbar; if unset or empty string, nothing will show
     */
    title?: string;
    /**
     * Actions available in a Custom Dashboard Toolbar
     */
    toolbarActions?: ToolbarActions;
    /**
     * Optional set of buttons to show in the Toolbar
     */
    toolbarButtons?: AdaptableButton<CustomToolbarButtonContext>[];
    /**
     * Function to provide custom content when NOT using a Framework wrapper
     */
    render?: (customRenderContext: CustomRenderContext) => string | null;
    /**
     * The Framework-specific (Angular, React or Vue) component to be rendered
     */
    frameworkComponent?: AdaptableFrameworkComponent;
}
/**
 * Context required by functions when using a Dashboard Button
 */
export interface DashboardButtonContext extends BaseContext {
    /**
     * Current Dashboard State
     */
    dashboardState: DashboardState;
}
/**
 * Context required by functions when using a Custom Toolbar Button
 */
export interface CustomToolbarButtonContext extends DashboardButtonContext {
    /**
     * Custom Toolbar which hosts the Button
     */
    customToolbar: CustomToolbar;
}
/**
 * Where Dashboard Buttons are displayed
 */
export type DashboardButtonsLocation = 'left' | 'right';
/**
 * List of Actions available in Custom Toolbar
 */
export type ToolbarActions = ToolbarAction[];
/**
 * Action available in Custom Toolbar - Close or Configure
 */
export type ToolbarAction = 'close' | 'configure';