@one-paragon/angular-utilities 0.3.3 → 0.3.4

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.
@@ -7,8 +7,9 @@ export declare class HttpRequestStateFactory implements OnDestroy {
7
7
  constructor();
8
8
  ngOnDestroy(): void;
9
9
  private requestors;
10
- create<TParam extends any[], T>(req: HttpRequestFactory<TParam, T>, options?: RequestStateOptions): HttpRequestStateStore<TParam, T>;
11
- createHttpClient<T>(r: (o: Observable<T>) => Observable<T>, options?: RequestStateOptions): HttpRequestStateStore<[o: Observable<T>], T>;
10
+ create<TParam extends any[], V>(req: HttpRequestFactory<TParam, V>, options?: RequestStateOptions): HttpRequestStateStore<TParam, V>;
11
+ create<TParam extends any[], V, R, T = R>(req: HttpRequestFactory<TParam, V>, project: (v: V) => R, options?: RequestStateOptions): HttpRequestStateStore<TParam, V, T>;
12
+ createHttpClient<T>(r: (o: Observable<T>) => Observable<T>, options?: RequestStateOptions): HttpRequestStateStore<[o: Observable<T>], T, null, T>;
12
13
  static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestStateFactory, never>;
13
14
  static ɵprov: i0.ɵɵInjectableDeclaration<HttpRequestStateFactory>;
14
15
  }
@@ -7,10 +7,11 @@ export interface RequestResponse<TParam extends any[], T> {
7
7
  requestParams: [...TParam];
8
8
  response: HttpRequestState<T>;
9
9
  }
10
- export declare class HttpRequestStateStore<TParam extends any[], T> extends ComponentStore<RequestResponse<TParam, T>> {
10
+ export declare class HttpRequestStateStore<TParam extends any[], V, R = null, T = R extends null ? V : R> extends ComponentStore<RequestResponse<TParam, T>> {
11
11
  private req;
12
12
  private options?;
13
- constructor(req: HttpRequestFactory<TParam, T>, options?: RequestStateOptions | undefined);
13
+ private project?;
14
+ constructor(req: HttpRequestFactory<TParam, V>, options?: RequestStateOptions | undefined, project?: ((v: V) => R) | undefined);
14
15
  reset(): void;
15
16
  private flatteningStrategy;
16
17
  private requestEffect;
@@ -38,11 +39,11 @@ export declare class HttpRequestStateStore<TParam extends any[], T> extends Comp
38
39
  requestParams: [...TParam];
39
40
  response: HttpRequestState<T>;
40
41
  }) => void): void;
41
- on: <V>(srcObservable: Observable<V>, func: (obj: V) => void) => Subscription;
42
+ on: <V_1>(srcObservable: Observable<V_1>, func: (obj: V_1) => void) => Subscription;
42
43
  request: (...value: [...TParam]) => Subscription;
43
44
  ngOnDestroy(): void;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestStateStore<any, any>, never>;
45
- static ɵdir: i0.ɵɵDirectiveDeclaration<HttpRequestStateStore<any, any>, never, never, {}, {}, never, never, false, never>;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestStateStore<any, any, any, any>, never>;
46
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HttpRequestStateStore<any, any, any, any>, never, never, {}, {}, never, never, false, never>;
46
47
  }
47
48
  export declare class CancellationToken {
48
49
  }
@@ -7,15 +7,15 @@ import * as i0 from "@angular/core";
7
7
  export interface HttpSuccessStateViewContext<T> {
8
8
  $implicit: T;
9
9
  }
10
- export declare class HttpSuccessStateDirective<T> extends HttpStateDirectiveBase {
11
- httpSuccessStateTypeSafety?: HttpRequestStateStore<any, T> | Observable<HttpRequestState<T>>;
12
- render: (state: HttpRequestState<T>) => boolean;
10
+ export declare class HttpSuccessStateDirective<V, R> extends HttpStateDirectiveBase {
11
+ httpSuccessStateTypeSafety?: HttpRequestStateStore<any, V, R> | Observable<HttpRequestState<V>>;
12
+ render: (state: HttpRequestState<R extends unknown ? V : R>) => boolean;
13
13
  constructor(injector: Injector, templateRef: TemplateRef<{
14
- $implicit: T;
14
+ $implicit: R extends unknown ? V : R;
15
15
  }>, viewContainer: ViewContainerRef);
16
16
  ngOnInit(): void;
17
17
  ngOnDestroy(): void;
18
- static ngTemplateContextGuard<T>(dir: HttpSuccessStateDirective<T>, ctx: any): ctx is HttpSuccessStateViewContext<T>;
19
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpSuccessStateDirective<any>, never>;
20
- static ɵdir: i0.ɵɵDirectiveDeclaration<HttpSuccessStateDirective<any>, "[httpSuccessState]", never, { "httpSuccessStateTypeSafety": { "alias": "httpSuccessStateTypeSafety"; "required": false; }; }, {}, never, never, true, never>;
18
+ static ngTemplateContextGuard<V, R>(dir: HttpSuccessStateDirective<V, R>, ctx: any): ctx is HttpSuccessStateViewContext<R extends unknown ? V : R>;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<HttpSuccessStateDirective<any, any>, never>;
20
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HttpSuccessStateDirective<any, any>, "[httpSuccessState]", never, { "httpSuccessStateTypeSafety": { "alias": "httpSuccessStateTypeSafety"; "required": false; }; }, {}, never, never, true, never>;
21
21
  }
@@ -13,7 +13,7 @@ export interface HttpRequestStateViewContext<T> {
13
13
  error: boolean;
14
14
  };
15
15
  }
16
- export declare class HttpRequestStateDirective<TParam extends any[], T> {
16
+ export declare class HttpRequestStateDirective<TParam extends any[], V, R, T = R extends null ? V : R> {
17
17
  private templateRef;
18
18
  private viewContainer;
19
19
  readonly ViewContext: HttpRequestStateViewContext<T>;
@@ -21,12 +21,12 @@ export declare class HttpRequestStateDirective<TParam extends any[], T> {
21
21
  state: Observable<HttpRequestState<T>>;
22
22
  subscription: Unsubscribable;
23
23
  hooks: ((state: HttpRequestState<T>) => void)[];
24
- set stateStore(store: HttpRequestStateStore<TParam, T> | Observable<HttpRequestState<T>>);
24
+ set stateStore(store: HttpRequestStateStore<TParam, V, R, T> | Observable<HttpRequestState<T>>);
25
25
  constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);
26
26
  ngOnDestroy(): void;
27
- static ngTemplateContextGuard<T>(dir: HttpRequestStateDirective<any, T>, ctx: any): ctx is HttpRequestStateViewContext<T>;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestStateDirective<any, any>, never>;
29
- static ɵdir: i0.ɵɵDirectiveDeclaration<HttpRequestStateDirective<any, any>, "[httpRequestState]", never, { "stateStore": { "alias": "httpRequestState"; "required": false; }; }, {}, never, never, true, never>;
27
+ static ngTemplateContextGuard<V, R>(dir: HttpRequestStateDirective<any, V, R>, ctx: any): ctx is HttpRequestStateViewContext<R extends null ? V : R>;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<HttpRequestStateDirective<any, any, any, any>, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HttpRequestStateDirective<any, any, any, any>, "[httpRequestState]", never, { "stateStore": { "alias": "httpRequestState"; "required": false; }; }, {}, never, never, true, never>;
30
30
  }
31
31
  export type HttpRequestStateAny<T> = {
32
32
  status: HttpRequestStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@one-paragon/angular-utilities",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.0.3",
6
6
  "@angular/core": "^17.0.3",
@@ -9,4 +9,4 @@ import { GenFilterDisplayerComponent } from "../table-container-filter/gen-filte
9
9
  import { GenColDisplayerComponent } from "../gen-col-displayer/gen-col-displayer.component";
10
10
  import { SortMenuComponent } from "../sort-menu/sort-menu.component";
11
11
  import { ClickEmitterDirective, DialogDirective, StopPropagationDirective } from "../../../utilities";
12
- export declare const i: (typeof MatButtonModule | typeof NgTemplateOutlet | typeof AsyncPipe | typeof MultiSortDirective | typeof StopPropagationDirective | typeof ClickEmitterDirective | typeof DialogDirective | typeof GenColDisplayerComponent | typeof GenFilterDisplayerComponent | typeof LetDirective | typeof FilterChipsComponent | typeof GenericTableComponent | typeof GroupByListComponent | typeof SortMenuComponent)[];
12
+ export declare const i: (typeof DialogDirective | typeof LetDirective | typeof MatButtonModule | typeof AsyncPipe | typeof FilterChipsComponent | typeof GroupByListComponent | typeof StopPropagationDirective | typeof SortMenuComponent | typeof NgTemplateOutlet | typeof MultiSortDirective | typeof ClickEmitterDirective | typeof GenColDisplayerComponent | typeof GenFilterDisplayerComponent | typeof GenericTableComponent)[];