gentics-ui-core
Version:
This is the common core framework for the Gentics CMS and Mesh UI, and other Angular applications.
89 lines (88 loc) • 4.25 kB
TypeScript
import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit, SimpleChange } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { ModalService } from '../modal/modal.service';
import { DateTimePickerFormatProvider } from './date-time-picker-format-provider.service';
import { DateTimePickerStrings } from './date-time-picker-strings';
import * as i0 from "@angular/core";
export { DateTimePickerStrings };
/**
* A form control for selecting a date and (optionally) a time.
*
* Depends on [ModalService](#/modal-service), which in turn
* requires that the [`<gtx-overlay-host>`](#/overlay-host) is present in the app.
*
* ```html
* <gtx-date-time-picker [(ngModel)]="dateOfBirth"
* label="Date of Birth"
* displayTime="false"
* format="Do MMMM YYYY">
* </gtx-date-time-picker>
* ```
*/
export declare class DateTimePicker implements ControlValueAccessor, OnInit, OnDestroy {
private formatProvider;
private modalService;
private changeDetector;
/** Sets the date picker to be auto-focused. Handled by `AutofocusDirective`. */
autofocus: boolean;
/** If true the clear button is displayed, which allows the user to clear the selected date. */
set clearable(val: any);
/** Value to set on the ngModel when the DatePicker is cleared. */
emptyValue: any;
/** The date/time value as a unix timestamp (in seconds). */
timestamp: number;
/** A label for the control. */
label: string;
/**
* A [moment.js](http://momentjs.com/)-compatible format string which determines how the
* date/time will be displayed in the input field.
* See [the moment docs](http://momentjs.com/docs/#/displaying/format/) for valid strings.
*/
format: string;
/** The minimum date allowed, e.g. `new Date(2015, 2, 12)`. */
min: Date;
/** The maximum date allowed, e.g. `new Date(2031, 1, 30)`. */
max: Date;
/** If true, the year may be selected from a Select control. */
set selectYear(val: any);
/** Set to `true` to disable the input field and not show the date picker on click. */
set disabled(val: any);
/** Set to `false` to omit the time picker part of the component. Defaults to `true`. */
set displayTime(val: any);
/** Set to `false` to omit the seconds of the time picker part. Defaults to `true`. */
set displaySeconds(val: any);
/** Fires when the "okay" button is clicked to close the picker. */
change: EventEmitter<number>;
/** Fires when the "clear" button is clicked on a clearable DateTimePicker. */
clear: EventEmitter<any>;
_clearable: boolean;
_selectYear: boolean;
_disabled: boolean;
displayValue: string;
/** @internal */
private value;
private _displayTime;
private _displaySeconds;
private subscription;
onChange: any;
onTouched: any;
constructor(formatProvider: DateTimePickerFormatProvider, modalService: ModalService, changeDetector: ChangeDetectorRef);
ngOnInit(): void;
ngOnChanges(changes: {
[K in keyof DateTimePicker]: SimpleChange;
}): void;
ngOnDestroy(): void;
handleEnterKey(event: KeyboardEvent): void;
showModal(): void;
getUnixTimestamp(): number;
writeValue(value: number): void;
registerOnChange(fn: Function): void;
registerOnTouched(fn: Function): void;
setDisabledState(disabled: boolean): void;
/** Format date to a human-readable string for displaying in the component's input field. */
updateDisplayValue(): void;
/** Clear input value of DateTimePicker and emit `emptyValue` as value. */
clearDateTime(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimePicker, [{ optional: true; }, null, null]>;
static ɵcmp: i0.ɵɵComponentDeclaration<DateTimePicker, "gtx-date-time-picker", never, { "autofocus": "autofocus"; "clearable": "clearable"; "emptyValue": "emptyValue"; "timestamp": "timestamp"; "label": "label"; "format": "format"; "min": "min"; "max": "max"; "selectYear": "selectYear"; "disabled": "disabled"; "displayTime": "displayTime"; "displaySeconds": "displaySeconds"; }, { "change": "change"; "clear": "clear"; }, never, never>;
}