@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
147 lines (146 loc) • 5.28 kB
TypeScript
import { AdaptableFrameworkComponent, AdaptableIcon } from '../../types';
import { AdaptableSettingsPanel } from '../AdaptableState/Common/Types';
import { BaseContext } from '../AdaptableState/Common/BaseContext';
import { CustomRenderContext } from '../agGrid/AdaptableFrameworkComponent';
import { WindowPosition, WindowSize } from '../AdaptableState/Common/Window';
/**
* Options for managing the AdapTable Settings Panel
*/
export interface SettingsPanelOptions {
/**
* Title for Settings Panel
*
* @defaultValue 'Settings Panel'
*/
title?: string;
/**
* Icon shown in top left of Settings Panel: Can be `ConfigurationIcon`, `ApplicationIcon` or custom Icon
* @defaultValue `ConfigurationIcon`
*/
icon?: 'ConfigurationIcon' | 'ApplicationIcon' | AdaptableIcon;
/**
* Whether to show Icons for each Module in the Setting Panel
* @defaultValue true
*/
showModuleIcons?: boolean;
/**
* Whether a Settings Panel button should always be displayed in `ModuleButtons` area of Dashboard
* @defaultValue false
* @noCodeItem
*/
alwaysShowInDashboard?: boolean;
/**
* Whether a Settings Panel button should always be displayed in `ModuleButtons` area of ToolPanel
* @defaultValue false
* @noCodeItem
*/
alwaysShowInToolPanel?: boolean;
/**
* Configure grouped navigation for the Settings Panel; use SettingsPanelNavigationConfigurer but backwards compatibility via the deprecated LegacyFlatSettingsPanelNavigation is supported
*
* @defaultValue all available AdapTable modules in the default grouped order */
navigation?: SettingsPanelNavigationConfigurer | LegacyFlatSettingsPanelNavigation;
/**
* Initial position of Settings Panel — pixel offset of top-left corner from top-left of viewport (requires `popupType` to be `'window'`)
*
* @defaultValue Middle of Screen
*/
position?: WindowPosition;
/**
* Initial size (in pixels) of Settings Panel (requires `popupType` to be `'window'`)
*
* @defaultValue Computed based on size of screen
*/
size?: WindowSize;
/**
* How the Settings Panel is rendered: `'modal'` (centred and unmovable and resizable) or `'window'` (supports size, position, drag and resize)
*
* @defaultValue 'modal'
*/
popupType?: PopupType;
/**
* Custom Settings Panels provided by developers at design-time
*/
customSettingsPanels?: CustomSettingsPanel[];
/**
* Which Tabs can be used to display Grid Info: 'Grid Options', 'Grid Summary' or 'Grid State'
*
* @defaultValue ['Grid Options', 'Grid Summary', 'Grid State']
*/
gridInfoTabs?: GridInfoTabs;
}
/**
* A labelled group of Settings Panel navigation entries.
*/
export interface SettingsPanelNavigationGroup {
/**
* Section heading shown above the group. Use an empty string to show items without a heading.
*/
label: string;
/**
* Module names or custom panel names in display order.
*/
items: (AdaptableSettingsPanel | string)[];
}
/**
* Grouped Settings Panel navigation structure.
*/
export interface SettingsPanelNavigation {
groups: SettingsPanelNavigationGroup[];
}
/**
* Context passed to `SettingsPanelOptions.navigation`.
*/
export interface SettingsPanelNavigationContext extends BaseContext {
}
/**
* Function used to customise Settings Panel navigation.
*/
export type SettingsPanelNavigationConfigurer = (context: SettingsPanelNavigationContext, defaultNavigation: SettingsPanelNavigation) => SettingsPanelNavigation;
/**
* Legacy (v22) flat Settings Panel navigation shape.
*
* Items are listed in a single ordered array, with the literal string `'-'` acting as a
* group separator. Internally converted to the grouped {@link SettingsPanelNavigation}
* shape — each chunk between separators becomes a group with no heading.
*
* @deprecated Provide a {@link SettingsPanelNavigationConfigurer} function instead. Will be
* removed in the next major release.
*/
export interface LegacyFlatSettingsPanelNavigation {
items?: (AdaptableSettingsPanel | string | '-')[];
}
/**
* Definition of a Custom Panel to add to the Adaptable Settings Panel
*/
export interface CustomSettingsPanel {
/**
* Appears in Settings Panel Navigation. Include in `navigation` to choose placement
* (by default added to a `Custom Panels` group at the end).
*/
name: string;
/**
* Icon rendered inside settings-panel name, inside the navigation
*/
icon?: AdaptableIcon;
/**
* Function to provide bespoke content when NOT using a Framework wrapper
*/
render?: (customRenderContext: CustomRenderContext) => string | null;
/**
* Framework-specific (Angular, React or Vue) component to be rendered
*/
frameworkComponent?: AdaptableFrameworkComponent;
}
/**
* Type of Popup
*/
export type PopupType = 'modal' | 'window';
/**
* List of Editors that can be used when creating the Grid Filter
*/
export type GridInfoTabs = GridInfoTab[];
/**
* Tab to use for Grid Info: 'Grid Options', 'Grid Summary' or 'Grid State'
*/
export type GridInfoTab = 'Grid Options' | 'Grid Summary' | 'Grid State';