source: trip-planner-front/node_modules/@angular/material/datepicker/date-selection-model.d.ts@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { FactoryProvider, OnDestroy } from '@angular/core';
9import { DateAdapter } from '@angular/material/core';
10import { Observable } from 'rxjs';
11/** A class representing a range of dates. */
12export declare class DateRange<D> {
13 /** The start date of the range. */
14 readonly start: D | null;
15 /** The end date of the range. */
16 readonly end: D | null;
17 /**
18 * Ensures that objects with a `start` and `end` property can't be assigned to a variable that
19 * expects a `DateRange`
20 */
21 private _disableStructuralEquivalency;
22 constructor(
23 /** The start date of the range. */
24 start: D | null,
25 /** The end date of the range. */
26 end: D | null);
27}
28/**
29 * Conditionally picks the date type, if a DateRange is passed in.
30 * @docs-private
31 */
32export declare type ExtractDateTypeFromSelection<T> = T extends DateRange<infer D> ? D : NonNullable<T>;
33/**
34 * Event emitted by the date selection model when its selection changes.
35 * @docs-private
36 */
37export interface DateSelectionModelChange<S> {
38 /** New value for the selection. */
39 selection: S;
40 /** Object that triggered the change. */
41 source: unknown;
42 /** Previous value */
43 oldValue?: S;
44}
45/**
46 * A selection model containing a date selection.
47 * @docs-private
48 */
49export declare abstract class MatDateSelectionModel<S, D = ExtractDateTypeFromSelection<S>> implements OnDestroy {
50 /** The current selection. */
51 readonly selection: S;
52 protected _adapter: DateAdapter<D>;
53 private readonly _selectionChanged;
54 /** Emits when the selection has changed. */
55 selectionChanged: Observable<DateSelectionModelChange<S>>;
56 protected constructor(
57 /** The current selection. */
58 selection: S, _adapter: DateAdapter<D>);
59 /**
60 * Updates the current selection in the model.
61 * @param value New selection that should be assigned.
62 * @param source Object that triggered the selection change.
63 */
64 updateSelection(value: S, source: unknown): void;
65 ngOnDestroy(): void;
66 protected _isValidDateInstance(date: D): boolean;
67 /** Adds a date to the current selection. */
68 abstract add(date: D | null): void;
69 /** Checks whether the current selection is valid. */
70 abstract isValid(): boolean;
71 /** Checks whether the current selection is complete. */
72 abstract isComplete(): boolean;
73 /** Clones the selection model. */
74 abstract clone(): MatDateSelectionModel<S, D>;
75}
76/**
77 * A selection model that contains a single date.
78 * @docs-private
79 */
80export declare class MatSingleDateSelectionModel<D> extends MatDateSelectionModel<D | null, D> {
81 constructor(adapter: DateAdapter<D>);
82 /**
83 * Adds a date to the current selection. In the case of a single date selection, the added date
84 * simply overwrites the previous selection
85 */
86 add(date: D | null): void;
87 /** Checks whether the current selection is valid. */
88 isValid(): boolean;
89 /**
90 * Checks whether the current selection is complete. In the case of a single date selection, this
91 * is true if the current selection is not null.
92 */
93 isComplete(): boolean;
94 /** Clones the selection model. */
95 clone(): MatSingleDateSelectionModel<D>;
96}
97/**
98 * A selection model that contains a date range.
99 * @docs-private
100 */
101export declare class MatRangeDateSelectionModel<D> extends MatDateSelectionModel<DateRange<D>, D> {
102 constructor(adapter: DateAdapter<D>);
103 /**
104 * Adds a date to the current selection. In the case of a date range selection, the added date
105 * fills in the next `null` value in the range. If both the start and the end already have a date,
106 * the selection is reset so that the given date is the new `start` and the `end` is null.
107 */
108 add(date: D | null): void;
109 /** Checks whether the current selection is valid. */
110 isValid(): boolean;
111 /**
112 * Checks whether the current selection is complete. In the case of a date range selection, this
113 * is true if the current selection has a non-null `start` and `end`.
114 */
115 isComplete(): boolean;
116 /** Clones the selection model. */
117 clone(): MatRangeDateSelectionModel<D>;
118}
119/** @docs-private */
120export declare function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(parent: MatSingleDateSelectionModel<unknown>, adapter: DateAdapter<unknown>): MatSingleDateSelectionModel<unknown>;
121/**
122 * Used to provide a single selection model to a component.
123 * @docs-private
124 */
125export declare const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider;
126/** @docs-private */
127export declare function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(parent: MatSingleDateSelectionModel<unknown>, adapter: DateAdapter<unknown>): MatSingleDateSelectionModel<unknown>;
128/**
129 * Used to provide a range selection model to a component.
130 * @docs-private
131 */
132export declare const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider;
Note: See TracBrowser for help on using the repository browser.