Commit c3a9e6917624eb758fcc4f3498a5682a88eedf4c

Authored by Chantsova Ekaterina
Committed by Andrew Shvayka
1 parent 240422aa

Make file input work properly when there are multiple on page

@@ -34,6 +34,7 @@ import { Subscription } from 'rxjs'; @@ -34,6 +34,7 @@ import { Subscription } from 'rxjs';
34 import { coerceBooleanProperty } from '@angular/cdk/coercion'; 34 import { coerceBooleanProperty } from '@angular/cdk/coercion';
35 import { FlowDirective } from '@flowjs/ngx-flow'; 35 import { FlowDirective } from '@flowjs/ngx-flow';
36 import { TranslateService } from '@ngx-translate/core'; 36 import { TranslateService } from '@ngx-translate/core';
  37 +import { UtilsService } from '@core/services/utils.service';
37 38
38 @Component({ 39 @Component({
39 selector: 'tb-file-input', 40 selector: 'tb-file-input',
@@ -59,7 +60,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit, @@ -59,7 +60,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit,
59 noFileText = 'import.no-file'; 60 noFileText = 'import.no-file';
60 61
61 @Input() 62 @Input()
62 - inputId = 'select'; 63 + inputId = this.utils.guid();
63 64
64 @Input() 65 @Input()
65 allowedExtensions: string; 66 allowedExtensions: string;
@@ -114,6 +115,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit, @@ -114,6 +115,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit,
114 private propagateChange = null; 115 private propagateChange = null;
115 116
116 constructor(protected store: Store<AppState>, 117 constructor(protected store: Store<AppState>,
  118 + private utils: UtilsService,
117 public translate: TranslateService) { 119 public translate: TranslateService) {
118 super(store); 120 super(store);
119 } 121 }