@object-ui/console 3.1.1 → 3.1.2

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.
Files changed (48) hide show
  1. package/dist/assets/{AppManagementPage-D_71FpIH.js → AppManagementPage-CaWUYaXX.js} +1 -1
  2. package/dist/assets/{AuditLogPage-D3g_VEdE.js → AuditLogPage-CB1qkThp.js} +1 -1
  3. package/dist/assets/{CreateAppPage-mqt5j4rK.js → CreateAppPage-DLRU3TEg.js} +1 -1
  4. package/dist/assets/{DashboardDesignPage-Cijb3jeF.js → DashboardDesignPage-DGz-5xrK.js} +1 -1
  5. package/dist/assets/{DashboardView-DjhlMHLV.js → DashboardView-v834XbaQ.js} +1 -1
  6. package/dist/assets/{EditAppPage-BiK_DWcO.js → EditAppPage-DocDqKMS.js} +1 -1
  7. package/dist/assets/{ForgotPasswordPage-Bzady8r_.js → ForgotPasswordPage-8ypvh4-X.js} +1 -1
  8. package/dist/assets/{KanbanEnhanced-OvdpYe81.js → KanbanEnhanced-Cw4oddBv.js} +1 -1
  9. package/dist/assets/{KanbanImpl-EcxwmGw7.js → KanbanImpl-D6ggfmB0.js} +1 -1
  10. package/dist/assets/{LoginPage-valW4Wu1.js → LoginPage-XakThPoT.js} +1 -1
  11. package/dist/assets/{OrgManagementPage-D0d52PdP.js → OrgManagementPage-Df5167oO.js} +1 -1
  12. package/dist/assets/{PageDesignPage-hpFLdWCR.js → PageDesignPage-BzM4EsXt.js} +1 -1
  13. package/dist/assets/PageView-CpIQvLmr.js +2 -0
  14. package/dist/assets/{PermissionManagementPage-ELCC8HyK.js → PermissionManagementPage-CZH3URJU.js} +1 -1
  15. package/dist/assets/{ProfilePage-Dj1N0mY3.js → ProfilePage-BvIbbebc.js} +1 -1
  16. package/dist/assets/RecordDetailView-BNnPf0DG.js +1 -0
  17. package/dist/assets/{RegisterPage-DqUU8oW-.js → RegisterPage-CIeFN9rY.js} +1 -1
  18. package/dist/assets/{ReportView-CNi0A66t.js → ReportView-DYhXezmy.js} +1 -1
  19. package/dist/assets/{RoleManagementPage-DRvuG53j.js → RoleManagementPage-D0X7HlqJ.js} +1 -1
  20. package/dist/assets/{SearchResultsPage-nMlMQCb8.js → SearchResultsPage-CoMB32KW.js} +1 -1
  21. package/dist/assets/{SystemHubPage-CAY-YvG2.js → SystemHubPage-Cvl3VKcV.js} +1 -1
  22. package/dist/assets/{UserManagementPage-fzvfJxav.js → UserManagementPage-5k8BQxT1.js} +1 -1
  23. package/dist/assets/data-adapter-Bif-TtZA.js +1 -0
  24. package/dist/assets/framework-52FGgFF6.js +10 -0
  25. package/dist/assets/{index-Dv78M4Xq.js → index-D5i0wk-G.js} +1 -1
  26. package/dist/assets/index-fjkakZm9.js +9 -0
  27. package/dist/assets/index-h9Jznm67.css +1 -0
  28. package/dist/assets/infrastructure-Dn7jNPwf.js +1 -0
  29. package/dist/assets/plugins-core-CP8uPw4p.js +8 -0
  30. package/dist/assets/plugins-views-DZCu8Ex3.js +62 -0
  31. package/dist/assets/{ui-components-BxvihT61.js → ui-components-BE4yvyhE.js} +6 -6
  32. package/dist/assets/ui-components-CxztIKgM.css +1 -0
  33. package/dist/assets/{ui-layout-C6KWQtRO.js → ui-layout-CYnH69Z2.js} +1 -1
  34. package/dist/assets/vendor-objectstack-CatrkstC.js +34 -0
  35. package/dist/assets/{vendor-zod-DxQVy2_o.js → vendor-zod-C5j6C2CQ.js} +1 -1
  36. package/dist/index.html +14 -14
  37. package/package.json +29 -29
  38. package/dist/assets/PageView-DxIAf-SB.js +0 -2
  39. package/dist/assets/RecordDetailView-DS9tEr5f.js +0 -1
  40. package/dist/assets/data-adapter-rvE3xy2B.js +0 -1
  41. package/dist/assets/framework-BM176iet.js +0 -10
  42. package/dist/assets/index-B6cpm7bF.css +0 -1
  43. package/dist/assets/index-CTBPkbPG.js +0 -9
  44. package/dist/assets/infrastructure-n1j_TN6w.js +0 -1
  45. package/dist/assets/plugins-core-qwgXbAqa.js +0 -8
  46. package/dist/assets/plugins-views-CveFN6PV.js +0 -62
  47. package/dist/assets/ui-components-CRV2BvKI.css +0 -1
  48. package/dist/assets/vendor-objectstack-YKtcdalX.js +0 -34
@@ -1 +1 @@
1
- import{h as L,i as E,r as t,j as e}from"./vendor-react-9M-xu2bR.js";import{B as o,aa as P,G as p,C as B,v as I}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as d}from"./vendor-ui-utils-3tkeUVaX.js";import{b as F,r as w}from"./index-CTBPkbPG.js";import{m as M,S as Q,ai as y,$ as G,at as R,bc as T,bd as q,Q as O,l as H}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function re(){const u=L(),{appName:g}=E(),j=g?`/apps/${g}`:"",{apps:C,refresh:i}=F(),[h,k]=t.useState(""),[n,x]=t.useState(new Set),[f,b]=t.useState(null),[m,c]=t.useState(!1),l=(C||[]).filter(s=>{if(!h)return!0;const a=h.toLowerCase();return(s.name||"").toLowerCase().includes(a)||(s.label||"").toLowerCase().includes(a)||(s.description||"").toLowerCase().includes(a)}),S=t.useCallback(s=>{x(a=>{const r=new Set(a);return r.has(s)?r.delete(s):r.add(s),r})},[]),$=t.useCallback(()=>{n.size===l.length?x(new Set):x(new Set(l.map(s=>s.name)))},[n.size,l]),z=t.useCallback(async s=>{c(!0);try{const a=s.active===!1;d.success(`${s.label||s.name} ${a?"enabled":"disabled"}`),await i()}catch{d.error("Failed to toggle app status")}finally{c(!1)}},[i]),A=t.useCallback(async s=>{c(!0);try{d.success(`${s.label||s.name} set as default`),await i()}catch{d.error("Failed to set default app")}finally{c(!1)}},[i]),D=t.useCallback(async s=>{if(f!==s.name){b(s.name);return}c(!0);try{d.success(`${s.label||s.name} deleted`),b(null),await i()}catch{d.error("Failed to delete app")}finally{c(!1)}},[f,i]),v=t.useCallback(async s=>{c(!0);try{d.success(`${n.size} apps ${s?"enabled":"disabled"}`),x(new Set),await i()}catch{d.error("Bulk operation failed")}finally{c(!1)}},[n,i]);return e.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Applications"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage all configured applications"})]}),e.jsxs(o,{onClick:()=>u(`${j}/create-app`),"data-testid":"create-app-btn",children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"New App"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Q,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(P,{placeholder:"Search apps...",value:h,onChange:s=>k(s.target.value),className:"pl-8","data-testid":"app-search-input"})]}),n.size>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(p,{variant:"secondary",children:[n.size," selected"]}),e.jsx(o,{variant:"outline",size:"sm",onClick:()=>v(!0),disabled:m,children:"Enable"}),e.jsx(o,{variant:"outline",size:"sm",onClick:()=>v(!1),disabled:m,children:"Disable"})]})]}),l.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:n.size===l.length&&l.length>0,onChange:$,className:"rounded border-input","aria-label":"Select all apps"}),e.jsxs("span",{children:["Select all (",l.length,")"]})]}),l.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground","data-testid":"no-apps-message",children:[e.jsx(y,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No apps found."})]}):e.jsx("div",{className:"grid gap-3",children:l.map(s=>{const a=s.active!==!1,r=s.isDefault===!0,N=f===s.name;return e.jsx(B,{className:a?"":"opacity-60","data-testid":`app-card-${s.name}`,children:e.jsxs(I,{className:"flex items-center gap-3 py-3 px-4",children:[e.jsx("input",{type:"checkbox",checked:n.has(s.name),onChange:()=>S(s.name),className:"rounded border-input shrink-0","aria-label":`Select ${s.label||s.name}`}),e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:w(s.label)||s.name}),r&&e.jsx(p,{variant:"default",className:"text-xs",children:"Default"}),e.jsx(p,{variant:a?"secondary":"outline",className:"text-xs",children:a?"Active":"Inactive"})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:w(s.description)})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(o,{variant:"ghost",size:"icon",title:"Open app",onClick:()=>u(`/apps/${s.name}`),children:e.jsx(G,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:"Edit app",onClick:()=>u(`${j}/edit-app/${s.name}`),children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:a?"Disable app":"Enable app",onClick:()=>z(s),disabled:m,children:a?e.jsx(T,{className:"h-4 w-4"}):e.jsx(q,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:"Set as default",onClick:()=>A(s),disabled:m||r,children:e.jsx(O,{className:`h-4 w-4 ${r?"fill-current text-yellow-500":""}`})}),e.jsx(o,{variant:"ghost",size:"icon",title:N?"Click again to confirm delete":"Delete app",onClick:()=>D(s),disabled:m,className:N?"text-destructive":"",children:e.jsx(H,{className:"h-4 w-4"})})]})]})},s.name)})})]})}export{re as AppManagementPage};
1
+ import{h as L,i as E,r as t,j as e}from"./vendor-react-9M-xu2bR.js";import{B as o,ab as P,G as p,C as B,v as I}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as d}from"./vendor-ui-utils-3tkeUVaX.js";import{b as F,r as w}from"./index-fjkakZm9.js";import{m as M,S as Q,ai as y,$ as G,at as R,bc as T,bd as q,Q as O,l as H}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function re(){const u=L(),{appName:g}=E(),j=g?`/apps/${g}`:"",{apps:C,refresh:i}=F(),[h,k]=t.useState(""),[n,x]=t.useState(new Set),[f,b]=t.useState(null),[m,c]=t.useState(!1),l=(C||[]).filter(s=>{if(!h)return!0;const a=h.toLowerCase();return(s.name||"").toLowerCase().includes(a)||(s.label||"").toLowerCase().includes(a)||(s.description||"").toLowerCase().includes(a)}),S=t.useCallback(s=>{x(a=>{const r=new Set(a);return r.has(s)?r.delete(s):r.add(s),r})},[]),$=t.useCallback(()=>{n.size===l.length?x(new Set):x(new Set(l.map(s=>s.name)))},[n.size,l]),z=t.useCallback(async s=>{c(!0);try{const a=s.active===!1;d.success(`${s.label||s.name} ${a?"enabled":"disabled"}`),await i()}catch{d.error("Failed to toggle app status")}finally{c(!1)}},[i]),A=t.useCallback(async s=>{c(!0);try{d.success(`${s.label||s.name} set as default`),await i()}catch{d.error("Failed to set default app")}finally{c(!1)}},[i]),D=t.useCallback(async s=>{if(f!==s.name){b(s.name);return}c(!0);try{d.success(`${s.label||s.name} deleted`),b(null),await i()}catch{d.error("Failed to delete app")}finally{c(!1)}},[f,i]),v=t.useCallback(async s=>{c(!0);try{d.success(`${n.size} apps ${s?"enabled":"disabled"}`),x(new Set),await i()}catch{d.error("Bulk operation failed")}finally{c(!1)}},[n,i]);return e.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Applications"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage all configured applications"})]}),e.jsxs(o,{onClick:()=>u(`${j}/create-app`),"data-testid":"create-app-btn",children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"New App"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Q,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(P,{placeholder:"Search apps...",value:h,onChange:s=>k(s.target.value),className:"pl-8","data-testid":"app-search-input"})]}),n.size>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(p,{variant:"secondary",children:[n.size," selected"]}),e.jsx(o,{variant:"outline",size:"sm",onClick:()=>v(!0),disabled:m,children:"Enable"}),e.jsx(o,{variant:"outline",size:"sm",onClick:()=>v(!1),disabled:m,children:"Disable"})]})]}),l.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:n.size===l.length&&l.length>0,onChange:$,className:"rounded border-input","aria-label":"Select all apps"}),e.jsxs("span",{children:["Select all (",l.length,")"]})]}),l.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground","data-testid":"no-apps-message",children:[e.jsx(y,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"No apps found."})]}):e.jsx("div",{className:"grid gap-3",children:l.map(s=>{const a=s.active!==!1,r=s.isDefault===!0,N=f===s.name;return e.jsx(B,{className:a?"":"opacity-60","data-testid":`app-card-${s.name}`,children:e.jsxs(I,{className:"flex items-center gap-3 py-3 px-4",children:[e.jsx("input",{type:"checkbox",checked:n.has(s.name),onChange:()=>S(s.name),className:"rounded border-input shrink-0","aria-label":`Select ${s.label||s.name}`}),e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:w(s.label)||s.name}),r&&e.jsx(p,{variant:"default",className:"text-xs",children:"Default"}),e.jsx(p,{variant:a?"secondary":"outline",className:"text-xs",children:a?"Active":"Inactive"})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:w(s.description)})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(o,{variant:"ghost",size:"icon",title:"Open app",onClick:()=>u(`/apps/${s.name}`),children:e.jsx(G,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:"Edit app",onClick:()=>u(`${j}/edit-app/${s.name}`),children:e.jsx(R,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:a?"Disable app":"Enable app",onClick:()=>z(s),disabled:m,children:a?e.jsx(T,{className:"h-4 w-4"}):e.jsx(q,{className:"h-4 w-4"})}),e.jsx(o,{variant:"ghost",size:"icon",title:"Set as default",onClick:()=>A(s),disabled:m||r,children:e.jsx(O,{className:`h-4 w-4 ${r?"fill-current text-yellow-500":""}`})}),e.jsx(o,{variant:"ghost",size:"icon",title:N?"Click again to confirm delete":"Delete app",onClick:()=>D(s),disabled:m,className:N?"text-destructive":"",children:e.jsx(H,{className:"h-4 w-4"})})]})]})},s.name)})})]})}export{re as AppManagementPage};
@@ -1 +1 @@
1
- import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{C as u,v as h,G as f}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as j}from"./vendor-ui-utils-3tkeUVaX.js";import{a as g}from"./index-CTBPkbPG.js";import{s as N}from"./systemObjects-DSpePIIy.js";import{bb as n,L as b}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const m=N.find(s=>s.name==="sys_audit_log"),i=m.views[0].columns;function V(){const s=g(),[o,c]=r.useState([]),[x,d]=r.useState(!0),l=r.useCallback(async()=>{if(s){d(!0);try{const t=await s.find("sys_audit_log",{$orderby:{createdAt:"desc"}});c(t.data||[])}catch{j.error("Failed to load audit logs")}finally{d(!1)}}},[s]);return r.useEffect(()=>{l()},[l]),e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(n,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Audit Log"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"View system activity and user actions"})]})]}),e.jsx(u,{children:e.jsx(h,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:i.map(t=>{const a=m.fields.find(p=>p.name===t);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:a?.label??t},t)})})}),e.jsx("tbody",{children:x?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:i.length,children:e.jsx(b,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:i.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(n,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No audit logs found."}),e.jsx(f,{variant:"secondary",className:"text-xs",children:"Read-only"})]})})}):o.map(t=>e.jsx("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:i.map(a=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(t[a]??"")},a))},t.id||t._id))})]})})})})]})}export{V as AuditLogPage};
1
+ import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{C as u,v as h,G as f}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as j}from"./vendor-ui-utils-3tkeUVaX.js";import{a as g}from"./index-fjkakZm9.js";import{s as N}from"./systemObjects-DSpePIIy.js";import{bb as n,L as b}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const m=N.find(s=>s.name==="sys_audit_log"),i=m.views[0].columns;function V(){const s=g(),[o,c]=r.useState([]),[x,d]=r.useState(!0),l=r.useCallback(async()=>{if(s){d(!0);try{const t=await s.find("sys_audit_log",{$orderby:{createdAt:"desc"}});c(t.data||[])}catch{j.error("Failed to load audit logs")}finally{d(!1)}}},[s]);return r.useEffect(()=>{l()},[l]),e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(n,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Audit Log"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"View system activity and user actions"})]})]}),e.jsx(u,{children:e.jsx(h,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:i.map(t=>{const a=m.fields.find(p=>p.name===t);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:a?.label??t},t)})})}),e.jsx("tbody",{children:x?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:i.length,children:e.jsx(b,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):o.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:i.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(n,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No audit logs found."}),e.jsx(f,{variant:"secondary",className:"text-xs",children:"Read-only"})]})})}):o.map(t=>e.jsx("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:i.map(a=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(t[a]??"")},a))},t.id||t._id))})]})})})})]})}export{V as AuditLogPage};
@@ -1 +1 @@
1
- import{h as C,i as v,r as e,j as n}from"./vendor-react-9M-xu2bR.js";import{AppCreationWizard as x}from"./index-Dv78M4Xq.js";import{z as S}from"./framework-BM176iet.js";import"./vendor-objectstack-YKtcdalX.js";import{b,a as y}from"./index-CTBPkbPG.js";import{b as s}from"./vendor-ui-utils-3tkeUVaX.js";import"./vendor-icons-ndICq8DC.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BxvihT61.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const i="objectui-app-wizard-draft";function K(){const t=C(),{appName:r}=v(),{objects:l,refresh:p}=b(),c=y(),f=(l||[]).map(a=>({name:a.name,label:a.label||a.name,icon:a.icon,selected:!1})),u=e.useCallback(()=>{try{const a=localStorage.getItem(i);if(a)return JSON.parse(a)}catch{}},[]),d=e.useCallback(async a=>{try{const o=S(a),m=c?.getClient();m&&await m.meta.saveItem("app",a.name,o),localStorage.removeItem(i),s.success(`Application "${a.title}" created successfully`),await p?.(),t(`/apps/${a.name}`)}catch(o){s.error(o?.message||"Failed to create application")}},[t,p,c]),g=e.useCallback(()=>{t(r?`/apps/${r}`:"/")},[t,r]),h=e.useCallback(a=>{try{localStorage.setItem(i,JSON.stringify(a)),s.info("Draft saved")}catch{}},[]);return n.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4","data-testid":"create-app-page",children:n.jsx(x,{availableObjects:f,initialDraft:u(),onComplete:d,onCancel:g,onSaveDraft:h})})}export{K as CreateAppPage};
1
+ import{h as C,i as v,r as e,j as n}from"./vendor-react-9M-xu2bR.js";import{AppCreationWizard as x}from"./index-D5i0wk-G.js";import{z as S}from"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b,a as y}from"./index-fjkakZm9.js";import{b as s}from"./vendor-ui-utils-3tkeUVaX.js";import"./vendor-icons-ndICq8DC.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-zod-C5j6C2CQ.js";import"./ui-components-BE4yvyhE.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const i="objectui-app-wizard-draft";function K(){const t=C(),{appName:r}=v(),{objects:l,refresh:p}=b(),c=y(),f=(l||[]).map(a=>({name:a.name,label:a.label||a.name,icon:a.icon,selected:!1})),u=e.useCallback(()=>{try{const a=localStorage.getItem(i);if(a)return JSON.parse(a)}catch{}},[]),d=e.useCallback(async a=>{try{const o=S(a),m=c?.getClient();m&&await m.meta.saveItem("app",a.name,o),localStorage.removeItem(i),s.success(`Application "${a.title}" created successfully`),await p?.(),t(`/apps/${a.name}`)}catch(o){s.error(o?.message||"Failed to create application")}},[t,p,c]),g=e.useCallback(()=>{t(r?`/apps/${r}`:"/")},[t,r]),h=e.useCallback(a=>{try{localStorage.setItem(i,JSON.stringify(a)),s.info("Draft saved")}catch{}},[]);return n.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4","data-testid":"create-app-page",children:n.jsx(x,{availableObjects:f,initialDraft:u(),onComplete:d,onCancel:g,onSaveDraft:h})})}export{K as CreateAppPage};
@@ -1 +1 @@
1
- import{h as j,i as v,r as s,j as a}from"./vendor-react-9M-xu2bR.js";import{DashboardEditor as w}from"./index-Dv78M4Xq.js";import{b as h}from"./vendor-ui-utils-3tkeUVaX.js";import{a as k,b as D}from"./index-CTBPkbPG.js";import{A as E}from"./vendor-icons-ndICq8DC.js";import"./framework-BM176iet.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BxvihT61.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function z(){const b=j(),{dashboardName:t}=v(),d=k(),{dashboards:f,refresh:u}=D(),r=f?.find(e=>e.name===t),[i,x]=s.useState(()=>r||{type:"dashboard",name:t??"",title:t??"",columns:2,widgets:[]}),p=s.useRef(i);p.current=i;const n=s.useCallback(async e=>{try{if(d)return await d.update("sys_dashboard",t,e),u().catch(()=>{}),!0}catch{}return!1},[d,t,u]),l=s.useCallback(async e=>{x(e),await n(e)},[n]);s.useEffect(()=>{const e=o=>{(o.ctrlKey||o.metaKey)&&o.key==="s"&&(o.preventDefault(),n(p.current).then(c=>{c&&h.success("Dashboard saved")}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);const g=s.useCallback(e=>{const o=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),c=URL.createObjectURL(o),m=document.createElement("a");m.href=c,m.download=`${t||"dashboard"}.json`,m.click(),URL.revokeObjectURL(c),h.success("Dashboard schema exported")},[t]),y=s.useCallback(e=>{h.success("Dashboard schema imported"),l(e)},[l]);return r?a.jsxs("div",{className:"h-full flex flex-col","data-testid":"dashboard-design-page",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 sm:px-6",children:[a.jsx("button",{type:"button",onClick:()=>b(-1),className:"rounded p-1.5 text-muted-foreground hover:text-foreground","aria-label":"Go back","data-testid":"dashboard-design-back",children:a.jsx(E,{className:"h-4 w-4"})}),a.jsxs("h1",{className:"text-lg font-semibold tracking-tight truncate",children:["Edit Dashboard: ",r.label||r.title||t]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:a.jsx(w,{schema:i,onChange:l,onExport:g,onImport:y})})]}):a.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Dashboard "',t,'" not found']})}export{z as DashboardDesignPage};
1
+ import{h as j,i as v,r as s,j as a}from"./vendor-react-9M-xu2bR.js";import{DashboardEditor as w}from"./index-D5i0wk-G.js";import{b as h}from"./vendor-ui-utils-3tkeUVaX.js";import{a as k,b as D}from"./index-fjkakZm9.js";import{A as E}from"./vendor-icons-ndICq8DC.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-zod-C5j6C2CQ.js";import"./ui-components-BE4yvyhE.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function z(){const b=j(),{dashboardName:t}=v(),d=k(),{dashboards:f,refresh:u}=D(),r=f?.find(e=>e.name===t),[i,x]=s.useState(()=>r||{type:"dashboard",name:t??"",title:t??"",columns:2,widgets:[]}),p=s.useRef(i);p.current=i;const n=s.useCallback(async e=>{try{if(d)return await d.update("sys_dashboard",t,e),u().catch(()=>{}),!0}catch{}return!1},[d,t,u]),l=s.useCallback(async e=>{x(e),await n(e)},[n]);s.useEffect(()=>{const e=o=>{(o.ctrlKey||o.metaKey)&&o.key==="s"&&(o.preventDefault(),n(p.current).then(c=>{c&&h.success("Dashboard saved")}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);const g=s.useCallback(e=>{const o=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),c=URL.createObjectURL(o),m=document.createElement("a");m.href=c,m.download=`${t||"dashboard"}.json`,m.click(),URL.revokeObjectURL(c),h.success("Dashboard schema exported")},[t]),y=s.useCallback(e=>{h.success("Dashboard schema imported"),l(e)},[l]);return r?a.jsxs("div",{className:"h-full flex flex-col","data-testid":"dashboard-design-page",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 sm:px-6",children:[a.jsx("button",{type:"button",onClick:()=>b(-1),className:"rounded p-1.5 text-muted-foreground hover:text-foreground","aria-label":"Go back","data-testid":"dashboard-design-back",children:a.jsx(E,{className:"h-4 w-4"})}),a.jsxs("h1",{className:"text-lg font-semibold tracking-tight truncate",children:["Edit Dashboard: ",r.label||r.title||t]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:a.jsx(w,{schema:i,onChange:l,onExport:g,onImport:y})})]}):a.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Dashboard "',t,'" not found']})}export{z as DashboardDesignPage};
@@ -1 +1 @@
1
- import{j as e,i as X,r as i}from"./vendor-react-9M-xu2bR.js";import{a as J,W as Q,b as Z}from"./plugins-views-CveFN6PV.js";import{p as m,b7 as ee,b8 as te,b9 as ae,B as se}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{u as re}from"./infrastructure-n1j_TN6w.js";import"./vendor-ui-utils-3tkeUVaX.js";import{u as ne,a as le,b as ie,r as F,M as oe}from"./index-CTBPkbPG.js";import{aX as de,u as ce,aY as ue,b5 as me,b6 as he,b7 as ge,ai as fe,m as be,at as pe,l as xe}from"./vendor-icons-ndICq8DC.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function je({cards:t=6}){return e.jsxs("div",{className:"w-full space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{className:"h-7 w-56"}),e.jsx(m,{className:"h-4 w-80"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:Array.from({length:4}).map((d,c)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsx(m,{className:"h-4 w-20"}),e.jsx(m,{className:"h-8 w-24"}),e.jsx(m,{className:"h-3 w-16"})]},`stat-${c}`))}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:t}).map((d,c)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(m,{className:"h-5 w-32"}),e.jsx(m,{className:"h-5 w-5 rounded-full"})]}),e.jsx(m,{className:"h-40 w-full"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-3 w-16"}),e.jsx(m,{className:"h-3 w-12"})]})]},`widget-${c}`))})]})}const T=[{type:"metric",label:"KPI Metric",Icon:ce},{type:"bar",label:"Bar Chart",Icon:ue},{type:"line",label:"Line Chart",Icon:me},{type:"pie",label:"Pie Chart",Icon:he},{type:"table",label:"Table",Icon:ge},{type:"grid",label:"Grid",Icon:fe}];let P=0;function V(){return P+=1,`widget_${Date.now()}_${P}`}function we(t){return!t.widgets?.length||!t.widgets.some(c=>!c.id)?t:{...t,widgets:t.widgets.map(c=>c.id?c:{...c,id:V()})}}function ve(t){const d=T.find(c=>c.type===t);return d?`New ${d.label}`:"New Widget"}function E(t){return{title:t.title??"",description:t.description??"",type:t.type??"metric",object:t.object??"",categoryField:t.categoryField??"",valueField:t.valueField??"",aggregate:t.aggregate??"count",layoutW:t.layout?.w??1,layoutH:t.layout?.h??1,colorVariant:t.colorVariant??"default",actionUrl:t.actionUrl??""}}function M(t,d){return{title:t.title,description:t.description,type:t.type,object:t.object,categoryField:t.categoryField,valueField:t.valueField,aggregate:t.aggregate,layout:{...d.layout||{},w:t.layoutW,h:t.layoutH},colorVariant:t.colorVariant,actionUrl:t.actionUrl}}function ye(t){return{columns:t.columns??3,gap:t.gap??4,rowHeight:String(t.rowHeight??"120"),refreshInterval:String(t.refreshInterval??"0"),title:t.title??"",showDescription:t.showDescription??!0,theme:t.theme??"auto"}}function He({dataSource:t}){const{dashboardName:d}=X(),{showDebug:c}=ne(),y=le(),{t:C}=re(),[A,S]=i.useState(!0),[x,N]=i.useState(!1),[o,j]=i.useState(null),[k,v]=i.useState(0);i.useEffect(()=>{S(!0),h(null),N(!1),j(null),queueMicrotask(()=>S(!1))},[d]);const{dashboards:L,objects:b,refresh:I}=ie(),u=L?.find(a=>a.name===d),[n,h]=i.useState(null);i.useEffect(()=>{x||h(null)},[u]);const g=i.useCallback(async a=>{try{y&&(await y.update("sys_dashboard",d,a),I().catch(()=>{}))}catch(l){console.warn("[DashboardView] Auto-save failed:",l)}},[y,d,I]),O=i.useCallback(()=>{h(we(u)),N(!0),v(a=>a+1)},[u]),D=i.useCallback(()=>{N(!1),j(null)},[]),$=i.useCallback(a=>{if(!n)return;const l=V(),s={id:l,title:ve(a),type:a,layout:{x:0,y:n.widgets?.length??0,w:n.columns??2,h:1}},r={...n,widgets:[...n.widgets||[],s]};h(r),g(r),j(l),v(p=>p+1)},[n,g]),H=i.useCallback(a=>{if(!n)return;const l={...n,widgets:n.widgets.filter(s=>s.id!==a)};h(l),g(l),o===a&&j(null)},[n,o,g]),_=i.useMemo(()=>ye(n||u),[k]),U=i.useCallback(a=>{if(!n)return;const l={...n,columns:a.columns,gap:a.gap,rowHeight:a.rowHeight,refreshInterval:Number(a.refreshInterval)||0,title:a.title,showDescription:a.showDescription,theme:a.theme};h(l),g(l),v(s=>s+1)},[n,g]),B=i.useCallback((a,l)=>{n&&h(s=>s&&(a==="refreshInterval"?{...s,refreshInterval:Number(l)||0}:{...s,[a]:l}))},[n]),f=n?.widgets?.find(a=>a.id===o),G=i.useMemo(()=>f?E(f):{},[o,k]),R=i.useCallback(a=>{if(!n||!o||!f)return;const l=M(a,f),s={...n,widgets:n.widgets.map(r=>r.id===o?{...r,...l}:r)};h(s),g(s),v(r=>r+1)},[n,o,f,g]),Y=i.useCallback((a,l)=>{o&&h(s=>{if(!s)return s;const r=s.widgets?.find(w=>w.id===o);if(!r)return s;const p=E(r);p[a]=l;const K=M(p,r);return{...s,widgets:s.widgets.map(w=>w.id===o?{...w,...K}:w)}})},[o]),q=i.useMemo(()=>{if(b?.length)return b.map(a=>({value:a.name,label:a.label||a.name}))},[b]),z=i.useMemo(()=>{const a=f?.object;if(!a||!b?.length)return;const l=b.find(r=>r.name===a);if(!l?.fields)return;const s=l.fields;return Array.isArray(s)?s.filter(r=>r.name).map(r=>({value:r.name,label:r.label||r.name})):Object.entries(s).map(([r,p])=>({value:r,label:p.label||r}))},[f?.object,b]);if(A)return e.jsx(je,{});if(!u)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(ee,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(de,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(te,{children:"Dashboard Not Found"}),e.jsxs(ae,{children:['The dashboard "',d,'" could not be found. It may have been removed or renamed.']})]})});const W=n||u;return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate",children:F(u.label,C)||u.name}),u.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:F(u.description,C)})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[x&&e.jsx("div",{className:"flex items-center gap-1 mr-2","data-testid":"dashboard-widget-toolbar",children:T.map(({type:a,label:l,Icon:s})=>e.jsxs("button",{type:"button","data-testid":`dashboard-add-${a}`,onClick:()=>$(a),className:"inline-flex items-center gap-1 rounded-md border border-input bg-background px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground",title:`Add ${l}`,children:[e.jsx(be,{className:"h-3 w-3"}),e.jsx(s,{className:"h-3 w-3"})]},a))}),e.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"dashboard-edit-button",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),"Edit"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col sm:flex-row relative",children:[e.jsx("div",{className:"flex-1 min-w-0 overflow-auto p-0 sm:p-6",children:e.jsx(J,{schema:W,dataSource:t,designMode:x,selectedWidgetId:o,onWidgetClick:j})}),f?e.jsx(Q,{open:x,onClose:D,config:G,onSave:R,onFieldChange:Y,availableObjects:q,availableFields:z,headerExtra:e.jsx(se,{size:"sm",variant:"ghost",onClick:()=>H(o),className:"h-7 w-7 p-0 text-destructive hover:text-destructive","data-testid":"widget-delete-button",title:"Delete widget",children:e.jsx(xe,{className:"h-3.5 w-3.5"})})},o):e.jsx(Z,{open:x,onClose:D,config:_,onSave:U,onFieldChange:B}),e.jsx(oe,{open:c,sections:[{title:"Dashboard Configuration",data:W}]})]})]})}export{He as DashboardView};
1
+ import{j as e,i as X,r as i}from"./vendor-react-9M-xu2bR.js";import{a as J,W as Q,b as Z}from"./plugins-views-DZCu8Ex3.js";import{p as m,b7 as ee,b8 as te,b9 as ae,B as se}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{u as re}from"./infrastructure-Dn7jNPwf.js";import"./vendor-ui-utils-3tkeUVaX.js";import{u as ne,a as le,b as ie,r as F,M as oe}from"./index-fjkakZm9.js";import{aX as de,u as ce,aY as ue,b5 as me,b6 as he,b7 as ge,ai as fe,m as be,at as pe,l as xe}from"./vendor-icons-ndICq8DC.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function je({cards:t=6}){return e.jsxs("div",{className:"w-full space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{className:"h-7 w-56"}),e.jsx(m,{className:"h-4 w-80"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:Array.from({length:4}).map((d,c)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[e.jsx(m,{className:"h-4 w-20"}),e.jsx(m,{className:"h-8 w-24"}),e.jsx(m,{className:"h-3 w-16"})]},`stat-${c}`))}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:t}).map((d,c)=>e.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(m,{className:"h-5 w-32"}),e.jsx(m,{className:"h-5 w-5 rounded-full"})]}),e.jsx(m,{className:"h-40 w-full"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{className:"h-3 w-16"}),e.jsx(m,{className:"h-3 w-12"})]})]},`widget-${c}`))})]})}const T=[{type:"metric",label:"KPI Metric",Icon:ce},{type:"bar",label:"Bar Chart",Icon:ue},{type:"line",label:"Line Chart",Icon:me},{type:"pie",label:"Pie Chart",Icon:he},{type:"table",label:"Table",Icon:ge},{type:"grid",label:"Grid",Icon:fe}];let P=0;function V(){return P+=1,`widget_${Date.now()}_${P}`}function we(t){return!t.widgets?.length||!t.widgets.some(c=>!c.id)?t:{...t,widgets:t.widgets.map(c=>c.id?c:{...c,id:V()})}}function ve(t){const d=T.find(c=>c.type===t);return d?`New ${d.label}`:"New Widget"}function E(t){return{title:t.title??"",description:t.description??"",type:t.type??"metric",object:t.object??"",categoryField:t.categoryField??"",valueField:t.valueField??"",aggregate:t.aggregate??"count",layoutW:t.layout?.w??1,layoutH:t.layout?.h??1,colorVariant:t.colorVariant??"default",actionUrl:t.actionUrl??""}}function M(t,d){return{title:t.title,description:t.description,type:t.type,object:t.object,categoryField:t.categoryField,valueField:t.valueField,aggregate:t.aggregate,layout:{...d.layout||{},w:t.layoutW,h:t.layoutH},colorVariant:t.colorVariant,actionUrl:t.actionUrl}}function ye(t){return{columns:t.columns??3,gap:t.gap??4,rowHeight:String(t.rowHeight??"120"),refreshInterval:String(t.refreshInterval??"0"),title:t.title??"",showDescription:t.showDescription??!0,theme:t.theme??"auto"}}function He({dataSource:t}){const{dashboardName:d}=X(),{showDebug:c}=ne(),y=le(),{t:C}=re(),[A,S]=i.useState(!0),[x,N]=i.useState(!1),[o,j]=i.useState(null),[k,v]=i.useState(0);i.useEffect(()=>{S(!0),h(null),N(!1),j(null),queueMicrotask(()=>S(!1))},[d]);const{dashboards:L,objects:b,refresh:I}=ie(),u=L?.find(a=>a.name===d),[n,h]=i.useState(null);i.useEffect(()=>{x||h(null)},[u]);const g=i.useCallback(async a=>{try{y&&(await y.update("sys_dashboard",d,a),I().catch(()=>{}))}catch(l){console.warn("[DashboardView] Auto-save failed:",l)}},[y,d,I]),O=i.useCallback(()=>{h(we(u)),N(!0),v(a=>a+1)},[u]),D=i.useCallback(()=>{N(!1),j(null)},[]),$=i.useCallback(a=>{if(!n)return;const l=V(),s={id:l,title:ve(a),type:a,layout:{x:0,y:n.widgets?.length??0,w:n.columns??2,h:1}},r={...n,widgets:[...n.widgets||[],s]};h(r),g(r),j(l),v(p=>p+1)},[n,g]),H=i.useCallback(a=>{if(!n)return;const l={...n,widgets:n.widgets.filter(s=>s.id!==a)};h(l),g(l),o===a&&j(null)},[n,o,g]),_=i.useMemo(()=>ye(n||u),[k]),U=i.useCallback(a=>{if(!n)return;const l={...n,columns:a.columns,gap:a.gap,rowHeight:a.rowHeight,refreshInterval:Number(a.refreshInterval)||0,title:a.title,showDescription:a.showDescription,theme:a.theme};h(l),g(l),v(s=>s+1)},[n,g]),B=i.useCallback((a,l)=>{n&&h(s=>s&&(a==="refreshInterval"?{...s,refreshInterval:Number(l)||0}:{...s,[a]:l}))},[n]),f=n?.widgets?.find(a=>a.id===o),G=i.useMemo(()=>f?E(f):{},[o,k]),R=i.useCallback(a=>{if(!n||!o||!f)return;const l=M(a,f),s={...n,widgets:n.widgets.map(r=>r.id===o?{...r,...l}:r)};h(s),g(s),v(r=>r+1)},[n,o,f,g]),Y=i.useCallback((a,l)=>{o&&h(s=>{if(!s)return s;const r=s.widgets?.find(w=>w.id===o);if(!r)return s;const p=E(r);p[a]=l;const K=M(p,r);return{...s,widgets:s.widgets.map(w=>w.id===o?{...w,...K}:w)}})},[o]),q=i.useMemo(()=>{if(b?.length)return b.map(a=>({value:a.name,label:a.label||a.name}))},[b]),z=i.useMemo(()=>{const a=f?.object;if(!a||!b?.length)return;const l=b.find(r=>r.name===a);if(!l?.fields)return;const s=l.fields;return Array.isArray(s)?s.filter(r=>r.name).map(r=>({value:r.name,label:r.label||r.name})):Object.entries(s).map(([r,p])=>({value:r,label:p.label||r}))},[f?.object,b]);if(A)return e.jsx(je,{});if(!u)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(ee,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(de,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(te,{children:"Dashboard Not Found"}),e.jsxs(ae,{children:['The dashboard "',d,'" could not be found. It may have been removed or renamed.']})]})});const W=n||u;return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate",children:F(u.label,C)||u.name}),u.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:F(u.description,C)})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[x&&e.jsx("div",{className:"flex items-center gap-1 mr-2","data-testid":"dashboard-widget-toolbar",children:T.map(({type:a,label:l,Icon:s})=>e.jsxs("button",{type:"button","data-testid":`dashboard-add-${a}`,onClick:()=>$(a),className:"inline-flex items-center gap-1 rounded-md border border-input bg-background px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:bg-accent hover:text-accent-foreground",title:`Add ${l}`,children:[e.jsx(be,{className:"h-3 w-3"}),e.jsx(s,{className:"h-3 w-3"})]},a))}),e.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"dashboard-edit-button",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),"Edit"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col sm:flex-row relative",children:[e.jsx("div",{className:"flex-1 min-w-0 overflow-auto p-0 sm:p-6",children:e.jsx(J,{schema:W,dataSource:t,designMode:x,selectedWidgetId:o,onWidgetClick:j})}),f?e.jsx(Q,{open:x,onClose:D,config:G,onSave:R,onFieldChange:Y,availableObjects:q,availableFields:z,headerExtra:e.jsx(se,{size:"sm",variant:"ghost",onClick:()=>H(o),className:"h-7 w-7 p-0 text-destructive hover:text-destructive","data-testid":"widget-delete-button",title:"Delete widget",children:e.jsx(xe,{className:"h-3.5 w-3.5"})})},o):e.jsx(Z,{open:x,onClose:D,config:_,onSave:U,onFieldChange:B}),e.jsx(oe,{open:c,sections:[{title:"Dashboard Configuration",data:W}]})]})]})}export{He as DashboardView};
@@ -1 +1 @@
1
- import{h as C,i as N,r,j as s}from"./vendor-react-9M-xu2bR.js";import{AppCreationWizard as A}from"./index-Dv78M4Xq.js";import{z as j}from"./framework-BM176iet.js";import"./vendor-objectstack-YKtcdalX.js";import{b as S,a as w}from"./index-CTBPkbPG.js";import{b as p}from"./vendor-ui-utils-3tkeUVaX.js";import"./vendor-icons-ndICq8DC.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BxvihT61.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function K(){const o=C(),{appName:i,editAppName:d}=N(),{apps:u,objects:f,refresh:m}=S(),c=w(),n=d||i,a=u.find(t=>t.name===n),g=(f||[]).map(t=>({name:t.name,label:t.label||t.name,icon:t.icon,selected:a?.navigation?.some(e=>e.type==="object"&&e.objectName===t.name)??!1})),x=r.useMemo(()=>{if(a)return{name:a.name,title:a.title||a.label||"",description:a.description||"",icon:a.icon||"",layout:a.layout||"sidebar",navigation:a.navigation||[],branding:{logo:a.branding?.logo||a.logo||"",primaryColor:a.branding?.primaryColor||"#3b82f6",favicon:a.branding?.favicon||a.favicon||""}}},[a]),b=r.useCallback(async t=>{try{const e=j(t),y={...a,...e},l=c?.getClient();l&&await l.meta.saveItem("app",t.name,y),p.success(`Application "${t.title}" updated successfully`),await m?.(),o(`/apps/${t.name}`)}catch(e){p.error(e?.message||"Failed to update application")}},[o,m,c,a]),v=r.useCallback(()=>{o(i?`/apps/${i}`:"/")},[o,i]),h=r.useCallback(t=>{try{localStorage.setItem(`objectui-edit-draft-${n}`,JSON.stringify(t)),p.info("Draft saved")}catch{}},[n]);return a?s.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4","data-testid":"edit-app-page",children:s.jsx(A,{availableObjects:g,initialDraft:x,onComplete:b,onCancel:v,onSaveDraft:h})}):s.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4 text-center","data-testid":"edit-app-not-found",children:s.jsxs("p",{className:"text-muted-foreground",children:['Application "',n,'" not found.']})})}export{K as EditAppPage};
1
+ import{h as C,i as N,r,j as s}from"./vendor-react-9M-xu2bR.js";import{AppCreationWizard as A}from"./index-D5i0wk-G.js";import{z as j}from"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as S,a as w}from"./index-fjkakZm9.js";import{b as p}from"./vendor-ui-utils-3tkeUVaX.js";import"./vendor-icons-ndICq8DC.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-zod-C5j6C2CQ.js";import"./ui-components-BE4yvyhE.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function K(){const o=C(),{appName:i,editAppName:d}=N(),{apps:u,objects:f,refresh:m}=S(),c=w(),n=d||i,a=u.find(t=>t.name===n),g=(f||[]).map(t=>({name:t.name,label:t.label||t.name,icon:t.icon,selected:a?.navigation?.some(e=>e.type==="object"&&e.objectName===t.name)??!1})),x=r.useMemo(()=>{if(a)return{name:a.name,title:a.title||a.label||"",description:a.description||"",icon:a.icon||"",layout:a.layout||"sidebar",navigation:a.navigation||[],branding:{logo:a.branding?.logo||a.logo||"",primaryColor:a.branding?.primaryColor||"#3b82f6",favicon:a.branding?.favicon||a.favicon||""}}},[a]),b=r.useCallback(async t=>{try{const e=j(t),y={...a,...e},l=c?.getClient();l&&await l.meta.saveItem("app",t.name,y),p.success(`Application "${t.title}" updated successfully`),await m?.(),o(`/apps/${t.name}`)}catch(e){p.error(e?.message||"Failed to update application")}},[o,m,c,a]),v=r.useCallback(()=>{o(i?`/apps/${i}`:"/")},[o,i]),h=r.useCallback(t=>{try{localStorage.setItem(`objectui-edit-draft-${n}`,JSON.stringify(t)),p.info("Draft saved")}catch{}},[n]);return a?s.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4","data-testid":"edit-app-page",children:s.jsx(A,{availableObjects:g,initialDraft:x,onComplete:b,onCancel:v,onSaveDraft:h})}):s.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4 text-center","data-testid":"edit-app-not-found",children:s.jsxs("p",{className:"text-muted-foreground",children:['Application "',n,'" not found.']})})}export{K as EditAppPage};
@@ -1 +1 @@
1
- import{j as t,L as a}from"./vendor-react-9M-xu2bR.js";import{u as e,F as i}from"./infrastructure-n1j_TN6w.js";import{A as n}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:o,className:s,children:r})=>t.jsx(a,{to:o,className:s,children:r});function d(){const{t:o}=e();return t.jsx(n,{children:t.jsx(i,{loginUrl:"/login",title:o("auth.forgotPassword.title"),description:o("auth.forgotPassword.description"),linkComponent:u,labels:{emailLabel:o("auth.forgotPassword.emailLabel"),emailPlaceholder:o("auth.forgotPassword.emailPlaceholder"),submitButton:o("auth.forgotPassword.submitButton"),submittingButton:o("auth.forgotPassword.submittingButton"),successTitle:o("auth.forgotPassword.successTitle"),successDescription:o("auth.forgotPassword.successDescription"),backToSignInText:o("auth.forgotPassword.backToSignInText"),rememberPasswordText:o("auth.forgotPassword.rememberPasswordText"),signInText:o("auth.forgotPassword.signInText")}})})}export{d as ForgotPasswordPage};
1
+ import{j as t,L as a}from"./vendor-react-9M-xu2bR.js";import{u as e,F as i}from"./infrastructure-Dn7jNPwf.js";import{A as n}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:o,className:s,children:r})=>t.jsx(a,{to:o,className:s,children:r});function d(){const{t:o}=e();return t.jsx(n,{children:t.jsx(i,{loginUrl:"/login",title:o("auth.forgotPassword.title"),description:o("auth.forgotPassword.description"),linkComponent:u,labels:{emailLabel:o("auth.forgotPassword.emailLabel"),emailPlaceholder:o("auth.forgotPassword.emailPlaceholder"),submitButton:o("auth.forgotPassword.submitButton"),submittingButton:o("auth.forgotPassword.submittingButton"),successTitle:o("auth.forgotPassword.successTitle"),successDescription:o("auth.forgotPassword.successDescription"),backToSignInText:o("auth.forgotPassword.backToSignInText"),rememberPasswordText:o("auth.forgotPassword.rememberPasswordText"),signInText:o("auth.forgotPassword.signInText")}})})}export{d as ForgotPasswordPage};
@@ -1 +1 @@
1
- import{r as f,j as e}from"./vendor-react-9M-xu2bR.js";import{u as H}from"./plugins-core-qwgXbAqa.js";import{u as G,a as M,P as U,D as Y,e as _,f as J,b as Q,d as V,S as W,v as X,C as Z}from"./vendor-dndkit-CX1oDZqy.js";import{B as L,G as R,C as ee,s as se,u as te,t as re,v as ae,aa as ne}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a as ie,C as oe,T as le,m as de}from"./vendor-icons-ndICq8DC.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-i18n-E3-WitRV.js";import"./plugins-views-CveFN6PV.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";const z=(...s)=>s.filter(Boolean).join(" ");function ce(s,l){if(!l||l.length===0)return{};for(const t of l){const i=s[t.field];if(i==null)continue;let n=!1;const a=String(i);switch(t.operator){case"equals":n=a===String(t.value);break;case"not_equals":n=a!==String(t.value);break;case"contains":n=a.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":n=Array.isArray(t.value)&&t.value.includes(a);break}if(n)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function A({card:s,conditionalFormatting:l}){const{attributes:t,listeners:i,setNodeRef:n,transform:a,transition:p,isDragging:d}=V({id:s.id}),h={transform:Z.Transform.toString(a),transition:p,opacity:d?.5:void 0},o=ce(s,l);return e.jsx("div",{ref:n,style:h,...t,...i,children:e.jsxs(ee,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",style:o,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(se,{className:"p-4",children:[e.jsx(te,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(re,{className:"text-xs text-muted-foreground font-mono",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ae,{className:"p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((g,v)=>e.jsx(R,{variant:g.variant||"default",className:"text-xs",children:g.label},v))})})]})})}function ue({cards:s,parentRef:l,conditionalFormatting:t}){const i=H({count:s.length,getScrollElement:()=>l.current,estimateSize:()=>120,overscan:5});return e.jsx("div",{style:{height:`${i.getTotalSize()}px`,width:"100%",position:"relative"},children:i.getVirtualItems().map(n=>{const a=s[n.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:e.jsx(A,{card:a,conditionalFormatting:t})},a.id)})})}function me({columnId:s,onAdd:l}){const[t,i]=f.useState(!1),[n,a]=f.useState(""),p=f.useRef(null),d=()=>{const o=n.trim();o&&(l(s,o),a("")),i(!1)},h=o=>{o.key==="Enter"?(o.preventDefault(),d()):o.key==="Escape"&&(a(""),i(!1))};return t?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(ne,{ref:p,value:n,onChange:o=>a(o.target.value),onKeyDown:h,onBlur:d,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{i(!0),setTimeout(()=>p.current?.focus(),0)},children:[e.jsx(de,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function fe({column:s,cards:l,onToggle:t,enableVirtual:i,quickAdd:n,onQuickAdd:a,conditionalFormatting:p}){const d=l||[],h=f.useRef(null),{setNodeRef:o}=V({id:s.id,data:{type:"column"}}),g=s.limit&&d.length>=s.limit,v=s.limit&&d.length>=s.limit*.8;return e.jsxs("div",{ref:o,className:z("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",s.collapsed?"w-16":"w-80",s.className),children:[e.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(L,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!s.collapsed),children:s.collapsed?e.jsx(ie,{className:"h-4 w-4"}):e.jsx(oe,{className:"h-4 w-4"})}),!s.collapsed&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:z("font-mono text-xs",g?"text-destructive":v?"text-yellow-500":"text-muted-foreground"),children:[d.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx(R,{variant:"destructive",className:"text-xs",children:"Full"}),v&&!g&&e.jsx(le,{className:"h-3 w-3 text-yellow-500"})]})]})]}),s.collapsed&&e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:s.title}),e.jsx(R,{variant:"secondary",className:"text-xs",children:d.length})]})]}),!s.collapsed&&e.jsxs("div",{ref:h,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[e.jsx(W,{items:d.map(m=>m.id),strategy:X,children:i?e.jsx(ue,{cards:d,parentRef:h,conditionalFormatting:p}):e.jsx("div",{className:"space-y-2",children:d.map(m=>e.jsx(A,{card:m,conditionalFormatting:p},m.id))})}),n&&a&&e.jsx(me,{columnId:s.id,onAdd:a})]})]})}function Ie({columns:s,onCardMove:l,onColumnToggle:t,enableVirtualScrolling:i=!1,virtualScrollThreshold:n=50,className:a,quickAdd:p,onQuickAdd:d,conditionalFormatting:h}){const[o,g]=f.useState(null),v=f.useMemo(()=>(s||[]).map(r=>({...r,cards:r.cards||[]})),[s]),[m,I]=f.useState(v);f.useEffect(()=>{I(v)},[v]);const K=G(M(U,{activationConstraint:{distance:8}})),O=r=>{const{active:c}=r,u=$(c.id);g(u)},P=r=>{const{active:c,over:u}=r;if(g(null),!u)return;const x=c.id,w=u.id;if(x===w)return;const b=B(x),y=B(w)||q(w);if(!(!b||!y))if(b.id===y.id){const j=[...b.cards],N=j.findIndex(C=>C.id===x),E=j.findIndex(C=>C.id===w),T=Q(j,N,E);I(C=>C.map(S=>S.id===b.id?{...S,cards:T}:S))}else{const j=[...b.cards],N=[...y.cards],E=j.findIndex(k=>k.id===x),C=w===y.id?N.length:N.findIndex(k=>k.id===w),[S]=j.splice(E,1);N.splice(C,0,S),I(k=>k.map(D=>D.id===b.id?{...D,cards:j}:D.id===y.id?{...D,cards:N}:D)),l&&l(x,b.id,y.id,C)}},$=f.useCallback(r=>{for(const c of m){const u=c.cards.find(x=>x.id===r);if(u)return u}return null},[m]),B=f.useCallback(r=>m.find(c=>c.cards.some(u=>u.id===r))||null,[m]),q=f.useCallback(r=>m.find(c=>c.id===r)||null,[m]),F=f.useCallback((r,c)=>{I(u=>u.map(x=>x.id===r?{...x,collapsed:c}:x)),t?.(r,c)},[t]);return e.jsxs(Y,{sensors:K,collisionDetection:_,onDragStart:O,onDragEnd:P,children:[e.jsx("div",{className:z("flex gap-4 overflow-x-auto p-4",a),children:m.map(r=>{const c=i&&r.cards.length>n;return e.jsx(fe,{column:r,cards:r.cards,onToggle:u=>F(r.id,u),enableVirtual:c,quickAdd:p,onQuickAdd:d,conditionalFormatting:h},r.id)})}),e.jsx(J,{children:o?e.jsx(A,{card:o,conditionalFormatting:h}):null})]})}export{Ie as KanbanEnhanced,Ie as default};
1
+ import{r as f,j as e}from"./vendor-react-9M-xu2bR.js";import{u as H}from"./plugins-core-CP8uPw4p.js";import{u as G,a as M,P as U,D as Y,e as _,f as J,b as Q,d as V,S as W,v as X,C as Z}from"./vendor-dndkit-CX1oDZqy.js";import{B as L,G as R,C as ee,s as se,u as te,t as re,v as ae,ab as ne}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a as ie,C as oe,T as le,m as de}from"./vendor-icons-ndICq8DC.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-i18n-E3-WitRV.js";import"./plugins-views-DZCu8Ex3.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-zod-C5j6C2CQ.js";const z=(...s)=>s.filter(Boolean).join(" ");function ce(s,l){if(!l||l.length===0)return{};for(const t of l){const i=s[t.field];if(i==null)continue;let n=!1;const a=String(i);switch(t.operator){case"equals":n=a===String(t.value);break;case"not_equals":n=a!==String(t.value);break;case"contains":n=a.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":n=Array.isArray(t.value)&&t.value.includes(a);break}if(n)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function A({card:s,conditionalFormatting:l}){const{attributes:t,listeners:i,setNodeRef:n,transform:a,transition:p,isDragging:d}=V({id:s.id}),h={transform:Z.Transform.toString(a),transition:p,opacity:d?.5:void 0},o=ce(s,l);return e.jsx("div",{ref:n,style:h,...t,...i,children:e.jsxs(ee,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",style:o,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(se,{className:"p-4",children:[e.jsx(te,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(re,{className:"text-xs text-muted-foreground font-mono",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ae,{className:"p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((g,v)=>e.jsx(R,{variant:g.variant||"default",className:"text-xs",children:g.label},v))})})]})})}function ue({cards:s,parentRef:l,conditionalFormatting:t}){const i=H({count:s.length,getScrollElement:()=>l.current,estimateSize:()=>120,overscan:5});return e.jsx("div",{style:{height:`${i.getTotalSize()}px`,width:"100%",position:"relative"},children:i.getVirtualItems().map(n=>{const a=s[n.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:e.jsx(A,{card:a,conditionalFormatting:t})},a.id)})})}function me({columnId:s,onAdd:l}){const[t,i]=f.useState(!1),[n,a]=f.useState(""),p=f.useRef(null),d=()=>{const o=n.trim();o&&(l(s,o),a("")),i(!1)},h=o=>{o.key==="Enter"?(o.preventDefault(),d()):o.key==="Escape"&&(a(""),i(!1))};return t?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(ne,{ref:p,value:n,onChange:o=>a(o.target.value),onKeyDown:h,onBlur:d,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{i(!0),setTimeout(()=>p.current?.focus(),0)},children:[e.jsx(de,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function fe({column:s,cards:l,onToggle:t,enableVirtual:i,quickAdd:n,onQuickAdd:a,conditionalFormatting:p}){const d=l||[],h=f.useRef(null),{setNodeRef:o}=V({id:s.id,data:{type:"column"}}),g=s.limit&&d.length>=s.limit,v=s.limit&&d.length>=s.limit*.8;return e.jsxs("div",{ref:o,className:z("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",s.collapsed?"w-16":"w-80",s.className),children:[e.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(L,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!s.collapsed),children:s.collapsed?e.jsx(ie,{className:"h-4 w-4"}):e.jsx(oe,{className:"h-4 w-4"})}),!s.collapsed&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:z("font-mono text-xs",g?"text-destructive":v?"text-yellow-500":"text-muted-foreground"),children:[d.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx(R,{variant:"destructive",className:"text-xs",children:"Full"}),v&&!g&&e.jsx(le,{className:"h-3 w-3 text-yellow-500"})]})]})]}),s.collapsed&&e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:s.title}),e.jsx(R,{variant:"secondary",className:"text-xs",children:d.length})]})]}),!s.collapsed&&e.jsxs("div",{ref:h,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[e.jsx(W,{items:d.map(m=>m.id),strategy:X,children:i?e.jsx(ue,{cards:d,parentRef:h,conditionalFormatting:p}):e.jsx("div",{className:"space-y-2",children:d.map(m=>e.jsx(A,{card:m,conditionalFormatting:p},m.id))})}),n&&a&&e.jsx(me,{columnId:s.id,onAdd:a})]})]})}function Ie({columns:s,onCardMove:l,onColumnToggle:t,enableVirtualScrolling:i=!1,virtualScrollThreshold:n=50,className:a,quickAdd:p,onQuickAdd:d,conditionalFormatting:h}){const[o,g]=f.useState(null),v=f.useMemo(()=>(s||[]).map(r=>({...r,cards:r.cards||[]})),[s]),[m,I]=f.useState(v);f.useEffect(()=>{I(v)},[v]);const K=G(M(U,{activationConstraint:{distance:8}})),O=r=>{const{active:c}=r,u=$(c.id);g(u)},P=r=>{const{active:c,over:u}=r;if(g(null),!u)return;const x=c.id,w=u.id;if(x===w)return;const b=B(x),y=B(w)||q(w);if(!(!b||!y))if(b.id===y.id){const j=[...b.cards],N=j.findIndex(C=>C.id===x),E=j.findIndex(C=>C.id===w),T=Q(j,N,E);I(C=>C.map(S=>S.id===b.id?{...S,cards:T}:S))}else{const j=[...b.cards],N=[...y.cards],E=j.findIndex(k=>k.id===x),C=w===y.id?N.length:N.findIndex(k=>k.id===w),[S]=j.splice(E,1);N.splice(C,0,S),I(k=>k.map(D=>D.id===b.id?{...D,cards:j}:D.id===y.id?{...D,cards:N}:D)),l&&l(x,b.id,y.id,C)}},$=f.useCallback(r=>{for(const c of m){const u=c.cards.find(x=>x.id===r);if(u)return u}return null},[m]),B=f.useCallback(r=>m.find(c=>c.cards.some(u=>u.id===r))||null,[m]),q=f.useCallback(r=>m.find(c=>c.id===r)||null,[m]),F=f.useCallback((r,c)=>{I(u=>u.map(x=>x.id===r?{...x,collapsed:c}:x)),t?.(r,c)},[t]);return e.jsxs(Y,{sensors:K,collisionDetection:_,onDragStart:O,onDragEnd:P,children:[e.jsx("div",{className:z("flex gap-4 overflow-x-auto p-4",a),children:m.map(r=>{const c=i&&r.cards.length>n;return e.jsx(fe,{column:r,cards:r.cards,onToggle:u=>F(r.id,u),enableVirtual:c,quickAdd:p,onQuickAdd:d,conditionalFormatting:h},r.id)})}),e.jsx(J,{children:o?e.jsx(A,{card:o,conditionalFormatting:h}):null})]})}export{Ie as KanbanEnhanced,Ie as default};
@@ -1 +1 @@
1
- import{j as e,r as p}from"./vendor-react-9M-xu2bR.js";import{u as Q,a as V,T as F,P as ee,D as se,e as te,S as _,v as q,f as re,b as ae,d as G,C as ne}from"./vendor-dndkit-CX1oDZqy.js";import{C as oe,s as ie,u as le,t as de,v as ce,G as $,bp as ue,B as me,aa as fe}from"./ui-components-BxvihT61.js";import{p as xe,q as pe}from"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{m as ge}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";const E=(...s)=>s.filter(Boolean).join(" "),T="Uncategorized";function he(s,c){if(!c||c.length===0)return{};for(const o of c){const u=s[o.field];if(u==null)continue;let r=!1;const m=String(u);switch(o.operator){case"equals":r=m===String(o.value);break;case"not_equals":r=m!==String(o.value);break;case"contains":r=m.toLowerCase().includes(String(o.value).toLowerCase());break;case"in":r=Array.isArray(o.value)&&o.value.includes(m);break}if(r)return{...o.backgroundColor?{backgroundColor:o.backgroundColor}:{},...o.borderColor?{borderColor:o.borderColor}:{}}}return{}}function O({card:s,onCardClick:c,conditionalFormatting:o}){const{attributes:u,listeners:r,setNodeRef:m,transform:f,transition:v,isDragging:g}=G({id:s.id}),n={transform:ne.Transform.toString(f),transition:v,opacity:g?.5:void 0},b=he(s,o);return e.jsx("div",{ref:m,style:n,...u,...r,role:"listitem","aria-label":s.title,onClick:()=>c?.(s),children:e.jsxs(oe,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:b,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(ie,{className:"p-2 sm:p-4",children:[e.jsx(le,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(de,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ce,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((w,C)=>e.jsx($,{variant:w.variant||"default",className:"text-xs",children:w.label},C))})})]})})}function ve({columnId:s,onAdd:c}){const[o,u]=p.useState(!1),[r,m]=p.useState(""),f=p.useRef(null),v=()=>{const n=r.trim();n&&(c(s,n),m("")),u(!1)},g=n=>{n.key==="Enter"?(n.preventDefault(),v()):n.key==="Escape"&&(m(""),u(!1))};return o?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(fe,{ref:f,value:r,onChange:n=>m(n.target.value),onKeyDown:g,onBlur:v,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(me,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{u(!0),setTimeout(()=>f.current?.focus(),0)},children:[e.jsx(ge,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function be({column:s,cards:c,onCardClick:o,quickAdd:u,onQuickAdd:r,conditionalFormatting:m}){const f=c||[],{setNodeRef:v}=G({id:s.id,data:{type:"column"}}),g=s.limit&&f.length>=s.limit;return e.jsxs("div",{ref:v,role:"group","aria-label":s.title,className:E("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[f.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx($,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsxs(ue,{className:"flex-1 p-4",children:[e.jsx(_,{items:f.map(n=>n.id),strategy:q,children:e.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:[f.length===0&&e.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:e.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),f.map(n=>e.jsx(O,{card:n,onCardClick:o,conditionalFormatting:m},n.id))]})}),u&&r&&e.jsx(ve,{columnId:s.id,onAdd:r})]})]})}function je({children:s}){const c=pe();return e.jsx(e.Fragment,{children:s(c)})}function Le({columns:s,onCardMove:c,onCardClick:o,className:u,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:v,swimlaneField:g}){return xe()?e.jsx(je,{children:b=>e.jsx(z,{columns:s,onCardMove:c,onCardClick:o,className:u,dnd:b,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:v,swimlaneField:g})}):e.jsx(z,{columns:s,onCardMove:c,onCardClick:o,className:u,dnd:null,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:v,swimlaneField:g})}function z({columns:s,onCardMove:c,onCardClick:o,className:u,dnd:r,quickAdd:m,onQuickAdd:f,coverImageField:v,conditionalFormatting:g,swimlaneField:n}){const[b,w]=p.useState(null),C=n?`objectui:kanban-collapsed:${n}`:null,[H,J]=p.useState(()=>{if(!C)return new Set;try{const t=localStorage.getItem(C);if(t){const i=JSON.parse(t);if(Array.isArray(i))return new Set(i.filter(a=>typeof a=="string"))}}catch{}return new Set}),A=p.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[x,B]=p.useState(A);p.useEffect(()=>{B(A)},[A]);const R=p.useMemo(()=>{if(!n)return null;const t=x.flatMap(a=>a.cards),i=new Set;return t.forEach(a=>{const l=a[n];i.add(l!=null?String(l):T)}),Array.from(i).sort()},[x,n]),M=p.useCallback(t=>{J(i=>{const a=new Set(i);if(a.has(t)?a.delete(t):a.add(t),C)try{localStorage.setItem(C,JSON.stringify([...a]))}catch{}return a})},[C]),U=Q(V(ee,{activationConstraint:{distance:5}}),V(F,{activationConstraint:{delay:200,tolerance:5}})),Z=t=>{const{active:i}=t,a=X(i.id);if(w(a),r&&a){const l=K(a.id);l&&r.startDrag({id:a.id,type:"kanban-card",data:a,sourceId:l.id})}},W=t=>{const{active:i,over:a}=t;if(w(null),!a){r&&r.endDrag();return}const l=i.id,h=a.id;if(l===h){r&&r.endDrag();return}const d=K(l),y=K(h)||Y(h);if(!d||!y){r&&r.endDrag();return}if(d.id===y.id){const N=[...d.cards],S=N.findIndex(j=>j.id===l),L=N.findIndex(j=>j.id===h),P=ae(N,S,L);B(j=>j.map(D=>D.id===d.id?{...D,cards:P}:D))}else{const N=[...d.cards],S=[...y.cards],L=N.findIndex(k=>k.id===l),j=h===y.id?S.length:S.findIndex(k=>k.id===h),[D]=N.splice(L,1);S.splice(j,0,D),B(k=>k.map(I=>I.id===d.id?{...I,cards:N}:I.id===y.id?{...I,cards:S}:I)),c&&c(l,d.id,y.id,j)}r&&r.endDrag(y.id)},X=p.useCallback(t=>{for(const i of x){const a=i.cards.find(l=>l.id===t);if(a)return a}return null},[x]),K=p.useCallback(t=>x.find(i=>i.cards.some(a=>a.id===t))||null,[x]),Y=p.useCallback(t=>x.find(i=>i.id===t)||null,[x]);return e.jsxs(se,{sensors:U,collisionDetection:te,onDragStart:Z,onDragEnd:W,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[x.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),R?e.jsxs("div",{className:E("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",u),role:"region","aria-label":"Kanban board with swimlanes",children:[e.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:x.map(t=>e.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[e.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:t.title}),e.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",t.cards.length,")"]})]},t.id))}),R.map(t=>{const i=H.has(t),a=x.reduce((l,h)=>l+h.cards.filter(d=>(d[n]!=null?String(d[n]):T)===t).length,0);return e.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>M(t),"aria-expanded":!i,children:[e.jsx("span",{className:E("transition-transform text-xs",i?"":"rotate-90"),children:"▶"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:t}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",a,")"]})]}),!i&&e.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:x.map(l=>{const h=l.cards.filter(d=>(d[n]!=null?String(d[n]):T)===t);return e.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:e.jsx(_,{items:h.map(d=>d.id),strategy:q,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${l.title} - ${t} cards`,children:h.map(d=>e.jsx(O,{card:d,onCardClick:o,conditionalFormatting:g},d.id))})})},l.id)})})]},t)})]}):e.jsx("div",{className:E("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",u),role:"region","aria-label":"Kanban board",children:x.map(t=>e.jsx(be,{column:t,cards:t.cards,onCardClick:o,quickAdd:m,onQuickAdd:f,conditionalFormatting:g},t.id))}),e.jsx(re,{children:e.jsx("div",{"aria-live":"assertive","aria-label":b?`Dragging ${b.title}`:void 0,children:b?e.jsx(O,{card:b,conditionalFormatting:g}):null})})]})}export{Le as default};
1
+ import{j as e,r as p}from"./vendor-react-9M-xu2bR.js";import{u as Q,a as V,T as F,P as ee,D as se,e as te,S as _,v as q,f as re,b as ae,d as G,C as ne}from"./vendor-dndkit-CX1oDZqy.js";import{C as oe,s as ie,u as le,t as de,v as ce,G as $,bp as ue,B as me,ab as fe}from"./ui-components-BE4yvyhE.js";import{p as xe,q as pe}from"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{m as ge}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";const E=(...s)=>s.filter(Boolean).join(" "),T="Uncategorized";function he(s,c){if(!c||c.length===0)return{};for(const o of c){const u=s[o.field];if(u==null)continue;let r=!1;const m=String(u);switch(o.operator){case"equals":r=m===String(o.value);break;case"not_equals":r=m!==String(o.value);break;case"contains":r=m.toLowerCase().includes(String(o.value).toLowerCase());break;case"in":r=Array.isArray(o.value)&&o.value.includes(m);break}if(r)return{...o.backgroundColor?{backgroundColor:o.backgroundColor}:{},...o.borderColor?{borderColor:o.borderColor}:{}}}return{}}function O({card:s,onCardClick:c,conditionalFormatting:o}){const{attributes:u,listeners:r,setNodeRef:m,transform:f,transition:b,isDragging:g}=G({id:s.id}),n={transform:ne.Transform.toString(f),transition:b,opacity:g?.5:void 0},v=he(s,o);return e.jsx("div",{ref:m,style:n,...u,...r,role:"listitem","aria-label":s.title,onClick:()=>c?.(s),children:e.jsxs(oe,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:v,children:[s.coverImage&&e.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:e.jsx("img",{src:s.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),e.jsxs(ie,{className:"p-2 sm:p-4",children:[e.jsx(le,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(de,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ce,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((w,C)=>e.jsx($,{variant:w.variant||"default",className:"text-xs",children:w.label},C))})})]})})}function be({columnId:s,onAdd:c}){const[o,u]=p.useState(!1),[r,m]=p.useState(""),f=p.useRef(null),b=()=>{const n=r.trim();n&&(c(s,n),m("")),u(!1)},g=n=>{n.key==="Enter"?(n.preventDefault(),b()):n.key==="Escape"&&(m(""),u(!1))};return o?e.jsx("div",{className:"mt-2 space-y-2",children:e.jsx(fe,{ref:f,value:r,onChange:n=>m(n.target.value),onKeyDown:g,onBlur:b,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):e.jsxs(me,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{u(!0),setTimeout(()=>f.current?.focus(),0)},children:[e.jsx(ge,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function ve({column:s,cards:c,onCardClick:o,quickAdd:u,onQuickAdd:r,conditionalFormatting:m}){const f=c||[],{setNodeRef:b}=G({id:s.id,data:{type:"column"}}),g=s.limit&&f.length>=s.limit;return e.jsxs("div",{ref:b,role:"group","aria-label":s.title,className:E("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs($,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[f.length,s.limit&&` / ${s.limit}`]}),g&&e.jsx($,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsxs(ue,{className:"flex-1 p-4",children:[e.jsx(_,{items:f.map(n=>n.id),strategy:q,children:e.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:[f.length===0&&e.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:e.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),f.map(n=>e.jsx(O,{card:n,onCardClick:o,conditionalFormatting:m},n.id))]})}),u&&r&&e.jsx(be,{columnId:s.id,onAdd:r})]})]})}function je({children:s}){const c=pe();return e.jsx(e.Fragment,{children:s(c)})}function Le({columns:s,onCardMove:c,onCardClick:o,className:u,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:b,swimlaneField:g}){return xe()?e.jsx(je,{children:v=>e.jsx(z,{columns:s,onCardMove:c,onCardClick:o,className:u,dnd:v,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:b,swimlaneField:g})}):e.jsx(z,{columns:s,onCardMove:c,onCardClick:o,className:u,dnd:null,quickAdd:r,onQuickAdd:m,coverImageField:f,conditionalFormatting:b,swimlaneField:g})}function z({columns:s,onCardMove:c,onCardClick:o,className:u,dnd:r,quickAdd:m,onQuickAdd:f,coverImageField:b,conditionalFormatting:g,swimlaneField:n}){const[v,w]=p.useState(null),C=n?`objectui:kanban-collapsed:${n}`:null,[H,J]=p.useState(()=>{if(!C)return new Set;try{const t=localStorage.getItem(C);if(t){const i=JSON.parse(t);if(Array.isArray(i))return new Set(i.filter(a=>typeof a=="string"))}}catch{}return new Set}),A=p.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[x,B]=p.useState(A);p.useEffect(()=>{B(A)},[A]);const R=p.useMemo(()=>{if(!n)return null;const t=x.flatMap(a=>a.cards),i=new Set;return t.forEach(a=>{const l=a[n];i.add(l!=null?String(l):T)}),Array.from(i).sort()},[x,n]),M=p.useCallback(t=>{J(i=>{const a=new Set(i);if(a.has(t)?a.delete(t):a.add(t),C)try{localStorage.setItem(C,JSON.stringify([...a]))}catch{}return a})},[C]),U=Q(V(ee,{activationConstraint:{distance:5}}),V(F,{activationConstraint:{delay:200,tolerance:5}})),Z=t=>{const{active:i}=t,a=X(i.id);if(w(a),r&&a){const l=K(a.id);l&&r.startDrag({id:a.id,type:"kanban-card",data:a,sourceId:l.id})}},W=t=>{const{active:i,over:a}=t;if(w(null),!a){r&&r.endDrag();return}const l=i.id,h=a.id;if(l===h){r&&r.endDrag();return}const d=K(l),y=K(h)||Y(h);if(!d||!y){r&&r.endDrag();return}if(d.id===y.id){const N=[...d.cards],S=N.findIndex(j=>j.id===l),L=N.findIndex(j=>j.id===h),P=ae(N,S,L);B(j=>j.map(D=>D.id===d.id?{...D,cards:P}:D))}else{const N=[...d.cards],S=[...y.cards],L=N.findIndex(k=>k.id===l),j=h===y.id?S.length:S.findIndex(k=>k.id===h),[D]=N.splice(L,1);S.splice(j,0,D),B(k=>k.map(I=>I.id===d.id?{...I,cards:N}:I.id===y.id?{...I,cards:S}:I)),c&&c(l,d.id,y.id,j)}r&&r.endDrag(y.id)},X=p.useCallback(t=>{for(const i of x){const a=i.cards.find(l=>l.id===t);if(a)return a}return null},[x]),K=p.useCallback(t=>x.find(i=>i.cards.some(a=>a.id===t))||null,[x]),Y=p.useCallback(t=>x.find(i=>i.id===t)||null,[x]);return e.jsxs(se,{sensors:U,collisionDetection:te,onDragStart:Z,onDragEnd:W,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[x.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),R?e.jsxs("div",{className:E("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",u),role:"region","aria-label":"Kanban board with swimlanes",children:[e.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:x.map(t=>e.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[e.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:t.title}),e.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",t.cards.length,")"]})]},t.id))}),R.map(t=>{const i=H.has(t),a=x.reduce((l,h)=>l+h.cards.filter(d=>(d[n]!=null?String(d[n]):T)===t).length,0);return e.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>M(t),"aria-expanded":!i,children:[e.jsx("span",{className:E("transition-transform text-xs",i?"":"rotate-90"),children:"▶"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:t}),e.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",a,")"]})]}),!i&&e.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:x.map(l=>{const h=l.cards.filter(d=>(d[n]!=null?String(d[n]):T)===t);return e.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:e.jsx(_,{items:h.map(d=>d.id),strategy:q,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${l.title} - ${t} cards`,children:h.map(d=>e.jsx(O,{card:d,onCardClick:o,conditionalFormatting:g},d.id))})})},l.id)})})]},t)})]}):e.jsx("div",{className:E("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",u),role:"region","aria-label":"Kanban board",children:x.map(t=>e.jsx(ve,{column:t,cards:t.cards,onCardClick:o,quickAdd:m,onQuickAdd:f,conditionalFormatting:g},t.id))}),e.jsx(re,{children:e.jsx("div",{"aria-live":"assertive","aria-label":v?`Dragging ${v.title}`:void 0,children:v?e.jsx(O,{card:v,conditionalFormatting:g}):null})})]})}export{Le as default};
@@ -1 +1 @@
1
- import{h as s,j as a,L as e}from"./vendor-react-9M-xu2bR.js";import{u as n,L as r}from"./infrastructure-n1j_TN6w.js";import{A as l}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:o,className:t,children:i})=>a.jsx(e,{to:o,className:t,children:i});function p(){const o=s(),{t}=n();return a.jsx(l,{children:a.jsx(r,{onSuccess:()=>o("/"),registerUrl:"/register",forgotPasswordUrl:"/forgot-password",title:t("auth.login.title"),description:t("auth.login.description"),linkComponent:u,labels:{emailLabel:t("auth.login.emailLabel"),emailPlaceholder:t("auth.login.emailPlaceholder"),passwordLabel:t("auth.login.passwordLabel"),passwordPlaceholder:t("auth.login.passwordPlaceholder"),forgotPasswordText:t("auth.login.forgotPasswordText"),submitButton:t("auth.login.submitButton"),submittingButton:t("auth.login.submittingButton"),noAccountText:t("auth.login.noAccountText"),signUpText:t("auth.login.signUpText")}})})}export{p as LoginPage};
1
+ import{h as s,j as a,L as e}from"./vendor-react-9M-xu2bR.js";import{u as n,L as r}from"./infrastructure-Dn7jNPwf.js";import{A as l}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:o,className:t,children:i})=>a.jsx(e,{to:o,className:t,children:i});function p(){const o=s(),{t}=n();return a.jsx(l,{children:a.jsx(r,{onSuccess:()=>o("/"),registerUrl:"/register",forgotPasswordUrl:"/forgot-password",title:t("auth.login.title"),description:t("auth.login.description"),linkComponent:u,labels:{emailLabel:t("auth.login.emailLabel"),emailPlaceholder:t("auth.login.emailPlaceholder"),passwordLabel:t("auth.login.passwordLabel"),passwordPlaceholder:t("auth.login.passwordPlaceholder"),forgotPasswordText:t("auth.login.forgotPasswordText"),submitButton:t("auth.login.submitButton"),submittingButton:t("auth.login.submittingButton"),noAccountText:t("auth.login.noAccountText"),signUpText:t("auth.login.signUpText")}})})}export{p as LoginPage};
@@ -1 +1 @@
1
- import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-n1j_TN6w.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as i}from"./vendor-ui-utils-3tkeUVaX.js";import{a as z}from"./index-CTBPkbPG.js";import{s as C}from"./systemObjects-DSpePIIy.js";import{b8 as h,m as k,L as O,l as S}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const p=C.find(l=>l.name==="sys_org"),c=p.views[0].columns;function Q(){const{user:l}=w(),n=l?.role==="admin",t=z(),[m,u]=r.useState([]),[g,d]=r.useState(!0),a=r.useCallback(async()=>{if(t){d(!0);try{const s=await t.find("sys_org");u(s.data||[])}catch{i.error("Failed to load organizations")}finally{d(!1)}}},[t]);r.useEffect(()=>{a()},[a]);const f=r.useCallback(async()=>{if(t)try{await t.create("sys_org",{name:"New Organization",slug:"",plan:"free",status:"active"}),i.success("Organization created"),a()}catch{i.error("Failed to create organization")}},[t,a]),j=r.useCallback(async s=>{if(t)try{await t.delete("sys_org",s),i.success("Organization deleted"),a()}catch{i.error("Failed to delete organization")}},[t,a]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Organization Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage organizations and their members"})]})]}),n&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:f,children:[e.jsx(k,{className:"h-4 w-4"}),"Add Organization"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[c.map(s=>{const o=p.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:o?.label??s},s)}),n&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:c.length+(n?1:0),children:e.jsx(O,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):m.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:c.length+(n?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No organizations found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):m.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[c.map(o=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[o]??"")},o)),n&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(s.id||s._id),children:e.jsx(S,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as OrgManagementPage};
1
+ import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-Dn7jNPwf.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as i}from"./vendor-ui-utils-3tkeUVaX.js";import{a as z}from"./index-fjkakZm9.js";import{s as C}from"./systemObjects-DSpePIIy.js";import{b8 as h,m as k,L as O,l as S}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const p=C.find(l=>l.name==="sys_org"),c=p.views[0].columns;function Q(){const{user:l}=w(),n=l?.role==="admin",t=z(),[m,u]=r.useState([]),[g,d]=r.useState(!0),a=r.useCallback(async()=>{if(t){d(!0);try{const s=await t.find("sys_org");u(s.data||[])}catch{i.error("Failed to load organizations")}finally{d(!1)}}},[t]);r.useEffect(()=>{a()},[a]);const f=r.useCallback(async()=>{if(t)try{await t.create("sys_org",{name:"New Organization",slug:"",plan:"free",status:"active"}),i.success("Organization created"),a()}catch{i.error("Failed to create organization")}},[t,a]),j=r.useCallback(async s=>{if(t)try{await t.delete("sys_org",s),i.success("Organization deleted"),a()}catch{i.error("Failed to delete organization")}},[t,a]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Organization Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage organizations and their members"})]})]}),n&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:f,children:[e.jsx(k,{className:"h-4 w-4"}),"Add Organization"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[c.map(s=>{const o=p.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:o?.label??s},s)}),n&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:c.length+(n?1:0),children:e.jsx(O,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):m.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:c.length+(n?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No organizations found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):m.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[c.map(o=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[o]??"")},o)),n&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(s.id||s._id),children:e.jsx(S,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as OrgManagementPage};
@@ -1 +1 @@
1
- import{h as v,i as y,r as s,j as a}from"./vendor-react-9M-xu2bR.js";import{PageCanvasEditor as j}from"./index-Dv78M4Xq.js";import{b as d}from"./vendor-ui-utils-3tkeUVaX.js";import{a as w,b as k}from"./index-CTBPkbPG.js";import{A as E}from"./vendor-icons-ndICq8DC.js";import"./framework-BM176iet.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BxvihT61.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function q(){const f=v(),{pageName:t}=y(),i=w(),{pages:g}=k(),r=g?.find(e=>e.name===t),[l,h]=s.useState(()=>r||{type:"page",name:t??"",title:t??"",children:[]}),u=s.useRef(l);u.current=l;const n=s.useCallback(async e=>{try{if(i)return await i.update("sys_page",t,e),!0}catch{}return!1},[i,t]),m=s.useCallback(async e=>{h(e),await n(e)},[n]);s.useEffect(()=>{const e=o=>{(o.ctrlKey||o.metaKey)&&o.key==="s"&&(o.preventDefault(),n(u.current).then(c=>{c&&d.success("Page saved")}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);const x=s.useCallback(e=>{const o=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),c=URL.createObjectURL(o),p=document.createElement("a");p.href=c,p.download=`${t||"page"}.json`,p.click(),URL.revokeObjectURL(c),d.success("Page schema exported")},[t]),b=s.useCallback(e=>{d.success("Page schema imported"),m(e)},[m]);return r?a.jsxs("div",{className:"h-full flex flex-col","data-testid":"page-design-page",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 sm:px-6",children:[a.jsx("button",{type:"button",onClick:()=>f(-1),className:"rounded p-1.5 text-muted-foreground hover:text-foreground","aria-label":"Go back","data-testid":"page-design-back",children:a.jsx(E,{className:"h-4 w-4"})}),a.jsxs("h1",{className:"text-lg font-semibold tracking-tight truncate",children:["Edit Page: ",r.label||r.title||t]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:a.jsx(j,{schema:l,onChange:m,onExport:x,onImport:b})})]}):a.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Page "',t,'" not found']})}export{q as PageDesignPage};
1
+ import{h as v,i as y,r as s,j as a}from"./vendor-react-9M-xu2bR.js";import{PageCanvasEditor as j}from"./index-D5i0wk-G.js";import{b as d}from"./vendor-ui-utils-3tkeUVaX.js";import{a as w,b as k}from"./index-fjkakZm9.js";import{A as E}from"./vendor-icons-ndICq8DC.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-zod-C5j6C2CQ.js";import"./ui-components-BE4yvyhE.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function q(){const f=v(),{pageName:t}=y(),i=w(),{pages:g}=k(),r=g?.find(e=>e.name===t),[l,h]=s.useState(()=>r||{type:"page",name:t??"",title:t??"",children:[]}),u=s.useRef(l);u.current=l;const n=s.useCallback(async e=>{try{if(i)return await i.update("sys_page",t,e),!0}catch{}return!1},[i,t]),m=s.useCallback(async e=>{h(e),await n(e)},[n]);s.useEffect(()=>{const e=o=>{(o.ctrlKey||o.metaKey)&&o.key==="s"&&(o.preventDefault(),n(u.current).then(c=>{c&&d.success("Page saved")}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);const x=s.useCallback(e=>{const o=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),c=URL.createObjectURL(o),p=document.createElement("a");p.href=c,p.download=`${t||"page"}.json`,p.click(),URL.revokeObjectURL(c),d.success("Page schema exported")},[t]),b=s.useCallback(e=>{d.success("Page schema imported"),m(e)},[m]);return r?a.jsxs("div",{className:"h-full flex flex-col","data-testid":"page-design-page",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 sm:px-6",children:[a.jsx("button",{type:"button",onClick:()=>f(-1),className:"rounded p-1.5 text-muted-foreground hover:text-foreground","aria-label":"Go back","data-testid":"page-design-back",children:a.jsx(E,{className:"h-4 w-4"})}),a.jsxs("h1",{className:"text-lg font-semibold tracking-tight truncate",children:["Edit Page: ",r.label||r.title||t]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:a.jsx(j,{schema:l,onChange:m,onExport:x,onImport:b})})]}):a.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Page "',t,'" not found']})}export{q as PageDesignPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D5i0wk-G.js","assets/framework-52FGgFF6.js","assets/vendor-objectstack-CatrkstC.js","assets/vendor-zod-C5j6C2CQ.js","assets/ui-components-BE4yvyhE.js","assets/vendor-react-9M-xu2bR.js","assets/vendor-ui-utils-3tkeUVaX.js","assets/vendor-icons-ndICq8DC.js","assets/vendor-radix-C6qchjxv.js","assets/vendor-i18n-E3-WitRV.js","assets/vendor-charts-BLNOCZWl.js","assets/infrastructure-Dn7jNPwf.js","assets/ui-components-CxztIKgM.css"])))=>i.map(i=>d[i]);
2
+ import{S as w,h as v,i as j,j as b,k as y,b7 as S,b8 as E,b9 as N,_ as k}from"./ui-components-BE4yvyhE.js";import{r,j as e,i as D,k as P}from"./vendor-react-9M-xu2bR.js";import{S as C}from"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as _}from"./vendor-ui-utils-3tkeUVaX.js";import{a as O,u as R,b as T,M as L}from"./index-fjkakZm9.js";import{ak as M,at as $}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function A({open:a,onOpenChange:x,title:o,description:m,schema:i,onSchemaChange:p,collection:s,recordName:l,children:h}){const u=O(),f=r.useRef(i);f.current=i;const c=r.useCallback(async t=>{try{if(u)return await u.update(s,l,t),!0}catch(n){console.warn("[DesignDrawer] Auto-save failed:",n)}return!1},[u,s,l]),d=r.useCallback(async t=>{p(t),await c(t)},[p,c]);return r.useEffect(()=>{if(!a)return;const t=n=>{(n.ctrlKey||n.metaKey)&&n.key==="s"&&(n.preventDefault(),c(f.current).then(g=>{g&&_.success(`${o} saved`)}))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,c,o]),e.jsx(w,{open:a,onOpenChange:x,modal:!1,children:e.jsxs(v,{side:"right",hideOverlay:!0,className:"w-full sm:w-[540px] sm:max-w-[540px] lg:w-[640px] lg:max-w-[640px] p-0 flex flex-col","data-testid":"design-drawer",children:[e.jsxs(j,{className:"px-4 py-3 border-b shrink-0",children:[e.jsx(b,{children:o}),e.jsx(y,{className:m?"":"sr-only",children:m||`Visual editor — configure and preview ${o}`})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:h(i,d)})]})})}const I=r.lazy(()=>k(()=>import("./index-D5i0wk-G.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(a=>({default:a.PageCanvasEditor})));function ae(){const{pageName:a}=D(),[x]=P(),{showDebug:o}=R(),[m,i]=r.useState(!1),{pages:p}=T(),s=p?.find(t=>t.name===a),[l,h]=r.useState(null),u=r.useCallback(()=>{h(s),i(!0)},[s]),f=r.useCallback(t=>{i(t)},[]);if(!s)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(S,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(M,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(E,{children:"Page Not Found"}),e.jsxs(N,{children:['The page "',a,'" could not be found. It may have been removed or renamed.']})]})});const c=Object.fromEntries(x.entries()),d=m&&l?l:s;return e.jsxs("div",{className:"flex flex-row h-full w-full overflow-hidden relative",children:[e.jsxs("div",{className:"flex-1 overflow-auto h-full relative group",children:[e.jsx("div",{className:`absolute top-1.5 sm:top-2 right-1.5 sm:right-2 z-50 flex items-center gap-1.5 transition-opacity ${o?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"page-edit-button",children:[e.jsx($,{className:"h-3.5 w-3.5"}),"Edit"]})}),e.jsx(C,{schema:{...d,type:d.type||"page",context:{...d.context,params:c}}})]}),e.jsx(L,{open:o,sections:[{title:"Page Configuration",data:d}]}),e.jsx(A,{open:m,onOpenChange:f,title:`Edit Page: ${s.label||s.title||a}`,schema:l||s,onSchemaChange:h,collection:"sys_page",recordName:a,children:(t,n)=>e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"p-4 text-muted-foreground",children:"Loading editor…"}),children:e.jsx(I,{schema:t,onChange:n})})})]})}export{ae as PageView};
@@ -1 +1 @@
1
- import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-n1j_TN6w.js";import{B as p,aa as b,G as v}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as n}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-CTBPkbPG.js";import{s as L}from"./systemObjects-DSpePIIy.js";import{ba as P,m as S,S as k,L as A,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const x=L.find(o=>o.name==="sys_permission"),u=x.views[0].columns;function W(){const{user:o}=w(),c=o?.role==="admin",a=C(),[h,f]=r.useState([]),[j,m]=r.useState(!0),[l,g]=r.useState(""),i=r.useCallback(async()=>{if(a){m(!0);try{const s=await a.find("sys_permission");f(s.data||[])}catch{n.error("Failed to load permissions")}finally{m(!1)}}},[a]);r.useEffect(()=>{i()},[i]);const y=r.useCallback(async()=>{if(a)try{await a.create("sys_permission",{name:"New Permission",description:"",resource:"",action:"read"}),n.success("Permission created"),i()}catch{n.error("Failed to create permission")}},[a,i]),N=r.useCallback(async s=>{if(a)try{await a.delete("sys_permission",s),n.success("Permission deleted"),i()}catch{n.error("Failed to delete permission")}},[a,i]),d=h.filter(s=>{if(!l)return!0;const t=l.toLowerCase();return(s.name||"").toLowerCase().includes(t)||(s.resource||"").toLowerCase().includes(t)||(s.action||"").toLowerCase().includes(t)||(s.description||"").toLowerCase().includes(t)});return e.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[e.jsx(P,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Permissions"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage permission rules and assignments"})]})]}),c&&e.jsxs(p,{onClick:y,"data-testid":"add-permission-btn",children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Add Permission"]})]}),e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(k,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(b,{placeholder:"Search permissions...",value:l,onChange:s=>g(s.target.value),className:"pl-8","data-testid":"permission-search-input"})]}),j?e.jsxs("div",{className:"flex items-center gap-2 py-8 justify-center text-muted-foreground",children:[e.jsx(A,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading permissions..."})]}):d.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No permissions found."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"permissions-table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[u.map(s=>e.jsx("th",{className:"py-2 px-3 font-medium text-muted-foreground capitalize",children:x.fields.find(t=>t.name===s)?.label||s},s)),c&&e.jsx("th",{className:"py-2 px-3 font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:d.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[u.map(t=>e.jsx("td",{className:"py-2 px-3",children:t==="action"?e.jsx(v,{variant:"outline",children:s[t]}):e.jsx("span",{className:"truncate",children:s[t]??"—"})},t)),c&&e.jsx("td",{className:"py-2 px-3",children:e.jsx(p,{variant:"ghost",size:"icon",onClick:()=>N(s.id),children:e.jsx(_,{className:"h-4 w-4"})})})]},s.id))})]})})]})}export{W as PermissionManagementPage};
1
+ import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as b}from"./infrastructure-Dn7jNPwf.js";import{B as p,ab as w,G as v}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as n}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-fjkakZm9.js";import{s as L}from"./systemObjects-DSpePIIy.js";import{ba as P,m as S,S as k,L as A,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const x=L.find(o=>o.name==="sys_permission"),u=x.views[0].columns;function W(){const{user:o}=b(),c=o?.role==="admin",a=C(),[h,f]=r.useState([]),[j,m]=r.useState(!0),[l,g]=r.useState(""),i=r.useCallback(async()=>{if(a){m(!0);try{const s=await a.find("sys_permission");f(s.data||[])}catch{n.error("Failed to load permissions")}finally{m(!1)}}},[a]);r.useEffect(()=>{i()},[i]);const y=r.useCallback(async()=>{if(a)try{await a.create("sys_permission",{name:"New Permission",description:"",resource:"",action:"read"}),n.success("Permission created"),i()}catch{n.error("Failed to create permission")}},[a,i]),N=r.useCallback(async s=>{if(a)try{await a.delete("sys_permission",s),n.success("Permission deleted"),i()}catch{n.error("Failed to delete permission")}},[a,i]),d=h.filter(s=>{if(!l)return!0;const t=l.toLowerCase();return(s.name||"").toLowerCase().includes(t)||(s.resource||"").toLowerCase().includes(t)||(s.action||"").toLowerCase().includes(t)||(s.description||"").toLowerCase().includes(t)});return e.jsxs("div",{className:"flex flex-col gap-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[e.jsx(P,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Permissions"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage permission rules and assignments"})]})]}),c&&e.jsxs(p,{onClick:y,"data-testid":"add-permission-btn",children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Add Permission"]})]}),e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(k,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(w,{placeholder:"Search permissions...",value:l,onChange:s=>g(s.target.value),className:"pl-8","data-testid":"permission-search-input"})]}),j?e.jsxs("div",{className:"flex items-center gap-2 py-8 justify-center text-muted-foreground",children:[e.jsx(A,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading permissions..."})]}):d.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No permissions found."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"permissions-table",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[u.map(s=>e.jsx("th",{className:"py-2 px-3 font-medium text-muted-foreground capitalize",children:x.fields.find(t=>t.name===s)?.label||s},s)),c&&e.jsx("th",{className:"py-2 px-3 font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:d.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[u.map(t=>e.jsx("td",{className:"py-2 px-3",children:t==="action"?e.jsx(v,{variant:"outline",children:s[t]}):e.jsx("span",{className:"truncate",children:s[t]??"—"})},t)),c&&e.jsx("td",{className:"py-2 px-3",children:e.jsx(p,{variant:"ghost",size:"icon",onClick:()=>N(s.id),children:e.jsx(_,{className:"h-4 w-4"})})})]},s.id))})]})})]})}export{W as PermissionManagementPage};
@@ -1 +1 @@
1
- import{r as l,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w,g as C}from"./infrastructure-n1j_TN6w.js";import{C as i,v as u,aR as S,aS as A,aT as E,G as P,s as h,u as p,t as j,bn as g,bo as f,a9 as n,aa as c,B as U}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a8 as k,h as I,g as B,ap as D}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";function O(){const{user:s,updateUser:N,isLoading:a}=w(),[m,v]=l.useState(s?.name??""),[b,d]=l.useState(!1),[o,x]=l.useState(null),y=async t=>{t.preventDefault(),x(null),d(!1);try{await N({name:m}),d(!0)}catch(r){x(r instanceof Error?r.message:String(r))}};return s?e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-2xl",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Profile"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your account settings"})]}),e.jsx(i,{children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{className:"h-16 w-16",children:[e.jsx(A,{src:s.image??void 0,alt:s.name??"User"}),e.jsx(E,{className:"text-lg bg-primary text-primary-foreground",children:C(s)})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-lg font-semibold truncate",children:s.name??"User"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.email}),e.jsx(P,{variant:"secondary",className:"mt-1",children:s.role??"member"})]})]})})}),e.jsxs(i,{children:[e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Personal Information"})]}),e.jsx(j,{children:"Update your name and view account details"})]}),e.jsx(u,{children:e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o&&e.jsxs(g,{variant:"destructive",children:[e.jsx(I,{className:"h-4 w-4"}),e.jsx(f,{children:o})]}),b&&e.jsxs(g,{children:[e.jsx(B,{className:"h-4 w-4 text-green-600"}),e.jsx(f,{className:"text-green-800 dark:text-green-400",children:"Profile updated successfully."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-name",children:"Name"}),e.jsx(c,{id:"profile-name",type:"text",value:m,onChange:t=>v(t.target.value),required:!0,disabled:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-email",children:"Email"}),e.jsx(c,{id:"profile-email",type:"email",value:s.email,disabled:!0,className:"bg-muted text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Email cannot be changed."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{children:"Role"}),e.jsx(c,{type:"text",value:s.role??"member",disabled:!0,className:"bg-muted text-muted-foreground"})]}),e.jsx(U,{type:"submit",disabled:a,className:"w-full sm:w-auto",children:a?"Saving...":"Save Changes"})]})})]}),e.jsx(i,{children:e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Change Password"})]}),e.jsx(j,{children:"To change your password, use the password reset flow from the login page."})]})})]}):null}export{O as ProfilePage};
1
+ import{r as l,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w,g as C}from"./infrastructure-Dn7jNPwf.js";import{C as i,v as u,aR as S,aS as A,aT as E,G as P,s as h,u as p,t as j,bn as g,bo as f,aa as n,ab as c,B as U}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a8 as k,h as I,g as B,ap as D}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-zod-C5j6C2CQ.js";function O(){const{user:s,updateUser:N,isLoading:a}=w(),[m,v]=l.useState(s?.name??""),[b,d]=l.useState(!1),[o,x]=l.useState(null),y=async t=>{t.preventDefault(),x(null),d(!1);try{await N({name:m}),d(!0)}catch(r){x(r instanceof Error?r.message:String(r))}};return s?e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-2xl",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Profile"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your account settings"})]}),e.jsx(i,{children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{className:"h-16 w-16",children:[e.jsx(A,{src:s.image??void 0,alt:s.name??"User"}),e.jsx(E,{className:"text-lg bg-primary text-primary-foreground",children:C(s)})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-lg font-semibold truncate",children:s.name??"User"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.email}),e.jsx(P,{variant:"secondary",className:"mt-1",children:s.role??"member"})]})]})})}),e.jsxs(i,{children:[e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Personal Information"})]}),e.jsx(j,{children:"Update your name and view account details"})]}),e.jsx(u,{children:e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o&&e.jsxs(g,{variant:"destructive",children:[e.jsx(I,{className:"h-4 w-4"}),e.jsx(f,{children:o})]}),b&&e.jsxs(g,{children:[e.jsx(B,{className:"h-4 w-4 text-green-600"}),e.jsx(f,{className:"text-green-800 dark:text-green-400",children:"Profile updated successfully."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-name",children:"Name"}),e.jsx(c,{id:"profile-name",type:"text",value:m,onChange:t=>v(t.target.value),required:!0,disabled:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-email",children:"Email"}),e.jsx(c,{id:"profile-email",type:"email",value:s.email,disabled:!0,className:"bg-muted text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Email cannot be changed."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{children:"Role"}),e.jsx(c,{type:"text",value:s.role??"member",disabled:!0,className:"bg-muted text-muted-foreground"})]}),e.jsx(U,{type:"submit",disabled:a,className:"w-full sm:w-auto",children:a?"Saving...":"Save Changes"})]})})]}),e.jsx(i,{children:e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Change Password"})]}),e.jsx(j,{children:"To change your password, use the password reset flow from the login page."})]})})]}):null}export{O as ProfilePage};
@@ -0,0 +1 @@
1
+ import{j as e,r as c,i as ne,h as ae}from"./vendor-react-9M-xu2bR.js";import{D as re,R as le}from"./plugins-views-DZCu8Ex3.js";import{p as x,be as ie,bf as oe,bg as ce,bh as de,bi as me,bj as ue,bk as fe,bl as he,D as pe,O as xe,l as ge,n as je,o as be,aa as ye,a0 as ve,a1 as we,a2 as Ne,a3 as Ae,a4 as Ce,bm as De,ab as P,U as _e,B as U,b7 as ke,b8 as Ie,b9 as Re}from"./ui-components-BE4yvyhE.js";import{A as $e}from"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{c as Te,u as Ee}from"./infrastructure-Dn7jNPwf.js";import{b as H}from"./vendor-ui-utils-3tkeUVaX.js";import{u as Ve,P as Fe,M as Pe}from"./index-fjkakZm9.js";import{aQ as Ue,b4 as He}from"./vendor-icons-ndICq8DC.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function Oe({fields:r=8,columns:h=2}){return e.jsxs("div",{className:"w-full space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"h-8 w-8 rounded"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{className:"h-6 w-48"}),e.jsx(x,{className:"h-4 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-9 w-20"}),e.jsx(x,{className:"h-9 w-20"})]})]}),e.jsx(x,{className:"h-5 w-24"}),e.jsx("div",{className:`grid grid-cols-1 ${h===2?"md:grid-cols-2":""} gap-4`,children:Array.from({length:r}).map((p,i)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{className:"h-4 w-24"}),e.jsx(x,{className:"h-9 w-full"})]},`field-${i}`))}),e.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[e.jsx(x,{className:"h-5 w-32"}),e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((p,i)=>e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(x,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(x,{className:"h-4 w-40"}),e.jsx(x,{className:"h-3 w-24"})]})]},`related-${i}`))})]})]})}function Se({state:r,onOpenChange:h}){const p=()=>{r.resolve?.(!0),h(!1)},i=()=>{r.resolve?.(!1),h(!1)};return e.jsx(ie,{open:r.open,onOpenChange:g=>{g||i()},children:e.jsxs(oe,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:r.options?.title||"Confirm Action"}),e.jsx(me,{children:r.message})]}),e.jsxs(ue,{children:[e.jsx(fe,{onClick:i,children:r.options?.cancelText||"Cancel"}),e.jsx(he,{onClick:p,children:r.options?.confirmText||"Continue"})]})]})})}function Le({state:r,onOpenChange:h}){const[p,i]=c.useState({}),[g,N]=c.useState({});c.useEffect(()=>{if(r.open){const n={};for(const o of r.params)o.defaultValue!==void 0&&(n[o.name]=o.defaultValue);i(n),N({})}},[r.open,r.params]);const v=n=>n==null?!0:typeof n=="string"?n.trim()==="":Array.isArray(n)?n.length===0:!1,A=()=>{const n={};for(const o of r.params)o.required&&v(p[o.name])&&(n[o.name]=!0);if(Object.keys(n).length>0){N(n);return}r.resolve?.(p),h(!1)},C=()=>{r.resolve?.(null),h(!1)},w=(n,o)=>{i(b=>({...b,[n]:o})),N(b=>({...b,[n]:!1}))};return e.jsx(pe,{open:r.open,onOpenChange:n=>{n||C()},children:e.jsxs(xe,{children:[e.jsxs(ge,{children:[e.jsx(je,{children:"Action Parameters"}),e.jsx(be,{children:"Please provide the required information to continue."})]}),e.jsx("div",{className:"grid gap-4 py-4",children:r.params.map(n=>e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(ye,{htmlFor:n.name,children:[n.label,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),n.type==="select"&&n.options?e.jsxs(ve,{value:p[n.name]??"",onValueChange:o=>w(n.name,o),children:[e.jsx(we,{id:n.name,className:g[n.name]?"border-destructive":"",children:e.jsx(Ne,{placeholder:n.placeholder||`Select ${n.label}`})}),e.jsx(Ae,{children:n.options.map(o=>e.jsx(Ce,{value:o.value,children:o.label},o.value))})]}):n.type==="textarea"?e.jsx(De,{id:n.name,value:p[n.name]??"",onChange:o=>w(n.name,o.target.value),placeholder:n.placeholder,className:g[n.name]?"border-destructive":""}):n.type==="number"?e.jsx(P,{id:n.name,type:"number",value:p[n.name]??"",onChange:o=>w(n.name,o.target.value===""?void 0:o.target.valueAsNumber),placeholder:n.placeholder,className:g[n.name]?"border-destructive":""}):e.jsx(P,{id:n.name,type:["email","url","date","datetime-local","time","password"].includes(n.type)?n.type:"text",value:p[n.name]??"",onChange:o=>w(n.name,o.target.value),placeholder:n.placeholder,className:g[n.name]?"border-destructive":""}),g[n.name]&&e.jsxs("p",{className:"text-xs text-destructive",children:[n.label," is required"]}),n.helpText&&e.jsx("p",{className:"text-xs text-muted-foreground",children:n.helpText})]},n.name))}),e.jsxs(_e,{children:[e.jsx(U,{variant:"outline",onClick:C,children:"Cancel"}),e.jsx(U,{onClick:A,children:"Confirm"})]})]})})}const qe={id:"current-user",name:"Demo User"},Me=["status","stage","priority","category","type","owner","amount"];function ot({dataSource:r,objects:h,onEdit:p}){const{objectName:i,recordId:g}=ne(),{showDebug:N}=Ve(),{user:v}=Te(),A=ae(),{t:C}=Ee(),[w,n]=c.useState(!0),[o,b]=c.useState([]),[I,O]=c.useState([]),[S,L]=c.useState(0),[q,M]=c.useState({}),m=h.find(s=>s.name===i),u=g,[B,R]=c.useState({open:!1,message:""}),[G,$]=c.useState({open:!1,params:[]}),K=c.useCallback((s,t)=>new Promise(a=>{R({open:!0,message:s,options:t,resolve:a})}),[]),z=c.useCallback(s=>new Promise(t=>{$({open:!0,params:s,resolve:t})}),[]),Q=c.useCallback((s,t)=>{t?.type==="error"?H.error(s):H.success(s)},[]),J=c.useCallback((s,t)=>{t?.external||t?.newTab?window.open(s,"_blank","noopener,noreferrer"):A(s)},[A]),W=c.useCallback(async s=>{try{const t=s.target||s.name,a=s.params||{};switch(t){case"opportunity_change_stage":await r.update(i,u,{stage:a.new_stage});break;case"opportunity_mark_won":await r.update(i,u,{stage:"closed_won"});break;case"opportunity_mark_lost":await r.update(i,u,{stage:"closed_lost",loss_reason:a.loss_reason});break;default:Object.keys(a).length>0&&await r.update(i,u,a);break}const l=s.refreshAfter===!0;return l&&L(d=>d+1),{success:!0,reload:l}}catch(t){return{success:!1,error:t.message}}},[r,i,u]),D=c.useMemo(()=>{if(!m||!h)return[];const s=[];for(const t of h)if(t.name!==m.name)for(const[a,l]of Object.entries(t.fields||{}))l&&(l.type==="lookup"||l.type==="master_detail")&&(l.reference_to||l.reference)===m.name&&s.push({childObject:t.name,childLabel:t.label||t.name,referenceField:a});return s},[m,h]);c.useEffect(()=>{if(!r||!u||D.length===0)return;let s=!1;return Promise.all(D.map(({childObject:t,referenceField:a})=>r.find(t,{$filter:{[a]:u}}).then(l=>{const d=Array.isArray(l)?l:l?.data||[];return{childObject:t,items:d}}).catch(l=>(console.warn(`[RecordDetailView] Failed to fetch related ${t}:`,l),{childObject:t,items:[]})))).then(t=>{if(s)return;const a={};for(const{childObject:l,items:d}of t)a[l]=d;M(a)}),()=>{s=!0}},[r,u,D]);const f=v?{id:v.id,name:v.name,avatar:v.image}:qe;c.useEffect(()=>{if(!r||!i||!u)return;const s=`${i}:${u}`;r.find("sys_presence",{$filter:`recordId eq '${u}'`}).then(t=>{t.data?.length&&O(t.data)}).catch(()=>{}),r.find("sys_comment",{$filter:`threadId eq '${s}'`,$orderby:"createdAt asc"}).then(t=>{t.data?.length&&b(t.data.map(a=>({id:a.id,type:"comment",actor:a.author?.name??"Unknown",actorAvatarUrl:a.author?.avatar,body:a.content,createdAt:a.createdAt,updatedAt:a.updatedAt,parentId:a.parentId,reactions:a.reactions?Object.entries(a.reactions).map(([l,d])=>({emoji:l,count:d.length,reacted:d.includes(f.id)})):void 0})))}).catch(()=>{})},[r,i,u,f]);const X=c.useCallback(async s=>{const t={id:crypto.randomUUID(),type:"comment",actor:f.name,actorAvatarUrl:"avatar"in f?f.avatar:void 0,body:s,createdAt:new Date().toISOString()};if(b(a=>[...a,t]),r){const a=`${i}:${u}`;r.create("sys_comment",{id:t.id,threadId:a,author:f,content:s,mentions:[],createdAt:t.createdAt}).catch(()=>{})}},[f,r,i,u]),Y=c.useCallback(async(s,t)=>{const a={id:crypto.randomUUID(),type:"comment",actor:f.name,actorAvatarUrl:"avatar"in f?f.avatar:void 0,body:t,createdAt:new Date().toISOString(),parentId:s};if(b(l=>[...l,a].map(j=>j.id===s?{...j,replyCount:(j.replyCount??0)+1}:j)),r){const l=`${i}:${u}`;r.create("sys_comment",{id:a.id,threadId:l,author:f,content:t,mentions:[],createdAt:a.createdAt,parentId:s}).catch(()=>{})}},[f,r,i,u]),Z=c.useCallback((s,t)=>{b(a=>a.map(l=>{if(l.id!==s)return l;const d=[...l.reactions??[]],j=d.findIndex(y=>y.emoji===t);if(j>=0){const y=d[j];y.reacted?y.count<=1?d.splice(j,1):d[j]={...y,count:y.count-1,reacted:!1}:d[j]={...y,count:y.count+1,reacted:!0}}else d.push({emoji:t,count:1,reacted:!0});const se={...l,reactions:d};return r&&r.update("sys_comment",String(s),{$toggleReaction:{emoji:t,userId:f.id}}).catch(()=>{}),se}))},[f.id,r]);if(c.useEffect(()=>{n(!0),queueMicrotask(()=>n(!1))},[i,g]),w)return e.jsx(Oe,{});if(!m)return e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs(ke,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(Ue,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(Ie,{children:"Object Not Found"}),e.jsxs(Re,{children:['Object "',i,'" definition missing. Check your configuration or navigate back to select a valid object.']})]})});const ee=m.primaryField||Object.keys(m.fields||{}).find(s=>s==="name"||s==="title"),_=m.views?.form?.sections,te=_&&_.length>0?_.map(s=>({title:s.title,collapsible:s.collapsible,defaultCollapsed:s.defaultCollapsed,fields:(s.fields||[]).map(t=>{const a=typeof t=="string"?t:t.name,l=m.fields[a];if(!l)return console.warn(`[RecordDetailView] Field "${a}" not found in ${m.name} definition`),{name:a,label:a};const d=l.reference_to||l.reference;return{name:a,label:l.label||a,type:l.type||"text",...l.options&&{options:l.options},...d&&{reference_to:d},...l.reference_field&&{reference_field:l.reference_field},...l.currency&&{currency:l.currency}}})})):[{title:C("detail.details",{defaultValue:"Details"}),fields:Object.keys(m.fields||{}).map(s=>{const t=m.fields[s],a=t.reference_to||t.reference;return{name:s,label:t.label||s,type:t.type||"text",...t.options&&{options:t.options},...a&&{reference_to:a},...t.reference_field&&{reference_field:t.reference_field},...t.currency&&{currency:t.currency}}})}],T=(()=>{const s=new Set;return(m.actions||[]).filter(t=>t.locations?.includes("record_header")?t.name?s.has(t.name)?!1:(s.add(t.name),!0):!0:!1)})(),E=m.views?.detail?.highlightFields??Object.entries(m.fields||{}).filter(([s])=>Me.includes(s)).map(([s,t])=>({name:s,label:t.label||s,...t.type&&{type:t.type}})),k=m.views?.detail?.sectionGroups??m.views?.form?.sectionGroups,V=D.map(({childObject:s,childLabel:t})=>({title:t,type:"table",api:s,data:q[s]||[]})),F={type:"detail-view",objectName:m.name,resourceId:u,showBack:!0,onBack:"history",showEdit:!0,title:m.label,primaryField:ee,sections:te,autoTabs:!0,autoDiscoverRelated:!0,...V.length>0&&{related:V},...E.length>0&&{highlightFields:E},...k&&k.length>0&&{sectionGroups:k},...T.length>0&&{actions:[{type:"action:bar",location:"record_header",actions:T}]}};return e.jsxs("div",{className:"h-full bg-background overflow-hidden flex flex-col relative",children:[e.jsx("div",{className:"absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2",children:I.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",title:"Users viewing this record",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(Fe,{users:I,size:"sm",maxVisible:4,showStatus:!0})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-row",children:[e.jsxs("div",{className:"flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48",children:[e.jsx($e,{context:{record:{},objectName:i,user:f},onConfirm:K,onToast:Q,onNavigate:J,onParamCollection:z,handlers:{api:W},children:e.jsx(re,{schema:F,dataSource:r,onEdit:()=>{p({_id:u,id:u})}},S)}),e.jsx("div",{className:"mt-6 border-t pt-6",children:e.jsx(le,{config:{position:"bottom",collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},items:o,onAddComment:X,onAddReply:Y,onToggleReaction:Z})})]}),e.jsx(Pe,{open:N,sections:[{title:"View Schema",data:F}]})]}),e.jsx(Se,{state:B,onOpenChange:s=>{s||R(t=>({...t,open:!1}))}}),e.jsx(Le,{state:G,onOpenChange:s=>{s||$(t=>({...t,open:!1}))}})]})}export{ot as RecordDetailView};
@@ -1 +1 @@
1
- import{h as a,j as t,L as o}from"./vendor-react-9M-xu2bR.js";import{u as i,R as n}from"./infrastructure-n1j_TN6w.js";import{A as l}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:r,className:e,children:s})=>t.jsx(o,{to:r,className:e,children:s});function d(){const r=a(),{t:e}=i();return t.jsx(l,{children:t.jsx(n,{onSuccess:()=>r("/"),loginUrl:"/login",title:e("auth.register.title"),description:e("auth.register.description"),linkComponent:u,labels:{nameLabel:e("auth.register.nameLabel"),namePlaceholder:e("auth.register.namePlaceholder"),emailLabel:e("auth.register.emailLabel"),emailPlaceholder:e("auth.register.emailPlaceholder"),passwordLabel:e("auth.register.passwordLabel"),passwordPlaceholder:e("auth.register.passwordPlaceholder"),confirmPasswordLabel:e("auth.register.confirmPasswordLabel"),confirmPasswordPlaceholder:e("auth.register.confirmPasswordPlaceholder"),passwordMismatchError:e("auth.register.passwordMismatchError"),passwordTooShortError:e("auth.register.passwordTooShortError"),submitButton:e("auth.register.submitButton"),submittingButton:e("auth.register.submittingButton"),hasAccountText:e("auth.register.hasAccountText"),signInText:e("auth.register.signInText")}})})}export{d as RegisterPage};
1
+ import{h as a,j as t,L as o}from"./vendor-react-9M-xu2bR.js";import{u as i,R as n}from"./infrastructure-Dn7jNPwf.js";import{A as l}from"./AuthPageLayout-9l5xWV_-.js";import"./vendor-i18n-E3-WitRV.js";const u=({href:r,className:e,children:s})=>t.jsx(o,{to:r,className:e,children:s});function d(){const r=a(),{t:e}=i();return t.jsx(l,{children:t.jsx(n,{onSuccess:()=>r("/"),loginUrl:"/login",title:e("auth.register.title"),description:e("auth.register.description"),linkComponent:u,labels:{nameLabel:e("auth.register.nameLabel"),namePlaceholder:e("auth.register.namePlaceholder"),emailLabel:e("auth.register.emailLabel"),emailPlaceholder:e("auth.register.emailPlaceholder"),passwordLabel:e("auth.register.passwordLabel"),passwordPlaceholder:e("auth.register.passwordPlaceholder"),confirmPasswordLabel:e("auth.register.confirmPasswordLabel"),confirmPasswordPlaceholder:e("auth.register.confirmPasswordPlaceholder"),passwordMismatchError:e("auth.register.passwordMismatchError"),passwordTooShortError:e("auth.register.passwordTooShortError"),submitButton:e("auth.register.submitButton"),submittingButton:e("auth.register.submittingButton"),hasAccountText:e("auth.register.hasAccountText"),signInText:e("auth.register.signInText")}})})}export{d as RegisterPage};
@@ -1 +1 @@
1
- import{i as q,r as o,j as t}from"./vendor-react-9M-xu2bR.js";import{c as z,d as G}from"./plugins-views-CveFN6PV.js";import{b7 as H,b8 as Q,b9 as U}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{u as W,a as X,b as Z,M as ee}from"./index-CTBPkbPG.js";import{L as A,aY as te,at as ae}from"./vendor-icons-ndICq8DC.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const re=[{value:"month",label:"Month",type:"text"},{value:"revenue",label:"Revenue",type:"number"},{value:"count",label:"Count",type:"number"},{value:"region",label:"Region",type:"text"},{value:"product",label:"Product",type:"text"},{value:"source",label:"Lead Source",type:"text"},{value:"stage",label:"Stage",type:"text"},{value:"amount",label:"Amount",type:"number"}];function we({dataSource:f}){const{reportName:h}=q(),{showDebug:R}=W(),b=X(),[j,v]=o.useState(!1),[F,w]=o.useState(0),{reports:D,objects:g,loading:S,refresh:C}=Z(),m=D?.find(r=>r.name===h),[l,M]=o.useState(m),[p,x]=o.useState(null),[k,c]=o.useState([]),[E,y]=o.useState(!1),V=o.useMemo(()=>{const r=p||l,e=r?.objectName||r?.dataSource?.object||r?.dataSource?.resource;if(e&&g?.length){const s=g.find(d=>d.name===e);if(s?.fields){const d=s.fields;return Array.isArray(d)?d.map(n=>typeof n=="string"?{value:n,label:n,type:"text"}:{value:n.name,label:n.label||n.name,type:n.type||"text"}):Object.entries(d).map(([n,i])=>({value:n,label:i.label||n,type:i.type||"text"}))}}return re},[p,l,g]),N=o.useCallback(async r=>{try{b&&(await b.update("sys_report",h,r),C().catch(()=>{}))}catch(e){console.warn("[ReportView] Auto-save failed:",e)}},[b,h,C]),O=o.useCallback(()=>{x(l),v(!0),w(r=>r+1)},[l]),P=o.useCallback(()=>{v(!1)},[]),T=o.useMemo(()=>p||l,[F]),L=o.useCallback(r=>{x(r),N(r),w(e=>e+1)},[N]),$=o.useCallback((r,e)=>{x(s=>({...s,[r]:e}))},[]);o.useEffect(()=>{M(m)},[m]),o.useEffect(()=>{j||x(null)},[m]);const a=p||l,I=o.useMemo(()=>JSON.stringify(a?.filters),[a?.filters]),K=o.useMemo(()=>JSON.stringify(a?.dataSource),[a?.dataSource]),J=o.useMemo(()=>JSON.stringify(a?.data),[a?.data]);if(o.useEffect(()=>{if(!a||!f){c([]);return}if(a.data&&Array.isArray(a.data)){c(a.data);return}if(a.dataSource){(async()=>{y(!0);try{const e=a.dataSource.object||a.dataSource.resource;if(!e){console.warn("ReportView: dataSource missing object/resource property"),c([]);return}const s=await f.find(e,{$filter:a.dataSource.filter,$orderby:a.dataSource.sort,$top:a.dataSource.limit});c(s.data||[])}catch(e){console.error("ReportView: Failed to load data from dataSource",e),c([])}finally{y(!1)}})();return}if(a.objectName){(async()=>{y(!0);try{const e=await f.find(a.objectName,{$filter:a.filters,$orderby:a.sort,$top:a.limit||100});c(e.data||[])}catch(e){console.error("ReportView: Failed to load data from objectName",e),c([])}finally{y(!1)}})();return}c([])},[a?.objectName,a?.limit,I,K,J,f]),S)return t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsx(A,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!m||!l)return!S&&!m?t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsxs(H,{children:[t.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:t.jsx(te,{className:"h-6 w-6 text-muted-foreground"})}),t.jsx(Q,{children:"Report Not Found"}),t.jsxs(U,{children:['The report "',h,'" could not be found. It may have been removed or renamed.']})]})}):t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsx(A,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const _=r=>{const e={...r};if(!e.title&&e.label&&(e.title=e.label),!e.fields&&Array.isArray(e.columns)&&(e.fields=e.columns.map(s=>({name:s.field||s.name,label:s.label,type:s.type,format:s.format,renderAs:s.renderAs,colorMap:s.colorMap,...s.aggregate?{aggregation:s.aggregate,showInSummary:!0}:{}}))),e.fields&&Array.isArray(e.fields)&&e.fields.length>0){const s=e.fields.some(i=>i.showInSummary||i.aggregation),d=e.reportType||"tabular",n=[];if((d==="summary"||s)&&n.push({type:"summary",title:"Key Metrics"}),n.push({type:"table",title:"Details",columns:e.fields.map(i=>({name:i.name,label:i.label,type:i.type,format:i.format,renderAs:i.renderAs,colorMap:i.colorMap}))}),e.chartConfig?.chartType&&n.push({type:"chart",title:"Chart",chart:{type:"chart",chartType:e.chartConfig.chartType,xAxisField:e.chartConfig.xAxisField,yAxisFields:e.chartConfig.yAxisFields}}),Array.isArray(r.sections)){const i=r.sections.filter(Y=>Y.type==="chart"&&!e.chartConfig?.chartType);n.push(...i)}e.sections=n}else e.sections||(e.sections=[]);return e},u=p||l,B={type:"report-viewer",report:_(u),data:k,showToolbar:!0,allowExport:!0,loading:E};return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate",children:u.title||u.label||"Report Viewer"}),u.description&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:u.description})]}),t.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:t.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"report-edit-button",children:[t.jsx(ae,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col sm:flex-row relative",children:[t.jsx("div",{className:"flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5",children:t.jsx("div",{className:"max-w-5xl mx-auto shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150",children:t.jsx(z,{schema:B})})}),t.jsx(G,{open:j,onClose:P,config:T,onSave:L,onFieldChange:$,availableFields:V}),t.jsx(ee,{open:R,sections:[{title:"Report Configuration",data:u}]})]})]})}export{we as ReportView};
1
+ import{i as q,r as o,j as t}from"./vendor-react-9M-xu2bR.js";import{c as z,d as G}from"./plugins-views-DZCu8Ex3.js";import{b7 as H,b8 as Q,b9 as U}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{u as W,a as X,b as Z,M as ee}from"./index-fjkakZm9.js";import{L as A,aY as te,at as ae}from"./vendor-icons-ndICq8DC.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const re=[{value:"month",label:"Month",type:"text"},{value:"revenue",label:"Revenue",type:"number"},{value:"count",label:"Count",type:"number"},{value:"region",label:"Region",type:"text"},{value:"product",label:"Product",type:"text"},{value:"source",label:"Lead Source",type:"text"},{value:"stage",label:"Stage",type:"text"},{value:"amount",label:"Amount",type:"number"}];function we({dataSource:f}){const{reportName:h}=q(),{showDebug:R}=W(),b=X(),[j,v]=o.useState(!1),[F,w]=o.useState(0),{reports:D,objects:g,loading:S,refresh:C}=Z(),m=D?.find(r=>r.name===h),[l,M]=o.useState(m),[p,x]=o.useState(null),[k,c]=o.useState([]),[E,y]=o.useState(!1),V=o.useMemo(()=>{const r=p||l,e=r?.objectName||r?.dataSource?.object||r?.dataSource?.resource;if(e&&g?.length){const s=g.find(d=>d.name===e);if(s?.fields){const d=s.fields;return Array.isArray(d)?d.map(n=>typeof n=="string"?{value:n,label:n,type:"text"}:{value:n.name,label:n.label||n.name,type:n.type||"text"}):Object.entries(d).map(([n,i])=>({value:n,label:i.label||n,type:i.type||"text"}))}}return re},[p,l,g]),N=o.useCallback(async r=>{try{b&&(await b.update("sys_report",h,r),C().catch(()=>{}))}catch(e){console.warn("[ReportView] Auto-save failed:",e)}},[b,h,C]),O=o.useCallback(()=>{x(l),v(!0),w(r=>r+1)},[l]),P=o.useCallback(()=>{v(!1)},[]),T=o.useMemo(()=>p||l,[F]),L=o.useCallback(r=>{x(r),N(r),w(e=>e+1)},[N]),$=o.useCallback((r,e)=>{x(s=>({...s,[r]:e}))},[]);o.useEffect(()=>{M(m)},[m]),o.useEffect(()=>{j||x(null)},[m]);const a=p||l,I=o.useMemo(()=>JSON.stringify(a?.filters),[a?.filters]),K=o.useMemo(()=>JSON.stringify(a?.dataSource),[a?.dataSource]),J=o.useMemo(()=>JSON.stringify(a?.data),[a?.data]);if(o.useEffect(()=>{if(!a||!f){c([]);return}if(a.data&&Array.isArray(a.data)){c(a.data);return}if(a.dataSource){(async()=>{y(!0);try{const e=a.dataSource.object||a.dataSource.resource;if(!e){console.warn("ReportView: dataSource missing object/resource property"),c([]);return}const s=await f.find(e,{$filter:a.dataSource.filter,$orderby:a.dataSource.sort,$top:a.dataSource.limit});c(s.data||[])}catch(e){console.error("ReportView: Failed to load data from dataSource",e),c([])}finally{y(!1)}})();return}if(a.objectName){(async()=>{y(!0);try{const e=await f.find(a.objectName,{$filter:a.filters,$orderby:a.sort,$top:a.limit||100});c(e.data||[])}catch(e){console.error("ReportView: Failed to load data from objectName",e),c([])}finally{y(!1)}})();return}c([])},[a?.objectName,a?.limit,I,K,J,f]),S)return t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsx(A,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!m||!l)return!S&&!m?t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsxs(H,{children:[t.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:t.jsx(te,{className:"h-6 w-6 text-muted-foreground"})}),t.jsx(Q,{children:"Report Not Found"}),t.jsxs(U,{children:['The report "',h,'" could not be found. It may have been removed or renamed.']})]})}):t.jsx("div",{className:"h-full flex items-center justify-center p-8",children:t.jsx(A,{className:"h-8 w-8 animate-spin text-muted-foreground"})});const _=r=>{const e={...r};if(!e.title&&e.label&&(e.title=e.label),!e.fields&&Array.isArray(e.columns)&&(e.fields=e.columns.map(s=>({name:s.field||s.name,label:s.label,type:s.type,format:s.format,renderAs:s.renderAs,colorMap:s.colorMap,...s.aggregate?{aggregation:s.aggregate,showInSummary:!0}:{}}))),e.fields&&Array.isArray(e.fields)&&e.fields.length>0){const s=e.fields.some(i=>i.showInSummary||i.aggregation),d=e.reportType||"tabular",n=[];if((d==="summary"||s)&&n.push({type:"summary",title:"Key Metrics"}),n.push({type:"table",title:"Details",columns:e.fields.map(i=>({name:i.name,label:i.label,type:i.type,format:i.format,renderAs:i.renderAs,colorMap:i.colorMap}))}),e.chartConfig?.chartType&&n.push({type:"chart",title:"Chart",chart:{type:"chart",chartType:e.chartConfig.chartType,xAxisField:e.chartConfig.xAxisField,yAxisFields:e.chartConfig.yAxisFields}}),Array.isArray(r.sections)){const i=r.sections.filter(Y=>Y.type==="chart"&&!e.chartConfig?.chartType);n.push(...i)}e.sections=n}else e.sections||(e.sections=[]);return e},u=p||l,B={type:"report-viewer",report:_(u),data:k,showToolbar:!0,allowExport:!0,loading:E};return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate",children:u.title||u.label||"Report Viewer"}),u.description&&t.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:u.description})]}),t.jsx("div",{className:"shrink-0 flex items-center gap-1.5",children:t.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"report-edit-button",children:[t.jsx(ae,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col sm:flex-row relative",children:[t.jsx("div",{className:"flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5",children:t.jsx("div",{className:"max-w-5xl mx-auto shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150",children:t.jsx(z,{schema:B})})}),t.jsx(G,{open:j,onClose:P,config:T,onSave:L,onFieldChange:$,availableFields:V}),t.jsx(ee,{open:R,sections:[{title:"Report Configuration",data:u}]})]})]})}export{we as ReportView};
@@ -1 +1 @@
1
- import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-n1j_TN6w.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as i}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-CTBPkbPG.js";import{s as k}from"./systemObjects-DSpePIIy.js";import{b9 as h,m as R,L as S,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const p=k.find(c=>c.name==="sys_role"),o=p.views[0].columns;function Q(){const{user:c}=w(),l=c?.role==="admin",t=C(),[m,u]=r.useState([]),[f,d]=r.useState(!0),a=r.useCallback(async()=>{if(t){d(!0);try{const s=await t.find("sys_role");u(s.data||[])}catch{i.error("Failed to load roles")}finally{d(!1)}}},[t]);r.useEffect(()=>{a()},[a]);const j=r.useCallback(async()=>{if(t)try{await t.create("sys_role",{name:"New Role",description:"",isSystem:!1}),i.success("Role created"),a()}catch{i.error("Failed to create role")}},[t,a]),g=r.useCallback(async s=>{if(t)try{await t.delete("sys_role",s),i.success("Role deleted"),a()}catch{i.error("Failed to delete role")}},[t,a]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Role Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Define roles and assign permissions"})]})]}),l&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:j,children:[e.jsx(R,{className:"h-4 w-4"}),"Add Role"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[o.map(s=>{const n=p.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:n?.label??s},s)}),l&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:f?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:o.length+(l?1:0),children:e.jsx(S,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):m.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:o.length+(l?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No roles found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):m.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[o.map(n=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[n]??"")},n)),l&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(s.id||s._id),children:e.jsx(_,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as RoleManagementPage};
1
+ import{r,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-Dn7jNPwf.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as i}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-fjkakZm9.js";import{s as k}from"./systemObjects-DSpePIIy.js";import{b9 as h,m as R,L as S,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const p=k.find(c=>c.name==="sys_role"),o=p.views[0].columns;function Q(){const{user:c}=w(),l=c?.role==="admin",t=C(),[m,u]=r.useState([]),[f,d]=r.useState(!0),a=r.useCallback(async()=>{if(t){d(!0);try{const s=await t.find("sys_role");u(s.data||[])}catch{i.error("Failed to load roles")}finally{d(!1)}}},[t]);r.useEffect(()=>{a()},[a]);const j=r.useCallback(async()=>{if(t)try{await t.create("sys_role",{name:"New Role",description:"",isSystem:!1}),i.success("Role created"),a()}catch{i.error("Failed to create role")}},[t,a]),g=r.useCallback(async s=>{if(t)try{await t.delete("sys_role",s),i.success("Role deleted"),a()}catch{i.error("Failed to delete role")}},[t,a]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Role Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Define roles and assign permissions"})]})]}),l&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:j,children:[e.jsx(R,{className:"h-4 w-4"}),"Add Role"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[o.map(s=>{const n=p.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:n?.label??s},s)}),l&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:f?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:o.length+(l?1:0),children:e.jsx(S,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):m.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:o.length+(l?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No roles found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):m.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[o.map(n=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[n]??"")},n)),l&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(s.id||s._id),children:e.jsx(_,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as RoleManagementPage};
@@ -1 +1 @@
1
- import{i as S,k as L,r as m,j as s,L as g}from"./vendor-react-9M-xu2bR.js";import{aa as I,G as f,C as P,v as A}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{b as T}from"./index-CTBPkbPG.js";import{A as q,S as b,aY as E,ak as M,aX as O,aQ as x}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function N(p){const l=[];for(const o of p)o.type==="group"&&o.children?l.push(...N(o.children)):l.push(o);return l}const j={object:x,dashboard:O,page:M,report:E},R={object:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",dashboard:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",page:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",report:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"};function se(){const{appName:p}=S(),[l,o]=L(),v=l.get("q")||"",[n,y]=m.useState(v),{apps:w}=T(),h=w||[],u=h.find(t=>t.name===p)||h[0],c=`/apps/${p}`,i=m.useMemo(()=>u?N(u.navigation||[]).map(e=>{let r="#";return e.type==="object"?(r=`${c}/${e.objectName}`,e.viewName&&(r+=`/view/${e.viewName}`)):e.type==="dashboard"?r=`${c}/dashboard/${e.dashboardName}`:e.type==="page"?r=`${c}/page/${e.pageName}`:e.type==="report"&&(r=`${c}/report/${e.reportName}`),{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||"",href:r,type:e.type,description:e.description}}).filter(e=>e.href!=="#"):[],[u,c]),d=m.useMemo(()=>{if(!n.trim())return i;const t=n.toLowerCase();return i.filter(e=>e.label.toLowerCase().includes(t)||e.type.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t))},[i,n]),$=t=>{y(t),o(t?{q:t}:{})},C=m.useMemo(()=>{const t={};for(const e of d)(t[e.type]||=[]).push(e);return t},[d]);return s.jsxs("div",{className:"flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(g,{to:c,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(q,{className:"h-4 w-4"}),"Back"]}),s.jsx("h1",{className:"text-xl font-semibold",children:"Search"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(b,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(I,{value:n,onChange:t=>$(t.target.value),placeholder:"Search objects, dashboards, pages, reports...",className:"pl-10 h-11 text-base",autoFocus:!0})]}),s.jsx("div",{className:"text-sm text-muted-foreground",children:n.trim()?`${d.length} result${d.length!==1?"s":""} for "${n}"`:`${i.length} items available`}),d.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(b,{className:"h-12 w-12 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No results found"}),s.jsx("p",{className:"text-sm text-muted-foreground/80 mt-1",children:"Try adjusting your search terms"})]}):s.jsx("div",{className:"space-y-6",children:Object.entries(C).map(([t,e])=>{const r=j[t]||x;return s.jsxs("div",{children:[s.jsxs("h2",{className:"text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5",children:[s.jsx(r,{className:"h-4 w-4"}),t.charAt(0).toUpperCase()+t.slice(1),"s",s.jsx(f,{variant:"secondary",className:"ml-1 text-xs",children:e.length})]}),s.jsx("div",{className:"grid gap-2",children:e.map(a=>{const k=j[a.type]||x;return s.jsx(g,{to:a.href,children:s.jsx(P,{className:"hover:bg-accent/50 transition-colors cursor-pointer",children:s.jsxs(A,{className:"flex items-center gap-3 p-3",children:[s.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded ${R[a.type]||""}`,children:s.jsx(k,{className:"h-4 w-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:a.label}),a.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.description})]}),s.jsx(f,{variant:"outline",className:"text-xs shrink-0",children:a.type})]})})},a.id)})})]},t)})})]})}export{se as SearchResultsPage};
1
+ import{i as S,k as L,r as m,j as s,L as g}from"./vendor-react-9M-xu2bR.js";import{ab as I,G as f,C as P,v as A}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{b as T}from"./index-fjkakZm9.js";import{A as q,S as b,aY as E,ak as M,aX as O,aQ as x}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function N(p){const l=[];for(const o of p)o.type==="group"&&o.children?l.push(...N(o.children)):l.push(o);return l}const j={object:x,dashboard:O,page:M,report:E},R={object:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",dashboard:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",page:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",report:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"};function se(){const{appName:p}=S(),[l,o]=L(),v=l.get("q")||"",[n,y]=m.useState(v),{apps:w}=T(),h=w||[],u=h.find(t=>t.name===p)||h[0],c=`/apps/${p}`,i=m.useMemo(()=>u?N(u.navigation||[]).map(e=>{let r="#";return e.type==="object"?(r=`${c}/${e.objectName}`,e.viewName&&(r+=`/view/${e.viewName}`)):e.type==="dashboard"?r=`${c}/dashboard/${e.dashboardName}`:e.type==="page"?r=`${c}/page/${e.pageName}`:e.type==="report"&&(r=`${c}/report/${e.reportName}`),{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||"",href:r,type:e.type,description:e.description}}).filter(e=>e.href!=="#"):[],[u,c]),d=m.useMemo(()=>{if(!n.trim())return i;const t=n.toLowerCase();return i.filter(e=>e.label.toLowerCase().includes(t)||e.type.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t))},[i,n]),$=t=>{y(t),o(t?{q:t}:{})},C=m.useMemo(()=>{const t={};for(const e of d)(t[e.type]||=[]).push(e);return t},[d]);return s.jsxs("div",{className:"flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(g,{to:c,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(q,{className:"h-4 w-4"}),"Back"]}),s.jsx("h1",{className:"text-xl font-semibold",children:"Search"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(b,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(I,{value:n,onChange:t=>$(t.target.value),placeholder:"Search objects, dashboards, pages, reports...",className:"pl-10 h-11 text-base",autoFocus:!0})]}),s.jsx("div",{className:"text-sm text-muted-foreground",children:n.trim()?`${d.length} result${d.length!==1?"s":""} for "${n}"`:`${i.length} items available`}),d.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(b,{className:"h-12 w-12 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No results found"}),s.jsx("p",{className:"text-sm text-muted-foreground/80 mt-1",children:"Try adjusting your search terms"})]}):s.jsx("div",{className:"space-y-6",children:Object.entries(C).map(([t,e])=>{const r=j[t]||x;return s.jsxs("div",{children:[s.jsxs("h2",{className:"text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5",children:[s.jsx(r,{className:"h-4 w-4"}),t.charAt(0).toUpperCase()+t.slice(1),"s",s.jsx(f,{variant:"secondary",className:"ml-1 text-xs",children:e.length})]}),s.jsx("div",{className:"grid gap-2",children:e.map(a=>{const k=j[a.type]||x;return s.jsx(g,{to:a.href,children:s.jsx(P,{className:"hover:bg-accent/50 transition-colors cursor-pointer",children:s.jsxs(A,{className:"flex items-center gap-3 p-3",children:[s.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded ${R[a.type]||""}`,children:s.jsx(k,{className:"h-4 w-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:a.label}),a.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.description})]}),s.jsx(f,{variant:"outline",className:"text-xs shrink-0",children:a.type})]})})},a.id)})})]},t)})})]})}export{se as SearchResultsPage};
@@ -1 +1 @@
1
- import{h as y,i as b,r as n,j as s}from"./vendor-react-9M-xu2bR.js";import{C as j,s as L,u as N,t as C,v,G as w}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a as $,b as S}from"./index-CTBPkbPG.js";import{ai as R,b4 as M,b8 as P,b9 as _,ba as k,bb as z,a8 as A,L as E}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-n1j_TN6w.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";function Z(){const m=y(),{appName:r}=b(),t=r?`/apps/${r}`:"",a=$(),{apps:l}=S(),[i,u]=n.useState({apps:null,users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[p,c]=n.useState(!0),d=n.useCallback(async()=>{if(a){c(!0);try{const[e,o,h,f,x]=await Promise.all([a.find("sys_user").catch(()=>({data:[]})),a.find("sys_org").catch(()=>({data:[]})),a.find("sys_role").catch(()=>({data:[]})),a.find("sys_permission").catch(()=>({data:[]})),a.find("sys_audit_log").catch(()=>({data:[]}))]);u({apps:l?.length??0,users:e.data?.length??0,orgs:o.data?.length??0,roles:h.data?.length??0,permissions:f.data?.length??0,auditLogs:x.data?.length??0})}catch{}finally{c(!1)}}},[a,l]);n.useEffect(()=>{d()},[d]);const g=[{title:"Applications",description:"Manage all configured applications",icon:R,href:`${t}/system/apps`,countLabel:"apps",count:i.apps},{title:"Users",description:"Manage system users and accounts",icon:M,href:`${t}/system/users`,countLabel:"users",count:i.users},{title:"Organizations",description:"Manage organizations and teams",icon:P,href:`${t}/system/organizations`,countLabel:"organizations",count:i.orgs},{title:"Roles",description:"Configure roles and access levels",icon:_,href:`${t}/system/roles`,countLabel:"roles",count:i.roles},{title:"Permissions",description:"Manage permission rules and assignments",icon:k,href:`${t}/system/permissions`,countLabel:"permissions",count:i.permissions},{title:"Audit Log",description:"View system activity and changes",icon:z,href:`${t}/system/audit-log`,countLabel:"entries",count:i.auditLogs},{title:"Profile",description:"View and edit your account settings",icon:A,href:`${t}/system/profile`,countLabel:"",count:null}];return s.jsxs("div",{className:"flex flex-col gap-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"System Settings"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage applications, users, roles, permissions, and system configuration"})]}),p&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(E,{className:"h-4 w-4 animate-spin"}),"Loading statistics..."]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:g.map(e=>{const o=e.icon;return s.jsxs(j,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>m(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,"-")}`,children:[s.jsxs(L,{className:"flex flex-row items-center gap-3 pb-2",children:[s.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(o,{className:"h-5 w-5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(N,{className:"text-base",children:e.title}),s.jsx(C,{className:"text-xs",children:e.description})]})]}),s.jsx(v,{className:"pt-0",children:e.count!==null&&s.jsxs(w,{variant:"secondary",children:[e.count," ",e.countLabel]})})]},e.title)})})]})}export{Z as SystemHubPage};
1
+ import{h as y,i as b,r as n,j as s}from"./vendor-react-9M-xu2bR.js";import{C as j,s as L,u as N,t as C,v,G as w}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import"./vendor-ui-utils-3tkeUVaX.js";import{a as $,b as S}from"./index-fjkakZm9.js";import{ai as R,b4 as M,b8 as P,b9 as _,ba as k,bb as z,a8 as A,L as E}from"./vendor-icons-ndICq8DC.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-charts-BLNOCZWl.js";import"./infrastructure-Dn7jNPwf.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";function Z(){const m=y(),{appName:r}=b(),t=r?`/apps/${r}`:"",a=$(),{apps:l}=S(),[i,u]=n.useState({apps:null,users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[p,c]=n.useState(!0),d=n.useCallback(async()=>{if(a){c(!0);try{const[e,o,h,f,x]=await Promise.all([a.find("sys_user").catch(()=>({data:[]})),a.find("sys_org").catch(()=>({data:[]})),a.find("sys_role").catch(()=>({data:[]})),a.find("sys_permission").catch(()=>({data:[]})),a.find("sys_audit_log").catch(()=>({data:[]}))]);u({apps:l?.length??0,users:e.data?.length??0,orgs:o.data?.length??0,roles:h.data?.length??0,permissions:f.data?.length??0,auditLogs:x.data?.length??0})}catch{}finally{c(!1)}}},[a,l]);n.useEffect(()=>{d()},[d]);const g=[{title:"Applications",description:"Manage all configured applications",icon:R,href:`${t}/system/apps`,countLabel:"apps",count:i.apps},{title:"Users",description:"Manage system users and accounts",icon:M,href:`${t}/system/users`,countLabel:"users",count:i.users},{title:"Organizations",description:"Manage organizations and teams",icon:P,href:`${t}/system/organizations`,countLabel:"organizations",count:i.orgs},{title:"Roles",description:"Configure roles and access levels",icon:_,href:`${t}/system/roles`,countLabel:"roles",count:i.roles},{title:"Permissions",description:"Manage permission rules and assignments",icon:k,href:`${t}/system/permissions`,countLabel:"permissions",count:i.permissions},{title:"Audit Log",description:"View system activity and changes",icon:z,href:`${t}/system/audit-log`,countLabel:"entries",count:i.auditLogs},{title:"Profile",description:"View and edit your account settings",icon:A,href:`${t}/system/profile`,countLabel:"",count:null}];return s.jsxs("div",{className:"flex flex-col gap-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"System Settings"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage applications, users, roles, permissions, and system configuration"})]}),p&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(E,{className:"h-4 w-4 animate-spin"}),"Loading statistics..."]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:g.map(e=>{const o=e.icon;return s.jsxs(j,{className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>m(e.href),"data-testid":`hub-card-${e.title.toLowerCase().replace(/\s+/g,"-")}`,children:[s.jsxs(L,{className:"flex flex-row items-center gap-3 pb-2",children:[s.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:s.jsx(o,{className:"h-5 w-5"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(N,{className:"text-base",children:e.title}),s.jsx(C,{className:"text-xs",children:e.description})]})]}),s.jsx(v,{className:"pt-0",children:e.count!==null&&s.jsxs(w,{variant:"secondary",children:[e.count," ",e.countLabel]})})]},e.title)})})]})}export{Z as SystemHubPage};
@@ -1 +1 @@
1
- import{r as a,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-n1j_TN6w.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BxvihT61.js";import"./framework-BM176iet.js";import{b as n}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-CTBPkbPG.js";import{s as k}from"./systemObjects-DSpePIIy.js";import{b4 as h,m as U,L as S,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-objectstack-YKtcdalX.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-qwgXbAqa.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-CveFN6PV.js";import"./data-adapter-rvE3xy2B.js";import"./ui-layout-C6KWQtRO.js";const u=k.find(m=>m.name==="sys_user"),l=u.views[0].columns;function Q(){const{user:m}=w(),i=m?.role==="admin",t=C(),[d,p]=a.useState([]),[f,o]=a.useState(!0),r=a.useCallback(async()=>{if(t){o(!0);try{const s=await t.find("sys_user");p(s.data||[])}catch{n.error("Failed to load users")}finally{o(!1)}}},[t]);a.useEffect(()=>{r()},[r]);const j=a.useCallback(async()=>{if(t)try{await t.create("sys_user",{name:"New User",email:"",role:"member",status:"active"}),n.success("User created"),r()}catch{n.error("Failed to create user")}},[t,r]),g=a.useCallback(async s=>{if(t)try{await t.delete("sys_user",s),n.success("User deleted"),r()}catch{n.error("Failed to delete user")}},[t,r]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"User Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage system users and their roles"})]})]}),i&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:j,children:[e.jsx(U,{className:"h-4 w-4"}),"Add User"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[l.map(s=>{const c=u.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:c?.label??s},s)}),i&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:f?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:l.length+(i?1:0),children:e.jsx(S,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):d.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:l.length+(i?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No users found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):d.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[l.map(c=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[c]??"")},c)),i&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(s.id||s._id),children:e.jsx(_,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as UserManagementPage};
1
+ import{r as a,j as e}from"./vendor-react-9M-xu2bR.js";import{c as w}from"./infrastructure-Dn7jNPwf.js";import{B as x,C as b,v as y,G as v}from"./ui-components-BE4yvyhE.js";import"./framework-52FGgFF6.js";import"./vendor-objectstack-CatrkstC.js";import{b as n}from"./vendor-ui-utils-3tkeUVaX.js";import{a as C}from"./index-fjkakZm9.js";import{s as k}from"./systemObjects-DSpePIIy.js";import{b4 as h,m as U,L as S,l as _}from"./vendor-icons-ndICq8DC.js";import"./vendor-i18n-E3-WitRV.js";import"./vendor-radix-C6qchjxv.js";import"./vendor-charts-BLNOCZWl.js";import"./vendor-zod-C5j6C2CQ.js";import"./plugins-core-CP8uPw4p.js";import"./vendor-dndkit-CX1oDZqy.js";import"./plugins-views-DZCu8Ex3.js";import"./data-adapter-Bif-TtZA.js";import"./ui-layout-CYnH69Z2.js";const u=k.find(m=>m.name==="sys_user"),l=u.views[0].columns;function Q(){const{user:m}=w(),i=m?.role==="admin",t=C(),[d,p]=a.useState([]),[f,o]=a.useState(!0),r=a.useCallback(async()=>{if(t){o(!0);try{const s=await t.find("sys_user");p(s.data||[])}catch{n.error("Failed to load users")}finally{o(!1)}}},[t]);a.useEffect(()=>{r()},[r]);const j=a.useCallback(async()=>{if(t)try{await t.create("sys_user",{name:"New User",email:"",role:"member",status:"active"}),n.success("User created"),r()}catch{n.error("Failed to create user")}},[t,r]),g=a.useCallback(async s=>{if(t)try{await t.delete("sys_user",s),n.success("User deleted"),r()}catch{n.error("Failed to delete user")}},[t,r]);return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(h,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"User Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage system users and their roles"})]})]}),i&&e.jsxs(x,{size:"sm",className:"shrink-0 gap-2",onClick:j,children:[e.jsx(U,{className:"h-4 w-4"}),"Add User"]})]}),e.jsx(b,{children:e.jsx(y,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[l.map(s=>{const c=u.fields.find(N=>N.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:c?.label??s},s)}),i&&e.jsx("th",{className:"h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:f?e.jsx("tr",{children:e.jsx("td",{className:"p-6 text-center",colSpan:l.length+(i?1:0),children:e.jsx(S,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):d.length===0?e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:l.length+(i?1:0),children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(h,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"No users found."}),e.jsx(v,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})}):d.map(s=>e.jsxs("tr",{className:"border-b hover:bg-muted/50 transition-colors",children:[l.map(c=>e.jsx("td",{className:"h-10 px-3 sm:px-4 whitespace-nowrap",children:String(s[c]??"")},c)),i&&e.jsx("td",{className:"h-10 px-3 sm:px-4 text-right",children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g(s.id||s._id),children:e.jsx(_,{className:"h-3.5 w-3.5 text-destructive"})})})]},s.id||s._id))})]})})})})]})}export{Q as UserManagementPage};