gentics-ui-core
Version:
This is the common core framework for the Gentics CMS and Mesh UI, and other Angular applications.
119 lines (118 loc) • 4.19 kB
TypeScript
import { ElementRef, EventEmitter, OnDestroy, SimpleChanges } from '@angular/core';
import { DateTimePickerFormatProvider } from './date-time-picker-format-provider.service';
import * as i0 from "@angular/core";
export declare type TimeUnit = 'hours' | 'minutes' | 'seconds';
/**
* The controls (calendar view, year & time inputs) powering the `DateTimePicker` component. Can be used as a stand-alone component.
*/
export declare class DateTimePickerControls implements OnDestroy {
private defaultFormatProvider;
private static momentLocales;
/**
* The date/time value as a unix timestamp (in seconds)
*/
timestamp: number;
/**
* Set to overwrite texts and date formatting in the modal.
*/
formatProvider: DateTimePickerFormatProvider;
/**
* The minimum date allowable. E.g. `new Date(2015, 2, 12)`
*/
min: Date;
/**
* The maximum date allowable. E.g. `new Date(2031, 1, 30)`
*/
max: Date;
/**
* If true, the year may be selected from a Select control
*/
set selectYear(val: any);
get selectYear(): any;
/**
* Set to `true` to disable the input field and not show the date picker on click.
*/
set disabled(val: any);
get disabled(): any;
/**
* Set to `false` to omit the time picker part of the component. Defaults to `true`
*/
set displayTime(val: any);
get displayTime(): any;
/**
* Set to `false` to omit the seconds of the time picker part. Defaults to `true`
*/
set displaySeconds(val: any);
get displaySeconds(): any;
/**
* When `true`, the controls use the "compact" (small screen) styling for all screen sizes. Defaults to `false`
*/
set compact(val: any);
get compact(): any;
/**
* Emits the unix timestamp of the current value on changes.
*/
change: EventEmitter<number>;
calendarContainer: ElementRef;
dateOrder: 'dmy' | 'ymd' | 'mdy';
years: number[];
_selectYear: boolean;
_disabled: boolean;
_displayTime: boolean;
_displaySeconds: boolean;
_compact: boolean;
/** @internal */
value: any;
/** @internal */
time: any;
/**
* cal is an instance of a Rome calendar, for the API see https://github.com/bevacqua/rome#rome-api
*/
private cal;
private subscription;
constructor(defaultFormatProvider: DateTimePickerFormatProvider);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
/**
* Initialize the Rome widget instance.
*/
ngAfterViewInit(): void;
ngOnDestroy(): void;
getRomeConfig(): any;
setupProviderChangeHook(): void;
/**
* Update the this.value in accordance with the input of one of the
* time fields (h, m, s).
*/
updateTime(unit: TimeUnit, value: number): void;
/**
* Handler for the incrementing the time values when up or down arrows are pressed.
*/
timeKeyHandler(unit: TimeUnit, e: KeyboardEvent): void;
incrementTime(unit: TimeUnit): void;
decrementTime(unit: TimeUnit): void;
formatWith(formatString: string): string;
getUnixTimestamp(): number;
setYear(year: number): void;
private updateByUnits;
/**
* Create a momentjs locale from the (possibly localized) strings.
* @internal
*/
private getMomentLocale;
private determineDateOrder;
/**
* Increment or decrement the value and update the time object.
*/
private addToTime;
/**
* Update the time object based on the value of this.value.
*/
private updateTimeObject;
/**
* Update the Rome calendar widget with the current value.
*/
private updateCalendar;
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimePickerControls, [{ optional: true; }]>;
static ɵcmp: i0.ɵɵComponentDeclaration<DateTimePickerControls, "gtx-date-time-picker-controls", never, { "timestamp": "timestamp"; "formatProvider": "formatProvider"; "min": "min"; "max": "max"; "selectYear": "selectYear"; "disabled": "disabled"; "displayTime": "displayTime"; "displaySeconds": "displaySeconds"; "compact": "compact"; }, { "change": "change"; }, never, never>;
}