-
Notifications
You must be signed in to change notification settings - Fork 866
feat(joint-react): auto layout demo, fix ports measuring #2941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(joint-react): auto layout demo, fix ports measuring #2941
Conversation
…ures and fixes, add auto layout demo, fix ports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an auto layout demo and fixes issues with port measurement and element sizing in the graph. Key changes include a refinement of cell and link processing (including default z-values) in set-cells, updates to the auto layout logic and event handling in the demos, and adjustments to port removal and store notification functions.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/joint-react/src/utils/cell/set-cells.ts | Updates link processing and propagates unsized element IDs through setElements. |
packages/joint-react/src/stories/examples/with-auto-layout/code.tsx | Implements an auto layout demo with an updated grid layout, node addition logic, and layout events. |
packages/joint-react/src/stories/demos/user-flow/code.tsx | Refactors port removal to pass the port id and refines magnet validation for connections. |
packages/joint-react/src/data/create-store.ts | Cleans up cell change notifications and port rendering function parameters. |
packages/joint-react/src/components/port/port-item.tsx | Migrates to type-only imports and enhances portal updates by refreshing connected link views. |
packages/joint-react/src/components/paper/paper.tsx | Introduces onElementSizeChange with a size hash to trigger layout updates when element sizes change. |
packages/joint-react/src/components/paper/paper.test.tsx | Updates test callbacks to match the renamed event handlers. |
packages/joint-react/docs/* | Updates documentation to align with internal code changes and updated export locations. |
Comments suppressed due to low confidence (1)
packages/joint-react/src/stories/demos/user-flow/code.tsx:81
- The function name 'PortIem' appears to be a typo; consider renaming it to 'PortItem' to match the file name and improve clarity.
function PortIem({ id, label, onRemove, x }: Readonly<PortProps>) {
ec2676c
to
fb5ffad
Compare
…r consistency across components
Description
This PR introduces multiple improvements and fixes for
@joint/react
:onElementsSizeReady
— triggered once after all elements are initially measured and rendered in React.onElementsSizeChange
— triggered whenever an element’s size changes after the initial render (e.g., due to user updates or layout changes).Motivation and Context
joint-react
.Screenshots
Screen.Recording.2025-04-24.at.13.31.08.mov
Screen.Recording.2025-04-24.at.13.35.10.mov
There is a known minor flickering issue when dynamically adding ports. This is a separate problem and will be addressed in a future update. It does not block merging this PR.