Skip to content

Commit

Permalink
fix(comp:table): table cell border missing when row span included (#1895
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sallerli1 committed Apr 17, 2024
1 parent 562314c commit f8aedce
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 42 deletions.
Expand Up @@ -53,7 +53,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 0</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 0</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -71,7 +71,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 1</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 1</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -89,7 +89,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 2</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 2</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -107,7 +107,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 3</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 3</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -125,7 +125,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 4</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 4</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -143,7 +143,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 5</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 5</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -161,7 +161,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 6</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 6</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -179,7 +179,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 7</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 7</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -197,7 +197,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 8</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 8</a><a>Delete</a></td>
</tr>
<tr class=\\"ix-table-row\\">
<td class=\\"ix-table-cell ix-table-cell-expandable\\">
Expand All @@ -215,7 +215,7 @@ exports[`Table > basic work > render work 1`] = `
<!----></span><span class=\\"ix-tag ix-tag-normal\\" color=\\"warning\\"><!----><!----><span class=\\"ix-tag-content\\">DEVELOPER</span>
<!----></span>
</td>
<td class=\\"ix-table-cell\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 9</a><a>Delete</a></td>
<td class=\\"ix-table-cell ix-table-cell-last\\"><a style=\\"margin-right: 8px;\\">Invite Edrward 9</a><a>Delete</a></td>
</tr>
</tbody>
<!---->
Expand Down
1 change: 1 addition & 0 deletions packages/components/table/src/main/body/BodyCell.tsx
Expand Up @@ -73,6 +73,7 @@ export default defineComponent({
[`${prefixCls}-cell-align-${align.cell}`]: !!align && align.cell != 'start',
[`${prefixCls}-cell-ellipsis`]: !!mergedEllipsis.value,
[`${prefixCls}-cell-${type}`]: !!type,
[`${prefixCls}-cell-last`]: !!props.isLast,
}
if (fixed) {
classes = {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/table/src/main/body/RenderBodyCells.tsx
Expand Up @@ -16,7 +16,7 @@ import BodyCell from './BodyCell'
export function renderBodyCells(columns: TableColumnMerged[], record: any, rowIndex: number): VNode[] {
const children: VNode[] = []
columns.forEach((column, colIndex) => {
const cell = renderBodyCell(column, record, rowIndex, colIndex)
const cell = renderBodyCell(column, record, rowIndex, colIndex === columns.length - 1)

if (cell) {
children.push(cell)
Expand All @@ -30,7 +30,7 @@ export function renderBodyCell(
column: TableColumnMerged,
record: any,
rowIndex: number,
colIndex: number,
isLast: boolean,
): VNode | undefined {
const { colSpan: getColSpan, rowSpan: getRowSpan } = column
const colSpan = getColSpan?.(record, rowIndex)
Expand All @@ -43,7 +43,7 @@ export function renderBodyCell(
const colProps: any = {
colSpan: colSpan === 1 ? undefined : colSpan,
rowSpan: rowSpan === 1 ? undefined : rowSpan,
colIndex,
isLast,
column,
}

Expand Down
2 changes: 1 addition & 1 deletion packages/components/table/src/types.ts
Expand Up @@ -262,7 +262,7 @@ export type TableBodyRowProps = ExtractInnerPropTypes<typeof tableBodyRowProps>

export const tableBodyCellProps = {
column: { type: Object as PropType<TableColumnMerged>, required: true },
colIndex: { type: Number, required: true },
isLast: { type: Boolean, required: true },
colSpan: Number,
rowSpan: Number,
} as const
Expand Down
9 changes: 1 addition & 8 deletions packages/components/table/style/border.less
Expand Up @@ -45,20 +45,13 @@
border: @table-border;

> table {
border-collapse: collapse;
> thead > tr > th,
> tbody > tr > td:not(:last-child),
> tbody > tr > td:not(.@{table-prefix}-cell-last),
> tfoot > tr > th:not(:last-child),
> tfoot > tr > td:not(:last-child) {
border-right: @table-border;
}

> tbody > tr > td:last-child:not(:first-child),
> tfoot > tr > th:last-child:not(:first-child),
> tfoot > tr > td:last-child:not(:first-child) {
border-left: @table-border;
}

> thead > tr:first-child > th:last-child {
border-right: none;
}
Expand Down
Expand Up @@ -257,7 +257,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
4
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -312,7 +312,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
5
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -368,7 +368,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
6
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -423,7 +423,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
7
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -478,7 +478,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
8
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -533,7 +533,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
9
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -588,7 +588,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
10
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -643,7 +643,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
11
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -699,7 +699,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
12
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -754,7 +754,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
13
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -809,7 +809,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
14
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -864,7 +864,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
15
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -920,7 +920,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
16
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -975,7 +975,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
17
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -1030,7 +1030,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
18
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -1085,7 +1085,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
19
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
<!---->
</td>
Expand Down Expand Up @@ -1371,7 +1371,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
</label>
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
Option0
</td>
Expand Down Expand Up @@ -1417,7 +1417,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
</label>
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
Option1
</td>
Expand Down Expand Up @@ -1462,7 +1462,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
</label>
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
Option2
</td>
Expand Down Expand Up @@ -1507,7 +1507,7 @@ exports[`ProTransfer > table transfer render work 1`] = `
</label>
</td>
<td
class="ix-table-cell"
class="ix-table-cell ix-table-cell-last"
>
Option3
</td>
Expand Down

0 comments on commit f8aedce

Please sign in to comment.