@one-paragon/angular-utilities 2.0.19 → 2.0.21-beta.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.
- package/fesm2022/one-paragon-angular-utilities.mjs +113 -108
- package/fesm2022/one-paragon-angular-utilities.mjs.map +1 -1
- package/http-request-state/RequestStateFactory.d.ts +17 -0
- package/http-request-state/{HttpRequestStateStore.d.ts → RequestStateStore.d.ts} +20 -21
- package/http-request-state/directives/HttpStateDirectiveBase.d.ts +2 -2
- package/http-request-state/directives/http-error-state-directive.d.ts +2 -2
- package/http-request-state/directives/http-inProgress-state-directive.d.ts +2 -2
- package/http-request-state/directives/http-notStarted-state-directive.d.ts +2 -2
- package/http-request-state/directives/http-success-state-directive.d.ts +4 -4
- package/http-request-state/directives/request-state-directive.d.ts +7 -7
- package/http-request-state/helpers.d.ts +9 -9
- package/http-request-state/index.d.ts +3 -3
- package/http-request-state/request-state.d.ts +12 -0
- package/http-request-state/rxjs/getRequestorBody.d.ts +2 -2
- package/http-request-state/rxjs/getRequestorState.d.ts +2 -2
- package/http-request-state/rxjs/tapError.d.ts +2 -2
- package/http-request-state/rxjs/tapSuccess.d.ts +2 -2
- package/http-request-state/types.d.ts +17 -17
- package/package.json +1 -1
- package/http-request-state/HttpRequestStateFactory.d.ts +0 -17
- package/http-request-state/http-request-state.d.ts +0 -12
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, computed, isSignal, Injectable,
|
|
2
|
+
import { Directive, Input, inject, Injector, TemplateRef, ViewContainerRef, NgModule, assertInInjectionContext, DestroyRef, signal, computed, isSignal, Injectable, runInInjectionContext, input, Renderer2, ElementRef, booleanAttribute, Pipe, InjectionToken, makeEnvironmentProviders, Component, ChangeDetectionStrategy, 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, fromEvent, takeUntil as takeUntil$1, tap as tap$1, switchMap as switchMap$1, scan, timestamp } from 'rxjs';
|
|
6
|
-
import { ComponentStore } from '@ngrx/component-store';
|
|
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';
|
|
7
6
|
import { toObservable, toSignal, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
7
|
+
import { isFunction, merge as merge$1, get, sumBy, difference, intersection, groupBy, orderBy, set } from 'lodash';
|
|
8
8
|
import * as i3$2 from '@angular/material/sort';
|
|
9
9
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
10
|
-
import { merge as merge$1, get, sumBy, difference, intersection, groupBy, orderBy, set, isFunction as isFunction$1 } from 'lodash';
|
|
11
10
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
12
11
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
13
12
|
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
|
@@ -21,6 +20,7 @@ import { NgControl, FormsModule, ControlContainer, NgForm, NG_VALUE_ACCESSOR } f
|
|
|
21
20
|
import * as i9 from '@angular/material/core';
|
|
22
21
|
import { MatOption } from '@angular/material/core';
|
|
23
22
|
import { DatePipe, CurrencyPipe, KeyValuePipe, NgTemplateOutlet, formatDate, formatCurrency, DecimalPipe, CommonModule, AsyncPipe } from '@angular/common';
|
|
23
|
+
import { ComponentStore } from '@ngrx/component-store';
|
|
24
24
|
import * as i5 from '@angular/cdk/drag-drop';
|
|
25
25
|
import { moveItemInArray, DragDropModule, CDK_DROP_LIST, CdkDropList, transferArrayItem } from '@angular/cdk/drag-drop';
|
|
26
26
|
import * as i1$1 from '@angular/material/input';
|
|
@@ -58,41 +58,41 @@ import { createEntityAdapter } from '@ngrx/entity';
|
|
|
58
58
|
import * as i1$a from '@angular/material/progress-spinner';
|
|
59
59
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
60
60
|
|
|
61
|
-
var
|
|
62
|
-
(function (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})(
|
|
69
|
-
var
|
|
70
|
-
(function (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})(
|
|
61
|
+
var RequestStatus;
|
|
62
|
+
(function (RequestStatus) {
|
|
63
|
+
RequestStatus[RequestStatus["notStarted"] = 0] = "notStarted";
|
|
64
|
+
RequestStatus[RequestStatus["inProgress"] = 1] = "inProgress";
|
|
65
|
+
RequestStatus[RequestStatus["success"] = 2] = "success";
|
|
66
|
+
RequestStatus[RequestStatus["fail"] = 3] = "fail";
|
|
67
|
+
RequestStatus[RequestStatus["cancelled"] = 4] = "cancelled";
|
|
68
|
+
})(RequestStatus || (RequestStatus = {}));
|
|
69
|
+
var RequestStrategy;
|
|
70
|
+
(function (RequestStrategy) {
|
|
71
|
+
RequestStrategy[RequestStrategy["concurrent"] = 1] = "concurrent";
|
|
72
|
+
RequestStrategy[RequestStrategy["singleUse"] = 2] = "singleUse";
|
|
73
|
+
RequestStrategy[RequestStrategy["cancelPrevious"] = 3] = "cancelPrevious";
|
|
74
|
+
RequestStrategy[RequestStrategy["sequential"] = 4] = "sequential";
|
|
75
|
+
})(RequestStrategy || (RequestStrategy = {}));
|
|
76
76
|
|
|
77
77
|
function isErrorState(state) {
|
|
78
|
-
return state.status ===
|
|
78
|
+
return state.status === RequestStatus.fail;
|
|
79
79
|
}
|
|
80
80
|
function isSuccessState(state) {
|
|
81
|
-
return state.status ===
|
|
81
|
+
return state.status === RequestStatus.success;
|
|
82
82
|
}
|
|
83
83
|
function isSuccessOrErrorState(state) {
|
|
84
|
-
return state.status ===
|
|
84
|
+
return state.status === RequestStatus.success || state.status === RequestStatus.fail;
|
|
85
85
|
}
|
|
86
86
|
function createSuccess(body) {
|
|
87
|
-
return { status:
|
|
87
|
+
return { status: RequestStatus.success, body };
|
|
88
88
|
}
|
|
89
89
|
function createFailure(error) {
|
|
90
|
-
return { status:
|
|
90
|
+
return { status: RequestStatus.fail, error };
|
|
91
91
|
}
|
|
92
|
-
const notStarted = { status:
|
|
93
|
-
const inProgress = { status:
|
|
92
|
+
const notStarted = { status: RequestStatus.notStarted };
|
|
93
|
+
const inProgress = { status: RequestStatus.inProgress };
|
|
94
94
|
function statusIsSuccessOrInProgress(status) {
|
|
95
|
-
return [
|
|
95
|
+
return [RequestStatus.success, RequestStatus.inProgress].includes(status);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function defaultShareReplay() {
|
|
@@ -131,10 +131,10 @@ class HttpRequestStateDirective {
|
|
|
131
131
|
this.subscription = this.state.subscribe(state => {
|
|
132
132
|
this.ViewContext.$implicit = state;
|
|
133
133
|
this.ViewContext.state = state;
|
|
134
|
-
this.ViewContext.status.inProgress = state.status ===
|
|
135
|
-
this.ViewContext.status.notStarted = state.status ===
|
|
136
|
-
this.ViewContext.status.success = state.status ===
|
|
137
|
-
this.ViewContext.status.error = state.status ===
|
|
134
|
+
this.ViewContext.status.inProgress = state.status === RequestStatus.inProgress;
|
|
135
|
+
this.ViewContext.status.notStarted = state.status === RequestStatus.notStarted;
|
|
136
|
+
this.ViewContext.status.success = state.status === RequestStatus.success;
|
|
137
|
+
this.ViewContext.status.error = state.status === RequestStatus.fail;
|
|
138
138
|
this.hooks.forEach(hook => hook(state));
|
|
139
139
|
});
|
|
140
140
|
}
|
|
@@ -204,7 +204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
204
204
|
|
|
205
205
|
class HttpInProgressStateDirective extends HttpStateDirectiveBase {
|
|
206
206
|
render = (state) => {
|
|
207
|
-
if (state.status ===
|
|
207
|
+
if (state.status === RequestStatus.inProgress) {
|
|
208
208
|
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
209
209
|
return true;
|
|
210
210
|
}
|
|
@@ -223,7 +223,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
223
223
|
|
|
224
224
|
class HttpNotStartedStateDirective extends HttpStateDirectiveBase {
|
|
225
225
|
render = (state) => {
|
|
226
|
-
if (state.status ===
|
|
226
|
+
if (state.status === RequestStatus.notStarted) {
|
|
227
227
|
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
228
228
|
return true;
|
|
229
229
|
}
|
|
@@ -314,7 +314,7 @@ function httpRequestor(req) {
|
|
|
314
314
|
}
|
|
315
315
|
function chainRequest(httpState$, request, requestParams) {
|
|
316
316
|
return httpState$.pipe(switchMap(res => {
|
|
317
|
-
if (res.status ===
|
|
317
|
+
if (res.status === RequestStatus.success) {
|
|
318
318
|
const secondReq = httpRequestor(request);
|
|
319
319
|
const param = requestParams(res.body);
|
|
320
320
|
secondReq.request(...param);
|
|
@@ -484,7 +484,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
484
484
|
type: Directive
|
|
485
485
|
}] });
|
|
486
486
|
function subscriber(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
487
|
-
const destroyRef = getDestroyRef
|
|
487
|
+
const destroyRef = getDestroyRef(obsOrSubOrInjector, actionOrInjector, injector);
|
|
488
488
|
const subscriber = new Subscriber();
|
|
489
489
|
if (obsOrSubOrInjector instanceof Subscription) {
|
|
490
490
|
subscriber.handle(obsOrSubOrInjector);
|
|
@@ -495,7 +495,7 @@ function subscriber(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
|
495
495
|
destroyRef.onDestroy(() => subscriber?.ngOnDestroy());
|
|
496
496
|
return subscriber;
|
|
497
497
|
}
|
|
498
|
-
function getDestroyRef
|
|
498
|
+
function getDestroyRef(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
499
499
|
const providedInjector = obsOrSubOrInjector instanceof Injector ? obsOrSubOrInjector
|
|
500
500
|
: actionOrInjector instanceof Injector ? actionOrInjector
|
|
501
501
|
: injector;
|
|
@@ -511,68 +511,79 @@ function getDestroyRef$1(obsOrSubOrInjector, actionOrInjector, injector) {
|
|
|
511
511
|
return destroyRef;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
-
class
|
|
514
|
+
class RequestStateStore {
|
|
515
|
+
_state = signal({ requestParams: null, response: notStarted });
|
|
516
|
+
setState = (state) => this._state.set(state);
|
|
517
|
+
state = this._state.asReadonly();
|
|
518
|
+
state$ = toObservable(this.state);
|
|
515
519
|
options;
|
|
516
520
|
project;
|
|
517
521
|
req;
|
|
518
|
-
injector;
|
|
522
|
+
injector = inject(Injector);
|
|
523
|
+
destroy$ = new Subject();
|
|
519
524
|
constructor(req, options, project) {
|
|
520
|
-
|
|
525
|
+
this.assertInjectionContext();
|
|
526
|
+
this.injector.get(DestroyRef).onDestroy(() => this.destroy$.next());
|
|
521
527
|
this.project = project;
|
|
522
528
|
this.options = options;
|
|
523
|
-
this.injector = options?.injector;
|
|
524
529
|
this.req = req;
|
|
525
|
-
this.request = (this.options?.strategy ===
|
|
526
|
-
if (options?.
|
|
527
|
-
this.request(
|
|
530
|
+
this.request = (this.options?.strategy === RequestStrategy.singleUse) ? this.singleUseRequest : this.flattenedRequest;
|
|
531
|
+
if (options?.autoRequest) {
|
|
532
|
+
this.request();
|
|
528
533
|
}
|
|
529
534
|
}
|
|
530
535
|
reset() {
|
|
531
|
-
this.
|
|
536
|
+
this._state.set({ requestParams: null, response: notStarted });
|
|
532
537
|
}
|
|
533
538
|
flatteningStrategy = () => {
|
|
534
|
-
if (this.options?.strategy ===
|
|
539
|
+
if (this.options?.strategy === RequestStrategy.concurrent)
|
|
535
540
|
return mergeMap((params) => this.createRequest(...params));
|
|
536
|
-
if (this.options?.strategy ===
|
|
541
|
+
if (this.options?.strategy === RequestStrategy.sequential)
|
|
537
542
|
return concatMap$1((params) => this.createRequest(...params));
|
|
538
543
|
return switchMap((params) => (params[0] instanceof CancellationToken) ?
|
|
539
|
-
of({ requestParams: params[0], response: { status:
|
|
544
|
+
of({ requestParams: params[0], response: { status: RequestStatus.cancelled } }) : this.createRequest(...params));
|
|
540
545
|
};
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
546
|
+
createRequestPipeline = () => {
|
|
547
|
+
const origin$ = new Subject();
|
|
548
|
+
const sub = origin$.pipe(this.flatteningStrategy(), tap(state => this.setState(state)), pipe(takeUntil(this.destroy$))).subscribe();
|
|
549
|
+
return (params) => {
|
|
550
|
+
origin$.next(params);
|
|
551
|
+
return sub;
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
requestPipeLine = this.createRequestPipeline();
|
|
544
555
|
flattenedRequest = (...value) => {
|
|
545
|
-
return this.
|
|
556
|
+
return this.requestPipeLine(value);
|
|
546
557
|
};
|
|
547
558
|
singleUseRequest = (...value) => {
|
|
548
|
-
if (this.
|
|
559
|
+
if (this.state().response.status !== RequestStatus.notStarted) {
|
|
549
560
|
throw new Error("state can not be reused. either reset the state by calling reset() or use a state requester that allows concurrent requests.");
|
|
550
561
|
}
|
|
551
|
-
return this.
|
|
562
|
+
return this.requestPipeLine(value);
|
|
552
563
|
};
|
|
553
|
-
$
|
|
554
|
-
|
|
555
|
-
$selectStatus = computed(() => this.$
|
|
556
|
-
selectStatus$ = this.
|
|
557
|
-
$isSuccess = computed(() => isSuccessState(this.$
|
|
558
|
-
$isError = computed(() => isErrorState(this.$
|
|
559
|
-
$isInProgress = computed(() => this.$selectStatus() ===
|
|
560
|
-
$isNotStarted = computed(() => this.$selectStatus() ===
|
|
561
|
-
selectError$ = this.
|
|
564
|
+
$selectRequestState = computed(() => this.state().response);
|
|
565
|
+
selectRequestState$ = this.state$.pipe(map(s => s.response));
|
|
566
|
+
$selectStatus = computed(() => this.$selectRequestState()?.status);
|
|
567
|
+
selectStatus$ = this.selectRequestState$.pipe(map(s => s.status));
|
|
568
|
+
$isSuccess = computed(() => isSuccessState(this.$selectRequestState()));
|
|
569
|
+
$isError = computed(() => isErrorState(this.$selectRequestState()));
|
|
570
|
+
$isInProgress = computed(() => this.$selectStatus() === RequestStatus.inProgress);
|
|
571
|
+
$isNotStarted = computed(() => this.$selectStatus() === RequestStatus.notStarted);
|
|
572
|
+
selectError$ = this.selectRequestState$.pipe(filter(isErrorState), map(state => state.error));
|
|
562
573
|
$selectError = computed(() => {
|
|
563
|
-
const state = this.$
|
|
574
|
+
const state = this.$selectRequestState();
|
|
564
575
|
if (isErrorState(state))
|
|
565
576
|
return state.error;
|
|
566
577
|
});
|
|
567
|
-
selectResponse$ = this.
|
|
578
|
+
selectResponse$ = this.selectRequestState$.pipe(filter(isSuccessState), map(state => state.body));
|
|
568
579
|
$selectResponse = computed(() => {
|
|
569
|
-
const state = this.$
|
|
580
|
+
const state = this.$selectRequestState();
|
|
570
581
|
if (isSuccessState(state)) {
|
|
571
582
|
return state.body;
|
|
572
583
|
}
|
|
573
584
|
return undefined;
|
|
574
585
|
});
|
|
575
|
-
selectSuccessOrError$ = this.state$.pipe(map(r => r.response), filter(isSuccessOrErrorState), map(() =>
|
|
586
|
+
selectSuccessOrError$ = this.state$.pipe(map(r => r.response), filter(isSuccessOrErrorState), map(() => undefined));
|
|
576
587
|
errorHandled = false;
|
|
577
588
|
onError(cb) {
|
|
578
589
|
this.errorHandled = true;
|
|
@@ -588,36 +599,26 @@ class HttpRequestStateStore extends ComponentStore {
|
|
|
588
599
|
return this;
|
|
589
600
|
}
|
|
590
601
|
onSuccessWithRequest(func) {
|
|
591
|
-
this.
|
|
592
|
-
if (isSuccessState(response))
|
|
602
|
+
this.on(this.state$, ({ requestParams, response }) => {
|
|
603
|
+
if (isSuccessState(response))
|
|
593
604
|
func({ requestParams, body: response.body });
|
|
594
|
-
}
|
|
595
605
|
});
|
|
596
606
|
return this;
|
|
597
607
|
}
|
|
598
608
|
onErrorWithRequest(func) {
|
|
599
|
-
this.
|
|
600
|
-
if (isErrorState(response))
|
|
609
|
+
this.on(this.state$, ({ requestParams, response }) => {
|
|
610
|
+
if (isErrorState(response))
|
|
601
611
|
func({ requestParams, error: response.error });
|
|
602
|
-
}
|
|
603
612
|
});
|
|
604
613
|
return this;
|
|
605
614
|
}
|
|
606
615
|
createRequest(...params) {
|
|
607
616
|
return this.req(...params).pipe(map(re => createSuccess((this.project ? this.project(re) : re))), mapError(createFailure), startWith(inProgress), map(state => ({ requestParams: params, response: state })), defaultShareReplay());
|
|
608
617
|
}
|
|
609
|
-
onUpdate(func) {
|
|
610
|
-
this.on(this.state$, func);
|
|
611
|
-
}
|
|
612
618
|
on = (srcObservable, func) => {
|
|
613
|
-
return
|
|
614
|
-
return src.pipe(tap(func));
|
|
615
|
-
})(srcObservable);
|
|
619
|
+
return srcObservable.pipe(tap(func), takeUntil(this.destroy$)).subscribe();
|
|
616
620
|
};
|
|
617
621
|
request;
|
|
618
|
-
ngOnDestroy() {
|
|
619
|
-
super.ngOnDestroy();
|
|
620
|
-
}
|
|
621
622
|
requestWith = (params) => {
|
|
622
623
|
if (isSignal(params)) {
|
|
623
624
|
params = toObservable(params, { injector: this.injector }).pipe(notNull());
|
|
@@ -625,12 +626,19 @@ class HttpRequestStateStore extends ComponentStore {
|
|
|
625
626
|
params.pipe(takeUntil(this.destroy$)).subscribe((p) => this.request(...p));
|
|
626
627
|
return this;
|
|
627
628
|
};
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
assertInjectionContext() {
|
|
630
|
+
try {
|
|
631
|
+
assertInInjectionContext(RequestStateStore);
|
|
632
|
+
}
|
|
633
|
+
catch (error) {
|
|
634
|
+
throw new Error('RequestStateStore must be created in an Injection Context');
|
|
635
|
+
}
|
|
636
|
+
;
|
|
637
|
+
}
|
|
638
|
+
destroy() {
|
|
639
|
+
this.destroy$.next();
|
|
640
|
+
}
|
|
630
641
|
}
|
|
631
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: HttpRequestStateStore, decorators: [{
|
|
632
|
-
type: Directive
|
|
633
|
-
}], ctorParameters: () => [{ type: undefined }, { type: undefined }, { type: undefined }] });
|
|
634
642
|
class CancellationToken {
|
|
635
643
|
}
|
|
636
644
|
function wrapInArr(sigOrObs) {
|
|
@@ -639,41 +647,39 @@ function wrapInArr(sigOrObs) {
|
|
|
639
647
|
: sigOrObs.pipe(map(a => [a]));
|
|
640
648
|
}
|
|
641
649
|
|
|
642
|
-
class
|
|
650
|
+
class RequestStateFactory {
|
|
643
651
|
constructor() { }
|
|
644
652
|
ngOnDestroy() {
|
|
645
|
-
this.requestors.forEach(request => request.
|
|
653
|
+
this.requestors.forEach(request => request.destroy());
|
|
646
654
|
}
|
|
647
655
|
requestors = [];
|
|
648
656
|
create(req, optionsOrProject, options) {
|
|
649
|
-
const requestor = (typeof (optionsOrProject) === 'function' ? new
|
|
657
|
+
const requestor = (typeof (optionsOrProject) === 'function' ? new RequestStateStore(req, options, optionsOrProject) : new RequestStateStore(req, optionsOrProject));
|
|
650
658
|
this.requestors.push(requestor);
|
|
651
659
|
return requestor;
|
|
652
660
|
}
|
|
653
661
|
createHttpClient(r, options) {
|
|
654
|
-
const requestor = new
|
|
662
|
+
const requestor = new RequestStateStore(r, options);
|
|
655
663
|
this.requestors.push(requestor);
|
|
656
664
|
return requestor;
|
|
657
665
|
}
|
|
658
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
659
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
666
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
667
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory });
|
|
660
668
|
}
|
|
661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
669
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory, decorators: [{
|
|
662
670
|
type: Injectable
|
|
663
671
|
}], ctorParameters: () => [] });
|
|
664
672
|
function createRequestor(req, optionsOrProject, options) {
|
|
665
673
|
const ops = isFunction(optionsOrProject) ? options : optionsOrProject;
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
function isFunction(value) {
|
|
674
|
-
return typeof value === 'function';
|
|
674
|
+
const injector = getInjector(ops);
|
|
675
|
+
return runInInjectionContext(injector, () => {
|
|
676
|
+
const requestStore = typeof (optionsOrProject) === 'function' ?
|
|
677
|
+
new RequestStateStore(req, options, optionsOrProject)
|
|
678
|
+
: new RequestStateStore(req, optionsOrProject);
|
|
679
|
+
return requestStore;
|
|
680
|
+
});
|
|
675
681
|
}
|
|
676
|
-
function
|
|
682
|
+
function getInjector(options) {
|
|
677
683
|
const providedInjector = options?.injector;
|
|
678
684
|
if (!providedInjector) {
|
|
679
685
|
try {
|
|
@@ -683,8 +689,7 @@ function getDestroyRef(options) {
|
|
|
683
689
|
throw new Error('createRequestor() must be used in an Injection Context or you must provide an injector to createRequestor()');
|
|
684
690
|
}
|
|
685
691
|
}
|
|
686
|
-
|
|
687
|
-
return destroyRef;
|
|
692
|
+
return providedInjector ?? inject(Injector);
|
|
688
693
|
}
|
|
689
694
|
|
|
690
695
|
var FieldType;
|
|
@@ -5415,7 +5420,7 @@ class TableContainerComponent {
|
|
|
5415
5420
|
$tableIdInput = input(undefined, { alias: 'tableId' });
|
|
5416
5421
|
$trackByInput = input(undefined, { alias: 'trackBy' });
|
|
5417
5422
|
$inputFilters = input([], { alias: 'inputFilters' });
|
|
5418
|
-
$filterInfoInputs = computed(() => this.$inputFilters().filter(i => !isFunction
|
|
5423
|
+
$filterInfoInputs = computed(() => this.$inputFilters().filter(i => !isFunction(i)));
|
|
5419
5424
|
$indexColumnInput = input(false, { alias: 'indexColumn' });
|
|
5420
5425
|
$selectionColumnInput = input(false, { alias: 'selectionColumn' });
|
|
5421
5426
|
$stickyHeaderInput = input(true, { alias: 'stickyHeader' });
|
|
@@ -5604,7 +5609,7 @@ class TableContainerComponent {
|
|
|
5604
5609
|
return [...tableBuilderMetaData, ...mappedCustomCellMetaDatas];
|
|
5605
5610
|
});
|
|
5606
5611
|
$preds = computed(() => {
|
|
5607
|
-
const predicateInputFilters = this.$inputFilters().filter(isFunction
|
|
5612
|
+
const predicateInputFilters = this.$inputFilters().filter(isFunction);
|
|
5608
5613
|
const notSavableFilterDirectives = this.$allFilterDirectives()
|
|
5609
5614
|
.filter(d => !d.savable)
|
|
5610
5615
|
.map(d => d.$filter())
|
|
@@ -6100,5 +6105,5 @@ function setUpStoreFactoryOld(store, env) {
|
|
|
6100
6105
|
* Generated bundle index. Do not edit.
|
|
6101
6106
|
*/
|
|
6102
6107
|
|
|
6103
|
-
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DefaultVirtualScrollOptions, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FilterType, FunctionPipe, GenColDisplayerComponent, GenFilterDisplayerComponent, GeneralTableSettings, GenericTableComponent, GroupByListComponent, HttpErrorStateDirective, HttpInProgressStateDirective, HttpNotStartedStateDirective, HttpRequestModule, HttpRequestStateDirective,
|
|
6108
|
+
export { ActionStateSpinnerComponent, ActionStateUiModule, ActionStatus, AppStatusState, ArrayStyle, AutoFocusDirective, CancellationToken, ClickEmitterDirective, ClickSubjectDirective, ConditionalClassesDirective, CreateTableBuilder, CustomCellDirective, DateFilterComponent, DefaultVirtualScrollOptions, DialogDirective, DialogService, DialogWrapper, FieldType, FilterChipsComponent, FilterComponent, FilterType, FunctionPipe, GenColDisplayerComponent, GenFilterDisplayerComponent, GeneralTableSettings, GenericTableComponent, GroupByListComponent, HttpErrorStateDirective, HttpInProgressStateDirective, HttpNotStartedStateDirective, HttpRequestModule, HttpRequestStateDirective, HttpSuccessStateDirective, MatButtonToggleFilterDirective, MatCheckboxTbFilterDirective, MatOptionTbFilterDirective, MatRadioButtonTbFilterDirective, MatSlideToggleGroupDirective, MatSlideToggleTbFilterDirective, MatTableObservableDataSource, MultiSortDirective, NgrxExtModule, NotPersistedTableSettings, PaginatorComponent, PaginatorOptions, PersistedTableSettings, PhoneNumberPipe, PreventEnterDirective, RequestStateFactory, RequestStateStore, RequestStatus, RequestStrategy, ResizeColumnDirective, SortDirection, SpaceCasePipe, StopPropagationDirective, StylerDirective, Subjectifier, Subscriber, TableBuilder, TableBuilderConfigToken, TableBuilderModule, TableColumnFooterSettings, TableColumnHeaderSettings, TableContainerComponent, TableCustomFilterDirective, TableCustomFilterDirectiveBase, TableFilterDirective, TableFilterStringContainsDirective, TableSettings, TableWrapperDirective, TableWrapperFooterSettings, TableWrapperHeaderSettings, Target, TbSelectedFilterDirective, TrimWhitespaceDirective, UtilitiesModule, VirtualScrollOptions, actionStatusReducer, chainRequest, clearActionableSelectorRequestCache, combineArrays, createActionResultSelector, createActionSelector, createActionableResultSelector, createActionableSelector, createFailure, createRequestor, createSuccess, defaultFilter, defaultShareReplay, delayOn, filterArray, getRequestorBody, getRequestorStatus, getStatusState, httpRequest, httpRequestor, inProgress, initialState, isErrorState, isSuccessOrErrorState, isSuccessState, mapArray, mapError, metaDataArrToDict, notNull, notStarted, onWait, onceWhen, parseTbSizeToPixels, phoneFormatter, previousAndCurrent, provideActionableSelector, provideTableBuilder, selectAll, selectEntities, selectEntity, selectIds, selectTotal, serverStatusTypes, setUpStoreFactory, setUpStoreFactoryOld, skipOneWhen, sortsAreSame, spaceCase, startWithIfEmpty, statusAdapter, statusIsSuccessOrInProgress, subscriber, switchOff, tapError, tapSuccess, wrapInArr };
|
|
6104
6109
|
//# sourceMappingURL=one-paragon-angular-utilities.mjs.map
|