[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation, NgZone, } from '@angular/core';
|
---|
| 9 | import { take } from 'rxjs/operators';
|
---|
| 10 | /**
|
---|
| 11 | * An internal class that represents the data corresponding to a single calendar cell.
|
---|
| 12 | * @docs-private
|
---|
| 13 | */
|
---|
| 14 | export class MatCalendarCell {
|
---|
| 15 | constructor(value, displayValue, ariaLabel, enabled, cssClasses = {}, compareValue = value, rawValue) {
|
---|
| 16 | this.value = value;
|
---|
| 17 | this.displayValue = displayValue;
|
---|
| 18 | this.ariaLabel = ariaLabel;
|
---|
| 19 | this.enabled = enabled;
|
---|
| 20 | this.cssClasses = cssClasses;
|
---|
| 21 | this.compareValue = compareValue;
|
---|
| 22 | this.rawValue = rawValue;
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
| 25 | /**
|
---|
| 26 | * An internal component used to display calendar data in a table.
|
---|
| 27 | * @docs-private
|
---|
| 28 | */
|
---|
| 29 | export class MatCalendarBody {
|
---|
| 30 | constructor(_elementRef, _ngZone) {
|
---|
| 31 | this._elementRef = _elementRef;
|
---|
| 32 | this._ngZone = _ngZone;
|
---|
| 33 | /** The number of columns in the table. */
|
---|
| 34 | this.numCols = 7;
|
---|
| 35 | /** The cell number of the active cell in the table. */
|
---|
| 36 | this.activeCell = 0;
|
---|
| 37 | /** Whether a range is being selected. */
|
---|
| 38 | this.isRange = false;
|
---|
| 39 | /**
|
---|
| 40 | * The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be
|
---|
| 41 | * maintained even as the table resizes.
|
---|
| 42 | */
|
---|
| 43 | this.cellAspectRatio = 1;
|
---|
| 44 | /** Start of the preview range. */
|
---|
| 45 | this.previewStart = null;
|
---|
| 46 | /** End of the preview range. */
|
---|
| 47 | this.previewEnd = null;
|
---|
| 48 | /** Emits when a new value is selected. */
|
---|
| 49 | this.selectedValueChange = new EventEmitter();
|
---|
| 50 | /** Emits when the preview has changed as a result of a user action. */
|
---|
| 51 | this.previewChange = new EventEmitter();
|
---|
| 52 | /**
|
---|
| 53 | * Event handler for when the user enters an element
|
---|
| 54 | * inside the calendar body (e.g. by hovering in or focus).
|
---|
| 55 | */
|
---|
| 56 | this._enterHandler = (event) => {
|
---|
| 57 | if (this._skipNextFocus && event.type === 'focus') {
|
---|
| 58 | this._skipNextFocus = false;
|
---|
| 59 | return;
|
---|
| 60 | }
|
---|
| 61 | // We only need to hit the zone when we're selecting a range.
|
---|
| 62 | if (event.target && this.isRange) {
|
---|
| 63 | const cell = this._getCellFromElement(event.target);
|
---|
| 64 | if (cell) {
|
---|
| 65 | this._ngZone.run(() => this.previewChange.emit({ value: cell.enabled ? cell : null, event }));
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | };
|
---|
| 69 | /**
|
---|
| 70 | * Event handler for when the user's pointer leaves an element
|
---|
| 71 | * inside the calendar body (e.g. by hovering out or blurring).
|
---|
| 72 | */
|
---|
| 73 | this._leaveHandler = (event) => {
|
---|
| 74 | // We only need to hit the zone when we're selecting a range.
|
---|
| 75 | if (this.previewEnd !== null && this.isRange) {
|
---|
| 76 | // Only reset the preview end value when leaving cells. This looks better, because
|
---|
| 77 | // we have a gap between the cells and the rows and we don't want to remove the
|
---|
| 78 | // range just for it to show up again when the user moves a few pixels to the side.
|
---|
| 79 | if (event.target && isTableCell(event.target)) {
|
---|
| 80 | this._ngZone.run(() => this.previewChange.emit({ value: null, event }));
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 | };
|
---|
| 84 | _ngZone.runOutsideAngular(() => {
|
---|
| 85 | const element = _elementRef.nativeElement;
|
---|
| 86 | element.addEventListener('mouseenter', this._enterHandler, true);
|
---|
| 87 | element.addEventListener('focus', this._enterHandler, true);
|
---|
| 88 | element.addEventListener('mouseleave', this._leaveHandler, true);
|
---|
| 89 | element.addEventListener('blur', this._leaveHandler, true);
|
---|
| 90 | });
|
---|
| 91 | }
|
---|
| 92 | /** Called when a cell is clicked. */
|
---|
| 93 | _cellClicked(cell, event) {
|
---|
| 94 | if (cell.enabled) {
|
---|
| 95 | this.selectedValueChange.emit({ value: cell.value, event });
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | /** Returns whether a cell should be marked as selected. */
|
---|
| 99 | _isSelected(value) {
|
---|
| 100 | return this.startValue === value || this.endValue === value;
|
---|
| 101 | }
|
---|
| 102 | ngOnChanges(changes) {
|
---|
| 103 | const columnChanges = changes['numCols'];
|
---|
| 104 | const { rows, numCols } = this;
|
---|
| 105 | if (changes['rows'] || columnChanges) {
|
---|
| 106 | this._firstRowOffset = rows && rows.length && rows[0].length ? numCols - rows[0].length : 0;
|
---|
| 107 | }
|
---|
| 108 | if (changes['cellAspectRatio'] || columnChanges || !this._cellPadding) {
|
---|
| 109 | this._cellPadding = `${50 * this.cellAspectRatio / numCols}%`;
|
---|
| 110 | }
|
---|
| 111 | if (columnChanges || !this._cellWidth) {
|
---|
| 112 | this._cellWidth = `${100 / numCols}%`;
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 | ngOnDestroy() {
|
---|
| 116 | const element = this._elementRef.nativeElement;
|
---|
| 117 | element.removeEventListener('mouseenter', this._enterHandler, true);
|
---|
| 118 | element.removeEventListener('focus', this._enterHandler, true);
|
---|
| 119 | element.removeEventListener('mouseleave', this._leaveHandler, true);
|
---|
| 120 | element.removeEventListener('blur', this._leaveHandler, true);
|
---|
| 121 | }
|
---|
| 122 | /** Returns whether a cell is active. */
|
---|
| 123 | _isActiveCell(rowIndex, colIndex) {
|
---|
| 124 | let cellNumber = rowIndex * this.numCols + colIndex;
|
---|
| 125 | // Account for the fact that the first row may not have as many cells.
|
---|
| 126 | if (rowIndex) {
|
---|
| 127 | cellNumber -= this._firstRowOffset;
|
---|
| 128 | }
|
---|
| 129 | return cellNumber == this.activeCell;
|
---|
| 130 | }
|
---|
| 131 | /** Focuses the active cell after the microtask queue is empty. */
|
---|
| 132 | _focusActiveCell(movePreview = true) {
|
---|
| 133 | this._ngZone.runOutsideAngular(() => {
|
---|
| 134 | this._ngZone.onStable.pipe(take(1)).subscribe(() => {
|
---|
| 135 | const activeCell = this._elementRef.nativeElement.querySelector('.mat-calendar-body-active');
|
---|
| 136 | if (activeCell) {
|
---|
| 137 | if (!movePreview) {
|
---|
| 138 | this._skipNextFocus = true;
|
---|
| 139 | }
|
---|
| 140 | activeCell.focus();
|
---|
| 141 | }
|
---|
| 142 | });
|
---|
| 143 | });
|
---|
| 144 | }
|
---|
| 145 | /** Gets whether a value is the start of the main range. */
|
---|
| 146 | _isRangeStart(value) {
|
---|
| 147 | return isStart(value, this.startValue, this.endValue);
|
---|
| 148 | }
|
---|
| 149 | /** Gets whether a value is the end of the main range. */
|
---|
| 150 | _isRangeEnd(value) {
|
---|
| 151 | return isEnd(value, this.startValue, this.endValue);
|
---|
| 152 | }
|
---|
| 153 | /** Gets whether a value is within the currently-selected range. */
|
---|
| 154 | _isInRange(value) {
|
---|
| 155 | return isInRange(value, this.startValue, this.endValue, this.isRange);
|
---|
| 156 | }
|
---|
| 157 | /** Gets whether a value is the start of the comparison range. */
|
---|
| 158 | _isComparisonStart(value) {
|
---|
| 159 | return isStart(value, this.comparisonStart, this.comparisonEnd);
|
---|
| 160 | }
|
---|
| 161 | /** Whether the cell is a start bridge cell between the main and comparison ranges. */
|
---|
| 162 | _isComparisonBridgeStart(value, rowIndex, colIndex) {
|
---|
| 163 | if (!this._isComparisonStart(value) || this._isRangeStart(value) || !this._isInRange(value)) {
|
---|
| 164 | return false;
|
---|
| 165 | }
|
---|
| 166 | let previousCell = this.rows[rowIndex][colIndex - 1];
|
---|
| 167 | if (!previousCell) {
|
---|
| 168 | const previousRow = this.rows[rowIndex - 1];
|
---|
| 169 | previousCell = previousRow && previousRow[previousRow.length - 1];
|
---|
| 170 | }
|
---|
| 171 | return previousCell && !this._isRangeEnd(previousCell.compareValue);
|
---|
| 172 | }
|
---|
| 173 | /** Whether the cell is an end bridge cell between the main and comparison ranges. */
|
---|
| 174 | _isComparisonBridgeEnd(value, rowIndex, colIndex) {
|
---|
| 175 | if (!this._isComparisonEnd(value) || this._isRangeEnd(value) || !this._isInRange(value)) {
|
---|
| 176 | return false;
|
---|
| 177 | }
|
---|
| 178 | let nextCell = this.rows[rowIndex][colIndex + 1];
|
---|
| 179 | if (!nextCell) {
|
---|
| 180 | const nextRow = this.rows[rowIndex + 1];
|
---|
| 181 | nextCell = nextRow && nextRow[0];
|
---|
| 182 | }
|
---|
| 183 | return nextCell && !this._isRangeStart(nextCell.compareValue);
|
---|
| 184 | }
|
---|
| 185 | /** Gets whether a value is the end of the comparison range. */
|
---|
| 186 | _isComparisonEnd(value) {
|
---|
| 187 | return isEnd(value, this.comparisonStart, this.comparisonEnd);
|
---|
| 188 | }
|
---|
| 189 | /** Gets whether a value is within the current comparison range. */
|
---|
| 190 | _isInComparisonRange(value) {
|
---|
| 191 | return isInRange(value, this.comparisonStart, this.comparisonEnd, this.isRange);
|
---|
| 192 | }
|
---|
| 193 | /**
|
---|
| 194 | * Gets whether a value is the same as the start and end of the comparison range.
|
---|
| 195 | * For context, the functions that we use to determine whether something is the start/end of
|
---|
| 196 | * a range don't allow for the start and end to be on the same day, because we'd have to use
|
---|
| 197 | * much more specific CSS selectors to style them correctly in all scenarios. This is fine for
|
---|
| 198 | * the regular range, because when it happens, the selected styles take over and still show where
|
---|
| 199 | * the range would've been, however we don't have these selected styles for a comparison range.
|
---|
| 200 | * This function is used to apply a class that serves the same purpose as the one for selected
|
---|
| 201 | * dates, but it only applies in the context of a comparison range.
|
---|
| 202 | */
|
---|
| 203 | _isComparisonIdentical(value) {
|
---|
| 204 | // Note that we don't need to null check the start/end
|
---|
| 205 | // here, because the `value` will always be defined.
|
---|
| 206 | return this.comparisonStart === this.comparisonEnd && value === this.comparisonStart;
|
---|
| 207 | }
|
---|
| 208 | /** Gets whether a value is the start of the preview range. */
|
---|
| 209 | _isPreviewStart(value) {
|
---|
| 210 | return isStart(value, this.previewStart, this.previewEnd);
|
---|
| 211 | }
|
---|
| 212 | /** Gets whether a value is the end of the preview range. */
|
---|
| 213 | _isPreviewEnd(value) {
|
---|
| 214 | return isEnd(value, this.previewStart, this.previewEnd);
|
---|
| 215 | }
|
---|
| 216 | /** Gets whether a value is inside the preview range. */
|
---|
| 217 | _isInPreview(value) {
|
---|
| 218 | return isInRange(value, this.previewStart, this.previewEnd, this.isRange);
|
---|
| 219 | }
|
---|
| 220 | /** Finds the MatCalendarCell that corresponds to a DOM node. */
|
---|
| 221 | _getCellFromElement(element) {
|
---|
| 222 | let cell;
|
---|
| 223 | if (isTableCell(element)) {
|
---|
| 224 | cell = element;
|
---|
| 225 | }
|
---|
| 226 | else if (isTableCell(element.parentNode)) {
|
---|
| 227 | cell = element.parentNode;
|
---|
| 228 | }
|
---|
| 229 | if (cell) {
|
---|
| 230 | const row = cell.getAttribute('data-mat-row');
|
---|
| 231 | const col = cell.getAttribute('data-mat-col');
|
---|
| 232 | if (row && col) {
|
---|
| 233 | return this.rows[parseInt(row)][parseInt(col)];
|
---|
| 234 | }
|
---|
| 235 | }
|
---|
| 236 | return null;
|
---|
| 237 | }
|
---|
| 238 | }
|
---|
| 239 | MatCalendarBody.decorators = [
|
---|
| 240 | { type: Component, args: [{
|
---|
| 241 | selector: '[mat-calendar-body]',
|
---|
| 242 | template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n <td 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<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\" 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 <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\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 <td *ngFor=\"let item of row; let colIndex = index\"\n role=\"gridcell\"\n class=\"mat-calendar-body-cell\"\n [ngClass]=\"item.cssClasses\"\n [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [attr.data-mat-row]=\"rowIndex\"\n [attr.data-mat-col]=\"colIndex\"\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]=\"_isComparisonBridgeStart(item.compareValue, rowIndex, colIndex)\"\n [class.mat-calendar-body-comparison-bridge-end]=\"_isComparisonBridgeEnd(item.compareValue, rowIndex, colIndex)\"\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-selected]=\"_isSelected(item.compareValue)\"\n (click)=\"_cellClicked(item, $event)\"\n [style.width]=\"_cellWidth\"\n [style.paddingTop]=\"_cellPadding\"\n [style.paddingBottom]=\"_cellPadding\">\n <div 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]=\"_isComparisonIdentical(item.compareValue)\"\n [class.mat-calendar-body-today]=\"todayValue === item.compareValue\">\n {{item.displayValue}}\n </div>\n <div class=\"mat-calendar-body-cell-preview\"></div>\n </td>\n</tr>\n",
|
---|
| 243 | host: {
|
---|
| 244 | 'class': 'mat-calendar-body',
|
---|
| 245 | },
|
---|
| 246 | exportAs: 'matCalendarBody',
|
---|
| 247 | encapsulation: ViewEncapsulation.None,
|
---|
| 248 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
| 249 | styles: [".mat-calendar-body{min-width:224px}.mat-calendar-body-label{height:0;line-height:0;text-align:left;padding-left:4.7142857143%;padding-right:4.7142857143%}.mat-calendar-body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.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;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;border-top-right-radius:999px;border-bottom-right-radius:999px}.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:0;border-top-left-radius:999px;border-bottom-left-radius: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}.cdk-high-contrast-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}.mat-calendar-body-cell-content.mat-focus-indicator{position:absolute}.cdk-high-contrast-active .mat-calendar-body-cell-content{border:none}.cdk-high-contrast-active .mat-datepicker-popup:not(:empty),.cdk-high-contrast-active .mat-calendar-body-cell:not(.mat-calendar-body-in-range) .mat-calendar-body-selected{outline:solid 1px}.cdk-high-contrast-active .mat-calendar-body-today{outline:dotted 1px}.cdk-high-contrast-active .cdk-keyboard-focused .mat-calendar-body-active>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected),.cdk-high-contrast-active .cdk-program-focused .mat-calendar-body-active>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected){outline:dotted 2px}.cdk-high-contrast-active .mat-calendar-body-cell::before,.cdk-high-contrast-active .mat-calendar-body-cell::after,.cdk-high-contrast-active .mat-calendar-body-selected{background:none}.cdk-high-contrast-active .mat-calendar-body-in-range::before,.cdk-high-contrast-active .mat-calendar-body-comparison-bridge-start::before,.cdk-high-contrast-active .mat-calendar-body-comparison-bridge-end::before{border-top:solid 1px;border-bottom:solid 1px}.cdk-high-contrast-active .mat-calendar-body-range-start::before{border-left:solid 1px}[dir=rtl] .cdk-high-contrast-active .mat-calendar-body-range-start::before{border-left:0;border-right:solid 1px}.cdk-high-contrast-active .mat-calendar-body-range-end::before{border-right:solid 1px}[dir=rtl] .cdk-high-contrast-active .mat-calendar-body-range-end::before{border-right:0;border-left:solid 1px}.cdk-high-contrast-active .mat-calendar-body-in-comparison-range::before{border-top:dashed 1px;border-bottom:dashed 1px}.cdk-high-contrast-active .mat-calendar-body-comparison-start::before{border-left:dashed 1px}[dir=rtl] .cdk-high-contrast-active .mat-calendar-body-comparison-start::before{border-left:0;border-right:dashed 1px}.cdk-high-contrast-active .mat-calendar-body-comparison-end::before{border-right:dashed 1px}[dir=rtl] .cdk-high-contrast-active .mat-calendar-body-comparison-end::before{border-right:0;border-left:dashed 1px}[dir=rtl] .mat-calendar-body-label{text-align:right}@media(hover: none){.mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected){background-color:transparent}}\n"]
|
---|
| 250 | },] }
|
---|
| 251 | ];
|
---|
| 252 | MatCalendarBody.ctorParameters = () => [
|
---|
| 253 | { type: ElementRef },
|
---|
| 254 | { type: NgZone }
|
---|
| 255 | ];
|
---|
| 256 | MatCalendarBody.propDecorators = {
|
---|
| 257 | label: [{ type: Input }],
|
---|
| 258 | rows: [{ type: Input }],
|
---|
| 259 | todayValue: [{ type: Input }],
|
---|
| 260 | startValue: [{ type: Input }],
|
---|
| 261 | endValue: [{ type: Input }],
|
---|
| 262 | labelMinRequiredCells: [{ type: Input }],
|
---|
| 263 | numCols: [{ type: Input }],
|
---|
| 264 | activeCell: [{ type: Input }],
|
---|
| 265 | isRange: [{ type: Input }],
|
---|
| 266 | cellAspectRatio: [{ type: Input }],
|
---|
| 267 | comparisonStart: [{ type: Input }],
|
---|
| 268 | comparisonEnd: [{ type: Input }],
|
---|
| 269 | previewStart: [{ type: Input }],
|
---|
| 270 | previewEnd: [{ type: Input }],
|
---|
| 271 | selectedValueChange: [{ type: Output }],
|
---|
| 272 | previewChange: [{ type: Output }]
|
---|
| 273 | };
|
---|
| 274 | /** Checks whether a node is a table cell element. */
|
---|
| 275 | function isTableCell(node) {
|
---|
| 276 | return node.nodeName === 'TD';
|
---|
| 277 | }
|
---|
| 278 | /** Checks whether a value is the start of a range. */
|
---|
| 279 | function isStart(value, start, end) {
|
---|
| 280 | return end !== null && start !== end && value < end && value === start;
|
---|
| 281 | }
|
---|
| 282 | /** Checks whether a value is the end of a range. */
|
---|
| 283 | function isEnd(value, start, end) {
|
---|
| 284 | return start !== null && start !== end && value >= start && value === end;
|
---|
| 285 | }
|
---|
| 286 | /** Checks whether a value is inside of a range. */
|
---|
| 287 | function isInRange(value, start, end, rangeEnabled) {
|
---|
| 288 | return rangeEnabled && start !== null && end !== null && start !== end &&
|
---|
| 289 | value >= start && value <= end;
|
---|
| 290 | }
|
---|
| 291 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsZW5kYXItYm9keS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9kYXRlcGlja2VyL2NhbGVuZGFyLWJvZHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsVUFBVSxFQUNWLFlBQVksRUFDWixLQUFLLEVBQ0wsTUFBTSxFQUNOLGlCQUFpQixFQUNqQixNQUFNLEdBSVAsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLElBQUksRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBU3BDOzs7R0FHRztBQUNILE1BQU0sT0FBTyxlQUFlO0lBQzFCLFlBQW1CLEtBQWEsRUFDYixZQUFvQixFQUNwQixTQUFpQixFQUNqQixPQUFnQixFQUNoQixhQUF3QyxFQUFFLEVBQzFDLGVBQWUsS0FBSyxFQUNwQixRQUFZO1FBTlosVUFBSyxHQUFMLEtBQUssQ0FBUTtRQUNiLGlCQUFZLEdBQVosWUFBWSxDQUFRO1FBQ3BCLGNBQVMsR0FBVCxTQUFTLENBQVE7UUFDakIsWUFBTyxHQUFQLE9BQU8sQ0FBUztRQUNoQixlQUFVLEdBQVYsVUFBVSxDQUFnQztRQUMxQyxpQkFBWSxHQUFaLFlBQVksQ0FBUTtRQUNwQixhQUFRLEdBQVIsUUFBUSxDQUFJO0l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