Skip to content

Commit

Permalink
fix(module:table): fix the wrong semantics about param "nzShowExpand"…
Browse files Browse the repository at this point in the history
… of nz-row-expand-icon

BREAKING CHANGE: the usage of param "nzShowExpand" is changed to the opposite value. The former, "nzShowExpand" represent as "hide the expand icon", now this change correct it to "show the expand icon".

And the default value of "nzShowExpand" has changed to "true".
  • Loading branch information
wilsoncook committed Oct 28, 2017
1 parent 4efd6f7 commit e4f8337
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/components/table/nz-row-expand-icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ import {
})
export class NzRowExpandIconComponent {
@Input() nzExpand = false;
@Input() @HostBinding('class.ant-table-row-spaced') nzShowExpand = false;
@Input() nzShowExpand = true;
@Output() nzExpandChange = new EventEmitter();

@HostBinding('class.ant-table-row-spaced')
get hidden() {
return !this.nzShowExpand;
}

@HostBinding(`class.ant-table-row-expanded`)
get expanded() {
return this.nzExpand && !this.nzShowExpand;
return this.nzShowExpand && this.nzExpand;
}

@HostBinding(`class.ant-table-row-collapsed`)
get collapsed() {
return !this.nzExpand && !this.nzShowExpand;
return this.nzShowExpand && !this.nzExpand;
}

@HostBinding(`class.ant-table-row-expand-icon`) _expandIcon = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Component, OnInit } from '@angular/core';
<tr nz-tbody-tr *ngIf="(item.parent&&item.parent.expand)||!(item.parent)">
<td nz-td>
<nz-row-indent [nzIndentSize]="item.level"></nz-row-indent>
<nz-row-expand-icon [(nzExpand)]="item.expand" (nzExpandChange)="collapse(expandDataCache[data.key],item,$event)" [nzShowExpand]="!item.children"></nz-row-expand-icon>
<nz-row-expand-icon [(nzExpand)]="item.expand" (nzExpandChange)="collapse(expandDataCache[data.key],item,$event)" [nzShowExpand]="!!item.children"></nz-row-expand-icon>
{{item.name}}
</td>
<td nz-td>{{item.age}}</td>
Expand Down
4 changes: 2 additions & 2 deletions src/showcase/nz-demo-table/nz-demo-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ <h3>
</tr>
<tr>
<td>nzShowExpand</td>
<td>是否展示展开按钮</td>
<td>是否显示此 展开/收缩 按钮</td>
<td>Boolean</td>
<td>false</td>
<td>true</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit e4f8337

Please sign in to comment.