UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.6 kB
{"version":3,"file":"tree-node-content.mjs","sources":["../../../../../../packages/components/tree/src/tree-node-content.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { h, defineComponent, inject } from 'vue'\n\nimport { useNamespace } from '@element-plus/hooks'\nimport type { ComponentInternalInstance } from 'vue'\nimport type { RootTreeType } from './tree.type'\n\nexport default defineComponent({\n name: 'ElTreeNodeContent',\n props: {\n node: {\n type: Object,\n required: true,\n },\n renderContent: Function,\n },\n setup(props) {\n const ns = useNamespace('tree')\n const nodeInstance = inject<ComponentInternalInstance>('NodeInstance')\n const tree = inject<RootTreeType>('RootTree')\n return () => {\n const node = props.node\n const { data, store } = node\n return props.renderContent\n ? props.renderContent(h, { _self: nodeInstance, node, data, store })\n : tree.ctx.slots.default\n ? tree.ctx.slots.default({ node, data })\n : h('span', { class: ns.be('node', 'label') }, [node.label])\n }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;MAOK,YAAa,gBAAa;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA;AAAA,IAEZ,eAAe;AAAA;AAAA,EAEjB,MAAM,OAAO;AACX,UAAM,KAAK,aAAa;AACxB,UAAM,eAAe,OAAkC;AACvD,UAAM,OAAO,OAAqB;AAClC,WAAO,MAAM;AACX,YAAM,OAAO,MAAM;AACnB,YAAM,EAAE,MAAM,UAAU;AACxB,aAAO,MAAM,gBACT,MAAM,cAAc,GAAG,EAAE,OAAO,cAAc,MAAM,MAAM,WAC1D,KAAK,IAAI,MAAM,UACf,KAAK,IAAI,MAAM,QAAQ,EAAE,MAAM,UAC/B,EAAE,QAAQ,EAAE,OAAO,GAAG,GAAG,QAAQ,YAAY,CAAC,KAAK;AAAA;AAAA;AAAA;;;;"}