Skip to content

Commit 0b59899

Browse files
fix(AnalyticalTable): enable minWidth/maxWidth column option, disable dragging while resizing (#518)
* fix(AnalyticalTable): enable column option minWidth and maxWidth again, fix draggable column bug Co-authored-by: Marcus Notheis <[email protected]>
1 parent c8e98ff commit 0b59899

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

packages/main/src/components/AnalyticalTable/defaults/LoadingComponent/TablePlaceholder.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ const TableRow: FC<RowProps> = ({ columns, y, row }: RowProps) => {
1717
y={y}
1818
rx="2"
1919
ry="8"
20-
width={column.width - 4}
20+
width={column.totalWidth - 4}
2121
height="16"
2222
/>
2323
);
24-
columnOffset += column.width;
24+
columnOffset += column.totalWidth;
2525
return el;
2626
})}
2727
</>

packages/main/src/components/AnalyticalTable/defaults/LoadingComponent/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const styles: CSSProperties = {
1010
zIndex: 1
1111
};
1212

13-
const DefaultLoadingComponent = () => {
14-
return <Loader delay={500} style={styles} />;
13+
const DefaultLoadingComponent = ({ style }) => {
14+
return <Loader delay={500} style={{ ...styles, ...style }} />;
1515
};
1616

1717
DefaultLoadingComponent.displayName = 'DefaultLoadingComponent';

packages/main/src/components/AnalyticalTable/hooks/useDragAndDrop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const useDragAndDrop = (props, setColumnOrder, columnOrder, resizeInfo, c
1212

1313
const handleDragStart = useCallback(
1414
(e) => {
15-
if (resizeInfo.isResizingColumn === e.currentTarget.dataset.columnId) {
15+
if (resizeInfo.isResizingColumn) {
1616
e.preventDefault();
1717
return;
1818
}

packages/main/src/components/AnalyticalTable/hooks/useStyling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const getHeaderProps = (columnProps, { instance, column }) => {
3232
const lastColumnId = instance.visibleColumns[instance.visibleColumns.length - 1].id;
3333
const isLastColumn = column.id === lastColumnId;
3434
const style: CSSProperties = {
35-
width: column.width
35+
width: column.totalWidth
3636
};
3737

3838
if (instance.state.isScrollable && isLastColumn) {

packages/main/src/components/AnalyticalTable/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ const AnalyticalTable: FC<TableProps> = forwardRef((props: TableProps, ref: Ref<
386386
</header>
387387
);
388388
})}
389-
{loading && busyIndicatorEnabled && props.data?.length > 0 && <LoadingComponent />}
389+
{loading && busyIndicatorEnabled && props.data?.length > 0 && (
390+
<LoadingComponent style={{ width: `${totalColumnsWidth}px` }} />
391+
)}
390392
{loading && props.data?.length === 0 && (
391393
<TablePlaceholder
392394
columns={tableInternalColumns.filter(

0 commit comments

Comments
 (0)