aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx16
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx8
2 files changed, 17 insertions, 7 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 5c8a84163..992ee2ec9 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -101,8 +101,8 @@ export class CollectionSchemaView extends CollectionSubView() {
@observable _colBeingDragged: boolean = false;
@observable _colKeysFiltered: boolean = false;
@observable _cellTags: ObservableMap = new ObservableMap<Doc, Array<string>>();
- @observable _highlightedCells: Array<HTMLDivElement> = [];
- @observable _cellHighlightColors: ObservableMap = new ObservableMap<HTMLDivElement, string[]>();
+ @observable _highlightedCells: Array<[doc: Doc, field: string]> = [];
+ @observable _cellHighlightColors: ObservableMap = new ObservableMap<[doc: Doc, field: string], string[]>();
@observable _docs: Doc[] = [];
// target HTMLelement portal for showing a popup menu to edit cell values.
@@ -290,7 +290,7 @@ export class CollectionSchemaView extends CollectionSubView() {
break;
}
case 'P': {
- this.highlightSortedColumn();
+ console.log(this._cellHighlightColors)
break;
}
default:
@@ -551,14 +551,17 @@ export class CollectionSchemaView extends CollectionSubView() {
matches.forEach((match: Match) => {
const {docRef, field} = match;
const doc = DocumentManager.Instance.DocumentViews[Number(docRef)].Document;
- if (this.columnKeys.includes(field)) {cells.push(this.getCellElement(doc, field))}
+ if (this.columnKeys.includes(field)) {cells.push([doc, field])}
})
return cells;
}
removeCellHighlights = () => {
- this._highlightedCells.forEach(cell => {cell.style.border = ''; cell.style.backgroundColor = '';});
+ this._highlightedCells.forEach(info => {
+ const cell = this.getCellElement(info[0], info[1]);
+ cell.style.border = ''; cell.style.backgroundColor = '';
+ });
this._highlightedCells = [];
}
@@ -580,8 +583,9 @@ export class CollectionSchemaView extends CollectionSubView() {
const cellsToHighlight = this.findCellRefs(text);
this._highlightedCells = [...cellsToHighlight];
- this._highlightedCells.forEach(cell => {
+ this._highlightedCells.forEach(info => {
const color = randomRGBColor();
+ const cell = this.getCellElement(info[0], info[1]);
if (!this._cellHighlightColors.has(cell)) {this._cellHighlightColors.set(cell, new Array<string>(`solid 2px ${color[0]}`, color[1]))}
cell.style.border = this._cellHighlightColors.get(cell)[0];
cell.style.backgroundColor = this._cellHighlightColors.get(cell)[1];
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index c0ad95141..6f6b6decf 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -125,7 +125,13 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
equationHighlightRef = (text: string) => {
}
- eqHighlightFunc = (text: string, raw: boolean) => {return this.schemaView.findCellRefs(text, raw)};
+ eqHighlightFunc = (text: string, raw: boolean) => {
+ const info = this.schemaView.findCellRefs(text, raw);
+ if (raw) return info;
+ const cells: HTMLDivElement[] = [];
+ info.forEach(info => {cells.push(this.schemaView.getCellElement(info[0], info[1]))})
+ return cells;
+ };
render() {
return (
<div