2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{a as _,aH as w,r as B,Z as I,a3 as R,aJ as S,_ as l,c2 as V,a2 as G,V as u,p,ai as U}from"./index.d96edf17.js";import{V as N}from"./Checkbox.bd14fc7b.js";var A=["prefixCls","id"],D=function(){return{prefixCls:String,checked:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},isGroup:{type:Boolean,default:void 0},value:U.any,name:String,id:String,autofocus:{type:Boolean,default:void 0},onChange:Function,onFocus:Function,onBlur:Function,onClick:Function,"onUpdate:checked":Function,"onUpdate:value":Function}},J=_({compatConfig:{MODE:3},name:"ARadio",props:D(),setup:function(o,c){var i=c.emit,g=c.expose,f=c.slots,v=w(),s=B(),d=I("radioGroupContext",void 0),C=R("radio",o),r=C.prefixCls,m=C.direction,x=function(){s.value.focus()},b=function(){s.value.blur()};g({focus:x,blur:b});var k=function(a){var t=a.target.checked;i("update:checked",t),i("update:value",t),i("change",a),v.onFieldChange()},F=function(a){i("change",a),d&&d.onRadioChange&&d.onRadioChange(a)};return function(){var e,a=d;o.prefixCls;var t=o.id,y=t===void 0?v.id.value:t,P=S(o,A),n=l({prefixCls:r.value,id:y},V(P,["onUpdate:checked","onUpdate:value"]));a?(n.name=a.props.name,n.onChange=F,n.checked=o.value===a.stateValue.value,n.disabled=o.disabled||a.props.disabled):n.onChange=k;var j=G((e={},u(e,"".concat(r.value,"-wrapper"),!0),u(e,"".concat(r.value,"-wrapper-checked"),n.checked),u(e,"".concat(r.value,"-wrapper-disabled"),n.disabled),u(e,"".concat(r.value,"-wrapper-rtl"),m.value==="rtl"),e));return p("label",{class:j},[p(N,l(l({},n),{},{type:"radio",ref:s}),null),f.default&&p("span",null,[f.default()])])}}});export{J as R,D as r};
|