diff options
author | Tyler Schicke <tschicke@gmail.com> | 2020-01-11 14:10:59 -0800 |
---|---|---|
committer | Tyler Schicke <tschicke@gmail.com> | 2020-01-11 14:10:59 -0800 |
commit | f24fcf4df595542d47ec9b98e173979656db68bd (patch) | |
tree | daf32c16ac99add88460980a6f19925806eb51da /src/client/views/CollectionMulticolumnView.tsx | |
parent | a2f423fa31e649805e7dd087037a5fe262c44a4a (diff) | |
parent | 54a241ff71abc07a5dbdebce1b614f1024a767e6 (diff) |
Merge branch 'master' of github.com:browngraphicslab/Dash-Web into no_db
Diffstat (limited to 'src/client/views/CollectionMulticolumnView.tsx')
-rw-r--r-- | src/client/views/CollectionMulticolumnView.tsx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/client/views/CollectionMulticolumnView.tsx b/src/client/views/CollectionMulticolumnView.tsx new file mode 100644 index 000000000..94e86c048 --- /dev/null +++ b/src/client/views/CollectionMulticolumnView.tsx @@ -0,0 +1,44 @@ +import { observer } from 'mobx-react'; +import { makeInterface } from '../../new_fields/Schema'; +import { documentSchema } from '../../new_fields/documentSchemas'; +import { CollectionSubView, SubCollectionViewProps } from './collections/CollectionSubView'; +import { DragManager } from '../util/DragManager'; +import * as React from "react"; +import { Doc } from '../../new_fields/Doc'; +import { NumCast } from '../../new_fields/Types'; + +type MulticolumnDocument = makeInterface<[typeof documentSchema]>; +const MulticolumnDocument = makeInterface(documentSchema); + +@observer +export default class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocument) { + + constructor(props: Readonly<SubCollectionViewProps>) { + super(props); + const { Document } = this.props; + Document.multicolumnData = new Doc(); + } + + private _dropDisposer?: DragManager.DragDropDisposer; + protected createDropTarget = (ele: HTMLDivElement) => { //used for stacking and masonry view + this._dropDisposer && this._dropDisposer(); + if (ele) { + this._dropDisposer = DragManager.MakeDropTarget(ele, this.drop.bind(this)); + } + } + + public isCurrent(doc: Doc) { return !doc.isMinimized && (Math.abs(NumCast(doc.displayTimecode, -1) - NumCast(this.Document.currentTimecode, -1)) < 1.5 || NumCast(doc.displayTimecode, -1) === -1); } + + render() { + return ( + <div className={"collectionMulticolumnView_outer"}> + <div className={"collectionMulticolumnView_contents"}> + {this.childLayoutPairs.filter(pair => this.isCurrent(pair.layout)).map(({ layout, data }) => { + + })} + </div> + </div> + ); + } + +}
\ No newline at end of file |