@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
102 lines • 4.54 kB
TypeScript
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { AbstractControl, ControlValueAccessor, FormControl, FormGroup, ValidationErrors, Validator } from '@angular/forms';
import { BsDatepickerDirective } from 'ngx-bootstrap/datepicker';
import { PickedDates } from '../date-picker';
import { DateFormatService } from '../common/date-format.service';
import * as i0 from "@angular/core";
interface DateAndTimeOptions {
showSpinners?: boolean;
showMeridian?: boolean;
showMinutes?: boolean;
showSeconds?: boolean;
}
export type DateType = 'DateAndTime' | 'Date' | 'DateRange' | 'SingleDateRequired' | 'Time';
export declare class DateTimePickerComponent implements ControlValueAccessor, Validator, OnInit, AfterViewInit, OnDestroy {
private cd;
private dateFormatService;
/**
* The minimum date that can be selected in the date-time picker.
* This property is used to restrict the selection of dates before this value.
*/
minDate: Date;
set _minDate(value: string);
/**
* The maximum date that can be selected in the date-time picker.
* This property is used to restrict the selection of dates beyond this value.
*/
maxDate: Date;
set _maxDate(value: string);
placeholder: string;
/**
* The format in which the date input should be displayed.
* E.g. 'dd/MM/yyyy' or 'MM/dd/yyyy'.
* This format is used to parse and display the date in the input field.
*/
dateInputFormat: string;
/**
* If true, the datepicker will adapt its position based on available space.
* This is useful for responsive designs where the datepicker should not overflow the viewport.
*/
adaptivePosition: boolean;
/**
* Specifies the size of the date-time picker.
*/
size: string;
/**
* Specifies the type of date input.
*
* @param DateAndTime - Display both date and time.
* @param Date - Display only the date without the time.
* @param DateRange - Specify a range of dates.
* @param SingleDateRequired - Require the selection of a single date.
* @param Time - Display only the time without the date.
*
* @defaultValue 'DateAndTime'
*/
dateType: DateType;
config: DateAndTimeOptions;
onDateSelected: EventEmitter<PickedDates>;
date: Date;
time: Date | null;
form: FormGroup;
defaultPlaceholder: "Select a date…";
datepicker: BsDatepickerDirective;
private previousValue;
private previousTimePickerValues;
private destroy$;
constructor(cd: ChangeDetectorRef, dateFormatService: DateFormatService);
datepickerShown({ _element }: {
_element: ElementRef;
}): void;
onChange: (value: string) => void;
onTouched: () => void;
ngOnInit(): void;
ngOnDestroy(): void;
ngAfterViewInit(): void;
onTimeChange(time: Date): void;
get dateControl(): FormControl;
/**
* Control Value Accessor - If form value changes by external factor, update date property and internal form with new value.
*/
writeValue(value: string): void;
registerOnChange(fn: any): void;
registerOnTouched(onTouched: any): void;
setDisabledState(disabled: boolean): void;
validate(_control: AbstractControl): ValidationErrors | null;
previousDay(): void;
nextDay(): void;
hide(): void;
handleMouseWheel(event: WheelEvent): void;
/**
* If internal form changes its value, then combine date and time into one Date and pass its ISO string value to onChange method
* @param dateTime
* @private
*/
private setDatetime;
private verifyDate;
private isInputCleared;
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimePickerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DateTimePickerComponent, "c8y-date-time-picker", never, { "_minDate": { "alias": "minDate"; "required": false; }; "_maxDate": { "alias": "maxDate"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "dateInputFormat": { "alias": "dateInputFormat"; "required": false; }; "adaptivePosition": { "alias": "adaptivePosition"; "required": false; }; "size": { "alias": "size"; "required": false; }; "dateType": { "alias": "dateType"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "onDateSelected": "onDateSelected"; }, never, never, true, never>;
}
export {};
//# sourceMappingURL=date-time-picker.component.d.ts.map