ag-grid-enterprise
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
70 lines (69 loc) • 2.58 kB
TypeScript
import type { _VerticalDirection } from 'ag-grid-community';
interface RichSelectAsyncValuesPageParams {
search: string;
startRow: number;
endRow: number;
cursor?: string | null;
}
interface RichSelectAsyncValuesPageResult<TValue> {
values: TValue[];
lastRow?: number;
cursor?: string | null;
}
interface RichSelectAsyncHost<TValue> {
setValueList: (params: {
valueList: TValue[] | Promise<TValue[] | undefined> | undefined;
refresh?: boolean;
isInitial?: boolean;
scrollToCurrentValue?: boolean;
prependedRowCount?: number;
}) => void;
setIsLoading: () => void;
}
interface RichSelectAsyncRequestsFeatureParams<TValue> {
host: RichSelectAsyncHost<TValue>;
source: RichSelectAsyncValuesSource<TValue>;
onMisconfiguredSearchSource?: () => void;
onFirstValuesPageLoaded: () => void;
}
export interface RichSelectAsyncValuesSource<TValue> {
searchValues?: (searchString: string) => TValue[] | Promise<TValue[]>;
loadValuesPage?: (params: RichSelectAsyncValuesPageParams) => RichSelectAsyncValuesPageResult<TValue> | Promise<RichSelectAsyncValuesPageResult<TValue>>;
valuesPageInitialStartRow?: (searchString: string) => number;
valuesPageSize?: number;
}
export declare function createRichSelectAsyncRequestBindings<TValue>(params: {
host: RichSelectAsyncHost<TValue>;
source: RichSelectAsyncValuesSource<TValue>;
useAsyncSearch?: boolean;
onMisconfiguredSearchSource?: () => void;
onFirstValuesPageLoaded?: () => void;
}): {
controller: RichSelectAsyncRequestsFeature<TValue>;
hasPagedSource: boolean;
onSearch?: (searchString: string) => void;
onLoadMoreRows?: (direction?: _VerticalDirection) => void;
};
export declare class RichSelectAsyncRequestsFeature<TValue = any> {
private readonly ctrlParams;
private currentSearchRequest;
private currentValuesPageRequest;
private valuesPageLoading;
private valuesPageHasMoreNext;
private valuesPageHasMorePrev;
private valuesPageLoadedValues;
private valuesPageSearch;
private valuesPageWindowStartRow;
private valuesPageNextCursor;
private destroyed;
constructor(ctrlParams: RichSelectAsyncRequestsFeatureParams<TValue>);
destroy(): void;
onSearch(searchString: string): void;
resetValuesPage(searchString: string): void;
loadValuesPage(direction: _VerticalDirection): void;
private applyValuesPageResult;
private handleValuesPageError;
private resolveValuesPageStartRow;
private isValuesPaged;
}
export {};