@igniteui/angular-templates 18.1.1341 → 18.1.1400-beta.2
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/AngularTypeScriptFileUpdate.d.ts +83 -0
- package/AngularTypeScriptFileUpdate.js +269 -0
- package/IgniteUIForAngularTemplate.d.ts +2 -2
- package/IgniteUIForAngularTemplate.js +40 -24
- package/igx-ts/dock-manager/default/index.js +0 -3
- package/igx-ts/grid/grid-custom/index.js +2 -2
- package/igx-ts/hierarchical-grid/hierarchical-grid-custom/index.js +1 -1
- package/igx-ts/projects/_base/files/src/app/app.config.ts +8 -16
- package/igx-ts/projects/_base_with_home/files/src/app/app.config.ts +7 -5
- package/igx-ts/projects/empty/files/src/app/app.config.ts +7 -5
- package/igx-ts/projects/side-nav/files/src/app/app.config.ts +19 -19
- package/igx-ts/projects/side-nav-auth/files/src/app/app.config.ts +21 -21
- package/igx-ts-legacy/dock-manager/default/index.js +1 -3
- package/igx-ts-legacy/projects/_base/files/src/app/app-routing.module.ts +1 -1
- package/igx-ts-legacy/projects/_base_with_home/files/src/app/app-routing.module.ts +1 -1
- package/igx-ts-legacy/projects/empty/files/src/app/app-routing.module.ts +1 -1
- package/index.d.ts +4 -2
- package/index.js +2 -0
- package/package.json +2 -2
- package/types/AngularRouteEntry.d.ts +6 -0
- package/types/AngularRouteEntry.js +2 -0
- package/types/AngularRouteLike.d.ts +10 -0
- package/types/AngularRouteLike.js +2 -0
- package/types/enumerations/AngularDecoratorMetaTarget.d.ts +9 -0
- package/types/enumerations/AngularDecoratorMetaTarget.js +3 -0
- package/types/enumerations/AngularRouteTarget.d.ts +10 -0
- package/types/enumerations/AngularRouteTarget.js +14 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +20 -0
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
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.values(meta).flat());
|
|
201
|
+
const identifiers = [...uniqueIdentifiers].map((name) => ({ name }));
|
|
202
|
+
this.astTransformer.requestNewImportDeclaration({
|
|
203
|
+
identifiers,
|
|
204
|
+
moduleName: this.applyConfigTransformation(moduleName, variables),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Applies mutations to an Angular decorator's metadata.
|
|
209
|
+
* @param decoratorName The name of the decorator to update.
|
|
210
|
+
* @param meta The metadata to use for the mutations.
|
|
211
|
+
* @param multiline Whether to format the new entry as multiline.
|
|
212
|
+
*/
|
|
213
|
+
applyDecoratorMutations(decoratorName, meta, multiline = false) {
|
|
214
|
+
for (const key of Object.keys(meta)) {
|
|
215
|
+
if (meta[key].length > 0) {
|
|
216
|
+
this.mutateNgDecoratorMeta(decoratorName, meta[key], key, multiline);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Updates an Angular decorator's metadata.
|
|
222
|
+
* @param name The name of the decorator to update.
|
|
223
|
+
* @param meta Names of identifiers to be added.
|
|
224
|
+
* @param target The target metadata property to update.
|
|
225
|
+
* @param multiline Whether to format the new entry as multiline.
|
|
226
|
+
*/
|
|
227
|
+
mutateNgDecoratorMeta(name, meta, target, multiline = false) {
|
|
228
|
+
const identifiers = meta.map(ts.factory.createIdentifier);
|
|
229
|
+
const targetMetaProp = this.findNgDecoratorProperty(name, target);
|
|
230
|
+
const value = targetMetaProp && !ts.isArrayLiteralExpression(targetMetaProp.initializer)
|
|
231
|
+
? [targetMetaProp.initializer, ...identifiers]
|
|
232
|
+
: identifiers;
|
|
233
|
+
this.astTransformer.requestNewMemberInObjectLiteral((node) => this.checkNgDecorator(name, node), target, this.astTransformer.createArrayLiteralExpression(value, multiline), multiline);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Checks if a node has an ancestor with a specific decorator.
|
|
237
|
+
* @param name The name of the decorator.
|
|
238
|
+
* @param node The node to start checking from.
|
|
239
|
+
*/
|
|
240
|
+
checkNgDecorator(name, node) {
|
|
241
|
+
const getNodeExpressionTokenName = (node) => {
|
|
242
|
+
const nodeExpression = ts.isDecorator(node) &&
|
|
243
|
+
ts.isCallExpression(node.expression) &&
|
|
244
|
+
node.expression;
|
|
245
|
+
const token = nodeExpression &&
|
|
246
|
+
ts.isIdentifier(nodeExpression.expression) &&
|
|
247
|
+
nodeExpression.expression;
|
|
248
|
+
return ts.isIdentifier(token) && token.text;
|
|
249
|
+
};
|
|
250
|
+
return !!this.astTransformer.findNodeAncestor(node, (node) => getNodeExpressionTokenName(node) === name);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Finds a property assignment that exists in a specific NG decorator meta.
|
|
254
|
+
* @param decoratorName The name of the decorator to check.
|
|
255
|
+
* @param propName The property name to check.
|
|
256
|
+
* @param node The node to start checking from.
|
|
257
|
+
*/
|
|
258
|
+
findNgDecoratorProperty(decoratorName, propName) {
|
|
259
|
+
const ngDecoratorExists = (node) => !!this.astTransformer.findNodeAncestor(node, (node) => {
|
|
260
|
+
const nodeExpressionToken = ts.isDecorator(node) && node.expression.getFirstToken();
|
|
261
|
+
return (ts.isIdentifier(nodeExpressionToken) &&
|
|
262
|
+
nodeExpressionToken.text === decoratorName);
|
|
263
|
+
});
|
|
264
|
+
return this.astTransformer.findPropertyAssignment((node) => ts.isIdentifier(node.name) &&
|
|
265
|
+
node.name.text === propName &&
|
|
266
|
+
ngDecoratorExists(node));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
exports.AngularTypeScriptFileUpdate = AngularTypeScriptFileUpdate;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AddTemplateArgs, ControlExtraConfiguration, Template, TemplateDependency
|
|
1
|
+
import { AddTemplateArgs, ControlExtraConfiguration, Template, TemplateDependency } 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;
|
|
7
8
|
listInCustomTemplates: boolean;
|
|
8
9
|
id: string;
|
|
9
10
|
name: string;
|
|
@@ -32,7 +33,6 @@ export declare class IgniteUIForAngularTemplate implements Template {
|
|
|
32
33
|
getExtraConfiguration(): ControlExtraConfiguration[];
|
|
33
34
|
setExtraConfiguration(extraConfigKeys: {}): void;
|
|
34
35
|
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,6 +10,7 @@ class IgniteUIForAngularTemplate {
|
|
|
10
10
|
constructor(rootPath) {
|
|
11
11
|
this.rootPath = rootPath;
|
|
12
12
|
this.listInComponentTemplates = true;
|
|
13
|
+
this.addAsNgModelDeclaration = true;
|
|
13
14
|
this.listInCustomTemplates = false;
|
|
14
15
|
this.framework = "angular";
|
|
15
16
|
this.projectType = "igx-ts";
|
|
@@ -46,30 +47,36 @@ class IgniteUIForAngularTemplate {
|
|
|
46
47
|
// tslint:disable-next-line:variable-name
|
|
47
48
|
const TsUpdate =
|
|
48
49
|
// tslint:disable-next-line:no-submodule-imports
|
|
49
|
-
require("@igniteui/
|
|
50
|
-
// standalone components
|
|
50
|
+
require("@igniteui/angular-templates").AngularTypeScriptFileUpdate;
|
|
51
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`;
|
|
56
|
+
// standalone components
|
|
52
57
|
if (!this.fileExists(mainModulePath)) {
|
|
53
58
|
const appRoutesPath = "src/app/app.routes.ts";
|
|
54
|
-
const folderName = this.folderName(name);
|
|
55
|
-
const fileName = this.fileName(name);
|
|
56
59
|
if (!(options && options.skipRoute) && this.fileExists(appRoutesPath)) {
|
|
57
|
-
const
|
|
58
|
-
rountesConfig
|
|
59
|
-
|
|
60
|
-
|
|
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();
|
|
61
69
|
}
|
|
62
|
-
const componentFile = new TsUpdate(
|
|
70
|
+
const componentFile = new TsUpdate(componentFilePath, true, { indentSize: 2, singleQuotes: true });
|
|
63
71
|
for (const dep of this.dependencies) {
|
|
64
72
|
if (dep.from && dep.from.startsWith(".")) {
|
|
65
73
|
// relative file dependency
|
|
66
74
|
const copy = Object.assign({}, dep);
|
|
67
|
-
copy.from = cli_core_1.Util.relativePath(
|
|
68
|
-
|
|
69
|
-
componentFile.addStandaloneImport(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
|
|
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));
|
|
70
77
|
continue;
|
|
71
78
|
}
|
|
72
|
-
componentFile.
|
|
79
|
+
componentFile.addStandaloneComponentMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content));
|
|
73
80
|
}
|
|
74
81
|
componentFile.finalize();
|
|
75
82
|
return;
|
|
@@ -79,25 +86,37 @@ class IgniteUIForAngularTemplate {
|
|
|
79
86
|
//1) import the component class name,
|
|
80
87
|
//2) and populate the Routes array with the path and component
|
|
81
88
|
//for example: { path: 'combo', component: ComboComponent }
|
|
82
|
-
const
|
|
83
|
-
routingModule
|
|
84
|
-
|
|
85
|
-
|
|
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();
|
|
86
98
|
}
|
|
87
99
|
//3) add an import of the component class from its file location.
|
|
88
100
|
//4) populate the declarations portion of the @NgModule with the component class name.
|
|
89
|
-
const mainModule = new TsUpdate(mainModulePath);
|
|
90
|
-
|
|
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
|
+
);
|
|
91
108
|
// import IgxModules and other dependencies
|
|
92
109
|
for (const dep of this.dependencies) {
|
|
93
110
|
if (dep.from && dep.from.startsWith(".")) {
|
|
94
111
|
// relative file dependency
|
|
95
112
|
const copy = Object.assign({}, dep);
|
|
96
113
|
copy.from = cli_core_1.Util.relativePath(mainModulePath, path.join(projectPath, copy.from), true, true);
|
|
97
|
-
mainModule.addNgModuleMeta(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content)
|
|
114
|
+
mainModule.addNgModuleMeta(copy, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content), true // multiline
|
|
115
|
+
);
|
|
98
116
|
}
|
|
99
117
|
else {
|
|
100
|
-
mainModule.addNgModuleMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content)
|
|
118
|
+
mainModule.addNgModuleMeta(dep, cli_core_1.Util.applyDelimiters(this.getBaseVariables(name), this.delimiters.content), true // multiline
|
|
119
|
+
);
|
|
101
120
|
}
|
|
102
121
|
}
|
|
103
122
|
mainModule.finalize();
|
|
@@ -109,9 +128,6 @@ class IgniteUIForAngularTemplate {
|
|
|
109
128
|
fileExists(filePath) {
|
|
110
129
|
return cli_core_1.App.container.get(cli_core_1.FS_TOKEN).fileExists(filePath);
|
|
111
130
|
}
|
|
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
|
-
}
|
|
115
131
|
getBaseVariables(name) {
|
|
116
132
|
const config = {};
|
|
117
133
|
config["name"] = cli_core_1.Util.nameFromPath(name);
|
|
@@ -15,8 +15,5 @@ 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
|
-
}
|
|
21
18
|
}
|
|
22
19
|
module.exports = new IgcDockManagerTemplate();
|
|
@@ -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" });
|
|
98
|
+
this.dependencies.push({ import: "FormsModule", from: "@angular/forms", standalone: true });
|
|
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%>" });
|
|
110
|
+
this.dependencies.push({ import: "IgxDatePickerComponent", from: "<%=igxPackage%>", standalone: true });
|
|
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" });
|
|
114
|
+
this.dependencies.push({ import: "FormsModule", from: "@angular/forms", standalone: true });
|
|
115
115
|
break;
|
|
116
116
|
case "Row Selection":
|
|
117
117
|
const gridFeatureText = `rowSelection="multiple"`;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { ApplicationConfig, ErrorHandler, Provider, importProvidersFrom } from '@angular/core';
|
|
2
|
-
import { provideRouter
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { BrowserModule, HammerModule } from '@angular/platform-browser';
|
|
4
4
|
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
5
|
-
import {
|
|
6
|
-
IgxNavigationDrawerModule,
|
|
7
|
-
IgxNavbarModule,
|
|
8
|
-
IgxLayoutModule,
|
|
9
|
-
IgxRippleModule,
|
|
10
|
-
} from 'igniteui-angular';
|
|
11
5
|
|
|
12
6
|
import { routes } from './app.routes';
|
|
13
7
|
import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
|
|
14
8
|
import { environment } from '../environments/environment';
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }
|
|
24
|
-
]
|
|
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()
|
|
25
17
|
];
|
|
26
18
|
|
|
27
19
|
if (environment.production) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { ApplicationConfig } from '@angular/core';
|
|
2
|
-
import { provideRouter
|
|
1
|
+
import { ApplicationConfig, Provider } from '@angular/core';
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
3
|
|
|
4
4
|
import { routes } from './app.routes';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
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';
|
|
2
|
-
import { provideRouter
|
|
1
|
+
import { ApplicationConfig, Provider } from '@angular/core';
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
3
|
|
|
4
4
|
import { routes } from './app.routes';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const providers: Provider = [
|
|
7
|
+
provideRouter(routes)
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const appConfig: ApplicationConfig = { providers };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
|
2
|
-
import { provideRouter
|
|
1
|
+
import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { BrowserModule, HammerModule } from '@angular/platform-browser';
|
|
4
4
|
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
5
5
|
import {
|
|
@@ -11,20 +11,20 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import { routes } from './app.routes';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
|
2
|
-
import { provideRouter
|
|
1
|
+
import { ApplicationConfig, Provider, importProvidersFrom } from '@angular/core';
|
|
2
|
+
import { provideRouter } from '@angular/router';
|
|
3
3
|
import { BrowserModule, HammerModule } from '@angular/platform-browser';
|
|
4
4
|
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
5
5
|
import {
|
|
@@ -12,22 +12,22 @@ import {
|
|
|
12
12
|
import { AuthenticationModule, ExternalAuthService } from './authentication';
|
|
13
13
|
import { routes } from './app.routes';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 };
|
|
@@ -8,6 +8,7 @@ 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;
|
|
11
12
|
this.id = "dock-manager";
|
|
12
13
|
this.projectType = "igx-ts";
|
|
13
14
|
this.name = "Dock Manager";
|
|
@@ -18,8 +19,5 @@ class IgcDockManagerTemplate extends IgniteUIForAngularTemplate_1.IgniteUIForAng
|
|
|
18
19
|
// "igniteui-dockmanager@~1.0.0":
|
|
19
20
|
this.packages = [`${(0, cli_core_1.resolvePackage)(cli_core_1.NPM_DOCK_MANAGER)}@~1.8.0`];
|
|
20
21
|
}
|
|
21
|
-
addClassDeclaration(mainModule, projPath, name, modulePath) {
|
|
22
|
-
// not applicable with custom module
|
|
23
|
-
}
|
|
24
22
|
}
|
|
25
23
|
module.exports = new IgcDockManagerTemplate();
|
|
@@ -11,7 +11,7 @@ export const routes: Routes = [
|
|
|
11
11
|
];
|
|
12
12
|
|
|
13
13
|
@NgModule({
|
|
14
|
-
imports: [RouterModule.forRoot(routes
|
|
14
|
+
imports: [RouterModule.forRoot(routes), ErrorRoutingModule],
|
|
15
15
|
exports: [RouterModule, ErrorRoutingModule]
|
|
16
16
|
})
|
|
17
17
|
export class AppRoutingModule { }
|
|
@@ -14,7 +14,7 @@ export const routes: Routes = [
|
|
|
14
14
|
];
|
|
15
15
|
|
|
16
16
|
@NgModule({
|
|
17
|
-
imports: [RouterModule.forRoot(routes
|
|
17
|
+
imports: [RouterModule.forRoot(routes), ErrorRoutingModule],
|
|
18
18
|
exports: [RouterModule, ErrorRoutingModule]
|
|
19
19
|
})
|
|
20
20
|
export class AppRoutingModule { }
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import * as standalone from
|
|
2
|
-
export * from
|
|
1
|
+
import * as standalone from './igx-ts';
|
|
2
|
+
export * from './IgniteUIForAngularTemplate';
|
|
3
|
+
export * from './AngularTypeScriptFileUpdate';
|
|
4
|
+
export * from './types';
|
|
3
5
|
declare const _default: (typeof standalone)[];
|
|
4
6
|
export default _default;
|
package/index.js
CHANGED
|
@@ -17,4 +17,6 @@ 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);
|
|
20
22
|
exports.default = [standalone, legacy];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igniteui/angular-templates",
|
|
3
|
-
"version": "18.1.
|
|
3
|
+
"version": "18.1.1400-beta.2",
|
|
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": "~
|
|
15
|
+
"@igniteui/cli-core": "~14.0.0-beta.2",
|
|
16
16
|
"typescript": "~5.4.3"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
ADDED
package/types/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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);
|