@nice2dev/ui 1.0.29 → 1.0.30
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 +17 -0
- package/dist/NiceBackupStatusBadge.doc-Bx2bFmBQ.cjs +1 -0
- package/dist/NiceBackupStatusBadge.doc-CdDxIQ-M.js +25 -0
- package/dist/NiceConfirmDialog-BiTJVR4-.js +81 -0
- package/dist/NiceConfirmDialog-Bjw_rN4o.cjs +1 -0
- package/dist/NiceErrorBoundary-1H751jK7.cjs +1 -0
- package/dist/NiceErrorBoundary-B-txoU3Y.js +709 -0
- package/dist/NiceForm-DGUTmaZT.js +5014 -0
- package/dist/NiceForm-DmU-gmyv.cjs +382 -0
- package/dist/NiceModal-BClAtR5T.js +95 -0
- package/dist/NiceModal-iKwtagFB.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-BO8Hw_W9.js +7619 -0
- package/dist/NiceModuleLifecyclePanel-Ch7HRRoy.cjs +1 -0
- package/dist/NicePagination-BVo-4KAD.js +172 -0
- package/dist/NicePagination-CaohvQsY.cjs +1 -0
- package/dist/NicePinCodeInput-DsyLuc0b.cjs +696 -0
- package/dist/NicePinCodeInput-nuRCN-9R.js +13223 -0
- package/dist/NiceSavedQueryPanel-BBFV4qiF.js +6969 -0
- package/dist/NiceSavedQueryPanel-CsiVNkCT.cjs +596 -0
- package/dist/NiceWindow-Cm9E6EAi.cjs +1 -0
- package/dist/NiceWindow-FMrVS7zo.js +1603 -0
- package/dist/charts-B90sSFeJ.cjs +761 -0
- package/dist/charts-DaLf19vS.js +4671 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BUTtIHg0.js +27766 -0
- package/dist/core-CESNSRyS.cjs +122 -0
- package/dist/data-branching-ByQdcjKO.cjs +1 -0
- package/dist/data-branching-psTzlcrT.js +6255 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.mjs +1 -1
- package/dist/devops-D7bQ3rE4.cjs +17 -0
- package/dist/devops-jCmpD6O-.js +8165 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +3 -3
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +4 -0
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index-BpixglWg.js +69337 -0
- package/dist/index-DLR-aWZR.cjs +5506 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +359 -145
- package/dist/index.mjs +986 -976
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.mjs +146 -146
- package/dist/no-code-BHo5WrXr.js +7425 -0
- package/dist/no-code-DyA_1_Th.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +4 -0
- package/dist/overlays.mjs +66 -66
- package/dist/pickerCommons-BEc3pZ_s.js +2044 -0
- package/dist/pickerCommons-CrITwM88.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),O=require("./core-CESNSRyS.cjs"),n=require("react"),xi=require("./NiceForm-DmU-gmyv.cjs"),_i=require("./NiceModal-iKwtagFB.cjs"),qi=require("./NicePagination-CaohvQsY.cjs"),Le=require("./pickerCommons-CrITwM88.cjs");function bi(t){const a=[];if(t.children)for(const s of t.children)a.push(s.key),a.push(...bi(s));return a}function Zn(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 o of t.children){const u=Zn(o,a);u==="checked"?r=!0:(u==="indeterminate"&&(r=!0),s=!1)}return s&&r?"checked":r?"indeterminate":"unchecked"}const Zi=({nodes:t,selectedKeys:a=[],expandedKeys:s,onSelectionChange:r,onExpandedChange:o,selectionMode:u="none",showCheckboxes:g,searchable:c,searchPlaceholder:x,onNodeClick:j,renderNode:D,showLines:V,loading:$,className:ae,style:W,accessMode:A,id:k,draggable:_,onNodeDrop:f,onLoadChildren:b,contextMenuItems:N,onContextMenuAction:U,editable:Z,onNodeEdit:re,maxDepth:ye})=>{const Y=O.$c(A,k)==="hidden",{t:le}=O.Gt(),[oe,ge]=n.useState([]),[B,R]=n.useState(""),[w,l]=n.useState(new Set),[_e,De]=n.useState(new Map),[ue,I]=n.useState(null),[Q,F]=n.useState(null),[he,pe]=n.useState(null),[Te,Ve]=n.useState(""),Ye=n.useRef(null),ke=s??oe,Ee=n.useMemo(()=>new Set(a),[a]),Be=n.useCallback(async(M,ee)=>{const Pe=!ke.includes(M),z=Pe?[...ke,M]:ke.filter(me=>me!==M);if(o?o(z):ge(z),Pe&&b&&!ee.children?.length&&ee.leaf!==!0&&!_e.has(M)){l(G=>new Set(G).add(M));const me=await b(ee);De(G=>new Map(G).set(M,me)),l(G=>{const Ie=new Set(G);return Ie.delete(M),Ie})}},[ke,o,b,_e]),Ge=n.useCallback((M,ee)=>{if(r){if(u==="single")r(a.includes(M)?[]:[M]);else if(u==="multiple")if(g&&ee.children?.length){const Pe=bi(ee),z=[M,...Pe];if(Zn(ee,Ee)==="checked")r(a.filter(G=>!z.includes(G)));else{const G=new Set([...a,...z]);r(Array.from(G))}}else r(a.includes(M)?a.filter(Pe=>Pe!==M):[...a,M])}},[a,u,r,g,Ee]),J=n.useCallback(M=>{if(!B)return!0;const ee=B.toLowerCase();return M.text.toLowerCase().includes(ee)?!0:(_e.get(M.key)??M.children)?.some(z=>J(z))??!1},[B,_e]),be=n.useCallback((M,ee)=>{N?.length&&(M.preventDefault(),F({x:M.clientX,y:M.clientY,node:ee}))},[N]),je=n.useCallback(()=>{he&&re&&re(he,Te),pe(null)},[he,Te,re]),xe=(M,ee)=>{if(B&&!J(M))return null;const Pe=typeof ye=="number"?Math.min(10,Math.max(1,ye)):1/0,z=ee+1>=Pe,me=z?void 0:_e.get(M.key)??M.children,G=!z&&(me&&me.length>0||M.leaf!==!0&&b&&!me?.length),Ie=ke.includes(M.key),$e=Ee.has(M.key),te=w.has(M.key),Ke=g&&u==="multiple"&&me?.length?Zn(M,Ee):$e?"checked":"unchecked",Qe=Math.min(ee+1,10),it={paddingLeft:ee*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":G?Ie:void 0,"data-nice-depth":Qe,draggable:_&&!M.disabled,onDragStart:_?Ne=>{Ne.stopPropagation(),I(M.key)}:void 0,onDragOver:_?Ne=>{Ne.preventDefault(),Ne.stopPropagation()}:void 0,onDrop:_&&ue?Ne=>{Ne.stopPropagation(),f?.(ue,M.key,"inside"),I(null)}:void 0,onDragEnd:_?()=>I(null):void 0,children:[e.jsxs("div",{className:`nice-tree__row ${$e?"nice-tree__row--selected":""} ${M.disabled?"nice-tree__row--disabled":""} ${ue===M.key?"nice-tree__row--dragging":""}`,style:it,onClick:()=>{M.disabled||(Ge(M.key,M),j?.(M))},onContextMenu:Ne=>be(Ne,M),onDoubleClick:Z&&!M.disabled?()=>{pe(M.key),Ve(M.text)}:void 0,children:[e.jsx("span",{className:`nice-tree__toggle ${G?Ie?"nice-tree__toggle--expanded":"":"nice-tree__toggle--leaf"}`,onClick:Ne=>{Ne.stopPropagation(),G&&Be(M.key,M)},children:te?e.jsx("span",{className:"nice-spinner nice-spinner--xs"}):G?Ie?e.jsx(O.oa,{name:"chevron-down",size:12}):e.jsx(O.oa,{name:"chevron-right",size:12}):""}),g&&u!=="none"&&e.jsx("input",{type:"checkbox",checked:Ke==="checked",ref:Ne=>{Ne&&(Ne.indeterminate=Ke==="indeterminate")},onChange:()=>Ge(M.key,M),onClick:Ne=>Ne.stopPropagation(),tabIndex:-1,className:"nice-tree__checkbox"}),he===M.key?e.jsx("input",{type:"text",className:"nice-tree__edit-input",value:Te,onChange:Ne=>Ve(Ne.target.value),onBlur:je,onKeyDown:Ne=>{Ne.key==="Enter"&&je(),Ne.key==="Escape"&&pe(null)},autoFocus:!0,onClick:Ne=>Ne.stopPropagation()}):D?D(M):e.jsxs(e.Fragment,{children:[M.icon&&e.jsx("span",{className:"nice-tree__icon",children:M.icon}),e.jsx("span",{className:"nice-tree__text",children:M.text})]})]}),me&&me.length>0&&Ie&&e.jsx("ul",{className:"nice-tree__children",role:"group",children:me.map(Ne=>xe(Ne,ee+1))})]},M.key)};return Y?null:e.jsxs("div",{className:`nice-tree ${V?"nice-tree--lines":""} ${ae||""}`,style:W,ref:Ye,onClick:()=>F(null),children:[c&&e.jsx("div",{className:"nice-tree__search",children:e.jsx("input",{type:"text",value:B,onChange:M=>R(M.target.value),placeholder:x||le("controls.search","Search..."),"aria-label":x||le("controls.search","Search tree")})}),$?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(M=>xe(M,0))}),Q&&N&&e.jsx("div",{className:"nice-tree__context-menu",style:{position:"fixed",top:Q.y,left:Q.x,zIndex:9999},children:N.map(M=>e.jsxs("div",{className:`nice-tree__context-item ${M.disabled?"nice-tree__context-item--disabled":""}`,onClick:()=>{M.disabled||(U?.(M.key,Q.node),F(null))},children:[M.icon&&e.jsx("span",{children:M.icon}),M.label]},M.key))})]})};function Xi({columns:t,data:a,striped:s,compact:r,emptyText:o,className:u,style:g,accessMode:c,id:x,displayStyle:j}){const V=O.$c(c,x)==="hidden",$=O.rc("table",j),ae=O.ac("table",j),[W,A]=n.useState(null),k=n.useMemo(()=>W?[...a].sort((f,b)=>{const N=f[W.field]??"",U=b[W.field]??"",Z=typeof N=="number"?N-U:String(N).localeCompare(String(U));return W.dir==="desc"?-Z:Z}):a,[a,W]),_=f=>{A(b=>b?.field===f?b.dir==="asc"?{field:f,dir:"desc"}:null:{field:f,dir:"asc"})};return V?null:e.jsx("div",{className:`nice-table-wrapper ${u||""}`,style:{...$,...g},children:e.jsxs("table",{className:`nice-table nice-table--ds-${ae} ${s?"nice-table--striped":""} ${r?"nice-table--compact":""}`,"aria-rowcount":k.length,"aria-colcount":t.length,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(f=>{const b=f.sortable?W?.field===f.field?W.dir==="asc"?"ascending":"descending":"none":void 0;return e.jsxs("th",{style:{width:f.width,textAlign:f.align},className:f.sortable?"th--sortable":void 0,onClick:()=>f.sortable&&_(f.field),scope:"col","aria-sort":b,children:[f.header,f.sortable&&W?.field===f.field&&e.jsx("span",{className:"nice-table__sort-icon","aria-hidden":"true",children:e.jsx(O.oa,{name:W.dir==="asc"?"sort-asc":"sort-desc",size:12})})]},f.field)})})}),e.jsx("tbody",{children:k.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"nice-table__empty",children:o||"No data"})}):k.map((f,b)=>e.jsx("tr",{children:t.map(N=>e.jsx("td",{style:{textAlign:N.align},children:N.render?N.render(f[N.field],f):String(f[N.field]??"")},N.field))},b))})]})})}const Hi=[{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"}],Yi=[{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"}],Qi=({condition:t,fields:a,onChange:s,onRemove:r})=>{const o=a.find(c=>c.field===t.field),u=t.operator==="isblank"||t.operator==="isnotblank",g=o?.operators||Yi;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:g.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))}),!u&&(o?.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:"--"}),o.options.map(c=>e.jsx("option",{value:c.value,children:c.label},c.value))]}):o?.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:o?.type==="number"?"number":o?.type==="date"?"date":"text",value:String(t.value??""),onChange:c=>s({...t,value:o?.type==="number"?Number(c.target.value):c.target.value})})),e.jsx("button",{className:"nice-filterbuilder__remove",onClick:r,children:"×"})]})},vi=({group:t,fields:a,onChange:s,onRemove:r,depth:o,maxDepth:u})=>{const[g,c]=n.useState(!1),x=()=>s({...t,logic:t.logic==="and"?"or":"and"}),j=t.items.filter(k=>k.type==="condition").length,D=t.items.length-j,V=[j?`${j} condition${j>1?"s":""}`:"",D?`${D} group${D>1?"s":""}`:""].filter(Boolean).join(" · ")||"empty",$=()=>{const k={type:"condition",field:a[0]?.field||"",operator:"=",value:""};s({...t,items:[...t.items,k]})},ae=()=>{if(o>=u)return;const k={type:"group",logic:"and",items:[]};s({...t,items:[...t.items,k]})},W=(k,_)=>{const f=[...t.items];f[k]=_,s({...t,items:f})},A=k=>{s({...t,items:t.items.filter((_,f)=>f!==k)})};return e.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(o,3)}`,children:[e.jsxs("div",{className:"nice-filterbuilder__group-header",children:[e.jsx("button",{type:"button",className:"nice-filterbuilder__collapse",onClick:()=>c(k=>!k),"aria-expanded":!g,title:g?"Expand group":"Collapse group",children:e.jsx(O.oa,{name:g?"chevron-right":"chevron-down",size:"sm"})}),e.jsx("button",{className:"nice-filterbuilder__logic",onClick:x,title:`Match ${t.logic==="and"?"ALL":"ANY"} — click to switch to ${t.logic==="and"?"OR":"AND"}`,children:t.logic.toUpperCase()}),g?e.jsx("span",{className:"nice-filterbuilder__summary",children:V}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:$,children:"+ Condition"}),o<u&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:ae,children:"+ Group"})]}),r&&e.jsx("button",{className:"nice-filterbuilder__remove",onClick:r,children:"×"})]}),!g&&e.jsx("div",{className:"nice-filterbuilder__group-body",children:t.items.map((k,_)=>e.jsx(n.Fragment,{children:k.type==="condition"?e.jsx(Qi,{condition:k,fields:a,onChange:f=>W(_,f),onRemove:()=>A(_)}):e.jsx(vi,{group:k,fields:a,onChange:f=>W(_,f),onRemove:()=>A(_),depth:o+1,maxDepth:u})},_))})]})},Xn=({fields:t,value:a,onChange:s,maxDepth:r=3,presets:o,onSavePreset:u,onDeletePreset:g,tutorial:c,className:x,style:j})=>{const[D,V]=n.useState(""),$=n.useCallback(W=>{const A=o?.find(k=>k.name===W);A&&s(structuredClone(A.filter))},[o,s]),ae=n.useCallback(()=>{!D.trim()||!u||(u({name:D.trim(),filter:structuredClone(a)}),V(""))},[D,a,u]);return e.jsxs("div",{className:`nice-filterbuilder ${x||""}`,style:{position:"relative",...j},children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(O.Yl,{steps:O.Jl(c,Hi)})}),(o?.length||u)&&e.jsxs("div",{className:"nice-filterbuilder__presets",children:[o&&o.length>0&&e.jsx("div",{className:"nice-filterbuilder__preset-list",children:o.map(W=>e.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>$(W.name),children:W.name}),g&&e.jsx("button",{type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>g(W.name),children:"×"})]},W.name))}),u&&e.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[e.jsx("input",{className:"nice-filterbuilder__input",value:D,onChange:W=>V(W.target.value),placeholder:"Preset name..."}),e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:ae,disabled:!D.trim(),children:"Save"})]})]}),e.jsx(vi,{group:a,fields:t,onChange:s,depth:0,maxDepth:r})]})};Xn.displayName="NiceFilterBuilder";function yi(t,a,s){const r=t.map(o=>o[a]).filter(o=>typeof o=="number");if(r.length===0)return s==="count"?"0":"";switch(s){case"sum":return r.reduce((o,u)=>o+u,0).toLocaleString();case"avg":return(r.reduce((o,u)=>o+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 wn(t){return t.includes(",")||t.includes('"')||t.includes(`
|
|
2
|
+
`)?`"${t.replace(/"/g,'""')}"`:t}const rn={width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Ji=()=>e.jsx("svg",{...rn,children:e.jsx("polyline",{points:"6 15 12 9 18 15"})}),Nn=()=>e.jsx("svg",{...rn,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),ea=()=>e.jsxs("svg",{...rn,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 10 12 5 18 10"}),e.jsx("polyline",{points:"6 14 12 19 18 14"})]}),$n=()=>e.jsx("svg",{...rn,children:e.jsx("polyline",{points:"9 6 15 12 9 18"})}),ta=()=>e.jsxs("svg",{...rn,children:[e.jsx("polyline",{points:"3 17 9 11 13 15 21 7"}),e.jsx("polyline",{points:"14 7 21 7 21 14"})]}),na=()=>e.jsxs("svg",{...rn,children:[e.jsx("polyline",{points:"3 7 9 13 13 9 21 17"}),e.jsx("polyline",{points:"14 17 21 17 21 10"})]}),ia=()=>e.jsx("svg",{...rn,children:e.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})});function aa(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 Tn({columns:t,data:a,keyField:s="id",dataSource:r,sortable:o=!0,sortField:u,sortDirection:g,onSort:c,showAdvancedFilter:x,advancedFilter:j,onAdvancedFilterChange:D,filterFields:V,filterPresets:$,onSaveFilterPreset:ae,onDeleteFilterPreset:W,selectable:A,selectedKeys:k,onSelectionChange:_,pagination:f,pageSize:b=10,page:N,onPageChange:U,totalRows:Z,autoPagination:re=!1,stickyHeader:ye=!0,stickyFooter:T=!0,searchable:Y,searchPlaceholder:le,virtualScroll:oe,rowHeight:ge=40,groupBy:B,groupRender:R,onCellEdit:w,editMode:l="inline",formItems:_e,formColumns:De=2,editFormTitle:ue,formProps:I,onRowEdit:Q,onRowAdd:F,onRowDelete:he,bulkActions:pe,onBulkDelete:Te,exportCsv:Ve,exportFilename:Ye="export",detailRow:ke,expandedRowKeys:Ee,onExpandedRowChange:Be,columnReorder:Ge,onColumnReorder:J,columnResize:be,rowDraggable:je,onRowReorder:xe,striped:M,compact:ee,loading:Pe,emptyText:z,toolbar:me,onRowClick:G,pinnedTopKeys:Ie,pinnedBottomKeys:$e,colSpan:te,showStatusBar:Ke,contextMenuItems:Qe,onContextMenuAction:it,printFriendly:Ne,keyboardNavigation:jt,focusedCell:Ft,onFocusedCellChange:mt,cellRangeSelection:Nt,selectedCellRange:E,onCellRangeChange:se,clipboard:de,clipboardFormat:Ze="text",onBeforeCopy:rt,onCopy:we,onPaste:Fe,quickFilters:Se,activeQuickFilters:ct,onQuickFilterChange:qe,columnGroups:wt,stateStorageKey:bt,initialState:cn,onStateChange:Yt,flashRowKeys:Qt,flashDuration:at=500,autoFitColumns:Pn,showColumnStats:Sn,rowIndicator:Jt,frozenRows:ln,className:kt,style:fn,accessMode:m,id:h,displayStyle:L}){const q=O.$c(m,h),ie=q==="hidden",P=q==="readOnly"||q==="disabled",{t:S}=O.Gt();O.rc("table",L),O.ac("table",L);const X=O.Ud(r??null,{autoLoad:!!r,defaultPageSize:b}),H=!!r,Oe=H?X.data:a??[],Re=H?X.loading:Pe,[Ce,et]=n.useState({field:"",dir:null}),[qt,en]=n.useState(1),[nt,Ot]=n.useState(new Set),[St,tn]=n.useState(""),[Zt,Ct]=n.useState({type:"group",logic:"and",items:[]}),[gn,Ut]=n.useState(!1),st=j??Zt,nn=i=>{D?D(i):Ct(i)},Bt=n.useMemo(()=>V??t.filter(i=>i.filterable!==!1&&i.field).map(i=>({field:String(i.field),label:String(i.header??i.field)})),[V,t]),xn=st.items.length,[Mt,Fn]=n.useState(b),[At,_n]=n.useState(null),[on,Gt]=n.useState(null),[lt,Et]=n.useState(null),[dn,Cn]=n.useState(new Set),[Mn,bn]=n.useState(0),vn=n.useRef(null),[On,Un]=n.useState(new Set),un=Ee??On,[Dt,Wt]=n.useState({}),[Vt,Kt]=n.useState(null),[Xt,y]=n.useState(null),[fe,Me]=n.useState(null),[Ae,ot]=n.useState(null),[It,zt]=n.useState([]),[dt,Hn]=n.useState(null),[Di,Yn]=n.useState(new Set),[ds,us]=n.useState(null),Bn=n.useRef(null),[Ii,zi]=n.useState(b);n.useEffect(()=>{if(!re)return;const i=vn.current;if(!i||typeof ResizeObserver>"u")return;const d=()=>{const v=i.clientHeight;if(v<=0)return;const C=Math.max(1,Math.floor(v/ge)-1);zi(ne=>ne===C?ne:C),H&&X.setPageSize(C)};d();const p=new ResizeObserver(d);return p.observe(i),()=>p.disconnect()},[re,ge,H]);const vt=Ft??fe,ht=E??Ae,$t=ct??It;n.useEffect(()=>{if(!bt)return;const i=localStorage.getItem(`nice-datagrid-${bt}`);if(i&&!cn)try{const d=JSON.parse(i);d.columnWidths&&Wt(d.columnWidths),d.expandedGroups&&Cn(new Set(d.expandedGroups))}catch{}},[bt,cn]),n.useEffect(()=>{if(!Qt?.size)return;Yn(new Set(Qt));const i=setTimeout(()=>Yn(new Set),at);return()=>clearTimeout(i)},[Qt,at]),n.useEffect(()=>{if(!Xt)return;const i=()=>y(null);return document.addEventListener("click",i),()=>document.removeEventListener("click",i)},[Xt]);const Ri=n.useCallback((i,d)=>{Qe?.length&&(i.preventDefault(),y({x:i.clientX,y:i.clientY,row:d}))},[Qe]),Qn=n.useCallback(i=>{const d=new Set(un);d.has(i)?d.delete(i):d.add(i),Be?Be(d):Un(d)},[un,Be]),Jn=n.useCallback((i,d)=>{if(!be)return;d.preventDefault();const p=d.clientX,C=d.target.closest("th")?.offsetWidth??100,ne=K=>{const ve=Math.max(40,C+K.clientX-p);Wt(We=>({...We,[i]:ve}))},ce=()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ce)};document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ce)},[be]),Lt=H?X.sort[0]?.field??"":u??Ce.field,yt=H?X.sort[0]?.direction??null:g??Ce.dir,yn=H?X.page:N??qt,tt=k??nt;n.useCallback(()=>{if(!bt)return;const i={columnWidths:Dt,sortField:Lt||void 0,sortDirection:yt,pageSize:Mt,expandedGroups:Array.from(dn)};localStorage.setItem(`nice-datagrid-${bt}`,JSON.stringify(i)),Yt?.(i)},[bt,Dt,Lt,yt,Mt,dn,Yt]);const pt=n.useMemo(()=>t.filter(i=>!i.hidden),[t]),Gn=n.useMemo(()=>pt.filter(i=>i.pinned==="left"),[pt]),Wn=n.useMemo(()=>pt.filter(i=>i.pinned==="right"),[pt]),ei=n.useMemo(()=>pt.filter(i=>!i.pinned),[pt]),Ue=n.useMemo(()=>[...Gn,...ei,...Wn],[Gn,ei,Wn]),Ai=n.useMemo(()=>pt.some(i=>i.aggregate),[pt]),jn=Gn.length>0||Wn.length>0,ti=n.useCallback(i=>{const d=Lt===i?yt==="asc"?"desc":yt==="desc"?null:"asc":"asc";H?d?X.setSortField(i,d):X.setSort([]):c?c(i,d):et({field:i,dir:d})},[Lt,yt,H,X,c]),ft=n.useMemo(()=>{if(H)return Oe;let i=[...Oe];if(St){const d=St.toLowerCase();i=i.filter(p=>pt.some(v=>String(p[v.field]??"").toLowerCase().includes(d)))}return st.items.length>0&&(i=i.filter(d=>O.Cr(d,st))),!c&&Lt&&yt&&i.sort((d,p)=>{const v=d[Lt]??"",C=p[Lt]??"",ne=typeof v=="number"?v-C:String(v).localeCompare(String(C));return yt==="desc"?-ne:ne}),i},[Oe,St,st,pt,Lt,yt,c,H]),Dn=H?X.totalCount:Z??ft.length,an=re?Ii:H?X.pageSize:Mt,Ei=Math.max(1,Math.ceil(Dn/an)),Rt=H?ft:f&&!Z?ft.slice((yn-1)*an,yn*an):ft,In=n.useCallback(i=>{H?X.setPage(i):U?U(i):en(i)},[H,X,U]),mn=n.useMemo(()=>Rt.map(i=>String(i[s])),[Rt,s]),hn=mn.length>0&&mn.every(i=>tt.has(i)),ni=mn.some(i=>tt.has(i)),ii=n.useCallback(()=>{const i=new Set(tt);hn?mn.forEach(d=>i.delete(d)):mn.forEach(d=>i.add(d)),_?_(i):Ot(i)},[hn,mn,tt,_]),ai=n.useCallback(i=>{const d=new Set(tt);d.has(i)?d.delete(i):d.add(i),_?_(d):Ot(d)},[tt,_]),si=({field:i})=>Lt!==i||!yt?e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(ea,{})}):e.jsx("span",{className:"nice-table__sort-icon",children:yt==="asc"?e.jsx(Ji,{}):e.jsx(Nn,{})}),gt=n.useMemo(()=>{if(!B)return Rt.map((p,v)=>({type:"data",row:p,key:String(p[s]??v)}));const i=new Map;Rt.forEach(p=>{const v=p[B];i.has(v)||i.set(v,[]),i.get(v).push(p)});const d=[];return i.forEach((p,v)=>{const C=`__group_${String(v)}`,ne=dn.has(C);d.push({type:"group",value:v,rows:p,expanded:ne,key:C}),ne&&p.forEach((ce,K)=>d.push({type:"data",row:ce,key:String(ce[s]??`${C}_${K}`)}))}),d},[Rt,B,s,dn]),{pinnedTopRows:$i,pinnedBottomRows:Li,normalRows:Ti}=n.useMemo(()=>{if(!Ie?.size&&!$e?.size)return{pinnedTopRows:[],pinnedBottomRows:[],normalRows:gt};const i=[],d=[],p=[];for(const v of gt){if(v.type==="data"){const C=v.key;if(Ie?.has(C)){i.push(v);continue}if($e?.has(C)){d.push(v);continue}}p.push(v)}return{pinnedTopRows:i,pinnedBottomRows:d,normalRows:p}},[gt,Ie,$e]),ri=n.useCallback(i=>{Cn(d=>{const p=new Set(d);return p.has(i)?p.delete(i):p.add(i),p})},[]),Pi=n.useMemo(()=>{if(!oe)return gt;const i=vn.current?.clientHeight??400,d=Math.ceil(i/ge),p=Math.max(0,Math.floor(Mn/ge)-3),v=Math.min(gt.length-1,p+d+6);return gt.slice(p,v+1).map((C,ne)=>({...C,_vIdx:p+ne}))},[oe,gt,Mn,ge]),zn=n.useCallback((i,d,p)=>{!w||P||(_n({rowKey:i,field:d}),Gt(p))},[w]),ci=n.useCallback(()=>{At&&w&&w(At.rowKey,At.field,on),_n(null),Gt(null)},[At,on,w]),Fi=n.useCallback(()=>{_n(null),Gt(null)},[]),Oi=n.useCallback(()=>{const i=pt,d=i.map(K=>wn(K.header)).join(","),p=ft.map(K=>i.map(ve=>wn(String(K[ve.field]??""))).join(",")),v=[d,...p].join(`
|
|
3
|
+
`),C=new Blob(["\uFEFF"+v],{type:"text/csv;charset=utf-8;"}),ne=URL.createObjectURL(C),ce=document.createElement("a");ce.href=ne,ce.download=`${Ye}.csv`,ce.click(),URL.revokeObjectURL(ne)},[pt,ft,Ye]),Rn=n.useCallback(i=>{mt?mt(i):Me(i)},[mt]),An=n.useCallback(i=>{se?se(i):ot(i)},[se]),xt=n.useMemo(()=>gt.filter(i=>i.type==="data").map(i=>i.key),[gt]),Ui=n.useCallback(i=>{if(!jt||At||!vt)return;const d=xt.indexOf(vt.rowKey),p=Ue.findIndex(ce=>ce.field===vt.field);if(d<0||p<0)return;let v=d,C=p;switch(i.key){case"ArrowUp":v=Math.max(0,d-1);break;case"ArrowDown":v=Math.min(xt.length-1,d+1);break;case"ArrowLeft":C=Math.max(0,p-1);break;case"ArrowRight":C=Math.min(Ue.length-1,p+1);break;case"Tab":i.preventDefault(),i.shiftKey?C=Math.max(0,p-1):C=Math.min(Ue.length-1,p+1);break;case"Enter":{const ce=Ue[p];if(ce.editable&&w){const K=Rt.find(ve=>String(ve[s])===vt.rowKey);K&&zn(vt.rowKey,ce.field,K[ce.field])}return}case"Escape":Rn(null),An(null);return;case"Home":i.ctrlKey&&(v=0),C=0;break;case"End":i.ctrlKey&&(v=xt.length-1),C=Ue.length-1;break;case"PageUp":v=Math.max(0,d-Mt);break;case"PageDown":v=Math.min(xt.length-1,d+Mt);break;default:return}i.preventDefault();const ne={rowKey:xt[v],field:Ue[C].field};if(Rn(ne),i.shiftKey&&Nt){const ce=ht?.start??vt;An({start:ce,end:ne})}else An(null)},[jt,At,vt,xt,Ue,Nt,ht,Rn,An,w,Rt,s,zn,Mt]),li=n.useCallback(()=>{let i=[],d=[];if(ht){const p=xt.indexOf(ht.start.rowKey),v=xt.indexOf(ht.end.rowKey),C=Math.min(p,v),ne=Math.max(p,v),ce=Ue.findIndex(Xe=>Xe.field===ht.start.field),K=Ue.findIndex(Xe=>Xe.field===ht.end.field),ve=Math.min(ce,K),We=Math.max(ce,K);d=Ue.slice(ve,We+1).map(Xe=>Xe.field),i=Rt.filter(Xe=>{const Ht=xt.indexOf(String(Xe[s]));return Ht>=C&&Ht<=ne})}else tt.size>0&&(i=Rt.filter(p=>tt.has(String(p[s]))),d=Ue.map(p=>p.field));return{rows:i,fields:d}},[ht,xt,Ue,Rt,s,tt]),oi=n.useCallback((i,d,p)=>{const v=Ue.filter(C=>d.includes(C.field));switch(p){case"json":return JSON.stringify(i.map(C=>Object.fromEntries(d.map(ne=>[ne,C[ne]]))),null,2);case"csv":{const C=v.map(ce=>wn(ce.header)).join(","),ne=i.map(ce=>v.map(K=>wn(String(ce[K.field]??""))).join(",")).join(`
|
|
4
|
+
`);return C+`
|
|
5
|
+
`+ne}case"html":{const C=v.map(ce=>`<th>${ce.header}</th>`).join(""),ne=i.map(ce=>`<tr>${v.map(K=>`<td>${ce[K.field]??""}</td>`).join("")}</tr>`).join("");return`<table><thead><tr>${C}</tr></thead><tbody>${ne}</tbody></table>`}case"markdown":{const C="| "+v.map(K=>K.header).join(" | ")+" |",ne="| "+v.map(()=>"---").join(" | ")+" |",ce=i.map(K=>"| "+v.map(ve=>K[ve.field]??"").join(" | ")+" |").join(`
|
|
6
|
+
`);return C+`
|
|
7
|
+
`+ne+`
|
|
8
|
+
`+ce}default:return i.map(C=>v.map(ne=>C[ne.field]??"").join(" ")).join(`
|
|
9
|
+
`)}},[Ue]),Vn=n.useCallback(async()=>{if(!de)return;const{rows:i,fields:d}=li();if(!i.length||rt?.(i,d)===!1)return;const p=oi(i,d,Ze);await navigator.clipboard.writeText(p),we?.(i,d,Ze)},[de,li,rt,oi,Ze,we]),di=n.useCallback(async()=>{if(!de||!vt||!Fe)return;const d=(await navigator.clipboard.readText()).split(`
|
|
10
|
+
`).map(p=>p.split(" "));Fe(d,vt)},[de,vt,Fe]);n.useEffect(()=>{if(!de||!Bn.current)return;const i=d=>{Bn.current?.contains(document.activeElement)&&(d.type==="copy"&&(d.preventDefault(),Vn()),d.type==="paste"&&(d.preventDefault(),di()))};return document.addEventListener("copy",i),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",i)}},[de,Vn,di]);const Bi=n.useCallback(i=>{const d=$t.includes(i)?$t.filter(p=>p!==i):[...$t,i];qe?qe(d):zt(d)},[$t,qe]),Gi=n.useMemo(()=>{if(!Se?.length||!$t.length)return ft;const i=Se.filter(d=>$t.includes(d.key));return ft.filter(d=>i.every(p=>p.filter(d)))},[ft,Se,$t]),ui=Se?.length?Gi:ft;n.useCallback(i=>{const d=ft.map(ve=>ve[i]).filter(ve=>ve!=null),p=d.filter(ve=>typeof ve=="number");if(p.length===0){const ve=new Set(d).size;return{count:d.length,unique:ve,type:"text"}}const v=p.reduce((ve,We)=>ve+We,0),C=v/p.length,ne=Math.min(...p),ce=Math.max(...p),K=Math.sqrt(p.reduce((ve,We)=>ve+(We-C)**2,0)/p.length);return{count:p.length,sum:v,avg:C,min:ne,max:ce,stdDev:K,type:"numeric"}},[ft]);const Wi=n.useCallback((i,d,p)=>{if(!i.cellVisualization)return null;const v=Number(d);if(isNaN(v))return null;const C=i.visualMin??0,ne=i.visualMax??100,ce=Math.max(0,Math.min(100,(v-C)/(ne-C)*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:`${ce}%`,height:"100%",background:ce>80?"var(--color-success)":ce>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(ce),"%"]})]});case"rating":{const K=Math.round(v/ne*5);return e.jsx("div",{className:"nice-datagrid__cell-rating",children:[1,2,3,4,5].map(ve=>e.jsx("span",{style:{color:ve<=K?"var(--color-warning)":"var(--text-muted)",fontSize:"0.95rem",lineHeight:1},"aria-hidden":"true",children:e.jsx(O.oa,{name:"star",size:14})},ve))})}case"trend":{const K=i.visualMin??v,ve=v-K,We=ve>0?ta:ve<0?na:ia,Xe=ve>0?"var(--color-success)":ve<0?"var(--color-danger)":"var(--text-muted)";return e.jsxs("span",{style:{color:Xe,fontWeight:500,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(We,{})," ",Math.abs(ve).toFixed(1),"%"]})}case"heatmap":{const K=ce/100,ve=`rgba(${Math.round(255*K)}, ${Math.round(100*(1-K))}, ${Math.round(50*(1-K))}, 0.6)`;return e.jsx("span",{style:{background:ve,padding:"2px 8px",borderRadius:4},children:v})}default:return null}},[]),Vi=n.useCallback((i,d,p)=>{if(!i.conditionalFormats?.length)return{};for(const v of i.conditionalFormats)if(v.when(d,p,i.field))return{className:v.className,style:{...v.style,backgroundColor:v.backgroundColor,color:v.color}};return{}},[]),Kn=n.useCallback((i,d)=>{if(!jn||!i.pinned)return{};const p={position:"sticky",zIndex:2,background:"var(--bg-primary, #fff)"};if(i.pinned==="left"){let v=0;for(let C=0;C<d;C++){const ne=Ue[C];ne.pinned==="left"&&(v+=typeof ne.width=="number"?ne.width:parseInt(String(ne.width)||"100",10))}A&&d===0&&(v=36),p.left=v}else{let v=0;for(let C=Ue.length-1;C>d;C--){const ne=Ue[C];ne.pinned==="right"&&(v+=typeof ne.width=="number"?ne.width:parseInt(String(ne.width)||"100",10))}p.right=v}return p},[jn,Ue,A]),mi=(i,d,p,v)=>{if(At?.rowKey===p&&At?.field===i.field)return i.editor?i.editor(on,d,K=>Gt(K)):e.jsx("input",{className:"nice-datagrid__edit-input",autoFocus:!0,value:on??"",onChange:K=>Gt(K.target.value),onBlur:ci,onKeyDown:K=>{K.key==="Enter"&&ci(),K.key==="Escape"&&Fi()}});const ne=Wi(i,d[i.field],d);return ne||(i.render?i.render(d[i.field],d,v):aa(d[i.field]))},Ki=(i,d,p,v)=>{const C=vt?.rowKey===p&&vt?.field===i.field,ne=ht&&(()=>{const ve=xt.indexOf(ht.start.rowKey),We=xt.indexOf(ht.end.rowKey),Xe=xt.indexOf(p),Ht=Ue.findIndex(pn=>pn.field===ht.start.field),sn=Ue.findIndex(pn=>pn.field===ht.end.field);return Xe>=Math.min(ve,We)&&Xe<=Math.max(ve,We)&&v>=Math.min(Ht,sn)&&v<=Math.max(Ht,sn)})(),ce=Vi(i,d[i.field],d);return{className:[ce.className,C&&"nice-datagrid__cell--focused",ne&&"nice-datagrid__cell--in-range"].filter(Boolean).join(" "),style:{...Kn(i,v),textAlign:i.align,...ce.style,...C?{outline:"2px solid var(--color-primary)",outlineOffset:-2}:{},...ne?{background:"var(--color-primary-light, rgba(59,130,246,0.15))"}:{}}}},En=Ue.length+(A?1:0)+(ke?1:0)+(je?1:0)+(Jt?1:0),qn=(i,d,p)=>{const{row:v,key:C}=i,ne=tt.has(C),ce=un.has(C),K=Di.has(C),ve=[ne&&"nice-datagrid__row--selected",Vt===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:ve,onClick:()=>G?.(v),onDoubleClick:l==="popup"&&(Q||w)?()=>Et({key:C,data:{...v}}):void 0,onContextMenu:We=>Ri(We,v),style:G||l==="popup"?{cursor:"pointer"}:void 0,draggable:je,onDragStart:je?()=>Kt(d):void 0,onDragOver:je?We=>We.preventDefault():void 0,onDrop:je&&xe&&Vt!=null?()=>{xe(Vt,d),Kt(null)}:void 0,onDragEnd:je?()=>Kt(null):void 0,children:[Jt&&e.jsx("td",{className:"nice-datagrid__row-indicator",style:{width:32,padding:"0 4px"},children:Jt(v)}),ke&&e.jsx("td",{className:"nice-datagrid__expand-col",onClick:We=>{We.stopPropagation(),Qn(C)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":ce,children:ce?e.jsx(Nn,{}):e.jsx($n,{})})}),je&&e.jsx("td",{className:"nice-datagrid__drag-handle",style:{cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),A&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:We=>We.stopPropagation(),style:jn?{position:"sticky",left:0,zIndex:1,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:ne,onChange:()=>ai(C),"aria-label":`Select row ${C}`})}),(()=>{let We=0;return Ue.map((Xe,Ht)=>{if(We>0)return We--,null;const sn=te?te(v,Xe,Ht):void 0;sn&&sn>1&&(We=sn-1);const pn=Ki(Xe,v,C,Ht);return e.jsx("td",{colSpan:sn,className:pn.className,style:pn.style,onClick:jt?()=>Rn({rowKey:C,field:Xe.field}):void 0,onDoubleClick:Xe.editable&&w?()=>zn(C,Xe.field,v[Xe.field]):void 0,children:mi(Xe,v,C,d)},Xe.field)})})()]}),ke&&ce&&e.jsx("tr",{className:"nice-datagrid__detail-row",children:e.jsx("td",{colSpan:En,children:ke(v)})})]},C)};return ie?null:e.jsxs("div",{ref:Bn,className:`nice-datagrid ${Ne?"nice-datagrid--print":""} ${ye?"nice-datagrid--sticky-header":""} ${T?"nice-datagrid--sticky-footer":""} ${re?"nice-datagrid--auto-pagination":""} ${kt||""}`,style:fn,role:"grid","aria-label":S("datagrid.title","Data Grid"),"aria-rowcount":gt.length,"aria-colcount":pt.length,"aria-busy":Re||void 0,tabIndex:jt?0:void 0,onKeyDown:jt?Ui:void 0,children:[(Y||me||Ve||Se?.length||F||x)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[Y&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:H?X.search:St,"aria-label":S("controls.search","Search"),onChange:i=>{H?X.setSearch(i.target.value):(tn(i.target.value),In(1))},placeholder:le||S("controls.search","Search...")})}),x&&e.jsxs("button",{type:"button",className:`nice-datagrid__filter-toggle ${xn>0?"nice-datagrid__filter-toggle--active":""}`,"aria-expanded":gn,onClick:()=>Ut(i=>!i),children:[S("controls.filter","Filter"),xn>0?` (${xn})`:""]}),Se&&Se.length>0&&e.jsx("div",{className:"nice-datagrid__quick-filters",style:{display:"flex",gap:6,flexWrap:"wrap"},children:Se.map(i=>e.jsxs("button",{className:`nice-datagrid__quick-filter ${$t.includes(i.key)?"nice-datagrid__quick-filter--active":""}`,onClick:()=>Bi(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))}),de&&e.jsx("button",{className:"nice-btn nice-btn--sm nice-btn--ghost",onClick:Vn,title:S("controls.copy","Copy selected"),style:{marginLeft:4},children:"??"}),Ve&&e.jsx("button",{className:"nice-btn nice-btn--sm",onClick:Oi,title:S("controls.exportCsv","Export CSV"),children:"CSV ?"}),F&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--primary",onClick:()=>Et({key:null,data:{}}),title:S("datagrid.addRow","Add row"),children:["+ ",S("datagrid.add","Add")]}),me]}),x&&gn&&e.jsx("div",{className:"nice-datagrid__filter-panel",style:{padding:"8px 12px",borderBottom:"1px solid var(--border-color)"},children:e.jsx(Xn,{fields:Bt,value:st,onChange:i=>{nn(i),In(1)},presets:$,onSavePreset:ae,onDeletePreset:W})}),A&&tt.size>0&&(pe?.length||Te)&&e.jsxs("div",{className:"nice-datagrid__bulk-toolbar",role:"toolbar","aria-label":S("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:S("datagrid.selectedCount","{count} selected").replace("{count}",String(tt.size))}),(pe||[]).map(i=>{const d=Array.from(tt),p=ui.filter(C=>tt.has(String(C[s]))),v=i.disabled?.(d,p)||!1;return e.jsxs("button",{type:"button",className:`nice-btn nice-btn--sm nice-btn--${i.variant||"secondary"}`,disabled:v,onClick:()=>i.onClick(d,p),children:[i.icon,i.icon&&" ",i.label]},i.key)}),Te&&!pe?.length&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--danger",onClick:()=>{const i=Array.from(tt),d=ui.filter(p=>tt.has(String(p[s])));Te(i,d)},children:["?? ",S("datagrid.deleteSelected","Delete selected")]}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--xs nice-btn--ghost",onClick:()=>{const i=new Set;k===void 0&&Ot(i),_?.(i)},style:{marginLeft:"auto"},children:S("datagrid.clearSelection","Clear")})]}),e.jsxs("div",{ref:vn,className:`nice-datagrid__table-wrap ${oe?"nice-datagrid__table-wrap--virtual":""}`,style:oe?{maxHeight:Math.min(gt.length*ge,600),overflowY:"auto"}:void 0,onScroll:oe?i=>bn(i.currentTarget.scrollTop):void 0,children:[oe&&e.jsxs("div",{style:{height:gt.length*ge,position:"relative"},children:[e.jsx("table",{className:`${M?"nice-table--striped":""} ${ee?"nice-table--compact":""}`,style:{position:"sticky",top:0,zIndex:3},children:e.jsx("thead",{children:e.jsxs("tr",{children:[ke&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),je&&e.jsx("th",{style:{width:28}}),A&&e.jsx("th",{className:"nice-datagrid__checkbox",style:jn?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:hn,ref:i=>{i&&(i.indeterminate=ni&&!hn)},onChange:ii,"aria-label":S("controls.selectAll","Select all")})}),Ue.map((i,d)=>e.jsxs("th",{style:{width:Dt[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Kn(i,d)},className:o&&i.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>o&&i.sortable!==!1&&ti(i.field),children:[i.header,o&&i.sortable!==!1&&e.jsx(si,{field:i.field}),be&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:p=>{p.stopPropagation(),Jn(i.field,p)}})]},i.field))]})})}),Pi.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*ge,height:ge,left:0,right:0},onClick:()=>ri(K.key),children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:K.expanded?e.jsx(Nn,{}):e.jsx($n,{})}),R?R(K.value,K.rows):e.jsxs(e.Fragment,{children:[String(K.value)," (",K.rows.length,")"]})]},K.key)}const{row:v,key:C}=i,ne=tt.has(C),ce=un.has(C);return e.jsxs(n.Fragment,{children:[e.jsxs("div",{className:`nice-datagrid__vrow ${ne?"nice-datagrid__row--selected":""} ${Vt===d?"nice-datagrid__row--dragging":""}`,style:{position:"absolute",top:p*ge,height:ge,left:0,right:0,display:"flex",alignItems:"center"},onClick:()=>G?.(v),onDoubleClick:l==="popup"&&(Q||w)?()=>Et({key:C,data:{...v}}):void 0,draggable:je,onDragStart:je?()=>Kt(d):void 0,onDragOver:je?K=>K.preventDefault():void 0,onDrop:je&&xe&&Vt!=null?()=>{xe(Vt,d),Kt(null)}:void 0,onDragEnd:je?()=>Kt(null):void 0,children:[ke&&e.jsx("div",{className:"nice-datagrid__expand-col",style:{width:36,flexShrink:0,textAlign:"center",cursor:"pointer"},onClick:K=>{K.stopPropagation(),Qn(C)},children:e.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":ce,children:ce?e.jsx(Nn,{}):e.jsx($n,{})})}),je&&e.jsx("div",{style:{width:28,flexShrink:0,cursor:"grab",textAlign:"center",color:"var(--text-muted)"},children:"?"}),A&&e.jsx("div",{className:"nice-datagrid__checkbox",style:{width:36,flexShrink:0},onClick:K=>K.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:ne,onChange:()=>ai(C)})}),Ue.map(K=>e.jsx("div",{className:"nice-datagrid__vcell",style:{width:Dt[K.field]||K.width||"auto",flex:Dt[K.field]||K.width?`0 0 ${typeof(Dt[K.field]||K.width)=="number"?(Dt[K.field]||K.width)+"px":Dt[K.field]||K.width}`:1,textAlign:K.align,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"0 8px"},onDoubleClick:K.editable&&w?()=>zn(C,K.field,v[K.field]):void 0,children:mi(K,v,C,p)},K.field))]}),ke&&ce&&e.jsx("div",{className:"nice-datagrid__detail-row",style:{position:"absolute",top:(p+1)*ge,left:0,right:0,padding:"8px 12px",background:"var(--bg-secondary, #f8f8f8)"},children:ke(v)})]},C)})]}),!oe&&e.jsxs("table",{className:`${M?"nice-table--striped":""} ${ee?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[ke&&e.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),je&&e.jsx("th",{style:{width:28}}),A&&e.jsx("th",{className:"nice-datagrid__checkbox",style:jn?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:e.jsx("input",{type:"checkbox",checked:hn,ref:i=>{i&&(i.indeterminate=ni&&!hn)},onChange:ii,"aria-label":S("controls.selectAll","Select all")})}),Ue.map((i,d)=>{const p=o&&i.sortable!==!1,v=p?Lt===i.field?yt==="asc"?"ascending":yt==="desc"?"descending":"none":"none":void 0;return e.jsxs("th",{style:{width:Dt[i.field]||i.width,minWidth:i.minWidth,textAlign:i.align,position:"relative",...Kn(i,d)},className:p?"nice-datagrid__th--sortable":void 0,onClick:()=>p&&ti(i.field),"aria-sort":v,scope:"col",children:[i.header,p&&e.jsx(si,{field:i.field}),be&&e.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:C=>{C.stopPropagation(),Jn(i.field,C)}})]},i.field)})]})}),e.jsx("tbody",{children:Re?e.jsx("tr",{children:e.jsx("td",{colSpan:En,className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):gt.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:En,className:"nice-datagrid__empty",children:z||S("controls.noData","No data available")})}):e.jsxs(e.Fragment,{children:[$i.map((i,d)=>i.type==="data"&&qn(i,d,"top")),Ti.map((i,d)=>{if(i.type==="group"){const p=i;return e.jsx("tr",{className:"nice-datagrid__group-row",onClick:()=>ri(p.key),children:e.jsxs("td",{colSpan:En,className:"nice-datagrid__group-cell",children:[e.jsx("span",{className:"nice-datagrid__group-toggle",children:p.expanded?e.jsx(Nn,{}):e.jsx($n,{})}),R?R(p.value,p.rows):e.jsxs(e.Fragment,{children:[String(p.value)," (",p.rows.length,")"]})]})},p.key)}return qn(i,d)}),Li.map((i,d)=>i.type==="data"&&qn(i,d,"bottom"))]})}),Ai&&!Re&&Rt.length>0&&e.jsx("tfoot",{children:e.jsxs("tr",{className:"nice-datagrid__aggregate-row",children:[A&&e.jsx("td",{}),Ue.map(i=>e.jsx("td",{style:{textAlign:i.align,fontWeight:600},children:i.aggregate?(i.aggregateLabel||i.aggregate.toUpperCase())+": "+yi(ft,i.field,i.aggregate):""},i.field))]})})]})]}),f&&e.jsxs("div",{className:"nice-datagrid__footer",children:[e.jsxs("span",{className:"nice-datagrid__footer-info",children:[S("controls.showing","Showing")," ",(yn-1)*an+1,"–",Math.min(yn*an,Dn)," ",S("controls.of","of")," ",Dn,re&&e.jsxs("span",{className:"nice-datagrid__page-size-label",children:[" · ",an," ",S("controls.perPage","/ page")]})]}),e.jsx(qi.NicePagination,{page:yn,totalPages:Ei,onChange:In,showInfo:!0,pageSize:an,showPageSize:!re,pageSizeOptions:[5,10,25,50,100],onPageSizeChange:i=>{H?X.setPageSize(i):(Fn(i),In(1))},showFirstLast:!0})]}),Ke&&!Re&&e.jsxs("div",{className:"nice-datagrid__status-bar",children:[e.jsxs("span",{children:[S("controls.totalRows","Total rows"),": ",Dn]}),A&&tt.size>0&&e.jsxs("span",{children:[S("controls.selected","Selected"),": ",tt.size]})]}),Xt&&Qe&&e.jsx("div",{className:"nice-datagrid__context-menu",style:{position:"fixed",left:Xt.x,top:Xt.y,zIndex:9999},onClick:i=>i.stopPropagation(),children:Qe.map(i=>e.jsxs("button",{className:"nice-datagrid__context-item",disabled:i.disabled,onClick:()=>{it?.(i.key,Xt.row),y(null)},children:[i.icon&&e.jsx("span",{className:"nice-datagrid__context-icon",children:i.icon}),i.label]},i.key))}),(l==="popup"||F)&<&&(()=>{const i=lt.key===null,d=_e??t.filter(p=>!p.hidden&&p.field!==s).map(p=>{let v="text";return p.dataType==="number"||p.dataType==="currency"||p.dataType==="percent"?v="number":p.dataType==="boolean"?v="checkbox":p.dataType==="date"&&(v="date"),{field:p.field,label:p.header,type:v,required:p.validation?.required}});return e.jsx(_i.NiceModal,{open:!0,onClose:()=>Et(null),title:ue??(i?S("datagrid.addRow","Add row"):S("datagrid.editRow","Edit row")),size:"lg",children:e.jsx(xi.NiceForm,{items:d,data:lt.data,columns:De,showActions:!0,submitLabel:i?S("controls.add","Add"):S("controls.save","Save"),cancelLabel:S("controls.cancel","Cancel"),onCancel:()=>Et(null),...I,onFieldChange:(p,v)=>Et(C=>C&&{...C,data:{...C.data,[p]:v}}),onSubmit:p=>{i?F?.(p):lt.key&&(Q?Q(lt.key,p):w&&Object.keys(p).forEach(v=>{w(lt.key,v,p[v])})),Et(null)}})})})()]})}Tn.displayName="NiceDataGrid";const sa=Object.freeze(Object.defineProperty({__proto__:null,NiceDataGrid:Tn},Symbol.toStringTag,{value:"Module"}));function ra(t,a){return t.filter(s=>a.every(r=>{const o=s[r.field],u=r.value;switch(r.operator){case"eq":return o===u;case"ne":return o!==u;case"gt":return typeof o=="number"&&typeof u=="number"&&o>u;case"gte":return typeof o=="number"&&typeof u=="number"&&o>=u;case"lt":return typeof o=="number"&&typeof u=="number"&&o<u;case"lte":return typeof o=="number"&&typeof u=="number"&&o<=u;case"contains":return String(o).toLowerCase().includes(String(u).toLowerCase());case"startsWith":return String(o).toLowerCase().startsWith(String(u).toLowerCase());case"endsWith":return String(o).toLowerCase().endsWith(String(u).toLowerCase());default:return!0}}))}function ca(t){return t.map(a=>({field:a.field,type:a.dataType||"string",label:typeof a.header=="string"?a.header:a.field}))}function la(t,a){const{enableAI:s=!0,aiModel:r,enableNLSearch:o=!0,enableInsights:u=!0,nlPlaceholder:g,onAIFilter:c,onInsights:x,showAISearchBar:j=!0,exampleQueries:D=["Show items from last week","Filter by status = active","Orders over $1000",'Names starting with "A"'],columns:V,data:$,...ae}=t,[W,A]=n.useState(""),[k,_]=n.useState([]),[f,b]=n.useState([]),[N,U]=n.useState(!1),[Z,re]=n.useState(null),ye=n.useRef(null),{t:T}=O.Gt(),Y=O.he(),{parseFilter:le,isLoading:oe}=O.wd(),ge=s&&Y.isConfigured,B=k.length>0?ra($||[],k):$,R=n.useCallback(async I=>{if(!ge||!o||!I.trim())return;re(I);const Q=ca(V);try{const F=await le(I,Q);_(F),c?.(I,F)}catch{_([])}},[ge,o,V,le,c]),w=n.useCallback(()=>{_([]),re(null),A("")},[]),l=n.useCallback(()=>k,[k]),_e=n.useCallback(async()=>{if(!ge||!u||!$?.length)return[];try{const I=await Y.complete([{role:"user",content:`Analyze this data and provide 3-5 key insights. Data sample (${$.length} total rows): ${JSON.stringify($.slice(0,20))}
|
|
11
|
+
|
|
12
|
+
Columns: ${V.map(Q=>Q.field).join(", ")}
|
|
13
|
+
|
|
14
|
+
Return a JSON array of insight strings. Be specific with numbers and trends.`}],{temperature:.3,maxTokens:500});try{const Q=JSON.parse(I.content),F=Array.isArray(Q)?Q:[];return b(F),x?.(F),F}catch{return[]}}catch{return[]}},[ge,u,$,V,Y,x]),De=I=>{I.preventDefault(),W.trim()&&R(W)},ue=I=>{A(I),R(I)};return n.useImperativeHandle(a,()=>({applyNLFilter:R,clearAIFilters:w,getAIFilters:l,generateInsights:_e})),e.jsxs("div",{className:"nice-data-grid-ai","data-testid":t["data-testid"],children:[j&&ge&&o&&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:De,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(O.oa,{name:"search",size:14})}),e.jsx("input",{ref:ye,type:"text",value:W,onChange:I=>A(I.target.value),placeholder:g||T("dataGridAI.searchPlaceholder","Search with natural language..."),className:"nice-data-grid-ai__input",disabled:oe}),oe&&e.jsx("span",{className:"nice-data-grid-ai__loading-spinner"}),W&&!oe&&e.jsx("button",{type:"button",className:"nice-data-grid-ai__clear-input",onClick:()=>A(""),"aria-label":T("dataGridAI.clearInput","Clear"),children:e.jsx(O.oa,{name:"close",size:14})})]}),e.jsx("button",{type:"submit",className:"nice-data-grid-ai__search-btn",disabled:oe||!W.trim(),children:oe?T("dataGridAI.searching","Searching..."):T("dataGridAI.search","Search")})]}),u&&e.jsxs("button",{type:"button",className:"nice-data-grid-ai__insights-btn",onClick:()=>{_e(),U(!0)},disabled:oe||!$?.length,title:T("dataGridAI.generateInsights","Generate AI Insights"),children:[e.jsx(O.oa,{name:"lightbulb",size:14})," ",T("dataGridAI.insights","Insights")]})]}),j&&ge&&o&&!Z&&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,Q)=>e.jsxs("button",{type:"button",className:"nice-data-grid-ai__example",onClick:()=>ue(I),children:['"',I,'"']},Q))})]}),Z&&k.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.jsx(O.oa,{name:"target",size:14})}),e.jsxs("span",{className:"nice-data-grid-ai__filter-query",children:['"',Z,'"']}),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:k.map((I,Q)=>e.jsxs("span",{className:"nice-data-grid-ai__filter-badge",children:[I.field," ",I.operator," ",String(I.value)]},Q))}),e.jsxs("button",{type:"button",className:"nice-data-grid-ai__clear-filter",onClick:w,children:[e.jsx(O.oa,{name:"close",size:14})," ",T("dataGridAI.clearFilter","Clear")]})]}),e.jsx("div",{className:"nice-data-grid-ai__grid-wrapper",children:e.jsx(Tn,{columns:V,data:B,...ae})}),N&&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:[e.jsx(O.oa,{name:"lightbulb",size:14})," ",T("dataGridAI.aiInsights","AI Insights")]}),e.jsx("button",{type:"button",className:"nice-data-grid-ai__insights-close",onClick:()=>U(!1),"aria-label":T("dataGridAI.closeInsights","Close"),children:e.jsx(O.oa,{name:"close",size:14})})]}),e.jsx("div",{className:"nice-data-grid-ai__insights-body",children:oe?e.jsx("div",{className:"nice-data-grid-ai__insights-loading",children:T("dataGridAI.analyzing","Analyzing data...")}):f.length>0?e.jsx("ul",{className:"nice-data-grid-ai__insights-list",children:f.map((I,Q)=>e.jsxs("li",{className:"nice-data-grid-ai__insight",children:[e.jsx("span",{className:"nice-data-grid-ai__insight-bullet",children:"•"}),I]},Q))}):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:()=>_e(),disabled:oe,children:[e.jsx(O.oa,{name:"refresh",size:14})," ",T("dataGridAI.refresh","Refresh")]})})]})]})}const oa=n.forwardRef(la),da=({items:t,selectedKeys:a=[],onSelectionChange:s,selectionMode:r="none",searchable:o,searchPlaceholder:u,grouped:g,groupField:c="group",reorderable:x,onReorder:j,onItemClick:D,renderItem:V,showCheckboxes:$,loading:ae,emptyText:W,size:A="md",bordered:k=!0,swipeActions:_,className:f,style:b,accessMode:N,id:U})=>{const re=O.$c(N,U)==="hidden",{t:ye}=O.Gt(),[T,Y]=n.useState(""),[le,oe]=n.useState(null),[ge,B]=n.useState(null),R=n.useRef(null),w=n.useMemo(()=>{if(!T)return t;const I=T.toLowerCase();return t.filter(Q=>Q.text.toLowerCase().includes(I))},[t,T]),l=n.useMemo(()=>{if(!g)return null;const I=new Map;return w.forEach(Q=>{const F=String(Q[c]??"");I.has(F)||I.set(F,[]),I.get(F).push(Q)}),I},[w,g,c]),_e=n.useCallback(I=>{s&&(r==="single"?s(a.includes(I)?[]:[I]):r==="multiple"&&s(a.includes(I)?a.filter(Q=>Q!==I):[...a,I]))},[a,r,s]),De=n.useCallback(I=>{le!==null&&le!==I&&j&&j(le,I),oe(null)},[le,j]),ue=(I,Q)=>{const F=a.includes(I.key),he=ge===I.key;return e.jsxs("li",{className:`nice-list__item ${F?"nice-list__item--selected":""} ${I.disabled?"nice-list__item--disabled":""} ${he?"nice-list__item--swiped":""}`,onClick:()=>{I.disabled||(_e(I.key),D?.(I))},draggable:x,onDragStart:()=>oe(Q),onDragOver:pe=>pe.preventDefault(),onDrop:()=>De(Q),onTouchStart:_?.length?pe=>{R.current={x:pe.touches[0].clientX,key:I.key}}:void 0,onTouchEnd:_?.length?pe=>{if(!R.current)return;const Te=pe.changedTouches[0].clientX-R.current.x;Te<-50&&R.current.key===I.key?B(I.key):Te>50&&B(null),R.current=null}:void 0,role:r!=="none"?"option":void 0,"aria-selected":r!=="none"?F:void 0,children:[e.jsxs("div",{className:"nice-list__item-content",children:[$&&r!=="none"&&e.jsx("input",{type:"checkbox",checked:F,readOnly:!0,tabIndex:-1,className:"nice-list__checkbox"}),V?V(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})]})]}),_&&he&&e.jsx("div",{className:"nice-list__swipe-actions",children:_.map(pe=>e.jsx("button",{className:"nice-list__swipe-btn",style:pe.color?{backgroundColor:pe.color}:void 0,onClick:Te=>{Te.stopPropagation(),pe.onClick(I),B(null)},children:pe.label},pe.key))})]},I.key)};return re?null:e.jsxs("div",{className:`nice-list nice-list--${A} ${k?"nice-list--bordered":""} ${f||""}`,style:b,children:[o&&e.jsx("div",{className:"nice-list__search",children:e.jsx("input",{type:"text",value:T,onChange:I=>Y(I.target.value),placeholder:u||ye("controls.search","Search...")})}),ae?e.jsx("div",{className:"nice-list__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--sm"})}):w.length===0?e.jsx("div",{className:"nice-list__empty",children:W||ye("controls.noData","No data available")}):l?e.jsx("div",{role:"listbox",children:Array.from(l.entries()).map(([I,Q])=>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:Q.map((F,he)=>ue(F,he))})]},I))}):e.jsx("ul",{className:"nice-list__items",role:"listbox",children:w.map((I,Q)=>ue(I,Q))})]})};function ua(t,a,s){const r=new Map,o=[];return t.forEach(u=>{const g={...u,children:[]};r.set(String(g[a]),g)}),t.forEach(u=>{const g=u[s];g!=null&&r.has(String(g))?r.get(String(g)).children.push(r.get(String(u[a]))):o.push(r.get(String(u[a])))}),o}function ma({columns:t,data:a,keyField:s="key",parentKeyField:r="parentKey",expandedKeys:o,onExpandedChange:u,selectedKeys:g=[],onSelectionChange:c,selectable:x,loading:j,emptyText:D,className:V,style:$,accessMode:ae,id:W}){const k=O.$c(ae,W)==="hidden",{t:_}=O.Gt(),[f,b]=n.useState([]),N=o??f,U=n.useMemo(()=>ua(a,s,r),[a,s,r]),Z=n.useMemo(()=>t.filter(Y=>!Y.hidden),[t]),re=n.useCallback(Y=>{const le=N.includes(Y)?N.filter(oe=>oe!==Y):[...N,Y];u?u(le):b(le)},[N,u]),ye=n.useCallback(Y=>{c&&c(g.includes(Y)?g.filter(le=>le!==Y):[...g,Y])},[g,c]),T=(Y,le)=>{const oe=String(Y[s]),ge=Y.children&&Y.children.length>0,B=N.includes(oe),R=g.includes(oe);return e.jsxs(n.Fragment,{children:[e.jsxs("tr",{className:R?"nice-treelist__row--selected":"",children:[x&&e.jsx("td",{className:"nice-treelist__checkbox",children:e.jsx("input",{type:"checkbox",checked:R,onChange:()=>ye(oe)})}),Z.map((w,l)=>e.jsxs("td",{style:{textAlign:w.align},children:[l===0&&e.jsx("span",{style:{display:"inline-block",width:le*20}}),l===0&&e.jsx("span",{className:"nice-treelist__toggle",onClick:()=>ge&&re(oe),style:{cursor:ge?"pointer":"default",width:20,display:"inline-block"},children:ge?e.jsx(O.oa,{name:B?"chevron-down":"chevron-right",size:12}):""}),w.render?w.render(Y[w.field],Y,0):String(Y[w.field]??"")]},w.field))]}),ge&&B&&Y.children.map(w=>T(w,le+1))]},oe)};return k?null:e.jsx("div",{className:`nice-treelist ${V||""}`,style:$,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[x&&e.jsx("th",{className:"nice-treelist__checkbox"}),Z.map(Y=>e.jsx("th",{style:{width:Y.width,minWidth:Y.minWidth,textAlign:Y.align},children:Y.header},Y.field))]})}),e.jsx("tbody",{children:j?e.jsx("tr",{children:e.jsx("td",{colSpan:Z.length+(x?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:Z.length+(x?1:0),className:"nice-treelist__empty",children:D||_("controls.noData","No data available")})}):U.map(Y=>T(Y,0))})]})})}function ha({items:t,renderCard:a,columns:s=3,gap:r=16,searchable:o,searchField:u="text",searchPlaceholder:g,loading:c,emptyText:x,onCardClick:j,className:D,style:V,accessMode:$,id:ae}){const A=O.$c($,ae)==="hidden",{t:k}=O.Gt(),[_,f]=n.useState(""),b=n.useMemo(()=>{if(!_)return t;const N=_.toLowerCase();return t.filter(U=>String(U[u]??"").toLowerCase().includes(N))},[t,_,u]);return A?null:e.jsxs("div",{className:`nice-cardview ${D||""}`,style:V,children:[o&&e.jsx("div",{className:"nice-cardview__search",children:e.jsx("input",{type:"text",value:_,onChange:N=>f(N.target.value),placeholder:g||k("controls.search","Search...")})}),c?e.jsx("div",{className:"nice-cardview__loading",children:e.jsx("div",{className:"nice-spinner nice-spinner--md"})}):b.length===0?e.jsx("div",{className:"nice-cardview__empty",children:x||k("controls.noData","No data available")}):e.jsx("div",{className:"nice-cardview__grid",style:{display:"grid",gridTemplateColumns:`repeat(${s}, 1fr)`,gap:r},children:b.map(N=>e.jsx("div",{className:"nice-cardview__card",onClick:()=>j?.(N),style:j?{cursor:"pointer"}:void 0,children:a(N)},N.key))})]})}function pa({items:t,tileWidth:a=180,tileHeight:s=180,direction:r="horizontal",renderTile:o,onTileClick:u,loading:g,emptyText:c,className:x,style:j}){const{t:D}=O.Gt();return e.jsx("div",{className:`nice-tileview nice-tileview--${r} ${x||""}`,style:j,children:g?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(V=>e.jsx("div",{className:"nice-tileview__tile",style:{width:a,height:s,cursor:u?"pointer":void 0},onClick:()=>u?.(V),children:o?o(V):e.jsxs(e.Fragment,{children:[V.image&&e.jsx("img",{src:V.image,alt:V.text||"",className:"nice-tileview__image"}),V.text&&e.jsx("div",{className:"nice-tileview__label",children:V.text})]})},V.key))})})}const hi=[{key:"row",label:"Rows"},{key:"column",label:"Columns"},{key:"data",label:"Values"},{key:"filter",label:"Filters"}],ji=({fields:t,onChange:a,className:s,style:r})=>{const o=t.filter(c=>!c.area),u=(c,x)=>{a(t.map(j=>j.field===c?{...j,area:x}:j))},g=c=>{a(t.map(x=>x.field===c?{...x,area:void 0}:x))};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:o.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:hi.map(x=>e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>u(c.field,x.key),children:x.label},x.key))})]},c.field))})]}),hi.map(c=>{const x=t.filter(j=>j.area===c.key);return e.jsxs("div",{className:"nice-field-chooser__section",children:[e.jsx("h4",{children:c.label}),e.jsx("ul",{children:x.map(j=>e.jsxs("li",{className:"nice-field-chooser__item",children:[e.jsx("span",{children:j.caption}),e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--sm",onClick:()=>g(j.field),"aria-label":`Remove ${j.caption}`,children:e.jsx(O.oa,{name:"close",size:14})})]},j.field))})]},c.key)})]})})};function fa(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 pi(t,a){return[...new Set(t.map(s=>String(s[a]??"")))].sort()}const Ni=({data:t,fields:a,onFieldsChange:s,showFieldChooser:r,loading:o,emptyText:u,exportCsv:g,exportFilename:c="pivot-export",onDrillThrough:x,className:j,style:D,accessMode:V,id:$})=>{const W=O.$c(V,$)==="hidden",{t:A}=O.Gt(),[k,_]=n.useState(a),[f,b]=n.useState(!1),N=n.useMemo(()=>k.filter(B=>B.area==="row"),[k]),U=n.useMemo(()=>k.filter(B=>B.area==="column"),[k]),Z=n.useMemo(()=>k.filter(B=>B.area==="data"),[k]),re=n.useMemo(()=>N.length===0?["Total"]:pi(t,N[0].field),[t,N]),ye=n.useMemo(()=>U.length===0?["Total"]:pi(t,U[0].field),[t,U]),T=n.useCallback((B,R,w)=>{let l=t;N.length>0&&(l=l.filter(ue=>String(ue[N[0].field])===B)),U.length>0&&(l=l.filter(ue=>String(ue[U[0].field])===R));const _e=l.map(ue=>Number(ue[w.field])||0),De=fa(_e,w.summaryType||"sum");return w.format?w.format(De):De},[t,N,U]),Y=n.useCallback(B=>{_(B),s?.(B)},[s]),le=n.useCallback((B,R)=>{let w=t;return N.length>0&&(w=w.filter(l=>String(l[N[0].field])===B)),U.length>0&&(w=w.filter(l=>String(l[U[0].field])===R)),w},[t,N,U]),oe=n.useCallback((B,R)=>{x&&x(B,R,le(B,R))},[x,le]),ge=n.useCallback(()=>{const B=["",...ye.flatMap(ue=>Z.length>0?Z.map(I=>`${ue} - ${I.caption}`):[ue])],R=re.map(ue=>{const I=ye.flatMap(Q=>Z.length>0?Z.map(F=>String(T(ue,Q,F))):["—"]);return[ue,...I]}),w=[B,...R].map(ue=>ue.map(I=>`"${String(I).replace(/"/g,'""')}"`).join(",")).join(`
|
|
15
|
+
`),l=new Blob(["\uFEFF"+w],{type:"text/csv;charset=utf-8;"}),_e=URL.createObjectURL(l),De=document.createElement("a");De.href=_e,De.download=`${c}.csv`,De.click(),URL.revokeObjectURL(_e)},[ye,re,Z,T,c]);return W?null:e.jsxs("div",{className:`nice-pivotgrid ${j||""}`,style:D,children:[(r||g)&&e.jsxs("div",{className:"nice-pivotgrid__toolbar",children:[r&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--outline nice-btn--sm",onClick:()=>b(!f),children:A("controls.fieldChooser","Field Chooser")}),g&&e.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ge,children:["CSV ",e.jsx(O.oa,{name:"download",size:14})]})]}),f&&e.jsx(ji,{fields:k,onChange:Y}),o?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:N.map(B=>B.caption).join(" / ")||""}),ye.map(B=>e.jsx("th",{colSpan:Z.length||1,children:B},B))]}),Z.length>1&&e.jsxs("tr",{children:[e.jsx("th",{}),ye.map(B=>Z.map(R=>e.jsx("th",{children:R.caption},`${B}-${R.field}`)))]})]}),e.jsx("tbody",{children:re.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:1+ye.length*Math.max(Z.length,1),className:"nice-pivotgrid__empty",children:u||A("controls.noData","No data available")})}):re.map(B=>e.jsxs("tr",{children:[e.jsx("td",{className:"nice-pivotgrid__row-header",children:B}),ye.map(R=>Z.length>0?Z.map(w=>e.jsx("td",{className:`nice-pivotgrid__cell ${x?"nice-pivotgrid__cell--clickable":""}`,onClick:x?()=>oe(B,R):void 0,children:T(B,R,w)},`${R}-${w.field}`)):e.jsx("td",{className:"nice-pivotgrid__cell",children:"—"},R))]},B))})]})})]})},ga=Object.freeze(Object.defineProperty({__proto__:null,NicePivotGrid:Ni},Symbol.toStringTag,{value:"Module"}));function xa({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 _a(){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 ba=[{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"}],wi=n.forwardRef(({columns:t,cards:a,onCardMove:s,onCardClick:r,renderCard:o,onAddCard:u,disabled:g=!1,size:c="md",collapsible:x=!1,layoutMode:j="scroll",viewMode:D,onViewModeChange:V,collapsedColumns:$,onCollapsedColumnsChange:ae,formItems:W,formColumns:A=1,formProps:k,editCardTitle:_,newCardTitle:f,onCardEdit:b,onCardCreate:N,onCardDelete:U,tutorial:Z,cookies:re=!1,localStorage:ye=!0,sessionStorage:T=!1,storageMode:Y,storageKey:le,className:oe,style:ge,id:B,...R},w)=>{const{t:l}=O.Gt(),[_e,De]=n.useState(null),[ue,I]=n.useState(null),[Q,F]=n.useState(null),he=!!W&&(!!b||!!N),pe=n.useCallback(z=>{if(he&&b){F({key:z.key,data:{...z},column:z.column});return}r?.(z)},[he,r,b]),Te=n.useCallback(z=>{if(he&&N){F({key:null,data:{title:"",description:""},column:z});return}u?.(z)},[he,u,N]),Ve=O.useStorageAdapter(le??"nice-kanban"),[Ye,ke]=n.useState(()=>Ve.get("state")??{collapsedColumns:[],viewMode:"default"}),Ee=$??Ye.collapsedColumns??[],Be=D??Ye.viewMode??"default",Ge=n.useCallback(z=>{ke(me=>{const G={...me,...z};return Ve.set("state",G),G})},[Ve]),J=n.useCallback(z=>{const me=Ee.includes(z)?Ee.filter(G=>G!==z):[...Ee,z];ae?ae(me):Ge({collapsedColumns:me})},[Ee,ae,Ge]);n.useCallback(z=>{V?V(z):Ge({viewMode:z})},[V,Ge]);const be=n.useCallback(z=>a.filter(me=>me.column===z).sort((me,G)=>(me.order??0)-(G.order??0)),[a]),je=n.useCallback((z,me)=>{g||(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",String(me.key)),De({cardKey:me.key,fromColumn:me.column}))},[g]),xe=n.useCallback((z,me)=>{z.preventDefault(),z.dataTransfer.dropEffect="move",I({column:me})},[]),M=n.useCallback(()=>{I(null)},[]),ee=n.useCallback((z,me)=>{if(z.preventDefault(),I(null),!_e||g)return;const G=be(me);s?.(_e.cardKey,me,G.length),De(null)},[_e,g,be,s]),Pe=n.useCallback(()=>{De(null),I(null)},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:w,id:B,className:`nice-kanban nice-kanban--${c} nice-kanban--${Be} nice-kanban--layout-${j} ${g?"nice-kanban--disabled":""} ${oe||""}`,style:{position:"relative",...ge},...R,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(O.Yl,{steps:O.Jl(Z,ba)})}),t.map(z=>{const me=be(z.key),G=ue?.column===z.key,Ie=z.limit!=null&&me.length>=z.limit,$e=x&&Ee.includes(z.key);return e.jsxs("div",{className:`nice-kanban__column ${G?"nice-kanban__column--dragover":""} ${$e?"nice-kanban__column--collapsed":""}`,onDragOver:te=>!$e&&xe(te,z.key),onDragLeave:M,onDrop:te=>!$e&&ee(te,z.key),children:[e.jsxs("div",{className:"nice-kanban__column-header",style:z.color?{borderTopColor:z.color}:void 0,onClick:x?()=>J(z.key):void 0,role:x?"button":void 0,tabIndex:x?0:void 0,onKeyDown:x?te=>{(te.key==="Enter"||te.key===" ")&&J(z.key)}:void 0,children:[x&&e.jsx("span",{className:"nice-kanban__collapse-icon","aria-hidden":"true",children:e.jsx(xa,{open:!$e})}),e.jsx("span",{className:"nice-kanban__column-title",children:z.title}),e.jsxs("span",{className:"nice-kanban__column-count",children:[me.length,z.limit!=null&&` / ${z.limit}`]})]}),!$e&&e.jsxs("div",{className:"nice-kanban__column-body",children:[me.map(te=>e.jsx("div",{className:`nice-kanban__card nice-kanban__card--${Be} ${_e?.cardKey===te.key?"nice-kanban__card--dragging":""}`,draggable:!g,onDragStart:Ke=>je(Ke,te),onDragEnd:Pe,onClick:()=>pe(te),role:"article",children:o?o(te):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-kanban__card-title",children:te.title}),Be!=="compact"&&te.description&&e.jsx("div",{className:"nice-kanban__card-desc",children:te.description})]})},te.key)),me.length===0&&e.jsx("div",{className:"nice-kanban__empty",children:l("kanban.empty","No cards")})]}),!$e&&(u||he&&N)&&!Ie&&e.jsxs("button",{type:"button",className:"nice-kanban__add",onClick:()=>Te(z.key),disabled:g,children:[e.jsx(_a,{})," ",l("kanban.addCard","Add card")]})]},z.key)})]}),he&&Q&&e.jsxs(_i.NiceModal,{open:!0,onClose:()=>F(null),title:Q.key==null?f||l("kanban.newCard","New card"):_||l("kanban.editCard","Edit card"),children:[e.jsx(xi.NiceForm,{items:W,data:Q.data,columns:A,...k,onFieldChange:(z,me)=>F(G=>G&&{...G,data:{...G.data,[z]:me}})}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16,flexWrap:"wrap"},children:[Q.key!=null&&U&&e.jsx(Le.NiceButton,{type:"button",size:"sm",variant:"error",style:{marginRight:"auto"},onClick:()=>{U(Q.key),F(null)},children:l("controls.delete","Delete")}),e.jsx(Le.NiceButton,{type:"button",size:"sm",variant:"secondary",onClick:()=>F(null),children:l("controls.cancel","Cancel")}),e.jsx(Le.NiceButton,{type:"button",size:"sm",variant:"primary",onClick:()=>{if(Q.key==null){const z={key:`card-${Date.now()}`,title:"",column:Q.column,...Q.data};N?.(z)}else b?.(Q.key,{...Q.data,key:Q.key,column:Q.column});F(null)},children:l("controls.save","Save")})]})]})]})});wi.displayName="NiceKanbanBoard";function Pt(...t){return t.filter(Boolean).map(a=>typeof a=="object"?Object.entries(a).filter(([,s])=>s).map(([s])=>s).join(" "):a).join(" ")}const va=50,ya=[10,25,50,100,200],ja=40,Na=10,wa=768,ka=500,Sa=10;function _t(t,a){return a.split(".").reduce((s,r)=>s?.[r],t)}function kn(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?e.jsx(O.oa,{name:"check",size:14}):e.jsx(O.oa,{name:"close",size:14});case"enum":return a.enumOptions?.find(o=>o.value===t)?.label||String(t);default:return String(t)}}function Ca(t,a,s,r){const[o,u]=n.useState(0),{startIndex:g,endIndex:c,totalHeight:x,offsetY:j}=n.useMemo(()=>{const $=t.length*s,ae=Math.ceil(a/s),W=Math.max(0,Math.floor(o/s)-r),A=Math.min(t.length,Math.ceil(o/s)+ae+r),k=W*s;return{startIndex:W,endIndex:A,totalHeight:$,offsetY:k}},[t.length,a,s,o,r]),D=n.useMemo(()=>t.slice(g,c),[t,g,c]),V=n.useCallback($=>{u($.currentTarget.scrollTop)},[]);return{visibleData:D,totalHeight:x,offsetY:j,handleScroll:V,startIndex:g}}function Ma(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||{}}),o=n.useCallback(u=>{r(g=>{const c={...g,...u};return t&&typeof window<"u"&&localStorage.setItem(`nice-module-grid-${t}`,JSON.stringify(c)),c})},[t]);return[s,o]}function Da(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 Ia({column:t,sort:a,onSort:s,onResize:r,resizable:o,t:u}){const g=n.useRef(null),[c,x]=n.useState(!1),j=n.useCallback($=>{if(!o||!r)return;$.preventDefault(),x(!0);const ae=$.clientX,W=t.width||150,A=_=>{const f=_.clientX-ae,b=Math.max(t.minWidth||50,W+f);r(t.field,Math.min(b,t.maxWidth||1/0))},k=()=>{x(!1),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",k)},[t,o,r]),D=a?.direction,V=D==="asc"?e.jsx(O.oa,{name:"sort-asc",size:12}):D==="desc"?e.jsx(O.oa,{name:"sort-desc",size:12}):null;return e.jsxs("div",{className:Pt("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}),V&&e.jsx("span",{className:"nice-module-grid__sort-indicator",children:V}),o&&e.jsx("div",{ref:g,className:"nice-module-grid__resize-handle",onMouseDown:j})]})}function za({column:t,row:a,rowIndex:s,value:r,locale:o="pl-PL",onClick:u}){const g=O.Zc({onClick:u}),c=u?g:{};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 x=t.enumOptions.find(j=>j.value===r);if(x)return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsxs("span",{className:Pt("nice-module-grid__badge",`nice-module-grid__badge--${x.color||"default"}`),children:[x.icon&&e.jsx("span",{className:"nice-module-grid__badge-icon",children:x.icon}),x.label]})})}if(t.type==="progress"){const x=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:Pt("nice-module-grid__progress-bar",`nice-module-grid__progress-bar--${t.progressColor||"primary"}`),style:{width:`${x}%`}}),e.jsxs("span",{className:"nice-module-grid__progress-text",children:[x,"%"]})]})})}if(t.type==="rating"){const x=t.maxRating||5,j=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":`${j} out of ${x} stars`,children:Array.from({length:x},(D,V)=>e.jsx("span",{className:Pt("nice-module-grid__star",V<j&&"nice-module-grid__star--filled"),children:e.jsx(O.oa,{name:"star",size:14})},V))})})}if(t.type==="link"&&t.linkTemplate){const x=t.linkTemplate.replace(/\{\{(\w+)\}\}/g,(j,D)=>String(_t(a,D)??""));return e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:e.jsx("a",{href:x,target:t.linkNewTab?"_blank":void 0,rel:t.linkNewTab?"noopener noreferrer":void 0,className:"nice-module-grid__link",children:kn(r,t,o)})})}if(t.type==="image"){const j={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:j,height:j}}):e.jsx("div",{className:"nice-module-grid__image-placeholder",style:{width:j,height:j}})})}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:Pt("nice-module-grid__boolean",!!r&&"nice-module-grid__boolean--true"),children:e.jsx(O.oa,{name:r?"check":"close",size:14})})}):e.jsx("div",{className:"nice-module-grid__cell",style:{textAlign:t.align},...c,children:kn(r,t,o)})}function Ra({row:t,index:a,columns:s,primaryField:r,secondaryField:o,customRender:u,selected:g,onClick:c,locale:x="pl-PL",t:j}){if(u)return e.jsx("div",{className:Pt("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:c,children:u(t,a)});const D=s.find($=>$.field===r)||s[0],V=s.find($=>$.field===o)||s[1];return e.jsxs("div",{className:Pt("nice-module-grid__mobile-card",g&&"nice-module-grid__mobile-card--selected"),onClick:c,role:"row","aria-selected":g,children:[e.jsxs("div",{className:"nice-module-grid__mobile-card-header",children:[e.jsx("div",{className:"nice-module-grid__mobile-card-title",children:kn(_t(t,D?.field||""),D,x)}),V&&e.jsx("div",{className:"nice-module-grid__mobile-card-subtitle",children:kn(_t(t,V.field),V,x)})]}),e.jsx("div",{className:"nice-module-grid__mobile-card-body",children:s.filter($=>!$.hidden&&$.field!==r&&$.field!==o).slice(0,4).map($=>e.jsxs("div",{className:"nice-module-grid__mobile-card-field",children:[e.jsx("span",{className:"nice-module-grid__mobile-card-label",children:$.header}),e.jsx("span",{className:"nice-module-grid__mobile-card-value",children:kn(_t(t,$.field),$,x)})]},$.field))})]})}function Aa({page:t,pageSize:a,totalRows:s,pageSizeOptions:r,onPageChange:o,t:u}){const g=Math.ceil(s/a),c=(t-1)*a+1,x=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,"–",x," ",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:j=>o(1,Number(j.target.value)),"aria-label":u("pagination.rowsPerPage","Rows per page"),children:r.map(j=>e.jsx("option",{value:j,children:j},j))}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(1,a),disabled:t===1,"aria-label":u("pagination.first","First"),children:"««"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(t-1,a),disabled:t===1,"aria-label":u("pagination.previous","Previous"),children:"«"}),e.jsxs("span",{className:"nice-module-grid__pagination-page",children:[t," / ",g]}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(t+1,a),disabled:t>=g,"aria-label":u("pagination.next","Next"),children:"»"}),e.jsx("button",{className:"nice-module-grid__pagination-btn",onClick:()=>o(g,a),disabled:t>=g,"aria-label":u("pagination.last","Last"),children:"»»"})]})]})}function Ea({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 $a(t,a){const{columns:s,data:r,keyField:o="id",dataSource:u,onFetch:g,sortable:c=!0,sort:x,onSortChange:j,multiSort:D=!1,filterable:V=!1,filter:$,onFilterChange:ae,searchText:W,onSearchChange:A,searchPlaceholder:k="moduleGrid.searchPlaceholder",pagination:_=!0,page:f,pageSize:b,pageSizeOptions:N=ya,totalRows:U,onPageChange:Z,virtualScroll:re=!0,rowHeight:ye=ja,overscan:T=Na,selectionMode:Y="none",selectedKeys:le,onSelectionChange:oe,columnReorder:ge=!0,onColumnOrderChange:B,columnResize:R=!0,onColumnWidthChange:w,groupBy:l,onGroupByChange:_e,groupRowRender:De,expandAllGroups:ue=!1,editable:I=!1,onCellEdit:Q,onRowEdit:F,editMode:he="cell",contextMenuItems:pe,onContextMenuAction:Te,exportable:Ve=!0,exportFormats:Ye=["csv","excel"],onExport:ke,preferencesKey:Ee,initialPreferences:Be,onPreferencesChange:Ge,density:J="normal",striped:be=!0,bordered:je=!1,hoverable:xe=!0,loading:M=!1,emptyState:ee,toolbar:Pe,onRowClick:z,onRowDoubleClick:me,rowClassName:G,rowStyle:Ie,mobileCardView:$e=!0,mobileBreakpoint:te=wa,mobileCardRender:Ke,mobilePrimaryField:Qe,mobileSecondaryField:it,moduleId:Ne,permissions:jt,size:Ft="medium",skeletonLoading:mt=!0,skeletonRows:Nt=Sa,"aria-label":E,"aria-labelledby":se,"aria-describedby":de,className:Ze,style:rt,id:we,testId:Fe}=t,{t:Se}=O.Gt();O.$c(),O.rc("table");const ct=Da(te),[qe,wt]=Ma(Ee,Be),bt=n.useRef(null),cn=n.useRef(null),[Yt,Qt]=n.useState([]),[at,Pn]=n.useState(),[Sn,Jt]=n.useState(""),[ln,kt]=n.useState(1),[fn,m]=n.useState(b||va),[h,L]=n.useState(new Set),[q,ie]=n.useState([]),[P,S]=n.useState(0),[X,H]=n.useState(!1),[Oe,Re]=n.useState(new Set),[Ce,et]=n.useState(null),[qt,en]=n.useState({}),nt=x??Yt,Ot=$??at,St=W??Sn,tn=f??ln,Zt=b??fn,Ct=le??h,gn=U??P??r?.length??0,Ut=!!(g||u),st=n.useMemo(()=>{const y=new Set(qe.hiddenColumns||[]);return s.filter(fe=>!fe.hidden&&!y.has(fe.field))},[s,qe.hiddenColumns]),nn=n.useMemo(()=>{if(Ut)return q;if(!r)return[];let y=[...r];if(St){const fe=St.toLowerCase(),Me=s.filter(Ae=>Ae.searchable!==!1).map(Ae=>Ae.field);y=y.filter(Ae=>Me.some(ot=>{const It=_t(Ae,ot);return String(It??"").toLowerCase().includes(fe)}))}return nt.length>0&&y.sort((fe,Me)=>{for(const Ae of nt){const ot=_t(fe,Ae.field),It=_t(Me,Ae.field),zt=ot<It?-1:ot>It?1:0;if(zt!==0)return Ae.direction==="asc"?zt:-zt}return 0}),y},[Ut,q,r,St,nt,s]),Bt=n.useMemo(()=>{if(Ut||!_)return nn;const y=(tn-1)*Zt;return nn.slice(y,y+Zt)},[Ut,nn,_,tn,Zt]),xn=bt.current?.clientHeight||400,Mt=re&&Bt.length>ka,{visibleData:Fn,totalHeight:At,offsetY:_n,handleScroll:on,startIndex:Gt}=Ca(Bt,xn,ye,T),lt=Mt?Fn:Bt,Et=n.useCallback(async()=>{if(g){H(!0);try{const fe=await g({page:tn,pageSize:Zt,sort:nt,filter:Ot,search:St});ie(fe.data),S(fe.total)}catch(y){console.error("NiceModuleGrid fetch error:",y)}finally{H(!1)}}},[g,tn,Zt,nt,Ot,St]);n.useEffect(()=>{Ut&&Et()},[Ut,Et]);const dn=n.useCallback(y=>{const fe=nt.find(Ae=>Ae.field===y);let Me;fe?fe.direction==="asc"?Me=nt.map(Ae=>Ae.field===y?{...Ae,direction:"desc"}:Ae):Me=nt.filter(Ae=>Ae.field!==y):Me=D?[...nt,{field:y,direction:"asc"}]:[{field:y,direction:"asc"}],j?j(Me):Qt(Me)},[nt,D,j]),Cn=n.useCallback((y,fe)=>{Z?Z(y,fe):(kt(y),m(fe))},[Z]),Mn=n.useCallback(y=>{A?A(y):Jt(y),Z||kt(1)},[A,Z]),bn=n.useCallback((y,fe)=>{const Me=new Set(Ct);if(Y==="single"?(Me.clear(),Me.add(y)):(Y==="multiple"||Y==="checkbox")&&(Me.has(y)?Me.delete(y):Me.add(y)),oe){const Ae=Bt.filter(ot=>Me.has(String(_t(ot,o))));oe(Me,Ae)}else L(Me)},[Ct,Y,oe,Bt,o]),vn=n.useCallback((y,fe)=>{en(Me=>({...Me,[y]:fe})),w?.(y,fe),wt({columnWidths:{...qe.columnWidths,[y]:fe}})},[w,wt,qe.columnWidths]),On=n.useCallback((y,fe)=>{pe?.length&&(y.preventDefault(),et({x:y.clientX,y:y.clientY,row:fe}))},[pe]),Un=n.useCallback(y=>{Ce&&Te?.(y,Ce.row),et(null)},[Ce,Te]),un=n.useCallback(async y=>{if(ke)await ke(y,{selectedOnly:Ct.size>0,columns:st.map(fe=>fe.field)});else if(y==="csv"){const fe=st.map(dt=>dt.header).join(","),Me=Bt.map(dt=>st.map(Hn=>JSON.stringify(_t(dt,Hn.field)??"")).join(",")),Ae=[fe,...Me].join(`
|
|
16
|
+
`),ot=new Blob([Ae],{type:"text/csv;charset=utf-8;"}),It=URL.createObjectURL(ot),zt=document.createElement("a");zt.href=It,zt.download=`export-${new Date().toISOString().slice(0,10)}.csv`,zt.click(),URL.revokeObjectURL(It)}},[ke,Ct,st,Bt,Se]);n.useEffect(()=>{if(!Ce)return;const y=()=>et(null);return document.addEventListener("click",y),()=>document.removeEventListener("click",y)},[Ce]);const Dt=n.useCallback(y=>{y.key==="Escape"&&et(null)},[]),Wt=M||X,Vt=!Wt&<.length===0,Kt=ct&&$e,Xt=Pt("nice-module-grid",`nice-module-grid--${J}`,`nice-module-grid--${Ft}`,be&&"nice-module-grid--striped",je&&"nice-module-grid--bordered",xe&&"nice-module-grid--hoverable",Wt&&"nice-module-grid--loading",Kt&&"nice-module-grid--mobile",Ze);return e.jsxs("div",{ref:a,id:we,"data-testid":Fe,className:Xt,style:rt,onKeyDown:Dt,role:"grid","aria-label":E,"aria-labelledby":se,"aria-describedby":de,"aria-rowcount":gn,"aria-colcount":st.length,"aria-busy":Wt,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:k,value:St,onChange:y=>Mn(y.target.value),"aria-label":Se("moduleGrid.searchAriaLabel","Search")})}),Pe,Ve&&e.jsx("div",{className:"nice-module-grid__toolbar-export",children:Ye.map(y=>e.jsx("button",{className:"nice-module-grid__export-btn",onClick:()=>un(y),"aria-label":Se(`moduleGrid.export.${y}`,`Export to ${y.toUpperCase()}`),children:y.toUpperCase()},y))})]}),e.jsx("div",{ref:bt,className:"nice-module-grid__container",onScroll:Mt?on:void 0,children:Kt?e.jsx("div",{className:"nice-module-grid__mobile-list",children:Wt&&mt?Array.from({length:Nt},(y,fe)=>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}})]},fe)):Vt?e.jsxs("div",{className:"nice-module-grid__empty",children:[ee?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:ee.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:ee?.title||Se("moduleGrid.noData","No data")}),ee?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:ee.description}),ee?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:ee.action.onClick,children:[ee.action.icon,ee.action.label]})]}):lt.map((y,fe)=>{const Me=String(_t(y,o));return e.jsx(Ra,{row:y,index:Gt+fe,columns:st,primaryField:Qe,secondaryField:it,customRender:Ke,selected:Ct.has(Me),onClick:()=>{Y!=="none"&&bn(Me,y),z?.(y,Gt+fe)},t:Se},Me)})}):e.jsxs("div",{ref:cn,className:"nice-module-grid__table",children:[e.jsxs("div",{className:"nice-module-grid__header",role:"row",children:[Y==="checkbox"&&e.jsx("div",{className:"nice-module-grid__header-cell nice-module-grid__header-cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:Ct.size>0&&Ct.size===lt.length,onChange:()=>{if(Ct.size===lt.length)oe?.(new Set,[]),L(new Set);else{const y=new Set(lt.map(fe=>String(_t(fe,o))));oe?.(y,lt),L(y)}},"aria-label":Se("moduleGrid.selectAll","Select all")})}),st.map(y=>e.jsx(Ia,{column:{...y,width:qt[y.field]||y.width},sort:nt.find(fe=>fe.field===y.field),onSort:c?dn:void 0,onResize:R?vn:void 0,resizable:R,t:Se},y.field))]}),e.jsx("div",{className:"nice-module-grid__body",style:Mt?{height:At,position:"relative"}:void 0,children:Wt&&mt?Array.from({length:Nt},(y,fe)=>e.jsx(Ea,{columns:st},fe)):Vt?e.jsxs("div",{className:"nice-module-grid__empty",children:[ee?.icon&&e.jsx("div",{className:"nice-module-grid__empty-icon",children:ee.icon}),e.jsx("div",{className:"nice-module-grid__empty-title",children:ee?.title||Se("moduleGrid.noData","No data")}),ee?.description&&e.jsx("div",{className:"nice-module-grid__empty-description",children:ee.description}),ee?.action&&e.jsxs("button",{className:"nice-module-grid__empty-action",onClick:ee.action.onClick,children:[ee.action.icon,ee.action.label]})]}):e.jsx("div",{style:Mt?{transform:`translateY(${_n}px)`}:void 0,children:lt.map((y,fe)=>{const Me=String(_t(y,o)),Ae=Gt+fe,ot=Ct.has(Me),It=typeof G=="function"?G(y,Ae):G,zt=typeof Ie=="function"?Ie(y,Ae):Ie;return e.jsxs("div",{className:Pt("nice-module-grid__row",ot&&"nice-module-grid__row--selected",It),style:{...zt,height:ye},role:"row","aria-rowindex":Ae+1,"aria-selected":ot,onClick:()=>{Y!=="none"&&bn(Me,y),z?.(y,Ae)},onDoubleClick:()=>me?.(y,Ae),onContextMenu:dt=>On(dt,y),children:[Y==="checkbox"&&e.jsx("div",{className:"nice-module-grid__cell nice-module-grid__cell--checkbox",children:e.jsx("input",{type:"checkbox",checked:ot,onChange:()=>bn(Me,y),onClick:dt=>dt.stopPropagation(),"aria-label":Se("moduleGrid.selectRow","Select row")})}),st.map(dt=>e.jsx(za,{column:{...dt,width:qt[dt.field]||dt.width},row:y,rowIndex:Ae,value:_t(y,dt.field)},dt.field))]},Me)})})})]})}),_&&gn>0&&e.jsx(Aa,{page:tn,pageSize:Zt,totalRows:Ut?P:nn.length,pageSizeOptions:N,onPageChange:Cn,t:Se}),Ce&&pe&&e.jsx("div",{className:"nice-module-grid__context-menu",style:{left:Ce.x,top:Ce.y},role:"menu",children:pe.filter(y=>typeof y.hidden=="function"?!y.hidden(Ce.row):!y.hidden).map(y=>{if(y.divider)return e.jsx("div",{className:"nice-module-grid__context-menu-divider"},y.key);const fe=typeof y.disabled=="function"?y.disabled(Ce.row):y.disabled;return e.jsxs("button",{className:Pt("nice-module-grid__context-menu-item",y.danger&&"nice-module-grid__context-menu-item--danger",fe&&"nice-module-grid__context-menu-item--disabled"),onClick:()=>{fe||(y.onClick?.(Ce.row),Un(y.key))},disabled:fe,role:"menuitem",children:[y.icon&&e.jsx("span",{className:"nice-module-grid__context-menu-icon",children:y.icon}),y.label]},y.key)})}),Wt&&!mt&&e.jsx("div",{className:"nice-module-grid__loading-overlay",children:e.jsx("div",{className:"nice-module-grid__spinner","aria-label":Se("moduleGrid.loading","Loading")})})]})}const La=n.forwardRef($a),Ta=`
|
|
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 Ln(t,a="pl-PL"){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(a,{year:"numeric",month:"2-digit",day:"2-digit"}):"-"}function Pa(t){return t>=80?"high":t>=50?"medium":"low"}function Fa(){return`match-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function Oa({item:t,isSelected:a,isDragging:s,isDropTarget:r,suggestion:o,currency:u,locale:g,onSelect:c,onDoubleClick:x,onDragStart:j,onDragEnd:D,onDrop:V,disabled:$}){const ae=t.status??"unmatched",W=o?.confidence??t.confidence,A=_=>{_.dataTransfer.setData("text/plain",t.id),_.dataTransfer.setData("source","statement"),_.dataTransfer.effectAllowed="move",j()},k=_=>{_.dataTransfer.types.includes("source")&&_.dataTransfer.getData("source")!=="statement"&&_.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${ae} ${a?"nice-reconciliation__row--selected":""} ${s?"nice-reconciliation__row--dragging":""} ${r?"nice-reconciliation__row--drop-target":""}`,draggable:!$&&ae!=="matched",onDragStart:A,onDragEnd:D,onDragOver:k,onDrop:V,onClick:c,onDoubleClick:x,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${ae}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsx("div",{className:"nice-reconciliation__row-date",children:Ln(t.date,g)}),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})]}),W!=null&&e.jsxs("span",{className:`nice-reconciliation__confidence nice-reconciliation__confidence--${Pa(W)}`,children:[W,"%"]}),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,g)})]})}function Ua({item:t,isSelected:a,isDragging:s,isDropTarget:r,currency:o,locale:u,onSelect:g,onDoubleClick:c,onDragStart:x,onDragEnd:j,onDrop:D,disabled:V}){const $=t.status??"unmatched",ae=A=>{A.dataTransfer.setData("text/plain",t.id),A.dataTransfer.setData("source","entry"),A.dataTransfer.effectAllowed="move",x()},W=A=>{A.dataTransfer.types.includes("source")&&A.dataTransfer.getData("source")!=="entry"&&A.preventDefault()};return e.jsxs("div",{className:`nice-reconciliation__row nice-reconciliation__row--${$} ${a?"nice-reconciliation__row--selected":""} ${s?"nice-reconciliation__row--dragging":""} ${r?"nice-reconciliation__row--drop-target":""}`,draggable:!V&&$!=="matched",onDragStart:ae,onDragEnd:j,onDragOver:W,onDrop:D,onClick:g,onDoubleClick:c,role:"row","aria-selected":a,tabIndex:0,children:[e.jsx("span",{className:`nice-reconciliation__status nice-reconciliation__status--${$}`}),e.jsxs("div",{className:"nice-reconciliation__row-main",children:[e.jsxs("div",{className:"nice-reconciliation__row-date",children:[Ln(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,o,u)})]})}const Ba=n.forwardRef(function(a,s){const{statements:r,bankTransactions:o,entries:u,accountingEntries:g,matches:c,defaultMatches:x=[],suggestions:j=[],config:D={},currency:V,showConfidence:$,statementPanelConfig:ae,entryPanelConfig:W,onMatch:A,onAutoMatch:k,onUnmatch:_,onBatchAction:f,onFilterChange:b,onRequestSuggestions:N,onSelectionChange:U,onComplete:Z,size:re="medium",showToolbar:ye=!0,showFilters:T=!0,showSummary:Y=!0,showSuggestions:le=!0,layout:oe="horizontal",enableDragDrop:ge=!0,enableKeyboard:B=!0,enableDetailPanel:R=!0,loading:w=!1,disabled:l=!1,readOnly:_e=!1,locale:De="pl-PL",labels:ue={},className:I,style:Q}=a,F=r??o??[],he=u??g??[],pe=V??D.currency??"PLN",[Te,Ve]=n.useState(x),[Ye,ke]=n.useState(new Set),[Ee,Be]=n.useState(new Set),[Ge,J]=n.useState(null),[be,je]=n.useState(null),[xe,M]=n.useState({}),[ee,Pe]=n.useState(null),z=c??Te,me=n.useRef(null),G=n.useRef(null);n.useEffect(()=>{const E="nice-reconciliation-styles";if(!document.getElementById(E)){const se=document.createElement("style");se.id=E,se.textContent=Ta,document.head.appendChild(se)}},[]);const Ie=n.useMemo(()=>{const E=new Set;return z.forEach(se=>se.statementIds.forEach(de=>E.add(de))),E},[z]),$e=n.useMemo(()=>{const E=new Set;return z.forEach(se=>se.entryIds.forEach(de=>E.add(de))),E},[z]),te=n.useMemo(()=>{const E=F.filter(we=>!Ie.has(we.id)),se=he.filter(we=>!$e.has(we.id)),de=F.reduce((we,Fe)=>we+Fe.amount,0),Ze=he.reduce((we,Fe)=>we+Fe.amount,0),rt=F.filter(we=>Ie.has(we.id)).reduce((we,Fe)=>we+Fe.amount,0);return{totalStatements:F.length,totalEntries:he.length,matchedStatements:F.length-E.length,matchedEntries:he.length-se.length,unmatchedStatements:E.length,unmatchedEntries:se.length,statementTotal:de,entryTotal:Ze,matchedAmount:rt,unmatchedStatementAmount:E.reduce((we,Fe)=>we+Fe.amount,0),unmatchedEntryAmount:se.reduce((we,Fe)=>we+Fe.amount,0),difference:de-Ze,matchPercentage:F.length>0?Math.round((F.length-E.length)/F.length*100):0,matchCount:z.length,partialMatchCount:z.filter(we=>we.status==="partial").length,pendingSuggestions:j.length}},[F,he,z,j,Ie,$e]),Ke=n.useCallback((E,se)=>{const de=F.filter(qe=>E.includes(qe.id)),Ze=he.filter(qe=>se.includes(qe.id));if(de.length===0||Ze.length===0)return null;const rt=de.reduce((qe,wt)=>qe+wt.amount,0),we=Ze.reduce((qe,wt)=>qe+wt.amount,0),Fe=Math.abs(rt-we),Se=D.amountTolerance??.01,ct={id:Fa(),statementIds:E,entryIds:se,status:Fe<=Se?"matched":"partial",statementTotal:rt,entryTotal:we,difference:Fe,confidence:Fe<=Se?100:Math.max(0,100-Fe/Math.max(Math.abs(rt),1)*100),matchedBy:"user",matchedAt:new Date};return c||Ve(qe=>[...qe,ct]),A?.(ct,de,Ze),ke(new Set),Be(new Set),ct},[F,he,D.amountTolerance,c,A]),Qe=n.useCallback(E=>{const se=z.find(de=>de.id===E);se&&(c||Ve(de=>de.filter(Ze=>Ze.id!==E)),_?.(E,se.statementIds,se.entryIds))},[z,c,_]),it=n.useCallback(async()=>{const E=[],se=new Set(Ie),de=new Set($e),Ze=D.amountTolerance??.01,rt=D.dateTolerance??3;for(const we of F){if(se.has(we.id))continue;const Fe=he.filter(Se=>{if(de.has(Se.id)||Math.abs(we.amount-Se.amount)>Ze)return!1;const qe=new Date(we.date),wt=new Date(Se.date);return!(Math.abs(qe.getTime()-wt.getTime())/(1e3*60*60*24)>rt)});if(Fe.length===1){const Se=Fe[0],ct=Ke([we.id],[Se.id]);ct&&(E.push(ct),se.add(we.id),de.add(Se.id))}}return f?.("autoMatch",E),E},[F,he,Ie,$e,D,Ke,f]),Ne=n.useCallback((E,se,de,Ze)=>{Ze!==se&&(Ze==="statement"?Ke([de],[E]):Ke([E],[de]),J(null),je(null))},[Ke]),jt=n.useCallback(()=>{const E=Array.from(Ye),se=Array.from(Ee);E.length>0&&se.length>0&&Ke(E,se)},[Ye,Ee,Ke]);n.useEffect(()=>{U?.(Array.from(Ye),Array.from(Ee))},[Ye,Ee,U]),n.useImperativeHandle(s,()=>({getMatches:()=>z,getUnmatchedStatements:()=>F.filter(E=>!Ie.has(E.id)),getUnmatchedEntries:()=>he.filter(E=>!$e.has(E.id)),createMatch:Ke,removeMatch:Qe,autoMatch:it,getSuggestions:async E=>N?N(E??F.filter(se=>!Ie.has(se.id)).map(se=>se.id)):[],applySuggestion:E=>Ke([E.statementId],E.entryIds),approveAll:()=>{f?.("approveAll",z)},clearAll:()=>{c||Ve([]),f?.("clearAll",[])},exportMatched:E=>{f?.("exportMatched",z)},getSummary:()=>te,reset:()=>{c||Ve([]),ke(new Set),Be(new Set),M({})},focusStatements:()=>me.current?.focus(),focusEntries:()=>G.current?.focus()}),[z,F,he,Ie,$e,Ke,Qe,it,N,f,c,te]);const Ft=n.useMemo(()=>F.filter(E=>{if(xe.status&&xe.status.length>0){const se=Ie.has(E.id)?"matched":"unmatched";if(!xe.status.includes(se))return!1}if(xe.searchText){const se=xe.searchText.toLowerCase();if(!E.description?.toLowerCase().includes(se)&&!E.counterparty?.toLowerCase().includes(se))return!1}return!0}),[F,xe,Ie]),mt=n.useMemo(()=>he.filter(E=>{if(xe.status&&xe.status.length>0){const se=$e.has(E.id)?"matched":"unmatched";if(!xe.status.includes(se))return!1}if(xe.searchText){const se=xe.searchText.toLowerCase();if(!E.description?.toLowerCase().includes(se)&&!E.partyName?.toLowerCase().includes(se))return!1}return!0}),[he,xe,$e]),Nt=Ye.size>0&&Ee.size>0&&!_e&&!l;return e.jsxs("div",{className:`nice-reconciliation nice-reconciliation--${oe} ${I??""}`,style:Q,children:[ye&&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:it,disabled:l||_e||w,children:[e.jsx(O.oa,{name:"zap",size:14})," ",ue.autoMatch??"Auto-match"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn nice-reconciliation__btn--success",onClick:jt,disabled:!Nt||w,children:[e.jsx(O.oa,{name:"link",size:14})," 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:()=>f?.("approveAll",z),disabled:z.length===0||l||w,children:[e.jsx(O.oa,{name:"check",size:14})," ",ue.approveAll??"Approve All"]}),e.jsxs("button",{type:"button",className:"nice-reconciliation__btn",onClick:()=>{c||Ve([]),f?.("clearAll",[])},disabled:z.length===0||l||_e||w,children:[e.jsx(O.oa,{name:"close",size:14})," ",ue.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:[e.jsx(O.oa,{name:"file",size:14})," ",ue.statementPanelTitle??"Bank Statement",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:Ft.length})]})}),e.jsx("div",{ref:me,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:Ft.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(O.oa,{name:"clipboard",size:32})}),ue.noStatements??"No statement items"]}):Ft.map(E=>e.jsx(Oa,{item:{...E,status:Ie.has(E.id)?"matched":"unmatched"},isSelected:Ye.has(E.id),isDragging:Ge===E.id,isDropTarget:be===E.id,suggestion:j.find(se=>se.statementId===E.id),currency:pe,locale:De,onSelect:()=>{l||ke(se=>{const de=new Set(se);return de.has(E.id)?de.delete(E.id):de.add(E.id),de})},onDoubleClick:()=>R&&Pe({type:"statement",id:E.id}),onDragStart:()=>J(E.id),onDragEnd:()=>{J(null),je(null)},onDrop:()=>{Ge&&Ge!==E.id&&Ne(E.id,"statement",Ge,"entry")},disabled:l||_e||!ge},E.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:[e.jsx(O.oa,{name:"book",size:14})," ",ue.entryPanelTitle??"Book Entries",e.jsx("span",{className:"nice-reconciliation__panel-badge",children:mt.length})]})}),e.jsx("div",{ref:G,className:"nice-reconciliation__panel-content",role:"listbox","aria-multiselectable":"true",children:mt.length===0?e.jsxs("div",{className:"nice-reconciliation__empty",children:[e.jsx("div",{className:"nice-reconciliation__empty-icon",children:e.jsx(O.oa,{name:"book",size:32})}),ue.noEntries??"No book entries"]}):mt.map(E=>e.jsx(Ua,{item:{...E,status:$e.has(E.id)?"matched":"unmatched"},isSelected:Ee.has(E.id),isDragging:Ge===E.id,isDropTarget:be===E.id,currency:pe,locale:De,onSelect:()=>{l||Be(se=>{const de=new Set(se);return de.has(E.id)?de.delete(E.id):de.add(E.id),de})},onDoubleClick:()=>R&&Pe({type:"entry",id:E.id}),onDragStart:()=>J(E.id),onDragEnd:()=>{J(null),je(null)},onDrop:()=>{Ge&&Ge!==E.id&&Ne(E.id,"entry",Ge,"statement")},disabled:l||_e||!ge},E.id))})]})]}),Y&&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:[te.matchedStatements,"/",te.totalStatements," (",te.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(te.matchedAmount,pe,De)})]}),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(te.unmatchedStatementAmount,pe,De)})]}),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(te.difference)<.01?"nice-reconciliation__summary-value--success":"nice-reconciliation__summary-value--danger"}`,children:Tt(te.difference,pe,De)})]})]}),R&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`nice-reconciliation__detail-backdrop ${ee?"nice-reconciliation__detail-backdrop--visible":""}`,onClick:()=>Pe(null)}),e.jsx("div",{className:`nice-reconciliation__detail-panel ${ee?"nice-reconciliation__detail-panel--open":""}`,children:ee&&e.jsx(Ga,{type:ee.type,id:ee.id,statements:F,entries:he,matches:z,currency:pe,locale:De,labels:ue,onClose:()=>Pe(null)})})]})]})});function Ga({type:t,id:a,statements:s,entries:r,matches:o,currency:u,locale:g,labels:c,onClose:x}){const j=t==="statement"?s.find(A=>A.id===a):r.find(A=>A.id===a),D=t==="statement"?o.find(A=>A.statementIds.includes(a)):o.find(A=>A.entryIds.includes(a)),V=D?t==="statement"?r.filter(A=>D.entryIds.includes(A.id)):s.filter(A=>D.statementIds.includes(A.id)):[];if(!j)return null;const $=t==="statement",ae=$?j:null,W=$?null:j;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-reconciliation__detail-header",children:[e.jsxs("span",{className:"nice-reconciliation__detail-title",children:[e.jsx(O.oa,{name:$?"file":"book",size:14})," ",$?c.statementDetails??"Transaction Details":c.entryDetails??"Entry Details"]}),e.jsx("button",{type:"button",className:"nice-reconciliation__detail-close",onClick:x,"aria-label":"Close",children:e.jsx(O.oa,{name:"close",size:14})})]}),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:[e.jsx(O.oa,{name:"check",size:14})," ",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,g)})]}),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,g)})]})]}),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,g)})]})]}),e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(O.oa,{name:"clipboard",size:14})," ",$?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:Ln(j.date,g)})]}),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:j.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 ${j.amount>=0?"nice-reconciliation__row-amount--positive":"nice-reconciliation__row-amount--negative"}`,children:Tt(j.amount,u,g)})]}),$&&ae?.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:ae.counterparty})]}),$&&ae?.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:ae.counterpartyAccount})]}),!$&&W?.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:W.partyName})]}),!$&&W?.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:W.documentNumber})]}),$&&ae?.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:ae.referenceNumber})]})]}),V.length>0&&e.jsxs("div",{className:"nice-reconciliation__detail-section",children:[e.jsxs("div",{className:"nice-reconciliation__detail-section-title",children:[e.jsx(O.oa,{name:"link",size:14})," ",$?c.matchedEntries??"Matched Entries":c.matchedStatements??"Matched Statements"]}),V.map(A=>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:A.description}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"var(--nice-text-secondary)"},children:[e.jsx("span",{children:Ln(A.date,g)}),e.jsx("span",{style:{fontWeight:600,color:A.amount>=0?"var(--nice-success)":"var(--nice-danger)"},children:Tt(A.amount,u,g)})]})]},A.id))]})]})]})}function Wa(t,a,s){const r=new Map,o=[];t.forEach(g=>r.set(String(g[a]),{data:g,children:[],key:String(g[a]),depth:0})),t.forEach(g=>{const c=g[s],x=r.get(String(g[a]));if(c!=null&&c!==""&&r.has(String(c))){const j=r.get(String(c));x.depth=j.depth+1,j.children.push(x)}else o.push(x)});const u=(g,c)=>{g.forEach(x=>{x.depth=c,u(x.children,c+1)})};return u(o,0),o}function ki(t,a,s,r=0){return t.map(o=>({data:o,key:String(o[s]),depth:r,children:Array.isArray(o[a])?ki(o[a],a,s,r+1):[]}))}function Va(t){const a=[],s=r=>{r.forEach(o=>{a.push(o.key),s(o.children)})};return s(t),a}function Ka(t,a){const s=[],r=o=>{o.forEach(u=>{s.push(u),u.children.length>0&&a.has(u.key)&&r(u.children)})};return r(t),s}function Si(t,a,s){return!a||!s?t:[...t].sort((o,u)=>{const g=o.data[a]??"",c=u.data[a]??"",x=typeof g=="number"&&typeof c=="number"?g-c:String(g).localeCompare(String(c));return s==="desc"?-x:x}).map(o=>({...o,children:Si(o.children,a,s)}))}function qa({columns:t,data:a,keyField:s="id",parentKeyField:r="parentId",nested:o=!1,childrenField:u="children",expandedKeys:g,onExpandedChange:c,defaultExpandAll:x=!1,sortable:j=!0,sortField:D,sortDirection:V,onSort:$,selectable:ae,selectedKeys:W,onSelectionChange:A,searchable:k,searchPlaceholder:_,striped:f,compact:b,loading:N,emptyText:U,toolbar:Z,onRowClick:re,className:ye,style:T}){const{t:Y}=O.Gt(),le=n.useMemo(()=>o?ki(a,u,s):Wa(a,s,r),[a,s,r,o,u]),oe=n.useMemo(()=>Va(le),[le]),[ge,B]=n.useState(()=>x?new Set(oe):new Set),R=g?new Set(g):ge,[w,l]=n.useState({field:"",dir:null}),[_e,De]=n.useState(new Set),[ue,I]=n.useState(""),Q=D??w.field,F=V??w.dir,he=W??_e,pe=n.useMemo(()=>t.filter(J=>!J.hidden),[t]),Te=n.useCallback(J=>{const be=Q===J?F==="asc"?"desc":F==="desc"?null:"asc":"asc";$?$(J,be):l({field:J,dir:be})},[Q,F,$]),Ve=n.useCallback(J=>{const be=new Set(R);be.has(J)?be.delete(J):be.add(J),c?c([...be]):B(be)},[R,c]),Ye=n.useCallback(J=>{const be=new Set(he);be.has(J)?be.delete(J):be.add(J),A?A(be):De(be)},[he,A]),ke=n.useMemo(()=>{if(!ue)return le;const J=ue.toLowerCase(),be=je=>je.reduce((xe,M)=>{const ee=be(M.children);return(pe.some(z=>String(M.data[z.field]??"").toLowerCase().includes(J))||ee.length>0)&&xe.push({...M,children:ee}),xe},[]);return be(le)},[le,ue,pe]),Ee=n.useMemo(()=>Si(ke,Q,F),[ke,Q,F]),Be=n.useMemo(()=>Ka(Ee,R),[Ee,R]),Ge=({field:J})=>Q!==J||!F?e.jsx("span",{className:"nice-table__sort-icon",style:{opacity:.3},children:"↕"}):e.jsx("span",{className:"nice-table__sort-icon",children:e.jsx(O.oa,{name:F==="asc"?"sort-asc":"sort-desc",size:12})});return e.jsxs("div",{className:`nice-treegrid nice-datagrid ${ye||""}`,style:T,children:[(k||Z)&&e.jsxs("div",{className:"nice-datagrid__toolbar",children:[k&&e.jsx("div",{className:"nice-datagrid__search",children:e.jsx("input",{type:"text",value:ue,onChange:J=>I(J.target.value),placeholder:_||Y("controls.search","Search...")})}),Z]}),e.jsx("div",{className:"nice-datagrid__table-wrap",children:e.jsxs("table",{className:`${f?"nice-table--striped":""} ${b?"nice-table--compact":""}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[ae&&e.jsx("th",{className:"nice-datagrid__checkbox",style:{width:36}}),pe.map(J=>e.jsxs("th",{style:{width:J.width,minWidth:J.minWidth,textAlign:J.align},className:j&&J.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>j&&J.sortable!==!1&&Te(J.field),children:[J.header,j&&J.sortable!==!1&&e.jsx(Ge,{field:J.field})]},J.field))]})}),e.jsx("tbody",{children:N?e.jsx("tr",{children:e.jsx("td",{colSpan:pe.length+(ae?1:0),className:"nice-datagrid__empty",children:e.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):Be.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:pe.length+(ae?1:0),className:"nice-datagrid__empty",children:U||Y("controls.noData","No data available")})}):Be.map((J,be)=>{const je=he.has(J.key),xe=J.children.length>0,M=R.has(J.key);return e.jsxs("tr",{className:je?"nice-datagrid__row--selected":void 0,onClick:()=>re?.(J.data),style:re?{cursor:"pointer"}:void 0,children:[ae&&e.jsx("td",{className:"nice-datagrid__checkbox",onClick:ee=>ee.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:je,onChange:()=>Ye(J.key),"aria-label":`Select row ${J.key}`})}),pe.map((ee,Pe)=>e.jsxs("td",{style:{textAlign:ee.align},children:[Pe===0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{display:"inline-block",width:J.depth*20}}),e.jsx("button",{className:`nice-treegrid__toggle ${xe?"":"nice-treegrid__toggle--leaf"}`,onClick:z=>{z.stopPropagation(),xe&&Ve(J.key)},tabIndex:xe?0:-1,"aria-expanded":xe?M:void 0,"aria-label":xe?M?"Collapse":"Expand":void 0,children:xe?e.jsx(O.oa,{name:M?"chevron-down":"chevron-right",size:12}):""})]}),ee.render?ee.render(J.data[ee.field],J.data,be):String(J.data[ee.field]??"")]},ee.field))]},J.key)})})]})})]})}const ut={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Za=()=>e.jsxs("svg",{...ut,children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13"})]}),Xa=()=>e.jsxs("svg",{...ut,children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 15-6.7L21 13"})]}),Ha=()=>e.jsxs("svg",{...ut,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"})]}),Ya=()=>e.jsxs("svg",{...ut,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",{...ut,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"})]}),Ja=()=>e.jsxs("svg",{...ut,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"})]}),es=()=>e.jsxs("svg",{...ut,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"})]}),ts=()=>e.jsxs("svg",{...ut,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"})]}),ns=()=>e.jsxs("svg",{...ut,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"})]}),is=()=>e.jsx("svg",{...ut,children:e.jsx("polyline",{points:"6 9 12 4 18 9"})}),as=()=>e.jsx("svg",{...ut,children:e.jsx("polyline",{points:"6 15 12 20 18 15"})}),ss=()=>e.jsxs("svg",{...ut,style:{opacity:.55},children:[e.jsx("polyline",{points:"6 9 12 4 18 9"}),e.jsx("polyline",{points:"6 15 12 20 18 15"})]}),rs=()=>e.jsxs("svg",{...ut,children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),cs=()=>e.jsxs("svg",{...ut,children:[e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),e.jsx("line",{x1:"6",y1:"18",x2:"18",y2:"6"})]});function Ci(t){let a="",s=t;for(;s>=0;)a=String.fromCharCode(65+s%26)+a,s=Math.floor(s/26)-1;return a}function ze(t,a){return`${Ci(a)}${t+1}`}function Je(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 ls(t,a,s=new Set){const r=t.startsWith("=")?t.slice(1).trim():t,o=(k,_)=>{if(!k||!_)return[];const f=[];for(let b=k.row;b<=_.row;b++)for(let N=k.col;N<=_.col;N++){const U=He(ze(b,N),a,new Set(s));typeof U=="number"&&f.push(U)}return f},u=(k,_)=>{if(!k||!_)return[];const f=[];for(let b=k.row;b<=_.row;b++)for(let N=k.col;N<=_.col;N++)f.push(He(ze(b,N),a,new Set(s)));return f},g=r.match(/^(\w+)\(([A-Z]+\d+):([A-Z]+\d+)\)$/i);if(g){const k=g[1].toUpperCase(),_=Je(g[2].toUpperCase()),f=Je(g[3].toUpperCase());switch(k){case"SUM":return o(_,f).reduce((N,U)=>N+U,0);case"AVG":case"AVERAGE":{const b=o(_,f);return b.length>0?b.reduce((N,U)=>N+U,0)/b.length:0}case"COUNT":return o(_,f).length;case"COUNTA":return u(_,f).filter(b=>b!==null&&b!=="").length;case"COUNTBLANK":return u(_,f).filter(b=>b===null||b==="").length;case"MIN":{const b=o(_,f);return b.length?Math.min(...b):0}case"MAX":{const b=o(_,f);return b.length?Math.max(...b):0}case"MEDIAN":{const b=o(_,f).sort((U,Z)=>U-Z);if(!b.length)return 0;const N=Math.floor(b.length/2);return b.length%2?b[N]:(b[N-1]+b[N])/2}case"STDEV":{const b=o(_,f);if(b.length<2)return 0;const N=b.reduce((U,Z)=>U+Z,0)/b.length;return Math.sqrt(b.reduce((U,Z)=>U+(Z-N)**2,0)/(b.length-1))}case"PRODUCT":{const b=o(_,f);return b.length?b.reduce((N,U)=>N*U,1):0}}}const c=r.match(/^(SUMIF|COUNTIF)\(([A-Z]+\d+):([A-Z]+\d+)\s*,\s*"?([^"]*)"?\)$/i);if(c){const k=c[1].toUpperCase(),_=Je(c[2].toUpperCase()),f=Je(c[3].toUpperCase()),b=c[4];if(_&&f){let N=0;for(let U=_.row;U<=f.row;U++)for(let Z=_.col;Z<=f.col;Z++){const re=He(ze(U,Z),a,new Set(s));(b.startsWith(">")?Number(re)>Number(b.slice(1)):b.startsWith("<")?Number(re)<Number(b.slice(1)):String(re)===b||typeof re=="number"&&re===Number(b))&&(N+=k==="SUMIF"?typeof re=="number"?re:0:1)}return N}}const x=r.match(/^IF\(([^,]+),\s*([^,]+),\s*([^)]+)\)$/i);if(x){const k=x[1].trim(),_=x[2].trim(),f=x[3].trim(),b=k.match(/^([A-Z]+\d+)\s*([><=!]+)\s*(\S+)$/i);let N=!1;if(b){const re=He(b[1].toUpperCase(),a,new Set(s)),ye=isNaN(Number(b[3]))?b[3].replace(/^"|"$/g,""):Number(b[3]),T=b[2],Y=typeof re=="number"?re:Number(re)||0,le=typeof ye=="number"?ye:Number(ye)||0;switch(T){case">":N=Y>le;break;case"<":N=Y<le;break;case">=":N=Y>=le;break;case"<=":N=Y<=le;break;case"=":case"==":N=Y===le;break;case"<>":case"!=":N=Y!==le;break}}const U=N?_:f;if(Je(U.toUpperCase()))return He(U.toUpperCase(),a,new Set(s));const Z=Number(U);return isNaN(Z)?U.replace(/^"|"$/g,""):Z}const j=r.match(/^CONCAT\((.+)\)$/i);if(j)return j[1].split(",").map(_=>_.trim()).map(_=>{if(_.startsWith('"')&&_.endsWith('"'))return _.slice(1,-1);if(Je(_.toUpperCase())){const b=He(_.toUpperCase(),a,new Set(s));return b!==null?String(b):""}return _}).join("");const D=r.match(/^VLOOKUP\(([^,]+),\s*([A-Z]+\d+):([A-Z]+\d+),\s*(\d+)\)$/i);if(D){let k;Je(D[1].trim().toUpperCase())?k=He(D[1].trim().toUpperCase(),a,new Set(s)):k=isNaN(Number(D[1]))?D[1].replace(/^"|"$/g,""):Number(D[1]);const f=Je(D[2].toUpperCase()),b=Je(D[3].toUpperCase()),N=parseInt(D[4])-1;if(f&&b)for(let U=f.row;U<=b.row;U++){const Z=He(ze(U,f.col),a,new Set(s));if(String(Z)===String(k))return He(ze(U,f.col+N),a,new Set(s))}return null}const V=r.match(/^(ABS|ROUND|FLOOR|CEIL|CEILING|SQRT|LEN|UPPER|LOWER|TRIM|INT)\(([^)]+)\)$/i);if(V){const k=V[1].toUpperCase(),_=V[2].trim();let f;switch(Je(_.toUpperCase())?f=He(_.toUpperCase(),a,new Set(s)):f=isNaN(Number(_))?_.replace(/^"|"$/g,""):Number(_),k){case"ABS":return Math.abs(Number(f)||0);case"ROUND":return Math.round(Number(f)||0);case"FLOOR":return Math.floor(Number(f)||0);case"CEIL":case"CEILING":return Math.ceil(Number(f)||0);case"SQRT":return Math.sqrt(Number(f)||0);case"INT":return Math.trunc(Number(f)||0);case"LEN":return String(f??"").length;case"UPPER":return String(f??"").toUpperCase();case"LOWER":return String(f??"").toLowerCase();case"TRIM":return String(f??"").trim()}}const $=r.match(/^POWER\(([^,]+),\s*([^)]+)\)$/i);if($){const k=Number(Je($[1].trim().toUpperCase())?He($[1].trim().toUpperCase(),a,new Set(s)):$[1].trim())||0,_=Number(Je($[2].trim().toUpperCase())?He($[2].trim().toUpperCase(),a,new Set(s)):$[2].trim())||0;return Math.pow(k,_)}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 ae=r.match(/^([A-Z]+\d+)$/i);if(ae)return He(ae[1].toUpperCase(),a,s);const W=r.match(/^([A-Z]+\d+)\s*([+\-*/])\s*([A-Z]+\d+|\d+\.?\d*)$/i);if(W){const k=W[1].toUpperCase(),_=W[2],f=W[3],b=He(k,a,s),U=Je(f.toUpperCase())?He(f.toUpperCase(),a,s):parseFloat(f),Z=typeof b=="number"?b:0,re=typeof U=="number"?U:0;switch(_){case"+":return Z+re;case"-":return Z-re;case"*":return Z*re;case"/":return re!==0?Z/re:null}}const A=parseFloat(r);return isNaN(A)?r:A}function He(t,a,s){if(s.has(t))return null;s.add(t);const r=a[t];return r?r.formula?ls(r.formula,a,s):r.value:null}function fi(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 gi(t){return{name:t,data:{}}}const Mi=n.forwardRef(({sheets:t,activeSheet:a,rows:s=50,cols:r=26,showToolbar:o=!0,showFormulaBar:u=!0,showSheetTabs:g=!0,readOnly:c=!1,onChange:x,onActiveSheetChange:j,onCellSelect:D,onCopy:V,onPaste:$,onInsert:ae,onRemove:W,maxUndo:A=50,sortable:k=!1,filterable:_=!1,rangeSelection:f=!0,className:b,style:N,id:U,...Z},re)=>{const ye=O.hc(U),{t:T}=O.Gt(),[Y,le]=n.useState(()=>t??[gi(T("spreadsheet.sheet","Sheet")+" 1")]),[oe,ge]=n.useState(0),B=t??Y,R=a??oe,w=B[R]??B[0],[l,_e]=n.useState(null),[De,ue]=n.useState(null),[I,Q]=n.useState(!1),[F,he]=n.useState(null),[pe,Te]=n.useState(""),Ve=n.useRef(null),Ye=n.useRef(null),[ke,Ee]=n.useState([]),[Be,Ge]=n.useState([]),[J,be]=n.useState(null),je=n.useRef({x:0,width:80}),[xe,M]=n.useState(null),[ee,Pe]=n.useState(null),[z,me]=n.useState("");n.useEffect(()=>{F&&Ve.current&&Ve.current.focus()},[F]);const G=n.useMemo(()=>{if(!l)return null;const m=De??l;return{startRow:Math.min(l.row,m.row),startCol:Math.min(l.col,m.col),endRow:Math.max(l.row,m.row),endCol:Math.max(l.col,m.col)}},[l,De]),Ie=n.useCallback((m,h)=>G?m>=G.startRow&&m<=G.endRow&&h>=G.startCol&&h<=G.endCol:!1,[G]),$e=n.useCallback(m=>{Ee(h=>{const L=[...h,m.map(q=>({...q,data:{...q.data}}))];return L.length>A?L.slice(-A):L}),Ge([])},[A]),te=n.useCallback((m,h=!0)=>{h&&$e(B);const L=m(B);t||le(L),x?.(L)},[B,t,x,$e]),Ke=n.useCallback(()=>{if(ke.length===0)return;const m=ke[ke.length-1];Ge(h=>[...h,B.map(L=>({...L,data:{...L.data}}))]),Ee(h=>h.slice(0,-1)),t||le(m),x?.(m)},[ke,B,t,x]),Qe=n.useCallback(()=>{if(Be.length===0)return;const m=Be[Be.length-1];Ee(h=>[...h,B.map(L=>({...L,data:{...L.data}}))]),Ge(h=>h.slice(0,-1)),t||le(m),x?.(m)},[Be,B,t,x]),it=n.useCallback(m=>{a||ge(m),j?.(m),_e(null),ue(null),he(null)},[a,j]),Ne=n.useCallback((m,h,L)=>{const q=ze(m,h);te(ie=>{const P=ie.map((X,H)=>H===R?{...X,data:{...X.data}}:X),S=L.startsWith("=");return P[R].data[q]={...P[R].data[q]??{value:null},formula:S?L:void 0,value:S?null:isNaN(Number(L))?L:Number(L)},P})},[R,te]),jt=n.useCallback((m,h,L)=>{L?.shiftKey&&f&&l?ue({row:m,col:h}):(_e({row:m,col:h}),ue(null)),he(null),D?.(R,m,h)},[R,D,f,l]),Ft=n.useCallback((m,h,L)=>{L.button===0&&(jt(m,h,L),f&&!L.shiftKey&&Q(!0))},[jt,f]),mt=n.useCallback((m,h)=>{I&&ue({row:m,col:h})},[I]);n.useEffect(()=>{if(!I)return;const m=()=>Q(!1);return document.addEventListener("mouseup",m),()=>document.removeEventListener("mouseup",m)},[I]);const Nt=n.useCallback((m,h)=>{if(c)return;const L=ze(m,h),q=w.data[L];q?.readOnly||(he({row:m,col:h}),Te(q?.formula??(q?.value!=null?String(q.value):"")))},[c,w.data]),E=n.useCallback(()=>{F&&(Ne(F.row,F.col,pe),he(null))},[F,pe,Ne]),se=n.useCallback(m=>{if(m.key==="Enter")E();else if(m.key==="Escape")he(null);else if(m.key==="Tab"&&(m.preventDefault(),E(),l)){const h=m.shiftKey?Math.max(0,l.col-1):Math.min(r-1,l.col+1);_e({row:l.row,col:h})}},[E,l,r]),de=n.useCallback((m,h)=>{if(!l)return;const L=G??{startRow:l.row,startCol:l.col,endRow:l.row,endCol:l.col};te(q=>{const ie=q.map((P,S)=>S===R?{...P,data:{...P.data}}:P);for(let P=L.startRow;P<=L.endRow;P++)for(let S=L.startCol;S<=L.endCol;S++){const X=ze(P,S);ie[R].data[X]={...ie[R].data[X]??{value:null},[m]:h}}return ie})},[l,G,R,te]),Ze=n.useCallback(m=>{if(!G||V?.(G)===!1)return;const{startRow:h,startCol:L,endRow:q,endCol:ie}=G,P=[];for(let S=h;S<=q;S++){const X=[];for(let H=L;H<=ie;H++){const Oe=ze(S,H),Re=w.data[Oe],Ce=Re?He(Oe,w.data,new Set):null;X.push(fi(Ce,Re?.format))}P.push(X.join(" "))}m.clipboardData.setData("text/plain",P.join(`
|
|
595
|
+
`)),m.preventDefault()},[G,w.data,V]),rt=n.useCallback(m=>{if(c||!l)return;const h=m.clipboardData.getData("text/plain");if(!h)return;const L=h.split(`
|
|
596
|
+
`).map(q=>q.split(" "));$?.(L,l.row,l.col)!==!1&&(te(q=>{const ie=q.map((P,S)=>S===R?{...P,data:{...P.data}}:P);return L.forEach((P,S)=>{P.forEach((X,H)=>{const Oe=ze(l.row+S,l.col+H),Re=X.startsWith("=");ie[R].data[Oe]={...ie[R].data[Oe]??{value:null},formula:Re?X:void 0,value:Re?null:isNaN(Number(X))?X:Number(X)}})}),ie}),m.preventDefault())},[c,l,R,te,$]),we=n.useCallback(m=>{te(h=>h.map((q,ie)=>{if(ie!==R)return q;const P={};for(const[S,X]of Object.entries(q.data)){const H=Je(S);H&&(H.row>m?P[ze(H.row+1,H.col)]=X:P[S]=X)}return{...q,data:P}})),ae?.("row",m)},[R,te,ae]),Fe=n.useCallback(m=>{te(h=>h.map((q,ie)=>{if(ie!==R)return q;const P={};for(const[S,X]of Object.entries(q.data)){const H=Je(S);H&&(H.col>m?P[ze(H.row,H.col+1)]=X:P[S]=X)}return{...q,data:P}})),ae?.("column",m)},[R,te,ae]),Se=n.useCallback(m=>{te(h=>h.map((q,ie)=>{if(ie!==R)return q;const P={};for(const[S,X]of Object.entries(q.data)){const H=Je(S);H&&H.row!==m&&(H.row>m?P[ze(H.row-1,H.col)]=X:P[S]=X)}return{...q,data:P}})),W?.("row",m)},[R,te,W]),ct=n.useCallback(m=>{te(h=>h.map((q,ie)=>{if(ie!==R)return q;const P={};for(const[S,X]of Object.entries(q.data)){const H=Je(S);H&&H.col!==m&&(H.col>m?P[ze(H.row,H.col-1)]=X:P[S]=X)}return{...q,data:P}})),W?.("column",m)},[R,te,W]),qe=n.useCallback((m,h)=>{te(L=>L.map((ie,P)=>{if(P!==R)return ie;const S=new Map;for(const[Oe,Re]of Object.entries(ie.data)){const Ce=Je(Oe);Ce&&(S.has(Ce.row)||S.set(Ce.row,{}),S.get(Ce.row)[Ce.col]=Re)}const X=Array.from(S.entries()).sort((Oe,Re)=>{const Ce=He(ze(Oe[0],m),ie.data,new Set),et=He(ze(Re[0],m),ie.data,new Set),qt=typeof Ce=="number"?Ce:Number(Ce),en=typeof et=="number"?et:Number(et);if(!isNaN(qt)&&!isNaN(en))return h==="asc"?qt-en:en-qt;const nt=String(Ce??""),Ot=String(et??"");return h==="asc"?nt.localeCompare(Ot):Ot.localeCompare(nt)}),H={};return X.forEach(([,Oe],Re)=>{for(const[Ce,et]of Object.entries(Oe))H[ze(Re,Number(Ce))]=et}),{...ie,data:H,sortColumn:m,sortDirection:h}}))},[R,te]),wt=n.useCallback((m,h)=>{const L=w.conditionalFormats;if(!L?.length)return;const q=ze(m,h),ie=He(q,w.data,new Set),P=typeof ie=="number"?ie:Number(ie);for(const S of L){const X=S.range.match(/^([A-Z]+\d+):([A-Z]+\d+)$/i);if(!X)continue;const H=Je(X[1].toUpperCase()),Oe=Je(X[2].toUpperCase());if(!H||!Oe||m<H.row||m>Oe.row||h<H.col||h>Oe.col)continue;let Re=!1;switch(S.type){case"greaterThan":Re=!isNaN(P)&&P>Number(S.value);break;case"lessThan":Re=!isNaN(P)&&P<Number(S.value);break;case"equalTo":Re=String(ie)===String(S.value);break;case"between":Re=!isNaN(P)&&P>=Number(S.value)&&P<=Number(S.value2);break;case"textContains":Re=String(ie).includes(String(S.value));break;case"isEmpty":Re=ie===null||ie==="";break;case"isNotEmpty":Re=ie!==null&&ie!=="";break}if(Re)return{backgroundColor:S.style.bgColor,color:S.style.color,fontWeight:S.style.bold?"bold":void 0,fontStyle:S.style.italic?"italic":void 0}}},[w.conditionalFormats,w.data]),bt=n.useCallback(()=>{const m=`${T("spreadsheet.sheet","Sheet")} ${B.length+1}`;te(h=>[...h,gi(m)]),it(B.length)},[B.length,te,it,T]),cn=n.useCallback(()=>{B.length<=1||(te(m=>m.filter((h,L)=>L!==R)),it(Math.max(0,R-1)))},[B.length,R,te,it]),Yt=n.useCallback((m,h)=>{h.trim()&&(te(L=>L.map((q,ie)=>ie===m?{...q,name:h.trim()}:q),!1),Pe(null))},[te]),Qt=n.useMemo(()=>{if(!l)return"";const m=ze(l.row,l.col),h=w.data[m];return h?.formula??(h?.value!=null?String(h.value):"")},[l,w.data]),at=n.useMemo(()=>{if(!G)return null;const{startRow:m,startCol:h,endRow:L,endCol:q}=G;if(m===L&&h===q)return null;const ie=[];let P=0;for(let S=m;S<=L;S++)for(let X=h;X<=q;X++){const H=ze(S,X),Oe=He(H,w.data,new Set);Oe!==null&&Oe!==""&&P++,typeof Oe=="number"&&ie.push(Oe)}return ie.length===0?{count:P}:{count:P,sum:ie.reduce((S,X)=>S+X,0),avg:ie.reduce((S,X)=>S+X,0)/ie.length,min:Math.min(...ie),max:Math.max(...ie)}},[G,w.data]),Pn=n.useCallback((m,h)=>{h.preventDefault(),h.stopPropagation(),be(m),je.current={x:h.clientX,width:w.colWidths?.[m]??80}},[w.colWidths]);n.useEffect(()=>{if(J===null)return;const m=L=>{const q=L.clientX-je.current.x,ie=Math.max(30,je.current.width+q);te(P=>P.map((X,H)=>H===R?{...X,colWidths:{...X.colWidths,[J]:ie}}:X),!1)},h=()=>be(null);return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h)}},[J,R,te]);const Sn=n.useCallback((m,h,L)=>{m.preventDefault(),_e({row:h,col:L}),M({x:m.clientX,y:m.clientY})},[]);n.useEffect(()=>{if(!xe)return;const m=()=>M(null);return document.addEventListener("click",m),()=>document.removeEventListener("click",m)},[xe]);const Jt=n.useCallback(m=>{if((m.ctrlKey||m.metaKey)&&!F){if(m.key==="z"){m.preventDefault(),Ke();return}if(m.key==="y"){m.preventDefault(),Qe();return}}if(F||!l)return;let{row:h,col:L}=l;switch(m.key){case"ArrowUp":h=Math.max(0,h-1);break;case"ArrowDown":h=Math.min(s-1,h+1);break;case"ArrowLeft":L=Math.max(0,L-1);break;case"ArrowRight":L=Math.min(r-1,L+1);break;case"Enter":Nt(h,L);return;case"Delete":case"Backspace":c||(G&&(G.startRow!==G.endRow||G.startCol!==G.endCol)?te(q=>{const ie=q.map((P,S)=>S===R?{...P,data:{...P.data}}:P);for(let P=G.startRow;P<=G.endRow;P++)for(let S=G.startCol;S<=G.endCol;S++)delete ie[R].data[ze(P,S)];return ie}):Ne(h,L,""));return;default:if(m.key.length===1&&!m.ctrlKey&&!m.metaKey&&!c){he({row:h,col:L}),Te(m.key);return}return}m.preventDefault(),m.shiftKey&&f?ue({row:h,col:L}):(_e({row:h,col:L}),ue(null)),D?.(R,h,L)},[F,l,s,r,c,Nt,Ne,R,D,Ke,Qe,G,te,f]),ln=w.frozenRows??0,kt=w.frozenCols??0,fn=[{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:re,id:ye,className:`nice-spreadsheet ${c?"nice-spreadsheet--readonly":""} ${b??""}`,style:N,onKeyDown:Jt,onCopy:Ze,onPaste:rt,tabIndex:0,role:"application","aria-label":T("spreadsheet.label","Spreadsheet"),...Z,children:[o&&!c&&e.jsxs("div",{className:"nice-spreadsheet__toolbar",role:"toolbar",children:[e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:Ke,disabled:ke.length===0,title:T("spreadsheet.undo","Undo"),children:e.jsx(Za,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:Qe,disabled:Be.length===0,title:T("spreadsheet.redo","Redo"),children:e.jsx(Xa,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Le.NiceButton,{variant:w.data[l?ze(l.row,l.col):""]?.bold?"primary":"ghost",size:"sm",onClick:()=>de("bold",!w.data[l?ze(l.row,l.col):""]?.bold),title:T("spreadsheet.bold","Bold"),children:e.jsx("strong",{children:"B"})}),e.jsx(Le.NiceButton,{variant:w.data[l?ze(l.row,l.col):""]?.italic?"primary":"ghost",size:"sm",onClick:()=>de("italic",!w.data[l?ze(l.row,l.col):""]?.italic),title:T("spreadsheet.italic","Italic"),children:e.jsx("em",{children:"I"})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>de("align","left"),title:T("spreadsheet.alignLeft","Align left"),children:e.jsx(Ha,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>de("align","center"),title:T("spreadsheet.alignCenter","Center"),children:e.jsx(Ya,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>de("align","right"),title:T("spreadsheet.alignRight","Align right"),children:e.jsx(Qa,{})}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Le.NiceColorPicker,{value:w.data[l?ze(l.row,l.col):""]?.bgColor??"var(--bg-primary, #ffffff)",onChange:m=>de("bgColor",m),title:T("spreadsheet.bgColor","Background color"),showInput:!1,showRandom:!1}),e.jsx(Le.NiceColorPicker,{value:w.data[l?ze(l.row,l.col):""]?.color??"var(--text-primary, #000000)",onChange:m=>de("color",m),title:T("spreadsheet.textColor","Text color"),showInput:!1,showRandom:!1}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Le.NiceSelect,{size:"sm",value:w.data[l?ze(l.row,l.col):""]?.format??"text",onChange:m=>de("format",m),options:fn,"aria-label":T("spreadsheet.format","Cell format")}),e.jsx("span",{className:"nice-spreadsheet__separator"}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&we(l.row),title:T("spreadsheet.insertRow","Insert row"),children:e.jsx(Ja,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&Fe(l.col),title:T("spreadsheet.insertCol","Insert column"),children:e.jsx(es,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&Se(l.row),title:T("spreadsheet.deleteRow","Delete row"),children:e.jsx(ts,{})}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>l&&ct(l.col),title:T("spreadsheet.deleteCol","Delete column"),children:e.jsx(ns,{})})]}),u&&e.jsxs("div",{className:"nice-spreadsheet__formula-bar",children:[e.jsxs("span",{className:"nice-spreadsheet__cell-label",children:[l?ze(l.row,l.col):"",G&&G.startRow!==G.endRow||G&&G.startCol!==G.endCol?`:${ze(G.endRow,G.endCol)}`:""]}),e.jsx(Le.NiceTextInput,{className:"nice-spreadsheet__formula-input",value:F?pe:Qt,onChange:m=>{F?Te(m):l&&(he(l),Te(m))},onKeyDown:se,readOnly:c,"aria-label":T("spreadsheet.formulaBar","Formula bar")})]}),e.jsx("div",{className:"nice-spreadsheet__grid",ref:Ye,children:e.jsxs("table",{role:"grid","aria-label":w.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:w.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:Ci(h)}),k&&e.jsx("span",{className:"nice-spreadsheet__sort-trigger",onClick:()=>qe(h,w.sortColumn===h&&w.sortDirection==="asc"?"desc":"asc"),title:T("spreadsheet.sort","Sort"),children:w.sortColumn===h?w.sortDirection==="asc"?e.jsx(is,{}):e.jsx(as,{}):e.jsx(ss,{})}),!c&&e.jsx("span",{className:"nice-spreadsheet__col-resize",onMouseDown:L=>Pn(h,L)})]},h))]})}),e.jsx("tbody",{children:Array.from({length:s},(m,h)=>e.jsxs("tr",{className:h<ln?"nice-spreadsheet__row--frozen":"",style:h<ln?{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},(L,q)=>{const ie=ze(h,q),P=w.data[ie];if(P?.mergedInto)return null;const S=l?.row===h&&l?.col===q,X=Ie(h,q),H=F?.row===h&&F?.col===q,Oe=P?He(ie,w.data,new Set):null,Re=wt(h,q),Ce=h<ln||q<kt;return e.jsxs("td",{className:`nice-spreadsheet__cell ${S?"nice-spreadsheet__cell--selected":""} ${X&&!S?"nice-spreadsheet__cell--in-range":""} ${P?.readOnly?"nice-spreadsheet__cell--readonly":""} ${Ce?"nice-spreadsheet__cell--frozen":""}`,style:{textAlign:P?.align,fontWeight:P?.bold?"bold":void 0,fontStyle:P?.italic?"italic":void 0,backgroundColor:Re?.backgroundColor??P?.bgColor,color:Re?.color??P?.color,width:w.colWidths?.[q],height:w.rowHeights?.[h],position:Ce?"sticky":void 0,left:q<kt?q*80+40:void 0,zIndex:Ce?1:void 0,...Re},colSpan:P?.colSpan,rowSpan:P?.rowSpan,onMouseDown:et=>Ft(h,q,et),onMouseEnter:()=>mt(h,q),onDoubleClick:()=>Nt(h,q),onContextMenu:et=>Sn(et,h,q),role:"gridcell","aria-selected":S,title:P?.comment,children:[P?.comment&&e.jsx("span",{className:"nice-spreadsheet__comment-indicator"}),H?e.jsx("input",{ref:Ve,className:"nice-spreadsheet__cell-editor",value:pe,onChange:et=>Te(et.target.value),onKeyDown:se,onBlur:E}):fi(Oe,P?.format)]},q)})]},h))})]})}),xe&&!c&&l&&e.jsxs("div",{className:"nice-spreadsheet__context-menu",style:{position:"fixed",left:xe.x,top:xe.y,zIndex:1e3},children:[e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{we(l.row),M(null)},children:T("spreadsheet.insertRowAbove","Insert row above")}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{we(l.row+1),M(null)},children:T("spreadsheet.insertRowBelow","Insert row below")}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Fe(l.col),M(null)},children:T("spreadsheet.insertColLeft","Insert column left")}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Fe(l.col+1),M(null)},children:T("spreadsheet.insertColRight","Insert column right")}),e.jsx("hr",{className:"nice-spreadsheet__context-sep"}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{Se(l.row),M(null)},children:T("spreadsheet.deleteRow","Delete row")}),e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:()=>{ct(l.col),M(null)},children:T("spreadsheet.deleteCol","Delete column")})]}),at&&e.jsxs("div",{className:"nice-spreadsheet__status-bar",children:[e.jsxs("span",{children:[T("spreadsheet.count","Count"),": ",at.count]}),at.sum!==void 0&&e.jsxs("span",{children:[T("spreadsheet.sum","Sum"),": ",at.sum.toFixed(2)]}),at.avg!==void 0&&e.jsxs("span",{children:[T("spreadsheet.avg","Avg"),": ",at.avg.toFixed(2)]}),at.min!==void 0&&e.jsxs("span",{children:[T("spreadsheet.min","Min"),": ",at.min]}),at.max!==void 0&&e.jsxs("span",{children:[T("spreadsheet.max","Max"),": ",at.max]})]}),g&&e.jsxs("div",{className:"nice-spreadsheet__tabs",role:"tablist",children:[B.map((m,h)=>e.jsx("span",{className:"nice-spreadsheet__tab-wrapper",children:ee===h?e.jsx(Le.NiceTextInput,{className:"nice-spreadsheet__tab-rename",value:z,onChange:L=>me(L),onBlur:()=>Yt(h,z),onKeyDown:L=>{L.key==="Enter"&&Yt(h,z),L.key==="Escape"&&Pe(null)},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>{c||(Pe(h),me(m.name))},children:e.jsx(Le.NiceButton,{variant:h===R?"primary":"ghost",size:"sm",onClick:()=>it(h),children:m.name})})},h)),!c&&e.jsxs(e.Fragment,{children:[e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:bt,title:T("spreadsheet.addSheet","Add sheet"),children:e.jsx(rs,{})}),B.length>1&&e.jsx(Le.NiceButton,{variant:"ghost",size:"sm",onClick:cn,title:T("spreadsheet.removeSheet","Remove sheet"),children:e.jsx(cs,{})})]})]})]})});Mi.displayName="NiceSpreadsheet";const os=({queries:t,currentFilter:a,currentColumns:s,currentSort:r,onLoad:o,onSave:u,onUpdate:g,onDelete:c,onShare:x,onSetDefault:j,allowSharing:D=!0,allowPinning:V=!0,position:$="dropdown",className:ae,style:W,"data-testid":A})=>{const[k,_]=n.useState(!1),[f,b]=n.useState(""),[N,U]=n.useState(!1),[Z,re]=n.useState(""),[ye,T]=n.useState(""),[Y,le]=n.useState(!1),oe=t.filter(l=>l.name.toLowerCase().includes(f.toLowerCase())),ge=oe.filter(l=>!l.isShared),B=oe.filter(l=>l.isShared),R=async()=>{if(Z.trim()){U(!0);try{await u({name:Z,description:ye||void 0,filter:a??{},columns:s,sort:r}),le(!1),re(""),T("")}finally{U(!1)}}},w=l=>e.jsxs("div",{className:"nice-saved-query__item",children:[l.icon&&e.jsx("span",{className:"nice-saved-query__icon","aria-hidden":"true",children:l.icon}),e.jsx("span",{className:"nice-saved-query__name",children:l.name}),l.isDefault&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--default",children:"domyślne"}),l.isShared&&e.jsx("span",{className:"nice-saved-query__badge nice-saved-query__badge--shared",children:"udostępnione"}),l.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:()=>{o(l),_(!1)},type:"button",children:"Wczytaj"}),j&&e.jsx("button",{onClick:()=>j(l.id),type:"button",title:"Ustaw domyślne","aria-label":"Ustaw domyślne",children:e.jsx(O.oa,{name:"star",size:14})}),D&&x&&e.jsx("button",{onClick:()=>x(l.id,[]),type:"button",title:"Udostępnij","aria-label":"Udostępnij",children:e.jsx(O.oa,{name:"external-link",size:14})}),V&&e.jsx("button",{onClick:()=>g(l.id,{...l}),type:"button",title:"Przypnij","aria-label":"Przypnij",children:e.jsx(O.oa,{name:"map-pin",size:14})}),e.jsx("button",{onClick:()=>c(l.id),type:"button",title:"Usuń","aria-label":`Usuń zapytanie ${l.name}`,children:e.jsx(O.oa,{name:"close",size:14})})]})]},l.id);return e.jsxs("div",{className:`nice-saved-query nice-saved-query--${$} ${k?"nice-saved-query--open":""} ${ae??""}`,style:W,"data-testid":A,children:[e.jsx("button",{className:"nice-saved-query__trigger",onClick:()=>_(l=>!l),"aria-expanded":k,"aria-haspopup":"listbox",type:"button",children:"Widoki i zapytania"}),k&&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:f,onChange:l=>b(l.target.value),"aria-label":"Szukaj zapytania"}),e.jsx("button",{onClick:()=>le(l=>!l),type:"button",children:"+ Zapisz bieżący widok"})]}),Y&&e.jsxs("div",{className:"nice-saved-query__save-form",children:[e.jsx("input",{type:"text",placeholder:"Nazwa zapytania",value:Z,onChange:l=>re(l.target.value),"aria-label":"Nazwa zapytania"}),e.jsx("input",{type:"text",placeholder:"Opis (opcjonalnie)",value:ye,onChange:l=>T(l.target.value),"aria-label":"Opis zapytania"}),e.jsx("button",{onClick:R,disabled:N||!Z.trim(),type:"button",children:N?"Zapisywanie…":"Zapisz"}),e.jsx("button",{onClick:()=>le(!1),type:"button",children:"Anuluj"})]}),ge.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"}),ge.map(w)]}),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(w)]}),oe.length===0&&e.jsx("p",{className:"nice-saved-query__empty",children:"Brak zapisanych zapytań"})]})]})};exports.NiceCardView=ha;exports.NiceDataGrid=Tn;exports.NiceDataGrid$1=sa;exports.NiceDataGridAI=oa;exports.NiceFilterBuilder=Xn;exports.NiceKanbanBoard=wi;exports.NiceList=da;exports.NiceModuleGrid=La;exports.NicePivotGrid=Ni;exports.NicePivotGrid$1=ga;exports.NicePivotGridFieldChooser=ji;exports.NiceReconciliationView=Ba;exports.NiceSavedQueryPanel=os;exports.NiceSpreadsheet=Mi;exports.NiceTable=Xi;exports.NiceTileView=pa;exports.NiceTreeGrid=qa;exports.NiceTreeList=ma;exports.NiceTreeView=Zi;exports.computeAggregate=yi;exports.escapeCsvField=wn;
|