@@ -28,13 +28,22 @@ export enum IgxAvatarType {
28
28
}
29
29
30
30
/**
31
- * **Ignite UI for Angular Avatar** -
32
- * [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/avatar.html)
31
+ * Avatar provides a way to display an image, icon or initials to the user.
32
+ *
33
+ * @igxModule IgxAvatarModule
34
+ *
35
+ * @igxTheme igx-avatar-theme, igx-icon-theme
36
+ *
37
+ * @igxKeywords avatar, profile, picture, initials
38
+ *
39
+ * @igxGroup Layouts
40
+ *
41
+ * @remarks
33
42
*
34
43
* The Ignite UI Avatar provides an easy way to add an avatar icon to your application. This icon can be an
35
- * image, someone's initials or a material icon from the google material icon set.
44
+ * image, someone's initials or a material icon from the Google Material icon set.
36
45
*
37
- * Example:
46
+ * @example
38
47
* ```html
39
48
* <igx-avatar initials="MS" roundShape="true" size="large">
40
49
* </igx-avatar>
@@ -47,43 +56,36 @@ export enum IgxAvatarType {
47
56
export class IgxAvatarComponent implements OnInit , AfterViewInit {
48
57
49
58
/**
50
- * This is a reference to the avatar ` image` element in the DOM.
59
+ * This is a reference to the avatar image element in the DOM.
51
60
*
61
+ * @example
52
62
* ```typescript
53
- * let image = this.avatar.image;
63
+ * let image = this.avatar.image;
54
64
* ```
55
- * @memberof IgxAvatarComponent
56
65
*/
57
66
@ViewChild ( 'image' )
58
67
public image : ElementRef ;
59
68
60
- /**
61
- *@hidden
62
- */
69
+ /** @hidden @internal */
63
70
@ViewChild ( 'defaultTemplate' , { read : TemplateRef , static : true } )
64
71
protected defaultTemplate : TemplateRef < any > ;
65
72
66
- /**
67
- *@hidden
68
- */
73
+ /** @hidden @internal */
69
74
@ViewChild ( 'imageTemplate' , { read : TemplateRef , static : true } )
70
75
protected imageTemplate : TemplateRef < any > ;
71
76
72
- /**
73
- *@hidden
74
- */
77
+ /** @hidden @internal */
75
78
@ViewChild ( 'initialsTemplate' , { read : TemplateRef , static : true } )
76
79
protected initialsTemplate : TemplateRef < any > ;
77
80
78
- /**
79
- *@hidden
80
- */
81
+ /** @hidden @internal */
81
82
@ViewChild ( 'iconTemplate' , { read : TemplateRef , static : true } )
82
83
protected iconTemplate : TemplateRef < any > ;
83
84
84
85
/**
85
- * Returns the `aria-label` of the avatar.
86
+ * Returns the `aria-label` attribute of the avatar.
86
87
*
88
+ * @example
87
89
* ```typescript
88
90
* let ariaLabel = this.avatar.ariaLabel;
89
91
* ```
@@ -95,23 +97,19 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
95
97
/**
96
98
* Returns the `role` attribute of the avatar.
97
99
*
100
+ * @example
98
101
* ```typescript
99
102
* let avatarRole = this.avatar.role;
100
103
* ```
101
- *
102
- * @memberof IgxAvatarComponent
103
104
*/
104
105
@HostBinding ( 'attr.role' )
105
106
public role = 'img' ;
106
107
107
108
/**
108
- * Returns the class of the avatar.
109
+ * Host ` class.igx- avatar` binding .
109
110
*
110
- * ```typescript
111
- * let avatarCLass = this.avatar.cssClass;
112
- * ```
113
- *
114
- * @memberof IgxAvatarComponent
111
+ * @hidden
112
+ * @internal
115
113
*/
116
114
@HostBinding ( 'class.igx-avatar' )
117
115
public cssClass = 'igx-avatar' ;
@@ -124,56 +122,47 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
124
122
* - `"image type avatar"`.
125
123
* - `"custom type avatar"`.
126
124
*
125
+ * @example
127
126
* ```typescript
128
127
* let avatarDescription = this.avatar.roleDescription;
129
128
* ```
130
- *
131
- * @memberof IgxAvatarComponent
132
129
*/
133
130
@HostBinding ( 'attr.aria-roledescription' )
134
131
public roleDescription : string ;
135
132
136
- /**
137
- * @hidden
138
- */
139
- private _size : string | IgxAvatarSize = IgxAvatarSize . SMALL ;
140
-
141
133
/**
142
134
* Sets the `id` of the avatar. If not set, the first avatar component will have `id` = `"igx-avatar-0"`.
143
135
*
136
+ * @example
144
137
* ```html
145
138
* <igx-avatar id="my-first-avatar"></igx-avatar>
146
139
* ```
147
- *
148
- * @memberof IgxAvatarComponent
149
140
*/
150
141
@HostBinding ( 'attr.id' )
151
142
@Input ( )
152
143
public id = `igx-avatar-${ NEXT_ID ++ } ` ;
153
144
154
145
/**
155
- * Sets a round shape to the avatar if `roundShape` is `" true" `.
146
+ * Sets a round shape to the avatar, if `roundShape` is set to ` true`.
156
147
* By default the shape of the avatar is a square.
157
148
*
149
+ * @example
158
150
* ```html
159
- * <igx-avatar roundShape = "true" ></igx-avatar>
151
+ * <igx-avatar roundShape= "true" ></igx-avatar>
160
152
* ```
161
- *
162
- * @memberof IgxAvatarComponent
163
153
*/
164
154
165
155
@HostBinding ( 'class.igx-avatar--rounded' )
166
156
@Input ( )
167
157
public roundShape = false ;
168
158
169
159
/**
170
- * Sets the avatar's ` initials`/`icon` color .
160
+ * Sets the color of the avatar's initials or icon .
171
161
*
162
+ * @example
172
163
*```html
173
164
*<igx-avatar color="blue"></igx-avatar>
174
165
*```
175
- *
176
- * @memberof IgxAvatarComponent
177
166
*/
178
167
179
168
@HostBinding ( 'style.color' )
@@ -183,76 +172,77 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
183
172
/**
184
173
* Sets the background color of the avatar.
185
174
*
175
+ * @example
186
176
* ```html
187
177
* <igx-avatar bgColor="yellow"></igx-avatar>
188
178
* ```
189
- *
190
- * @memberof IgxAvatarComponent
179
+ * @igxFriendlyName Background color
191
180
*/
192
181
193
182
@HostBinding ( 'style.background' )
194
183
@Input ( )
195
184
public bgColor : string ;
196
185
197
186
/**
198
- * Sets ` initials` to the avatar.
187
+ * Sets initials to the avatar.
199
188
*
189
+ * @example
200
190
* ```html
201
191
* <igx-avatar initials="MN"></igx-avatar>
202
192
* ```
203
- *
204
- * @memberof IgxAvatarComponent
205
193
*/
206
194
@Input ( )
207
195
public initials : string ;
208
196
209
197
/**
210
- * Sets an ` icon` to the avatar. All icons from the material icon set are supported.
198
+ * Sets an icon to the avatar. All icons from the material icon set are supported.
211
199
*
200
+ * @example
212
201
* ```html
213
202
* <igx-avatar icon="phone"></igx-avatar>
214
203
* ```
215
- *
216
- * @memberof IgxAvatarComponent
217
204
*/
218
205
@Input ( )
219
206
public icon : string ;
220
207
221
208
/**
222
- * Sets the ` image` source of the avatar.
209
+ * Sets the image source of the avatar.
223
210
*
211
+ * @example
224
212
* ```html
225
213
* <igx-avatar src="images/picture.jpg"></igx-avatar>
226
214
* ```
227
- *
228
- * @memberof IgxAvatarComponent
215
+ * @igxFriendlyName Image URL
229
216
*/
230
217
@Input ( )
231
218
public src : string ;
232
219
233
220
/**
234
- * Returns the `size` of the avatar.
221
+ * @hidden
222
+ * @internal
223
+ */
224
+ private _size : string | IgxAvatarSize = IgxAvatarSize . SMALL ;
225
+ /**
226
+ * Returns the size of the avatar.
235
227
*
228
+ * @example
236
229
* ```typescript
237
- *let avatarSize = this.avatar.size;
230
+ * let avatarSize = this.avatar.size;
238
231
* ```
239
- *
240
- * @memberof IgxAvatarComponent
241
232
*/
242
233
@Input ( )
243
234
public get size ( ) : string | IgxAvatarSize {
244
235
return this . _size ;
245
236
}
246
237
247
238
/**
248
- * Sets the ` size` of the avatar.
249
- * By default the ` size` is `"small"`. It can be set to `"medium"` or `"large"`.
239
+ * Sets the size of the avatar.
240
+ * By default, the size is `"small"`. It can be set to `"medium"` or `"large"`.
250
241
*
251
- * ```
242
+ * @example
243
+ * ```html
252
244
* <igx-avatar size="large"></igx-avatar>
253
245
* ```
254
- *
255
- * @memberof IgxAvatarComponent
256
246
*/
257
247
public set size ( value : string | IgxAvatarSize ) {
258
248
switch ( value ) {
@@ -269,11 +259,10 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
269
259
/**
270
260
* Returns the type of the avatar.
271
261
*
262
+ * @example
272
263
* ```typescript
273
264
* let avatarType = this.avatar.type;
274
265
* ```
275
- *
276
- * @memberof IgxAvatarComponent
277
266
*/
278
267
get type ( ) : IgxAvatarType {
279
268
if ( this . src ) {
@@ -294,11 +283,8 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
294
283
/**
295
284
* Returns the template of the avatar.
296
285
*
297
- * ```typescript
298
- * let template = this.avatar.template;
299
- * ```
300
- *
301
- * @memberof IgxAvatarComponent
286
+ * @hidden
287
+ * @internal
302
288
*/
303
289
get template ( ) : TemplateRef < any > {
304
290
switch ( this . type ) {
@@ -315,16 +301,12 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
315
301
316
302
constructor ( public elementRef : ElementRef ) { }
317
303
318
- /**
319
- * @hidden
320
- */
304
+ /** @hidden @internal */
321
305
public ngOnInit ( ) {
322
306
this . roleDescription = this . getRole ( ) ;
323
307
}
324
308
325
- /**
326
- *@hidden
327
- */
309
+ /** @hidden @internal */
328
310
public ngAfterViewInit ( ) {
329
311
if ( this . type !== IgxAvatarType . CUSTOM ) {
330
312
this . elementRef . nativeElement . classList . add ( `igx-avatar--${ this . type } ` ) ;
@@ -333,9 +315,7 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
333
315
this . elementRef . nativeElement . classList . add ( `igx-avatar--${ this . _size } ` ) ;
334
316
}
335
317
336
- /**
337
- * @hidden
338
- */
318
+ /** @hidden @internal */
339
319
private getRole ( ) : string {
340
320
switch ( this . type ) {
341
321
case IgxAvatarType . IMAGE :
@@ -350,13 +330,10 @@ export class IgxAvatarComponent implements OnInit, AfterViewInit {
350
330
}
351
331
352
332
/**
353
- * Returns the url of the ` image` .
333
+ * Returns the css url of the image.
354
334
*
355
- * ```typescript
356
- * let imageSourceUrl = this.avatar.getSrcUrl();
357
- * ```
358
- *
359
- * @memberof IgxAvatarComponent
335
+ * @hidden
336
+ * @internal
360
337
*/
361
338
public getSrcUrl ( ) {
362
339
return `url(${ this . src } )` ;
0 commit comments