| 12 |
- import{d as A,an as re,r as z,w as q,a5 as m,a8 as K,f as O,a7 as D,a6 as N,ak as X,ac as J,aJ as ne,aH as ae,b2 as ie,aF as M,b3 as Q,aP as Y,aQ as le,aU as L,K as _,aS as U,aw as de,aN as G,aO as P,aM as H,b4 as se,D as ce}from"./index.932f1548.js";var ue=globalThis&&globalThis.__rest||function(e,r){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,o=Object.getOwnPropertySymbols(e);t<o.length;t++)r.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(n[o[t]]=e[o[t]]);return n};const be={prefixCls:String,name:String,id:String,type:String,defaultChecked:{type:[Boolean,Number],default:void 0},checked:{type:[Boolean,Number],default:void 0},disabled:Boolean,tabindex:{type:[Number,String]},readonly:Boolean,autofocus:Boolean,value:N.any,required:Boolean},pe=A({compatConfig:{MODE:3},name:"Checkbox",inheritAttrs:!1,props:re(be,{prefixCls:"rc-checkbox",type:"checkbox",defaultChecked:!1}),emits:["click","change"],setup(e,r){let{attrs:n,emit:o,expose:t}=r;const l=z(e.checked===void 0?e.defaultChecked:e.checked),s=z();q(()=>e.checked,()=>{l.value=e.checked}),t({focus(){var a;(a=s.value)===null||a===void 0||a.focus()},blur(){var a;(a=s.value)===null||a===void 0||a.blur()}});const $=z(),v=a=>{if(e.disabled)return;e.checked===void 0&&(l.value=a.target.checked),a.shiftKey=$.value;const b={target:m(m({},e),{checked:a.target.checked}),stopPropagation(){a.stopPropagation()},preventDefault(){a.preventDefault()},nativeEvent:a};e.checked!==void 0&&(s.value.checked=!!e.checked),o("change",b),$.value=!1},g=a=>{o("click",a),$.value=a.shiftKey};return()=>{const{prefixCls:a,name:b,id:C,type:B,disabled:u,readonly:f,tabindex:i,autofocus:k,value:p,required:h}=e,w=ue(e,["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"]),{class:d,onFocus:S,onBlur:R,onKeydown:c,onKeypress:y,onKeyup:T}=n,E=m(m({},w),n),W=Object.keys(E).reduce((V,j)=>((j.startsWith("data-")||j.startsWith("aria-")||j==="role")&&(V[j]=E[j]),V),{}),x=K(a,d,{[`${a}-checked`]:l.value,[`${a}-disabled`]:u}),F=m(m({name:b,id:C,type:B,readonly:f,disabled:u,tabindex:i,class:`${a}-input`,checked:!!l.value,autofocus:k,value:p},W),{onChange:v,onClick:g,onFocus:S,onBlur:R,onKeydown:c,onKeypress:y,onKeyup:T,required:h});return O("span",{class:x},[O("input",D({ref:s},F),null),O("span",{class:`${a}-inner`},null)])}}}),Z=Symbol("radioGroupContextKey"),he=e=>{X(Z,e)},ge=()=>J(Z,void 0),ee=Symbol("radioOptionTypeContextKey"),fe=e=>{X(ee,e)},ve=()=>J(ee,void 0),Ce=new ie("antRadioEffect",{"0%":{transform:"scale(1)",opacity:.5},"100%":{transform:"scale(1.6)",opacity:0}}),me=e=>{const{componentCls:r,antCls:n}=e,o=`${r}-group`;return{[o]:m(m({},M(e)),{display:"inline-block",fontSize:0,[`&${o}-rtl`]:{direction:"rtl"},[`${n}-badge ${n}-badge-count`]:{zIndex:1},[`> ${n}-badge:not(:first-child) > ${n}-button-wrapper`]:{borderInlineStart:"none"}})}},Se=e=>{const{componentCls:r,radioWrapperMarginRight:n,radioCheckedColor:o,radioSize:t,motionDurationSlow:l,motionDurationMid:s,motionEaseInOut:$,motionEaseInOutCirc:v,radioButtonBg:g,colorBorder:a,lineWidth:b,radioDotSize:C,colorBgContainerDisabled:B,colorTextDisabled:u,paddingXS:f,radioDotDisabledColor:i,lineType:k,radioDotDisabledSize:p,wireframe:h,colorWhite:w}=e,d=`${r}-inner`;return{[`${r}-wrapper`]:m(m({},M(e)),{position:"relative",display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:n,cursor:"pointer",[`&${r}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},[`${r}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${b}px ${k} ${o}`,borderRadius:"50%",visibility:"hidden",animationName:Ce,animationDuration:l,animationTimingFunction:$,animationFillMode:"both",content:'""'},[r]:m(m({},M(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center"}),[`${r}-wrapper:hover &,
- &:hover ${d}`]:{borderColor:o},[`${r}-input:focus-visible + ${d}`]:m({},Q(e)),[`${r}:hover::after, ${r}-wrapper:hover &::after`]:{visibility:"visible"},[`${r}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:t,height:t,marginBlockStart:t/-2,marginInlineStart:t/-2,backgroundColor:h?o:w,borderBlockStart:0,borderInlineStart:0,borderRadius:t,transform:"scale(0)",opacity:0,transition:`all ${l} ${v}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:t,height:t,backgroundColor:g,borderColor:a,borderStyle:"solid",borderWidth:b,borderRadius:"50%",transition:`all ${s}`},[`${r}-input`]:{position:"absolute",insetBlockStart:0,insetInlineEnd:0,insetBlockEnd:0,insetInlineStart:0,zIndex:1,cursor:"pointer",opacity:0},[`${r}-checked`]:{[d]:{borderColor:o,backgroundColor:h?g:o,"&::after":{transform:`scale(${C/t})`,opacity:1,transition:`all ${l} ${v}`}}},[`${r}-disabled`]:{cursor:"not-allowed",[d]:{backgroundColor:B,borderColor:a,cursor:"not-allowed","&::after":{backgroundColor:i}},[`${r}-input`]:{cursor:"not-allowed"},[`${r}-disabled + span`]:{color:u,cursor:"not-allowed"},[`&${r}-checked`]:{[d]:{"&::after":{transform:`scale(${p/t})`}}}},[`span${r} + *`]:{paddingInlineStart:f,paddingInlineEnd:f}})}},ke=e=>{const{radioButtonColor:r,controlHeight:n,componentCls:o,lineWidth:t,lineType:l,colorBorder:s,motionDurationSlow:$,motionDurationMid:v,radioButtonPaddingHorizontal:g,fontSize:a,radioButtonBg:b,fontSizeLG:C,controlHeightLG:B,controlHeightSM:u,paddingXS:f,borderRadius:i,borderRadiusSM:k,borderRadiusLG:p,radioCheckedColor:h,radioButtonCheckedBg:w,radioButtonHoverColor:d,radioButtonActiveColor:S,radioSolidCheckedColor:R,colorTextDisabled:c,colorBgContainerDisabled:y,radioDisabledButtonCheckedColor:T,radioDisabledButtonCheckedBg:E}=e;return{[`${o}-button-wrapper`]:{position:"relative",display:"inline-block",height:n,margin:0,paddingInline:g,paddingBlock:0,color:r,fontSize:a,lineHeight:`${n-t*2}px`,background:b,border:`${t}px ${l} ${s}`,borderBlockStartWidth:t+.02,borderInlineStartWidth:0,borderInlineEndWidth:t,cursor:"pointer",transition:[`color ${v}`,`background ${v}`,`border-color ${v}`,`box-shadow ${v}`].join(","),a:{color:r},[`> ${o}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:first-child)":{"&::before":{position:"absolute",insetBlockStart:-t,insetInlineStart:-t,display:"block",boxSizing:"content-box",width:1,height:"100%",paddingBlock:t,paddingInline:0,backgroundColor:s,transition:`background-color ${$}`,content:'""'}},"&:first-child":{borderInlineStart:`${t}px ${l} ${s}`,borderStartStartRadius:i,borderEndStartRadius:i},"&:last-child":{borderStartEndRadius:i,borderEndEndRadius:i},"&:first-child:last-child":{borderRadius:i},[`${o}-group-large &`]:{height:B,fontSize:C,lineHeight:`${B-t*2}px`,"&:first-child":{borderStartStartRadius:p,borderEndStartRadius:p},"&:last-child":{borderStartEndRadius:p,borderEndEndRadius:p}},[`${o}-group-small &`]:{height:u,paddingInline:f-t,paddingBlock:0,lineHeight:`${u-t*2}px`,"&:first-child":{borderStartStartRadius:k,borderEndStartRadius:k},"&:last-child":{borderStartEndRadius:k,borderEndEndRadius:k}},"&:hover":{position:"relative",color:h},"&:has(:focus-visible)":m({},Q(e)),[`${o}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${o}-button-wrapper-disabled)`]:{zIndex:1,color:h,background:w,borderColor:h,"&::before":{backgroundColor:h},"&:first-child":{borderColor:h},"&:hover":{color:d,borderColor:d,"&::before":{backgroundColor:d}},"&:active":{color:S,borderColor:S,"&::before":{backgroundColor:S}}},[`${o}-group-solid &-checked:not(${o}-button-wrapper-disabled)`]:{color:R,background:h,borderColor:h,"&:hover":{color:R,background:d,borderColor:d},"&:active":{color:R,background:S,borderColor:S}},"&-disabled":{color:c,backgroundColor:y,borderColor:s,cursor:"not-allowed","&:first-child, &:hover":{color:c,backgroundColor:y,borderColor:s}},[`&-disabled${o}-button-wrapper-checked`]:{color:T,backgroundColor:E,borderColor:s,boxShadow:"none"}}}},oe=ne("Radio",e=>{const{padding:r,lineWidth:n,controlItemBgActiveDisabled:o,colorTextDisabled:t,colorBgContainer:l,fontSizeLG:s,controlOutline:$,colorPrimaryHover:v,colorPrimaryActive:g,colorText:a,colorPrimary:b,marginXS:C,controlOutlineWidth:B,colorTextLightSolid:u,wireframe:f}=e,i=`0 0 0 ${B}px ${$}`,k=i,p=s,h=4,w=p-h*2,d=f?w:p-(h+n)*2,S=b,R=a,c=v,y=g,T=r-n,x=ae(e,{radioFocusShadow:i,radioButtonFocusShadow:k,radioSize:p,radioDotSize:d,radioDotDisabledSize:w,radioCheckedColor:S,radioDotDisabledColor:t,radioSolidCheckedColor:u,radioButtonBg:l,radioButtonCheckedBg:l,radioButtonColor:R,radioButtonHoverColor:c,radioButtonActiveColor:y,radioButtonPaddingHorizontal:T,radioDisabledButtonCheckedBg:o,radioDisabledButtonCheckedColor:t,radioWrapperMarginRight:C});return[me(x),Se(x),ke(x)]});var ye=globalThis&&globalThis.__rest||function(e,r){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,o=Object.getOwnPropertySymbols(e);t<o.length;t++)r.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(e,o[t])&&(n[o[t]]=e[o[t]]);return n};const te=()=>({prefixCls:String,checked:G(),disabled:G(),isGroup:G(),value:N.any,name:String,id:String,autofocus:G(),onChange:P(),onFocus:P(),onBlur:P(),onClick:P(),"onUpdate:checked":P(),"onUpdate:value":P()}),I=A({compatConfig:{MODE:3},name:"ARadio",inheritAttrs:!1,props:te(),setup(e,r){let{emit:n,expose:o,slots:t,attrs:l}=r;const s=Y(),$=le.useInject(),v=ve(),g=ge(),a=L(),b=_(()=>{var c;return(c=f.value)!==null&&c!==void 0?c:a.value}),C=z(),{prefixCls:B,direction:u,disabled:f}=U("radio",e),i=_(()=>(g==null?void 0:g.optionType.value)==="button"||v==="button"?`${B.value}-button`:B.value),k=L(),[p,h]=oe(B);o({focus:()=>{C.value.focus()},blur:()=>{C.value.blur()}});const S=c=>{const y=c.target.checked;n("update:checked",y),n("update:value",y),n("change",c),s.onFieldChange()},R=c=>{n("change",c),g&&g.onChange&&g.onChange(c)};return()=>{var c;const y=g,{prefixCls:T,id:E=s.id.value}=e,W=ye(e,["prefixCls","id"]),x=m(m({prefixCls:i.value,id:E},de(W,["onUpdate:checked","onUpdate:value"])),{disabled:(c=f.value)!==null&&c!==void 0?c:k.value});y?(x.name=y.name.value,x.onChange=R,x.checked=e.value===y.value.value,x.disabled=b.value||y.disabled.value):x.onChange=S;const F=K({[`${i.value}-wrapper`]:!0,[`${i.value}-wrapper-checked`]:x.checked,[`${i.value}-wrapper-disabled`]:x.disabled,[`${i.value}-wrapper-rtl`]:u.value==="rtl",[`${i.value}-wrapper-in-form-item`]:$.isFormItemInput},l.class,h.value);return p(O("label",D(D({},l),{},{class:F}),[O(pe,D(D({},x),{},{type:"radio",ref:C}),null),t.default&&O("span",null,[t.default()])]))}}}),xe=()=>({prefixCls:String,value:N.any,size:H(),options:se(),disabled:G(),name:String,buttonStyle:H("outline"),id:String,optionType:H("default"),onChange:P(),"onUpdate:value":P()}),$e=A({compatConfig:{MODE:3},name:"ARadioGroup",inheritAttrs:!1,props:xe(),setup(e,r){let{slots:n,emit:o,attrs:t}=r;const l=Y(),{prefixCls:s,direction:$,size:v}=U("radio",e),[g,a]=oe(s),b=z(e.value),C=z(!1);return q(()=>e.value,u=>{b.value=u,C.value=!1}),he({onChange:u=>{const f=b.value,{value:i}=u.target;"value"in e||(b.value=i),!C.value&&i!==f&&(C.value=!0,o("update:value",i),o("change",u),l.onFieldChange()),ce(()=>{C.value=!1})},value:b,disabled:_(()=>e.disabled),name:_(()=>e.name),optionType:_(()=>e.optionType)}),()=>{var u;const{options:f,buttonStyle:i,id:k=l.id.value}=e,p=`${s.value}-group`,h=K(p,`${p}-${i}`,{[`${p}-${v.value}`]:v.value,[`${p}-rtl`]:$.value==="rtl"},t.class,a.value);let w=null;return f&&f.length>0?w=f.map(d=>{if(typeof d=="string"||typeof d=="number")return O(I,{key:d,prefixCls:s.value,disabled:e.disabled,value:d,checked:b.value===d},{default:()=>[d]});const{value:S,disabled:R,label:c}=d;return O(I,{key:`radio-group-value-options-${S}`,prefixCls:s.value,disabled:R||e.disabled,value:S,checked:b.value===S},{default:()=>[c]})}):w=(u=n.default)===null||u===void 0?void 0:u.call(n),g(O("div",D(D({},t),{},{class:h,id:k}),[w]))}}}),Be=A({compatConfig:{MODE:3},name:"ARadioButton",inheritAttrs:!1,props:te(),setup(e,r){let{slots:n,attrs:o}=r;const{prefixCls:t}=U("radio",e);return fe("button"),()=>{var l;return O(I,D(D(D({},o),e),{},{prefixCls:t.value}),{default:()=>[(l=n.default)===null||l===void 0?void 0:l.call(n)]})}}});I.Group=$e;I.Button=Be;I.install=function(e){return e.component(I.name,I),e.component(I.Group.name,I.Group),e.component(I.Button.name,I.Button),e};export{I as R,pe as V,$e as a,Be as b};
|