import{Or as e,Tr as t,t as n}from"./jsx-runtime-NwRKtVrk.js";import{t as r}from"./space-Dvitgohy.js";import{t as i}from"./card-D7XvzVif.js";import{r as a,t as o}from"./XinForm-ihfVpzb6.js";import{M as s,b as c,h as l}from"./index-B7MUL4ct.js";var u=e(t(),1),d=n(),{Title:f,Paragraph:p,Text:m}=l,h=()=>{let[e,t]=(0,u.useState)(null),[n,h]=(0,u.useState)([]),g=(0,u.useRef)(void 0);return(0,d.jsxs)(`div`,{children:[(0,d.jsxs)(l,{style:{margin:`12px 0 24px 0`},children:[(0,d.jsx)(f,{level:2,children:`用户选择器组件示例`}),(0,d.jsx)(p,{children:`基于 AntDesign 封装的用户选择器表单组件，支持单选和多选模式。`})]}),(0,d.jsxs)(r,{direction:`vertical`,size:`large`,style:{width:`100%`},children:[(0,d.jsxs)(i,{title:`独立使用`,bordered:!0,children:[(0,d.jsx)(m,{children:`单选模式：`}),(0,d.jsx)(`div`,{className:`mt-2`,children:(0,d.jsx)(a,{value:e,onChange:e=>{t(e),c.success(`选中用户ID: ${e}`)},placeholder:`请选择用户`})}),(0,d.jsxs)(m,{type:`secondary`,className:`mt-2 block`,children:[`当前选中: `,e||`未选择`]}),(0,d.jsx)(s,{}),(0,d.jsx)(m,{children:`多选模式：`}),(0,d.jsx)(`div`,{className:`mt-2`,children:(0,d.jsx)(a,{mode:`multiple`,value:n,onChange:e=>{h(e),c.success(`选中${e.length}个用户`)},placeholder:`请选择多个用户`,maxTagCount:3})}),(0,d.jsxs)(m,{type:`secondary`,className:`mt-2 block`,children:[`当前选中: `,n.length>0?n.join(`, `):`未选择`]})]}),(0,d.jsx)(i,{title:`在 XinForm 中使用`,bordered:!0,children:(0,d.jsx)(o,{formRef:g,columns:[{dataIndex:`taskName`,title:`任务名称`,valueType:`text`,rules:[{required:!0,message:`请输入任务名称`}],fieldProps:{placeholder:`请输入任务名称`}},{dataIndex:`owner_id`,title:`任务负责人`,rules:[{required:!0,message:`请选择负责人`}],fieldRender:()=>(0,d.jsx)(a,{placeholder:`请选择负责人`})},{dataIndex:`participant_ids`,title:`参与人员`,rules:[{required:!0,message:`请至少选择一个参与人员`},{validator:(e,t)=>t&&t.length>10?Promise.reject(`最多选择10个参与人员`):Promise.resolve()}],fieldRender:()=>(0,d.jsx)(a,{mode:`multiple`,maxTagCount:3,placeholder:`请选择参与人员`})},{dataIndex:`description`,title:`任务描述`,valueType:`textarea`,fieldProps:{placeholder:`请输入任务描述`}}],onFinish:async e=>(console.log(`表单提交:`,e),c.success(`提交成功！`),c.info(`负责人ID: ${e.owner_id}, 参与人IDs: ${e.participant_ids?.join(`, `)}`),!0),submitter:{submitText:`提交表单`,render:e=>e.submit}})})]})]})};export{h as default};