Skip to content

Commit 13bbe9d

Browse files
authored
fix(material-experimental/mdc-paginator): allow form-field density to go lower than -4 (#25192)
* fix(material-experimental/mdc-paginator): allow form-field density to go lower than -4 MDC recently added support for -5 form-field density (b/217245308). The paginator should respect that if requested. * fixup! fix(material-experimental/mdc-paginator): allow form-field density to go lower than -4
1 parent 272f50a commit 13bbe9d

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/material-experimental/mdc-paginator/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ sass_library(
3434
deps = [
3535
"//:mdc_sass_lib",
3636
"//src/material:sass_lib",
37+
"//src/material-experimental/mdc-form-field:mdc_form_field_scss_lib",
3738
"//src/material/core:core_scss_lib",
3839
],
3940
)
@@ -43,7 +44,6 @@ sass_binary(
4344
src = "paginator.scss",
4445
deps = [
4546
"//src/cdk:sass_lib",
46-
"//src/material-experimental/mdc-form-field:mdc_form_field_scss_lib",
4747
],
4848
)
4949

src/material-experimental/mdc-paginator/_paginator-theme.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
@use 'sass:map';
2+
@use 'sass:meta';
13
@use '@angular/material' as mat;
24
@use '@material/density' as mdc-density;
35
@use '@material/typography' as mdc-typography;
4-
@use 'sass:map';
6+
@use '../mdc-form-field/form-field-theme';
57

68
@use './paginator-variables';
79

@@ -66,6 +68,18 @@
6668
$height: mdc-density.prop-value(
6769
paginator-variables.$density-config, $density-scale, height);
6870

71+
.mat-mdc-paginator {
72+
// We need the form field to be narrower in order to fit into the paginator,
73+
// so we set its density to be -4 or denser.
74+
@if ((meta.type-of($density-scale) == 'number' and $density-scale >= -4) or
75+
$density-scale == maximum) {
76+
@include form-field-theme.density(-4);
77+
}
78+
@else {
79+
@include form-field-theme.density($density-scale);
80+
}
81+
}
82+
6983
.mat-mdc-paginator-container {
7084
min-height: $height;
7185
}

src/material-experimental/mdc-paginator/paginator.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use '@angular/cdk';
2-
@use '../mdc-form-field/form-field-theme';
32

43
$padding: 0 8px;
54
$page-size-margin-right: 8px;
@@ -14,10 +13,6 @@ $button-icon-size: 28px;
1413
.mat-mdc-paginator {
1514
display: block;
1615

17-
// We need the form field to be as narrow as possible in order to fit
18-
// into the paginator so we always use the densest layout available.
19-
@include form-field-theme.density(minimum);
20-
2116
// This element reserves space for hints and error messages.
2217
// Hide it since we know that we won't need it.
2318
.mat-mdc-form-field-subscript-wrapper {

0 commit comments

Comments
 (0)