File

core/date-time-picker/date-time-picker.component.ts

Implements

ControlValueAccessor Validator OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(cd: ChangeDetectorRef)
Parameters :
Name Type Optional
cd ChangeDetectorRef No

Inputs

adaptivePosition
Type : boolean
Default value : false
config
Type : DateAndTimeOptions
Default value : { showMeridian: false, showMinutes: true, showSeconds: false, showSpinners: false }
dateInputFormat
Type : string
Default value : 'YYYY-MM-DD'
dateType
Type : DateType
Default value : 'DateAndTime'

Specifies the type of date input.

maxDate
Type : string
minDate
Type : string
placeholder
Type : string
size
Type : string

Outputs

onDateSelected
Type : EventEmitter<PickedDates>

Methods

handleMouseWheel
handleMouseWheel(event: WheelEvent)
Parameters :
Name Type Optional
event WheelEvent No
Returns : void
hide
hide()
Returns : void
nextDay
nextDay()
Returns : void
ngAfterViewInit
ngAfterViewInit()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
previousDay
previousDay()
Returns : void
registerOnChange
registerOnChange(fn: any)
Parameters :
Name Type Optional
fn any No
Returns : void
registerOnTouched
registerOnTouched(onTouched: any)
Parameters :
Name Type Optional
onTouched any No
Returns : void
setDisabledState
setDisabledState(disabled: boolean)
Parameters :
Name Type Optional
disabled boolean No
Returns : void
validate
validate(_control: AbstractControl)
Parameters :
Name Type Optional
_control AbstractControl No
Returns : ValidationErrors | null
writeValue
writeValue(value: string)

Control Value Accessor - If form value changes by external factor, update date property and internal form with new value.

Parameters :
Name Type Optional
value string No
Returns : void

Properties

date
Type : Date
datepicker
Type : BsDatepickerDirective
Decorators :
@ViewChild(BsDatepickerDirective)
defaultPlaceholder
Default value : gettext('Select a dateā€¦')
form
Type : FormGroup
maxDate
Type : Date
minDate
Type : Date
onChange
Type : function
Default value : () => {...}
onTouched
Type : function
Default value : () => {...}

Accessors

_minDate
set_minDate(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
_maxDate
set_maxDate(value: string)
Parameters :
Name Type Optional
value string No
Returns : void
<div
  class="datetime-picker"
  [ngSwitch]="dateType"
>
  <div
    class="d-contents"
    *ngSwitchCase="'DateAndTime'"
    [closeDatepicker]="datepicker"
  >
    <div class="form-group datepicker {{ size ? 'form-group-' + size : '' }}">
      <input
        class="form-control"
        [placeholder]="placeholder || defaultPlaceholder | translate"
        bsDatepicker
        [outsideClick]="false"
        [bsConfig]="{
          customTodayClass: 'today',
          dateInputFormat: dateInputFormat,
          adaptivePosition: adaptivePosition
        }"
        [formControl]="form.get('date')"
        (blur)="onTouched()"
        [minDate]="minDate"
        [maxDate]="maxDate"
      />
    </div>
    <timepicker
      class="form-group {{ size ? 'form-group-' + size : '' }}"
      [formControl]="form.get('time')"
      [showSeconds]="config.showSeconds"
      [showSpinners]="config.showSpinners"
      [showMeridian]="config.showMeridian"
      (wheel)="handleMouseWheel($event)"
    ></timepicker>
  </div>

  <div
    class="d-contents"
    *ngSwitchCase="'Date'"
    [closeDatepicker]="datepicker"
  >
    <div class="form-group datepicker {{ size ? 'form-group-' + size : '' }}">
      <input
        class="form-control"
        [placeholder]="placeholder || defaultPlaceholder | translate"
        bsDatepicker
        [outsideClick]="false"
        [bsConfig]="{
          customTodayClass: 'today',
          dateInputFormat: dateInputFormat,
          adaptivePosition: adaptivePosition
        }"
        [formControl]="form.get('date')"
        (blur)="onTouched()"
        [minDate]="minDate"
        [maxDate]="maxDate"
      />
    </div>
  </div>

  <div
    class="d-contents"
    *ngSwitchCase="'DateRange'"
  >
    <div class="form-group datepicker {{ size ? 'form-group-' + size : '' }}">
      <input
        class="form-control"
        placeholder="{{ 'Select a date range' | translate }}"
        [formControl]="form.get('date')"
        [bsConfig]="{
          customTodayClass: 'today',
          adaptivePosition: true,
          rangeInputFormat: dateInputFormat
        }"
        bsDaterangepicker
      />
    </div>
  </div>

  <div
    class="d-contents"
    *ngSwitchCase="'Time'"
  >
    <timepicker
      class="form-group {{ size ? 'form-group-' + size : '' }}"
      [formControl]="form.get('time')"
      [showSeconds]="config.showSeconds"
      [showSpinners]="config.showSpinners"
      [showMeridian]="config.showMeridian"
      [minutesPlaceholder]="'MM`MINUTES`' | translate"
      [hoursPlaceholder]="'HH`HOURS`' | translate"
      [secondsPlaceholder]="'SS`SECONDS`' | translate"
      (wheel)="handleMouseWheel($event)"
    ></timepicker>
  </div>

  <div *ngSwitchCase="'SingleDateRequired'">
    <div class="form-group {{ size ? 'form-group-' + size : '' }}">
      <c8y-date-picker (onDateSelected)="onDateSelected.emit($event)"></c8y-date-picker>
    </div>
  </div>
</div>

results matching ""

    No results matching ""