@energycap/components 0.39.20 → 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 { UntypedFormGroup, 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';
@@ -10,10 +10,21 @@ export declare const FileTypeExtensions: {
10
10
  zip: string[];
11
11
  excel: string[];
12
12
  };
13
+ export type FileUploadFormGroup = {
14
+ file: FormControl<File | null>;
15
+ name: FormControl<string | null>;
16
+ base64FileString: FormControl<string | null>;
17
+ uploadResult: FormControl<any>;
18
+ };
19
+ export type InvalidFileError = {
20
+ invalidFile: true;
21
+ };
13
22
  export declare class FileUploadComponent extends FormControlBase implements OnInit, OnChanges {
14
23
  protected validationMessageService: ValidationMessageService;
15
24
  protected formGroupHelper: FormGroupHelper;
16
- static getFormModel(validators: ValidatorFn[], disabled?: boolean): UntypedFormGroup;
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;
27
+ formModel: FormGroup<FileUploadFormGroup>;
17
28
  /**
18
29
  * The value of the textbox input's placeholder
19
30
  */
@@ -91,12 +102,12 @@ export declare class FileUploadComponent extends FormControlBase implements OnIn
91
102
  * @param base64FileString
92
103
  * @param onFileSelectedResult
93
104
  */
94
- private patchFileResult;
105
+ private patchProcessedFile;
95
106
  /** Maps the files to an array of File objects and sends them along
96
107
  * to the derived onMultipleFileSelected method in the hosting component
97
108
  */
98
109
  private handleMultipleFiles;
99
110
  private readFile;
100
111
  static ɵfac: i0.ɵɵFactoryDeclaration<FileUploadComponent, never>;
101
- static ɵcmp: i0.ɵɵComponentDeclaration<FileUploadComponent, "ec-file-upload", never, { "placeholder": "placeholder"; "fileType": "fileType"; "fileOutput": "fileOutput"; "customExtensions": "customExtensions"; "onFileSelected": "onFileSelected"; "onMultipleFilesSelected": "onMultipleFilesSelected"; "displayType": "displayType"; "buttonLabel": "buttonLabel"; "buttonType": "buttonType"; "multiSelect": "multiSelect"; }, {}, never, never, false, never>;
112
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileUploadComponent, "ec-file-upload", never, { "formModel": "formModel"; "placeholder": "placeholder"; "fileType": "fileType"; "fileOutput": "fileOutput"; "customExtensions": "customExtensions"; "onFileSelected": "onFileSelected"; "onMultipleFilesSelected": "onMultipleFilesSelected"; "displayType": "displayType"; "buttonLabel": "buttonLabel"; "buttonType": "buttonType"; "multiSelect": "multiSelect"; }, {}, never, never, false, never>;
102
113
  }
@@ -5,13 +5,13 @@ import { TranslateService } from '@ngx-translate/core';
5
5
  import { Observable, Subject } from 'rxjs';
6
6
  import { NavItem } from '../../../controls/navigation/nav-item';
7
7
  import { ErrorService } from '../../../core/error.service';
8
+ import { RouterHelper } from '../../../core/router-helper.service';
8
9
  import { ScrollService } from '../../../core/scroll.service';
9
10
  import { DialogService } from '../../../display/dialog/dialog.service';
10
- import { SplashService } from '../../../display/splash/splash.service';
11
11
  import { Help } from '../../../display/help/help-types';
12
+ import { SplashService } from '../../../display/splash/splash.service';
12
13
  import { Overlay } from '../../../display/view-overlay/view-overlay.component';
13
14
  import { PageStatus } from '../page-statuses';
14
- import { RouterHelper } from '../../../core/router-helper.service';
15
15
  import * as i0 from "@angular/core";
16
16
  export declare class PageInitResult {
17
17
  title?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energycap/components",
3
- "version": "0.39.20",
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
  }