chrv-components 1.10.45 → 1.10.47

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
@@ -1934,10 +1934,10 @@ 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
+ //console.log(`[FileInput] (change) -> `, event);
1938
1938
  this.files = [];
1939
1939
  const files = event.target.files;
1940
- console.log(`[FileInput] (change): target -> `, files);
1940
+ //console.log(`[FileInput] (change): target -> `, files);
1941
1941
  const filesAsync = [];
1942
1942
  if (files.length <= 0) {
1943
1943
  this.valueDisplay = '';
@@ -1965,6 +1965,7 @@ class ChrFileInputComponent extends ChrBaseInputComponent {
1965
1965
  data: null,
1966
1966
  extension: extension,
1967
1967
  name: name,
1968
+ file: fil,
1968
1969
  url: window.URL.createObjectURL(fil),
1969
1970
  },
1970
1971
  });
@@ -2369,8 +2370,19 @@ class ChrFormComponent {
2369
2370
  };
2370
2371
  this.toFormData = () => {
2371
2372
  const data = new FormData();
2372
- for (const key in this.model)
2373
- data.append(key, this.model[key]);
2373
+ for (const key in this.model) {
2374
+ if (this.flattenedControls[key].type === 'file' &&
2375
+ this.flattenedControls[key].base64 === false) {
2376
+ if (this.flattenedControls[key].multiple === true) {
2377
+ for (const file of this.model[key])
2378
+ data.append(key, file.file);
2379
+ }
2380
+ else
2381
+ data.append(key, this.model[key].file);
2382
+ }
2383
+ else
2384
+ data.append(key, this.model[key]);
2385
+ }
2374
2386
  return data;
2375
2387
  };
2376
2388
  this.get = (control) => {