Add option to change form field appearance in timezone and entity autcomplete components.

This commit is contained in:
devaskim 2022-10-23 14:55:14 +05:00
parent 9d23c91137
commit 3e6831e07c
4 changed files with 10 additions and 2 deletions

View File

@ -15,7 +15,7 @@
limitations under the License.
-->
<mat-form-field [formGroup]="selectEntityFormGroup" class="mat-block">
<mat-form-field [formGroup]="selectEntityFormGroup" class="mat-block" [appearance]="appearance">
<input matInput type="text" placeholder="{{ entityText | translate }}"
#entityInput
formControlName="entity"

View File

@ -25,6 +25,7 @@ import {
Output,
ViewChild
} from '@angular/core';
import { MatFormFieldAppearance } from '@angular/material/form-field/form-field';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { merge, Observable, of, Subject } from 'rxjs';
import { catchError, debounceTime, map, share, switchMap, tap } from 'rxjs/operators';
@ -96,6 +97,9 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
@Input()
requiredText: string;
@Input()
appearance: MatFormFieldAppearance = 'legacy';
private requiredValue: boolean;
get required(): boolean {
return this.requiredValue;

View File

@ -15,7 +15,7 @@
limitations under the License.
-->
<mat-form-field [formGroup]="selectTimezoneFormGroup" fxFlex class="mat-block">
<mat-form-field [formGroup]="selectTimezoneFormGroup" fxFlex class="mat-block" [appearance]="appearance">
<mat-label translate>timezone.timezone</mat-label>
<input matInput type="text" placeholder="{{ 'timezone.select-timezone' | translate }}"
#timezoneInput

View File

@ -16,6 +16,7 @@
import { AfterViewInit, Component, forwardRef, Input, NgZone, OnInit, ViewChild } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { MatFormFieldAppearance } from '@angular/material/form-field/form-field';
import { Observable, of } from 'rxjs';
import { map, mergeMap, share, tap } from 'rxjs/operators';
import { Store } from '@ngrx/store';
@ -44,6 +45,9 @@ export class TimezoneSelectComponent implements ControlValueAccessor, OnInit, Af
defaultTimezoneId: string = null;
@Input()
appearance: MatFormFieldAppearance = 'legacy';
@Input()
set defaultTimezone(timezone: string) {
if (this.defaultTimezoneId !== timezone) {