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
package/schematics/section/files/ionic/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {RouterModule, Routes} from '@angular/router';
|
|
3
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
4
|
+
import {<%= clazz %>EditComponent} from '@views/<%= dasherize(clazz) %>/<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
5
|
+
|
|
6
|
+
const routes: Routes = [
|
|
7
|
+
{
|
|
8
|
+
path: 'main',
|
|
9
|
+
component: <%= clazz %>MainComponent,
|
|
10
|
+
pathMatch: 'full'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: 'edit',
|
|
14
|
+
component: <%= clazz %>EditComponent,
|
|
15
|
+
pathMatch: 'full'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: '',
|
|
19
|
+
redirectTo: 'main',
|
|
20
|
+
pathMatch: 'full'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: '**',
|
|
24
|
+
redirectTo: 'main',
|
|
25
|
+
pathMatch: 'full'
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
@NgModule({
|
|
30
|
+
imports: [
|
|
31
|
+
RouterModule.forChild(routes)
|
|
32
|
+
],
|
|
33
|
+
exports: [RouterModule]
|
|
34
|
+
})
|
|
35
|
+
export class <%= clazz %>RoutingModule {
|
|
36
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
4
|
+
import {<%= clazz %>EditComponent} from './<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
5
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
6
|
+
import {<%= clazz %>ListComponent} from './<%= dasherize(clazz) %>-list/<%= dasherize(clazz) %>-list.component';
|
|
7
|
+
import {<%= clazz %>RoutingModule} from './<%= dasherize(clazz) %>-routing.module';
|
|
8
|
+
import {SearchModule} from '@components/search/search.module';
|
|
9
|
+
import {IonicModule} from '@ionic/angular';
|
|
10
|
+
import {EditBaseModule} from '@components/edit-base/edit-base.module';
|
|
11
|
+
import {PipesModule} from '@core/pipe/pipes.module';
|
|
12
|
+
|
|
13
|
+
@NgModule({
|
|
14
|
+
declarations: [
|
|
15
|
+
<%= clazz %>EditComponent,
|
|
16
|
+
<%= clazz %>MainComponent,
|
|
17
|
+
<%= clazz %>ListComponent,
|
|
18
|
+
],
|
|
19
|
+
imports: [
|
|
20
|
+
CommonModule,
|
|
21
|
+
FormsModule,
|
|
22
|
+
ReactiveFormsModule,
|
|
23
|
+
<%= clazz %>RoutingModule,
|
|
24
|
+
PipesModule,
|
|
25
|
+
SearchModule,
|
|
26
|
+
IonicModule,
|
|
27
|
+
EditBaseModule
|
|
28
|
+
],
|
|
29
|
+
providers: [],
|
|
30
|
+
entryComponents: []
|
|
31
|
+
})
|
|
32
|
+
export class <%= clazz %>Module {
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= dasherize(clazz) %>-edit.component.html
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {RootStoreState} from '@root-store/index';
|
|
3
|
+
import {Store} from '@ngrx/store';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-<%= dasherize(clazz) %>-edit',
|
|
7
|
+
templateUrl: './<%= dasherize(clazz) %>-edit.component.html',
|
|
8
|
+
styles: [``]
|
|
9
|
+
})
|
|
10
|
+
export class <%= clazz %>EditComponent {
|
|
11
|
+
|
|
12
|
+
constructor(private store$: Store<RootStoreState.State>) {
|
|
13
|
+
console.log('<%= clazz %>EditComponent.constructor()');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= dasherize(clazz) %>-list.component.html
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
19
|
+
constructor(private store$: Store<RootStoreState.State>) {
|
|
20
|
+
console.log('<%= clazz %>ListComponent.constructor()');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ngOnInit(): void {
|
|
24
|
+
console.log('<%= clazz %>ListComponent.ngOnInit()');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= dasherize(clazz) %>-main.component.html
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {Component, OnInit} from '@angular/core';
|
|
2
|
+
import {Store} from '@ngrx/store';
|
|
3
|
+
import {RootStoreState} from '@root-store/index';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-<%= dasherize(clazz) %>-main',
|
|
7
|
+
templateUrl: '<%= dasherize(clazz) %>-main.component.html',
|
|
8
|
+
styles: []
|
|
9
|
+
})
|
|
10
|
+
export class <%= clazz %>MainComponent implements OnInit {
|
|
11
|
+
|
|
12
|
+
constructor(private readonly store$: Store<RootStoreState.State>) {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
ngOnInit(): void {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
package/schematics/section/files/no-libs/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {RouterModule, Routes} from '@angular/router';
|
|
3
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
4
|
+
import {<%= clazz %>EditComponent} from './<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
5
|
+
|
|
6
|
+
const routes: Routes = [
|
|
7
|
+
{
|
|
8
|
+
path: 'main',
|
|
9
|
+
component: <%= clazz %>MainComponent,
|
|
10
|
+
pathMatch: 'full'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: 'edit',
|
|
14
|
+
component: <%= clazz %>EditComponent,
|
|
15
|
+
pathMatch: 'full'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: '',
|
|
19
|
+
redirectTo: 'main',
|
|
20
|
+
pathMatch: 'full'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: '**',
|
|
24
|
+
redirectTo: 'main',
|
|
25
|
+
pathMatch: 'full'
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
@NgModule({
|
|
30
|
+
imports: [
|
|
31
|
+
RouterModule.forChild(routes)
|
|
32
|
+
],
|
|
33
|
+
exports: [RouterModule]
|
|
34
|
+
})
|
|
35
|
+
export class <%= clazz %>RoutingModule {
|
|
36
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
|
|
4
|
+
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
5
|
+
import {<%= clazz %>EditComponent} from './<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
6
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
7
|
+
import {<%= clazz %>ListComponent} from './<%= dasherize(clazz) %>-list/<%= dasherize(clazz) %>-list.component';
|
|
8
|
+
import {<%= clazz %>RoutingModule} from './<%= dasherize(clazz) %>-routing.module';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
declarations: [
|
|
12
|
+
<%= clazz %>EditComponent,
|
|
13
|
+
<%= clazz %>MainComponent,
|
|
14
|
+
<%= clazz %>ListComponent,
|
|
15
|
+
],
|
|
16
|
+
imports: [
|
|
17
|
+
CommonModule,
|
|
18
|
+
FormsModule,
|
|
19
|
+
ReactiveFormsModule,
|
|
20
|
+
<%= clazz %>RoutingModule
|
|
21
|
+
],
|
|
22
|
+
providers: [],
|
|
23
|
+
entryComponents: []
|
|
24
|
+
})
|
|
25
|
+
export class <%= clazz %>Module {
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<p-dialog header="{{title}}"
|
|
2
|
+
[transitionOptions]="'150ms cubic-bezier(0, 0, 0.2, 1)'"
|
|
3
|
+
[visible]="true"
|
|
4
|
+
[modal]="true"
|
|
5
|
+
[responsive]="true"
|
|
6
|
+
[style]="{width: '70em', minWidth: '200px'}"
|
|
7
|
+
[minY]="70"
|
|
8
|
+
[maximizable]="false"
|
|
9
|
+
[closable]="false"
|
|
10
|
+
(onHide)="cancel()">
|
|
11
|
+
|
|
12
|
+
<div class="grid">
|
|
13
|
+
<div class="col">
|
|
14
|
+
<form
|
|
15
|
+
class="dynamic-form"
|
|
16
|
+
[formGroup]="form">
|
|
17
|
+
<div *ngFor="let key of keys" class="grid">
|
|
18
|
+
<div class="col">
|
|
19
|
+
<label for="{{key}}"><strong>{{key}}</strong></label><br>
|
|
20
|
+
<input id="{{key}}" name="{{key}}" type="text" class="form-control" pInputText [formControlName]="key"/>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</form>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="col">
|
|
26
|
+
<pre>
|
|
27
|
+
{{form | jsonForm | json}}
|
|
28
|
+
</pre>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<ng-template pTemplate="footer">
|
|
34
|
+
<button pButton class="p-button-success mr-1" label="save" (click)="submit(form.getRawValue())"></button>
|
|
35
|
+
<button pButton type="button" label="Cancel" (click)="cancel()"></button>
|
|
36
|
+
</ng-template>
|
|
37
|
+
|
|
38
|
+
</p-dialog>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {closePopUpAction, PopUpBaseComponent} from '@root-store/router-store/pop-up-base.component';
|
|
3
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
4
|
+
import {FormGroup} from '@angular/forms';
|
|
5
|
+
import {<%= clazz %>StoreActions} from '@root-store/<%= dasherize(clazz) %>-store';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'app-<%= dasherize(clazz) %>-edit',
|
|
10
|
+
templateUrl: './<%= dasherize(clazz) %>-edit.component.html',
|
|
11
|
+
styles: [``]
|
|
12
|
+
})
|
|
13
|
+
export class <%= clazz %>EditComponent extends PopUpBaseComponent<<%= clazz %>> {
|
|
14
|
+
|
|
15
|
+
form: FormGroup;
|
|
16
|
+
keys: string[];
|
|
17
|
+
|
|
18
|
+
setItemPerform(value: <%= clazz %>): void {
|
|
19
|
+
const group = this.fb.group({});
|
|
20
|
+
this.keys = Object.keys(value);
|
|
21
|
+
this.keys.forEach(key => group.addControl(key, this.fb.control({value: value[key], disabled: key === 'id'})));
|
|
22
|
+
this.form = group;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
acceptPerform(item: <%= clazz %>): void {
|
|
26
|
+
if (item.id) {
|
|
27
|
+
this.store$.dispatch(<%= clazz %>StoreActions.EditRequest({
|
|
28
|
+
item, onResult: [
|
|
29
|
+
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
30
|
+
// chiude la popUP.
|
|
31
|
+
// closePopUpAction: metodo per la creazione dell'azione di chiusura della popUP
|
|
32
|
+
closePopUpAction
|
|
33
|
+
]
|
|
34
|
+
}));
|
|
35
|
+
} else {
|
|
36
|
+
this.store$.dispatch(<%= clazz %>StoreActions.CreateRequest({
|
|
37
|
+
item, onResult: [
|
|
38
|
+
// azione che verrà invocata al result della chiamata all'interno dell'effect.
|
|
39
|
+
// chiude la popUP.
|
|
40
|
+
// closePopUpAction: metodo per la creazione dell'azione di chiusura della popUP
|
|
41
|
+
closePopUpAction
|
|
42
|
+
]
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// cancel(): void {
|
|
48
|
+
// this.store$.dispatch(closePopUpAction(this.route));
|
|
49
|
+
// }
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<p-table [value]="collection$ | async" [selection]="itemsSelected$ | async" (selectionChange)="onSelectionChange($event)">
|
|
2
|
+
<ng-template pTemplate="header">
|
|
3
|
+
<tr>
|
|
4
|
+
<th style="width: 3rem">
|
|
5
|
+
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
|
|
6
|
+
</th>
|
|
7
|
+
<th *ngFor="let col of cols">
|
|
8
|
+
{{col}}
|
|
9
|
+
</th>
|
|
10
|
+
<th style="width: 10em">actions</th>
|
|
11
|
+
</tr>
|
|
12
|
+
</ng-template>
|
|
13
|
+
<ng-template pTemplate="body" let-item>
|
|
14
|
+
<tr>
|
|
15
|
+
<td>
|
|
16
|
+
<p-tableCheckbox [value]="item"></p-tableCheckbox>
|
|
17
|
+
</td>
|
|
18
|
+
<td *ngFor="let col of cols">
|
|
19
|
+
{{item[col]}}
|
|
20
|
+
</td>
|
|
21
|
+
<td>
|
|
22
|
+
|
|
23
|
+
<button pButton pRipple type="button" icon="pi pi-copy" class="p-button-rounded p-button-outlined mr-1" (click)="onCopy(item)"></button>
|
|
24
|
+
<button pButton pRipple type="button" icon="pi pi-pencil" class="p-button-rounded p-button-success p-button-outlined mr-1" (click)="onEdit(item)"></button>
|
|
25
|
+
<button pButton pRipple type="button" icon="pi pi-times" class="p-button-rounded p-button-danger p-button-outlined" (click)="onDelete(item)"></button>
|
|
26
|
+
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
</ng-template>
|
|
30
|
+
</p-table>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
|
|
2
|
+
import {select, 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
|
+
import {tap} from 'rxjs/operators';
|
|
8
|
+
import {ConfirmationService} from 'primeng/api';
|
|
9
|
+
import {PopUpData} from '@root-store/router-store/pop-up-base.component';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'app-<%= dasherize(clazz) %>-list',
|
|
13
|
+
templateUrl: `<%= dasherize(clazz) %>-list.component.html`,
|
|
14
|
+
styles: [``],
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
16
|
+
})
|
|
17
|
+
export class <%= clazz %>ListComponent implements OnInit {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
collection$: Observable<<%= clazz %>[]>;
|
|
21
|
+
cols: any;
|
|
22
|
+
itemsSelected$: Observable<<%= clazz %>[]>;
|
|
23
|
+
|
|
24
|
+
constructor(private store$: Store<RootStoreState.State>,
|
|
25
|
+
private confirmationService: ConfirmationService) {
|
|
26
|
+
console.log('<%= clazz %>ListComponent.constructor()');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ngOnInit(): void {
|
|
30
|
+
console.log('<%= clazz %>ListComponent.ngOnInit()');
|
|
31
|
+
|
|
32
|
+
this.itemsSelected$ = this.store$.pipe(
|
|
33
|
+
select(<%= clazz %>StoreSelectors.selectItemsSelected)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
this.collection$ = this.store$.select(
|
|
37
|
+
<%= clazz %>StoreSelectors.selectAll
|
|
38
|
+
).pipe(
|
|
39
|
+
tap(values => {
|
|
40
|
+
if (values && values.length > 0) {
|
|
41
|
+
this.cols = Object.keys(values[0]);
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
this.store$.dispatch(
|
|
47
|
+
<%= clazz %>StoreActions.SearchRequest({queryParams: {}})
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onEdit(item): void {
|
|
53
|
+
console.log('<%= clazz %>ListComponent.onEdit()');
|
|
54
|
+
|
|
55
|
+
const data: PopUpData<<%= clazz %>> = {
|
|
56
|
+
item,
|
|
57
|
+
props: {title: 'Edit <%= clazz %>', route: '<%= dasherize(clazz) %>'}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// apro la popUP
|
|
61
|
+
this.store$.dispatch(RouterStoreActions.RouterGoPopUp({
|
|
62
|
+
path: ['<%= dasherize(clazz) %>', {outlets: {popUp: ['edit']}}],
|
|
63
|
+
data
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onCopy(value): void {
|
|
69
|
+
console.log('<%= clazz %>ListComponent.onCopy()');
|
|
70
|
+
|
|
71
|
+
const item = {...{}, ...value, ...{id: null}};
|
|
72
|
+
const data: PopUpData<<%= clazz %>> = {
|
|
73
|
+
item,
|
|
74
|
+
props: {title: 'Copy <%= clazz %>', route: '<%= dasherize(clazz) %>'}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.store$.dispatch(RouterStoreActions.RouterGoPopUp({
|
|
78
|
+
path: ['<%= dasherize(clazz) %>', {outlets: {popUp: ['edit']}}],
|
|
79
|
+
data
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onDelete(item): void {
|
|
85
|
+
|
|
86
|
+
this.confirmationService.confirm({
|
|
87
|
+
message: 'Are you sure that you want to perform this action?',
|
|
88
|
+
accept: () => {
|
|
89
|
+
this.store$.dispatch(<%= clazz %>StoreActions.DeleteRequest({item}));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onSelectionChange(items: <%= clazz %>[]): void {
|
|
96
|
+
console.log('<%= clazz %>ListComponent.onSelectionChange()');
|
|
97
|
+
console.log('items', items);
|
|
98
|
+
this.store$.dispatch(<%= clazz %>StoreActions.SelectItems({items}));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<p-toolbar styleClass="mb-4">
|
|
2
|
+
<ng-template pTemplate="left">
|
|
3
|
+
<app-search [actions]="actions"></app-search>
|
|
4
|
+
</ng-template>
|
|
5
|
+
<ng-template pTemplate="right">
|
|
6
|
+
<app-button-new-<%= dasherize(clazz) %> class="mr-2"></app-button-new-<%= dasherize(clazz) %>>
|
|
7
|
+
<app-button-delete-<%= dasherize(clazz) %> class="mr-2"></app-button-delete-<%= dasherize(clazz) %>>
|
|
8
|
+
<app-button-edit-many-test-<%= dasherize(clazz) %> class="mr-2"></app-button-edit-many-test-<%= dasherize(clazz) %>>
|
|
9
|
+
<app-button-create-many-test-<%= dasherize(clazz) %>></app-button-create-many-test-<%= dasherize(clazz) %>>
|
|
10
|
+
</ng-template>
|
|
11
|
+
</p-toolbar>
|
|
12
|
+
<app-<%= dasherize(clazz) %>-list></app-<%= dasherize(clazz) %>-list>
|
|
@@ -0,0 +1,21 @@
|
|
|
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(): void {
|
|
20
|
+
}
|
|
21
|
+
}
|
package/schematics/section/files/primeng/__clazz@dasherize__/__clazz@dasherize__-routing.module.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {RouterModule, Routes} from '@angular/router';
|
|
3
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
4
|
+
import {<%= clazz %>EditComponent} from '@views/<%= dasherize(clazz) %>/<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
5
|
+
|
|
6
|
+
const routes: Routes = [
|
|
7
|
+
{
|
|
8
|
+
path: 'main',
|
|
9
|
+
component: <%= clazz %>MainComponent,
|
|
10
|
+
pathMatch: 'full'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: 'edit',
|
|
14
|
+
component: <%= clazz %>EditComponent,
|
|
15
|
+
outlet: 'popUp',
|
|
16
|
+
pathMatch: 'full'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: '',
|
|
20
|
+
redirectTo: 'main',
|
|
21
|
+
pathMatch: 'full'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: '**',
|
|
25
|
+
redirectTo: 'main',
|
|
26
|
+
pathMatch: 'full'
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
@NgModule({
|
|
31
|
+
imports: [
|
|
32
|
+
RouterModule.forChild(routes)
|
|
33
|
+
],
|
|
34
|
+
exports: [RouterModule]
|
|
35
|
+
})
|
|
36
|
+
export class <%= clazz %>RoutingModule {
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
|
4
|
+
import {<%= clazz %>EditComponent} from './<%= dasherize(clazz) %>-edit/<%= dasherize(clazz) %>-edit.component';
|
|
5
|
+
import {<%= clazz %>MainComponent} from './<%= dasherize(clazz) %>-main/<%= dasherize(clazz) %>-main.component';
|
|
6
|
+
import {<%= clazz %>ListComponent} from './<%= dasherize(clazz) %>-list/<%= dasherize(clazz) %>-list.component';
|
|
7
|
+
import {<%= clazz %>RoutingModule} from './<%= dasherize(clazz) %>-routing.module';
|
|
8
|
+
import {ButtonNew<%= clazz %>Component} from './components/button-new-<%= dasherize(clazz) %>.component';
|
|
9
|
+
import {TableModule} from 'primeng/table';
|
|
10
|
+
import {DialogModule} from 'primeng/dialog';
|
|
11
|
+
import {ButtonModule} from 'primeng/button';
|
|
12
|
+
import {InputTextModule} from 'primeng/inputtext';
|
|
13
|
+
import {SearchModule} from '@components/search/search.module';
|
|
14
|
+
import {PipesModule} from '@core/pipe/pipes.module';
|
|
15
|
+
import {ButtonDelete<%= clazz %>Component} from './components/button-delete-<%= dasherize(clazz) %>.component';
|
|
16
|
+
import {ButtonEditManyTest<%= clazz %>Component} from './components/button-edit-many-test-<%= dasherize(clazz) %>.component';
|
|
17
|
+
import {ButtonCreateManyTest<%= clazz %>Component} from './components/button-create-many-test-<%= dasherize(clazz) %>.component';
|
|
18
|
+
import {NgLetModule} from '@core/directive/ng-let.directive';
|
|
19
|
+
import {ToolbarModule} from 'primeng/toolbar';
|
|
20
|
+
|
|
21
|
+
@NgModule({
|
|
22
|
+
declarations: [
|
|
23
|
+
<%= clazz %>EditComponent,
|
|
24
|
+
<%= clazz %>MainComponent,
|
|
25
|
+
<%= clazz %>ListComponent,
|
|
26
|
+
ButtonNew<%= clazz %>Component,
|
|
27
|
+
ButtonDelete<%= clazz %>Component,
|
|
28
|
+
ButtonEditManyTest<%= clazz %>Component,
|
|
29
|
+
ButtonCreateManyTest<%= clazz %>Component
|
|
30
|
+
],
|
|
31
|
+
imports: [
|
|
32
|
+
CommonModule,
|
|
33
|
+
FormsModule,
|
|
34
|
+
ReactiveFormsModule,
|
|
35
|
+
<%= clazz %>RoutingModule,
|
|
36
|
+
TableModule,
|
|
37
|
+
DialogModule,
|
|
38
|
+
ButtonModule,
|
|
39
|
+
InputTextModule,
|
|
40
|
+
PipesModule,
|
|
41
|
+
SearchModule,
|
|
42
|
+
NgLetModule,
|
|
43
|
+
ToolbarModule
|
|
44
|
+
],
|
|
45
|
+
providers: [],
|
|
46
|
+
entryComponents: []
|
|
47
|
+
})
|
|
48
|
+
export class <%= clazz %>Module {
|
|
49
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
|
|
2
|
+
import {select, Store} from '@ngrx/store';
|
|
3
|
+
import {Observable} from 'rxjs';
|
|
4
|
+
import {<%= clazz %>StoreActions, <%= clazz %>StoreSelectors, RootStoreState} from '@root-store/index';
|
|
5
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-button-create-many-test-<%= dasherize(clazz) %>',
|
|
9
|
+
template: `
|
|
10
|
+
<button type="button" *ngLet="(itemsSelected$|async) as itemsSelected" pButton icon="pi pi-plus"
|
|
11
|
+
label="Create many ({{itemsSelected.length}})" (click)="onCreateMany(itemsSelected)"
|
|
12
|
+
[disabled]="!(itemsSelected.length > 0)"
|
|
13
|
+
class="p-button-success"></button>
|
|
14
|
+
`,
|
|
15
|
+
styles: [],
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
17
|
+
})
|
|
18
|
+
export class ButtonCreateManyTest<%= clazz %>Component implements OnInit {
|
|
19
|
+
|
|
20
|
+
itemsSelected$: Observable<<%= clazz %>[]>;
|
|
21
|
+
|
|
22
|
+
constructor(private readonly store$: Store<RootStoreState.State>) {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {
|
|
26
|
+
this.itemsSelected$ = this.store$.pipe(
|
|
27
|
+
select(<%= clazz %>StoreSelectors.selectItemsSelected)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onCreateMany(values: <%= clazz %>[]): void {
|
|
32
|
+
const items = values.map(value => {
|
|
33
|
+
const keys = Object.keys(value);
|
|
34
|
+
const result = {...value};
|
|
35
|
+
keys.forEach(key => {
|
|
36
|
+
result.id = null;
|
|
37
|
+
if (key !== 'id' && typeof result[key] === 'string') {
|
|
38
|
+
result[key] = 'edited ' + new Date().getSeconds();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
42
|
+
});
|
|
43
|
+
this.store$.dispatch(<%= clazz %>StoreActions.CreateManyRequest({items}));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core';
|
|
2
|
+
import {select, Store} from '@ngrx/store';
|
|
3
|
+
import {Observable} from 'rxjs';
|
|
4
|
+
import {<%= clazz %>StoreActions, <%= clazz %>StoreSelectors, RootStoreState} from '@root-store/index';
|
|
5
|
+
import {<%= clazz %>} from '@models/vo/<%= dasherize(clazz) %>';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-button-delete-<%= dasherize(clazz) %>',
|
|
9
|
+
template: `
|
|
10
|
+
<button type="button" *ngLet="(itemsSelected$|async) as itemsSelected" pButton icon="pi pi-trash"
|
|
11
|
+
label="Delete ({{itemsSelected.length}})" (click)="onDelete(itemsSelected)"
|
|
12
|
+
[disabled]="!(itemsSelected.length > 0)"
|
|
13
|
+
class="p-button-danger"></button>
|
|
14
|
+
`,
|
|
15
|
+
styles: [],
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
17
|
+
})
|
|
18
|
+
export class ButtonDelete<%= clazz %>Component implements OnInit {
|
|
19
|
+
|
|
20
|
+
itemsSelected$: Observable<<%= clazz %>[]>;
|
|
21
|
+
|
|
22
|
+
constructor(private readonly store$: Store<RootStoreState.State>) {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {
|
|
26
|
+
this.itemsSelected$ = this.store$.pipe(
|
|
27
|
+
select(<%= clazz %>StoreSelectors.selectItemsSelected)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
onDelete(items: <%= clazz %>[]): void {
|
|
32
|
+
this.store$.dispatch(<%= clazz %>StoreActions.DeleteManyRequest({items}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|