aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-06-11 01:56:17 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-06-11 01:56:17 -0400
commitc2a2b8c119c44b167310485cede0920f313cd40a (patch)
treed70c91fba745ae2d9952e7007d15c659657fb7f1 /src
parent74849a5f9307ca64e2bbafa9eaa77822de18102d (diff)
rowmenu info icons
Diffstat (limited to 'src')
-rw-r--r--src/client/views/MainView.tsx1
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.scss17
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx22
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx13
4 files changed, 37 insertions, 16 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 8dc2ce98a..5b9ddbb88 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -278,6 +278,7 @@ export class MainView extends ObservableReactComponent<{}> {
library.add(
...[
+ fa.faGift,
fa.faLockOpen,
fa.faSort,
fa.faArrowUpZA,
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.scss b/src/client/views/collections/collectionSchema/CollectionSchemaView.scss
index ceffc7e44..d1f1e3a13 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.scss
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.scss
@@ -259,9 +259,6 @@
flex-direction: row;
min-width: 50px;
justify-content: center;
- .iconButton-container {
- min-width: unset !important;
- }
}
.row-cells {
@@ -269,6 +266,20 @@
flex-direction: row;
justify-content: flex-end;
}
+
+ .row-menu-infos {
+ position: absolute;
+ top: 3;
+ left: 3;
+ z-index: 1;
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+
+ .row-infos-icon {
+ padding-right: 2px;
+ }
+ }
}
.schema-row-button,
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index dc29e7413..4abbc7f51 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -201,7 +201,7 @@ export class CollectionSchemaView extends CollectionSubView() {
this._docs = this._docs.filter(d => d !== doc)
}
- rowIndex = (doc: Doc) => this.displayedDocs.docs.indexOf(doc);
+ rowIndex = (doc: Doc) => this.draggedSpliceDocs.docs.indexOf(doc);
@action
onKeyDown = (e: KeyboardEvent) => {
@@ -211,9 +211,9 @@ export class CollectionSchemaView extends CollectionSubView() {
{
const lastDoc = this._selectedDocs.lastElement();
const lastIndex = this.rowIndex(lastDoc);
- const curDoc = this.displayedDocs.docs[lastIndex];
+ const curDoc = this.docs[lastIndex];
if (lastIndex >= 0 && lastIndex < this.childDocs.length - 1) {
- const newDoc = this.displayedDocs.docs[lastIndex + 1];
+ const newDoc = this.docs[lastIndex + 1];
if (this._selectedDocs.includes(newDoc)) {
DocumentView.DeselectView(DocumentView.getFirstDocumentView(curDoc));
this.deselectCell(curDoc);
@@ -230,9 +230,9 @@ export class CollectionSchemaView extends CollectionSubView() {
{
const firstDoc = this._selectedDocs.lastElement();
const firstIndex = this.rowIndex(firstDoc);
- const curDoc = this.displayedDocs.docs[firstIndex];
+ const curDoc = this.docs[firstIndex];
if (firstIndex > 0 && firstIndex < this.childDocs.length) {
- const newDoc = this.displayedDocs.docs[firstIndex - 1];
+ const newDoc = this.docs[firstIndex - 1];
if (this._selectedDocs.includes(newDoc)) {
DocumentView.DeselectView(DocumentView.getFirstDocumentView(curDoc));
this.deselectCell(curDoc);
@@ -514,7 +514,7 @@ export class CollectionSchemaView extends CollectionSubView() {
const startRow = Math.min(lastSelectedRow, index);
const endRow = Math.max(lastSelectedRow, index);
for (let i = startRow; i <= endRow; i++) {
- const currDoc = this.displayedDocs.docs[i];
+ const currDoc = this.docs[i];
if (!this._selectedDocs.includes(currDoc)) {
this.selectCell(currDoc, this._selectedCol, false, true);
}
@@ -555,8 +555,6 @@ export class CollectionSchemaView extends CollectionSubView() {
this._lowestSelectedIndex = -1;
};
- sortedSelectedDocs = () => this.displayedDocs.docs.filter(doc => this._selectedDocs.includes(doc));
-
@computed
get rowDropIndex() {
const mouseY = this.ScreenToLocalBoxXf().transformPoint(this._mouseCoordinates.x, this._mouseCoordinates.y)[1];
@@ -587,7 +585,7 @@ export class CollectionSchemaView extends CollectionSubView() {
const draggedDocs = de.complete.docDragData?.draggedDocuments;
if (draggedDocs && super.onInternalDrop(e, de) && !this.sortField) {
- const docs = this.displayedDocs.docs.slice();
+ const docs = this.draggedSpliceDocs.docs.slice();
this._docs = docs;
this.clearSelection();
draggedDocs.forEach(doc => {
@@ -719,7 +717,7 @@ export class CollectionSchemaView extends CollectionSubView() {
};
setCellValues = (key: string, value: string) => {
- if (this._selectedCells.length === 1) this.childDocs.forEach(doc => !doc._lockedSchemaEditing &&Doc.SetField(doc, key, value)); // if only one cell selected, fill all
+ if (this._selectedCells.length === 1) this.docs.forEach(doc => !doc._lockedSchemaEditing &&Doc.SetField(doc, key, value)); // if only one cell selected, fill all
else this._selectedCells.forEach(doc => !doc._lockedSchemaEditing && Doc.SetField(doc, key, value)); // else only fill selected cells
return true;
};
@@ -1037,7 +1035,7 @@ export class CollectionSchemaView extends CollectionSubView() {
return docs;
}
- @computed get displayedDocs() {
+ @computed get draggedSpliceDocs() {
const draggedDocs = this.isContentActive() ? DragManager.docsBeingDragged : [];
let docs = [...this.docs];
docs = docs.filter(d => !draggedDocs.includes(d));
@@ -1064,7 +1062,7 @@ export class CollectionSchemaView extends CollectionSubView() {
screenToLocal = () => this.ScreenToLocalBoxXf().translate(-this.tableWidth, 0);
previewWidthFunc = () => this.previewWidth;
onPassiveWheel = (e: WheelEvent) => e.stopPropagation();
- displayedDocsFunc = () => this.displayedDocs.docs;
+ displayedDocsFunc = () => this.draggedSpliceDocs.docs;
_oldWheel: any;
render() {
return (
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index a0d3144ce..98a16deea 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -7,7 +7,7 @@ import { CgClose, CgLock, CgLockUnlock, CgMenu } from 'react-icons/cg';
import { FaExternalLinkAlt } from 'react-icons/fa';
import { returnFalse, setupMoveUpEvents } from '../../../../ClientUtils';
import { emptyFunction } from '../../../../Utils';
-import { Doc, DocListCast } from '../../../../fields/Doc';
+import { Doc, DocListCast, FieldResult } from '../../../../fields/Doc';
import { BoolCast } from '../../../../fields/Types';
import { Transform } from '../../../util/Transform';
import { undoable } from '../../../util/UndoManager';
@@ -21,6 +21,7 @@ import { SchemaTableCell } from './SchemaTableCell';
import { ContextMenu } from '../../ContextMenu';
import { CollectionFreeFormView } from '../collectionFreeForm';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { IconProp } from '@fortawesome/fontawesome-svg-core';
interface SchemaRowBoxProps extends FieldViewProps {
rowIndex: number;
@@ -94,6 +95,13 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
return ''
}
+ get menuInfos() {
+ const infos: Array<IconProp> = [];
+ if (this.Document._lockedSchemaEditing) infos.push('lock');
+ if (this.Document._childrenSharedWithSchema) infos.push('star');
+ return infos;
+ }
+
cleanupField = (field: string) => this.schemaView.cleanupComputedField(field)
setCursorIndex = (mouseY: number) => this.schemaView?.setRelCursorIndex(mouseY);
selectedCol = () => this.schemaView._selectedCol;
@@ -113,6 +121,9 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
row && this.schemaView?.addRowRef?.(this.Document, row);
this._ref = row;
}}>
+ <div className="row-menu-infos">
+ {this.menuInfos.map(icn => <FontAwesomeIcon className="row-infos-icon" icon={icn} size='2xs' />)}
+ </div>
<div
className="row-menu"
style={{