aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionMasonryViewFieldRow.tsx')
-rw-r--r--src/client/views/collections/CollectionMasonryViewFieldRow.tsx49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
index befd89e41..64f9c6a87 100644
--- a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
+++ b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
@@ -2,7 +2,8 @@ import React = require('react');
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
-import { DataSym, Doc, DocListCast } from '../../../fields/Doc';
+import { Doc, DocListCast } from '../../../fields/Doc';
+import { DocData } from '../../../fields/DocSymbols';
import { Id } from '../../../fields/FieldSymbols';
import { PastelSchemaPalette, SchemaHeaderField } from '../../../fields/SchemaHeaderField';
import { ScriptField } from '../../../fields/ScriptField';
@@ -44,7 +45,7 @@ interface CMVFieldRowProps {
@observer
export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowProps> {
@observable private _background = 'inherit';
- @observable private _createAliasSelected: boolean = false;
+ @observable private _createEmbeddingSelected: boolean = false;
@observable private heading: string = '';
@observable private color: string = '#f1efeb';
@observable private collapsed: boolean = false;
@@ -95,7 +96,7 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
@undoBatch
rowDrop = action((e: Event, de: DragManager.DropEvent) => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
if (de.complete.docDragData) {
this.props.parent.Document.dropConverter instanceof ScriptField && this.props.parent.Document.dropConverter.script.run({ dragData: de.complete.docDragData });
const key = this.props.pivotField;
@@ -117,12 +118,12 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
@action
headingChanged = (value: string, shiftDown?: boolean) => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
const key = this.props.pivotField;
const castedValue = this.getValue(value);
if (castedValue) {
- if (this.props.parent.columnHeaders) {
- if (this.props.parent.columnHeaders.map(i => i.heading).indexOf(castedValue.toString()) > -1) {
+ if (this.props.parent.colHeaderData) {
+ if (this.props.parent.colHeaderData.map(i => i.heading).indexOf(castedValue.toString()) > -1) {
return false;
}
}
@@ -135,7 +136,7 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
@action
changeColumnColor = (color: string) => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
this._color = color;
};
@@ -143,53 +144,53 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
@action
pointerLeaveRow = () => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
this._background = 'inherit';
};
@action
addDocument = (value: string, shiftDown?: boolean, forceEmptyNote?: boolean) => {
if (!value && !forceEmptyNote) return false;
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
const key = this.props.pivotField;
- const newDoc = Docs.Create.TextDocument('', { _autoHeight: true, _width: 200, _fitWidth: true, title: value });
+ const newDoc = Docs.Create.TextDocument('', { _layout_autoHeight: true, _width: 200, _layout_fitWidth: true, title: value });
const onLayoutDoc = this.onLayoutDoc(key);
FormattedTextBox.SelectOnLoad = newDoc[Id];
FormattedTextBox.SelectOnLoadChar = value;
- (onLayoutDoc ? newDoc : newDoc[DataSym])[key] = this.getValue(this.props.heading);
+ (onLayoutDoc ? newDoc : newDoc[DocData])[key] = this.getValue(this.props.heading);
const docs = this.props.parent.childDocList;
return docs ? (docs.splice(0, 0, newDoc) ? true : false) : this.props.parent.props.addDocument?.(newDoc) || false; // should really extend addDocument to specify insertion point (at beginning of list)
};
deleteRow = undoBatch(
action(() => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
const key = this.props.pivotField;
this.props.docList.forEach(d => Doc.SetInPlace(d, key, undefined, true));
- if (this.props.parent.columnHeaders && this.props.headingObject) {
- const index = this.props.parent.columnHeaders.indexOf(this.props.headingObject);
- this.props.parent.columnHeaders.splice(index, 1);
+ if (this.props.parent.colHeaderData && this.props.headingObject) {
+ const index = this.props.parent.colHeaderData.indexOf(this.props.headingObject);
+ this.props.parent.colHeaderData.splice(index, 1);
}
})
);
@action
collapseSection = (e: any) => {
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
this.toggleVisibility();
e.stopPropagation();
};
headerMove = (e: PointerEvent) => {
- const alias = Doc.MakeAlias(this.props.Document);
+ const embedding = Doc.MakeEmbedding(this.props.Document);
const key = this.props.pivotField;
let value = this.getValue(this.heading);
value = typeof value === 'string' ? `"${value}"` : value;
const script = `return doc.${key} === ${value}`;
const compiled = CompileScript(script, { params: { doc: Doc.name } });
if (compiled.compiled) {
- alias.viewSpecScript = new ScriptField(compiled);
- DragManager.StartDocumentDrag([this._headerRef.current!], new DragManager.DocumentDragData([alias]), e.clientX, e.clientY);
+ embedding.viewSpecScript = new ScriptField(compiled);
+ DragManager.StartDocumentDrag([this._headerRef.current!], new DragManager.DocumentDragData([embedding]), e.clientX, e.clientY);
}
return true;
};
@@ -198,7 +199,7 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
headerDown = (e: React.PointerEvent<HTMLDivElement>) => {
if (e.button === 0 && !e.ctrlKey) {
setupMoveUpEvents(this, e, this.headerMove, emptyFunction, e => !this.props.chromeHidden && this.collapseSection(e));
- this._createAliasSelected = false;
+ this._createEmbeddingSelected = false;
}
};
@@ -242,16 +243,16 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
);
};
- toggleAlias = action(() => (this._createAliasSelected = true));
+ toggleEmbedding = action(() => (this._createEmbeddingSelected = true));
toggleVisibility = () => (this._collapsed = !this.collapsed);
renderMenu = () => {
- const selected = this._createAliasSelected;
+ const selected = this._createEmbeddingSelected;
return (
<div className="collectionStackingView-optionPicker">
<div className="optionOptions">
- <div className={'optionPicker' + (selected === true ? ' active' : '')} onClick={this.toggleAlias}>
- Create Alias
+ <div className={'optionPicker' + (selected === true ? ' active' : '')} onClick={this.toggleEmbedding}>
+ Create Embedding
</div>
<div className={'optionPicker' + (selected === true ? ' active' : '')} onClick={this.deleteRow}>
Delete