@ngdux/list 0.1.6
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/README.md +7 -0
- package/esm2020/index.mjs +6 -0
- package/esm2020/lib/+state/abstract-list-effects.mjs +83 -0
- package/esm2020/lib/+state/list-actions.mjs +56 -0
- package/esm2020/lib/+state/list-reducer.mjs +139 -0
- package/esm2020/lib/+state/list-selectors.mjs +70 -0
- package/esm2020/lib/models/list.model.mjs +2 -0
- package/esm2020/ngdux-list.mjs +5 -0
- package/fesm2015/ngdux-list.mjs +295 -0
- package/fesm2015/ngdux-list.mjs.map +1 -0
- package/fesm2020/ngdux-list.mjs +351 -0
- package/fesm2020/ngdux-list.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/+state/abstract-list-effects.d.ts +65 -0
- package/lib/+state/list-actions.d.ts +2 -0
- package/lib/+state/list-reducer.d.ts +10 -0
- package/lib/+state/list-selectors.d.ts +4 -0
- package/lib/models/list.model.d.ts +122 -0
- package/package.json +43 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ErrorDto, FilteringOptions, PagingOptions, RequestOptions, RequestState, SortingField, SortingOptions } from '@ngdux/data-model-common';
|
|
2
|
+
import { ApiRequestState, LoadingState } from '@ngdux/store-common';
|
|
3
|
+
import { EntityState } from '@ngrx/entity';
|
|
4
|
+
import { ActionCreator, MemoizedSelector } from '@ngrx/store';
|
|
5
|
+
import { TypedAction } from '@ngrx/store/src/models';
|
|
6
|
+
export interface ListState<T, E> extends EntityState<T>, RequestOptions, ApiRequestState<E>, LoadingState {
|
|
7
|
+
selectedResourceIds: string[];
|
|
8
|
+
lastPageNumber: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ListSelectors<T, E> {
|
|
11
|
+
getAll: MemoizedSelector<object, T[]>;
|
|
12
|
+
getRequestOptions: MemoizedSelector<object, RequestOptions>;
|
|
13
|
+
isLastPage: MemoizedSelector<object, boolean>;
|
|
14
|
+
getCurrentPageData: MemoizedSelector<object, T[]>;
|
|
15
|
+
getPagingOptions: MemoizedSelector<object, PagingOptions>;
|
|
16
|
+
getSortingOptions: MemoizedSelector<object, SortingOptions>;
|
|
17
|
+
getFilteringOptions: MemoizedSelector<object, FilteringOptions>;
|
|
18
|
+
getCurrentPageNumber: MemoizedSelector<object, number>;
|
|
19
|
+
getLastPageNumber: MemoizedSelector<object, number>;
|
|
20
|
+
getLoadingState: MemoizedSelector<object, RequestState>;
|
|
21
|
+
getSelectedResourceIds: MemoizedSelector<object, string[]>;
|
|
22
|
+
getSelected: MemoizedSelector<object, T[]>;
|
|
23
|
+
getSelectionRecord: MemoizedSelector<object, Record<string, T>>;
|
|
24
|
+
getRequestState: MemoizedSelector<object, RequestState>;
|
|
25
|
+
getErrors: MemoizedSelector<object, E>;
|
|
26
|
+
areSelectedReady: MemoizedSelector<object, boolean>;
|
|
27
|
+
isReady: MemoizedSelector<object, boolean>;
|
|
28
|
+
isDeleteDisabled: MemoizedSelector<object, boolean>;
|
|
29
|
+
isCopyDisabled: MemoizedSelector<object, boolean>;
|
|
30
|
+
getTotalCount: MemoizedSelector<object, number>;
|
|
31
|
+
}
|
|
32
|
+
export interface ListActions<T, E, S = T> {
|
|
33
|
+
initializeRequestOptions: ActionCreator<string, () => TypedAction<string>>;
|
|
34
|
+
changePagingOptions: ActionCreator<string, (props: {
|
|
35
|
+
pagingOptions: PagingOptions;
|
|
36
|
+
}) => {
|
|
37
|
+
pagingOptions: PagingOptions;
|
|
38
|
+
} & TypedAction<string>>;
|
|
39
|
+
changePageSize: ActionCreator<string, (props: {
|
|
40
|
+
pageSize: number;
|
|
41
|
+
}) => {
|
|
42
|
+
pageSize: number;
|
|
43
|
+
} & TypedAction<string>>;
|
|
44
|
+
changeSorting: ActionCreator<string, (props: {
|
|
45
|
+
sortingField: SortingField;
|
|
46
|
+
}) => {
|
|
47
|
+
sortingField: SortingField;
|
|
48
|
+
} & TypedAction<string>>;
|
|
49
|
+
changeFiltering: ActionCreator<string, (props: {
|
|
50
|
+
filteringOptions: FilteringOptions;
|
|
51
|
+
}) => {
|
|
52
|
+
filteringOptions: FilteringOptions;
|
|
53
|
+
} & TypedAction<string>>;
|
|
54
|
+
changeSelected: ActionCreator<string, (props: {
|
|
55
|
+
selectedResourceIds: string[];
|
|
56
|
+
}) => {
|
|
57
|
+
selectedResourceIds: string[];
|
|
58
|
+
} & TypedAction<string>>;
|
|
59
|
+
loadPage: ActionCreator<string, (props: {
|
|
60
|
+
pageNumber: number;
|
|
61
|
+
}) => {
|
|
62
|
+
pageNumber: number;
|
|
63
|
+
} & TypedAction<string>>;
|
|
64
|
+
loadPageSuccess: ActionCreator<string, (props: {
|
|
65
|
+
resources: S[];
|
|
66
|
+
pagingOptions: PagingOptions;
|
|
67
|
+
}) => {
|
|
68
|
+
resources: S[];
|
|
69
|
+
pagingOptions: PagingOptions;
|
|
70
|
+
} & TypedAction<string>>;
|
|
71
|
+
loadPageFailure: ActionCreator<string, (props: {
|
|
72
|
+
errors: E;
|
|
73
|
+
}) => {
|
|
74
|
+
errors: E;
|
|
75
|
+
} & TypedAction<string>>;
|
|
76
|
+
delete: ActionCreator<string, (props: {
|
|
77
|
+
resourceIds: string[];
|
|
78
|
+
}) => {
|
|
79
|
+
resourceIds: string[];
|
|
80
|
+
} & TypedAction<string>>;
|
|
81
|
+
deleteSuccess: ActionCreator<string, (props: {
|
|
82
|
+
resourceIds: string[];
|
|
83
|
+
}) => {
|
|
84
|
+
resourceIds: string[];
|
|
85
|
+
} & TypedAction<string>>;
|
|
86
|
+
deleteFailure: ActionCreator<string, (props: {
|
|
87
|
+
errors: E;
|
|
88
|
+
}) => {
|
|
89
|
+
errors: E;
|
|
90
|
+
} & TypedAction<string>>;
|
|
91
|
+
patch: ActionCreator<string, (props: {
|
|
92
|
+
resourceIds: string[];
|
|
93
|
+
resource: Partial<T>;
|
|
94
|
+
}) => {
|
|
95
|
+
resourceIds: string[];
|
|
96
|
+
resource: Partial<T>;
|
|
97
|
+
} & TypedAction<string>>;
|
|
98
|
+
patchSuccess: ActionCreator<string, (props: {
|
|
99
|
+
resources: (T | ErrorDto)[];
|
|
100
|
+
}) => {
|
|
101
|
+
resources: (T | ErrorDto)[];
|
|
102
|
+
} & TypedAction<string>>;
|
|
103
|
+
patchFailure: ActionCreator<string, (props: {
|
|
104
|
+
errors: E;
|
|
105
|
+
}) => {
|
|
106
|
+
errors: E;
|
|
107
|
+
} & TypedAction<string>>;
|
|
108
|
+
loadNextPage: ActionCreator<string, () => TypedAction<string>>;
|
|
109
|
+
refresh: ActionCreator<string, () => TypedAction<string>>;
|
|
110
|
+
initialize: ActionCreator<string, () => TypedAction<string>>;
|
|
111
|
+
reinitialize: ActionCreator<string, () => TypedAction<string>>;
|
|
112
|
+
loadPreviousPage: ActionCreator<string, () => TypedAction<string>>;
|
|
113
|
+
loadFirstPage: ActionCreator<string, () => TypedAction<string>>;
|
|
114
|
+
resetRequestState: ActionCreator<string, () => TypedAction<string>>;
|
|
115
|
+
copySelected: ActionCreator<string, () => TypedAction<string>>;
|
|
116
|
+
navigateToSelected: ActionCreator<string, (props: {
|
|
117
|
+
resourceId: string;
|
|
118
|
+
}) => {
|
|
119
|
+
resourceId: string;
|
|
120
|
+
} & TypedAction<string>>;
|
|
121
|
+
showRemovalsConfirmation: ActionCreator<string, () => TypedAction<string>>;
|
|
122
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ngdux/list",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^14.2.0",
|
|
6
|
+
"@angular/core": "^14.2.0",
|
|
7
|
+
"@angular/router": "14.2.6",
|
|
8
|
+
"@ngdux/data-model-common": "0.1.6",
|
|
9
|
+
"@ngdux/store-common": "0.1.6",
|
|
10
|
+
"@ngrx/effects": "14.0.2",
|
|
11
|
+
"@angular/material": "14.2.5",
|
|
12
|
+
"@ngrx/entity": "14.0.2"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"tslib": "^2.3.0"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git@github.com:allanartuso/ngdux.git",
|
|
20
|
+
"directory": "/libs/ngdux/util/store/list"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/allanartuso/ngdux/tree/master/libs/ngdux/util/store/list#readme",
|
|
23
|
+
"module": "fesm2015/ngdux-list.mjs",
|
|
24
|
+
"es2020": "fesm2020/ngdux-list.mjs",
|
|
25
|
+
"esm2020": "esm2020/ngdux-list.mjs",
|
|
26
|
+
"fesm2020": "fesm2020/ngdux-list.mjs",
|
|
27
|
+
"fesm2015": "fesm2015/ngdux-list.mjs",
|
|
28
|
+
"typings": "index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
"./package.json": {
|
|
31
|
+
"default": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./index.d.ts",
|
|
35
|
+
"esm2020": "./esm2020/ngdux-list.mjs",
|
|
36
|
+
"es2020": "./fesm2020/ngdux-list.mjs",
|
|
37
|
+
"es2015": "./fesm2015/ngdux-list.mjs",
|
|
38
|
+
"node": "./fesm2015/ngdux-list.mjs",
|
|
39
|
+
"default": "./fesm2020/ngdux-list.mjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false
|
|
43
|
+
}
|