diff options
author | ljungster <parkerljung@gmail.com> | 2022-08-12 14:43:41 -0700 |
---|---|---|
committer | ljungster <parkerljung@gmail.com> | 2022-08-12 14:43:41 -0700 |
commit | 6f7a94b0fa65729f03b49e8aecf9eb3c8a2461ff (patch) | |
tree | 2741a689af6ba514227ecc2aa5ac5229635465ef /src/client/views/collections/CollectionNoteTakingViewColumn.tsx | |
parent | 08ac7a2006027147ce15f18433318ae3cf789c9f (diff) |
sizing works but undo redo no longer does
Diffstat (limited to 'src/client/views/collections/CollectionNoteTakingViewColumn.tsx')
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingViewColumn.tsx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingViewColumn.tsx b/src/client/views/collections/CollectionNoteTakingViewColumn.tsx index f58d8e937..8ad684cec 100644 --- a/src/client/views/collections/CollectionNoteTakingViewColumn.tsx +++ b/src/client/views/collections/CollectionNoteTakingViewColumn.tsx @@ -51,10 +51,12 @@ interface CSVFieldColumnProps { unobserveHeight: (myref: any) => void; //setDraggedCol:(clonedDiv:any, header:SchemaHeaderField, xycoors: ) editableViewProps: () => any; - // resizeColumns: (n: number) => void; + resizeColumns: (n: number, isAdd: boolean) => void; // columnStartXCoords: number[]; PanelWidth: number; maxColWidth: number; + dividerWidth: number; + availableWidth: number; // docsByColumnHeader: Map<string, Doc[]> // setDocsForColHeader: (key: string, docs: Doc[]) => void } @@ -63,16 +65,22 @@ interface CSVFieldColumnProps { export class CollectionNoteTakingViewColumn extends React.Component<CSVFieldColumnProps> { @observable private _background = 'inherit'; + // the "width" property of headers is relative (a percentage of available space) @computed get columnWidth() { // base cases - if (!this.props.columnHeaders || !this.props.headingObject || this.props.columnHeaders.length == 1) { + if (!this.props.columnHeaders || !this.props.headingObject) { return this.props.maxColWidth; } - const i = this.props.columnHeaders.indexOf(this.props.headingObject); - if (i >= 0 && this.props.columnHeaders[i].width > 0) { - return this.props.columnHeaders[i].width; + if (this.props.columnHeaders.length == 1) { + // this.props.columnHeaders[0].setWidth(1); + return this.props.maxColWidth; } - return this.props.maxColWidth; + const i = this.props.columnHeaders.indexOf(this.props.headingObject); + return this.props.columnHeaders[i].width * this.props.availableWidth; + // if (i >= 0 && this.props.columnHeaders[i].width > 0) { + // return this.props.columnHeaders[i].width; + // } + // return this.props.maxColWidth; // if (i < 0 || i > this.props.columnStartXCoords.length - 1) { // return this.props.maxColWidth; // } @@ -150,7 +158,6 @@ export class CollectionNoteTakingViewColumn extends React.Component<CSVFieldColu return this.props.addDocument?.(newDoc) || false; }; - @undoBatch @action @undoBatch deleteColumn = () => { @@ -158,9 +165,9 @@ export class CollectionNoteTakingViewColumn extends React.Component<CSVFieldColu if (columnHeaders && this.props.headingObject) { const index = columnHeaders.indexOf(this.props.headingObject); this.props.docList.forEach(d => (d[this.props.pivotField] = 'unset')); + this.props.resizeColumns(columnHeaders.length - 1, false) columnHeaders.splice(index, 1); } - // probably need to add something here for sizing purposes }; menuCallback = (x: number, y: number) => { |