Skip to content

Commit

Permalink
PATCH: remove circular dependency in BIMDataTree (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtil authored Apr 2, 2024
1 parent c2140cf commit 545bca0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 37 deletions.
34 changes: 32 additions & 2 deletions src/BIMDataComponents/BIMDataTree/Node.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,39 @@
</template>

<script>
import { inject, ref, computed, watch, isRef } from "vue";
import { inject, ref, computed, watch, isRef, h } from "vue";
import NodeChildren from "./NodeChildren.js";
const NodeChildren = {
inject: ["root"],
props: {
node: {
type: Object,
required: true,
validator: node => Number.isFinite(node?.id),
},
depth: {
type: Number,
default: 0,
},
},
render() {
const { node, depth, root } = this;
const state = root.state;
return node.children.map(child =>
h(Node, { node: child, depth, key: child.id }, () =>
root.$slots.node?.({
node: child,
depth,
selected: child.id === state.selectedId,
hovered: child.id === state.hoveredNode?.id,
ancestorSelected: state.hasAncestorSelected(child),
})
)
);
},
};
export default {
name: "Node",
Expand Down
35 changes: 0 additions & 35 deletions src/BIMDataComponents/BIMDataTree/NodeChildren.js

This file was deleted.

0 comments on commit 545bca0

Please sign in to comment.