ng-matero / extensions

Angular Material Extensions Library.
https://ng-matero.github.io/extensions/
MIT License
393 stars 48 forks source link

Density of datetimepicker #229

Closed Rado-1 closed 10 months ago

Rado-1 commented 11 months ago

I wanted to change density of datetime picker specified in class of comprising form field, which works fine for other Angular Material components. I used Angular Material 16.1.1 and Extensions 16.0.0 with extensions-date-fns-adapter 16.0.0.

My template code:

<mat-form-field appearance="outline" class="form-field-density-5">
      <mat-label>From</mat-label>
      <input
        matInput
        #inputFrom
        [formControl]="from"
        [mtxDatetimepicker]="dpFrom"
      />
      <mtx-datetimepicker-toggle
        matSuffix
        [for]="dpFrom"
      ></mtx-datetimepicker-toggle>
      <mtx-datetimepicker type="date" #dpFrom></mtx-datetimepicker>
    </mat-form-field>

My scss code:

@use '@angular/material' as mat;
...

.form-field-density-5 {
  @include mat.form-field-density(-5);
}

Unfortunately, the height of the datetimepicker component did not change. Could you please help me to solve the problem or at least give some workaround? Thanks!

nzbin commented 11 months ago

I'sorry, I don't quite sure what the reason of your problem. But you can try the methods in my dev-app.

https://github.com/ng-matero/extensions/blob/63ae586d759d2c6014421d444dc64de34a01007e/projects/dev-app/src/styles.scss#L73-L83

Rado-1 commented 10 months ago

Thanks. I originally used only density-related mixins from mat and did not realize that mtx has its own. Thanks for the example which helped me to do what I originally wanted.