diff options
author | mehekj <mehek.jethani@gmail.com> | 2022-08-16 17:28:33 -0400 |
---|---|---|
committer | mehekj <mehek.jethani@gmail.com> | 2022-08-16 17:28:33 -0400 |
commit | a20a40b86bf5df9200218cb713f48e593c41b0ae (patch) | |
tree | 54d9f00e6f6c84ff12d0bb3b5604e209288aefc5 /src | |
parent | d0d10426510e1bc8397eea927a65714b5b48f966 (diff) |
got formatter to work
Diffstat (limited to 'src')
4 files changed, 35 insertions, 19 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 02bc55e7a..bcfa695f0 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -88,11 +88,10 @@ export class CollectionSchemaView extends CollectionSubView() { this._selectedDocs.add(doc); this._lastSelectedRow = index; } - + if (this._lastSelectedRow && this._selectedDocs.size > 0) { SelectionManager.SelectSchemaViewDoc(this.childDocs[this._lastSelectedRow]); - } - else { + } else { SelectionManager.SelectSchemaViewDoc(undefined); } }; @@ -154,7 +153,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action addNewTextDoc = (value: string, shiftDown?: boolean, forceEmptyNote?: boolean) => { if (!value && !forceEmptyNote) return false; - const newDoc = Docs.Create.TextDocument(value, {title: value}); + const newDoc = Docs.Create.TextDocument(value, { title: value }); FormattedTextBox.SelectOnLoad = newDoc[Id]; FormattedTextBox.SelectOnLoadChar = forceEmptyNote ? '' : ' '; return this.props.addDocument?.(newDoc) || false; diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx index 9bd1b843f..b9dbf4f57 100644 --- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx +++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx @@ -1,9 +1,8 @@ import React = require('react'); +import { computed } from 'mobx'; import { observer } from 'mobx-react'; -import './CollectionSchemaView.scss'; import { EditableView } from '../../EditableView'; -import { emptyFunction } from '../../../../Utils'; -import { action, computed } from 'mobx'; +import './CollectionSchemaView.scss'; export interface SchemaColumnHeaderProps { columnKeys: string[]; 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> ); diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 1eb5e0e01..7e2fa1f6f 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -1,7 +1,6 @@ import React = require('react'); import { observer } from 'mobx-react'; import { Doc, Field } from '../../../../fields/Doc'; -import { StrCast } from '../../../../fields/Types'; import './CollectionSchemaView.scss'; export interface SchemaTableCellProps { |