-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(module:empty): add empty component #2722
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2722 +/- ##
==========================================
+ Coverage 95.57% 95.57% +<.01%
==========================================
Files 507 515 +8
Lines 12092 12191 +99
Branches 1701 1711 +10
==========================================
+ Hits 11557 11652 +95
- Misses 171 173 +2
- Partials 364 366 +2
Continue to review full report at Codecov.
|
Deploy preview for ng-zorro-master ready! Built with commit 9c6484d |
components/empty/demo/config.md
Outdated
|
||
## zh-CN | ||
|
||
自定义图片、描述、附属内容。自定义全局组件的 Empty 样式。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 自定义图片、描述、附属内容
components/empty/doc/index.en-US.md
Outdated
| -------- | ----------- | ---- | ------- | | ||
| `[nzNotFoundImage]` | Customize image. Will tread as image url when string provided | string | TemplateRef | - | | ||
| `[nzNotFoundContent]` | Custom desciption | string | TemplateRef | - | | ||
| `[nzNotFoundFooter]` | Custom Footer | string | TemplateRef | - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `string|TemplateRef<void>`|
components/empty/doc/index.en-US.md
Outdated
|
||
| Methods/Properties | Description | Parameters | | ||
| -------- | ----------- | ---- | | ||
| `setDefaultEmptyContent` | To set the default empty content | `TemplateRef<void>` | `string` | undefined` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最好不要将 undefined
作为参数,建议在说明里备注 不传则设为默认
,或者提供一个重置方法更为合理。
<ng-container *nzStringTemplateOutlet="nzNotFoundFooter"> | ||
{{ nzNotFoundFooter }} | ||
</ng-container> | ||
<!--<ng-content></ng-content>--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段没用可以拿掉
templateUrl : './nz-empty.component.html', | ||
styles : [ 'nz-empty { display: block; }' ], | ||
host : { | ||
'[class.ant-empty]': 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
- '[class.ant-empty]': 'true'
+ 'class': 'ant-empty'
}
@@ -63,6 +59,8 @@ export class NzListComponent implements OnInit, OnChanges, OnDestroy { | |||
|
|||
@Input() @InputBoolean() nzSplit = true; | |||
|
|||
@Input() nzNoResult: string | TemplateRef<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新 API 加到文档里面
components/list/nz-list.component.ts
Outdated
@@ -32,10 +29,9 @@ import { NzListGrid } from './interface'; | |||
} | |||
` ] | |||
}) | |||
export class NzListComponent implements OnInit, OnChanges, OnDestroy { | |||
export class NzListComponent implements OnInit, OnChanges { | |||
/* tslint:disable-next-line:no-any */ | |||
locale: any = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- locale: any = {};
@@ -155,7 +150,7 @@ export class NzTransferComponent implements OnInit, OnChanges, OnDestroy { | |||
|
|||
// #endregion | |||
|
|||
constructor(private cdr: ChangeDetectorRef, private i18n: NzI18nService) { | |||
constructor(private cdr: ChangeDetectorRef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- locale: any = {};
fix: fix fix: test fix: fix ci Revert: feat(module:empty): add empty component Revert: fix: fix fix: fix ci
@hsuanxyz Please review again. |
components/components.less
Outdated
@@ -15,6 +15,7 @@ | |||
@import "./divider/style/index.less"; | |||
@import "./drawer/style/index"; | |||
@import "./dropdown/style/index.less"; | |||
@import "./empty/style//index.less"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- @import "./empty/style//index.less";
+ @import "./empty/style/index.less";
@hsuanxyz Updated. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #2711
There was no
Empty
component. And different components handle empty content separately, via inputs likenzNotFountContent
ornzNoResult
.What is the new behavior?
NzEmbedEmptyComponent
component.nzNotFoundContent
and other old API would be passed toNzEmbedEmptyComponent
.Does this PR introduce a breaking change?
Other information
NzEmptyService
's method to set a default empty component. For that, DI is suggested.