@one-paragon/angular-utilities 2.0.20 → 2.0.21-beta.2
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 +123 -110
- 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} +27 -20
- package/http-request-state/deprecated.d.ts +5 -0
- 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 +4 -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 +16 -16
- 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,113 +511,122 @@ 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 ===
|
|
530
|
+
this.request = (this.options?.strategy === RequestStrategy.singleUse) ? this.singleUseRequest : this.flattenedRequest;
|
|
526
531
|
if (options?.autoRequest) {
|
|
527
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
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
$
|
|
559
|
-
$
|
|
560
|
-
$
|
|
561
|
-
|
|
564
|
+
$selectRequestState = computed(() => this.state().response);
|
|
565
|
+
selectRequestState$ = this.state$.pipe(map(s => s.response));
|
|
566
|
+
/**
|
|
567
|
+
* @deprecated use selectRequestState$ instead
|
|
568
|
+
*/
|
|
569
|
+
selectHttpState$ = this.selectRequestState$;
|
|
570
|
+
$selectStatus = computed(() => this.$selectRequestState()?.status);
|
|
571
|
+
selectStatus$ = this.selectRequestState$.pipe(map(s => s.status));
|
|
572
|
+
$isSuccess = computed(() => isSuccessState(this.$selectRequestState()));
|
|
573
|
+
$isError = computed(() => isErrorState(this.$selectRequestState()));
|
|
574
|
+
$isInProgress = computed(() => this.$selectStatus() === RequestStatus.inProgress);
|
|
575
|
+
$isNotStarted = computed(() => this.$selectStatus() === RequestStatus.notStarted);
|
|
576
|
+
selectError$ = this.selectRequestState$.pipe(filter(isErrorState), map(state => state.error));
|
|
562
577
|
$selectError = computed(() => {
|
|
563
|
-
const state = this.$
|
|
578
|
+
const state = this.$selectRequestState();
|
|
564
579
|
if (isErrorState(state))
|
|
565
580
|
return state.error;
|
|
566
581
|
});
|
|
567
|
-
selectResponse$ = this.
|
|
582
|
+
selectResponse$ = this.selectRequestState$.pipe(filter(isSuccessState), map(state => state.body));
|
|
568
583
|
$selectResponse = computed(() => {
|
|
569
|
-
const state = this.$
|
|
584
|
+
const state = this.$selectRequestState();
|
|
570
585
|
if (isSuccessState(state)) {
|
|
571
586
|
return state.body;
|
|
572
587
|
}
|
|
573
588
|
return undefined;
|
|
574
589
|
});
|
|
575
|
-
selectSuccessOrError$ = this.state$.pipe(map(r => r.response), filter(isSuccessOrErrorState), map(() =>
|
|
590
|
+
selectSuccessOrError$ = this.state$.pipe(map(r => r.response), filter(isSuccessOrErrorState), map(() => undefined));
|
|
576
591
|
errorHandled = false;
|
|
577
592
|
onError(cb) {
|
|
578
593
|
this.errorHandled = true;
|
|
579
|
-
this.
|
|
594
|
+
this.subscriber(this.selectError$, cb);
|
|
580
595
|
return this;
|
|
581
596
|
}
|
|
582
597
|
onSuccess(cb) {
|
|
583
|
-
this.
|
|
598
|
+
this.subscriber(this.selectResponse$, cb);
|
|
584
599
|
return this;
|
|
585
600
|
}
|
|
586
601
|
onSuccessOrError(cb) {
|
|
587
|
-
this.
|
|
602
|
+
this.subscriber(this.selectSuccessOrError$, cb);
|
|
588
603
|
return this;
|
|
589
604
|
}
|
|
590
605
|
onSuccessWithRequest(func) {
|
|
591
|
-
this.
|
|
592
|
-
if (isSuccessState(response))
|
|
606
|
+
this.subscriber(this.state$, ({ requestParams, response }) => {
|
|
607
|
+
if (isSuccessState(response))
|
|
593
608
|
func({ requestParams, body: response.body });
|
|
594
|
-
}
|
|
595
609
|
});
|
|
596
610
|
return this;
|
|
597
611
|
}
|
|
598
612
|
onErrorWithRequest(func) {
|
|
599
|
-
this.
|
|
600
|
-
if (isErrorState(response))
|
|
613
|
+
this.subscriber(this.state$, ({ requestParams, response }) => {
|
|
614
|
+
if (isErrorState(response))
|
|
601
615
|
func({ requestParams, error: response.error });
|
|
602
|
-
}
|
|
603
616
|
});
|
|
604
617
|
return this;
|
|
605
618
|
}
|
|
606
619
|
createRequest(...params) {
|
|
607
620
|
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
621
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
on = (srcObservable, func) => {
|
|
613
|
-
return this.effect((src) => {
|
|
614
|
-
return src.pipe(tap(func));
|
|
615
|
-
})(srcObservable);
|
|
622
|
+
subscriber = (srcObservable, func) => {
|
|
623
|
+
return srcObservable.pipe(tap(func), takeUntil(this.destroy$)).subscribe();
|
|
616
624
|
};
|
|
625
|
+
/**
|
|
626
|
+
* @deprecated use the standalone subscriber helper function
|
|
627
|
+
*/
|
|
628
|
+
on = this.subscriber;
|
|
617
629
|
request;
|
|
618
|
-
ngOnDestroy() {
|
|
619
|
-
super.ngOnDestroy();
|
|
620
|
-
}
|
|
621
630
|
requestWith = (params) => {
|
|
622
631
|
if (isSignal(params)) {
|
|
623
632
|
params = toObservable(params, { injector: this.injector }).pipe(notNull());
|
|
@@ -625,12 +634,19 @@ class HttpRequestStateStore extends ComponentStore {
|
|
|
625
634
|
params.pipe(takeUntil(this.destroy$)).subscribe((p) => this.request(...p));
|
|
626
635
|
return this;
|
|
627
636
|
};
|
|
628
|
-
|
|
629
|
-
|
|
637
|
+
assertInjectionContext() {
|
|
638
|
+
try {
|
|
639
|
+
assertInInjectionContext(RequestStateStore);
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
throw new Error('RequestStateStore must be created in an Injection Context');
|
|
643
|
+
}
|
|
644
|
+
;
|
|
645
|
+
}
|
|
646
|
+
destroy() {
|
|
647
|
+
this.destroy$.next();
|
|
648
|
+
}
|
|
630
649
|
}
|
|
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
650
|
class CancellationToken {
|
|
635
651
|
}
|
|
636
652
|
function wrapInArr(sigOrObs) {
|
|
@@ -639,41 +655,39 @@ function wrapInArr(sigOrObs) {
|
|
|
639
655
|
: sigOrObs.pipe(map(a => [a]));
|
|
640
656
|
}
|
|
641
657
|
|
|
642
|
-
class
|
|
658
|
+
class RequestStateFactory {
|
|
643
659
|
constructor() { }
|
|
644
660
|
ngOnDestroy() {
|
|
645
|
-
this.requestors.forEach(request => request.
|
|
661
|
+
this.requestors.forEach(request => request.destroy());
|
|
646
662
|
}
|
|
647
663
|
requestors = [];
|
|
648
664
|
create(req, optionsOrProject, options) {
|
|
649
|
-
const requestor = (typeof (optionsOrProject) === 'function' ? new
|
|
665
|
+
const requestor = (typeof (optionsOrProject) === 'function' ? new RequestStateStore(req, options, optionsOrProject) : new RequestStateStore(req, optionsOrProject));
|
|
650
666
|
this.requestors.push(requestor);
|
|
651
667
|
return requestor;
|
|
652
668
|
}
|
|
653
669
|
createHttpClient(r, options) {
|
|
654
|
-
const requestor = new
|
|
670
|
+
const requestor = new RequestStateStore(r, options);
|
|
655
671
|
this.requestors.push(requestor);
|
|
656
672
|
return requestor;
|
|
657
673
|
}
|
|
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:
|
|
674
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
675
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory });
|
|
660
676
|
}
|
|
661
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: RequestStateFactory, decorators: [{
|
|
662
678
|
type: Injectable
|
|
663
679
|
}], ctorParameters: () => [] });
|
|
664
680
|
function createRequestor(req, optionsOrProject, options) {
|
|
665
681
|
const ops = isFunction(optionsOrProject) ? options : optionsOrProject;
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
function isFunction(value) {
|
|
674
|
-
return typeof value === 'function';
|
|
682
|
+
const injector = getInjector(ops);
|
|
683
|
+
return runInInjectionContext(injector, () => {
|
|
684
|
+
const requestStore = typeof (optionsOrProject) === 'function' ?
|
|
685
|
+
new RequestStateStore(req, options, optionsOrProject)
|
|
686
|
+
: new RequestStateStore(req, optionsOrProject);
|
|
687
|
+
return requestStore;
|
|
688
|
+
});
|
|
675
689
|
}
|
|
676
|
-
function
|
|
690
|
+
function getInjector(options) {
|
|
677
691
|
const providedInjector = options?.injector;
|
|
678
692
|
if (!providedInjector) {
|
|
679
693
|
try {
|
|
@@ -683,8 +697,7 @@ function getDestroyRef(options) {
|
|
|
683
697
|
throw new Error('createRequestor() must be used in an Injection Context or you must provide an injector to createRequestor()');
|
|
684
698
|
}
|
|
685
699
|
}
|
|
686
|
-
|
|
687
|
-
return destroyRef;
|
|
700
|
+
return providedInjector ?? inject(Injector);
|
|
688
701
|
}
|
|
689
702
|
|
|
690
703
|
var FieldType;
|
|
@@ -5415,7 +5428,7 @@ class TableContainerComponent {
|
|
|
5415
5428
|
$tableIdInput = input(undefined, { alias: 'tableId' });
|
|
5416
5429
|
$trackByInput = input(undefined, { alias: 'trackBy' });
|
|
5417
5430
|
$inputFilters = input([], { alias: 'inputFilters' });
|
|
5418
|
-
$filterInfoInputs = computed(() => this.$inputFilters().filter(i => !isFunction
|
|
5431
|
+
$filterInfoInputs = computed(() => this.$inputFilters().filter(i => !isFunction(i)));
|
|
5419
5432
|
$indexColumnInput = input(false, { alias: 'indexColumn' });
|
|
5420
5433
|
$selectionColumnInput = input(false, { alias: 'selectionColumn' });
|
|
5421
5434
|
$stickyHeaderInput = input(true, { alias: 'stickyHeader' });
|
|
@@ -5604,7 +5617,7 @@ class TableContainerComponent {
|
|
|
5604
5617
|
return [...tableBuilderMetaData, ...mappedCustomCellMetaDatas];
|
|
5605
5618
|
});
|
|
5606
5619
|
$preds = computed(() => {
|
|
5607
|
-
const predicateInputFilters = this.$inputFilters().filter(isFunction
|
|
5620
|
+
const predicateInputFilters = this.$inputFilters().filter(isFunction);
|
|
5608
5621
|
const notSavableFilterDirectives = this.$allFilterDirectives()
|
|
5609
5622
|
.filter(d => !d.savable)
|
|
5610
5623
|
.map(d => d.$filter())
|
|
@@ -6100,5 +6113,5 @@ function setUpStoreFactoryOld(store, env) {
|
|
|
6100
6113
|
* Generated bundle index. Do not edit.
|
|
6101
6114
|
*/
|
|
6102
6115
|
|
|
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, HttpRequestStateFactory, HttpRequestStateStore, HttpRequestStatus, HttpRequestStrategy, HttpSuccessStateDirective, MatButtonToggleFilterDirective, MatCheckboxTbFilterDirective, MatOptionTbFilterDirective, MatRadioButtonTbFilterDirective, MatSlideToggleGroupDirective, MatSlideToggleTbFilterDirective, MatTableObservableDataSource, MultiSortDirective, NgrxExtModule, NotPersistedTableSettings, PaginatorComponent, PaginatorOptions, PersistedTableSettings, PhoneNumberPipe, PreventEnterDirective, 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 };
|
|
6116
|
+
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, RequestStateFactory as HttpRequestStateFactory, RequestStateStore as HttpRequestStateStore, RequestStatus as HttpRequestStatus, RequestStrategy as HttpRequestStrategy, 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
6117
|
//# sourceMappingURL=one-paragon-angular-utilities.mjs.map
|