@mescius/wijmo 5.20232.939
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +4553 -0
- package/index.js +14 -0
- package/package.json +44 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,4553 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* {@module wijmo}
|
|
15
|
+
* Contains utilities used by all controls and modules, as well as the
|
|
16
|
+
* {@link Control} and {@link Event} classes.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare var ___keepComment: any;
|
|
22
|
+
import * as selfModule from '@grapecity/wijmo';
|
|
23
|
+
export declare function isMobile(): boolean;
|
|
24
|
+
export declare function isiOS(): boolean;
|
|
25
|
+
export declare function isFirefox(): boolean;
|
|
26
|
+
export declare function isSafari(): boolean;
|
|
27
|
+
export declare function isEdge(): boolean;
|
|
28
|
+
export declare function isIE(): boolean;
|
|
29
|
+
export declare function isIE9(): boolean;
|
|
30
|
+
export declare function isIE10(): boolean;
|
|
31
|
+
export declare function getEventOptions(capture: boolean, passive: boolean): any;
|
|
32
|
+
export declare function supportsFocusOptions(): boolean;
|
|
33
|
+
export declare function _startDrag(dataTransfer: any, effectAllowed: string): void;
|
|
34
|
+
export declare function _getCalculatedArray(arr: any[], calculatedFields: any, newItem?: any): any[];
|
|
35
|
+
export declare function _getTargetObject(item: any): any;
|
|
36
|
+
declare class _FocusService {
|
|
37
|
+
private readonly _hasDoc;
|
|
38
|
+
private _ae;
|
|
39
|
+
private static readonly _noAe;
|
|
40
|
+
constructor();
|
|
41
|
+
readonly activeElement: HTMLElement;
|
|
42
|
+
private _onBlur;
|
|
43
|
+
private _onFocus;
|
|
44
|
+
private _isSpecialRoot;
|
|
45
|
+
private _nativeAe;
|
|
46
|
+
}
|
|
47
|
+
export declare var _focusSrv: _FocusService;
|
|
48
|
+
/**
|
|
49
|
+
* Provides binding to complex properties (e.g. 'customer.address.city')
|
|
50
|
+
*/
|
|
51
|
+
export declare class Binding {
|
|
52
|
+
_path: string;
|
|
53
|
+
_parts: any[];
|
|
54
|
+
_key: string;
|
|
55
|
+
/**
|
|
56
|
+
* Initializes a new instance of the {@link Binding} class.
|
|
57
|
+
*
|
|
58
|
+
* @param path Name of the property to bind to.
|
|
59
|
+
*/
|
|
60
|
+
constructor(path: string);
|
|
61
|
+
/**
|
|
62
|
+
* Gets or sets the path for the binding.
|
|
63
|
+
*
|
|
64
|
+
* In the simplest case, the path is the name of the property of the source
|
|
65
|
+
* object to use for the binding (e.g. 'street').
|
|
66
|
+
*
|
|
67
|
+
* Sub-properties of a property can be specified by a syntax similar to that
|
|
68
|
+
* used in JavaScript (e.g. 'address.street').
|
|
69
|
+
*/
|
|
70
|
+
path: string;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the binding value for a given object.
|
|
73
|
+
*
|
|
74
|
+
* If the object does not contain the property specified by the
|
|
75
|
+
* binding {@link path}, the method returns null.
|
|
76
|
+
*
|
|
77
|
+
* @param object The object that contains the data to be retrieved.
|
|
78
|
+
*/
|
|
79
|
+
getValue(object: any): any;
|
|
80
|
+
/**
|
|
81
|
+
* Sets the binding value on a given object.
|
|
82
|
+
*
|
|
83
|
+
* If the object does not contain the property specified by the
|
|
84
|
+
* binding {@link path}, the value is not set.
|
|
85
|
+
*
|
|
86
|
+
* @param object The object that contains the data to be set.
|
|
87
|
+
* @param value Data value to set.
|
|
88
|
+
* @returns True if the value was assigned correctly, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
setValue(object: any, value: any): boolean;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Represents an event handler.
|
|
94
|
+
*
|
|
95
|
+
* Event handlers are functions invoked when events are raised.
|
|
96
|
+
*
|
|
97
|
+
* Every event handler has two arguments:
|
|
98
|
+
* <ul>
|
|
99
|
+
* <li><b>sender</b> is the object that raised the event, and</li>
|
|
100
|
+
* <li><b>args</b> is an optional object that contains the event parameters.</li>
|
|
101
|
+
* </ul>
|
|
102
|
+
*
|
|
103
|
+
* Read more about <a href="https://developer.mescius.com/blogs/html-and-wijmo-events" target="_blank">Wijmo Events</a>.
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
export interface IEventHandler<S = any, T = EventArgs> {
|
|
107
|
+
(sender: S, args: T): void;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Represents an event.
|
|
111
|
+
*
|
|
112
|
+
* Wijmo events are similar to .NET events. Any class may define events by
|
|
113
|
+
* declaring them as fields. Any class may subscribe to events using the
|
|
114
|
+
* event's {@link addHandler} method and unsubscribe using the {@link removeHandler}
|
|
115
|
+
* method.
|
|
116
|
+
*
|
|
117
|
+
* Wijmo event handlers take two parameters: <i>sender</i> and <i>args</i>.
|
|
118
|
+
* The first is the object that raised the event, and the second is an object
|
|
119
|
+
* that contains the event parameters.
|
|
120
|
+
*
|
|
121
|
+
* Classes that define events follow the .NET pattern where for every event
|
|
122
|
+
* there is an <i>on[EVENTNAME]</i> method that raises the event. This pattern
|
|
123
|
+
* allows derived classes to override the <i>on[EVENTNAME]</i> method and
|
|
124
|
+
* handle the event before and/or after the base class raises the event.
|
|
125
|
+
* Derived classes may even suppress the event by not calling the base class
|
|
126
|
+
* implementation.
|
|
127
|
+
*
|
|
128
|
+
* For example, the TypeScript code below overrides the <b>onValueChanged</b>
|
|
129
|
+
* event for a control to perform some processing before and after the
|
|
130
|
+
* <b>valueChanged</b> event fires:
|
|
131
|
+
*
|
|
132
|
+
* <pre>// override base class
|
|
133
|
+
* onValueChanged(e: EventArgs) {
|
|
134
|
+
* // execute some code before the event fires
|
|
135
|
+
* console.log('about to fire valueChanged');
|
|
136
|
+
* // optionally, call base class to fire the event
|
|
137
|
+
* super.onValueChanged(e);
|
|
138
|
+
* // execute some code after the event fired
|
|
139
|
+
* console.log('valueChanged event just fired');
|
|
140
|
+
* }</pre>
|
|
141
|
+
*/
|
|
142
|
+
export declare class Event<S = any, T = EventArgs> {
|
|
143
|
+
private _handlers;
|
|
144
|
+
private _handlersChanged;
|
|
145
|
+
/**
|
|
146
|
+
* Initializes a new instance of an {@link Event}.
|
|
147
|
+
*
|
|
148
|
+
* @param handlersChanged Optional callback invoked when handlers are
|
|
149
|
+
* added or removed from this {@link Event}.
|
|
150
|
+
*/
|
|
151
|
+
constructor(handlersChanged?: Function);
|
|
152
|
+
/**
|
|
153
|
+
* Adds a handler to this event.
|
|
154
|
+
*
|
|
155
|
+
* @param handler Function invoked when the event is raised.
|
|
156
|
+
* @param self Object that defines the event handler
|
|
157
|
+
* (accessible as 'this' from the handler code).
|
|
158
|
+
*/
|
|
159
|
+
addHandler(handler: IEventHandler<S, T>, self?: any): void;
|
|
160
|
+
/**
|
|
161
|
+
* Gets a handler to this event.
|
|
162
|
+
*
|
|
163
|
+
* @param index Desired handle index number, this is usually zero.
|
|
164
|
+
*/
|
|
165
|
+
getHandler(index?: number): IEventHandler | void;
|
|
166
|
+
/**
|
|
167
|
+
* Removes a handler from this event.
|
|
168
|
+
*
|
|
169
|
+
* @param handler Function invoked when the event is raised.
|
|
170
|
+
* @param self Object that owns the event handler (accessible as 'this' from the handler code).
|
|
171
|
+
*/
|
|
172
|
+
removeHandler(handler: IEventHandler<S, T>, self?: any): void;
|
|
173
|
+
/**
|
|
174
|
+
* Removes all handlers associated with this event.
|
|
175
|
+
*/
|
|
176
|
+
removeAllHandlers(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Raises this event, causing all associated handlers to be invoked.
|
|
179
|
+
*
|
|
180
|
+
* @param sender Source object.
|
|
181
|
+
* @param args Event parameters.
|
|
182
|
+
*/
|
|
183
|
+
raise(sender: any, args?: EventArgs): void;
|
|
184
|
+
/**
|
|
185
|
+
* Gets a value that indicates whether this event has any handlers.
|
|
186
|
+
*/
|
|
187
|
+
readonly hasHandlers: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Gets the number of handlers added to this event.
|
|
190
|
+
*/
|
|
191
|
+
readonly handlerCount: number;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Base class for event arguments.
|
|
195
|
+
*/
|
|
196
|
+
export declare class EventArgs {
|
|
197
|
+
/**
|
|
198
|
+
* Provides a value to use with events that do not have event data.
|
|
199
|
+
*/
|
|
200
|
+
static empty: EventArgs;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Provides arguments for cancellable events.
|
|
204
|
+
*/
|
|
205
|
+
export declare class CancelEventArgs extends EventArgs {
|
|
206
|
+
/**
|
|
207
|
+
* Gets or sets a value that indicates whether the event should be canceled.
|
|
208
|
+
*/
|
|
209
|
+
cancel: boolean;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Provides arguments for property change events.
|
|
213
|
+
*/
|
|
214
|
+
export declare class PropertyChangedEventArgs extends EventArgs {
|
|
215
|
+
_name: string;
|
|
216
|
+
_oldVal: any;
|
|
217
|
+
_newVal: any;
|
|
218
|
+
/**
|
|
219
|
+
* Initializes a new instance of the {@link PropertyChangedEventArgs} class.
|
|
220
|
+
*
|
|
221
|
+
* @param propertyName The name of the property whose value changed.
|
|
222
|
+
* @param oldValue The old value of the property.
|
|
223
|
+
* @param newValue The new value of the property.
|
|
224
|
+
*/
|
|
225
|
+
constructor(propertyName: string, oldValue: any, newValue: any);
|
|
226
|
+
/**
|
|
227
|
+
* Gets the name of the property whose value changed.
|
|
228
|
+
*/
|
|
229
|
+
readonly propertyName: string;
|
|
230
|
+
/**
|
|
231
|
+
* Gets the old value of the property.
|
|
232
|
+
*/
|
|
233
|
+
readonly oldValue: any;
|
|
234
|
+
/**
|
|
235
|
+
* Gets the new value of the property.
|
|
236
|
+
*/
|
|
237
|
+
readonly newValue: any;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Provides arguments for
|
|
241
|
+
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a>
|
|
242
|
+
* error events.
|
|
243
|
+
*/
|
|
244
|
+
export declare class RequestErrorEventArgs extends CancelEventArgs {
|
|
245
|
+
_xhr: XMLHttpRequest;
|
|
246
|
+
_msg: string;
|
|
247
|
+
/**
|
|
248
|
+
* Initializes a new instance of the {@link RequestErrorEventArgs} class.
|
|
249
|
+
*
|
|
250
|
+
* @param xhr The <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a>
|
|
251
|
+
* that detected the error.
|
|
252
|
+
* The 'status' and 'statusText' properties of the request object contain details about the error.
|
|
253
|
+
* @param msg Optional error message.
|
|
254
|
+
*/
|
|
255
|
+
constructor(xhr: XMLHttpRequest, msg?: string);
|
|
256
|
+
/**
|
|
257
|
+
* Gets a reference to the <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest" target="_blank">XMLHttpRequest</a>
|
|
258
|
+
* that detected the error.
|
|
259
|
+
*
|
|
260
|
+
* The status and statusText properties of the request object contain
|
|
261
|
+
* details about the error.
|
|
262
|
+
*/
|
|
263
|
+
readonly request: XMLHttpRequest;
|
|
264
|
+
/**
|
|
265
|
+
* Gets or sets an error message to display to the user.
|
|
266
|
+
*/
|
|
267
|
+
message: string;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Notifies listeners of dynamic changes, such as when items get added and
|
|
271
|
+
* removed or when the collection is sorted, filtered, or grouped.
|
|
272
|
+
*/
|
|
273
|
+
export interface INotifyCollectionChanged {
|
|
274
|
+
/**
|
|
275
|
+
* Occurs when the collection changes.
|
|
276
|
+
*/
|
|
277
|
+
collectionChanged: Event<INotifyCollectionChanged, NotifyCollectionChangedEventArgs>;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Describes the action that caused the {@link INotifyCollectionChanged.collectionChanged}
|
|
281
|
+
* event to fire.
|
|
282
|
+
*/
|
|
283
|
+
export declare enum NotifyCollectionChangedAction {
|
|
284
|
+
/** An item was added to the collection. */
|
|
285
|
+
Add = 0,
|
|
286
|
+
/** An item was removed from the collection. */
|
|
287
|
+
Remove = 1,
|
|
288
|
+
/** An item was changed or replaced. */
|
|
289
|
+
Change = 2,
|
|
290
|
+
/**
|
|
291
|
+
* Several items changed simultaneously
|
|
292
|
+
* (for example, the collection was sorted, filtered, or grouped).
|
|
293
|
+
*/
|
|
294
|
+
Reset = 3
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Provides data for the {@link INotifyCollectionChanged.collectionChanged} event.
|
|
298
|
+
*/
|
|
299
|
+
export declare class NotifyCollectionChangedEventArgs<T = any> extends EventArgs {
|
|
300
|
+
/**
|
|
301
|
+
* Provides a reset notification.
|
|
302
|
+
*/
|
|
303
|
+
static reset: NotifyCollectionChangedEventArgs<any>;
|
|
304
|
+
/**
|
|
305
|
+
* Gets the action that caused the event to fire.
|
|
306
|
+
*/
|
|
307
|
+
action: NotifyCollectionChangedAction;
|
|
308
|
+
/**
|
|
309
|
+
* Gets the item that was added, removed, or changed.
|
|
310
|
+
*/
|
|
311
|
+
item: T;
|
|
312
|
+
/**
|
|
313
|
+
* Gets the index at which the change occurred.
|
|
314
|
+
*/
|
|
315
|
+
index: number;
|
|
316
|
+
/**
|
|
317
|
+
* Initializes a new instance of the {@link NotifyCollectionChangedEventArgs} class.
|
|
318
|
+
*
|
|
319
|
+
* @param action Type of action that caused the event to fire.
|
|
320
|
+
* @param item Item that was added or changed.
|
|
321
|
+
* @param index Index of the item.
|
|
322
|
+
*/
|
|
323
|
+
constructor(action?: NotifyCollectionChangedAction, item?: T, index?: number);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Represents a method that takes an item of any type and returns a
|
|
327
|
+
* boolean that indicates whether the object meets a set of criteria.
|
|
328
|
+
*/
|
|
329
|
+
export interface IPredicate<T = any> {
|
|
330
|
+
/**
|
|
331
|
+
* @param item Data item to test.
|
|
332
|
+
* @returns true if the item passes the test, false otherwise.
|
|
333
|
+
*/
|
|
334
|
+
(item: T): boolean;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Represents a method that compares two objects.
|
|
338
|
+
*/
|
|
339
|
+
export interface IComparer<T = any> {
|
|
340
|
+
/**
|
|
341
|
+
* @param: item1 First object to compare.
|
|
342
|
+
* @param: item2 Second object to compare.
|
|
343
|
+
* @returns -1, 0, or +1 to indicate that the first item is smaller than, equal to, or created than the second.
|
|
344
|
+
*/
|
|
345
|
+
(item1: T, item2: T): number;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Represents a method that takes an item and a property name
|
|
349
|
+
* and returns a group name.
|
|
350
|
+
*/
|
|
351
|
+
export interface IGroupConverter<T = any> {
|
|
352
|
+
/**
|
|
353
|
+
* @param item Data item being grouped.
|
|
354
|
+
* @param property Name of the property being grouped on.
|
|
355
|
+
* @return Name of the group to use for this data item.
|
|
356
|
+
*/
|
|
357
|
+
(item: T, property: string): string;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Describes a sorting criterion.
|
|
361
|
+
*/
|
|
362
|
+
export declare class SortDescription {
|
|
363
|
+
_bnd: Binding;
|
|
364
|
+
_asc: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Initializes a new instance of the {@link SortDescription} class.
|
|
367
|
+
*
|
|
368
|
+
* @param property Name of the property to sort on.
|
|
369
|
+
* @param ascending Whether to sort in ascending order.
|
|
370
|
+
*/
|
|
371
|
+
constructor(property: string, ascending: boolean);
|
|
372
|
+
/**
|
|
373
|
+
* Gets the name of the property used to sort.
|
|
374
|
+
*/
|
|
375
|
+
readonly property: string;
|
|
376
|
+
/**
|
|
377
|
+
* Gets a value that determines whether to sort the values in ascending order.
|
|
378
|
+
*/
|
|
379
|
+
readonly ascending: boolean;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Enables collections to have the functionalities of current record management,
|
|
383
|
+
* custom sorting, filtering, and grouping.
|
|
384
|
+
*
|
|
385
|
+
* This is a JavaScript version of the <b>ICollectionView</b> interface used in
|
|
386
|
+
* Microsoft's XAML platform. It provides a consistent, powerful, and MVVM-friendly
|
|
387
|
+
* way to bind data to UI elements.
|
|
388
|
+
*
|
|
389
|
+
* Wijmo includes several classes that implement {@link ICollectionView}. The most
|
|
390
|
+
* common is {@link CollectionView}, which works based on regular JavsScript
|
|
391
|
+
* arrays.
|
|
392
|
+
*/
|
|
393
|
+
export interface ICollectionView<T = any> extends INotifyCollectionChanged, IQueryInterface {
|
|
394
|
+
/**
|
|
395
|
+
* Gets a value that indicates whether this view supports filtering via the
|
|
396
|
+
* {@link filter} property.
|
|
397
|
+
*/
|
|
398
|
+
canFilter: boolean;
|
|
399
|
+
/**
|
|
400
|
+
* Gets a value that indicates whether this view supports grouping via the
|
|
401
|
+
* {@link groupDescriptions} property.
|
|
402
|
+
*/
|
|
403
|
+
canGroup: boolean;
|
|
404
|
+
/**
|
|
405
|
+
* Gets a value that indicates whether this view supports sorting via the
|
|
406
|
+
* {@link sortDescriptions} property.
|
|
407
|
+
*/
|
|
408
|
+
canSort: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Gets the current item in the view.
|
|
411
|
+
*/
|
|
412
|
+
currentItem: T;
|
|
413
|
+
/**
|
|
414
|
+
* Gets the ordinal position of the current item in the view.
|
|
415
|
+
*/
|
|
416
|
+
currentPosition: number;
|
|
417
|
+
/**
|
|
418
|
+
* Gets or sets a callback used to determine if an item is suitable for
|
|
419
|
+
* inclusion in the view.
|
|
420
|
+
*
|
|
421
|
+
* NOTE: If the filter function needs a scope (i.e. a meaningful 'this'
|
|
422
|
+
* value), then remember to set the filter using the 'bind' function to
|
|
423
|
+
* specify the 'this' object. For example:
|
|
424
|
+
* <pre>
|
|
425
|
+
* collectionView.filter = this._filter.bind(this);
|
|
426
|
+
* </pre>
|
|
427
|
+
*/
|
|
428
|
+
filter: IPredicate<T> | null;
|
|
429
|
+
/**
|
|
430
|
+
* Gets a collection of {@link GroupDescription} objects that describe how the
|
|
431
|
+
* items in the collection are grouped in the view.
|
|
432
|
+
*/
|
|
433
|
+
groupDescriptions: ObservableArray<GroupDescription>;
|
|
434
|
+
/**
|
|
435
|
+
* Gets the top-level groups.
|
|
436
|
+
*/
|
|
437
|
+
groups: any[];
|
|
438
|
+
/**
|
|
439
|
+
* Gets a value that indicates whether this view contains no items.
|
|
440
|
+
*/
|
|
441
|
+
isEmpty: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Gets a collection of {@link SortDescription} objects that describe how the items
|
|
444
|
+
* in the collection are sorted in the view.
|
|
445
|
+
*/
|
|
446
|
+
sortDescriptions: ObservableArray<SortDescription>;
|
|
447
|
+
/**
|
|
448
|
+
* Gets or sets the collection object from which to create this view.
|
|
449
|
+
*/
|
|
450
|
+
sourceCollection: any;
|
|
451
|
+
/**
|
|
452
|
+
* Returns a value that indicates whether a given item belongs to this view.
|
|
453
|
+
*
|
|
454
|
+
* @param item The item to locate in the collection.
|
|
455
|
+
*/
|
|
456
|
+
contains(item: T): boolean;
|
|
457
|
+
/**
|
|
458
|
+
* Sets the specified item to be the current item in the view.
|
|
459
|
+
*
|
|
460
|
+
* @param item The item to set as the {@link currentItem}.
|
|
461
|
+
*/
|
|
462
|
+
moveCurrentTo(item: T): boolean;
|
|
463
|
+
/**
|
|
464
|
+
* Sets the first item in the view as the current item.
|
|
465
|
+
*/
|
|
466
|
+
moveCurrentToFirst(): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Sets the last item in the view as the current item.
|
|
469
|
+
*/
|
|
470
|
+
moveCurrentToLast(): boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Sets the item after the current item in the view as the current item.
|
|
473
|
+
*/
|
|
474
|
+
moveCurrentToNext(): boolean;
|
|
475
|
+
/**
|
|
476
|
+
* Sets the item at the specified index in the view as the current item.
|
|
477
|
+
*
|
|
478
|
+
* @param index The index of the item to set as the {@link currentItem}.
|
|
479
|
+
*/
|
|
480
|
+
moveCurrentToPosition(index: number): boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Sets the item before the current item in the view as the current item.
|
|
483
|
+
*/
|
|
484
|
+
moveCurrentToPrevious(): boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Re-creates the view using the current sort, filter, and group parameters.
|
|
487
|
+
*/
|
|
488
|
+
refresh(): void;
|
|
489
|
+
/**
|
|
490
|
+
* Occurs after the current item changes.
|
|
491
|
+
*/
|
|
492
|
+
currentChanged: Event<ICollectionView, EventArgs>;
|
|
493
|
+
/**
|
|
494
|
+
* Occurs before the current item changes.
|
|
495
|
+
*/
|
|
496
|
+
currentChanging: Event<ICollectionView, EventArgs>;
|
|
497
|
+
/**
|
|
498
|
+
* Suspends refreshes until the next call to {@link endUpdate}.
|
|
499
|
+
*/
|
|
500
|
+
beginUpdate(): void;
|
|
501
|
+
/**
|
|
502
|
+
* Resumes refreshes suspended by a call to {@link beginUpdate}.
|
|
503
|
+
*
|
|
504
|
+
* @param force Whether to force a refresh when ending the update.
|
|
505
|
+
*/
|
|
506
|
+
endUpdate(force?: boolean): void;
|
|
507
|
+
/**
|
|
508
|
+
* Executes a function within a beginUpdate/endUpdate block.
|
|
509
|
+
*
|
|
510
|
+
* The collection will not be refreshed until the function has been executed.
|
|
511
|
+
* This method ensures endUpdate is called even if the function throws.
|
|
512
|
+
*
|
|
513
|
+
* @param fn Function to be executed within the beginUpdate/endUpdate block.
|
|
514
|
+
* @param force Whether to force a refresh when ending the update.
|
|
515
|
+
*/
|
|
516
|
+
deferUpdate(fn: Function, force?: boolean): void;
|
|
517
|
+
/**
|
|
518
|
+
* Gets the filtered, sorted, grouped items in the view.
|
|
519
|
+
*/
|
|
520
|
+
items: T[];
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Defines methods and properties that extend {@link ICollectionView} to provide
|
|
524
|
+
* editing capabilities.
|
|
525
|
+
*/
|
|
526
|
+
export interface IEditableCollectionView extends ICollectionView {
|
|
527
|
+
/**
|
|
528
|
+
* Gets a value that indicates whether a new item can be added to the collection.
|
|
529
|
+
*/
|
|
530
|
+
canAddNew: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Gets a value that indicates whether the collection view can discard pending changes
|
|
533
|
+
* and restore the original values of an edited object.
|
|
534
|
+
*/
|
|
535
|
+
canCancelEdit: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Gets a value that indicates whether items can be removed from the collection.
|
|
538
|
+
*/
|
|
539
|
+
canRemove: boolean;
|
|
540
|
+
/**
|
|
541
|
+
* Gets the item that is being added during the current add transaction.
|
|
542
|
+
*/
|
|
543
|
+
currentAddItem: any;
|
|
544
|
+
/**
|
|
545
|
+
* Gets the item that is being edited during the current edit transaction.
|
|
546
|
+
*/
|
|
547
|
+
currentEditItem: any;
|
|
548
|
+
/**
|
|
549
|
+
* Gets a value that indicates whether an add transaction is in progress.
|
|
550
|
+
*/
|
|
551
|
+
isAddingNew: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Gets a value that indicates whether an edit transaction is in progress.
|
|
554
|
+
*/
|
|
555
|
+
isEditingItem: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Adds a new item to the collection.
|
|
558
|
+
*
|
|
559
|
+
* @return The item that was added to the collection.
|
|
560
|
+
*/
|
|
561
|
+
addNew(): any;
|
|
562
|
+
/**
|
|
563
|
+
* Ends the current edit transaction and, if possible,
|
|
564
|
+
* restores the original value to the item.
|
|
565
|
+
*/
|
|
566
|
+
cancelEdit(): void;
|
|
567
|
+
/**
|
|
568
|
+
* Ends the current add transaction and discards the pending new item.
|
|
569
|
+
*/
|
|
570
|
+
cancelNew(): void;
|
|
571
|
+
/**
|
|
572
|
+
* Ends the current edit transaction and saves the pending changes.
|
|
573
|
+
*/
|
|
574
|
+
commitEdit(): void;
|
|
575
|
+
/**
|
|
576
|
+
* Ends the current add transaction and saves the pending new item.
|
|
577
|
+
*/
|
|
578
|
+
commitNew(): void;
|
|
579
|
+
/**
|
|
580
|
+
* Begins an edit transaction of the specified item.
|
|
581
|
+
*
|
|
582
|
+
* @param item Item to edit.
|
|
583
|
+
*/
|
|
584
|
+
editItem(item: any): void;
|
|
585
|
+
/**
|
|
586
|
+
* Removes the specified item from the collection.
|
|
587
|
+
*
|
|
588
|
+
* @param item Item to remove from the collection.
|
|
589
|
+
*/
|
|
590
|
+
remove(item: any): void;
|
|
591
|
+
/**
|
|
592
|
+
* Removes the item at the specified index from the collection.
|
|
593
|
+
*
|
|
594
|
+
* @param index Index of the item to remove from the collection.
|
|
595
|
+
*/
|
|
596
|
+
removeAt(index: number): void;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Defines methods and properties that extend {@link ICollectionView} to provide
|
|
600
|
+
* paging capabilities.
|
|
601
|
+
*/
|
|
602
|
+
export interface IPagedCollectionView extends ICollectionView {
|
|
603
|
+
/**
|
|
604
|
+
* Gets a value that indicates whether the {@link pageIndex} value can change.
|
|
605
|
+
*/
|
|
606
|
+
canChangePage: boolean;
|
|
607
|
+
/**
|
|
608
|
+
* Gets a value that indicates whether the index is changing.
|
|
609
|
+
*/
|
|
610
|
+
isPageChanging: boolean;
|
|
611
|
+
/**
|
|
612
|
+
* Gets the number of items in the view taking paging into account.
|
|
613
|
+
*
|
|
614
|
+
* To get the total number of items, use the {@link totalItemCount} property.
|
|
615
|
+
*
|
|
616
|
+
* Notice that this is different from the .NET <b>IPagedCollectionView</b>,
|
|
617
|
+
* where <b>itemCount</b> and <b>totalItemCount</b> both return the count
|
|
618
|
+
* before paging is applied.
|
|
619
|
+
*/
|
|
620
|
+
itemCount: number;
|
|
621
|
+
/**
|
|
622
|
+
* Gets the zero-based index of the current page.
|
|
623
|
+
*/
|
|
624
|
+
pageIndex: number;
|
|
625
|
+
/**
|
|
626
|
+
* Gets or sets the number of items to display on each page.
|
|
627
|
+
*/
|
|
628
|
+
pageSize: number;
|
|
629
|
+
/**
|
|
630
|
+
* Gets the total number of items in the view before paging is applied.
|
|
631
|
+
*
|
|
632
|
+
* To get the number of items in the current view taking paging into
|
|
633
|
+
* account, use the {@link itemCount} property.
|
|
634
|
+
*
|
|
635
|
+
* Notice that this is different from the .NET <b>IPagedCollectionView</b>,
|
|
636
|
+
* where <b>itemCount</b> and <b>totalItemCount</b> both return the count
|
|
637
|
+
* before paging is applied.
|
|
638
|
+
*/
|
|
639
|
+
totalItemCount: number;
|
|
640
|
+
/**
|
|
641
|
+
* Sets the first page as the current page.
|
|
642
|
+
*/
|
|
643
|
+
moveToFirstPage(): boolean;
|
|
644
|
+
/**
|
|
645
|
+
* Sets the last page as the current page.
|
|
646
|
+
*/
|
|
647
|
+
moveToLastPage(): boolean;
|
|
648
|
+
/**
|
|
649
|
+
* Moves to the page after the current page.
|
|
650
|
+
*/
|
|
651
|
+
moveToNextPage(): boolean;
|
|
652
|
+
/**
|
|
653
|
+
* Moves to the page at the specified index.
|
|
654
|
+
*
|
|
655
|
+
* @param index Index of the page to move to.
|
|
656
|
+
*/
|
|
657
|
+
moveToPage(index: number): boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Moves to the page before the current page.
|
|
660
|
+
*/
|
|
661
|
+
moveToPreviousPage(): boolean;
|
|
662
|
+
/**
|
|
663
|
+
* Occurs after the page index changes.
|
|
664
|
+
*/
|
|
665
|
+
pageChanged: Event<IPagedCollectionView, EventArgs>;
|
|
666
|
+
/**
|
|
667
|
+
* Occurs before the page index changes.
|
|
668
|
+
*/
|
|
669
|
+
pageChanging: Event<IPagedCollectionView, PageChangingEventArgs>;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Provides data for the {@link IPagedCollectionView.pageChanging} event
|
|
673
|
+
*/
|
|
674
|
+
export declare class PageChangingEventArgs extends CancelEventArgs {
|
|
675
|
+
/**
|
|
676
|
+
* Gets the index of the page that is about to become current.
|
|
677
|
+
*/
|
|
678
|
+
newPageIndex: number;
|
|
679
|
+
/**
|
|
680
|
+
* Initializes a new instance of the {@link PageChangingEventArgs} class.
|
|
681
|
+
*
|
|
682
|
+
* @param newIndex Index of the page that is about to become current.
|
|
683
|
+
*/
|
|
684
|
+
constructor(newIndex: number);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Represents a base class for types defining grouping conditions.
|
|
688
|
+
*
|
|
689
|
+
* The concrete class which is commonly used for this purpose is
|
|
690
|
+
* {@link PropertyGroupDescription}.
|
|
691
|
+
*/
|
|
692
|
+
export declare class GroupDescription {
|
|
693
|
+
/**
|
|
694
|
+
* Returns the group name for the given item.
|
|
695
|
+
*
|
|
696
|
+
* @param item The item to get group name for.
|
|
697
|
+
* @param level The zero-based group level index.
|
|
698
|
+
* @return The name of the group the item belongs to.
|
|
699
|
+
*/
|
|
700
|
+
groupNameFromItem(item: any, level: number): any;
|
|
701
|
+
/**
|
|
702
|
+
* Returns a value that indicates whether the group name and the item name
|
|
703
|
+
* match (which implies that the item belongs to the group).
|
|
704
|
+
*
|
|
705
|
+
* @param groupName The name of the group.
|
|
706
|
+
* @param itemName The name of the item.
|
|
707
|
+
* @return True if the names match; otherwise, false.
|
|
708
|
+
*/
|
|
709
|
+
namesMatch(groupName: any, itemName: any): boolean;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Describes the grouping of items using a property name as the criterion.
|
|
713
|
+
*
|
|
714
|
+
* For example, the code below causes a {@link CollectionView} to group items
|
|
715
|
+
* by the value of their 'country' property:
|
|
716
|
+
* <pre>
|
|
717
|
+
* var cv = new wijmo.collections.CollectionView(items);
|
|
718
|
+
* var gd = new wijmo.collections.PropertyGroupDescription('country');
|
|
719
|
+
* cv.groupDescriptions.push(gd);
|
|
720
|
+
* </pre>
|
|
721
|
+
*
|
|
722
|
+
* You may also specify a callback function that generates the group name.
|
|
723
|
+
* For example, the code below causes a {@link CollectionView} to group items
|
|
724
|
+
* by the first letter of the value of their 'country' property:
|
|
725
|
+
* <pre>
|
|
726
|
+
* var cv = new wijmo.collections.CollectionView(items);
|
|
727
|
+
* var gd = new wijmo.collections.PropertyGroupDescription('country',
|
|
728
|
+
* function(item, propName) {
|
|
729
|
+
* return item[propName][0]; // return country's initial
|
|
730
|
+
* });
|
|
731
|
+
* cv.groupDescriptions.push(gd);
|
|
732
|
+
* </pre>
|
|
733
|
+
*/
|
|
734
|
+
export declare class PropertyGroupDescription extends GroupDescription {
|
|
735
|
+
_bnd: Binding;
|
|
736
|
+
_converter: IGroupConverter;
|
|
737
|
+
/**
|
|
738
|
+
* Initializes a new instance of the {@link PropertyGroupDescription} class.
|
|
739
|
+
*
|
|
740
|
+
* @param property The name of the property that specifies
|
|
741
|
+
* which group an item belongs to.
|
|
742
|
+
* @param converter A callback function that takes an item and
|
|
743
|
+
* a property name and returns the group name. If not specified,
|
|
744
|
+
* the group name is the property value for the item.
|
|
745
|
+
*/
|
|
746
|
+
constructor(property: string, converter?: IGroupConverter);
|
|
747
|
+
/**
|
|
748
|
+
* Gets the name of the property that is used to determine which
|
|
749
|
+
* group an item belongs to.
|
|
750
|
+
*/
|
|
751
|
+
readonly propertyName: string;
|
|
752
|
+
/**
|
|
753
|
+
* Returns the group name for the given item.
|
|
754
|
+
*
|
|
755
|
+
* @param item The item to get group name for.
|
|
756
|
+
* @param level The zero-based group level index.
|
|
757
|
+
* @return The name of the group the item belongs to.
|
|
758
|
+
*/
|
|
759
|
+
groupNameFromItem(item: any, level: number): any;
|
|
760
|
+
/**
|
|
761
|
+
* Returns a value that indicates whether the group name and the item name
|
|
762
|
+
* match (which implies that the item belongs to the group).
|
|
763
|
+
*
|
|
764
|
+
* @param groupName The name of the group.
|
|
765
|
+
* @param itemName The name of the item.
|
|
766
|
+
* @return True if the names match; otherwise, false.
|
|
767
|
+
*/
|
|
768
|
+
namesMatch(groupName: any, itemName: any): boolean;
|
|
769
|
+
}
|
|
770
|
+
export declare const empty: {};
|
|
771
|
+
/**
|
|
772
|
+
* Gets the version of the Wijmo library that is currently loaded.
|
|
773
|
+
*/
|
|
774
|
+
export declare function getVersion(): string;
|
|
775
|
+
/**
|
|
776
|
+
* Sets the license key that identifies licensed Wijmo applications.
|
|
777
|
+
*
|
|
778
|
+
* If you do not set the license key, Wijmo will run in evaluation mode,
|
|
779
|
+
* adding a watermark element to the page.
|
|
780
|
+
*
|
|
781
|
+
* Licensed users may obtain keys at the
|
|
782
|
+
* <a href="https://developer.mescius.com/my-account" target="_blank">My Account</a>
|
|
783
|
+
* section of the Wijmo site.
|
|
784
|
+
*
|
|
785
|
+
* Note that Wijmo does not send keys or any licensing information to any servers.
|
|
786
|
+
* It only checks the internal consistency of the key provided.
|
|
787
|
+
*
|
|
788
|
+
* @param licenseKey String containing the license key to use in this application.
|
|
789
|
+
*/
|
|
790
|
+
export declare function setLicenseKey(licenseKey: string): void;
|
|
791
|
+
/**
|
|
792
|
+
* Specifies constants that represent keyboard codes.
|
|
793
|
+
*
|
|
794
|
+
* This enumeration is useful when handling <b>keyDown</b> events.
|
|
795
|
+
*/
|
|
796
|
+
export declare enum Key {
|
|
797
|
+
/** The backspace key. */
|
|
798
|
+
Back = 8,
|
|
799
|
+
/** The tab key. */
|
|
800
|
+
Tab = 9,
|
|
801
|
+
/** The enter key. */
|
|
802
|
+
Enter = 13,
|
|
803
|
+
/** The escape key. */
|
|
804
|
+
Escape = 27,
|
|
805
|
+
/** The space key. */
|
|
806
|
+
Space = 32,
|
|
807
|
+
/** The page up key. */
|
|
808
|
+
PageUp = 33,
|
|
809
|
+
/** The page down key. */
|
|
810
|
+
PageDown = 34,
|
|
811
|
+
/** The end key. */
|
|
812
|
+
End = 35,
|
|
813
|
+
/** The home key. */
|
|
814
|
+
Home = 36,
|
|
815
|
+
/** The left arrow key. */
|
|
816
|
+
Left = 37,
|
|
817
|
+
/** The up arrow key. */
|
|
818
|
+
Up = 38,
|
|
819
|
+
/** The right arrow key. */
|
|
820
|
+
Right = 39,
|
|
821
|
+
/** The down arrow key. */
|
|
822
|
+
Down = 40,
|
|
823
|
+
/** The delete key. */
|
|
824
|
+
Delete = 46,
|
|
825
|
+
/** The 'X' key */
|
|
826
|
+
X = 88,
|
|
827
|
+
/** The F1 key. */
|
|
828
|
+
F1 = 112,
|
|
829
|
+
/** The F2 key. */
|
|
830
|
+
F2 = 113,
|
|
831
|
+
/** The F3 key. */
|
|
832
|
+
F3 = 114,
|
|
833
|
+
/** The F4 key. */
|
|
834
|
+
F4 = 115,
|
|
835
|
+
/** The F5 key. */
|
|
836
|
+
F5 = 116,
|
|
837
|
+
/** The F6 key. */
|
|
838
|
+
F6 = 117,
|
|
839
|
+
/** The F7 key. */
|
|
840
|
+
F7 = 118,
|
|
841
|
+
/** The F8 key. */
|
|
842
|
+
F8 = 119,
|
|
843
|
+
/** The F9 key. */
|
|
844
|
+
F9 = 120,
|
|
845
|
+
/** The F10 key. */
|
|
846
|
+
F10 = 121,
|
|
847
|
+
/** The F11 key. */
|
|
848
|
+
F11 = 122,
|
|
849
|
+
/** The F12 key. */
|
|
850
|
+
F12 = 123
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Specifies constants that represent data types.
|
|
854
|
+
*
|
|
855
|
+
* Use the {@link getType} method to get a {@link DataType} from a value.
|
|
856
|
+
*/
|
|
857
|
+
export declare enum DataType {
|
|
858
|
+
/** Object (anything). */
|
|
859
|
+
Object = 0,
|
|
860
|
+
/** String. */
|
|
861
|
+
String = 1,
|
|
862
|
+
/** Number. */
|
|
863
|
+
Number = 2,
|
|
864
|
+
/** Boolean. */
|
|
865
|
+
Boolean = 3,
|
|
866
|
+
/** Date (date and time). */
|
|
867
|
+
Date = 4,
|
|
868
|
+
/** Array. */
|
|
869
|
+
Array = 5
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Allows callers to verify whether an object implements an interface.
|
|
873
|
+
*/
|
|
874
|
+
export interface IQueryInterface {
|
|
875
|
+
/**
|
|
876
|
+
* Returns true if the object implements a given interface.
|
|
877
|
+
*
|
|
878
|
+
* @param interfaceName Name of the interface to look for.
|
|
879
|
+
*/
|
|
880
|
+
implementsInterface(interfaceName: string): boolean;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Casts a value to a type if possible.
|
|
884
|
+
*
|
|
885
|
+
* @param value Value to cast.
|
|
886
|
+
* @param type Type or interface name to cast to.
|
|
887
|
+
* @return The value passed in if the cast was successful, null otherwise.
|
|
888
|
+
*/
|
|
889
|
+
export declare function tryCast(value: any, type: any): any;
|
|
890
|
+
/**
|
|
891
|
+
* Determines whether an object is a primitive type (string, number, Boolean, or Date).
|
|
892
|
+
*
|
|
893
|
+
* @param value Value to test.
|
|
894
|
+
*/
|
|
895
|
+
export declare function isPrimitive(value: any): value is string | number | Boolean | Date;
|
|
896
|
+
/**
|
|
897
|
+
* Determines whether an object is a string.
|
|
898
|
+
*
|
|
899
|
+
* @param value Value to test.
|
|
900
|
+
*/
|
|
901
|
+
export declare function isString(value: any): value is string;
|
|
902
|
+
/**
|
|
903
|
+
* Determines whether a string is null, empty, or whitespace only.
|
|
904
|
+
*
|
|
905
|
+
* @param value Value to test.
|
|
906
|
+
*/
|
|
907
|
+
export declare function isNullOrWhiteSpace(value: string): boolean;
|
|
908
|
+
/**
|
|
909
|
+
* Determines whether an object is a number.
|
|
910
|
+
*
|
|
911
|
+
* @param value Value to test.
|
|
912
|
+
*/
|
|
913
|
+
export declare function isNumber(value: any): value is number;
|
|
914
|
+
/**
|
|
915
|
+
* Determines whether an object is an integer.
|
|
916
|
+
*
|
|
917
|
+
* @param value Value to test.
|
|
918
|
+
*/
|
|
919
|
+
export declare function isInt(value: any): value is number;
|
|
920
|
+
/**
|
|
921
|
+
* Determines whether an object is a Boolean.
|
|
922
|
+
*
|
|
923
|
+
* @param value Value to test.
|
|
924
|
+
*/
|
|
925
|
+
export declare function isBoolean(value: any): value is boolean;
|
|
926
|
+
/**
|
|
927
|
+
* Determines whether an object is a function.
|
|
928
|
+
*
|
|
929
|
+
* @param value Value to test.
|
|
930
|
+
*/
|
|
931
|
+
export declare function isFunction(value: any): value is Function;
|
|
932
|
+
/**
|
|
933
|
+
* Determines whether an object is undefined.
|
|
934
|
+
*
|
|
935
|
+
* @param value Value to test.
|
|
936
|
+
*/
|
|
937
|
+
export declare function isUndefined(value: any): value is undefined;
|
|
938
|
+
/**
|
|
939
|
+
* Determines whether an object is a Date.
|
|
940
|
+
*
|
|
941
|
+
* @param value Value to test.
|
|
942
|
+
*/
|
|
943
|
+
export declare function isDate(value: any): value is Date;
|
|
944
|
+
/**
|
|
945
|
+
* Determines whether an object is an Array.
|
|
946
|
+
*
|
|
947
|
+
* @param value Value to test.
|
|
948
|
+
*/
|
|
949
|
+
export declare function isArray(value: any): value is Array<any>;
|
|
950
|
+
/**
|
|
951
|
+
* Determines whether a value is an object
|
|
952
|
+
* (as opposed to a value type, an array, or a Date).
|
|
953
|
+
*
|
|
954
|
+
* @param value Value to test.
|
|
955
|
+
*/
|
|
956
|
+
export declare function isObject(value: any): boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Determines whether an object is empty
|
|
959
|
+
* (contains no enumerable properties).
|
|
960
|
+
*
|
|
961
|
+
* @param obj Object to test.
|
|
962
|
+
*/
|
|
963
|
+
export declare function isEmpty(obj: any): boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Creates a new unique id for an element by adding sequential
|
|
966
|
+
* numbers to a given base id.
|
|
967
|
+
*
|
|
968
|
+
* @param baseId String to use as a basis for generating the unique id.
|
|
969
|
+
*/
|
|
970
|
+
export declare function getUniqueId(baseId: string): string;
|
|
971
|
+
/**
|
|
972
|
+
* Creates an unique id
|
|
973
|
+
*/
|
|
974
|
+
export declare function uidGenerator(): string;
|
|
975
|
+
/**
|
|
976
|
+
* Converts mouse or touch event arguments into a {@link Point} in page coordinates.
|
|
977
|
+
*/
|
|
978
|
+
export declare function mouseToPage(e: any): Point;
|
|
979
|
+
/**
|
|
980
|
+
* Gets the type of a value.
|
|
981
|
+
*
|
|
982
|
+
* @param value Value to test.
|
|
983
|
+
* @return A {@link DataType} value representing the type of the value passed in.
|
|
984
|
+
*/
|
|
985
|
+
export declare function getType(value: any): DataType;
|
|
986
|
+
/**
|
|
987
|
+
* Provides binding information for object properties.
|
|
988
|
+
*/
|
|
989
|
+
export interface IBindingInfo {
|
|
990
|
+
binding: string;
|
|
991
|
+
dataType: DataType;
|
|
992
|
+
isReadOnly?: boolean;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Gets an array containing the names and types of items in an array.
|
|
996
|
+
*
|
|
997
|
+
* @param arr Array containing data items.
|
|
998
|
+
* @param limit Number of the array items to scan (1000 by default). Zero or negative value causes
|
|
999
|
+
* the function to scan all items.
|
|
1000
|
+
* @return An array containing objects with the binding and type of each
|
|
1001
|
+
* primitive property in the items found in the input array.
|
|
1002
|
+
*/
|
|
1003
|
+
export declare function getTypes(arr: any[], limit?: number): IBindingInfo[];
|
|
1004
|
+
/**
|
|
1005
|
+
* Changes the type of a value.
|
|
1006
|
+
*
|
|
1007
|
+
* If the conversion fails, the original value is returned. To check if a
|
|
1008
|
+
* conversion succeeded, you should check the type of the returned value.
|
|
1009
|
+
*
|
|
1010
|
+
* @param value Value to convert.
|
|
1011
|
+
* @param type {@link DataType} to convert the value to.
|
|
1012
|
+
* @param format Format to use when converting to or from strings.
|
|
1013
|
+
* @param refDate Reference date to use when parsing strings with missing information.
|
|
1014
|
+
* @return The converted value, or the original value if a conversion was not possible.
|
|
1015
|
+
*/
|
|
1016
|
+
export declare function changeType(value: any, type: DataType, format?: string, refDate?: Date): any;
|
|
1017
|
+
/**
|
|
1018
|
+
* Rounds or truncates a number to a specified precision.
|
|
1019
|
+
*
|
|
1020
|
+
* @param value Value to round or truncate.
|
|
1021
|
+
* @param prec Number of decimal digits for the result.
|
|
1022
|
+
* @param truncate Whether to truncate or round the original value.
|
|
1023
|
+
*/
|
|
1024
|
+
export declare function toFixed(value: number, prec: number, truncate: boolean): number;
|
|
1025
|
+
/**
|
|
1026
|
+
* Replaces each format item in a specified string with the text equivalent of an
|
|
1027
|
+
* object's value.
|
|
1028
|
+
*
|
|
1029
|
+
* The function works by replacing parts of the <b>formatString</b> with the pattern
|
|
1030
|
+
* '{name:format}' with properties of the <b>data</b> parameter. For example:
|
|
1031
|
+
*
|
|
1032
|
+
* ```typescript
|
|
1033
|
+
* import { format } from '@grapecity/wijmo';
|
|
1034
|
+
* let data = { name: 'Joe', amount: 123456 },
|
|
1035
|
+
* msg = format('Hello {name}, you won {amount:n2}!', data);
|
|
1036
|
+
* ```
|
|
1037
|
+
*
|
|
1038
|
+
* The {@link format} function supports pluralization. If the format string is a
|
|
1039
|
+
* JSON-encoded object with 'count' and 'when' properties, the method uses
|
|
1040
|
+
* the 'count' parameter of the data object to select the appropriate format
|
|
1041
|
+
* from the 'when' property. For example:
|
|
1042
|
+
*
|
|
1043
|
+
* ```typescript
|
|
1044
|
+
* import { format } from '@grapecity/wijmo';
|
|
1045
|
+
* fmtObj fmt = {
|
|
1046
|
+
* count: 'count',
|
|
1047
|
+
* when: {
|
|
1048
|
+
* 0: 'No items selected.',
|
|
1049
|
+
* 1: 'One item is selected.',
|
|
1050
|
+
* 2: 'A pair is selected.',
|
|
1051
|
+
* 'other': '{count:n0} items are selected.'
|
|
1052
|
+
* }
|
|
1053
|
+
* };
|
|
1054
|
+
* let fmt = JSON.stringify(fmtObj);
|
|
1055
|
+
* console.log(format(fmt, { count: 0 })); // No items selected.
|
|
1056
|
+
* console.log(format(fmt, { count: 1 })); // One item is selected.
|
|
1057
|
+
* console.log(format(fmt, { count: 2 })); // A pair is selected.
|
|
1058
|
+
* console.log(format(fmt, { count: 12 })); // 12 items are selected.
|
|
1059
|
+
* ```
|
|
1060
|
+
*
|
|
1061
|
+
* The optional <b>formatFunction</b> allows you to customize the content by
|
|
1062
|
+
* providing context-sensitive formatting. If provided, the format function
|
|
1063
|
+
* gets called for each format element and gets passed the data object, the
|
|
1064
|
+
* parameter name, the format, and the value; it should return an output string.
|
|
1065
|
+
* For example:
|
|
1066
|
+
*
|
|
1067
|
+
* ```typescript
|
|
1068
|
+
* import { format, isString, escapeHtml } from '@grapecity/wijmo';
|
|
1069
|
+
* let data = { name: 'Joe', amount: 123456 },
|
|
1070
|
+
* msg = format('Hello {name}, you won {amount:n2}!', data,
|
|
1071
|
+
* (data, name, fmt, val) => {
|
|
1072
|
+
* if (isString(data[name])) {
|
|
1073
|
+
* val = escapeHtml(data[name]);
|
|
1074
|
+
* }
|
|
1075
|
+
* return val;
|
|
1076
|
+
* }
|
|
1077
|
+
* );
|
|
1078
|
+
* ```
|
|
1079
|
+
*
|
|
1080
|
+
* @param format A composite format string.
|
|
1081
|
+
* @param data The data object used to build the string.
|
|
1082
|
+
* @param formatFunction An optional function used to format items in context.
|
|
1083
|
+
* @return The formatted string.
|
|
1084
|
+
*/
|
|
1085
|
+
export declare function format(format: string, data: any, formatFunction?: Function): string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Tag function for use with template literals.
|
|
1088
|
+
*
|
|
1089
|
+
* The {@link glbz} tag function allows you to specify formatting for
|
|
1090
|
+
* variables in template literal expressions.
|
|
1091
|
+
*
|
|
1092
|
+
* To format a variable in a template literal using {@link glbz}, add a
|
|
1093
|
+
* colon and the format string after the name of the variable you want
|
|
1094
|
+
* to format.
|
|
1095
|
+
*
|
|
1096
|
+
* For example:
|
|
1097
|
+
*
|
|
1098
|
+
* ```typescript
|
|
1099
|
+
* import { glbz } from '@grapecity/wijmo';
|
|
1100
|
+
* let num = 42,
|
|
1101
|
+
* dt = new Date(),
|
|
1102
|
+
* msg = glbz`the number is ${num}:n2, and the date is ${dt}:'MMM d, yyyy'!`;
|
|
1103
|
+
* ```
|
|
1104
|
+
*/
|
|
1105
|
+
export declare function glbz(...args: any[]): string;
|
|
1106
|
+
/**
|
|
1107
|
+
* Evaluates a string in template literal notation.
|
|
1108
|
+
*
|
|
1109
|
+
* This function allows you to evaluate template literals on-demand,
|
|
1110
|
+
* rather than when they are declared.
|
|
1111
|
+
*
|
|
1112
|
+
* The template string uses the standard template literal syntax,
|
|
1113
|
+
* except it is a regular string (enclosed in single or double
|
|
1114
|
+
* quotes) rather than a template literal (enclosed in back-quotes).
|
|
1115
|
+
*
|
|
1116
|
+
* The template string may contain references to variables provided
|
|
1117
|
+
* in a context object passed as a parameter.
|
|
1118
|
+
*
|
|
1119
|
+
* The template string may contain formatting information as
|
|
1120
|
+
* used with the {@link glbz} tag function.
|
|
1121
|
+
*
|
|
1122
|
+
* For example:
|
|
1123
|
+
* ```typescript
|
|
1124
|
+
* import { evalTemplate } from '@grapecity/wijmo';
|
|
1125
|
+
* const msg = evalTemplate('hello ${user}, want some ${Math.PI}:n2?', { user: 'Chris' }));
|
|
1126
|
+
* console.log(msg);
|
|
1127
|
+
* > hello Chris, want some 3.14?
|
|
1128
|
+
* ```
|
|
1129
|
+
*
|
|
1130
|
+
* @param template String in template literal notation.
|
|
1131
|
+
* @param ctx Object with properties acessible to the template.
|
|
1132
|
+
* @returns A string containing the result.
|
|
1133
|
+
*/
|
|
1134
|
+
export declare function evalTemplate(template: string, ctx?: any): string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Clamps a value between a minimum and a maximum.
|
|
1137
|
+
*
|
|
1138
|
+
* @param value Original value.
|
|
1139
|
+
* @param min Minimum allowed value.
|
|
1140
|
+
* @param max Maximum allowed value.
|
|
1141
|
+
*/
|
|
1142
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
1143
|
+
/**
|
|
1144
|
+
* Copies properties from an object to another.
|
|
1145
|
+
*
|
|
1146
|
+
* This method is typically used to initialize controls and other Wijmo objects
|
|
1147
|
+
* by setting their properties and assigning event handlers.
|
|
1148
|
+
*
|
|
1149
|
+
* The destination object must define all the properties defined in the source,
|
|
1150
|
+
* or an error will be thrown.
|
|
1151
|
+
*
|
|
1152
|
+
* @param dst The destination object.
|
|
1153
|
+
* @param src The source object.
|
|
1154
|
+
* @returns The destination object.
|
|
1155
|
+
*/
|
|
1156
|
+
export declare function copy(dst: any, src: any): any;
|
|
1157
|
+
/**
|
|
1158
|
+
* Throws an exception if a condition is false.
|
|
1159
|
+
*
|
|
1160
|
+
* @param condition Condition expected to be true.
|
|
1161
|
+
* @param msg Message of the exception if the condition is not true.
|
|
1162
|
+
*/
|
|
1163
|
+
export declare function assert(condition: boolean, msg: string): void;
|
|
1164
|
+
/**
|
|
1165
|
+
* Outputs a message to indicate a member has been deprecated.
|
|
1166
|
+
*
|
|
1167
|
+
* @param oldMember Member that has been deprecated.
|
|
1168
|
+
* @param newMember Member that replaces the one that has been deprecated.
|
|
1169
|
+
*/
|
|
1170
|
+
export declare function _deprecated(oldMember: string, newMember: string): void;
|
|
1171
|
+
/**
|
|
1172
|
+
* Asserts that a value is a string.
|
|
1173
|
+
*
|
|
1174
|
+
* @param value Value supposed to be a string.
|
|
1175
|
+
* @param nullOK Whether null values are acceptable.
|
|
1176
|
+
* @return The string passed in.
|
|
1177
|
+
*/
|
|
1178
|
+
export declare function asString(value: string, nullOK?: boolean): string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Asserts that a value is a number.
|
|
1181
|
+
*
|
|
1182
|
+
* @param value Value supposed to be numeric.
|
|
1183
|
+
* @param nullOK Whether null values are acceptable.
|
|
1184
|
+
* @param positive Whether to accept only positive numeric values.
|
|
1185
|
+
* @return The number passed in.
|
|
1186
|
+
*/
|
|
1187
|
+
export declare function asNumber(value: number, nullOK?: boolean, positive?: boolean): number;
|
|
1188
|
+
/**
|
|
1189
|
+
* Asserts that a value is an integer.
|
|
1190
|
+
*
|
|
1191
|
+
* @param value Value supposed to be an integer.
|
|
1192
|
+
* @param nullOK Whether null values are acceptable.
|
|
1193
|
+
* @param positive Whether to accept only positive integers.
|
|
1194
|
+
* @return The number passed in.
|
|
1195
|
+
*/
|
|
1196
|
+
export declare function asInt(value: number, nullOK?: boolean, positive?: boolean): number;
|
|
1197
|
+
/**
|
|
1198
|
+
* Asserts that a value is a Boolean.
|
|
1199
|
+
*
|
|
1200
|
+
* @param value Value supposed to be Boolean.
|
|
1201
|
+
* @param nullOK Whether null values are acceptable.
|
|
1202
|
+
* @return The Boolean passed in.
|
|
1203
|
+
*/
|
|
1204
|
+
export declare function asBoolean(value: boolean, nullOK?: boolean): boolean;
|
|
1205
|
+
/**
|
|
1206
|
+
* Asserts that a value is a Date.
|
|
1207
|
+
*
|
|
1208
|
+
* @param value Value supposed to be a Date.
|
|
1209
|
+
* @param nullOK Whether null values are acceptable.
|
|
1210
|
+
* @return The Date passed in.
|
|
1211
|
+
*/
|
|
1212
|
+
export declare function asDate(value: Date, nullOK?: boolean): Date;
|
|
1213
|
+
/**
|
|
1214
|
+
* Asserts that a value is a function.
|
|
1215
|
+
*
|
|
1216
|
+
* @param value Value supposed to be a function.
|
|
1217
|
+
* @param nullOK Whether null values are acceptable.
|
|
1218
|
+
* @return The function passed in.
|
|
1219
|
+
*/
|
|
1220
|
+
export declare function asFunction(value: any, nullOK?: boolean): Function;
|
|
1221
|
+
/**
|
|
1222
|
+
* Asserts that a value is an array.
|
|
1223
|
+
*
|
|
1224
|
+
* @param value Value supposed to be an array.
|
|
1225
|
+
* @param nullOK Whether null values are acceptable.
|
|
1226
|
+
* @return The array passed in.
|
|
1227
|
+
*/
|
|
1228
|
+
export declare function asArray(value: any, nullOK?: boolean): any[];
|
|
1229
|
+
/**
|
|
1230
|
+
* Asserts that a value is an instance of a given type.
|
|
1231
|
+
*
|
|
1232
|
+
* @param value Value to be checked.
|
|
1233
|
+
* @param type Type of value expected.
|
|
1234
|
+
* @param nullOK Whether null values are acceptable.
|
|
1235
|
+
* @return The value passed in.
|
|
1236
|
+
*/
|
|
1237
|
+
export declare function asType(value: any, type: any, nullOK?: boolean): any;
|
|
1238
|
+
/**
|
|
1239
|
+
* Asserts that a value is a valid setting for an enumeration.
|
|
1240
|
+
*
|
|
1241
|
+
* @param value Value supposed to be a member of the enumeration.
|
|
1242
|
+
* @param enumType Enumeration to test for.
|
|
1243
|
+
* @param nullOK Whether null values are acceptable.
|
|
1244
|
+
* @return The value passed in.
|
|
1245
|
+
*/
|
|
1246
|
+
export declare function asEnum(value: number, enumType: any, nullOK?: boolean): number;
|
|
1247
|
+
/**
|
|
1248
|
+
* Asserts that a value is an {@link ICollectionView} or an Array.
|
|
1249
|
+
*
|
|
1250
|
+
* @param value Array or {@link ICollectionView}.
|
|
1251
|
+
* @param nullOK Whether null values are acceptable.
|
|
1252
|
+
* @return The {@link ICollectionView} that was passed in or a {@link CollectionView}
|
|
1253
|
+
* created from the array that was passed in.
|
|
1254
|
+
*/
|
|
1255
|
+
export declare function asCollectionView(value: any, nullOK?: boolean): ICollectionView;
|
|
1256
|
+
/**
|
|
1257
|
+
* Checks whether an {@link ICollectionView} is defined and not empty.
|
|
1258
|
+
*
|
|
1259
|
+
* @param value {@link ICollectionView} to check.
|
|
1260
|
+
*/
|
|
1261
|
+
export declare function hasItems(value: ICollectionView): boolean;
|
|
1262
|
+
/**
|
|
1263
|
+
* Converts a camel-cased string into a header-type string by capitalizing the first letter
|
|
1264
|
+
* and adding spaces before uppercase characters preceded by lower-case characters.
|
|
1265
|
+
*
|
|
1266
|
+
* For example, 'somePropertyName' becomes 'Some Property Name'.
|
|
1267
|
+
*
|
|
1268
|
+
* @param text String to convert to header case.
|
|
1269
|
+
*/
|
|
1270
|
+
export declare function toHeaderCase(text: string): string;
|
|
1271
|
+
/**
|
|
1272
|
+
* Escapes a string by replacing HTML characters with text entities.
|
|
1273
|
+
*
|
|
1274
|
+
* Strings entered by users should always be escaped before they are displayed
|
|
1275
|
+
* in HTML pages. This helps ensure page integrity and prevent HTML/javascript
|
|
1276
|
+
* injection attacks.
|
|
1277
|
+
*
|
|
1278
|
+
* @param text Text to escape.
|
|
1279
|
+
* @return An HTML-escaped version of the original string.
|
|
1280
|
+
*/
|
|
1281
|
+
export declare function escapeHtml(text: string): string;
|
|
1282
|
+
/**
|
|
1283
|
+
* Escapes a string by prefixing special regular expression characters
|
|
1284
|
+
* with backslashes.
|
|
1285
|
+
*
|
|
1286
|
+
* @param text Text to escape.
|
|
1287
|
+
* @return A RegExp-escaped version of the original string.
|
|
1288
|
+
*/
|
|
1289
|
+
export declare function escapeRegExp(text: string): string;
|
|
1290
|
+
/**
|
|
1291
|
+
* Converts an HTML string into plain text.
|
|
1292
|
+
*
|
|
1293
|
+
* @param html HTML string to convert to plain text.
|
|
1294
|
+
* @return A plain-text version of the string.
|
|
1295
|
+
*/
|
|
1296
|
+
export declare function toPlainText(html: string): string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Checks whether an element has a class.
|
|
1299
|
+
*
|
|
1300
|
+
* @param e Element to check.
|
|
1301
|
+
* @param className Class to check for.
|
|
1302
|
+
*/
|
|
1303
|
+
export declare function hasClass(e: Element, className: string): boolean;
|
|
1304
|
+
/**
|
|
1305
|
+
* Adds a class to an element.
|
|
1306
|
+
*
|
|
1307
|
+
* @param e Element that will have the class added.
|
|
1308
|
+
* @param className Class (or space-separated list of classes) to add to the element.
|
|
1309
|
+
*/
|
|
1310
|
+
export declare function addClass(e: Element, className: string): void;
|
|
1311
|
+
/**
|
|
1312
|
+
* Removes a class from an element.
|
|
1313
|
+
*
|
|
1314
|
+
* @param e Element that will have the class removed.
|
|
1315
|
+
* @param className Class (or space-separated list of classes) to remove from the element.
|
|
1316
|
+
*/
|
|
1317
|
+
export declare function removeClass(e: Element, className: string): void;
|
|
1318
|
+
/**
|
|
1319
|
+
* Adds or removes a class to or from an element.
|
|
1320
|
+
*
|
|
1321
|
+
* @param e Element that will have the class added.
|
|
1322
|
+
* @param className Class to add or remove.
|
|
1323
|
+
* @param addOrRemove Whether to add or remove the class. If not provided, toggle the class.
|
|
1324
|
+
*/
|
|
1325
|
+
export declare function toggleClass(e: Element, className: string, addOrRemove?: boolean): void;
|
|
1326
|
+
/**
|
|
1327
|
+
* Sets or clears an attribute on an element.
|
|
1328
|
+
*
|
|
1329
|
+
* @param e Element that will be updated.
|
|
1330
|
+
* @param name Name of the attribute to add or remove.
|
|
1331
|
+
* @param value Value of the attribute, or null to remove the attribute
|
|
1332
|
+
* from the element.
|
|
1333
|
+
* @param keep Whether to keep original attribute if present.
|
|
1334
|
+
*/
|
|
1335
|
+
export declare function setAttribute(e: Element, name: string, value?: any, keep?: boolean): void;
|
|
1336
|
+
/**
|
|
1337
|
+
* Sets the checked and indeterminate properties of a checkbox input
|
|
1338
|
+
* element.
|
|
1339
|
+
*
|
|
1340
|
+
* @param cb Checkbox element.
|
|
1341
|
+
* @param checked True, false, or null for checked, unchecked, or indeterminate.
|
|
1342
|
+
*/
|
|
1343
|
+
export declare function setChecked(cb: HTMLInputElement, checked: boolean): void;
|
|
1344
|
+
/**
|
|
1345
|
+
* Sets or clears an element's <b>aria-label</b> attribute.
|
|
1346
|
+
*
|
|
1347
|
+
* @param e Element that will be updated.
|
|
1348
|
+
* @param value Value of the aria label, or null to remove the label
|
|
1349
|
+
* from the element.
|
|
1350
|
+
*/
|
|
1351
|
+
export declare function setAriaLabel(e: Element, value?: string): void;
|
|
1352
|
+
/**
|
|
1353
|
+
* Sets the start and end positions of a selection in a text field.
|
|
1354
|
+
*
|
|
1355
|
+
* This method is similar to the native {@link setSelectionRange} method
|
|
1356
|
+
* in HTMLInputElement objects, except it checks for conditions that
|
|
1357
|
+
* may cause exceptions (element not in the DOM, disabled, or hidden).
|
|
1358
|
+
*
|
|
1359
|
+
* @param e HTMLInputElement or HTMLTextAreaElement to select.
|
|
1360
|
+
* @param start Offset into the text field for the start of the selection.
|
|
1361
|
+
* @param end Offset into the text field for the end of the selection.
|
|
1362
|
+
*/
|
|
1363
|
+
export declare function setSelectionRange(e: any, start: number, end?: number, needFocus?: boolean): boolean;
|
|
1364
|
+
/**
|
|
1365
|
+
* Disables the autocomplete, autocorrect, autocapitalize, and spellcheck
|
|
1366
|
+
* properties of an input element.
|
|
1367
|
+
*
|
|
1368
|
+
* @param e The input element.
|
|
1369
|
+
*/
|
|
1370
|
+
export declare function disableAutoComplete(e: HTMLInputElement): void;
|
|
1371
|
+
/**
|
|
1372
|
+
* Safely removes an element from the DOM tree.
|
|
1373
|
+
*
|
|
1374
|
+
* @param e Element to remove from the DOM tree.
|
|
1375
|
+
*/
|
|
1376
|
+
export declare function removeChild(e: Node): Node;
|
|
1377
|
+
/**
|
|
1378
|
+
* Gets a reference to the element that contains the focus,
|
|
1379
|
+
* accounting for shadow document fragments.
|
|
1380
|
+
*/
|
|
1381
|
+
export declare function getActiveElement(): HTMLElement;
|
|
1382
|
+
export declare function _getActiveElement(): HTMLElement;
|
|
1383
|
+
/**
|
|
1384
|
+
* Moves the focus to the next/previous/first focusable child within
|
|
1385
|
+
* a given parent element.
|
|
1386
|
+
*
|
|
1387
|
+
* @param parent Parent element.
|
|
1388
|
+
* @param offset Offset to use when moving the focus (use zero to focus on the first focusable child).
|
|
1389
|
+
* @return True if the focus was set, false if a focusable element was not found.
|
|
1390
|
+
*/
|
|
1391
|
+
export declare function moveFocus(parent: HTMLElement, offset: number): boolean;
|
|
1392
|
+
/**
|
|
1393
|
+
* Saves content to a file.
|
|
1394
|
+
*
|
|
1395
|
+
* @param content A string or a Blob object to be saved to a file.
|
|
1396
|
+
* @param fileName Name of the file to save, including extension.
|
|
1397
|
+
* @param type Optional file MIME type, used if the **content** argument is a string.
|
|
1398
|
+
*
|
|
1399
|
+
* The {@link saveFile} method can be used to create text files
|
|
1400
|
+
* (txt, csv, html) as well as image files.
|
|
1401
|
+
*
|
|
1402
|
+
* For example, this code saves the current selection of a FlexGrid to a CSV file:
|
|
1403
|
+
*
|
|
1404
|
+
* ```typescript
|
|
1405
|
+
* import { saveFile } from '@grapecity/wijmo';
|
|
1406
|
+
* const clipString = theGrid.getClipString(null, true, true, false);
|
|
1407
|
+
* saveFile(clipString, 'grid.csv', 'text/csv');
|
|
1408
|
+
* ```
|
|
1409
|
+
*
|
|
1410
|
+
* And this code saves the content of a canvas element to a JPG file:
|
|
1411
|
+
*
|
|
1412
|
+
* ```typescript
|
|
1413
|
+
* import { saveFile } from '@grapecity/wijmo';
|
|
1414
|
+
*
|
|
1415
|
+
* canvas.toBlob(blob => {
|
|
1416
|
+
* saveFile(blob, 'image.jpg');
|
|
1417
|
+
* }, 'image/jpeg');
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
export declare function saveFile(content: string | Blob, fileName: string, type?: string): void;
|
|
1421
|
+
/**
|
|
1422
|
+
* Gets an element from a query selector.
|
|
1423
|
+
*
|
|
1424
|
+
* @param selector An element, a query selector string, or a jQuery object.
|
|
1425
|
+
*/
|
|
1426
|
+
export declare function getElement(selector: any): HTMLElement;
|
|
1427
|
+
/**
|
|
1428
|
+
* Creates an element from an HTML string.
|
|
1429
|
+
*
|
|
1430
|
+
* @param html HTML fragment to convert into an HTMLElement.
|
|
1431
|
+
* @param appendTo Optional HTMLElement to append the new element to.
|
|
1432
|
+
* @param css Optional CSS attributes to apply to the root of the new element.
|
|
1433
|
+
* @return The new element.
|
|
1434
|
+
*/
|
|
1435
|
+
export declare function createElement(html: string, appendTo?: HTMLElement, css?: any): HTMLElement;
|
|
1436
|
+
/**
|
|
1437
|
+
* Sets the text content of an element.
|
|
1438
|
+
*
|
|
1439
|
+
* @param e Element that will have its content updated.
|
|
1440
|
+
* @param text Plain text to be assigned to the element.
|
|
1441
|
+
*/
|
|
1442
|
+
export declare function setText(e: HTMLElement, text: string): void;
|
|
1443
|
+
/**
|
|
1444
|
+
* Checks whether an HTML element contains another.
|
|
1445
|
+
*
|
|
1446
|
+
* @param parent Parent element.
|
|
1447
|
+
* @param child Child element.
|
|
1448
|
+
* @param popup Whether to take Wijmo popups into account.
|
|
1449
|
+
* @return True if the parent element contains the child element.
|
|
1450
|
+
*/
|
|
1451
|
+
export declare function contains(parent: any, child: any, popup?: boolean): boolean;
|
|
1452
|
+
/**
|
|
1453
|
+
* Finds the closest ancestor (including the original element) that satisfies a selector.
|
|
1454
|
+
*
|
|
1455
|
+
* @param e Element where the search should start.
|
|
1456
|
+
* @param selector A string containing a selector expression to match elements against.
|
|
1457
|
+
* @return The closest ancestor that satisfies the selector, or null if not found.
|
|
1458
|
+
*/
|
|
1459
|
+
export declare function closest(e: any, selector: string): Element;
|
|
1460
|
+
/**
|
|
1461
|
+
* Finds the closest ancestor (including the original element) that satisfies a class selector.
|
|
1462
|
+
*
|
|
1463
|
+
* @param e Element where the search should start.
|
|
1464
|
+
* @param className A string containing the class name to match elements against.
|
|
1465
|
+
* @return The closest ancestor that has the specified class name, or null if not found.
|
|
1466
|
+
*/
|
|
1467
|
+
export declare function closestClass(e: any, className: string): Node;
|
|
1468
|
+
/**
|
|
1469
|
+
* Enables or disables an element.
|
|
1470
|
+
*
|
|
1471
|
+
* @param e Element to enable or disable.
|
|
1472
|
+
* @param value Whether to enable or disable the element.
|
|
1473
|
+
*/
|
|
1474
|
+
export declare function enable(e: HTMLElement, value: boolean): void;
|
|
1475
|
+
/**
|
|
1476
|
+
* Gets the bounding rectangle of an element in page coordinates.
|
|
1477
|
+
*
|
|
1478
|
+
* This is similar to the <b>getBoundingClientRect</b> function,
|
|
1479
|
+
* except that uses viewport coordinates, which change when the
|
|
1480
|
+
* document scrolls.
|
|
1481
|
+
*/
|
|
1482
|
+
export declare function getElementRect(e: Element): Rect;
|
|
1483
|
+
/**
|
|
1484
|
+
* Modifies the style of an element by applying the properties specified in an object.
|
|
1485
|
+
*
|
|
1486
|
+
* @param e Element or array of elements whose style will be modified.
|
|
1487
|
+
* @param css Object containing the style properties to apply to the element.
|
|
1488
|
+
*/
|
|
1489
|
+
export declare function setCss(e: any, css: any): void;
|
|
1490
|
+
/**
|
|
1491
|
+
* Represents a method called periodically while handling calls to
|
|
1492
|
+
* the {@link animate} method.
|
|
1493
|
+
*/
|
|
1494
|
+
export interface IAnimateCallback {
|
|
1495
|
+
/**
|
|
1496
|
+
* @param percentage Value ranging from zero to one that indicates how
|
|
1497
|
+
* far along the animation is.
|
|
1498
|
+
*/
|
|
1499
|
+
(percentage: number): void;
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Calls a function on a timer with a parameter varying between zero and one.
|
|
1503
|
+
*
|
|
1504
|
+
* Use this function to create animations by modifying document properties
|
|
1505
|
+
* or styles on a timer.
|
|
1506
|
+
*
|
|
1507
|
+
* For example, the code below changes the opacity of an element from zero
|
|
1508
|
+
* to one in one second:
|
|
1509
|
+
*
|
|
1510
|
+
* ```typescript
|
|
1511
|
+
* import { animate } from '@grapecity/wijmo';
|
|
1512
|
+
* const element = document.getElementById('someElement');
|
|
1513
|
+
* animate(pct => {
|
|
1514
|
+
* element.style.opacity = pct;
|
|
1515
|
+
* }, 1000);
|
|
1516
|
+
* ```
|
|
1517
|
+
*
|
|
1518
|
+
* The function returns an interval ID that you can use to stop the
|
|
1519
|
+
* animation. This is typically done when you are starting a new animation
|
|
1520
|
+
* and wish to suspend other on-going animations on the same element.
|
|
1521
|
+
* For example, the code below keeps track of the interval ID and clears
|
|
1522
|
+
* if before starting a new animation:
|
|
1523
|
+
*
|
|
1524
|
+
* ```typescript
|
|
1525
|
+
* import { animate } from '@grapecity/wijmo';
|
|
1526
|
+
* const element = document.getElementById('someElement');
|
|
1527
|
+
* if (this._animInterval) {
|
|
1528
|
+
* clearInterval(this._animInterval);
|
|
1529
|
+
* }
|
|
1530
|
+
* this._animInterval = animate(pct => {
|
|
1531
|
+
* element.style.opacity = pct;
|
|
1532
|
+
* if (pct == 1) {
|
|
1533
|
+
* self._animInterval = null;
|
|
1534
|
+
* }
|
|
1535
|
+
* }, 1000);
|
|
1536
|
+
* ```
|
|
1537
|
+
*
|
|
1538
|
+
* @param apply Callback function that modifies the document.
|
|
1539
|
+
* The function takes a single parameter that represents a percentage.
|
|
1540
|
+
* @param duration The duration of the animation, in milliseconds.
|
|
1541
|
+
* @param step The interval between animation frames, in milliseconds.
|
|
1542
|
+
* @return An interval id that you can use to suspend the animation.
|
|
1543
|
+
*/
|
|
1544
|
+
export declare function animate(apply: IAnimateCallback, duration?: number, step?: number): any;
|
|
1545
|
+
/**
|
|
1546
|
+
* Class that represents a point (with x and y coordinates).
|
|
1547
|
+
*/
|
|
1548
|
+
export declare class Point {
|
|
1549
|
+
/**
|
|
1550
|
+
* Gets or sets the x coordinate of this {@link Point}.
|
|
1551
|
+
*/
|
|
1552
|
+
x: number;
|
|
1553
|
+
/**
|
|
1554
|
+
* Gets or sets the y coordinate of this {@link Point}.
|
|
1555
|
+
*/
|
|
1556
|
+
y: number;
|
|
1557
|
+
/**
|
|
1558
|
+
* Initializes a new instance of the {@link Point} class.
|
|
1559
|
+
*
|
|
1560
|
+
* @param x X coordinate of the new Point.
|
|
1561
|
+
* @param y Y coordinate of the new Point.
|
|
1562
|
+
*/
|
|
1563
|
+
constructor(x?: number, y?: number);
|
|
1564
|
+
/**
|
|
1565
|
+
* Returns true if a {@link Point} has the same coordinates as this {@link Point}.
|
|
1566
|
+
*
|
|
1567
|
+
* @param pt {@link Point} to compare to this {@link Point}.
|
|
1568
|
+
*/
|
|
1569
|
+
equals(pt: Point): boolean;
|
|
1570
|
+
/**
|
|
1571
|
+
* Creates a copy of this {@link Point}.
|
|
1572
|
+
*/
|
|
1573
|
+
clone(): Point;
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Class that represents a size (with width and height).
|
|
1577
|
+
*/
|
|
1578
|
+
export declare class Size {
|
|
1579
|
+
/**
|
|
1580
|
+
* Gets or sets the width of this {@link Size}.
|
|
1581
|
+
*/
|
|
1582
|
+
width: number;
|
|
1583
|
+
/**
|
|
1584
|
+
* Gets or sets the height of this {@link Size}.
|
|
1585
|
+
*/
|
|
1586
|
+
height: number;
|
|
1587
|
+
/**
|
|
1588
|
+
* Initializes a new instance of the {@link Size} class.
|
|
1589
|
+
*
|
|
1590
|
+
* @param width Width of the new {@link Size}.
|
|
1591
|
+
* @param height Height of the new {@link Size}.
|
|
1592
|
+
*/
|
|
1593
|
+
constructor(width?: number, height?: number);
|
|
1594
|
+
/**
|
|
1595
|
+
* Returns true if a {@link Size} has the same dimensions as this {@link Size}.
|
|
1596
|
+
*
|
|
1597
|
+
* @param sz {@link Size} to compare to this {@link Size}.
|
|
1598
|
+
*/
|
|
1599
|
+
equals(sz: Size): boolean;
|
|
1600
|
+
/**
|
|
1601
|
+
* Creates a copy of this {@link Size}.
|
|
1602
|
+
*/
|
|
1603
|
+
clone(): Size;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Class that represents a rectangle (with left, top, width, and height).
|
|
1607
|
+
*/
|
|
1608
|
+
export declare class Rect {
|
|
1609
|
+
/**
|
|
1610
|
+
* Gets or sets the left coordinate of this {@link Rect}.
|
|
1611
|
+
*/
|
|
1612
|
+
left: number;
|
|
1613
|
+
/**
|
|
1614
|
+
* Gets or sets the top coordinate of this {@link Rect}.
|
|
1615
|
+
*/
|
|
1616
|
+
top: number;
|
|
1617
|
+
/**
|
|
1618
|
+
* Gets or sets the width of this {@link Rect}.
|
|
1619
|
+
*/
|
|
1620
|
+
width: number;
|
|
1621
|
+
/**
|
|
1622
|
+
* Gets or sets the height of this {@link Rect}.
|
|
1623
|
+
*/
|
|
1624
|
+
height: number;
|
|
1625
|
+
/**
|
|
1626
|
+
* Initializes a new instance of the {@link Rect} class.
|
|
1627
|
+
*
|
|
1628
|
+
* @param left Left coordinate of the new {@link Rect}.
|
|
1629
|
+
* @param top Top coordinate of the new {@link Rect}.
|
|
1630
|
+
* @param width Width of the new {@link Rect}.
|
|
1631
|
+
* @param height Height of the new {@link Rect}.
|
|
1632
|
+
*/
|
|
1633
|
+
constructor(left: number, top: number, width: number, height: number);
|
|
1634
|
+
/**
|
|
1635
|
+
* Gets the right coordinate of this {@link Rect}.
|
|
1636
|
+
*/
|
|
1637
|
+
readonly right: number;
|
|
1638
|
+
/**
|
|
1639
|
+
* Gets the bottom coordinate of this {@link Rect}.
|
|
1640
|
+
*/
|
|
1641
|
+
readonly bottom: number;
|
|
1642
|
+
/**
|
|
1643
|
+
* Returns true if a {@link Rect} has the same coordinates and dimensions
|
|
1644
|
+
* as this {@link Rect}.
|
|
1645
|
+
*
|
|
1646
|
+
* @param rc {@link Rect} to compare to this {@link Rect}.
|
|
1647
|
+
*/
|
|
1648
|
+
equals(rc: Rect): boolean;
|
|
1649
|
+
/**
|
|
1650
|
+
* Creates a copy of this {@link Rect}.
|
|
1651
|
+
*/
|
|
1652
|
+
clone(): Rect;
|
|
1653
|
+
/**
|
|
1654
|
+
* Creates a {@link Rect} from <b>ClientRect</b> or <b>SVGRect</b> objects.
|
|
1655
|
+
*
|
|
1656
|
+
* @param rc Rectangle obtained by a call to the DOM's <b>getBoundingClientRect</b>
|
|
1657
|
+
* or <b>GetBoundingBox</b> methods.
|
|
1658
|
+
*/
|
|
1659
|
+
static fromBoundingRect(rc: any): Rect;
|
|
1660
|
+
/**
|
|
1661
|
+
* Gets a rectangle that represents the union of two rectangles.
|
|
1662
|
+
*
|
|
1663
|
+
* @param rc1 First rectangle.
|
|
1664
|
+
* @param rc2 Second rectangle.
|
|
1665
|
+
*/
|
|
1666
|
+
static union(rc1: Rect, rc2: Rect): Rect;
|
|
1667
|
+
/**
|
|
1668
|
+
* Gets a rectangle that represents the intersection of two rectangles.
|
|
1669
|
+
*
|
|
1670
|
+
* @param rc1 First rectangle.
|
|
1671
|
+
* @param rc2 Second rectangle.
|
|
1672
|
+
*/
|
|
1673
|
+
static intersection(rc1: Rect, rc2: Rect): Rect;
|
|
1674
|
+
/**
|
|
1675
|
+
* Determines whether the rectangle contains a given point or rectangle.
|
|
1676
|
+
*
|
|
1677
|
+
* @param pt The {@link Point} or {@link Rect} to ckeck.
|
|
1678
|
+
*/
|
|
1679
|
+
contains(pt: any): boolean;
|
|
1680
|
+
/**
|
|
1681
|
+
* Creates a rectangle that results from expanding or shrinking a rectangle by the specified amounts.
|
|
1682
|
+
*
|
|
1683
|
+
* @param dx The amount by which to expand or shrink the left and right sides of the rectangle.
|
|
1684
|
+
* @param dy The amount by which to expand or shrink the top and bottom sides of the rectangle.
|
|
1685
|
+
*/
|
|
1686
|
+
inflate(dx: number, dy: number): Rect;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Provides date and time utilities.
|
|
1690
|
+
*/
|
|
1691
|
+
export declare class DateTime {
|
|
1692
|
+
/**
|
|
1693
|
+
* Gets a new Date that adds the specified number of days to a given Date.
|
|
1694
|
+
*
|
|
1695
|
+
* @param value Original date.
|
|
1696
|
+
* @param days Number of days to add to the given date.
|
|
1697
|
+
*/
|
|
1698
|
+
static addDays(value: Date, days: number): Date;
|
|
1699
|
+
/**
|
|
1700
|
+
* Gets a new Date that adds the specified number of months to a given Date.
|
|
1701
|
+
*
|
|
1702
|
+
* @param value Original date.
|
|
1703
|
+
* @param months Number of months to add to the given date.
|
|
1704
|
+
*/
|
|
1705
|
+
static addMonths(value: Date, months: number): Date;
|
|
1706
|
+
/**
|
|
1707
|
+
* Gets a new Date that adds the specified number of years to a given Date.
|
|
1708
|
+
*
|
|
1709
|
+
* @param value Original date.
|
|
1710
|
+
* @param years Number of years to add to the given date.
|
|
1711
|
+
*/
|
|
1712
|
+
static addYears(value: Date, years: number): Date;
|
|
1713
|
+
/**
|
|
1714
|
+
* Gets a new Date that adds the specified number of hours to a given Date.
|
|
1715
|
+
*
|
|
1716
|
+
* @param value Original date.
|
|
1717
|
+
* @param hours Number of hours to add to the given date.
|
|
1718
|
+
*/
|
|
1719
|
+
static addHours(value: Date, hours: number): Date;
|
|
1720
|
+
/**
|
|
1721
|
+
* Gets a new Date that adds the specified number of minutes to a given Date.
|
|
1722
|
+
*
|
|
1723
|
+
* @param value Original date.
|
|
1724
|
+
* @param minutes Number of minutes to add to the given date.
|
|
1725
|
+
*/
|
|
1726
|
+
static addMinutes(value: Date, minutes: number): Date;
|
|
1727
|
+
/**
|
|
1728
|
+
* Gets a new Date that adds the specified number of seconds to a given Date.
|
|
1729
|
+
*
|
|
1730
|
+
* @param value Original date.
|
|
1731
|
+
* @param seconds Number of seconds to add to the given date.
|
|
1732
|
+
*/
|
|
1733
|
+
static addSeconds(value: Date, seconds: number): Date;
|
|
1734
|
+
/**
|
|
1735
|
+
* Gets the first day of the week for a given Date.
|
|
1736
|
+
*
|
|
1737
|
+
* @param value Original date.
|
|
1738
|
+
* @param firstDayOfWeek First day of week (0 for Sunday, 1 for Monday, etc).
|
|
1739
|
+
* Defaults to first day of week for the current culture.
|
|
1740
|
+
*/
|
|
1741
|
+
static weekFirst(value: Date, firstDayOfWeek?: number): Date;
|
|
1742
|
+
/**
|
|
1743
|
+
* Gets the last day of the week for a given Date.
|
|
1744
|
+
*
|
|
1745
|
+
* @param value Original date.
|
|
1746
|
+
* @param firstDayOfWeek First day of week (0 for Sunday, 1 for Monday, etc).
|
|
1747
|
+
* Defaults to first day of week for the current culture.
|
|
1748
|
+
*/
|
|
1749
|
+
static weekLast(value: Date, firstDayOfWeek?: number): Date;
|
|
1750
|
+
/**
|
|
1751
|
+
* Gets the first day of the month for a given Date.
|
|
1752
|
+
*
|
|
1753
|
+
* @param value Original date.
|
|
1754
|
+
*/
|
|
1755
|
+
static monthFirst(value: Date): Date;
|
|
1756
|
+
/**
|
|
1757
|
+
* Gets the last day of the month for a given Date.
|
|
1758
|
+
*
|
|
1759
|
+
* @param value Original date.
|
|
1760
|
+
*/
|
|
1761
|
+
static monthLast(value: Date): Date;
|
|
1762
|
+
/**
|
|
1763
|
+
* Gets the first day of the year for a given Date.
|
|
1764
|
+
*
|
|
1765
|
+
* @param value Original date.
|
|
1766
|
+
*/
|
|
1767
|
+
static yearFirst(value: Date): Date;
|
|
1768
|
+
/**
|
|
1769
|
+
* Gets the last day of the year for a given Date.
|
|
1770
|
+
*
|
|
1771
|
+
* @param value Original date.
|
|
1772
|
+
*/
|
|
1773
|
+
static yearLast(value: Date): Date;
|
|
1774
|
+
/**
|
|
1775
|
+
* Returns true if two Date objects refer to the same date (ignoring time).
|
|
1776
|
+
*
|
|
1777
|
+
* @param d1 First date.
|
|
1778
|
+
* @param d2 Second date.
|
|
1779
|
+
*/
|
|
1780
|
+
static sameDate(d1: Date, d2: Date): boolean;
|
|
1781
|
+
/**
|
|
1782
|
+
* Returns true if two Date objects refer to the same time (ignoring date).
|
|
1783
|
+
*
|
|
1784
|
+
* @param d1 First date.
|
|
1785
|
+
* @param d2 Second date.
|
|
1786
|
+
*/
|
|
1787
|
+
static sameTime(d1: Date, d2: Date): boolean;
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns true if two Date objects refer to the same date and time
|
|
1790
|
+
* (or if both are null).
|
|
1791
|
+
*
|
|
1792
|
+
* @param d1 First date.
|
|
1793
|
+
* @param d2 Second date.
|
|
1794
|
+
*/
|
|
1795
|
+
static equals(d1: Date | null, d2: Date | null): boolean;
|
|
1796
|
+
/**
|
|
1797
|
+
* Gets a Date object with the date and time set on two Date objects.
|
|
1798
|
+
*
|
|
1799
|
+
* @param date Date object that contains the date (day/month/year).
|
|
1800
|
+
* @param time Date object that contains the time (hour:minute:second.millisecond).
|
|
1801
|
+
*/
|
|
1802
|
+
static fromDateTime(date: Date, time: Date): Date;
|
|
1803
|
+
/**
|
|
1804
|
+
* Converts a calendar date to a fiscal date using the current culture.
|
|
1805
|
+
*
|
|
1806
|
+
* @param date Calendar date.
|
|
1807
|
+
* @param govt Whether to use the government or corporate fiscal year.
|
|
1808
|
+
*/
|
|
1809
|
+
static toFiscal(date: Date, govt: boolean): Date;
|
|
1810
|
+
/**
|
|
1811
|
+
* Converts a fiscal year date to a calendar date using the current culture.
|
|
1812
|
+
*
|
|
1813
|
+
* @param date Fiscal year date.
|
|
1814
|
+
* @param govt Whether to use the government or corporate fiscal year.
|
|
1815
|
+
*/
|
|
1816
|
+
static fromFiscal(date: Date, govt: boolean): Date;
|
|
1817
|
+
/**
|
|
1818
|
+
* Gets a new Date object instance.
|
|
1819
|
+
*
|
|
1820
|
+
* @param year Integer value representing the year, defaults to current year.
|
|
1821
|
+
* @param month Integer value representing the month (0-11), defaults to current month.
|
|
1822
|
+
* @param day Integer value representing the day (1-31), defaults to current day.
|
|
1823
|
+
* @param hour Integer value representing the hour, defaults to zero.
|
|
1824
|
+
* @param min Integer value representing the minute, defaults to zero.
|
|
1825
|
+
* @param sec Integer value representing the second, defaults to zero.
|
|
1826
|
+
* @param ms Integer value representing the millisecond, defaults to zero.
|
|
1827
|
+
*/
|
|
1828
|
+
static newDate(year?: number, month?: number, day?: number, hour?: number, min?: number, sec?: number, ms?: number): Date;
|
|
1829
|
+
/**
|
|
1830
|
+
* Creates a copy of a given Date object.
|
|
1831
|
+
*
|
|
1832
|
+
* @param date Date object to copy.
|
|
1833
|
+
*/
|
|
1834
|
+
static clone(date: Date): Date;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Represents a set of options to be used with the {@link httpRequest} method.
|
|
1838
|
+
*/
|
|
1839
|
+
export interface IHttpRequestOptions {
|
|
1840
|
+
/**
|
|
1841
|
+
* The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
|
|
1842
|
+
* The default is "GET".
|
|
1843
|
+
*/
|
|
1844
|
+
method?: string;
|
|
1845
|
+
/**
|
|
1846
|
+
* Data to be sent to the server. It is appended to the url for GET requests,
|
|
1847
|
+
* and converted to a JSON string for other requests.
|
|
1848
|
+
*/
|
|
1849
|
+
data?: any;
|
|
1850
|
+
/**
|
|
1851
|
+
* A JavaScript object containing key/value pairs to be added to the request headers.
|
|
1852
|
+
*/
|
|
1853
|
+
requestHeaders?: any;
|
|
1854
|
+
/**
|
|
1855
|
+
* By default, all requests are sent asynchronously (i.e. this is set to true by default).
|
|
1856
|
+
* If you need to make synchronous requests, set this option to false.
|
|
1857
|
+
*/
|
|
1858
|
+
async?: boolean;
|
|
1859
|
+
/**
|
|
1860
|
+
* The number of milliseconds the request can take before automatically being terminated.
|
|
1861
|
+
* The default value is 0, which means there is no timeout.
|
|
1862
|
+
*/
|
|
1863
|
+
timeout?: number;
|
|
1864
|
+
/**
|
|
1865
|
+
* Function to be called if the request succeeds.
|
|
1866
|
+
* The function has a single parameter of type <b>XMLHttpRequest</b> that represents the request.
|
|
1867
|
+
*/
|
|
1868
|
+
success?: (x: XMLHttpRequest) => void;
|
|
1869
|
+
/**
|
|
1870
|
+
* Function to be called if the request fails.
|
|
1871
|
+
* The function has a single parameter of type <b>XMLHttpRequest</b> that represents the request.
|
|
1872
|
+
*/
|
|
1873
|
+
error?: (x: XMLHttpRequest) => void;
|
|
1874
|
+
/**
|
|
1875
|
+
* Function to be called when the request finishes (after success and error callbacks are executed).
|
|
1876
|
+
* The function has a single parameter of type <b>XMLHttpRequest</b> that represents the request.
|
|
1877
|
+
*/
|
|
1878
|
+
complete?: (x: XMLHttpRequest) => void;
|
|
1879
|
+
/**
|
|
1880
|
+
* Function to be called immediately before the request is sent.
|
|
1881
|
+
* The function has a single parameter of type <b>XMLHttpRequest</b> that represents the request.
|
|
1882
|
+
*/
|
|
1883
|
+
beforeSend?: (x: XMLHttpRequest) => void;
|
|
1884
|
+
/**
|
|
1885
|
+
* A username to be used with <b>XMLHttpRequest</b> in response to an HTTP access
|
|
1886
|
+
* authentication request.
|
|
1887
|
+
*/
|
|
1888
|
+
user?: string;
|
|
1889
|
+
/**
|
|
1890
|
+
* A password to be used with <b>XMLHttpRequest</b> in response to an HTTP access
|
|
1891
|
+
* authentication request.
|
|
1892
|
+
*/
|
|
1893
|
+
password?: string;
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Performs HTTP requests.
|
|
1897
|
+
*
|
|
1898
|
+
* Use the <b>success</b> method to obtain the result of the request which is provided in
|
|
1899
|
+
* the callback's <b>XMLHttpRequest</b> parameter. For example, the code below uses
|
|
1900
|
+
* the {@link httpRequest} method to retrieve a list of customers from an OData service:
|
|
1901
|
+
*
|
|
1902
|
+
* ```typescript
|
|
1903
|
+
* import { httpRequest } from '@grapecity/wijmo';
|
|
1904
|
+
* httpRequest('https://services.odata.org/Northwind/Northwind.svc/Customers?$format=json', {
|
|
1905
|
+
* success: xhr => {
|
|
1906
|
+
* let response = JSON.parse(xhr.responseText),
|
|
1907
|
+
* customers = response.value;
|
|
1908
|
+
* // do something with the customers...
|
|
1909
|
+
* }
|
|
1910
|
+
* });
|
|
1911
|
+
* ```
|
|
1912
|
+
*
|
|
1913
|
+
* @param url String containing the URL to which the request is sent.
|
|
1914
|
+
* @param options An optional {@link IHttpRequestOptions} object used to configure the request.
|
|
1915
|
+
* @return The <b>XMLHttpRequest</b> object used to perform the request.
|
|
1916
|
+
*/
|
|
1917
|
+
export declare function httpRequest(url: string, options?: IHttpRequestOptions): XMLHttpRequest;
|
|
1918
|
+
export declare function _registerModule(name: string, ref: any): void;
|
|
1919
|
+
export declare function _getModule(name: string): any;
|
|
1920
|
+
interface _IMap<K, V> {
|
|
1921
|
+
clear(): void;
|
|
1922
|
+
delete(key: K): any;
|
|
1923
|
+
get(key: K): V | undefined;
|
|
1924
|
+
has(key: K): boolean;
|
|
1925
|
+
set(key: K, value: V): this;
|
|
1926
|
+
readonly size: number;
|
|
1927
|
+
}
|
|
1928
|
+
export declare class _Map<K = any, V = any> {
|
|
1929
|
+
readonly _m: _IMap<K, V>;
|
|
1930
|
+
_h: any;
|
|
1931
|
+
/**
|
|
1932
|
+
* Creates an instance of the Map class wrapper.
|
|
1933
|
+
* @param pojoHash If true (default), then POJO hash object is used; otherwise, the Map is used.
|
|
1934
|
+
*/
|
|
1935
|
+
constructor(pojoHash?: boolean);
|
|
1936
|
+
readonly isPojoHash: boolean;
|
|
1937
|
+
readonly size: number;
|
|
1938
|
+
clear(): void;
|
|
1939
|
+
delete(key: K): void;
|
|
1940
|
+
get(key: K): V | undefined;
|
|
1941
|
+
has(key: K): boolean;
|
|
1942
|
+
set(key: K, value: V): this;
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Represents a color.
|
|
1946
|
+
*
|
|
1947
|
+
* The {@link Color} class parses colors specified as CSS strings and exposes
|
|
1948
|
+
* their red, green, blue, and alpha channels as read-write properties.
|
|
1949
|
+
*
|
|
1950
|
+
* The {@link Color} class also provides {@link fromHsb} and {@link fromHsl} methods
|
|
1951
|
+
* for creating colors using the HSB and HSL color models instead of RGB,
|
|
1952
|
+
* as well as {@link getHsb} and {@link getHsl} methods for retrieving the color
|
|
1953
|
+
* components using those color models.
|
|
1954
|
+
*
|
|
1955
|
+
* Finally, the {@link Color} class provides an {@link interpolate} method that
|
|
1956
|
+
* creates colors by interpolating between two colors using the HSL model.
|
|
1957
|
+
* This method is especially useful for creating color animations with the
|
|
1958
|
+
* {@link animate} method.
|
|
1959
|
+
*
|
|
1960
|
+
* The example below shows how this works:
|
|
1961
|
+
*
|
|
1962
|
+
* {@sample Core/Color Example}
|
|
1963
|
+
*/
|
|
1964
|
+
export declare class Color {
|
|
1965
|
+
_r: number;
|
|
1966
|
+
_g: number;
|
|
1967
|
+
_b: number;
|
|
1968
|
+
_a: number;
|
|
1969
|
+
/**
|
|
1970
|
+
* Initializes a new {@link Color} from a CSS color specification.
|
|
1971
|
+
*
|
|
1972
|
+
* @param color CSS color specification.
|
|
1973
|
+
*/
|
|
1974
|
+
constructor(color: string);
|
|
1975
|
+
/**
|
|
1976
|
+
* Gets or sets the red component of this {@link Color},
|
|
1977
|
+
* in a range from 0 to 255.
|
|
1978
|
+
*/
|
|
1979
|
+
r: number;
|
|
1980
|
+
/**
|
|
1981
|
+
* Gets or sets the green component of this {@link Color},
|
|
1982
|
+
* in a range from 0 to 255.
|
|
1983
|
+
*/
|
|
1984
|
+
g: number;
|
|
1985
|
+
/**
|
|
1986
|
+
* Gets or sets the blue component of this {@link Color},
|
|
1987
|
+
* in a range from 0 to 255.
|
|
1988
|
+
*/
|
|
1989
|
+
b: number;
|
|
1990
|
+
/**
|
|
1991
|
+
* Gets or sets the alpha component of this {@link Color},
|
|
1992
|
+
* in a range from 0 to 1 (zero is transparent, one is solid).
|
|
1993
|
+
*/
|
|
1994
|
+
a: number;
|
|
1995
|
+
/**
|
|
1996
|
+
* Returns true if a {@link Color} has the same value as this {@link Color}.
|
|
1997
|
+
*
|
|
1998
|
+
* @param clr {@link Color} to compare to this {@link Color}.
|
|
1999
|
+
*/
|
|
2000
|
+
equals(clr: Color): boolean;
|
|
2001
|
+
/**
|
|
2002
|
+
* Gets a string representation of this {@link Color}.
|
|
2003
|
+
*/
|
|
2004
|
+
toString(): string;
|
|
2005
|
+
/**
|
|
2006
|
+
* Creates a new {@link Color} using the specified RGBA color channel values.
|
|
2007
|
+
*
|
|
2008
|
+
* @param r Value for the red channel, from 0 to 255.
|
|
2009
|
+
* @param g Value for the green channel, from 0 to 255.
|
|
2010
|
+
* @param b Value for the blue channel, from 0 to 255.
|
|
2011
|
+
* @param a Value for the alpha channel, from 0 to 1.
|
|
2012
|
+
*/
|
|
2013
|
+
static fromRgba(r: number, g: number, b: number, a?: number): Color;
|
|
2014
|
+
/**
|
|
2015
|
+
* Creates a new {@link Color} using the specified HSB values.
|
|
2016
|
+
*
|
|
2017
|
+
* @param h Hue value, from 0 to 1.
|
|
2018
|
+
* @param s Saturation value, from 0 to 1.
|
|
2019
|
+
* @param b Brightness value, from 0 to 1.
|
|
2020
|
+
* @param a Alpha value, from 0 to 1.
|
|
2021
|
+
*/
|
|
2022
|
+
static fromHsb(h: number, s: number, b: number, a?: number): Color;
|
|
2023
|
+
/**
|
|
2024
|
+
* Creates a new {@link Color} using the specified HSL values.
|
|
2025
|
+
*
|
|
2026
|
+
* @param h Hue value, from 0 to 1.
|
|
2027
|
+
* @param s Saturation value, from 0 to 1.
|
|
2028
|
+
* @param l Lightness value, from 0 to 1.
|
|
2029
|
+
* @param a Alpha value, from 0 to 1.
|
|
2030
|
+
*/
|
|
2031
|
+
static fromHsl(h: number, s: number, l: number, a?: number): Color;
|
|
2032
|
+
/**
|
|
2033
|
+
* Creates a new {@link Color} from a CSS color string.
|
|
2034
|
+
*
|
|
2035
|
+
* @param value String containing a CSS color specification.
|
|
2036
|
+
* @return A new {@link Color}, or null if the string cannot be parsed into a color.
|
|
2037
|
+
*/
|
|
2038
|
+
static fromString(value: string): Color;
|
|
2039
|
+
/**
|
|
2040
|
+
* Gets an array with this color's HSB components.
|
|
2041
|
+
*/
|
|
2042
|
+
getHsb(): number[];
|
|
2043
|
+
/**
|
|
2044
|
+
* Gets an array with this color's HSL components.
|
|
2045
|
+
*/
|
|
2046
|
+
getHsl(): number[];
|
|
2047
|
+
/**
|
|
2048
|
+
* Creates a {@link Color} by interpolating between two colors.
|
|
2049
|
+
*
|
|
2050
|
+
* @param c1 First color.
|
|
2051
|
+
* @param c2 Second color.
|
|
2052
|
+
* @param pct Value between zero and one that determines how close the
|
|
2053
|
+
* interpolation should be to the second color.
|
|
2054
|
+
*/
|
|
2055
|
+
static interpolate(c1: Color, c2: Color, pct: number): Color;
|
|
2056
|
+
/**
|
|
2057
|
+
* Gets the closest opaque color to a given color.
|
|
2058
|
+
*
|
|
2059
|
+
* @param c {@link Color} to be converted to an opaque color
|
|
2060
|
+
* (the color may also be specified as a string).
|
|
2061
|
+
* @param bkg Background color to use when removing the transparency
|
|
2062
|
+
* (defaults to white).
|
|
2063
|
+
*/
|
|
2064
|
+
static toOpaque(c: any, bkg?: any): Color;
|
|
2065
|
+
_parse(c: string): boolean;
|
|
2066
|
+
/**
|
|
2067
|
+
* Converts an HSL color value to RGB.
|
|
2068
|
+
*
|
|
2069
|
+
* @param h The hue (between zero and one).
|
|
2070
|
+
* @param s The saturation (between zero and one).
|
|
2071
|
+
* @param l The lightness (between zero and one).
|
|
2072
|
+
* @return An array containing the R, G, and B values (between zero and 255).
|
|
2073
|
+
*/
|
|
2074
|
+
static _hslToRgb(h: number, s: number, l: number): number[];
|
|
2075
|
+
static _hue2rgb(p: number, q: number, t: number): number;
|
|
2076
|
+
/**
|
|
2077
|
+
* Converts an RGB color value to HSL.
|
|
2078
|
+
*
|
|
2079
|
+
* @param r The value of the red channel (between zero and 255).
|
|
2080
|
+
* @param g The value of the green channel (between zero and 255).
|
|
2081
|
+
* @param b The value of the blue channel (between zero and 255).
|
|
2082
|
+
* @return An array containing the H, S, and L values (between zero and one).
|
|
2083
|
+
*/
|
|
2084
|
+
static _rgbToHsl(r: number, g: number, b: number): number[];
|
|
2085
|
+
/**
|
|
2086
|
+
* Converts an RGB color value to HSB.
|
|
2087
|
+
*
|
|
2088
|
+
* @param r The value of the red channel (between zero and 255).
|
|
2089
|
+
* @param g The value of the green channel (between zero and 255).
|
|
2090
|
+
* @param b The value of the blue channel (between zero and 255).
|
|
2091
|
+
* @return An array containing the H, S, and B values (between zero and one).
|
|
2092
|
+
*/
|
|
2093
|
+
static _rgbToHsb(r: number, g: number, b: number): number[];
|
|
2094
|
+
/**
|
|
2095
|
+
* Converts an HSB color value to RGB.
|
|
2096
|
+
*
|
|
2097
|
+
* @param h The hue (between zero and one).
|
|
2098
|
+
* @param s The saturation (between zero and one).
|
|
2099
|
+
* @param b The brightness (between zero and one).
|
|
2100
|
+
* @return An array containing the R, G, and B values (between zero and 255).
|
|
2101
|
+
*/
|
|
2102
|
+
static _hsbToRgb(h: number, s: number, b: number): number[];
|
|
2103
|
+
/**
|
|
2104
|
+
* Converts an HSB color value to HSL.
|
|
2105
|
+
*
|
|
2106
|
+
* @param h The hue (between zero and one).
|
|
2107
|
+
* @param s The saturation (between zero and one).
|
|
2108
|
+
* @param b The brightness (between zero and one).
|
|
2109
|
+
* @return An array containing the H, S, and L values (between zero and one).
|
|
2110
|
+
*/
|
|
2111
|
+
static _hsbToHsl(h: number, s: number, b: number): number[];
|
|
2112
|
+
/**
|
|
2113
|
+
* Converts an HSL color value to HSB.
|
|
2114
|
+
*
|
|
2115
|
+
* @param h The hue (between zero and one).
|
|
2116
|
+
* @param s The saturation (between zero and one).
|
|
2117
|
+
* @param l The lightness (between zero and one).
|
|
2118
|
+
* @return An array containing the H, S, and B values (between zero and one).
|
|
2119
|
+
*/
|
|
2120
|
+
static _hslToHsb(h: number, s: number, l: number): number[];
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Contains information used to format numbers
|
|
2124
|
+
*/
|
|
2125
|
+
interface _INumFormatInfo {
|
|
2126
|
+
/** String to display before the formatted value */
|
|
2127
|
+
prefix: string;
|
|
2128
|
+
/** Format specifier (N, n, D, d, C, c, P, p, X, x, etc) */
|
|
2129
|
+
specRaw: string;
|
|
2130
|
+
/** Format specifier as lower-case (n, d, c, p, x, etc) */
|
|
2131
|
+
spec: string;
|
|
2132
|
+
/** Precision (number of decimal places to display) */
|
|
2133
|
+
prec: number;
|
|
2134
|
+
/** Scale (3 for thousands, 6 for millions, etc) */
|
|
2135
|
+
scale: number;
|
|
2136
|
+
/** String to display after the formatted value */
|
|
2137
|
+
suffix: string;
|
|
2138
|
+
/** Currency sign */
|
|
2139
|
+
curr: string;
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Gets or sets an object that contains all localizable strings in the Wijmo library.
|
|
2143
|
+
*
|
|
2144
|
+
* The culture selector is a two-letter string that represents an
|
|
2145
|
+
* <a href='https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes'>ISO 639 culture</a>.
|
|
2146
|
+
*/
|
|
2147
|
+
export declare var culture: any;
|
|
2148
|
+
/**
|
|
2149
|
+
* Class that implements formatting and parsing of numbers and Dates.
|
|
2150
|
+
*
|
|
2151
|
+
* By default, {@link Globalize} uses the American English culture.
|
|
2152
|
+
* To switch cultures, include the appropriate **wijmo.culture**
|
|
2153
|
+
* file after the wijmo files.
|
|
2154
|
+
*
|
|
2155
|
+
* The example below shows how you can use the {@link Globalize} class
|
|
2156
|
+
* to format dates, times, and numbers in different cultures:
|
|
2157
|
+
*
|
|
2158
|
+
* {@sample Core/Globalization/Formatting Example}
|
|
2159
|
+
*/
|
|
2160
|
+
export declare class Globalize {
|
|
2161
|
+
/**
|
|
2162
|
+
* Formats a number or a date.
|
|
2163
|
+
*
|
|
2164
|
+
* The format strings used with the {@link format} function are similar to
|
|
2165
|
+
* the ones used by the .NET Globalization library.
|
|
2166
|
+
* The tables below contains links that describe the formats available:
|
|
2167
|
+
*
|
|
2168
|
+
* <ul>
|
|
2169
|
+
* <li><a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings">
|
|
2170
|
+
* Standard Numeric Format Strings</a></li>
|
|
2171
|
+
* <li><a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings">
|
|
2172
|
+
* Standard Date and Time Format Strings</a></li>
|
|
2173
|
+
* <li><a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings">
|
|
2174
|
+
* Custom Date and Time Format Strings</a></li>
|
|
2175
|
+
* </ul>
|
|
2176
|
+
*
|
|
2177
|
+
* @param value Number or Date to format (all other types are converted to strings).
|
|
2178
|
+
* @param format Format string to use when formatting numbers or dates.
|
|
2179
|
+
* @param trim Whether to remove trailing zeros from numeric results.
|
|
2180
|
+
* @param truncate Whether to truncate the numeric values rather than round them.
|
|
2181
|
+
* @param defaultPrec Precision to use if not specified in the format string.
|
|
2182
|
+
* @return A string representation of the given value.
|
|
2183
|
+
*/
|
|
2184
|
+
static format(value: any, format: string, trim?: boolean, truncate?: boolean, defaultPrec?: number): string;
|
|
2185
|
+
/**
|
|
2186
|
+
* Formats a number using the current culture.
|
|
2187
|
+
*
|
|
2188
|
+
* The {@link formatNumber} method accepts all .NET-style
|
|
2189
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings">
|
|
2190
|
+
* Standard Numeric Format Strings</a> and provides support
|
|
2191
|
+
* for scaling, prefixes, suffixes, and custom currency symbols.
|
|
2192
|
+
*
|
|
2193
|
+
* Numeric format strings take the form <i>Axxsscc</i>, where:
|
|
2194
|
+
* <ul>
|
|
2195
|
+
* <li>
|
|
2196
|
+
* <i>A</i> is a single alphabetic character called the format
|
|
2197
|
+
* specifier (described below).</li>
|
|
2198
|
+
* <li>
|
|
2199
|
+
* <i>xx</i> is an optional integer called the precision specifier.
|
|
2200
|
+
* The precision specifier affects the number of digits in the result.</li>
|
|
2201
|
+
* <li>
|
|
2202
|
+
* <i>ss</i> is an optional string used to scale the number. If provided,
|
|
2203
|
+
* it must consist of commas. The number is divided by 1000 for each comma
|
|
2204
|
+
* specified.</li>
|
|
2205
|
+
* <li>
|
|
2206
|
+
* <i>cc</i> is an optional string used to override the currency symbol
|
|
2207
|
+
* when formatting currency values. This is useful when formatting
|
|
2208
|
+
* currency values for cultures different than the current default
|
|
2209
|
+
* (for example, when formatting Euro or Yen values in applications
|
|
2210
|
+
* that use the English culture).</li>
|
|
2211
|
+
* </ul>
|
|
2212
|
+
*
|
|
2213
|
+
* The following table describes the standard numeric format specifiers and
|
|
2214
|
+
* displays sample output produced by each format specifier for the default
|
|
2215
|
+
* culture.
|
|
2216
|
+
*
|
|
2217
|
+
* <b>c</b> Currency: <code>formatNumber(1234, 'c') => '$1,234.00'</code><br/>
|
|
2218
|
+
* <b>d</b> Decimal (integers): <code>formatNumber(-1234, 'd6') => '-001234'</code><br/>
|
|
2219
|
+
* <b>e</b> Scientific Notation (lower-case 'e'): <code>formatNumber(123.456, 'e6') => '1.234560e+2'</code>
|
|
2220
|
+
* <b>E</b> Scientific Notation (upper-case 'e'): <code>formatNumber(123.456, 'E6') => '1.234560E+2'</code>
|
|
2221
|
+
* <b>f</b> Fixed-point: <code>formatNumber(1234.5, 'f2') => '1234.50'</code><br/>
|
|
2222
|
+
* <b>F</b> Fixed-point (with thousand separators): <code>formatNumber(1234.5, 'F2') => '1,234.50'</code><br/>
|
|
2223
|
+
* <b>g</b> General (no trailing zeros): <code>formatNumber(1234.50, 'g2') => '1234.5'</code><br/>
|
|
2224
|
+
* <b>G</b> General (no trailing zeros, thousand separators): <code>formatNumber(1234.5, 'G2') => '1,234.5'</code><br/>
|
|
2225
|
+
* <b>n</b> Number: <code>formatNumber(1234.5, 'n2') => '1,234.50'</code><br/>
|
|
2226
|
+
* <b>p</b> Percent: <code>formatNumber(0.1234, 'p2') => '12.34%'</code>
|
|
2227
|
+
* <b>P</b> Percent (no thousand separators): <code>formatNumber(12.34, 'P2') => '1234%'</code>
|
|
2228
|
+
* <b>r</b> Round-trip (same as g15): <code>formatNumber(0.1234, 'r') => '0.1234'</code>
|
|
2229
|
+
* <b>x</b> Hexadecimal (integers): <code>formatNumber(1234, 'x6') => '0004d2'</code><br/>
|
|
2230
|
+
*
|
|
2231
|
+
* The scaling specifier is especially useful when charting large values. For
|
|
2232
|
+
* example, the markup below creates a chart that plots population versus GDP.
|
|
2233
|
+
* The raw data expresses the population is units and the GDP in millions.
|
|
2234
|
+
* The scaling specified in the axes formats causes the chart to show population
|
|
2235
|
+
* in millions and GDP in trillions:
|
|
2236
|
+
*
|
|
2237
|
+
* ```typescript
|
|
2238
|
+
* import { FlexChart} from '@grapecity/wijmo.chart';
|
|
2239
|
+
* new FlexChart('#theChart', {
|
|
2240
|
+
* itemsSource: countriesGDP,
|
|
2241
|
+
* bindingX: 'pop',
|
|
2242
|
+
* chartType: 'Scatter',
|
|
2243
|
+
* series: [
|
|
2244
|
+
* { name: 'GDP', binding: 'gdp' }
|
|
2245
|
+
* ],
|
|
2246
|
+
* axisX: {
|
|
2247
|
+
* title: 'Population (millions)'
|
|
2248
|
+
* format: 'n0,,'
|
|
2249
|
+
* },
|
|
2250
|
+
* axisY: {
|
|
2251
|
+
* title: 'GDP (US$ trillions)'
|
|
2252
|
+
* format: 'c0,,'
|
|
2253
|
+
* }
|
|
2254
|
+
* });
|
|
2255
|
+
* ```
|
|
2256
|
+
*
|
|
2257
|
+
* The format string may also include constant prefix and suffix
|
|
2258
|
+
* strings to be added to the output.
|
|
2259
|
+
* If present, the prefix and suffix are specified as *double-quoted*
|
|
2260
|
+
* strings at the start and end of the format string:
|
|
2261
|
+
*
|
|
2262
|
+
* ```typescript
|
|
2263
|
+
* import { Globalize } from '@grapecity/wijmo';
|
|
2264
|
+
* console.log(Globalize.formatNumber(value, '"thousands: "c3," k"'));
|
|
2265
|
+
* console.log(Globalize.formatNumber(value, '"millions: "c1,," M"'));
|
|
2266
|
+
* ```
|
|
2267
|
+
*
|
|
2268
|
+
* @param value Number to format.
|
|
2269
|
+
* @param format .NET-style standard numeric format string (e.g. 'n2', 'c4', 'p0', 'g2', 'd2').
|
|
2270
|
+
* @param trim Whether to remove trailing zeros from the result.
|
|
2271
|
+
* @param truncate Whether to truncate the value rather than round it.
|
|
2272
|
+
* @param defaultPrec Precision to use if not specified in the format string.
|
|
2273
|
+
* @return A string representation of the given number.
|
|
2274
|
+
*/
|
|
2275
|
+
static formatNumber(value: number, format: string, trim?: boolean, truncate?: boolean, defaultPrec?: number): string;
|
|
2276
|
+
/**
|
|
2277
|
+
* Formats a date using the current culture.
|
|
2278
|
+
*
|
|
2279
|
+
* The {@link format} parameter contains a .NET-style
|
|
2280
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings">Date format string</a>
|
|
2281
|
+
* with the following additions:
|
|
2282
|
+
* <ul>
|
|
2283
|
+
* <li><i>Q, q</i> Calendar quarter.</li>
|
|
2284
|
+
* <li><i>U</i> Fiscal quarter (government).</li>
|
|
2285
|
+
* <li><i>u</i> Fiscal quarter (private sector).</li>
|
|
2286
|
+
* <li><i>EEEE, EEE, EE, E</i> Fiscal year (government).</li>
|
|
2287
|
+
* <li><i>eeee, eee, ee, e</i> Fiscal year (private sector).</li>
|
|
2288
|
+
* </ul>
|
|
2289
|
+
*
|
|
2290
|
+
* For example:
|
|
2291
|
+
*
|
|
2292
|
+
* ```typescript
|
|
2293
|
+
* import { Globalize } from '@grapecity/wijmo';
|
|
2294
|
+
* let dt = new Date(2015, 9, 1); // Oct 1, 2015
|
|
2295
|
+
* console.log('result', Globalize.format(dt, '"FY"EEEE"Q"U') + ' (US culture)');
|
|
2296
|
+
* **result** FY2016Q1 (US culture)
|
|
2297
|
+
* ```
|
|
2298
|
+
*
|
|
2299
|
+
* Another addition is available for dealing with complex eras such
|
|
2300
|
+
* as those defined in the Japanese culture:
|
|
2301
|
+
*
|
|
2302
|
+
* <ul>
|
|
2303
|
+
* <li><i>ggg</i> Era name (e.g. '平成', '昭和', '大正', or '明治').</li>
|
|
2304
|
+
* <li><i>gg</i> Era initial (e.g. '平', '昭', '大', or '明').</li>
|
|
2305
|
+
* <li><i>g</i> Era symbol (e.g. 'H', 'S', 'T', or 'M').</li>
|
|
2306
|
+
* </ul>
|
|
2307
|
+
*
|
|
2308
|
+
* {@sample Core/Globalization/Formatting/purejs Example}
|
|
2309
|
+
*
|
|
2310
|
+
* @param value Number or Date to format.
|
|
2311
|
+
* @param format .NET-style Date format string.
|
|
2312
|
+
* @return A string representation of the given date.
|
|
2313
|
+
*/
|
|
2314
|
+
static formatDate(value: Date, format: string): string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Parses a string into an integer.
|
|
2317
|
+
*
|
|
2318
|
+
* @param value String to convert to an integer.
|
|
2319
|
+
* @param format Format to use when parsing the number.
|
|
2320
|
+
* @return The integer represented by the given string,
|
|
2321
|
+
* or **NaN** if the string cannot be parsed into an integer.
|
|
2322
|
+
*/
|
|
2323
|
+
static parseInt(value: string, format?: string): number;
|
|
2324
|
+
/**
|
|
2325
|
+
* Parses a string into a floating point number.
|
|
2326
|
+
*
|
|
2327
|
+
* @param value String to convert to a number.
|
|
2328
|
+
* @param format Format to use when parsing the number.
|
|
2329
|
+
* @return The floating point number represented by the given string,
|
|
2330
|
+
* or **NaN** if the string cannot be parsed into a floating point number.
|
|
2331
|
+
*/
|
|
2332
|
+
static parseFloat(value: string, format?: string): number;
|
|
2333
|
+
/**
|
|
2334
|
+
* Parses a string into a Date.
|
|
2335
|
+
*
|
|
2336
|
+
* Two-digit years are converted to full years based on the value of the
|
|
2337
|
+
* calendar's **twoDigitYearMax** property. By default, this is set to
|
|
2338
|
+
* 2029, meaning two-digit values of 30 to 99 are parsed as 19xx, and values
|
|
2339
|
+
* from zero to 29 are parsed as 20xx.
|
|
2340
|
+
*
|
|
2341
|
+
* You can change this threshold by assigning a new value to the calendar.
|
|
2342
|
+
* For example:
|
|
2343
|
+
*
|
|
2344
|
+
* <pre>// get calendar
|
|
2345
|
+
* var cal = wijmo.culture.Globalize.calendar;
|
|
2346
|
+
*
|
|
2347
|
+
* // default threshold is 2029, so "30" is parsed as 1930
|
|
2348
|
+
* cal.twoDigitYearMax = 2029;
|
|
2349
|
+
* var d1 = wijmo.Globalize.parseDate('30/12', 'yy/MM'); // dec 1930
|
|
2350
|
+
*
|
|
2351
|
+
* // changing threshold to 2100, so all values are parsed as 20**
|
|
2352
|
+
* cal.twoDigitYearMax = 2100;
|
|
2353
|
+
* var d2 = wijmo.Globalize.parseDate('30/12', 'yy/MM'); // dec 2030</pre>
|
|
2354
|
+
*
|
|
2355
|
+
* @param value String to convert to a Date.
|
|
2356
|
+
* @param format Format string used to parse the date.
|
|
2357
|
+
* @param refDate Date to use as a reference in case date or time
|
|
2358
|
+
* parts are not specified in the format string (e.g. format = 'MM/dd').
|
|
2359
|
+
* @return The Date object represented by the given string, or null
|
|
2360
|
+
* if the string cannot be parsed into a Date.
|
|
2361
|
+
*/
|
|
2362
|
+
static parseDate(value: string, format: string, refDate?: Date): Date;
|
|
2363
|
+
static _CJK: string;
|
|
2364
|
+
/**
|
|
2365
|
+
* Gets the first day of the week according to the current culture.
|
|
2366
|
+
*
|
|
2367
|
+
* The value returned is between zero (Sunday) and six (Saturday).
|
|
2368
|
+
*/
|
|
2369
|
+
static getFirstDayOfWeek(): number;
|
|
2370
|
+
/**
|
|
2371
|
+
* Gets the symbol used as a decimal separator in numbers.
|
|
2372
|
+
*/
|
|
2373
|
+
static getNumberDecimalSeparator(): string;
|
|
2374
|
+
private static _toFixedStr;
|
|
2375
|
+
private static _unquote;
|
|
2376
|
+
private static _numFormatInfo;
|
|
2377
|
+
static _parseNumericFormat(format: string): _INumFormatInfo;
|
|
2378
|
+
private static _dateFormatParts;
|
|
2379
|
+
static _parseDateFormat(format: string): string[];
|
|
2380
|
+
private static _formatDatePart;
|
|
2381
|
+
private static _getEra;
|
|
2382
|
+
private static _expandFormat;
|
|
2383
|
+
private static _zeroPad;
|
|
2384
|
+
private static _h12;
|
|
2385
|
+
static _shiftDecimal(val: any, shift: any, calcPrec?: number): any;
|
|
2386
|
+
}
|
|
2387
|
+
export declare const _loadedCultures: any;
|
|
2388
|
+
export declare function _updateCulture(c: any): void;
|
|
2389
|
+
export declare function _addCultureInfo(member: string, info: any): void;
|
|
2390
|
+
/**
|
|
2391
|
+
* Change culture with given code synced
|
|
2392
|
+
*
|
|
2393
|
+
* @param cultureCode string (e.g. "jp")
|
|
2394
|
+
* @param callback
|
|
2395
|
+
* @return void
|
|
2396
|
+
*/
|
|
2397
|
+
export declare const changeCultureSync: (cultureCode: string, callback?: any) => any;
|
|
2398
|
+
/**
|
|
2399
|
+
* Change culture with given code async
|
|
2400
|
+
*
|
|
2401
|
+
* @param cultureCode string (e.g. "jp")
|
|
2402
|
+
* @return Promise
|
|
2403
|
+
*/
|
|
2404
|
+
export declare const changeCulture: (cultureCode: string) => Promise<{}>;
|
|
2405
|
+
/**
|
|
2406
|
+
* Class that provides masking services to an HTMLInputElement.
|
|
2407
|
+
*/
|
|
2408
|
+
export declare class _MaskProvider {
|
|
2409
|
+
_tbx: HTMLInputElement;
|
|
2410
|
+
_msk: string;
|
|
2411
|
+
_promptChar: string;
|
|
2412
|
+
_mskArr: _MaskElement[];
|
|
2413
|
+
_firstPos: number;
|
|
2414
|
+
_lastPos: number;
|
|
2415
|
+
_backSpace: boolean;
|
|
2416
|
+
_composing: boolean;
|
|
2417
|
+
_overWrite: boolean;
|
|
2418
|
+
_full: boolean;
|
|
2419
|
+
_matchEnd: number;
|
|
2420
|
+
_autoComplete: string;
|
|
2421
|
+
_spellCheck: boolean;
|
|
2422
|
+
_inputBnd: any;
|
|
2423
|
+
_keydownBnd: any;
|
|
2424
|
+
_keypressBnd: any;
|
|
2425
|
+
_cmpstartBnd: any;
|
|
2426
|
+
_cmpendBnd: any;
|
|
2427
|
+
_evtInput: any;
|
|
2428
|
+
static _X_DBCS_BIG_HIRA: string;
|
|
2429
|
+
static _X_DBCS_BIG_KATA: string;
|
|
2430
|
+
static _X_SBCS_BIG_KATA: string;
|
|
2431
|
+
/**
|
|
2432
|
+
* Initializes a new instance of the {@link _MaskProvider} class.
|
|
2433
|
+
*
|
|
2434
|
+
* @param input Input element to be masked.
|
|
2435
|
+
* @param mask Input mask.
|
|
2436
|
+
* @param promptChar Character used to indicate input positions.
|
|
2437
|
+
*/
|
|
2438
|
+
constructor(input: HTMLInputElement, mask?: string, promptChar?: string);
|
|
2439
|
+
/**
|
|
2440
|
+
* Gets or sets the Input element to be masked.
|
|
2441
|
+
*/
|
|
2442
|
+
input: HTMLInputElement;
|
|
2443
|
+
/**
|
|
2444
|
+
* Gets or sets the input mask used to validate input.
|
|
2445
|
+
*/
|
|
2446
|
+
mask: string;
|
|
2447
|
+
/**
|
|
2448
|
+
* Gets or sets the input mask used to validate input.
|
|
2449
|
+
*/
|
|
2450
|
+
promptChar: string;
|
|
2451
|
+
/**
|
|
2452
|
+
* Gets or sets a value that determines whether the input element handles input in
|
|
2453
|
+
* overwrite mode.
|
|
2454
|
+
*
|
|
2455
|
+
* In **overwrite mode**, every character you type is displayed at the cursor position.
|
|
2456
|
+
* If a character is already at that position, it is replaced.
|
|
2457
|
+
*
|
|
2458
|
+
* In **insert mode**, each character you type is inserted at the cursor position.
|
|
2459
|
+
*
|
|
2460
|
+
* The default value for this property is **false**.
|
|
2461
|
+
*/
|
|
2462
|
+
overwriteMode: boolean;
|
|
2463
|
+
/**
|
|
2464
|
+
* Gets a value that indicates whether the mask has been completely filled.
|
|
2465
|
+
*/
|
|
2466
|
+
readonly maskFull: boolean;
|
|
2467
|
+
/**
|
|
2468
|
+
* Gets an array with the position of the first and last wildcard characters in the mask.
|
|
2469
|
+
*/
|
|
2470
|
+
getMaskRange(): number[];
|
|
2471
|
+
/**
|
|
2472
|
+
* Gets the raw value of the editor, excluding prompts and literals.
|
|
2473
|
+
*/
|
|
2474
|
+
getRawValue(): string;
|
|
2475
|
+
/**
|
|
2476
|
+
* Updates the control mask and content.
|
|
2477
|
+
*/
|
|
2478
|
+
refresh(): void;
|
|
2479
|
+
_input(e: KeyboardEvent): void;
|
|
2480
|
+
_keydown(e: KeyboardEvent): void;
|
|
2481
|
+
_keypress(e: KeyboardEvent): void;
|
|
2482
|
+
_cmpstart(e: CompositionEvent): void;
|
|
2483
|
+
_cmpend(e: CompositionEvent): void;
|
|
2484
|
+
_preventKey(charCode: number): boolean;
|
|
2485
|
+
_connect(connect: boolean): void;
|
|
2486
|
+
_valueChanged(): boolean;
|
|
2487
|
+
_applyMask(): string;
|
|
2488
|
+
_handleVagueLiterals(text: string): string;
|
|
2489
|
+
_isCharValid(mask: string, c: string): boolean;
|
|
2490
|
+
_isDigit(c: string): boolean;
|
|
2491
|
+
_isLetter(c: string): boolean;
|
|
2492
|
+
_validatePosition(start: number): void;
|
|
2493
|
+
_parseMask(): void;
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Class that contains information about a position in an input mask.
|
|
2497
|
+
*/
|
|
2498
|
+
export declare class _MaskElement {
|
|
2499
|
+
wildCard: string;
|
|
2500
|
+
charCase: string;
|
|
2501
|
+
literal: string;
|
|
2502
|
+
vague: boolean;
|
|
2503
|
+
/**
|
|
2504
|
+
* Initializes a new instance of the {@link _MaskElement} class.
|
|
2505
|
+
*
|
|
2506
|
+
* @param wildcardOrLiteral Wildcard or literal character
|
|
2507
|
+
* @param charCase Whether to convert wildcard matches to upper or lowercase.
|
|
2508
|
+
*/
|
|
2509
|
+
constructor(wildcardOrLiteral: string, charCase?: string);
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Specifies the type of aggregate to calculate over a group of values.
|
|
2513
|
+
*/
|
|
2514
|
+
export declare enum Aggregate {
|
|
2515
|
+
/**
|
|
2516
|
+
* No aggregate.
|
|
2517
|
+
*/
|
|
2518
|
+
None = 0,
|
|
2519
|
+
/**
|
|
2520
|
+
* Returns the sum of the numeric values in the group.
|
|
2521
|
+
*/
|
|
2522
|
+
Sum = 1,
|
|
2523
|
+
/**
|
|
2524
|
+
* Returns the count of non-null values in the group.
|
|
2525
|
+
*/
|
|
2526
|
+
Cnt = 2,
|
|
2527
|
+
/**
|
|
2528
|
+
* Returns the average value of the numeric values in the group.
|
|
2529
|
+
*/
|
|
2530
|
+
Avg = 3,
|
|
2531
|
+
/**
|
|
2532
|
+
* Returns the maximum value in the group.
|
|
2533
|
+
*/
|
|
2534
|
+
Max = 4,
|
|
2535
|
+
/**
|
|
2536
|
+
* Returns the minimum value in the group.
|
|
2537
|
+
*/
|
|
2538
|
+
Min = 5,
|
|
2539
|
+
/**
|
|
2540
|
+
* Returns the difference between the maximum and minimum numeric values in the group.
|
|
2541
|
+
*/
|
|
2542
|
+
Rng = 6,
|
|
2543
|
+
/**
|
|
2544
|
+
* Returns the sample standard deviation of the numeric values in the group
|
|
2545
|
+
* (uses the formula based on n-1).
|
|
2546
|
+
*/
|
|
2547
|
+
Std = 7,
|
|
2548
|
+
/**
|
|
2549
|
+
* Returns the sample variance of the numeric values in the group
|
|
2550
|
+
* (uses the formula based on n-1).
|
|
2551
|
+
*/
|
|
2552
|
+
Var = 8,
|
|
2553
|
+
/**
|
|
2554
|
+
* Returns the population standard deviation of the values in the group
|
|
2555
|
+
* (uses the formula based on n).
|
|
2556
|
+
*/
|
|
2557
|
+
StdPop = 9,
|
|
2558
|
+
/**
|
|
2559
|
+
* Returns the population variance of the values in the group
|
|
2560
|
+
* (uses the formula based on n).
|
|
2561
|
+
*/
|
|
2562
|
+
VarPop = 10,
|
|
2563
|
+
/**
|
|
2564
|
+
* Returns the count of all values in the group (including nulls).
|
|
2565
|
+
*/
|
|
2566
|
+
CntAll = 11,
|
|
2567
|
+
/**
|
|
2568
|
+
* Returns the first non-null value in the group.
|
|
2569
|
+
*/
|
|
2570
|
+
First = 12,
|
|
2571
|
+
/**
|
|
2572
|
+
* Returns the last non-null value in the group.
|
|
2573
|
+
*/
|
|
2574
|
+
Last = 13
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Calculates an aggregate value from the values in an array.
|
|
2578
|
+
*
|
|
2579
|
+
* @param aggType Type of aggregate to calculate.
|
|
2580
|
+
* @param items Array with the items to aggregate.
|
|
2581
|
+
* @param binding Name of the property to aggregate on (in case the items are not simple values).
|
|
2582
|
+
*/
|
|
2583
|
+
export declare function getAggregate(aggType: Aggregate, items: any[], binding?: string, sheet?: any): any;
|
|
2584
|
+
/**
|
|
2585
|
+
* Base class for Array classes with notifications.
|
|
2586
|
+
*/
|
|
2587
|
+
export declare class ArrayBase<T = any> extends Array<T> {
|
|
2588
|
+
/**
|
|
2589
|
+
* Initializes a new instance of the {@link ArrayBase} class.
|
|
2590
|
+
*/
|
|
2591
|
+
constructor();
|
|
2592
|
+
}
|
|
2593
|
+
/**
|
|
2594
|
+
* Array that sends notifications on changes.
|
|
2595
|
+
*
|
|
2596
|
+
* The class raises the {@link collectionChanged} event when changes are made with
|
|
2597
|
+
* the push, pop, splice, shift, unshift, insert, or remove methods.
|
|
2598
|
+
*
|
|
2599
|
+
* Warning: Changes made by assigning values directly to array members or to the
|
|
2600
|
+
* length of the array do not raise the {@link collectionChanged} event.
|
|
2601
|
+
*/
|
|
2602
|
+
export declare class ObservableArray<T = any> extends ArrayBase<T> implements INotifyCollectionChanged {
|
|
2603
|
+
private _updating;
|
|
2604
|
+
/**
|
|
2605
|
+
* Initializes a new instance of the {@link ObservableArray} class.
|
|
2606
|
+
*
|
|
2607
|
+
* @param data Array containing items used to populate the {@link ObservableArray}.
|
|
2608
|
+
*/
|
|
2609
|
+
constructor(data?: T[]);
|
|
2610
|
+
/**
|
|
2611
|
+
* Adds one or more items to the end of the array.
|
|
2612
|
+
*
|
|
2613
|
+
* @param ...items One or more items to add to the array.
|
|
2614
|
+
* @return The new length of the array.
|
|
2615
|
+
*/
|
|
2616
|
+
push(...items: T[]): number;
|
|
2617
|
+
/**
|
|
2618
|
+
* Removes the first element from the array and returns that element.
|
|
2619
|
+
*
|
|
2620
|
+
* This method changes the length of the array.
|
|
2621
|
+
*/
|
|
2622
|
+
shift(): T;
|
|
2623
|
+
/**
|
|
2624
|
+
* Adds one or more elements to the beginning of the array and returns
|
|
2625
|
+
* the new length of the array.
|
|
2626
|
+
*
|
|
2627
|
+
* @param ...items One or more items to add to the array.
|
|
2628
|
+
* @return The new length of the array.
|
|
2629
|
+
*/
|
|
2630
|
+
unshift(...items: T[]): number;
|
|
2631
|
+
pop(): any;
|
|
2632
|
+
/**
|
|
2633
|
+
* Removes and/or adds items to the array.
|
|
2634
|
+
*
|
|
2635
|
+
* @param index Position where items will be added or removed.
|
|
2636
|
+
* @param count Number of items to remove from the array.
|
|
2637
|
+
* @param ...item One or more items to add to the array.
|
|
2638
|
+
* @return An array containing the removed elements.
|
|
2639
|
+
*/
|
|
2640
|
+
splice(index: number, count: number, ...item: T[]): T[];
|
|
2641
|
+
/**
|
|
2642
|
+
* Creates a shallow copy of a portion of an array.
|
|
2643
|
+
*
|
|
2644
|
+
* @param begin Position where the copy starts.
|
|
2645
|
+
* @param end Position where the copy ends.
|
|
2646
|
+
* @return A shallow copy of a portion of an array.
|
|
2647
|
+
*/
|
|
2648
|
+
slice(begin?: number, end?: number): T[];
|
|
2649
|
+
/**
|
|
2650
|
+
* Searches for an item in the array.
|
|
2651
|
+
*
|
|
2652
|
+
* @param searchElement Element to locate in the array.
|
|
2653
|
+
* @param fromIndex The index where the search should start.
|
|
2654
|
+
* @return The index of the item in the array, or -1 if the item was not found.
|
|
2655
|
+
*/
|
|
2656
|
+
indexOf(searchElement: T, fromIndex?: number): number;
|
|
2657
|
+
/**
|
|
2658
|
+
* Sorts the elements of the array in place.
|
|
2659
|
+
*
|
|
2660
|
+
* @param compareFn Specifies a function that defines the sort order.
|
|
2661
|
+
* If specified, the function should take two arguments and should return
|
|
2662
|
+
* -1, +1, or 0 to indicate the first argument is smaller, greater than,
|
|
2663
|
+
* or equal to the second argument.
|
|
2664
|
+
* If omitted, the array is sorted in dictionary order according to the
|
|
2665
|
+
* string conversion of each element.
|
|
2666
|
+
* @return A copy of the sorted array.
|
|
2667
|
+
*/
|
|
2668
|
+
sort(compareFn?: Function): this;
|
|
2669
|
+
/**
|
|
2670
|
+
* Inserts an item at a specific position in the array.
|
|
2671
|
+
*
|
|
2672
|
+
* @param index Position where the item will be added.
|
|
2673
|
+
* @param item Item to add to the array.
|
|
2674
|
+
*/
|
|
2675
|
+
insert(index: number, item: T): void;
|
|
2676
|
+
/**
|
|
2677
|
+
* Removes an item from the array.
|
|
2678
|
+
*
|
|
2679
|
+
* @param item Item to remove.
|
|
2680
|
+
* @return True if the item was removed, false if it wasn't found in the array.
|
|
2681
|
+
*/
|
|
2682
|
+
remove(item: T): boolean;
|
|
2683
|
+
/**
|
|
2684
|
+
* Removes an item at a specific position in the array.
|
|
2685
|
+
*
|
|
2686
|
+
* @param index Position of the item to remove.
|
|
2687
|
+
*/
|
|
2688
|
+
removeAt(index: number): void;
|
|
2689
|
+
/**
|
|
2690
|
+
* Assigns an item at a specific position in the array.
|
|
2691
|
+
*
|
|
2692
|
+
* @param index Position where the item will be assigned.
|
|
2693
|
+
* @param item Item to assign to the array.
|
|
2694
|
+
*/
|
|
2695
|
+
setAt(index: number, item: T): void;
|
|
2696
|
+
/**
|
|
2697
|
+
* Removes all items from the array.
|
|
2698
|
+
*/
|
|
2699
|
+
clear(): void;
|
|
2700
|
+
/**
|
|
2701
|
+
* Suspends notifications until the next call to {@link endUpdate}.
|
|
2702
|
+
*/
|
|
2703
|
+
beginUpdate(): void;
|
|
2704
|
+
/**
|
|
2705
|
+
* Resumes notifications suspended by a call to {@link beginUpdate}.
|
|
2706
|
+
*/
|
|
2707
|
+
endUpdate(): void;
|
|
2708
|
+
/**
|
|
2709
|
+
* Gets a value that indicates whether notifications are currently suspended
|
|
2710
|
+
* (see {@link beginUpdate} and {@link endUpdate}).
|
|
2711
|
+
*/
|
|
2712
|
+
readonly isUpdating: boolean;
|
|
2713
|
+
/**
|
|
2714
|
+
* Executes a function within a {@link beginUpdate}/{@link endUpdate} block.
|
|
2715
|
+
*
|
|
2716
|
+
* The collection will not be refreshed until the function finishes.
|
|
2717
|
+
* This method ensures {@link endUpdate} is called even if the function throws
|
|
2718
|
+
* an exception.
|
|
2719
|
+
*
|
|
2720
|
+
* @param fn Function to be executed without updates.
|
|
2721
|
+
*/
|
|
2722
|
+
deferUpdate(fn: Function): void;
|
|
2723
|
+
/**
|
|
2724
|
+
* Returns true if the caller queries for a supported interface.
|
|
2725
|
+
*
|
|
2726
|
+
* @param interfaceName Name of the interface to look for.
|
|
2727
|
+
* @return True if the caller queries for a supported interface.
|
|
2728
|
+
*/
|
|
2729
|
+
implementsInterface(interfaceName: string): boolean;
|
|
2730
|
+
/**
|
|
2731
|
+
* Occurs when the collection changes.
|
|
2732
|
+
*/
|
|
2733
|
+
readonly collectionChanged: Event<ObservableArray<T>, NotifyCollectionChangedEventArgs<T>>;
|
|
2734
|
+
/**
|
|
2735
|
+
* Raises the {@link collectionChanged} event.
|
|
2736
|
+
*
|
|
2737
|
+
* @param e Contains a description of the change.
|
|
2738
|
+
*/
|
|
2739
|
+
onCollectionChanged(e?: NotifyCollectionChangedEventArgs<any>): void;
|
|
2740
|
+
private _raiseCollectionChanged;
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Represents a method that takes no arguments and returns a new data object.
|
|
2744
|
+
*/
|
|
2745
|
+
export interface IItemCreator<T = any> {
|
|
2746
|
+
(): T;
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* Represents a method that provides an alternate data item
|
|
2750
|
+
* to be used when sorting collections.
|
|
2751
|
+
*/
|
|
2752
|
+
export interface ISortConverter<T = any> {
|
|
2753
|
+
/**
|
|
2754
|
+
* @param sd {@link SortDescription} that describes the property being sorted and the sort direction.
|
|
2755
|
+
* @param item Data item being sorted.
|
|
2756
|
+
* @param value Value of the item property.
|
|
2757
|
+
* @param extra Optional parameter with custom information.
|
|
2758
|
+
* @returns The data item to use when sorting.
|
|
2759
|
+
*/
|
|
2760
|
+
(sd: SortDescription, item: T, value: any, custom?: any): any;
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
* Represents a method that identifies errors in data items.
|
|
2764
|
+
*/
|
|
2765
|
+
export interface IGetError<T = any> {
|
|
2766
|
+
/**
|
|
2767
|
+
* @param item Item to be inspected.
|
|
2768
|
+
* @param property Property to be inspected, or null to inspect all properties.
|
|
2769
|
+
* @param parsing Whether the value is being edited and could not be parsed into the right data type.
|
|
2770
|
+
* @returns A string describing the error, if any, or null to indicate there are no errors.
|
|
2771
|
+
*/
|
|
2772
|
+
(item: T, property: string | null, parsing?: boolean): string | null;
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* Specifies constants that define how null values are sorted.
|
|
2776
|
+
*/
|
|
2777
|
+
export declare enum SortNulls {
|
|
2778
|
+
/** Null values are sorted in natural order (first in ascending, last in descending order). */
|
|
2779
|
+
Natural = 0,
|
|
2780
|
+
/** Null values appear first (regardless of sort order). */
|
|
2781
|
+
First = 1,
|
|
2782
|
+
/** Null values appear last (regardless of sort order). */
|
|
2783
|
+
Last = 2
|
|
2784
|
+
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Class that implements the {@link ICollectionView} interface to expose data in
|
|
2787
|
+
* regular JavaScript arrays.
|
|
2788
|
+
*
|
|
2789
|
+
* The {@link CollectionView} class implements the following interfaces:
|
|
2790
|
+
* <ul>
|
|
2791
|
+
* <li>{@link ICollectionView}: provides current record management,
|
|
2792
|
+
* custom sorting, filtering, and grouping.</li>
|
|
2793
|
+
* <li>{@link IEditableCollectionView}: provides methods for editing,
|
|
2794
|
+
* adding, and removing items.</li>
|
|
2795
|
+
* <li>{@link IPagedCollectionView}: provides paging.</li>
|
|
2796
|
+
* </ul>
|
|
2797
|
+
*
|
|
2798
|
+
* To use the {@link CollectionView} class, start by declaring it and passing a
|
|
2799
|
+
* regular array as a data source. Then configure the view using the
|
|
2800
|
+
* {@link filter}, {@link sortDescriptions}, {@link groupDescriptions}, and
|
|
2801
|
+
* {@link pageSize} properties. Finally, access the view using the {@link items}
|
|
2802
|
+
* property. For example:
|
|
2803
|
+
*
|
|
2804
|
+
* ```typescript
|
|
2805
|
+
* import { CollectionView, SortDescription} from '@grapecity/wijmo';
|
|
2806
|
+
*
|
|
2807
|
+
* // create a CollectionView based on a data array
|
|
2808
|
+
* let view = new CollectionView(dataArray);
|
|
2809
|
+
*
|
|
2810
|
+
* // sort items by amount in descending order
|
|
2811
|
+
* let sortDesc = new SortDescription('amount', false);
|
|
2812
|
+
* view.sortDescriptions.push(sortDesc);
|
|
2813
|
+
*
|
|
2814
|
+
* // show only items with amounts greater than 100
|
|
2815
|
+
* view.filter = (item) => { return item.amount > 100 };
|
|
2816
|
+
*
|
|
2817
|
+
* // show the sorted, filtered result on the console
|
|
2818
|
+
* view.items.forEach((item, index) => {
|
|
2819
|
+
* console.log(index + ': ' + item.name + ' ' + item.amount);
|
|
2820
|
+
* });
|
|
2821
|
+
* ```
|
|
2822
|
+
*
|
|
2823
|
+
* The example below shows how you can use a {@link CollectionView}
|
|
2824
|
+
* to provide sorted views of some raw data:
|
|
2825
|
+
*
|
|
2826
|
+
* {@sample Core/CollectionView/CreatingViews/Sorting/Overview Example}
|
|
2827
|
+
*/
|
|
2828
|
+
export declare class CollectionView<T = any> implements IEditableCollectionView, IPagedCollectionView {
|
|
2829
|
+
_srcRaw: T[];
|
|
2830
|
+
_src: T[];
|
|
2831
|
+
_ncc: INotifyCollectionChanged;
|
|
2832
|
+
_view: T[];
|
|
2833
|
+
_pgView: T[];
|
|
2834
|
+
_groups: CollectionViewGroup[] | null;
|
|
2835
|
+
_fullGroups: CollectionViewGroup[] | null;
|
|
2836
|
+
_digest: string;
|
|
2837
|
+
_idx: number;
|
|
2838
|
+
_filter: IPredicate;
|
|
2839
|
+
_filters: ObservableArray<IPredicate<any>>;
|
|
2840
|
+
_srtDsc: ObservableArray<SortDescription>;
|
|
2841
|
+
_grpDesc: ObservableArray<GroupDescription>;
|
|
2842
|
+
_newItem: T | null;
|
|
2843
|
+
_edtItem: T | null;
|
|
2844
|
+
_edtClone: any;
|
|
2845
|
+
_committing: boolean;
|
|
2846
|
+
_canceling: boolean;
|
|
2847
|
+
_pendingRefresh: boolean;
|
|
2848
|
+
_pendingRemove: boolean;
|
|
2849
|
+
_pgSz: number;
|
|
2850
|
+
_pgIdx: number;
|
|
2851
|
+
_updating: number;
|
|
2852
|
+
_itemCreator: IItemCreator<T>;
|
|
2853
|
+
_stableSort: boolean;
|
|
2854
|
+
_srtNulls: SortNulls;
|
|
2855
|
+
_canFilter: boolean;
|
|
2856
|
+
_canGroup: boolean;
|
|
2857
|
+
_canSort: boolean;
|
|
2858
|
+
_canAddNew: boolean;
|
|
2859
|
+
_canCancelEdit: boolean;
|
|
2860
|
+
_canRemove: boolean;
|
|
2861
|
+
_canChangePage: boolean;
|
|
2862
|
+
_refreshOnEdit: boolean;
|
|
2863
|
+
_trackChanges: boolean;
|
|
2864
|
+
_chgAdded: ObservableArray<T>;
|
|
2865
|
+
_chgRemoved: ObservableArray<T>;
|
|
2866
|
+
_chgEdited: ObservableArray<T>;
|
|
2867
|
+
_orgVals: Map<any, any>;
|
|
2868
|
+
_srtCvt: ISortConverter<T> | null;
|
|
2869
|
+
_srtCmp: IComparer<T> | null;
|
|
2870
|
+
_getError: IGetError<T> | null;
|
|
2871
|
+
_keepCurrentItem: boolean | null;
|
|
2872
|
+
_initializing: boolean;
|
|
2873
|
+
_calcFields: any;
|
|
2874
|
+
static _collator: Intl.Collator;
|
|
2875
|
+
/**
|
|
2876
|
+
* Initializes a new instance of the {@link CollectionView} class.
|
|
2877
|
+
*
|
|
2878
|
+
* @param sourceCollection Array that serves as a source for this
|
|
2879
|
+
* {@link CollectionView}.
|
|
2880
|
+
* @param options JavaScript object containing initialization data for the control.
|
|
2881
|
+
*/
|
|
2882
|
+
constructor(sourceCollection?: any, options?: any);
|
|
2883
|
+
_copy(key: string, value: any): boolean;
|
|
2884
|
+
/**
|
|
2885
|
+
* Gets or sets an object where the keys represent calculated fields
|
|
2886
|
+
* and the values are expressions (functions or strings).
|
|
2887
|
+
*
|
|
2888
|
+
* Calculated fields require proxies. To use them in IE11, you will
|
|
2889
|
+
* need a polyfill such as this one:
|
|
2890
|
+
* https://www.npmjs.com/package/proxy-polyfill.
|
|
2891
|
+
*
|
|
2892
|
+
* Calculated fields can be useful when dealing with external data.
|
|
2893
|
+
* For example, you could add a per-capita income field (gnp/pop) or a
|
|
2894
|
+
* profit field (revenue-expenses).
|
|
2895
|
+
*
|
|
2896
|
+
* Calculated fields are dynamic. If you change the fields used in the
|
|
2897
|
+
* calculation, their values are updated automatically. They are also
|
|
2898
|
+
* read-only. You may change the value of the properties used to calculate
|
|
2899
|
+
* them, but you cannot directly edit the result.
|
|
2900
|
+
*
|
|
2901
|
+
* Unlike {@link FlexGrid} cellTemplates, calculated fields can be used
|
|
2902
|
+
* for sorting, filtering, and grouping. They can also be used with charts
|
|
2903
|
+
* and any other Wijmo controls.
|
|
2904
|
+
*
|
|
2905
|
+
* Calculated fields can be defined as functions that take a data item
|
|
2906
|
+
* as an argument or as strings.
|
|
2907
|
+
*
|
|
2908
|
+
* For example, if your data looked like this:
|
|
2909
|
+
*
|
|
2910
|
+
* ```typescript
|
|
2911
|
+
* // regular data item
|
|
2912
|
+
* interface IDataItem {
|
|
2913
|
+
* product: string,
|
|
2914
|
+
* brand: string,
|
|
2915
|
+
* unitPrice: number,
|
|
2916
|
+
* qty: number,
|
|
2917
|
+
* shipped: boolean
|
|
2918
|
+
* }
|
|
2919
|
+
* function getData(): IDataItem[] {
|
|
2920
|
+
* return [
|
|
2921
|
+
* {
|
|
2922
|
+
* product: 'Banana',
|
|
2923
|
+
* brand: 'Chiquita',
|
|
2924
|
+
* unitPrice: 45.95,
|
|
2925
|
+
* qty: 12,
|
|
2926
|
+
* discount: .08,
|
|
2927
|
+
* shipped: true
|
|
2928
|
+
* }, ...
|
|
2929
|
+
* ]
|
|
2930
|
+
* }
|
|
2931
|
+
* ```
|
|
2932
|
+
*
|
|
2933
|
+
* You could add function-based calculated fields this way:
|
|
2934
|
+
*
|
|
2935
|
+
* ```typescript
|
|
2936
|
+
* // add calculated properties to IDataItem
|
|
2937
|
+
* interface ICalcDataItem extends IDataItem {
|
|
2938
|
+
* fullName: string;
|
|
2939
|
+
* allCaps: string;
|
|
2940
|
+
* totalPrice: number,
|
|
2941
|
+
* tax: number;
|
|
2942
|
+
* }
|
|
2943
|
+
*
|
|
2944
|
+
* let cv = new CollectionView<ICalcDataItem>(getData(), {
|
|
2945
|
+
* calculatedFields: {
|
|
2946
|
+
* fullName: ($: ICalcDataItem) => [$.brand, $.product].join(' '),
|
|
2947
|
+
* allCaps: ($: ICalcDataItem) => $.fullName.toUpperCase(),
|
|
2948
|
+
* totalPrice: ($: ICalcDataItem) => ($.unitPrice * $.qty) * (1 - $.discount),
|
|
2949
|
+
* tax: ($: ICalcDataItem) => $.totalPrice * 0.12
|
|
2950
|
+
* }
|
|
2951
|
+
* });
|
|
2952
|
+
* ```
|
|
2953
|
+
* **Function-based calculated fields** are usually a better choice than
|
|
2954
|
+
* string-based calculated fields because:
|
|
2955
|
+
*
|
|
2956
|
+
* 1) They provide design-time error checking and command completion,
|
|
2957
|
+
* 2) They run faster, and
|
|
2958
|
+
* 3) They do not have any issues with content-security policy (CSP).
|
|
2959
|
+
*
|
|
2960
|
+
* Alternatively, you could add string-based calculated fields:
|
|
2961
|
+
*
|
|
2962
|
+
* ```typescript
|
|
2963
|
+
* let cv = new CollectionView<IDataItem>(getData(), {
|
|
2964
|
+
* calculatedFields: {
|
|
2965
|
+
* fullName: '[$.brand, $.product].join(" ")',
|
|
2966
|
+
* allCaps: '$.fullNameStr.toUpperCase()',
|
|
2967
|
+
* totalPrice: '($.unitPrice * $.qty) * (1 - $.discount)',
|
|
2968
|
+
* tax: '$.totalPrice * 0.12'
|
|
2969
|
+
* });
|
|
2970
|
+
* ```
|
|
2971
|
+
* String expressions may refer to the current item via the context
|
|
2972
|
+
* variable '$', which contains the item's original and calculated
|
|
2973
|
+
* values.
|
|
2974
|
+
*
|
|
2975
|
+
* **String-based calculated fields** have advantages over function-based
|
|
2976
|
+
* calculated fields that may be important in some scenarios:
|
|
2977
|
+
*
|
|
2978
|
+
* 1) They are slightly more concise, and
|
|
2979
|
+
* 2) They can be stored as data and easily changed at run-time.
|
|
2980
|
+
*/
|
|
2981
|
+
calculatedFields: any;
|
|
2982
|
+
/**
|
|
2983
|
+
* Gets or sets a function that creates new items for the collection.
|
|
2984
|
+
*
|
|
2985
|
+
* If the creator function is not supplied, the {@link CollectionView}
|
|
2986
|
+
* will try to create an uninitialized item of the appropriate type.
|
|
2987
|
+
*
|
|
2988
|
+
* If the creator function is supplied, it should be a function that
|
|
2989
|
+
* takes no parameters and returns an initialized object of the proper
|
|
2990
|
+
* type for the collection.
|
|
2991
|
+
*/
|
|
2992
|
+
newItemCreator: IItemCreator<T>;
|
|
2993
|
+
/**
|
|
2994
|
+
* Gets or sets a function used to convert values when sorting.
|
|
2995
|
+
*
|
|
2996
|
+
* If provided, the function should take as parameters a
|
|
2997
|
+
* {@link SortDescription}, a data item, and a value to convert,
|
|
2998
|
+
* and should return the converted value.
|
|
2999
|
+
*
|
|
3000
|
+
* This property provides a way to customize sorting. For example,
|
|
3001
|
+
* the {@link FlexGrid} control uses it to sort mapped columns by
|
|
3002
|
+
* display value instead of by raw value.
|
|
3003
|
+
*
|
|
3004
|
+
* For example, the code below causes a {@link CollectionView} to
|
|
3005
|
+
* sort the 'country' property, which contains country code integers,
|
|
3006
|
+
* using the corresponding country names:
|
|
3007
|
+
*
|
|
3008
|
+
* ```typescript
|
|
3009
|
+
* const countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
|
|
3010
|
+
* view.sortConverter = (sd: SortDescription, item: any, value: any) => {
|
|
3011
|
+
* return sd.property === 'countryMapped'
|
|
3012
|
+
* ? countries[value]; // convert country id into name
|
|
3013
|
+
* : value;
|
|
3014
|
+
* }
|
|
3015
|
+
* ```
|
|
3016
|
+
*
|
|
3017
|
+
* The next example combines two values so when sorting by country,
|
|
3018
|
+
* the view will break ties by city:
|
|
3019
|
+
*
|
|
3020
|
+
* ```typescript
|
|
3021
|
+
* view.sortConverter: (sd: SortDescription, item: any, value: any) => {
|
|
3022
|
+
* if (sd.property == 'country') {
|
|
3023
|
+
* value = item.country + '\t' + item.city;
|
|
3024
|
+
* }
|
|
3025
|
+
* return value;
|
|
3026
|
+
* }
|
|
3027
|
+
* ```
|
|
3028
|
+
*/
|
|
3029
|
+
sortConverter: ISortConverter;
|
|
3030
|
+
/**
|
|
3031
|
+
* Gets or sets a function used to compare values when sorting.
|
|
3032
|
+
*
|
|
3033
|
+
* If provided, the sort comparer function should take as parameters
|
|
3034
|
+
* two values of any type, and should return -1, 0, or +1 to indicate
|
|
3035
|
+
* whether the first value is smaller than, equal to, or greater than
|
|
3036
|
+
* the second. If the sort comparer returns null, the standard built-in
|
|
3037
|
+
* comparer is used.
|
|
3038
|
+
*
|
|
3039
|
+
* This {@link sortComparer} property allows you to use custom comparison
|
|
3040
|
+
* algorithms that in some cases result in sorting sequences that are
|
|
3041
|
+
* more consistent with user's expectations than plain string comparisons.
|
|
3042
|
+
*
|
|
3043
|
+
* For example, see
|
|
3044
|
+
* <a href="http://www.davekoelle.com/alphanum.html">Dave Koele's Alphanum algorithm</a>.
|
|
3045
|
+
* It breaks up strings into chunks composed of strings or numbers, then
|
|
3046
|
+
* sorts number chunks in value order and string chunks in ASCII order.
|
|
3047
|
+
* Dave calls the result a "natural sorting order".
|
|
3048
|
+
*
|
|
3049
|
+
* The example below shows a typical use for the {@link sortComparer} property:
|
|
3050
|
+
*
|
|
3051
|
+
* ```typescript
|
|
3052
|
+
* import { CollectionView, isString } from '@grapecity/wijmo';
|
|
3053
|
+
*
|
|
3054
|
+
* // create a CollectionView with a custom sort comparer
|
|
3055
|
+
* const view = new CollectionView(data, {
|
|
3056
|
+
* sortComparer: (a: any, b: any) => {
|
|
3057
|
+
* return isString(a) && isString(b)
|
|
3058
|
+
* ? alphanum(a, b) // use custom comparer for strings
|
|
3059
|
+
* : null; // use default comparer for everything else
|
|
3060
|
+
* }
|
|
3061
|
+
* });
|
|
3062
|
+
* ```
|
|
3063
|
+
*
|
|
3064
|
+
* The example below shows how you can use an
|
|
3065
|
+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator">Intl.Collator</a>
|
|
3066
|
+
* to control the sort order:
|
|
3067
|
+
*
|
|
3068
|
+
* ```typescript
|
|
3069
|
+
* import { CollectionView, isString } from '@grapecity/wijmo';
|
|
3070
|
+
*
|
|
3071
|
+
* // create a CollectionView that uses an Intl.Collator to sort
|
|
3072
|
+
* const collator = window.Intl ? new Intl.Collator() : null;
|
|
3073
|
+
* let view = new CollectionView(data, {
|
|
3074
|
+
* sortComparer: (a, b) => {
|
|
3075
|
+
* return isString(a) && isString(b) && collator
|
|
3076
|
+
* ? collator.compare(a, b) // use collator for strings
|
|
3077
|
+
* : null; // use default comparer for everything else
|
|
3078
|
+
* }
|
|
3079
|
+
* });
|
|
3080
|
+
* ```
|
|
3081
|
+
*/
|
|
3082
|
+
sortComparer: IComparer<T>;
|
|
3083
|
+
/**
|
|
3084
|
+
* Gets or sets whether to use a stable sort algorithm.
|
|
3085
|
+
*
|
|
3086
|
+
* Stable sorting algorithms maintain the relative order of records with equal keys.
|
|
3087
|
+
* For example, consider a collection of objects with an "Amount" field.
|
|
3088
|
+
* If you sort the collection by "Amount", a stable sort will keep the original
|
|
3089
|
+
* order of records with the same Amount value.
|
|
3090
|
+
*
|
|
3091
|
+
* The default value for this property is **false**, which causes the
|
|
3092
|
+
* {@link CollectionView} to use JavaScript's built-in sort method, which is fast
|
|
3093
|
+
* and usually stable.
|
|
3094
|
+
*
|
|
3095
|
+
* Chrome provides stable sorting since version 70, and Firefox since version 3.
|
|
3096
|
+
* As of ES2019, sort is **required** to be stable. In ECMAScript 1st edition through
|
|
3097
|
+
* ES2018, it was allowed to be unstable.
|
|
3098
|
+
*
|
|
3099
|
+
* Setting the {@link useStableSort} property to true ensures stable sorts on all
|
|
3100
|
+
* browsers (even IE 11), but increases sort times by 30% to 50%.
|
|
3101
|
+
*/
|
|
3102
|
+
useStableSort: boolean;
|
|
3103
|
+
/**
|
|
3104
|
+
* Gets or sets a value that determines how null values should be sorted.
|
|
3105
|
+
*
|
|
3106
|
+
* This property is set to **SortNulls.Last** by default, which causes null values
|
|
3107
|
+
* to appear last on the sorted collection, regardless of sort direction.
|
|
3108
|
+
* This is also the default behavior in Excel.
|
|
3109
|
+
*/
|
|
3110
|
+
sortNulls: SortNulls;
|
|
3111
|
+
sortNullsFirst: boolean;
|
|
3112
|
+
/**
|
|
3113
|
+
* Calculates an aggregate value for the items in this collection.
|
|
3114
|
+
*
|
|
3115
|
+
* @param aggType Type of aggregate to calculate.
|
|
3116
|
+
* @param binding Property to aggregate on.
|
|
3117
|
+
* @param currentPage Whether to include only items on the current page.
|
|
3118
|
+
* @return The aggregate value.
|
|
3119
|
+
*/
|
|
3120
|
+
getAggregate(aggType: Aggregate, binding: string, currentPage?: boolean): any;
|
|
3121
|
+
/**
|
|
3122
|
+
* Gets or sets a value that determines whether the control should
|
|
3123
|
+
* track changes to the data.
|
|
3124
|
+
*
|
|
3125
|
+
* The default value for this property is **false**, so the {@link CollectionView}
|
|
3126
|
+
* does not keep track of which data items have changed.
|
|
3127
|
+
*
|
|
3128
|
+
* If you set this property to **true**, the {@link CollectionView} will keep
|
|
3129
|
+
* track of changes to the data and will expose them through the {@link itemsAdded},
|
|
3130
|
+
* {@link itemsRemoved}, and {@link itemsEdited} collections.
|
|
3131
|
+
*
|
|
3132
|
+
* Tracking changes is useful in situations where you need to update
|
|
3133
|
+
* the server after the user has confirmed that the modifications are
|
|
3134
|
+
* valid.
|
|
3135
|
+
*
|
|
3136
|
+
* After committing or cancelling changes, use the {@link clearChanges} method
|
|
3137
|
+
* to clear the {@link itemsAdded}, {@link itemsRemoved}, and {@link itemsEdited}
|
|
3138
|
+
* collections.
|
|
3139
|
+
*
|
|
3140
|
+
* The {@link CollectionView} only tracks changes made when the proper
|
|
3141
|
+
* {@link CollectionView} methods are used ({@link editItem}/{@link commitEdit},
|
|
3142
|
+
* {@link addNew}/{@link commitNew}, and {@link remove}).
|
|
3143
|
+
* Changes made directly to the data are not tracked.
|
|
3144
|
+
*/
|
|
3145
|
+
trackChanges: boolean;
|
|
3146
|
+
/**
|
|
3147
|
+
* Gets or sets a value that determines whether the {@link CollectionView}
|
|
3148
|
+
* should automatically refresh its results (by applying the sort, filter,
|
|
3149
|
+
* and grouping operations) after items are edited.
|
|
3150
|
+
*
|
|
3151
|
+
* The default value for this property is **true**, which ensures the
|
|
3152
|
+
* collection is always sorted, filtered, and grouped correctly after any
|
|
3153
|
+
* edit operations.
|
|
3154
|
+
*
|
|
3155
|
+
* Set it to **false** if you want updates to be deferred when items
|
|
3156
|
+
* are edited. In this case, the collection will not be refreshed until
|
|
3157
|
+
* the sorting, filtering, and grouping criteria change or until the
|
|
3158
|
+
* {@link refresh} method is called (Excel behavior).
|
|
3159
|
+
*/
|
|
3160
|
+
refreshOnEdit: boolean;
|
|
3161
|
+
/**
|
|
3162
|
+
* Gets an {@link ObservableArray} containing the records that were added to
|
|
3163
|
+
* the collection since {@link trackChanges} was enabled.
|
|
3164
|
+
*/
|
|
3165
|
+
readonly itemsAdded: ObservableArray;
|
|
3166
|
+
/**
|
|
3167
|
+
* Gets an {@link ObservableArray} containing the records that were removed from
|
|
3168
|
+
* the collection since {@link trackChanges} was enabled.
|
|
3169
|
+
*/
|
|
3170
|
+
readonly itemsRemoved: ObservableArray;
|
|
3171
|
+
/**
|
|
3172
|
+
* Gets an {@link ObservableArray} containing the records that were edited in
|
|
3173
|
+
* the collection since {@link trackChanges} was enabled.
|
|
3174
|
+
*/
|
|
3175
|
+
readonly itemsEdited: ObservableArray;
|
|
3176
|
+
/**
|
|
3177
|
+
* Clears all changes by removing all items in the {@link itemsAdded},
|
|
3178
|
+
* {@link itemsRemoved}, and {@link itemsEdited} collections.
|
|
3179
|
+
*
|
|
3180
|
+
* Call this method after committing changes to the server or
|
|
3181
|
+
* after refreshing the data from the server.
|
|
3182
|
+
*/
|
|
3183
|
+
clearChanges(): void;
|
|
3184
|
+
/**
|
|
3185
|
+
* Returns true if this object supports a given interface.
|
|
3186
|
+
*
|
|
3187
|
+
* @param interfaceName Name of the interface to look for.
|
|
3188
|
+
*/
|
|
3189
|
+
implementsInterface(interfaceName: string): boolean;
|
|
3190
|
+
/**
|
|
3191
|
+
* Gets or sets a callback that determines whether a specific property
|
|
3192
|
+
* of an item contains validation errors.
|
|
3193
|
+
*
|
|
3194
|
+
* The method takes as parameters a data item, the property being validated,
|
|
3195
|
+
* and a parsing parameter that describes whether the data has already been
|
|
3196
|
+
* parsed and applied to the data item (parsing == false), or whether the user
|
|
3197
|
+
* was trying to edit the value and entered a value that could not be parsed
|
|
3198
|
+
* into the data type expected (parsing == true).
|
|
3199
|
+
*
|
|
3200
|
+
* The method returns a string containing an error message, or null if no
|
|
3201
|
+
* errors were detected.
|
|
3202
|
+
*
|
|
3203
|
+
* For example,
|
|
3204
|
+
*
|
|
3205
|
+
* ```typescript
|
|
3206
|
+
* view = new CollectionView(data, {
|
|
3207
|
+
* getError: (item: any, prop: string, parsing: boolean) => {
|
|
3208
|
+
*
|
|
3209
|
+
* // parsing failed, show message
|
|
3210
|
+
* if (parsing) {
|
|
3211
|
+
* if (prop == 'date') {
|
|
3212
|
+
* return 'Please enter a valid date in the format "MM/dd/yyyy"';
|
|
3213
|
+
* } else if (prop == 'id') {
|
|
3214
|
+
* return 'Please enter a positive number';
|
|
3215
|
+
* }
|
|
3216
|
+
* }
|
|
3217
|
+
*
|
|
3218
|
+
* // check that stored (parsed) data is valid
|
|
3219
|
+
* if (prop == 'date' && item.date < minDate) {
|
|
3220
|
+
* return 'Please enter a date after ' + Globalize.formatDate(minDate, 'd');
|
|
3221
|
+
* } else if (prop == 'id' && item.id < 0) {
|
|
3222
|
+
* return 'Please enter a positive number';
|
|
3223
|
+
* }
|
|
3224
|
+
* }
|
|
3225
|
+
* });
|
|
3226
|
+
* ```
|
|
3227
|
+
*/
|
|
3228
|
+
getError: IGetError | null;
|
|
3229
|
+
/**
|
|
3230
|
+
* Occurs when the collection changes.
|
|
3231
|
+
*/
|
|
3232
|
+
readonly collectionChanged: Event<ICollectionView<T>, NotifyCollectionChangedEventArgs<T>>;
|
|
3233
|
+
/**
|
|
3234
|
+
* Raises the {@link collectionChanged} event.
|
|
3235
|
+
*
|
|
3236
|
+
* @param e Contains a description of the change.
|
|
3237
|
+
*/
|
|
3238
|
+
onCollectionChanged(e?: NotifyCollectionChangedEventArgs<any>, clone?: any): void;
|
|
3239
|
+
protected _raiseCollectionChanged(action?: NotifyCollectionChangedAction, item?: T, index?: number): void;
|
|
3240
|
+
/**
|
|
3241
|
+
* Occurs before the value of the {@link sourceCollection} property changes.
|
|
3242
|
+
*/
|
|
3243
|
+
readonly sourceCollectionChanging: Event<ICollectionView<T>, CancelEventArgs>;
|
|
3244
|
+
/**
|
|
3245
|
+
* Raises the {@link sourceCollectionChanging} event.
|
|
3246
|
+
*
|
|
3247
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
3248
|
+
*/
|
|
3249
|
+
onSourceCollectionChanging(e: CancelEventArgs): boolean;
|
|
3250
|
+
/**
|
|
3251
|
+
* Occurs after the value of the {@link sourceCollection} property changes.
|
|
3252
|
+
*/
|
|
3253
|
+
readonly sourceCollectionChanged: Event<ICollectionView<T>, EventArgs>;
|
|
3254
|
+
/**
|
|
3255
|
+
* Raises the {@link sourceCollectionChanged} event.
|
|
3256
|
+
*/
|
|
3257
|
+
onSourceCollectionChanged(e?: EventArgs): void;
|
|
3258
|
+
/**
|
|
3259
|
+
* Gets a value that indicates whether this view supports filtering via the
|
|
3260
|
+
* {@link filter} property.
|
|
3261
|
+
*
|
|
3262
|
+
* This property does not affect the {@link filters} property, which are
|
|
3263
|
+
* always applied.
|
|
3264
|
+
*/
|
|
3265
|
+
canFilter: boolean;
|
|
3266
|
+
/**
|
|
3267
|
+
* Gets a value that indicates whether this view supports grouping via the
|
|
3268
|
+
* {@link groupDescriptions} property.
|
|
3269
|
+
*/
|
|
3270
|
+
canGroup: boolean;
|
|
3271
|
+
/**
|
|
3272
|
+
* Gets a value that indicates whether this view supports sorting via the
|
|
3273
|
+
* {@link sortDescriptions} property.
|
|
3274
|
+
*/
|
|
3275
|
+
canSort: boolean;
|
|
3276
|
+
/**
|
|
3277
|
+
* Gets or sets the current item in the view.
|
|
3278
|
+
*/
|
|
3279
|
+
currentItem: T;
|
|
3280
|
+
/**
|
|
3281
|
+
* Gets the ordinal position of the current item in the view.
|
|
3282
|
+
*/
|
|
3283
|
+
currentPosition: number;
|
|
3284
|
+
/**
|
|
3285
|
+
* Gets or sets a callback used to determine if an item is suitable for
|
|
3286
|
+
* inclusion in the view.
|
|
3287
|
+
*
|
|
3288
|
+
* The callback should return true if the item passed in as a parameter
|
|
3289
|
+
* should be included in the view.
|
|
3290
|
+
*
|
|
3291
|
+
* The default value for this property is **null**, which means the
|
|
3292
|
+
* data is not filtered.
|
|
3293
|
+
*/
|
|
3294
|
+
filter: IPredicate | null;
|
|
3295
|
+
/**
|
|
3296
|
+
* Gets an array of {@link IPredicate} functions used as filters
|
|
3297
|
+
* on this {@link CollectionView}.
|
|
3298
|
+
*
|
|
3299
|
+
* To be included in the view, an item has to pass the predicate
|
|
3300
|
+
* in the {@link filter} property as well as all predicates in
|
|
3301
|
+
* the {@link filters} collection.
|
|
3302
|
+
*/
|
|
3303
|
+
readonly filters: ObservableArray<IPredicate>;
|
|
3304
|
+
/**
|
|
3305
|
+
* Gets a collection of {@link GroupDescription} objects that describe how the
|
|
3306
|
+
* items in the collection are grouped in the view.
|
|
3307
|
+
*/
|
|
3308
|
+
readonly groupDescriptions: ObservableArray<GroupDescription>;
|
|
3309
|
+
/**
|
|
3310
|
+
* Gets an array of {@link CollectionViewGroup} objects that represents the
|
|
3311
|
+
* top-level groups.
|
|
3312
|
+
*/
|
|
3313
|
+
readonly groups: CollectionViewGroup[];
|
|
3314
|
+
/**
|
|
3315
|
+
* Gets a value that indicates whether this view contains no items.
|
|
3316
|
+
*/
|
|
3317
|
+
readonly isEmpty: boolean;
|
|
3318
|
+
/**
|
|
3319
|
+
* Gets an array of {@link SortDescription} objects that describe how the items
|
|
3320
|
+
* in the collection are sorted in the view.
|
|
3321
|
+
*/
|
|
3322
|
+
readonly sortDescriptions: ObservableArray<SortDescription>;
|
|
3323
|
+
/**
|
|
3324
|
+
* Gets or sets the underlying (unfiltered and unsorted) collection.
|
|
3325
|
+
*/
|
|
3326
|
+
sourceCollection: any;
|
|
3327
|
+
private _sourceChanged;
|
|
3328
|
+
/**
|
|
3329
|
+
* Returns a value indicating whether a given item belongs to this view.
|
|
3330
|
+
*
|
|
3331
|
+
* @param item Item to seek.
|
|
3332
|
+
*/
|
|
3333
|
+
contains(item: T): boolean;
|
|
3334
|
+
/**
|
|
3335
|
+
* Sets the specified item to be the current item in the view.
|
|
3336
|
+
*
|
|
3337
|
+
* @param item Item that will become current.
|
|
3338
|
+
*/
|
|
3339
|
+
moveCurrentTo(item: T): boolean;
|
|
3340
|
+
/**
|
|
3341
|
+
* Sets the first item in the view as the current item.
|
|
3342
|
+
*/
|
|
3343
|
+
moveCurrentToFirst(): boolean;
|
|
3344
|
+
/**
|
|
3345
|
+
* Sets the last item in the view as the current item.
|
|
3346
|
+
*/
|
|
3347
|
+
moveCurrentToLast(): boolean;
|
|
3348
|
+
/**
|
|
3349
|
+
* Sets the item before the current item in the view as the current item.
|
|
3350
|
+
*/
|
|
3351
|
+
moveCurrentToPrevious(): boolean;
|
|
3352
|
+
/**
|
|
3353
|
+
* Sets the item after the current item in the view as the current item.
|
|
3354
|
+
*/
|
|
3355
|
+
moveCurrentToNext(): boolean;
|
|
3356
|
+
/**
|
|
3357
|
+
* Sets the item at the specified index in the view as the current item.
|
|
3358
|
+
*
|
|
3359
|
+
* @param index Index of the item that will become current.
|
|
3360
|
+
*/
|
|
3361
|
+
moveCurrentToPosition(index: number): boolean;
|
|
3362
|
+
/**
|
|
3363
|
+
* Re-creates the view using the current sort, filter, and group parameters.
|
|
3364
|
+
*/
|
|
3365
|
+
refresh(): void;
|
|
3366
|
+
_commitAndRefresh(): void;
|
|
3367
|
+
_performRefresh(): void;
|
|
3368
|
+
_performSort(items: any[]): void;
|
|
3369
|
+
_compareItems(): (a: any, b: any) => number;
|
|
3370
|
+
_performFilter(items: any[]): any[];
|
|
3371
|
+
_filterItem(item: any): boolean;
|
|
3372
|
+
/**
|
|
3373
|
+
* Occurs after the current item changes.
|
|
3374
|
+
*/
|
|
3375
|
+
readonly currentChanged: Event<ICollectionView<T>, EventArgs>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Raises the {@link currentChanged} event.
|
|
3378
|
+
*/
|
|
3379
|
+
onCurrentChanged(e?: EventArgs): void;
|
|
3380
|
+
/**
|
|
3381
|
+
* Occurs before the current item changes.
|
|
3382
|
+
*/
|
|
3383
|
+
readonly currentChanging: Event<ICollectionView<T>, CancelEventArgs>;
|
|
3384
|
+
/**
|
|
3385
|
+
* Raises the {@link currentChanging} event.
|
|
3386
|
+
*
|
|
3387
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
3388
|
+
*/
|
|
3389
|
+
onCurrentChanging(e: CancelEventArgs): boolean;
|
|
3390
|
+
/**
|
|
3391
|
+
* Gets items in the view.
|
|
3392
|
+
*/
|
|
3393
|
+
readonly items: T[];
|
|
3394
|
+
/**
|
|
3395
|
+
* Suspend refreshes until the next call to {@link endUpdate}.
|
|
3396
|
+
*/
|
|
3397
|
+
beginUpdate(): void;
|
|
3398
|
+
/**
|
|
3399
|
+
* Resume refreshes suspended by a call to {@link beginUpdate}.
|
|
3400
|
+
*
|
|
3401
|
+
* @param force Whether to force a refresh when ending the update.
|
|
3402
|
+
*/
|
|
3403
|
+
endUpdate(force?: boolean): void;
|
|
3404
|
+
/**
|
|
3405
|
+
* Gets a value that indicates whether notifications are currently suspended
|
|
3406
|
+
* (see {@link beginUpdate} and {@link endUpdate}).
|
|
3407
|
+
*/
|
|
3408
|
+
readonly isUpdating: boolean;
|
|
3409
|
+
/**
|
|
3410
|
+
* Executes a function within a {@link beginUpdate}/{@link endUpdate} block.
|
|
3411
|
+
*
|
|
3412
|
+
* The collection will not be refreshed until the function finishes.
|
|
3413
|
+
*
|
|
3414
|
+
* The {@link deferUpdate} method ensures {@link endUpdate} is called even
|
|
3415
|
+
* if the update function throws an exception.
|
|
3416
|
+
*
|
|
3417
|
+
* @param fn Function to be executed without updates.
|
|
3418
|
+
* @param force Whether to force a refresh when ending the update.
|
|
3419
|
+
*/
|
|
3420
|
+
deferUpdate(fn: Function, force?: boolean): void;
|
|
3421
|
+
/**
|
|
3422
|
+
* Gets a value that indicates whether a new item can be added to the collection.
|
|
3423
|
+
*/
|
|
3424
|
+
canAddNew: boolean;
|
|
3425
|
+
/**
|
|
3426
|
+
* Gets a value that indicates whether the collection view can discard pending changes
|
|
3427
|
+
* and restore the original values of an edited object.
|
|
3428
|
+
*/
|
|
3429
|
+
canCancelEdit: boolean;
|
|
3430
|
+
/**
|
|
3431
|
+
* Gets a value that indicates whether items can be removed from the collection.
|
|
3432
|
+
*/
|
|
3433
|
+
canRemove: boolean;
|
|
3434
|
+
/**
|
|
3435
|
+
* Gets the item that is being added during the current add transaction.
|
|
3436
|
+
*/
|
|
3437
|
+
readonly currentAddItem: T;
|
|
3438
|
+
/**
|
|
3439
|
+
* Gets the item that is being edited during the current edit transaction.
|
|
3440
|
+
*/
|
|
3441
|
+
readonly currentEditItem: T;
|
|
3442
|
+
/**
|
|
3443
|
+
* Gets a value that indicates whether an add transaction is in progress.
|
|
3444
|
+
*/
|
|
3445
|
+
readonly isAddingNew: boolean;
|
|
3446
|
+
/**
|
|
3447
|
+
* Gets a value that indicates whether an edit transaction is in progress.
|
|
3448
|
+
*/
|
|
3449
|
+
readonly isEditingItem: boolean;
|
|
3450
|
+
/**
|
|
3451
|
+
* Begins an edit transaction of the specified item.
|
|
3452
|
+
*
|
|
3453
|
+
* @param item Item to be edited.
|
|
3454
|
+
*/
|
|
3455
|
+
editItem(item: T): void;
|
|
3456
|
+
/**
|
|
3457
|
+
* Ends the current edit transaction and saves the pending changes.
|
|
3458
|
+
*/
|
|
3459
|
+
commitEdit(): void;
|
|
3460
|
+
/**
|
|
3461
|
+
* Ends the current edit transaction and, if possible,
|
|
3462
|
+
* restores the original value to the item.
|
|
3463
|
+
*/
|
|
3464
|
+
cancelEdit(): void;
|
|
3465
|
+
/**
|
|
3466
|
+
* Adds a new item to the collection.
|
|
3467
|
+
*
|
|
3468
|
+
* Calling this methods without any parameters creates a new item, adds it to the
|
|
3469
|
+
* collection, and defers refresh operations until the new item is committed using
|
|
3470
|
+
* the {@link commitNew} method or canceled using the {@link cancelNew} method.
|
|
3471
|
+
*
|
|
3472
|
+
* The code below shows how the {@link addNew} method is typically used:
|
|
3473
|
+
*
|
|
3474
|
+
* ```typescript
|
|
3475
|
+
* // create the new item, add it to the collection
|
|
3476
|
+
* var newItem = view.addNew();
|
|
3477
|
+
*
|
|
3478
|
+
* // initialize the new item
|
|
3479
|
+
* newItem.id = getFreshId();
|
|
3480
|
+
* newItem.name = 'New Customer';
|
|
3481
|
+
*
|
|
3482
|
+
* // commit the new item so the view can be refreshed
|
|
3483
|
+
* view.commitNew();
|
|
3484
|
+
* ```
|
|
3485
|
+
*
|
|
3486
|
+
* You can also add new items by pushing them into the {@link sourceCollection}
|
|
3487
|
+
* and then calling the {@link refresh} method. The main advantage of {@link addNew}
|
|
3488
|
+
* is in user-interactive scenarios (like adding new items in a data grid),
|
|
3489
|
+
* because it gives users the ability to cancel the add operation. It also
|
|
3490
|
+
* prevents the new item from being sorted or filtered out of view until the
|
|
3491
|
+
* transaction is committed.
|
|
3492
|
+
*
|
|
3493
|
+
* New items are empty objects by default, unless the colletion has
|
|
3494
|
+
* {@link calculatedFields}, in which case the new items will have properties
|
|
3495
|
+
* set to values that depend on their data types (empty strings for string
|
|
3496
|
+
* properties, zero for numeric properties, and null for other data types).
|
|
3497
|
+
*
|
|
3498
|
+
* This behavior is convenient since in many cases the calculated fields
|
|
3499
|
+
* depend on expressions that rely on strings not being null. But you can
|
|
3500
|
+
* customize this behavior by setting the {@link newItemCreator} property
|
|
3501
|
+
* to a function that creates the new items and initializes them in any
|
|
3502
|
+
* way you want.
|
|
3503
|
+
*
|
|
3504
|
+
* @param item Item to be added to the collection (optional).
|
|
3505
|
+
* @param commit Whether to commit the new item immediately.
|
|
3506
|
+
* @return The item that was added to the collection, or null if the transaction
|
|
3507
|
+
* failed.
|
|
3508
|
+
*/
|
|
3509
|
+
addNew(item?: T, commit?: boolean): T;
|
|
3510
|
+
/**
|
|
3511
|
+
* Ends the current add transaction and saves the pending new item.
|
|
3512
|
+
*/
|
|
3513
|
+
commitNew(): void;
|
|
3514
|
+
/**
|
|
3515
|
+
* Ends the current add transaction and discards the pending new item.
|
|
3516
|
+
*/
|
|
3517
|
+
cancelNew(): void;
|
|
3518
|
+
/**
|
|
3519
|
+
* Removes the specified item from the collection.
|
|
3520
|
+
*
|
|
3521
|
+
* @param item Item to be removed from the collection.
|
|
3522
|
+
*/
|
|
3523
|
+
remove(item: T): void;
|
|
3524
|
+
/**
|
|
3525
|
+
* Removes the item at the specified index from the collection.
|
|
3526
|
+
*
|
|
3527
|
+
* @param index Index of the item to be removed from the collection.
|
|
3528
|
+
* The index is relative to the view, not to the source collection.
|
|
3529
|
+
*/
|
|
3530
|
+
removeAt(index: number): void;
|
|
3531
|
+
_trackItemChanged(item: T, clone?: any): void;
|
|
3532
|
+
_extend(dst: any, src: any, level?: number): any;
|
|
3533
|
+
_getChangedFields(dst: any, src: any, level?: number): string[] | null;
|
|
3534
|
+
_sameValue(v1: any, v2: any, level?: number): boolean;
|
|
3535
|
+
_sameContent(dst: any, src: any): boolean;
|
|
3536
|
+
_needRefresh(changedFields: string[]): boolean;
|
|
3537
|
+
_getBindingRoot(name: string): string;
|
|
3538
|
+
/**
|
|
3539
|
+
* Gets a value that indicates whether the {@link pageIndex} value can change.
|
|
3540
|
+
*/
|
|
3541
|
+
canChangePage: boolean;
|
|
3542
|
+
/**
|
|
3543
|
+
* Gets a value that indicates whether the page index is changing.
|
|
3544
|
+
*/
|
|
3545
|
+
readonly isPageChanging: boolean;
|
|
3546
|
+
/**
|
|
3547
|
+
* Gets the total number of items in the view taking paging into account.
|
|
3548
|
+
*/
|
|
3549
|
+
readonly itemCount: number;
|
|
3550
|
+
/**
|
|
3551
|
+
* Gets the zero-based index of the current page.
|
|
3552
|
+
*/
|
|
3553
|
+
readonly pageIndex: number;
|
|
3554
|
+
/**
|
|
3555
|
+
* Gets or sets the number of items to display on each page.
|
|
3556
|
+
*
|
|
3557
|
+
* The default value for this property is **zero**, which
|
|
3558
|
+
* disables paging.
|
|
3559
|
+
*/
|
|
3560
|
+
pageSize: number;
|
|
3561
|
+
/**
|
|
3562
|
+
* Gets the total number of items in the view before paging is applied.
|
|
3563
|
+
*/
|
|
3564
|
+
readonly totalItemCount: number;
|
|
3565
|
+
/**
|
|
3566
|
+
* Gets the total number of pages.
|
|
3567
|
+
*/
|
|
3568
|
+
readonly pageCount: number;
|
|
3569
|
+
/**
|
|
3570
|
+
* Sets the first page as the current page.
|
|
3571
|
+
*
|
|
3572
|
+
* @return True if the page index was changed successfully.
|
|
3573
|
+
*/
|
|
3574
|
+
moveToFirstPage(): boolean;
|
|
3575
|
+
/**
|
|
3576
|
+
* Sets the last page as the current page.
|
|
3577
|
+
*
|
|
3578
|
+
* @return True if the page index was changed successfully.
|
|
3579
|
+
*/
|
|
3580
|
+
moveToLastPage(): boolean;
|
|
3581
|
+
/**
|
|
3582
|
+
* Moves to the page before the current page.
|
|
3583
|
+
*
|
|
3584
|
+
* @return True if the page index was changed successfully.
|
|
3585
|
+
*/
|
|
3586
|
+
moveToPreviousPage(): boolean;
|
|
3587
|
+
/**
|
|
3588
|
+
* Moves to the page after the current page.
|
|
3589
|
+
*
|
|
3590
|
+
* @return True if the page index was changed successfully.
|
|
3591
|
+
*/
|
|
3592
|
+
moveToNextPage(): boolean;
|
|
3593
|
+
/**
|
|
3594
|
+
* Moves to the page at the specified index.
|
|
3595
|
+
*
|
|
3596
|
+
* @param index Index of the page to move to.
|
|
3597
|
+
* @return True if the page index was changed successfully.
|
|
3598
|
+
*/
|
|
3599
|
+
moveToPage(index: number): boolean;
|
|
3600
|
+
/**
|
|
3601
|
+
* Occurs after the page index changes.
|
|
3602
|
+
*/
|
|
3603
|
+
readonly pageChanged: Event<IPagedCollectionView, EventArgs>;
|
|
3604
|
+
/**
|
|
3605
|
+
* Raises the {@link pageChanged} event.
|
|
3606
|
+
*/
|
|
3607
|
+
onPageChanged(e?: EventArgs): void;
|
|
3608
|
+
/**
|
|
3609
|
+
* Occurs before the page index changes.
|
|
3610
|
+
*/
|
|
3611
|
+
readonly pageChanging: Event<IPagedCollectionView, PageChangingEventArgs>;
|
|
3612
|
+
/**
|
|
3613
|
+
* Raises the {@link pageChanging} event.
|
|
3614
|
+
*
|
|
3615
|
+
* @param e {@link PageChangingEventArgs} that contains the event data.
|
|
3616
|
+
*/
|
|
3617
|
+
onPageChanging(e: PageChangingEventArgs): boolean;
|
|
3618
|
+
_getFullGroup(g: CollectionViewGroup): CollectionViewGroup;
|
|
3619
|
+
_getGroupByPath(groups: CollectionViewGroup[], level: number, path: string): CollectionViewGroup;
|
|
3620
|
+
_getPageView(): T[];
|
|
3621
|
+
_createGroups(items: any[]): CollectionViewGroup[] | null;
|
|
3622
|
+
private _getGroupsDigest;
|
|
3623
|
+
private _mergeGroupItems;
|
|
3624
|
+
private _getGroup;
|
|
3625
|
+
}
|
|
3626
|
+
/**
|
|
3627
|
+
* Represents a group created by a {@link CollectionView} object based on
|
|
3628
|
+
* its {@link CollectionView.groupDescriptions} property.
|
|
3629
|
+
*/
|
|
3630
|
+
export declare class CollectionViewGroup {
|
|
3631
|
+
_gd: GroupDescription;
|
|
3632
|
+
_name: string;
|
|
3633
|
+
_path: string;
|
|
3634
|
+
_level: number;
|
|
3635
|
+
_isBottomLevel: boolean;
|
|
3636
|
+
_groups: CollectionViewGroup[];
|
|
3637
|
+
_items: any[];
|
|
3638
|
+
/**
|
|
3639
|
+
* Initializes a new instance of the {@link CollectionViewGroup} class.
|
|
3640
|
+
*
|
|
3641
|
+
* @param groupDescription {@link GroupDescription} that owns the new group.
|
|
3642
|
+
* @param name Name of the new group.
|
|
3643
|
+
* @param level Level of the new group.
|
|
3644
|
+
* @param isBottomLevel Whether this group has any subgroups.
|
|
3645
|
+
*/
|
|
3646
|
+
constructor(groupDescription: GroupDescription, name: string, level: number, isBottomLevel: boolean);
|
|
3647
|
+
/**
|
|
3648
|
+
* Gets the name of this group.
|
|
3649
|
+
*/
|
|
3650
|
+
readonly name: string;
|
|
3651
|
+
/**
|
|
3652
|
+
* Gets the level of this group.
|
|
3653
|
+
*/
|
|
3654
|
+
readonly level: number;
|
|
3655
|
+
/**
|
|
3656
|
+
* Gets a value that indicates whether this group has any subgroups.
|
|
3657
|
+
*/
|
|
3658
|
+
readonly isBottomLevel: boolean;
|
|
3659
|
+
/**
|
|
3660
|
+
* Gets an array containing the items included in this group (including all subgroups).
|
|
3661
|
+
*/
|
|
3662
|
+
readonly items: any[];
|
|
3663
|
+
/**
|
|
3664
|
+
* Gets an array containing this group's subgroups.
|
|
3665
|
+
*/
|
|
3666
|
+
readonly groups: CollectionViewGroup[];
|
|
3667
|
+
/**
|
|
3668
|
+
* Gets the {@link GroupDescription} that owns this group.
|
|
3669
|
+
*/
|
|
3670
|
+
readonly groupDescription: GroupDescription;
|
|
3671
|
+
/**
|
|
3672
|
+
* Calculates an aggregate value for the items in this group.
|
|
3673
|
+
*
|
|
3674
|
+
* @param aggType Type of aggregate to calculate.
|
|
3675
|
+
* @param binding Property to aggregate on.
|
|
3676
|
+
* @param view CollectionView that owns this group.
|
|
3677
|
+
* @return The aggregate value.
|
|
3678
|
+
*/
|
|
3679
|
+
getAggregate(aggType: Aggregate, binding: string, view?: ICollectionView, sheet?: any): any;
|
|
3680
|
+
}
|
|
3681
|
+
export declare var controlBaseClass: ObjectConstructor;
|
|
3682
|
+
export declare class ControlBase extends controlBaseClass {
|
|
3683
|
+
constructor();
|
|
3684
|
+
}
|
|
3685
|
+
/**
|
|
3686
|
+
* Base class for all Wijmo controls.
|
|
3687
|
+
*
|
|
3688
|
+
* The {@link Control} class handles the association between DOM elements and the
|
|
3689
|
+
* actual control. Use the {@link hostElement} property to get the DOM element
|
|
3690
|
+
* that is hosting a control, or the {@link getControl} method to get the control
|
|
3691
|
+
* hosted in a given DOM element.
|
|
3692
|
+
*
|
|
3693
|
+
* The {@link Control} class also provides a common pattern for invalidating and
|
|
3694
|
+
* refreshing controls, for updating the control layout when its size changes,
|
|
3695
|
+
* and for handling the HTML templates that define the control structure.
|
|
3696
|
+
*/
|
|
3697
|
+
export declare class Control extends ControlBase {
|
|
3698
|
+
workingAs: "React" | "Angular" | "Angular2" | "PureJs";
|
|
3699
|
+
static sharedState: any;
|
|
3700
|
+
static _licKey: string;
|
|
3701
|
+
static _wme: HTMLElement;
|
|
3702
|
+
static _toWme: any;
|
|
3703
|
+
static _ctlCnt: number;
|
|
3704
|
+
static _touching: boolean;
|
|
3705
|
+
static _ctlInvalidInput: Control;
|
|
3706
|
+
static _toClearCtlInvalid: any;
|
|
3707
|
+
static _toInvalidInput: any;
|
|
3708
|
+
static _toTouch: any;
|
|
3709
|
+
static _REFRESH_INTERVAL: number;
|
|
3710
|
+
static _FOCUS_INTERVAL: number;
|
|
3711
|
+
static _ANIM_DEF_DURATION: number;
|
|
3712
|
+
static _ANIM_DEF_STEP: number;
|
|
3713
|
+
static _CLICK_DELAY: number;
|
|
3714
|
+
static _CLICK_REPEAT: number;
|
|
3715
|
+
static _CLIPBOARD_DELAY: number;
|
|
3716
|
+
static _POPUP_ZINDEX: number;
|
|
3717
|
+
static _SEARCH_DELAY: number;
|
|
3718
|
+
static _HOVER_DELAY: number;
|
|
3719
|
+
static _LEAVE_DELAY: number;
|
|
3720
|
+
static _DRAG_SCROLL_EDGE: number;
|
|
3721
|
+
static _DRAG_SCROLL_STEP: number;
|
|
3722
|
+
static _CTRL_KEY: string;
|
|
3723
|
+
static _OWNR_KEY: string;
|
|
3724
|
+
static _SCRL_KEY: string;
|
|
3725
|
+
static _TTIP_KEY: string;
|
|
3726
|
+
static _DSBL_KEY: string;
|
|
3727
|
+
static _rxInputAtts: RegExp;
|
|
3728
|
+
protected _szObserver: any;
|
|
3729
|
+
protected _e: HTMLElement;
|
|
3730
|
+
protected _orgTabIndex: number;
|
|
3731
|
+
_orgOuter: string;
|
|
3732
|
+
_orgInner: string;
|
|
3733
|
+
protected _orgTag: string;
|
|
3734
|
+
protected _orgAtts: NamedNodeMap;
|
|
3735
|
+
protected _listeners: any[];
|
|
3736
|
+
protected _pristine: boolean;
|
|
3737
|
+
_focus: boolean;
|
|
3738
|
+
protected _updating: number;
|
|
3739
|
+
protected _fullUpdate: boolean;
|
|
3740
|
+
protected _toInv: any;
|
|
3741
|
+
protected _toFocus: any;
|
|
3742
|
+
protected _szCtl: Size;
|
|
3743
|
+
protected _rtlDir: boolean;
|
|
3744
|
+
/**
|
|
3745
|
+
* Initializes a new instance of the {@link Control} class and attaches it to a DOM element.
|
|
3746
|
+
*
|
|
3747
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3748
|
+
* @param options JavaScript object containing initialization data for the control.
|
|
3749
|
+
* @param invalidateOnResize Whether the control should be invalidated when it is resized.
|
|
3750
|
+
*/
|
|
3751
|
+
constructor(element: any, options?: any, invalidateOnResize?: boolean);
|
|
3752
|
+
/**
|
|
3753
|
+
* Gets the HTML template used to create instances of the control.
|
|
3754
|
+
*
|
|
3755
|
+
* This method traverses up the class hierarchy to find the nearest
|
|
3756
|
+
* ancestor that specifies a control template. For example, if you
|
|
3757
|
+
* specify a prototype for the {@link ComboBox} control, which does
|
|
3758
|
+
* not specify a template, it will override the template defined
|
|
3759
|
+
* by the {@link DropDown} base class (the nearest ancestor that does
|
|
3760
|
+
* specify a template).
|
|
3761
|
+
*/
|
|
3762
|
+
getTemplate(): string;
|
|
3763
|
+
/**
|
|
3764
|
+
* Applies the template to a new instance of a control, and returns the root element.
|
|
3765
|
+
*
|
|
3766
|
+
* This method should be called by constructors of templated controls. Therefore,
|
|
3767
|
+
* this method is not available.
|
|
3768
|
+
* It is responsible for binding the template parts to the corresponding control
|
|
3769
|
+
* members.
|
|
3770
|
+
*
|
|
3771
|
+
* For example, the code below applies a template to an instance of an
|
|
3772
|
+
* {@link InputNumber} control. The template must contain elements with the
|
|
3773
|
+
* 'wj-part' attribute set to 'input', 'btn-inc', and 'btn-dec'.
|
|
3774
|
+
* The control members '_tbx', '_btnUp', and '_btnDn' will be assigned
|
|
3775
|
+
* references to these elements.
|
|
3776
|
+
*
|
|
3777
|
+
* ```typescript
|
|
3778
|
+
* this.applyTemplate('wj-control wj-inputnumber', templateString, {
|
|
3779
|
+
* _tbx: 'input',
|
|
3780
|
+
* _btnUp: 'btn-inc',
|
|
3781
|
+
* _btnDn: 'btn-dec'
|
|
3782
|
+
* }, 'input');
|
|
3783
|
+
* ``````
|
|
3784
|
+
*
|
|
3785
|
+
* @param classNames Names of classes to add to the control's host element.
|
|
3786
|
+
* @param template An HTML string that defines the control template.
|
|
3787
|
+
* @param parts A dictionary of part variables and their names.
|
|
3788
|
+
* @param namePart Name of the part to be named after the host element. This
|
|
3789
|
+
* determines how the control submits data when used in forms.
|
|
3790
|
+
*/
|
|
3791
|
+
applyTemplate(classNames: string, template: string, parts: Object, namePart?: string): HTMLElement;
|
|
3792
|
+
/**
|
|
3793
|
+
* Disposes of the control by removing its association with the host element.
|
|
3794
|
+
*
|
|
3795
|
+
* The {@link dispose} method automatically removes any event listeners added
|
|
3796
|
+
* with the {@link addEventListener} method.
|
|
3797
|
+
*
|
|
3798
|
+
* Calling the {@link dispose} method is important in applications that create
|
|
3799
|
+
* and remove controls dynamically. Failing to dispose of the controls may
|
|
3800
|
+
* cause memory leaks.
|
|
3801
|
+
*/
|
|
3802
|
+
dispose(): void;
|
|
3803
|
+
/**
|
|
3804
|
+
* Gets the control that is hosted in a given DOM element.
|
|
3805
|
+
*
|
|
3806
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3807
|
+
*/
|
|
3808
|
+
static getControl(element: any): Control;
|
|
3809
|
+
/**
|
|
3810
|
+
* Gets the DOM element that is hosting the control.
|
|
3811
|
+
*/
|
|
3812
|
+
readonly hostElement: HTMLElement;
|
|
3813
|
+
/**
|
|
3814
|
+
* Gets a value indicating whether the control is hosted in an element
|
|
3815
|
+
* with right-to-left layout.
|
|
3816
|
+
*/
|
|
3817
|
+
readonly rightToLeft: boolean;
|
|
3818
|
+
/**
|
|
3819
|
+
* Sets the focus to this control.
|
|
3820
|
+
*/
|
|
3821
|
+
focus(): void;
|
|
3822
|
+
/**
|
|
3823
|
+
* Checks whether this control contains the focused element.
|
|
3824
|
+
*/
|
|
3825
|
+
containsFocus(): boolean;
|
|
3826
|
+
_containsFocus(): boolean;
|
|
3827
|
+
_containsFocusImpl(activeElement: HTMLElement): boolean;
|
|
3828
|
+
/**
|
|
3829
|
+
* Invalidates the control causing an asynchronous refresh.
|
|
3830
|
+
*
|
|
3831
|
+
* @param fullUpdate Whether to update the control layout as well as the content.
|
|
3832
|
+
*/
|
|
3833
|
+
invalidate(fullUpdate?: boolean): void;
|
|
3834
|
+
/**
|
|
3835
|
+
* Refreshes the control.
|
|
3836
|
+
*
|
|
3837
|
+
* @param fullUpdate Whether to update the control layout as well as the content.
|
|
3838
|
+
*/
|
|
3839
|
+
refresh(fullUpdate?: boolean): void;
|
|
3840
|
+
/**
|
|
3841
|
+
* Invalidates all Wijmo controls contained in an HTML element.
|
|
3842
|
+
*
|
|
3843
|
+
* Use this method when your application has dynamic panels that change
|
|
3844
|
+
* the control's visibility or dimensions. For example, splitters, accordions,
|
|
3845
|
+
* and tab controls usually change the visibility of its content elements.
|
|
3846
|
+
* In this case, failing to notify the controls contained in the element
|
|
3847
|
+
* may cause them to stop working properly.
|
|
3848
|
+
*
|
|
3849
|
+
* If this happens, you must handle the appropriate event in the dynamic
|
|
3850
|
+
* container and call the {@link Control.invalidateAll} method so the contained
|
|
3851
|
+
* Wijmo controls will update their layout information properly.
|
|
3852
|
+
*
|
|
3853
|
+
* @param e Container element. If set to null, all Wijmo controls
|
|
3854
|
+
* on the page will be invalidated.
|
|
3855
|
+
*/
|
|
3856
|
+
static invalidateAll(e?: HTMLElement): void;
|
|
3857
|
+
/**
|
|
3858
|
+
* Refreshes all Wijmo controls contained in an HTML element.
|
|
3859
|
+
*
|
|
3860
|
+
* This method is similar to {@link invalidateAll}, except the controls
|
|
3861
|
+
* are updated immediately rather than after an interval.
|
|
3862
|
+
*
|
|
3863
|
+
* @param e Container element. If set to null, all Wijmo controls
|
|
3864
|
+
* on the page will be invalidated.
|
|
3865
|
+
*/
|
|
3866
|
+
static refreshAll(e?: HTMLElement): void;
|
|
3867
|
+
/**
|
|
3868
|
+
* Disposes of all Wijmo controls contained in an HTML element.
|
|
3869
|
+
*
|
|
3870
|
+
* @param e Container element.
|
|
3871
|
+
*/
|
|
3872
|
+
static disposeAll(e?: HTMLElement): void;
|
|
3873
|
+
/**
|
|
3874
|
+
* Suspends notifications until the next call to {@link endUpdate}.
|
|
3875
|
+
*/
|
|
3876
|
+
beginUpdate(): void;
|
|
3877
|
+
/**
|
|
3878
|
+
* Resumes notifications suspended by calls to {@link beginUpdate}.
|
|
3879
|
+
*/
|
|
3880
|
+
endUpdate(): void;
|
|
3881
|
+
/**
|
|
3882
|
+
* Gets a value that indicates whether the control is currently being updated.
|
|
3883
|
+
*/
|
|
3884
|
+
readonly isUpdating: boolean;
|
|
3885
|
+
/**
|
|
3886
|
+
* Executes a function within a {@link beginUpdate}/{@link endUpdate} block.
|
|
3887
|
+
*
|
|
3888
|
+
* The control will not be updated until the function has been executed.
|
|
3889
|
+
* This method ensures {@link endUpdate} is called even if the function throws
|
|
3890
|
+
* an exception.
|
|
3891
|
+
*
|
|
3892
|
+
* @param fn Function to be executed.
|
|
3893
|
+
*/
|
|
3894
|
+
deferUpdate(fn: Function): void;
|
|
3895
|
+
/**
|
|
3896
|
+
* Gets a value that indicates whether the control is currently handling
|
|
3897
|
+
* a touch event.
|
|
3898
|
+
*/
|
|
3899
|
+
readonly isTouching: boolean;
|
|
3900
|
+
/**
|
|
3901
|
+
* Gets or sets a value of the **tabindex** attribute associated with the control.
|
|
3902
|
+
*
|
|
3903
|
+
* **tabindex** attribute value can be defined statically for a Wijmo control by specifying it
|
|
3904
|
+
* on the control's host HTML element. But this value can't be changed later during application
|
|
3905
|
+
* lifecycle, because Wijmo controls have complex structure, and the control may need to propagate
|
|
3906
|
+
* this attribute value to its internal element to work properly.
|
|
3907
|
+
*
|
|
3908
|
+
* Because of this, to read or change control's **tabindex** dynamically, you should do it using
|
|
3909
|
+
* this property.
|
|
3910
|
+
*/
|
|
3911
|
+
tabOrder: number;
|
|
3912
|
+
protected _setTabOrder(value: number): void;
|
|
3913
|
+
/**
|
|
3914
|
+
* Gets or sets a value that determines whether the control is disabled.
|
|
3915
|
+
*
|
|
3916
|
+
* Disabled controls cannot get mouse or keyboard events.
|
|
3917
|
+
*/
|
|
3918
|
+
isDisabled: boolean;
|
|
3919
|
+
protected _setIsDisabled(value: boolean): void;
|
|
3920
|
+
/**
|
|
3921
|
+
* Initializes the control by copying the properties from a given object.
|
|
3922
|
+
*
|
|
3923
|
+
* This method allows you to initialize controls using plain data objects
|
|
3924
|
+
* instead of setting the value of each property in code.
|
|
3925
|
+
*
|
|
3926
|
+
* For example:
|
|
3927
|
+
*
|
|
3928
|
+
* ```typescript
|
|
3929
|
+
* grid.initialize({
|
|
3930
|
+
* itemsSource: myList,
|
|
3931
|
+
* autoGenerateColumns: false,
|
|
3932
|
+
* columns: [
|
|
3933
|
+
* { binding: 'id', header: 'Code', width: 130 },
|
|
3934
|
+
* { binding: 'name', header: 'Name', width: 60 }
|
|
3935
|
+
* ]
|
|
3936
|
+
* });
|
|
3937
|
+
*
|
|
3938
|
+
* // is equivalent to
|
|
3939
|
+
* grid.itemsSource = myList;
|
|
3940
|
+
* grid.autoGenerateColumns = false;
|
|
3941
|
+
* // etc.
|
|
3942
|
+
* ```
|
|
3943
|
+
*
|
|
3944
|
+
* The initialization data is type-checked as it is applied. If the
|
|
3945
|
+
* initialization object contains unknown property names or invalid
|
|
3946
|
+
* data types, this method will throw.
|
|
3947
|
+
*
|
|
3948
|
+
* @param options Object that contains the initialization data.
|
|
3949
|
+
*/
|
|
3950
|
+
initialize(options: any): void;
|
|
3951
|
+
/**
|
|
3952
|
+
* Adds an event listener to an element owned by this {@link Control}.
|
|
3953
|
+
*
|
|
3954
|
+
* The control keeps a list of attached listeners and their handlers,
|
|
3955
|
+
* making it easier to remove them when the control is disposed (see the
|
|
3956
|
+
* {@link dispose} and {@link removeEventListener} methods).
|
|
3957
|
+
*
|
|
3958
|
+
* Failing to remove event listeners may cause memory leaks.
|
|
3959
|
+
*
|
|
3960
|
+
* The <b>passive</b> parameter is set to false by default, which means
|
|
3961
|
+
* the event handler may call <b>event.preventDefault()</b>.
|
|
3962
|
+
* If you are adding passive handlers to touch or wheel events, setting
|
|
3963
|
+
* this parameter to true will improve application performance.
|
|
3964
|
+
*
|
|
3965
|
+
* For details on passive event listeners, please see
|
|
3966
|
+
* <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Improving_scrolling_performance_with_passive_listeners">Improving scrolling performance with passive listeners</a>.
|
|
3967
|
+
*
|
|
3968
|
+
* @param target Target element for the event.
|
|
3969
|
+
* @param type String that specifies the event.
|
|
3970
|
+
* @param fn Function to execute when the event occurs.
|
|
3971
|
+
* @param capture Whether the listener should be handled by the control before it is handled by the target element.
|
|
3972
|
+
* @param passive Indicates that the handler will never call <b>preventDefault()</b>.
|
|
3973
|
+
*/
|
|
3974
|
+
addEventListener(target: EventTarget, type: string, fn: any, capture?: boolean, passive?: boolean): void;
|
|
3975
|
+
/**
|
|
3976
|
+
* Removes one or more event listeners attached to elements owned by this {@link Control}.
|
|
3977
|
+
*
|
|
3978
|
+
* @param target Target element for the event. If null, removes listeners attached to all targets.
|
|
3979
|
+
* @param type String that specifies the event. If null, removes listeners attached to all events.
|
|
3980
|
+
* @param fn Handler to remove. If null, removes all handlers.
|
|
3981
|
+
* @param capture Whether the listener is capturing. If null, removes capturing and non-capturing listeners.
|
|
3982
|
+
* @return The number of listeners removed.
|
|
3983
|
+
*/
|
|
3984
|
+
removeEventListener(target?: EventTarget, type?: string, fn?: any, capture?: boolean): number;
|
|
3985
|
+
/**
|
|
3986
|
+
* Occurs when the control gets the focus.
|
|
3987
|
+
*/
|
|
3988
|
+
readonly gotFocus: Event<Control, EventArgs>;
|
|
3989
|
+
/**
|
|
3990
|
+
* Raises the {@link gotFocus} event.
|
|
3991
|
+
*/
|
|
3992
|
+
onGotFocus(e?: EventArgs): void;
|
|
3993
|
+
/**
|
|
3994
|
+
* Occurs when the control loses the focus.
|
|
3995
|
+
*/
|
|
3996
|
+
readonly lostFocus: Event<Control, EventArgs>;
|
|
3997
|
+
/**
|
|
3998
|
+
* Raises the {@link lostFocus} event.
|
|
3999
|
+
*/
|
|
4000
|
+
onLostFocus(e?: EventArgs): void;
|
|
4001
|
+
/**
|
|
4002
|
+
* Occurs when invalid input is detected.
|
|
4003
|
+
*
|
|
4004
|
+
* Invalid input may occur when the user types or pastes a value that
|
|
4005
|
+
* cannot be converted to the proper type, or a value that is outside
|
|
4006
|
+
* the valid range.
|
|
4007
|
+
*
|
|
4008
|
+
* If the event handler cancels the event, the control will retain
|
|
4009
|
+
* the invalid content and the focus, so users can correct the error.
|
|
4010
|
+
*
|
|
4011
|
+
* If the event is not canceled, the control will ignore the invalid
|
|
4012
|
+
* input and will retain the original content.
|
|
4013
|
+
*/
|
|
4014
|
+
readonly invalidInput: Event<Control, CancelEventArgs>;
|
|
4015
|
+
/**
|
|
4016
|
+
* Raises the {@link invalidInput} event.
|
|
4017
|
+
*
|
|
4018
|
+
* If the event handler cancels the event, the control will keep
|
|
4019
|
+
* the invalid input and the focus.
|
|
4020
|
+
*/
|
|
4021
|
+
onInvalidInput(e: CancelEventArgs): boolean;
|
|
4022
|
+
/**
|
|
4023
|
+
* Occurs when the control is about to refresh its contents.
|
|
4024
|
+
*/
|
|
4025
|
+
readonly refreshing: Event<Control, EventArgs>;
|
|
4026
|
+
/**
|
|
4027
|
+
* Raises the {@link refreshing} event.
|
|
4028
|
+
*/
|
|
4029
|
+
onRefreshing(e?: EventArgs): void;
|
|
4030
|
+
/**
|
|
4031
|
+
* Occurs after the control has refreshed its contents.
|
|
4032
|
+
*/
|
|
4033
|
+
readonly refreshed: Event<Control, EventArgs>;
|
|
4034
|
+
/**
|
|
4035
|
+
* Raises the {@link refreshed} event.
|
|
4036
|
+
*/
|
|
4037
|
+
onRefreshed(e?: EventArgs): void;
|
|
4038
|
+
_getProductInfo(): string;
|
|
4039
|
+
private _updateWme;
|
|
4040
|
+
_hasPendingUpdates(): boolean;
|
|
4041
|
+
protected _handleResize(): void;
|
|
4042
|
+
_resizeObserverCallback(entries: any[]): void;
|
|
4043
|
+
_handleFocusBlur(): void;
|
|
4044
|
+
protected _updateFocusState(): void;
|
|
4045
|
+
protected _updateState(): void;
|
|
4046
|
+
private _handleDisabled;
|
|
4047
|
+
private _replaceWithDiv;
|
|
4048
|
+
private _copyAttributes;
|
|
4049
|
+
_getKeyCode(e: KeyboardEvent): number;
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Class that enables the creation of custom documents for printing.
|
|
4053
|
+
*
|
|
4054
|
+
* The {@link PrintDocument} class makes it easy to create documents
|
|
4055
|
+
* for printing or exporting to PDF. Most browsers allow you to select
|
|
4056
|
+
* the paper size, orientation, margins, and whether to include page
|
|
4057
|
+
* headers and footers.
|
|
4058
|
+
*
|
|
4059
|
+
* To use, instantiate a {@link PrintDocument}, add content using the
|
|
4060
|
+
* {@link append} method, and finish by calling the {@link print}
|
|
4061
|
+
* method.
|
|
4062
|
+
*
|
|
4063
|
+
* For example:
|
|
4064
|
+
* ```typescript
|
|
4065
|
+
* import { PrintDocument } from '@grapecity/wijmo';
|
|
4066
|
+
*
|
|
4067
|
+
* // create the document
|
|
4068
|
+
* var doc = new PrintDocument({
|
|
4069
|
+
* title: 'PrintDocument Test'
|
|
4070
|
+
* });
|
|
4071
|
+
*
|
|
4072
|
+
* // add some simple text
|
|
4073
|
+
* doc.append('<h1>Printing Example</h1>');
|
|
4074
|
+
* doc.append('<p>This document was created using the <b>PrintDocument</b> class.</p>');
|
|
4075
|
+
*
|
|
4076
|
+
* // add some existing elements
|
|
4077
|
+
* doc.append(document.getElementById('gaugeControl'));
|
|
4078
|
+
*
|
|
4079
|
+
* // print the document (or export it to PDF)
|
|
4080
|
+
* doc.print();
|
|
4081
|
+
* ```
|
|
4082
|
+
*
|
|
4083
|
+
* The example below shows how you can create a printer-friendly version of
|
|
4084
|
+
* a document which can be printed or exported to PDF and other formats
|
|
4085
|
+
* directly from the browser:
|
|
4086
|
+
*
|
|
4087
|
+
* {@sample Core/PrintDocument Example}
|
|
4088
|
+
*/
|
|
4089
|
+
export declare class PrintDocument {
|
|
4090
|
+
_iframe: HTMLIFrameElement;
|
|
4091
|
+
_title: string;
|
|
4092
|
+
_css: string[];
|
|
4093
|
+
_copyCss: boolean;
|
|
4094
|
+
/**
|
|
4095
|
+
* Initializes a new instance of the {@link PrintDocument} class.
|
|
4096
|
+
*
|
|
4097
|
+
* @param options JavaScript object containing initialization data for the {@link PrintDocument}.
|
|
4098
|
+
*/
|
|
4099
|
+
constructor(options?: any);
|
|
4100
|
+
/**
|
|
4101
|
+
* Gets or sets the document title.
|
|
4102
|
+
*
|
|
4103
|
+
* The default value for this property is **null**, which causes the
|
|
4104
|
+
* {@link PrintDocument} to use the title from the current document's
|
|
4105
|
+
* **title** tag.
|
|
4106
|
+
*/
|
|
4107
|
+
title: string;
|
|
4108
|
+
/**
|
|
4109
|
+
* Gets or sets a value that determines whether the {@link PrintDocument}
|
|
4110
|
+
* should include the CSS style sheets defined in the main document.
|
|
4111
|
+
*
|
|
4112
|
+
* The default value for the property is **true**.
|
|
4113
|
+
*/
|
|
4114
|
+
copyCss: boolean;
|
|
4115
|
+
/**
|
|
4116
|
+
* Adds a CSS style sheet to the document.
|
|
4117
|
+
*
|
|
4118
|
+
* @param href URL of the CSS file that should be added to the document.
|
|
4119
|
+
*/
|
|
4120
|
+
addCSS(href: string): void;
|
|
4121
|
+
/**
|
|
4122
|
+
* Appends an HTML string or an element to the document.
|
|
4123
|
+
*
|
|
4124
|
+
* @param content HTML string or Element to append to the document.
|
|
4125
|
+
*/
|
|
4126
|
+
append(content: string | Element): void;
|
|
4127
|
+
/**
|
|
4128
|
+
* Prints the document.
|
|
4129
|
+
*
|
|
4130
|
+
* @param callback Optional callback invoked after the document
|
|
4131
|
+
* finishes printing.
|
|
4132
|
+
*/
|
|
4133
|
+
print(callback?: Function): void;
|
|
4134
|
+
_afterPrint(callback?: Function): void;
|
|
4135
|
+
_getDocument(): Document;
|
|
4136
|
+
_close(): void;
|
|
4137
|
+
_addStyle(style: string): void;
|
|
4138
|
+
}
|
|
4139
|
+
/**
|
|
4140
|
+
* Static class that provides utility methods for clipboard operations.
|
|
4141
|
+
*
|
|
4142
|
+
* The {@link Clipboard} class provides static {@link copy} and {@link paste} methods
|
|
4143
|
+
* that can be used by controls to customize the clipboard content during
|
|
4144
|
+
* clipboard operations.
|
|
4145
|
+
*
|
|
4146
|
+
* For example, the code below shows how a control could intercept the
|
|
4147
|
+
* clipboard shortcut keys and provide custom clipboard handling:
|
|
4148
|
+
*
|
|
4149
|
+
* ```typescript
|
|
4150
|
+
* rootElement.addEventListener('keydown', (e: KeyboardEvent) {
|
|
4151
|
+
*
|
|
4152
|
+
* // copy: ctrl+c or ctrl+Insert
|
|
4153
|
+
* if (e.ctrlKey && (e.keyCode == 67 || e.keyCode == 45)) {
|
|
4154
|
+
* let text = this.getClipString();
|
|
4155
|
+
* Clipboard.copy(text);
|
|
4156
|
+
* return;
|
|
4157
|
+
* }
|
|
4158
|
+
*
|
|
4159
|
+
* // paste: ctrl+v or shift+Insert
|
|
4160
|
+
* if ((e.ctrlKey && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45)) {
|
|
4161
|
+
* Clipboard.paste(text => {
|
|
4162
|
+
* this.setClipString(text);
|
|
4163
|
+
* });
|
|
4164
|
+
* return;
|
|
4165
|
+
* }
|
|
4166
|
+
* });
|
|
4167
|
+
* ```
|
|
4168
|
+
*
|
|
4169
|
+
* The example below shows how you can customize the behavior of the clipboard
|
|
4170
|
+
* paste command when the target is a {@link FlexGrid} control:
|
|
4171
|
+
*
|
|
4172
|
+
* {@sample Core/Clipboard Example}
|
|
4173
|
+
*/
|
|
4174
|
+
export declare class Clipboard {
|
|
4175
|
+
/**
|
|
4176
|
+
* Copies a string to the clipboard.
|
|
4177
|
+
*
|
|
4178
|
+
* This method only works if invoked immediately after the user
|
|
4179
|
+
* pressed a clipboard copy command (such as ctrl+c).
|
|
4180
|
+
*
|
|
4181
|
+
* @param text Text to copy to the clipboard.
|
|
4182
|
+
*/
|
|
4183
|
+
static copy(text: string): void;
|
|
4184
|
+
/**
|
|
4185
|
+
* Gets a string from the clipboard.
|
|
4186
|
+
*
|
|
4187
|
+
* This method only works if invoked immediately after the user
|
|
4188
|
+
* pressed a clipboard paste command (such as ctrl+v).
|
|
4189
|
+
*
|
|
4190
|
+
* @param callback Function called when the clipboard content
|
|
4191
|
+
* has been retrieved. The function receives the clipboard
|
|
4192
|
+
* content as a parameter.
|
|
4193
|
+
*/
|
|
4194
|
+
static paste(callback: Function): void;
|
|
4195
|
+
private static _copyPaste;
|
|
4196
|
+
}
|
|
4197
|
+
/**
|
|
4198
|
+
* Class that provides repeat-clicking on behalf of an HTMLElement
|
|
4199
|
+
* (typically a button).
|
|
4200
|
+
*/
|
|
4201
|
+
export declare class _ClickRepeater {
|
|
4202
|
+
private static _startEvents;
|
|
4203
|
+
private static _stopEvents;
|
|
4204
|
+
private _e;
|
|
4205
|
+
private _disabled;
|
|
4206
|
+
private _isDown;
|
|
4207
|
+
private _clicked;
|
|
4208
|
+
private _toDelay;
|
|
4209
|
+
private _toRepeat;
|
|
4210
|
+
private _mousedownBnd;
|
|
4211
|
+
private _mouseupBnd;
|
|
4212
|
+
private _clickBnd;
|
|
4213
|
+
/**
|
|
4214
|
+
* Initializes a new instance of the {@link _ClickRepeater} class.
|
|
4215
|
+
*
|
|
4216
|
+
* @param element Element that will raise click events while the mouse is down.
|
|
4217
|
+
*/
|
|
4218
|
+
constructor(element: HTMLElement);
|
|
4219
|
+
/**
|
|
4220
|
+
* Gets or sets the element that will raise click events while the mouse is down.
|
|
4221
|
+
*/
|
|
4222
|
+
element: HTMLElement;
|
|
4223
|
+
/**
|
|
4224
|
+
* Gets or sets a value that determines whether this repeater is disabled.
|
|
4225
|
+
*/
|
|
4226
|
+
disabled: boolean;
|
|
4227
|
+
_connect(connect: boolean): void;
|
|
4228
|
+
_clearTimeouts(): void;
|
|
4229
|
+
_mousedown(e: MouseEvent): void;
|
|
4230
|
+
_mouseup(e: MouseEvent): void;
|
|
4231
|
+
_click(): void;
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Represents the position of a popup element with respect to a
|
|
4235
|
+
* reference element.
|
|
4236
|
+
*/
|
|
4237
|
+
export declare enum PopupPosition {
|
|
4238
|
+
/** Above the reference element. */
|
|
4239
|
+
Above = 0,
|
|
4240
|
+
/** Above and aligned to the right of the reference element. */
|
|
4241
|
+
AboveRight = 1,
|
|
4242
|
+
/** To the right and aligned to the top of the reference element. */
|
|
4243
|
+
RightTop = 2,
|
|
4244
|
+
/** To the right of the reference element. */
|
|
4245
|
+
Right = 3,
|
|
4246
|
+
/** To the right and aligned to the bottom of the reference element. */
|
|
4247
|
+
RightBottom = 4,
|
|
4248
|
+
/** Below and aligned to the right of the reference element. */
|
|
4249
|
+
BelowRight = 5,
|
|
4250
|
+
/** Below the reference element. */
|
|
4251
|
+
Below = 6,
|
|
4252
|
+
/** Below and aligned to the left of the reference element. */
|
|
4253
|
+
BelowLeft = 7,
|
|
4254
|
+
/** To the left and aligned to the bottom of the reference element. */
|
|
4255
|
+
LeftBottom = 8,
|
|
4256
|
+
/** To the left of the reference element. */
|
|
4257
|
+
Left = 9,
|
|
4258
|
+
/** To the left and aligned to the top of the reference element. */
|
|
4259
|
+
LeftTop = 10,
|
|
4260
|
+
/** Above and aligned to the left of the reference element. */
|
|
4261
|
+
AboveLeft = 11
|
|
4262
|
+
}
|
|
4263
|
+
/**
|
|
4264
|
+
* Shows an element as a popup.
|
|
4265
|
+
*
|
|
4266
|
+
* The popup element becomes a child of the body element, and is positioned
|
|
4267
|
+
* with respect to reference rectangle according to the given {@link PopupPosition}.
|
|
4268
|
+
*
|
|
4269
|
+
* The reference rectangle may be specified as one of the following:
|
|
4270
|
+
*
|
|
4271
|
+
* <dl class="dl-horizontal">
|
|
4272
|
+
* <dt>HTMLElement</dt>
|
|
4273
|
+
* <dd>The bounding rectangle of the element.</dd>
|
|
4274
|
+
* <dt>MouseEvent</dt>
|
|
4275
|
+
* <dd>The bounding rectangle of the event's target element.</dd>
|
|
4276
|
+
* <dt>Rect</dt>
|
|
4277
|
+
* <dd>The given rectangle.</dd>
|
|
4278
|
+
* <dt>null</dt>
|
|
4279
|
+
* <dd>No reference rectangle; the popup is centered on the window.</dd>
|
|
4280
|
+
* </dl>
|
|
4281
|
+
*
|
|
4282
|
+
* Call the {@link hidePopup} method to hide the popup.
|
|
4283
|
+
*
|
|
4284
|
+
* @param popup Element to show as a popup.
|
|
4285
|
+
* @param ref Reference element or rectangle used to position the popup.
|
|
4286
|
+
* @param position Position of the popup with respect to the reference element.
|
|
4287
|
+
* @param fadeIn Use a fade-in animation to make the popup appear gradually.
|
|
4288
|
+
* @param copyStyles Whether to copy font and color styles from the reference element, or an element to use as the style source.
|
|
4289
|
+
* @param hideOnScroll An optional function called when the popup is hidden as a result of a parent element scrolling.
|
|
4290
|
+
* @return An interval ID that can be used to suspend the fade-in animation.
|
|
4291
|
+
*/
|
|
4292
|
+
export declare function showPopup(popup: HTMLElement, ref?: any, position?: PopupPosition | Boolean, fadeIn?: boolean, copyStyles?: any, hideOnScroll?: Function): any;
|
|
4293
|
+
/**
|
|
4294
|
+
* Hides a popup element previously displayed with the {@link showPopup}
|
|
4295
|
+
* method.
|
|
4296
|
+
*
|
|
4297
|
+
* @param popup Popup element to hide.
|
|
4298
|
+
* @param remove Whether to remove the popup from the DOM or just to hide it.
|
|
4299
|
+
* This parameter may be a boolean or a callback function that gets invoked
|
|
4300
|
+
* after the popup has been removed from the DOM.
|
|
4301
|
+
* @param fadeOut Whether to use a fade-out animation to make the popup disappear gradually.
|
|
4302
|
+
* @return An interval id that you can use to suspend the fade-out animation.
|
|
4303
|
+
*/
|
|
4304
|
+
export declare function hidePopup(popup: HTMLElement, remove?: any, fadeOut?: boolean): any;
|
|
4305
|
+
interface _ITooltipInfo {
|
|
4306
|
+
element: HTMLElement;
|
|
4307
|
+
content: string;
|
|
4308
|
+
position: PopupPosition;
|
|
4309
|
+
}
|
|
4310
|
+
/**
|
|
4311
|
+
* Enum representing different triggers for displaying tooltips.
|
|
4312
|
+
* @remarks
|
|
4313
|
+
* This enum allows you to specify how tooltips should be triggered in a user interface.
|
|
4314
|
+
*/
|
|
4315
|
+
export declare enum TooltipTrigger {
|
|
4316
|
+
/** Show tooltip by focusing element. */
|
|
4317
|
+
Focus = 0,
|
|
4318
|
+
/** Show tooltip by hovering element. */
|
|
4319
|
+
Hover = 1,
|
|
4320
|
+
/** Show tooltip by focusing/hovering element. */
|
|
4321
|
+
Both = 2
|
|
4322
|
+
}
|
|
4323
|
+
/**
|
|
4324
|
+
* Provides a pop-up window that displays additional information about
|
|
4325
|
+
* elements on the page.
|
|
4326
|
+
*
|
|
4327
|
+
* The {@link Tooltip} class can be used in two modes:
|
|
4328
|
+
*
|
|
4329
|
+
* **Automatic Mode:** Use the {@link setTooltip} method to connect
|
|
4330
|
+
* the {@link Tooltip} to one or more elements on the page. The {@link Tooltip}
|
|
4331
|
+
* will automatically monitor events and display the tooltips when the
|
|
4332
|
+
* user performs actions that trigger the tooltip.
|
|
4333
|
+
* For example:
|
|
4334
|
+
*
|
|
4335
|
+
* ```typescript
|
|
4336
|
+
* import { Tooltip } from '@grapecity/wijmo';
|
|
4337
|
+
* let tt = new Tooltip();
|
|
4338
|
+
* tt.setTooltip('#menu', 'Select commands.');
|
|
4339
|
+
* tt.setTooltip('#tree', 'Explore the hierarchy.');
|
|
4340
|
+
* tt.setTooltip('#chart', '#idChartTooltip');
|
|
4341
|
+
* ```
|
|
4342
|
+
*
|
|
4343
|
+
* **Manual Mode:** The caller is responsible for showing and hiding
|
|
4344
|
+
* the tooltip using the {@link show} and {@link hide} methods. For example:
|
|
4345
|
+
*
|
|
4346
|
+
* ```typescript
|
|
4347
|
+
* import { Tooltip } from '@grapecity/wijmo';
|
|
4348
|
+
* let tt = new Tooltip();
|
|
4349
|
+
* element.addEventListener('click', () => {
|
|
4350
|
+
* if (tt.isVisible) {
|
|
4351
|
+
* tt.hide();
|
|
4352
|
+
* } else {
|
|
4353
|
+
* tt.show(element, 'This is an important element!');
|
|
4354
|
+
* }
|
|
4355
|
+
* });
|
|
4356
|
+
* ```
|
|
4357
|
+
*
|
|
4358
|
+
* The example below shows how you can use the {@link Tooltip} class
|
|
4359
|
+
* to add Excel-style notes to cells in a {@link FlexGrid} control:
|
|
4360
|
+
*
|
|
4361
|
+
* {@sample Grid/CustomCells/CellNotes/purejs Example}
|
|
4362
|
+
*/
|
|
4363
|
+
export declare class Tooltip {
|
|
4364
|
+
static _eTip: HTMLElement;
|
|
4365
|
+
private _toShow;
|
|
4366
|
+
private _toHide;
|
|
4367
|
+
private _showAutoTipBnd;
|
|
4368
|
+
private _hideAutoTipBnd;
|
|
4369
|
+
private _mousemoveBnd;
|
|
4370
|
+
private _eMouse;
|
|
4371
|
+
private _html;
|
|
4372
|
+
private _cssClass;
|
|
4373
|
+
private _gap;
|
|
4374
|
+
private _isAnimated;
|
|
4375
|
+
private _position;
|
|
4376
|
+
private _trigger;
|
|
4377
|
+
private _showAtMouse;
|
|
4378
|
+
private _showDelay;
|
|
4379
|
+
private _hideDelay;
|
|
4380
|
+
_tips: _ITooltipInfo[];
|
|
4381
|
+
/**
|
|
4382
|
+
* Initializes a new instance of the {@link Tooltip} class.
|
|
4383
|
+
*
|
|
4384
|
+
* @param options JavaScript object containing initialization data for the {@link Tooltip}.
|
|
4385
|
+
*/
|
|
4386
|
+
constructor(options?: any);
|
|
4387
|
+
/**
|
|
4388
|
+
* Gets or sets the {@link PopupPosition} where the tooltip should be
|
|
4389
|
+
* displayed with respect to the owner element.
|
|
4390
|
+
*
|
|
4391
|
+
* The default value for this property is **PopupPosition.Above**.
|
|
4392
|
+
*/
|
|
4393
|
+
position: PopupPosition;
|
|
4394
|
+
/**
|
|
4395
|
+
* Gets or sets the {@link TooltipTrigger} that determines how the tooltip should be
|
|
4396
|
+
* triggered.
|
|
4397
|
+
*
|
|
4398
|
+
* The default value for this property is **TooltipTrigger.Focus**.
|
|
4399
|
+
*/
|
|
4400
|
+
trigger: TooltipTrigger;
|
|
4401
|
+
/**
|
|
4402
|
+
* Gets or sets a value that determines whether tooltips should use a
|
|
4403
|
+
* fade-in animation when shown.
|
|
4404
|
+
*
|
|
4405
|
+
* The default value for this property is **false**.
|
|
4406
|
+
*/
|
|
4407
|
+
isAnimated: boolean;
|
|
4408
|
+
/**
|
|
4409
|
+
* Assigns tooltip content to a given element on the page.
|
|
4410
|
+
*
|
|
4411
|
+
* The same tooltip may be used to display information for any number
|
|
4412
|
+
* of elements on the page. To remove the tooltip from an element,
|
|
4413
|
+
* call {@link setTooltip} and specify null for the content.
|
|
4414
|
+
*
|
|
4415
|
+
* To remove the tooltips for all elements, call the {@link dispose} method.
|
|
4416
|
+
*
|
|
4417
|
+
* @param element Element, single element CSS selector, or control that the tooltip explains.
|
|
4418
|
+
* @param content Tooltip content or ID of the element that contains the tooltip content.
|
|
4419
|
+
* @param position Position where the tooltip should be displayed with respect to the owner element.
|
|
4420
|
+
*/
|
|
4421
|
+
setTooltip(element: any, content: string | null, position?: PopupPosition): void;
|
|
4422
|
+
/**
|
|
4423
|
+
* Gets the tooltip content associated with a given element.
|
|
4424
|
+
*
|
|
4425
|
+
* @param element Element, element ID, or control that the tooltip explains.
|
|
4426
|
+
* @return Tooltip content associated with the given element.
|
|
4427
|
+
*/
|
|
4428
|
+
getTooltip(element: any): string | null;
|
|
4429
|
+
/**
|
|
4430
|
+
* Shows a tooltip with the specified content next to the specified element.
|
|
4431
|
+
*
|
|
4432
|
+
* @param element Element, element ID, or control that the tooltip explains.
|
|
4433
|
+
* @param content Tooltip content or ID of the element that contains the tooltip content.
|
|
4434
|
+
* @param bounds Optional parameter that defines the bounds of the area that the tooltip
|
|
4435
|
+
* targets. If not provided, the element bounds are used.
|
|
4436
|
+
* @param position Optional parameter that specifies the position of the tooltip
|
|
4437
|
+
* with respect to the reference bounds. If provided, this value overrides the setting
|
|
4438
|
+
* of the {@link position} property.
|
|
4439
|
+
*/
|
|
4440
|
+
show(element: any, content: string, bounds?: Rect, position?: PopupPosition): void;
|
|
4441
|
+
/**
|
|
4442
|
+
* Hides the tooltip if it is currently visible.
|
|
4443
|
+
*/
|
|
4444
|
+
hide(): void;
|
|
4445
|
+
/**
|
|
4446
|
+
* Removes all tooltips associated with this {@link Tooltip} instance.
|
|
4447
|
+
*/
|
|
4448
|
+
dispose(): void;
|
|
4449
|
+
/**
|
|
4450
|
+
* Gets a value that determines whether the tooltip is currently visible.
|
|
4451
|
+
*/
|
|
4452
|
+
readonly isVisible: boolean;
|
|
4453
|
+
/**
|
|
4454
|
+
* Gets or sets a value that determines whether the tooltip contents
|
|
4455
|
+
* should be displayed as plain text or as HTML.
|
|
4456
|
+
*
|
|
4457
|
+
* The default value for the property is **true**.
|
|
4458
|
+
*/
|
|
4459
|
+
isContentHtml: boolean;
|
|
4460
|
+
/**
|
|
4461
|
+
* Gets or sets a CSS class name to add to the tooltip.
|
|
4462
|
+
*
|
|
4463
|
+
* The default value for this property is an empty string.
|
|
4464
|
+
*/
|
|
4465
|
+
cssClass: string;
|
|
4466
|
+
/**
|
|
4467
|
+
* Gets or sets the distance between the tooltip and the target element.
|
|
4468
|
+
*
|
|
4469
|
+
* The default value for the property is **6** pixels.
|
|
4470
|
+
*/
|
|
4471
|
+
gap: number;
|
|
4472
|
+
/**
|
|
4473
|
+
* Gets or sets a value that determines whether the tooltip should be
|
|
4474
|
+
* calculated based on the mouse position rather than the target element.
|
|
4475
|
+
*
|
|
4476
|
+
* The default value for the property is **false**, which means
|
|
4477
|
+
* the tooltip position is calculated based on the target element.
|
|
4478
|
+
*
|
|
4479
|
+
* The {@link position} property is used to determine the tooltip
|
|
4480
|
+
* position in respect to the target element or to the mouse
|
|
4481
|
+
* position.
|
|
4482
|
+
*/
|
|
4483
|
+
showAtMouse: boolean;
|
|
4484
|
+
/**
|
|
4485
|
+
* Gets or sets the delay, in milliseconds, before showing the tooltip
|
|
4486
|
+
* after the mouse enters the target element.
|
|
4487
|
+
*
|
|
4488
|
+
* The default value for the property is **500** milliseconds.
|
|
4489
|
+
*/
|
|
4490
|
+
showDelay: number;
|
|
4491
|
+
/**
|
|
4492
|
+
* Gets or sets the delay, in milliseconds, before hiding the tooltip
|
|
4493
|
+
* if the mouse remains over the element.
|
|
4494
|
+
*
|
|
4495
|
+
* The default value for the property is **zero** milliseconds,
|
|
4496
|
+
* which causes the tip to remain visible until the mouse moves
|
|
4497
|
+
* away from the element.
|
|
4498
|
+
*/
|
|
4499
|
+
hideDelay: number;
|
|
4500
|
+
/**
|
|
4501
|
+
* Occurs before the tooltip content is displayed.
|
|
4502
|
+
*
|
|
4503
|
+
* The event handler may customize the tooltip content or suppress
|
|
4504
|
+
* the tooltip display by changing the event parameters.
|
|
4505
|
+
*/
|
|
4506
|
+
readonly popup: Event<Tooltip, TooltipEventArgs>;
|
|
4507
|
+
/**
|
|
4508
|
+
* Raises the {@link popup} event.
|
|
4509
|
+
*
|
|
4510
|
+
* @param e {@link TooltipEventArgs} that contains the event data.
|
|
4511
|
+
*/
|
|
4512
|
+
onPopup(e: TooltipEventArgs): boolean;
|
|
4513
|
+
private _indexOf;
|
|
4514
|
+
private _attach;
|
|
4515
|
+
private _detach;
|
|
4516
|
+
_showAutoTip(e?: MouseEvent, element?: HTMLElement): void;
|
|
4517
|
+
_mousemove(e: MouseEvent): void;
|
|
4518
|
+
private _hideAutoTip;
|
|
4519
|
+
private _clearTimeouts;
|
|
4520
|
+
private _getContent;
|
|
4521
|
+
private _setContent;
|
|
4522
|
+
}
|
|
4523
|
+
/**
|
|
4524
|
+
* Provides arguments for the {@link Tooltip.popup} event.
|
|
4525
|
+
*/
|
|
4526
|
+
export declare class TooltipEventArgs extends CancelEventArgs {
|
|
4527
|
+
private _content;
|
|
4528
|
+
private _e;
|
|
4529
|
+
/**
|
|
4530
|
+
* Initializes a new instance of the {@link TooltipEventArgs} class.
|
|
4531
|
+
*
|
|
4532
|
+
* @param content String to show in the tooltip.
|
|
4533
|
+
* @param element HTMLElement that the tip refers to.
|
|
4534
|
+
*/
|
|
4535
|
+
constructor(content: string, element?: HTMLElement);
|
|
4536
|
+
/**
|
|
4537
|
+
* Gets a reference to the tooltip element.
|
|
4538
|
+
*/
|
|
4539
|
+
readonly tip: HTMLElement;
|
|
4540
|
+
/**
|
|
4541
|
+
* Gets a reference to the element that the tooltip refers to.
|
|
4542
|
+
*/
|
|
4543
|
+
readonly element: HTMLElement;
|
|
4544
|
+
/**
|
|
4545
|
+
* Gets or sets the content to show in the tooltip.
|
|
4546
|
+
*
|
|
4547
|
+
* This parameter can be used while handling the {@link Tooltip.popup}
|
|
4548
|
+
* event to modify the content of the tooltip.
|
|
4549
|
+
*/
|
|
4550
|
+
content: string;
|
|
4551
|
+
}
|
|
4552
|
+
export declare function _updateWme(ctl: Control, key: string): void;
|
|
4553
|
+
export {};
|