@sumaris-net/ngx-components 1.11.6 → 1.11.9

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 (_d) {
18006
- switch (_d.label) {
18005
+ return __generator(this, function (_b) {
18006
+ switch (_b.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
- _d.label = 1;
18014
+ _b.label = 1;
18015
18015
  case 1:
18016
- _d.trys.push([1, 3, 4, 5]);
18016
+ _b.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 = _d.sent();
18020
+ deleted = _b.sent();
18021
18021
  if (!deleted)
18022
18022
  return [2 /*return*/];
18023
18023
  return [3 /*break*/, 5];
18024
18024
  case 3:
18025
- err_1 = _d.sent();
18025
+ err_1 = _b.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
- _d.label = 7;
18042
+ _b.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 _d;
18057
+ var _b;
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
- (_d = this.files).push.apply(_d, __spread(items));
18069
+ (_b = this.files).push.apply(_b, __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 (_d) {
18083
+ return __generator(this, function (_b) {
18084
18084
  if (!files) {
18085
18085
  console.info('[upload-file] Uploading all files...');
18086
18086
  files = this.files;
@@ -18117,7 +18117,6 @@
18117
18117
  // Start uploading
18118
18118
  operators.switchMap(function (file) { return _this.uploadFn(file)
18119
18119
  .pipe(operators.map(function (event) {
18120
- var _a, _b, _c;
18121
18120
  // Progress event
18122
18121
  if ((event === null || event === void 0 ? void 0 : event.type) === i2$1.HttpEventType.UploadProgress || event.type === i2$1.HttpEventType.User) {
18123
18122
  var total = event.total || 1;
@@ -18126,11 +18125,9 @@
18126
18125
  }
18127
18126
  // Response event
18128
18127
  else if (event instanceof i2$1.HttpResponse || event instanceof FileResponse) {
18129
- file.result = event.body;
18130
18128
  file.progress = 1;
18131
- var message = ((_a = file.result) === null || _a === void 0 ? void 0 : _a.message) || event.statusText || 'OK';
18132
- console.debug("[upload-file] " + file.name + ": " + message
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
+ file.response = event;
18130
+ console.debug("[upload-file] " + file.name + ": " + (event.statusText || 'OK'), file.response);
18134
18131
  }
18135
18132
  // Other events
18136
18133
  else {
@@ -18250,10 +18247,10 @@
18250
18247
  errors.forEach(function (error) { return console.error(error); });
18251
18248
  throw { message: 'FILE.UPLOAD.ERROR' };
18252
18249
  }
18253
- // return filenames
18250
+ // return files
18254
18251
  return [4 /*yield*/, this.popoverController.dismiss(files)];
18255
18252
  case 5:
18256
- // return filenames
18253
+ // return files
18257
18254
  _a.sent();
18258
18255
  return [3 /*break*/, 7];
18259
18256
  case 6:
@@ -29981,10 +29978,10 @@
29981
29978
  }
29982
29979
  UploadFileTestingPage.prototype.showPopover = function (event, opts) {
29983
29980
  return __awaiter(this, void 0, void 0, function () {
29984
- var modal, data;
29981
+ var modal, data, filenames;
29985
29982
  var _this = this;
29986
- return __generator(this, function (_a) {
29987
- switch (_a.label) {
29983
+ return __generator(this, function (_b) {
29984
+ switch (_b.label) {
29988
29985
  case 0: return [4 /*yield*/, this.popoverController.create({
29989
29986
  component: UploadFilePopover,
29990
29987
  componentProps: Object.assign({ title: 'modalTitle', uploadFn: function (file) { return _this.uploadFile(file); }, deleteFn: function (file) { return _this.deleteFile(file); } }, opts),
@@ -29995,15 +29992,16 @@
29995
29992
  cssClass: 'popover-large',
29996
29993
  })];
29997
29994
  case 1:
29998
- modal = _a.sent();
29995
+ modal = _b.sent();
29999
29996
  return [4 /*yield*/, modal.present()];
30000
29997
  case 2:
30001
- _a.sent();
29998
+ _b.sent();
30002
29999
  return [4 /*yield*/, modal.onDidDismiss()];
30003
30000
  case 3:
30004
- data = (_a.sent()).data;
30001
+ data = (_b.sent()).data;
30005
30002
  if (data) {
30006
- console.info('Popover result: ', 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);
30007
30005
  }
30008
30006
  return [2 /*return*/];
30009
30007
  }
@@ -30033,13 +30031,13 @@
30033
30031
  };
30034
30032
  UploadFileTestingPage.prototype.deleteFile = function (file) {
30035
30033
  return __awaiter(this, void 0, void 0, function () {
30036
- return __generator(this, function (_a) {
30037
- switch (_a.label) {
30034
+ return __generator(this, function (_b) {
30035
+ switch (_b.label) {
30038
30036
  case 0:
30039
30037
  console.info('[testing] Simulate remote deletion... (waiting 2s)');
30040
30038
  return [4 /*yield*/, sleep(2000)];
30041
30039
  case 1:
30042
- _a.sent();
30040
+ _b.sent();
30043
30041
  return [2 /*return*/, true];
30044
30042
  }
30045
30043
  });