Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Domino987 committed Jul 2, 2021
2 parents b4b04c6 + cfcdd22 commit eef03a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/components/MTableHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ export function MTableHeader({ onColumnResized, ...props }) {
const handleMouseMove = React.useCallback(
// Use usecallback to prevent triggering theuse effect too much
(e) => {
if (!resizingColumnDef) {
return;
}
if (!resizingColumnDef) return;
let additionalWidth = lastAdditionalWidth + e.clientX - lastX;
additionalWidth = Math.min(
resizingColumnDef.maxWidth || additionalWidth,
additionalWidth
);
let th = e.target.closest('th');
let currentWidth = +window.getComputedStyle(th).width.slice(0, -2);
if (currentWidth <= resizingColumnDef.minWidth) return;
if (resizingColumnDef.tableData.additionalWidth !== additionalWidth) {
onColumnResized(resizingColumnDef.tableData.id, additionalWidth);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/m-table-body-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ export default function MTableBodyRow(props) {
const selectionWidth = CommonValues.selectionMaxWidth(
props,
props.treeDataMaxLevel
);
) || 0;

const styles =
size === 'medium'
? {
marginLeft: props.level * 9
marginLeft: props.level * 9 || 0
}
: {
padding: '4px',
marginLeft: 5 + props.level * 9
marginLeft: 5 + props.level * 9 || 0
};

return (
Expand Down

0 comments on commit eef03a0

Please sign in to comment.