/**
 * -------------------------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation.  All Rights Reserved.  Licensed under the MIT License.
 * See License in the project root for license information.
 * -------------------------------------------------------------------------------------------
 */ import { MgtTemplatedComponent } from '@microsoft/mgt-element' ; import { html , property , TemplateResult } from 'lit-element' ; import { IDynamicPerson } from '../../../graph/types' ; import { MgtPersonCard } from '../mgt-person-card' ; import '../../sub-components/mgt-spinner/mgt-spinner' ; export class extends MgtTemplatedComponent export abstract class BasePersonCardSection extends MgtTemplatedComponent { type { IDynamicPerson } memberof @ property ( { attribute : 'person-details' , type : Object } ) public get personDetails ( ) : IDynamicPerson { return this . _personDetails ; } public set personDetails ( value ) { if ( this . _personDetails === value ) { return ; } this . _personDetails = value ; this . requestStateUpdate ( ) ; } abstract type { string } memberof public abstract get displayName ( ) : string ; protected type { boolean } memberof protected get isCompact ( ) : boolean { return this . _isCompact ; } private _isCompact : boolean ; private _personDetails : IDynamicPerson ; constructor ( ) { super ( ) ; this . _isCompact = false ; this . _personDetails = null ; } protected abstract returns { TemplateResult } memberof public abstract renderIcon ( ) ; returns memberof public asCompactView ( ) { this . _isCompact = true ; this . requestUpdate ( ) ; return this ; } returns memberof public asFullView ( ) { this . _isCompact = false ; this . requestUpdate ( ) ; return this ; } protected abstract memberof public clearState ( ) { this . _isCompact = false ; this . _personDetails = null ; } /**
     * Invoked on each update to perform rendering tasks. This method must return
     * a lit-html TemplateResult. Setting properties inside this method will *not*
     * trigger the element to update.
     */ protected render ( ) { return this . isCompact ? this . renderCompactView ( ) : this . renderFullView ( ) ; } protected returns { TemplateResult } memberof protected renderLoading ( ) { return html `
      <div class="loading">
        <mgt-spinner></mgt-spinner>
      </div>
    ` ; } protected returns { TemplateResult } memberof protected renderNoData ( ) { return html `
      <div class="no-data">No data</div>
    ` ; } protected abstract returns { TemplateResult } memberof protected abstract renderCompactView ( ) ; protected abstract returns { TemplateResult } memberof protected abstract renderFullView ( ) ; protected memberof protected navigateCard ( person ) { let parent = this . parentNode ; while ( parent ) { parent = parent . parentNode ; if ( parent && parent . host && parent . host . tagName === 'MGT-PERSON-CARD' ) { parent = parent . host ; break ; } } const personCard = parent as MgtPersonCard ; personCard . navigate ( person ) ; } }