UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.3 kB
{"version":3,"file":"tree-node-content.mjs","names":[],"sources":["../../../../../../packages/components/tree-v2/src/tree-node-content.ts"],"sourcesContent":["import { defineComponent, h, inject } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport ElText from '@element-plus/components/text'\nimport { ROOT_TREE_INJECTION_KEY, treeNodeContentProps } from './virtual-tree'\n\nexport default defineComponent({\n name: 'ElTreeNodeContent',\n props: treeNodeContentProps,\n setup(props) {\n const tree = inject(ROOT_TREE_INJECTION_KEY)\n const ns = useNamespace('tree')\n return () => {\n const node = props.node\n const { data } = node!\n return tree?.ctx.slots.default\n ? tree.ctx.slots.default({ node, data })\n : h(\n ElText,\n { tag: 'span', truncated: true, class: ns.be('node', 'label') },\n () => [node?.label]\n )\n }\n },\n})\n"],"mappings":";;;;;;AAKA,gCAAe,gBAAgB;CAC7B,MAAM;CACN,OAAO;CACP,MAAM,OAAO;EACX,MAAM,OAAO,OAAO,wBAAwB;EAC5C,MAAM,KAAK,aAAa,OAAO;AAC/B,eAAa;GACX,MAAM,OAAO,MAAM;GACnB,MAAM,EAAE,SAAS;AACjB,UAAO,MAAM,IAAI,MAAM,UACnB,KAAK,IAAI,MAAM,QAAQ;IAAE;IAAM;IAAM,CAAC,GACtC,EACE,QACA;IAAE,KAAK;IAAQ,WAAW;IAAM,OAAO,GAAG,GAAG,QAAQ,QAAQ;IAAE,QACzD,CAAC,MAAM,MAAM,CACpB;;;CAGV,CAAC"}