@ngx-mce/datetime-picker 21.2.6-next.5 → 21.2.6-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { CdkMonitorFocus, CdkTrapFocus } from '@angular/cdk/a11y';
|
|
2
2
|
import { ComponentPortal, CdkPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, Optional, SkipSelf,
|
|
4
|
+
import { inject, Injectable, Optional, SkipSelf, input, output, computed, ElementRef, NgZone, ChangeDetectionStrategy, ViewEncapsulation, Component, InjectionToken, viewChild, ChangeDetectorRef, Input, forwardRef, linkedSignal, Directive, Injector, ContentChild, model, effect, untracked, HostBinding, DOCUMENT, EventEmitter, ViewContainerRef, Output, booleanAttribute, TemplateRef, Attribute, signal, ViewChild } from '@angular/core';
|
|
5
5
|
import { outputFromObservable, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import * as i4 from '@angular/material/button';
|
|
7
7
|
import { MatButton, MatIconButton, MatButtonModule } from '@angular/material/button';
|
|
8
|
-
import
|
|
9
|
-
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
8
|
+
import { DateAdapter, MAT_DATE_FORMATS, ErrorStateMatcher } from '@angular/material/core';
|
|
10
9
|
import { Subject, Subscription, merge, of } from 'rxjs';
|
|
10
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
11
11
|
import { ESCAPE, hasModifierKey, SPACE, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, BACKSPACE } from '@angular/cdk/keycodes';
|
|
12
12
|
import { take, startWith, debounceTime, filter, takeUntil } from 'rxjs/operators';
|
|
13
13
|
import { Platform, _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
|
|
14
14
|
import { NgClass } from '@angular/common';
|
|
15
|
-
import * as i2 from '@angular/cdk/bidi';
|
|
16
|
-
import { Directionality } from '@angular/cdk/bidi';
|
|
17
15
|
import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
|
|
18
|
-
import * as
|
|
19
|
-
import { NgControl, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormBuilder, FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
20
|
-
import * as i2
|
|
16
|
+
import * as i1 from '@angular/forms';
|
|
17
|
+
import { NgForm, FormGroupDirective, NgControl, Validators, NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer, FormBuilder, FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
18
|
+
import * as i2 from '@angular/material/form-field';
|
|
21
19
|
import { MAT_FORM_FIELD, MatFormFieldControl, MatFormFieldModule, MatFormField } from '@angular/material/form-field';
|
|
22
|
-
import * as i5$1 from '@angular/cdk/overlay';
|
|
23
20
|
import { Overlay, FlexibleConnectedPositionStrategy, OverlayConfig } from '@angular/cdk/overlay';
|
|
24
21
|
import * as i5 from '@angular/material/icon';
|
|
25
22
|
import { MatIconModule } from '@angular/material/icon';
|
|
@@ -52,15 +49,14 @@ class NgxDateRange {
|
|
|
52
49
|
*/
|
|
53
50
|
class NgxMatDateSelectionModel {
|
|
54
51
|
selection;
|
|
55
|
-
_adapter;
|
|
56
52
|
_selectionChanged = new Subject();
|
|
57
53
|
/** Emits when the selection has changed. */
|
|
58
54
|
selectionChanged = this._selectionChanged;
|
|
55
|
+
_adapter = inject((DateAdapter));
|
|
59
56
|
constructor(
|
|
60
57
|
/** The current selection. */
|
|
61
|
-
selection
|
|
58
|
+
selection) {
|
|
62
59
|
this.selection = selection;
|
|
63
|
-
this._adapter = _adapter;
|
|
64
60
|
this.selection = selection;
|
|
65
61
|
}
|
|
66
62
|
/**
|
|
@@ -84,14 +80,14 @@ class NgxMatDateSelectionModel {
|
|
|
84
80
|
}
|
|
85
81
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateSelectionModel, decorators: [{
|
|
86
82
|
type: Injectable
|
|
87
|
-
}], ctorParameters: () => [{ type: undefined }
|
|
83
|
+
}], ctorParameters: () => [{ type: undefined }] });
|
|
88
84
|
/**
|
|
89
85
|
* A selection model that contains a single date.
|
|
90
86
|
* @docs-private
|
|
91
87
|
*/
|
|
92
88
|
class NgxMatSingleDateSelectionModel extends NgxMatDateSelectionModel {
|
|
93
|
-
constructor(
|
|
94
|
-
super(null
|
|
89
|
+
constructor() {
|
|
90
|
+
super(null);
|
|
95
91
|
}
|
|
96
92
|
/**
|
|
97
93
|
* Adds a date to the current selection. In the case of a single date selection, the added date
|
|
@@ -113,23 +109,23 @@ class NgxMatSingleDateSelectionModel extends NgxMatDateSelectionModel {
|
|
|
113
109
|
}
|
|
114
110
|
/** Clones the selection model. */
|
|
115
111
|
clone() {
|
|
116
|
-
const clone = new NgxMatSingleDateSelectionModel(
|
|
112
|
+
const clone = new NgxMatSingleDateSelectionModel();
|
|
117
113
|
clone.updateSelection(this.selection, this);
|
|
118
114
|
return clone;
|
|
119
115
|
}
|
|
120
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatSingleDateSelectionModel, deps: [
|
|
116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatSingleDateSelectionModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
121
117
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatSingleDateSelectionModel });
|
|
122
118
|
}
|
|
123
119
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatSingleDateSelectionModel, decorators: [{
|
|
124
120
|
type: Injectable
|
|
125
|
-
}], ctorParameters: () => [
|
|
121
|
+
}], ctorParameters: () => [] });
|
|
126
122
|
/**
|
|
127
123
|
* A selection model that contains a date range.
|
|
128
124
|
* @docs-private
|
|
129
125
|
*/
|
|
130
126
|
class NgxMatRangeDateSelectionModel extends NgxMatDateSelectionModel {
|
|
131
|
-
constructor(
|
|
132
|
-
super(new NgxDateRange(null, null)
|
|
127
|
+
constructor() {
|
|
128
|
+
super(new NgxDateRange(null, null));
|
|
133
129
|
}
|
|
134
130
|
/**
|
|
135
131
|
* Adds a date to the current selection. In the case of a date range selection, the added date
|
|
@@ -176,19 +172,19 @@ class NgxMatRangeDateSelectionModel extends NgxMatDateSelectionModel {
|
|
|
176
172
|
}
|
|
177
173
|
/** Clones the selection model. */
|
|
178
174
|
clone() {
|
|
179
|
-
const clone = new NgxMatRangeDateSelectionModel(
|
|
175
|
+
const clone = new NgxMatRangeDateSelectionModel();
|
|
180
176
|
clone.updateSelection(this.selection, this);
|
|
181
177
|
return clone;
|
|
182
178
|
}
|
|
183
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatRangeDateSelectionModel, deps: [
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatRangeDateSelectionModel, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
184
180
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatRangeDateSelectionModel });
|
|
185
181
|
}
|
|
186
182
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatRangeDateSelectionModel, decorators: [{
|
|
187
183
|
type: Injectable
|
|
188
|
-
}], ctorParameters: () => [
|
|
184
|
+
}], ctorParameters: () => [] });
|
|
189
185
|
/** @docs-private */
|
|
190
|
-
function NGX_MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(parent
|
|
191
|
-
return parent || new NgxMatSingleDateSelectionModel(
|
|
186
|
+
function NGX_MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(parent) {
|
|
187
|
+
return parent || new NgxMatSingleDateSelectionModel();
|
|
192
188
|
}
|
|
193
189
|
/**
|
|
194
190
|
* Used to provide a single selection model to a component.
|
|
@@ -200,8 +196,8 @@ const NGX_MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER = {
|
|
|
200
196
|
useFactory: NGX_MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY,
|
|
201
197
|
};
|
|
202
198
|
/** @docs-private */
|
|
203
|
-
function NGX_MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(parent
|
|
204
|
-
return parent || new NgxMatRangeDateSelectionModel(
|
|
199
|
+
function NGX_MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(parent) {
|
|
200
|
+
return parent || new NgxMatRangeDateSelectionModel();
|
|
205
201
|
}
|
|
206
202
|
/**
|
|
207
203
|
* Used to provide a range selection model to a component.
|
|
@@ -220,6 +216,63 @@ function createMissingDateImplError$1(provider) {
|
|
|
220
216
|
`custom implementation.`);
|
|
221
217
|
}
|
|
222
218
|
|
|
219
|
+
/** Datepicker data that requires internationalization. */
|
|
220
|
+
class NgxMatDatepickerIntl {
|
|
221
|
+
/**
|
|
222
|
+
* Stream that emits whenever the labels here are changed. Use this to notify
|
|
223
|
+
* components if the labels have changed after initialization.
|
|
224
|
+
*/
|
|
225
|
+
changes = new Subject();
|
|
226
|
+
/** A label for the calendar popup (used by screen readers). */
|
|
227
|
+
calendarLabel = 'Calendar';
|
|
228
|
+
/** A label for the button used to open the calendar popup (used by screen readers). */
|
|
229
|
+
openCalendarLabel = 'Open calendar';
|
|
230
|
+
/** Label for the button used to close the calendar popup. */
|
|
231
|
+
closeCalendarLabel = 'Close calendar';
|
|
232
|
+
/** A label for the previous month button (used by screen readers). */
|
|
233
|
+
prevMonthLabel = 'Previous month';
|
|
234
|
+
/** A label for the next month button (used by screen readers). */
|
|
235
|
+
nextMonthLabel = 'Next month';
|
|
236
|
+
/** A label for the previous year button (used by screen readers). */
|
|
237
|
+
prevYearLabel = 'Previous year';
|
|
238
|
+
/** A label for the next year button (used by screen readers). */
|
|
239
|
+
nextYearLabel = 'Next year';
|
|
240
|
+
/** A label for the previous multi-year button (used by screen readers). */
|
|
241
|
+
prevMultiYearLabel = 'Previous 24 years';
|
|
242
|
+
/** A label for the next multi-year button (used by screen readers). */
|
|
243
|
+
nextMultiYearLabel = 'Next 24 years';
|
|
244
|
+
/** A label for the 'switch to month view' button (used by screen readers). */
|
|
245
|
+
switchToMonthViewLabel = 'Choose date';
|
|
246
|
+
/** A label for the 'switch to year view' button (used by screen readers). */
|
|
247
|
+
switchToMultiYearViewLabel = 'Choose month and year';
|
|
248
|
+
/**
|
|
249
|
+
* A label for the first date of a range of dates (used by screen readers).
|
|
250
|
+
* @deprecated Provide your own internationalization string.
|
|
251
|
+
* @breaking-change 17.0.0
|
|
252
|
+
*/
|
|
253
|
+
startDateLabel = 'Start date';
|
|
254
|
+
/**
|
|
255
|
+
* A label for the last date of a range of dates (used by screen readers).
|
|
256
|
+
* @deprecated Provide your own internationalization string.
|
|
257
|
+
* @breaking-change 17.0.0
|
|
258
|
+
*/
|
|
259
|
+
endDateLabel = 'End date';
|
|
260
|
+
/** Formats a range of years (used for visuals). */
|
|
261
|
+
formatYearRange(start, end) {
|
|
262
|
+
return `${start} \u2013 ${end}`;
|
|
263
|
+
}
|
|
264
|
+
/** Formats a label for a range of years (used by screen readers). */
|
|
265
|
+
formatYearRangeLabel(start, end) {
|
|
266
|
+
return `${start} to ${end}`;
|
|
267
|
+
}
|
|
268
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
269
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, providedIn: 'root' });
|
|
270
|
+
}
|
|
271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, decorators: [{
|
|
272
|
+
type: Injectable,
|
|
273
|
+
args: [{ providedIn: 'root' }]
|
|
274
|
+
}] });
|
|
275
|
+
|
|
223
276
|
/**
|
|
224
277
|
* An internal class that represents the data corresponding to a single calendar cell.
|
|
225
278
|
* @docs-private
|
|
@@ -244,8 +297,6 @@ class NgxMatCalendarCell {
|
|
|
244
297
|
}
|
|
245
298
|
let calendarBodyId = 1;
|
|
246
299
|
class NgxMatCalendarBody {
|
|
247
|
-
_elementRef;
|
|
248
|
-
_ngZone;
|
|
249
300
|
_platform = inject(Platform);
|
|
250
301
|
/**
|
|
251
302
|
* Used to skip the next focus event when rendering the preview range.
|
|
@@ -323,11 +374,11 @@ class NgxMatCalendarBody {
|
|
|
323
374
|
return `${100 / this.numCols()}%`;
|
|
324
375
|
}, ...(ngDevMode ? [{ debugName: "_cellWidth" }] : /* istanbul ignore next */ []));
|
|
325
376
|
_didDragSinceMouseDown = false;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
_ngZone.runOutsideAngular(() => {
|
|
330
|
-
const element = _elementRef.nativeElement;
|
|
377
|
+
_elementRef = inject((ElementRef));
|
|
378
|
+
_ngZone = inject(NgZone);
|
|
379
|
+
constructor() {
|
|
380
|
+
this._ngZone.runOutsideAngular(() => {
|
|
381
|
+
const element = this._elementRef.nativeElement;
|
|
331
382
|
element.addEventListener('mouseenter', this._enterHandler, true);
|
|
332
383
|
element.addEventListener('touchmove', this._touchmoveHandler, true);
|
|
333
384
|
element.addEventListener('focus', this._enterHandler, true);
|
|
@@ -601,7 +652,7 @@ class NgxMatCalendarBody {
|
|
|
601
652
|
_id = `mat-calendar-body-${calendarBodyId++}`;
|
|
602
653
|
_startDateLabelId = `${this._id}-start-date`;
|
|
603
654
|
_endDateLabelId = `${this._id}-end-date`;
|
|
604
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarBody, deps: [
|
|
655
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
605
656
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatCalendarBody, isStandalone: true, selector: "[ngx-mat-calendar-body]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, todayValue: { classPropertyName: "todayValue", publicName: "todayValue", isSignal: true, isRequired: false, transformFunction: null }, startValue: { classPropertyName: "startValue", publicName: "startValue", isSignal: true, isRequired: false, transformFunction: null }, endValue: { classPropertyName: "endValue", publicName: "endValue", isSignal: true, isRequired: false, transformFunction: null }, labelMinRequiredCells: { classPropertyName: "labelMinRequiredCells", publicName: "labelMinRequiredCells", isSignal: true, isRequired: false, transformFunction: null }, numCols: { classPropertyName: "numCols", publicName: "numCols", isSignal: true, isRequired: false, transformFunction: null }, activeCell: { classPropertyName: "activeCell", publicName: "activeCell", isSignal: true, isRequired: false, transformFunction: null }, isRange: { classPropertyName: "isRange", publicName: "isRange", isSignal: true, isRequired: false, transformFunction: null }, cellAspectRatio: { classPropertyName: "cellAspectRatio", publicName: "cellAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, comparisonStart: { classPropertyName: "comparisonStart", publicName: "comparisonStart", isSignal: true, isRequired: false, transformFunction: null }, comparisonEnd: { classPropertyName: "comparisonEnd", publicName: "comparisonEnd", isSignal: true, isRequired: false, transformFunction: null }, previewStart: { classPropertyName: "previewStart", publicName: "previewStart", isSignal: true, isRequired: false, transformFunction: null }, previewEnd: { classPropertyName: "previewEnd", publicName: "previewEnd", isSignal: true, isRequired: false, transformFunction: null }, startDateAccessibleName: { classPropertyName: "startDateAccessibleName", publicName: "startDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, endDateAccessibleName: { classPropertyName: "endDateAccessibleName", publicName: "endDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedValueChange: "selectedValueChange", previewChange: "previewChange", activeDateChange: "activeDateChange", dragStarted: "dragStarted", dragEnded: "dragEnded" }, host: { classAttribute: "ngx-mat-calendar-body" }, exportAs: ["matCalendarBody"], ngImport: i0, template: "<!--\nIf there's not enough space in the first row, create a separate label row. We mark this row as\naria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n@if (_firstRowOffset()! < labelMinRequiredCells()!) {\n <tr aria-hidden=\"true\">\n <td\n class=\"mat-calendar-body-label\"\n [attr.colspan]=\"numCols()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\">\n {{ label() }}\n </td>\n </tr>\n}\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n@for (row of rows(); track rowIndex; let rowIndex = $index) {\n <tr role=\"row\">\n <!--\n This cell is purely decorative, but we can't put `aria-hidden` or `role=\"presentation\"` on it,\n because it throws off the week days for the rest of the row on NVDA. The aspect ratio of the\n table cells is maintained by setting the top and bottom padding as a percentage of the width\n (a variant of the trick described here: https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n @if (rowIndex === 0 && _firstRowOffset()) {\n <td\n class=\"mat-calendar-body-label\"\n [attr.colspan]=\"_firstRowOffset()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\">\n {{ _firstRowOffset()! >= labelMinRequiredCells()! ? label() : '' }}\n </td>\n }\n <!--\n Each gridcell in the calendar contains a button, which signals to assistive technology that the\n cell is interactable, as well as the selection state via `aria-pressed`. See #23476 for\n background.\n -->\n @for (item of row; track colIndex; let colIndex = $index) {\n <td\n role=\"gridcell\"\n class=\"mat-calendar-body-cell-container\"\n [style.width]=\"_cellWidth()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\">\n <button\n type=\"button\"\n class=\"mat-calendar-body-cell\"\n [ngClass]=\"item.cssClasses\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mat-calendar-body-disabled]=\"!item.enabled\"\n [class.mat-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mat-calendar-body-range-start]=\"_isRangeStart(item.compareValue)\"\n [class.mat-calendar-body-range-end]=\"_isRangeEnd(item.compareValue)\"\n [class.mat-calendar-body-in-range]=\"_isInRange(item.compareValue)\"\n [class.mat-calendar-body-comparison-bridge-start]=\"\n _isComparisonBridgeStart(item.compareValue, rowIndex, colIndex)\n \"\n [class.mat-calendar-body-comparison-bridge-end]=\"\n _isComparisonBridgeEnd(item.compareValue, rowIndex, colIndex)\n \"\n [class.mat-calendar-body-comparison-start]=\"_isComparisonStart(item.compareValue)\"\n [class.mat-calendar-body-comparison-end]=\"_isComparisonEnd(item.compareValue)\"\n [class.mat-calendar-body-in-comparison-range]=\"_isInComparisonRange(item.compareValue)\"\n [class.mat-calendar-body-preview-start]=\"_isPreviewStart(item.compareValue)\"\n [class.mat-calendar-body-preview-end]=\"_isPreviewEnd(item.compareValue)\"\n [class.mat-calendar-body-in-preview]=\"_isInPreview(item.compareValue)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [attr.aria-pressed]=\"_isSelected(item.compareValue)\"\n [attr.aria-current]=\"todayValue() === item.compareValue ? 'date' : null\"\n [attr.aria-describedby]=\"_getDescribedby(item.compareValue)\"\n (click)=\"_cellClicked(item, $event)\"\n (focus)=\"_emitActiveDateChange(item, $event)\">\n <span\n class=\"mat-calendar-body-cell-content mat-focus-indicator\"\n [class.mat-calendar-body-selected]=\"_isSelected(item.compareValue)\"\n [class.mat-calendar-body-comparison-identical]=\"\n _isComparisonIdentical(item.compareValue)\n \"\n [class.mat-calendar-body-today]=\"todayValue() === item.compareValue\">\n {{ item.displayValue }}\n </span>\n <span class=\"mat-calendar-body-cell-preview\" aria-hidden=\"true\"></span>\n </button>\n </td>\n }\n </tr>\n}\n\n<label [id]=\"_startDateLabelId\" class=\"mat-calendar-body-hidden-label\">\n {{ startDateAccessibleName() }}\n</label>\n<label [id]=\"_endDateLabelId\" class=\"mat-calendar-body-hidden-label\">\n {{ endDateAccessibleName() }}\n</label>\n", styles: [".mat-calendar-body{min-width:224px}.mat-calendar-body-label{height:0;line-height:0;padding-left:4.7142857143%;padding-right:4.7142857143%;text-align:start;font-size:var(--mat-datepicker-calendar-body-label-text-size, var(--mat-sys-title-small-size));font-weight:var(--mat-datepicker-calendar-body-label-text-weight, var(--mat-sys-title-small-weight));color:var(--mat-datepicker-calendar-body-label-text-color, var(--mat-sys-on-surface))}.mat-calendar-body-hidden-label{display:none}.mat-calendar-body-cell-container{position:relative;height:0;line-height:0}.mat-calendar-body-cell-container .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background-color:var(--mat-datepicker-calendar-date-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-calendar-body-disabled>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){color:var(--mat-datepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-calendar-body-cell{-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent}.mat-calendar-body-cell::-moz-focus-inner{border:0}.mat-calendar-body-cell{position:absolute;top:0;left:0;width:100%;height:100%;background:none;text-align:center;outline:none;font-family:var(--mat-datepicker-calendar-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-datepicker-calendar-text-size, var(--mat-sys-body-medium-size));margin:0}.mat-calendar-body-cell:before,.mat-calendar-body-cell:after,.mat-calendar-body-cell-preview{content:\"\";position:absolute;top:5%;left:0;z-index:0;box-sizing:border-box;display:block;height:90%;width:100%}.mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range):before,.mat-calendar-body-range-start:after,.mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start):before,.mat-calendar-body-comparison-start:after,.mat-calendar-body-preview-start .mat-calendar-body-cell-preview{left:5%;width:95%;border-top-left-radius:999px;border-bottom-left-radius:999px}[dir=rtl] .mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range):before,[dir=rtl] .mat-calendar-body-range-start:after,[dir=rtl] .mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start):before,[dir=rtl] .mat-calendar-body-comparison-start:after,[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview{left:0;border-radius:0 999px 999px 0}.mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range):before,.mat-calendar-body-range-end:after,.mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end):before,.mat-calendar-body-comparison-end:after,.mat-calendar-body-preview-end .mat-calendar-body-cell-preview{width:95%;border-top-right-radius:999px;border-bottom-right-radius:999px}[dir=rtl] .mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range):before,[dir=rtl] .mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end):before,[dir=rtl] .mat-calendar-body-comparison-end:after,[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview{left:5%;border-radius:999px 0 0 999px}[dir=rtl] .mat-calendar-body-comparison-bridge-start.mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-bridge-end.mat-calendar-body-range-start:after{width:95%;border-top-right-radius:999px;border-bottom-right-radius:999px}.mat-calendar-body-comparison-start.mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-start.mat-calendar-body-range-end:after,.mat-calendar-body-comparison-end.mat-calendar-body-range-start:after,[dir=rtl] .mat-calendar-body-comparison-end.mat-calendar-body-range-start:after{width:90%}.mat-calendar-body-in-preview .mat-calendar-body-cell-preview{border-top:dashed 1px;border-bottom:dashed 1px}.mat-calendar-body-preview-start .mat-calendar-body-cell-preview{border-left:dashed 1px}[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview{border-left:0;border-right:dashed 1px}.mat-calendar-body-preview-end .mat-calendar-body-cell-preview{border-right:dashed 1px}[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview{border-right:0;border-left:dashed 1px}.mat-calendar-body-disabled{cursor:default}@media(forced-colors:active){.mat-calendar-body-disabled{opacity:.5}}.mat-calendar-body-cell-content{top:5%;left:5%;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-style:solid;border-radius:999px;color:var(--mat-datepicker-calendar-date-text-color, var(--mat-sys-on-surface));border-color:var(--mat-datepicker-calendar-date-outline-color, transparent)}.mat-calendar-body-cell-content.mat-calendar-body-selected{background-color:var(--mat-datepicker-calendar-date-selected-state-background-color, var(--mat-sys-primary));color:var(--mat-datepicker-calendar-date-selected-state-text-color, var(--mat-sys-on-primary))}.mat-calendar-body-cell-content.mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){border-color:var(--mat-datepicker-calendar-date-today-outline-color, var(--mat-sys-primary))}.mat-calendar-body-cell-content.mat-focus-indicator{position:absolute}@media(forced-colors:active){.mat-calendar-body-cell-content{border:none}}@media(forced-colors:active){.mat-datepicker-popup:not(:empty),.mat-calendar-body-cell:not(.mat-calendar-body-in-range) .mat-calendar-body-selected{outline:solid 1px}.mat-calendar-body-today{outline:dotted 1px}.mat-calendar-body-cell:before,.mat-calendar-body-cell:after,.mat-calendar-body-selected{background:none}.mat-calendar-body-in-range:before,.mat-calendar-body-comparison-bridge-start:before,.mat-calendar-body-comparison-bridge-end:before{border-top:solid 1px;border-bottom:solid 1px}.mat-calendar-body-range-start:before{border-left:solid 1px}[dir=rtl] .mat-calendar-body-range-start:before{border-left:0;border-right:solid 1px}.mat-calendar-body-range-end:before{border-right:solid 1px}[dir=rtl] .mat-calendar-body-range-end:before{border-right:0;border-left:solid 1px}.mat-calendar-body-in-comparison-range:before{border-top:dashed 1px;border-bottom:dashed 1px}.mat-calendar-body-comparison-start:before{border-left:dashed 1px}[dir=rtl] .mat-calendar-body-comparison-start:before{border-left:0;border-right:dashed 1px}.mat-calendar-body-comparison-end:before{border-right:dashed 1px}[dir=rtl] .mat-calendar-body-comparison-end:before{border-right:0;border-left:dashed 1px}}[dir=rtl] .mat-calendar-body-label{text-align:right}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
606
657
|
}
|
|
607
658
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarBody, decorators: [{
|
|
@@ -609,7 +660,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
609
660
|
args: [{ selector: '[ngx-mat-calendar-body]', host: {
|
|
610
661
|
class: 'ngx-mat-calendar-body',
|
|
611
662
|
}, exportAs: 'matCalendarBody', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgClass], template: "<!--\nIf there's not enough space in the first row, create a separate label row. We mark this row as\naria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n@if (_firstRowOffset()! < labelMinRequiredCells()!) {\n <tr aria-hidden=\"true\">\n <td\n class=\"mat-calendar-body-label\"\n [attr.colspan]=\"numCols()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\">\n {{ label() }}\n </td>\n </tr>\n}\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n@for (row of rows(); track rowIndex; let rowIndex = $index) {\n <tr role=\"row\">\n <!--\n This cell is purely decorative, but we can't put `aria-hidden` or `role=\"presentation\"` on it,\n because it throws off the week days for the rest of the row on NVDA. The aspect ratio of the\n table cells is maintained by setting the top and bottom padding as a percentage of the width\n (a variant of the trick described here: https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n @if (rowIndex === 0 && _firstRowOffset()) {\n <td\n class=\"mat-calendar-body-label\"\n [attr.colspan]=\"_firstRowOffset()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\">\n {{ _firstRowOffset()! >= labelMinRequiredCells()! ? label() : '' }}\n </td>\n }\n <!--\n Each gridcell in the calendar contains a button, which signals to assistive technology that the\n cell is interactable, as well as the selection state via `aria-pressed`. See #23476 for\n background.\n -->\n @for (item of row; track colIndex; let colIndex = $index) {\n <td\n role=\"gridcell\"\n class=\"mat-calendar-body-cell-container\"\n [style.width]=\"_cellWidth()\"\n [style.paddingTop]=\"_cellPadding()\"\n [style.paddingBottom]=\"_cellPadding()\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\">\n <button\n type=\"button\"\n class=\"mat-calendar-body-cell\"\n [ngClass]=\"item.cssClasses\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mat-calendar-body-disabled]=\"!item.enabled\"\n [class.mat-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n [class.mat-calendar-body-range-start]=\"_isRangeStart(item.compareValue)\"\n [class.mat-calendar-body-range-end]=\"_isRangeEnd(item.compareValue)\"\n [class.mat-calendar-body-in-range]=\"_isInRange(item.compareValue)\"\n [class.mat-calendar-body-comparison-bridge-start]=\"\n _isComparisonBridgeStart(item.compareValue, rowIndex, colIndex)\n \"\n [class.mat-calendar-body-comparison-bridge-end]=\"\n _isComparisonBridgeEnd(item.compareValue, rowIndex, colIndex)\n \"\n [class.mat-calendar-body-comparison-start]=\"_isComparisonStart(item.compareValue)\"\n [class.mat-calendar-body-comparison-end]=\"_isComparisonEnd(item.compareValue)\"\n [class.mat-calendar-body-in-comparison-range]=\"_isInComparisonRange(item.compareValue)\"\n [class.mat-calendar-body-preview-start]=\"_isPreviewStart(item.compareValue)\"\n [class.mat-calendar-body-preview-end]=\"_isPreviewEnd(item.compareValue)\"\n [class.mat-calendar-body-in-preview]=\"_isInPreview(item.compareValue)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [attr.aria-pressed]=\"_isSelected(item.compareValue)\"\n [attr.aria-current]=\"todayValue() === item.compareValue ? 'date' : null\"\n [attr.aria-describedby]=\"_getDescribedby(item.compareValue)\"\n (click)=\"_cellClicked(item, $event)\"\n (focus)=\"_emitActiveDateChange(item, $event)\">\n <span\n class=\"mat-calendar-body-cell-content mat-focus-indicator\"\n [class.mat-calendar-body-selected]=\"_isSelected(item.compareValue)\"\n [class.mat-calendar-body-comparison-identical]=\"\n _isComparisonIdentical(item.compareValue)\n \"\n [class.mat-calendar-body-today]=\"todayValue() === item.compareValue\">\n {{ item.displayValue }}\n </span>\n <span class=\"mat-calendar-body-cell-preview\" aria-hidden=\"true\"></span>\n </button>\n </td>\n }\n </tr>\n}\n\n<label [id]=\"_startDateLabelId\" class=\"mat-calendar-body-hidden-label\">\n {{ startDateAccessibleName() }}\n</label>\n<label [id]=\"_endDateLabelId\" class=\"mat-calendar-body-hidden-label\">\n {{ endDateAccessibleName() }}\n</label>\n", styles: [".mat-calendar-body{min-width:224px}.mat-calendar-body-label{height:0;line-height:0;padding-left:4.7142857143%;padding-right:4.7142857143%;text-align:start;font-size:var(--mat-datepicker-calendar-body-label-text-size, var(--mat-sys-title-small-size));font-weight:var(--mat-datepicker-calendar-body-label-text-weight, var(--mat-sys-title-small-weight));color:var(--mat-datepicker-calendar-body-label-text-color, var(--mat-sys-on-surface))}.mat-calendar-body-hidden-label{display:none}.mat-calendar-body-cell-container{position:relative;height:0;line-height:0}.mat-calendar-body-cell-container .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background-color:var(--mat-datepicker-calendar-date-hover-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-calendar-body-disabled>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){color:var(--mat-datepicker-calendar-date-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-calendar-body-cell{-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent}.mat-calendar-body-cell::-moz-focus-inner{border:0}.mat-calendar-body-cell{position:absolute;top:0;left:0;width:100%;height:100%;background:none;text-align:center;outline:none;font-family:var(--mat-datepicker-calendar-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-datepicker-calendar-text-size, var(--mat-sys-body-medium-size));margin:0}.mat-calendar-body-cell:before,.mat-calendar-body-cell:after,.mat-calendar-body-cell-preview{content:\"\";position:absolute;top:5%;left:0;z-index:0;box-sizing:border-box;display:block;height:90%;width:100%}.mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range):before,.mat-calendar-body-range-start:after,.mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start):before,.mat-calendar-body-comparison-start:after,.mat-calendar-body-preview-start .mat-calendar-body-cell-preview{left:5%;width:95%;border-top-left-radius:999px;border-bottom-left-radius:999px}[dir=rtl] .mat-calendar-body-range-start:not(.mat-calendar-body-in-comparison-range):before,[dir=rtl] .mat-calendar-body-range-start:after,[dir=rtl] .mat-calendar-body-comparison-start:not(.mat-calendar-body-comparison-bridge-start):before,[dir=rtl] .mat-calendar-body-comparison-start:after,[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview{left:0;border-radius:0 999px 999px 0}.mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range):before,.mat-calendar-body-range-end:after,.mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end):before,.mat-calendar-body-comparison-end:after,.mat-calendar-body-preview-end .mat-calendar-body-cell-preview{width:95%;border-top-right-radius:999px;border-bottom-right-radius:999px}[dir=rtl] .mat-calendar-body-range-end:not(.mat-calendar-body-in-comparison-range):before,[dir=rtl] .mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-end:not(.mat-calendar-body-comparison-bridge-end):before,[dir=rtl] .mat-calendar-body-comparison-end:after,[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview{left:5%;border-radius:999px 0 0 999px}[dir=rtl] .mat-calendar-body-comparison-bridge-start.mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-bridge-end.mat-calendar-body-range-start:after{width:95%;border-top-right-radius:999px;border-bottom-right-radius:999px}.mat-calendar-body-comparison-start.mat-calendar-body-range-end:after,[dir=rtl] .mat-calendar-body-comparison-start.mat-calendar-body-range-end:after,.mat-calendar-body-comparison-end.mat-calendar-body-range-start:after,[dir=rtl] .mat-calendar-body-comparison-end.mat-calendar-body-range-start:after{width:90%}.mat-calendar-body-in-preview .mat-calendar-body-cell-preview{border-top:dashed 1px;border-bottom:dashed 1px}.mat-calendar-body-preview-start .mat-calendar-body-cell-preview{border-left:dashed 1px}[dir=rtl] .mat-calendar-body-preview-start .mat-calendar-body-cell-preview{border-left:0;border-right:dashed 1px}.mat-calendar-body-preview-end .mat-calendar-body-cell-preview{border-right:dashed 1px}[dir=rtl] .mat-calendar-body-preview-end .mat-calendar-body-cell-preview{border-right:0;border-left:dashed 1px}.mat-calendar-body-disabled{cursor:default}@media(forced-colors:active){.mat-calendar-body-disabled{opacity:.5}}.mat-calendar-body-cell-content{top:5%;left:5%;z-index:1;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-style:solid;border-radius:999px;color:var(--mat-datepicker-calendar-date-text-color, var(--mat-sys-on-surface));border-color:var(--mat-datepicker-calendar-date-outline-color, transparent)}.mat-calendar-body-cell-content.mat-calendar-body-selected{background-color:var(--mat-datepicker-calendar-date-selected-state-background-color, var(--mat-sys-primary));color:var(--mat-datepicker-calendar-date-selected-state-text-color, var(--mat-sys-on-primary))}.mat-calendar-body-cell-content.mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){border-color:var(--mat-datepicker-calendar-date-today-outline-color, var(--mat-sys-primary))}.mat-calendar-body-cell-content.mat-focus-indicator{position:absolute}@media(forced-colors:active){.mat-calendar-body-cell-content{border:none}}@media(forced-colors:active){.mat-datepicker-popup:not(:empty),.mat-calendar-body-cell:not(.mat-calendar-body-in-range) .mat-calendar-body-selected{outline:solid 1px}.mat-calendar-body-today{outline:dotted 1px}.mat-calendar-body-cell:before,.mat-calendar-body-cell:after,.mat-calendar-body-selected{background:none}.mat-calendar-body-in-range:before,.mat-calendar-body-comparison-bridge-start:before,.mat-calendar-body-comparison-bridge-end:before{border-top:solid 1px;border-bottom:solid 1px}.mat-calendar-body-range-start:before{border-left:solid 1px}[dir=rtl] .mat-calendar-body-range-start:before{border-left:0;border-right:solid 1px}.mat-calendar-body-range-end:before{border-right:solid 1px}[dir=rtl] .mat-calendar-body-range-end:before{border-right:0;border-left:solid 1px}.mat-calendar-body-in-comparison-range:before{border-top:dashed 1px;border-bottom:dashed 1px}.mat-calendar-body-comparison-start:before{border-left:dashed 1px}[dir=rtl] .mat-calendar-body-comparison-start:before{border-left:0;border-right:dashed 1px}.mat-calendar-body-comparison-end:before{border-right:dashed 1px}[dir=rtl] .mat-calendar-body-comparison-end:before{border-right:0;border-left:dashed 1px}}[dir=rtl] .mat-calendar-body-label{text-align:right}\n"] }]
|
|
612
|
-
}], ctorParameters: () => [
|
|
663
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], todayValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "todayValue", required: false }] }], startValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "startValue", required: false }] }], endValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "endValue", required: false }] }], labelMinRequiredCells: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelMinRequiredCells", required: false }] }], numCols: [{ type: i0.Input, args: [{ isSignal: true, alias: "numCols", required: false }] }], activeCell: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeCell", required: false }] }], isRange: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRange", required: false }] }], cellAspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellAspectRatio", required: false }] }], comparisonStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "comparisonStart", required: false }] }], comparisonEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "comparisonEnd", required: false }] }], previewStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewStart", required: false }] }], previewEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewEnd", required: false }] }], startDateAccessibleName: [{ type: i0.Input, args: [{ isSignal: true, alias: "startDateAccessibleName", required: false }] }], endDateAccessibleName: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDateAccessibleName", required: false }] }], selectedValueChange: [{ type: i0.Output, args: ["selectedValueChange"] }], previewChange: [{ type: i0.Output, args: ["previewChange"] }], activeDateChange: [{ type: i0.Output, args: ["activeDateChange"] }], dragStarted: [{ type: i0.Output, args: ["dragStarted"] }], dragEnded: [{ type: i0.Output, args: ["dragEnded"] }] } });
|
|
613
664
|
/** Checks whether a node is a table cell element. */
|
|
614
665
|
function isTableCell(node) {
|
|
615
666
|
return node?.nodeName === 'TD';
|
|
@@ -661,10 +712,7 @@ function getActualTouchTarget(event) {
|
|
|
661
712
|
const NGX_MAT_DATE_RANGE_SELECTION_STRATEGY = new InjectionToken('NGX_MAT_DATE_RANGE_SELECTION_STRATEGY');
|
|
662
713
|
/** Provides the default date range selection behavior. */
|
|
663
714
|
class DefaultNgxMatCalendarRangeStrategy {
|
|
664
|
-
_dateAdapter;
|
|
665
|
-
constructor(_dateAdapter) {
|
|
666
|
-
this._dateAdapter = _dateAdapter;
|
|
667
|
-
}
|
|
715
|
+
_dateAdapter = inject((DateAdapter));
|
|
668
716
|
selectionFinished(date, currentRange) {
|
|
669
717
|
let { start, end } = currentRange;
|
|
670
718
|
if (start == null) {
|
|
@@ -726,15 +774,15 @@ class DefaultNgxMatCalendarRangeStrategy {
|
|
|
726
774
|
}
|
|
727
775
|
return new NgxDateRange(start, end);
|
|
728
776
|
}
|
|
729
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultNgxMatCalendarRangeStrategy, deps: [
|
|
777
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultNgxMatCalendarRangeStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
730
778
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultNgxMatCalendarRangeStrategy });
|
|
731
779
|
}
|
|
732
780
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: DefaultNgxMatCalendarRangeStrategy, decorators: [{
|
|
733
781
|
type: Injectable
|
|
734
|
-
}]
|
|
782
|
+
}] });
|
|
735
783
|
/** @docs-private */
|
|
736
|
-
function NGX_MAT_CALENDAR_RANGE_STRATEGY_PROVIDER_FACTORY(parent
|
|
737
|
-
return parent || new DefaultNgxMatCalendarRangeStrategy(
|
|
784
|
+
function NGX_MAT_CALENDAR_RANGE_STRATEGY_PROVIDER_FACTORY(parent) {
|
|
785
|
+
return parent || new DefaultNgxMatCalendarRangeStrategy();
|
|
738
786
|
}
|
|
739
787
|
const NGX_MAT_CALENDAR_RANGE_STRATEGY_PROVIDER = {
|
|
740
788
|
provide: NGX_MAT_DATE_RANGE_SELECTION_STRATEGY,
|
|
@@ -748,11 +796,6 @@ const DAYS_PER_WEEK = 7;
|
|
|
748
796
|
* @docs-private
|
|
749
797
|
*/
|
|
750
798
|
class NgxMatMonthView {
|
|
751
|
-
_changeDetectorRef;
|
|
752
|
-
_dateFormats;
|
|
753
|
-
_dateAdapter;
|
|
754
|
-
_dir;
|
|
755
|
-
_rangeStrategy;
|
|
756
799
|
_rerenderSubscription = Subscription.EMPTY;
|
|
757
800
|
/** Flag used to filter out space/enter keyup events that originated outside of the view. */
|
|
758
801
|
_selectionKeyPressed = false;
|
|
@@ -763,6 +806,8 @@ class NgxMatMonthView {
|
|
|
763
806
|
return this._activeDate;
|
|
764
807
|
}
|
|
765
808
|
set activeDate(value) {
|
|
809
|
+
if (!this._dateAdapter)
|
|
810
|
+
return;
|
|
766
811
|
const oldActiveDate = this._activeDate;
|
|
767
812
|
const validDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)) ||
|
|
768
813
|
this._dateAdapter.today();
|
|
@@ -777,7 +822,7 @@ class NgxMatMonthView {
|
|
|
777
822
|
return this._selected;
|
|
778
823
|
}
|
|
779
824
|
set selected(value) {
|
|
780
|
-
if (value instanceof NgxDateRange) {
|
|
825
|
+
if (!this._dateAdapter || value instanceof NgxDateRange) {
|
|
781
826
|
this._selected = value;
|
|
782
827
|
}
|
|
783
828
|
else {
|
|
@@ -791,6 +836,10 @@ class NgxMatMonthView {
|
|
|
791
836
|
return this._minDate;
|
|
792
837
|
}
|
|
793
838
|
set minDate(value) {
|
|
839
|
+
if (!this._dateAdapter) {
|
|
840
|
+
this._minDate = null;
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
794
843
|
this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
795
844
|
}
|
|
796
845
|
_minDate = null;
|
|
@@ -799,6 +848,10 @@ class NgxMatMonthView {
|
|
|
799
848
|
return this._maxDate;
|
|
800
849
|
}
|
|
801
850
|
set maxDate(value) {
|
|
851
|
+
if (!this._dateAdapter) {
|
|
852
|
+
this._maxDate = null;
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
802
855
|
this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
803
856
|
}
|
|
804
857
|
_maxDate = null;
|
|
@@ -855,12 +908,12 @@ class NgxMatMonthView {
|
|
|
855
908
|
_todayDate = null;
|
|
856
909
|
/** The names of the weekdays. */
|
|
857
910
|
_weekdays = null;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
911
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
912
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
913
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
914
|
+
_dir = inject(Directionality, { optional: true });
|
|
915
|
+
_rangeStrategy = inject(NGX_MAT_DATE_RANGE_SELECTION_STRATEGY, { optional: true });
|
|
916
|
+
constructor() {
|
|
864
917
|
if (!this._dateAdapter) {
|
|
865
918
|
throw createMissingDateImplError$1('DateAdapter');
|
|
866
919
|
}
|
|
@@ -870,6 +923,8 @@ class NgxMatMonthView {
|
|
|
870
923
|
this._activeDate = this._dateAdapter.today();
|
|
871
924
|
}
|
|
872
925
|
ngAfterContentInit() {
|
|
926
|
+
if (!this._dateAdapter)
|
|
927
|
+
return;
|
|
873
928
|
this._rerenderSubscription = this._dateAdapter.localeChanges
|
|
874
929
|
.pipe(startWith(null))
|
|
875
930
|
.subscribe(() => this._init());
|
|
@@ -919,8 +974,9 @@ class NgxMatMonthView {
|
|
|
919
974
|
_updateActiveDate(event) {
|
|
920
975
|
const month = event.value;
|
|
921
976
|
const oldActiveDate = this._activeDate;
|
|
922
|
-
|
|
923
|
-
if (this._dateAdapter.compareDate(oldActiveDate,
|
|
977
|
+
const dateToAssign = this._getDateFromDayOfMonth(month);
|
|
978
|
+
if (this._dateAdapter && dateToAssign && this._dateAdapter.compareDate(oldActiveDate, dateToAssign)) {
|
|
979
|
+
this.activeDate = dateToAssign;
|
|
924
980
|
this.activeDateChange.emit(this._activeDate);
|
|
925
981
|
}
|
|
926
982
|
}
|
|
@@ -933,33 +989,33 @@ class NgxMatMonthView {
|
|
|
933
989
|
const isRtl = this._isRtl();
|
|
934
990
|
switch (event.keyCode) {
|
|
935
991
|
case LEFT_ARROW:
|
|
936
|
-
this.activeDate = this._dateAdapter
|
|
992
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
|
|
937
993
|
break;
|
|
938
994
|
case RIGHT_ARROW:
|
|
939
|
-
this.activeDate = this._dateAdapter
|
|
995
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
|
|
940
996
|
break;
|
|
941
997
|
case UP_ARROW:
|
|
942
|
-
this.activeDate = this._dateAdapter
|
|
998
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, -7);
|
|
943
999
|
break;
|
|
944
1000
|
case DOWN_ARROW:
|
|
945
|
-
this.activeDate = this._dateAdapter
|
|
1001
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, 7);
|
|
946
1002
|
break;
|
|
947
1003
|
case HOME:
|
|
948
|
-
this.activeDate = this._dateAdapter
|
|
1004
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, 1 - this._dateAdapter.getDate(this._activeDate));
|
|
949
1005
|
break;
|
|
950
1006
|
case END:
|
|
951
|
-
this.activeDate = this._dateAdapter
|
|
1007
|
+
this.activeDate = this._dateAdapter?.addCalendarDays(this._activeDate, this._dateAdapter.getNumDaysInMonth(this._activeDate) -
|
|
952
1008
|
this._dateAdapter.getDate(this._activeDate));
|
|
953
1009
|
break;
|
|
954
1010
|
case PAGE_UP:
|
|
955
1011
|
this.activeDate = event.altKey
|
|
956
|
-
? this._dateAdapter
|
|
957
|
-
: this._dateAdapter
|
|
1012
|
+
? this._dateAdapter?.addCalendarYears(this._activeDate, -1)
|
|
1013
|
+
: this._dateAdapter?.addCalendarMonths(this._activeDate, -1);
|
|
958
1014
|
break;
|
|
959
1015
|
case PAGE_DOWN:
|
|
960
1016
|
this.activeDate = event.altKey
|
|
961
|
-
? this._dateAdapter
|
|
962
|
-
: this._dateAdapter
|
|
1017
|
+
? this._dateAdapter?.addCalendarYears(this._activeDate, 1)
|
|
1018
|
+
: this._dateAdapter?.addCalendarMonths(this._activeDate, 1);
|
|
963
1019
|
break;
|
|
964
1020
|
case ENTER:
|
|
965
1021
|
case SPACE:
|
|
@@ -994,7 +1050,7 @@ class NgxMatMonthView {
|
|
|
994
1050
|
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
995
1051
|
return;
|
|
996
1052
|
}
|
|
997
|
-
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1053
|
+
if (this._dateAdapter && this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
998
1054
|
this.activeDateChange.emit(this.activeDate);
|
|
999
1055
|
this._focusActiveCellAfterViewChecked();
|
|
1000
1056
|
}
|
|
@@ -1004,7 +1060,7 @@ class NgxMatMonthView {
|
|
|
1004
1060
|
/** Handles keyup events on the calendar body when calendar is in month view. */
|
|
1005
1061
|
_handleCalendarBodyKeyup(event) {
|
|
1006
1062
|
if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
|
1007
|
-
if (this._selectionKeyPressed && this._canSelect(this._activeDate)) {
|
|
1063
|
+
if (this._dateAdapter && this._selectionKeyPressed && this._canSelect(this._activeDate)) {
|
|
1008
1064
|
this._dateSelected({
|
|
1009
1065
|
value: this._dateAdapter.getDate(this._activeDate),
|
|
1010
1066
|
event,
|
|
@@ -1015,12 +1071,13 @@ class NgxMatMonthView {
|
|
|
1015
1071
|
}
|
|
1016
1072
|
/** Initializes this month view. */
|
|
1017
1073
|
_init() {
|
|
1074
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
1075
|
+
return;
|
|
1018
1076
|
this._setRanges(this.selected);
|
|
1019
1077
|
this._todayDate = this._getCellCompareValue(this._dateAdapter.today());
|
|
1020
1078
|
this._monthLabel = this._dateFormats.display.monthLabel
|
|
1021
1079
|
? this._dateAdapter.format(this.activeDate, this._dateFormats.display.monthLabel)
|
|
1022
|
-
: this._dateAdapter
|
|
1023
|
-
.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)].toLocaleUpperCase();
|
|
1080
|
+
: this._dateAdapter.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)].toLocaleUpperCase();
|
|
1024
1081
|
const firstOfMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), 1);
|
|
1025
1082
|
this._firstWeekOffset =
|
|
1026
1083
|
(DAYS_PER_WEEK +
|
|
@@ -1086,10 +1143,14 @@ class NgxMatMonthView {
|
|
|
1086
1143
|
* active date. The returned date will have the same day of the month as the argument date.
|
|
1087
1144
|
*/
|
|
1088
1145
|
_getDateFromDayOfMonth(dayOfMonth) {
|
|
1146
|
+
if (!this._dateAdapter)
|
|
1147
|
+
return null;
|
|
1089
1148
|
return this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate), dayOfMonth);
|
|
1090
1149
|
}
|
|
1091
1150
|
/** Initializes the weekdays. */
|
|
1092
1151
|
_initWeekdays() {
|
|
1152
|
+
if (!this._dateAdapter)
|
|
1153
|
+
return;
|
|
1093
1154
|
const firstDayOfWeek = this._dateAdapter.getFirstDayOfWeek();
|
|
1094
1155
|
const narrowWeekdays = this._dateAdapter.getDayOfWeekNames('narrow');
|
|
1095
1156
|
const longWeekdays = this._dateAdapter.getDayOfWeekNames('long');
|
|
@@ -1101,6 +1162,8 @@ class NgxMatMonthView {
|
|
|
1101
1162
|
}
|
|
1102
1163
|
/** Creates MatCalendarCells for the dates in this month. */
|
|
1103
1164
|
_createWeekCells() {
|
|
1165
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
1166
|
+
return;
|
|
1104
1167
|
const daysInMonth = this._dateAdapter.getNumDaysInMonth(this.activeDate);
|
|
1105
1168
|
const dateNames = this._dateAdapter.getDateNames();
|
|
1106
1169
|
this._weeks = [[]];
|
|
@@ -1118,6 +1181,8 @@ class NgxMatMonthView {
|
|
|
1118
1181
|
}
|
|
1119
1182
|
/** Date filter for the month */
|
|
1120
1183
|
_shouldEnableDate(date) {
|
|
1184
|
+
if (!this._dateAdapter)
|
|
1185
|
+
return false;
|
|
1121
1186
|
return (!!date &&
|
|
1122
1187
|
(!this.minDate || this._dateAdapter.compareDate(date, this.minDate) >= 0) &&
|
|
1123
1188
|
(!this.maxDate || this._dateAdapter.compareDate(date, this.maxDate) <= 0) &&
|
|
@@ -1128,12 +1193,14 @@ class NgxMatMonthView {
|
|
|
1128
1193
|
* Returns null if the given Date is in another month.
|
|
1129
1194
|
*/
|
|
1130
1195
|
_getDateInCurrentMonth(date) {
|
|
1131
|
-
return date && this._hasSameMonthAndYear(date, this.activeDate)
|
|
1196
|
+
return this._dateAdapter && date && this._hasSameMonthAndYear(date, this.activeDate)
|
|
1132
1197
|
? this._dateAdapter.getDate(date)
|
|
1133
1198
|
: null;
|
|
1134
1199
|
}
|
|
1135
1200
|
/** Checks whether the 2 dates are non-null and fall within the same month of the same year. */
|
|
1136
1201
|
_hasSameMonthAndYear(d1, d2) {
|
|
1202
|
+
if (!this._dateAdapter)
|
|
1203
|
+
return false;
|
|
1137
1204
|
return !!(d1 &&
|
|
1138
1205
|
d2 &&
|
|
1139
1206
|
this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&
|
|
@@ -1141,7 +1208,7 @@ class NgxMatMonthView {
|
|
|
1141
1208
|
}
|
|
1142
1209
|
/** Gets the value that will be used to one cell to another. */
|
|
1143
1210
|
_getCellCompareValue(date) {
|
|
1144
|
-
if (date) {
|
|
1211
|
+
if (this._dateAdapter && date) {
|
|
1145
1212
|
// We use the time since the Unix epoch to compare dates in this view, rather than the
|
|
1146
1213
|
// cell values, because we need to support ranges that span across multiple months/years.
|
|
1147
1214
|
const year = this._dateAdapter.getYear(date);
|
|
@@ -1177,27 +1244,13 @@ class NgxMatMonthView {
|
|
|
1177
1244
|
_clearPreview() {
|
|
1178
1245
|
this._previewStart = this._previewEnd = null;
|
|
1179
1246
|
}
|
|
1180
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMonthView, deps: [
|
|
1181
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatMonthView, isStandalone: true, selector: "ngx-mat-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: false, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null }, comparisonStart: { classPropertyName: "comparisonStart", publicName: "comparisonStart", isSignal: true, isRequired: false, transformFunction: null }, comparisonEnd: { classPropertyName: "comparisonEnd", publicName: "comparisonEnd", isSignal: true, isRequired: false, transformFunction: null }, startDateAccessibleName: { classPropertyName: "startDateAccessibleName", publicName: "startDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, endDateAccessibleName: { classPropertyName: "endDateAccessibleName", publicName: "endDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, activeDrag: { classPropertyName: "activeDrag", publicName: "activeDrag", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection", dragStarted: "dragStarted", dragEnded: "dragEnded", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_matCalendarBody", first: true, predicate: NgxMatCalendarBody, descendants: true, isSignal: true }], exportAs: ["ngxMatMonthView"], usesOnChanges: true, ngImport: i0, template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track $index) {\n <th scope=\"col\">\n <span class=\"cdk-visually-hidden\">{{ day.long }}</span>\n <span aria-hidden=\"true\">{{ day.narrow }}</span>\n </th>\n }\n </tr>\n <tr>\n <th\n aria-hidden=\"true\"\n class=\"mat-calendar-table-header-divider\"\n colspan=\"7\"\n ></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (dragStarted)=\"dragStarted.emit($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n", dependencies: [{ kind: "component", type: NgxMatCalendarBody, selector: "[ngx-mat-calendar-body]", inputs: ["label", "rows", "todayValue", "startValue", "endValue", "labelMinRequiredCells", "numCols", "activeCell", "isRange", "cellAspectRatio", "comparisonStart", "comparisonEnd", "previewStart", "previewEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedValueChange", "previewChange", "activeDateChange", "dragStarted", "dragEnded"], exportAs: ["matCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1247
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMonthView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1248
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatMonthView, isStandalone: true, selector: "ngx-mat-month-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: false, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null }, comparisonStart: { classPropertyName: "comparisonStart", publicName: "comparisonStart", isSignal: true, isRequired: false, transformFunction: null }, comparisonEnd: { classPropertyName: "comparisonEnd", publicName: "comparisonEnd", isSignal: true, isRequired: false, transformFunction: null }, startDateAccessibleName: { classPropertyName: "startDateAccessibleName", publicName: "startDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, endDateAccessibleName: { classPropertyName: "endDateAccessibleName", publicName: "endDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, activeDrag: { classPropertyName: "activeDrag", publicName: "activeDrag", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", _userSelection: "_userSelection", dragStarted: "dragStarted", dragEnded: "dragEnded", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_matCalendarBody", first: true, predicate: NgxMatCalendarBody, descendants: true, isSignal: true }], exportAs: ["ngxMatMonthView"], usesOnChanges: true, ngImport: i0, template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track $index) {\n <th scope=\"col\">\n <span class=\"cdk-visually-hidden\">{{ day.long }}</span>\n <span aria-hidden=\"true\">{{ day.narrow }}</span>\n </th>\n }\n </tr>\n <tr>\n <th\n aria-hidden=\"true\"\n class=\"mat-calendar-table-header-divider\"\n colspan=\"7\"\n ></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter ? _dateAdapter.getDate(activeDate) - 1 : 0\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (dragStarted)=\"dragStarted.emit($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n", dependencies: [{ kind: "component", type: NgxMatCalendarBody, selector: "[ngx-mat-calendar-body]", inputs: ["label", "rows", "todayValue", "startValue", "endValue", "labelMinRequiredCells", "numCols", "activeCell", "isRange", "cellAspectRatio", "comparisonStart", "comparisonEnd", "previewStart", "previewEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedValueChange", "previewChange", "activeDateChange", "dragStarted", "dragEnded"], exportAs: ["matCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1182
1249
|
}
|
|
1183
1250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMonthView, decorators: [{
|
|
1184
1251
|
type: Component,
|
|
1185
|
-
args: [{ selector: 'ngx-mat-month-view', exportAs: 'ngxMatMonthView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgxMatCalendarBody], template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track $index) {\n <th scope=\"col\">\n <span class=\"cdk-visually-hidden\">{{ day.long }}</span>\n <span aria-hidden=\"true\">{{ day.narrow }}</span>\n </th>\n }\n </tr>\n <tr>\n <th\n aria-hidden=\"true\"\n class=\"mat-calendar-table-header-divider\"\n colspan=\"7\"\n ></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (dragStarted)=\"dragStarted.emit($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n" }]
|
|
1186
|
-
}], ctorParameters: () => [
|
|
1187
|
-
type: Optional
|
|
1188
|
-
}, {
|
|
1189
|
-
type: Inject,
|
|
1190
|
-
args: [MAT_DATE_FORMATS]
|
|
1191
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
1192
|
-
type: Optional
|
|
1193
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1194
|
-
type: Optional
|
|
1195
|
-
}] }, { type: undefined, decorators: [{
|
|
1196
|
-
type: Inject,
|
|
1197
|
-
args: [NGX_MAT_DATE_RANGE_SELECTION_STRATEGY]
|
|
1198
|
-
}, {
|
|
1199
|
-
type: Optional
|
|
1200
|
-
}] }], propDecorators: { activeDate: [{
|
|
1252
|
+
args: [{ selector: 'ngx-mat-month-view', exportAs: 'ngxMatMonthView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgxMatCalendarBody], template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead class=\"mat-calendar-table-header\">\n <tr>\n @for (day of _weekdays; track $index) {\n <th scope=\"col\">\n <span class=\"cdk-visually-hidden\">{{ day.long }}</span>\n <span aria-hidden=\"true\">{{ day.narrow }}</span>\n </th>\n }\n </tr>\n <tr>\n <th\n aria-hidden=\"true\"\n class=\"mat-calendar-table-header-divider\"\n colspan=\"7\"\n ></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_monthLabel\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [startValue]=\"_rangeStart!\"\n [endValue]=\"_rangeEnd!\"\n [comparisonStart]=\"_comparisonRangeStart\"\n [comparisonEnd]=\"_comparisonRangeEnd\"\n [previewStart]=\"_previewStart\"\n [previewEnd]=\"_previewEnd\"\n [isRange]=\"_isRange\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"_dateAdapter ? _dateAdapter.getDate(activeDate) - 1 : 0\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (selectedValueChange)=\"_dateSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (previewChange)=\"_previewChanged($event)\"\n (dragStarted)=\"dragStarted.emit($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n" }]
|
|
1253
|
+
}], ctorParameters: () => [], propDecorators: { activeDate: [{
|
|
1201
1254
|
type: Input
|
|
1202
1255
|
}], selected: [{
|
|
1203
1256
|
type: Input
|
|
@@ -1214,9 +1267,6 @@ const yearsPerRow = 4;
|
|
|
1214
1267
|
* @docs-private
|
|
1215
1268
|
*/
|
|
1216
1269
|
class NgxMatMultiYearView {
|
|
1217
|
-
_changeDetectorRef;
|
|
1218
|
-
_dateAdapter;
|
|
1219
|
-
_dir;
|
|
1220
1270
|
_rerenderSubscription = Subscription.EMPTY;
|
|
1221
1271
|
/** Flag used to filter out space/enter keyup events that originated outside of the view. */
|
|
1222
1272
|
_selectionKeyPressed = false;
|
|
@@ -1225,6 +1275,8 @@ class NgxMatMultiYearView {
|
|
|
1225
1275
|
return this._activeDate;
|
|
1226
1276
|
}
|
|
1227
1277
|
set activeDate(value) {
|
|
1278
|
+
if (!this._dateAdapter)
|
|
1279
|
+
return;
|
|
1228
1280
|
const oldActiveDate = this._activeDate;
|
|
1229
1281
|
const validDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)) ||
|
|
1230
1282
|
this._dateAdapter.today();
|
|
@@ -1239,7 +1291,7 @@ class NgxMatMultiYearView {
|
|
|
1239
1291
|
return this._selected;
|
|
1240
1292
|
}
|
|
1241
1293
|
set selected(value) {
|
|
1242
|
-
if (value instanceof NgxDateRange) {
|
|
1294
|
+
if (!this._dateAdapter || value instanceof NgxDateRange) {
|
|
1243
1295
|
this._selected = value;
|
|
1244
1296
|
}
|
|
1245
1297
|
else {
|
|
@@ -1253,6 +1305,10 @@ class NgxMatMultiYearView {
|
|
|
1253
1305
|
return this._minDate;
|
|
1254
1306
|
}
|
|
1255
1307
|
set minDate(value) {
|
|
1308
|
+
if (!this._dateAdapter) {
|
|
1309
|
+
this._minDate = null;
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1256
1312
|
this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
1257
1313
|
}
|
|
1258
1314
|
_minDate = null;
|
|
@@ -1261,6 +1317,10 @@ class NgxMatMultiYearView {
|
|
|
1261
1317
|
return this._maxDate;
|
|
1262
1318
|
}
|
|
1263
1319
|
set maxDate(value) {
|
|
1320
|
+
if (!this._dateAdapter) {
|
|
1321
|
+
this._maxDate = null;
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1264
1324
|
this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
1265
1325
|
}
|
|
1266
1326
|
_maxDate = null;
|
|
@@ -1282,16 +1342,18 @@ class NgxMatMultiYearView {
|
|
|
1282
1342
|
_todayYear = 0;
|
|
1283
1343
|
/** The year of the selected date. Null if the selected date is null. */
|
|
1284
1344
|
_selectedYear = null;
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1345
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
1346
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
1347
|
+
_dir = inject(Directionality, { optional: true });
|
|
1348
|
+
constructor() {
|
|
1289
1349
|
if (!this._dateAdapter) {
|
|
1290
1350
|
throw createMissingDateImplError$1('DateAdapter');
|
|
1291
1351
|
}
|
|
1292
1352
|
this._activeDate = this._dateAdapter.today();
|
|
1293
1353
|
}
|
|
1294
1354
|
ngAfterContentInit() {
|
|
1355
|
+
if (!this._dateAdapter)
|
|
1356
|
+
return;
|
|
1295
1357
|
this._rerenderSubscription = this._dateAdapter.localeChanges
|
|
1296
1358
|
.pipe(startWith(null))
|
|
1297
1359
|
.subscribe(() => this._init());
|
|
@@ -1301,6 +1363,8 @@ class NgxMatMultiYearView {
|
|
|
1301
1363
|
}
|
|
1302
1364
|
/** Initializes this multi-year view. */
|
|
1303
1365
|
_init() {
|
|
1366
|
+
if (!this._dateAdapter)
|
|
1367
|
+
return;
|
|
1304
1368
|
this._todayYear = this._dateAdapter.getYear(this._dateAdapter.today());
|
|
1305
1369
|
// We want a range years such that we maximize the number of
|
|
1306
1370
|
// enabled dates visible at once. This prevents issues where the minimum year
|
|
@@ -1313,7 +1377,9 @@ class NgxMatMultiYearView {
|
|
|
1313
1377
|
for (let i = 0, row = []; i < yearsPerPage; i++) {
|
|
1314
1378
|
row.push(minYearOfPage + i);
|
|
1315
1379
|
if (row.length == yearsPerRow) {
|
|
1316
|
-
this._years.push(row
|
|
1380
|
+
this._years.push(row
|
|
1381
|
+
.map(y => this._createCellForYear(y))
|
|
1382
|
+
.filter(y => y != null));
|
|
1317
1383
|
row = [];
|
|
1318
1384
|
}
|
|
1319
1385
|
}
|
|
@@ -1321,6 +1387,8 @@ class NgxMatMultiYearView {
|
|
|
1321
1387
|
}
|
|
1322
1388
|
/** Handles when a new year is selected. */
|
|
1323
1389
|
_yearSelected(event) {
|
|
1390
|
+
if (!this._dateAdapter)
|
|
1391
|
+
return;
|
|
1324
1392
|
const year = event.value;
|
|
1325
1393
|
const selectedYear = this._dateAdapter.createDate(year, 0, 1);
|
|
1326
1394
|
const selectedDate = this._getDateFromYear(year);
|
|
@@ -1340,8 +1408,9 @@ class NgxMatMultiYearView {
|
|
|
1340
1408
|
_updateActiveDate(event) {
|
|
1341
1409
|
const year = event.value;
|
|
1342
1410
|
const oldActiveDate = this._activeDate;
|
|
1343
|
-
|
|
1344
|
-
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1411
|
+
const dateToUse = this._getDateFromYear(year);
|
|
1412
|
+
if (this._dateAdapter && dateToUse && this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1413
|
+
this.activeDate = dateToUse;
|
|
1345
1414
|
this.activeDateChange.emit(this.activeDate);
|
|
1346
1415
|
}
|
|
1347
1416
|
}
|
|
@@ -1351,30 +1420,30 @@ class NgxMatMultiYearView {
|
|
|
1351
1420
|
const isRtl = this._isRtl();
|
|
1352
1421
|
switch (event.keyCode) {
|
|
1353
1422
|
case LEFT_ARROW:
|
|
1354
|
-
this.activeDate = this._dateAdapter
|
|
1423
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
|
|
1355
1424
|
break;
|
|
1356
1425
|
case RIGHT_ARROW:
|
|
1357
|
-
this.activeDate = this._dateAdapter
|
|
1426
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
|
|
1358
1427
|
break;
|
|
1359
1428
|
case UP_ARROW:
|
|
1360
|
-
this.activeDate = this._dateAdapter
|
|
1429
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, -yearsPerRow);
|
|
1361
1430
|
break;
|
|
1362
1431
|
case DOWN_ARROW:
|
|
1363
|
-
this.activeDate = this._dateAdapter
|
|
1432
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, yearsPerRow);
|
|
1364
1433
|
break;
|
|
1365
1434
|
case HOME:
|
|
1366
|
-
this.activeDate = this._dateAdapter
|
|
1435
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, -getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate));
|
|
1367
1436
|
break;
|
|
1368
1437
|
case END:
|
|
1369
|
-
this.activeDate = this._dateAdapter
|
|
1438
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, yearsPerPage -
|
|
1370
1439
|
getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate) -
|
|
1371
1440
|
1);
|
|
1372
1441
|
break;
|
|
1373
1442
|
case PAGE_UP:
|
|
1374
|
-
this.activeDate = this._dateAdapter
|
|
1443
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
|
|
1375
1444
|
break;
|
|
1376
1445
|
case PAGE_DOWN:
|
|
1377
|
-
this.activeDate = this._dateAdapter
|
|
1446
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
|
|
1378
1447
|
break;
|
|
1379
1448
|
case ENTER:
|
|
1380
1449
|
case SPACE:
|
|
@@ -1388,7 +1457,7 @@ class NgxMatMultiYearView {
|
|
|
1388
1457
|
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1389
1458
|
return;
|
|
1390
1459
|
}
|
|
1391
|
-
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1460
|
+
if (this._dateAdapter && this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1392
1461
|
this.activeDateChange.emit(this.activeDate);
|
|
1393
1462
|
}
|
|
1394
1463
|
this._focusActiveCellAfterViewChecked();
|
|
@@ -1398,7 +1467,7 @@ class NgxMatMultiYearView {
|
|
|
1398
1467
|
/** Handles keyup events on the calendar body when calendar is in multi-year view. */
|
|
1399
1468
|
_handleCalendarBodyKeyup(event) {
|
|
1400
1469
|
if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
|
1401
|
-
if (this._selectionKeyPressed) {
|
|
1470
|
+
if (this._dateAdapter && this._selectionKeyPressed) {
|
|
1402
1471
|
this._yearSelected({
|
|
1403
1472
|
value: this._dateAdapter.getYear(this._activeDate),
|
|
1404
1473
|
event,
|
|
@@ -1423,6 +1492,8 @@ class NgxMatMultiYearView {
|
|
|
1423
1492
|
* The returned date will have the same year as the argument date.
|
|
1424
1493
|
*/
|
|
1425
1494
|
_getDateFromYear(year) {
|
|
1495
|
+
if (!this._dateAdapter)
|
|
1496
|
+
return null;
|
|
1426
1497
|
const activeMonth = this._dateAdapter.getMonth(this.activeDate);
|
|
1427
1498
|
const daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, activeMonth, 1));
|
|
1428
1499
|
const normalizedDate = this._dateAdapter.createDate(year, activeMonth, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth));
|
|
@@ -1430,6 +1501,8 @@ class NgxMatMultiYearView {
|
|
|
1430
1501
|
}
|
|
1431
1502
|
/** Creates an MatCalendarCell for the given year. */
|
|
1432
1503
|
_createCellForYear(year) {
|
|
1504
|
+
if (!this._dateAdapter)
|
|
1505
|
+
return null;
|
|
1433
1506
|
const date = this._dateAdapter.createDate(year, 0, 1);
|
|
1434
1507
|
const yearName = this._dateAdapter.getYearName(date);
|
|
1435
1508
|
const cellClasses = this.dateClass() ? this.dateClass()(date, 'multi-year') : undefined;
|
|
@@ -1437,6 +1510,8 @@ class NgxMatMultiYearView {
|
|
|
1437
1510
|
}
|
|
1438
1511
|
/** Whether the given year is enabled. */
|
|
1439
1512
|
_shouldEnableYear(year) {
|
|
1513
|
+
if (!this._dateAdapter)
|
|
1514
|
+
return false;
|
|
1440
1515
|
// disable if the year is greater than maxDate lower than minDate
|
|
1441
1516
|
if (year === undefined ||
|
|
1442
1517
|
year === null ||
|
|
@@ -1463,6 +1538,8 @@ class NgxMatMultiYearView {
|
|
|
1463
1538
|
}
|
|
1464
1539
|
/** Sets the currently-highlighted year based on a model value. */
|
|
1465
1540
|
_setSelectedYear(value) {
|
|
1541
|
+
if (!this._dateAdapter)
|
|
1542
|
+
return;
|
|
1466
1543
|
this._selectedYear = null;
|
|
1467
1544
|
if (value instanceof NgxDateRange) {
|
|
1468
1545
|
const displayValue = value.start || value.end;
|
|
@@ -1474,17 +1551,13 @@ class NgxMatMultiYearView {
|
|
|
1474
1551
|
this._selectedYear = this._dateAdapter.getYear(value);
|
|
1475
1552
|
}
|
|
1476
1553
|
}
|
|
1477
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMultiYearView, deps: [
|
|
1554
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMultiYearView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1478
1555
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.6", type: NgxMatMultiYearView, isStandalone: true, selector: "ngx-mat-multi-year-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: false, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_matCalendarBody", first: true, predicate: NgxMatCalendarBody, descendants: true, isSignal: true }], exportAs: ["ngxMatMultiYearView"], ngImport: i0, template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [startValue]=\"_selectedYear!\"\n [endValue]=\"_selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n", dependencies: [{ kind: "component", type: NgxMatCalendarBody, selector: "[ngx-mat-calendar-body]", inputs: ["label", "rows", "todayValue", "startValue", "endValue", "labelMinRequiredCells", "numCols", "activeCell", "isRange", "cellAspectRatio", "comparisonStart", "comparisonEnd", "previewStart", "previewEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedValueChange", "previewChange", "activeDateChange", "dragStarted", "dragEnded"], exportAs: ["matCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1479
1556
|
}
|
|
1480
1557
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatMultiYearView, decorators: [{
|
|
1481
1558
|
type: Component,
|
|
1482
1559
|
args: [{ selector: 'ngx-mat-multi-year-view', exportAs: 'ngxMatMultiYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgxMatCalendarBody], template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [startValue]=\"_selectedYear!\"\n [endValue]=\"_selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"\n ></tbody>\n</table>\n" }]
|
|
1483
|
-
}], ctorParameters: () => [
|
|
1484
|
-
type: Optional
|
|
1485
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1486
|
-
type: Optional
|
|
1487
|
-
}] }], propDecorators: { activeDate: [{
|
|
1560
|
+
}], ctorParameters: () => [], propDecorators: { activeDate: [{
|
|
1488
1561
|
type: Input
|
|
1489
1562
|
}], selected: [{
|
|
1490
1563
|
type: Input
|
|
@@ -1506,6 +1579,8 @@ function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
|
|
|
1506
1579
|
* "startingYear" will render when paged into view.
|
|
1507
1580
|
*/
|
|
1508
1581
|
function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
|
|
1582
|
+
if (!dateAdapter)
|
|
1583
|
+
return 0;
|
|
1509
1584
|
const activeYear = dateAdapter.getYear(activeDate);
|
|
1510
1585
|
return euclideanModulo(activeYear - getStartingYear(dateAdapter, minDate, maxDate), yearsPerPage);
|
|
1511
1586
|
}
|
|
@@ -1534,10 +1609,6 @@ function euclideanModulo(a, b) {
|
|
|
1534
1609
|
* @docs-private
|
|
1535
1610
|
*/
|
|
1536
1611
|
class NgxMatYearView {
|
|
1537
|
-
_changeDetectorRef;
|
|
1538
|
-
_dateFormats;
|
|
1539
|
-
_dateAdapter;
|
|
1540
|
-
_dir;
|
|
1541
1612
|
_rerenderSubscription = Subscription.EMPTY;
|
|
1542
1613
|
/** Flag used to filter out space/enter keyup events that originated outside of the view. */
|
|
1543
1614
|
_selectionKeyPressed = false;
|
|
@@ -1546,6 +1617,8 @@ class NgxMatYearView {
|
|
|
1546
1617
|
return this._activeDate;
|
|
1547
1618
|
}
|
|
1548
1619
|
set activeDate(value) {
|
|
1620
|
+
if (!this._dateAdapter)
|
|
1621
|
+
return;
|
|
1549
1622
|
const oldActiveDate = this._activeDate;
|
|
1550
1623
|
const validDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)) ||
|
|
1551
1624
|
this._dateAdapter.today();
|
|
@@ -1560,7 +1633,7 @@ class NgxMatYearView {
|
|
|
1560
1633
|
return this._selected;
|
|
1561
1634
|
}
|
|
1562
1635
|
set selected(value) {
|
|
1563
|
-
if (value instanceof NgxDateRange) {
|
|
1636
|
+
if (!this._dateAdapter || value instanceof NgxDateRange) {
|
|
1564
1637
|
this._selected = value;
|
|
1565
1638
|
}
|
|
1566
1639
|
else {
|
|
@@ -1574,6 +1647,10 @@ class NgxMatYearView {
|
|
|
1574
1647
|
return this._minDate;
|
|
1575
1648
|
}
|
|
1576
1649
|
set minDate(value) {
|
|
1650
|
+
if (!this._dateAdapter) {
|
|
1651
|
+
this._minDate = null;
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1577
1654
|
this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
1578
1655
|
}
|
|
1579
1656
|
_minDate = null;
|
|
@@ -1582,6 +1659,10 @@ class NgxMatYearView {
|
|
|
1582
1659
|
return this._maxDate;
|
|
1583
1660
|
}
|
|
1584
1661
|
set maxDate(value) {
|
|
1662
|
+
if (!this._dateAdapter) {
|
|
1663
|
+
this._maxDate = null;
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1585
1666
|
this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
1586
1667
|
}
|
|
1587
1668
|
_maxDate = null;
|
|
@@ -1608,11 +1689,11 @@ class NgxMatYearView {
|
|
|
1608
1689
|
* Null if the selected Date is in a different year.
|
|
1609
1690
|
*/
|
|
1610
1691
|
_selectedMonth = null;
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1692
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
1693
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
1694
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
1695
|
+
_dir = inject(Directionality, { optional: true });
|
|
1696
|
+
constructor() {
|
|
1616
1697
|
if (!this._dateAdapter) {
|
|
1617
1698
|
throw createMissingDateImplError$1('DateAdapter');
|
|
1618
1699
|
}
|
|
@@ -1622,6 +1703,8 @@ class NgxMatYearView {
|
|
|
1622
1703
|
this._activeDate = this._dateAdapter.today();
|
|
1623
1704
|
}
|
|
1624
1705
|
ngAfterContentInit() {
|
|
1706
|
+
if (!this._dateAdapter)
|
|
1707
|
+
return;
|
|
1625
1708
|
this._rerenderSubscription = this._dateAdapter.localeChanges
|
|
1626
1709
|
.pipe(startWith(null))
|
|
1627
1710
|
.subscribe(() => this._init());
|
|
@@ -1631,6 +1714,8 @@ class NgxMatYearView {
|
|
|
1631
1714
|
}
|
|
1632
1715
|
/** Handles when a new month is selected. */
|
|
1633
1716
|
_monthSelected(event) {
|
|
1717
|
+
if (!this._dateAdapter)
|
|
1718
|
+
return;
|
|
1634
1719
|
const month = event.value;
|
|
1635
1720
|
const selectedMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
|
|
1636
1721
|
this.monthSelected.emit(selectedMonth);
|
|
@@ -1650,8 +1735,9 @@ class NgxMatYearView {
|
|
|
1650
1735
|
_updateActiveDate(event) {
|
|
1651
1736
|
const month = event.value;
|
|
1652
1737
|
const oldActiveDate = this._activeDate;
|
|
1653
|
-
|
|
1654
|
-
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1738
|
+
const dateToUse = this._getDateFromMonth(month);
|
|
1739
|
+
if (this._dateAdapter && dateToUse && this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1740
|
+
this.activeDate = dateToUse;
|
|
1655
1741
|
this.activeDateChange.emit(this.activeDate);
|
|
1656
1742
|
}
|
|
1657
1743
|
}
|
|
@@ -1664,28 +1750,28 @@ class NgxMatYearView {
|
|
|
1664
1750
|
const isRtl = this._isRtl();
|
|
1665
1751
|
switch (event.keyCode) {
|
|
1666
1752
|
case LEFT_ARROW:
|
|
1667
|
-
this.activeDate = this._dateAdapter
|
|
1753
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
|
|
1668
1754
|
break;
|
|
1669
1755
|
case RIGHT_ARROW:
|
|
1670
|
-
this.activeDate = this._dateAdapter
|
|
1756
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
|
|
1671
1757
|
break;
|
|
1672
1758
|
case UP_ARROW:
|
|
1673
|
-
this.activeDate = this._dateAdapter
|
|
1759
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, -4);
|
|
1674
1760
|
break;
|
|
1675
1761
|
case DOWN_ARROW:
|
|
1676
|
-
this.activeDate = this._dateAdapter
|
|
1762
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, 4);
|
|
1677
1763
|
break;
|
|
1678
1764
|
case HOME:
|
|
1679
|
-
this.activeDate = this._dateAdapter
|
|
1765
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, -this._dateAdapter.getMonth(this._activeDate));
|
|
1680
1766
|
break;
|
|
1681
1767
|
case END:
|
|
1682
|
-
this.activeDate = this._dateAdapter
|
|
1768
|
+
this.activeDate = this._dateAdapter?.addCalendarMonths(this._activeDate, 11 - this._dateAdapter.getMonth(this._activeDate));
|
|
1683
1769
|
break;
|
|
1684
1770
|
case PAGE_UP:
|
|
1685
|
-
this.activeDate = this._dateAdapter
|
|
1771
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
|
1686
1772
|
break;
|
|
1687
1773
|
case PAGE_DOWN:
|
|
1688
|
-
this.activeDate = this._dateAdapter
|
|
1774
|
+
this.activeDate = this._dateAdapter?.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
|
1689
1775
|
break;
|
|
1690
1776
|
case ENTER:
|
|
1691
1777
|
case SPACE:
|
|
@@ -1699,7 +1785,7 @@ class NgxMatYearView {
|
|
|
1699
1785
|
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
|
1700
1786
|
return;
|
|
1701
1787
|
}
|
|
1702
|
-
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1788
|
+
if (this._dateAdapter && this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
|
1703
1789
|
this.activeDateChange.emit(this.activeDate);
|
|
1704
1790
|
this._focusActiveCellAfterViewChecked();
|
|
1705
1791
|
}
|
|
@@ -1709,7 +1795,7 @@ class NgxMatYearView {
|
|
|
1709
1795
|
/** Handles keyup events on the calendar body when calendar is in year view. */
|
|
1710
1796
|
_handleCalendarBodyKeyup(event) {
|
|
1711
1797
|
if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
|
1712
|
-
if (this._selectionKeyPressed) {
|
|
1798
|
+
if (this._dateAdapter && this._selectionKeyPressed) {
|
|
1713
1799
|
this._monthSelected({
|
|
1714
1800
|
value: this._dateAdapter.getMonth(this._activeDate),
|
|
1715
1801
|
event,
|
|
@@ -1720,6 +1806,8 @@ class NgxMatYearView {
|
|
|
1720
1806
|
}
|
|
1721
1807
|
/** Initializes this year view. */
|
|
1722
1808
|
_init() {
|
|
1809
|
+
if (!this._dateAdapter)
|
|
1810
|
+
return;
|
|
1723
1811
|
this._setSelectedMonth(this.selected);
|
|
1724
1812
|
this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());
|
|
1725
1813
|
this._yearLabel = this._dateAdapter.getYearName(this.activeDate);
|
|
@@ -1729,7 +1817,9 @@ class NgxMatYearView {
|
|
|
1729
1817
|
[0, 1, 2, 3],
|
|
1730
1818
|
[4, 5, 6, 7],
|
|
1731
1819
|
[8, 9, 10, 11],
|
|
1732
|
-
].map(
|
|
1820
|
+
].map(row => row
|
|
1821
|
+
.map(m => this._createCellForMonth(m, monthNames[m]))
|
|
1822
|
+
.filter(m => m != null));
|
|
1733
1823
|
this._changeDetectorRef.markForCheck();
|
|
1734
1824
|
}
|
|
1735
1825
|
/** Focuses the active cell after the microtask queue is empty. */
|
|
@@ -1745,7 +1835,7 @@ class NgxMatYearView {
|
|
|
1745
1835
|
* Returns null if the given Date is in another year.
|
|
1746
1836
|
*/
|
|
1747
1837
|
_getMonthInCurrentYear(date) {
|
|
1748
|
-
return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate)
|
|
1838
|
+
return this._dateAdapter && date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate)
|
|
1749
1839
|
? this._dateAdapter.getMonth(date)
|
|
1750
1840
|
: null;
|
|
1751
1841
|
}
|
|
@@ -1754,12 +1844,16 @@ class NgxMatYearView {
|
|
|
1754
1844
|
* The returned date will have the same month as the argument date.
|
|
1755
1845
|
*/
|
|
1756
1846
|
_getDateFromMonth(month) {
|
|
1847
|
+
if (!this._dateAdapter)
|
|
1848
|
+
return null;
|
|
1757
1849
|
const normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
|
|
1758
1850
|
const daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);
|
|
1759
1851
|
return this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth));
|
|
1760
1852
|
}
|
|
1761
1853
|
/** Creates an MatCalendarCell for the given month. */
|
|
1762
1854
|
_createCellForMonth(month, monthName) {
|
|
1855
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
1856
|
+
return null;
|
|
1763
1857
|
const date = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
|
|
1764
1858
|
const ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.monthYearA11yLabel);
|
|
1765
1859
|
const cellClasses = this.dateClass() ? this.dateClass()(date, 'year') : undefined;
|
|
@@ -1767,6 +1861,8 @@ class NgxMatYearView {
|
|
|
1767
1861
|
}
|
|
1768
1862
|
/** Whether the given month is enabled. */
|
|
1769
1863
|
_shouldEnableMonth(month) {
|
|
1864
|
+
if (!this._dateAdapter)
|
|
1865
|
+
return false;
|
|
1770
1866
|
const activeYear = this._dateAdapter.getYear(this.activeDate);
|
|
1771
1867
|
if (month === undefined ||
|
|
1772
1868
|
month === null ||
|
|
@@ -1791,7 +1887,7 @@ class NgxMatYearView {
|
|
|
1791
1887
|
* just the month and year of this.maxDate
|
|
1792
1888
|
*/
|
|
1793
1889
|
_isYearAndMonthAfterMaxDate(year, month) {
|
|
1794
|
-
if (this.maxDate) {
|
|
1890
|
+
if (this._dateAdapter && this.maxDate) {
|
|
1795
1891
|
const maxYear = this._dateAdapter.getYear(this.maxDate);
|
|
1796
1892
|
const maxMonth = this._dateAdapter.getMonth(this.maxDate);
|
|
1797
1893
|
return year > maxYear || (year === maxYear && month > maxMonth);
|
|
@@ -1803,7 +1899,7 @@ class NgxMatYearView {
|
|
|
1803
1899
|
* just the month and year of this.minDate
|
|
1804
1900
|
*/
|
|
1805
1901
|
_isYearAndMonthBeforeMinDate(year, month) {
|
|
1806
|
-
if (this.minDate) {
|
|
1902
|
+
if (this._dateAdapter && this.minDate) {
|
|
1807
1903
|
const minYear = this._dateAdapter.getYear(this.minDate);
|
|
1808
1904
|
const minMonth = this._dateAdapter.getMonth(this.minDate);
|
|
1809
1905
|
return year < minYear || (year === minYear && month < minMonth);
|
|
@@ -1824,22 +1920,13 @@ class NgxMatYearView {
|
|
|
1824
1920
|
this._selectedMonth = this._getMonthInCurrentYear(value);
|
|
1825
1921
|
}
|
|
1826
1922
|
}
|
|
1827
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatYearView, deps: [
|
|
1828
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.6", type: NgxMatYearView, isStandalone: true, selector: "ngx-mat-year-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: false, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", monthSelected: "monthSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_matCalendarBody", first: true, predicate: NgxMatCalendarBody, descendants: true, isSignal: true }], exportAs: ["ngxMatYearView"], ngImport: i0, template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n", dependencies: [{ kind: "component", type: NgxMatCalendarBody, selector: "[ngx-mat-calendar-body]", inputs: ["label", "rows", "todayValue", "startValue", "endValue", "labelMinRequiredCells", "numCols", "activeCell", "isRange", "cellAspectRatio", "comparisonStart", "comparisonEnd", "previewStart", "previewEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedValueChange", "previewChange", "activeDateChange", "dragStarted", "dragEnded"], exportAs: ["matCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1923
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatYearView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1924
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.6", type: NgxMatYearView, isStandalone: true, selector: "ngx-mat-year-view", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: false, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", monthSelected: "monthSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "_matCalendarBody", first: true, predicate: NgxMatCalendarBody, descendants: true, isSignal: true }], exportAs: ["ngxMatYearView"], ngImport: i0, template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter ? _dateAdapter.getMonth(activeDate) : 0\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n", dependencies: [{ kind: "component", type: NgxMatCalendarBody, selector: "[ngx-mat-calendar-body]", inputs: ["label", "rows", "todayValue", "startValue", "endValue", "labelMinRequiredCells", "numCols", "activeCell", "isRange", "cellAspectRatio", "comparisonStart", "comparisonEnd", "previewStart", "previewEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedValueChange", "previewChange", "activeDateChange", "dragStarted", "dragEnded"], exportAs: ["matCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1829
1925
|
}
|
|
1830
1926
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatYearView, decorators: [{
|
|
1831
1927
|
type: Component,
|
|
1832
|
-
args: [{ selector: 'ngx-mat-year-view', exportAs: 'ngxMatYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgxMatCalendarBody], template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n" }]
|
|
1833
|
-
}], ctorParameters: () => [
|
|
1834
|
-
type: Optional
|
|
1835
|
-
}, {
|
|
1836
|
-
type: Inject,
|
|
1837
|
-
args: [MAT_DATE_FORMATS]
|
|
1838
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
1839
|
-
type: Optional
|
|
1840
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
1841
|
-
type: Optional
|
|
1842
|
-
}] }], propDecorators: { activeDate: [{
|
|
1928
|
+
args: [{ selector: 'ngx-mat-year-view', exportAs: 'ngxMatYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgxMatCalendarBody], template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr>\n <th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody\n ngx-mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter ? _dateAdapter.getMonth(activeDate) : 0\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (activeDateChange)=\"_updateActiveDate($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\"></tbody>\n</table>\n" }]
|
|
1929
|
+
}], ctorParameters: () => [], propDecorators: { activeDate: [{
|
|
1843
1930
|
type: Input
|
|
1844
1931
|
}], selected: [{
|
|
1845
1932
|
type: Input
|
|
@@ -1849,79 +1936,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
1849
1936
|
type: Input
|
|
1850
1937
|
}], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], dateClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateClass", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }], monthSelected: [{ type: i0.Output, args: ["monthSelected"] }], activeDateChange: [{ type: i0.Output, args: ["activeDateChange"] }], _matCalendarBody: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgxMatCalendarBody), { isSignal: true }] }] } });
|
|
1851
1938
|
|
|
1852
|
-
/** Datepicker data that requires internationalization. */
|
|
1853
|
-
class NgxMatDatepickerIntl {
|
|
1854
|
-
/**
|
|
1855
|
-
* Stream that emits whenever the labels here are changed. Use this to notify
|
|
1856
|
-
* components if the labels have changed after initialization.
|
|
1857
|
-
*/
|
|
1858
|
-
changes = new Subject();
|
|
1859
|
-
/** A label for the calendar popup (used by screen readers). */
|
|
1860
|
-
calendarLabel = 'Calendar';
|
|
1861
|
-
/** A label for the button used to open the calendar popup (used by screen readers). */
|
|
1862
|
-
openCalendarLabel = 'Open calendar';
|
|
1863
|
-
/** Label for the button used to close the calendar popup. */
|
|
1864
|
-
closeCalendarLabel = 'Close calendar';
|
|
1865
|
-
/** A label for the previous month button (used by screen readers). */
|
|
1866
|
-
prevMonthLabel = 'Previous month';
|
|
1867
|
-
/** A label for the next month button (used by screen readers). */
|
|
1868
|
-
nextMonthLabel = 'Next month';
|
|
1869
|
-
/** A label for the previous year button (used by screen readers). */
|
|
1870
|
-
prevYearLabel = 'Previous year';
|
|
1871
|
-
/** A label for the next year button (used by screen readers). */
|
|
1872
|
-
nextYearLabel = 'Next year';
|
|
1873
|
-
/** A label for the previous multi-year button (used by screen readers). */
|
|
1874
|
-
prevMultiYearLabel = 'Previous 24 years';
|
|
1875
|
-
/** A label for the next multi-year button (used by screen readers). */
|
|
1876
|
-
nextMultiYearLabel = 'Next 24 years';
|
|
1877
|
-
/** A label for the 'switch to month view' button (used by screen readers). */
|
|
1878
|
-
switchToMonthViewLabel = 'Choose date';
|
|
1879
|
-
/** A label for the 'switch to year view' button (used by screen readers). */
|
|
1880
|
-
switchToMultiYearViewLabel = 'Choose month and year';
|
|
1881
|
-
/**
|
|
1882
|
-
* A label for the first date of a range of dates (used by screen readers).
|
|
1883
|
-
* @deprecated Provide your own internationalization string.
|
|
1884
|
-
* @breaking-change 17.0.0
|
|
1885
|
-
*/
|
|
1886
|
-
startDateLabel = 'Start date';
|
|
1887
|
-
/**
|
|
1888
|
-
* A label for the last date of a range of dates (used by screen readers).
|
|
1889
|
-
* @deprecated Provide your own internationalization string.
|
|
1890
|
-
* @breaking-change 17.0.0
|
|
1891
|
-
*/
|
|
1892
|
-
endDateLabel = 'End date';
|
|
1893
|
-
/** Formats a range of years (used for visuals). */
|
|
1894
|
-
formatYearRange(start, end) {
|
|
1895
|
-
return `${start} \u2013 ${end}`;
|
|
1896
|
-
}
|
|
1897
|
-
/** Formats a label for a range of years (used by screen readers). */
|
|
1898
|
-
formatYearRangeLabel(start, end) {
|
|
1899
|
-
return `${start} to ${end}`;
|
|
1900
|
-
}
|
|
1901
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1902
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, providedIn: 'root' });
|
|
1903
|
-
}
|
|
1904
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerIntl, decorators: [{
|
|
1905
|
-
type: Injectable,
|
|
1906
|
-
args: [{ providedIn: 'root' }]
|
|
1907
|
-
}] });
|
|
1908
|
-
|
|
1909
1939
|
let calendarHeaderId = 1;
|
|
1910
1940
|
/** Default header for MatCalendar */
|
|
1911
1941
|
class NgxMatCalendarHeader {
|
|
1912
|
-
_intl;
|
|
1913
|
-
calendar;
|
|
1914
|
-
_dateAdapter;
|
|
1915
|
-
_dateFormats;
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
this.calendar
|
|
1919
|
-
this._dateAdapter = _dateAdapter;
|
|
1920
|
-
this._dateFormats = _dateFormats;
|
|
1921
|
-
this.calendar.stateChanges.subscribe(() => changeDetectorRef.markForCheck());
|
|
1942
|
+
_intl = inject(NgxMatDatepickerIntl);
|
|
1943
|
+
calendar = inject(forwardRef(() => NgxMatCalendar));
|
|
1944
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
1945
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
1946
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
1947
|
+
constructor() {
|
|
1948
|
+
this.calendar.stateChanges.subscribe(() => this.changeDetectorRef.markForCheck());
|
|
1922
1949
|
}
|
|
1923
1950
|
/** The display text for the current calendar view. */
|
|
1924
1951
|
get periodButtonText() {
|
|
1952
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
1953
|
+
return "";
|
|
1925
1954
|
if (this.calendar.currentView() == 'month') {
|
|
1926
1955
|
return this._dateAdapter
|
|
1927
1956
|
.format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
|
@@ -1934,6 +1963,8 @@ class NgxMatCalendarHeader {
|
|
|
1934
1963
|
}
|
|
1935
1964
|
/** The aria description for the current calendar view. */
|
|
1936
1965
|
get periodButtonDescription() {
|
|
1966
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
1967
|
+
return "";
|
|
1937
1968
|
if (this.calendar.currentView() == 'month') {
|
|
1938
1969
|
return this._dateAdapter
|
|
1939
1970
|
.format(this.calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
|
@@ -1974,6 +2005,8 @@ class NgxMatCalendarHeader {
|
|
|
1974
2005
|
}
|
|
1975
2006
|
/** Handles user clicks on the previous button. */
|
|
1976
2007
|
previousClicked() {
|
|
2008
|
+
if (!this._dateAdapter)
|
|
2009
|
+
return;
|
|
1977
2010
|
this.calendar.activeDate =
|
|
1978
2011
|
this.calendar.currentView() == 'month'
|
|
1979
2012
|
? this._dateAdapter.addCalendarMonths(this.calendar.activeDate, -1)
|
|
@@ -1981,6 +2014,8 @@ class NgxMatCalendarHeader {
|
|
|
1981
2014
|
}
|
|
1982
2015
|
/** Handles user clicks on the next button. */
|
|
1983
2016
|
nextClicked() {
|
|
2017
|
+
if (!this._dateAdapter)
|
|
2018
|
+
return;
|
|
1984
2019
|
this.calendar.activeDate =
|
|
1985
2020
|
this.calendar.currentView() == 'month'
|
|
1986
2021
|
? this._dateAdapter.addCalendarMonths(this.calendar.activeDate, 1)
|
|
@@ -1999,6 +2034,8 @@ class NgxMatCalendarHeader {
|
|
|
1999
2034
|
}
|
|
2000
2035
|
/** Whether the two dates represent the same view in the current view mode (month or year). */
|
|
2001
2036
|
_isSameView(date1, date2) {
|
|
2037
|
+
if (!this._dateAdapter)
|
|
2038
|
+
return false;
|
|
2002
2039
|
if (this.calendar.currentView() == 'month') {
|
|
2003
2040
|
return (this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) &&
|
|
2004
2041
|
this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2));
|
|
@@ -2015,6 +2052,8 @@ class NgxMatCalendarHeader {
|
|
|
2015
2052
|
* for the minimum year, and the second string is the formatted label for the maximum year.
|
|
2016
2053
|
*/
|
|
2017
2054
|
_formatMinAndMaxYearLabels() {
|
|
2055
|
+
if (!this._dateAdapter)
|
|
2056
|
+
return ["", ""];
|
|
2018
2057
|
// The offset from the active year to the "slot" for the starting year is the
|
|
2019
2058
|
// *actual* first rendered year in the multi-year view, and the last year is
|
|
2020
2059
|
// just yearsPerPage - 1 away.
|
|
@@ -2028,28 +2067,15 @@ class NgxMatCalendarHeader {
|
|
|
2028
2067
|
}
|
|
2029
2068
|
_id = `mat-calendar-header-${calendarHeaderId++}`;
|
|
2030
2069
|
_periodButtonLabelId = `${this._id}-period-label`;
|
|
2031
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarHeader, deps: [
|
|
2070
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2032
2071
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatCalendarHeader, isStandalone: true, selector: "ngx-mat-calendar-header", exportAs: ["ngxMatCalendarHeader"], ngImport: i0, template: "<div class=\"mat-calendar-header\">\n <div class=\"mat-calendar-controls\">\n <button\n mat-button\n type=\"button\"\n class=\"mat-calendar-period-button\"\n (click)=\"currentPeriodClicked()\"\n [attr.aria-label]=\"periodButtonLabel\"\n [attr.aria-describedby]=\"_periodButtonLabelId\"\n aria-live=\"polite\">\n <span aria-hidden=\"true\">{{ periodButtonText }}</span>\n <svg\n class=\"mat-calendar-arrow\"\n [class.mat-calendar-invert]=\"calendar.currentView() !== 'month'\"\n viewBox=\"0 0 10 5\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <polygon points=\"0,0 5,5 10,0\" />\n </svg>\n </button>\n\n <div class=\"mat-calendar-spacer\"></div>\n\n <ng-content></ng-content>\n\n <button\n mat-icon-button\n type=\"button\"\n class=\"mat-calendar-previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\"\n [attr.aria-label]=\"prevButtonLabel\"></button>\n\n <button\n mat-icon-button\n type=\"button\"\n class=\"mat-calendar-next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\"\n [attr.aria-label]=\"nextButtonLabel\"></button>\n </div>\n</div>\n<label [id]=\"_periodButtonLabelId\" class=\"mat-calendar-hidden-label\">{{\n periodButtonDescription\n}}</label>\n", dependencies: [{ kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2033
2072
|
}
|
|
2034
2073
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendarHeader, decorators: [{
|
|
2035
2074
|
type: Component,
|
|
2036
2075
|
args: [{ selector: 'ngx-mat-calendar-header', exportAs: 'ngxMatCalendarHeader', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButton, MatIconButton], template: "<div class=\"mat-calendar-header\">\n <div class=\"mat-calendar-controls\">\n <button\n mat-button\n type=\"button\"\n class=\"mat-calendar-period-button\"\n (click)=\"currentPeriodClicked()\"\n [attr.aria-label]=\"periodButtonLabel\"\n [attr.aria-describedby]=\"_periodButtonLabelId\"\n aria-live=\"polite\">\n <span aria-hidden=\"true\">{{ periodButtonText }}</span>\n <svg\n class=\"mat-calendar-arrow\"\n [class.mat-calendar-invert]=\"calendar.currentView() !== 'month'\"\n viewBox=\"0 0 10 5\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <polygon points=\"0,0 5,5 10,0\" />\n </svg>\n </button>\n\n <div class=\"mat-calendar-spacer\"></div>\n\n <ng-content></ng-content>\n\n <button\n mat-icon-button\n type=\"button\"\n class=\"mat-calendar-previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\"\n [attr.aria-label]=\"prevButtonLabel\"></button>\n\n <button\n mat-icon-button\n type=\"button\"\n class=\"mat-calendar-next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\"\n [attr.aria-label]=\"nextButtonLabel\"></button>\n </div>\n</div>\n<label [id]=\"_periodButtonLabelId\" class=\"mat-calendar-hidden-label\">{{\n periodButtonDescription\n}}</label>\n" }]
|
|
2037
|
-
}], ctorParameters: () => [
|
|
2038
|
-
type: Inject,
|
|
2039
|
-
args: [forwardRef(() => NgxMatCalendar)]
|
|
2040
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
2041
|
-
type: Optional
|
|
2042
|
-
}] }, { type: undefined, decorators: [{
|
|
2043
|
-
type: Optional
|
|
2044
|
-
}, {
|
|
2045
|
-
type: Inject,
|
|
2046
|
-
args: [MAT_DATE_FORMATS]
|
|
2047
|
-
}] }, { type: i0.ChangeDetectorRef }] });
|
|
2076
|
+
}], ctorParameters: () => [] });
|
|
2048
2077
|
/** A calendar that is used as part of the datepicker. */
|
|
2049
2078
|
class NgxMatCalendar {
|
|
2050
|
-
_dateAdapter;
|
|
2051
|
-
_dateFormats;
|
|
2052
|
-
_changeDetectorRef;
|
|
2053
2079
|
/** An input indicating the type of the header component, if set. */
|
|
2054
2080
|
headerComponent = input(...(ngDevMode ? [undefined, { debugName: "headerComponent" }] : /* istanbul ignore next */ []));
|
|
2055
2081
|
/** A portal containing the header component type for this calendar. */
|
|
@@ -2066,7 +2092,9 @@ class NgxMatCalendar {
|
|
|
2066
2092
|
return this._startAt;
|
|
2067
2093
|
}
|
|
2068
2094
|
set startAt(value) {
|
|
2069
|
-
this._startAt = this._dateAdapter
|
|
2095
|
+
this._startAt = this._dateAdapter
|
|
2096
|
+
? this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value))
|
|
2097
|
+
: null;
|
|
2070
2098
|
}
|
|
2071
2099
|
_startAt = null;
|
|
2072
2100
|
/** Whether the calendar should be started in month or year view. */
|
|
@@ -2076,7 +2104,7 @@ class NgxMatCalendar {
|
|
|
2076
2104
|
return this._selected;
|
|
2077
2105
|
}
|
|
2078
2106
|
set selected(value) {
|
|
2079
|
-
if (value instanceof NgxDateRange) {
|
|
2107
|
+
if (!this._dateAdapter || value instanceof NgxDateRange) {
|
|
2080
2108
|
this._selected = value;
|
|
2081
2109
|
}
|
|
2082
2110
|
else {
|
|
@@ -2089,6 +2117,10 @@ class NgxMatCalendar {
|
|
|
2089
2117
|
return this._minDate;
|
|
2090
2118
|
}
|
|
2091
2119
|
set minDate(value) {
|
|
2120
|
+
if (!this._dateAdapter) {
|
|
2121
|
+
this._minDate = null;
|
|
2122
|
+
return;
|
|
2123
|
+
}
|
|
2092
2124
|
this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
2093
2125
|
}
|
|
2094
2126
|
_minDate = null;
|
|
@@ -2097,6 +2129,10 @@ class NgxMatCalendar {
|
|
|
2097
2129
|
return this._maxDate;
|
|
2098
2130
|
}
|
|
2099
2131
|
set maxDate(value) {
|
|
2132
|
+
if (!this._dateAdapter) {
|
|
2133
|
+
this._maxDate = null;
|
|
2134
|
+
return;
|
|
2135
|
+
}
|
|
2100
2136
|
this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
2101
2137
|
}
|
|
2102
2138
|
_maxDate = null;
|
|
@@ -2144,9 +2180,11 @@ class NgxMatCalendar {
|
|
|
2144
2180
|
* highlighted when using keyboard navigation.
|
|
2145
2181
|
*/
|
|
2146
2182
|
get activeDate() {
|
|
2147
|
-
return this._clampedActiveDate ?? this._dateAdapter
|
|
2183
|
+
return this._clampedActiveDate ?? this._dateAdapter?.today();
|
|
2148
2184
|
}
|
|
2149
2185
|
set activeDate(value) {
|
|
2186
|
+
if (!this._dateAdapter)
|
|
2187
|
+
return;
|
|
2150
2188
|
this._clampedActiveDate = this._dateAdapter.clampDate(value, this.minDate, this.maxDate);
|
|
2151
2189
|
this.stateChanges.next();
|
|
2152
2190
|
this._changeDetectorRef.markForCheck();
|
|
@@ -2158,22 +2196,25 @@ class NgxMatCalendar {
|
|
|
2158
2196
|
* Emits whenever there is a state change that the header may need to respond to.
|
|
2159
2197
|
*/
|
|
2160
2198
|
stateChanges = new Subject();
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2199
|
+
_intl = inject(NgxMatDatepickerIntl);
|
|
2200
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
2201
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
2202
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
2203
|
+
constructor() {
|
|
2165
2204
|
if (!this._dateAdapter) {
|
|
2166
2205
|
throw createMissingDateImplError$1('DateAdapter');
|
|
2167
2206
|
}
|
|
2168
2207
|
if (!this._dateFormats) {
|
|
2169
2208
|
throw createMissingDateImplError$1('MAT_DATE_FORMATS');
|
|
2170
2209
|
}
|
|
2171
|
-
this._intlChanges = _intl.changes.subscribe(() => {
|
|
2172
|
-
_changeDetectorRef.markForCheck();
|
|
2210
|
+
this._intlChanges = this._intl.changes.subscribe(() => {
|
|
2211
|
+
this._changeDetectorRef.markForCheck();
|
|
2173
2212
|
this.stateChanges.next();
|
|
2174
2213
|
});
|
|
2175
2214
|
}
|
|
2176
2215
|
ngAfterContentInit() {
|
|
2216
|
+
if (!this._dateAdapter)
|
|
2217
|
+
return;
|
|
2177
2218
|
this._calendarHeaderPortal = new ComponentPortal(this.headerComponent() || NgxMatCalendarHeader);
|
|
2178
2219
|
this.activeDate = this.startAt || this._dateAdapter.today();
|
|
2179
2220
|
}
|
|
@@ -2191,11 +2232,11 @@ class NgxMatCalendar {
|
|
|
2191
2232
|
// Ignore date changes that are at a different time on the same day. This fixes issues where
|
|
2192
2233
|
// the calendar re-renders when there is no meaningful change to [minDate] or [maxDate]
|
|
2193
2234
|
// (#24435).
|
|
2194
|
-
const minDateChange = changes['minDate'] &&
|
|
2235
|
+
const minDateChange = this._dateAdapter && changes['minDate'] &&
|
|
2195
2236
|
!this._dateAdapter.sameDate(changes['minDate'].previousValue, changes['minDate'].currentValue)
|
|
2196
2237
|
? changes['minDate']
|
|
2197
2238
|
: undefined;
|
|
2198
|
-
const maxDateChange = changes['maxDate'] &&
|
|
2239
|
+
const maxDateChange = this._dateAdapter && changes['maxDate'] &&
|
|
2199
2240
|
!this._dateAdapter.sameDate(changes['maxDate'].previousValue, changes['maxDate'].currentValue)
|
|
2200
2241
|
? changes['maxDate']
|
|
2201
2242
|
: undefined;
|
|
@@ -2222,6 +2263,8 @@ class NgxMatCalendar {
|
|
|
2222
2263
|
}
|
|
2223
2264
|
/** Handles date selection in the month view. */
|
|
2224
2265
|
_dateSelected(event) {
|
|
2266
|
+
if (!this._dateAdapter)
|
|
2267
|
+
return;
|
|
2225
2268
|
let date = event.value;
|
|
2226
2269
|
if (date && this.selected) {
|
|
2227
2270
|
const selected = this.selected;
|
|
@@ -2275,7 +2318,7 @@ class NgxMatCalendar {
|
|
|
2275
2318
|
// only the first component type. See https://github.com/angular/components/issues/22996.
|
|
2276
2319
|
return this.monthView() || this.yearView() || this.multiYearView();
|
|
2277
2320
|
}
|
|
2278
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendar, deps: [
|
|
2321
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2279
2322
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatCalendar, isStandalone: true, selector: "ngx-mat-calendar", inputs: { headerComponent: { classPropertyName: "headerComponent", publicName: "headerComponent", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: false, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null }, comparisonStart: { classPropertyName: "comparisonStart", publicName: "comparisonStart", isSignal: true, isRequired: false, transformFunction: null }, comparisonEnd: { classPropertyName: "comparisonEnd", publicName: "comparisonEnd", isSignal: true, isRequired: false, transformFunction: null }, startDateAccessibleName: { classPropertyName: "startDateAccessibleName", publicName: "startDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null }, endDateAccessibleName: { classPropertyName: "endDateAccessibleName", publicName: "endDateAccessibleName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", monthSelected: "monthSelected", viewChanged: "viewChanged", _userSelection: "_userSelection", _userDragDrop: "_userDragDrop" }, host: { classAttribute: "mat-calendar" }, providers: [NGX_MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER], viewQueries: [{ propertyName: "monthView", first: true, predicate: NgxMatMonthView, descendants: true, isSignal: true }, { propertyName: "yearView", first: true, predicate: NgxMatYearView, descendants: true, isSignal: true }, { propertyName: "multiYearView", first: true, predicate: NgxMatMultiYearView, descendants: true, isSignal: true }], exportAs: ["ngxMatCalendar"], usesOnChanges: true, ngImport: i0, template: "<ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\" />\n\n<div class=\"mat-calendar-content\" cdkMonitorSubtreeFocus tabindex=\"-1\">\n @switch (currentView()) {\n @case ('month') {\n <ngx-mat-month-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n [comparisonStart]=\"comparisonStart()\"\n [comparisonEnd]=\"comparisonEnd()\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (_userSelection)=\"_dateSelected($event)\"\n (dragStarted)=\"_dragStarted($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n [activeDrag]=\"_activeDrag\" />\n }\n @case ('year') {\n <ngx-mat-year-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n (monthSelected)=\"_monthSelectedInYearView($event)\"\n (selectedChange)=\"_goToDateInView($event, 'month')\" />\n }\n @case ('multi-year') {\n <ngx-mat-multi-year-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n (yearSelected)=\"_yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"_goToDateInView($event, 'year')\" />\n }\n }\n</div>\n", styles: [".mat-calendar{display:block}.mat-calendar-header{padding:8px 8px 0}.mat-calendar-content{padding:0 8px 8px;outline:none}.mat-calendar-controls{display:flex;align-items:center;margin:5% calc(4.7142857143% - 16px)}.mat-calendar-spacer{flex:1 1 auto}.mat-calendar-period-button{min-width:0;margin:0 8px}.mat-calendar-arrow{display:inline-block;width:10px;height:5px;margin:0 0 0 5px;vertical-align:middle}.mat-calendar-arrow.mat-calendar-invert{transform:rotate(180deg)}[dir=rtl] .mat-calendar-arrow{margin:0 5px 0 0}@media(forced-colors:active){.mat-calendar-arrow{fill:CanvasText}}.mat-calendar-previous-button,.mat-calendar-next-button{position:relative}.mat-calendar-previous-button:after,.mat-calendar-next-button:after{inset:0;position:absolute;content:\"\";margin:15.5px;border:0 solid currentColor;border-top-width:2px}[dir=rtl] .mat-calendar-previous-button,[dir=rtl] .mat-calendar-next-button{transform:rotate(180deg)}.mat-calendar-previous-button:after{border-left-width:2px;transform:translate(2px) rotate(-45deg)}.mat-calendar-next-button:after{border-right-width:2px;transform:translate(-2px) rotate(45deg)}.mat-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mat-calendar-table-header th{text-align:center;padding:0 0 8px;color:var(--mat-datepicker-calendar-header-text-color, var(--mat-sys-on-surface-variant));font-size:var(--mat-datepicker-calendar-header-text-size, var(--mat-sys-title-small-size));font-weight:var(--mat-datepicker-calendar-header-text-weight, var(--mat-sys-title-small-weight))}.mat-calendar-table-header-divider{position:relative;height:1px}.mat-calendar-table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;right:-8px;height:1px}.mat-calendar-body-cell-content:before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 3px) * -1)}.mat-calendar-body-cell:focus .mat-focus-indicator:before{content:\"\"}.mat-calendar-hidden-label{display:none}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "directive", type: CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"], exportAs: ["cdkMonitorFocus"] }, { kind: "component", type: NgxMatMonthView, selector: "ngx-mat-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName", "activeDrag"], outputs: ["selectedChange", "_userSelection", "dragStarted", "dragEnded", "activeDateChange"], exportAs: ["ngxMatMonthView"] }, { kind: "component", type: NgxMatYearView, selector: "ngx-mat-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "monthSelected", "activeDateChange"], exportAs: ["ngxMatYearView"] }, { kind: "component", type: NgxMatMultiYearView, selector: "ngx-mat-multi-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "yearSelected", "activeDateChange"], exportAs: ["ngxMatMultiYearView"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2280
2323
|
}
|
|
2281
2324
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatCalendar, decorators: [{
|
|
@@ -2283,14 +2326,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
2283
2326
|
args: [{ selector: 'ngx-mat-calendar', host: {
|
|
2284
2327
|
class: 'mat-calendar',
|
|
2285
2328
|
}, exportAs: 'ngxMatCalendar', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [NGX_MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER], imports: [CdkPortalOutlet, CdkMonitorFocus, NgxMatMonthView, NgxMatYearView, NgxMatMultiYearView], template: "<ng-template [cdkPortalOutlet]=\"_calendarHeaderPortal\" />\n\n<div class=\"mat-calendar-content\" cdkMonitorSubtreeFocus tabindex=\"-1\">\n @switch (currentView()) {\n @case ('month') {\n <ngx-mat-month-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n [comparisonStart]=\"comparisonStart()\"\n [comparisonEnd]=\"comparisonEnd()\"\n [startDateAccessibleName]=\"startDateAccessibleName()\"\n [endDateAccessibleName]=\"endDateAccessibleName()\"\n (_userSelection)=\"_dateSelected($event)\"\n (dragStarted)=\"_dragStarted($event)\"\n (dragEnded)=\"_dragEnded($event)\"\n [activeDrag]=\"_activeDrag\" />\n }\n @case ('year') {\n <ngx-mat-year-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n (monthSelected)=\"_monthSelectedInYearView($event)\"\n (selectedChange)=\"_goToDateInView($event, 'month')\" />\n }\n @case ('multi-year') {\n <ngx-mat-multi-year-view\n [activeDate]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass()\"\n (yearSelected)=\"_yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"_goToDateInView($event, 'year')\" />\n }\n }\n</div>\n", styles: [".mat-calendar{display:block}.mat-calendar-header{padding:8px 8px 0}.mat-calendar-content{padding:0 8px 8px;outline:none}.mat-calendar-controls{display:flex;align-items:center;margin:5% calc(4.7142857143% - 16px)}.mat-calendar-spacer{flex:1 1 auto}.mat-calendar-period-button{min-width:0;margin:0 8px}.mat-calendar-arrow{display:inline-block;width:10px;height:5px;margin:0 0 0 5px;vertical-align:middle}.mat-calendar-arrow.mat-calendar-invert{transform:rotate(180deg)}[dir=rtl] .mat-calendar-arrow{margin:0 5px 0 0}@media(forced-colors:active){.mat-calendar-arrow{fill:CanvasText}}.mat-calendar-previous-button,.mat-calendar-next-button{position:relative}.mat-calendar-previous-button:after,.mat-calendar-next-button:after{inset:0;position:absolute;content:\"\";margin:15.5px;border:0 solid currentColor;border-top-width:2px}[dir=rtl] .mat-calendar-previous-button,[dir=rtl] .mat-calendar-next-button{transform:rotate(180deg)}.mat-calendar-previous-button:after{border-left-width:2px;transform:translate(2px) rotate(-45deg)}.mat-calendar-next-button:after{border-right-width:2px;transform:translate(-2px) rotate(45deg)}.mat-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mat-calendar-table-header th{text-align:center;padding:0 0 8px;color:var(--mat-datepicker-calendar-header-text-color, var(--mat-sys-on-surface-variant));font-size:var(--mat-datepicker-calendar-header-text-size, var(--mat-sys-title-small-size));font-weight:var(--mat-datepicker-calendar-header-text-weight, var(--mat-sys-title-small-weight))}.mat-calendar-table-header-divider{position:relative;height:1px}.mat-calendar-table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;right:-8px;height:1px}.mat-calendar-body-cell-content:before{margin:calc(calc(var(--mat-focus-indicator-border-width, 3px) + 3px) * -1)}.mat-calendar-body-cell:focus .mat-focus-indicator:before{content:\"\"}.mat-calendar-hidden-label{display:none}\n"] }]
|
|
2286
|
-
}], ctorParameters: () => [
|
|
2287
|
-
type: Optional
|
|
2288
|
-
}] }, { type: undefined, decorators: [{
|
|
2289
|
-
type: Optional
|
|
2290
|
-
}, {
|
|
2291
|
-
type: Inject,
|
|
2292
|
-
args: [MAT_DATE_FORMATS]
|
|
2293
|
-
}] }, { type: i0.ChangeDetectorRef }], propDecorators: { headerComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerComponent", required: false }] }], startAt: [{
|
|
2329
|
+
}], ctorParameters: () => [], propDecorators: { headerComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerComponent", required: false }] }], startAt: [{
|
|
2294
2330
|
type: Input
|
|
2295
2331
|
}], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], selected: [{
|
|
2296
2332
|
type: Input
|
|
@@ -2474,9 +2510,6 @@ class NgxMatDatepickerInputEvent {
|
|
|
2474
2510
|
}
|
|
2475
2511
|
/** Base class for datepicker inputs. */
|
|
2476
2512
|
class NgxMatDatepickerInputBase {
|
|
2477
|
-
_elementRef;
|
|
2478
|
-
_dateAdapter;
|
|
2479
|
-
_dateFormats;
|
|
2480
2513
|
/** Whether the component has been initialized. */
|
|
2481
2514
|
_isInitialized = false;
|
|
2482
2515
|
/** The value of the input. */
|
|
@@ -2516,9 +2549,15 @@ class NgxMatDatepickerInputBase {
|
|
|
2516
2549
|
dateInput = output();
|
|
2517
2550
|
/** Emits when the internal state has changed */
|
|
2518
2551
|
stateChanges = new Subject();
|
|
2519
|
-
_onTouched = () => {
|
|
2520
|
-
|
|
2521
|
-
|
|
2552
|
+
_onTouched = () => {
|
|
2553
|
+
// Intentionally left empty.
|
|
2554
|
+
};
|
|
2555
|
+
_validatorOnChange = () => {
|
|
2556
|
+
// Intentionally left empty.
|
|
2557
|
+
};
|
|
2558
|
+
_cvaOnChange = () => {
|
|
2559
|
+
// Intentionally left empty.
|
|
2560
|
+
};
|
|
2522
2561
|
_valueChangesSubscription = Subscription.EMPTY;
|
|
2523
2562
|
_localeSubscription = Subscription.EMPTY;
|
|
2524
2563
|
/**
|
|
@@ -2535,6 +2574,8 @@ class NgxMatDatepickerInputBase {
|
|
|
2535
2574
|
};
|
|
2536
2575
|
/** The form control validator for the date filter. */
|
|
2537
2576
|
_filterValidator = (control) => {
|
|
2577
|
+
if (!this._dateAdapter)
|
|
2578
|
+
return null;
|
|
2538
2579
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2539
2580
|
return !controlValue || this._matchesFilter(controlValue)
|
|
2540
2581
|
? null
|
|
@@ -2542,6 +2583,8 @@ class NgxMatDatepickerInputBase {
|
|
|
2542
2583
|
};
|
|
2543
2584
|
/** The form control validator for the min date. */
|
|
2544
2585
|
_minValidator = (control) => {
|
|
2586
|
+
if (!this._dateAdapter)
|
|
2587
|
+
return null;
|
|
2545
2588
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2546
2589
|
const min = this._getMinDate();
|
|
2547
2590
|
return !min || !controlValue || this._dateAdapter.compareDate(min, controlValue) <= 0
|
|
@@ -2550,6 +2593,8 @@ class NgxMatDatepickerInputBase {
|
|
|
2550
2593
|
};
|
|
2551
2594
|
/** The form control validator for the max date. */
|
|
2552
2595
|
_maxValidator = (control) => {
|
|
2596
|
+
if (!this._dateAdapter)
|
|
2597
|
+
return null;
|
|
2553
2598
|
const controlValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2554
2599
|
const max = this._getMaxDate();
|
|
2555
2600
|
return !max || !controlValue || this._dateAdapter.compareDate(max, controlValue) >= 0
|
|
@@ -2581,10 +2626,10 @@ class NgxMatDatepickerInputBase {
|
|
|
2581
2626
|
}
|
|
2582
2627
|
/** Whether the last value set on the input was valid. */
|
|
2583
2628
|
_lastValueValid = false;
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2629
|
+
_elementRef = inject((ElementRef));
|
|
2630
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
2631
|
+
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
2632
|
+
constructor() {
|
|
2588
2633
|
if (!this._dateAdapter) {
|
|
2589
2634
|
throw createMissingDateImplError$1('DateAdapter');
|
|
2590
2635
|
}
|
|
@@ -2592,7 +2637,7 @@ class NgxMatDatepickerInputBase {
|
|
|
2592
2637
|
throw createMissingDateImplError$1('MAT_DATE_FORMATS');
|
|
2593
2638
|
}
|
|
2594
2639
|
// Update the displayed date when the locale changes.
|
|
2595
|
-
this._localeSubscription = _dateAdapter.localeChanges.subscribe(() => {
|
|
2640
|
+
this._localeSubscription = this._dateAdapter.localeChanges.subscribe(() => {
|
|
2596
2641
|
this._assignValueProgrammatically(this.value);
|
|
2597
2642
|
});
|
|
2598
2643
|
}
|
|
@@ -2600,7 +2645,7 @@ class NgxMatDatepickerInputBase {
|
|
|
2600
2645
|
this._isInitialized = true;
|
|
2601
2646
|
}
|
|
2602
2647
|
ngOnChanges(changes) {
|
|
2603
|
-
if (dateInputsHaveChanged(changes, this._dateAdapter)) {
|
|
2648
|
+
if (this._dateAdapter && dateInputsHaveChanged(changes, this._dateAdapter)) {
|
|
2604
2649
|
this.stateChanges.next(undefined);
|
|
2605
2650
|
}
|
|
2606
2651
|
}
|
|
@@ -2644,6 +2689,8 @@ class NgxMatDatepickerInputBase {
|
|
|
2644
2689
|
}
|
|
2645
2690
|
}
|
|
2646
2691
|
_onInput(event) {
|
|
2692
|
+
if (!this._dateAdapter || !this._dateFormats)
|
|
2693
|
+
return;
|
|
2647
2694
|
const lastValueWasValid = this._lastValueValid;
|
|
2648
2695
|
const target = event.target;
|
|
2649
2696
|
let date = this._dateAdapter.parse(target.value, this._dateFormats.parse.dateInput);
|
|
@@ -2686,8 +2733,9 @@ class NgxMatDatepickerInputBase {
|
|
|
2686
2733
|
}
|
|
2687
2734
|
/** Formats a value and sets it on the input element. */
|
|
2688
2735
|
_formatValue(value) {
|
|
2689
|
-
this._elementRef.nativeElement.value =
|
|
2690
|
-
|
|
2736
|
+
this._elementRef.nativeElement.value = (this._dateAdapter && this._dateFormats && value != null)
|
|
2737
|
+
? this._dateAdapter.format(value, this._dateFormats.display.dateInput)
|
|
2738
|
+
: '';
|
|
2691
2739
|
}
|
|
2692
2740
|
/** Assigns a value to the model. */
|
|
2693
2741
|
_assignValue(value) {
|
|
@@ -2703,7 +2751,12 @@ class NgxMatDatepickerInputBase {
|
|
|
2703
2751
|
}
|
|
2704
2752
|
/** Whether a value is considered valid. */
|
|
2705
2753
|
_isValidValue(value) {
|
|
2706
|
-
|
|
2754
|
+
if (value) {
|
|
2755
|
+
return (this._dateAdapter)
|
|
2756
|
+
? this._dateAdapter.isValid(value)
|
|
2757
|
+
: false;
|
|
2758
|
+
}
|
|
2759
|
+
return true;
|
|
2707
2760
|
}
|
|
2708
2761
|
/**
|
|
2709
2762
|
* Checks whether a parent control is disabled. This is in place so that it can be overridden
|
|
@@ -2714,9 +2767,13 @@ class NgxMatDatepickerInputBase {
|
|
|
2714
2767
|
}
|
|
2715
2768
|
/** Programmatically assigns a value to the input. */
|
|
2716
2769
|
_assignValueProgrammatically(value) {
|
|
2717
|
-
value = this._dateAdapter
|
|
2770
|
+
value = this._dateAdapter
|
|
2771
|
+
? this._dateAdapter.deserialize(value)
|
|
2772
|
+
: null;
|
|
2718
2773
|
this._lastValueValid = this._isValidValue(value);
|
|
2719
|
-
value = this._dateAdapter
|
|
2774
|
+
value = this._dateAdapter
|
|
2775
|
+
? this._dateAdapter.getValidDateOrNull(value)
|
|
2776
|
+
: null;
|
|
2720
2777
|
this._assignValue(value);
|
|
2721
2778
|
this._formatValue(value);
|
|
2722
2779
|
}
|
|
@@ -2725,19 +2782,12 @@ class NgxMatDatepickerInputBase {
|
|
|
2725
2782
|
const filter = this._getDateFilter();
|
|
2726
2783
|
return !filter || filter(value);
|
|
2727
2784
|
}
|
|
2728
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerInputBase, deps: [
|
|
2785
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerInputBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2729
2786
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDatepickerInputBase, isStandalone: true, inputs: { value: "value", disabled: "disabled" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, usesOnChanges: true, ngImport: i0 });
|
|
2730
2787
|
}
|
|
2731
2788
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerInputBase, decorators: [{
|
|
2732
2789
|
type: Directive
|
|
2733
|
-
}], ctorParameters: () => [
|
|
2734
|
-
type: Optional
|
|
2735
|
-
}] }, { type: undefined, decorators: [{
|
|
2736
|
-
type: Optional
|
|
2737
|
-
}, {
|
|
2738
|
-
type: Inject,
|
|
2739
|
-
args: [MAT_DATE_FORMATS]
|
|
2740
|
-
}] }], propDecorators: { value: [{
|
|
2790
|
+
}], ctorParameters: () => [], propDecorators: { value: [{
|
|
2741
2791
|
type: Input
|
|
2742
2792
|
}], disabled: [{
|
|
2743
2793
|
type: Input
|
|
@@ -2771,12 +2821,6 @@ const NGX_MAT_DATE_RANGE_INPUT_PARENT = new InjectionToken('NGX_MAT_DATE_RANGE_I
|
|
|
2771
2821
|
* Base class for the individual inputs that can be projected inside a `mat-date-range-input`.
|
|
2772
2822
|
*/
|
|
2773
2823
|
class NgxMatDateRangeInputPartBase extends NgxMatDatepickerInputBase {
|
|
2774
|
-
_rangeInput;
|
|
2775
|
-
_elementRef;
|
|
2776
|
-
_defaultErrorStateMatcher;
|
|
2777
|
-
_injector;
|
|
2778
|
-
_parentForm;
|
|
2779
|
-
_parentFormGroup;
|
|
2780
2824
|
errorStateMatcher = null;
|
|
2781
2825
|
/**
|
|
2782
2826
|
* Form control bound to this input part.
|
|
@@ -2785,15 +2829,12 @@ class NgxMatDateRangeInputPartBase extends NgxMatDatepickerInputBase {
|
|
|
2785
2829
|
ngControl = null;
|
|
2786
2830
|
errorState = false;
|
|
2787
2831
|
_dir = inject(Directionality, { optional: true });
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
this._parentForm = _parentForm;
|
|
2795
|
-
this._parentFormGroup = _parentFormGroup;
|
|
2796
|
-
}
|
|
2832
|
+
_elementRef = inject((ElementRef));
|
|
2833
|
+
_rangeInput = inject(NGX_MAT_DATE_RANGE_INPUT_PARENT);
|
|
2834
|
+
_defaultErrorStateMatcher = inject(ErrorStateMatcher);
|
|
2835
|
+
_injector = inject(Injector);
|
|
2836
|
+
_parentForm = inject(NgForm, { optional: true });
|
|
2837
|
+
_parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
2797
2838
|
ngOnInit() {
|
|
2798
2839
|
// We need the date input to provide itself as a `ControlValueAccessor` and a `Validator`, while
|
|
2799
2840
|
// injecting its `NgControl` so that the error state is handled correctly. This introduces a
|
|
@@ -2877,41 +2918,26 @@ class NgxMatDateRangeInputPartBase extends NgxMatDatepickerInputBase {
|
|
|
2877
2918
|
_getAccessibleName() {
|
|
2878
2919
|
return _computeAriaAccessibleName(this._elementRef.nativeElement);
|
|
2879
2920
|
}
|
|
2880
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateRangeInputPartBase, deps:
|
|
2921
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateRangeInputPartBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2881
2922
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDateRangeInputPartBase, isStandalone: true, inputs: { errorStateMatcher: "errorStateMatcher" }, usesInheritance: true, ngImport: i0 });
|
|
2882
2923
|
}
|
|
2883
2924
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateRangeInputPartBase, decorators: [{
|
|
2884
2925
|
type: Directive
|
|
2885
|
-
}],
|
|
2886
|
-
type: Inject,
|
|
2887
|
-
args: [NGX_MAT_DATE_RANGE_INPUT_PARENT]
|
|
2888
|
-
}] }, { type: i0.ElementRef }, { type: i1.ErrorStateMatcher }, { type: i0.Injector }, { type: i2$1.NgForm, decorators: [{
|
|
2889
|
-
type: Optional
|
|
2890
|
-
}] }, { type: i2$1.FormGroupDirective, decorators: [{
|
|
2891
|
-
type: Optional
|
|
2892
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
2893
|
-
type: Optional
|
|
2894
|
-
}] }, { type: undefined, decorators: [{
|
|
2895
|
-
type: Optional
|
|
2896
|
-
}, {
|
|
2897
|
-
type: Inject,
|
|
2898
|
-
args: [MAT_DATE_FORMATS]
|
|
2899
|
-
}] }], propDecorators: { errorStateMatcher: [{
|
|
2926
|
+
}], propDecorators: { errorStateMatcher: [{
|
|
2900
2927
|
type: Input
|
|
2901
2928
|
}] } });
|
|
2902
2929
|
/** Input for entering the start date in a `mat-date-range-input`. */
|
|
2903
2930
|
class NgxMatStartDate extends NgxMatDateRangeInputPartBase {
|
|
2904
2931
|
/** Validator that checks that the start date isn't after the end date. */
|
|
2905
2932
|
_startValidator = (control) => {
|
|
2933
|
+
if (!this._dateAdapter)
|
|
2934
|
+
return null;
|
|
2906
2935
|
const start = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
2907
2936
|
const end = this._model ? this._model.selection.end : null;
|
|
2908
2937
|
return !start || !end || this._dateAdapter.compareDate(start, end) <= 0
|
|
2909
2938
|
? null
|
|
2910
2939
|
: { matStartDateInvalid: { end: end, actual: start } };
|
|
2911
2940
|
};
|
|
2912
|
-
constructor(rangeInput, elementRef, defaultErrorStateMatcher, injector, parentForm, parentFormGroup, dateAdapter, dateFormats) {
|
|
2913
|
-
super(rangeInput, elementRef, defaultErrorStateMatcher, injector, parentForm, parentFormGroup, dateAdapter, dateFormats);
|
|
2914
|
-
}
|
|
2915
2941
|
_validator = Validators.compose([...super._getValidators(), this._startValidator]);
|
|
2916
2942
|
_getValueFromModel(modelValue) {
|
|
2917
2943
|
return modelValue.start;
|
|
@@ -2921,10 +2947,12 @@ class NgxMatStartDate extends NgxMatDateRangeInputPartBase {
|
|
|
2921
2947
|
return false;
|
|
2922
2948
|
}
|
|
2923
2949
|
else {
|
|
2950
|
+
const fnCompare = (this._dateAdapter)
|
|
2951
|
+
? ch => !!this._dateAdapter.compareDate(ch.oldValue.start, ch.selection.start)
|
|
2952
|
+
: _ => false;
|
|
2924
2953
|
return !change.oldValue?.start
|
|
2925
2954
|
? !!change.selection.start
|
|
2926
|
-
: !change.selection.start ||
|
|
2927
|
-
!!this._dateAdapter.compareDate(change.oldValue.start, change.selection.start);
|
|
2955
|
+
: !change.selection.start || fnCompare(change);
|
|
2928
2956
|
}
|
|
2929
2957
|
}
|
|
2930
2958
|
_assignValueToModel(value) {
|
|
@@ -2955,8 +2983,8 @@ class NgxMatStartDate extends NgxMatDateRangeInputPartBase {
|
|
|
2955
2983
|
super._onKeydown(event);
|
|
2956
2984
|
}
|
|
2957
2985
|
}
|
|
2958
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatStartDate, deps:
|
|
2959
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatStartDate, isStandalone: true, selector: "input[ngxMatStartDate]", inputs: { errorStateMatcher: "errorStateMatcher" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { attributes: { "type": "text" }, listeners: { "input": "_onInput($event)", "change": "_onChange()", "keydown": "_onKeydown($event)", "blur": "_onBlur()" }, properties: { "disabled": "disabled", "attr.aria-haspopup": "_rangeInput.rangePicker ? \"dialog\" : null", "attr.aria-owns": "(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null", "attr.min": "_getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null", "attr.max": "_getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null" }, classAttribute: "mat-start-date mat-date-range-input-inner" }, providers: [
|
|
2986
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatStartDate, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2987
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatStartDate, isStandalone: true, selector: "input[ngxMatStartDate]", inputs: { errorStateMatcher: "errorStateMatcher" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { attributes: { "type": "text" }, listeners: { "input": "_onInput($event)", "change": "_onChange()", "keydown": "_onKeydown($event)", "blur": "_onBlur()" }, properties: { "disabled": "disabled", "attr.aria-haspopup": "_rangeInput.rangePicker ? \"dialog\" : null", "attr.aria-owns": "(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null", "attr.min": "_dateAdapter && _getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null", "attr.max": "_dateAdapter && _getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null" }, classAttribute: "mat-start-date mat-date-range-input-inner" }, providers: [
|
|
2960
2988
|
{ provide: NG_VALUE_ACCESSOR, useExisting: NgxMatStartDate, multi: true },
|
|
2961
2989
|
{ provide: NG_VALIDATORS, useExisting: NgxMatStartDate, multi: true },
|
|
2962
2990
|
], usesInheritance: true, ngImport: i0 });
|
|
@@ -2973,8 +3001,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
2973
3001
|
'(keydown)': '_onKeydown($event)',
|
|
2974
3002
|
'[attr.aria-haspopup]': '_rangeInput.rangePicker ? "dialog" : null',
|
|
2975
3003
|
'[attr.aria-owns]': '(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null',
|
|
2976
|
-
'[attr.min]': '_getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null',
|
|
2977
|
-
'[attr.max]': '_getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null',
|
|
3004
|
+
'[attr.min]': '_dateAdapter && _getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null',
|
|
3005
|
+
'[attr.max]': '_dateAdapter && _getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null',
|
|
2978
3006
|
'(blur)': '_onBlur()',
|
|
2979
3007
|
type: 'text',
|
|
2980
3008
|
},
|
|
@@ -2987,34 +3015,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
2987
3015
|
outputs: ['dateChange', 'dateInput'],
|
|
2988
3016
|
inputs: ['errorStateMatcher'],
|
|
2989
3017
|
}]
|
|
2990
|
-
}]
|
|
2991
|
-
type: Inject,
|
|
2992
|
-
args: [NGX_MAT_DATE_RANGE_INPUT_PARENT]
|
|
2993
|
-
}] }, { type: i0.ElementRef }, { type: i1.ErrorStateMatcher }, { type: i0.Injector }, { type: i2$1.NgForm, decorators: [{
|
|
2994
|
-
type: Optional
|
|
2995
|
-
}] }, { type: i2$1.FormGroupDirective, decorators: [{
|
|
2996
|
-
type: Optional
|
|
2997
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
2998
|
-
type: Optional
|
|
2999
|
-
}] }, { type: undefined, decorators: [{
|
|
3000
|
-
type: Optional
|
|
3001
|
-
}, {
|
|
3002
|
-
type: Inject,
|
|
3003
|
-
args: [MAT_DATE_FORMATS]
|
|
3004
|
-
}] }] });
|
|
3018
|
+
}] });
|
|
3005
3019
|
/** Input for entering the end date in a `mat-date-range-input`. */
|
|
3006
3020
|
class NgxMatEndDate extends NgxMatDateRangeInputPartBase {
|
|
3007
3021
|
/** Validator that checks that the end date isn't before the start date. */
|
|
3008
3022
|
_endValidator = (control) => {
|
|
3023
|
+
if (!this._dateAdapter)
|
|
3024
|
+
return null;
|
|
3009
3025
|
const end = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(control.value));
|
|
3010
3026
|
const start = this._model ? this._model.selection.start : null;
|
|
3011
3027
|
return !end || !start || this._dateAdapter.compareDate(end, start) >= 0
|
|
3012
3028
|
? null
|
|
3013
3029
|
: { matEndDateInvalid: { start: start, actual: end } };
|
|
3014
3030
|
};
|
|
3015
|
-
constructor(rangeInput, elementRef, defaultErrorStateMatcher, injector, parentForm, parentFormGroup, dateAdapter, dateFormats) {
|
|
3016
|
-
super(rangeInput, elementRef, defaultErrorStateMatcher, injector, parentForm, parentFormGroup, dateAdapter, dateFormats);
|
|
3017
|
-
}
|
|
3018
3031
|
_validator = Validators.compose([...super._getValidators(), this._endValidator]);
|
|
3019
3032
|
_getValueFromModel(modelValue) {
|
|
3020
3033
|
return modelValue.end;
|
|
@@ -3024,10 +3037,12 @@ class NgxMatEndDate extends NgxMatDateRangeInputPartBase {
|
|
|
3024
3037
|
return false;
|
|
3025
3038
|
}
|
|
3026
3039
|
else {
|
|
3040
|
+
const fnCompare = (this._dateAdapter)
|
|
3041
|
+
? ch => !!this._dateAdapter.compareDate(ch.oldValue.end, ch.selection.end)
|
|
3042
|
+
: _ => false;
|
|
3027
3043
|
return !change.oldValue?.end
|
|
3028
3044
|
? !!change.selection.end
|
|
3029
|
-
: !change.selection.end ||
|
|
3030
|
-
!!this._dateAdapter.compareDate(change.oldValue.end, change.selection.end);
|
|
3045
|
+
: !change.selection.end || fnCompare(change);
|
|
3031
3046
|
}
|
|
3032
3047
|
}
|
|
3033
3048
|
_assignValueToModel(value) {
|
|
@@ -3058,8 +3073,8 @@ class NgxMatEndDate extends NgxMatDateRangeInputPartBase {
|
|
|
3058
3073
|
super._onKeydown(event);
|
|
3059
3074
|
}
|
|
3060
3075
|
}
|
|
3061
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatEndDate, deps:
|
|
3062
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatEndDate, isStandalone: true, selector: "input[ngxMatEndDate]", inputs: { errorStateMatcher: "errorStateMatcher" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { attributes: { "type": "text" }, listeners: { "input": "_onInput($event)", "change": "_onChange()", "keydown": "_onKeydown($event)", "blur": "_onBlur()" }, properties: { "disabled": "disabled", "attr.aria-haspopup": "_rangeInput.rangePicker ? \"dialog\" : null", "attr.aria-owns": "(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null", "attr.min": "_getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null", "attr.max": "_getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null" }, classAttribute: "mat-end-date mat-date-range-input-inner" }, providers: [
|
|
3076
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatEndDate, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
3077
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatEndDate, isStandalone: true, selector: "input[ngxMatEndDate]", inputs: { errorStateMatcher: "errorStateMatcher" }, outputs: { dateChange: "dateChange", dateInput: "dateInput" }, host: { attributes: { "type": "text" }, listeners: { "input": "_onInput($event)", "change": "_onChange()", "keydown": "_onKeydown($event)", "blur": "_onBlur()" }, properties: { "disabled": "disabled", "attr.aria-haspopup": "_rangeInput.rangePicker ? \"dialog\" : null", "attr.aria-owns": "(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null", "attr.min": "_dateAdapter && _getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null", "attr.max": "_dateAdapter && _getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null" }, classAttribute: "mat-end-date mat-date-range-input-inner" }, providers: [
|
|
3063
3078
|
{ provide: NG_VALUE_ACCESSOR, useExisting: NgxMatEndDate, multi: true },
|
|
3064
3079
|
{ provide: NG_VALIDATORS, useExisting: NgxMatEndDate, multi: true },
|
|
3065
3080
|
], usesInheritance: true, ngImport: i0 });
|
|
@@ -3076,8 +3091,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
3076
3091
|
'(keydown)': '_onKeydown($event)',
|
|
3077
3092
|
'[attr.aria-haspopup]': '_rangeInput.rangePicker ? "dialog" : null',
|
|
3078
3093
|
'[attr.aria-owns]': '(_rangeInput.rangePicker?.opened && _rangeInput.rangePicker.id) || null',
|
|
3079
|
-
'[attr.min]': '_getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null',
|
|
3080
|
-
'[attr.max]': '_getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null',
|
|
3094
|
+
'[attr.min]': '_dateAdapter && _getMinDate() ? _dateAdapter.toIso8601(_getMinDate()!) : null',
|
|
3095
|
+
'[attr.max]': '_dateAdapter && _getMaxDate() ? _dateAdapter.toIso8601(_getMaxDate()!) : null',
|
|
3081
3096
|
'(blur)': '_onBlur()',
|
|
3082
3097
|
type: 'text',
|
|
3083
3098
|
},
|
|
@@ -3090,28 +3105,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
3090
3105
|
outputs: ['dateChange', 'dateInput'],
|
|
3091
3106
|
inputs: ['errorStateMatcher'],
|
|
3092
3107
|
}]
|
|
3093
|
-
}]
|
|
3094
|
-
type: Inject,
|
|
3095
|
-
args: [NGX_MAT_DATE_RANGE_INPUT_PARENT]
|
|
3096
|
-
}] }, { type: i0.ElementRef }, { type: i1.ErrorStateMatcher }, { type: i0.Injector }, { type: i2$1.NgForm, decorators: [{
|
|
3097
|
-
type: Optional
|
|
3098
|
-
}] }, { type: i2$1.FormGroupDirective, decorators: [{
|
|
3099
|
-
type: Optional
|
|
3100
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
3101
|
-
type: Optional
|
|
3102
|
-
}] }, { type: undefined, decorators: [{
|
|
3103
|
-
type: Optional
|
|
3104
|
-
}, {
|
|
3105
|
-
type: Inject,
|
|
3106
|
-
args: [MAT_DATE_FORMATS]
|
|
3107
|
-
}] }] });
|
|
3108
|
+
}] });
|
|
3108
3109
|
|
|
3109
3110
|
let nextUniqueId = 0;
|
|
3110
3111
|
class NgxMatDateRangeInput {
|
|
3111
|
-
_changeDetectorRef;
|
|
3112
|
-
_elementRef;
|
|
3113
|
-
_dateAdapter;
|
|
3114
|
-
_formField;
|
|
3115
3112
|
_closedSubscription = Subscription.EMPTY;
|
|
3116
3113
|
/** Current value of the range input. */
|
|
3117
3114
|
get value() {
|
|
@@ -3189,6 +3186,10 @@ class NgxMatDateRangeInput {
|
|
|
3189
3186
|
return this._min;
|
|
3190
3187
|
}
|
|
3191
3188
|
set min(value) {
|
|
3189
|
+
if (!this._dateAdapter) {
|
|
3190
|
+
this._min = null;
|
|
3191
|
+
return;
|
|
3192
|
+
}
|
|
3192
3193
|
const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
3193
3194
|
if (!this._dateAdapter.sameDate(validValue, this._min)) {
|
|
3194
3195
|
this._min = validValue;
|
|
@@ -3201,6 +3202,10 @@ class NgxMatDateRangeInput {
|
|
|
3201
3202
|
return this._max;
|
|
3202
3203
|
}
|
|
3203
3204
|
set max(value) {
|
|
3205
|
+
if (!this._dateAdapter) {
|
|
3206
|
+
this._max = null;
|
|
3207
|
+
return;
|
|
3208
|
+
}
|
|
3204
3209
|
const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
3205
3210
|
if (!this._dateAdapter.sameDate(validValue, this._max)) {
|
|
3206
3211
|
this._max = validValue;
|
|
@@ -3255,21 +3260,22 @@ class NgxMatDateRangeInput {
|
|
|
3255
3260
|
ngControl;
|
|
3256
3261
|
/** Emits when the input's state has changed. */
|
|
3257
3262
|
stateChanges = new Subject();
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3263
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
3264
|
+
_elementRef = inject((ElementRef));
|
|
3265
|
+
control = inject(ControlContainer, { optional: true, self: true });
|
|
3266
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
3267
|
+
_formField = inject(MAT_FORM_FIELD, { optional: true });
|
|
3268
|
+
constructor() {
|
|
3269
|
+
if (!this._dateAdapter) {
|
|
3264
3270
|
throw createMissingDateImplError$1('DateAdapter');
|
|
3265
3271
|
}
|
|
3266
3272
|
// The datepicker module can be used both with MDC and non-MDC form fields. We have
|
|
3267
3273
|
// to conditionally add the MDC input class so that the range picker looks correctly.
|
|
3268
|
-
if (_formField?._elementRef.nativeElement.classList.contains('mat-mdc-form-field')) {
|
|
3269
|
-
_elementRef.nativeElement.classList.add('mat-mdc-input-element', 'mat-mdc-form-field-input-control', 'mdc-text-field__input');
|
|
3274
|
+
if (this._formField?._elementRef.nativeElement.classList.contains('mat-mdc-form-field')) {
|
|
3275
|
+
this._elementRef.nativeElement.classList.add('mat-mdc-input-element', 'mat-mdc-form-field-input-control', 'mdc-text-field__input');
|
|
3270
3276
|
}
|
|
3271
3277
|
// TODO(crisbeto): remove `as any` after #18206 lands.
|
|
3272
|
-
this.ngControl = control;
|
|
3278
|
+
this.ngControl = this.control;
|
|
3273
3279
|
}
|
|
3274
3280
|
/**
|
|
3275
3281
|
* Implemented as a part of `MatFormFieldControl`.
|
|
@@ -3309,7 +3315,7 @@ class NgxMatDateRangeInput {
|
|
|
3309
3315
|
});
|
|
3310
3316
|
}
|
|
3311
3317
|
ngOnChanges(changes) {
|
|
3312
|
-
if (dateInputsHaveChanged(changes, this._dateAdapter)) {
|
|
3318
|
+
if (this._dateAdapter && dateInputsHaveChanged(changes, this._dateAdapter)) {
|
|
3313
3319
|
this.stateChanges.next(undefined);
|
|
3314
3320
|
}
|
|
3315
3321
|
}
|
|
@@ -3397,7 +3403,7 @@ class NgxMatDateRangeInput {
|
|
|
3397
3403
|
_isTargetRequired(target) {
|
|
3398
3404
|
return target?.ngControl?.control?.hasValidator(Validators.required);
|
|
3399
3405
|
}
|
|
3400
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateRangeInput, deps: [
|
|
3406
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDateRangeInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3401
3407
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDateRangeInput, isStandalone: true, selector: "ngx-mat-date-range-input", inputs: { rangePicker: "rangePicker", required: "required", dateFilter: "dateFilter", min: "min", max: "max", disabled: "disabled", separator: "separator", comparisonStart: "comparisonStart", comparisonEnd: "comparisonEnd" }, host: { attributes: { "role": "group" }, properties: { "class.mat-date-range-input-hide-placeholders": "_shouldHidePlaceholders()", "class.mat-date-range-input-required": "required", "attr.id": "id", "attr.aria-labelledby": "_getAriaLabelledby()", "attr.aria-describedby": "_ariaDescribedBy", "attr.data-mat-calendar": "rangePicker ? rangePicker.id : null" }, classAttribute: "mat-date-range-input" }, providers: [
|
|
3402
3408
|
{ provide: MatFormFieldControl, useExisting: NgxMatDateRangeInput },
|
|
3403
3409
|
{
|
|
@@ -3426,18 +3432,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
3426
3432
|
useExisting: NgxMatDateRangeInput,
|
|
3427
3433
|
},
|
|
3428
3434
|
], imports: [CdkMonitorFocus], template: "<div\n class=\"mat-date-range-input-container\"\n cdkMonitorSubtreeFocus\n (cdkFocusChange)=\"_updateFocus($event)\"\n>\n <div class=\"mat-date-range-input-wrapper\">\n <ng-content select=\"input[matStartDate]\"></ng-content>\n <span class=\"mat-date-range-input-mirror\" aria-hidden=\"true\">{{\n _getInputMirrorValue(\"start\")\n }}</span>\n </div>\n\n <span\n class=\"mat-date-range-input-separator\"\n [class.mat-date-range-input-separator-hidden]=\"_shouldHideSeparator()\"\n >{{ separator }}</span\n >\n\n <div class=\"mat-date-range-input-wrapper mat-date-range-input-end-wrapper\">\n <ng-content select=\"input[matEndDate]\"></ng-content>\n <span class=\"mat-date-range-input-mirror\" aria-hidden=\"true\">{{\n _getInputMirrorValue(\"end\")\n }}</span>\n </div>\n</div>\n", styles: [".mat-date-range-input{display:block;width:100%}.mat-date-range-input-container{display:flex;align-items:center}.mat-date-range-input-separator{transition:opacity .4s .1333333333333s cubic-bezier(.25,.8,.25,1);margin:0 4px}._mat-animation-noopable .mat-date-range-input-separator{transition:none}.mat-date-range-input-separator-hidden{-webkit-user-select:none;user-select:none;opacity:0;transition:none}.mat-date-range-input-wrapper{position:relative;overflow:hidden;max-width:calc(50% - 4px)}.mat-date-range-input-end-wrapper{flex-grow:1}.mat-date-range-input-inner{position:absolute;top:0;left:0;font:inherit;background:transparent;color:currentColor;border:none;outline:none;padding:0;margin:0;vertical-align:bottom;text-align:inherit;appearance:none;width:100%;height:100%}.mat-date-range-input-inner:-moz-ui-invalid{box-shadow:none}.mat-form-field-hide-placeholder .mat-date-range-input-inner::placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::placeholder{-webkit-user-select:none;user-select:none;color:transparent!important;-webkit-text-fill-color:transparent;transition:none}@media(forced-colors:active){.mat-form-field-hide-placeholder .mat-date-range-input-inner::placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::placeholder{opacity:0}}.mat-form-field-hide-placeholder .mat-date-range-input-inner::-moz-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-moz-placeholder{-webkit-user-select:none;user-select:none;color:transparent!important;-webkit-text-fill-color:transparent;transition:none}@media(forced-colors:active){.mat-form-field-hide-placeholder .mat-date-range-input-inner::-moz-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-moz-placeholder{opacity:0}}.mat-form-field-hide-placeholder .mat-date-range-input-inner::-webkit-input-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-webkit-input-placeholder{-webkit-user-select:none;user-select:none;color:transparent!important;-webkit-text-fill-color:transparent;transition:none}@media(forced-colors:active){.mat-form-field-hide-placeholder .mat-date-range-input-inner::-webkit-input-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner::-webkit-input-placeholder{opacity:0}}.mat-form-field-hide-placeholder .mat-date-range-input-inner:-ms-input-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner:-ms-input-placeholder{-webkit-user-select:none;user-select:none;color:transparent!important;-webkit-text-fill-color:transparent;transition:none}@media(forced-colors:active){.mat-form-field-hide-placeholder .mat-date-range-input-inner:-ms-input-placeholder,.mat-date-range-input-hide-placeholders .mat-date-range-input-inner:-ms-input-placeholder{opacity:0}}._mat-animation-noopable .mat-date-range-input-inner::placeholder{transition:none}._mat-animation-noopable .mat-date-range-input-inner::-moz-placeholder{transition:none}._mat-animation-noopable .mat-date-range-input-inner::-webkit-input-placeholder{transition:none}._mat-animation-noopable .mat-date-range-input-inner:-ms-input-placeholder{transition:none}.mat-date-range-input-mirror{-webkit-user-select:none;user-select:none;visibility:hidden;white-space:nowrap;display:inline-block;min-width:2px}.mat-mdc-form-field-type-mat-date-range-input .mat-mdc-form-field-infix{width:200px}\n"] }]
|
|
3429
|
-
}], ctorParameters: () => [
|
|
3430
|
-
type: Optional
|
|
3431
|
-
}, {
|
|
3432
|
-
type: Self
|
|
3433
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
3434
|
-
type: Optional
|
|
3435
|
-
}] }, { type: undefined, decorators: [{
|
|
3436
|
-
type: Optional
|
|
3437
|
-
}, {
|
|
3438
|
-
type: Inject,
|
|
3439
|
-
args: [MAT_FORM_FIELD]
|
|
3440
|
-
}] }], propDecorators: { rangePicker: [{
|
|
3435
|
+
}], ctorParameters: () => [], propDecorators: { rangePicker: [{
|
|
3441
3436
|
type: Input
|
|
3442
3437
|
}], required: [{
|
|
3443
3438
|
type: Input
|
|
@@ -3526,8 +3521,12 @@ class NgxMatTimepickerComponent {
|
|
|
3526
3521
|
nonNullable: true,
|
|
3527
3522
|
}),
|
|
3528
3523
|
});
|
|
3529
|
-
_onChange = () => {
|
|
3530
|
-
|
|
3524
|
+
_onChange = () => {
|
|
3525
|
+
// Intentionally left empty.
|
|
3526
|
+
};
|
|
3527
|
+
_onTouched = () => {
|
|
3528
|
+
// Intentionally left empty.
|
|
3529
|
+
};
|
|
3531
3530
|
value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3532
3531
|
/** Hour */
|
|
3533
3532
|
get hour() {
|
|
@@ -3707,7 +3706,7 @@ class NgxMatTimepickerComponent {
|
|
|
3707
3706
|
useExisting: forwardRef(() => NgxMatTimepickerComponent),
|
|
3708
3707
|
multi: true,
|
|
3709
3708
|
},
|
|
3710
|
-
], exportAs: ["ngxMatTimepicker"], ngImport: i0, template: "<form [formGroup]=\"form\">\n <table class=\"ngx-mat-timepicker-table\">\n <tbody class=\"ngx-mat-timepicker-tbody\">\n @if (showSpinners()) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('hour', true)\"\n [disabled]=\"disabled()\">\n <mat-icon>\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" />\n </svg>\n </mat-icon>\n </button>\n </td>\n <td></td>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('minute', true)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" /></svg\n ></mat-icon>\n </button>\n </td>\n <td></td>\n @if (showSeconds()) {\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('second', true)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" /></svg\n ></mat-icon>\n </button>\n </td>\n }\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n <td></td>\n }\n </tr>\n }\n\n <tr>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"hour\"\n (keydown.ArrowUp)=\"change('hour', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('hour', false); $event.preventDefault()\"\n (blur)=\"change('hour')\" />\n </mat-form-field>\n </td>\n <td class=\"ngx-mat-timepicker-spacer\">:</td>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"minute\"\n (keydown.ArrowUp)=\"change('minute', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('minute', false); $event.preventDefault()\"\n (blur)=\"change('minute')\" />\n </mat-form-field>\n </td>\n @if (showSeconds()) {\n <td class=\"ngx-mat-timepicker-spacer\">:</td>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"second\"\n (keydown.ArrowUp)=\"change('second', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('second', false); $event.preventDefault()\"\n (blur)=\"change('second')\" />\n </mat-form-field>\n </td>\n }\n\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n\n <td class=\"ngx-mat-timepicker-meridian\">\n <button\n mat-button\n (click)=\"toggleMeridian()\"\n mat-stroked-button\n [color]=\"color()\"\n [disabled]=\"disabled()\">\n {{ meridian() }}\n </button>\n </td>\n }\n </tr>\n\n @if (showSpinners()) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('hour', false)\"\n [disabled]=\"disabled()\">\n <mat-icon>\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </mat-icon>\n </button>\n </td>\n <td></td>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('minute', false)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" /></svg\n ></mat-icon>\n </button>\n </td>\n @if (showSeconds()) {\n <td></td>\n\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('second', false)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" /></svg\n ></mat-icon>\n </button>\n </td>\n }\n\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n <td></td>\n }\n </tr>\n }\n </tbody>\n </table>\n</form>\n", styles: [".ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td{text-align:center}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td.ngx-mat-timepicker-spacer{font-weight:700}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td.ngx-mat-timepicker-meridian .mdc-button{min-width:64px;line-height:36px;min-width:0;border-radius:50%;width:36px;height:36px;padding:0;flex-shrink:0}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button{display:inline-flex;align-items:center;justify-content:center;height:var(--mat-icon-button-state-layer-size, 40px);width:var(--mdc-icon-button-state-layer-size, 40px);line-height:var(--mdc-icon-button-state-layer-size, 40px);font-size:var(--mdc-icon-button-icon-size, 24px);color:var(--mdc-icon-button-icon-color, var(--mat-sys-on-surface-variant));padding:calc((var(--mdc-icon-button-state-layer-size, 40px) - var(--mdc-icon-button-icon-size, 24px)) / 2)}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button .mat-icon{font-size:var(--mdc-icon-button-icon-size, 24px)}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button svg{width:var(--mdc-icon-button-icon-size, 24px);height:var(--mdc-icon-button-icon-size, 24px);vertical-align:baseline}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button:disabled,.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mdc-icon-button-disabled-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field{width:24px;max-width:24px;text-align:center}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field.mat-focused .mdc-text-field--filled .mat-mdc-form-field-focus-overlay,.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field:hover .mdc-text-field--filled .mat-mdc-form-field-focus-overlay{background-color:transparent}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled{background-color:transparent!important;padding:0!important}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled .mat-mdc-form-field-infix{padding:4px 0;min-height:1px!important}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled .mat-mdc-form-field-infix input{text-align:center;font-size:14px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3709
|
+
], exportAs: ["ngxMatTimepicker"], ngImport: i0, template: "<form [formGroup]=\"form\">\n <table class=\"ngx-mat-timepicker-table\">\n <tbody class=\"ngx-mat-timepicker-tbody\">\n @if (showSpinners()) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('hour', true)\"\n [disabled]=\"disabled()\">\n <mat-icon>\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" />\n </svg>\n </mat-icon>\n </button>\n </td>\n <td></td>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('minute', true)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" /></svg\n ></mat-icon>\n </button>\n </td>\n <td></td>\n @if (showSeconds()) {\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"expand_less icon\"\n (click)=\"change('second', true)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M18 15l-6-6-6 6\" /></svg\n ></mat-icon>\n </button>\n </td>\n }\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n <td></td>\n }\n </tr>\n }\n\n <tr>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"hour\"\n (keydown.ArrowUp)=\"change('hour', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('hour', false); $event.preventDefault()\"\n (blur)=\"change('hour')\" />\n </mat-form-field>\n </td>\n <td class=\"ngx-mat-timepicker-spacer\">:</td>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"minute\"\n (keydown.ArrowUp)=\"change('minute', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('minute', false); $event.preventDefault()\"\n (blur)=\"change('minute')\" />\n </mat-form-field>\n </td>\n @if (showSeconds()) {\n <td class=\"ngx-mat-timepicker-spacer\">:</td>\n <td>\n <mat-form-field appearance=\"fill\" [color]=\"color()\">\n <input\n type=\"text\"\n matInput\n (input)=\"formatInput($any($event).target)\"\n maxlength=\"2\"\n formControlName=\"second\"\n (keydown.ArrowUp)=\"change('second', true); $event.preventDefault()\"\n (keydown.ArrowDown)=\"change('second', false); $event.preventDefault()\"\n (blur)=\"change('second')\" />\n </mat-form-field>\n </td>\n }\n\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n\n <td class=\"ngx-mat-timepicker-meridian\">\n <button\n mat-button\n (click)=\"toggleMeridian()\"\n mat-stroked-button\n [color]=\"color()\"\n [disabled]=\"disabled()\">\n {{ meridian() }}\n </button>\n </td>\n }\n </tr>\n\n @if (showSpinners()) {\n <tr>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('hour', false)\"\n [disabled]=\"disabled()\">\n <mat-icon>\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" />\n </svg>\n </mat-icon>\n </button>\n </td>\n <td></td>\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('minute', false)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" /></svg\n ></mat-icon>\n </button>\n </td>\n @if (showSeconds()) {\n <td></td>\n\n <td>\n <button\n type=\"button\"\n mat-icon-button\n aria-label=\"keyboard_arrow_down icon\"\n (click)=\"change('second', false)\"\n [disabled]=\"disabled() || disableMinute()\">\n <mat-icon\n ><svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"M6 9l6 6 6-6\" /></svg\n ></mat-icon>\n </button>\n </td>\n }\n\n @if (enableMeridian()) {\n <td class=\"ngx-mat-timepicker-spacer\"></td>\n <td></td>\n }\n </tr>\n }\n </tbody>\n </table>\n</form>\n", styles: [".ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td{text-align:center}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td.ngx-mat-timepicker-spacer{font-weight:700}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td.ngx-mat-timepicker-meridian .mdc-button{min-width:64px;line-height:36px;min-width:0;border-radius:50%;width:36px;height:36px;padding:0;flex-shrink:0}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button{display:inline-flex;align-items:center;justify-content:center;height:var(--mat-icon-button-state-layer-size, 40px);width:var(--mdc-icon-button-state-layer-size, 40px);line-height:var(--mdc-icon-button-state-layer-size, 40px);font-size:var(--mdc-icon-button-icon-size, 24px);color:var(--mdc-icon-button-icon-color, var(--mat-sys-on-surface-variant));padding:calc((var(--mdc-icon-button-state-layer-size, 40px) - var(--mdc-icon-button-icon-size, 24px)) / 2)}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button .mat-icon{font-size:var(--mdc-icon-button-icon-size, 24px)}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button svg{width:var(--mdc-icon-button-icon-size, 24px);height:var(--mdc-icon-button-icon-size, 24px);vertical-align:baseline}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button:disabled,.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-icon-button.mat-mdc-button-disabled{cursor:default;pointer-events:none;color:var(--mdc-icon-button-disabled-icon-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field{width:24px;max-width:24px;text-align:center}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field.mat-focused .mdc-text-field--filled .mat-mdc-form-field-focus-overlay,.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field:hover .mdc-text-field--filled .mat-mdc-form-field-focus-overlay{background-color:transparent}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled{background-color:transparent!important;padding:0!important}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled .mat-mdc-form-field-infix{padding:4px 0;min-height:1px!important}.ngx-mat-timepicker form .ngx-mat-timepicker-table .ngx-mat-timepicker-tbody tr td .mat-mdc-form-field .mdc-text-field--filled .mat-mdc-form-field-infix input{text-align:center;font-size:14px}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3711
3710
|
}
|
|
3712
3711
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatTimepickerComponent, decorators: [{
|
|
3713
3712
|
type: Component,
|
|
@@ -3751,10 +3750,6 @@ const NGX_MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
|
3751
3750
|
* @docs-private
|
|
3752
3751
|
*/
|
|
3753
3752
|
class NgxMatDatepickerContent {
|
|
3754
|
-
_changeDetectorRef;
|
|
3755
|
-
_globalModel;
|
|
3756
|
-
_dateAdapter;
|
|
3757
|
-
_rangeSelectionStrategy;
|
|
3758
3753
|
_subscriptions = new Subscription();
|
|
3759
3754
|
_model = null;
|
|
3760
3755
|
/** Reference to the internal calendar component. */
|
|
@@ -3812,12 +3807,13 @@ class NgxMatDatepickerContent {
|
|
|
3812
3807
|
return this._calendar().currentView() == 'month';
|
|
3813
3808
|
}
|
|
3814
3809
|
_modelTime = null;
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3810
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
3811
|
+
_globalModel = inject((NgxMatDateSelectionModel));
|
|
3812
|
+
_dateAdapter = inject((DateAdapter));
|
|
3813
|
+
_rangeSelectionStrategy = inject(NGX_MAT_DATE_RANGE_SELECTION_STRATEGY, { optional: true });
|
|
3814
|
+
_intl = inject(NgxMatDatepickerIntl);
|
|
3815
|
+
constructor() {
|
|
3816
|
+
this._closeButtonText = this._intl.closeCalendarLabel;
|
|
3821
3817
|
effect(() => {
|
|
3822
3818
|
const calendar = this._calendar();
|
|
3823
3819
|
if (calendar) {
|
|
@@ -3921,8 +3917,8 @@ class NgxMatDatepickerContent {
|
|
|
3921
3917
|
this._changeDetectorRef.detectChanges();
|
|
3922
3918
|
}
|
|
3923
3919
|
}
|
|
3924
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerContent, deps: [
|
|
3925
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatDatepickerContent, isStandalone: true, selector: "ngx-mat-datepicker-content", inputs: { color: "color" }, host: { listeners: { "animationend": "_onAnimationEnd($event)" }, properties: { "class.mat-datepicker-content-touch": "datepicker!.touchUi", "class.mat-datepicker-content-touch-with-time": "!datepicker!.hideTime", "class.mat-primary": "this.isPrimary", "class.mat-accent": "this.isAccent", "class.mat-warn": "this.isWarn", "class.panel-enter-dropdown": "this.isEnterDropdown", "class.panel-enter-dialog": "this.isEnterDialog", "class.panel-leave": "this.isLeavingClass" }, classAttribute: "mat-datepicker-content" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: NgxMatCalendar, descendants: true, isSignal: true }], exportAs: ["ngxMatDatepickerContent"], ngImport: i0, template: "<div\n cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n class=\"mat-datepicker-content-container\"\n [class.mat-datepicker-content-container-with-custom-header]=\"\n datepicker?.calendarHeaderComponent()\n \"\n [class.mat-datepicker-content-container-with-actions]=\"_actionsPortal\"\n [class.mat-datepicker-content-container-with-time]=\"!datepicker!._hideTime\"\n>\n <ngx-mat-calendar\n [id]=\"datepicker!.id\"\n [ngClass]=\"datepicker!.panelClass\"\n [startAt]=\"datepicker!.startAt\"\n [startView]=\"datepicker!.startView()\"\n [minDate]=\"datepicker!._getMinDate()\"\n [maxDate]=\"datepicker!._getMaxDate()\"\n [dateFilter]=\"datepicker!._getDateFilter()\"\n [headerComponent]=\"datepicker!.calendarHeaderComponent()\"\n [selected]=\"_getSelected()\"\n [dateClass]=\"datepicker!.dateClass()\"\n [comparisonStart]=\"comparisonStart\"\n [comparisonEnd]=\"comparisonEnd\"\n [class.calendar-fade-enter]=\"false\"\n [startDateAccessibleName]=\"startDateAccessibleName\"\n [endDateAccessibleName]=\"endDateAccessibleName\"\n (yearSelected)=\"datepicker!._selectYear($event)\"\n (monthSelected)=\"datepicker!._selectMonth($event)\"\n (viewChanged)=\"datepicker!._viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection($event)\"\n (_userDragDrop)=\"_handleUserDragDrop($event)\"\n />\n\n @if (isViewMonth) {\n @if (!datepicker!._hideTime) {\n <div\n class=\"time-container\"\n [ngClass]=\"datepicker!.panelClass\"\n [class.disable-seconds]=\"!datepicker!._showSeconds\"\n >\n <ngx-mat-timepicker\n [showSpinners]=\"datepicker!._showSpinners\"\n [showSeconds]=\"datepicker!._showSeconds\"\n [disabled]=\"datepicker!._disabled || !_modelTime\"\n [stepHour]=\"datepicker!._stepHour\"\n [stepMinute]=\"datepicker!._stepMinute\"\n [stepSecond]=\"datepicker!._stepSecond\"\n [(ngModel)]=\"_modelTime\"\n [color]=\"datepicker!._color\"\n [enableMeridian]=\"datepicker!._enableMeridian\"\n [disableMinute]=\"datepicker!._disableMinute\"\n (ngModelChange)=\"onTimeChanged($event)\"\n />\n </div>\n }\n }\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\" />\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mat-datepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datepicker?.close()\"\n >\n {{ _closeButtonText }}\n </button>\n</div>\n", styles: ["@keyframes panelDropdownEnter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scale(1)}}@keyframes panelDialogEnter{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:none}}@keyframes panelLeave{0%{opacity:1}to{opacity:0}}.panel-enter-dropdown{animation:panelDropdownEnter .12s cubic-bezier(0,0,.2,1)}.panel-enter-dialog{animation:panelDialogEnter .15s cubic-bezier(0,0,.2,1)}.panel-leave{animation:panelLeave .1s linear forwards;pointer-events:none}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.calendar-fade-enter{animation:fadeIn .12s .1s cubic-bezier(.55,0,.55,.2) forwards}\n", ".mat-datepicker-content{display:block;border-radius:var(--mat-datepicker-calendar-container-shape, var(--mat-sys-corner-large, 4px));background-color:var(--mat-datepicker-calendar-container-background-color, var(--mat-sys-surface-container-high));color:var(--mat-datepicker-calendar-container-text-color, var(--mat-sys-on-surface));box-shadow:var(--mat-datepicker-calendar-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12))}.mat-datepicker-content .mat-calendar{font-family:var(--mat-datepicker-calendar-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-datepicker-calendar-text-size, var(--mat-sys-body-medium-size));width:296px;height:354px}.mat-datepicker-content .mat-datepicker-content-container-with-custom-header .mat-calendar{height:auto}.mat-datepicker-content .mat-datepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mat-datepicker-content .mat-datepicker-close-button{display:none}.mat-datepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.time-container{display:flex;position:relative;padding-top:5px;justify-content:center}.time-container.disable-seconds .ngx-mat-timepicker .table{margin-left:9px}.time-container:before{content:\"\";position:absolute;top:0;left:0;right:0;height:1px;background-color:#0000001f}.mat-datepicker-content-touch{display:block;max-height:90vh;position:relative;overflow:visible}.mat-datepicker-content-touch .mat-datepicker-content-container{min-height:312px;max-height:815px;min-width:250px;max-width:750px}.mat-datepicker-content-touch .mat-calendar{width:100%;height:auto}@media all and (orientation:landscape){.mat-datepicker-content-touch .mat-datepicker-content-container{width:64vh;height:90vh}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:none}}@media all and (orientation:portrait){.mat-datepicker-content-touch{max-height:100vh}.mat-datepicker-content-touch .mat-datepicker-content-container{width:80vw;height:100vw}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:870px}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time.mat-datepicker-content-container-with-actions{max-height:none!important}.mat-datepicker-content-touch .mat-datepicker-content-container-with-actions{height:115vw}}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: NgxMatCalendar, selector: "ngx-mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["ngxMatCalendar"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgxMatTimepickerComponent, selector: "ngx-mat-timepicker", inputs: ["disabled", "showSpinners", "stepHour", "stepMinute", "stepSecond", "showSeconds", "disableMinute", "enableMeridian", "defaultTime", "color", "meridian", "value"], outputs: ["valueChange"], exportAs: ["ngxMatTimepicker"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type:
|
|
3920
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3921
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxMatDatepickerContent, isStandalone: true, selector: "ngx-mat-datepicker-content", inputs: { color: "color" }, host: { listeners: { "animationend": "_onAnimationEnd($event)" }, properties: { "class.mat-datepicker-content-touch": "datepicker!.touchUi", "class.mat-datepicker-content-touch-with-time": "!datepicker!.hideTime", "class.mat-primary": "this.isPrimary", "class.mat-accent": "this.isAccent", "class.mat-warn": "this.isWarn", "class.panel-enter-dropdown": "this.isEnterDropdown", "class.panel-enter-dialog": "this.isEnterDialog", "class.panel-leave": "this.isLeavingClass" }, classAttribute: "mat-datepicker-content" }, viewQueries: [{ propertyName: "_calendar", first: true, predicate: NgxMatCalendar, descendants: true, isSignal: true }], exportAs: ["ngxMatDatepickerContent"], ngImport: i0, template: "<div\n cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n class=\"mat-datepicker-content-container\"\n [class.mat-datepicker-content-container-with-custom-header]=\"\n datepicker?.calendarHeaderComponent()\n \"\n [class.mat-datepicker-content-container-with-actions]=\"_actionsPortal\"\n [class.mat-datepicker-content-container-with-time]=\"!datepicker!._hideTime\"\n>\n <ngx-mat-calendar\n [id]=\"datepicker!.id\"\n [ngClass]=\"datepicker!.panelClass\"\n [startAt]=\"datepicker!.startAt\"\n [startView]=\"datepicker!.startView()\"\n [minDate]=\"datepicker!._getMinDate()\"\n [maxDate]=\"datepicker!._getMaxDate()\"\n [dateFilter]=\"datepicker!._getDateFilter()\"\n [headerComponent]=\"datepicker!.calendarHeaderComponent()\"\n [selected]=\"_getSelected()\"\n [dateClass]=\"datepicker!.dateClass()\"\n [comparisonStart]=\"comparisonStart\"\n [comparisonEnd]=\"comparisonEnd\"\n [class.calendar-fade-enter]=\"false\"\n [startDateAccessibleName]=\"startDateAccessibleName\"\n [endDateAccessibleName]=\"endDateAccessibleName\"\n (yearSelected)=\"datepicker!._selectYear($event)\"\n (monthSelected)=\"datepicker!._selectMonth($event)\"\n (viewChanged)=\"datepicker!._viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection($event)\"\n (_userDragDrop)=\"_handleUserDragDrop($event)\"\n />\n\n @if (isViewMonth) {\n @if (!datepicker!._hideTime) {\n <div\n class=\"time-container\"\n [ngClass]=\"datepicker!.panelClass\"\n [class.disable-seconds]=\"!datepicker!._showSeconds\"\n >\n <ngx-mat-timepicker\n [showSpinners]=\"datepicker!._showSpinners\"\n [showSeconds]=\"datepicker!._showSeconds\"\n [disabled]=\"datepicker!._disabled || !_modelTime\"\n [stepHour]=\"datepicker!._stepHour\"\n [stepMinute]=\"datepicker!._stepMinute\"\n [stepSecond]=\"datepicker!._stepSecond\"\n [(ngModel)]=\"_modelTime\"\n [color]=\"datepicker!._color\"\n [enableMeridian]=\"datepicker!._enableMeridian\"\n [disableMinute]=\"datepicker!._disableMinute\"\n (ngModelChange)=\"onTimeChanged($event)\"\n />\n </div>\n }\n }\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\" />\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mat-datepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datepicker?.close()\"\n >\n {{ _closeButtonText }}\n </button>\n</div>\n", styles: ["@keyframes panelDropdownEnter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scale(1)}}@keyframes panelDialogEnter{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:none}}@keyframes panelLeave{0%{opacity:1}to{opacity:0}}.panel-enter-dropdown{animation:panelDropdownEnter .12s cubic-bezier(0,0,.2,1)}.panel-enter-dialog{animation:panelDialogEnter .15s cubic-bezier(0,0,.2,1)}.panel-leave{animation:panelLeave .1s linear forwards;pointer-events:none}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.calendar-fade-enter{animation:fadeIn .12s .1s cubic-bezier(.55,0,.55,.2) forwards}\n", ".mat-datepicker-content{display:block;border-radius:var(--mat-datepicker-calendar-container-shape, var(--mat-sys-corner-large, 4px));background-color:var(--mat-datepicker-calendar-container-background-color, var(--mat-sys-surface-container-high));color:var(--mat-datepicker-calendar-container-text-color, var(--mat-sys-on-surface));box-shadow:var(--mat-datepicker-calendar-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12))}.mat-datepicker-content .mat-calendar{font-family:var(--mat-datepicker-calendar-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-datepicker-calendar-text-size, var(--mat-sys-body-medium-size));width:296px;height:354px}.mat-datepicker-content .mat-datepicker-content-container-with-custom-header .mat-calendar{height:auto}.mat-datepicker-content .mat-datepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mat-datepicker-content .mat-datepicker-close-button{display:none}.mat-datepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.time-container{display:flex;position:relative;padding-top:5px;justify-content:center}.time-container.disable-seconds .ngx-mat-timepicker .table{margin-left:9px}.time-container:before{content:\"\";position:absolute;top:0;left:0;right:0;height:1px;background-color:#0000001f}.mat-datepicker-content-touch{display:block;max-height:90vh;position:relative;overflow:visible}.mat-datepicker-content-touch .mat-datepicker-content-container{min-height:312px;max-height:815px;min-width:250px;max-width:750px}.mat-datepicker-content-touch .mat-calendar{width:100%;height:auto}@media all and (orientation:landscape){.mat-datepicker-content-touch .mat-datepicker-content-container{width:64vh;height:90vh}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:none}}@media all and (orientation:portrait){.mat-datepicker-content-touch{max-height:100vh}.mat-datepicker-content-touch .mat-datepicker-content-container{width:80vw;height:100vw}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:870px}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time.mat-datepicker-content-container-with-actions{max-height:none!important}.mat-datepicker-content-touch .mat-datepicker-content-container-with-actions{height:115vw}}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: NgxMatCalendar, selector: "ngx-mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["ngxMatCalendar"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgxMatTimepickerComponent, selector: "ngx-mat-timepicker", inputs: ["disabled", "showSpinners", "stepHour", "stepMinute", "stepSecond", "showSeconds", "disableMinute", "enableMeridian", "defaultTime", "color", "meridian", "value"], outputs: ["valueChange"], exportAs: ["ngxMatTimepicker"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3926
3922
|
}
|
|
3927
3923
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerContent, decorators: [{
|
|
3928
3924
|
type: Component,
|
|
@@ -3941,12 +3937,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
3941
3937
|
CdkPortalOutlet,
|
|
3942
3938
|
MatButton,
|
|
3943
3939
|
], template: "<div\n cdkTrapFocus\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-labelledby]=\"_dialogLabelId ?? undefined\"\n class=\"mat-datepicker-content-container\"\n [class.mat-datepicker-content-container-with-custom-header]=\"\n datepicker?.calendarHeaderComponent()\n \"\n [class.mat-datepicker-content-container-with-actions]=\"_actionsPortal\"\n [class.mat-datepicker-content-container-with-time]=\"!datepicker!._hideTime\"\n>\n <ngx-mat-calendar\n [id]=\"datepicker!.id\"\n [ngClass]=\"datepicker!.panelClass\"\n [startAt]=\"datepicker!.startAt\"\n [startView]=\"datepicker!.startView()\"\n [minDate]=\"datepicker!._getMinDate()\"\n [maxDate]=\"datepicker!._getMaxDate()\"\n [dateFilter]=\"datepicker!._getDateFilter()\"\n [headerComponent]=\"datepicker!.calendarHeaderComponent()\"\n [selected]=\"_getSelected()\"\n [dateClass]=\"datepicker!.dateClass()\"\n [comparisonStart]=\"comparisonStart\"\n [comparisonEnd]=\"comparisonEnd\"\n [class.calendar-fade-enter]=\"false\"\n [startDateAccessibleName]=\"startDateAccessibleName\"\n [endDateAccessibleName]=\"endDateAccessibleName\"\n (yearSelected)=\"datepicker!._selectYear($event)\"\n (monthSelected)=\"datepicker!._selectMonth($event)\"\n (viewChanged)=\"datepicker!._viewChanged($event)\"\n (_userSelection)=\"_handleUserSelection($event)\"\n (_userDragDrop)=\"_handleUserDragDrop($event)\"\n />\n\n @if (isViewMonth) {\n @if (!datepicker!._hideTime) {\n <div\n class=\"time-container\"\n [ngClass]=\"datepicker!.panelClass\"\n [class.disable-seconds]=\"!datepicker!._showSeconds\"\n >\n <ngx-mat-timepicker\n [showSpinners]=\"datepicker!._showSpinners\"\n [showSeconds]=\"datepicker!._showSeconds\"\n [disabled]=\"datepicker!._disabled || !_modelTime\"\n [stepHour]=\"datepicker!._stepHour\"\n [stepMinute]=\"datepicker!._stepMinute\"\n [stepSecond]=\"datepicker!._stepSecond\"\n [(ngModel)]=\"_modelTime\"\n [color]=\"datepicker!._color\"\n [enableMeridian]=\"datepicker!._enableMeridian\"\n [disableMinute]=\"datepicker!._disableMinute\"\n (ngModelChange)=\"onTimeChanged($event)\"\n />\n </div>\n }\n }\n\n <ng-template [cdkPortalOutlet]=\"_actionsPortal\" />\n\n <!-- Invisible close button for screen reader users. -->\n <button\n type=\"button\"\n mat-raised-button\n [color]=\"color || 'primary'\"\n class=\"mat-datepicker-close-button\"\n [class.cdk-visually-hidden]=\"!_closeButtonFocused\"\n (focus)=\"_closeButtonFocused = true\"\n (blur)=\"_closeButtonFocused = false\"\n (click)=\"datepicker?.close()\"\n >\n {{ _closeButtonText }}\n </button>\n</div>\n", styles: ["@keyframes panelDropdownEnter{0%{opacity:0;transform:scaleY(.8)}to{opacity:1;transform:scale(1)}}@keyframes panelDialogEnter{0%{opacity:0;transform:scale(.7)}to{opacity:1;transform:none}}@keyframes panelLeave{0%{opacity:1}to{opacity:0}}.panel-enter-dropdown{animation:panelDropdownEnter .12s cubic-bezier(0,0,.2,1)}.panel-enter-dialog{animation:panelDialogEnter .15s cubic-bezier(0,0,.2,1)}.panel-leave{animation:panelLeave .1s linear forwards;pointer-events:none}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.calendar-fade-enter{animation:fadeIn .12s .1s cubic-bezier(.55,0,.55,.2) forwards}\n", ".mat-datepicker-content{display:block;border-radius:var(--mat-datepicker-calendar-container-shape, var(--mat-sys-corner-large, 4px));background-color:var(--mat-datepicker-calendar-container-background-color, var(--mat-sys-surface-container-high));color:var(--mat-datepicker-calendar-container-text-color, var(--mat-sys-on-surface));box-shadow:var(--mat-datepicker-calendar-container-elevation-shadow, 0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12))}.mat-datepicker-content .mat-calendar{font-family:var(--mat-datepicker-calendar-text-font, var(--mat-sys-body-medium-font));font-size:var(--mat-datepicker-calendar-text-size, var(--mat-sys-body-medium-size));width:296px;height:354px}.mat-datepicker-content .mat-datepicker-content-container-with-custom-header .mat-calendar{height:auto}.mat-datepicker-content .mat-datepicker-close-button{position:absolute;top:100%;left:0;margin-top:8px}.ng-animating .mat-datepicker-content .mat-datepicker-close-button{display:none}.mat-datepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.time-container{display:flex;position:relative;padding-top:5px;justify-content:center}.time-container.disable-seconds .ngx-mat-timepicker .table{margin-left:9px}.time-container:before{content:\"\";position:absolute;top:0;left:0;right:0;height:1px;background-color:#0000001f}.mat-datepicker-content-touch{display:block;max-height:90vh;position:relative;overflow:visible}.mat-datepicker-content-touch .mat-datepicker-content-container{min-height:312px;max-height:815px;min-width:250px;max-width:750px}.mat-datepicker-content-touch .mat-calendar{width:100%;height:auto}@media all and (orientation:landscape){.mat-datepicker-content-touch .mat-datepicker-content-container{width:64vh;height:90vh}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:none}}@media all and (orientation:portrait){.mat-datepicker-content-touch{max-height:100vh}.mat-datepicker-content-touch .mat-datepicker-content-container{width:80vw;height:100vw}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time{height:auto;max-height:870px}.mat-datepicker-content-touch .mat-datepicker-content-container.mat-datepicker-content-container-with-time.mat-datepicker-content-container-with-actions{max-height:none!important}.mat-datepicker-content-touch .mat-datepicker-content-container-with-actions{height:115vw}}\n"] }]
|
|
3944
|
-
}], ctorParameters: () => [
|
|
3945
|
-
type: Optional
|
|
3946
|
-
}, {
|
|
3947
|
-
type: Inject,
|
|
3948
|
-
args: [NGX_MAT_DATE_RANGE_SELECTION_STRATEGY]
|
|
3949
|
-
}] }, { type: NgxMatDatepickerIntl }], propDecorators: { _calendar: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgxMatCalendar), { isSignal: true }] }], color: [{
|
|
3940
|
+
}], ctorParameters: () => [], propDecorators: { _calendar: [{ type: i0.ViewChild, args: [i0.forwardRef(() => NgxMatCalendar), { isSignal: true }] }], color: [{
|
|
3950
3941
|
type: Input
|
|
3951
3942
|
}], isPrimary: [{
|
|
3952
3943
|
type: HostBinding,
|
|
@@ -3969,13 +3960,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
3969
3960
|
}] } });
|
|
3970
3961
|
/** Base class for a datepicker. */
|
|
3971
3962
|
class NgxMatDatepickerBase {
|
|
3972
|
-
_overlay;
|
|
3973
|
-
_ngZone;
|
|
3974
|
-
_viewContainerRef;
|
|
3975
|
-
_dateAdapter;
|
|
3976
|
-
_dir;
|
|
3977
|
-
_model;
|
|
3978
|
-
_scrollStrategy;
|
|
3979
3963
|
_inputStateChanges = Subscription.EMPTY;
|
|
3980
3964
|
_document = inject(DOCUMENT);
|
|
3981
3965
|
/** An input indicating the type of the custom header component for the calendar, if set. */
|
|
@@ -3987,7 +3971,9 @@ class NgxMatDatepickerBase {
|
|
|
3987
3971
|
return this._startAt || (this.datepickerInput ? this.datepickerInput.getStartValue() : null);
|
|
3988
3972
|
}
|
|
3989
3973
|
set startAt(value) {
|
|
3990
|
-
this._startAt =
|
|
3974
|
+
this._startAt = (this._dateAdapter)
|
|
3975
|
+
? this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value))
|
|
3976
|
+
: null;
|
|
3991
3977
|
}
|
|
3992
3978
|
_startAt = null;
|
|
3993
3979
|
/** The view that the calendar should start in. */
|
|
@@ -4084,7 +4070,10 @@ class NgxMatDatepickerBase {
|
|
|
4084
4070
|
return this._opened;
|
|
4085
4071
|
}
|
|
4086
4072
|
set opened(value) {
|
|
4087
|
-
coerceBooleanProperty(value)
|
|
4073
|
+
if (coerceBooleanProperty(value))
|
|
4074
|
+
this.open();
|
|
4075
|
+
else
|
|
4076
|
+
this.close();
|
|
4088
4077
|
}
|
|
4089
4078
|
_opened = false;
|
|
4090
4079
|
/** Whether the timepicker'spinners is shown. */
|
|
@@ -4178,17 +4167,17 @@ class NgxMatDatepickerBase {
|
|
|
4178
4167
|
datepickerInput;
|
|
4179
4168
|
/** Emits when the datepicker's state changes. */
|
|
4180
4169
|
stateChanges = new Subject();
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4170
|
+
_overlay = inject(Overlay);
|
|
4171
|
+
_ngZone = inject(NgZone);
|
|
4172
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
4173
|
+
_scrollStrategy = inject(NGX_MAT_DATEPICKER_SCROLL_STRATEGY);
|
|
4174
|
+
_dateAdapter = inject((DateAdapter), { optional: true });
|
|
4175
|
+
_dir = inject(Directionality, { optional: true });
|
|
4176
|
+
_model = inject((NgxMatDateSelectionModel));
|
|
4177
|
+
constructor() {
|
|
4188
4178
|
if (!this._dateAdapter) {
|
|
4189
4179
|
throw createMissingDateImplError$1('DateAdapter');
|
|
4190
4180
|
}
|
|
4191
|
-
this._scrollStrategy = scrollStrategy;
|
|
4192
4181
|
}
|
|
4193
4182
|
ngOnChanges(changes) {
|
|
4194
4183
|
const positionChange = changes['xPosition'] || changes['yPosition'];
|
|
@@ -4348,7 +4337,7 @@ class NgxMatDatepickerBase {
|
|
|
4348
4337
|
isDialog ? 'cdk-overlay-dark-backdrop' : 'mat-overlay-transparent-backdrop',
|
|
4349
4338
|
this._backdropHarnessClass,
|
|
4350
4339
|
],
|
|
4351
|
-
direction: this._dir,
|
|
4340
|
+
direction: this._dir ?? "ltr",
|
|
4352
4341
|
scrollStrategy: isDialog ? this._overlay.scrollStrategies.block() : this._scrollStrategy(),
|
|
4353
4342
|
panelClass: `mat-datepicker-${isDialog ? 'dialog' : 'popup'}`,
|
|
4354
4343
|
})));
|
|
@@ -4447,19 +4436,12 @@ class NgxMatDatepickerBase {
|
|
|
4447
4436
|
ctrlShiftMetaModifiers.every((modifier) => !hasModifierKey(event, modifier))));
|
|
4448
4437
|
})));
|
|
4449
4438
|
}
|
|
4450
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerBase, deps: [
|
|
4439
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4451
4440
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.6", type: NgxMatDatepickerBase, isStandalone: true, inputs: { calendarHeaderComponent: { classPropertyName: "calendarHeaderComponent", publicName: "calendarHeaderComponent", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: false, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: false, isRequired: false, transformFunction: null }, touchUi: { classPropertyName: "touchUi", publicName: "touchUi", isSignal: false, isRequired: false, transformFunction: null }, hideTime: { classPropertyName: "hideTime", publicName: "hideTime", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, xPosition: { classPropertyName: "xPosition", publicName: "xPosition", isSignal: true, isRequired: false, transformFunction: null }, yPosition: { classPropertyName: "yPosition", publicName: "yPosition", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: false, isRequired: false, transformFunction: null }, dateClass: { classPropertyName: "dateClass", publicName: "dateClass", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: false, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: false, isRequired: false, transformFunction: null }, showSpinners: { classPropertyName: "showSpinners", publicName: "showSpinners", isSignal: false, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: false, isRequired: false, transformFunction: null }, stepHour: { classPropertyName: "stepHour", publicName: "stepHour", isSignal: false, isRequired: false, transformFunction: null }, stepMinute: { classPropertyName: "stepMinute", publicName: "stepMinute", isSignal: false, isRequired: false, transformFunction: null }, stepSecond: { classPropertyName: "stepSecond", publicName: "stepSecond", isSignal: false, isRequired: false, transformFunction: null }, enableMeridian: { classPropertyName: "enableMeridian", publicName: "enableMeridian", isSignal: false, isRequired: false, transformFunction: null }, disableMinute: { classPropertyName: "disableMinute", publicName: "disableMinute", isSignal: false, isRequired: false, transformFunction: null }, defaultTime: { classPropertyName: "defaultTime", publicName: "defaultTime", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected", viewChanged: "viewChanged", openedStream: "opened", closedStream: "closed" }, usesOnChanges: true, ngImport: i0 });
|
|
4452
4441
|
}
|
|
4453
4442
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerBase, decorators: [{
|
|
4454
4443
|
type: Directive
|
|
4455
|
-
}], ctorParameters: () => [
|
|
4456
|
-
type: Inject,
|
|
4457
|
-
args: [NGX_MAT_DATEPICKER_SCROLL_STRATEGY]
|
|
4458
|
-
}] }, { type: i1.DateAdapter, decorators: [{
|
|
4459
|
-
type: Optional
|
|
4460
|
-
}] }, { type: i2.Directionality, decorators: [{
|
|
4461
|
-
type: Optional
|
|
4462
|
-
}] }, { type: NgxMatDateSelectionModel }], propDecorators: { calendarHeaderComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "calendarHeaderComponent", required: false }] }], startAt: [{
|
|
4444
|
+
}], ctorParameters: () => [], propDecorators: { calendarHeaderComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "calendarHeaderComponent", required: false }] }], startAt: [{
|
|
4463
4445
|
type: Input
|
|
4464
4446
|
}], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], color: [{
|
|
4465
4447
|
type: Input
|
|
@@ -4567,15 +4549,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4567
4549
|
|
|
4568
4550
|
/** Button that will close the datepicker and assign the current selection to the data model. */
|
|
4569
4551
|
class NgxMatDatepickerApply {
|
|
4570
|
-
_datepicker;
|
|
4571
|
-
constructor(_datepicker) {
|
|
4572
|
-
this._datepicker = _datepicker;
|
|
4573
|
-
}
|
|
4552
|
+
_datepicker = inject((NgxMatDatepickerBase));
|
|
4574
4553
|
_applySelection() {
|
|
4575
4554
|
this._datepicker._applyPendingSelection();
|
|
4576
4555
|
this._datepicker.close();
|
|
4577
4556
|
}
|
|
4578
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerApply, deps: [
|
|
4557
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerApply, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4579
4558
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDatepickerApply, isStandalone: true, selector: "[ngxMatDatepickerApply], [ngxMatDateRangePickerApply]", host: { listeners: { "click": "_applySelection()" } }, ngImport: i0 });
|
|
4580
4559
|
}
|
|
4581
4560
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerApply, decorators: [{
|
|
@@ -4584,12 +4563,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4584
4563
|
selector: '[ngxMatDatepickerApply], [ngxMatDateRangePickerApply]',
|
|
4585
4564
|
host: { '(click)': '_applySelection()' },
|
|
4586
4565
|
}]
|
|
4587
|
-
}]
|
|
4566
|
+
}] });
|
|
4588
4567
|
class NgxMatDatepickerClear {
|
|
4589
|
-
_datepicker;
|
|
4590
|
-
constructor(_datepicker) {
|
|
4591
|
-
this._datepicker = _datepicker;
|
|
4592
|
-
}
|
|
4568
|
+
_datepicker = inject((NgxMatDatepickerBase));
|
|
4593
4569
|
close = false;
|
|
4594
4570
|
_clearSelection() {
|
|
4595
4571
|
this._datepicker._clearSelection();
|
|
@@ -4597,7 +4573,7 @@ class NgxMatDatepickerClear {
|
|
|
4597
4573
|
this._datepicker.close();
|
|
4598
4574
|
}
|
|
4599
4575
|
}
|
|
4600
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerClear, deps: [
|
|
4576
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerClear, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4601
4577
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.2.6", type: NgxMatDatepickerClear, isStandalone: true, selector: "[ngxMatDatepickerClear], [ngxMatDateRangePickerClear]", inputs: { close: ["close", "close", booleanAttribute] }, host: { listeners: { "click": "_clearSelection()" } }, ngImport: i0 });
|
|
4602
4578
|
}
|
|
4603
4579
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerClear, decorators: [{
|
|
@@ -4606,7 +4582,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4606
4582
|
selector: '[ngxMatDatepickerClear], [ngxMatDateRangePickerClear]',
|
|
4607
4583
|
host: { '(click)': '_clearSelection()' },
|
|
4608
4584
|
}]
|
|
4609
|
-
}],
|
|
4585
|
+
}], propDecorators: { close: [{
|
|
4610
4586
|
type: Input,
|
|
4611
4587
|
args: [{
|
|
4612
4588
|
transform: booleanAttribute,
|
|
@@ -4614,11 +4590,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4614
4590
|
}] } });
|
|
4615
4591
|
/** Button that will close the datepicker and discard the current selection. */
|
|
4616
4592
|
class NgxMatDatepickerCancel {
|
|
4617
|
-
_datepicker;
|
|
4618
|
-
|
|
4619
|
-
this._datepicker = _datepicker;
|
|
4620
|
-
}
|
|
4621
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerCancel, deps: [{ token: NgxMatDatepickerBase }], target: i0.ɵɵFactoryTarget.Directive });
|
|
4593
|
+
_datepicker = inject((NgxMatDatepickerBase));
|
|
4594
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerCancel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4622
4595
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDatepickerCancel, isStandalone: true, selector: "[ngxMatDatepickerCancel], [ngxMatDateRangePickerCancel]", host: { listeners: { "click": "_datepicker.close()" } }, ngImport: i0 });
|
|
4623
4596
|
}
|
|
4624
4597
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerCancel, decorators: [{
|
|
@@ -4627,20 +4600,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4627
4600
|
selector: '[ngxMatDatepickerCancel], [ngxMatDateRangePickerCancel]',
|
|
4628
4601
|
host: { '(click)': '_datepicker.close()' },
|
|
4629
4602
|
}]
|
|
4630
|
-
}]
|
|
4603
|
+
}] });
|
|
4631
4604
|
/**
|
|
4632
4605
|
* Container that can be used to project a row of action buttons
|
|
4633
4606
|
* to the bottom of a datepicker or date range picker.
|
|
4634
4607
|
*/
|
|
4635
4608
|
class NgxMatDatepickerActions {
|
|
4636
|
-
_datepicker;
|
|
4637
|
-
_viewContainerRef;
|
|
4638
4609
|
_template = viewChild(TemplateRef, ...(ngDevMode ? [{ debugName: "_template" }] : /* istanbul ignore next */ []));
|
|
4639
4610
|
_portal = null;
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
this._viewContainerRef = _viewContainerRef;
|
|
4643
|
-
}
|
|
4611
|
+
_datepicker = inject((NgxMatDatepickerBase));
|
|
4612
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
4644
4613
|
ngAfterViewInit() {
|
|
4645
4614
|
this._portal = new TemplatePortal(this._template(), this._viewContainerRef);
|
|
4646
4615
|
this._datepicker.registerActions(this._portal);
|
|
@@ -4652,7 +4621,7 @@ class NgxMatDatepickerActions {
|
|
|
4652
4621
|
this._portal?.detach();
|
|
4653
4622
|
}
|
|
4654
4623
|
}
|
|
4655
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerActions, deps: [
|
|
4624
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4656
4625
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.6", type: NgxMatDatepickerActions, isStandalone: true, selector: "ngx-mat-datepicker-actions, ngx-mat-date-range-picker-actions", viewQueries: [{ propertyName: "_template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
4657
4626
|
<ng-template>
|
|
4658
4627
|
<div class="mat-datepicker-actions">
|
|
@@ -4670,7 +4639,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4670
4639
|
</div>
|
|
4671
4640
|
</ng-template>
|
|
4672
4641
|
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, styles: [".mat-datepicker-actions{display:flex;justify-content:flex-end;align-items:center;padding:8px}.mat-datepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-datepicker-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"] }]
|
|
4673
|
-
}],
|
|
4642
|
+
}], propDecorators: { _template: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
4674
4643
|
|
|
4675
4644
|
/** @docs-private */
|
|
4676
4645
|
const NGX_MAT_DATEPICKER_VALUE_ACCESSOR = {
|
|
@@ -4686,7 +4655,6 @@ const NGX_MAT_DATEPICKER_VALIDATORS = {
|
|
|
4686
4655
|
};
|
|
4687
4656
|
/** Directive used to connect an input to a MatDatepicker. */
|
|
4688
4657
|
class NgxMatDatepickerInput extends NgxMatDatepickerInputBase {
|
|
4689
|
-
_formField;
|
|
4690
4658
|
_closedSubscription = Subscription.EMPTY;
|
|
4691
4659
|
/** The datepicker that this input is associated with. */
|
|
4692
4660
|
set ngxMatDatetimePicker(datepicker) {
|
|
@@ -4702,6 +4670,10 @@ class NgxMatDatepickerInput extends NgxMatDatepickerInputBase {
|
|
|
4702
4670
|
return this._min;
|
|
4703
4671
|
}
|
|
4704
4672
|
set min(value) {
|
|
4673
|
+
if (!this._dateAdapter) {
|
|
4674
|
+
this._min = null;
|
|
4675
|
+
return;
|
|
4676
|
+
}
|
|
4705
4677
|
const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
4706
4678
|
if (!this._dateAdapter.sameDate(validValue, this._min)) {
|
|
4707
4679
|
this._min = validValue;
|
|
@@ -4714,6 +4686,10 @@ class NgxMatDatepickerInput extends NgxMatDatepickerInputBase {
|
|
|
4714
4686
|
return this._max;
|
|
4715
4687
|
}
|
|
4716
4688
|
set max(value) {
|
|
4689
|
+
if (!this._dateAdapter) {
|
|
4690
|
+
this._max = null;
|
|
4691
|
+
return;
|
|
4692
|
+
}
|
|
4717
4693
|
const validValue = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
|
4718
4694
|
if (!this._dateAdapter.sameDate(validValue, this._max)) {
|
|
4719
4695
|
this._max = validValue;
|
|
@@ -4735,9 +4711,9 @@ class NgxMatDatepickerInput extends NgxMatDatepickerInputBase {
|
|
|
4735
4711
|
_dateFilter = null;
|
|
4736
4712
|
/** The combined form control validator for this input. */
|
|
4737
4713
|
_validator;
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4714
|
+
_formField = inject(MAT_FORM_FIELD, { optional: true });
|
|
4715
|
+
constructor() {
|
|
4716
|
+
super();
|
|
4741
4717
|
this._validator = Validators.compose(super._getValidators());
|
|
4742
4718
|
}
|
|
4743
4719
|
/**
|
|
@@ -4795,8 +4771,8 @@ class NgxMatDatepickerInput extends NgxMatDatepickerInputBase {
|
|
|
4795
4771
|
_shouldHandleChangeEvent(event) {
|
|
4796
4772
|
return event.source !== this;
|
|
4797
4773
|
}
|
|
4798
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerInput, deps: [
|
|
4799
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDatepickerInput, isStandalone: true, selector: "input[ngxMatDatetimePicker]", inputs: { ngxMatDatetimePicker: "ngxMatDatetimePicker", min: "min", max: "max", dateFilter: ["matDatepickerFilter", "dateFilter"] }, host: { listeners: { "input": "_onInput($event)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_datepicker ? \"dialog\" : null", "attr.aria-owns": "(_datepicker?.opened && _datepicker?.id) || null", "attr.min": "min ? _dateAdapter.toIso8601(min) : null", "attr.max": "max ? _dateAdapter.toIso8601(max) : null", "attr.data-mat-calendar": "_datepicker ? _datepicker.id : null", "disabled": "disabled" }, classAttribute: "mat-datepicker-input" }, providers: [
|
|
4774
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4775
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxMatDatepickerInput, isStandalone: true, selector: "input[ngxMatDatetimePicker]", inputs: { ngxMatDatetimePicker: "ngxMatDatetimePicker", min: "min", max: "max", dateFilter: ["matDatepickerFilter", "dateFilter"] }, host: { listeners: { "input": "_onInput($event)", "change": "_onChange()", "blur": "_onBlur()", "keydown": "_onKeydown($event)" }, properties: { "attr.aria-haspopup": "_datepicker ? \"dialog\" : null", "attr.aria-owns": "(_datepicker?.opened && _datepicker?.id) || null", "attr.min": "_dateAdapter && min ? _dateAdapter.toIso8601(min) : null", "attr.max": "_dateAdapter && max ? _dateAdapter.toIso8601(max) : null", "attr.data-mat-calendar": "_datepicker ? _datepicker.id : null", "disabled": "disabled" }, classAttribute: "mat-datepicker-input" }, providers: [
|
|
4800
4776
|
NGX_MAT_DATEPICKER_VALUE_ACCESSOR,
|
|
4801
4777
|
NGX_MAT_DATEPICKER_VALIDATORS,
|
|
4802
4778
|
{ provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: NgxMatDatepickerInput },
|
|
@@ -4815,8 +4791,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4815
4791
|
class: 'mat-datepicker-input',
|
|
4816
4792
|
'[attr.aria-haspopup]': '_datepicker ? "dialog" : null',
|
|
4817
4793
|
'[attr.aria-owns]': '(_datepicker?.opened && _datepicker?.id) || null',
|
|
4818
|
-
'[attr.min]': 'min ? _dateAdapter.toIso8601(min) : null',
|
|
4819
|
-
'[attr.max]': 'max ? _dateAdapter.toIso8601(max) : null',
|
|
4794
|
+
'[attr.min]': '_dateAdapter && min ? _dateAdapter.toIso8601(min) : null',
|
|
4795
|
+
'[attr.max]': '_dateAdapter && max ? _dateAdapter.toIso8601(max) : null',
|
|
4820
4796
|
// Used by the test harness to tie this input to its calendar. We can't depend on
|
|
4821
4797
|
// `aria-owns` for this, because it's only defined while the calendar is open.
|
|
4822
4798
|
'[attr.data-mat-calendar]': '_datepicker ? _datepicker.id : null',
|
|
@@ -4828,19 +4804,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4828
4804
|
},
|
|
4829
4805
|
exportAs: 'ngxMatDatepickerInput',
|
|
4830
4806
|
}]
|
|
4831
|
-
}], ctorParameters: () => [
|
|
4832
|
-
type: Optional
|
|
4833
|
-
}] }, { type: undefined, decorators: [{
|
|
4834
|
-
type: Optional
|
|
4835
|
-
}, {
|
|
4836
|
-
type: Inject,
|
|
4837
|
-
args: [MAT_DATE_FORMATS]
|
|
4838
|
-
}] }, { type: undefined, decorators: [{
|
|
4839
|
-
type: Optional
|
|
4840
|
-
}, {
|
|
4841
|
-
type: Inject,
|
|
4842
|
-
args: [MAT_FORM_FIELD]
|
|
4843
|
-
}] }], propDecorators: { ngxMatDatetimePicker: [{
|
|
4807
|
+
}], ctorParameters: () => [], propDecorators: { ngxMatDatetimePicker: [{
|
|
4844
4808
|
type: Input
|
|
4845
4809
|
}], min: [{
|
|
4846
4810
|
type: Input
|
|
@@ -4863,8 +4827,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4863
4827
|
}]
|
|
4864
4828
|
}] });
|
|
4865
4829
|
class NgxMatDatepickerToggle {
|
|
4866
|
-
_intl;
|
|
4867
|
-
_changeDetectorRef;
|
|
4868
4830
|
_stateChanges = Subscription.EMPTY;
|
|
4869
4831
|
/** Datepicker instance that the button will toggle. */
|
|
4870
4832
|
datepicker = input(undefined, { ...(ngDevMode ? { debugName: "datepicker" } : /* istanbul ignore next */ {}), alias: 'for' });
|
|
@@ -4887,9 +4849,9 @@ class NgxMatDatepickerToggle {
|
|
|
4887
4849
|
disableRipple = input(...(ngDevMode ? [undefined, { debugName: "disableRipple" }] : /* istanbul ignore next */ []));
|
|
4888
4850
|
/** Underlying button element. */
|
|
4889
4851
|
_button = viewChild('button', ...(ngDevMode ? [{ debugName: "_button" }] : /* istanbul ignore next */ []));
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4852
|
+
_intl = inject(NgxMatDatepickerIntl);
|
|
4853
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
4854
|
+
constructor(defaultTabIndex) {
|
|
4893
4855
|
const parsedTabIndex = Number(defaultTabIndex);
|
|
4894
4856
|
this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
|
|
4895
4857
|
effect(() => {
|
|
@@ -4922,7 +4884,7 @@ class NgxMatDatepickerToggle {
|
|
|
4922
4884
|
this._stateChanges.unsubscribe();
|
|
4923
4885
|
this._stateChanges = merge(this._intl.changes, datepickerStateChanged, inputStateChanged, datepickerToggled).subscribe(() => this._changeDetectorRef.markForCheck());
|
|
4924
4886
|
}
|
|
4925
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerToggle, deps: [{ token:
|
|
4887
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerToggle, deps: [{ token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
4926
4888
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.6", type: NgxMatDatepickerToggle, isStandalone: true, selector: "ngx-mat-datepicker-toggle", inputs: { datepicker: { classPropertyName: "datepicker", publicName: "for", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: false, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null", "class.mat-datepicker-toggle-active": "datepicker()?.opened", "class.mat-accent": "datepicker()?.color === \"accent\"", "class.mat-warn": "datepicker()?.color === \"warn\"", "attr.data-mat-calendar": "datepicker()?.id" }, classAttribute: "mat-datepicker-toggle" }, viewQueries: [{ propertyName: "_button", first: true, predicate: ["button"], descendants: true, isSignal: true }], exportAs: ["ngxMatDatepickerToggle"], ngImport: i0, template: "<button\n #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datepicker() ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel() || _intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple()\"\n>\n <ng-content select=\"[ngxMatDatepickerToggleIcon]\">\n <svg\n class=\"mat-datepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\"\n >\n <path\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\"\n />\n </svg>\n </ng-content>\n</button>\n", styles: [".mat-datepicker-toggle{pointer-events:auto;color:var(--mat-datepicker-toggle-icon-color, var(--mat-sys-on-surface-variant))}@media(forced-colors:active){.mat-datepicker-toggle-default-icon{color:CanvasText}}\n"], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4927
4889
|
}
|
|
4928
4890
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatepickerToggle, decorators: [{
|
|
@@ -4940,7 +4902,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImpor
|
|
|
4940
4902
|
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
4941
4903
|
'(click)': '_open($event)',
|
|
4942
4904
|
}, exportAs: 'ngxMatDatepickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIconButton], template: "<button\n #button\n mat-icon-button\n type=\"button\"\n [attr.aria-haspopup]=\"datepicker() ? 'dialog' : null\"\n [attr.aria-label]=\"ariaLabel() || _intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n [disableRipple]=\"disableRipple()\"\n>\n <ng-content select=\"[ngxMatDatepickerToggleIcon]\">\n <svg\n class=\"mat-datepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\"\n >\n <path\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\"\n />\n </svg>\n </ng-content>\n</button>\n", styles: [".mat-datepicker-toggle{pointer-events:auto;color:var(--mat-datepicker-toggle-icon-color, var(--mat-sys-on-surface-variant))}@media(forced-colors:active){.mat-datepicker-toggle-default-icon{color:CanvasText}}\n"] }]
|
|
4943
|
-
}], ctorParameters: () => [{ type:
|
|
4905
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
4944
4906
|
type: Attribute,
|
|
4945
4907
|
args: ['tabindex']
|
|
4946
4908
|
}] }], propDecorators: { datepicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "for", required: false }] }], tabIndex: [{
|
|
@@ -5010,10 +4972,10 @@ class NgxMatDatetimePickerContentV2 {
|
|
|
5010
4972
|
this.selectedDateTime.set(null);
|
|
5011
4973
|
}
|
|
5012
4974
|
}
|
|
5013
|
-
onYearSelected(
|
|
4975
|
+
onYearSelected(_) {
|
|
5014
4976
|
// Let the calendar handle year selection
|
|
5015
4977
|
}
|
|
5016
|
-
onMonthSelected(
|
|
4978
|
+
onMonthSelected(_) {
|
|
5017
4979
|
// Let the calendar handle month selection
|
|
5018
4980
|
}
|
|
5019
4981
|
onTimeChanged(time) {
|
|
@@ -5125,7 +5087,7 @@ class NgxMatDatetimePickerContentV2 {
|
|
|
5125
5087
|
</button>
|
|
5126
5088
|
</div>
|
|
5127
5089
|
</div>
|
|
5128
|
-
`, isInline: true, styles: [".ngx-mat-datetime-picker-content-v2{display:flex;flex-direction:column;max-height:90vh;min-width:296px}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-content{display:flex;flex-direction:column}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-time{padding:16px;border-top:1px solid rgba(0,0,0,.12)}.mat-dark .ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-time{border-top-color:#ffffff1f}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-actions{display:flex;justify-content:flex-end;gap:8px;padding:8px 16px 16px;border-top:1px solid rgba(0,0,0,.12)}.mat-dark .ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-actions{border-top-color:#ffffff1f}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch{min-width:320px}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch .ngx-mat-datetime-picker-time{padding:24px}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch .ngx-mat-datetime-picker-actions{padding:16px 24px 24px}.ngx-mat-datetime-picker-content-v2 mat-calendar{display:block}.ngx-mat-datetime-picker-content-v2 mat-calendar .mat-calendar-header{padding:8px 8px 0}.ngx-mat-datetime-picker-content-v2 mat-calendar .mat-calendar-content{padding:0 8px 8px}.ngx-mat-datetime-picker-content-v2 ngx-mat-timepicker{width:100%;display:flex;justify-content:center;align-items:center}.ngx-mat-datetime-picker-content-v2 ngx-mat-timepicker .ngx-mat-timepicker-container{justify-content:center}.ngx-mat-datetime-picker-content-enter{opacity:0;transform:scale(.9);transition:opacity .15s cubic-bezier(.25,.8,.25,1),transform .15s cubic-bezier(.25,.8,.25,1)}.ngx-mat-datetime-picker-content-enter-active{opacity:1;transform:scale(1)}.ngx-mat-datetime-picker-content-exit{opacity:1;transform:scale(1);transition:opacity .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1)}.ngx-mat-datetime-picker-content-exit-active{opacity:0;transform:scale(.9)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type:
|
|
5090
|
+
`, isInline: true, styles: [".ngx-mat-datetime-picker-content-v2{display:flex;flex-direction:column;max-height:90vh;min-width:296px}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-content{display:flex;flex-direction:column}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-time{padding:16px;border-top:1px solid rgba(0,0,0,.12)}.mat-dark .ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-time{border-top-color:#ffffff1f}.ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-actions{display:flex;justify-content:flex-end;gap:8px;padding:8px 16px 16px;border-top:1px solid rgba(0,0,0,.12)}.mat-dark .ngx-mat-datetime-picker-content-v2 .ngx-mat-datetime-picker-actions{border-top-color:#ffffff1f}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch{min-width:320px}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch .ngx-mat-datetime-picker-time{padding:24px}.ngx-mat-datetime-picker-content-v2.ngx-mat-datetime-picker-content-touch .ngx-mat-datetime-picker-actions{padding:16px 24px 24px}.ngx-mat-datetime-picker-content-v2 mat-calendar{display:block}.ngx-mat-datetime-picker-content-v2 mat-calendar .mat-calendar-header{padding:8px 8px 0}.ngx-mat-datetime-picker-content-v2 mat-calendar .mat-calendar-content{padding:0 8px 8px}.ngx-mat-datetime-picker-content-v2 ngx-mat-timepicker{width:100%;display:flex;justify-content:center;align-items:center}.ngx-mat-datetime-picker-content-v2 ngx-mat-timepicker .ngx-mat-timepicker-container{justify-content:center}.ngx-mat-datetime-picker-content-enter{opacity:0;transform:scale(.9);transition:opacity .15s cubic-bezier(.25,.8,.25,1),transform .15s cubic-bezier(.25,.8,.25,1)}.ngx-mat-datetime-picker-content-enter-active{opacity:1;transform:scale(1)}.ngx-mat-datetime-picker-content-exit{opacity:1;transform:scale(1);transition:opacity .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1)}.ngx-mat-datetime-picker-content-exit-active{opacity:0;transform:scale(.9)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: NgxMatTimepickerComponent, selector: "ngx-mat-timepicker", inputs: ["disabled", "showSpinners", "stepHour", "stepMinute", "stepSecond", "showSeconds", "disableMinute", "enableMeridian", "defaultTime", "color", "meridian", "value"], outputs: ["valueChange"], exportAs: ["ngxMatTimepicker"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5129
5091
|
}
|
|
5130
5092
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxMatDatetimePickerContentV2, decorators: [{
|
|
5131
5093
|
type: Component,
|
|
@@ -5272,9 +5234,15 @@ class NgxMatDatetimePickerInputV2 {
|
|
|
5272
5234
|
dateInput = new EventEmitter();
|
|
5273
5235
|
/** Emits when the internal state has changed */
|
|
5274
5236
|
stateChanges = new Subject();
|
|
5275
|
-
_onTouched = () => {
|
|
5276
|
-
|
|
5277
|
-
|
|
5237
|
+
_onTouched = () => {
|
|
5238
|
+
// Intentionally left empty.
|
|
5239
|
+
};
|
|
5240
|
+
_validatorOnChange = () => {
|
|
5241
|
+
// Intentionally left empty.
|
|
5242
|
+
};
|
|
5243
|
+
_cvaOnChange = () => {
|
|
5244
|
+
// Intentionally left empty.
|
|
5245
|
+
};
|
|
5278
5246
|
_valueChangesSubscription = Subscription.EMPTY;
|
|
5279
5247
|
_localeSubscription = Subscription.EMPTY;
|
|
5280
5248
|
/** The form control validator for whether the input parses. */
|
|
@@ -5408,7 +5376,7 @@ class NgxMatDatetimePickerInputV2 {
|
|
|
5408
5376
|
_onInput(event) {
|
|
5409
5377
|
const target = event?.target;
|
|
5410
5378
|
const parsedDate = this._dateAdapter?.parse(target.value, this._dateFormats.display.dateInput);
|
|
5411
|
-
this._lastValueValid = this._dateAdapter
|
|
5379
|
+
this._lastValueValid = this._dateAdapter ? this._dateAdapter.isValid(parsedDate) : false;
|
|
5412
5380
|
const date = this._dateAdapter?.getValidDateOrNull(parsedDate);
|
|
5413
5381
|
// Update internal value
|
|
5414
5382
|
this._value.set(date);
|
|
@@ -5429,7 +5397,7 @@ class NgxMatDatetimePickerInputV2 {
|
|
|
5429
5397
|
this._onTouched();
|
|
5430
5398
|
this.stateChanges.next();
|
|
5431
5399
|
}
|
|
5432
|
-
_onClick(
|
|
5400
|
+
_onClick(_) {
|
|
5433
5401
|
// Open the datepicker when clicking on the input
|
|
5434
5402
|
if (this.ngxMatDatetimePicker && !this.disabled) {
|
|
5435
5403
|
this.ngxMatDatetimePicker.open();
|
|
@@ -5477,7 +5445,7 @@ class NgxMatDatetimePickerInputV2 {
|
|
|
5477
5445
|
return !filter || !value || filter(value);
|
|
5478
5446
|
}
|
|
5479
5447
|
// MatFormFieldControl methods
|
|
5480
|
-
setDescribedByIds(
|
|
5448
|
+
setDescribedByIds(_) {
|
|
5481
5449
|
// Implementation for accessibility
|
|
5482
5450
|
}
|
|
5483
5451
|
onContainerClick() {
|
|
@@ -5647,7 +5615,7 @@ class NgxMatDatetimePickerV2 {
|
|
|
5647
5615
|
this.closedStream.emit();
|
|
5648
5616
|
}
|
|
5649
5617
|
/** Applies the current pending selection on the overlay to the model. */
|
|
5650
|
-
select(
|
|
5618
|
+
select(_) {
|
|
5651
5619
|
// This will be handled by the content component
|
|
5652
5620
|
}
|
|
5653
5621
|
/** Get the minimum date from the input. */
|