3 lines
22 KiB
JavaScript
3 lines
22 KiB
JavaScript
|
|
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5826],{84567:function(Se,le,r){r.d(le,{Z:function(){return me}});var n=r(67294),ee=r(93967),R=r.n(ee),J=r(50132),F=r(42550),O=r(45353),V=r(17415),z=r(53124),T=r(98866),de=r(35792),fe=r(65223),ge=n.createContext(null),ce=r(63185),se=r(5273),ye=function(p,q){var A={};for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&q.indexOf(h)<0&&(A[h]=p[h]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function")for(var b=0,h=Object.getOwnPropertySymbols(p);b<h.length;b++)q.indexOf(h[b])<0&&Object.prototype.propertyIsEnumerable.call(p,h[b])&&(A[h[b]]=p[h[b]]);return A};const l=(p,q)=>{var A;const{prefixCls:h,className:b,rootClassName:ae,children:te,indeterminate:X=!1,style:ne,onMouseEnter:B,onMouseLeave:k,skipGroup:ue=!1,disabled:pe}=p,D=ye(p,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:re,direction:Ce,checkbox:a}=n.useContext(z.E_),o=n.useContext(ge),{isFormItemInput:v}=n.useContext(fe.aM),t=n.useContext(T.Z),e=(A=(o==null?void 0:o.disabled)||pe)!==null&&A!==void 0?A:t,C=n.useRef(D.value),E=n.useRef(null),d=(0,F.sQ)(q,E);n.useEffect(()=>{o==null||o.registerValue(D.value)},[]),n.useEffect(()=>{if(!ue)return D.value!==C.current&&(o==null||o.cancelValue(C.current),o==null||o.registerValue(D.value),C.current=D.value),()=>o==null?void 0:o.cancelValue(D.value)},[D.value]),n.useEffect(()=>{var $;!(($=E.current)===null||$===void 0)&&$.input&&(E.current.input.indeterminate=X)},[X]);const m=re("checkbox",h),Z=(0,de.Z)(m),[H,L,Y]=(0,ce.ZP)(m,Z),w=Object.assign({},D);o&&!ue&&(w.onChange=(...$)=>{D.onChange&&D.onChange.apply(D,$),o.toggleOption&&o.toggleOption({label:te,value:D.value})},w.name=o.name,w.checked=o.value.includes(D.value));const Q=R()(`${m}-wrapper`,{[`${m}-rtl`]:Ce==="rtl",[`${m}-wrapper-checked`]:w.checked,[`${m}-wrapper-disabled`]:e,[`${m}-wrapper-in-form-item`]:v},a==null?void 0:a.className,b,ae,Y,Z,L),s=R()({[`${m}-indeterminate`]:X},V.A,L),[y,P]=(0,se.Z)(w.onClick);return H(n.createElement(O.Z,{component:"Checkbox",disabled:e},n.createElement("label",{className:Q,style:Object.assign(Object.assign({},a==null?void 0:a.style),ne),onMouseEnter:B,onMouseLeave:k,onClick:y},n.createElement(J.Z,Object.assign({},w,{onClick:P,prefixCls:m,className:s,disabled:e,ref:d})),te!=null&&n.createElement("span",{className:`${m}-label`},te))))};var g=n.forwardRef(l),f=r(74902),c=r(98423),i=function(p,q){var A={};for(var h in p)Object.prototype.hasOwnProperty.call(p,h)&&q.indexOf(h)<0&&(A[h]=p[h]);if(p!=null&&typeof Object.getOwnPropertySymbols=="function")for(var b=0,h=Object.getOwnPropertySymbols(p);b<h.length;b++)q.indexOf(h[b])<0&&Object.prototype.propertyIsEnumerable.call(p,h[b])&&(A[h[b]]=p[h[b]]);return A},S=n.forwardRef((p,q)=>{const{defaultValue:A,children:h,options:b=[],prefixCls:ae,className:te,rootClassName:X,style:ne,onChange:B}=p,k=i(p,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:ue,direction:pe}=n.useContext(z.E_),[D,re]=n.useState(k.value||A||[]),[Ce,a]=n.useState([]);n.useEffect(()=>{"value"in k&&re(k.value||[])},[k.value]);const o=n.useMemo(()=>b.map(s=>typeof s=="string"||typeof s=="number"?{label:s,value:s}:s),[b]),v=s=>{a(y=>y.filter(P=>P!==s))},t=s=>{a(y=>[].concat((0,f.Z)(y),[s]))},e=s=>{const y=D.indexOf(s.value),P=(0,f.Z)(D);y===-1?P.push(s.value):P.splice(y,1),"value"in k||re(P),B==null||B(P.filter($=>Ce.includes($)).sort(($,N)=>{const W=o.findIndex(I=>I.value===$),G=o.findIndex(I=>I.value===N);return W-G}))},C=ue("checkbox",ae),E=`${C}-group`,d=(0,de.Z)(C),[m,Z,H]=(0,ce.ZP)(C,d),L=(0,c.Z)(k,["value","disabled"]),Y=b.length?o.map(s=>n.createElement(g,{prefixCls:C,key:s.value.toString(),disabled:"disabled"in s?s.disabled:k.disabled,value:s.value,checked:D.includes(s.value),onChange:s.onChange,className:R()(`${E}-item`,s.className),style:s.style,title:s.title,id:s.id,required:s.required},s.label)):h,w=n.useMemo(()=>({toggleOption:e,value:D,disabled:k.disabled,na
|
||
|
|
&:hover ${N}`]:{borderColor:t},[`${o}-input:focus-visible + ${N}`]:(0,x.oN)(a),[`${o}:hover::after, ${o}-wrapper:hover &::after`]:{visibility:"visible"},[`${o}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:I,height:I,marginBlockStart:$(1).mul(e).div(-2).equal({unit:!0}),marginInlineStart:$(1).mul(e).div(-2).equal({unit:!0}),backgroundColor:y,borderBlockStart:0,borderInlineStart:0,borderRadius:I,transform:"scale(0)",opacity:0,transition:`all ${C} ${d}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:I,height:I,backgroundColor:m,borderColor:Z,borderStyle:"solid",borderWidth:H,borderRadius:"50%",transition:`all ${E}`},[`${o}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${o}-checked`]:{[N]:{borderColor:t,backgroundColor:P,"&::after":{transform:`scale(${a.calc(a.dotSize).div(e).equal()})`,opacity:1,transition:`all ${C} ${d}`}}},[`${o}-disabled`]:{cursor:"not-allowed",[N]:{backgroundColor:L,borderColor:Z,cursor:"not-allowed","&::after":{backgroundColor:Q}},[`${o}-input`]:{cursor:"not-allowed"},[`${o}-disabled + span`]:{color:Y,cursor:"not-allowed"},[`&${o}-checked`]:{[N]:{"&::after":{transform:`scale(${$(G).div(e).equal()})`}}}},[`span${o} + *`]:{paddingInlineStart:w,paddingInlineEnd:w}})}},q=a=>{const{buttonColor:o,controlHeight:v,componentCls:t,lineWidth:e,lineType:C,colorBorder:E,motionDurationMid:d,buttonPaddingInline:m,fontSize:Z,buttonBg:H,fontSizeLG:L,controlHeightLG:Y,controlHeightSM:w,paddingXS:Q,borderRadius:s,borderRadiusSM:y,borderRadiusLG:P,buttonCheckedBg:$,buttonSolidCheckedColor:N,colorTextDisabled:W,colorBgContainerDisabled:G,buttonCheckedBgDisabled:I,buttonCheckedColorDisabled:be,colorPrimary:ie,colorPrimaryHover:ve,colorPrimaryActive:oe,buttonSolidCheckedBg:U,buttonSolidCheckedHoverBg:xe,buttonSolidCheckedActiveBg:he,calc:_}=a;return{[`${t}-button-wrapper`]:{position:"relative",display:"inline-block",height:v,margin:0,paddingInline:m,paddingBlock:0,color:o,fontSize:Z,lineHeight:(0,i.bf)(_(v).sub(_(e).mul(2)).equal()),background:H,border:`${(0,i.bf)(e)} ${C} ${E}`,borderBlockStartWidth:_(e).add(.02).equal(),borderInlineEndWidth:e,cursor:"pointer",transition:[`color ${d}`,`background ${d}`,`box-shadow ${d}`].join(","),a:{color:o},[`> ${t}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:_(e).mul(-1).equal()},"&:first-child":{borderInlineStart:`${(0,i.bf)(e)} ${C} ${E}`,borderStartStartRadius:s,borderEndStartRadius:s},"&:last-child":{borderStartEndRadius:s,borderEndEndRadius:s},"&:first-child:last-child":{borderRadius:s},[`${t}-group-large &`]:{height:Y,fontSize:L,lineHeight:(0,i.bf)(_(Y).sub(_(e).mul(2)).equal()),"&:first-child":{borderStartStartRadius:P,borderEndStartRadius:P},"&:last-child":{borderStartEndRadius:P,borderEndEndRadius:P}},[`${t}-group-small &`]:{height:w,paddingInline:_(Q).sub(e).equal(),paddingBlock:0,lineHeight:(0,i.bf)(_(w).sub(_(e).mul(2)).equal()),"&:first-child":{borderStartStartRadius:y,borderEndStartRadius:y},"&:last-child":{borderStartEndRadius:y,borderEndEndRadius:y}},"&:hover":{position:"relative",color:ie},"&:has(:focus-visible)":(0,x.oN)(a),[`${t}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${t}-button-wrapper-disabled)`]:{zIndex:1,color:ie,background:$,borderColor:ie,"&::before":{backgroundColor:ie},"&:first-child":{borderColor:ie},"&:hover":{color:ve,borderColor:ve,"&::before":{backgroundColor:ve}},"&:active":{color:oe,borderColor:oe,"&::before":{backgroundColor:oe}}},[`${t}-group-solid &-checked:not(${t}-button-wrapper-disabled)`]:{color:N,background:U,borderColor:U,"&:hover":{color:N,background:xe,borderColor:xe},"&:active":{color:N,background:he,borderColor:he}},"&-disabled":{color:W,backgroundColor:G,borderColor:E,cursor:"not-allowed","&:first-child, &:hover":{color:W,backgroundColor:G,borderColor:E}},[`&-disabled${t}-b
|