@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,27 +1,28 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import { LoremIpsum, loremIpsum } from
|
|
4
|
-
import
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import ReactFlow, { Elements, ReactFlowProvider } from "react-flow-renderer";
|
|
3
|
+
import { LoremIpsum, loremIpsum } from "react-lorem-ipsum";
|
|
4
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
import { Definitions } from "../../../../common/Intent";
|
|
7
|
+
|
|
8
|
+
import canonicalIcons from "./../../../../components/Icon/canonicalIconNames";
|
|
5
9
|
import {
|
|
6
10
|
Badge,
|
|
7
11
|
ContextMenu,
|
|
8
|
-
MenuItem,
|
|
9
|
-
OverflowText,
|
|
10
12
|
HtmlContentBlock,
|
|
11
13
|
IconButton,
|
|
14
|
+
MenuItem,
|
|
15
|
+
OverflowText,
|
|
12
16
|
Tag,
|
|
13
17
|
TagList,
|
|
14
18
|
} from "./../../../../index";
|
|
15
|
-
import canonicalIcons from "./../../../../components/Icon/canonicalIconNames";
|
|
16
|
-
import { Definitions } from "../../../../common/Intent";
|
|
17
|
-
|
|
18
19
|
import { NodeContent } from "./../NodeContent";
|
|
19
|
-
import { nodeTypes } from "./../nodeTypes";
|
|
20
20
|
import { NodeContentExtension } from "./../NodeContentExtension";
|
|
21
21
|
import {
|
|
22
22
|
Default as ContentExtensionExample,
|
|
23
23
|
SlideOutOfNode as ContentExtensionExampleSlideOut,
|
|
24
24
|
} from "./NodeContentExtension.stories";
|
|
25
|
+
import { nodeTypes } from "./nodeTypes";
|
|
25
26
|
|
|
26
27
|
export default {
|
|
27
28
|
title: "Extensions/React Flow/Node Content",
|
|
@@ -42,14 +43,32 @@ export default {
|
|
|
42
43
|
options: ["Not set", "Text string", "OverflowText element", "Tag list"],
|
|
43
44
|
mapping: {
|
|
44
45
|
"Not set": undefined,
|
|
45
|
-
"Text string": loremIpsum({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
"Text string": loremIpsum({
|
|
47
|
+
p: 1,
|
|
48
|
+
avgSentencesPerParagraph: 1,
|
|
49
|
+
avgWordsPerSentence: 8,
|
|
50
|
+
random: false,
|
|
51
|
+
}).toString(),
|
|
52
|
+
"OverflowText element": (
|
|
53
|
+
<OverflowText>
|
|
54
|
+
{loremIpsum({
|
|
55
|
+
p: 1,
|
|
56
|
+
avgSentencesPerParagraph: 2,
|
|
57
|
+
avgWordsPerSentence: 4,
|
|
58
|
+
random: false,
|
|
59
|
+
}).toString()}
|
|
60
|
+
</OverflowText>
|
|
61
|
+
),
|
|
62
|
+
"Tag list": (
|
|
63
|
+
<TagList>
|
|
64
|
+
{loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 5, random: false })
|
|
65
|
+
.toString()
|
|
66
|
+
.split(" ")
|
|
67
|
+
.map((term) => (
|
|
68
|
+
<Tag small>{term}</Tag>
|
|
69
|
+
))}
|
|
70
|
+
</TagList>
|
|
71
|
+
),
|
|
53
72
|
},
|
|
54
73
|
},
|
|
55
74
|
menuButtons: {
|
|
@@ -57,14 +76,18 @@ export default {
|
|
|
57
76
|
options: ["Not set", "Icon button", "Context Menu", "Info badge"],
|
|
58
77
|
mapping: {
|
|
59
78
|
"Not set": undefined,
|
|
60
|
-
"Icon button": <IconButton name="item-info" text="Icon button" onClick={()=>alert("Click info")} />,
|
|
61
|
-
"Context Menu":
|
|
79
|
+
"Icon button": <IconButton name="item-info" text="Icon button" onClick={() => alert("Click info")} />,
|
|
80
|
+
"Context Menu": (
|
|
81
|
+
<ContextMenu>
|
|
82
|
+
<MenuItem text="Context menu" />
|
|
83
|
+
</ContextMenu>
|
|
84
|
+
),
|
|
62
85
|
"Info badge": <Badge intent="info">Info</Badge>,
|
|
63
86
|
},
|
|
64
87
|
},
|
|
65
88
|
iconName: {
|
|
66
89
|
control: "select",
|
|
67
|
-
options: [...
|
|
90
|
+
options: [...Object.keys(canonicalIcons)],
|
|
68
91
|
},
|
|
69
92
|
highlightedState: {
|
|
70
93
|
control: "select",
|
|
@@ -80,20 +103,20 @@ export default {
|
|
|
80
103
|
},
|
|
81
104
|
intent: {
|
|
82
105
|
control: "select",
|
|
83
|
-
options: {"Not set": undefined, ...Definitions},
|
|
106
|
+
options: { "Not set": undefined, ...Definitions },
|
|
84
107
|
},
|
|
85
108
|
highlightColor: {
|
|
86
109
|
control: "select",
|
|
87
110
|
options: {
|
|
88
111
|
"Not set": undefined,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"Default + alternate": ["default"
|
|
112
|
+
Default: "default",
|
|
113
|
+
Alternate: "alternate",
|
|
114
|
+
"Default + alternate": ["default", "alternate"],
|
|
92
115
|
"Custom (red)": "red",
|
|
93
116
|
"Default + Custom (red)": ["default", "red"],
|
|
94
117
|
"Custom (green) + alternate": ["green", "alternate"],
|
|
95
118
|
"Custom (purple) + custom (yellow)": ["purple", "yellow"],
|
|
96
|
-
}
|
|
119
|
+
},
|
|
97
120
|
},
|
|
98
121
|
content: { control: "none" },
|
|
99
122
|
footerContent: { control: "none" },
|
|
@@ -103,7 +126,7 @@ export default {
|
|
|
103
126
|
selected: { table: { disable: true } },
|
|
104
127
|
businessData: { table: { disable: true } },
|
|
105
128
|
},
|
|
106
|
-
} as
|
|
129
|
+
} as Meta<typeof NodeContent>;
|
|
107
130
|
|
|
108
131
|
const NodeContentExample = (args: any) => {
|
|
109
132
|
const [reactflowInstance, setReactflowInstance] = useState(null);
|
|
@@ -113,11 +136,11 @@ const NodeContentExample = (args: any) => {
|
|
|
113
136
|
useEffect(() => {
|
|
114
137
|
setElements([
|
|
115
138
|
{
|
|
116
|
-
id:
|
|
117
|
-
type:
|
|
139
|
+
id: "example-1",
|
|
140
|
+
type: "default",
|
|
118
141
|
data: args,
|
|
119
142
|
position: { x: 50, y: 50 },
|
|
120
|
-
}
|
|
143
|
+
},
|
|
121
144
|
] as Elements);
|
|
122
145
|
}, [args]);
|
|
123
146
|
|
|
@@ -130,33 +153,31 @@ const NodeContentExample = (args: any) => {
|
|
|
130
153
|
[reactflowInstance]
|
|
131
154
|
);
|
|
132
155
|
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
156
|
+
return (
|
|
157
|
+
<ReactFlowProvider>
|
|
158
|
+
<ReactFlow
|
|
159
|
+
elements={elements}
|
|
160
|
+
style={{ height: "400px" }}
|
|
161
|
+
onLoad={onLoad}
|
|
162
|
+
nodeTypes={nodeTypes}
|
|
163
|
+
defaultZoom={1}
|
|
164
|
+
/>
|
|
165
|
+
</ReactFlowProvider>
|
|
166
|
+
);
|
|
167
|
+
};
|
|
141
168
|
|
|
142
|
-
const Template:
|
|
143
|
-
<NodeContentExample {...args} /*some comment*/ />
|
|
144
|
-
);
|
|
169
|
+
const Template: StoryFn<typeof NodeContent> = (args) => <NodeContentExample {...args} /*some comment*/ />;
|
|
145
170
|
|
|
146
171
|
export const Default = Template.bind({});
|
|
147
172
|
Default.args = {
|
|
148
|
-
label:
|
|
173
|
+
label: "Node title",
|
|
149
174
|
content: (
|
|
150
175
|
<HtmlContentBlock>
|
|
151
176
|
<h4>Node body</h4>
|
|
152
177
|
<LoremIpsum p={4} avgSentencesPerParagraph={3} random={false} />
|
|
153
178
|
</HtmlContentBlock>
|
|
154
179
|
),
|
|
155
|
-
footerContent:
|
|
156
|
-
<OverflowText passDown>
|
|
157
|
-
Node footer with some text information.
|
|
158
|
-
</OverflowText>
|
|
159
|
-
),
|
|
180
|
+
footerContent: <OverflowText passDown>Node footer with some text information.</OverflowText>,
|
|
160
181
|
contentExtension: undefined,
|
|
161
182
|
minimalShape: "none",
|
|
162
183
|
getMinimalTooltipData: (node: any) => {
|
|
@@ -165,7 +186,7 @@ Default.args = {
|
|
|
165
186
|
content: node.data?.content,
|
|
166
187
|
iconName: node.data?.iconName,
|
|
167
188
|
depiction: node.data?.depiction,
|
|
168
|
-
}
|
|
189
|
+
};
|
|
169
190
|
},
|
|
170
191
|
handles: [
|
|
171
192
|
{
|
|
@@ -174,8 +195,8 @@ Default.args = {
|
|
|
174
195
|
},
|
|
175
196
|
{
|
|
176
197
|
type: "source",
|
|
177
|
-
data: {extendedTooltip: "this is a source handle"}
|
|
178
|
-
}
|
|
198
|
+
data: { extendedTooltip: "this is a source handle" },
|
|
199
|
+
},
|
|
179
200
|
],
|
|
180
201
|
onNodeResize: false, // workaround that storybook do not automatically include empty handle function
|
|
181
202
|
};
|
|
@@ -183,5 +204,7 @@ Default.args = {
|
|
|
183
204
|
export const Resizeable = Template.bind({});
|
|
184
205
|
Resizeable.args = {
|
|
185
206
|
...Default.args,
|
|
186
|
-
onNodeResize: (dimensions) => {
|
|
187
|
-
}
|
|
207
|
+
onNodeResize: (dimensions) => {
|
|
208
|
+
console.log("onNodeResize", `new dimensions: ${dimensions.width}x${dimensions.height}`);
|
|
209
|
+
},
|
|
210
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Elements } from 'react-flow-renderer';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { Elements } from "react-flow-renderer";
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { ReactFlow } from "./../../../../cmem";
|
|
7
6
|
import { NodeContent } from "./../NodeContent";
|
|
8
|
-
import {
|
|
7
|
+
import { NodeDefault } from "./../NodeDefault";
|
|
9
8
|
import { Default as NodeContentExample } from "./NodeContent.stories";
|
|
9
|
+
import { nodeTypes } from "./nodeTypes";
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
|
-
title: "Extensions/React Flow/
|
|
12
|
+
title: "Extensions/React Flow/Node",
|
|
13
13
|
component: NodeDefault,
|
|
14
14
|
subcomponents: { NodeContent },
|
|
15
15
|
argTypes: {
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
type: { required: true },
|
|
22
22
|
description: "Position on React-Flow canvas.",
|
|
23
23
|
table: {
|
|
24
|
-
type: { summary: "XYPosition" }
|
|
24
|
+
type: { summary: "XYPosition" },
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
type: {
|
|
@@ -29,34 +29,34 @@ export default {
|
|
|
29
29
|
description: "Key of the imported and connected `nodeTypes` to specify what node implementation is used.",
|
|
30
30
|
table: {
|
|
31
31
|
type: { summary: "string" },
|
|
32
|
-
defaultValue: { summary: "default" }
|
|
32
|
+
defaultValue: { summary: "default" },
|
|
33
33
|
},
|
|
34
34
|
options: Object.keys(nodeTypes),
|
|
35
|
-
mapping: Object.fromEntries(Object.keys(nodeTypes).map(type => [type, type])),
|
|
35
|
+
mapping: Object.fromEntries(Object.keys(nodeTypes).map((type) => [type, type])),
|
|
36
36
|
},
|
|
37
37
|
style: {
|
|
38
38
|
control: "object",
|
|
39
39
|
description: "css properties",
|
|
40
40
|
table: {
|
|
41
|
-
type: { summary: "React.CSSProperties" }
|
|
41
|
+
type: { summary: "React.CSSProperties" },
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
className: {
|
|
45
45
|
control: "text",
|
|
46
|
-
description: "additional class name"
|
|
46
|
+
description: "additional class name",
|
|
47
47
|
},
|
|
48
48
|
targetPosition: {
|
|
49
49
|
description: "'left' | 'right' | 'top' | 'bottom' handle position",
|
|
50
50
|
table: {
|
|
51
51
|
type: { summary: "Position" },
|
|
52
|
-
defaultValue: { summary: "Position.Left" }
|
|
52
|
+
defaultValue: { summary: "Position.Left" },
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
sourcePosition: {
|
|
56
56
|
description: "'left' | 'right' | 'top' | 'bottom' handle position",
|
|
57
57
|
table: {
|
|
58
58
|
type: { summary: "Position" },
|
|
59
|
-
defaultValue: { summary: "Position.Right" }
|
|
59
|
+
defaultValue: { summary: "Position.Right" },
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
isHidden: {
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
description: "if true, the node will not be rendered",
|
|
65
65
|
table: {
|
|
66
66
|
type: { summary: "boolean" },
|
|
67
|
-
defaultValue: { summary: "false" }
|
|
67
|
+
defaultValue: { summary: "false" },
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
draggable: {
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
description: "if option is not set, the node is draggable (overwrites general nodesDraggable option)",
|
|
73
73
|
table: {
|
|
74
74
|
type: { summary: "boolean" },
|
|
75
|
-
defaultValue: { summary: "true" }
|
|
75
|
+
defaultValue: { summary: "true" },
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
connectable: {
|
|
@@ -80,7 +80,7 @@ export default {
|
|
|
80
80
|
description: "if option is not set, the node is connectable (overwrites general nodesConnectable option)",
|
|
81
81
|
table: {
|
|
82
82
|
type: { summary: "boolean" },
|
|
83
|
-
defaultValue: { summary: "true" }
|
|
83
|
+
defaultValue: { summary: "true" },
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
selectable: {
|
|
@@ -88,15 +88,15 @@ export default {
|
|
|
88
88
|
description: "if option is not set, the node is selectable (overwrites general elementsSelectable option)",
|
|
89
89
|
table: {
|
|
90
90
|
type: { summary: "boolean" },
|
|
91
|
-
defaultValue: { summary: "true" }
|
|
91
|
+
defaultValue: { summary: "true" },
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
dragHandle: {
|
|
95
95
|
control: "text",
|
|
96
|
-
description: "selector for specifying an element as a drag handle"
|
|
96
|
+
description: "selector for specifying an element as a drag handle",
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
|
-
} as
|
|
99
|
+
} as Meta<typeof NodeDefault>;
|
|
100
100
|
|
|
101
101
|
const NodeDefaultExample = (args: any) => {
|
|
102
102
|
const [reactflowInstance, setReactflowInstance] = useState(null);
|
|
@@ -104,9 +104,7 @@ const NodeDefaultExample = (args: any) => {
|
|
|
104
104
|
//const [edgeTools, setEdgeTools] = useState<JSX.Element>(<></>);
|
|
105
105
|
|
|
106
106
|
useEffect(() => {
|
|
107
|
-
setElements([
|
|
108
|
-
args
|
|
109
|
-
] as Elements);
|
|
107
|
+
setElements([args] as Elements);
|
|
110
108
|
}, [args]);
|
|
111
109
|
|
|
112
110
|
const onLoad = useCallback(
|
|
@@ -118,23 +116,23 @@ const NodeDefaultExample = (args: any) => {
|
|
|
118
116
|
[reactflowInstance]
|
|
119
117
|
);
|
|
120
118
|
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
return (
|
|
120
|
+
<ReactFlow
|
|
121
|
+
elements={elements}
|
|
122
|
+
style={{ height: "400px" }}
|
|
123
|
+
onLoad={onLoad}
|
|
124
|
+
nodeTypes={nodeTypes}
|
|
125
|
+
defaultZoom={1}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
129
|
|
|
130
|
-
const Template:
|
|
131
|
-
<NodeDefaultExample {...args} /*some comment*/ />
|
|
132
|
-
);
|
|
130
|
+
const Template: StoryFn<typeof NodeDefault> = (args) => <NodeDefaultExample {...args} /*some comment*/ />;
|
|
133
131
|
|
|
134
132
|
export const Default = Template.bind({});
|
|
135
133
|
Default.args = {
|
|
136
|
-
id:
|
|
137
|
-
type:
|
|
134
|
+
id: "1",
|
|
135
|
+
type: "default",
|
|
138
136
|
data: NodeContentExample.args,
|
|
139
137
|
position: { x: 50, y: 50 },
|
|
140
138
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { nodeTypes as nodeTypesGraph } from "./../../../../cmem/react-flow/configuration/graph";
|
|
2
|
+
import { nodeTypes as nodeTypesLinking } from "./../../../../cmem/react-flow/configuration/linking";
|
|
3
|
+
import { nodeTypes as nodeTypesUnspecified } from "./../../../../cmem/react-flow/configuration/unspecified";
|
|
4
|
+
import { nodeTypes as nodeTypesWorkflow } from "./../../../../cmem/react-flow/configuration/workflow";
|
|
5
|
+
|
|
6
|
+
export const nodeTypes = {
|
|
7
|
+
...nodeTypesUnspecified,
|
|
8
|
+
...nodeTypesWorkflow,
|
|
9
|
+
...nodeTypesLinking,
|
|
10
|
+
...nodeTypesGraph,
|
|
11
|
+
};
|