Commit a7ffe555 by zhaochengxiang

解决可伸缩列与排序器冲突

parent 88c939b5
...@@ -13,7 +13,9 @@ import { AnchorId, AnchorTimestamp, Action, CatalogId, ModelerId } from '../../. ...@@ -13,7 +13,9 @@ import { AnchorId, AnchorTimestamp, Action, CatalogId, ModelerId } from '../../.
import './ModelTable.less'; import './ModelTable.less';
const ResizeableHeaderCell = props => { const ResizeableHeaderCell = props => {
const { onResize, width, ...restProps } = props; const { onResize, width, onClick, ...restProps } = props;
const [ resizing, setResizing ] = useState(false);
if (!width) { if (!width) {
return <th {...restProps} />; return <th {...restProps} />;
...@@ -23,10 +25,23 @@ const ResizeableHeaderCell = props => { ...@@ -23,10 +25,23 @@ const ResizeableHeaderCell = props => {
<Resizable <Resizable
width={width} width={width}
height={0} height={0}
onResize={onResize} onResize={(event, {element, size, handle}) => {
setResizing(true);
onResize && onResize(event, { size });
}}
draggableOpts={{ enableUserSelectHack: false }} draggableOpts={{ enableUserSelectHack: false }}
> >
<th {...restProps} /> <th
onClick={(...args) => {
//解决可伸缩列与排序器冲突
if (!resizing && onClick) {
onClick(...args);
}
setResizing(false);
}}
{...restProps}
/>
</Resizable> </Resizable>
); );
}; };
...@@ -85,17 +100,17 @@ const ModelTable = (props) => { ...@@ -85,17 +100,17 @@ const ModelTable = (props) => {
sorter: true, sorter: true,
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
onCell: (record, rowIndex) => { onCell: (record, rowIndex) => {
if (!record.digest) { // if (!record.digest) {
dispatch({ // dispatch({
type: 'datamodel.getDataModelDigest', // type: 'datamodel.getDataModelDigest',
payload: { // payload: {
id: record.id // id: record.id
}, // },
callback: _data => { // callback: _data => {
record.digest = _data; // record.digest = _data;
} // }
}) // })
} // }
}, },
render: (text, record, index) => { render: (text, record, index) => {
......
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