@sumaris-net/ngx-components 1.5.11 → 1.6.0

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.
@@ -1117,6 +1117,14 @@
1117
1117
  .then(function (jobRes) { return finalResult.concat(jobRes); }); });
1118
1118
  }, null);
1119
1119
  }
1120
+ function firstTrue(obs) {
1121
+ return obs.pipe(operators.first(function (v) { return v === true; }), operators.map(function (_) { }) // Convert to void
1122
+ );
1123
+ }
1124
+ function firstFalse(obs) {
1125
+ return obs.pipe(operators.first(function (v) { return v === false; }), operators.map(function (_) { }) // Convert to void
1126
+ );
1127
+ }
1120
1128
  /**
1121
1129
  * Wait form a predicate return true. This need to implement AppFormUtils.waitWhilePending(), AppFormUtils.waitIdle()
1122
1130
  * @param predicate
@@ -1157,8 +1165,7 @@
1157
1165
  return __awaiter(this, void 0, void 0, function () {
1158
1166
  var firstTrueObservable, $timeout;
1159
1167
  return __generator(this, function (_a) {
1160
- firstTrueObservable = observable.pipe(operators.first(function (v) { return v === true; }), operators.map(function () { }) // convert to void
1161
- );
1168
+ firstTrueObservable = firstTrue(observable);
1162
1169
  // Timeout (+ dueTime)
1163
1170
  if (opts && opts.timeout > 0) {
1164
1171
  $timeout = rxjs.timer(opts.timeout);
@@ -19531,6 +19538,9 @@
19531
19538
  this.onSubmit.complete();
19532
19539
  this.onSubmit.unsubscribe();
19533
19540
  this._$ready.complete();
19541
+ this._$ready.unsubscribe();
19542
+ this._$loading.complete();
19543
+ this._$loading.unsubscribe();
19534
19544
  };
19535
19545
  AppForm.prototype.cancel = function () {
19536
19546
  this.onCancel.emit();
@@ -19636,16 +19646,7 @@
19636
19646
  * @param opts
19637
19647
  */
19638
19648
  AppForm.prototype.ready = function (opts) {
19639
- return __awaiter(this, void 0, void 0, function () {
19640
- return __generator(this, function (_b) {
19641
- switch (_b.label) {
19642
- case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
19643
- case 1:
19644
- _b.sent();
19645
- return [2 /*return*/];
19646
- }
19647
- });
19648
- });
19649
+ return waitForTrue(this._$ready, opts);
19649
19650
  };
19650
19651
  /**
19651
19652
  * Wait form is idle (not loading)
@@ -24423,7 +24424,12 @@
24423
24424
  rxjs.combineLatest([
24424
24425
  _this.onStartEditingRow,
24425
24426
  _this._destroy$
24426
- ])), operators.map(function () { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }), operators.filter(function (dirty) { return dirty === true; }), operators.first()); }))
24427
+ ])
24428
+ // DEBUG
24429
+ //.pipe(
24430
+ // tap(() => console.debug('TODO stopping previous row listener'))
24431
+ //)
24432
+ ), operators.map(function () { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }), operators.filter(function (dirty) { return dirty === true; }), operators.first()); }))
24427
24433
  .subscribe(function () { return _this.markAsDirty(); }));
24428
24434
  // Call datasource refresh, on each refresh events
24429
24435
  this.registerSubscription(this.onRefresh
@@ -25878,13 +25884,29 @@
25878
25884
  this._subscription = new rxjs.Subscription();
25879
25885
  this._enabled = false;
25880
25886
  this._dirty = false;
25881
- this._loading = true;
25882
25887
  this._$ready = new rxjs.BehaviorSubject(false);
25888
+ this._$loading = new rxjs.BehaviorSubject(true);
25883
25889
  this.debug = false;
25884
25890
  this.submitted = false;
25885
25891
  this.toolbar = null;
25886
25892
  this.formButtonsBar = null;
25887
25893
  }
25894
+ Object.defineProperty(AppEditor.prototype, "_loading", {
25895
+ /**
25896
+ * @deprecated
25897
+ */
25898
+ get: function () {
25899
+ return this._$loading.value;
25900
+ },
25901
+ /**
25902
+ * @deprecated
25903
+ */
25904
+ set: function (value) {
25905
+ this._$loading.next(value);
25906
+ },
25907
+ enumerable: false,
25908
+ configurable: true
25909
+ });
25888
25910
  Object.defineProperty(AppEditor.prototype, "tables", {
25889
25911
  get: function () {
25890
25912
  return this._children && this._children.filter(function (c) { return c instanceof AppTable; });
@@ -25937,7 +25959,7 @@
25937
25959
  Object.defineProperty(AppEditor.prototype, "loading", {
25938
25960
  get: function () {
25939
25961
  var _a;
25940
- return this._loading || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.loading; })) !== -1) || false;
25962
+ return this._$loading.value || (((_a = this._children) === null || _a === void 0 ? void 0 : _a.findIndex(function (c) { return c.enabled && c.loading; })) !== -1) || false;
25941
25963
  },
25942
25964
  enumerable: false,
25943
25965
  configurable: true
@@ -25983,6 +26005,8 @@
25983
26005
  this._subscription.unsubscribe();
25984
26006
  this._$ready.complete();
25985
26007
  this._$ready.unsubscribe();
26008
+ this._$loading.complete();
26009
+ this._$loading.unsubscribe();
25986
26010
  };
25987
26011
  AppEditor.prototype.addChildForm = function (form) {
25988
26012
  if (!form)
@@ -28747,9 +28771,11 @@
28747
28771
  exports.filterNumberInput = filterNumberInput;
28748
28772
  exports.filterTrue = filterTrue;
28749
28773
  exports.firstArrayValue = firstArrayValue;
28774
+ exports.firstFalse = firstFalse;
28750
28775
  exports.firstFalsePromise = firstFalsePromise;
28751
28776
  exports.firstNotNil = firstNotNil;
28752
28777
  exports.firstNotNilPromise = firstNotNilPromise;
28778
+ exports.firstTrue = firstTrue;
28753
28779
  exports.firstTruePromise = firstTruePromise;
28754
28780
  exports.focusInput = focusInput;
28755
28781
  exports.focusNextInput = focusNextInput;