|
|
|
@ -35,6 +35,7 @@ import { |
|
|
|
|
forwardRef, |
|
|
|
|
Injector, |
|
|
|
|
Input, |
|
|
|
|
OnInit, |
|
|
|
|
Output, |
|
|
|
|
ViewChild, |
|
|
|
|
ViewEncapsulation, |
|
|
|
@ -68,7 +69,9 @@ export const opSingleDatePickerSelector = 'op-single-date-picker'; |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}) |
|
|
|
|
export class OpSingleDatePickerComponent implements ControlValueAccessor { |
|
|
|
|
export class OpSingleDatePickerComponent implements ControlValueAccessor, OnInit { |
|
|
|
|
@Output('closed') closed = new EventEmitter(); |
|
|
|
|
|
|
|
|
|
@Output('valueChange') valueChange = new EventEmitter(); |
|
|
|
|
|
|
|
|
|
private _value = ''; |
|
|
|
@ -90,7 +93,29 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor { |
|
|
|
|
|
|
|
|
|
@Input() minimalDate:Date|null = null; |
|
|
|
|
|
|
|
|
|
@Input() opened = false; |
|
|
|
|
private _opened = false; |
|
|
|
|
|
|
|
|
|
@Input() set opened(opened:boolean) { |
|
|
|
|
if (this._opened === !!opened) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this._opened = !!opened; |
|
|
|
|
|
|
|
|
|
if (this._opened) { |
|
|
|
|
this.initializeDatepicker(); |
|
|
|
|
} else { |
|
|
|
|
this.closed.emit(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get opened() { |
|
|
|
|
return this.opened; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Input() showIgnoreNonWorkingDays = true; |
|
|
|
|
|
|
|
|
|
@Input() ignoreNonWorkingDays = false; |
|
|
|
|
|
|
|
|
|
@ViewChild('flatpickrTarget') flatpickrTarget:ElementRef; |
|
|
|
|
|
|
|
|
@ -98,8 +123,6 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor { |
|
|
|
|
|
|
|
|
|
public workingDate:Date = new Date(); |
|
|
|
|
|
|
|
|
|
public ignoreNonWorkingDays = false; |
|
|
|
|
|
|
|
|
|
public datePickerInstance:DatePicker; |
|
|
|
|
|
|
|
|
|
text = { |
|
|
|
@ -123,13 +146,15 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor { |
|
|
|
|
populateInputsFromDataset(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
open() { |
|
|
|
|
this.opened = true; |
|
|
|
|
this.initializeDatepicker(); |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
if (!this.value) { |
|
|
|
|
const today = parseDate(new Date()) as Date; |
|
|
|
|
this.writeValue(this.timezoneService.formattedISODate(today)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
close() { |
|
|
|
|
this.opened = false; |
|
|
|
|
onInputClick(event:MouseEvent) { |
|
|
|
|
event.stopPropagation(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
save($event:Event) { |
|
|
|
@ -137,7 +162,7 @@ export class OpSingleDatePickerComponent implements ControlValueAccessor { |
|
|
|
|
this.valueChange.emit(this.workingValue); |
|
|
|
|
this.onChange(this.workingValue); |
|
|
|
|
this.writeValue(this.workingValue); |
|
|
|
|
this.close(); |
|
|
|
|
this.opened = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setToday():void { |
|
|
|
|