@igniteui/angular-templates 18.0.1400-alpha.2 → 18.0.1400-alpha.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.
@@ -34,6 +34,16 @@ export declare class AngularTypeScriptFileUpdate extends TypeScriptFileUpdate {
34
34
  * @param multiline Whether to format the new entry as multiline.
35
35
  */
36
36
  addNgModuleMeta(dep: TemplateDependency, variables?: KeyValuePair<string>, multiline?: boolean): void;
37
+ /**
38
+ * Includes `{ bindToComponentInputs: true }` for a `forRoot` call in an `NgModule`'s `imports` member.
39
+ *
40
+ * For standalone projects, includes an `withComponentInputBinding` call in a `providers` variable. Mainly present in an `app.config` file.
41
+ */
42
+ allowComponentInputBinding(): void;
43
+ /**
44
+ * Provides the `HttpClient` for standalone applications.
45
+ */
46
+ provideHttpClientForStandaloneAppConfig(): void;
37
47
  protected buildRouteStructure(route: AngularRouteLike, multiline: boolean): RouteEntry[];
38
48
  /**
39
49
  * Updates an Angular decorator's metadata.
@@ -31,7 +31,7 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
31
31
  }
32
32
  const structure = this.buildRouteStructure(route, multiline);
33
33
  const newRoute = this.astTransformer.createObjectLiteralExpression(structure, multiline);
34
- this.astTransformer.requestNewMembersInArrayLiteral((0, cli_core_1.RoutesVariableAsParentCondition)(this.astTransformer), [newRoute], prepend, anchorElement);
34
+ this.astTransformer.requestNewMembersInArrayLiteral((0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.ROUTES_VARIABLE_NAME), [newRoute], prepend, anchorElement);
35
35
  }
36
36
  addChildRoute(parentPath, route, asIdentifier = false, multiline = false) {
37
37
  super.addChildRoute(parentPath, route, asIdentifier, multiline);
@@ -124,6 +124,48 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
124
124
  this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.schemas, types_1.AngularDecoratorMetaTarget.Schemas, multiline);
125
125
  }
126
126
  }
127
+ /**
128
+ * Includes `{ bindToComponentInputs: true }` for a `forRoot` call in an `NgModule`'s `imports` member.
129
+ *
130
+ * For standalone projects, includes an `withComponentInputBinding` call in a `providers` variable. Mainly present in an `app.config` file.
131
+ */
132
+ allowComponentInputBinding() {
133
+ if (this.standalone) {
134
+ this.astTransformer.requestNewImportDeclaration({
135
+ identifiers: [{ name: cli_core_1.WITH_COMPONENT_INPUT_BINDING }],
136
+ moduleName: cli_core_1.NG_ROUTER_PACKAGE,
137
+ });
138
+ // create withComponentInputBinding()
139
+ const callExpr = ts.factory.createCallExpression(ts.factory.createIdentifier(cli_core_1.WITH_COMPONENT_INPUT_BINDING), undefined, // type args
140
+ [] // args
141
+ );
142
+ this.astTransformer.requestNewArgumentInMethodCallExpression((node) => ts.isIdentifier(node.expression) &&
143
+ node.expression.text === cli_core_1.PROVIDE_ROUTER &&
144
+ (0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.NG_DECORATOR_PROVIDERS)(node), callExpr);
145
+ }
146
+ else {
147
+ const objLiteral = this.astTransformer.createObjectLiteralExpression([{ bindToComponentInputs: cli_core_1.TRUE_CLAUSE }], false, // multiline
148
+ () => ts.factory.createTrue());
149
+ this.astTransformer.requestNewArgumentInMethodCallExpression((node) => ts.isPropertyAccessExpression(node.expression) &&
150
+ ts.isIdentifier(node.expression.name) &&
151
+ node.expression.name.text === cli_core_1.NG_FOR_ROOT_IDENTIFIER_NAME &&
152
+ this.checkNgDecorator(cli_core_1.NG_MODULE_DECORATOR_NAME, node), objLiteral);
153
+ }
154
+ }
155
+ /**
156
+ * Provides the `HttpClient` for standalone applications.
157
+ */
158
+ provideHttpClientForStandaloneAppConfig() {
159
+ this.astTransformer.requestNewImportDeclaration({
160
+ identifiers: [{ name: cli_core_1.NG_HTTP_CLIENT_PROVIDER }],
161
+ moduleName: cli_core_1.NG_COMMON_HTTP_PACKAGE,
162
+ });
163
+ // create provideHttpClient()
164
+ const callExpr = ts.factory.createCallExpression(ts.factory.createIdentifier(cli_core_1.NG_HTTP_CLIENT_PROVIDER), undefined, // type args
165
+ [] // args
166
+ );
167
+ this.astTransformer.requestNewMembersInArrayLiteral((0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.NG_DECORATOR_PROVIDERS), [callExpr]);
168
+ }
127
169
  //#endregion
128
170
  //#region Protected Overrides
129
171
  buildRouteStructure(route, multiline) {
@@ -65,11 +65,7 @@ class IgniteUIForAngularTemplate {
65
65
  data: { text: cli_core_1.Util.nameFromPath(name) },
66
66
  identifierName: className
67
67
  });
68
- const content = rountesConfig.finalize();
69
- if (content) {
70
- // add to a finalize override in the NG File Update instead?
71
- cli_core_1.TypeScriptUtils.saveFile(routesConfigPath, content);
72
- }
68
+ rountesConfig.finalize();
73
69
  }
74
70
  const componentFile = new TsUpdate(componentFilePath, true, { indentSize: 2, singleQuotes: true });
75
71
  for (const dep of this.dependencies) {
@@ -82,11 +78,7 @@ class IgniteUIForAngularTemplate {
82
78
  }
83
79
  componentFile.addStandaloneComponentMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
84
80
  }
85
- const content = componentFile.finalize();
86
- if (content) {
87
- // add to a finalize override in the NG File Update instead?
88
- cli_core_1.TypeScriptUtils.saveFile(componentFilePath, content);
89
- }
81
+ componentFile.finalize();
90
82
  return;
91
83
  }
92
84
  // ngModule based components
@@ -102,11 +94,7 @@ class IgniteUIForAngularTemplate {
102
94
  data: { text: cli_core_1.Util.nameFromPath(name) },
103
95
  identifierName: className
104
96
  });
105
- const content = routingModule.finalize();
106
- if (content) {
107
- // add to a finalize override in the NG File Update instead?
108
- cli_core_1.TypeScriptUtils.saveFile(routingModulePath, content);
109
- }
97
+ routingModule.finalize();
110
98
  }
111
99
  //3) add an import of the component class from its file location.
112
100
  //4) populate the declarations portion of the @NgModule with the component class name.
@@ -131,11 +119,7 @@ class IgniteUIForAngularTemplate {
131
119
  );
132
120
  }
133
121
  }
134
- const content = mainModule.finalize();
135
- if (content) {
136
- // add to a finalize override in the NG File Update instead?
137
- cli_core_1.TypeScriptUtils.saveFile(mainModulePath, content);
138
- }
122
+ mainModule.finalize();
139
123
  }
140
124
  getExtraConfiguration() {
141
125
  return [];
@@ -1,27 +1,19 @@
1
1
  import { ApplicationConfig, ErrorHandler, Provider, importProvidersFrom } from '@angular/core';
2
- import { provideRouter, withComponentInputBinding } from '@angular/router';
2
+ import { provideRouter } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
- import {
6
- IgxNavigationDrawerModule,
7
- IgxNavbarModule,
8
- IgxLayoutModule,
9
- IgxRippleModule,
10
- } from 'igniteui-angular';
11
5
 
12
6
  import { routes } from './app.routes';
13
7
  import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
14
8
  import { environment } from '../environments/environment';
15
9
 
16
10
  const providers: Provider[] = [
17
- [
18
- provideRouter(routes, withComponentInputBinding()),
19
- importProvidersFrom(BrowserModule),
20
- provideAnimations()
21
- // provide the HAMMER_GESTURE_CONFIG token
22
- // to override the default settings of the HammerModule
23
- // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
24
- ]
11
+ provideRouter(routes),
12
+ importProvidersFrom(BrowserModule, HammerModule),
13
+ provideAnimations()
14
+ // provide the HAMMER_GESTURE_CONFIG token
15
+ // to override the default settings of the HammerModule
16
+ // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
25
17
  ];
26
18
 
27
19
  if (environment.production) {
@@ -1,8 +1,8 @@
1
1
  import { ApplicationConfig } from '@angular/core';
2
- import { provideRouter, withComponentInputBinding } from '@angular/router';
2
+ import { provideRouter } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
6
  export const appConfig: ApplicationConfig = {
7
- providers: [provideRouter(routes, withComponentInputBinding())]
7
+ providers: [provideRouter(routes)]
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import { ApplicationConfig } from '@angular/core';
2
- import { provideRouter, withComponentInputBinding } from '@angular/router';
2
+ import { provideRouter } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
6
  export const appConfig: ApplicationConfig = {
7
- providers: [provideRouter(routes, withComponentInputBinding())]
7
+ providers: [provideRouter(routes)]
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import { ApplicationConfig, importProvidersFrom } from '@angular/core';
2
- import { provideRouter, withComponentInputBinding } from '@angular/router';
2
+ import { provideRouter } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
5
  import {
@@ -13,7 +13,7 @@ import { routes } from './app.routes';
13
13
 
14
14
  export const appConfig: ApplicationConfig = {
15
15
  providers: [
16
- provideRouter(routes, withComponentInputBinding()),
16
+ provideRouter(routes),
17
17
  importProvidersFrom(
18
18
  BrowserModule,
19
19
  HammerModule,
@@ -1,5 +1,5 @@
1
1
  import { ApplicationConfig, importProvidersFrom } from '@angular/core';
2
- import { provideRouter, withComponentInputBinding } from '@angular/router';
2
+ import { provideRouter } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
5
  import {
@@ -14,7 +14,7 @@ import { routes } from './app.routes';
14
14
 
15
15
  export const appConfig: ApplicationConfig = {
16
16
  providers: [
17
- provideRouter(routes, withComponentInputBinding()),
17
+ provideRouter(routes),
18
18
  importProvidersFrom(
19
19
  BrowserModule,
20
20
  HammerModule,
@@ -11,7 +11,7 @@ export const routes: Routes = [
11
11
  ];
12
12
 
13
13
  @NgModule({
14
- imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true }), ErrorRoutingModule],
14
+ imports: [RouterModule.forRoot(routes), ErrorRoutingModule],
15
15
  exports: [RouterModule, ErrorRoutingModule]
16
16
  })
17
17
  export class AppRoutingModule { }
@@ -14,7 +14,7 @@ export const routes: Routes = [
14
14
  ];
15
15
 
16
16
  @NgModule({
17
- imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true }), ErrorRoutingModule],
17
+ imports: [RouterModule.forRoot(routes), ErrorRoutingModule],
18
18
  exports: [RouterModule, ErrorRoutingModule]
19
19
  })
20
20
  export class AppRoutingModule { }
@@ -8,7 +8,7 @@ const routes: Routes = [
8
8
  ];
9
9
 
10
10
  @NgModule({
11
- imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true })],
11
+ imports: [RouterModule.forRoot(routes)],
12
12
  exports: [RouterModule]
13
13
  })
14
14
  export class AppRoutingModule { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniteui/angular-templates",
3
- "version": "18.0.1400-alpha.2",
3
+ "version": "18.0.1400-alpha.4",
4
4
  "description": "Templates for Ignite UI for Angular projects and components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "author": "Infragistics",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@igniteui/cli-core": "~14.0.0-alpha.2",
15
+ "@igniteui/cli-core": "~14.0.0-alpha.4",
16
16
  "typescript": "~5.4.3"
17
17
  }
18
18
  }