@ngdux/form 1.3.2 → 2.0.0

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.
@@ -1,19 +1,19 @@
1
- import { ActionPayload } from '@ngdux/store-common';
2
- import { Store } from '@ngrx/store';
3
- import { FormActions, FormSelectors } from '../models/form.model';
4
- export declare abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {
5
- protected readonly store: Store;
6
- private readonly formActions;
7
- private readonly formSelectors;
8
- readonly resource$: import("rxjs").Observable<DTO | undefined>;
9
- readonly loadingState$: import("rxjs").Observable<import("@ngdux/data-model-common").RequestState>;
10
- readonly requestState$: import("rxjs").Observable<import("@ngdux/data-model-common").RequestState>;
11
- readonly errors$: import("rxjs").Observable<E | undefined>;
12
- readonly isReady$: import("rxjs").Observable<boolean>;
13
- constructor(store: Store, formActions: FormActions<DTO, E, CREATE_DTO>, formSelectors: FormSelectors<DTO, E>);
14
- create(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['create']>): void;
15
- load(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['load']>): void;
16
- save(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['save']>): void;
17
- delete(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['delete']>): void;
18
- reset(): void;
19
- }
1
+ import { ActionPayload } from '@ngdux/store-common';
2
+ import { Store } from '@ngrx/store';
3
+ import { FormActions, FormSelectors } from '../models/form.model';
4
+ export declare abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {
5
+ protected readonly store: Store;
6
+ private readonly formActions;
7
+ private readonly formSelectors;
8
+ readonly resource$: import("rxjs").Observable<DTO | undefined>;
9
+ readonly loadingState$: import("rxjs").Observable<import("@ngdux/data-model-common").RequestState>;
10
+ readonly requestState$: import("rxjs").Observable<import("@ngdux/data-model-common").RequestState>;
11
+ readonly errors$: import("rxjs").Observable<E | undefined>;
12
+ readonly isReady$: import("rxjs").Observable<boolean>;
13
+ constructor(store: Store, formActions: FormActions<DTO, E, CREATE_DTO>, formSelectors: FormSelectors<DTO, E>);
14
+ create(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['create']>): void;
15
+ load(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['load']>): void;
16
+ save(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['save']>): void;
17
+ delete(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['delete']>): void;
18
+ reset(): void;
19
+ }
@@ -1,2 +1,2 @@
1
- import { FormActions } from '../models/form.model';
2
- export declare function createFormActions<DTO, ERROR, CREATE_DTO = DTO>(featureName: string): FormActions<DTO, ERROR, CREATE_DTO>;
1
+ import { FormActions } from '../models/form.model';
2
+ export declare function createFormActions<DTO, ERROR, CREATE_DTO = DTO>(featureName: string): FormActions<DTO, ERROR, CREATE_DTO>;
@@ -1,3 +1,3 @@
1
- import { ActionCreator, ActionReducer, ReducerTypes } from '@ngrx/store';
2
- import { FormActions, FormState } from '../models/form.model';
3
- export declare function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(actions: FormActions<DTO, ERROR, CREATE_DTO>, actionHandlers?: ReducerTypes<FormState<DTO, ERROR>, ActionCreator[]>[], initialFormState?: Record<string, any>): ActionReducer<FormState<DTO, ERROR>>;
1
+ import { ActionCreator, ActionReducer, ReducerTypes } from '@ngrx/store';
2
+ import { FormActions, FormState } from '../models/form.model';
3
+ export declare function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(actions: FormActions<DTO, ERROR, CREATE_DTO>, actionHandlers?: ReducerTypes<FormState<DTO, ERROR>, ActionCreator[]>[], initialFormState?: Record<string, any>): ActionReducer<FormState<DTO, ERROR>>;
@@ -1,3 +1,3 @@
1
- import { DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';
2
- import { FormSelectors, FormState } from '../models/form.model';
3
- export declare function createFormSelectors<T, E>(getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>): FormSelectors<T, E>;
1
+ import { DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';
2
+ import { FormSelectors, FormState } from '../models/form.model';
3
+ export declare function createFormSelectors<T, E>(getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>): FormSelectors<T, E>;
@@ -1,7 +1,7 @@
1
- import { Action } from '@ngrx/store';
2
- import { FormState } from '../models/form.model';
3
- export declare function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string): {
4
- actions: import("../models/form.model").FormActions<DTO, ERROR, CREATE_DTO>;
5
- reducer: (state: FormState<DTO, ERROR>, action: Action) => FormState<DTO, ERROR>;
6
- selectors: import("../models/form.model").FormSelectors<DTO, ERROR>;
7
- };
1
+ import { Action } from '@ngrx/store';
2
+ import { FormState } from '../models/form.model';
3
+ export declare function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string): {
4
+ actions: import("../models/form.model").FormActions<DTO, ERROR, CREATE_DTO>;
5
+ reducer: (state: FormState<DTO, ERROR>, action: Action) => FormState<DTO, ERROR>;
6
+ selectors: import("../models/form.model").FormSelectors<DTO, ERROR>;
7
+ };
@@ -1,79 +1,79 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { RequestState } from '@ngdux/data-model-common';
3
- import { ApiRequestState, LoadingState } from '@ngdux/store-common';
4
- import { ActionCreator, MemoizedSelector } from '@ngrx/store';
5
- import { TypedAction } from '@ngrx/store/src/models';
6
- export declare const FORM_FEATURE_KEY: InjectionToken<string>;
7
- export interface FormState<T, E> extends ApiRequestState<E>, LoadingState {
8
- resource?: T;
9
- }
10
- export interface FormSelectors<T, E> {
11
- getRequestState: MemoizedSelector<object, RequestState>;
12
- getLoadingState: MemoizedSelector<object, RequestState>;
13
- getErrors: MemoizedSelector<object, E | undefined>;
14
- getResource: MemoizedSelector<object, T | undefined>;
15
- isReady: MemoizedSelector<object, boolean>;
16
- }
17
- export interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {
18
- load: ActionCreator<string, (props: {
19
- id: string;
20
- }) => {
21
- id: string;
22
- } & TypedAction<string>>;
23
- loadSuccess: ActionCreator<string, (props: {
24
- resource: DTO;
25
- }) => {
26
- resource: DTO;
27
- } & TypedAction<string>>;
28
- loadFailure: ActionCreator<string, (props: {
29
- errors: ERROR;
30
- }) => {
31
- errors: ERROR;
32
- } & TypedAction<string>>;
33
- save: ActionCreator<string, (props: {
34
- resource: DTO;
35
- }) => {
36
- resource: DTO;
37
- } & TypedAction<string>>;
38
- saveSuccess: ActionCreator<string, (props: {
39
- resource: DTO;
40
- }) => {
41
- resource: DTO;
42
- } & TypedAction<string>>;
43
- saveFailure: ActionCreator<string, (props: {
44
- errors: ERROR;
45
- }) => {
46
- errors: ERROR;
47
- } & TypedAction<string>>;
48
- delete: ActionCreator<string, (props: {
49
- id: string;
50
- }) => {
51
- id: string;
52
- } & TypedAction<string>>;
53
- deleteSuccess: ActionCreator<string, (props: {
54
- id: string;
55
- }) => {
56
- id: string;
57
- } & TypedAction<string>>;
58
- deleteFailure: ActionCreator<string, (props: {
59
- errors: ERROR;
60
- }) => {
61
- errors: ERROR;
62
- } & TypedAction<string>>;
63
- create: ActionCreator<string, (props: {
64
- resource: CREATE_DTO;
65
- }) => {
66
- resource: CREATE_DTO;
67
- } & TypedAction<string>>;
68
- createSuccess: ActionCreator<string, (props: {
69
- resource: DTO;
70
- }) => {
71
- resource: DTO;
72
- } & TypedAction<string>>;
73
- createFailure: ActionCreator<string, (props: {
74
- errors: ERROR;
75
- }) => {
76
- errors: ERROR;
77
- } & TypedAction<string>>;
78
- reset: ActionCreator<string, () => TypedAction<string>>;
79
- }
1
+ import { InjectionToken } from '@angular/core';
2
+ import { RequestState } from '@ngdux/data-model-common';
3
+ import { ApiRequestState, LoadingState } from '@ngdux/store-common';
4
+ import { ActionCreator, MemoizedSelector } from '@ngrx/store';
5
+ import { TypedAction } from '@ngrx/store/src/models';
6
+ export declare const FORM_FEATURE_KEY: InjectionToken<string>;
7
+ export interface FormState<T, E> extends ApiRequestState<E>, LoadingState {
8
+ resource?: T;
9
+ }
10
+ export interface FormSelectors<T, E> {
11
+ getRequestState: MemoizedSelector<object, RequestState>;
12
+ getLoadingState: MemoizedSelector<object, RequestState>;
13
+ getErrors: MemoizedSelector<object, E | undefined>;
14
+ getResource: MemoizedSelector<object, T | undefined>;
15
+ isReady: MemoizedSelector<object, boolean>;
16
+ }
17
+ export interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {
18
+ load: ActionCreator<string, (props: {
19
+ id: string;
20
+ }) => {
21
+ id: string;
22
+ } & TypedAction<string>>;
23
+ loadSuccess: ActionCreator<string, (props: {
24
+ resource: DTO;
25
+ }) => {
26
+ resource: DTO;
27
+ } & TypedAction<string>>;
28
+ loadFailure: ActionCreator<string, (props: {
29
+ errors: ERROR;
30
+ }) => {
31
+ errors: ERROR;
32
+ } & TypedAction<string>>;
33
+ save: ActionCreator<string, (props: {
34
+ resource: DTO;
35
+ }) => {
36
+ resource: DTO;
37
+ } & TypedAction<string>>;
38
+ saveSuccess: ActionCreator<string, (props: {
39
+ resource: DTO;
40
+ }) => {
41
+ resource: DTO;
42
+ } & TypedAction<string>>;
43
+ saveFailure: ActionCreator<string, (props: {
44
+ errors: ERROR;
45
+ }) => {
46
+ errors: ERROR;
47
+ } & TypedAction<string>>;
48
+ delete: ActionCreator<string, (props: {
49
+ id: string;
50
+ }) => {
51
+ id: string;
52
+ } & TypedAction<string>>;
53
+ deleteSuccess: ActionCreator<string, (props: {
54
+ id: string;
55
+ }) => {
56
+ id: string;
57
+ } & TypedAction<string>>;
58
+ deleteFailure: ActionCreator<string, (props: {
59
+ errors: ERROR;
60
+ }) => {
61
+ errors: ERROR;
62
+ } & TypedAction<string>>;
63
+ create: ActionCreator<string, (props: {
64
+ resource: CREATE_DTO;
65
+ }) => {
66
+ resource: CREATE_DTO;
67
+ } & TypedAction<string>>;
68
+ createSuccess: ActionCreator<string, (props: {
69
+ resource: DTO;
70
+ }) => {
71
+ resource: DTO;
72
+ } & TypedAction<string>>;
73
+ createFailure: ActionCreator<string, (props: {
74
+ errors: ERROR;
75
+ }) => {
76
+ errors: ERROR;
77
+ } & TypedAction<string>>;
78
+ reset: ActionCreator<string, () => TypedAction<string>>;
79
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngdux/form",
3
- "version": "1.3.2",
3
+ "version": "2.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:allanartuso/ngdux.git",
@@ -9,98 +9,12 @@
9
9
  "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
10
10
  "peerDependencies": {
11
11
  "@ngdux/data-model-common": "^1.0.0",
12
- "@angular/core": "^15.0.0",
13
- "@ngdux/store-common": "^1.0.0"
12
+ "@angular/core": "^16.0.0",
13
+ "@ngdux/store-common": "^1.0.0",
14
+ "@ngrx/store": "^16.0.0",
15
+ "@ngrx/effects": "^16.0.0"
14
16
  },
15
- "default": {
16
- "name": "@ngdux/form",
17
- "version": "1.3.1",
18
- "repository": {
19
- "type": "git",
20
- "url": "git@github.com:allanartuso/ngdux.git",
21
- "directory": "/libs/ngdux/util/store/form"
22
- },
23
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
24
- "peerDependencies": {
25
- "@ngdux/data-model-common": "^1.0.0",
26
- "@angular/core": "^15.0.0",
27
- "@ngdux/store-common": "^1.0.0"
28
- },
29
- "default": {
30
- "name": "@ngdux/form",
31
- "version": "1.3.0",
32
- "repository": {
33
- "type": "git",
34
- "url": "git@github.com:allanartuso/ngdux.git",
35
- "directory": "/libs/ngdux/util/store/form"
36
- },
37
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
38
- "peerDependencies": {
39
- "@ngdux/data-model-common": "^1.0.0",
40
- "@angular/core": "^15.0.0",
41
- "@ngdux/store-common": "^1.0.0"
42
- },
43
- "default": {
44
- "name": "@ngdux/form",
45
- "version": "1.2.1",
46
- "repository": {
47
- "type": "git",
48
- "url": "git@github.com:allanartuso/ngdux.git",
49
- "directory": "/libs/ngdux/util/store/form"
50
- },
51
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
52
- "peerDependencies": {
53
- "@ngdux/data-model-common": "^1.0.0",
54
- "@angular/core": "^15.0.0",
55
- "@ngdux/store-common": "^1.0.0"
56
- },
57
- "default": {
58
- "name": "@ngdux/form",
59
- "version": "1.2.0",
60
- "repository": {
61
- "type": "git",
62
- "url": "git@github.com:allanartuso/ngdux.git",
63
- "directory": "/libs/ngdux/util/store/form"
64
- },
65
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
66
- "peerDependencies": {
67
- "@ngdux/data-model-common": "^1.0.0",
68
- "@angular/core": "^15.0.0",
69
- "@ngdux/store-common": "^1.0.0"
70
- },
71
- "default": {
72
- "name": "@ngdux/form",
73
- "version": "1.1.1",
74
- "repository": {
75
- "type": "git",
76
- "url": "git@github.com:allanartuso/ngdux.git",
77
- "directory": "/libs/ngdux/util/store/form"
78
- },
79
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme",
80
- "default": {
81
- "name": "@ngdux/form",
82
- "repository": {
83
- "type": "git",
84
- "url": "git@github.com:allanartuso/ngdux.git",
85
- "directory": "/libs/ngdux/util/store/form"
86
- },
87
- "homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/form#readme"
88
- },
89
- "peerDependencies": {
90
- "@ngdux/data-model-common": "^1.0.0",
91
- "@angular/core": "^15.0.0",
92
- "@ngdux/store-common": "^1.0.0"
93
- }
94
- }
95
- }
96
- }
97
- }
98
- },
99
- "module": "fesm2015/ngdux-form.mjs",
100
- "es2020": "fesm2020/ngdux-form.mjs",
101
- "esm2020": "esm2020/ngdux-form.mjs",
102
- "fesm2020": "fesm2020/ngdux-form.mjs",
103
- "fesm2015": "fesm2015/ngdux-form.mjs",
17
+ "module": "fesm2022/ngdux-form.mjs",
104
18
  "typings": "index.d.ts",
105
19
  "exports": {
106
20
  "./package.json": {
@@ -108,11 +22,9 @@
108
22
  },
109
23
  ".": {
110
24
  "types": "./index.d.ts",
111
- "esm2020": "./esm2020/ngdux-form.mjs",
112
- "es2020": "./fesm2020/ngdux-form.mjs",
113
- "es2015": "./fesm2015/ngdux-form.mjs",
114
- "node": "./fesm2015/ngdux-form.mjs",
115
- "default": "./fesm2020/ngdux-form.mjs"
25
+ "esm2022": "./esm2022/ngdux-form.mjs",
26
+ "esm": "./esm2022/ngdux-form.mjs",
27
+ "default": "./fesm2022/ngdux-form.mjs"
116
28
  }
117
29
  },
118
30
  "sideEffects": false,
@@ -1,194 +0,0 @@
1
- import { RequestState } from '@ngdux/data-model-common';
2
- export { RequestState } from '@ngdux/data-model-common';
3
- import { createEffect, ofType } from '@ngrx/effects';
4
- import { of } from 'rxjs';
5
- import { switchMap, map, catchError, exhaustMap, tap } from 'rxjs/operators';
6
- import * as i0 from '@angular/core';
7
- import { InjectionToken, Injectable, Inject } from '@angular/core';
8
- import * as i1 from '@ngrx/store';
9
- import { createAction, props, createReducer, on, createSelector, createFeatureSelector, select } from '@ngrx/store';
10
- import { createRequestStateActionHandlers, createLoadingStateActionHandlers } from '@ngdux/store-common';
11
-
12
- class AbstractFormEffects {
13
- constructor(actions$, store, service, formActions, notificationService) {
14
- this.actions$ = actions$;
15
- this.store = store;
16
- this.service = service;
17
- this.formActions = formActions;
18
- this.notificationService = notificationService;
19
- this.load$ = createEffect(() => this.actions$.pipe(ofType(this.formActions.load), switchMap(({ id }) => this.service.loadResource(id).pipe(map(resource => this.formActions.loadSuccess({ resource })), catchError((errors) => of(this.formActions.loadFailure({ errors })))))));
20
- this.create$ = createEffect(() => this.actions$.pipe(ofType(this.formActions.create), switchMap(action => {
21
- if (!this.service.createResource) {
22
- throw new Error('createResource not implement in the ListService');
23
- }
24
- return this.service.createResource(action.resource).pipe(map(resource => this.formActions.createSuccess({ resource })), catchError((errors) => of(this.formActions.createFailure({ errors }))));
25
- })));
26
- this.update$ = createEffect(() => this.actions$.pipe(ofType(this.formActions.save), switchMap(({ resource }) => {
27
- if (!this.service.saveResource) {
28
- throw new Error('saveResource not implement in the ListService');
29
- }
30
- return this.service.saveResource(resource).pipe(map(response => this.formActions.saveSuccess({ resource: response })), catchError((errors) => of(this.formActions.saveFailure({ errors }))));
31
- })));
32
- this.delete$ = createEffect(() => this.actions$.pipe(ofType(this.formActions.delete), exhaustMap(action => {
33
- if (!this.service.deleteResource) {
34
- throw new Error('deleteResource not implement in the ListService');
35
- }
36
- return this.service.deleteResource(action.id).pipe(map(() => this.formActions.deleteSuccess({ id: action.id })), catchError((errors) => of(this.formActions.deleteFailure({ errors }))));
37
- })));
38
- this.errorsHandler$ = createEffect(() => this.actions$.pipe(ofType(this.formActions.saveFailure, this.formActions.loadFailure, this.formActions.deleteFailure, this.formActions.createFailure), tap(({ errors }) => {
39
- this.notificationService.onFormErrors(errors);
40
- })), { dispatch: false });
41
- }
42
- }
43
-
44
- const FORM_FEATURE_KEY = new InjectionToken('FORM_FEATURE_KEY');
45
-
46
- function createFormActions(featureName) {
47
- const load = createAction(`[${featureName} API] Load ${featureName}`, props());
48
- const loadSuccess = createAction(`[${featureName} API] Load ${featureName} Success`, props());
49
- const loadFailure = createAction(`[${featureName} API] Load ${featureName} Failure`, props());
50
- const save = createAction(`[${featureName} API] Save ${featureName}`, props());
51
- const saveSuccess = createAction(`[${featureName} API] Save ${featureName} Success`, props());
52
- const saveFailure = createAction(`[${featureName} API] Save ${featureName} Failure`, props());
53
- const deleteAction = createAction(`[${featureName} API] Delete ${featureName}`, props());
54
- const deleteSuccess = createAction(`[${featureName} API] Delete ${featureName} Success`, props());
55
- const deleteFailure = createAction(`[${featureName} API] Delete ${featureName} Failure`, props());
56
- const create = createAction(`[${featureName} API] Create ${featureName}`, props());
57
- const createSuccess = createAction(`[${featureName} API] Create ${featureName} Success`, props());
58
- const createFailure = createAction(`[${featureName} API] Create ${featureName} Failure`, props());
59
- const reset = createAction(`[${featureName} API] Reset ${featureName}`);
60
- return {
61
- load,
62
- loadSuccess,
63
- loadFailure,
64
- save,
65
- saveSuccess,
66
- saveFailure,
67
- delete: deleteAction,
68
- deleteSuccess,
69
- deleteFailure,
70
- create,
71
- createSuccess,
72
- createFailure,
73
- reset
74
- };
75
- }
76
-
77
- function createFormReducer(actions, actionHandlers, initialFormState) {
78
- const initialState = Object.assign(Object.assign({}, createInitialFormState()), initialFormState);
79
- return createReducer(initialState, ...createFormActionHandlers(initialState, actions), ...(actionHandlers || []));
80
- }
81
- function createInitialFormState() {
82
- return {
83
- resource: undefined,
84
- loadingState: RequestState.IDLE,
85
- requestState: RequestState.IDLE,
86
- errors: undefined
87
- };
88
- }
89
- function createFormActionHandlers(initialFormState, actions) {
90
- return [
91
- on(actions.reset, () => initialFormState),
92
- on(actions.loadSuccess, actions.createSuccess, actions.saveSuccess, (state, { resource }) => (Object.assign(Object.assign({}, state), { resource }))),
93
- on(actions.deleteSuccess, (state) => (Object.assign(Object.assign({}, state), { resource: undefined }))),
94
- ...createRequestStateActionHandlers(actions.load, actions.save, actions.saveSuccess, actions.saveFailure),
95
- ...createRequestStateActionHandlers(undefined, actions.create, actions.createSuccess, actions.createFailure),
96
- ...createRequestStateActionHandlers(undefined, actions.delete, actions.deleteSuccess, actions.deleteFailure),
97
- ...createLoadingStateActionHandlers(actions.load, actions.loadSuccess, actions.loadFailure)
98
- ];
99
- }
100
-
101
- function createFormSelectors(getFormState) {
102
- const getRequestState = createSelector(getFormState, state => state.requestState);
103
- const getLoadingState = createSelector(getFormState, state => state.loadingState);
104
- const getErrors = createSelector(getFormState, state => state.errors);
105
- const getResource = createSelector(getFormState, state => state.resource);
106
- const isReady = createSelector(getResource, getLoadingState, (resource, loadingState) => !!resource && loadingState === RequestState.SUCCESS);
107
- return {
108
- getRequestState,
109
- getLoadingState,
110
- getErrors,
111
- getResource,
112
- isReady
113
- };
114
- }
115
-
116
- class AbstractFormReducerManager {
117
- constructor(reducerManager, featureKey) {
118
- this.reducerManager = reducerManager;
119
- this.featureKey = featureKey;
120
- this.actions = this.getActions();
121
- this.addReducer();
122
- this.selectors = this.getSelectors();
123
- }
124
- getActions() {
125
- return createFormActions(this.featureKey);
126
- }
127
- addReducer() {
128
- if (!this.reducerManager.currentReducers[this.featureKey]) {
129
- const reducer = createFormReducer(this.actions);
130
- this.reducerManager.addReducer(this.featureKey, reducer);
131
- }
132
- }
133
- getSelectors() {
134
- const getState = createFeatureSelector(this.featureKey);
135
- return createFormSelectors(getState);
136
- }
137
- }
138
- AbstractFormReducerManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AbstractFormReducerManager, deps: [{ token: i1.ReducerManager }, { token: FORM_FEATURE_KEY }], target: i0.ɵɵFactoryTarget.Injectable });
139
- AbstractFormReducerManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AbstractFormReducerManager });
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AbstractFormReducerManager, decorators: [{
141
- type: Injectable
142
- }], ctorParameters: function () {
143
- return [{ type: i1.ReducerManager }, { type: undefined, decorators: [{
144
- type: Inject,
145
- args: [FORM_FEATURE_KEY]
146
- }] }];
147
- } });
148
-
149
- class AbstractFormFacade {
150
- constructor(store, formActions, formSelectors) {
151
- this.store = store;
152
- this.formActions = formActions;
153
- this.formSelectors = formSelectors;
154
- this.resource$ = this.store.pipe(select(this.formSelectors.getResource));
155
- this.loadingState$ = this.store.pipe(select(this.formSelectors.getLoadingState));
156
- this.requestState$ = this.store.pipe(select(this.formSelectors.getRequestState));
157
- this.errors$ = this.store.pipe(select(this.formSelectors.getErrors));
158
- this.isReady$ = this.store.pipe(select(this.formSelectors.isReady));
159
- }
160
- create(props) {
161
- this.store.dispatch(this.formActions.create(props));
162
- }
163
- load(props) {
164
- this.store.dispatch(this.formActions.load(props));
165
- }
166
- save(props) {
167
- this.store.dispatch(this.formActions.save(props));
168
- }
169
- delete(props) {
170
- this.store.dispatch(this.formActions.delete(props));
171
- }
172
- reset() {
173
- this.store.dispatch(this.formActions.reset());
174
- }
175
- }
176
-
177
- function createFormState(featureName) {
178
- const actions = createFormActions(featureName);
179
- const reducer = createFormReducer(actions);
180
- const getState = createFeatureSelector(featureName);
181
- const selectors = createFormSelectors(getState);
182
- return {
183
- actions,
184
- reducer: (state, action) => reducer(state, action),
185
- selectors
186
- };
187
- }
188
-
189
- /**
190
- * Generated bundle index. Do not edit.
191
- */
192
-
193
- export { AbstractFormEffects, AbstractFormFacade, AbstractFormReducerManager, FORM_FEATURE_KEY, createFormActions, createFormReducer, createFormSelectors, createFormState };
194
- //# sourceMappingURL=ngdux-form.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngdux-form.mjs","sources":["../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-effects.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/models/form.model.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-actions.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-reducer.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-selectors.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form-state.service.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/abstract-form.facade.ts","../../../../../../../libs/ngdux/util/store/form/src/lib/+state/form-state.ts","../../../../../../../libs/ngdux/util/store/form/src/ngdux-form.ts"],"sourcesContent":["import { FormNotificationService, FormService } from '@ngdux/data-model-common';\r\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\r\nimport { Store } from '@ngrx/store';\r\nimport { of } from 'rxjs';\r\nimport { catchError, exhaustMap, map, switchMap, tap } from 'rxjs/operators';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport abstract class AbstractFormEffects<DTO, ERROR, CREATE_DTO = DTO> {\r\n load$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.load),\r\n switchMap(({ id }) =>\r\n this.service.loadResource(id).pipe(\r\n map(resource => this.formActions.loadSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.loadFailure({ errors })))\r\n )\r\n )\r\n )\r\n );\r\n\r\n create$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.create),\r\n switchMap(action => {\r\n if (!this.service.createResource) {\r\n throw new Error('createResource not implement in the ListService');\r\n }\r\n\r\n return this.service.createResource(action.resource).pipe(\r\n map(resource => this.formActions.createSuccess({ resource })),\r\n catchError((errors: ERROR) => of(this.formActions.createFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n update$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.save),\r\n switchMap(({ resource }) => {\r\n if (!this.service.saveResource) {\r\n throw new Error('saveResource not implement in the ListService');\r\n }\r\n\r\n return this.service.saveResource(resource).pipe(\r\n map(response => this.formActions.saveSuccess({ resource: response })),\r\n catchError((errors: ERROR) => of(this.formActions.saveFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n delete$ = createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(this.formActions.delete),\r\n exhaustMap(action => {\r\n if (!this.service.deleteResource) {\r\n throw new Error('deleteResource not implement in the ListService');\r\n }\r\n\r\n return this.service.deleteResource(action.id).pipe(\r\n map(() => this.formActions.deleteSuccess({ id: action.id })),\r\n catchError((errors: ERROR) => of(this.formActions.deleteFailure({ errors })))\r\n );\r\n })\r\n )\r\n );\r\n\r\n errorsHandler$ = createEffect(\r\n () =>\r\n this.actions$.pipe(\r\n ofType(\r\n this.formActions.saveFailure,\r\n this.formActions.loadFailure,\r\n this.formActions.deleteFailure,\r\n this.formActions.createFailure\r\n ),\r\n tap(({ errors }) => {\r\n this.notificationService.onFormErrors(errors);\r\n })\r\n ),\r\n { dispatch: false }\r\n );\r\n\r\n protected constructor(\r\n protected readonly actions$: Actions,\r\n protected readonly store: Store,\r\n private readonly service: FormService<DTO, CREATE_DTO>,\r\n private readonly formActions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n private readonly notificationService: FormNotificationService<ERROR>\r\n ) {}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { RequestState } from '@ngdux/data-model-common';\r\nimport { ApiRequestState, LoadingState } from '@ngdux/store-common';\r\nimport { ActionCreator, MemoizedSelector } from '@ngrx/store';\r\nimport { TypedAction } from '@ngrx/store/src/models';\r\n\r\nexport const FORM_FEATURE_KEY = new InjectionToken<string>('FORM_FEATURE_KEY');\r\n\r\nexport interface FormState<T, E> extends ApiRequestState<E>, LoadingState {\r\n resource?: T;\r\n}\r\n\r\nexport interface FormSelectors<T, E> {\r\n getRequestState: MemoizedSelector<object, RequestState>;\r\n getLoadingState: MemoizedSelector<object, RequestState>;\r\n getErrors: MemoizedSelector<object, E | undefined>;\r\n getResource: MemoizedSelector<object, T | undefined>;\r\n isReady: MemoizedSelector<object, boolean>;\r\n}\r\n\r\nexport interface FormActions<DTO, ERROR, CREATE_DTO = DTO> {\r\n load: ActionCreator<string, (props: { id: string }) => { id: string } & TypedAction<string>>;\r\n loadSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & TypedAction<string>>;\r\n loadFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & TypedAction<string>>;\r\n\r\n save: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & TypedAction<string>>;\r\n saveSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & TypedAction<string>>;\r\n saveFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & TypedAction<string>>;\r\n\r\n delete: ActionCreator<string, (props: { id: string }) => { id: string } & TypedAction<string>>;\r\n deleteSuccess: ActionCreator<string, (props: { id: string }) => { id: string } & TypedAction<string>>;\r\n deleteFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & TypedAction<string>>;\r\n\r\n create: ActionCreator<string, (props: { resource: CREATE_DTO }) => { resource: CREATE_DTO } & TypedAction<string>>;\r\n createSuccess: ActionCreator<string, (props: { resource: DTO }) => { resource: DTO } & TypedAction<string>>;\r\n createFailure: ActionCreator<string, (props: { errors: ERROR }) => { errors: ERROR } & TypedAction<string>>;\r\n\r\n reset: ActionCreator<string, () => TypedAction<string>>;\r\n}\r\n","import { createAction, props } from '@ngrx/store';\r\nimport { FormActions } from '../models/form.model';\r\n\r\nexport function createFormActions<DTO, ERROR, CREATE_DTO = DTO>(\r\n featureName: string\r\n): FormActions<DTO, ERROR, CREATE_DTO> {\r\n const load = createAction(`[${featureName} API] Load ${featureName}`, props<{ id: string }>());\r\n const loadSuccess = createAction(`[${featureName} API] Load ${featureName} Success`, props<{ resource: DTO }>());\r\n const loadFailure = createAction(`[${featureName} API] Load ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const save = createAction(`[${featureName} API] Save ${featureName}`, props<{ resource: DTO }>());\r\n const saveSuccess = createAction(`[${featureName} API] Save ${featureName} Success`, props<{ resource: DTO }>());\r\n const saveFailure = createAction(`[${featureName} API] Save ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const deleteAction = createAction(`[${featureName} API] Delete ${featureName}`, props<{ id: string }>());\r\n const deleteSuccess = createAction(`[${featureName} API] Delete ${featureName} Success`, props<{ id: string }>());\r\n const deleteFailure = createAction(`[${featureName} API] Delete ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const create = createAction(`[${featureName} API] Create ${featureName}`, props<{ resource: CREATE_DTO }>());\r\n const createSuccess = createAction(`[${featureName} API] Create ${featureName} Success`, props<{ resource: DTO }>());\r\n const createFailure = createAction(`[${featureName} API] Create ${featureName} Failure`, props<{ errors: ERROR }>());\r\n\r\n const reset = createAction(`[${featureName} API] Reset ${featureName}`);\r\n\r\n return {\r\n load,\r\n loadSuccess,\r\n loadFailure,\r\n save,\r\n saveSuccess,\r\n saveFailure,\r\n delete: deleteAction,\r\n deleteSuccess,\r\n deleteFailure,\r\n create,\r\n createSuccess,\r\n createFailure,\r\n reset\r\n };\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createLoadingStateActionHandlers, createRequestStateActionHandlers } from '@ngdux/store-common';\r\nimport { ActionCreator, ActionReducer, Creator, ReducerTypes, createReducer, on } from '@ngrx/store';\r\nimport { FormActions, FormState } from '../models/form.model';\r\n\r\nexport function createFormReducer<DTO, ERROR, CREATE_DTO = DTO>(\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>,\r\n actionHandlers?: ReducerTypes<FormState<DTO, ERROR>, ActionCreator[]>[],\r\n initialFormState?: Record<string, any>\r\n): ActionReducer<FormState<DTO, ERROR>> {\r\n const initialState: FormState<DTO, ERROR> = { ...createInitialFormState<DTO, ERROR>(), ...initialFormState };\r\n return createReducer<FormState<DTO, ERROR>>(\r\n initialState,\r\n ...createFormActionHandlers<DTO, ERROR, CREATE_DTO>(initialState, actions),\r\n ...(actionHandlers || [])\r\n );\r\n}\r\n\r\nfunction createInitialFormState<DTO, ERROR>(): FormState<DTO, ERROR> {\r\n return {\r\n resource: undefined,\r\n loadingState: RequestState.IDLE,\r\n requestState: RequestState.IDLE,\r\n errors: undefined\r\n };\r\n}\r\n\r\nfunction createFormActionHandlers<DTO, ERROR, CREATE_DTO = DTO>(\r\n initialFormState: FormState<DTO, ERROR>,\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>\r\n): ReducerTypes<FormState<DTO, ERROR>, ActionCreator<string, Creator<any[], object>>[]>[] {\r\n return [\r\n on(actions.reset, (): FormState<DTO, ERROR> => initialFormState),\r\n on(\r\n actions.loadSuccess,\r\n actions.createSuccess,\r\n actions.saveSuccess,\r\n (state: FormState<DTO, ERROR>, { resource }): FormState<DTO, ERROR> => ({ ...state, resource })\r\n ),\r\n on(\r\n actions.deleteSuccess,\r\n (state: FormState<DTO, ERROR>): FormState<DTO, ERROR> => ({\r\n ...state,\r\n resource: undefined\r\n })\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n actions.load,\r\n actions.save,\r\n actions.saveSuccess,\r\n actions.saveFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.create,\r\n actions.createSuccess,\r\n actions.createFailure\r\n ),\r\n ...createRequestStateActionHandlers<FormState<DTO, ERROR>, ERROR>(\r\n undefined,\r\n actions.delete,\r\n actions.deleteSuccess,\r\n actions.deleteFailure\r\n ),\r\n ...createLoadingStateActionHandlers<FormState<DTO, ERROR>>(actions.load, actions.loadSuccess, actions.loadFailure)\r\n ];\r\n}\r\n","import { RequestState } from '@ngdux/data-model-common';\r\nimport { createSelector, DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';\r\nimport { FormSelectors, FormState } from '../models/form.model';\r\n\r\nexport function createFormSelectors<T, E>(\r\n getFormState: MemoizedSelector<object, FormState<T, E>, DefaultProjectorFn<FormState<T, E>>>\r\n): FormSelectors<T, E> {\r\n const getRequestState = createSelector(getFormState, state => state.requestState);\r\n const getLoadingState = createSelector(getFormState, state => state.loadingState);\r\n const getErrors = createSelector(getFormState, state => state.errors);\r\n const getResource = createSelector(getFormState, state => state.resource);\r\n\r\n const isReady = createSelector(\r\n getResource,\r\n getLoadingState,\r\n (resource, loadingState) => !!resource && loadingState === RequestState.SUCCESS\r\n );\r\n\r\n return {\r\n getRequestState,\r\n getLoadingState,\r\n getErrors,\r\n getResource,\r\n isReady\r\n };\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { ReducerManager, createFeatureSelector } from '@ngrx/store';\r\nimport { FORM_FEATURE_KEY, FormActions, FormSelectors, FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\n@Injectable()\r\nexport abstract class AbstractFormReducerManager<DTO, ERROR, CREATE_DTO = DTO> {\r\n actions: FormActions<DTO, ERROR, CREATE_DTO>;\r\n selectors: FormSelectors<DTO, ERROR>;\r\n\r\n constructor(\r\n private readonly reducerManager: ReducerManager,\r\n @Inject(FORM_FEATURE_KEY) private readonly featureKey: string\r\n ) {\r\n this.actions = this.getActions();\r\n this.addReducer();\r\n this.selectors = this.getSelectors();\r\n }\r\n\r\n protected getActions() {\r\n return createFormActions<DTO, ERROR, CREATE_DTO>(this.featureKey);\r\n }\r\n\r\n protected addReducer() {\r\n if (!this.reducerManager.currentReducers[this.featureKey]) {\r\n const reducer = createFormReducer(this.actions);\r\n this.reducerManager.addReducer(this.featureKey, reducer);\r\n }\r\n }\r\n\r\n protected getSelectors() {\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(this.featureKey);\r\n return createFormSelectors(getState);\r\n }\r\n}\r\n","import { ActionPayload } from '@ngdux/store-common';\r\nimport { select, Store } from '@ngrx/store';\r\nimport { FormActions, FormSelectors } from '../models/form.model';\r\n\r\nexport abstract class AbstractFormFacade<DTO, E, CREATE_DTO = DTO> {\r\n readonly resource$ = this.store.pipe(select(this.formSelectors.getResource));\r\n readonly loadingState$ = this.store.pipe(select(this.formSelectors.getLoadingState));\r\n readonly requestState$ = this.store.pipe(select(this.formSelectors.getRequestState));\r\n readonly errors$ = this.store.pipe(select(this.formSelectors.getErrors));\r\n readonly isReady$ = this.store.pipe(select(this.formSelectors.isReady));\r\n\r\n constructor(\r\n protected readonly store: Store,\r\n private readonly formActions: FormActions<DTO, E, CREATE_DTO>,\r\n private readonly formSelectors: FormSelectors<DTO, E>\r\n ) {}\r\n\r\n create(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['create']>): void {\r\n this.store.dispatch(this.formActions.create(props));\r\n }\r\n\r\n load(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['load']>): void {\r\n this.store.dispatch(this.formActions.load(props));\r\n }\r\n\r\n save(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['save']>): void {\r\n this.store.dispatch(this.formActions.save(props));\r\n }\r\n\r\n delete(props: ActionPayload<FormActions<DTO, E, CREATE_DTO>['delete']>): void {\r\n this.store.dispatch(this.formActions.delete(props));\r\n }\r\n\r\n reset(): void {\r\n this.store.dispatch(this.formActions.reset());\r\n }\r\n}\r\n","import { Action, createFeatureSelector } from '@ngrx/store';\r\nimport { FormState } from '../models/form.model';\r\nimport { createFormActions } from './form-actions';\r\nimport { createFormReducer } from './form-reducer';\r\nimport { createFormSelectors } from './form-selectors';\r\n\r\nexport function createFormState<DTO, ERROR, CREATE_DTO = DTO>(featureName: string) {\r\n const actions = createFormActions<DTO, ERROR, CREATE_DTO>(featureName);\r\n const reducer = createFormReducer(actions);\r\n const getState = createFeatureSelector<FormState<DTO, ERROR>>(featureName);\r\n const selectors = createFormSelectors(getState);\r\n\r\n return {\r\n actions,\r\n reducer: (state: FormState<DTO, ERROR>, action: Action): FormState<DTO, ERROR> => reducer(state, action),\r\n selectors\r\n };\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAOsB,mBAAmB,CAAA;IA6EvC,WACqB,CAAA,QAAiB,EACjB,KAAY,EACd,OAAqC,EACrC,WAAgD,EAChD,mBAAmD,EAAA;AAJjD,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAS;AACjB,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAO;AACd,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAA8B;AACrC,QAAA,IAAW,CAAA,WAAA,GAAX,WAAW,CAAqC;AAChD,QAAA,IAAmB,CAAA,mBAAA,GAAnB,mBAAmB,CAAgC;AAjFtE,QAAA,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,MACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAC7B,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,KACf,IAAI,CAAC,OAA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