{"version":3,"file":"node2.js","sources":["../../../../../../packages/components/cascader-panel/src/node.vue"],"sourcesContent":["<template>\n  <li\n    :id=\"`${menuId}-${node.uid}`\"\n    role=\"menuitem\"\n    :aria-haspopup=\"!isLeaf\"\n    :aria-owns=\"isLeaf ? null : menuId\"\n    :aria-expanded=\"inExpandingPath\"\n    :tabindex=\"expandable ? -1 : undefined\"\n    :class=\"[\n      ns.b(),\n      ns.is('selectable', checkStrictly),\n      ns.is('active', node.checked),\n      ns.is('disabled', !expandable),\n      inExpandingPath && 'in-active-path',\n      inCheckedPath && 'in-checked-path',\n    ]\"\n    @mouseenter=\"handleHoverExpand\"\n    @focus=\"handleHoverExpand\"\n    @click=\"handleClick\"\n  >\n    <!-- prefix -->\n    <el-checkbox\n      v-if=\"multiple\"\n      :model-value=\"node.checked\"\n      :indeterminate=\"node.indeterminate\"\n      :disabled=\"isDisabled\"\n      @click.stop\n      @update:model-value=\"handleSelectCheck\"\n    />\n    <el-radio\n      v-else-if=\"checkStrictly\"\n      :model-value=\"checkedNodeId\"\n      :label=\"node.uid\"\n      :disabled=\"isDisabled\"\n      @update:model-value=\"handleSelectCheck\"\n      @click.stop\n    >\n      <!--\n        Add an empty element to avoid render label,\n        do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n      -->\n      <span />\n    </el-radio>\n    <el-icon v-else-if=\"isLeaf && node.checked\" :class=\"ns.e('prefix')\">\n      <check />\n    </el-icon>\n\n    <!-- content -->\n    <node-content />\n\n    <!-- postfix -->\n    <template v-if=\"!isLeaf\">\n      <el-icon v-if=\"node.loading\" :class=\"[ns.is('loading'), ns.e('postfix')]\">\n        <loading />\n      </el-icon>\n      <el-icon v-else :class=\"['arrow-right', ns.e('postfix')]\">\n        <arrow-right />\n      </el-icon>\n    </template>\n  </li>\n</template>\n\n<script lang=\"ts\">\n// @ts-nocheck\nimport { computed, defineComponent, inject } from 'vue'\nimport ElCheckbox from '@element-plus/components/checkbox'\nimport ElRadio from '@element-plus/components/radio'\nimport ElIcon from '@element-plus/components/icon'\nimport { useNamespace } from '@element-plus/hooks'\nimport { ArrowRight, Check, Loading } from '@element-plus/icons-vue'\nimport NodeContent from './node-content'\nimport { CASCADER_PANEL_INJECTION_KEY } from './types'\nimport type { default as CascaderNode } from './node'\n\nimport type { PropType } from 'vue'\n\nexport default defineComponent({\n  name: 'ElCascaderNode',\n\n  components: {\n    ElCheckbox,\n    ElRadio,\n    NodeContent,\n    ElIcon,\n    Check,\n    Loading,\n    ArrowRight,\n  },\n\n  props: {\n    node: {\n      type: Object as PropType<CascaderNode>,\n      required: true,\n    },\n    menuId: String,\n  },\n\n  emits: ['expand'],\n\n  setup(props, { emit }) {\n    const panel = inject(CASCADER_PANEL_INJECTION_KEY)!\n\n    const ns = useNamespace('cascader-node')\n    const isHoverMenu = computed(() => panel.isHoverMenu)\n    const multiple = computed(() => panel.config.multiple)\n    const checkStrictly = computed(() => panel.config.checkStrictly)\n    const checkedNodeId = computed(() => panel.checkedNodes[0]?.uid)\n    const isDisabled = computed(() => props.node.isDisabled)\n    const isLeaf = computed(() => props.node.isLeaf)\n    const expandable = computed(\n      () => (checkStrictly.value && !isLeaf.value) || !isDisabled.value\n    )\n    const inExpandingPath = computed(() => isInPath(panel.expandingNode!))\n    // only useful in check-strictly mode\n    const inCheckedPath = computed(\n      () => checkStrictly.value && panel.checkedNodes.some(isInPath)\n    )\n\n    const isInPath = (node: CascaderNode) => {\n      const { level, uid } = props.node\n      return node?.pathNodes[level - 1]?.uid === uid\n    }\n\n    const doExpand = () => {\n      if (inExpandingPath.value) return\n      panel.expandNode(props.node)\n    }\n\n    const doCheck = (checked: boolean) => {\n      const { node } = props\n      if (checked === node.checked) return\n      panel.handleCheckChange(node, checked)\n    }\n\n    const doLoad = () => {\n      panel.lazyLoad(props.node, () => {\n        if (!isLeaf.value) doExpand()\n      })\n    }\n\n    const handleHoverExpand = (e: Event) => {\n      if (!isHoverMenu.value) return\n      handleExpand()\n      !isLeaf.value && emit('expand', e)\n    }\n\n    const handleExpand = () => {\n      const { node } = props\n      // do not exclude leaf node because the menus expanded might have to reset\n      if (!expandable.value || node.loading) return\n      node.loaded ? doExpand() : doLoad()\n    }\n\n    const handleClick = () => {\n      if (isHoverMenu.value && !isLeaf.value) return\n\n      if (\n        isLeaf.value &&\n        !isDisabled.value &&\n        !checkStrictly.value &&\n        !multiple.value\n      ) {\n        handleCheck(true)\n      } else {\n        handleExpand()\n      }\n    }\n\n    const handleSelectCheck = (checked: boolean) => {\n      if (checkStrictly.value) {\n        doCheck(checked)\n        if (props.node.loaded) {\n          doExpand()\n        }\n      } else {\n        handleCheck(checked)\n      }\n    }\n\n    const handleCheck = (checked: boolean) => {\n      if (!props.node.loaded) {\n        doLoad()\n      } else {\n        doCheck(checked)\n        !checkStrictly.value && doExpand()\n      }\n    }\n\n    return {\n      panel,\n      isHoverMenu,\n      multiple,\n      checkStrictly,\n      checkedNodeId,\n      isDisabled,\n      isLeaf,\n      expandable,\n      inExpandingPath,\n      inCheckedPath,\n      ns,\n      handleHoverExpand,\n      handleExpand,\n      handleClick,\n      handleCheck,\n      handleSelectCheck,\n    }\n  },\n})\n</script>\n"],"names":["defineComponent","ElCheckbox","ElRadio","NodeContent","ElIcon","Check","Loading","ArrowRight","inject","CASCADER_PANEL_INJECTION_KEY","useNamespace","computed","_resolveComponent","_openBlock","_normalizeClass","_createCommentVNode","_createBlock","_withModifiers","_createElementVNode","_createVNode","_createElementBlock","_Fragment"],"mappings":";;;;;;;;;;;;;;;AA4EA,MAAK,YAAaA,mBAAa,CAAA;AAAA,EAC7B,IAAM,EAAA,gBAAA;AAAA,EAEN,UAAY,EAAA;AAAA,gBACVC,gBAAA;AAAA,aACAC,eAAA;AAAA,iBACAC,sBAAA;AAAA,YACAC,cAAA;AAAA,WACAC,cAAA;AAAA,aACAC,gBAAA;AAAA,gBACAC,mBAAA;AAAA,GACF;AAAA,EAEA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA,M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