From a20a40b86bf5df9200218cb713f48e593c41b0ae Mon Sep 17 00:00:00 2001 From: mehekj Date: Tue, 16 Aug 2022 17:28:33 -0400 Subject: got formatter to work --- .../collectionSchema/CollectionSchemaView.tsx | 7 ++-- .../collectionSchema/SchemaColumnHeader.tsx | 5 ++- .../collections/collectionSchema/SchemaRowBox.tsx | 41 ++++++++++++++++------ .../collectionSchema/SchemaTableCell.tsx | 1 - 4 files changed, 35 insertions(+), 19 deletions(-) (limited to 'src') 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() { 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() { 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() { render() { return ( -
(this._ref = row)}> -
-
{e.stopPropagation(); this.props.removeDocument?.(this.props.Document)})}> +
(this._ref = row)}> +
+
{ + e.stopPropagation(); + this.props.removeDocument?.(this.props.Document); + })}>
-
{e.stopPropagation(); this.props.addDocTab(this.props.Document, 'add:right')}}> +
{ + e.stopPropagation(); + this.props.addDocTab(this.props.Document, 'add:right'); + }}>
- {this.props.columnKeys.map((key, index) => ())} + {this.props.columnKeys.map((key, index) => ( + + ))}
); 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 { -- cgit v1.2.3-70-g09d2