@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
269 lines (268 loc) • 8.16 kB
TypeScript
import { EventEmitter, Injector, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { ValidationAlerts } from '../../validation-alert/validation-alert';
import { DateLikeFormFieldComponent } from '../date-like/date-like-form-field.component';
import * as i0 from "@angular/core";
export interface TimeBlock {
display: string;
value: number;
isSelected: boolean;
}
export declare enum Meridiem {
AM = "am",
PM = "pm"
}
export declare type NullableMeridiem = null | Meridiem;
export interface MeridiemBlock {
display: string;
value: Meridiem;
isSelected: boolean;
}
export interface Spin {
value: number;
pivot: number;
}
/**
* Clock Form Field Component
*/
export declare class ClockFormFieldComponent extends DateLikeFormFieldComponent implements OnInit {
/**
* Const getter for The visible number of rows for the clock component.
*/
private static get visibleRowCount();
/**
* Returns maximum number of hours depending of the hour format
*/
private get maxHours();
/**
* Return the maximum number of minutes in an hour
*/
private maxMinutes;
/**
* The source name to use for logging
*/
protected get logSourceName(): string;
showConfirmation: boolean;
accepted: EventEmitter<any>;
cleared: EventEmitter<any>;
/**
* Internal selected time value
*/
viewportTime: Date;
/**
* Gets the selected hours
*/
private get viewportHour();
/**
* Gets the selected minutes
*/
private get viewportMinute();
/**
* A list of hours in the clock
*/
hours: TimeBlock[];
/**
* A list of minutes in the clock
*/
minutes: TimeBlock[];
/**
* A list of minutes in the clock
*/
meridiems: MeridiemBlock[];
/**
* The initial meridian should remain at the top
*/
private initialMeridiem;
/**
* indicates the meridiem of the current time
*/
get viewportMeridiem(): NullableMeridiem;
/**
* Current spun hour and the pivot point
*/
private spinHour;
/**
* Current spun minute and the pivot point
*/
private spinMinute;
/**
* indicates if a value change is expected
*/
private localeDateFormat;
/**
* Answers, is user currently scrolling down?
*/
private isScrollDown;
/**
* indicates if a value change is expected
*/
private localeDateFormatOptions;
private get use12HourFormat();
/**
* A workaround to have Screen reader know this is a required "input" field.
*/
get ariaLabel(): string;
/**
* Initializes a new instance of the @see ClockFormFieldComponent class.
* @param injector The angular injection service. required by @see SmeInjectableBase decorator in the @see BaseComponent class
*/
constructor(injector: Injector);
/**
* Implementation of angular OnInit interface
*/
ngOnInit(): void;
/**
* Indicates if a given day is selected
*/
isMeridiemSelected(value: Meridiem): boolean;
/**
* Occurs when an hour is clicked
*/
onHourClicked(event: MouseEvent, hour: TimeBlock): void;
/**
* Occurs when a key is pressed down on a hour block
*/
onHourKeydown(event: KeyboardEvent): void;
/**
* Occurs when the mouse wheel is moved on the hour column
*/
onHourWheel(event: WheelEvent): void;
/**
* Occurs when any column is scrolled
*/
onColumnScroll(event: Event): void;
/**
* Selected the previous hour block from the current one
*/
goToPreviousHour(): void;
/**
* Selected the next hour block from the current one
*/
goToNextHour(): void;
/**
* Sets the hour from a time block
*/
private setHour;
/**
* Occurs when an minute is clicked
*/
onMinuteClicked(event: MouseEvent, minute: TimeBlock): void;
/**
* Occurs when a key is pressed down on a minute block
*/
onMinuteKeydown(event: KeyboardEvent): void;
/**
* Occurs when the mouse wheel is moved on the minute column
*/
onMinuteWheel(event: WheelEvent): void;
/**
* Selected the previous minute block from the current one
*/
goToPreviousMinute(): void;
/**
* Selected the next minute block from the current one
*/
goToNextMinute(): void;
/**
* Sets the minute from a time block
*/
private setMinute;
/**
* Parse an hour depending on the current format
*/
private getParsedHour;
/**
* Convert a 12 hour system value to twenty four hour
*/
private convertTo24Hours;
/**
* Occurs when an meridiem is clicked
*/
onMeridiemClicked(event: MouseEvent, meridiem: Meridiem): void;
/**
* Occurs when a key is pressed down on a meridiem block
*/
onMeridiemKeydown(event: KeyboardEvent): void;
/**
* Occurs when the mouse wheel is moved on the meridiem column
*/
onMeridiemWheel(event: WheelEvent): void;
/**
* Toggles the meridiem between AM and PM. No-Op if meridiem is not valid in the current locale
*/
toggleMeridiem(meridiem?: Meridiem): void;
/**
* Sets the meridiem to either AM or PM. No-Op if meridiem is not valid in the current locale
*/
setMeridiem(meridiem: Meridiem): void;
/**
* Called when accept button is clicked to commit changes
*/
onAcceptClicked(event: Event): void;
/**
* Updates either the form value or the viewport value depending on whether the value should be persisted
*/
private updateValueOrViewPortTime;
/**
* Occurs every time the value of the control changes, in the UI or programmatically.
* @param value the value of the form control
*/
protected onValueChanged(value: any): void;
/**
* Performs validation that is internal to this control
* @param c The form control attached to this instance
*/
protected validate(c: FormControl): ValidationAlerts;
/**
* Handles the wheel spin on columns. No value selection is made mimicking the behavior in Chromium Edge
*/
private handleWheelSpin;
/**
* Applies the focus to a the hours column
*/
private focusOnHours;
/**
* Applies the focus to a the minutes column
*/
private focusOnMinute;
/**
* Applies the focus to a the meridiem column
*/
private focusOnMeridiem;
/**
* Applies the focus to a column
*/
private focusOnColumn;
/**
* Applies the focus to the current element
*/
focus(): void;
/**
* Applies the focus to the host element when the clock retracts
*/
private focusOnHostElement;
/**
* Generates the current view
*/
private generateTimeColumns;
/**
* Returns the next value after a given step in a cycle
* @param currentValue current value in the cycle
* @param step value of steps to move
* @param maxValue max value in the cycle
*/
private getNextValue;
/**
* Returns the previous value after a given step in a cycle
* @param currentValue current value in the cycle
* @param step value of steps to move
* @param maxValue max value in the cycle
*/
private getPreviousValue;
/**
* Generates a series of numbers representing a cyclic window in time given a center (current value) and max value
*/
private generateTimeWindow;
static ɵfac: i0.ɵɵFactoryDeclaration<ClockFormFieldComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ClockFormFieldComponent, "sme-form-field[type=\"clock\"]", never, { "showConfirmation": "showConfirmation"; }, { "accepted": "accepted"; "cleared": "cleared"; }, never, never, false, never>;
}