import type { BasePubSubService, EventSubscription } from '@slickgrid-universal/event-pub-sub'; import { SlickEventHandler, type SlickDataView, type SlickGrid } from '../core/index.js'; import { ExtensionName, type ExtensionNameTypeString } from '../enums/index.js'; import type { Column, CurrentColumn, CurrentFilter, CurrentPagination, CurrentRowSelection, CurrentSorter, GridOption, GridState, TreeToggleStateChange } from '../interfaces/index.js'; import type { ExtensionService } from './extension.service.js'; import type { FilterService } from './filter.service.js'; import type { SharedService } from './shared.service.js'; import type { SortService } from './sort.service.js'; import type { TreeDataService } from './treeData.service.js'; export declare class GridStateService { protected readonly extensionService: ExtensionService; protected readonly filterService: FilterService; protected readonly pubSubService: BasePubSubService; protected readonly sharedService: SharedService; protected readonly sortService: SortService; protected readonly treeDataService: TreeDataService; readonly pluginName = "GridStateService"; protected _eventHandler: SlickEventHandler; protected _columns: Column[]; protected _grid: SlickGrid; protected _subscriptions: EventSubscription[]; protected _selectedRowIndexes: number[] | undefined; protected _selectedRowDataContextIds: Array | undefined; protected _wasRecheckedAfterPageChange: boolean; constructor(extensionService: ExtensionService, filterService: FilterService, pubSubService: BasePubSubService, sharedService: SharedService, sortService: SortService, treeDataService: TreeDataService); /** Getter of SlickGrid DataView object */ get _dataView(): SlickDataView; /** Getter for the Grid Options pulled through the Grid Object */ protected get _gridOptions(): GridOption; /** Getter of the selected data context object IDs */ get selectedRowDataContextIds(): Array | undefined; /** Setter of the selected data context object IDs */ set selectedRowDataContextIds(dataContextIds: Array | undefined); /** * Initialize the Service * @param grid */ init(grid: SlickGrid): void; /** Dispose of all the SlickGrid & PubSub subscriptions */ dispose(): void; /** * Dynamically change the arrangement/distribution of the columns Positions/Visibilities and optionally Widths. * For a column to have its visibly as hidden, it has to be part of the original list but excluded from the list provided as argument to be considered a hidden field. * If you are passing columns Width, then you probably don't want to trigger the autosizeColumns (2nd argument to False). * We could also resize the columns by their content but be aware that you can only trigger 1 type of resize at a time (either the 2nd argument or the 3rd last argument but not both at same time) * The resize by content could be called by the 3rd argument OR simply by enabling `enableAutoResizeColumnsByCellContent` but again this will only get executed when the 2nd argument is set to false. * @param {Array} definedColumns - defined columns * @param {Boolean} triggerAutoSizeColumns - True by default, do we also want to call the "autosizeColumns()" method to make the columns fit in the grid? * @param {Boolean} triggerColumnsFullResizeByContent - False by default, do we also want to call full columns resize by their content? */ changeColumnsArrangement(definedColumns: CurrentColumn[], triggerAutoSizeColumns?: boolean, triggerColumnsFullResizeByContent?: boolean): void; /** * Get the current grid state (filters/sorters/pagination), by default we'll return only the visible columns * but with the argument `includeHiddenColumns` set to true, we could instead return all columns including their "hidden" * @param {Boolean} [includeHiddenColumns=false] - should we include all columns including the hidden column and their "hidden" * @return grid state */ getCurrentGridState(includeHiddenColumns?: boolean): GridState; /** * Get the Columns (and their state: visibility/position) that are currently applied in the grid * @return {Array} current columns */ getColumns(): Column[]; /** * From an array of Grid Column Definitions, get the associated Current Columns. * @param {Array} gridColumns * @param {Boolean} [includeHiddenProps=false] - should we also include the "hidden" on all the columns? defaults to `false` * @returns {{Array} current columns */ getAssociatedCurrentColumns(gridColumns: Column[], includeHiddenProps?: boolean): CurrentColumn[]; /** * From an array of Grid State Columns (`CurrentColumn[]`), get the associated Grid Column Definitions * @param {Object} grid * @param {Array} currentColumns (e.g. Grid Preset) * @returns {Array} column definitions */ getAssociatedGridColumns(grid: SlickGrid, currentColumns: CurrentColumn[]): Column[]; /** * Get the Columns (and their states: visibility/position/width) that are currently applied in the grid * @param {Boolean} [includeHiddenColumns=false] - should we include all columns including the hidden column and their "hidden" * @return current columns */ getCurrentColumns(includeHiddenColumns?: boolean): CurrentColumn[]; /** * Get the Filters (and their state, columnId, searchTerm(s)) that are currently applied in the grid * @return current filters */ getCurrentFilters(): CurrentFilter[] | null; /** * Get the Grouping column IDs or null when there are no Grouping set * @returns current Grouping column IDs */ getCurrentGrouping(): string[] | null; /** * Get current Pagination (and its state, pageNumber, pageSize) that are currently applied in the grid * @return current pagination state */ getCurrentPagination(): CurrentPagination | null; /** * Get the current Row Selections (and its state, gridRowIndexes, dataContextIds, filteredDataContextIds) that are currently applied in the grid * @return current row selections */ getCurrentRowSelections(): CurrentRowSelection | null; /** * Get the current Sorters (and their state, columnId, direction) that are currently applied in the grid * @return current sorters */ getCurrentSorters(): CurrentSorter[] | null; /** * Get the current list of Tree Data item(s) that got toggled in the grid * @returns {Array} treeDataToggledItems - items that were toggled (array of `parentId` and `isCollapsed` flag) */ getCurrentTreeDataToggleState(): Omit | null; /** Check whether the row selection needs to be preserved */ needToPreserveRowSelection(): boolean; resetColumns(columns?: Column[]): void; /** * Reset the grid to its original (all) columns, that is to display the entire set of columns with their original positions & visibilities * @param {Boolean} triggerAutoSizeColumns - True by default, do we also want to call the "autosizeColumns()" method to make the columns fit in the grid? */ resetToOriginalColumns(triggerAutoSizeColumns?: boolean): void; /** if we use Row Selection or the Checkbox Selector, we need to reset any selection */ resetRowSelectionWhenRequired(): void; /** * Subscribe to all necessary SlickGrid or Service Events that deals with a Grid change, * when triggered, we will publish a Grid State Event with current Grid State */ subscribeToAllGridChanges(grid: SlickGrid): void; /** * Add certain column(s), when the feature is/are enabled, to an output column definitions array (by reference). * Basically some features (for example: Row Selection, Row Detail, Row Move) will be added as column(s) dynamically and internally by the lib, * we just ask the developer to enable the feature, via flags, and internally the lib will create the necessary column. * So specifically for these column(s) and feature(s), we need to re-add them internally when the user calls the `changeColumnsArrangement()` method. * @param {Array} dynamicAddonColumnByIndexPositionList - array of plugin columnId and columnIndexPosition that will be re-added (if it wasn't already found in the output array) dynamically * @param {Array} fullColumns - full column definitions array that includes every columns (including Row Selection, Row Detail, Row Move when enabled) * @param {Array} newArrangedColumns - output array that will be use to show in the UI (it could have less columns than fullColumnDefinitions array since user might hide some columns) */ protected addColumnDynamicWhenFeatureEnabled(dynamicAddonColumnByIndexPositionList: Array<{ columnId: string; columnIndexPosition: number; }>, fullColumns: Column[], newArrangedColumns: Column[]): void; /** * Bind a SlickGrid Extension Event to a Grid State change event * @param extension name * @param event name */ protected bindExtensionAddonEventToGridStateChange(extensionName: ExtensionName | ExtensionNameTypeString, eventName: string): void; /** * Bind a Grid Event (of Column changes) to a Grid State change event * @param event - event name * @param grid - SlickGrid object */ protected bindSlickGridColumnChangeEventToGridStateChange(eventName: string, grid: SlickGrid): void; /** * Bind a Grid Event (of grid option changes) to a Grid State change event, if we detect that any of the pinning (frozen) options changes then we'll trigger a Grid State change * @param grid - SlickGrid object */ protected bindSlickGridOnSetOptionsEventToGridStateChange(grid: SlickGrid): void; /** Check wether the grid has the Row Selection enabled */ protected hasRowSelectionEnabled(): boolean; } //# sourceMappingURL=gridState.service.d.ts.map