@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.
- package/esm2020/lib/controls/file-upload/file-upload.component.mjs +23 -16
- package/fesm2015/energycap-components.mjs +23 -15
- package/fesm2015/energycap-components.mjs.map +1 -1
- package/fesm2020/energycap-components.mjs +22 -15
- package/fesm2020/energycap-components.mjs.map +1 -1
- package/lib/controls/file-upload/file-upload.component.d.ts +7 -3
- package/package.json +1 -1
- package/src/assets/locales/en_US.json +2 -1
@@ -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
|
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