forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NG-ZORRO#4 from HhQr/develop
Develop
- Loading branch information
Showing
11 changed files
with
264 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/showcase/custom-demo/shipper-select/shipper-select-demo-basic.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NzMessageService } from "../../../components/ng-zorro-antd.module"; | ||
|
||
@Component({ | ||
selector: 'shipper-select-demo-basic', | ||
template: ` | ||
<shipper-select [(ngModel)]="value"></shipper-select> | ||
<button nz-button [nzType]="'primary'" (click)="handle()">获取发货人编号</button> | ||
`, | ||
styles: [] | ||
}) | ||
export class ShipperSelectDemoBasicComponent implements OnInit { | ||
value: string = ""; | ||
constructor(private _message: NzMessageService) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
handle() { | ||
this._message.info('发货人编号值为:'+this.value); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/showcase/custom-demo/shipper-select/shipper-select-demo-multiple.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NzMessageService } from "../../../components/ng-zorro-antd.module"; | ||
|
||
@Component({ | ||
selector: 'shipper-select-demo-multiple', | ||
template: ` | ||
<shipper-select [(ngModel)]="value" [shipperMode]="'multiple'"></shipper-select> | ||
<button nz-button [nzType]="'primary'" (click)="handle()">获取发货人编号数组</button> | ||
`, | ||
styles: [] | ||
}) | ||
export class ShipperSelectDemoMultipleComponent implements OnInit { | ||
value: any[] = []; | ||
constructor(private _message: NzMessageService) { } | ||
|
||
ngOnInit() { | ||
} | ||
handle() { | ||
this._message.info("发货人编号数组为:"+this.value); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/showcase/custom-demo/shipper-select/shipper-select-demo-template.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { NzMessageService } from "../../../components/ng-zorro-antd.module"; | ||
|
||
@Component({ | ||
selector: 'shipper-select-demo-template', | ||
template: ` | ||
<shipper-select [(ngModel)]="value" [customTemplate]="content" [valueType]="'object'"> | ||
<ng-template #content let-name="name" let-idBak="idBak"> | ||
<div class="wrap"> | ||
<span class="font-style border-right">{{name}}</span> | ||
<span class="font-style">{{idBak}}</span> | ||
</div> | ||
</ng-template> | ||
</shipper-select> | ||
<button nz-button [nzType]="'primary'" (click)="handle()">获取发货人编号</button> | ||
`, | ||
styles: [` | ||
.border-right{ | ||
border-right:1px solid #ECECEC; | ||
padding-right: 10px; | ||
margin-right: 10px; | ||
} | ||
`] | ||
}) | ||
export class ShipperSelectDemoTemplateComponent implements OnInit { | ||
value: any; | ||
constructor(private _message: NzMessageService) { } | ||
|
||
ngOnInit() { | ||
} | ||
handle() { | ||
this._message.info('获取发货人编号为:'+this.value); | ||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
src/showcase/custom-demo/shipper-select/shipper-select-demo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<article> | ||
<section class="markdown"> | ||
<h1>shipper-select 发货人选择</h1> | ||
<section class="markdown"> | ||
<p>使用nz-select组件封装发货人选择组件</p> | ||
<h2 id="何时使用"><span>如何使用</span> | ||
<a class="anchor">#</a> | ||
</h2> | ||
<p>输入发货人关键字,显示发货人</p> | ||
</section> | ||
<h2>代码演示<i class="code-box-expand-trigger anticon anticon-appstore" title="展开全部代码"></i></h2> | ||
</section> | ||
<div nz-row [nzGutter]="8"> | ||
<div nz-col [nzSpan]="12"> | ||
<nz-code-box [nzTitle]="'基本使用'" id="shipper-select-demo-basic" [nzCode]="ShipperSelectDemoBasicCode"> | ||
<shipper-select-demo-basic demo></shipper-select-demo-basic> | ||
<div intro> | ||
<p>基本使用。</p> | ||
</div> | ||
</nz-code-box> | ||
</div> | ||
<div nz-col [nzSpan]="12"> | ||
<nz-code-box [nzTitle]="'多选发货人'" id="shipper-select-demo-multiple" [nzCode]="ShipperSelectDemoMultipleComponent"> | ||
<shipper-select-demo-multiple demo></shipper-select-demo-multiple> | ||
<div intro> | ||
<p>下拉框支持多选功能,并返回数组的形式</p> | ||
</div> | ||
</nz-code-box> | ||
</div> | ||
<div nz-col [nzSpan]="12"> | ||
<nz-code-box [nzTitle]="'自定义模板'" id="shipper-select-demo-multiple" [nzCode]="ShipperSelectDemoTemplateComponent"> | ||
<shipper-select-demo-template demo></shipper-select-demo-template> | ||
<div intro> | ||
<p>使用[customTemplate]传入template模板,可以实现自定义下拉框样式及定制内容</p> | ||
</div> | ||
</nz-code-box> | ||
</div> | ||
</div> | ||
<section class="markdown api-container"> | ||
<h2 id="API"><span>API</span> | ||
<!-- <a class="anchor">#</a> --> | ||
</h2> | ||
<h3 id="Select props"><span>shipper-select</span> | ||
<!-- <a class="anchor">#</a> --> | ||
</h3> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>参数</th> | ||
<th>说明</th> | ||
<th>类型</th> | ||
<th>默认值</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>ngModel</td> | ||
<td>指定当前选中的条目,支持双向绑定</td> | ||
<td> | ||
Array(多选)/String/Object(单选) | ||
</td> | ||
<td>无</td> | ||
</tr> | ||
<tr> | ||
<td>placeholder</td> | ||
<td>输入框默认提示</td> | ||
<td> | ||
String | ||
</td> | ||
<td>请选择发货人</td> | ||
</tr> | ||
<tr> | ||
<td>shipperMode</td> | ||
<td>设置 Select 的模式,默认单选</td> | ||
<td> | ||
'multiple' | ||
</td> | ||
<td>-</td> | ||
</tr> | ||
<tr> | ||
<td>valueType</td> | ||
<td>单选模式下返回发货人值或者对象,默认字符串</td> | ||
<td>"object"</td> | ||
<td>-</td> | ||
</tr> | ||
<tr> | ||
<td>width</td> | ||
<td>输入框宽度,支持百分比和像素</td> | ||
<td>String | Number</td> | ||
<td>100%</td> | ||
</tr> | ||
<tr> | ||
<td>customTemplate</td> | ||
<td>支持自定义下拉选项,传入模板</td> | ||
<td>TemplateRef</td> | ||
<td>-</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</section> | ||
</article> |
3 changes: 3 additions & 0 deletions
3
src/showcase/custom-demo/shipper-select/shipper-select-demo.component.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[id^="shipper-select-demo-"] nz-select.ant-select{ | ||
margin: 0 8px 10px 0; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/showcase/custom-demo/shipper-select/shipper-select-demo.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Component, ViewEncapsulation } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'shipper-select-demo', | ||
encapsulation: ViewEncapsulation.None, | ||
templateUrl: './shipper-select-demo.component.html', | ||
styleUrls: ['./shipper-select-demo.component.less'] | ||
}) | ||
export class ShipperSelectDemoComponent { | ||
ShipperSelectDemoBasicCode = require('!!raw-loader!./shipper-select-demo-basic.component'); | ||
ShipperSelectDemoMultipleComponent = require('!!raw-loader!./shipper-select-demo-multiple.component'); | ||
ShipperSelectDemoTemplateComponent = require('!!raw-loader!./shipper-select-demo-template.component'); | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/showcase/custom-demo/shipper-select/shipper-select-demo.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { JsonpModule } from '@angular/http'; | ||
|
||
import { NzCodeBoxModule } from '../../share/nz-codebox/nz-codebox.module'; | ||
import { YztCustomModule } from '../../../custom-components/yzt-custom.module'; | ||
import { ShipperSelectDemoComponent } from "./shipper-select-demo.component"; | ||
import { ShipperSelectDemoRoutingModule } from "./shipper-select-demo.routing.module"; | ||
import { ShipperSelectDemoBasicComponent } from "./shipper-select-demo-basic.component"; | ||
import { ShipperSelectDemoMultipleComponent } from "./shipper-select-demo-multiple.component"; | ||
import { ShipperSelectDemoTemplateComponent } from "./shipper-select-demo-template.component"; | ||
|
||
|
||
|
||
@NgModule({ | ||
imports: [ShipperSelectDemoRoutingModule, CommonModule, NzCodeBoxModule, YztCustomModule, FormsModule, JsonpModule], | ||
declarations: [ShipperSelectDemoComponent, ShipperSelectDemoBasicComponent, ShipperSelectDemoMultipleComponent, ShipperSelectDemoTemplateComponent] | ||
}) | ||
export class ShipperSelectDemoModule { } |
11 changes: 11 additions & 0 deletions
11
src/showcase/custom-demo/shipper-select/shipper-select-demo.routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { ShipperSelectDemoComponent } from "./shipper-select-demo.component"; | ||
|
||
@NgModule({ | ||
imports: [ RouterModule.forChild([ | ||
{ path: '', component: ShipperSelectDemoComponent } | ||
]) ], | ||
exports: [ RouterModule ] | ||
}) | ||
export class ShipperSelectDemoRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.