diff --git a/packages/datalib/src/PerspectiveCache.ts b/packages/datalib/src/PerspectiveCache.ts index 478bca5dd..5446d87a8 100644 --- a/packages/datalib/src/PerspectiveCache.ts +++ b/packages/datalib/src/PerspectiveCache.ts @@ -5,7 +5,7 @@ import _difference from 'lodash/difference'; import debug from 'debug'; import stableStringify from 'json-stable-stringify'; import { PerspectiveDataPattern } from './PerspectiveDataPattern'; -import { perspectiveValueMatcherSimple } from './perspectiveTools'; +import { perspectiveValueMatcher } from './perspectiveTools'; const dbg = debug('dbgate:PerspectiveCache'); @@ -19,7 +19,7 @@ export class PerspectiveBindingGroup { matchRow(row) { return this.table.bindingColumns.every((column, index) => - perspectiveValueMatcherSimple(row[column], this.bindingValues[index]) + perspectiveValueMatcher(row[column], this.bindingValues[index]) ); } } @@ -73,7 +73,7 @@ export class PerspectiveCacheTable { storeGroupSize(props: PerspectiveDataLoadProps, bindingValues: any[], count: number) { const originalBindingValue = props.bindingValues.find(v => - _zip(v, bindingValues).every(([x, y]) => perspectiveValueMatcherSimple(x, y)) + _zip(v, bindingValues).every(([x, y]) => perspectiveValueMatcher(x, y)) ); // console.log('storeGroupSize NEW', bindingValues); // console.log('storeGroupSize ORIGINAL', originalBindingValue); diff --git a/packages/datalib/src/PerspectiveTreeNode.ts b/packages/datalib/src/PerspectiveTreeNode.ts index 42d77ed80..f80c9a2a7 100644 --- a/packages/datalib/src/PerspectiveTreeNode.ts +++ b/packages/datalib/src/PerspectiveTreeNode.ts @@ -835,10 +835,10 @@ export class PerspectivePatternColumnNode extends PerspectiveTreeNode { return null; } - get generatesHiearchicGridColumn() { + get generatesHiearchicGridColumn(): boolean { // return true; // console.log('generatesHiearchicGridColumn', this.parentTableNode?.nodeConfig?.checkedColumns, this.codeName + '::'); - if (!!this.tableNodeOrParent?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::'))) { + if (this.tableNodeOrParent?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::'))) { return true; } // return false; diff --git a/packages/datalib/src/perspectiveTools.ts b/packages/datalib/src/perspectiveTools.ts index 5a93757b3..0ce3f2d83 100644 --- a/packages/datalib/src/perspectiveTools.ts +++ b/packages/datalib/src/perspectiveTools.ts @@ -9,14 +9,14 @@ export function getPerspectiveMostNestedChildColumnName(columnName: string) { return path[path.length - 1]; } +// export function perspectiveValueMatcher(value1, value2): boolean { +// if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid; +// if (Array.isArray(value1)) return !!value1.find(x => perspectiveValueMatcher(x, value2)); +// if (Array.isArray(value2)) return !!value2.find(x => perspectiveValueMatcher(value1, x)); +// return value1 == value2; +// } + export function perspectiveValueMatcher(value1, value2): boolean { - if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid; - if (Array.isArray(value1)) return !!value1.find(x => perspectiveValueMatcher(x, value2)); - if (Array.isArray(value2)) return !!value2.find(x => perspectiveValueMatcher(value1, x)); - return value1 == value2; -} - -export function perspectiveValueMatcherSimple(value1, value2): boolean { if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid; return value1 == value2; }