@eccenca/gui-elements 23.2.0 → 23.3.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
- package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
- package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +12 -0
- package/dist/cjs/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
- package/dist/cjs/common/index.js +5 -2
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/utils/globalVars.js +21 -0
- package/dist/cjs/common/utils/globalVars.js.map +1 -0
- package/dist/cjs/components/Application/ApplicationHeader.js +2 -3
- package/dist/cjs/components/Application/ApplicationHeader.js.map +1 -1
- package/dist/cjs/components/Dialog/Modal.js +35 -8
- package/dist/cjs/components/Dialog/Modal.js.map +1 -1
- package/dist/cjs/components/Dialog/SimpleDialog.js +15 -2
- package/dist/cjs/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/cjs/components/Icon/IconButton.js +1 -1
- package/dist/cjs/components/Icon/IconButton.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +1 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +3 -6
- package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/cjs/components/PropertyValuePair/PropertyName.js +3 -3
- package/dist/cjs/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/cjs/components/Separation/Spacing.js +18 -4
- package/dist/cjs/components/Separation/Spacing.js.map +1 -1
- package/dist/cjs/components/Table/TableExpandHeader.js +7 -8
- package/dist/cjs/components/Table/TableExpandHeader.js.map +1 -1
- package/dist/cjs/components/TextField/TextField.js +23 -3
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/extensions/codemirror/CodeMirror.js +39 -7
- package/dist/cjs/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +10 -9
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js +4 -4
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +56 -6
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js +41 -0
- package/dist/cjs/extensions/react-flow/handles/HandleTools.js.map +1 -0
- package/dist/cjs/extensions/react-flow/index.js +2 -0
- package/dist/cjs/extensions/react-flow/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +42 -13
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +1 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +5 -1
- package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +9 -11
- package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
- package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js +6 -0
- package/dist/esm/cmem/react-flow/extensions/ReactFlowHotkeyContext.js.map +1 -0
- package/dist/esm/common/index.js +5 -2
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/common/utils/globalVars.js +16 -0
- package/dist/esm/common/utils/globalVars.js.map +1 -0
- package/dist/esm/components/Application/ApplicationHeader.js +2 -3
- package/dist/esm/components/Application/ApplicationHeader.js.map +1 -1
- package/dist/esm/components/Dialog/Modal.js +36 -9
- package/dist/esm/components/Dialog/Modal.js.map +1 -1
- package/dist/esm/components/Dialog/SimpleDialog.js +14 -1
- package/dist/esm/components/Dialog/SimpleDialog.js.map +1 -1
- package/dist/esm/components/Icon/IconButton.js +1 -1
- package/dist/esm/components/Icon/IconButton.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +1 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +3 -6
- package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
- package/dist/esm/components/PropertyValuePair/PropertyName.js +3 -3
- package/dist/esm/components/PropertyValuePair/PropertyName.js.map +1 -1
- package/dist/esm/components/Separation/Spacing.js +28 -4
- package/dist/esm/components/Separation/Spacing.js.map +1 -1
- package/dist/esm/components/Table/TableExpandHeader.js +7 -8
- package/dist/esm/components/Table/TableExpandHeader.js.map +1 -1
- package/dist/esm/components/TextField/TextField.js +25 -5
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/extensions/codemirror/CodeMirror.js +49 -6
- package/dist/esm/extensions/codemirror/CodeMirror.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +10 -9
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js +16 -5
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +75 -9
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleTools.js +61 -0
- package/dist/esm/extensions/react-flow/handles/HandleTools.js.map +1 -0
- package/dist/esm/extensions/react-flow/index.js +2 -0
- package/dist/esm/extensions/react-flow/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +49 -20
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/types/cmem/react-flow/extensions/ReactFlowHotkeyContext.d.ts +8 -0
- package/dist/types/common/index.d.ts +4 -0
- package/dist/types/common/utils/globalVars.d.ts +2 -0
- package/dist/types/components/Application/ApplicationHeader.d.ts +1 -2
- package/dist/types/components/Dialog/Modal.d.ts +22 -7
- package/dist/types/components/Dialog/SimpleDialog.d.ts +12 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/PropertyValuePair/PropertyName.d.ts +7 -1
- package/dist/types/components/Separation/Spacing.d.ts +2 -2
- package/dist/types/components/Table/TableExpandHeader.d.ts +5 -1
- package/dist/types/components/TextField/TextField.d.ts +4 -2
- package/dist/types/extensions/codemirror/CodeMirror.d.ts +17 -3
- package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +7 -3
- package/dist/types/extensions/react-flow/handles/HandleContent.d.ts +7 -2
- package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +15 -6
- package/dist/types/extensions/react-flow/handles/HandleTools.d.ts +7 -0
- package/dist/types/extensions/react-flow/index.d.ts +2 -0
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +24 -8
- package/package.json +19 -17
- package/scripts/compile-sass.ts +1 -1
- package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +10 -0
- package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -12
- package/src/cmem/react-flow/extensions/ReactFlowHotkeyContext.ts +14 -0
- package/src/common/index.ts +6 -3
- package/src/common/utils/globalVars.ts +18 -0
- package/src/components/Application/ApplicationHeader.tsx +8 -13
- package/src/components/Application/_header.scss +17 -17
- package/src/components/Application/_toolbar.scss +22 -33
- package/src/components/Application/application.scss +8 -6
- package/src/components/AutoSuggestion/tests/AutoSuggestion.test.tsx +34 -21
- package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +20 -9
- package/src/components/Dialog/Modal.tsx +96 -39
- package/src/components/Dialog/SimpleDialog.tsx +19 -1
- package/src/components/Dialog/dialog.scss +33 -17
- package/src/components/Icon/IconButton.tsx +1 -1
- package/src/components/Icon/canonicalIconNames.tsx +2 -0
- package/src/components/OverviewItem/OverviewItemDepiction.tsx +8 -16
- package/src/components/PropertyValuePair/PropertyName.tsx +15 -4
- package/src/components/PropertyValuePair/propertyvalue.scss +1 -0
- package/src/components/Separation/Spacing.tsx +12 -8
- package/src/components/Table/TableExpandHeader.tsx +21 -18
- package/src/components/TextField/TextField.tsx +32 -6
- package/src/components/Tooltip/tooltip.scss +15 -1
- package/src/extensions/codemirror/CodeMirror.tsx +62 -8
- package/src/extensions/codemirror/_codemirror.scss +53 -8
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +78 -81
- package/src/extensions/react-flow/edges/_edges.scss +62 -67
- package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +43 -44
- package/src/extensions/react-flow/handles/HandleContent.tsx +14 -13
- package/src/extensions/react-flow/handles/HandleDefault.tsx +121 -44
- package/src/extensions/react-flow/handles/HandleTools.tsx +46 -0
- package/src/extensions/react-flow/handles/_handles.scss +135 -50
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +69 -25
- package/src/extensions/react-flow/index.ts +2 -0
- package/src/extensions/react-flow/nodes/NodeContent.tsx +97 -32
- package/src/extensions/react-flow/nodes/_nodes.scss +170 -110
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +75 -52
- package/src/extensions/react-flow/nodes/stories/NodeDefault.stories.tsx +34 -36
- package/src/extensions/react-flow/nodes/stories/nodeTypes.ts +11 -0
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import React, {memo} from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
Handle as HandleNext,
|
|
9
|
-
} from "react-flow-renderer-lts";
|
|
10
|
-
import { HandleContent, HandleContentProps } from "./HandleContent";
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { Handle as HandleLegacy, HandleProps as ReactFlowHandleLegacyProps } from "react-flow-renderer";
|
|
3
|
+
import { Handle as HandleNext, HandleProps as ReactFlowHandleNextProps } from "react-flow-renderer-lts";
|
|
4
|
+
|
|
5
|
+
import { intentClassName, IntentTypes } from "../../../common/Intent";
|
|
6
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
7
|
+
import { TooltipProps } from "../../../index";
|
|
11
8
|
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
import { HandleContent, HandleContentProps } from "./HandleContent";
|
|
11
|
+
|
|
12
|
+
export type HandleCategory = "configuration" | "flexible" | "fixed" | "unknown" | "dependency";
|
|
13
|
+
|
|
14
|
+
interface HandleExtensionProps
|
|
15
|
+
extends ReacFlowVersionSupportProps,
|
|
16
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, "id" | "children"> {
|
|
17
|
+
/**
|
|
18
|
+
* Defines the handle category, mainly used to adjust layout.
|
|
19
|
+
*/
|
|
20
|
+
category?: HandleCategory;
|
|
14
21
|
/**
|
|
15
22
|
* Extended handle data.
|
|
16
23
|
*/
|
|
@@ -19,8 +26,11 @@ interface HandleExtensionProps extends ReacFlowVersionSupportProps {
|
|
|
19
26
|
* Simple text tooltip displayed as title on hover.
|
|
20
27
|
*/
|
|
21
28
|
tooltip?: string;
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Feedback state of the handle.
|
|
31
|
+
*/
|
|
32
|
+
intent?: IntentTypes;
|
|
33
|
+
children?: HandleContentProps["children"];
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
export interface HandleProps extends HandleExtensionProps, ReactFlowHandleLegacyProps {}
|
|
@@ -28,38 +38,105 @@ export interface HandleNextProps extends HandleExtensionProps, ReactFlowHandleNe
|
|
|
28
38
|
|
|
29
39
|
export type HandleDefaultProps = HandleProps | HandleNextProps;
|
|
30
40
|
|
|
31
|
-
export const HandleDefault = memo(
|
|
32
|
-
flowVersion,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const evaluateFlowVersion = useReactFlowVersion();
|
|
39
|
-
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
41
|
+
export const HandleDefault = memo(
|
|
42
|
+
({ flowVersion, data, tooltip, children, category, intent, ...handleProps }: HandleDefaultProps) => {
|
|
43
|
+
const evaluateFlowVersion = useReactFlowVersion();
|
|
44
|
+
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
45
|
+
const handleDefaultRef = React.useRef<any>();
|
|
46
|
+
const [extendedTooltipDisplayed, setExtendedTooltipDisplayed] = React.useState<boolean>(false);
|
|
47
|
+
const [handleToolsDisplayed, setHandleToolsDisplayed] = React.useState<boolean>(false);
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
const routeClickToTools = React.useCallback(
|
|
50
|
+
(e: Event) => {
|
|
51
|
+
const toolsTarget = handleDefaultRef.current.getElementsByClassName(
|
|
52
|
+
`${eccgui}-graphviz__handletools-target`
|
|
53
|
+
);
|
|
54
|
+
if (toolsTarget.length > 0 && e.target === handleDefaultRef.current) {
|
|
55
|
+
setHandleToolsDisplayed(true);
|
|
56
|
+
setExtendedTooltipDisplayed(false);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
[handleDefaultRef]
|
|
60
|
+
);
|
|
42
61
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</HandleContent>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
switch (flowVersionCheck) {
|
|
50
|
-
case "legacy":
|
|
51
|
-
return (
|
|
52
|
-
<HandleLegacy {...handleProps} {...tooltipTitle}>
|
|
53
|
-
{ handleContent }
|
|
54
|
-
</HandleLegacy>
|
|
55
|
-
);
|
|
56
|
-
case "next":
|
|
57
|
-
return (
|
|
58
|
-
<HandleNext {...handleProps} {...tooltipTitle}>
|
|
59
|
-
{ handleContent }
|
|
60
|
-
</HandleNext>
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
const toolsTarget = handleDefaultRef.current.getElementsByClassName(
|
|
64
|
+
`${eccgui}-graphviz__handletools-target`
|
|
61
65
|
);
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
if (toolsTarget && toolsTarget[0]) {
|
|
67
|
+
// Polyfill for FF that does not support the `:has()` pseudo selector until at least version 119 or 120
|
|
68
|
+
// need to be re-evaluated then
|
|
69
|
+
// @see https://connect.mozilla.org/t5/ideas/when-is-has-css-selector-going-to-be-fully-implemented-in/idi-p/23794
|
|
70
|
+
handleDefaultRef.current.classList.add(`ffpolyfill-has-${eccgui}-graphviz__handletools-target`);
|
|
71
|
+
}
|
|
72
|
+
if (handleToolsDisplayed) {
|
|
73
|
+
toolsTarget[0].click();
|
|
74
|
+
}
|
|
75
|
+
}, [handleToolsDisplayed]);
|
|
76
|
+
|
|
77
|
+
const tooltipTitle = tooltip ? { title: tooltip } : {};
|
|
78
|
+
|
|
79
|
+
const handleContentTooltipProps = {
|
|
80
|
+
placement:
|
|
81
|
+
handleProps.position === "left" || handleProps.position === "right"
|
|
82
|
+
? `${handleProps.position}-end`
|
|
83
|
+
: undefined,
|
|
84
|
+
modifiers: {
|
|
85
|
+
offset: {
|
|
86
|
+
enabled: true,
|
|
87
|
+
options: {
|
|
88
|
+
offset: [3, 20],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
intent: intent,
|
|
93
|
+
className: `${eccgui}-graphviz__handle__tooltip-target`,
|
|
94
|
+
isOpen: extendedTooltipDisplayed && !handleToolsDisplayed,
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleContentProps = {
|
|
98
|
+
...data,
|
|
99
|
+
tooltipProps: {
|
|
100
|
+
...handleContentTooltipProps,
|
|
101
|
+
...data?.tooltipProps,
|
|
102
|
+
} as TooltipProps,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const handleContent = <HandleContent {...handleContentProps}>{children}</HandleContent>;
|
|
106
|
+
|
|
107
|
+
const handleConfig = {
|
|
108
|
+
...handleProps,
|
|
109
|
+
...tooltipTitle,
|
|
110
|
+
className: intent ? ` ${intentClassName(intent)}` : "",
|
|
111
|
+
onClick: (e: any) => {
|
|
112
|
+
if (handleProps.onClick) {
|
|
113
|
+
handleProps.onClick(e);
|
|
114
|
+
}
|
|
115
|
+
routeClickToTools(e);
|
|
116
|
+
},
|
|
117
|
+
"data-category": category,
|
|
118
|
+
onMouseEnter: () => {
|
|
119
|
+
setExtendedTooltipDisplayed(true);
|
|
120
|
+
setHandleToolsDisplayed(false);
|
|
121
|
+
},
|
|
122
|
+
onMouseLeave: () => setExtendedTooltipDisplayed(false),
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
switch (flowVersionCheck) {
|
|
126
|
+
case "legacy":
|
|
127
|
+
return (
|
|
128
|
+
<HandleLegacy ref={handleDefaultRef} {...handleConfig}>
|
|
129
|
+
{handleContent}
|
|
130
|
+
</HandleLegacy>
|
|
131
|
+
);
|
|
132
|
+
case "next":
|
|
133
|
+
return (
|
|
134
|
+
<HandleNext ref={handleDefaultRef} {...handleConfig}>
|
|
135
|
+
{handleContent}
|
|
136
|
+
</HandleNext>
|
|
137
|
+
);
|
|
138
|
+
default:
|
|
139
|
+
return <></>;
|
|
140
|
+
}
|
|
64
141
|
}
|
|
65
|
-
|
|
142
|
+
);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PopoverInteractionKind as BlueprintPopoverInteractionKind } from "@blueprintjs/core";
|
|
3
|
+
|
|
4
|
+
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
5
|
+
import { ContextOverlay, TestableComponent } from "../../../index";
|
|
6
|
+
|
|
7
|
+
import {ContextOverlayProps} from "./../../../components/ContextOverlay/ContextOverlay";
|
|
8
|
+
|
|
9
|
+
export interface HandleToolsProps
|
|
10
|
+
extends Omit<ContextOverlayProps, "children" | "content" | "popoverClassName">,
|
|
11
|
+
TestableComponent {
|
|
12
|
+
children: string | JSX.Element | JSX.Element[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const HandleTools = ({ children, ...otherContextOverlayProps }: HandleToolsProps) => {
|
|
16
|
+
const [toolsDisplayed, setToolsDisplayed] = React.useState<boolean>(false);
|
|
17
|
+
|
|
18
|
+
const configToolsDisplayed = toolsDisplayed
|
|
19
|
+
? {
|
|
20
|
+
defaultIsOpen: true,
|
|
21
|
+
autoFocus: true,
|
|
22
|
+
interactionKind: BlueprintPopoverInteractionKind.HOVER,
|
|
23
|
+
onClosing: () => setToolsDisplayed(false),
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
onOpening: () => {
|
|
27
|
+
setToolsDisplayed(true);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<ContextOverlay
|
|
33
|
+
hoverCloseDelay={500}
|
|
34
|
+
{...configToolsDisplayed}
|
|
35
|
+
{...otherContextOverlayProps}
|
|
36
|
+
content={<div className={`${eccgui}-graphviz__handletools-content`}>{children}</div>}
|
|
37
|
+
className={`${eccgui}-graphviz__handletools-target`}
|
|
38
|
+
popoverClassName={`${eccgui}-graphviz__handletools-overlay`}
|
|
39
|
+
>
|
|
40
|
+
<div
|
|
41
|
+
className={`${eccgui}-graphviz__handletools-target`}
|
|
42
|
+
data-test-id={otherContextOverlayProps["data-test-id"]}
|
|
43
|
+
/>
|
|
44
|
+
</ContextOverlay>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -1,91 +1,171 @@
|
|
|
1
|
+
$eccgui-size-flow-handle: $eccgui-size-block-whitespace * 0.7;
|
|
2
|
+
$eccgui-size-flow-handle-border: $eccgui-size-flow-handle * 0.4;
|
|
3
|
+
|
|
1
4
|
div.react-flow__handle {
|
|
2
|
-
color: $reactflow-node-border-color;
|
|
3
|
-
background-color: currentColor;
|
|
4
|
-
border-color: currentColor;
|
|
5
|
-
width: $eccgui-size-block-whitespace * 0.5;
|
|
6
|
-
height: $eccgui-size-block-whitespace * 0.5;
|
|
7
5
|
z-index: 2;
|
|
6
|
+
width: $eccgui-size-flow-handle;
|
|
7
|
+
height: $eccgui-size-flow-handle;
|
|
8
|
+
color: $reactflow-node-border-color;
|
|
9
|
+
background-color: currentcolor;
|
|
10
|
+
border: 2px solid currentcolor;
|
|
8
11
|
border-radius: 100%;
|
|
9
12
|
|
|
13
|
+
&.eccgui-intent--primary {
|
|
14
|
+
color: $eccgui-color-primary;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.eccgui-intent--accent {
|
|
18
|
+
color: $eccgui-color-accent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.eccgui-intent--success {
|
|
22
|
+
color: $eccgui-color-success-text;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.eccgui-intent--info {
|
|
26
|
+
color: $eccgui-color-info-text;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.eccgui-intent--warning {
|
|
30
|
+
color: $eccgui-color-warning-text;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.eccgui-intent--danger {
|
|
34
|
+
color: $eccgui-color-danger-text;
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
.react-flow__node-default & {
|
|
11
|
-
background-color:
|
|
38
|
+
background-color: currentcolor;
|
|
12
39
|
}
|
|
13
40
|
|
|
14
|
-
|
|
15
|
-
content: " ";
|
|
41
|
+
&::before {
|
|
16
42
|
position: absolute;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
top: $eccgui-size-block-whitespace * -0.5;
|
|
20
|
-
left: $eccgui-size-block-whitespace * -0.5;
|
|
21
|
-
bottom: $eccgui-size-block-whitespace * -0.5;
|
|
22
|
-
right: $eccgui-size-block-whitespace * -0.5;
|
|
23
|
-
opacity: 0.61;
|
|
43
|
+
inset: $eccgui-size-flow-handle * -0.75;
|
|
44
|
+
z-index: -1;
|
|
24
45
|
display: none;
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
content: " ";
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
border: solid $eccgui-size-flow-handle * 0.75 currentcolor;
|
|
27
49
|
border-radius: 100%;
|
|
50
|
+
opacity: 0.61;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:is(
|
|
54
|
+
// Polyfill for FF that does not support the `:has()` pseudo selector until at least version 119 or 120
|
|
55
|
+
// usally `&:has(.#{$eccgui}-graphviz__handletools-target)` should be enough
|
|
56
|
+
// need to be re-evaluated then
|
|
57
|
+
.ffpolyfill-has-#{$eccgui}-graphviz__handletools-target,
|
|
58
|
+
div:has(.#{$eccgui}-graphviz__handletools-target)
|
|
59
|
+
) {
|
|
60
|
+
&::after {
|
|
61
|
+
position: absolute;
|
|
62
|
+
inset: 0;
|
|
63
|
+
display: none;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
content: " ";
|
|
66
|
+
border-radius: 100%;
|
|
67
|
+
outline: dotted $eccgui-size-flow-handle-border currentcolor;
|
|
68
|
+
outline-offset: $eccgui-size-flow-handle * 0.75 + $eccgui-size-flow-handle-border * 0.5;
|
|
69
|
+
|
|
70
|
+
.react-flow__node:hover & {
|
|
71
|
+
display: block;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
28
74
|
}
|
|
29
75
|
|
|
30
76
|
&:hover {
|
|
31
|
-
|
|
32
|
-
box-shadow: 0 0 $eccgui-size-
|
|
77
|
+
&::before {
|
|
78
|
+
box-shadow: 0 0 $eccgui-size-flow-handle $eccgui-size-flow-handle * 0.5 currentcolor;
|
|
33
79
|
}
|
|
34
80
|
}
|
|
35
81
|
|
|
36
|
-
|
|
82
|
+
&[data-category="configuration"] {
|
|
37
83
|
border-radius: 0;
|
|
38
84
|
|
|
39
|
-
|
|
85
|
+
&::after,
|
|
86
|
+
&::before {
|
|
87
|
+
border-radius: 0;
|
|
88
|
+
transform: scale(0.9);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&[data-category="dependency"] {
|
|
93
|
+
background-color: color-mix(in srgb, currentcolor 39%, white);
|
|
94
|
+
border-radius: 0;
|
|
95
|
+
transform: rotate(45deg);
|
|
96
|
+
|
|
97
|
+
&[data-category="dependency"].react-flow__handle-left {
|
|
98
|
+
transform-origin: 125% 100%;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&[data-category="dependency"].react-flow__handle-right {
|
|
102
|
+
transform-origin: 75% -50%;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&::after,
|
|
106
|
+
&::before {
|
|
40
107
|
border-radius: 0;
|
|
108
|
+
transform: scale(0.9);
|
|
41
109
|
}
|
|
42
110
|
}
|
|
43
111
|
|
|
112
|
+
&[data-category="flexible"] {
|
|
113
|
+
background-color: white;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[data-category="fixed"] {
|
|
117
|
+
border-color: currentcolor; // no change, only here to have a "fixed" rule
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&[data-category="unknown"] {
|
|
121
|
+
background-color: color-mix(in srgb, currentcolor 39%, white);
|
|
122
|
+
}
|
|
123
|
+
|
|
44
124
|
.react-flow__node:hover &.connectable {
|
|
45
|
-
|
|
125
|
+
&::before {
|
|
46
126
|
display: block;
|
|
47
127
|
}
|
|
48
128
|
}
|
|
49
129
|
|
|
50
|
-
&.react-flow__handle-connecting:hover,
|
|
130
|
+
&.react-flow__handle-connecting:hover,
|
|
131
|
+
&.invalid-handle {
|
|
51
132
|
color: $eccgui-color-danger-text;
|
|
52
|
-
|
|
133
|
+
|
|
134
|
+
&::before {
|
|
53
135
|
display: block;
|
|
54
136
|
}
|
|
55
137
|
}
|
|
56
138
|
|
|
57
|
-
&.react-flow__handle-valid:hover,
|
|
139
|
+
&.react-flow__handle-valid:hover,
|
|
140
|
+
&.valid-handle {
|
|
58
141
|
color: $eccgui-color-success-text;
|
|
59
142
|
}
|
|
60
143
|
}
|
|
61
144
|
|
|
62
145
|
.#{$eccgui}-graphviz__handle__content {
|
|
63
146
|
position: absolute;
|
|
64
|
-
|
|
65
|
-
right: 0;
|
|
66
|
-
bottom: 0;
|
|
67
|
-
left: 0;
|
|
68
|
-
cursor: help;
|
|
147
|
+
inset: 0;
|
|
69
148
|
overflow: hidden;
|
|
149
|
+
cursor: help;
|
|
70
150
|
}
|
|
71
151
|
|
|
72
152
|
div.react-flow__handle-right {
|
|
73
|
-
right: -1 * $eccgui-size-
|
|
153
|
+
right: -1 * $eccgui-size-flow-handle;
|
|
74
154
|
transform: translateX(-50%) translateY(-50%);
|
|
75
155
|
}
|
|
76
156
|
|
|
77
157
|
div.react-flow__handle-left {
|
|
78
|
-
left: -1 * $eccgui-size-
|
|
158
|
+
left: -1 * $eccgui-size-flow-handle;
|
|
79
159
|
transform: translateX(50%) translateY(-50%);
|
|
80
160
|
}
|
|
81
161
|
|
|
82
162
|
div.react-flow__handle-top {
|
|
83
|
-
top: -1 * $eccgui-size-
|
|
163
|
+
top: -1 * $eccgui-size-flow-handle;
|
|
84
164
|
transform: translateX(-50%) translateY(50%);
|
|
85
165
|
}
|
|
86
166
|
|
|
87
167
|
div.react-flow__handle-bottom {
|
|
88
|
-
bottom: -1 * $eccgui-size-
|
|
168
|
+
bottom: -1 * $eccgui-size-flow-handle;
|
|
89
169
|
transform: translateX(-50%) translateY(-50%);
|
|
90
170
|
}
|
|
91
171
|
|
|
@@ -93,28 +173,22 @@ div.react-flow__handle-bottom {
|
|
|
93
173
|
.#{$eccgui}-graphviz__node--minimal-circular {
|
|
94
174
|
.react-flow__node:not(.selected) & {
|
|
95
175
|
& ~ .react-flow__handle {
|
|
96
|
-
|
|
97
|
-
left: $reactflow-node-basesize * 0.5;
|
|
98
|
-
right: auto;
|
|
99
|
-
bottom: auto;
|
|
100
|
-
transform: translateX(-50%) translateY(-50%);
|
|
176
|
+
inset: 50% auto auto $reactflow-node-basesize * 0.5;
|
|
101
177
|
z-index: 0;
|
|
102
|
-
opacity: 0;
|
|
103
|
-
height: $reactflow-node-basesize;
|
|
104
178
|
width: $reactflow-node-basesize;
|
|
179
|
+
height: $reactflow-node-basesize;
|
|
180
|
+
opacity: 0;
|
|
181
|
+
transform: translateX(-50%) translateY(-50%);
|
|
105
182
|
}
|
|
106
183
|
}
|
|
107
184
|
|
|
108
185
|
& ~ .react-flow__handle:not(.connectable) {
|
|
109
|
-
|
|
110
|
-
left: $reactflow-node-basesize * 0.5;
|
|
111
|
-
right: auto;
|
|
112
|
-
bottom: auto;
|
|
113
|
-
transform: translateX(-50%) translateY(-50%);
|
|
186
|
+
inset: 50% auto auto $reactflow-node-basesize * 0.5;
|
|
114
187
|
z-index: 0;
|
|
115
|
-
opacity: 0;
|
|
116
|
-
height: $reactflow-node-basesize;
|
|
117
188
|
width: $reactflow-node-basesize;
|
|
189
|
+
height: $reactflow-node-basesize;
|
|
190
|
+
opacity: 0;
|
|
191
|
+
transform: translateX(-50%) translateY(-50%);
|
|
118
192
|
}
|
|
119
193
|
}
|
|
120
194
|
|
|
@@ -132,23 +206,34 @@ div.react-flow__handle-bottom {
|
|
|
132
206
|
|
|
133
207
|
.#{$eccgui}-graphviz__node--hidehandles {
|
|
134
208
|
& ~ .react-flow__handle:not(.connectable) {
|
|
135
|
-
|
|
209
|
+
z-index: -1;
|
|
136
210
|
width: 1px;
|
|
211
|
+
height: 1px;
|
|
137
212
|
visibility: hidden;
|
|
138
213
|
border: none;
|
|
139
|
-
z-index: -1;
|
|
140
214
|
|
|
141
215
|
&.react-flow__handle-top {
|
|
142
216
|
top: 0;
|
|
143
217
|
}
|
|
218
|
+
|
|
144
219
|
&.react-flow__handle-right {
|
|
145
220
|
right: 0;
|
|
146
221
|
}
|
|
222
|
+
|
|
147
223
|
&.react-flow__handle-bottom {
|
|
148
224
|
bottom: 0;
|
|
149
225
|
}
|
|
226
|
+
|
|
150
227
|
&.react-flow__handle-left {
|
|
151
228
|
left: 0;
|
|
152
229
|
}
|
|
153
230
|
}
|
|
154
231
|
}
|
|
232
|
+
|
|
233
|
+
.#{$eccgui}-graphviz__handletools-target {
|
|
234
|
+
position: absolute;
|
|
235
|
+
top: 0;
|
|
236
|
+
left: 0;
|
|
237
|
+
width: 100%;
|
|
238
|
+
height: 100%;
|
|
239
|
+
}
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { Elements, ReactFlowProvider } from "react-flow-renderer";
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { Definitions } from "../../../../common/Intent";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Button,
|
|
9
|
+
HandleDefault,
|
|
10
|
+
HandleProps,
|
|
11
|
+
HandleTools,
|
|
12
|
+
Menu,
|
|
13
|
+
MenuItem,
|
|
14
|
+
ReactFlow,
|
|
15
|
+
SimpleDialog,
|
|
16
|
+
} from "./../../../../../index";
|
|
5
17
|
import { edgeTypes } from "./../../edges/edgeTypes";
|
|
6
18
|
|
|
7
19
|
const HandleDefaultDataProps = (data: HandleProps["data"]) => {
|
|
8
20
|
// this is only a mock to get it as sub element in the table
|
|
9
21
|
return <>{data.extendedTooltip}</>;
|
|
10
|
-
}
|
|
22
|
+
};
|
|
11
23
|
|
|
12
24
|
export default {
|
|
13
|
-
title: "Extensions/React Flow/
|
|
25
|
+
title: "Extensions/React Flow/Handle",
|
|
14
26
|
component: HandleDefault,
|
|
15
|
-
subcomponents: { HandleDefaultDataProps },
|
|
27
|
+
subcomponents: { HandleDefaultDataProps, HandleTools },
|
|
16
28
|
argTypes: {
|
|
29
|
+
intent: {
|
|
30
|
+
control: "select",
|
|
31
|
+
options: { "Not set": undefined, ...Definitions },
|
|
32
|
+
},
|
|
17
33
|
},
|
|
18
|
-
} as
|
|
34
|
+
} as Meta<typeof HandleDefault>;
|
|
19
35
|
|
|
20
36
|
const HandleDefaultExample = (args: any) => {
|
|
21
37
|
const [reactflowInstance, setReactflowInstance] = useState(null);
|
|
@@ -30,9 +46,7 @@ const HandleDefaultExample = (args: any) => {
|
|
|
30
46
|
label: "Default ",
|
|
31
47
|
content: "Example content.",
|
|
32
48
|
minimalShape: "none",
|
|
33
|
-
handles: [
|
|
34
|
-
{ ...args }
|
|
35
|
-
],
|
|
49
|
+
handles: [{ ...args }],
|
|
36
50
|
},
|
|
37
51
|
position: { x: 50, y: 200 },
|
|
38
52
|
},
|
|
@@ -48,24 +62,54 @@ const HandleDefaultExample = (args: any) => {
|
|
|
48
62
|
[reactflowInstance]
|
|
49
63
|
);
|
|
50
64
|
|
|
51
|
-
return
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
return (
|
|
66
|
+
<ReactFlowProvider>
|
|
67
|
+
<ReactFlow
|
|
68
|
+
elements={elements}
|
|
69
|
+
style={{ height: "400px" }}
|
|
70
|
+
onLoad={onLoad}
|
|
71
|
+
edgeTypes={edgeTypes}
|
|
72
|
+
defaultZoom={1}
|
|
73
|
+
/>
|
|
74
|
+
</ReactFlowProvider>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
61
77
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
const HandleTestMenu = () => {
|
|
79
|
+
const [menuOpen, setMenuOpen] = useState<boolean>(false);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<HandleTools>
|
|
84
|
+
<Menu>
|
|
85
|
+
<MenuItem onClick={() => alert("Thank you for the click!")} text={"Click me!"} />
|
|
86
|
+
<MenuItem onClick={() => setMenuOpen(!menuOpen)} text="Open modal" />
|
|
87
|
+
</Menu>
|
|
88
|
+
</HandleTools>
|
|
89
|
+
<SimpleDialog isOpen={menuOpen} actions={<Button onClick={() => setMenuOpen(false)}>Close</Button>}>
|
|
90
|
+
Open modal.
|
|
91
|
+
</SimpleDialog>
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const Template: StoryFn<typeof HandleDefault> = (args) => <HandleDefaultExample {...args} />;
|
|
65
97
|
|
|
66
98
|
export const Default = Template.bind({});
|
|
67
99
|
Default.args = {
|
|
68
100
|
type: "target",
|
|
69
101
|
tooltip: "this is a target handle",
|
|
70
|
-
isConnectable:
|
|
102
|
+
isConnectable: true,
|
|
103
|
+
onClick: () => alert("Clicked handle."),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const UsingHandleTools = Template.bind({});
|
|
107
|
+
UsingHandleTools.args = {
|
|
108
|
+
type: "source",
|
|
109
|
+
tooltip: "this is a handle with tools overlay",
|
|
110
|
+
isConnectable: true,
|
|
111
|
+
children: <HandleTestMenu />,
|
|
112
|
+
data: {
|
|
113
|
+
extendedTooltip: "This is another Tooltip",
|
|
114
|
+
},
|
|
71
115
|
};
|
|
@@ -7,6 +7,8 @@ export * from "./nodes/NodeContentExtension";
|
|
|
7
7
|
export * from "./nodes/NodeTools";
|
|
8
8
|
export * from "./nodes/nodeUtils";
|
|
9
9
|
export * from "./handles/HandleDefault";
|
|
10
|
+
export * from "./handles/HandleContent";
|
|
11
|
+
export * from "./handles/HandleTools";
|
|
10
12
|
export * from "./edges/EdgeDefault";
|
|
11
13
|
export * from "./edges/EdgeStep";
|
|
12
14
|
export * from "./edges/EdgeTools";
|