@truedat/dd 8.12.10 → 8.12.11
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 +3 -3
- package/src/components/LineageGraph.js +104 -79
- package/src/components/LineageGraphNode.js +53 -0
- package/src/components/LineageGraphToolbar.js +45 -33
- package/src/components/__tests__/LineageGraph.spec.js +16 -0
- package/src/components/__tests__/LineageGraphInteraction.spec.js +1 -1
- package/src/components/__tests__/LineageGraphLayout.spec.js +21 -0
- package/src/components/__tests__/LineageGraphNode.spec.js +56 -0
- package/src/components/__tests__/LineageGraphPin.spec.js +338 -0
- package/src/components/__tests__/LineageGraphToolbar.spec.js +54 -2
- package/src/components/__tests__/LineageInspectorPanel.spec.js +1 -1
- package/src/styles/LineageGraph.less +81 -24
- package/src/utils/__tests__/lineageLayout.spec.js +68 -0
- package/src/utils/lineageGraph.js +5 -3
|
@@ -233,6 +233,74 @@ describe("compound root columns", () => {
|
|
|
233
233
|
});
|
|
234
234
|
});
|
|
235
235
|
|
|
236
|
+
describe("relations within one lineage group", () => {
|
|
237
|
+
const group = { ...node("group"), data: { label: "group", topology: true } };
|
|
238
|
+
const child = (id) => ({ ...node(id), parentId: "group" });
|
|
239
|
+
|
|
240
|
+
it("places related siblings from left to right and keeps an unrelated sibling separate", () => {
|
|
241
|
+
const nodes = [group, child("source"), child("target"), child("unrelated")];
|
|
242
|
+
const edges = [{ source: "source", target: "target" }];
|
|
243
|
+
const positions = geometry(freshLayout()({ nodes, edges }));
|
|
244
|
+
|
|
245
|
+
expect(positions.source.x + positions.source.w).toBeLessThan(
|
|
246
|
+
positions.target.x,
|
|
247
|
+
);
|
|
248
|
+
expect(positions.unrelated.x).toBe(positions.source.x);
|
|
249
|
+
expect(positions.unrelated.y).toBeGreaterThan(positions.source.y);
|
|
250
|
+
expect(positions.target.x + positions.target.w).toBeLessThanOrEqual(
|
|
251
|
+
positions.group.x + positions.group.w,
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("projects relations between nested nodes onto their sibling groups", () => {
|
|
256
|
+
const nodes = [
|
|
257
|
+
group,
|
|
258
|
+
child("left"),
|
|
259
|
+
child("right"),
|
|
260
|
+
{ ...node("left/leaf"), parentId: "left" },
|
|
261
|
+
{ ...node("right/leaf"), parentId: "right" },
|
|
262
|
+
];
|
|
263
|
+
const edges = [{ source: "left/leaf", target: "right/leaf" }];
|
|
264
|
+
const positions = geometry(freshLayout()({ nodes, edges }));
|
|
265
|
+
|
|
266
|
+
expect(positions.left.x + positions.left.w).toBeLessThan(positions.right.x);
|
|
267
|
+
expect(positions["left/leaf"].x).toBeGreaterThanOrEqual(positions.left.x);
|
|
268
|
+
expect(positions["right/leaf"].x).toBeGreaterThanOrEqual(positions.right.x);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it("reflows the whole graph when an internal dependency widens a group", () => {
|
|
272
|
+
const nodes = [group, child("source"), child("target"), node("other")];
|
|
273
|
+
const layout = freshLayout();
|
|
274
|
+
const before = geometry(layout({ nodes, edges: [] }));
|
|
275
|
+
const after = geometry(
|
|
276
|
+
layout({
|
|
277
|
+
nodes,
|
|
278
|
+
edges: [{ source: "source", target: "target" }],
|
|
279
|
+
}),
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
expect(after.group.w).toBeGreaterThan(before.group.w);
|
|
283
|
+
expect(after.group.h).toBeLessThan(before.group.h);
|
|
284
|
+
expect(after.other.y).toBeLessThan(before.other.y);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it("keeps cyclic siblings in one column without overlapping", () => {
|
|
288
|
+
const nodes = [group, child("a"), child("b")];
|
|
289
|
+
const positions = geometry(
|
|
290
|
+
freshLayout()({
|
|
291
|
+
nodes,
|
|
292
|
+
edges: [
|
|
293
|
+
{ source: "a", target: "b" },
|
|
294
|
+
{ source: "b", target: "a" },
|
|
295
|
+
],
|
|
296
|
+
}),
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
expect(positions.a.x).toBe(positions.b.x);
|
|
300
|
+
expect(positions.b.y).toBeGreaterThanOrEqual(positions.a.y + positions.a.h);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
236
304
|
it.each([undefined, "lineage-field"])(
|
|
237
305
|
"leaves only bottom padding after the last child (%s)",
|
|
238
306
|
(variant) => {
|
|
@@ -3108,8 +3108,8 @@ export const planLineageEdgeRoutes = (edges = [], nodes = []) => {
|
|
|
3108
3108
|
data: {
|
|
3109
3109
|
...edge.data,
|
|
3110
3110
|
...routePortPositions[index],
|
|
3111
|
-
edgeOffset: routeGuides[index]?.edgeOffset
|
|
3112
|
-
routeGuide: routeGuides[index]
|
|
3111
|
+
edgeOffset: routeGuides[index]?.edgeOffset,
|
|
3112
|
+
routeGuide: routeGuides[index],
|
|
3113
3113
|
},
|
|
3114
3114
|
}));
|
|
3115
3115
|
};
|
|
@@ -3139,6 +3139,7 @@ export const focusLineageNodes = (
|
|
|
3139
3139
|
focusedNodeIds,
|
|
3140
3140
|
focusActive,
|
|
3141
3141
|
selectedNodeId,
|
|
3142
|
+
pinnedNodeId,
|
|
3142
3143
|
) =>
|
|
3143
3144
|
focusActive
|
|
3144
3145
|
? nodes.map((node) => {
|
|
@@ -3147,7 +3148,8 @@ export const focusLineageNodes = (
|
|
|
3147
3148
|
node.data?.lineageNode?.lineageKind === "group";
|
|
3148
3149
|
const selected = node.id === selectedNodeId;
|
|
3149
3150
|
const direct = !selected && focusedNodeIds.has(node.id);
|
|
3150
|
-
const dimmed =
|
|
3151
|
+
const dimmed =
|
|
3152
|
+
!selected && node.id !== pinnedNodeId && !focusedNodeIds.has(node.id);
|
|
3151
3153
|
|
|
3152
3154
|
return {
|
|
3153
3155
|
...node,
|