@ngdux/list 3.0.1 → 4.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.
Files changed (30) hide show
  1. package/fesm2022/ngdux-list.mjs +16 -16
  2. package/fesm2022/ngdux-list.mjs.map +1 -1
  3. package/index.d.ts +368 -10
  4. package/package.json +1 -3
  5. package/esm2022/index.mjs +0 -12
  6. package/esm2022/lib/+state/effects.mjs +0 -23
  7. package/esm2022/lib/+state/state.service.mjs +0 -55
  8. package/esm2022/lib/models/list.model.mjs +0 -7
  9. package/esm2022/lib/ngdux-list-state.module.mjs +0 -53
  10. package/esm2022/lib/services/list-notification-service.mjs +0 -21
  11. package/esm2022/lib/state-generator/abstract-list-effects.mjs +0 -50
  12. package/esm2022/lib/state-generator/abstract-list-state.service.mjs +0 -44
  13. package/esm2022/lib/state-generator/abstract-list.facade.mjs +0 -85
  14. package/esm2022/lib/state-generator/list-actions.mjs +0 -58
  15. package/esm2022/lib/state-generator/list-reducer.mjs +0 -104
  16. package/esm2022/lib/state-generator/list-selectors.mjs +0 -80
  17. package/esm2022/lib/state-generator/list-state.mjs +0 -18
  18. package/esm2022/ngdux-list.mjs +0 -5
  19. package/lib/+state/effects.d.ts +0 -14
  20. package/lib/+state/state.service.d.ts +0 -22
  21. package/lib/models/list.model.d.ts +0 -191
  22. package/lib/ngdux-list-state.module.d.ts +0 -23
  23. package/lib/services/list-notification-service.d.ts +0 -13
  24. package/lib/state-generator/abstract-list-effects.d.ts +0 -49
  25. package/lib/state-generator/abstract-list-state.service.d.ts +0 -21
  26. package/lib/state-generator/abstract-list.facade.d.ts +0 -45
  27. package/lib/state-generator/list-actions.d.ts +0 -2
  28. package/lib/state-generator/list-reducer.d.ts +0 -10
  29. package/lib/state-generator/list-selectors.d.ts +0 -4
  30. package/lib/state-generator/list-state.d.ts +0 -12
@@ -1,22 +0,0 @@
1
- import { ReducerManager } from '@ngrx/store';
2
- import { ListActions, ListSelectors } from '../models/list.model';
3
- import * as i0 from "@angular/core";
4
- export declare class ListStateService<T extends {
5
- [key: string]: any;
6
- }, Error = unknown, S extends {
7
- [key: string]: any;
8
- } = T, Params = Record<string, string>> {
9
- private readonly reducerManager;
10
- protected actions: Record<string, ListActions<T, Error, S, Params>>;
11
- protected selectors: Record<string, ListSelectors<S, Error, Params>>;
12
- private entityAdapter;
13
- constructor(reducerManager: ReducerManager, featureKeys: string[]);
14
- protected getActions(featureKey: string): ListActions<T, Error, S, Params>;
15
- private getEntityAdapter;
16
- protected addReducer(featureKey: string, actions: ListActions<T, Error, S, Params>): void;
17
- protected getSelectors(featureKey: string): ListSelectors<S, Error, Params>;
18
- getFeatureActions(featureKey: string): ListActions<T, Error, S, Params>;
19
- getFeatureSelectors(featureKey: string): ListSelectors<S, Error, Params>;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<ListStateService<any, any, any, any>, never>;
21
- static ɵprov: i0.ɵɵInjectableDeclaration<ListStateService<any, any, any, any>>;
22
- }
@@ -1,191 +0,0 @@
1
- import { InjectionToken, Type } from '@angular/core';
2
- import { ErrorDto, FilteringOptions, ListNotificationService, ListService, PagingOptions, RequestOptions, RequestState, SortingField } from '@ngdux/data-model-common';
3
- import { ApiRequestState, LoadingState } from '@ngdux/store-common';
4
- import { EntityState } from '@ngrx/entity';
5
- import { ActionCreator, MemoizedSelector } from '@ngrx/store';
6
- import { TypedAction } from '@ngrx/store/src/models';
7
- export declare const LIST_FEATURE_KEY: InjectionToken<string>;
8
- export declare const LIST_FEATURE_KEYS: InjectionToken<string>;
9
- export declare const LIST_SERVICES: InjectionToken<string>;
10
- export declare const LIST_NOTIFICATION_SERVICES: InjectionToken<string>;
11
- export interface ListState<T, E = unknown, Params = Record<string, string>> extends EntityState<T>, RequestOptions<Params>, ApiRequestState<E>, LoadingState {
12
- selectedResourceIds: string[];
13
- lastPageNumber?: number;
14
- }
15
- export interface ListSelectors<T, E = unknown, Params = Record<string, string>> {
16
- getAll: MemoizedSelector<object, T[]>;
17
- getRequestOptions: MemoizedSelector<object, RequestOptions>;
18
- isLastPage: MemoizedSelector<object, boolean>;
19
- getCurrentPageData: MemoizedSelector<object, T[]>;
20
- getPagingOptions: MemoizedSelector<object, PagingOptions>;
21
- getSortingOptions: MemoizedSelector<object, SortingField[]>;
22
- getFilteringOptions: MemoizedSelector<object, FilteringOptions>;
23
- getRequestParameters: MemoizedSelector<object, Params | undefined>;
24
- getCurrentPageNumber: MemoizedSelector<object, number>;
25
- getLastPageNumber: MemoizedSelector<object, number | undefined>;
26
- getLoadingState: MemoizedSelector<object, RequestState>;
27
- getSelectedResourceIds: MemoizedSelector<object, string[]>;
28
- getSelectedItems: MemoizedSelector<object, T[]>;
29
- getSelectionRecord: MemoizedSelector<object, Record<string, T>>;
30
- getRequestState: MemoizedSelector<object, RequestState>;
31
- getErrors: MemoizedSelector<object, E | undefined>;
32
- areSelectedReady: MemoizedSelector<object, boolean>;
33
- isReady: MemoizedSelector<object, boolean>;
34
- isDeleteDisabled: MemoizedSelector<object, boolean>;
35
- isCopyDisabled: MemoizedSelector<object, boolean>;
36
- getTotalCount: MemoizedSelector<object, number>;
37
- }
38
- export interface ListActions<Entity, Error = unknown, Summary = Entity, Params = Record<string, string>> {
39
- /**
40
- * Set the page size without reloading the list
41
- */
42
- setPageSize: ActionCreator<string, (props: {
43
- pageSize: number;
44
- }) => {
45
- pageSize: number;
46
- } & TypedAction<string>>;
47
- /**
48
- * Set the sorting options without reloading the list
49
- */
50
- setSorting: ActionCreator<string, (props: {
51
- sortingOptions: SortingField[];
52
- }) => {
53
- sortingOptions: SortingField[];
54
- } & TypedAction<string>>;
55
- /**
56
- * Set the filtering options without reloading the list
57
- */
58
- setFiltering: ActionCreator<string, (props: {
59
- filteringOptions: FilteringOptions;
60
- }) => {
61
- filteringOptions: FilteringOptions;
62
- } & TypedAction<string>>;
63
- /**
64
- * Set the request parameters without reloading the list
65
- */
66
- setRequestParams: ActionCreator<string, (props: {
67
- params: Params;
68
- }) => {
69
- params: Params;
70
- } & TypedAction<string>>;
71
- /**
72
- * Change the paging options and reload the list
73
- */
74
- changePagingOptions: ActionCreator<string, (props: {
75
- pagingOptions: PagingOptions;
76
- }) => {
77
- pagingOptions: PagingOptions;
78
- } & TypedAction<string>>;
79
- /**
80
- * Change the page number and reload the list
81
- */
82
- changePageNumber: ActionCreator<string, (props: {
83
- pageNumber: number;
84
- }) => {
85
- pageNumber: number;
86
- } & TypedAction<string>>;
87
- /**
88
- * Change the page size and reload the list
89
- */
90
- changePageSize: ActionCreator<string, (props: {
91
- pageSize: number;
92
- }) => {
93
- pageSize: number;
94
- } & TypedAction<string>>;
95
- /**
96
- * Change the sorting options and reload the list
97
- */
98
- changeSorting: ActionCreator<string, (props: {
99
- sortingOptions: SortingField[];
100
- }) => {
101
- sortingOptions: SortingField[];
102
- } & TypedAction<string>>;
103
- /**
104
- * Change the filtering options and reload the list
105
- */
106
- changeFiltering: ActionCreator<string, (props: {
107
- filteringOptions: FilteringOptions;
108
- }) => {
109
- filteringOptions: FilteringOptions;
110
- } & TypedAction<string>>;
111
- /**
112
- * Change the request parameters and reload the list
113
- */
114
- changeRequestParams: ActionCreator<string, (props: {
115
- params: Params;
116
- }) => {
117
- params: Params;
118
- } & TypedAction<string>>;
119
- changeSelectedResources: ActionCreator<string, (props: {
120
- selectedResourceIds: string[];
121
- }) => {
122
- selectedResourceIds: string[];
123
- } & TypedAction<string>>;
124
- loadPage: ActionCreator<string, () => TypedAction<string>>;
125
- loadPageSuccess: ActionCreator<string, (props: {
126
- resources: Summary[];
127
- pagingOptions: PagingOptions;
128
- }) => {
129
- resources: Summary[];
130
- pagingOptions: PagingOptions;
131
- } & TypedAction<string>>;
132
- loadPageFailure: ActionCreator<string, (props: {
133
- errors: Error;
134
- }) => {
135
- errors: Error;
136
- } & TypedAction<string>>;
137
- delete: ActionCreator<string, (props: {
138
- resourceIds: string[];
139
- }) => {
140
- resourceIds: string[];
141
- } & TypedAction<string>>;
142
- deleteSuccess: ActionCreator<string, (props: {
143
- resourceIds: string[];
144
- }) => {
145
- resourceIds: string[];
146
- } & TypedAction<string>>;
147
- deleteFailure: ActionCreator<string, (props: {
148
- errors: Error;
149
- }) => {
150
- errors: Error;
151
- } & TypedAction<string>>;
152
- patch: ActionCreator<string, (props: {
153
- resourceIds: string[];
154
- resource: Partial<Entity>;
155
- }) => {
156
- resourceIds: string[];
157
- resource: Partial<Entity>;
158
- } & TypedAction<string>>;
159
- patchSuccess: ActionCreator<string, (props: {
160
- resources: (Entity | ErrorDto)[];
161
- }) => {
162
- resources: (Entity | ErrorDto)[];
163
- } & TypedAction<string>>;
164
- patchFailure: ActionCreator<string, (props: {
165
- errors: Error;
166
- }) => {
167
- errors: Error;
168
- } & TypedAction<string>>;
169
- loadNextPage: ActionCreator<string, () => TypedAction<string>>;
170
- /**
171
- * Remove the current data, set the page number to 1 and deselect resources.
172
- * Keep all the rest, like filteringOptions and sortingOptions
173
- */
174
- initialize: ActionCreator<string, () => TypedAction<string>>;
175
- /**
176
- * Reset to the initial state
177
- */
178
- reset: ActionCreator<string, () => TypedAction<string>>;
179
- loadPreviousPage: ActionCreator<string, () => TypedAction<string>>;
180
- loadFirstPage: ActionCreator<string, () => TypedAction<string>>;
181
- /**
182
- * Reset the request state to idle
183
- */
184
- resetRequestState: ActionCreator<string, () => TypedAction<string>>;
185
- }
186
- export interface NgduxListStateModuleConfig<T extends {
187
- [key: string]: any;
188
- }, E, S = T, Params = Record<string, string>> {
189
- service: Type<ListService<T, S, Params>>;
190
- notificationService?: Type<ListNotificationService<E>>;
191
- }
@@ -1,23 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { ListNotificationService, ListService } from '@ngdux/data-model-common';
3
- import { RegisterEffectsService } from '@ngdux/store-common';
4
- import { Actions } from '@ngrx/effects';
5
- import { Store } from '@ngrx/store';
6
- import { ListStateService } from './+state/state.service';
7
- import { NgduxListStateModuleConfig } from './models/list.model';
8
- import * as i0 from "@angular/core";
9
- export declare class NgduxListStateModule<T extends {
10
- [key: string]: any;
11
- }, Error = unknown, S extends {
12
- [key: string]: any;
13
- } = T, Params = Record<string, string>> {
14
- constructor(registerEffectsService: RegisterEffectsService, actions$: Actions, store: Store, listStateService: ListStateService<T, Error, S, Params>, featureKeys: string[], services: ListService<T, S, Params>[], notificationServices: ListNotificationService<Error>[]);
15
- static config<T extends {
16
- [key: string]: any;
17
- }, Error = unknown, S extends {
18
- [key: string]: any;
19
- } = T, Params = Record<string, string>>(config: NgduxListStateModuleConfig<T, Error, S, Params>): ModuleWithProviders<NgduxListStateModule<T, Error, S, Params>>;
20
- static ɵfac: i0.ɵɵFactoryDeclaration<NgduxListStateModule, never>;
21
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgduxListStateModule, never, never, never>;
22
- static ɵinj: i0.ɵɵInjectorDeclaration<NgduxListStateModule>;
23
- }
@@ -1,13 +0,0 @@
1
- import { ErrorDto, ListNotificationService } from '@ngdux/data-model-common';
2
- import { Observable } from 'rxjs';
3
- import * as i0 from "@angular/core";
4
- export declare class NotificationServicePlaceholder implements ListNotificationService<ErrorDto> {
5
- onListErrors(errors: ErrorDto): void;
6
- onListDelete(ids: string[]): void;
7
- openConfirmationDialog(data: {
8
- message: string;
9
- title: string;
10
- }): Observable<boolean>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<NotificationServicePlaceholder, never>;
12
- static ɵprov: i0.ɵɵInjectableDeclaration<NotificationServicePlaceholder>;
13
- }
@@ -1,49 +0,0 @@
1
- import { ListNotificationService, ListService } from '@ngdux/data-model-common';
2
- import { Actions } from '@ngrx/effects';
3
- import { Store } from '@ngrx/store';
4
- import { ListActions, ListSelectors } from '../models/list.model';
5
- export declare abstract class AbstractListEffects<T, E = unknown, S = T, Params = Record<string, string>> {
6
- protected readonly actions$: Actions;
7
- protected readonly store: Store;
8
- protected readonly service: ListService<T, S, Params>;
9
- protected readonly listActions: ListActions<T, E, S, Params>;
10
- protected readonly listSelectors: ListSelectors<S, E, Params>;
11
- protected readonly notificationService?: ListNotificationService<E> | undefined;
12
- reload$: import("rxjs").Observable<import("@ngrx/store/src/models").TypedAction<string>> & import("@ngrx/effects").CreateEffectMetadata;
13
- loadFirstPage$: import("rxjs").Observable<{
14
- pageNumber: number;
15
- } & import("@ngrx/store/src/models").TypedAction<string>> & import("@ngrx/effects").CreateEffectMetadata;
16
- loadPreviousPage$: import("rxjs").Observable<{
17
- pageNumber: number;
18
- } & import("@ngrx/store/src/models").TypedAction<string>> & import("@ngrx/effects").CreateEffectMetadata;
19
- loadNextPage$: import("rxjs").Observable<{
20
- pageNumber: number;
21
- } & import("@ngrx/store/src/models").TypedAction<string>> & import("@ngrx/effects").CreateEffectMetadata;
22
- loadPage$: import("rxjs").Observable<({
23
- resources: S[];
24
- pagingOptions: import("@ngdux/data-model-common").PagingOptions;
25
- } & import("@ngrx/store/src/models").TypedAction<string>) | ({
26
- errors: E;
27
- } & import("@ngrx/store/src/models").TypedAction<string>)> & import("@ngrx/effects").CreateEffectMetadata;
28
- patch$: import("rxjs").Observable<({
29
- resources: (import("@ngdux/data-model-common").ErrorDto | T)[];
30
- } & import("@ngrx/store/src/models").TypedAction<string>) | ({
31
- errors: E;
32
- } & import("@ngrx/store/src/models").TypedAction<string>)> & import("@ngrx/effects").CreateEffectMetadata;
33
- delete$: import("rxjs").Observable<({
34
- resourceIds: string[];
35
- } & import("@ngrx/store/src/models").TypedAction<string>) | ({
36
- errors: E;
37
- } & import("@ngrx/store/src/models").TypedAction<string>)> & import("@ngrx/effects").CreateEffectMetadata;
38
- deleteSuccess$: import("rxjs").Observable<{
39
- resourceIds: string[];
40
- } & import("@ngrx/store/src/models").TypedAction<string>> & import("@ngrx/effects").CreateEffectMetadata;
41
- errorsHandler$: import("rxjs").Observable<({
42
- errors: E;
43
- } & import("@ngrx/store/src/models").TypedAction<string>) | ({
44
- errors: E;
45
- } & import("@ngrx/store/src/models").TypedAction<string>) | ({
46
- errors: E;
47
- } & import("@ngrx/store/src/models").TypedAction<string>)> & import("@ngrx/effects").CreateEffectMetadata;
48
- protected constructor(actions$: Actions, store: Store, service: ListService<T, S, Params>, listActions: ListActions<T, E, S, Params>, listSelectors: ListSelectors<S, E, Params>, notificationService?: ListNotificationService<E> | undefined);
49
- }
@@ -1,21 +0,0 @@
1
- import { ReducerManager } from '@ngrx/store';
2
- import { ListActions, ListSelectors } from '../models/list.model';
3
- import * as i0 from "@angular/core";
4
- export declare abstract class AbstractListReducerManager<T extends {
5
- [key: string]: any;
6
- }, E, S extends {
7
- [key: string]: any;
8
- } = T, Params = Record<string, string>> {
9
- private readonly reducerManager;
10
- private readonly featureKey;
11
- actions: ListActions<T, E, S, Params>;
12
- selectors: ListSelectors<S, E, Params>;
13
- private entityAdapter;
14
- constructor(reducerManager: ReducerManager, featureKey: string);
15
- protected getActions(): ListActions<T, E, S, Params>;
16
- private getEntityAdapter;
17
- protected addReducer(): void;
18
- protected getSelectors(): ListSelectors<S, E, Params>;
19
- static ɵfac: i0.ɵɵFactoryDeclaration<AbstractListReducerManager<any, any, any, any>, never>;
20
- static ɵprov: i0.ɵɵInjectableDeclaration<AbstractListReducerManager<any, any, any, any>>;
21
- }
@@ -1,45 +0,0 @@
1
- import { ActionPayload } from '@ngdux/store-common';
2
- import { Store } from '@ngrx/store';
3
- import { ListActions, ListSelectors } from '../models/list.model';
4
- export declare abstract class AbstractListFacade<T, E, S = T, Params = Record<string, string>> {
5
- protected readonly store: Store;
6
- private readonly listActions;
7
- private readonly listSelectors;
8
- readonly resources$: import("rxjs").Observable<S[]>;
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
- readonly areSelectedReady$: import("rxjs").Observable<boolean>;
14
- readonly currentPageData$: import("rxjs").Observable<S[]>;
15
- readonly currentPageNumber$: import("rxjs").Observable<number>;
16
- readonly filteringOptions$: import("rxjs").Observable<import("@ngdux/data-model-common").FilteringOptions>;
17
- readonly requestParameters$: import("rxjs").Observable<Params | undefined>;
18
- readonly lastPageNumber$: import("rxjs").Observable<number | undefined>;
19
- readonly pagingOptions$: import("rxjs").Observable<import("@ngdux/data-model-common").PagingOptions>;
20
- readonly requestOptions$: import("rxjs").Observable<import("@ngdux/data-model-common").RequestOptions<Record<string, string>>>;
21
- readonly sortingOptions$: import("rxjs").Observable<import("@ngdux/data-model-common").SortingField[]>;
22
- readonly selectedItems$: import("rxjs").Observable<S[]>;
23
- readonly totalCount$: import("rxjs").Observable<number>;
24
- constructor(store: Store, listActions: ListActions<T, E, S, Params>, listSelectors: ListSelectors<S, E, Params>);
25
- setPageSize(props: ActionPayload<ListActions<T, E, S, Params>['setPageSize']>): void;
26
- setFiltering(props: ActionPayload<ListActions<T, E, S, Params>['setFiltering']>): void;
27
- setSorting(props: ActionPayload<ListActions<T, E, S, Params>['setSorting']>): void;
28
- setRequestParameters(props: ActionPayload<ListActions<T, E, S, Params>['setRequestParams']>): void;
29
- changeFiltering(props: ActionPayload<ListActions<T, E, S, Params>['changeFiltering']>): void;
30
- changePagingOptions(props: ActionPayload<ListActions<T, E, S, Params>['changePagingOptions']>): void;
31
- changePageSize(props: ActionPayload<ListActions<T, E, S, Params>['changePageSize']>): void;
32
- changePageNumber(props: ActionPayload<ListActions<T, E, S, Params>['changePageNumber']>): void;
33
- changeSelectedResources(props: ActionPayload<ListActions<T, E, S, Params>['changeSelectedResources']>): void;
34
- changeSorting(props: ActionPayload<ListActions<T, E, S, Params>['changeSorting']>): void;
35
- changeRequestParams(props: ActionPayload<ListActions<T, E, S, Params>['changeRequestParams']>): void;
36
- loadPage(): void;
37
- loadFirstPage(): void;
38
- loadNextPage(): void;
39
- loadPreviousPage(): void;
40
- patch(props: ActionPayload<ListActions<T, E, S, Params>['patch']>): void;
41
- delete(props: ActionPayload<ListActions<T, E, S, Params>['delete']>): void;
42
- initialize(): void;
43
- reinitialize(): void;
44
- resetRequestState(): void;
45
- }
@@ -1,2 +0,0 @@
1
- import { ListActions } from '../models/list.model';
2
- export declare function createListActions<T, E, S = T, Params = Record<string, string>>(featureName: string): ListActions<T, E, S, Params>;
@@ -1,10 +0,0 @@
1
- import { EntityAdapter } from '@ngrx/entity';
2
- import { ActionReducer, ReducerTypes } from '@ngrx/store';
3
- import { ActionCreator } from '@ngrx/store/src/models';
4
- import { ListActions, ListState } from '../models/list.model';
5
- export declare function createListEntityAdapter<T extends {
6
- [key: string]: any;
7
- }>(idKey?: string): EntityAdapter<T>;
8
- export declare function createListReducer<T, E, S = T, Params = Record<string, string>>(entityAdapter: EntityAdapter<S>, actions: ListActions<T, E, S, Params>, actionHandlers?: ReducerTypes<ListState<S, E, Params>, ActionCreator[]>[], initialListState?: {
9
- [key: string]: unknown;
10
- }): ActionReducer<ListState<S, E, Params>>;
@@ -1,4 +0,0 @@
1
- import { EntityAdapter } from '@ngrx/entity';
2
- import { DefaultProjectorFn, MemoizedSelector } from '@ngrx/store';
3
- import { ListSelectors, ListState } from '../models/list.model';
4
- export declare function createListSelectors<T, E, Params = Record<string, string>>(entityAdapter: EntityAdapter<T>, getListState: MemoizedSelector<object, ListState<T, E, Params>, DefaultProjectorFn<ListState<T, E, Params>>>): ListSelectors<T, E, Params>;
@@ -1,12 +0,0 @@
1
- import { Action } from '@ngrx/store';
2
- import { ListState } from '../models/list.model';
3
- export declare function createListState<T extends {
4
- [key: string]: any;
5
- }, E, S extends {
6
- [key: string]: any;
7
- } = T, Params = Record<string, string>>(featureName: string, idKey?: string): {
8
- actions: import("../models/list.model").ListActions<T, E, S, Params>;
9
- reducer: (state: ListState<S, E, Params>, action: Action) => ListState<S, E, Params>;
10
- selectors: import("../models/list.model").ListSelectors<S, E, Params>;
11
- entityAdapter: import("@ngrx/entity").EntityAdapter<S>;
12
- };