@sumaris-net/ngx-components 1.11.0-rc3 → 1.11.2
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 +29 -13
- 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 +2 -2
- package/esm2015/src/app/shared/upload-file/upload-file.component.js +12 -5
- package/esm2015/src/app/shared/upload-file/upload-file.model.js +11 -1
- package/fesm2015/sumaris-net.ngx-components.js +23 -9
- 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 +2 -2
- package/src/app/shared/upload-file/upload-file.component.d.ts +1 -1
- package/src/app/shared/upload-file/upload-file.model.d.ts +20 -2
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -17936,6 +17936,23 @@
|
|
|
17936
17936
|
{ type: i1$2.TranslateService }
|
|
17937
17937
|
]; };
|
|
17938
17938
|
|
|
17939
|
+
var UploadFile = /** @class */ (function (_super) {
|
|
17940
|
+
__extends(UploadFile, _super);
|
|
17941
|
+
function UploadFile() {
|
|
17942
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
17943
|
+
}
|
|
17944
|
+
return UploadFile;
|
|
17945
|
+
}(File));
|
|
17946
|
+
var FileResponse = /** @class */ (function () {
|
|
17947
|
+
function FileResponse(init) {
|
|
17948
|
+
this.type = i2$1.HttpEventType.Response;
|
|
17949
|
+
this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
|
|
17950
|
+
this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
|
|
17951
|
+
this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
|
|
17952
|
+
}
|
|
17953
|
+
return FileResponse;
|
|
17954
|
+
}());
|
|
17955
|
+
|
|
17939
17956
|
var UploadFileComponent = /** @class */ (function () {
|
|
17940
17957
|
function UploadFileComponent(cd, translate) {
|
|
17941
17958
|
this.cd = cd;
|
|
@@ -18097,14 +18114,20 @@
|
|
|
18097
18114
|
return rxjs.of(file);
|
|
18098
18115
|
})
|
|
18099
18116
|
.map(function (file$) { return file$.pipe(operators.tap(function (file) { return console.debug("[upload-file] " + file.name + ": uploading..."); }), operators.switchMap(function (file) { return _this.uploadFn(file).pipe(operators.map(function (event) {
|
|
18100
|
-
if (event.type === i2$1.HttpEventType.UploadProgress) {
|
|
18101
|
-
|
|
18117
|
+
if ((event === null || event === void 0 ? void 0 : event.type) === i2$1.HttpEventType.UploadProgress || event.type === i2$1.HttpEventType.User) {
|
|
18118
|
+
var total = event.total || 1;
|
|
18119
|
+
var loaded = event.loaded || 0;
|
|
18120
|
+
file.progress = Math.min(1, loaded / total);
|
|
18102
18121
|
}
|
|
18103
|
-
else if (event instanceof i2$1.HttpResponse) {
|
|
18122
|
+
else if (event instanceof i2$1.HttpResponse || event instanceof FileResponse) {
|
|
18104
18123
|
var content = event.body;
|
|
18105
18124
|
file.finalName = content === null || content === void 0 ? void 0 : content.finalName;
|
|
18106
18125
|
file.progress = 1;
|
|
18107
|
-
|
|
18126
|
+
var message = content.message || event.statusText || 'succeed';
|
|
18127
|
+
console.info("[upload-file] " + file.name + ": " + message + " (finalName: " + file.finalName + ")");
|
|
18128
|
+
}
|
|
18129
|
+
else {
|
|
18130
|
+
console.warn("[upload-file] " + file.name + ": Unknown event received by uploadFn : ", event);
|
|
18108
18131
|
}
|
|
18109
18132
|
return file;
|
|
18110
18133
|
}), operators.catchError(function (err) {
|
|
@@ -18883,14 +18906,6 @@
|
|
|
18883
18906
|
return FormFieldValuesHolder;
|
|
18884
18907
|
}());
|
|
18885
18908
|
|
|
18886
|
-
var UploadFile = /** @class */ (function (_super) {
|
|
18887
|
-
__extends(UploadFile, _super);
|
|
18888
|
-
function UploadFile() {
|
|
18889
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
18890
|
-
}
|
|
18891
|
-
return UploadFile;
|
|
18892
|
-
}(File));
|
|
18893
|
-
|
|
18894
18909
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
18895
18910
|
var AppForm = /** @class */ (function () {
|
|
18896
18911
|
function AppForm(injector, form) {
|
|
@@ -29946,7 +29961,7 @@
|
|
|
29946
29961
|
// Stop the timer
|
|
29947
29962
|
setTimeout(function () { return $stop.next(); }, 100);
|
|
29948
29963
|
// Return final response
|
|
29949
|
-
return new i2$1.HttpResponse({ body: { finalName: file.name
|
|
29964
|
+
return new i2$1.HttpResponse({ body: { finalName: file.name } });
|
|
29950
29965
|
}));
|
|
29951
29966
|
};
|
|
29952
29967
|
UploadFileTestingPage.prototype.deleteFile = function (file) {
|
|
@@ -30603,6 +30618,7 @@
|
|
|
30603
30618
|
exports.Environment = Environment;
|
|
30604
30619
|
exports.ErrorCodes = ErrorCodes;
|
|
30605
30620
|
exports.EvenPipe = EvenPipe;
|
|
30621
|
+
exports.FileResponse = FileResponse;
|
|
30606
30622
|
exports.FileService = FileService;
|
|
30607
30623
|
exports.FileSizePipe = FileSizePipe;
|
|
30608
30624
|
exports.FormArrayHelper = FormArrayHelper;
|