diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-10 14:56:42 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-06-10 14:56:42 -0400 |
| commit | 03f9fd4beb2bd3efa8f88c71bdbaf52dbec82e66 (patch) | |
| tree | f12c7a7376449f1a79bda11938140eb23401f4dc /src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx | |
| parent | 4b604b5118a1aac89d977c832c81495ec2c9aa19 (diff) | |
sub-collection doc adding refactor complete except for small bug
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx')
| -rw-r--r-- | src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx index 3719840ff..0da186f81 100644 --- a/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx +++ b/src/client/views/collections/collectionSchema/SchemaColumnHeader.tsx @@ -30,8 +30,6 @@ export interface SchemaColumnHeaderProps { columnKeys: string[]; columnWidths: number[]; columnIndex: number; - sortField: string; - sortDesc: boolean; schemaView: CollectionSchemaView; keysDropdown: React.JSX.Element; //cleanupField: (s: string) => string; @@ -158,6 +156,46 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea return isDefault; } + get headerButton(){ + const toRender = SchemaColumnHeader.isDefaultField(this.fieldKey) ? + (<IconButton + icon={ <FontAwesomeIcon icon="trash" size='sm'/>} + size={Size.XSMALL} + color={'black'} + onPointerDown={e => + setupMoveUpEvents( + this, + e, + returnFalse, + emptyFunction, + undoable(clickEv => { + clickEv.stopPropagation(); + this._props.schemaView.removeColumn(this._props.columnIndex); + }, 'open column menu') + ) + } + />) + : (<IconButton + icon={ <FontAwesomeIcon icon="caret-down" size='lg'/>} + size={Size.XSMALL} + color={'black'} + onPointerDown={e => + setupMoveUpEvents( + this, + e, + returnFalse, + emptyFunction, + undoable(clickEv => { + clickEv.stopPropagation(); + this._props.openContextMenu(e.clientX, e.clientY, this._props.columnIndex) + }, 'open column menu') + ) + } + />) + + return toRender; + } + render() { return ( <div @@ -177,23 +215,7 @@ export class SchemaColumnHeader extends ObservableReactComponent<SchemaColumnHea <div className="schema-header-menu"> <div className="schema-header-button"> - <IconButton - icon={ <FontAwesomeIcon icon="caret-down" size='lg'/>} - size={Size.XSMALL} - color={'black'} - onPointerDown={e => - setupMoveUpEvents( - this, - e, - returnFalse, - emptyFunction, - undoable(clickEv => { - clickEv.stopPropagation(); - this._props.openContextMenu(e.clientX, e.clientY, this._props.columnIndex) - }, 'open column menu') - ) - } - /> + {this.headerButton} </div> </div> </div> |
