UNPKG

@eclipse-scout/core

Version:
60 lines 3.07 kB
/// <reference types="jquery" /> import { InitModelOf, LookupCall, LookupResult, LookupRow, StaticLookupCallModel } from '../index'; /** * Base class for lookup calls with static or local data. Implement the _data() and _dataToLookupRow() * functions to provide data for lookup calls. Results are resolved as a Promise, the delay * property controls how long it takes until the promise is resolved. You can set it to a higher value for testing purposes. */ export declare class StaticLookupCall<TKey> extends LookupCall<TKey> implements StaticLookupCallModel<TKey> { model: StaticLookupCallModel<TKey>; delay: number; data: any[]; protected _deferred: JQuery.Deferred<LookupResult<TKey>>; constructor(); protected _init(model: InitModelOf<this>): void; refreshData(data?: any[]): void; abort(): void; protected _getAll(): JQuery.Promise<LookupResult<TKey>>; protected _queryByAll(): void; /** * Limits the data to 'maxRowCount' results, converts the data to LookupRows and filters * the rows by their 'active' state. If a subclass overrides this method it can omit the * super call, if it must avoid the maxRowCount limit and does its own filtering. In that * case the subclass may choose to call <code>#_mapAndFilterData</code> and * <code>#_limitMaxRows</code> when suitable. */ protected _lookupRowsByAll(): LookupRow<TKey>[]; protected _limitMaxRows(array: any[]): any[]; protected _mapAndFilterData(datas: any[]): LookupRow<TKey>[]; protected _filterActiveLookupRow(dataRow: LookupRow<TKey>): boolean; protected _getByText(text: string): JQuery.Promise<LookupResult<TKey>>; protected _queryByText(text: string): void; protected _lookupRowsByText(text: string): LookupRow<TKey>[]; _createSearchPattern(text: string): RegExp; protected _getByKey(key: TKey): JQuery.Promise<LookupResult<TKey>>; protected _queryByKey(key: TKey): void; protected _getByKeys(keys: TKey[]): JQuery.Promise<LookupResult<TKey>>; protected _queryByKeys(keys: TKey[]): void; protected _lookupRowByKey(key: TKey): LookupRow<TKey>; protected _getByRec(rec: TKey): JQuery.Promise<LookupResult<TKey>>; protected _queryByRec(rec: TKey): void; protected _lookupRowsByRec(rec: TKey): LookupRow<TKey>[]; setDelay(delay: number): void; /** * Implement this function to convert a single data array into an instance of LookupRow. */ protected _dataToLookupRow(data: any[], index?: number): LookupRow<TKey>; /** * Implement this function to provide static data. * * The result is expected to be a list of tuples. Each tuple will be converted to a lookup row via * {@link _dataToLookupRow}. The first three elements of each tuple have a predefined meaning and * are used by the lookup call (e.g. to filter rows by text). More elements can be added freely. * * - [0] = key * - [1] = text * - [2] = parentKey */ protected _data(): any[]; } //# sourceMappingURL=StaticLookupCall.d.ts.map