UNPKG

@eclipse-scout/core

Version:
147 lines 8.41 kB
import { Column, Event, ITableCustomizerDo, IUserFilterStateDo, ObjectWithType, PropertyChangeEvent, Table, TableClientUiPreferenceProfileDo, TableClientUiPreferencesDo, TableColumnClientUiPreferenceDo } from '../index'; /** * A singleton that represents all {@link Table}-specific UI preferences of the current user. It is populated during the start of the * application, so the preferences can be accessed synchronously. */ export declare class TableUiPreferences implements ObjectWithType { /** * Key for the current global preferences of a table, i.e. preferences that are not stored in a specific settings profile. */ static PROFILE_ID_GLOBAL: string; /** * Special key used to store table settings of a bookmarked table page. The bookmark support will consider this state as * the "factory settings" when the page is displayed in the bookmark outline. */ static PROFILE_ID_BOOKMARK: string; objectType: string; /** Map of all table preferences, indexed by table identifier (see {@link _computeTablePreferencesKey}). */ protected _tablePreferencesMap: Map<string, TableClientUiPreferencesDo>; /** If > 0, table events are ignored. Useful when applying preferences. */ protected _ignoreTableEventsCounter: number; protected _columResizeTimeoutId: number; protected _tableColumnListener: (event: Event<Table>) => void; protected _tableTileModeListener: (event: PropertyChangeEvent<boolean, Table>) => void; /** * Imports the given data into the internal structures, so individual table preferences can be read and * modified by the various methods on this class. Any existing data is replaced. * * @internal should only be called from the registered {@link UiPreferencesHandler}! */ _importTablePreferences(tablePreferences: TableClientUiPreferencesDo[]): void; /** * Exports the current state of the internal data structures as persistable table preferences. * * @internal should only be called from the registered {@link UiPreferencesHandler}! */ _exportTablePreferences(): TableClientUiPreferencesDo[]; /** * Returns the preferences for the given table. If no preferences are registered yet, a new empty * preferences data object is created and stored. */ protected _getOrCreateTablePreferences(table: Table): TableClientUiPreferencesDo; protected _computeTablePreferencesKey(tableId: string, userPreferenceContext: string): string; protected _scheduleStore(): void; /** * Installs or uninstalls UI preference support for the given table according to its {@link Table#uiPreferencesEnabled} flag. */ updateUiPreferencesEnabled(table: Table): void; /** * Installs a table listener for all preference-related changes and stores them in the {@link TableUiPreferences#PROFILE_ID_GLOBAL} profile for that table. */ protected _installTableListener(table: Table): void; /** * Uninstalls the listener installed by {@link _installTableListener}. */ protected _uninstallTableListener(table: Table): void; protected get _ignoreTableEvents(): boolean; protected set _ignoreTableEvents(applyingTablePreferences: boolean); protected _onTableColumnEvent(event: Event<Table>): void; protected _onTableTileModeChange(event: PropertyChangeEvent<boolean, Table>): void; /** * Returns the preferences for the given table, or `null` if no preferences are registered yet. */ get(table: Table): TableClientUiPreferencesDo; /** * Returns the profile with the given id from the given table preferences. If no such profile exists, `undefined` is returned. */ getProfile(prefs: TableClientUiPreferencesDo, profileId: string): TableClientUiPreferenceProfileDo; /** * Creates a new data object consisting of all profile-independent preferences for the given table, according to its current state. * * Note: the `tablePreferences` map is *not* set automatically. */ create(table: Table): TableClientUiPreferencesDo; /** * Creates a new data object consisting of all profile-dependent preferences for the given table, according to its current state. */ createProfile(table: Table, options?: CreateTablePreferenceProfileOptions): TableClientUiPreferenceProfileDo; /** * Creates a list of new data objects consisting of the preferences for each column of the given table, according to their current state. * The result is never `null`. Invisible columns are included, while `guiOnly` columns are ignored. */ createColumnPreferences(table: Table): TableColumnClientUiPreferenceDo[]; /** * Creates a list of new data objects consisting of the state of each {@link TableUserFilter} of the given table. * The result is never `null`. Only user filters with a registered {@link UserFilterStateMapper} are returned. */ createUserFilterStates(table: Table): IUserFilterStateDo[]; /** * If the table is customizable, returns the customizer data. Otherwise, `null` is returned. */ createCustomizerData(table: Table): ITableCustomizerDo; /** * Stores the given profile under the given profileId in the table preferences of the given table. */ storeProfile(table: Table, profileId: string, profile: TableClientUiPreferenceProfileDo): void; /** * Renames a table preference profile and stores it. */ renameProfile(table: Table, oldProfileId: string, newProfileId: string): void; /** * Removes the specified profile from the table preferences and stores it. */ removeProfile(table: Table, profileId: string): void; /** * Updates and stores the profile-independent table preferences to match the current state of the table. */ store(table: Table): void; protected _storeTableTileMode(table: Table, prefs: TableClientUiPreferencesDo): boolean; /** * Stores the current profile-dependent preferences of the given table in the {@link TableUiPreferences#PROFILE_ID_GLOBAL} profile. */ storeGlobalProfile(table: Table): void; /** * Removes the {@link TableUiPreferences#PROFILE_ID_GLOBAL} profile for the given table. */ clearGlobalProfile(table: Table): void; /** * Applies the given preferences to the given table, i.e. changes the table state to match the preferences. If a `profileId` is given * and the table preferences contain a profile with that id, it is applied as well. Otherwise, only profile-independent preferences * are applied. */ apply(table: Table, prefs: TableClientUiPreferencesDo, profileId?: string, options?: ApplyTablePreferencesOptions): void; /** * Applies the given preference profile to the given table, i.e. changes the table state to match the profile. */ applyProfile(table: Table, profile: TableClientUiPreferenceProfileDo, options?: ApplyTablePreferencesOptions): void; protected _applyTablePreferencesInternal(table: Table, prefs: TableClientUiPreferencesDo, options?: ApplyTablePreferencesOptions): void; protected _applyTablePreferenceProfileInternal(table: Table, profile: TableClientUiPreferenceProfileDo, options?: ApplyTablePreferencesOptions): void; protected _applyCustomizerData(table: Table, customizerData: ITableCustomizerDo, options?: ApplyTablePreferencesOptions): void; protected _applyColumnPreferences(table: Table, columnPreferences: TableColumnClientUiPreferenceDo[], options?: ApplyTablePreferencesOptions): void; protected _applyColumnPreferencesToColumn(column: Column<any>, columnPreferences: TableColumnClientUiPreferenceDo): void; protected _applyUserFilterStates(table: Table, userFilterStates: IUserFilterStateDo[], options?: ApplyTablePreferencesOptions): void; } export interface CreateTablePreferenceProfileOptions { /** * Specifies whether to include the state of user filters ({@link IUserFilterStateDo}) in the preference profile. Default is `false`. */ includeUserFilters: boolean; } export interface ApplyTablePreferencesOptions { /** * Specifies whether to apply user filter states from the preference profile to the table. Default is `false`. */ applyUserFilters?: boolean; } export declare const tableUiPreferences: TableUiPreferences; //# sourceMappingURL=TableUiPreferences.d.ts.map