import{booleanType as e}from"../_util/type.mjs";import t from"../_util/classNames.mjs";import n from"../_util/vue-types/index.mjs";import r from"../pagination/index.mjs";import i from"./ListItem.mjs";import{Fragment as a,computed as o,createVNode as s,defineComponent as c,ref as l,watch as u}from"vue";var d={prefixCls:String,filteredRenderItems:n.array.def([]),selectedKeys:n.array,disabled:e(),showRemove:e(),pagination:n.any,onItemSelect:Function,onScroll:Function,onItemRemove:Function};function f(e){if(!e)return null;let t={pageSize:10,simple:!0,showSizeChanger:!1,showLessItems:!1};return typeof e==`object`?{...t,...e}:t}var p=c({compatConfig:{MODE:3},name:`ListBody`,inheritAttrs:!1,props:d,emits:[`itemSelect`,`itemRemove`,`scroll`],setup(e,{emit:n,expose:c}){let d=l(1),p=t=>{let{selectedKeys:r}=e,i=r.includes(t.key);n(`itemSelect`,t.key,!i)},m=e=>{n(`itemRemove`,[e.key])},h=e=>{n(`scroll`,e)},g=o(()=>f(e.pagination));u([g,()=>e.filteredRenderItems],()=>{if(g.value){let t=Math.ceil(e.filteredRenderItems.length/g.value.pageSize);d.value=Math.min(d.value,t)}},{immediate:!0});let _=o(()=>{let{filteredRenderItems:t}=e,n=t;return g.value&&(n=t.slice((d.value-1)*g.value.pageSize,d.value*g.value.pageSize)),n}),v=e=>{d.value=e};return c({items:_}),()=>{let{prefixCls:n,filteredRenderItems:o,selectedKeys:c,disabled:l,showRemove:u}=e,f=null;g.value&&(f=s(r,{simple:g.value.simple,showSizeChanger:g.value.showSizeChanger,showLessItems:g.value.showLessItems,size:`small`,disabled:l,class:`${n}-pagination`,total:o.length,pageSize:g.value.pageSize,current:d.value,onChange:v},null));let y=_.value.map(({renderedEl:e,renderedText:t,item:r})=>{let{disabled:a}=r,o=c.includes(r.key);return s(i,{disabled:l||a,key:r.key,item:r,renderedText:t,renderedEl:e,checked:o,prefixCls:n,onClick:p,onRemove:m,showRemove:u},null)});return s(a,null,[s(`ul`,{class:t(`${n}-content`,{[`${n}-content-show-remove`]:u}),onScroll:h},[y]),f])}}});export{p as default,d as transferListBodyProps};