@adaptabletools/adaptable
Version: 
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
112 lines (111 loc) • 3.64 kB
TypeScript
import { AlertDefinition } from '../AdaptableState/AlertState';
import { CustomSort } from '../AdaptableState/CustomSortState';
import { FlashingCellDefinition } from '../AdaptableState/FlashingCellState';
import { FormatColumn } from '../AdaptableState/FormatColumnState';
import { PlusMinusNudge } from '../AdaptableState/PlusMinusState';
import { Shortcut } from '../AdaptableState/ShortcutState';
import { StyledColumn } from '../AdaptableState/StyledColumnState';
import { BaseSchedule } from '../AdaptableState/Common/Schedule';
import { Layout } from '../AdaptableState/LayoutState';
import { AdaptableModule } from '../AdaptableState/Common/Types';
import { AdaptableObjectTag } from '../AdaptableState/Common/AdaptableObject';
import { BaseContext } from '../../types';
/**
 * Options for configuring Layouts; these manage Column visibility, order, sorting, grouping, width etc.
 *
 */
export interface LayoutOptions {
    /**
     * Set of options for how Layouts are displayed in Settings Panel
     */
    layoutViewOptions?: LayoutViewOptions;
    /**
     * Set of options for leveraging Object Tags to extend Layouts
     */
    layoutTagOptions?: LayoutTagOptions;
    /**
     * Columns to display in Table that opens when viewing Pivot Cell contents
     */
    pivotPreviewColumns?: string[] | ((context: PivotPreviewColumnsContext) => string[]);
}
/**
 * Options for managing Tags in Layouts (used to enhance Layouts)
 */
export interface LayoutTagOptions {
    /**
     * Automatically generate an AdaptableObjectTag for each Layout
     *
     * @defaultValue false
     */
    autoGenerateTagsForLayouts?: boolean | ((context: AutoGenerateTagsForLayoutsContext) => AdaptableObjectTag[]);
    /**
     * Automatically assumes that any `LayoutAssociatedObject` is available in the current Layout if it has a tag with the Layouts name (or no tags at all)
     *
     * @defaultValue false
     */
    autoCheckTagsForLayouts?: boolean;
    /**
     * Checks if the provided Adaptable Object is available in the given Layout
     *
     * @defaultValue undefined
     */
    isObjectAvailableInLayout?: (layoutAvailableContext: LayoutAvailableContext) => boolean;
}
/**
 * Customize how Layouts are displayed in Settings Panel
 */
export interface LayoutViewOptions {
    /**
     * How many Column Names to display in inline Layout preview
     *
     * @defaultValue 10
     */
    maxColumnsToDisplay?: number;
}
/**
 * Context for `LayoutOptions.isObjectAvailableInLayout` functions
 */
export interface LayoutAvailableContext extends BaseContext {
    /**
     * Object being checked
     */
    adaptableObject: LayoutAssociatedObject;
    /**
     * Current Adaptable Module
     */
    module: AdaptableModule;
    /**
     * Current Layout
     */
    layout: Layout;
}
/**
 * Types of Adaptable Objects that can be associated with a Layout
 */
export type LayoutAssociatedObject = AlertDefinition | CustomSort | FlashingCellDefinition | FormatColumn | PlusMinusNudge | StyledColumn | Shortcut | BaseSchedule;
/**
 * Context for `LayoutOptions.autoGenerateTagsForLayouts` method
 */
export interface AutoGenerateTagsForLayoutsContext extends BaseContext {
    /**
     * Layouts currently in Adaptable State
     */
    layouts: Layout[];
    /**
     * Object Tags provided in User Interface Options
     */
    objectTags: AdaptableObjectTag[];
}
/**
 * Context uses for pivotPreviewColumns function in Layout Options
 */
export interface PivotPreviewColumnsContext extends BaseContext {
    /**
     * Current Layout
     */
    layout: Layout;
    /**
     * Column being opened
     */
    columnId: string;
}