import{Select as e}from"antd";import{useEffect as n}from"react";import{jsx as r}from"react/jsx-runtime";function a(a){const{onGetData:o,onChange:t,onGetLabel:i,onGetOption:l,placeholder:c="",data:s=[],nameKey:d="name",idKey:p="id",labelRender:h,...f}=a;return n(()=>{o?.(s)},[s]),r(e,{placeholder:`请选择${c}`,showSearch:!0,allowClear:!0,optionFilterProp:"children",onChange:(e,n)=>{if(i||l)if(Array.isArray(e))if(e.length>0){const n=[],r=[];e.forEach(e=>{const a=s.find(n=>n[p]===e);a&&(n.push(a),r.push(a[d]))}),i?.(r),l?.(n)}else i?.([]),l?.([]);else if(e){const n=s.find(n=>n[p]===e);i?.(n[d]),l?.(n)}else i?.(""),l?.({});t?.(e,n)},...f,children:s.map(n=>{const a=n[p],o=h?h(n):n[d];return r(e.Option,{value:a,children:o},a)})})}a.displayName="BasicSelect";export{a as default};
