Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 038b0d3

Browse files
committed
resizer
1 parent 30415dc commit 038b0d3

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TextIcon from 'components/img/Text';
1010
import MultiIcon from 'components/img/Multi';
1111
import HashIcon from 'components/img/Hash';
1212
import PlusIcon from 'components/img/Plus';
13-
import { ActionTypes, DataTypes, MAX_CAPACITY_DATABASE, MetadataColumns } from 'helpers/Constants';
13+
import { ActionTypes, DataTypes, MetadataColumns } from 'helpers/Constants';
1414
import { LOGGER } from 'services/Logger';
1515
import { DatabaseHeaderProps } from 'cdm/FolderModel';
1616
import ReactDOM from 'react-dom';

src/components/Table.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,12 @@ export function Table(initialState: TableDataType){
239239
setColumnOrder(colOrder);
240240
}
241241
}}
242-
onDragEnd={() => {
243-
// save on disk
244-
initialState.view.diskConfig.reorderColumns((state as any).columnOrder);
242+
onDragEnd={(result) => {
243+
// save on disk in case of changes
244+
if(result.source.index!==result.destination!.index){
245+
initialState.view.diskConfig.reorderColumns((state as any).columnOrder);
246+
}
247+
245248
// clear the current order
246249
currentColOrder.current = null;
247250
}}
@@ -281,6 +284,14 @@ export function Table(initialState: TableDataType){
281284
}}
282285
>
283286
{column.render("Header")}
287+
{/* Use column.getResizerProps to hook up the events correctly */}
288+
<div
289+
{...(column as any).getResizerProps()}
290+
key={`resizer-${column.id}`}
291+
className={`resizer ${
292+
(column as any).isResizing ? 'isResizing' : ''
293+
}`}
294+
/>
284295
</div>
285296
</div>
286297
);

src/components/styles/DragableStyle.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ const DraggableStyle = (styleProps:any) => ({
33
...styleProps.draggableStyle,
44
// some basic styles to make the items look a bit nicer
55
userSelect: "none",
6-
7-
// change background colour if dragging
8-
// background: styleProps.dragableProps.isDragging ? "lightgreen" : "grey",
9-
106
...(!styleProps.dragableProps.isDragging && { transform: "translate(0,0)" }),
117
...(styleProps.dragableProps.isDropAnimating && { transitionDuration: "0.001s" })
128

styles.css

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,21 @@ html {
296296
margin-left: auto;
297297
margin-right: auto;
298298
display: flex;
299-
}
299+
}
300+
301+
.resizer {
302+
display: inline-block;
303+
width: 15px;
304+
height: 100%;
305+
position: absolute;
306+
right: 0;
307+
top: 0;
308+
transform: translateX(50%);
309+
z-index: 1;
310+
/* prevents from scrolling while dragging on touch devices */
311+
touch-action:none;
312+
}
313+
314+
.isResizing {
315+
background: rgb(182, 119, 119);
316+
}

0 commit comments

Comments
 (0)