@@ -91,7 +91,18 @@ export class MgtPerson extends MgtTemplatedComponent {
9191 @property ( {
9292 attribute : 'person-query'
9393 } )
94- public personQuery : string ;
94+ public get personQuery ( ) : string {
95+ return this . _personQuery ;
96+ }
97+ public set personQuery ( value : string ) {
98+ if ( value === this . _personQuery ) {
99+ return ;
100+ }
101+
102+ this . _personQuery = value ;
103+ this . personDetails = null ;
104+ this . requestStateUpdate ( ) ;
105+ }
95106
96107 /**
97108 * user-id property allows developer to use id value to determine person
@@ -100,7 +111,18 @@ export class MgtPerson extends MgtTemplatedComponent {
100111 @property ( {
101112 attribute : 'user-id'
102113 } )
103- public userId : string ;
114+ public get userId ( ) : string {
115+ return this . _userId ;
116+ }
117+ public set userId ( value : string ) {
118+ if ( value === this . _userId ) {
119+ return ;
120+ }
121+
122+ this . _userId = value ;
123+ this . personDetails = null ;
124+ this . requestStateUpdate ( ) ;
125+ }
104126
105127 /**
106128 * determines if person component renders user-name
@@ -318,6 +340,8 @@ export class MgtPerson extends MgtTemplatedComponent {
318340 private _personAvatarBg : string ;
319341 private _personImage : string ;
320342 private _personPresence : MicrosoftGraphBeta . Presence ;
343+ private _personQuery : string ;
344+ private _userId : string ;
321345
322346 private _mouseLeaveTimeout ;
323347 private _mouseEnterTimeout ;
@@ -334,30 +358,6 @@ export class MgtPerson extends MgtTemplatedComponent {
334358 this . _isInvalidImageSrc = false ;
335359 }
336360
337- /**
338- * Synchronizes property values when attributes change.
339- *
340- * @param {* } name
341- * @param {* } oldValue
342- * @param {* } newValue
343- * @memberof MgtPerson
344- */
345- public attributeChangedCallback ( name , oldval , newval ) {
346- super . attributeChangedCallback ( name , oldval , newval ) ;
347-
348- if ( oldval === newval ) {
349- return ;
350- }
351-
352- switch ( name ) {
353- case 'person-query' :
354- case 'user-id' :
355- this . personDetails = null ;
356- this . requestStateUpdate ( ) ;
357- break ;
358- }
359- }
360-
361361 /**
362362 * Invoked on each update to perform rendering tasks. This method must return
363363 * a lit-html TemplateResult. Setting properties inside this method will *not*
@@ -386,9 +386,7 @@ export class MgtPerson extends MgtTemplatedComponent {
386386 const imageWithPresenceTemplate : TemplateResult = this . renderAvatar ( person , image , presence ) ;
387387
388388 personTemplate = html `
389- < div class ="person-root ">
390- ${ imageWithPresenceTemplate } ${ detailsTemplate }
391- </ div >
389+ < div class ="person-root "> ${ imageWithPresenceTemplate } ${ detailsTemplate } </ div >
392390 ` ;
393391 }
394392
@@ -568,9 +566,7 @@ export class MgtPerson extends MgtTemplatedComponent {
568566 if ( statusClass === 'presence-oof-offline' ) {
569567 iconHtml = html `
570568 < div class ="ms-Icon presence-basic presence-oof-offline-wrapper ">
571- < i class ="presence-oof-offline ">
572- ${ getSvg ( SvgIcon . SkypeArrow , '#666666' ) }
573- </ i >
569+ < i class ="presence-oof-offline "> ${ getSvg ( SvgIcon . SkypeArrow , '#666666' ) } </ i >
574570 </ div >
575571 ` ;
576572 } else {
@@ -580,9 +576,7 @@ export class MgtPerson extends MgtTemplatedComponent {
580576 }
581577
582578 return html `
583- < div class ="user-presence " title =${ presence . activity } aria-label =${ presence . activity } >
584- ${ iconHtml }
585- </ div >
579+ < div class ="user-presence " title =${ presence . activity } aria-label =${ presence . activity } > ${ iconHtml } </ div >
586580 ` ;
587581 }
588582
@@ -618,9 +612,7 @@ export class MgtPerson extends MgtTemplatedComponent {
618612 const presenceTemplate : TemplateResult = this . renderPresence ( presence ) ;
619613
620614 return html `
621- < div class =${ classMap ( imageClasses ) } title =${ title } aria-label=${ title } >
622- ${ imageTemplate } ${ presenceTemplate }
623- </ div >
615+ < div class =${ classMap ( imageClasses ) } title =${ title } aria-label=${ title } > ${ imageTemplate } ${ presenceTemplate } </ div >
624616 ` ;
625617 }
626618
@@ -643,18 +635,22 @@ export class MgtPerson extends MgtTemplatedComponent {
643635 if ( this . showName || this . view > PersonViewType . avatar ) {
644636 const text = this . getTextFromProperty ( person , this . line1Property ) ;
645637 if ( text ) {
646- details . push ( html `
647- < div class ="line1 " aria-label ="${ text } "> ${ text } </ div >
648- ` ) ;
638+ details . push (
639+ html `
640+ < div class ="line1 " aria-label ="${ text } "> ${ text } </ div >
641+ `
642+ ) ;
649643 }
650644 }
651645
652646 if ( this . showEmail || this . view > PersonViewType . oneline ) {
653647 const text = this . getTextFromProperty ( person , this . line2Property ) ;
654648 if ( text ) {
655- details . push ( html `
656- < div class ="line2 " aria-label ="${ text } "> ${ text } </ div >
657- ` ) ;
649+ details . push (
650+ html `
651+ < div class ="line2 " aria-label ="${ text } "> ${ text } </ div >
652+ `
653+ ) ;
658654 }
659655 }
660656
@@ -664,9 +660,7 @@ export class MgtPerson extends MgtTemplatedComponent {
664660 } ) ;
665661
666662 return html `
667- < div class ="${ detailsClasses } ">
668- ${ details }
669- </ div >
663+ < div class ="${ detailsClasses } "> ${ details } </ div >
670664 ` ;
671665 }
672666
@@ -685,16 +679,12 @@ export class MgtPerson extends MgtTemplatedComponent {
685679 ) : TemplateResult {
686680 const flyoutContent = this . _personCardShouldRender
687681 ? html `
688- < div slot ="flyout ">
689- ${ this . renderFlyoutContent ( personDetails , image , presence ) }
690- </ div >
682+ < div slot ="flyout "> ${ this . renderFlyoutContent ( personDetails , image , presence ) } </ div >
691683 `
692684 : html `` ;
693685
694686 return html `
695- < mgt-flyout light-dismiss class ="flyout ">
696- ${ anchor } ${ flyoutContent }
697- </ mgt-flyout >
687+ < mgt-flyout light-dismiss class ="flyout "> ${ anchor } ${ flyoutContent } </ mgt-flyout >
698688 ` ;
699689 }
700690
0 commit comments