Skip to content

Commit c071678

Browse files
committed
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 236f515 commit c071678

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
@@ -35,6 +35,7 @@ sass_library(
3535
"//src/material:sass_lib",
3636
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
3737
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
38+
"//src/material-experimental/mdc-form-field:mdc_form_field_scss_lib",
3839
],
3940
)
4041

@@ -46,7 +47,6 @@ sass_binary(
4647
],
4748
deps = [
4849
"//src/cdk:sass_lib",
49-
"//src/material-experimental/mdc-form-field:mdc_form_field_scss_lib",
5050
],
5151
)
5252

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 '../mdc-core/mdc-helpers/mdc-helpers';
79
@use './paginator-variables';
@@ -67,6 +69,18 @@
6769
$height: mdc-density.prop-value(
6870
paginator-variables.$density-config, $density-scale, height);
6971

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

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)