chore(core): cleanup types in changes util
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { isFunction, isString } from '@vueuse/core'
|
import { isFunction, isString } from '@vueuse/core'
|
||||||
import type {
|
import type {
|
||||||
Edge,
|
|
||||||
EdgeAddChange,
|
EdgeAddChange,
|
||||||
EdgeChange,
|
EdgeChange,
|
||||||
EdgeRemoveChange,
|
EdgeRemoveChange,
|
||||||
@@ -10,7 +9,6 @@ import type {
|
|||||||
FlowElements,
|
FlowElements,
|
||||||
GraphEdge,
|
GraphEdge,
|
||||||
GraphNode,
|
GraphNode,
|
||||||
Node,
|
|
||||||
NodeAddChange,
|
NodeAddChange,
|
||||||
NodeChange,
|
NodeChange,
|
||||||
NodeRemoveChange,
|
NodeRemoveChange,
|
||||||
@@ -102,7 +100,7 @@ function handleParentExpand(updateItem: GraphNode, parent: GraphNode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const applyChanges = <
|
export const applyChanges = <
|
||||||
T extends Node | Edge | FlowElement = Node,
|
T extends FlowElement = FlowElement,
|
||||||
C extends ElementChange = T extends GraphNode ? NodeChange : EdgeChange,
|
C extends ElementChange = T extends GraphNode ? NodeChange : EdgeChange,
|
||||||
>(
|
>(
|
||||||
changes: C[],
|
changes: C[],
|
||||||
@@ -137,7 +135,7 @@ export const applyChanges = <
|
|||||||
for (const currentChange of currentChanges) {
|
for (const currentChange of currentChanges) {
|
||||||
switch (currentChange.type) {
|
switch (currentChange.type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
;(element as FlowElement).selected = currentChange.selected
|
element.selected = currentChange.selected
|
||||||
break
|
break
|
||||||
case 'position':
|
case 'position':
|
||||||
if (isGraphNode(element)) {
|
if (isGraphNode(element)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user