Skip to content

Commit 10e4509

Browse files
authored
Merge branch 'master' into igxDragDrop-directive
2 parents e072bb3 + 0116739 commit 10e4509

File tree

3 files changed

+348
-23
lines changed

3 files changed

+348
-23
lines changed

projects/igniteui-angular/src/lib/drop-down/drop-down.component.ts

+132-3
Original file line numberDiff line numberDiff line change
@@ -63,53 +63,99 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
6363

6464
/**
6565
* Emitted when item selection is changing, before the selection completes
66+
*
67+
* ```html
68+
* <igx-drop-down (onSelection)='handleSelection()'></igx-drop-down>
69+
* ```
6670
*/
6771
@Output()
6872
public onSelection = new EventEmitter<ISelectionEventArgs>();
6973

7074
/**
7175
* Emitted before the dropdown is opened
76+
*
77+
* ```html
78+
* <igx-drop-down (onOpening)='handleOpening()'></igx-drop-down>
79+
* ```
7280
*/
7381
@Output()
7482
public onOpening = new EventEmitter();
7583

7684
/**
7785
* Emitted after the dropdown is opened
86+
*
87+
* ```html
88+
* <igx-drop-down (onOpened)='handleOpened()'></igx-drop-down>
89+
* ```
7890
*/
7991
@Output()
8092
public onOpened = new EventEmitter();
8193

8294
/**
8395
* Emitted before the dropdown is closed
96+
*
97+
* ```html
98+
* <igx-drop-down (onClosing)='handleClosing()'></igx-drop-down>
99+
* ```
84100
*/
85101
@Output()
86102
public onClosing = new EventEmitter();
87103

88104
/**
89105
* Emitted after the dropdown is closed
106+
*
107+
* ```html
108+
* <igx-drop-down (onClosed)='handleClosed()'></igx-drop-down>
109+
* ```
90110
*/
91111
@Output()
92112
public onClosed = new EventEmitter();
93113

94114
/**
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+
* ```
96121
*/
97122
@Input()
98123
get width() {
99124
return this._width;
100125
}
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+
*/
101134
set width(value) {
102135
this._width = value;
103136
this.toggleDirective.element.style.width = value;
104137
}
105138

106139
/**
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+
* ```
108146
*/
109147
@Input()
110148
get height() {
111149
return this._height;
112150
}
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+
*/
113159
set height(value) {
114160
this._height = value;
115161
this.toggleDirective.element.style.height = value;
@@ -118,31 +164,62 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
118164
/**
119165
* Gets/sets whether items will be able to take focus. If set to true, default value,
120166
* 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+
* ```
121177
*/
122178
@Input()
123179
public allowItemsFocus = true;
124180

125181
/**
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+
* ```
127188
*/
128189
@Input()
129190
get id(): string {
130191
return this._id;
131192
}
193+
/**
194+
* Sets the drop down's id
195+
*
196+
* ```html
197+
* <!--set-->
198+
* <igx-drop-down [id]='newDropDownId'></igx-drop-down>
199+
* ```
200+
*/
132201
set id(value: string) {
133202
this._id = value;
134203
this.toggleDirective.id = value;
135204
}
136205

137206
/**
138207
* Gets if the dropdown is collapsed
208+
*
209+
* ```typescript
210+
* let isCollapsed = this.dropdown.collapsed;
211+
* ```
139212
*/
140213
public get collapsed(): boolean {
141214
return this.toggleDirective.collapsed;
142215
}
143216

144217
/**
145218
* Get currently selected item
219+
*
220+
* ```typescript
221+
* let currentItem = this.dropdown.selectedItem;
222+
* ```
146223
*/
147224
public get selectedItem(): IgxDropDownItemComponent {
148225
const selection = this.selectionAPI.get_selection(this.id);
@@ -151,6 +228,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
151228

152229
/**
153230
* Get all non-header items
231+
*
232+
* ```typescript
233+
* let myDropDownItems = this.dropdown.items;
234+
* ```
154235
*/
155236
public get items(): IgxDropDownItemComponent[] {
156237
const items: IgxDropDownItemComponent[] = [];
@@ -167,6 +248,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
167248

168249
/**
169250
* Get all header items
251+
*
252+
* ```typescript
253+
* let myDropDownHeaderItems = this.dropdown.headers;
254+
* ```
170255
*/
171256
public get headers(): IgxDropDownItemComponent[] {
172257
const headers: IgxDropDownItemComponent[] = [];
@@ -183,6 +268,10 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
183268

184269
/**
185270
* Get dropdown html element
271+
*
272+
* ```typescript
273+
* let myDropDownElement = this.dropdown.element;
274+
* ```
186275
*/
187276
public get element() {
188277
return this.elementRef.nativeElement;
@@ -212,20 +301,32 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
212301

213302
/**
214303
* Opens the dropdown
304+
*
305+
* ```typescript
306+
* this.dropdown.open();
307+
* ```
215308
*/
216309
open() {
217310
this.toggleDirective.open(true);
218311
}
219312

220313
/**
221314
* Closes the dropdown
315+
*
316+
* ```typescript
317+
* this.dropdown.close();
318+
* ```
222319
*/
223320
close() {
224321
this.toggleDirective.close(true);
225322
}
226323

227324
/**
228325
* Toggles the dropdown
326+
*
327+
* ```typescript
328+
* this.dropdown.toggle();
329+
* ```
229330
*/
230331
toggle() {
231332
if (this.toggleDirective.collapsed) {
@@ -235,6 +336,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
235336
}
236337
}
237338

339+
/**
340+
* @hidden
341+
*/
238342
focusFirst() {
239343
if (this._focusedItem) {
240344
const focusedItemIndex = - 1;
@@ -245,6 +349,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
245349
}
246350
}
247351

352+
/**
353+
* @hidden
354+
*/
248355
focusLast() {
249356
if (this._focusedItem) {
250357
const focusedItemIndex = (this.items.length);
@@ -255,6 +362,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
255362
}
256363
}
257364

365+
/**
366+
* @hidden
367+
*/
258368
focusNext() {
259369
let focusedItemIndex = -1;
260370
if (this._focusedItem) {
@@ -266,6 +376,9 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
266376
}
267377
}
268378

379+
/**
380+
* @hidden
381+
*/
269382
focusPrev() {
270383
if (this._focusedItem) {
271384
const focusedItemIndex = this._focusedItem.index;
@@ -276,17 +389,27 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
276389
}
277390
}
278391

392+
/**
393+
* @hidden
394+
*/
279395
ngOnInit() {
280396
this.toggleDirective.id = this.id;
281397
}
282398

399+
400+
/**
401+
* @hidden
402+
*/
283403
onToggleOpening() {
284404
this.toggleDirective.collapsed = false;
285405
this.cdr.detectChanges();
286406
this.scrollToItem(this.selectedItem);
287407
this.onOpening.emit();
288408
}
289409

410+
/**
411+
* @hidden
412+
*/
290413
onToggleOpened() {
291414
this._initiallySelectedItem = this.selectedItem;
292415
this._focusedItem = this.selectedItem;
@@ -301,10 +424,16 @@ export class IgxDropDownComponent implements IToggleView, OnInit {
301424
this.onOpened.emit();
302425
}
303426

427+
/**
428+
* @hidden
429+
*/
304430
onToggleClosing() {
305431
this.onClosing.emit();
306432
}
307433

434+
/**
435+
* @hidden
436+
*/
308437
onToggleClosed() {
309438
if (this._focusedItem) {
310439
this._focusedItem.isFocused = false;

0 commit comments

Comments
 (0)