UNPKG

@asoftwareworld/form-builder-pro

Version:

ASW Form Builder Pro helps you with rapid development and designed web forms which includes several controls. The key feature of Form Builder is to make your content attractive and effective. We can customize our control at run time and preview the same b

108 lines (107 loc) 5.67 kB
import { AfterContentInit, ElementRef, EventEmitter, OnDestroy } from '@angular/core'; import { AbstractControl, ControlValueAccessor, ValidationErrors, Validator } from '@angular/forms'; import { BooleanInput } from '@angular/cdk/coercion'; import { ThemePalette } from '@angular/material/core'; import { MatFormField } from '@angular/material/form-field'; import { DatetimeAdapter, AswDatetimeFormats } from '@asoftwareworld/form-builder-pro/common'; import { AswDatetimepicker } from './datetimepicker'; import { AswDatetimepickerFilterType } from './datetimepicker-filtertype'; import * as i0 from "@angular/core"; export declare const MAT_DATETIMEPICKER_VALUE_ACCESSOR: any; export declare const MAT_DATETIMEPICKER_VALIDATORS: any; /** * An event used for datetimepicker input and change events. We don't always have access to a native * input or change event because the event may have been triggered by the user clicking on the * calendar popup. For consistency, we always use AswDatetimepickerInputEvent instead. */ export declare class AswDatetimepickerInputEvent<D> { target: AswDatetimepickerInput<D>; targetElement: HTMLElement; /** The new value for the target datetimepicker input. */ value: D | null; constructor(target: AswDatetimepickerInput<D>, targetElement: HTMLElement); } /** Directive used to connect an input to a AswDatetimepicker. */ export declare class AswDatetimepickerInput<D> implements AfterContentInit, ControlValueAccessor, OnDestroy, Validator { private _elementRef; _dateAdapter: DatetimeAdapter<D>; private _dateFormats; private _formField; _datetimepicker: AswDatetimepicker<D>; _dateFilter: (date: D | null, type: AswDatetimepickerFilterType) => boolean; /** Emits when a `change` event is fired on this `<input>`. */ dateChange: EventEmitter<AswDatetimepickerInputEvent<D>>; /** Emits when an `input` event is fired on this `<input>`. */ dateInput: EventEmitter<AswDatetimepickerInputEvent<D>>; /** Emits when the value changes (either due to user input or programmatic change). */ _valueChange: EventEmitter<D>; /** Emits when the disabled state has changed */ _disabledChange: EventEmitter<boolean>; private _datetimepickerSubscription; private _localeSubscription; /** Whether the last value set on the input was valid. */ private _lastValueValid; constructor(_elementRef: ElementRef, _dateAdapter: DatetimeAdapter<D>, _dateFormats: AswDatetimeFormats, _formField: MatFormField); /** The datetimepicker that this input is associated with. */ set aswDatetimepicker(value: AswDatetimepicker<D>); set aswDatetimepickerFilter(filter: (date: D | null, type: AswDatetimepickerFilterType) => boolean); /** The value of the input. */ get value(): D | null; set value(value: D | null); private _value; /** The minimum valid date. */ get min(): D | null; set min(value: D | null); private _min; /** The maximum valid date. */ get max(): D | null; set max(value: D | null); private _max; /** Whether the datetimepicker-input is disabled. */ get disabled(): boolean; set disabled(value: boolean); private _disabled; _onTouched: () => void; ngAfterContentInit(): void; ngOnDestroy(): void; registerOnValidatorChange(fn: () => void): void; validate(c: AbstractControl): ValidationErrors | null; /** * Gets the element that the datetimepicker popup should be connected to. * @return The element to connect the popup to. */ getConnectedOverlayOrigin(): ElementRef; /** Gets the ID of an element that should be used a description for the calendar overlay. */ getOverlayLabelId(): string | null; writeValue(value: D): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(disabled: boolean): void; _onKeydown(event: KeyboardEvent): void; _onInput(value: string): void; _onChange(): void; /** Handles blur events on the input. */ _onBlur(): void; private registerDatetimepicker; private getDisplayFormat; private getParseFormat; private _cvaOnChange; private _validatorOnChange; /** The form control validator for whether the input parses. */ private _parseValidator; /** The form control validator for the min date. */ private _minValidator; /** The form control validator for the max date. */ private _maxValidator; /** The form control validator for the date filter. */ private _filterValidator; /** The combined form control validator for this input. */ private _validator; /** Formats a value and sets it on the input element. */ private _formatValue; /** Returns the palette used by the input's form field, if any. */ getThemePalette(): ThemePalette; static ngAcceptInputType_disabled: BooleanInput; static ɵfac: i0.ɵɵFactoryDeclaration<AswDatetimepickerInput<any>, [null, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<AswDatetimepickerInput<any>, "input[aswDatetimepicker]", ["aswDatetimepickerInput"], { "aswDatetimepicker": { "alias": "aswDatetimepicker"; "required": false; }; "aswDatetimepickerFilter": { "alias": "aswDatetimepickerFilter"; "required": false; }; "value": { "alias": "value"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "dateChange": "dateChange"; "dateInput": "dateInput"; }, never, never, false, never>; }