-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(datepicker): move weekdays into table header (#4129)
* fix broken tests * md-calendar-table --> [md-calendar-body] * move md-calendar-body to tbody element * move weekdays into table header * finishing touches * fix year view padding * add some comments
- Loading branch information
Showing
20 changed files
with
263 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- If there's not enough space in the first row, create a separate label row. --> | ||
<tr *ngIf="_firstRowOffset < labelMinRequiredCells"> | ||
<td class="mat-calendar-body-label" [attr.colspan]="numCols" >{{label}}</td> | ||
</tr> | ||
|
||
<!-- Create the first row separately so we can include a special spacer cell. --> | ||
<tr *ngFor="let row of rows; let rowIndex = index"> | ||
<td *ngIf="rowIndex === 0 && _firstRowOffset" | ||
class="mat-calendar-body-label" | ||
[attr.colspan]="_firstRowOffset"> | ||
{{_firstRowOffset >= labelMinRequiredCells ? label : ''}} | ||
</td> | ||
<td *ngFor="let item of row; let colIndex = index" | ||
class="mat-calendar-body-cell" | ||
[class.mat-calendar-body-disabled]="!item.enabled" | ||
[class.mat-calendar-body-active]="_isActiveCell(rowIndex, colIndex)" | ||
(click)="_cellClicked(item)"> | ||
<div class="mat-calendar-body-cell-content" | ||
[class.mat-calendar-body-selected]="selectedValue === item.value" | ||
[class.mat-calendar-body-today]="todayValue === item.value"> | ||
{{item.displayValue}} | ||
</div> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
$mat-calendar-body-font-size: 13px !default; | ||
$mat-calendar-body-header-font-size: 14px !default; | ||
$mat-calendar-body-label-padding-start: 5% !default; | ||
$mat-calendar-body-label-translation: -6px !default; | ||
$mat-calendar-body-cell-min-size: 32px !default; | ||
$mat-calendar-body-cell-size: 100% / 7 !default; | ||
$mat-calendar-body-cell-content-margin: 5% !default; | ||
$mat-calendar-body-cell-content-border-width: 1px !default; | ||
|
||
$mat-calendar-body-min-size: 7 * $mat-calendar-body-cell-min-size !default; | ||
$mat-calendar-body-cell-padding: $mat-calendar-body-cell-size / 2 !default; | ||
$mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-margin * 2 !default; | ||
|
||
|
||
.mat-calendar-body { | ||
font-size: $mat-calendar-body-font-size; | ||
min-width: $mat-calendar-body-min-size; | ||
} | ||
|
||
.mat-calendar-body-label { | ||
padding: $mat-calendar-body-cell-padding 0 | ||
$mat-calendar-body-cell-padding $mat-calendar-body-cell-padding; | ||
height: 0; | ||
line-height: 0; | ||
transform: translateX($mat-calendar-body-label-translation); | ||
text-align: left; | ||
font-size: $mat-calendar-body-header-font-size; | ||
font-weight: bold; | ||
} | ||
|
||
.mat-calendar-body-cell { | ||
position: relative; | ||
width: $mat-calendar-body-cell-size; | ||
height: 0; | ||
line-height: 0; | ||
padding: $mat-calendar-body-cell-padding 0; | ||
text-align: center; | ||
} | ||
|
||
.mat-calendar-body-cell-content { | ||
position: absolute; | ||
top: $mat-calendar-body-cell-content-margin; | ||
left: $mat-calendar-body-cell-content-margin; | ||
|
||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
box-sizing: border-box; | ||
width: $mat-calendar-body-cell-content-size; | ||
height: $mat-calendar-body-cell-content-size; | ||
|
||
border-width: $mat-calendar-body-cell-content-border-width; | ||
border-style: solid; | ||
border-radius: 50%; | ||
} | ||
|
||
[dir='rtl'] { | ||
.mat-calendar-body-label { | ||
padding: 0 $mat-calendar-body-cell-padding 0 0; | ||
transform: translateX(-$mat-calendar-body-label-translation); | ||
text-align: right; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.