refactor(types)!: change node and edge types to extend element

* element type provides intersection interface of nodes and edges
* rename isHidden to hidden

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent da54bc3316
commit fe0eeaeae9
6 changed files with 18 additions and 31 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ export default (state: FlowState): FlowGetters => {
const getNodes = computed<GraphNode[]>(() => {
if (state.isReady) {
const nodes = state.elements.filter((n) => isGraphNode(n) && !n.isHidden) as GraphNode[]
const nodes = state.elements.filter((n) => isGraphNode(n) && !n.hidden) as GraphNode[]
return state.onlyRenderVisibleElements
? nodes &&
getNodesInside(
@@ -40,7 +40,7 @@ export default (state: FlowState): FlowGetters => {
})
const getEdges = computed<GraphEdge[]>(() => {
const edges = state.elements.filter((e) => isEdge(e) && !e.isHidden) as GraphEdge[]
const edges = state.elements.filter((e) => isEdge(e) && !e.hidden) as GraphEdge[]
if (state.isReady) {
return (
edges