@sumaris-net/ngx-components 1.23.17 → 1.23.18

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.
@@ -26121,7 +26121,8 @@
26121
26121
  */
26122
26122
  EntitiesTableDataSource.prototype.close = function () {
26123
26123
  if (!this._stopWatchSubject.closed) {
26124
- console.debug('[table-datasource] Closing...');
26124
+ if (this._debug)
26125
+ console.debug('[entities-table-datasource] Closing...');
26125
26126
  this._stopWatchSubject.next();
26126
26127
  this._stopWatchSubject.complete();
26127
26128
  this._stopWatchSubject.unsubscribe();
@@ -26137,10 +26138,10 @@
26137
26138
  return this.dataService.watchAll(offset, size, sortBy, sortDirection, filter, this.serviceOptions)
26138
26139
  .pipe(operators.catchError(function (err) { return _this.handleError(err, 'ERROR.LOAD_DATA_ERROR'); }), operators.map(function (res) {
26139
26140
  if (_this._saving) {
26140
- console.info("[table-datasource] Received " + _this._entityName + " data (from service), but still saving: skip");
26141
+ console.info("[entities-table-datasource] Received " + _this._entityName + " data (from service), but still saving: skip");
26141
26142
  }
26142
26143
  else if (_this.hasSomeEditingRow()) {
26143
- console.warn("[table-datasource] Received " + _this._entityName + " data, while some row still editing: skip; Please check save() implementation in the table!");
26144
+ console.warn("[entities-table-datasource] Received " + _this._entityName + " data, while some row still editing: skip; Please check save() implementation in the table!");
26144
26145
  }
26145
26146
  else {
26146
26147
  _this.updateDatasource((res.data || []));
@@ -26158,11 +26159,11 @@
26158
26159
  // Avoid to update dataSourceSubject, when not need
26159
26160
  if ((_a = this.datasourceSubject.observers) === null || _a === void 0 ? void 0 : _a.length) {
26160
26161
  if (!this.config.suppressErrors)
26161
- console.warn('[table-datasource] Update datasource subject. Please prefer using \'rowsSubject\' instead of \'datasourceSubject\'');
26162
+ console.warn('[entities-table-datasource] Update datasource subject. Please prefer using \'rowsSubject\' instead of \'datasourceSubject\'');
26162
26163
  _super_1.prototype.updateDatasourceFromRows.call(this, rows);
26163
26164
  }
26164
26165
  else {
26165
- console.debug('[table-datasource] Skipping datasourceSubject update (not used yet).');
26166
+ console.debug('[entities-table-datasource] Skipping datasourceSubject update (not used yet).');
26166
26167
  }
26167
26168
  };
26168
26169
  EntitiesTableDataSource.prototype.save = function () {
@@ -26173,12 +26174,12 @@
26173
26174
  switch (_b.label) {
26174
26175
  case 0:
26175
26176
  if (this.config.readOnly) {
26176
- console.error('[table-datasource] Enable to save, because config.readOnly=true');
26177
+ console.error('[entities-table-datasource] Enable to save, because config.readOnly=true');
26177
26178
  return [2 /*return*/, false];
26178
26179
  }
26179
26180
  // Saving twice (should never occur)
26180
26181
  if (this._saving) {
26181
- console.warn("[table-datasource] Trying to save " + this._entityName + " rows twice. Skip");
26182
+ console.warn("[entities-table-datasource] Trying to save " + this._entityName + " rows twice. Skip");
26182
26183
  return [2 /*return*/, false];
26183
26184
  }
26184
26185
  this._saving = true;
@@ -26188,14 +26189,14 @@
26188
26189
  case 1:
26189
26190
  _b.trys.push([1, 3, 4, 5]);
26190
26191
  if (this._debug)
26191
- console.debug("[table-datasource] Saving " + this._entityName + " rows... {onlyDirtyRows: " + onlyDirtyRows + "}");
26192
+ console.debug("[entities-table-datasource] Saving " + this._entityName + " rows... {onlyDirtyRows: " + onlyDirtyRows + "}");
26192
26193
  rows = this.getRows();
26193
26194
  invalidRows = rows.filter(function (row) { return row.editing && !row.confirmEditCreate(); });
26194
26195
  // Cannot finish some rows: error
26195
26196
  if (invalidRows.length) {
26196
26197
  // log errors
26197
26198
  if (this._debug)
26198
- invalidRows.forEach(function (row) { return AppTableUtils.logRowErrors(row, "[table-datasource] " + _this._entityName + " row #" + row.id); });
26199
+ invalidRows.forEach(function (row) { return AppTableUtils.logRowErrors(row, "[entities-table-datasource] " + _this._entityName + " row #" + row.id); });
26199
26200
  // Stop with an error
26200
26201
  throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
26201
26202
  }
@@ -26222,23 +26223,23 @@
26222
26223
  // If no data to save: exit
26223
26224
  if (onlyDirtyRows && !dataToSave_1.length) {
26224
26225
  if (this._debug)
26225
- console.debug("[table-datasource] No " + this._entityName + " data to save. Skip");
26226
+ console.debug("[entities-table-datasource] No " + this._entityName + " data to save. Skip");
26226
26227
  return [2 /*return*/, false];
26227
26228
  }
26228
26229
  if (this._debug)
26229
- console.debug("[table-datasource] Asking service to save this " + this._entityName + " data:", dataToSave_1);
26230
+ console.debug("[entities-table-datasource] Asking service to save this " + this._entityName + " data:", dataToSave_1);
26230
26231
  return [4 /*yield*/, this.dataService.saveAll(dataToSave_1, this.serviceOptions)];
26231
26232
  case 2:
26232
26233
  _b.sent();
26233
26234
  if (this._debug)
26234
- console.debug("[table-datasource] Saving " + this._entityName + " data [OK]");
26235
+ console.debug("[entities-table-datasource] Saving " + this._entityName + " data [OK]");
26235
26236
  // LP 23/03/2021: update datasource is necessary but can be changed to a refetch() on QueryRef (must be created and registered in GraphqlService.watchQuery)
26236
26237
  this.updateDatasource(data, { emitEvent: false });
26237
26238
  return [2 /*return*/, true];
26238
26239
  case 3:
26239
26240
  error_1 = _b.sent();
26240
26241
  if (this._debug)
26241
- console.error('[table-datasource] Error while saving: ' + error_1 && error_1.message || error_1);
26242
+ console.error('[entities-table-datasource] Error while saving: ' + error_1 && error_1.message || error_1);
26242
26243
  throw error_1;
26243
26244
  case 4:
26244
26245
  this._saving = false;
@@ -26251,7 +26252,7 @@
26251
26252
  };
26252
26253
  EntitiesTableDataSource.prototype.updateDatasource = function (data, opts) {
26253
26254
  if (this._debug)
26254
- console.debug("[table-datasource] Updating datasource with data:", data);
26255
+ console.debug("[entities-table-datasource] Updating datasource with data:", data);
26255
26256
  _super_1.prototype.updateDatasource.call(this, data, opts);
26256
26257
  if (!opts || opts.emitEvent !== false) {
26257
26258
  this.markAsLoaded();
@@ -26263,7 +26264,8 @@
26263
26264
  return _super_1.prototype.connect.call(this, collectionViewer);
26264
26265
  };
26265
26266
  EntitiesTableDataSource.prototype.disconnect = function (collectionViewer) {
26266
- console.debug('[table-datasource] Disconnecting...');
26267
+ if (this._debug)
26268
+ console.debug('[entities-table-datasource] Disconnecting...');
26267
26269
  _super_1.prototype.disconnect.call(this, collectionViewer);
26268
26270
  this.close();
26269
26271
  };
@@ -26277,7 +26279,7 @@
26277
26279
  if (!_super_1.prototype.confirmCreate.call(this, row))
26278
26280
  return false;
26279
26281
  if (row.editing && row.validator) {
26280
- console.warn('[table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
26282
+ console.warn('[entities-table-datasource] Row still has {editing: true} after confirmCreate()! Force editing to false');
26281
26283
  row.validator.disable({ onlySelf: true, emitEvent: false });
26282
26284
  }
26283
26285
  return true;
@@ -26286,7 +26288,7 @@
26286
26288
  if (!_super_1.prototype.confirmEdit.call(this, row))
26287
26289
  return false;
26288
26290
  if (row.editing && row.validator) {
26289
- console.warn('[table-datasource] Row still has {editing: true} after confirmEdit()! Force editing to false');
26291
+ console.warn('[entities-table-datasource] Row still has {editing: true} after confirmEdit()! Force editing to false');
26290
26292
  row.validator.disable({ onlySelf: true, emitEvent: false });
26291
26293
  }
26292
26294
  return true;
@@ -26295,19 +26297,19 @@
26295
26297
  if (!_super_1.prototype.startEdit.call(this, row))
26296
26298
  return false;
26297
26299
  if (!row.editing && row.validator) {
26298
- console.warn('[table-datasource] Row still has {editing: false} after startEdit()! Force editing');
26300
+ console.warn('[entities-table-datasource] Row still has {editing: false} after startEdit()! Force editing');
26299
26301
  row.validator.enable({ onlySelf: true, emitEvent: false });
26300
26302
  }
26301
26303
  };
26302
26304
  EntitiesTableDataSource.prototype.handleError = function (error, message) {
26303
26305
  var errorMsg = error && error.message || error;
26304
- console.error("[table-datasource] Service " + this._entityName + " sent error: " + errorMsg, error);
26306
+ console.error("[entities-table-datasource] Service " + this._entityName + " sent error: " + errorMsg, error);
26305
26307
  this.markAsLoaded();
26306
26308
  throw new Error(message || errorMsg);
26307
26309
  };
26308
26310
  EntitiesTableDataSource.prototype.handleServiceError = function (error) {
26309
26311
  var errorMsg = error && error.message || error;
26310
- console.error("[table-datasource] Service " + this._entityName + " sent error: " + errorMsg, error);
26312
+ console.error("[entities-table-datasource] Service " + this._entityName + " sent error: " + errorMsg, error);
26311
26313
  this.markAsLoaded();
26312
26314
  throw error;
26313
26315
  };
@@ -26319,7 +26321,7 @@
26319
26321
  }
26320
26322
  var row = this.getRow(id);
26321
26323
  if (!row) {
26322
- console.error("[table-datasource] Row to delete with id=" + id + " not found");
26324
+ console.error("[entities-table-datasource] Row to delete with id=" + id + " not found");
26323
26325
  return;
26324
26326
  }
26325
26327
  this.markAsLoading();
@@ -26357,7 +26359,7 @@
26357
26359
  _b.sent();
26358
26360
  rowNotDeleted = this.getRows().filter(function (row) { return rows.includes(row); });
26359
26361
  if (isNotEmptyArray(rowNotDeleted)) {
26360
- console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows! Please check that data service update the cache, after deletion");
26362
+ console.warn("[entities-table-datasource] Force deletion of " + rowNotDeleted.length + " rows! Please check that data service update the cache, after deletion");
26361
26363
  rowNotDeleted
26362
26364
  // Start at the end
26363
26365
  .sort(function (a, b) { return a.id > b.id ? -1 : 1; })