diff --git a/package-lock.json b/package-lock.json index 3a7b6bf..e63d4b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12171,9 +12171,9 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sartography-workflow-lib": { - "version": "0.0.72", - "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.72.tgz", - "integrity": "sha512-l6153jMOkKPgi2dOODOdTSHdPyyZpYjuylkPt38ct4XYaaF+kiT3GadhZli3sxg8KRkYfiaJ5krZRgl3adNu7A==" + "version": "0.0.73", + "resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.73.tgz", + "integrity": "sha512-GE+kB9018IWgUIBGv/5E4eoybnTmm8fz4kbES42LT6buAqNMtnvzVEt/XZKGAt78sM78Jc/CugrQFFxVFW/xxg==" }, "sass": { "version": "1.23.3", diff --git a/package.json b/package.json index ff428ae..0f69f18 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "ngx-file-drop": "^8.0.8", "ngx-markdown": "^9.0.0", "rxjs": "~6.5.4", - "sartography-workflow-lib": "^0.0.72", + "sartography-workflow-lib": "^0.0.73", "tslib": "^1.11.1", "uuid": "^7.0.2", "zone.js": "^0.10.3" diff --git a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.html b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.html index 65de608..cbb6443 100644 --- a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.html +++ b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.html @@ -1,6 +1,12 @@
- +
diff --git a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.ts b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.ts index dfb7391..9f4b98d 100644 --- a/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.ts +++ b/src/app/_dialogs/file-meta-dialog/file-meta-dialog.component.ts @@ -1,5 +1,5 @@ import {Component, Inject} from '@angular/core'; -import {FormGroup} from '@angular/forms'; +import {FormControl, FormGroup} from '@angular/forms'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {FormlyFieldConfig, FormlyFormOptions} from '@ngx-formly/core'; import {cleanUpFilename, FileType} from 'sartography-workflow-lib'; @@ -51,15 +51,18 @@ export class FileMetaDialogComponent { options: fileTypeOptions, }, }, - // { - // key: 'file', - // type: 'file', - // defaultValue: this.data.file, - // templateOptions: { - // label: 'File', - // required: true, - // }, - // } + { + key: 'file', + type: 'file', + defaultValue: this.data.file, + templateOptions: { + label: 'File', + required: true, + }, + modelOptions: { + updateOn: 'change' + }, + } ]; } @@ -72,4 +75,16 @@ export class FileMetaDialogComponent { this.dialogRef.close(this.model); } + onModelChange(model: any) { + console.log('model', model); + if (model.file && typeof model.file === 'object' && model.file instanceof Blob) { + // Upload file + const fileReader = new (window as any).FileReader(); + fileReader.onload = (event: ProgressEvent) => { + const stringContent = (event.target as FileReader).result.toString(); + console.log(stringContent); + }; + fileReader.readAsText(model.file); + } + } }