Skip to content
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

Merged
merged 3 commits into from
Jan 9, 2019
Merged

Conversation

wzhudev
Copy link
Member

@wzhudev wzhudev commented Dec 31, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #2711

There was no Empty component. And different components handle empty content separately, via inputs like nzNotFountContent or nzNoResult.

What is the new behavior?

  • All components which need to render an empty placeholder now use NzEmbedEmptyComponent component.
    • nzNotFoundContent and other old API would be passed to NzEmbedEmptyComponent.
    • there are two ways to set a user default placeholder.
    • components affected: cascader, list, select, table, transter.
    • tree-select doesn't support this now. The interaction should be changed completely. @hsuanxyz .
  • Related properties have been removed from i18n files.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

  • Due to this bug, users can't invoke NzEmptyService's method to set a default empty component. For that, DI is suggested.
  • i18n should be unified.

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #2722 into master will increase coverage by <.01%.
The diff coverage is 98.13%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
components/i18n/languages/nl_NL.ts 100% <ø> (ø) ⬆️
components/i18n/languages/tr_TR.ts 100% <ø> (ø) ⬆️
components/i18n/languages/nl_BE.ts 100% <ø> (ø) ⬆️
components/i18n/languages/ja_JP.ts 100% <ø> (ø) ⬆️
components/i18n/languages/el_GR.ts 100% <ø> (ø) ⬆️
components/i18n/languages/nb_NO.ts 100% <ø> (ø) ⬆️
components/i18n/languages/uk_UA.ts 100% <ø> (ø) ⬆️
components/i18n/languages/et_EE.ts 100% <ø> (ø) ⬆️
components/i18n/languages/ar_EG.ts 100% <ø> (ø) ⬆️
components/i18n/languages/sk_SK.ts 100% <ø> (ø) ⬆️
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f07279...9c6484d. Read the comment docs.

@netlify
Copy link

netlify bot commented Jan 3, 2019

Deploy preview for ng-zorro-master ready!

Built with commit 9c6484d

https://deploy-preview-2722--ng-zorro-master.netlify.com

@wzhudev wzhudev requested a review from vthinkxie January 4, 2019 02:29
@wzhudev wzhudev changed the title [WIP] feat(module:empty): add empty component feat(module:empty): add empty component Jan 4, 2019
@wzhudev wzhudev requested a review from hsuanxyz January 4, 2019 02:30
components/select/nz-select.module.ts Outdated Show resolved Hide resolved

## zh-CN

自定义图片、描述、附属内容。自定义全局组件的 Empty 样式。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 自定义图片、描述、附属内容

| -------- | ----------- | ---- | ------- |
| `[nzNotFoundImage]` | Customize image. Will tread as image url when string provided | string | TemplateRef | - |
| `[nzNotFoundContent]` | Custom desciption | string | TemplateRef | - |
| `[nzNotFoundFooter]` | Custom Footer | string | TemplateRef | - |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2734

| `string|TemplateRef<void>`|


| Methods/Properties | Description | Parameters |
| -------- | ----------- | ---- |
| `setDefaultEmptyContent` | To set the default empty content | `TemplateRef<void>` | `string` | undefined` |
Copy link
Member

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>-->
Copy link
Member

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'
Copy link
Member

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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新 API 加到文档里面

@@ -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 = {};
Copy link
Member

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) {
Copy link
Member

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
@wzhudev
Copy link
Member Author

wzhudev commented Jan 7, 2019

@hsuanxyz Please review again.

@@ -15,6 +15,7 @@
@import "./divider/style/index.less";
@import "./drawer/style/index";
@import "./dropdown/style/index.less";
@import "./empty/style//index.less";
Copy link
Member

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";

@wzhudev
Copy link
Member Author

wzhudev commented Jan 7, 2019

@hsuanxyz Updated.

@wzhudev wzhudev merged commit 8906dff into NG-ZORRO:master Jan 9, 2019
@wzhudev wzhudev deleted the empty branch January 11, 2019 02:31
Ricbet pushed a commit to Ricbet/ng-zorro-antd that referenced this pull request Apr 9, 2020
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this pull request Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants