@igniteui/angular-templates 18.0.1400-alpha.4 → 18.0.1400-beta.1

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.
@@ -45,6 +45,20 @@ export declare class AngularTypeScriptFileUpdate extends TypeScriptFileUpdate {
45
45
  */
46
46
  provideHttpClientForStandaloneAppConfig(): void;
47
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;
48
62
  /**
49
63
  * Updates an Angular decorator's metadata.
50
64
  * @param name The name of the decorator to update.
@@ -46,32 +46,14 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
46
46
  if (!this.standalone || !dep.standalone)
47
47
  return;
48
48
  const copy = {
49
- import: this.asArray(dep.import || [], variables || {}),
50
- provide: this.asArray(dep.provide || [], variables || {}),
49
+ imports: this.asArray(dep.import || [], variables || {}),
50
+ providers: this.asArray(dep.provide || [], variables || {}),
51
51
  schemas: this.asArray(dep.schema || [], variables || {}),
52
52
  };
53
53
  if (dep.from) {
54
- // add an import declaration for the dependency
55
- const uniqueIdentifiers = new Set([
56
- ...copy.import,
57
- ...copy.provide,
58
- ...copy.schemas,
59
- ]);
60
- const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
61
- this.astTransformer.requestNewImportDeclaration({
62
- identifiers,
63
- moduleName: this.applyConfigTransformation(dep.from, variables),
64
- });
65
- }
66
- if (copy.import.length > 0) {
67
- this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
68
- }
69
- if (copy.provide.length > 0) {
70
- this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
71
- }
72
- if (copy.schemas.length > 0) {
73
- this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.schemas, types_1.AngularDecoratorMetaTarget.Schemas, multiline);
54
+ this.addImportDeclarationForDependency(copy, dep.from, variables);
74
55
  }
56
+ this.applyDecoratorMutations(cli_core_1.NG_SA_DECORATOR_NAME, copy, multiline);
75
57
  }
76
58
  /**
77
59
  * Adds metadata to an NgModule decorator.
@@ -83,46 +65,20 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
83
65
  if (this.standalone || dep.standalone)
84
66
  return;
85
67
  const copy = {
86
- import: this.asArray(dep.import || [], variables || {}),
87
- declare: this.asArray(dep.declare || [], variables || {}),
88
- provide: this.asArray(dep.provide || [], variables || {}),
89
- export: this.asArray(dep.export || [], variables || {}),
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 || {}),
90
72
  schemas: this.asArray(dep.schema || [], variables || {}),
91
73
  };
92
74
  if (dep.from) {
93
- // add an import declaration for the dependency
94
- const uniqueIdentifiers = new Set([
95
- ...copy.import,
96
- ...copy.declare,
97
- ...copy.provide,
98
- ...copy.export,
99
- ...copy.schemas,
100
- ]);
101
- const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
102
- this.astTransformer.requestNewImportDeclaration({
103
- identifiers,
104
- moduleName: this.applyConfigTransformation(dep.from, variables),
105
- });
75
+ this.addImportDeclarationForDependency(copy, dep.from, variables);
106
76
  }
107
- if (dep.root && copy.import.length > 0) {
77
+ if (dep.root && copy.imports.length > 0) {
108
78
  // add forRoot to the module
109
- copy.import = copy.import.map((i) => this.astTransformer.printer.printNode(ts.EmitHint.Unspecified, this.astTransformer.createCallExpression(i, cli_core_1.NG_FOR_ROOT_IDENTIFIER_NAME), this.astTransformer.sourceFile));
110
- }
111
- if (copy.declare.length > 0) {
112
- this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.declare, types_1.AngularDecoratorMetaTarget.Declarations, multiline);
113
- }
114
- if (copy.import.length > 0) {
115
- this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
116
- }
117
- if (copy.provide.length > 0) {
118
- this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
119
- }
120
- if (copy.export.length > 0) {
121
- this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.export, types_1.AngularDecoratorMetaTarget.Exports, multiline);
122
- }
123
- if (copy.schemas.length > 0) {
124
- this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.schemas, types_1.AngularDecoratorMetaTarget.Schemas, multiline);
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));
125
80
  }
81
+ this.applyDecoratorMutations(cli_core_1.NG_MODULE_DECORATOR_NAME, copy, multiline);
126
82
  }
127
83
  /**
128
84
  * Includes `{ bindToComponentInputs: true }` for a `forRoot` call in an `NgModule`'s `imports` member.
@@ -233,6 +189,36 @@ class AngularTypeScriptFileUpdate extends cli_core_1.TypeScriptFileUpdate {
233
189
  }
234
190
  //#endregion
235
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
+ }
236
222
  /**
237
223
  * Updates an Angular decorator's metadata.
238
224
  * @param name The name of the decorator to update.
@@ -7,13 +7,13 @@ import { routes } from './app.routes';
7
7
  import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
8
8
  import { environment } from '../environments/environment';
9
9
 
10
- const providers: Provider[] = [
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 = [
11
14
  provideRouter(routes),
12
15
  importProvidersFrom(BrowserModule, HammerModule),
13
16
  provideAnimations()
14
- // provide the HAMMER_GESTURE_CONFIG token
15
- // to override the default settings of the HammerModule
16
- // { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
17
17
  ];
18
18
 
19
19
  if (environment.production) {
@@ -1,8 +1,10 @@
1
- import { ApplicationConfig } from '@angular/core';
1
+ import { ApplicationConfig, Provider } from '@angular/core';
2
2
  import { provideRouter } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
- export const appConfig: ApplicationConfig = {
7
- providers: [provideRouter(routes)]
8
- };
6
+ const providers: Provider = [
7
+ provideRouter(routes)
8
+ ];
9
+
10
+ export const appConfig: ApplicationConfig = { providers };
@@ -1,8 +1,10 @@
1
- import { ApplicationConfig } from '@angular/core';
1
+ import { ApplicationConfig, Provider } from '@angular/core';
2
2
  import { provideRouter } from '@angular/router';
3
3
 
4
4
  import { routes } from './app.routes';
5
5
 
6
- export const appConfig: ApplicationConfig = {
7
- providers: [provideRouter(routes)]
8
- };
6
+ const providers: Provider = [
7
+ provideRouter(routes)
8
+ ];
9
+
10
+ export const appConfig: ApplicationConfig = { providers };
@@ -1,4 +1,4 @@
1
- import { ApplicationConfig, importProvidersFrom } from '@angular/core';
1
+ import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
2
2
  import { provideRouter } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
@@ -11,20 +11,20 @@ import {
11
11
 
12
12
  import { routes } from './app.routes';
13
13
 
14
- export const appConfig: ApplicationConfig = {
15
- providers: [
16
- provideRouter(routes),
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
- };
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 };
@@ -1,4 +1,4 @@
1
- import { ApplicationConfig, importProvidersFrom } from '@angular/core';
1
+ import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
2
2
  import { provideRouter } from '@angular/router';
3
3
  import { BrowserModule, HammerModule } from '@angular/platform-browser';
4
4
  import { provideAnimations } from '@angular/platform-browser/animations';
@@ -12,22 +12,22 @@ import {
12
12
  import { AuthenticationModule, ExternalAuthService } from './authentication';
13
13
  import { routes } from './app.routes';
14
14
 
15
- export const appConfig: ApplicationConfig = {
16
- providers: [
17
- provideRouter(routes),
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
- };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniteui/angular-templates",
3
- "version": "18.0.1400-alpha.4",
3
+ "version": "18.0.1400-beta.1",
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.4",
15
+ "@igniteui/cli-core": "~14.0.0-beta.1",
16
16
  "typescript": "~5.4.3"
17
17
  }
18
18
  }
@@ -1,8 +1,9 @@
1
+ /** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
1
2
  /** Represents possible meta data members in an Angular decorator. */
2
- export declare enum AngularDecoratorMetaTarget {
3
- Imports = "imports",
4
- Declarations = "declarations",
5
- Providers = "providers",
6
- Exports = "exports",
7
- Schemas = "schemas"
3
+ export interface AngularDecoratorMetaTarget {
4
+ imports?: string[];
5
+ declarations?: string[];
6
+ providers?: string[];
7
+ exports?: string[];
8
+ schemas?: string[];
8
9
  }
@@ -1,12 +1,3 @@
1
1
  "use strict";
2
+ /** TODO: Unify this with `packages/core/types/TemplateDependency.ts` */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AngularDecoratorMetaTarget = void 0;
4
- /** Represents possible meta data members in an Angular decorator. */
5
- var AngularDecoratorMetaTarget;
6
- (function (AngularDecoratorMetaTarget) {
7
- AngularDecoratorMetaTarget["Imports"] = "imports";
8
- AngularDecoratorMetaTarget["Declarations"] = "declarations";
9
- AngularDecoratorMetaTarget["Providers"] = "providers";
10
- AngularDecoratorMetaTarget["Exports"] = "exports";
11
- AngularDecoratorMetaTarget["Schemas"] = "schemas";
12
- })(AngularDecoratorMetaTarget || (exports.AngularDecoratorMetaTarget = AngularDecoratorMetaTarget = {}));