ngrx-entity-crud 12.0.6-beta.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/README.md +259 -0
- package/bundles/ngrx-entity-crud.umd.js +1829 -0
- package/bundles/ngrx-entity-crud.umd.js.map +1 -0
- package/esm2015/lib/actions.js +88 -0
- package/esm2015/lib/base-crud-gql.service.js +71 -0
- package/esm2015/lib/base-crud.service.js +136 -0
- package/esm2015/lib/create_adapter.js +14 -0
- package/esm2015/lib/effect.js +467 -0
- package/esm2015/lib/entity_state.js +23 -0
- package/esm2015/lib/ibase-crud-service.js +2 -0
- package/esm2015/lib/j-ngrx-filter.js +133 -0
- package/esm2015/lib/models.js +17 -0
- package/esm2015/lib/reducer.js +353 -0
- package/esm2015/lib/state_selectors.js +56 -0
- package/esm2015/lib/utils.js +19 -0
- package/esm2015/ngrx-entity-crud.js +5 -0
- package/esm2015/public-api.js +7 -0
- package/fesm2015/ngrx-entity-crud.js +1367 -0
- package/fesm2015/ngrx-entity-crud.js.map +1 -0
- package/lib/actions.d.ts +5 -0
- package/lib/actions.d.ts.map +1 -0
- package/lib/base-crud-gql.service.d.ts +19 -0
- package/lib/base-crud-gql.service.d.ts.map +1 -0
- package/lib/base-crud.service.d.ts +34 -0
- package/lib/base-crud.service.d.ts.map +1 -0
- package/lib/create_adapter.d.ts +6 -0
- package/lib/create_adapter.d.ts.map +1 -0
- package/lib/effect.d.ts +132 -0
- package/lib/effect.d.ts.map +1 -0
- package/lib/entity_state.d.ts +9 -0
- package/lib/entity_state.d.ts.map +1 -0
- package/lib/ibase-crud-service.d.ts +13 -0
- package/lib/ibase-crud-service.d.ts.map +1 -0
- package/lib/j-ngrx-filter.d.ts +14 -0
- package/lib/j-ngrx-filter.d.ts.map +1 -0
- package/lib/models.d.ts +494 -0
- package/lib/models.d.ts.map +1 -0
- package/lib/reducer.d.ts +11 -0
- package/lib/reducer.d.ts.map +1 -0
- package/lib/state_selectors.d.ts +5 -0
- package/lib/state_selectors.d.ts.map +1 -0
- package/lib/utils.d.ts +8 -0
- package/lib/utils.d.ts.map +1 -0
- package/ngrx-entity-crud.d.ts +5 -0
- package/ngrx-entity-crud.d.ts.map +1 -0
- package/ngrx-entity-crud.metadata.json +1 -0
- package/package.json +41 -0
- package/public-api.d.ts +7 -0
- package/public-api.d.ts.map +1 -0
- package/schematics/auth/files/model/auth.ts +17 -0
- package/schematics/auth/files/store/auth-store/actions.ts +30 -0
- package/schematics/auth/files/store/auth-store/auth-mock.service.ts +95 -0
- package/schematics/auth/files/store/auth-store/auth-store.module.ts +34 -0
- package/schematics/auth/files/store/auth-store/auth.guard.ts +44 -0
- package/schematics/auth/files/store/auth-store/auth.service.ts +28 -0
- package/schematics/auth/files/store/auth-store/conf.ts +2 -0
- package/schematics/auth/files/store/auth-store/effects.ts +53 -0
- package/schematics/auth/files/store/auth-store/index.d.ts +13 -0
- package/schematics/auth/files/store/auth-store/index.ts +13 -0
- package/schematics/auth/files/store/auth-store/names.ts +3 -0
- package/schematics/auth/files/store/auth-store/reducer.ts +16 -0
- package/schematics/auth/files/store/auth-store/selectors.ts +51 -0
- package/schematics/auth/files/store/auth-store/state.ts +16 -0
- package/schematics/auth/files/views/login/components/logout-button/logout-button.component.ts +49 -0
- package/schematics/auth/files/views/login/login-main/login-main.component.html +25 -0
- package/schematics/auth/files/views/login/login-main/login-main.component.ts +57 -0
- package/schematics/auth/files/views/login/login-routing.module.ts +30 -0
- package/schematics/auth/files/views/login/login.module.ts +30 -0
- package/schematics/auth/index.d.ts +2 -0
- package/schematics/auth/index.js +77 -0
- package/schematics/auth/index.js.map +1 -0
- package/schematics/auth/schema.json +21 -0
- package/schematics/auth0/files/store/auth-store/actions.ts +21 -0
- package/schematics/auth0/files/store/auth-store/auth-store.module.ts +32 -0
- package/schematics/auth0/files/store/auth-store/auth.guard.ts +44 -0
- package/schematics/auth0/files/store/auth-store/authentication.service.ts +32 -0
- package/schematics/auth0/files/store/auth-store/conf.ts +2 -0
- package/schematics/auth0/files/store/auth-store/effects.ts +59 -0
- package/schematics/auth0/files/store/auth-store/index.d.ts +13 -0
- package/schematics/auth0/files/store/auth-store/index.ts +13 -0
- package/schematics/auth0/files/store/auth-store/login.component.ts +75 -0
- package/schematics/auth0/files/store/auth-store/names.ts +3 -0
- package/schematics/auth0/files/store/auth-store/profile.ts +12 -0
- package/schematics/auth0/files/store/auth-store/reducer.ts +23 -0
- package/schematics/auth0/files/store/auth-store/selectors.ts +24 -0
- package/schematics/auth0/files/store/auth-store/state.ts +11 -0
- package/schematics/auth0/index.d.ts +2 -0
- package/schematics/auth0/index.js +67 -0
- package/schematics/auth0/index.js.map +1 -0
- package/schematics/auth0/schema.json +21 -0
- package/schematics/collection.json +30 -0
- package/schematics/my-utility.d.ts +58 -0
- package/schematics/my-utility.js +257 -0
- package/schematics/my-utility.js.map +1 -0
- package/schematics/ng-add/files/root-store/index.d.ts +8 -0
- package/schematics/ng-add/files/root-store/index.ts +8 -0
- package/schematics/ng-add/files/root-store/root-reducer.ts +11 -0
- package/schematics/ng-add/files/root-store/root-store.module.ts +29 -0
- package/schematics/ng-add/files/root-store/router-store/actions.ts +27 -0
- package/schematics/ng-add/files/root-store/router-store/effects.ts +65 -0
- package/schematics/ng-add/files/root-store/router-store/index.d.ts +11 -0
- package/schematics/ng-add/files/root-store/router-store/index.ts +11 -0
- package/schematics/ng-add/files/root-store/router-store/pop-up-base.component.ts +83 -0
- package/schematics/ng-add/files/root-store/router-store/pop-up-base.module.ts +24 -0
- package/schematics/ng-add/files/root-store/router-store/reducer.ts +31 -0
- package/schematics/ng-add/files/root-store/router-store/router-store.module.ts +30 -0
- package/schematics/ng-add/files/root-store/router-store/selectors.ts +63 -0
- package/schematics/ng-add/files/root-store/router-store/state.ts +18 -0
- package/schematics/ng-add/files/root-store/selectors.ts +20 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/actions.ts +11 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/effects.ts +10 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/index.d.ts +13 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/index.ts +13 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/names.ts +3 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/operators.ts +24 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/reducer.ts +8 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/selectors.ts +41 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/slide-menu-store.module.ts +27 -0
- package/schematics/ng-add/files/root-store/slide-menu-store/state.ts +14 -0
- package/schematics/ng-add/files/root-store/state.ts +5 -0
- package/schematics/ng-add/index.d.ts +2 -0
- package/schematics/ng-add/index.js +78 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.json +22 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +52 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +57 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +7 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +50 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +15 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +23 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +36 -0
- package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__.module.ts +33 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +16 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +27 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +1 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +18 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +36 -0
- package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__.module.ts +26 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.html +38 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-edit/__clazz@dasherize__-edit.component.ts +50 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.html +30 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-list/__clazz@dasherize__-list.component.ts +101 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.html +12 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-main/__clazz@dasherize__-main.component.ts +21 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts +37 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__.module.ts +49 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-create-many-test-__clazz@dasherize__.component.ts +46 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-delete-__clazz@dasherize__.component.ts +35 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-edit-many-test-__clazz@dasherize__.component.ts +45 -0
- package/schematics/section/files/primeng/__clazz@dasherize__/components/button-new-__clazz@dasherize__.component.ts +45 -0
- package/schematics/section/index.d.ts +2 -0
- package/schematics/section/index.js +56 -0
- package/schematics/section/index.js.map +1 -0
- package/schematics/section/schema.json +39 -0
- package/schematics/store/files/base-model/__clazz@dasherize__.ts +8 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__-store.module.ts +26 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.actions.ts +9 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.effects.ts +11 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.names.ts +3 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.reducer.ts +8 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.selectors.ts +18 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/__clazz@dasherize__.state.ts +6 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/index.d.ts +13 -0
- package/schematics/store/files/base-store/__clazz@dasherize__-store/index.ts +13 -0
- package/schematics/store/files/crud-graphql/__clazz@dasherize__-store/__clazz@dasherize__.criteria.ts +39 -0
- package/schematics/store/files/crud-graphql/__clazz@dasherize__-store/__clazz@dasherize__.graphql +34 -0
- package/schematics/store/files/crud-model/__clazz@dasherize__.ts +8 -0
- package/schematics/store/files/crud-service/__clazz@dasherize__.service.ts +11 -0
- package/schematics/store/files/crud-service-graphql/__clazz@dasherize__.service.ts +16 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__-store.module.ts +26 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.actions.ts +55 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.effects.ts +90 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.names.ts +3 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.reducer.ts +103 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.selectors.ts +26 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/__clazz@dasherize__.state.ts +11 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/index.d.ts +15 -0
- package/schematics/store/files/crud-store/__clazz@dasherize__-store/index.ts +15 -0
- package/schematics/store/index.d.ts +2 -0
- package/schematics/store/index.js +100 -0
- package/schematics/store/index.js.map +1 -0
- package/schematics/store/schema.json +45 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {InjectionToken, NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {EffectsModule} from '@ngrx/effects';
|
|
4
|
+
import {RouterEffects} from './effects';
|
|
5
|
+
import {State} from './state';
|
|
6
|
+
import {ActionReducer, StoreModule} from '@ngrx/store';
|
|
7
|
+
import {routerReducer, StoreRouterConnectingModule} from '@ngrx/router-store';
|
|
8
|
+
import {featureReducer} from './reducer';
|
|
9
|
+
|
|
10
|
+
export const INJECTION_TOKEN = new InjectionToken<ActionReducer<State>>(`router-store Reducers`);
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule,
|
|
15
|
+
StoreModule.forFeature('router', INJECTION_TOKEN),
|
|
16
|
+
EffectsModule.forFeature([RouterEffects]),
|
|
17
|
+
StoreRouterConnectingModule.forRoot({stateKey: 'router'})
|
|
18
|
+
],
|
|
19
|
+
declarations: [],
|
|
20
|
+
providers: [
|
|
21
|
+
RouterEffects,
|
|
22
|
+
{
|
|
23
|
+
provide: INJECTION_TOKEN,
|
|
24
|
+
useFactory: (): ActionReducer<State> => featureReducer
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
})
|
|
29
|
+
export class RouterStoreModule {
|
|
30
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/store';
|
|
2
|
+
import * as fromRouter from '@ngrx/router-store';
|
|
3
|
+
import {Data, NavigationExtras, Params} from '@angular/router';
|
|
4
|
+
import {State} from './state';
|
|
5
|
+
import {evalData} from '@core/utils/j-utils';
|
|
6
|
+
|
|
7
|
+
export const selectRouterState: MemoizedSelector<object, State> = createFeatureSelector<State>('router');
|
|
8
|
+
const getOptions = (state: State): any => state.state.root.firstChild.params.options;
|
|
9
|
+
const getHasPopUp = (state: State): any => evalData<string>(() => state.state.url, '').indexOf('//popUp') !== -1;
|
|
10
|
+
const getPrimary = (state: State): any => evalData(() => state.primary, null);
|
|
11
|
+
const getPopUp = (state: State): any => evalData(() => state.popUp, null);
|
|
12
|
+
|
|
13
|
+
export const selectOptions: MemoizedSelector<object, any> = createSelector(
|
|
14
|
+
selectRouterState,
|
|
15
|
+
getOptions
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const selectPrimary: MemoizedSelector<object, any> = createSelector(
|
|
19
|
+
selectRouterState,
|
|
20
|
+
getPrimary
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const selectPopUp: MemoizedSelector<object, any> = createSelector(
|
|
24
|
+
selectRouterState,
|
|
25
|
+
getPopUp
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const hasPopUp: MemoizedSelector<object, NavigationExtras> = createSelector(
|
|
29
|
+
selectRouterState,
|
|
30
|
+
getHasPopUp
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const {
|
|
34
|
+
selectQueryParams, // select the current route query params
|
|
35
|
+
selectQueryParam, // factory function to select a query param
|
|
36
|
+
selectRouteParams, // select the current route params
|
|
37
|
+
selectRouteParam, // factory function to select a route param
|
|
38
|
+
selectRouteData, // select the current route data
|
|
39
|
+
selectUrl, // select the current url
|
|
40
|
+
} = fromRouter.getSelectors(selectRouterState);
|
|
41
|
+
|
|
42
|
+
export const all: MemoizedSelector<object, RuoteData> = createSelector(
|
|
43
|
+
selectQueryParams,
|
|
44
|
+
selectRouteParams,
|
|
45
|
+
selectRouteData,
|
|
46
|
+
selectUrl,
|
|
47
|
+
(selectQueryParamsA, selectRouteParamsA, selectRouteDataA, selectUrlA) => {
|
|
48
|
+
return {
|
|
49
|
+
selectQueryParams: selectQueryParamsA,
|
|
50
|
+
selectRouteParams: selectRouteParamsA,
|
|
51
|
+
selectRouteData: selectRouteDataA,
|
|
52
|
+
selectUrl: selectUrlA
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export interface RuoteData {
|
|
58
|
+
selectQueryParams: Params;
|
|
59
|
+
selectRouteParams: Params;
|
|
60
|
+
selectRouteData: Data;
|
|
61
|
+
selectUrl: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {RouterReducerState, SerializedRouterStateSnapshot} from '@ngrx/router-store';
|
|
2
|
+
import {NavigationExtras} from '@angular/router';
|
|
3
|
+
import {PopUpData} from '@root-store/router-store/pop-up-base.component';
|
|
4
|
+
|
|
5
|
+
export interface State extends RouterReducerState<SerializedRouterStateSnapshot> {
|
|
6
|
+
extras: NavigationExtras;
|
|
7
|
+
primary: any;
|
|
8
|
+
popUp: PopUpData<any>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const initialState: State = {
|
|
12
|
+
state: null,
|
|
13
|
+
navigationId: null,
|
|
14
|
+
extras: null,
|
|
15
|
+
primary: null,
|
|
16
|
+
popUp: null,
|
|
17
|
+
};
|
|
18
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {createSelectorFactory, defaultMemoize} from '@ngrx/store';
|
|
2
|
+
|
|
3
|
+
const customMemoizer = (aFn) => defaultMemoize(aFn, (a: any, b: any) => a === b);
|
|
4
|
+
|
|
5
|
+
export const selectError =
|
|
6
|
+
createSelectorFactory(customMemoizer)(
|
|
7
|
+
(...args: string[]) => {
|
|
8
|
+
console.log('selectError.args', args);
|
|
9
|
+
return args.join('');
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const selectIsLoading =
|
|
14
|
+
createSelectorFactory(customMemoizer)(
|
|
15
|
+
(...args: boolean[]) => {
|
|
16
|
+
console.log('selectIsLoading.args', args);
|
|
17
|
+
return args.find((value => value));
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {SlideMenuItem} from '@models/vo/slide-menu-item';
|
|
2
|
+
import {createAction, props} from '@ngrx/store';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export enum ActionTypes {
|
|
6
|
+
SELECT = '[SlideMenu] Select',
|
|
7
|
+
OPEN = '[SlideMenu] Open',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Open = createAction(ActionTypes.OPEN, props<{ open: boolean }>());
|
|
11
|
+
export const Select = createAction(ActionTypes.SELECT, props<{ item: SlideMenuItem }>());
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as SlideMenuStoreActions from './actions';
|
|
2
|
+
import * as SlideMenuStoreSelectors from './selectors';
|
|
3
|
+
import * as SlideMenuStoreState from './state';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
SlideMenuStoreModule
|
|
7
|
+
} from './slide-menu-store.module';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
SlideMenuStoreActions,
|
|
11
|
+
SlideMenuStoreSelectors,
|
|
12
|
+
SlideMenuStoreState
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as SlideMenuStoreActions from './actions';
|
|
2
|
+
import * as SlideMenuStoreSelectors from './selectors';
|
|
3
|
+
import * as SlideMenuStoreState from './state';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
SlideMenuStoreModule
|
|
7
|
+
} from './slide-menu-store.module';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
SlideMenuStoreActions,
|
|
11
|
+
SlideMenuStoreSelectors,
|
|
12
|
+
SlideMenuStoreState
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {MenuItem} from 'primeng/api';
|
|
2
|
+
import {map} from 'rxjs/operators';
|
|
3
|
+
|
|
4
|
+
export const menuItemsDecoratorFn: (itemsA: MenuItem[], store$) => MenuItem[] = (itemsA: MenuItem[], store$) => {
|
|
5
|
+
return itemsA.map(value => {
|
|
6
|
+
const result: any = {...value};
|
|
7
|
+
if (!!result.command) {
|
|
8
|
+
result.store$ = store$;
|
|
9
|
+
}
|
|
10
|
+
if (!!result.items) {
|
|
11
|
+
result.items = menuItemsDecoratorFn(result.items, store$);
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const menuItemsDecorator = (store$: any) => {
|
|
19
|
+
return input$ => input$.pipe(
|
|
20
|
+
map((items: MenuItem[]) => {
|
|
21
|
+
return menuItemsDecoratorFn(items, store$);
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {initialState, State} from './state';
|
|
2
|
+
import * as actions from './actions';
|
|
3
|
+
import {createReducer, on} from '@ngrx/store';
|
|
4
|
+
|
|
5
|
+
export const featureReducer = createReducer<State>(initialState,
|
|
6
|
+
on(actions.Open, (state, {open}) => ({...state, ...{open}})),
|
|
7
|
+
on(actions.Select, (state, {item}) => ({...state, ...{item}})),
|
|
8
|
+
);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {createFeatureSelector, createSelector, MemoizedSelector} from '@ngrx/store';
|
|
2
|
+
|
|
3
|
+
import {State} from './state';
|
|
4
|
+
import {Names} from './names';
|
|
5
|
+
import {SlideMenuItem} from '@models/vo/slide-menu-item';
|
|
6
|
+
import {MenuItem} from 'primeng/api';
|
|
7
|
+
|
|
8
|
+
const getOpen = (state: State): boolean => state.open;
|
|
9
|
+
const getItem = (state: State): SlideMenuItem => state.item;
|
|
10
|
+
const getItems = (state: State): MenuItem[] => state.items;
|
|
11
|
+
const getBreadcrumb = (value: SlideMenuItem): string[] => value.breadcrumb;
|
|
12
|
+
|
|
13
|
+
export const selectState: MemoizedSelector<object, State> = createFeatureSelector<State>(Names.NAME);
|
|
14
|
+
|
|
15
|
+
export const selectItems: MemoizedSelector<object, MenuItem[]> = createSelector(
|
|
16
|
+
selectState,
|
|
17
|
+
getItems
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const selectItem: MemoizedSelector<object, SlideMenuItem> = createSelector(
|
|
21
|
+
selectState,
|
|
22
|
+
getItem
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const selectOpen: MemoizedSelector<object, boolean> = createSelector(
|
|
27
|
+
selectState,
|
|
28
|
+
getOpen
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const selectBreadcrumb: MemoizedSelector<object, string[]> = createSelector(
|
|
32
|
+
selectItem,
|
|
33
|
+
getBreadcrumb
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const selectBreadcrumbRenderized: MemoizedSelector<object, string> = createSelector(
|
|
37
|
+
selectBreadcrumb,
|
|
38
|
+
(values: string[]): string => {
|
|
39
|
+
return values.join(' > ');
|
|
40
|
+
}
|
|
41
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {InjectionToken, NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {ActionReducer, StoreModule} from '@ngrx/store';
|
|
4
|
+
import {Names} from './names';
|
|
5
|
+
import {State} from './state';
|
|
6
|
+
import {EffectsModule} from '@ngrx/effects';
|
|
7
|
+
import {SlideMenuStoreEffects} from './effects';
|
|
8
|
+
import {featureReducer} from './reducer';
|
|
9
|
+
|
|
10
|
+
export const CLIENT_TOKEN = new InjectionToken<ActionReducer<State>>(Names.NAME + ' Reducers');
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule,
|
|
15
|
+
StoreModule.forFeature(Names.NAME, CLIENT_TOKEN),
|
|
16
|
+
EffectsModule.forFeature([SlideMenuStoreEffects])
|
|
17
|
+
],
|
|
18
|
+
declarations: [],
|
|
19
|
+
providers: [SlideMenuStoreEffects,
|
|
20
|
+
{
|
|
21
|
+
provide: CLIENT_TOKEN,
|
|
22
|
+
useFactory: (): ActionReducer<State> => featureReducer
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class SlideMenuStoreModule {
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {SlideMenuItem} from '@models/vo/slide-menu-item';
|
|
2
|
+
import {MenuItem} from 'primeng/api';
|
|
3
|
+
|
|
4
|
+
export interface State {
|
|
5
|
+
open: boolean;
|
|
6
|
+
item: SlideMenuItem;
|
|
7
|
+
items: MenuItem[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const initialState: State = {
|
|
11
|
+
open: false,
|
|
12
|
+
item: {breadcrumb: [], data: null},
|
|
13
|
+
items: []
|
|
14
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const my_utility_1 = require("../my-utility");
|
|
6
|
+
// Just return the tree
|
|
7
|
+
function ngAdd(options) {
|
|
8
|
+
return (tree, context) => {
|
|
9
|
+
console.log('makeStore(options: CrudStore): Rule');
|
|
10
|
+
console.log('context', context);
|
|
11
|
+
const workspaceConfig = tree.read('/angular.json');
|
|
12
|
+
if (!workspaceConfig) {
|
|
13
|
+
throw new schematics_1.SchematicsException('Could not find Angular workspace configuration');
|
|
14
|
+
}
|
|
15
|
+
// convert workspace to string
|
|
16
|
+
const workspaceContent = workspaceConfig.toString();
|
|
17
|
+
// parse workspace string into JSON object
|
|
18
|
+
console.log('1');
|
|
19
|
+
const workspace = JSON.parse(workspaceContent);
|
|
20
|
+
if (!options.project) {
|
|
21
|
+
options.project = workspace.defaultProject;
|
|
22
|
+
}
|
|
23
|
+
console.log('2');
|
|
24
|
+
let pathApp = 'src/app';
|
|
25
|
+
let pathStore = 'src/app/root-store';
|
|
26
|
+
let pathView = 'src/app/main/views';
|
|
27
|
+
let pathService = 'src/app/main/services';
|
|
28
|
+
let pathVo = 'src/app/main/models/vo/';
|
|
29
|
+
const conf = tree.read('/ngrx-entity-crud.conf.json');
|
|
30
|
+
if (conf) {
|
|
31
|
+
console.log('3');
|
|
32
|
+
const confData = JSON.parse(conf.toString());
|
|
33
|
+
pathView = confData.pathView;
|
|
34
|
+
pathStore = confData.pathStore;
|
|
35
|
+
pathApp = confData.pathApp;
|
|
36
|
+
pathService = confData.pathService;
|
|
37
|
+
pathVo = confData.pathVo;
|
|
38
|
+
}
|
|
39
|
+
console.log('pathView', pathView);
|
|
40
|
+
console.log('pathStore', pathStore);
|
|
41
|
+
console.log('pathApp', pathApp);
|
|
42
|
+
console.log('pathService', pathService);
|
|
43
|
+
console.log('pathVo', pathVo);
|
|
44
|
+
/* const genericRules: Rule[] = [
|
|
45
|
+
addExport(options, normalize(`${pathStore}/index.ts`)),
|
|
46
|
+
addExport(options, normalize(`${pathStore}/index.d.ts`)),
|
|
47
|
+
];*/
|
|
48
|
+
/* const crudRules: Rule[] = [
|
|
49
|
+
addImport(normalize(`${pathStore}/state.ts`), `import {${options.clazz}StoreState} from '@root-store/${strings.dasherize(options.clazz)}-store';`),
|
|
50
|
+
updateState(`${strings.underscore(options.name)}:${options.clazz}StoreState.State;`, normalize(`${pathStore}/state.ts`)),
|
|
51
|
+
addImport(normalize(`${pathStore}/selectors.ts`), `import {${options.clazz}StoreSelectors} from '@root-store/${strings.dasherize(options.clazz)}-store';`),
|
|
52
|
+
addRootSelector(options, normalize(`${pathStore}/selectors.ts`)),
|
|
53
|
+
render(options, './files/crud-store', pathStore),
|
|
54
|
+
render(options, './files/crud-service', pathService),
|
|
55
|
+
render(options, './files/crud-model', pathVo),
|
|
56
|
+
addDeclarationToNgModule({
|
|
57
|
+
module: `${pathStore}/root-store.module.ts`,
|
|
58
|
+
name: `${options.clazz}Store`,
|
|
59
|
+
path: `@root-store/${strings.dasherize(options.clazz)}-store`
|
|
60
|
+
})
|
|
61
|
+
];*/
|
|
62
|
+
// updateTsConfigSelector()
|
|
63
|
+
const baseRules = [
|
|
64
|
+
// addImport(normalize(`${pathStore}/state.ts`), `import {${options.clazz}} from '@models/vo/${strings.dasherize(options.clazz)}';`),
|
|
65
|
+
// updateState(`${strings.underscore(options.name)}:${options.clazz};`, normalize(`${pathStore}/state.ts`)),
|
|
66
|
+
my_utility_1.render(options, './files', pathStore),
|
|
67
|
+
my_utility_1.addDeclarationToNgModule({
|
|
68
|
+
module: `${pathApp}/app.module.ts`,
|
|
69
|
+
name: `RootStore`,
|
|
70
|
+
path: `./root-store/root-store`
|
|
71
|
+
}),
|
|
72
|
+
my_utility_1.updateTsConfigSelector()
|
|
73
|
+
];
|
|
74
|
+
return schematics_1.chain(baseRules);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.ngAdd = ngAdd;
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngrx-entity-crud/schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoG;AACpG,8CAAuF;AAEvF,uBAAuB;AACvB,SAAgB,KAAK,CAAC,OAAY;IAChC,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,CAAC,CAAC;SACjF;QAED,8BAA8B;QAC9B,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;QAEpD,0CAA0C;QAC1C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC;SAC5C;QACL,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,OAAO,GAAW,SAAS,CAAC;QAChC,IAAI,SAAS,GAAW,oBAAoB,CAAC;QAC7C,IAAI,QAAQ,GAAW,oBAAoB,CAAC;QAC5C,IAAI,WAAW,GAAW,uBAAuB,CAAC;QAClD,IAAI,MAAM,GAAW,yBAAyB,CAAC;QAE/C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QACtD,IAAI,IAAI,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC7C,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAC7B,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;YAC/B,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;YAC3B,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;YACnC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;SAC1B;QAED,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE9B;;;gBAGQ;QACR;;;;;;;;;;;;;gBAaQ;QAER,2BAA2B;QAC3B,MAAM,SAAS,GAAW;YACxB,qIAAqI;YACrI,4GAA4G;YAC5G,mBAAM,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;YACrC,qCAAwB,CAAC;gBACvB,MAAM,EAAE,GAAG,OAAO,gBAAgB;gBAClC,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,yBAAyB;aAChC,CAAC;YACF,mCAAsB,EAAE;SACzB,CAAC;QAEF,OAAO,kBAAK,CAAC,SAAS,CAAC,CAAC;IAE1B,CAAC,CAAC;AACJ,CAAC;AA7ED,sBA6EC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"id": "ng add",
|
|
4
|
+
"title": "ng add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"path": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"format": "path",
|
|
10
|
+
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
11
|
+
"visible": false
|
|
12
|
+
},
|
|
13
|
+
"project": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The name of the project.",
|
|
16
|
+
"$default": {
|
|
17
|
+
"$source": "projectName"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": []
|
|
22
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<ion-header>
|
|
2
|
+
<ion-toolbar>
|
|
3
|
+
<ion-buttons slot="start">
|
|
4
|
+
<ion-back-button></ion-back-button>
|
|
5
|
+
</ion-buttons>
|
|
6
|
+
<ion-title>
|
|
7
|
+
Edit
|
|
8
|
+
</ion-title>
|
|
9
|
+
</ion-toolbar>
|
|
10
|
+
</ion-header>
|
|
11
|
+
<ion-content fullscreen>
|
|
12
|
+
<ion-card>
|
|
13
|
+
<ion-title>
|
|
14
|
+
Form
|
|
15
|
+
</ion-title>
|
|
16
|
+
<ion-card-content>
|
|
17
|
+
<form [formGroup]="form">
|
|
18
|
+
<ion-item *ngFor="let key of keys">
|
|
19
|
+
<ion-label position="floating">{{key}}</ion-label>
|
|
20
|
+
<ion-input [formControlName]="key"></ion-input>
|
|
21
|
+
</ion-item>
|
|
22
|
+
</form>
|
|
23
|
+
</ion-card-content>
|
|
24
|
+
</ion-card>
|
|
25
|
+
<ion-card>
|
|
26
|
+
<ion-title>
|
|
27
|
+
Form data
|
|
28
|
+
</ion-title>
|
|
29
|
+
<ion-card-content>
|
|
30
|
+
<pre>
|
|
31
|
+
{{form | jsonForm | json}}
|
|
32
|
+
</pre>
|
|
33
|
+
</ion-card-content>
|
|
34
|
+
</ion-card>
|
|
35
|
+
</ion-content>
|
|
36
|
+
<ion-footer>
|
|
37
|
+
<ion-toolbar>
|
|
38
|
+
<ion-button color="success" (click)="onSave(form.getRawValue())">
|
|
39
|
+
<ion-icon name="save"></ion-icon>
|
|
40
|
+
Save
|
|
41
|
+
</ion-button>
|
|
42
|
+
<ion-button color="success" (click)="onCopy(form.getRawValue())">
|
|
43
|
+
<ion-icon name="copy"></ion-icon>
|
|
44
|
+
Clone
|
|
45
|
+
</ion-button>
|
|
46
|
+
<ion-button color="success" (click)="onDelete(form.getRawValue())">
|
|
47
|
+
<ion-icon name="delete"></ion-icon>
|
|
48
|
+
Delete
|
|
49
|
+
</ion-button>
|
|
50
|
+
<ion-button color="danger" (click)="cancel()">Cancel</ion-button>
|
|
51
|
+
</ion-toolbar>
|
|
52
|
+
</ion-footer>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
3
|
+
import {<%= clazz %>StoreActions} from '@root-store/<%= dasherize(clazz) %>-store';
|
|
4
|
+
|
|
5
|
+
import {FormGroup} from '@angular/forms';
|
|
6
|
+
import {EditBaseComponent} from '@components/edit-base/edit-base.component';
|
|
7
|
+
import * as RouterStoreActions from '@root-store/router-store/actions';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-<%= dasherize(clazz) %>-edit',
|
|
11
|
+
templateUrl: './<%= dasherize(clazz) %>-edit.component.html',
|
|
12
|
+
styles: [``]
|
|
13
|
+
})
|
|
14
|
+
export class <%= clazz %>EditComponent extends EditBaseComponent<<%= clazz %>> {
|
|
15
|
+
|
|
16
|
+
form: FormGroup;
|
|
17
|
+
keys: string[];
|
|
18
|
+
|
|
19
|
+
setItemPerform(value: <%= clazz %>): void {
|
|
20
|
+
const group = this.fb.group({});
|
|
21
|
+
this.keys = Object.keys(value);
|
|
22
|
+
this.keys.forEach(key => group.addControl(key, this.fb.control({value: value[key], disabled: key === 'id'})));
|
|
23
|
+
this.form = group;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
onSavePerform(item: <%= clazz %>): void {
|
|
27
|
+
this.store$.dispatch(<%= clazz %>StoreActions.EditRequest({
|
|
28
|
+
item, onResult: [
|
|
29
|
+
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
30
|
+
RouterStoreActions.RouterBack()
|
|
31
|
+
]
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onCopyPerform(item: <%= clazz %>): void {
|
|
36
|
+
this.store$.dispatch(<%= clazz %>StoreActions.CreateRequest({
|
|
37
|
+
item, onResult: [
|
|
38
|
+
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
39
|
+
RouterStoreActions.RouterBack()
|
|
40
|
+
]
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onDeletePerform(item) {
|
|
45
|
+
this.store$.dispatch(<%= clazz %>StoreActions.DeleteRequest({
|
|
46
|
+
item, onResult: [
|
|
47
|
+
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
48
|
+
RouterStoreActions.RouterBack()
|
|
49
|
+
]
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
cancel(): void {
|
|
54
|
+
this.store$.dispatch(RouterStoreActions.RouterBack());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
|
|
2
|
+
import {Store} from '@ngrx/store';
|
|
3
|
+
import {<%= clazz %>StoreActions, <%= clazz %>StoreSelectors, RootStoreState} from '@root-store/index';
|
|
4
|
+
import {Observable} from 'rxjs';
|
|
5
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
6
|
+
import {RouterStoreActions} from '@root-store/router-store/index';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'app-<%= dasherize(clazz) %>-list',
|
|
10
|
+
templateUrl: `<%= dasherize(clazz) %>-list.component.html`,
|
|
11
|
+
styles: [``],
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
13
|
+
})
|
|
14
|
+
export class <%= clazz %>ListComponent implements OnInit {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
collection$: Observable<<%= clazz %>[]>;
|
|
18
|
+
cols: any;
|
|
19
|
+
|
|
20
|
+
constructor(private store$: Store<RootStoreState.State>) {
|
|
21
|
+
console.log('<%= clazz %>ListComponent.constructor()');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
ngOnInit() {
|
|
26
|
+
console.log('<%= clazz %>ListComponent.ngOnInit()');
|
|
27
|
+
|
|
28
|
+
this.collection$ = this.store$.select(
|
|
29
|
+
<%= clazz %>StoreSelectors.selectAll
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onSelect(item) {
|
|
35
|
+
console.log('<%= clazz %>ListComponent.onEdit()');
|
|
36
|
+
|
|
37
|
+
const state = {
|
|
38
|
+
item,
|
|
39
|
+
props: {}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// apro la popUP
|
|
43
|
+
this.store$.dispatch(RouterStoreActions.RouterGo({
|
|
44
|
+
path: ['<%= dasherize(clazz) %>', 'edit'],
|
|
45
|
+
extras: {state}
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<ion-header>
|
|
2
|
+
<ion-toolbar>
|
|
3
|
+
<ion-buttons slot="start">
|
|
4
|
+
<ion-menu-button></ion-menu-button>
|
|
5
|
+
</ion-buttons>
|
|
6
|
+
<ion-title>
|
|
7
|
+
List
|
|
8
|
+
</ion-title>
|
|
9
|
+
</ion-toolbar>
|
|
10
|
+
</ion-header>
|
|
11
|
+
|
|
12
|
+
<ion-content fullscreen>
|
|
13
|
+
<app-search [actions]="actions"></app-search>
|
|
14
|
+
<app-<%= dasherize(clazz) %>-list></app-<%= dasherize(clazz) %>-list>
|
|
15
|
+
</ion-content>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {Component, OnInit} from '@angular/core';
|
|
2
|
+
import {Store} from '@ngrx/store';
|
|
3
|
+
import {<%= clazz %>StoreActions, RootStoreState} from '@root-store/index';
|
|
4
|
+
import {Actions} from 'ngrx-entity-crud';
|
|
5
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-<%= dasherize(clazz) %>-main',
|
|
9
|
+
templateUrl: '<%= dasherize(clazz) %>-main.component.html',
|
|
10
|
+
styles: []
|
|
11
|
+
})
|
|
12
|
+
export class <%= clazz %>MainComponent implements OnInit {
|
|
13
|
+
|
|
14
|
+
constructor(private readonly store$: Store<RootStoreState.State>) {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
actions: Actions<<%= clazz %>> = <%= clazz %>StoreActions.actions;
|
|
18
|
+
|
|
19
|
+
ngOnInit() {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|