-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca02a07
commit a39edb7
Showing
47 changed files
with
1,192 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,14 @@ | ||
--- | ||
order: 1 | ||
title: | ||
zh-CN: nzBytes | ||
en-US: nzBytes | ||
--- | ||
|
||
## zh-CN | ||
|
||
存储单位的换算增加可读性 | ||
|
||
## en-US | ||
|
||
Conversion of storage units increases readability |
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,17 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-bytes', | ||
template: ` | ||
<ul> | ||
<li>{{ 200 | nzBytes }}</li> | ||
<li>{{ 1024 | nzBytes }}</li> | ||
<li>{{ 1048576 | nzBytes }}</li> | ||
<li>{{ 1024 | nzBytes: 0:'KB' }}</li> | ||
<li>{{ 1073741824 | nzBytes }}</li> | ||
<li>{{ 1099511627776 | nzBytes }}</li> | ||
<li>{{ 1073741824 | nzBytes: 0:'B':'MB' }}</li> | ||
</ul> | ||
` | ||
}) | ||
export class NzDemoPipeBytesComponent {} |
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: 2 | ||
title: | ||
zh-CN: nzToCssUnit | ||
en-US: nzToCssUnit | ||
--- | ||
|
||
## zh-CN | ||
|
||
Css 单位补全 | ||
|
||
## en-US | ||
|
||
Css unit completion |
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 { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-css-unit', | ||
template: ` | ||
<div>{{ 200 | nzToCssUnit }}</div> | ||
<div>{{ 200 | nzToCssUnit: 'pt' }}</div> | ||
<div>{{ '200px' | nzToCssUnit: 'pt' }}</div> | ||
` | ||
}) | ||
export class NzDemoPipeCssUnitComponent {} |
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: nzEllipsis | ||
en-US: nzEllipsis | ||
--- | ||
|
||
## zh-CN | ||
|
||
截断字符串,用指定的字符串结尾 | ||
|
||
## en-US | ||
|
||
Truncate the string, ending with the specified string |
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,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-ellipsis', | ||
template: ` | ||
{{ 'Hello World' | nzEllipsis: 4 }}<br /> | ||
{{ 'Hello World' | nzEllipsis: 4:'':true }}<br /> | ||
{{ 'Hello World' | nzEllipsis: 4:'...':true }}<br /> | ||
{{ 'Hello World, how is it going?' | nzEllipsis: 14:'...':true }} | ||
` | ||
}) | ||
export class NzDemoPipeEllipsisComponent {} |
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: nzMath | ||
en-US: nzMath | ||
--- | ||
|
||
## zh-CN | ||
|
||
数组的Sum、Min、Max、Average等聚合操作 | ||
|
||
## en-US | ||
|
||
Sum, Min, Max, Average and other operations on arrays |
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,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-math', | ||
template: ` | ||
{{ [7, 8, 2, 3] | nzMath: 'min' }}<br /> | ||
{{ [7, 8, 2, 3] | nzMath: 'max' }}<br /> | ||
{{ [7, 8, 2, 3] | nzMath: 'sum' }}<br /> | ||
{{ [7, 8, 2, 3] | nzMath: 'avg' }}<br /> | ||
` | ||
}) | ||
export class NzDemoPipeMathComponent {} |
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 @@ | ||
import { NzPipesModule } from 'ng-zorro-antd/pipe'; | ||
|
||
export const moduleList = [ NzPipesModule ]; |
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: nzSafeNull | ||
en-US: nzSafeNull | ||
--- | ||
|
||
## zh-CN | ||
|
||
转换 Null 和 Undefined 为指定字符串 | ||
|
||
## en-US | ||
|
||
Convert Null and Undefined to the specified string | ||
|
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,12 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-safe-null', | ||
template: ` | ||
<ul> | ||
<li>使用量:{{ 1000 | nzSafeNull }}</li> | ||
<li>比例:34/{{ null | nzSafeNull: '-' }}</li> | ||
</ul> | ||
` | ||
}) | ||
export class NzDemoPipeSafeNullComponent {} |
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: 6 | ||
title: | ||
zh-CN: nzSanitizer | ||
en-US: nzSanitizer | ||
--- | ||
|
||
## zh-CN | ||
|
||
DomSanitizer 防止跨站点脚本安全漏洞 | ||
|
||
## en-US | ||
|
||
DomSanitizer prevents cross-site scripting vulnerabilities | ||
|
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 } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-sanitizer', | ||
template: ` | ||
<div [innerHTML]="htmlSnippet | nzSanitizer: 'html'"></div> | ||
<div [innerHTML]="scriptSnippet | nzSanitizer: 'script'"></div> | ||
<div [style]="styleSnippet | nzSanitizer: 'style'">我不会报警</div> | ||
<hr /> | ||
<div><img [src]="urlSnippet | nzSanitizer: 'url'" /></div> | ||
<hr /> | ||
<div> | ||
<iframe [src]="resourceUrlSnippet | nzSanitizer: 'resourceUrl'"></iframe> | ||
</div> | ||
` | ||
}) | ||
export class NzDemoPipeSanitizerComponent { | ||
htmlSnippet: string = '<p>hello world</p>'; | ||
scriptSnippet: string = '<script>function testScript(){alert("我不会报错!")}</script>'; | ||
styleSnippet: string = "{'height': '20px'}"; | ||
urlSnippet: string = 'https://ng.ant.design/assets/img/logo.svg'; | ||
resourceUrlSnippet: string = 'https://ng.ant.design/docs/introduce/zh'; | ||
} |
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: 7 | ||
title: | ||
zh-CN: nzSome | ||
en-US: nzSome | ||
--- | ||
|
||
## zh-CN | ||
|
||
集合中的至少一项通过,则返回true。 | ||
|
||
## en-US | ||
|
||
Returns true if at least one of the item in the collections pass the method. |
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 } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-some', | ||
template: ` | ||
{{ [5, 6, 7, 8, 9] | nzSome: method }}<br /> | ||
{{ [6, 7, 8, 9, 10] | nzSome: method }}<br /> | ||
` | ||
}) | ||
export class NzDemoPipeSomeComponent { | ||
method = (item: number) => { | ||
return item === 5; | ||
}; | ||
} |
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: 9 | ||
title: | ||
zh-CN: nzTimeRange | ||
en-US: nzTimeRange | ||
--- | ||
|
||
## zh-CN | ||
|
||
返回指定时间格式 | ||
|
||
## en-US | ||
|
||
Returns the specified time format |
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,18 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-time-range', | ||
template: ` | ||
{{ diff | nzTimeRange: format1 }}<br /> | ||
{{ diff | nzTimeRange: format2 }}<br /> | ||
{{ diff | nzTimeRange: format3 }}<br /> | ||
{{ diff1 | nzTimeRange }}<br /> | ||
` | ||
}) | ||
export class NzDemoPipeTimeRangeComponent { | ||
diff = 1000 * 60 * 60 * 24 * 2 + 1000 * 30; | ||
diff1 = 0; | ||
format1 = 'HH:mm:ss'; | ||
format2 = 'HH:mm'; | ||
format3 = 'D 天 H 时 m 分 s 秒'; | ||
} |
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: 8 | ||
title: | ||
zh-CN: nzTrim | ||
en-US: nzTrim | ||
--- | ||
|
||
## zh-CN | ||
|
||
去除字符串左右指定字符 | ||
|
||
## en-US | ||
|
||
Strip left and right string |
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 { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-pipe-trim', | ||
template: ` | ||
{{ 'hello' | nzTrim }}<br /> | ||
{{ 'hello ' | nzTrim }}<br /> | ||
{{ ' hello ' | nzTrim }}<br /> | ||
` | ||
}) | ||
export class NzDemoPipeTrimComponent {} |
Oops, something went wrong.