@sumaris-net/ngx-components 0.14.0 → 0.15.3

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.
@@ -17483,6 +17483,7 @@
17483
17483
  this.pending = false;
17484
17484
  this.error = null;
17485
17485
  this.enabled = false;
17486
+ this.loading = false;
17486
17487
  }
17487
17488
  Object.defineProperty(AppNullForm.prototype, "disabled", {
17488
17489
  get: function () {
@@ -17587,6 +17588,13 @@
17587
17588
  enumerable: false,
17588
17589
  configurable: true
17589
17590
  });
17591
+ Object.defineProperty(AppFormHolder.prototype, "loading", {
17592
+ get: function () {
17593
+ return this.delegate.loading;
17594
+ },
17595
+ enumerable: false,
17596
+ configurable: true
17597
+ });
17590
17598
  AppFormHolder.prototype.disable = function (opts) {
17591
17599
  return this.delegate.disable(opts);
17592
17600
  };
@@ -17625,6 +17633,7 @@
17625
17633
  AppFormUtils.markAsTouched = markAsTouched;
17626
17634
  AppFormUtils.markAsUntouched = markAsUntouched;
17627
17635
  AppFormUtils.waitWhilePending = waitWhilePending;
17636
+ AppFormUtils.waitIdle = waitIdle;
17628
17637
  AppFormUtils.updateValueAndValidity = updateValueAndValidity;
17629
17638
  AppFormUtils.getFormErrors = getFormErrors;
17630
17639
  // ArrayForm
@@ -17978,7 +17987,29 @@
17978
17987
  .pipe(
17979
17988
  // For DEBUG :
17980
17989
  //tap(() => console.debug("Waiting async validator...", form)),
17981
- operators.filter(function () { return stop || !form.pending; }), operators.first()).toPromise();
17990
+ operators.filter(function (_) { return stop || !form.pending; }), operators.map(function (_) { return !stop; }), operators.first()).toPromise();
17991
+ }
17992
+ /**
17993
+ * Wait form is idle (not loading). This need to implement IAppForm.loading
17994
+ * @param form
17995
+ * @param opts
17996
+ */
17997
+ function waitIdle(form, opts) {
17998
+ var period = opts && opts.checkPeriod || 300;
17999
+ if (!form.loading)
18000
+ return;
18001
+ var stop = false;
18002
+ if (opts && opts.timeout) {
18003
+ setTimeout(function () {
18004
+ console.warn("Waiting form idle: timeout reached (after " + opts.timeout + "ms)");
18005
+ stop = true;
18006
+ }, opts.timeout);
18007
+ }
18008
+ return rxjs.timer(period, period)
18009
+ .pipe(
18010
+ // For DEBUG :
18011
+ //tap(() => console.debug("Waiting form idle...", form)),
18012
+ operators.filter(function () { return stop || !form.loading; }), operators.map(function (_) { return !stop; }), operators.first()).toPromise();
17982
18013
  }
17983
18014
  function isControlHasInput(controls, controlName) {
17984
18015
  // true if the control has a value and its 'calculated' control has the value 'false'
@@ -18651,6 +18682,13 @@
18651
18682
  AppFormUtils.updateValueAndValidity(this.form, opts);
18652
18683
  this.markForCheck();
18653
18684
  };
18685
+ /**
18686
+ * Wait form is idle (not loading)
18687
+ * @param opts
18688
+ */
18689
+ AppForm.prototype.waitIdle = function () {
18690
+ return AppFormUtils.waitIdle(this);
18691
+ };
18654
18692
  /* -- protected methods -- */
18655
18693
  AppForm.prototype.registerSubscription = function (sub) {
18656
18694
  return this._subscription.add(sub);
@@ -24397,10 +24435,10 @@
24397
24435
  this._subscription = new rxjs.Subscription();
24398
24436
  this._enabled = false;
24399
24437
  this._dirty = false;
24438
+ this._loading = true;
24400
24439
  this.debug = false;
24401
24440
  this.selectedTabIndex = 0;
24402
24441
  this.submitted = false;
24403
- this.loading = true;
24404
24442
  this.toolbar = null;
24405
24443
  this.formButtonsBar = null;
24406
24444
  options = Object.assign({ tabCount: 1, tabGroupAnimationDuration: '200ms', enableSwipe: true }, options);
@@ -24447,6 +24485,13 @@
24447
24485
  enumerable: false,
24448
24486
  configurable: true
24449
24487
  });
24488
+ Object.defineProperty(AppTabEditor.prototype, "loading", {
24489
+ get: function () {
24490
+ return this._loading || this._children && this._children.find(function (c) { return c.loading; }) && true;
24491
+ },
24492
+ enumerable: false,
24493
+ configurable: true
24494
+ });
24450
24495
  Object.defineProperty(AppTabEditor.prototype, "enabled", {
24451
24496
  get: function () {
24452
24497
  return this._enabled;
@@ -24564,15 +24609,15 @@
24564
24609
  this.markForCheck();
24565
24610
  };
24566
24611
  AppTabEditor.prototype.markAsLoading = function (opts) {
24567
- if (!this.loading) {
24568
- this.loading = true;
24612
+ if (!this._loading) {
24613
+ this._loading = true;
24569
24614
  if (!opts || opts.emitEvent !== false)
24570
24615
  this.markForCheck();
24571
24616
  }
24572
24617
  };
24573
24618
  AppTabEditor.prototype.markAsLoaded = function (opts) {
24574
- if (this.loading) {
24575
- this.loading = false;
24619
+ if (this._loading) {
24620
+ this._loading = false;
24576
24621
  if (!opts || opts.emitEvent !== false)
24577
24622
  this.markForCheck();
24578
24623
  }
@@ -24662,7 +24707,7 @@
24662
24707
  return __awaiter(this, void 0, void 0, function () {
24663
24708
  return __generator(this, function (_a) {
24664
24709
  console.debug('[tab-page] Unloading data...');
24665
- this.loading = true;
24710
+ this._loading = true;
24666
24711
  this.selectedTabIndex = 0;
24667
24712
  this._children.forEach(function (f) {
24668
24713
  if (f instanceof AppForm) {
@@ -25542,7 +25587,7 @@
25542
25587
  return __generator(this, function (_a) {
25543
25588
  switch (_a.label) {
25544
25589
  case 0:
25545
- this.loading = true;
25590
+ this._loading = true;
25546
25591
  return [4 /*yield*/, this.load(this.data && this.data.id)];
25547
25592
  case 1:
25548
25593
  _a.sent();
@@ -27284,6 +27329,7 @@
27284
27329
  exports.trimEmptyToNull = trimEmptyToNull;
27285
27330
  exports.uncapitalizeFirstLetter = uncapitalizeFirstLetter;
27286
27331
  exports.updateValueAndValidity = updateValueAndValidity;
27332
+ exports.waitIdle = waitIdle;
27287
27333
  exports.waitWhilePending = waitWhilePending;
27288
27334
  exports.ɵ0 = ɵ0$5;
27289
27335
  exports.ɵa = CustomReuseStrategy;