aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2023-03-15 18:15:18 -0400
committermehekj <mehek.jethani@gmail.com>2023-03-15 18:15:18 -0400
commit61ce7b4d434aff7e642d2af17b8643297f99e4a3 (patch)
tree0562ddcab46ef1c10996baaada7001c083dea820 /src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
parent504c8046c13dfe77316e42943e48c017d67c2ad8 (diff)
column drag in progress
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
index 42626697a..e648356f4 100644
--- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx
@@ -26,8 +26,9 @@ export interface SchemaColumnHeaderProps {
setSort: (field: string, desc: boolean) => void;
removeColumn: (index: number) => void;
resizeColumn: (e: any, index: number, left: boolean) => void;
- // dragColumn: (e: any, index: number) => boolean;
+ dragColumn: (e: any, index: number) => boolean;
openContextMenu: (x: number, y: number, index: number) => void;
+ setColRef: (index: number, ref: HTMLDivElement) => void;
}
@observer
@@ -47,16 +48,20 @@ export class SchemaColumnHeader extends React.Component<SchemaColumnHeaderProps>
}
};
- // @action
- // onPointerDown = (e: React.PointerEvent) => {
- // e.stopPropagation();
-
- // setupMoveUpEvents(this, e, e => this.props.dragColumn(e, this.props.columnIndex), emptyFunction, emptyFunction);
- // };
+ @action
+ onPointerDown = (e: React.PointerEvent) => {
+ setupMoveUpEvents(this, e, e => this.props.dragColumn(e, this.props.columnIndex), emptyFunction, emptyFunction);
+ };
render() {
return (
- <div className="schema-column-header" style={{ width: this.props.columnWidths[this.props.columnIndex] }}>
+ <div
+ className="schema-column-header"
+ style={{ width: this.props.columnWidths[this.props.columnIndex] }}
+ onPointerDown={this.onPointerDown}
+ ref={(col: HTMLDivElement | null) => {
+ col && this.props.setColRef(this.props.columnIndex, col);
+ }}>
<div className="schema-column-resizer left" onPointerDown={e => this.props.resizeColumn(e, this.props.columnIndex, true)}></div>
<div className="schema-column-title">{this.fieldKey}</div>