{"version":3,"file":"tree-node.js","sources":["../../../../../../packages/components/tree-v2/src/tree-node.vue"],"sourcesContent":["<template>\n  <div\n    ref=\"node$\"\n    :class=\"[\n      ns.b('node'),\n      ns.is('expanded', expanded),\n      ns.is('current', current),\n      ns.is('focusable', !disabled),\n      ns.is('checked', !disabled && checked),\n    ]\"\n    role=\"treeitem\"\n    tabindex=\"-1\"\n    :aria-expanded=\"expanded\"\n    :aria-disabled=\"disabled\"\n    :aria-checked=\"checked\"\n    :data-key=\"node?.key\"\n    @click.stop=\"handleClick\"\n    @contextmenu=\"handleContextMenu\"\n    @dragover.prevent\n    @dragenter.prevent\n    @drop.stop=\"handleDrop\"\n  >\n    <div\n      :class=\"ns.be('node', 'content')\"\n      :style=\"{\n        paddingLeft: `${(node.level - 1) * indent}px`,\n        height: itemSize + 'px',\n      }\"\n    >\n      <el-icon\n        v-if=\"icon\"\n        :class=\"[\n          ns.is('leaf', !!node?.isLeaf),\n          ns.is('hidden', hiddenExpandIcon),\n          {\n            expanded: !node?.isLeaf && expanded,\n          },\n          ns.be('node', 'expand-icon'),\n        ]\"\n        @click.stop=\"handleExpandIconClick\"\n      >\n        <component :is=\"icon\" />\n      </el-icon>\n      <el-checkbox\n        v-if=\"showCheckbox\"\n        :model-value=\"checked\"\n        :indeterminate=\"indeterminate\"\n        :disabled=\"disabled\"\n        @change=\"handleCheckChange\"\n        @click.stop\n      />\n      <el-node-content :node=\"node\" />\n    </div>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject } from 'vue'\nimport ElIcon from '@element-plus/components/icon'\nimport { CaretRight } from '@element-plus/icons-vue'\nimport ElCheckbox from '@element-plus/components/checkbox'\nimport { useNamespace } from '@element-plus/hooks'\nimport ElNodeContent from './tree-node-content'\nimport {\n  NODE_CONTEXTMENU,\n  ROOT_TREE_INJECTION_KEY,\n  treeNodeEmits,\n  treeNodeProps,\n} from './virtual-tree'\nimport type { CheckboxValueType } from '@element-plus/components/checkbox'\n\ndefineOptions({\n  name: 'ElTreeNode',\n})\n\nconst props = defineProps(treeNodeProps)\nconst emit = defineEmits(treeNodeEmits)\n\nconst tree = inject(ROOT_TREE_INJECTION_KEY)\nconst ns = useNamespace('tree')\n\nconst indent = computed(() => {\n  return tree?.props.indent ?? 16\n})\n\nconst icon = computed(() => {\n  return tree?.props.icon ?? CaretRight\n})\n\nconst handleClick = (e: MouseEvent) => {\n  emit('click', props.node, e)\n}\n\nconst handleDrop = (e: DragEvent) => {\n  emit('drop', props.node, e)\n}\nconst handleExpandIconClick = () => {\n  emit('toggle', props.node)\n}\nconst handleCheckChange = (value: CheckboxValueType) => {\n  emit('check', props.node, value)\n}\nconst handleContextMenu = (event: Event) => {\n  if (tree?.instance?.vnode?.props?.['onNodeContextmenu']) {\n    event.stopPropagation()\n    event.preventDefault()\n  }\n  tree?.ctx.emit(NODE_CONTEXTMENU, event, props.node?.data, props.node)\n}\n</script>\n"],"names":["inject","ROOT_TREE_INJECTION_KEY","useNamespace","computed","CaretRight"],"mappings":";;;;;;;;;;;;;;uCAuEc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,IAAA,GAAOA,WAAOC,mCAAuB,CAAA,CAAA;AAC3C,IAAM,MAAA,EAAA,GAAKC,mBAAa,MAAM,CAAA,CAAA;AAE9B,IAAM,MAAA,MAAA,GAASC,aAAS,MAAM;AAC5B,MAAO,IAAA,EAAA,CAAA;AAAsB,MAC9B,OAAA,CAAA,EAAA,GAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CAAA,KAAA,CAAA,MAAA,KAAA,IAAA,GAAA,EAAA,GAAA,EAAA,CAAA;AAED,KAAM,CAAA,CAAA;AACJ,IAAO,MAAA,IAAA,GAAAA,YAAY,CAAQ,MAAA;AAAA,MAC5B,IAAA,EAAA,CAAA;AAED,MAAM,OAAA,CAAA,EAAA,GAAA,IAAA,IAAiC,IAAA,GAAA,KAAA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