mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Merge pull request #1146 from 2betop/fix
还原固定列显示切换逻辑, 固定列跟 footable 搭配有问题
This commit is contained in:
commit
d6b8b05451
@ -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 {
|
||||
|
@ -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}
|
||||
/>
|
||||
);
|
||||
|
@ -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>
|
||||
);
|
||||
|
@ -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}
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user