@sumaris-net/ngx-components 0.27.3 → 0.27.7

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.
@@ -19032,8 +19032,8 @@
19032
19032
  var _this = this;
19033
19033
  this.error = null;
19034
19034
  this._enable = false;
19035
+ this._$ready = new rxjs.BehaviorSubject(false);
19035
19036
  this._loading = true;
19036
- this._ready = true;
19037
19037
  this.i18nFieldPrefix = null;
19038
19038
  this._subscription = new rxjs.Subscription();
19039
19039
  this.debug = false;
@@ -19154,6 +19154,7 @@
19154
19154
  this.onCancel.unsubscribe();
19155
19155
  this.onSubmit.complete();
19156
19156
  this.onSubmit.unsubscribe();
19157
+ this._$ready.complete();
19157
19158
  };
19158
19159
  AppForm.prototype.cancel = function () {
19159
19160
  this.onCancel.emit();
@@ -19245,10 +19246,12 @@
19245
19246
  }
19246
19247
  };
19247
19248
  AppForm.prototype.markAsReady = function (opts) {
19248
- if (!this._ready) {
19249
- this._ready = true;
19250
- if (!opts || opts.emitEvent !== false)
19251
- this.markForCheck();
19249
+ if (!this._$ready.value) {
19250
+ this._$ready.next(true);
19251
+ // If subclasses implements OnReady
19252
+ if (typeof this['ngOnReady'] === 'function') {
19253
+ this.ngOnReady();
19254
+ }
19252
19255
  }
19253
19256
  };
19254
19257
  /**
@@ -19256,8 +19259,7 @@
19256
19259
  * @param opts
19257
19260
  */
19258
19261
  AppForm.prototype.ready = function (opts) {
19259
- var _this = this;
19260
- return waitFor(function () { return _this._ready; }, opts);
19262
+ return firstTruePromise(this._$ready);
19261
19263
  };
19262
19264
  /**
19263
19265
  * Wait form is idle (not loading)
@@ -25498,8 +25500,6 @@
25498
25500
  var _a;
25499
25501
  (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(function (c) { return c.markAsReady(opts); });
25500
25502
  this._$ready.next(true);
25501
- if (!this.loading && (!opts || opts.emitEvent !== false))
25502
- this.markForCheck();
25503
25503
  };
25504
25504
  AppEditor.prototype.ready = function (opts) {
25505
25505
  return firstTruePromise(this._$ready);
@@ -26188,13 +26188,16 @@
26188
26188
  opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && isNil(this.previousDataId) && this.computeNextTabIndex() }, opts);
26189
26189
  this.data = data;
26190
26190
  this.previousDataId = data.id || null;
26191
- promiseOrVoid = this.setValue(data);
26192
- if (!promiseOrVoid) return [3 /*break*/, 2];
26193
- return [4 /*yield*/, promiseOrVoid];
26191
+ return [4 /*yield*/, this.ready()];
26194
26192
  case 1:
26195
26193
  _b.sent();
26196
- _b.label = 2;
26194
+ promiseOrVoid = this.setValue(data);
26195
+ if (!promiseOrVoid) return [3 /*break*/, 3];
26196
+ return [4 /*yield*/, promiseOrVoid];
26197
26197
  case 2:
26198
+ _b.sent();
26199
+ _b.label = 3;
26200
+ case 3:
26198
26201
  if (!opts || opts.emitEvent !== false) {
26199
26202
  this.markAsPristine();
26200
26203
  this.markAsUntouched();