Commit 4baaf79a by zhaochengxiang

可拖动列宽问题

parent 2ff10eeb
...@@ -650,7 +650,7 @@ const ImportActionIndex = (props) => { ...@@ -650,7 +650,7 @@ const ImportActionIndex = (props) => {
return ( return (
<div className='model-import-action-index'> <div className='model-import-action-index'>
<h2>数据表结构</h2> <h2>数据表索引</h2>
<div className='d-flex mb-3' style={{ justifyContent: editable?'space-between':'flex-end' }}> <div className='d-flex mb-3' style={{ justifyContent: editable?'space-between':'flex-end' }}>
{ {
editable && <Tooltip title={addTip}> editable && <Tooltip title={addTip}>
......
...@@ -80,8 +80,6 @@ const ModelNameColumn = (props) => { ...@@ -80,8 +80,6 @@ const ModelNameColumn = (props) => {
const ResizeableHeaderCell = props => { const ResizeableHeaderCell = props => {
const { onResize, width, onClick, ...restProps } = props; const { onResize, width, onClick, ...restProps } = props;
const [ resizing, setResizing ] = useState(false);
if (!width) { if (!width) {
return <th {...restProps} />; return <th {...restProps} />;
} }
...@@ -90,23 +88,21 @@ const ResizeableHeaderCell = props => { ...@@ -90,23 +88,21 @@ const ResizeableHeaderCell = props => {
<Resizable <Resizable
width={width} width={width}
height={0} height={0}
onResize={(event, {element, size, handle}) => { handle={
setResizing(true); <span
onResize && onResize(event, { size }); className="react-resizable-handle"
}} onClick={(e) => {
e.stopPropagation();
}}
/>
}
onResize={onResize}
draggableOpts={{ enableUserSelectHack: false }} draggableOpts={{ enableUserSelectHack: false }}
> >
<th <th
onClick={(...args) => { onClick={onClick}
//解决可伸缩列与排序器冲突
if (!resizing && onClick) {
onClick(...args);
}
setResizing(false);
}}
{...restProps} {...restProps}
/> />
</Resizable> </Resizable>
); );
}; };
...@@ -220,6 +216,7 @@ const ModelTable = (props) => { ...@@ -220,6 +216,7 @@ const ModelTable = (props) => {
ellipsis: true, ellipsis: true,
sorter: true, sorter: true,
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
width: 200,
render: (text, _, __) => { render: (text, _, __) => {
return ( return (
<Tooltip title={text||''}> <Tooltip title={text||''}>
...@@ -654,6 +651,9 @@ const ModelTable = (props) => { ...@@ -654,6 +651,9 @@ const ModelTable = (props) => {
onChange={onTableChange} onChange={onTableChange}
expandable={expandable} expandable={expandable}
sticky={!modelId} sticky={!modelId}
scroll={{
x: 'max-content'
}}
/> />
{ {
!modelId && (data||[]).length>0 && <Pagination !modelId && (data||[]).length>0 && <Pagination
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment