import{a as D,n as y,y as R}from"./vue-core-Di3IuVqe.js";function N(n,o,m){const{modeModification:v,entete:L,indexLigneRef:t,ligneSelectionneeRef:p,appliquerArticle:C,chargerArticleComplet:E,focusApresAjout:d,champCode:f="code_art",champLibelle:g="libelle"}=m,w=()=>({...o,_entryRow:!0}),l=D([w()]),u=()=>{const e=l.value[0];if(e)for(const c of Object.keys(o))e[c]=o[c];else l.value=[w()]},x=R(()=>v.value&&!L?.value?.valide?l.value:[]);return{entryRowData:l,pinnedTopData:x,reinitEntryRow:u,interceptEntryRow:async e=>{if(!(e?.node?.rowPinned==="top"&&e?.data?._entryRow))return!1;if(e?.colDef?.field===f&&e?.newValue){const s=e.newValue,a=await E(s);if(u(),!a)return!0;const r={...o,nligne:n.value.length+1,qte:1};n.value.push(r);const i=n.value.length-1;t&&(t.value=i),p.value=n.value[i],await C(a),await y();const h=e.api.getPinnedTopRow?.(0);return h&&e.api.refreshCells({rowNodes:[h],force:!0}),d&&d(),!0}if(e?.colDef?.field===g&&(e?.newValue||"").toString().trim()){const s=e.newValue;u();const a={...o,nligne:n.value.length+1};a[g]=s,n.value.push(a);const r=n.value.length-1;t&&(t.value=r),p.value=n.value[r],await y();try{const i=e.api.getPinnedTopRow?.(0);i&&e.api.refreshCells({rowNodes:[i],force:!0}),e.api.setFocusedCell(0,f,"top")}catch{}return!0}return!0},isLigneFantome:()=>!1,assurerLigneFantome:()=>{},filtrerPourSauvegarde:e=>e,rowDragFn:()=>!0,rowClassRules:{}}}export{N as u};
