Skip to content

Commit

Permalink
fix(abc:st): fix style misplacement when expand is true (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Apr 28, 2020
1 parent 020393d commit 773f546
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 1 addition & 4 deletions packages/abc/st/st.component.html
Expand Up @@ -169,10 +169,7 @@
</td>
</tr>
<tr [nzExpand]="i.expand">
<td></td>
<td [attr.colspan]="_columns.length">
<ng-template [ngTemplateOutlet]="expand" [ngTemplateOutletContext]="{$implicit: i, index: index }"></ng-template>
</td>
<ng-template [ngTemplateOutlet]="expand" [ngTemplateOutletContext]="{$implicit: i, index: index }"></ng-template>
</tr>
</ng-template>
<ng-container *ngIf="!virtualScroll">
Expand Down
3 changes: 3 additions & 0 deletions packages/abc/st/st.component.ts
Expand Up @@ -482,6 +482,9 @@ export class STComponent implements AfterViewInit, OnChanges, OnDestroy {
}

_expandChange(item: STData, expand: boolean): void {
if (this.expandRowByClick) {
return;
}
item.expand = expand;
this.closeOtherExpand(item);
this.changeEmit('expand', item);
Expand Down
6 changes: 6 additions & 0 deletions packages/abc/st/style/index.less
Expand Up @@ -62,6 +62,12 @@
display: inline-block;
margin-left: 4px;
}
// 修复 `st` 内嵌表格额外产生边距
.@{ant-prefix}-table-tbody > tr {
.@{ant-prefix}-table-wrapper:only-child .@{ant-prefix}-table {
margin: 0;
}
}

@media screen and (min-width: @nz-table-rep-min-width) {
&__width {
Expand Down
10 changes: 10 additions & 0 deletions packages/abc/st/test/st.spec.ts
Expand Up @@ -1075,6 +1075,16 @@ describe('abc: table', () => {
el.click();
page.expectData(1, 'expand', undefined).asyncEnd();
}));
it('should be click icon when with true', fakeAsync(() => {
context.expandRowByClick = true;
page
.cd()
.expectData(1, 'expand', undefined)
.clickCell('.ant-table-row-expand-icon')
.expectData(1, 'expand', true)
.expectChangeType('expand')
.asyncEnd();
}));
});
describe('expandRowByClick', () => {
it('should be close other expaned', fakeAsync(() => {
Expand Down

0 comments on commit 773f546

Please sign in to comment.