Skip to content
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

fix(material/datepicker): hide date selection model from docs #22056

Merged
merged 1 commit into from
Mar 2, 2021
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
34 changes: 26 additions & 8 deletions src/material/datepicker/date-selection-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {FactoryProvider, Injectable, Optional, SkipSelf, OnDestroy, Directive} from '@angular/core';
import {FactoryProvider, Injectable, Optional, SkipSelf, OnDestroy} from '@angular/core';
import {DateAdapter} from '@angular/material/core';
import {Observable, Subject} from 'rxjs';

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

/** Event emitted by the date selection model when its selection changes. */
/**
* Event emitted by the date selection model when its selection changes.
* @docs-private
*/
export interface DateSelectionModelChange<S> {
/** New value for the selection. */
selection: S;
Expand All @@ -41,8 +44,11 @@ export interface DateSelectionModelChange<S> {
source: unknown;
}

/** A selection model containing a date selection. */
@Directive()
/**
* A selection model containing a date selection.
* @docs-private
*/
@Injectable()
export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<S>>
implements OnDestroy {
private _selectionChanged = new Subject<DateSelectionModelChange<S>>();
Expand Down Expand Up @@ -88,7 +94,10 @@ export abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<
abstract clone(): MatDateSelectionModel<S, D>;
}

/** A selection model that contains a single date. */
/**
* A selection model that contains a single date.
* @docs-private
*/
@Injectable()
export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | null, D> {
constructor(adapter: DateAdapter<D>) {
Expand Down Expand Up @@ -124,7 +133,10 @@ export class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | nu
}
}

/** A selection model that contains a date range. */
/**
* A selection model that contains a date range.
* @docs-private
*/
@Injectable()
export class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRange<D>, D> {
constructor(adapter: DateAdapter<D>) {
Expand Down Expand Up @@ -193,7 +205,10 @@ export function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(
return parent || new MatSingleDateSelectionModel(adapter);
}

/** Used to provide a single selection model to a component. */
/**
* Used to provide a single selection model to a component.
* @docs-private
*/
export const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
provide: MatDateSelectionModel,
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
Expand All @@ -207,7 +222,10 @@ export function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(
return parent || new MatRangeDateSelectionModel(adapter);
}

/** Used to provide a range selection model to a component. */
/**
* Used to provide a range selection model to a component.
* @docs-private
*/
export const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider = {
provide: MatDateSelectionModel,
deps: [[new Optional(), new SkipSelf(), MatDateSelectionModel], DateAdapter],
Expand Down
2 changes: 1 addition & 1 deletion tools/public_api_guard/material/datepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ export declare abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSe
abstract isValid(): boolean;
ngOnDestroy(): void;
updateSelection(value: S, source: unknown): void;
static ɵdir: i0.ɵɵDirectiveDefWithMeta<MatDateSelectionModel<any, any>, never, never, {}, {}, never>;
static ɵfac: i0.ɵɵFactoryDef<MatDateSelectionModel<any, any>, never>;
static ɵprov: i0.ɵɵInjectableDef<MatDateSelectionModel<any, any>>;
}

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