Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified packages/components/datepicker/__screenshots__/01-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/components/datepicker/__screenshots__/01-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion packages/components/datepicker/datepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import {
validationTooltipHideDelay,
validationTooltipShowDelay
} from '@koobiq/components/core';
import { KbqFormFieldControl } from '@koobiq/components/form-field';
import { KbqFormField, KbqFormFieldControl } from '@koobiq/components/form-field';
import type { KbqWarningTooltipTrigger } from '@koobiq/components/tooltip';
import { Subject, Subscription } from 'rxjs';
import { KbqCalendar } from './calendar.component';
Expand Down Expand Up @@ -273,9 +273,12 @@ interface DateTimeObject {
export class KbqDatepickerInput<D>
implements KbqFormFieldControl<D>, ControlValueAccessor, Validator, OnDestroy, DoCheck, AfterContentInit
{
/** @docs-private */
protected readonly formField = inject(KbqFormField, { optional: true, host: true });
/** @docs-private */
protected readonly localeService = inject(KBQ_LOCALE_SERVICE, { optional: true });

/** @docs-private */
protected readonly externalConfiguration = inject(KBQ_DATEPICKER_CONFIGURATION, { optional: true });

protected configuration;
Expand Down Expand Up @@ -865,6 +868,11 @@ export class KbqDatepickerInput<D>
this.errorStateTracker.updateErrorState();
}

/** Returns the ElementRef of the formField if it exists; otherwise, returns the ElementRef of the input. */
getOrigin(): ElementRef {
return this.formField ? this.formField.getConnectedOverlayOrigin() : this.elementRef;
}

private saveTimePart(selected: D) {
if (!this.value) {
return selected;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/datepicker/datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ export class KbqDatepicker<D> implements OnDestroy {
private createPopupPositionStrategy(): PositionStrategy {
return this.overlay
.position()
.flexibleConnectedTo(this.datepickerInput.elementRef)
.flexibleConnectedTo(this.datepickerInput.getOrigin())
.withTransformOriginOn('.kbq-datepicker__content')
.withFlexibleDimensions(false)
.withViewportMargin(8)
Expand Down
4 changes: 3 additions & 1 deletion tools/public_api_guard/components/datepicker.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as i8 from '@angular/common';
import { InjectionToken } from '@angular/core';
import { KbqButton } from '@koobiq/components/button';
import { KbqDateFormats } from '@koobiq/components/core';
import { KbqFormField } from '@koobiq/components/form-field';
import { KbqFormFieldControl } from '@koobiq/components/form-field';
import { KbqLocaleService } from '@koobiq/components/core';
import type { KbqWarningTooltipTrigger } from '@koobiq/components/tooltip';
Expand Down Expand Up @@ -308,14 +309,15 @@ export class KbqDatepickerInput<D> implements KbqFormFieldControl<D>, ControlVal
set errorState(value: boolean);
get errorStateMatcher(): ErrorStateMatcher;
set errorStateMatcher(value: ErrorStateMatcher);
// (undocumented)
protected readonly externalConfiguration: unknown;
// (undocumented)
focus(): void;
// (undocumented)
focusChanged(isFocused: boolean): void;
// (undocumented)
focused: boolean;
protected readonly formField: KbqFormField | null;
getOrigin(): ElementRef;
// (undocumented)
get id(): string;
set id(value: string);
Expand Down