Merge pull request #1146 from 2betop/fix

还原固定列显示切换逻辑, 固定列跟 footable 搭配有问题
This commit is contained in:
liaoxuezhi 2020-12-07 19:42:42 +08:00 committed by GitHub
commit d6b8b05451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 32 deletions

View File

@ -19,10 +19,13 @@
}
&-fixedLeft {
// 还是改成默认不显示footable 展示的时候配置 固定列还没修复
left: 0;
top: -99999px;
&.in {
box-shadow: $Table-fixedLeft-boxShadow;
top: 0;
}
& > .#{$ns}Table-table {
@ -38,10 +41,13 @@
}
&-fixedRight {
// 还是改成默认不显示footable 展示的时候配置 固定列还没修复
right: 0;
top: -99999px;
&.in {
box-shadow: $Table-fixedRight-boxShadow;
top: 0;
}
& > .#{$ns}Table-table {

View File

@ -31,6 +31,7 @@ export interface TableBodyProps {
savePristine?: boolean
) => void;
footable?: boolean;
ignoreFootableContent?: boolean;
footableColumns: Array<IColumn>;
checkOnItemClick?: boolean;
buildItemProps?: (item: IRow, index: number) => any;
@ -95,6 +96,7 @@ export class TableBody extends React.Component<TableBodyProps> {
onCheck,
onQuickChange,
footable,
ignoreFootableContent,
footableColumns
} = this.props;
@ -151,6 +153,7 @@ export class TableBody extends React.Component<TableBodyProps> {
footableMode
footableColSpan={columns.length}
onQuickChange={onQuickChange}
ignoreFootableContent={ignoreFootableContent}
{...rowProps}
/>
);

View File

@ -21,6 +21,7 @@ interface TableRowProps extends Pick<RendererProps, 'render'> {
itemIndex: number;
regionPrefix?: string;
checkOnItemClick?: boolean;
ignoreFootableContent?: boolean;
[propName: string]: any;
}
@ -103,6 +104,7 @@ export class TableRow extends React.Component<TableRowProps> {
renderCell,
children,
footableMode,
ignoreFootableContent,
footableColSpan,
regionPrefix,
checkOnItemClick,
@ -135,37 +137,39 @@ export class TableRow extends React.Component<TableRowProps> {
})}
>
<td className={cx(`Table-foot`)} colSpan={footableColSpan}>
<table className={cx(`Table-footTable`)}>
<tbody>
{columns.map(column => (
<tr key={column.index}>
{column.label !== false ? (
<th>
{render(
`${regionPrefix}${itemIndex}/${column.index}/tpl`,
column.label
)}
</th>
) : null}
{ignoreFootableContent ? null : (
<table className={cx(`Table-footTable`)}>
<tbody>
{columns.map(column => (
<tr key={column.index}>
{column.label !== false ? (
<th>
{render(
`${regionPrefix}${itemIndex}/${column.index}/tpl`,
column.label
)}
</th>
) : null}
{renderCell(
`${regionPrefix}${itemIndex}/${column.index}`,
column,
item,
{
...rest,
width: null,
rowIndex: itemIndex,
colIndex: column.rawIndex,
key: column.index,
onAction: this.handleAction,
onQuickChange: this.handleQuickChange
}
)}
</tr>
))}
</tbody>
</table>
{renderCell(
`${regionPrefix}${itemIndex}/${column.index}`,
column,
item,
{
...rest,
width: null,
rowIndex: itemIndex,
colIndex: column.rawIndex,
key: column.index,
onAction: this.handleAction,
onQuickChange: this.handleQuickChange
}
)}
</tr>
))}
</tbody>
</table>
)}
</td>
</tr>
);

View File

@ -1635,6 +1635,7 @@ export default class Table extends React.Component<TableProps, object> {
onCheck={this.handleCheck}
onQuickChange={store.dragging ? undefined : this.handleQuickChange}
footable={store.footable}
ignoreFootableContent
footableColumns={store.footableColumns}
checkOnItemClick={checkOnItemClick}
buildItemProps={buildItemProps}

View File

@ -117,10 +117,27 @@ export const Row = types
return data;
},
get expanded(): boolean {
get collapsed(): boolean {
const table = getParent(self, self.depth * 2) as ITableStore;
if (table.dragging) {
return true;
}
return !table.dragging && table.isExpanded(self as IRow);
let from: IRow = self as any;
while (from && (from as any) !== table) {
if (!table.isExpanded(from)) {
return true;
}
from = getParent(from, 2);
}
return false;
},
get expanded(): boolean {
return !this.collapsed;
},
get moved() {