@sumaris-net/ngx-components 1.11.0-rc3 → 1.11.0

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.
@@ -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;
@@ -18098,13 +18115,15 @@
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
18117
  if (event.type === i2$1.HttpEventType.UploadProgress) {
18101
- file.progress = Math.min(1, event.loaded / event.total);
18118
+ var total = event.total || file.size;
18119
+ file.progress = Math.min(1, event.loaded / total);
18102
18120
  }
18103
- else if (event instanceof i2$1.HttpResponse) {
18121
+ else if (event instanceof i2$1.HttpResponse || event instanceof FileResponse) {
18104
18122
  var content = event.body;
18105
18123
  file.finalName = content === null || content === void 0 ? void 0 : content.finalName;
18106
18124
  file.progress = 1;
18107
- console.info("[upload-file] " + file.name + ": " + (content.message || 'succeed') + " (finalName: " + file.finalName + ")");
18125
+ var message = content.message || event.statusText || 'succeed';
18126
+ console.info("[upload-file] " + file.name + ": " + message + " (finalName: " + file.finalName + ")");
18108
18127
  }
18109
18128
  return file;
18110
18129
  }), operators.catchError(function (err) {
@@ -18883,14 +18902,6 @@
18883
18902
  return FormFieldValuesHolder;
18884
18903
  }());
18885
18904
 
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
18905
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
18895
18906
  var AppForm = /** @class */ (function () {
18896
18907
  function AppForm(injector, form) {
@@ -29946,7 +29957,7 @@
29946
29957
  // Stop the timer
29947
29958
  setTimeout(function () { return $stop.next(); }, 100);
29948
29959
  // Return final response
29949
- return new i2$1.HttpResponse({ body: { finalName: file.name, message: 'Upload succeed' } });
29960
+ return new i2$1.HttpResponse({ body: { finalName: file.name } });
29950
29961
  }));
29951
29962
  };
29952
29963
  UploadFileTestingPage.prototype.deleteFile = function (file) {
@@ -30603,6 +30614,7 @@
30603
30614
  exports.Environment = Environment;
30604
30615
  exports.ErrorCodes = ErrorCodes;
30605
30616
  exports.EvenPipe = EvenPipe;
30617
+ exports.FileResponse = FileResponse;
30606
30618
  exports.FileService = FileService;
30607
30619
  exports.FileSizePipe = FileSizePipe;
30608
30620
  exports.FormArrayHelper = FormArrayHelper;