import{Cascader as e}from"antd";import{useMemo as n,useEffect as a}from"react";import{processTreeDataByLevel as t}from"../../../utils/index.js";import{jsx as o}from"react/jsx-runtime";function l(l){const{onGetData:s,onChange:d,onGetNodePaths:r,onGetNodePathsIsIncludeOneself:c,getNodePathsIsIncludeOneself:i=!0,placeholder:h="",data:m=[],nameKey:f="name",idKey:u="id",childrenKey:p="children",level:I,...N}=l;void 0!==c&&console.warn("【BasicCascader】 onGetNodePathsIsIncludeOneself 参数已弃用，请使用 getNodePathsIsIncludeOneself 参数");const v=void 0!==c?c:i,y=n(()=>I?t({data:m,level:I,childrenKey:p,currentLevel:1}):m,[m,I,p]);return a(()=>{s?.(m,y)},[m,y]),o(e,{options:y,placeholder:`请选择${h}`,onChange:(e,n)=>{if(n&&r){const e=(e=>{let n=e;return!v&&e&&(n=e.slice(0,-1)),n||[]})(n);r?.(e)}d?.(e,n)},onClear:()=>{r?.([])},fieldNames:{label:f,value:u,children:p},...N})}l.displayName="BasicCascader";export{l as default};
