import{a as S,n as b,y as s}from"./vue-core-Di3IuVqe.js";function h(m,a,g={}){const{modeModification:l,entete:R,aDesDonnees:v,onCommit:c,apresCommit:f}=g,C=v||(n=>Object.keys(a).some(o=>{const e=n[o],t=a[o];return e==null?!1:typeof e=="number"?e!==0&&e!==t:typeof e=="string"?e.trim()!==""&&e!==t:e!==t})),u=()=>({...a,_entryRow:!0}),i=S([u()]),d=()=>{const n=i.value[0];if(n)for(const o of Object.keys(a))n[o]=a[o];else i.value=[u()]},p=s(()=>(l?l.value:!0)&&!R?.value?.valide),D=s(()=>p.value?i.value:[]),E=s(()=>p.value?i.value:[]),P=n=>{const o=n?.getAllDisplayedColumns?.()||[];return(o.find(t=>{const r=t.getColDef?.()||{};return r.editable===!0||typeof r.editable=="function"})||o[0])?.getColId?.()};return{entryRowData:i,pinnedBottomData:D,pinnedTopData:E,reinitEntryRow:d,interceptEntryRow:n=>!!n?.data?._entryRow,onEntryKeyDown:async n=>{if(!n?.data?._entryRow)return;const o=n.event;if(!o||o.key!=="Enter")return;o.preventDefault?.(),o.stopPropagation?.();const e=n.api,t=n.node?.rowPinned;if(e?.stopEditing?.(),!C(n.data))return;const r={...n.data};if(delete r._entryRow,c&&c(r),m.value.unshift(r),f&&f(r),d(),await b(),e){const y=e.getPinnedTopRow?.(0);y&&e.refreshCells({rowNodes:[y],force:!0}),e.clearCellSelection?.(),e.clearRangeSelection?.();const w=P(e);try{e.setFocusedCell(0,w,t),e.startEditingCell({rowIndex:0,colKey:w,rowPinned:t})}catch{}}},isLigneFantome:()=>!1,assurerLigneFantome:()=>{},filtrerPourSauvegarde:n=>n,rowDragFn:()=>!0,rowClassRules:{}}}export{h as u};
