import{s as b,ai as S,ao as K,v as R,w as E,f as c,ad as j,y as i,b0 as k,ae as O,z as P,D as V,a3 as D}from"./index-DT8qTvyx.js";function z(a){var t=a.render,h=a.data,e=a.items,r=a.item,u=a.name,m=a.index,y=a.itemKeyName,p=a.indexKeyName,v=c.useMemo(function(){var d,l;return D(h,i(i({},K(r)?i({index:m},r):(d={},d[u]=r,d)),(l={},l[y||"item"]=r,l[p||"index"]=m,l)))},[r,h,u,m,y,p]);return t("item/".concat(m),e,{data:v})}var F=function(a){b(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t.prototype.render=function(){var h=this,e=this.props,r=e.data,u=e.name,m=e.className,y=e.style,p=e.render,v=e.items,d=e.itemKeyName,l=e.indexKeyName,_=e.placeholder,f=e.classnames,A=e.translate,w=e.env,x=e.id,L=e.wrapperCustomStyle,C=e.themeCss,o=S(this.props,function(s){return s.source?E(s.source,s.data,"| raw"):void 0}),n=K(o)?Object.keys(o).map(function(s){return{key:s,value:o[s]}}):Array.isArray(o)?o:[],N=R(this.props.maxLength)?E(this.props.maxLength,this.props.data)||0:this.props.maxLength;return Array.isArray(n)&&N>=1&&n.length>N&&(n=n.slice(0,N)),c.createElement("div",{className:f("Each",m,j(i(i({},this.props),{name:"baseControlClassName",id:x,themeCss:C}))),style:k(y,r)},Array.isArray(n)&&n.length&&v?n.map(function(s,g){return c.createElement(z,i({},h.props,{items:v,key:g,index:g,data:r,item:s,name:u,itemKeyName:d,indexKeyName:l}))}):c.createElement("div",{className:f("Each-placeholder")},p("placeholder",A(_))),c.createElement(O,i({},this.props,{config:{wrapperCustomStyle:L,id:x,themeCss:C,classNames:[{key:"baseControlClassName"}]},env:w})))},t.propsList=["name","items","value"],t.defaultProps={className:"",placeholder:"placeholder.noData"},t}(c.Component),M=function(a){b(t,a);function t(){return a!==null&&a.apply(this,arguments)||this}return t=P([V({type:"each"})],t),t}(F);export{M as EachRenderer,F as default};
