@sumaris-net/ngx-components 1.11.9 → 1.11.12
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 +39 -49
- 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/core/form/entity-editor.class.js +18 -16
- package/esm2015/src/app/core/services/model/referential.model.js +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 +29 -35
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +4 -3
- package/src/app/core/services/model/referential.model.d.ts +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
|
];
|
|
@@ -27422,13 +27425,16 @@
|
|
|
27422
27425
|
});
|
|
27423
27426
|
});
|
|
27424
27427
|
};
|
|
27428
|
+
AppEntityEditor.prototype.canUserWrite = function (data, opts) {
|
|
27429
|
+
return this.dataService.canUserWrite(data, opts);
|
|
27430
|
+
};
|
|
27425
27431
|
AppEntityEditor.prototype.startListenRemoteChanges = function () {
|
|
27426
27432
|
var _this = this;
|
|
27427
27433
|
// Skip if disable, or already listening
|
|
27428
27434
|
if (this._listenChangesSubscription || !this._enableListenChanges || this.isNewData)
|
|
27429
27435
|
return;
|
|
27430
27436
|
// Listen for changes on server
|
|
27431
|
-
this._listenChangesSubscription = this.
|
|
27437
|
+
this._listenChangesSubscription = this.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
|
|
27432
27438
|
.pipe(operators.filter(isNotNil))
|
|
27433
27439
|
.subscribe(function (data) {
|
|
27434
27440
|
if (data.updateDate && data.updateDate.isAfter(_this.data.updateDate)) {
|
|
@@ -27781,6 +27787,19 @@
|
|
|
27781
27787
|
});
|
|
27782
27788
|
});
|
|
27783
27789
|
};
|
|
27790
|
+
AppEntityEditor.prototype.unload = function () {
|
|
27791
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
27792
|
+
return __generator(this, function (_c) {
|
|
27793
|
+
this.stopListenRemoteChanges();
|
|
27794
|
+
this.form.reset();
|
|
27795
|
+
this.registerForms();
|
|
27796
|
+
this._dirty = false;
|
|
27797
|
+
this.data = null;
|
|
27798
|
+
this.saving = false;
|
|
27799
|
+
return [2 /*return*/];
|
|
27800
|
+
});
|
|
27801
|
+
});
|
|
27802
|
+
};
|
|
27784
27803
|
AppEntityEditor.prototype.goBack = function (event) {
|
|
27785
27804
|
var _a;
|
|
27786
27805
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -27830,10 +27849,6 @@
|
|
|
27830
27849
|
if (!opts || opts.emitEvent !== false)
|
|
27831
27850
|
this.markForCheck();
|
|
27832
27851
|
};
|
|
27833
|
-
/* -- public abstract methods (to override) -- */
|
|
27834
|
-
AppEntityEditor.prototype.canUserWrite = function (data, opts) {
|
|
27835
|
-
return this.dataService.canUserWrite(data, opts);
|
|
27836
|
-
};
|
|
27837
27852
|
/* -- protected methods -- */
|
|
27838
27853
|
/**
|
|
27839
27854
|
* Return undefined to keep same tab
|
|
@@ -27843,19 +27858,6 @@
|
|
|
27843
27858
|
var nextTabIndex = this.selectedTabIndex + 1;
|
|
27844
27859
|
return nextTabIndex < this.tabCount ? nextTabIndex : undefined;
|
|
27845
27860
|
};
|
|
27846
|
-
AppEntityEditor.prototype.unload = function () {
|
|
27847
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
27848
|
-
return __generator(this, function (_c) {
|
|
27849
|
-
this.stopListenRemoteChanges();
|
|
27850
|
-
this.form.reset();
|
|
27851
|
-
this.registerForms();
|
|
27852
|
-
this._dirty = false;
|
|
27853
|
-
this.data = null;
|
|
27854
|
-
this.saving = false;
|
|
27855
|
-
return [2 /*return*/];
|
|
27856
|
-
});
|
|
27857
|
-
});
|
|
27858
|
-
};
|
|
27859
27861
|
AppEntityEditor.prototype.onBeforeEntityLoad = function () {
|
|
27860
27862
|
return __awaiter(this, void 0, void 0, function () {
|
|
27861
27863
|
return __generator(this, function (_c) {
|
|
@@ -27979,6 +27981,9 @@
|
|
|
27979
27981
|
}
|
|
27980
27982
|
return parentUrl;
|
|
27981
27983
|
};
|
|
27984
|
+
AppEntityEditor.prototype.listenChanges = function (id, opts) {
|
|
27985
|
+
return this.dataService.listenChanges(this.data.id, opts);
|
|
27986
|
+
};
|
|
27982
27987
|
AppEntityEditor.prototype.markForCheck = function () {
|
|
27983
27988
|
this.cd.markForCheck();
|
|
27984
27989
|
};
|
|
@@ -29978,31 +29983,15 @@
|
|
|
29978
29983
|
}
|
|
29979
29984
|
UploadFileTestingPage.prototype.showPopover = function (event, opts) {
|
|
29980
29985
|
return __awaiter(this, void 0, void 0, function () {
|
|
29981
|
-
var
|
|
29986
|
+
var data, filenames;
|
|
29982
29987
|
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
|
-
})];
|
|
29988
|
+
return __generator(this, function (_c) {
|
|
29989
|
+
switch (_c.label) {
|
|
29990
|
+
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
29991
|
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
|
-
}
|
|
29992
|
+
data = (_c.sent()).data;
|
|
29993
|
+
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; });
|
|
29994
|
+
console.info('Popover result: ', filenames);
|
|
30006
29995
|
return [2 /*return*/];
|
|
30007
29996
|
}
|
|
30008
29997
|
});
|
|
@@ -30021,7 +30010,8 @@
|
|
|
30021
30010
|
loaded += loadStep;
|
|
30022
30011
|
// Return progression
|
|
30023
30012
|
if (loaded < file.size) {
|
|
30024
|
-
return {
|
|
30013
|
+
//return {type: HttpEventType.UploadProgress, total: file.size, loaded };
|
|
30014
|
+
return { type: i2$1.HttpEventType.UploadProgress, loaded: -1 };
|
|
30025
30015
|
}
|
|
30026
30016
|
// Stop the timer
|
|
30027
30017
|
setTimeout(function () { return $stop.next(); }, 100);
|
|
@@ -30031,13 +30021,13 @@
|
|
|
30031
30021
|
};
|
|
30032
30022
|
UploadFileTestingPage.prototype.deleteFile = function (file) {
|
|
30033
30023
|
return __awaiter(this, void 0, void 0, function () {
|
|
30034
|
-
return __generator(this, function (
|
|
30035
|
-
switch (
|
|
30024
|
+
return __generator(this, function (_c) {
|
|
30025
|
+
switch (_c.label) {
|
|
30036
30026
|
case 0:
|
|
30037
30027
|
console.info('[testing] Simulate remote deletion... (waiting 2s)');
|
|
30038
30028
|
return [4 /*yield*/, sleep(2000)];
|
|
30039
30029
|
case 1:
|
|
30040
|
-
|
|
30030
|
+
_c.sent();
|
|
30041
30031
|
return [2 /*return*/, true];
|
|
30042
30032
|
}
|
|
30043
30033
|
});
|