Skip to content

Commit f2e175e

Browse files
committed
chore: upgrade angular to 8.x & zorro to 7.x
1 parent 5f03088 commit f2e175e

19 files changed

+1398
-1196
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ testem.log
4242
# System Files
4343
.DS_Store
4444
Thumbs.db
45-
package-lock.json
45+
package-lock.json

angular.json

+19-26
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@
1919
"assets": [
2020
"src/assets",
2121
"src/mock",
22-
"src/favicon.ico"
22+
"src/favicon.ico",
23+
{
24+
"glob": "**/*",
25+
"input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",
26+
"output": "/assets/"
27+
}
2328
],
2429
"styles": [
2530
"node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css",
2631
"src/styles.scss"
2732
],
28-
"scripts": [
29-
"node_modules/jquery/dist/jquery.min.js"
30-
]
33+
"scripts": ["node_modules/jquery/dist/jquery.min.js"]
3134
},
3235
"configurations": {
3336
"production": {
@@ -40,10 +43,12 @@
4043
"extractLicenses": true,
4144
"vendorChunk": false,
4245
"buildOptimizer": true,
43-
"fileReplacements": [{
44-
"replace": "src/environments/environment.ts",
45-
"with": "src/environments/environment.prod.ts"
46-
}]
46+
"fileReplacements": [
47+
{
48+
"replace": "src/environments/environment.ts",
49+
"with": "src/environments/environment.prod.ts"
50+
}
51+
]
4752
}
4853
}
4954
},
@@ -71,18 +76,12 @@
7176
"karmaConfig": "./karma.conf.js",
7277
"polyfills": "src/polyfills.ts",
7378
"tsConfig": "src/tsconfig.spec.json",
74-
"scripts": [
75-
"node_modules/jquery/dist/jquery.min.js"
76-
],
79+
"scripts": ["node_modules/jquery/dist/jquery.min.js"],
7780
"styles": [
7881
"node_modules/ng-zorro-antd/src/ng-zorro-antd.min.css",
7982
"src/styles.scss"
8083
],
81-
"assets": [
82-
"src/assets",
83-
"src/mock",
84-
"src/favicon.ico"
85-
]
84+
"assets": ["src/assets", "src/mock", "src/favicon.ico"]
8685
}
8786
},
8887
"lint": {
@@ -92,9 +91,7 @@
9291
"src/tsconfig.app.json",
9392
"src/tsconfig.spec.json"
9493
],
95-
"exclude": [
96-
"**/node_modules/**"
97-
]
94+
"exclude": ["**/node_modules/**"]
9895
}
9996
}
10097
}
@@ -114,12 +111,8 @@
114111
"lint": {
115112
"builder": "@angular-devkit/build-angular:tslint",
116113
"options": {
117-
"tsConfig": [
118-
"e2e/tsconfig.e2e.json"
119-
],
120-
"exclude": [
121-
"**/node_modules/**"
122-
]
114+
"tsConfig": ["e2e/tsconfig.e2e.json"],
115+
"exclude": ["**/node_modules/**"]
123116
}
124117
}
125118
}
@@ -135,4 +128,4 @@
135128
"prefix": "app"
136129
}
137130
}
138-
}
131+
}

package.json

+46-45
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"scripts": {
77
"ng": "ng",
8-
"start": "ng serve --port 8888",
8+
"start": "ng serve --port 8888 -o",
99
"build": "ng build",
1010
"aot": "ng build --prod --aot",
1111
"test": "ng test",
@@ -21,53 +21,54 @@
2121
},
2222
"private": true,
2323
"dependencies": {
24-
"@angular/animations": "^6.0.6",
25-
"@angular/common": "^6.0.6",
26-
"@angular/compiler": "^6.0.6",
27-
"@angular/core": "^6.0.6",
28-
"@angular/forms": "^6.0.6",
29-
"@angular/http": "^6.0.6",
30-
"@angular/platform-browser": "^6.0.6",
31-
"@angular/platform-browser-dynamic": "^6.0.6",
32-
"@angular/router": "^6.0.6",
33-
"@stackblitz/sdk": "^1.2.0",
34-
"bootstrap": "^3.3.7",
35-
"copy-text-to-clipboard": "^1.0.4",
36-
"core-js": "^2.4.1",
24+
"@angular/animations": "^8.0.3",
25+
"@angular/common": "^8.0.3",
26+
"@angular/compiler": "^8.0.3",
27+
"@angular/core": "^8.0.3",
28+
"@angular/forms": "^8.0.3",
29+
"@angular/http": "^7.2.15",
30+
"@angular/platform-browser": "^8.0.3",
31+
"@angular/platform-browser-dynamic": "^8.0.3",
32+
"@angular/router": "^8.0.3",
33+
"@ant-design/icons-angular": "^8.0.0",
34+
"@stackblitz/sdk": "^1.3.0",
35+
"bootstrap": "^4.3.1",
36+
"copy-text-to-clipboard": "^2.1.0",
37+
"core-js": "^3.1.4",
3738
"lodash": "^4.17.11",
38-
"ng-ace-tern": "^1.1.0",
39-
"ng-zorro-antd": "^1.1.1",
40-
"ngx-highlightjs": "^2.1.1",
41-
"ngx-md": "^6.0.9",
42-
"rxjs": "^6.2.1",
43-
"rxjs-compat": "^6.0.0-rc.0",
44-
"strip-json-comments": "^2.0.1",
45-
"z-schema": "^3.19.0",
46-
"zone.js": "^0.8.26"
39+
"ng-zorro-antd": "^7.5.1",
40+
"ngx-ace-tern": "^1.2.2",
41+
"ngx-highlightjs": "2.1.1",
42+
"ngx-md": "^7.1.3",
43+
"rxjs": "^6.5.2",
44+
"rxjs-compat": "^6.5.2",
45+
"strip-json-comments": "^3.0.1",
46+
"z-schema": "^4.1.0",
47+
"zone.js": "^0.9.1"
4748
},
4849
"devDependencies": {
49-
"@angular-devkit/build-angular": "~0.6.8",
50-
"@angular-devkit/core": "0.0.29",
51-
"@angular/cli": "^6.0.8",
52-
"@angular/compiler-cli": "^6.0.6",
53-
"@angular/language-service": "^6.0.6",
54-
"@types/jasmine": "~2.5.53",
55-
"@types/jasminewd2": "~2.0.2",
56-
"@types/node": "~6.0.60",
57-
"jasmine-core": "~2.6.2",
58-
"jasmine-spec-reporter": "~4.1.0",
59-
"jquery": "^3.3.1",
50+
"@angular-devkit/build-angular": "~0.800.4",
51+
"@angular-devkit/core": "8.0.4",
52+
"@angular/cli": "^8.0.4",
53+
"@angular/compiler-cli": "^8.0.3",
54+
"@angular/language-service": "^8.0.3",
55+
"@types/jasmine": "~3.3.13",
56+
"@types/jasminewd2": "~2.0.6",
57+
"@types/node": "~12.0.10",
58+
"jasmine-core": "~3.4.0",
59+
"jasmine-spec-reporter": "~4.2.1",
60+
"jquery": "^3.4.1",
6061
"json-loader": "^0.5.7",
61-
"karma": "~1.7.0",
62-
"karma-chrome-launcher": "~2.1.1",
63-
"karma-cli": "~1.0.1",
64-
"karma-coverage-istanbul-reporter": "^1.2.1",
65-
"karma-jasmine": "~1.1.0",
66-
"karma-jasmine-html-reporter": "^0.2.2",
67-
"protractor": "^5.3.2",
68-
"raw-loader": "^0.5.1",
69-
"ts-node": "~3.2.0",
70-
"tslint": "~5.7.0",
71-
"typescript": "~2.7.2"
62+
"karma": "~4.1.0",
63+
"karma-chrome-launcher": "~2.2.0",
64+
"karma-cli": "~2.0.0",
65+
"karma-coverage-istanbul-reporter": "^2.0.5",
66+
"karma-jasmine": "~2.0.1",
67+
"karma-jasmine-html-reporter": "^1.4.2",
68+
"protractor": "^5.4.2",
69+
"raw-loader": "^1.0.0",
70+
"ts-node": "~8.3.0",
71+
"tslint": "~5.18.0",
72+
"typescript": "3.4.2"
7273
}
7374
}

src/app/app-routing.module.ts

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
import { NgModule } from "@angular/core";
2-
import { Routes, RouterModule } from "@angular/router";
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
33

4-
import { SharedModule } from "./shared/shared.module";
5-
import { DndModule } from "../lib/dnd/dnd.module";
6-
import { ZorroFormComponent } from "./pages/zorro-form/zorro-form.component";
7-
import { BootstrapFormComponent } from "./pages/bootstrap-form/bootstrap-form.component";
8-
import { DndComponent } from "./pages/dnd-form/dnd.component";
9-
import { DocumentComponent } from "./document/document.component";
4+
import { SharedModule } from './shared/shared.module';
5+
import { DndModule } from '../lib/dnd/dnd.module';
6+
import { ZorroFormComponent } from './pages/zorro-form/zorro-form.component';
7+
import { BootstrapFormComponent } from './pages/bootstrap-form/bootstrap-form.component';
8+
// import { DndComponent } from "./pages/dnd-form/dnd.component";
9+
import { DocumentComponent } from './document/document.component';
1010

1111
const routes: Routes = [
1212
{ path: '', redirectTo: 'zorro', pathMatch: 'full' },
13-
{ path: 'dnd', component: DndComponent },
13+
// { path: 'dnd', component: DndComponent },
1414
{ path: 'bootstrap', component: BootstrapFormComponent },
1515
{ path: 'zorro', component: ZorroFormComponent },
16-
{ path: 'document', redirectTo: 'document/getting-started', pathMatch: 'full' },
16+
{
17+
path: 'document',
18+
redirectTo: 'document/getting-started',
19+
pathMatch: 'full'
20+
},
1721
{
1822
path: 'document/:id',
1923
component: DocumentComponent
@@ -24,7 +28,7 @@ const routes: Routes = [
2428
declarations: [
2529
BootstrapFormComponent,
2630
ZorroFormComponent,
27-
DndComponent,
31+
// DndComponent,
2832
DocumentComponent
2933
],
3034
imports: [
@@ -34,4 +38,4 @@ const routes: Routes = [
3438
],
3539
exports: []
3640
})
37-
export class AppRoutingModule { }
41+
export class AppRoutingModule {}

src/app/app.component.ts

+41-37
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,54 @@
1-
import { Component, ViewChild, ViewEncapsulation, OnDestroy } from '@angular/core';
1+
import {
2+
Component,
3+
ViewChild,
4+
ViewEncapsulation,
5+
OnDestroy
6+
} from '@angular/core';
27
import { Title } from '@angular/platform-browser';
38
import { NavigationEnd, Router } from '@angular/router';
49
import { Subscription } from 'rxjs';
510
import { NavComponent } from './layout/nav/nav.component';
611
import { BuilderService } from './services/builder-service';
712
import { StartUpService } from './services/startup.service';
813

9-
1014
@Component({
11-
selector: 'sf-app',
12-
templateUrl: './app.component.html',
13-
encapsulation: ViewEncapsulation.None,
14-
styleUrls: ["./app.component.scss"],
15-
providers: [BuilderService]
15+
selector: 'sf-app',
16+
templateUrl: './app.component.html',
17+
encapsulation: ViewEncapsulation.None,
18+
styleUrls: ['./app.component.scss'],
19+
providers: [BuilderService]
1620
})
17-
export class AppComponent implements OnDestroy{
18-
@ViewChild('nav') navRef: NavComponent;
21+
export class AppComponent implements OnDestroy {
22+
@ViewChild('nav', { static: false }) navRef: NavComponent;
1923

20-
subject: Subscription;
21-
constructor(
22-
private router: Router,
23-
private titleService: Title,
24-
private startUpService: StartUpService,
25-
private builderService: BuilderService
26-
) {
27-
this.subject = builderService.builderChanged.subscribe(value => {
28-
this.navRef._builder_type = value || 'zorro';
29-
});
30-
this.startUpService.initData().then(() => {
31-
this.startUpService.mockChanged.next('mock chaged')
32-
});
33-
}
24+
subject: Subscription;
25+
constructor(
26+
private router: Router,
27+
private titleService: Title,
28+
private startUpService: StartUpService,
29+
private builderService: BuilderService
30+
) {
31+
this.subject = builderService.builderChanged.subscribe(value => {
32+
this.navRef._builder_type = value || 'zorro';
33+
});
34+
this.startUpService.initData().then(() => {
35+
this.startUpService.mockChanged.next('mock chaged');
36+
});
37+
}
3438

35-
ngOnInit() {
36-
this.router.events
37-
.subscribe((event) => {
38-
if (event instanceof NavigationEnd) { // 当导航成功结束时执行
39-
let title = event.url.substr(1);
40-
this.titleService.setTitle(`${title} builder`);
41-
this.builderService.builderChanged.next(title);
42-
this.startUpService.mockChanged.next('route mock chaged');
43-
}
44-
});
45-
}
39+
ngOnInit() {
40+
this.router.events.subscribe(event => {
41+
if (event instanceof NavigationEnd) {
42+
// 当导航成功结束时执行
43+
let title = event.url.substr(1);
44+
this.titleService.setTitle(`${title} builder`);
45+
this.builderService.builderChanged.next(title);
46+
this.startUpService.mockChanged.next('route mock chaged');
47+
}
48+
});
49+
}
4650

47-
ngOnDestroy() {
48-
this.subject.unsubscribe();
49-
}
51+
ngOnDestroy() {
52+
this.subject.unsubscribe();
53+
}
5054
}

src/app/document/document.component.html

+18-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,33 @@
44
<li nz-menu-group>
55
<div title>入门</div>
66
<ul>
7-
<li nz-menu-item *ngFor="let i of data.basic" [routerLink]="'/document/' + i.id" routerLinkActive="ant-menu-item-selected">{{i.title}}</li>
7+
<li
8+
nz-menu-item
9+
*ngFor="let i of data.basic"
10+
[routerLink]="'/document/' + i.id"
11+
routerLinkActive="ant-menu-item-selected"
12+
>
13+
{{ i.title }}
14+
</li>
815
</ul>
916
</li>
1017
<li nz-menu-group>
1118
<div title>小部件</div>
1219
<ul>
13-
<li nz-menu-item *ngFor="let i of data.widgets" [routerLink]="'/document/' + i.id" routerLinkActive="ant-menu-item-selected">{{i.id}}-{{i.title}}</li>
20+
<li
21+
nz-menu-item
22+
*ngFor="let i of data.widgets"
23+
[routerLink]="'/document/' + i.id"
24+
routerLinkActive="ant-menu-item-selected"
25+
>
26+
{{ i.id }}-{{ i.title }}
27+
</li>
1428
</ul>
1529
</li>
1630
</ul>
1731
</nz-sider>
1832
<nz-content class="markdown" *ngIf="item" class="bg-white doc">
19-
<h1>{{item.title}}</h1>
33+
<h1>{{ item.title }}</h1>
2034
<markdown [data]="item.content"></markdown>
2135
</nz-content>
22-
</nz-layout>
36+
</nz-layout>

0 commit comments

Comments
 (0)