Skip to content

Commit 8497bb1

Browse files
authored
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.
1 parent 4b1ee6f commit 8497bb1

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

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

Lines changed: 26 additions & 8 deletions
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>>();
@@ -88,7 +94,10 @@ export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<
8894
abstract clone(): MatDateSelectionModel<S, D>;
8995
}
9096

91-
/** A selection model that contains a single date. */
97+
/**
98+
* A selection model that contains a single date.
99+
* @docs-private
100+
*/
92101
@Injectable()
93102
export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | null, D> {
94103
constructor(adapter: DateAdapter<D>) {
@@ -124,7 +133,10 @@ export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | nu
124133
}
125134
}
126135

127-
/** A selection model that contains a date range. */
136+
/**
137+
* A selection model that contains a date range.
138+
* @docs-private
139+
*/
128140
@Injectable()
129141
export class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRange<D>, D> {
130142
constructor(adapter: DateAdapter<D>) {
@@ -193,7 +205,10 @@ export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
193205
return parent || new MatSingleDateSelectionModel(adapter);
194206
}
195207

196-
/** Used to provide a single selection model to a component. */
208+
/**
209+
* Used to provide a single selection model to a component.
210+
* @docs-private
211+
*/
197212
export const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
198213
provide: MatDateSelectionModel,
199214
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
@@ -207,7 +222,10 @@ export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
207222
return parent || new MatRangeDateSelectionModel(adapter);
208223
}
209224

210-
/** Used to provide a range selection model to a component. */
225+
/**
226+
* Used to provide a range selection model to a component.
227+
* @docs-private
228+
*/
211229
export const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
212230
provide: MatDateSelectionModel,
213231
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],

tools/public_api_guard/material/datepicker.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ export declare abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSe
394394
abstract isValid(): boolean;
395395
ngOnDestroy(): void;
396396
updateSelection(value: S, source: unknown): void;
397-
static ɵdir: i0.ɵɵDirectiveDefWithMeta<MatDateSelectionModel<any, any>, never, never, {}, {}, never>;
398397
static ɵfac: i0.ɵɵFactoryDef<MatDateSelectionModel<any, any>, never>;
398+
static ɵprov: i0.ɵɵInjectableDef<MatDateSelectionModel<any, any>>;
399399
}
400400

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

0 commit comments

Comments
 (0)