import{C as g}from"./tmagic-core-DwMmMg7V.js";import{u as C,a as V,_ as I,b as y,r as k}from"./plugin-vueexport-helper-CYignUIG.js";import"./index-kuiGTNrJ.js";import"./tmagic-dep-DSKLZ87U.js";const N=VueDemi.defineComponent({name:"tmagic-iterator-container-item",props:{config:{type:Object,required:!0},iteratorIndex:Array,iteratorContainerId:Array,containerIndex:Number,index:Number,model:{type:Object,default:()=>({})}},setup(e){const t=VueDemi.inject("app"),i=C({componentType:"container",app:t}),{style:c,className:s}=V(e);return{style:c,className:s,containerComponent:i}}});function $(e,t,i,c,s,r){return Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(e.containerComponent),{style:Vue.normalizeStyle(e.style),class:Vue.normalizeClass(e.className),config:e.config,"iterator-index":e.iteratorIndex,"iterator-container-id":e.iteratorContainerId},null,8,["style","class","config","iterator-index","iterator-container-id"])}const b=I(N,[["render",$]]),B=VueDemi.defineComponent({name:"tmagic-iterator-container",components:{IteratorItem:b},props:{config:{type:Object,required:!0},iteratorIndex:Array,iteratorContainerId:Array,containerIndex:Number,model:{type:Object,default:()=>({})}},setup(e){const t=VueDemi.inject("app"),i=y(e,t);k(i);const c=VueDemi.computed(()=>{let{iteratorData:r=[]}=e.config;const{itemConfig:n,dsField:o,items:a}=e.config;return Array.isArray(r)||(r=[]),(t==null?void 0:t.platform)==="editor"&&!r.length&&r.push({}),r.map(d=>{var m,u,l,f;const p=(t==null?void 0:t.platform)!=="editor"&&(u=(m=t==null?void 0:t.dataSourceManager)==null?void 0:m.compliedIteratorItemConds(d,n,o))!=null?u:!0;return{items:(f=(l=t==null?void 0:t.dataSourceManager)==null?void 0:l.compliedIteratorItems(d,a,o))!=null?f:a,condResult:p,style:{position:"relative",left:0,top:0,...n.style}}})});return VueDemi.watch(c,r=>{if(!e.config.id)return;const n=t==null?void 0:t.getNode(e.config.id,e.iteratorContainerId,e.iteratorIndex);n&&(n.resetNodes(),r.forEach((o,a)=>{n.setNodes(o.items,a)}))},{immediate:!0}),{configs:c,clickHandler:()=>{t&&i&&t.emit("".concat(g,"click"),i)}}}});function D(e,t,i,c,s,r){const n=Vue.resolveComponent("IteratorItem");return Vue.openBlock(),Vue.createElementBlock("div",{onClick:t[0]||(t[0]=(...o)=>e.clickHandler&&e.clickHandler(...o))},[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(e.configs,(o,a)=>(Vue.openBlock(),Vue.createBlock(n,{key:a,config:o,"iterator-index":[...e.iteratorIndex||[],a],"iterator-container-id":e.config.id?[...e.iteratorContainerId||[],e.config.id]:[...e.iteratorContainerId||[]]},null,8,["config","iterator-index","iterator-container-id"]))),128))])}const h=I(B,[["render",D]]);export{h as default};
//# sourceMappingURL=IteratorContainer-mcyMZomT.js.map
