From 5e67e3db522c2080c51de53c1fbd4be570e62a98 Mon Sep 17 00:00:00 2001 From: ljungster Date: Tue, 26 Apr 2022 07:27:39 -0400 Subject: columns (sort of) working --- .../views/collections/CollectionNoteTakingView.tsx | 21 ++++++++---- .../CollectionNoteTakingViewFieldColumn.tsx | 37 ++++++++++++++++------ 2 files changed, 42 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 5f9a4f4d0..0cdf63939 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -67,12 +67,14 @@ export class CollectionNoteTakingView extends CollectionSubView { - const totalWidth = this.props.PanelWidth() + const totalWidth = this.PanelWidth const colWidth = totalWidth / n const newColXCoords: number[] = [] let colStart = 0 @@ -356,6 +359,7 @@ export class CollectionNoteTakingView extends CollectionSubView void; editableViewProps: any; resizeColumns: (n: number) => void + columnStartXCoords: number[] + PanelWidth: number + maxColWidth: number } @observer export class CollectionNoteTakingViewFieldColumn extends React.Component { @observable private _background = "inherit"; + // It seems like this is being a little funky atm + @computed get columnWidth() { + // base cases + if (!this.props.columnHeaders || !this.props.headingObject || this.props.columnHeaders.length == 1) { + return this.props.maxColWidth + } + const i = this.props.columnHeaders.indexOf(this.props.headingObject) + if (i < 0) { + return this.props.maxColWidth + } + const endColValue = i == this.props.numGroupColumns - 1 ? this.props.PanelWidth : this.props.columnStartXCoords[i+1] + return endColValue - this.props.columnStartXCoords[i] - 10 + } + private dropDisposer?: DragManager.DragDropDisposer; private _headerRef: React.RefObject = React.createRef(); @@ -150,7 +167,8 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component headings.indexOf(i) === idx); const evContents = heading ? heading : "25"; const headingView = this.props.headingObject ?
: (null); - const templatecols = `${this.props.columnWidth / this.props.numGroupColumns}px `; + // const templatecols = `${this.props.columnWidth / this.props.numGroupColumns}px `; + const templatecols = `${this.columnWidth}px `; const type = this.props.Document.type; return <> {headingView} @@ -264,7 +282,8 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component + // style={{ width: this.props.columnWidth / this.props.numGroupColumns, marginBottom: 10 }}> + style={{ width: this.columnWidth, marginBottom: 10 }}>