@sumaris-net/ngx-components 0.27.5 → 0.27.9

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() {
@@ -3134,7 +3145,6 @@
3134
3145
  var endField = group.get(endDateField);
3135
3146
  var endDate = fromDateISOString(endField.value);
3136
3147
  if (isNotNil(startDate) && isNotNil(endDate) && Math.abs(startDate.diff(endDate, durationUnit)) > maxDuration) {
3137
- console.log('TODO error !');
3138
3148
  // Update end field
3139
3149
  endField.markAsTouched({ onlySelf: true });
3140
3150
  endField.markAsPending();
@@ -3471,6 +3481,9 @@
3471
3481
  AppFormProvider.prototype.ready = function () {
3472
3482
  return this.delegate.ready();
3473
3483
  };
3484
+ AppFormProvider.prototype.waitIdle = function (opts) {
3485
+ return this.delegate.waitIdle();
3486
+ };
3474
3487
  AppFormProvider.prototype.disable = function (opts) {
3475
3488
  return this.delegate.disable(opts);
3476
3489
  };
@@ -19032,15 +19045,16 @@
19032
19045
  var _this = this;
19033
19046
  this.error = null;
19034
19047
  this._enable = false;
19048
+ this._$ready = new rxjs.BehaviorSubject(false);
19035
19049
  this._loading = true;
19036
19050
  this.i18nFieldPrefix = null;
19037
19051
  this._subscription = new rxjs.Subscription();
19038
- this._$ready = new rxjs.BehaviorSubject(true);
19039
19052
  this.debug = false;
19040
19053
  this.onCancel = new i0.EventEmitter();
19041
19054
  this.onSubmit = new i0.EventEmitter();
19042
19055
  if (form)
19043
19056
  this.setForm(form);
19057
+ this.translate = injector.get(i1$2.TranslateService);
19044
19058
  this.settings = injector.get(LocalSettingsService);
19045
19059
  this.errorTranslator = injector.get(FormErrorTranslator);
19046
19060
  this.autocompleteHelper = new MatAutocompleteConfigHolder(this.settings && {
@@ -19249,7 +19263,7 @@
19249
19263
  if (!this._$ready.value) {
19250
19264
  this._$ready.next(true);
19251
19265
  // If subclasses implements OnReady
19252
- if (typeof this['nngOnReady'] === 'function') {
19266
+ if (typeof this['ngOnReady'] === 'function') {
19253
19267
  this.ngOnReady();
19254
19268
  }
19255
19269
  }
@@ -19259,14 +19273,27 @@
19259
19273
  * @param opts
19260
19274
  */
19261
19275
  AppForm.prototype.ready = function (opts) {
19262
- 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
+ });
19263
19286
  };
19264
19287
  /**
19265
19288
  * Wait form is idle (not loading)
19266
19289
  * @param opts
19267
19290
  */
19268
19291
  AppForm.prototype.waitIdle = function (opts) {
19269
- 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
+ });
19270
19297
  };
19271
19298
  AppForm.prototype.updateValueAndValidity = function (opts) {
19272
19299
  AppFormUtils.updateValueAndValidity(this.form, opts);
@@ -19274,7 +19301,9 @@
19274
19301
  this.markForCheck();
19275
19302
  };
19276
19303
  AppForm.prototype.translateControlPath = function (path) {
19277
- return this.getFieldName(path);
19304
+ var _a;
19305
+ var i18nFieldName = this.getI18nFieldName(path);
19306
+ return ((_a = this.translate) === null || _a === void 0 ? void 0 : _a.instant(i18nFieldName)) || i18nFieldName;
19278
19307
  };
19279
19308
  /* -- protected methods -- */
19280
19309
  AppForm.prototype.getFormError = function (form, opts) {
@@ -19282,7 +19311,7 @@
19282
19311
  return undefined;
19283
19312
  return this.errorTranslator.translateErrors(this.form, Object.assign({ controlPathTranslator: this }, opts));
19284
19313
  };
19285
- AppForm.prototype.getFieldName = function (path) {
19314
+ AppForm.prototype.getI18nFieldName = function (path) {
19286
19315
  return (this.i18nFieldPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
19287
19316
  };
19288
19317
  AppForm.prototype.registerSubscription = function (sub) {
@@ -19292,7 +19321,7 @@
19292
19321
  return this.autocompleteHelper.add(fieldName, opts);
19293
19322
  };
19294
19323
  AppForm.prototype.markForCheck = function () {
19295
- // Should be override by subclasses
19324
+ // Should be overwritten by subclasses
19296
19325
  console.warn('markForCheck() has been called, but is not overwritten by component ' + this.constructor.name);
19297
19326
  };
19298
19327
  return AppForm;
@@ -24512,10 +24541,28 @@
24512
24541
  this.dataSource.move(id, direction);
24513
24542
  };
24514
24543
  AppTable.prototype.ready = function () {
24515
- return firstTruePromise(this.readySubject);
24544
+ return __awaiter(this, void 0, void 0, function () {
24545
+ return __generator(this, function (_d) {
24546
+ switch (_d.label) {
24547
+ case 0: return [4 /*yield*/, firstTruePromise(this.readySubject)];
24548
+ case 1:
24549
+ _d.sent();
24550
+ return [2 /*return*/];
24551
+ }
24552
+ });
24553
+ });
24516
24554
  };
24517
- AppTable.prototype.waitIdle = function () {
24518
- return firstFalsePromise(this.loadingSubject);
24555
+ AppTable.prototype.waitIdle = function (opts) {
24556
+ return __awaiter(this, void 0, void 0, function () {
24557
+ return __generator(this, function (_d) {
24558
+ switch (_d.label) {
24559
+ case 0: return [4 /*yield*/, firstFalsePromise(this.loadingSubject)];
24560
+ case 1:
24561
+ _d.sent();
24562
+ return [2 /*return*/];
24563
+ }
24564
+ });
24565
+ });
24519
24566
  };
24520
24567
  AppTable.prototype.openSelectColumnsModal = function (event) {
24521
24568
  return __awaiter(this, void 0, void 0, function () {
@@ -25502,7 +25549,16 @@
25502
25549
  this._$ready.next(true);
25503
25550
  };
25504
25551
  AppEditor.prototype.ready = function (opts) {
25505
- return firstTruePromise(this._$ready);
25552
+ return __awaiter(this, void 0, void 0, function () {
25553
+ return __generator(this, function (_b) {
25554
+ switch (_b.label) {
25555
+ case 0: return [4 /*yield*/, firstTruePromise(this._$ready)];
25556
+ case 1:
25557
+ _b.sent();
25558
+ return [2 /*return*/];
25559
+ }
25560
+ });
25561
+ });
25506
25562
  };
25507
25563
  AppEditor.prototype.waitIdle = function (opts) {
25508
25564
  return AppFormUtils.waitIdle(this, opts);