import{s as q,ct as w,aI as M,y as u,v as R,w as j,dk as O,ai as $,f as o,K as y,L as z,z as A,D}from"./index-BPRWoLf4.js";var K=function(r){q(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,I=i.placeholder,v=i.classnames,p=i.data,E=w(e.defaultProps.map,(b=this.props)===null||b===void 0?void 0:b.map),F=w(e.defaultProps.labelMap,(g=this.props)===null||g===void 0?void 0:g.labelMap),s={};E&&Object.entries(E).forEach(function(m){var n=M(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=M(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||{};R(c)&&(c=j(c,p,"| raw")),c=O(s,c);var a=$(this.props);h&&R(h)&&(a=j(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"},I));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(z,{cx:v,icon:x||d,className:"Status-icon icon",classNameProp:V,key:"icon"})}var k=null;return l.label!==""&&l.label!=null&&(k=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,k)},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),B=function(r){q(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e=A([D({type:"status"})],e),e}(K);export{K as StatusField,B as StatusFieldRenderer};
