Skip to content

Commit 410765b

Browse files
committed
feat(core): allow string array or object as class to node/edge objects (#1502)
* feat(core): allow string array as class * chore(changeset): add * feat(core): allow record as class * chore(changeset): add
1 parent 8454dca commit 410765b

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.changeset/thin-beans-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-flow/core": minor
3+
---
4+
5+
Allow passing a Record<string, any> as class to node/edge objects

.changeset/thirty-days-retire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-flow/core": minor
3+
---
4+
5+
Allow passing an array of strings as class to node/edge objects

packages/core/src/types/edge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface DefaultEdge<
9292
/** Disable/enable deleting edge */
9393
deletable?: boolean
9494
/** Additional class names, can be a string or a callback returning a string (receives current flow element) */
95-
class?: string | ClassFunc<GraphEdge<Data, CustomEvents>>
95+
class?: string | string[] | Record<string, any> | ClassFunc<GraphEdge<Data, CustomEvents>>
9696
/** Additional styles, can be an object or a callback returning an object (receives current flow element) */
9797
style?: Styles | StyleFunc<GraphEdge<Data, CustomEvents>>
9898
/** Is edge hidden */

packages/core/src/types/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export interface Node<Data = ElementData, CustomEvents extends Record<string, Cu
9090
height?: number | string | HeightFunc
9191

9292
/** Additional class names, can be a string or a callback returning a string (receives current flow element) */
93-
class?: string | ClassFunc<GraphNode<Data, CustomEvents>>
93+
class?: string | string[] | Record<string, any> | ClassFunc<GraphNode<Data, CustomEvents>>
9494
/** Additional styles, can be an object or a callback returning an object (receives current flow element) */
9595
style?: Styles | StyleFunc<GraphNode<Data, CustomEvents>>
9696
/** Is node hidden */

0 commit comments

Comments
 (0)