Skip to content

Commit

Permalink
perf(form): performance templates
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed May 28, 2018
1 parent 33e2079 commit 0b73da0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<% if(modal) { %><div class="modal-header">
<div class="modal-title">编辑 {{ record.id }} 用户信息</div>
<div class="modal-title">编辑 {{ record.id }} 信息</div>
</div>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
<button nz-button type="submit" [nzType]="'primary'" (click)="save(sf.value)" [disabled]="!sf.valid" [nzLoading]="http.loading">保存</button>
</div>
</sf><% } else { %><page-header [title]="'编辑 ' + id + ' 用户信息'"></page-header>
</sf><% } else { %><page-header [title]="'编辑 ' + id + ' 信息'"></page-header>
<nz-card>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { Component, OnInit, ViewChild<% if(!!viewEncapsulation) { %>, ViewEncaps
@Component({
selector: '<%= selector %>',<% if(inlineTemplate) { %>
template: `<% if(modal) { %><div class="modal-header">
<div class="modal-title">编辑 {{ record.id }} 用户信息</div>
<div class="modal-title">编辑 {{ record.id }} 信息</div>
</div>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
<button nz-button type="submit" [nzType]="'primary'" (click)="save(sf.value)" [disabled]="!sf.valid" [nzLoading]="http.loading">保存</button>
</div>
</sf><% } else { %><page-header [title]="'编辑 ' + id + ' 用户信息'"></page-header>
</sf><% } else { %><page-header [title]="'编辑 ' + id + ' 信息'"></page-header>
<nz-card>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<page-header [title]="'Page Name'"></page-header>
<page-header></page-header>
<nz-card>
<sf mode="search" [schema]="searchSchema" [formData]="params" (formSubmit)="st.reset($event)" (formReset)="st.reset(params)"></sf>
<div class="my-sm">
<button (click)="add()" nz-button nzType="primary">新建</button>
</div>
<simple-table #st [data]="url" [columns]="columns" [extraParams]="params"></simple-table>
</nz-card>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import { SFSchema } from '@delon/form';
@Component({
selector: '<%= selector %>',<% if(inlineTemplate) { %>
template: `
<page-header [title]="'Page Name'"></page-header>
<page-header></page-header>
<nz-card>
<sf mode="search" [schema]="searchSchema" [formData]="params" (formSubmit)="st.reset($event)" (formReset)="st.reset(params)"></sf>
<div class="my-sm">
<button (click)="add()" nz-button nzType="primary">新建</button>
</div>
<simple-table #st [data]="url" [columns]="columns" [extraParams]="params"></simple-table>
</nz-card>
`,<% } else { %>
Expand Down Expand Up @@ -48,4 +51,6 @@ export class <%= componentName %> implements OnInit {

ngOnInit() { }

add() { }

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if(modal) { %><div class="modal-header">
<div class="modal-title">查看 {{ record.id }} 用户信息</div>
<div class="modal-title">查看 {{ record.id }} 信息</div>
</div>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<desc-list *ngIf="i">
Expand All @@ -11,7 +11,7 @@
</desc-list>
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
</div><% } else { %><page-header [title]="'查看 ' + id + ' 用户信息'"></page-header>
</div><% } else { %><page-header [title]="'查看 ' + id + ' 信息'"></page-header>
<nz-card>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<desc-list *ngIf="i">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Component, OnInit<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }
selector: '<%= selector %>',<% if(inlineTemplate) { %>
template: `<% if(modal) { %>
<div class="modal-header">
<div class="modal-title">查看 {{ record.id }} 用户信息</div>
<div class="modal-title">查看 {{ record.id }} 信息</div>
</div>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<desc-list *ngIf="i">
Expand All @@ -19,7 +19,7 @@ import { Component, OnInit<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }
</desc-list>
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
</div><% } else { %><page-header [title]="'查看 ' + id + ' 用户信息'"></page-header>
</div><% } else { %><page-header [title]="'查看 ' + id + ' 信息'"></page-header>
<nz-card>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<desc-list *ngIf="i">
Expand Down

0 comments on commit 0b73da0

Please sign in to comment.