Browse Source

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

pull/7475/head
devaskim 4 years ago
parent
commit
3e6831e07c
  1. 2
      ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.html
  2. 4
      ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts
  3. 2
      ui-ngx/src/app/shared/components/time/timezone-select.component.html
  4. 4
      ui-ngx/src/app/shared/components/time/timezone-select.component.ts

2
ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.html

@ -15,7 +15,7 @@
limitations under the License. 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 }}" <input matInput type="text" placeholder="{{ entityText | translate }}"
#entityInput #entityInput
formControlName="entity" formControlName="entity"

4
ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts

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

2
ui-ngx/src/app/shared/components/time/timezone-select.component.html

@ -15,7 +15,7 @@
limitations under the License. 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> <mat-label translate>timezone.timezone</mat-label>
<input matInput type="text" placeholder="{{ 'timezone.select-timezone' | translate }}" <input matInput type="text" placeholder="{{ 'timezone.select-timezone' | translate }}"
#timezoneInput #timezoneInput

4
ui-ngx/src/app/shared/components/time/timezone-select.component.ts

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

Loading…
Cancel
Save