/** Core */ import { CoreComponent } from "cmf.core/src/core"; import Cmf from "cmf.lbos"; /** Angular2 */ import * as ng from "@angular/core"; import { OnValidate, OnValidateArgs } from "../../directives/validator/validator"; import "moment-duration-format/lib/moment-duration-format"; /** Component metadata */ /** * @whatItDoes * TimeSpanPicker basic component is used to pick a duration. * * @howToUse * This component is used with the inputs and outputs mentioned below. * * ## Inputs * `any` : **value** - Default timespan value (string or milliseconds) ; * `string` : **placeholder** - Text to display when component is empty ; * `string` : **pattern** - Input pattern, used as regex to validate input value ; * `boolean` : **required** - Defines if the control is mandatory or not ; * `boolean` : **disabled** - Defines if the control is disabled ; * `string` : **minValue** - Minimum allowed selectable value ; * `string` : **maxValue** - Maximum allowed selectable value ; * `Cmf.Foundation.Common.RangeType` : **rangeType** - Used in conjunction with maxValue and minValue properties to validate ranges . * * ## Outputs * `any` : **valueChange** - Will output moment.Duration whenever value changes . * * ## Example * * Assume this HTML Template * * ```html * * * * * ``` */ export declare class TimeSpanPicker extends CoreComponent implements ng.OnInit, ng.AfterViewInit, ng.OnChanges, OnValidate, ng.AfterContentInit, ng.OnDestroy { private _elementRef; /** * Component error class */ private static ERROR_CLASS; /** * Spinner limit values */ private static MAX_DAYS; private static MAX_HOURS; private static MAX_MINUTES; private static MAX_SECONDS; /** * Moment date formats, used to properly convert the date values to moments. */ static MOMENT_DURATION_FORMAT: string; /** * Spinner default values */ _days: any; _hours: any; _minutes: any; _seconds: any; /** * Current value of the input value */ _inputValue: string; /** * Input placeholder */ _placeholder: string; /** * Input pattern, used as regex to validate input value */ _pattern: string; /** * Defines if the control is mandatory or not. */ _required: boolean; /** * Defines if the control is disabled. */ _disabled: boolean; /** * Stores the dropDown element attached to body to destroy later */ private _dropDown; /** * Defines if the dropDown is open based on the aria-expanded attribute of the dropDown-toggle */ private _dropDownToggleIsExpanded; /** * Keeps the current state of the dropDown open to detect when it is changed */ private _isDropDownOpen; /** * Stores the dropDown toggles element to get the position of the dropDown */ private _dropDownToggle; /** * Stores the top position of the dropDown to optimize calculation */ _dropDownTop: string; /** * Stores the left position of the dropDown to optimize calculation */ _dropDownLeft: string; /** * Stores a unique id to be set as attribute of this timeSpan */ _uniqueTimeSpanId: string; private _inputRef; /** * Current value - always a moment.duration */ private _value; /** * Maximum allowed selectable value */ private _maxValue; /** * Minimum allowed selectable value */ private _minValue; /** * Current display mode of picker popup */ dropDownDisplayMode: string; /** * Mutation observer used to monitor interactions with picker button */ private pickerButtonObserver; /** * Gets the required Property. */ /** * Sets the required Property */ required: boolean; /** * Gets the disabled Property. */ /** * Sets the disabled Property */ disabled: boolean; /** * Gets the placeholder Property. */ /** * Sets the placeholder Property */ placeholder: string; /** * Gets the placeholder Property. */ /** * Sets the pattern Property */ pattern: string; /** * Sets the maximum value Property */ maxValue: string; /** * Sets the maximum value Property */ minValue: string; /** * Range Type * Used in conjunction with max and min properties. */ rangeType: Cmf.Foundation.Common.RangeType; /** * Current value */ value: any; /** * The value change event, so the timeSpanPicker can inform the upper/parent components that the value has changed */ valueChange: ng.EventEmitter; /** * Format value into a string following the standard GUI format for timeSpans */ static format(value: any): string; constructor(_elementRef: ng.ElementRef); /** * Component initialization */ ngOnInit(): void; /** * After component content is initiated set the time span picker on body */ ngAfterContentInit(): void; /** * After component view and child views are initialized */ ngAfterViewInit(): void; /** * On component destruction - destroy time span picker. */ ngOnDestroy(): void; /** * When component value changes - update * * @param {any} [changes] Complex object that contains a set of properties that have changed */ ngOnChanges(changes: any): void; /** * Parse duration time units to spinner values * @param {any} [value] duration value to parse */ setTimeUnits(value: any): void; /** * Updates input value with current duration; Emits output to parent component * @param internalSet Disables event emit if set to true */ updateInputValue(internalSet?: boolean): void; /** * When input value changes * @param {Event} [event] change event * @param {any} [value] input value */ onKeyUp(event: Event, value: any): void; /** * Component internal validation * @param {any} [nativeElement] HTML native element * @param {OnValidateArgs} [context] context of validation */ private internalValidation; /** * Validation function triggered by a wizard. * @param {OnValidateArgs} [context] context of validation */ onValidate(context: OnValidateArgs): Promise; /** * Resets the styling option of the validation process * * @see OnValidate interface */ reset(): Promise; /** * Checks if value is correctly formatted using the pattern * @param {Any} [value] duration to evaluate */ private isDurationValid; /** * Spinner increase days button * @param {Event} [event] click event */ incrementDays(event: Event): void; /** * Spinner increase hours button click * @param {Event} [event] click event */ incrementHours(event: Event): void; /** * Spinner increase minutes button click * @param {Event} [event] click event */ incrementMinutes(event: Event): void; /** * Spinner increase seconds button click * @param {Event} [event] click event */ incrementSeconds(event: Event): void; /** * Spinner decrease days button click * @param {Event} [event] click event */ decrementDays(event: Event): void; /** * Spinner decrease hours button click * @param {Event} [event] click event */ decrementHours(event: Event): void; /** * Spinner decrease minutes button click * @param {Event} [event] click event */ decrementMinutes(event: Event): void; /** * Spinner decrease seconds button click * @param {Event} [event] click event */ decrementSeconds(event: Event): void; /** * Calculates the dropDown display and position when it is toggled */ private dropDownDisplay; /** * Check if limits are being met for some new TimeSpan. Return false if not. * * @param days New value for days * @param hours New value for hours * @param minutes New value for minutes * @param seconds New value for seconds */ private checkLimits; /** * Return 'disabled' class if limits are not being met for some new TimeSpan increment/decrement. * Use to disable/enable buttons. * * @param daysIncrement New value to increment on current number of days * @param hours New value to increment on current number of hours * @param minutes New value to increment on current number of minutes * @param seconds New value to increment on current number of seconds */ displayBounds(daysIncrement: any, hoursIncrement: any, minutesIncrement: any, secondsIncrement: any): string; private convertInput; } export declare class TimeSpanPickerModule { }