Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(AnalyticalTable): fix minWidth and maxWidth column option, disable dragging while resizing #518

Merged
merged 5 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const TableRow: FC<RowProps> = ({ columns, y, row }: RowProps) => {
y={y}
rx="2"
ry="8"
width={column.width - 4}
width={column.totalWidth - 4}
height="16"
/>
);
columnOffset += column.width;
columnOffset += column.totalWidth;
return el;
})}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const styles: CSSProperties = {
zIndex: 1
};

const DefaultLoadingComponent = () => {
return <Loader delay={500} style={styles} />;
const DefaultLoadingComponent = ({ style }) => {
return <Loader delay={500} style={{ ...styles, ...style }} />;
};

DefaultLoadingComponent.displayName = 'DefaultLoadingComponent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const useDragAndDrop = (props, setColumnOrder, columnOrder, resizeInfo, c

const handleDragStart = useCallback(
(e) => {
if (resizeInfo.isResizingColumn === e.currentTarget.dataset.columnId) {
if (resizeInfo.isResizingColumn) {
e.preventDefault();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getHeaderProps = (columnProps, { instance, column }) => {
const lastColumnId = instance.visibleColumns[instance.visibleColumns.length - 1].id;
const isLastColumn = column.id === lastColumnId;
const style: CSSProperties = {
width: column.width
width: column.totalWidth
};

if (instance.state.isScrollable && isLastColumn) {
Expand Down
4 changes: 3 additions & 1 deletion packages/main/src/components/AnalyticalTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ const AnalyticalTable: FC<TableProps> = forwardRef((props: TableProps, ref: Ref<
</header>
);
})}
{loading && busyIndicatorEnabled && props.data?.length > 0 && <LoadingComponent />}
{loading && busyIndicatorEnabled && props.data?.length > 0 && (
<LoadingComponent style={{ width: `${totalColumnsWidth}px` }} />
)}
{loading && props.data?.length === 0 && (
<TablePlaceholder
columns={tableInternalColumns.filter(
Expand Down