UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

130 lines (129 loc) 4.1 kB
import { Layout, PivotLayout, TableLayout } from '../AdaptableState/LayoutState'; import { AdaptableObjectTag } from '../AdaptableState/Common/AdaptableObject'; import { BaseContext, LayoutExtensionModule, LayoutExtensionObject } from '../../types'; /** * Options for configuring Layouts; 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[]); /** * Default properties to apply when creating a new Layout (Table or Pivot) */ layoutCreationDefaultProperties?: LayoutCreationDefaultProperties | ((context: LayoutCreationDefaultPropertiesContext) => TableLayoutCreationDefaultProperties | PivotLayoutCreationDefaultProperties); } /** * 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 `LayoutExtensionObject` 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 provided Adaptable Object is extended in given Layout */ isObjectExtendedInLayout?: (layoutExtendedContext: LayoutExtendedContext) => 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.isObjectExtendedInLayout` function */ export interface LayoutExtendedContext extends BaseContext { /** * Object being checked */ adaptableObject: LayoutExtensionObject; /** * Current Adaptable Module */ module: LayoutExtensionModule; /** * Current Layout */ layout: Layout; } /** * 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; } /** * Default properties to apply when creating a new Table Layout */ export type TableLayoutCreationDefaultProperties = Partial<Omit<TableLayout, 'Name'>>; /** * Default properties to apply when creating a new Pivot Layout */ export type PivotLayoutCreationDefaultProperties = Partial<Omit<PivotLayout, 'Name'>>; /** * Default properties to apply when creating a new Layout (Table or Pivot) */ export interface LayoutCreationDefaultProperties { /** * Default properties to apply when creating a new Table Layout */ tableLayout?: TableLayoutCreationDefaultProperties; /** * Default properties to apply when creating a new Pivot Layout */ pivotLayout?: PivotLayoutCreationDefaultProperties; } /** * Context for `LayoutOptions.layoutCreationDefaultProperties` function */ export interface LayoutCreationDefaultPropertiesContext extends BaseContext { /** * Type of Layout ('table' | 'pivot') */ layoutType: 'table' | 'pivot'; }