Col-c05b789a.js 7.5 KB

1
  1. import{bo as X,bp as Y,az as Z,bq as ee,d as B,i as ae,r as A,w as te,s as E,b as y,h as O,_ as c,c as _,P as q,V as ne,f as V,u as K,I as re,a as N,p as oe,t as M,o as ue,y as F,g as ce}from"./index-c0ea9eee.js";import{u as ie,R as $,r as D}from"./useFlexGapSupport-20a12060.js";function ke(l){return X(l)||Y(l)||Z(l)||ee()}var le=["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"],se={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:q.any,required:Boolean};const de=B({compatConfig:{MODE:3},name:"Checkbox",inheritAttrs:!1,props:ae(se,{prefixCls:"rc-checkbox",type:"checkbox",defaultChecked:!1}),emits:["click","change"],setup:function(e,C){var s=C.attrs,k=C.emit,h=C.expose,S=A(e.checked===void 0?e.defaultChecked:e.checked),g=A();te(function(){return e.checked},function(){S.value=e.checked}),h({focus:function(){var n;(n=g.value)===null||n===void 0||n.focus()},blur:function(){var n;(n=g.value)===null||n===void 0||n.blur()}});var v=A(),j=function(n){if(!e.disabled){e.checked===void 0&&(S.value=n.target.checked),n.shiftKey=v.value;var a={target:y(y({},e),{},{checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n};e.checked!==void 0&&(g.value.checked=!!e.checked),k("change",a),v.value=!1}},m=function(n){k("click",n),v.value=n.shiftKey};return function(){var p,n=e.prefixCls,a=e.name,t=e.id,o=e.type,r=e.disabled,u=e.readonly,b=e.tabindex,i=e.autofocus,w=e.value,f=e.required,x=E(e,le),d=s.class,P=s.onFocus,U=s.onBlur,W=s.onKeydown,L=s.onKeypress,H=s.onKeyup,G=y(y({},x),s),z=Object.keys(G).reduce(function(I,R){return(R.substr(0,5)==="aria-"||R.substr(0,5)==="data-"||R==="role")&&(I[R]=G[R]),I},{}),J=O(n,d,(p={},c(p,"".concat(n,"-checked"),S.value),c(p,"".concat(n,"-disabled"),r),p)),Q=y(y({name:a,id:t,type:o,readonly:u,disabled:r,tabindex:b,class:"".concat(n,"-input"),checked:!!S.value,autofocus:i,value:w},z),{},{onChange:j,onClick:m,onFocus:P,onBlur:U,onKeydown:W,onKeypress:L,onKeyup:H,required:f});return _("span",{class:J},[_("input",y({ref:g},Q),null),_("span",{class:"".concat(n,"-inner")},null)])}}});var fe=["prefixCls","id"],ve=function(){return{prefixCls:String,checked:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},isGroup:{type:Boolean,default:void 0},value:q.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}};const Se=B({compatConfig:{MODE:3},name:"ARadio",props:ve(),setup:function(e,C){var s=C.emit,k=C.expose,h=C.slots,S=ne(),g=A(),v=V("radioGroupContext",void 0),j=K("radio",e),m=j.prefixCls,p=j.direction,n=function(){g.value.focus()},a=function(){g.value.blur()};k({focus:n,blur:a});var t=function(u){var b=u.target.checked;s("update:checked",b),s("update:value",b),s("change",u),S.onFieldChange()},o=function(u){s("change",u),v&&v.onRadioChange&&v.onRadioChange(u)};return function(){var r,u=v;e.prefixCls;var b=e.id,i=b===void 0?S.id.value:b,w=E(e,fe),f=y({prefixCls:m.value,id:i},re(w,["onUpdate:checked","onUpdate:value"]));u?(f.name=u.props.name,f.onChange=o,f.checked=e.value===u.stateValue.value,f.disabled=e.disabled||u.props.disabled):f.onChange=t;var x=O((r={},c(r,"".concat(m.value,"-wrapper"),!0),c(r,"".concat(m.value,"-wrapper-checked"),f.checked),c(r,"".concat(m.value,"-wrapper-disabled"),f.disabled),c(r,"".concat(m.value,"-wrapper-rtl"),p.value==="rtl"),r));return _("label",{class:x},[_(de,y(y({},f),{},{type:"radio",ref:g}),null),h.default&&_("span",null,[h.default()])])}}});var T=Symbol("rowContextKey"),pe=function(e){oe(T,e)},ge=function(){return V(T,{gutter:N(function(){}),wrap:N(function(){}),supportFlexGap:N(function(){})})};M("top","middle","bottom","stretch");M("start","end","center","space-around","space-between");var be=function(){return{align:String,justify:String,prefixCls:String,gutter:{type:[Number,Array,Object],default:0},wrap:{type:Boolean,default:void 0}}},he=B({compatConfig:{MODE:3},name:"ARow",props:be(),setup:function(e,C){var s=C.slots,k=K("row",e),h=k.prefixCls,S=k.direction,g,v=A({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0,xxxl:!0}),j=ie();ue(function(){g=$.subscribe(function(a){var t=e.gutter||0;(!Array.isArray(t)&&F(t)==="object"||Array.isArray(t)&&(F(t[0])==="object"||F(t[1])==="object"))&&(v.value=a)})}),ce(function(){$.unsubscribe(g)});var m=N(function(){var a=[0,0],t=e.gutter,o=t===void 0?0:t,r=Array.isArray(o)?o:[o,0];return r.forEach(function(u,b){if(F(u)==="object")for(var i=0;i<D.length;i++){var w=D[i];if(v.value[w]&&u[w]!==void 0){a[b]=u[w];break}}else a[b]=u||0}),a});pe({gutter:m,supportFlexGap:j,wrap:N(function(){return e.wrap})});var p=N(function(){var a;return O(h.value,(a={},c(a,"".concat(h.value,"-no-wrap"),e.wrap===!1),c(a,"".concat(h.value,"-").concat(e.justify),e.justify),c(a,"".concat(h.value,"-").concat(e.align),e.align),c(a,"".concat(h.value,"-rtl"),S.value==="rtl"),a))}),n=N(function(){var a=m.value,t={},o=a[0]>0?"".concat(a[0]/-2,"px"):void 0,r=a[1]>0?"".concat(a[1]/-2,"px"):void 0;return o&&(t.marginLeft=o,t.marginRight=o),j.value?t.rowGap="".concat(a[1],"px"):r&&(t.marginTop=r,t.marginBottom=r),t});return function(){var a;return _("div",{class:p.value,style:n.value},[(a=s.default)===null||a===void 0?void 0:a.call(s)])}}});const we=he;function me(l){return typeof l=="number"?"".concat(l," ").concat(l," auto"):/^\d+(\.\d+)?(px|em|rem|%)$/.test(l)?"0 0 ".concat(l):l}var xe=function(){return{span:[String,Number],order:[String,Number],offset:[String,Number],push:[String,Number],pull:[String,Number],xs:{type:[String,Number,Object],default:void 0},sm:{type:[String,Number,Object],default:void 0},md:{type:[String,Number,Object],default:void 0},lg:{type:[String,Number,Object],default:void 0},xl:{type:[String,Number,Object],default:void 0},xxl:{type:[String,Number,Object],default:void 0},xxxl:{type:[String,Number,Object],default:void 0},prefixCls:String,flex:[String,Number]}};const je=B({compatConfig:{MODE:3},name:"ACol",props:xe(),setup:function(e,C){var s=C.slots,k=ge(),h=k.gutter,S=k.supportFlexGap,g=k.wrap,v=K("col",e),j=v.prefixCls,m=v.direction,p=N(function(){var a,t=e.span,o=e.order,r=e.offset,u=e.push,b=e.pull,i=j.value,w={};return["xs","sm","md","lg","xl","xxl","xxxl"].forEach(function(f){var x,d={},P=e[f];typeof P=="number"?d.span=P:F(P)==="object"&&(d=P||{}),w=y(y({},w),{},(x={},c(x,"".concat(i,"-").concat(f,"-").concat(d.span),d.span!==void 0),c(x,"".concat(i,"-").concat(f,"-order-").concat(d.order),d.order||d.order===0),c(x,"".concat(i,"-").concat(f,"-offset-").concat(d.offset),d.offset||d.offset===0),c(x,"".concat(i,"-").concat(f,"-push-").concat(d.push),d.push||d.push===0),c(x,"".concat(i,"-").concat(f,"-pull-").concat(d.pull),d.pull||d.pull===0),c(x,"".concat(i,"-rtl"),m.value==="rtl"),x))}),O(i,(a={},c(a,"".concat(i,"-").concat(t),t!==void 0),c(a,"".concat(i,"-order-").concat(o),o),c(a,"".concat(i,"-offset-").concat(r),r),c(a,"".concat(i,"-push-").concat(u),u),c(a,"".concat(i,"-pull-").concat(b),b),a),w)}),n=N(function(){var a=e.flex,t=h.value,o={};if(t&&t[0]>0){var r="".concat(t[0]/2,"px");o.paddingLeft=r,o.paddingRight=r}if(t&&t[1]>0&&!S.value){var u="".concat(t[1]/2,"px");o.paddingTop=u,o.paddingBottom=u}return a&&(o.flex=me(a),g.value===!1&&!o.minWidth&&(o.minWidth=0)),o});return function(){var a;return _("div",{class:p.value,style:n.value},[(a=s.default)===null||a===void 0?void 0:a.call(s)])}}});export{je as C,Se as R,de as V,ke as _,we as a,ve as r};