@igniteui/angular-templates 18.0.1400-beta.1 → 18.1.1340

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.
Files changed (51) hide show
  1. package/IgniteUIForAngularTemplate.d.ts +2 -2
  2. package/IgniteUIForAngularTemplate.js +24 -40
  3. package/igx-ts/bullet-graph/default/index.js +1 -1
  4. package/igx-ts/category-chart/default/index.js +1 -1
  5. package/igx-ts/custom-templates/awesome-grid/index.js +1 -1
  6. package/igx-ts/custom-templates/crm-grid/index.js +1 -1
  7. package/igx-ts/custom-templates/fintech-grid/index.js +1 -1
  8. package/igx-ts/dock-manager/default/index.js +3 -0
  9. package/igx-ts/financial-chart/default/index.js +1 -1
  10. package/igx-ts/grid/grid-custom/index.js +2 -2
  11. package/igx-ts/hierarchical-grid/hierarchical-grid-custom/index.js +1 -1
  12. package/igx-ts/linear-gauge/default/index.js +1 -1
  13. package/igx-ts/map/default/index.js +1 -1
  14. package/igx-ts/projects/_base/files/package.json +1 -1
  15. package/igx-ts/projects/_base/files/src/app/app.config.ts +16 -8
  16. package/igx-ts/projects/_base_with_home/files/src/app/app.config.ts +5 -7
  17. package/igx-ts/projects/empty/files/src/app/app.config.ts +5 -7
  18. package/igx-ts/projects/side-nav/files/src/app/app.config.ts +19 -19
  19. package/igx-ts/projects/side-nav-auth/files/package.json +18 -18
  20. package/igx-ts/projects/side-nav-auth/files/src/app/app.config.ts +21 -21
  21. package/igx-ts/radial-gauge/default/index.js +1 -1
  22. package/igx-ts-legacy/bullet-graph/default/index.js +1 -1
  23. package/igx-ts-legacy/category-chart/default/index.js +1 -1
  24. package/igx-ts-legacy/custom-templates/awesome-grid/index.js +1 -1
  25. package/igx-ts-legacy/custom-templates/crm-grid/index.js +1 -1
  26. package/igx-ts-legacy/custom-templates/fintech-grid/index.js +1 -1
  27. package/igx-ts-legacy/dock-manager/default/index.js +3 -1
  28. package/igx-ts-legacy/financial-chart/default/index.js +1 -1
  29. package/igx-ts-legacy/linear-gauge/default/index.js +1 -1
  30. package/igx-ts-legacy/map/default/index.js +1 -1
  31. package/igx-ts-legacy/projects/_base/files/package.json +1 -1
  32. package/igx-ts-legacy/projects/_base/files/src/app/app-routing.module.ts +1 -1
  33. package/igx-ts-legacy/projects/_base_with_home/files/src/app/app-routing.module.ts +1 -1
  34. package/igx-ts-legacy/projects/empty/files/src/app/app-routing.module.ts +1 -1
  35. package/igx-ts-legacy/projects/side-nav-auth/files/package.json +18 -18
  36. package/igx-ts-legacy/radial-gauge/default/index.js +1 -1
  37. package/index.d.ts +2 -4
  38. package/index.js +0 -2
  39. package/package.json +2 -2
  40. package/AngularTypeScriptFileUpdate.d.ts +0 -83
  41. package/AngularTypeScriptFileUpdate.js +0 -271
  42. package/types/AngularRouteEntry.d.ts +0 -6
  43. package/types/AngularRouteEntry.js +0 -2
  44. package/types/AngularRouteLike.d.ts +0 -10
  45. package/types/AngularRouteLike.js +0 -2
  46. package/types/enumerations/AngularDecoratorMetaTarget.d.ts +0 -9
  47. package/types/enumerations/AngularDecoratorMetaTarget.js +0 -3
  48. package/types/enumerations/AngularRouteTarget.d.ts +0 -10
  49. package/types/enumerations/AngularRouteTarget.js +0 -14
  50. package/types/index.d.ts +0 -4
  51. package/types/index.js +0 -20
@@ -1,10 +1,9 @@
1
- import { AddTemplateArgs, ControlExtraConfiguration, Template, TemplateDependency } from "@igniteui/cli-core";
1
+ import { AddTemplateArgs, ControlExtraConfiguration, Template, TemplateDependency, TypeScriptFileUpdate } from "@igniteui/cli-core";
2
2
  export declare class IgniteUIForAngularTemplate implements Template {
3
3
  private rootPath;
4
4
  components: string[];
5
5
  controlGroup: string;
6
6
  listInComponentTemplates: boolean;
7
- addAsNgModelDeclaration: boolean;
8
7
  listInCustomTemplates: boolean;
9
8
  id: string;
10
9
  name: string;
@@ -33,6 +32,7 @@ export declare class IgniteUIForAngularTemplate implements Template {
33
32
  getExtraConfiguration(): ControlExtraConfiguration[];
34
33
  setExtraConfiguration(extraConfigKeys: {}): void;
35
34
  fileExists(filePath: string): boolean;
35
+ protected addClassDeclaration(mainModule: TypeScriptFileUpdate, projPath: string, name: string, modulePath: string): void;
36
36
  protected getBaseVariables(name: string): {
37
37
  [key: string]: string;
38
38
  };
@@ -10,7 +10,6 @@ class IgniteUIForAngularTemplate {
10
10
  constructor(rootPath) {
11
11
  this.rootPath = rootPath;
12
12
  this.listInComponentTemplates = true;
13
- this.addAsNgModelDeclaration = true;
14
13
  this.listInCustomTemplates = false;
15
14
  this.framework = "angular";
16
15
  this.projectType = "igx-ts";
@@ -47,36 +46,30 @@ class IgniteUIForAngularTemplate {
47
46
  // tslint:disable-next-line:variable-name
48
47
  const TsUpdate =
49
48
  // tslint:disable-next-line:no-submodule-imports
50
- require("@igniteui/angular-templates").AngularTypeScriptFileUpdate;
51
- const mainModulePath = path.join(projectPath, `src/app/${modulePath}`);
52
- const folderName = this.folderName(name);
53
- const fileName = this.fileName(name);
54
- const componentFilePath = path.join(projectPath, `src/app/${folderName}/${fileName}.component.ts`);
55
- const className = `${cli_core_1.Util.className(cli_core_1.Util.nameFromPath(name))}Component`;
49
+ require("@igniteui/cli-core/typescript").TypeScriptFileUpdate;
56
50
  // standalone components
51
+ const mainModulePath = path.join(projectPath, `src/app/${modulePath}`);
57
52
  if (!this.fileExists(mainModulePath)) {
58
53
  const appRoutesPath = "src/app/app.routes.ts";
54
+ const folderName = this.folderName(name);
55
+ const fileName = this.fileName(name);
59
56
  if (!(options && options.skipRoute) && this.fileExists(appRoutesPath)) {
60
- const routesConfigPath = path.join(projectPath, appRoutesPath);
61
- const rountesConfig = new TsUpdate(routesConfigPath, true, { indentSize: 2, singleQuotes: true });
62
- rountesConfig.addRoute({
63
- modulePath: cli_core_1.Util.relativePath(routesConfigPath, componentFilePath, true, true),
64
- path: this.fileName(name),
65
- data: { text: cli_core_1.Util.nameFromPath(name) },
66
- identifierName: className
67
- });
68
- rountesConfig.finalize();
57
+ const rountesConfig = new TsUpdate(path.join(projectPath, appRoutesPath));
58
+ rountesConfig.addRoute(path.join(projectPath, `src/app/${folderName}/${fileName}.component.ts`), this.fileName(name), //path
59
+ cli_core_1.Util.nameFromPath(name) //text
60
+ );
69
61
  }
70
- const componentFile = new TsUpdate(componentFilePath, true, { indentSize: 2, singleQuotes: true });
62
+ const componentFile = new TsUpdate(path.join(projectPath, `src/app/${folderName}/${fileName}.component.ts`));
71
63
  for (const dep of this.dependencies) {
72
64
  if (dep.from && dep.from.startsWith(".")) {
73
65
  // relative file dependency
74
66
  const copy = Object.assign({}, dep);
75
- copy.from = cli_core_1.Util.relativePath(componentFilePath, path.join(projectPath, copy.from), true, true);
76
- componentFile.addStandaloneComponentMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
67
+ copy.from = cli_core_1.Util.relativePath(path.join(projectPath, `src/app/${folderName}/${fileName}.component.ts`), path.join(projectPath, copy.from), true, true);
68
+ // can use addNgModuleMeta here instead?
69
+ componentFile.addStandaloneImport(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
77
70
  continue;
78
71
  }
79
- componentFile.addStandaloneComponentMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
72
+ componentFile.addStandaloneImport(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
80
73
  }
81
74
  componentFile.finalize();
82
75
  return;
@@ -86,37 +79,25 @@ class IgniteUIForAngularTemplate {
86
79
  //1) import the component class name,
87
80
  //2) and populate the Routes array with the path and component
88
81
  //for example: { path: 'combo', component: ComboComponent }
89
- const routingModulePath = path.join(projectPath, "src/app/app-routing.module.ts");
90
- const routingModule = new TsUpdate(routingModulePath, false, { indentSize: 2, singleQuotes: true });
91
- routingModule.addRoute({
92
- modulePath: cli_core_1.Util.relativePath(routingModulePath, componentFilePath, true, true),
93
- path: this.fileName(name),
94
- data: { text: cli_core_1.Util.nameFromPath(name) },
95
- identifierName: className
96
- });
97
- routingModule.finalize();
82
+ const routingModule = new TsUpdate(path.join(projectPath, "src/app/app-routing.module.ts"));
83
+ routingModule.addRoute(path.join(projectPath, `src/app/${this.folderName(name)}/${this.fileName(name)}.component.ts`), this.fileName(name), //path
84
+ cli_core_1.Util.nameFromPath(name) //text
85
+ );
98
86
  }
99
87
  //3) add an import of the component class from its file location.
100
88
  //4) populate the declarations portion of the @NgModule with the component class name.
101
- const mainModule = new TsUpdate(mainModulePath, false, { indentSize: 2, singleQuotes: true });
102
- mainModule.addNgModuleMeta({
103
- declare: this.addAsNgModelDeclaration ? [className] : [],
104
- from: cli_core_1.Util.relativePath(mainModulePath, componentFilePath, true, true),
105
- export: modulePath !== "app.module.ts" ? [className] : []
106
- }, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content), true // multiline
107
- );
89
+ const mainModule = new TsUpdate(mainModulePath);
90
+ this.addClassDeclaration(mainModule, projectPath, name, modulePath);
108
91
  // import IgxModules and other dependencies
109
92
  for (const dep of this.dependencies) {
110
93
  if (dep.from && dep.from.startsWith(".")) {
111
94
  // relative file dependency
112
95
  const copy = Object.assign({}, dep);
113
96
  copy.from = cli_core_1.Util.relativePath(mainModulePath, path.join(projectPath, copy.from), true, true);
114
- mainModule.addNgModuleMeta(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content), true // multiline
115
- );
97
+ mainModule.addNgModuleMeta(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
116
98
  }
117
99
  else {
118
- mainModule.addNgModuleMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content), true // multiline
119
- );
100
+ mainModule.addNgModuleMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
120
101
  }
121
102
  }
122
103
  mainModule.finalize();
@@ -128,6 +109,9 @@ class IgniteUIForAngularTemplate {
128
109
  fileExists(filePath) {
129
110
  return cli_core_1.App.container.get(cli_core_1.FS_TOKEN).fileExists(filePath);
130
111
  }
112
+ addClassDeclaration(mainModule, projPath, name, modulePath) {
113
+ mainModule.addDeclaration(path.join(projPath, `src/app/${this.folderName(name)}/${this.fileName(name)}.component.ts`), modulePath !== "app.module.ts");
114
+ }
131
115
  getBaseVariables(name) {
132
116
  const config = {};
133
117
  config["name"] = cli_core_1.Util.nameFromPath(name);
@@ -12,7 +12,7 @@ class IgxBulletGraphTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
12
12
  this.projectType = "igx-ts";
13
13
  this.name = "Bullet Graph";
14
14
  this.description = "IgxBulletGraph with different animations.";
15
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
15
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
16
16
  }
17
17
  }
18
18
  module.exports = new IgxBulletGraphTemplate();
@@ -11,7 +11,7 @@ class IgxCategoryChartTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForA
11
11
  this.projectType = "igx-ts";
12
12
  this.name = "Category Chart";
13
13
  this.description = "basic category chart with chart type selector.";
14
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
14
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
15
15
  }
16
16
  }
17
17
  module.exports = new IgxCategoryChartTemplate();
@@ -10,7 +10,7 @@ class IgxGridAwesomeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
10
10
  this.listInCustomTemplates = true;
11
11
  this.name = "Awesome Grid";
12
12
  this.description = "Awesome IgxGrid";
13
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
13
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
14
14
  }
15
15
  }
16
16
  module.exports = new IgxGridAwesomeTemplate();
@@ -10,7 +10,7 @@ class IgxGridCRMTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngular
10
10
  this.listInCustomTemplates = true;
11
11
  this.name = "CRM Grid";
12
12
  this.description = "CRM IgxGrid";
13
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
13
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
14
14
  }
15
15
  }
16
16
  module.exports = new IgxGridCRMTemplate();
@@ -10,7 +10,7 @@ class IgxFinTechGridTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
10
10
  this.listInCustomTemplates = true;
11
11
  this.name = "FinTech Grid";
12
12
  this.description = "Grid with simulated high-frequency data feed";
13
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
13
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
14
14
  }
15
15
  }
16
16
  module.exports = new IgxFinTechGridTemplate();
@@ -15,5 +15,8 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
15
15
  // "igniteui-dockmanager@~1.0.0":
16
16
  this.packages = [`${(0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER)}@~1.8.0`];
17
17
  }
18
+ addClassDeclaration(mainModule, projPath, name, modulePath) {
19
+ // not applicable with custom module
20
+ }
18
21
  }
19
22
  module.exports = new IgcDockManagerTemplate();
@@ -10,7 +10,7 @@ class IgxFinancialChartTemplate extends IgniteUIForAngularTemplate_1.IgniteUIFor
10
10
  this.id = "financial-chart";
11
11
  this.projectType = "igx-ts";
12
12
  this.name = "Financial Chart";
13
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
13
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
14
14
  }
15
15
  }
16
16
  module.exports = new IgxFinancialChartTemplate();
@@ -95,7 +95,7 @@ class IgxCustomGridTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngu
95
95
  checkBoxBind = `[ngModel]="cell.value" (ngModelChange)="cell.update($event)"`;
96
96
  // enable Date Picker, ngModel
97
97
  // this.dependencies.push({ import: "IgxDatePickerModule", from: "<%=igxPackage%>" });
98
- this.dependencies.push({ import: "FormsModule", from: "@angular/forms", standalone: true });
98
+ this.dependencies.push({ import: "FormsModule", from: "@angular/forms" });
99
99
  // datePickerEditor = EOL +
100
100
  // `<ng-template igxCellEditor let-cell="cell">` + EOL +
101
101
  // ` <igx-date-picker cancelButtonLabel="cancel" todayButtonLabel="today" [(ngModel)]="cell.value"` +
@@ -107,7 +107,7 @@ class IgxCustomGridTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngu
107
107
  break;
108
108
  case "Row Editing":
109
109
  gridFeatures.push(`[rowEditable]="true"`);
110
- this.dependencies.push({ import: "IgxDatePickerComponent", from: "<%=igxPackage%>", standalone: true });
110
+ this.dependencies.push({ import: "IgxDatePickerComponent", from: "<%=igxPackage%>" });
111
111
  break;
112
112
  case "Row Selection":
113
113
  const gridFeatureText = `rowSelection="multiple"`;
@@ -111,7 +111,7 @@ class IgxHierarchicalGridTemplate extends IgniteUIForAngularTemplate_1.IgniteUIF
111
111
  break;
112
112
  case "Cell Editing":
113
113
  columnFeatures.push(`[editable]="true"`);
114
- this.dependencies.push({ import: "FormsModule", from: "@angular/forms", standalone: true });
114
+ this.dependencies.push({ import: "FormsModule", from: "@angular/forms" });
115
115
  break;
116
116
  case "Row Selection":
117
117
  const gridFeatureText = `rowSelection="multiple"`;
@@ -12,7 +12,7 @@ class IgxLinearGaugeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
12
12
  this.projectType = "igx-ts";
13
13
  this.name = "Linear Gauge";
14
14
  this.description = "IgxLinearGauge with different animations.";
15
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
15
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
16
16
  }
17
17
  }
18
18
  module.exports = new IgxLinearGaugeTemplate();
@@ -11,7 +11,7 @@ class IgxGeographicMapTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForA
11
11
  this.projectType = "igx-ts";
12
12
  this.name = "Geographic Map";
13
13
  this.description = "Basic IgxGeographicMap.";
14
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0", "igniteui-angular-maps@~17.2.0"];
14
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0", "igniteui-angular-maps@~18.0.0"];
15
15
  }
16
16
  }
17
17
  module.exports = new IgxGeographicMapTemplate();
@@ -19,7 +19,7 @@
19
19
  "@angular/platform-browser-dynamic": "~18.0.0",
20
20
  "@angular/router": "~18.0.0",
21
21
  "hammerjs": "~2.0.8",
22
- "igniteui-angular": "~18.0.0",
22
+ "igniteui-angular": "~18.1.0",
23
23
  "minireset.css": "~0.0.7",
24
24
  "rxjs": "~7.8.0",
25
25
  "tslib": "~2.3.0",
@@ -1,19 +1,27 @@
1
1
  import { ApplicationConfig, ErrorHandler, Provider, importProvidersFrom } from '@angular/core';
2
- import { provideRouter } from '@angular/router';
2
+ import { provideRouter, withComponentInputBinding } 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';
5
11
 
6
12
  import { routes } from './app.routes';
7
13
  import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
8
14
  import { environment } from '../environments/environment';
9
15
 
10
- // provide the HAMMER_GESTURE_CONFIG token
11
- // to override the default settings of the HammerModule
12
- // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
13
- const providers: Provider = [
14
- provideRouter(routes),
15
- importProvidersFrom(BrowserModule, HammerModule),
16
- provideAnimations()
16
+ 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
+ ]
17
25
  ];
18
26
 
19
27
  if (environment.production) {
@@ -1,10 +1,8 @@
1
- import { ApplicationConfig, Provider } from '@angular/core';
2
- import { provideRouter } from '@angular/router';
1
+ import { ApplicationConfig } from '@angular/core';
2
+ import { provideRouter, withComponentInputBinding } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
- const providers: Provider = [
7
- provideRouter(routes)
8
- ];
9
-
10
- export const appConfig: ApplicationConfig = { providers };
6
+ export const appConfig: ApplicationConfig = {
7
+ providers: [provideRouter(routes, withComponentInputBinding())]
8
+ };
@@ -1,10 +1,8 @@
1
- import { ApplicationConfig, Provider } from '@angular/core';
2
- import { provideRouter } from '@angular/router';
1
+ import { ApplicationConfig } from '@angular/core';
2
+ import { provideRouter, withComponentInputBinding } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
- const providers: Provider = [
7
- provideRouter(routes)
8
- ];
9
-
10
- export const appConfig: ApplicationConfig = { providers };
6
+ export const appConfig: ApplicationConfig = {
7
+ providers: [provideRouter(routes, withComponentInputBinding())]
8
+ };
@@ -1,5 +1,5 @@
1
- import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
2
- import { provideRouter } from '@angular/router';
1
+ import { ApplicationConfig, importProvidersFrom } from '@angular/core';
2
+ import { provideRouter, withComponentInputBinding } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
5
  import {
@@ -11,20 +11,20 @@ import {
11
11
 
12
12
  import { routes } from './app.routes';
13
13
 
14
- // provide the HAMMER_GESTURE_CONFIG token
15
- // to override the default settings of the HammerModule
16
- // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
17
- const providers: Provider = [
18
- provideRouter(routes),
19
- importProvidersFrom(
20
- BrowserModule,
21
- HammerModule,
22
- IgxLayoutModule,
23
- IgxNavbarModule,
24
- IgxNavigationDrawerModule,
25
- IgxRippleModule
26
- ),
27
- provideAnimations()
28
- ];
29
-
30
- export const appConfig: ApplicationConfig = { providers };
14
+ export const appConfig: ApplicationConfig = {
15
+ providers: [
16
+ provideRouter(routes, withComponentInputBinding()),
17
+ importProvidersFrom(
18
+ BrowserModule,
19
+ HammerModule,
20
+ IgxLayoutModule,
21
+ IgxNavbarModule,
22
+ IgxNavigationDrawerModule,
23
+ IgxRippleModule
24
+ ),
25
+ provideAnimations()
26
+ // provide the HAMMER_GESTURE_CONFIG token
27
+ // to override the default settings of the HammerModule
28
+ // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
29
+ ]
30
+ };
@@ -11,32 +11,32 @@
11
11
  },
12
12
  "private": true,
13
13
  "dependencies": {
14
- "@angular/animations": "~17.2.0",
15
- "@angular/common": "~17.2.0",
16
- "@angular/compiler": "~17.2.0",
17
- "@angular/core": "~17.2.0",
18
- "@angular/forms": "~17.2.0",
19
- "@angular/platform-browser": "~17.2.0",
20
- "@angular/platform-browser-dynamic": "~17.2.0",
21
- "@angular/router": "~17.2.0",
14
+ "@angular/animations": "~18.0.0",
15
+ "@angular/common": "~18.0.0",
16
+ "@angular/compiler": "~18.0.0",
17
+ "@angular/core": "~18.0.0",
18
+ "@angular/forms": "~18.0.0",
19
+ "@angular/platform-browser": "~18.0.0",
20
+ "@angular/platform-browser-dynamic": "~18.0.0",
21
+ "@angular/router": "~18.0.0",
22
22
  "angular-auth-oidc-client": "~15.0.4",
23
23
  "hammerjs": "~2.0.8",
24
- "igniteui-angular": "~17.2.0",
24
+ "igniteui-angular": "~18.0.0",
25
25
  "minireset.css": "~0.0.7",
26
26
  "rxjs": "~7.8.0",
27
27
  "tslib": "~2.3.0",
28
28
  "zone.js": "~0.14.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@angular-devkit/build-angular": "~17.2.0",
32
- "@angular-eslint/builder": "~17.2.0",
33
- "@angular-eslint/eslint-plugin": "~17.2.0",
34
- "@angular-eslint/eslint-plugin-template": "~17.2.0",
35
- "@angular-eslint/schematics": "~17.2.0",
36
- "@angular-eslint/template-parser": "~17.2.0",
37
- "@angular/cli": "~17.2.0",
38
- "@angular/compiler-cli": "~17.2.0",
39
- "@angular/language-service": "~17.2.0",
31
+ "@angular-devkit/build-angular": "~18.0.0",
32
+ "@angular-eslint/builder": "~18.0.0",
33
+ "@angular-eslint/eslint-plugin": "~18.0.0",
34
+ "@angular-eslint/eslint-plugin-template": "~18.0.0",
35
+ "@angular-eslint/schematics": "~18.0.0",
36
+ "@angular-eslint/template-parser": "~18.0.0",
37
+ "@angular/cli": "~18.0.0",
38
+ "@angular/compiler-cli": "~18.0.0",
39
+ "@angular/language-service": "~18.0.0",
40
40
  "@types/facebook-js-sdk": "~3.3.6",
41
41
  "@types/hammerjs": "~2.0.41",
42
42
  "@types/jasmine": "~5.1.1",
@@ -1,5 +1,5 @@
1
- import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
2
- import { provideRouter } from '@angular/router';
1
+ import { ApplicationConfig, importProvidersFrom } from '@angular/core';
2
+ import { provideRouter, withComponentInputBinding } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
5
5
  import {
@@ -12,22 +12,22 @@ import {
12
12
  import { AuthenticationModule, ExternalAuthService } from './authentication';
13
13
  import { routes } from './app.routes';
14
14
 
15
- // provide the HAMMER_GESTURE_CONFIG token
16
- // to override the default settings of the HammerModule
17
- // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
18
- const providers: Provider = [
19
- provideRouter(routes),
20
- importProvidersFrom(
21
- BrowserModule,
22
- HammerModule,
23
- IgxLayoutModule,
24
- IgxNavbarModule,
25
- IgxNavigationDrawerModule,
26
- IgxRippleModule,
27
- AuthenticationModule
28
- ),
29
- provideAnimations(),
30
- ExternalAuthService
31
- ];
32
-
33
- export const appConfig: ApplicationConfig = { providers };
15
+ export const appConfig: ApplicationConfig = {
16
+ providers: [
17
+ provideRouter(routes, withComponentInputBinding()),
18
+ importProvidersFrom(
19
+ BrowserModule,
20
+ HammerModule,
21
+ IgxLayoutModule,
22
+ IgxNavbarModule,
23
+ IgxNavigationDrawerModule,
24
+ IgxRippleModule,
25
+ AuthenticationModule
26
+ ),
27
+ provideAnimations(),
28
+ ExternalAuthService
29
+ // provide the HAMMER_GESTURE_CONFIG token
30
+ // to override the default settings of the HammerModule
31
+ // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
32
+ ]
33
+ };
@@ -12,7 +12,7 @@ class IgxRadialGaugeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
12
12
  this.projectType = "igx-ts";
13
13
  this.name = "Radial Gauge";
14
14
  this.description = "IgxRadialGauge with different animations";
15
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
15
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0", constants_1.IGNITEUI_ANGULAR_PACKAGE];
16
16
  }
17
17
  }
18
18
  module.exports = new IgxRadialGaugeTemplate();
@@ -15,7 +15,7 @@ class IgxBulletGraphTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
15
15
  import: ["IgxBulletGraphModule"],
16
16
  from: "igniteui-angular-gauges"
17
17
  }];
18
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0"];
18
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0"];
19
19
  }
20
20
  }
21
21
  module.exports = new IgxBulletGraphTemplate();
@@ -15,7 +15,7 @@ class IgxCategoryChartTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForA
15
15
  { import: "IgxCategoryChartModule", from: "igniteui-angular-charts" },
16
16
  { import: "FormsModule", from: "@angular/forms" }
17
17
  ];
18
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
18
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
19
19
  }
20
20
  }
21
21
  module.exports = new IgxCategoryChartTemplate();
@@ -33,7 +33,7 @@ class IgxGridAwesomeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
33
33
  },
34
34
  { import: "FormsModule", from: "@angular/forms" }
35
35
  ];
36
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
36
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
37
37
  }
38
38
  }
39
39
  module.exports = new IgxGridAwesomeTemplate();
@@ -43,7 +43,7 @@ class IgxGridCRMTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAngular
43
43
  },
44
44
  { import: "FormsModule", from: "@angular/forms" }
45
45
  ];
46
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
46
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
47
47
  }
48
48
  }
49
49
  module.exports = new IgxGridCRMTemplate();
@@ -30,7 +30,7 @@ class IgxFinTechGridTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
30
30
  },
31
31
  { import: "FormsModule", from: "@angular/forms" }
32
32
  ];
33
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
33
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
34
34
  }
35
35
  }
36
36
  module.exports = new IgxFinTechGridTemplate();
@@ -8,7 +8,6 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
8
8
  this.components = ["Dock Manager"];
9
9
  this.controlGroup = "Layouts";
10
10
  this.listInComponentTemplates = true;
11
- this.addAsNgModelDeclaration = false;
12
11
  this.id = "dock-manager";
13
12
  this.projectType = "igx-ts";
14
13
  this.name = "Dock Manager";
@@ -19,5 +18,8 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
19
18
  // "igniteui-dockmanager@~1.0.0":
20
19
  this.packages = [`${(0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER)}@~1.8.0`];
21
20
  }
21
+ addClassDeclaration(mainModule, projPath, name, modulePath) {
22
+ // not applicable with custom module
23
+ }
22
24
  }
23
25
  module.exports = new IgcDockManagerTemplate();
@@ -13,7 +13,7 @@ class IgxFinancialChartTemplate extends IgniteUIForAngularTemplate_1.IgniteUIFor
13
13
  this.dependencies = [
14
14
  { import: "IgxFinancialChartModule", from: "igniteui-angular-charts" }
15
15
  ];
16
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0"];
16
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0"];
17
17
  }
18
18
  }
19
19
  module.exports = new IgxFinancialChartTemplate();
@@ -17,7 +17,7 @@ class IgxLinearGaugeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
17
17
  from: "igniteui-angular-gauges"
18
18
  }
19
19
  ];
20
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0"];
20
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0"];
21
21
  }
22
22
  }
23
23
  module.exports = new IgxLinearGaugeTemplate();
@@ -21,7 +21,7 @@ class IgxGeographicMapTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForA
21
21
  from: "igniteui-angular-charts"
22
22
  }
23
23
  ];
24
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-charts@~17.2.0", "igniteui-angular-maps@~17.2.0"];
24
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-charts@~18.0.0", "igniteui-angular-maps@~18.0.0"];
25
25
  }
26
26
  }
27
27
  module.exports = new IgxGeographicMapTemplate();
@@ -20,7 +20,7 @@
20
20
  "@angular/platform-browser-dynamic": "~18.0.0",
21
21
  "@angular/router": "~18.0.0",
22
22
  "hammerjs": "^2.0.8",
23
- "igniteui-angular": "~18.0.0",
23
+ "igniteui-angular": "~18.1.0",
24
24
  "minireset.css": "~0.0.7",
25
25
  "rxjs": "~7.8.0",
26
26
  "tslib": "~2.3.0",
@@ -11,7 +11,7 @@ export const routes: Routes = [
11
11
  ];
12
12
 
13
13
  @NgModule({
14
- imports: [RouterModule.forRoot(routes), ErrorRoutingModule],
14
+ imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true }), 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), ErrorRoutingModule],
17
+ imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true }), 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)],
11
+ imports: [RouterModule.forRoot(routes, { bindToComponentInputs: true })],
12
12
  exports: [RouterModule]
13
13
  })
14
14
  export class AppRoutingModule { }
@@ -11,32 +11,32 @@
11
11
  },
12
12
  "private": true,
13
13
  "dependencies": {
14
- "@angular/animations": "~17.2.0",
15
- "@angular/common": "~17.2.0",
16
- "@angular/compiler": "~17.2.0",
17
- "@angular/core": "~17.2.0",
18
- "@angular/forms": "~17.2.0",
19
- "@angular/platform-browser": "~17.2.0",
20
- "@angular/platform-browser-dynamic": "~17.2.0",
21
- "@angular/router": "~17.2.0",
14
+ "@angular/animations": "~18.0.0",
15
+ "@angular/common": "~18.0.0",
16
+ "@angular/compiler": "~18.0.0",
17
+ "@angular/core": "~18.0.0",
18
+ "@angular/forms": "~18.0.0",
19
+ "@angular/platform-browser": "~18.0.0",
20
+ "@angular/platform-browser-dynamic": "~18.0.0",
21
+ "@angular/router": "~18.0.0",
22
22
  "angular-auth-oidc-client": "~15.0.4",
23
23
  "hammerjs": "~2.0.8",
24
- "igniteui-angular": "~17.2.0",
24
+ "igniteui-angular": "~18.1.0",
25
25
  "minireset.css": "~0.0.7",
26
26
  "rxjs": "~7.8.0",
27
27
  "tslib": "~2.3.0",
28
28
  "zone.js": "~0.14.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@angular-devkit/build-angular": "~17.2.0",
32
- "@angular-eslint/builder": "~17.2.0",
33
- "@angular-eslint/eslint-plugin": "~17.2.0",
34
- "@angular-eslint/eslint-plugin-template": "~17.2.0",
35
- "@angular-eslint/schematics": "~17.2.0",
36
- "@angular-eslint/template-parser": "~17.2.0",
37
- "@angular/cli": "~17.2.0",
38
- "@angular/compiler-cli": "~17.2.0",
39
- "@angular/language-service": "~17.2.0",
31
+ "@angular-devkit/build-angular": "~18.0.0",
32
+ "@angular-eslint/builder": "~18.0.0",
33
+ "@angular-eslint/eslint-plugin": "~18.0.0",
34
+ "@angular-eslint/eslint-plugin-template": "~18.0.0",
35
+ "@angular-eslint/schematics": "~18.0.0",
36
+ "@angular-eslint/template-parser": "~18.0.0",
37
+ "@angular/cli": "~18.0.0",
38
+ "@angular/compiler-cli": "~18.0.0",
39
+ "@angular/language-service": "~18.0.0",
40
40
  "@types/facebook-js-sdk": "~3.3.6",
41
41
  "@types/hammerjs": "~2.0.41",
42
42
  "@types/jasmine": "~5.1.1",
@@ -17,7 +17,7 @@ class IgxRadialGaugeTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
17
17
  from: "igniteui-angular-gauges"
18
18
  }
19
19
  ];
20
- this.packages = ["igniteui-angular-core@~17.2.0", "igniteui-angular-gauges@~17.2.0"];
20
+ this.packages = ["igniteui-angular-core@~18.0.0", "igniteui-angular-gauges@~18.0.0"];
21
21
  }
22
22
  }
23
23
  module.exports = new IgxRadialGaugeTemplate();
package/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- import * as standalone from './igx-ts';
2
- export * from './IgniteUIForAngularTemplate';
3
- export * from './AngularTypeScriptFileUpdate';
4
- export * from './types';
1
+ import * as standalone from "./igx-ts";
2
+ export * from "./IgniteUIForAngularTemplate";
5
3
  declare const _default: (typeof standalone)[];
6
4
  export default _default;
package/index.js CHANGED
@@ -17,6 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const standalone = require("./igx-ts");
18
18
  const legacy = require("./igx-ts-legacy");
19
19
  __exportStar(require("./IgniteUIForAngularTemplate"), exports);
20
- __exportStar(require("./AngularTypeScriptFileUpdate"), exports);
21
- __exportStar(require("./types"), exports);
22
20
  exports.default = [standalone, legacy];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniteui/angular-templates",
3
- "version": "18.0.1400-beta.1",
3
+ "version": "18.1.1340",
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-beta.1",
15
+ "@igniteui/cli-core": "~13.4.0",
16
16
  "typescript": "~5.4.3"
17
17
  }
18
18
  }
@@ -1,83 +0,0 @@
1
- import { KeyValuePair, FormatSettings, PropertyAssignment, TemplateDependency, TypeScriptFileUpdate, RouteEntry } from '@igniteui/cli-core';
2
- import { AngularRouteLike } from './types';
3
- export declare class AngularTypeScriptFileUpdate extends TypeScriptFileUpdate {
4
- protected filePath: string;
5
- private standalone;
6
- protected formatSettings?: FormatSettings;
7
- /**
8
- * Creates a new AngularTypeScriptFileUpdate instance for the given file.
9
- * @param standalone Whether the file is a standalone component.
10
- * @param formatSettings Custom formatting settings to apply.
11
- */
12
- constructor(filePath: string, standalone?: boolean, formatSettings?: FormatSettings);
13
- /**
14
- * Adds a route entry to the Angular routing module's routes variable instance.
15
- * @param route The route to add.
16
- * @param multiline Whether to format the new entry as multiline.
17
- * @param prepend Whether to insert the new entry before the anchor element.
18
- * If no anchor is provided, the new entry will be added to the start or end of the array.
19
- * @param anchorElement The anchor element to insert to.
20
- */
21
- addRoute(route: AngularRouteLike, multiline?: boolean, prepend?: boolean, anchorElement?: PropertyAssignment): void;
22
- addChildRoute(parentPath: string, route: AngularRouteLike, asIdentifier?: boolean, multiline?: boolean): void;
23
- /**
24
- * Adds an import identifier to a standalone component's metadata.
25
- * @param dep The dependency to add to the standalone component's metadata.
26
- * @param variables Variables to replace in the dependency strings.
27
- * @param multiline Whether to format the new entry as multiline.
28
- */
29
- addStandaloneComponentMeta(dep: TemplateDependency, variables?: KeyValuePair<string>, multiline?: boolean): void;
30
- /**
31
- * Adds metadata to an NgModule decorator.
32
- * @param dep The dependency to add to the NgModule decorator.
33
- * @param variables Variables to replace in the dependency strings.
34
- * @param multiline Whether to format the new entry as multiline.
35
- */
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;
47
- protected buildRouteStructure(route: AngularRouteLike, multiline: boolean): RouteEntry[];
48
- /**
49
- * Add an imort declaration for the dependency.
50
- * @param meta The metadata to use for the import declaration.
51
- * @param moduleName The name of the module to import from.
52
- * @param variables Variables to replace in the dependency strings.
53
- */
54
- private addImportDeclarationForDependency;
55
- /**
56
- * Applies mutations to an Angular decorator's metadata.
57
- * @param decoratorName The name of the decorator to update.
58
- * @param meta The metadata to use for the mutations.
59
- * @param multiline Whether to format the new entry as multiline.
60
- */
61
- private applyDecoratorMutations;
62
- /**
63
- * Updates an Angular decorator's metadata.
64
- * @param name The name of the decorator to update.
65
- * @param meta Names of identifiers to be added.
66
- * @param target The target metadata property to update.
67
- * @param multiline Whether to format the new entry as multiline.
68
- */
69
- private mutateNgDecoratorMeta;
70
- /**
71
- * Checks if a node has an ancestor with a specific decorator.
72
- * @param name The name of the decorator.
73
- * @param node The node to start checking from.
74
- */
75
- private checkNgDecorator;
76
- /**
77
- * Finds a property assignment that exists in a specific NG decorator meta.
78
- * @param decoratorName The name of the decorator to check.
79
- * @param propName The property name to check.
80
- * @param node The node to start checking from.
81
- */
82
- private findNgDecoratorProperty;
83
- }
@@ -1,271 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AngularTypeScriptFileUpdate = void 0;
4
- const ts = require("typescript");
5
- const cli_core_1 = require("@igniteui/cli-core");
6
- const types_1 = require("./types");
7
- class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
8
- /**
9
- * Creates a new AngularTypeScriptFileUpdate instance for the given file.
10
- * @param standalone Whether the file is a standalone component.
11
- * @param formatSettings Custom formatting settings to apply.
12
- */
13
- constructor(filePath, standalone = false, formatSettings) {
14
- super(filePath, formatSettings);
15
- this.filePath = filePath;
16
- this.standalone = standalone;
17
- this.formatSettings = formatSettings;
18
- }
19
- //#region Public API
20
- /**
21
- * Adds a route entry to the Angular routing module's routes variable instance.
22
- * @param route The route to add.
23
- * @param multiline Whether to format the new entry as multiline.
24
- * @param prepend Whether to insert the new entry before the anchor element.
25
- * If no anchor is provided, the new entry will be added to the start or end of the array.
26
- * @param anchorElement The anchor element to insert to.
27
- */
28
- addRoute(route, multiline = false, prepend = true, anchorElement = cli_core_1.ANCHOR_ELEMENT) {
29
- if (!route.lazyload) {
30
- this.requestImportForRouteIdentifier(route);
31
- }
32
- const structure = this.buildRouteStructure(route, multiline);
33
- const newRoute = this.astTransformer.createObjectLiteralExpression(structure, multiline);
34
- this.astTransformer.requestNewMembersInArrayLiteral((0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.ROUTES_VARIABLE_NAME), [newRoute], prepend, anchorElement);
35
- }
36
- addChildRoute(parentPath, route, asIdentifier = false, multiline = false) {
37
- super.addChildRoute(parentPath, route, asIdentifier, multiline);
38
- }
39
- /**
40
- * Adds an import identifier to a standalone component's metadata.
41
- * @param dep The dependency to add to the standalone component's metadata.
42
- * @param variables Variables to replace in the dependency strings.
43
- * @param multiline Whether to format the new entry as multiline.
44
- */
45
- addStandaloneComponentMeta(dep, variables, multiline = false) {
46
- if (!this.standalone || !dep.standalone)
47
- return;
48
- const copy = {
49
- imports: this.asArray(dep.import || [], variables || {}),
50
- providers: this.asArray(dep.provide || [], variables || {}),
51
- schemas: this.asArray(dep.schema || [], variables || {}),
52
- };
53
- if (dep.from) {
54
- this.addImportDeclarationForDependency(copy, dep.from, variables);
55
- }
56
- this.applyDecoratorMutations(cli_core_1.NG_SA_DECORATOR_NAME, copy, multiline);
57
- }
58
- /**
59
- * Adds metadata to an NgModule decorator.
60
- * @param dep The dependency to add to the NgModule decorator.
61
- * @param variables Variables to replace in the dependency strings.
62
- * @param multiline Whether to format the new entry as multiline.
63
- */
64
- addNgModuleMeta(dep, variables, multiline = false) {
65
- if (this.standalone || dep.standalone)
66
- return;
67
- const copy = {
68
- imports: this.asArray(dep.import || [], variables || {}),
69
- declarations: this.asArray(dep.declare || [], variables || {}),
70
- providers: this.asArray(dep.provide || [], variables || {}),
71
- exports: this.asArray(dep.export || [], variables || {}),
72
- schemas: this.asArray(dep.schema || [], variables || {}),
73
- };
74
- if (dep.from) {
75
- this.addImportDeclarationForDependency(copy, dep.from, variables);
76
- }
77
- if (dep.root && copy.imports.length > 0) {
78
- // add forRoot to the module
79
- copy.imports = copy.imports.map((i) => this.astTransformer.printer.printNode(ts.EmitHint.Unspecified, this.astTransformer.createCallExpression(i, cli_core_1.NG_FOR_ROOT_IDENTIFIER_NAME), this.astTransformer.sourceFile));
80
- }
81
- this.applyDecoratorMutations(cli_core_1.NG_MODULE_DECORATOR_NAME, copy, multiline);
82
- }
83
- /**
84
- * Includes `{ bindToComponentInputs: true }` for a `forRoot` call in an `NgModule`'s `imports` member.
85
- *
86
- * For standalone projects, includes an `withComponentInputBinding` call in a `providers` variable. Mainly present in an `app.config` file.
87
- */
88
- allowComponentInputBinding() {
89
- if (this.standalone) {
90
- this.astTransformer.requestNewImportDeclaration({
91
- identifiers: [{ name: cli_core_1.WITH_COMPONENT_INPUT_BINDING }],
92
- moduleName: cli_core_1.NG_ROUTER_PACKAGE,
93
- });
94
- // create withComponentInputBinding()
95
- const callExpr = ts.factory.createCallExpression(ts.factory.createIdentifier(cli_core_1.WITH_COMPONENT_INPUT_BINDING), undefined, // type args
96
- [] // args
97
- );
98
- this.astTransformer.requestNewArgumentInMethodCallExpression((node) => ts.isIdentifier(node.expression) &&
99
- node.expression.text === cli_core_1.PROVIDE_ROUTER &&
100
- (0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.NG_DECORATOR_PROVIDERS)(node), callExpr);
101
- }
102
- else {
103
- const objLiteral = this.astTransformer.createObjectLiteralExpression([{ bindToComponentInputs: cli_core_1.TRUE_CLAUSE }], false, // multiline
104
- () => ts.factory.createTrue());
105
- this.astTransformer.requestNewArgumentInMethodCallExpression((node) => ts.isPropertyAccessExpression(node.expression) &&
106
- ts.isIdentifier(node.expression.name) &&
107
- node.expression.name.text === cli_core_1.NG_FOR_ROOT_IDENTIFIER_NAME &&
108
- this.checkNgDecorator(cli_core_1.NG_MODULE_DECORATOR_NAME, node), objLiteral);
109
- }
110
- }
111
- /**
112
- * Provides the `HttpClient` for standalone applications.
113
- */
114
- provideHttpClientForStandaloneAppConfig() {
115
- this.astTransformer.requestNewImportDeclaration({
116
- identifiers: [{ name: cli_core_1.NG_HTTP_CLIENT_PROVIDER }],
117
- moduleName: cli_core_1.NG_COMMON_HTTP_PACKAGE,
118
- });
119
- // create provideHttpClient()
120
- const callExpr = ts.factory.createCallExpression(ts.factory.createIdentifier(cli_core_1.NG_HTTP_CLIENT_PROVIDER), undefined, // type args
121
- [] // args
122
- );
123
- this.astTransformer.requestNewMembersInArrayLiteral((0, cli_core_1.variableAsParentCondition)(this.astTransformer, cli_core_1.NG_DECORATOR_PROVIDERS), [callExpr]);
124
- }
125
- //#endregion
126
- //#region Protected Overrides
127
- buildRouteStructure(route, multiline) {
128
- var _a, _b, _c, _d, _e;
129
- let structure = [];
130
- // lazily loaded route
131
- if (route.lazyload &&
132
- route.path &&
133
- route.identifierName &&
134
- route.modulePath) {
135
- const lazyLoadedModule = this.createDynamicImport(route.modulePath, route.identifierName, route.root);
136
- const propAssignmentName = route.root
137
- ? types_1.AngularRouteTarget.LoadChildren
138
- : types_1.AngularRouteTarget.LoadComponent;
139
- structure = [
140
- {
141
- name: cli_core_1.RouteTarget.Path,
142
- value: ts.factory.createStringLiteral(route.path, (_a = this.formatSettings) === null || _a === void 0 ? void 0 : _a.singleQuotes),
143
- },
144
- { name: propAssignmentName, value: lazyLoadedModule },
145
- ];
146
- }
147
- if (route.redirectTo) {
148
- // redirect route
149
- structure = [
150
- {
151
- name: cli_core_1.RouteTarget.Path,
152
- value: ts.factory.createStringLiteral(route.path || '', (_b = this.formatSettings) === null || _b === void 0 ? void 0 : _b.singleQuotes),
153
- },
154
- {
155
- name: types_1.AngularRouteTarget.RedirectTo,
156
- value: ts.factory.createStringLiteral(route.redirectTo, (_c = this.formatSettings) === null || _c === void 0 ? void 0 : _c.singleQuotes),
157
- },
158
- ];
159
- if (route.pathMatch) {
160
- structure.push({
161
- name: types_1.AngularRouteTarget.PathMatch,
162
- value: ts.factory.createStringLiteral(route.pathMatch, (_d = this.formatSettings) === null || _d === void 0 ? void 0 : _d.singleQuotes),
163
- });
164
- }
165
- }
166
- else if (!route.lazyload) {
167
- // default route
168
- structure = [
169
- {
170
- name: cli_core_1.RouteTarget.Path,
171
- value: ts.factory.createStringLiteral(route.path, (_e = this.formatSettings) === null || _e === void 0 ? void 0 : _e.singleQuotes),
172
- },
173
- {
174
- name: cli_core_1.RouteTarget.Component,
175
- value: ts.factory.createIdentifier(route.aliasName || route.identifierName),
176
- },
177
- ];
178
- }
179
- if (route.data) {
180
- structure.push({
181
- name: types_1.AngularRouteTarget.Data,
182
- value: this.astTransformer.createObjectLiteralExpression([route.data], multiline, (value) => {
183
- var _a;
184
- return ts.factory.createStringLiteral(value, (_a = this.formatSettings) === null || _a === void 0 ? void 0 : _a.singleQuotes);
185
- }),
186
- });
187
- }
188
- return structure;
189
- }
190
- //#endregion
191
- //#region Internals
192
- /**
193
- * Add an imort declaration for the dependency.
194
- * @param meta The metadata to use for the import declaration.
195
- * @param moduleName The name of the module to import from.
196
- * @param variables Variables to replace in the dependency strings.
197
- */
198
- addImportDeclarationForDependency(meta, moduleName, variables) {
199
- // add an import declaration for the dependency
200
- const uniqueIdentifiers = new Set(Object.keys(meta)
201
- .map((key) => meta[key])
202
- .flat());
203
- const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
204
- this.astTransformer.requestNewImportDeclaration({
205
- identifiers,
206
- moduleName: this.applyConfigTransformation(moduleName, variables),
207
- });
208
- }
209
- /**
210
- * Applies mutations to an Angular decorator's metadata.
211
- * @param decoratorName The name of the decorator to update.
212
- * @param meta The metadata to use for the mutations.
213
- * @param multiline Whether to format the new entry as multiline.
214
- */
215
- applyDecoratorMutations(decoratorName, meta, multiline = false) {
216
- for (const key of Object.keys(meta)) {
217
- if (meta[key].length > 0) {
218
- this.mutateNgDecoratorMeta(decoratorName, meta[key], key, multiline);
219
- }
220
- }
221
- }
222
- /**
223
- * Updates an Angular decorator's metadata.
224
- * @param name The name of the decorator to update.
225
- * @param meta Names of identifiers to be added.
226
- * @param target The target metadata property to update.
227
- * @param multiline Whether to format the new entry as multiline.
228
- */
229
- mutateNgDecoratorMeta(name, meta, target, multiline = false) {
230
- const identifiers = meta.map(ts.factory.createIdentifier);
231
- const targetMetaProp = this.findNgDecoratorProperty(name, target);
232
- const value = targetMetaProp && !ts.isArrayLiteralExpression(targetMetaProp.initializer)
233
- ? [targetMetaProp.initializer, ...identifiers]
234
- : identifiers;
235
- this.astTransformer.requestNewMemberInObjectLiteral((node) => this.checkNgDecorator(name, node), target, this.astTransformer.createArrayLiteralExpression(value, multiline), multiline);
236
- }
237
- /**
238
- * Checks if a node has an ancestor with a specific decorator.
239
- * @param name The name of the decorator.
240
- * @param node The node to start checking from.
241
- */
242
- checkNgDecorator(name, node) {
243
- const getNodeExpressionTokenName = (node) => {
244
- const nodeExpression = ts.isDecorator(node) &&
245
- ts.isCallExpression(node.expression) &&
246
- node.expression;
247
- const token = nodeExpression &&
248
- ts.isIdentifier(nodeExpression.expression) &&
249
- nodeExpression.expression;
250
- return ts.isIdentifier(token) && token.text;
251
- };
252
- return !!this.astTransformer.findNodeAncestor(node, (node) => getNodeExpressionTokenName(node) === name);
253
- }
254
- /**
255
- * Finds a property assignment that exists in a specific NG decorator meta.
256
- * @param decoratorName The name of the decorator to check.
257
- * @param propName The property name to check.
258
- * @param node The node to start checking from.
259
- */
260
- findNgDecoratorProperty(decoratorName, propName) {
261
- const ngDecoratorExists = (node) => !!this.astTransformer.findNodeAncestor(node, (node) => {
262
- const nodeExpressionToken = ts.isDecorator(node) && node.expression.getFirstToken();
263
- return (ts.isIdentifier(nodeExpressionToken) &&
264
- nodeExpressionToken.text === decoratorName);
265
- });
266
- return this.astTransformer.findPropertyAssignment((node) => ts.isIdentifier(node.name) &&
267
- node.name.text === propName &&
268
- ngDecoratorExists(node));
269
- }
270
- }
271
- exports.AngularTypeScriptFileUpdate = AngularTypeScriptFileUpdate;
@@ -1,6 +0,0 @@
1
- import { RouteEntry, RouteTarget } from "@igniteui/cli-core";
2
- import { AngularRouteTarget } from "./index";
3
- /** Represents an Angular route entry in a routes collection. */
4
- export interface AngularRouteEntry extends Pick<RouteEntry, "value"> {
5
- name: RouteTarget | AngularRouteTarget;
6
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- import { RouteLike, KeyValuePair } from "@igniteui/cli-core";
2
- /** A route member in an Angular routes collection. */
3
- export interface AngularRouteLike extends RouteLike {
4
- /** The path-matching strategy, one of 'prefix' or 'full'. Default is 'prefix'. */
5
- pathMatch?: "prefix" | "full";
6
- /** For lazy loaded routes - if it should load the routes' children or its component. */
7
- root?: boolean;
8
- /** Additional developer-defined data provided to the component via `ActivatedRoute`. */
9
- data?: KeyValuePair<string>;
10
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- /** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
2
- /** Represents possible meta data members in an Angular decorator. */
3
- export interface AngularDecoratorMetaTarget {
4
- imports?: string[];
5
- declarations?: string[];
6
- providers?: string[];
7
- exports?: string[];
8
- schemas?: string[];
9
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- /** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- /** Represents possible members in an Angular route object. */
2
- export declare enum AngularRouteTarget {
3
- PathMatch = "pathMatch",
4
- Root = "root",
5
- Data = "data",
6
- Children = "children",
7
- RedirectTo = "redirectTo",
8
- LoadChildren = "loadChildren",
9
- LoadComponent = "loadComponent"
10
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AngularRouteTarget = void 0;
4
- /** Represents possible members in an Angular route object. */
5
- var AngularRouteTarget;
6
- (function (AngularRouteTarget) {
7
- AngularRouteTarget["PathMatch"] = "pathMatch";
8
- AngularRouteTarget["Root"] = "root";
9
- AngularRouteTarget["Data"] = "data";
10
- AngularRouteTarget["Children"] = "children";
11
- AngularRouteTarget["RedirectTo"] = "redirectTo";
12
- AngularRouteTarget["LoadChildren"] = "loadChildren";
13
- AngularRouteTarget["LoadComponent"] = "loadComponent";
14
- })(AngularRouteTarget || (exports.AngularRouteTarget = AngularRouteTarget = {}));
package/types/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./enumerations/AngularDecoratorMetaTarget";
2
- export * from "./enumerations/AngularRouteTarget";
3
- export * from "./AngularRouteEntry";
4
- export * from "./AngularRouteLike";
package/types/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./enumerations/AngularDecoratorMetaTarget"), exports);
18
- __exportStar(require("./enumerations/AngularRouteTarget"), exports);
19
- __exportStar(require("./AngularRouteEntry"), exports);
20
- __exportStar(require("./AngularRouteLike"), exports);