aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authorSam Wilkins <abdullah_ahmed@brown.edu>2019-07-22 14:49:57 -0400
committerSam Wilkins <abdullah_ahmed@brown.edu>2019-07-22 14:49:57 -0400
commit8515b6957f075f8ae7e88243ab5a4c7cb8fff3b6 (patch)
treeb88947bbf954555e9197afa8cfb6103c861791c9 /src/client/views/collections/CollectionSchemaView.tsx
parente81cf9407966612e25b944addbc8d2a08300d0bb (diff)
removed fixed row height
Diffstat (limited to 'src/client/views/collections/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index ea09926d4..a1251b028 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -81,6 +81,21 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
@computed get borderWidth() { return Number(COLLECTION_BORDER_WIDTH); }
@computed get tableColumns(): Column<Doc>[] {
let possibleKeys = this.documentKeys.filter(key => this.columns.findIndex(existingKey => existingKey.toUpperCase() === key.toUpperCase()) === -1);
+ let columns: Column<Doc>[] = [
+ {
+ expander: true,
+ Header: "",
+ width: 45,
+ Expander: (rowInfo) => {
+ if (rowInfo.original.type === "collection") {
+ return <div>+</div>;
+ } else {
+ return null;
+ }
+ }
+ }
+ ];
+
let cols = this.columns.map(col => {
let focusedRow = this._focusedCell.row;
let focusedCol = this._focusedCell.col;
@@ -139,22 +154,10 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
},
minWidth: 200,
};
- }) as {Header?: TableCellRenderer, accessor?: (doc: Doc) => FieldResult<Field>, id?: string, Cell?: (rowProps: CellInfo) => JSX.Element, width?: number, resizable?: boolean, expander?: boolean, Expander?: (rowInfo: RowInfo) => JSX.Element | null, minWidth?: number}[];
-
- // cols.push({
- // expander: true,
- // Header: "",
- // width: 45,
- // Expander: (rowInfo) => {
- // if (rowInfo.original.type === "collection") {
- // return <div>+</div>;
- // } else {
- // return null;
- // }
- // }
- // });
-
- cols.push({
+ });// as {Header?: TableCellRenderer, accessor?: (doc: Doc) => FieldResult<Field>, id?: string, Cell?: (rowProps: CellInfo) => JSX.Element, width?: number, resizable?: boolean, expander?: boolean, Expander?: (rowInfo: RowInfo) => JSX.Element | null, minWidth?: number}[];
+ columns.push(...cols);
+
+ columns.push({
Header: <CollectionSchemaAddColumnHeader
createColumn={this.createColumn}
// possibleKeys={possibleKeys}
@@ -171,7 +174,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
// SubComponent={row => row.original.type === "collection" && <div>SUB</div>}
- return cols;
+ return columns;
}
// onHeaderDrag = (columnName: string) => {
@@ -201,11 +204,17 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
if (!rowInfo) {
return {};
}
+ let isSelected = SelectionManager.SelectedDocuments().length ? SelectionManager.SelectedDocuments()[0].props.Document === this.props.Document : false;
return {
ScreenToLocalTransform: this.props.ScreenToLocalTransform,
addDoc: (doc: Doc, relativeTo?: Doc, before?: boolean) => Doc.AddDocToList(this.props.Document, this.props.fieldKey, doc, relativeTo, before),
moveDoc: (d: Doc, target: Doc, addDoc: (doc: Doc) => boolean) => this.props.moveDocument(d, target, addDoc),
rowInfo,
+ rowFocused: !this._headerIsEditing && isSelected && rowInfo.index === this._focusedCell.row,
+ // style: {
+ // background: rowInfo.index === this._focusedCell.row ? "lightGray" : "white",
+ // //color: rowInfo.index === this._selectedIndex ? "white" : "black"
+ // }
// onClick: action((e: React.MouseEvent, handleOriginal: Function) => {
// that.props.select(e.ctrlKey);
// that._selectedIndex = rowInfo.index;
@@ -486,7 +495,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
sortable={false}
TrComponent={MovableRow}
sorted={Array.from(this._sortedColumns.values())}
- // SubComponent={row => row.original.type === "collection" && <div>this is the sub component</div>}
+ SubComponent={row => row.original.type === "collection" && <div>this is the sub component</div>}
/>;