@sumaris-net/ngx-components 1.11.5 → 1.11.6

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.
@@ -18002,8 +18002,8 @@
18002
18002
  UploadFileComponent.prototype.deleteFile = function (index) {
18003
18003
  return __awaiter(this, void 0, void 0, function () {
18004
18004
  var file, deleted, err_1;
18005
- return __generator(this, function (_b) {
18006
- switch (_b.label) {
18005
+ return __generator(this, function (_d) {
18006
+ switch (_d.label) {
18007
18007
  case 0:
18008
18008
  file = this.files[index];
18009
18009
  if (!(file.progress === 1 && this.deleteFn)) return [3 /*break*/, 6];
@@ -18011,18 +18011,18 @@
18011
18011
  console.warn("[upload-file] This file already deleting");
18012
18012
  return [2 /*return*/];
18013
18013
  }
18014
- _b.label = 1;
18014
+ _d.label = 1;
18015
18015
  case 1:
18016
- _b.trys.push([1, 3, 4, 5]);
18016
+ _d.trys.push([1, 3, 4, 5]);
18017
18017
  file.deleting = true;
18018
18018
  return [4 /*yield*/, this.deleteFn(file)];
18019
18019
  case 2:
18020
- deleted = _b.sent();
18020
+ deleted = _d.sent();
18021
18021
  if (!deleted)
18022
18022
  return [2 /*return*/];
18023
18023
  return [3 /*break*/, 5];
18024
18024
  case 3:
18025
- err_1 = _b.sent();
18025
+ err_1 = _d.sent();
18026
18026
  console.error(err_1 && err_1.message || err_1);
18027
18027
  return [2 /*return*/];
18028
18028
  case 4:
@@ -18039,7 +18039,7 @@
18039
18039
  console.warn("[upload-file] Cannot remove this file while uploading");
18040
18040
  return [2 /*return*/];
18041
18041
  }
18042
- _b.label = 7;
18042
+ _d.label = 7;
18043
18043
  case 7:
18044
18044
  this.files.splice(index, 1);
18045
18045
  this.cd.markForCheck();
@@ -18054,7 +18054,7 @@
18054
18054
  * @param files (Files List)
18055
18055
  */
18056
18056
  UploadFileComponent.prototype.prepareFilesList = function (files) {
18057
- var _b;
18057
+ var _d;
18058
18058
  var items;
18059
18059
  if (files instanceof FileList) {
18060
18060
  items = [];
@@ -18066,7 +18066,7 @@
18066
18066
  else {
18067
18067
  items = files;
18068
18068
  }
18069
- (_b = this.files).push.apply(_b, __spread(items));
18069
+ (_d = this.files).push.apply(_d, __spread(items));
18070
18070
  this.fileDropEl.nativeElement.value = '';
18071
18071
  // Start upload
18072
18072
  if (this.instantUpload) {
@@ -18080,7 +18080,7 @@
18080
18080
  return __awaiter(this, void 0, void 0, function () {
18081
18081
  var $processingFileCountChange, $changes, jobs;
18082
18082
  var _this = this;
18083
- return __generator(this, function (_b) {
18083
+ return __generator(this, function (_d) {
18084
18084
  if (!files) {
18085
18085
  console.info('[upload-file] Uploading all files...');
18086
18086
  files = this.files;
@@ -18111,7 +18111,13 @@
18111
18111
  file.progress = 0;
18112
18112
  return rxjs.of(file);
18113
18113
  })
18114
- .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) {
18114
+ .map(function (file$) { return file$.pipe(
18115
+ // Log
18116
+ operators.tap(function (file) { return console.debug("[upload-file] " + file.name + ": uploading..."); }),
18117
+ // Start uploading
18118
+ operators.switchMap(function (file) { return _this.uploadFn(file)
18119
+ .pipe(operators.map(function (event) {
18120
+ var _a, _b, _c;
18115
18121
  // Progress event
18116
18122
  if ((event === null || event === void 0 ? void 0 : event.type) === i2$1.HttpEventType.UploadProgress || event.type === i2$1.HttpEventType.User) {
18117
18123
  var total = event.total || 1;
@@ -18120,12 +18126,11 @@
18120
18126
  }
18121
18127
  // Response event
18122
18128
  else if (event instanceof i2$1.HttpResponse || event instanceof FileResponse) {
18123
- var body = event.body;
18124
- file.finalName = body === null || body === void 0 ? void 0 : body.finalName;
18129
+ file.result = event.body;
18125
18130
  file.progress = 1;
18126
- var message = (body === null || body === void 0 ? void 0 : body.message) || event.statusText || 'OK';
18131
+ var message = ((_a = file.result) === null || _a === void 0 ? void 0 : _a.message) || event.statusText || 'OK';
18127
18132
  console.debug("[upload-file] " + file.name + ": " + message
18128
- + (file.finalName ? " (finalName: " + file.finalName + ")" : ''));
18133
+ + (((_b = file.result) === null || _b === void 0 ? void 0 : _b.finalName) ? " (finalName: " + ((_c = file.result) === null || _c === void 0 ? void 0 : _c.finalName) + ")" : ''));
18129
18134
  }
18130
18135
  // Other events
18131
18136
  else {