Skip to content

Commit 92de837

Browse files
crisbetowagnermaciel
authored andcommitted
fix(material/datepicker): hide date selection model from docs (#22056)
* Hides some symbols related to the date selection model from the public API docs. * Fixes that `MatDateSelectionModel` was marked as a directive, rather than an injectable. Fixes #21985. (cherry picked from commit 8497bb1)
1 parent d3809ad commit 92de837

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

src/material/datepicker/date-selection-model.ts

+26-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {FactoryProvider, Injectable, Optional, SkipSelf, OnDestroy, Directive} from '@angular/core';
9+
import {FactoryProvider, Injectable, Optional, SkipSelf, OnDestroy} from '@angular/core';
1010
import {DateAdapter} from '@angular/material/core';
1111
import {Observable, Subject} from 'rxjs';
1212

@@ -32,7 +32,10 @@ export class DateRange<D> {
3232
*/
3333
export type ExtractDateTypeFromSelection<T> = T extends DateRange<infer D> ? D : NonNullable<T>;
3434

35-
/** Event emitted by the date selection model when its selection changes. */
35+
/**
36+
* Event emitted by the date selection model when its selection changes.
37+
* @docs-private
38+
*/
3639
export interface DateSelectionModelChange<S> {
3740
/** New value for the selection. */
3841
selection: S;
@@ -41,8 +44,11 @@ export interface DateSelectionModelChange<S> {
4144
source: unknown;
4245
}
4346

44-
/** A selection model containing a date selection. */
45-
@Directive()
47+
/**
48+
* A selection model containing a date selection.
49+
* @docs-private
50+
*/
51+
@Injectable()
4652
export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<S>>
4753
implements OnDestroy {
4854
private _selectionChanged = new Subject<DateSelectionModelChange<S>>();
@@ -98,7 +104,10 @@ export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<
98104
}
99105
}
100106

101-
/** A selection model that contains a single date. */
107+
/**
108+
* A selection model that contains a single date.
109+
* @docs-private
110+
*/
102111
@Injectable()
103112
export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | null, D> {
104113
constructor(adapter: DateAdapter<D>) {
@@ -134,7 +143,10 @@ export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | nu
134143
}
135144
}
136145

137-
/** A selection model that contains a date range. */
146+
/**
147+
* A selection model that contains a date range.
148+
* @docs-private
149+
*/
138150
@Injectable()
139151
export class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRange<D>, D> {
140152
constructor(adapter: DateAdapter<D>) {
@@ -203,7 +215,10 @@ export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
203215
return parent || new MatSingleDateSelectionModel(adapter);
204216
}
205217

206-
/** Used to provide a single selection model to a component. */
218+
/**
219+
* Used to provide a single selection model to a component.
220+
* @docs-private
221+
*/
207222
export const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
208223
provide: MatDateSelectionModel,
209224
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
@@ -217,7 +232,10 @@ export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
217232
return parent || new MatRangeDateSelectionModel(adapter);
218233
}
219234

220-
/** Used to provide a range selection model to a component. */
235+
/**
236+
* Used to provide a range selection model to a component.
237+
* @docs-private
238+
*/
221239
export const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
222240
provide: MatDateSelectionModel,
223241
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],

tools/public_api_guard/material/datepicker.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ export declare abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSe
395395
abstract isValid(): boolean;
396396
ngOnDestroy(): void;
397397
updateSelection(value: S, source: unknown): void;
398-
static ɵdir: i0.ɵɵDirectiveDefWithMeta<MatDateSelectionModel<any, any>, never, never, {}, {}, never>;
399398
static ɵfac: i0.ɵɵFactoryDef<MatDateSelectionModel<any, any>, never>;
399+
static ɵprov: i0.ɵɵInjectableDef<MatDateSelectionModel<any, any>>;
400400
}
401401

402402
export declare class MatEndDate<D> extends _MatDateRangeInputBase<D> implements CanUpdateErrorState, DoCheck, OnInit {

0 commit comments

Comments
 (0)