@energycap/components 0.39.21-ECAP-25650-file-upload-validation-support.20240802-1011 → 0.39.21-ECAP-25650-file-upload-validation-support.20240805-1645

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.
@@ -1,5 +1,5 @@
1
1
  import { ElementRef, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import { FormControl, FormGroup, ValidatorFn } from '@angular/forms';
2
+ import { AsyncValidatorFn, FormControl, FormGroup, ValidatorFn } from '@angular/forms';
3
3
  import { ValidationMessageService } from '../../core/validation-message.service';
4
4
  import { FormGroupHelper } from '../../shared/form-group.helper';
5
5
  import { FormControlBase } from '../form-control-base';
@@ -16,10 +16,14 @@ export type FileUploadFormGroup = {
16
16
  base64FileString: FormControl<string | null>;
17
17
  uploadResult: FormControl<any>;
18
18
  };
19
+ export type InvalidFileError = {
20
+ invalidFile: true;
21
+ };
19
22
  export declare class FileUploadComponent extends FormControlBase implements OnInit, OnChanges {
20
23
  protected validationMessageService: ValidationMessageService;
21
24
  protected formGroupHelper: FormGroupHelper;
22
- static getFormModel(validators: ValidatorFn[], disabled?: boolean): FormGroup<FileUploadFormGroup>;
25
+ static getFormModel(validators: ValidatorFn[], disabled?: boolean, fileValidators?: AsyncValidatorFn | AsyncValidatorFn[]): FormGroup<FileUploadFormGroup>;
26
+ static getFileValidator(callback: (file: File | null | undefined, base64: string | null | undefined) => Promise<InvalidFileError | null>): AsyncValidatorFn;
23
27
  formModel: FormGroup<FileUploadFormGroup>;
24
28
  /**
25
29
  * The value of the textbox input's placeholder
@@ -98,7 +102,7 @@ export declare class FileUploadComponent extends FormControlBase implements OnIn
98
102
  * @param base64FileString
99
103
  * @param onFileSelectedResult
100
104
  */
101
- private patchFileResult;
105
+ private patchProcessedFile;
102
106
  /** Maps the files to an array of File objects and sends them along
103
107
  * to the derived onMultipleFileSelected method in the hosting component
104
108
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energycap/components",
3
- "version": "0.39.21-ECAP-25650-file-upload-validation-support.20240802-1011",
3
+ "version": "0.39.21-ECAP-25650-file-upload-validation-support.20240805-1645",
4
4
  "dependencies": {
5
5
  "tslib": "^2.0.0"
6
6
  },
@@ -43,5 +43,6 @@
43
43
  "Done_TC": "Done",
44
44
  "LearnMore_SC": "Learn more",
45
45
  "SelectZipFiles_ELS": "Select ZIP files...",
46
- "Browse_TC": "Browse"
46
+ "Browse_TC": "Browse",
47
+ "is invalid": "is invalid"
47
48
  }