From 5cb549b88836f6674c7d346c75a679a73672e1fa Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 7 May 2024 18:27:21 -0400 Subject: key filtering for colkeymenu working (still need to implement UI) --- .../collectionSchema/CollectionSchemaView.tsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') 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 (