From 4a42946b5c8ec86e66a89fec2e66971a242e3dbb Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Thu, 28 Feb 2019 09:19:53 -0500 Subject: added css --- src/client/documents/Documents.ts | 4 +- .../views/collections/CollectionFreeFormView.tsx | 5 +- src/client/views/nodes/DocumentView.tsx | 4 +- src/client/views/nodes/FieldView.tsx | 2 - src/client/views/nodes/KeyValueBox.scss | 24 ++++++ src/client/views/nodes/KeyValueBox.tsx | 89 ++++++++++++++++++++ src/client/views/nodes/KeyValuePair.tsx | 6 +- src/client/views/nodes/KeyValuePane.scss | 0 src/client/views/nodes/KeyValuePane.tsx | 96 ---------------------- 9 files changed, 123 insertions(+), 107 deletions(-) create mode 100644 src/client/views/nodes/KeyValueBox.scss create mode 100644 src/client/views/nodes/KeyValueBox.tsx delete mode 100644 src/client/views/nodes/KeyValuePane.scss delete mode 100644 src/client/views/nodes/KeyValuePane.tsx (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 41f1c9b3f..1d24ff7d2 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -13,7 +13,7 @@ import { CollectionView, CollectionViewType } from "../views/collections/Collect import { HtmlField } from "../../fields/HtmlField"; import { Key } from "../../fields/Key" import { Field } from "../../fields/Field"; -import { KeyValuePane } from "../views/nodes/KeyValuePane" +import { KeyValueBox } from "../views/nodes/KeyValueBox" import { KVPField } from "../../fields/KVPField"; export interface DocumentOptions { @@ -105,7 +105,7 @@ export namespace Documents { function GetKVPPrototype(): Document { return kvpProto ? kvpProto : - kvpProto = setupPrototypeOptions(kvpProtoId, "KVP_PROTO", KeyValuePane.LayoutString(), + kvpProto = setupPrototypeOptions(kvpProtoId, "KVP_PROTO", KeyValueBox.LayoutString(), { x: 0, y: 0, width: 300, height: 150, layoutKeys: [KeyStore.Data] }) } diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index 137bcf706..96b6d1477 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -16,6 +16,7 @@ import { DocumentView } from "../nodes/DocumentView"; import { FormattedTextBox } from "../nodes/FormattedTextBox"; import { ImageBox } from "../nodes/ImageBox"; import { WebBox } from "../nodes/WebBox"; +import { KeyValueBox } from "../nodes/KeyValueBox" import "./CollectionFreeFormView.scss"; import { COLLECTION_BORDER_WIDTH } from "./CollectionView"; import { CollectionViewBase } from "./CollectionViewBase"; @@ -230,7 +231,7 @@ export class CollectionFreeFormView extends CollectionViewBase { get backgroundView() { return !this.backgroundLayout ? (null) : ( { @computed get mainContent() { return { + + public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(KeyValueBox, fieldStr) } + private _ref: React.RefObject; + private _editorView: Opt; + private _reactionDisposer: Opt; + + + constructor(props: FieldViewProps) { + super(props); + + this._ref = React.createRef(); + } + + + + shouldComponentUpdate() { + return false; + } + + + onPointerDown = (e: React.PointerEvent): void => { + if (e.buttons === 1 && this.props.isSelected()) { + e.stopPropagation(); + } + } + onPointerWheel = (e: React.WheelEvent): void => { + e.stopPropagation(); + } + + createTable = () => { + let table: Array = [] + let ret = "waiting" + let doc = this.props.doc.GetT(KeyStore.Data, Document); + if (!doc || doc == "") { + return Loading... + } + let realDoc = doc; + + let ids: { [key: string]: string } = {}; + let protos = doc.GetAllPrototypes(); + for (const proto of protos) { + proto._proxies.forEach((val, key) => { + if (!(key in ids)) { + ids[key] = key; + } + }) + } + + let rows: JSX.Element[] = []; + let i = 0; + for (let key in ids) { + if (i++ % 2 == 0) + rows.push() + else rows.push() + } + return rows; + } + + + render() { + + return (
+ + + + + + + {this.createTable()} + +
KeyFields
+
) + } +} \ No newline at end of file diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index b8a0cca48..ecdd47a1e 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -1,5 +1,5 @@ import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app -import "./KeyValuePane.scss"; +import "./KeyValueBox.scss"; import React = require("react") import { FieldViewProps, FieldView } from './FieldView'; import { Opt, Field } from '../../../fields/Field'; @@ -12,6 +12,7 @@ import { Server } from "../../Server" // Represents one row in a key value plane export interface KeyValuePairProps { + rowStyle: string; fieldId: string; doc: Document; } @@ -33,7 +34,6 @@ export class KeyValuePair extends React.Component { } - render() { if (!this.key) { return error @@ -49,7 +49,7 @@ export class KeyValuePair extends React.Component { selectOnLoad: false, } return ( - {this.key.Name} + {this.key.Name} ) } } \ No newline at end of file diff --git a/src/client/views/nodes/KeyValuePane.scss b/src/client/views/nodes/KeyValuePane.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/client/views/nodes/KeyValuePane.tsx b/src/client/views/nodes/KeyValuePane.tsx deleted file mode 100644 index 90f5b653c..000000000 --- a/src/client/views/nodes/KeyValuePane.tsx +++ /dev/null @@ -1,96 +0,0 @@ - -import Lightbox from 'react-image-lightbox'; -import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app -import "./KeyValuePane.scss"; -import React = require("react") -import { FieldViewProps, FieldView } from './FieldView'; -import { FieldWaiting, Opt, Field } from '../../../fields/Field'; -import { observer } from "mobx-react" -import { observable, action, IReactionDisposer, reaction, ObservableMap } from 'mobx'; -import { KeyStore } from '../../../fields/KeyStore'; -import { RichTextField } from "../../../fields/RichTextField"; -import { element } from 'prop-types'; -import { props } from 'bluebird'; -import { EditorView } from 'prosemirror-view'; -import { Transaction, EditorState } from 'prosemirror-state'; -import { schema } from 'prosemirror-schema-basic'; -import { keymap } from 'prosemirror-keymap'; -import { undo, redo } from 'prosemirror-history'; -import { baseKeymap } from 'prosemirror-commands'; -import { KVPField } from '../../../fields/KVPField'; -import { Document } from '../../../fields/Document'; -import { Key } from '../../../fields/Key'; -import { JSXElement } from 'babel-types'; -import { KeyValuePair } from "./KeyValuePair" - -@observer -export class KeyValuePane extends React.Component { - - public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(KeyValuePane, fieldStr) } - private _ref: React.RefObject; - private _editorView: Opt; - private _reactionDisposer: Opt; - - - constructor(props: FieldViewProps) { - super(props); - - this._ref = React.createRef(); - } - - - - shouldComponentUpdate() { - return false; - } - - - onPointerDown = (e: React.PointerEvent): void => { - if (e.buttons === 1 && this.props.isSelected()) { - e.stopPropagation(); - } - } - onPointerWheel = (e: React.WheelEvent): void => { - e.stopPropagation(); - } - - createTable = () => { - let table: Array = [] - let ret = "waiting" - let doc = this.props.doc.GetT(KeyStore.Data, Document); - if (!doc || doc == "") { - return Loading... - } - let realDoc = doc; - - let ids: { [key: string]: string } = {}; - let protos = doc.GetAllPrototypes(); - for (const proto of protos) { - proto._proxies.forEach((val, key) => { - if (!(key in ids)) { - ids[key] = key; - } - }) - } - - let rows: JSX.Element[] = []; - for (let key in ids) { - rows.push() - } - return rows; - } - - - render() { - - return ( - - - - - - {this.createTable()} - -
KeyFields
) - } -} \ No newline at end of file -- cgit v1.2.3-70-g09d2