@finos/legend-query-builder 4.1.2 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  2. package/lib/components/QueryBuilderPropertyExpressionEditor.js +1 -1
  3. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  4. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.js +91 -24
  6. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  7. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  8. package/lib/components/QueryBuilderTextEditor.js +3 -1
  9. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  10. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts +23 -0
  11. package/lib/components/execution-plan/AllocationExecutionNodeViewer.d.ts.map +1 -0
  12. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js +32 -0
  13. package/lib/components/execution-plan/AllocationExecutionNodeViewer.js.map +1 -0
  14. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts +23 -0
  15. package/lib/components/execution-plan/ConstantExecutionNodeViewer.d.ts.map +1 -0
  16. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js +35 -0
  17. package/lib/components/execution-plan/ConstantExecutionNodeViewer.js.map +1 -0
  18. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts +21 -0
  19. package/lib/components/execution-plan/DataTypeResultTypeViewer.d.ts.map +1 -0
  20. package/lib/components/execution-plan/DataTypeResultTypeViewer.js +31 -0
  21. package/lib/components/execution-plan/DataTypeResultTypeViewer.js.map +1 -0
  22. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts +10 -4
  23. package/lib/components/execution-plan/ExecutionPlanViewer.d.ts.map +1 -1
  24. package/lib/components/execution-plan/ExecutionPlanViewer.js +74 -62
  25. package/lib/components/execution-plan/ExecutionPlanViewer.js.map +1 -1
  26. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts +25 -0
  27. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.d.ts.map +1 -0
  28. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js +47 -0
  29. package/lib/components/execution-plan/FunctionParametersValidationNodeViewer.js.map +1 -0
  30. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts +23 -0
  31. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.d.ts.map +1 -0
  32. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js +31 -0
  33. package/lib/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.js.map +1 -0
  34. package/lib/components/execution-plan/ResultTypeViewer.d.ts +21 -0
  35. package/lib/components/execution-plan/ResultTypeViewer.d.ts.map +1 -0
  36. package/lib/components/execution-plan/ResultTypeViewer.js +33 -0
  37. package/lib/components/execution-plan/ResultTypeViewer.js.map +1 -0
  38. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts +9 -1
  39. package/lib/components/execution-plan/SQLExecutionNodeViewer.d.ts.map +1 -1
  40. package/lib/components/execution-plan/SQLExecutionNodeViewer.js +12 -6
  41. package/lib/components/execution-plan/SQLExecutionNodeViewer.js.map +1 -1
  42. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts +23 -0
  43. package/lib/components/execution-plan/SequenceExecutionNodeViewer.d.ts.map +1 -0
  44. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js +38 -0
  45. package/lib/components/execution-plan/SequenceExecutionNodeViewer.js.map +1 -0
  46. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts +21 -0
  47. package/lib/components/execution-plan/TDSResultTypeViewer.d.ts.map +1 -0
  48. package/lib/components/execution-plan/TDSResultTypeViewer.js +25 -0
  49. package/lib/components/execution-plan/TDSResultTypeViewer.js.map +1 -0
  50. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  51. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -3
  52. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +25 -34
  55. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  56. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  57. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +68 -22
  58. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  59. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
  60. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +4 -4
  61. package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
  62. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  63. package/lib/components/filter/QueryBuilderFilterPanel.js +21 -32
  64. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  65. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  66. package/lib/components/shared/LambdaEditor.js +10 -3
  67. package/lib/components/shared/LambdaEditor.js.map +1 -1
  68. package/lib/index.css +2 -2
  69. package/lib/index.css.map +1 -1
  70. package/lib/package.json +4 -4
  71. package/lib/stores/QueryBuilderResultState.d.ts +0 -3
  72. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  73. package/lib/stores/QueryBuilderResultState.js +2 -25
  74. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  75. package/lib/stores/QueryBuilderTextEditorState.d.ts +3 -1
  76. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  77. package/lib/stores/QueryBuilderTextEditorState.js +2 -2
  78. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  79. package/lib/stores/QueryLoaderState.d.ts +2 -0
  80. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  81. package/lib/stores/QueryLoaderState.js +7 -3
  82. package/lib/stores/QueryLoaderState.js.map +1 -1
  83. package/lib/stores/execution-plan/ExecutionPlanState.d.ts +14 -1
  84. package/lib/stores/execution-plan/ExecutionPlanState.d.ts.map +1 -1
  85. package/lib/stores/execution-plan/ExecutionPlanState.js +86 -3
  86. package/lib/stores/execution-plan/ExecutionPlanState.js.map +1 -1
  87. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  88. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -1
  89. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  90. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +4 -1
  91. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  92. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +5 -3
  93. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  94. package/lib/stores/shared/LambdaEditorState.d.ts +7 -2
  95. package/lib/stores/shared/LambdaEditorState.d.ts.map +1 -1
  96. package/lib/stores/shared/LambdaEditorState.js +7 -2
  97. package/lib/stores/shared/LambdaEditorState.js.map +1 -1
  98. package/package.json +12 -12
  99. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +1 -2
  100. package/src/components/QueryBuilderResultPanel.tsx +146 -30
  101. package/src/components/QueryBuilderTextEditor.tsx +3 -1
  102. package/src/components/execution-plan/AllocationExecutionNodeViewer.tsx +77 -0
  103. package/src/components/execution-plan/ConstantExecutionNodeViewer.tsx +82 -0
  104. package/src/components/execution-plan/DataTypeResultTypeViewer.tsx +52 -0
  105. package/src/components/execution-plan/ExecutionPlanViewer.tsx +205 -195
  106. package/src/components/execution-plan/FunctionParametersValidationNodeViewer.tsx +118 -0
  107. package/src/components/execution-plan/RelationalTDSInstantiationExecutionNodeViewer.tsx +68 -0
  108. package/src/components/execution-plan/ResultTypeViewer.tsx +37 -0
  109. package/src/components/execution-plan/SQLExecutionNodeViewer.tsx +50 -19
  110. package/src/components/execution-plan/SequenceExecutionNodeViewer.tsx +95 -0
  111. package/src/components/execution-plan/TDSResultTypeViewer.tsx +59 -0
  112. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -8
  113. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +37 -62
  114. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +161 -45
  115. package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +6 -8
  116. package/src/components/filter/QueryBuilderFilterPanel.tsx +49 -73
  117. package/src/components/shared/LambdaEditor.tsx +10 -3
  118. package/src/stores/QueryBuilderResultState.ts +1 -42
  119. package/src/stores/QueryBuilderTextEditorState.ts +4 -2
  120. package/src/stores/QueryLoaderState.ts +11 -1
  121. package/src/stores/execution-plan/ExecutionPlanState.ts +142 -4
  122. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +3 -1
  123. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +8 -3
  124. package/src/stores/shared/LambdaEditorState.ts +12 -5
  125. package/tsconfig.json +8 -0
@@ -35,7 +35,7 @@ import {
35
35
  PanelContent,
36
36
  TrashIcon,
37
37
  PanelDnDEntry,
38
- PanelDnDEntryDragHandle,
38
+ PanelEntryDragHandle,
39
39
  CalendarIcon,
40
40
  CalendarClockIcon,
41
41
  CustomSelectorInput,
@@ -324,17 +324,32 @@ const buildCalendarTypeOption = (
324
324
  });
325
325
 
326
326
  const QueryBuilderProjectionColumnEditor = observer(
327
- (props: { projectionColumnState: QueryBuilderProjectionColumnState }) => {
328
- const handleRef = useRef<HTMLDivElement>(null);
327
+ (props: {
328
+ projectionColumnState: QueryBuilderProjectionColumnState;
329
+ isRearrangeActive: boolean;
330
+ currentRearrangeDraggedColumnIndex: number | undefined;
331
+ setCurrentRearrangeDraggedColumnIndex: (val: number | undefined) => void;
332
+ currentRearrangeDropGapIndex: number | undefined;
333
+ setCurrentRearrangeDropGapIndex: (val: number | undefined) => void;
334
+ columnIdx: number;
335
+ }) => {
336
+ const {
337
+ isRearrangeActive,
338
+ projectionColumnState,
339
+ columnIdx,
340
+ currentRearrangeDraggedColumnIndex,
341
+ setCurrentRearrangeDraggedColumnIndex,
342
+ currentRearrangeDropGapIndex,
343
+ setCurrentRearrangeDropGapIndex,
344
+ } = props;
345
+ const dragHandleRef = useRef<HTMLDivElement>(null);
329
346
  const applicationStore = useApplicationStore();
330
-
331
347
  const ref = useRef<HTMLDivElement>(null);
332
348
  const [isSelectedFromContextMenu, setIsSelectedFromContextMenu] =
333
349
  useState(false);
334
350
  const onContextMenuOpen = (): void => setIsSelectedFromContextMenu(true);
335
351
  const onContextMenuClose = (): void => setIsSelectedFromContextMenu(false);
336
352
 
337
- const { projectionColumnState } = props;
338
353
  const tdsState = projectionColumnState.tdsState;
339
354
  const isCalendarEnabled = tdsState.queryBuilderState.isCalendarEnabled;
340
355
  const isRemovalDisabled = tdsState.isColumnInUse(projectionColumnState);
@@ -403,6 +418,7 @@ const QueryBuilderProjectionColumnEditor = observer(
403
418
  aggregateColumnState?.calendarFunction?.setCalendarType(option.value);
404
419
  }
405
420
  };
421
+
406
422
  const defaultEndDate = observe_PrimitiveInstanceValue(
407
423
  new PrimitiveInstanceValue(
408
424
  GenericTypeExplicitReference.create(
@@ -478,6 +494,32 @@ const QueryBuilderProjectionColumnEditor = observer(
478
494
  }
479
495
  };
480
496
 
497
+ const handleDroppingColumn = useCallback(
498
+ (type: string): void => {
499
+ if (
500
+ type === QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE &&
501
+ currentRearrangeDropGapIndex !== undefined &&
502
+ currentRearrangeDraggedColumnIndex !== undefined
503
+ ) {
504
+ tdsState.moveColumn(
505
+ currentRearrangeDraggedColumnIndex,
506
+ currentRearrangeDropGapIndex === tdsState.projectionColumns.length
507
+ ? tdsState.projectionColumns.length - 1
508
+ : currentRearrangeDropGapIndex,
509
+ );
510
+ }
511
+ setCurrentRearrangeDraggedColumnIndex(undefined);
512
+ setCurrentRearrangeDropGapIndex(undefined);
513
+ },
514
+ [
515
+ tdsState,
516
+ currentRearrangeDropGapIndex,
517
+ currentRearrangeDraggedColumnIndex,
518
+ setCurrentRearrangeDraggedColumnIndex,
519
+ setCurrentRearrangeDropGapIndex,
520
+ ],
521
+ );
522
+
481
523
  // Drag and Drop
482
524
  const handleHover = useCallback(
483
525
  (
@@ -487,37 +529,60 @@ const QueryBuilderProjectionColumnEditor = observer(
487
529
  const dragIndex = tdsState.projectionColumns.findIndex(
488
530
  (e) => e === item.columnState,
489
531
  );
490
- const hoverIndex = tdsState.projectionColumns.findIndex(
491
- (e) => e === projectionColumnState,
492
- );
493
- if (dragIndex === -1 || hoverIndex === -1 || dragIndex === hoverIndex) {
494
- return;
532
+ const hoveredRectangle = ref.current?.getBoundingClientRect();
533
+ const hoveredRectangleMiddle =
534
+ hoveredRectangle?.top && hoveredRectangle.bottom
535
+ ? (hoveredRectangle.top + hoveredRectangle.bottom) / 2
536
+ : undefined;
537
+ const yCoordinate = monitor.getClientOffset()?.y ?? 0;
538
+
539
+ if (yCoordinate && hoveredRectangleMiddle) {
540
+ setCurrentRearrangeDropGapIndex(
541
+ yCoordinate < hoveredRectangleMiddle ? columnIdx : columnIdx + 1,
542
+ );
495
543
  }
544
+
496
545
  // move the item being hovered on when the dragged item position is beyond the its middle point
497
546
  const hoverBoundingReact = ref.current?.getBoundingClientRect();
498
-
499
547
  const distanceThreshold =
500
548
  ((hoverBoundingReact?.bottom ?? 0) - (hoverBoundingReact?.top ?? 0)) /
501
549
  2;
502
- const dragDistance =
503
- (monitor.getClientOffset()?.y ?? 0) - (hoverBoundingReact?.top ?? 0);
504
- if (dragIndex < hoverIndex && dragDistance < distanceThreshold) {
550
+ const dragDistance = yCoordinate - (hoverBoundingReact?.top ?? 0);
551
+
552
+ if (dragIndex === -1 || columnIdx === -1 || dragIndex === columnIdx) {
505
553
  return;
506
554
  }
507
- if (dragIndex > hoverIndex && dragDistance > distanceThreshold) {
555
+
556
+ if (dragIndex < columnIdx && dragDistance < distanceThreshold) {
557
+ return;
558
+ }
559
+ if (dragIndex > columnIdx && dragDistance > distanceThreshold) {
508
560
  return;
509
561
  }
510
- tdsState.moveColumn(dragIndex, hoverIndex);
562
+
563
+ setCurrentRearrangeDraggedColumnIndex(dragIndex);
511
564
  },
512
- [projectionColumnState, tdsState],
565
+ [
566
+ tdsState,
567
+ columnIdx,
568
+ setCurrentRearrangeDropGapIndex,
569
+ setCurrentRearrangeDraggedColumnIndex,
570
+ ],
513
571
  );
572
+
514
573
  const [, dropConnector] = useDrop<QueryBuilderProjectionColumnDragSource>(
515
574
  () => ({
516
575
  accept: [QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE],
517
576
  hover: (item, monitor): void => handleHover(item, monitor),
577
+ drop: (item, monitor): void => {
578
+ if (!monitor.didDrop()) {
579
+ handleDroppingColumn(monitor.getItemType() as string);
580
+ }
581
+ },
518
582
  }),
519
- [handleHover],
583
+ [handleHover, handleDroppingColumn],
520
584
  );
585
+
521
586
  const [
522
587
  { projectionColumnBeingDragged },
523
588
  dragConnector,
@@ -548,9 +613,8 @@ const QueryBuilderProjectionColumnEditor = observer(
548
613
  }),
549
614
  [projectionColumnState],
550
615
  );
551
- const isBeingDragged =
552
- projectionColumnState === projectionColumnBeingDragged;
553
- dragConnector(handleRef);
616
+
617
+ dragConnector(dragHandleRef);
554
618
  dropConnector(ref);
555
619
 
556
620
  useDragPreviewLayer(dragPreviewConnector);
@@ -613,7 +677,24 @@ const QueryBuilderProjectionColumnEditor = observer(
613
677
  return (
614
678
  <PanelDnDEntry
615
679
  ref={ref}
616
- showPlaceholder={isBeingDragged}
680
+ placeholder={
681
+ <div
682
+ className={clsx(
683
+ {
684
+ 'query-builder__projection__column__placeholder--bottom':
685
+ currentRearrangeDropGapIndex === columnIdx + 1 &&
686
+ columnIdx === tdsState.projectionColumns.length - 1,
687
+ },
688
+ {
689
+ 'query-builder__projection__column__placeholder--top':
690
+ currentRearrangeDropGapIndex === columnIdx,
691
+ },
692
+ )}
693
+ />
694
+ }
695
+ showPlaceholder={
696
+ projectionColumnBeingDragged !== undefined && isRearrangeActive
697
+ }
617
698
  className="query-builder__projection__column"
618
699
  >
619
700
  <ContextMenu
@@ -637,9 +718,9 @@ const QueryBuilderProjectionColumnEditor = observer(
637
718
  onClose={onContextMenuClose}
638
719
  >
639
720
  <div className="query-builder__projection__column__container">
640
- <PanelDnDEntryDragHandle
641
- isBeingDragged={isBeingDragged}
642
- dropTargetConnector={handleRef}
721
+ <PanelEntryDragHandle
722
+ isDragging={false}
723
+ dragSourceConnector={dragHandleRef}
643
724
  className="query-builder__projection__column__drag-handle__container"
644
725
  />
645
726
  <div className="query-builder__projection__column__name">
@@ -806,7 +887,7 @@ const QueryBuilderProjectionColumnEditor = observer(
806
887
  ref={dropTargetConnector}
807
888
  >
808
889
  <PanelEntryDropZonePlaceholder
809
- showPlaceholder={isDragOver}
890
+ isDragOver={isDragOver}
810
891
  label="Change Date Column"
811
892
  className="query-builder__projection__calendar__date__column__dnd__placeholder"
812
893
  >
@@ -855,6 +936,12 @@ export const QueryBuilderTDSPanel = observer(
855
936
  const applicationStore = useApplicationStore();
856
937
  const { tdsState } = props;
857
938
  const projectionColumns = tdsState.projectionColumns;
939
+ const [
940
+ currentRearrangeDraggedColumnIndex,
941
+ setCurrentRearrangeDraggedColumnIndex,
942
+ ] = useState<number | undefined>();
943
+ const [currentRearrangeDropGapIndex, setCurrentRearrangeDropGapIndex] =
944
+ useState<number | undefined>();
858
945
 
859
946
  // Toolbar
860
947
  const openResultSetModifierEditor = (): void =>
@@ -937,8 +1024,22 @@ export const QueryBuilderTDSPanel = observer(
937
1024
  [handleDrop],
938
1025
  );
939
1026
 
940
- const { showDroppableSuggestion } = useDragLayer((monitor) => ({
941
- showDroppableSuggestion:
1027
+ const [{ isRearrangeActive }, rearrangeColumnDropConnector] = useDrop<
1028
+ QueryBuilderProjectionColumnDragSource,
1029
+ void,
1030
+ { isRearrangeActive: boolean }
1031
+ >(
1032
+ () => ({
1033
+ accept: [QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE],
1034
+ collect: (monitor) => ({
1035
+ isRearrangeActive: monitor.isOver({ shallow: false }),
1036
+ }),
1037
+ }),
1038
+ [],
1039
+ );
1040
+
1041
+ const { isDroppable } = useDragLayer((monitor) => ({
1042
+ isDroppable:
942
1043
  monitor.isDragging() &&
943
1044
  [
944
1045
  QUERY_BUILDER_EXPLORER_TREE_DND_TYPE.ENUM_PROPERTY,
@@ -989,8 +1090,7 @@ export const QueryBuilderTDSPanel = observer(
989
1090
  <div className="query-builder__projection__content">
990
1091
  <PanelDropZone
991
1092
  isDragOver={isDragOver}
992
- showDroppableSuggestion={showDroppableSuggestion}
993
- className="query-builder__panel--droppable"
1093
+ isDroppable={isDroppable}
994
1094
  dropTargetConnector={dropTargetConnector}
995
1095
  >
996
1096
  {!projectionColumns.length && (
@@ -1004,22 +1104,38 @@ export const QueryBuilderTDSPanel = observer(
1004
1104
  data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_TDS}
1005
1105
  className="query-builder__projection__columns"
1006
1106
  >
1007
- <DragPreviewLayer
1008
- labelGetter={(
1009
- item: QueryBuilderProjectionColumnDragSource,
1010
- ): string =>
1011
- item.columnState.columnName === ''
1012
- ? '(unknown)'
1013
- : item.columnState.columnName
1014
- }
1015
- types={[QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE]}
1016
- />
1017
- {projectionColumns.map((projectionColumnState) => (
1018
- <QueryBuilderProjectionColumnEditor
1019
- key={projectionColumnState.uuid}
1020
- projectionColumnState={projectionColumnState}
1107
+ <div ref={rearrangeColumnDropConnector}>
1108
+ <DragPreviewLayer
1109
+ labelGetter={(
1110
+ item: QueryBuilderProjectionColumnDragSource,
1111
+ ): string =>
1112
+ item.columnState.columnName === ''
1113
+ ? '(unknown)'
1114
+ : item.columnState.columnName
1115
+ }
1116
+ types={[QUERY_BUILDER_PROJECTION_COLUMN_DND_TYPE]}
1021
1117
  />
1022
- ))}
1118
+ {projectionColumns.map((projectionColumnState, columnIdx) => (
1119
+ <QueryBuilderProjectionColumnEditor
1120
+ key={projectionColumnState.uuid}
1121
+ projectionColumnState={projectionColumnState}
1122
+ isRearrangeActive={isRearrangeActive}
1123
+ currentRearrangeDraggedColumnIndex={
1124
+ currentRearrangeDraggedColumnIndex
1125
+ }
1126
+ currentRearrangeDropGapIndex={
1127
+ currentRearrangeDropGapIndex
1128
+ }
1129
+ setCurrentRearrangeDraggedColumnIndex={
1130
+ setCurrentRearrangeDraggedColumnIndex
1131
+ }
1132
+ setCurrentRearrangeDropGapIndex={
1133
+ setCurrentRearrangeDropGapIndex
1134
+ }
1135
+ columnIdx={columnIdx}
1136
+ />
1137
+ ))}
1138
+ </div>
1023
1139
  </div>
1024
1140
  )}
1025
1141
  <QueryResultModifierModal tdsState={tdsState} />
@@ -42,7 +42,7 @@ import {
42
42
  ModalFooter,
43
43
  PanelFormSection,
44
44
  ModalFooterButton,
45
- PanelDnDEntryDragHandle,
45
+ PanelEntryDragHandle,
46
46
  PanelDnDEntry,
47
47
  PanelHeaderActionItem,
48
48
  PanelHeader,
@@ -611,9 +611,8 @@ const TDSColumnReferenceEditor = observer(
611
611
  className="query-builder__olap__tds__column-badge"
612
612
  >
613
613
  <PanelEntryDropZonePlaceholder
614
- showPlaceholder={isDragOver}
614
+ isDragOver={isDragOver}
615
615
  label="Change Column"
616
- className="query-builder__dnd__placeholder"
617
616
  >
618
617
  <div className="query-builder__olap__tds__column-badge__content">
619
618
  <div
@@ -875,10 +874,10 @@ const QueryBuilderWindowColumnEditor = observer(
875
874
  onOpen={onContextMenuOpen}
876
875
  onClose={onContextMenuClose}
877
876
  >
878
- <PanelDnDEntryDragHandle
879
- isBeingDragged={isBeingDragged}
877
+ <PanelEntryDragHandle
878
+ isDragging={isBeingDragged}
880
879
  className="query-builder__olap__column__drag-handle__container"
881
- dropTargetConnector={handleRef}
880
+ dragSourceConnector={handleRef}
882
881
  />
883
882
  <div className="query-builder__olap__column__operation">
884
883
  <div className="query-builder__olap__column__operation__operator">
@@ -947,9 +946,8 @@ const QueryBuilderWindowColumnEditor = observer(
947
946
  className="query-builder__olap__column__window__content"
948
947
  >
949
948
  <PanelEntryDropZonePlaceholder
950
- showPlaceholder={isDragOver}
949
+ isDragOver={isDragOver}
951
950
  label="Add"
952
- className="query-builder__dnd__placeholder"
953
951
  >
954
952
  <div
955
953
  title={`${windowColumnState.windowColumns.length} columns partitioned`}
@@ -105,9 +105,9 @@ const QueryBuilderFilterGroupConditionEditor = observer(
105
105
  (props: {
106
106
  node: QueryBuilderFilterTreeGroupNodeData;
107
107
  isDragOver: boolean;
108
- showDroppableSuggestion: boolean;
108
+ isDroppable: boolean;
109
109
  }) => {
110
- const { node, isDragOver, showDroppableSuggestion } = props;
110
+ const { node, isDragOver, isDroppable } = props;
111
111
  const switchOperation: React.MouseEventHandler<HTMLDivElement> = (
112
112
  event,
113
113
  ): void => {
@@ -118,32 +118,35 @@ const QueryBuilderFilterGroupConditionEditor = observer(
118
118
  : QUERY_BUILDER_GROUP_OPERATION.AND,
119
119
  );
120
120
  };
121
+
122
+ const operationName =
123
+ node.groupOperation === QUERY_BUILDER_GROUP_OPERATION.AND ? 'AND' : 'OR';
124
+
121
125
  return (
122
126
  <div className="query-builder-filter-tree__node__label__content dnd__entry__container">
123
- {showDroppableSuggestion && (
127
+ <PanelEntryDropZonePlaceholder
128
+ isDragOver={isDragOver}
129
+ isDroppable={isDroppable}
130
+ label={`Add to Logical Group '${operationName}'`}
131
+ >
124
132
  <div
125
- className={clsx('dnd__entry--droppable__indicator ', {
126
- 'dnd__entry--droppable__indicator--dragover': isDragOver,
133
+ className={clsx('query-builder-filter-tree__group-node', {
134
+ 'query-builder-filter-tree__group-node--and':
135
+ node.groupOperation === QUERY_BUILDER_GROUP_OPERATION.AND,
136
+ 'query-builder-filter-tree__group-node--or':
137
+ node.groupOperation === QUERY_BUILDER_GROUP_OPERATION.OR,
127
138
  })}
128
- ></div>
129
- )}
130
- <div
131
- className={clsx('query-builder-filter-tree__group-node', {
132
- 'query-builder-filter-tree__group-node--and':
133
- node.groupOperation === QUERY_BUILDER_GROUP_OPERATION.AND,
134
- 'query-builder-filter-tree__group-node--or':
135
- node.groupOperation === QUERY_BUILDER_GROUP_OPERATION.OR,
136
- })}
137
- title="Switch Operation"
138
- onClick={switchOperation}
139
- >
140
- <div className="query-builder-filter-tree__group-node__label">
141
- {node.groupOperation}
139
+ title="Switch Operation"
140
+ onClick={switchOperation}
141
+ >
142
+ <div className="query-builder-filter-tree__group-node__label">
143
+ {node.groupOperation}
144
+ </div>
145
+ <button className="query-builder-filter-tree__group-node__action">
146
+ <FilledTriangleIcon />
147
+ </button>
142
148
  </div>
143
- <button className="query-builder-filter-tree__group-node__action">
144
- <FilledTriangleIcon />
145
- </button>
146
- </div>
149
+ </PanelEntryDropZonePlaceholder>
147
150
  </div>
148
151
  );
149
152
  },
@@ -232,32 +235,11 @@ const QueryBuilderFilterConditionEditor = observer(
232
235
  cleanUpReloadValues,
233
236
  };
234
237
 
235
- const { showDroppableSuggestion } = useDragLayer((monitor) => ({
236
- showDroppableSuggestion:
237
- monitor.isDragging() &&
238
- (queryBuilderState.TEMPORARY__isDnDFetchStructureToFilterSupported
239
- ? IS_DRAGGABLE_FILTER_DND_TYPES_FETCH_SUPPORTED
240
- : IS_DRAGGABLE_FILTER_DND_TYPES
241
- ).includes(monitor.getItemType()?.toString() ?? ''),
242
- }));
243
-
244
238
  return (
245
239
  <div className="query-builder-filter-tree__node__label__content dnd__entry__container">
246
- {showDroppableSuggestion && (
247
- <div
248
- className={clsx(
249
- 'dnd__entry--droppable__indicator dnd__entry-potential__oiodropzone__indicator--full',
250
- {
251
- 'dnd__entry--droppable__indicator--dragover': isDragOver,
252
- },
253
- )}
254
- ></div>
255
- )}
256
-
257
240
  <PanelEntryDropZonePlaceholder
258
- showPlaceholder={isDragOver}
241
+ isDragOver={isDragOver}
259
242
  label="Add New Logical Group"
260
- className="query-builder__dnd__placeholder"
261
243
  >
262
244
  <div className="query-builder-filter-tree__condition-node">
263
245
  <div className="query-builder-filter-tree__condition-node__property">
@@ -301,9 +283,8 @@ const QueryBuilderFilterConditionEditor = observer(
301
283
  className="query-builder-filter-tree__condition-node__value"
302
284
  >
303
285
  <PanelEntryDropZonePlaceholder
304
- showPlaceholder={isFilterValueDragOver}
286
+ isDragOver={isFilterValueDragOver}
305
287
  label="Change Filter Value"
306
- className="query-builder__dnd__placeholder"
307
288
  >
308
289
  <BasicValueSpecificationEditor
309
290
  valueSpecification={node.condition.value}
@@ -336,19 +317,16 @@ const QueryBuilderFilterBlankConditionEditor = observer(
336
317
  (props: {
337
318
  node: QueryBuilderFilterTreeBlankConditionNodeData;
338
319
  isDragOver: boolean;
339
- showDroppableSuggestion: boolean;
320
+ isDroppable: boolean;
340
321
  }) => {
341
- const { isDragOver, showDroppableSuggestion } = props;
322
+ const { isDragOver, isDroppable } = props;
342
323
  return (
343
324
  <div className="query-builder-filter-tree__node__label__content">
344
325
  <PanelEntryDropZonePlaceholder
345
- showPlaceholder={isDragOver}
326
+ isDragOver={isDragOver}
327
+ isDroppable={isDroppable}
346
328
  label="Create Condition"
347
- className="query-builder__dnd__placeholder"
348
329
  >
349
- {showDroppableSuggestion && (
350
- <div className="query-builder-filter-tree__blank-node--droppable"></div>
351
- )}
352
330
  <div className="query-builder-filter-tree__blank-node">blank</div>
353
331
  </PanelEntryDropZonePlaceholder>
354
332
  </div>
@@ -560,8 +538,8 @@ const QueryBuilderFilterTreeNodeContainer = observer(
560
538
  dragConnector(dropConnector(ref));
561
539
  useDragPreviewLayer(dragPreviewConnector);
562
540
 
563
- const { showDroppableSuggestion } = useDragLayer((monitor) => ({
564
- showDroppableSuggestion:
541
+ const { isDroppable } = useDragLayer((monitor) => ({
542
+ isDroppable:
565
543
  monitor.isDragging() &&
566
544
  (queryBuilderState.TEMPORARY__isDnDFetchStructureToFilterSupported
567
545
  ? IS_DRAGGABLE_FILTER_DND_TYPES_FETCH_SUPPORTED
@@ -627,7 +605,7 @@ const QueryBuilderFilterTreeNodeContainer = observer(
627
605
  {node instanceof QueryBuilderFilterTreeGroupNodeData && (
628
606
  <QueryBuilderFilterGroupConditionEditor
629
607
  node={node}
630
- showDroppableSuggestion={showDroppableSuggestion}
608
+ isDroppable={isDroppable}
631
609
  isDragOver={isDragOver}
632
610
  />
633
611
  )}
@@ -641,7 +619,7 @@ const QueryBuilderFilterTreeNodeContainer = observer(
641
619
  <QueryBuilderFilterBlankConditionEditor
642
620
  node={node}
643
621
  isDragOver={isDragOver}
644
- showDroppableSuggestion={showDroppableSuggestion}
622
+ isDroppable={isDroppable}
645
623
  />
646
624
  )}
647
625
  </div>
@@ -811,8 +789,8 @@ export const QueryBuilderFilterPanel = observer(
811
789
  }
812
790
  };
813
791
 
814
- const { showDroppableSuggestion } = useDragLayer((monitor) => ({
815
- showDroppableSuggestion:
792
+ const { isDroppable } = useDragLayer((monitor) => ({
793
+ isDroppable:
816
794
  monitor.isDragging() &&
817
795
  (queryBuilderState.TEMPORARY__isDnDFetchStructureToFilterSupported
818
796
  ? IS_DRAGGABLE_FILTER_DND_TYPES_FETCH_SUPPORTED
@@ -991,10 +969,7 @@ export const QueryBuilderFilterPanel = observer(
991
969
  <PanelContent>
992
970
  <PanelDropZone
993
971
  isDragOver={isDragOver && filterState.isEmpty}
994
- showDroppableSuggestion={
995
- showDroppableSuggestion && filterState.isEmpty
996
- }
997
- className="query-builder__panel--droppable"
972
+ isDroppable={isDroppable && filterState.isEmpty}
998
973
  dropTargetConnector={dropTargetConnector}
999
974
  >
1000
975
  {filterState.isEmpty && (
@@ -1014,18 +989,19 @@ export const QueryBuilderFilterPanel = observer(
1014
989
  <QueryBuilderFilterTree queryBuilderState={queryBuilderState} />
1015
990
  </>
1016
991
  )}
1017
-
1018
- {showDroppableSuggestion && !filterState.isEmpty && (
992
+ {isDroppable && !filterState.isEmpty && (
1019
993
  <div
1020
994
  ref={addFilterRef}
1021
- className={clsx(
1022
- 'query-builder-post-filter-tree__blank-node--droppable--tall',
1023
- {
1024
- 'dnd__entry--droppable__indicator--dragover': isDragOver,
1025
- },
1026
- )}
995
+ className="query-builder-filter-tree__free-drop-zone__container"
1027
996
  >
1028
- Add filter to main group
997
+ <PanelEntryDropZonePlaceholder
998
+ isDragOver={isDragOver}
999
+ isDroppable={isDroppable}
1000
+ className="query-builder-filter-tree__free-drop-zone"
1001
+ label="Add filter to main group"
1002
+ >
1003
+ <></>
1004
+ </PanelEntryDropZonePlaceholder>
1029
1005
  </div>
1030
1006
  )}
1031
1007
  </PanelDropZone>
@@ -140,7 +140,9 @@ const LambdaEditor_Inner = observer(
140
140
  const transformLambdaToString = async (pretty: boolean): Promise<void> => {
141
141
  transformStringToLambda?.cancel();
142
142
  return flowResult(
143
- lambdaEditorState.convertLambdaObjectToGrammarString(pretty),
143
+ lambdaEditorState.convertLambdaObjectToGrammarString({
144
+ pretty: pretty,
145
+ }),
144
146
  ).catch(applicationStore.alertUnhandledError);
145
147
  };
146
148
  const discardChanges = applicationStore.guardUnhandledError(() =>
@@ -447,7 +449,9 @@ const LambdaEditor_PopUp = observer(
447
449
  const transformLambdaToString = async (pretty: boolean): Promise<void> => {
448
450
  transformStringToLambda?.cancel();
449
451
  return flowResult(
450
- lambdaEditorState.convertLambdaObjectToGrammarString(pretty),
452
+ lambdaEditorState.convertLambdaObjectToGrammarString({
453
+ pretty: pretty,
454
+ }),
451
455
  ).catch(applicationStore.alertUnhandledError);
452
456
  };
453
457
  const discardChanges = applicationStore.guardUnhandledError(() =>
@@ -554,7 +558,10 @@ const LambdaEditor_PopUp = observer(
554
558
 
555
559
  useEffect(() => {
556
560
  flowResult(
557
- lambdaEditorState.convertLambdaObjectToGrammarString(true),
561
+ lambdaEditorState.convertLambdaObjectToGrammarString({
562
+ pretty: true,
563
+ preserveCompilationError: true,
564
+ }),
558
565
  ).catch(applicationStore.alertUnhandledError);
559
566
  }, [applicationStore, lambdaEditorState]);
560
567
 
@@ -37,7 +37,6 @@ import {
37
37
  buildRawLambdaFromLambdaFunction,
38
38
  reportGraphAnalytics,
39
39
  extractExecutionResultValues,
40
- TDSExecutionResult,
41
40
  } from '@finos/legend-graph';
42
41
  import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
43
42
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
@@ -163,46 +162,6 @@ export class QueryBuilderResultState {
163
162
  this.queryRunPromise = promise;
164
163
  };
165
164
 
166
- findColumnFromCoordinates = (
167
- colIndex: number,
168
- ): string | number | boolean | null | undefined => {
169
- if (
170
- !this.executionResult ||
171
- !(this.executionResult instanceof TDSExecutionResult)
172
- ) {
173
- return undefined;
174
- }
175
- return this.executionResult.result.columns[colIndex];
176
- };
177
-
178
- findRowFromRowIndex = (
179
- rowIndex: number,
180
- ): (string | number | boolean | null)[] => {
181
- if (
182
- !this.executionResult ||
183
- !(this.executionResult instanceof TDSExecutionResult)
184
- ) {
185
- return [''];
186
- }
187
- return this.executionResult.result.rows[rowIndex]?.values ?? [''];
188
- };
189
-
190
- findResultValueFromCoordinates = (
191
- resultCoordinate: [number, number],
192
- ): string | number | boolean | null | undefined => {
193
- const rowIndex = resultCoordinate[0];
194
- const colIndex = resultCoordinate[1];
195
-
196
- if (
197
- !this.executionResult ||
198
- !(this.executionResult instanceof TDSExecutionResult)
199
- ) {
200
- return undefined;
201
- }
202
-
203
- return this.executionResult.result.rows[rowIndex]?.values[colIndex];
204
- };
205
-
206
165
  setIsQueryUsageViewerOpened(val: boolean): void {
207
166
  this.isQueryUsageViewerOpened = val;
208
167
  }
@@ -442,7 +401,7 @@ export class QueryBuilderResultState {
442
401
  rawPlan,
443
402
  this.queryBuilderState.graphManagerState.graph,
444
403
  );
445
- this.executionPlanState.setPlan(plan);
404
+ this.executionPlanState.initialize(plan);
446
405
  } catch {
447
406
  // do nothing
448
407
  }