Skip to content

Commit

Permalink
fix(abc:st): fixed columns not aligned (#1877)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Jan 19, 2025
1 parent 26e93cc commit 4ea94be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
12 changes: 6 additions & 6 deletions packages/abc/st/st.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@
@for (row of _headers; track row) {
<tr>
@if ($first && expand) {
<th nzWidth="50px" [rowSpan]="_headers.length" [nzLeft]="row[0].column._left! ? true : false"></th>
<th nzWidth="50px" [rowSpan]="_headers.length" [nzLeft]="row[0].column._left ? true : false"></th>
}
@for (h of row; track h; let index = $index; let last = $last) {
@let _c = h.column;
<th
[colSpan]="h.colSpan"
[rowSpan]="h.rowSpan"
[nzWidth]="$any(_c).width"
[nzLeft]="_c._left!"
[nzRight]="_c._right!"
[nzLeft]="_c._left"
[nzRight]="_c._right"
[class]="_c._className"
[attr.data-col]="_c.indexKey"
[attr.data-col-index]="index"
Expand Down Expand Up @@ -173,7 +173,7 @@
(nzExpandChange)="_expandChange(i, $event)"
(click)="_stopPropagation($event)"
nzWidth="50px"
[nzLeft]="_columns[0]._left! ? true : false"
[nzLeft]="_columns[0]._left ? true : false"
></td>
<ng-template #wrapExpandIcon>
<span (click)="_expandChange(i, !i.expand)">
Expand All @@ -185,8 +185,8 @@
@let props = i._values[cIdx].props;
@if (props?.colSpan > 0 && props?.rowSpan > 0) {
<td
[nzLeft]="!!c._left"
[nzRight]="!!c._right"
[nzLeft]="c._left"
[nzRight]="c._right"
[attr.data-col-index]="cIdx"
[class]="c._className"
[attr.colspan]="props?.colSpan === 1 ? null : props?.colSpan"
Expand Down
4 changes: 2 additions & 2 deletions packages/abc/st/st.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export interface _STColumn extends STColumn {
_className?: string | string[] | Set<string> | { [klass: string]: any } | null;
_sort: STSortMap;
_width?: number;
_left?: string | boolean;
_right?: string | boolean;
_left: string | boolean;
_right: string | boolean;
__renderTitle?: TemplateRef<any>;
__render?: TemplateRef<any>;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/abc/st/test/st-data-source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,16 @@ describe('abc: table: data-souce', () => {
{
title: '',
index: 'id1',
_sort: { enabled: true, default: 'descend', key: 'id1' }
_sort: { enabled: true, default: 'descend', key: 'id1' },
_left: false,
_right: false
},
{
title: '',
index: 'id2',
_sort: { enabled: true, default: 'ascend', key: 'id2' }
_sort: { enabled: true, default: 'ascend', key: 'id2' },
_left: false,
_right: false
}
];
options.headers = [
Expand Down

0 comments on commit 4ea94be

Please sign in to comment.