@@ -63,53 +63,99 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
63
63
64
64
/**
65
65
* Emitted when item selection is changing, before the selection completes
66
+ *
67
+ * ```html
68
+ * <igx-drop-down (onSelection)='handleSelection()'></igx-drop-down>
69
+ * ```
66
70
*/
67
71
@Output ( )
68
72
public onSelection = new EventEmitter < ISelectionEventArgs > ( ) ;
69
73
70
74
/**
71
75
* Emitted before the dropdown is opened
76
+ *
77
+ * ```html
78
+ * <igx-drop-down (onOpening)='handleOpening()'></igx-drop-down>
79
+ * ```
72
80
*/
73
81
@Output ( )
74
82
public onOpening = new EventEmitter ( ) ;
75
83
76
84
/**
77
85
* Emitted after the dropdown is opened
86
+ *
87
+ * ```html
88
+ * <igx-drop-down (onOpened)='handleOpened()'></igx-drop-down>
89
+ * ```
78
90
*/
79
91
@Output ( )
80
92
public onOpened = new EventEmitter ( ) ;
81
93
82
94
/**
83
95
* Emitted before the dropdown is closed
96
+ *
97
+ * ```html
98
+ * <igx-drop-down (onClosing)='handleClosing()'></igx-drop-down>
99
+ * ```
84
100
*/
85
101
@Output ( )
86
102
public onClosing = new EventEmitter ( ) ;
87
103
88
104
/**
89
105
* Emitted after the dropdown is closed
106
+ *
107
+ * ```html
108
+ * <igx-drop-down (onClosed)='handleClosed()'></igx-drop-down>
109
+ * ```
90
110
*/
91
111
@Output ( )
92
112
public onClosed = new EventEmitter ( ) ;
93
113
94
114
/**
95
- * Gets/sets the width of the drop down
115
+ * Gets the width of the drop down
116
+ *
117
+ * ```typescript
118
+ * // get
119
+ * let myDropDownCurrentWidth = this.dropdown.width;
120
+ * ```
96
121
*/
97
122
@Input ( )
98
123
get width ( ) {
99
124
return this . _width ;
100
125
}
126
+ /**
127
+ * Sets the width of the drop down
128
+ *
129
+ * ```html
130
+ * <!--set-->
131
+ * <igx-drop-down [width]='160px'></igx-drop-down>
132
+ * ```
133
+ */
101
134
set width ( value ) {
102
135
this . _width = value ;
103
136
this . toggleDirective . element . style . width = value ;
104
137
}
105
138
106
139
/**
107
- * Gets/sets the height of the drop down
140
+ * Gets the height of the drop down
141
+ *
142
+ * ```typescript
143
+ * // get
144
+ * let myDropDownCurrentHeight = this.dropdown.height;
145
+ * ```
108
146
*/
109
147
@Input ( )
110
148
get height ( ) {
111
149
return this . _height ;
112
150
}
151
+ /**
152
+ * Sets the height of the drop down
153
+ *
154
+ * ```html
155
+ * <!--set-->
156
+ * <igx-drop-down [height]='400px'></igx-drop-down>
157
+ * ```
158
+ */
113
159
set height ( value ) {
114
160
this . _height = value ;
115
161
this . toggleDirective . element . style . height = value ;
@@ -118,31 +164,62 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
118
164
/**
119
165
* Gets/sets whether items will be able to take focus. If set to true, default value,
120
166
* user will be able to use keyboard navigation.
167
+ *
168
+ * ```typescript
169
+ * // get
170
+ * let dropDownAllowsItemFocus = this.dropdown.allowItemsFocus;
171
+ * ```
172
+ *
173
+ * ```html
174
+ * <!--set-->
175
+ * <igx-drop-down [allowItemsFocus]='true'></igx-drop-down>
176
+ * ```
121
177
*/
122
178
@Input ( )
123
179
public allowItemsFocus = true ;
124
180
125
181
/**
126
- * Gets/sets the drop down's id
182
+ * Gets the drop down's id
183
+ *
184
+ * ```typescript
185
+ * // get
186
+ * let myDropDownCurrentId = this.dropdown.id;
187
+ * ```
127
188
*/
128
189
@Input ( )
129
190
get id ( ) : string {
130
191
return this . _id ;
131
192
}
193
+ /**
194
+ * Sets the drop down's id
195
+ *
196
+ * ```html
197
+ * <!--set-->
198
+ * <igx-drop-down [id]='newDropDownId'></igx-drop-down>
199
+ * ```
200
+ */
132
201
set id ( value : string ) {
133
202
this . _id = value ;
134
203
this . toggleDirective . id = value ;
135
204
}
136
205
137
206
/**
138
207
* Gets if the dropdown is collapsed
208
+ *
209
+ * ```typescript
210
+ * let isCollapsed = this.dropdown.collapsed;
211
+ * ```
139
212
*/
140
213
public get collapsed ( ) : boolean {
141
214
return this . toggleDirective . collapsed ;
142
215
}
143
216
144
217
/**
145
218
* Get currently selected item
219
+ *
220
+ * ```typescript
221
+ * let currentItem = this.dropdown.selectedItem;
222
+ * ```
146
223
*/
147
224
public get selectedItem ( ) : IgxDropDownItemComponent {
148
225
const selection = this . selectionAPI . get_selection ( this . id ) ;
@@ -151,6 +228,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
151
228
152
229
/**
153
230
* Get all non-header items
231
+ *
232
+ * ```typescript
233
+ * let myDropDownItems = this.dropdown.items;
234
+ * ```
154
235
*/
155
236
public get items ( ) : IgxDropDownItemComponent [ ] {
156
237
const items : IgxDropDownItemComponent [ ] = [ ] ;
@@ -167,6 +248,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
167
248
168
249
/**
169
250
* Get all header items
251
+ *
252
+ * ```typescript
253
+ * let myDropDownHeaderItems = this.dropdown.headers;
254
+ * ```
170
255
*/
171
256
public get headers ( ) : IgxDropDownItemComponent [ ] {
172
257
const headers : IgxDropDownItemComponent [ ] = [ ] ;
@@ -183,6 +268,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
183
268
184
269
/**
185
270
* Get dropdown html element
271
+ *
272
+ * ```typescript
273
+ * let myDropDownElement = this.dropdown.element;
274
+ * ```
186
275
*/
187
276
public get element ( ) {
188
277
return this . elementRef . nativeElement ;
@@ -212,20 +301,32 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
212
301
213
302
/**
214
303
* Opens the dropdown
304
+ *
305
+ * ```typescript
306
+ * this.dropdown.open();
307
+ * ```
215
308
*/
216
309
open ( ) {
217
310
this . toggleDirective . open ( true ) ;
218
311
}
219
312
220
313
/**
221
314
* Closes the dropdown
315
+ *
316
+ * ```typescript
317
+ * this.dropdown.close();
318
+ * ```
222
319
*/
223
320
close ( ) {
224
321
this . toggleDirective . close ( true ) ;
225
322
}
226
323
227
324
/**
228
325
* Toggles the dropdown
326
+ *
327
+ * ```typescript
328
+ * this.dropdown.toggle();
329
+ * ```
229
330
*/
230
331
toggle ( ) {
231
332
if ( this . toggleDirective . collapsed ) {
@@ -235,6 +336,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
235
336
}
236
337
}
237
338
339
+ /**
340
+ * @hidden
341
+ */
238
342
focusFirst ( ) {
239
343
if ( this . _focusedItem ) {
240
344
const focusedItemIndex = - 1 ;
@@ -245,6 +349,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
245
349
}
246
350
}
247
351
352
+ /**
353
+ * @hidden
354
+ */
248
355
focusLast ( ) {
249
356
if ( this . _focusedItem ) {
250
357
const focusedItemIndex = ( this . items . length ) ;
@@ -255,6 +362,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
255
362
}
256
363
}
257
364
365
+ /**
366
+ * @hidden
367
+ */
258
368
focusNext ( ) {
259
369
let focusedItemIndex = - 1 ;
260
370
if ( this . _focusedItem ) {
@@ -266,6 +376,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
266
376
}
267
377
}
268
378
379
+ /**
380
+ * @hidden
381
+ */
269
382
focusPrev ( ) {
270
383
if ( this . _focusedItem ) {
271
384
const focusedItemIndex = this . _focusedItem . index ;
@@ -276,17 +389,27 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
276
389
}
277
390
}
278
391
392
+ /**
393
+ * @hidden
394
+ */
279
395
ngOnInit ( ) {
280
396
this . toggleDirective . id = this . id ;
281
397
}
282
398
399
+
400
+ /**
401
+ * @hidden
402
+ */
283
403
onToggleOpening ( ) {
284
404
this . toggleDirective . collapsed = false ;
285
405
this . cdr . detectChanges ( ) ;
286
406
this . scrollToItem ( this . selectedItem ) ;
287
407
this . onOpening . emit ( ) ;
288
408
}
289
409
410
+ /**
411
+ * @hidden
412
+ */
290
413
onToggleOpened ( ) {
291
414
this . _initiallySelectedItem = this . selectedItem ;
292
415
this . _focusedItem = this . selectedItem ;
@@ -301,10 +424,16 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
301
424
this . onOpened . emit ( ) ;
302
425
}
303
426
427
+ /**
428
+ * @hidden
429
+ */
304
430
onToggleClosing ( ) {
305
431
this . onClosing . emit ( ) ;
306
432
}
307
433
434
+ /**
435
+ * @hidden
436
+ */
308
437
onToggleClosed ( ) {
309
438
if ( this . _focusedItem ) {
310
439
this . _focusedItem . isFocused = false ;
0 commit comments