dhx-react-suite 1.0.6 → 1.0.8
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/dist/dhx-react-suite.js +1250 -946
- package/dist/dhx-react-suite.js.map +1 -1
- package/dist/dhx-react-suite.umd.cjs +2 -2
- package/dist/dhx-react-suite.umd.cjs.map +1 -1
- package/dist/index.d.ts +17 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(W,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react"),require("recharts")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","recharts"],e):(W=typeof globalThis<"u"?globalThis:W||self,e(W.DhxReactSuite={},W.ReactJSXRuntime,W.React,W.Recharts))})(this,function(W,e,x,Y){"use strict";const t={primary:"#0288d1",primaryDk:"#01579b",primaryLt:"#e1f5fe",success:"#43a047",danger:"#e53935",warning:"#fb8c00",bg:"#f5f7fa",surface:"#ffffff",border:"#dde3ea",borderDk:"#b0bec5",text:"#3d4a5c",textSec:"#6b7a8d",textMut:"#9aa5b1",shadow:"0 2px 8px rgba(0,0,0,.10)",shadowLg:"0 8px 28px rgba(0,0,0,.14)",r:"4px",rMd:"8px",font:"'Segoe UI', system-ui, -apple-system, sans-serif"},ke="dhx-react-styles";function j(){if(typeof document>"u"||document.getElementById(ke))return;const r=document.createElement("style");r.id=ke,r.textContent=`
|
|
2
2
|
*,*::before,*::after{box-sizing:border-box}
|
|
3
3
|
.dhx{font-family:${t.font};font-size:14px;color:${t.text}}
|
|
4
4
|
.dhx *{box-sizing:border-box}
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
.dhx-tag-success{background:#e8f5e9;color:#1b5e20}
|
|
39
39
|
.dhx-tag-danger{background:#ffebee;color:#b71c1c}
|
|
40
40
|
.dhx-tag-warning{background:#fff3e0;color:#e65100}
|
|
41
|
-
`,document.head.appendChild(r)}const be={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function ve({children:r,variant:a="primary",size:f="md",icon:s,disabled:x,onClick:p,style:u,className:n=""}){return h.useEffect(B,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${a} ${n}`,style:{...be[f],...u},disabled:x,onClick:p,children:[s&&e.jsx("span",{style:{fontSize:16},children:s}),r]})}function Se({items:r=[],style:a}){h.useEffect(B,[]);const f=(s,x)=>{var u;if(s.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},x);if(s.type==="spacer")return e.jsx("div",{style:{flex:1}},x);if(s.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:s.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:s.width||140,height:28},placeholder:s.placeholder,defaultValue:s.value,onChange:n=>{var d;return(d=s.onChange)==null?void 0:d.call(s,n.target.value)}})]},x);if(s.type==="select")return e.jsx("select",{className:"dhx dhx-input",style:{width:s.width||100,height:28,cursor:"pointer"},defaultValue:s.value,onChange:n=>{var d;return(d=s.onChange)==null?void 0:d.call(s,n.target.value)},children:(u=s.options)==null?void 0:u.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))},x);const p=s.active;return e.jsxs("button",{className:`dhx dhx-btn ${p?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:32,gap:4,...s.twoState&&p?{background:t.primaryLt,color:t.primary,borderColor:`${t.primary}66`}:{}},disabled:s.disabled,onClick:()=>{var n;return(n=s.onClick)==null?void 0:n.call(s,s)},children:[s.icon&&e.jsx("span",{style:{fontSize:16},children:s.icon}),s.text&&e.jsx("span",{children:s.text})]},x)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...a},children:r.map(f)})}function ke({items:r=[],width:a=240,collapsed:f,onSelect:s,header:x,footer:p,style:u}){const[n,d]=h.useState(f??!1),[y,c]=h.useState(null),[w,C]=h.useState({});h.useEffect(B,[]);const v=n?56:a,o=z=>{c(z.id),s==null||s(z)},k=(z,N=0)=>{var b;if(z.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},z.id);if(z.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:z.html||""}},z.id);const D=(((b=z.items)==null?void 0:b.length)??0)>0,m=w[z.id],i=y===z.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{D&&C(I=>({...I,[z.id]:!I[z.id]})),o(z)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${n?"0px":`${12+N*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:n?"center":"flex-start",transition:"all .15s",background:i?t.primaryLt:"transparent",color:i?t.primary:t.text,userSelect:"none"},onMouseEnter:I=>!i&&(I.currentTarget.style.background=t.bg),onMouseLeave:I=>!i&&(I.currentTarget.style.background="transparent"),children:[z.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:z.icon}),!n&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:i?600:400},children:z.value}),!n&&z.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:z.count}),!n&&D&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:m?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),D&&m&&!n&&z.items.map(I=>k(I,N+1))]},z.id)};return e.jsxs("div",{className:"dhx",style:{width:v,minWidth:v,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...u},children:[x&&!n&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:x}),e.jsx("button",{onClick:()=>d(z=>!z),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:n?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:n?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(z=>k(z))}),p&&!n&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:p})]})}function we({config:r}){const[a,f]=h.useState(!1),s={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...a?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:s,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>f(x=>!x),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:a?"▼":"▲"})]}),!a&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(de,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function de({rows:r,cols:a,type:f="line",style:s,children:x}){h.useEffect(B,[]);const p=f==="space"?12:f==="wide"?8:1,u=r||a,n=!!r;return u?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:n?"column":"row",gap:p,width:"100%",height:"100%",...s},children:u.map((d,y)=>e.jsx(we,{config:d},d.id||y))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...s},children:x})}function me({views:r=[],mode:a="top",tabAlign:f="left",closable:s=[],disabled:x=[],defaultActive:p,onBeforeChange:u,onChange:n,style:d}){var i;const[y,c]=h.useState(p||((i=r[0])==null?void 0:i.id)),[w,C]=h.useState(r.map(b=>b.id));h.useEffect(B,[]);const v=(b,I)=>{b.stopPropagation(),C(l=>l.filter($=>$!==I)),y===I&&c(w.find(l=>l!==I)??"")},o=b=>{x.includes(b)||u&&u(b)===!1||(c(b),n==null||n(b))},k=a==="left"||a==="right",z=r.filter(b=>w.includes(b.id)),N=e.jsx("div",{style:{display:"flex",flexDirection:k?"column":"row",justifyContent:f==="center"?"center":f==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!k&&a!=="bottom"?`2px solid ${t.border}`:"none",borderTop:a==="bottom"?`2px solid ${t.border}`:"none",borderRight:a==="left"?`2px solid ${t.border}`:"none",borderLeft:a==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:z.map(b=>{const I=y===b.id,l=x.includes(b.id),$=a==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:k?{color:t.primary,fontWeight:600,background:t.primaryLt,[a==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>o(b.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:l?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:k?120:"auto",...I?$:{color:l?t.textMut:t.textSec}},children:[b.icon&&e.jsx("span",{style:{fontSize:16},children:b.icon}),e.jsx("span",{children:b.tab}),s.includes(b.id)&&e.jsx("span",{onClick:g=>v(g,b.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},b.id)})}),D=z.find(b=>b.id===y),m=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[D==null?void 0:D.content,(D==null?void 0:D.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:D.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:a==="top"?"column":a==="bottom"?"column-reverse":a==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...d},children:[N,m]})}const K=`1px solid ${t.border}`;function Me({active:r,dir:a}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&a==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&a==="desc"?t.primary:t.borderDk})})]})}function ze({columns:r,data:a=[],height:f=400,rowHeight:s=40,sortable:x=!0,resizable:p=!0,editable:u=!1,stripe:n=!1,autoWidth:d=!1,keyNavigation:y=!1,selection:c,multiselect:w,onSelect:C,onChange:v,style:o}){const[k,z]=h.useState(null),[N,D]=h.useState("asc"),[m,i]=h.useState({}),[b,I]=h.useState(new Set),[l,$]=h.useState(-1),[g,W]=h.useState(()=>r.map(S=>S.width??S.minWidth??150)),[j,V]=h.useState(null),[U,ge]=h.useState(""),[ne,qe]=h.useState({}),Q=h.useRef(null),[Z,Ge]=h.useState(0);h.useEffect(B,[]),h.useEffect(()=>{if(!d||!Q.current)return;const S=new ResizeObserver(()=>{var M;return Ge(((M=Q.current)==null?void 0:M.offsetWidth)??0)});return S.observe(Q.current),()=>S.disconnect()},[d]);const X=h.useMemo(()=>{if(!d||Z===0)return g;const S=g.reduce((E,T)=>E+T,0);if(Z<=S)return g;const M=(Z-S)/r.length;return g.map(E=>E+M)},[d,Z,g,r.length]),Y=h.useMemo(()=>{let S=a.map((M,E)=>{const T=String(M.id??E);return ne[T]?{...M,...ne[T]}:M}).filter(M=>Object.entries(m).every(([E,T])=>!T||String(M[E]??"").toLowerCase().includes(T.toLowerCase())));return k&&(S=[...S].sort((M,E)=>{const T=M[k],H=E[k];if(T==null)return 1;if(H==null)return-1;const A=T<H?-1:T>H?1:0;return N==="asc"?A:-A})),S},[a,k,N,m,ne]),Je=h.useMemo(()=>{const S={};return r.forEach(M=>{var E;if((E=M.footer)!=null&&E.some(T=>T.summary)){const T=Y.map(A=>Number(A[M.id])).filter(A=>!isNaN(A)),H=T.reduce((A,_)=>A+_,0);S[M.id]={sum:H,avg:T.length?H/T.length:0,count:Y.length,min:T.length?Math.min(...T):0,max:T.length?Math.max(...T):0}}}),S},[Y,r]),Ue=h.useMemo(()=>{const S={};return r.filter(M=>M.filterType==="select").forEach(M=>{S[M.id]=[...new Set(a.map(E=>String(E[M.id]??"")))].sort()}),S},[a,r]),Qe=r.some(S=>S.filterable),Ze=r.some(S=>{var M;return(M=S.footer)==null?void 0:M.length}),Re=X.reduce((S,M)=>S+M,0),oe=(S,M)=>S.id??M,et=S=>{!x||S.sortable===!1||(D(M=>k===S.id&&M==="asc"?"desc":"asc"),z(S.id))},se=(S,M)=>{if(!c)return;const E=oe(S,M);$(M),I(T=>{const H=w?new Set(T):new Set;return H.has(E)?H.delete(E):H.add(E),H}),C==null||C(S)},ye=()=>{if(!j)return;const{key:S,colId:M}=j;qe(T=>({...T,[String(S)]:{...T[String(S)]||{},[M]:U}}));const E=Y.find((T,H)=>oe(T,H)===S);E&&(v==null||v(E,M,U)),V(null)},tt=S=>{if(j&&S.key==="Escape"){V(null);return}if(!(!y||!c)){if(S.key==="ArrowDown"){S.preventDefault();const M=Math.min(l+1,Y.length-1);M>=0&&se(Y[M],M)}else if(S.key==="ArrowUp"){S.preventDefault();const M=Math.max(l-1,0);M>=0&&se(Y[M],M)}}},rt=(S,M)=>{S.preventDefault(),S.stopPropagation();const E=S.clientX,T=g[M],H=_=>W(ae=>{const q=[...ae];return q[M]=Math.max(r[M].minWidth||50,T+_.clientX-E),q}),A=()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",A)};document.addEventListener("mousemove",H),document.addEventListener("mouseup",A)},le=(S,M,E,T)=>({width:S,minWidth:S,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:T,display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:M.align,justifyContent:M.align==="center"?"center":M.align==="right"?"flex-end":"flex-start",borderLeft:E?"none":K});return e.jsx("div",{ref:Q,className:"dhx",tabIndex:y?0:void 0,onKeyDown:tt,style:{width:"100%",height:f,display:"flex",flexDirection:"column",border:K,borderRadius:t.r,overflow:"hidden",outline:"none",...o},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column",minHeight:0},children:e.jsxs("div",{style:{minWidth:Re,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:K,flexShrink:0,position:"sticky",top:0,zIndex:2},children:r.map((S,M)=>{var E;return e.jsxs("div",{onClick:()=>et(S),style:{...le(X[M],S,M===0,40),position:"relative",fontWeight:500,color:t.text,cursor:x&&S.sortable!==!1?"pointer":"default",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(S.header)?(E=S.header[0])==null?void 0:E.text:S.header||S.id}),x&&S.sortable!==!1&&e.jsx(Me,{active:k===S.id,dir:N}),p&&S.resizable!==!1&&M<r.length-1&&e.jsx("div",{onMouseDown:T=>rt(T,M),onClick:T=>T.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:T=>T.currentTarget.style.background=t.primary+"55",onMouseLeave:T=>T.currentTarget.style.background="transparent"})]},S.id)})}),Qe&&e.jsx("div",{style:{display:"flex",borderBottom:K,background:t.surface,flexShrink:0},children:r.map((S,M)=>e.jsx("div",{style:{width:X[M],minWidth:X[M],flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:M===0?"none":K},children:S.filterable&&S.filterType==="select"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:m[S.id]||"",onChange:E=>i(T=>({...T,[S.id]:E.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(Ue[S.id]||[]).map(E=>e.jsx("option",{value:E,children:E},E))]}):S.filterable?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:m[S.id]||"",onChange:E=>i(T=>({...T,[S.id]:E.target.value}))}):null},S.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",minHeight:0},children:[Y.map((S,M)=>{const E=oe(S,M),T=b.has(E),H=T?t.primaryLt:n&&M%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:s,borderBottom:K,flexShrink:0,background:H,transition:"background .1s",cursor:c?"pointer":"default"},onMouseEnter:A=>!T&&(A.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:A=>!T&&(A.currentTarget.style.background=H),children:r.map((A,_)=>{const ae=(j==null?void 0:j.key)===E&&(j==null?void 0:j.colId)===A.id,q=S[A.id],nt=A.template?A.template(q,S):String(q??"");return e.jsx("div",{onClick:()=>{se(S,M),u&&A.editable!==!1&&(V({key:E,colId:A.id}),ge(String(q??"")))},style:le(X[_],A,_===0,s),children:ae?e.jsx("input",{autoFocus:!0,value:U,onChange:G=>ge(G.target.value),onBlur:ye,onKeyDown:G=>{G.key==="Enter"&&ye(),G.key==="Escape"&&V(null)},onClick:G=>G.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}):nt},A.id)})},String(E))}),Y.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),Ze&&e.jsx("div",{style:{display:"flex",borderTop:K,background:t.bg,flexShrink:0},children:r.map((S,M)=>{var A;const E=(A=S.footer)==null?void 0:A[0],T=Je[S.id]??{sum:0,avg:0,count:0,min:0,max:0};let H="";return E&&(typeof E.text=="function"?H=E.text(T):E.text?H=E.text:E.summary&&(H=String(Math.round(T[E.summary]*100)/100))),e.jsx("div",{style:{...le(X[M],S,M===0,40),fontWeight:600,color:t.text},children:H},S.id)})})]})})})}const O=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function $e({type:r="bar",data:a=[],series:f=[],scales:s={},legend:x,height:p=280,style:u}){var k,z,N,D,m;h.useEffect(B,[]);const n=((k=s.bottom)==null?void 0:k.text)||a[0]&&Object.keys(a[0])[0]||"x",d=e.jsx(P.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),y=x?e.jsx(P.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:x.valign,align:x.halign}):null,c=e.jsx(P.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),w=e.jsx(P.XAxis,{dataKey:n,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),C=e.jsx(P.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((z=s.left)==null?void 0:z.min)??"auto",((N=s.left)==null?void 0:N.max)??"auto"]}),v={data:a,margin:{top:10,right:20,left:0,bottom:0}};let o;if(r==="bar")o=e.jsxs(P.BarChart,{...v,children:[c,w,C,d,y,f.map((i,b)=>e.jsx(P.Bar,{dataKey:i.value||i.id,name:i.label||i.id,fill:i.fill||O[b%O.length],radius:[3,3,0,0]},i.id))]});else if(r==="line")o=e.jsxs(P.LineChart,{...v,children:[c,w,C,d,y,f.map((i,b)=>e.jsx(P.Line,{type:"monotone",dataKey:i.value||i.id,name:i.label||i.id,stroke:i.color||O[b%O.length],strokeWidth:2,dot:{r:3,fill:i.color||O[b%O.length]}},i.id))]});else if(r==="area")o=e.jsxs(P.AreaChart,{...v,children:[c,w,C,d,y,f.map((i,b)=>e.jsx(P.Area,{type:"monotone",dataKey:i.value||i.id,name:i.label||i.id,stroke:i.color||O[b%O.length],fill:(i.fill||O[b%O.length])+"33",strokeWidth:2},i.id))]});else if(r==="pie"||r==="donut"){const i=a[0]||{},b=Object.keys(i).find(l=>typeof i[l]=="number")||"value",I=Object.keys(i).find(l=>typeof i[l]=="string")||"x";o=e.jsxs(P.PieChart,{children:[e.jsx(P.Pie,{data:a,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:b,nameKey:I,label:({name:l,percent:$})=>`${l??""} ${(($??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:a.map((l,$)=>e.jsx(P.Cell,{fill:O[$%O.length]},$))}),d,y]})}else r==="radar"?o=e.jsxs(P.RadarChart,{...v,cx:"50%",cy:"50%",children:[e.jsx(P.PolarGrid,{}),e.jsx(P.PolarAngleAxis,{dataKey:n,tick:{fontSize:11}}),f.map((i,b)=>e.jsx(P.Radar,{dataKey:i.value||i.id,name:i.label||i.id,stroke:i.color||O[b],fill:(i.fill||O[b])+"44"},i.id)),d,y]}):r==="scatter"&&(o=e.jsxs(P.ScatterChart,{...v,children:[c,e.jsx(P.XAxis,{dataKey:((D=f[0])==null?void 0:D.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(P.YAxis,{dataKey:((m=f[0])==null?void 0:m.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),d,f.map((i,b)=>e.jsx(P.Scatter,{data:i.data||a,name:i.label||i.id,fill:i.color||O[b]},i.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:p,padding:12,background:t.surface,borderRadius:t.rMd,...u},children:e.jsx(P.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=["Su","Mo","Tu","We","Th","Fr","Sa"];function Ne({value:r,range:a=!1,timepicker:f=!1,onChange:s,style:x}){const p=new Date,u=r?new Date(Array.isArray(r)?r[0]:r):p,[n,d]=h.useState(u),[y,c]=h.useState(r??(a?[null,null]:null)),[w,C]=h.useState(null),[v,o]=h.useState({h:0,m:0});h.useEffect(B,[]);const k=n.getFullYear(),z=n.getMonth(),N=new Date(k,z,1).getDay(),D=new Date(k,z+1,0).getDate(),m=[];for(let l=0;l<N;l++)m.push(null);for(let l=1;l<=D;l++)m.push(new Date(k,z,l));const i=l=>l.toDateString()===p.toDateString(),b=l=>{if(!y)return!1;if(a&&Array.isArray(y)){const[$,g]=y;if(!$)return!1;const W=l.getTime();return g?W>=$.getTime()&&W<=g.getTime():l.toDateString()===$.toDateString()}return l.toDateString()===y.toDateString()},I=l=>{if(a){const[$,g]=Array.isArray(y)?y:[null,null];if(!$||g)c([l,null]);else{const W=l<$?[l,$]:[$,l];c(W),s==null||s(W)}}else c(l),s==null||s(l)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...x},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>d(l=>new Date(l.getFullYear(),l.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[Ce[z]," ",k]}),e.jsx("button",{onClick:()=>d(l=>new Date(l.getFullYear(),l.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[Te.map(l=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:l},l)),m.map((l,$)=>{const g=l?b(l):!1,W=l&&w&&l.toDateString()===w.toDateString();return e.jsx("div",{onClick:()=>l&&I(l),onMouseEnter:()=>l&&C(l),onMouseLeave:()=>C(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:l?"pointer":"default",fontSize:12,fontWeight:l&&i(l)?700:400,background:g?t.primary:W?t.bg:"transparent",color:g?"#fff":l&&i(l)?t.primary:l?t.text:"transparent",border:l&&i(l)&&!g?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:l==null?void 0:l.getDate()},$)})]}),f&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:v.h,onChange:l=>o($=>({...$,h:+l.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:v.m,onChange:l=>o($=>({...$,m:+l.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function ce({value:r,onChange:a,timeFormat:f=12,controls:s=!1,minuteStep:x=5,style:p}){const[u,n]=h.useState((r==null?void 0:r.h)??(f===24?0:12)),[d,y]=h.useState((r==null?void 0:r.m)??0),[c,w]=h.useState((r==null?void 0:r.ampm)??"AM"),[C,v]=h.useState(null);h.useEffect(B,[]);const o=f===24?Array.from({length:24},(i,b)=>b):Array.from({length:12},(i,b)=>b+1),k=Array.from({length:Math.ceil(60/x)},(i,b)=>b*x),z=(i,b,I)=>{const l=f===24?{h:i,m:b}:{h:i,m:b,ampm:I};s?v(l):a==null||a(l)},N=()=>{v(null),n((r==null?void 0:r.h)??(f===24?0:12)),y((r==null?void 0:r.m)??0),w((r==null?void 0:r.ampm)??"AM")},D={display:"flex",flexDirection:"column",alignItems:"center",gap:4},m=i=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:i?700:400,background:i?t.primaryLt:"transparent",color:i?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...p},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:o.map(i=>e.jsx("div",{onClick:()=>{n(i),z(i,d,c)},style:m(u===i),onMouseEnter:b=>u!==i&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>u!==i&&(b.currentTarget.style.background="transparent"),children:String(i).padStart(2,"0")},i))})]}),e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:k.map(i=>e.jsx("div",{onClick:()=>{y(i),z(u,i,c)},style:m(d===i),onMouseEnter:b=>d!==i&&(b.currentTarget.style.background=t.bg),onMouseLeave:b=>d!==i&&(b.currentTarget.style.background="transparent"),children:String(i).padStart(2,"0")},i))})]}),f===12&&e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(i=>e.jsx("div",{onClick:()=>{w(i),z(u,d,i)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:c===i?700:400,background:c===i?t.primary:t.surface,color:c===i?"#fff":t.text},children:i},i))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(u).padStart(2,"0"),":",String(d).padStart(2,"0"),f===12?` ${c}`:""]}),s&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:N,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>C&&(a==null?void 0:a(C)),children:"Apply"})]})]})}function F(r,a){h.useEffect(()=>{const f=s=>{r.current&&!r.current.contains(s.target)&&a(s)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r,a])}function pe(r){const a=h.useRef(!1),f=h.useRef({x:0,y:0,ox:0,oy:0});return h.useCallback((s,x=0,p=0)=>{a.current=!0,f.current={x:s.clientX,y:s.clientY,ox:x,oy:p};const u=d=>{if(!a.current)return;const{x:y,y:c,ox:w,oy:C}=f.current;r(w+d.clientX-y,C+d.clientY-c)},n=()=>{a.current=!1,document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",u),document.addEventListener("mouseup",n),s.preventDefault()},[r])}const De=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function R({data:r=[],value:a,placeholder:f="Select or type...",multiselection:s=!1,label:x,onChange:p,style:u}){var I;const[n,d]=h.useState(!1),[y,c]=h.useState(""),[w,C]=h.useState(s?a?[].concat(a):[]:a||null),v=h.useRef(null),o=h.useRef(null);h.useEffect(B,[]),F(v,h.useCallback(()=>{d(!1),c("")},[]));const k=h.useMemo(()=>r.filter(l=>!y||l.value.toLowerCase().includes(y.toLowerCase())),[r,y]),z=l=>s?(w||[]).includes(l):w===l,N=l=>{const $=l.id||l.value;if(s){const g=z($)?w.filter(W=>W!==$):[...w||[],$];C(g),p==null||p(g)}else C($),c(""),d(!1),p==null||p($)},D=l=>{const $=w.filter(g=>g!==l);C($),p==null||p($)},m=()=>{d(!0),setTimeout(()=>{var l;return(l=o.current)==null?void 0:l.focus()},0)},i=((I=r.find(l=>(l.id||l.value)===w))==null?void 0:I.value)||"",b=s?w||[]:[];return e.jsxs("div",{ref:v,className:"dhx",style:{position:"relative",...u},children:[x&&e.jsx("label",{className:"dhx dhx-label",children:x}),e.jsxs("div",{onClick:m,style:{display:"flex",alignItems:"center",flexWrap:s?"wrap":"nowrap",border:`1px solid ${n?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:n?`0 0 0 3px ${t.primary}22`:"none"},children:[s&&e.jsxs(e.Fragment,{children:[b.map(l=>{var $;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[(($=r.find(g=>(g.id||g.value)===l))==null?void 0:$.value)||l,e.jsx("span",{onClick:g=>{g.stopPropagation(),D(l)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},l)}),e.jsx("input",{ref:o,value:y,onChange:l=>{c(l.target.value),d(!0)},onFocus:()=>d(!0),onClick:l=>l.stopPropagation(),placeholder:b.length?"":f,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!s&&e.jsx("input",{ref:o,value:n?y:i,onChange:l=>{c(l.target.value),d(!0)},onFocus:()=>{d(!0),c("")},onClick:l=>l.stopPropagation(),placeholder:f,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(De,{open:n})]}),n&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[k.map(l=>{const $=l.id||l.value,g=z($);return e.jsxs("div",{onClick:()=>N(l),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:g?t.primaryLt:"transparent",color:g?t.primary:t.text},onMouseEnter:W=>!g&&(W.currentTarget.style.background=t.bg),onMouseLeave:W=>!g&&(W.currentTarget.style.background="transparent"),children:[s&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${g?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:g?t.primary:"transparent"},children:g&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:l.value}),!s&&g&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),l.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",l.count,")"]})]},$)}),k.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function ee({min:r=0,max:a=100,step:f=1,value:s,range:x=!1,label:p,tick:u,disabled:n=!1,onChange:d,style:y}){const[c,w]=h.useState(s??(x?[r,a]:r));h.useEffect(B,[]);const C=(N,D)=>{if(!n)if(x){const m=[...c];m[N]=D,w(m),d==null||d(m)}else w(D),d==null||d(D)},v=N=>(N-r)/(a-r)*100,o=x?c:[c],k=x?{left:`${v(o[0])}%`,width:`${v(o[1])-v(o[0])}%`}:{left:0,width:`${v(o[0])}%`},z=n?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:n?.5:1,...y},children:[p&&e.jsx("label",{className:"dhx dhx-label",children:p}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...k,height:"100%",background:z,borderRadius:2}}),o.map((N,D)=>e.jsx("input",{type:"range",min:r,max:a,step:f,value:N,disabled:n,onChange:m=>{const i=+m.target.value;x&&D===0&&i>=c[1]||x&&D===1&&i<=c[0]||C(D,i)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:n?"not-allowed":"pointer",top:0,left:0,margin:0}},D)),o.map((N,D)=>e.jsx("div",{style:{position:"absolute",left:`${v(N)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${z}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:n?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:N})},D))]})}),u&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((a+r)/2),a].map(N=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:N},N))})]})}const Ee=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function te(r){const a=parseInt(r.slice(1,3),16)/255,f=parseInt(r.slice(3,5),16)/255,s=parseInt(r.slice(5,7),16)/255,x=Math.max(a,f,s),p=Math.min(a,f,s);let u=0,n=0;const d=(x+p)/2;if(x!==p){const y=x-p;n=d>.5?y/(2-x-p):y/(x+p),u=x===a?((f-s)/y+(f<s?6:0))/6:x===f?((s-a)/y+2)/6:((a-f)/y+4)/6}return[Math.round(u*360),Math.round(n*100),Math.round(d*100)]}function he(r,a,f){a/=100,f/=100;const s=a*Math.min(f,1-f),x=p=>{const u=(p+r/30)%12,n=f-s*Math.max(Math.min(u-3,9-u,1),-1);return Math.round(255*n).toString(16).padStart(2,"0")};return"#"+x(0)+x(8)+x(4)}function Ie({value:r="#0288d1",onChange:a,style:f}){const[s,x]=h.useState(()=>te(r)),p=he(...s);h.useEffect(B,[]);const u=n=>{x(n),a==null||a(he(...n))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...f},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${s[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,s[0]],["Saturation",0,100,s[1]],["Lightness",0,100,s[2]]].map(([n,d,y,c],w)=>e.jsxs("div",{style:{marginBottom:w<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[n,w>0?` (${c}%)`:""]}),e.jsx("input",{type:"range",min:d,max:y,value:c,onChange:C=>{const v=[...s];v[w]=+C.target.value,u(v)},style:{width:"100%",accentColor:t.primary}})]},n)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:p,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:p,onChange:n=>{try{u(te(n.target.value)),a==null||a(n.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:Ee.map(n=>e.jsx("div",{onClick:()=>{x(te(n)),a==null||a(n)},style:{width:14,height:14,borderRadius:2,background:n,cursor:"pointer",border:p===n?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:d=>d.currentTarget.style.transform="scale(1.3)",onMouseLeave:d=>d.currentTarget.style.transform="scale(1)"},n))})]})}function J({items:r,onSelect:a,style:f}){const[s,x]=h.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...f},children:r.map((p,u)=>{var d,y;if(p.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},u);const n=s===u;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x(u),onMouseLeave:()=>x(null),children:[e.jsxs("div",{onClick:()=>{var c;return!p.disabled&&!((c=p.items)!=null&&c.length)&&a(p)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:p.disabled?"not-allowed":"pointer",fontSize:13,color:p.disabled?t.textMut:t.text,background:n&&!p.disabled?t.bg:"transparent",opacity:p.disabled?.5:1},children:[p.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:p.icon}),e.jsx("span",{style:{flex:1},children:p.value||p.id}),p.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:p.hotkey}),(d=p.items)!=null&&d.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),n&&((y=p.items)!=null&&y.length)?e.jsx(J,{items:p.items,onSelect:a,style:{position:"absolute",left:"100%",top:-4}}):null]},p.id||u)})})}function Le({items:r=[],label:a="Menu",onSelect:f,style:s}){const[x,p]=h.useState(!1),u=h.useRef(null);return h.useEffect(B,[]),F(u,h.useCallback(()=>p(!1),[])),e.jsxs("div",{ref:u,className:"dhx",style:{position:"relative",display:"inline-block",...s},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>p(n=>!n),children:[a," ",e.jsx("span",{style:{fontSize:10},children:x?"▲":"▼"})]}),x&&e.jsx(J,{items:r,onSelect:n=>{f==null||f(n),p(!1)}})]})}function We({items:r=[],onSelect:a,children:f}){const[s,x]=h.useState(null),p=h.useRef(null);h.useEffect(B,[]),F(p,h.useCallback(()=>x(null),[]));const u=n=>{n.preventDefault(),x({x:n.clientX,y:n.clientY})};return e.jsxs("div",{ref:p,onContextMenu:u,style:{position:"relative",display:"contents"},children:[f,s&&e.jsx("div",{style:{position:"fixed",left:s.x,top:s.y,zIndex:9999},children:e.jsx(J,{items:r,onSelect:n=>{a==null||a(n),x(null)}})})]})}function Ae({trigger:r,children:a,placement:f="bottom-start",style:s}){const[x,p]=h.useState(!1),[u,n]=h.useState({top:"100%",left:0}),d=h.useRef(null),y=h.useRef(null);h.useEffect(B,[]),F(d,h.useCallback(()=>p(!1),[]));const c=()=>{p(w=>{if(!w&&y.current){const C=y.current.getBoundingClientRect(),v={"bottom-start":{top:C.height+4,left:0},"bottom-end":{top:C.height+4,right:0,left:"auto"},"top-start":{bottom:C.height+4,top:"auto",left:0}};n(v[f]||v["bottom-start"])}return!w})};return e.jsxs("div",{ref:d,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:y,onClick:c,children:r}),x&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...u,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...s},children:a})]})}function Be({title:r,children:a,width:f=480,height:s,closable:x=!0,movable:p=!0,modal:u=!1,defaultOpen:n=!0,footer:d,onClose:y,style:c}){const[w,C]=h.useState(n),[v,o]=h.useState({x:0,y:0});h.useEffect(B,[]);const k=pe(h.useCallback((N,D)=>p&&o({x:N,y:D}),[p])),z=()=>{C(!1),y==null||y()};return w?e.jsxs(e.Fragment,{children:[u&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:x?z:void 0}),e.jsxs("div",{className:"dhx",style:{position:u?"fixed":"absolute",left:u?"50%":`calc(50% + ${v.x}px)`,top:u?"50%":`calc(50% + ${v.y}px)`,transform:`translate(calc(-50% + ${v.x}px), calc(-50% + ${v.y}px))`,width:f,...s?{height:s}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...c},children:[e.jsxs("div",{onMouseDown:N=>k(N,v.x,v.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:p?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),x&&e.jsx("button",{onClick:z,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:N=>N.currentTarget.style.background=t.border,onMouseLeave:N=>N.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:a}),d&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:d})]})]}):null}const re=h.createContext(null),He={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},fe={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function Pe({children:r}){const[a,f]=h.useState([]);h.useEffect(B,[]);const s=h.useCallback(u=>f(n=>n.filter(d=>d.id!==u)),[]),x=h.useCallback(u=>{const n=Date.now();return f(d=>[...d,{id:n,...u}]),u.duration!==0&&setTimeout(()=>s(n),u.duration||4e3),n},[s]),p={message:x,alert:(u,n)=>x({type:"info",title:u,...n}),confirm:(u,n,d)=>x({type:"warning",title:u,confirm:n,...d})};return e.jsxs(re.Provider,{value:p,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:a.map(u=>{const n=u.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${fe[n]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:fe[n],lineHeight:1},children:He[n]}),e.jsxs("div",{style:{flex:1},children:[u.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:u.text?3:0},children:u.title}),u.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:u.text}),u.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!0),s(u.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{u.confirm(!1),s(u.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>s(u.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},u.id)})})]})}function je(){const r=h.useContext(re);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function Oe({data:r=[],template:a,keyNavigation:f=!0,multiselection:s=!1,editable:x=!1,height:p=400,onSelect:u,onEdit:n,style:d}){const[y,c]=h.useState(new Set),[w,C]=h.useState(null),[v,o]=h.useState(""),[k,z]=h.useState(null);h.useEffect(B,[]);const N=(m,i)=>{const b=m.id??i;c(I=>{const l=s?new Set(I):new Set;return l.has(b)?l.delete(b):l.add(b),l}),z(i),u==null||u(m)},D=(m,i)=>{n==null||n({...m,value:v},i),C(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:p,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...d},tabIndex:0,onKeyDown:m=>{f&&(m.key==="ArrowDown"&&z(i=>Math.min((i??-1)+1,r.length-1)),m.key==="ArrowUp"&&z(i=>Math.max((i??1)-1,0)))},children:[r.map((m,i)=>{const b=m.id??i,I=y.has(b),l=k===i;return e.jsx("div",{onClick:()=>N(m,i),onDoubleClick:()=>x&&(C(i),o(String(m.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:I?t.primaryLt:l?t.bg:t.surface,color:I?t.primary:t.text,outline:l?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:w===i?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:v,onChange:$=>o($.target.value),onBlur:()=>D(m,i),onKeyDown:$=>{$.key==="Enter"&&D(m,i),$.key==="Escape"&&C(null)},onClick:$=>$.stopPropagation()}):a?e.jsx("div",{dangerouslySetInnerHTML:{__html:a(m)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(m.value??"")})},String(b))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function Ye({data:r=[],template:a,itemsInRow:f=3,gap:s=12,multiselection:x=!1,onSelect:p,style:u}){const[n,d]=h.useState(new Set);h.useEffect(B,[]);const y=c=>{const w=c.id??String(c.title);d(C=>{const v=x?new Set(C):new Set;return v.has(w)?v.delete(w):v.add(w),v}),p==null||p(c)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${f}, 1fr)`,gap:s,padding:s,...u},children:r.map((c,w)=>{const C=c.id??w,v=n.has(C);return e.jsx("div",{onClick:()=>y(c),style:{background:t.surface,border:`2px solid ${v?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:v?`0 0 0 3px ${t.primary}33`:t.shadow,transform:v?"translateY(-2px)":"none"},onMouseEnter:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=v?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=v?"translateY(-2px)":"none"},children:a?e.jsx("div",{dangerouslySetInnerHTML:{__html:a(c)}}):e.jsxs("div",{style:{padding:16},children:[c.img&&e.jsx("img",{src:c.img,alt:c.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:c.title||c.value}),c.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:c.subtitle})]})},String(C))})})}function Ke({data:r=[],checkbox:a=!1,editable:f=!1,onSelect:s,onCheck:x,style:p}){const[u,n]=h.useState({}),[d,y]=h.useState(null),[c,w]=h.useState({}),[C,v]=h.useState(null),[o,k]=h.useState("");h.useEffect(B,[]);const z=m=>n(i=>({...i,[m]:!i[m]})),N=(m,i)=>{w(b=>({...b,[m]:i})),x==null||x(m,i)},D=(m,i=0)=>{var $;const b=((($=m.items)==null?void 0:$.length)??0)>0,I=u[m.id],l=d===m.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{y(m.id),s==null||s(m),b&&z(m.id)},onDoubleClick:()=>{f&&(v(m.id),k(m.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+i*18}px`,cursor:"pointer",borderRadius:t.r,margin:"1px 4px",background:l?t.primaryLt:"transparent",color:l?t.primary:t.text,userSelect:"none",fontSize:13},onMouseEnter:g=>!l&&(g.currentTarget.style.background=t.bg),onMouseLeave:g=>!l&&(g.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},children:b?I?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:b?I?"📂":"📁":"📄"}),a&&e.jsx("input",{type:"checkbox",checked:!!c[m.id],onChange:g=>{g.stopPropagation(),N(m.id,g.target.checked)},style:{cursor:"pointer",accentColor:t.primary},onClick:g=>g.stopPropagation()}),C===m.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:o,onChange:g=>k(g.target.value),onBlur:()=>v(null),onKeyDown:g=>g.key==="Enter"&&v(null),onClick:g=>g.stopPropagation()}):e.jsx("span",{style:{flex:1},children:m.value}),m.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",m.count,")"]})]}),b&&I&&e.jsx("div",{children:m.items.map(g=>D(g,i+1))})]},m.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...p},children:r.map(m=>D(m))})}function Fe({total:r,pageSize:a=10,page:f,onChange:s,style:x}){const[p,u]=h.useState(f||1),n=Math.ceil(r/a);h.useEffect(B,[]);const d=c=>{const w=Math.min(Math.max(1,c),n);u(w),s==null||s(w)},y=h.useMemo(()=>{const c=[];for(let C=Math.max(1,p-2);C<=Math.min(n,p+2);C++)c.push(C);return c[0]>1&&(c[0]>2&&c.unshift("..."),c.unshift(1)),c[c.length-1]<n&&(c[c.length-1]<n-1&&c.push("..."),c.push(n)),c},[p,n]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...x},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(p-1)*a+1,"–",Math.min(p*a,r)," of ",r]}),[["«",1],["‹",p-1]].map(([c,w])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:p===1,onClick:()=>d(w),children:c},c)),y.map((c,w)=>e.jsx("button",{onClick:()=>typeof c=="number"&&d(c),className:`dhx dhx-btn ${c===p?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:c==="...",children:c},w)),[["›",p+1],["»",n]].map(([c,w])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:p===n,onClick:()=>d(w),children:c},c))]})}function Ve({config:r={},defaultValues:a={},onSubmit:f,style:s}){const[x,p]=h.useState(a),[u,n]=h.useState({}),[d,y]=h.useState(null);h.useEffect(B,[]);const c=(o,k)=>{p(z=>({...z,[o]:k})),n(z=>({...z,[o]:null}))},w=()=>{const o={};return(r.rows||[]).flat().forEach(k=>{k&&typeof k=="object"&&"name"in k&&k.required&&!x[k.name]&&(o[k.name]=`${k.label||k.name} is required`)}),n(o),Object.keys(o).length===0},C=o=>{const k=x[o.name]??o.value??"",z=u[o.name],N=o.labelWidth??r.labelWidth,D=N!==void 0||o.labelPosition==="left";if(o.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:o.label}),(o.rows||[]).map(g=>C(g))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const m=N?{minWidth:N,width:N,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},i=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...m},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,b=z?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:z}):null,I=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,l={key:o.name,className:"dhx-form-group"},$=g=>D?e.jsxs("div",{...l,style:{display:"flex",alignItems:"flex-start",gap:8},children:[i,e.jsxs("div",{style:{flex:1,minWidth:0},children:[g,b,I]})]}):e.jsxs("div",{...l,children:[i,g,b,I]});if(!o.type||o.type==="input")return $(e.jsxs("div",{className:"dhx-input-wrap",children:[o.icon&&e.jsx("span",{className:"dhx-input-icon",children:o.icon}),e.jsx("input",{className:`dhx dhx-input${o.icon?" dhx-input--with-icon":""}`,style:{borderColor:z?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:k,onChange:g=>c(o.name,g.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return $(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:k,onChange:g=>c(o.name,g.target.value)}));if(o.type==="select")return $(e.jsxs("select",{className:"dhx dhx-input",value:k,onChange:g=>c(o.name,g.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(g=>e.jsx("option",{value:g.value,children:g.label||g.value},g.value))]}));if(o.type==="datepicker")return $(e.jsx("input",{type:"date",className:"dhx dhx-input",value:k,onChange:g=>c(o.name,g.target.value)}));if(o.type==="timepicker"){const g=x[o.name]??{h:12,m:0,ampm:"AM"},W=!!x[o.name],j=W?`${String(g.h).padStart(2,"0")}:${String(g.m).padStart(2,"0")}${g.ampm?" "+g.ampm:""}`:o.placeholder||"Click to select",V=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>y(d===o.name?null:o.name),children:[e.jsx("span",{style:{color:W?t.text:t.textMut},children:j}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),d===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(ce,{value:g,controls:!0,onChange:U=>{c(o.name,U),y(null)}})})]});return $(V)}if(o.type==="colorpicker")return $(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:k||"#000000",onChange:g=>c(o.name,g.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:k||"#000000"})]}));if(o.type==="text")return $(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...l,children:[D?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[N&&e.jsx("div",{style:{width:N,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!k,onChange:g=>c(o.name,g.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!k,onChange:g=>c(o.name,g.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),I]});if(o.type==="radio"){const g=(o.options||[]).map(W=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:W.value,checked:k===W.value,onChange:()=>c(o.name,W.value),style:{accentColor:t.primary,cursor:"pointer"}}),W.label||W.value]},W.value));return $(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:g}))}if(o.type==="slider")return D?e.jsxs("div",{...l,style:{display:"flex",alignItems:"flex-start",gap:8},children:[i,e.jsxs("div",{style:{flex:1},children:[e.jsx(ee,{min:o.min,max:o.max,step:o.step,value:k||o.min,range:o.range,onChange:g=>c(o.name,g)}),I]})]}):e.jsxs("div",{...l,children:[e.jsx(ee,{label:o.label,min:o.min,max:o.max,step:o.step,value:k||o.min,range:o.range,onChange:g=>c(o.name,g)}),I]});if(o.type==="combo")return D?e.jsxs("div",{...l,style:{display:"flex",alignItems:"flex-start",gap:8},children:[i,e.jsxs("div",{style:{flex:1},children:[e.jsx(R,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:k||(o.multiselection?[]:null),onChange:g=>c(o.name,g)}),b,I]})]}):e.jsxs("div",{...l,children:[e.jsx(R,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:k||(o.multiselection?[]:null),onChange:g=>c(o.name,g)}),b,I]});if(o.type==="toggle"){const g=!!k,W=g?o.icon:o.offIcon||o.icon,j=g?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...l,children:[D&&N&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:N,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(ue,{on:g,onClick:()=>c(o.name,!k)}),W&&e.jsx("span",{style:{fontSize:16},children:W}),j&&e.jsx("span",{style:{fontSize:13},children:j})]})]}),!D&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(ue,{on:g,onClick:()=>c(o.name,!k)}),W&&e.jsx("span",{style:{fontSize:16},children:W}),j&&e.jsx("span",{style:{fontSize:13},children:j})]}),I]})}return null},v=o=>o.map((k,z)=>Array.isArray(k)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:k.map(C)},z):C(k));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...s},children:[v(r.rows||[]),(r.buttons||f)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>w()&&(f==null?void 0:f(x)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{p(a),n({})},children:r.resetText||"Reset"})]})]})}function ue({on:r,onClick:a}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:a,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function xe(r){const a=[];for(const f of r)"type"in f&&f.type==="block"?a.push(...f.items||[]):a.push(f);return a}function Xe({items:r=[],onAction:a,style:f}){h.useEffect(B,[]);const[s,x]=h.useState(()=>{const n={};for(const d of xe(r))d.id&&(n[d.id]=!!d.active);return n}),p=n=>{var d;if(n.id)if(n.group){const y=xe(r).filter(c=>c.group===n.group&&c.id);x(c=>{const w={...c};for(const C of y)w[C.id]=!1;return w[n.id]=!0,w})}else n.twoState&&x(y=>({...y,[n.id]:!y[n.id]}));(d=n.onClick)==null||d.call(n,n),n.id&&(a==null||a(n.id,n))},u=(n,d)=>{var w,C;if("type"in n&&(n.type==="separator"||n.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},d);if("type"in n&&n.type==="input"){const v=n;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:v.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:v.width||110,height:26,fontSize:12},placeholder:v.placeholder,defaultValue:v.value,onChange:o=>{var k;return(k=v.onChange)==null?void 0:k.call(v,o.target.value)}})]},d)}if("type"in n&&n.type==="block"){const v=n;return e.jsxs("div",{style:{display:"flex",flexDirection:v.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(w=v.items)==null?void 0:w.map((o,k)=>u(o,k))}),v.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:v.label})]},d)}if("type"in n&&n.type==="selectButton"){const v=n;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:v.value,onChange:o=>{var k;return(k=v.onChange)==null?void 0:k.call(v,o.target.value)},children:(C=v.items)==null?void 0:C.map(o=>e.jsx("option",{value:o.value,children:o.value},o.value))},d)}const y=n,c=y.id!==void 0?s[y.id]??!!y.active:!!y.active;return e.jsxs("button",{title:y.tooltip,className:`dhx dhx-btn ${c?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:y.disabled,onClick:()=>p(y),children:[y.icon&&e.jsx("span",{style:{fontSize:y.size==="large"?24:18},children:y.icon}),y.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:y.text})]},d)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...f},children:r.map(u)})}function _e({logo:r,items:a=[],vertical:f=!1,style:s}){const[x,p]=h.useState(null),u=h.useRef(null);h.useEffect(B,[]),F(u,h.useCallback(()=>p(null),[]));const n=(d,y)=>{var c;return d.type==="separator"?e.jsx("div",{style:{[f?"height":"width"]:1,background:t.border,margin:f?"4px 8px":"0 6px",alignSelf:"stretch"}},y):d.type==="spacer"?e.jsx("div",{style:{flex:1}},y):d.type==="input"?e.jsx("input",{className:"dhx dhx-input",style:{width:d.width||200,height:28,margin:"0 4px"},placeholder:d.placeholder},y):d.type==="menuItem"&&((c=d.items)!=null&&c.length)?e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,color:t.text},onClick:()=>p(x===y?null:y),children:[d.icon&&e.jsx("span",{children:d.icon}),d.value," ",e.jsx("span",{style:{fontSize:9},children:"▼"})]}),x===y&&e.jsx(J,{items:d.items,onSelect:()=>p(null),style:{top:"100%"}})]},y):e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:36,gap:6,color:t.text},onClick:()=>{var w;return(w=d.onClick)==null?void 0:w.call(d)},children:[d.icon&&e.jsx("span",{style:{fontSize:16},children:d.icon}),d.value&&e.jsx("span",{style:{fontSize:13},children:d.value})]},y)};return e.jsxs("nav",{ref:u,className:"dhx",style:{display:"flex",flexDirection:f?"column":"row",alignItems:f?"stretch":"center",background:t.surface,borderBottom:f?"none":`1px solid ${t.border}`,borderRight:f?`1px solid ${t.border}`:"none",padding:f?"12px 0":"0 12px",minHeight:f?void 0:48,gap:2,...s},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:f?"8px 16px":"0 12px 0 4px",borderRight:f?"none":`1px solid ${t.border}`,marginRight:f?0:8},children:r}),a.map(n)]})}L.Button=ve,L.Calendar=Ne,L.Chart=$e,L.Colorpicker=Ie,L.Combobox=R,L.ContextMenu=We,L.DataView=Ye,L.Form=Ve,L.Grid=ze,L.Layout=de,L.List=Oe,L.Menu=Le,L.MenuDropdown=J,L.MessageContext=re,L.MessageProvider=Pe,L.Navbar=_e,L.Pagination=Fe,L.Popup=Ae,L.Ribbon=Xe,L.Sidebar=ke,L.Slider=ee,L.Tabbar=me,L.Timepicker=ce,L.Toolbar=Se,L.Tree=Ke,L.Window=Be,L.tokens=t,L.useClickOutside=F,L.useDrag=pe,L.useMessage=je,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
41
|
+
`,document.head.appendChild(r)}const Ne={sm:{height:24,padding:"0 8px",fontSize:12},md:{},lg:{height:38,padding:"0 18px",fontSize:14}};function Ie({children:r,variant:l="primary",size:d="md",icon:s,disabled:u,onClick:a,style:h,className:n=""}){return x.useEffect(j,[]),e.jsxs("button",{className:`dhx dhx-btn dhx-btn-${l} ${n}`,style:{...Ne[d],...h},disabled:u,onClick:a,children:[s&&e.jsx("span",{style:{fontSize:16},children:s}),r]})}function We({items:r=[],style:l}){x.useEffect(j,[]);const d=(s,u)=>{var h;if(s.type==="separator")return e.jsx("div",{style:{width:1,background:t.border,margin:"6px 4px",alignSelf:"stretch"}},u);if(s.type==="spacer")return e.jsx("div",{style:{flex:1}},u);if(s.type==="input")return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.label&&e.jsx("span",{style:{fontSize:12,color:t.textSec,fontWeight:500},children:s.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:s.width||140,height:28},placeholder:s.placeholder,defaultValue:s.value,onChange:n=>{var g;return(g=s.onChange)==null?void 0:g.call(s,n.target.value)}})]},u);if(s.type==="select")return e.jsx("select",{className:"dhx dhx-input",style:{width:s.width||100,height:28,cursor:"pointer"},defaultValue:s.value,onChange:n=>{var g;return(g=s.onChange)==null?void 0:g.call(s,n.target.value)},children:(h=s.options)==null?void 0:h.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))},u);const a=s.active;return e.jsxs("button",{className:`dhx dhx-btn ${a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:32,gap:4,...s.twoState&&a?{background:t.primaryLt,color:t.primary,borderColor:`${t.primary}66`}:{}},disabled:s.disabled,onClick:()=>{var n;return(n=s.onClick)==null?void 0:n.call(s,s)},children:[s.icon&&e.jsx("span",{style:{fontSize:16},children:s.icon}),s.text&&e.jsx("span",{children:s.text})]},u)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:2,padding:"4px 8px",background:t.surface,borderBottom:`1px solid ${t.border}`,minHeight:44,flexWrap:"wrap",...l},children:r.map(d)})}function Ae({items:r=[],width:l=240,collapsed:d,onSelect:s,header:u,footer:a,style:h}){const[n,g]=x.useState(d??!1),[b,c]=x.useState(null),[M,f]=x.useState({});x.useEffect(j,[]);const y=n?56:l,o=m=>{c(m.id),s==null||s(m)},k=(m,C=0)=>{var v;if(m.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"6px 8px"}},m.id);if(m.type==="customHTML")return e.jsx("div",{style:{padding:"8px 12px"},dangerouslySetInnerHTML:{__html:m.html||""}},m.id);const D=(((v=m.items)==null?void 0:v.length)??0)>0,T=M[m.id],p=b===m.id;return e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>{D&&f(I=>({...I,[m.id]:!I[m.id]})),o(m)},style:{display:"flex",alignItems:"center",gap:10,padding:`8px ${n?"0px":`${12+C*16}px`}`,cursor:"pointer",borderRadius:t.r,margin:"1px 6px",justifyContent:n?"center":"flex-start",transition:"all .15s",background:p?t.primaryLt:"transparent",color:p?t.primary:t.text,userSelect:"none"},onMouseEnter:I=>!p&&(I.currentTarget.style.background=t.bg),onMouseLeave:I=>!p&&(I.currentTarget.style.background="transparent"),children:[m.icon&&e.jsx("span",{style:{fontSize:18,minWidth:22,textAlign:"center"},children:m.icon}),!n&&e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:p?600:400},children:m.value}),!n&&m.count!==void 0&&e.jsx("span",{style:{background:t.primary,color:"#fff",borderRadius:10,padding:"1px 6px",fontSize:11,fontWeight:700},children:m.count}),!n&&D&&e.jsx("span",{style:{fontSize:12,color:t.textMut,transition:"transform .15s",transform:T?"rotate(90deg)":"rotate(0deg)"},children:"▶"})]}),D&&T&&!n&&m.items.map(I=>k(I,C+1))]},m.id)};return e.jsxs("div",{className:"dhx",style:{width:y,minWidth:y,background:t.surface,borderRight:`1px solid ${t.border}`,display:"flex",flexDirection:"column",transition:"width .2s ease",overflow:"hidden",...h},children:[u&&!n&&e.jsx("div",{style:{padding:"12px 14px",borderBottom:`1px solid ${t.border}`,fontWeight:700,fontSize:15},children:u}),e.jsx("button",{onClick:()=>g(m=>!m),style:{margin:"8px 6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:n?"center":"flex-end",padding:"4px 6px",borderRadius:t.r,color:t.textSec},children:e.jsx("span",{style:{fontSize:18},children:n?"☰":"✕"})}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden"},children:r.map(m=>k(m))}),a&&!n&&e.jsx("div",{style:{padding:"10px 14px",borderTop:`1px solid ${t.border}`},children:a})]})}function Be({config:r}){const[l,d]=x.useState(!1),s={position:"relative",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...r.width?{width:r.width,minWidth:r.width}:{flex:1},...r.height?{height:r.height,minHeight:r.height}:{minHeight:40},...l?{flex:"0 0 auto"}:{}};return e.jsxs("div",{style:s,children:[r.header&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",background:t.bg,borderBottom:`1px solid ${t.border}`,fontSize:12,fontWeight:600,color:t.textSec,userSelect:"none"},children:[e.jsx("span",{children:r.header}),r.collapsable&&e.jsx("button",{onClick:()=>d(u=>!u),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:16,lineHeight:1},children:l?"▼":"▲"})]}),!l&&e.jsxs("div",{style:{padding:r.padding||0,height:r.header?"calc(100% - 33px)":"100%",overflow:"auto"},children:[r.html?e.jsx("div",{dangerouslySetInnerHTML:{__html:r.html}}):r.content,(r.rows||r.cols)&&e.jsx(we,{rows:r.rows,cols:r.cols,style:{height:"100%"}})]})]})}function we({rows:r,cols:l,type:d="line",style:s,children:u}){x.useEffect(j,[]);const a=d==="space"?12:d==="wide"?8:1,h=r||l,n=!!r;return h?e.jsx("div",{className:"dhx",style:{display:"flex",flexDirection:n?"column":"row",gap:a,width:"100%",height:"100%",...s},children:h.map((g,b)=>e.jsx(Be,{config:g},g.id||b))}):e.jsx("div",{className:"dhx",style:{width:"100%",height:"100%",...s},children:u})}function He({views:r=[],mode:l="top",tabAlign:d="left",closable:s=[],disabled:u=[],defaultActive:a,onBeforeChange:h,onChange:n,style:g}){var p;const[b,c]=x.useState(a||((p=r[0])==null?void 0:p.id)),[M,f]=x.useState(r.map(v=>v.id));x.useEffect(j,[]);const y=(v,I)=>{v.stopPropagation(),f(i=>i.filter($=>$!==I)),b===I&&c(M.find(i=>i!==I)??"")},o=v=>{u.includes(v)||h&&h(v)===!1||(c(v),n==null||n(v))},k=l==="left"||l==="right",m=r.filter(v=>M.includes(v.id)),C=e.jsx("div",{style:{display:"flex",flexDirection:k?"column":"row",justifyContent:d==="center"?"center":d==="right"?"flex-end":"flex-start",background:t.surface,borderBottom:!k&&l!=="bottom"?`2px solid ${t.border}`:"none",borderTop:l==="bottom"?`2px solid ${t.border}`:"none",borderRight:l==="left"?`2px solid ${t.border}`:"none",borderLeft:l==="right"?`2px solid ${t.border}`:"none",overflowX:"auto",flexShrink:0},children:m.map(v=>{const I=b===v.id,i=u.includes(v.id),$=l==="bottom"?{borderTop:`2px solid ${t.primary}`,color:t.primary,fontWeight:600}:k?{color:t.primary,fontWeight:600,background:t.primaryLt,[l==="left"?"borderRight":"borderLeft"]:`2px solid ${t.primary}`}:{borderBottom:`2px solid ${t.primary}`,color:t.primary,fontWeight:600};return e.jsxs("div",{onClick:()=>o(v.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",cursor:i?"not-allowed":"pointer",whiteSpace:"nowrap",fontSize:13,transition:"color .15s",userSelect:"none",minWidth:k?120:"auto",...I?$:{color:i?t.textMut:t.textSec}},children:[v.icon&&e.jsx("span",{style:{fontSize:16},children:v.icon}),e.jsx("span",{children:v.tab}),s.includes(v.id)&&e.jsx("span",{onClick:S=>y(S,v.id),style:{marginLeft:4,opacity:.6,fontSize:12,cursor:"pointer"},children:"✕"})]},v.id)})}),D=m.find(v=>v.id===b),T=e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflow:"auto"},children:[D==null?void 0:D.content,(D==null?void 0:D.html)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:D.html},style:{padding:16}})]});return e.jsxs("div",{className:"dhx",style:{display:"flex",flexDirection:l==="top"?"column":l==="bottom"?"column-reverse":l==="left"?"row":"row-reverse",width:"100%",height:"100%",background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden",...g},children:[C,T]})}const U=`1px solid ${t.border}`;function Pe({active:r,dir:l}){return e.jsxs("span",{style:{display:"inline-flex",flexDirection:"column",gap:1,flexShrink:0,marginLeft:4},children:[e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 0L7 4H0z",fill:r&&l==="asc"?t.primary:t.borderDk})}),e.jsx("svg",{width:"7",height:"4",viewBox:"0 0 7 4",children:e.jsx("path",{d:"M3.5 4L0 0H7z",fill:r&&l==="desc"?t.primary:t.borderDk})})]})}function je({columns:r,data:l=[],height:d=400,rowHeight:s=40,sortable:u=!0,resizable:a=!0,editable:h=!1,stripe:n=!1,autoWidth:g=!1,keyNavigation:b=!1,selection:c,multiselect:M,onSelect:f,onChange:y,style:o}){const[k,m]=x.useState(null),[C,D]=x.useState("asc"),[T,p]=x.useState({}),[v,I]=x.useState(new Set),[i,$]=x.useState(-1),[S,B]=x.useState(()=>r.map(w=>w.width??w.minWidth??150)),[V,J]=x.useState(null),[Q,le]=x.useState(""),[oe,ae]=x.useState({}),E=x.useRef(null),[P,F]=x.useState(0);x.useEffect(j,[]),x.useEffect(()=>{if(!g||!E.current)return;const w=new ResizeObserver(()=>{var z;return F(((z=E.current)==null?void 0:z.offsetWidth)??0)});return w.observe(E.current),()=>w.disconnect()},[g]);const X=x.useMemo(()=>{if(!g||P===0)return S;const w=S.reduce((N,L)=>N+L,0);if(P<=w)return S;const z=(P-w)/r.length;return S.map(N=>N+z)},[g,P,S,r.length]),K=x.useMemo(()=>{let w=l.map((z,N)=>{const L=String(z.id??N);return oe[L]?{...z,...oe[L]}:z}).filter(z=>Object.entries(T).every(([N,L])=>!L||String(z[N]??"").toLowerCase().includes(L.toLowerCase())));return k&&(w=[...w].sort((z,N)=>{const L=z[k],O=N[k];if(L==null)return 1;if(O==null)return-1;const H=L<O?-1:L>O?1:0;return C==="asc"?H:-H})),w},[l,k,C,T,oe]),G=x.useMemo(()=>{const w={};return r.forEach(z=>{var N;if((N=z.footer)!=null&&N.some(L=>L.summary)){const L=K.map(H=>Number(H[z.id])).filter(H=>!isNaN(H)),O=L.reduce((H,ee)=>H+ee,0);w[z.id]={sum:O,avg:L.length?O/L.length:0,count:K.length,min:L.length?Math.min(...L):0,max:L.length?Math.max(...L):0}}}),w},[K,r]),q=x.useMemo(()=>{const w={};return r.filter(z=>z.filterType==="select").forEach(z=>{w[z.id]=[...new Set(l.map(N=>String(N[z.id]??"")))].sort()}),w},[l,r]),ie=r.some(w=>w.filterable),de=r.some(w=>{var z;return(z=w.footer)==null?void 0:z.length}),be=X.reduce((w,z)=>w+z,0),se=(w,z)=>w.id??z,ce=w=>{!u||w.sortable===!1||(D(z=>k===w.id&&z==="asc"?"desc":"asc"),m(w.id))},A=(w,z)=>{if(!c)return;const N=se(w,z);$(z),I(L=>{const O=M?new Set(L):new Set;return O.has(N)?O.delete(N):O.add(N),O}),f==null||f(w)},R=()=>{if(!V)return;const{key:w,colId:z}=V;ae(L=>({...L,[String(w)]:{...L[String(w)]||{},[z]:Q}}));const N=K.find((L,O)=>se(L,O)===w);N&&(y==null||y(N,z,Q)),J(null)},dt=w=>{if(V&&w.key==="Escape"){J(null);return}if(!(!b||!c)){if(w.key==="ArrowDown"){w.preventDefault();const z=Math.min(i+1,K.length-1);z>=0&&A(K[z],z)}else if(w.key==="ArrowUp"){w.preventDefault();const z=Math.max(i-1,0);z>=0&&A(K[z],z)}}},ct=(w,z)=>{w.preventDefault(),w.stopPropagation();const N=w.clientX,L=S[z],O=ee=>B(Se=>{const te=[...Se];return te[z]=Math.max(r[z].minWidth||50,L+ee.clientX-N),te}),H=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",O),document.addEventListener("mouseup",H)},ve=(w,z,N,L)=>({width:w,minWidth:w,flexShrink:0,boxSizing:"border-box",padding:"0 12px",height:L,display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:13,textAlign:z.align,justifyContent:z.align==="center"?"center":z.align==="right"?"flex-end":"flex-start",borderLeft:N?"none":U});return e.jsx("div",{ref:E,className:"dhx",tabIndex:b?0:void 0,onKeyDown:dt,style:{width:"100%",height:d,display:"flex",flexDirection:"column",border:U,borderRadius:t.r,overflow:"hidden",outline:"none",...o},children:e.jsx("div",{style:{overflowX:"auto",flex:1,display:"flex",flexDirection:"column",minHeight:0},children:e.jsxs("div",{style:{minWidth:be,display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx("div",{style:{display:"flex",background:t.bg,borderBottom:U,flexShrink:0,position:"sticky",top:0,zIndex:2},children:r.map((w,z)=>{var N;return e.jsxs("div",{onClick:()=>ce(w),style:{...ve(X[z],w,z===0,40),position:"relative",fontWeight:500,color:t.text,cursor:u&&w.sortable!==!1?"pointer":"default",userSelect:"none"},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(w.header)?(N=w.header[0])==null?void 0:N.text:w.header||w.id}),u&&w.sortable!==!1&&e.jsx(Pe,{active:k===w.id,dir:C}),a&&w.resizable!==!1&&z<r.length-1&&e.jsx("div",{onMouseDown:L=>ct(L,z),onClick:L=>L.stopPropagation(),style:{position:"absolute",right:0,top:0,bottom:0,width:4,cursor:"col-resize",zIndex:1},onMouseEnter:L=>L.currentTarget.style.background=t.primary+"55",onMouseLeave:L=>L.currentTarget.style.background="transparent"})]},w.id)})}),ie&&e.jsx("div",{style:{display:"flex",borderBottom:U,background:t.surface,flexShrink:0},children:r.map((w,z)=>e.jsx("div",{style:{width:X[z],minWidth:X[z],flexShrink:0,padding:"4px 6px",boxSizing:"border-box",borderLeft:z===0?"none":U},children:w.filterable&&w.filterType==="select"?e.jsxs("select",{className:"dhx dhx-input",style:{height:26,fontSize:12,padding:"0 4px"},value:T[w.id]||"",onChange:N=>p(L=>({...L,[w.id]:N.target.value})),children:[e.jsx("option",{value:"",children:"All"}),(q[w.id]||[]).map(N=>e.jsx("option",{value:N,children:N},N))]}):w.filterable?e.jsx("input",{className:"dhx dhx-input",style:{height:26,fontSize:12},placeholder:"Filter...",value:T[w.id]||"",onChange:N=>p(L=>({...L,[w.id]:N.target.value}))}):null},w.id))}),e.jsxs("div",{className:"dhx-scroll",style:{flex:1,overflowY:"auto",minHeight:0},children:[K.map((w,z)=>{const N=se(w,z),L=v.has(N),O=L?t.primaryLt:n&&z%2!==0?t.bg:t.surface;return e.jsx("div",{style:{display:"flex",height:s,borderBottom:U,flexShrink:0,background:O,transition:"background .1s",cursor:c?"pointer":"default"},onMouseEnter:H=>!L&&(H.currentTarget.style.background=t.primaryLt+"80"),onMouseLeave:H=>!L&&(H.currentTarget.style.background=O),children:r.map((H,ee)=>{const Se=(V==null?void 0:V.key)===N&&(V==null?void 0:V.colId)===H.id,te=w[H.id],pt=H.template?H.template(te,w):String(te??"");return e.jsx("div",{onClick:()=>{A(w,z),h&&H.editable!==!1&&(J({key:N,colId:H.id}),le(String(te??"")))},style:ve(X[ee],H,ee===0,s),children:Se?e.jsx("input",{autoFocus:!0,value:Q,onChange:re=>le(re.target.value),onBlur:R,onKeyDown:re=>{re.key==="Enter"&&R(),re.key==="Escape"&&J(null)},onClick:re=>re.stopPropagation(),style:{width:"100%",border:"none",outline:`2px solid ${t.primary}`,borderRadius:2,fontSize:13,padding:"2px 4px",background:t.surface,color:t.text}}):pt},H.id)})},String(N))}),K.length===0&&e.jsx("div",{style:{textAlign:"center",padding:40,color:t.textMut,fontSize:13},children:"No data"})]}),de&&e.jsx("div",{style:{display:"flex",borderTop:U,background:t.bg,flexShrink:0},children:r.map((w,z)=>{var H;const N=(H=w.footer)==null?void 0:H[0],L=G[w.id]??{sum:0,avg:0,count:0,min:0,max:0};let O="";return N&&(typeof N.text=="function"?O=N.text(L):N.text?O=N.text:N.summary&&(O=String(Math.round(L[N.summary]*100)/100))),e.jsx("div",{style:{...ve(X[z],w,z===0,40),fontWeight:600,color:t.text},children:O},w.id)})})]})})})}const _=["#0288d1","#43a047","#f57c00","#e53935","#8e24aa","#00838f","#ef6c00","#2e7d32"];function Oe({type:r="bar",data:l=[],series:d=[],scales:s={},legend:u,height:a=280,style:h}){var k,m,C,D,T;x.useEffect(j,[]);const n=((k=s.bottom)==null?void 0:k.text)||l[0]&&Object.keys(l[0])[0]||"x",g=e.jsx(Y.Tooltip,{contentStyle:{fontSize:12,borderRadius:t.r,border:`1px solid ${t.border}`}}),b=u?e.jsx(Y.Legend,{iconSize:10,wrapperStyle:{fontSize:12},verticalAlign:u.valign,align:u.halign}):null,c=e.jsx(Y.CartesianGrid,{strokeDasharray:"3 3",stroke:t.border}),M=e.jsx(Y.XAxis,{dataKey:n,tick:{fontSize:11,fill:t.textSec},axisLine:{stroke:t.border},tickLine:!1}),f=e.jsx(Y.YAxis,{tick:{fontSize:11,fill:t.textSec},axisLine:!1,tickLine:!1,domain:[((m=s.left)==null?void 0:m.min)??"auto",((C=s.left)==null?void 0:C.max)??"auto"]}),y={data:l,margin:{top:10,right:20,left:0,bottom:0}};let o;if(r==="bar")o=e.jsxs(Y.BarChart,{...y,children:[c,M,f,g,b,d.map((p,v)=>e.jsx(Y.Bar,{dataKey:p.value||p.id,name:p.label||p.id,fill:p.fill||_[v%_.length],radius:[3,3,0,0]},p.id))]});else if(r==="line")o=e.jsxs(Y.LineChart,{...y,children:[c,M,f,g,b,d.map((p,v)=>e.jsx(Y.Line,{type:"monotone",dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[v%_.length],strokeWidth:2,dot:{r:3,fill:p.color||_[v%_.length]}},p.id))]});else if(r==="area")o=e.jsxs(Y.AreaChart,{...y,children:[c,M,f,g,b,d.map((p,v)=>e.jsx(Y.Area,{type:"monotone",dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[v%_.length],fill:(p.fill||_[v%_.length])+"33",strokeWidth:2},p.id))]});else if(r==="pie"||r==="donut"){const p=l[0]||{},v=Object.keys(p).find(i=>typeof p[i]=="number")||"value",I=Object.keys(p).find(i=>typeof p[i]=="string")||"x";o=e.jsxs(Y.PieChart,{children:[e.jsx(Y.Pie,{data:l,cx:"50%",cy:"50%",outerRadius:r==="donut"?"70%":"80%",innerRadius:r==="donut"?"40%":0,dataKey:v,nameKey:I,label:({name:i,percent:$})=>`${i??""} ${(($??0)*100).toFixed(0)}%`,labelLine:!0,paddingAngle:2,children:l.map((i,$)=>e.jsx(Y.Cell,{fill:_[$%_.length]},$))}),g,b]})}else r==="radar"?o=e.jsxs(Y.RadarChart,{...y,cx:"50%",cy:"50%",children:[e.jsx(Y.PolarGrid,{}),e.jsx(Y.PolarAngleAxis,{dataKey:n,tick:{fontSize:11}}),d.map((p,v)=>e.jsx(Y.Radar,{dataKey:p.value||p.id,name:p.label||p.id,stroke:p.color||_[v],fill:(p.fill||_[v])+"44"},p.id)),g,b]}):r==="scatter"&&(o=e.jsxs(Y.ScatterChart,{...y,children:[c,e.jsx(Y.XAxis,{dataKey:((D=d[0])==null?void 0:D.xValue)||"x",type:"number",tick:{fontSize:11,fill:t.textSec}}),e.jsx(Y.YAxis,{dataKey:((T=d[0])==null?void 0:T.yValue)||"y",tick:{fontSize:11,fill:t.textSec}}),g,d.map((p,v)=>e.jsx(Y.Scatter,{data:p.data||l,name:p.label||p.id,fill:p.color||_[v]},p.id))]}));return e.jsx("div",{className:"dhx",style:{width:"100%",height:a,padding:12,background:t.surface,borderRadius:t.rMd,...h},children:e.jsx(Y.ResponsiveContainer,{width:"100%",height:"100%",children:o})})}const Ye=["January","February","March","April","May","June","July","August","September","October","November","December"],Fe=["Su","Mo","Tu","We","Th","Fr","Sa"];function Ke({value:r,range:l=!1,timepicker:d=!1,onChange:s,style:u}){const a=new Date,h=r?new Date(Array.isArray(r)?r[0]:r):a,[n,g]=x.useState(h),[b,c]=x.useState(r??(l?[null,null]:null)),[M,f]=x.useState(null),[y,o]=x.useState({h:0,m:0});x.useEffect(j,[]);const k=n.getFullYear(),m=n.getMonth(),C=new Date(k,m,1).getDay(),D=new Date(k,m+1,0).getDate(),T=[];for(let i=0;i<C;i++)T.push(null);for(let i=1;i<=D;i++)T.push(new Date(k,m,i));const p=i=>i.toDateString()===a.toDateString(),v=i=>{if(!b)return!1;if(l&&Array.isArray(b)){const[$,S]=b;if(!$)return!1;const B=i.getTime();return S?B>=$.getTime()&&B<=S.getTime():i.toDateString()===$.toDateString()}return i.toDateString()===b.toDateString()},I=i=>{if(l){const[$,S]=Array.isArray(b)?b:[null,null];if(!$||S)c([i,null]);else{const B=i<$?[i,$]:[$,i];c(B),s==null||s(B)}}else c(i),s==null||s(i)};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...u},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{onClick:()=>g(i=>new Date(i.getFullYear(),i.getMonth()-1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"‹"}),e.jsxs("div",{style:{fontWeight:700,fontSize:14},children:[Ye[m]," ",k]}),e.jsx("button",{onClick:()=>g(i=>new Date(i.getFullYear(),i.getMonth()+1,1)),className:"dhx dhx-btn dhx-btn-ghost",style:{height:28,padding:"0 8px",fontSize:16},children:"›"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 32px)",gap:2},children:[Fe.map(i=>e.jsx("div",{style:{textAlign:"center",fontSize:11,fontWeight:600,color:t.textMut,paddingBottom:4},children:i},i)),T.map((i,$)=>{const S=i?v(i):!1,B=i&&M&&i.toDateString()===M.toDateString();return e.jsx("div",{onClick:()=>i&&I(i),onMouseEnter:()=>i&&f(i),onMouseLeave:()=>f(null),style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:t.r,cursor:i?"pointer":"default",fontSize:12,fontWeight:i&&p(i)?700:400,background:S?t.primary:B?t.bg:"transparent",color:S?"#fff":i&&p(i)?t.primary:i?t.text:"transparent",border:i&&p(i)&&!S?`1px solid ${t.primary}`:"1px solid transparent",transition:"all .1s"},children:i==null?void 0:i.getDate()},$)})]}),d&&e.jsxs("div",{style:{borderTop:`1px solid ${t.border}`,marginTop:12,paddingTop:12,display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("input",{type:"number",min:0,max:23,value:y.h,onChange:i=>o($=>({...$,h:+i.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}}),e.jsx("span",{style:{fontWeight:700,color:t.textSec},children:":"}),e.jsx("input",{type:"number",min:0,max:59,value:y.m,onChange:i=>o($=>({...$,m:+i.target.value})),className:"dhx dhx-input",style:{width:50,textAlign:"center"}})]})]})}function me({value:r,onChange:l,timeFormat:d=12,controls:s=!1,minuteStep:u=5,style:a}){const[h,n]=x.useState((r==null?void 0:r.h)??(d===24?0:12)),[g,b]=x.useState((r==null?void 0:r.m)??0),[c,M]=x.useState((r==null?void 0:r.ampm)??"AM"),[f,y]=x.useState(null);x.useEffect(j,[]);const o=d===24?Array.from({length:24},(p,v)=>v):Array.from({length:12},(p,v)=>v+1),k=Array.from({length:Math.ceil(60/u)},(p,v)=>v*u),m=(p,v,I)=>{const i=d===24?{h:p,m:v}:{h:p,m:v,ampm:I};s?y(i):l==null||l(i)},C=()=>{y(null),n((r==null?void 0:r.h)??(d===24?0:12)),b((r==null?void 0:r.m)??0),M((r==null?void 0:r.ampm)??"AM")},D={display:"flex",flexDirection:"column",alignItems:"center",gap:4},T=p=>({height:32,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:13,fontWeight:p?700:400,background:p?t.primaryLt:"transparent",color:p?t.primary:t.text});return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...a},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"stretch"},children:[e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Hours"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:o.map(p=>e.jsx("div",{onClick:()=>{n(p),m(p,g,c)},style:T(h===p),onMouseEnter:v=>h!==p&&(v.currentTarget.style.background=t.bg),onMouseLeave:v=>h!==p&&(v.currentTarget.style.background="transparent"),children:String(p).padStart(2,"0")},p))})]}),e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"Minutes"}),e.jsx("div",{className:"dhx-scroll",style:{height:160,overflowY:"auto",width:48,border:`1px solid ${t.border}`,borderRadius:t.r},children:k.map(p=>e.jsx("div",{onClick:()=>{b(p),m(h,p,c)},style:T(g===p),onMouseEnter:v=>g!==p&&(v.currentTarget.style.background=t.bg),onMouseLeave:v=>g!==p&&(v.currentTarget.style.background="transparent"),children:String(p).padStart(2,"0")},p))})]}),d===12&&e.jsxs("div",{style:D,children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:t.textMut},children:"AM/PM"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${t.border}`,borderRadius:t.r,overflow:"hidden"},children:["AM","PM"].map(p=>e.jsx("div",{onClick:()=>{M(p),m(h,g,p)},style:{height:40,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"0 12px",fontSize:13,fontWeight:c===p?700:400,background:c===p?t.primary:t.surface,color:c===p?"#fff":t.text},children:p},p))})]})]}),e.jsxs("div",{style:{textAlign:"center",marginTop:12,fontSize:22,fontWeight:700,color:t.primary,letterSpacing:2},children:[String(h).padStart(2,"0"),":",String(g).padStart(2,"0"),d===12?` ${c}`:""]}),s&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:12},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:C,children:"Cancel"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>f&&(l==null?void 0:l(f)),children:"Apply"})]})]})}function Z(r,l){x.useEffect(()=>{const d=s=>{r.current&&!r.current.contains(s.target)&&l(s)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[r,l])}function Me(r){const l=x.useRef(!1),d=x.useRef({x:0,y:0,ox:0,oy:0});return x.useCallback((s,u=0,a=0)=>{l.current=!0,d.current={x:s.clientX,y:s.clientY,ox:u,oy:a};const h=g=>{if(!l.current)return;const{x:b,y:c,ox:M,oy:f}=d.current;r(M+g.clientX-b,f+g.clientY-c)},n=()=>{l.current=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",h),document.addEventListener("mouseup",n),s.preventDefault()},[r])}const Ve=({open:r})=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",style:{flexShrink:0,transition:"transform .15s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:e.jsx("path",{d:"M2 4l4 4 4-4",stroke:t.textMut,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})});function pe({data:r=[],value:l,placeholder:d="Select or type...",multiselection:s=!1,label:u,onChange:a,style:h}){var I;const[n,g]=x.useState(!1),[b,c]=x.useState(""),[M,f]=x.useState(s?l?[].concat(l):[]:l||null),y=x.useRef(null),o=x.useRef(null);x.useEffect(j,[]),Z(y,x.useCallback(()=>{g(!1),c("")},[]));const k=x.useMemo(()=>r.filter(i=>!b||i.value.toLowerCase().includes(b.toLowerCase())),[r,b]),m=i=>s?(M||[]).includes(i):M===i,C=i=>{const $=i.id||i.value;if(s){const S=m($)?M.filter(B=>B!==$):[...M||[],$];f(S),a==null||a(S)}else f($),c(""),g(!1),a==null||a($)},D=i=>{const $=M.filter(S=>S!==i);f($),a==null||a($)},T=()=>{g(!0),setTimeout(()=>{var i;return(i=o.current)==null?void 0:i.focus()},0)},p=((I=r.find(i=>(i.id||i.value)===M))==null?void 0:I.value)||"",v=s?M||[]:[];return e.jsxs("div",{ref:y,className:"dhx",style:{position:"relative",...h},children:[u&&e.jsx("label",{className:"dhx dhx-label",children:u}),e.jsxs("div",{onClick:T,style:{display:"flex",alignItems:"center",flexWrap:s?"wrap":"nowrap",border:`1px solid ${n?t.primary:t.border}`,borderRadius:t.r,minHeight:34,padding:"4px 8px",cursor:"text",background:t.surface,gap:4,transition:"border-color .15s",boxShadow:n?`0 0 0 3px ${t.primary}22`:"none"},children:[s&&e.jsxs(e.Fragment,{children:[v.map(i=>{var $;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:t.primary,color:"#fff",borderRadius:12,padding:"2px 10px 2px 8px",fontSize:12,lineHeight:1.5,whiteSpace:"nowrap"},children:[(($=r.find(S=>(S.id||S.value)===i))==null?void 0:$.value)||i,e.jsx("span",{onClick:S=>{S.stopPropagation(),D(i)},style:{cursor:"pointer",fontSize:15,lineHeight:1,opacity:.75,marginLeft:2},children:"×"})]},i)}),e.jsx("input",{ref:o,value:b,onChange:i=>{c(i.target.value),g(!0)},onFocus:()=>g(!0),onClick:i=>i.stopPropagation(),placeholder:v.length?"":d,style:{flex:1,minWidth:60,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}})]}),!s&&e.jsx("input",{ref:o,value:n?b:p,onChange:i=>{c(i.target.value),g(!0)},onFocus:()=>{g(!0),c("")},onClick:i=>i.stopPropagation(),placeholder:d,style:{flex:1,border:"none",outline:"none",fontSize:13,background:"transparent",color:t.text,padding:0}}),e.jsx(Ve,{open:n})]}),n&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:100},children:e.jsxs("div",{className:"dhx-scroll",style:{maxHeight:220,overflowY:"auto"},children:[k.map(i=>{const $=i.id||i.value,S=m($);return e.jsxs("div",{onClick:()=>C(i),style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:8,fontSize:13,background:S?t.primaryLt:"transparent",color:S?t.primary:t.text},onMouseEnter:B=>!S&&(B.currentTarget.style.background=t.bg),onMouseLeave:B=>!S&&(B.currentTarget.style.background="transparent"),children:[s&&e.jsx("span",{style:{width:14,height:14,flexShrink:0,border:`2px solid ${S?t.primary:t.borderDk}`,borderRadius:3,display:"flex",alignItems:"center",justifyContent:"center",background:S?t.primary:"transparent"},children:S&&e.jsx("span",{style:{color:"#fff",fontSize:9,lineHeight:1},children:"✓"})}),e.jsx("span",{style:{flex:1},children:i.value}),!s&&S&&e.jsx("span",{style:{color:t.primary,fontSize:12,fontWeight:700},children:"✓"}),i.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",i.count,")"]})]},$)}),k.length===0&&e.jsx("div",{style:{padding:16,textAlign:"center",color:t.textMut,fontSize:13},children:"No matches"})]})})]})}function he({min:r=0,max:l=100,step:d=1,value:s,range:u=!1,label:a,tick:h,disabled:n=!1,onChange:g,style:b}){const[c,M]=x.useState(s??(u?[r,l]:r));x.useEffect(j,[]);const f=(C,D)=>{if(!n)if(u){const T=[...c];T[C]=D,M(T),g==null||g(T)}else M(D),g==null||g(D)},y=C=>(C-r)/(l-r)*100,o=u?c:[c],k=u?{left:`${y(o[0])}%`,width:`${y(o[1])-y(o[0])}%`}:{left:0,width:`${y(o[0])}%`},m=n?t.border:t.primary;return e.jsxs("div",{className:"dhx",style:{width:"100%",opacity:n?.5:1,...b},children:[a&&e.jsx("label",{className:"dhx dhx-label",children:a}),e.jsx("div",{style:{position:"relative",height:36,display:"flex",alignItems:"center"},children:e.jsxs("div",{style:{position:"relative",flex:1,height:4,background:t.border,borderRadius:2},children:[e.jsx("div",{style:{position:"absolute",...k,height:"100%",background:m,borderRadius:2}}),o.map((C,D)=>e.jsx("input",{type:"range",min:r,max:l,step:d,value:C,disabled:n,onChange:T=>{const p=+T.target.value;u&&D===0&&p>=c[1]||u&&D===1&&p<=c[0]||f(D,p)},style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:n?"not-allowed":"pointer",top:0,left:0,margin:0}},D)),o.map((C,D)=>e.jsx("div",{style:{position:"absolute",left:`${y(C)}%`,top:"50%",transform:"translate(-50%, -50%)",width:16,height:16,borderRadius:"50%",background:t.surface,border:`2px solid ${m}`,boxShadow:"0 1px 4px rgba(0,0,0,.2)",pointerEvents:"none"},children:e.jsx("div",{style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:n?t.textMut:t.primaryDk,color:"#fff",padding:"2px 6px",borderRadius:t.r,fontSize:11,fontWeight:700,whiteSpace:"nowrap"},children:C})},D))]})}),h&&e.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginTop:2},children:[r,Math.round((l+r)/2),l].map(C=>e.jsx("span",{style:{fontSize:10,color:t.textMut},children:C},C))})]})}const Xe=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#9e9e9e","#000000","#ffffff","#0288d1","#01579b","#43a047","#e53935","#f57c00"];function fe(r){const l=parseInt(r.slice(1,3),16)/255,d=parseInt(r.slice(3,5),16)/255,s=parseInt(r.slice(5,7),16)/255,u=Math.max(l,d,s),a=Math.min(l,d,s);let h=0,n=0;const g=(u+a)/2;if(u!==a){const b=u-a;n=g>.5?b/(2-u-a):b/(u+a),h=u===l?((d-s)/b+(d<s?6:0))/6:u===d?((s-l)/b+2)/6:((l-d)/b+4)/6}return[Math.round(h*360),Math.round(n*100),Math.round(g*100)]}function ze(r,l,d){l/=100,d/=100;const s=l*Math.min(d,1-d),u=a=>{const h=(a+r/30)%12,n=d-s*Math.max(Math.min(h-3,9-h,1),-1);return Math.round(255*n).toString(16).padStart(2,"0")};return"#"+u(0)+u(8)+u(4)}function _e({value:r="#0288d1",onChange:l,style:d}){const[s,u]=x.useState(()=>fe(r)),a=ze(...s);x.useEffect(j,[]);const h=n=>{u(n),l==null||l(ze(...n))};return e.jsxs("div",{className:"dhx",style:{background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,padding:16,display:"inline-block",boxShadow:t.shadow,...d},children:[e.jsx("div",{style:{width:200,height:120,borderRadius:t.r,marginBottom:12,background:`linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${s[0]},100%,50%))`,cursor:"crosshair"}}),[["Hue",0,360,s[0]],["Saturation",0,100,s[1]],["Lightness",0,100,s[2]]].map(([n,g,b,c],M)=>e.jsxs("div",{style:{marginBottom:M<2?8:12},children:[e.jsxs("div",{className:"dhx dhx-label",children:[n,M>0?` (${c}%)`:""]}),e.jsx("input",{type:"range",min:g,max:b,value:c,onChange:f=>{const y=[...s];y[M]=+f.target.value,h(y)},style:{width:"100%",accentColor:t.primary}})]},n)),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:t.r,background:a,border:`1px solid ${t.border}`,flexShrink:0}}),e.jsx("input",{className:"dhx dhx-input",style:{flex:1,fontFamily:"monospace",fontSize:12},value:a,onChange:n=>{try{h(fe(n.target.value)),l==null||l(n.target.value)}catch{}}})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(13, 1fr)",gap:3},children:Xe.map(n=>e.jsx("div",{onClick:()=>{u(fe(n)),l==null||l(n)},style:{width:14,height:14,borderRadius:2,background:n,cursor:"pointer",border:a===n?`2px solid ${t.text}`:"1px solid rgba(0,0,0,.15)",transition:"transform .1s"},onMouseEnter:g=>g.currentTarget.style.transform="scale(1.3)",onMouseLeave:g=>g.currentTarget.style.transform="scale(1)"},n))})]})}function ne({items:r,onSelect:l,style:d}){const[s,u]=x.useState(null);return e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:180,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.r,boxShadow:t.shadowLg,zIndex:200,padding:"4px 0",...d},children:r.map((a,h)=>{var g,b;if(a.type==="separator")return e.jsx("div",{style:{height:1,background:t.border,margin:"4px 0"}},h);const n=s===h;return e.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>u(h),onMouseLeave:()=>u(null),children:[e.jsxs("div",{onClick:()=>{var c;return!a.disabled&&!((c=a.items)!=null&&c.length)&&l(a)},style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",cursor:a.disabled?"not-allowed":"pointer",fontSize:13,color:a.disabled?t.textMut:t.text,background:n&&!a.disabled?t.bg:"transparent",opacity:a.disabled?.5:1},children:[a.icon&&e.jsx("span",{style:{fontSize:15,width:18,textAlign:"center"},children:a.icon}),e.jsx("span",{style:{flex:1},children:a.value||a.id}),a.hotkey&&e.jsx("span",{style:{fontSize:11,color:t.textMut},children:a.hotkey}),(g=a.items)!=null&&g.length?e.jsx("span",{style:{fontSize:10,color:t.textMut},children:"▶"}):null]}),n&&((b=a.items)!=null&&b.length)?e.jsx(ne,{items:a.items,onSelect:l,style:{position:"absolute",left:"100%",top:-4}}):null]},a.id||h)})})}function qe({items:r=[],label:l="Menu",onSelect:d,style:s}){const[u,a]=x.useState(!1),h=x.useRef(null);return x.useEffect(j,[]),Z(h,x.useCallback(()=>a(!1),[])),e.jsxs("div",{ref:h,className:"dhx",style:{position:"relative",display:"inline-block",...s},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>a(n=>!n),children:[l," ",e.jsx("span",{style:{fontSize:10},children:u?"▲":"▼"})]}),u&&e.jsx(ne,{items:r,onSelect:n=>{d==null||d(n),a(!1)}})]})}function Ge({items:r=[],onSelect:l,children:d}){const[s,u]=x.useState(null),a=x.useRef(null);x.useEffect(j,[]),Z(a,x.useCallback(()=>u(null),[]));const h=n=>{n.preventDefault(),u({x:n.clientX,y:n.clientY})};return e.jsxs("div",{ref:a,onContextMenu:h,style:{position:"relative",display:"contents"},children:[d,s&&e.jsx("div",{style:{position:"fixed",left:s.x,top:s.y,zIndex:9999},children:e.jsx(ne,{items:r,onSelect:n=>{l==null||l(n),u(null)}})})]})}function Je({trigger:r,children:l,placement:d="bottom-start",style:s}){const[u,a]=x.useState(!1),[h,n]=x.useState({top:"100%",left:0}),g=x.useRef(null),b=x.useRef(null);x.useEffect(j,[]),Z(g,x.useCallback(()=>a(!1),[]));const c=()=>{a(M=>{if(!M&&b.current){const f=b.current.getBoundingClientRect(),y={"bottom-start":{top:f.height+4,left:0},"bottom-end":{top:f.height+4,right:0,left:"auto"},"top-start":{bottom:f.height+4,top:"auto",left:0}};n(y[d]||y["bottom-start"])}return!M})};return e.jsxs("div",{ref:g,className:"dhx",style:{position:"relative",display:"inline-block"},children:[e.jsx("div",{ref:b,onClick:c,children:r}),u&&e.jsx("div",{className:"dhx dhx-anim-fade",style:{position:"absolute",...h,zIndex:200,background:t.surface,border:`1px solid ${t.border}`,borderRadius:t.rMd,boxShadow:t.shadowLg,...s},children:l})]})}function Ue({title:r,children:l,width:d=480,height:s,closable:u=!0,movable:a=!0,modal:h=!1,defaultOpen:n=!0,footer:g,onClose:b,style:c}){const[M,f]=x.useState(n),[y,o]=x.useState({x:0,y:0});x.useEffect(j,[]);const k=Me(x.useCallback((C,D)=>a&&o({x:C,y:D}),[a])),m=()=>{f(!1),b==null||b()};return M?e.jsxs(e.Fragment,{children:[h&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:900},onClick:u?m:void 0}),e.jsxs("div",{className:"dhx",style:{position:h?"fixed":"absolute",left:h?"50%":`calc(50% + ${y.x}px)`,top:h?"50%":`calc(50% + ${y.y}px)`,transform:`translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`,width:d,...s?{height:s}:{},background:t.surface,borderRadius:t.rMd,boxShadow:t.shadowLg,zIndex:901,display:"flex",flexDirection:"column",overflow:"hidden",...c},children:[e.jsxs("div",{onMouseDown:C=>k(C,y.x,y.y),style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${t.border}`,cursor:a?"grab":"default",background:t.bg,gap:8,userSelect:"none"},children:[e.jsx("span",{style:{flex:1,fontWeight:700,fontSize:15},children:r}),u&&e.jsx("button",{onClick:m,style:{background:"none",border:"none",cursor:"pointer",width:28,height:28,borderRadius:t.r,display:"flex",alignItems:"center",justifyContent:"center",fontSize:18,color:t.textSec},onMouseEnter:C=>C.currentTarget.style.background=t.border,onMouseLeave:C=>C.currentTarget.style.background="none",children:"×"})]}),e.jsx("div",{className:"dhx-scroll",style:{flex:1,minHeight:0,padding:20,overflowY:"auto"},children:l}),g&&e.jsx("div",{style:{padding:"12px 16px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"flex-end",gap:8,background:t.bg},children:g})]})]}):null}const ue=x.createContext(null),Qe={success:"✓",error:"✕",warning:"⚠",info:"ℹ"},$e={success:t.success,error:t.danger,warning:t.warning,info:t.primary};function Ze({children:r}){const[l,d]=x.useState([]);x.useEffect(j,[]);const s=x.useCallback(h=>d(n=>n.filter(g=>g.id!==h)),[]),u=x.useCallback(h=>{const n=Date.now();return d(g=>[...g,{id:n,...h}]),h.duration!==0&&setTimeout(()=>s(n),h.duration||4e3),n},[s]),a={message:u,alert:(h,n)=>u({type:"info",title:h,...n}),confirm:(h,n,g)=>u({type:"warning",title:h,confirm:n,...g})};return e.jsxs(ue.Provider,{value:a,children:[r,e.jsx("div",{style:{position:"fixed",top:20,right:20,zIndex:9999,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none"},children:l.map(h=>{const n=h.type||"info";return e.jsxs("div",{style:{background:t.surface,border:`1px solid ${t.border}`,borderLeft:`4px solid ${$e[n]}`,borderRadius:t.r,boxShadow:t.shadowLg,padding:"12px 16px",minWidth:280,maxWidth:380,pointerEvents:"all",display:"flex",gap:10,alignItems:"flex-start",animation:"dhx-toast .3s ease"},children:[e.jsx("span",{style:{fontSize:18,color:$e[n],lineHeight:1},children:Qe[n]}),e.jsxs("div",{style:{flex:1},children:[h.title&&e.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:h.text?3:0},children:h.title}),h.text&&e.jsx("div",{style:{fontSize:12,color:t.textSec,lineHeight:1.5},children:h.text}),h.confirm&&e.jsxs("div",{style:{display:"flex",gap:6,marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",style:{height:26,fontSize:12},onClick:()=>{h.confirm(!0),s(h.id)},children:"Confirm"}),e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",style:{height:26,fontSize:12},onClick:()=>{h.confirm(!1),s(h.id)},children:"Cancel"})]})]}),e.jsx("button",{onClick:()=>s(h.id),style:{background:"none",border:"none",cursor:"pointer",color:t.textMut,fontSize:14,lineHeight:1,padding:0},children:"×"})]},h.id)})})]})}function Re(){const r=x.useContext(ue);if(!r)throw new Error("useMessage must be used inside <MessageProvider>");return r}function et({data:r=[],template:l,keyNavigation:d=!0,multiselection:s=!1,editable:u=!1,height:a=400,onSelect:h,onEdit:n,style:g}){const[b,c]=x.useState(new Set),[M,f]=x.useState(null),[y,o]=x.useState(""),[k,m]=x.useState(null);x.useEffect(j,[]);const C=(T,p)=>{const v=T.id??p;c(I=>{const i=s?new Set(I):new Set;return i.has(v)?i.delete(v):i.add(v),i}),m(p),h==null||h(T)},D=(T,p)=>{n==null||n({...T,value:y},p),f(null)};return e.jsxs("div",{className:"dhx dhx-scroll",style:{height:a,overflowY:"auto",border:`1px solid ${t.border}`,borderRadius:t.r,background:t.surface,...g},tabIndex:0,onKeyDown:T=>{d&&(T.key==="ArrowDown"&&m(p=>Math.min((p??-1)+1,r.length-1)),T.key==="ArrowUp"&&m(p=>Math.max((p??1)-1,0)))},children:[r.map((T,p)=>{const v=T.id??p,I=b.has(v),i=k===p;return e.jsx("div",{onClick:()=>C(T,p),onDoubleClick:()=>u&&(f(p),o(String(T.value||""))),style:{display:"flex",alignItems:"center",padding:"0 12px",height:40,cursor:"pointer",fontSize:13,borderBottom:`1px solid ${t.border}`,background:I?t.primaryLt:i?t.bg:t.surface,color:I?t.primary:t.text,outline:i?`2px solid ${t.primary}44`:"none",transition:"background .1s"},children:M===p?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:28,flex:1},value:y,onChange:$=>o($.target.value),onBlur:()=>D(T,p),onKeyDown:$=>{$.key==="Enter"&&D(T,p),$.key==="Escape"&&f(null)},onClick:$=>$.stopPropagation()}):l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(T)},style:{flex:1}}):e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:String(T.value??"")})},String(v))}),r.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:t.textMut},children:"No items"})]})}function tt({data:r=[],template:l,itemsInRow:d=3,gap:s=12,multiselection:u=!1,onSelect:a,style:h}){const[n,g]=x.useState(new Set);x.useEffect(j,[]);const b=c=>{const M=c.id??String(c.title);g(f=>{const y=u?new Set(f):new Set;return y.has(M)?y.delete(M):y.add(M),y}),a==null||a(c)};return e.jsx("div",{className:"dhx",style:{display:"grid",gridTemplateColumns:`repeat(${d}, 1fr)`,gap:s,padding:s,...h},children:r.map((c,M)=>{const f=c.id??M,y=n.has(f);return e.jsx("div",{onClick:()=>b(c),style:{background:t.surface,border:`2px solid ${y?t.primary:t.border}`,borderRadius:t.rMd,overflow:"hidden",cursor:"pointer",transition:"all .15s",boxShadow:y?`0 0 0 3px ${t.primary}33`:t.shadow,transform:y?"translateY(-2px)":"none"},onMouseEnter:o=>{o.currentTarget.style.boxShadow=t.shadowLg,o.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:o=>{o.currentTarget.style.boxShadow=y?`0 0 0 3px ${t.primary}33`:t.shadow,o.currentTarget.style.transform=y?"translateY(-2px)":"none"},children:l?e.jsx("div",{dangerouslySetInnerHTML:{__html:l(c)}}):e.jsxs("div",{style:{padding:16},children:[c.img&&e.jsx("img",{src:c.img,alt:c.title||"",style:{width:"100%",borderRadius:t.r,marginBottom:8,display:"block"}}),e.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:c.title||c.value}),c.subtitle&&e.jsx("div",{style:{fontSize:12,color:t.textSec},children:c.subtitle})]})},String(f))})})}function xe(r){return r.map(l=>({...l,items:l.items?xe(l.items):void 0}))}function ge(r,l={}){return r.forEach(d=>{d.opened&&(l[d.id]=!0),d.items&&ge(d.items,l)}),l}function Ce(r,l){let d=null;return[r.filter(u=>u.id===l?(d=u,!1):!0).map(u=>{if(u.items){const[a,h]=Ce(u.items,l);return h&&(d=h),{...u,items:a}}return u}),d]}function ye(r,l,d,s){if(s==="inside")return r.map(a=>a.id===l?{...a,items:[...a.items||[],d]}:a.items?{...a,items:ye(a.items,l,d,s)}:a);if(r.some(a=>a.id===l)){const a=[];for(const h of r)h.id===l?s==="before"?(a.push(d),a.push(h)):(a.push(h),a.push(d)):a.push(h);return a}return r.map(a=>a.items?{...a,items:ye(a.items,l,d,s)}:a)}function rt(r,l,d){function s(u){var a,h;if(u.id===l){const n=g=>{var b;return g.id===d||(((b=g.items)==null?void 0:b.some(n))??!1)};return((a=u.items)==null?void 0:a.some(n))??!1}return((h=u.items)==null?void 0:h.some(s))??!1}return r.some(s)}function De(r,l,d){return r.map(s=>s.id===l?{...s,value:d}:{...s,items:s.items?De(s.items,l,d):void 0})}function nt(r,l){var a;let d=0,s=0;const u=h=>{var n;d++,l[h.id]&&s++,(n=h.items)==null||n.forEach(u)};return(a=r.items)==null||a.forEach(u),{total:d,checkedCount:s}}function ot({data:r=[],checkbox:l=!1,editable:d=!1,dragMode:s,tooltip:u,onSelect:a,onCheck:h,onChange:n,style:g}){const[b,c]=x.useState(()=>xe(r)),[M,f]=x.useState(()=>ge(r)),[y,o]=x.useState(null),[k,m]=x.useState({}),[C,D]=x.useState(null),[T,p]=x.useState(""),[v,I]=x.useState(null),[i,$]=x.useState(null);x.useEffect(j,[]),x.useEffect(()=>{c(xe(r)),f(E=>({...ge(r),...E}))},[r]);const S=E=>f(P=>({...P,[E]:!P[E]})),B=(E,P)=>{m(F=>({...F,[E]:P})),h==null||h(E,P)},V=()=>{if(!C)return;const E=C,P=T;D(null),c(F=>{const X=De(F,E,P);return n==null||n(X),X})},J=(E,P)=>{E.dataTransfer.effectAllowed="move",I(P)},Q=(E,P)=>{if(!v||v===P||rt(b,v,P))return;E.preventDefault();const F=E.currentTarget.getBoundingClientRect(),X=E.clientY-F.top,K=F.height,G=X<K*.25?"before":X>K*.75?"after":"inside";$(q=>(q==null?void 0:q.id)===P&&(q==null?void 0:q.pos)===G?q:{id:P,pos:G})},le=(E,P)=>{if(E.preventDefault(),!v||!i||v===P){$(null),I(null);return}c(F=>{const[X,K]=Ce(F,v);if(!K)return F;const G=ye(X,P,K,i.pos);return n==null||n(G),G}),i.pos==="inside"&&f(F=>({...F,[P]:!0})),$(null),I(null)},oe=()=>{I(null),$(null)},ae=(E,P=0)=>{var ce;const F=(((ce=E.items)==null?void 0:ce.length)??0)>0,X=M[E.id],K=y===E.id,G=v===E.id,q=(i==null?void 0:i.id)===E.id;let ie=!!k[E.id],de=!1;if(l&&F){const{total:A,checkedCount:R}=nt(E,k);R>0&&R<A?de=!0:A>0&&R===A&&(ie=!0)}const be=q&&i.pos!=="inside"?{boxShadow:i.pos==="before"?`inset 0 2px 0 0 ${t.primary}`:`inset 0 -2px 0 0 ${t.primary}`}:{},se=q&&i.pos==="inside"||K?t.primaryLt:"transparent";return e.jsxs("div",{style:{opacity:G?.4:1},children:[e.jsxs("div",{draggable:!!s,onDragStart:s?A=>J(A,E.id):void 0,onDragOver:s?A=>Q(A,E.id):void 0,onDrop:s?A=>le(A,E.id):void 0,onDragEnd:s?oe:void 0,title:u==null?void 0:u(E),onClick:()=>{o(E.id),a==null||a(E),F&&S(E.id)},onDoubleClick:()=>{d&&(D(E.id),p(E.value||""))},style:{display:"flex",alignItems:"center",gap:4,padding:`5px 8px 5px ${12+P*18}px`,cursor:s?"grab":"pointer",borderRadius:t.r,margin:"1px 4px",background:se,color:K?t.primary:t.text,userSelect:"none",fontSize:13,...be},onMouseEnter:A=>!K&&!q&&(A.currentTarget.style.background=t.bg),onMouseLeave:A=>!K&&!q&&(A.currentTarget.style.background="transparent"),children:[e.jsx("span",{style:{width:16,textAlign:"center",fontSize:11,color:t.textMut,flexShrink:0},onClick:A=>{A.stopPropagation(),F&&S(E.id)},children:F?X?"▾":"▸":""}),e.jsx("span",{style:{fontSize:15,flexShrink:0},children:F?X?"📂":"📁":"📄"}),l&&e.jsx("input",{ref:A=>{A&&(A.indeterminate=de)},type:"checkbox",checked:ie,onChange:A=>{A.stopPropagation(),B(E.id,A.target.checked)},style:{cursor:"pointer",accentColor:t.primary,flexShrink:0},onClick:A=>A.stopPropagation()}),C===E.id?e.jsx("input",{autoFocus:!0,className:"dhx dhx-input",style:{height:24,fontSize:12,flex:1},value:T,onChange:A=>p(A.target.value),onBlur:V,onKeyDown:A=>{A.key==="Enter"&&V(),A.key==="Escape"&&D(null)},onClick:A=>A.stopPropagation()}):e.jsx("span",{style:{flex:1},children:E.value}),E.count!==void 0&&e.jsxs("span",{style:{fontSize:11,color:t.textMut},children:["(",E.count,")"]})]}),F&&X&&e.jsx("div",{children:E.items.map(A=>ae(A,P+1))})]},E.id)};return e.jsx("div",{className:"dhx dhx-scroll",style:{overflowY:"auto",...g},onDragOver:s?E=>E.preventDefault():void 0,onDrop:s?E=>{E.preventDefault(),$(null),I(null)}:void 0,children:b.map(E=>ae(E))})}function st({total:r,pageSize:l=10,page:d,onChange:s,style:u}){const[a,h]=x.useState(d||1),n=Math.ceil(r/l);x.useEffect(j,[]);const g=c=>{const M=Math.min(Math.max(1,c),n);h(M),s==null||s(M)},b=x.useMemo(()=>{const c=[];for(let f=Math.max(1,a-2);f<=Math.min(n,a+2);f++)c.push(f);return c[0]>1&&(c[0]>2&&c.unshift("..."),c.unshift(1)),c[c.length-1]<n&&(c[c.length-1]<n-1&&c.push("..."),c.push(n)),c},[a,n]);return e.jsxs("div",{className:"dhx",style:{display:"flex",alignItems:"center",gap:4,padding:"8px 12px",...u},children:[e.jsxs("span",{style:{fontSize:12,color:t.textSec,marginRight:8},children:[(a-1)*l+1,"–",Math.min(a*l,r)," of ",r]}),[["«",1],["‹",a-1]].map(([c,M])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===1,onClick:()=>g(M),children:c},c)),b.map((c,M)=>e.jsx("button",{onClick:()=>typeof c=="number"&&g(c),className:`dhx dhx-btn ${c===a?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{height:30,minWidth:30,padding:"0 8px",fontSize:13},disabled:c==="...",children:c},M)),[["›",a+1],["»",n]].map(([c,M])=>e.jsx("button",{className:"dhx dhx-btn dhx-btn-ghost",style:{height:30,padding:"0 8px",fontSize:14},disabled:a===n,onClick:()=>g(M),children:c},c))]})}function lt({config:r={},defaultValues:l={},onSubmit:d,style:s}){const[u,a]=x.useState(l),[h,n]=x.useState({}),[g,b]=x.useState(null);x.useEffect(j,[]);const c=(o,k)=>{a(m=>({...m,[o]:k})),n(m=>({...m,[o]:null}))},M=()=>{const o={};return(r.rows||[]).flat().forEach(k=>{k&&typeof k=="object"&&"name"in k&&k.required&&!u[k.name]&&(o[k.name]=`${k.label||k.name} is required`)}),n(o),Object.keys(o).length===0},f=o=>{const k=u[o.name]??o.value??"",m=h[o.name],C=o.labelWidth??r.labelWidth,D=C!==void 0||o.labelPosition==="left";if(o.type==="fieldset")return e.jsxs("fieldset",{style:{border:`1px solid ${t.border}`,borderRadius:t.r,padding:"12px 16px",marginBottom:14},children:[e.jsx("legend",{style:{fontSize:12,fontWeight:700,color:t.textSec,padding:"0 6px"},children:o.label}),(o.rows||[]).map(S=>f(S))]},o.name);if(o.type==="spacer")return e.jsx("div",{style:{height:o.height||16}},o.name);const T=C?{minWidth:C,width:C,flexShrink:0,paddingTop:8,boxSizing:"border-box"}:{},p=o.label?e.jsxs("label",{className:"dhx dhx-label",style:{display:"flex",gap:4,...T},children:[o.label,o.required&&e.jsx("span",{style:{color:t.danger},children:"*"})]},"lbl"):null,v=m?e.jsx("div",{style:{fontSize:11,color:t.danger,marginTop:3},children:m}):null,I=o.helpMessage?e.jsxs("div",{style:{fontSize:11,color:t.textMut,marginTop:3},children:["ⓘ ",o.helpMessage]}):null,i={key:o.name,className:"dhx-form-group"},$=S=>D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1,minWidth:0},children:[S,v,I]})]}):e.jsxs("div",{...i,children:[p,S,v,I]});if(!o.type||o.type==="input")return $(e.jsxs("div",{className:"dhx-input-wrap",children:[o.icon&&e.jsx("span",{className:"dhx-input-icon",children:o.icon}),e.jsx("input",{className:`dhx dhx-input${o.icon?" dhx-input--with-icon":""}`,style:{borderColor:m?t.danger:void 0},type:o.inputType||"text",placeholder:o.placeholder,value:k,onChange:S=>c(o.name,S.target.value),disabled:o.disabled})]}));if(o.type==="textarea")return $(e.jsx("textarea",{className:"dhx dhx-input",style:{height:80,resize:"vertical",padding:"8px 10px"},placeholder:o.placeholder,value:k,onChange:S=>c(o.name,S.target.value)}));if(o.type==="select")return $(e.jsxs("select",{className:"dhx dhx-input",value:k,onChange:S=>c(o.name,S.target.value),style:{cursor:"pointer"},children:[e.jsx("option",{value:"",children:"— Select —"}),(o.options||[]).map(S=>e.jsx("option",{value:S.value,children:S.label||S.value},S.value))]}));if(o.type==="datepicker")return $(e.jsx("input",{type:"date",className:"dhx dhx-input",value:k,onChange:S=>c(o.name,S.target.value)}));if(o.type==="timepicker"){const S=u[o.name]??{h:12,m:0,ampm:"AM"},B=!!u[o.name],V=B?`${String(S.h).padStart(2,"0")}:${String(S.m).padStart(2,"0")}${S.ampm?" "+S.ampm:""}`:o.placeholder||"Click to select",J=e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{className:"dhx dhx-input",style:{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between"},onClick:()=>b(g===o.name?null:o.name),children:[e.jsx("span",{style:{color:B?t.text:t.textMut},children:V}),e.jsx("span",{style:{fontSize:13,color:t.textSec},children:"🕐"})]}),g===o.name&&e.jsx("div",{style:{position:"absolute",zIndex:100,top:"calc(100% + 4px)",left:0},children:e.jsx(me,{value:S,controls:!0,onChange:Q=>{c(o.name,Q),b(null)}})})]});return $(J)}if(o.type==="colorpicker")return $(e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"color",value:k||"#000000",onChange:S=>c(o.name,S.target.value),style:{width:36,height:36,padding:2,border:`1px solid ${t.border}`,borderRadius:t.r,cursor:"pointer",background:"none"}}),e.jsx("span",{style:{fontSize:12,color:t.textSec,fontFamily:"monospace"},children:k||"#000000"})]}));if(o.type==="text")return $(e.jsx("p",{style:{margin:"6px 0",fontSize:13,color:t.text},children:o.value}));if(o.type==="checkbox")return e.jsxs("div",{...i,children:[D?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[C&&e.jsx("div",{style:{width:C,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!k,onChange:S=>c(o.name,S.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]})]}):e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!!k,onChange:S=>c(o.name,S.target.checked),style:{width:16,height:16,accentColor:t.primary,cursor:"pointer"}}),e.jsx("span",{style:{fontSize:13},children:o.label})]}),I]});if(o.type==="radio"){const S=(o.options||[]).map(B=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer",fontSize:13},children:[e.jsx("input",{type:"radio",name:o.name,value:B.value,checked:k===B.value,onChange:()=>c(o.name,B.value),style:{accentColor:t.primary,cursor:"pointer"}}),B.label||B.value]},B.value));return $(e.jsx("div",{style:{display:"flex",gap:16,flexWrap:"wrap",paddingTop:8},children:S}))}if(o.type==="slider")return D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1},children:[e.jsx(he,{min:o.min,max:o.max,step:o.step,value:k||o.min,range:o.range,onChange:S=>c(o.name,S)}),I]})]}):e.jsxs("div",{...i,children:[e.jsx(he,{label:o.label,min:o.min,max:o.max,step:o.step,value:k||o.min,range:o.range,onChange:S=>c(o.name,S)}),I]});if(o.type==="combo")return D?e.jsxs("div",{...i,style:{display:"flex",alignItems:"flex-start",gap:8},children:[p,e.jsxs("div",{style:{flex:1},children:[e.jsx(pe,{data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:k||(o.multiselection?[]:null),onChange:S=>c(o.name,S)}),v,I]})]}):e.jsxs("div",{...i,children:[e.jsx(pe,{label:o.label,data:o.data||[],multiselection:o.multiselection,placeholder:o.placeholder||"Select...",value:k||(o.multiselection?[]:null),onChange:S=>c(o.name,S)}),v,I]});if(o.type==="toggle"){const S=!!k,B=S?o.icon:o.offIcon||o.icon,V=S?o.text||o.label:o.offText||o.text||o.label;return e.jsxs("div",{...i,children:[D&&C&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:C,flexShrink:0}}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx(Ee,{on:S,onClick:()=>c(o.name,!k)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]})]}),!D&&e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer"},children:[e.jsx(Ee,{on:S,onClick:()=>c(o.name,!k)}),B&&e.jsx("span",{style:{fontSize:16},children:B}),V&&e.jsx("span",{style:{fontSize:13},children:V})]}),I]})}return null},y=o=>o.map((k,m)=>Array.isArray(k)?e.jsx("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:k.map(f)},m):f(k));return e.jsxs("div",{className:"dhx",style:{padding:r.padding||0,width:r.width||"100%",...s},children:[y(r.rows||[]),(r.buttons||d)&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:r.buttonAlign||"flex-start",marginTop:8},children:[e.jsx("button",{className:"dhx dhx-btn dhx-btn-primary",onClick:()=>M()&&(d==null?void 0:d(u)),children:r.submitText||"Submit"}),r.resetButton!==!1&&e.jsx("button",{className:"dhx dhx-btn dhx-btn-secondary",onClick:()=>{a(l),n({})},children:r.resetText||"Reset"})]})]})}function Ee({on:r,onClick:l}){return e.jsxs("div",{style:{position:"relative",width:40,height:22,flexShrink:0},onClick:l,children:[e.jsx("div",{style:{width:40,height:22,borderRadius:11,background:r?t.primary:t.border,transition:"background 0.2s"}}),e.jsx("div",{style:{position:"absolute",top:3,left:r?21:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s",boxShadow:"0 1px 3px rgba(0,0,0,.3)"}})]})}function Te(r){const l=[];for(const d of r)"type"in d&&d.type==="block"?l.push(...d.items||[]):l.push(d);return l}function at({items:r=[],onAction:l,style:d}){x.useEffect(j,[]);const[s,u]=x.useState(()=>{const n={};for(const g of Te(r))g.id&&(n[g.id]=!!g.active);return n}),a=n=>{var g;if(n.id)if(n.group){const b=Te(r).filter(c=>c.group===n.group&&c.id);u(c=>{const M={...c};for(const f of b)M[f.id]=!1;return M[n.id]=!0,M})}else n.twoState&&u(b=>({...b,[n.id]:!b[n.id]}));(g=n.onClick)==null||g.call(n,n),n.id&&(l==null||l(n.id,n))},h=(n,g)=>{var M,f;if("type"in n&&(n.type==="separator"||n.type==="sep"))return e.jsx("div",{style:{width:1,background:t.border,margin:"8px 4px",alignSelf:"stretch"}},g);if("type"in n&&n.type==="input"){const y=n;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"4px 6px",gap:4},children:[y.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut},children:y.label}),e.jsx("input",{className:"dhx dhx-input",style:{width:y.width||110,height:26,fontSize:12},placeholder:y.placeholder,defaultValue:y.value,onChange:o=>{var k;return(k=y.onChange)==null?void 0:k.call(y,o.target.value)}})]},g)}if("type"in n&&n.type==="block"){const y=n;return e.jsxs("div",{style:{display:"flex",flexDirection:y.direction==="col"?"column":"row",alignItems:"center",gap:4,padding:"4px 8px",borderRight:`1px solid ${t.border}`,minHeight:64},children:[e.jsx("div",{style:{display:"flex",gap:2},children:(M=y.items)==null?void 0:M.map((o,k)=>h(o,k))}),y.label&&e.jsx("span",{style:{fontSize:10,color:t.textMut,marginTop:2},children:y.label})]},g)}if("type"in n&&n.type==="selectButton"){const y=n;return e.jsx("select",{className:"dhx dhx-input",style:{height:28,fontSize:12,cursor:"pointer",margin:2},defaultValue:y.value,onChange:o=>{var k;return(k=y.onChange)==null?void 0:k.call(y,o.target.value)},children:(f=y.items)==null?void 0:f.map(o=>e.jsx("option",{value:o.value,children:o.value},o.value))},g)}const b=n,c=b.id!==void 0?s[b.id]??!!b.active:!!b.active;return e.jsxs("button",{title:b.tooltip,className:`dhx dhx-btn ${c?"dhx-btn-primary":"dhx-btn-ghost"}`,style:{flexDirection:"column",minHeight:48,padding:"4px 8px",gap:4,fontSize:12},disabled:b.disabled,onClick:()=>a(b),children:[b.icon&&e.jsx("span",{style:{fontSize:b.size==="large"?24:18},children:b.icon}),b.text&&e.jsx("span",{style:{fontSize:10,maxWidth:60,textAlign:"center",lineHeight:1.2,whiteSpace:"normal"},children:b.text})]},g)};return e.jsx("div",{className:"dhx",style:{display:"flex",alignItems:"stretch",background:t.bg,borderBottom:`1px solid ${t.border}`,padding:"4px 0",overflowX:"auto",gap:0,...d},children:r.map(h)})}function Le({count:r}){return e.jsx("span",{style:{position:"absolute",top:3,right:3,minWidth:16,height:16,background:t.danger,color:"#fff",borderRadius:8,fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 3px",lineHeight:1,pointerEvents:"none"},children:r})}function it({logo:r,items:l=[],vertical:d=!1,onAction:s,style:u}){const[a,h]=x.useState(null),[n,g]=x.useState(()=>{const f={};return l.forEach(y=>{y.id&&y.twoState&&y.active&&(f[y.id]=!0)}),f}),b=x.useRef(null);x.useEffect(j,[]),Z(b,x.useCallback(()=>h(null),[]));const c=(f,y)=>{var o,k;if(!f.disabled){if(f.twoState&&f.id&&g(m=>({...m,[f.id]:!m[f.id]})),(o=f.items)!=null&&o.length){h(m=>m===y?null:y);return}(k=f.onClick)==null||k.call(f,f.id||""),s==null||s(f.id||"")}},M=(f,y)=>{var C;if(f.hidden)return null;if(f.type==="separator")return e.jsx("div",{style:{[d?"height":"width"]:1,background:t.border,margin:d?"4px 8px":"0 6px",alignSelf:"stretch"}},y);if(f.type==="spacer")return e.jsx("div",{style:{flex:1}},y);if(f.type==="input")return e.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",margin:"0 4px"},children:[f.icon&&e.jsx("span",{style:{position:"absolute",left:8,color:t.textMut,fontSize:15,pointerEvents:"none",zIndex:1},children:f.icon}),e.jsx("input",{className:"dhx dhx-input",style:{width:f.width||200,height:28,paddingLeft:f.icon?30:void 0},placeholder:f.placeholder,onChange:D=>{var T;return(T=f.onChange)==null?void 0:T.call(f,D.target.value)}})]},y);if(f.type==="imageButton")return e.jsxs("button",{title:f.tooltip,disabled:f.disabled,style:{position:"relative",width:36,height:36,padding:2,border:"none",borderRadius:"50%",overflow:"hidden",cursor:f.disabled?"not-allowed":"pointer",background:"transparent",flexShrink:0},onClick:()=>c(f,y),children:[f.src&&e.jsx("img",{src:f.src,alt:f.value||"",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}),f.count!==void 0&&e.jsx(Le,{count:f.count})]},y);const o=!!(f.twoState&&f.id&&n[f.id]),k=!!((C=f.items)!=null&&C.length),m={position:"relative",height:d?40:36,gap:6,background:o?t.primaryLt:"transparent",color:o?t.primary:f.disabled?t.textMut:t.text,opacity:f.disabled?.55:1,cursor:f.disabled?"not-allowed":"pointer",...d?{width:"100%",justifyContent:"flex-start",padding:"0 16px",borderRadius:0}:{}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{className:"dhx dhx-btn dhx-btn-ghost",title:f.tooltip,disabled:f.disabled,style:m,onClick:()=>c(f,y),children:[f.icon&&e.jsx("span",{style:{fontSize:16,flexShrink:0},children:f.icon}),f.value&&e.jsx("span",{style:{fontSize:13},children:f.value}),k&&e.jsx("span",{style:{fontSize:9,opacity:.55,marginLeft:2},children:"▼"}),f.count!==void 0&&e.jsx(Le,{count:f.count})]}),k&&a===y&&e.jsx(ne,{items:f.items,onSelect:()=>h(null),style:d?{left:"100%",top:0}:{top:"100%"}})]},y)};return e.jsxs("nav",{ref:b,className:"dhx",style:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"stretch":"center",background:t.surface,borderBottom:d?"none":`1px solid ${t.border}`,borderRight:d?`1px solid ${t.border}`:"none",padding:d?"8px 0":"0 12px",minHeight:d?void 0:48,gap:2,...u},children:[r&&e.jsx("div",{style:{color:t.text,fontWeight:800,fontSize:16,padding:d?"8px 16px 12px":"0 12px 0 4px",borderBottom:d?`1px solid ${t.border}`:"none",borderRight:d?"none":`1px solid ${t.border}`,marginRight:d?0:8,marginBottom:d?4:0,flexShrink:0},children:r}),l.map(M)]})}W.Button=Ie,W.Calendar=Ke,W.Chart=Oe,W.Colorpicker=_e,W.Combobox=pe,W.ContextMenu=Ge,W.DataView=tt,W.Form=lt,W.Grid=je,W.Layout=we,W.List=et,W.Menu=qe,W.MenuDropdown=ne,W.MessageContext=ue,W.MessageProvider=Ze,W.Navbar=it,W.Pagination=st,W.Popup=Je,W.Ribbon=at,W.Sidebar=Ae,W.Slider=he,W.Tabbar=He,W.Timepicker=me,W.Toolbar=We,W.Tree=ot,W.Window=Ue,W.tokens=t,W.useClickOutside=Z,W.useDrag=Me,W.useMessage=Re,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
|
|
42
42
|
//# sourceMappingURL=dhx-react-suite.umd.cjs.map
|