@eccenca/gui-elements 23.1.0-rc.2 → 23.1.0-rc.3
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 +54 -10
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js +6 -4
- package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js +33 -8
- package/dist/cjs/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/cjs/cmem/ConfidenceValue/ConfidenceValue.js +52 -0
- package/dist/cjs/cmem/ConfidenceValue/ConfidenceValue.js.map +1 -0
- package/dist/cjs/cmem/ConfidenceValue/index.js +14 -0
- package/dist/cjs/cmem/ConfidenceValue/index.js.map +1 -0
- package/dist/cjs/cmem/index.js +11 -0
- package/dist/cjs/cmem/index.js.map +1 -1
- package/dist/cjs/cmem/markdown/Markdown.js +8 -4
- package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
- package/dist/cjs/common/Intent/index.js +1 -0
- package/dist/cjs/common/Intent/index.js.map +1 -1
- package/dist/cjs/common/utils/CssCustomProperties.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +10 -1
- package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +8 -10
- package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/cjs/components/Card/Card.js +7 -6
- package/dist/cjs/components/Card/Card.js.map +1 -1
- package/dist/cjs/components/Card/CardContent.js +4 -2
- package/dist/cjs/components/Card/CardContent.js.map +1 -1
- package/dist/cjs/components/Card/CardHeader.js.map +1 -1
- package/dist/cjs/components/Depiction/Depiction.js +13 -13
- package/dist/cjs/components/Depiction/Depiction.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +6 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.js +24 -9
- package/dist/cjs/components/Pagination/Pagination.js.map +1 -1
- package/dist/cjs/components/ProgressBar/index.js +14 -0
- package/dist/cjs/components/ProgressBar/index.js.map +1 -0
- package/dist/cjs/components/Separation/Divider.js +20 -2
- package/dist/cjs/components/Separation/Divider.js.map +1 -1
- package/dist/cjs/components/Switch/Switch.js +2 -2
- package/dist/cjs/components/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/Table/Table.js +46 -0
- package/dist/cjs/components/Table/Table.js.map +1 -0
- package/dist/cjs/components/Table/TableCell.js +29 -0
- package/dist/cjs/components/Table/TableCell.js.map +1 -0
- package/dist/cjs/components/Table/TableContainer.js +32 -0
- package/dist/cjs/components/Table/TableContainer.js.map +1 -0
- package/dist/cjs/components/Table/TableExpandHeader.js +36 -0
- package/dist/cjs/components/Table/TableExpandHeader.js.map +1 -0
- package/dist/cjs/components/Table/TableExpandRow.js +45 -0
- package/dist/cjs/components/Table/TableExpandRow.js.map +1 -0
- package/dist/cjs/components/{SimpleTable/TableContainer.js → Table/TableRow.js} +9 -11
- package/dist/cjs/components/Table/TableRow.js.map +1 -0
- package/dist/cjs/components/Table/index.js +26 -0
- package/dist/cjs/components/Table/index.js.map +1 -0
- package/dist/cjs/components/Tag/TagList.js.map +1 -1
- package/dist/cjs/components/Tag/index.js +11 -0
- package/dist/cjs/components/Tag/index.js.map +1 -0
- package/dist/cjs/components/TextField/TextField.js +25 -9
- package/dist/cjs/components/TextField/TextField.js.map +1 -1
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js +20 -5
- package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +74 -0
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -0
- package/dist/cjs/extensions/react-flow/edges/edgeTypes.js +10 -9
- package/dist/cjs/extensions/react-flow/edges/edgeTypes.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js +14 -3
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/index.js +13 -3
- package/dist/cjs/extensions/react-flow/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +113 -33
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeDefault.js +5 -2
- package/dist/cjs/extensions/react-flow/nodes/NodeDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/versionsupport.js +20 -0
- package/dist/cjs/extensions/react-flow/versionsupport.js.map +1 -0
- package/dist/cjs/index.js +3 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js +6 -4
- package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js +35 -10
- package/dist/esm/cmem/ActivityControl/SilkActivityControl.js.map +1 -1
- package/dist/esm/cmem/ConfidenceValue/ConfidenceValue.js +56 -0
- package/dist/esm/cmem/ConfidenceValue/ConfidenceValue.js.map +1 -0
- package/dist/esm/cmem/ConfidenceValue/index.js +2 -0
- package/dist/esm/cmem/ConfidenceValue/index.js.map +1 -0
- package/dist/esm/cmem/index.js +1 -0
- package/dist/esm/cmem/index.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +8 -4
- package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
- package/dist/esm/common/Intent/index.js +1 -0
- package/dist/esm/common/Intent/index.js.map +1 -1
- package/dist/esm/common/utils/CssCustomProperties.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +10 -1
- package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +8 -10
- package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
- package/dist/esm/components/Card/Card.js +7 -6
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardContent.js +4 -2
- package/dist/esm/components/Card/CardContent.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Depiction/Depiction.js +15 -14
- package/dist/esm/components/Depiction/Depiction.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +6 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +25 -10
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/ProgressBar/index.js +2 -0
- package/dist/esm/components/ProgressBar/index.js.map +1 -0
- package/dist/esm/components/Separation/Divider.js +29 -3
- package/dist/esm/components/Separation/Divider.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +2 -2
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Table/Table.js +50 -0
- package/dist/esm/components/Table/Table.js.map +1 -0
- package/dist/esm/components/{SimpleTable/TableContainer.js → Table/TableCell.js} +8 -12
- package/dist/esm/components/Table/TableCell.js.map +1 -0
- package/dist/esm/components/Table/TableContainer.js +36 -0
- package/dist/esm/components/Table/TableContainer.js.map +1 -0
- package/dist/esm/components/Table/TableExpandHeader.js +40 -0
- package/dist/esm/components/Table/TableExpandHeader.js.map +1 -0
- package/dist/esm/components/Table/TableExpandRow.js +49 -0
- package/dist/esm/components/Table/TableExpandRow.js.map +1 -0
- package/dist/esm/components/Table/TableRow.js +33 -0
- package/dist/esm/components/Table/TableRow.js.map +1 -0
- package/dist/esm/components/Table/index.js +9 -0
- package/dist/esm/components/Table/index.js.map +1 -0
- package/dist/esm/components/Tag/TagList.js.map +1 -1
- package/dist/esm/components/Tag/index.js +4 -0
- package/dist/esm/components/Tag/index.js.map +1 -0
- package/dist/esm/components/TextField/TextField.js +26 -10
- package/dist/esm/components/TextField/TextField.js.map +1 -1
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeDefault.js +20 -4
- package/dist/esm/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +63 -0
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -0
- package/dist/esm/extensions/react-flow/edges/edgeTypes.js +10 -9
- package/dist/esm/extensions/react-flow/edges/edgeTypes.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js +15 -4
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/index.js +2 -1
- package/dist/esm/extensions/react-flow/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +121 -38
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeDefault.js +5 -2
- package/dist/esm/extensions/react-flow/nodes/NodeDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/versionsupport.js +32 -0
- package/dist/esm/extensions/react-flow/versionsupport.js.map +1 -0
- package/dist/esm/index.js +3 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +1 -1
- package/dist/types/cmem/ActivityControl/SilkActivityControl.d.ts +6 -2
- package/dist/types/cmem/ConfidenceValue/ConfidenceValue.d.ts +46 -0
- package/dist/types/cmem/ConfidenceValue/index.d.ts +1 -0
- package/dist/types/cmem/index.d.ts +1 -0
- package/dist/types/cmem/markdown/Markdown.d.ts +6 -1
- package/dist/types/common/Intent/index.d.ts +1 -1
- package/dist/types/common/utils/CssCustomProperties.d.ts +1 -1
- package/dist/types/components/Card/Card.d.ts +5 -1
- package/dist/types/components/Card/CardContent.d.ts +7 -1
- package/dist/types/components/Card/CardHeader.d.ts +9 -1
- package/dist/types/components/Grid/Grid.d.ts +1 -1
- package/dist/types/components/Grid/GridColumn.d.ts +1 -1
- package/dist/types/components/Grid/GridRow.d.ts +1 -1
- package/dist/types/components/Icon/IconButton.d.ts +1 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts +5 -1
- package/dist/types/components/ProgressBar/index.d.ts +1 -0
- package/dist/types/components/Separation/Divider.d.ts +18 -2
- package/dist/types/components/Separation/Spacing.d.ts +1 -1
- package/dist/types/components/Switch/Switch.d.ts +5 -1
- package/dist/types/components/Table/Table.d.ts +32 -0
- package/dist/types/components/Table/TableCell.d.ts +11 -0
- package/dist/types/components/Table/TableContainer.d.ts +13 -0
- package/dist/types/components/Table/TableExpandHeader.d.ts +13 -0
- package/dist/types/components/Table/TableExpandRow.d.ts +17 -0
- package/dist/types/components/Table/TableRow.d.ts +10 -0
- package/dist/types/components/Table/index.d.ts +7 -0
- package/dist/types/components/Tag/Tag.d.ts +1 -1
- package/dist/types/components/Tag/TagList.d.ts +5 -2
- package/dist/types/components/Tag/index.d.ts +4 -0
- package/dist/types/components/TextField/TextField.d.ts +9 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/extensions/react-flow/edges/EdgeDefault.d.ts +16 -1
- package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +44 -0
- package/dist/types/extensions/react-flow/edges/edgeTypes.d.ts +10 -9
- package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +11 -3
- package/dist/types/extensions/react-flow/index.d.ts +2 -2
- package/dist/types/extensions/react-flow/nodes/NodeContent.d.ts +55 -8
- package/dist/types/extensions/react-flow/nodes/NodeDefault.d.ts +2 -1
- package/dist/types/extensions/react-flow/versionsupport.d.ts +7 -0
- package/dist/types/index.d.ts +1 -6
- package/package.json +2 -1
- package/src/cmem/ActivityControl/ActivityControlWidget.tsx +5 -5
- package/src/cmem/ActivityControl/SilkActivityControl.tsx +44 -17
- package/src/cmem/ConfidenceValue/ConfidenceValue.stories.tsx +22 -0
- package/src/cmem/ConfidenceValue/ConfidenceValue.tsx +116 -0
- package/src/cmem/ConfidenceValue/confidencevalue.scss +49 -0
- package/src/cmem/ConfidenceValue/index.ts +1 -0
- package/src/cmem/_index.scss +1 -0
- package/src/cmem/index.ts +2 -0
- package/src/cmem/markdown/Markdown.stories.tsx +3 -1
- package/src/cmem/markdown/Markdown.tsx +22 -10
- package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +2 -2
- package/src/cmem/react-flow/_edges.scss +3 -2
- package/src/cmem/react-flow/configuration/_colors-workflow.scss +3 -0
- package/src/common/Intent/index.ts +2 -1
- package/src/common/utils/CssCustomProperties.ts +1 -1
- package/src/components/AutoSuggestion/AutoSuggestion.scss +1 -0
- package/src/components/AutoSuggestion/AutoSuggestion.tsx +10 -1
- package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +8 -10
- package/src/components/AutoSuggestion/tests/SingleLineCodeEditor.test.tsx +5 -0
- package/src/components/Badge/badge.scss +2 -5
- package/src/components/Card/Card.tsx +11 -5
- package/src/components/Card/CardContent.tsx +12 -1
- package/src/components/Card/CardHeader.tsx +9 -1
- package/src/components/Card/card.scss +108 -3
- package/src/components/Checkbox/checkbox.scss +6 -2
- package/src/components/Depiction/Depiction.tsx +11 -10
- package/src/components/Grid/Grid.tsx +1 -1
- package/src/components/Grid/GridColumn.tsx +1 -1
- package/src/components/Grid/GridRow.tsx +1 -1
- package/src/components/Icon/IconButton.tsx +1 -1
- package/src/components/Icon/canonicalIconNames.tsx +13 -0
- package/src/components/Menu/menu.scss +4 -0
- package/src/components/OverviewItem/overviewitem.scss +2 -2
- package/src/components/Pagination/Pagination.tsx +29 -9
- package/src/components/Pagination/pagination.scss +16 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/Separation/Divider.tsx +36 -2
- package/src/components/Separation/Spacing.tsx +1 -1
- package/src/components/Separation/Stories/Divider.stories.tsx +22 -0
- package/src/components/Separation/separation.scss +31 -5
- package/src/components/Switch/Switch.tsx +6 -2
- package/src/components/Table/Table.tsx +88 -0
- package/src/components/Table/TableCell.tsx +37 -0
- package/src/components/Table/TableContainer.tsx +49 -0
- package/src/components/Table/TableExpandHeader.tsx +51 -0
- package/src/components/Table/TableExpandRow.tsx +70 -0
- package/src/components/Table/TableRow.tsx +36 -0
- package/src/components/Table/index.tsx +14 -0
- package/src/components/Table/table.scss +323 -0
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/Tag/TagList.tsx +5 -3
- package/src/components/Tag/index.ts +5 -0
- package/src/components/Tag/{Tag.stories.tsx → stories/Tag.stories.tsx} +3 -2
- package/src/components/Tag/stories/TagList.stories.tsx +28 -0
- package/src/components/Tag/tag.scss +1 -0
- package/src/components/TextField/TextField.tsx +43 -12
- package/src/components/TextField/stories/TextField.stories.tsx +3 -0
- package/src/components/TextField/textfield.scss +23 -1
- package/src/components/Tree/tree.scss +4 -0
- package/src/components/Typography/typography.scss +2 -2
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +5 -0
- package/src/extensions/react-flow/_config.scss +8 -4
- package/src/extensions/react-flow/edges/EdgeDefault.tsx +60 -5
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +127 -0
- package/src/extensions/react-flow/edges/_edges.scss +214 -38
- package/src/extensions/react-flow/edges/edgeTypes.ts +13 -9
- package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +34 -13
- package/src/extensions/react-flow/edges/stories/EdgeLabel.stories.tsx +40 -0
- package/src/extensions/react-flow/handles/HandleDefault.tsx +41 -10
- package/src/extensions/react-flow/index.ts +3 -2
- package/src/extensions/react-flow/nodes/NodeContent.tsx +233 -60
- package/src/extensions/react-flow/nodes/NodeDefault.tsx +7 -2
- package/src/extensions/react-flow/nodes/_nodes.scss +232 -67
- package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +67 -1
- package/src/extensions/react-flow/versionsupport.ts +22 -0
- package/src/index.scss +0 -1
- package/src/index.ts +5 -38
- package/dist/cjs/components/SimpleTable/TableContainer.js.map +0 -1
- package/dist/cjs/components/SimpleTable/index.js +0 -16
- package/dist/cjs/components/SimpleTable/index.js.map +0 -1
- package/dist/esm/components/SimpleTable/TableContainer.js.map +0 -1
- package/dist/esm/components/SimpleTable/index.js +0 -4
- package/dist/esm/components/SimpleTable/index.js.map +0 -1
- package/dist/types/components/SimpleTable/TableContainer.d.ts +0 -3
- package/dist/types/components/SimpleTable/index.d.ts +0 -3
- package/src/components/SimpleTable/TableContainer.tsx +0 -20
- package/src/components/SimpleTable/index.tsx +0 -4
- package/src/components/SimpleTable/simpletable.scss +0 -180
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { loremIpsum } from 'react-lorem-ipsum';
|
|
4
|
+
import { EdgeLabel, IconButton, Badge, Icon } from "./../../../../../index";
|
|
5
|
+
import canonicalIcons from "./../../../../components/Icon/canonicalIconNames";
|
|
6
|
+
import { helpersArgTypes } from "../../../../../.storybook/helpers";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Extensions/React Flow/Custom EdgeLabel",
|
|
10
|
+
component: EdgeLabel,
|
|
11
|
+
argTypes: {
|
|
12
|
+
depiction: {
|
|
13
|
+
control: "select",
|
|
14
|
+
options: [...(Object.keys(canonicalIcons))],
|
|
15
|
+
},
|
|
16
|
+
actions: {
|
|
17
|
+
control: "select",
|
|
18
|
+
options: ["Not set", "Icon button", "Icon button small", "Info badge", "Icon badge"],
|
|
19
|
+
mapping: {
|
|
20
|
+
"Not set": undefined,
|
|
21
|
+
"Icon button": <IconButton name="item-info" text="Icon button" onClick={()=>alert("Click info")} />,
|
|
22
|
+
"Icon button small": <IconButton small name="item-info" text="Icon button" onClick={()=>alert("Click info")} />,
|
|
23
|
+
"Info badge": <Badge intent="info">Info</Badge>,
|
|
24
|
+
"Icon badge": <Badge intent="accent" size="small"><Icon name="undefined" small /></Badge>,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
intent: {
|
|
28
|
+
...helpersArgTypes.exampleIntent,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
} as ComponentMeta<typeof EdgeLabel>;
|
|
32
|
+
|
|
33
|
+
const Template: ComponentStory<typeof EdgeLabel> = (args) => (
|
|
34
|
+
<EdgeLabel {...args} />
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const Default = Template.bind({});
|
|
38
|
+
Default.args = {
|
|
39
|
+
text: loremIpsum({ p: 1, avgSentencesPerParagraph: 1, avgWordsPerSentence: 8, random: false }).toString(),
|
|
40
|
+
};
|
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
import React, {memo} from 'react';
|
|
2
2
|
import {
|
|
3
|
-
HandleProps as
|
|
4
|
-
Handle,
|
|
3
|
+
HandleProps as ReactFlowHandleLegacyProps,
|
|
4
|
+
Handle as HandleLegacy,
|
|
5
5
|
} from "react-flow-renderer";
|
|
6
|
+
import {
|
|
7
|
+
HandleProps as ReactFlowHandleNextProps,
|
|
8
|
+
Handle as HandleNext,
|
|
9
|
+
} from "react-flow-renderer-lts";
|
|
6
10
|
import { HandleContent, HandleContentProps } from "./HandleContent";
|
|
11
|
+
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
interface HandleExtensionProps extends ReacFlowVersionSupportProps {
|
|
9
14
|
data?: HandleContentProps;
|
|
10
15
|
tooltip?: string;
|
|
11
16
|
children?: JSX.Element | string;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface HandleProps extends HandleExtensionProps, ReactFlowHandleLegacyProps {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HandleNextProps extends HandleExtensionProps, ReactFlowHandleNextProps {
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
export const HandleDefault = memo(({
|
|
27
|
+
flowVersion,
|
|
15
28
|
data,
|
|
16
29
|
tooltip,
|
|
17
30
|
children,
|
|
18
31
|
...handleProps
|
|
19
|
-
}: HandleProps) => {
|
|
32
|
+
}: HandleProps | HandleNextProps) => {
|
|
33
|
+
const evaluateFlowVersion = useReactFlowVersion();
|
|
34
|
+
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
35
|
+
|
|
20
36
|
const tooltipTitle = !!tooltip ? { title: tooltip } : {};
|
|
21
37
|
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</HandleContent>
|
|
27
|
-
</Handle>
|
|
38
|
+
const handleContent = (
|
|
39
|
+
<HandleContent {...data}>
|
|
40
|
+
{ children }
|
|
41
|
+
</HandleContent>
|
|
28
42
|
);
|
|
43
|
+
|
|
44
|
+
switch (flowVersionCheck) {
|
|
45
|
+
case "legacy":
|
|
46
|
+
return (
|
|
47
|
+
<HandleLegacy {...handleProps} {...tooltipTitle}>
|
|
48
|
+
{ handleContent }
|
|
49
|
+
</HandleLegacy>
|
|
50
|
+
);
|
|
51
|
+
case "next":
|
|
52
|
+
return (
|
|
53
|
+
<HandleNext {...handleProps} {...tooltipTitle}>
|
|
54
|
+
{ handleContent }
|
|
55
|
+
</HandleNext>
|
|
56
|
+
);
|
|
57
|
+
default:
|
|
58
|
+
return <></>;
|
|
59
|
+
}
|
|
29
60
|
});
|
|
@@ -3,10 +3,10 @@ export { NodeContent } from "./nodes/NodeContent";
|
|
|
3
3
|
export { NodeContentExtension } from "./nodes/NodeContentExtension";
|
|
4
4
|
export { NodeTools } from "./nodes/NodeTools";
|
|
5
5
|
export { nodeTypes } from "./nodes/nodeTypes";
|
|
6
|
-
export { EdgeDefault } from "./edges/EdgeDefault";
|
|
7
6
|
export { EdgeStep } from "./edges/EdgeStep";
|
|
8
7
|
export { EdgeTools } from "./edges/EdgeTools";
|
|
9
8
|
export { edgeTypes } from "./edges/edgeTypes";
|
|
9
|
+
export * from "./edges/EdgeLabel";
|
|
10
10
|
export { MarkerArrowClosedInverse } from "./markers/MarkerArrowClosedInverse";
|
|
11
11
|
export { ReactFlowMarkers } from "./markers/ReactFlowMarkers";
|
|
12
12
|
export { MiniMap } from "./minimap/MiniMap";
|
|
@@ -17,6 +17,7 @@ export type { NodeProps } from "./nodes/NodeDefault";
|
|
|
17
17
|
export type { NodeContentProps } from "./nodes/NodeContent";
|
|
18
18
|
export type { NodeContentExtensionProps } from "./nodes/NodeContentExtension";
|
|
19
19
|
export type { NodeToolsProps } from "./nodes/NodeTools";
|
|
20
|
-
export type { EdgeDefaultProps } from "./edges/EdgeDefault";
|
|
21
20
|
export type { EdgeStepProps } from "./edges/EdgeStep";
|
|
22
21
|
export type { MiniMapProps } from "./minimap/MiniMap";
|
|
22
|
+
|
|
23
|
+
export * from "./edges/EdgeDefault";
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import Color from "color";
|
|
3
|
+
import { Position, useStoreState as getStoreStateFlowLegacy } from "react-flow-renderer";
|
|
4
|
+
import { useStore as getStoreStateFlowNext } from "react-flow-renderer-lts";
|
|
5
|
+
import { Icon, Depiction, OverflowText } from "../../../index";
|
|
4
6
|
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
5
7
|
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
6
|
-
import {
|
|
8
|
+
import { DepictionProps } from "../../../components/Depiction/Depiction";
|
|
9
|
+
import { IntentTypes, intentClassName } from "../../../common/Intent";
|
|
10
|
+
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
11
|
+
import { HandleDefault, HandleProps, HandleNextProps } from "./../handles/HandleDefault";
|
|
7
12
|
import { NodeProps } from "./NodeDefault";
|
|
8
13
|
import { NodeContentExtensionProps } from "./NodeContentExtension";
|
|
9
14
|
import { Resizable } from "re-resizable";
|
|
10
15
|
|
|
11
16
|
export type HighlightingState = "success" | "warning" | "danger" | "match" | "altmatch";
|
|
17
|
+
export type NodeHighlightColor = "default" | "alternate" | Color | string;
|
|
12
18
|
|
|
13
19
|
export interface IHandleProps extends HandleProps {
|
|
14
20
|
category?: "configuration";
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
interface NodeContentHandleNextProps extends HandleNextProps {
|
|
24
|
+
category?: "configuration";
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
export type NodeDimensions = {
|
|
18
28
|
width: number;
|
|
19
29
|
height: number;
|
|
@@ -26,13 +36,22 @@ interface NodeContentData<CONTENT_PROPS = any> {
|
|
|
26
36
|
*/
|
|
27
37
|
iconName?: ValidIconName;
|
|
28
38
|
/**
|
|
29
|
-
*
|
|
39
|
+
* Depiction element that should be displayed before the node label.
|
|
40
|
+
* As alternative a valid and accessible URL or `data-uri` for an image can be set, then the Depiction element is created automatically.
|
|
30
41
|
*/
|
|
31
|
-
depiction?: string
|
|
42
|
+
depiction?: string | React.ReactElement<DepictionProps>;
|
|
43
|
+
/**
|
|
44
|
+
* Any element that should be displayed as depiction before the node label.
|
|
45
|
+
*/
|
|
46
|
+
leftElement?: JSX.Element;
|
|
32
47
|
/**
|
|
33
48
|
* Label that is displayed in the node header.
|
|
34
49
|
*/
|
|
35
|
-
label: string;
|
|
50
|
+
label: string | JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Element that is displayed as subline under the label in the header.
|
|
53
|
+
*/
|
|
54
|
+
labelSubline?: JSX.Element;
|
|
36
55
|
/**
|
|
37
56
|
* Content element, displayed in the node body.
|
|
38
57
|
*/
|
|
@@ -48,7 +67,7 @@ interface NodeContentData<CONTENT_PROPS = any> {
|
|
|
48
67
|
}
|
|
49
68
|
|
|
50
69
|
export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
51
|
-
extends NodeContentData,
|
|
70
|
+
extends NodeContentData, ReacFlowVersionSupportProps,
|
|
52
71
|
React.HTMLAttributes<HTMLDivElement> {
|
|
53
72
|
/**
|
|
54
73
|
* Size of the node.
|
|
@@ -61,9 +80,35 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
|
61
80
|
*/
|
|
62
81
|
minimalShape?: "none" | "circular" | "rectangular";
|
|
63
82
|
/**
|
|
83
|
+
* Stretches the node to the full available width.
|
|
84
|
+
*/
|
|
85
|
+
fullWidth?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Increase the hight of the node header.
|
|
88
|
+
* Use this for example if you need more space for a label subline.
|
|
89
|
+
* Also the depiction is displayed larger.
|
|
90
|
+
*/
|
|
91
|
+
enlargeHeader?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated
|
|
64
94
|
* Set the type of used highlights to mark the node.
|
|
95
|
+
* Replaced by `intent` and `highlightColor` properties.
|
|
65
96
|
*/
|
|
66
97
|
highlightedState?: HighlightingState | HighlightingState[];
|
|
98
|
+
/**
|
|
99
|
+
* Defines how the borders of a node are displayed.
|
|
100
|
+
* Use this property to overwrite default styles.
|
|
101
|
+
* You can use this to visuaize different states or type without depending only on color.
|
|
102
|
+
*/
|
|
103
|
+
border?: "solid" | "double" | "dashed" | "dotted";
|
|
104
|
+
/**
|
|
105
|
+
* Feedback state of the node.
|
|
106
|
+
*/
|
|
107
|
+
intent?: IntentTypes;
|
|
108
|
+
/**
|
|
109
|
+
* Set the type of used highlights to mark the node.
|
|
110
|
+
*/
|
|
111
|
+
highlightColor?: NodeHighlightColor | [NodeHighlightColor, NodeHighlightColor];
|
|
67
112
|
/**
|
|
68
113
|
* Text used for tooltip used on icon and depiction.
|
|
69
114
|
*/
|
|
@@ -90,7 +135,7 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
|
90
135
|
* Array of property definition objects for `Handle` components that need to be created for the node.
|
|
91
136
|
* @see https://reactflow.dev/docs/api/handle/
|
|
92
137
|
*/
|
|
93
|
-
handles?: IHandleProps[];
|
|
138
|
+
handles?: IHandleProps[] | NodeContentHandleNextProps[];
|
|
94
139
|
/**
|
|
95
140
|
* Set the minimal number of handles on left or right side of the node to activate the recalculation of the minimal height of the node.
|
|
96
141
|
*/
|
|
@@ -153,14 +198,32 @@ export interface NodeContentProps<NODE_DATA, NODE_CONTENT_PROPS = any>
|
|
|
153
198
|
nodeDimensions?: NodeDimensions;
|
|
154
199
|
}
|
|
155
200
|
|
|
156
|
-
interface
|
|
201
|
+
interface MemoHandlerLegacyProps extends HandleProps {
|
|
202
|
+
posdirection: string;
|
|
203
|
+
style: {
|
|
204
|
+
[key: string]: string | undefined;
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface MemoHandlerNextProps extends HandleNextProps {
|
|
157
209
|
posdirection: string;
|
|
158
210
|
style: {
|
|
159
211
|
[key: string]: string | undefined;
|
|
160
212
|
};
|
|
161
213
|
}
|
|
162
214
|
|
|
163
|
-
|
|
215
|
+
type MemoHandlerProps = MemoHandlerLegacyProps | MemoHandlerNextProps;
|
|
216
|
+
|
|
217
|
+
const defaultHandles = (flowVersion: ReacFlowVersionSupportProps["flowVersion"]) => {
|
|
218
|
+
switch (flowVersion) {
|
|
219
|
+
case "legacy":
|
|
220
|
+
return [{ type: "target" }, { type: "source" }] as IHandleProps[];
|
|
221
|
+
case "next":
|
|
222
|
+
return [{ type: "target" }, { type: "source" }] as NodeContentHandleNextProps[];
|
|
223
|
+
default:
|
|
224
|
+
return [];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
164
227
|
|
|
165
228
|
const getDefaultMinimalTooltipData = (node: any) => {
|
|
166
229
|
return {
|
|
@@ -171,7 +234,7 @@ const getDefaultMinimalTooltipData = (node: any) => {
|
|
|
171
234
|
};
|
|
172
235
|
};
|
|
173
236
|
|
|
174
|
-
const addHandles = (handles: any, position: any, posDirection: any, isConnectable: any, nodeStyle: any) => {
|
|
237
|
+
const addHandles = (handles: any, position: any, posDirection: any, isConnectable: any, nodeStyle: any, flowVersion: any = "legacy") => {
|
|
175
238
|
return handles[position].map((handle: any, idx: any) => {
|
|
176
239
|
const { className, style = {}, category } = handle;
|
|
177
240
|
const styleAdditions: { [key: string]: string } = {
|
|
@@ -191,26 +254,18 @@ const addHandles = (handles: any, position: any, posDirection: any, isConnectabl
|
|
|
191
254
|
: className,
|
|
192
255
|
},
|
|
193
256
|
};
|
|
194
|
-
return <MemoHandler {...handleProperties} key={"handle" + idx} />;
|
|
257
|
+
return <MemoHandler flowVersion={flowVersion} {...handleProperties} key={"handle" + idx} />;
|
|
195
258
|
});
|
|
196
259
|
};
|
|
197
260
|
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<span>{imgEl}</span>
|
|
203
|
-
</Tooltip>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return imgEl;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const gethighlightedStateClasses = (state: any, baseClassName: any) => {
|
|
261
|
+
export const gethighlightedStateClasses = (
|
|
262
|
+
state: HighlightingState | HighlightingState[],
|
|
263
|
+
baseClassName: string
|
|
264
|
+
) => {
|
|
211
265
|
let hightlights = typeof state === "string" ? [state] : state;
|
|
212
|
-
|
|
213
|
-
|
|
266
|
+
return hightlights.map(
|
|
267
|
+
(item : HighlightingState) => `${baseClassName}--highlight-${item}`
|
|
268
|
+
).join(" ");
|
|
214
269
|
};
|
|
215
270
|
|
|
216
271
|
const MemoHandler = React.memo(
|
|
@@ -226,20 +281,28 @@ const MemoHandler = React.memo(
|
|
|
226
281
|
* This element cannot be used directly, all properties must be routed through the `data` property of an `elements` property item inside the `ReactFlow` container.
|
|
227
282
|
*/
|
|
228
283
|
export function NodeContent<CONTENT_PROPS = any>({
|
|
284
|
+
flowVersion,
|
|
229
285
|
iconName,
|
|
230
286
|
depiction,
|
|
287
|
+
leftElement,
|
|
231
288
|
typeLabel,
|
|
232
289
|
label,
|
|
290
|
+
labelSubline,
|
|
291
|
+
enlargeHeader,
|
|
292
|
+
fullWidth,
|
|
233
293
|
showExecutionButtons = true,
|
|
234
294
|
executionButtons,
|
|
235
295
|
menuButtons,
|
|
236
296
|
content,
|
|
237
297
|
contentExtension,
|
|
238
|
-
|
|
298
|
+
footerContent,
|
|
239
299
|
size = "small",
|
|
240
300
|
minimalShape = "circular",
|
|
241
301
|
highlightedState,
|
|
242
|
-
|
|
302
|
+
intent,
|
|
303
|
+
border,
|
|
304
|
+
highlightColor,
|
|
305
|
+
//handles = defaultHandles(),
|
|
243
306
|
adaptHeightForHandleMinCount,
|
|
244
307
|
adaptSizeIncrement = 15,
|
|
245
308
|
getMinimalTooltipData = getDefaultMinimalTooltipData,
|
|
@@ -257,18 +320,32 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
257
320
|
// businessData is just being ignored
|
|
258
321
|
businessData,
|
|
259
322
|
// other props for DOM element
|
|
260
|
-
...
|
|
323
|
+
...otherDomProps
|
|
261
324
|
}: NodeContentProps<any>) {
|
|
325
|
+
const evaluateFlowVersion = useReactFlowVersion();
|
|
326
|
+
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
327
|
+
|
|
328
|
+
const {
|
|
329
|
+
handles = defaultHandles(flowVersionCheck),
|
|
330
|
+
...otherProps
|
|
331
|
+
} = otherDomProps;
|
|
332
|
+
|
|
333
|
+
const isResizeable = (!!onNodeResize && minimalShape === "none");
|
|
262
334
|
const [width, setWidth] = React.useState<number>(nodeDimensions?.width ?? 0);
|
|
263
335
|
const [height, setHeight] = React.useState<number>(nodeDimensions?.height ?? 0);
|
|
264
|
-
|
|
336
|
+
let zoom = 1;
|
|
337
|
+
if (isResizeable) try {
|
|
338
|
+
[, , zoom] = flowVersionCheck === "legacy"
|
|
339
|
+
? getStoreStateFlowLegacy((state) => state.transform)
|
|
340
|
+
: getStoreStateFlowNext((state) => state.transform);
|
|
341
|
+
} catch {}
|
|
265
342
|
const [adjustedContentProps, setAdjustedContentProps] = React.useState<Partial<CONTENT_PROPS>>({});
|
|
266
343
|
const nodeContentRef = React.useRef<any>();
|
|
267
|
-
const handleStack
|
|
268
|
-
handleStack[Position.Top] = [] as IHandleProps[];
|
|
269
|
-
handleStack[Position.Right] = [] as IHandleProps[];
|
|
270
|
-
handleStack[Position.Bottom] = [] as IHandleProps[];
|
|
271
|
-
handleStack[Position.Left] = [] as IHandleProps[];
|
|
344
|
+
const handleStack = flowVersionCheck==="legacy" ? {} as { [key: string]: IHandleProps[] } : {} as { [key: string]: NodeContentHandleNextProps[] };
|
|
345
|
+
handleStack[Position.Top] = flowVersionCheck==="legacy" ? [] as IHandleProps[] : [] as NodeContentHandleNextProps[];
|
|
346
|
+
handleStack[Position.Right] = flowVersionCheck==="legacy" ? [] as IHandleProps[] : [] as NodeContentHandleNextProps[];
|
|
347
|
+
handleStack[Position.Bottom] = flowVersionCheck==="legacy" ? [] as IHandleProps[] : [] as NodeContentHandleNextProps[];
|
|
348
|
+
handleStack[Position.Left] = flowVersionCheck==="legacy" ? [] as IHandleProps[] : [] as NodeContentHandleNextProps[];
|
|
272
349
|
|
|
273
350
|
// initial dimension before resize
|
|
274
351
|
React.useEffect(() => {
|
|
@@ -322,17 +399,29 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
322
399
|
styleExpandDimensions["minHeight"] = Math.max(minHeightLeft, minHeightRight);
|
|
323
400
|
}
|
|
324
401
|
|
|
402
|
+
const {
|
|
403
|
+
highlightClassNameSuffix,
|
|
404
|
+
highlightCustomPropertySettings
|
|
405
|
+
} = evaluateHighlightColors("--node-highlight", highlightColor);
|
|
406
|
+
|
|
325
407
|
const resizableStyles = (!!onNodeResize === true && minimalShape === "none" && (width + height > 0)) ? { width, height } : {};
|
|
326
408
|
const nodeContent = (
|
|
327
409
|
<>
|
|
328
410
|
<section
|
|
329
411
|
ref={nodeContentRef}
|
|
330
412
|
{...otherProps}
|
|
331
|
-
style={{ ...style, ...styleExpandDimensions, ...resizableStyles }}
|
|
413
|
+
style={{ ...style, ...highlightCustomPropertySettings, ...styleExpandDimensions, ...resizableStyles }}
|
|
332
414
|
className={
|
|
333
415
|
`${eccgui}-graphviz__node` +
|
|
334
416
|
` ${eccgui}-graphviz__node--${size}` +
|
|
335
417
|
` ${eccgui}-graphviz__node--minimal-${minimalShape}` +
|
|
418
|
+
(fullWidth ? ` ${eccgui}-graphviz__node--fullwidth` : "") +
|
|
419
|
+
(border ? ` ${eccgui}-graphviz__node--border-${border}` : "") +
|
|
420
|
+
(intent ? ` ${intentClassName(intent)}` : "") +
|
|
421
|
+
(highlightClassNameSuffix.length > 0
|
|
422
|
+
? highlightClassNameSuffix.map(highlight => ` ${eccgui}-graphviz__node--highlight-${highlight}`).join("")
|
|
423
|
+
: ""
|
|
424
|
+
) +
|
|
336
425
|
(!!highlightedState
|
|
337
426
|
? " " + gethighlightedStateClasses(highlightedState, `${eccgui}-graphviz__node`)
|
|
338
427
|
: "") +
|
|
@@ -341,32 +430,66 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
341
430
|
(letPassWheelEvents === false ? ` nowheel` : "")
|
|
342
431
|
}
|
|
343
432
|
>
|
|
344
|
-
<header className={
|
|
345
|
-
{
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
433
|
+
<header className={
|
|
434
|
+
`${eccgui}-graphviz__node__header` +
|
|
435
|
+
((enlargeHeader && minimalShape==="none") ? ` ${eccgui}-graphviz__node__header--large` : "")
|
|
436
|
+
}>
|
|
437
|
+
{(!!iconName || !!depiction || !!leftElement) && (
|
|
438
|
+
<div className={`${eccgui}-graphviz__node__header-depiction`}>
|
|
439
|
+
{ leftElement }
|
|
440
|
+
{!!depiction && !leftElement && typeof depiction === "string" && (
|
|
441
|
+
<Depiction
|
|
442
|
+
image={<img src={depiction} alt="" />}
|
|
443
|
+
caption={minimalShape === "none" || selected ? typeLabel : undefined}
|
|
444
|
+
captionPosition="tooltip"
|
|
445
|
+
padding="tiny"
|
|
446
|
+
ratio="1:1"
|
|
447
|
+
resizing="contain"
|
|
448
|
+
forceInlineSvg
|
|
356
449
|
/>
|
|
357
450
|
)}
|
|
358
|
-
|
|
451
|
+
{!!depiction && !leftElement && typeof depiction !== "string" && (
|
|
452
|
+
React.cloneElement(depiction, {
|
|
453
|
+
caption: minimalShape === "none" || selected ? typeLabel : undefined,
|
|
454
|
+
captionPosition: "tooltip",
|
|
455
|
+
padding: "tiny",
|
|
456
|
+
ratio: "1:1",
|
|
457
|
+
resizing: "contain",
|
|
458
|
+
forceInlineSvg: true,
|
|
459
|
+
})
|
|
460
|
+
)}
|
|
461
|
+
{!!iconName && !leftElement && !depiction && (
|
|
462
|
+
<Depiction
|
|
463
|
+
image={<Icon name={iconName} />}
|
|
464
|
+
caption={minimalShape === "none" || selected ? typeLabel : undefined}
|
|
465
|
+
captionPosition="tooltip"
|
|
466
|
+
padding="tiny"
|
|
467
|
+
ratio="1:1"
|
|
468
|
+
resizing="contain"
|
|
469
|
+
forceInlineSvg
|
|
470
|
+
/>
|
|
471
|
+
)}
|
|
472
|
+
</div>
|
|
359
473
|
)}
|
|
360
|
-
<
|
|
361
|
-
{
|
|
362
|
-
|
|
474
|
+
<div className={`${eccgui}-graphviz__node__header-label`} title={typeof label==="string" ? label : undefined}>
|
|
475
|
+
{
|
|
476
|
+
typeof label === "string"
|
|
477
|
+
? <OverflowText className={`${eccgui}-graphviz__node__header-label__mainline`}>{label}</OverflowText>
|
|
478
|
+
: <div className={`${eccgui}-graphviz__node__header-label__mainline`}>{label}</div>
|
|
479
|
+
}
|
|
480
|
+
{!!labelSubline && (
|
|
481
|
+
<div className={`${eccgui}-graphviz__node__header-label__subline`}>
|
|
482
|
+
{ labelSubline }
|
|
483
|
+
</div>
|
|
484
|
+
)}
|
|
485
|
+
</div>
|
|
363
486
|
{(menuButtons || (showExecutionButtons && executionButtons)) && (
|
|
364
|
-
<
|
|
487
|
+
<div className={`${eccgui}-graphviz__node__header-menu`}>
|
|
365
488
|
{showExecutionButtons && typeof executionButtons === "function"
|
|
366
489
|
? executionButtons(adjustedContentProps, setAdjustedContentProps)
|
|
367
490
|
: null}
|
|
368
491
|
{menuButtons ?? null}
|
|
369
|
-
</
|
|
492
|
+
</div>
|
|
370
493
|
)}
|
|
371
494
|
</header>
|
|
372
495
|
{content && (
|
|
@@ -383,10 +506,10 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
383
506
|
</section>
|
|
384
507
|
{!!handles && (
|
|
385
508
|
<>
|
|
386
|
-
{addHandles(handleStack, Position.Top, "left", isConnectable, style)}
|
|
387
|
-
{addHandles(handleStack, Position.Right, "top", isConnectable, style)}
|
|
388
|
-
{addHandles(handleStack, Position.Bottom, "left", isConnectable, style)}
|
|
389
|
-
{addHandles(handleStack, Position.Left, "top", isConnectable, style)}
|
|
509
|
+
{addHandles(handleStack, Position.Top, "left", isConnectable, style, flowVersionCheck)}
|
|
510
|
+
{addHandles(handleStack, Position.Right, "top", isConnectable, style, flowVersionCheck)}
|
|
511
|
+
{addHandles(handleStack, Position.Bottom, "left", isConnectable, style, flowVersionCheck)}
|
|
512
|
+
{addHandles(handleStack, Position.Left, "top", isConnectable, style, flowVersionCheck)}
|
|
390
513
|
</>
|
|
391
514
|
)}
|
|
392
515
|
</>
|
|
@@ -419,5 +542,55 @@ export function NodeContent<CONTENT_PROPS = any>({
|
|
|
419
542
|
</Resizable>
|
|
420
543
|
);
|
|
421
544
|
|
|
422
|
-
return (
|
|
545
|
+
return (isResizeable) ? resizableNode() : nodeContent;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export const evaluateHighlightColors = (
|
|
549
|
+
baseCustomProperty: string,
|
|
550
|
+
highlightColor?: NodeHighlightColor | NodeHighlightColor[]
|
|
551
|
+
) => {
|
|
552
|
+
let styleHighlightColors = {
|
|
553
|
+
[`${baseCustomProperty}-default-color`]: undefined,
|
|
554
|
+
[`${baseCustomProperty}-alternate-color`]: undefined,
|
|
555
|
+
} as React.CSSProperties;
|
|
556
|
+
const classesHightlightColors = [] as string[];
|
|
557
|
+
if (!!highlightColor) {
|
|
558
|
+
const highlightingColors = (typeof highlightColor === "string") ? [highlightColor] : highlightColor;
|
|
559
|
+
(highlightingColors as Array<string>).map((color, idx) => {
|
|
560
|
+
switch (color) {
|
|
561
|
+
case "default":
|
|
562
|
+
classesHightlightColors.push("default");
|
|
563
|
+
break;
|
|
564
|
+
case "alternate":
|
|
565
|
+
classesHightlightColors.push("alternate");
|
|
566
|
+
break;
|
|
567
|
+
default:
|
|
568
|
+
classesHightlightColors.push("custom");
|
|
569
|
+
let customColor = Color("#ffffff")
|
|
570
|
+
try {
|
|
571
|
+
customColor = Color(color);
|
|
572
|
+
} catch(ex) {
|
|
573
|
+
console.warn("Received invalid color for highlight: " + color)
|
|
574
|
+
}
|
|
575
|
+
if (idx === 0) {
|
|
576
|
+
styleHighlightColors = {
|
|
577
|
+
...styleHighlightColors,
|
|
578
|
+
[`${baseCustomProperty}-default-color`]: customColor.rgb().toString(),
|
|
579
|
+
} as React.CSSProperties
|
|
580
|
+
} else {
|
|
581
|
+
styleHighlightColors = {
|
|
582
|
+
...styleHighlightColors,
|
|
583
|
+
[`${baseCustomProperty}-alternate-color`]: customColor.rgb().toString(),
|
|
584
|
+
} as React.CSSProperties
|
|
585
|
+
}
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
return color;
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return {
|
|
593
|
+
highlightClassNameSuffix: classesHightlightColors,
|
|
594
|
+
highlightCustomPropertySettings: styleHighlightColors,
|
|
595
|
+
}
|
|
423
596
|
}
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
} from "react-flow-renderer";
|
|
6
6
|
import { Tooltip } from "../../../index";
|
|
7
7
|
import { NodeContent, NodeContentProps } from "./NodeContent";
|
|
8
|
+
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
8
9
|
|
|
9
|
-
export interface NodeProps<NODE_DATA, NODE_CONTENT_PROPS = any> extends ReactFlowNodeProps {
|
|
10
|
+
export interface NodeProps<NODE_DATA, NODE_CONTENT_PROPS = any> extends ReacFlowVersionSupportProps, ReactFlowNodeProps {
|
|
10
11
|
/**
|
|
11
12
|
* Contains all properties for our implementation of the React-Flow node.
|
|
12
13
|
* For details pls see the `NodeContent` element documentation.
|
|
@@ -22,14 +23,18 @@ export interface NodeProps<NODE_DATA, NODE_CONTENT_PROPS = any> extends ReactFlo
|
|
|
22
23
|
export const NodeDefault = memo(
|
|
23
24
|
(node: NodeProps<any>) => {
|
|
24
25
|
const {
|
|
26
|
+
flowVersion,
|
|
25
27
|
data,
|
|
26
28
|
targetPosition = Position.Left,
|
|
27
29
|
sourcePosition = Position.Right,
|
|
28
30
|
isConnectable = true,
|
|
29
31
|
selected
|
|
30
32
|
} = node;
|
|
33
|
+
|
|
34
|
+
const evaluateFlowVersion = useReactFlowVersion();
|
|
35
|
+
const flowVersionCheck = flowVersion || evaluateFlowVersion;
|
|
31
36
|
|
|
32
|
-
const nodeEl = <NodeContent {...{...data, targetPosition, sourcePosition, isConnectable, selected}} />
|
|
37
|
+
const nodeEl = <NodeContent {...{flowVersion: flowVersionCheck, ...data, targetPosition, sourcePosition, isConnectable, selected}} />
|
|
33
38
|
|
|
34
39
|
if (!selected && data?.minimalShape !== "none" && !!data?.getMinimalTooltipData) {
|
|
35
40
|
const tooltipData = data?.getMinimalTooltipData(node);
|