@finos/legend-query-builder 4.14.54 → 4.14.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/lib/__lib__/QueryBuilderTesting.d.ts +5 -1
  2. package/lib/__lib__/QueryBuilderTesting.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTesting.js +10 -1
  4. package/lib/__lib__/QueryBuilderTesting.js.map +1 -1
  5. package/lib/components/QueryBuilder.js +3 -3
  6. package/lib/components/QueryBuilder.js.map +1 -1
  7. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +9 -1
  8. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderPropertyExpressionEditor.js +10 -8
  10. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  11. package/lib/components/QueryLoader.js +3 -3
  12. package/lib/components/QueryLoader.js.map +1 -1
  13. package/lib/components/execution-plan/ExecutionPlanViewer.js +2 -2
  14. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  15. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts +12 -2
  16. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  17. package/lib/components/explorer/QueryBuilderExplorerPanel.js +4 -4
  18. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  19. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js +2 -2
  20. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.js.map +1 -1
  21. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +1 -1
  22. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  23. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +55 -45
  24. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  25. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +2 -2
  26. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  27. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +5 -5
  28. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  29. package/lib/components/filter/QueryBuilderFilterPanel.js +3 -3
  30. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  31. package/lib/components/result/QueryBuilderResultPanel.js +3 -3
  32. package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
  33. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  34. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +2 -1
  35. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  36. package/lib/index.css +17 -1
  37. package/lib/index.css.map +1 -1
  38. package/lib/index.d.ts +12 -0
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.js +12 -0
  41. package/lib/index.js.map +1 -1
  42. package/lib/package.json +3 -3
  43. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +4 -2
  44. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  45. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +12 -4
  46. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  47. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts +2 -1
  48. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
  49. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +15 -0
  50. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  51. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts +3 -2
  52. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -1
  53. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js +1 -1
  54. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -1
  55. package/lib/stores/workflows/ServiceQueryBuilderState.js +1 -1
  56. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  57. package/package.json +11 -11
  58. package/src/__lib__/QueryBuilderTesting.ts +10 -1
  59. package/src/components/QueryBuilder.tsx +5 -5
  60. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +35 -16
  61. package/src/components/QueryLoader.tsx +5 -5
  62. package/src/components/execution-plan/ExecutionPlanViewer.tsx +3 -3
  63. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +5 -5
  64. package/src/components/explorer/QueryBuilderFunctionsExplorerPanel.tsx +3 -3
  65. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +181 -160
  66. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +3 -3
  67. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +9 -9
  68. package/src/components/filter/QueryBuilderFilterPanel.tsx +5 -5
  69. package/src/components/result/QueryBuilderResultPanel.tsx +5 -5
  70. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +2 -1
  71. package/src/index.ts +24 -2
  72. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +15 -3
  73. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +39 -0
  74. package/src/stores/filter/QueryBuilderFilterValueSpecificationBuilder.ts +1 -1
  75. package/src/stores/workflows/ServiceQueryBuilderState.ts +1 -1
@@ -28,7 +28,7 @@ import {
28
28
  type TreeNodeViewProps,
29
29
  clsx,
30
30
  ContextMenu,
31
- DropdownMenu,
31
+ ControlledDropdownMenu,
32
32
  MenuContent,
33
33
  MenuContentItem,
34
34
  BlankPanelPlaceholder,
@@ -828,7 +828,7 @@ const QueryBuilderFilterConditionEditor = observer(
828
828
  propertyExpressionState={node.condition.propertyExpressionState}
829
829
  />
830
830
  </div>
831
- <DropdownMenu
831
+ <ControlledDropdownMenu
832
832
  className="query-builder-filter-tree__condition-node__operator"
833
833
  title="Choose Operator..."
834
834
  content={
@@ -856,7 +856,7 @@ const QueryBuilderFilterConditionEditor = observer(
856
856
  <div className="query-builder-filter-tree__condition-node__operator__dropdown__trigger">
857
857
  <CaretDownIcon />
858
858
  </div>
859
- </DropdownMenu>
859
+ </ControlledDropdownMenu>
860
860
  {node.condition.value && (
861
861
  <div
862
862
  ref={dropConnector}
@@ -1499,7 +1499,7 @@ export const QueryBuilderFilterPanel = observer(
1499
1499
  </div>
1500
1500
 
1501
1501
  <div className="panel__header__actions">
1502
- <DropdownMenu
1502
+ <ControlledDropdownMenu
1503
1503
  className="panel__header__action"
1504
1504
  title="Show Filter Options Menu..."
1505
1505
  content={
@@ -1572,7 +1572,7 @@ export const QueryBuilderFilterPanel = observer(
1572
1572
  }
1573
1573
  >
1574
1574
  <MoreVerticalIcon className="query-builder__icon__more-options" />
1575
- </DropdownMenu>
1575
+ </ControlledDropdownMenu>
1576
1576
  </div>
1577
1577
  </div>
1578
1578
  <PanelContent>
@@ -17,7 +17,7 @@
17
17
  import {
18
18
  BlankPanelContent,
19
19
  PlayIcon,
20
- DropdownMenu,
20
+ ControlledDropdownMenu,
21
21
  MenuContent,
22
22
  MenuContentItem,
23
23
  CaretDownIcon,
@@ -517,7 +517,7 @@ export const QueryBuilderResultPanel = observer(
517
517
  <PlayIcon />
518
518
  Run Query
519
519
  </button>
520
- <DropdownMenu
520
+ <ControlledDropdownMenu
521
521
  className="btn__dropdown-combo__dropdown-btn query-builder__result__execute-btn__btn query-builder__result__execute-btn__btn--green"
522
522
  disabled={isRunQueryDisabled}
523
523
  content={
@@ -552,11 +552,11 @@ export const QueryBuilderResultPanel = observer(
552
552
  }}
553
553
  >
554
554
  <CaretDownIcon />
555
- </DropdownMenu>
555
+ </ControlledDropdownMenu>
556
556
  </>
557
557
  )}
558
558
  </div>
559
- <DropdownMenu
559
+ <ControlledDropdownMenu
560
560
  className="query-builder__result__export__dropdown"
561
561
  title="Export"
562
562
  disabled={!isQueryValid}
@@ -604,7 +604,7 @@ export const QueryBuilderResultPanel = observer(
604
604
  <div className="query-builder__result__export__dropdown__trigger">
605
605
  <CaretDownIcon />
606
606
  </div>
607
- </DropdownMenu>
607
+ </ControlledDropdownMenu>
608
608
  {resultState.isQueryUsageViewerOpened && (
609
609
  <QueryUsageViewer resultState={resultState} />
610
610
  )}
@@ -278,7 +278,8 @@ export const QueryBuilderTDSGridResult = observer(
278
278
  api: DataGridApi<QueryBuilderTDSRowDataType>,
279
279
  ): QueryBuilderTDSResultCellData[] => {
280
280
  const selectedRanges: DataGridCellRange[] | null = api.getCellRanges();
281
- const nodes = api.getRenderedNodes();
281
+ const nodes = [] as DataGridIRowNode<QueryBuilderTDSRowDataType>[];
282
+ api.forEachNode((node) => nodes.push(node));
282
283
  const columns = api.getColumnDefs() as DataGridColumnDefinition[];
283
284
  const selectedCells = [];
284
285
  if (selectedRanges) {
package/src/index.ts CHANGED
@@ -17,7 +17,10 @@
17
17
  // application
18
18
  export * from './__lib__/QueryBuilderTelemetryHelper.js';
19
19
  export * from './__lib__/QueryBuilderEvent.js';
20
-
20
+ export {
21
+ QueryBuilderExplorerState,
22
+ QueryBuilderExplorerPreviewDataState,
23
+ } from './stores/explorer/QueryBuilderExplorerState.js';
21
24
  export { QueryBuilder_GraphManagerPreset } from './graph-manager/QueryBuilder_GraphManagerPreset.js';
22
25
  export { QueryBuilderConfig } from './graph-manager/QueryBuilderConfig.js';
23
26
  export { QUERY_BUILDER_TEST_ID } from './__lib__/QueryBuilderTesting.js';
@@ -72,7 +75,18 @@ export {
72
75
  QueryBuilderChangeDetectionState,
73
76
  } from './stores/QueryBuilderChangeDetectionState.js';
74
77
  export { QueryBuilderResultValues } from './components/result/QueryBuilderResultPanel.js';
75
-
78
+ export {
79
+ QueryBuilderTaggedValueInfoTooltip,
80
+ QueryBuilderPropertyInfoTooltip,
81
+ QueryBuilderDerivationInfoTooltip,
82
+ } from './components/shared/QueryBuilderPropertyInfoTooltip.js';
83
+ export { QueryBuilderRootClassInfoTooltip } from './components/shared/QueryBuilderRootClassInfoTooltip.js';
84
+ export {
85
+ renderPropertyTypeIcon,
86
+ checkForDeprecatedNode,
87
+ getQueryBuilderExplorerTreeNodeSortRank,
88
+ QueryBuilderSubclassInfoTooltip,
89
+ } from './components/explorer/QueryBuilderExplorerPanel.js';
76
90
  // ------------------------------------------- Shared components -------------------------------------------
77
91
 
78
92
  export * from './components/shared/LambdaEditor.js';
@@ -97,3 +111,11 @@ export * from './stores/QueryBuilder_LegendApplicationPlugin_Extension.js';
97
111
  export * from './stores/data-access/DataAccessState.js';
98
112
  export * from './components/data-access/DataAccessOverview.js';
99
113
  export * from './stores/query-workflow/QueryBuilderWorkFlowState.js';
114
+ export * from './stores/explorer/QueryBuilderExplorerState.js';
115
+ export * from './stores/explorer/QueryBuilderPropertySearchState.js';
116
+ export * from './stores/explorer/QueryFunctionsExplorerState.js';
117
+ export * from './components/filter/QueryBuilderFilterPanel.js';
118
+ export * from './stores/filter/QueryBuilderFilterValueSpecificationBuilder.js';
119
+ export * from './stores/QueryBuilderValueSpecificationHelper.js';
120
+ export * from './stores/filter/QueryBuilderFilterState.js';
121
+ export * from './stores/filter/QueryBuilderFilterStateBuilder.js';
@@ -216,19 +216,28 @@ export class QueryBuilderPostFilterTreeConditionNodeData
216
216
  implements Hashable
217
217
  {
218
218
  condition: PostFilterConditionState;
219
+ isNewlyAdded: boolean;
219
220
 
220
221
  constructor(
221
222
  parentId: string | undefined,
222
223
  condition: PostFilterConditionState,
224
+ isNewlyAdded?: boolean,
223
225
  ) {
224
226
  super(parentId);
225
227
 
226
228
  makeObservable(this, {
227
229
  condition: observable,
230
+ isNewlyAdded: observable,
231
+ setIsNewlyAdded: action,
228
232
  dragPreviewLabel: computed,
229
233
  });
230
234
 
231
235
  this.condition = condition;
236
+ this.isNewlyAdded = isNewlyAdded ?? false;
237
+ }
238
+
239
+ setIsNewlyAdded(val: boolean): void {
240
+ this.isNewlyAdded = val;
232
241
  }
233
242
 
234
243
  get dragPreviewLabel(): string {
@@ -461,7 +470,9 @@ export class PostFilterConditionState implements Hashable {
461
470
  );
462
471
  }
463
472
  }
464
- *handleTypeaheadSearch(): GeneratorFn<void> {
473
+ *handleTypeaheadSearch(
474
+ searchValue?: ValueSpecification | undefined,
475
+ ): GeneratorFn<void> {
465
476
  try {
466
477
  this.typeaheadSearchState.inProgress();
467
478
  this.typeaheadSearchResults = undefined;
@@ -475,13 +486,14 @@ export class PostFilterConditionState implements Hashable {
475
486
  this.rightConditionValue,
476
487
  PostFilterValueSpecConditionValueState,
477
488
  );
478
- if (performTypeahead(rightConditionValue.value)) {
489
+ const value = searchValue ?? rightConditionValue.value;
490
+ if (performTypeahead(value)) {
479
491
  const result =
480
492
  (yield this.postFilterState.tdsState.queryBuilderState.graphManagerState.graphManager.runQuery(
481
493
  buildProjectionColumnTypeaheadQuery(
482
494
  this.postFilterState.tdsState.queryBuilderState,
483
495
  columnState,
484
- rightConditionValue.value,
496
+ value,
485
497
  ),
486
498
  guaranteeNonNullable(
487
499
  this.postFilterState.tdsState.queryBuilderState
@@ -399,3 +399,42 @@ export const processFilterExpression = (
399
399
  */
400
400
  filterState.simplifyTree();
401
401
  };
402
+
403
+ export const processFilterLambda = (
404
+ lambdaFunc: LambdaFunction,
405
+ queryBuilderState: QueryBuilderState,
406
+ ): void => {
407
+ const filterState = queryBuilderState.filterState;
408
+
409
+ assertTrue(
410
+ lambdaFunc.expressionSequence.length === 1,
411
+ `Can't process filter() lambda: only support filter() lambda body with 1 expression`,
412
+ );
413
+ const rootExpression = guaranteeType(
414
+ lambdaFunc.expressionSequence[0],
415
+ SimpleFunctionExpression,
416
+ `Can't process filter() lambda: only support filter() lambda body with 1 expression`,
417
+ );
418
+
419
+ assertTrue(
420
+ lambdaFunc.functionType.parameters.length === 1,
421
+ `Can't process filter() lambda: only support filter() lambda with 1 parameter`,
422
+ );
423
+ filterState.setLambdaParameterName(
424
+ guaranteeType(
425
+ lambdaFunc.functionType.parameters[0],
426
+ VariableExpression,
427
+ `Can't process filter() lambda: only support filter() lambda with 1 parameter`,
428
+ ).name,
429
+ );
430
+
431
+ processFilterTree(rootExpression, filterState, undefined);
432
+
433
+ /**
434
+ * NOTE: Since group operations like and/or do not take more than 2 parameters, if there are
435
+ * more than 2 clauses in each group operations, then these clauses are converted into an
436
+ * unbalanced tree. However, this would look quite bad for UX, as such, we simplify the tree.
437
+ * After building the filter state.
438
+ */
439
+ filterState.simplifyTree();
440
+ };
@@ -39,7 +39,7 @@ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaM
39
39
  import { DEFAULT_LAMBDA_VARIABLE_NAME } from '../QueryBuilderConfig.js';
40
40
  import { buildPropertyExpressionChain } from '../QueryBuilderValueSpecificationBuilderHelper.js';
41
41
 
42
- const buildFilterConditionExpression = (
42
+ export const buildFilterConditionExpression = (
43
43
  filterState: QueryBuilderFilterState,
44
44
  node: QueryBuilderFilterTreeNodeData,
45
45
  ): ValueSpecification | undefined => {
@@ -137,7 +137,7 @@ export class ServiceQueryBuilderState extends QueryBuilderState {
137
137
 
138
138
  override get sideBarClassName(): string | undefined {
139
139
  return this.executionContexts.length
140
- ? 'query-builder__setup__service--with-mutiple-execution'
140
+ ? 'query-builder__setup__service--with-multiple-execution'
141
141
  : 'query-builder__setup__service';
142
142
  }
143
143