aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaCells.tsx
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-14 12:54:38 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-14 12:54:38 -0500
commitc5c7fa9c0b17bbcee582d4fd788d378a2f7cd243 (patch)
treecdcb04d61ebc5f10adb233d0086a7c815c093efc /src/client/views/collections/CollectionSchemaCells.tsx
parente21a97ff5b45a9dde6a42c16394475ad66937a87 (diff)
adding list and image types
Diffstat (limited to 'src/client/views/collections/CollectionSchemaCells.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index baf9d4156..4f2bfac08 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -24,6 +24,7 @@ import { SchemaHeaderField } from "../../../fields/SchemaHeaderField";
import { undoBatch } from "../../util/UndoManager";
import { SnappingManager } from "../../util/SnappingManager";
import { ComputedField } from "../../../fields/ScriptField";
+import { ImageField } from "../../../fields/URLField";
library.add(faExpand);
@@ -205,6 +206,18 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
const doc = FieldValue(Cast(field, Doc));
contents = typeof field === "object" ? doc ? StrCast(doc.title) === "" ? "--" : StrCast(doc.title) : `--${typeof field}--` : `--${typeof field}--`;
}
+ if (type === "image") {
+ // fix this
+
+ const image = FieldValue(Cast(field, ImageField));
+ const doc = FieldValue(Cast(field, Doc));
+ contents = typeof field === "object" ? doc ? StrCast(doc.title) === "" ? "--" : StrCast(doc.title) : `--${typeof field}--` : `--${typeof field}--`;
+ }
+ if (type === "list") {
+ // fix this
+ contents = typeof field === "object" ? doc ? StrCast(field) === "" ? "--" : StrCast(field) : `--${typeof field}--` : `--${typeof field}--`;
+ }
+
let className = "collectionSchemaView-cellWrapper";
if (this._isEditing) className += " editing";
@@ -305,6 +318,71 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell {
}
@observer
+export class CollectionSchemaImageCell extends CollectionSchemaCell {
+ render() {
+ return this.renderCellWithType("image");
+ }
+ // render() {
+ // const props: FieldViewProps = {
+ // Document: this.props.rowProps.original,
+ // DataDoc: this.props.rowProps.original,
+ // LibraryPath: [],
+ // dropAction: "alias",
+ // bringToFront: emptyFunction,
+ // rootSelected: returnFalse,
+ // fieldKey: this.props.rowProps.column.id as string,
+ // ContainingCollectionView: this.props.CollectionView,
+ // ContainingCollectionDoc: this.props.CollectionView && this.props.CollectionView.props.Document,
+ // isSelected: returnFalse,
+ // select: emptyFunction,
+ // renderDepth: this.props.renderDepth + 1,
+ // ScreenToLocalTransform: Transform.Identity,
+ // focus: emptyFunction,
+ // active: returnFalse,
+ // whenActiveChanged: emptyFunction,
+ // PanelHeight: returnZero,
+ // PanelWidth: returnZero,
+ // NativeHeight: returnZero,
+ // NativeWidth: returnZero,
+ // addDocTab: this.props.addDocTab,
+ // pinToPres: this.props.pinToPres,
+ // ContentScaling: returnOne
+ // };
+
+ // if (props.fieldKey === "data") {
+ // const reference = React.createRef<HTMLDivElement>();
+ // return (
+ // <div className="collectionSchemaView-cellWrapper" ref={this._focusRef} tabIndex={-1} onPointerDown={this.onPointerDown}>
+ // <div className="collectionSchemaView-cellContents" key={this._document[Id]} ref={reference}>
+ // {props.DataDoc?.data}
+ // </div >
+ // </div>
+ // );
+ // } else {
+ // return this.renderCellWithType("image");
+ // }
+ // }
+}
+
+@observer
+export class CollectionSchemaListCell extends CollectionSchemaCell {
+ render() {
+ return this.renderCellWithType("list");
+ }
+
+ // render() {
+ // const reference = React.createRef<HTMLDivElement>();
+ // return (
+ // <div className="collectionSchemaView-cellWrapper" ref={this._focusRef} tabIndex={-1} onPointerDown={this.onPointerDown}>
+ // <div className="collectionSchemaView-cellContents" onPointerDown={onItemDown} key={this._document[Id]} ref={reference}>
+ // <input type="checkbox" checked={this._isChecked} onChange={this.toggleChecked} />
+ // </div >
+ // </div>
+ // );
+ // }
+}
+
+@observer
export class CollectionSchemaCheckboxCell extends CollectionSchemaCell {
@observable private _isChecked: boolean = typeof this.props.rowProps.original[this.props.rowProps.column.id as string] === "boolean" ? BoolCast(this.props.rowProps.original[this.props.rowProps.column.id as string]) : false;