From e4f83378176a096aed30a65b4d2a05e63ffcc2f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=8C=E4=BA=A6?= Date: Sat, 14 Oct 2017 14:22:59 +0800 Subject: [PATCH] fix(module:table): fix the wrong semantics about param "nzShowExpand" 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". --- src/components/table/nz-row-expand-icon.component.ts | 11 ++++++++--- .../nz-demo-table-expand-tree.component.ts | 2 +- src/showcase/nz-demo-table/nz-demo-table.html | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/table/nz-row-expand-icon.component.ts b/src/components/table/nz-row-expand-icon.component.ts index 3ed26be3db1..6eeba3d9acc 100644 --- a/src/components/table/nz-row-expand-icon.component.ts +++ b/src/components/table/nz-row-expand-icon.component.ts @@ -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; diff --git a/src/showcase/nz-demo-table/nz-demo-table-expand-tree.component.ts b/src/showcase/nz-demo-table/nz-demo-table-expand-tree.component.ts index eac77643339..9c0566ff79c 100644 --- a/src/showcase/nz-demo-table/nz-demo-table-expand-tree.component.ts +++ b/src/showcase/nz-demo-table/nz-demo-table-expand-tree.component.ts @@ -17,7 +17,7 @@ import { Component, OnInit } from '@angular/core'; - + {{item.name}} {{item.age}} diff --git a/src/showcase/nz-demo-table/nz-demo-table.html b/src/showcase/nz-demo-table/nz-demo-table.html index 425ed12dea2..7e23f32a0a6 100644 --- a/src/showcase/nz-demo-table/nz-demo-table.html +++ b/src/showcase/nz-demo-table/nz-demo-table.html @@ -441,9 +441,9 @@

nzShowExpand - 是否展示展开按钮 + 是否显示此 展开/收缩 按钮 Boolean - false + true