Skip to content

Commit 4ba72e2

Browse files
authored
feat(chore): Angular 12 (#UIM-757) (#694)
* fix: prepare for update * updated to angular 12 * added linter fix for secondary-entry-points-migration * fixed build * fixed linter errors * fixed linter errors * returned Ctor * fixed wallaby config and some tests * fixed tests and linter * fixed tests * updated @angular-devkit/architect-cli * updated yarn.lock * cleared configuration * fixed build * fixed tests
1 parent 3162f7c commit 4ba72e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2589
-3830
lines changed

angular.json

Lines changed: 353 additions & 797 deletions
Large diffs are not rendered by default.

packages/docs/browserslist renamed to browserslist

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
# npx browserslist
77

88
> 0.5%
9-
last 2 versions
9+
last 2 Chrome version
10+
last 2 Firefox version
11+
last 2 Edge major versions
12+
last 2 Safari major versions
13+
last 2 iOS major versions
1014
Firefox ESR
11-
not dead
12-
not IE 9-11 # For IE 9-11 support, remove 'not'.
15+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

docs/guides/01-contribution-checklist.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ On top of automated testing, we should also be manually testing our examples on
3636
* Chrome
3737
* Firefox
3838
* Edge
39-
* IE11
4039
* Mac
4140
* Chrome
4241
* Firefox
4342
* Safari
4443

4544
## Review
4645

47-
* Ensure a core maintainer is added to the review.
46+
* Ensure a core maintainer is added to the review.

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@
1515
},
1616
"requiredAngularVersion": ">=11.0.0",
1717
"dependencies": {
18-
"@angular/animations": "^11.2.4",
18+
"@angular/animations": "^12.2.5",
1919
"@angular/cdk": "^11.2.2",
20-
"@angular/common": "^11.2.4",
21-
"@angular/compiler": "^11.2.4",
22-
"@angular/core": "^11.2.4",
23-
"@angular/forms": "^11.2.4",
24-
"@angular/platform-browser": "^11.2.4",
20+
"@angular/common": "^12.2.5",
21+
"@angular/compiler": "^12.2.5",
22+
"@angular/core": "^12.2.5",
23+
"@angular/forms": "^12.2.5",
24+
"@angular/platform-browser": "^12.2.5",
2525
"@ptsecurity/mosaic-icons": "^5.3.0",
2626
"core-js": "^3.6.5",
2727
"rxjs": "^6.5.5",
2828
"tslib": "^2.0.0",
29-
"zone.js": "~0.10.3"
29+
"zone.js": "~0.11.4"
3030
},
3131
"devDependencies": {
32-
"@angular-devkit/architect-cli": "^0.1102.14",
33-
"@angular-devkit/build-angular": "^0.1102.13",
34-
"@angular-devkit/core": "^11.2.3",
35-
"@angular-devkit/schematics": "^11.2.3",
36-
"@angular/cli": "^11.2.3",
37-
"@angular/compiler-cli": "^11.2.4",
38-
"@angular/platform-browser-dynamic": "^11.2.4",
39-
"@angular/platform-server": "^11.2.4",
40-
"@angular/router": "^11.2.4",
32+
"@angular-devkit/architect-cli": "^0.1202.6",
33+
"@angular-devkit/build-angular": "^12.2.5",
34+
"@angular-devkit/core": "^12.2.5",
35+
"@angular-devkit/schematics": "^12.2.5",
36+
"@angular/cli": "^12.2.5",
37+
"@angular/compiler-cli": "^12.2.5",
38+
"@angular/platform-browser-dynamic": "^12.2.5",
39+
"@angular/platform-server": "^12.2.5",
40+
"@angular/router": "^12.2.5",
4141
"@commitlint/cli": "9.1.2",
4242
"@commitlint/config-conventional": "^7.5.0",
4343
"@octokit/rest": "^18.9.1",
@@ -77,7 +77,7 @@
7777
"inquirer": "^7.3.3",
7878
"jasmine": "^3.5.0",
7979
"jasmine-core": "^3.5.0",
80-
"karma": "^5.1.1",
80+
"karma": "^6.3.4",
8181
"karma-chrome-launcher": "^3.1.0",
8282
"karma-coverage": "^2.0.3",
8383
"karma-jasmine": "^3.1.1",
@@ -91,10 +91,10 @@
9191
"merge2": "^1.2.3",
9292
"messageformat": "^2.0.5",
9393
"moment": "~2.23.0",
94-
"ng-packagr": "^11.2.4",
94+
"ng-packagr": "^12.2.1",
9595
"request": "^2.88.0",
9696
"resolve-bin": "^0.4.0",
97-
"sass": "^1.32.6",
97+
"sass": "^1.39.2",
9898
"scss-bundle": "^3.1.1",
9999
"snyk": "^1.667.0",
100100
"spdx-satisfies": "^5.0.0",
@@ -106,7 +106,7 @@
106106
"tsconfig-paths": "^3.9.0",
107107
"tsickle": "^0.39.1",
108108
"tslint": "^6.1.3",
109-
"typescript": "~4.0.3",
109+
"typescript": "~4.3.5",
110110
"wallaby-webpack": "^3.9.13",
111111
"yaml-lint": "^1.2.4"
112112
},
@@ -139,7 +139,7 @@
139139
"docs:start:dev": "ng serve --configuration=development mosaic-docs",
140140
"docs:start:prod": "ng serve --configuration=production mosaic-docs",
141141
"docs:prod-build": "ng build mosaic-docs",
142-
"docs:prod-build:aot": "ng build mosaic-docs --prod",
142+
"docs:prod-build:aot": "ng build mosaic-docs --configuration production",
143143
"docs:publish-preview": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/publish-docs-preview.ts",
144144
"docs:cleanup-preview": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/cleanup-preview.ts",
145145
"preinstall": "node tools/npm/check-npm.js",

packages/cdk/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* tslint:disable */
2-
import 'zone.js/dist/zone';
3-
import 'zone.js/dist/zone-testing';
2+
import 'zone.js';
3+
import 'zone.js/testing';
44

55
import { getTestBed } from '@angular/core/testing';
66
import {

packages/cdk/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
"flatModuleId": "@ptsecurity/cdk",
1616
"skipTemplateCodegen": true,
1717
"fullTemplateTypeCheck": true,
18-
"enableIvy": false
18+
"compilationMode": "partial"
1919
}
2020
}

packages/docs/src/app/components/anchors/anchors.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ export class AnchorsComponent {
3232
readonly isSmoothScrollSupported;
3333
noSmoothScrollDebounce = 10;
3434
debounceTime: number = 15;
35+
activeClass = 'anchors-menu__list-element_active';
36+
pathName: string;
37+
fragment = '';
3538
private destroyed: Subject<boolean> = new Subject();
36-
private fragment = '';
37-
private activeClass = 'anchors-menu__list-element_active';
3839
private scrollContainer: any;
3940
private currentUrl: any;
40-
private pathName: string;
4141

4242
constructor(private router: Router,
4343
private route: ActivatedRoute,
44-
private element: ElementRef,
44+
public element: ElementRef,
4545
private ref: ChangeDetectorRef,
4646
@Inject(DOCUMENT) private document: Document) {
4747
this.isSmoothScrollSupported = 'scrollBehavior' in this.document.documentElement.style;
@@ -69,7 +69,7 @@ export class AnchorsComponent {
6969
ngOnInit() {
7070
// attached to anchor's change in the address bar manually or by clicking on the anchor
7171
this.route.fragment.pipe(takeUntil(this.destroyed)).subscribe((fragment) => {
72-
this.fragment = fragment;
72+
this.fragment = fragment as string;
7373
const index = this.getAnchorIndex(fragment);
7474

7575
if (index) { this.setFragment(index); }
@@ -140,7 +140,7 @@ export class AnchorsComponent {
140140
}
141141

142142
private createAnchors(): IAnchor[] {
143-
const anchors = [];
143+
const anchors: any = [];
144144
const headers: HTMLElement[] = Array.from(this.document.querySelectorAll(this.headerSelectors));
145145

146146
if (headers.length) {

packages/docs/src/app/components/component-viewer/component-viewer.component.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ export class ComponentViewerComponent implements OnDestroy {
2020

2121
private destroyed: Subject<boolean> = new Subject();
2222

23-
constructor(routeActivated: ActivatedRoute,
24-
public docItems: DocumentationItems
23+
constructor(
24+
routeActivated: ActivatedRoute,
25+
public docItems: DocumentationItems
2526
) {
2627
// Listen to changes on the current route for the doc id (e.g. button/checkbox) and the
2728
// parent route for the section (mosaic/cdk).
2829

29-
combineLatest([routeActivated.params, routeActivated.parent.params]).pipe(
30-
map((p: [Params, Params]) => ({id: p[0].id, section: p[1].section})),
31-
map((p) => ({doc: docItems.getItemById(p.id, p.section), section: p.section}),
30+
combineLatest([routeActivated.params, routeActivated!.parent!.params]).pipe(
31+
map((p: [Params, Params]) => ({ id: p[0].id, section: p[1].section })),
32+
map((p) => ({ doc: docItems.getItemById(p.id, p.section), section: p.section }),
3233
takeUntil(this.destroyed))
3334
).subscribe((d) => {
34-
this.componentDocItem = d.doc;
35+
if (d.doc) {
36+
this.componentDocItem = d.doc;
37+
}
3538
});
3639
}
3740

@@ -137,11 +140,17 @@ export class ComponentOverviewComponent implements OnDestroy {
137140

138141
copyCode = (event: Event) => {
139142
const codeCopyAnimationTime = 1000;
140-
const copyBlock = (<HTMLElement> event.target).parentElement.parentElement;
143+
const copyBlock = (<HTMLElement> event.target)!.parentElement!.parentElement;
144+
145+
if (!copyBlock) { return; }
141146

142147
const range = document.createRange();
143148
range.selectNodeContents(copyBlock);
149+
144150
const sel = window.getSelection();
151+
152+
if (!sel) { return; }
153+
145154
sel.removeAllRanges();
146155
sel.addRange(range);
147156
document.execCommand('copy');

packages/docs/src/app/components/main-layout/main-layout.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
77
styleUrls: ['./main-layout.component.scss']
88
})
99
export class MainLayoutComponent {
10-
nextRoute: string = '';
10+
nextRoute: string | null = '';
1111
extras: NavigationExtras = {
1212
preserveFragment: true,
1313
queryParamsHandling: 'preserve'
1414
};
1515

16-
constructor(private router: Router,
17-
private route: ActivatedRoute) {
16+
constructor(
17+
private router: Router,
18+
public route: ActivatedRoute
19+
) {
1820
const href = location.href;
1921

2022
if (href.match('github')) {

packages/docs/src/app/components/navbar/navbar-property.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ export class NavbarProperty {
2828
setValue(i: number) {
2929
this.currentValue = this.data[i];
3030
localStorage.setItem(this.property, `${i}`);
31-
if (this.updateTemplate) { this.updateTemplate(i); }
31+
if (this.updateTemplate) { this.updateTemplate(); }
3232
if (this.updateSelected) { this.updateSelected(i); }
3333
}
3434

3535
init() {
36-
const currentValue = +localStorage.getItem(this.property);
36+
const currentValue = parseInt(localStorage.getItem(this.property) as string);
3737

3838
if (currentValue) {
3939
this.setValue(currentValue);
@@ -42,7 +42,7 @@ export class NavbarProperty {
4242
}
4343
}
4444

45-
private updateTemplate(i: number) {
45+
private updateTemplate() {
4646
if (this.currentValue) {
4747
for (const color of this.data) {
4848
document.body.classList.remove(color.className);

0 commit comments

Comments
 (0)