@sumaris-net/ngx-components 1.11.9 → 1.11.10
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/bundles/sumaris-net.ngx-components.umd.js +19 -31
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/shared/upload-file/testing/upload-file.testing.js +7 -18
- package/esm2015/src/app/shared/upload-file/upload-file.component.js +8 -5
- package/fesm2015/sumaris-net.ngx-components.js +12 -20
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/upload-file/testing/upload-file.testing.d.ts +3 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -18119,9 +18119,12 @@
|
|
|
18119
18119
|
.pipe(operators.map(function (event) {
|
|
18120
18120
|
// Progress event
|
|
18121
18121
|
if ((event === null || event === void 0 ? void 0 : event.type) === i2$1.HttpEventType.UploadProgress || event.type === i2$1.HttpEventType.User) {
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18122
|
+
if (isNotNil(event.loaded) && event.loaded >= 0) {
|
|
18123
|
+
file.progress = Math.min(1, event.loaded / (event.total || 1));
|
|
18124
|
+
}
|
|
18125
|
+
else {
|
|
18126
|
+
file.progress = -1; // Indeterminate progression
|
|
18127
|
+
}
|
|
18125
18128
|
}
|
|
18126
18129
|
// Response event
|
|
18127
18130
|
else if (event instanceof i2$1.HttpResponse || event instanceof FileResponse) {
|
|
@@ -18159,7 +18162,7 @@
|
|
|
18159
18162
|
UploadFileComponent.decorators = [
|
|
18160
18163
|
{ type: i0.Component, args: [{
|
|
18161
18164
|
selector: 'app-upload-file',
|
|
18162
|
-
template: "<div *ngIf=\"!uniqueFile || files.length === 0\"\n class=\"container\"\n appDragAndDrop (fileDropped)=\"onFileDropped($event)\">\n <input\n type=\"file\"\n #fileDropRef\n id=\"fileDropRef\"\n multiple\n [accept]=\"fileExtension\"\n (change)=\"fileBrowseHandler($any($event.target).files)\"\n />\n <mat-icon style=\"font-size: xx-large\" color=\"accent\">file_upload</mat-icon>\n <ion-label\n [innerHTML]=\"\n 'FILE.UPLOAD.DRAG_AND_DROP' | translate: { extension: !fileExtension ? '' : ' (' + fileExtension + ')' }\n \"\n ></ion-label>\n <ion-button>{{ 'FILE.UPLOAD.BROWSE' | translate }}</ion-button>\n</div>\n<div class=\"files-list\">\n <div *ngFor=\"let file of files; index as i\"\n class=\"single-file\"\n [class.deleting]=\"file.deleting\">\n <mat-icon>description</mat-icon>\n <div class=\"info\">\n <h4 class=\"name\">\n {{ file.name }}\n </h4>\n <p class=\"size\">\n {{ file.size | fileSize }}\n </p>\n <ion-progress-bar *ngIf=\"!file.error\"\n [value]=\"file.progress||0\"\n [type]=\"file.deleting ? 'indeterminate' : 'determinate'\"></ion-progress-bar>\n <ion-label *ngIf=\"file.error\" color=\"danger\" [innerHTML]=\"file.error | translate\"></ion-label>\n </div>\n <!-- remote from list (before importation) -->\n <button *ngIf=\"!(file.progress) || file.error\" mat-icon-button (click)=\"deleteFile(i)\">\n <mat-icon>clear</mat-icon>\n </button>\n <!-- delete file (remotely - after importation) -->\n <button *ngIf=\"file.progress === 1 && !!deleteFn && !file.deleting\" mat-icon-button (click)=\"deleteFile(i)\">\n <mat-icon>clear</mat-icon>\n </button>\n </div>\n</div>\n",
|
|
18165
|
+
template: "<div *ngIf=\"!uniqueFile || files.length === 0\"\n class=\"container\"\n appDragAndDrop (fileDropped)=\"onFileDropped($event)\">\n <input\n type=\"file\"\n #fileDropRef\n id=\"fileDropRef\"\n multiple\n [accept]=\"fileExtension\"\n (change)=\"fileBrowseHandler($any($event.target).files)\"\n />\n <mat-icon style=\"font-size: xx-large\" color=\"accent\">file_upload</mat-icon>\n <ion-label\n [innerHTML]=\"\n 'FILE.UPLOAD.DRAG_AND_DROP' | translate: { extension: !fileExtension ? '' : ' (' + fileExtension + ')' }\n \"\n ></ion-label>\n <ion-button>{{ 'FILE.UPLOAD.BROWSE' | translate }}</ion-button>\n</div>\n<div class=\"files-list\">\n <div *ngFor=\"let file of files; index as i\"\n class=\"single-file\"\n [class.deleting]=\"file.deleting\">\n <mat-icon>description</mat-icon>\n <div class=\"info\">\n <h4 class=\"name\">\n {{ file.name }}\n </h4>\n <p class=\"size\">\n {{ file.size | fileSize }}\n </p>\n <ion-progress-bar *ngIf=\"!file.error\"\n [value]=\"file.progress||0\"\n [type]=\"(file.deleting || file.progress === -1) ? 'indeterminate' : 'determinate'\"></ion-progress-bar>\n <ion-label *ngIf=\"file.error\" color=\"danger\" [innerHTML]=\"file.error | translate\"></ion-label>\n </div>\n <!-- remote from list (before importation) -->\n <button *ngIf=\"!(file.progress) || file.error\" mat-icon-button (click)=\"deleteFile(i)\">\n <mat-icon>clear</mat-icon>\n </button>\n <!-- delete file (remotely - after importation) -->\n <button *ngIf=\"file.progress === 1 && !!deleteFn && !file.deleting\" mat-icon-button (click)=\"deleteFile(i)\">\n <mat-icon>clear</mat-icon>\n </button>\n </div>\n</div>\n",
|
|
18163
18166
|
styles: [".container{width:calc(100% - 3rem);min-height:200px;padding:2rem;text-align:center;border:1px dashed #979797;position:relative;margin:1.5rem}.container input{opacity:0;position:absolute;z-index:2;width:100%;height:100%;top:0;left:0;cursor:pointer}.container ion-label{display:block;font-size:20px;font-weight:600;color:#38424c}.container label{display:inline-block;color:#fff;width:183px;height:44px;border-radius:21.5px;background-color:#db202f;padding:8px 16px}.fileover{-webkit-animation:shake 1s;animation:shake 1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.files-list{max-height:300px;overflow:auto}.files-list .single-file{display:flex;flex-grow:1;padding:.5rem;justify-content:space-between;align-items:center;border:1px dashed #979797;margin-bottom:1rem}.files-list .single-file.deleting .name{color:grey!important;font-style:italic!important}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0 0 .25rem}.files-list .single-file .info{width:100%}@-webkit-keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}@keyframes shake{0%{transform:translate(1px,1px) rotate(0deg)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0deg)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0deg)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0deg)}to{transform:translate(1px,-2px) rotate(-1deg)}}"]
|
|
18164
18167
|
},] }
|
|
18165
18168
|
];
|
|
@@ -29978,31 +29981,15 @@
|
|
|
29978
29981
|
}
|
|
29979
29982
|
UploadFileTestingPage.prototype.showPopover = function (event, opts) {
|
|
29980
29983
|
return __awaiter(this, void 0, void 0, function () {
|
|
29981
|
-
var
|
|
29984
|
+
var data, filenames;
|
|
29982
29985
|
var _this = this;
|
|
29983
|
-
return __generator(this, function (
|
|
29984
|
-
switch (
|
|
29985
|
-
case 0: return [4 /*yield*/, this.popoverController.
|
|
29986
|
-
component: UploadFilePopover,
|
|
29987
|
-
componentProps: Object.assign({ title: 'modalTitle', uploadFn: function (file) { return _this.uploadFile(file); }, deleteFn: function (file) { return _this.deleteFile(file); } }, opts),
|
|
29988
|
-
backdropDismiss: false,
|
|
29989
|
-
keyboardClose: false,
|
|
29990
|
-
event: event,
|
|
29991
|
-
translucent: true,
|
|
29992
|
-
cssClass: 'popover-large',
|
|
29993
|
-
})];
|
|
29986
|
+
return __generator(this, function (_c) {
|
|
29987
|
+
switch (_c.label) {
|
|
29988
|
+
case 0: return [4 /*yield*/, FilesUtils.showUploadPopover(this.popoverController, event, Object.assign({ uploadFn: function (file) { return _this.uploadFile(file); }, deleteFn: function (file) { return _this.deleteFile(file); } }, opts))];
|
|
29994
29989
|
case 1:
|
|
29995
|
-
|
|
29996
|
-
|
|
29997
|
-
|
|
29998
|
-
_b.sent();
|
|
29999
|
-
return [4 /*yield*/, modal.onDidDismiss()];
|
|
30000
|
-
case 3:
|
|
30001
|
-
data = (_b.sent()).data;
|
|
30002
|
-
if (data) {
|
|
30003
|
-
filenames = data.map(function (file) { var _a; return (_a = file.response) === null || _a === void 0 ? void 0 : _a.body.finalName; });
|
|
30004
|
-
console.info('Popover result: ', filenames);
|
|
30005
|
-
}
|
|
29990
|
+
data = (_c.sent()).data;
|
|
29991
|
+
filenames = (data || []).map(function (file) { var _a, _b; return (_b = (_a = file.response) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.finalName; });
|
|
29992
|
+
console.info('Popover result: ', filenames);
|
|
30006
29993
|
return [2 /*return*/];
|
|
30007
29994
|
}
|
|
30008
29995
|
});
|
|
@@ -30021,7 +30008,8 @@
|
|
|
30021
30008
|
loaded += loadStep;
|
|
30022
30009
|
// Return progression
|
|
30023
30010
|
if (loaded < file.size) {
|
|
30024
|
-
return {
|
|
30011
|
+
//return {type: HttpEventType.UploadProgress, total: file.size, loaded };
|
|
30012
|
+
return { type: i2$1.HttpEventType.UploadProgress, loaded: -1 };
|
|
30025
30013
|
}
|
|
30026
30014
|
// Stop the timer
|
|
30027
30015
|
setTimeout(function () { return $stop.next(); }, 100);
|
|
@@ -30031,13 +30019,13 @@
|
|
|
30031
30019
|
};
|
|
30032
30020
|
UploadFileTestingPage.prototype.deleteFile = function (file) {
|
|
30033
30021
|
return __awaiter(this, void 0, void 0, function () {
|
|
30034
|
-
return __generator(this, function (
|
|
30035
|
-
switch (
|
|
30022
|
+
return __generator(this, function (_c) {
|
|
30023
|
+
switch (_c.label) {
|
|
30036
30024
|
case 0:
|
|
30037
30025
|
console.info('[testing] Simulate remote deletion... (waiting 2s)');
|
|
30038
30026
|
return [4 /*yield*/, sleep(2000)];
|
|
30039
30027
|
case 1:
|
|
30040
|
-
|
|
30028
|
+
_c.sent();
|
|
30041
30029
|
return [2 /*return*/, true];
|
|
30042
30030
|
}
|
|
30043
30031
|
});
|