@canmingir/link 1.2.58 → 1.2.60
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/package.json
CHANGED
package/src/config/schemas.js
CHANGED
|
@@ -2,7 +2,7 @@ import Joi from "joi";
|
|
|
2
2
|
|
|
3
3
|
export const ConfigSchema = Joi.object({
|
|
4
4
|
appId: Joi.string().uuid().required(),
|
|
5
|
-
name: Joi.string().
|
|
5
|
+
name: Joi.string().optional().default(""),
|
|
6
6
|
beta: Joi.boolean().optional(),
|
|
7
7
|
base: Joi.string().required(),
|
|
8
8
|
api: Joi.string().uri().required(),
|
|
@@ -73,7 +73,7 @@ export default function NavVertical({ openNav, onCloseNav }) {
|
|
|
73
73
|
mt: 3,
|
|
74
74
|
}}
|
|
75
75
|
>
|
|
76
|
-
<Logo sx={{ ml: 4, mb: 1 }} />
|
|
76
|
+
<Logo maxSize={name ? 100 : 200} sx={{ ml: 4, mb: 1 }} />
|
|
77
77
|
<Link to="/" style={{ textDecoration: "none", color: "white" }}>
|
|
78
78
|
<Typography
|
|
79
79
|
sx={{
|
|
@@ -105,7 +105,7 @@ export default function NavVertical({ openNav, onCloseNav }) {
|
|
|
105
105
|
mt: 3,
|
|
106
106
|
}}
|
|
107
107
|
>
|
|
108
|
-
<Logo sx={{ ml: 4 }} />
|
|
108
|
+
<Logo maxSize={name ? 100 : 150} sx={{ ml: name ? 4 : -10 }} />
|
|
109
109
|
<Typography
|
|
110
110
|
sx={{
|
|
111
111
|
ml: 2,
|
|
@@ -26,6 +26,8 @@ const DynamicConnector = ({
|
|
|
26
26
|
labelPosition = 0.5,
|
|
27
27
|
labelOffsetX = 0,
|
|
28
28
|
labelOffsetY = -10,
|
|
29
|
+
startGap = 8,
|
|
30
|
+
endGap = 10,
|
|
29
31
|
}) => {
|
|
30
32
|
const uniqueId = useId();
|
|
31
33
|
const [dims, setDims] = useState(null);
|
|
@@ -53,32 +55,38 @@ const DynamicConnector = ({
|
|
|
53
55
|
let parentPoint;
|
|
54
56
|
let childPoints = [];
|
|
55
57
|
|
|
58
|
+
const headRoom = showArrow ? arrowSize * strokeWidth * 0.5 : 0;
|
|
59
|
+
const tailInset = startGap;
|
|
60
|
+
const headInset = endGap + headRoom;
|
|
61
|
+
|
|
56
62
|
if (isHorizontal) {
|
|
57
63
|
parentPoint = {
|
|
58
|
-
x: (pRect.right - cRect.left) / scaleX,
|
|
64
|
+
x: (pRect.right - cRect.left) / scaleX + tailInset,
|
|
59
65
|
y: (pRect.top + pRect.height / 2 - cRect.top) / scaleY,
|
|
60
66
|
};
|
|
61
67
|
|
|
62
68
|
childPoints = childEls.map((el) => {
|
|
63
69
|
if (!el) return { x: parentPoint.x + 100, y: parentPoint.y };
|
|
64
70
|
const r = el.getBoundingClientRect();
|
|
71
|
+
const x = (r.left - cRect.left) / scaleX - headInset;
|
|
65
72
|
return {
|
|
66
|
-
x: (
|
|
73
|
+
x: Math.max(x, parentPoint.x),
|
|
67
74
|
y: (r.top + r.height / 2 - cRect.top) / scaleY,
|
|
68
75
|
};
|
|
69
76
|
});
|
|
70
77
|
} else {
|
|
71
78
|
parentPoint = {
|
|
72
79
|
x: (pRect.left + pRect.width / 2 - cRect.left) / scaleX,
|
|
73
|
-
y: (pRect.bottom - cRect.top) / scaleY,
|
|
80
|
+
y: (pRect.bottom - cRect.top) / scaleY + tailInset,
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
childPoints = childEls.map((el) => {
|
|
77
84
|
if (!el) return { x: parentPoint.x, y: parentPoint.y + 100 };
|
|
78
85
|
const r = el.getBoundingClientRect();
|
|
86
|
+
const y = (r.top - cRect.top) / scaleY - headInset;
|
|
79
87
|
return {
|
|
80
88
|
x: (r.left + r.width / 2 - cRect.left) / scaleX,
|
|
81
|
-
y: (
|
|
89
|
+
y: Math.max(y, parentPoint.y),
|
|
82
90
|
};
|
|
83
91
|
});
|
|
84
92
|
}
|
|
@@ -95,7 +103,18 @@ const DynamicConnector = ({
|
|
|
95
103
|
childEls.forEach((el) => el && ro.observe(el));
|
|
96
104
|
|
|
97
105
|
return () => ro.disconnect();
|
|
98
|
-
}, [
|
|
106
|
+
}, [
|
|
107
|
+
containerEl,
|
|
108
|
+
parentEl,
|
|
109
|
+
childEls,
|
|
110
|
+
tick,
|
|
111
|
+
isHorizontal,
|
|
112
|
+
showArrow,
|
|
113
|
+
arrowSize,
|
|
114
|
+
strokeWidth,
|
|
115
|
+
startGap,
|
|
116
|
+
endGap,
|
|
117
|
+
]);
|
|
99
118
|
|
|
100
119
|
const ids = useMemo(
|
|
101
120
|
() => ({
|
|
@@ -189,15 +208,18 @@ const DynamicConnector = ({
|
|
|
189
208
|
<marker
|
|
190
209
|
id={ids.arrow}
|
|
191
210
|
viewBox="0 0 10 10"
|
|
192
|
-
refX="
|
|
211
|
+
refX="10"
|
|
193
212
|
refY="5"
|
|
194
213
|
markerWidth={arrowSize}
|
|
195
214
|
markerHeight={arrowSize}
|
|
196
215
|
orient="auto-start-reverse"
|
|
197
216
|
>
|
|
198
217
|
<path
|
|
199
|
-
d="M 0
|
|
218
|
+
d="M 0.5 1 L 10 5 L 0.5 9 Z"
|
|
200
219
|
fill={gradient ? `url(#${ids.gradient})` : stroke}
|
|
220
|
+
stroke={gradient ? `url(#${ids.gradient})` : stroke}
|
|
221
|
+
strokeWidth="1"
|
|
222
|
+
strokeLinejoin="round"
|
|
201
223
|
/>
|
|
202
224
|
</marker>
|
|
203
225
|
)}
|
|
@@ -209,15 +231,6 @@ const DynamicConnector = ({
|
|
|
209
231
|
const pathD = getPath(points.parent, child);
|
|
210
232
|
const pathStroke = gradient ? `url(#${ids.gradient})` : stroke;
|
|
211
233
|
|
|
212
|
-
const labelX =
|
|
213
|
-
points.parent.x +
|
|
214
|
-
(child.x - points.parent.x) * labelPosition +
|
|
215
|
-
labelOffsetX;
|
|
216
|
-
const labelY =
|
|
217
|
-
points.parent.y +
|
|
218
|
-
(child.y - points.parent.y) * labelPosition +
|
|
219
|
-
labelOffsetY;
|
|
220
|
-
|
|
221
234
|
return (
|
|
222
235
|
<g key={i}>
|
|
223
236
|
<path
|
|
@@ -226,7 +239,7 @@ const DynamicConnector = ({
|
|
|
226
239
|
stroke={pathStroke}
|
|
227
240
|
strokeWidth={strokeWidth}
|
|
228
241
|
strokeDasharray={animated ? "8,4" : dashArray}
|
|
229
|
-
strokeLinecap="round"
|
|
242
|
+
strokeLinecap={dashArray || animated ? "round" : "butt"}
|
|
230
243
|
strokeLinejoin="round"
|
|
231
244
|
markerEnd={showArrow ? `url(#${ids.arrow})` : undefined}
|
|
232
245
|
style={{
|
|
@@ -258,24 +271,25 @@ const DynamicConnector = ({
|
|
|
258
271
|
}}
|
|
259
272
|
/>
|
|
260
273
|
|
|
261
|
-
{
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
{!showArrow &&
|
|
275
|
+
points.children.map((child, i) => {
|
|
276
|
+
const dotFill = gradient ? gradient.to : effectiveDotColor;
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<circle
|
|
280
|
+
key={i}
|
|
281
|
+
cx={child.x}
|
|
282
|
+
cy={child.y}
|
|
283
|
+
r={dotRadius}
|
|
284
|
+
fill={dotFill}
|
|
285
|
+
stroke="#fff"
|
|
286
|
+
strokeWidth={1.5}
|
|
287
|
+
style={{
|
|
288
|
+
filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.15))",
|
|
289
|
+
}}
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
})}
|
|
279
293
|
</>
|
|
280
294
|
)}
|
|
281
295
|
</svg>
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
|
|
1
3
|
import { Box } from "@mui/material";
|
|
2
4
|
import DefaultNodeCard from "./DefaultCard";
|
|
3
5
|
import DraggableNode from "./DraggableNode";
|
|
@@ -7,8 +9,6 @@ import { getContentParts } from "../utils/flowUtils";
|
|
|
7
9
|
import { toPxNumber } from "../styles";
|
|
8
10
|
import { useNodeStyle } from "../hooks/useNodeStyle";
|
|
9
11
|
|
|
10
|
-
import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
11
|
-
|
|
12
12
|
const FlowNodeView = ({
|
|
13
13
|
node,
|
|
14
14
|
type,
|
|
@@ -59,6 +59,8 @@ const FlowNodeView = ({
|
|
|
59
59
|
gradient = baseStyle.gradient ?? null,
|
|
60
60
|
curvature = baseStyle.curvature ?? 0.5,
|
|
61
61
|
connectorType = baseStyle.connectorType ?? "curved",
|
|
62
|
+
startGap = baseStyle.startGap ?? 8,
|
|
63
|
+
endGap = baseStyle.endGap ?? 10,
|
|
62
64
|
selectionColor = baseStyle.selectionColor ?? "#64748b",
|
|
63
65
|
} = nodeStyle;
|
|
64
66
|
|
|
@@ -76,6 +78,8 @@ const FlowNodeView = ({
|
|
|
76
78
|
gradient: edgeStyle.gradient ?? gradient,
|
|
77
79
|
curvature: edgeStyle.curvature ?? curvature,
|
|
78
80
|
connectorType: edgeStyle.connectorType ?? connectorType,
|
|
81
|
+
startGap: edgeStyle.startGap ?? startGap,
|
|
82
|
+
endGap: edgeStyle.endGap ?? endGap,
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
const isHorizontal = direction === "horizontal";
|
|
@@ -241,6 +245,9 @@ const FlowNodeView = ({
|
|
|
241
245
|
connectorType:
|
|
242
246
|
childSpecificStyle.connectorType ??
|
|
243
247
|
childEdgeProps.connectorType,
|
|
248
|
+
startGap:
|
|
249
|
+
childSpecificStyle.startGap ?? childEdgeProps.startGap,
|
|
250
|
+
endGap: childSpecificStyle.endGap ?? childEdgeProps.endGap,
|
|
244
251
|
label: childSpecificStyle.label,
|
|
245
252
|
labelStyle: childSpecificStyle.labelStyle,
|
|
246
253
|
labelPosition: childSpecificStyle.labelPosition,
|
|
@@ -278,6 +285,8 @@ const FlowNodeView = ({
|
|
|
278
285
|
gradient={childEdgeProps.gradient}
|
|
279
286
|
curvature={childEdgeProps.curvature}
|
|
280
287
|
connectorType={childEdgeProps.connectorType}
|
|
288
|
+
startGap={childEdgeProps.startGap}
|
|
289
|
+
endGap={childEdgeProps.endGap}
|
|
281
290
|
label={childEdgeProps.label}
|
|
282
291
|
labelStyle={childEdgeProps.labelStyle}
|
|
283
292
|
labelPosition={childEdgeProps.labelPosition}
|