Skip to content

Commit cece1ec

Browse files
committed
Assistant checkpoint: Fixed TypeScript compilation errors
Assistant generated file changes: - src/index.ts: Fix optional callback properties in InternalConfig - src/mindmap.ts: Fix D3 linkHorizontal usage and types, Fix children assignment type issue, Fix zoom type arguments --- User prompt: still failing on the same step: https://github.com/workflow-builder/nodeq-mindmap/actions/runs/16894372584/job/47861120007 Replit-Commit-Author: Assistant Replit-Commit-Session-Id: e5c8aa2d-05f7-401c-b338-9e102c33d9ab
1 parent 90d331a commit cece1ec

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@ export interface NodeQConfig {
2020
onDataTransformed?: (result: any) => void;
2121
}
2222

23-
type InternalConfig = Required<NodeQConfig> & {
23+
type InternalConfig = {
24+
container: string | HTMLElement;
25+
data: any;
26+
width: number;
27+
height: number;
2428
theme: Required<Theme>;
29+
interactive: boolean;
30+
zoomable: boolean;
31+
collapsible: boolean;
32+
nodeSpacing: number;
33+
levelSpacing: number;
34+
onNodeClick: (node: MindMapNode) => void;
35+
onNodeHover: (node: MindMapNode) => void;
36+
onPipelineCreated?: (pipeline: PipelineConfig) => void;
37+
onDataTransformed?: (result: any) => void;
2538
};
2639

2740
export class NodeQMindMap {

src/mindmap.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export class NodeQMindMap {
116116
.enter()
117117
.append('path')
118118
.attr('class', 'link')
119-
.attr('d', d3.linkHorizontal<d3.HierarchyPoint<MindMapNode>>()
120-
.x(d => d.y)
121-
.y(d => d.x))
119+
.attr('d', d3.linkHorizontal()
120+
.x((d: any) => d.y)
121+
.y((d: any) => d.x))
122122
.style('fill', 'none')
123123
.style('stroke', this.config.theme.linkColor)
124124
.style('stroke-width', '2px');
@@ -130,7 +130,13 @@ export class NodeQMindMap {
130130
this.config.onNodeClick(d.data);
131131
if (this.config.collapsible) {
132132
// Toggle children visibility
133-
d.children = d.children ? (d.depth === 0 ? null : d.children) : this.hasChildren(d) ? this.getChildren(d) : null;
133+
if (d.children) {
134+
(d as any)._children = d.children;
135+
d.children = undefined;
136+
} else if ((d as any)._children) {
137+
d.children = (d as any)._children;
138+
(d as any)._children = undefined;
139+
}
134140
this.render(); // Re-render on collapse/expand
135141
}
136142
})
@@ -145,7 +151,7 @@ export class NodeQMindMap {
145151

146152
// Zooming
147153
if (this.config.zoomable) {
148-
const zoom = d3.zoom<SVGSVGElement>()
154+
const zoom = d3.zoom<SVGSVGElement, unknown>()
149155
.scaleExtent([0.1, 5])
150156
.on('zoom', (event) => {
151157
g.attr('transform', event.transform);

0 commit comments

Comments
 (0)