@energycap/components 0.39.21-ECAP-25650-file-upload-validation-support.20240806-1534 → 0.39.21-ECAP-25650-file-upload-validation-support.20240806-1611
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.
@@ -4245,7 +4245,7 @@ class FileUploadComponent extends FormControlBase {
|
|
4245
4245
|
this.formModel.patchValue({ uploadResult: result ?? null });
|
4246
4246
|
}
|
4247
4247
|
else {
|
4248
|
-
this.formModel.patchValue({ file, name: file.name,
|
4248
|
+
this.formModel.patchValue({ base64FileString, file, name: file.name, uploadResult: result ?? null });
|
4249
4249
|
}
|
4250
4250
|
}
|
4251
4251
|
catch (e) {
|
@@ -4257,13 +4257,13 @@ class FileUploadComponent extends FormControlBase {
|
|
4257
4257
|
// In the case of pre-upload validation the form already has the file so we don't want to patch again.
|
4258
4258
|
}
|
4259
4259
|
else if (!validateBeforeUpload) {
|
4260
|
-
this.formModel.patchValue({ file, name: file.name,
|
4260
|
+
this.formModel.patchValue({ base64FileString, file, name: file.name, uploadResult: null });
|
4261
4261
|
}
|
4262
4262
|
}
|
4263
4263
|
/** Patches the form with the selected file in order to trigger control validation */
|
4264
4264
|
async validateFile(file, base64FileString = null) {
|
4265
4265
|
// Patch the file first to trigger any file validators
|
4266
|
-
this.formModel.patchValue({ file, name: file.name,
|
4266
|
+
this.formModel.patchValue({ base64FileString, file, name: file.name, uploadResult: null });
|
4267
4267
|
// If we have any async validators pending we need to wait for them to complete before we know if the form is valid
|
4268
4268
|
if (this.formModel.pending) {
|
4269
4269
|
await this.formModel.statusChanges.pipe(filter(status => status !== 'PENDING'), take(1), takeUntil(this.componentDestroyed)).toPromise();
|