cat-documents-ng 0.0.5 → 0.0.7
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/.github/PULL_REQUEST_TEMPLATE.md +32 -0
- package/.github/workflows/pr-validation.yml +87 -0
- package/.husky/pre-commit +4 -0
- package/README.md +59 -63
- package/angular.json +119 -0
- package/eslint.config.cjs +148 -0
- package/package.json +66 -19
- package/projects/cat-document-lib/README.md +63 -0
- package/{jest.config.mjs → projects/cat-document-lib/jest.config.mjs} +18 -18
- package/{ng-package.json → projects/cat-document-lib/ng-package.json} +10 -10
- package/projects/cat-document-lib/package-lock.json +599 -0
- package/projects/cat-document-lib/package.json +19 -0
- package/{setup-jest.ts → projects/cat-document-lib/setup-jest.ts} +9 -9
- package/{src/shared → projects/cat-document-lib/src/Shared}/constant/SHARED.ts +231 -231
- package/{src/shared → projects/cat-document-lib/src/Shared}/constant/URLS.ts +31 -31
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/app-config.service.spec.ts +16 -16
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/app-config.service.ts +73 -73
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/global-error.handler.ts +29 -29
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.html +5 -5
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.ts +82 -82
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.html +34 -34
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.scss +11 -11
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.ts +73 -73
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.html +32 -32
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.scss +21 -21
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.spec.ts +23 -23
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.ts +40 -40
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.html +55 -55
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.scss +26 -26
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.spec.ts +24 -24
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.ts +184 -184
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.html +244 -244
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.scss +35 -35
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.spec.ts +21 -21
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.ts +125 -125
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.html +46 -46
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.ts +51 -51
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.html +1 -1
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.ts +29 -29
- package/{src → projects/cat-document-lib/src}/lib/document/document.module.ts +191 -191
- package/{src → projects/cat-document-lib/src}/lib/document/models/document.model.ts +39 -39
- package/{src → projects/cat-document-lib/src}/lib/document/models/folder.model.ts +35 -35
- package/{src → projects/cat-document-lib/src}/lib/document/services/file-format.service.spec.ts +16 -16
- package/{src → projects/cat-document-lib/src}/lib/document/services/file-format.service.ts +41 -41
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.query.ts +23 -23
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.service.ts +95 -95
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.state.ts +39 -39
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.store.ts +23 -23
- package/{src → projects/cat-document-lib/src}/public-api.ts +8 -8
- package/{tsconfig.lib.json → projects/cat-document-lib/tsconfig.lib.json} +15 -15
- package/{tsconfig.lib.prod.json → projects/cat-document-lib/tsconfig.lib.prod.json} +11 -11
- package/{tsconfig.spec.json → projects/cat-document-lib/tsconfig.spec.json} +15 -15
- package/public/favicon.ico +0 -0
- package/src/app/app.component.html +1 -0
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts +29 -0
- package/src/app/app.component.ts +15 -0
- package/src/app/app.module.ts +60 -0
- package/src/app/app.routing.module.ts +19 -0
- package/src/index.html +13 -0
- package/src/main.ts +5 -0
- package/src/styles.scss +39 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +32 -0
- package/src/assets/config/app.config.json +0 -4
- /package/{src → projects/cat-document-lib/src}/assets/images/FolderImg.png +0 -0
- /package/{src → projects/cat-document-lib/src}/assets/images/Frame.png +0 -0
- /package/{src → projects/cat-document-lib/src}/assets/images/document.png +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.spec.ts +0 -0
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, EventEmitter, Input, input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { FileUpload } from 'primeng/fileupload';
|
|
3
|
-
import { MessageService } from 'primeng/api';
|
|
4
|
-
import { PrimeNGConfig } from 'primeng/api';
|
|
5
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
6
|
-
import { FileFormatService } from '../../services/file-format.service';
|
|
7
|
-
import { DocumentService } from '../../state/document.service';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A component for handling document uploads, including file selection, removal, and progress tracking.
|
|
11
|
-
* @class DocumentUploadComponent
|
|
12
|
-
*/
|
|
13
|
-
@Component({
|
|
14
|
-
selector: 'lib-document-upload',
|
|
15
|
-
templateUrl: './document-upload.component.html',
|
|
16
|
-
styleUrls: ['./document-upload.component.scss'],
|
|
17
|
-
standalone: false,
|
|
18
|
-
encapsulation: ViewEncapsulation.None
|
|
19
|
-
})
|
|
20
|
-
export class DocumentUploadComponent {
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Represent contextId
|
|
24
|
-
* @type {string}
|
|
25
|
-
*/
|
|
26
|
-
@Input() contextId: string = SHARED.EMPTY
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Provide id of file after upload.
|
|
30
|
-
* @type {*}
|
|
31
|
-
*/
|
|
32
|
-
@Output() onInput = new EventEmitter();
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* To make file explorer visible.
|
|
36
|
-
* @type {!FileUpload}
|
|
37
|
-
*/
|
|
38
|
-
@ViewChild('fileUploader') fileUploader!: FileUpload;
|
|
39
|
-
|
|
40
|
-
fileProgress: Map<File, number> = new Map();
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* List of files selected for upload.
|
|
44
|
-
* @type {File[]}
|
|
45
|
-
*/
|
|
46
|
-
uploadedFiles: any[] = [];
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Percentage of the total size calculated for displaying upload progress.
|
|
50
|
-
* @type {number}
|
|
51
|
-
*/
|
|
52
|
-
totalSizePercent: number = SHARED.INITIAL_COUNT;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The current upload progress percentage (SHARED.INITIAL_VALUE-100).
|
|
56
|
-
* @type {number}
|
|
57
|
-
*/
|
|
58
|
-
uploadProgress: number = SHARED.INITIAL_COUNT;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of DocumentUploadComponent.
|
|
63
|
-
* @class
|
|
64
|
-
* @param {DocumentService} uploadService - Service for handling document upload.
|
|
65
|
-
* @param {PrimeNGConfig} config - PrimeNG configuration.
|
|
66
|
-
* @param {FileFormatService} fileFormatService - Service for formatting file sizes.
|
|
67
|
-
* @param {MessageService} messageService - Service for displaying messages.
|
|
68
|
-
* @param {ChangeDetectorRef} cdr - Service for detecting changes.
|
|
69
|
-
*/
|
|
70
|
-
constructor(public uploadService: DocumentService, private config: PrimeNGConfig, public fileFormatService: FileFormatService, public messageService: MessageService, public cdr: ChangeDetectorRef) { }
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Open the file explorer.
|
|
74
|
-
* @param {*} event - The triggering event.
|
|
75
|
-
* @param {() => void} callback - A callback function to execute.
|
|
76
|
-
* @returns {void} - No return value.
|
|
77
|
-
*/
|
|
78
|
-
choose(event: any, callback: () => void) {
|
|
79
|
-
callback();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Prepares the files for upload by creating a FormData object.
|
|
86
|
-
* This method appends each file to the FormData for submission.
|
|
87
|
-
* @param {File} file - The file to upload.
|
|
88
|
-
* @returns {void}
|
|
89
|
-
*/
|
|
90
|
-
handleTemplatedUpload(file: File) {
|
|
91
|
-
let formData = this.handleCreateFormData(file)
|
|
92
|
-
this.uploadService.create(formData)
|
|
93
|
-
.subscribe({
|
|
94
|
-
/**
|
|
95
|
-
* Handles the successful upload event.
|
|
96
|
-
* Updates the list of uploaded files and emits the file ID.
|
|
97
|
-
* @param {any} event - The event emitted by the upload service on success.
|
|
98
|
-
*/
|
|
99
|
-
next: (event) => {
|
|
100
|
-
this.uploadedFiles.push(event);
|
|
101
|
-
this.fileProgress.set(event, 100);
|
|
102
|
-
this.onInput.emit(event._id)
|
|
103
|
-
this.totalSizePercent = 100;
|
|
104
|
-
},
|
|
105
|
-
/**
|
|
106
|
-
* Handles the error event during file upload.
|
|
107
|
-
* Updates the progress of the file to indicate failure.
|
|
108
|
-
* @param {any} error - The error object returned by the upload service.
|
|
109
|
-
*/
|
|
110
|
-
error: (error) => {
|
|
111
|
-
this.fileProgress.set(file, SHARED.INITIAL_COUNT);
|
|
112
|
-
this.messageService.add({
|
|
113
|
-
severity: SHARED.SEVERITY,
|
|
114
|
-
summary: SHARED.UPLOAD_SUMMERY,
|
|
115
|
-
detail: error?.message,
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Handle the creation of formdata.
|
|
124
|
-
* @param {File} file - The file to append in formdata.
|
|
125
|
-
* @returns {*}
|
|
126
|
-
*/
|
|
127
|
-
handleCreateFormData(file: File) {
|
|
128
|
-
const formData = new FormData();
|
|
129
|
-
formData.append(SHARED.FILE, file, file.name);
|
|
130
|
-
formData.append(SHARED.CONTEXT_ID, this.contextId)
|
|
131
|
-
return formData;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Handles the event when new files are selected.
|
|
135
|
-
* @param { { currentFiles: File[] } } event - The event containing the newly selected files.
|
|
136
|
-
* @returns {void}
|
|
137
|
-
*/
|
|
138
|
-
onSelectedFiles(event: { currentFiles: File[] }): void {
|
|
139
|
-
event.currentFiles.forEach((file: File) => {
|
|
140
|
-
this.handleTemplatedUpload(file);
|
|
141
|
-
});
|
|
142
|
-
this.fileUploader.clear();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Formats the given file size in bytes into a readable format (e.g., KB, MB).
|
|
147
|
-
* @param {number} bytes - The size of the file in bytes.
|
|
148
|
-
* @returns {string} The formatted file size (e.g., '1.2 KB', '2.3 MB').
|
|
149
|
-
*/
|
|
150
|
-
formatSize(bytes: number): string {
|
|
151
|
-
return this.fileFormatService.formatFileSize(bytes, this.config)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Handles the removal of a file from the uploaded files list.
|
|
156
|
-
* @param {File} file - The file to be removed.
|
|
157
|
-
* @param {number} index - The index of the file in the uploaded files list.
|
|
158
|
-
*/
|
|
159
|
-
handleDocumentRemove(file: File, index: number): void {
|
|
160
|
-
this.uploadedFiles.splice(index, 1);
|
|
161
|
-
this.fileProgress.delete(file);
|
|
162
|
-
this.cdr.detectChanges();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Major progress for the progress bar.
|
|
167
|
-
* @param {File} file - File to check progress for.
|
|
168
|
-
* @returns {number} - The progress percentage for the file.
|
|
169
|
-
*/
|
|
170
|
-
getProgress(file: File): number {
|
|
171
|
-
return this.fileProgress.get(file) || SHARED.INITIAL_COUNT;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Triggers the file upload dialog.
|
|
176
|
-
* Opens the file explorer for selecting files.
|
|
177
|
-
* @returns {void}
|
|
178
|
-
*/
|
|
179
|
-
triggerFileUpload() {
|
|
180
|
-
this.fileUploader.choose();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
1
|
+
import { ChangeDetectorRef, Component, EventEmitter, Input, input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { FileUpload } from 'primeng/fileupload';
|
|
3
|
+
import { MessageService } from 'primeng/api';
|
|
4
|
+
import { PrimeNGConfig } from 'primeng/api';
|
|
5
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
6
|
+
import { FileFormatService } from '../../services/file-format.service';
|
|
7
|
+
import { DocumentService } from '../../state/document.service';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A component for handling document uploads, including file selection, removal, and progress tracking.
|
|
11
|
+
* @class DocumentUploadComponent
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'lib-document-upload',
|
|
15
|
+
templateUrl: './document-upload.component.html',
|
|
16
|
+
styleUrls: ['./document-upload.component.scss'],
|
|
17
|
+
standalone: false,
|
|
18
|
+
encapsulation: ViewEncapsulation.None
|
|
19
|
+
})
|
|
20
|
+
export class DocumentUploadComponent {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Represent contextId
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
@Input() contextId: string = SHARED.EMPTY
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Provide id of file after upload.
|
|
30
|
+
* @type {*}
|
|
31
|
+
*/
|
|
32
|
+
@Output() onInput = new EventEmitter();
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* To make file explorer visible.
|
|
36
|
+
* @type {!FileUpload}
|
|
37
|
+
*/
|
|
38
|
+
@ViewChild('fileUploader') fileUploader!: FileUpload;
|
|
39
|
+
|
|
40
|
+
fileProgress: Map<File, number> = new Map();
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* List of files selected for upload.
|
|
44
|
+
* @type {File[]}
|
|
45
|
+
*/
|
|
46
|
+
uploadedFiles: any[] = [];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Percentage of the total size calculated for displaying upload progress.
|
|
50
|
+
* @type {number}
|
|
51
|
+
*/
|
|
52
|
+
totalSizePercent: number = SHARED.INITIAL_COUNT;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The current upload progress percentage (SHARED.INITIAL_VALUE-100).
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
uploadProgress: number = SHARED.INITIAL_COUNT;
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of DocumentUploadComponent.
|
|
63
|
+
* @class
|
|
64
|
+
* @param {DocumentService} uploadService - Service for handling document upload.
|
|
65
|
+
* @param {PrimeNGConfig} config - PrimeNG configuration.
|
|
66
|
+
* @param {FileFormatService} fileFormatService - Service for formatting file sizes.
|
|
67
|
+
* @param {MessageService} messageService - Service for displaying messages.
|
|
68
|
+
* @param {ChangeDetectorRef} cdr - Service for detecting changes.
|
|
69
|
+
*/
|
|
70
|
+
constructor(public uploadService: DocumentService, private config: PrimeNGConfig, public fileFormatService: FileFormatService, public messageService: MessageService, public cdr: ChangeDetectorRef) { }
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Open the file explorer.
|
|
74
|
+
* @param {*} event - The triggering event.
|
|
75
|
+
* @param {() => void} callback - A callback function to execute.
|
|
76
|
+
* @returns {void} - No return value.
|
|
77
|
+
*/
|
|
78
|
+
choose(event: any, callback: () => void) {
|
|
79
|
+
callback();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Prepares the files for upload by creating a FormData object.
|
|
86
|
+
* This method appends each file to the FormData for submission.
|
|
87
|
+
* @param {File} file - The file to upload.
|
|
88
|
+
* @returns {void}
|
|
89
|
+
*/
|
|
90
|
+
handleTemplatedUpload(file: File) {
|
|
91
|
+
let formData = this.handleCreateFormData(file)
|
|
92
|
+
this.uploadService.create(formData)
|
|
93
|
+
.subscribe({
|
|
94
|
+
/**
|
|
95
|
+
* Handles the successful upload event.
|
|
96
|
+
* Updates the list of uploaded files and emits the file ID.
|
|
97
|
+
* @param {any} event - The event emitted by the upload service on success.
|
|
98
|
+
*/
|
|
99
|
+
next: (event) => {
|
|
100
|
+
this.uploadedFiles.push(event);
|
|
101
|
+
this.fileProgress.set(event, 100);
|
|
102
|
+
this.onInput.emit(event._id)
|
|
103
|
+
this.totalSizePercent = 100;
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Handles the error event during file upload.
|
|
107
|
+
* Updates the progress of the file to indicate failure.
|
|
108
|
+
* @param {any} error - The error object returned by the upload service.
|
|
109
|
+
*/
|
|
110
|
+
error: (error) => {
|
|
111
|
+
this.fileProgress.set(file, SHARED.INITIAL_COUNT);
|
|
112
|
+
this.messageService.add({
|
|
113
|
+
severity: SHARED.SEVERITY,
|
|
114
|
+
summary: SHARED.UPLOAD_SUMMERY,
|
|
115
|
+
detail: error?.message,
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Handle the creation of formdata.
|
|
124
|
+
* @param {File} file - The file to append in formdata.
|
|
125
|
+
* @returns {*}
|
|
126
|
+
*/
|
|
127
|
+
handleCreateFormData(file: File) {
|
|
128
|
+
const formData = new FormData();
|
|
129
|
+
formData.append(SHARED.FILE, file, file.name);
|
|
130
|
+
formData.append(SHARED.CONTEXT_ID, this.contextId)
|
|
131
|
+
return formData;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Handles the event when new files are selected.
|
|
135
|
+
* @param { { currentFiles: File[] } } event - The event containing the newly selected files.
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
onSelectedFiles(event: { currentFiles: File[] }): void {
|
|
139
|
+
event.currentFiles.forEach((file: File) => {
|
|
140
|
+
this.handleTemplatedUpload(file);
|
|
141
|
+
});
|
|
142
|
+
this.fileUploader.clear();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Formats the given file size in bytes into a readable format (e.g., KB, MB).
|
|
147
|
+
* @param {number} bytes - The size of the file in bytes.
|
|
148
|
+
* @returns {string} The formatted file size (e.g., '1.2 KB', '2.3 MB').
|
|
149
|
+
*/
|
|
150
|
+
formatSize(bytes: number): string {
|
|
151
|
+
return this.fileFormatService.formatFileSize(bytes, this.config)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Handles the removal of a file from the uploaded files list.
|
|
156
|
+
* @param {File} file - The file to be removed.
|
|
157
|
+
* @param {number} index - The index of the file in the uploaded files list.
|
|
158
|
+
*/
|
|
159
|
+
handleDocumentRemove(file: File, index: number): void {
|
|
160
|
+
this.uploadedFiles.splice(index, 1);
|
|
161
|
+
this.fileProgress.delete(file);
|
|
162
|
+
this.cdr.detectChanges();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Major progress for the progress bar.
|
|
167
|
+
* @param {File} file - File to check progress for.
|
|
168
|
+
* @returns {number} - The progress percentage for the file.
|
|
169
|
+
*/
|
|
170
|
+
getProgress(file: File): number {
|
|
171
|
+
return this.fileProgress.get(file) || SHARED.INITIAL_COUNT;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Triggers the file upload dialog.
|
|
176
|
+
* Opens the file explorer for selecting files.
|
|
177
|
+
* @returns {void}
|
|
178
|
+
*/
|
|
179
|
+
triggerFileUpload() {
|
|
180
|
+
this.fileUploader.choose();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|