From 67a0081bb4fb713b730fa86a5b67d3c061426514 Mon Sep 17 00:00:00 2001 From: mehekj Date: Wed, 1 Mar 2023 21:45:13 -0500 Subject: cells editable --- .../collections/collectionSchema/SchemaRowBox.tsx | 4 +- .../collectionSchema/SchemaTableCell.tsx | 45 +++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index 4b709f670..05197d05f 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -93,7 +93,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { onPointerEnter={this.onPointerEnter} onPointerLeave={this.onPointerLeave} ref={(row: HTMLDivElement | null) => { - row && this.schemaView?.addRowRef(this.rootDoc, row); + row && this.schemaView?.addRowRef?.(this.rootDoc, row); this._ref = row; }}>
() {
{this.schemaView?.columnKeys?.map((key, index) => ( - + ))}
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 4cfc5850c..0f832e7c4 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -9,20 +9,61 @@ import { FieldValue } from '../../../../fields/Types'; import { CompileScript } from '../../../util/Scripting'; import { EditableView } from '../../EditableView'; import { MAX_ROW_HEIGHT } from '../../global/globalCssVariables.scss'; +import { FieldView, FieldViewProps } from '../../nodes/FieldView'; +import { KeyValueBox } from '../../nodes/KeyValueBox'; +import { returnEmptyFilter, returnEmptyDoclist, returnFalse, emptyFunction, returnZero } from '../../../../Utils'; +import { DefaultStyleProvider } from '../../StyleProvider'; +import { Transform } from '../../../util/Transform'; +import { CollectionSchemaView } from './CollectionSchemaView'; export interface SchemaTableCellProps { Document: Doc; fieldKey: string; columnWidth: number; + isRowActive: () => boolean | undefined; } @observer export class SchemaTableCell extends React.Component { render() { + const props: FieldViewProps = { + Document: this.props.Document, + // DataDoc: this.props.doc, + docFilters: returnEmptyFilter, + docRangeFilters: returnEmptyFilter, + searchFilterDocs: returnEmptyDoclist, + styleProvider: DefaultStyleProvider, + docViewPath: returnEmptyDoclist, + ContainingCollectionView: undefined, + ContainingCollectionDoc: undefined, + fieldKey: this.props.fieldKey, + rootSelected: returnFalse, + isSelected: returnFalse, + setHeight: returnFalse, + select: emptyFunction, + dropAction: 'alias', + bringToFront: emptyFunction, + renderDepth: 1, + isContentActive: returnFalse, + whenChildContentsActiveChanged: emptyFunction, + ScreenToLocalTransform: Transform.Identity, + focus: emptyFunction, + PanelWidth: () => this.props.columnWidth, + PanelHeight: () => CollectionSchemaView._rowHeight, + addDocTab: returnFalse, + pinToPres: returnZero, + }; + return ( -
- {Field.toString(this.props.Document[this.props.fieldKey] as Field)} +
+ {/* {Field.toString(this.props.Document[this.props.fieldKey] as Field)} */} {/* Field.toKeyValueString(this.props.Document, this.props.fieldKey)} SetValue={(value: string) => true} /> */} + } + height={'auto'} + GetValue={() => Field.toKeyValueString(this.props.Document, this.props.fieldKey)} + SetValue={(value: string) => KeyValueBox.SetField(this.props.Document, this.props.fieldKey, value)} + />
); } -- cgit v1.2.3-70-g09d2