@finos/legend-query-builder 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +6 -7
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +19 -17
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +31 -29
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +2 -2
- package/lib/stores/QueryBuilderResultState.d.ts +7 -3
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +14 -20
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +3 -0
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +10 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +36 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +6 -0
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +21 -2
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/package.json +9 -9
- package/src/components/QueryBuilderResultPanel.tsx +18 -20
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +128 -126
- package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +254 -251
- package/src/stores/QueryBuilderResultState.ts +28 -33
- package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +5 -0
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +44 -0
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +28 -0
@@ -24,18 +24,18 @@ import {
|
|
24
24
|
MenuContent,
|
25
25
|
MenuContentItem,
|
26
26
|
CaretDownIcon,
|
27
|
-
VerticalDragHandleIcon,
|
28
27
|
ContextMenu,
|
29
28
|
InputWithInlineValidation,
|
30
29
|
SigmaIcon,
|
31
30
|
PanelDropZone,
|
32
31
|
DragPreviewLayer,
|
33
|
-
PanelEntryDropZonePlaceholder,
|
34
32
|
useDragPreviewLayer,
|
35
33
|
OptionsIcon,
|
36
34
|
PlusIcon,
|
37
35
|
PanelContent,
|
38
36
|
TrashIcon,
|
37
|
+
PanelDnDEntry,
|
38
|
+
PanelDnDEntryDragHandle,
|
39
39
|
} from '@finos/legend-art';
|
40
40
|
import {
|
41
41
|
type QueryBuilderExplorerTreeDragSource,
|
@@ -223,8 +223,8 @@ const QueryBuilderDerivationProjectionColumnEditor = observer(
|
|
223
223
|
|
224
224
|
const QueryBuilderProjectionColumnEditor = observer(
|
225
225
|
(props: { projectionColumnState: QueryBuilderProjectionColumnState }) => {
|
226
|
+
const handleRef = useRef<HTMLDivElement>(null);
|
226
227
|
const ref = useRef<HTMLDivElement>(null);
|
227
|
-
|
228
228
|
const [isSelectedFromContextMenu, setIsSelectedFromContextMenu] =
|
229
229
|
useState(false);
|
230
230
|
const onContextMenuOpen = (): void => setIsSelectedFromContextMenu(true);
|
@@ -275,6 +275,7 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
275
275
|
}
|
276
276
|
// move the item being hovered on when the dragged item position is beyond the its middle point
|
277
277
|
const hoverBoundingReact = ref.current?.getBoundingClientRect();
|
278
|
+
|
278
279
|
const distanceThreshold =
|
279
280
|
((hoverBoundingReact?.bottom ?? 0) - (hoverBoundingReact?.top ?? 0)) /
|
280
281
|
2;
|
@@ -329,141 +330,142 @@ const QueryBuilderProjectionColumnEditor = observer(
|
|
329
330
|
);
|
330
331
|
const isBeingDragged =
|
331
332
|
projectionColumnState === projectionColumnBeingDragged;
|
332
|
-
dragConnector(
|
333
|
+
dragConnector(handleRef);
|
334
|
+
dropConnector(ref);
|
335
|
+
|
333
336
|
useDragPreviewLayer(dragPreviewConnector);
|
334
337
|
|
335
338
|
return (
|
336
|
-
<
|
337
|
-
|
338
|
-
|
339
|
-
|
339
|
+
<PanelDnDEntry
|
340
|
+
ref={ref}
|
341
|
+
showPlaceholder={isBeingDragged}
|
342
|
+
className="query-builder__projection__column"
|
343
|
+
>
|
344
|
+
<ContextMenu
|
345
|
+
content={
|
346
|
+
<QueryBuilderProjectionColumnContextMenu
|
347
|
+
projectionColumnState={projectionColumnState}
|
348
|
+
/>
|
349
|
+
}
|
350
|
+
disabled={
|
351
|
+
!(
|
352
|
+
projectionColumnState instanceof
|
353
|
+
QueryBuilderSimpleProjectionColumnState
|
354
|
+
)
|
355
|
+
}
|
356
|
+
className={clsx('query-builder__projection__column__context-menu', {
|
357
|
+
'query-builder__projection__column--selected-from-context-menu':
|
358
|
+
isSelectedFromContextMenu,
|
359
|
+
})}
|
360
|
+
menuProps={{ elevation: 7 }}
|
361
|
+
onOpen={onContextMenuOpen}
|
362
|
+
onClose={onContextMenuClose}
|
340
363
|
>
|
341
|
-
<
|
342
|
-
|
343
|
-
|
364
|
+
<PanelDnDEntryDragHandle
|
365
|
+
isBeingDragged={isBeingDragged}
|
366
|
+
dropTargetConnector={handleRef}
|
367
|
+
className="query-builder__projection__column__drag-handle__container"
|
368
|
+
/>
|
369
|
+
<div className="query-builder__projection__column__name">
|
370
|
+
<InputWithInlineValidation
|
371
|
+
className="query-builder__projection__column__name__input input-group__input"
|
372
|
+
spellCheck={false}
|
373
|
+
value={projectionColumnState.columnName}
|
374
|
+
onChange={changeColumnName}
|
375
|
+
validationErrorMessage={
|
376
|
+
isDuplicatedColumnName ? 'Duplicated column' : undefined
|
377
|
+
}
|
378
|
+
/>
|
379
|
+
</div>
|
380
|
+
<div className="query-builder__projection__column__value">
|
381
|
+
{projectionColumnState instanceof
|
382
|
+
QueryBuilderSimpleProjectionColumnState && (
|
383
|
+
<QueryBuilderSimpleProjectionColumnEditor
|
344
384
|
projectionColumnState={projectionColumnState}
|
345
385
|
/>
|
346
|
-
}
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
)
|
352
|
-
}
|
353
|
-
className={clsx('query-builder__projection__column__context-menu', {
|
354
|
-
'query-builder__projection__column--selected-from-context-menu':
|
355
|
-
isSelectedFromContextMenu,
|
356
|
-
})}
|
357
|
-
menuProps={{ elevation: 7 }}
|
358
|
-
onOpen={onContextMenuOpen}
|
359
|
-
onClose={onContextMenuClose}
|
360
|
-
>
|
361
|
-
<div className="query-builder__projection__column__drag-handle__container">
|
362
|
-
<div className="query-builder__projection__column__drag-handle">
|
363
|
-
<VerticalDragHandleIcon />
|
364
|
-
</div>
|
365
|
-
</div>
|
366
|
-
<div className="query-builder__projection__column__name">
|
367
|
-
<InputWithInlineValidation
|
368
|
-
className="query-builder__projection__column__name__input input-group__input"
|
369
|
-
spellCheck={false}
|
370
|
-
value={projectionColumnState.columnName}
|
371
|
-
onChange={changeColumnName}
|
372
|
-
validationErrorMessage={
|
373
|
-
isDuplicatedColumnName ? 'Duplicated column' : undefined
|
374
|
-
}
|
386
|
+
)}
|
387
|
+
{projectionColumnState instanceof
|
388
|
+
QueryBuilderDerivationProjectionColumnState && (
|
389
|
+
<QueryBuilderDerivationProjectionColumnEditor
|
390
|
+
projectionColumnState={projectionColumnState}
|
375
391
|
/>
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
<QueryBuilderDerivationProjectionColumnEditor
|
387
|
-
projectionColumnState={projectionColumnState}
|
388
|
-
/>
|
392
|
+
)}
|
393
|
+
</div>
|
394
|
+
<div className="query-builder__projection__column__aggregate">
|
395
|
+
<div className="query-builder__projection__column__aggregate__operator">
|
396
|
+
{aggregateColumnState && (
|
397
|
+
<div className="query-builder__projection__column__aggregate__operator__label">
|
398
|
+
{aggregateColumnState.operator.getLabel(
|
399
|
+
projectionColumnState,
|
400
|
+
)}
|
401
|
+
</div>
|
389
402
|
)}
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
{
|
394
|
-
|
395
|
-
|
396
|
-
|
403
|
+
<DropdownMenu
|
404
|
+
className="query-builder__projection__column__aggregate__operator__dropdown"
|
405
|
+
title="Choose Aggregate Operator..."
|
406
|
+
disabled={!aggreateOperators.length}
|
407
|
+
content={
|
408
|
+
<MenuContent>
|
409
|
+
{aggregateColumnState && (
|
410
|
+
<MenuContentItem
|
411
|
+
className="query-builder__projection__column__aggregate__operator__dropdown__option"
|
412
|
+
onClick={changeOperator(undefined)}
|
413
|
+
>
|
414
|
+
(none)
|
415
|
+
</MenuContentItem>
|
397
416
|
)}
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
className="query-builder__projection__column__aggregate__operator__dropdown__option"
|
409
|
-
onClick={changeOperator(undefined)}
|
410
|
-
>
|
411
|
-
(none)
|
412
|
-
</MenuContentItem>
|
413
|
-
)}
|
414
|
-
{aggreateOperators.map((op) => (
|
415
|
-
<MenuContentItem
|
416
|
-
key={op.uuid}
|
417
|
-
className="query-builder__projection__column__aggregate__operator__dropdown__option"
|
418
|
-
onClick={changeOperator(op)}
|
419
|
-
>
|
420
|
-
{op.getLabel(projectionColumnState)}
|
421
|
-
</MenuContentItem>
|
422
|
-
))}
|
423
|
-
</MenuContent>
|
424
|
-
}
|
425
|
-
menuProps={{
|
426
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
|
427
|
-
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
428
|
-
elevation: 7,
|
429
|
-
}}
|
430
|
-
>
|
431
|
-
<div
|
432
|
-
className={clsx(
|
433
|
-
'query-builder__projection__column__aggregate__operator__badge',
|
434
|
-
{
|
435
|
-
'query-builder__projection__column__aggregate__operator__badge--activated':
|
436
|
-
Boolean(aggregateColumnState),
|
437
|
-
},
|
438
|
-
)}
|
439
|
-
>
|
440
|
-
<SigmaIcon />
|
441
|
-
</div>
|
442
|
-
<div className="query-builder__projection__column__aggregate__operator__dropdown__trigger">
|
443
|
-
<CaretDownIcon />
|
444
|
-
</div>
|
445
|
-
</DropdownMenu>
|
446
|
-
</div>
|
447
|
-
</div>
|
448
|
-
<div className="query-builder__projection__column__actions">
|
449
|
-
<button
|
450
|
-
className="query-builder__projection__column__action"
|
451
|
-
tabIndex={-1}
|
452
|
-
onClick={removeColumn}
|
453
|
-
disabled={isRemovalDisabled}
|
454
|
-
title={
|
455
|
-
isRemovalDisabled
|
456
|
-
? // TODO: We may want to provide a list of all places where column is in use
|
457
|
-
"This column is used and can't be removed"
|
458
|
-
: 'Remove'
|
417
|
+
{aggreateOperators.map((op) => (
|
418
|
+
<MenuContentItem
|
419
|
+
key={op.uuid}
|
420
|
+
className="query-builder__projection__column__aggregate__operator__dropdown__option"
|
421
|
+
onClick={changeOperator(op)}
|
422
|
+
>
|
423
|
+
{op.getLabel(projectionColumnState)}
|
424
|
+
</MenuContentItem>
|
425
|
+
))}
|
426
|
+
</MenuContent>
|
459
427
|
}
|
428
|
+
menuProps={{
|
429
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
|
430
|
+
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
431
|
+
elevation: 7,
|
432
|
+
}}
|
460
433
|
>
|
461
|
-
<
|
462
|
-
|
434
|
+
<div
|
435
|
+
className={clsx(
|
436
|
+
'query-builder__projection__column__aggregate__operator__badge',
|
437
|
+
{
|
438
|
+
'query-builder__projection__column__aggregate__operator__badge--activated':
|
439
|
+
Boolean(aggregateColumnState),
|
440
|
+
},
|
441
|
+
)}
|
442
|
+
>
|
443
|
+
<SigmaIcon />
|
444
|
+
</div>
|
445
|
+
<div className="query-builder__projection__column__aggregate__operator__dropdown__trigger">
|
446
|
+
<CaretDownIcon />
|
447
|
+
</div>
|
448
|
+
</DropdownMenu>
|
463
449
|
</div>
|
464
|
-
</
|
465
|
-
|
466
|
-
|
450
|
+
</div>
|
451
|
+
<div className="query-builder__projection__column__actions">
|
452
|
+
<button
|
453
|
+
className="query-builder__projection__column__action"
|
454
|
+
tabIndex={-1}
|
455
|
+
onClick={removeColumn}
|
456
|
+
disabled={isRemovalDisabled}
|
457
|
+
title={
|
458
|
+
isRemovalDisabled
|
459
|
+
? // TODO: We may want to provide a list of all places where column is in use
|
460
|
+
"This column is used and can't be removed"
|
461
|
+
: 'Remove'
|
462
|
+
}
|
463
|
+
>
|
464
|
+
<TimesIcon />
|
465
|
+
</button>
|
466
|
+
</div>
|
467
|
+
</ContextMenu>
|
468
|
+
</PanelDnDEntry>
|
467
469
|
);
|
468
470
|
},
|
469
471
|
);
|