import * as React from 'react' ; import styles from './sharePointComponents.module.scss' ; import { FieldComponent , IFieldComponentProps , IFieldComponentState } from './FieldComponent' ; import { ISharePointItem } from '../data/ISharePointItem' ; export interface IItemMultiLookupFieldDisplayProps extends IFieldComponentProps { } export interface IItemMultiLookupFieldDisplayState extends IFieldComponentState { lookupItems : ISharePointItem [ ] ; } export default class ItemMultiLookupFieldDisplay extends FieldComponent < IItemMultiLookupFieldDisplayProps , IItemMultiLookupFieldDisplayState > { public constructor ( props ) { super ( props ) ; } public componentWillMount ( ) { if ( this . props == null || this . props . itemContext == null ) { return ; } if ( this . value != null && this . value . length != null && this . value . length > 0 ) { this . props . itemContext . readListItemsByIds ( this . props . field . LookupList , this . value ) . then ( ( displayItems ) => { this . setState ( { lookupItems : displayItems } ) ; } ) ; } } public render ( ) { if ( this . state == null || this . state . lookupItems == null ) { return < div > < /div>; } return < div className = { styles . itemMultiLookupFieldDisplay } > { this . state . lookupItems . map ( ( sharePointItem , i ) => { return < div key = { i } className = { styles . tag } > { sharePointItem . Title } < /div>; } ) } < /div>; } }