import { KbqDatepickerModule } from '@koobiq/components/datepicker';

KbqCalendarHeader

componentСкопировать ссылку на KbqCalendarHeader

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()Скопировать ссылку на onMonthSelected()void

Handles when a new month is selected.

onYearSelected()Скопировать ссылку на onYearSelected()void

Handles when a new year is selected.

selectPreviousMonth()Скопировать ссылку на selectPreviousMonth()void

Handles user clicks on the previous button.

selectNextMonth()Скопировать ссылку на selectNextMonth()void

Handles user clicks on the next button.

KbqDatepicker

componentСкопировать ссылку на KbqDatepicker

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;
}
startAtinputСкопировать ссылку на startAtD | null | undefined

The date to open the calendar to initially.

disabledinputСкопировать ссылку на disabledboolean | undefined

Whether the datepicker pop-up should be disabled.

openedinputСкопировать ссылку на openedboolean | undefined

Whether the calendar is open.

minDateinputСкопировать ссылку на minDateD | null

The minimum selectable date.

maxDateinputСкопировать ссылку на maxDateD | null

The maximum selectable date.

panelClassinputСкопировать ссылку на panelClassstring | string[]

Classes to be passed to the date picker panel. Supports the same syntax as the [class] binding.

dateClassinputСкопировать ссылку на dateClass(date: D) => KbqCalendarCellCssClasses

Function that can be used to add custom CSS classes to dates.

localeOverridesinputСкопировать ссылку на localeOverridesKbqPartialLocaleData | undefined

Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.

yearSelectedoutputСкопировать ссылку на yearSelectedD

Emits selected year in multiyear view. This doesn't imply a change on the selected date.

monthSelectedoutputСкопировать ссылку на monthSelectedD

Emits selected month in year view. This doesn't imply a change on the selected date.

openedoutputСкопировать ссылку на openedvoid

Emits when the datepicker has been opened.

closedoutputСкопировать ссылку на closedvoid

Emits when the datepicker has been closed.

selectedСкопировать ссылку на selectedD | null

The currently selected date.

disabledChangeСкопировать ссылку на disabledChangeSubject<boolean>

Emits when the datepicker is disabled.

selectedChangedСкопировать ссылку на selectedChangedSubject<D>

Emits new selected date when selected date changes.

idСкопировать ссылку на idstring

The id for the datepicker calendar.

popupRefСкопировать ссылку на popupRefOverlayRef | null

A reference to the overlay when the calendar is opened as a popup.

datepickerInputСкопировать ссылку на datepickerInputKbqDatepickerInput<D>

The input element this datepicker is associated with.

select()Скопировать ссылку на select()void

Selects the given date

selectYear()Скопировать ссылку на selectYear()void

Emits the selected year in multiyear view

selectMonth()Скопировать ссылку на selectMonth()void

Emits selected month in year view

registerInput()Скопировать ссылку на registerInput()void

Register an input with this datepicker.

Parameters
inputKbqDatepickerInput<D>

The datepicker input to register with this datepicker.

KbqDatepickerToggleIconComponent

componentСкопировать ссылку на KbqDatepickerToggleIconComponent
@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;
}
disabledinputСкопировать ссылку на disabledboolean | undefined

Whether the toggle button is disabled.

forinputСкопировать ссылку на forKbqDatepicker<D>

Datepicker instance that the button will toggle.

isAttachedСкопировать ссылку на isAttachedboolean

Whether the calendar is currently on screen. Part of the KbqSiblingPopup contract.

openedChangeСкопировать ссылку на 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()Скопировать ссылку на open()void

Opens the calendar, moving the focus to its input; closes it instead when it was open at the press.

KbqDatepickerInput

directiveСкопировать ссылку на KbqDatepickerInput

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;
}
errorStateMatcherinputСкопировать ссылку на errorStateMatcherErrorStateMatcher

Object used to control when error messages are shown.

placeholderinputСкопировать ссылку на placeholderstring | undefined

Placeholder of the input. Defaults to the localized date pattern.

requiredinputСкопировать ссылку на requiredboolean

Whether the input is required.

valueinputСкопировать ссылку на valueD | null | undefined

The date the input holds: set with [value], by the form control, by typing and by the calendar.

mininputСкопировать ссылку на 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.

maxinputСкопировать ссылку на 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.

disabledinputСкопировать ссылку на disabledboolean

Whether the datepicker-input is disabled. Also set by the bound form control.

idinputСкопировать ссылку на idstring | undefined

Unique id of the element, generated when not provided.

localeOverridesinputСкопировать ссылку на localeOverridesKbqPartialLocaleData | undefined

Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.

dateChangeoutputСкопировать ссылку на dateChangeKbqDatepickerInputEvent<D>

Emits when a change event is fired on this <input>.

dateInputoutputСкопировать ссылку на dateInputKbqDatepickerInputEvent<D>

Emits when an input event is fired on this <input>.

errorStateСкопировать ссылку на errorStateSignal<boolean>

Whether the input is in an error state.

focusedСкопировать ссылку на focusedSignal<boolean>

Whether the input has focus.

valueChangeСкопировать ссылку на valueChangeEventEmitter<D | null>

Emits when the value changes (either due to user input or programmatic change).

disabledChangeСкопировать ссылку на disabledChangeEventEmitter<boolean>

Emits when the disabled state has changed

kbqDatepickerСкопировать ссылку на kbqDatepickerKbqDatepicker<D>

The datepicker that this input is associated with.

kbqCalendarСкопировать ссылку на kbqCalendarKbqCalendar<D>

The calendar that this input is associated with.

kbqDatepickerFilterСкопировать ссылку на kbqDatepickerFilter((date: D | null) => boolean) | undefined

Function that can be used to filter out dates within the datepicker. undefined removes the filter.

emptyСкопировать ссылку на emptySignal<boolean>

Whether the input renders no text.

onBlur()Скопировать ссылку на onBlur()void

Handles blur events on the input.

updateErrorState()Скопировать ссылку на updateErrorState()void

Refreshes the error state of the input.

getOrigin()Скопировать ссылку на getOrigin()ElementRef

Returns the ElementRef of the formField if it exists; otherwise, returns the ElementRef of the input.

KbqDatepickerToggleIcon

directiveСкопировать ссылку на KbqDatepickerToggleIcon

Can be used to override the icon of a kbqDatepickerToggle.

@Directive({ selector: '[kbqDatepickerToggleIcon]' })
class KbqDatepickerToggleIcon {}

KbqDatepickerInputEvent

classСкопировать ссылку на KbqDatepickerInputEvent

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
    );
}
valueСкопировать ссылку на valueD | null

The new value for the target datepicker input.

targetСкопировать ссылку на targetKbqDatepickerInput<D>

Reference to the datepicker input component that emitted the event.

targetElementСкопировать ссылку на targetElementHTMLElement

Reference to the native input element associated with the datepicker input.

constructor()Скопировать ссылку на constructor()
Parameters
targetKbqDatepickerInput<D>

Reference to the datepicker input component that emitted the event.

targetElementHTMLElement

Reference to the native input element associated with the datepicker input.

KbqCalendarCellCssClasses

typeСкопировать ссылку на KbqCalendarCellCssClasses

Extra CSS classes that can be associated with a calendar cell.

type KbqCalendarCellCssClasses = string | string[] | Set<string> | { [key: string]: any };

MonthName

typeСкопировать ссылку на MonthName
type MonthName = {
    name: string;
    nameShort: string;
    value: number;
    disabled: boolean;
};

KBQ_DATEPICKER_CONFIGURATION

constDeprecatedСкопировать ссылку на KBQ_DATEPICKER_CONFIGURATION

Use KBQ_DATEPICKER_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_DATEPICKER_CONFIGURATION: InjectionToken<KbqDatepickerLocaleConfiguration>;

KBQ_DATEPICKER_DEFAULT_CONFIGURATION

constDeprecatedСкопировать ссылку на KBQ_DATEPICKER_DEFAULT_CONFIGURATION

Use KBQ_DATEPICKER_DEFAULT_LOCALE_CONFIGURATION. Will be removed in 22.0.0.

const KBQ_DATEPICKER_DEFAULT_CONFIGURATION: { placeholder: string; dateInput: string; };

KBQ_DATEPICKER_SCROLL_STRATEGY

constСкопировать ссылку на KBQ_DATEPICKER_SCROLL_STRATEGY

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>;

kbqDatepickerLocaleConfigurationProvider

constСкопировать ссылку на kbqDatepickerLocaleConfigurationProvider

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;

MAX_YEAR

constСкопировать ссылку на MAX_YEAR
const MAX_YEAR: number;
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.