@skyux/packages 12.34.0 → 12.35.0
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/collection.json +5 -0
- package/package.json +57 -57
- package/src/schematics/migrations/migration-collection.json +1 -1
- package/src/schematics/ng-generate/convert-definition-list-to-description-list/convert-definition-list-to-description-list.schematic.js +3 -3
- package/src/schematics/ng-generate/convert-definition-list-to-description-list/convert-definition-list-to-description-list.schematic.js.map +1 -1
- package/src/schematics/ng-generate/convert-page-summary-to-page-header/convert-page-summary-to-page-header.schematic.js +3 -3
- package/src/schematics/ng-generate/convert-page-summary-to-page-header/convert-page-summary-to-page-header.schematic.js.map +1 -1
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.schematic.d.ts +8 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.schematic.js +15 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.schematic.js.map +1 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.d.ts +9 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.js +3 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.js.map +1 -0
- package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.json +16 -0
- package/src/schematics/rules/convert-definition-list-to-description-list/convert-definition-list-to-description-list.js +3 -3
- package/src/schematics/rules/convert-definition-list-to-description-list/convert-definition-list-to-description-list.js.map +1 -1
- package/src/schematics/rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header.js +31 -12
- package/src/schematics/rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header.js.map +1 -1
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.d.ts +3 -0
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.js +305 -0
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.js.map +1 -0
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/options.d.ts +6 -0
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/options.js +3 -0
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/options.js.map +1 -0
- package/src/schematics/testing/angular-module-generator.d.ts +5 -0
- package/src/schematics/testing/angular-module-generator.js +15 -0
- package/src/schematics/testing/angular-module-generator.js.map +1 -0
- package/src/schematics/utility/typescript/ng-ast.d.ts +14 -1
- package/src/schematics/utility/typescript/ng-ast.js +138 -66
- package/src/schematics/utility/typescript/ng-ast.js.map +1 -1
- package/src/version.js +1 -1
package/collection.json
CHANGED
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"factory": "./src/schematics/ng-generate/convert-page-summary-to-page-header/convert-page-summary-to-page-header.schematic",
|
|
27
27
|
"schema": "./src/schematics/ng-generate/convert-page-summary-to-page-header/schema.json"
|
|
28
28
|
},
|
|
29
|
+
"convert-progress-indicator-wizard-to-tab-wizard": {
|
|
30
|
+
"description": "Convert <sky-progress-indicator> components using wizard to use <sky-tabset> components.",
|
|
31
|
+
"factory": "./src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.schematic",
|
|
32
|
+
"schema": "./src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.json"
|
|
33
|
+
},
|
|
29
34
|
"polyfills": {
|
|
30
35
|
"description": "Add @skyux/packages/polyfills to project config.",
|
|
31
36
|
"factory": "./src/schematics/ng-generate/polyfills/polyfills.schematic",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyux/packages",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.35.0",
|
|
4
4
|
"author": "Blackbaud, Inc.",
|
|
5
5
|
"description": "Handles the `ng update` command for SKY UX component libraries.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,68 +35,68 @@
|
|
|
35
35
|
"ng-update": {
|
|
36
36
|
"migrations": "./src/schematics/migrations/migration-collection.json",
|
|
37
37
|
"packageGroup": {
|
|
38
|
-
"@skyux/packages": "12.
|
|
38
|
+
"@skyux/packages": "12.35.0",
|
|
39
39
|
"@blackbaud/angular-tree-component": "^1.0.0",
|
|
40
|
-
"@skyux-sdk/eslint-config": "12.
|
|
41
|
-
"@skyux-sdk/eslint-schematics": "12.
|
|
42
|
-
"@skyux-sdk/prettier-schematics": "12.
|
|
43
|
-
"@skyux-sdk/stylelint-schematics": "12.
|
|
44
|
-
"@skyux-sdk/testing": "12.
|
|
45
|
-
"@skyux/a11y": "12.
|
|
46
|
-
"@skyux/action-bars": "12.
|
|
47
|
-
"@skyux/ag-grid": "12.
|
|
48
|
-
"@skyux/angular-tree-component": "12.
|
|
49
|
-
"@skyux/animations": "12.
|
|
50
|
-
"@skyux/assets": "12.
|
|
51
|
-
"@skyux/autonumeric": "12.
|
|
52
|
-
"@skyux/avatar": "12.
|
|
53
|
-
"@skyux/code-examples": "12.
|
|
54
|
-
"@skyux/colorpicker": "12.
|
|
55
|
-
"@skyux/config": "12.
|
|
56
|
-
"@skyux/core": "12.
|
|
57
|
-
"@skyux/data-manager": "12.
|
|
58
|
-
"@skyux/datetime": "12.
|
|
59
|
-
"@skyux/docs-tools": "12.
|
|
60
|
-
"@skyux/errors": "12.
|
|
61
|
-
"@skyux/flyout": "12.
|
|
62
|
-
"@skyux/forms": "12.
|
|
63
|
-
"@skyux/grids": "12.
|
|
64
|
-
"@skyux/help-inline": "12.
|
|
65
|
-
"@skyux/i18n": "12.
|
|
66
|
-
"@skyux/icon": "12.
|
|
40
|
+
"@skyux-sdk/eslint-config": "12.35.0",
|
|
41
|
+
"@skyux-sdk/eslint-schematics": "12.35.0",
|
|
42
|
+
"@skyux-sdk/prettier-schematics": "12.35.0",
|
|
43
|
+
"@skyux-sdk/stylelint-schematics": "12.35.0",
|
|
44
|
+
"@skyux-sdk/testing": "12.35.0",
|
|
45
|
+
"@skyux/a11y": "12.35.0",
|
|
46
|
+
"@skyux/action-bars": "12.35.0",
|
|
47
|
+
"@skyux/ag-grid": "12.35.0",
|
|
48
|
+
"@skyux/angular-tree-component": "12.35.0",
|
|
49
|
+
"@skyux/animations": "12.35.0",
|
|
50
|
+
"@skyux/assets": "12.35.0",
|
|
51
|
+
"@skyux/autonumeric": "12.35.0",
|
|
52
|
+
"@skyux/avatar": "12.35.0",
|
|
53
|
+
"@skyux/code-examples": "12.35.0",
|
|
54
|
+
"@skyux/colorpicker": "12.35.0",
|
|
55
|
+
"@skyux/config": "12.35.0",
|
|
56
|
+
"@skyux/core": "12.35.0",
|
|
57
|
+
"@skyux/data-manager": "12.35.0",
|
|
58
|
+
"@skyux/datetime": "12.35.0",
|
|
59
|
+
"@skyux/docs-tools": "12.35.0",
|
|
60
|
+
"@skyux/errors": "12.35.0",
|
|
61
|
+
"@skyux/flyout": "12.35.0",
|
|
62
|
+
"@skyux/forms": "12.35.0",
|
|
63
|
+
"@skyux/grids": "12.35.0",
|
|
64
|
+
"@skyux/help-inline": "12.35.0",
|
|
65
|
+
"@skyux/i18n": "12.35.0",
|
|
66
|
+
"@skyux/icon": "12.35.0",
|
|
67
67
|
"@skyux/icons": "^9.0.0",
|
|
68
|
-
"@skyux/indicators": "12.
|
|
69
|
-
"@skyux/inline-form": "12.
|
|
70
|
-
"@skyux/layout": "12.
|
|
71
|
-
"@skyux/list-builder": "12.
|
|
72
|
-
"@skyux/list-builder-common": "12.
|
|
73
|
-
"@skyux/list-builder-view-checklist": "12.
|
|
74
|
-
"@skyux/list-builder-view-grids": "12.
|
|
75
|
-
"@skyux/lists": "12.
|
|
76
|
-
"@skyux/lookup": "12.
|
|
77
|
-
"@skyux/manifest": "12.
|
|
78
|
-
"@skyux/modals": "12.
|
|
79
|
-
"@skyux/navbar": "12.
|
|
80
|
-
"@skyux/pages": "12.
|
|
81
|
-
"@skyux/phone-field": "12.
|
|
82
|
-
"@skyux/popovers": "12.
|
|
83
|
-
"@skyux/progress-indicator": "12.
|
|
84
|
-
"@skyux/router": "12.
|
|
85
|
-
"@skyux/select-field": "12.
|
|
86
|
-
"@skyux/split-view": "12.
|
|
87
|
-
"@skyux/tabs": "12.
|
|
88
|
-
"@skyux/text-editor": "12.
|
|
89
|
-
"@skyux/theme": "12.
|
|
90
|
-
"@skyux/tiles": "12.
|
|
91
|
-
"@skyux/toast": "12.
|
|
92
|
-
"@skyux/validation": "12.
|
|
68
|
+
"@skyux/indicators": "12.35.0",
|
|
69
|
+
"@skyux/inline-form": "12.35.0",
|
|
70
|
+
"@skyux/layout": "12.35.0",
|
|
71
|
+
"@skyux/list-builder": "12.35.0",
|
|
72
|
+
"@skyux/list-builder-common": "12.35.0",
|
|
73
|
+
"@skyux/list-builder-view-checklist": "12.35.0",
|
|
74
|
+
"@skyux/list-builder-view-grids": "12.35.0",
|
|
75
|
+
"@skyux/lists": "12.35.0",
|
|
76
|
+
"@skyux/lookup": "12.35.0",
|
|
77
|
+
"@skyux/manifest": "12.35.0",
|
|
78
|
+
"@skyux/modals": "12.35.0",
|
|
79
|
+
"@skyux/navbar": "12.35.0",
|
|
80
|
+
"@skyux/pages": "12.35.0",
|
|
81
|
+
"@skyux/phone-field": "12.35.0",
|
|
82
|
+
"@skyux/popovers": "12.35.0",
|
|
83
|
+
"@skyux/progress-indicator": "12.35.0",
|
|
84
|
+
"@skyux/router": "12.35.0",
|
|
85
|
+
"@skyux/select-field": "12.35.0",
|
|
86
|
+
"@skyux/split-view": "12.35.0",
|
|
87
|
+
"@skyux/tabs": "12.35.0",
|
|
88
|
+
"@skyux/text-editor": "12.35.0",
|
|
89
|
+
"@skyux/theme": "12.35.0",
|
|
90
|
+
"@skyux/tiles": "12.35.0",
|
|
91
|
+
"@skyux/toast": "12.35.0",
|
|
92
|
+
"@skyux/validation": "12.35.0",
|
|
93
93
|
"ag-grid-angular": "^33.3.2",
|
|
94
94
|
"ag-grid-community": "^33.3.2",
|
|
95
95
|
"ag-grid-enterprise": "^32.1.0",
|
|
96
96
|
"autonumeric": "^4.10.5",
|
|
97
|
-
"eslint-config-skyux": "12.
|
|
98
|
-
"skyux-stylelint": "12.
|
|
99
|
-
"stylelint-config-skyux": "12.
|
|
97
|
+
"eslint-config-skyux": "12.35.0",
|
|
98
|
+
"skyux-stylelint": "12.35.0",
|
|
99
|
+
"stylelint-config-skyux": "12.35.0"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = convertDefinitionListToDescriptionListSchematic;
|
|
4
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
4
5
|
const convert_definition_list_to_description_list_1 = require("../../rules/convert-definition-list-to-description-list/convert-definition-list-to-description-list");
|
|
5
|
-
const workspace_1 = require("../../utility/workspace");
|
|
6
6
|
/**
|
|
7
7
|
* Converts `<sky-definition-list>` to `<sky-description-list>`.
|
|
8
8
|
*/
|
|
9
9
|
function convertDefinitionListToDescriptionListSchematic(options) {
|
|
10
10
|
return async (tree) => {
|
|
11
|
-
const
|
|
12
|
-
return (0, convert_definition_list_to_description_list_1.convertDefinitionListToDescriptionList)(
|
|
11
|
+
const projectRoot = await (0, utility_1.readWorkspace)(tree).then(({ projects }) => projects.get(`${options.project}`)?.root ?? '');
|
|
12
|
+
return (0, convert_definition_list_to_description_list_1.convertDefinitionListToDescriptionList)(projectRoot);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=convert-definition-list-to-description-list.schematic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-definition-list-to-description-list.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-definition-list-to-description-list/convert-definition-list-to-description-list.schematic.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"convert-definition-list-to-description-list.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-definition-list-to-description-list/convert-definition-list-to-description-list.schematic.ts"],"names":[],"mappings":";;AAUA,kEAUC;AAnBD,yDAA4D;AAE5D,qKAA6J;AAI7J;;GAEG;AACH,SAAwB,+CAA+C,CACrE,OAAe;IAEf,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,WAAW,GAAG,MAAM,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,IAAI,CAChD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,IAAI,EAAE,CACjE,CAAC;QAEF,OAAO,IAAA,oFAAsC,EAAC,WAAW,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = convertPageSummaryToPageHeaderSchematic;
|
|
4
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
4
5
|
const convert_page_summary_to_page_header_1 = require("../../rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header");
|
|
5
|
-
const workspace_1 = require("../../utility/workspace");
|
|
6
6
|
/**
|
|
7
7
|
* Converts `<sky-definition-list>` to `<sky-description-list>`.
|
|
8
8
|
*/
|
|
9
9
|
function convertPageSummaryToPageHeaderSchematic(options) {
|
|
10
10
|
return async (tree) => {
|
|
11
|
-
const
|
|
12
|
-
return (0, convert_page_summary_to_page_header_1.convertPageSummaryToPageHeader)(
|
|
11
|
+
const projectRoot = await (0, utility_1.readWorkspace)(tree).then(({ projects }) => projects.get(`${options.project}`)?.root ?? '');
|
|
12
|
+
return (0, convert_page_summary_to_page_header_1.convertPageSummaryToPageHeader)(projectRoot);
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=convert-page-summary-to-page-header.schematic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-page-summary-to-page-header.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-page-summary-to-page-header/convert-page-summary-to-page-header.schematic.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"convert-page-summary-to-page-header.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-page-summary-to-page-header/convert-page-summary-to-page-header.schematic.ts"],"names":[],"mappings":";;AAUA,0DAUC;AAnBD,yDAA4D;AAE5D,6IAAqI;AAIrI;;GAEG;AACH,SAAwB,uCAAuC,CAC7D,OAAe;IAEf,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,WAAW,GAAG,MAAM,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,IAAI,CAChD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,IAAI,EAAE,CACjE,CAAC;QAEF,OAAO,IAAA,oEAA8B,EAAC,WAAW,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Converts `<sky-progress-indicator>` components using
|
|
5
|
+
* `displayMode="horizontal"` to `<sky-tabset>` components
|
|
6
|
+
* with `<sky-tab>` elements.
|
|
7
|
+
*/
|
|
8
|
+
export default function convertProgressIndicatorWizardToTabWizardSchematic(options: Partial<Schema>): Rule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = convertProgressIndicatorWizardToTabWizardSchematic;
|
|
4
|
+
const convert_progress_indicator_wizard_to_tab_wizard_1 = require("../../rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard");
|
|
5
|
+
/**
|
|
6
|
+
* Converts `<sky-progress-indicator>` components using
|
|
7
|
+
* `displayMode="horizontal"` to `<sky-tabset>` components
|
|
8
|
+
* with `<sky-tab>` elements.
|
|
9
|
+
*/
|
|
10
|
+
function convertProgressIndicatorWizardToTabWizardSchematic(options) {
|
|
11
|
+
return (0, convert_progress_indicator_wizard_to_tab_wizard_1.convertProgressIndicatorWizardToTabWizard)({
|
|
12
|
+
projectPath: options.projectPath ?? '',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=convert-progress-indicator-wizard-to-tab-wizard.schematic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-progress-indicator-wizard-to-tab-wizard.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.schematic.ts"],"names":[],"mappings":";;AAWA,qEAMC;AAfD,iLAAwK;AAIxK;;;;GAIG;AACH,SAAwB,kDAAkD,CACxE,OAAwB;IAExB,OAAO,IAAA,2FAAyC,EAAC;QAC/C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;KACvC,CAAC,CAAC;AACL,CAAC"}
|
package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.ts"],"names":[],"mappings":""}
|
package/src/schematics/ng-generate/convert-progress-indicator-wizard-to-tab-wizard/schema.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"description": "Converts sky-progress-indicator components using horizontal layout to use sky-tabset wizard",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"projectPath": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The path to the files where the rule should be applied.",
|
|
10
|
+
"format": "path",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "workingDirectory"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -12,10 +12,10 @@ const visit_project_files_1 = require("../../utility/visit-project-files");
|
|
|
12
12
|
* Description list does not use a heading element.
|
|
13
13
|
* Create a new `<h3>` element with the heading text.
|
|
14
14
|
*/
|
|
15
|
-
function moveHeading(definitionList, recorder, offset, eol) {
|
|
15
|
+
function moveHeading(definitionList, recorder, content, offset, eol) {
|
|
16
16
|
const heading = (0, template_1.getElementsByTagName)('sky-definition-list-heading', definitionList)[0];
|
|
17
17
|
if ((0, template_1.isParentNode)(heading)) {
|
|
18
|
-
const headingText =
|
|
18
|
+
const headingText = content.slice(heading.sourceCodeLocation.startTag.endOffset, heading.sourceCodeLocation.endTag.startOffset);
|
|
19
19
|
const indent = ' '.repeat(definitionList.sourceCodeLocation.startTag.startCol - 1);
|
|
20
20
|
recorder.insertLeft(offset + definitionList.sourceCodeLocation.startTag.startOffset, `<h3 class="sky-margin-stacked-sm">${headingText}</h3>${eol}${indent}`);
|
|
21
21
|
recorder.remove(offset + heading.sourceCodeLocation.startOffset, heading.sourceCodeLocation.endOffset -
|
|
@@ -69,7 +69,7 @@ function convertTemplate(recorder, context, content, offset = 0) {
|
|
|
69
69
|
const fragment = (0, template_1.parseTemplate)(content);
|
|
70
70
|
const definitionLists = (0, template_1.getElementsByTagName)('sky-definition-list', fragment);
|
|
71
71
|
for (const definitionList of definitionLists) {
|
|
72
|
-
moveHeading(definitionList, recorder, offset, eol);
|
|
72
|
+
moveHeading(definitionList, recorder, content, offset, eol);
|
|
73
73
|
(0, template_1.swapTags)(content, recorder, offset, Object.keys(tags), definitionListTagSwap(context), definitionList);
|
|
74
74
|
}
|
|
75
75
|
if (definitionLists.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-definition-list-to-description-list.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-definition-list-to-description-list/convert-definition-list-to-description-list.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"convert-definition-list-to-description-list.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-definition-list-to-description-list/convert-definition-list-to-description-list.ts"],"names":[],"mappings":";;AAyLA,wFAYC;AA/LD,wDAAsE;AACtE,yDAAyD;AAEzD,qDAAiD;AACjD,qDAOgC;AAChC,4DAAqE;AACrE,sFAAiF;AACjF,2EAAsE;AAEtE;;;GAGG;AACH,SAAS,WAAW,CAClB,cAAmC,EACnC,QAAwB,EACxB,OAAe,EACf,MAAc,EACd,GAAW;IAEX,MAAM,OAAO,GAAG,IAAA,+BAAoB,EAClC,6BAA6B,EAC7B,cAAc,CACf,CAAC,CAAC,CAAC,CAAC;IACL,IAAI,IAAA,uBAAY,EAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAC/B,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAC7C,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAC9C,CAAC;QACF,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CACvB,cAAc,CAAC,kBAAkB,CAAC,Q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 @@ const visit_project_files_1 = require("../../utility/visit-project-files");
|
|
|
18
18
|
*/
|
|
19
19
|
function getPageTitle(pageSummary) {
|
|
20
20
|
const heading = (0, template_1.getElementsByTagName)('sky-page-summary-title', pageSummary)[0];
|
|
21
|
-
if ((0, template_1.isParentNode)(heading)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
if ((0, template_1.isParentNode)(heading)) {
|
|
22
|
+
try {
|
|
23
|
+
return (0, template_1.getText)(heading.childNodes);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
// If the heading contains something other than a single text node,
|
|
27
|
+
// throw an error to indicate that the title cannot be converted.
|
|
28
|
+
throw new Error(`The '<sky-page-summary-title>' element contains additional markup that is not supported as a 'pageTitle' for the <sky-page-header> component.`, { cause: error });
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
else {
|
|
30
|
-
|
|
31
|
-
// throw an error to indicate that the title cannot be converted.
|
|
32
|
-
throw new Error(`The '<sky-page-summary-title>' element contains additional markup that is not supported as a 'pageTitle' for the <sky-page-header> component.`);
|
|
32
|
+
return '';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -132,7 +132,26 @@ function convertHtmlFile(tree, filePath, context) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
function convertTypescriptFile(tree, filePath, context) {
|
|
135
|
-
|
|
135
|
+
let source = (0, schematics_2.parseSourceFile)(tree, filePath);
|
|
136
|
+
if ((0, schematics_2.isImported)(source, 'SkyPageLayoutType', '@skyux/layout') ||
|
|
137
|
+
(0, schematics_2.isImported)(source, 'SkyPageModule', '@skyux/layout')) {
|
|
138
|
+
// These should have been migrated in SKY UX 9.
|
|
139
|
+
const recorder = tree.beginUpdate(filePath);
|
|
140
|
+
(0, swap_imported_class_1.swapImportedClass)(recorder, filePath, source, [
|
|
141
|
+
{
|
|
142
|
+
classNames: {
|
|
143
|
+
SkyPageLayoutType: 'SkyPageLayoutType',
|
|
144
|
+
SkyPageModule: 'SkyPageModule',
|
|
145
|
+
},
|
|
146
|
+
moduleName: {
|
|
147
|
+
old: '@skyux/layout',
|
|
148
|
+
new: '@skyux/pages',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
]);
|
|
152
|
+
tree.commitUpdate(recorder);
|
|
153
|
+
source = (0, schematics_2.parseSourceFile)(tree, filePath);
|
|
154
|
+
}
|
|
136
155
|
const templates = (0, ng_ast_1.getInlineTemplates)(source);
|
|
137
156
|
const recorder = tree.beginUpdate(filePath);
|
|
138
157
|
if (templates.length > 0) {
|
|
@@ -175,7 +194,7 @@ function convertPageSummaryToPageHeader(projectPath) {
|
|
|
175
194
|
}
|
|
176
195
|
});
|
|
177
196
|
},
|
|
178
|
-
(0, utility_1.addDependency)('@skyux/pages', `12.
|
|
197
|
+
(0, utility_1.addDependency)('@skyux/pages', `12.35.0`, {
|
|
179
198
|
existing: utility_1.ExistingBehavior.Skip,
|
|
180
199
|
}),
|
|
181
200
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-page-summary-to-page-header.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"convert-page-summary-to-page-header.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header.ts"],"names":[],"mappings":";;AA+PA,wEAqBC;AApRD,2DAMoC;AACpC,wDAAsE;AACtE,yDAA8E;AAC9E,yDAAyD;AAEzD,qDAAiD;AACjD,qDAQgC;AAChC,4DAAqE;AACrE,sFAAiF;AACjF,2EAAsE;AAEtE;;;;;GAKG;AACH,SAAS,YAAY,CAAC,WAAgC;IACpD,MAAM,OAAO,GAAG,IAAA,+BAAoB,EAClC,wBAAwB,EACxB,WAA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tB,IAAA,uCAAiB,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAChD,IAAI,CAAC;oBACH,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;wBAC/B,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;oBAC3C,CAAC;yBAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBACpC,qBAAqB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;oBACjD,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,0BAA0B;oBAC1B,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACnE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAA,uBAAa,EAAC,cAAc,EAAE,mBAAmB,EAAE;YACjD,QAAQ,EAAE,0BAAgB,CAAC,IAAI;SAChC,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertProgressIndicatorWizardToTabWizard = convertProgressIndicatorWizardToTabWizard;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const schematics_2 = require("@angular/cdk/schematics");
|
|
7
|
+
const typescript_1 = tslib_1.__importDefault(require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
8
|
+
const utility_1 = require("@schematics/angular/utility");
|
|
9
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
10
|
+
const change_1 = require("@schematics/angular/utility/change");
|
|
11
|
+
const eol_1 = require("@schematics/angular/utility/eol");
|
|
12
|
+
const util_1 = require("@schematics/angular/utility/standalone/util");
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
const template_1 = require("../../utility/template");
|
|
15
|
+
const ng_ast_1 = require("../../utility/typescript/ng-ast");
|
|
16
|
+
const swap_imported_class_1 = require("../../utility/typescript/swap-imported-class");
|
|
17
|
+
const visit_project_files_1 = require("../../utility/visit-project-files");
|
|
18
|
+
/**
|
|
19
|
+
* Tabs do not use a heading element.
|
|
20
|
+
* Create a new `<h3>` element with the heading text.
|
|
21
|
+
*/
|
|
22
|
+
function moveHeading(progressIndicator, recorder, content, offset, eol) {
|
|
23
|
+
const heading = (0, template_1.getElementsByTagName)('sky-progress-indicator-title', progressIndicator)[0];
|
|
24
|
+
if ((0, template_1.isParentNode)(heading)) {
|
|
25
|
+
const headingText = content.slice(heading.sourceCodeLocation.startTag.endOffset, heading.sourceCodeLocation.endTag.startOffset);
|
|
26
|
+
const indent = ' '.repeat(progressIndicator.sourceCodeLocation.startTag.startCol - 1);
|
|
27
|
+
recorder.insertLeft(offset + progressIndicator.sourceCodeLocation.startTag.startOffset, `<h3 class="sky-margin-stacked-sm">${headingText}</h3>${eol}${indent}`);
|
|
28
|
+
recorder.remove(offset + heading.sourceCodeLocation.startOffset, heading.sourceCodeLocation.endOffset -
|
|
29
|
+
heading.sourceCodeLocation.startOffset);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const tags = {
|
|
33
|
+
'sky-progress-indicator': 'sky-tabset',
|
|
34
|
+
'sky-progress-indicator-item': 'sky-tab',
|
|
35
|
+
'sky-progress-indicator-nav-button': 'sky-tabset-nav-button',
|
|
36
|
+
};
|
|
37
|
+
function progressIndicatorTagSwap(filePath) {
|
|
38
|
+
return (position, oldTag, node, content) => {
|
|
39
|
+
if (position === 'open') {
|
|
40
|
+
if (oldTag === 'sky-progress-indicator') {
|
|
41
|
+
const attributeSwaps = {
|
|
42
|
+
'[startingIndex]': '[active]',
|
|
43
|
+
'(progressChanges)': '(activeChange)',
|
|
44
|
+
'[messageStream]': '(unsupported)',
|
|
45
|
+
isPassive: '',
|
|
46
|
+
'[isPassive]': '',
|
|
47
|
+
displayMode: '',
|
|
48
|
+
'[displayMode]': '',
|
|
49
|
+
};
|
|
50
|
+
const attributeCallback = (oldAttr, newAttr, _node, _content) => {
|
|
51
|
+
if (oldAttr === '(progressChanges)') {
|
|
52
|
+
const newValue = (0, template_1.getAttributeValueText)(content, node, oldAttr).replace('$event', '{ activeIndex: $event }');
|
|
53
|
+
return `${newAttr}${newValue}`;
|
|
54
|
+
}
|
|
55
|
+
else if (oldAttr === '[messageStream]') {
|
|
56
|
+
throw new Error(`The <sky-progress-indicator> element in ${filePath} uses '[messageStream]', which is not supported on the <sky-tabset> component. Please evaluate if '[messageStream]' is still needed.`);
|
|
57
|
+
}
|
|
58
|
+
return `${newAttr}${(0, template_1.getAttributeValueText)(content, node, oldAttr)}`;
|
|
59
|
+
};
|
|
60
|
+
return `<${tags[oldTag]} tabStyle="wizard"${(0, template_1.swapAttributes)(node, attributeSwaps, content, attributeCallback)}>`;
|
|
61
|
+
}
|
|
62
|
+
else if (oldTag === 'sky-progress-indicator-item') {
|
|
63
|
+
return `<${tags[oldTag]}${(0, template_1.swapAttributes)(node, { title: 'tabHeading', '[title]': '[tabHeading]' }, content)}>`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return `</${tags[oldTag]}>`;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function progressIndicatorNavButtonTagSwap(filePath) {
|
|
70
|
+
return (position, oldTag, node, content) => {
|
|
71
|
+
if (position === 'open') {
|
|
72
|
+
if (node.attrs.some((attr) => attr.name === '(actionClick)'.toLowerCase())) {
|
|
73
|
+
throw new Error(`The <sky-progress-indicator-nav-button> element in ${filePath} uses '(actionClick)', which is not supported on the <sky-tabset-nav-button> component. Please evaluate if '(actionClick)' is still needed.`);
|
|
74
|
+
}
|
|
75
|
+
if (node.attrs.some((attr) => attr.name === 'buttonType'.toLowerCase() && attr.value === 'reset')) {
|
|
76
|
+
throw new Error(`The <sky-progress-indicator-nav-button> element in ${filePath} uses 'buttonType="reset"', which is not supported on the <sky-tabset-nav-button> component. Please evaluate if a reset button is still needed.`);
|
|
77
|
+
}
|
|
78
|
+
const close = node.sourceCodeLocation.endTag?.startOffset ? '>' : ' />';
|
|
79
|
+
return `<${tags[oldTag]}${(0, template_1.swapAttributes)(node, { progressIndicator: 'tabset', '[progressIndicator]': '[tabset]' }, content)}${close}`;
|
|
80
|
+
}
|
|
81
|
+
return `</${tags[oldTag]}>`;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function addFollowupComments(filePath, sourceFile, followupTasks, eol) {
|
|
85
|
+
const changes = [];
|
|
86
|
+
const addComments = ([functionName, comment]) => {
|
|
87
|
+
const functionNodes = (0, ast_utils_1.findNodes)(sourceFile, (node) => typescript_1.default.isIdentifier(node) && node.text === functionName);
|
|
88
|
+
if (functionNodes.length === 1) {
|
|
89
|
+
const line = sourceFile.getLineAndCharacterOfPosition(functionNodes[0].getStart()).line;
|
|
90
|
+
const lineStart = sourceFile.getPositionOfLineAndCharacter(line, 0);
|
|
91
|
+
const lineText = String(sourceFile.text.split('\n')[line]);
|
|
92
|
+
const indentation = lineText.match(/^\s*/)?.[0] || '';
|
|
93
|
+
changes.push(new change_1.InsertChange(filePath, lineStart, `${indentation}// todo: ${comment}${eol}`));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
Object.entries(followupTasks.addCommentsToProperties).forEach(addComments);
|
|
97
|
+
return changes;
|
|
98
|
+
}
|
|
99
|
+
function applyFollowupTasksToComponent(source, tree, filePath, followupTasks, isStandalone, eol) {
|
|
100
|
+
if (isStandalone &&
|
|
101
|
+
(0, schematics_2.isImported)(source, 'SkyProgressIndicatorModule', '@skyux/progress-indicator') &&
|
|
102
|
+
!(0, schematics_2.isImported)(source, 'SkyTabsModule', '@skyux/tabs')) {
|
|
103
|
+
if (followupTasks.keepProgressIndicator) {
|
|
104
|
+
applyModuleDependencies(source, tree, filePath);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
swapModuleDependencies(tree, filePath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
(0, util_1.applyChangesToFile)(tree, filePath, addFollowupComments(filePath, (0, schematics_2.parseSourceFile)(tree, filePath), followupTasks, eol));
|
|
111
|
+
}
|
|
112
|
+
function applyModuleDependencies(originalSource, tree, filePath) {
|
|
113
|
+
[
|
|
114
|
+
['Component', '@angular/core'],
|
|
115
|
+
['NgModule', '@angular/core'],
|
|
116
|
+
['TestBed.configureTestingModule', '@angular/core/testing'],
|
|
117
|
+
].forEach(([decorator, decoratorModule]) => {
|
|
118
|
+
if ((0, schematics_2.isImported)(originalSource, String(decorator.split('.').shift()), decoratorModule)) {
|
|
119
|
+
const metadata = decorator === 'TestBed.configureTestingModule'
|
|
120
|
+
? (0, ng_ast_1.getTestingModuleMetadata)(originalSource)
|
|
121
|
+
: (0, schematics_2.getDecoratorMetadata)(originalSource, decorator, decoratorModule);
|
|
122
|
+
['imports', 'exports'].forEach((metadataField) => {
|
|
123
|
+
if (metadata.some((node) => typescript_1.default.isObjectLiteralExpression(node) &&
|
|
124
|
+
(0, ng_ast_1.isSymbolInClassMetadataFieldArray)(node, metadataField, 'SkyProgressIndicatorModule'))) {
|
|
125
|
+
(0, util_1.applyChangesToFile)(tree, filePath, (0, ng_ast_1.addSymbolToClassMetadata)((0, schematics_2.parseSourceFile)(tree, filePath), decorator, filePath, metadataField, 'SkyTabsModule', '@skyux/tabs'));
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function swapModuleDependencies(tree, filePath) {
|
|
132
|
+
const recorder = tree.beginUpdate(filePath);
|
|
133
|
+
(0, swap_imported_class_1.swapImportedClass)(recorder, filePath, (0, schematics_2.parseSourceFile)(tree, filePath), [
|
|
134
|
+
{
|
|
135
|
+
classNames: { SkyProgressIndicatorModule: 'SkyTabsModule' },
|
|
136
|
+
moduleName: {
|
|
137
|
+
old: '@skyux/progress-indicator',
|
|
138
|
+
new: '@skyux/tabs',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
]);
|
|
142
|
+
tree.commitUpdate(recorder);
|
|
143
|
+
}
|
|
144
|
+
function isThisAWizard(progressIndicator, componentSource, filePath, followupTasks) {
|
|
145
|
+
const displayModeBoundAttribute = progressIndicator.attrs.find((attr) => '[displayMode]'.toLowerCase() === attr.name);
|
|
146
|
+
const displayModeAttribute = progressIndicator.attrs.find((attr) => 'displayMode'.toLowerCase() === attr.name);
|
|
147
|
+
if (displayModeAttribute) {
|
|
148
|
+
return ['horizontal', '1'].includes(displayModeAttribute.value);
|
|
149
|
+
}
|
|
150
|
+
else if (displayModeBoundAttribute) {
|
|
151
|
+
const displayModeExpression = displayModeBoundAttribute.value.trim();
|
|
152
|
+
if (displayModeExpression.match(/^([`"'])horizontal\1$/) ||
|
|
153
|
+
displayModeExpression === '1') {
|
|
154
|
+
// You're a wizard!
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
else if (!displayModeExpression.match(/^\w+$/)) {
|
|
158
|
+
// If the expression is not a simple identifier, we can't determine the value.
|
|
159
|
+
throw new Error(`Unable to determine the 'displayMode' attribute on <sky-progress-indicator> in ${filePath}.`);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// Find the value in componentSource
|
|
163
|
+
const displayModeProperty = (0, ast_utils_1.findNodes)(componentSource, (node) => typescript_1.default.isPropertyDeclaration(node) &&
|
|
164
|
+
typescript_1.default.isIdentifier(node.name) &&
|
|
165
|
+
node.name.text === displayModeExpression)[0];
|
|
166
|
+
const value = displayModeProperty?.initializer?.getText().trim();
|
|
167
|
+
if (!value) {
|
|
168
|
+
throw new Error(`Unable to determine the value for the 'displayMode' attribute on <sky-progress-indicator> in ${filePath}.`);
|
|
169
|
+
}
|
|
170
|
+
if (!!value.match(/^([`"'])horizontal\1$/) ||
|
|
171
|
+
['SkyProgressIndicatorDisplayMode.Horizontal', '1'].includes(value)) {
|
|
172
|
+
// You're a wizard!
|
|
173
|
+
followupTasks.addCommentsToProperties[displayModeProperty.name.getText()] =
|
|
174
|
+
`Remove. The ${displayModeProperty.name.getText()} property was previously used to determine if the progress indicator should be displayed as a wizard. It is no longer needed.`;
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
function convertTemplate(recorder, filePath, content, componentSource, offset = 0) {
|
|
182
|
+
const eol = (0, eol_1.getEOL)(content);
|
|
183
|
+
const fragment = (0, template_1.parseTemplate)(content);
|
|
184
|
+
const progressIndicators = (0, template_1.getElementsByTagName)('sky-progress-indicator', fragment);
|
|
185
|
+
const followupTasks = {
|
|
186
|
+
swapModuleImports: false,
|
|
187
|
+
keepProgressIndicator: false,
|
|
188
|
+
addCommentsToProperties: {},
|
|
189
|
+
};
|
|
190
|
+
for (const progressIndicator of progressIndicators) {
|
|
191
|
+
const isWizard = isThisAWizard(progressIndicator, componentSource, filePath, followupTasks);
|
|
192
|
+
if (!isWizard) {
|
|
193
|
+
followupTasks.keepProgressIndicator = true;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
followupTasks.swapModuleImports = true;
|
|
197
|
+
moveHeading(progressIndicator, recorder, content, offset, eol);
|
|
198
|
+
(0, template_1.swapTags)(content, recorder, offset, ['sky-progress-indicator', 'sky-progress-indicator-item'], progressIndicatorTagSwap(filePath), progressIndicator);
|
|
199
|
+
}
|
|
200
|
+
const navButtons = (0, template_1.getElementsByTagName)('sky-progress-indicator-nav-button', fragment);
|
|
201
|
+
for (const navButton of navButtons) {
|
|
202
|
+
(0, template_1.swapTags)(content, recorder, offset, ['sky-progress-indicator-nav-button'], progressIndicatorNavButtonTagSwap(filePath), navButton);
|
|
203
|
+
}
|
|
204
|
+
return followupTasks;
|
|
205
|
+
}
|
|
206
|
+
function convertHtmlFile(tree, filePath, componentSource) {
|
|
207
|
+
const content = tree.readText(filePath);
|
|
208
|
+
if (content.includes('<sky-progress-indicator')) {
|
|
209
|
+
const recorder = tree.beginUpdate(filePath);
|
|
210
|
+
const followupTasks = convertTemplate(recorder, filePath, content, componentSource);
|
|
211
|
+
tree.commitUpdate(recorder);
|
|
212
|
+
return followupTasks;
|
|
213
|
+
}
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
function convertTypescriptFile(tree, filePath, componentsThatNeedModules, componentsThatKeepProgressIndicator) {
|
|
217
|
+
const source = (0, schematics_2.parseSourceFile)(tree, filePath);
|
|
218
|
+
const eol = (0, eol_1.getEOL)(tree.readText(filePath));
|
|
219
|
+
let followupTasks = undefined;
|
|
220
|
+
if ((0, schematics_2.isImported)(source, 'Component', '@angular/core')) {
|
|
221
|
+
const metadata = (0, schematics_2.getDecoratorMetadata)(source, 'Component', '@angular/core')[0];
|
|
222
|
+
const templateUrl = (0, schematics_2.getMetadataField)(metadata, 'templateUrl')[0];
|
|
223
|
+
if (templateUrl && typescript_1.default.isStringLiteralLike(templateUrl.initializer)) {
|
|
224
|
+
const htmlFilePath = (0, node_path_1.normalize)((0, node_path_1.join)((0, node_path_1.dirname)(filePath), templateUrl.initializer.text));
|
|
225
|
+
followupTasks = convertHtmlFile(tree, htmlFilePath, source);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
const template = (0, ng_ast_1.getInlineTemplates)(source)[0];
|
|
229
|
+
if (template) {
|
|
230
|
+
const content = tree.readText(filePath);
|
|
231
|
+
const templateContent = content.slice(template.start, template.end);
|
|
232
|
+
const recorder = tree.beginUpdate(filePath);
|
|
233
|
+
followupTasks = convertTemplate(recorder, filePath, templateContent, source, template.start);
|
|
234
|
+
tree.commitUpdate(recorder);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (followupTasks?.swapModuleImports) {
|
|
238
|
+
const isStandalone = (0, ng_ast_1.isStandaloneComponent)(metadata);
|
|
239
|
+
applyFollowupTasksToComponent(source, tree, filePath, followupTasks, isStandalone, eol);
|
|
240
|
+
if (!isStandalone) {
|
|
241
|
+
const componentClassName = (0, ast_utils_1.findNodes)(source, typescript_1.default.isClassDeclaration)[0]?.name?.text;
|
|
242
|
+
componentsThatNeedModules.push(componentClassName);
|
|
243
|
+
if (followupTasks?.keepProgressIndicator) {
|
|
244
|
+
componentsThatKeepProgressIndicator.push(componentClassName);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function hasSymbolReference(source, symbolNames) {
|
|
251
|
+
return ((0, ast_utils_1.findNodes)(source, (node) => typescript_1.default.isIdentifier(node) && symbolNames.includes(node.text)).length > 0);
|
|
252
|
+
}
|
|
253
|
+
function isModuleExportingProgressIndicatorModule(source) {
|
|
254
|
+
if ((0, schematics_2.isImported)(source, 'NgModule', '@angular/core')) {
|
|
255
|
+
const decoratorMetadata = (0, schematics_2.getDecoratorMetadata)(source, 'NgModule', '@angular/core')[0];
|
|
256
|
+
return (typescript_1.default.isObjectLiteralExpression(decoratorMetadata) &&
|
|
257
|
+
(0, ng_ast_1.isSymbolInClassMetadataFieldArray)(decoratorMetadata, 'exports', 'SkyProgressIndicatorModule'));
|
|
258
|
+
}
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* If this is a test file and references a component that was converted,
|
|
263
|
+
* we need to ensure that the SkyTabsModule is imported in the TestBed configuration.
|
|
264
|
+
*/
|
|
265
|
+
function updateModuleOrTestFile(tree, filePath, componentsThatNeedModules, componentsThatKeepProgressIndicator) {
|
|
266
|
+
const source = (0, schematics_2.parseSourceFile)(tree, filePath);
|
|
267
|
+
if (((0, schematics_2.isImported)(source, 'TestBed', '@angular/core/testing') &&
|
|
268
|
+
hasSymbolReference(source, componentsThatNeedModules)) ||
|
|
269
|
+
((0, schematics_2.isImported)(source, 'NgModule', '@angular/core') &&
|
|
270
|
+
(0, schematics_2.isImported)(source, 'SkyProgressIndicatorModule', '@skyux/progress-indicator'))) {
|
|
271
|
+
if ((componentsThatKeepProgressIndicator.length > 0 &&
|
|
272
|
+
isModuleExportingProgressIndicatorModule(source)) ||
|
|
273
|
+
hasSymbolReference(source, componentsThatKeepProgressIndicator)) {
|
|
274
|
+
applyModuleDependencies(source, tree, filePath);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
swapModuleDependencies(tree, filePath);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function convertProgressIndicatorWizardToTabWizard(options) {
|
|
282
|
+
return (0, schematics_1.chain)([
|
|
283
|
+
(tree, context) => {
|
|
284
|
+
// This is used to track if we need to add the SkyTabsModule to the module imports.
|
|
285
|
+
const componentsThatNeedModules = [];
|
|
286
|
+
const componentsThatKeepProgressIndicator = [];
|
|
287
|
+
(0, visit_project_files_1.visitProjectFiles)(tree, options.projectPath, (filePath) => {
|
|
288
|
+
if (filePath.endsWith('.ts')) {
|
|
289
|
+
convertTypescriptFile(tree, filePath, componentsThatNeedModules, componentsThatKeepProgressIndicator);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
if (componentsThatNeedModules.length > 0) {
|
|
293
|
+
(0, visit_project_files_1.visitProjectFiles)(tree, options.projectPath, (filePath) => {
|
|
294
|
+
if (filePath.endsWith('.ts')) {
|
|
295
|
+
updateModuleOrTestFile(tree, filePath, componentsThatNeedModules, componentsThatKeepProgressIndicator);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
(0, utility_1.addDependency)('@skyux/tabs', `12.35.0`, {
|
|
301
|
+
existing: utility_1.ExistingBehavior.Skip,
|
|
302
|
+
}),
|
|
303
|
+
]);
|
|
304
|
+
}
|
|
305
|
+
//# sourceMappingURL=convert-progress-indicator-wizard-to-tab-wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-progress-indicator-wizard-to-tab-wizard.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.ts"],"names":[],"mappings":";;AAgjBA,8FAmCC;;AAnlBD,2DAA+E;AAC/E,wDAKiC;AACjC,wIAAgG;AAChG,yDAA8E;AAC9E,qEAAkE;AAClE,+DAA0E;AAC1E,yDAAyD;AACzD,sEAAiF;AAEjF,yCAAqD;AAErD,qDASgC;AAChC,4DAMyC;AACzC,sFAAiF;AACjF,2EAAsE;AAItE;;;GAGG;AACH,SAAS,WAAW,CAClB,iBAAsC,EACtC,QAAwB,EACxB,OAAe,EACf,MAAc,EACd,GAAW;IAEX,MAAM,OAAO,GAAG,IAAA,+BAAoB,EAClC,8BAA8B,EAC9B,iBAAiB,CAClB,CAAC,CAAC,CAAC,CAAC;IACL,IAAI,IAAA,uBAAY,EAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAC/B,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,SAAS,EAC7C,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAC9C,CAAC;QACF,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CACvB,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAC3D,CAAC;QACF,QAAQ,CAAC,UAAU,CACjB,MAAM,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAClE,qCAAqC,WAAW,QAAQ,GAAG,GAAG,MAAM,EAAE,CACvE,CAAC;QACF,QAAQ,CAAC,MAAM,CACb,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,WAA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uCAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;oBACxD,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC7B,sBAAsB,CACpB,IAAI,EACJ,QAAQ,EACR,yBAAyB,EACzB,mCAAmC,CACpC,CAAC;oBACJ,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,IAAA,uBAAa,EAAC,aAAa,EAAE,mBAAmB,EAAE;YAChD,QAAQ,EAAE,0BAAgB,CAAC,IAAI;SAChC,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
import { Schema as ComponentSchema } from '@schematics/angular/component/schema';
|
|
3
|
+
import { Schema as ModuleSchema } from '@schematics/angular/module/schema';
|
|
4
|
+
export declare function angularModuleGenerator(runner: SchematicTestRunner, tree: UnitTestTree, schema: ModuleSchema): Promise<UnitTestTree>;
|
|
5
|
+
export declare function angularComponentGenerator(runner: SchematicTestRunner, tree: UnitTestTree, schema: ComponentSchema): Promise<UnitTestTree>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.angularModuleGenerator = angularModuleGenerator;
|
|
4
|
+
exports.angularComponentGenerator = angularComponentGenerator;
|
|
5
|
+
async function angularModuleGenerator(runner, tree, schema) {
|
|
6
|
+
return await runner.runExternalSchematic('@schematics/angular', 'module', schema, tree);
|
|
7
|
+
}
|
|
8
|
+
async function angularComponentGenerator(runner, tree, schema) {
|
|
9
|
+
return await runner.runExternalSchematic('@schematics/angular', 'component', {
|
|
10
|
+
style: 'scss',
|
|
11
|
+
type: 'component',
|
|
12
|
+
...schema,
|
|
13
|
+
}, tree);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=angular-module-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-module-generator.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/testing/angular-module-generator.ts"],"names":[],"mappings":";;AAOA,wDAWC;AAED,8DAeC;AA5BM,KAAK,UAAU,sBAAsB,CAC1C,MAA2B,EAC3B,IAAkB,EAClB,MAAoB;IAEpB,OAAO,MAAM,MAAM,CAAC,oBAAoB,CACtC,qBAAqB,EACrB,QAAQ,EACR,MAAM,EACN,IAAI,CACL,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,yBAAyB,CAC7C,MAA2B,EAC3B,IAAkB,EAClB,MAAuB;IAEvB,OAAO,MAAM,MAAM,CAAC,oBAAoB,CACtC,qBAAqB,EACrB,WAAW,EACX;QACE,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,WAAW;QACjB,GAAG,MAAM;KACV,EACD,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -4,9 +4,22 @@ export declare function getInlineTemplates(sourceFile: ts.SourceFile): {
|
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
}[];
|
|
7
|
+
export declare function getTemplateUrls(sourceFile: ts.SourceFile): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Like `getDecoratorMetadata` from @angular/cdk/schematics, but for `TestBed.configureTestingModule`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getTestingModuleMetadata(source: ts.SourceFile): ts.ObjectLiteralExpression[];
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether a component is standalone from its metadata.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isStandaloneComponent(metadata: ts.ObjectLiteralExpression): boolean;
|
|
7
16
|
/**
|
|
8
17
|
* Adds a symbol to the metadata of an Angular class (NgModule, Component, Directive).
|
|
9
18
|
*
|
|
10
19
|
* Derived from https://github.com/angular/angular-cli/blob/20.1.x/packages/schematics/angular/utility/ast-utils.ts
|
|
11
20
|
*/
|
|
12
|
-
export declare function addSymbolToClassMetadata(source: ts.SourceFile, decorator: 'NgModule' | 'Component' | 'Directive', filePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[];
|
|
21
|
+
export declare function addSymbolToClassMetadata(source: ts.SourceFile, decorator: 'NgModule' | 'Component' | 'Directive' | 'TestBed.configureTestingModule', filePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[];
|
|
22
|
+
/**
|
|
23
|
+
* Checks if a symbol is present in a class metadata field array.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSymbolInClassMetadataFieldArray(node: ts.ObjectLiteralExpression, metadataField: string, symbolName: string): boolean;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInlineTemplates = getInlineTemplates;
|
|
4
|
+
exports.getTemplateUrls = getTemplateUrls;
|
|
5
|
+
exports.getTestingModuleMetadata = getTestingModuleMetadata;
|
|
6
|
+
exports.isStandaloneComponent = isStandaloneComponent;
|
|
4
7
|
exports.addSymbolToClassMetadata = addSymbolToClassMetadata;
|
|
8
|
+
exports.isSymbolInClassMetadataFieldArray = isSymbolInClassMetadataFieldArray;
|
|
5
9
|
const tslib_1 = require("tslib");
|
|
6
10
|
const core_1 = require("@angular-devkit/core");
|
|
7
11
|
const schematics_1 = require("@angular/cdk/schematics");
|
|
@@ -18,8 +22,7 @@ function getInlineTemplates(sourceFile) {
|
|
|
18
22
|
if (templates.length > 0) {
|
|
19
23
|
return templates
|
|
20
24
|
.map((template) => {
|
|
21
|
-
if (typescript_1.default.isStringLiteralLike(template.initializer)
|
|
22
|
-
typescript_1.default.isNoSubstitutionTemplateLiteral(template.initializer)) {
|
|
25
|
+
if (typescript_1.default.isStringLiteralLike(template.initializer)) {
|
|
23
26
|
return {
|
|
24
27
|
start: template.initializer.getStart() + 1,
|
|
25
28
|
end: template.initializer.getEnd() - 1, // Exclude quotes
|
|
@@ -32,96 +35,165 @@ function getInlineTemplates(sourceFile) {
|
|
|
32
35
|
}
|
|
33
36
|
return [];
|
|
34
37
|
}
|
|
38
|
+
function getTemplateUrls(sourceFile) {
|
|
39
|
+
if ((0, schematics_1.isImported)(sourceFile, 'Component', '@angular/core')) {
|
|
40
|
+
const components = (0, schematics_1.getDecoratorMetadata)(sourceFile, 'Component', '@angular/core');
|
|
41
|
+
const templates = components
|
|
42
|
+
.filter((component) => typescript_1.default.isObjectLiteralExpression(component))
|
|
43
|
+
.flatMap((component) => (0, schematics_1.getMetadataField)(component, 'templateUrl'))
|
|
44
|
+
.filter((template) => typescript_1.default.isPropertyAssignment(template));
|
|
45
|
+
if (templates.length > 0) {
|
|
46
|
+
return templates
|
|
47
|
+
.map((template) => {
|
|
48
|
+
if (typescript_1.default.isStringLiteralLike(template.initializer)) {
|
|
49
|
+
const quoted = template.initializer.getText();
|
|
50
|
+
return quoted.substring(1, quoted.length - 1);
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
})
|
|
54
|
+
.filter(Boolean);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Like `getDecoratorMetadata` from @angular/cdk/schematics, but for `TestBed.configureTestingModule`.
|
|
61
|
+
*/
|
|
62
|
+
function getTestingModuleMetadata(source) {
|
|
63
|
+
return (0, ast_utils_1.findNodes)(source, (node) => !!node?.parent &&
|
|
64
|
+
typescript_1.default.isObjectLiteralExpression(node) &&
|
|
65
|
+
typescript_1.default.isCallExpression(node.parent) &&
|
|
66
|
+
node.parent.expression.getText().trim() ===
|
|
67
|
+
'TestBed.configureTestingModule');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Determines whether a component is standalone from its metadata.
|
|
71
|
+
*/
|
|
72
|
+
function isStandaloneComponent(metadata) {
|
|
73
|
+
const standalone = (0, schematics_1.getMetadataField)(metadata, 'standalone');
|
|
74
|
+
return (!standalone[0] ||
|
|
75
|
+
(typescript_1.default.isPropertyAssignment(standalone[0]) &&
|
|
76
|
+
standalone[0].initializer.kind === typescript_1.default.SyntaxKind.TrueKeyword));
|
|
77
|
+
}
|
|
35
78
|
/**
|
|
36
79
|
* Adds a symbol to the metadata of an Angular class (NgModule, Component, Directive).
|
|
37
80
|
*
|
|
38
81
|
* Derived from https://github.com/angular/angular-cli/blob/20.1.x/packages/schematics/angular/utility/ast-utils.ts
|
|
39
82
|
*/
|
|
40
83
|
function addSymbolToClassMetadata(source, decorator, filePath, metadataField, symbolName, importPath = null) {
|
|
41
|
-
const nodes =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
const nodes = 'TestBed.configureTestingModule' === decorator
|
|
85
|
+
? getTestingModuleMetadata(source)
|
|
86
|
+
: (0, schematics_1.getDecoratorMetadata)(source, decorator, '@angular/core');
|
|
87
|
+
let insertedImport = false;
|
|
88
|
+
return nodes
|
|
89
|
+
.filter((node) => !!node && typescript_1.default.isObjectLiteralExpression(node))
|
|
90
|
+
.flatMap((node) => {
|
|
91
|
+
if (importPath === '@angular/common' &&
|
|
92
|
+
isSymbolInClassMetadataFieldArray(node, metadataField, 'CommonModule')) {
|
|
93
|
+
// Special case: don't add children of CommonModule if it's already present.
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
// Get all the children property assignment of object literals.
|
|
97
|
+
const matchingProperties = (0, schematics_1.getMetadataField)(node, metadataField);
|
|
98
|
+
if (!matchingProperties.length) {
|
|
99
|
+
// We haven't found the field in the metadata declaration. Insert a new field.
|
|
100
|
+
let position;
|
|
101
|
+
let toInsert;
|
|
102
|
+
if (!node.properties.length) {
|
|
103
|
+
position = node.getEnd() - 1;
|
|
104
|
+
toInsert = `\n ${metadataField}: [\n${core_1.tags.indentBy(4) `${symbolName}`}\n ]\n`;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const childNode = node.properties[node.properties.length - 1];
|
|
108
|
+
position = childNode.getEnd();
|
|
109
|
+
// Get the indentation of the last element, if any.
|
|
110
|
+
const text = childNode.getFullText(source);
|
|
111
|
+
const matches = text.match(/^(\r?\n)(\s*)/);
|
|
112
|
+
if (matches) {
|
|
113
|
+
toInsert =
|
|
114
|
+
`,${matches[0]}${metadataField}: [${matches[1]}` +
|
|
115
|
+
`${core_1.tags.indentBy(matches[2].length + 2) `${symbolName}`}${matches[0]}]`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
toInsert = `, ${metadataField}: [${symbolName}]`;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (importPath !== null && !insertedImport) {
|
|
122
|
+
insertedImport = true;
|
|
123
|
+
return [
|
|
124
|
+
new change_1.InsertChange(filePath, position, toInsert),
|
|
125
|
+
(0, ast_utils_1.insertImport)(source, filePath,
|
|
126
|
+
// Remove function call syntax (e.g., SomeSymbol()) and property access (e.g., SomeSymbol.method) from symbolName for import.
|
|
127
|
+
symbolName.replace(/(\.\w+|\(.*\))$/, ''), importPath),
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return [new change_1.InsertChange(filePath, position, toInsert)];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const assignment = matchingProperties[0];
|
|
135
|
+
// If it's not an array, nothing we can do really.
|
|
136
|
+
if (!typescript_1.default.isPropertyAssignment(assignment) ||
|
|
137
|
+
!typescript_1.default.isArrayLiteralExpression(assignment.initializer)) {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
let expression;
|
|
141
|
+
const assignmentInit = assignment.initializer;
|
|
142
|
+
const elements = assignmentInit.elements;
|
|
143
|
+
if (elements.length) {
|
|
144
|
+
const symbolsArray = elements.map((node) => core_1.tags.oneLine `${node.getText()}`);
|
|
145
|
+
if (symbolsArray.includes(core_1.tags.oneLine `${symbolName}`)) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
expression = elements[elements.length - 1];
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
expression = assignmentInit;
|
|
152
|
+
}
|
|
52
153
|
let toInsert;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
154
|
+
let position = expression.getEnd();
|
|
155
|
+
if (typescript_1.default.isArrayLiteralExpression(expression)) {
|
|
156
|
+
// We found the field but it's empty. Insert it just before the `]`.
|
|
157
|
+
position--;
|
|
158
|
+
toInsert = `\n${core_1.tags.indentBy(4) `${symbolName}`}\n `;
|
|
56
159
|
}
|
|
57
160
|
else {
|
|
58
|
-
const childNode = node.properties[node.properties.length - 1];
|
|
59
|
-
position = childNode.getEnd();
|
|
60
161
|
// Get the indentation of the last element, if any.
|
|
61
|
-
const text =
|
|
162
|
+
const text = expression.getFullText(source);
|
|
62
163
|
const matches = text.match(/^(\r?\n)(\s*)/);
|
|
63
164
|
if (matches) {
|
|
64
|
-
toInsert =
|
|
65
|
-
`,${matches[0]}${metadataField}: [${matches[1]}` +
|
|
66
|
-
`${core_1.tags.indentBy(matches[2].length + 2) `${symbolName}`}${matches[0]}]`;
|
|
165
|
+
toInsert = `,${matches[1]}${core_1.tags.indentBy(matches[2].length) `${symbolName}`}`;
|
|
67
166
|
}
|
|
68
167
|
else {
|
|
69
|
-
toInsert = `, ${
|
|
168
|
+
toInsert = `, ${symbolName}`;
|
|
70
169
|
}
|
|
71
170
|
}
|
|
72
|
-
if (importPath !== null) {
|
|
171
|
+
if (importPath !== null && !insertedImport) {
|
|
172
|
+
insertedImport = true;
|
|
73
173
|
return [
|
|
74
174
|
new change_1.InsertChange(filePath, position, toInsert),
|
|
75
|
-
(0, ast_utils_1.insertImport)(source, filePath, symbolName.replace(
|
|
175
|
+
(0, ast_utils_1.insertImport)(source, filePath, symbolName.replace(/[.(].*$/, ''), importPath),
|
|
76
176
|
];
|
|
77
177
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
178
|
+
return [new change_1.InsertChange(filePath, position, toInsert)];
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Checks if a symbol is present in a class metadata field array.
|
|
183
|
+
*/
|
|
184
|
+
function isSymbolInClassMetadataFieldArray(node, metadataField, symbolName) {
|
|
185
|
+
const matchingProperties = (0, schematics_1.getMetadataField)(node, metadataField);
|
|
186
|
+
if (!matchingProperties.length) {
|
|
187
|
+
return false;
|
|
81
188
|
}
|
|
82
189
|
const assignment = matchingProperties[0];
|
|
83
|
-
// If it's not an array, nothing we can do really.
|
|
84
190
|
if (!typescript_1.default.isPropertyAssignment(assignment) ||
|
|
85
191
|
!typescript_1.default.isArrayLiteralExpression(assignment.initializer)) {
|
|
86
|
-
return
|
|
192
|
+
return false;
|
|
87
193
|
}
|
|
88
|
-
let expression;
|
|
89
194
|
const assignmentInit = assignment.initializer;
|
|
90
195
|
const elements = assignmentInit.elements;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (symbolsArray.includes(core_1.tags.oneLine `${symbolName}`)) {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
expression = elements[elements.length - 1];
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
expression = assignmentInit;
|
|
100
|
-
}
|
|
101
|
-
let toInsert;
|
|
102
|
-
let position = expression.getEnd();
|
|
103
|
-
if (typescript_1.default.isArrayLiteralExpression(expression)) {
|
|
104
|
-
// We found the field but it's empty. Insert it just before the `]`.
|
|
105
|
-
position--;
|
|
106
|
-
toInsert = `\n${core_1.tags.indentBy(4) `${symbolName}`}\n `;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
// Get the indentation of the last element, if any.
|
|
110
|
-
const text = expression.getFullText(source);
|
|
111
|
-
const matches = text.match(/^(\r?\n)(\s*)/);
|
|
112
|
-
if (matches) {
|
|
113
|
-
toInsert = `,${matches[1]}${core_1.tags.indentBy(matches[2].length) `${symbolName}`}`;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
toInsert = `, ${symbolName}`;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (importPath !== null) {
|
|
120
|
-
return [
|
|
121
|
-
new change_1.InsertChange(filePath, position, toInsert),
|
|
122
|
-
(0, ast_utils_1.insertImport)(source, filePath, symbolName.replace(/\..*$/, ''), importPath),
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
return [new change_1.InsertChange(filePath, position, toInsert)];
|
|
196
|
+
const symbolsArray = elements.map((node) => core_1.tags.oneLine `${node.getText()}`);
|
|
197
|
+
return symbolsArray.includes(core_1.tags.oneLine `${symbolName}`);
|
|
126
198
|
}
|
|
127
199
|
//# sourceMappingURL=ng-ast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-ast.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/ng-ast.ts"],"names":[],"mappings":";;AAUA,
|
|
1
|
+
{"version":3,"file":"ng-ast.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/ng-ast.ts"],"names":[],"mappings":";;AAUA,gDA4BC;AAED,0CAwBC;AAKD,4DAYC;AAKD,sDASC;AAOD,4DA+HC;AAKD,8EAwBC;;AAlQD,+CAA4C;AAC5C,wDAIiC;AACjC,wIAAgG;AAChG,qEAAgF;AAChF,+DAA0E;AAE1E,SAAgB,kBAAkB,CAChC,UAAyB;IAEzB,IAAI,IAAA,uBAAU,EAAC,UAAU,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,CAAC;QACzD,MAAM,UAAU,GAAG,IAAA,iCAAoB,EACrC,UAAU,EACV,WAAW,EACX,eAAe,CAChB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