-
Notifications
You must be signed in to change notification settings - Fork 8
/
SearchProperty.ts
40 lines (32 loc) · 1005 Bytes
/
SearchProperty.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {SearchPropertyType} from './SearchPropertyType';
import {IValueProvider} from '../dao/IValueProvider';
/**
* Represents a query search property.
* @module SearchProperty
*/
export class SearchProperty {
/** the search property ID */
public id: string;
/** a descriptive name for the property */
public name: string;
/** whether the property is sortable */
public orderBy: boolean;
/** the property type */
public type: SearchPropertyType;
/** the values if any */
public values: any;
/** The value provider */
private valueProvider: IValueProvider;
constructor(valueProvider: IValueProvider) {
this.valueProvider = valueProvider;
}
/**
* Hook to gather all the values for this property.
*
* @param options Some additional options, to for example restrict the values or limit the query.
* @returns {Promise<any>}
*/
public async findValues(options: any): Promise<any> {
return this.valueProvider.findValues(this.id, options);
}
}