-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:drawer): add drawer component (#1789)
close #1565
- Loading branch information
Showing
22 changed files
with
1,145 additions
and
0 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
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,15 @@ | ||
--- | ||
order: 1 | ||
title: | ||
zh-CN: 左侧滑出 | ||
en-US: Left Slider | ||
--- | ||
|
||
## zh-CN | ||
|
||
基础抽屉,点击触发按钮抽屉从左滑出,点击遮罩区关闭 | ||
|
||
## en-US | ||
|
||
Basic drawer. | ||
|
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,26 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-drawer-basic-left', | ||
template: ` | ||
<button nz-button nzType="primary" (click)="open()">Open</button> | ||
<nz-drawer [nzClosable]="false" [nzVisible]="visible" nzPlacement="left" nzTitle="Basic Drawer" (nzOnClose)="close()"> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
</nz-drawer> | ||
` | ||
}) | ||
|
||
export class NzDemoDrawerBasicLeftComponent { | ||
|
||
visible = false; | ||
|
||
open(): void { | ||
this.visible = true; | ||
} | ||
|
||
close(): void { | ||
this.visible = false; | ||
} | ||
} |
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 @@ | ||
--- | ||
order: 0 | ||
title: | ||
zh-CN: 基础抽屉 | ||
en-US: Basic | ||
--- | ||
|
||
## zh-CN | ||
|
||
基础抽屉,点击触发按钮抽屉从右滑出,点击遮罩区关闭 | ||
|
||
## en-US | ||
|
||
Basic drawer. |
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,25 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-drawer-basic-right', | ||
template: ` | ||
<button nz-button nzType="primary" (click)="open()">Open</button> | ||
<nz-drawer [nzClosable]="false" [nzVisible]="visible" nzPlacement="right" nzTitle="Basic Drawer" (nzOnClose)="close()"> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
<p>Some contents...</p> | ||
</nz-drawer> | ||
` | ||
}) | ||
|
||
export class NzDemoDrawerBasicRightComponent { | ||
visible = false; | ||
|
||
open(): void { | ||
this.visible = true; | ||
} | ||
|
||
close(): void { | ||
this.visible = false; | ||
} | ||
} |
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 @@ | ||
--- | ||
order: 3 | ||
title: | ||
zh-CN: 对象编辑 | ||
en-US: Edit item in drawer | ||
--- | ||
|
||
## zh-CN | ||
|
||
用于承载编辑相关操作,需要点击关闭按钮关闭。 | ||
|
||
## en-US | ||
|
||
A drawer containing an editable form which needs to be collapsed by clicking the close button. |
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,106 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-drawer-from-drawer', | ||
template: ` | ||
<button nz-button nzType="primary" (click)="open()">Create</button> | ||
<nz-drawer [nzBodyStyle]="{ height: 'calc(100% - 55px)', overflow: 'auto', 'padding-bottom':'53px' }"[nzMaskClosable]="false" [nzWidth]="720" [nzVisible]="visible" nzTitle="Create" (nzOnClose)="close()"> | ||
<form nz-form> | ||
<div nz-row nzGutter="8"> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>Name</nz-form-label> | ||
<nz-form-control> | ||
<input nz-input placeholder="please enter user name"> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>Url</nz-form-label> | ||
<nz-form-control> | ||
<nz-input-group nzAddOnBefore="http://" nzAddOnAfter=".com"> | ||
<input type="text" nz-input placeholder="please enter url"> | ||
</nz-input-group> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
<div nz-row nzGutter="8"> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>Owner</nz-form-label> | ||
<nz-form-control> | ||
<nz-select nzPlaceHolder="Please select an owner"></nz-select> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>Type</nz-form-label> | ||
<nz-form-control> | ||
<nz-select nzPlaceHolder="Please choose the type"></nz-select> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
<div nz-row nzGutter="8"> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>Approver</nz-form-label> | ||
<nz-form-control> | ||
<nz-select nzPlaceHolder="Please choose the approver"></nz-select> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
<div nz-col nzSpan="12"> | ||
<nz-form-item> | ||
<nz-form-label>DateTime</nz-form-label> | ||
<nz-form-control> | ||
<nz-range-picker></nz-range-picker> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
<div nz-row nzGutter="8"> | ||
<div nz-col nzSpan="24"> | ||
<nz-form-item> | ||
<nz-form-label>Description</nz-form-label> | ||
<nz-form-control> | ||
<textarea nz-input placeholder="please enter url description" [nzAutosize]="{ minRows: 4, maxRows: 4 }"></textarea> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
</form> | ||
<div class="footer"> | ||
<button type="button" (click)="close()" class="ant-btn" style="margin-right: 8px;"><span>Cancel</span></button> | ||
<button type="button" (click)="close()" class="ant-btn ant-btn-primary"><span>Submit</span></button> | ||
</div> | ||
</nz-drawer> | ||
`, | ||
styles: [` | ||
.footer { | ||
position: absolute; | ||
bottom: 0px; | ||
width: 100%; | ||
border-top: 1px solid rgb(232, 232, 232); | ||
padding: 10px 16px; | ||
text-align: right; | ||
left: 0px; | ||
background: #fff; | ||
} | ||
`] | ||
}) | ||
|
||
export class NzDemoDrawerFromDrawerComponent { | ||
visible = false; | ||
|
||
open(): void { | ||
this.visible = true; | ||
} | ||
|
||
close(): void { | ||
this.visible = false; | ||
} | ||
} |
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,15 @@ | ||
--- | ||
order: 5 | ||
title: | ||
zh-CN: 多层抽屉 | ||
en-US: Multi-level drawer | ||
--- | ||
|
||
## zh-CN | ||
|
||
在抽屉内打开新的抽屉,用以解决多分支任务的复杂状况。 | ||
|
||
## en-US | ||
|
||
Open a new drawer on top of an existing drawer to handle multi branch tasks | ||
|
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,80 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-drawer-multi-level-drawer', | ||
template: ` | ||
<button nz-button nzType="primary" (click)="open()">New Cookbook</button> | ||
<nz-drawer [nzClosable]="false" [nzOffsetX]="childrenVisible ? 180 : 0" [nzWidth]="320" [nzVisible]="visible" nzTitle="Cookbook" (nzOnClose)="close()"> | ||
<form nz-form> | ||
<div nz-row> | ||
<div nz-col nzSpan="24"> | ||
<nz-form-item> | ||
<nz-form-label>Name</nz-form-label> | ||
<nz-form-control> | ||
<input nz-input placeholder="please enter cookbook name"> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
<div nz-row> | ||
<div nz-col nzSpan="24"> | ||
<nz-form-item> | ||
<nz-form-label>Food</nz-form-label> | ||
<nz-form-control> | ||
<nz-tag>potato</nz-tag> | ||
<nz-tag>eggplant</nz-tag> | ||
<nz-tag (click)="openChildren()">+</nz-tag> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</div> | ||
</div> | ||
</form> | ||
<div class="footer"> | ||
<button type="button" (click)="close()" class="ant-btn" style="margin-right: 8px;"><span>Cancel</span></button> | ||
<button type="button" (click)="close()" class="ant-btn ant-btn-primary"><span>Submit</span></button> | ||
</div> | ||
<nz-drawer [nzClosable]="false" [nzVisible]="childrenVisible" nzTitle="Food" (nzOnClose)="closeChildren()"> | ||
<nz-list [nzDataSource]="vegetables" [nzRenderItem]="item"> | ||
<ng-template #item let-item> | ||
<nz-list-item [nzContent]="item"></nz-list-item> | ||
</ng-template> | ||
</nz-list> | ||
</nz-drawer> | ||
</nz-drawer> | ||
`, | ||
styles: [` | ||
.footer { | ||
position: absolute; | ||
bottom: 0px; | ||
width: 100%; | ||
border-top: 1px solid rgb(232, 232, 232); | ||
padding: 10px 16px; | ||
text-align: right; | ||
left: 0px; | ||
background: #fff; | ||
} | ||
`] | ||
}) | ||
|
||
export class NzDemoDrawerMultiLevelDrawerComponent { | ||
visible = false; | ||
childrenVisible = false; | ||
|
||
vegetables = ['asparagus', 'bamboo', 'potato', 'carrot', 'cilantro', 'potato', 'eggplant']; | ||
|
||
open(): void { | ||
this.visible = true; | ||
} | ||
|
||
close(): void { | ||
this.visible = false; | ||
} | ||
|
||
openChildren(): void { | ||
this.childrenVisible = true; | ||
} | ||
|
||
closeChildren(): void { | ||
this.childrenVisible = false; | ||
} | ||
} |
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 @@ | ||
--- | ||
order: 4 | ||
title: | ||
zh-CN: 信息预览抽屉 | ||
en-US: Preview drawer | ||
--- | ||
|
||
## zh-CN | ||
|
||
需要快速预览对象概要时使用,点击遮罩区关闭。 | ||
|
||
## en-US | ||
|
||
Use when you need to quickly preview the outline of the object. Such as list item preview. |
Oops, something went wrong.