@eccenca/gui-elements 23.1.0-rc.3 → 23.1.0
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 +4 -4
- package/dist/cjs/components/Badge/Badge.js +1 -0
- package/dist/cjs/components/Badge/Badge.js.map +1 -1
- package/dist/cjs/components/Button/Button.js +32 -2
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/Icon/BaseIcon.js +4 -2
- package/dist/cjs/components/Icon/BaseIcon.js.map +1 -1
- package/dist/cjs/components/Icon/canonicalIconNames.js +8 -0
- package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js +18 -10
- package/dist/cjs/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/cjs/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/cjs/extensions/react-flow/index.js +1 -0
- package/dist/cjs/extensions/react-flow/index.js.map +1 -1
- package/dist/cjs/extensions/react-flow/minimap/utils.js +4 -2
- package/dist/cjs/extensions/react-flow/minimap/utils.js.map +1 -1
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js +5 -2
- package/dist/cjs/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js +1 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Button/Button.js +33 -2
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Icon/BaseIcon.js +4 -2
- package/dist/esm/components/Icon/BaseIcon.js.map +1 -1
- package/dist/esm/components/Icon/canonicalIconNames.js +8 -0
- package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js +19 -11
- package/dist/esm/extensions/react-flow/edges/EdgeLabel.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleContent.js.map +1 -1
- package/dist/esm/extensions/react-flow/handles/HandleDefault.js.map +1 -1
- package/dist/esm/extensions/react-flow/index.js +1 -0
- package/dist/esm/extensions/react-flow/index.js.map +1 -1
- package/dist/esm/extensions/react-flow/minimap/utils.js +4 -2
- package/dist/esm/extensions/react-flow/minimap/utils.js.map +1 -1
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js +5 -2
- package/dist/esm/extensions/react-flow/nodes/NodeContent.js.map +1 -1
- package/dist/types/components/Badge/Badge.d.ts +1 -0
- package/dist/types/components/Button/Button.d.ts +12 -1
- package/dist/types/components/Icon/BaseIcon.d.ts +1 -1
- package/dist/types/components/Icon/canonicalIconNames.d.ts +1 -1
- package/dist/types/components/interfaces.d.ts +3 -0
- package/dist/types/extensions/react-flow/edges/EdgeLabel.d.ts +6 -1
- package/dist/types/extensions/react-flow/handles/HandleContent.d.ts +3 -0
- package/dist/types/extensions/react-flow/handles/HandleDefault.d.ts +6 -0
- package/dist/types/extensions/react-flow/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Badge/Badge.tsx +2 -0
- package/src/components/Button/Button.stories.tsx +3 -2
- package/src/components/Button/Button.tsx +54 -0
- package/src/components/Button/button.scss +2 -0
- package/src/components/Icon/BaseIcon.tsx +3 -0
- package/src/components/Icon/canonicalIconNames.tsx +16 -0
- package/src/components/Icon/icon.scss +21 -0
- package/src/components/PropertyValuePair/propertyvalue.scss +4 -0
- package/src/components/Table/table.scss +2 -1
- package/src/components/interfaces.ts +3 -0
- package/src/extensions/react-flow/edges/EdgeLabel.tsx +22 -10
- package/src/extensions/react-flow/handles/HandleContent.tsx +3 -0
- package/src/extensions/react-flow/handles/HandleDefault.tsx +6 -0
- package/src/extensions/react-flow/handles/stories/HandleDefault.stories.tsx +71 -0
- package/src/extensions/react-flow/index.ts +1 -0
- package/src/extensions/react-flow/minimap/_minimap.scss +20 -4
- package/src/extensions/react-flow/minimap/utils.ts +3 -1
- package/src/extensions/react-flow/nodes/NodeContent.tsx +6 -2
- package/src/extensions/react-flow/nodes/_nodes.scss +4 -4
|
@@ -179,7 +179,8 @@ $eccgui-color-tablerow-border: $pt-divider-black !default;
|
|
|
179
179
|
.#{$prefix}--data-table--zebra > tbody > tr[data-parent-row]:nth-child(4n+3),
|
|
180
180
|
.#{$prefix}--data-table--zebra > tbody > tr[data-child-row]:nth-child(4n+4),
|
|
181
181
|
.#{$prefix}--data-table > tbody > tr.#{eccgui}-simpletable__row--zebra,
|
|
182
|
-
|
|
182
|
+
.#{$prefix}--data-table > tbody > tr.#{eccgui}-simpletable__row--zebra + tr[data-child-row],
|
|
183
|
+
.#{$prefix}--data-table--zebra > tbody > tr:not([data-parent-row]):not([data-child-row]):nth-child(2n+0) {
|
|
183
184
|
// even rows
|
|
184
185
|
|
|
185
186
|
&.#{$prefix}--expandable-row:not([data-child-row]) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo
|
|
1
|
+
import React, { memo } from "react";
|
|
2
2
|
import { Icon, Depiction, DepictionProps, OverflowText } from "../../../index";
|
|
3
3
|
import { CLASSPREFIX as eccgui } from "../../../configuration/constants";
|
|
4
4
|
import { ValidIconName } from "../../../components/Icon/canonicalIconNames";
|
|
@@ -91,30 +91,42 @@ interface EdgeLabelObjectProps extends React.SVGAttributes<SVGForeignObjectEleme
|
|
|
91
91
|
* Property from the `renderLabel` callback method.
|
|
92
92
|
*/
|
|
93
93
|
edgeCenter: [number, number, number, number];
|
|
94
|
+
/**
|
|
95
|
+
* Number of milliseconds.
|
|
96
|
+
* If set and larger then zero then the re-sizing process is repeated after this time.
|
|
97
|
+
*/
|
|
98
|
+
resizeTimeout?: number;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
export const EdgeLabelObject = memo(({
|
|
97
102
|
children,
|
|
98
103
|
edgeCenter,
|
|
104
|
+
resizeTimeout = -1,
|
|
99
105
|
...otherForeignObjectProps
|
|
100
106
|
} : EdgeLabelObjectProps) => {
|
|
101
|
-
const
|
|
107
|
+
const containerCallback = React.useCallback((containerRef) => {
|
|
108
|
+
if (containerRef) labelSize(containerRef);
|
|
109
|
+
}, [edgeCenter]);
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
const labelElement =
|
|
111
|
+
const labelSize = (container: SVGForeignObjectElement) => {
|
|
112
|
+
const labelElement = container.getElementsByClassName(`${eccgui}-graphviz__edge-label`);
|
|
105
113
|
if (labelElement.length > 0) {
|
|
106
114
|
const width = (labelElement[0] as HTMLElement).offsetWidth;
|
|
107
115
|
const height = (labelElement[0] as HTMLElement).offsetHeight;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
container.setAttribute("x", (edgeCenter[0] - width/2).toString());
|
|
117
|
+
container.setAttribute("y", (edgeCenter[1] - height/2).toString());
|
|
118
|
+
container.setAttribute("width", width.toString());
|
|
119
|
+
container.setAttribute("height", height.toString());
|
|
120
|
+
} else if (resizeTimeout > 0){
|
|
121
|
+
// Content is not ready yet, recall resizing process after timeout.
|
|
122
|
+
// This can happen in case the children is actually not a `EdgeLabel`.
|
|
123
|
+
setTimeout(() => { labelSize(container)}, resizeTimeout);
|
|
112
124
|
}
|
|
113
|
-
}
|
|
125
|
+
}
|
|
114
126
|
|
|
115
127
|
return (
|
|
116
128
|
<foreignObject
|
|
117
|
-
ref={
|
|
129
|
+
ref={containerCallback}
|
|
118
130
|
className={`${eccgui}-graphviz__edge-labelobject`}
|
|
119
131
|
width="1"
|
|
120
132
|
height="1"
|
|
@@ -11,7 +11,13 @@ import { HandleContent, HandleContentProps } from "./HandleContent";
|
|
|
11
11
|
import { ReacFlowVersionSupportProps, useReactFlowVersion } from "../versionsupport";
|
|
12
12
|
|
|
13
13
|
interface HandleExtensionProps extends ReacFlowVersionSupportProps {
|
|
14
|
+
/**
|
|
15
|
+
* Extended handle data.
|
|
16
|
+
*/
|
|
14
17
|
data?: HandleContentProps;
|
|
18
|
+
/**
|
|
19
|
+
* Simple text tooltip displayed as title on hover.
|
|
20
|
+
*/
|
|
15
21
|
tooltip?: string;
|
|
16
22
|
children?: JSX.Element | string;
|
|
17
23
|
onClick?: () => void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { ReactFlow, HandleDefault, HandleProps } from "./../../../../../index";
|
|
4
|
+
import { Elements, ReactFlowProvider } from 'react-flow-renderer';
|
|
5
|
+
import { edgeTypes } from "./../../edges/edgeTypes";
|
|
6
|
+
|
|
7
|
+
const HandleDefaultDataProps = (data: HandleProps["data"]) => {
|
|
8
|
+
// this is only a mock to get it as sub element in the table
|
|
9
|
+
return <>{data.extendedTooltip}</>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: "Extensions/React Flow/Default Handle",
|
|
14
|
+
component: HandleDefault,
|
|
15
|
+
subcomponents: { HandleDefaultDataProps },
|
|
16
|
+
argTypes: {
|
|
17
|
+
},
|
|
18
|
+
} as ComponentMeta<typeof HandleDefault>;
|
|
19
|
+
|
|
20
|
+
const HandleDefaultExample = (args: any) => {
|
|
21
|
+
const [reactflowInstance, setReactflowInstance] = useState(null);
|
|
22
|
+
const [elements, setElements] = useState([] as Elements);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setElements([
|
|
26
|
+
{
|
|
27
|
+
id: "node-1",
|
|
28
|
+
type: "default",
|
|
29
|
+
data: {
|
|
30
|
+
label: "Default ",
|
|
31
|
+
content: "Example content.",
|
|
32
|
+
minimalShape: "none",
|
|
33
|
+
handles: [
|
|
34
|
+
{ ...args }
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
position: { x: 50, y: 200 },
|
|
38
|
+
},
|
|
39
|
+
] as Elements);
|
|
40
|
+
}, [args]);
|
|
41
|
+
|
|
42
|
+
const onLoad = useCallback(
|
|
43
|
+
(rfi) => {
|
|
44
|
+
if (!reactflowInstance) {
|
|
45
|
+
setReactflowInstance(rfi);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[reactflowInstance]
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return <ReactFlowProvider>
|
|
52
|
+
<ReactFlow
|
|
53
|
+
elements={elements}
|
|
54
|
+
style={{ height: '400px' }}
|
|
55
|
+
onLoad={onLoad}
|
|
56
|
+
edgeTypes={ edgeTypes }
|
|
57
|
+
defaultZoom={1}
|
|
58
|
+
/>
|
|
59
|
+
</ReactFlowProvider>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const Template: ComponentStory<typeof HandleDefault> = (args) => (
|
|
63
|
+
<HandleDefaultExample {...args} />
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export const Default = Template.bind({});
|
|
67
|
+
Default.args = {
|
|
68
|
+
type: "target",
|
|
69
|
+
tooltip: "this is a target handle",
|
|
70
|
+
isConnectable: false,
|
|
71
|
+
};
|
|
@@ -10,25 +10,41 @@
|
|
|
10
10
|
.#{$eccgui}-graphviz__minimap__node--highlight-match {
|
|
11
11
|
stroke: $eccgui-color-accent;
|
|
12
12
|
stroke-width: 5;
|
|
13
|
-
//fill: $reactflow-node-background-color;
|
|
14
13
|
}
|
|
15
14
|
.#{$eccgui}-graphviz__minimap__node--highlight-altmatch {
|
|
16
15
|
stroke: complement($eccgui-color-primary);
|
|
17
16
|
stroke-width: 5;
|
|
18
|
-
//fill: $reactflow-node-background-color;
|
|
19
17
|
}
|
|
20
18
|
.#{$eccgui}-graphviz__minimap__node--highlight-success {
|
|
21
19
|
stroke: $eccgui-color-success-text;
|
|
22
20
|
stroke-width: 5;
|
|
23
|
-
//fill: $reactflow-node-background-color;
|
|
24
21
|
}
|
|
25
22
|
.#{$eccgui}-graphviz__minimap__node--highlight-warning {
|
|
26
23
|
stroke: $eccgui-color-warning-text;
|
|
27
24
|
stroke-width: 7;
|
|
28
|
-
//fill: $reactflow-node-background-color;
|
|
29
25
|
}
|
|
30
26
|
.#{$eccgui}-graphviz__minimap__node--highlight-danger {
|
|
31
27
|
fill: $eccgui-color-danger-text;
|
|
32
28
|
stroke: $eccgui-color-danger-text;
|
|
33
29
|
stroke-width: 9;
|
|
34
30
|
}
|
|
31
|
+
|
|
32
|
+
.react-flow__minimap-node {
|
|
33
|
+
|
|
34
|
+
// FIXME: this is a first basic implementation, later it should be possible to highlight without overwriting stroke/fill colors
|
|
35
|
+
|
|
36
|
+
&[class*="#{$eccgui}-intent--"] {
|
|
37
|
+
stroke-width: 20;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.#{$eccgui}-intent--success {
|
|
41
|
+
stroke: $eccgui-color-success-text;
|
|
42
|
+
}
|
|
43
|
+
&.#{$eccgui}-intent--warning {
|
|
44
|
+
stroke: $eccgui-color-warning-text;
|
|
45
|
+
}
|
|
46
|
+
&.#{$eccgui}-intent--danger {
|
|
47
|
+
stroke: $eccgui-color-danger-text;
|
|
48
|
+
fill: $eccgui-color-danger-text !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CLASSPREFIX as eccgui } from "./../../../configuration/constants";
|
|
2
2
|
import { gethighlightedStateClasses } from "./../nodes/NodeContent";
|
|
3
|
+
import { intentClassName } from "../../../common/Intent";
|
|
3
4
|
|
|
4
5
|
export const minimapNodeClassName = (node: any) => {
|
|
5
6
|
const typeClass = `${eccgui}-graphviz__minimap__node--` + node.type;
|
|
6
7
|
const stateClass = node.data?.highlightedState ? gethighlightedStateClasses(node.data.highlightedState, `${eccgui}-graphviz__minimap__node`) : "";
|
|
7
|
-
|
|
8
|
+
const intentClass = node.data?.intent ? intentClassName(node.data.intent) : "";
|
|
9
|
+
return `${typeClass} ${intentClass} ${stateClass}`;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
export const minimapNodeColor = (node: any) => {
|
|
@@ -271,8 +271,12 @@ export const gethighlightedStateClasses = (
|
|
|
271
271
|
const MemoHandler = React.memo(
|
|
272
272
|
(props: MemoHandlerProps) => <HandleDefault {...props} />,
|
|
273
273
|
(prev, next) => {
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
return (
|
|
275
|
+
// we only test a few properties to control re-rendering
|
|
276
|
+
// need to be extended if also other properties need to be changed late
|
|
277
|
+
prev.style[prev.posdirection] === next.style[next.posdirection]
|
|
278
|
+
&& prev.isConnectable === next.isConnectable
|
|
279
|
+
)
|
|
276
280
|
}
|
|
277
281
|
);
|
|
278
282
|
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
bottom: -2 * $reactflow-node-border-width;
|
|
502
502
|
right: -2 * $reactflow-node-border-width;
|
|
503
503
|
border-radius: inherit;
|
|
504
|
-
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-danger-text;
|
|
504
|
+
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-danger-text !important;
|
|
505
505
|
z-index: -1;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
@@ -535,18 +535,18 @@
|
|
|
535
535
|
|
|
536
536
|
.#{$eccgui}-graphviz__node--highlight-success {
|
|
537
537
|
&:before {
|
|
538
|
-
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-success-text;
|
|
538
|
+
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-success-text !important;
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
.#{$eccgui}-graphviz__node--highlight-warning {
|
|
543
543
|
&:before {
|
|
544
|
-
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-warning-text;
|
|
544
|
+
box-shadow: 0 0 0 2 * $reactflow-node-border-width $eccgui-color-warning-text !important;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
|
|
548
548
|
.#{$eccgui}-graphviz__node--highlight-altmatch {
|
|
549
549
|
&:after {
|
|
550
|
-
box-shadow: 0 0 0 2 * $reactflow-node-border-width complement($eccgui-color-primary);
|
|
550
|
+
box-shadow: 0 0 0 2 * $reactflow-node-border-width complement($eccgui-color-primary) !important;
|
|
551
551
|
}
|
|
552
552
|
}
|