Skip to content

Commit

Permalink
refactor(nodes): add parentId to NodeProps closes #4061
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Jun 3, 2024
1 parent 5769ad2 commit 3cc14e8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- update internals on node resizer updates
- re-observe node when `node.hidden` is toggled
- update `updateNodeData` argument type - thanks @ogroppo
- add `selectable`, `deletable` and `draggable` to node and edge props
- add `parentId` to node props

## 12.0.0-next.18

Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/NodeWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export function NodeWrapper<NodeType extends Node>({
dragging={dragging}
dragHandle={node.dragHandle}
zIndex={internals.z}
parentId={node.parentId}
{...nodeDimensions}
/>
</Provider>
Expand Down
5 changes: 5 additions & 0 deletions packages/svelte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# @xyflow/svelte

## 0.1.4

- add `selectable`, `deletable` and `draggable` to node and edge props
- add `parentId` to node props

## 0.1.3

- fix `NodeToolbar` for subflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
export let height: $$Props['height'] = undefined;
export let dragHandle: $$Props['dragHandle'] = undefined;
export let initialized: $$Props['initialized'] = false;
export let parentId: $$Props['parentId'] = undefined;
let className: string = '';
export { className as class };
Expand Down Expand Up @@ -201,6 +203,7 @@
{dragging}
{draggable}
{dragHandle}
{parentId}
type={nodeType}
isConnectable={$connectableStore}
positionAbsoluteX={positionX}
Expand Down
1 change: 1 addition & 0 deletions packages/svelte/src/lib/components/NodeWrapper/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type NodeWrapperProps = Pick<
| 'height'
| 'initialWidth'
| 'initialHeight'
| 'parentId'
> & {
measuredWidth?: number;
measuredHeight?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
initialHeight={node.initialHeight}
measuredWidth={node.measured.width}
measuredHeight={node.measured.height}
parentId={node.parentId}
{resizeObserver}
on:nodeclick
on:nodemouseenter
Expand Down
13 changes: 12 additions & 1 deletion packages/system/src/types/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,18 @@ export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType &
*/
export type NodeProps<NodeType extends NodeBase> = Pick<
NodeType,
'id' | 'data' | 'width' | 'height' | 'sourcePosition' | 'targetPosition' | 'selected' | 'dragHandle' | 'selectable' | 'deletable' | 'draggable'
| 'id'
| 'data'
| 'width'
| 'height'
| 'sourcePosition'
| 'targetPosition'
| 'selected'
| 'dragHandle'
| 'selectable'
| 'deletable'
| 'draggable'
| 'parentId'
> &
Required<Pick<NodeType, 'type' | 'dragging' | 'zIndex'>> & {
/** whether a node is connectable or not */
Expand Down

0 comments on commit 3cc14e8

Please sign in to comment.