@nice2dev/ui 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +198 -0
- package/dist/NiceErrorBoundary-B0262Ffc.js +770 -0
- package/dist/NiceErrorBoundary-BNhkOZtq.cjs +1 -0
- package/dist/NiceErrorBoundary-BXOLv-zG.cjs +1 -0
- package/dist/NiceErrorBoundary-DsreAsON.cjs +1 -0
- package/dist/NiceErrorBoundary-DyPWyuki.js +770 -0
- package/dist/NiceErrorBoundary-HMfrXIir.js +770 -0
- package/dist/NiceForm-B7D1MASh.js +5383 -0
- package/dist/NiceForm-BA9zZdm8.cjs +382 -0
- package/dist/NiceForm-Ba9rvBoT.cjs +382 -0
- package/dist/NiceForm-DAGMJpgx.js +5383 -0
- package/dist/NiceForm-D_ifvkIf.js +5386 -0
- package/dist/NiceForm-kd4essRP.cjs +382 -0
- package/dist/NiceForm.css +1 -1
- package/dist/NiceModal-4DLpDmAl.js +95 -0
- package/dist/NiceModal-BVT9cZbf.cjs +1 -0
- package/dist/NiceModal-CiOYOWJy.cjs +1 -0
- package/dist/NiceModal-D2xJTZZf.cjs +1 -0
- package/dist/NiceModal-DZbHCdKq.js +95 -0
- package/dist/NiceModal-MeC1cNtW.js +95 -0
- package/dist/NiceModuleLifecyclePanel-BZMUuDad.js +6807 -0
- package/dist/NiceModuleLifecyclePanel-BiX4KxaK.js +6781 -0
- package/dist/NiceModuleLifecyclePanel-C54g5eV_.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CDo0iVfr.js +6781 -0
- package/dist/NiceModuleLifecyclePanel-DEJpoz5a.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DrDTpH6K.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-3be3_sVK.js +171 -0
- package/dist/NicePagination-BCRsVzkR.cjs +1 -0
- package/dist/NicePagination-C8gx6Bcl.js +171 -0
- package/dist/NicePagination-CNxEAb4C.cjs +1 -0
- package/dist/NicePagination-Cg_WEf-R.cjs +1 -0
- package/dist/NicePagination-DQXdzx7W.js +171 -0
- package/dist/NicePinCodeInput-3WugpLHi.js +12240 -0
- package/dist/NicePinCodeInput-BD2bMmVF.cjs +696 -0
- package/dist/NicePinCodeInput-CSfRHs4v.cjs +419 -0
- package/dist/NicePinCodeInput-CjwFvOEQ.js +13092 -0
- package/dist/NicePinCodeInput-DCLRLR8a.js +13097 -0
- package/dist/NicePinCodeInput-DoBQnMj9.cjs +694 -0
- package/dist/NiceSavedQueryPanel-DFDDuKWd.js +6597 -0
- package/dist/NiceSavedQueryPanel-DT9v7kUB.cjs +596 -0
- package/dist/NiceSavedQueryPanel-DTU4eiIH.cjs +596 -0
- package/dist/NiceSavedQueryPanel-RLj3BnDR.js +6866 -0
- package/dist/NiceSavedQueryPanel-qtWETcRP.cjs +596 -0
- package/dist/NiceSavedQueryPanel-z29D7N_A.js +6584 -0
- package/dist/NiceTabs-B4dM77y_.js +1657 -0
- package/dist/NiceTabs-BTVTtRZR.cjs +1 -0
- package/dist/NiceTabs-BXGmot7J.cjs +1 -0
- package/dist/NiceTabs-CFA8DGYR.cjs +1 -0
- package/dist/NiceTabs-Cx9DN6QD.js +1657 -0
- package/dist/NiceTabs-DJdhKste.js +1657 -0
- package/dist/NiceWindow-5VCSBJrc.js +1592 -0
- package/dist/NiceWindow-BEFAUTLp.cjs +1 -0
- package/dist/NiceWindow-Cs6-Dbci.js +1592 -0
- package/dist/NiceWindow-DYw4NCeb.js +1592 -0
- package/dist/NiceWindow-O_g8StvA.cjs +1 -0
- package/dist/NiceWindow-a4wB_m30.cjs +1 -0
- package/dist/NiceWindow.css +1 -0
- package/dist/charts-BDr6B81L.js +4657 -0
- package/dist/charts-Ci_KrAoU.cjs +761 -0
- package/dist/charts-ClxW-i5q.js +4657 -0
- package/dist/charts-De7FYS1U.cjs +761 -0
- package/dist/charts-DjFvhCdD.js +4657 -0
- package/dist/charts-Dr_FIPZT.cjs +761 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BIz6zQ5u.cjs +122 -0
- package/dist/core-BYxnKGOi.js +23141 -0
- package/dist/core-CT5vpy5U.js +25248 -0
- package/dist/core-CZE5v34h.cjs +122 -0
- package/dist/core-Cjw8oBvC.cjs +96 -0
- package/dist/core-xcuNJ-DB.js +24948 -0
- package/dist/data-branching-B7dCyaWr.cjs +1 -0
- package/dist/data-branching-BPAeL45o.js +6133 -0
- package/dist/data-branching-Byz79mmA.cjs +1 -0
- package/dist/data-branching-DjuerHfS.js +6133 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.d.ts +3 -0
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +45 -7
- package/dist/data.mjs +1 -1
- package/dist/devops-C3Pmbnxc.js +7684 -0
- package/dist/devops-CrXz348W.cjs +17 -0
- package/dist/devops-DYFov8j3.js +7684 -0
- package/dist/devops-g4qcLXah.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +5 -0
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +175 -1
- package/dist/editors.mjs +44 -41
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +1 -2
- package/dist/feedback.mjs +2 -2
- package/dist/index-9Gi1mNY7.js +67912 -0
- package/dist/index-AEO3cK4T.cjs +5194 -0
- package/dist/index-BMQ-F0zE.js +65054 -0
- package/dist/index-BNb9q4Ll.cjs +5490 -0
- package/dist/index-CjdfogVa.js +66711 -0
- package/dist/index-Di3Cgr1P.cjs +5518 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +752 -62
- package/dist/index.mjs +982 -963
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +11 -0
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +30 -4
- package/dist/navigation.mjs +34 -34
- package/dist/no-code-CHvv1KjZ.cjs +332 -0
- package/dist/no-code-CyvddsYt.js +7133 -0
- package/dist/no-code-Dl3ima61.cjs +332 -0
- package/dist/no-code-ktRzFaET.js +7133 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +11 -0
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +38 -0
- package/dist/overlays.mjs +52 -52
- package/dist/style.css +7 -4
- package/package.json +1 -1
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),Ne=require("./core-CZE5v34h.cjs"),n=require("react"),gi=require("./NiceForm-kd4essRP.cjs"),xi=require("./NiceModal-D2xJTZZf.cjs"),Wi=require("./NicePagination-BCRsVzkR.cjs"),$e=require("./NiceTabs-CFA8DGYR.cjs");function Gi({columns:t,data:a,striped:s,compact:r,emptyText:l,className:u,style:f,accessMode:c,id:g,displayStyle:N}){const z=Ne.sc(c,g)==="hidden",k=Ne.Ns("table",N),Q=Ne.Es("table",N),[V,L]=n.useState(null),F=n.useMemo(()=>V?[...a].sort((x,_)=>{const j=x[V.field]??"",U=_[V.field]??"",X=typeof j=="number"?j-U:String(j).localeCompare(String(U));return V.dir==="desc"?-X:X}):a,[a,V]),v=x=>{L(_=>_?.field===x?_.dir==="asc"?{field:x,dir:"desc"}:null:{field:x,dir:"asc"})};return z?null:e.jsx("div",{className:`nice-table-wrapper ${u||""}`,style:{...k,...f},children:e.jsxs("table",{className:`nice-table nice-table--ds-${Q} ${s?"nice-table--striped":""} ${r?"nice-table--compact":""}`,"aria-rowcount":F.length,"aria-colcount":t.length,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(x=>{const _=x.sortable?V?.field===x.field?V.dir==="asc"?"ascending":"descending":"none":void 0;return e.jsxs("th",{style:{width:x.width,textAlign:x.align},className:x.sortable?"th--sortable":void 0,onClick:()=>x.sortable&&v(x.field),scope:"col","aria-sort":_,children:[x.header,x.sortable&&V?.field===x.field&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:V.dir==="asc"?"↑":"↓"})]},x.field)})})}),e.jsx("tbody",{children:F.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"nice-table__empty",children:l||"No data"})}):F.map((x,_)=>e.jsx("tr",{children:t.map(j=>e.jsx("td",{style:{textAlign:j.align},children:j.render?j.render(x[j.field],x):String(x[j.field]??"")},j.field))},_))})]})})}const Ki=[{target:".nice-filterbuilder",titleKey:"tutorial.filterBuilder.intro.title",title:"Filter builder",contentKey:"tutorial.filterBuilder.intro.content",content:"Build complex AND/OR filter trees: add conditions and nested groups, choose fields and operators, and save reusable presets.",placement:"auto"}],Vi=[{value:"=",label:"Equals"},{value:"<>",label:"Not Equals"},{value:"<",label:"Less Than"},{value:"<=",label:"Less or Equal"},{value:">",label:"Greater Than"},{value:">=",label:"Greater or Equal"},{value:"contains",label:"Contains"},{value:"notcontains",label:"Not Contains"},{value:"startswith",label:"Starts With"},{value:"endswith",label:"Ends With"},{value:"isblank",label:"Is Blank"},{value:"isnotblank",label:"Is Not Blank"}],Zi=({condition:t,fields:a,onChange:s,onRemove:r})=>{const l=a.find(c=>c.field===t.field),u=t.operator==="isblank"||t.operator==="isnotblank",f=l?.operators||Vi;return e.jsxs("div",{className:"nice-filterbuilder__condition",children:[e.jsx("select",{className:"nice-filterbuilder__select",value:t.field,onChange:c=>s({...t,field:c.target.value,value:""}),children:a.map(c=>e.jsx("option",{value:c.field,children:c.label},c.field))}),e.jsx("select",{className:"nice-filterbuilder__select",value:t.operator,onChange:c=>s({...t,operator:c.target.value}),children:f.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}),!u&&(l?.options?e.jsxs("select",{className:"nice-filterbuilder__select",value:String(t.value??""),onChange:c=>s({...t,value:c.target.value}),children:[e.jsx("option",{value:"",children:"--"}),l.options.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))]}):l?.type==="boolean"?e.jsxs("select",{className:"nice-filterbuilder__select",value:String(t.value??""),onChange:c=>s({...t,value:c.target.value==="true"}),children:[e.jsx("option",{value:"true",children:"True"}),e.jsx("option",{value:"false",children:"False"})]}):e.jsx("input",{className:"nice-filterbuilder__input",type:l?.type==="number"?"number":l?.type==="date"?"date":"text",value:String(t.value??""),onChange:c=>s({...t,value:l?.type==="number"?Number(c.target.value):c.target.value})})),e.jsx("button",{className:"nice-filterbuilder__remove",onClick:r,children:"×"})]})},_i=({group:t,fields:a,onChange:s,onRemove:r,depth:l,maxDepth:u})=>{const f=()=>s({...t,logic:t.logic==="and"?"or":"and"}),c=()=>{const z={type:"condition",field:a[0]?.field||"",operator:"=",value:""};s({...t,items:[...t.items,z]})},g=()=>{if(l>=u)return;const z={type:"group",logic:"and",items:[]};s({...t,items:[...t.items,z]})},N=(z,k)=>{const Q=[...t.items];Q[z]=k,s({...t,items:Q})},D=z=>{s({...t,items:t.items.filter((k,Q)=>Q!==z)})};return e.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(l,3)}`,children:[e.jsxs("div",{className:"nice-filterbuilder__group-header",children:[e.jsx("button",{className:"nice-filterbuilder__logic",onClick:f,children:t.logic.toUpperCase()}),e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:c,children:"+ Condition"}),l<u&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:g,children:"+ Group"}),r&&e.jsx("button",{className:"nice-filterbuilder__remove",onClick:r,children:"×"})]}),e.jsx("div",{className:"nice-filterbuilder__group-body",children:t.items.map((z,k)=>e.jsx(n.Fragment,{children:z.type==="condition"?e.jsx(Zi,{condition:z,fields:a,onChange:Q=>N(k,Q),onRemove:()=>D(k)}):e.jsx(_i,{group:z,fields:a,onChange:Q=>N(k,Q),onRemove:()=>D(k),depth:l+1,maxDepth:u})},k))})]})},Xn=({fields:t,value:a,onChange:s,maxDepth:r=3,presets:l,onSavePreset:u,onDeletePreset:f,tutorial:c,className:g,style:N})=>{const[D,z]=n.useState(""),k=n.useCallback(V=>{const L=l?.find(F=>F.name===V);L&&s(structuredClone(L.filter))},[l,s]),Q=n.useCallback(()=>{!D.trim()||!u||(u({name:D.trim(),filter:structuredClone(a)}),z(""))},[D,a,u]);return e.jsxs("div",{className:`nice-filterbuilder ${g||""}`,style:{position:"relative",...N},children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(Ne.wl,{steps:Ne.xl(c,Ki)})}),(l?.length||u)&&e.jsxs("div",{className:"nice-filterbuilder__presets",children:[l&&l.length>0&&e.jsx("div",{className:"nice-filterbuilder__preset-list",children:l.map(V=>e.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>k(V.name),children:V.name}),f&&e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>f(V.name),children:"×"})]},V.name))}),u&&e.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[e.jsx("input",{className:"nice-filterbuilder__input",value:D,onChange:V=>z(V.target.value),placeholder:"Preset name..."}),e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:Q,disabled:!D.trim(),children:"Save"})]})]}),e.jsx(_i,{group:a,fields:t,onChange:s,depth:0,maxDepth:r})]})};Xn.displayName="NiceFilterBuilder";function bi(t,a,s){const r=t.map(l=>l[a]).filter(l=>typeof l=="number");if(r.length===0)return s==="count"?"0":"";switch(s){case"sum":return r.reduce((l,u)=>l+u,0).toLocaleString();case"avg":return(r.reduce((l,u)=>l+u,0)/r.length).toLocaleString(void 0,{maximumFractionDigits:2});case"count":return String(t.length);case"min":return Math.min(...r).toLocaleString();case"max":return Math.max(...r).toLocaleString()}}function jn(t){return t.includes(",")||t.includes('"')||t.includes(`
|
|
2
|
+
`)?`"${t.replace(/"/g,'""')}"`:t}const an={width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},qi=()=>e.jsx("svg",{...an,children:e.jsx("polyline",{points:"6 15 12 9 18 15"})}),yn=()=>e.jsx("svg",{...an,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),Xi=()=>e.jsxs("svg",{...an,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 10 12 5 18 10"}),e.jsx("polyline",{points:"6 14 12 19 18 14"})]}),Ln=()=>e.jsx("svg",{...an,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),Hi=()=>e.jsxs("svg",{...an,children:[e.jsx("polyline",{points:"3 17 9 11 13 15 21 7"}),e.jsx("polyline",{points:"14 7 21 7 21 14"})]}),Qi=()=>e.jsxs("svg",{...an,children:[e.jsx("polyline",{points:"3 7 9 13 13 9 21 17"}),e.jsx("polyline",{points:"14 17 21 17 21 10"})]}),Yi=()=>e.jsx("svg",{...an,children:e.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})});function Ji(t){return typeof t=="boolean"?t?e.jsx("svg",{className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--true",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"true",role:"img",children:e.jsx("path",{d:"M4 10.5l4 4L16 6"})}):e.jsx("svg",{className:"nice-datagrid__bool-icon nice-datagrid__bool-icon--false",width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-label":"false",role:"img",children:e.jsx("path",{d:"M5 5l10 10M15 5L5 15"})}):String(t??"")}function zn({columns:t,data:a,keyField:s="id",dataSource:r,sortable:l=!0,sortField:u,sortDirection:f,onSort:c,showAdvancedFilter:g,advancedFilter:N,onAdvancedFilterChange:D,filterFields:z,filterPresets:k,onSaveFilterPreset:Q,onDeleteFilterPreset:V,selectable:L,selectedKeys:F,onSelectionChange:v,pagination:x,pageSize:_=10,page:j,onPageChange:U,totalRows:X,searchable:le,searchPlaceholder:be,virtualScroll:T,rowHeight:G=40,groupBy:ae,groupRender:ue,onCellEdit:he,editMode:B="inline",formItems:$,formColumns:E=2,editFormTitle:o,formProps:xe,onRowEdit:we,onRowAdd:se,onRowDelete:I,bulkActions:Y,onBulkDelete:O,exportCsv:de,exportFilename:pe="export",detailRow:Se,expandedRowKeys:Ke,onExpandedRowChange:Ze,columnReorder:Fe,onColumnReorder:Le,columnResize:Oe,rowDraggable:ge,onRowReorder:H,striped:je,compact:Ve,loading:ve,emptyText:C,toolbar:J,onRowClick:Re,pinnedTopKeys:S,pinnedBottomKeys:ce,colSpan:W,showStatusBar:Ae,contextMenuItems:Ee,onContextMenuAction:ee,printFriendly:Ge,keyboardNavigation:qe,focusedCell:lt,onFocusedCellChange:ye,cellRangeSelection:Wt,selectedCellRange:Pt,onCellRangeChange:ut,clipboard:at,clipboardFormat:A="text",onBeforeCopy:ne,onCopy:fe,onPaste:Xe,quickFilters:Je,activeQuickFilters:ke,onQuickFilterChange:Te,columnGroups:Be,stateStorageKey:tt,initialState:He,onStateChange:mt,flashRowKeys:Ft,flashDuration:sn=500,autoFitColumns:pn,showColumnStats:wn,rowIndicator:st,frozenRows:Pn,className:fn,style:gn,accessMode:Jt,id:kt,displayStyle:rn}){const m=Ne.sc(Jt,kt),h=m==="hidden",P=m==="readOnly"||m==="disabled",{t:M}=Ne.Zt();Ne.Ns("table",rn),Ne.Es("table",rn);const Z=Ne.hd(r??null,{autoLoad:!!r,defaultPageSize:_}),w=!!r,q=w?Z.data:a??[],ie=w?Z.loading:ve,[oe,Ue]=n.useState({field:"",dir:null}),[ze,Me]=n.useState(1),[nt,Dt]=n.useState(new Set),[It,rt]=n.useState(""),[en,Gt]=n.useState({type:"group",logic:"and",items:[]}),[Kt,Vt]=n.useState(!1),ot=N??en,kn=i=>{D?D(i):Gt(i)},Ot=n.useMemo(()=>z??t.filter(i=>i.filterable!==!1&&i.field).map(i=>({field:String(i.field),label:String(i.header??i.field)})),[z,t]),ht=ot.items.length,[jt,Bt]=n.useState(_),[Rt,Zt]=n.useState(null),[cn,tn]=n.useState(null),[qt,Ut]=n.useState(null),[Xt,At]=n.useState(new Set),[xn,Fn]=n.useState(0),Sn=n.useRef(null),[On,_n]=n.useState(new Set),ln=Ke??On,[St,Cn]=n.useState({}),[Ht,Qt]=n.useState(null),[pt,on]=n.useState(null),[Mn,Bn]=n.useState(null),[y,me]=n.useState(null),[Ce,Ie]=n.useState([]),[ft,Et]=n.useState(null),[Ct,ct]=n.useState(new Set),[Hn,rs]=n.useState(null),Un=n.useRef(null),Nt=lt??Mn,gt=Pt??y,$t=ke??Ce;n.useEffect(()=>{if(!tt)return;const i=localStorage.getItem(`nice-datagrid-${tt}`);if(i&&!He)try{const d=JSON.parse(i);d.columnWidths&&Cn(d.columnWidths),d.expandedGroups&&At(new Set(d.expandedGroups))}catch{}},[tt,He]),n.useEffect(()=>{if(!Ft?.size)return;ct(new Set(Ft));const i=setTimeout(()=>ct(new Set),sn);return()=>clearTimeout(i)},[Ft,sn]),n.useEffect(()=>{if(!pt)return;const i=()=>on(null);return document.addEventListener("click",i),()=>document.removeEventListener("click",i)},[pt]);const Mi=n.useCallback((i,d)=>{Ee?.length&&(i.preventDefault(),on({x:i.clientX,y:i.clientY,row:d}))},[Ee]),Qn=n.useCallback(i=>{const d=new Set(ln);d.has(i)?d.delete(i):d.add(i),Ze?Ze(d):_n(d)},[ln,Ze]),Yn=n.useCallback((i,d)=>{if(!Oe)return;d.preventDefault();const p=d.clientX,R=d.target.closest("th")?.offsetWidth??100,te=K=>{const _e=Math.max(40,R+K.clientX-p);Cn(We=>({...We,[i]:_e}))},re=()=>{document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",re)};document.addEventListener("mousemove",te),document.addEventListener("mouseup",re)},[Oe]),Lt=w?Z.sort[0]?.field??"":u??oe.field,wt=w?Z.sort[0]?.direction??null:f??oe.dir,bn=w?Z.page:j??ze,it=F??nt;n.useCallback(()=>{if(!tt)return;const i={columnWidths:St,sortField:Lt||void 0,sortDirection:wt,pageSize:jt,expandedGroups:Array.from(Xt)};localStorage.setItem(`nice-datagrid-${tt}`,JSON.stringify(i)),mt?.(i)},[tt,St,Lt,wt,jt,Xt,mt]);const xt=n.useMemo(()=>t.filter(i=>!i.hidden),[t]),Wn=n.useMemo(()=>xt.filter(i=>i.pinned==="left"),[xt]),Gn=n.useMemo(()=>xt.filter(i=>i.pinned==="right"),[xt]),Jn=n.useMemo(()=>xt.filter(i=>!i.pinned),[xt]),Pe=n.useMemo(()=>[...Wn,...Jn,...Gn],[Wn,Jn,Gn]),Di=n.useMemo(()=>xt.some(i=>i.aggregate),[xt]),vn=Wn.length>0||Gn.length>0,ei=n.useCallback(i=>{const d=Lt===i?wt==="asc"?"desc":wt==="desc"?null:"asc":"asc";w?d?Z.setSortField(i,d):Z.setSort([]):c?c(i,d):Ue({field:i,dir:d})},[Lt,wt,w,Z,c]),_t=n.useMemo(()=>{if(w)return q;let i=[...q];if(It){const d=It.toLowerCase();i=i.filter(p=>xt.some(b=>String(p[b.field]??"").toLowerCase().includes(d)))}return ot.items.length>0&&(i=i.filter(d=>Ne.Ka(d,ot))),!c&&Lt&&wt&&i.sort((d,p)=>{const b=d[Lt]??"",R=p[Lt]??"",te=typeof b=="number"?b-R:String(b).localeCompare(String(R));return wt==="desc"?-te:te}),i},[q,It,ot,xt,Lt,wt,c,w]),Dn=w?Z.totalCount:X??_t.length,dn=w?Z.pageSize:jt,Ii=Math.max(1,Math.ceil(Dn/dn)),Mt=w?_t:x&&!X?_t.slice((bn-1)*dn,bn*dn):_t,In=n.useCallback(i=>{w?Z.setPage(i):U?U(i):Me(i)},[w,Z,U]),un=n.useMemo(()=>Mt.map(i=>String(i[s])),[Mt,s]),mn=un.length>0&&un.every(i=>it.has(i)),ti=un.some(i=>it.has(i)),ni=n.useCallback(()=>{const i=new Set(it);mn?un.forEach(d=>i.delete(d)):un.forEach(d=>i.add(d)),v?v(i):Dt(i)},[mn,un,it,v]),ii=n.useCallback(i=>{const d=new Set(it);d.has(i)?d.delete(i):d.add(i),v?v(d):Dt(d)},[it,v]),ai=({field:i})=>Lt!==i||!wt?e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(Xi,{})}):e.jsx("span",{className:"nice-table__sort-icon",children:wt==="asc"?e.jsx(qi,{}):e.jsx(yn,{})}),bt=n.useMemo(()=>{if(!ae)return Mt.map((p,b)=>({type:"data",row:p,key:String(p[s]??b)}));const i=new Map;Mt.forEach(p=>{const b=p[ae];i.has(b)||i.set(b,[]),i.get(b).push(p)});const d=[];return i.forEach((p,b)=>{const R=`__group_${String(b)}`,te=Xt.has(R);d.push({type:"group",value:b,rows:p,expanded:te,key:R}),te&&p.forEach((re,K)=>d.push({type:"data",row:re,key:String(re[s]??`${R}_${K}`)}))}),d},[Mt,ae,s,Xt]),{pinnedTopRows:Ri,pinnedBottomRows:Ai,normalRows:Ei}=n.useMemo(()=>{if(!S?.size&&!ce?.size)return{pinnedTopRows:[],pinnedBottomRows:[],normalRows:bt};const i=[],d=[],p=[];for(const b of bt){if(b.type==="data"){const R=b.key;if(S?.has(R)){i.push(b);continue}if(ce?.has(R)){d.push(b);continue}}p.push(b)}return{pinnedTopRows:i,pinnedBottomRows:d,normalRows:p}},[bt,S,ce]),si=n.useCallback(i=>{At(d=>{const p=new Set(d);return p.has(i)?p.delete(i):p.add(i),p})},[]),$i=n.useMemo(()=>{if(!T)return bt;const i=Sn.current?.clientHeight??400,d=Math.ceil(i/G),p=Math.max(0,Math.floor(xn/G)-3),b=Math.min(bt.length-1,p+d+6);return bt.slice(p,b+1).map((R,te)=>({...R,_vIdx:p+te}))},[T,bt,xn,G]),Rn=n.useCallback((i,d,p)=>{!he||P||(Zt({rowKey:i,field:d}),tn(p))},[he]),ri=n.useCallback(()=>{Rt&&he&&he(Rt.rowKey,Rt.field,cn),Zt(null),tn(null)},[Rt,cn,he]),Li=n.useCallback(()=>{Zt(null),tn(null)},[]),Ti=n.useCallback(()=>{const i=xt,d=i.map(K=>jn(K.header)).join(","),p=_t.map(K=>i.map(_e=>jn(String(K[_e.field]??""))).join(",")),b=[d,...p].join(`
|
|
3
|
+
`),R=new Blob(["\uFEFF"+b],{type:"text/csv;charset=utf-8;"}),te=URL.createObjectURL(R),re=document.createElement("a");re.href=te,re.download=`${pe}.csv`,re.click(),URL.revokeObjectURL(te)},[xt,_t,pe]),An=n.useCallback(i=>{ye?ye(i):Bn(i)},[ye]),En=n.useCallback(i=>{ut?ut(i):me(i)},[ut]),vt=n.useMemo(()=>bt.filter(i=>i.type==="data").map(i=>i.key),[bt]),zi=n.useCallback(i=>{if(!qe||Rt||!Nt)return;const d=vt.indexOf(Nt.rowKey),p=Pe.findIndex(re=>re.field===Nt.field);if(d<0||p<0)return;let b=d,R=p;switch(i.key){case"ArrowUp":b=Math.max(0,d-1);break;case"ArrowDown":b=Math.min(vt.length-1,d+1);break;case"ArrowLeft":R=Math.max(0,p-1);break;case"ArrowRight":R=Math.min(Pe.length-1,p+1);break;case"Tab":i.preventDefault(),i.shiftKey?R=Math.max(0,p-1):R=Math.min(Pe.length-1,p+1);break;case"Enter":{const re=Pe[p];if(re.editable&&he){const K=Mt.find(_e=>String(_e[s])===Nt.rowKey);K&&Rn(Nt.rowKey,re.field,K[re.field])}return}case"Escape":An(null),En(null);return;case"Home":i.ctrlKey&&(b=0),R=0;break;case"End":i.ctrlKey&&(b=vt.length-1),R=Pe.length-1;break;case"PageUp":b=Math.max(0,d-jt);break;case"PageDown":b=Math.min(vt.length-1,d+jt);break;default:return}i.preventDefault();const te={rowKey:vt[b],field:Pe[R].field};if(An(te),i.shiftKey&&Wt){const re=gt?.start??Nt;En({start:re,end:te})}else En(null)},[qe,Rt,Nt,vt,Pe,Wt,gt,An,En,he,Mt,s,Rn,jt]),ci=n.useCallback(()=>{let i=[],d=[];if(gt){const p=vt.indexOf(gt.start.rowKey),b=vt.indexOf(gt.end.rowKey),R=Math.min(p,b),te=Math.max(p,b),re=Pe.findIndex(Qe=>Qe.field===gt.start.field),K=Pe.findIndex(Qe=>Qe.field===gt.end.field),_e=Math.min(re,K),We=Math.max(re,K);d=Pe.slice(_e,We+1).map(Qe=>Qe.field),i=Mt.filter(Qe=>{const Yt=vt.indexOf(String(Qe[s]));return Yt>=R&&Yt<=te})}else it.size>0&&(i=Mt.filter(p=>it.has(String(p[s]))),d=Pe.map(p=>p.field));return{rows:i,fields:d}},[gt,vt,Pe,Mt,s,it]),li=n.useCallback((i,d,p)=>{const b=Pe.filter(R=>d.includes(R.field));switch(p){case"json":return JSON.stringify(i.map(R=>Object.fromEntries(d.map(te=>[te,R[te]]))),null,2);case"csv":{const R=b.map(re=>jn(re.header)).join(","),te=i.map(re=>b.map(K=>jn(String(re[K.field]??""))).join(",")).join(`
|
|
4
|
+
`);return R+`
|
|
5
|
+
`+te}case"html":{const R=b.map(re=>`<th>${re.header}</th>`).join(""),te=i.map(re=>`<tr>${b.map(K=>`<td>${re[K.field]??""}</td>`).join("")}</tr>`).join("");return`<table><thead><tr>${R}</tr></thead><tbody>${te}</tbody></table>`}case"markdown":{const R="| "+b.map(K=>K.header).join(" | ")+" |",te="| "+b.map(()=>"---").join(" | ")+" |",re=i.map(K=>"| "+b.map(_e=>K[_e.field]??"").join(" | ")+" |").join(`
|
|
6
|
+
`);return R+`
|
|
7
|
+
`+te+`
|
|
8
|
+
`+re}default:return i.map(R=>b.map(te=>R[te.field]??"").join(" ")).join(`
|
|
9
|
+
`)}},[Pe]),Kn=n.useCallback(async()=>{if(!at)return;const{rows:i,fields:d}=ci();if(!i.length||ne?.(i,d)===!1)return;const p=li(i,d,A);await navigator.clipboard.writeText(p),fe?.(i,d,A)},[at,ci,ne,li,A,fe]),oi=n.useCallback(async()=>{if(!at||!Nt||!Xe)return;const d=(await navigator.clipboard.readText()).split(`
|
|
10
|
+
`).map(p=>p.split(" "));Xe(d,Nt)},[at,Nt,Xe]);n.useEffect(()=>{if(!at||!Un.current)return;const i=d=>{Un.current?.contains(document.activeElement)&&(d.type==="copy"&&(d.preventDefault(),Kn()),d.type==="paste"&&(d.preventDefault(),oi()))};return document.addEventListener("copy",i),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",i)}},[at,Kn,oi]);const Pi=n.useCallback(i=>{const d=$t.includes(i)?$t.filter(p=>p!==i):[...$t,i];Te?Te(d):Ie(d)},[$t,Te]),Fi=n.useMemo(()=>{if(!Je?.length||!$t.length)return _t;const i=Je.filter(d=>$t.includes(d.key));return _t.filter(d=>i.every(p=>p.filter(d)))},[_t,Je,$t]),di=Je?.length?Fi:_t;n.useCallback(i=>{const d=_t.map(_e=>_e[i]).filter(_e=>_e!=null),p=d.filter(_e=>typeof _e=="number");if(p.length===0){const _e=new Set(d).size;return{count:d.length,unique:_e,type:"text"}}const b=p.reduce((_e,We)=>_e+We,0),R=b/p.length,te=Math.min(...p),re=Math.max(...p),K=Math.sqrt(p.reduce((_e,We)=>_e+(We-R)**2,0)/p.length);return{count:p.length,sum:b,avg:R,min:te,max:re,stdDev:K,type:"numeric"}},[_t]);const Oi=n.useCallback((i,d,p)=>{if(!i.cellVisualization)return null;const b=Number(d);if(isNaN(b))return null;const R=i.visualMin??0,te=i.visualMax??100,re=Math.max(0,Math.min(100,(b-R)/(te-R)*100));switch(i.cellVisualization){case"progress":return e.jsxs("div",{className:"nice-datagrid__cell-progress",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{flex:1,height:6,background:"var(--border-color)",borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${re}%`,height:"100%",background:re>80?"var(--color-success)":re>50?"var(--color-primary)":"var(--color-warning)",transition:"width 0.3s ease"}})}),e.jsxs("span",{style:{fontSize:"0.75rem",minWidth:32,textAlign:"right"},children:[Math.round(re),"%"]})]});case"rating":{const K=Math.round(b/te*5);return e.jsx("div",{className:"nice-datagrid__cell-rating",children:[1,2,3,4,5].map(_e=>e.jsx("span",{style:{color:_e<=K?"var(--color-warning)":"var(--text-muted)",fontSize:"0.95rem",lineHeight:1},"aria-hidden":"true",children:"★"},_e))})}case"trend":{const K=i.visualMin??b,_e=b-K,We=_e>0?Hi:_e<0?Qi:Yi,Qe=_e>0?"var(--color-success)":_e<0?"var(--color-danger)":"var(--text-muted)";return e.jsxs("span",{style:{color:Qe,fontWeight:500,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(We,{})," ",Math.abs(_e).toFixed(1),"%"]})}case"heatmap":{const K=re/100,_e=`rgba(${Math.round(255*K)}, ${Math.round(100*(1-K))}, ${Math.round(50*(1-K))}, 0.6)`;return e.jsx("span",{style:{background:_e,padding:"2px 8px",borderRadius:4},children:b})}default:return null}},[]),Bi=n.useCallback((i,d,p)=>{if(!i.conditionalFormats?.length)return{};for(const b of i.conditionalFormats)if(b.when(d,p,i.field))return{className:b.className,style:{...b.style,backgroundColor:b.backgroundColor,color:b.color}};return{}},[]),Vn=n.useCallback((i,d)=>{if(!vn||!i.pinned)return{};const p={position:"sticky",zIndex:2,background:"var(--bg-primary, #fff)"};if(i.pinned==="left"){let b=0;for(let R=0;R<d;R++){const te=Pe[R];te.pinned==="left"&&(b+=typeof te.width=="number"?te.width:parseInt(String(te.width)||"100",10))}L&&d===0&&(b=36),p.left=b}else{let b=0;for(let R=Pe.length-1;R>d;R--){const te=Pe[R];te.pinned==="right"&&(b+=typeof te.width=="number"?te.width:parseInt(String(te.width)||"100",10))}p.right=b}return p},[vn,Pe,L]),ui=(i,d,p,b)=>{if(Rt?.rowKey===p&&Rt?.field===i.field)return i.editor?i.editor(cn,d,K=>tn(K)):e.jsx("input",{className:"nice-datagrid__edit-input",autoFocus:!0,value:cn??"",onChange:K=>tn(K.target.value),onBlur:ri,onKeyDown:K=>{K.key==="Enter"&&ri(),K.key==="Escape"&&Li()}});const te=Oi(i,d[i.field],d);return te||(i.render?i.render(d[i.field],d,b):Ji(d[i.field]))},Ui=(i,d,p,b)=>{const R=Nt?.rowKey===p&&Nt?.field===i.field,te=gt&&(()=>{const _e=vt.indexOf(gt.start.rowKey),We=vt.indexOf(gt.end.rowKey),Qe=vt.indexOf(p),Yt=Pe.findIndex(hn=>hn.field===gt.start.field),nn=Pe.findIndex(hn=>hn.field===gt.end.field);return Qe>=Math.min(_e,We)&&Qe<=Math.max(_e,We)&&b>=Math.min(Yt,nn)&&b<=Math.max(Yt,nn)})(),re=Bi(i,d[i.field],d);return{className:[re.className,R&&"nice-datagrid__cell--focused",te&&"nice-datagrid__cell--in-range"].filter(Boolean).join(" "),style:{...Vn(i,b),textAlign:i.align,...re.style,...R?{outline:"2px solid var(--color-primary)",outlineOffset:-2}:{},...te?{background:"var(--color-primary-light, rgba(59,130,246,0.15))"}:{}}}},$n=Pe.length+(L?1:0)+(Se?1:0)+(ge?1:0)+(st?1:0),Zn=(i,d,p)=>{const{row:b,key:R}=i,te=it.has(R),re=ln.has(R),K=Ct.has(R),_e=[te&&"nice-datagrid__row--selected",Ht===d&&"nice-datagrid__row--dragging",p&&"nice-datagrid__row--pinned",K&&"nice-datagrid__row--flash"].filter(Boolean).join(" ");return e.jsxs(n.Fragment,{children:[e.jsxs("tr",{className:_e,onClick:()=>Re?.(b),onDoubleClick:B==="popup"&&(we||he)?()=>Ut({key:R,data:{...b}}):void 0,onContextMenu:We=>Mi(We,b),style:Re||B==="popup"?{cursor:"pointer"}:void 0,draggable:ge,onDragStart:ge?()=>Qt(d):void 0,onDragOver:ge?We=>We.preventDefault():void 0,onDrop:ge&&H&&Ht!=null?()=>{H(Ht,d),Qt(null)}:void 0,onDragEnd:ge?()=>Qt(null):void 0,children:[st&&e.jsx("td",{className:"nice-datagrid__row-indicator",style:{width:32,padding:"0 4px"},children:st(b)}),Se&&e.jsx("td",{className:"nice-datagrid__expand-col",onClick:We=>{We.stopPropagation(),Qn(R)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":re,children:re?e.jsx(yn,{}):e.jsx(Ln,{})})}),ge&&e.jsx("td",{className:"nice-datagrid__drag-handle",style:{cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),L&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:We=>We.stopPropagation(),style:vn?{position:"sticky",left:0,zIndex:1,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:te,onChange:()=>ii(R),"aria-label":`Select row ${R}`})}),(()=>{let We=0;return Pe.map((Qe,Yt)=>{if(We>0)return We--,null;const nn=W?W(b,Qe,Yt):void 0;nn&&nn>1&&(We=nn-1);const hn=Ui(Qe,b,R,Yt);return e.jsx("td",{colSpan:nn,className:hn.className,style:hn.style,onClick:qe?()=>An({rowKey:R,field:Qe.field}):void 0,onDoubleClick:Qe.editable&&he?()=>Rn(R,Qe.field,b[Qe.field]):void 0,children:ui(Qe,b,R,d)},Qe.field)})})()]}),Se&&re&&e.jsx("tr",{className:"nice-datagrid__detail-row",children:e.jsx("td",{colSpan:$n,children:Se(b)})})]},R)};return h?null:e.jsxs("div",{ref:Un,className:`nice-datagrid ${Ge?"nice-datagrid--print":""} ${fn||""}`,style:gn,role:"grid","aria-label":M("datagrid.title","Data Grid"),"aria-rowcount":bt.length,"aria-colcount":xt.length,"aria-busy":ie||void 0,tabIndex:qe?0:void 0,onKeyDown:qe?zi:void 0,children:[(le||J||de||Je?.length||se||g)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[le&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:w?Z.search:It,"aria-label":M("controls.search","Search"),onChange:i=>{w?Z.setSearch(i.target.value):(rt(i.target.value),In(1))},placeholder:be||M("controls.search","Search...")})}),g&&e.jsxs("button",{type:"button",className:`nice-datagrid__filter-toggle ${ht>0?"nice-datagrid__filter-toggle--active":""}`,"aria-expanded":Kt,onClick:()=>Vt(i=>!i),children:[M("controls.filter","Filter"),ht>0?` (${ht})`:""]}),Je&&Je.length>0&&e.jsx("div",{className:"nice-datagrid__quick-filters",style:{display:"flex",gap:6,flexWrap:"wrap"},children:Je.map(i=>e.jsxs("button",{className:`nice-datagrid__quick-filter ${$t.includes(i.key)?"nice-datagrid__quick-filter--active":""}`,onClick:()=>Pi(i.key),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:"0.75rem",border:"1px solid var(--border-color)",borderRadius:12,background:$t.includes(i.key)?`var(--color-${i.color||"primary"})`:"var(--bg-primary)",color:$t.includes(i.key)?"var(--bg-primary, #fff)":"inherit",cursor:"pointer",transition:"all 0.15s ease"},children:[i.icon&&e.jsx("span",{children:i.icon}),i.label]},i.key))}),at&&e.jsx("button",{className:"nice-btn nice-btn--sm nice-btn--ghost",onClick:Kn,title:M("controls.copy","Copy selected"),style:{marginLeft:4},children:"??"}),de&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:Ti,title:M("controls.exportCsv","Export CSV"),children:"CSV ?"}),se&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--primary",onClick:()=>Ut({key:null,data:{}}),title:M("datagrid.addRow","Add row"),children:["+ ",M("datagrid.add","Add")]}),J]}),g&&Kt&&e.jsx("div",{className:"nice-datagrid__filter-panel",style:{padding:"8px 12px",borderBottom:"1px solid var(--border-color)"},children:e.jsx(Xn,{fields:Ot,value:ot,onChange:i=>{kn(i),In(1)},presets:k,onSavePreset:Q,onDeletePreset:V})}),L&&it.size>0&&(Y?.length||O)&&e.jsxs("div",{className:"nice-datagrid__bulk-toolbar",role:"toolbar","aria-label":M("datagrid.bulkActions","Bulk actions"),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--bg-tertiary, #f1f5f9)",borderBottom:"1px solid var(--border-color)",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:M("datagrid.selectedCount","{count} selected").replace("{count}",String(it.size))}),(Y||[]).map(i=>{const d=Array.from(it),p=di.filter(R=>it.has(String(R[s]))),b=i.disabled?.(d,p)||!1;return e.jsxs("button",{type:"button",className:`nice-btn nice-btn--sm nice-btn--${i.variant||"secondary"}`,disabled:b,onClick:()=>i.onClick(d,p),children:[i.icon,i.icon&&" ",i.label]},i.key)}),O&&!Y?.length&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--danger",onClick:()=>{const i=Array.from(it),d=di.filter(p=>it.has(String(p[s])));O(i,d)},children:["?? ",M("datagrid.deleteSelected","Delete selected")]}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--xs nice-btn--ghost",onClick:()=>{const i=new Set;F===void 0&&Dt(i),v?.(i)},style:{marginLeft:"auto"},children:M("datagrid.clearSelection","Clear")})]}),e.jsxs("div",{ref:Sn,className:`nice-datagrid__table-wrap ${T?"nice-datagrid__table-wrap--virtual":""}`,style:T?{maxHeight:Math.min(bt.length*G,600),overflowY:"auto"}:void 0,onScroll:T?i=>Fn(i.currentTarget.scrollTop):void 0,children:[T&&e.jsxs("div",{style:{height:bt.length*G,position:"relative"},children:[e.jsx("table",{className:`${je?"nice-table--striped":""} ${Ve?"nice-table--compact":""}`,style:{position:"sticky",top:0,zIndex:3},children:e.jsx("thead",{children:e.jsxs("tr",{children:[Se&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),ge&&e.jsx("th",{style:{width:28}}),L&&e.jsx("th",{className:"nice-datagrid__checkbox",style:vn?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:mn,ref:i=>{i&&(i.indeterminate=ti&&!mn)},onChange:ni,"aria-label":M("controls.selectAll","Select all")})}),Pe.map((i,d)=>e.jsxs("th",{style:{width:St[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Vn(i,d)},className:l&&i.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>l&&i.sortable!==!1&&ei(i.field),children:[i.header,l&&i.sortable!==!1&&e.jsx(ai,{field:i.field}),Oe&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:p=>{p.stopPropagation(),Yn(i.field,p)}})]},i.field))]})})}),$i.map((i,d)=>{const p=i._vIdx??0;if(i.type==="group"){const K=i;return e.jsxs("div",{className:"nice-datagrid__group-row",style:{position:"absolute",top:p*G,height:G,left:0,right:0},onClick:()=>si(K.key),children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:K.expanded?e.jsx(yn,{}):e.jsx(Ln,{})}),ue?ue(K.value,K.rows):e.jsxs(e.Fragment,{children:[String(K.value)," (",K.rows.length,")"]})]},K.key)}const{row:b,key:R}=i,te=it.has(R),re=ln.has(R);return e.jsxs(n.Fragment,{children:[e.jsxs("div",{className:`nice-datagrid__vrow ${te?"nice-datagrid__row--selected":""} ${Ht===d?"nice-datagrid__row--dragging":""}`,style:{position:"absolute",top:p*G,height:G,left:0,right:0,display:"flex",alignItems:"center"},onClick:()=>Re?.(b),onDoubleClick:B==="popup"&&(we||he)?()=>Ut({key:R,data:{...b}}):void 0,draggable:ge,onDragStart:ge?()=>Qt(d):void 0,onDragOver:ge?K=>K.preventDefault():void 0,onDrop:ge&&H&&Ht!=null?()=>{H(Ht,d),Qt(null)}:void 0,onDragEnd:ge?()=>Qt(null):void 0,children:[Se&&e.jsx("div",{className:"nice-datagrid__expand-col",style:{width:36,flexShrink:0,textAlign:"center",cursor:"pointer"},onClick:K=>{K.stopPropagation(),Qn(R)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":re,children:re?e.jsx(yn,{}):e.jsx(Ln,{})})}),ge&&e.jsx("div",{style:{width:28,flexShrink:0,cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),L&&e.jsx("div",{className:"nice-datagrid__checkbox",style:{width:36,flexShrink:0},onClick:K=>K.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:te,onChange:()=>ii(R)})}),Pe.map(K=>e.jsx("div",{className:"nice-datagrid__vcell",style:{width:St[K.field]||K.width||"auto",flex:St[K.field]||K.width?`0 0 ${typeof(St[K.field]||K.width)=="number"?(St[K.field]||K.width)+"px":St[K.field]||K.width}`:1,textAlign:K.align,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"0 8px"},onDoubleClick:K.editable&&he?()=>Rn(R,K.field,b[K.field]):void 0,children:ui(K,b,R,p)},K.field))]}),Se&&re&&e.jsx("div",{className:"nice-datagrid__detail-row",style:{position:"absolute",top:(p+1)*G,left:0,right:0,padding:"8px 12px",background:"var(--bg-secondary, #f8f8f8)"},children:Se(b)})]},R)})]}),!T&&e.jsxs("table",{className:`${je?"nice-table--striped":""} ${Ve?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Se&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),ge&&e.jsx("th",{style:{width:28}}),L&&e.jsx("th",{className:"nice-datagrid__checkbox",style:vn?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:mn,ref:i=>{i&&(i.indeterminate=ti&&!mn)},onChange:ni,"aria-label":M("controls.selectAll","Select all")})}),Pe.map((i,d)=>{const p=l&&i.sortable!==!1,b=p?Lt===i.field?wt==="asc"?"ascending":wt==="desc"?"descending":"none":"none":void 0;return e.jsxs("th",{style:{width:St[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Vn(i,d)},className:p?"nice-datagrid__th--sortable":void 0,onClick:()=>p&&ei(i.field),"aria-sort":b,scope:"col",children:[i.header,p&&e.jsx(ai,{field:i.field}),Oe&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:R=>{R.stopPropagation(),Yn(i.field,R)}})]},i.field)})]})}),e.jsx("tbody",{children:ie?e.jsx("tr",{children:e.jsx("td",{colSpan:$n,className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):bt.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:$n,className:"nice-datagrid__empty",children:C||M("controls.noData","No data available")})}):e.jsxs(e.Fragment,{children:[Ri.map((i,d)=>i.type==="data"&&Zn(i,d,"top")),Ei.map((i,d)=>{if(i.type==="group"){const p=i;return e.jsx("tr",{className:"nice-datagrid__group-row",onClick:()=>si(p.key),children:e.jsxs("td",{colSpan:$n,className:"nice-datagrid__group-cell",children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:p.expanded?e.jsx(yn,{}):e.jsx(Ln,{})}),ue?ue(p.value,p.rows):e.jsxs(e.Fragment,{children:[String(p.value)," (",p.rows.length,")"]})]})},p.key)}return Zn(i,d)}),Ai.map((i,d)=>i.type==="data"&&Zn(i,d,"bottom"))]})}),Di&&!ie&&Mt.length>0&&e.jsx("tfoot",{children:e.jsxs("tr",{className:"nice-datagrid__aggregate-row",children:[L&&e.jsx("td",{}),Pe.map(i=>e.jsx("td",{style:{textAlign:i.align,fontWeight:600},children:i.aggregate?(i.aggregateLabel||i.aggregate.toUpperCase())+": "+bi(_t,i.field,i.aggregate):""},i.field))]})})]})]}),x&&e.jsxs("div",{className:"nice-datagrid__footer",children:[e.jsxs("span",{className:"nice-datagrid__footer-info",children:[M("controls.showing","Showing")," ",(bn-1)*dn+1,"–",Math.min(bn*dn,Dn)," ",M("controls.of","of")," ",Dn]}),e.jsx(Wi.NicePagination,{page:bn,totalPages:Ii,onChange:In,showInfo:!0,pageSize:dn,showPageSize:!0,pageSizeOptions:[5,10,25,50,100],onPageSizeChange:i=>{w?Z.setPageSize(i):(Bt(i),In(1))},showFirstLast:!0})]}),Ae&&!ie&&e.jsxs("div",{className:"nice-datagrid__status-bar",children:[e.jsxs("span",{children:[M("controls.totalRows","Total rows"),": ",Dn]}),L&&it.size>0&&e.jsxs("span",{children:[M("controls.selected","Selected"),": ",it.size]})]}),pt&&Ee&&e.jsx("div",{className:"nice-datagrid__context-menu",style:{position:"fixed",left:pt.x,top:pt.y,zIndex:9999},onClick:i=>i.stopPropagation(),children:Ee.map(i=>e.jsxs("button",{className:"nice-datagrid__context-item",disabled:i.disabled,onClick:()=>{ee?.(i.key,pt.row),on(null)},children:[i.icon&&e.jsx("span",{className:"nice-datagrid__context-icon",children:i.icon}),i.label]},i.key))}),(B==="popup"||se)&&qt&&(()=>{const i=qt.key===null,d=$??t.filter(p=>!p.hidden&&p.field!==s).map(p=>{let b="text";return p.dataType==="number"||p.dataType==="currency"||p.dataType==="percent"?b="number":p.dataType==="boolean"?b="checkbox":p.dataType==="date"&&(b="date"),{field:p.field,label:p.header,type:b,required:p.validation?.required}});return e.jsx(xi.NiceModal,{open:!0,onClose:()=>Ut(null),title:o??(i?M("datagrid.addRow","Add row"):M("datagrid.editRow","Edit row")),size:"lg",children:e.jsx(gi.NiceForm,{items:d,data:qt.data,columns:E,showActions:!0,submitLabel:i?M("controls.add","Add"):M("controls.save","Save"),cancelLabel:M("controls.cancel","Cancel"),onCancel:()=>Ut(null),...xe,onFieldChange:(p,b)=>Ut(R=>R&&{...R,data:{...R.data,[p]:b}}),onSubmit:p=>{i?se?.(p):qt.key&&(we?we(qt.key,p):he&&Object.keys(p).forEach(b=>{he(qt.key,b,p[b])})),Ut(null)}})})})()]})}zn.displayName="NiceDataGrid";const ea=Object.freeze(Object.defineProperty({__proto__:null,NiceDataGrid:zn},Symbol.toStringTag,{value:"Module"}));function ta(t,a){return t.filter(s=>a.every(r=>{const l=s[r.field],u=r.value;switch(r.operator){case"eq":return l===u;case"ne":return l!==u;case"gt":return typeof l=="number"&&typeof u=="number"&&l>u;case"gte":return typeof l=="number"&&typeof u=="number"&&l>=u;case"lt":return typeof l=="number"&&typeof u=="number"&&l<u;case"lte":return typeof l=="number"&&typeof u=="number"&&l<=u;case"contains":return String(l).toLowerCase().includes(String(u).toLowerCase());case"startsWith":return String(l).toLowerCase().startsWith(String(u).toLowerCase());case"endsWith":return String(l).toLowerCase().endsWith(String(u).toLowerCase());default:return!0}}))}function na(t){return t.map(a=>({field:a.field,type:a.dataType||"string",label:typeof a.header=="string"?a.header:a.field}))}function ia(t,a){const{enableAI:s=!0,aiModel:r,enableNLSearch:l=!0,enableInsights:u=!0,nlPlaceholder:f,onAIFilter:c,onInsights:g,showAISearchBar:N=!0,exampleQueries:D=["Show items from last week","Filter by status = active","Orders over $1000",'Names starting with "A"'],columns:z,data:k,...Q}=t,[V,L]=n.useState(""),[F,v]=n.useState([]),[x,_]=n.useState([]),[j,U]=n.useState(!1),[X,le]=n.useState(null),be=n.useRef(null),{t:T}=Ne.Zt(),G=Ne.se(),{parseFilter:ae,isLoading:ue}=Ne.Ul(),he=s&&G.isConfigured,B=F.length>0?ta(k||[],F):k,$=n.useCallback(async I=>{if(!he||!l||!I.trim())return;le(I);const Y=na(z);try{const O=await ae(I,Y);v(O),c?.(I,O)}catch{v([])}},[he,l,z,ae,c]),E=n.useCallback(()=>{v([]),le(null),L("")},[]),o=n.useCallback(()=>F,[F]),xe=n.useCallback(async()=>{if(!he||!u||!k?.length)return[];try{const I=await G.complete([{role:"user",content:`Analyze this data and provide 3-5 key insights. Data sample (${k.length} total rows): ${JSON.stringify(k.slice(0,20))}
|
|
11
|
+
|
|
12
|
+
Columns: ${z.map(Y=>Y.field).join(", ")}
|
|
13
|
+
|
|
14
|
+
Return a JSON array of insight strings. Be specific with numbers and trends.`}],{temperature:.3,maxTokens:500});try{const Y=JSON.parse(I.content),O=Array.isArray(Y)?Y:[];return _(O),g?.(O),O}catch{return[]}}catch{return[]}},[he,u,k,z,G,g]),we=I=>{I.preventDefault(),V.trim()&&$(V)},se=I=>{L(I),$(I)};return n.useImperativeHandle(a,()=>({applyNLFilter:$,clearAIFilters:E,getAIFilters:o,generateInsights:xe})),e.jsxs("div",{className:"nice-data-grid-ai","data-testid":t["data-testid"],children:[N&&he&&l&&e.jsxs("div",{className:"nice-data-grid-ai__search-bar",children:[e.jsx("div",{className:"nice-data-grid-ai__search-left",children:e.jsx("span",{className:"nice-data-grid-ai__badge",children:"AI"})}),e.jsxs("form",{onSubmit:we,className:"nice-data-grid-ai__search-form",children:[e.jsxs("div",{className:"nice-data-grid-ai__input-wrapper",children:[e.jsx("span",{className:"nice-data-grid-ai__search-icon",children:"🔍"}),e.jsx("input",{ref:be,type:"text",value:V,onChange:I=>L(I.target.value),placeholder:f||T("dataGridAI.searchPlaceholder","Search with natural language..."),className:"nice-data-grid-ai__input",disabled:ue}),ue&&e.jsx("span",{className:"nice-data-grid-ai__loading-spinner"}),V&&!ue&&e.jsx("button",{type:"button",className:"nice-data-grid-ai__clear-input",onClick:()=>L(""),children:"✕"})]}),e.jsx("button",{type:"submit",className:"nice-data-grid-ai__search-btn",disabled:ue||!V.trim(),children:ue?T("dataGridAI.searching","Searching..."):T("dataGridAI.search","Search")})]}),u&&e.jsxs("button",{type:"button",className:"nice-data-grid-ai__insights-btn",onClick:()=>{xe(),U(!0)},disabled:ue||!k?.length,title:T("dataGridAI.generateInsights","Generate AI Insights"),children:["💡 ",T("dataGridAI.insights","Insights")]})]}),N&&he&&l&&!X&&D.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__examples",children:[e.jsx("span",{className:"nice-data-grid-ai__examples-label",children:T("dataGridAI.tryAsking","Try asking:")}),e.jsx("div",{className:"nice-data-grid-ai__examples-list",children:D.slice(0,4).map((I,Y)=>e.jsxs("button",{type:"button",className:"nice-data-grid-ai__example",onClick:()=>se(I),children:['"',I,'"']},Y))})]}),X&&F.length>0&&e.jsxs("div",{className:"nice-data-grid-ai__active-filter",children:[e.jsxs("div",{className:"nice-data-grid-ai__filter-info",children:[e.jsx("span",{className:"nice-data-grid-ai__filter-icon",children:"🎯"}),e.jsxs("span",{className:"nice-data-grid-ai__filter-query",children:['"',X,'"']}),e.jsxs("span",{className:"nice-data-grid-ai__filter-count",children:["(",B?.length||0," ",T("dataGridAI.results","results"),")"]})]}),e.jsx("div",{className:"nice-data-grid-ai__filter-badges",children:F.map((I,Y)=>e.jsxs("span",{className:"nice-data-grid-ai__filter-badge",children:[I.field," ",I.operator," ",String(I.value)]},Y))}),e.jsxs("button",{type:"button",className:"nice-data-grid-ai__clear-filter",onClick:E,children:["✕ ",T("dataGridAI.clearFilter","Clear")]})]}),e.jsx("div",{className:"nice-data-grid-ai__grid-wrapper",children:e.jsx(zn,{columns:z,data:B,...Q})}),j&&e.jsxs("div",{className:"nice-data-grid-ai__insights-panel",children:[e.jsxs("div",{className:"nice-data-grid-ai__insights-header",children:[e.jsxs("h4",{children:["💡 ",T("dataGridAI.aiInsights","AI Insights")]}),e.jsx("button",{type:"button",className:"nice-data-grid-ai__insights-close",onClick:()=>U(!1),children:"✕"})]}),e.jsx("div",{className:"nice-data-grid-ai__insights-body",children:ue?e.jsx("div",{className:"nice-data-grid-ai__insights-loading",children:T("dataGridAI.analyzing","Analyzing data...")}):x.length>0?e.jsx("ul",{className:"nice-data-grid-ai__insights-list",children:x.map((I,Y)=>e.jsxs("li",{className:"nice-data-grid-ai__insight",children:[e.jsx("span",{className:"nice-data-grid-ai__insight-bullet",children:"•"}),I]},Y))}):e.jsx("div",{className:"nice-data-grid-ai__insights-empty",children:T("dataGridAI.noInsights","Click to generate insights from your data")})}),e.jsx("div",{className:"nice-data-grid-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-data-grid-ai__refresh-insights",onClick:()=>xe(),disabled:ue,children:["🔄 ",T("dataGridAI.refresh","Refresh")]})})]})]})}const aa=n.forwardRef(ia),sa=({items:t,selectedKeys:a=[],onSelectionChange:s,selectionMode:r="none",searchable:l,searchPlaceholder:u,grouped:f,groupField:c="group",reorderable:g,onReorder:N,onItemClick:D,renderItem:z,showCheckboxes:k,loading:Q,emptyText:V,size:L="md",bordered:F=!0,swipeActions:v,className:x,style:_,accessMode:j,id:U})=>{const le=Ne.sc(j,U)==="hidden",{t:be}=Ne.Zt(),[T,G]=n.useState(""),[ae,ue]=n.useState(null),[he,B]=n.useState(null),$=n.useRef(null),E=n.useMemo(()=>{if(!T)return t;const I=T.toLowerCase();return t.filter(Y=>Y.text.toLowerCase().includes(I))},[t,T]),o=n.useMemo(()=>{if(!f)return null;const I=new Map;return E.forEach(Y=>{const O=String(Y[c]??"");I.has(O)||I.set(O,[]),I.get(O).push(Y)}),I},[E,f,c]),xe=n.useCallback(I=>{s&&(r==="single"?s(a.includes(I)?[]:[I]):r==="multiple"&&s(a.includes(I)?a.filter(Y=>Y!==I):[...a,I]))},[a,r,s]),we=n.useCallback(I=>{ae!==null&&ae!==I&&N&&N(ae,I),ue(null)},[ae,N]),se=(I,Y)=>{const O=a.includes(I.key),de=he===I.key;return e.jsxs("li",{className:`nice-list__item ${O?"nice-list__item--selected":""} ${I.disabled?"nice-list__item--disabled":""} ${de?"nice-list__item--swiped":""}`,onClick:()=>{I.disabled||(xe(I.key),D?.(I))},draggable:g,onDragStart:()=>ue(Y),onDragOver:pe=>pe.preventDefault(),onDrop:()=>we(Y),onTouchStart:v?.length?pe=>{$.current={x:pe.touches[0].clientX,key:I.key}}:void 0,onTouchEnd:v?.length?pe=>{if(!$.current)return;const Se=pe.changedTouches[0].clientX-$.current.x;Se<-50&&$.current.key===I.key?B(I.key):Se>50&&B(null),$.current=null}:void 0,role:r!=="none"?"option":void 0,"aria-selected":r!=="none"?O:void 0,children:[e.jsxs("div",{className:"nice-list__item-content",children:[k&&r!=="none"&&e.jsx("input",{type:"checkbox",checked:O,readOnly:!0,tabIndex:-1,className:"nice-list__checkbox"}),z?z(I):e.jsxs(e.Fragment,{children:[I.icon&&e.jsx("span",{className:"nice-list__icon",children:I.icon}),e.jsx("span",{className:"nice-list__text",children:I.text}),I.badge&&e.jsx("span",{className:"nice-list__badge",children:I.badge})]})]}),v&&de&&e.jsx("div",{className:"nice-list__swipe-actions",children:v.map(pe=>e.jsx("button",{className:"nice-list__swipe-btn",style:pe.color?{backgroundColor:pe.color}:void 0,onClick:Se=>{Se.stopPropagation(),pe.onClick(I),B(null)},children:pe.label},pe.key))})]},I.key)};return le?null:e.jsxs("div",{className:`nice-list nice-list--${L} ${F?"nice-list--bordered":""} ${x||""}`,style:_,children:[l&&e.jsx("div",{className:"nice-list__search",children:e.jsx("input",{type:"text",value:T,onChange:I=>G(I.target.value),placeholder:u||be("controls.search","Search...")})}),Q?e.jsx("div",{className:"nice-list__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):E.length===0?e.jsx("div",{className:"nice-list__empty",children:V||be("controls.noData","No data available")}):o?e.jsx("div",{role:"listbox",children:Array.from(o.entries()).map(([I,Y])=>e.jsxs("div",{className:"nice-list__group",children:[e.jsx("div",{className:"nice-list__group-header",children:I}),e.jsx("ul",{className:"nice-list__items",children:Y.map((O,de)=>se(O,de))})]},I))}):e.jsx("ul",{className:"nice-list__items",role:"listbox",children:E.map((I,Y)=>se(I,Y))})]})};function vi(t){const a=[];if(t.children)for(const s of t.children)a.push(s.key),a.push(...vi(s));return a}function qn(t,a){if(!t.children||t.children.length===0)return a.has(t.key)?"checked":"unchecked";let s=!0,r=a.has(t.key);for(const l of t.children){const u=qn(l,a);u==="checked"?r=!0:(u==="indeterminate"&&(r=!0),s=!1)}return s&&r?"checked":r?"indeterminate":"unchecked"}const ra=({nodes:t,selectedKeys:a=[],expandedKeys:s,onSelectionChange:r,onExpandedChange:l,selectionMode:u="none",showCheckboxes:f,searchable:c,searchPlaceholder:g,onNodeClick:N,renderNode:D,showLines:z,loading:k,className:Q,style:V,accessMode:L,id:F,draggable:v,onNodeDrop:x,onLoadChildren:_,contextMenuItems:j,onContextMenuAction:U,editable:X,onNodeEdit:le,maxDepth:be})=>{const G=Ne.sc(L,F)==="hidden",{t:ae}=Ne.Zt(),[ue,he]=n.useState([]),[B,$]=n.useState(""),[E,o]=n.useState(new Set),[xe,we]=n.useState(new Map),[se,I]=n.useState(null),[Y,O]=n.useState(null),[de,pe]=n.useState(null),[Se,Ke]=n.useState(""),Ze=n.useRef(null),Fe=s??ue,Le=n.useMemo(()=>new Set(a),[a]),Oe=n.useCallback(async(C,J)=>{const Re=!Fe.includes(C),S=Re?[...Fe,C]:Fe.filter(ce=>ce!==C);if(l?l(S):he(S),Re&&_&&!J.children?.length&&J.leaf!==!0&&!xe.has(C)){o(W=>new Set(W).add(C));const ce=await _(J);we(W=>new Map(W).set(C,ce)),o(W=>{const Ae=new Set(W);return Ae.delete(C),Ae})}},[Fe,l,_,xe]),ge=n.useCallback((C,J)=>{if(r){if(u==="single")r(a.includes(C)?[]:[C]);else if(u==="multiple")if(f&&J.children?.length){const Re=vi(J),S=[C,...Re];if(qn(J,Le)==="checked")r(a.filter(W=>!S.includes(W)));else{const W=new Set([...a,...S]);r(Array.from(W))}}else r(a.includes(C)?a.filter(Re=>Re!==C):[...a,C])}},[a,u,r,f,Le]),H=n.useCallback(C=>{if(!B)return!0;const J=B.toLowerCase();return C.text.toLowerCase().includes(J)?!0:(xe.get(C.key)??C.children)?.some(S=>H(S))??!1},[B,xe]),je=n.useCallback((C,J)=>{j?.length&&(C.preventDefault(),O({x:C.clientX,y:C.clientY,node:J}))},[j]),Ve=n.useCallback(()=>{de&&le&&le(de,Se),pe(null)},[de,Se,le]),ve=(C,J)=>{if(B&&!H(C))return null;const Re=typeof be=="number"?Math.min(10,Math.max(1,be)):1/0,S=J+1>=Re,ce=S?void 0:xe.get(C.key)??C.children,W=!S&&(ce&&ce.length>0||C.leaf!==!0&&_&&!ce?.length),Ae=Fe.includes(C.key),Ee=Le.has(C.key),ee=E.has(C.key),Ge=f&&u==="multiple"&&ce?.length?qn(C,Le):Ee?"checked":"unchecked",qe=Math.min(J+1,10),lt={paddingLeft:J*20+4,"--nice-row-bg":`var(--nice-tree-level-${qe}-bg, transparent)`,"--nice-row-text":`var(--nice-tree-level-${qe}-text, inherit)`,"--nice-row-border":`var(--nice-tree-level-${qe}-border, transparent)`,"--nice-row-hover-bg":`var(--nice-tree-level-${qe}-hover-bg, var(--hover-bg, color-mix(in srgb, var(--text-primary) 6%, transparent)))`,"--nice-row-active-bg":`var(--nice-tree-level-${qe}-active-bg, color-mix(in srgb, var(--color-primary) 14%, transparent))`};return e.jsxs("li",{className:"nice-tree__node",role:"treeitem","aria-expanded":W?Ae:void 0,"data-nice-depth":qe,draggable:v&&!C.disabled,onDragStart:v?ye=>{ye.stopPropagation(),I(C.key)}:void 0,onDragOver:v?ye=>{ye.preventDefault(),ye.stopPropagation()}:void 0,onDrop:v&&se?ye=>{ye.stopPropagation(),x?.(se,C.key,"inside"),I(null)}:void 0,onDragEnd:v?()=>I(null):void 0,children:[e.jsxs("div",{className:`nice-tree__row ${Ee?"nice-tree__row--selected":""} ${C.disabled?"nice-tree__row--disabled":""} ${se===C.key?"nice-tree__row--dragging":""}`,style:lt,onClick:()=>{C.disabled||(ge(C.key,C),N?.(C))},onContextMenu:ye=>je(ye,C),onDoubleClick:X&&!C.disabled?()=>{pe(C.key),Ke(C.text)}:void 0,children:[e.jsx("span",{className:`nice-tree__toggle ${W?Ae?"nice-tree__toggle--expanded":"":"nice-tree__toggle--leaf"}`,onClick:ye=>{ye.stopPropagation(),W&&Oe(C.key,C)},children:ee?e.jsx("span",{className:"nice-spinner nice-spinner--xs"}):W?Ae?"▾":"▸":""}),f&&u!=="none"&&e.jsx("input",{type:"checkbox",checked:Ge==="checked",ref:ye=>{ye&&(ye.indeterminate=Ge==="indeterminate")},onChange:()=>ge(C.key,C),onClick:ye=>ye.stopPropagation(),tabIndex:-1,className:"nice-tree__checkbox"}),de===C.key?e.jsx("input",{type:"text",className:"nice-tree__edit-input",value:Se,onChange:ye=>Ke(ye.target.value),onBlur:Ve,onKeyDown:ye=>{ye.key==="Enter"&&Ve(),ye.key==="Escape"&&pe(null)},autoFocus:!0,onClick:ye=>ye.stopPropagation()}):D?D(C):e.jsxs(e.Fragment,{children:[C.icon&&e.jsx("span",{className:"nice-tree__icon",children:C.icon}),e.jsx("span",{className:"nice-tree__text",children:C.text})]})]}),ce&&ce.length>0&&Ae&&e.jsx("ul",{className:"nice-tree__children",role:"group",children:ce.map(ye=>ve(ye,J+1))})]},C.key)};return G?null:e.jsxs("div",{className:`nice-tree ${z?"nice-tree--lines":""} ${Q||""}`,style:V,ref:Ze,onClick:()=>O(null),children:[c&&e.jsx("div",{className:"nice-tree__search",children:e.jsx("input",{type:"text",value:B,onChange:C=>$(C.target.value),placeholder:g||ae("controls.search","Search..."),"aria-label":g||ae("controls.search","Search tree")})}),k?e.jsx("div",{className:"nice-tree__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):e.jsx("ul",{className:"nice-tree__root",role:"tree",children:t.map(C=>ve(C,0))}),Y&&j&&e.jsx("div",{className:"nice-tree__context-menu",style:{position:"fixed",top:Y.y,left:Y.x,zIndex:9999},children:j.map(C=>e.jsxs("div",{className:`nice-tree__context-item ${C.disabled?"nice-tree__context-item--disabled":""}`,onClick:()=>{C.disabled||(U?.(C.key,Y.node),O(null))},children:[C.icon&&e.jsx("span",{children:C.icon}),C.label]},C.key))})]})};function ca(t,a,s){const r=new Map,l=[];return t.forEach(u=>{const f={...u,children:[]};r.set(String(f[a]),f)}),t.forEach(u=>{const f=u[s];f!=null&&r.has(String(f))?r.get(String(f)).children.push(r.get(String(u[a]))):l.push(r.get(String(u[a])))}),l}function la({columns:t,data:a,keyField:s="key",parentKeyField:r="parentKey",expandedKeys:l,onExpandedChange:u,selectedKeys:f=[],onSelectionChange:c,selectable:g,loading:N,emptyText:D,className:z,style:k,accessMode:Q,id:V}){const F=Ne.sc(Q,V)==="hidden",{t:v}=Ne.Zt(),[x,_]=n.useState([]),j=l??x,U=n.useMemo(()=>ca(a,s,r),[a,s,r]),X=n.useMemo(()=>t.filter(G=>!G.hidden),[t]),le=n.useCallback(G=>{const ae=j.includes(G)?j.filter(ue=>ue!==G):[...j,G];u?u(ae):_(ae)},[j,u]),be=n.useCallback(G=>{c&&c(f.includes(G)?f.filter(ae=>ae!==G):[...f,G])},[f,c]),T=(G,ae)=>{const ue=String(G[s]),he=G.children&&G.children.length>0,B=j.includes(ue),$=f.includes(ue);return e.jsxs(n.Fragment,{children:[e.jsxs("tr",{className:$?"nice-treelist__row--selected":"",children:[g&&e.jsx("td",{className:"nice-treelist__checkbox",children:e.jsx("input",{type:"checkbox",checked:$,onChange:()=>be(ue)})}),X.map((E,o)=>e.jsxs("td",{style:{textAlign:E.align},children:[o===0&&e.jsx("span",{style:{display:"inline-block",width:ae*20}}),o===0&&e.jsx("span",{className:"nice-treelist__toggle",onClick:()=>he&&le(ue),style:{cursor:he?"pointer":"default",width:20,display:"inline-block"},children:he?B?"▾":"▸":""}),E.render?E.render(G[E.field],G,0):String(G[E.field]??"")]},E.field))]}),he&&B&&G.children.map(E=>T(E,ae+1))]},ue)};return F?null:e.jsx("div",{className:`nice-treelist ${z||""}`,style:k,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[g&&e.jsx("th",{className:"nice-treelist__checkbox"}),X.map(G=>e.jsx("th",{style:{width:G.width,minWidth:G.minWidth,textAlign:G.align},children:G.header},G.field))]})}),e.jsx("tbody",{children:N?e.jsx("tr",{children:e.jsx("td",{colSpan:X.length+(g?1:0),className:"nice-treelist__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):U.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:X.length+(g?1:0),className:"nice-treelist__empty",children:D||v("controls.noData","No data available")})}):U.map(G=>T(G,0))})]})})}function oa({items:t,renderCard:a,columns:s=3,gap:r=16,searchable:l,searchField:u="text",searchPlaceholder:f,loading:c,emptyText:g,onCardClick:N,className:D,style:z,accessMode:k,id:Q}){const L=Ne.sc(k,Q)==="hidden",{t:F}=Ne.Zt(),[v,x]=n.useState(""),_=n.useMemo(()=>{if(!v)return t;const j=v.toLowerCase();return t.filter(U=>String(U[u]??"").toLowerCase().includes(j))},[t,v,u]);return L?null:e.jsxs("div",{className:`nice-cardview ${D||""}`,style:z,children:[l&&e.jsx("div",{className:"nice-cardview__search",children:e.jsx("input",{type:"text",value:v,onChange:j=>x(j.target.value),placeholder:f||F("controls.search","Search...")})}),c?e.jsx("div",{className:"nice-cardview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):_.length===0?e.jsx("div",{className:"nice-cardview__empty",children:g||F("controls.noData","No data available")}):e.jsx("div",{className:"nice-cardview__grid",style:{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gap:r},children:_.map(j=>e.jsx("div",{className:"nice-cardview__card",onClick:()=>N?.(j),style:N?{cursor:"pointer"}:void 0,children:a(j)},j.key))})]})}function da({items:t,tileWidth:a=180,tileHeight:s=180,direction:r="horizontal",renderTile:l,onTileClick:u,loading:f,emptyText:c,className:g,style:N}){const{t:D}=Ne.Zt();return e.jsx("div",{className:`nice-tileview nice-tileview--${r} ${g||""}`,style:N,children:f?e.jsx("div",{className:"nice-tileview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):t.length===0?e.jsx("div",{className:"nice-tileview__empty",children:c||D("controls.noData","No data available")}):e.jsx("div",{className:"nice-tileview__container",style:{display:"flex",flexWrap:"wrap",gap:8,flexDirection:r==="vertical"?"column":"row"},children:t.map(z=>e.jsx("div",{className:"nice-tileview__tile",style:{width:a,height:s,cursor:u?"pointer":void 0},onClick:()=>u?.(z),children:l?l(z):e.jsxs(e.Fragment,{children:[z.image&&e.jsx("img",{src:z.image,alt:z.text||"",className:"nice-tileview__image"}),z.text&&e.jsx("div",{className:"nice-tileview__label",children:z.text})]})},z.key))})})}const mi=[{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],yi=({fields:t,onChange:a,className:s,style:r})=>{const l=t.filter(c=>!c.area),u=(c,g)=>{a(t.map(N=>N.field===c?{...N,area:g}:N))},f=c=>{a(t.map(g=>g.field===c?{...g,area:void 0}:g))};return e.jsx("div",{className:`nice-field-chooser ${s||""}`,style:r,children:e.jsxs("div",{className:"nice-field-chooser__panel",children:[e.jsxs("div",{className:"nice-field-chooser__section",children:[e.jsx("h4",{children:"Available Fields"}),e.jsx("ul",{children:l.map(c=>e.jsxs("li",{className:"nice-field-chooser__item",children:[e.jsx("span",{children:c.caption}),e.jsx("div",{className:"nice-field-chooser__actions",children:mi.map(g=>e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>u(c.field,g.key),children:g.label},g.key))})]},c.field))})]}),mi.map(c=>{const g=t.filter(N=>N.area===c.key);return e.jsxs("div",{className:"nice-field-chooser__section",children:[e.jsx("h4",{children:c.label}),e.jsx("ul",{children:g.map(N=>e.jsxs("li",{className:"nice-field-chooser__item",children:[e.jsx("span",{children:N.caption}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>f(N.field),children:"✕"})]},N.field))})]},c.key)})]})})};function ua(t,a){if(t.length===0)return 0;switch(a){case"sum":return t.reduce((s,r)=>s+r,0);case"count":return t.length;case"avg":return t.reduce((s,r)=>s+r,0)/t.length;case"min":return Math.min(...t);case"max":return Math.max(...t);default:return t.reduce((s,r)=>s+r,0)}}function hi(t,a){return[...new Set(t.map(s=>String(s[a]??"")))].sort()}const ji=({data:t,fields:a,onFieldsChange:s,showFieldChooser:r,loading:l,emptyText:u,exportCsv:f,exportFilename:c="pivot-export",onDrillThrough:g,className:N,style:D,accessMode:z,id:k})=>{const V=Ne.sc(z,k)==="hidden",{t:L}=Ne.Zt(),[F,v]=n.useState(a),[x,_]=n.useState(!1),j=n.useMemo(()=>F.filter(B=>B.area==="row"),[F]),U=n.useMemo(()=>F.filter(B=>B.area==="column"),[F]),X=n.useMemo(()=>F.filter(B=>B.area==="data"),[F]),le=n.useMemo(()=>j.length===0?["Total"]:hi(t,j[0].field),[t,j]),be=n.useMemo(()=>U.length===0?["Total"]:hi(t,U[0].field),[t,U]),T=n.useCallback((B,$,E)=>{let o=t;j.length>0&&(o=o.filter(se=>String(se[j[0].field])===B)),U.length>0&&(o=o.filter(se=>String(se[U[0].field])===$));const xe=o.map(se=>Number(se[E.field])||0),we=ua(xe,E.summaryType||"sum");return E.format?E.format(we):we},[t,j,U]),G=n.useCallback(B=>{v(B),s?.(B)},[s]),ae=n.useCallback((B,$)=>{let E=t;return j.length>0&&(E=E.filter(o=>String(o[j[0].field])===B)),U.length>0&&(E=E.filter(o=>String(o[U[0].field])===$)),E},[t,j,U]),ue=n.useCallback((B,$)=>{g&&g(B,$,ae(B,$))},[g,ae]),he=n.useCallback(()=>{const B=["",...be.flatMap(se=>X.length>0?X.map(I=>`${se} - ${I.caption}`):[se])],$=le.map(se=>{const I=be.flatMap(Y=>X.length>0?X.map(O=>String(T(se,Y,O))):["—"]);return[se,...I]}),E=[B,...$].map(se=>se.map(I=>`"${String(I).replace(/"/g,'""')}"`).join(",")).join(`
|
|
15
|
+
`),o=new Blob(["\uFEFF"+E],{type:"text/csv;charset=utf-8;"}),xe=URL.createObjectURL(o),we=document.createElement("a");we.href=xe,we.download=`${c}.csv`,we.click(),URL.revokeObjectURL(xe)},[be,le,X,T,c]);return V?null:e.jsxs("div",{className:`nice-pivotgrid ${N||""}`,style:D,children:[(r||f)&&e.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[r&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm",onClick:()=>_(!x),children:L("controls.fieldChooser","Field Chooser")}),f&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:he,children:"CSV ↓"})]}),x&&e.jsx(yi,{fields:F,onChange:G}),l?e.jsx("div",{className:"nice-pivotgrid__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):e.jsx("div",{className:"nice-pivotgrid__table-wrap",children:e.jsxs("table",{className:"nice-pivotgrid__table",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{children:j.map(B=>B.caption).join(" / ")||""}),be.map(B=>e.jsx("th",{colSpan:X.length||1,children:B},B))]}),X.length>1&&e.jsxs("tr",{children:[e.jsx("th",{}),be.map(B=>X.map($=>e.jsx("th",{children:$.caption},`${B}-${$.field}`)))]})]}),e.jsx("tbody",{children:le.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:1+be.length*Math.max(X.length,1),className:"nice-pivotgrid__empty",children:u||L("controls.noData","No data available")})}):le.map(B=>e.jsxs("tr",{children:[e.jsx("td",{className:"nice-pivotgrid__row-header",children:B}),be.map($=>X.length>0?X.map(E=>e.jsx("td",{className:`nice-pivotgrid__cell ${g?"nice-pivotgrid__cell--clickable":""}`,onClick:g?()=>ue(B,$):void 0,children:T(B,$,E)},`${$}-${E.field}`)):e.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},$))]},B))})]})})]})},ma=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:ji},Symbol.toStringTag,{value:"Module"}));function ha({open:t}){return e.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transition:"transform 160ms ease",transform:t?"rotate(0deg)":"rotate(-90deg)"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function pa(){return e.jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}const fa=[{target:".nice-kanban",titleKey:"tutorial.kanbanBoard.intro.title",title:"Kanban board",contentKey:"tutorial.kanbanBoard.intro.content",content:'Drag cards between columns to change their status, add cards with the "+" button, and click a card to edit its details.',placement:"auto"}],Ni=n.forwardRef(({columns:t,cards:a,onCardMove:s,onCardClick:r,renderCard:l,onAddCard:u,disabled:f=!1,size:c="md",collapsible:g=!1,layoutMode:N="scroll",viewMode:D,onViewModeChange:z,collapsedColumns:k,onCollapsedColumnsChange:Q,formItems:V,formColumns:L=1,formProps:F,editCardTitle:v,newCardTitle:x,onCardEdit:_,onCardCreate:j,onCardDelete:U,tutorial:X,cookies:le=!1,localStorage:be=!0,sessionStorage:T=!1,storageMode:G,storageKey:ae,className:ue,style:he,id:B,...$},E)=>{const{t:o}=Ne.Zt(),[xe,we]=n.useState(null),[se,I]=n.useState(null),[Y,O]=n.useState(null),de=!!V&&(!!_||!!j),pe=n.useCallback(S=>{if(de&&_){O({key:S.key,data:{...S},column:S.column});return}r?.(S)},[de,r,_]),Se=n.useCallback(S=>{if(de&&j){O({key:null,data:{title:"",description:""},column:S});return}u?.(S)},[de,u,j]),Ke=Ne.useStorageAdapter(ae??"nice-kanban"),[Ze,Fe]=n.useState(()=>Ke.get("state")??{collapsedColumns:[],viewMode:"default"}),Le=k??Ze.collapsedColumns??[],Oe=D??Ze.viewMode??"default",ge=n.useCallback(S=>{Fe(ce=>{const W={...ce,...S};return Ke.set("state",W),W})},[Ke]),H=n.useCallback(S=>{const ce=Le.includes(S)?Le.filter(W=>W!==S):[...Le,S];Q?Q(ce):ge({collapsedColumns:ce})},[Le,Q,ge]);n.useCallback(S=>{z?z(S):ge({viewMode:S})},[z,ge]);const je=n.useCallback(S=>a.filter(ce=>ce.column===S).sort((ce,W)=>(ce.order??0)-(W.order??0)),[a]),Ve=n.useCallback((S,ce)=>{f||(S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",String(ce.key)),we({cardKey:ce.key,fromColumn:ce.column}))},[f]),ve=n.useCallback((S,ce)=>{S.preventDefault(),S.dataTransfer.dropEffect="move",I({column:ce})},[]),C=n.useCallback(()=>{I(null)},[]),J=n.useCallback((S,ce)=>{if(S.preventDefault(),I(null),!xe||f)return;const W=je(ce);s?.(xe.cardKey,ce,W.length),we(null)},[xe,f,je,s]),Re=n.useCallback(()=>{we(null),I(null)},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:E,id:B,className:`nice-kanban nice-kanban--${c} nice-kanban--${Oe} nice-kanban--layout-${N} ${f?"nice-kanban--disabled":""} ${ue||""}`,style:{position:"relative",...he},...$,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(Ne.wl,{steps:Ne.xl(X,fa)})}),t.map(S=>{const ce=je(S.key),W=se?.column===S.key,Ae=S.limit!=null&&ce.length>=S.limit,Ee=g&&Le.includes(S.key);return e.jsxs("div",{className:`nice-kanban__column ${W?"nice-kanban__column--dragover":""} ${Ee?"nice-kanban__column--collapsed":""}`,onDragOver:ee=>!Ee&&ve(ee,S.key),onDragLeave:C,onDrop:ee=>!Ee&&J(ee,S.key),children:[e.jsxs("div",{className:"nice-kanban__column-header",style:S.color?{borderTopColor:S.color}:void 0,onClick:g?()=>H(S.key):void 0,role:g?"button":void 0,tabIndex:g?0:void 0,onKeyDown:g?ee=>{(ee.key==="Enter"||ee.key===" ")&&H(S.key)}:void 0,children:[g&&e.jsx("span",{className:"nice-kanban__collapse-icon","aria-hidden":"true",children:e.jsx(ha,{open:!Ee})}),e.jsx("span",{className:"nice-kanban__column-title",children:S.title}),e.jsxs("span",{className:"nice-kanban__column-count",children:[ce.length,S.limit!=null&&` / ${S.limit}`]})]}),!Ee&&e.jsxs("div",{className:"nice-kanban__column-body",children:[ce.map(ee=>e.jsx("div",{className:`nice-kanban__card nice-kanban__card--${Oe} ${xe?.cardKey===ee.key?"nice-kanban__card--dragging":""}`,draggable:!f,onDragStart:Ge=>Ve(Ge,ee),onDragEnd:Re,onClick:()=>pe(ee),role:"article",children:l?l(ee):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-kanban__card-title",children:ee.title}),Oe!=="compact"&&ee.description&&e.jsx("div",{className:"nice-kanban__card-desc",children:ee.description})]})},ee.key)),ce.length===0&&e.jsx("div",{className:"nice-kanban__empty",children:o("kanban.empty","No cards")})]}),!Ee&&(u||de&&j)&&!Ae&&e.jsxs("button",{type:"button",className:"nice-kanban__add",onClick:()=>Se(S.key),disabled:f,children:[e.jsx(pa,{})," ",o("kanban.addCard","Add card")]})]},S.key)})]}),de&&Y&&e.jsxs(xi.NiceModal,{open:!0,onClose:()=>O(null),title:Y.key==null?x||o("kanban.newCard","New card"):v||o("kanban.editCard","Edit card"),children:[e.jsx(gi.NiceForm,{items:V,data:Y.data,columns:L,...F,onFieldChange:(S,ce)=>O(W=>W&&{...W,data:{...W.data,[S]:ce}})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,flexWrap:"wrap"},children:[Y.key!=null&&U&&e.jsx($e.NiceButton,{type:"button",size:"sm",variant:"error",style:{marginRight:"auto"},onClick:()=>{U(Y.key),O(null)},children:o("controls.delete","Delete")}),e.jsx($e.NiceButton,{type:"button",size:"sm",variant:"secondary",onClick:()=>O(null),children:o("controls.cancel","Cancel")}),e.jsx($e.NiceButton,{type:"button",size:"sm",variant:"primary",onClick:()=>{if(Y.key==null){const S={key:`card-${Date.now()}`,title:"",column:Y.column,...Y.data};j?.(S)}else _?.(Y.key,{...Y.data,key:Y.key,column:Y.column});O(null)},children:o("controls.save","Save")})]})]})]})});Ni.displayName="NiceKanbanBoard";function zt(...t){return t.filter(Boolean).map(a=>typeof a=="object"?Object.entries(a).filter(([,s])=>s).map(([s])=>s).join(" "):a).join(" ")}const ga=50,xa=[10,25,50,100,200],_a=40,ba=10,va=768,ya=500,ja=10;function yt(t,a){return a.split(".").reduce((s,r)=>s?.[r],t)}function Nn(t,a,s="pl-PL"){if(t==null)return"—";switch(a.type){case"number":return new Intl.NumberFormat(s,{minimumFractionDigits:a.format?.includes(".")?a.format.split(".")[1].length:0}).format(t);case"currency":return new Intl.NumberFormat(s,{style:"currency",currency:a.currencyCode||"PLN"}).format(t);case"percent":return new Intl.NumberFormat(s,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}).format(t/100);case"date":return new Intl.DateTimeFormat(s,{dateStyle:"short"}).format(new Date(t));case"datetime":return new Intl.DateTimeFormat(s,{dateStyle:"short",timeStyle:"short"}).format(new Date(t));case"boolean":return t?"✓":"✗";case"enum":return a.enumOptions?.find(l=>l.value===t)?.label||String(t);default:return String(t)}}function Na(t,a,s,r){const[l,u]=n.useState(0),{startIndex:f,endIndex:c,totalHeight:g,offsetY:N}=n.useMemo(()=>{const k=t.length*s,Q=Math.ceil(a/s),V=Math.max(0,Math.floor(l/s)-r),L=Math.min(t.length,Math.ceil(l/s)+Q+r),F=V*s;return{startIndex:V,endIndex:L,totalHeight:k,offsetY:F}},[t.length,a,s,l,r]),D=n.useMemo(()=>t.slice(f,c),[t,f,c]),z=n.useCallback(k=>{u(k.currentTarget.scrollTop)},[]);return{visibleData:D,totalHeight:g,offsetY:N,handleScroll:z,startIndex:f}}function wa(t,a){const[s,r]=n.useState(()=>{if(t&&typeof window<"u"){const u=localStorage.getItem(`nice-module-grid-${t}`);if(u)return JSON.parse(u)}return a||{}}),l=n.useCallback(u=>{r(f=>{const c={...f,...u};return t&&typeof window<"u"&&localStorage.setItem(`nice-module-grid-${t}`,JSON.stringify(c)),c})},[t]);return[s,l]}function ka(t){const[a,s]=n.useState(typeof window<"u"&&window.innerWidth<t);return n.useEffect(()=>{if(typeof window>"u")return;const r=()=>s(window.innerWidth<t);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[t]),a}function Sa({column:t,sort:a,onSort:s,onResize:r,resizable:l,t:u}){const f=n.useRef(null),[c,g]=n.useState(!1),N=n.useCallback(k=>{if(!l||!r)return;k.preventDefault(),g(!0);const Q=k.clientX,V=t.width||150,L=v=>{const x=v.clientX-Q,_=Math.max(t.minWidth||50,V+x);r(t.field,Math.min(_,t.maxWidth||1/0))},F=()=>{g(!1),document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",F)};document.addEventListener("mousemove",L),document.addEventListener("mouseup",F)},[t,l,r]),D=a?.direction,z=D==="asc"?"↑":D==="desc"?"↓":null;return e.jsxs("div",{className:zt("nice-module-grid__header-cell",t.sortable&&"nice-module-grid__header-cell--sortable",c&&"nice-module-grid__header-cell--resizing"),style:{width:t.width==="auto"?"auto":t.width||150,minWidth:t.minWidth,maxWidth:t.maxWidth,textAlign:t.align},onClick:()=>t.sortable&&s?.(t.field),role:"columnheader","aria-sort":D==="asc"?"ascending":D==="desc"?"descending":"none",title:t.headerTooltip,children:[e.jsx("span",{className:"nice-module-grid__header-text",children:t.header}),z&&e.jsx("span",{className:"nice-module-grid__sort-indicator",children:z}),l&&e.jsx("div",{ref:f,className:"nice-module-grid__resize-handle",onMouseDown:N})]})}function Ca({column:t,row:a,rowIndex:s,value:r,locale:l="pl-PL",onClick:u}){const f=Ne.Mc({onClick:u}),c=u?f:{};if(t.render)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:t.render(r,a,s)});if(t.type==="enum"&&t.enumOptions){const g=t.enumOptions.find(N=>N.value===r);if(g)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsxs("span",{className:zt("nice-module-grid__badge",`nice-module-grid__badge--${g.color||"default"}`),children:[g.icon&&e.jsx("span",{className:"nice-module-grid__badge-icon",children:g.icon}),g.label]})})}if(t.type==="progress"){const g=Math.min(100,Math.max(0,Number(r)||0));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsxs("div",{className:"nice-module-grid__progress",children:[e.jsx("div",{className:zt("nice-module-grid__progress-bar",`nice-module-grid__progress-bar--${t.progressColor||"primary"}`),style:{width:`${g}%`}}),e.jsxs("span",{className:"nice-module-grid__progress-text",children:[g,"%"]})]})})}if(t.type==="rating"){const g=t.maxRating||5,N=Number(r)||0;return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsx("span",{className:"nice-module-grid__rating","aria-label":`${N} out of ${g} stars`,children:Array.from({length:g},(D,z)=>e.jsx("span",{className:zt("nice-module-grid__star",z<N&&"nice-module-grid__star--filled"),children:"★"},z))})})}if(t.type==="link"&&t.linkTemplate){const g=t.linkTemplate.replace(/\{\{(\w+)\}\}/g,(N,D)=>String(yt(a,D)??""));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsx("a",{href:g,target:t.linkNewTab?"_blank":void 0,rel:t.linkNewTab?"noopener noreferrer":void 0,className:"nice-module-grid__link",children:Nn(r,t,l)})})}if(t.type==="image"){const N={xs:24,sm:32,md:48,lg:64}[t.imageSize||"sm"];return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:r?e.jsx("img",{src:String(r),alt:"",className:"nice-module-grid__image",style:{width:N,height:N}}):e.jsx("div",{className:"nice-module-grid__image-placeholder",style:{width:N,height:N}})})}return t.type==="avatar"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:r?e.jsx("img",{src:String(r),alt:"",className:"nice-module-grid__avatar"}):e.jsx("div",{className:"nice-module-grid__avatar-placeholder",children:"?"})}):t.type==="color"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsx("span",{className:"nice-module-grid__color-swatch",style:{backgroundColor:r||"transparent"},title:r})}):t.type==="boolean"?e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align||"center"},...c,children:e.jsx("span",{className:zt("nice-module-grid__boolean",!!r&&"nice-module-grid__boolean--true"),children:r?"✓":"✗"})}):e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:Nn(r,t,l)})}function Ma({row:t,index:a,columns:s,primaryField:r,secondaryField:l,customRender:u,selected:f,onClick:c,locale:g="pl-PL",t:N}){if(u)return e.jsx("div",{className:zt("nice-module-grid__mobile-card",f&&"nice-module-grid__mobile-card--selected"),onClick:c,children:u(t,a)});const D=s.find(k=>k.field===r)||s[0],z=s.find(k=>k.field===l)||s[1];return e.jsxs("div",{className:zt("nice-module-grid__mobile-card",f&&"nice-module-grid__mobile-card--selected"),onClick:c,role:"row","aria-selected":f,children:[e.jsxs("div",{className:"nice-module-grid__mobile-card-header",children:[e.jsx("div",{className:"nice-module-grid__mobile-card-title",children:Nn(yt(t,D?.field||""),D,g)}),z&&e.jsx("div",{className:"nice-module-grid__mobile-card-subtitle",children:Nn(yt(t,z.field),z,g)})]}),e.jsx("div",{className:"nice-module-grid__mobile-card-body",children:s.filter(k=>!k.hidden&&k.field!==r&&k.field!==l).slice(0,4).map(k=>e.jsxs("div",{className:"nice-module-grid__mobile-card-field",children:[e.jsx("span",{className:"nice-module-grid__mobile-card-label",children:k.header}),e.jsx("span",{className:"nice-module-grid__mobile-card-value",children:Nn(yt(t,k.field),k,g)})]},k.field))})]})}function Da({page:t,pageSize:a,totalRows:s,pageSizeOptions:r,onPageChange:l,t:u}){const f=Math.ceil(s/a),c=(t-1)*a+1,g=Math.min(t*a,s);return e.jsxs("div",{className:"nice-module-grid__pagination",role:"navigation","aria-label":u("pagination.ariaLabel","Pagination"),children:[e.jsxs("div",{className:"nice-module-grid__pagination-info",children:[u("pagination.showing","Showing")," ",c,"–",g," ",u("pagination.of","of")," ",s]}),e.jsxs("div",{className:"nice-module-grid__pagination-controls",children:[e.jsx("select",{className:"nice-module-grid__page-size-select",value:a,onChange:N=>l(1,Number(N.target.value)),"aria-label":u("pagination.rowsPerPage","Rows per page"),children:r.map(N=>e.jsx("option",{value:N,children:N},N))}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>l(1,a),disabled:t===1,"aria-label":u("pagination.first","First"),children:"««"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>l(t-1,a),disabled:t===1,"aria-label":u("pagination.previous","Previous"),children:"«"}),e.jsxs("span",{className:"nice-module-grid__pagination-page",children:[t," / ",f]}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>l(t+1,a),disabled:t>=f,"aria-label":u("pagination.next","Next"),children:"»"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>l(f,a),disabled:t>=f,"aria-label":u("pagination.last","Last"),children:"»»"})]})]})}function Ia({columns:t}){return e.jsx("div",{className:"nice-module-grid__row nice-module-grid__row--skeleton",role:"row",children:t.filter(a=>!a.hidden).map(a=>e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--skeleton",style:{width:a.width==="auto"?"auto":a.width||150},children:e.jsx("div",{className:"nice-module-grid__skeleton-bar"})},a.field))})}function Ra(t,a){const{columns:s,data:r,keyField:l="id",dataSource:u,onFetch:f,sortable:c=!0,sort:g,onSortChange:N,multiSort:D=!1,filterable:z=!1,filter:k,onFilterChange:Q,searchText:V,onSearchChange:L,searchPlaceholder:F="moduleGrid.searchPlaceholder",pagination:v=!0,page:x,pageSize:_,pageSizeOptions:j=xa,totalRows:U,onPageChange:X,virtualScroll:le=!0,rowHeight:be=_a,overscan:T=ba,selectionMode:G="none",selectedKeys:ae,onSelectionChange:ue,columnReorder:he=!0,onColumnOrderChange:B,columnResize:$=!0,onColumnWidthChange:E,groupBy:o,onGroupByChange:xe,groupRowRender:we,expandAllGroups:se=!1,editable:I=!1,onCellEdit:Y,onRowEdit:O,editMode:de="cell",contextMenuItems:pe,onContextMenuAction:Se,exportable:Ke=!0,exportFormats:Ze=["csv","excel"],onExport:Fe,preferencesKey:Le,initialPreferences:Oe,onPreferencesChange:ge,density:H="normal",striped:je=!0,bordered:Ve=!1,hoverable:ve=!0,loading:C=!1,emptyState:J,toolbar:Re,onRowClick:S,onRowDoubleClick:ce,rowClassName:W,rowStyle:Ae,mobileCardView:Ee=!0,mobileBreakpoint:ee=va,mobileCardRender:Ge,mobilePrimaryField:qe,mobileSecondaryField:lt,moduleId:ye,permissions:Wt,size:Pt="medium",skeletonLoading:ut=!0,skeletonRows:at=ja,"aria-label":A,"aria-labelledby":ne,"aria-describedby":fe,className:Xe,style:Je,id:ke,testId:Te}=t,{t:Be}=Ne.Zt();Ne.sc(),Ne.Ns("table");const tt=ka(ee),[He,mt]=wa(Le,Oe),Ft=n.useRef(null),sn=n.useRef(null),[pn,wn]=n.useState([]),[st,Pn]=n.useState(),[fn,gn]=n.useState(""),[Jt,kt]=n.useState(1),[rn,m]=n.useState(_||ga),[h,P]=n.useState(new Set),[M,Z]=n.useState([]),[w,q]=n.useState(0),[ie,oe]=n.useState(!1),[Ue,ze]=n.useState(new Set),[Me,nt]=n.useState(null),[Dt,It]=n.useState({}),rt=g??pn,en=k??st,Gt=V??fn,Kt=x??Jt,Vt=_??rn,ot=ae??h,kn=U??w??r?.length??0,Ot=!!(f||u),ht=n.useMemo(()=>{const y=new Set(He.hiddenColumns||[]);return s.filter(me=>!me.hidden&&!y.has(me.field))},[s,He.hiddenColumns]),jt=n.useMemo(()=>{if(Ot)return M;if(!r)return[];let y=[...r];if(Gt){const me=Gt.toLowerCase(),Ce=s.filter(Ie=>Ie.searchable!==!1).map(Ie=>Ie.field);y=y.filter(Ie=>Ce.some(ft=>{const Et=yt(Ie,ft);return String(Et??"").toLowerCase().includes(me)}))}return rt.length>0&&y.sort((me,Ce)=>{for(const Ie of rt){const ft=yt(me,Ie.field),Et=yt(Ce,Ie.field),Ct=ft<Et?-1:ft>Et?1:0;if(Ct!==0)return Ie.direction==="asc"?Ct:-Ct}return 0}),y},[Ot,M,r,Gt,rt,s]),Bt=n.useMemo(()=>{if(Ot||!v)return jt;const y=(Kt-1)*Vt;return jt.slice(y,y+Vt)},[Ot,jt,v,Kt,Vt]),Rt=Ft.current?.clientHeight||400,Zt=le&&Bt.length>ya,{visibleData:cn,totalHeight:tn,offsetY:qt,handleScroll:Ut,startIndex:Xt}=Na(Bt,Rt,be,T),At=Zt?cn:Bt,xn=n.useCallback(async()=>{if(f){oe(!0);try{const me=await f({page:Kt,pageSize:Vt,sort:rt,filter:en,search:Gt});Z(me.data),q(me.total)}catch(y){console.error("NiceModuleGrid fetch error:",y)}finally{oe(!1)}}},[f,Kt,Vt,rt,en,Gt]);n.useEffect(()=>{Ot&&xn()},[Ot,xn]);const Fn=n.useCallback(y=>{const me=rt.find(Ie=>Ie.field===y);let Ce;me?me.direction==="asc"?Ce=rt.map(Ie=>Ie.field===y?{...Ie,direction:"desc"}:Ie):Ce=rt.filter(Ie=>Ie.field!==y):Ce=D?[...rt,{field:y,direction:"asc"}]:[{field:y,direction:"asc"}],N?N(Ce):wn(Ce)},[rt,D,N]),Sn=n.useCallback((y,me)=>{X?X(y,me):(kt(y),m(me))},[X]),On=n.useCallback(y=>{L?L(y):gn(y),X||kt(1)},[L,X]),_n=n.useCallback((y,me)=>{const Ce=new Set(ot);if(G==="single"?(Ce.clear(),Ce.add(y)):(G==="multiple"||G==="checkbox")&&(Ce.has(y)?Ce.delete(y):Ce.add(y)),ue){const Ie=Bt.filter(ft=>Ce.has(String(yt(ft,l))));ue(Ce,Ie)}else P(Ce)},[ot,G,ue,Bt,l]),ln=n.useCallback((y,me)=>{It(Ce=>({...Ce,[y]:me})),E?.(y,me),mt({columnWidths:{...He.columnWidths,[y]:me}})},[E,mt,He.columnWidths]),St=n.useCallback((y,me)=>{pe?.length&&(y.preventDefault(),nt({x:y.clientX,y:y.clientY,row:me}))},[pe]),Cn=n.useCallback(y=>{Me&&Se?.(y,Me.row),nt(null)},[Me,Se]),Ht=n.useCallback(async y=>{if(Fe)await Fe(y,{selectedOnly:ot.size>0,columns:ht.map(me=>me.field)});else if(y==="csv"){const me=ht.map(ct=>ct.header).join(","),Ce=Bt.map(ct=>ht.map(Hn=>JSON.stringify(yt(ct,Hn.field)??"")).join(",")),Ie=[me,...Ce].join(`
|
|
16
|
+
`),ft=new Blob([Ie],{type:"text/csv;charset=utf-8;"}),Et=URL.createObjectURL(ft),Ct=document.createElement("a");Ct.href=Et,Ct.download=`export-${new Date().toISOString().slice(0,10)}.csv`,Ct.click(),URL.revokeObjectURL(Et)}},[Fe,ot,ht,Bt,Be]);n.useEffect(()=>{if(!Me)return;const y=()=>nt(null);return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[Me]);const Qt=n.useCallback(y=>{y.key==="Escape"&&nt(null)},[]),pt=C||ie,on=!pt&&At.length===0,Mn=tt&&Ee,Bn=zt("nice-module-grid",`nice-module-grid--${H}`,`nice-module-grid--${Pt}`,je&&"nice-module-grid--striped",Ve&&"nice-module-grid--bordered",ve&&"nice-module-grid--hoverable",pt&&"nice-module-grid--loading",Mn&&"nice-module-grid--mobile",Xe);return e.jsxs("div",{ref:a,id:ke,"data-testid":Te,className:Bn,style:Je,onKeyDown:Qt,role:"grid","aria-label":A,"aria-labelledby":ne,"aria-describedby":fe,"aria-rowcount":kn,"aria-colcount":ht.length,"aria-busy":pt,children:[e.jsxs("div",{className:"nice-module-grid__toolbar",children:[e.jsx("div",{className:"nice-module-grid__toolbar-search",children:e.jsx("input",{type:"search",className:"nice-module-grid__search-input",placeholder:F,value:Gt,onChange:y=>On(y.target.value),"aria-label":Be("moduleGrid.searchAriaLabel","Search")})}),Re,Ke&&e.jsx("div",{className:"nice-module-grid__toolbar-export",children:Ze.map(y=>e.jsx("button",{className:"nice-module-grid__export-btn",onClick:()=>Ht(y),"aria-label":Be(`moduleGrid.export.${y}`,`Export to ${y.toUpperCase()}`),children:y.toUpperCase()},y))})]}),e.jsx("div",{ref:Ft,className:"nice-module-grid__container",onScroll:Zt?Ut:void 0,children:Mn?e.jsx("div",{className:"nice-module-grid__mobile-list",children:pt&&ut?Array.from({length:at},(y,me)=>e.jsxs("div",{className:"nice-module-grid__mobile-card nice-module-grid__mobile-card--skeleton",children:[e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"60%",height:20}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"40%",height:14}}),e.jsx("div",{className:"nice-module-grid__skeleton-bar",style:{width:"80%",height:14}})]},me)):on?e.jsxs("div",{className:"nice-module-grid__empty",children:[J?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:J.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:J?.title||Be("moduleGrid.noData","No data")}),J?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:J.description}),J?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:J.action.onClick,children:[J.action.icon,J.action.label]})]}):At.map((y,me)=>{const Ce=String(yt(y,l));return e.jsx(Ma,{row:y,index:Xt+me,columns:ht,primaryField:qe,secondaryField:lt,customRender:Ge,selected:ot.has(Ce),onClick:()=>{G!=="none"&&_n(Ce,y),S?.(y,Xt+me)},t:Be},Ce)})}):e.jsxs("div",{ref:sn,className:"nice-module-grid__table",children:[e.jsxs("div",{className:"nice-module-grid__header",role:"row",children:[G==="checkbox"&&e.jsx("div",{className:"nice-module-grid__header-cell nice-module-grid__header-cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:ot.size>0&&ot.size===At.length,onChange:()=>{if(ot.size===At.length)ue?.(new Set,[]),P(new Set);else{const y=new Set(At.map(me=>String(yt(me,l))));ue?.(y,At),P(y)}},"aria-label":Be("moduleGrid.selectAll","Select all")})}),ht.map(y=>e.jsx(Sa,{column:{...y,width:Dt[y.field]||y.width},sort:rt.find(me=>me.field===y.field),onSort:c?Fn:void 0,onResize:$?ln:void 0,resizable:$,t:Be},y.field))]}),e.jsx("div",{className:"nice-module-grid__body",style:Zt?{height:tn,position:"relative"}:void 0,children:pt&&ut?Array.from({length:at},(y,me)=>e.jsx(Ia,{columns:ht},me)):on?e.jsxs("div",{className:"nice-module-grid__empty",children:[J?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:J.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:J?.title||Be("moduleGrid.noData","No data")}),J?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:J.description}),J?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:J.action.onClick,children:[J.action.icon,J.action.label]})]}):e.jsx("div",{style:Zt?{transform:`translateY(${qt}px)`}:void 0,children:At.map((y,me)=>{const Ce=String(yt(y,l)),Ie=Xt+me,ft=ot.has(Ce),Et=typeof W=="function"?W(y,Ie):W,Ct=typeof Ae=="function"?Ae(y,Ie):Ae;return e.jsxs("div",{className:zt("nice-module-grid__row",ft&&"nice-module-grid__row--selected",Et),style:{...Ct,height:be},role:"row","aria-rowindex":Ie+1,"aria-selected":ft,onClick:()=>{G!=="none"&&_n(Ce,y),S?.(y,Ie)},onDoubleClick:()=>ce?.(y,Ie),onContextMenu:ct=>St(ct,y),children:[G==="checkbox"&&e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:ft,onChange:()=>_n(Ce,y),onClick:ct=>ct.stopPropagation(),"aria-label":Be("moduleGrid.selectRow","Select row")})}),ht.map(ct=>e.jsx(Ca,{column:{...ct,width:Dt[ct.field]||ct.width},row:y,rowIndex:Ie,value:yt(y,ct.field)},ct.field))]},Ce)})})})]})}),v&&kn>0&&e.jsx(Da,{page:Kt,pageSize:Vt,totalRows:Ot?w:jt.length,pageSizeOptions:j,onPageChange:Sn,t:Be}),Me&&pe&&e.jsx("div",{className:"nice-module-grid__context-menu",style:{left:Me.x,top:Me.y},role:"menu",children:pe.filter(y=>typeof y.hidden=="function"?!y.hidden(Me.row):!y.hidden).map(y=>{if(y.divider)return e.jsx("div",{className:"nice-module-grid__context-menu-divider"},y.key);const me=typeof y.disabled=="function"?y.disabled(Me.row):y.disabled;return e.jsxs("button",{className:zt("nice-module-grid__context-menu-item",y.danger&&"nice-module-grid__context-menu-item--danger",me&&"nice-module-grid__context-menu-item--disabled"),onClick:()=>{me||(y.onClick?.(Me.row),Cn(y.key))},disabled:me,role:"menuitem",children:[y.icon&&e.jsx("span",{className:"nice-module-grid__context-menu-icon",children:y.icon}),y.label]},y.key)})}),pt&&!ut&&e.jsx("div",{className:"nice-module-grid__loading-overlay",children:e.jsx("div",{className:"nice-module-grid__spinner","aria-label":Be("moduleGrid.loading","Loading")})})]})}const Aa=n.forwardRef(Ra),Ea=`
|
|
17
|
+
.nice-reconciliation {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
height: 100%;
|
|
21
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
22
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
23
|
+
border-radius: var(--nice-radius-lg, 0.5rem);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nice-reconciliation__toolbar {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: 0.75rem;
|
|
31
|
+
padding: 0.75rem 1rem;
|
|
32
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
33
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nice-reconciliation__toolbar-group {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nice-reconciliation__toolbar-group--end {
|
|
44
|
+
margin-inline-start: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nice-reconciliation__btn {
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 0.375rem;
|
|
51
|
+
padding: 0.375rem 0.75rem;
|
|
52
|
+
font-size: 0.8125rem;
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition: all 0.15s ease;
|
|
57
|
+
border: 1px solid var(--nice-border-color, #d1d5db);
|
|
58
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
59
|
+
color: var(--nice-text-primary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.nice-reconciliation__btn:hover {
|
|
63
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.nice-reconciliation__btn--primary {
|
|
67
|
+
background: var(--nice-primary, #3b82f6);
|
|
68
|
+
border-color: var(--nice-primary, #3b82f6);
|
|
69
|
+
color: white;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.nice-reconciliation__btn--primary:hover {
|
|
73
|
+
background: var(--nice-primary-dark, #2563eb);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.nice-reconciliation__btn--success {
|
|
77
|
+
background: var(--nice-success, #10b981);
|
|
78
|
+
border-color: var(--nice-success, #10b981);
|
|
79
|
+
color: white;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nice-reconciliation__btn:disabled {
|
|
83
|
+
opacity: 0.5;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.nice-reconciliation__content {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex: 1;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nice-reconciliation--vertical .nice-reconciliation__content {
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.nice-reconciliation__panel {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
min-height: 0;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.nice-reconciliation__panel--statements {
|
|
107
|
+
border-inline-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.nice-reconciliation--vertical .nice-reconciliation__panel--statements {
|
|
111
|
+
border-inline-end: none;
|
|
112
|
+
border-block-end: 1px solid var(--nice-border-color, #e5e7eb);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.nice-reconciliation__panel-header {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: space-between;
|
|
119
|
+
padding: 0.75rem 1rem;
|
|
120
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
121
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nice-reconciliation__panel-title {
|
|
125
|
+
font-weight: 600;
|
|
126
|
+
font-size: 0.875rem;
|
|
127
|
+
color: var(--nice-text-primary);
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 0.5rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.nice-reconciliation__panel-badge {
|
|
134
|
+
font-size: 0.75rem;
|
|
135
|
+
font-weight: 500;
|
|
136
|
+
padding: 0.125rem 0.5rem;
|
|
137
|
+
border-radius: var(--nice-radius-full, 9999px);
|
|
138
|
+
background: var(--nice-bg-tertiary, #e5e7eb);
|
|
139
|
+
color: var(--nice-text-secondary);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.nice-reconciliation__panel-content {
|
|
143
|
+
flex: 1;
|
|
144
|
+
overflow: auto;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.nice-reconciliation__row {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 0.75rem;
|
|
151
|
+
padding: 0.625rem 1rem;
|
|
152
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
user-select: none;
|
|
155
|
+
transition: background 0.1s ease;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nice-reconciliation__row:hover {
|
|
159
|
+
background: var(--nice-bg-hover, rgba(0, 0, 0, 0.02));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.nice-reconciliation__row--selected {
|
|
163
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.1));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.nice-reconciliation__row--dragging {
|
|
167
|
+
opacity: 0.6;
|
|
168
|
+
background: var(--nice-primary-light, rgba(59, 130, 246, 0.15));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.nice-reconciliation__row--drop-target {
|
|
172
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.15));
|
|
173
|
+
box-shadow: inset 0 0 0 2px var(--nice-success, #10b981);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.nice-reconciliation__row--matched {
|
|
177
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.08));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.nice-reconciliation__row--partial {
|
|
181
|
+
background: var(--nice-warning-light, rgba(245, 158, 11, 0.08));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.nice-reconciliation__row--unmatched {
|
|
185
|
+
background: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.nice-reconciliation__row--excluded {
|
|
189
|
+
opacity: 0.5;
|
|
190
|
+
background: var(--nice-bg-disabled, #f3f4f6);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.nice-reconciliation__status {
|
|
194
|
+
width: 0.5rem;
|
|
195
|
+
height: 0.5rem;
|
|
196
|
+
border-radius: var(--nice-radius-full, 50%);
|
|
197
|
+
flex-shrink: 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.nice-reconciliation__status--matched {
|
|
201
|
+
background: var(--nice-success, #10b981);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.nice-reconciliation__status--partial {
|
|
205
|
+
background: var(--nice-warning, #f59e0b);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.nice-reconciliation__status--unmatched {
|
|
209
|
+
background: var(--nice-danger, #ef4444);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.nice-reconciliation__status--excluded {
|
|
213
|
+
background: var(--nice-text-disabled, #9ca3af);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.nice-reconciliation__row-main {
|
|
217
|
+
flex: 1;
|
|
218
|
+
min-width: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.nice-reconciliation__row-date {
|
|
222
|
+
font-size: 0.75rem;
|
|
223
|
+
color: var(--nice-text-secondary);
|
|
224
|
+
margin-bottom: 0.125rem;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.nice-reconciliation__row-description {
|
|
228
|
+
font-size: 0.8125rem;
|
|
229
|
+
color: var(--nice-text-primary);
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
overflow: hidden;
|
|
232
|
+
text-overflow: ellipsis;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nice-reconciliation__row-counterparty {
|
|
236
|
+
font-size: 0.75rem;
|
|
237
|
+
color: var(--nice-text-tertiary);
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
text-overflow: ellipsis;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.nice-reconciliation__row-amount {
|
|
244
|
+
font-size: 0.875rem;
|
|
245
|
+
font-weight: 600;
|
|
246
|
+
font-variant-numeric: tabular-nums;
|
|
247
|
+
white-space: nowrap;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.nice-reconciliation__row-amount--positive {
|
|
251
|
+
color: var(--nice-success, #10b981);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.nice-reconciliation__row-amount--negative {
|
|
255
|
+
color: var(--nice-danger, #ef4444);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.nice-reconciliation__confidence {
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: 0.25rem;
|
|
262
|
+
font-size: 0.6875rem;
|
|
263
|
+
padding: 0.125rem 0.375rem;
|
|
264
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.nice-reconciliation__confidence--high {
|
|
268
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.15));
|
|
269
|
+
color: var(--nice-success-dark, #059669);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.nice-reconciliation__confidence--medium {
|
|
273
|
+
background: var(--nice-warning-light, rgba(245, 158, 11, 0.15));
|
|
274
|
+
color: var(--nice-warning-dark, #d97706);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.nice-reconciliation__confidence--low {
|
|
278
|
+
background: var(--nice-danger-light, rgba(239, 68, 68, 0.15));
|
|
279
|
+
color: var(--nice-danger-dark, #dc2626);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.nice-reconciliation__empty {
|
|
283
|
+
display: flex;
|
|
284
|
+
flex-direction: column;
|
|
285
|
+
align-items: center;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
padding: 3rem 1rem;
|
|
288
|
+
color: var(--nice-text-secondary);
|
|
289
|
+
text-align: center;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.nice-reconciliation__empty-icon {
|
|
293
|
+
font-size: 2.5rem;
|
|
294
|
+
margin-bottom: 0.75rem;
|
|
295
|
+
opacity: 0.5;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.nice-reconciliation__summary {
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 1.5rem;
|
|
302
|
+
padding: 0.75rem 1rem;
|
|
303
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
304
|
+
border-top: 1px solid var(--nice-border-color, #e5e7eb);
|
|
305
|
+
font-size: 0.8125rem;
|
|
306
|
+
flex-wrap: wrap;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.nice-reconciliation__summary-item {
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
gap: 0.375rem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.nice-reconciliation__summary-label {
|
|
316
|
+
color: var(--nice-text-secondary);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.nice-reconciliation__summary-value {
|
|
320
|
+
font-weight: 600;
|
|
321
|
+
color: var(--nice-text-primary);
|
|
322
|
+
font-variant-numeric: tabular-nums;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.nice-reconciliation__summary-value--success {
|
|
326
|
+
color: var(--nice-success, #10b981);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.nice-reconciliation__summary-value--warning {
|
|
330
|
+
color: var(--nice-warning, #f59e0b);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.nice-reconciliation__summary-value--danger {
|
|
334
|
+
color: var(--nice-danger, #ef4444);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.nice-reconciliation__resizer {
|
|
338
|
+
width: 4px;
|
|
339
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
340
|
+
cursor: col-resize;
|
|
341
|
+
transition: background 0.15s ease;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.nice-reconciliation__resizer:hover {
|
|
345
|
+
background: var(--nice-primary, #3b82f6);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.nice-reconciliation--vertical .nice-reconciliation__resizer {
|
|
349
|
+
width: 100%;
|
|
350
|
+
height: 4px;
|
|
351
|
+
cursor: row-resize;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.nice-reconciliation__suggestions {
|
|
355
|
+
padding: 0.75rem 1rem;
|
|
356
|
+
background: var(--nice-info-light, rgba(59, 130, 246, 0.08));
|
|
357
|
+
border-bottom: 1px solid var(--nice-info, #3b82f6);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.nice-reconciliation__suggestion {
|
|
361
|
+
display: flex;
|
|
362
|
+
align-items: center;
|
|
363
|
+
gap: 0.75rem;
|
|
364
|
+
padding: 0.5rem;
|
|
365
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
366
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
367
|
+
margin-bottom: 0.5rem;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.nice-reconciliation__suggestion:last-child {
|
|
371
|
+
margin-bottom: 0;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* Dark mode */
|
|
375
|
+
.dark .nice-reconciliation {
|
|
376
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
377
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.dark .nice-reconciliation__toolbar,
|
|
381
|
+
.dark .nice-reconciliation__panel-header,
|
|
382
|
+
.dark .nice-reconciliation__summary {
|
|
383
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
384
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.dark .nice-reconciliation__row--selected {
|
|
388
|
+
background: var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* RTL support */
|
|
392
|
+
[dir="rtl"] .nice-reconciliation__row-amount {
|
|
393
|
+
direction: ltr;
|
|
394
|
+
text-align: left;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Detail Panel */
|
|
398
|
+
.nice-reconciliation__detail-panel {
|
|
399
|
+
position: fixed;
|
|
400
|
+
inset-inline-end: 0;
|
|
401
|
+
top: 0;
|
|
402
|
+
bottom: 0;
|
|
403
|
+
width: 420px;
|
|
404
|
+
max-width: 90vw;
|
|
405
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
406
|
+
box-shadow: -4px 0 24px var(--nice-overlay-15, rgba(0, 0, 0, 0.15));
|
|
407
|
+
z-index: 1000;
|
|
408
|
+
display: flex;
|
|
409
|
+
flex-direction: column;
|
|
410
|
+
transform: translateX(100%);
|
|
411
|
+
transition: transform 0.25s ease-out;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.nice-reconciliation__detail-panel--open {
|
|
415
|
+
transform: translateX(0);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.nice-reconciliation__detail-header {
|
|
419
|
+
display: flex;
|
|
420
|
+
align-items: center;
|
|
421
|
+
justify-content: space-between;
|
|
422
|
+
padding: 1rem;
|
|
423
|
+
border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
|
|
424
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.nice-reconciliation__detail-title {
|
|
428
|
+
font-weight: 600;
|
|
429
|
+
font-size: 1rem;
|
|
430
|
+
color: var(--nice-text-primary);
|
|
431
|
+
display: flex;
|
|
432
|
+
align-items: center;
|
|
433
|
+
gap: 0.5rem;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.nice-reconciliation__detail-close {
|
|
437
|
+
width: 2rem;
|
|
438
|
+
height: 2rem;
|
|
439
|
+
display: flex;
|
|
440
|
+
align-items: center;
|
|
441
|
+
justify-content: center;
|
|
442
|
+
background: transparent;
|
|
443
|
+
border: none;
|
|
444
|
+
cursor: pointer;
|
|
445
|
+
font-size: 1.25rem;
|
|
446
|
+
color: var(--nice-text-secondary);
|
|
447
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
448
|
+
transition: all 0.15s ease;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.nice-reconciliation__detail-close:hover {
|
|
452
|
+
background: var(--nice-bg-hover, #f3f4f6);
|
|
453
|
+
color: var(--nice-text-primary);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.nice-reconciliation__detail-content {
|
|
457
|
+
flex: 1;
|
|
458
|
+
overflow: auto;
|
|
459
|
+
padding: 1rem;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.nice-reconciliation__detail-section {
|
|
463
|
+
margin-bottom: 1.5rem;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.nice-reconciliation__detail-section-title {
|
|
467
|
+
font-weight: 600;
|
|
468
|
+
font-size: 0.875rem;
|
|
469
|
+
color: var(--nice-text-primary);
|
|
470
|
+
margin-bottom: 0.75rem;
|
|
471
|
+
display: flex;
|
|
472
|
+
align-items: center;
|
|
473
|
+
gap: 0.375rem;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.nice-reconciliation__detail-row {
|
|
477
|
+
display: flex;
|
|
478
|
+
justify-content: space-between;
|
|
479
|
+
align-items: flex-start;
|
|
480
|
+
padding: 0.5rem 0;
|
|
481
|
+
border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.nice-reconciliation__detail-row:last-child {
|
|
485
|
+
border-bottom: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.nice-reconciliation__detail-label {
|
|
489
|
+
font-size: 0.8125rem;
|
|
490
|
+
color: var(--nice-text-secondary);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.nice-reconciliation__detail-value {
|
|
494
|
+
font-size: 0.8125rem;
|
|
495
|
+
font-weight: 500;
|
|
496
|
+
color: var(--nice-text-primary);
|
|
497
|
+
text-align: end;
|
|
498
|
+
max-width: 60%;
|
|
499
|
+
word-break: break-word;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.nice-reconciliation__detail-divider {
|
|
503
|
+
height: 1px;
|
|
504
|
+
background: var(--nice-border-color, #e5e7eb);
|
|
505
|
+
margin: 1rem 0;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.nice-reconciliation__detail-match-info {
|
|
509
|
+
padding: 0.75rem;
|
|
510
|
+
background: var(--nice-success-light, rgba(16, 185, 129, 0.08));
|
|
511
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
512
|
+
margin-bottom: 1rem;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.nice-reconciliation__detail-match-header {
|
|
516
|
+
display: flex;
|
|
517
|
+
align-items: center;
|
|
518
|
+
gap: 0.5rem;
|
|
519
|
+
font-weight: 600;
|
|
520
|
+
font-size: 0.8125rem;
|
|
521
|
+
color: var(--nice-success-dark, #059669);
|
|
522
|
+
margin-bottom: 0.5rem;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.nice-reconciliation__detail-match-detail {
|
|
526
|
+
font-size: 0.75rem;
|
|
527
|
+
color: var(--nice-text-secondary);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.nice-reconciliation__detail-side-by-side {
|
|
531
|
+
display: grid;
|
|
532
|
+
grid-template-columns: 1fr 1fr;
|
|
533
|
+
gap: 1rem;
|
|
534
|
+
padding: 0.75rem;
|
|
535
|
+
background: var(--nice-bg-secondary, #f9fafb);
|
|
536
|
+
border-radius: var(--nice-radius-md, 0.375rem);
|
|
537
|
+
margin-top: 0.75rem;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.nice-reconciliation__detail-side-item {
|
|
541
|
+
padding: 0.5rem;
|
|
542
|
+
background: var(--nice-bg-primary, #ffffff);
|
|
543
|
+
border-radius: var(--nice-radius-sm, 0.25rem);
|
|
544
|
+
border: 1px solid var(--nice-border-color, #e5e7eb);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.nice-reconciliation__detail-side-label {
|
|
548
|
+
font-size: 0.6875rem;
|
|
549
|
+
font-weight: 500;
|
|
550
|
+
text-transform: uppercase;
|
|
551
|
+
color: var(--nice-text-tertiary);
|
|
552
|
+
margin-bottom: 0.375rem;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.nice-reconciliation__detail-side-amount {
|
|
556
|
+
font-size: 1.125rem;
|
|
557
|
+
font-weight: 600;
|
|
558
|
+
font-variant-numeric: tabular-nums;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.nice-reconciliation__detail-backdrop {
|
|
562
|
+
position: fixed;
|
|
563
|
+
inset: 0;
|
|
564
|
+
background: var(--nice-overlay-30, rgba(0, 0, 0, 0.3));
|
|
565
|
+
z-index: 999;
|
|
566
|
+
opacity: 0;
|
|
567
|
+
pointer-events: none;
|
|
568
|
+
transition: opacity 0.2s ease;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.nice-reconciliation__detail-backdrop--visible {
|
|
572
|
+
opacity: 1;
|
|
573
|
+
pointer-events: auto;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.dark .nice-reconciliation__detail-panel {
|
|
577
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
578
|
+
box-shadow: -4px 0 24px var(--nice-overlay-40, rgba(0, 0, 0, 0.4));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.dark .nice-reconciliation__detail-header {
|
|
582
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
583
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.dark .nice-reconciliation__detail-side-by-side {
|
|
587
|
+
background: var(--nice-bg-secondary-dark, #1f2937);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
.dark .nice-reconciliation__detail-side-item {
|
|
591
|
+
background: var(--nice-bg-primary-dark, #111827);
|
|
592
|
+
border-color: var(--nice-border-color-dark, #374151);
|
|
593
|
+
}
|
|
594
|
+
`;function Tt(t,a="PLN",s="pl-PL"){return new Intl.NumberFormat(s,{style:"currency",currency:a,minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}function Tn(t,a="pl-PL"){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(a,{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}function $a(t){return t>=80?"high":t>=50?"medium":"low"}function La(){return`match-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Ta({item:t,isSelected:a,isDragging:s,isDropTarget:r,suggestion:l,currency:u,locale:f,onSelect:c,onDoubleClick:g,onDragStart:N,onDragEnd:D,onDrop:z,disabled:k}){const Q=t.status??"unmatched",V=l?.confidence??t.confidence,L=v=>{v.dataTransfer.setData("text/plain",t.id),v.dataTransfer.setData("source","statement"),v.dataTransfer.effectAllowed="move",N()},F=v=>{v.dataTransfer.types.includes("source")&&v.dataTransfer.getData("source")!=="statement"&&v.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${Q} ${a?"nice-reconciliation__row--selected":""} ${s?"nice-reconciliation__row--dragging":""} ${r?"nice-reconciliation__row--drop-target":""}`,draggable:!k&&Q!=="matched",onDragStart:L,onDragEnd:D,onDragOver:F,onDrop:z,onClick:c,onDoubleClick:g,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${Q}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsx("div",{className:"nice-reconciliation__row-date",children:Tn(t.date,f)}),e.jsx("div",{className:"nice-reconciliation__row-description",title:t.description,children:t.description}),t.counterparty&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:t.counterparty})]}),V!=null&&e.jsxs("span",{className:`nice-reconciliation__confidence nice-reconciliation__confidence--${$a(V)}`,children:[V,"%"]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${t.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(t.amount,u,f)})]})}function za({item:t,isSelected:a,isDragging:s,isDropTarget:r,currency:l,locale:u,onSelect:f,onDoubleClick:c,onDragStart:g,onDragEnd:N,onDrop:D,disabled:z}){const k=t.status??"unmatched",Q=L=>{L.dataTransfer.setData("text/plain",t.id),L.dataTransfer.setData("source","entry"),L.dataTransfer.effectAllowed="move",g()},V=L=>{L.dataTransfer.types.includes("source")&&L.dataTransfer.getData("source")!=="entry"&&L.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${k} ${a?"nice-reconciliation__row--selected":""} ${s?"nice-reconciliation__row--dragging":""} ${r?"nice-reconciliation__row--drop-target":""}`,draggable:!z&&k!=="matched",onDragStart:Q,onDragEnd:N,onDragOver:V,onDrop:D,onClick:f,onDoubleClick:c,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${k}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsxs("div",{className:"nice-reconciliation__row-date",children:[Tn(t.date,u),t.documentNumber&&e.jsxs("span",{children:[" · ",t.documentNumber]})]}),e.jsx("div",{className:"nice-reconciliation__row-description",title:t.description,children:t.description}),t.partyName&&e.jsx("div",{className:"nice-reconciliation__row-counterparty",children:t.partyName})]}),e.jsx("span",{className:`nice-reconciliation__row-amount ${t.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(t.amount,l,u)})]})}const Pa=n.forwardRef(function(a,s){const{statements:r,bankTransactions:l,entries:u,accountingEntries:f,matches:c,defaultMatches:g=[],suggestions:N=[],config:D={},currency:z,showConfidence:k,statementPanelConfig:Q,entryPanelConfig:V,onMatch:L,onAutoMatch:F,onUnmatch:v,onBatchAction:x,onFilterChange:_,onRequestSuggestions:j,onSelectionChange:U,onComplete:X,size:le="medium",showToolbar:be=!0,showFilters:T=!0,showSummary:G=!0,showSuggestions:ae=!0,layout:ue="horizontal",enableDragDrop:he=!0,enableKeyboard:B=!0,enableDetailPanel:$=!0,loading:E=!1,disabled:o=!1,readOnly:xe=!1,locale:we="pl-PL",labels:se={},className:I,style:Y}=a,O=r??l??[],de=u??f??[],pe=z??D.currency??"PLN",[Se,Ke]=n.useState(g),[Ze,Fe]=n.useState(new Set),[Le,Oe]=n.useState(new Set),[ge,H]=n.useState(null),[je,Ve]=n.useState(null),[ve,C]=n.useState({}),[J,Re]=n.useState(null),S=c??Se,ce=n.useRef(null),W=n.useRef(null);n.useEffect(()=>{const A="nice-reconciliation-styles";if(!document.getElementById(A)){const ne=document.createElement("style");ne.id=A,ne.textContent=Ea,document.head.appendChild(ne)}},[]);const Ae=n.useMemo(()=>{const A=new Set;return S.forEach(ne=>ne.statementIds.forEach(fe=>A.add(fe))),A},[S]),Ee=n.useMemo(()=>{const A=new Set;return S.forEach(ne=>ne.entryIds.forEach(fe=>A.add(fe))),A},[S]),ee=n.useMemo(()=>{const A=O.filter(ke=>!Ae.has(ke.id)),ne=de.filter(ke=>!Ee.has(ke.id)),fe=O.reduce((ke,Te)=>ke+Te.amount,0),Xe=de.reduce((ke,Te)=>ke+Te.amount,0),Je=O.filter(ke=>Ae.has(ke.id)).reduce((ke,Te)=>ke+Te.amount,0);return{totalStatements:O.length,totalEntries:de.length,matchedStatements:O.length-A.length,matchedEntries:de.length-ne.length,unmatchedStatements:A.length,unmatchedEntries:ne.length,statementTotal:fe,entryTotal:Xe,matchedAmount:Je,unmatchedStatementAmount:A.reduce((ke,Te)=>ke+Te.amount,0),unmatchedEntryAmount:ne.reduce((ke,Te)=>ke+Te.amount,0),difference:fe-Xe,matchPercentage:O.length>0?Math.round((O.length-A.length)/O.length*100):0,matchCount:S.length,partialMatchCount:S.filter(ke=>ke.status==="partial").length,pendingSuggestions:N.length}},[O,de,S,N,Ae,Ee]),Ge=n.useCallback((A,ne)=>{const fe=O.filter(He=>A.includes(He.id)),Xe=de.filter(He=>ne.includes(He.id));if(fe.length===0||Xe.length===0)return null;const Je=fe.reduce((He,mt)=>He+mt.amount,0),ke=Xe.reduce((He,mt)=>He+mt.amount,0),Te=Math.abs(Je-ke),Be=D.amountTolerance??.01,tt={id:La(),statementIds:A,entryIds:ne,status:Te<=Be?"matched":"partial",statementTotal:Je,entryTotal:ke,difference:Te,confidence:Te<=Be?100:Math.max(0,100-Te/Math.max(Math.abs(Je),1)*100),matchedBy:"user",matchedAt:new Date};return c||Ke(He=>[...He,tt]),L?.(tt,fe,Xe),Fe(new Set),Oe(new Set),tt},[O,de,D.amountTolerance,c,L]),qe=n.useCallback(A=>{const ne=S.find(fe=>fe.id===A);ne&&(c||Ke(fe=>fe.filter(Xe=>Xe.id!==A)),v?.(A,ne.statementIds,ne.entryIds))},[S,c,v]),lt=n.useCallback(async()=>{const A=[],ne=new Set(Ae),fe=new Set(Ee),Xe=D.amountTolerance??.01,Je=D.dateTolerance??3;for(const ke of O){if(ne.has(ke.id))continue;const Te=de.filter(Be=>{if(fe.has(Be.id)||Math.abs(ke.amount-Be.amount)>Xe)return!1;const He=new Date(ke.date),mt=new Date(Be.date);return!(Math.abs(He.getTime()-mt.getTime())/(1e3*60*60*24)>Je)});if(Te.length===1){const Be=Te[0],tt=Ge([ke.id],[Be.id]);tt&&(A.push(tt),ne.add(ke.id),fe.add(Be.id))}}return x?.("autoMatch",A),A},[O,de,Ae,Ee,D,Ge,x]),ye=n.useCallback((A,ne,fe,Xe)=>{Xe!==ne&&(Xe==="statement"?Ge([fe],[A]):Ge([A],[fe]),H(null),Ve(null))},[Ge]),Wt=n.useCallback(()=>{const A=Array.from(Ze),ne=Array.from(Le);A.length>0&&ne.length>0&&Ge(A,ne)},[Ze,Le,Ge]);n.useEffect(()=>{U?.(Array.from(Ze),Array.from(Le))},[Ze,Le,U]),n.useImperativeHandle(s,()=>({getMatches:()=>S,getUnmatchedStatements:()=>O.filter(A=>!Ae.has(A.id)),getUnmatchedEntries:()=>de.filter(A=>!Ee.has(A.id)),createMatch:Ge,removeMatch:qe,autoMatch:lt,getSuggestions:async A=>j?j(A??O.filter(ne=>!Ae.has(ne.id)).map(ne=>ne.id)):[],applySuggestion:A=>Ge([A.statementId],A.entryIds),approveAll:()=>{x?.("approveAll",S)},clearAll:()=>{c||Ke([]),x?.("clearAll",[])},exportMatched:A=>{x?.("exportMatched",S)},getSummary:()=>ee,reset:()=>{c||Ke([]),Fe(new Set),Oe(new Set),C({})},focusStatements:()=>ce.current?.focus(),focusEntries:()=>W.current?.focus()}),[S,O,de,Ae,Ee,Ge,qe,lt,j,x,c,ee]);const Pt=n.useMemo(()=>O.filter(A=>{if(ve.status&&ve.status.length>0){const ne=Ae.has(A.id)?"matched":"unmatched";if(!ve.status.includes(ne))return!1}if(ve.searchText){const ne=ve.searchText.toLowerCase();if(!A.description?.toLowerCase().includes(ne)&&!A.counterparty?.toLowerCase().includes(ne))return!1}return!0}),[O,ve,Ae]),ut=n.useMemo(()=>de.filter(A=>{if(ve.status&&ve.status.length>0){const ne=Ee.has(A.id)?"matched":"unmatched";if(!ve.status.includes(ne))return!1}if(ve.searchText){const ne=ve.searchText.toLowerCase();if(!A.description?.toLowerCase().includes(ne)&&!A.partyName?.toLowerCase().includes(ne))return!1}return!0}),[de,ve,Ee]),at=Ze.size>0&&Le.size>0&&!xe&&!o;return e.jsxs("div",{className:`nice-reconciliation nice-reconciliation--${ue} ${I??""}`,style:Y,children:[be&&e.jsxs("div",{className:"nice-reconciliation__toolbar",children:[e.jsxs("div",{className:"nice-reconciliation__toolbar-group",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--primary",onClick:lt,disabled:o||xe||E,children:["⚡ ",se.autoMatch??"Auto-match"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--success",onClick:Wt,disabled:!at||E,children:"🔗 Match Selected"})]}),e.jsxs("div",{className:"nice-reconciliation__toolbar-group nice-reconciliation__toolbar-group--end",children:[e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>x?.("approveAll",S),disabled:S.length===0||o||E,children:["✓ ",se.approveAll??"Approve All"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>{c||Ke([]),x?.("clearAll",[])},disabled:S.length===0||o||xe||E,children:["✕ ",se.clearAll??"Clear All"]})]})]}),e.jsxs("div",{className:"nice-reconciliation__content",children:[e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--statements",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:["📄 ",se.statementPanelTitle??"Bank Statement",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:Pt.length})]})}),e.jsx("div",{ref:ce,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:Pt.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:"📋"}),se.noStatements??"No statement items"]}):Pt.map(A=>e.jsx(Ta,{item:{...A,status:Ae.has(A.id)?"matched":"unmatched"},isSelected:Ze.has(A.id),isDragging:ge===A.id,isDropTarget:je===A.id,suggestion:N.find(ne=>ne.statementId===A.id),currency:pe,locale:we,onSelect:()=>{o||Fe(ne=>{const fe=new Set(ne);return fe.has(A.id)?fe.delete(A.id):fe.add(A.id),fe})},onDoubleClick:()=>$&&Re({type:"statement",id:A.id}),onDragStart:()=>H(A.id),onDragEnd:()=>{H(null),Ve(null)},onDrop:()=>{ge&&ge!==A.id&&ye(A.id,"statement",ge,"entry")},disabled:o||xe||!he},A.id))})]}),e.jsxs("div",{className:"nice-reconciliation__panel nice-reconciliation__panel--entries",children:[e.jsx("div",{className:"nice-reconciliation__panel-header",children:e.jsxs("span",{className:"nice-reconciliation__panel-title",children:["📒 ",se.entryPanelTitle??"Book Entries",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:ut.length})]})}),e.jsx("div",{ref:W,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:ut.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:"📚"}),se.noEntries??"No book entries"]}):ut.map(A=>e.jsx(za,{item:{...A,status:Ee.has(A.id)?"matched":"unmatched"},isSelected:Le.has(A.id),isDragging:ge===A.id,isDropTarget:je===A.id,currency:pe,locale:we,onSelect:()=>{o||Oe(ne=>{const fe=new Set(ne);return fe.has(A.id)?fe.delete(A.id):fe.add(A.id),fe})},onDoubleClick:()=>$&&Re({type:"entry",id:A.id}),onDragStart:()=>H(A.id),onDragEnd:()=>{H(null),Ve(null)},onDrop:()=>{ge&&ge!==A.id&&ye(A.id,"entry",ge,"statement")},disabled:o||xe||!he},A.id))})]})]}),G&&e.jsxs("div",{className:"nice-reconciliation__summary",children:[e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched:"}),e.jsxs("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--success",children:[ee.matchedStatements,"/",ee.totalStatements," (",ee.matchPercentage,"%)"]})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Matched Amount:"}),e.jsx("span",{className:"nice-reconciliation__summary-value",children:Tt(ee.matchedAmount,pe,we)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Unmatched:"}),e.jsx("span",{className:"nice-reconciliation__summary-value nice-reconciliation__summary-value--warning",children:Tt(ee.unmatchedStatementAmount,pe,we)})]}),e.jsxs("div",{className:"nice-reconciliation__summary-item",children:[e.jsx("span",{className:"nice-reconciliation__summary-label",children:"Difference:"}),e.jsx("span",{className:`nice-reconciliation__summary-value ${Math.abs(ee.difference)<.01?"nice-reconciliation__summary-value--success":"nice-reconciliation__summary-value--danger"}`,children:Tt(ee.difference,pe,we)})]})]}),$&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`nice-reconciliation__detail-backdrop ${J?"nice-reconciliation__detail-backdrop--visible":""}`,onClick:()=>Re(null)}),e.jsx("div",{className:`nice-reconciliation__detail-panel ${J?"nice-reconciliation__detail-panel--open":""}`,children:J&&e.jsx(Fa,{type:J.type,id:J.id,statements:O,entries:de,matches:S,currency:pe,locale:we,labels:se,onClose:()=>Re(null)})})]})]})});function Fa({type:t,id:a,statements:s,entries:r,matches:l,currency:u,locale:f,labels:c,onClose:g}){const N=t==="statement"?s.find(L=>L.id===a):r.find(L=>L.id===a),D=t==="statement"?l.find(L=>L.statementIds.includes(a)):l.find(L=>L.entryIds.includes(a)),z=D?t==="statement"?r.filter(L=>D.entryIds.includes(L.id)):s.filter(L=>D.statementIds.includes(L.id)):[];if(!N)return null;const k=t==="statement",Q=k?N:null,V=k?null:N;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-reconciliation__detail-header",children:[e.jsxs("span",{className:"nice-reconciliation__detail-title",children:[k?"📄":"📒"," ",k?c.statementDetails??"Transaction Details":c.entryDetails??"Entry Details"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__detail-close",onClick:g,"aria-label":"Close",children:"✕"})]}),e.jsxs("div",{className:"nice-reconciliation__detail-content",children:[D&&e.jsxs("div",{className:"nice-reconciliation__detail-match-info",children:[e.jsxs("div",{className:"nice-reconciliation__detail-match-header",children:["✓ ",c.matchedWith??"Matched"," (",D.confidence?.toFixed(0)??100,"% confidence)"]}),e.jsx("div",{className:"nice-reconciliation__detail-match-detail",children:D.matchedBy==="ai"?c.matchedByAI??"Matched automatically by AI":c.matchedManually??"Matched manually"}),e.jsxs("div",{className:"nice-reconciliation__detail-side-by-side",children:[e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:c.statementTotal??"Statement"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${D.statementTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(D.statementTotal,u,f)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-side-item",children:[e.jsx("div",{className:"nice-reconciliation__detail-side-label",children:c.entryTotal??"Book Entry"}),e.jsx("div",{className:`nice-reconciliation__detail-side-amount ${D.entryTotal>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(D.entryTotal,u,f)})]})]}),D.difference>.01&&e.jsxs("div",{className:"nice-reconciliation__detail-row",style:{marginTop:"0.5rem",borderBottom:"none"},children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.difference??"Difference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{color:"var(--nice-warning, #f59e0b)"},children:Tt(D.difference,u,f)})]})]}),e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:["📋"," ",k?c.transactionInfo??"Transaction Information":c.entryInfo??"Entry Information"]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.date??"Date",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Tn(N.date,f)})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.description??"Description",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:N.description})]}),e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.amount??"Amount",":"]}),e.jsx("span",{className:`nice-reconciliation__detail-value ${N.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(N.amount,u,f)})]}),k&&Q?.counterparty&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.counterparty??"Counterparty",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Q.counterparty})]}),k&&Q?.counterpartyAccount&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.accountNumber??"Account",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",style:{fontFamily:"monospace",fontSize:"0.75rem"},children:Q.counterpartyAccount})]}),!k&&V?.partyName&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.party??"Party",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:V.partyName})]}),!k&&V?.documentNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.documentRef??"Document Ref",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:V.documentNumber})]}),k&&Q?.referenceNumber&&e.jsxs("div",{className:"nice-reconciliation__detail-row",children:[e.jsxs("span",{className:"nice-reconciliation__detail-label",children:[c.reference??"Reference",":"]}),e.jsx("span",{className:"nice-reconciliation__detail-value",children:Q.referenceNumber})]})]}),z.length>0&&e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:["🔗"," ",k?c.matchedEntries??"Matched Entries":c.matchedStatements??"Matched Statements"]}),z.map(L=>e.jsxs("div",{style:{padding:"0.5rem",background:"var(--nice-bg-secondary, #f9fafb)",borderRadius:"0.25rem",marginBottom:"0.5rem",fontSize:"0.8125rem"},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:"0.25rem"},children:L.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"var(--nice-text-secondary)"},children:[e.jsx("span",{children:Tn(L.date,f)}),e.jsx("span",{style:{fontWeight:600,color:L.amount>=0?"var(--nice-success)":"var(--nice-danger)"},children:Tt(L.amount,u,f)})]})]},L.id))]})]})]})}function Oa(t,a,s){const r=new Map,l=[];t.forEach(f=>r.set(String(f[a]),{data:f,children:[],key:String(f[a]),depth:0})),t.forEach(f=>{const c=f[s],g=r.get(String(f[a]));if(c!=null&&c!==""&&r.has(String(c))){const N=r.get(String(c));g.depth=N.depth+1,N.children.push(g)}else l.push(g)});const u=(f,c)=>{f.forEach(g=>{g.depth=c,u(g.children,c+1)})};return u(l,0),l}function wi(t,a,s,r=0){return t.map(l=>({data:l,key:String(l[s]),depth:r,children:Array.isArray(l[a])?wi(l[a],a,s,r+1):[]}))}function Ba(t){const a=[],s=r=>{r.forEach(l=>{a.push(l.key),s(l.children)})};return s(t),a}function Ua(t,a){const s=[],r=l=>{l.forEach(u=>{s.push(u),u.children.length>0&&a.has(u.key)&&r(u.children)})};return r(t),s}function ki(t,a,s){return!a||!s?t:[...t].sort((l,u)=>{const f=l.data[a]??"",c=u.data[a]??"",g=typeof f=="number"&&typeof c=="number"?f-c:String(f).localeCompare(String(c));return s==="desc"?-g:g}).map(l=>({...l,children:ki(l.children,a,s)}))}function Wa({columns:t,data:a,keyField:s="id",parentKeyField:r="parentId",nested:l=!1,childrenField:u="children",expandedKeys:f,onExpandedChange:c,defaultExpandAll:g=!1,sortable:N=!0,sortField:D,sortDirection:z,onSort:k,selectable:Q,selectedKeys:V,onSelectionChange:L,searchable:F,searchPlaceholder:v,striped:x,compact:_,loading:j,emptyText:U,toolbar:X,onRowClick:le,className:be,style:T}){const{t:G}=Ne.Zt(),ae=n.useMemo(()=>l?wi(a,u,s):Oa(a,s,r),[a,s,r,l,u]),ue=n.useMemo(()=>Ba(ae),[ae]),[he,B]=n.useState(()=>g?new Set(ue):new Set),$=f?new Set(f):he,[E,o]=n.useState({field:"",dir:null}),[xe,we]=n.useState(new Set),[se,I]=n.useState(""),Y=D??E.field,O=z??E.dir,de=V??xe,pe=n.useMemo(()=>t.filter(H=>!H.hidden),[t]),Se=n.useCallback(H=>{const je=Y===H?O==="asc"?"desc":O==="desc"?null:"asc":"asc";k?k(H,je):o({field:H,dir:je})},[Y,O,k]),Ke=n.useCallback(H=>{const je=new Set($);je.has(H)?je.delete(H):je.add(H),c?c([...je]):B(je)},[$,c]),Ze=n.useCallback(H=>{const je=new Set(de);je.has(H)?je.delete(H):je.add(H),L?L(je):we(je)},[de,L]),Fe=n.useMemo(()=>{if(!se)return ae;const H=se.toLowerCase(),je=Ve=>Ve.reduce((ve,C)=>{const J=je(C.children);return(pe.some(S=>String(C.data[S.field]??"").toLowerCase().includes(H))||J.length>0)&&ve.push({...C,children:J}),ve},[]);return je(ae)},[ae,se,pe]),Le=n.useMemo(()=>ki(Fe,Y,O),[Fe,Y,O]),Oe=n.useMemo(()=>Ua(Le,$),[Le,$]),ge=({field:H})=>Y!==H||!O?e.jsx("span",{className:"nice-table__sort-icon",style:{opacity:.3},children:"↕"}):e.jsx("span",{className:"nice-table__sort-icon",children:O==="asc"?"↑":"↓"});return e.jsxs("div",{className:`nice-treegrid nice-datagrid ${be||""}`,style:T,children:[(F||X)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[F&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:se,onChange:H=>I(H.target.value),placeholder:v||G("controls.search","Search...")})}),X]}),e.jsx("div",{className:"nice-datagrid__table-wrap",children:e.jsxs("table",{className:`${x?"nice-table--striped":""} ${_?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[Q&&e.jsx("th",{className:"nice-datagrid__checkbox",style:{width:36}}),pe.map(H=>e.jsxs("th",{style:{width:H.width,minWidth:H.minWidth,textAlign:H.align},className:N&&H.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>N&&H.sortable!==!1&&Se(H.field),children:[H.header,N&&H.sortable!==!1&&e.jsx(ge,{field:H.field})]},H.field))]})}),e.jsx("tbody",{children:j?e.jsx("tr",{children:e.jsx("td",{colSpan:pe.length+(Q?1:0),className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):Oe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:pe.length+(Q?1:0),className:"nice-datagrid__empty",children:U||G("controls.noData","No data available")})}):Oe.map((H,je)=>{const Ve=de.has(H.key),ve=H.children.length>0,C=$.has(H.key);return e.jsxs("tr",{className:Ve?"nice-datagrid__row--selected":void 0,onClick:()=>le?.(H.data),style:le?{cursor:"pointer"}:void 0,children:[Q&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:J=>J.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:Ve,onChange:()=>Ze(H.key),"aria-label":`Select row ${H.key}`})}),pe.map((J,Re)=>e.jsxs("td",{style:{textAlign:J.align},children:[Re===0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:H.depth*20}}),e.jsx("button",{className:`nice-treegrid__toggle ${ve?"":"nice-treegrid__toggle--leaf"}`,onClick:S=>{S.stopPropagation(),ve&&Ke(H.key)},tabIndex:ve?0:-1,"aria-expanded":ve?C:void 0,"aria-label":ve?C?"Collapse":"Expand":void 0,children:ve?C?"▾":"▸":""})]}),J.render?J.render(H.data[J.field],H.data,je):String(H.data[J.field]??"")]},J.field))]},H.key)})})]})})]})}const dt={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Ga=()=>e.jsxs("svg",{...dt,children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13"})]}),Ka=()=>e.jsxs("svg",{...dt,children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 15-6.7L21 13"})]}),Va=()=>e.jsxs("svg",{...dt,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"15",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"18",y2:"18"})]}),Za=()=>e.jsxs("svg",{...dt,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"6",y1:"12",x2:"18",y2:"12"}),e.jsx("line",{x1:"4",y1:"18",x2:"20",y2:"18"})]}),qa=()=>e.jsxs("svg",{...dt,children:[e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"6",y1:"18",x2:"21",y2:"18"})]}),Xa=()=>e.jsxs("svg",{...dt,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"12",y1:"11",x2:"12",y2:"13"})]}),Ha=()=>e.jsxs("svg",{...dt,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"11",y1:"12",x2:"13",y2:"12"})]}),Qa=()=>e.jsxs("svg",{...dt,children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"6",rx:"1"}),e.jsx("line",{x1:"6",y1:"17",x2:"18",y2:"17"})]}),Ya=()=>e.jsxs("svg",{...dt,children:[e.jsx("rect",{x:"4",y:"3",width:"6",height:"18",rx:"1"}),e.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"})]}),Ja=()=>e.jsx("svg",{...dt,children:e.jsx("polyline",{points:"6 9 12 4 18 9"})}),es=()=>e.jsx("svg",{...dt,children:e.jsx("polyline",{points:"6 15 12 20 18 15"})}),ts=()=>e.jsxs("svg",{...dt,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 9 12 4 18 9"}),e.jsx("polyline",{points:"6 15 12 20 18 15"})]}),ns=()=>e.jsxs("svg",{...dt,children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),is=()=>e.jsxs("svg",{...dt,children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"6",y1:"18",x2:"18",y2:"6"})]});function Si(t){let a="",s=t;for(;s>=0;)a=String.fromCharCode(65+s%26)+a,s=Math.floor(s/26)-1;return a}function De(t,a){return`${Si(a)}${t+1}`}function et(t){const a=t.match(/^([A-Z]+)(\d+)$/);if(!a)return null;let s=0;for(let r=0;r<a[1].length;r++)s=s*26+(a[1].charCodeAt(r)-64);return{row:parseInt(a[2],10)-1,col:s-1}}function as(t,a,s=new Set){const r=t.startsWith("=")?t.slice(1).trim():t,l=(F,v)=>{if(!F||!v)return[];const x=[];for(let _=F.row;_<=v.row;_++)for(let j=F.col;j<=v.col;j++){const U=Ye(De(_,j),a,new Set(s));typeof U=="number"&&x.push(U)}return x},u=(F,v)=>{if(!F||!v)return[];const x=[];for(let _=F.row;_<=v.row;_++)for(let j=F.col;j<=v.col;j++)x.push(Ye(De(_,j),a,new Set(s)));return x},f=r.match(/^(\w+)\(([A-Z]+\d+):([A-Z]+\d+)\)$/i);if(f){const F=f[1].toUpperCase(),v=et(f[2].toUpperCase()),x=et(f[3].toUpperCase());switch(F){case"SUM":return l(v,x).reduce((j,U)=>j+U,0);case"AVG":case"AVERAGE":{const _=l(v,x);return _.length>0?_.reduce((j,U)=>j+U,0)/_.length:0}case"COUNT":return l(v,x).length;case"COUNTA":return u(v,x).filter(_=>_!==null&&_!=="").length;case"COUNTBLANK":return u(v,x).filter(_=>_===null||_==="").length;case"MIN":{const _=l(v,x);return _.length?Math.min(..._):0}case"MAX":{const _=l(v,x);return _.length?Math.max(..._):0}case"MEDIAN":{const _=l(v,x).sort((U,X)=>U-X);if(!_.length)return 0;const j=Math.floor(_.length/2);return _.length%2?_[j]:(_[j-1]+_[j])/2}case"STDEV":{const _=l(v,x);if(_.length<2)return 0;const j=_.reduce((U,X)=>U+X,0)/_.length;return Math.sqrt(_.reduce((U,X)=>U+(X-j)**2,0)/(_.length-1))}case"PRODUCT":{const _=l(v,x);return _.length?_.reduce((j,U)=>j*U,1):0}}}const c=r.match(/^(SUMIF|COUNTIF)\(([A-Z]+\d+):([A-Z]+\d+)\s*,\s*"?([^"]*)"?\)$/i);if(c){const F=c[1].toUpperCase(),v=et(c[2].toUpperCase()),x=et(c[3].toUpperCase()),_=c[4];if(v&&x){let j=0;for(let U=v.row;U<=x.row;U++)for(let X=v.col;X<=x.col;X++){const le=Ye(De(U,X),a,new Set(s));(_.startsWith(">")?Number(le)>Number(_.slice(1)):_.startsWith("<")?Number(le)<Number(_.slice(1)):String(le)===_||typeof le=="number"&&le===Number(_))&&(j+=F==="SUMIF"?typeof le=="number"?le:0:1)}return j}}const g=r.match(/^IF\(([^,]+),\s*([^,]+),\s*([^)]+)\)$/i);if(g){const F=g[1].trim(),v=g[2].trim(),x=g[3].trim(),_=F.match(/^([A-Z]+\d+)\s*([><=!]+)\s*(\S+)$/i);let j=!1;if(_){const le=Ye(_[1].toUpperCase(),a,new Set(s)),be=isNaN(Number(_[3]))?_[3].replace(/^"|"$/g,""):Number(_[3]),T=_[2],G=typeof le=="number"?le:Number(le)||0,ae=typeof be=="number"?be:Number(be)||0;switch(T){case">":j=G>ae;break;case"<":j=G<ae;break;case">=":j=G>=ae;break;case"<=":j=G<=ae;break;case"=":case"==":j=G===ae;break;case"<>":case"!=":j=G!==ae;break}}const U=j?v:x;if(et(U.toUpperCase()))return Ye(U.toUpperCase(),a,new Set(s));const X=Number(U);return isNaN(X)?U.replace(/^"|"$/g,""):X}const N=r.match(/^CONCAT\((.+)\)$/i);if(N)return N[1].split(",").map(v=>v.trim()).map(v=>{if(v.startsWith('"')&&v.endsWith('"'))return v.slice(1,-1);if(et(v.toUpperCase())){const _=Ye(v.toUpperCase(),a,new Set(s));return _!==null?String(_):""}return v}).join("");const D=r.match(/^VLOOKUP\(([^,]+),\s*([A-Z]+\d+):([A-Z]+\d+),\s*(\d+)\)$/i);if(D){let F;et(D[1].trim().toUpperCase())?F=Ye(D[1].trim().toUpperCase(),a,new Set(s)):F=isNaN(Number(D[1]))?D[1].replace(/^"|"$/g,""):Number(D[1]);const x=et(D[2].toUpperCase()),_=et(D[3].toUpperCase()),j=parseInt(D[4])-1;if(x&&_)for(let U=x.row;U<=_.row;U++){const X=Ye(De(U,x.col),a,new Set(s));if(String(X)===String(F))return Ye(De(U,x.col+j),a,new Set(s))}return null}const z=r.match(/^(ABS|ROUND|FLOOR|CEIL|CEILING|SQRT|LEN|UPPER|LOWER|TRIM|INT)\(([^)]+)\)$/i);if(z){const F=z[1].toUpperCase(),v=z[2].trim();let x;switch(et(v.toUpperCase())?x=Ye(v.toUpperCase(),a,new Set(s)):x=isNaN(Number(v))?v.replace(/^"|"$/g,""):Number(v),F){case"ABS":return Math.abs(Number(x)||0);case"ROUND":return Math.round(Number(x)||0);case"FLOOR":return Math.floor(Number(x)||0);case"CEIL":case"CEILING":return Math.ceil(Number(x)||0);case"SQRT":return Math.sqrt(Number(x)||0);case"INT":return Math.trunc(Number(x)||0);case"LEN":return String(x??"").length;case"UPPER":return String(x??"").toUpperCase();case"LOWER":return String(x??"").toLowerCase();case"TRIM":return String(x??"").trim()}}const k=r.match(/^POWER\(([^,]+),\s*([^)]+)\)$/i);if(k){const F=Number(et(k[1].trim().toUpperCase())?Ye(k[1].trim().toUpperCase(),a,new Set(s)):k[1].trim())||0,v=Number(et(k[2].trim().toUpperCase())?Ye(k[2].trim().toUpperCase(),a,new Set(s)):k[2].trim())||0;return Math.pow(F,v)}if(/^NOW\(\)$/i.test(r))return new Date().toISOString();if(/^TODAY\(\)$/i.test(r))return new Date().toISOString().split("T")[0];if(/^PI\(\)$/i.test(r))return Math.PI;const Q=r.match(/^([A-Z]+\d+)$/i);if(Q)return Ye(Q[1].toUpperCase(),a,s);const V=r.match(/^([A-Z]+\d+)\s*([+\-*/])\s*([A-Z]+\d+|\d+\.?\d*)$/i);if(V){const F=V[1].toUpperCase(),v=V[2],x=V[3],_=Ye(F,a,s),U=et(x.toUpperCase())?Ye(x.toUpperCase(),a,s):parseFloat(x),X=typeof _=="number"?_:0,le=typeof U=="number"?U:0;switch(v){case"+":return X+le;case"-":return X-le;case"*":return X*le;case"/":return le!==0?X/le:null}}const L=parseFloat(r);return isNaN(L)?r:L}function Ye(t,a,s){if(s.has(t))return null;s.add(t);const r=a[t];return r?r.formula?as(r.formula,a,s):r.value:null}function pi(t,a){return t==null?"":a==="percent"&&typeof t=="number"?`${(t*100).toFixed(1)}%`:a==="currency"&&typeof t=="number"?`$${t.toFixed(2)}`:String(t)}function fi(t){return{name:t,data:{}}}const Ci=n.forwardRef(({sheets:t,activeSheet:a,rows:s=50,cols:r=26,showToolbar:l=!0,showFormulaBar:u=!0,showSheetTabs:f=!0,readOnly:c=!1,onChange:g,onActiveSheetChange:N,onCellSelect:D,onCopy:z,onPaste:k,onInsert:Q,onRemove:V,maxUndo:L=50,sortable:F=!1,filterable:v=!1,rangeSelection:x=!0,className:_,style:j,id:U,...X},le)=>{const be=Ne._s(U),{t:T}=Ne.Zt(),[G,ae]=n.useState(()=>t??[fi(T("spreadsheet.sheet","Sheet")+" 1")]),[ue,he]=n.useState(0),B=t??G,$=a??ue,E=B[$]??B[0],[o,xe]=n.useState(null),[we,se]=n.useState(null),[I,Y]=n.useState(!1),[O,de]=n.useState(null),[pe,Se]=n.useState(""),Ke=n.useRef(null),Ze=n.useRef(null),[Fe,Le]=n.useState([]),[Oe,ge]=n.useState([]),[H,je]=n.useState(null),Ve=n.useRef({x:0,width:80}),[ve,C]=n.useState(null),[J,Re]=n.useState(null),[S,ce]=n.useState("");n.useEffect(()=>{O&&Ke.current&&Ke.current.focus()},[O]);const W=n.useMemo(()=>{if(!o)return null;const m=we??o;return{startRow:Math.min(o.row,m.row),startCol:Math.min(o.col,m.col),endRow:Math.max(o.row,m.row),endCol:Math.max(o.col,m.col)}},[o,we]),Ae=n.useCallback((m,h)=>W?m>=W.startRow&&m<=W.endRow&&h>=W.startCol&&h<=W.endCol:!1,[W]),Ee=n.useCallback(m=>{Le(h=>{const P=[...h,m.map(M=>({...M,data:{...M.data}}))];return P.length>L?P.slice(-L):P}),ge([])},[L]),ee=n.useCallback((m,h=!0)=>{h&&Ee(B);const P=m(B);t||ae(P),g?.(P)},[B,t,g,Ee]),Ge=n.useCallback(()=>{if(Fe.length===0)return;const m=Fe[Fe.length-1];ge(h=>[...h,B.map(P=>({...P,data:{...P.data}}))]),Le(h=>h.slice(0,-1)),t||ae(m),g?.(m)},[Fe,B,t,g]),qe=n.useCallback(()=>{if(Oe.length===0)return;const m=Oe[Oe.length-1];Le(h=>[...h,B.map(P=>({...P,data:{...P.data}}))]),ge(h=>h.slice(0,-1)),t||ae(m),g?.(m)},[Oe,B,t,g]),lt=n.useCallback(m=>{a||he(m),N?.(m),xe(null),se(null),de(null)},[a,N]),ye=n.useCallback((m,h,P)=>{const M=De(m,h);ee(Z=>{const w=Z.map((ie,oe)=>oe===$?{...ie,data:{...ie.data}}:ie),q=P.startsWith("=");return w[$].data[M]={...w[$].data[M]??{value:null},formula:q?P:void 0,value:q?null:isNaN(Number(P))?P:Number(P)},w})},[$,ee]),Wt=n.useCallback((m,h,P)=>{P?.shiftKey&&x&&o?se({row:m,col:h}):(xe({row:m,col:h}),se(null)),de(null),D?.($,m,h)},[$,D,x,o]),Pt=n.useCallback((m,h,P)=>{P.button===0&&(Wt(m,h,P),x&&!P.shiftKey&&Y(!0))},[Wt,x]),ut=n.useCallback((m,h)=>{I&&se({row:m,col:h})},[I]);n.useEffect(()=>{if(!I)return;const m=()=>Y(!1);return document.addEventListener("mouseup",m),()=>document.removeEventListener("mouseup",m)},[I]);const at=n.useCallback((m,h)=>{if(c)return;const P=De(m,h),M=E.data[P];M?.readOnly||(de({row:m,col:h}),Se(M?.formula??(M?.value!=null?String(M.value):"")))},[c,E.data]),A=n.useCallback(()=>{O&&(ye(O.row,O.col,pe),de(null))},[O,pe,ye]),ne=n.useCallback(m=>{if(m.key==="Enter")A();else if(m.key==="Escape")de(null);else if(m.key==="Tab"&&(m.preventDefault(),A(),o)){const h=m.shiftKey?Math.max(0,o.col-1):Math.min(r-1,o.col+1);xe({row:o.row,col:h})}},[A,o,r]),fe=n.useCallback((m,h)=>{if(!o)return;const P=W??{startRow:o.row,startCol:o.col,endRow:o.row,endCol:o.col};ee(M=>{const Z=M.map((w,q)=>q===$?{...w,data:{...w.data}}:w);for(let w=P.startRow;w<=P.endRow;w++)for(let q=P.startCol;q<=P.endCol;q++){const ie=De(w,q);Z[$].data[ie]={...Z[$].data[ie]??{value:null},[m]:h}}return Z})},[o,W,$,ee]),Xe=n.useCallback(m=>{if(!W||z?.(W)===!1)return;const{startRow:h,startCol:P,endRow:M,endCol:Z}=W,w=[];for(let q=h;q<=M;q++){const ie=[];for(let oe=P;oe<=Z;oe++){const Ue=De(q,oe),ze=E.data[Ue],Me=ze?Ye(Ue,E.data,new Set):null;ie.push(pi(Me,ze?.format))}w.push(ie.join(" "))}m.clipboardData.setData("text/plain",w.join(`
|
|
595
|
+
`)),m.preventDefault()},[W,E.data,z]),Je=n.useCallback(m=>{if(c||!o)return;const h=m.clipboardData.getData("text/plain");if(!h)return;const P=h.split(`
|
|
596
|
+
`).map(M=>M.split(" "));k?.(P,o.row,o.col)!==!1&&(ee(M=>{const Z=M.map((w,q)=>q===$?{...w,data:{...w.data}}:w);return P.forEach((w,q)=>{w.forEach((ie,oe)=>{const Ue=De(o.row+q,o.col+oe),ze=ie.startsWith("=");Z[$].data[Ue]={...Z[$].data[Ue]??{value:null},formula:ze?ie:void 0,value:ze?null:isNaN(Number(ie))?ie:Number(ie)}})}),Z}),m.preventDefault())},[c,o,$,ee,k]),ke=n.useCallback(m=>{ee(h=>h.map((M,Z)=>{if(Z!==$)return M;const w={};for(const[q,ie]of Object.entries(M.data)){const oe=et(q);oe&&(oe.row>m?w[De(oe.row+1,oe.col)]=ie:w[q]=ie)}return{...M,data:w}})),Q?.("row",m)},[$,ee,Q]),Te=n.useCallback(m=>{ee(h=>h.map((M,Z)=>{if(Z!==$)return M;const w={};for(const[q,ie]of Object.entries(M.data)){const oe=et(q);oe&&(oe.col>m?w[De(oe.row,oe.col+1)]=ie:w[q]=ie)}return{...M,data:w}})),Q?.("column",m)},[$,ee,Q]),Be=n.useCallback(m=>{ee(h=>h.map((M,Z)=>{if(Z!==$)return M;const w={};for(const[q,ie]of Object.entries(M.data)){const oe=et(q);oe&&oe.row!==m&&(oe.row>m?w[De(oe.row-1,oe.col)]=ie:w[q]=ie)}return{...M,data:w}})),V?.("row",m)},[$,ee,V]),tt=n.useCallback(m=>{ee(h=>h.map((M,Z)=>{if(Z!==$)return M;const w={};for(const[q,ie]of Object.entries(M.data)){const oe=et(q);oe&&oe.col!==m&&(oe.col>m?w[De(oe.row,oe.col-1)]=ie:w[q]=ie)}return{...M,data:w}})),V?.("column",m)},[$,ee,V]),He=n.useCallback((m,h)=>{ee(P=>P.map((Z,w)=>{if(w!==$)return Z;const q=new Map;for(const[Ue,ze]of Object.entries(Z.data)){const Me=et(Ue);Me&&(q.has(Me.row)||q.set(Me.row,{}),q.get(Me.row)[Me.col]=ze)}const ie=Array.from(q.entries()).sort((Ue,ze)=>{const Me=Ye(De(Ue[0],m),Z.data,new Set),nt=Ye(De(ze[0],m),Z.data,new Set),Dt=typeof Me=="number"?Me:Number(Me),It=typeof nt=="number"?nt:Number(nt);if(!isNaN(Dt)&&!isNaN(It))return h==="asc"?Dt-It:It-Dt;const rt=String(Me??""),en=String(nt??"");return h==="asc"?rt.localeCompare(en):en.localeCompare(rt)}),oe={};return ie.forEach(([,Ue],ze)=>{for(const[Me,nt]of Object.entries(Ue))oe[De(ze,Number(Me))]=nt}),{...Z,data:oe,sortColumn:m,sortDirection:h}}))},[$,ee]),mt=n.useCallback((m,h)=>{const P=E.conditionalFormats;if(!P?.length)return;const M=De(m,h),Z=Ye(M,E.data,new Set),w=typeof Z=="number"?Z:Number(Z);for(const q of P){const ie=q.range.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!ie)continue;const oe=et(ie[1].toUpperCase()),Ue=et(ie[2].toUpperCase());if(!oe||!Ue||m<oe.row||m>Ue.row||h<oe.col||h>Ue.col)continue;let ze=!1;switch(q.type){case"greaterThan":ze=!isNaN(w)&&w>Number(q.value);break;case"lessThan":ze=!isNaN(w)&&w<Number(q.value);break;case"equalTo":ze=String(Z)===String(q.value);break;case"between":ze=!isNaN(w)&&w>=Number(q.value)&&w<=Number(q.value2);break;case"textContains":ze=String(Z).includes(String(q.value));break;case"isEmpty":ze=Z===null||Z==="";break;case"isNotEmpty":ze=Z!==null&&Z!=="";break}if(ze)return{backgroundColor:q.style.bgColor,color:q.style.color,fontWeight:q.style.bold?"bold":void 0,fontStyle:q.style.italic?"italic":void 0}}},[E.conditionalFormats,E.data]),Ft=n.useCallback(()=>{const m=`${T("spreadsheet.sheet","Sheet")} ${B.length+1}`;ee(h=>[...h,fi(m)]),lt(B.length)},[B.length,ee,lt,T]),sn=n.useCallback(()=>{B.length<=1||(ee(m=>m.filter((h,P)=>P!==$)),lt(Math.max(0,$-1)))},[B.length,$,ee,lt]),pn=n.useCallback((m,h)=>{h.trim()&&(ee(P=>P.map((M,Z)=>Z===m?{...M,name:h.trim()}:M),!1),Re(null))},[ee]),wn=n.useMemo(()=>{if(!o)return"";const m=De(o.row,o.col),h=E.data[m];return h?.formula??(h?.value!=null?String(h.value):"")},[o,E.data]),st=n.useMemo(()=>{if(!W)return null;const{startRow:m,startCol:h,endRow:P,endCol:M}=W;if(m===P&&h===M)return null;const Z=[];let w=0;for(let q=m;q<=P;q++)for(let ie=h;ie<=M;ie++){const oe=De(q,ie),Ue=Ye(oe,E.data,new Set);Ue!==null&&Ue!==""&&w++,typeof Ue=="number"&&Z.push(Ue)}return Z.length===0?{count:w}:{count:w,sum:Z.reduce((q,ie)=>q+ie,0),avg:Z.reduce((q,ie)=>q+ie,0)/Z.length,min:Math.min(...Z),max:Math.max(...Z)}},[W,E.data]),Pn=n.useCallback((m,h)=>{h.preventDefault(),h.stopPropagation(),je(m),Ve.current={x:h.clientX,width:E.colWidths?.[m]??80}},[E.colWidths]);n.useEffect(()=>{if(H===null)return;const m=P=>{const M=P.clientX-Ve.current.x,Z=Math.max(30,Ve.current.width+M);ee(w=>w.map((ie,oe)=>oe===$?{...ie,colWidths:{...ie.colWidths,[H]:Z}}:ie),!1)},h=()=>je(null);return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h)}},[H,$,ee]);const fn=n.useCallback((m,h,P)=>{m.preventDefault(),xe({row:h,col:P}),C({x:m.clientX,y:m.clientY})},[]);n.useEffect(()=>{if(!ve)return;const m=()=>C(null);return document.addEventListener("click",m),()=>document.removeEventListener("click",m)},[ve]);const gn=n.useCallback(m=>{if((m.ctrlKey||m.metaKey)&&!O){if(m.key==="z"){m.preventDefault(),Ge();return}if(m.key==="y"){m.preventDefault(),qe();return}}if(O||!o)return;let{row:h,col:P}=o;switch(m.key){case"ArrowUp":h=Math.max(0,h-1);break;case"ArrowDown":h=Math.min(s-1,h+1);break;case"ArrowLeft":P=Math.max(0,P-1);break;case"ArrowRight":P=Math.min(r-1,P+1);break;case"Enter":at(h,P);return;case"Delete":case"Backspace":c||(W&&(W.startRow!==W.endRow||W.startCol!==W.endCol)?ee(M=>{const Z=M.map((w,q)=>q===$?{...w,data:{...w.data}}:w);for(let w=W.startRow;w<=W.endRow;w++)for(let q=W.startCol;q<=W.endCol;q++)delete Z[$].data[De(w,q)];return Z}):ye(h,P,""));return;default:if(m.key.length===1&&!m.ctrlKey&&!m.metaKey&&!c){de({row:h,col:P}),Se(m.key);return}return}m.preventDefault(),m.shiftKey&&x?se({row:h,col:P}):(xe({row:h,col:P}),se(null)),D?.($,h,P)},[O,o,s,r,c,at,ye,$,D,Ge,qe,W,ee,x]),Jt=E.frozenRows??0,kt=E.frozenCols??0,rn=[{value:"text",label:T("spreadsheet.formatText","Text")},{value:"number",label:T("spreadsheet.formatNumber","Number")},{value:"percent",label:T("spreadsheet.formatPercent","Percent")},{value:"currency",label:T("spreadsheet.formatCurrency","Currency")},{value:"date",label:T("spreadsheet.formatDate","Date")}];return e.jsxs("div",{ref:le,id:be,className:`nice-spreadsheet ${c?"nice-spreadsheet--readonly":""} ${_??""}`,style:j,onKeyDown:gn,onCopy:Xe,onPaste:Je,tabIndex:0,role:"application","aria-label":T("spreadsheet.label","Spreadsheet"),...X,children:[l&&!c&&e.jsxs("div",{className:"nice-spreadsheet__toolbar",role:"toolbar",children:[e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:Ge,disabled:Fe.length===0,title:T("spreadsheet.undo","Undo"),children:e.jsx(Ga,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:qe,disabled:Oe.length===0,title:T("spreadsheet.redo","Redo"),children:e.jsx(Ka,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx($e.NiceButton,{variant:E.data[o?De(o.row,o.col):""]?.bold?"primary":"ghost",size:"sm",onClick:()=>fe("bold",!E.data[o?De(o.row,o.col):""]?.bold),title:T("spreadsheet.bold","Bold"),children:e.jsx("strong",{children:"B"})}),e.jsx($e.NiceButton,{variant:E.data[o?De(o.row,o.col):""]?.italic?"primary":"ghost",size:"sm",onClick:()=>fe("italic",!E.data[o?De(o.row,o.col):""]?.italic),title:T("spreadsheet.italic","Italic"),children:e.jsx("em",{children:"I"})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>fe("align","left"),title:T("spreadsheet.alignLeft","Align left"),children:e.jsx(Va,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>fe("align","center"),title:T("spreadsheet.alignCenter","Center"),children:e.jsx(Za,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>fe("align","right"),title:T("spreadsheet.alignRight","Align right"),children:e.jsx(qa,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx($e.NiceColorPicker,{value:E.data[o?De(o.row,o.col):""]?.bgColor??"var(--bg-primary, #ffffff)",onChange:m=>fe("bgColor",m),title:T("spreadsheet.bgColor","Background color"),showInput:!1,showRandom:!1}),e.jsx($e.NiceColorPicker,{value:E.data[o?De(o.row,o.col):""]?.color??"var(--text-primary, #000000)",onChange:m=>fe("color",m),title:T("spreadsheet.textColor","Text color"),showInput:!1,showRandom:!1}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx($e.NiceSelect,{size:"sm",value:E.data[o?De(o.row,o.col):""]?.format??"text",onChange:m=>fe("format",m),options:rn,"aria-label":T("spreadsheet.format","Cell format")}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o&&ke(o.row),title:T("spreadsheet.insertRow","Insert row"),children:e.jsx(Xa,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o&&Te(o.col),title:T("spreadsheet.insertCol","Insert column"),children:e.jsx(Ha,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o&&Be(o.row),title:T("spreadsheet.deleteRow","Delete row"),children:e.jsx(Qa,{})}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>o&&tt(o.col),title:T("spreadsheet.deleteCol","Delete column"),children:e.jsx(Ya,{})})]}),u&&e.jsxs("div",{className:"nice-spreadsheet__formula-bar",children:[e.jsxs("span",{className:"nice-spreadsheet__cell-label",children:[o?De(o.row,o.col):"",W&&W.startRow!==W.endRow||W&&W.startCol!==W.endCol?`:${De(W.endRow,W.endCol)}`:""]}),e.jsx($e.NiceTextInput,{className:"nice-spreadsheet__formula-input",value:O?pe:wn,onChange:m=>{O?Se(m):o&&(de(o),Se(m))},onKeyDown:ne,readOnly:c,"aria-label":T("spreadsheet.formulaBar","Formula bar")})]}),e.jsx("div",{className:"nice-spreadsheet__grid",ref:Ze,children:e.jsxs("table",{role:"grid","aria-label":E.name,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"nice-spreadsheet__corner"}),Array.from({length:r},(m,h)=>e.jsxs("th",{className:`nice-spreadsheet__col-header ${h<kt?"nice-spreadsheet__col-header--frozen":""}`,style:{width:E.colWidths?.[h]??80,position:h<kt?"sticky":void 0,left:h<kt?h*80+40:void 0,zIndex:h<kt?3:void 0},children:[e.jsx("span",{children:Si(h)}),F&&e.jsx("span",{className:"nice-spreadsheet__sort-trigger",onClick:()=>He(h,E.sortColumn===h&&E.sortDirection==="asc"?"desc":"asc"),title:T("spreadsheet.sort","Sort"),children:E.sortColumn===h?E.sortDirection==="asc"?e.jsx(Ja,{}):e.jsx(es,{}):e.jsx(ts,{})}),!c&&e.jsx("span",{className:"nice-spreadsheet__col-resize",onMouseDown:P=>Pn(h,P)})]},h))]})}),e.jsx("tbody",{children:Array.from({length:s},(m,h)=>e.jsxs("tr",{className:h<Jt?"nice-spreadsheet__row--frozen":"",style:h<Jt?{position:"sticky",top:h*24,zIndex:2}:void 0,children:[e.jsx("td",{className:"nice-spreadsheet__row-header",children:h+1}),Array.from({length:r},(P,M)=>{const Z=De(h,M),w=E.data[Z];if(w?.mergedInto)return null;const q=o?.row===h&&o?.col===M,ie=Ae(h,M),oe=O?.row===h&&O?.col===M,Ue=w?Ye(Z,E.data,new Set):null,ze=mt(h,M),Me=h<Jt||M<kt;return e.jsxs("td",{className:`nice-spreadsheet__cell ${q?"nice-spreadsheet__cell--selected":""} ${ie&&!q?"nice-spreadsheet__cell--in-range":""} ${w?.readOnly?"nice-spreadsheet__cell--readonly":""} ${Me?"nice-spreadsheet__cell--frozen":""}`,style:{textAlign:w?.align,fontWeight:w?.bold?"bold":void 0,fontStyle:w?.italic?"italic":void 0,backgroundColor:ze?.backgroundColor??w?.bgColor,color:ze?.color??w?.color,width:E.colWidths?.[M],height:E.rowHeights?.[h],position:Me?"sticky":void 0,left:M<kt?M*80+40:void 0,zIndex:Me?1:void 0,...ze},colSpan:w?.colSpan,rowSpan:w?.rowSpan,onMouseDown:nt=>Pt(h,M,nt),onMouseEnter:()=>ut(h,M),onDoubleClick:()=>at(h,M),onContextMenu:nt=>fn(nt,h,M),role:"gridcell","aria-selected":q,title:w?.comment,children:[w?.comment&&e.jsx("span",{className:"nice-spreadsheet__comment-indicator"}),oe?e.jsx("input",{ref:Ke,className:"nice-spreadsheet__cell-editor",value:pe,onChange:nt=>Se(nt.target.value),onKeyDown:ne,onBlur:A}):pi(Ue,w?.format)]},M)})]},h))})]})}),ve&&!c&&o&&e.jsxs("div",{className:"nice-spreadsheet__context-menu",style:{position:"fixed",left:ve.x,top:ve.y,zIndex:1e3},children:[e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{ke(o.row),C(null)},children:T("spreadsheet.insertRowAbove","Insert row above")}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{ke(o.row+1),C(null)},children:T("spreadsheet.insertRowBelow","Insert row below")}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Te(o.col),C(null)},children:T("spreadsheet.insertColLeft","Insert column left")}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Te(o.col+1),C(null)},children:T("spreadsheet.insertColRight","Insert column right")}),e.jsx("hr",{className:"nice-spreadsheet__context-sep"}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Be(o.row),C(null)},children:T("spreadsheet.deleteRow","Delete row")}),e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{tt(o.col),C(null)},children:T("spreadsheet.deleteCol","Delete column")})]}),st&&e.jsxs("div",{className:"nice-spreadsheet__status-bar",children:[e.jsxs("span",{children:[T("spreadsheet.count","Count"),": ",st.count]}),st.sum!==void 0&&e.jsxs("span",{children:[T("spreadsheet.sum","Sum"),": ",st.sum.toFixed(2)]}),st.avg!==void 0&&e.jsxs("span",{children:[T("spreadsheet.avg","Avg"),": ",st.avg.toFixed(2)]}),st.min!==void 0&&e.jsxs("span",{children:[T("spreadsheet.min","Min"),": ",st.min]}),st.max!==void 0&&e.jsxs("span",{children:[T("spreadsheet.max","Max"),": ",st.max]})]}),f&&e.jsxs("div",{className:"nice-spreadsheet__tabs",role:"tablist",children:[B.map((m,h)=>e.jsx("span",{className:"nice-spreadsheet__tab-wrapper",children:J===h?e.jsx($e.NiceTextInput,{className:"nice-spreadsheet__tab-rename",value:S,onChange:P=>ce(P),onBlur:()=>pn(h,S),onKeyDown:P=>{P.key==="Enter"&&pn(h,S),P.key==="Escape"&&Re(null)},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>{c||(Re(h),ce(m.name))},children:e.jsx($e.NiceButton,{variant:h===$?"primary":"ghost",size:"sm",onClick:()=>lt(h),children:m.name})})},h)),!c&&e.jsxs(e.Fragment,{children:[e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:Ft,title:T("spreadsheet.addSheet","Add sheet"),children:e.jsx(ns,{})}),B.length>1&&e.jsx($e.NiceButton,{variant:"ghost",size:"sm",onClick:sn,title:T("spreadsheet.removeSheet","Remove sheet"),children:e.jsx(is,{})})]})]})]})});Ci.displayName="NiceSpreadsheet";const ss=({queries:t,currentFilter:a,currentColumns:s,currentSort:r,onLoad:l,onSave:u,onUpdate:f,onDelete:c,onShare:g,onSetDefault:N,allowSharing:D=!0,allowPinning:z=!0,position:k="dropdown",className:Q,style:V,"data-testid":L})=>{const[F,v]=n.useState(!1),[x,_]=n.useState(""),[j,U]=n.useState(!1),[X,le]=n.useState(""),[be,T]=n.useState(""),[G,ae]=n.useState(!1),ue=t.filter(o=>o.name.toLowerCase().includes(x.toLowerCase())),he=ue.filter(o=>!o.isShared),B=ue.filter(o=>o.isShared),$=async()=>{if(X.trim()){U(!0);try{await u({name:X,description:be||void 0,filter:a??{},columns:s,sort:r}),ae(!1),le(""),T("")}finally{U(!1)}}},E=o=>e.jsxs("div",{className:"nice-saved-query__item",children:[o.icon&&e.jsx("span",{className:"nice-saved-query__icon","aria-hidden":"true",children:o.icon}),e.jsx("span",{className:"nice-saved-query__name",children:o.name}),o.isDefault&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--default",children:"domyślne"}),o.isShared&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--shared",children:"udostępnione"}),o.isPinned&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--pinned",children:"przypięte"}),e.jsxs("div",{className:"nice-saved-query__actions",children:[e.jsx("button",{onClick:()=>{l(o),v(!1)},type:"button",children:"Wczytaj"}),N&&e.jsx("button",{onClick:()=>N(o.id),type:"button",title:"Ustaw domyślne",children:"★"}),D&&g&&e.jsx("button",{onClick:()=>g(o.id,[]),type:"button",title:"Udostępnij",children:"↗"}),z&&e.jsx("button",{onClick:()=>f(o.id,{...o}),type:"button",title:"Przypnij",children:"📌"}),e.jsx("button",{onClick:()=>c(o.id),type:"button",title:"Usuń","aria-label":`Usuń zapytanie ${o.name}`,children:"✕"})]})]},o.id);return e.jsxs("div",{className:`nice-saved-query nice-saved-query--${k} ${F?"nice-saved-query--open":""} ${Q??""}`,style:V,"data-testid":L,children:[e.jsx("button",{className:"nice-saved-query__trigger",onClick:()=>v(o=>!o),"aria-expanded":F,"aria-haspopup":"listbox",type:"button",children:"Widoki i zapytania"}),F&&e.jsxs("div",{className:"nice-saved-query__panel",role:"dialog","aria-label":"Zarządzanie zapytaniami",children:[e.jsxs("div",{className:"nice-saved-query__search-row",children:[e.jsx("input",{type:"search",placeholder:"Szukaj zapytania…",value:x,onChange:o=>_(o.target.value),"aria-label":"Szukaj zapytania"}),e.jsx("button",{onClick:()=>ae(o=>!o),type:"button",children:"+ Zapisz bieżący widok"})]}),G&&e.jsxs("div",{className:"nice-saved-query__save-form",children:[e.jsx("input",{type:"text",placeholder:"Nazwa zapytania",value:X,onChange:o=>le(o.target.value),"aria-label":"Nazwa zapytania"}),e.jsx("input",{type:"text",placeholder:"Opis (opcjonalnie)",value:be,onChange:o=>T(o.target.value),"aria-label":"Opis zapytania"}),e.jsx("button",{onClick:$,disabled:j||!X.trim(),type:"button",children:j?"Zapisywanie…":"Zapisz"}),e.jsx("button",{onClick:()=>ae(!1),type:"button",children:"Anuluj"})]}),he.length>0&&e.jsxs("section",{className:"nice-saved-query__group","aria-labelledby":"nice-saved-query-mine",children:[e.jsx("h3",{id:"nice-saved-query-mine",className:"nice-saved-query__group-title",children:"Moje"}),he.map(E)]}),B.length>0&&e.jsxs("section",{className:"nice-saved-query__group","aria-labelledby":"nice-saved-query-shared",children:[e.jsx("h3",{id:"nice-saved-query-shared",className:"nice-saved-query__group-title",children:"Udostępnione"}),B.map(E)]}),ue.length===0&&e.jsx("p",{className:"nice-saved-query__empty",children:"Brak zapisanych zapytań"})]})]})};exports.NiceCardView=oa;exports.NiceDataGrid=zn;exports.NiceDataGrid$1=ea;exports.NiceDataGridAI=aa;exports.NiceFilterBuilder=Xn;exports.NiceKanbanBoard=Ni;exports.NiceList=sa;exports.NiceModuleGrid=Aa;exports.NicePivotGrid=ji;exports.NicePivotGrid$1=ma;exports.NicePivotGridFieldChooser=yi;exports.NiceReconciliationView=Pa;exports.NiceSavedQueryPanel=ss;exports.NiceSpreadsheet=Ci;exports.NiceTable=Gi;exports.NiceTileView=da;exports.NiceTreeGrid=Wa;exports.NiceTreeList=la;exports.NiceTreeView=ra;exports.computeAggregate=bi;exports.escapeCsvField=jn;
|