1 | "use strict";
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
10 | exports.MiscTemplateMigration = void 0;
|
---|
11 | const schematics_1 = require("@angular/cdk/schematics");
|
---|
12 | /**
|
---|
13 | * Migration that walks through every inline or external template and reports if there
|
---|
14 | * are outdated usages of the Angular Material API that needs to be updated manually.
|
---|
15 | */
|
---|
16 | class MiscTemplateMigration extends schematics_1.Migration {
|
---|
17 | constructor() {
|
---|
18 | super(...arguments);
|
---|
19 | // Only enable this rule if the migration targets version 6. The rule
|
---|
20 | // currently only includes migrations for V6 deprecations.
|
---|
21 | this.enabled = this.targetVersion === schematics_1.TargetVersion.V6;
|
---|
22 | }
|
---|
23 | visitTemplate(template) {
|
---|
24 | // Migration for: https://github.com/angular/components/pull/10398 (v6)
|
---|
25 | schematics_1.findOutputsOnElementWithTag(template.content, 'selectionChange', [
|
---|
26 | 'mat-list-option'
|
---|
27 | ]).forEach(offset => {
|
---|
28 | this.failures.push({
|
---|
29 | filePath: template.filePath,
|
---|
30 | position: template.getCharacterAndLineOfPosition(template.start + offset),
|
---|
31 | message: `Found deprecated "selectionChange" output binding on "mat-list-option". ` +
|
---|
32 | `Use "selectionChange" on "mat-selection-list" instead.`
|
---|
33 | });
|
---|
34 | });
|
---|
35 | // Migration for: https://github.com/angular/components/pull/10413 (v6)
|
---|
36 | schematics_1.findOutputsOnElementWithTag(template.content, 'selectedChanged', [
|
---|
37 | 'mat-datepicker'
|
---|
38 | ]).forEach(offset => {
|
---|
39 | this.failures.push({
|
---|
40 | filePath: template.filePath,
|
---|
41 | position: template.getCharacterAndLineOfPosition(template.start + offset),
|
---|
42 | message: `Found deprecated "selectedChanged" output binding on "mat-datepicker". ` +
|
---|
43 | `Use "dateChange" or "dateInput" on "<input [matDatepicker]>" instead.`
|
---|
44 | });
|
---|
45 | });
|
---|
46 | // Migration for: https://github.com/angular/components/commit/f0bf6e7 (v6)
|
---|
47 | schematics_1.findInputsOnElementWithTag(template.content, 'selected', [
|
---|
48 | 'mat-button-toggle-group'
|
---|
49 | ]).forEach(offset => {
|
---|
50 | this.failures.push({
|
---|
51 | filePath: template.filePath,
|
---|
52 | position: template.getCharacterAndLineOfPosition(template.start + offset),
|
---|
53 | message: `Found deprecated "selected" input binding on "mat-radio-button-group". ` +
|
---|
54 | `Use "value" instead.`
|
---|
55 | });
|
---|
56 | });
|
---|
57 | }
|
---|
58 | }
|
---|
59 | exports.MiscTemplateMigration = MiscTemplateMigration;
|
---|
60 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlzYy10ZW1wbGF0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9zY2hlbWF0aWNzL25nLXVwZGF0ZS9taWdyYXRpb25zL21pc2MtY2hlY2tzL21pc2MtdGVtcGxhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7O0FBRUgsd0RBTWlDO0FBRWpDOzs7R0FHRztBQUNILE1BQWEscUJBQXNCLFNBQVEsc0JBQWU7SUFBMUQ7O1FBRUUscUVBQXFFO1FBQ3JFLDBEQUEwRDtRQUMxRCxZQUFPLEdBQUcsSUFBSSxDQUFDLGFBQWEsS0FBSywwQkFBYSxDQUFDLEVBQUUsQ0FBQztJQXdDcEQsQ0FBQztJQXRDVSxhQUFhLENBQUMsUUFBMEI7UUFFL0MsdUVBQXVFO1FBQ3ZFLHdDQUEyQixDQUFDLFFBQVEsQ0FBQyxPQUFPLEVBQUUsaUJBQWlCLEVBQUU7WUFDL0QsaUJBQWlCO1NBQ2xCLENBQUMsQ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