@one-paragon/angular-utilities 2.0.25 → 2.0.27

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Input, Directive, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, signal, InjectionToken, computed, isSignal, Injectable, runInInjectionContext, input, Renderer2, ElementRef, booleanAttribute, Pipe, makeEnvironmentProviders, ChangeDetectionStrategy, Component, HostListener, EventEmitter, untracked, Output, effect, ContentChildren, ChangeDetectorRef, output, viewChild, EnvironmentInjector, createComponent, linkedSignal, contentChild, forwardRef, contentChildren, provideAppInitializer } from '@angular/core';
3
3
  import { shareReplay, switchAll, map, filter, tap, catchError, startWith, switchMap, mergeMap, concatMap as concatMap$1, takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
4
4
  import * as i1 from 'rxjs';
5
- import { Subject, isObservable, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, concatMap, merge, delay, pipe, fromEvent, takeUntil as takeUntil$1, tap as tap$1, switchMap as switchMap$1, scan, timestamp } from 'rxjs';
5
+ import { Subject, isObservable, of, ReplaySubject, filter as filter$1, first, map as map$1, Observable, combineLatest, Subscription, startWith as startWith$1, pairwise, pipe, concatMap, merge, delay, fromEvent, takeUntil as takeUntil$1, tap as tap$1, switchMap as switchMap$1, scan, timestamp } from 'rxjs';
6
6
  import { toObservable, toSignal, outputFromObservable } from '@angular/core/rxjs-interop';
7
7
  import { isFunction, merge as merge$1, get, sumBy, difference, groupBy, intersection, orderBy, set } from 'lodash';
8
8
  import * as i3$2 from '@angular/material/sort';
@@ -433,9 +433,7 @@ function previousAndCurrent(startingValue) {
433
433
  };
434
434
  }
435
435
  function notNull() {
436
- return (source) => {
437
- return source.pipe(filter$1((o) => o != null));
438
- };
436
+ return pipe(filter$1((o) => o != null));
439
437
  }
440
438
  function delayOn(predicate, delayTime) {
441
439
  return (src) => {
@@ -646,6 +644,7 @@ class RequestStateStore {
646
644
  return this;
647
645
  }
648
646
  onErrorWithRequest(func) {
647
+ this.errorHandled = true;
649
648
  this.subscriber(this.state$, ({ requestParams, response }) => {
650
649
  if (isErrorState(response))
651
650
  func({ requestParams, error: response.error });
@@ -685,10 +684,21 @@ class RequestStateStore {
685
684
  }
686
685
  class CancellationToken {
687
686
  }
688
- function wrapInArr(sigOrObs) {
689
- return isSignal(sigOrObs) ?
690
- computed(() => [sigOrObs()])
691
- : sigOrObs.pipe(map(a => [a]));
687
+ /**
688
+ * If any values from the array of signals or observables are null or undefined, all values will be filtered
689
+ */
690
+ function wrapInArr(...sigOrObs) {
691
+ if (isSignal(sigOrObs[0])) {
692
+ return computed(() => {
693
+ const arr = sigOrObs.map(s => s());
694
+ if (arr.some(s => s == undefined))
695
+ return undefined;
696
+ return arr;
697
+ });
698
+ }
699
+ else {
700
+ return combineLatest(sigOrObs).pipe(filter(vals => vals.every(val => val != undefined)));
701
+ }
692
702
  }
693
703
  const RequestStateStoreConfigToken = new InjectionToken('RequestStateConfig');
694
704