myrta-ui 13.0.11 → 13.0.13
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/components/form/input-file/input-file.component.mjs +30 -27
- package/fesm2015/myrta-ui.mjs +29 -26
- package/fesm2015/myrta-ui.mjs.map +1 -1
- package/fesm2020/myrta-ui.mjs +29 -26
- package/fesm2020/myrta-ui.mjs.map +1 -1
- package/lib/components/form/input-file/input-file.component.d.ts +5 -5
- package/package.json +1 -1
package/fesm2020/myrta-ui.mjs
CHANGED
|
@@ -13302,7 +13302,9 @@ class InputFileComponent {
|
|
|
13302
13302
|
if (this.showInputWithError) {
|
|
13303
13303
|
return this.maxFiles > this.files.filter(s => !s.error).length;
|
|
13304
13304
|
}
|
|
13305
|
-
|
|
13305
|
+
else {
|
|
13306
|
+
return this.maxFiles > this.files.length;
|
|
13307
|
+
}
|
|
13306
13308
|
}
|
|
13307
13309
|
get getTarget() {
|
|
13308
13310
|
return InputFileTargetTypesEnum[this.target];
|
|
@@ -13337,13 +13339,13 @@ class InputFileComponent {
|
|
|
13337
13339
|
const findFile = this.files.find(s => s.uuid === file.uuid);
|
|
13338
13340
|
if (findFile) {
|
|
13339
13341
|
if (this.deleteEndPoint) {
|
|
13340
|
-
const formData = this.
|
|
13342
|
+
const formData = this._createFormData();
|
|
13341
13343
|
formData.append('Qquuid', file.uuid);
|
|
13342
13344
|
findFile.deleting = true;
|
|
13343
13345
|
if (this.autoUpload) {
|
|
13344
13346
|
this.fileUploadService.delete(this.deleteEndPoint, formData).subscribe(result => {
|
|
13345
13347
|
this.files.splice(this.files.indexOf(findFile), 1);
|
|
13346
|
-
this.
|
|
13348
|
+
this._validateUploadedAllFiles();
|
|
13347
13349
|
this.filesChanged.emit(this.files);
|
|
13348
13350
|
});
|
|
13349
13351
|
}
|
|
@@ -13353,7 +13355,7 @@ class InputFileComponent {
|
|
|
13353
13355
|
}
|
|
13354
13356
|
else {
|
|
13355
13357
|
this.files.splice(this.files.indexOf(findFile), 1);
|
|
13356
|
-
this.
|
|
13358
|
+
this._validateUploadedAllFiles();
|
|
13357
13359
|
this.filesChanged.emit(this.files);
|
|
13358
13360
|
}
|
|
13359
13361
|
}
|
|
@@ -13364,19 +13366,6 @@ class InputFileComponent {
|
|
|
13364
13366
|
canCancelUploading(file) {
|
|
13365
13367
|
return !!file.uploading && file.percentage ? file.percentage < 90 : false;
|
|
13366
13368
|
}
|
|
13367
|
-
validateUploadedAllFiles() {
|
|
13368
|
-
for (let i = 0; i < this.files.length; i++) {
|
|
13369
|
-
const data = this.files[i];
|
|
13370
|
-
data.error = undefined;
|
|
13371
|
-
this.checkForUpload(data, true);
|
|
13372
|
-
if (this.maxFiles <= i) {
|
|
13373
|
-
data.error = this.messageTooManyFiles;
|
|
13374
|
-
}
|
|
13375
|
-
else if (!data.error) {
|
|
13376
|
-
data.uuid = data.uuid || data.tempUuid || '';
|
|
13377
|
-
}
|
|
13378
|
-
}
|
|
13379
|
-
}
|
|
13380
13369
|
clear(file) {
|
|
13381
13370
|
if (file.uploading) {
|
|
13382
13371
|
if (file.execution) {
|
|
@@ -13388,7 +13377,7 @@ class InputFileComponent {
|
|
|
13388
13377
|
this.files.splice(findFileIdx, 1);
|
|
13389
13378
|
this.filesChanged.emit(this.files);
|
|
13390
13379
|
}
|
|
13391
|
-
this.
|
|
13380
|
+
this._validateUploadedAllFiles();
|
|
13392
13381
|
}
|
|
13393
13382
|
downloadUrl(file) {
|
|
13394
13383
|
if (file.url && !file.size) {
|
|
@@ -13406,7 +13395,7 @@ class InputFileComponent {
|
|
|
13406
13395
|
if (droppedFile.fileEntry.isFile) {
|
|
13407
13396
|
const fileEntry = droppedFile.fileEntry;
|
|
13408
13397
|
fileEntry.file((file) => {
|
|
13409
|
-
this.
|
|
13398
|
+
this._uploadFile(file);
|
|
13410
13399
|
});
|
|
13411
13400
|
}
|
|
13412
13401
|
else {
|
|
@@ -13415,19 +13404,32 @@ class InputFileComponent {
|
|
|
13415
13404
|
}
|
|
13416
13405
|
}
|
|
13417
13406
|
}
|
|
13418
|
-
|
|
13407
|
+
_validateUploadedAllFiles() {
|
|
13408
|
+
for (let i = 0; i < this.files.length; i++) {
|
|
13409
|
+
const data = this.files[i];
|
|
13410
|
+
data.error = undefined;
|
|
13411
|
+
this._checkForUpload(data, true);
|
|
13412
|
+
if (this.maxFiles <= i) {
|
|
13413
|
+
data.error = this.messageTooManyFiles;
|
|
13414
|
+
}
|
|
13415
|
+
else if (!data.error) {
|
|
13416
|
+
data.uuid = data.uuid || data.tempUuid || '';
|
|
13417
|
+
}
|
|
13418
|
+
}
|
|
13419
|
+
}
|
|
13420
|
+
_formDataKeys() {
|
|
13419
13421
|
return Object.keys(this.formData);
|
|
13420
13422
|
}
|
|
13421
|
-
|
|
13423
|
+
_createFormData() {
|
|
13422
13424
|
const form = new FormData();
|
|
13423
13425
|
if (this.maxFiles) {
|
|
13424
13426
|
form.append('MaxFiles', this.maxFiles.toString(10));
|
|
13425
13427
|
}
|
|
13426
|
-
const keys = this.
|
|
13428
|
+
const keys = this._formDataKeys();
|
|
13427
13429
|
keys.forEach(key => form.append(key, this.formData[key]));
|
|
13428
13430
|
return form;
|
|
13429
13431
|
}
|
|
13430
|
-
|
|
13432
|
+
_uploadFile(file) {
|
|
13431
13433
|
const data = {
|
|
13432
13434
|
uuid: '',
|
|
13433
13435
|
tempUuid: v4(),
|
|
@@ -13437,10 +13439,11 @@ class InputFileComponent {
|
|
|
13437
13439
|
percentage: 0,
|
|
13438
13440
|
file: file
|
|
13439
13441
|
};
|
|
13440
|
-
if (!this.
|
|
13442
|
+
if (!this._checkForUpload(data)) {
|
|
13443
|
+
this.filesChanged.emit(this.files);
|
|
13441
13444
|
return;
|
|
13442
13445
|
}
|
|
13443
|
-
const formData = this.
|
|
13446
|
+
const formData = this._createFormData();
|
|
13444
13447
|
formData.append('File', file);
|
|
13445
13448
|
if (this.uploadAdditionalData && Object.keys(this.uploadAdditionalData).length) {
|
|
13446
13449
|
Object.keys(this.uploadAdditionalData).forEach(key => {
|
|
@@ -13489,7 +13492,7 @@ class InputFileComponent {
|
|
|
13489
13492
|
}
|
|
13490
13493
|
}
|
|
13491
13494
|
}
|
|
13492
|
-
|
|
13495
|
+
_checkForUpload(data, existing) {
|
|
13493
13496
|
this.checkDroppedFile.emit(data);
|
|
13494
13497
|
if (!this.canAdd && !existing) {
|
|
13495
13498
|
data.error = this.messageTooManyFiles;
|