diff --git a/.storybook/stories/datepicker/datepicker.stories.ts b/.storybook/stories/datepicker/datepicker.stories.ts
index 8eea1ec894..a0a92c6498 100644
--- a/.storybook/stories/datepicker/datepicker.stories.ts
+++ b/.storybook/stories/datepicker/datepicker.stories.ts
@@ -36,19 +36,14 @@ export default {
getDateString: { control: { disable: true }, table: { disable: true } },
},
args: {
+ // inputs
disabled: false,
placeholder: '',
id: '',
// outputs
clrDateChange: action('clrDateChange'),
// story helpers
- getDateObject: date => {
- try {
- return date && new Date(date).toISOString();
- } catch {
- return undefined;
- }
- },
+ getDateObject: date => new Date(date),
getDateString: date => date && new Date(date).toISOString().split('T')[0],
},
};
@@ -61,7 +56,7 @@ const DatePickerTemplate: StoryFn = args => ({
#date
type="date"
[id]="id"
- [clrDate]="getDateObject(date.value || clrDate)"
+ [clrDate]="getDateObject(clrDate || date.value)"
[min]="getDateString(min)"
[max]="getDateString(max)"
[disabled]="disabled"
diff --git a/.storybook/stories/datepicker/daterangepicker.stories.ts b/.storybook/stories/datepicker/daterangepicker.stories.ts
deleted file mode 100644
index fa4c288b04..0000000000
--- a/.storybook/stories/datepicker/daterangepicker.stories.ts
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2016-2024 Broadcom. All Rights Reserved.
- * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
- * This software is released under MIT license.
- * The full license information can be found in LICENSE in the root directory of this project.
- */
-
-import { ClrDatepickerModule, ClrDateRangeEndInput, ClrDateRangeStartInput, ClrFormsModule } from '@clr/angular';
-import { action } from '@storybook/addon-actions';
-import { moduleMetadata, StoryFn, StoryObj } from '@storybook/angular';
-import { CommonModules } from 'helpers/common';
-
-export default {
- title: 'Datepicker/DateRangepicker',
- component: ClrDateRangeStartInput,
- subcomponents: { ClrDateRangeEndInput },
- decorators: [
- moduleMetadata({
- imports: [...CommonModules, ClrFormsModule, ClrDatepickerModule],
- }),
- ],
- argTypes: {
- // inputs
- clrRangeStartDate: { control: { type: 'date' } },
- clrRangeEndDate: { control: { type: 'date' } },
- max: { control: { type: 'date' } },
- min: { control: { type: 'date' } },
- disabled: { control: { type: 'boolean' } },
- // outputs
- clrRangeStartDateChange: { control: { disable: true } },
- clrRangeEndDateChange: { control: { disable: true } },
- // methods
- onValueChange: { control: { disable: true }, table: { disable: true } },
- setFocusStates: { control: { disable: true }, table: { disable: true } },
- triggerValidation: { control: { disable: true }, table: { disable: true } },
- getProviderFromContainer: { control: { disable: true }, table: { disable: true } },
- // story helpers
- getDateObject: { control: { disable: true }, table: { disable: true } },
- getDateString: { control: { disable: true }, table: { disable: true } },
- },
- args: {
- disabled: false,
- placeholder: '',
- id: '',
- // outputs
- clrRangeStartDateChange: action('clrRangeStartDateChange'),
- clrRangeEndDateChange: action('clrRangeEndDateChange'),
- // story helpers
- getDateObject: date => {
- try {
- return date && new Date(date).toISOString();
- } catch {
- return undefined;
- }
- },
- getDateString: date => date && new Date(date).toISOString().split('T')[0],
- },
-};
-
-const DateRangePickerTemplate: StoryFn = args => ({
- template: `
-
-
-
-
-
- `,
- props: { ...args },
-});
-
-export const DateRangePicker: StoryObj = {
- render: DateRangePickerTemplate,
-};
-
-export const DefaultDate: StoryObj = {
- render: DateRangePickerTemplate,
- args: {
- clrRangeStartDate: '2024-06-22 00:00:00.000',
- clrRangeEndDate: '2024-08-21 00:00:00.000',
- },
-};
-
-export const Disabled: StoryObj = {
- render: DateRangePickerTemplate,
- args: {
- disabled: true,
- },
-};
-
-export const MinDate: StoryObj = {
- render: DateRangePickerTemplate,
- args: {
- min: Date.now() - 2592000000,
- },
-};
-
-export const MaxDate: StoryObj = {
- render: DateRangePickerTemplate,
- args: {
- max: Date.now() + 2592000000,
- },
-};
diff --git a/projects/angular/clarity.api.md b/projects/angular/clarity.api.md
index 8b2112e60d..0077c45e41 100644
--- a/projects/angular/clarity.api.md
+++ b/projects/angular/clarity.api.md
@@ -98,8 +98,8 @@ export class ClarityModule {
// Warning: (ae-forgotten-export) The symbol "i7_6" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i8_6" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i9_2" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i10_5" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i11_5" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i10_4" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i11_4" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i12_3" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i13_3" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i14_2" needs to be exported by the entry point index.d.ts
@@ -109,7 +109,7 @@ export class ClarityModule {
// Warning: (ae-forgotten-export) The symbol "i18_2" needs to be exported by the entry point index.d.ts
//
// (undocumented)
- static ɵmod: i0.ɵɵNgModuleDeclaration;
+ static ɵmod: i0.ɵɵNgModuleDeclaration;
}
// @public (undocumented)
@@ -186,8 +186,6 @@ export abstract class ClrAbstractContainer implements DynamicWrapper, OnDestroy,
// (undocumented)
addGrid(): boolean;
// (undocumented)
- additionalControls: NgControl[];
- // (undocumented)
control: NgControl;
// (undocumented)
controlClass(): string;
@@ -680,8 +678,6 @@ export class ClrCalendar implements OnDestroy {
// (undocumented)
get selectedDay(): DayModel;
// (undocumented)
- get selectedEndDay(): DayModel;
- // (undocumented)
get today(): DayModel;
// (undocumented)
static ɵcmp: i0.ɵɵComponentDeclaration;
@@ -1990,16 +1986,12 @@ export class ClrDateContainer extends ClrAbstractContainer implements AfterViewI
// Warning: (ae-forgotten-export) The symbol "DatepickerEnabledService" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "DateFormControlService" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ViewManagerService" needs to be exported by the entry point index.d.ts
- constructor(renderer: Renderer2, elem: ElementRef, toggleService: ClrPopoverToggleService, dateNavigationService: DateNavigationService, datepickerEnabledService: DatepickerEnabledService, dateFormControlService: DateFormControlService, dateIOService: DateIOService, commonStrings: ClrCommonStringsService, focusService: FocusService_2, viewManagerService: ViewManagerService, controlClassService: ControlClassService, layoutService: LayoutService, ngControlService: NgControlService, ifControlStateService: IfControlStateService);
+ constructor(renderer: Renderer2, toggleService: ClrPopoverToggleService, dateNavigationService: DateNavigationService, datepickerEnabledService: DatepickerEnabledService, dateFormControlService: DateFormControlService, dateIOService: DateIOService, commonStrings: ClrCommonStringsService, focusService: FocusService_2, viewManagerService: ViewManagerService, controlClassService: ControlClassService, layoutService: LayoutService, ngControlService: NgControlService, ifControlStateService: IfControlStateService);
// (undocumented)
set actionButton(button: ElementRef);
// (undocumented)
set clrPosition(position: string);
// (undocumented)
- clrRangeEndEl: ClrDateRangeEndInput;
- // (undocumented)
- clrRangeStartEl: ClrDateRangeStartInput;
- // (undocumented)
commonStrings: ClrCommonStringsService;
// (undocumented)
protected controlClassService: ControlClassService;
@@ -2012,10 +2004,6 @@ export class ClrDateContainer extends ClrAbstractContainer implements AfterViewI
// (undocumented)
protected layoutService: LayoutService;
// (undocumented)
- set max(dateString: string);
- // (undocumented)
- set min(dateString: string);
- // (undocumented)
ngAfterViewInit(): void;
// (undocumented)
protected ngControlService: NgControlService;
@@ -2024,58 +2012,28 @@ export class ClrDateContainer extends ClrAbstractContainer implements AfterViewI
// (undocumented)
get popoverPosition(): ClrPopoverPosition;
// (undocumented)
- set rangeOptions(rangeOptions: any);
- // (undocumented)
protected renderer: Renderer2;
// (undocumented)
- static ɵcmp: i0.ɵɵComponentDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
-}
-
-// @public (undocumented)
-export class ClrDateInput extends ClrDateInputBase implements AfterViewInit {
- // (undocumented)
- set date(date: Date | string);
- // (undocumented)
- dateChange: EventEmitter;
- // (undocumented)
- ngAfterViewInit(): void;
- // (undocumented)
- ngOnInit(): void;
- // (undocumented)
- onValueChange(target: HTMLInputElement): void;
- // (undocumented)
- protected updateDate(value: Date, setByUserInteraction?: boolean, fieldName?: string): void;
+ static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
+ static ɵfac: i0.ɵɵFactoryDeclaration;
}
// @public (undocumented)
-export class ClrDateInputBase extends WrappedFormControl implements OnInit, AfterViewInit, OnDestroy {
- constructor(viewContainerRef: ViewContainerRef, injector: Injector, el: ElementRef, renderer: Renderer2, document: any, control: NgControl, container: ClrDateContainer, dateIOService: DateIOService, dateNavigationService: DateNavigationService, datepickerEnabledService: DatepickerEnabledService, dateFormControlService: DateFormControlService, platformId: any, focusService: FocusService_2, datepickerFocusService: DatepickerFocusService);
+export class ClrDateInput extends WrappedFormControl implements OnInit, AfterViewInit, OnDestroy {
+ constructor(viewContainerRef: ViewContainerRef, injector: Injector, el: ElementRef, renderer: Renderer2, control: NgControl, container: ClrDateContainer, dateIOService: DateIOService, dateNavigationService: DateNavigationService, datepickerEnabledService: DatepickerEnabledService, dateFormControlService: DateFormControlService, platformId: any, focusService: FocusService_2, datepickerFocusService: DatepickerFocusService);
// (undocumented)
protected control: NgControl;
// (undocumented)
- protected dateIOService: DateIOService;
- // (undocumented)
- protected dateNavigationService: DateNavigationService;
- // (undocumented)
- protected datepickerFocusService: DatepickerFocusService;
+ set date(date: Date | string);
// (undocumented)
- protected datepickerHasFormControl(): boolean;
+ dateChange: EventEmitter;
// (undocumented)
get disabled(): boolean | string;
set disabled(value: boolean | string);
// (undocumented)
- protected document: any;
- // (undocumented)
protected el: ElementRef;
// (undocumented)
- protected getValidDateValueFromDate(date: Date): Date;
- // (undocumented)
protected index: number;
// (undocumented)
get inputType(): string;
@@ -2090,6 +2048,8 @@ export class ClrDateInputBase extends WrappedFormControl imple
// (undocumented)
ngOnInit(): void;
// (undocumented)
+ onValueChange(target: HTMLInputElement): void;
+ // (undocumented)
placeholder: string;
// (undocumented)
get placeholderText(): string;
@@ -2100,16 +2060,9 @@ export class ClrDateInputBase extends WrappedFormControl imple
// (undocumented)
triggerValidation(): void;
// (undocumented)
- protected updateInput(date: Date): void;
- // (undocumented)
- protected usingClarityDatepicker(): boolean;
- // (undocumented)
- protected usingNativeDatepicker(): boolean;
- protected validateDateRange(): void;
+ static ɵdir: i0.ɵɵDirectiveDeclaration;
// (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
+ static ɵfac: i0.ɵɵFactoryDeclaration;
}
// @public (undocumented)
@@ -2118,7 +2071,7 @@ export class ClrDateInputValidator implements Validator {
// (undocumented)
validate(control: AbstractControl): ValidationErrors;
// (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
+ static ɵdir: i0.ɵɵDirectiveDeclaration;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration;
}
@@ -2139,122 +2092,33 @@ export class ClrDatepickerModule {
// Warning: (ae-forgotten-export) The symbol "i7_4" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i8_4" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i9_4" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i10_3" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i11_2" needs to be exported by the entry point index.d.ts
//
// (undocumented)
- static ɵmod: i0.ɵɵNgModuleDeclaration;
+ static ɵmod: i0.ɵɵNgModuleDeclaration;
}
// @public (undocumented)
export class ClrDatepickerViewManager {
- // Warning: (ae-forgotten-export) The symbol "DatePickerHelperService" needs to be exported by the entry point index.d.ts
- constructor(commonStrings: ClrCommonStringsService, viewManagerService: ViewManagerService, dateIOService: DateIOService, datePickerHelperService: DatePickerHelperService, dateNavigationService: DateNavigationService);
+ constructor(commonStrings: ClrCommonStringsService, viewManagerService: ViewManagerService);
// (undocumented)
commonStrings: ClrCommonStringsService;
- // (undocumented)
- dateRangeOptions: any;
- // (undocumented)
- get hasRangeOptions(): any;
get isDayView(): boolean;
get isMonthView(): boolean;
get isYearView(): boolean;
// (undocumented)
- onRangeOptionSelect(selectedRange: any): void;
- // (undocumented)
static ɵcmp: i0.ɵɵComponentDeclaration;
// (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
-}
-
-// @public (undocumented)
-export class ClrDateRangeEndInput extends ClrDateInputBase implements AfterViewInit {
- // (undocumented)
- set date(date: Date | string);
- // (undocumented)
- dateChange: EventEmitter;
- // (undocumented)
- get inputSize(): number;
- // (undocumented)
- inputWidth: number;
- // (undocumented)
- ngAfterViewInit(): void;
- // (undocumented)
- ngOnInit(): void;
- // (undocumented)
- onValueChange(target: HTMLInputElement): void;
- // (undocumented)
- triggerControlInputValidation(): void;
- // (undocumented)
- protected updateDate(value: Date, setByUserInteraction?: boolean): void;
- // (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
-}
-
-// @public (undocumented)
-export class ClrDateRangeEndInputValidator implements Validator {
- constructor(dateIOService: DateIOService, dateNavigationService: DateNavigationService);
- // (undocumented)
- validate(control: AbstractControl): ValidationErrors;
- // (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
-}
-
-// @public (undocumented)
-export class ClrDateRangeStartInput extends ClrDateInputBase implements AfterViewInit {
- // (undocumented)
- set date(date: Date | string);
- // (undocumented)
- dateChange: EventEmitter;
- // (undocumented)
- get inputSize(): number;
- // (undocumented)
- inputWidth: number;
- // (undocumented)
- ngAfterViewInit(): void;
- // (undocumented)
- ngOnInit(): void;
- // (undocumented)
- onValueChange(target: HTMLInputElement): void;
- // (undocumented)
- triggerControlInputValidation(): void;
- // (undocumented)
- protected updateDate(value: Date, setByUserInteraction?: boolean): void;
- // (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
-}
-
-// @public (undocumented)
-export class ClrDateRangeStartInputValidator implements Validator {
- constructor(dateIOService: DateIOService, dateNavigationService: DateNavigationService);
- // (undocumented)
- validate(control: AbstractControl): ValidationErrors;
- // (undocumented)
- static ɵdir: i0.ɵɵDirectiveDeclaration;
- // (undocumented)
- static ɵfac: i0.ɵɵFactoryDeclaration;
+ static ɵfac: i0.ɵɵFactoryDeclaration;
}
// @public (undocumented)
export class ClrDay {
- constructor(_dateNavigationService: DateNavigationService, _datePickerHelperService: DatePickerHelperService, commonStrings: ClrCommonStringsService);
+ constructor(_dateNavigationService: DateNavigationService, _toggleService: ClrPopoverToggleService, dateFormControlService: DateFormControlService, commonStrings: ClrCommonStringsService);
// (undocumented)
get dayString(): string;
// Warning: (ae-forgotten-export) The symbol "DayViewModel" needs to be exported by the entry point index.d.ts
get dayView(): DayViewModel;
set dayView(day: DayViewModel);
- hoverListener(): void;
- isInRange(): boolean;
- // (undocumented)
- get isRangeEndDay(): boolean;
- // (undocumented)
- get isRangeStartDay(): boolean;
onDayViewFocus(): void;
selectDay(): void;
// (undocumented)
@@ -2580,13 +2444,13 @@ export class ClrFormsModule {
// Warning: (ae-forgotten-export) The symbol "i6_7" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i8_5" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i9_5" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i10_4" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i11_3" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i10_3" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i11_2" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i12_2" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i13_2" needs to be exported by the entry point index.d.ts
//
// (undocumented)
- static ɵmod: i0.ɵɵNgModuleDeclaration;
+ static ɵmod: i0.ɵɵNgModuleDeclaration;
}
// @public (undocumented)
@@ -3021,8 +2885,7 @@ export class ClrModalModule {
// @public (undocumented)
export class ClrMonthpicker implements AfterViewInit {
- constructor(_localeHelperService: LocaleHelperService, _dateNavigationService: DateNavigationService, _datepickerFocusService: DatepickerFocusService, _elRef: ElementRef, _viewManagerService: ViewManagerService, commonStrings: ClrCommonStringsService);
- get calendarEndMonthIndex(): number;
+ constructor(_viewManagerService: ViewManagerService, _localeHelperService: LocaleHelperService, _dateNavigationService: DateNavigationService, _datepickerFocusService: DatepickerFocusService, _elRef: ElementRef, commonStrings: ClrCommonStringsService);
get calendarMonthIndex(): number;
get calendarYear(): number;
changeMonth(monthIndex: number): void;
@@ -3034,18 +2897,12 @@ export class ClrMonthpicker implements AfterViewInit {
// (undocumented)
get currentCalendarYear(): number;
currentYear(): void;
- // (undocumented)
- getIsRangeEndMonth(monthIndex: number): boolean;
- // (undocumented)
- getIsRangeStartMonth(monthIndex: number): boolean;
getTabIndex(monthIndex: number): number;
- isInRange(monthIndex: number): boolean;
// (undocumented)
isSelected(monthIndex: number): boolean;
get monthNames(): ReadonlyArray;
nextYear(): void;
ngAfterViewInit(): void;
- onHover(monthIndex: number): void;
onKeyDown(event: KeyboardEvent): void;
previousYear(): void;
// (undocumented)
@@ -4248,10 +4105,10 @@ export class ClrTabsModule {
// Warning: (ae-forgotten-export) The symbol "i5_11" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i6_8" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i7_7" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i11_4" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i11_3" needs to be exported by the entry point index.d.ts
//
// (undocumented)
- static ɵmod: i0.ɵɵNgModuleDeclaration;
+ static ɵmod: i0.ɵɵNgModuleDeclaration;
}
// @public (undocumented)
@@ -4842,11 +4699,11 @@ export class ClrWizardModule {
// Warning: (ae-forgotten-export) The symbol "i7_8" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i8_7" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "i9_6" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i10_6" needs to be exported by the entry point index.d.ts
- // Warning: (ae-forgotten-export) The symbol "i11_6" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i10_5" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "i11_5" needs to be exported by the entry point index.d.ts
//
// (undocumented)
- static ɵmod: i0.ɵɵNgModuleDeclaration;
+ static ɵmod: i0.ɵɵNgModuleDeclaration;
}
// @public
@@ -5012,7 +4869,6 @@ export class ClrWizardTitle {
// @public (undocumented)
export class ClrYearpicker implements AfterViewInit {
constructor(_dateNavigationService: DateNavigationService, _viewManagerService: ViewManagerService, _datepickerFocusService: DatepickerFocusService, _elRef: ElementRef, commonStrings: ClrCommonStringsService);
- get calendarEndYear(): number;
get calendarYear(): number;
changeYear(year: number): void;
// (undocumented)
@@ -5020,15 +4876,9 @@ export class ClrYearpicker implements AfterViewInit {
// (undocumented)
get currentCalendarYear(): number;
currentDecade(): void;
- // (undocumented)
- getIsRangeEndYear(year: number): boolean;
- // (undocumented)
- getIsRangeStartYear(year: number): boolean;
getTabIndex(year: number): number;
- isInRange(year: number): boolean;
nextDecade(): void;
ngAfterViewInit(): void;
- onHover(year: number): void;
onKeyDown(event: KeyboardEvent): void;
previousDecade(): void;
// Warning: (ae-forgotten-export) The symbol "YearRangeModel" needs to be exported by the entry point index.d.ts
@@ -5228,7 +5078,7 @@ export function ToggleServiceFactory(): BehaviorSubject;
// @public (undocumented)
export class WrappedFormControl implements OnInit, DoCheck, OnDestroy {
- constructor(vcr: ViewContainerRef, wrapperType: Type, injector: Injector, _ngControl: NgControl | null, renderer: Renderer2, el: ElementRef);
+ constructor(vcr: ViewContainerRef, wrapperType: Type, injector: Injector, ngControl: NgControl | null, renderer: Renderer2, el: ElementRef);
// (undocumented)
protected controlIdService: ControlIdService;
// (undocumented)
diff --git a/projects/angular/src/forms/common/abstract-container.ts b/projects/angular/src/forms/common/abstract-container.ts
index 06396deab6..162e4268b2 100644
--- a/projects/angular/src/forms/common/abstract-container.ts
+++ b/projects/angular/src/forms/common/abstract-container.ts
@@ -27,7 +27,6 @@ export abstract class ClrAbstractContainer implements DynamicWrapper, OnDestroy,
@ContentChild(ClrControlHelper) controlHelperComponent: ClrControlHelper;
control: NgControl;
- additionalControls: NgControl[];
_dynamic = false;
protected subscriptions: Subscription[] = [];
@@ -53,9 +52,6 @@ export abstract class ClrAbstractContainer implements DynamicWrapper, OnDestroy,
this.subscriptions.push(
this.ngControlService.controlChanges.subscribe(control => {
this.control = control;
- }),
- this.ngControlService.additionalControlChanges.subscribe(controls => {
- this.additionalControls = controls;
})
);
}
@@ -94,7 +90,7 @@ export abstract class ClrAbstractContainer implements DynamicWrapper, OnDestroy,
}
private get touched() {
- return !!(this.control?.touched || this.additionalControls?.some(control => control.touched));
+ return this.control?.touched;
}
ngAfterContentInit() {
diff --git a/projects/angular/src/forms/common/if-control-state/abstract-if-state.ts b/projects/angular/src/forms/common/if-control-state/abstract-if-state.ts
index 7880666898..8f4026be58 100644
--- a/projects/angular/src/forms/common/if-control-state/abstract-if-state.ts
+++ b/projects/angular/src/forms/common/if-control-state/abstract-if-state.ts
@@ -17,7 +17,6 @@ export abstract class AbstractIfState {
protected subscriptions: Subscription[] = [];
protected displayedContent = false;
protected control: NgControl;
- protected additionalControls: NgControl[];
constructor(
@Optional() protected ifControlStateService: IfControlStateService,
@@ -27,9 +26,6 @@ export abstract class AbstractIfState {
this.subscriptions.push(
this.ngControlService.controlChanges.subscribe(control => {
this.control = control;
- }),
- this.ngControlService.additionalControlChanges.subscribe(controls => {
- this.additionalControls = controls;
})
);
}
diff --git a/projects/angular/src/forms/common/if-control-state/if-control-state.service.ts b/projects/angular/src/forms/common/if-control-state/if-control-state.service.ts
index 6b223a4c62..164aff5960 100644
--- a/projects/angular/src/forms/common/if-control-state/if-control-state.service.ts
+++ b/projects/angular/src/forms/common/if-control-state/if-control-state.service.ts
@@ -7,7 +7,7 @@
import { Injectable, OnDestroy } from '@angular/core';
import { NgControl } from '@angular/forms';
-import { BehaviorSubject, Observable, Subject, Subscription, takeUntil } from 'rxjs';
+import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { NgControlService } from '../providers/ng-control.service';
@@ -21,8 +21,6 @@ export enum CONTROL_STATE {
export class IfControlStateService implements OnDestroy {
private subscriptions: Subscription[] = [];
private control: NgControl;
- private additionalControls: NgControl[];
- private unSubscribeAdditionalControls: Subject = new Subject();
// Implement our own status changes observable, since Angular controls don't
private _statusChanges = new BehaviorSubject(CONTROL_STATE.NONE);
@@ -36,25 +34,11 @@ export class IfControlStateService implements OnDestroy {
// Subscribe to the status change events, only after touched
// and emit the control
this.subscriptions.push(
- this.control.statusChanges?.subscribe(() => {
+ this.control.statusChanges.subscribe(() => {
this.triggerStatusChange();
})
);
}
- }),
-
- this.ngControlService.additionalControlChanges.subscribe((controls: NgControl[]) => {
- if (controls) {
- this.additionalControls = controls;
- this.unSubscribeAdditionalControls.next(true);
- // Subscribe to the status change events, only after touched
- // and emit the control
- this.additionalControls?.forEach((control: NgControl) => {
- control?.statusChanges?.pipe(takeUntil(this.unSubscribeAdditionalControls)).subscribe(() => {
- this.triggerStatusChange();
- });
- });
- }
})
);
}
@@ -65,7 +49,6 @@ export class IfControlStateService implements OnDestroy {
ngOnDestroy() {
this.subscriptions.forEach(subscription => subscription.unsubscribe());
- this.unSubscribeAdditionalControls.next(true);
}
triggerStatusChange() {
@@ -73,15 +56,8 @@ export class IfControlStateService implements OnDestroy {
if (this.control) {
// These status values are mutually exclusive, so a control
// cannot be both valid AND invalid or invalid AND disabled.
- let finalStatus = CONTROL_STATE.NONE;
- const additionalControlsStatus = this.additionalControls?.map(control => control.status) || [];
- const combinedStatus = [this.control.status, ...additionalControlsStatus];
- if (combinedStatus.includes(CONTROL_STATE.INVALID)) {
- finalStatus = CONTROL_STATE.INVALID;
- } else if (combinedStatus.includes(CONTROL_STATE.VALID)) {
- finalStatus = CONTROL_STATE.VALID;
- }
- this._statusChanges.next(finalStatus);
+ const status = CONTROL_STATE[this.control.status];
+ this._statusChanges.next(['VALID', 'INVALID'].includes(status) ? status : CONTROL_STATE.NONE);
}
}
}
diff --git a/projects/angular/src/forms/common/if-control-state/if-error.ts b/projects/angular/src/forms/common/if-control-state/if-error.ts
index ec79f3fcd0..1581383416 100644
--- a/projects/angular/src/forms/common/if-control-state/if-error.ts
+++ b/projects/angular/src/forms/common/if-control-state/if-error.ts
@@ -35,17 +35,14 @@ export class ClrIfError extends AbstractIfState {
* @param state CONTROL_STATE
*/
protected override handleState(state: CONTROL_STATE) {
- if (this.error && this.control && !!this.control.invalid) {
+ if (this.error && this.control) {
this.displayError(this.control.hasError(this.error));
- } else if (this.error && !!this.additionalControls?.length) {
- const invalidControl = this.additionalControls?.filter(control => control.hasError(this.error))[0];
- this.displayError(!!invalidControl, invalidControl);
} else {
this.displayError(CONTROL_STATE.INVALID === state);
}
}
- private displayError(invalid: boolean, control = this.control) {
+ private displayError(invalid: boolean) {
/* if no container do nothing */
if (!this.container) {
return;
@@ -53,12 +50,12 @@ export class ClrIfError extends AbstractIfState {
if (invalid) {
if (this.displayedContent === false) {
this.embeddedViewRef = this.container.createEmbeddedView(this.template, {
- error: control.getError(this.error),
+ error: this.control.getError(this.error),
});
this.displayedContent = true;
} else if (this.embeddedViewRef && this.embeddedViewRef.context) {
// if view is already rendered, update the error object to keep it in sync
- this.embeddedViewRef.context.error = control.getError(this.error);
+ this.embeddedViewRef.context.error = this.control.getError(this.error);
}
} else {
this.container.clear();
diff --git a/projects/angular/src/forms/common/providers/ng-control.service.ts b/projects/angular/src/forms/common/providers/ng-control.service.ts
index 892ae12572..c901213f31 100644
--- a/projects/angular/src/forms/common/providers/ng-control.service.ts
+++ b/projects/angular/src/forms/common/providers/ng-control.service.ts
@@ -19,10 +19,7 @@ export interface Helpers {
@Injectable()
export class NgControlService {
// Observable to subscribe to the control, since its not available immediately for projected content
- private _control: NgControl;
private _controlChanges = new Subject();
- private _additionalControls: NgControl[] = [];
- private _additionalControlChanges = new Subject();
private _helpers = new Subject();
@@ -34,33 +31,11 @@ export class NgControlService {
return this._helpers.asObservable();
}
- get additionalControlChanges(): Observable {
- return this._additionalControlChanges.asObservable();
- }
-
- get hasAdditionalControls() {
- return !!this._additionalControls?.length;
- }
-
setControl(control: NgControl) {
- this._control = control;
this._controlChanges.next(control);
}
setHelpers(state: Helpers) {
this._helpers.next(state);
}
-
- addAdditionalControl(control: NgControl) {
- this._additionalControls.push(control);
- this._additionalControlChanges.next(this._additionalControls);
- }
-
- getControl() {
- return this._control;
- }
-
- getAdditionalControls() {
- return this._additionalControls;
- }
}
diff --git a/projects/angular/src/forms/common/wrapped-control.ts b/projects/angular/src/forms/common/wrapped-control.ts
index d83260dfde..23fe0426d5 100644
--- a/projects/angular/src/forms/common/wrapped-control.ts
+++ b/projects/angular/src/forms/common/wrapped-control.ts
@@ -58,8 +58,6 @@ export class WrappedFormControl implements OnInit, DoC
private _containerInjector: Injector;
private differs: KeyValueDiffers;
private differ: KeyValueDiffer;
- private additionalDiffer = new Map>();
- private ngControl: NgControl | null;
// I lost way too much time trying to make this work without injecting the ViewContainerRef and the Injector,
// I'm giving up. So we have to inject these two manually for now.
@@ -67,7 +65,7 @@ export class WrappedFormControl implements OnInit, DoC
protected vcr: ViewContainerRef,
protected wrapperType: Type,
injector: Injector,
- private _ngControl: NgControl | null,
+ private ngControl: NgControl | null,
renderer: Renderer2,
el: ElementRef
) {
@@ -100,6 +98,10 @@ export class WrappedFormControl implements OnInit, DoC
})
);
}
+
+ if (ngControl) {
+ this.differ = this.differs.find(ngControl).create();
+ }
}
@Input()
@@ -114,10 +116,6 @@ export class WrappedFormControl implements OnInit, DoC
}
}
- private get hasAdditionalControls() {
- return this.additionalDiffer.size > 0;
- }
-
ngOnInit() {
this._containerInjector = new HostWrapper(this.wrapperType, this.vcr, this.index);
this.controlIdService = this._containerInjector.get(ControlIdService);
@@ -133,24 +131,23 @@ export class WrappedFormControl implements OnInit, DoC
this._id = this.controlIdService.id;
}
- if (this.ngControlService && this._ngControl) {
- if (!this.ngControlService.getControl()) {
- this.ngControl = this._ngControl;
- this.ngControlService.setControl(this.ngControl);
- this.differ = this.differs.find(this._ngControl).create();
- } else {
- this.ngControl = this.ngControlService.getControl();
- this.ngControlService.addAdditionalControl(this._ngControl);
- this.additionalDiffer.set(this._ngControl, this.differs.find(this._ngControl).create());
- }
+ if (this.ngControlService && this.ngControl) {
+ this.ngControlService.setControl(this.ngControl);
}
}
ngDoCheck() {
- this.triggerDoCheck(this.differ, this.ngControl);
- if (this.hasAdditionalControls) {
- for (const [ngControl, differ] of this.additionalDiffer) {
- this.triggerDoCheck(differ, ngControl);
+ if (this.differ) {
+ const changes = this.differ.diff(this.ngControl);
+ if (changes) {
+ changes.forEachChangedItem(change => {
+ if (
+ (change.key === CHANGE_KEYS.FORM || change.key === CHANGE_KEYS.MODEL) &&
+ change.currentValue !== change.previousValue
+ ) {
+ this.triggerValidation();
+ }
+ });
}
}
}
@@ -178,33 +175,11 @@ export class WrappedFormControl implements OnInit, DoC
}
}
- private triggerDoCheck(differ, ngControl) {
- if (differ) {
- const changes = differ.diff(ngControl);
- if (changes) {
- changes.forEachChangedItem(change => {
- if (
- (change.key === CHANGE_KEYS.FORM || change.key === CHANGE_KEYS.MODEL) &&
- change.currentValue !== change.previousValue
- ) {
- this.triggerValidation();
- }
- });
- }
- }
- }
-
private markAsTouched(): void {
if (this.ngControl) {
this.ngControl.control.markAsTouched();
this.ngControl.control.updateValueAndValidity();
}
- if (this.ngControlService && this.ngControlService.hasAdditionalControls) {
- this.ngControlService.getAdditionalControls()?.forEach((ngControl: NgControl) => {
- ngControl.control.markAsTouched();
- ngControl.control.updateValueAndValidity();
- });
- }
}
private setAriaDescribedBy(helpers: Helpers) {
diff --git a/projects/angular/src/forms/datepicker/_datepicker.clarity.scss b/projects/angular/src/forms/datepicker/_datepicker.clarity.scss
index eb7d4bed35..75edbc22a1 100644
--- a/projects/angular/src/forms/datepicker/_datepicker.clarity.scss
+++ b/projects/angular/src/forms/datepicker/_datepicker.clarity.scss
@@ -34,15 +34,8 @@
&:hover {
background: datepicker-variables.$clr-calendar-btn-hover-color;
}
- &.in-range {
- &:not(.is-today) {
- border-radius: 0;
- }
- background: datepicker-variables.$clr-calendar-in-range-cell-border-color;
- }
&:focus {
outline: tokens.$cds-alias-object-interaction-outline;
- outline-color: -webkit-focus-ring-color;
outline-offset: calc(-1 * tokens.$cds-global-space-2);
}
&:active {
@@ -59,24 +52,13 @@
}
@mixin generate-selected-date-style() {
- &.is-selected,
- &.is-start-range,
- &.is-end-range {
+ &.is-selected {
background: datepicker-variables.$clr-calendar-active-cell-background-color;
color: datepicker-variables.$clr-calendar-active-cell-color;
border: none;
- }
- &.is-start-range {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- }
- &.is-end-range {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
- }
-
- &.is-selected:focus {
- background: datepicker-variables.$clr-calendar-active-focus-cell-background-color;
+ &:focus {
+ background: datepicker-variables.$clr-calendar-active-focus-cell-background-color;
+ }
}
}
@@ -93,48 +75,21 @@
@include mixins.exports('datepicker.clarity') {
.datepicker {
display: flex;
- flex-direction: row;
- margin-top: tokens.$cds-global-space-4;
+ flex-direction: column;
+
+ //Dimensions
+ margin-top: datepicker-variables.$clr-calendar-margin-top;
+ padding: datepicker-variables.$clr-calendar-padding;
width: datepicker-variables.$clr-calendar-width;
height: datepicker-variables.$clr-calendar-height;
+
+ //Other Props
background: datepicker-variables.$clr-calendar-background-color;
border: tokens.$cds-alias-object-border-width-100 solid datepicker-variables.$clr-calendar-border-color;
border-radius: tokens.$cds-alias-object-border-radius-100;
box-shadow: tokens.$cds-alias-object-shadow-100;
+ overflow: hidden;
z-index: map.get(variables.$clr-layers, dropdown-menu);
- .datepicker-view-manager {
- padding: tokens.$cds-global-space-7;
- }
- &.has-range-option {
- width: calc(datepicker-variables.$clr-calendar-width + datepicker-variables.$clr-calendar-options-width);
- }
- }
- .options-wrapper {
- width: datepicker-variables.$clr-calendar-options-width;
- padding: tokens.$cds-global-space-3 0;
- flex-shrink: 0;
- border-top-left-radius: tokens.$cds-alias-object-border-radius-100;
- border-bottom-left-radius: tokens.$cds-alias-object-border-radius-100;
- .range-option {
- padding: tokens.$cds-global-space-5;
- padding-left: tokens.$cds-global-space-7;
- color: datepicker-variables.$clr-calendar-option-text-color;
- cursor: pointer;
- &.active {
- border-left: mixins.baselinePx(3) solid datepicker-variables.$clr-calendar-active-option-border-color;
- color: datepicker-variables.$clr-calendar-options-active-text-color;
- background-color: datepicker-variables.$clr-calendar-options-active-background-color;
- }
- + .range-option {
- margin: tokens.$cds-global-space-5 0;
- }
- &:hover,
- &:focus {
- background-color: datepicker-variables.$clr-calendar-option-hover-background-color;
- outline: none;
- }
- }
- background-color: datepicker-variables.$clr-calendar-options-background-color;
}
.calendar-header {
@@ -296,12 +251,6 @@
.months {
flex-wrap: wrap;
flex-direction: row;
-
- &.enlarged {
- .month {
- height: datepicker-variables.$clr-calendar-month-enlarged-cell-height;
- }
- }
}
.month,
diff --git a/projects/angular/src/forms/datepicker/_properties.datepicker.scss b/projects/angular/src/forms/datepicker/_properties.datepicker.scss
index bc156368a0..a801089326 100644
--- a/projects/angular/src/forms/datepicker/_properties.datepicker.scss
+++ b/projects/angular/src/forms/datepicker/_properties.datepicker.scss
@@ -13,9 +13,6 @@
--clr-calendar-background-color: #{tokens.$cds-alias-object-container-background};
--clr-calendar-border-color: #{tokens.$cds-alias-object-border-color-shade};
- --clr-calendar-option-text-color: #{tokens.$cds-alias-object-interaction-color};
- --clr-calendar-active-option-border-color: #{tokens.$cds-alias-object-interaction-background-highlight};
-
--clr-calendar-btn-color: #{tokens.$cds-alias-object-interaction-color};
--clr-calendar-today-date-cell-color: #{tokens.$cds-alias-typography-color-400};
diff --git a/projects/angular/src/forms/datepicker/_variables.datepicker.scss b/projects/angular/src/forms/datepicker/_variables.datepicker.scss
index a189c79cdc..4df2a58228 100644
--- a/projects/angular/src/forms/datepicker/_variables.datepicker.scss
+++ b/projects/angular/src/forms/datepicker/_variables.datepicker.scss
@@ -6,7 +6,6 @@
*/
@use '@cds/core/tokens/tokens.scss';
-@use '../../utils/mixins';
$clr-calendar-click-target: #{tokens.$cds-global-space-11};
$clr-calendar-background-color: var(--clr-calendar-background-color) !default;
@@ -19,7 +18,6 @@ $clr-calendar-width: calc(
calc(7 * #{tokens.$cds-global-space-11}) + calc(2 * #{tokens.$cds-global-space-7}) +
calc(2 * #{tokens.$cds-alias-object-border-width-100})
);
-$clr-calendar-options-width: mixins.baselinePx(150);
//(8 = 6 date rows + 1 row for day heading + 1 row for calendar switches and month/year pickers) + 2 * 16px padding + 2px for border
$clr-calendar-height: calc(
@@ -38,8 +36,8 @@ $clr-calendar-btn-padding: 0;
$clr-calendar-year-cell-height: #{tokens.$cds-global-space-12};
$clr-calendar-month-cell-height: #{tokens.$cds-global-space-11};
-$clr-calendar-month-enlarged-cell-height: #{tokens.$cds-global-space-12};
$clr-calendar-month-cell-padding: #{tokens.$cds-global-space-6};
+
$clr-calendar-picker-btn-font-size: var(--clr-calendar-picker-btn-font-size);
$clr-calendar-picker-btn-font-weight: var(--clr-calendar-picker-btn-font-weight);
@@ -60,12 +58,4 @@ $clr-month-year-btn-width: calc(
0.5 * #{$clr-calendar-width} - #{tokens.$cds-global-space-7} - #{tokens.$cds-alias-object-border-width-100}
);
-$clr-calendar-option-text-color: var(--clr-calendar-option-text-color) !default;
-$clr-calendar-option-hover-background-color: var(--clr-calendar-btn-hover-color);
-$clr-calendar-options-background-color: var(--clr-vertical-nav-bg-color);
-$clr-calendar-active-option-border-color: var(--clr-calendar-active-option-border-color);
-$clr-calendar-in-range-cell-border-color: var(--clr-calendar-btn-hover-color);
$clr-calendar-today-date-cell-border-color: var(--clr-calendar-today-date-cell-border-color);
-
-$clr-calendar-options-active-text-color: var(--clr-vertical-nav-item-active-color);
-$clr-calendar-options-active-background-color: var(--clr-vertical-nav-selected-bg-color);
diff --git a/projects/angular/src/forms/datepicker/all.spec.ts b/projects/angular/src/forms/datepicker/all.spec.ts
index 74195135f0..4b7b44b050 100644
--- a/projects/angular/src/forms/datepicker/all.spec.ts
+++ b/projects/angular/src/forms/datepicker/all.spec.ts
@@ -8,7 +8,7 @@
import { addHelpers } from '../../data/datagrid/helpers.spec';
import CalendarSpecs from './calendar.spec';
import DateContainerSpecs from './date-container.spec';
-import DateInputSpecs from './date-input-base.spec';
+import DateInputSpecs from './date-input.spec';
import DateInputValidatorSpecs from './date-input.validator.spec';
import DatepickerViewManagerSpecs from './datepicker-view-manager.spec';
import DayComponentSpecs from './day.spec';
diff --git a/projects/angular/src/forms/datepicker/calendar.spec.ts b/projects/angular/src/forms/datepicker/calendar.spec.ts
index 6d2aee30f4..7b8123262b 100644
--- a/projects/angular/src/forms/datepicker/calendar.spec.ts
+++ b/projects/angular/src/forms/datepicker/calendar.spec.ts
@@ -16,7 +16,6 @@ import { DateFormControlService } from './providers/date-form-control.service';
import { DateIOService } from './providers/date-io.service';
import { DateNavigationService } from './providers/date-navigation.service';
import { DatepickerFocusService } from './providers/datepicker-focus.service';
-import { DatePickerHelperService } from './providers/datepicker-helper.service';
import { LocaleHelperService } from './providers/locale-helper.service';
import { ViewManagerService } from './providers/view-manager.service';
@@ -39,7 +38,6 @@ export default function () {
LocaleHelperService,
DatepickerFocusService,
DateFormControlService,
- DatePickerHelperService,
]);
});
diff --git a/projects/angular/src/forms/datepicker/calendar.ts b/projects/angular/src/forms/datepicker/calendar.ts
index 6fdac98fd5..2902b2262f 100644
--- a/projects/angular/src/forms/datepicker/calendar.ts
+++ b/projects/angular/src/forms/datepicker/calendar.ts
@@ -58,10 +58,6 @@ export class ClrCalendar implements OnDestroy {
return this._dateNavigationService.selectedDay;
}
- get selectedEndDay(): DayModel {
- return this._dateNavigationService.selectedEndDay;
- }
-
get focusedDay(): DayModel {
return this._dateNavigationService.focusedDay;
}
@@ -132,18 +128,6 @@ export class ClrCalendar implements OnDestroy {
})
);
- this._subs.push(
- this._dateNavigationService.selectedDayChange.subscribe((selectedDay: DayModel) => {
- this.calendarViewModel.updateSelectedDay(selectedDay);
- })
- );
-
- this._subs.push(
- this._dateNavigationService.selectedEndDayChange.subscribe((selectedDay: DayModel) => {
- this.calendarViewModel.updateSelectedEndDay(selectedDay);
- })
- );
-
this._subs.push(
this._dateNavigationService.focusOnCalendarChange.subscribe(() => {
this._datepickerFocusService.focusCell(this._elRef);
@@ -158,7 +142,6 @@ export class ClrCalendar implements OnDestroy {
this.calendarViewModel = new CalendarViewModel(
this.calendar,
this.selectedDay,
- this.selectedEndDay,
this.focusedDay,
this.today,
this._localeHelperService.firstDayOfWeek,
diff --git a/projects/angular/src/forms/datepicker/date-container.spec.ts b/projects/angular/src/forms/datepicker/date-container.spec.ts
index 8620ab2f95..f37a727989 100644
--- a/projects/angular/src/forms/datepicker/date-container.spec.ts
+++ b/projects/angular/src/forms/datepicker/date-container.spec.ts
@@ -29,7 +29,6 @@ import { DateIOService } from './providers/date-io.service';
import { DateNavigationService } from './providers/date-navigation.service';
import { DatepickerEnabledService } from './providers/datepicker-enabled.service';
import { MockDatepickerEnabledService } from './providers/datepicker-enabled.service.mock';
-import { DatePickerHelperService } from './providers/datepicker-helper.service';
import { LocaleHelperService } from './providers/locale-helper.service';
import { ViewManagerService } from './providers/view-manager.service';
@@ -45,7 +44,6 @@ const DATEPICKER_PROVIDERS: any[] = [
DateIOService,
ControlIdService,
DateFormControlService,
- DatePickerHelperService,
];
export default function () {
diff --git a/projects/angular/src/forms/datepicker/date-container.ts b/projects/angular/src/forms/datepicker/date-container.ts
index 8cc25d6e06..9337e53c74 100644
--- a/projects/angular/src/forms/datepicker/date-container.ts
+++ b/projects/angular/src/forms/datepicker/date-container.ts
@@ -5,16 +5,7 @@
* The full license information can be found in LICENSE in the root directory of this project.
*/
-import {
- AfterViewInit,
- Component,
- ContentChild,
- ElementRef,
- Input,
- Optional,
- Renderer2,
- ViewChild,
-} from '@angular/core';
+import { AfterViewInit, Component, ElementRef, Input, Optional, Renderer2, ViewChild } from '@angular/core';
import { startWith } from 'rxjs/operators';
import { ClrCommonStringsService } from '../../utils/i18n/common-strings.service';
@@ -29,19 +20,16 @@ import { ControlIdService } from '../common/providers/control-id.service';
import { FocusService } from '../common/providers/focus.service';
import { LayoutService } from '../common/providers/layout.service';
import { NgControlService } from '../common/providers/ng-control.service';
-import { ClrDateRangeEndInput } from './date-range-end-input';
-import { ClrDateRangeStartInput } from './date-range-start-input';
import { DayModel } from './model/day.model';
import { DateFormControlService } from './providers/date-form-control.service';
import { DateIOService } from './providers/date-io.service';
import { DateNavigationService } from './providers/date-navigation.service';
import { DatepickerEnabledService } from './providers/datepicker-enabled.service';
-import { DatePickerHelperService } from './providers/datepicker-helper.service';
import { LocaleHelperService } from './providers/locale-helper.service';
import { ViewManagerService } from './providers/view-manager.service';
@Component({
- selector: 'clr-date-container, clr-date-range-container',
+ selector: 'clr-date-container',
template: `
@@ -49,8 +37,6 @@ import { ViewManagerService } from './providers/view-manager.service';
-
-
@@ -98,25 +94,10 @@ export class ClrYearpicker implements AfterViewInit {
: this._dateNavigationService.displayedCalendar.year;
}
- /**
- * Gets the year which the user is currently on.
- */
- get calendarEndYear(): number {
- return this._dateNavigationService.selectedEndDay?.year;
- }
-
get currentCalendarYear(): number {
return new Date().getFullYear();
}
- getIsRangeStartYear(year: number): boolean {
- return this._dateNavigationService.isRangePicker && year === this._dateNavigationService.selectedDay?.year;
- }
-
- getIsRangeEndYear(year: number): boolean {
- return this._dateNavigationService.isRangePicker && year === this._dateNavigationService.selectedEndDay?.year;
- }
-
/**
* Focuses on the current calendar year when the View is initialized.
*/
@@ -156,14 +137,7 @@ export class ClrYearpicker implements AfterViewInit {
*/
changeYear(year: number): void {
this._dateNavigationService.changeYear(year);
- this._viewManagerService.changeToMonthView();
- }
-
- /**
- * Calls the DateNavigationService to update the hovered year value of the calendar
- */
- onHover(year: number): void {
- this._dateNavigationService.hoveredYear = year;
+ this._viewManagerService.changeToDayView();
}
/**
@@ -201,8 +175,6 @@ export class ClrYearpicker implements AfterViewInit {
if (!this.yearRangeModel.inRange(this._focusedYear)) {
if (this.yearRangeModel.inRange(this.calendarYear)) {
this._focusedYear = this.calendarYear;
- } else if (this.yearRangeModel.inRange(this.calendarEndYear)) {
- this._focusedYear = this.calendarEndYear;
} else {
this._focusedYear = this.yearRangeModel.middleYear;
}
@@ -210,22 +182,6 @@ export class ClrYearpicker implements AfterViewInit {
return this._focusedYear === year ? 0 : -1;
}
- /**
- * Applicable only to date range picker
- * Compares the year passed is in between the start and end date range
- */
- isInRange(year: number): boolean {
- if (!this._dateNavigationService.isRangePicker) {
- return false;
- }
- if (this._dateNavigationService.selectedDay?.year && this.calendarEndYear) {
- return year > this.calendarYear && year < this.calendarEndYear;
- } else if (this._dateNavigationService.selectedDay?.year && !this.calendarEndYear) {
- return year > this.calendarYear && year < this._dateNavigationService.hoveredYear;
- } else {
- return false;
- }
- }
/**
* Increments the focus year by the value passed. Updates the YearRangeModel if the
* new value is not in the current decade.
diff --git a/projects/angular/src/forms/tests/container.spec.ts b/projects/angular/src/forms/tests/container.spec.ts
index 7db19df82c..0530f5b067 100644
--- a/projects/angular/src/forms/tests/container.spec.ts
+++ b/projects/angular/src/forms/tests/container.spec.ts
@@ -221,15 +221,14 @@ function fullSpec(description, testContainer, directives: any | any[], testCompo
test.disabled = true;
fixture.detectChanges();
// Have to wait for the whole control to settle or it doesn't track
-
await fixture.whenStable();
expect(containerEl.className).not.toContain('clr-form-control-disabled');
if (test.form) {
// Handle setting disabled based on reactive form
test.form.get('model').reset({ value: '', disabled: true });
- fixture.detectChanges();
- expect(containerEl.className).toContain('clr-form-control-disabled', containerEl.className);
}
+ fixture.detectChanges();
+ expect(containerEl.className).toContain('clr-form-control-disabled');
});
it('implements ngOnDestroy', () => {
diff --git a/projects/demo/src/app/datepicker/datepicker.demo.html b/projects/demo/src/app/datepicker/datepicker.demo.html
index bb7231ab57..78a2c03f8c 100644
--- a/projects/demo/src/app/datepicker/datepicker.demo.html
+++ b/projects/demo/src/app/datepicker/datepicker.demo.html
@@ -23,12 +23,6 @@