Skip to content

refactor(material/datepicker): remove deprecated APIs for v12 #21952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
14 changes: 2 additions & 12 deletions src/material/datepicker/date-selection-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,8 @@ export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<
/** Checks whether the current selection is complete. */
abstract isComplete(): boolean;

/**
* Clones the selection model.
* @deprecated To be turned into an abstract method.
* @breaking-change 12.0.0
*/
clone(): MatDateSelectionModel<S, D> {
if (typeof ngDevMode === 'undefined' || ngDevMode) {
throw Error('Not implemented');
}

return null!;
}
/** Clones the selection model. */
abstract clone(): MatDateSelectionModel<S, D>;
}

/** A selection model that contains a single date. */
Expand Down
9 changes: 2 additions & 7 deletions src/material/datepicker/datepicker-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,9 @@ export class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>>
private _dateAdapter: DateAdapter<D>,
@Optional() @Inject(MAT_DATE_RANGE_SELECTION_STRATEGY)
private _rangeSelectionStrategy: MatDateRangeSelectionStrategy<D>,
/**
* @deprecated `intl` argument to become required.
* @breaking-change 12.0.0
*/
intl?: MatDatepickerIntl) {
intl: MatDatepickerIntl) {
super(elementRef);
// @breaking-change 12.0.0 Remove fallback for `intl`.
this._closeButtonText = intl?.closeCalendarLabel || 'Close calendar';
this._closeButtonText = intl.closeCalendarLabel;
}

ngOnInit() {
Expand Down
4 changes: 4 additions & 0 deletions src/material/schematics/ng-update/data/constructor-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
{
pr: 'https://github.com/angular/components/pull/21897',
changes: ['MatTooltip']
},
{
pr: 'https://github.com/angular/components/pull/21952',
changes: ['MatDatepickerContent']
}
],
[TargetVersion.V11]: [
Expand Down
5 changes: 2 additions & 3 deletions tools/public_api_guard/material/datepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>
comparisonEnd: D | null;
comparisonStart: D | null;
datepicker: MatDatepickerBase<any, S, D>;
constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _globalModel: MatDateSelectionModel<S, D>, _dateAdapter: DateAdapter<D>, _rangeSelectionStrategy: MatDateRangeSelectionStrategy<D>,
intl?: MatDatepickerIntl);
constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _globalModel: MatDateSelectionModel<S, D>, _dateAdapter: DateAdapter<D>, _rangeSelectionStrategy: MatDateRangeSelectionStrategy<D>, intl: MatDatepickerIntl);
_applyPendingSelection(): void;
_getSelected(): D | DateRange<D> | null;
_handleUserSelection(event: MatCalendarUserEvent<D | null>): void;
Expand Down Expand Up @@ -390,7 +389,7 @@ export declare abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSe
selection: S, _adapter: DateAdapter<D>);
protected _isValidDateInstance(date: D): boolean;
abstract add(date: D | null): void;
clone(): MatDateSelectionModel<S, D>;
abstract clone(): MatDateSelectionModel<S, D>;
abstract isComplete(): boolean;
abstract isValid(): boolean;
ngOnDestroy(): void;
Expand Down