@finos/legend-query-builder 4.10.0 → 4.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. package/lib/__lib__/QueryBuilderTesting.d.ts +1 -0
  2. package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTesting.js +1 -0
  4. package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  6. package/lib/components/QueryBuilderResultPanel.js +44 -57
  7. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  8. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +3 -2
  9. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  10. package/lib/components/filter/QueryBuilderFilterPanel.js +145 -8
  11. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  12. package/lib/index.css +1 -1
  13. package/lib/package.json +1 -1
  14. package/lib/stores/QueryBuilderResultState.d.ts +3 -0
  15. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  16. package/lib/stores/QueryBuilderResultState.js +31 -2
  17. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  18. package/lib/stores/filter/QueryBuilderFilterState.d.ts +7 -1
  19. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  20. package/lib/stores/filter/QueryBuilderFilterState.js +27 -0
  21. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  22. package/package.json +5 -5
  23. package/src/__lib__/QueryBuilderTesting.ts +1 -0
  24. package/src/components/QueryBuilderResultPanel.tsx +63 -76
  25. package/src/components/filter/QueryBuilderFilterPanel.tsx +239 -21
  26. package/src/stores/QueryBuilderResultState.ts +36 -1
  27. package/src/stores/filter/QueryBuilderFilterState.ts +40 -1
@@ -466,6 +466,7 @@ export class QueryBuilderFilterState
466
466
  addNodeFromNode: action,
467
467
  replaceBlankNodeWithNode: action,
468
468
  addGroupConditionNodeFromNode: action,
469
+ newGroupConditionFromNode: action,
469
470
  newGroupWithConditionFromNode: action,
470
471
  removeNodeAndPruneBranch: action,
471
472
  pruneTree: action,
@@ -514,7 +515,7 @@ export class QueryBuilderFilterState
514
515
  return rootId ? this.getNode(rootId) : undefined;
515
516
  }
516
517
 
517
- private getParentNode(
518
+ getParentNode(
518
519
  node: QueryBuilderFilterTreeNodeData,
519
520
  ): QueryBuilderFilterTreeOperationNodeData | undefined {
520
521
  return node.parentId
@@ -635,6 +636,44 @@ export class QueryBuilderFilterState
635
636
  this.addNodeFromNode(newGroupNode, fromNode);
636
637
  }
637
638
 
639
+ /**
640
+ *
641
+ * Function to create group condition from node where either of the
642
+ * child nodes of group condition is `exists` node
643
+ */
644
+ newGroupConditionFromNode(
645
+ fromNode:
646
+ | QueryBuilderFilterTreeConditionNodeData
647
+ | QueryBuilderFilterTreeExistsNodeData,
648
+ node?:
649
+ | QueryBuilderFilterTreeConditionNodeData
650
+ | QueryBuilderFilterTreeExistsNodeData
651
+ | undefined,
652
+ operation?: QUERY_BUILDER_GROUP_OPERATION | undefined,
653
+ ): QueryBuilderFilterTreeGroupNodeData {
654
+ const fromNodeParent = this.getParentNode(fromNode);
655
+ const newGroupNode = new QueryBuilderFilterTreeGroupNodeData(
656
+ undefined,
657
+ operation ?? QUERY_BUILDER_GROUP_OPERATION.AND,
658
+ );
659
+ this.nodes.set(newGroupNode.id, newGroupNode);
660
+ fromNodeParent?.removeChildNode(fromNode);
661
+ newGroupNode.addChildNode(fromNode);
662
+ if (node) {
663
+ this.nodes.set(node.id, node);
664
+ newGroupNode.addChildNode(node);
665
+ }
666
+ newGroupNode.lambdaParameterName =
667
+ fromNodeParent?.lambdaParameterName ?? this.lambdaParameterName;
668
+ if (fromNodeParent) {
669
+ fromNodeParent.addChildNode(newGroupNode);
670
+ } else {
671
+ deleteEntry(this.rootIds, fromNode.id);
672
+ this.addRootNode(newGroupNode);
673
+ }
674
+ return newGroupNode;
675
+ }
676
+
638
677
  newGroupWithConditionFromNode(
639
678
  node: QueryBuilderFilterTreeNodeData | undefined,
640
679
  fromNode: QueryBuilderFilterTreeNodeData | undefined,