@sumaris-net/ngx-components 1.11.10 → 1.11.13

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.
@@ -27425,20 +27425,23 @@
27425
27425
  });
27426
27426
  });
27427
27427
  };
27428
+ AppEntityEditor.prototype.canUserWrite = function (data, opts) {
27429
+ return this.dataService.canUserWrite(data, opts);
27430
+ };
27428
27431
  AppEntityEditor.prototype.startListenRemoteChanges = function () {
27429
27432
  var _this = this;
27430
27433
  // Skip if disable, or already listening
27431
27434
  if (this._listenChangesSubscription || !this._enableListenChanges || this.isNewData)
27432
27435
  return;
27433
27436
  // Listen for changes on server
27434
- this._listenChangesSubscription = this.dataService.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
27437
+ this._listenChangesSubscription = this.listenChanges(this.data.id, { interval: this._listenIntervalInSeconds })
27435
27438
  .pipe(operators.filter(isNotNil))
27436
27439
  .subscribe(function (data) {
27437
27440
  if (data.updateDate && data.updateDate.isAfter(_this.data.updateDate)) {
27438
27441
  if (!_this.dirty) {
27439
27442
  if (_this.debug)
27440
27443
  console.debug("[data-editor] Changes detected on server, at {" + data.updateDate + "}: reloading page...");
27441
- _this.updateView(data);
27444
+ _this.reload();
27442
27445
  }
27443
27446
  else {
27444
27447
  if (_this.debug)
@@ -27771,12 +27774,13 @@
27771
27774
  });
27772
27775
  };
27773
27776
  AppEntityEditor.prototype.reload = function () {
27777
+ var _a;
27774
27778
  return __awaiter(this, void 0, void 0, function () {
27775
27779
  return __generator(this, function (_c) {
27776
27780
  switch (_c.label) {
27777
27781
  case 0:
27778
27782
  this.markAsLoading();
27779
- return [4 /*yield*/, this.load(this.data && this.data.id)];
27783
+ return [4 /*yield*/, this.load((_a = this.data) === null || _a === void 0 ? void 0 : _a.id)];
27780
27784
  case 1:
27781
27785
  _c.sent();
27782
27786
  return [2 /*return*/];
@@ -27784,6 +27788,19 @@
27784
27788
  });
27785
27789
  });
27786
27790
  };
27791
+ AppEntityEditor.prototype.unload = function () {
27792
+ return __awaiter(this, void 0, void 0, function () {
27793
+ return __generator(this, function (_c) {
27794
+ this.stopListenRemoteChanges();
27795
+ this.form.reset();
27796
+ this.registerForms();
27797
+ this._dirty = false;
27798
+ this.data = null;
27799
+ this.saving = false;
27800
+ return [2 /*return*/];
27801
+ });
27802
+ });
27803
+ };
27787
27804
  AppEntityEditor.prototype.goBack = function (event) {
27788
27805
  var _a;
27789
27806
  return __awaiter(this, void 0, void 0, function () {
@@ -27833,10 +27850,6 @@
27833
27850
  if (!opts || opts.emitEvent !== false)
27834
27851
  this.markForCheck();
27835
27852
  };
27836
- /* -- public abstract methods (to override) -- */
27837
- AppEntityEditor.prototype.canUserWrite = function (data, opts) {
27838
- return this.dataService.canUserWrite(data, opts);
27839
- };
27840
27853
  /* -- protected methods -- */
27841
27854
  /**
27842
27855
  * Return undefined to keep same tab
@@ -27846,19 +27859,6 @@
27846
27859
  var nextTabIndex = this.selectedTabIndex + 1;
27847
27860
  return nextTabIndex < this.tabCount ? nextTabIndex : undefined;
27848
27861
  };
27849
- AppEntityEditor.prototype.unload = function () {
27850
- return __awaiter(this, void 0, void 0, function () {
27851
- return __generator(this, function (_c) {
27852
- this.stopListenRemoteChanges();
27853
- this.form.reset();
27854
- this.registerForms();
27855
- this._dirty = false;
27856
- this.data = null;
27857
- this.saving = false;
27858
- return [2 /*return*/];
27859
- });
27860
- });
27861
- };
27862
27862
  AppEntityEditor.prototype.onBeforeEntityLoad = function () {
27863
27863
  return __awaiter(this, void 0, void 0, function () {
27864
27864
  return __generator(this, function (_c) {
@@ -27982,6 +27982,9 @@
27982
27982
  }
27983
27983
  return parentUrl;
27984
27984
  };
27985
+ AppEntityEditor.prototype.listenChanges = function (id, opts) {
27986
+ return this.dataService.listenChanges(this.data.id, opts);
27987
+ };
27985
27988
  AppEntityEditor.prototype.markForCheck = function () {
27986
27989
  this.cd.markForCheck();
27987
27990
  };