ngrx-entity-crud 16.1.0 → 16.1.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/package.json +1 -1
- package/schematics/auth/files/views/login/components/logout-button/logout-button.component.ts +0 -1
- package/schematics/auth/files/views/login/login.module.ts +0 -1
- package/schematics/ng-add/files/src/app/root-store/root-reducer.ts +4 -3
- package/schematics/ng-add/files/src/app/root-store/router-store/pop-up-base.module.ts +0 -1
- package/schematics/ng-add/files/src/app/root-store/router-store/selectors.ts +16 -8
- package/schematics/ng-add/files/src/environments/environment.ts +2 -1
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +2 -2
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__.module.ts +1 -1
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__.module.ts +1 -1
- package/schematics/section/files/primeng/plural/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +2 -2
- package/schematics/section/files/primeng/plural/__clazz@dasherize__/__clazz@dasherize__.module.ts +1 -1
- package/schematics/section/files/primeng/singular/__clazz@dasherize__/__clazz@dasherize__.module.ts +1 -1
- package/schematics/store/files/crud-service/plural/__clazz@dasherize__.service.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ActionReducerMap, MetaReducer} from '@ngrx/store';
|
|
2
|
-
import {State} from '@root-store/state';
|
|
3
2
|
import {environment} from '../../environments/environment';
|
|
4
3
|
|
|
5
|
-
export
|
|
4
|
+
export interface AppState {}
|
|
6
5
|
|
|
7
|
-
export const
|
|
6
|
+
export const reducers: ActionReducerMap<AppState> = {};
|
|
7
|
+
|
|
8
|
+
export const metaReducers: MetaReducer<AppState>[] = !environment.production ? [] : [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/store';
|
|
2
|
-
import * as fromRouter from '@ngrx/router-store';
|
|
3
2
|
import {Data, NavigationExtras, Params} from '@angular/router';
|
|
4
3
|
import {State} from './state';
|
|
5
4
|
import {evalData} from 'ngrx-entity-crud';
|
|
5
|
+
import {getRouterSelectors} from "@ngrx/router-store";
|
|
6
6
|
|
|
7
7
|
export const selectRouterState: MemoizedSelector<object, State> = createFeatureSelector<State>('router');
|
|
8
8
|
const getOptions = (state: State): any => state?.state?.root?.firstChild?.params["options"];
|
|
@@ -31,13 +31,17 @@ export const hasPopUp: MemoizedSelector<object, NavigationExtras> = createSelect
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export const {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
selectCurrentRoute, // select the current route
|
|
35
|
+
selectFragment, // select the current route fragment
|
|
36
|
+
selectQueryParams, // select the current route query params
|
|
37
|
+
selectQueryParam, // factory function to select a query param
|
|
38
|
+
selectRouteParams, // select the current route params
|
|
39
|
+
selectRouteParam, // factory function to select a route param
|
|
40
|
+
selectRouteData, // select the current route data
|
|
41
|
+
selectRouteDataParam, // factory function to select a route data param
|
|
42
|
+
selectUrl, // select the current url
|
|
43
|
+
selectTitle, // select the title if available
|
|
44
|
+
} = getRouterSelectors(selectRouterState);
|
|
41
45
|
|
|
42
46
|
export const all: MemoizedSelector<object, RuoteData> = createSelector(
|
|
43
47
|
selectQueryParams,
|
|
@@ -61,3 +65,7 @@ export interface RuoteData {
|
|
|
61
65
|
selectUrl: string;
|
|
62
66
|
}
|
|
63
67
|
|
|
68
|
+
export const selectId = createSelector(
|
|
69
|
+
selectRouteParams,
|
|
70
|
+
(params:Params) => params['id']
|
|
71
|
+
)
|
|
@@ -16,14 +16,14 @@ export class <%= clazz %>EditComponent extends EditBaseComponent<<%= clazz %>> {
|
|
|
16
16
|
form: FormGroup;
|
|
17
17
|
keys: string[];
|
|
18
18
|
|
|
19
|
-
setItemPerform(value: <%= clazz %>): void {
|
|
19
|
+
override setItemPerform(value: <%= clazz %>): void {
|
|
20
20
|
const group = this.fb.group({});
|
|
21
21
|
this.keys = Object.keys(value);
|
|
22
22
|
this.keys.forEach(key => group.addControl(key, this.fb.control({value: value[key], disabled: key === 'id'})));
|
|
23
23
|
this.form = group;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
onSavePerform(item: <%= clazz %>): void {
|
|
26
|
+
override onSavePerform(item: <%= clazz %>): void {
|
|
27
27
|
this.store$.dispatch(<%= clazz %>StoreActions.EditRequest({
|
|
28
28
|
item, onResult: [
|
|
29
29
|
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
@@ -15,14 +15,14 @@ export class <%= clazz %>EditComponent extends PopUpBaseComponent<<%= clazz %>>
|
|
|
15
15
|
form: FormGroup;
|
|
16
16
|
keys: string[];
|
|
17
17
|
|
|
18
|
-
setItemPerform(value: <%= clazz %>): void {
|
|
18
|
+
override setItemPerform(value: <%= clazz %>): void {
|
|
19
19
|
const group = this.fb.group({});
|
|
20
20
|
this.keys = Object.keys(value);
|
|
21
21
|
this.keys.forEach(key => group.addControl(key, this.fb.control({value: value[key], disabled: key === 'id'})));
|
|
22
22
|
this.form = group;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
acceptPerform(mutationParams: <%= clazz %>): void {
|
|
25
|
+
override acceptPerform(mutationParams: <%= clazz %>): void {
|
|
26
26
|
if (mutationParams.id) {
|
|
27
27
|
this.store$.dispatch(<%= clazz %>StoreActions.EditRequest({
|
|
28
28
|
mutationParams, onResult: [
|
|
@@ -7,5 +7,5 @@ import {BaseCrudService} from 'ngrx-entity-crud';
|
|
|
7
7
|
providedIn: 'root'
|
|
8
8
|
})
|
|
9
9
|
export class <%= clazz %>Service extends BaseCrudService<<%= clazz %>> {
|
|
10
|
-
|
|
10
|
+
public override service = environment.webServiceUri + '<%= dasherize(clazz) %>';
|
|
11
11
|
}
|