@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
214 lines (213 loc) • 8.84 kB
TypeScript
import { ThemeState } from '../AdaptableState/ThemeState';
import { ShortcutState } from '../AdaptableState/ShortcutState';
import { QuickSearchState } from '../AdaptableState/QuickSearchState';
import { LayoutState } from '../AdaptableState/LayoutState';
import { FormatColumnState } from '../AdaptableState/FormatColumnState';
import { ExportState } from '../AdaptableState/ExportState';
import { DashboardState } from '../AdaptableState/DashboardState';
import { CustomSortState } from '../AdaptableState/CustomSortState';
import { CalculatedColumnState } from '../AdaptableState/CalculatedColumnState';
import { AlertState } from '../AdaptableState/AlertState';
import { BaseState } from '../AdaptableState/BaseState';
import { PlusMinusState } from '../AdaptableState/PlusMinusState';
import { ApplicationState } from '../AdaptableState/ApplicationState';
import { AdaptablePersistentState, AdaptableState } from '../AdaptableState/AdaptableState';
import { FreeTextColumnState } from '../AdaptableState/FreeTextColumnState';
import { ToolPanelState } from '../AdaptableState/ToolPanelState';
import { AdaptableModule, AdaptableStateKey } from '../AdaptableState/Common/Types';
import { AdaptableSearchState, AdaptableSortState, ChartingState, FlashingCellState, InitialState, NamedQueryState, NoteState, PredefinedConfig, ScheduleState, StatusBarState, StyledColumnState } from '../types';
/**
* Range of functions to access Initial and Full Adaptable State
*/
export interface StateApi {
/**
* Changes key used for persisting AdaptableState into localStorage; optionally provides an initialState to load
* @param adaptableStateKey - key for persisting the AdaptableState into localStorage
* @param config.initialState - new initialState to load
* @param config.flushCurrentState - whether to flush(persist) the current state before loading the new initialState
* @param config.progressIndicatorLabel - label for the progress indicator
*
*/
setAdaptableStateKey(adaptableStateKey: string, config?: {
initialState?: InitialState;
flushCurrentState?: boolean;
progressIndicatorLabel?: string;
}): Promise<void>;
/**
* @deprecated use `getInitialState()` instead
*/
getPredefinedConfig(): PredefinedConfig | any;
/**
* Returns the Initial Adaptable State
*/
getInitialState(): InitialState | any;
/**
* @deprecated use `reloadInitialState()` instead
*/
reloadPredefinedConfig(newPredefinedConfig?: PredefinedConfig): void;
/**
* Reloads existing (or supplied) Initial State; clears persistent state by calling `StateOptions.clearState`
* @param newInitialState optional new InitialState to load
*/
reloadInitialState(newInitialState?: InitialState): void;
/**
* Copies all Adaptable state to clipboard
*/
copyAllStateToClipboard(): void;
/**
* Copies User State sections of Adaptable State to clipboard
*/
copyUserStateToClipboard(): void;
/**
* Loads supplied user state, replacing (NOT merging) existing User(persisted) State.
* @param state
*/
loadUserState(state: InitialState): void;
/**
* Retrieves ALL state which is currently stored by Adaptable (both persistent and transient/internal)
*/
getAllState(): AdaptableState;
/**
* Retrieves persisted state in AdapTable, i.e. state last stored with `StateOptions.persistState()` function
*/
getPersistedState(): AdaptablePersistentState;
/**
* Gets search-related sections of Adaptable State
*/
getAdaptableSearchState(): AdaptableSearchState;
/**
* Gets sort-related sections of Adaptable State
*/
getAdaptableSortState(): AdaptableSortState;
/**
* Retrieves a brief description of an AdapTable Module
* @param adaptableModule Adaptable Module to get description for
*/
getDescriptionForModule(adaptableModule: AdaptableModule): string;
/**
* Retrieves the help page for an AdapTable Module
* @param adaptableModule Adaptable Module to get help page for
*/
getHelpPageForModule(adaptableModule: AdaptableModule): string;
/**
* Returns given section of Adaptable State (as JSON or object)
* @param stateKey section of State to return
* @param returnJson whether to return section as JSON or object
*/
getUserStateByStateKey(stateKey: AdaptableStateKey, returnJson?: boolean): BaseState | string;
/**
* Adds '1' to current revision number of State element
* @param stateKey Adaptable State Key to update
*/
incrementUserStateRevision(stateKey: AdaptableStateKey): void;
/**
* Returns Alert section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getAlertState(returnJson?: boolean): AlertState;
/**
* Returns Application section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getApplicationState(returnJson?: boolean): ApplicationState;
/**
* Returns Calculated Column section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getCalculatedColumnState(returnJson?: boolean): CalculatedColumnState;
/**
* Returns Charting section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getChartingState(returnJson?: boolean): ChartingState;
/**
* Returns Note section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getNoteState(returnJson?: boolean): NoteState;
/**
* Returns Custom Sort section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getCustomSortState(returnJson?: boolean): CustomSortState;
/**
* Returns Dashboard section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getDashboardState(returnJson?: boolean): DashboardState;
/**
* Returns Export section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getExportState(returnJson?: boolean): ExportState;
/**
* Returns Flashing Cell section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getFlashingCellState(returnJson?: boolean): FlashingCellState;
/**
* Returns Format Column section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getFormatColumnState(returnJson?: boolean): FormatColumnState;
/**
* Returns FreeText Column section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getFreeTextColumnState(returnJson?: boolean): FreeTextColumnState;
/**
* Returns Layout section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getLayoutState(returnJson?: boolean): LayoutState;
/**
* Returns Plus Minus section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getPlusMinusState(returnJson?: boolean): PlusMinusState;
/**
* Returns Query section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getNamedQueryState(returnJson?: boolean): NamedQueryState;
/**
* Returns Quick Search section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getQuickSearchState(returnJson?: boolean): QuickSearchState;
/**
* Returns Schedule section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getScheduleState(returnJson?: boolean): ScheduleState;
/**
* Returns Shortcut section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getShortcutState(returnJson?: boolean): ShortcutState;
/**
* Returns StatusBar section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getStatusBarState(returnJson?: boolean): StatusBarState;
/**
* Returns StyledColumn section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getStyledColumnState(returnJson?: boolean): StyledColumnState;
/**
* Returns Theme section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getThemeState(returnJson?: boolean): ThemeState;
/**
* Returns Tool Panel section of Adaptable State
* @param returnJson return as JSON rather than object
*/
getToolPanelState(returnJson?: boolean): ToolPanelState;
/**
* Sent by each Module when it is Ready
* @param module Module which is Ready
*/
dispatchStateReadyAction(module: AdaptableModule): void;
}