@nice2dev/ui 1.0.31 → 1.1.5
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 +353 -0
- package/dist/NiceCodeEditor-BVUwp9yX.js +1134 -0
- package/dist/NiceCodeEditor-cIqUSk3j.cjs +260 -0
- package/dist/NiceColorPicker-C8NZZcXE.js +596 -0
- package/dist/NiceColorPicker-CKVbjicN.cjs +1 -0
- package/dist/NiceConfirmDialog-DmBX1Iea.js +81 -0
- package/dist/NiceConfirmDialog-oSxVpsCs.cjs +1 -0
- package/dist/NiceDataGrid-3AIf2D3t.cjs +10 -0
- package/dist/NiceDataGrid-CXCUAkRb.js +1736 -0
- package/dist/NiceDocumentViewer-B-uEPZAf.js +672 -0
- package/dist/NiceDocumentViewer-BE0gKBlw.cjs +180 -0
- package/dist/NiceForm-C6F0HvrX.cjs +1 -0
- package/dist/NiceForm-CCyfWgIs.js +4805 -0
- package/dist/NiceGantt-CSFLZD2y.js +328 -0
- package/dist/NiceGantt-_ysNSVYR.cjs +1 -0
- package/dist/NiceHtmlEditor-B8B8AcSC.js +841 -0
- package/dist/NiceHtmlEditor-D8RQcBNp.cjs +10 -0
- package/dist/NiceLoginForm-Bai7aN8V.js +708 -0
- package/dist/NiceLoginForm-BrvIc-wq.cjs +1 -0
- package/dist/NiceMention-CWoLD0SE.js +11082 -0
- package/dist/NiceMention-J1lUDLhg.cjs +430 -0
- package/dist/NiceMention.css +1 -0
- package/dist/NiceModal-0UxviEYE.cjs +1 -0
- package/dist/NiceModal-D-iOonog.js +95 -0
- package/dist/NiceModuleLifecyclePanel-4hzDw6it.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-Df_1k5qW.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-CPn-Q1h_.js +172 -0
- package/dist/NicePagination-EEQ6o1dF.cjs +1 -0
- package/dist/NicePivotGrid-Cmiolup9.cjs +152 -0
- package/dist/NicePivotGrid-DX_iUj2X.js +1167 -0
- package/dist/NiceSavedQueryPanel-BhjFJBvn.cjs +586 -0
- package/dist/NiceSavedQueryPanel-KvyXTnFx.js +5129 -0
- package/dist/NiceScheduler-DuxPzQQZ.js +1645 -0
- package/dist/NiceScheduler-nW7fMzKL.cjs +5 -0
- package/dist/NiceSelect-BVoqtfYN.cjs +1 -0
- package/dist/NiceSelect-DHowflmX.js +433 -0
- package/dist/NiceWindow-DdD9k4nc.cjs +1 -0
- package/dist/NiceWindow-xnTSHdHv.js +1623 -0
- package/dist/charts-B-sl1V9y.cjs +882 -0
- package/dist/charts-DO2z6Ziu.js +31920 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +7 -7
- package/dist/core-C2KhqEaU.cjs +1 -0
- package/dist/core-K2DIxXLn.js +795 -0
- package/dist/data-branching-DC6hcBQN.cjs +1 -0
- package/dist/data-branching-DykdTpjJ.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.d.ts +29 -7
- package/dist/data.mjs +18 -16
- package/dist/devops-CU0sOVEA.cjs +17 -0
- package/dist/devops-CXyEwQeM.js +8165 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +73 -1
- package/dist/editors.mjs +58 -54
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +5137 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +115 -13
- package/dist/index.mjs +66371 -992
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/navigation.mjs +4 -4
- package/dist/no-code-C58g8_fb.cjs +332 -0
- package/dist/no-code-Cj4xJ3w9.js +7425 -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 +2 -0
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-B-wOzHFh.cjs +1 -0
- package/dist/pickerCommons-COiSUiP2.js +1122 -0
- package/dist/style.css +6 -6
- package/dist/vendor-BPVpdtPp.js +271 -0
- package/dist/vendor-Bo2Q64AF.cjs +1 -0
- package/package.json +17 -17
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { G as C } from "./charts-DO2z6Ziu.js";
|
|
3
|
+
import m from "react";
|
|
4
|
+
const z = {
|
|
5
|
+
info: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }),
|
|
6
|
+
warning: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }) }),
|
|
7
|
+
error: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
|
|
8
|
+
success: /* @__PURE__ */ e("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) })
|
|
9
|
+
}, E = ({
|
|
10
|
+
visible: i,
|
|
11
|
+
message: a,
|
|
12
|
+
header: o,
|
|
13
|
+
icon: h,
|
|
14
|
+
variant: n = "warning",
|
|
15
|
+
acceptLabel: f,
|
|
16
|
+
rejectLabel: v,
|
|
17
|
+
onAccept: u,
|
|
18
|
+
onReject: c,
|
|
19
|
+
closeOnOverlay: g = !1,
|
|
20
|
+
closeOnEscape: l = !0,
|
|
21
|
+
size: p = "md",
|
|
22
|
+
className: w,
|
|
23
|
+
style: y
|
|
24
|
+
}) => {
|
|
25
|
+
const { t: s } = C();
|
|
26
|
+
if (m.useEffect(() => {
|
|
27
|
+
if (!i || !l)
|
|
28
|
+
return;
|
|
29
|
+
const r = (b) => {
|
|
30
|
+
b.key === "Escape" && c();
|
|
31
|
+
};
|
|
32
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
33
|
+
}, [i, l, c]), m.useEffect(() => (i ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
34
|
+
document.body.style.overflow = "";
|
|
35
|
+
}), [i]), !i)
|
|
36
|
+
return null;
|
|
37
|
+
const d = h ?? z[n], _ = f ?? s("confirm.accept", "Yes"), N = v ?? s("confirm.reject", "No");
|
|
38
|
+
return /* @__PURE__ */ e("div", { className: "nice-modal-overlay", onClick: g ? c : void 0, children: /* @__PURE__ */ t(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: `nice-confirm nice-confirm--${n} nice-confirm--${p} ${w || ""}`,
|
|
42
|
+
style: y,
|
|
43
|
+
role: "alertdialog",
|
|
44
|
+
"aria-modal": "true",
|
|
45
|
+
"aria-label": o,
|
|
46
|
+
"aria-describedby": "nice-confirm-message",
|
|
47
|
+
onClick: (r) => r.stopPropagation(),
|
|
48
|
+
children: [
|
|
49
|
+
o && /* @__PURE__ */ e("div", { className: "nice-confirm__header", children: /* @__PURE__ */ e("h3", { className: "nice-confirm__title", children: o }) }),
|
|
50
|
+
/* @__PURE__ */ t("div", { className: "nice-confirm__body", children: [
|
|
51
|
+
d && /* @__PURE__ */ e("div", { className: `nice-confirm__icon nice-confirm__icon--${n}`, children: d }),
|
|
52
|
+
/* @__PURE__ */ e("div", { id: "nice-confirm-message", className: "nice-confirm__message", children: a })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ t("div", { className: "nice-confirm__footer", children: [
|
|
55
|
+
/* @__PURE__ */ e(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
type: "button",
|
|
59
|
+
className: "nice-btn nice-btn--ghost nice-btn--md",
|
|
60
|
+
onClick: c,
|
|
61
|
+
children: N
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
"button",
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
className: `nice-btn nice-btn--${n === "error" ? "error" : "primary"} nice-btn--md`,
|
|
69
|
+
onClick: u,
|
|
70
|
+
autoFocus: !0,
|
|
71
|
+
children: _
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) });
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
E as N
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),C=require("./charts-B-sl1V9y.cjs"),d=require("react"),N={info:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})}),warning:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})}),error:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),success:e.jsx("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})},b=({visible:c,message:m,header:o,icon:h,variant:i="warning",acceptLabel:a,rejectLabel:f,onAccept:u,onReject:n,closeOnOverlay:v=!1,closeOnEscape:s=!0,size:x="md",className:g,style:j})=>{const{t}=C.Gt();if(d.useEffect(()=>{if(!c||!s)return;const r=_=>{_.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[c,s,n]),d.useEffect(()=>(c?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[c]),!c)return null;const l=h??N[i],w=a??t("confirm.accept","Yes"),y=f??t("confirm.reject","No");return e.jsx("div",{className:"nice-modal-overlay",onClick:v?n:void 0,children:e.jsxs("div",{className:`nice-confirm nice-confirm--${i} nice-confirm--${x} ${g||""}`,style:j,role:"alertdialog","aria-modal":"true","aria-label":o,"aria-describedby":"nice-confirm-message",onClick:r=>r.stopPropagation(),children:[o&&e.jsx("div",{className:"nice-confirm__header",children:e.jsx("h3",{className:"nice-confirm__title",children:o})}),e.jsxs("div",{className:"nice-confirm__body",children:[l&&e.jsx("div",{className:`nice-confirm__icon nice-confirm__icon--${i}`,children:l}),e.jsx("div",{id:"nice-confirm-message",className:"nice-confirm__message",children:m})]}),e.jsxs("div",{className:"nice-confirm__footer",children:[e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--md",onClick:n,children:y}),e.jsx("button",{type:"button",className:`nice-btn nice-btn--${i==="error"?"error":"primary"} nice-btn--md`,onClick:u,autoFocus:!0,children:w})]})]})})};exports.NiceConfirmDialog=b;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),w=require("./charts-B-sl1V9y.cjs"),l=require("react"),vs=require("./NiceForm-C6F0HvrX.cjs"),ys=require("./NiceModal-0UxviEYE.cjs"),js=require("./NicePagination-EEQ6o1dF.cjs"),_s=[{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"}],ks=[{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"}],ws=({condition:c,fields:R,onChange:f,onRemove:_})=>{const h=R.find(p=>p.field===c.field),k=c.operator==="isblank"||c.operator==="isnotblank",A=h?.operators||ks;return t.jsxs("div",{className:"nice-filterbuilder__condition",children:[t.jsx("select",{className:"nice-filterbuilder__select",value:c.field,onChange:p=>f({...c,field:p.target.value,value:""}),children:R.map(p=>t.jsx("option",{value:p.field,children:p.label},p.field))}),t.jsx("select",{className:"nice-filterbuilder__select",value:c.operator,onChange:p=>f({...c,operator:p.target.value}),children:A.map(p=>t.jsx("option",{value:p.value,children:p.label},p.value))}),!k&&(h?.options?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(c.value??""),onChange:p=>f({...c,value:p.target.value}),children:[t.jsx("option",{value:"",children:"--"}),h.options.map(p=>t.jsx("option",{value:p.value,children:p.label},p.value))]}):h?.type==="boolean"?t.jsxs("select",{className:"nice-filterbuilder__select",value:String(c.value??""),onChange:p=>f({...c,value:p.target.value==="true"}),children:[t.jsx("option",{value:"true",children:"True"}),t.jsx("option",{value:"false",children:"False"})]}):t.jsx("input",{className:"nice-filterbuilder__input",type:h?.type==="number"?"number":h?.type==="date"?"date":"text",value:String(c.value??""),onChange:p=>f({...c,value:h?.type==="number"?Number(p.target.value):p.target.value})})),t.jsx("button",{className:"nice-filterbuilder__remove",onClick:_,children:"×"})]})},rn=({group:c,fields:R,onChange:f,onRemove:_,depth:h,maxDepth:k})=>{const[A,p]=l.useState(!1),Z=()=>f({...c,logic:c.logic==="and"?"or":"and"}),X=c.items.filter(v=>v.type==="condition").length,F=c.items.length-X,H=[X?`${X} condition${X>1?"s":""}`:"",F?`${F} group${F>1?"s":""}`:""].filter(Boolean).join(" · ")||"empty",xe=()=>{const v={type:"condition",field:R[0]?.field||"",operator:"=",value:""};f({...c,items:[...c.items,v]})},be=()=>{if(h>=k)return;const v={type:"group",logic:"and",items:[]};f({...c,items:[...c.items,v]})},I=(v,C)=>{const W=[...c.items];W[v]=C,f({...c,items:W})},S=v=>{f({...c,items:c.items.filter((C,W)=>W!==v)})};return t.jsxs("div",{className:`nice-filterbuilder__group nice-filterbuilder__group--depth-${Math.min(h,3)}`,children:[t.jsxs("div",{className:"nice-filterbuilder__group-header",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__collapse",onClick:()=>p(v=>!v),"aria-expanded":!A,title:A?"Expand group":"Collapse group",children:t.jsx(w.oa,{name:A?"chevron-right":"chevron-down",size:"sm"})}),t.jsx("button",{className:"nice-filterbuilder__logic",onClick:Z,title:`Match ${c.logic==="and"?"ALL":"ANY"} — click to switch to ${c.logic==="and"?"OR":"AND"}`,children:c.logic.toUpperCase()}),A?t.jsx("span",{className:"nice-filterbuilder__summary",children:H}):t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:xe,children:"+ Condition"}),h<k&&t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:be,children:"+ Group"})]}),_&&t.jsx("button",{className:"nice-filterbuilder__remove",onClick:_,children:"×"})]}),!A&&t.jsx("div",{className:"nice-filterbuilder__group-body",children:c.items.map((v,C)=>t.jsx(l.Fragment,{children:v.type==="condition"?t.jsx(ws,{condition:v,fields:R,onChange:W=>I(C,W),onRemove:()=>S(C)}):t.jsx(rn,{group:v,fields:R,onChange:W=>I(C,W),onRemove:()=>S(C),depth:h+1,maxDepth:k})},C))})]})},_t=({fields:c,value:R,onChange:f,maxDepth:_=3,presets:h,onSavePreset:k,onDeletePreset:A,tutorial:p,className:Z,style:X})=>{const[F,H]=l.useState(""),xe=l.useCallback(I=>{const S=h?.find(v=>v.name===I);S&&f(structuredClone(S.filter))},[h,f]),be=l.useCallback(()=>{!F.trim()||!k||(k({name:F.trim(),filter:structuredClone(R)}),H(""))},[F,R,k]);return t.jsxs("div",{className:`nice-filterbuilder ${Z||""}`,style:{position:"relative",...X},children:[t.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:t.jsx(w.Ql,{steps:w.Yl(p,_s)})}),(h?.length||k)&&t.jsxs("div",{className:"nice-filterbuilder__presets",children:[h&&h.length>0&&t.jsx("div",{className:"nice-filterbuilder__preset-list",children:h.map(I=>t.jsxs("span",{className:"nice-filterbuilder__preset-tag",children:[t.jsx("button",{type:"button",className:"nice-filterbuilder__preset-btn",onClick:()=>xe(I.name),children:I.name}),A&&t.jsx("button",{type:"button",className:"nice-filterbuilder__preset-del",onClick:()=>A(I.name),children:"×"})]},I.name))}),k&&t.jsxs("div",{className:"nice-filterbuilder__preset-save",children:[t.jsx("input",{className:"nice-filterbuilder__input",value:F,onChange:I=>H(I.target.value),placeholder:"Preset name..."}),t.jsx("button",{className:"nice-btn nice-btn--sm",onClick:be,disabled:!F.trim(),children:"Save"})]})]}),t.jsx(rn,{group:R,fields:c,onChange:f,depth:0,maxDepth:_})]})};_t.displayName="NiceFilterBuilder";function on(c,R,f){const _=c.map(h=>h[R]).filter(h=>typeof h=="number");if(_.length===0)return f==="count"?"0":"";switch(f){case"sum":return _.reduce((h,k)=>h+k,0).toLocaleString();case"avg":return(_.reduce((h,k)=>h+k,0)/_.length).toLocaleString(void 0,{maximumFractionDigits:2});case"count":return String(c.length);case"min":return Math.min(..._).toLocaleString();case"max":return Math.max(..._).toLocaleString()}}function Ce(c){return c.includes(",")||c.includes('"')||c.includes(`
|
|
2
|
+
`)?`"${c.replace(/"/g,'""')}"`:c}const le={width:12,height:12,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},Cs=()=>t.jsx("svg",{...le,children:t.jsx("polyline",{points:"6 15 12 9 18 15"})}),we=()=>t.jsx("svg",{...le,children:t.jsx("polyline",{points:"6 9 12 15 18 9"})}),Ns=()=>t.jsxs("svg",{...le,style:{opacity:.55},children:[t.jsx("polyline",{points:"6 10 12 5 18 10"}),t.jsx("polyline",{points:"6 14 12 19 18 14"})]}),Ue=()=>t.jsx("svg",{...le,children:t.jsx("polyline",{points:"9 6 15 12 9 18"})}),Ss=()=>t.jsxs("svg",{...le,children:[t.jsx("polyline",{points:"3 17 9 11 13 15 21 7"}),t.jsx("polyline",{points:"14 7 21 7 21 14"})]}),Ms=()=>t.jsxs("svg",{...le,children:[t.jsx("polyline",{points:"3 7 9 13 13 9 21 17"}),t.jsx("polyline",{points:"14 17 21 17 21 10"})]}),Rs=()=>t.jsx("svg",{...le,children:t.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})});function Is(c){return typeof c=="boolean"?c?t.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:t.jsx("path",{d:"M4 10.5l4 4L16 6"})}):t.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:t.jsx("path",{d:"M5 5l10 10M15 5L5 15"})}):String(c??"")}function kt({columns:c,data:R,keyField:f="id",dataSource:_,sortable:h=!0,sortField:k,sortDirection:A,onSort:p,showAdvancedFilter:Z,advancedFilter:X,onAdvancedFilterChange:F,filterFields:H,filterPresets:xe,onSaveFilterPreset:be,onDeleteFilterPreset:I,selectable:S,selectedKeys:v,onSelectionChange:C,pagination:W,pageSize:Ve=10,page:cn,onPageChange:qe,totalRows:wt,autoPagination:re=!1,stickyHeader:dn=!0,stickyFooter:un=!0,searchable:Ct,searchPlaceholder:pn,virtualScroll:ee,rowHeight:T=40,groupBy:Xe,groupRender:Ne,onCellEdit:$,editMode:Se="inline",formItems:fn,formColumns:hn=2,editFormTitle:mn,formProps:gn,onRowEdit:Me,onRowAdd:Re,onRowDelete:zs,bulkActions:Ye,onBulkDelete:Je,exportCsv:Nt,exportFilename:St="export",detailRow:V,expandedRowKeys:xn,onExpandedRowChange:Qe,columnReorder:Ds,onColumnReorder:Ls,columnResize:Ie,rowDraggable:M,onRowReorder:$e,striped:bn,compact:vn,size:Ze,loading:yn,emptyText:jn,toolbar:Mt,onRowClick:He,pinnedTopKeys:et,pinnedBottomKeys:tt,colSpan:Rt,showStatusBar:_n,contextMenuItems:ze,onContextMenuAction:kn,printFriendly:wn,keyboardNavigation:ve,focusedCell:Cn,onFocusedCellChange:nt,cellRangeSelection:It,selectedCellRange:Nn,onCellRangeChange:st,clipboard:te,clipboardFormat:at="text",onBeforeCopy:$t,onCopy:zt,onPaste:it,quickFilters:Y,activeQuickFilters:Sn,onQuickFilterChange:lt,columnGroups:Es,stateStorageKey:oe,initialState:Dt,onStateChange:Lt,flashRowKeys:rt,flashDuration:Et=500,autoFitColumns:Os,showColumnStats:As,rowIndicator:ot,frozenRows:Fs,className:Mn,style:Rn,accessMode:In,id:$n,displayStyle:Ot,disabled:zn,readOnly:At,error:ct}){const dt=w.Dc(In,$n),Dn=dt==="hidden",De=zn||dt==="disabled",Ln=At||De||dt==="readOnly",{t:m}=w.Gt();w.rc("table",Ot),w.ac("table",Ot);const N=w.Gd(_??null,{autoLoad:!!_,defaultPageSize:Ve}),y=!!_,ut=y?N.data:R??[],Le=y?N.loading:yn,[Ft,En]=l.useState({field:"",dir:null}),[On,An]=l.useState(1),[Fn,pt]=l.useState(new Set),[Ee,Tn]=l.useState(""),[Pn,Gn]=l.useState({type:"group",logic:"and",items:[]}),[Tt,Wn]=l.useState(!1),ye=X??Pn,Bn=e=>{F?F(e):Gn(e)},Kn=l.useMemo(()=>H??c.filter(e=>e.filterable!==!1&&e.field).map(e=>({field:String(e.field),label:String(e.header??e.field)})),[H,c]),ne=ye.items.length,[ce,Un]=l.useState(Ve),[J,ft]=l.useState(null),[Oe,je]=l.useState(null),[de,se]=l.useState(null),[Ae,Pt]=l.useState(new Set),[Gt,Vn]=l.useState(0),ht=l.useRef(null),[qn,Xn]=l.useState(new Set),Fe=xn??qn,[q,Wt]=l.useState({}),[ue,pe]=l.useState(null),[fe,mt]=l.useState(null),[Yn,Jn]=l.useState(null),[Qn,Zn]=l.useState(null),[Hn,es]=l.useState([]),[Ts,Ps]=l.useState(null),[ts,Bt]=l.useState(new Set),[Gs,Ws]=l.useState(null),gt=l.useRef(null),[ns,ss]=l.useState(Ve);l.useEffect(()=>{if(!re)return;const e=ht.current;if(!e||typeof ResizeObserver>"u")return;const n=()=>{const a=e.clientHeight;if(a<=0)return;const i=Math.max(1,Math.floor(a/T)-1);ss(o=>o===i?o:i),y&&N.setPageSize(i)};n();const s=new ResizeObserver(n);return s.observe(e),()=>s.disconnect()},[re,T,y]);const P=Cn??Yn,z=Nn??Qn,K=Sn??Hn;l.useEffect(()=>{if(!oe)return;const e=localStorage.getItem(`nice-datagrid-${oe}`);if(e&&!Dt)try{const n=JSON.parse(e);n.columnWidths&&Wt(n.columnWidths),n.expandedGroups&&Pt(new Set(n.expandedGroups))}catch{}},[oe,Dt]),l.useEffect(()=>{if(!rt?.size)return;Bt(new Set(rt));const e=setTimeout(()=>Bt(new Set),Et);return()=>clearTimeout(e)},[rt,Et]),l.useEffect(()=>{if(!fe)return;const e=()=>mt(null);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[fe]);const as=l.useCallback((e,n)=>{ze?.length&&(e.preventDefault(),mt({x:e.clientX,y:e.clientY,row:n}))},[ze]),Kt=l.useCallback(e=>{const n=new Set(Fe);n.has(e)?n.delete(e):n.add(e),Qe?Qe(n):Xn(n)},[Fe,Qe]),Ut=l.useCallback((e,n)=>{if(!Ie)return;n.preventDefault();const s=n.clientX,i=n.target.closest("th")?.offsetWidth??100,o=r=>{const u=Math.max(40,i+r.clientX-s);Wt(x=>({...x,[e]:u}))},d=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",d)},[Ie]),U=y?N.sort[0]?.field??"":k??Ft.field,G=y?N.sort[0]?.direction??null:A??Ft.dir,_e=y?N.page:cn??On,j=v??Fn;l.useCallback(()=>{if(!oe)return;const e={columnWidths:q,sortField:U||void 0,sortDirection:G,pageSize:ce,expandedGroups:Array.from(Ae)};localStorage.setItem(`nice-datagrid-${oe}`,JSON.stringify(e)),Lt?.(e)},[oe,q,U,G,ce,Ae,Lt]);const D=l.useMemo(()=>c.filter(e=>!e.hidden),[c]),xt=l.useMemo(()=>D.filter(e=>e.pinned==="left"),[D]),bt=l.useMemo(()=>D.filter(e=>e.pinned==="right"),[D]),Vt=l.useMemo(()=>D.filter(e=>!e.pinned),[D]),g=l.useMemo(()=>[...xt,...Vt,...bt],[xt,Vt,bt]),is=l.useMemo(()=>D.some(e=>e.aggregate),[D]),ke=xt.length>0||bt.length>0,qt=l.useCallback(e=>{const n=U===e?G==="asc"?"desc":G==="desc"?null:"asc":"asc";y?n?N.setSortField(e,n):N.setSort([]):p?p(e,n):En({field:e,dir:n})},[U,G,y,N,p]),L=l.useMemo(()=>{if(y)return ut;let e=[...ut];if(Ee){const n=Ee.toLowerCase();e=e.filter(s=>D.some(a=>String(s[a.field]??"").toLowerCase().includes(n)))}return ye.items.length>0&&(e=e.filter(n=>w.Cr(n,ye))),!p&&U&&G&&e.sort((n,s)=>{const a=n[U]??"",i=s[U]??"",o=typeof a=="number"?a-i:String(a).localeCompare(String(i));return G==="desc"?-o:o}),e},[ut,Ee,ye,D,U,G,p,y]),Te=y?N.totalCount:wt??L.length,ae=re?ns:y?N.pageSize:ce,ls=Math.max(1,Math.ceil(Te/ae)),B=y?L:W&&!wt?L.slice((_e-1)*ae,_e*ae):L,Pe=l.useCallback(e=>{y?N.setPage(e):qe?qe(e):An(e)},[y,N,qe]),he=l.useMemo(()=>B.map(e=>String(e[f])),[B,f]),me=he.length>0&&he.every(e=>j.has(e)),Xt=he.some(e=>j.has(e)),Yt=l.useCallback(()=>{const e=new Set(j);me?he.forEach(n=>e.delete(n)):he.forEach(n=>e.add(n)),C?C(e):pt(e)},[me,he,j,C]),Jt=l.useCallback(e=>{const n=new Set(j);n.has(e)?n.delete(e):n.add(e),C?C(n):pt(n)},[j,C]),Qt=({field:e})=>U!==e||!G?t.jsx("span",{className:"nice-table__sort-icon",children:t.jsx(Ns,{})}):t.jsx("span",{className:"nice-table__sort-icon",children:G==="asc"?t.jsx(Cs,{}):t.jsx(we,{})}),E=l.useMemo(()=>{if(!Xe)return B.map((s,a)=>({type:"data",row:s,key:String(s[f]??a)}));const e=new Map;B.forEach(s=>{const a=s[Xe];e.has(a)||e.set(a,[]),e.get(a).push(s)});const n=[];return e.forEach((s,a)=>{const i=`__group_${String(a)}`,o=Ae.has(i);n.push({type:"group",value:a,rows:s,expanded:o,key:i}),o&&s.forEach((d,r)=>n.push({type:"data",row:d,key:String(d[f]??`${i}_${r}`)}))}),n},[B,Xe,f,Ae]),{pinnedTopRows:rs,pinnedBottomRows:os,normalRows:cs}=l.useMemo(()=>{if(!et?.size&&!tt?.size)return{pinnedTopRows:[],pinnedBottomRows:[],normalRows:E};const e=[],n=[],s=[];for(const a of E){if(a.type==="data"){const i=a.key;if(et?.has(i)){e.push(a);continue}if(tt?.has(i)){n.push(a);continue}}s.push(a)}return{pinnedTopRows:e,pinnedBottomRows:n,normalRows:s}},[E,et,tt]),Zt=l.useCallback(e=>{Pt(n=>{const s=new Set(n);return s.has(e)?s.delete(e):s.add(e),s})},[]),ds=l.useMemo(()=>{if(!ee)return E;const e=ht.current?.clientHeight??400,n=Math.ceil(e/T),s=Math.max(0,Math.floor(Gt/T)-3),a=Math.min(E.length-1,s+n+6);return E.slice(s,a+1).map((i,o)=>({...i,_vIdx:s+o}))},[ee,E,Gt,T]),Ge=l.useCallback((e,n,s)=>{!$||Ln||(ft({rowKey:e,field:n}),je(s))},[$]),Ht=l.useCallback(()=>{J&&$&&$(J.rowKey,J.field,Oe),ft(null),je(null)},[J,Oe,$]),us=l.useCallback(()=>{ft(null),je(null)},[]),ps=l.useCallback(()=>{const e=D,n=e.map(r=>Ce(r.header)).join(","),s=L.map(r=>e.map(u=>Ce(String(r[u.field]??""))).join(",")),a=[n,...s].join(`
|
|
3
|
+
`),i=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(i),d=document.createElement("a");d.href=o,d.download=`${St}.csv`,d.click(),URL.revokeObjectURL(o)},[D,L,St]),We=l.useCallback(e=>{nt?nt(e):Jn(e)},[nt]),Be=l.useCallback(e=>{st?st(e):Zn(e)},[st]),O=l.useMemo(()=>E.filter(e=>e.type==="data").map(e=>e.key),[E]),fs=l.useCallback(e=>{if(!ve||J||!P)return;const n=O.indexOf(P.rowKey),s=g.findIndex(d=>d.field===P.field);if(n<0||s<0)return;let a=n,i=s;switch(e.key){case"ArrowUp":a=Math.max(0,n-1);break;case"ArrowDown":a=Math.min(O.length-1,n+1);break;case"ArrowLeft":i=Math.max(0,s-1);break;case"ArrowRight":i=Math.min(g.length-1,s+1);break;case"Tab":e.preventDefault(),e.shiftKey?i=Math.max(0,s-1):i=Math.min(g.length-1,s+1);break;case"Enter":{const d=g[s];if(d.editable&&$){const r=B.find(u=>String(u[f])===P.rowKey);r&&Ge(P.rowKey,d.field,r[d.field])}return}case"Escape":We(null),Be(null);return;case"Home":e.ctrlKey&&(a=0),i=0;break;case"End":e.ctrlKey&&(a=O.length-1),i=g.length-1;break;case"PageUp":a=Math.max(0,n-ce);break;case"PageDown":a=Math.min(O.length-1,n+ce);break;default:return}e.preventDefault();const o={rowKey:O[a],field:g[i].field};if(We(o),e.shiftKey&&It){const d=z?.start??P;Be({start:d,end:o})}else Be(null)},[ve,J,P,O,g,It,z,We,Be,$,B,f,Ge,ce]),en=l.useCallback(()=>{let e=[],n=[];if(z){const s=O.indexOf(z.start.rowKey),a=O.indexOf(z.end.rowKey),i=Math.min(s,a),o=Math.max(s,a),d=g.findIndex(b=>b.field===z.start.field),r=g.findIndex(b=>b.field===z.end.field),u=Math.min(d,r),x=Math.max(d,r);n=g.slice(u,x+1).map(b=>b.field),e=B.filter(b=>{const Q=O.indexOf(String(b[f]));return Q>=i&&Q<=o})}else j.size>0&&(e=B.filter(s=>j.has(String(s[f]))),n=g.map(s=>s.field));return{rows:e,fields:n}},[z,O,g,B,f,j]),tn=l.useCallback((e,n,s)=>{const a=g.filter(i=>n.includes(i.field));switch(s){case"json":return JSON.stringify(e.map(i=>Object.fromEntries(n.map(o=>[o,i[o]]))),null,2);case"csv":{const i=a.map(d=>Ce(d.header)).join(","),o=e.map(d=>a.map(r=>Ce(String(d[r.field]??""))).join(",")).join(`
|
|
4
|
+
`);return i+`
|
|
5
|
+
`+o}case"html":{const i=a.map(d=>`<th>${d.header}</th>`).join(""),o=e.map(d=>`<tr>${a.map(r=>`<td>${d[r.field]??""}</td>`).join("")}</tr>`).join("");return`<table><thead><tr>${i}</tr></thead><tbody>${o}</tbody></table>`}case"markdown":{const i="| "+a.map(r=>r.header).join(" | ")+" |",o="| "+a.map(()=>"---").join(" | ")+" |",d=e.map(r=>"| "+a.map(u=>r[u.field]??"").join(" | ")+" |").join(`
|
|
6
|
+
`);return i+`
|
|
7
|
+
`+o+`
|
|
8
|
+
`+d}default:return e.map(i=>a.map(o=>i[o.field]??"").join(" ")).join(`
|
|
9
|
+
`)}},[g]),vt=l.useCallback(async()=>{if(!te)return;const{rows:e,fields:n}=en();if(!e.length||$t?.(e,n)===!1)return;const s=tn(e,n,at);await navigator.clipboard.writeText(s),zt?.(e,n,at)},[te,en,$t,tn,at,zt]),nn=l.useCallback(async()=>{if(!te||!P||!it)return;const n=(await navigator.clipboard.readText()).split(`
|
|
10
|
+
`).map(s=>s.split(" "));it(n,P)},[te,P,it]);l.useEffect(()=>{if(!te||!gt.current)return;const e=n=>{gt.current?.contains(document.activeElement)&&(n.type==="copy"&&(n.preventDefault(),vt()),n.type==="paste"&&(n.preventDefault(),nn()))};return document.addEventListener("copy",e),document.addEventListener("paste",e),()=>{document.removeEventListener("copy",e),document.removeEventListener("paste",e)}},[te,vt,nn]);const hs=l.useCallback(e=>{const n=K.includes(e)?K.filter(s=>s!==e):[...K,e];lt?lt(n):es(n)},[K,lt]),ms=l.useMemo(()=>{if(!Y?.length||!K.length)return L;const e=Y.filter(n=>K.includes(n.key));return L.filter(n=>e.every(s=>s.filter(n)))},[L,Y,K]),sn=Y?.length?ms:L;l.useCallback(e=>{const n=L.map(u=>u[e]).filter(u=>u!=null),s=n.filter(u=>typeof u=="number");if(s.length===0){const u=new Set(n).size;return{count:n.length,unique:u,type:"text"}}const a=s.reduce((u,x)=>u+x,0),i=a/s.length,o=Math.min(...s),d=Math.max(...s),r=Math.sqrt(s.reduce((u,x)=>u+(x-i)**2,0)/s.length);return{count:s.length,sum:a,avg:i,min:o,max:d,stdDev:r,type:"numeric"}},[L]);const gs=l.useCallback((e,n,s)=>{if(!e.cellVisualization)return null;const a=Number(n);if(isNaN(a))return null;const i=e.visualMin??0,o=e.visualMax??100,d=Math.max(0,Math.min(100,(a-i)/(o-i)*100));switch(e.cellVisualization){case"progress":return t.jsxs("div",{className:"nice-datagrid__cell-progress",style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("div",{style:{flex:1,height:6,background:"var(--border-color)",borderRadius:3,overflow:"hidden"},children:t.jsx("div",{style:{width:`${d}%`,height:"100%",background:d>80?"var(--color-success)":d>50?"var(--color-primary)":"var(--color-warning)",transition:"width 0.3s ease"}})}),t.jsxs("span",{style:{fontSize:"0.75rem",minWidth:32,textAlign:"right"},children:[Math.round(d),"%"]})]});case"rating":{const r=Math.round(a/o*5);return t.jsx("div",{className:"nice-datagrid__cell-rating",children:[1,2,3,4,5].map(u=>t.jsx("span",{style:{color:u<=r?"var(--color-warning)":"var(--text-muted)",fontSize:"0.95rem",lineHeight:1},"aria-hidden":"true",children:t.jsx(w.oa,{name:"star",size:14})},u))})}case"trend":{const r=e.visualMin??a,u=a-r,x=u>0?Ss:u<0?Ms:Rs,b=u>0?"var(--color-success)":u<0?"var(--color-danger)":"var(--text-muted)";return t.jsxs("span",{style:{color:b,fontWeight:500,display:"inline-flex",alignItems:"center",gap:4},children:[t.jsx(x,{})," ",Math.abs(u).toFixed(1),"%"]})}case"heatmap":{const r=d/100,u=`rgba(${Math.round(255*r)}, ${Math.round(100*(1-r))}, ${Math.round(50*(1-r))}, 0.6)`;return t.jsx("span",{style:{background:u,padding:"2px 8px",borderRadius:4},children:a})}default:return null}},[]),xs=l.useCallback((e,n,s)=>{if(!e.conditionalFormats?.length)return{};for(const a of e.conditionalFormats)if(a.when(n,s,e.field))return{className:a.className,style:{...a.style,backgroundColor:a.backgroundColor,color:a.color}};return{}},[]),yt=l.useCallback((e,n)=>{if(!ke||!e.pinned)return{};const s={position:"sticky",zIndex:2,background:"var(--bg-primary, #fff)"};if(e.pinned==="left"){let a=0;for(let i=0;i<n;i++){const o=g[i];o.pinned==="left"&&(a+=typeof o.width=="number"?o.width:parseInt(String(o.width)||"100",10))}S&&n===0&&(a=36),s.left=a}else{let a=0;for(let i=g.length-1;i>n;i--){const o=g[i];o.pinned==="right"&&(a+=typeof o.width=="number"?o.width:parseInt(String(o.width)||"100",10))}s.right=a}return s},[ke,g,S]),an=(e,n,s,a)=>{if(J?.rowKey===s&&J?.field===e.field)return e.editor?e.editor(Oe,n,r=>je(r)):t.jsx("input",{className:"nice-datagrid__edit-input",autoFocus:!0,value:Oe??"",onChange:r=>je(r.target.value),onBlur:Ht,onKeyDown:r=>{r.key==="Enter"&&Ht(),r.key==="Escape"&&us()}});const o=gs(e,n[e.field],n);return o||(e.render?e.render(n[e.field],n,a):Is(n[e.field]))},bs=(e,n,s,a)=>{const i=P?.rowKey===s&&P?.field===e.field,o=z&&(()=>{const u=O.indexOf(z.start.rowKey),x=O.indexOf(z.end.rowKey),b=O.indexOf(s),Q=g.findIndex(ge=>ge.field===z.start.field),ie=g.findIndex(ge=>ge.field===z.end.field);return b>=Math.min(u,x)&&b<=Math.max(u,x)&&a>=Math.min(Q,ie)&&a<=Math.max(Q,ie)})(),d=xs(e,n[e.field],n);return{className:[d.className,i&&"nice-datagrid__cell--focused",o&&"nice-datagrid__cell--in-range"].filter(Boolean).join(" "),style:{...yt(e,a),textAlign:e.align,...d.style,...i?{outline:"2px solid var(--color-primary)",outlineOffset:-2}:{},...o?{background:"var(--color-primary-light, rgba(59,130,246,0.15))"}:{}}}},ln=["nice-table",bn?"nice-table--striped":"",vn?"nice-table--compact":"",Ze&&Ze!=="md"?`nice-table--${Ze}`:""].filter(Boolean).join(" "),Ke=g.length+(S?1:0)+(V?1:0)+(M?1:0)+(ot?1:0),jt=(e,n,s)=>{const{row:a,key:i}=e,o=j.has(i),d=Fe.has(i),r=ts.has(i),u=[o&&"nice-datagrid__row--selected",ue===n&&"nice-datagrid__row--dragging",s&&"nice-datagrid__row--pinned",r&&"nice-datagrid__row--flash"].filter(Boolean).join(" ");return t.jsxs(l.Fragment,{children:[t.jsxs("tr",{className:u,onClick:()=>He?.(a),onDoubleClick:Se==="popup"&&(Me||$)?()=>se({key:i,data:{...a}}):void 0,onContextMenu:x=>as(x,a),style:He||Se==="popup"?{cursor:"pointer"}:void 0,draggable:M,onDragStart:M?()=>pe(n):void 0,onDragOver:M?x=>x.preventDefault():void 0,onDrop:M&&$e&&ue!=null?()=>{$e(ue,n),pe(null)}:void 0,onDragEnd:M?()=>pe(null):void 0,children:[ot&&t.jsx("td",{className:"nice-datagrid__row-indicator",style:{width:32,padding:"0 4px"},children:ot(a)}),V&&t.jsx("td",{className:"nice-datagrid__expand-col",onClick:x=>{x.stopPropagation(),Kt(i)},children:t.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":d,children:d?t.jsx(we,{}):t.jsx(Ue,{})})}),M&&t.jsx("td",{className:"nice-datagrid__drag-handle",style:{cursor:"grab",textAlign:"center",color:"var(--text-muted)"},"aria-label":m("datagrid.dragRow","Drag to reorder"),children:t.jsx(w.oa,{name:"more-vertical",size:14})}),S&&t.jsx("td",{className:"nice-datagrid__checkbox",onClick:x=>x.stopPropagation(),style:ke?{position:"sticky",left:0,zIndex:1,background:"var(--bg-primary, #fff)"}:void 0,children:t.jsx("input",{type:"checkbox",checked:o,onChange:()=>Jt(i),"aria-label":`Select row ${i}`})}),(()=>{let x=0;return g.map((b,Q)=>{if(x>0)return x--,null;const ie=Rt?Rt(a,b,Q):void 0;ie&&ie>1&&(x=ie-1);const ge=bs(b,a,i,Q);return t.jsx("td",{colSpan:ie,className:ge.className,style:ge.style,onClick:ve?()=>We({rowKey:i,field:b.field}):void 0,onDoubleClick:b.editable&&$?()=>Ge(i,b.field,a[b.field]):void 0,children:an(b,a,i,n)},b.field)})})()]}),V&&d&&t.jsx("tr",{className:"nice-datagrid__detail-row",children:t.jsx("td",{colSpan:Ke,children:V(a)})})]},i)};return Dn?null:t.jsxs("div",{ref:gt,className:`nice-datagrid ${wn?"nice-datagrid--print":""} ${dn?"nice-datagrid--sticky-header":""} ${un?"nice-datagrid--sticky-footer":""} ${re?"nice-datagrid--auto-pagination":""} ${De?"nice-datagrid--disabled":""} ${At&&!De?"nice-datagrid--readonly":""} ${ct?"nice-datagrid--error":""} ${Mn||""}`,"aria-disabled":De||void 0,style:Rn,role:"grid","aria-label":m("datagrid.title","Data Grid"),"aria-rowcount":E.length,"aria-colcount":D.length,"aria-busy":Le||void 0,tabIndex:ve?0:void 0,onKeyDown:ve?fs:void 0,children:[ct&&t.jsx("div",{className:"nice-datagrid__error",role:"alert",children:ct}),(Ct||Mt||Nt||Y?.length||Re||Z)&&t.jsxs("div",{className:"nice-datagrid__toolbar",children:[Ct&&t.jsx("div",{className:"nice-datagrid__search",children:t.jsx("input",{type:"text",value:y?N.search:Ee,"aria-label":m("controls.search","Search"),onChange:e=>{y?N.setSearch(e.target.value):(Tn(e.target.value),Pe(1))},placeholder:pn||m("controls.search","Search...")})}),Z&&t.jsxs("button",{type:"button",className:`nice-btn nice-btn--sm nice-btn--icon-only ${ne>0?"nice-btn--primary":"nice-btn--secondary"}`,"aria-expanded":Tt,"aria-label":`${m("controls.filter","Filter")}${ne>0?` (${ne})`:""}`,title:`${m("controls.filter","Filter")}${ne>0?` (${ne})`:""}`,onClick:()=>Wn(e=>!e),style:{position:"relative"},children:[t.jsx(w.oa,{name:"filter",size:14}),ne>0&&t.jsx("span",{className:"nice-datagrid__filter-badge",children:ne})]}),Y&&Y.length>0&&t.jsx("div",{className:"nice-datagrid__quick-filters",style:{display:"flex",gap:6,flexWrap:"wrap"},children:Y.map(e=>t.jsxs("button",{className:`nice-datagrid__quick-filter ${K.includes(e.key)?"nice-datagrid__quick-filter--active":""}`,onClick:()=>hs(e.key),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:"0.75rem",border:"1px solid var(--border-color)",borderRadius:12,background:K.includes(e.key)?`var(--color-${e.color||"primary"})`:"var(--bg-primary)",color:K.includes(e.key)?"var(--bg-primary, #fff)":"inherit",cursor:"pointer",transition:"all 0.15s ease"},children:[e.icon&&t.jsx("span",{children:e.icon}),e.label]},e.key))}),te&&t.jsx("button",{className:"nice-btn nice-btn--sm nice-btn--ghost",onClick:vt,"aria-label":m("controls.copy","Copy selected"),title:m("controls.copy","Copy selected"),style:{marginLeft:4},children:t.jsx(w.oa,{name:"copy",size:14})}),Nt&&t.jsxs("button",{className:"nice-btn nice-btn--sm nice-btn--secondary",onClick:ps,title:m("controls.exportCsv","Export CSV"),children:[t.jsx(w.oa,{name:"download",size:14}),m("controls.exportCsv","Export CSV")]}),Re&&t.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--primary",onClick:()=>se({key:null,data:{}}),title:m("datagrid.addRow","Add row"),children:[t.jsx(w.oa,{name:"plus",size:14}),m("datagrid.add","Add")]}),Mt]}),Z&&Tt&&t.jsx("div",{className:"nice-datagrid__filter-panel",style:{padding:"8px 12px",borderBottom:"1px solid var(--border-color)"},children:t.jsx(_t,{fields:Kn,value:ye,onChange:e=>{Bn(e),Pe(1)},presets:xe,onSavePreset:be,onDeletePreset:I})}),S&&j.size>0&&(Ye?.length||Je)&&t.jsxs("div",{className:"nice-datagrid__bulk-toolbar",role:"toolbar","aria-label":m("datagrid.bulkActions","Bulk actions"),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--bg-tertiary, #f1f5f9)",borderBottom:"1px solid var(--border-color)",flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:m("datagrid.selectedCount","{count} selected").replace("{count}",String(j.size))}),(Ye||[]).map(e=>{const n=Array.from(j),s=sn.filter(i=>j.has(String(i[f]))),a=e.disabled?.(n,s)||!1;return t.jsxs("button",{type:"button",className:`nice-btn nice-btn--sm nice-btn--${e.variant||"secondary"}`,disabled:a,onClick:()=>e.onClick(n,s),children:[e.icon,e.icon&&" ",e.label]},e.key)}),Je&&!Ye?.length&&t.jsxs("button",{type:"button",className:"nice-btn nice-btn--sm nice-btn--danger",onClick:()=>{const e=Array.from(j),n=sn.filter(s=>j.has(String(s[f])));Je(e,n)},children:[t.jsx(w.oa,{name:"trash",size:14}),m("datagrid.deleteSelected","Delete selected")]}),t.jsx("button",{type:"button",className:"nice-btn nice-btn--xs nice-btn--ghost",onClick:()=>{const e=new Set;v===void 0&&pt(e),C?.(e)},style:{marginLeft:"auto"},children:m("datagrid.clearSelection","Clear")})]}),t.jsxs("div",{ref:ht,className:`nice-datagrid__table-wrap ${ee?"nice-datagrid__table-wrap--virtual":""}`,style:ee?{maxHeight:Math.min(E.length*T,600),overflowY:"auto"}:void 0,onScroll:ee?e=>Vn(e.currentTarget.scrollTop):void 0,children:[ee&&t.jsxs("div",{style:{height:E.length*T,position:"relative"},children:[t.jsx("table",{className:ln,style:{position:"sticky",top:0,zIndex:3},children:t.jsx("thead",{children:t.jsxs("tr",{children:[V&&t.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),M&&t.jsx("th",{style:{width:28}}),S&&t.jsx("th",{className:"nice-datagrid__checkbox",style:ke?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:t.jsx("input",{type:"checkbox",checked:me,ref:e=>{e&&(e.indeterminate=Xt&&!me)},onChange:Yt,"aria-label":m("controls.selectAll","Select all")})}),g.map((e,n)=>t.jsxs("th",{style:{width:q[e.field]||e.width,minWidth:e.minWidth,textAlign:e.align,position:"relative",...yt(e,n)},className:h&&e.sortable!==!1?"nice-datagrid__th--sortable":void 0,onClick:()=>h&&e.sortable!==!1&&qt(e.field),children:[e.header,h&&e.sortable!==!1&&t.jsx(Qt,{field:e.field}),Ie&&t.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:s=>{s.stopPropagation(),Ut(e.field,s)}})]},e.field))]})})}),ds.map((e,n)=>{const s=e._vIdx??0;if(e.type==="group"){const r=e;return t.jsxs("div",{className:"nice-datagrid__group-row",style:{position:"absolute",top:s*T,height:T,left:0,right:0},onClick:()=>Zt(r.key),children:[t.jsx("span",{className:"nice-datagrid__group-toggle",children:r.expanded?t.jsx(we,{}):t.jsx(Ue,{})}),Ne?Ne(r.value,r.rows):t.jsxs(t.Fragment,{children:[String(r.value)," (",r.rows.length,")"]})]},r.key)}const{row:a,key:i}=e,o=j.has(i),d=Fe.has(i);return t.jsxs(l.Fragment,{children:[t.jsxs("div",{className:`nice-datagrid__vrow ${o?"nice-datagrid__row--selected":""} ${ue===n?"nice-datagrid__row--dragging":""}`,style:{position:"absolute",top:s*T,height:T,left:0,right:0,display:"flex",alignItems:"center"},onClick:()=>He?.(a),onDoubleClick:Se==="popup"&&(Me||$)?()=>se({key:i,data:{...a}}):void 0,draggable:M,onDragStart:M?()=>pe(n):void 0,onDragOver:M?r=>r.preventDefault():void 0,onDrop:M&&$e&&ue!=null?()=>{$e(ue,n),pe(null)}:void 0,onDragEnd:M?()=>pe(null):void 0,children:[V&&t.jsx("div",{className:"nice-datagrid__expand-col",style:{width:36,flexShrink:0,textAlign:"center",cursor:"pointer"},onClick:r=>{r.stopPropagation(),Kt(i)},children:t.jsx("span",{className:"nice-datagrid__expand-btn","data-expanded":d,children:d?t.jsx(we,{}):t.jsx(Ue,{})})}),M&&t.jsx("div",{"aria-label":m("datagrid.dragRow","Drag to reorder"),style:{width:28,flexShrink:0,cursor:"grab",textAlign:"center",color:"var(--text-muted)",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:t.jsx(w.oa,{name:"more-vertical",size:14})}),S&&t.jsx("div",{className:"nice-datagrid__checkbox",style:{width:36,flexShrink:0},onClick:r=>r.stopPropagation(),children:t.jsx("input",{type:"checkbox",checked:o,onChange:()=>Jt(i)})}),g.map(r=>t.jsx("div",{className:"nice-datagrid__vcell",style:{width:q[r.field]||r.width||"auto",flex:q[r.field]||r.width?`0 0 ${typeof(q[r.field]||r.width)=="number"?(q[r.field]||r.width)+"px":q[r.field]||r.width}`:1,textAlign:r.align,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"0 8px"},onDoubleClick:r.editable&&$?()=>Ge(i,r.field,a[r.field]):void 0,children:an(r,a,i,s)},r.field))]}),V&&d&&t.jsx("div",{className:"nice-datagrid__detail-row",style:{position:"absolute",top:(s+1)*T,left:0,right:0,padding:"8px 12px",background:"var(--bg-secondary, #f8f8f8)"},children:V(a)})]},i)})]}),!ee&&t.jsxs("table",{className:ln,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[V&&t.jsx("th",{className:"nice-datagrid__expand-col",style:{width:36}}),M&&t.jsx("th",{style:{width:28}}),S&&t.jsx("th",{className:"nice-datagrid__checkbox",style:ke?{position:"sticky",left:0,zIndex:3,background:"var(--bg-primary, #fff)"}:void 0,children:t.jsx("input",{type:"checkbox",checked:me,ref:e=>{e&&(e.indeterminate=Xt&&!me)},onChange:Yt,"aria-label":m("controls.selectAll","Select all")})}),g.map((e,n)=>{const s=h&&e.sortable!==!1,a=s?U===e.field?G==="asc"?"ascending":G==="desc"?"descending":"none":"none":void 0;return t.jsxs("th",{style:{width:q[e.field]||e.width,minWidth:e.minWidth,textAlign:e.align,position:"relative",...yt(e,n)},className:s?"nice-datagrid__th--sortable":void 0,onClick:()=>s&&qt(e.field),"aria-sort":a,scope:"col",children:[e.header,s&&t.jsx(Qt,{field:e.field}),Ie&&t.jsx("span",{className:"nice-datagrid__resize-handle",onMouseDown:i=>{i.stopPropagation(),Ut(e.field,i)}})]},e.field)})]})}),t.jsx("tbody",{children:Le?t.jsx("tr",{children:t.jsx("td",{colSpan:Ke,className:"nice-datagrid__empty",children:t.jsx("div",{className:"nice-spinner nice-spinner--md",style:{margin:"0 auto"}})})}):E.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:Ke,className:"nice-datagrid__empty",children:jn||m("controls.noData","No data available")})}):t.jsxs(t.Fragment,{children:[rs.map((e,n)=>e.type==="data"&&jt(e,n,"top")),cs.map((e,n)=>{if(e.type==="group"){const s=e;return t.jsx("tr",{className:"nice-datagrid__group-row",onClick:()=>Zt(s.key),children:t.jsxs("td",{colSpan:Ke,className:"nice-datagrid__group-cell",children:[t.jsx("span",{className:"nice-datagrid__group-toggle",children:s.expanded?t.jsx(we,{}):t.jsx(Ue,{})}),Ne?Ne(s.value,s.rows):t.jsxs(t.Fragment,{children:[String(s.value)," (",s.rows.length,")"]})]})},s.key)}return jt(e,n)}),os.map((e,n)=>e.type==="data"&&jt(e,n,"bottom"))]})})]})]}),is&&!Le&&B.length>0&&t.jsx("div",{className:"nice-datagrid__summary",role:"row","aria-label":m("datagrid.summary","Summary"),children:g.map(e=>t.jsx("div",{className:"nice-datagrid__summary-cell",style:{textAlign:e.align},children:e.aggregate?(e.aggregateLabel||e.aggregate.toUpperCase())+": "+on(L,e.field,e.aggregate):""},e.field))}),W&&t.jsxs("div",{className:"nice-datagrid__footer",children:[t.jsxs("span",{className:"nice-datagrid__footer-info",children:[m("controls.showing","Showing")," ",(_e-1)*ae+1,"–",Math.min(_e*ae,Te)," ",m("controls.of","of")," ",Te,re&&t.jsxs("span",{className:"nice-datagrid__page-size-label",children:[" · ",ae," ",m("controls.perPage","/ page")]})]}),t.jsx(js.NicePagination,{page:_e,totalPages:ls,onChange:Pe,showInfo:!0,pageSize:ae,showPageSize:!re,pageSizeOptions:[5,10,25,50,100],onPageSizeChange:e=>{y?N.setPageSize(e):(Un(e),Pe(1))},showFirstLast:!0})]}),_n&&!Le&&t.jsxs("div",{className:"nice-datagrid__status-bar",children:[t.jsxs("span",{children:[m("controls.totalRows","Total rows"),": ",Te]}),S&&j.size>0&&t.jsxs("span",{children:[m("controls.selected","Selected"),": ",j.size]})]}),fe&&ze&&t.jsx("div",{className:"nice-datagrid__context-menu",style:{position:"fixed",left:fe.x,top:fe.y,zIndex:9999},onClick:e=>e.stopPropagation(),children:ze.map(e=>t.jsxs("button",{className:"nice-datagrid__context-item",disabled:e.disabled,onClick:()=>{kn?.(e.key,fe.row),mt(null)},children:[e.icon&&t.jsx("span",{className:"nice-datagrid__context-icon",children:e.icon}),e.label]},e.key))}),(Se==="popup"||Re)&&de&&(()=>{const e=de.key===null,n=fn??c.filter(s=>!s.hidden&&s.field!==f).map(s=>{let a="text";return s.dataType==="number"||s.dataType==="currency"||s.dataType==="percent"?a="number":s.dataType==="boolean"?a="checkbox":s.dataType==="date"&&(a="date"),{field:s.field,label:s.header,type:a,required:s.validation?.required}});return t.jsx(ys.NiceModal,{open:!0,onClose:()=>se(null),title:mn??(e?m("datagrid.addRow","Add row"):m("datagrid.editRow","Edit row")),size:"lg",children:t.jsx(vs.NiceForm,{items:n,data:de.data,columns:hn,showActions:!0,submitLabel:e?m("controls.add","Add"):m("controls.save","Save"),cancelLabel:m("controls.cancel","Cancel"),onCancel:()=>se(null),...gn,onFieldChange:(s,a)=>se(i=>i&&{...i,data:{...i.data,[s]:a}}),onSubmit:s=>{e?Re?.(s):de.key&&(Me?Me(de.key,s):$&&Object.keys(s).forEach(a=>{$(de.key,a,s[a])})),se(null)}})})})()]})}kt.displayName="NiceDataGrid";const $s=Object.freeze(Object.defineProperty({__proto__:null,NiceDataGrid:kt},Symbol.toStringTag,{value:"Module"}));exports.NiceDataGrid=kt;exports.NiceDataGrid$1=$s;exports.NiceFilterBuilder=_t;exports.computeAggregate=on;exports.escapeCsvField=Ce;
|