import { Query, DataManager } from '@syncfusion/ej2-data'; import { IDataProcessor, IGrid, DataStateChangeEventArgs, PendingState } from '../base/interface'; import { PredicateModel } from '../base/grid-model'; import { ServiceLocator } from '../services/service-locator'; import { Column } from '../models/column'; /** * Grid data module is used to generate query and data source. * * @hidden */ export declare class Data implements IDataProcessor { dataManager: DataManager; /** @hidden */ isQueryInvokedFromData: boolean; /** @hidden */ pinnedData: DataManager; protected parent: IGrid; protected serviceLocator: ServiceLocator; protected dataState: PendingState; foreignKeyDataState: PendingState; /** @hidden Cached custom-binding records keyed by page number, e.g. `{ 1: [...], 2: [...] }`. */ customBindingCache: { [page: number]: Object[]; }; /** @hidden Total record count and aggregates that belong to the cached pages. */ customBindingMeta: { count?: number; aggregates?: Object; }; /** @hidden Responses that do not map to one page (lazy group expand, misaligned blocks), keyed by query state. */ customBindingBlocks: { [key: string]: Object; }; /** @hidden Insertion order of cached entries (`p:` or `b:`); the first item is evicted when the cache limit is exceeded. */ customBindingOrder: string[]; /** @hidden Page number of the custom-binding request currently awaiting a response. */ pendingCachePage: number; /** @hidden State signature of the non-page request currently awaiting a response. */ pendingCacheKey: string; /** * Constructor for data module. * * @param {IGrid} parent - specifies the IGrid * @param {ServiceLocator} serviceLocator - specifies the service locator * @hidden */ constructor(parent?: IGrid, serviceLocator?: ServiceLocator); private reorderRows; protected getModuleName(): string; /** * The function used to initialize dataManager and external query * * @returns {void} */ private initDataManager; /** * Generates a query based on the current grid configuration. * * @param {boolean} skipPage - If `true`, the query will exclude paging information. * @param {boolean} skipGroup - If `true`, the query will exclude grouping information. * * @returns {Query} A query object reflecting the current grid state. */ generateQuery(skipPage?: boolean, skipGroup?: boolean): Query; /** * @param {Query} query - specifies the query * @returns {Query} - returns the query * @hidden */ pinnedDataQuery(query: Query): Query; /** * @param {Query} query - specifies the query * @returns {Query} - returns the query * @hidden */ aggregateQuery(query: Query): Query; protected virtualGroupPageQuery(query: Query): Query; protected pageQuery(query: Query, skipPage?: boolean): Query; protected groupQuery(query: Query): Query; protected sortQuery(query: Query): Query; /** * @param {Query} query - specifies the query * @param {Column} fcolumn - specifies the forein key column model * @param {boolean} isForeignKey - Confirms whether the column is a foreign key or not * @returns {Query} - returns the query * @hidden */ searchQuery(query: Query, fcolumn?: Column, isForeignKey?: boolean): Query; protected filterQuery(query: Query, column?: PredicateModel[], skipFoerign?: boolean): Query; private fGeneratePredicate; /** * The function is used to get dataManager promise by executing given Query. * * @param {object} args - specifies the object * @param {string} args.requestType - Defines the request type * @param {string[]} args.foreignKeyData - Defines the foreignKeyData.string * @param {Object} args.data - Defines the data. * @param {number} args.index - Defines the index . * @param {Query} query - Defines the query which will execute along with data processing. * @returns {Promise} - returns the object * @hidden */ getData(args?: { requestType?: string; foreignKeyData?: string[]; data?: Object; index?: number; }, query?: Query): Promise; private insert; private executeQuery; private formatGroupColumn; private crudActions; /** * @param {object} changes - specifies the changes * @param {string} key - specifies the key * @param {object} original - specifies the original data * @param {Query} query - specifies the query * @returns {Promise} returns the object * @hidden */ saveChanges(changes: Object, key: string, original: Object, query?: Query): Promise; private getKey; /** * @returns {boolean} returns whether its remote data * @hidden */ isRemote(): boolean; /** * clears the cache * * @returns {void} * @hidden */ clearCache(): void; private resetCustomBindingCache; private addRows; private removeRows; private getColumnByField; protected destroy(): void; getState(): PendingState; setState(state: PendingState): Object; getForeignKeyDataState(): PendingState; setForeignKeyDataState(state: PendingState): void; getStateEventArgument(query: Query): PendingState; private eventPromise; /** * Gets the columns where searching needs to be performed from the Grid. * * @returns {string[]} returns the searched column field names */ private getSearchColumnFieldNames; private refreshFilteredCols; /** * Whether custom-binding page cache is enabled. * * @returns {boolean} returns true when page cache is enabled for a custom data source * @hidden */ isCustomBindingCacheEnabled(): boolean; private getCustomBindingCacheKey; /** * Stores a resolved custom-binding page. The initially bound page never raises * dataStateChange, so it is seeded here before the first paging request. * * @param {DataStateChangeEventArgs} state - Query state the page belongs to * @param {Object} data - Resolved `{ result, count }` page * @returns {void} * @hidden */ storeCustomBindingCache(state: DataStateChangeEventArgs, data: Object): void; /** * Stores the response the application assigned for the pending request. * * @param {Object} data - Resolved `{ result, count }` page * @returns {void} * @hidden */ storePendingCustomBindingCache(data: Object): void; private saveCustomBindingResponse; private getCustomBindingCache; /** * Page number for a plain page request: no lazy group info and `skip` is a whole multiple of `take`. * Sorting, filtering, searching and grouping clear the cache, so a page number is unique per query state. * * @param {DataStateChangeEventArgs} state - Query state * @returns {number} 1-based page number, or 0 when the request does not map to one page */ private getCustomBindingPage; private seedInitialCustomBindingCache; private isFilterChoiceRequest; private shouldInvalidateCustomBindingCache; private registerCacheEntry; /** * Removes the oldest cache objects until the count is within `cacheLimit`. * * @returns {void} * @hidden */ trimCache(): void; }