@mescius/wijmo.input 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 +4298 -0
- package/index.js +14 -0
- package/package.json +44 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,4298 @@
|
|
|
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.input}
|
|
15
|
+
* Defines input controls for strings, numbers, dates, times, and colors.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare var ___keepComment: any;
|
|
21
|
+
import { Control, Event, EventArgs, CancelEventArgs, Binding, Rect, ICollectionView, CollectionViewGroup, _ClickRepeater, CollectionView, _MaskProvider, PopupPosition } from '@grapecity/wijmo';
|
|
22
|
+
import * as selfModule from '@grapecity/wijmo.input';
|
|
23
|
+
/**
|
|
24
|
+
* The {@link InputNumber} control allows users to enter numbers.
|
|
25
|
+
*
|
|
26
|
+
* The control prevents users from accidentally entering invalid data and
|
|
27
|
+
* formats the number as it is edited.
|
|
28
|
+
*
|
|
29
|
+
* Pressing the minus key reverses the sign of the value being edited,
|
|
30
|
+
* regardless of cursor position.
|
|
31
|
+
*
|
|
32
|
+
* You may use the {@link min} and {@link max} properties to limit the range of
|
|
33
|
+
* acceptable values, and the {@link step} property to provide spinner buttons
|
|
34
|
+
* that increase or decrease the value with a click.
|
|
35
|
+
*
|
|
36
|
+
* For details about using the {@link min} and {@link max} properties, please see
|
|
37
|
+
* the <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
38
|
+
*
|
|
39
|
+
* Use the {@link value} property to get or set the currently selected number.
|
|
40
|
+
*
|
|
41
|
+
* The example below creates several {@link InputNumber} controls and shows
|
|
42
|
+
* the effect of using different formats.
|
|
43
|
+
*
|
|
44
|
+
* {@sample Input/InputNumber/Formatting/purejs Example}
|
|
45
|
+
*/
|
|
46
|
+
export declare class InputNumber extends Control {
|
|
47
|
+
_tbx: HTMLInputElement;
|
|
48
|
+
_btnUp: HTMLElement;
|
|
49
|
+
_btnDn: HTMLElement;
|
|
50
|
+
_value: number;
|
|
51
|
+
_min: number;
|
|
52
|
+
_max: number;
|
|
53
|
+
_format: string;
|
|
54
|
+
_step: number;
|
|
55
|
+
_showBtn: boolean;
|
|
56
|
+
_readOnly: boolean;
|
|
57
|
+
_handleWheel: boolean;
|
|
58
|
+
_oldText: string;
|
|
59
|
+
_oldValue: number;
|
|
60
|
+
_composing: boolean;
|
|
61
|
+
_chrDec: string;
|
|
62
|
+
_chrCur: string;
|
|
63
|
+
_chrNeg: string;
|
|
64
|
+
_chrPls: string;
|
|
65
|
+
_chrPct: string;
|
|
66
|
+
_chrTho: string;
|
|
67
|
+
_fmtSpc: string;
|
|
68
|
+
_fmtPrc: number;
|
|
69
|
+
_rxSym: RegExp;
|
|
70
|
+
_rxNeg: RegExp;
|
|
71
|
+
_delKey: boolean;
|
|
72
|
+
_rptUp: _ClickRepeater;
|
|
73
|
+
_rptDn: _ClickRepeater;
|
|
74
|
+
_fromKb: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Gets or sets the template used to instantiate {@link InputNumber} controls.
|
|
77
|
+
*/
|
|
78
|
+
static controlTemplate: string;
|
|
79
|
+
/**
|
|
80
|
+
* Initializes a new instance of the {@link InputNumber} class.
|
|
81
|
+
*
|
|
82
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
83
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
84
|
+
*/
|
|
85
|
+
constructor(element: any, options?: any);
|
|
86
|
+
/**
|
|
87
|
+
* Gets the HTML input element hosted by the control.
|
|
88
|
+
*
|
|
89
|
+
* Use this property in situations where you want to customize the
|
|
90
|
+
* attributes of the input element.
|
|
91
|
+
*/
|
|
92
|
+
readonly inputElement: HTMLInputElement;
|
|
93
|
+
/**
|
|
94
|
+
* Gets or sets the "type" attribute of the HTML input element hosted by the control.
|
|
95
|
+
*
|
|
96
|
+
* By default, this property is set to "tel", a value that causes mobile devices to
|
|
97
|
+
* show a numeric keypad that includes a negative sign and a decimal separator.
|
|
98
|
+
*
|
|
99
|
+
* Use this property to change the default setting if the default does not work well
|
|
100
|
+
* for the current culture, device, or application. In those cases, try changing
|
|
101
|
+
* the value to "number" or "text."
|
|
102
|
+
*
|
|
103
|
+
* Note that input elements with type "number" prevent selection in Chrome and
|
|
104
|
+
* therefore that type is not recommended. For more details, see this link:
|
|
105
|
+
* https://stackoverflow.com/questions/21177489/selectionstart-selectionend-on-input-type-number-no-longer-allowed-in-chrome
|
|
106
|
+
*/
|
|
107
|
+
inputType: string;
|
|
108
|
+
/**
|
|
109
|
+
* Gets or sets the current value of the control.
|
|
110
|
+
*/
|
|
111
|
+
value: number | null;
|
|
112
|
+
/**
|
|
113
|
+
* Gets or sets a value indicating whether the control value must be
|
|
114
|
+
* a number or whether it can be set to null (by deleting the content
|
|
115
|
+
* of the control).
|
|
116
|
+
*
|
|
117
|
+
* The default value for this property is **true**.
|
|
118
|
+
*/
|
|
119
|
+
isRequired: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Gets or sets a value that indicates whether the user can modify
|
|
122
|
+
* the control value using the mouse and keyboard.
|
|
123
|
+
*
|
|
124
|
+
* The default value for this property is **false**.
|
|
125
|
+
*/
|
|
126
|
+
isReadOnly: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Gets or sets a value that determines whether the user can edit the
|
|
129
|
+
* value using the mouse wheel.
|
|
130
|
+
*
|
|
131
|
+
* The default value for this property is **true**.
|
|
132
|
+
*/
|
|
133
|
+
handleWheel: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Gets or sets the smallest number that the user can enter.
|
|
136
|
+
*
|
|
137
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
138
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
139
|
+
*/
|
|
140
|
+
min: number | null;
|
|
141
|
+
/**
|
|
142
|
+
* Gets or sets the largest number that the user can enter.
|
|
143
|
+
*
|
|
144
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
145
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
146
|
+
*/
|
|
147
|
+
max: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* Gets or sets the amount to add or subtract to the {@link value} property
|
|
150
|
+
* when the user clicks the spinner buttons.
|
|
151
|
+
*
|
|
152
|
+
* The default value for this property is **null**, which hides the spinner
|
|
153
|
+
* buttons from the control.
|
|
154
|
+
*/
|
|
155
|
+
step: number | null;
|
|
156
|
+
/**
|
|
157
|
+
* Gets or sets the format used to display the number being edited (see {@link Globalize}).
|
|
158
|
+
*
|
|
159
|
+
* The format string is expressed as a .NET-style
|
|
160
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings" target="_blank">
|
|
161
|
+
* standard numeric format string</a>.
|
|
162
|
+
*/
|
|
163
|
+
format: string;
|
|
164
|
+
/**
|
|
165
|
+
* Gets or sets the text shown in the control.
|
|
166
|
+
*/
|
|
167
|
+
text: string;
|
|
168
|
+
/**
|
|
169
|
+
* Gets or sets the string shown as a hint when the control is empty.
|
|
170
|
+
*/
|
|
171
|
+
placeholder: string;
|
|
172
|
+
/**
|
|
173
|
+
* Gets or sets a value indicating whether the control displays spinner buttons
|
|
174
|
+
* to increment or decrement the value (the step property must be set to a
|
|
175
|
+
* value other than zero).
|
|
176
|
+
*
|
|
177
|
+
* The default value for this property is **true**.
|
|
178
|
+
*/
|
|
179
|
+
showSpinner: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Gets or sets a value that determines whether the spinner buttons
|
|
182
|
+
* should act as repeat buttons, firing repeatedly as long as the
|
|
183
|
+
* button remains pressed.
|
|
184
|
+
*
|
|
185
|
+
* The default value for this property is **true**.
|
|
186
|
+
*/
|
|
187
|
+
repeatButtons: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Sets the focus to the control and selects all its content.
|
|
190
|
+
*/
|
|
191
|
+
selectAll(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Returns a value within the range defined by the {@link min} and {@link max}
|
|
194
|
+
* properties.
|
|
195
|
+
*
|
|
196
|
+
* @param value Value to clamp.
|
|
197
|
+
*/
|
|
198
|
+
clamp(value: number): number;
|
|
199
|
+
/**
|
|
200
|
+
* Occurs when the value of the {@link text} property changes.
|
|
201
|
+
*/
|
|
202
|
+
readonly textChanged: Event<InputNumber, EventArgs>;
|
|
203
|
+
/**
|
|
204
|
+
* Raises the {@link textChanged} event.
|
|
205
|
+
*/
|
|
206
|
+
onTextChanged(e?: EventArgs): void;
|
|
207
|
+
/**
|
|
208
|
+
* Occurs when the value of the {@link value} property changes, either
|
|
209
|
+
* as a result of user actions or by assignment in code.
|
|
210
|
+
*/
|
|
211
|
+
readonly valueChanged: Event<any, EventArgs>;
|
|
212
|
+
/**
|
|
213
|
+
* Raises the {@link valueChanged} event.
|
|
214
|
+
*/
|
|
215
|
+
onValueChanged(e?: EventArgs): void;
|
|
216
|
+
dispose(): void;
|
|
217
|
+
onGotFocus(e: EventArgs): void;
|
|
218
|
+
onLostFocus(e?: EventArgs): void;
|
|
219
|
+
refresh(fullUpdate?: boolean): void;
|
|
220
|
+
private _isEditable;
|
|
221
|
+
private _updateSymbols;
|
|
222
|
+
private _isNumeric;
|
|
223
|
+
private _getInputRange;
|
|
224
|
+
private _flipSign;
|
|
225
|
+
private _getSelStartDigits;
|
|
226
|
+
private _setSelStartDigits;
|
|
227
|
+
private _increment;
|
|
228
|
+
protected _updateBtn(): void;
|
|
229
|
+
_setText(text: string, truncate?: boolean, forceDelete?: boolean): void;
|
|
230
|
+
protected _keypress(e: KeyboardEvent): void;
|
|
231
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
232
|
+
protected _input(): void;
|
|
233
|
+
protected _clickSpinner(e: MouseEvent): void;
|
|
234
|
+
protected _updateAria(): void;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The {@link InputMask} control provides a way to govern what a user is allowed
|
|
238
|
+
* to enter.
|
|
239
|
+
*
|
|
240
|
+
* The control prevents users from accidentally entering invalid data and
|
|
241
|
+
* saves time by skipping over literals (such as slashes in dates) as the
|
|
242
|
+
* user types.
|
|
243
|
+
*
|
|
244
|
+
* The mask used to validate the input is defined by the {@link InputMask.mask}
|
|
245
|
+
* property, which may contain one or more of the following special
|
|
246
|
+
* characters:
|
|
247
|
+
*
|
|
248
|
+
* <dl class="dl-horizontal">
|
|
249
|
+
* <dt>0</dt> <dd>Digit.</dd>
|
|
250
|
+
* <dt>9</dt> <dd>Digit or space.</dd>
|
|
251
|
+
* <dt>#</dt> <dd>Digit, sign, or space.</dd>
|
|
252
|
+
* <dt>L</dt> <dd>Letter.</dd>
|
|
253
|
+
* <dt>l</dt> <dd>Letter or space.</dd>
|
|
254
|
+
* <dt>A</dt> <dd>Alphanumeric.</dd>
|
|
255
|
+
* <dt>a</dt> <dd>Alphanumeric or space.</dd>
|
|
256
|
+
* <dt>.</dt> <dd>Localized decimal point.</dd>
|
|
257
|
+
* <dt>,</dt> <dd>Localized thousand separator.</dd>
|
|
258
|
+
* <dt>:</dt> <dd>Localized time separator.</dd>
|
|
259
|
+
* <dt>/</dt> <dd>Localized date separator.</dd>
|
|
260
|
+
* <dt>$</dt> <dd>Localized currency symbol.</dd>
|
|
261
|
+
* <dt><</dt> <dd>Converts characters that follow to lowercase.</dd>
|
|
262
|
+
* <dt>></dt> <dd>Converts characters that follow to uppercase.</dd>
|
|
263
|
+
* <dt>|</dt> <dd>Disables case conversion.</dd>
|
|
264
|
+
* <dt>\</dt> <dd>Escapes any character, turning it into a literal.</dd>
|
|
265
|
+
* <dt>9 (\uff19)</dt> <dd>DBCS Digit.</dd>
|
|
266
|
+
* <dt>J (\uff2a)</dt> <dd>DBCS Hiragana.</dd>
|
|
267
|
+
* <dt>G (\uff27)</dt> <dd>DBCS big Hiragana.</dd>
|
|
268
|
+
* <dt>K (\uff2b)</dt> <dd>DBCS Katakana. </dd>
|
|
269
|
+
* <dt>N (\uff2e)</dt> <dd>DBCS big Katakana.</dd>
|
|
270
|
+
* <dt>K</dt> <dd>SBCS Katakana.</dd>
|
|
271
|
+
* <dt>N</dt> <dd>SBCS big Katakana.</dd>
|
|
272
|
+
* <dt>Z (\uff3a)</dt> <dd>Any DBCS character.</dd>
|
|
273
|
+
* <dt>H</dt> <dd>Any SBCS character.</dd>
|
|
274
|
+
* <dt>All others</dt> <dd>Literals.</dd>
|
|
275
|
+
* </dl>
|
|
276
|
+
*
|
|
277
|
+
* The example below shows how you can use the {@link InputMask} control to
|
|
278
|
+
* edit strings with custom formats:
|
|
279
|
+
*
|
|
280
|
+
* {@sample Input/InputMask/Overview Example}
|
|
281
|
+
*/
|
|
282
|
+
export declare class InputMask extends Control {
|
|
283
|
+
_tbx: HTMLInputElement;
|
|
284
|
+
_oldValue: string;
|
|
285
|
+
_value: string;
|
|
286
|
+
_msk: _MaskProvider;
|
|
287
|
+
_fullEdit: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Gets or sets the template used to instantiate {@link InputMask} controls.
|
|
290
|
+
*/
|
|
291
|
+
static controlTemplate: string;
|
|
292
|
+
/**
|
|
293
|
+
* Initializes a new instance of the {@link InputMask} class.
|
|
294
|
+
*
|
|
295
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
296
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
297
|
+
*/
|
|
298
|
+
constructor(element: any, options?: any);
|
|
299
|
+
/**
|
|
300
|
+
* Gets the HTML input element hosted by the control.
|
|
301
|
+
*
|
|
302
|
+
* Use this property in situations where you want to customize the
|
|
303
|
+
* attributes of the input element.
|
|
304
|
+
*/
|
|
305
|
+
readonly inputElement: HTMLInputElement;
|
|
306
|
+
/**
|
|
307
|
+
* Gets or sets the "type" attribute of the HTML input element hosted
|
|
308
|
+
* by the control.
|
|
309
|
+
*
|
|
310
|
+
* The default value for this property is **'text'**.
|
|
311
|
+
*/
|
|
312
|
+
inputType: string;
|
|
313
|
+
/**
|
|
314
|
+
* Gets or sets the text currently shown in the control.
|
|
315
|
+
*/
|
|
316
|
+
value: string;
|
|
317
|
+
/**
|
|
318
|
+
* Gets or sets the raw value of the control (excluding mask literals).
|
|
319
|
+
*
|
|
320
|
+
* The raw value of the control excludes prompt and literal characters.
|
|
321
|
+
* For example, if the {@link mask} property is set to "AA-9999" and the
|
|
322
|
+
* user enters the value "AB-1234", the {@link rawValue} property will
|
|
323
|
+
* return "AB1234", excluding the hyphen that is part of the mask.
|
|
324
|
+
*/
|
|
325
|
+
rawValue: string;
|
|
326
|
+
/**
|
|
327
|
+
* Gets or sets the mask used to validate the input as the user types.
|
|
328
|
+
*
|
|
329
|
+
* The mask is defined as a string with one or more of the masking
|
|
330
|
+
* characters listed in the {@link InputMask} topic.
|
|
331
|
+
*
|
|
332
|
+
* The default value for this property is the empty string **''**.
|
|
333
|
+
*/
|
|
334
|
+
mask: string;
|
|
335
|
+
/**
|
|
336
|
+
* Gets or sets the symbol used to show input positions in the control.
|
|
337
|
+
*/
|
|
338
|
+
promptChar: string;
|
|
339
|
+
/**
|
|
340
|
+
* Gets or sets a value that determines whether the input element handles input in
|
|
341
|
+
* overwrite mode.
|
|
342
|
+
*
|
|
343
|
+
* In **overwrite mode**, every character you type is displayed at the cursor position.
|
|
344
|
+
* If a character is already at that position, it is replaced.
|
|
345
|
+
*
|
|
346
|
+
* In **insert mode**, each character you type is inserted at the cursor position.
|
|
347
|
+
*
|
|
348
|
+
* The default value for this property is **false**.
|
|
349
|
+
*/
|
|
350
|
+
overwriteMode: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Gets or sets the string shown as a hint when the control is empty.
|
|
353
|
+
*/
|
|
354
|
+
placeholder: string;
|
|
355
|
+
/**
|
|
356
|
+
* Gets a value that indicates whether the mask has been completely filled.
|
|
357
|
+
*/
|
|
358
|
+
readonly maskFull: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Gets or sets a value indicating whether the control value
|
|
361
|
+
* must be a non-empty string.
|
|
362
|
+
*
|
|
363
|
+
* The default value for this property is **true**.
|
|
364
|
+
*/
|
|
365
|
+
isRequired: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Gets or sets a value that indicates whether the user can modify
|
|
368
|
+
* the control value using the mouse and keyboard.
|
|
369
|
+
*
|
|
370
|
+
* The default value for this property is **false**.
|
|
371
|
+
*/
|
|
372
|
+
isReadOnly: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Sets the focus to the control and selects all its content.
|
|
375
|
+
*/
|
|
376
|
+
selectAll(): void;
|
|
377
|
+
/**
|
|
378
|
+
* Occurs when the value of the {@link value} property changes, either
|
|
379
|
+
* as a result of user actions or by assignment in code.
|
|
380
|
+
*/
|
|
381
|
+
readonly valueChanged: Event<InputMask, EventArgs>;
|
|
382
|
+
/**
|
|
383
|
+
* Raises the {@link valueChanged} event.
|
|
384
|
+
*/
|
|
385
|
+
onValueChanged(e?: EventArgs): void;
|
|
386
|
+
_commitText(): void;
|
|
387
|
+
dispose(): void;
|
|
388
|
+
refresh(fullUpdate?: boolean): void;
|
|
389
|
+
_isGridImeEnabled(): boolean;
|
|
390
|
+
onGotFocus(e: any): void;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* The {@link ColorPicker} control allows users to select a color by clicking
|
|
394
|
+
* on panels to adjust color channels (hue, saturation, brightness, alpha).
|
|
395
|
+
*
|
|
396
|
+
* Use the {@link value} property to get or set the currently selected color.
|
|
397
|
+
*
|
|
398
|
+
* The control is used as a drop-down for the {@link InputColor} control.
|
|
399
|
+
*
|
|
400
|
+
* {@sample Input/InputColor/Overview/purejs Example}
|
|
401
|
+
*/
|
|
402
|
+
export declare class ColorPicker extends Control {
|
|
403
|
+
_hsb: number[];
|
|
404
|
+
_alpha: number;
|
|
405
|
+
_value: string;
|
|
406
|
+
_palette: string[];
|
|
407
|
+
_eSB: HTMLElement;
|
|
408
|
+
_eHue: HTMLElement;
|
|
409
|
+
_eAlpha: HTMLElement;
|
|
410
|
+
_cSB: HTMLElement;
|
|
411
|
+
_cHue: HTMLElement;
|
|
412
|
+
_cAlpha: HTMLElement;
|
|
413
|
+
_ePal: HTMLElement;
|
|
414
|
+
_ePreview: HTMLElement;
|
|
415
|
+
_eText: HTMLElement;
|
|
416
|
+
_htDown: Element;
|
|
417
|
+
/**
|
|
418
|
+
* Gets or sets the template used to instantiate {@link ColorPicker} controls.
|
|
419
|
+
*/
|
|
420
|
+
static controlTemplate: string;
|
|
421
|
+
static _tplCursor: string;
|
|
422
|
+
/**
|
|
423
|
+
* Initializes a new instance of the {@link ColorPicker} class.
|
|
424
|
+
*
|
|
425
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
426
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
427
|
+
*/
|
|
428
|
+
constructor(element: any, options?: any);
|
|
429
|
+
/**
|
|
430
|
+
* Gets or sets a value indicating whether the {@link ColorPicker} allows users
|
|
431
|
+
* to edit the color's alpha channel (transparency).
|
|
432
|
+
*
|
|
433
|
+
* The default value for this property is **true**.
|
|
434
|
+
*/
|
|
435
|
+
showAlphaChannel: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Gets or sets a value indicating whether the {@link ColorPicker} shows a string representation
|
|
438
|
+
* of the current color.
|
|
439
|
+
*
|
|
440
|
+
* The default value for this property is **false**.
|
|
441
|
+
*/
|
|
442
|
+
showColorString: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Gets or sets the currently selected color.
|
|
445
|
+
*
|
|
446
|
+
* The default value for this property is **"#ffffff"** (white).
|
|
447
|
+
*
|
|
448
|
+
* Setting this property to a string that cannot be interpreted as
|
|
449
|
+
* a color causes the assignment to be ignored (no exceptions are
|
|
450
|
+
* thrown).
|
|
451
|
+
*/
|
|
452
|
+
value: string;
|
|
453
|
+
/**
|
|
454
|
+
* Gets or sets an array that contains the colors in the palette.
|
|
455
|
+
*
|
|
456
|
+
* The default palette contains up to ten colors, represented by
|
|
457
|
+
* an array with color strings.
|
|
458
|
+
*
|
|
459
|
+
* For each color in the palette, the control generates six buttons
|
|
460
|
+
* ranging from light to dark versions of the main color. Users
|
|
461
|
+
* may click these color buttons to select the color they want.
|
|
462
|
+
*
|
|
463
|
+
* You may customize the palette by providing the color string array
|
|
464
|
+
* you want to use. Palettes contain up to ten colors, and the first
|
|
465
|
+
* two are usually white and black.
|
|
466
|
+
*
|
|
467
|
+
* Palette arrays with more than 10 colors are truncated, and
|
|
468
|
+
* arrays with values that do not represent colors are ignored.
|
|
469
|
+
* No exceptions are thrown in these cases.
|
|
470
|
+
*/
|
|
471
|
+
palette: string[];
|
|
472
|
+
/**
|
|
473
|
+
* Occurs when the value of the {@link value} property changes, either
|
|
474
|
+
* as a result of user actions or by assignment in code.
|
|
475
|
+
*/
|
|
476
|
+
readonly valueChanged: Event<ColorPicker, EventArgs>;
|
|
477
|
+
/**
|
|
478
|
+
* Raises the {@link valueChanged} event.
|
|
479
|
+
*/
|
|
480
|
+
onValueChanged(e?: EventArgs): void;
|
|
481
|
+
protected _mouseDown(e: MouseEvent): void;
|
|
482
|
+
protected _mouseMove(e: MouseEvent): void;
|
|
483
|
+
protected _mouseUp(e: MouseEvent): void;
|
|
484
|
+
private _updateColor;
|
|
485
|
+
private _updatePalette;
|
|
486
|
+
private _makePalEntry;
|
|
487
|
+
private _updatePanels;
|
|
488
|
+
private _getTargetPanel;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* The {@link CollectionViewNavigator} control provides a UI for navigating
|
|
492
|
+
* through the data items or pages in a {@link CollectionView} object.
|
|
493
|
+
*
|
|
494
|
+
* Use the navigator's {@link cv} property to bind it to a {@link CollectionView},
|
|
495
|
+
* and the {@link byPage} property to define whether the navigator should show
|
|
496
|
+
* data items or pages.
|
|
497
|
+
*
|
|
498
|
+
* The navigator shows VCR-like buttons that allow users to select the
|
|
499
|
+
* first/previous/next/last data item (or page) in the {@link CollectionView},
|
|
500
|
+
* and some text showing the current index and total count.
|
|
501
|
+
*
|
|
502
|
+
* You may use the {@link headerFormat} property to customize the text displayed
|
|
503
|
+
* by the navigator.
|
|
504
|
+
*/
|
|
505
|
+
export declare class CollectionViewNavigator extends Control {
|
|
506
|
+
private _btnFirst;
|
|
507
|
+
private _btnPrev;
|
|
508
|
+
private _btnNext;
|
|
509
|
+
private _btnLast;
|
|
510
|
+
private _txtCurr;
|
|
511
|
+
private _view;
|
|
512
|
+
private _byPage;
|
|
513
|
+
private _rptNext;
|
|
514
|
+
private _rptPrev;
|
|
515
|
+
private _fmt;
|
|
516
|
+
/**
|
|
517
|
+
* Gets or sets the template used to instantiate {@link CollectionViewNavigator} controls.
|
|
518
|
+
*/
|
|
519
|
+
static controlTemplate: string;
|
|
520
|
+
/**
|
|
521
|
+
* Initializes a new instance of the {@link CollectionViewNavigator} class.
|
|
522
|
+
*
|
|
523
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
524
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
525
|
+
*/
|
|
526
|
+
constructor(element: any, options?: any);
|
|
527
|
+
/**
|
|
528
|
+
* Gets or sets the {@link CollectionView} controlled by this {@link CollectionViewNavigator}.
|
|
529
|
+
*/
|
|
530
|
+
cv: CollectionView;
|
|
531
|
+
/**
|
|
532
|
+
* Gets or sets a value that determines whether this {@link CollectionViewNavigator} should
|
|
533
|
+
* navigate items or pages.
|
|
534
|
+
*
|
|
535
|
+
* To navigate pages, the {@link CollectionView} associated with the navigator should
|
|
536
|
+
* have it's {@link CollectionView.pageSize} property set to a value greater than zero.
|
|
537
|
+
*
|
|
538
|
+
* The default value for this property is **false**.
|
|
539
|
+
*/
|
|
540
|
+
byPage: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Gets or sets the format string used to display the current
|
|
543
|
+
* total item/page values in the control header.
|
|
544
|
+
*
|
|
545
|
+
* The format string may contain the '{current}' and '{count}'
|
|
546
|
+
* replacement strings, which are replaced with values that
|
|
547
|
+
* depend on the value of the {@link byPage} property.
|
|
548
|
+
*
|
|
549
|
+
* The format string may also contain the following replacement
|
|
550
|
+
* strings: '{currentItem}', '{itemCount}', '{currentPage}', and
|
|
551
|
+
* '{pageCount}', which are replaced with values that do not
|
|
552
|
+
* depend on the value of the {@link byPage} property.
|
|
553
|
+
*
|
|
554
|
+
* The default value for this property is the string
|
|
555
|
+
* **"{current:n0} / {count:n0}"**.
|
|
556
|
+
*
|
|
557
|
+
* The control header element is an input element and contains
|
|
558
|
+
* plain text (HTML is not supported).
|
|
559
|
+
*/
|
|
560
|
+
headerFormat: string;
|
|
561
|
+
/**
|
|
562
|
+
* Gets or sets a value that determines whether the next/previous buttons
|
|
563
|
+
* should act as repeat buttons, firing repeatedly as long as the button
|
|
564
|
+
* remains pressed.
|
|
565
|
+
*
|
|
566
|
+
* The default value for this property is **true**.
|
|
567
|
+
*/
|
|
568
|
+
repeatButtons: boolean;
|
|
569
|
+
_update(): void;
|
|
570
|
+
_currentChanged(): void;
|
|
571
|
+
_collectionChanged(): void;
|
|
572
|
+
_click(e: MouseEvent): void;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Represents a method that formats an item for display in a
|
|
576
|
+
* {@link ListBox} control.
|
|
577
|
+
*/
|
|
578
|
+
export interface IItemFormatter {
|
|
579
|
+
/**
|
|
580
|
+
* @param index Index of the item being formatted.
|
|
581
|
+
* @param item Default text or HTML used to represent the item.
|
|
582
|
+
* @returns Customized text or HTML used to represent the item.
|
|
583
|
+
*/
|
|
584
|
+
(index: number, item: string): string;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* The {@link ListBox} control displays a list of items which may contain
|
|
588
|
+
* plain text or HTML, and allows users to select items with the mouse
|
|
589
|
+
* or the keyboard.
|
|
590
|
+
*
|
|
591
|
+
* Use the {@link ListBox.selectedIndex} property to determine which item
|
|
592
|
+
* is currently selected.
|
|
593
|
+
*
|
|
594
|
+
* You can populate a {@link ListBox} using an array of strings or you can
|
|
595
|
+
* use an array of objects, in which case the {@link ListBox.displayMemberPath}
|
|
596
|
+
* property determines which object property is displayed on the list.
|
|
597
|
+
*
|
|
598
|
+
* To display items that contain HTML rather than plain text, set the
|
|
599
|
+
* {@link ListBox.isContentHtml} property to true.
|
|
600
|
+
*
|
|
601
|
+
* The {@link ListBox} control supports the following keyboard commands:
|
|
602
|
+
*
|
|
603
|
+
* <table>
|
|
604
|
+
* <thead>
|
|
605
|
+
* <tr><th>Key Combination</th><th>Action</th></tr>
|
|
606
|
+
* </thead>
|
|
607
|
+
* <tbody>
|
|
608
|
+
* <tr><td>Up/Down</td><td>Select the previous/next item</td></tr>
|
|
609
|
+
* <tr><td>PageUp/Down</td><td>Select the item one page above or below the selection</td></tr>
|
|
610
|
+
* <tr><td>Home/End</td><td>Select the first/last items</td></tr>
|
|
611
|
+
* <tr><td>Space</td><td>Toggle the checkbox in the current item (see the {@link checkedMemberPath} property)</td></tr>
|
|
612
|
+
* <tr><td>Other characters</td><td>Search for items that contain the text typed (multi-character auto-search)</td></tr>
|
|
613
|
+
* </tbody>
|
|
614
|
+
* </table>
|
|
615
|
+
*
|
|
616
|
+
* The example below creates a {@link ListBox} control and populates it using
|
|
617
|
+
* a 'countries' array. The control updates its {@link ListBox.selectedIndex}
|
|
618
|
+
* and {@link ListBox.selectedItem} properties as the user moves the selection.
|
|
619
|
+
*
|
|
620
|
+
* {@sample Input/ListBox/Overview/purejs Example}
|
|
621
|
+
*/
|
|
622
|
+
export declare class ListBox extends Control {
|
|
623
|
+
_items: any;
|
|
624
|
+
_cv: ICollectionView | null;
|
|
625
|
+
_itemFormatter: IItemFormatter | null;
|
|
626
|
+
_pathDisplay: Binding;
|
|
627
|
+
_pathValue: Binding;
|
|
628
|
+
_pathChecked: Binding;
|
|
629
|
+
_html: boolean;
|
|
630
|
+
_shGroups: boolean;
|
|
631
|
+
private _checkedItems;
|
|
632
|
+
_itemRole: string;
|
|
633
|
+
_caseSensitive: boolean;
|
|
634
|
+
_addMode: boolean;
|
|
635
|
+
_vThreshold: number;
|
|
636
|
+
_isVirtual: boolean;
|
|
637
|
+
_children: HTMLElement[];
|
|
638
|
+
_clientHeight: number;
|
|
639
|
+
_itemHeight: number;
|
|
640
|
+
_itemsAbove: number;
|
|
641
|
+
_itemsBelow: number;
|
|
642
|
+
_eSizer: HTMLDivElement;
|
|
643
|
+
_ePadTop: HTMLDivElement;
|
|
644
|
+
_ePadBot: HTMLDivElement;
|
|
645
|
+
_checking: boolean;
|
|
646
|
+
_ignoredItemChangedEvents: boolean;
|
|
647
|
+
_search: string;
|
|
648
|
+
_toSearch: any;
|
|
649
|
+
_fmtItemHandlers: number;
|
|
650
|
+
_itemCount: number;
|
|
651
|
+
_oldSel: HTMLElement | null;
|
|
652
|
+
_container: HTMLElement | null;
|
|
653
|
+
_oldSelectedIndex: number;
|
|
654
|
+
static _DIDX_KEY: string;
|
|
655
|
+
static _VTHRESH: number;
|
|
656
|
+
/**
|
|
657
|
+
* Initializes a new instance of the {@link ListBox} class.
|
|
658
|
+
*
|
|
659
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
660
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
661
|
+
*/
|
|
662
|
+
constructor(element: any, options?: any);
|
|
663
|
+
/**
|
|
664
|
+
* Gets or sets the array or {@link ICollectionView} object that contains
|
|
665
|
+
* the list items.
|
|
666
|
+
*/
|
|
667
|
+
itemsSource: any;
|
|
668
|
+
/**
|
|
669
|
+
* Gets the {@link ICollectionView} object used as the item source.
|
|
670
|
+
*/
|
|
671
|
+
readonly collectionView: ICollectionView;
|
|
672
|
+
/**
|
|
673
|
+
* Gets or sets the minimum number of rows and/or columns required to enable
|
|
674
|
+
* virtualization.
|
|
675
|
+
*
|
|
676
|
+
* When the {@link ListBox} is virtualized, only the items that are currently
|
|
677
|
+
* visible are added to the DOM. This makes a huge difference in performance
|
|
678
|
+
* when the {@link ListBox} contains a large number of items (say 1,000 or so).
|
|
679
|
+
*
|
|
680
|
+
* The default value for this property is a very big number, meaning virtualization is
|
|
681
|
+
* disabled. To enable virtualization, set its value to 0 or a positive number.
|
|
682
|
+
*
|
|
683
|
+
* Virtualization assumes a vertically stacked layout, so it is automatically
|
|
684
|
+
* disabled if the {@link ListBox} uses a multi-column display (such as a
|
|
685
|
+
* flexbox or grid layout).
|
|
686
|
+
*/
|
|
687
|
+
virtualizationThreshold: number;
|
|
688
|
+
/**
|
|
689
|
+
* Gets or sets a value that determines whether the {@link ListBox} should
|
|
690
|
+
* include group header items to delimit data groups.
|
|
691
|
+
*
|
|
692
|
+
* Data groups are created by modifying the {@link ICollectionView.groupDescriptions}
|
|
693
|
+
* property of the {@link ICollectionView} object used as an {@link itemsSource}.
|
|
694
|
+
*
|
|
695
|
+
* The {@link ListBox} only shows the first level of grouping.
|
|
696
|
+
*
|
|
697
|
+
* The default value for this property is **false**.
|
|
698
|
+
*/
|
|
699
|
+
showGroups: boolean;
|
|
700
|
+
/**
|
|
701
|
+
* Gets or sets a value indicating whether items contain plain
|
|
702
|
+
* text or HTML.
|
|
703
|
+
*
|
|
704
|
+
* The default value for this property is **false**.
|
|
705
|
+
*/
|
|
706
|
+
isContentHtml: boolean;
|
|
707
|
+
/**
|
|
708
|
+
* Gets or sets a function used to customize the values shown on
|
|
709
|
+
* the list.
|
|
710
|
+
*
|
|
711
|
+
* The function takes two arguments, the item index and the default
|
|
712
|
+
* text or html, and returns the new text or html to display.
|
|
713
|
+
*
|
|
714
|
+
* If the formatting function needs a scope (i.e. a meaningful
|
|
715
|
+
* 'this' value), then remember to set the filter using the 'bind'
|
|
716
|
+
* function to specify the 'this' object. For example:
|
|
717
|
+
*
|
|
718
|
+
* ```typescript
|
|
719
|
+
* listBox.itemFormatter = customItemFormatter.bind(this);
|
|
720
|
+
* function customItemFormatter(index, content) {
|
|
721
|
+
* if (this.makeItemBold(index)) {
|
|
722
|
+
* content = '<b>' + content + '</b>';
|
|
723
|
+
* }
|
|
724
|
+
* return content;
|
|
725
|
+
* }
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
itemFormatter: IItemFormatter;
|
|
729
|
+
/**
|
|
730
|
+
* Gets or sets the name of the property to use as the visual
|
|
731
|
+
* representation of the items.
|
|
732
|
+
*
|
|
733
|
+
* The default value for this property is the empty string **''**.
|
|
734
|
+
*/
|
|
735
|
+
displayMemberPath: string;
|
|
736
|
+
/**
|
|
737
|
+
* Gets or sets the name of the property used to get the
|
|
738
|
+
* {@link selectedValue} from the {@link selectedItem}.
|
|
739
|
+
*
|
|
740
|
+
* The default value for this property is the empty string **''**.
|
|
741
|
+
*/
|
|
742
|
+
selectedValuePath: string;
|
|
743
|
+
/**
|
|
744
|
+
* Gets or sets the name of the property used to control
|
|
745
|
+
* check boxes placed next to each item.
|
|
746
|
+
*
|
|
747
|
+
* Use this property to create multi-select ListBoxes.
|
|
748
|
+
*
|
|
749
|
+
* When an item is checked or unchecked, the control raises the
|
|
750
|
+
* {@link itemChecked} event.
|
|
751
|
+
*
|
|
752
|
+
* Use the {@link selectedItem} property to retrieve the item that
|
|
753
|
+
* was checked or unchecked, or use the {@link checkedItems} property
|
|
754
|
+
* to retrieve the list of items that are currently checked.
|
|
755
|
+
*
|
|
756
|
+
* The default value for this property is the empty string **''**.
|
|
757
|
+
*/
|
|
758
|
+
checkedMemberPath: string;
|
|
759
|
+
/**
|
|
760
|
+
* Gets or sets a value that determines whether searches performed
|
|
761
|
+
* while the user types should case-sensitive.
|
|
762
|
+
*
|
|
763
|
+
* The default value for this property is **false**.
|
|
764
|
+
*/
|
|
765
|
+
caseSensitiveSearch: boolean;
|
|
766
|
+
/**
|
|
767
|
+
* Gets or sets the value or the "role" attribute added to the
|
|
768
|
+
* list items.
|
|
769
|
+
*
|
|
770
|
+
* The default value for this property is the string **"option"**.
|
|
771
|
+
*/
|
|
772
|
+
itemRole: string;
|
|
773
|
+
/**
|
|
774
|
+
* Gets the string displayed for the item at a given index.
|
|
775
|
+
*
|
|
776
|
+
* The string may be plain text or HTML, depending on the setting
|
|
777
|
+
* of the {@link isContentHtml} property.
|
|
778
|
+
*
|
|
779
|
+
* @param index The index of the item in the {@link itemsSource}.
|
|
780
|
+
*/
|
|
781
|
+
getDisplayValue(index: number): string;
|
|
782
|
+
/**
|
|
783
|
+
* Gets the text displayed for the item at a given index (as plain text).
|
|
784
|
+
*
|
|
785
|
+
* @param index The index of the item in the {@link itemsSource}.
|
|
786
|
+
*/
|
|
787
|
+
getDisplayText(index: number): string;
|
|
788
|
+
/**
|
|
789
|
+
* Gets a value that determines whether the item at a given index is enabled.
|
|
790
|
+
*
|
|
791
|
+
* @param index The index of the item in the {@link itemsSource}.
|
|
792
|
+
*/
|
|
793
|
+
isItemEnabled(index: number): boolean;
|
|
794
|
+
/**
|
|
795
|
+
* Gets or sets the index of the currently selected item.
|
|
796
|
+
*/
|
|
797
|
+
selectedIndex: number;
|
|
798
|
+
/**
|
|
799
|
+
* Gets or sets the item that is currently selected.
|
|
800
|
+
*/
|
|
801
|
+
selectedItem: any;
|
|
802
|
+
/**
|
|
803
|
+
* Gets or sets the value of the {@link selectedItem} obtained using
|
|
804
|
+
* the {@link selectedValuePath}.
|
|
805
|
+
*/
|
|
806
|
+
selectedValue: any;
|
|
807
|
+
/**
|
|
808
|
+
* Gets or sets the maximum height of the list (in pixels).
|
|
809
|
+
*
|
|
810
|
+
* The default value for this property is **null**, which
|
|
811
|
+
* means the {@link ListBox} has no maximum height limit.
|
|
812
|
+
*/
|
|
813
|
+
maxHeight: number;
|
|
814
|
+
/**
|
|
815
|
+
* Highlights the selected item and scrolls it into view.
|
|
816
|
+
*
|
|
817
|
+
* @param setFocus Whether to set the focus to the list after scrolling
|
|
818
|
+
* the selected item into view.
|
|
819
|
+
*/
|
|
820
|
+
showSelection(setFocus?: boolean): void;
|
|
821
|
+
/**
|
|
822
|
+
* Loads the list with items from the current {@link itemsSource}.
|
|
823
|
+
*/
|
|
824
|
+
loadList(): void;
|
|
825
|
+
/**
|
|
826
|
+
* Gets the checked state of an item on the list.
|
|
827
|
+
*
|
|
828
|
+
* This method can be used with multi-select ListBoxes
|
|
829
|
+
* (see the {@link checkedMemberPath} property).
|
|
830
|
+
*
|
|
831
|
+
* @param index Item index.
|
|
832
|
+
*/
|
|
833
|
+
getItemChecked(index: number): boolean;
|
|
834
|
+
/**
|
|
835
|
+
* Sets the checked state of an item on the list.
|
|
836
|
+
*
|
|
837
|
+
* This method is applicable only on multi-select ListBoxes
|
|
838
|
+
* (see the {@link checkedMemberPath} property).
|
|
839
|
+
*
|
|
840
|
+
* If the checked state of the item changes, the item becomes
|
|
841
|
+
* selected.
|
|
842
|
+
*
|
|
843
|
+
* @param index Item index.
|
|
844
|
+
* @param checked Item's new checked state.
|
|
845
|
+
*/
|
|
846
|
+
setItemChecked(index: number, checked: boolean | null): void;
|
|
847
|
+
/**
|
|
848
|
+
* Toggles the checked state of an item on the list.
|
|
849
|
+
* This method is applicable only to multi-select ListBoxes
|
|
850
|
+
* (see the {@link checkedMemberPath} property).
|
|
851
|
+
*
|
|
852
|
+
* @param index Item index.
|
|
853
|
+
*/
|
|
854
|
+
toggleItemChecked(index: number): void;
|
|
855
|
+
/**
|
|
856
|
+
* Gets or sets an array containing the items that are currently checked.
|
|
857
|
+
*
|
|
858
|
+
* Setting this property does not change the value of the
|
|
859
|
+
* {@link selectedIndex} property.
|
|
860
|
+
*/
|
|
861
|
+
checkedItems: any[];
|
|
862
|
+
/**
|
|
863
|
+
* Gets the data index of an element within the list.
|
|
864
|
+
*
|
|
865
|
+
* @param e Element to search for.
|
|
866
|
+
* @return The index of the element in the list, or -1 if the element
|
|
867
|
+
* is not a member of the list.
|
|
868
|
+
*/
|
|
869
|
+
indexOf(e: HTMLElement): number;
|
|
870
|
+
/**
|
|
871
|
+
* Occurs when the value of the {@link selectedIndex} property changes.
|
|
872
|
+
*/
|
|
873
|
+
readonly selectedIndexChanged: Event<ListBox, EventArgs>;
|
|
874
|
+
/**
|
|
875
|
+
* Raises the {@link selectedIndexChanged} event.
|
|
876
|
+
*/
|
|
877
|
+
onSelectedIndexChanged(e?: EventArgs): void;
|
|
878
|
+
/**
|
|
879
|
+
* Occurs when the list of items changes.
|
|
880
|
+
*/
|
|
881
|
+
readonly itemsChanged: Event<ListBox, EventArgs>;
|
|
882
|
+
/**
|
|
883
|
+
* Raises the {@link itemsChanged} event.
|
|
884
|
+
*/
|
|
885
|
+
onItemsChanged(e?: EventArgs): void;
|
|
886
|
+
/**
|
|
887
|
+
* Occurs before the list items are generated.
|
|
888
|
+
*/
|
|
889
|
+
readonly loadingItems: Event<ListBox, EventArgs>;
|
|
890
|
+
/**
|
|
891
|
+
* Raises the {@link loadingItems} event.
|
|
892
|
+
*/
|
|
893
|
+
onLoadingItems(e?: EventArgs): void;
|
|
894
|
+
/**
|
|
895
|
+
* Occurs after the list items have been generated.
|
|
896
|
+
*/
|
|
897
|
+
readonly loadedItems: Event<ListBox, EventArgs>;
|
|
898
|
+
/**
|
|
899
|
+
* Raises the {@link loadedItems} event.
|
|
900
|
+
*/
|
|
901
|
+
onLoadedItems(e?: EventArgs): void;
|
|
902
|
+
/**
|
|
903
|
+
* Occurs when the current item is checked or unchecked by the user.
|
|
904
|
+
*
|
|
905
|
+
* This event is raised when the {@link checkedMemberPath} is set to
|
|
906
|
+
* the name of a property to add check boxes to each item in the control.
|
|
907
|
+
*
|
|
908
|
+
* Use the {@link selectedItem} property to retrieve the item that was
|
|
909
|
+
* checked or unchecked.
|
|
910
|
+
*/
|
|
911
|
+
readonly itemChecked: Event<ListBox, EventArgs>;
|
|
912
|
+
/**
|
|
913
|
+
* Raises the {@link itemChecked} event.
|
|
914
|
+
*/
|
|
915
|
+
onItemChecked(e?: EventArgs): void;
|
|
916
|
+
/**
|
|
917
|
+
* Occurs when the value of the {@link checkedItems} property changes.
|
|
918
|
+
*/
|
|
919
|
+
readonly checkedItemsChanged: Event<ListBox, EventArgs>;
|
|
920
|
+
/**
|
|
921
|
+
* Raises the {@link checkedItemsChanged} event.
|
|
922
|
+
*/
|
|
923
|
+
onCheckedItemsChanged(e?: EventArgs): void;
|
|
924
|
+
/**
|
|
925
|
+
* Occurs when an element representing a list item has been created.
|
|
926
|
+
*
|
|
927
|
+
* This event can be used to format list items for display. It is similar
|
|
928
|
+
* in purpose to the {@link itemFormatter} property, but has the advantage
|
|
929
|
+
* of allowing multiple independent handlers.
|
|
930
|
+
*
|
|
931
|
+
* The {@link FormatItemEventArgs} object passed as a parameter has
|
|
932
|
+
* a **data** property that refers to the data item bound to the
|
|
933
|
+
* item and an **index** property that provides the item index into
|
|
934
|
+
* the current view.
|
|
935
|
+
*
|
|
936
|
+
* If the {@link showGroups} property is set to **true** and
|
|
937
|
+
* the item represents a group header, then the **data** property
|
|
938
|
+
* contains a reference to a {@link CollectionViewGroup} object
|
|
939
|
+
* represents the group. This object contains the group's **name**,
|
|
940
|
+
* **items**, and **groupDescription**.
|
|
941
|
+
* Since group headers do not correspond to actual data items,
|
|
942
|
+
* the **index** property in this case is set to **-1**.
|
|
943
|
+
*/
|
|
944
|
+
readonly formatItem: Event<ListBox, FormatItemEventArgs>;
|
|
945
|
+
/**
|
|
946
|
+
* Raises the {@link formatItem} event.
|
|
947
|
+
*
|
|
948
|
+
* @param e {@link FormatItemEventArgs} that contains the event data.
|
|
949
|
+
*/
|
|
950
|
+
onFormatItem(e: FormatItemEventArgs): void;
|
|
951
|
+
/**
|
|
952
|
+
* Refreshes the control.
|
|
953
|
+
*
|
|
954
|
+
* @param fullUpdate Whether to update the control layout as well as the content.
|
|
955
|
+
*/
|
|
956
|
+
refresh(fullUpdate?: boolean): void;
|
|
957
|
+
_updateCheckedList(arr: any[]): void;
|
|
958
|
+
_getBoundingClientRect(e: HTMLElement): Rect;
|
|
959
|
+
_updateItemAttributes(e: HTMLElement | null, selected: boolean): void;
|
|
960
|
+
_getCheckedItems(): any[];
|
|
961
|
+
_arrayEquals(arr1: any[], arr2: any[]): boolean;
|
|
962
|
+
_getChild(index: number): HTMLElement;
|
|
963
|
+
_getElementIndex(index: number): number;
|
|
964
|
+
private _setItemChecked;
|
|
965
|
+
private _checkedItemsUpdate;
|
|
966
|
+
private _cvCollectionChanged;
|
|
967
|
+
private _cvCurrentChanged;
|
|
968
|
+
protected _populateList(): void;
|
|
969
|
+
_getCanvasContext(): CanvasRenderingContext2D;
|
|
970
|
+
_getVirtual(): boolean;
|
|
971
|
+
_getMaxSupportedCssHeight(): number;
|
|
972
|
+
_updateViewRange(): boolean;
|
|
973
|
+
_getSelectedElement(visible: boolean): HTMLElement | null;
|
|
974
|
+
_handleResize(): void;
|
|
975
|
+
_createItem(i: number): string;
|
|
976
|
+
_getAriaSelected(isSelected: boolean, isChecked: boolean | null): boolean;
|
|
977
|
+
_createHeaderItem(group: CollectionViewGroup): string;
|
|
978
|
+
private _click;
|
|
979
|
+
private _keydown;
|
|
980
|
+
private _keypress;
|
|
981
|
+
_selectNext(): boolean;
|
|
982
|
+
_selectPrev(): boolean;
|
|
983
|
+
_selectFirst(): boolean;
|
|
984
|
+
_selectLast(): boolean;
|
|
985
|
+
_selectNextPage(): boolean;
|
|
986
|
+
_selectPrevPage(): boolean;
|
|
987
|
+
private _findNext;
|
|
988
|
+
private _getCheckbox;
|
|
989
|
+
_initFromSelect(hostElement: HTMLElement): void;
|
|
990
|
+
_setIsDisabled(value: boolean): void;
|
|
991
|
+
_setTabOrder(value: number): void;
|
|
992
|
+
_updateTabIndex(): void;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Provides arguments for the {@link ListBox.formatItem} event.
|
|
996
|
+
*/
|
|
997
|
+
export declare class FormatItemEventArgs extends EventArgs {
|
|
998
|
+
_index: number;
|
|
999
|
+
_data: any;
|
|
1000
|
+
_item: HTMLElement;
|
|
1001
|
+
/**
|
|
1002
|
+
* Initializes a new instance of the {@link FormatItemEventArgs} class.
|
|
1003
|
+
*
|
|
1004
|
+
* @param index Index of the item being formatted in the source {@link ICollectionView}, or -1 if the item is a group header.
|
|
1005
|
+
* @param data Data item being formatted, or a {@link CollectionViewGroup} object if the item is a group header.
|
|
1006
|
+
* @param item Element that represents the list item to be formatted.
|
|
1007
|
+
*/
|
|
1008
|
+
constructor(index: number, data: any, item: HTMLElement);
|
|
1009
|
+
/**
|
|
1010
|
+
* Gets the index of the data item in the list.
|
|
1011
|
+
*/
|
|
1012
|
+
readonly index: number;
|
|
1013
|
+
/**
|
|
1014
|
+
* Gets the data item being formatted.
|
|
1015
|
+
*/
|
|
1016
|
+
readonly data: any;
|
|
1017
|
+
/**
|
|
1018
|
+
* Gets a reference to the element that represents the list item to be formatted.
|
|
1019
|
+
*/
|
|
1020
|
+
readonly item: HTMLElement;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* The {@link MultiSelectListBox} control contains a {@link ListBox} with
|
|
1024
|
+
* a "Select All" button and a "Filter" input.
|
|
1025
|
+
*
|
|
1026
|
+
* The "Select All" and "Filter" elements can be shown or hidden using
|
|
1027
|
+
* the {@link showSelectAllCheckbox} and {@link showFilterInput} properties.
|
|
1028
|
+
*
|
|
1029
|
+
* The {@link MultiSelectListBox} control is used as a drop-down by the
|
|
1030
|
+
* {@link MultiSelect} control.
|
|
1031
|
+
*/
|
|
1032
|
+
export declare class MultiSelectListBox extends Control {
|
|
1033
|
+
_selectAll: HTMLElement;
|
|
1034
|
+
_filter: HTMLInputElement;
|
|
1035
|
+
_lbHost: HTMLElement;
|
|
1036
|
+
_lbx: ListBox;
|
|
1037
|
+
_cbSelectAll: HTMLInputElement;
|
|
1038
|
+
_spSelectAll: HTMLSpanElement;
|
|
1039
|
+
_selectAllLabel: string;
|
|
1040
|
+
_filterPlaceholder: string;
|
|
1041
|
+
_filterText: string;
|
|
1042
|
+
_checkOnFilter: boolean;
|
|
1043
|
+
_delay: number;
|
|
1044
|
+
_toSearch: any;
|
|
1045
|
+
static _DEF_CHECKED_PATH: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* Gets or sets the template used to instantiate {@link MultiSelectListBox} controls.
|
|
1048
|
+
*/
|
|
1049
|
+
static controlTemplate: string;
|
|
1050
|
+
/**
|
|
1051
|
+
* Initializes a new instance of the {@link MultiSelectListBox} class.
|
|
1052
|
+
*
|
|
1053
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
1054
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
1055
|
+
*/
|
|
1056
|
+
constructor(element: any, options?: any);
|
|
1057
|
+
/**
|
|
1058
|
+
* Gets or sets the array or {@link ICollectionView} object that contains
|
|
1059
|
+
* the list items.
|
|
1060
|
+
*/
|
|
1061
|
+
itemsSource: any;
|
|
1062
|
+
/**
|
|
1063
|
+
* Gets the {@link ICollectionView} object used as the item source.
|
|
1064
|
+
*/
|
|
1065
|
+
readonly collectionView: ICollectionView;
|
|
1066
|
+
/**
|
|
1067
|
+
* Gets or sets the minimum number of rows and/or columns required to enable
|
|
1068
|
+
* virtualization in the drop-down {@link ListBox}.
|
|
1069
|
+
*
|
|
1070
|
+
* The default value for this property is a very big number, meaning virtualization is
|
|
1071
|
+
* disabled. To enable virtualization, set its value to 0 or a positive number.
|
|
1072
|
+
*
|
|
1073
|
+
* For more detals, please see the {@link ListBox.virtializationThreshold}
|
|
1074
|
+
* property.
|
|
1075
|
+
*/
|
|
1076
|
+
virtualizationThreshold: number;
|
|
1077
|
+
/**
|
|
1078
|
+
* Gets or sets the name of the property to use as the visual
|
|
1079
|
+
* representation of the items.
|
|
1080
|
+
*/
|
|
1081
|
+
displayMemberPath: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Gets or sets a value indicating whether items contain plain
|
|
1084
|
+
* text or HTML.
|
|
1085
|
+
*
|
|
1086
|
+
* The default value for this property is **false**.
|
|
1087
|
+
*/
|
|
1088
|
+
isContentHtml: boolean;
|
|
1089
|
+
/**
|
|
1090
|
+
* Gets or sets a value that determines whether searches performed
|
|
1091
|
+
* while the user types should case-sensitive.
|
|
1092
|
+
*
|
|
1093
|
+
* The default value for this property is **false**.
|
|
1094
|
+
*/
|
|
1095
|
+
caseSensitiveSearch: boolean;
|
|
1096
|
+
/**
|
|
1097
|
+
* Gets or sets the delay, in milliseconds, between when a keystroke occurs
|
|
1098
|
+
* and when the search is performed to update the filter.
|
|
1099
|
+
*
|
|
1100
|
+
* This property is relevant only when the {@link showFilterInput}
|
|
1101
|
+
* property is set to **true**.
|
|
1102
|
+
*
|
|
1103
|
+
* The default value for this property is **500** milliseconds.
|
|
1104
|
+
*/
|
|
1105
|
+
delay: number;
|
|
1106
|
+
/**
|
|
1107
|
+
* Gets or sets a value that determines whether the {@link MultiSelectListBox} should
|
|
1108
|
+
* include group header items to delimit data groups.
|
|
1109
|
+
*
|
|
1110
|
+
* Data groups are created by modifying the {@link ICollectionView.groupDescriptions}
|
|
1111
|
+
* property of the {@link ICollectionView} object used as an {@link itemsSource}.
|
|
1112
|
+
*
|
|
1113
|
+
* The {@link MultiSelectListBox} only shows the first level of grouping.
|
|
1114
|
+
*
|
|
1115
|
+
* The default value for this property is **false**.
|
|
1116
|
+
*/
|
|
1117
|
+
showGroups: boolean;
|
|
1118
|
+
/**
|
|
1119
|
+
* Gets or sets a value that determines whether the {@link MultiSelectListBox}
|
|
1120
|
+
* should automatically check all filtered items when the filter text changes.
|
|
1121
|
+
*
|
|
1122
|
+
* The default value for this property is **true**, which causes the control
|
|
1123
|
+
* to behave like Excel and check all visible items when the filter is applied.
|
|
1124
|
+
*
|
|
1125
|
+
* For example, in a control with three items "Alice", "Bob", and "Mary",
|
|
1126
|
+
* typing "a" into the filter would cause the control to show items "Alice"
|
|
1127
|
+
* and "Mary", and both would be checked.
|
|
1128
|
+
*
|
|
1129
|
+
* Setting this property to **false** prevents the control from automatically
|
|
1130
|
+
* checking filtered items, and to keep checked items visible regardless of the
|
|
1131
|
+
* filter value.
|
|
1132
|
+
*
|
|
1133
|
+
* For example, in a control with three items "Alice", "Bob", and "Mary",
|
|
1134
|
+
* typing "a" into the filter would cause the control to show items "Alice"
|
|
1135
|
+
* and "Mary", but neither would be checked.
|
|
1136
|
+
* If the user then checked "Mary", and typed "b" into the filter, the list
|
|
1137
|
+
* would show items "Mary" (still checked) and "Bob" (unchecked).
|
|
1138
|
+
*/
|
|
1139
|
+
checkOnFilter: boolean;
|
|
1140
|
+
/**
|
|
1141
|
+
* Gets or sets the index of the currently selected item.
|
|
1142
|
+
*/
|
|
1143
|
+
selectedIndex: number;
|
|
1144
|
+
/**
|
|
1145
|
+
* Gets a reference to the {@link ListBox} control hosted by this
|
|
1146
|
+
* {@link MultiSelectListBox}.
|
|
1147
|
+
*/
|
|
1148
|
+
readonly listBox: ListBox;
|
|
1149
|
+
/**
|
|
1150
|
+
* Gets or sets whether the control should display a "filter" input
|
|
1151
|
+
* above the items to filter the items displayed.
|
|
1152
|
+
*
|
|
1153
|
+
* The default value for this property is **false**.
|
|
1154
|
+
*/
|
|
1155
|
+
showFilterInput: boolean;
|
|
1156
|
+
/**
|
|
1157
|
+
* Gets or sets the string used as a placeholder for the filter input element.
|
|
1158
|
+
*
|
|
1159
|
+
* The default value for this property is **null**, which causes the control
|
|
1160
|
+
* to show a localized version of the string "Filter".
|
|
1161
|
+
*/
|
|
1162
|
+
filterInputPlaceholder: string;
|
|
1163
|
+
/**
|
|
1164
|
+
* Gets or sets whether the control should display a "Select All" checkbox
|
|
1165
|
+
* above the items to select or de-select all items.
|
|
1166
|
+
*
|
|
1167
|
+
* The default value for this property is **false**.
|
|
1168
|
+
*/
|
|
1169
|
+
showSelectAllCheckbox: boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Gets or sets the string to be used as a label for the "Select All"
|
|
1172
|
+
* checkbox that is displayed when the {@link showSelectAllCheckbox}
|
|
1173
|
+
* property is set to true.
|
|
1174
|
+
*
|
|
1175
|
+
* The default value for this property is **null**, which causes the control
|
|
1176
|
+
* to show a localized version of the string "Select All".
|
|
1177
|
+
*/
|
|
1178
|
+
selectAllLabel: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Gets or sets the name of the property used to control the checkboxes
|
|
1181
|
+
* placed next to each item.
|
|
1182
|
+
*/
|
|
1183
|
+
checkedMemberPath: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Gets or sets an array containing the items that are currently checked.
|
|
1186
|
+
*/
|
|
1187
|
+
checkedItems: any[];
|
|
1188
|
+
/**
|
|
1189
|
+
* Occurs when the value of the {@link checkedItems} property changes.
|
|
1190
|
+
*/
|
|
1191
|
+
readonly checkedItemsChanged: Event<MultiSelectListBox, EventArgs>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Raises the {@link checkedItemsChanged} event.
|
|
1194
|
+
*/
|
|
1195
|
+
onCheckedItemsChanged(e?: any): void;
|
|
1196
|
+
/**
|
|
1197
|
+
* Occurs when the value of the {@link selectedIndex} property changes.
|
|
1198
|
+
*/
|
|
1199
|
+
readonly selectedIndexChanged: Event<MultiSelectListBox, EventArgs>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Raises the {@link selectedIndexChanged} event.
|
|
1202
|
+
*/
|
|
1203
|
+
onSelectedIndexChanged(e?: EventArgs): void;
|
|
1204
|
+
refresh(fullUpdate?: boolean): void;
|
|
1205
|
+
dispose(): void;
|
|
1206
|
+
_applyFilter(): void;
|
|
1207
|
+
_updateCheckAllCheckbox(): void;
|
|
1208
|
+
_setIsDisabled(value: boolean): void;
|
|
1209
|
+
_setTabOrder(value: number): void;
|
|
1210
|
+
tryForceClearDelayAndFilter(): void;
|
|
1211
|
+
onLostFocus(): void;
|
|
1212
|
+
}
|
|
1213
|
+
export interface _IDateRange {
|
|
1214
|
+
from: Date | null;
|
|
1215
|
+
to: Date | null;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Specifies constants that define the date selection behavior.
|
|
1219
|
+
*/
|
|
1220
|
+
export declare enum DateSelectionMode {
|
|
1221
|
+
/** The user cannot change the current value using the mouse or keyboard. */
|
|
1222
|
+
None = 0,
|
|
1223
|
+
/** The user can select days. */
|
|
1224
|
+
Day = 1,
|
|
1225
|
+
/** The user can select months. */
|
|
1226
|
+
Month = 2,
|
|
1227
|
+
/**
|
|
1228
|
+
* The user can select ranges.
|
|
1229
|
+
*
|
|
1230
|
+
* Ranges are defined by the {@link value} and {@link rangeEnd})
|
|
1231
|
+
* properties.
|
|
1232
|
+
*
|
|
1233
|
+
* To select a date range with the mouse, the user should click
|
|
1234
|
+
* the starting date ({@link value} property) and then the
|
|
1235
|
+
* ending date ({@link rangeEnd} property.
|
|
1236
|
+
*
|
|
1237
|
+
* To select a date range with the keyobard, the user should
|
|
1238
|
+
* use the cursor keys to select the starting date, then press
|
|
1239
|
+
* the shift key and extend the selection to select the ending
|
|
1240
|
+
* date.
|
|
1241
|
+
*/
|
|
1242
|
+
Range = 3
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Specifies constants that define whether the control should
|
|
1246
|
+
* display month navigation elements.
|
|
1247
|
+
*
|
|
1248
|
+
* The month navigation elements include a drop-down button to
|
|
1249
|
+
* switch between month and year views
|
|
1250
|
+
* (see the {@link monthView} property)
|
|
1251
|
+
* and buttons to navigate to the previous and next months
|
|
1252
|
+
* (see the {@link displayMonth} property).
|
|
1253
|
+
*
|
|
1254
|
+
* The month navigation elements can be displayed on one or more of
|
|
1255
|
+
* the {@link monthCount} in the control.
|
|
1256
|
+
*/
|
|
1257
|
+
export declare enum ShowMonthPicker {
|
|
1258
|
+
/** No month navigation. */
|
|
1259
|
+
None = 0,
|
|
1260
|
+
/** Show month navigation elements on the first month. */
|
|
1261
|
+
FirstMonth = 1,
|
|
1262
|
+
/** Show month navigation elements on the last month. */
|
|
1263
|
+
LastMonth = 2,
|
|
1264
|
+
/** Show month navigation elements on the first and last months. */
|
|
1265
|
+
FirstAndLastMonths = 3,
|
|
1266
|
+
/** Show month navigation elements on all months. */
|
|
1267
|
+
AllMonths = 4,
|
|
1268
|
+
/** Show month navigation buttons next to the edges of the calendar. */
|
|
1269
|
+
Outside = 5
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Represents a method that formats a date on the {@link Calendar}
|
|
1273
|
+
* control.
|
|
1274
|
+
*
|
|
1275
|
+
* The method typically adds class names to the element to modify
|
|
1276
|
+
* its appearance.
|
|
1277
|
+
*/
|
|
1278
|
+
export interface IDateFormatter {
|
|
1279
|
+
/**
|
|
1280
|
+
* @param date The date value to be formatted.
|
|
1281
|
+
* @param element The HTMLElement that represents the date value.
|
|
1282
|
+
*/
|
|
1283
|
+
(date: Date, element: HTMLElement): void;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Represents a method that takes a date value as a parameter and
|
|
1287
|
+
* returns a boolean value that indicates the date is valid and
|
|
1288
|
+
* should be selectable by the user.
|
|
1289
|
+
*/
|
|
1290
|
+
export interface IDateValidator {
|
|
1291
|
+
/**
|
|
1292
|
+
* @param date The date value to be formatted.
|
|
1293
|
+
* @returns True if the date is valid and should be selectable by the user.
|
|
1294
|
+
*/
|
|
1295
|
+
(date: Date): boolean;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* The {@link Calendar} control displays a table with one or more months
|
|
1299
|
+
* and allows users to view and select dates.
|
|
1300
|
+
*
|
|
1301
|
+
* You may use the {@link min} and {@link max} properties to restrict
|
|
1302
|
+
* the range of dates that the user can select.
|
|
1303
|
+
*
|
|
1304
|
+
* For details about using the {@link min} and {@link max} properties,
|
|
1305
|
+
* please see the
|
|
1306
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
1307
|
+
*
|
|
1308
|
+
* Use the {@link value} property to get or set the currently selected date.
|
|
1309
|
+
*
|
|
1310
|
+
* Use the {@link selectionMode} property to determine whether users should
|
|
1311
|
+
* be allowed to select days, ranges, months, or no values at all.
|
|
1312
|
+
*
|
|
1313
|
+
* The {@link Calendar} control supports the following keyboard commands:
|
|
1314
|
+
*
|
|
1315
|
+
* <table>
|
|
1316
|
+
* <thead>
|
|
1317
|
+
* <tr><th>Key Combination</th><th>Moves Selection To</th></tr>
|
|
1318
|
+
* </thead>
|
|
1319
|
+
* <tbody>
|
|
1320
|
+
* <tr><td>Left</td><td>Previous day</td></tr>
|
|
1321
|
+
* <tr><td>Right</td><td>Next day</td></tr>
|
|
1322
|
+
* <tr><td>Up</td><td>Previous week</td></tr>
|
|
1323
|
+
* <tr><td>Down</td><td>Next week</td></tr>
|
|
1324
|
+
* <tr><td>PgUp</td><td>Previous month</td></tr>
|
|
1325
|
+
* <tr><td>PgDn</td><td>Next month</td></tr>
|
|
1326
|
+
* <tr><td>Alt+PgUp</td><td>Previous year</td></tr>
|
|
1327
|
+
* <tr><td>Alt+PgDn</td><td>Next year</td></tr>
|
|
1328
|
+
* <tr><td>Home</td><td>First valid day of the month</td></tr>
|
|
1329
|
+
* <tr><td>End</td><td>Last valid day of the month</td></tr>
|
|
1330
|
+
* <tr><td>Alt+End</td><td>Today's date</td></tr>
|
|
1331
|
+
* </tbody>
|
|
1332
|
+
* </table>
|
|
1333
|
+
*
|
|
1334
|
+
* The example below shows a {@link Calendar} control that allows
|
|
1335
|
+
* users to select the date with a single click.
|
|
1336
|
+
*
|
|
1337
|
+
* {@sample Input/Calendar/Overview/purejs Example}
|
|
1338
|
+
*/
|
|
1339
|
+
export declare class Calendar extends Control {
|
|
1340
|
+
private _tbHdr;
|
|
1341
|
+
private _tbMth;
|
|
1342
|
+
private _tbYr;
|
|
1343
|
+
private _btnMth;
|
|
1344
|
+
private _spMth;
|
|
1345
|
+
private _btnPrv;
|
|
1346
|
+
private _btnTdy;
|
|
1347
|
+
private _btnNxt;
|
|
1348
|
+
private _lbYears;
|
|
1349
|
+
private _rptUp;
|
|
1350
|
+
private _rptDn;
|
|
1351
|
+
private _yrPicker;
|
|
1352
|
+
private _mtPicker;
|
|
1353
|
+
private _wksBefore;
|
|
1354
|
+
private _wksAfter;
|
|
1355
|
+
private _rngMin;
|
|
1356
|
+
private _rngMax;
|
|
1357
|
+
private _value;
|
|
1358
|
+
private _rngEnd;
|
|
1359
|
+
private _month;
|
|
1360
|
+
private _min;
|
|
1361
|
+
private _max;
|
|
1362
|
+
private _readOnly;
|
|
1363
|
+
private _handleWheel;
|
|
1364
|
+
private _fdw;
|
|
1365
|
+
private _selMode;
|
|
1366
|
+
private _itemFormatter;
|
|
1367
|
+
private _itemValidator;
|
|
1368
|
+
private _tmYrHidden;
|
|
1369
|
+
private _syncing;
|
|
1370
|
+
private _cals;
|
|
1371
|
+
_clearingRangeEnd: boolean;
|
|
1372
|
+
private _fmtYrMo;
|
|
1373
|
+
private _fmtYr;
|
|
1374
|
+
private _fmtDayHdr;
|
|
1375
|
+
private _fmtDay;
|
|
1376
|
+
private _fmtMonths;
|
|
1377
|
+
static _DATE_KEY: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* Gets or sets the template used to instantiate {@link Calendar} controls.
|
|
1380
|
+
*/
|
|
1381
|
+
static controlTemplate: string;
|
|
1382
|
+
/**
|
|
1383
|
+
* Initializes a new instance of the {@link Calendar} class.
|
|
1384
|
+
*
|
|
1385
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
1386
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
1387
|
+
*/
|
|
1388
|
+
constructor(element: any, options?: any);
|
|
1389
|
+
/**
|
|
1390
|
+
* Gets or sets the currently selected date.
|
|
1391
|
+
*
|
|
1392
|
+
* The default value for this property is the current date.
|
|
1393
|
+
*
|
|
1394
|
+
* When editing ranges, the current range is defined by the interval between
|
|
1395
|
+
* the {@link value} and {@link rangeEnd} properties.
|
|
1396
|
+
*
|
|
1397
|
+
* Setting the {@link value} property automatically resets the {@link rangeEnd}
|
|
1398
|
+
* property to null, so the user can click the range end value on the calendar
|
|
1399
|
+
* to finish a range selection.
|
|
1400
|
+
*
|
|
1401
|
+
* Because setting the {@link value} property resets {@link rangeEnd}, to define
|
|
1402
|
+
* a range in code you must set the {@link value} first, and then {@link rangeEnd}.
|
|
1403
|
+
* For example:
|
|
1404
|
+
*
|
|
1405
|
+
* ```typescript
|
|
1406
|
+
* // this selects a range from 'start' to 'end':
|
|
1407
|
+
* cal.value = start; // rangeEnd == null
|
|
1408
|
+
* cal.rangeEnd = end; // rangeEnd == 'end'
|
|
1409
|
+
*
|
|
1410
|
+
* // **this doesn't work**
|
|
1411
|
+
* cal.rangeEnd = end; // rangeEnd == 'end'
|
|
1412
|
+
* cal.value = start; // rangeEnd == null
|
|
1413
|
+
*/
|
|
1414
|
+
value: Date;
|
|
1415
|
+
/**
|
|
1416
|
+
* Gets or sets the last selected date in a range selection.
|
|
1417
|
+
*
|
|
1418
|
+
* To enable date range selection, set the {@link selectionMode} property
|
|
1419
|
+
* to **DateSelectionMode.Range**.
|
|
1420
|
+
*
|
|
1421
|
+
* Once you do that, the selection range will be defined by the {@link value}
|
|
1422
|
+
* and {@link rangeEnd} properties.
|
|
1423
|
+
*
|
|
1424
|
+
* If not null, the {@link rangeEnd} date must be greater than or equal to
|
|
1425
|
+
* the {@link value} date, which represents the range start.
|
|
1426
|
+
*/
|
|
1427
|
+
rangeEnd: Date;
|
|
1428
|
+
/**
|
|
1429
|
+
* Gets or sets the minimum number of days allowed when editing date ranges.
|
|
1430
|
+
*
|
|
1431
|
+
* This property is used only when the {@link selectionMode} property
|
|
1432
|
+
* is set to {@link DateSelectionMode.Range}.
|
|
1433
|
+
*
|
|
1434
|
+
* The default value for this property is **0**, which means there is
|
|
1435
|
+
* no minimum value for range lengths.
|
|
1436
|
+
*/
|
|
1437
|
+
rangeMin: number;
|
|
1438
|
+
/**
|
|
1439
|
+
* Gets or sets the maximum length allowed when editing date ranges.
|
|
1440
|
+
*
|
|
1441
|
+
* This property is used only when the {@link selectionMode} property
|
|
1442
|
+
* is set to {@link DateSelectionMode.Range}.
|
|
1443
|
+
*
|
|
1444
|
+
* The default value for this property is **0**, which means there
|
|
1445
|
+
* is no maximum value for range lengths.
|
|
1446
|
+
*/
|
|
1447
|
+
rangeMax: number;
|
|
1448
|
+
/**
|
|
1449
|
+
* Gets or sets the earliest date that the user can select in the calendar.
|
|
1450
|
+
*
|
|
1451
|
+
* The default value for this property is **null**, which means no earliest
|
|
1452
|
+
* date is defined.
|
|
1453
|
+
*
|
|
1454
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
1455
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
1456
|
+
*/
|
|
1457
|
+
min: Date | null;
|
|
1458
|
+
/**
|
|
1459
|
+
* Gets or sets the latest date that the user can select in the calendar.
|
|
1460
|
+
*
|
|
1461
|
+
* The default value for this property is **null**, which means no latest
|
|
1462
|
+
* date is defined.
|
|
1463
|
+
*
|
|
1464
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
1465
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
1466
|
+
*/
|
|
1467
|
+
max: Date | null;
|
|
1468
|
+
/**
|
|
1469
|
+
* Gets or sets a value that determines whether users should be
|
|
1470
|
+
* able to select days, day ranges, months, or no values at all.
|
|
1471
|
+
*
|
|
1472
|
+
* The default value for this property is **DateSelectionMode.Day**.
|
|
1473
|
+
*/
|
|
1474
|
+
selectionMode: DateSelectionMode;
|
|
1475
|
+
/**
|
|
1476
|
+
* Gets or sets a value that determines whether users can modify
|
|
1477
|
+
* the control value using the mouse and keyboard.
|
|
1478
|
+
*
|
|
1479
|
+
* The default value for this property is **false**.
|
|
1480
|
+
*/
|
|
1481
|
+
isReadOnly: boolean;
|
|
1482
|
+
/**
|
|
1483
|
+
* Gets or sets a value that determines whether the user can change
|
|
1484
|
+
* the current {@link displayMonth} using the mouse wheel.
|
|
1485
|
+
*
|
|
1486
|
+
* The default value for this property is **true**.
|
|
1487
|
+
*/
|
|
1488
|
+
handleWheel: boolean;
|
|
1489
|
+
/**
|
|
1490
|
+
* Gets or sets a value that determines whether the calendar buttons
|
|
1491
|
+
* should act as repeat buttons, firing repeatedly as the button
|
|
1492
|
+
* remains pressed.
|
|
1493
|
+
*
|
|
1494
|
+
* The default value for this property is **true**.
|
|
1495
|
+
*/
|
|
1496
|
+
repeatButtons: boolean;
|
|
1497
|
+
/**
|
|
1498
|
+
* Gets or sets a value that determines whether the calendar should
|
|
1499
|
+
* display a list of years when the user clicks the header element
|
|
1500
|
+
* on the year calendar.
|
|
1501
|
+
*
|
|
1502
|
+
* The default value for this property is **true**.
|
|
1503
|
+
*/
|
|
1504
|
+
showYearPicker: boolean;
|
|
1505
|
+
/**
|
|
1506
|
+
* Gets or sets a value that determines whether the calendar should
|
|
1507
|
+
* display a list of months when the user clicks the header element
|
|
1508
|
+
* on the month calendar, and buttons for navigating to the next
|
|
1509
|
+
* or previous months.
|
|
1510
|
+
*
|
|
1511
|
+
* The default value for this property is **ShowMonthPicker.FirstMonth**.
|
|
1512
|
+
*/
|
|
1513
|
+
showMonthPicker: boolean | ShowMonthPicker;
|
|
1514
|
+
/**
|
|
1515
|
+
* Gets or sets a value that represents the first day of the week,
|
|
1516
|
+
* the one displayed in the first column of the calendar.
|
|
1517
|
+
*
|
|
1518
|
+
* The default value for this property is **null**, which causes
|
|
1519
|
+
* the calendar to use the default for the current culture.
|
|
1520
|
+
*
|
|
1521
|
+
* In the English culture, the first day of the week is Sunday (0);
|
|
1522
|
+
* in most European cultures, the first day of the week is Monday (1).
|
|
1523
|
+
*/
|
|
1524
|
+
firstDayOfWeek: number | null;
|
|
1525
|
+
/**
|
|
1526
|
+
* Gets or sets the month displayed in the calendar.
|
|
1527
|
+
*/
|
|
1528
|
+
displayMonth: Date;
|
|
1529
|
+
/**
|
|
1530
|
+
* Gets or sets the number of months to display within the calendar.
|
|
1531
|
+
*
|
|
1532
|
+
* The default value for this property is **1**.
|
|
1533
|
+
*
|
|
1534
|
+
* When you set this property to a value greater than 1, extra child
|
|
1535
|
+
* calendars are added to the control displaying consecutive months.
|
|
1536
|
+
*
|
|
1537
|
+
* All calendars within the control are synchronized, so changing
|
|
1538
|
+
* any property on the main calendar automatically updates all
|
|
1539
|
+
* child calendars. This includes the {@link value}, {@link rangeEnd},
|
|
1540
|
+
* and {@link selectionMode} properties.
|
|
1541
|
+
*
|
|
1542
|
+
* When multiple months are shown, the main control's host element
|
|
1543
|
+
* gets a "wj-calendar-multimonth" class which is used in CSS to
|
|
1544
|
+
* switch the display to "flex".
|
|
1545
|
+
*
|
|
1546
|
+
* The "flex" container is very versatile. You can limit the width
|
|
1547
|
+
* of the outer control and have the months wrap horizontally or
|
|
1548
|
+
* vertically, align the months within the main control, align and
|
|
1549
|
+
* justify them, etc.
|
|
1550
|
+
*/
|
|
1551
|
+
monthCount: number;
|
|
1552
|
+
/**
|
|
1553
|
+
* Gets or sets the format used to display the month and year
|
|
1554
|
+
* above the calendar in month view.
|
|
1555
|
+
*
|
|
1556
|
+
* The default value for this property is **'y'**.
|
|
1557
|
+
*/
|
|
1558
|
+
formatYearMonth: string;
|
|
1559
|
+
/**
|
|
1560
|
+
* Gets or sets the format used to display the headers
|
|
1561
|
+
* above the days in month view.
|
|
1562
|
+
*
|
|
1563
|
+
* The default value for this property is **'ddd'**.
|
|
1564
|
+
*/
|
|
1565
|
+
formatDayHeaders: string;
|
|
1566
|
+
/**
|
|
1567
|
+
* Gets or sets the format used to display the days
|
|
1568
|
+
* in month view.
|
|
1569
|
+
*
|
|
1570
|
+
* The default value for this property is 'd ' (the space after the 'd'
|
|
1571
|
+
* prevents the format from being interpreted as 'd', the standard format
|
|
1572
|
+
* used to represent the short date pattern).
|
|
1573
|
+
*/
|
|
1574
|
+
formatDays: string;
|
|
1575
|
+
/**
|
|
1576
|
+
* Gets or sets the format used to display the year
|
|
1577
|
+
* above the months in year view.
|
|
1578
|
+
*
|
|
1579
|
+
* The default value for this property is **'yyyy'**.
|
|
1580
|
+
*/
|
|
1581
|
+
formatYear: string;
|
|
1582
|
+
/**
|
|
1583
|
+
* Gets or sets the format used to display the months
|
|
1584
|
+
* in year view.
|
|
1585
|
+
*
|
|
1586
|
+
* The default value for this property is **'MMM'**.
|
|
1587
|
+
*/
|
|
1588
|
+
formatMonths: string;
|
|
1589
|
+
/**
|
|
1590
|
+
* Gets or sets a value that determines whether the control should
|
|
1591
|
+
* display a header area with the current month and navigation buttons.
|
|
1592
|
+
*
|
|
1593
|
+
* The default value for this property is **true**.
|
|
1594
|
+
*/
|
|
1595
|
+
showHeader: boolean;
|
|
1596
|
+
/**
|
|
1597
|
+
* Gets or sets a value that determines whether the calendar should
|
|
1598
|
+
* display a month view (one day per cell) or a year view (one month per cell).
|
|
1599
|
+
*
|
|
1600
|
+
* The default value for this property is **true**.
|
|
1601
|
+
*/
|
|
1602
|
+
monthView: boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Gets or sets the number of weeks to show on the calendar
|
|
1605
|
+
* before the current month.
|
|
1606
|
+
*
|
|
1607
|
+
* The default value for this property is **zero**.
|
|
1608
|
+
*/
|
|
1609
|
+
weeksBefore: number;
|
|
1610
|
+
/**
|
|
1611
|
+
* Gets or sets the number of weeks to show on the calendar
|
|
1612
|
+
* after the current month.
|
|
1613
|
+
*
|
|
1614
|
+
* The default value for this property is **zero**.
|
|
1615
|
+
*/
|
|
1616
|
+
weeksAfter: number;
|
|
1617
|
+
/**
|
|
1618
|
+
* Gets or sets a formatter function to customize dates in the calendar.
|
|
1619
|
+
*
|
|
1620
|
+
* The formatter function can add any content to any date. It allows
|
|
1621
|
+
* complete customization of the appearance and behavior of the calendar.
|
|
1622
|
+
*
|
|
1623
|
+
* If specified, the function takes two parameters:
|
|
1624
|
+
* <ul>
|
|
1625
|
+
* <li>the date being formatted </li>
|
|
1626
|
+
* <li>the HTML element that represents the date</li>
|
|
1627
|
+
* </ul>
|
|
1628
|
+
*
|
|
1629
|
+
* For example, the code below shows weekends with a yellow background:
|
|
1630
|
+
* ```typescript
|
|
1631
|
+
* calendar.itemFormatter = (date, element) => {
|
|
1632
|
+
* let day = date.getDay();
|
|
1633
|
+
* element.style.backgroundColor = (day == 0 || day == 6) ? 'yellow' : '';
|
|
1634
|
+
* }
|
|
1635
|
+
* ```
|
|
1636
|
+
*/
|
|
1637
|
+
itemFormatter: IDateFormatter | null;
|
|
1638
|
+
/**
|
|
1639
|
+
* Gets or sets a validator function to determine whether dates are valid for selection.
|
|
1640
|
+
*
|
|
1641
|
+
* If specified, the validator function should take one parameter representing the
|
|
1642
|
+
* date to be tested, and should return false if the date is invalid and should not
|
|
1643
|
+
* be selectable.
|
|
1644
|
+
*
|
|
1645
|
+
* For example, the code below shows weekends in a disabled state and prevents users
|
|
1646
|
+
* from selecting those dates:
|
|
1647
|
+
* ```typescript
|
|
1648
|
+
* calendar.itemValidator = date => {
|
|
1649
|
+
* let weekday = date.getDay();
|
|
1650
|
+
* return weekday != 0 && weekday != 6;
|
|
1651
|
+
* }
|
|
1652
|
+
* ```
|
|
1653
|
+
*/
|
|
1654
|
+
itemValidator: IDateValidator | null;
|
|
1655
|
+
/**
|
|
1656
|
+
* Gets the date at a given mouse position or represented
|
|
1657
|
+
* by a given HTML element.
|
|
1658
|
+
*
|
|
1659
|
+
* @param e Element to test.
|
|
1660
|
+
* @returns The date represented by the element, or null if the
|
|
1661
|
+
* element does not represent a date.
|
|
1662
|
+
*/
|
|
1663
|
+
hitTest(e: MouseEvent | Element): Date;
|
|
1664
|
+
/**
|
|
1665
|
+
* Adjusts the {@see displayMonth} value as needed to ensure
|
|
1666
|
+
* a given date is visible on the calendar.
|
|
1667
|
+
*
|
|
1668
|
+
* @param date Date to display.
|
|
1669
|
+
*/
|
|
1670
|
+
ensureVisible(date: Date): void;
|
|
1671
|
+
/**
|
|
1672
|
+
* Occurs when the value of the {@link value} property changes.
|
|
1673
|
+
*/
|
|
1674
|
+
readonly valueChanged: Event<Calendar, EventArgs>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Raises the {@link valueChanged} event.
|
|
1677
|
+
*/
|
|
1678
|
+
onValueChanged(e?: EventArgs): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Occurs when the value of the {@link rangeEnd} property changes.
|
|
1681
|
+
*/
|
|
1682
|
+
readonly rangeEndChanged: Event<Calendar, EventArgs>;
|
|
1683
|
+
/**
|
|
1684
|
+
* Raises the {@link rangeEndChanged} event.
|
|
1685
|
+
*/
|
|
1686
|
+
onRangeEndChanged(e?: EventArgs): void;
|
|
1687
|
+
/**
|
|
1688
|
+
* Occurs when the value of the {@link rangeEnd} property changes
|
|
1689
|
+
* into a non-null value, indicating a data range has been selected.
|
|
1690
|
+
*/
|
|
1691
|
+
readonly rangeChanged: Event<Calendar, EventArgs>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Raises the {@link rangeChanged} event.
|
|
1694
|
+
*/
|
|
1695
|
+
onRangeChanged(e?: EventArgs): void;
|
|
1696
|
+
/**
|
|
1697
|
+
* Occurs after the {@link displayMonth} property changes.
|
|
1698
|
+
*/
|
|
1699
|
+
readonly displayMonthChanged: Event<Calendar, EventArgs>;
|
|
1700
|
+
/**
|
|
1701
|
+
* Raises the {@link displayMonthChanged} event.
|
|
1702
|
+
*/
|
|
1703
|
+
onDisplayMonthChanged(e?: EventArgs): void;
|
|
1704
|
+
/**
|
|
1705
|
+
* Occurs when an element representing a day in the calendar has been created.
|
|
1706
|
+
*
|
|
1707
|
+
* This event can be used to format calendar items for display. It is similar
|
|
1708
|
+
* in purpose to the {@link itemFormatter} property, but has the advantage
|
|
1709
|
+
* of allowing multiple independent handlers.
|
|
1710
|
+
*
|
|
1711
|
+
* For example, the code below uses the {@link formatItem} event to disable weekends
|
|
1712
|
+
* so they appear dimmed in the calendar:
|
|
1713
|
+
* ```typescript
|
|
1714
|
+
* // disable Sundays and Saturdays
|
|
1715
|
+
* calendar.formatItem.addHandler((s, e) => {
|
|
1716
|
+
* let day = e.data.getDay();
|
|
1717
|
+
* if (day == 0 || day == 6) {
|
|
1718
|
+
* addClass(e.item, 'wj-state-disabled');
|
|
1719
|
+
* }
|
|
1720
|
+
* });
|
|
1721
|
+
* ```
|
|
1722
|
+
*/
|
|
1723
|
+
readonly formatItem: Event<Calendar, FormatItemEventArgs>;
|
|
1724
|
+
/**
|
|
1725
|
+
* Raises the {@link formatItem} event.
|
|
1726
|
+
*
|
|
1727
|
+
* @param e {@link FormatItemEventArgs} that contains the event data.
|
|
1728
|
+
*/
|
|
1729
|
+
onFormatItem(e: FormatItemEventArgs): void;
|
|
1730
|
+
_containsFocusImpl(activeElement: HTMLElement): boolean;
|
|
1731
|
+
dispose(): void;
|
|
1732
|
+
refresh(fullUpdate?: boolean): void;
|
|
1733
|
+
private _getShowMonthPicker;
|
|
1734
|
+
private _getDisplayMonthRange;
|
|
1735
|
+
private _getCalendar;
|
|
1736
|
+
private _getCalendars;
|
|
1737
|
+
private _syncProp;
|
|
1738
|
+
private _updateContent;
|
|
1739
|
+
private _updateSelection;
|
|
1740
|
+
private _addWeek;
|
|
1741
|
+
private _customizeCell;
|
|
1742
|
+
private _canChangeValue;
|
|
1743
|
+
private _valid;
|
|
1744
|
+
private _inValidRange;
|
|
1745
|
+
private _monthInValidRange;
|
|
1746
|
+
private _sameMonth;
|
|
1747
|
+
private _getValidDate;
|
|
1748
|
+
_clamp(value: Date): Date;
|
|
1749
|
+
private _createChildren;
|
|
1750
|
+
private _createYearPicker;
|
|
1751
|
+
private _createElement;
|
|
1752
|
+
private _click;
|
|
1753
|
+
private _keydown;
|
|
1754
|
+
private _getMonth;
|
|
1755
|
+
_mthMode(): boolean;
|
|
1756
|
+
_rngMode(): boolean;
|
|
1757
|
+
private _navigate;
|
|
1758
|
+
_setTabOrder(value: number): void;
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Specifies constants that define the action to perform when the
|
|
1762
|
+
* user clicks the input element in the control.
|
|
1763
|
+
*/
|
|
1764
|
+
export declare enum ClickAction {
|
|
1765
|
+
/** Selects the input element content. */
|
|
1766
|
+
Select = 0,
|
|
1767
|
+
/** Open the drop-down. */
|
|
1768
|
+
Open = 1,
|
|
1769
|
+
/** Toggle the drop-down. */
|
|
1770
|
+
Toggle = 2
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* DropDown control (abstract).
|
|
1774
|
+
*
|
|
1775
|
+
* Contains an input element and a button used to show or hide the drop-down.
|
|
1776
|
+
*
|
|
1777
|
+
* Derived classes must override the _createDropDown method to create whatever
|
|
1778
|
+
* editor they want to show in the drop down area (a list of items, a calendar,
|
|
1779
|
+
* a color editor, etc).
|
|
1780
|
+
*/
|
|
1781
|
+
export declare class DropDown extends Control {
|
|
1782
|
+
_tbx: HTMLInputElement;
|
|
1783
|
+
_elRef: HTMLElement;
|
|
1784
|
+
_btn: HTMLElement;
|
|
1785
|
+
_dropDown: HTMLElement;
|
|
1786
|
+
_clickAction: ClickAction;
|
|
1787
|
+
_showBtn: boolean;
|
|
1788
|
+
_autoExpand: boolean;
|
|
1789
|
+
_animate: boolean;
|
|
1790
|
+
_cssClass: string;
|
|
1791
|
+
_internalSettingText: boolean;
|
|
1792
|
+
_oldText: string;
|
|
1793
|
+
_minWidthDropdown: string;
|
|
1794
|
+
_escapeIE: boolean;
|
|
1795
|
+
/**
|
|
1796
|
+
* Gets or sets the template used to instantiate {@link DropDown} controls.
|
|
1797
|
+
*/
|
|
1798
|
+
static controlTemplate: string;
|
|
1799
|
+
/**
|
|
1800
|
+
* Initializes a new instance of the {@link DropDown} class.
|
|
1801
|
+
*
|
|
1802
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
1803
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
1804
|
+
*/
|
|
1805
|
+
constructor(element: any, options?: any);
|
|
1806
|
+
/**
|
|
1807
|
+
* Gets or sets the text shown on the control.
|
|
1808
|
+
*/
|
|
1809
|
+
text: string | null;
|
|
1810
|
+
/**
|
|
1811
|
+
* Gets the HTML input element hosted by the control.
|
|
1812
|
+
*
|
|
1813
|
+
* Use this property in situations where you want to customize the
|
|
1814
|
+
* attributes of the input element.
|
|
1815
|
+
*/
|
|
1816
|
+
readonly inputElement: HTMLInputElement;
|
|
1817
|
+
/**
|
|
1818
|
+
* Gets or sets the "type" attribute of the HTML input element hosted
|
|
1819
|
+
* by the control.
|
|
1820
|
+
*
|
|
1821
|
+
* The default value for this property is **'text'**.
|
|
1822
|
+
*/
|
|
1823
|
+
inputType: string;
|
|
1824
|
+
/**
|
|
1825
|
+
* Gets or sets a value that indicates whether the user can modify
|
|
1826
|
+
* the control value using the mouse and keyboard.
|
|
1827
|
+
*
|
|
1828
|
+
* The default value for this property is **false**.
|
|
1829
|
+
*/
|
|
1830
|
+
isReadOnly: boolean;
|
|
1831
|
+
/**
|
|
1832
|
+
* Gets or sets a value that determines whether the control value must be
|
|
1833
|
+
* set to a non-null value or whether it can be set to null
|
|
1834
|
+
* (by deleting the content of the control).
|
|
1835
|
+
*
|
|
1836
|
+
* This property defaults to true for most controls, including {@link ComboBox},
|
|
1837
|
+
* {@link InputDate}, {@link InputTime}, {@link InputDateTime}, and {@link InputColor}.
|
|
1838
|
+
* It defaults to false for the {@link AutoComplete} control.
|
|
1839
|
+
*/
|
|
1840
|
+
isRequired: boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* Gets or sets the string shown as a hint when the control is empty.
|
|
1843
|
+
*/
|
|
1844
|
+
placeholder: string;
|
|
1845
|
+
/**
|
|
1846
|
+
* Gets or sets a value that specifies the action to perform when the
|
|
1847
|
+
* user clicks the input element in the control.
|
|
1848
|
+
*
|
|
1849
|
+
* For most drop-down controls, this property is set to {@link ClickAction.Select}
|
|
1850
|
+
* by default. This setting allows users to select portions of the text with the mouse.
|
|
1851
|
+
*
|
|
1852
|
+
* For drop-down controls that display non-editable text (such as the {@link MultiSelect}),
|
|
1853
|
+
* this property is set to {@link ClickAction.Toggle} by default.
|
|
1854
|
+
*/
|
|
1855
|
+
clickAction: ClickAction;
|
|
1856
|
+
/**
|
|
1857
|
+
* Gets or sets a value that indicates whether the drop down is currently
|
|
1858
|
+
* visible.
|
|
1859
|
+
*
|
|
1860
|
+
* The default value for this property is **false**.
|
|
1861
|
+
*/
|
|
1862
|
+
isDroppedDown: boolean;
|
|
1863
|
+
_toogleDropDown(isDroppedDown: boolean): void;
|
|
1864
|
+
/**
|
|
1865
|
+
* Gets the drop down element shown when the {@link isDroppedDown}
|
|
1866
|
+
* property is set to true.
|
|
1867
|
+
*/
|
|
1868
|
+
readonly dropDown: HTMLElement;
|
|
1869
|
+
/**
|
|
1870
|
+
* Gets or sets a CSS class name to add to the control's drop-down element.
|
|
1871
|
+
*
|
|
1872
|
+
* This property is useful when styling the drop-down element, because it is
|
|
1873
|
+
* shown as a child of the document body rather than as a child of the control
|
|
1874
|
+
* itself, which prevents using CSS selectors based on the parent control.
|
|
1875
|
+
*/
|
|
1876
|
+
dropDownCssClass: string;
|
|
1877
|
+
/**
|
|
1878
|
+
* Gets or sets a value that indicates whether the control should
|
|
1879
|
+
* display a drop-down button.
|
|
1880
|
+
*
|
|
1881
|
+
* The default value for this property is **true**.
|
|
1882
|
+
*/
|
|
1883
|
+
showDropDownButton: boolean;
|
|
1884
|
+
/**
|
|
1885
|
+
* Gets or sets a value that indicates whether the control should
|
|
1886
|
+
* automatically expand the selection to whole words/numbers when
|
|
1887
|
+
* the control is clicked.
|
|
1888
|
+
*
|
|
1889
|
+
* The default value for this property is **true**.
|
|
1890
|
+
*/
|
|
1891
|
+
autoExpandSelection: boolean;
|
|
1892
|
+
/**
|
|
1893
|
+
* Gets or sets a value that indicates whether the control should use a fade-in animation
|
|
1894
|
+
* when displaying the drop-down.
|
|
1895
|
+
*
|
|
1896
|
+
* The default value for this property is **false**.
|
|
1897
|
+
*/
|
|
1898
|
+
isAnimated: boolean;
|
|
1899
|
+
/**
|
|
1900
|
+
* Sets the focus to the control and selects all its content.
|
|
1901
|
+
*/
|
|
1902
|
+
selectAll(): void;
|
|
1903
|
+
/**
|
|
1904
|
+
* Occurs when the value of the {@link text} property changes.
|
|
1905
|
+
*/
|
|
1906
|
+
readonly textChanged: Event<DropDown, EventArgs>;
|
|
1907
|
+
/**
|
|
1908
|
+
* Raises the {@link textChanged} event.
|
|
1909
|
+
*/
|
|
1910
|
+
onTextChanged(e?: EventArgs): void;
|
|
1911
|
+
/**
|
|
1912
|
+
* Occurs before the drop down is shown or hidden.
|
|
1913
|
+
*/
|
|
1914
|
+
readonly isDroppedDownChanging: Event<DropDown, CancelEventArgs>;
|
|
1915
|
+
/**
|
|
1916
|
+
* Raises the {@link isDroppedDownChanging} event.
|
|
1917
|
+
*/
|
|
1918
|
+
onIsDroppedDownChanging(e: CancelEventArgs): boolean;
|
|
1919
|
+
/**
|
|
1920
|
+
* Occurs after the drop down is shown or hidden.
|
|
1921
|
+
*/
|
|
1922
|
+
readonly isDroppedDownChanged: Event<DropDown, EventArgs>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Raises the {@link isDroppedDownChanged} event.
|
|
1925
|
+
*/
|
|
1926
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
1927
|
+
onGotFocus(e?: EventArgs): void;
|
|
1928
|
+
onLostFocus(e?: EventArgs): void;
|
|
1929
|
+
_containsFocusImpl(activeElement: HTMLElement): boolean;
|
|
1930
|
+
dispose(): void;
|
|
1931
|
+
refresh(fullUpdate?: boolean): void;
|
|
1932
|
+
_handleResize(): void;
|
|
1933
|
+
protected _dropDownClick(e: MouseEvent): void;
|
|
1934
|
+
protected _expandSelection(): void;
|
|
1935
|
+
protected _getCharType(text: string, pos: number): 1 | -1 | 0;
|
|
1936
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
1937
|
+
protected _isHiddenEditor(): boolean;
|
|
1938
|
+
protected _keypress(e: KeyboardEvent): void;
|
|
1939
|
+
protected _input(e: Event): void;
|
|
1940
|
+
protected _btnclick(e: MouseEvent): void;
|
|
1941
|
+
protected _setText(text: string, fullMatch: boolean, forceRevertInvalid?: boolean, clearTbxVal?: boolean): void;
|
|
1942
|
+
protected _updateBtn(): void;
|
|
1943
|
+
protected _createDropDown(): void;
|
|
1944
|
+
protected _commitText(noFocus?: boolean): void;
|
|
1945
|
+
_updateDropDown(): void;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Specifies actions that trigger showing and hiding {@link Popup} controls.
|
|
1949
|
+
*
|
|
1950
|
+
* The {@link PopupTrigger} actions are flags that may be combined using binary
|
|
1951
|
+
* operators. For example:
|
|
1952
|
+
*
|
|
1953
|
+
* ```typescript
|
|
1954
|
+
* let popup = new Popup('#popup', {
|
|
1955
|
+
*
|
|
1956
|
+
* // set popup owner to 'show' button
|
|
1957
|
+
* owner: '#btn-show'
|
|
1958
|
+
*
|
|
1959
|
+
* // show the popup when clicking the button
|
|
1960
|
+
* showTrigger: PopupTrigger.ClickOwner,
|
|
1961
|
+
*
|
|
1962
|
+
* // hide the popup when clicking the button or when the mouse leaves the popup
|
|
1963
|
+
* hideTrigger: PopupTrigger.ClickOwner | PopupTrigger.LeavePopup,
|
|
1964
|
+
* });
|
|
1965
|
+
* ```
|
|
1966
|
+
*/
|
|
1967
|
+
export declare enum PopupTrigger {
|
|
1968
|
+
/** No triggers; popups must be shown and hidden using code. */
|
|
1969
|
+
None = 0,
|
|
1970
|
+
/** When the user clicks the owner element. */
|
|
1971
|
+
ClickOwner = 1,
|
|
1972
|
+
/** When the user clicks the popup. */
|
|
1973
|
+
ClickPopup = 2,
|
|
1974
|
+
/** When the user clicks the owner element or the popup. */
|
|
1975
|
+
Click = 3,
|
|
1976
|
+
/** When the owner element loses focus. */
|
|
1977
|
+
BlurOwner = 4,
|
|
1978
|
+
/** When the popup loses focus. */
|
|
1979
|
+
BlurPopup = 8,
|
|
1980
|
+
/** When the owner element or the popup lose focus. */
|
|
1981
|
+
Blur = 12,
|
|
1982
|
+
/** When the owner element or the popup are clicked or lose focus. */
|
|
1983
|
+
ClickOrBlur = 15,
|
|
1984
|
+
/** When the mouse button is pressed over the owner element. */
|
|
1985
|
+
DownOwner = 16,
|
|
1986
|
+
/** When the mouse button is pressed over the popup. */
|
|
1987
|
+
DownPopup = 32,
|
|
1988
|
+
/** When the mouse button is pressed over the owner element or the popup. */
|
|
1989
|
+
Down = 48,
|
|
1990
|
+
/** When the mouse enters the owner element. */
|
|
1991
|
+
EnterOwner = 64,
|
|
1992
|
+
/** When the mouse enters the popup. */
|
|
1993
|
+
EnterPopup = 128,
|
|
1994
|
+
/** When the mouse enters the owner element or the popup. */
|
|
1995
|
+
Enter = 192,
|
|
1996
|
+
/** When the mouse leaves the owner element. */
|
|
1997
|
+
LeaveOwner = 256,
|
|
1998
|
+
/** When the mouse leaves the popup. */
|
|
1999
|
+
LeavePopup = 512,
|
|
2000
|
+
/** When the mouse leaves the owner element or the popup. */
|
|
2001
|
+
Leave = 768
|
|
2002
|
+
}
|
|
2003
|
+
declare enum _Edges {
|
|
2004
|
+
None = 0,
|
|
2005
|
+
Left = 1,
|
|
2006
|
+
Top = 2,
|
|
2007
|
+
Right = 4,
|
|
2008
|
+
Bottom = 8,
|
|
2009
|
+
LeftTop = 3,
|
|
2010
|
+
RightTop = 6,
|
|
2011
|
+
RightBottom = 12,
|
|
2012
|
+
LeftBottom = 9
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Class that shows an element as a popup.
|
|
2016
|
+
*
|
|
2017
|
+
* Popups may be have {@link owner} elements, in which case they behave
|
|
2018
|
+
* as rich tooltips that may be shown or hidden based on actions
|
|
2019
|
+
* specified by the {@link Popup.showTrigger} and {@link Popup.hideTrigger}
|
|
2020
|
+
* properties.
|
|
2021
|
+
*
|
|
2022
|
+
* Popups with no owner elements behave like dialogs. They are centered
|
|
2023
|
+
* on the screen and displayed using the {@link show} method.
|
|
2024
|
+
*
|
|
2025
|
+
* To close a {@link Popup}, call the {@link Popup.hide} method.
|
|
2026
|
+
*
|
|
2027
|
+
* Alternatively, any clickable elements within a {@link Popup} that have
|
|
2028
|
+
* the classes starting with the 'wj-hide' string will hide the {@link Popup}
|
|
2029
|
+
* when clicked and will set the {@link Popup.dialogResult} property to the
|
|
2030
|
+
* class name so the caller may take appropriate action.
|
|
2031
|
+
*
|
|
2032
|
+
* For example, the {@link Popup} below will be hidden when the user presses
|
|
2033
|
+
* the OK or Cancel buttons, and the {@link Popup.dialogResult} property will
|
|
2034
|
+
* be set to either 'wj-hide-cancel' or 'wj-hide-ok':
|
|
2035
|
+
*
|
|
2036
|
+
* ```html
|
|
2037
|
+
* <button id="btn-show-popup">
|
|
2038
|
+
* Show Popup
|
|
2039
|
+
* </button>
|
|
2040
|
+
* <div id="thePopup" class="wj-dialog">
|
|
2041
|
+
* <div class="wj-dialog-header">
|
|
2042
|
+
* Welcome to the popup.
|
|
2043
|
+
* </div>
|
|
2044
|
+
* <div class="wj-dialog-body">
|
|
2045
|
+
* Click one of the buttons below to close the popup.
|
|
2046
|
+
* </div>
|
|
2047
|
+
* <div class="wj-dialog-footer">
|
|
2048
|
+
* <button class="wj-hide-ok">
|
|
2049
|
+
* OK
|
|
2050
|
+
* </button>
|
|
2051
|
+
* <button class="wj-hide-cancel">
|
|
2052
|
+
* Cancel
|
|
2053
|
+
* </button>
|
|
2054
|
+
* </div>
|
|
2055
|
+
* </div>
|
|
2056
|
+
* ```
|
|
2057
|
+
* ```typescript
|
|
2058
|
+
* new Popup('#thePopup', {
|
|
2059
|
+
* owner: '#btn-show-popup',
|
|
2060
|
+
* hidden: s => console.log('popup closed with result', s.dialogResult)
|
|
2061
|
+
* });
|
|
2062
|
+
* ```
|
|
2063
|
+
*
|
|
2064
|
+
* The example below shows how you can use the {@link Popup} control to implement
|
|
2065
|
+
* popups attached to owner elements and dialogs:
|
|
2066
|
+
*
|
|
2067
|
+
* {@sample Input/Popup/PopupsWithOwnerElements/purejs}
|
|
2068
|
+
*/
|
|
2069
|
+
export declare class Popup extends Control {
|
|
2070
|
+
static _DRAG_THRESHOLD: number;
|
|
2071
|
+
static _SZ_EDGE: number;
|
|
2072
|
+
static _SZ_MIN: number;
|
|
2073
|
+
static _evtHover: MouseEvent;
|
|
2074
|
+
protected _owner: HTMLElement;
|
|
2075
|
+
protected _modal: boolean;
|
|
2076
|
+
protected _position: PopupPosition;
|
|
2077
|
+
protected _showTrigger: PopupTrigger;
|
|
2078
|
+
protected _hideTrigger: PopupTrigger;
|
|
2079
|
+
protected _hideAnim: any[];
|
|
2080
|
+
protected _fadeIn: boolean;
|
|
2081
|
+
protected _fadeOut: boolean;
|
|
2082
|
+
protected _removeOnHide: boolean;
|
|
2083
|
+
protected _draggable: boolean;
|
|
2084
|
+
protected _resizable: boolean;
|
|
2085
|
+
protected _dragged: boolean;
|
|
2086
|
+
protected _resized: boolean;
|
|
2087
|
+
protected _ignoreClick: boolean;
|
|
2088
|
+
protected _bkDrop: HTMLDivElement;
|
|
2089
|
+
protected _result: string;
|
|
2090
|
+
protected _resultEnter: string;
|
|
2091
|
+
protected _resultSubmit: string;
|
|
2092
|
+
protected _callback: Function;
|
|
2093
|
+
protected _refreshing: boolean;
|
|
2094
|
+
protected _visible: boolean;
|
|
2095
|
+
protected _wasVisible: boolean;
|
|
2096
|
+
protected _composing: boolean;
|
|
2097
|
+
protected _ownerClickBnd: any;
|
|
2098
|
+
protected _ownerDownBnd: any;
|
|
2099
|
+
protected _ownerBlurBnd: any;
|
|
2100
|
+
protected _ownerEnterBnd: any;
|
|
2101
|
+
protected _ownerLeaveBnd: any;
|
|
2102
|
+
protected _toShow: any;
|
|
2103
|
+
protected _toHideLeave: any;
|
|
2104
|
+
protected _toHideBlur: any;
|
|
2105
|
+
protected _edges: _Edges;
|
|
2106
|
+
protected _mousedownEvt: MouseEvent;
|
|
2107
|
+
protected _rcBounds: ClientRect;
|
|
2108
|
+
protected _mousedownBnd: any;
|
|
2109
|
+
protected _mousemoveBnd: any;
|
|
2110
|
+
protected _mousedragBnd: any;
|
|
2111
|
+
protected _mouseupBnd: any;
|
|
2112
|
+
protected _hideBnd: any;
|
|
2113
|
+
protected _oldFocus: HTMLElement;
|
|
2114
|
+
protected _myFocus: HTMLElement;
|
|
2115
|
+
protected _lastShow: number;
|
|
2116
|
+
/**
|
|
2117
|
+
* Initializes a new instance of the {@link Popup} class.
|
|
2118
|
+
*
|
|
2119
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
2120
|
+
* @param options JavaScript object containing initialization data for the control.
|
|
2121
|
+
*/
|
|
2122
|
+
constructor(element: any, options?: any);
|
|
2123
|
+
/**
|
|
2124
|
+
* Gets or sets the element that owns this {@link Popup}.
|
|
2125
|
+
*
|
|
2126
|
+
* If the {@link owner} is null, the {@link Popup} behaves like a dialog.
|
|
2127
|
+
* It is centered on the screen and must be shown using the
|
|
2128
|
+
* {@link show} method.
|
|
2129
|
+
*/
|
|
2130
|
+
owner: HTMLElement | null;
|
|
2131
|
+
/**
|
|
2132
|
+
* Gets or sets the {@link PopupPosition} where the popup should be
|
|
2133
|
+
* displayed with respect to the owner element.
|
|
2134
|
+
*
|
|
2135
|
+
* The default value for this property is **PopupPosition.BelowLeft**.
|
|
2136
|
+
*/
|
|
2137
|
+
position: PopupPosition;
|
|
2138
|
+
/**
|
|
2139
|
+
* Gets or sets the HTML element contained in this {@link Popup}.
|
|
2140
|
+
*/
|
|
2141
|
+
content: HTMLElement;
|
|
2142
|
+
/**
|
|
2143
|
+
* Gets or sets the actions that show the {@link Popup}.
|
|
2144
|
+
*
|
|
2145
|
+
* The default value for this property is **PopupTrigger.ClickOwner**,
|
|
2146
|
+
* which causes the popup to appear when the user clicks the owner element.
|
|
2147
|
+
*
|
|
2148
|
+
* If you set the {@link showTrigger} property to {@link PopupTrigger.None},
|
|
2149
|
+
* the popup will be shown only when the {@link show} method is called.
|
|
2150
|
+
*/
|
|
2151
|
+
showTrigger: PopupTrigger;
|
|
2152
|
+
/**
|
|
2153
|
+
* Gets or sets the actions that hide the {@link Popup}.
|
|
2154
|
+
*
|
|
2155
|
+
* The default value for this property is **PopupTrigger.Blur**,
|
|
2156
|
+
* which causes the popup to hide when it loses focus.
|
|
2157
|
+
*
|
|
2158
|
+
* If you set the {@link hideTrigger} property to {@link PopupTrigger.Click},
|
|
2159
|
+
* the popup will be hidden when the user clicks the popup or its owner element.
|
|
2160
|
+
*
|
|
2161
|
+
* If you set the {@link hideTrigger} property to {@link PopupTrigger.Leave}, the
|
|
2162
|
+
* popup will be hidden a short interval after the mouse leaves the popup or its
|
|
2163
|
+
* owner element, unless the user moves the mouse back into the popup before the
|
|
2164
|
+
* interval elapses.
|
|
2165
|
+
*
|
|
2166
|
+
* If you set the {@link hideTrigger} property to {@link PopupTrigger.None}, the
|
|
2167
|
+
* popup will be hidden only when the {@link hide} method is called
|
|
2168
|
+
* (or when the user presses the Escape key).
|
|
2169
|
+
*/
|
|
2170
|
+
hideTrigger: PopupTrigger;
|
|
2171
|
+
/**
|
|
2172
|
+
* Gets or sets a value that determines whether the {@link Popup} should
|
|
2173
|
+
* use a fade-in animation when it is shown.
|
|
2174
|
+
*
|
|
2175
|
+
* The default value for this property is **true**.
|
|
2176
|
+
*/
|
|
2177
|
+
fadeIn: boolean;
|
|
2178
|
+
/**
|
|
2179
|
+
* Gets or sets a value that determines whether the {@link Popup} should
|
|
2180
|
+
* use a fade-out animation when it is hidden.
|
|
2181
|
+
*
|
|
2182
|
+
* The default value for this property is **true**.
|
|
2183
|
+
*/
|
|
2184
|
+
fadeOut: boolean;
|
|
2185
|
+
/**
|
|
2186
|
+
* Gets or sets a value that determines whether the {@link Popup} host
|
|
2187
|
+
* element should be hidden and removed from the DOM when the {@link Popup}
|
|
2188
|
+
* is hidden, as opposed to simply being hidden.
|
|
2189
|
+
*
|
|
2190
|
+
* The default value for this property is **true**.
|
|
2191
|
+
*
|
|
2192
|
+
* Note that {@link removeOnHide} removes the {@link Popup} element from
|
|
2193
|
+
* the DOM when the {@link Popup} is hidden, but not when it is created.
|
|
2194
|
+
*
|
|
2195
|
+
* If the {@link Popup} contains elements with access keys (**accesskey**
|
|
2196
|
+
* attributes) that should not be activated when the {@link Popup} is not
|
|
2197
|
+
* visible, you should remove the {@link Popup} from the DOM after it is
|
|
2198
|
+
* created. For example:
|
|
2199
|
+
* ```typesript
|
|
2200
|
+
* import { Popup} from '@grapecity/wijmo.input';
|
|
2201
|
+
* import { removeChild } from '@grapecity/wijmo';
|
|
2202
|
+
* // create the Popup
|
|
2203
|
+
* let popup = new Popup('#popup', {
|
|
2204
|
+
* owner: '#show'
|
|
2205
|
+
* });
|
|
2206
|
+
*
|
|
2207
|
+
* // add event listeners to accesskey elements (accesskey element is in the DOM)
|
|
2208
|
+
* document.getElementById('alert').addEventListener('click', e => alert('hi'));
|
|
2209
|
+
*
|
|
2210
|
+
* // remove Popup (and accesskey element) from DOM
|
|
2211
|
+
* // so accesskey will not work until the Popup is visible
|
|
2212
|
+
* removeChild(popup.hostElement);
|
|
2213
|
+
* ```
|
|
2214
|
+
*/
|
|
2215
|
+
removeOnHide: boolean;
|
|
2216
|
+
/**
|
|
2217
|
+
* Gets or sets a value that determines whether the {@link Popup} should
|
|
2218
|
+
* be displayed as a modal dialog.
|
|
2219
|
+
*
|
|
2220
|
+
* Modal dialogs show a dark backdrop that makes the {@link Popup} stand
|
|
2221
|
+
* out from other content on the page.
|
|
2222
|
+
*
|
|
2223
|
+
* If you want to make a dialog truly modal, also set the {@link Popup.hideTrigger}
|
|
2224
|
+
* property to {@link PopupTrigger.None}, so users won't be able to click the
|
|
2225
|
+
* backdrop to dismiss the dialog. In this case, the dialog will close only
|
|
2226
|
+
* when the {@link hide} method is called (or when the user presses the Escape key).
|
|
2227
|
+
*
|
|
2228
|
+
* The default value for this property is **false**.
|
|
2229
|
+
*/
|
|
2230
|
+
modal: boolean;
|
|
2231
|
+
/**
|
|
2232
|
+
* Gets or sets a value that determines whether the popup can be dragged
|
|
2233
|
+
* with the mouse by its header.
|
|
2234
|
+
*
|
|
2235
|
+
* The header is identified by the '.wj-dialog-header' or '.modal-header'
|
|
2236
|
+
* CSS selectors.
|
|
2237
|
+
* If the dialog does not contain any elements with the 'wj-dialog-header'
|
|
2238
|
+
* or 'modal-header' classes, users will not be able to drag the popup.
|
|
2239
|
+
*
|
|
2240
|
+
* The default value for this property is **false**.
|
|
2241
|
+
*/
|
|
2242
|
+
isDraggable: boolean;
|
|
2243
|
+
/**
|
|
2244
|
+
* Gets or sets a value that determines whether the popup can be resized
|
|
2245
|
+
* by dragging its edges with the mouse.
|
|
2246
|
+
*
|
|
2247
|
+
* You can limit the size of the popup by setting the host element's
|
|
2248
|
+
* max-width, min-width, max-height, and min-height CSS properties.
|
|
2249
|
+
*
|
|
2250
|
+
* The default value for this property is **false**.
|
|
2251
|
+
*/
|
|
2252
|
+
isResizable: boolean;
|
|
2253
|
+
/**
|
|
2254
|
+
* Gets or sets a value used as a return value for the {@link Popup} after
|
|
2255
|
+
* it is hidden.
|
|
2256
|
+
*
|
|
2257
|
+
* This property is set to **null** when the {@link Popup} is displayed.
|
|
2258
|
+
*
|
|
2259
|
+
* It can be set in response to button click events or in the call to the
|
|
2260
|
+
* {@link hide} method to provide a result value to callers.
|
|
2261
|
+
*/
|
|
2262
|
+
dialogResult: any;
|
|
2263
|
+
/**
|
|
2264
|
+
* Gets or sets a value to be used as a {@link dialogResult} when the user presses
|
|
2265
|
+
* the Enter key while the {@link Popup} is visible.
|
|
2266
|
+
*
|
|
2267
|
+
* The default value for this property is **null**.
|
|
2268
|
+
*
|
|
2269
|
+
* If the user presses Enter and the {@link dialogResultEnter} property is not
|
|
2270
|
+
* **null**, the popup checks whether all its child elements are in a valid state.
|
|
2271
|
+
* If so, the popup is closed and the {@link dialogResult} property is set to
|
|
2272
|
+
* the value of the {@link dialogResultEnter} property.
|
|
2273
|
+
*/
|
|
2274
|
+
dialogResultEnter: any;
|
|
2275
|
+
/**
|
|
2276
|
+
* Gets or sets a string to be used as a {@link dialogResult} when the dialog
|
|
2277
|
+
* is hosted by a form element and the user submits the form.
|
|
2278
|
+
*
|
|
2279
|
+
* The default value for this property is **null**.
|
|
2280
|
+
*
|
|
2281
|
+
* If you set this property to a non-empty string, the control will handle
|
|
2282
|
+
* the form's submit event, validating the fields and closing the form with
|
|
2283
|
+
* a {@link dialogResult} set to the specified value. For example:
|
|
2284
|
+
*
|
|
2285
|
+
* ```typescript
|
|
2286
|
+
* let dlg = new Popup('#theForm', {
|
|
2287
|
+
* dialogResultSubmit: 'ok'
|
|
2288
|
+
* });
|
|
2289
|
+
* dlg.show(true, () => {
|
|
2290
|
+
* if (dlg.dialogResult == dlg.dialogResultSubmit) {
|
|
2291
|
+
* // form is valid, handle results here
|
|
2292
|
+
* }
|
|
2293
|
+
* });
|
|
2294
|
+
* ```
|
|
2295
|
+
*
|
|
2296
|
+
* See also the {@link dialogResultEnter} property, which can be used
|
|
2297
|
+
* when the {@link Popup} is hosted in elements that are not forms.
|
|
2298
|
+
*/
|
|
2299
|
+
dialogResultSubmit: string;
|
|
2300
|
+
/**
|
|
2301
|
+
* Gets a value that determines whether the {@link Popup} is currently visible.
|
|
2302
|
+
*/
|
|
2303
|
+
readonly isVisible: boolean;
|
|
2304
|
+
/**
|
|
2305
|
+
* Shows the {@link Popup}.
|
|
2306
|
+
*
|
|
2307
|
+
* @param modal Whether to show the popup as a modal dialog. If provided, this
|
|
2308
|
+
* sets the value of the {@link modal} property.
|
|
2309
|
+
* @param handleResult Callback invoked when the popup is hidden. If provided,
|
|
2310
|
+
* this should be a function that receives the popup as a parameter.
|
|
2311
|
+
*
|
|
2312
|
+
* The **handleResult** callback allows callers to handle the result of modal
|
|
2313
|
+
* dialogs without attaching handlers to the {@link hidden} event. For example,
|
|
2314
|
+
* the code below shows a dialog used to edit the current item in a
|
|
2315
|
+
* {@link CollectionView}. The edits are committed or canceled depending on the
|
|
2316
|
+
* {@link Popup.dialogResult} value. For example:
|
|
2317
|
+
*
|
|
2318
|
+
* ```typescript
|
|
2319
|
+
* function editCurrentItem(popupEditor: Popup, view: CollectionView) {
|
|
2320
|
+
* view.editItem(view.currentItem);
|
|
2321
|
+
* popupEditor.show(true, (e: Popup) => {
|
|
2322
|
+
* if (e.dialogResult == 'wj-hide-ok') {
|
|
2323
|
+
* view.commitEdit();
|
|
2324
|
+
* } else {
|
|
2325
|
+
* view.cancelEdit();
|
|
2326
|
+
* }
|
|
2327
|
+
* });
|
|
2328
|
+
* }
|
|
2329
|
+
* ```
|
|
2330
|
+
*/
|
|
2331
|
+
show(modal?: boolean, handleResult?: Function): void;
|
|
2332
|
+
/**
|
|
2333
|
+
* Hides the {@link Popup}.
|
|
2334
|
+
*
|
|
2335
|
+
* @param dialogResult Optional value assigned to the {@link dialogResult} property
|
|
2336
|
+
* before closing the {@link Popup}.
|
|
2337
|
+
*/
|
|
2338
|
+
hide(dialogResult?: any): void;
|
|
2339
|
+
/**
|
|
2340
|
+
* Occurs before the {@link Popup} is shown.
|
|
2341
|
+
*/
|
|
2342
|
+
readonly showing: Event<Popup, CancelEventArgs>;
|
|
2343
|
+
/**
|
|
2344
|
+
* Raises the {@link showing} event.
|
|
2345
|
+
*
|
|
2346
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
2347
|
+
* @return True if the event was not canceled.
|
|
2348
|
+
*/
|
|
2349
|
+
onShowing(e: CancelEventArgs): boolean;
|
|
2350
|
+
/**
|
|
2351
|
+
* Occurs after the {@link Popup} has been shown.
|
|
2352
|
+
*/
|
|
2353
|
+
readonly shown: Event<Popup, EventArgs>;
|
|
2354
|
+
/**
|
|
2355
|
+
* Raises the {@link shown} event.
|
|
2356
|
+
*/
|
|
2357
|
+
onShown(e?: EventArgs): void;
|
|
2358
|
+
/**
|
|
2359
|
+
* Occurs before the {@link Popup} is hidden.
|
|
2360
|
+
*/
|
|
2361
|
+
readonly hiding: Event<Popup, CancelEventArgs>;
|
|
2362
|
+
/**
|
|
2363
|
+
* Raises the {@link hiding} event.
|
|
2364
|
+
*
|
|
2365
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
2366
|
+
* @return True if the event was not canceled.
|
|
2367
|
+
*/
|
|
2368
|
+
onHiding(e: CancelEventArgs): boolean;
|
|
2369
|
+
/**
|
|
2370
|
+
* Occurs after the {@link Popup} has been hidden.
|
|
2371
|
+
*/
|
|
2372
|
+
readonly hidden: Event<Popup, EventArgs>;
|
|
2373
|
+
/**
|
|
2374
|
+
* Raises the {@link hidden} event.
|
|
2375
|
+
*/
|
|
2376
|
+
onHidden(e?: EventArgs): void;
|
|
2377
|
+
/**
|
|
2378
|
+
* Occurs when the {@link Popup} is about to be resized.
|
|
2379
|
+
*
|
|
2380
|
+
* See also the {@link isResizable} property.
|
|
2381
|
+
*/
|
|
2382
|
+
readonly resizing: Event<Popup, CancelEventArgs>;
|
|
2383
|
+
/**
|
|
2384
|
+
* Raises the {@link resizing} event.
|
|
2385
|
+
*
|
|
2386
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
2387
|
+
* @return True if the event was not canceled.
|
|
2388
|
+
*/
|
|
2389
|
+
onResizing(e: CancelEventArgs): boolean;
|
|
2390
|
+
/**
|
|
2391
|
+
* Occurs after the {@link Popup} has been resized.
|
|
2392
|
+
*
|
|
2393
|
+
* See also the {@link isResizable} property.
|
|
2394
|
+
*/
|
|
2395
|
+
readonly resized: Event<Popup, EventArgs>;
|
|
2396
|
+
/**
|
|
2397
|
+
* Raises the {@link resized} event.
|
|
2398
|
+
*/
|
|
2399
|
+
onResized(e?: EventArgs): void;
|
|
2400
|
+
/**
|
|
2401
|
+
* Occurs when the {@link Popup} is about to be dragged.
|
|
2402
|
+
*
|
|
2403
|
+
* See also the {@link isDraggable} property.
|
|
2404
|
+
*/
|
|
2405
|
+
readonly dragging: Event<Popup, CancelEventArgs>;
|
|
2406
|
+
/**
|
|
2407
|
+
* Raises the {@link dragging} event.
|
|
2408
|
+
*
|
|
2409
|
+
* @param e {@link CancelEventArgs} that contains the event data.
|
|
2410
|
+
* @return True if the event was not canceled.
|
|
2411
|
+
*/
|
|
2412
|
+
onDragging(e: CancelEventArgs): boolean;
|
|
2413
|
+
/**
|
|
2414
|
+
* Occurs after the {@link Popup} has been dragged.
|
|
2415
|
+
*
|
|
2416
|
+
* See also the {@link isDraggable} property.
|
|
2417
|
+
*/
|
|
2418
|
+
readonly dragged: Event<Popup, EventArgs>;
|
|
2419
|
+
/**
|
|
2420
|
+
* Raises the {@link dragged} event.
|
|
2421
|
+
*/
|
|
2422
|
+
onDragged(e?: EventArgs): void;
|
|
2423
|
+
/**
|
|
2424
|
+
* Occurs while the user resizes the {@link Popup}, between the
|
|
2425
|
+
* {@link resizing} and {@link resized} events.
|
|
2426
|
+
*
|
|
2427
|
+
* When the user drags the {@link Popup}, it raises the following events:
|
|
2428
|
+
* - {@link resizing} (once, cancelable)
|
|
2429
|
+
* - {@link sizeChanging} (several times while the user moves the mouse, cancelable)
|
|
2430
|
+
* - {@link sizeChanged} (several times while the user moves the mouse)
|
|
2431
|
+
* - {@link resized} (once, at the end of the resizing process)
|
|
2432
|
+
*
|
|
2433
|
+
* See also the {@link isResizable} property.
|
|
2434
|
+
*/
|
|
2435
|
+
readonly sizeChanging: Event<Popup, PopupBoundsChangingEventArgs>;
|
|
2436
|
+
/**
|
|
2437
|
+
* Raises the {@link sizeChanging} event.
|
|
2438
|
+
*
|
|
2439
|
+
* @param e {@link PopupBoundsChangingEventArgs} that contains the event data.
|
|
2440
|
+
* @return True if the event was not canceled.
|
|
2441
|
+
*/
|
|
2442
|
+
onSizeChanging(e: PopupBoundsChangingEventArgs): boolean;
|
|
2443
|
+
/**
|
|
2444
|
+
* Occurs while the user resizes the {@link Popup}, between the
|
|
2445
|
+
* {@link resizing} and {@link resized} events.
|
|
2446
|
+
*
|
|
2447
|
+
* When the user resizes the {@link Popup}, it raises the following events:
|
|
2448
|
+
* - {@link resizing} (once, cancelable)
|
|
2449
|
+
* - {@link sizeChanging} (several times while the user moves the mouse, cancelable)
|
|
2450
|
+
* - {@link sizeChanged} (several times while the user moves the mouse)
|
|
2451
|
+
* - {@link resized} (once, at the end of the resizing process)
|
|
2452
|
+
*
|
|
2453
|
+
* See also the {@link isResizable} property.
|
|
2454
|
+
*/
|
|
2455
|
+
readonly sizeChanged: Event<Popup, EventArgs>;
|
|
2456
|
+
/**
|
|
2457
|
+
*
|
|
2458
|
+
* @param e Raises the {@link sizeChanged} event.
|
|
2459
|
+
*/
|
|
2460
|
+
onSizeChanged(e?: EventArgs): void;
|
|
2461
|
+
/**
|
|
2462
|
+
* Occurs while the user moves the {@link Popup}, between the
|
|
2463
|
+
* {@link dragging} and {@link dragged} events.
|
|
2464
|
+
*
|
|
2465
|
+
* When the user drags the {@link Popup}, it raises the following events:
|
|
2466
|
+
* - {@link dragging} (once, cancelable)
|
|
2467
|
+
* - {@link positionChanging} (several times while the user moves the mouse, cancelable)
|
|
2468
|
+
* - {@link positionChanged} (several times while the user moves the mouse)
|
|
2469
|
+
* - {@link dragged} (once, at the end of the resizing process)
|
|
2470
|
+
*
|
|
2471
|
+
* See also the {@link isDraggable} property.
|
|
2472
|
+
*
|
|
2473
|
+
* You can use the {@link positionChanging} event to cancel or to modify
|
|
2474
|
+
* the {@link Popup} bounds as the user drags the control.
|
|
2475
|
+
*
|
|
2476
|
+
* For example, the code keeps the popup in full view, preventing users
|
|
2477
|
+
* from dragging parts of the {@link Popup} off the screen:
|
|
2478
|
+
*
|
|
2479
|
+
* ```typescript
|
|
2480
|
+
* new Popup('#thePopup', {
|
|
2481
|
+
* isDraggable: true,
|
|
2482
|
+
* isResizable: true,
|
|
2483
|
+
* hideTrigger: 'None',
|
|
2484
|
+
*
|
|
2485
|
+
* // keep popup fully within the browser window
|
|
2486
|
+
* positionChanging: (s: Popup, e: PopupBoundsChangingEventArgs) => {
|
|
2487
|
+
* let bnd = e.bounds;
|
|
2488
|
+
* bnd.left = Math.max(Math.min(bnd.left, innerWidth + scrollX - bnd.width), scrollX);
|
|
2489
|
+
* bnd.top = Math.max(Math.min(bnd.top, innerHeight + scrollY - bnd.height), scrollY);
|
|
2490
|
+
* }
|
|
2491
|
+
* });
|
|
2492
|
+
* ```
|
|
2493
|
+
*/
|
|
2494
|
+
readonly positionChanging: Event<Popup, PopupBoundsChangingEventArgs>;
|
|
2495
|
+
/**
|
|
2496
|
+
* Raises the {@link positionChanging} event.
|
|
2497
|
+
*
|
|
2498
|
+
* @param e {@link PopupBoundsChangingEventArgs} that contains the event data.
|
|
2499
|
+
* @return True if the event was not canceled.
|
|
2500
|
+
*/
|
|
2501
|
+
onPositionChanging(e: PopupBoundsChangingEventArgs): boolean;
|
|
2502
|
+
/**
|
|
2503
|
+
* Occurs while the user moves the {@link Popup}, between the
|
|
2504
|
+
* {@link dragging} and {@link dragged} events.
|
|
2505
|
+
*
|
|
2506
|
+
* When the user drags the {@link Popup}, it raises the following events:
|
|
2507
|
+
* - {@link dragging} (once, cancelable)
|
|
2508
|
+
* - {@link positionChanging} (several times while the user moves the mouse)
|
|
2509
|
+
* - {@link positionChanged} (several times while the user moves the mouse)
|
|
2510
|
+
* - {@link dragged} (once, at the end of the resizing process)
|
|
2511
|
+
*
|
|
2512
|
+
* See also the {@link isDraggable} property.
|
|
2513
|
+
*/
|
|
2514
|
+
readonly positionChanged: Event<Popup, EventArgs>;
|
|
2515
|
+
/**
|
|
2516
|
+
* Raises the {@link positionChanged} event.
|
|
2517
|
+
*/
|
|
2518
|
+
onPositionChanged(e?: EventArgs): void;
|
|
2519
|
+
onLostFocus(e?: EventArgs): void;
|
|
2520
|
+
dispose(): void;
|
|
2521
|
+
refresh(fullUpdate?: boolean): void;
|
|
2522
|
+
_clearTimeouts(): void;
|
|
2523
|
+
protected _handleDragResize(on: boolean): void;
|
|
2524
|
+
protected _mousemove(e: MouseEvent): void;
|
|
2525
|
+
protected _mousedown(e: any): void;
|
|
2526
|
+
protected _mouseup(): void;
|
|
2527
|
+
protected _mousedrag(e: any): void;
|
|
2528
|
+
protected _getEdges(host: HTMLElement, e: MouseEvent): _Edges;
|
|
2529
|
+
protected _ownerClick(e: MouseEvent): void;
|
|
2530
|
+
protected _ownerDown(e: MouseEvent): void;
|
|
2531
|
+
protected _ownerBlur(e: UIEvent): void;
|
|
2532
|
+
protected _ownerEnter(e: MouseEvent): void;
|
|
2533
|
+
protected _ownerLeave(e: MouseEvent): void;
|
|
2534
|
+
protected _toggle(e: UIEvent, trigger: PopupTrigger): void;
|
|
2535
|
+
private _getHeaderElement;
|
|
2536
|
+
private _getClosestHeader;
|
|
2537
|
+
private _showBackdrop;
|
|
2538
|
+
protected _validateAndHide(result: any): void;
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Provides arguments for the {@link Popup} control's {@link sizeChanging} and
|
|
2542
|
+
* {@link positionChanging} events.
|
|
2543
|
+
*/
|
|
2544
|
+
export declare class PopupBoundsChangingEventArgs extends CancelEventArgs {
|
|
2545
|
+
_rc: Rect;
|
|
2546
|
+
/**
|
|
2547
|
+
* Initializes a new instance of the {@link PopupBoundsChangingEventArgs} class.
|
|
2548
|
+
*/
|
|
2549
|
+
constructor(bounds: Rect);
|
|
2550
|
+
/**
|
|
2551
|
+
* Gets a {@link Rect} that represents the bounds of the {@link Popup} control.
|
|
2552
|
+
*/
|
|
2553
|
+
readonly bounds: Rect;
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* The {@link InputDate} control allows users to type in dates using any format
|
|
2557
|
+
* supported by the {@link Globalize} class, or to pick dates from a drop-down
|
|
2558
|
+
* that contains a {@link Calendar} control.
|
|
2559
|
+
*
|
|
2560
|
+
* Use the {@link min} and {@link max} properties to restrict the range of
|
|
2561
|
+
* values that the user can enter.
|
|
2562
|
+
*
|
|
2563
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
2564
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a>
|
|
2565
|
+
* topic.
|
|
2566
|
+
*
|
|
2567
|
+
* Use the {@link value} property to get or set the currently selected date.
|
|
2568
|
+
*
|
|
2569
|
+
* Use the {@link autoExpandSelection} property to determine whether the control
|
|
2570
|
+
* should automatically expand the selection to entire words, numbers, or dates
|
|
2571
|
+
* when the user clicks the input element.
|
|
2572
|
+
*
|
|
2573
|
+
* The example below shows how to edit a **Date** value using an {@link InputDate}
|
|
2574
|
+
* control.
|
|
2575
|
+
*
|
|
2576
|
+
* {@sample Input/InputDate/Overview/purejs Example}
|
|
2577
|
+
*
|
|
2578
|
+
* The {@link InputDate} and {@link Calendar} controls have built-in accessibility
|
|
2579
|
+
* support. They support keyboard commands and provide aria-label attributes for
|
|
2580
|
+
* all elements on the calendar. You can improve accessibility by adding your own
|
|
2581
|
+
* application-specific aria-label attributes to the main input element of your
|
|
2582
|
+
* {@link InputDate} controls. For example:
|
|
2583
|
+
* ```typescript
|
|
2584
|
+
* // create an InputDate control and add an aria-label for improved accessibility
|
|
2585
|
+
* let inputDate = new InputDate('#theInputDate');
|
|
2586
|
+
* inputDate.inputElement.setAttribute('aria-label', 'enter trip start date in the format month/day/year')
|
|
2587
|
+
* ```
|
|
2588
|
+
*/
|
|
2589
|
+
export declare class InputDate extends DropDown {
|
|
2590
|
+
private _lbx;
|
|
2591
|
+
private _cal;
|
|
2592
|
+
private _fmt;
|
|
2593
|
+
private _sep;
|
|
2594
|
+
private _msk;
|
|
2595
|
+
private _rngs;
|
|
2596
|
+
private _showCal;
|
|
2597
|
+
private _clsOnSel;
|
|
2598
|
+
private _handleWheel;
|
|
2599
|
+
private _clicked;
|
|
2600
|
+
private _rangeChanged;
|
|
2601
|
+
private _textInitialized;
|
|
2602
|
+
/**
|
|
2603
|
+
* Initializes a new instance of the {@link InputDate} class.
|
|
2604
|
+
*
|
|
2605
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
2606
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
2607
|
+
*/
|
|
2608
|
+
constructor(element: any, options?: any);
|
|
2609
|
+
/**
|
|
2610
|
+
* Gets or sets the currently selected date.
|
|
2611
|
+
*
|
|
2612
|
+
* The default value for this property is the current date.
|
|
2613
|
+
*/
|
|
2614
|
+
value: Date | null;
|
|
2615
|
+
/**
|
|
2616
|
+
* Gets or sets the last selected date in a range selection.
|
|
2617
|
+
*
|
|
2618
|
+
* To enable date range selection, set the {@link selectionMode}
|
|
2619
|
+
* property to **DateSelectionMode.Range**.
|
|
2620
|
+
*
|
|
2621
|
+
* Once you do that, the selection range will be defined by
|
|
2622
|
+
* the {@link value} and {@link rangeEnd} properties.
|
|
2623
|
+
*/
|
|
2624
|
+
rangeEnd: Date;
|
|
2625
|
+
/**
|
|
2626
|
+
* Gets or sets the minimum number of days allowed when editing date ranges.
|
|
2627
|
+
*
|
|
2628
|
+
* This property is used only when the {@link selectionMode} property
|
|
2629
|
+
* is set to {@link DateSelectionMode.Range}.
|
|
2630
|
+
*
|
|
2631
|
+
* The default value for this property is **0**, which means
|
|
2632
|
+
* there is no minimum value for range lengths.
|
|
2633
|
+
*/
|
|
2634
|
+
rangeMin: number;
|
|
2635
|
+
/**
|
|
2636
|
+
* Gets or sets the maximum length allowed when editing date ranges.
|
|
2637
|
+
*
|
|
2638
|
+
* This property is used only when the {@link selectionMode} property
|
|
2639
|
+
* is set to {@link DateSelectionMode.Range}.
|
|
2640
|
+
*
|
|
2641
|
+
* The default value for this property is **0**, which means
|
|
2642
|
+
* there is no maximum value for range lengths.
|
|
2643
|
+
*/
|
|
2644
|
+
rangeMax: number;
|
|
2645
|
+
/**
|
|
2646
|
+
* Gets or sets the text shown on the control.
|
|
2647
|
+
*/
|
|
2648
|
+
text: string;
|
|
2649
|
+
/**
|
|
2650
|
+
* Gets or sets the format used to display the selected date.
|
|
2651
|
+
*
|
|
2652
|
+
* The format string is expressed as a .NET-style
|
|
2653
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings" target="_blank">
|
|
2654
|
+
* Date format string</a>.
|
|
2655
|
+
*
|
|
2656
|
+
* The default value for this property is **'d'**, the culture-dependent
|
|
2657
|
+
* short date pattern (e.g. 6/15/2020 in the US, 15/6/2020 in France, or
|
|
2658
|
+
* 2020/6/15 in Japan).
|
|
2659
|
+
*/
|
|
2660
|
+
format: string;
|
|
2661
|
+
/**
|
|
2662
|
+
* Gets or sets a string used as a separator between the {@link value} and
|
|
2663
|
+
* {@link rangeEnd} values shown by the control.
|
|
2664
|
+
*
|
|
2665
|
+
* This property is used only when the {@link selectionMode} property is set to
|
|
2666
|
+
* {@link DateSelectionMode.Range}.
|
|
2667
|
+
*
|
|
2668
|
+
* The default value for this property is a **' - '**.
|
|
2669
|
+
*/
|
|
2670
|
+
separator: string;
|
|
2671
|
+
/**
|
|
2672
|
+
* Gets or sets a mask to use while editing.
|
|
2673
|
+
*
|
|
2674
|
+
* The mask format is the same one that the {@link wijmo.input.InputMask}
|
|
2675
|
+
* control uses.
|
|
2676
|
+
*
|
|
2677
|
+
* If specified, the mask must be compatible with the value of
|
|
2678
|
+
* the {@link format} and {@link separator} properties.
|
|
2679
|
+
*
|
|
2680
|
+
* For example, the mask '99/99/9999 - 99/99/9999' can be used for
|
|
2681
|
+
* entering date ranges formatted as 'MM/dd/yyyy' with a ' - '
|
|
2682
|
+
* separator.
|
|
2683
|
+
*/
|
|
2684
|
+
mask: string;
|
|
2685
|
+
/**
|
|
2686
|
+
* Gets or sets a value that determines whether the control should
|
|
2687
|
+
* automatically close the drop-down when the user makes a selection.
|
|
2688
|
+
*
|
|
2689
|
+
* The default value for this property is **true**.
|
|
2690
|
+
*/
|
|
2691
|
+
closeOnSelection: boolean;
|
|
2692
|
+
/**
|
|
2693
|
+
* Gets or sets a value that determines whether the user can edit the
|
|
2694
|
+
* current value using the mouse wheel.
|
|
2695
|
+
*
|
|
2696
|
+
* The default value for this property is **true**.
|
|
2697
|
+
*
|
|
2698
|
+
* Setting this property to **false** also disables the custom wheel
|
|
2699
|
+
* handling for the control's drop-down {@link calendar}.
|
|
2700
|
+
*/
|
|
2701
|
+
handleWheel: boolean;
|
|
2702
|
+
/**
|
|
2703
|
+
* Gets or sets an object that defines predefined ranges.
|
|
2704
|
+
*
|
|
2705
|
+
* This property is useful only when the {@link selectionMode}
|
|
2706
|
+
* property is set to {@link DateSelectionMode.Range}.
|
|
2707
|
+
*
|
|
2708
|
+
* Each property in the object represents a predefined range,
|
|
2709
|
+
* identified by the property name and defined by an array with
|
|
2710
|
+
* two dates (range start and end).
|
|
2711
|
+
*
|
|
2712
|
+
* Properties with null values represent custom ranges to be defined
|
|
2713
|
+
* by users by clicking on the calendar.
|
|
2714
|
+
*
|
|
2715
|
+
* For example:
|
|
2716
|
+
* ```typescript
|
|
2717
|
+
* import { DateTime } from '@grapecity/wijmo';
|
|
2718
|
+
* import { InputDate } from '@grapecity/wijmo.input';
|
|
2719
|
+
*
|
|
2720
|
+
* new InputDate(host, {
|
|
2721
|
+
* selectionMode: 'Range',
|
|
2722
|
+
* predefinedRanges: getRanges()
|
|
2723
|
+
* });
|
|
2724
|
+
*
|
|
2725
|
+
* function getRanges() {
|
|
2726
|
+
* let dt = DateTime,
|
|
2727
|
+
* now = new Date();
|
|
2728
|
+
* return {
|
|
2729
|
+
* 'This Week': [dt.weekFirst(now), dt.weekLast(now)],
|
|
2730
|
+
* 'Last Week': [dt.weekFirst(dt.addDays(now, -7)), dt.weekLast(dt.addDays(now, -7))],
|
|
2731
|
+
* 'Next Week': [dt.weekFirst(dt.addDays(now, +7)), dt.weekLast(dt.addDays(now, +7))],
|
|
2732
|
+
*
|
|
2733
|
+
* 'This Month': [dt.monthFirst(now), dt.monthLast(now)],
|
|
2734
|
+
* 'Last Month': [dt.monthFirst(dt.addMonths(now, -1)), dt.monthLast(dt.addMonths(now, -1))],
|
|
2735
|
+
* 'Next Month': [dt.monthFirst(dt.addMonths(now, +1)), dt.monthLast(dt.addMonths(now, +1))],
|
|
2736
|
+
* 'Custom Range': null
|
|
2737
|
+
* };
|
|
2738
|
+
* }
|
|
2739
|
+
* ```
|
|
2740
|
+
*/
|
|
2741
|
+
predefinedRanges: any;
|
|
2742
|
+
/**
|
|
2743
|
+
* Gets or sets a value that determines whether the calendar
|
|
2744
|
+
* should remain visible in the dropdown even when there are
|
|
2745
|
+
* selected predefined ranges.
|
|
2746
|
+
*
|
|
2747
|
+
* The default value for this property is **false**, which
|
|
2748
|
+
* causes the control to hide the calendar if one of the
|
|
2749
|
+
* predefined ranges is selected.
|
|
2750
|
+
*/
|
|
2751
|
+
alwaysShowCalendar: boolean;
|
|
2752
|
+
/**
|
|
2753
|
+
* Gets or sets the earliest date that the user can enter.
|
|
2754
|
+
*
|
|
2755
|
+
* The default value for this property is **null**, which
|
|
2756
|
+
* means no earliest date is defined.
|
|
2757
|
+
*
|
|
2758
|
+
* For details about using the {@link min} and {@link max}
|
|
2759
|
+
* properties, please see the
|
|
2760
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
2761
|
+
*/
|
|
2762
|
+
min: Date | null;
|
|
2763
|
+
/**
|
|
2764
|
+
* Gets or sets the latest date that the user can enter.
|
|
2765
|
+
*
|
|
2766
|
+
* The default value for this property is **null**, which means no latest
|
|
2767
|
+
* date is defined.
|
|
2768
|
+
*
|
|
2769
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
2770
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
2771
|
+
*/
|
|
2772
|
+
max: Date | null;
|
|
2773
|
+
/**
|
|
2774
|
+
* Gets or sets a value that determines whether the calendar buttons
|
|
2775
|
+
* should act as repeat buttons, firing repeatedly as the button
|
|
2776
|
+
* remains pressed.
|
|
2777
|
+
*
|
|
2778
|
+
* The default value for this property is **true**.
|
|
2779
|
+
*/
|
|
2780
|
+
repeatButtons: boolean;
|
|
2781
|
+
/**
|
|
2782
|
+
* Gets or sets a value that determines whether the drop-down
|
|
2783
|
+
* calendar should display a list of years when the user clicks
|
|
2784
|
+
* the header element on the year calendar.
|
|
2785
|
+
*
|
|
2786
|
+
* The default value for this property is **true**.
|
|
2787
|
+
*/
|
|
2788
|
+
showYearPicker: boolean;
|
|
2789
|
+
/**
|
|
2790
|
+
* Gets or sets a value that determines whether the calendar should
|
|
2791
|
+
* display a list of months when the user clicks the header element
|
|
2792
|
+
* on the month calendar.
|
|
2793
|
+
*
|
|
2794
|
+
* The default value for this property is **ShowMonthPicker.First**.
|
|
2795
|
+
*/
|
|
2796
|
+
showMonthPicker: boolean | ShowMonthPicker;
|
|
2797
|
+
/**
|
|
2798
|
+
* Gets or sets a value that determines whether the calendar should
|
|
2799
|
+
* display an area with the current month and navigation buttons.
|
|
2800
|
+
*
|
|
2801
|
+
* The default value for this property is **true**.
|
|
2802
|
+
*/
|
|
2803
|
+
showHeader: boolean;
|
|
2804
|
+
/**
|
|
2805
|
+
* Gets or sets the number of weeks to show on the calendar
|
|
2806
|
+
* before the current month.
|
|
2807
|
+
*
|
|
2808
|
+
* The default value for this property is **zero**.
|
|
2809
|
+
*/
|
|
2810
|
+
weeksBefore: number;
|
|
2811
|
+
/**
|
|
2812
|
+
* Gets or sets the number of weeks to show on the calendar
|
|
2813
|
+
* after the current month.
|
|
2814
|
+
*
|
|
2815
|
+
* The default value for this property is **zero**.
|
|
2816
|
+
*/
|
|
2817
|
+
weeksAfter: number;
|
|
2818
|
+
/**
|
|
2819
|
+
* Gets or sets a value that determines whether users can select
|
|
2820
|
+
* days, ranges, months, or no values at all.
|
|
2821
|
+
*
|
|
2822
|
+
* This property affects the behavior of the drop-down calendar,
|
|
2823
|
+
* but not the format used to display dates.
|
|
2824
|
+
* If you set {@link selectionMode} to 'Month', you should normally
|
|
2825
|
+
* set the {@link format} property to 'MMM yyyy' or some format that
|
|
2826
|
+
* does not include the day. For example:
|
|
2827
|
+
*
|
|
2828
|
+
* ```typescript
|
|
2829
|
+
* import { InputDate } from '@grapecity/wijmo.input';
|
|
2830
|
+
* var inputDate = new InputDate('#el, {
|
|
2831
|
+
* selectionMode: 'Month',
|
|
2832
|
+
* format: 'MMM yyyy'
|
|
2833
|
+
* });
|
|
2834
|
+
* ```
|
|
2835
|
+
*
|
|
2836
|
+
* The default value for this property is **DateSelectionMode.Day**.
|
|
2837
|
+
*/
|
|
2838
|
+
selectionMode: DateSelectionMode;
|
|
2839
|
+
/**
|
|
2840
|
+
* Gets or sets the number of months to display in the drop-down calendar.
|
|
2841
|
+
*
|
|
2842
|
+
* The default value for this property is **1**.
|
|
2843
|
+
*
|
|
2844
|
+
* For more details on this property, please see the {@link Calendar.monthCount}
|
|
2845
|
+
* property.
|
|
2846
|
+
*
|
|
2847
|
+
* When showing multiple months in the same calendar, months will be shown
|
|
2848
|
+
* using a wrapping flex-box container. You may use CSS to limit the number
|
|
2849
|
+
* of months shown per row in the drop-down.
|
|
2850
|
+
*
|
|
2851
|
+
* For example this code creates an {@link InputDate} control with a drop-down
|
|
2852
|
+
* that shows three months per row:
|
|
2853
|
+
* ```typescript
|
|
2854
|
+
* import { InputDate } from '@grapecity/wijmo.input';
|
|
2855
|
+
* let idt = new InputDate(document.createElement('#theInputDate'), {
|
|
2856
|
+
* monthCount: 6,
|
|
2857
|
+
* dropDownCssClass: 'three-months-per-row'
|
|
2858
|
+
* });
|
|
2859
|
+
* ```
|
|
2860
|
+
* ```
|
|
2861
|
+
* .three-months-per-row .wj-calendar-multimonth {
|
|
2862
|
+
* width: calc(3 * 21em);
|
|
2863
|
+
* }
|
|
2864
|
+
* ```
|
|
2865
|
+
*/
|
|
2866
|
+
monthCount: number;
|
|
2867
|
+
/**
|
|
2868
|
+
* Gets a reference to the {@link Calendar} control shown in the drop-down box.
|
|
2869
|
+
*/
|
|
2870
|
+
readonly calendar: Calendar;
|
|
2871
|
+
/**
|
|
2872
|
+
* Gets the HTML input element hosted by the control.
|
|
2873
|
+
*
|
|
2874
|
+
* Use this property in situations where you want to customize the attributes
|
|
2875
|
+
* of the input element.
|
|
2876
|
+
*
|
|
2877
|
+
* For example, the code below uses the {@link inputElement} property to
|
|
2878
|
+
* improve accessibility by adding an aria-label attribute to the control's
|
|
2879
|
+
* input element:
|
|
2880
|
+
* ```typescript
|
|
2881
|
+
* // create an InputDate control and add an aria-label for improved accessibility
|
|
2882
|
+
* let inputDate = new InputDate('#theInputDate');
|
|
2883
|
+
* inputDate.inputElement.setAttribute('aria-label', 'enter trip start date in the format month/day/year')
|
|
2884
|
+
* ```
|
|
2885
|
+
*/
|
|
2886
|
+
readonly inputElement: HTMLInputElement;
|
|
2887
|
+
/**
|
|
2888
|
+
* Gets or sets the "type" attribute of the HTML input element hosted by the control.
|
|
2889
|
+
*
|
|
2890
|
+
* Use this property to change the default setting if the default does not work well
|
|
2891
|
+
* for the current culture, device, or application. In those cases, try changing
|
|
2892
|
+
* the value to "tel" or "text"
|
|
2893
|
+
*/
|
|
2894
|
+
inputType: string;
|
|
2895
|
+
/**
|
|
2896
|
+
* Gets or sets a validator function to determine whether dates are valid for selection.
|
|
2897
|
+
*
|
|
2898
|
+
* If specified, the validator function should take one parameter representing the
|
|
2899
|
+
* date to be tested, and should return false if the date is invalid and should not
|
|
2900
|
+
* be selectable.
|
|
2901
|
+
*
|
|
2902
|
+
* For example, the code below prevents users from selecting dates that fall on
|
|
2903
|
+
* weekends:
|
|
2904
|
+
*
|
|
2905
|
+
* ```typescript
|
|
2906
|
+
* inputDate.itemValidator = date => {
|
|
2907
|
+
* const weekday = date.getDay();
|
|
2908
|
+
* return weekday != 0 && weekday != 6;
|
|
2909
|
+
* }
|
|
2910
|
+
* ```
|
|
2911
|
+
*/
|
|
2912
|
+
itemValidator: IDateValidator;
|
|
2913
|
+
/**
|
|
2914
|
+
* Gets or sets a formatter function to customize dates in the drop-down calendar.
|
|
2915
|
+
*
|
|
2916
|
+
* The formatter function can add any content to any date. It allows
|
|
2917
|
+
* complete customization of the appearance and behavior of the calendar.
|
|
2918
|
+
*
|
|
2919
|
+
* If specified, the function takes two parameters:
|
|
2920
|
+
* <ul>
|
|
2921
|
+
* <li>the date being formatted </li>
|
|
2922
|
+
* <li>the HTML element that represents the date</li>
|
|
2923
|
+
* </ul>
|
|
2924
|
+
*
|
|
2925
|
+
* For example, the code below shows weekends with a yellow background:
|
|
2926
|
+
*
|
|
2927
|
+
* ```typescript
|
|
2928
|
+
* inputDate.itemFormatter = (date, element) => {
|
|
2929
|
+
* const day = date.getDay();
|
|
2930
|
+
* element.style.backgroundColor = day == 0 || day == 6 ? 'yellow' : '';
|
|
2931
|
+
* }
|
|
2932
|
+
* ```
|
|
2933
|
+
*/
|
|
2934
|
+
itemFormatter: IDateFormatter;
|
|
2935
|
+
/**
|
|
2936
|
+
* Occurs when the value of the {@link value} property changes.
|
|
2937
|
+
*/
|
|
2938
|
+
readonly valueChanged: Event<InputDate, EventArgs>;
|
|
2939
|
+
/**
|
|
2940
|
+
* Raises the {@link valueChanged} event.
|
|
2941
|
+
*/
|
|
2942
|
+
onValueChanged(e?: EventArgs): void;
|
|
2943
|
+
/**
|
|
2944
|
+
* Occurs when the value of the {@link rangeEnd} property changes.
|
|
2945
|
+
*/
|
|
2946
|
+
readonly rangeEndChanged: Event<InputDate, EventArgs>;
|
|
2947
|
+
/**
|
|
2948
|
+
* Raises the {@link rangeEndChanged} event.
|
|
2949
|
+
*/
|
|
2950
|
+
onRangeEndChanged(e?: EventArgs): void;
|
|
2951
|
+
/**
|
|
2952
|
+
* Occurs when the value of the {@link rangeEnd} property changes
|
|
2953
|
+
* into a non-null value, indicating a data range has been selected.
|
|
2954
|
+
*/
|
|
2955
|
+
readonly rangeChanged: Event<InputDate, EventArgs>;
|
|
2956
|
+
/**
|
|
2957
|
+
* Raises the {@link rangeChanged} event.
|
|
2958
|
+
*/
|
|
2959
|
+
onRangeChanged(e?: EventArgs): void;
|
|
2960
|
+
refresh(fullUpdate?: boolean): void;
|
|
2961
|
+
onIsDroppedDownChanging(e: CancelEventArgs): boolean;
|
|
2962
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
2963
|
+
_updateDropDown(): void;
|
|
2964
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
2965
|
+
protected _expandSelection(): void;
|
|
2966
|
+
_refreshText(): void;
|
|
2967
|
+
protected _selectAll(): void;
|
|
2968
|
+
_closeOnChange(): void;
|
|
2969
|
+
private _tryFocus;
|
|
2970
|
+
_clamp(value: Date): Date;
|
|
2971
|
+
protected _getText(): string;
|
|
2972
|
+
protected _commitText(noFocus?: boolean): void;
|
|
2973
|
+
protected _fromDateTime(value: Date): Date;
|
|
2974
|
+
private _canChangeValue;
|
|
2975
|
+
protected _isValidDate(value: Date): boolean;
|
|
2976
|
+
private _getRanges;
|
|
2977
|
+
private _updateRangeSelection;
|
|
2978
|
+
protected _copy(key: string, value: any): boolean;
|
|
2979
|
+
}
|
|
2980
|
+
/**
|
|
2981
|
+
* The {@link InputDateRange} control extends the {@link InputDate}
|
|
2982
|
+
* control and sets
|
|
2983
|
+
* the {@link selectionMode} property to {@link DateSelectionMode.Range},
|
|
2984
|
+
* the {@link monthCount} property to **2**, and
|
|
2985
|
+
* the {@link showMonthPicker} property to **ShowMonthPicker.Outside**.
|
|
2986
|
+
*
|
|
2987
|
+
* Use the {@link value} and {@link rangeEnd} properties to access
|
|
2988
|
+
* the currently selected date range.
|
|
2989
|
+
*
|
|
2990
|
+
* Use the {@link predefinedRanges} property to add pre-defined
|
|
2991
|
+
* ranges that users can select from.
|
|
2992
|
+
*/
|
|
2993
|
+
export declare class InputDateRange extends InputDate {
|
|
2994
|
+
/**
|
|
2995
|
+
* Initializes a new instance of the {@link InputDateRange} class.
|
|
2996
|
+
*
|
|
2997
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
2998
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
2999
|
+
*/
|
|
3000
|
+
constructor(element: any, options?: any);
|
|
3001
|
+
selectionMode: DateSelectionMode;
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* The {@link InputColor} control allows users to select colors by typing in
|
|
3005
|
+
* HTML-supported color strings, or to pick colors from a drop-down
|
|
3006
|
+
* that shows a {@link ColorPicker} control.
|
|
3007
|
+
*
|
|
3008
|
+
* Use the {@link value} property to get or set the currently selected color.
|
|
3009
|
+
*
|
|
3010
|
+
* {@sample Input/InputColor/Overview/purejs Example}
|
|
3011
|
+
*/
|
|
3012
|
+
export declare class InputColor extends DropDown {
|
|
3013
|
+
private _ePreview;
|
|
3014
|
+
private _colorPicker;
|
|
3015
|
+
private _value;
|
|
3016
|
+
private _textInitialized;
|
|
3017
|
+
/**
|
|
3018
|
+
* Initializes a new instance of the {@link InputColor} class.
|
|
3019
|
+
*
|
|
3020
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
3021
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3022
|
+
*/
|
|
3023
|
+
constructor(element: any, options?: any);
|
|
3024
|
+
/**
|
|
3025
|
+
* Gets or sets the currently selected color.
|
|
3026
|
+
*
|
|
3027
|
+
* The default value for this property is **"#ffffff"** (white).
|
|
3028
|
+
*
|
|
3029
|
+
* Setting this property to a string that cannot be interpreted as
|
|
3030
|
+
* a color causes the assignment to be ignored. No exceptions are
|
|
3031
|
+
* thrown in this case.
|
|
3032
|
+
*/
|
|
3033
|
+
value: string;
|
|
3034
|
+
/**
|
|
3035
|
+
* Gets or sets the text shown on the control.
|
|
3036
|
+
*/
|
|
3037
|
+
text: string;
|
|
3038
|
+
/**
|
|
3039
|
+
* Gets or sets a value indicating whether the {@link ColorPicker}
|
|
3040
|
+
* allows users to edit the color's alpha channel (transparency).
|
|
3041
|
+
*
|
|
3042
|
+
* The default value for this property is **true**.
|
|
3043
|
+
*/
|
|
3044
|
+
showAlphaChannel: boolean;
|
|
3045
|
+
/**
|
|
3046
|
+
* Gets or sets a value indicating whether the {@link ColorPicker}
|
|
3047
|
+
* shows a string representation of the current color.
|
|
3048
|
+
*
|
|
3049
|
+
* The default value for this property is **false**.
|
|
3050
|
+
*/
|
|
3051
|
+
showColorString: boolean;
|
|
3052
|
+
/**
|
|
3053
|
+
* Gets or sets an array that contains the colors in the palette.
|
|
3054
|
+
*
|
|
3055
|
+
* The palette contains ten colors, represented by an array with
|
|
3056
|
+
* ten strings. The first two colors are usually white and black.
|
|
3057
|
+
*/
|
|
3058
|
+
palette: string[];
|
|
3059
|
+
/**
|
|
3060
|
+
* Gets a reference to the {@link ColorPicker} control shown in the drop-down.
|
|
3061
|
+
*/
|
|
3062
|
+
readonly colorPicker: ColorPicker;
|
|
3063
|
+
/**
|
|
3064
|
+
* Occurs when the value of the {@link value} property changes, either
|
|
3065
|
+
* as a result of user actions or by assignment in code.
|
|
3066
|
+
*/
|
|
3067
|
+
readonly valueChanged: Event<InputColor, EventArgs>;
|
|
3068
|
+
/**
|
|
3069
|
+
* Raises the {@link valueChanged} event.
|
|
3070
|
+
*/
|
|
3071
|
+
onValueChanged(e?: EventArgs): void;
|
|
3072
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
3073
|
+
protected _createDropDown(): void;
|
|
3074
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
3075
|
+
protected _commitText(): void;
|
|
3076
|
+
protected _copy(key: string, value: any): boolean;
|
|
3077
|
+
}
|
|
3078
|
+
/**
|
|
3079
|
+
* The {@link ComboBox} control allows users to pick strings from lists.
|
|
3080
|
+
*
|
|
3081
|
+
* The control automatically completes entries as the user types, and
|
|
3082
|
+
* allows users to show a drop-down list with the items available.
|
|
3083
|
+
*
|
|
3084
|
+
* Use the {@link ComboBox.itemsSource} property to populate the list of
|
|
3085
|
+
* options.
|
|
3086
|
+
* The items may be strings or objects. If the items are objects, use
|
|
3087
|
+
* the {@link ComboBox.displayMemberPath} to define which property of the
|
|
3088
|
+
* items will be displayed in the list and use the {@link ComboBox.selectedValuePath}
|
|
3089
|
+
* property to define which property of the items will be used to set the
|
|
3090
|
+
* combo's {@link ComboBox.selectedValue} property.
|
|
3091
|
+
*
|
|
3092
|
+
* Use the {@link ComboBox.selectedIndex} or the {@link ComboBox.text} properties
|
|
3093
|
+
* to determine which item is currently selected.
|
|
3094
|
+
*
|
|
3095
|
+
* The {@link ComboBox.isRequired} property determines whether the control
|
|
3096
|
+
* must have a non-null value or whether it can be set to null
|
|
3097
|
+
* (by deleting the content of the control). If the value is set to null,
|
|
3098
|
+
* the {@link ComboBox.selectedIndex} is set to -1.
|
|
3099
|
+
*
|
|
3100
|
+
* The {@link ComboBox.isEditable} property determines whether users can enter
|
|
3101
|
+
* values that are not present in the list.
|
|
3102
|
+
*
|
|
3103
|
+
* The example below creates a {@link ComboBox} control and populates it with
|
|
3104
|
+
* a list of countries. The {@link ComboBox} searches for the country as the
|
|
3105
|
+
* user types.
|
|
3106
|
+
* The {@link ComboBox.isEditable} property is set to false, so the user must
|
|
3107
|
+
* select one of the items in the list.
|
|
3108
|
+
*
|
|
3109
|
+
* {@sample Input/ComboBox/Overview/purejs Example}
|
|
3110
|
+
*/
|
|
3111
|
+
export declare class ComboBox extends DropDown {
|
|
3112
|
+
_lbx: ListBox;
|
|
3113
|
+
_editable: boolean;
|
|
3114
|
+
_trimText: boolean;
|
|
3115
|
+
_handleWheel: boolean;
|
|
3116
|
+
_delKey: number;
|
|
3117
|
+
_draggingText: boolean;
|
|
3118
|
+
_composing: boolean;
|
|
3119
|
+
_settingText: boolean;
|
|
3120
|
+
_pathHdr: Binding;
|
|
3121
|
+
_bsCollapse: boolean;
|
|
3122
|
+
_fmtItemHandlers: number;
|
|
3123
|
+
_emptyValueAction: boolean;
|
|
3124
|
+
_oldIndexToBeRestoredOnBlur: null | number;
|
|
3125
|
+
_restoreComboboxTbxVal: boolean;
|
|
3126
|
+
_isWheel: boolean;
|
|
3127
|
+
/**
|
|
3128
|
+
* Initializes a new instance of the {@link ComboBox} class.
|
|
3129
|
+
*
|
|
3130
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
3131
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3132
|
+
*/
|
|
3133
|
+
constructor(element: any, options?: any);
|
|
3134
|
+
/**
|
|
3135
|
+
* Gets or sets the array or {@link ICollectionView} object that contains
|
|
3136
|
+
* the items to select from.
|
|
3137
|
+
*
|
|
3138
|
+
* Setting this property to an array causes the {@link ComboBox} to create
|
|
3139
|
+
* an internal {@link ICollectionView} object that is exposed by the
|
|
3140
|
+
* {@link ComboBox.collectionView} property.
|
|
3141
|
+
*
|
|
3142
|
+
* The {@link ComboBox} selection is determined by the current item in its
|
|
3143
|
+
* {@link ComboBox.collectionView}. By default, this is the first item in
|
|
3144
|
+
* the collection. You may change this behavior by setting the
|
|
3145
|
+
* {@link wijmo.CollectionView.currentItem} property of the
|
|
3146
|
+
* {@link ComboBox.collectionView} to null.
|
|
3147
|
+
*/
|
|
3148
|
+
itemsSource: any;
|
|
3149
|
+
/**
|
|
3150
|
+
* Gets the {@link ICollectionView} object used as the item source.
|
|
3151
|
+
*/
|
|
3152
|
+
readonly collectionView: ICollectionView;
|
|
3153
|
+
/**
|
|
3154
|
+
* Gets or sets the minimum number of rows and/or columns required to enable
|
|
3155
|
+
* virtualization in the drop-down {@link ListBox}.
|
|
3156
|
+
*
|
|
3157
|
+
* The default value for this property is a very big number, meaning virtualization is
|
|
3158
|
+
* disabled. To enable virtualization, set its value to 0 or a positive number.
|
|
3159
|
+
*
|
|
3160
|
+
* For more detals, please see the {@link ListBox.virtializationThreshold}
|
|
3161
|
+
* property.
|
|
3162
|
+
*/
|
|
3163
|
+
virtualizationThreshold: number;
|
|
3164
|
+
/**
|
|
3165
|
+
* Gets or sets a value that determines whether the drop-down {@link ListBox}
|
|
3166
|
+
* should include group header items to delimit data groups.
|
|
3167
|
+
*
|
|
3168
|
+
* Data groups are created by modifying the {@link ICollectionView.groupDescriptions}
|
|
3169
|
+
* property of the {@link ICollectionView} object used as an {@link itemsSource}.
|
|
3170
|
+
*
|
|
3171
|
+
* The default value for this property is **false**.
|
|
3172
|
+
*/
|
|
3173
|
+
showGroups: boolean;
|
|
3174
|
+
/**
|
|
3175
|
+
* Gets or sets the name of the property to use as the visual
|
|
3176
|
+
* representation of the items.
|
|
3177
|
+
*/
|
|
3178
|
+
displayMemberPath: string;
|
|
3179
|
+
/**
|
|
3180
|
+
* Gets or sets the name of a property to use for getting the value
|
|
3181
|
+
* displayed in the control's input element.
|
|
3182
|
+
*
|
|
3183
|
+
* The default value for this property is **null**, which causes the
|
|
3184
|
+
* control to display the same content in the input element as in the
|
|
3185
|
+
* selected item of the drop-down list.
|
|
3186
|
+
*
|
|
3187
|
+
* Use this property if you want to decouple the value shown in the
|
|
3188
|
+
* input element from the values shown in the drop-down list. For example,
|
|
3189
|
+
* the input element could show an item's name and the drop-down list
|
|
3190
|
+
* could show additional detail.
|
|
3191
|
+
*/
|
|
3192
|
+
headerPath: string | null;
|
|
3193
|
+
/**
|
|
3194
|
+
* Gets or sets the name of the property used to get the
|
|
3195
|
+
* {@link selectedValue} from the {@link selectedItem}.
|
|
3196
|
+
*/
|
|
3197
|
+
selectedValuePath: string;
|
|
3198
|
+
/**
|
|
3199
|
+
* Gets or sets a value indicating whether the drop-down list displays
|
|
3200
|
+
* items as plain text or as HTML.
|
|
3201
|
+
*
|
|
3202
|
+
* The default value for this property is **false**.
|
|
3203
|
+
*/
|
|
3204
|
+
isContentHtml: boolean;
|
|
3205
|
+
/**
|
|
3206
|
+
* Gets or sets a value that determines whether searches performed
|
|
3207
|
+
* while the user types should case-sensitive.
|
|
3208
|
+
*
|
|
3209
|
+
* The default value for this property is **false**.
|
|
3210
|
+
*/
|
|
3211
|
+
caseSensitiveSearch: boolean;
|
|
3212
|
+
/**
|
|
3213
|
+
* Gets or sets a value that determines whether values in the
|
|
3214
|
+
* control's input element should be trimmed by removing leading
|
|
3215
|
+
* and trailing spaces.
|
|
3216
|
+
*
|
|
3217
|
+
* The default value for this property is **true**.
|
|
3218
|
+
*
|
|
3219
|
+
* To see leading and trailing spaces in the drop-down list items,
|
|
3220
|
+
* you may have to apply a CSS rule such as this one:
|
|
3221
|
+
*
|
|
3222
|
+
* ```css
|
|
3223
|
+
* .wj-listbox-item {
|
|
3224
|
+
* white-space: pre;
|
|
3225
|
+
* }
|
|
3226
|
+
* ```
|
|
3227
|
+
* </pre>
|
|
3228
|
+
*/
|
|
3229
|
+
trimText: boolean;
|
|
3230
|
+
/**
|
|
3231
|
+
* Gets or sets a function used to customize the values shown in
|
|
3232
|
+
* the drop-down list.
|
|
3233
|
+
* The function takes two arguments, the item index and the default
|
|
3234
|
+
* text or html, and returns the new text or html to display.
|
|
3235
|
+
*
|
|
3236
|
+
* If the formatting function needs a scope (i.e. a meaningful 'this'
|
|
3237
|
+
* value), then remember to set the filter using the 'bind' function
|
|
3238
|
+
* to specify the 'this' object. For example:
|
|
3239
|
+
*
|
|
3240
|
+
* ```typescript
|
|
3241
|
+
* comboBox.itemFormatter = customItemFormatter.bind(this);
|
|
3242
|
+
* function customItemFormatter(index, content) {
|
|
3243
|
+
* if (this.makeItemBold(index)) {
|
|
3244
|
+
* content = '<b>' + content + '</b>';
|
|
3245
|
+
* }
|
|
3246
|
+
* return content;
|
|
3247
|
+
* }
|
|
3248
|
+
* ```
|
|
3249
|
+
*/
|
|
3250
|
+
itemFormatter: IItemFormatter;
|
|
3251
|
+
/**
|
|
3252
|
+
* Event that fires when items in the drop-down list are created.
|
|
3253
|
+
*
|
|
3254
|
+
* You can use this event to modify the HTML in the list items.
|
|
3255
|
+
* For details, see the {@link ListBox.formatItem} event.
|
|
3256
|
+
*/
|
|
3257
|
+
readonly formatItem: Event<ListBox, FormatItemEventArgs>;
|
|
3258
|
+
/**
|
|
3259
|
+
* Gets or sets the index of the currently selected item in
|
|
3260
|
+
* the drop-down list.
|
|
3261
|
+
*/
|
|
3262
|
+
selectedIndex: number;
|
|
3263
|
+
/**
|
|
3264
|
+
* Gets or sets the item that is currently selected in
|
|
3265
|
+
* the drop-down list.
|
|
3266
|
+
*/
|
|
3267
|
+
selectedItem: any;
|
|
3268
|
+
/**
|
|
3269
|
+
* Gets or sets the value of the {@link selectedItem}, obtained
|
|
3270
|
+
* using the {@link selectedValuePath}.
|
|
3271
|
+
*
|
|
3272
|
+
* If the {@link selectedValuePath} property is not set, gets or
|
|
3273
|
+
* sets the value of the control's {@link selectedItem} property.
|
|
3274
|
+
*
|
|
3275
|
+
* If the {@link itemsSource} property is not set, gets or sets
|
|
3276
|
+
* the value of the control's {@link text} property.
|
|
3277
|
+
*/
|
|
3278
|
+
selectedValue: any;
|
|
3279
|
+
/**
|
|
3280
|
+
* Gets or sets a value that determines whether the content of the
|
|
3281
|
+
* input element should be restricted to items in the {@link itemsSource}
|
|
3282
|
+
* collection.
|
|
3283
|
+
*
|
|
3284
|
+
* The default value for this property is **false** on the {@link ComboBox} control, and
|
|
3285
|
+
* **true** on the {@link AutoComplete} and {@link InputTime} controls.
|
|
3286
|
+
*/
|
|
3287
|
+
isEditable: boolean;
|
|
3288
|
+
/**
|
|
3289
|
+
* Gets or sets a value that determines whether the user can use
|
|
3290
|
+
* the mouse wheel to change the currently selected item.
|
|
3291
|
+
*
|
|
3292
|
+
* The default value for this property is **true**.
|
|
3293
|
+
*/
|
|
3294
|
+
handleWheel: boolean;
|
|
3295
|
+
/**
|
|
3296
|
+
* Gets or sets the maximum height of the drop-down list, in pixels.
|
|
3297
|
+
*
|
|
3298
|
+
* The default value for this property is **200** pixels.
|
|
3299
|
+
*/
|
|
3300
|
+
maxDropDownHeight: number;
|
|
3301
|
+
/**
|
|
3302
|
+
* Gets or sets the maximum width of the drop-down list.
|
|
3303
|
+
*
|
|
3304
|
+
* The width of the drop-down list is also limited by the width of
|
|
3305
|
+
* the control itself (that value represents the drop-down's
|
|
3306
|
+
* minimum width).
|
|
3307
|
+
*
|
|
3308
|
+
* The default value for this property is **null**, which
|
|
3309
|
+
* means the drop-down has no maximum width limit.
|
|
3310
|
+
*/
|
|
3311
|
+
maxDropDownWidth: number;
|
|
3312
|
+
/**
|
|
3313
|
+
* Gets the string displayed in the input element for the item at a
|
|
3314
|
+
* given index (always plain text).
|
|
3315
|
+
*
|
|
3316
|
+
* @param index The index of the item to retrieve the text for.
|
|
3317
|
+
* @param trimText Optionally override the value of the {@link trimText} property.
|
|
3318
|
+
*/
|
|
3319
|
+
getDisplayText(index?: number, trimText?: boolean): string;
|
|
3320
|
+
/**
|
|
3321
|
+
* Gets the index of the first item that matches a given string.
|
|
3322
|
+
*
|
|
3323
|
+
* @param search String to search for.
|
|
3324
|
+
* @param fullMatch Whether to look for a full match or just the start of the string.
|
|
3325
|
+
* @return The index of the item, or -1 if not found.
|
|
3326
|
+
*/
|
|
3327
|
+
indexOf(search: string, fullMatch: boolean, dry?: boolean): number;
|
|
3328
|
+
/**
|
|
3329
|
+
* Gets the {@link ListBox} control shown in the drop-down.
|
|
3330
|
+
*/
|
|
3331
|
+
readonly listBox: ListBox;
|
|
3332
|
+
/**
|
|
3333
|
+
* Occurs when the value of the {@link itemsSource} property changes.
|
|
3334
|
+
*/
|
|
3335
|
+
readonly itemsSourceChanged: Event<ComboBox, EventArgs>;
|
|
3336
|
+
/**
|
|
3337
|
+
* Raises the {@link itemsSourceChanged} event.
|
|
3338
|
+
*/
|
|
3339
|
+
onItemsSourceChanged(e?: EventArgs): void;
|
|
3340
|
+
/**
|
|
3341
|
+
* Occurs when the value of the {@link selectedIndex} property changes.
|
|
3342
|
+
*/
|
|
3343
|
+
readonly selectedIndexChanged: Event<ComboBox, EventArgs>;
|
|
3344
|
+
/**
|
|
3345
|
+
* Raises the {@link selectedIndexChanged} event.
|
|
3346
|
+
*/
|
|
3347
|
+
onSelectedIndexChanged(e?: EventArgs): void;
|
|
3348
|
+
refresh(fullUpdate?: boolean): void;
|
|
3349
|
+
onLostFocus(e?: EventArgs, oldIdxAutoComplete?: number, forceAutoCompleteBlurIdxUpdate?: boolean): void;
|
|
3350
|
+
onIsDroppedDownChanging(e: CancelEventArgs): boolean;
|
|
3351
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
3352
|
+
protected _trySelectionUpdateOnItemsSourceChanged(isSourceChanged: boolean, txtCombo: string): void;
|
|
3353
|
+
protected _setIsDisabled(value: boolean): void;
|
|
3354
|
+
protected _updateBtn(): void;
|
|
3355
|
+
protected _hasItems(): boolean;
|
|
3356
|
+
private _updateAria;
|
|
3357
|
+
protected _createDropDown(): void;
|
|
3358
|
+
protected _wheel(e: WheelEvent): void;
|
|
3359
|
+
protected _dropDownClick(e: MouseEvent): void;
|
|
3360
|
+
protected _setText(text: string, fullMatch: boolean): void;
|
|
3361
|
+
protected _findNext(search: string, step: number, start?: number): number;
|
|
3362
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
3363
|
+
protected _input(e: Event): void;
|
|
3364
|
+
protected _updateInputSelection(start: number): void;
|
|
3365
|
+
private _getSelStart;
|
|
3366
|
+
private _getSelEnd;
|
|
3367
|
+
private _setSelRange;
|
|
3368
|
+
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Represents a method that returns a string used as a header for a
|
|
3371
|
+
* {@link MultiSelect} control.
|
|
3372
|
+
*/
|
|
3373
|
+
export interface IHeaderFormatter {
|
|
3374
|
+
/**
|
|
3375
|
+
* @param sender {@link MultiSelect} whose header is being formatted.
|
|
3376
|
+
* @returns The text to show in the control's header element.
|
|
3377
|
+
*/
|
|
3378
|
+
(sender: MultiSelect): string;
|
|
3379
|
+
}
|
|
3380
|
+
/**
|
|
3381
|
+
* The {@link MultiSelect} control allows users to select multiple items from
|
|
3382
|
+
* drop-down lists that contain custom objects or simple strings.
|
|
3383
|
+
*
|
|
3384
|
+
* The {@link MultiSelect} control extends {@link ComboBox}, with all the usual
|
|
3385
|
+
* properties, including {@link MultiSelect.itemsSource} and
|
|
3386
|
+
* {@link MultiSelect.displayMemberPath}.
|
|
3387
|
+
*
|
|
3388
|
+
* Like the {@link ListBox} control, it has a {@link MultiSelect.checkedMemberPath}
|
|
3389
|
+
* property that defines the name of the property that determines whether an
|
|
3390
|
+
* item is checked or not.
|
|
3391
|
+
*
|
|
3392
|
+
* The items currently checked (selected) can be obtained using the
|
|
3393
|
+
* {@link MultiSelect.checkedItems} property.
|
|
3394
|
+
*
|
|
3395
|
+
* The control header is fully customizable. By default, it shows up to two items
|
|
3396
|
+
* selected and the item count after that. You can change the maximum number of
|
|
3397
|
+
* items to display ({@link MultiSelect.maxHeaderItems}), the message shown when no
|
|
3398
|
+
* items are selected ({@link MultiSelect.placeholder}), and the format string used to
|
|
3399
|
+
* show the item count ({@link MultiSelect.headerFormat}).
|
|
3400
|
+
*
|
|
3401
|
+
* Alternatively, you can provide a function to generate the header content based
|
|
3402
|
+
* on whatever criteria your application requires ({@link MultiSelect.headerFormatter}).
|
|
3403
|
+
*
|
|
3404
|
+
* The example below shows how you can use a {@link MultiSelect} control to select
|
|
3405
|
+
* multiple items from a drop-down list:
|
|
3406
|
+
*
|
|
3407
|
+
* {@sample Input/MultiSelect/Overview Example}
|
|
3408
|
+
*/
|
|
3409
|
+
export declare class MultiSelect extends ComboBox {
|
|
3410
|
+
private _maxHdrItems;
|
|
3411
|
+
private _readOnly;
|
|
3412
|
+
private _hdrFmt;
|
|
3413
|
+
private _hdrFormatter;
|
|
3414
|
+
private _msLbx;
|
|
3415
|
+
static _DEF_CHECKED_PATH: string;
|
|
3416
|
+
/**
|
|
3417
|
+
* Initializes a new instance of the {@link MultiSelect} class.
|
|
3418
|
+
*
|
|
3419
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3420
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3421
|
+
*/
|
|
3422
|
+
constructor(element: any, options?: any);
|
|
3423
|
+
/**
|
|
3424
|
+
* Gets or sets whether the control should display a "Select All" checkbox
|
|
3425
|
+
* above the items to select or de-select all items.
|
|
3426
|
+
*
|
|
3427
|
+
* The default value for this property is **false**.
|
|
3428
|
+
*/
|
|
3429
|
+
showSelectAllCheckbox: boolean;
|
|
3430
|
+
/**
|
|
3431
|
+
* Gets or sets whether the control should display a "filter" input
|
|
3432
|
+
* above the items to filter the items displayed.
|
|
3433
|
+
*
|
|
3434
|
+
* The default value for this property is **false**.
|
|
3435
|
+
*/
|
|
3436
|
+
showFilterInput: boolean;
|
|
3437
|
+
/**
|
|
3438
|
+
* Gets or sets the delay, in milliseconds, between when a keystroke occurs
|
|
3439
|
+
* and when the search is performed to update the filter.
|
|
3440
|
+
*
|
|
3441
|
+
* This property is relevant only when the {@link showFilterInput}
|
|
3442
|
+
* property is set to **true**.
|
|
3443
|
+
*
|
|
3444
|
+
* The default value for this property is **500** milliseconds.
|
|
3445
|
+
*/
|
|
3446
|
+
delay: number;
|
|
3447
|
+
/**
|
|
3448
|
+
* Gets or sets a value that determines whether searches performed
|
|
3449
|
+
* while the user types should case-sensitive.
|
|
3450
|
+
*
|
|
3451
|
+
* The default value for this property is **false**.
|
|
3452
|
+
*/
|
|
3453
|
+
caseSensitiveSearch: boolean;
|
|
3454
|
+
/**
|
|
3455
|
+
* Gets or sets the string used as a placeholder for the filter input
|
|
3456
|
+
* element on the {@link MultiSelectListBox} drop-down.
|
|
3457
|
+
*
|
|
3458
|
+
* The default value for this property is **null**, which causes the
|
|
3459
|
+
* control to use a localized version of the string "Filter".
|
|
3460
|
+
*/
|
|
3461
|
+
filterInputPlaceholder: string | null;
|
|
3462
|
+
/**
|
|
3463
|
+
* Gets or sets a value that determines whether the {@link MultiSelectListBox}
|
|
3464
|
+
* in the drop-down should automatically select all the filtered items when the
|
|
3465
|
+
* filter text changes.
|
|
3466
|
+
*
|
|
3467
|
+
* The default value for this property is **true**.
|
|
3468
|
+
*/
|
|
3469
|
+
checkOnFilter: boolean;
|
|
3470
|
+
/**
|
|
3471
|
+
* Gets or sets the string to be used as a label for the "Select All"
|
|
3472
|
+
* checkbox that is displayed when the {@link showSelectAllCheckbox}
|
|
3473
|
+
* property is set to true.
|
|
3474
|
+
*
|
|
3475
|
+
* The default value for this property is **null**, which causes the
|
|
3476
|
+
* control to use a localized version of the string "Select All".
|
|
3477
|
+
*/
|
|
3478
|
+
selectAllLabel: string | null;
|
|
3479
|
+
/**
|
|
3480
|
+
* Gets or sets the name of the property used to control the checkboxes
|
|
3481
|
+
* placed next to each item.
|
|
3482
|
+
*/
|
|
3483
|
+
checkedMemberPath: string;
|
|
3484
|
+
/**
|
|
3485
|
+
* Gets or sets the maximum number of items to display on the control header.
|
|
3486
|
+
*
|
|
3487
|
+
* If no items are selected, the header displays the text specified by the
|
|
3488
|
+
* {@link placeholder} property.
|
|
3489
|
+
*
|
|
3490
|
+
* If the number of selected items is smaller than or equal to the value of the
|
|
3491
|
+
* {@link maxHeaderItems} property, the selected items are shown in the header.
|
|
3492
|
+
*
|
|
3493
|
+
* If the number of selected items is greater than {@link maxHeaderItems}, the
|
|
3494
|
+
* header displays the selected item count instead.
|
|
3495
|
+
*
|
|
3496
|
+
* The default value for this property is **2**.
|
|
3497
|
+
*/
|
|
3498
|
+
maxHeaderItems: number;
|
|
3499
|
+
/**
|
|
3500
|
+
* Gets or sets the format string used to create the header content
|
|
3501
|
+
* when the control has more than {@link maxHeaderItems} items checked.
|
|
3502
|
+
*
|
|
3503
|
+
* The format string may contain the '{count}' replacement string
|
|
3504
|
+
* which gets replaced with the number of items currently checked.
|
|
3505
|
+
*
|
|
3506
|
+
* The default value for this property is **null**, which causes the
|
|
3507
|
+
* control to use a localized version of the string "{count:n0} items selected".
|
|
3508
|
+
*/
|
|
3509
|
+
headerFormat: string | null;
|
|
3510
|
+
/**
|
|
3511
|
+
* Gets or sets a function that gets the text displayed in the control
|
|
3512
|
+
* header.
|
|
3513
|
+
*
|
|
3514
|
+
* By default, the control header content is determined based on the
|
|
3515
|
+
* {@link placeholder}, {@link maxHeaderItems}, and on the current selection.
|
|
3516
|
+
*
|
|
3517
|
+
* You may customize the header content by specifying a function that
|
|
3518
|
+
* returns a custom string based on whatever criteria your application
|
|
3519
|
+
* requires.
|
|
3520
|
+
*/
|
|
3521
|
+
headerFormatter: IHeaderFormatter | null;
|
|
3522
|
+
/**
|
|
3523
|
+
* Gets or sets an array containing the items that are currently checked.
|
|
3524
|
+
*/
|
|
3525
|
+
checkedItems: any[];
|
|
3526
|
+
/**
|
|
3527
|
+
* Occurs when the value of the {@link checkedItems} property changes.
|
|
3528
|
+
*/
|
|
3529
|
+
readonly checkedItemsChanged: Event<MultiSelect, EventArgs>;
|
|
3530
|
+
/**
|
|
3531
|
+
* Raises the {@link checkedItemsChanged} event.
|
|
3532
|
+
*/
|
|
3533
|
+
onCheckedItemsChanged(e?: EventArgs): void;
|
|
3534
|
+
dispose(): void;
|
|
3535
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
3536
|
+
onLostFocus(): void;
|
|
3537
|
+
protected _createDropDown(): void;
|
|
3538
|
+
isReadOnly: boolean;
|
|
3539
|
+
refresh(fullUpdate?: boolean): void;
|
|
3540
|
+
protected _setText(text: string, fullMatch: boolean): void;
|
|
3541
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
3542
|
+
protected _hasItems(): boolean;
|
|
3543
|
+
private _updateHeader;
|
|
3544
|
+
}
|
|
3545
|
+
/**
|
|
3546
|
+
* Interface implemented by command objects.
|
|
3547
|
+
*
|
|
3548
|
+
* For details, please see the {@link Menu.command} property.
|
|
3549
|
+
*/
|
|
3550
|
+
interface ICommand {
|
|
3551
|
+
/**
|
|
3552
|
+
* Executes the command with a given parameter.
|
|
3553
|
+
*
|
|
3554
|
+
* The parameter passed to the command is defined by the value of the
|
|
3555
|
+
* {@link Menu.commandParameterPath} property of the current item.
|
|
3556
|
+
* If the {@link Menu.commandParameterPath} property is not specified,
|
|
3557
|
+
* the parameter passed is the item itself.
|
|
3558
|
+
*/
|
|
3559
|
+
executeCommand(parameter: any): void;
|
|
3560
|
+
/**
|
|
3561
|
+
* Returns true if the command can be executed in the current app state.
|
|
3562
|
+
*
|
|
3563
|
+
* If this method returns false, the corresponding menu option is
|
|
3564
|
+
* disabled.
|
|
3565
|
+
*/
|
|
3566
|
+
canExecuteCommand?(parameter: any): boolean;
|
|
3567
|
+
}
|
|
3568
|
+
/**
|
|
3569
|
+
* The {@link Menu} control shows a text element with a drop-down list of commands that
|
|
3570
|
+
* the user can invoke by click or touch.
|
|
3571
|
+
*
|
|
3572
|
+
* The {@link Menu} control inherits from {@link ComboBox}, so you populate and style it
|
|
3573
|
+
* in the same way that you do the {@link ComboBox} (see the {@link Menu.itemsSource}
|
|
3574
|
+
* property).
|
|
3575
|
+
*
|
|
3576
|
+
* The {@link Menu} control adds an {@link Menu.itemClicked} event that fires when the user
|
|
3577
|
+
* selects an item from the menu. The event handler can inspect the {@link Menu} control
|
|
3578
|
+
* to determine which item was clicked. For example:
|
|
3579
|
+
*
|
|
3580
|
+
* ```typescript
|
|
3581
|
+
* import { Menu } from '@grapecity/wijmo.input';
|
|
3582
|
+
* let menu = new Menu('#theMenu', {
|
|
3583
|
+
* header: 'Main Menu',
|
|
3584
|
+
* itemsSource: ['option 1', 'option 2', 'option 3'],
|
|
3585
|
+
* itemClicked: s => {
|
|
3586
|
+
* alert('Thanks for selecting item ' + s.selectedIndex + ' from menu ' + s.header + '!');
|
|
3587
|
+
* }
|
|
3588
|
+
* });
|
|
3589
|
+
* ```
|
|
3590
|
+
*
|
|
3591
|
+
* The example below shows how you can create menus that handle the
|
|
3592
|
+
* {@link itemClicked} event.
|
|
3593
|
+
*
|
|
3594
|
+
* {@sample Input/Menu/Overview Example}
|
|
3595
|
+
*/
|
|
3596
|
+
export declare class Menu extends ComboBox {
|
|
3597
|
+
_hdr: HTMLElement;
|
|
3598
|
+
_closing: boolean;
|
|
3599
|
+
_cmd: ICommand;
|
|
3600
|
+
_cmdPath: string;
|
|
3601
|
+
_cmdParamPath: string;
|
|
3602
|
+
_subPath: string;
|
|
3603
|
+
_defaultItem: any;
|
|
3604
|
+
_owner: HTMLElement;
|
|
3605
|
+
_isButton: boolean;
|
|
3606
|
+
_openOnHover: boolean;
|
|
3607
|
+
_closeOnLeave: boolean;
|
|
3608
|
+
_toHover: any;
|
|
3609
|
+
_subMenu: Menu;
|
|
3610
|
+
_hoverEnterBnd: any;
|
|
3611
|
+
_hoverLeaveBnd: any;
|
|
3612
|
+
_hoverOverBnd: any;
|
|
3613
|
+
static _evtHover: MouseEvent;
|
|
3614
|
+
/**
|
|
3615
|
+
* Initializes a new instance of the {@link Menu} class.
|
|
3616
|
+
*
|
|
3617
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3618
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3619
|
+
*/
|
|
3620
|
+
constructor(element: any, options?: any);
|
|
3621
|
+
/**
|
|
3622
|
+
* Gets or sets the HTML text shown in the {@link Menu} element.
|
|
3623
|
+
*
|
|
3624
|
+
* The default value for this property is an empty string (**''**).
|
|
3625
|
+
*/
|
|
3626
|
+
header: string;
|
|
3627
|
+
/**
|
|
3628
|
+
* Gets or sets the command object that determines whether menu items
|
|
3629
|
+
* should be enabled and what actions they should perform when selected.
|
|
3630
|
+
*
|
|
3631
|
+
* Command objects implement the {@link ICommand} interface.
|
|
3632
|
+
*
|
|
3633
|
+
* You can also set commands on individual items using the {@link commandPath}
|
|
3634
|
+
* property.
|
|
3635
|
+
*
|
|
3636
|
+
* The default value for this property is **null**.
|
|
3637
|
+
*/
|
|
3638
|
+
command: ICommand | null;
|
|
3639
|
+
/**
|
|
3640
|
+
* Gets or sets the name of the property that contains the command to
|
|
3641
|
+
* execute when the user clicks an item.
|
|
3642
|
+
*
|
|
3643
|
+
* Command objects implement the {@link ICommand} interface.
|
|
3644
|
+
*
|
|
3645
|
+
* This property overrides the {@link command} property for specific
|
|
3646
|
+
* menu items.
|
|
3647
|
+
*
|
|
3648
|
+
* The default value for this property is **null**.
|
|
3649
|
+
*/
|
|
3650
|
+
commandPath: string;
|
|
3651
|
+
/**
|
|
3652
|
+
* Gets or sets the name of the property that contains a parameter to use with
|
|
3653
|
+
* the command specified by the {@link commandPath} property.
|
|
3654
|
+
*
|
|
3655
|
+
* Command objects implement the {@link ICommand} interface.
|
|
3656
|
+
*
|
|
3657
|
+
* The default value for this property is **null**.
|
|
3658
|
+
*/
|
|
3659
|
+
commandParameterPath: string;
|
|
3660
|
+
/**
|
|
3661
|
+
* Gets or sets the name of the property that contains an array with items
|
|
3662
|
+
* to be displayed in a sub-menu.
|
|
3663
|
+
*
|
|
3664
|
+
* The default value for this property is **null**.
|
|
3665
|
+
*/
|
|
3666
|
+
subItemsPath: string;
|
|
3667
|
+
/**
|
|
3668
|
+
* Gets or sets a value that determines whether the menu (and any sub-menus)
|
|
3669
|
+
* should open automatically when the mouse hovers over the items.
|
|
3670
|
+
*
|
|
3671
|
+
* See also the {@link closeOnLeave} property, which determines whether the
|
|
3672
|
+
* menu should close automatically when the mouse leaves the menu.
|
|
3673
|
+
*
|
|
3674
|
+
* The default value for this property is **false**.
|
|
3675
|
+
*/
|
|
3676
|
+
openOnHover: boolean;
|
|
3677
|
+
/**
|
|
3678
|
+
* Gets or sets a value that determines whether the menu (and any sub-menus)
|
|
3679
|
+
* should close automatically when the mouse leaves the menu.
|
|
3680
|
+
*
|
|
3681
|
+
* This property is applicable only when the {@link openOnHover} is set to true.
|
|
3682
|
+
*
|
|
3683
|
+
* The default value for this property is **true**.
|
|
3684
|
+
*/
|
|
3685
|
+
closeOnLeave: boolean;
|
|
3686
|
+
/**
|
|
3687
|
+
* Gets or sets a value that determines whether this {@link Menu} should act
|
|
3688
|
+
* as a split button instead of a regular menu.
|
|
3689
|
+
*
|
|
3690
|
+
* The default value for this property is **false**.
|
|
3691
|
+
*
|
|
3692
|
+
* The difference between regular menus and split buttons is what happens
|
|
3693
|
+
* when the user clicks the menu header.
|
|
3694
|
+
* In regular menus, clicking the header shows or hides the menu options.
|
|
3695
|
+
* In split buttons, clicking the header raises the {@link Menu.itemClicked}
|
|
3696
|
+
* event and/or invokes the command associated with the last option selected by
|
|
3697
|
+
* the user as if the user had picked the item from the drop-down list.
|
|
3698
|
+
*
|
|
3699
|
+
* If you want to differentiate between clicks on menu items and the button
|
|
3700
|
+
* part of a split button, check the value of the {@link Menu.isDroppedDown}
|
|
3701
|
+
* property of the event sender. If that is true, then a menu item was clicked;
|
|
3702
|
+
* if it is false, then the button was clicked.
|
|
3703
|
+
*
|
|
3704
|
+
* For example, the code below implements a split button that uses the drop-down
|
|
3705
|
+
* list only to change the default item/command, and triggers actions only when
|
|
3706
|
+
* the button is clicked:
|
|
3707
|
+
*
|
|
3708
|
+
* ```typescript
|
|
3709
|
+
* import { Menu } from '@grapecity/wijmo.input';
|
|
3710
|
+
* let theMenu = new Menu('#theMenu', {
|
|
3711
|
+
* isButton: true,
|
|
3712
|
+
* itemClicked: s => {
|
|
3713
|
+
* if (!s.isDroppedDown) { // header/button click
|
|
3714
|
+
* console.log('running ', s.selectedItem.browser);
|
|
3715
|
+
* }
|
|
3716
|
+
* },
|
|
3717
|
+
* selectedIndexChanged: s => { // update header text
|
|
3718
|
+
* if (s.selectedItem != null) {
|
|
3719
|
+
* s.header = 'Run ' + s.selectedItem.browser;
|
|
3720
|
+
* }
|
|
3721
|
+
* },
|
|
3722
|
+
* selectedValuePath: 'id',
|
|
3723
|
+
* displayMemberPath: 'browser',
|
|
3724
|
+
* itemsSource: [
|
|
3725
|
+
* { id: 0, browser: 'Chrome' },
|
|
3726
|
+
* { id: 1, browser: 'Edge' },
|
|
3727
|
+
* { id: 2, browser: 'Firefox' },
|
|
3728
|
+
* { id: 3, browser: 'Internet Explorer' }
|
|
3729
|
+
* ],
|
|
3730
|
+
* });
|
|
3731
|
+
* ```
|
|
3732
|
+
*/
|
|
3733
|
+
isButton: boolean;
|
|
3734
|
+
/**
|
|
3735
|
+
* Gets or sets the element that owns this {@link Menu}.
|
|
3736
|
+
*
|
|
3737
|
+
* This property is set by the wj-context-menu directive in case a
|
|
3738
|
+
* single menu is used as a context menu for several different
|
|
3739
|
+
* elements.
|
|
3740
|
+
*
|
|
3741
|
+
* The default value for this property is **null**.
|
|
3742
|
+
*/
|
|
3743
|
+
owner: HTMLElement;
|
|
3744
|
+
/**
|
|
3745
|
+
* Shows the menu at a given location.
|
|
3746
|
+
*
|
|
3747
|
+
* @param position An optional **MouseEvent** or reference element
|
|
3748
|
+
* that determines the position where the menu should be displayed.
|
|
3749
|
+
* If not provided, the menu is displayed at the center of the screen.
|
|
3750
|
+
|
|
3751
|
+
* This method is useful if you want to use the menu as a context
|
|
3752
|
+
* menu attached to one or more elements on the page. For example:
|
|
3753
|
+
*
|
|
3754
|
+
* ```typescript
|
|
3755
|
+
* import { Menu } from '@grapecity/wijmo.input';
|
|
3756
|
+
* let theMenu = new Menu(document.createElement('div'), {
|
|
3757
|
+
* itemsSource: 'New,Open,Save,Exit'.split(','),
|
|
3758
|
+
* itemClicked: s => {
|
|
3759
|
+
* alert('thanks for picking ' + s.selectedIndex);
|
|
3760
|
+
* }
|
|
3761
|
+
* });
|
|
3762
|
+
*
|
|
3763
|
+
* // use it as a context menu for one or more elements
|
|
3764
|
+
* let element = document.getElementById('btn');
|
|
3765
|
+
* element.addEventListener('contextmenu', e => {
|
|
3766
|
+
* e.preventDefault();
|
|
3767
|
+
* theMenu.show(e);
|
|
3768
|
+
* });
|
|
3769
|
+
* ```
|
|
3770
|
+
* You can adjust the position of the menu by setting the margin of
|
|
3771
|
+
* the menu's dropdown. For example, the code below causes the menu
|
|
3772
|
+
* to be displayed 20 pixels away from the point that was clicked:
|
|
3773
|
+
*
|
|
3774
|
+
* ```typescript
|
|
3775
|
+
* // add 20-pixel offset to the menu
|
|
3776
|
+
* theMenu.dropDown.style.margin = '20px';
|
|
3777
|
+
*
|
|
3778
|
+
* // show menu as a context menu
|
|
3779
|
+
* let element = document.getElementById('btn');
|
|
3780
|
+
* element.addEventListener('contextmenu', e => {
|
|
3781
|
+
* e.preventDefault();
|
|
3782
|
+
* theMenu.show(e);
|
|
3783
|
+
* });
|
|
3784
|
+
* ```
|
|
3785
|
+
*/
|
|
3786
|
+
show(position?: any): void;
|
|
3787
|
+
/**
|
|
3788
|
+
* Hides the menu.
|
|
3789
|
+
*
|
|
3790
|
+
* This method is useful if you want to hide a context menu displayed
|
|
3791
|
+
* with the {@link show} method.
|
|
3792
|
+
*/
|
|
3793
|
+
hide(): void;
|
|
3794
|
+
/**
|
|
3795
|
+
* Occurs when the user picks an item from the menu.
|
|
3796
|
+
*
|
|
3797
|
+
* The handler can determine which item was picked by reading the event sender's
|
|
3798
|
+
* {@link selectedIndex} property.
|
|
3799
|
+
*/
|
|
3800
|
+
readonly itemClicked: Event<Menu, EventArgs>;
|
|
3801
|
+
/**
|
|
3802
|
+
* Raises the {@link itemClicked} event.
|
|
3803
|
+
*/
|
|
3804
|
+
onItemClicked(e?: EventArgs): void;
|
|
3805
|
+
refresh(fullUpdate?: boolean): void;
|
|
3806
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
3807
|
+
_updateHoverEvents(): void;
|
|
3808
|
+
_getSubItems(item: any): any[];
|
|
3809
|
+
_formatMenuItem(s: ListBox, e: FormatItemEventArgs): void;
|
|
3810
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
3811
|
+
protected _dropDownClick(e: MouseEvent): void;
|
|
3812
|
+
private _showSubMenu;
|
|
3813
|
+
private _raiseCommand;
|
|
3814
|
+
private _getCommand;
|
|
3815
|
+
private _getCommandParm;
|
|
3816
|
+
private _executeCommand;
|
|
3817
|
+
private _canExecuteCommand;
|
|
3818
|
+
private _enableDisableItems;
|
|
3819
|
+
private _clearHover;
|
|
3820
|
+
private _isTargetDisabled;
|
|
3821
|
+
private _hoverEnter;
|
|
3822
|
+
private _hoverOver;
|
|
3823
|
+
private _hoverLeave;
|
|
3824
|
+
_setIsDisabled(value: boolean): void;
|
|
3825
|
+
_setTabOrder(value: number): void;
|
|
3826
|
+
}
|
|
3827
|
+
/**
|
|
3828
|
+
* The {@link InputTime} control allows users to enter times using any format
|
|
3829
|
+
* supported by the {@link Globalize} class, or to pick times from a drop-down
|
|
3830
|
+
* list.
|
|
3831
|
+
*
|
|
3832
|
+
* The {@link min}, {@link max}, and {@link step} properties determine the values shown
|
|
3833
|
+
* in the list.
|
|
3834
|
+
*
|
|
3835
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
3836
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
3837
|
+
*
|
|
3838
|
+
* The {@link value} property gets or sets a {@link Date} object that represents the time
|
|
3839
|
+
* selected by the user.
|
|
3840
|
+
*
|
|
3841
|
+
* The example below shows a **Date** value (that includes date and time information)
|
|
3842
|
+
* using an {@link InputDate} and an {@link InputTime} control. Notice how both controls
|
|
3843
|
+
* are bound to the same controller variable, and each edits the appropriate information
|
|
3844
|
+
* (either date or time).
|
|
3845
|
+
*
|
|
3846
|
+
* {@sample Input/InputTime/Overview/purejs Example}
|
|
3847
|
+
*/
|
|
3848
|
+
export declare class InputTime extends ComboBox {
|
|
3849
|
+
_value: Date;
|
|
3850
|
+
_min: Date;
|
|
3851
|
+
_max: Date;
|
|
3852
|
+
_step: number;
|
|
3853
|
+
_format: string;
|
|
3854
|
+
_msk: _MaskProvider;
|
|
3855
|
+
_hasCustomItems: boolean;
|
|
3856
|
+
/**
|
|
3857
|
+
* Initializes a new instance of the {@link InputTime} class.
|
|
3858
|
+
*
|
|
3859
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3860
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3861
|
+
*/
|
|
3862
|
+
constructor(element: any, options?: any);
|
|
3863
|
+
/**
|
|
3864
|
+
* Gets the HTML input element hosted by the control.
|
|
3865
|
+
*
|
|
3866
|
+
* Use this property in situations where you want to customize the
|
|
3867
|
+
* attributes of the input element.
|
|
3868
|
+
*/
|
|
3869
|
+
readonly inputElement: HTMLInputElement;
|
|
3870
|
+
/**
|
|
3871
|
+
* Gets or sets the "type" attribute of the HTML input element hosted by the control.
|
|
3872
|
+
*
|
|
3873
|
+
* By default, this property is set to "tel", a value that causes mobile devices to
|
|
3874
|
+
* show a numeric keypad that includes a negative sign and a decimal separator.
|
|
3875
|
+
*
|
|
3876
|
+
* Use this property to change the default setting if the default does not work well
|
|
3877
|
+
* for the current culture, device, or application. In those cases, try changing
|
|
3878
|
+
* the value to "number" or "text."
|
|
3879
|
+
*
|
|
3880
|
+
* Note that input elements with type "number" prevent selection in Chrome and therefore
|
|
3881
|
+
* is not recommended. For more details, see this link:
|
|
3882
|
+
* https://stackoverflow.com/questions/21177489/selectionstart-selectionend-on-input-type-number-no-longer-allowed-in-chrome
|
|
3883
|
+
*/
|
|
3884
|
+
inputType: string;
|
|
3885
|
+
/**
|
|
3886
|
+
* Gets or sets the current input time.
|
|
3887
|
+
*/
|
|
3888
|
+
value: Date | null;
|
|
3889
|
+
/**
|
|
3890
|
+
* Gets or sets the text shown in the control.
|
|
3891
|
+
*/
|
|
3892
|
+
text: string;
|
|
3893
|
+
/**
|
|
3894
|
+
* Gets or sets the earliest time that the user can enter.
|
|
3895
|
+
*
|
|
3896
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
3897
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
3898
|
+
*/
|
|
3899
|
+
min: Date | null;
|
|
3900
|
+
/**
|
|
3901
|
+
* Gets or sets the latest time that the user can enter.
|
|
3902
|
+
*
|
|
3903
|
+
* For details about using the {@link min} and {@link max} properties, please see the
|
|
3904
|
+
* <a href="/wijmo/docs/Topics/Input/Using-Min-Max">Using the min and max properties</a> topic.
|
|
3905
|
+
*/
|
|
3906
|
+
max: Date | null;
|
|
3907
|
+
/**
|
|
3908
|
+
* Gets or sets the number of minutes between entries in the drop-down list.
|
|
3909
|
+
*
|
|
3910
|
+
* The default value for this property is **15** minutes.
|
|
3911
|
+
*
|
|
3912
|
+
* Setting it to **null**, zero, or any negative value disables the drop-down.
|
|
3913
|
+
*
|
|
3914
|
+
* Only the integer part of the step value is used. Setting **step** to
|
|
3915
|
+
* **30.5** for example will create **30** minute intervals.
|
|
3916
|
+
*/
|
|
3917
|
+
step: number | null;
|
|
3918
|
+
/**
|
|
3919
|
+
* Gets or sets the format used to display the selected time (see {@link Globalize}).
|
|
3920
|
+
*
|
|
3921
|
+
* The format string is expressed as a .NET-style
|
|
3922
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings" target="_blank">
|
|
3923
|
+
* time format string</a>.
|
|
3924
|
+
*
|
|
3925
|
+
* The default value for this property is **'t'** (short time pattern).
|
|
3926
|
+
*/
|
|
3927
|
+
format: string;
|
|
3928
|
+
/**
|
|
3929
|
+
* Gets or sets a mask to use while the user is editing.
|
|
3930
|
+
*
|
|
3931
|
+
* The mask format is the same used by the {@link wijmo.input.InputMask}
|
|
3932
|
+
* control.
|
|
3933
|
+
*
|
|
3934
|
+
* If specified, the mask must be compatible with the value of
|
|
3935
|
+
* the {@link format} property. For example, you can use the mask '99:99 >LL'
|
|
3936
|
+
* for entering short times (format 't').
|
|
3937
|
+
*/
|
|
3938
|
+
mask: string;
|
|
3939
|
+
onLostFocus(): void;
|
|
3940
|
+
/**
|
|
3941
|
+
* Occurs when the value of the {@link value} property changes, either
|
|
3942
|
+
* as a result of user actions or by assignment in code.
|
|
3943
|
+
*/
|
|
3944
|
+
readonly valueChanged: Event<InputTime, EventArgs>;
|
|
3945
|
+
/**
|
|
3946
|
+
* Raises the {@link valueChanged} event.
|
|
3947
|
+
*/
|
|
3948
|
+
onValueChanged(e?: EventArgs): void;
|
|
3949
|
+
onItemsSourceChanged(e?: EventArgs): void;
|
|
3950
|
+
refresh(fullUpdate?: boolean): void;
|
|
3951
|
+
onSelectedIndexChanged(e?: EventArgs): void;
|
|
3952
|
+
_clamp(value: Date): Date;
|
|
3953
|
+
protected _wheel(e: WheelEvent): void;
|
|
3954
|
+
protected _updateInputSelection(start: number): void;
|
|
3955
|
+
protected _updateItems(): void;
|
|
3956
|
+
private _getTime;
|
|
3957
|
+
protected _keydown(e: KeyboardEvent): void;
|
|
3958
|
+
protected _commitText(): void;
|
|
3959
|
+
protected _copy(key: string, value: any): boolean;
|
|
3960
|
+
}
|
|
3961
|
+
/**
|
|
3962
|
+
* The {@link InputDateTime} control extends the {@link InputDate} control to allows users
|
|
3963
|
+
* to input dates and times, either by typing complete date/time values in any format
|
|
3964
|
+
* supported by the {@link Globalize} class, or by picking dates from a drop-down calendar
|
|
3965
|
+
* and times from a drop-down list.
|
|
3966
|
+
*
|
|
3967
|
+
* Use the {@link InputDateTime.min} and {@link InputDateTime.max} properties to restrict
|
|
3968
|
+
* the range of dates that the user can enter.
|
|
3969
|
+
*
|
|
3970
|
+
* Use the {@link InputDateTime.timeMin} and {@link InputDateTime.timeMax} properties to
|
|
3971
|
+
* restrict the range of times that the user can enter.
|
|
3972
|
+
*
|
|
3973
|
+
* Use the {@link InputDateTime.value} property to gets or set the currently selected
|
|
3974
|
+
* date/time.
|
|
3975
|
+
*
|
|
3976
|
+
* The example below shows how you can use an {@link InputDateTime} control to edit
|
|
3977
|
+
* dates and times using a single control:
|
|
3978
|
+
*
|
|
3979
|
+
* {@sample Input/InputDateTime/Overview Example}
|
|
3980
|
+
*/
|
|
3981
|
+
export declare class InputDateTime extends InputDate {
|
|
3982
|
+
private _btnTm;
|
|
3983
|
+
private _inputTime;
|
|
3984
|
+
private _ddDate;
|
|
3985
|
+
private _ddTime;
|
|
3986
|
+
/**
|
|
3987
|
+
* Gets or sets the template used to instantiate {@link InputDateTime} controls.
|
|
3988
|
+
*/
|
|
3989
|
+
static controlTemplate: string;
|
|
3990
|
+
/**
|
|
3991
|
+
* Initializes a new instance of the {@link InputDateTime} class.
|
|
3992
|
+
*
|
|
3993
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
3994
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
3995
|
+
*/
|
|
3996
|
+
constructor(element: any, options?: any);
|
|
3997
|
+
/**
|
|
3998
|
+
* Gets or sets the earliest time that the user can enter.
|
|
3999
|
+
*
|
|
4000
|
+
* The default value for this property is **null**, which means there
|
|
4001
|
+
* is no earliest time limit.
|
|
4002
|
+
*/
|
|
4003
|
+
timeMin: Date;
|
|
4004
|
+
/**
|
|
4005
|
+
* Gets or sets the latest time that the user can enter.
|
|
4006
|
+
*
|
|
4007
|
+
* The default value for this property is **null**, which means there
|
|
4008
|
+
* is no latest time limit.
|
|
4009
|
+
*/
|
|
4010
|
+
timeMax: Date;
|
|
4011
|
+
/**
|
|
4012
|
+
* Gets or sets the format used to display times in the drop-down list.
|
|
4013
|
+
*
|
|
4014
|
+
* This property does not affect the value shown in the control's input element.
|
|
4015
|
+
* That value is formatted using the {@link format} property.
|
|
4016
|
+
*
|
|
4017
|
+
* The format string is expressed as a .NET-style
|
|
4018
|
+
* <a href="https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings" target="_blank">
|
|
4019
|
+
* time format string</a>.
|
|
4020
|
+
*
|
|
4021
|
+
* The default value for this property is **'t'** (short time pattern).
|
|
4022
|
+
*/
|
|
4023
|
+
timeFormat: string;
|
|
4024
|
+
/**
|
|
4025
|
+
* Gets or sets the number of minutes between entries in the
|
|
4026
|
+
* drop-down list of times.
|
|
4027
|
+
*
|
|
4028
|
+
* The default value for this property is **15** minutes.
|
|
4029
|
+
*
|
|
4030
|
+
* Setting this property to **null**, zero, or any negative value
|
|
4031
|
+
* disables the time-picker and hides the time drop-down button.
|
|
4032
|
+
*
|
|
4033
|
+
* Only the integer part of the step value is used. Setting
|
|
4034
|
+
* **timeStep** to **30.5** for example will create **30**
|
|
4035
|
+
* minute intervals.
|
|
4036
|
+
*/
|
|
4037
|
+
timeStep: number | null;
|
|
4038
|
+
/**
|
|
4039
|
+
* Gets a reference to the inner {@link InputTime} control so you can access its
|
|
4040
|
+
* full object model.
|
|
4041
|
+
*/
|
|
4042
|
+
readonly inputTime: InputTime;
|
|
4043
|
+
protected _fromDateTime(value: Date): Date;
|
|
4044
|
+
protected _btnclick(e: MouseEvent): void;
|
|
4045
|
+
dispose(): void;
|
|
4046
|
+
refresh(fullUpdate?: boolean): void;
|
|
4047
|
+
protected _updateBtn(): void;
|
|
4048
|
+
protected _setDropdown(e: HTMLElement): boolean;
|
|
4049
|
+
_updateDropDown(): void;
|
|
4050
|
+
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Represents a method that returns data items asynchronously as the user types.
|
|
4053
|
+
*/
|
|
4054
|
+
export interface IGetItems {
|
|
4055
|
+
/**
|
|
4056
|
+
* @param query Query string typed by the user.
|
|
4057
|
+
* @param maxItems Maximum number of items to return.
|
|
4058
|
+
* @param callback Callback function to invoke when the results become available.
|
|
4059
|
+
*/
|
|
4060
|
+
(query: string, maxItems: number, callback: IGetItemsCallback): void;
|
|
4061
|
+
}
|
|
4062
|
+
/**
|
|
4063
|
+
* Represents a method to invoke when the data items become available.
|
|
4064
|
+
*/
|
|
4065
|
+
export interface IGetItemsCallback {
|
|
4066
|
+
/**
|
|
4067
|
+
* items Array of data items retrieved asynchrounously.
|
|
4068
|
+
* */
|
|
4069
|
+
(items: any[]): void;
|
|
4070
|
+
}
|
|
4071
|
+
/**
|
|
4072
|
+
* The {@link AutoComplete} control is an input control that allows callers
|
|
4073
|
+
* to customize the item list as the user types.
|
|
4074
|
+
*
|
|
4075
|
+
* The control is similar to the {@link ComboBox}, except the item source is a
|
|
4076
|
+
* function ({@link itemsSourceFunction}) rather than a static list. For example,
|
|
4077
|
+
* you can look up items on remote databases as the user types.
|
|
4078
|
+
*
|
|
4079
|
+
* The example below creates an {@link AutoComplete} control and populates it using
|
|
4080
|
+
* a 'countries' array. The {@link AutoComplete} searches for the country as the user
|
|
4081
|
+
* types, and narrows down the list of countries that match the current input.
|
|
4082
|
+
*
|
|
4083
|
+
* {@sample Input/AutoComplete/Overview/purejs Example}
|
|
4084
|
+
*/
|
|
4085
|
+
export declare class AutoComplete extends ComboBox {
|
|
4086
|
+
private _cssMatch;
|
|
4087
|
+
private _itemsSourceFn;
|
|
4088
|
+
private _itemsSourceFnCallbackBnd;
|
|
4089
|
+
private _srchProp;
|
|
4090
|
+
private _minLength;
|
|
4091
|
+
private _maxItems;
|
|
4092
|
+
private _itemCount;
|
|
4093
|
+
private _beginsWith;
|
|
4094
|
+
private _delay;
|
|
4095
|
+
private _toSearch;
|
|
4096
|
+
private _query;
|
|
4097
|
+
private _rxSrch;
|
|
4098
|
+
private _rxHighlight;
|
|
4099
|
+
private _inCallback;
|
|
4100
|
+
private _srchProps;
|
|
4101
|
+
private _oldSelectedIndex;
|
|
4102
|
+
/**
|
|
4103
|
+
* Initializes a new instance of the {@link AutoComplete} class.
|
|
4104
|
+
*
|
|
4105
|
+
* @param element The DOM element that hosts the control, or a selector for the host element (e.g. '#theCtrl').
|
|
4106
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
4107
|
+
*/
|
|
4108
|
+
constructor(element: any, options?: any);
|
|
4109
|
+
/**
|
|
4110
|
+
* Gets or sets the minimum input length to trigger auto-complete suggestions.
|
|
4111
|
+
*
|
|
4112
|
+
* The default value for this property is **2**.
|
|
4113
|
+
*/
|
|
4114
|
+
minLength: number;
|
|
4115
|
+
/**
|
|
4116
|
+
* Gets or sets a value that determines whether to search for items
|
|
4117
|
+
* that begin with the given search term.
|
|
4118
|
+
*
|
|
4119
|
+
* The default value for this property is **false**, which causes
|
|
4120
|
+
* the control to search for items that contain the given search
|
|
4121
|
+
* terms.
|
|
4122
|
+
*/
|
|
4123
|
+
beginsWithSearch: boolean;
|
|
4124
|
+
/**
|
|
4125
|
+
* Gets or sets the maximum number of items to display in the drop-down list.
|
|
4126
|
+
*
|
|
4127
|
+
* The default value for this property is **6**.
|
|
4128
|
+
*/
|
|
4129
|
+
maxItems: number;
|
|
4130
|
+
/**
|
|
4131
|
+
* Gets or sets the delay, in milliseconds, between when a keystroke occurs
|
|
4132
|
+
* and when the search is performed.
|
|
4133
|
+
*
|
|
4134
|
+
* The default value for this property is **500** milliseconds.
|
|
4135
|
+
*/
|
|
4136
|
+
delay: number;
|
|
4137
|
+
/**
|
|
4138
|
+
* Gets or sets a string containing a comma-separated list of properties to use
|
|
4139
|
+
* when searching for items.
|
|
4140
|
+
*
|
|
4141
|
+
* By default, the {@link AutoComplete} control searches for matches against the
|
|
4142
|
+
* property specified by the {@link displayMemberPath} property.
|
|
4143
|
+
* The {@link searchMemberPath} property allows you to search using additional
|
|
4144
|
+
* properties.
|
|
4145
|
+
*
|
|
4146
|
+
* For example, the code below would cause the control to display the company
|
|
4147
|
+
* name and search by company name, symbol, and country:
|
|
4148
|
+
*
|
|
4149
|
+
* ```typescript
|
|
4150
|
+
* import { AutoComplete } from '@grapecity/wijmo.input';
|
|
4151
|
+
* var ac = new AutoComplete('#autoComplete', {
|
|
4152
|
+
* itemsSource: companies,
|
|
4153
|
+
* displayMemberPath: 'name',
|
|
4154
|
+
* searchMemberPath: 'symbol,country'
|
|
4155
|
+
* });
|
|
4156
|
+
* ```
|
|
4157
|
+
*/
|
|
4158
|
+
searchMemberPath: string;
|
|
4159
|
+
/**
|
|
4160
|
+
* Gets or sets a function that provides list items dynamically as the user types.
|
|
4161
|
+
*
|
|
4162
|
+
* The function takes three parameters:
|
|
4163
|
+
* <ul>
|
|
4164
|
+
* <li>the query string typed by the user</li>
|
|
4165
|
+
* <li>the maximum number of items to return</li>
|
|
4166
|
+
* <li>the callback function to call when the results become available</li>
|
|
4167
|
+
* </ul>
|
|
4168
|
+
*
|
|
4169
|
+
* For example:
|
|
4170
|
+
*
|
|
4171
|
+
* ```typescript
|
|
4172
|
+
* autoComplete.itemsSourceFunction: (query: string, max: number, callback: Function) => {
|
|
4173
|
+
*
|
|
4174
|
+
* // query the server
|
|
4175
|
+
* httpRequest('https://services.odata.org/Northwind/Northwind.svc/Products', {
|
|
4176
|
+
* data: {
|
|
4177
|
+
* $format: 'json',
|
|
4178
|
+
* $select: 'ProductID,ProductName',
|
|
4179
|
+
* $filter: 'indexof(ProductName, \'' + query + '\') gt -1'
|
|
4180
|
+
* },
|
|
4181
|
+
* success: (xhr: XMLHttpRequest) => {
|
|
4182
|
+
*
|
|
4183
|
+
* // return results to AutoComplete control
|
|
4184
|
+
* let response = JSON.parse(xhr.response);
|
|
4185
|
+
* callback(response.d ? response.d.results : response.value);
|
|
4186
|
+
* }
|
|
4187
|
+
* });
|
|
4188
|
+
* }
|
|
4189
|
+
* ```
|
|
4190
|
+
*/
|
|
4191
|
+
itemsSourceFunction: IGetItems;
|
|
4192
|
+
/**
|
|
4193
|
+
* Gets or sets the name of the CSS class used to highlight any parts
|
|
4194
|
+
* of the content that match the search terms.
|
|
4195
|
+
*
|
|
4196
|
+
* The default value for this property is **wj-state-match**.
|
|
4197
|
+
*/
|
|
4198
|
+
cssMatch: string;
|
|
4199
|
+
/**
|
|
4200
|
+
* Raises the {@link selectedIndexChanged} event.
|
|
4201
|
+
*/
|
|
4202
|
+
onSelectedIndexChanged(e?: EventArgs): void;
|
|
4203
|
+
_keydown(e: KeyboardEvent): void;
|
|
4204
|
+
_setText(text: string | null): void;
|
|
4205
|
+
onLostFocus(e?: EventArgs): void;
|
|
4206
|
+
_itemSourceFunctionCallback(result: any[]): void;
|
|
4207
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
4208
|
+
protected _updateItems(): void;
|
|
4209
|
+
protected _filter(item: any): boolean;
|
|
4210
|
+
protected _getItemText(item: any, header: boolean): string;
|
|
4211
|
+
protected _formatListItem(sender: any, e: FormatItemEventArgs): void;
|
|
4212
|
+
private _enclosed;
|
|
4213
|
+
protected _wheel(e: WheelEvent): void;
|
|
4214
|
+
}
|
|
4215
|
+
/**
|
|
4216
|
+
* The {@link MultiAutoComplete} control allows users to pick items from lists
|
|
4217
|
+
* that contain custom objects or simple strings.
|
|
4218
|
+
*
|
|
4219
|
+
* The example below shows how you can use a {@link MultiAutoComplete} to
|
|
4220
|
+
* enter multiple items picked from a single list:
|
|
4221
|
+
*
|
|
4222
|
+
* {@sample Input/MultiAutoComplete/Overview Example}
|
|
4223
|
+
*/
|
|
4224
|
+
export declare class MultiAutoComplete extends AutoComplete {
|
|
4225
|
+
private _wjTpl;
|
|
4226
|
+
private _wjInput;
|
|
4227
|
+
private _helperInput;
|
|
4228
|
+
private _selItems;
|
|
4229
|
+
private _maxSelItems;
|
|
4230
|
+
private _lastInputValue;
|
|
4231
|
+
private _selPath;
|
|
4232
|
+
private _notAddItm;
|
|
4233
|
+
static _clsActive: string;
|
|
4234
|
+
/**
|
|
4235
|
+
* Initializes a new instance of the {@link MultiAutoComplete} class.
|
|
4236
|
+
*
|
|
4237
|
+
* @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').
|
|
4238
|
+
* @param options The JavaScript object containing initialization data for the control.
|
|
4239
|
+
*/
|
|
4240
|
+
constructor(element: any, options?: any);
|
|
4241
|
+
/**
|
|
4242
|
+
* Overridden to prevent the control from showing the drop-down button.
|
|
4243
|
+
*/
|
|
4244
|
+
showDropDownButton: boolean;
|
|
4245
|
+
/**
|
|
4246
|
+
* Gets or sets the maximum number of items that can be selected.
|
|
4247
|
+
*
|
|
4248
|
+
* The default value for this property is **null**, which allows
|
|
4249
|
+
* users to pick any number of items.
|
|
4250
|
+
*/
|
|
4251
|
+
maxSelectedItems: number;
|
|
4252
|
+
/**
|
|
4253
|
+
* Gets or sets the name of the property used to control which
|
|
4254
|
+
* item will be selected.
|
|
4255
|
+
*/
|
|
4256
|
+
selectedMemberPath: string;
|
|
4257
|
+
/**
|
|
4258
|
+
* Gets or sets an array containing the items that are currently
|
|
4259
|
+
* selected.
|
|
4260
|
+
*/
|
|
4261
|
+
selectedItems: any[];
|
|
4262
|
+
/**
|
|
4263
|
+
* Occurs when the value of the {@link selectedItems} property changes.
|
|
4264
|
+
*/
|
|
4265
|
+
readonly selectedItemsChanged: Event<MultiAutoComplete, EventArgs>;
|
|
4266
|
+
/**
|
|
4267
|
+
* Raises the {@link selectedItemsChanged} event.
|
|
4268
|
+
*/
|
|
4269
|
+
onSelectedItemsChanged(e?: EventArgs): void;
|
|
4270
|
+
onIsDroppedDownChanged(e?: EventArgs): void;
|
|
4271
|
+
refresh(fullUpdate?: boolean): void;
|
|
4272
|
+
_keydown(e: KeyboardEvent): void;
|
|
4273
|
+
protected _updateState(): void;
|
|
4274
|
+
protected _keyup(e: KeyboardEvent): void;
|
|
4275
|
+
private _addHelperInput;
|
|
4276
|
+
private _refreshHeader;
|
|
4277
|
+
private _insertToken;
|
|
4278
|
+
private _updateMaxItems;
|
|
4279
|
+
private _updateFocus;
|
|
4280
|
+
private _addItem;
|
|
4281
|
+
private _delItem;
|
|
4282
|
+
private _updateSelItems;
|
|
4283
|
+
private _createItem;
|
|
4284
|
+
private _itemOn;
|
|
4285
|
+
private _itemOff;
|
|
4286
|
+
private _initSeltems;
|
|
4287
|
+
private _getSelItem;
|
|
4288
|
+
private _setSelItem;
|
|
4289
|
+
private _clearSelIndex;
|
|
4290
|
+
private _hasSelectedMemeberPath;
|
|
4291
|
+
private _disableInput;
|
|
4292
|
+
private _adjustInputWidth;
|
|
4293
|
+
private _getItemIndex;
|
|
4294
|
+
_setIsDisabled(value: boolean): void;
|
|
4295
|
+
_setTabOrder(value: number): void;
|
|
4296
|
+
_updateTabIndex(): void;
|
|
4297
|
+
}
|
|
4298
|
+
export {};
|