/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Event } from 'vs/base/common/event'; /** * Interface for table data providers */ export interface IDisposableDataProvider extends Slick.DataProvider { /** * Disposes the data provider object */ dispose(): void; /** * Gets the rows of the giving range * @param startIndex Start index of the range * @param length Length of the rows to retrieve */ getRangeAsync(startIndex: number, length: number): Promise; /** * Gets unique values of all the cells in the given column * @param column the column information */ getColumnValues(column: Slick.Column): Promise; /** * Filters the data * @param columns columns to be filtered, the */ filter(columns?: Slick.Column[]): Promise; /** * Sorts the data * @param args sort arguments */ sort(args: Slick.OnSortEventArgs): Promise; /** * Event fired when the filters changed */ readonly onFilterStateChange: Event; /** * Event fired when the sorting is completed */ readonly onSortComplete: Event>; /** * Gets a boolean value indicating whether the data is current in memory */ readonly isDataInMemory: boolean; } /** * Check whether the object is an instance of IDisposableDataProvider */ export function instanceOfIDisposableDataProvider(obj: any): obj is IDisposableDataProvider { const provider = obj as IDisposableDataProvider; return obj && provider.dispose && provider.sort && provider.isDataInMemory !== undefined; }