imng-kendo-schematics 7.285.6 → 7.291.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imng-kendo-schematics",
3
- "version": "7.285.6",
3
+ "version": "7.291.4",
4
4
  "description": "Angular Schematics facilitating Angular, Kendo, NGRX and imng package integration",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",
@@ -0,0 +1,47 @@
1
+ import { on } from '@ngrx/store';
2
+ import * as <%= camelize(singularizedName) %>ActionTypes from './<%= dasherize(singularizedName) %>.actions';
3
+ import { State } from './<%= dasherize(parentName) %>.feature';
4
+ import { findAndModify } from 'imng-ngrx-utils';
5
+ import { getODataPagerSettings } from 'imng-kendo-grid-odata';
6
+
7
+ export const <%= camelize(singularizedName) %>Reducers = [
8
+ on(<%= camelize(singularizedName) %>ActionTypes.load<%= classify(pluralizedName) %>Request,
9
+ (state: State, { payload }): State =>
10
+ ({
11
+ ...state,
12
+ loading: true,
13
+ gridData: {
14
+ ...state.gridData,
15
+ data: findAndModify(
16
+ state.gridData.data,
17
+ payload.<%= camelize(parentName) %>Id,
18
+ (rec) => (rec.<%= camelize(singularizedName) %>ODataState = payload.odataState),
19
+ )
20
+ },
21
+ })),
22
+ on(<%= camelize(singularizedName) %>ActionTypes.reload<%= classify(pluralizedName) %>Request,
23
+ (state: state): State =>
24
+ ({
25
+ ...state,
26
+ loading: true
27
+ })),
28
+ on(<%= camelize(singularizedName) %>ActionTypes.load<%= classify(pluralizedName) %>Success,
29
+ <%= camelize(singularizedName) %>ActionTypes.reload<%= classify(pluralizedName) %>Success,
30
+ (state: State, { payload }): State =>
31
+ ({
32
+ ...state,
33
+ loading: false,
34
+ gridData: {
35
+ ...state.gridData,
36
+ data: findAndModify(
37
+ state.gridData.data,
38
+ payload.<%= camelize(parentName) %>Id,
39
+ (rec) => {
40
+ rec.<%= camelize(singularizedName) %>OData = payload.odataResult;
41
+ rec.<%= camelize(singularizedName) %>PagerSettings = getODataPagerSettings({
42
+ gridData: payload.odataResult,
43
+ gridODataState: rec.<%= camelize(singularizedName) %>ODataState,
44
+ });
45
+ }),
46
+ },
47
+ }))];
@@ -2,7 +2,7 @@ import { createSelector } from '@ngrx/store';
2
2
  import { PagerSettings } from '@progress/kendo-angular-grid';
3
3
  import { createEmptyODataResult } from 'imng-kendo-odata';
4
4
  import { getById } from 'imng-ngrx-utils';
5
- import { <%= camelize(pluralizedStoreName) %>Feature } from './<%= dasherize(singularizedStoreName) %>.reducer';
5
+ import { <%= camelize(pluralizedStoreName) %>Feature } from './<%= dasherize(singularizedStoreName) %>.feature';
6
6
  <% if (openApiJsonUrl || openApiJsonFileName) { %>
7
7
  const select<%= classify(pluralizedName) %> = (<%= camelize(parentName) %>Id: string) => createSelector(
8
8
  <%= camelize(pluralizedStoreName) %>Feature.selectGridData,
@@ -1,3 +1,4 @@
1
1
  export { <%= classify(singularizedName) %>ListComponent } from './list.component';
2
2
  export { <%= classify(singularizedName) %>ListFacade } from './list.facade';
3
3
  export { <%= classify(singularizedName) %>ApiService } from './api.service';
4
+ export { <%= camelize(singularizedName) %>GridState } from './list.grid-state';
@@ -1,7 +1,7 @@
1
1
  <kendo-grid [height]="375" kendoGridFocusable [imngODataGrid]="this">
2
2
  <ng-template kendoGridToolbarTemplate>
3
3
  <div class="w-100 d-flex justify-content-between">
4
- <h3><%= startCasedPluralName %></h3>
4
+ <h4><%= startCasedPluralName %></h4>
5
5
  <imng-kendo-odata-grid-header
6
6
  (reloadEntitiesClicked)="reloadEntities()"
7
7
  [hideClearFilters]="true"
@@ -2,17 +2,7 @@ import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
2
2
  import { KendoODataBasedComponent } from 'imng-kendo-grid-odata';
3
3
  import { ODataState } from 'imng-kendo-odata';
4
4
  import { <%= classify(singularizedName) %>ListFacade } from './list.facade';
5
-
6
- const initialGridState: ODataState = {
7
- take: 5,
8
- skip: 0,
9
- selectors: [<% swaggerProperties.forEach(function(swaggerProperty){ %>
10
- <%= classify(singularizedName) %>Properties.<%= swaggerProperty.snakeCaseName.toUpperCase() %>,<%})%>
11
- ],
12
- sort: [
13
- { field: <%= classify(singularizedName) %>Properties.<%= firstProperty?.snakeCaseName.toUpperCase() %>, dir: 'asc' },
14
- ],
15
- };
5
+ import { <%= camelize(singularizedName) %>GridState } from './list.grid-state';
16
6
 
17
7
  @Component({
18
8
  selector: '<%= appPrefix %>-<%= dasherize(singularizedName) %>-list',
@@ -22,11 +12,11 @@ const initialGridState: ODataState = {
22
12
  })
23
13
  export class <%= classify(singularizedName) %>ListComponent extends KendoODataBasedComponent<I<%= classify(singularizedName) %>, <%= classify(singularizedName) %>ListFacade> {
24
14
  public readonly props = <%= classify(singularizedName) %>Properties;<% swaggerObjectProperties.filter(t=> !t.enum).forEach(function(swaggerProperty){ %>
25
- public readonly <%= camelize(swaggerProperty.name) %>props = <%= classify(swaggerProperty.propertyTypeName) %>Properties;<% }) %>
15
+ public readonly <%= camelize(swaggerProperty.name) %>Props = <%= classify(swaggerProperty.propertyTypeName) %>Properties;<% }) %>
26
16
  public currentItem: I<%= classify(singularizedName) %> | undefined;
27
17
 
28
18
  constructor(facade: <%= classify(singularizedName) %>ListFacade) {
29
- super(facade, initialGridState);
19
+ super(facade, <%= camelize(singularizedName) %>GridState);
30
20
  }
31
21
 
32
22
  @Input()
@@ -11,9 +11,9 @@ import { Observable, of } from 'rxjs';
11
11
  import * as <%= camelize(parentName) %>ActionTypes from '../+state/<%= dasherize(parentName) %>.actions';
12
12
  import * as <%= camelize(singularizedName) %>ActionTypes from '../+state/<%= dasherize(singularizedName) %>.actions';
13
13
  import { <%= classify(singularizedName) %>Effects } from '../+state/<%= dasherize(singularizedName) %>.effects';
14
- import { <%= camelize(pluralizedStoreName) %>Feature } from '../+state/<%= dasherize(singularizedStoreName) %>.reducer';
14
+ import { <%= camelize(pluralizedStoreName) %>Feature } from '../+state/<%= dasherize(singularizedStoreName) %>.feature';
15
15
  import { <%= classify(singularizedName) %>ListFacade } from './list.facade';
16
- import { <%= classify(parentName) %>Effects } from '../+state/<%= dasherize(parentName) %>.effects';
16
+ import { <%= classify(parentName) %>ListEffects } from '../+state/<%= dasherize(parentName) %>-list.effects';
17
17
  import { environment } from '@env';
18
18
 
19
19
  describe('<%= classify(singularizedName) %>ListFacade', () => {
@@ -29,7 +29,7 @@ describe('<%= classify(singularizedName) %>ListFacade', () => {
29
29
  @NgModule({
30
30
  imports: [
31
31
  StoreModule.forFeature(<%= camelize(pluralizedStoreName) %>Feature),
32
- EffectsModule.forFeature([<%= classify(singularizedStoreName) %>Effects, <%= classify(singularizedName) %>Effects]),
32
+ EffectsModule.forFeature([<%= classify(singularizedStoreName) %>Effects, <%= classify(singularizedName) %>ListEffects]),
33
33
  ],
34
34
  providers: [
35
35
  <%= classify(singularizedName) %>ListFacade,
@@ -67,7 +67,7 @@ describe('<%= classify(singularizedName) %>ListFacade', () => {
67
67
 
68
68
  list = await readFirst(facade.gridData$);
69
69
  const loading = await readFirst(facade.loading$);
70
- expect(list.?data.length).toBe(1);
70
+ expect(list?.data.length).toBe(1);
71
71
  expect(loading).toBe(false);
72
72
 
73
73
  const gridPagerSettings$ = await readFirst(facade.gridPagerSettings$);
@@ -7,7 +7,7 @@ import { applyFilter, ODataResult, ODataState } from 'imng-kendo-odata';
7
7
  import { BehaviorSubject, Observable, switchMap } from 'rxjs';
8
8
 
9
9
  import * as <%= camelize(singularizedName) %>ActionTypes from '../+state/<%= dasherize(singularizedName) %>.actions';
10
- import { <%= camelize(pluralizedStoreName) %>Feature } from '../+state/<%= dasherize(singularizedStoreName) %>.reducer';
10
+ import { <%= camelize(pluralizedStoreName) %>Feature } from '../+state/<%= dasherize(singularizedStoreName) %>.feature';
11
11
  import { <%= camelize(singularizedName) %>Selectors } from '../+state/<%= dasherize(singularizedName) %>.selectors';
12
12
 
13
13
  @Injectable()
@@ -0,0 +1,19 @@
1
+ import { ODataState } from 'imng-kendo-odata';
2
+
3
+ export const <%= camelize(singularizedName) %>GridState: ODataState = {
4
+ take: 20,
5
+ skip: 0,
6
+ selectors: [<% swaggerProperties.filter(t => t.htmlInputType !== 'object' || t.enum).forEach(function (swaggerProperty) { %>
7
+ <%= classify(singularizedName) %>Properties.<%= swaggerProperty.snakeCaseName.toUpperCase() %>, <%}) %>
8
+ ],
9
+ sort: [
10
+ { field: <%= classify(singularizedName) %>Properties.<%= firstProperty?.snakeCaseName.toUpperCase() %>, dir: 'asc' },
11
+ ], <% if (hasObjects) { %>
12
+ expanders: [<% swaggerObjectProperties.filter(t => !t.enum).forEach(function (swaggerProperty) { %>
13
+ { table: <%= classify(singularizedName) %>Properties.<%= swaggerProperty.snakeCaseName.toUpperCase() %>,
14
+ selectors: [<% swaggerProperty.properties.forEach(function (subSwaggerProperty) { %>
15
+ <%= classify(swaggerProperty.propertyTypeName) %>Properties.<%= subSwaggerProperty.snakeCaseName.toUpperCase() %>, <%}) %>
16
+ ]
17
+ }, <% }) %>
18
+ ]<% } %>
19
+ };