aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2022-08-16 17:28:33 -0400
committermehekj <mehek.jethani@gmail.com>2022-08-16 17:28:33 -0400
commita20a40b86bf5df9200218cb713f48e593c41b0ae (patch)
tree54d9f00e6f6c84ff12d0bb3b5604e209288aefc5 /src/client/views/collections/collectionSchema/SchemaRowBox.tsx
parentd0d10426510e1bc8397eea927a65714b5b48f966 (diff)
got formatter to work
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaRowBox.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index ea2ebed7a..3d1fa0ee2 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -36,12 +36,13 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
e.stopPropagation();
setupMoveUpEvents(
- this, e,
- (e) => this.props.startDrag(e, this.props.Document),
+ this,
+ e,
+ e => this.props.startDrag(e, this.props.Document),
emptyFunction,
- (e) => this.props.selectRow(e, this.props.Document, this.props.rowIndex)
- )
- }
+ e => this.props.selectRow(e, this.props.Document, this.props.rowIndex)
+ );
+ };
onPointerEnter = (e: any) => {
if (!this.props.dragging) return;
@@ -54,7 +55,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
let dragIsRow: boolean = true;
DragManager.docsBeingDragged.forEach(doc => {
dragIsRow = this.props.selectedRows.has(doc);
- })
+ });
if (this._ref && dragIsRow) {
const rect = this._ref.getBoundingClientRect();
const y = e.clientY - rect.top; //y position within the element.
@@ -82,17 +83,35 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
render() {
return (
- <div className="schema-row" style={this.isSelected() ? { backgroundColor: Colors.LIGHT_BLUE, opacity: this.props.dragging ? 0.5 : 1} : {}} onPointerDown={this.onRowPointerDown} onPointerEnter={this.onPointerEnter} onPointerLeave={this.onPointerLeave} ref={(row: HTMLDivElement | null) => (this._ref = row)}>
- <div className="row-menu" style={{width: this.props.rowMenuWidth}}>
- <div className="row-button" onPointerDown={undoBatch((e) => {e.stopPropagation(); this.props.removeDocument?.(this.props.Document)})}>
+ <div
+ className="schema-row"
+ style={this.isSelected() ? { backgroundColor: Colors.LIGHT_BLUE, opacity: this.props.dragging ? 0.5 : 1 } : {}}
+ onPointerDown={this.onRowPointerDown}
+ onPointerEnter={this.onPointerEnter}
+ onPointerLeave={this.onPointerLeave}
+ ref={(row: HTMLDivElement | null) => (this._ref = row)}>
+ <div className="row-menu" style={{ width: this.props.rowMenuWidth }}>
+ <div
+ className="row-button"
+ onPointerDown={undoBatch(e => {
+ e.stopPropagation();
+ this.props.removeDocument?.(this.props.Document);
+ })}>
<FontAwesomeIcon icon="times" />
</div>
- <div className="row-button" onPointerDown={(e) => {e.stopPropagation(); this.props.addDocTab(this.props.Document, 'add:right')}}>
+ <div
+ className="row-button"
+ onPointerDown={e => {
+ e.stopPropagation();
+ this.props.addDocTab(this.props.Document, 'add:right');
+ }}>
<FontAwesomeIcon icon="external-link-alt" />
</div>
</div>
<div className="row-cells">
- {this.props.columnKeys.map((key, index) => (<SchemaTableCell Document={this.props.Document} fieldKey={key} columnWidth={this.props.columnWidths[index]} />))}
+ {this.props.columnKeys.map((key, index) => (
+ <SchemaTableCell Document={this.props.Document} fieldKey={key} columnWidth={this.props.columnWidths[index]} />
+ ))}
</div>
</div>
);