igniteui-angular
Version:
Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps
185 lines (184 loc) • 6.49 kB
TypeScript
import { ViewContainerRef, EnvironmentInjector, Injector } from '@angular/core';
import { IFilteringExpressionsTree } from '../data-operations/filtering-expressions-tree';
import { IPagingState } from '../data-operations/paging-state.interface';
import { GridColumnDataType } from '../data-operations/data-util';
import { IGroupingState } from '../data-operations/groupby-state.interface';
import { GridSelectionRange } from './common/types';
import { ISortingExpression } from '../data-operations/sorting-strategy';
import { GridType, IPinningConfig } from './common/grid.interface';
import { IPivotConfiguration } from './pivot-grid/pivot-grid.interface';
import * as i0 from "@angular/core";
export interface IGridState {
columns?: IColumnState[];
filtering?: IFilteringExpressionsTree;
advancedFiltering?: IFilteringExpressionsTree;
paging?: IPagingState;
moving?: boolean;
sorting?: ISortingExpression[];
groupBy?: IGroupingState;
cellSelection?: GridSelectionRange[];
rowSelection?: any[];
columnSelection?: string[];
rowPinning?: any[];
pinningConfig?: IPinningConfig;
expansion?: any[];
rowIslands?: IGridStateCollection[];
id?: string;
pivotConfiguration?: IPivotConfiguration;
}
export interface IGridStateCollection {
id: string;
parentRowID: any;
state: IGridState;
}
export interface IGridStateOptions {
columns?: boolean;
filtering?: boolean;
advancedFiltering?: boolean;
sorting?: boolean;
groupBy?: boolean;
paging?: boolean;
cellSelection?: boolean;
rowSelection?: boolean;
columnSelection?: boolean;
rowPinning?: boolean;
pinningConfig?: boolean;
expansion?: boolean;
rowIslands?: boolean;
moving?: boolean;
pivotConfiguration?: boolean;
}
export interface IColumnState {
pinned: boolean;
sortable: boolean;
filterable: boolean;
editable: boolean;
sortingIgnoreCase: boolean;
filteringIgnoreCase: boolean;
headerClasses: string;
headerGroupClasses: string;
maxWidth: string;
groupable: boolean;
hidden: boolean;
dataType: GridColumnDataType;
hasSummary: boolean;
field: string;
width: any;
header: string;
resizable: boolean;
searchable: boolean;
columnGroup: boolean;
columnLayout?: boolean;
rowStart?: number;
rowEnd?: number;
colStart?: number;
colEnd?: number;
/**
* @deprecated
*/
parent?: any;
key: string;
parentKey: string;
disableHiding: boolean;
disablePinning: boolean;
collapsible?: boolean;
expanded?: boolean;
visibleWhenCollapsed?: boolean;
}
export type GridFeatures = keyof IGridStateOptions;
export declare class IgxGridStateBaseDirective {
grid: GridType;
protected viewRef: ViewContainerRef;
protected envInjector: EnvironmentInjector;
protected injector: Injector;
private featureKeys;
private state;
private currGrid;
protected _options: IGridStateOptions;
private FEATURES;
/**
* An object with options determining if a certain feature state should be saved.
* ```html
* <igx-grid [igxGridState]="options"></igx-grid>
* ```
* ```typescript
* public options = {selection: false, advancedFiltering: false};
* ```
*/
get options(): IGridStateOptions;
set options(value: IGridStateOptions);
/**
* @hidden
*/
constructor(grid: GridType, viewRef: ViewContainerRef, envInjector: EnvironmentInjector, injector: Injector);
/**
* Gets the state of a feature or states of all grid features, unless a certain feature is disabled through the `options` property.
*
* @param `serialize` determines whether the returned object will be serialized to JSON string. Default value is true.
* @param `feature` string or array of strings determining the features to be added in the state. If skipped, all features are added.
* @returns Returns the serialized to JSON string IGridState object, or the non-serialized IGridState object.
* ```html
* <igx-grid [igxGridState]="options"></igx-grid>
* ```
* ```typescript
* @ViewChild(IgxGridStateDirective, { static: true }) public state;
* let state = this.state.getState(); // returns string
* let state = this.state(false) // returns `IGridState` object
* ```
*/
protected getStateInternal(serialize?: boolean, features?: GridFeatures | GridFeatures[]): IGridState | string;
/**
* Restores grid features' state based on the IGridState object passed as an argument.
*
* @param IGridState object to restore state from.
* @returns
* ```html
* <igx-grid [igxGridState]="options"></igx-grid>
* ```
* ```typescript
* @ViewChild(IgxGridStateDirective, { static: true }) public state;
* this.state.setState(gridState);
* ```
*/
protected setStateInternal(state: IGridState, features?: GridFeatures | GridFeatures[]): void;
/**
* Builds an IGridState object.
*/
private buildState;
/**
* The method that calls corresponding methods to restore features from the passed IGridState object.
*/
private restoreGridState;
private restoreFeatures;
/**
* Returns a collection of all grid features.
*/
private applyFeatures;
/**
* This method restores complex objects in the pivot dimensions
* Like the IgxPivotDateDimension and filters.
*/
private restoreDimensions;
/**
* This method restores the IgxPivotDateDimension with its default functions and resource strings.
*/
private restoreDateDimension;
/**
* Returns if this is a IgxPivotDateDimension.
*/
private isDateDimension;
/**
* This method restores complex objects in the pivot values.
* Like the default aggregator methods.
*/
private restoreValues;
/**
* This method builds a rehydrated IExpressionTree from a provided object.
*/
private createExpressionsTreeFromObject;
protected stringifyCallback(key: string, val: any): any;
private getColumnGroupKey;
private getFeature;
static ɵfac: i0.ɵɵFactoryDeclaration<IgxGridStateBaseDirective, [{ optional: true; host: true; }, null, null, null]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<IgxGridStateBaseDirective, never, never, { "options": { "alias": "options"; "required": false; }; }, {}, never, never, true, never>;
}