import{s as j,cq as M,aH as R,y as u,v as k,w as q,df as $,ai as z,f as o,K as y,L as A,z as D,D as H}from"./index-DT8qTvyx.js";var I=function(r){j(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(){var b,g,i=this.props,h=i.defaultValue,_=i.className,S=i.style,O=i.placeholder,v=i.classnames,p=i.data,E=M(e.defaultProps.map,(b=this.props)===null||b===void 0?void 0:b.map),F=M(e.defaultProps.labelMap,(g=this.props)===null||g===void 0?void 0:g.labelMap),s={};E&&Object.entries(E).forEach(function(m){var n=R(m,2),t=n[0],f=n[1];s[t]?s[t]=u(u({},s[t]),{icon:f}):s[t]={icon:f}}),F&&Object.entries(F).forEach(function(m){var n=R(m,2),t=n[0],f=n[1];s[t]?s[t]=u(u({},s[t]),{label:f}):s[t]={label:f}});var c=this.props.source||{};k(c)&&(c=q(c,p,"| raw")),c=$(s,c);var a=z(this.props);h&&k(h)&&(a=q(h,p,"| raw")),a!=null&&a!==""&&(typeof a=="boolean"?a=a?1:0:/^\d+$/.test(a)&&(a=parseInt(a,10)||0));var l=c[a]||{};if(!l.icon&&!l.label)return o.createElement("span",{className:v("StatusField",_),style:S},o.createElement("span",{className:"text-muted",key:"status-value"},O));var N="",P=null;if(l.icon){N="StatusField--".concat(a);var d=l.icon,x="",V="";typeof d=="string"&&(d=y(d,p)||"",V=d.replace(/\bsvg-([^\s|$]+)\b/g,function(m,n){return x=n,"icon"})),P=o.createElement(A,{cx:v,icon:x||d,className:"Status-icon icon",classNameProp:V,key:"icon"})}var w=null;return l.label!==""&&l.label!=null&&(w=o.createElement("span",{className:v("StatusField-label"),key:"label"},y(""+l.label,p))),o.createElement("span",{className:v("StatusField",N,_,l.className),style:u(u({},S),l.color?{color:y(l.color,p)}:{})},P,w)},e.defaultProps={placeholder:"-",map:{0:"svg-fail",1:"svg-success",success:"svg-success",pending:"rolling",fail:"svg-fail",queue:"svg-warning",schedule:"svg-schedule"},labelMap:{success:"成功",pending:"运行中",fail:"失败",queue:"排队中",schedule:"调度中"}},e}(o.Component),L=function(r){j(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e=D([H({type:"status"})],e),e}(I);export{I as StatusField,L as StatusFieldRenderer};
