import { KbqDatepickerModule } from '@koobiq/components/datepicker';Default header for KbqCalendar
@Component({ selector: 'kbq-calendar-header', exportAs: 'kbqCalendarHeader' })
class KbqCalendarHeader<D> {
activeDate = model<D | undefined>();
maxDate = input<D | null | undefined>();
minDate = input<D | null | undefined>();
readonly monthSelected = output<D>();
readonly yearSelected = output<D>();
monthNames: MonthName[];
selectedMonth: number;
years: number[];
selectedYear: number;
get previousDisabled(): boolean;
get currentDisabled(): boolean;
get nextDisabled(): boolean;
onMonthSelected(month: number): void;
onYearSelected(year: number): void;
selectCurrentDate(): void;
selectPreviousMonth(): void;
selectNextMonth(): void;
}onMonthSelected()void Handles when a new month is selected.
onYearSelected()void Handles when a new year is selected.
selectPreviousMonth()void Handles user clicks on the previous button.
selectNextMonth()void Handles user clicks on the next button.
Component responsible for managing the datepicker popup/dialog.
@Component({ selector: 'kbq-datepicker', exportAs: 'kbqDatepicker' })
class KbqDatepicker<D> {
hasBackdrop = input<boolean | undefined>();
startAt = input<D | null | undefined>();
disabled = input<boolean | undefined>();
opened = input<boolean | undefined>();
readonly minDate = input<D | null>();
readonly maxDate = input<D | null>();
readonly panelClass = input<string | string[]>();
readonly dateClass = input<(date: D) => KbqCalendarCellCssClasses>();
readonly backdropClass = input<string>(
'cdk-overlay-transparent-backdrop'
);
readonly yearSelected = output<D>();
readonly monthSelected = output<D>();
readonly openedStream = output<void>({ alias: 'opened' });
readonly closedStream = output<void>({ alias: 'closed' });
selected: D | null;
get dateFilter(): (date: D | null) => boolean;
get value(): D | null;
readonly disabledChange: Subject<boolean>;
readonly selectedChanged: Subject<D>;
id: string;
popupRef: OverlayRef | null;
datepickerInput: KbqDatepickerInput<D>;
select(date: D): void;
selectYear(normalizedYear: D): void;
selectMonth(normalizedMonth: D): void;
registerInput(input: KbqDatepickerInput<D>): void;
open(): void;
close(restoreFocus?: boolean): void;
toggle(): void;
}startAtD | null | undefined The date to open the calendar to initially.
disabledboolean | undefined Whether the datepicker pop-up should be disabled.
openedboolean | undefined Whether the calendar is open.
minDateD | null The minimum selectable date.
maxDateD | null The maximum selectable date.
panelClassstring | string[] Classes to be passed to the date picker panel. Supports the same syntax as the [class] binding.
dateClass(date: D) => KbqCalendarCellCssClasses Function that can be used to add custom CSS classes to dates.
localeOverridesKbqPartialLocaleData | undefined Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.
yearSelectedD Emits selected year in multiyear view. This doesn't imply a change on the selected date.
monthSelectedD Emits selected month in year view. This doesn't imply a change on the selected date.
openedvoid Emits when the datepicker has been opened.
closedvoid Emits when the datepicker has been closed.
selectedD | null The currently selected date.
disabledChangeSubject<boolean> Emits when the datepicker is disabled.
selectedChangedSubject<D> Emits new selected date when selected date changes.
idstring The id for the datepicker calendar.
popupRefOverlayRef | null A reference to the overlay when the calendar is opened as a popup.
datepickerInputKbqDatepickerInput<D> The input element this datepicker is associated with.
select()void Selects the given date
selectYear()void Emits the selected year in multiyear view
selectMonth()void Emits selected month in year view
registerInput()void Register an input with this datepicker.
inputKbqDatepickerInput<D> The datepicker input to register with this datepicker.
open()void Open the calendar.
close()void Close the calendar.
@Component({ selector: 'kbq-datepicker-toggle-icon' })
class KbqDatepickerToggleIconComponent<D> implements KbqSiblingPopup {
disabled = input<boolean | undefined>();
readonly datepicker = input<KbqDatepicker<D>>(undefined, {
alias: 'for'
});
get isAttached(): boolean;
readonly openedChange: Observable<boolean>;
open($event: MouseEvent): void;
}disabledboolean | undefined Whether the toggle button is disabled.
forKbqDatepicker<D> Datepicker instance that the button will toggle.
isAttachedboolean Whether the calendar is currently on screen. Part of the KbqSiblingPopup contract.
openedChangeObservable<boolean> Emits true when the calendar opens and false when it closes. Part of the KbqSiblingPopup
contract.
Built on top of the datepicker signal rather than read once, because the instance is bound after the
consumers of this stream (a tooltip on the same element subscribes in its constructor) and may be
swapped later.
open()void Opens the calendar, moving the focus to its input; closes it instead when it was open at the press.
Directive used to connect an input to a KbqDatepicker.
@Directive({
selector: 'input[kbqDatepicker], input[kbqCalendar]',
exportAs: 'kbqDatepickerInput'
})
class KbqDatepickerInput<D> implements KbqFormFieldControl<D>, ControlValueAccessor, Validator {
readonly errorStateMatcher = input<ErrorStateMatcher>();
readonly placeholder = input<string | undefined>();
readonly required = input<boolean>(false);
readonly value = input<D | null | undefined>();
min = input<D | null | undefined>();
max = input<D | null | undefined>();
readonly disabled = input<boolean>(false);
readonly id = input<string | undefined>();
readonly incorrectInput = output<void>();
readonly dateChange = output<KbqDatepickerInputEvent<D>>();
readonly dateInput = output<KbqDatepickerInputEvent<D>>();
elementRef: ElementRef<HTMLInputElement>;
readonly adapter: DateAdapter<D>;
readonly errorState: Signal<boolean>;
controlType: string;
readonly focused: Signal<boolean>;
datepicker: KbqDatepicker<D>;
calendar: KbqCalendar<D>;
dateFilter: (date: D | null) => boolean;
valueChange: EventEmitter<D | null>;
disabledChange: EventEmitter<boolean>;
set kbqDatepicker(value: KbqDatepicker<D>);
set kbqCalendar(value: KbqCalendar<D>);
set kbqDatepickerFilter(value: ((date: D | null) => boolean) | undefined);
set kbqValidationTooltip(value: KbqTooltipTrigger);
readonly empty: Signal<boolean>;
get viewValue(): string;
get ngControl(): any;
get isReadOnly(): boolean;
get dateInputFormat(): string;
onInput: () => void;
parseOnBlur: () => any;
onContainerClick(): void;
focus(): void;
focusChanged(isFocused: boolean): void;
onKeyDown(event: KeyboardEvent): void;
onChange(): void;
onBlur(): void;
onPaste(event: ClipboardEvent): void;
toISO8601(value: D): string;
updateErrorState(): void;
getOrigin(): ElementRef;
}errorStateMatcherErrorStateMatcher Object used to control when error messages are shown.
placeholderstring | undefined Placeholder of the input. Defaults to the localized date pattern.
requiredboolean Whether the input is required.
valueD | null | undefined The date the input holds: set with [value], by the form control, by typing and by the calendar.
minD | null | undefined The minimum valid date. Drives validation only — including dates typed or pasted into the
input — and reports kbqDatepickerMin. The calendar is restricted separately, by minDate
on the associated <kbq-datepicker>.
Compared down to the millisecond, not by calendar day: the input keeps the time part of the value it parses, and the comparison is made on wall-clock components rather than on absolute time.
maxD | null | undefined The maximum valid date. Drives validation only — including dates typed or pasted into the
input — and reports kbqDatepickerMax. The calendar is restricted separately, by maxDate
on the associated <kbq-datepicker>.
Compared down to the millisecond, not by calendar day: the input keeps the time part of the value it parses, so an upper bound meant to include its whole day has to be the end of that day.
disabledboolean Whether the datepicker-input is disabled. Also set by the bound form control.
idstring | undefined Unique id of the element, generated when not provided.
localeOverridesKbqPartialLocaleData | undefined Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.
dateChangeKbqDatepickerInputEvent<D> Emits when a change event is fired on this <input>.
dateInputKbqDatepickerInputEvent<D> Emits when an input event is fired on this <input>.
errorStateSignal<boolean> Whether the input is in an error state.
focusedSignal<boolean> Whether the input has focus.
valueChangeEventEmitter<D | null> Emits when the value changes (either due to user input or programmatic change).
disabledChangeEventEmitter<boolean> Emits when the disabled state has changed
kbqDatepickerKbqDatepicker<D> The datepicker that this input is associated with.
kbqCalendarKbqCalendar<D> The calendar that this input is associated with.
kbqDatepickerFilter((date: D | null) => boolean) | undefined Function that can be used to filter out dates within the datepicker. undefined removes the filter.
emptySignal<boolean> Whether the input renders no text.
onBlur()void Handles blur events on the input.
updateErrorState()void Refreshes the error state of the input.
getOrigin()ElementRef Returns the ElementRef of the formField if it exists; otherwise, returns the ElementRef of the input.
Can be used to override the icon of a kbqDatepickerToggle.
@Directive({ selector: '[kbqDatepickerToggleIcon]' })
class KbqDatepickerToggleIcon {}An event used for datepicker 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 KbqDatepickerInputEvent instead.
class KbqDatepickerInputEvent<D> {
value: D | null;
target: KbqDatepickerInput<D>;
targetElement: HTMLElement;
constructor(
target: KbqDatepickerInput<D>,
targetElement: HTMLElement
);
}valueD | null The new value for the target datepicker input.
targetKbqDatepickerInput<D> Reference to the datepicker input component that emitted the event.
targetElementHTMLElement Reference to the native input element associated with the datepicker input.
constructor()targetKbqDatepickerInput<D> Reference to the datepicker input component that emitted the event.
targetElementHTMLElement Reference to the native input element associated with the datepicker input.
Extra CSS classes that can be associated with a calendar cell.
type KbqCalendarCellCssClasses = string | string[] | Set<string> | { [key: string]: any };type MonthName = {
name: string;
nameShort: string;
value: number;
disabled: boolean;
};Use KBQ_DATEPICKER_LOCALE_CONFIGURATION. Will be removed in 22.0.0.
const KBQ_DATEPICKER_CONFIGURATION: InjectionToken<KbqDatepickerLocaleConfiguration>;Use KBQ_DATEPICKER_DEFAULT_LOCALE_CONFIGURATION. Will be removed in 22.0.0.
const KBQ_DATEPICKER_DEFAULT_CONFIGURATION: { placeholder: string; dateInput: string; };Injection token that determines the scroll handling while the calendar is open. The root default keeps the
datepicker usable outside KbqDatepickerModule's injector; providing the token anywhere still wins over it.
const KBQ_DATEPICKER_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;Utility provider for KBQ_DATEPICKER_LOCALE_CONFIGURATION. Only the strings you pass are overridden; the rest
keep following the active locale.
const kbqDatepickerLocaleConfigurationProvider: (
configuration: KbqDeepPartial<KbqDatepickerLocaleConfiguration>
) => Provider;const MAX_YEAR: number;