-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathExpandedGroupNode.tsx
More file actions
121 lines (114 loc) · 3.52 KB
/
Copy pathExpandedGroupNode.tsx
File metadata and controls
121 lines (114 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import {Box, Colors, Icon} from '@dagster-io/ui-components';
import * as React from 'react';
import styled from 'styled-components';
import {GroupNodeNameAndRepo, useGroupNodeContextMenu} from './CollapsedGroupNode';
import {ContextMenuWrapper} from './ContextMenuWrapper';
import {ManualPositionHandle} from './ManualPositionHandle';
import {GraphNode} from './Utils';
import {GroupLayout} from './layout';
import {SVGRelativeContainerForSafari} from '../graph/SVGComponents';
export const ExpandedGroupNode = ({
group,
minimal,
onCollapse,
toggleSelectAllNodes,
preferredJobName,
onFilterToGroup,
setHighlighted,
isManuallyPositioned,
isDragging,
onDragStart,
onResetPosition,
}: {
group: GroupLayout & {assets: GraphNode[]};
minimal: boolean;
onCollapse?: () => void;
toggleSelectAllNodes?: (e: React.MouseEvent) => void;
preferredJobName?: string;
onFilterToGroup?: () => void;
setHighlighted: (ids: string[] | null) => void;
isManuallyPositioned?: boolean;
isDragging?: boolean;
onDragStart?: (e: React.MouseEvent<HTMLButtonElement>) => void;
onResetPosition?: () => void;
}) => {
const {menu, dialog} = useGroupNodeContextMenu({
onFilterToGroup,
assets: group.assets,
preferredJobName,
});
return (
<SVGRelativeContainerForSafari>
<ContextMenuWrapper menu={menu} stopPropagation>
<GroupNodeHeaderBox
$minimal={minimal}
onMouseEnter={() => setHighlighted(group.assets.map((a) => a.id))}
onMouseLeave={() => setHighlighted(null)}
onClick={(e) => {
if (e.metaKey && toggleSelectAllNodes) {
toggleSelectAllNodes(e);
} else {
onCollapse?.();
}
e.stopPropagation();
}}
>
<GroupNodeNameAndRepo group={group} minimal={minimal} />
{onDragStart ? (
<ManualPositionHandle
isDragging={!!isDragging}
isManuallyPositioned={!!isManuallyPositioned}
onDragStart={onDragStart}
onReset={onResetPosition}
/>
) : null}
{onCollapse && (
<Box padding={{vertical: 4}}>
<Icon name="unfold_less" />
</Box>
)}
</GroupNodeHeaderBox>
</ContextMenuWrapper>
{dialog}
</SVGRelativeContainerForSafari>
);
};
export const GroupOutline = ({minimal}: {minimal: boolean}) => (
<SVGRelativeContainerForSafari>
<GroupOutlineBox $minimal={minimal} />
</SVGRelativeContainerForSafari>
);
const GroupOutlineBox = styled.div<{$minimal: boolean}>`
inset: 0;
top: 60px;
position: absolute;
background: ${Colors.lineageGroupBackground()};
width: 100%;
border-radius: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
pointer-events: none;
border: ${(p) => (p.$minimal ? '4px' : '2px')} solid ${Colors.lineageGroupNodeBorder()};
border-top: 0;
`;
const GroupNodeHeaderBox = styled.div<{$minimal: boolean}>`
border: ${(p) => (p.$minimal ? '4px' : '2px')} solid ${Colors.lineageGroupNodeBorder()};
background: ${Colors.lineageGroupNodeBackground()};
width: 100%;
height: 60px;
display: flex;
align-items: center;
cursor: pointer;
padding: 0 12px 0 16px;
border-radius: 8px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
position: relative;
transition:
background 100ms linear,
border-color 100ms linear;
&:hover {
background: ${Colors.lineageGroupNodeBackgroundHover()};
border-color: ${Colors.lineageGroupNodeBorderHover()};
}
`;