UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

48 lines (45 loc) 1.96 kB
import { defineComponent, computed, createBlock, openBlock, mergeProps, unref, withCtx, createElementBlock, Fragment, renderList, renderSlot } from 'vue'; import { createSplitProps } from '../create-split-props.js'; import _sfc_main$1 from '../tree-view/tree-view-tree.vue.js'; import { useTreeViewContext } from '../tree-view/use-tree-view-context.js'; import _sfc_main$2 from './json-tree-view-node.vue.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "json-tree-view-tree", props: { asChild: { type: Boolean }, indentGuide: { type: Boolean } }, setup(__props) { const props = __props; const splitTreeNodeProps = createSplitProps(); const [nodeProps, treeProps] = splitTreeNodeProps(props, ["indentGuide"]); const tree = useTreeViewContext(); const children = computed(() => tree.value.collection.getNodeChildren(tree.value.collection.rootNode)); return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$1, mergeProps({ "data-scope": "json-tree-view" }, unref(treeProps)), { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(children.value, (child, index) => { return openBlock(), createBlock(_sfc_main$2, mergeProps({ key: index, node: child, "index-path": [index] }, { ref_for: true }, unref(nodeProps)), { arrow: withCtx(() => [ renderSlot(_ctx.$slots, "arrow") ]), indentGuide: withCtx(() => [ renderSlot(_ctx.$slots, "indentGuide") ]), renderValue: withCtx(({ node: childNode }) => [ renderSlot(_ctx.$slots, "renderValue", { node: childNode }) ]), _: 2 }, 1040, ["node", "index-path"]); }), 128)) ]), _: 3 }, 16); }; } }); export { _sfc_main as default };