diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-12 02:50:19 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-12 02:50:19 -0400 |
| commit | 571220cb349644efc149b8e13d000a37366db664 (patch) | |
| tree | fe03f374c65994fcdf8f83020c6dade9dcf8aad9 /src/client/views/collections/collectionSchema/SchemaRowBox.tsx | |
| parent | c0afdafa109c377a83ebe4394d63b9fe785fe475 (diff) | |
fixed col drag highlight and cleaned up multi-select highlight
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaRowBox.tsx')
| -rw-r--r-- | src/client/views/collections/collectionSchema/SchemaRowBox.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index 98a16deea..a8affb0d9 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -87,7 +87,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { ContextMenu.Instance.displayMenu(x, y, undefined, false); } - get menuBackgroundColor(){ + @computed get menuBackgroundColor(){ if (this.Document._lockedSchemaEditing){ if (this._props.isSelected()) return '#B0D1E7' else return '#F5F5F5' @@ -95,14 +95,22 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { return '' } - get menuInfos() { + @computed get menuInfos() { const infos: Array<IconProp> = []; if (this.Document._lockedSchemaEditing) infos.push('lock'); if (this.Document._childrenSharedWithSchema) infos.push('star'); return infos; } - cleanupField = (field: string) => this.schemaView.cleanupComputedField(field) + @computed get isolatedSelection() { + const toReturn: [boolean, boolean] = [true, true]; + const selectedBelow: boolean = this.schemaView?._selectedDocs.includes(this.schemaView.draggedSpliceDocs.docs[this.rowIndex + 1]); + const selectedAbove: boolean = this.schemaView?._selectedDocs.includes(this.schemaView.draggedSpliceDocs.docs[this.rowIndex - 1]); + toReturn[0] = selectedAbove; + toReturn[1] = selectedBelow; + return toReturn; + } + setCursorIndex = (mouseY: number) => this.schemaView?.setRelCursorIndex(mouseY); selectedCol = () => this.schemaView._selectedCol; getFinfo = computedFn((fieldKey: string) => this.schemaView?.fieldInfos.get(fieldKey)); @@ -111,6 +119,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { selectedCells = () => this.schemaView?._selectedDocs; setColumnValues = (field: any, value: any) => this.schemaView?.setCellValues(field, value) ?? false; columnWidth = computedFn((index: number) => () => this.schemaView?.displayColumnWidths[index] ?? CollectionSchemaView._minColWidth); + computeRowIndex = () => this.schemaView?.rowIndex(this.Document); render() { return ( <div @@ -121,9 +130,6 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { row && this.schemaView?.addRowRef?.(this.Document, row); this._ref = row; }}> - <div className="row-menu-infos"> - {this.menuInfos.map(icn => <FontAwesomeIcon className="row-infos-icon" icon={icn} size='2xs' />)} - </div> <div className="row-menu" style={{ @@ -149,10 +155,14 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { ) } /> + <div className="row-menu-infos"> + {this.menuInfos.map(icn => <FontAwesomeIcon className="row-infos-icon" icon={icn} size='2xs' />)} + </div> </div> <div className="row-cells"> {this.schemaView?.columnKeys?.map((key, index) => ( <SchemaTableCell + isolatedSelection={this.isolatedSelection} key={key} rowSelected={this._props.isSelected} Document={this.Document} @@ -170,7 +180,6 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() { setColumnValues={this.setColumnValues} oneLine={BoolCast(this.schemaDoc?._singleLine)} menuTarget={this.schemaView.MenuTarget} - cleanupField={this.cleanupField} transform={() => { const ind = index === this.schemaView.columnKeys.length - 1 ? this.schemaView.columnKeys.length - 3 : index; const x = this.schemaView?.displayColumnWidths.reduce((p, c, i) => (i <= ind ? p + c : p), 0); |
