@sumaris-net/ngx-components 1.13.0 → 1.13.1

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.
@@ -1187,16 +1187,6 @@
1187
1187
  });
1188
1188
  });
1189
1189
  }
1190
- function fromPromise(promise) {
1191
- var $observable = new rxjs.Subject();
1192
- promise
1193
- .then(function (errors) {
1194
- $observable.next(errors);
1195
- $observable.complete();
1196
- })
1197
- .catch(function (err) { return $observable.error(err); });
1198
- return $observable;
1199
- }
1200
1190
 
1201
1191
  function createPromiseEventEmitter() {
1202
1192
  return new i0.EventEmitter(true);
@@ -3599,21 +3589,6 @@
3599
3589
  var SharedAsyncValidators = /** @class */ (function () {
3600
3590
  function SharedAsyncValidators() {
3601
3591
  }
3602
- /**
3603
- * Create an observable validator function. Will execute the validator, then cnvert the result into an observable
3604
- * @param validatorFn any validator
3605
- */
3606
- SharedAsyncValidators.of = function (validatorFn) {
3607
- return function (control) {
3608
- var res = validatorFn(control);
3609
- if (rxjs.isObservable(res)) {
3610
- return res;
3611
- } // Already an observable
3612
- if (res instanceof Promise)
3613
- return fromPromise(res);
3614
- return rxjs.of(res);
3615
- };
3616
- };
3617
3592
  /**
3618
3593
  * Add a debounce time to a validator.
3619
3594
  * @param form
@@ -3631,8 +3606,6 @@
3631
3606
  var $disposeSubject = new rxjs.Subject();
3632
3607
  var disposeEvent$ = (opts === null || opts === void 0 ? void 0 : opts.dispose) ? rxjs.merge($disposeSubject, opts === null || opts === void 0 ? void 0 : opts.dispose)
3633
3608
  : $disposeSubject;
3634
- // Make sure validator will return an Observable - This is need by the switchMap()
3635
- var asyncValidatorFn = SharedAsyncValidators.of(validatorFn);
3636
3609
  // DEBUG
3637
3610
  if (debug && (opts === null || opts === void 0 ? void 0 : opts.dispose)) {
3638
3611
  opts === null || opts === void 0 ? void 0 : opts.dispose.pipe(operators.first()).subscribe(function () {
@@ -3654,7 +3627,16 @@
3654
3627
  console.debug(logPrefix + 'Executing...');
3655
3628
  now = Date.now();
3656
3629
  }
3657
- }), operators.switchMap(function (_) { return asyncValidatorFn(control); }),
3630
+ }), operators.switchMap(function (_) {
3631
+ // Call the validator
3632
+ var res = validatorFn(control);
3633
+ // Make sure to return an Observable
3634
+ if (rxjs.isObservable(res))
3635
+ return res;
3636
+ if (res instanceof Promise)
3637
+ return rxjs.from(res);
3638
+ return rxjs.of(res);
3639
+ }),
3658
3640
  // DEBUG
3659
3641
  operators.tap(function (res) { return debug && console.debug(logPrefix + ("Finished in " + (Date.now() - now) + "ms (" + (res ? 'with errors' : 'no error') + ")"), res); }), operators.catchError(function (error) {
3660
3642
  console.error('[debounceTime-validator] Error while executing validator. Stopping job', error);
@@ -31111,7 +31093,6 @@
31111
31093
  exports.formatLatitude = formatLatitude;
31112
31094
  exports.formatLongitude = formatLongitude;
31113
31095
  exports.fromDateISOString = fromDateISOString;
31114
- exports.fromPromise = fromPromise;
31115
31096
  exports.fromScrollEndEvent = fromScrollEndEvent;
31116
31097
  exports.fromUnixMsTimestamp = fromUnixMsTimestamp;
31117
31098
  exports.fromUnixTimestamp = fromUnixTimestamp;