@igniteui/angular-templates 17.2.1322-beta.1 → 18.0.1330-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.
- package/IgniteUIForAngularTemplate.d.ts +2 -2
- package/IgniteUIForAngularTemplate.js +24 -53
- package/igx-ts/dock-manager/default/index.js +3 -0
- package/igx-ts/grid/grid-custom/index.js +2 -2
- package/igx-ts/hierarchical-grid/hierarchical-grid-batch-editing/files/src/app/__path__/__filePrefix__.component.ts +1 -1
- package/igx-ts/hierarchical-grid/hierarchical-grid-custom/index.js +1 -1
- package/igx-ts/projects/_base/files/__dot__vscode/extensions.json +4 -0
- package/igx-ts/projects/_base/files/__dot__vscode/launch.json +20 -0
- package/igx-ts/projects/_base/files/__dot__vscode/tasks.json +42 -0
- package/igx-ts/projects/_base/files/package.json +20 -20
- package/igx-ts/projects/_base/files/public/favicon.ico +0 -0
- package/igx-ts/projects/_base/files/src/main.ts +0 -6
- package/igx-ts/projects/_base/files/tsconfig.json +2 -2
- package/igx-ts-legacy/dock-manager/default/index.js +3 -1
- package/igx-ts-legacy/projects/_base/files/__dot__vscode/extensions.json +4 -0
- package/igx-ts-legacy/projects/_base/files/__dot__vscode/launch.json +20 -0
- package/igx-ts-legacy/projects/_base/files/__dot__vscode/tasks.json +42 -0
- package/igx-ts-legacy/projects/_base/files/package.json +20 -20
- package/igx-ts-legacy/projects/_base/files/src/app/app-routing.module.ts +2 -3
- package/igx-ts-legacy/projects/_base/files/src/main.ts +0 -6
- package/index.d.ts +2 -4
- package/index.js +0 -2
- package/package.json +2 -2
- package/AngularTypeScriptFileUpdate.d.ts +0 -93
- package/AngularTypeScriptFileUpdate.js +0 -296
- package/igx-ts/projects/_base/files/karma.conf.js +0 -44
- package/igx-ts/projects/_base/files/src/app/error-routing/error/global-error-handler.service.ts +0 -23
- package/igx-ts/projects/_base/files/src/environments/environment.prod.ts +0 -3
- package/igx-ts/projects/_base/files/src/environments/environment.ts +0 -16
- package/igx-ts-legacy/projects/_base/files/karma.conf.js +0 -44
- package/igx-ts-legacy/projects/_base/files/src/app/error-routing/error/global-error-handler.service.ts +0 -23
- package/igx-ts-legacy/projects/_base/files/src/app/error-routing/error-routing.module.ts +0 -21
- package/igx-ts-legacy/projects/_base/files/src/environments/environment.prod.ts +0 -3
- package/igx-ts-legacy/projects/_base/files/src/environments/environment.ts +0 -16
- package/igx-ts-legacy/projects/_base/files/src/favicon.ico +0 -0
- package/types/AngularRouteEntry.d.ts +0 -6
- package/types/AngularRouteEntry.js +0 -2
- package/types/AngularRouteLike.d.ts +0 -12
- package/types/AngularRouteLike.js +0 -2
- package/types/enumerations/AngularDecoratorMetaTarget.d.ts +0 -7
- package/types/enumerations/AngularDecoratorMetaTarget.js +0 -11
- package/types/enumerations/AngularRouteTarget.d.ts +0 -10
- package/types/enumerations/AngularRouteTarget.js +0 -14
- package/types/index.d.ts +0 -4
- package/types/index.js +0 -20
- /package/{igx-ts/projects/_base/files/src → igx-ts-legacy/projects/_base/files/public}/favicon.ico +0 -0
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import * as ts from 'typescript';
|
|
2
|
-
import { KeyValuePair, FormatSettings, PropertyAssignment, TemplateDependency, TypeScriptFileUpdate } from '@igniteui/cli-core';
|
|
3
|
-
import { AngularRouteLike } from './types';
|
|
4
|
-
export declare class AngularTypeScriptFileUpdate extends TypeScriptFileUpdate {
|
|
5
|
-
protected targetPath: string;
|
|
6
|
-
private standalone;
|
|
7
|
-
constructor(targetPath: string, standalone?: boolean, formatSettings?: FormatSettings);
|
|
8
|
-
/**
|
|
9
|
-
* Adds a route entry to the Angular routing module's routes variable instance.
|
|
10
|
-
* @param route The route to add.
|
|
11
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
12
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
13
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
14
|
-
* @param anchorElement The anchor element to insert to.
|
|
15
|
-
*/
|
|
16
|
-
addRoute(route: AngularRouteLike, multiline?: boolean, prepend?: boolean, anchorElement?: PropertyAssignment): ts.SourceFile;
|
|
17
|
-
/**
|
|
18
|
-
* Adds a child route to a parent route.
|
|
19
|
-
* @param parentPath The path of the parent route.
|
|
20
|
-
* @param route The child route to add.
|
|
21
|
-
* @param asIdentifier Whether to initialize the {@link RouteTarget.Children} member with an identifier or an array literal.
|
|
22
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
23
|
-
* @param prepend Whether to prepend the new added routes.
|
|
24
|
-
* @param anchorElement The anchor element to insert to.
|
|
25
|
-
* @remarks The `parentPath` is used to determine where the child route should be added.
|
|
26
|
-
*/
|
|
27
|
-
addChildRoute(parentPath: string, route: AngularRouteLike, asIdentifier?: boolean, multiline?: boolean, prepend?: boolean, anchorElement?: PropertyAssignment): ts.SourceFile;
|
|
28
|
-
/** // TODO: update description
|
|
29
|
-
* Adds an import identifier to a standalone component's metadata.
|
|
30
|
-
* @param dep The dependency to add to the standalone component's metadata.
|
|
31
|
-
* @param variables Variables to replace in the dependency strings.
|
|
32
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
33
|
-
*/
|
|
34
|
-
addStandaloneComponentMeta(dep: TemplateDependency, variables?: KeyValuePair<string>, multiline?: boolean): ts.SourceFile;
|
|
35
|
-
/**
|
|
36
|
-
* Adds metadata to an NgModule decorator.
|
|
37
|
-
* @param dep The dependency to add to the NgModule decorator.
|
|
38
|
-
* @param variables Variables to replace in the dependency strings.
|
|
39
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
40
|
-
*/
|
|
41
|
-
addNgModuleMeta(dep: TemplateDependency, variables?: KeyValuePair<string>, multiline?: boolean): ts.SourceFile;
|
|
42
|
-
/**
|
|
43
|
-
* Adds a new not lazy-loaded route entry to the routes array. With a component identifier and path.
|
|
44
|
-
* @param route The route to add.
|
|
45
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
46
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
47
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
48
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
49
|
-
* @param anchorElement The anchor element to insert to.
|
|
50
|
-
*/
|
|
51
|
-
protected addRouteEntry(route: AngularRouteLike, visitCondition: (node: ts.Node) => boolean, multiline: boolean, prepend: boolean, anchorElement: PropertyAssignment): ts.SourceFile;
|
|
52
|
-
/**
|
|
53
|
-
* Adds a new not lazy-loaded route entry to the routes array. With a redirect option.
|
|
54
|
-
* @param route The route to add.
|
|
55
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
56
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
57
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
58
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
59
|
-
* @param anchorElement The anchor element to insert to.
|
|
60
|
-
*/
|
|
61
|
-
protected addRedirectRouteEntry(route: AngularRouteLike, visitCondition: (node: ts.Node) => boolean, multiline: boolean, prepend: boolean, anchorElement: PropertyAssignment): ts.SourceFile;
|
|
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
|
-
/**
|
|
84
|
-
* Adds a new lazy-loaded route entry to the routes array.
|
|
85
|
-
* @param route The route to add.
|
|
86
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
87
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
88
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
89
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
90
|
-
* @param anchorElement The anchor element to insert to.
|
|
91
|
-
*/
|
|
92
|
-
private addLazyLoadedRouteEntry;
|
|
93
|
-
}
|
|
@@ -1,296 +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
|
-
constructor(targetPath, standalone = false, formatSettings) {
|
|
9
|
-
super(targetPath, formatSettings);
|
|
10
|
-
this.targetPath = targetPath;
|
|
11
|
-
this.standalone = standalone;
|
|
12
|
-
}
|
|
13
|
-
//#region Public API
|
|
14
|
-
/**
|
|
15
|
-
* Adds a route entry to the Angular routing module's routes variable instance.
|
|
16
|
-
* @param route The route to add.
|
|
17
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
18
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
19
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
20
|
-
* @param anchorElement The anchor element to insert to.
|
|
21
|
-
*/
|
|
22
|
-
addRoute(route, multiline = false, prepend = true, anchorElement = cli_core_1.ANCHOR_ELEMENT) {
|
|
23
|
-
if (route.lazyload &&
|
|
24
|
-
route.path &&
|
|
25
|
-
route.identifierName &&
|
|
26
|
-
route.modulePath) {
|
|
27
|
-
return this.addLazyLoadedRouteEntry(route, (0, cli_core_1.RoutesVariableAsParentCondition)(this.astTransformer), multiline, prepend, anchorElement);
|
|
28
|
-
}
|
|
29
|
-
return this.addRedirectOrSimpleRouteEntry(route, (0, cli_core_1.RoutesVariableAsParentCondition)(this.astTransformer), multiline, prepend, anchorElement);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Adds a child route to a parent route.
|
|
33
|
-
* @param parentPath The path of the parent route.
|
|
34
|
-
* @param route The child route to add.
|
|
35
|
-
* @param asIdentifier Whether to initialize the {@link RouteTarget.Children} member with an identifier or an array literal.
|
|
36
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
37
|
-
* @param prepend Whether to prepend the new added routes.
|
|
38
|
-
* @param anchorElement The anchor element to insert to.
|
|
39
|
-
* @remarks The `parentPath` is used to determine where the child route should be added.
|
|
40
|
-
*/
|
|
41
|
-
addChildRoute(parentPath, route, asIdentifier = false, multiline = false, prepend = false, anchorElement = cli_core_1.ANCHOR_ELEMENT) {
|
|
42
|
-
if (route.lazyload &&
|
|
43
|
-
route.path &&
|
|
44
|
-
route.identifierName &&
|
|
45
|
-
route.modulePath) {
|
|
46
|
-
return this.addLazyLoadedRouteEntry(route, (0, cli_core_1.PropertyAssignmentWithStringLiteralValueCondition)(cli_core_1.RouteTarget.Path, parentPath), multiline, true, // prepend
|
|
47
|
-
cli_core_1.ANCHOR_ELEMENT);
|
|
48
|
-
}
|
|
49
|
-
return super.addChildRoute(parentPath, route, asIdentifier, multiline, prepend, anchorElement);
|
|
50
|
-
}
|
|
51
|
-
/** // TODO: update description
|
|
52
|
-
* Adds an import identifier to a standalone component's metadata.
|
|
53
|
-
* @param dep The dependency to add to the standalone component's metadata.
|
|
54
|
-
* @param variables Variables to replace in the dependency strings.
|
|
55
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
56
|
-
*/
|
|
57
|
-
addStandaloneComponentMeta(dep, variables, multiline = false) {
|
|
58
|
-
if (!this.standalone || !dep.standalone)
|
|
59
|
-
return this.astTransformer.sourceFile;
|
|
60
|
-
const copy = {
|
|
61
|
-
import: this.asArray(dep.import || [], variables || {}),
|
|
62
|
-
provide: this.asArray(dep.provide || [], variables || {}),
|
|
63
|
-
};
|
|
64
|
-
if (dep.from) {
|
|
65
|
-
// add an import declaration for the dependency
|
|
66
|
-
const uniqueIdentifiers = new Set([
|
|
67
|
-
...copy.import,
|
|
68
|
-
...copy.provide,
|
|
69
|
-
]);
|
|
70
|
-
const identifiers = [...uniqueIdentifiers]
|
|
71
|
-
.filter((name) => !this.astTransformer.importDeclarationCollides({ name }))
|
|
72
|
-
.map((name) => ({ name }));
|
|
73
|
-
this.astTransformer.addImportDeclaration({
|
|
74
|
-
identifiers,
|
|
75
|
-
moduleName: this.applyConfigTransformation(dep.from, variables),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (copy.import.length > 0) {
|
|
79
|
-
return this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
|
|
80
|
-
}
|
|
81
|
-
if (copy.provide.length > 0) {
|
|
82
|
-
return this.mutateNgDecoratorMeta(cli_core_1.NG_SA_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
|
|
83
|
-
}
|
|
84
|
-
return this.astTransformer.sourceFile;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Adds metadata to an NgModule decorator.
|
|
88
|
-
* @param dep The dependency to add to the NgModule decorator.
|
|
89
|
-
* @param variables Variables to replace in the dependency strings.
|
|
90
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
91
|
-
*/
|
|
92
|
-
addNgModuleMeta(dep, variables, multiline = false) {
|
|
93
|
-
if (this.standalone || dep.standalone)
|
|
94
|
-
return this.astTransformer.sourceFile;
|
|
95
|
-
const copy = {
|
|
96
|
-
import: this.asArray(dep.import || [], variables || {}),
|
|
97
|
-
declare: this.asArray(dep.declare || [], variables || {}),
|
|
98
|
-
provide: this.asArray(dep.provide || [], variables || {}),
|
|
99
|
-
export: this.asArray(dep.export || [], variables || {}),
|
|
100
|
-
};
|
|
101
|
-
if (dep.from) {
|
|
102
|
-
// add an import declaration for the dependency
|
|
103
|
-
const uniqueIdentifiers = new Set([
|
|
104
|
-
...copy.import,
|
|
105
|
-
...copy.declare,
|
|
106
|
-
...copy.provide,
|
|
107
|
-
...copy.export,
|
|
108
|
-
]);
|
|
109
|
-
const identifiers = [...uniqueIdentifiers]
|
|
110
|
-
.filter((name) => !this.astTransformer.importDeclarationCollides({ name }))
|
|
111
|
-
.map((name) => ({ name }));
|
|
112
|
-
this.astTransformer.addImportDeclaration({
|
|
113
|
-
identifiers,
|
|
114
|
-
moduleName: this.applyConfigTransformation(dep.from, variables),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
if (dep.root && copy.import.length > 0) {
|
|
118
|
-
// add forRoot to the module
|
|
119
|
-
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));
|
|
120
|
-
}
|
|
121
|
-
if (copy.declare.length > 0) {
|
|
122
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.declare, types_1.AngularDecoratorMetaTarget.Declarations, multiline);
|
|
123
|
-
}
|
|
124
|
-
if (copy.import.length > 0) {
|
|
125
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.import, types_1.AngularDecoratorMetaTarget.Imports, multiline);
|
|
126
|
-
}
|
|
127
|
-
if (copy.provide.length > 0) {
|
|
128
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.provide, types_1.AngularDecoratorMetaTarget.Providers, multiline);
|
|
129
|
-
}
|
|
130
|
-
if (copy.export.length > 0) {
|
|
131
|
-
this.mutateNgDecoratorMeta(cli_core_1.NG_MODULE_DECORATOR_NAME, copy.export, types_1.AngularDecoratorMetaTarget.Exports, multiline);
|
|
132
|
-
}
|
|
133
|
-
return this.astTransformer.sourceFile;
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region Protected Overrides
|
|
137
|
-
/**
|
|
138
|
-
* Adds a new not lazy-loaded route entry to the routes array. With a component identifier and path.
|
|
139
|
-
* @param route The route to add.
|
|
140
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
141
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
142
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
143
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
144
|
-
* @param anchorElement The anchor element to insert to.
|
|
145
|
-
*/
|
|
146
|
-
addRouteEntry(route, visitCondition, multiline = false, prepend = false, anchorElement) {
|
|
147
|
-
if (route.modulePath) {
|
|
148
|
-
// add an import for the given identifier
|
|
149
|
-
const routeIdentifier = { name: route.identifierName };
|
|
150
|
-
if (!this.astTransformer.importDeclarationCollides(routeIdentifier)) {
|
|
151
|
-
// if there is an identifierName, there must be a modulePath as well
|
|
152
|
-
this.astTransformer.addImportDeclaration({
|
|
153
|
-
identifiers: routeIdentifier,
|
|
154
|
-
moduleName: route.modulePath,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const structure = [
|
|
159
|
-
{
|
|
160
|
-
name: cli_core_1.RouteTarget.Path,
|
|
161
|
-
value: ts.factory.createStringLiteral(route.path),
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: cli_core_1.RouteTarget.Component,
|
|
165
|
-
value: ts.factory.createIdentifier(route.identifierName),
|
|
166
|
-
},
|
|
167
|
-
];
|
|
168
|
-
if (route.data) {
|
|
169
|
-
structure.push({
|
|
170
|
-
name: types_1.AngularRouteTarget.Data,
|
|
171
|
-
value: this.astTransformer.createObjectLiteralExpression([route.data], multiline, ts.factory.createStringLiteral),
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
const newRoute = this.astTransformer.createObjectLiteralExpression(structure, multiline);
|
|
175
|
-
return this.astTransformer.addMembersToArrayLiteral(visitCondition, [newRoute], prepend, anchorElement);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Adds a new not lazy-loaded route entry to the routes array. With a redirect option.
|
|
179
|
-
* @param route The route to add.
|
|
180
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
181
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
182
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
183
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
184
|
-
* @param anchorElement The anchor element to insert to.
|
|
185
|
-
*/
|
|
186
|
-
addRedirectRouteEntry(route, visitCondition, multiline = false, prepend = false, anchorElement) {
|
|
187
|
-
const structure = [
|
|
188
|
-
{
|
|
189
|
-
name: cli_core_1.RouteTarget.Path,
|
|
190
|
-
value: ts.factory.createStringLiteral(route.path || ''),
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: types_1.AngularRouteTarget.RedirectTo,
|
|
194
|
-
value: ts.factory.createStringLiteral(route.redirectTo),
|
|
195
|
-
},
|
|
196
|
-
];
|
|
197
|
-
if (route.pathMatch) {
|
|
198
|
-
structure.push({
|
|
199
|
-
name: types_1.AngularRouteTarget.PathMatch,
|
|
200
|
-
value: ts.factory.createStringLiteral(route.pathMatch),
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
const newRoute = this.astTransformer.createObjectLiteralExpression(structure, multiline);
|
|
204
|
-
return this.astTransformer.addMembersToArrayLiteral(visitCondition, [newRoute], prepend, anchorElement);
|
|
205
|
-
}
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region Internals
|
|
208
|
-
/**
|
|
209
|
-
* Updates an Angular decorator's metadata.
|
|
210
|
-
* @param name The name of the decorator to update.
|
|
211
|
-
* @param meta Names of identifiers to be added.
|
|
212
|
-
* @param target The target metadata property to update.
|
|
213
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
214
|
-
*/
|
|
215
|
-
mutateNgDecoratorMeta(name, meta, target, multiline = false) {
|
|
216
|
-
const identifiers = meta.map(ts.factory.createIdentifier);
|
|
217
|
-
const targetMetaProp = this.findNgDecoratorProperty(name, target);
|
|
218
|
-
if (!targetMetaProp) {
|
|
219
|
-
return this.astTransformer.addMemberToObjectLiteral((node) => this.checkNgDecorator(name, node), {
|
|
220
|
-
name: target,
|
|
221
|
-
value: this.astTransformer.createArrayLiteralExpression(identifiers, multiline),
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
if (ts.isArrayLiteralExpression(targetMetaProp.initializer)) {
|
|
225
|
-
// prop assignment of the form { member: [...] }
|
|
226
|
-
// store to avoid second type check due to different context in the filter
|
|
227
|
-
const elementsAsNodeArray = targetMetaProp.initializer.elements;
|
|
228
|
-
const elementsToAdd = identifiers.filter((i) => !elementsAsNodeArray.some((el) => el.getText() === i.text));
|
|
229
|
-
return this.astTransformer.addMembersToArrayLiteral((node) => ts.isPropertyAssignment(node.parent) &&
|
|
230
|
-
node.parent.name.getText() === target &&
|
|
231
|
-
this.checkNgDecorator(name, node), elementsToAdd);
|
|
232
|
-
}
|
|
233
|
-
// prop assignment of the form { member: <some-val> }
|
|
234
|
-
return this.astTransformer.updateObjectLiteralMember((node) => this.checkNgDecorator(name, node), {
|
|
235
|
-
name: target,
|
|
236
|
-
value: this.astTransformer.createArrayLiteralExpression([targetMetaProp.initializer, ...identifiers], multiline),
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Checks if a node has an ancestor with a specific decorator.
|
|
241
|
-
* @param name The name of the decorator.
|
|
242
|
-
* @param node The node to start checking from.
|
|
243
|
-
*/
|
|
244
|
-
checkNgDecorator(name, node) {
|
|
245
|
-
return !!this.astTransformer.findNodeAncestor(node, (node) => {
|
|
246
|
-
var _a;
|
|
247
|
-
return ts.isDecorator(node) &&
|
|
248
|
-
((_a = node.expression.getFirstToken()) === null || _a === void 0 ? void 0 : _a.getText()) === name;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Finds a property assignment that exists in a specific NG decorator meta.
|
|
253
|
-
* @param decoratorName The name of the decorator to check.
|
|
254
|
-
* @param propName The property name to check.
|
|
255
|
-
* @param node The node to start checking from.
|
|
256
|
-
*/
|
|
257
|
-
findNgDecoratorProperty(decoratorName, propName) {
|
|
258
|
-
return this.astTransformer.findPropertyAssignment((node) => node.name.getText() === propName &&
|
|
259
|
-
!!this.astTransformer.findNodeAncestor(node, (node) => {
|
|
260
|
-
var _a;
|
|
261
|
-
return ts.isDecorator(node) &&
|
|
262
|
-
((_a = node.expression.getFirstToken()) === null || _a === void 0 ? void 0 : _a.getText()) === decoratorName;
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Adds a new lazy-loaded route entry to the routes array.
|
|
267
|
-
* @param route The route to add.
|
|
268
|
-
* @param visitCondition The condition used to find the appropriate route node.
|
|
269
|
-
* @param multiline Whether to format the new entry as multiline.
|
|
270
|
-
* @param prepend Whether to insert the new entry before the anchor element.
|
|
271
|
-
* If no anchor is provided, the new entry will be added to the start or end of the array.
|
|
272
|
-
* @param anchorElement The anchor element to insert to.
|
|
273
|
-
*/
|
|
274
|
-
addLazyLoadedRouteEntry(route, visitCondition, multiline = false, prepend = false, anchorElement) {
|
|
275
|
-
const lazyLoadedModule = this.createDynamicImport(route.modulePath, route.identifierName, route.root);
|
|
276
|
-
const propAssignmentName = route.root
|
|
277
|
-
? types_1.AngularRouteTarget.LoadChildren
|
|
278
|
-
: types_1.AngularRouteTarget.LoadComponent;
|
|
279
|
-
const structure = [
|
|
280
|
-
{
|
|
281
|
-
name: cli_core_1.RouteTarget.Path,
|
|
282
|
-
value: ts.factory.createStringLiteral(route.path),
|
|
283
|
-
},
|
|
284
|
-
{ name: propAssignmentName, value: lazyLoadedModule },
|
|
285
|
-
];
|
|
286
|
-
if (route.data) {
|
|
287
|
-
structure.push({
|
|
288
|
-
name: types_1.AngularRouteTarget.Data,
|
|
289
|
-
value: this.astTransformer.createObjectLiteralExpression([route.data], multiline, ts.factory.createStringLiteral),
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
const newRoute = this.astTransformer.createObjectLiteralExpression(structure, multiline);
|
|
293
|
-
return this.astTransformer.addMembersToArrayLiteral(visitCondition, [newRoute], prepend, anchorElement);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.AngularTypeScriptFileUpdate = AngularTypeScriptFileUpdate;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, './coverage/<%=dashName%>'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: true,
|
|
40
|
-
browsers: ['Chrome'],
|
|
41
|
-
singleRun: false,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
package/igx-ts/projects/_base/files/src/app/error-routing/error/global-error-handler.service.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ErrorHandler, Injectable, Injector, NgZone } from '@angular/core';
|
|
2
|
-
import { Router } from '@angular/router';
|
|
3
|
-
|
|
4
|
-
@Injectable()
|
|
5
|
-
export class GlobalErrorHandlerService implements ErrorHandler {
|
|
6
|
-
|
|
7
|
-
constructor(private injector: Injector, private zone: NgZone) { }
|
|
8
|
-
|
|
9
|
-
handleError(error: any) {
|
|
10
|
-
// handle and/or log error, for example:
|
|
11
|
-
console.error(error);
|
|
12
|
-
|
|
13
|
-
// show error page
|
|
14
|
-
const router = this.injector.get(Router);
|
|
15
|
-
if (router) {
|
|
16
|
-
this.zone.run(() => {
|
|
17
|
-
router
|
|
18
|
-
.navigate(['error'])
|
|
19
|
-
.catch((err: any) => console.error(err));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
-
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
-
// The list of file replacements can be found in `angular.json`.
|
|
4
|
-
|
|
5
|
-
export const environment = {
|
|
6
|
-
production: false
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* For easier debugging in development mode, you can import the following file
|
|
11
|
-
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
12
|
-
*
|
|
13
|
-
* This import should be commented out in production mode because it will have a negative impact
|
|
14
|
-
* on performance if an error is thrown.
|
|
15
|
-
*/
|
|
16
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, './coverage/<%=dashName%>'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: true,
|
|
40
|
-
browsers: ['Chrome'],
|
|
41
|
-
singleRun: false,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ErrorHandler, Injectable, Injector, NgZone } from '@angular/core';
|
|
2
|
-
import { Router } from '@angular/router';
|
|
3
|
-
|
|
4
|
-
@Injectable()
|
|
5
|
-
export class GlobalErrorHandlerService implements ErrorHandler {
|
|
6
|
-
|
|
7
|
-
constructor(private injector: Injector, private zone: NgZone) { }
|
|
8
|
-
|
|
9
|
-
handleError(error: any) {
|
|
10
|
-
// handle and/or log error, for example:
|
|
11
|
-
console.error(error);
|
|
12
|
-
|
|
13
|
-
// show error page
|
|
14
|
-
const router = this.injector.get(Router);
|
|
15
|
-
if (router) {
|
|
16
|
-
this.zone.run(() => {
|
|
17
|
-
router
|
|
18
|
-
.navigate(['error'])
|
|
19
|
-
.catch((err: any) => console.error(err));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ErrorHandler, NgModule, Provider } from '@angular/core';
|
|
2
|
-
import { environment } from '../../environments/environment';
|
|
3
|
-
import { GlobalErrorHandlerService } from './error/global-error-handler.service';
|
|
4
|
-
import { UncaughtErrorComponent } from './error/uncaught-error.component';
|
|
5
|
-
import { PageNotFoundComponent } from './not-found/not-found.component';
|
|
6
|
-
|
|
7
|
-
const providers: Provider[] = [];
|
|
8
|
-
|
|
9
|
-
if (environment.production) {
|
|
10
|
-
// register prod error handler
|
|
11
|
-
providers.push({ provide: ErrorHandler, useClass: GlobalErrorHandlerService });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@NgModule({
|
|
15
|
-
declarations: [
|
|
16
|
-
PageNotFoundComponent,
|
|
17
|
-
UncaughtErrorComponent
|
|
18
|
-
],
|
|
19
|
-
providers
|
|
20
|
-
})
|
|
21
|
-
export class ErrorRoutingModule { }
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
-
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
-
// The list of file replacements can be found in `angular.json`.
|
|
4
|
-
|
|
5
|
-
export const environment = {
|
|
6
|
-
production: false
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* For easier debugging in development mode, you can import the following file
|
|
11
|
-
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
12
|
-
*
|
|
13
|
-
* This import should be commented out in production mode because it will have a negative impact
|
|
14
|
-
* on performance if an error is thrown.
|
|
15
|
-
*/
|
|
16
|
-
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
Binary file
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { RouteEntry, RouteTarget } from "@igniteui/cli-core";
|
|
2
|
-
import { AngularRouteTarget } from "./enumerations/AngularRouteTarget";
|
|
3
|
-
/** Represents an Angular route entry in a routes collection. */
|
|
4
|
-
export interface AngularRouteEntry extends Pick<RouteEntry, "value"> {
|
|
5
|
-
name: RouteTarget | AngularRouteTarget;
|
|
6
|
-
}
|
|
@@ -1,12 +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
|
-
/** An array of child `Route` objects that specifies a nested route configuration. */
|
|
11
|
-
children?: AngularRouteLike | AngularRouteLike[];
|
|
12
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
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 || (exports.AngularDecoratorMetaTarget = AngularDecoratorMetaTarget = {}));
|
|
@@ -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
|
-
}
|