##// END OF EJS Templates
added type parameter to dojo.store.api.SortInformation,...
cin -
r20:1c7650c17856 v1.0.8 default
parent child
Show More
@@ -46,7 +46,7 declare namespace dijit {
46 46 /* dijit/form/_AutoCompleterMixin */
47 47
48 48 /* tslint:disable:class-name */
49 interface _AutoCompleterMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _SearchMixin<T, Q, O> {
49 interface _AutoCompleterMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>> extends _SearchMixin<T, Q, O> {
50 50 /**
51 51 * This is the item returned by the dojo/store/api/Store implementation that
52 52 * provides the data for this ComboBox, it's the currently selected item.
@@ -250,7 +250,7 declare namespace dijit {
250 250 /**
251 251 * Fills in the items in the drop down list
252 252 */
253 createOptions(results: T[], options: dojo.store.api.QueryOptions, labelFunc: (item: T) => { html: boolean; label: string; }): void;
253 createOptions(results: T[], options: dojo.store.api.QueryOptions<T>, labelFunc: (item: T) => { html: boolean; label: string; }): void;
254 254
255 255 /**
256 256 * Clears the entries in the drop down list, but of course keeps the previous and next buttons.
@@ -470,7 +470,7 declare namespace dijit {
470 470 disabled?: boolean;
471 471 }
472 472
473 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _FormValueWidget {
473 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>> extends _FormValueWidget {
474 474 /**
475 475 * Whether or not we are multi-valued
476 476 */
@@ -869,7 +869,7 declare namespace dijit {
869 869
870 870 /* dijit/form/_SearchMixin */
871 871
872 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> {
872 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>> {
873 873 /**
874 874 * Argument to data provider.
875 875 * Specifies maximum number of search results to return per query
@@ -1170,18 +1170,18 declare namespace dijit {
1170 1170
1171 1171 /* dijit/form/ComboBox */
1172 1172
1173 interface ComboBox<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1173 interface ComboBox<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>, C extends Constraints = Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1174 1174 // set(name: string, value: any): this;
1175 1175 // set(values: Object): this;
1176 1176 }
1177 1177
1178 1178 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any>> {
1179 new <T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1179 new <T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>, C extends Constraints = Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1180 1180 }
1181 1181
1182 1182 /* dijit/form/ComboBoxMixin */
1183 1183
1184 interface ComboBoxMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1184 interface ComboBoxMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1185 1185
1186 1186 /**
1187 1187 * Dropdown widget class used to select a date/time.
@@ -1315,7 +1315,7 declare namespace dijit {
1315 1315
1316 1316 /* dijit/form/FilteringSelect */
1317 1317
1318 interface FilteringSelect<C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions> extends MappedTextBox<C>, ComboBoxMixin<T, Q, O> {
1318 interface FilteringSelect<C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions<T>> extends MappedTextBox<C>, ComboBoxMixin<T, Q, O> {
1319 1319 /**
1320 1320 * True (default) if user is required to enter a value into this field.
1321 1321 */
@@ -1341,7 +1341,7 declare namespace dijit {
1341 1341 }
1342 1342
1343 1343 interface FilteringSelectConstructor extends _WidgetBaseConstructor<FilteringSelect<any, any, any, any>> {
1344 new <C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions>(params: Object, srcNodeRef: dojo.NodeOrString): FilteringSelect<C, T, Q, O>;
1344 new <C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions<T>>(params: Object, srcNodeRef: dojo.NodeOrString): FilteringSelect<C, T, Q, O>;
1345 1345 }
1346 1346
1347 1347 /* dijit/form/Form */
@@ -1691,7 +1691,7 declare namespace dijit {
1691 1691
1692 1692 /* dijit/form/Select */
1693 1693
1694 interface Select<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, U extends dijit._WidgetBase> extends _FormSelectWidget<T, Q, O>, _HasDropDown<U>, _KeyNavMixin {
1694 interface Select<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T>, U extends dijit._WidgetBase> extends _FormSelectWidget<T, Q, O>, _HasDropDown<U>, _KeyNavMixin {
1695 1695 baseClass: string;
1696 1696
1697 1697 /**
@@ -332,7 +332,7 declare module 'dijit/form/DropDownButto
332 332 }
333 333
334 334 declare module 'dijit/form/FilteringSelect' {
335 type FilteringSelect<C extends dijit.form.Constraints = dijit.form.Constraints, T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> = dijit.form.FilteringSelect<C, T, Q, O>;
335 type FilteringSelect<C extends dijit.form.Constraints = dijit.form.Constraints, T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions<T> = dojo.store.api.QueryOptions<T>> = dijit.form.FilteringSelect<C, T, Q, O>;
336 336 const FilteringSelect: dijit.form.FilteringSelectConstructor;
337 337 export = FilteringSelect;
338 338 }
@@ -9,12 +9,12 declare namespace dojo {
9 9
10 10 /* dojo/store/api/Store */
11 11
12 interface SortInformation {
12 interface SortInformation<K extends string | number | symbol = string> {
13 13
14 14 /**
15 15 * The name of the attribute to sort on.
16 16 */
17 attribute: string;
17 attribute: K;
18 18
19 19 /**
20 20 * The direction of the sort. Default is false.
@@ -22,7 +22,9 declare namespace dojo {
22 22 descending?: boolean;
23 23 }
24 24
25 interface QueryOptions {
25 type SortFn<T> = (left: T, right: T) => number;
26
27 interface QueryOptions<T = unknown> {
26 28 /**
27 29 * A list of attributes to sort on, as well as direction
28 30 * For example:
@@ -30,7 +32,7 declare namespace dojo {
30 32 * If the sort parameter is omitted, then the natural order of the store may be
31 33 * applied if there is a natural order.
32 34 */
33 sort?: SortInformation[];
35 sort?: SortFn<T> | SortInformation<keyof T>[];
34 36
35 37 /**
36 38 * The first result to begin iteration on
@@ -51,7 +53,7 declare namespace dojo {
51 53 type BaseQueryType = string | object | ((...params: unknown[]) => boolean);
52 54
53 55 interface QueryEngine<T extends object, Q extends BaseQueryType> {
54 <O extends QueryOptions>(query: Q, options?: O): QueryEngineFunction<T>;
56 <O extends QueryOptions<T>>(query: Q, options?: O): QueryEngineFunction<T>;
55 57 }
56 58
57 59 interface PutDirectives<T extends object> {
@@ -173,7 +175,7 declare namespace dojo {
173 175 interface Queryable<
174 176 T extends object,
175 177 Q extends BaseQueryType,
176 O extends QueryOptions,
178 O extends QueryOptions<T>,
177 179 R extends QueryResults<T> = QueryResults<T>> {
178 180
179 181 /**
@@ -183,7 +185,7 declare namespace dojo {
183 185 query(query?: Q, options?: O): R;
184 186 }
185 187
186 interface SyncStore<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions = QueryOptions>
188 interface SyncStore<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions<T> = QueryOptions<T>>
187 189 extends IdentityProvider<T>, Queryable<T, Q, O, SyncQueryResults<T>> {
188 190
189 191 /**
@@ -223,7 +225,7 declare namespace dojo {
223 225
224 226 }
225 227
226 interface AsyncStore<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions = QueryOptions>
228 interface AsyncStore<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions<T> = QueryOptions<T>>
227 229 extends IdentityProvider<T>, Queryable<T, Q, O, AsyncQueryResults<T>> {
228 230
229 231 /**
@@ -263,7 +265,7 declare namespace dojo {
263 265
264 266 }
265 267
266 interface HierarchicalStore<T extends object, O extends QueryOptions = QueryOptions, R extends QueryResults<T> = QueryResults<T>> {
268 interface HierarchicalStore<T extends object, O extends QueryOptions<T> = QueryOptions<T>, R extends QueryResults<T> = QueryResults<T>> {
267 269
268 270 /**
269 271 * Retrieves the children of an object.
@@ -271,7 +273,7 declare namespace dojo {
271 273 getChildren(parent: T, options?: O): R;
272 274 }
273 275
274 interface Store<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions = QueryOptions>
276 interface Store<T extends object, Q extends BaseQueryType = Partial<T> | ((item: T) => boolean) | string, O extends QueryOptions<T> = QueryOptions<T>>
275 277 extends IdentityProvider<T>, Queryable<T, Q, O> {
276 278
277 279 /**
@@ -370,11 +372,11 declare namespace dojo {
370 372
371 373 interface DataStoreOptions<T extends object> {
372 374 idProperty?: keyof T;
373 queryEngine?: api.QueryEngine<T, api.QueryOptions>;
375 queryEngine?: api.QueryEngine<T, api.QueryOptions<T>>;
374 376 store?: data.api.Read<T> | data.api.Write<T> | data.api.Identity<T>;
375 377 }
376 378
377 interface DataStore<T extends object> extends api.Store<T, api.BaseQueryType, api.QueryOptions> {
379 interface DataStore<T extends object> extends api.Store<T, api.BaseQueryType, api.QueryOptions<T>> {
378 380 /**
379 381 * The object store to convert to a data store
380 382 */
@@ -406,7 +408,7 declare namespace dojo {
406 408 timeout?: number
407 409 }
408 410
409 interface JsonRestQueryOptions extends api.QueryOptions {
411 interface JsonRestQueryOptions<T = unknown> extends api.QueryOptions<T> {
410 412 headers?: Headers;
411 413
412 414 timeout?: number;
@@ -414,7 +416,7 declare namespace dojo {
414 416
415 417 interface JsonRestOptions<T extends object> {
416 418 idProperty?: keyof T;
417 queryEngine?: api.QueryEngine<T, JsonRestQueryOptions>;
419 queryEngine?: api.QueryEngine<T, JsonRestQueryOptions<T>>;
418 420 headers?: Headers;
419 421 target?: string;
420 422 rangeParam?: string;
@@ -427,7 +429,7 declare namespace dojo {
427 429 interface JsonRest<
428 430 T extends object,
429 431 Q extends api.BaseQueryType = (Partial<T> | string) & api.BaseQueryType,
430 O extends JsonRestQueryOptions = JsonRestQueryOptions>
432 O extends JsonRestQueryOptions<T> = JsonRestQueryOptions<T>>
431 433 extends api.AsyncStore<T, Q, O> {
432 434 /**
433 435 * Additional headers to pass in all requests to the server. These can be overridden
@@ -509,7 +511,7 declare namespace dojo {
509 511 interface MemoryOptions<T extends object> {
510 512 data?: T[];
511 513 idProperty?: keyof T;
512 queryEngine?: api.QueryEngine<T, api.QueryOptions>;
514 queryEngine?: api.QueryEngine<T, api.QueryOptions<T>>;
513 515 setData?: (data: T[]) => void;
514 516 }
515 517
@@ -551,7 +553,7 declare namespace dojo {
551 553
552 554 type ObservableQueryResults<T extends object> = ObservableQueryResultsMixin<T> & api.QueryResults<T>;
553 555
554 interface ObservableMixin<T extends object, Q extends api.BaseQueryType, O extends api.QueryOptions, R extends api.QueryResults<T> = api.QueryResults<T> > {
556 interface ObservableMixin<T extends object, Q extends api.BaseQueryType, O extends api.QueryOptions<T>, R extends api.QueryResults<T> = api.QueryResults<T> > {
555 557 notify(object: T, existingId?: api.Identity): void;
556 558
557 559 /**
@@ -19,7 +19,8 const mem = new Memory<Schedule>();
19 19 observable.query().observe(() => { });
20 20 store.query().forEach(() => { });
21 21 const total = await store.query().total;
22 const result = await store.query();
22 const res1 = await store.query(undefined, { sort: [{ attribute: "duration", descending: true }] });
23 const res2 = await store.query(undefined, { sort: ({ duration: a }, { duration: b }) => a - b });
23 24
24 25 mem.query();
25 26
General Comments 0
You need to be logged in to leave comments. Login now