import { DayOfWeek } from 'office-ui-fabric-react/lib/utilities/dateValues/DateValues' ; import * as React from 'react' ; import * as ReactDom from 'react-dom' ; import { IPropertyPaneField , PropertyPaneFieldType , IPropertyPaneCustomFieldProps } from '@microsoft/sp-webpart-base' ; import { IPropertyFieldDateTimePickerHostProps } from './IPropertyFieldDateTimePickerHost' ; import PropertyFieldDateTimePickerHost from './PropertyFieldDateTimePickerHost' ; import { IDateTimeFieldValue , IPropertyFieldDateTimePickerPropsInternal , TimeConvention , IPropertyFieldDateTimePickerProps , DateConvention } from './IPropertyFieldDateTimePicker' ; /**
 * Represents a PropertyFieldDateTimePicker object
 */ class PropertyFieldDateTimePickerBuilder implements IPropertyPaneField < IPropertyFieldDateTimePickerPropsInternal > { public type : PropertyPaneFieldType = PropertyPaneFieldType . Custom ; public targetProperty : string ; public properties : IPropertyFieldDateTimePickerPropsInternal ; private label : string ; private disabled : boolean = false ; private initialDate : IDateTimeFieldValue ; private formatDate : ( date : Date ) => string ; private dateConvention : DateConvention ; private timeConvention : TimeConvention ; private firstDayOfWeek : DayOfWeek ; private onPropertyChange : ( propertyPath : string , oldValue : any , newValue : any ) => void ; private customProperties : any ; private key : string ; private onGetErrorMessage : ( value : string ) => string | Promise < string > ; private deferredValidationTime : number = 200 ; private showLabels : boolean = true ; /**
     * Constructor
     */ public constructor ( _targetProperty , _properties ) { this . render = this . render . bind ( this ) ; this . targetProperty = _properties . targetProperty ; this . properties = _properties ; this . label = _properties . label ; this . initialDate = _properties . initialDate ; this . properties . onDispose = this . dispose ; this . properties . onRender = this . render ; this . onPropertyChange = _properties . onPropertyChange ; this . formatDate = _properties . formatDate ; this . customProperties = _properties . properties ; this . key = _properties . key ; this . onGetErrorMessage = _properties . onGetErrorMessage ; if ( _properties . deferredValidationTime ) { this . deferredValidationTime = _properties . deferredValidationTime ; } if ( typeof _properties . disabled !== 'undefined' ) { this . disabled = _properties . disabled ; } if ( typeof _properties . dateConvention !== 'undefined' ) { this . dateConvention = _properties . dateConvention ; } else { this . dateConvention = DateConvention . DateTime ; } if ( typeof _properties . timeConvention !== 'undefined' ) { this . timeConvention = _properties . timeConvention ; } else { this . timeConvention = TimeConvention . Hours24 ; } if ( typeof _properties . firstDayOfWeek !== 'undefined' ) { this . firstDayOfWeek = _properties . firstDayOfWeek ; } else { this . firstDayOfWeek = DayOfWeek . Sunday ; } this . showLabels = _properties . showLabels ; } /**
     * Renders the DatePicker field content
     */ private render ( elem , ctx ? , changeCallback ? ) { const element = React . createElement ( PropertyFieldDateTimePickerHost , { label : this . label , disabled : this . disabled , initialDate : this . initialDate , targetProperty : this . targetProperty , formatDate : this . formatDate , dateConvention : this . dateConvention , timeConvention : this . timeConvention , firstDayOfWeek : this . firstDayOfWeek , onDispose : this . dispose , onRender : this . render , onPropertyChange : this . onPropertyChange , onChange : changeCallback , properties : this . customProperties , key : this . key , onGetErrorMessage : this . onGetErrorMessage , deferredValidationTime : this . deferredValidationTime , showLabels : this . showLabels } ) ; ReactDom . render ( element , elem ) ; } /**
     * Disposes the current object
     */ private dispose ( elem ) { } } param targetProperty param properties export function PropertyFieldDateTimePicker ( targetProperty , properties ) { return new PropertyFieldDateTimePickerBuilder ( targetProperty , { ... properties , targetProperty : targetProperty , onDispose : null , onRender : null } ) ; }