Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #39 from zhytang/add-zhytang
Browse files Browse the repository at this point in the history
Support AOT (#28)
  • Loading branch information
surmon-china committed Feb 18, 2020
2 parents d4766ad + 42dc93b commit 9e318eb
Show file tree
Hide file tree
Showing 51 changed files with 179 additions and 168 deletions.
10 changes: 6 additions & 4 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": false,
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
"scripts": [
]
},
"configurations": {
"production": {
Expand Down Expand Up @@ -95,7 +96,8 @@
"styles": [
"src/styles.scss"
],
"scripts": []
"scripts": [
]
}
},
"lint": {
Expand Down Expand Up @@ -126,4 +128,4 @@
}
}},
"defaultProject": "angular-admin"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"ng": "ng",
"dev": "ng serve --proxy-config proxy.conf.json --hmr",
"build": "ng build --prod --aot=false --build-optimizer=false",
"build": "ng build --prod --aot --build-optimizer=false",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type TMenuCollapsedState = boolean;
@Component({
selector: 'app-admin',
encapsulation: ViewEncapsulation.None,
styles: [require('./styles/app.scss')],
styleUrls: ['./styles/app.scss'],
template: `
<main [ngClass]="isMenuCollapsed ? 'menu-collapsed': ''">
<ngx-loading-bar color="#017170" height="4px" diameter="20px"></ngx-loading-bar>
Expand All @@ -34,10 +34,10 @@ type TMenuCollapsedState = boolean;
})
export class AppComponent implements AfterViewInit, OnInit {

private isMenuCollapsed: TMenuCollapsedState = false;
public isMenuCollapsed: TMenuCollapsedState = false;

// 通知配置
private notificationsOptions = {
public notificationsOptions = {
position: ['top', 'right'],
timeOut: 300,
lastOnBottom: true,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/saCard/saCard.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="animated fadeIn card {{ cardType }} {{ baCardClass || '' }}">
<div class="animated fadeIn card {{ baCardClass || '' }}">
<div *ngIf="title" class="card-header clearfix">
<h3 class="card-title">{{ title }}</h3>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/app/components/saCheckbox/saCheckbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms';
@Component({
selector: 'sa-checkbox[ngModel]',
styleUrls: ['./saCheckbox.component.scss'],
providers: [NgModel],
templateUrl: './saCheckbox.component.html'
})
export class SaCheckboxComponent implements ControlValueAccessor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import '~app/styles/base/init';

@import '~highlight.js/styles/ocean.css';
@import '~codemirror/lib/codemirror.css';
@import '~codemirror/theme/base16-dark.css';
@import '~codemirror/addon/fold/foldgutter.css';

.markdown-editor {

&.fullscreen {
Expand Down Expand Up @@ -219,4 +224,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,8 @@ marked.setOptions({
@Component({
selector: 'sa-markdown-editor',
templateUrl: './markdownEditor.component.html',
styles: [
require('./markdownEditor.component.scss'),
require('highlight.js/styles/ocean.css'),
require('codemirror/lib/codemirror.css'),
require('codemirror/theme/base16-dark.css'),
require('codemirror/addon/fold/foldgutter.css')
styleUrls: [
'./markdownEditor.component.scss'
],
providers: [{
provide: NG_VALUE_ACCESSOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<a
*ngIf="!menuItem.children && !menuItem.url"
(mouseenter)="onHoverItem($event, item)"
(mouseenter)="onHoverItem($event)"
[routerLink]="menuItem.route.paths"
class="al-sidebar-list-link"
>
Expand All @@ -20,7 +20,7 @@
</a>
<a
*ngIf="!menuItem.children && menuItem.url"
(mouseenter)="onHoverItem($event, item)"
(mouseenter)="onHoverItem($event)"
[href]="menuItem.url"
[target]="menuItem.target"
class="al-sidebar-list-link"
Expand All @@ -32,7 +32,7 @@
href
class="al-sidebar-list-link"
*ngIf="menuItem.children"
(mouseenter)="onHoverItem($event, item)"
(mouseenter)="onHoverItem($event)"
(click)="onToggleSubMenu($event, menuItem)"
>
<i *ngIf="menuItem.icon" class="{{ menuItem.icon }}"></i>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/saMenu/saMenu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class SaMenuComponent implements OnInit, OnDestroy {
private router: Router,
private service: SaMenuService,
private state: GlobalState,
private appState: AppState
readonly appState: AppState
) {
this.onRouteChange = this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ControlValueAccessor, NgModel } from '@angular/forms';
@Component({
selector: 'sa-multi-checkbox[ngModel]',
templateUrl: './saMultiCheckbox.component.html',
providers: [NgModel]
})
export class SaMultiCheckboxComponent implements ControlValueAccessor {

Expand Down
4 changes: 2 additions & 2 deletions src/app/components/saPageHeader/saPageHeader.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ type TCollapsedState = boolean;
})
export class SaPageHeaderComponent {

private APP_TITLE = APP_TITLE;
public APP_TITLE = APP_TITLE;

public isScrolled: TCollapsedState = false;
public isMenuCollapsed: TCollapsedState = false;

constructor(
private router: Router,
private state: GlobalState,
private appState: AppState
readonly appState: AppState
) {
this.state.subscribe('menu.isCollapsed', isCollapsed => {
this.isMenuCollapsed = isCollapsed;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/saSidebar/saSidebar.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<aside class="al-sidebar" (mouseleave)="hoverElemTop=outOfArea" sidebarResize>
<aside class="al-sidebar" sidebarResize>
<sa-menu
[menuRoutes]="routes"
[menuHeight]="menuHeight"
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/announcement/announcement.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h5>公告内容</h5>
<form
class="pull-right form-inline navbar-form announcement-search-form"
[formGroup]="searchForm"
(ngSubmit)="submitSearchForm(searchForm.value)"
(ngSubmit)="submitSearchForm()"
>
<div class="input-group" style="margin: 0">
<input
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/announcement/announcement.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const DEFAULT_SEARCH_FORM = {
})
export class AnnouncementComponent implements OnInit {

private Loading = ELoading;
private PublishState = EPublishState;
private controlStateClass = formControlStateClass;
public Loading = ELoading;
public PublishState = EPublishState;
public controlStateClass = formControlStateClass;
private apiPath: TApiPath = API_PATH.ANNOUNCEMENT;

@ViewChild('delModal', { static: false }) delModal: ModalDirective;
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/announcement/announcement.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ import { AnnouncementComponent } from './announcement.component';
AnnouncementComponent
]
})
export default class AnnouncementModule {}
export class AnnouncementModule {}
2 changes: 1 addition & 1 deletion src/app/pages/article/article.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ import { ArticleEditCategoryComponent } from './components/edit/components/categ
ArticleCategoryListComponent
]
})
export default class ArticleModule {}
export class ArticleModule {}
2 changes: 2 additions & 0 deletions src/app/pages/article/article.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface IArticle {
tag: ITag[];
category: ICategory[];
extends: IDataExtends[];
password?: string;
thumb?: string;
}

// 分类数据
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ArticleCategoryComponent implements OnInit {
@ViewChild('delModal', { static: false }) delModal: ModalDirective;
@ViewChild('editCategoryForm', { static: false }) editCategoryForm;

private Loading = ELoading;
public Loading = ELoading;
private apiPath: TApiPath = API_PATH.CATEGORY;

public categories: TResponsePaginationCategory = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ArticleCategoryAddComponent implements OnChanges {

@Input() fetching: IFetching;
@Input() category: ICategory;
@Input() categories: IResponsePaginationData<ICategory>;
@Input() categories: IResponsePaginationData<ICategory>[];
@Output() resetForm: EventEmitter<any> = new EventEmitter();
@Output() submitForm: EventEmitter<any> = new EventEmitter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class ArticleCategoryListComponent {
@Output() editCategoryRequest = new EventEmitter();
@Output() refreshList = new EventEmitter();

private getCategoryPath = getCategoryPath;
public getCategoryPath = getCategoryPath;

public categoriesSelectAll: TSelectedAll = false;
public selectedCategories: TSelectedIds = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p class="text-muted" *ngIf="!categories.length;else dstaList">暂无分类</p>
<ng-template #dstaList>
<div [title]="category.name" class="category-item-checkbox" *ngFor="let category of categories">
<sa-checkbox [(ngModel)]="category.checked" (ngModelChange)="itemSelectChange($event, category)">
<sa-checkbox [(ngModel)]="category.checked" (ngModelChange)="itemSelectChange()">
<span sa-checkbox-label>
<span>&nbsp;</span>
<span *ngIf="category.level"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ArticleEditCategoryComponent implements OnInit, OnChanges {
@Input() category;
@Output() categoryChange: EventEmitter<any> = new EventEmitter();

private Loading = ELoading;
public Loading = ELoading;
private apiPath: TApiPath = API_PATH.CATEGORY;

public categories: ICategory[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ enum ELoading {
})
export class ArticleEditMainComponent implements OnInit, OnChanges {

private Loading = ELoading;
public Loading = ELoading;
private tagApiPath: TApiPath = API_PATH.TAG;
private controlStateClass = formControlStateClass;
public controlStateClass = formControlStateClass;

@Input() isSubmited;
@Input() tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { EOriginState, EPublicState, EPublishState } from '@app/constants/state'

export class ArticleEditSubmitComponent {

private OriginState = EOriginState;
private PublicState = EPublicState;
private PublishState = EPublishState;
public OriginState = EOriginState;
public PublicState = EPublicState;
public PublishState = EPublishState;

@Input() isEdit;
@Input() state;
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/article/components/edit/edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ArticleEditComponent implements OnInit {

private Loading = ELoading;
private apiPath: TApiPath = API_PATH.ARTICLE;
private isSubmited: boolean = false;
public isSubmited: boolean = false;

// 文章内容
public article_id: TArticleId = null;
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/article/components/list/list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h4 class="modal-title">确认操作</h4>
<span class="icon text-danger">
<i class="ion-md-information-circle-outline"></i>
</span>
<span>确定要删除{{ todoDelArticle ? '这篇' : '选中' }}文章吗?本操作不可逆</span>
<span>确定要删除{{ todoDelArticleId ? '这篇' : '选中' }}文章吗?本操作不可逆</span>
</div>
</div>
<div class="modal-footer">
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/article/components/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ArticleListComponent implements OnInit {

@ViewChild('delModal', { static: false }) delModal: ModalDirective;

private getArticlePath = getArticlePath;
public getArticlePath = getArticlePath;

private tagApiPath: TApiPath = API_PATH.TAG;
private articleApiPath: TApiPath = API_PATH.ARTICLE;
Expand Down Expand Up @@ -128,7 +128,7 @@ export class ArticleListComponent implements OnInit {
}

// 弹窗
public delArticleModal(articleId: string) {
public delArticleModal(articleId?: string) {
this.todoDelArticleId = articleId;
this.delModal.show();
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/article/components/tag/tag.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ArticleTagComponent implements OnInit {
@ViewChild('delModal', { static: false }) delModal: ModalDirective;

private apiPath: TApiPath = API_PATH.TAG;
private getTagPath = getTagPath;
public getTagPath = getTagPath;

public editForm: FormGroup;
public searchForm: FormGroup;
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/auth/auth.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#pwdInput
*ngIf="editMode"
[(ngModel)]="password"
(keyup.esc)="quitEdit($event)"
(keyup.enter)="onEnter($event)"
(keyup.esc)="quitEdit()"
(keyup.enter)="onEnter()"
(blur)="quitEdit()"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/auth/auth.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class AuthComponent implements AfterViewChecked {

@ViewChild('pwdInput', { static: false }) input: ElementRef;

private password = '';
private editMode = false;
public password = '';
public editMode = false;

constructor(
private router: Router,
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ import { AuthComponent } from './auth.component';
AuthComponent
]
})
export default class AuthModule {}
export class AuthModule {}
2 changes: 1 addition & 1 deletion src/app/pages/comment/comment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ import { CommentDetailComponent } from './components/detail';
CommentDetailComponent
]
})
export default class CommentModule {}
export class CommentModule {}
8 changes: 4 additions & 4 deletions src/app/pages/comment/components/detail/detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ enum ELoading { GetDetail, Update, GetList, GetArticle }
})
export class CommentDetailComponent implements OnInit {

private Loading = ELoading;
private CommentState = ECommentState;
private CommentPostType = ECommentPostType;
private controlStateClass = formControlStateClass;
public Loading = ELoading;
public CommentState = ECommentState;
public CommentPostType = ECommentPostType;
public controlStateClass = formControlStateClass;
private apiPath: TApiPath = API_PATH.COMMENT;

public osParser = osParser;
Expand Down
Loading

0 comments on commit 9e318eb

Please sign in to comment.