diff options
| author | mehekj <mehek.jethani@gmail.com> | 2022-11-07 12:57:44 -0500 |
|---|---|---|
| committer | mehekj <mehek.jethani@gmail.com> | 2022-11-07 12:57:44 -0500 |
| commit | 213a92ba3aa39d144754029fde32b9d69b0f51cf (patch) | |
| tree | ebf2cd7c8626b676f018798304b4bf83dc20df1c /src/client/views/collections/collectionSchema/SchemaRowBox.tsx | |
| parent | 5425b61d62beef22d068e259ae3e2003f08e0c05 (diff) | |
basic key selection menu created
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaRowBox.tsx')
| -rw-r--r-- | src/client/views/collections/collectionSchema/SchemaRowBox.tsx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index 66cc3a47a..bfce61952 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -17,11 +17,12 @@ export interface SchemaRowBoxProps extends FieldViewProps { columnKeys: string[]; columnWidths: number[]; rowMenuWidth: number; - selectedRows: ObservableMap<Doc, HTMLDivElement>; + selectedDocs: ObservableSet<Doc>; selectRow: (e: any, doc: Doc, ref: HTMLDivElement, index: number) => void; startDrag: (e: any, doc: Doc, ref: HTMLDivElement, index: number) => boolean; dragging: boolean; dropIndex: (index: number) => void; + addRowRef: (doc: Doc, ref: HTMLDivElement) => void; } @observer @@ -32,7 +33,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { private _ref: HTMLDivElement | null = null; - isSelected = () => this.props.selectedRows.has(this.props.Document); + isSelected = () => this.props.selectedDocs.has(this.props.Document); bounds = () => this._ref?.getBoundingClientRect(); @action @@ -58,7 +59,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { if (!this.props.dragging) return; let dragIsRow: boolean = true; DragManager.docsBeingDragged.forEach(doc => { - dragIsRow = this.props.selectedRows.has(doc); + dragIsRow = this.props.selectedDocs.has(doc); }); if (this._ref && dragIsRow) { const rect = this._ref.getBoundingClientRect(); @@ -93,7 +94,10 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { onPointerDown={this.onRowPointerDown} onPointerEnter={this.onPointerEnter} onPointerLeave={this.onPointerLeave} - ref={(row: HTMLDivElement | null) => (this._ref = row)}> + ref={(row: HTMLDivElement | null) => { + row && this.props.addRowRef(this.props.Document, row); + this._ref = row; + }}> <div className="row-menu" style={{ width: this.props.rowMenuWidth }}> <div className="schema-row-button" |
