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/views/nodes/KeyValueBox.tsx | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/client/views/nodes/KeyValueBox.tsx (limited to 'src/client/views/nodes/KeyValueBox.tsx') diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx new file mode 100644 index 000000000..7e2426b58 --- /dev/null +++ b/src/client/views/nodes/KeyValueBox.tsx @@ -0,0 +1,89 @@ + +import { IReactionDisposer } from 'mobx'; +import { observer } from "mobx-react"; +import { EditorView } from 'prosemirror-view'; +import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app +import { Document } from '../../../fields/Document'; +import { Opt } from '../../../fields/Field'; +import { KeyStore } from '../../../fields/KeyStore'; +import { FieldView, FieldViewProps } from './FieldView'; +import { KeyValuePair } from "./KeyValuePair"; +import "./KeyValueBox.scss"; +import React = require("react") + +@observer +export class KeyValueBox extends React.Component { + + 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 -- cgit v1.2.3-70-g09d2 From 179be4e314409269494da0d5bc52ca05c778d535 Mon Sep 17 00:00:00 2001 From: bob Date: Thu, 28 Feb 2019 17:24:26 -0500 Subject: fixed warning --- src/client/views/nodes/KeyValueBox.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/client/views/nodes/KeyValueBox.tsx') diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx index 7e2426b58..75e2952b7 100644 --- a/src/client/views/nodes/KeyValueBox.tsx +++ b/src/client/views/nodes/KeyValueBox.tsx @@ -65,8 +65,8 @@ export class KeyValueBox extends React.Component { let i = 0; for (let key in ids) { if (i++ % 2 == 0) - rows.push() - else rows.push() + rows.push() + else rows.push() } return rows; } -- cgit v1.2.3-70-g09d2 From bde8aabad7e5745b4797e73b564e4efb19faeca9 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Fri, 1 Mar 2019 00:13:35 -0500 Subject: minor cleanup --- src/client/views/nodes/KeyValueBox.scss | 7 +++++++ src/client/views/nodes/KeyValueBox.tsx | 12 ++++-------- src/client/views/nodes/KeyValuePair.tsx | 5 ++++- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src/client/views/nodes/KeyValueBox.tsx') diff --git a/src/client/views/nodes/KeyValueBox.scss b/src/client/views/nodes/KeyValueBox.scss index f22989735..1295266e5 100644 --- a/src/client/views/nodes/KeyValueBox.scss +++ b/src/client/views/nodes/KeyValueBox.scss @@ -6,6 +6,13 @@ border-style: solid; box-sizing: border-box; display: inline-block; + .imageBox-cont img { + max-height:45px; + height: auto; + } +} +.keyValueBox-table { + position: relative; } .keyValueBox-header { background:gray; diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx index 75e2952b7..e8ebd50be 100644 --- a/src/client/views/nodes/KeyValueBox.tsx +++ b/src/client/views/nodes/KeyValueBox.tsx @@ -4,7 +4,7 @@ import { observer } from "mobx-react"; import { EditorView } from 'prosemirror-view'; import 'react-image-lightbox/style.css'; // This only needs to be imported once in your app import { Document } from '../../../fields/Document'; -import { Opt } from '../../../fields/Field'; +import { Opt, FieldWaiting } from '../../../fields/Field'; import { KeyStore } from '../../../fields/KeyStore'; import { FieldView, FieldViewProps } from './FieldView'; import { KeyValuePair } from "./KeyValuePair"; @@ -43,10 +43,8 @@ export class KeyValueBox extends React.Component { } createTable = () => { - let table: Array = [] - let ret = "waiting" let doc = this.props.doc.GetT(KeyStore.Data, Document); - if (!doc || doc == "") { + if (!doc || doc == FieldWaiting) { return Loading... } let realDoc = doc; @@ -64,9 +62,7 @@ export class KeyValueBox extends React.Component { let rows: JSX.Element[] = []; let i = 0; for (let key in ids) { - if (i++ % 2 == 0) - rows.push() - else rows.push() + rows.push() } return rows; } @@ -74,7 +70,7 @@ export class KeyValueBox extends React.Component { render() { - return (
+ return (
diff --git a/src/client/views/nodes/KeyValuePair.tsx b/src/client/views/nodes/KeyValuePair.tsx index ecdd47a1e..a97e98313 100644 --- a/src/client/views/nodes/KeyValuePair.tsx +++ b/src/client/views/nodes/KeyValuePair.tsx @@ -49,7 +49,10 @@ export class KeyValuePair extends React.Component { selectOnLoad: false, } return ( - + + + + ) } } \ No newline at end of file -- cgit v1.2.3-70-g09d2
{this.key.Name}
{this.key.Name}