You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.0 KiB
2 lines
1.0 KiB
import{ROW_KEY as w}from"./const-0405ffdf.js";import{u as m,ak as v,aj as y}from"./index-f4658ae7.js";function I(i,t,f){return!t||f?i[w]:v(t)?i[t]:y(t)?i[t(i)]:null}function A(i,{setSelectedRowKeys:t,getSelectRowKeys:f,getAutoCreateKey:b,clearSelectedRowKeys:l,emit:c}){return{customRow:(u,r)=>({onClick:n=>{n==null||n.stopPropagation();function C(){var k;const{rowSelection:e,rowKey:x,clickToRowSelect:g}=m(i);if(!e||!g)return;const o=f(),s=I(u,x,m(b));if(!s)return;if(e.type==="checkbox"){const p=(k=n.composedPath)==null?void 0:k.call(n).find(a=>a.tagName==="TR");if(!p)return;const h=p.querySelector("input[type=checkbox]");if(!h||h.hasAttribute("disabled"))return;if(!o.includes(s)){t([...o,s]);return}const R=o.findIndex(a=>a===s);o.splice(R,1),t(o);return}if(e.type==="radio"){if(!o.includes(s)){o.length&&l(),t([s]);return}l()}}C(),c("row-click",u,r,n)},onDblclick:n=>{c("row-dbClick",u,r,n)},onContextmenu:n=>{c("row-contextmenu",u,r,n)},onMouseenter:n=>{c("row-mouseenter",u,r,n)},onMouseleave:n=>{c("row-mouseleave",u,r,n)}})}}export{A as useCustomRow};
|