fix(components): [table] fix merge cell cannot show side shadow (#10095)

This commit is contained in:
tinyfind
2022-10-19 10:15:59 +08:00
committed by GitHub
parent 04820a4dcf
commit 2fb99b01e1
3 changed files with 18 additions and 6 deletions

View File

@@ -116,7 +116,7 @@ function useRender<T>(props: Partial<TableBodyProps<T>>) {
'td',
{
style: getCellStyle($index, cellIndex, row, column),
class: getCellClass($index, cellIndex, row, column),
class: getCellClass($index, cellIndex, row, column, colspan - 1),
key: `${patchKey}${baseKey}`,
rowspan,
colspan,

View File

@@ -79,11 +79,19 @@ function useStyles<T>(props: Partial<TableBodyProps<T>>) {
rowIndex: number,
columnIndex: number,
row: T,
column: TableColumnCtx<T>
column: TableColumnCtx<T>,
offset: number
) => {
const fixedClasses = column.isSubColumn
? []
: getFixedColumnsClass(ns.b(), columnIndex, props?.fixed, props.store)
: getFixedColumnsClass(
ns.b(),
columnIndex,
props?.fixed,
props.store,
undefined,
offset
)
const classes = [column.id, column.align, column.className, ...fixedClasses]
const cellClassName = parent?.props.cellClassName
if (typeof cellClassName === 'string') {

View File

@@ -440,18 +440,22 @@ export const getFixedColumnsClass = <T>(
index: number,
fixed: string | boolean,
store: any,
realColumns?: TableColumnCtx<T>[]
realColumns?: TableColumnCtx<T>[],
offset = 0
) => {
const classes: string[] = []
const { direction, start } = isFixedColumn(index, fixed, store, realColumns)
if (direction) {
const isLeft = direction === 'left'
classes.push(`${namespace}-fixed-column--${direction}`)
if (isLeft && start === store.states.fixedLeafColumnsLength.value - 1) {
if (
isLeft &&
start + offset === store.states.fixedLeafColumnsLength.value - 1
) {
classes.push('is-last-column')
} else if (
!isLeft &&
start ===
start - offset ===
store.states.columns.value.length -
store.states.rightFixedLeafColumnsLength.value
) {