chrv-components 1.10.43 → 1.10.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -15,7 +15,7 @@ import * as i1$3 from '@angular/forms';
15
15
  import { NG_VALIDATORS, Validators, FormControl, ReactiveFormsModule, FormsModule, FormGroup } from '@angular/forms';
16
16
  import * as i2$1 from '@angular/material/autocomplete';
17
17
  import { MatAutocompleteModule } from '@angular/material/autocomplete';
18
- import { Observable, map, BehaviorSubject, skip, debounceTime, distinctUntilChanged, Subject, startWith, from, mergeMap, toArray, timer, catchError, of, forkJoin, take, skipWhile, tap, finalize as finalize$1 } from 'rxjs';
18
+ import { Observable, map, BehaviorSubject, skip, debounceTime, distinctUntilChanged, Subject, startWith, from, mergeMap, toArray, timer, of, catchError, forkJoin, take, skipWhile, tap, finalize as finalize$1 } from 'rxjs';
19
19
  import * as i3$1 from '@angular/material/core';
20
20
  import { MatOption } from '@angular/material/core';
21
21
  import { trigger, state, style, transition, animate } from '@angular/animations';
@@ -1934,37 +1934,32 @@ class ChrFileInputComponent extends ChrBaseInputComponent {
1934
1934
  this.errors = null;
1935
1935
  this.files = [];
1936
1936
  this.onFileChange = (event) => {
1937
+ console.log(`[FileInput] (change) -> `, event);
1937
1938
  this.files = [];
1938
1939
  const files = event.target.files;
1940
+ console.log(`[FileInput] (change): target -> `, files);
1939
1941
  const filesAsync = [];
1940
1942
  if (files.length <= 0) {
1941
1943
  this.valueDisplay = '';
1942
1944
  this.onValueChange(null);
1943
1945
  }
1946
+ let obs;
1944
1947
  for (const file of files) {
1945
1948
  if (this.base64) {
1946
1949
  // Convert the file to base64 using the fileservice
1947
- const obs = this.fileService.toBase64WithProgress({
1950
+ obs = this.fileService.toBase64WithProgress({
1948
1951
  file: file,
1949
1952
  url: window.URL.createObjectURL(file),
1950
1953
  });
1951
- // Add to the file list with the progress percentage
1952
- this.files = [...this.files, obs];
1953
- filesAsync.push(obs);
1954
- // Catch conversion error for display
1955
- obs.pipe(catchError((err, source) => {
1956
- this.toastService.setWarning(`Une erreur s'est produite pendant la conversion du fichier ${file.name} `);
1957
- return err;
1958
- }));
1959
1954
  }
1960
1955
  else {
1961
1956
  const fil = file;
1962
1957
  const indexOfExtension = file?.file?.name.lastIndexOf('.');
1963
1958
  const [name, extension] = [
1964
- file.file.name.slice(0, indexOfExtension),
1965
- file.file.name.slice(indexOfExtension + 1),
1959
+ fil.name.slice(0, indexOfExtension),
1960
+ fil.name.slice(indexOfExtension + 1),
1966
1961
  ];
1967
- const obs = of({
1962
+ obs = of({
1968
1963
  progress: 100,
1969
1964
  file: {
1970
1965
  data: null,
@@ -1974,6 +1969,14 @@ class ChrFileInputComponent extends ChrBaseInputComponent {
1974
1969
  },
1975
1970
  });
1976
1971
  }
1972
+ // Add to the file list with the progress percentage
1973
+ this.files = [...this.files, obs];
1974
+ filesAsync.push(obs);
1975
+ // Catch conversion error for display
1976
+ obs.pipe(catchError((err, source) => {
1977
+ this.toastService.setWarning(`Une erreur s'est produite pendant la conversion du fichier ${file.name} `);
1978
+ return err;
1979
+ }));
1977
1980
  }
1978
1981
  forkJoin(filesAsync)
1979
1982
  .pipe(take(1))