aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-07 18:27:21 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-07 18:27:21 -0400
commit5cb549b88836f6674c7d346c75a679a73672e1fa (patch)
tree199c89839346b52365f5fcbc55049e6387888793 /src
parent2e27b90ded41146b249649b0b0c3267b46c68363 (diff)
key filtering for colkeymenu working (still need to implement UI)
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 27e1eabcf..4490b8dec 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -32,6 +32,7 @@ import { CollectionSubView } from '../CollectionSubView';
import './CollectionSchemaView.scss';
import { SchemaColumnHeader } from './SchemaColumnHeader';
import { SchemaRowBox } from './SchemaRowBox';
+import { ActionButton } from '@adobe/react-spectrum';
const { SCHEMA_NEW_NODE_HEIGHT } = require('../../global/globalCssVariables.module.scss'); // prettier-ignore
@@ -393,9 +394,7 @@ export class CollectionSchemaView extends CollectionSubView() {
};
findColDropIndex = (mouseX: number) => {
- let leftOffset: number = this._props.ScreenToLocalTransform().inverse().transformPoint(0,0)[0]
- console.log(leftOffset)
- console.log(CollectionSchemaView._rowMenuWidth)
+ let xOffset: number = this._props.ScreenToLocalTransform().inverse().transformPoint(0,0)[0] + CollectionSchemaView._rowMenuWidth;
let index: number | undefined;
this.displayColumnWidths.reduce((total, curr, i) => {
if (total <= mouseX && total + curr >= mouseX) {
@@ -403,7 +402,7 @@ export class CollectionSchemaView extends CollectionSubView() {
else index = i + 1;
}
return total + curr;
- }, leftOffset + CollectionSchemaView._rowMenuWidth); //probably prone to issues; find better implementation (!!!)
+ }, xOffset);
return index;
};
@@ -744,17 +743,15 @@ export class CollectionSchemaView extends CollectionSubView() {
return true;
};
- @computed
- get activeMenuKeys() {
+ activeMenuKeys = () => {
let activeKeys = this.documentKeys.filter(key => this.childDocsInclude(key));
return activeKeys
}
childDocsInclude = (key: string) => {
- this.childDocs.forEach(doc => {
- //TODO: if childdoc fieldkeys contain the key, return true
- })
- return false
+ let keyExists: boolean = false;
+ this.childDocs.forEach(doc => {if (Object.keys(doc).includes(key)) keyExists = true;})
+ return keyExists
}
@action
@@ -954,7 +951,7 @@ export class CollectionSchemaView extends CollectionSubView() {
return (
<div className="schema-column-menu" style={{ left: 0, minWidth: CollectionSchemaView._minColWidth }}>
<input className="schema-key-search-input" type="text" onKeyDown={this.onSearchKeyDown} onChange={this.updateKeySearch} onPointerDown={e => e.stopPropagation()} />
- <button className="schema-column-menu-toggle" onClick={() => null}></button>
+ <button className="schema-column-menu-toggle" onClick={() => this._menuKeys = this.activeMenuKeys()}></button>
{this._makeNewField ? this.newFieldMenu : this.keysDropdown}
</div>
);