@kushki/ng-suka
Version:
<p align="center"> <h1 align="center">Suka Components Angular</h1> <p align="center"> An Angular implementation of the Suka Design System </p> </p>
131 lines (130 loc) • 3.79 kB
TypeScript
import { EventEmitter, ElementRef, OnDestroy, TemplateRef, OnChanges, SimpleChanges, AfterViewChecked } from '@angular/core';
export declare class DatePicker implements OnDestroy, OnChanges, AfterViewChecked {
protected elementRef: ElementRef;
private static datePickerCount;
/**
* Select calendar range mode
*/
range: boolean;
/**
* Format of date
*
* For reference: https://flatpickr.js.org/formatting/
*/
dateFormat: string;
/**
* Defines if time selector should be present. Please define dateFormat accordingly. i.e.: "d/m/Y H:i"
*
* For reference: https://flatpickr.js.org/formatting/
*/
hasTime: boolean;
/**
* Disables calendar input. Useful for time picker functionality. Pair it with a time related format accordingly. i.e.: "H:i"
*/
noCalendar: boolean;
/**
* Date picker label.
*/
label: string | TemplateRef<any>;
/**
* Label for date range selector.
*/
rangeLabel: string;
/**
* Sets the placeholder text.
*/
placeholder: string;
/**
* Sets the pattern to follow.
*/
pattern: string;
/**
* Date picker id.
*/
id: string;
/**
* Sets the value.
*/
value: (Date | string)[];
/**
* Set to `true` to disable the `Datepicker`
*/
disabled: boolean;
/**
* Set to `true` to display invalid state.
*/
invalid: boolean;
/**
* Feedback message to display when `Datepicker` is invalid.
*/
invalidText: string | TemplateRef<any>;
/**
* Skeleton state.
*/
skeleton: boolean;
/**
* Array of date picker plugins.
*/
plugins: any[];
/**
* Flatpickr options
*/
flatpickrOptions: any;
/**
* Emits event notifying other classes of a change.
*/
valueChange: EventEmitter<any>;
protected _value: any[];
protected _flatpickrOptions: {
allowInput: boolean;
};
protected flatpickrBaseOptions: {
mode: string;
dateFormat: string;
locale: import("flatpickr/dist/types/locale").CustomLocale;
plugins: any[];
onOpen: () => void;
value: (string | Date)[];
};
protected flatpickrInstance: any;
constructor(elementRef: ElementRef);
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewChecked(): void;
onFocus(): void;
/**
* Writes a value from the model to the component. Expects the value to be `null` or `(Date | string)[]`
* @param value value received from the model
*/
writeValue(value: (Date | string)[]): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
onTouched: () => any;
propagateChange: (_: any) => void;
/**
* Cleans up our flatpickr instance
*/
ngOnDestroy(): void;
/**
* Handles the `valueChange` event from the primary/single input
*/
onValueChange(event: string): void;
/**
* Handles the `valueChange` event from the range input
*/
onRangeValueChange(event: string): void;
/**
* Suka uses a number of specific classnames for parts of the flatpickr - this idempotent method applies them if needed.
*/
protected updateClassNames(): void;
/**
* Applies the given date value array to both the flatpickr instance and the `input`(s)
* @param dates the date values to apply
*/
protected setDateValues(dates: (Date | string)[]): void;
protected doSelect(selectedValue: (Date | string)[]): void;
protected didDateValueChange(currentValue: any, previousValue: any): boolean;
/**
* More advanced checking of the loaded state of flatpickr
*/
protected isFlatpickrLoaded(): boolean;
}