forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devextreme.d.ts
7383 lines (7380 loc) · 372 KB
/
devextreme.d.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for DevExtreme 15.2.5
// Project: http://js.devexpress.com/
// Definitions by: DevExpress Inc. <http://devexpress.com/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare module DevExpress {
/** A mixin that provides a capability to fire and subscribe to events. */
export interface EventsMixin<T> {
/** Subscribes to a specified event. */
on(eventName: string, eventHandler: Function): T;
/** Subscribes to the specified events. */
on(events: { [eventName: string]: Function; }): T;
/** Detaches all event handlers from the specified event. */
off(eventName: string): Object;
/** Detaches a particular event handler from the specified event. */
off(eventName: string, eventHandler: Function): T;
}
/** An object that serves as a namespace for the methods required to perform validation. */
export module validationEngine {
export interface IValidator {
validate(): ValidatorValidationResult;
reset(): void;
}
export interface ValidatorValidationResult {
isValid: boolean;
name?: string;
value: any;
brokenRule: any;
validationRules: any[];
}
export interface ValidationGroupValidationResult {
isValid: boolean;
brokenRules: any[];
validators: IValidator[];
}
export interface GroupConfig extends EventsMixin<GroupConfig> {
group: any;
validators: IValidator[];
validate(): ValidationGroupValidationResult;
reset(): void;
}
/** Provides access to the object that represents the specified validation group. */
export function getGroupConfig(group: any): GroupConfig
/** Provides access to the object that represents the default validation group. */
export function getGroupConfig(): GroupConfig
/** Validates rules of the validators that belong to the specified validation group. */
export function validateGroup(group: any): ValidationGroupValidationResult;
/** Validates rules of the validators that belong to the default validation group. */
export function validateGroup(): ValidationGroupValidationResult;
/** Resets the values and validation result of the editors that belong to the specified validation group. */
export function resetGroup(group: any): void;
/** Resets the values and validation result of the editors that belong to the default validation group. */
export function resetGroup(): void;
/** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */
export function validateModel(model: Object): ValidationGroupValidationResult;
/** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */
export function registerModelForValidation(model: Object) : void;
}
export var hardwareBackButton: JQueryCallback;
/** Processes the hardware back button click. */
export function processHardwareBackButton(): void;
/** Hides the last displayed overlay widget. */
export function hideTopOverlay(): boolean;
/** Specifies whether or not the entire application/site supports right-to-left representation. */
export var rtlEnabled: boolean;
/** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */
export function registerComponent(name: string, componentClass: Object): void;
/** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */
export function registerComponent(name: string, namespace: Object, componentClass: Object): void;
export function requestAnimationFrame(callback: Function): number;
export function cancelAnimationFrame(requestID: number): void;
/** Custom Knockout binding that links an HTML element with a specific action. */
export class Action { }
/** Used to get URLs that vary in a locally running application and the application running on production. */
export class EndpointSelector {
constructor(options: {
[key: string]: {
local?: string;
production?: string;
}
});
/** Returns a local or a productional URL depending on how the application is currently running. */
urlFor(key: string): string;
}
/** An object that serves as a namespace for the methods that are used to animate UI elements. */
export module fx {
/** Defines animation options. */
export interface AnimationOptions {
/** A function called after animation is completed. */
complete?: (element: JQuery, config: AnimationOptions) => void;
/** A number specifying wait time before animation execution. */
delay?: number;
/** A number specifying the time period to wait before the animation of the next stagger item starts. */
staggerDelay?: number;
/** A number specifying the time in milliseconds spent on animation. */
duration?: number;
/** A string specifying the type of an easing function used for animation. */
easing?: string;
/** Specifies the initial animation state. */
from?: any;
/** A function called before animation is started. */
start?: (element: JQuery, config: AnimationOptions) => void;
/** Specifies a final animation state. */
to?: any;
/** A string value specifying the animation type. */
type?: string;
/** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */
direction?: string;
}
/** Animates the specified element. */
export function animate(element: HTMLElement, config: AnimationOptions): Object;
/** Returns a value indicating whether the specified element is being animated. */
export function isAnimating(element: HTMLElement): boolean;
/** Stops the animation. */
export function stop(element: HTMLElement, jumpToEnd: boolean): void;
}
/** The manager that performs several specified animations at a time. */
export class TransitionExecutor {
/** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */
reset(): void;
/** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */
enter(elements: JQuery, animation: any): void;
/** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */
leave(elements: JQuery, animation: any): void;
/** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */
start(config: Object): JQueryPromise<void>;
/** Stops all started animations. */
stop(): void;
}
export class AnimationPresetCollection {
/** Resets all the changes made in the animation repository. */
resetToDefaults(): void;
/** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */
clear(name: string): void;
/** Adds the specified animation preset to the animation repository by the specified name. */
registerPreset(name: string, config: any): void;
/** Applies the changes made in the animation repository. */
applyChanges(): void;
/** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */
getPreset(name: string): void;
/** Registers predefined animations in the animation repository. */
registerDefaultPresets(): void;
}
/** A repository of animations. */
export var animationPresets: AnimationPresetCollection;
/** The device object defines the device on which the application is running. */
export interface Device {
/** Indicates whether or not the device platform is Android. */
android?: boolean;
/** Specifies the type of the device on which the application is running. */
deviceType?: string;
/** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */
generic?: boolean;
/** Indicates whether or not the device platform is iOS. */
ios?: boolean;
/** Indicates whether or not the device type is 'phone'. */
phone?: boolean;
/** Specifies the platform of the device on which the application is running. */
platform?: string;
/** Indicates whether or not the device type is 'tablet'. */
tablet?: boolean;
/** Specifies an array with the major and minor versions of the device platform. */
version?: Array<number>;
/** Indicates whether or not the device platform is Windows. */
win?: boolean;
/** Specifies a performance grade of the current device. */
grade?: string;
}
export class Devices implements EventsMixin<Devices> {
constructor(options: { window: Window });
/** Overrides actual device information to force the application to operate as if it was running on the specified device. */
current(deviceName: any): void;
/** Returns information about the current device. */
current(): Device;
orientationChanged: JQueryCallback;
/** Returns the current device orientation. */
orientation(): string;
/** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */
real(): Device;
on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices;
on(eventName: string, eventHandler: Function): Devices;
on(events: { [eventName: string]: Function; }): Devices;
off(eventName: "orientationChanged"): Devices;
off(eventName: string): Devices;
off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices;
off(eventName: string, eventHandler: Function): Devices;
}
/** An object that serves as a namespace for the methods and events specifying information on the current device. */
export var devices: Devices;
/** The position object specifies the widget positioning options. */
export interface PositionOptions {
/** The target element position that the widget is positioned against. */
at?: string;
/** The element within which the widget is positioned. */
boundary?: Element;
/** A string value holding horizontal and vertical offset from the window's boundaries. */
boundaryOffset?: string;
/** Specifies how to move the widget if it overflows the screen. */
collision?: any;
/** The position of the widget to align against the target element. */
my?: string;
/** The target element that the widget is positioned against. */
of?: HTMLElement;
/** A string value holding horizontal and vertical offset in pixels, separated by a space (e.g., "5 -10"). */
offset?: string;
}
export interface ComponentOptions {
/** A handler for the initialized event. */
onInitialized?: Function;
/** A handler for the optionChanged event. */
onOptionChanged?: Function;
/** A handler for the disposing event. */
onDisposing?: Function;
}
/** A base class for all components and widgets. */
export class Component {
constructor(options?: ComponentOptions)
/** Prevents the component from refreshing until the endUpdate method is called. */
beginUpdate(): void;
/** Enables the component to refresh after the beginUpdate method call. */
endUpdate(): void;
/** Returns an instance of this component class. */
instance(): Component;
/** Returns the configuration options of this component. */
option(): {
[optionKey: string]: any;
};
/** Sets one or more options of this component. */
option(options: {
[optionKey: string]: any;
}): void;
/** Gets the value of the specified configuration option of this component. */
option(optionName: string): any;
/** Sets a value to the specified configuration option of this component. */
option(optionName: string, optionValue: any): void;
}
export interface DOMComponentOptions extends ComponentOptions {
/** Specifies whether or not the current component supports a right-to-left representation. */
rtlEnabled?: boolean;
/** Specifies the height of the widget. */
height?: any;
/** Specifies the width of the widget. */
width?: any;
}
/** A base class for all components. */
export class DOMComponent extends Component {
constructor(element: JQuery, options?: DOMComponentOptions);
constructor(element: HTMLElement, options?: DOMComponentOptions);
/** Returns the root HTML element of the widget. */
element(): JQuery;
/** Specifies the device-dependent default configuration options for this component. */
static defaultOptions(rule: {
device?: any;
options?: any;
}): void;
}
export module data {
export interface ODataError extends Error {
httpStatus?: number;
errorDetails?: any;
}
export interface StoreOptions {
/** A handler for the modified event. */
onModified?: () => void;
/** A handler for the modifying event. */
onModifying?: () => void;
/** A handler for the removed event. */
onRemoved?: (key: any) => void;
/** A handler for the removing event. */
onRemoving?: (key: any) => void;
/** A handler for the updated event. */
onUpdated?: (key: any, values: Object) => void;
/** A handler for the updating event. */
onUpdating?: (key: any, values: Object) => void;
/** A handler for the loaded event. */
onLoaded?: (result: Array<any>) => void;
/** A handler for the loading event. */
onLoading?: (loadOptions: LoadOptions) => void;
/** A handler for the inserted event. */
onInserted?: (values: Object, key: any) => void;
/** A handler for the inserting event. */
onInserting?: (values: Object) => void;
/** Specifies the function called when the Store causes an error. */
errorHandler?: (e: Error) => void;
/** Specifies the key properties within the data associated with the Store. */
key?: any;
}
export interface LoadOptions {
filter?: Object;
sort?: Object;
select?: Object;
expand?: Object;
group?: Object;
skip?: number;
take?: number;
userData?: Object;
requireTotalCount?: boolean;
}
/** The base class for all Stores. */
export class Store implements EventsMixin<Store> {
constructor(options?: StoreOptions);
/** Returns the data item specified by the key. */
byKey(key: any): JQueryPromise<any>;
/** Adds an item to the data associated with this Store. */
insert(values: Object): JQueryPromise<any>;
/** Returns the key expression specified via the key configuration option. */
key(): any;
/** Returns the key of the Store item that matches the specified object. */
keyOf(obj: Object): any;
/** Starts loading data. */
load(obj?: LoadOptions): JQueryPromise<any[]>;
/** Removes the data item specified by the key. */
remove(key: any): JQueryPromise<any>;
/** Obtains the total count of items that will be returned by the load() function. */
totalCount(options?: {
filter?: Object;
group?: Object;
}): JQueryPromise<any>;
/** Updates the data item specified by the key. */
update(key: any, values: Object): JQueryPromise<any>;
on(eventName: "removing", eventHandler: (key: any) => void): Store;
on(eventName: "removed", eventHandler: (key: any) => void): Store;
on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store;
on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store;
on(eventName: "inserting", eventHandler: (values: Object) => void): Store;
on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store;
on(eventName: "modifying", eventHandler: () => void): Store;
on(eventName: "modified", eventHandler: () => void): Store;
on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store;
on(eventName: "loaded", eventHandler: (result: Array<any>) => void): Store;
on(eventName: string, eventHandler: Function): Store;
on(events: { [eventName: string]: Function; }): Store;
off(eventName: "removing"): Store;
off(eventName: "removed"): Store;
off(eventName: "updating"): Store;
off(eventName: "updated"): Store;
off(eventName: "inserting"): Store;
off(eventName: "inserted"): Store;
off(eventName: "modifying"): Store;
off(eventName: "modified"): Store;
off(eventName: "loading"): Store;
off(eventName: "loaded"): Store;
off(eventName: string): Store;
off(eventName: "removing", eventHandler: (key: any) => void): Store;
off(eventName: "removed", eventHandler: (key: any) => void): Store;
off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store;
off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store;
off(eventName: "inserting", eventHandler: (values: Object) => void): Store;
off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store;
off(eventName: "modifying", eventHandler: () => void): Store;
off(eventName: "modified", eventHandler: () => void): Store;
off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store;
off(eventName: "loaded", eventHandler: (result: Array<any>) => void): Store;
off(eventName: string, eventHandler: Function): Store;
}
export interface ArrayStoreOptions extends StoreOptions {
/** Specifies the array associated with this Store. */
data?: Array<any>;
}
/** A Store accessing an in-memory array. */
export class ArrayStore extends Store {
constructor(options?: ArrayStoreOptions);
/** Clears all data associated with the current ArrayStore. */
clear(): void;
/** Creates the Query object for the underlying array. */
createQuery(): Query;
}
interface Promise {
then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise;
}
export interface CustomStoreOptions extends StoreOptions {
/** The user implementation of the byKey(key, extraOptions) method. */
byKey?: (key: any) => Promise;
/** The user implementation of the insert(values) method. */
insert?: (values: Object) => Promise;
/** The user implementation of the load(options) method. */
load?: (options?: LoadOptions) => Promise;
/** The user implementation of the remove(key) method. */
remove?: (key: any) => Promise;
/** The user implementation of the totalCount(options) method. */
totalCount?: (options?: {
filter?: Object;
group?: Object;
}) => Promise;
/** The user implementation of the update(key, values) method. */
update?: (key: any, values: Object) => Promise;
}
/** A Store object that enables you to implement your own data access logic. */
export class CustomStore extends Store {
constructor(options: CustomStoreOptions);
}
export interface DataSourceOptions {
/** Specifies data filtering conditions. */
filter?: Object;
/** Specifies data grouping conditions. */
group?: Object;
/** The item mapping function. */
map?: (record: any) => any;
/** Specifies the maximum number of items the page can contain. */
pageSize?: number;
/** Specifies whether a DataSource loads data by pages, or all items at once. */
paginate?: boolean;
/** The data post processing function. */
postProcess?: (data: any[]) => any[];
/** Specifies a value by which the required items are searched. */
searchExpr?: Object;
/** Specifies the comparison operation used to search for the required items. */
searchOperation?: string;
/** Specifies the value to which the search expression is compared. */
searchValue?: Object;
/** Specifies the initial select option value. */
select?: Object;
/** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */
expand?: Object;
/** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */
requireTotalCount?: boolean;
/** Specifies the initial sort option value. */
sort?: Object;
/** Specifies the underlying Store instance used to access data. */
store?: any;
/** A handler for the changed event. */
onChanged?: () => void;
/** A handler for the loadingChanged event. */
onLoadingChanged?: (isLoading: boolean) => void;
/** A handler for the loadError event. */
onLoadError?: (e?: Error) => void;
}
/** An object that provides access to a data web service or local data storage for collection container widgets. */
export class DataSource implements EventsMixin<DataSource> {
constructor(url: string);
constructor(data: Array<any>);
constructor(options: CustomStoreOptions);
constructor(options: DataSourceOptions);
/** Disposes all resources associated with this DataSource. */
dispose(): void;
/** Returns the current filter option value. */
filter(): Object;
/** Sets the filter option value. */
filter(filterExpr: Object): void;
/** Returns the current group option value. */
group(): Object;
/** Sets the group option value. */
group(groupExpr: Object): void;
/** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */
isLastPage(): boolean;
/** Indicates whether or not at least one load() method execution has successfully finished. */
isLoaded(): boolean;
/** Indicates whether or not the DataSource is currently being loaded. */
isLoading(): boolean;
/** Returns the array of items currently operated by the DataSource. */
items(): Array<any>;
/** Returns the key expression. */
key(): any;
/** Starts loading data. */
load(): JQueryPromise<Array<any>>;
/** Clears currently loaded DataSource items and calls the load() method. */
reload(): JQueryPromise<Array<any>>;
/** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */
loadOptions(): Object;
/** Returns the current pageSize option value. */
pageSize(): number;
/** Sets the pageSize option value. */
pageSize(value: number): void;
/** Specifies the index of the currently loaded page. */
pageIndex(): number;
/** Specifies the index of the page to be loaded during the next load() method execution. */
pageIndex(newIndex: number): void;
/** Returns the current paginate option value. */
paginate(): boolean;
/** Sets the paginate option value. */
paginate(value: boolean): void;
/** Returns the searchExpr option value. */
searchExpr(): Object;
/** Sets the searchExpr option value. */
searchExpr(expr: Object): void;
/** Returns the currently specified search operation. */
searchOperation(): string;
/** Sets the current search operation. */
searchOperation(op: string): void;
/** Returns the searchValue option value. */
searchValue(): Object;
/** Sets the searchValue option value. */
searchValue(value: Object): void;
/** Returns the current select option value. */
select(): Object;
/** Sets the select option value. */
select(expr: Object): void;
/** Returns the current requireTotalCount option value. */
requireTotalCount(): boolean;
/** Sets the requireTotalCount option value. */
requireTotalCount(value: boolean): void;
/** Returns the current sort option value. */
sort(): Object;
/** Sets the sort option value. */
sort(sortExpr: Object): void;
/** Returns the underlying Store instance. */
store(): Store;
/** Returns the number of data items available in an underlying Store after the last load() operation without paging. */
totalCount(): number;
on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource;
on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource;
on(eventName: "changed", eventHandler: () => void): DataSource;
on(eventName: string, eventHandler: Function): DataSource;
on(events: { [eventName: string]: Function; }): DataSource;
off(eventName: "loadingChanged"): DataSource;
off(eventName: "loadError"): DataSource;
off(eventName: "changed"): DataSource;
off(eventName: string): DataSource;
off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource;
off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource;
off(eventName: "changed", eventHandler: () => void): DataSource;
off(eventName: string, eventHandler: Function): DataSource;
}
/** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */
export class EdmLiteral {
/** Creates an EdmLiteral instance and assigns the specified value to it. */
constructor(value: string);
/** Returns a string representation of the value associated with this EdmLiteral object. */
valueOf(): string;
}
/** An object used to generate and hold the GUID. */
export class Guid {
/** Creates a new Guid instance that holds the specified GUID. */
constructor(value: string);
/** Creates a new Guid instance holding the generated GUID. */
constructor();
/** Returns a string representation of the Guid instance. */
toString(): string;
/** Returns a string representation of the Guid instance. */
valueOf(): string;
}
export interface LocalStoreOptions extends ArrayStoreOptions {
/** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */
flushInterval?: number;
/** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */
immediate?: boolean;
/** The unique identifier used to distinguish the data within the HTML5 Web Storage. */
name?: string;
}
/** A Store providing access to the HTML5 Web Storage. */
export class LocalStore extends ArrayStore {
constructor(options?: LocalStoreOptions);
/** Removes all data associated with this Store. */
clear(): void;
}
export interface ODataContextOptions extends ODataStoreOptions {
/** Specifies the list of entities to be accessed via the ODataContext. */
entities?: Object;
/** Specifies the function called if the ODataContext causes an error. */
errorHandler?: (e: Error) => void;
}
/** Provides access to the entire OData service. */
export class ODataContext {
constructor(options?: ODataContextOptions);
/** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */
get(operationName: string, params: Object): JQueryPromise<any>;
/** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */
invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise<any>;
/** Return a special proxy object to describe the entity link. */
objectLink(entityAlias: string, key: any): Object;
}
export interface ODataStoreOptions extends StoreOptions {
/** A function used to customize a web request before it is sent. */
beforeSend?: (request: {
url: string;
async: boolean;
method: string;
timeout: number;
params: Object;
payload: Object;
headers: Object;
}) => void;
/** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */
jsonp?: boolean;
/** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */
keyType?: any;
/** Specifies whether or not dates found in the response are deserialized. */
deserializeDates?: boolean;
/** Specifies the URL of the data service being accessed via the current ODataContext. */
url?: string;
/** Specifies the version of the OData protocol used to interact with the data service. */
version?: number;
/** Specifies the value of the withCredentials field of the underlying jqXHR object. */
withCredentials?: boolean;
}
/** A Store providing access to a separate OData web service entity. */
export class ODataStore extends Store {
constructor(options?: ODataStoreOptions);
/** Creates the Query object for the OData endpoint. */
createQuery(loadOptions: Object): Object;
/** Returns the data item specified by the key. */
byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise<any>;
}
/** An universal chainable data query interface object. */
export interface Query {
/** Calculates a custom summary for the items in the current Query. */
aggregate(step: (accumulator: any, value: any) => any): JQueryPromise<any>;
/** Calculates a custom summary for the items in the current Query. */
aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise<any>;
/** Calculates the average item value for the current Query. */
avg(getter: Object): JQueryPromise<any>;
/** Finds the item with the maximum getter value. */
max(getter: Object): JQueryPromise<any>;
/** Finds the item with the maximum value in the Query. */
max(): JQueryPromise<any>;
/** Finds the item with the minimum value in the Query. */
min(): JQueryPromise<any>;
/** Finds the item with the minimum getter value. */
min(getter: Object): JQueryPromise<any>;
/** Calculates the average item value for the current Query, if each Query item has a numeric type. */
avg(): JQueryPromise<any>;
/** Returns the total count of items in the current Query. */
count(): JQueryPromise<any>;
/** Executes the Query. */
enumerate(): JQueryPromise<any>;
/** Filters the current Query data. */
filter(criteria: Array<any>): Query;
/** Filters the current Query data. */
filter(predicate: (item: any) => boolean): Query;
/** Groups the current Query data. */
groupBy(getter: Object): Query;
/** Applies the specified transformation to each item. */
select(getter: Object): Query;
/** Limits the data item count. */
slice(skip: number, take?: number): Query;
/** Sorts current Query data. */
sortBy(getter: Object, desc: boolean): Query;
/** Sorts current Query data. */
sortBy(getter: Object): Query;
/** Calculates the sum of item getter values in the current Query. */
sum(getter: Object): JQueryPromise<any>;
/** Calculates the sum of item values in the current Query. */
sum(): JQueryPromise<any>;
/** Adds one more sorting condition to the current Query. */
thenBy(getter: Object): Query;
/** Adds one more sorting condition to the current Query. */
thenBy(getter: Object, desc: boolean): Query;
/** Returns the array of current Query items. */
toArray(): Array<any>;
}
/** The global data layer error handler. */
export var errorHandler: (e: Error) => void;
/** Encodes the specified string or array of bytes to base64 encoding. */
export function base64_encode(input: any): string;
/** Creates a Query instance. */
export function query(array: Array<any>): Query;
/** Creates a Query instance for accessing the remote service specified by a URL. */
export function query(url: string, queryOptions: Object): Query;
/** This section describes the utility objects provided by the DevExtreme data layer. */
export var utils: {
/** Compiles a getter function from the getter expression. */
compileGetter(expr: any): Function;
/** Compiles a setter function from the setter expression. */
compileSetter(expr: any): Function;
odata: {
/** Holds key value converters for OData. */
keyConverters: {
String(value: any): string;
Int32(value: any): number;
Int64(value: any): EdmLiteral;
Guid(value: any): Guid;
Boolean(value: any): boolean;
Single(value: any): EdmLiteral;
Decimal(value: any): EdmLiteral;
};
}
}
}
/** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */
export module ui {
export interface WidgetOptions extends DOMComponentOptions {
/** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */
activeStateEnabled?: boolean;
/** A Boolean value specifying whether or not the widget can respond to user interaction. */
disabled?: boolean;
/** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */
hoverStateEnabled?: boolean;
/** Specifies whether or not the widget can be focused. */
focusStateEnabled?: boolean;
/** Specifies a shortcut key that sets focus on the widget element. */
accessKey?: string;
/** A Boolean value specifying whether or not the widget is visible. */
visible?: boolean;
/** Specifies the widget tab index. */
tabIndex?: number;
/** Specifies the text of the hint displayed for the widget. */
hint?: string;
}
/** The base class for widgets. */
export class Widget extends DOMComponent {
constructor(options?: WidgetOptions);
/** Redraws the widget. */
repaint(): void;
/** Sets focus on the widget. */
focus(): void;
/** Registers a handler when a specified key is pressed. */
registerKeyHandler(key: string, handler: Function): void;
}
export interface CollectionWidgetOptions extends WidgetOptions {
/** A data source used to fetch data to be displayed by the widget. */
dataSource?: any;
/** The time period in milliseconds before the onItemHold event is raised. */
itemHoldTimeout?: number;
/** An array of items displayed by the widget. */
items?: Array<any>;
/** The template to be used for rendering items. */
itemTemplate?: any;
loopItemFocus?: boolean;
/** The text or HTML markup displayed by the widget if the item collection is empty. */
noDataText?: string;
onContentReady?: any;
/** A handler for the itemClick event. */
onItemClick?: any;
/** A handler for the itemContextMenu event. */
onItemContextMenu?: Function;
/** A handler for the itemHold event. */
onItemHold?: Function;
/** A handler for the itemRendered event. */
onItemRendered?: Function;
/** A handler for the selectionChanged event. */
onSelectionChanged?: Function;
/** The index of the currently selected widget item. */
selectedIndex?: number;
/** The selected item object. */
selectedItem?: Object;
/** An array of currently selected item objects. */
selectedItems?: Array<any>;
/** A handler for the itemDeleting event. */
onItemDeleting?: Function;
/** A handler for the itemDeleted event. */
onItemDeleted?: Function;
/** A handler for the itemReordered event. */
onItemReordered?: Function;
}
/** The base class for widgets containing an item collection. */
export class CollectionWidget extends Widget {
constructor(element: JQuery, options?: CollectionWidgetOptions);
constructor(element: HTMLElement, options?: CollectionWidgetOptions);
selectItem(itemElement: any): void;
unselectItem(itemElement: any): void;
deleteItem(itemElement: any): JQueryPromise<void>;
isItemSelected(itemElement: any): boolean;
reorderItem(itemElement: any, toItemElement: any): JQueryPromise<void>;
}
export interface DataExpressionMixinOptions {
/** A data source used to fetch data to be displayed by the widget. */
dataSource?: any;
/** Specifies the name of the data source item field whose value is displayed by the widget. */
displayExpr?: any;
/** Specifies the name of a data source item field whose value is held in the value configuration option. */
valueExpr?: any;
/** An array of items displayed by the widget. */
items?: Array<any>;
/** The template to be used for rendering items. */
itemTemplate?: any;
/** The currently selected value in the widget. */
value?: Object;
}
export interface EditorOptions extends WidgetOptions {
/** The currently specified value. */
value?: Object;
/** A handler for the valueChanged event. */
onValueChanged?: Function;
/** A Boolean value specifying whether or not the widget is read-only. */
readOnly?: boolean;
/** Holds the object that defines the error that occurred during validation. */
validationError?: Object;
/** Specifies whether the editor's value is valid. */
isValid?: boolean;
/** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */
validationMessageMode?: string;
}
/** A base class for editors. */
export class Editor extends Widget {
/** Resets the editor's value to undefined. */
reset(): void;
}
/** An object that serves as a namespace for methods displaying a message in an application/site. */
export var dialog: {
/** Creates an alert dialog message containing a single "OK" button. */
alert(message: string, title: string): JQueryPromise<void>;
/** Creates a confirm dialog that contains "Yes" and "No" buttons. */
confirm(message: string, title: string): JQueryPromise<boolean>;
/** Creates a custom dialog using the options specified by the passed configuration object. */
custom(options: { title?: string; message?: string; buttons?: Array<Object>; }): {
show(): JQueryPromise<any>;
hide(): void;
hide(value: any): void;
};
};
/** Creates a toast message. */
export function notify(message: any, type: string, displayTime: number): void;
/** Creates a toast message. */
export function notify(options: Object): void;
/** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */
export var themes: {
/** Returns the name of the currently applied theme. */
current(): string;
/** Changes the current theme to the specified one. */
current(themeName: string): void;
};
/** Sets a specified template engine. */
export function setTemplateEngine(name: string): void;
/** Sets a custom template engine defined via custom compile and render functions. */
export function setTemplateEngine(options: Object): void;
}
/** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */
export var utils: {
/** Sets parameters for the viewport meta tag. */
initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void;
/** Requests that the browser call a specified function to update animation before the next repaint. */
requestAnimationFrame(callback: Function): number;
/** Cancels an animation frame request scheduled with the requestAnimationFrame method. */
cancelAnimationFrame(requestID: number): void;
};
/** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */
export module viz {
/** Applies a theme for the entire page with several DevExtreme visualization widgets. */
export function currentTheme(theme: string): void;
/** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */
export function currentTheme(platform: string, colorScheme: string): void;
/** Registers a new theme based on the existing one. */
export function registerTheme(customTheme: Object, baseTheme: string): void;
/** Applies a predefined or registered custom palette to all visualization widgets at once. */
export function currentPalette(paletteName: string): void;
/** Obtains the color sets of a predefined or registered palette. */
export function getPalette(paletteName: string): Object;
/** Registers a new palette. */
export function registerPalette(paletteName: string, palette: Object): void;
}
}
declare module DevExpress.ui {
export interface dxValidatorOptions extends DOMComponentOptions {
/** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */
validationRules?: Array<any>;
/** Specifies the editor name to be used in the validation default messages. */
name?: string;
/** An object that specifies what and when to validate and how to apply the validation result. */
adapter?: Object;
/** Specifies the validation group the editor will be related to. */
validationGroup?: string;
/** A handler for the validated event. */
onValidated?: (params: validationEngine.ValidatorValidationResult) => void;
}
/** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */
export class dxValidator extends DOMComponent implements validationEngine.IValidator {
constructor(element: JQuery, options?: dxValidatorOptions);
constructor(element: Element, options?: dxValidatorOptions);
/** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */
validate(): validationEngine.ValidatorValidationResult;
/** Resets the value and validation result of the editor associated with the current dxValidator object. */
reset(): void;
}
/** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */
export class dxValidationGroup extends DOMComponent {
constructor(element: JQuery);
constructor(element: Element);
/** Validates rules of the validators that belong to the current validation group. */
validate(): validationEngine.ValidationGroupValidationResult;
/** Resets the value and validation result of the editors that are included to the current validation group. */
reset(): void;
}
export interface dxValidationSummaryOptions extends CollectionWidgetOptions {
/** Specifies the validation group for which summary should be generated. */
validationGroup?: string;
}
/** A widget for displaying the result of checking validation rules for editors. */
export class dxValidationSummary extends CollectionWidget {
constructor(element: JQuery, options?: dxValidationSummaryOptions);
constructor(element: Element, options?: dxValidationSummaryOptions);
}
export interface dxResizableOptions extends DOMComponentOptions {
/** Specifies which borders of the widget element are used as a handle. */
handles?: string;
/** Specifies the lower width boundary for resizing. */
minWidth?: number;
/** Specifies the upper width boundary for resizing. */
maxWidth?: number;
/** Specifies the lower height boundary for resizing. */
minHeight?: number;
/** Specifies the upper height boundary for resizing. */
maxHeight?: number;
/** A handler for the resizeStart event. */
onResizeStart?: Function;
/** A handler for the resize event. */
onResize?: Function;
/** A handler for the resizeEnd event. */
onResizeEnd?: Function;
}
/** A widget that displays required content in a resizable element. */
export class dxResizable extends DOMComponent {
constructor(element: JQuery, options?: dxResizableOptions);
constructor(element: Element, options?: dxResizableOptions);
}
export interface dxTooltipOptions extends dxPopoverOptions {
}
/** A tooltip widget. */
export class dxTooltip extends dxPopover {
constructor(element: JQuery, options?: dxTooltipOptions);
constructor(element: Element, options?: dxTooltipOptions);
}
export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions {
/** Returns the value currently displayed by the widget. */
displayValue?: string;
/** The minimum number of characters that must be entered into the text box to begin a search. */
minSearchLength?: number;
/** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */
showDataBeforeSearch?: boolean;
/** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */
searchExpr?: Object;
/** Specifies the binary operation used to filter data. */
searchMode?: string;
/** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */
searchTimeout?: number;
/** A handler for the valueChanged event. */
onValueChanged?: Function;
/** Specifies DOM event names that update a widget's value. */
valueChangeEvent?: string;
/** Specifies whether or not the widget supports searching. */
searchEnabled?: boolean;
/**
* Specifies whether or not the widget displays items by pages.
* @deprecated dataSource.paginate.md
*/
pagingEnabled?: boolean;
/** The text or HTML markup displayed by the widget if the item collection is empty. */
noDataText?: string;
/** A handler for the selectionChanged event. */
onSelectionChanged?: Function;
/** A handler for the itemClick event. */
onItemClick?: Function;
onContentReady?: Function;
}
/** A base class for drop-down list widgets. */
export class dxDropDownList extends dxDropDownEditor {
constructor(element: JQuery, options?: dxDropDownListOptions);
constructor(element: Element, options?: dxDropDownListOptions);
}
export interface dxToolbarOptions extends CollectionWidgetOptions {
/** The template used to render menu items. */
menuItemTemplate?: any;
/** Informs the widget about its location in a view HTML markup. */
renderAs?: string;
}
/** A toolbar widget. */
export class dxToolbar extends CollectionWidget {
constructor(element: JQuery, options?: dxToolbarOptions);
constructor(element: Element, options?: dxToolbarOptions);
}
export interface dxToastOptions extends dxOverlayOptions {
animation?: fx.AnimationOptions;
/** The time span in milliseconds during which the dxToast widget is visible. */
displayTime?: number;
height?: any;
/** The dxToast message text. */
message?: string;
position?: PositionOptions;
shading?: boolean;
/** Specifies the dxToast widget type. */
type?: string;
width?: any;
closeOnBackButton?: boolean;
/** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */
closeOnSwipe?: boolean;
/** A Boolean value specifying whether or not the toast is closed if a user clicks it. */
closeOnClick?: boolean;
}
/** The toast message widget. */
export class dxToast extends dxOverlay {
constructor(element: JQuery, options?: dxToastOptions);
constructor(element: Element, options?: dxToastOptions);
}
export interface dxTextEditorOptions extends EditorOptions {
/** A handler for the change event. */
onChange?: Function;
/** A handler for the copy event. */
onCopy?: Function;
/** A handler for the cut event. */
onCut?: Function;
/** A handler for the enterKey event. */
onEnterKey?: Function;
/** A handler for the focusIn event. */
onFocusIn?: Function;
/** A handler for the focusOut event. */
onFocusOut?: Function;
/** A handler for the input event. */
onInput?: Function;
/** A handler for the keyDown event. */
onKeyDown?: Function;
/** A handler for the keyPress event. */
onKeyPress?: Function;
/** A handler for the keyUp event. */
onKeyUp?: Function;
/** A handler for the paste event. */
onPaste?: Function;
/** The text displayed by the widget when the widget value is empty. */
placeholder?: string;
/** Specifies whether to display the Clear button in the widget. */