@@ -14,6 +14,8 @@ $mat-calendar-body-cell-radius: 999px !default;
14
14
$mat-calendar-body-min-size : 7 * $mat-calendar-body-cell-min-size !default ;
15
15
$mat-calendar-body-cell-content-size : 100% - $mat-calendar-body-cell-content-margin * 2 !default ;
16
16
17
+ $mat-calendar-range-end-body-cell-size :
18
+ $mat-calendar-body-cell-content-size + $mat-calendar-body-cell-content-margin !default ;
17
19
18
20
.mat-calendar-body {
19
21
min-width : $mat-calendar-body-min-size ;
@@ -43,10 +45,44 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar
43
45
& ::before {
44
46
content : ' ' ;
45
47
position : absolute ;
46
- top : 0 ;
47
- bottom : 0 ;
48
+ top : $mat-calendar-body-cell-content-margin ;
48
49
left : 0 ;
49
- right : 0 ;
50
+
51
+ // We want the range background to be slightly shorter than the cell so
52
+ // that there's a gap when the range goes across multiple rows.
53
+ height : $mat-calendar-body-cell-content-size ;
54
+ width : 100% ;
55
+ }
56
+ }
57
+
58
+ .mat-calendar-body-range-start ::before {
59
+ // Since the range background isn't a perfect circle, we need to size
60
+ // and offset the start so that it aligns with the main circle.
61
+ left : $mat-calendar-body-cell-content-margin ;
62
+ width : $mat-calendar-range-end-body-cell-size ;
63
+ border-top-left-radius : $mat-calendar-body-cell-radius ;
64
+ border-bottom-left-radius : $mat-calendar-body-cell-radius ;
65
+
66
+ [dir = ' rtl' ] & {
67
+ left : 0 ;
68
+ border-radius : 0 ;
69
+ border-top-right-radius : $mat-calendar-body-cell-radius ;
70
+ border-bottom-right-radius : $mat-calendar-body-cell-radius ;
71
+ }
72
+ }
73
+
74
+ .mat-calendar-body-range-end ::before {
75
+ // Since the range background isn't a perfect circle, we need to
76
+ // resize the end so that it aligns with the main circle.
77
+ width : $mat-calendar-range-end-body-cell-size ;
78
+ border-top-right-radius : $mat-calendar-body-cell-radius ;
79
+ border-bottom-right-radius : $mat-calendar-body-cell-radius ;
80
+
81
+ [dir = ' rtl' ] & {
82
+ left : $mat-calendar-body-cell-content-margin ;
83
+ border-radius : 0 ;
84
+ border-top-left-radius : $mat-calendar-body-cell-radius ;
85
+ border-bottom-left-radius : $mat-calendar-body-cell-radius ;
50
86
}
51
87
}
52
88
@@ -81,16 +117,6 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar
81
117
}
82
118
}
83
119
84
- .mat-calendar-body-range-start ::before {
85
- border-top-left-radius : $mat-calendar-body-cell-radius ;
86
- border-bottom-left-radius : $mat-calendar-body-cell-radius ;
87
- }
88
-
89
- .mat-calendar-body-range-end ::before {
90
- border-top-right-radius : $mat-calendar-body-cell-radius ;
91
- border-bottom-right-radius : $mat-calendar-body-cell-radius ;
92
- }
93
-
94
120
@include cdk-high-contrast (active , off) {
95
121
.mat-datepicker-popup :not (:empty ),
96
122
.mat-calendar-body-selected {
0 commit comments