UNPKG

moh-common-lib

Version:

A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).

92 lines (91 loc) 3.48 kB
import { OnInit, EventEmitter, SimpleChanges, OnChanges } from '@angular/core'; import { INgxMyDpOptions, IMyDate, NgxMyDatePickerDirective } from 'ngx-mydatepicker'; import { ControlValueAccessor } from '@angular/forms'; import { Base } from '../../models/base'; /** * Component NPM package dependencies: * a) moment * * This component reports the following errors. * required * dayOutOfRange * yearDistantPast * yearDistantFuture * noFutureDatesAllowed * invalidValue * * These messages can be changed by updated messages using the errorMessages interface/ * Ex. { required: 'This field is required', invalidValue: '{label} is invalid' } */ export interface DateErrorMsg { required?: string; dayOutOfRange?: string; yearDistantPast?: string; yearDistantFuture?: string; noPastDatesAllowed?: string; noFutureDatesAllowed?: string; invalidValue?: string; } /** * PRIME datepicker component. Largely a wrapper for ngx-mydatepicker * https://github.com/kekeh/ngx-mydatepicker * * NOTE - YOU MUST INCLUDE NGX-MYDATEPICKER IN YOUR PARENT APPLICATION TO USE * THIS COMPONENT! This is due to some poor implementation in ngx-mydatepicker. * Make sure to use the same version that this library uses. */ export declare class DatepickerComponent extends Base implements OnInit, OnChanges, ControlValueAccessor { /** Component size can be reduced, see Datepickersizes for options */ size: DatepickerSizes; date: Date; dateChange: EventEmitter<Date>; disabled: boolean; labelText: string; required: boolean; /** Dates **before** disableUntil will not be valid selections. Maps to a ngx-mydatepicker option, but we convert IMyDate to Date */ disableUntil: Date; /** Dates **after** disableSince will not be valid selections. Maps to a ngx-mydatepicker option, but we convert IMyDate to Date */ disableSince: Date; /** Equivalent to setting disableBefore to tomorrow. */ onlyFutureDates: boolean; /** * Control visibility of the clear 'x' button on the mini datepicker. * * **'visible'** is default, button exists * * **'none'** means the element does not exist * * **'invisible'** means the element takes up space but is not visible / cannot be * used. * * Invisible is useful when you want to make sure a datepicker is the same * size as a visible one. */ clearButton: 'visible' | 'invisible' | 'none'; /** Format for how to display the date to the user. */ dateFormat: string; errorMessages: DateErrorMsg; /** Datetime model used to interface with ngx-datepicker. */ model: any; DatepickerSizes: typeof DatepickerSizes; ngxdp: NgxMyDatePickerDirective; /** Default options for wrapped ngx-datepicker. */ datepickerOptions: INgxMyDpOptions; _onChange: (_: any) => void; _onTouched: () => void; constructor(); convertDateToSimpleDate(date: Date): IMyDate; convertSimpleDateToDate(date: IMyDate): Date; isDate(x: any): x is Date; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; onDateChanged(event: any): void; clearDate(): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; writeValue(obj: any): void; } export declare enum DatepickerSizes { MINI = "mini", DEFAULT = "default" }