@sumaris-net/ngx-components 0.27.4 → 0.27.8

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.
@@ -1046,24 +1046,35 @@
1046
1046
  * @param opts
1047
1047
  */
1048
1048
  function waitFor(predicate, opts) {
1049
- if (predicate())
1050
- return Promise.resolve(true);
1051
- var period = opts && opts.checkPeriod || 300;
1052
- var dueTime = opts && opts.dueTime || period;
1053
- var wait$ = rxjs.timer(dueTime, period)
1054
- .pipe(
1055
- // For DEBUG :
1056
- //tap(() => console.debug("Waiting form idle...", form)),
1057
- operators.filter(function (_) { return predicate(); }), operators.map(function (_) { return true; }));
1058
- // Add timeout
1059
- if (opts && opts.timeout) {
1060
- var $timeout = rxjs.timer(opts.timeout);
1061
- wait$ = rxjs.merge(wait$.pipe(operators.takeUntil($timeout)), $timeout
1062
- .pipe(operators.map(function () {
1063
- throw new Error("Timeout waitIdle() - after " + opts.timeout + "ms");
1064
- })));
1065
- }
1066
- return firstNotNilPromise(wait$);
1049
+ return __awaiter(this, void 0, void 0, function () {
1050
+ var period, dueTime, wait$, $timeout;
1051
+ return __generator(this, function (_a) {
1052
+ switch (_a.label) {
1053
+ case 0:
1054
+ if (predicate())
1055
+ return [2 /*return*/, Promise.resolve()];
1056
+ period = opts && opts.checkPeriod || 300;
1057
+ dueTime = opts && opts.dueTime || period;
1058
+ wait$ = rxjs.timer(dueTime, period)
1059
+ .pipe(
1060
+ // For DEBUG :
1061
+ //tap(() => console.debug("Waiting form idle...", form)),
1062
+ operators.filter(function (_) { return predicate(); }), operators.map(function (_) { return true; }));
1063
+ // Add timeout
1064
+ if (opts && opts.timeout) {
1065
+ $timeout = rxjs.timer(opts.timeout);
1066
+ wait$ = rxjs.merge(wait$.pipe(operators.takeUntil($timeout)), $timeout
1067
+ .pipe(operators.map(function () {
1068
+ throw new Error("Timeout waitIdle() - after " + opts.timeout + "ms");
1069
+ })));
1070
+ }
1071
+ return [4 /*yield*/, firstNotNilPromise(wait$)];
1072
+ case 1:
1073
+ _a.sent();
1074
+ return [2 /*return*/];
1075
+ }
1076
+ });
1077
+ });
1067
1078
  }
1068
1079
 
1069
1080
  function createPromiseEventEmitter() {
@@ -3471,6 +3482,9 @@
3471
3482
  AppFormProvider.prototype.ready = function () {
3472
3483
  return this.delegate.ready();
3473
3484
  };
3485
+ AppFormProvider.prototype.waitIdle = function (opts) {
3486
+ return this.delegate.waitIdle();
3487
+ };
3474
3488
  AppFormProvider.prototype.disable = function (opts) {
3475
3489
  return this.delegate.disable(opts);
3476
3490
  };
@@ -19032,8 +19046,8 @@
19032
19046
  var _this = this;
19033
19047
  this.error = null;
19034
19048
  this._enable = false;
19049
+ this._$ready = new rxjs.BehaviorSubject(false);
19035
19050
  this._loading = true;
19036
- this._$ready = new rxjs.BehaviorSubject(true);
19037
19051
  this.i18nFieldPrefix = null;
19038
19052
  this._subscription = new rxjs.Subscription();
19039
19053
  this.debug = false;
@@ -19154,6 +19168,7 @@
19154
19168
  this.onCancel.unsubscribe();
19155
19169
  this.onSubmit.complete();
19156
19170
  this.onSubmit.unsubscribe();
19171
+ this._$ready.complete();
19157
19172
  };
19158
19173
  AppForm.prototype.cancel = function () {
19159
19174
  this.onCancel.emit();
@@ -19247,6 +19262,10 @@
19247
19262
  AppForm.prototype.markAsReady = function (opts) {
19248
19263
  if (!this._$ready.value) {
19249
19264
  this._$ready.next(true);
19265
+ // If subclasses implements OnReady
19266
+ if (typeof this['ngOnReady'] === 'function') {
19267
+ this.ngOnReady();
19268
+ }
19250
19269
  }
19251
19270
  };
19252
19271
  /**
@@ -19254,14 +19273,27 @@
19254
19273
  * @param opts
19255
19274
  */
19256
19275
  AppForm.prototype.ready = function (opts) {
19257
- return firstTruePromise(this._$ready);
19276
+ return __awaiter(this, void 0, void 0, function () {
19277
+ return __generator(this, function (_b) {
19278
+ switch (_b.label) {
19279
+ case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
19280
+ case 1:
19281
+ _b.sent();
19282
+ return [2 /*return*/];
19283
+ }
19284
+ });
19285
+ });
19258
19286
  };
19259
19287
  /**
19260
19288
  * Wait form is idle (not loading)
19261
19289
  * @param opts
19262
19290
  */
19263
19291
  AppForm.prototype.waitIdle = function (opts) {
19264
- return AppFormUtils.waitIdle(this, opts);
19292
+ return __awaiter(this, void 0, void 0, function () {
19293
+ return __generator(this, function (_b) {
19294
+ return [2 /*return*/, AppFormUtils.waitIdle(this, opts)];
19295
+ });
19296
+ });
19265
19297
  };
19266
19298
  AppForm.prototype.updateValueAndValidity = function (opts) {
19267
19299
  AppFormUtils.updateValueAndValidity(this.form, opts);
@@ -24507,10 +24539,28 @@
24507
24539
  this.dataSource.move(id, direction);
24508
24540
  };
24509
24541
  AppTable.prototype.ready = function () {
24510
- return firstTruePromise(this.readySubject);
24542
+ return __awaiter(this, void 0, void 0, function () {
24543
+ return __generator(this, function (_d) {
24544
+ switch (_d.label) {
24545
+ case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
24546
+ case 1:
24547
+ _d.sent();
24548
+ return [2 /*return*/];
24549
+ }
24550
+ });
24551
+ });
24511
24552
  };
24512
- AppTable.prototype.waitIdle = function () {
24513
- return firstFalsePromise(this.loadingSubject);
24553
+ AppTable.prototype.waitIdle = function (opts) {
24554
+ return __awaiter(this, void 0, void 0, function () {
24555
+ return __generator(this, function (_d) {
24556
+ switch (_d.label) {
24557
+ case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
24558
+ case 1:
24559
+ _d.sent();
24560
+ return [2 /*return*/];
24561
+ }
24562
+ });
24563
+ });
24514
24564
  };
24515
24565
  AppTable.prototype.openSelectColumnsModal = function (event) {
24516
24566
  return __awaiter(this, void 0, void 0, function () {
@@ -25497,7 +25547,16 @@
25497
25547
  this._$ready.next(true);
25498
25548
  };
25499
25549
  AppEditor.prototype.ready = function (opts) {
25500
- return firstTruePromise(this._$ready);
25550
+ return __awaiter(this, void 0, void 0, function () {
25551
+ return __generator(this, function (_b) {
25552
+ switch (_b.label) {
25553
+ case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
25554
+ case 1:
25555
+ _b.sent();
25556
+ return [2 /*return*/];
25557
+ }
25558
+ });
25559
+ });
25501
25560
  };
25502
25561
  AppEditor.prototype.waitIdle = function (opts) {
25503
25562
  return AppFormUtils.waitIdle(this, opts);