{"version":3,"file":"useRenderOperations.mjs","sources":["../../../../components/tree/hooks/useRenderOperations.tsx"],"sourcesContent":["import { usePrefixClass, TypeCreateElement, TypeVNode } from '../utils/adapt';\nimport { TypeTreeItemState } from '../types';\nimport { getTNode } from '../utils';\n\n// 渲染节点操作区域\nexport default function useRenderOperations(state: TypeTreeItemState) {\n  const componentName = usePrefixClass('tree').value;\n\n  const renderOperations = (h: TypeCreateElement): TypeVNode => {\n    const { node, treeScope } = state;\n    const { scopedSlots } = treeScope;\n    const treeProps = treeScope?.treeProps || {};\n    const { operations } = treeProps;\n\n    let opNode = null;\n    if (scopedSlots?.operations) {\n      opNode = scopedSlots.operations({\n        node: node?.getModel(),\n      });\n    } else {\n      opNode = getTNode(operations, {\n        createElement: h,\n        node,\n      });\n    }\n    if (opNode) {\n      opNode = (\n        // TODO: 这里最好修改一下，改成 data-ignore 之类的\n        // @ts-ignore\n        <span class={`${componentName}__operations`} ignore=\"active,expand\">\n          {opNode}\n        </span>\n      );\n    }\n    return opNode as TypeVNode;\n  };\n\n  return {\n    renderOperations,\n  };\n}\n"],"names":["useRenderOperations","state","componentName","usePrefixClass","value","renderOperations","h","node","treeScope","scopedSlots","treeProps","operations","opNode","getModel","getTNode","createElement","_opNode","_createVNode","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAwBA,oBAAoBC,KAA0B,EAAA;AAC9D,EAAA,IAAAC,aAAA,GAAgBC,cAAe,CAAA,MAAM,CAAE,CAAAC,KAAA,CAAA;AAEvC,EAAA,IAAAC,gBAAA,GAAmB,SAAnBA,gBAAAA,CAAoBC,CAAoC,EAAA;AACtD,IAAA,IAAEC,IAAM,GAAcN,KAAA,CAApBM,IAAM;MAAAC,SAAA,GAAcP,KAAA,CAAdO,SAAA,CAAA;AACR,IAAA,IAAEC,cAAgBD,SAAA,CAAhBC;AACF,IAAA,IAAAC,SAAA,GAAY,CAAAF,SAAW,KAAXA,IAAA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