@object-ui/console 3.1.4 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/dist/assets/{AppManagementPage-C3hg63SY.js → AppManagementPage-C5q5QBar.js} +1 -1
  2. package/dist/assets/{AuditLogPage-BQ8vLOcD.js → AuditLogPage-BpLFTD-b.js} +1 -1
  3. package/dist/assets/{CreateAppPage-Do3sVvxx.js → CreateAppPage-A-VfItcx.js} +1 -1
  4. package/dist/assets/{DashboardDesignPage-B2PH_3Ly.js → DashboardDesignPage-N8NL-jkM.js} +1 -1
  5. package/dist/assets/{DashboardView-DxTi63mN.js → DashboardView-Dy0d2kFj.js} +1 -1
  6. package/dist/assets/{EditAppPage-j0L1x2UT.js → EditAppPage-B6HL4COW.js} +1 -1
  7. package/dist/assets/{OrgManagementPage-BTNWvRHI.js → OrgManagementPage-BqtqRi_6.js} +1 -1
  8. package/dist/assets/{PageDesignPage-B62v76Qo.js → PageDesignPage-BzIL8o0u.js} +1 -1
  9. package/dist/assets/{PageView-CzF68bdQ.js → PageView-eCi7zkJr.js} +1 -1
  10. package/dist/assets/{PermissionManagementPage-PWrxdXgQ.js → PermissionManagementPage-BmI-0QXt.js} +1 -1
  11. package/dist/assets/{RecordDetailView-FkYkjMEZ.js → RecordDetailView-CFVPmfrM.js} +1 -1
  12. package/dist/assets/{ReportView-pQJYBCo1.js → ReportView-DNOPIpWM.js} +1 -1
  13. package/dist/assets/{RoleManagementPage-cNU9Z5K1.js → RoleManagementPage-DwtqyfDW.js} +1 -1
  14. package/dist/assets/{SearchResultsPage-DJU7W1Zx.js → SearchResultsPage-BxzOkRnL.js} +1 -1
  15. package/dist/assets/{SystemHubPage-BxKsLijB.js → SystemHubPage-RFiJSMgW.js} +1 -1
  16. package/dist/assets/{UserManagementPage-D2qUebpD.js → UserManagementPage-BBS1vYGa.js} +1 -1
  17. package/dist/assets/index-DDpLaQOV.js +8 -0
  18. package/dist/index.html +1 -1
  19. package/package.json +35 -35
  20. package/dist/assets/index-RiB5-8aY.js +0 -8
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Gs as a,Jo as o,Lc as s,Ms as c,Po as l,So as u,St as d,ds as f,fs as p,gc as m,on as h,ps as g,vs as _}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as v,u as y}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as b,o as x}from"./index-RiB5-8aY.js";var S=e(t(),1),C=n();function w(){let e=v(),{appName:t}=y(),n=t?`/apps/${t}`:``,{apps:w,refresh:T}=b(),[E,D]=(0,S.useState)(``),[O,k]=(0,S.useState)(new Set),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(!1),P=(w||[]).filter(e=>{if(!E)return!0;let t=E.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.label||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)}),F=(0,S.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),I=(0,S.useCallback)(()=>{O.size===P.length?k(new Set):k(new Set(P.map(e=>e.name)))},[O.size,P]),L=(0,S.useCallback)(async e=>{N(!0);try{let t=e.active===!1;d.success(`${e.label||e.name} ${t?`enabled`:`disabled`}`),await T()}catch{d.error(`Failed to toggle app status`)}finally{N(!1)}},[T]),R=(0,S.useCallback)(async e=>{N(!0);try{d.success(`${e.label||e.name} set as default`),await T()}catch{d.error(`Failed to set default app`)}finally{N(!1)}},[T]),z=(0,S.useCallback)(async e=>{if(A!==e.name){j(e.name);return}N(!0);try{d.success(`${e.label||e.name} deleted`),j(null),await T()}catch{d.error(`Failed to delete app`)}finally{N(!1)}},[A,T]),B=(0,S.useCallback)(async e=>{N(!0);try{d.success(`${O.size} apps ${e?`enabled`:`disabled`}`),k(new Set),await T()}catch{d.error(`Bulk operation failed`)}finally{N(!1)}},[O,T]);return(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Applications`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage all configured applications`})]}),(0,C.jsxs)(o,{onClick:()=>e(`${n}/create-app`),"data-testid":`create-app-btn`,children:[(0,C.jsx)(r,{className:`h-4 w-4 mr-2`}),`New App`]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,C.jsx)(c,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(h,{placeholder:`Search apps...`,value:E,onChange:e=>D(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),O.size>0&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(l,{variant:`secondary`,children:[O.size,` selected`]}),(0,C.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>B(!0),disabled:M,children:`Enable`}),(0,C.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>B(!1),disabled:M,children:`Disable`})]})]}),P.length>0&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:O.size===P.length&&P.length>0,onChange:I,className:`rounded border-input`,"aria-label":`Select all apps`}),(0,C.jsxs)(`span`,{children:[`Select all (`,P.length,`)`]})]}),P.length===0?(0,C.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,C.jsx)(m,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,C.jsx)(`p`,{children:`No apps found.`})]}):(0,C.jsx)(`div`,{className:`grid gap-3`,children:P.map(t=>{let r=t.active!==!1,c=t.isDefault===!0,d=A===t.name;return(0,C.jsx)(u,{className:r?``:`opacity-60`,"data-testid":`app-card-${t.name}`,children:(0,C.jsxs)(i,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:O.has(t.name),onChange:()=>F(t.name),className:`rounded border-input shrink-0`,"aria-label":`Select ${t.label||t.name}`}),(0,C.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,C.jsx)(m,{className:`h-4 w-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`font-medium truncate`,children:x(t.label)||t.name}),c&&(0,C.jsx)(l,{variant:`default`,className:`text-xs`,children:`Default`}),(0,C.jsx)(l,{variant:r?`secondary`:`outline`,className:`text-xs`,children:r?`Active`:`Inactive`})]}),t.description&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:x(t.description)})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Open app`,onClick:()=>e(`/apps/${t.name}`),children:(0,C.jsx)(s,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Edit app`,onClick:()=>e(`${n}/edit-app/${t.name}`),children:(0,C.jsx)(a,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:r?`Disable app`:`Enable app`,onClick:()=>L(t),disabled:M,children:r?(0,C.jsx)(p,{className:`h-4 w-4`}):(0,C.jsx)(g,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Set as default`,onClick:()=>R(t),disabled:M||c,children:(0,C.jsx)(_,{className:`h-4 w-4 ${c?`fill-current text-yellow-500`:``}`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:d?`Click again to confirm delete`:`Delete app`,onClick:()=>z(t),disabled:M,className:d?`text-destructive`:``,children:(0,C.jsx)(f,{className:`h-4 w-4`})})]})]})},t.name)})})]})}export{w as AppManagementPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Gs as a,Jo as o,Lc as s,Ms as c,Po as l,So as u,St as d,ds as f,fs as p,gc as m,on as h,ps as g,vs as _}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as v,u as y}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as b,o as x}from"./index-DDpLaQOV.js";var S=e(t(),1),C=n();function w(){let e=v(),{appName:t}=y(),n=t?`/apps/${t}`:``,{apps:w,refresh:T}=b(),[E,D]=(0,S.useState)(``),[O,k]=(0,S.useState)(new Set),[A,j]=(0,S.useState)(null),[M,N]=(0,S.useState)(!1),P=(w||[]).filter(e=>{if(!E)return!0;let t=E.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.label||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)}),F=(0,S.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),I=(0,S.useCallback)(()=>{O.size===P.length?k(new Set):k(new Set(P.map(e=>e.name)))},[O.size,P]),L=(0,S.useCallback)(async e=>{N(!0);try{let t=e.active===!1;d.success(`${e.label||e.name} ${t?`enabled`:`disabled`}`),await T()}catch{d.error(`Failed to toggle app status`)}finally{N(!1)}},[T]),R=(0,S.useCallback)(async e=>{N(!0);try{d.success(`${e.label||e.name} set as default`),await T()}catch{d.error(`Failed to set default app`)}finally{N(!1)}},[T]),z=(0,S.useCallback)(async e=>{if(A!==e.name){j(e.name);return}N(!0);try{d.success(`${e.label||e.name} deleted`),j(null),await T()}catch{d.error(`Failed to delete app`)}finally{N(!1)}},[A,T]),B=(0,S.useCallback)(async e=>{N(!0);try{d.success(`${O.size} apps ${e?`enabled`:`disabled`}`),k(new Set),await T()}catch{d.error(`Bulk operation failed`)}finally{N(!1)}},[O,T]);return(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,C.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Applications`}),(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage all configured applications`})]}),(0,C.jsxs)(o,{onClick:()=>e(`${n}/create-app`),"data-testid":`create-app-btn`,children:[(0,C.jsx)(r,{className:`h-4 w-4 mr-2`}),`New App`]})]}),(0,C.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,C.jsx)(c,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(h,{placeholder:`Search apps...`,value:E,onChange:e=>D(e.target.value),className:`pl-8`,"data-testid":`app-search-input`})]}),O.size>0&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsxs)(l,{variant:`secondary`,children:[O.size,` selected`]}),(0,C.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>B(!0),disabled:M,children:`Enable`}),(0,C.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>B(!1),disabled:M,children:`Disable`})]})]}),P.length>0&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:O.size===P.length&&P.length>0,onChange:I,className:`rounded border-input`,"aria-label":`Select all apps`}),(0,C.jsxs)(`span`,{children:[`Select all (`,P.length,`)`]})]}),P.length===0?(0,C.jsxs)(`div`,{className:`text-center py-12 text-muted-foreground`,"data-testid":`no-apps-message`,children:[(0,C.jsx)(m,{className:`h-12 w-12 mx-auto mb-3 opacity-30`}),(0,C.jsx)(`p`,{children:`No apps found.`})]}):(0,C.jsx)(`div`,{className:`grid gap-3`,children:P.map(t=>{let r=t.active!==!1,c=t.isDefault===!0,d=A===t.name;return(0,C.jsx)(u,{className:r?``:`opacity-60`,"data-testid":`app-card-${t.name}`,children:(0,C.jsxs)(i,{className:`flex items-center gap-3 py-3 px-4`,children:[(0,C.jsx)(`input`,{type:`checkbox`,checked:O.has(t.name),onChange:()=>F(t.name),className:`rounded border-input shrink-0`,"aria-label":`Select ${t.label||t.name}`}),(0,C.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,C.jsx)(m,{className:`h-4 w-4`})}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`font-medium truncate`,children:x(t.label)||t.name}),c&&(0,C.jsx)(l,{variant:`default`,className:`text-xs`,children:`Default`}),(0,C.jsx)(l,{variant:r?`secondary`:`outline`,className:`text-xs`,children:r?`Active`:`Inactive`})]}),t.description&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:x(t.description)})]}),(0,C.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Open app`,onClick:()=>e(`/apps/${t.name}`),children:(0,C.jsx)(s,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Edit app`,onClick:()=>e(`${n}/edit-app/${t.name}`),children:(0,C.jsx)(a,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:r?`Disable app`:`Enable app`,onClick:()=>L(t),disabled:M,children:r?(0,C.jsx)(p,{className:`h-4 w-4`}):(0,C.jsx)(g,{className:`h-4 w-4`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:`Set as default`,onClick:()=>R(t),disabled:M||c,children:(0,C.jsx)(_,{className:`h-4 w-4 ${c?`fill-current text-yellow-500`:``}`})}),(0,C.jsx)(o,{variant:`ghost`,size:`icon`,title:d?`Click again to confirm delete`:`Delete app`,onClick:()=>z(t),disabled:M,className:d?`text-destructive`:``,children:(0,C.jsx)(f,{className:`h-4 w-4`})})]})]})},t.name)})})]})}export{w as AppManagementPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ns as i,Po as a,So as o,St as s,dc as c}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import"./infrastructure-C6Ph6Ug0.js";import{s as l}from"./index-RiB5-8aY.js";import{t as u}from"./systemObjects-5--4zaiX.js";var d=e(t(),1),f=n(),p=u.find(e=>e.name===`sys_audit_log`),m=p.views[0].columns;function h(){let e=l(),[t,n]=(0,d.useState)([]),[u,h]=(0,d.useState)(!0),g=(0,d.useCallback)(async()=>{if(e){h(!0);try{n((await e.find(`sys_audit_log`,{$orderby:{createdAt:`desc`}})).data||[])}catch{s.error(`Failed to load audit logs`)}finally{h(!1)}}},[e]);return(0,d.useEffect)(()=>{g()},[g]),(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,f.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,f.jsx)(i,{className:`h-5 w-5 text-primary`})}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Audit Log`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`View system activity and user actions`})]})]}),(0,f.jsx)(o,{children:(0,f.jsx)(r,{className:`p-0`,children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsx)(`tr`,{className:`border-b bg-muted/50`,children:m.map(e=>(0,f.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:p.fields.find(t=>t.name===e)?.label??e},e))})}),(0,f.jsx)(`tbody`,{children:u?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{className:`p-6 text-center`,colSpan:m.length,children:(0,f.jsx)(c,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):t.length===0?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:m.length,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,f.jsx)(i,{className:`h-8 w-8 text-muted-foreground/50`}),(0,f.jsx)(`p`,{children:`No audit logs found.`}),(0,f.jsx)(a,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]})})}):t.map(e=>(0,f.jsx)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:m.map(t=>(0,f.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t))},e.id||e._id))})]})})})})]})}export{h as AuditLogPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ns as i,Po as a,So as o,St as s,dc as c}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import"./infrastructure-C6Ph6Ug0.js";import{s as l}from"./index-DDpLaQOV.js";import{t as u}from"./systemObjects-5--4zaiX.js";var d=e(t(),1),f=n(),p=u.find(e=>e.name===`sys_audit_log`),m=p.views[0].columns;function h(){let e=l(),[t,n]=(0,d.useState)([]),[u,h]=(0,d.useState)(!0),g=(0,d.useCallback)(async()=>{if(e){h(!0);try{n((await e.find(`sys_audit_log`,{$orderby:{createdAt:`desc`}})).data||[])}catch{s.error(`Failed to load audit logs`)}finally{h(!1)}}},[e]);return(0,d.useEffect)(()=>{g()},[g]),(0,f.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,f.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,f.jsx)(i,{className:`h-5 w-5 text-primary`})}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Audit Log`}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`View system activity and user actions`})]})]}),(0,f.jsx)(o,{children:(0,f.jsx)(r,{className:`p-0`,children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsx)(`tr`,{className:`border-b bg-muted/50`,children:m.map(e=>(0,f.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:p.fields.find(t=>t.name===e)?.label??e},e))})}),(0,f.jsx)(`tbody`,{children:u?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{className:`p-6 text-center`,colSpan:m.length,children:(0,f.jsx)(c,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):t.length===0?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:m.length,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,f.jsx)(i,{className:`h-8 w-8 text-muted-foreground/50`}),(0,f.jsx)(`p`,{children:`No audit logs found.`}),(0,f.jsx)(a,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]})})}):t.map(e=>(0,f.jsx)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:m.map(t=>(0,f.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t))},e.id||e._id))})]})})})})]})}export{h as AuditLogPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,n,w as r}from"./framework-DJlDX9E6.js";import{St as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-RiB5-8aY.js";import{n as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=r(),f=`objectui-app-wizard-draft`;function p(){let e=a(),{appName:t}=o(),{objects:r,refresh:p}=s(),m=c(),h=(r||[]).map(e=>({name:e.name,label:e.label||e.name,icon:e.icon,selected:!1})),g=(0,u.useCallback)(()=>{try{let e=localStorage.getItem(f);if(e)return JSON.parse(e)}catch{}},[]),_=(0,u.useCallback)(async t=>{try{let r=n(t),a=m?.getClient();a&&await a.meta.saveItem(`app`,t.name,r),localStorage.removeItem(f),i.success(`Application "${t.title}" created successfully`),await p?.(),e(`/apps/${t.name}`)}catch(e){i.error(e?.message||`Failed to create application`)}},[e,p,m]),v=(0,u.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),y=(0,u.useCallback)(e=>{try{localStorage.setItem(f,JSON.stringify(e)),i.info(`Draft saved`)}catch{}},[]);return(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`create-app-page`,children:(0,d.jsx)(l,{availableObjects:h,initialDraft:g(),onComplete:_,onCancel:v,onSaveDraft:y})})}export{p as CreateAppPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,n,w as r}from"./framework-DJlDX9E6.js";import{St as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-DDpLaQOV.js";import{n as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=r(),f=`objectui-app-wizard-draft`;function p(){let e=a(),{appName:t}=o(),{objects:r,refresh:p}=s(),m=c(),h=(r||[]).map(e=>({name:e.name,label:e.label||e.name,icon:e.icon,selected:!1})),g=(0,u.useCallback)(()=>{try{let e=localStorage.getItem(f);if(e)return JSON.parse(e)}catch{}},[]),_=(0,u.useCallback)(async t=>{try{let r=n(t),a=m?.getClient();a&&await a.meta.saveItem(`app`,t.name,r),localStorage.removeItem(f),i.success(`Application "${t.title}" created successfully`),await p?.(),e(`/apps/${t.name}`)}catch(e){i.error(e?.message||`Failed to create application`)}},[e,p,m]),v=(0,u.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),y=(0,u.useCallback)(e=>{try{localStorage.setItem(f,JSON.stringify(e)),i.info(`Draft saved`)}catch{}},[]);return(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`create-app-page`,children:(0,d.jsx)(l,{availableObjects:h,initialDraft:g(),onComplete:_,onCancel:v,onSaveDraft:y})})}export{p as CreateAppPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{St as r,gl as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-RiB5-8aY.js";import{t as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=n();function f(){let e=a(),{dashboardName:t}=o(),n=c(),{dashboards:f,refresh:p}=s(),m=f?.find(e=>e.name===t),[h,g]=(0,u.useState)(()=>m||{type:`dashboard`,name:t??``,title:t??``,columns:2,widgets:[]}),_=(0,u.useRef)(h);_.current=h;let v=(0,u.useCallback)(async e=>{try{if(n)return await n.update(`sys_dashboard`,t,e),p().catch(()=>{}),!0}catch{}return!1},[n,t,p]),y=(0,u.useCallback)(async e=>{g(e),await v(e)},[v]);(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),v(_.current).then(e=>{e&&r.success(`Dashboard saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]);let b=(0,u.useCallback)(e=>{let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${t||`dashboard`}.json`,a.click(),URL.revokeObjectURL(i),r.success(`Dashboard schema exported`)},[t]),x=(0,u.useCallback)(e=>{r.success(`Dashboard schema imported`),y(e)},[y]);return m?(0,d.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`dashboard-design-page`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`dashboard-design-back`,children:(0,d.jsx)(i,{className:`h-4 w-4`})}),(0,d.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Dashboard: `,m.label||m.title||t]})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,d.jsx)(l,{schema:h,onChange:y,onExport:b,onImport:x})})]}):(0,d.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Dashboard "`,t,`" not found`]})}export{f as DashboardDesignPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{St as r,gl as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-DDpLaQOV.js";import{t as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=n();function f(){let e=a(),{dashboardName:t}=o(),n=c(),{dashboards:f,refresh:p}=s(),m=f?.find(e=>e.name===t),[h,g]=(0,u.useState)(()=>m||{type:`dashboard`,name:t??``,title:t??``,columns:2,widgets:[]}),_=(0,u.useRef)(h);_.current=h;let v=(0,u.useCallback)(async e=>{try{if(n)return await n.update(`sys_dashboard`,t,e),p().catch(()=>{}),!0}catch{}return!1},[n,t,p]),y=(0,u.useCallback)(async e=>{g(e),await v(e)},[v]);(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),v(_.current).then(e=>{e&&r.success(`Dashboard saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]);let b=(0,u.useCallback)(e=>{let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${t||`dashboard`}.json`,a.click(),URL.revokeObjectURL(i),r.success(`Dashboard schema exported`)},[t]),x=(0,u.useCallback)(e=>{r.success(`Dashboard schema imported`),y(e)},[y]);return m?(0,d.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`dashboard-design-page`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`dashboard-design-back`,children:(0,d.jsx)(i,{className:`h-4 w-4`})}),(0,d.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Dashboard: `,m.label||m.title||t]})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,d.jsx)(l,{schema:h,onChange:y,onExport:b,onImport:x})})]}):(0,d.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Dashboard "`,t,`" not found`]})}export{f as DashboardDesignPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Gs as i,Jo as a,al as o,ct as s,ds as c,gc as l,gs as u,hc as ee,lt as d,ol as f,rl as p,st as te,us as m}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{u as ne}from"./ui-layout-DdDX0gzI.js";import{p as h}from"./infrastructure-C6Ph6Ug0.js";import{a as g,i as _,r as v}from"./plugins-views-CE0VP3vl.js";import{c as y,i as b,o as x,r as S,s as C}from"./index-RiB5-8aY.js";import{n as w}from"./skeletons-DcGqw3b1.js";var T=e(t(),1),E=n(),D=[{type:`metric`,label:`KPI Metric`,Icon:m},{type:`bar`,label:`Bar Chart`,Icon:f},{type:`line`,label:`Line Chart`,Icon:o},{type:`pie`,label:`Pie Chart`,Icon:p},{type:`table`,label:`Table`,Icon:u},{type:`grid`,label:`Grid`,Icon:l}],O=0;function k(){return O+=1,`widget_${Date.now()}_${O}`}function A(e){return!e.widgets?.length||!e.widgets.some(e=>!e.id)?e:{...e,widgets:e.widgets.map(e=>e.id?e:{...e,id:k()})}}function j(e){let t=D.find(t=>t.type===e);return t?`New ${t.label}`:`New Widget`}function M(e){return{title:e.title??``,description:e.description??``,type:e.type??`metric`,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??`count`,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``}}function N(e,t){return{title:e.title,description:e.description,type:e.type,object:e.object,categoryField:e.categoryField,valueField:e.valueField,aggregate:e.aggregate,layout:{...t.layout||{},w:e.layoutW,h:e.layoutH},colorVariant:e.colorVariant,actionUrl:e.actionUrl}}function P(e){return{columns:e.columns??3,gap:e.gap??4,rowHeight:String(e.rowHeight??`120`),refreshInterval:String(e.refreshInterval??`0`),title:e.title??``,showDescription:e.showDescription??!0,theme:e.theme??`auto`}}function F({dataSource:e}){let{dashboardName:t}=ne(),{showDebug:n}=b(),o=C(),{t:l}=h(),[u,f]=(0,T.useState)(!0),[p,m]=(0,T.useState)(!1),[O,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(0);(0,T.useEffect)(()=>{f(!0),U(null),m(!1),F(null),queueMicrotask(()=>f(!1))},[t]);let{dashboards:R,objects:z,refresh:B}=y(),V=R?.find(e=>e.name===t),[H,U]=(0,T.useState)(null);(0,T.useEffect)(()=>{p||U(null)},[V]);let W=(0,T.useCallback)(async e=>{try{o&&(await o.update(`sys_dashboard`,t,e),B().catch(()=>{}))}catch(e){console.warn(`[DashboardView] Auto-save failed:`,e)}},[o,t,B]),G=(0,T.useCallback)(()=>{U(A(V)),m(!0),L(e=>e+1)},[V]),K=(0,T.useCallback)(()=>{m(!1),F(null)},[]),q=(0,T.useCallback)(e=>{if(!H)return;let t=k(),n={id:t,title:j(e),type:e,layout:{x:0,y:H.widgets?.length??0,w:H.columns??2,h:1}},r={...H,widgets:[...H.widgets||[],n]};U(r),W(r),F(t),L(e=>e+1)},[H,W]),J=(0,T.useCallback)(e=>{if(!H)return;let t={...H,widgets:H.widgets.filter(t=>t.id!==e)};U(t),W(t),O===e&&F(null)},[H,O,W]),Y=(0,T.useMemo)(()=>P(H||V),[I]),X=(0,T.useCallback)(e=>{if(!H)return;let t={...H,columns:e.columns,gap:e.gap,rowHeight:e.rowHeight,refreshInterval:Number(e.refreshInterval)||0,title:e.title,showDescription:e.showDescription,theme:e.theme};U(t),W(t),L(e=>e+1)},[H,W]),Z=(0,T.useCallback)((e,t)=>{H&&U(n=>n&&(e===`refreshInterval`?{...n,refreshInterval:Number(t)||0}:{...n,[e]:t}))},[H]),Q=H?.widgets?.find(e=>e.id===O),re=(0,T.useMemo)(()=>Q?M(Q):{},[O,I]),ie=(0,T.useCallback)(e=>{if(!H||!O||!Q)return;let t=N(e,Q),n={...H,widgets:H.widgets.map(e=>e.id===O?{...e,...t}:e)};U(n),W(n),L(e=>e+1)},[H,O,Q,W]),ae=(0,T.useCallback)((e,t)=>{O&&U(n=>{if(!n)return n;let r=n.widgets?.find(e=>e.id===O);if(!r)return n;let i=M(r);i[e]=t;let a=N(i,r);return{...n,widgets:n.widgets.map(e=>e.id===O?{...e,...a}:e)}})},[O]),oe=(0,T.useMemo)(()=>{if(z?.length)return z.map(e=>({value:e.name,label:e.label||e.name}))},[z]),se=(0,T.useMemo)(()=>{let e=Q?.object;if(!e||!z?.length)return;let t=z.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.filter(e=>e.name).map(e=>({value:e.name,label:e.label||e.name})):Object.entries(n).map(([e,t])=>({value:e,label:t.label||e}))},[Q?.object,z]);if(u)return(0,E.jsx)(w,{});if(!V)return(0,E.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,E.jsxs)(te,{children:[(0,E.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,E.jsx)(ee,{className:`h-6 w-6 text-muted-foreground`})}),(0,E.jsx)(d,{children:`Dashboard Not Found`}),(0,E.jsxs)(s,{children:[`The dashboard "`,t,`" could not be found. It may have been removed or renamed.`]})]})});let $=H||V;return(0,E.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,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:[(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:x(V.label,l)||V.name}),V.description&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:x(V.description,l)})]}),(0,E.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:[p&&(0,E.jsx)(`div`,{className:`flex items-center gap-1 mr-2`,"data-testid":`dashboard-widget-toolbar`,children:D.map(({type:e,label:t,Icon:n})=>(0,E.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>q(e),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 ${t}`,children:[(0,E.jsx)(r,{className:`h-3 w-3`}),(0,E.jsx)(n,{className:`h-3 w-3`})]},e))}),(0,E.jsxs)(`button`,{type:`button`,onClick:G,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:[(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),`Edit`]})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,E.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-0 sm:p-6`,children:(0,E.jsx)(g,{schema:$,dataSource:e,designMode:p,selectedWidgetId:O,onWidgetClick:F})}),Q?(0,E.jsx)(v,{open:p,onClose:K,config:re,onSave:ie,onFieldChange:ae,availableObjects:oe,availableFields:se,headerExtra:(0,E.jsx)(a,{size:`sm`,variant:`ghost`,onClick:()=>J(O),className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,"data-testid":`widget-delete-button`,title:`Delete widget`,children:(0,E.jsx)(c,{className:`h-3.5 w-3.5`})})},O):(0,E.jsx)(_,{open:p,onClose:K,config:Y,onSave:X,onFieldChange:Z}),(0,E.jsx)(S,{open:n,sections:[{title:`Dashboard Configuration`,data:$}]})]})]})}export{F as DashboardView};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Gs as i,Jo as a,al as o,ct as s,ds as c,gc as l,gs as u,hc as ee,lt as d,ol as f,rl as p,st as te,us as m}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{u as ne}from"./ui-layout-DdDX0gzI.js";import{p as h}from"./infrastructure-C6Ph6Ug0.js";import{a as g,i as _,r as v}from"./plugins-views-CE0VP3vl.js";import{c as y,i as b,o as x,r as S,s as C}from"./index-DDpLaQOV.js";import{n as w}from"./skeletons-DcGqw3b1.js";var T=e(t(),1),E=n(),D=[{type:`metric`,label:`KPI Metric`,Icon:m},{type:`bar`,label:`Bar Chart`,Icon:f},{type:`line`,label:`Line Chart`,Icon:o},{type:`pie`,label:`Pie Chart`,Icon:p},{type:`table`,label:`Table`,Icon:u},{type:`grid`,label:`Grid`,Icon:l}],O=0;function k(){return O+=1,`widget_${Date.now()}_${O}`}function A(e){return!e.widgets?.length||!e.widgets.some(e=>!e.id)?e:{...e,widgets:e.widgets.map(e=>e.id?e:{...e,id:k()})}}function j(e){let t=D.find(t=>t.type===e);return t?`New ${t.label}`:`New Widget`}function M(e){return{title:e.title??``,description:e.description??``,type:e.type??`metric`,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??`count`,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``}}function N(e,t){return{title:e.title,description:e.description,type:e.type,object:e.object,categoryField:e.categoryField,valueField:e.valueField,aggregate:e.aggregate,layout:{...t.layout||{},w:e.layoutW,h:e.layoutH},colorVariant:e.colorVariant,actionUrl:e.actionUrl}}function P(e){return{columns:e.columns??3,gap:e.gap??4,rowHeight:String(e.rowHeight??`120`),refreshInterval:String(e.refreshInterval??`0`),title:e.title??``,showDescription:e.showDescription??!0,theme:e.theme??`auto`}}function F({dataSource:e}){let{dashboardName:t}=ne(),{showDebug:n}=b(),o=C(),{t:l}=h(),[u,f]=(0,T.useState)(!0),[p,m]=(0,T.useState)(!1),[O,F]=(0,T.useState)(null),[I,L]=(0,T.useState)(0);(0,T.useEffect)(()=>{f(!0),U(null),m(!1),F(null),queueMicrotask(()=>f(!1))},[t]);let{dashboards:R,objects:z,refresh:B}=y(),V=R?.find(e=>e.name===t),[H,U]=(0,T.useState)(null);(0,T.useEffect)(()=>{p||U(null)},[V]);let W=(0,T.useCallback)(async e=>{try{o&&(await o.update(`sys_dashboard`,t,e),B().catch(()=>{}))}catch(e){console.warn(`[DashboardView] Auto-save failed:`,e)}},[o,t,B]),G=(0,T.useCallback)(()=>{U(A(V)),m(!0),L(e=>e+1)},[V]),K=(0,T.useCallback)(()=>{m(!1),F(null)},[]),q=(0,T.useCallback)(e=>{if(!H)return;let t=k(),n={id:t,title:j(e),type:e,layout:{x:0,y:H.widgets?.length??0,w:H.columns??2,h:1}},r={...H,widgets:[...H.widgets||[],n]};U(r),W(r),F(t),L(e=>e+1)},[H,W]),J=(0,T.useCallback)(e=>{if(!H)return;let t={...H,widgets:H.widgets.filter(t=>t.id!==e)};U(t),W(t),O===e&&F(null)},[H,O,W]),Y=(0,T.useMemo)(()=>P(H||V),[I]),X=(0,T.useCallback)(e=>{if(!H)return;let t={...H,columns:e.columns,gap:e.gap,rowHeight:e.rowHeight,refreshInterval:Number(e.refreshInterval)||0,title:e.title,showDescription:e.showDescription,theme:e.theme};U(t),W(t),L(e=>e+1)},[H,W]),Z=(0,T.useCallback)((e,t)=>{H&&U(n=>n&&(e===`refreshInterval`?{...n,refreshInterval:Number(t)||0}:{...n,[e]:t}))},[H]),Q=H?.widgets?.find(e=>e.id===O),re=(0,T.useMemo)(()=>Q?M(Q):{},[O,I]),ie=(0,T.useCallback)(e=>{if(!H||!O||!Q)return;let t=N(e,Q),n={...H,widgets:H.widgets.map(e=>e.id===O?{...e,...t}:e)};U(n),W(n),L(e=>e+1)},[H,O,Q,W]),ae=(0,T.useCallback)((e,t)=>{O&&U(n=>{if(!n)return n;let r=n.widgets?.find(e=>e.id===O);if(!r)return n;let i=M(r);i[e]=t;let a=N(i,r);return{...n,widgets:n.widgets.map(e=>e.id===O?{...e,...a}:e)}})},[O]),oe=(0,T.useMemo)(()=>{if(z?.length)return z.map(e=>({value:e.name,label:e.label||e.name}))},[z]),se=(0,T.useMemo)(()=>{let e=Q?.object;if(!e||!z?.length)return;let t=z.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.filter(e=>e.name).map(e=>({value:e.name,label:e.label||e.name})):Object.entries(n).map(([e,t])=>({value:e,label:t.label||e}))},[Q?.object,z]);if(u)return(0,E.jsx)(w,{});if(!V)return(0,E.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,E.jsxs)(te,{children:[(0,E.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,E.jsx)(ee,{className:`h-6 w-6 text-muted-foreground`})}),(0,E.jsx)(d,{children:`Dashboard Not Found`}),(0,E.jsxs)(s,{children:[`The dashboard "`,t,`" could not be found. It may have been removed or renamed.`]})]})});let $=H||V;return(0,E.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,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:[(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:x(V.label,l)||V.name}),V.description&&(0,E.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:x(V.description,l)})]}),(0,E.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:[p&&(0,E.jsx)(`div`,{className:`flex items-center gap-1 mr-2`,"data-testid":`dashboard-widget-toolbar`,children:D.map(({type:e,label:t,Icon:n})=>(0,E.jsxs)(`button`,{type:`button`,"data-testid":`dashboard-add-${e}`,onClick:()=>q(e),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 ${t}`,children:[(0,E.jsx)(r,{className:`h-3 w-3`}),(0,E.jsx)(n,{className:`h-3 w-3`})]},e))}),(0,E.jsxs)(`button`,{type:`button`,onClick:G,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:[(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),`Edit`]})]})]}),(0,E.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,E.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-0 sm:p-6`,children:(0,E.jsx)(g,{schema:$,dataSource:e,designMode:p,selectedWidgetId:O,onWidgetClick:F})}),Q?(0,E.jsx)(v,{open:p,onClose:K,config:re,onSave:ie,onFieldChange:ae,availableObjects:oe,availableFields:se,headerExtra:(0,E.jsx)(a,{size:`sm`,variant:`ghost`,onClick:()=>J(O),className:`h-7 w-7 p-0 text-destructive hover:text-destructive`,"data-testid":`widget-delete-button`,title:`Delete widget`,children:(0,E.jsx)(c,{className:`h-3.5 w-3.5`})})},O):(0,E.jsx)(_,{open:p,onClose:K,config:Y,onSave:X,onFieldChange:Z}),(0,E.jsx)(S,{open:n,sections:[{title:`Dashboard Configuration`,data:$}]})]})]})}export{F as DashboardView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,n,w as r}from"./framework-DJlDX9E6.js";import{St as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-RiB5-8aY.js";import{n as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=r();function f(){let e=a(),{appName:t,editAppName:r}=o(),{apps:f,objects:p,refresh:m}=s(),h=c(),g=r||t,_=f.find(e=>e.name===g),v=(p||[]).map(e=>({name:e.name,label:e.label||e.name,icon:e.icon,selected:_?.navigation?.some(t=>t.type===`object`&&t.objectName===e.name)??!1})),y=(0,u.useMemo)(()=>{if(_)return{name:_.name,title:_.title||_.label||``,description:_.description||``,icon:_.icon||``,layout:_.layout||`sidebar`,navigation:_.navigation||[],branding:{logo:_.branding?.logo||_.logo||``,primaryColor:_.branding?.primaryColor||`#3b82f6`,favicon:_.branding?.favicon||_.favicon||``}}},[_]),b=(0,u.useCallback)(async t=>{try{let r=n(t),a={..._,...r},o=h?.getClient();o&&await o.meta.saveItem(`app`,t.name,a),i.success(`Application "${t.title}" updated successfully`),await m?.(),e(`/apps/${t.name}`)}catch(e){i.error(e?.message||`Failed to update application`)}},[e,m,h,_]),x=(0,u.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),S=(0,u.useCallback)(e=>{try{localStorage.setItem(`objectui-edit-draft-${g}`,JSON.stringify(e)),i.info(`Draft saved`)}catch{}},[g]);return _?(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`edit-app-page`,children:(0,d.jsx)(l,{availableObjects:v,initialDraft:y,onComplete:b,onCancel:x,onSaveDraft:S})}):(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4 text-center`,"data-testid":`edit-app-not-found`,children:(0,d.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Application "`,g,`" not found.`]})})}export{f as EditAppPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,n,w as r}from"./framework-DJlDX9E6.js";import{St as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-DDpLaQOV.js";import{n as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=r();function f(){let e=a(),{appName:t,editAppName:r}=o(),{apps:f,objects:p,refresh:m}=s(),h=c(),g=r||t,_=f.find(e=>e.name===g),v=(p||[]).map(e=>({name:e.name,label:e.label||e.name,icon:e.icon,selected:_?.navigation?.some(t=>t.type===`object`&&t.objectName===e.name)??!1})),y=(0,u.useMemo)(()=>{if(_)return{name:_.name,title:_.title||_.label||``,description:_.description||``,icon:_.icon||``,layout:_.layout||`sidebar`,navigation:_.navigation||[],branding:{logo:_.branding?.logo||_.logo||``,primaryColor:_.branding?.primaryColor||`#3b82f6`,favicon:_.branding?.favicon||_.favicon||``}}},[_]),b=(0,u.useCallback)(async t=>{try{let r=n(t),a={..._,...r},o=h?.getClient();o&&await o.meta.saveItem(`app`,t.name,a),i.success(`Application "${t.title}" updated successfully`),await m?.(),e(`/apps/${t.name}`)}catch(e){i.error(e?.message||`Failed to update application`)}},[e,m,h,_]),x=(0,u.useCallback)(()=>{e(t?`/apps/${t}`:`/`)},[e,t]),S=(0,u.useCallback)(e=>{try{localStorage.setItem(`objectui-edit-draft-${g}`,JSON.stringify(e)),i.info(`Draft saved`)}catch{}},[g]);return _?(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4`,"data-testid":`edit-app-page`,children:(0,d.jsx)(l,{availableObjects:v,initialDraft:y,onComplete:b,onCancel:x,onSaveDraft:S})}):(0,d.jsx)(`div`,{className:`mx-auto max-w-4xl py-8 px-4 text-center`,"data-testid":`edit-app-not-found`,children:(0,d.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Application "`,g,`" not found.`]})})}export{f as EditAppPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Jo as a,Po as o,So as s,St as c,dc as l,ds as u,ll as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-RiB5-8aY.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_org`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_org`)).data||[])}catch{c.error(`Failed to load organizations`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_org`,{name:`New Organization`,slug:``,plan:`free`,status:`active`}),c.success(`Organization created`),S()}catch{c.error(`Failed to create organization`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_org`,e),c.success(`Organization deleted`),S()}catch{c.error(`Failed to delete organization`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(d,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Organization Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Manage organizations and their members`})]})]}),t&&(0,g.jsxs)(a,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add Organization`]})]}),(0,g.jsx)(s,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(l,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No organizations found.`}),(0,g.jsx)(o,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(u,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as OrgManagementPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Jo as a,Po as o,So as s,St as c,dc as l,ds as u,ll as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-DDpLaQOV.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_org`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_org`)).data||[])}catch{c.error(`Failed to load organizations`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_org`,{name:`New Organization`,slug:``,plan:`free`,status:`active`}),c.success(`Organization created`),S()}catch{c.error(`Failed to create organization`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_org`,e),c.success(`Organization deleted`),S()}catch{c.error(`Failed to delete organization`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(d,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Organization Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Manage organizations and their members`})]})]}),t&&(0,g.jsxs)(a,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add Organization`]})]}),(0,g.jsx)(s,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(l,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No organizations found.`}),(0,g.jsx)(o,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(u,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as OrgManagementPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{St as r,gl as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-RiB5-8aY.js";import{PageCanvasEditor as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=n();function f(){let e=a(),{pageName:t}=o(),n=c(),{pages:f}=s(),p=f?.find(e=>e.name===t),[m,h]=(0,u.useState)(()=>p||{type:`page`,name:t??``,title:t??``,children:[]}),g=(0,u.useRef)(m);g.current=m;let _=(0,u.useCallback)(async e=>{try{if(n)return await n.update(`sys_page`,t,e),!0}catch{}return!1},[n,t]),v=(0,u.useCallback)(async e=>{h(e),await _(e)},[_]);(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_(g.current).then(e=>{e&&r.success(`Page saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]);let y=(0,u.useCallback)(e=>{let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${t||`page`}.json`,a.click(),URL.revokeObjectURL(i),r.success(`Page schema exported`)},[t]),b=(0,u.useCallback)(e=>{r.success(`Page schema imported`),v(e)},[v]);return p?(0,d.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`page-design-page`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`page-design-back`,children:(0,d.jsx)(i,{className:`h-4 w-4`})}),(0,d.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Page: `,p.label||p.title||t]})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,d.jsx)(l,{schema:m,onChange:v,onExport:y,onImport:b})})]}):(0,d.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Page "`,t,`" not found`]})}export{f as PageDesignPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{St as r,gl as i}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as a,u as o}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as s,s as c}from"./index-DDpLaQOV.js";import{PageCanvasEditor as l}from"./src-oeWLmiqa.js";var u=e(t(),1),d=n();function f(){let e=a(),{pageName:t}=o(),n=c(),{pages:f}=s(),p=f?.find(e=>e.name===t),[m,h]=(0,u.useState)(()=>p||{type:`page`,name:t??``,title:t??``,children:[]}),g=(0,u.useRef)(m);g.current=m;let _=(0,u.useCallback)(async e=>{try{if(n)return await n.update(`sys_page`,t,e),!0}catch{}return!1},[n,t]),v=(0,u.useCallback)(async e=>{h(e),await _(e)},[_]);(0,u.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_(g.current).then(e=>{e&&r.success(`Page saved`)}))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]);let y=(0,u.useCallback)(e=>{let n=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${t||`page`}.json`,a.click(),URL.revokeObjectURL(i),r.success(`Page schema exported`)},[t]),b=(0,u.useCallback)(e=>{r.success(`Page schema imported`),v(e)},[v]);return p?(0,d.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`page-design-page`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 sm:px-6`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>e(-1),className:`rounded p-1.5 text-muted-foreground hover:text-foreground`,"aria-label":`Go back`,"data-testid":`page-design-back`,children:(0,d.jsx)(i,{className:`h-4 w-4`})}),(0,d.jsxs)(`h1`,{className:`text-lg font-semibold tracking-tight truncate`,children:[`Edit Page: `,p.label||p.title||t]})]}),(0,d.jsx)(`div`,{className:`flex-1 overflow-auto p-4 sm:p-6`,children:(0,d.jsx)(l,{schema:m,onChange:v,onExport:y,onImport:b})})]}):(0,d.jsxs)(`div`,{className:`h-full flex items-center justify-center text-muted-foreground`,children:[`Page "`,t,`" not found`]})}export{f as PageDesignPage};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/src-oeWLmiqa.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/infrastructure-C6Ph6Ug0.js","assets/framework-DJlDX9E6.js","assets/plugins-core-PiAAytWV.js","assets/data-adapter-wZ81OFjZ.js","assets/plugins-core-Cfhp_BXE.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,v as n,w as r}from"./framework-DJlDX9E6.js";import{Gs as i,Gt as a,Jt as o,Kt as s,Pc as c,St as l,Wt as u,ct as d,lt as f,qt as p,st as m}from"./plugins-core-PiAAytWV.js";import{S as h}from"./data-adapter-wZ81OFjZ.js";import{d as g,u as _}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as v,i as y,r as b,s as x}from"./index-RiB5-8aY.js";var S=e(t(),1),C=r();function w({open:e,onOpenChange:t,title:n,description:r,schema:i,onSchemaChange:c,collection:d,recordName:f,children:m}){let h=x(),g=(0,S.useRef)(i);g.current=i;let _=(0,S.useCallback)(async e=>{try{if(h)return await h.update(d,f,e),!0}catch(e){console.warn(`[DesignDrawer] Auto-save failed:`,e)}return!1},[h,d,f]),v=(0,S.useCallback)(async e=>{c(e),await _(e)},[c,_]);return(0,S.useEffect)(()=>{if(!e)return;let t=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_(g.current).then(e=>{e&&l.success(`${n} saved`)}))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,_,n]),(0,C.jsx)(u,{open:e,onOpenChange:t,modal:!1,children:(0,C.jsxs)(a,{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:[(0,C.jsxs)(p,{className:`px-4 py-3 border-b shrink-0`,children:[(0,C.jsx)(o,{children:n}),(0,C.jsx)(s,{className:r?``:`sr-only`,children:r||`Visual editor — configure and preview ${n}`})]}),(0,C.jsx)(`div`,{className:`flex-1 overflow-auto p-4`,children:m(i,v)})]})})}var T=(0,S.lazy)(()=>h(()=>import(`./src-oeWLmiqa.js`).then(e=>({default:e.PageCanvasEditor})),__vite__mapDeps([0,1,2,3,4,5,6])));function E(){let{pageName:e}=_(),[t]=g(),{showDebug:r}=y(),[a,o]=(0,S.useState)(!1),{pages:s}=v(),l=s?.find(t=>t.name===e),[u,p]=(0,S.useState)(null),h=(0,S.useCallback)(()=>{p(l),o(!0)},[l]),x=(0,S.useCallback)(e=>{o(e)},[]);if(!l)return(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(m,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(c,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:`Page Not Found`}),(0,C.jsxs)(d,{children:[`The page "`,e,`" could not be found. It may have been removed or renamed.`]})]})});let E=Object.fromEntries(t.entries()),D=a&&u?u:l;return(0,C.jsxs)(`div`,{className:`flex flex-row h-full w-full overflow-hidden relative`,children:[(0,C.jsxs)(`div`,{className:`flex-1 overflow-auto h-full relative group`,children:[(0,C.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 ${r?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:h,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:[(0,C.jsx)(i,{className:`h-3.5 w-3.5`}),`Edit`]})}),(0,C.jsx)(n,{schema:{...D,type:D.type||`page`,context:{...D.context,params:E}}})]}),(0,C.jsx)(b,{open:r,sections:[{title:`Page Configuration`,data:D}]}),(0,C.jsx)(w,{open:a,onOpenChange:x,title:`Edit Page: ${l.label||l.title||e}`,schema:u||l,onSchemaChange:p,collection:`sys_page`,recordName:e,children:(e,t)=>(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(`div`,{className:`p-4 text-muted-foreground`,children:`Loading editor…`}),children:(0,C.jsx)(T,{schema:e,onChange:t})})})]})}export{E as PageView};
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,v as n,w as r}from"./framework-DJlDX9E6.js";import{Gs as i,Gt as a,Jt as o,Kt as s,Pc as c,St as l,Wt as u,ct as d,lt as f,qt as p,st as m}from"./plugins-core-PiAAytWV.js";import{S as h}from"./data-adapter-wZ81OFjZ.js";import{d as g,u as _}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as v,i as y,r as b,s as x}from"./index-DDpLaQOV.js";var S=e(t(),1),C=r();function w({open:e,onOpenChange:t,title:n,description:r,schema:i,onSchemaChange:c,collection:d,recordName:f,children:m}){let h=x(),g=(0,S.useRef)(i);g.current=i;let _=(0,S.useCallback)(async e=>{try{if(h)return await h.update(d,f,e),!0}catch(e){console.warn(`[DesignDrawer] Auto-save failed:`,e)}return!1},[h,d,f]),v=(0,S.useCallback)(async e=>{c(e),await _(e)},[c,_]);return(0,S.useEffect)(()=>{if(!e)return;let t=e=>{(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),_(g.current).then(e=>{e&&l.success(`${n} saved`)}))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,_,n]),(0,C.jsx)(u,{open:e,onOpenChange:t,modal:!1,children:(0,C.jsxs)(a,{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:[(0,C.jsxs)(p,{className:`px-4 py-3 border-b shrink-0`,children:[(0,C.jsx)(o,{children:n}),(0,C.jsx)(s,{className:r?``:`sr-only`,children:r||`Visual editor — configure and preview ${n}`})]}),(0,C.jsx)(`div`,{className:`flex-1 overflow-auto p-4`,children:m(i,v)})]})})}var T=(0,S.lazy)(()=>h(()=>import(`./src-oeWLmiqa.js`).then(e=>({default:e.PageCanvasEditor})),__vite__mapDeps([0,1,2,3,4,5,6])));function E(){let{pageName:e}=_(),[t]=g(),{showDebug:r}=y(),[a,o]=(0,S.useState)(!1),{pages:s}=v(),l=s?.find(t=>t.name===e),[u,p]=(0,S.useState)(null),h=(0,S.useCallback)(()=>{p(l),o(!0)},[l]),x=(0,S.useCallback)(e=>{o(e)},[]);if(!l)return(0,C.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,C.jsxs)(m,{children:[(0,C.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,C.jsx)(c,{className:`h-6 w-6 text-muted-foreground`})}),(0,C.jsx)(f,{children:`Page Not Found`}),(0,C.jsxs)(d,{children:[`The page "`,e,`" could not be found. It may have been removed or renamed.`]})]})});let E=Object.fromEntries(t.entries()),D=a&&u?u:l;return(0,C.jsxs)(`div`,{className:`flex flex-row h-full w-full overflow-hidden relative`,children:[(0,C.jsxs)(`div`,{className:`flex-1 overflow-auto h-full relative group`,children:[(0,C.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 ${r?`opacity-100`:`opacity-0 group-hover:opacity-100`}`,children:(0,C.jsxs)(`button`,{type:`button`,onClick:h,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:[(0,C.jsx)(i,{className:`h-3.5 w-3.5`}),`Edit`]})}),(0,C.jsx)(n,{schema:{...D,type:D.type||`page`,context:{...D.context,params:E}}})]}),(0,C.jsx)(b,{open:r,sections:[{title:`Page Configuration`,data:D}]}),(0,C.jsx)(w,{open:a,onOpenChange:x,title:`Edit Page: ${l.label||l.title||e}`,schema:u||l,onSchemaChange:p,collection:`sys_page`,recordName:e,children:(e,t)=>(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(`div`,{className:`p-4 text-muted-foreground`,children:`Loading editor…`}),children:(0,C.jsx)(T,{schema:e,onChange:t})})})]})}export{E as PageView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Jo as i,Ms as a,Po as o,St as s,dc as c,ds as l,on as u,vc as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-RiB5-8aY.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_permission`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),[S,C]=(0,h.useState)(``),w=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_permission`)).data||[])}catch{s.error(`Failed to load permissions`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{w()},[w]);let T=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_permission`,{name:`New Permission`,description:``,resource:``,action:`read`}),s.success(`Permission created`),w()}catch{s.error(`Failed to create permission`)}},[n,w]),E=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_permission`,e),s.success(`Permission deleted`),w()}catch{s.error(`Failed to delete permission`)}},[n,w]),D=m.filter(e=>{if(!S)return!0;let t=S.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.resource||``).toLowerCase().includes(t)||(e.action||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)});return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,g.jsx)(d,{className:`h-5 w-5 text-muted-foreground`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Permissions`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage permission rules and assignments`})]})]}),t&&(0,g.jsxs)(i,{onClick:T,"data-testid":`add-permission-btn`,children:[(0,g.jsx)(r,{className:`h-4 w-4 mr-2`}),`Add Permission`]})]}),(0,g.jsxs)(`div`,{className:`relative max-w-sm`,children:[(0,g.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,g.jsx)(u,{placeholder:`Search permissions...`,value:S,onChange:e=>C(e.target.value),className:`pl-8`,"data-testid":`permission-search-input`})]}),b?(0,g.jsxs)(`div`,{className:`flex items-center gap-2 py-8 justify-center text-muted-foreground`,children:[(0,g.jsx)(c,{className:`h-5 w-5 animate-spin`}),(0,g.jsx)(`span`,{children:`Loading permissions...`})]}):D.length===0?(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No permissions found.`}):(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`permissions-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b text-left`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`py-2 px-3 font-medium text-muted-foreground capitalize`,children:_.fields.find(t=>t.name===e)?.label||e},e)),t&&(0,g.jsx)(`th`,{className:`py-2 px-3 font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:D.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`py-2 px-3`,children:t===`action`?(0,g.jsx)(o,{variant:`outline`,children:e[t]}):(0,g.jsx)(`span`,{className:`truncate`,children:e[t]??`—`})},t)),t&&(0,g.jsx)(`td`,{className:`py-2 px-3`,children:(0,g.jsx)(i,{variant:`ghost`,size:`icon`,onClick:()=>E(e.id),children:(0,g.jsx)(l,{className:`h-4 w-4`})})})]},e.id))})]})})]})}export{y as PermissionManagementPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Jo as i,Ms as a,Po as o,St as s,dc as c,ds as l,on as u,vc as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-DDpLaQOV.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_permission`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),[S,C]=(0,h.useState)(``),w=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_permission`)).data||[])}catch{s.error(`Failed to load permissions`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{w()},[w]);let T=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_permission`,{name:`New Permission`,description:``,resource:``,action:`read`}),s.success(`Permission created`),w()}catch{s.error(`Failed to create permission`)}},[n,w]),E=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_permission`,e),s.success(`Permission deleted`),w()}catch{s.error(`Failed to delete permission`)}},[n,w]),D=m.filter(e=>{if(!S)return!0;let t=S.toLowerCase();return(e.name||``).toLowerCase().includes(t)||(e.resource||``).toLowerCase().includes(t)||(e.action||``).toLowerCase().includes(t)||(e.description||``).toLowerCase().includes(t)});return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,g.jsx)(d,{className:`h-5 w-5 text-muted-foreground`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Permissions`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Manage permission rules and assignments`})]})]}),t&&(0,g.jsxs)(i,{onClick:T,"data-testid":`add-permission-btn`,children:[(0,g.jsx)(r,{className:`h-4 w-4 mr-2`}),`Add Permission`]})]}),(0,g.jsxs)(`div`,{className:`relative max-w-sm`,children:[(0,g.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,g.jsx)(u,{placeholder:`Search permissions...`,value:S,onChange:e=>C(e.target.value),className:`pl-8`,"data-testid":`permission-search-input`})]}),b?(0,g.jsxs)(`div`,{className:`flex items-center gap-2 py-8 justify-center text-muted-foreground`,children:[(0,g.jsx)(c,{className:`h-5 w-5 animate-spin`}),(0,g.jsx)(`span`,{children:`Loading permissions...`})]}):D.length===0?(0,g.jsx)(`p`,{className:`text-muted-foreground text-center py-8`,children:`No permissions found.`}):(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,"data-testid":`permissions-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b text-left`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`py-2 px-3 font-medium text-muted-foreground capitalize`,children:_.fields.find(t=>t.name===e)?.label||e},e)),t&&(0,g.jsx)(`th`,{className:`py-2 px-3 font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:D.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`py-2 px-3`,children:t===`action`?(0,g.jsx)(o,{variant:`outline`,children:e[t]}):(0,g.jsx)(`span`,{className:`truncate`,children:e[t]??`—`})},t)),t&&(0,g.jsx)(`td`,{className:`py-2 px-3`,children:(0,g.jsx)(i,{variant:`ghost`,size:`icon`,onClick:()=>E(e.id),children:(0,g.jsx)(l,{className:`h-4 w-4`})})})]},e.id))})]})})]})}export{y as PermissionManagementPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,l as n,w as r}from"./framework-DJlDX9E6.js";import{St as i,Vc as a,ct as o,is as s,lt as c,st as l}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as u,u as d}from"./ui-layout-DdDX0gzI.js";import{c as f,p}from"./infrastructure-C6Ph6Ug0.js";import{o as m,s as h}from"./plugins-views-CE0VP3vl.js";import{a as ee,i as g,n as _,r as v,t as y}from"./index-RiB5-8aY.js";import{t as b}from"./skeletons-DcGqw3b1.js";var x=e(t(),1),S=r(),C={id:`current-user`,name:`Demo User`};function w({dataSource:e,objects:t,onEdit:r}){let{objectName:w,recordId:T}=d(),{showDebug:E}=g(),{user:D}=f(),O=u(),{t:k}=p(),[A,j]=(0,x.useState)(!0),[M,N]=(0,x.useState)([]),[P,F]=(0,x.useState)([]),[I,L]=(0,x.useState)(0),[R,z]=(0,x.useState)({}),B=t.find(e=>e.name===w),V=T,[H,U]=(0,x.useState)({open:!1,message:``}),[W,G]=(0,x.useState)({open:!1,params:[]}),K=(0,x.useCallback)((e,t)=>new Promise(n=>{U({open:!0,message:e,options:t,resolve:n})}),[]),q=(0,x.useCallback)(e=>new Promise(t=>{G({open:!0,params:e,resolve:t})}),[]),J=(0,x.useCallback)((e,t)=>{t?.type===`error`?i.error(e):i.success(e)},[]),Y=(0,x.useCallback)((e,t)=>{t?.external||t?.newTab?window.open(e,`_blank`,`noopener,noreferrer`):O(e)},[O]),X=(0,x.useCallback)(async t=>{try{let n=t.target||t.name,r=t.params||{};switch(n){case`opportunity_change_stage`:await e.update(w,V,{stage:r.new_stage});break;case`opportunity_mark_won`:await e.update(w,V,{stage:`closed_won`});break;case`opportunity_mark_lost`:await e.update(w,V,{stage:`closed_lost`,loss_reason:r.loss_reason});break;default:Object.keys(r).length>0&&await e.update(w,V,r);break}let i=t.refreshAfter===!0;return i&&L(e=>e+1),{success:!0,reload:i}}catch(e){return{success:!1,error:e.message}}},[e,w,V]),Z=(0,x.useMemo)(()=>{if(!B||!t)return[];let e=[];for(let n of t)if(n.name!==B.name)for(let[t,r]of Object.entries(n.fields||{}))r&&(r.type===`lookup`||r.type===`master_detail`)&&(r.reference_to||r.reference)===B.name&&e.push({childObject:n.name,childLabel:n.label||n.name,referenceField:t});return e},[B,t]);(0,x.useEffect)(()=>{if(!e||!V||Z.length===0)return;let t=!1;return Promise.all(Z.map(({childObject:t,referenceField:n})=>e.find(t,{$filter:{[n]:V}}).then(e=>({childObject:t,items:Array.isArray(e)?e:e?.data||[]})).catch(e=>(console.warn(`[RecordDetailView] Failed to fetch related ${t}:`,e),{childObject:t,items:[]})))).then(e=>{if(t)return;let n={};for(let{childObject:t,items:r}of e)n[t]=r;z(n)}),()=>{t=!0}},[e,V,Z]);let Q=D?{id:D.id,name:D.name,avatar:D.image}:C;(0,x.useEffect)(()=>{if(!e||!w||!V)return;let t=`${w}:${V}`;e.find(`sys_presence`,{$filter:{recordId:V}}).then(e=>{e.data?.length&&F(e.data)}).catch(()=>{}),e.find(`sys_comment`,{$filter:{threadId:t},$orderby:{createdAt:`asc`}}).then(e=>{e.data?.length&&N(e.data.map(e=>({id:e.id,type:`comment`,actor:e.author?.name??`Unknown`,actorAvatarUrl:e.author?.avatar,body:e.content,createdAt:e.createdAt,updatedAt:e.updatedAt,parentId:e.parentId,reactions:e.reactions?Object.entries(e.reactions).map(([e,t])=>({emoji:e,count:t.length,reacted:t.includes(Q.id)})):void 0})))}).catch(()=>{})},[e,w,V,Q]);let te=(0,x.useCallback)(async t=>{let n={id:crypto.randomUUID(),type:`comment`,actor:Q.name,actorAvatarUrl:`avatar`in Q?Q.avatar:void 0,body:t,createdAt:new Date().toISOString()};if(N(e=>[...e,n]),e){let r=`${w}:${V}`;e.create(`sys_comment`,{id:n.id,threadId:r,author:Q,content:t,mentions:[],createdAt:n.createdAt}).catch(()=>{})}},[Q,e,w,V]),ne=(0,x.useCallback)(async(t,n)=>{let r={id:crypto.randomUUID(),type:`comment`,actor:Q.name,actorAvatarUrl:`avatar`in Q?Q.avatar:void 0,body:n,createdAt:new Date().toISOString(),parentId:t};if(N(e=>[...e,r].map(e=>e.id===t?{...e,replyCount:(e.replyCount??0)+1}:e)),e){let i=`${w}:${V}`;e.create(`sys_comment`,{id:r.id,threadId:i,author:Q,content:n,mentions:[],createdAt:r.createdAt,parentId:t}).catch(()=>{})}},[Q,e,w,V]),re=(0,x.useCallback)((t,n)=>{N(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.reactions??[]],a=i.findIndex(e=>e.emoji===n);if(a>=0){let e=i[a];e.reacted?e.count<=1?i.splice(a,1):i[a]={...e,count:e.count-1,reacted:!1}:i[a]={...e,count:e.count+1,reacted:!0}}else i.push({emoji:n,count:1,reacted:!0});let o={...r,reactions:i};return e&&e.update(`sys_comment`,String(t),{$toggleReaction:{emoji:n,userId:Q.id}}).catch(()=>{}),o}))},[Q.id,e]);(0,x.useEffect)(()=>{j(!0),queueMicrotask(()=>j(!1))},[w,T]);let $=(0,x.useMemo)(()=>{if(!B)return{type:`detail-view`};let e=B.primaryField||Object.keys(B.fields||{}).find(e=>e===`name`||e===`title`),t=B.views?.form?.sections,n=t&&t.length>0?t.map(e=>({title:e.title,collapsible:e.collapsible,defaultCollapsed:e.defaultCollapsed,fields:(e.fields||[]).map(e=>{let t=typeof e==`string`?e:e.name,n=B.fields[t];if(!n)return console.warn(`[RecordDetailView] Field "${t}" not found in ${B.name} definition`),{name:t,label:t};let r=n.reference_to||n.reference;return{name:t,label:n.label||t,type:n.type||`text`,...n.options&&{options:n.options},...r&&{reference_to:r},...n.reference_field&&{reference_field:n.reference_field},...n.currency&&{currency:n.currency}}})})):[{title:k(`detail.details`,{defaultValue:`Details`}),fields:Object.keys(B.fields||{}).map(e=>{let t=B.fields[e],n=t.reference_to||t.reference;return{name:e,label:t.label||e,type:t.type||`text`,...t.options&&{options:t.options},...n&&{reference_to:n},...t.reference_field&&{reference_field:t.reference_field},...t.currency&&{currency:t.currency}}})}],r=(()=>{let e=new Set;return(B.actions||[]).filter(t=>t.locations?.includes(`record_header`)?t.name?e.has(t.name)?!1:(e.add(t.name),!0):!0:!1)})(),i=B.views?.detail?.highlightFields??[],a=B.views?.detail?.sectionGroups??B.views?.form?.sectionGroups,o=Z.map(({childObject:e,childLabel:t})=>({title:t,type:`table`,api:e,data:R[e]||[]}));return{type:`detail-view`,objectName:B.name,resourceId:V,showBack:!0,onBack:`history`,showEdit:!0,title:B.label,primaryField:e,sections:n,autoTabs:!0,autoDiscoverRelated:!0,...o.length>0&&{related:o},...i.length>0&&{highlightFields:i},...a&&a.length>0&&{sectionGroups:a},...r.length>0&&{actions:[{type:`action:bar`,location:`record_header`,actions:r}]}}},[B?.name,V,R,I]);return A?(0,S.jsx)(b,{}):B?(0,S.jsxs)(`div`,{className:`h-full bg-background overflow-hidden flex flex-col relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2`,children:P.length>0&&(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:`Users viewing this record`,children:[(0,S.jsx)(s,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,S.jsx)(ee,{users:P,size:`sm`,maxVisible:4,showStatus:!0})]})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-row`,children:[(0,S.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48`,children:[(0,S.jsx)(n,{context:{record:{},objectName:w,user:Q},onConfirm:K,onToast:J,onNavigate:Y,onParamCollection:q,handlers:{api:X},children:(0,S.jsx)(h,{schema:$,dataSource:e,onEdit:()=>{r({id:V})}},I)}),(0,S.jsx)(`div`,{className:`mt-6 border-t pt-6`,children:(0,S.jsx)(m,{config:{position:`bottom`,collapsible:!0,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},collapseWhenEmpty:!0,items:M,onAddComment:te,onAddReply:ne,onToggleReaction:re})})]}),(0,S.jsx)(v,{open:E,sections:[{title:`View Schema`,data:$}]})]}),(0,S.jsx)(_,{state:H,onOpenChange:e=>{e||U(e=>({...e,open:!1}))}}),(0,S.jsx)(y,{state:W,onOpenChange:e=>{e||G(e=>({...e,open:!1}))}})]}):(0,S.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,S.jsxs)(l,{children:[(0,S.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,S.jsx)(a,{className:`h-6 w-6 text-muted-foreground`})}),(0,S.jsx)(c,{children:`Object Not Found`}),(0,S.jsxs)(o,{children:[`Object "`,w,`" definition missing. Check your configuration or navigate back to select a valid object.`]})]})})}export{w as RecordDetailView};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,l as n,w as r}from"./framework-DJlDX9E6.js";import{St as i,Vc as a,ct as o,is as s,lt as c,st as l}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as u,u as d}from"./ui-layout-DdDX0gzI.js";import{c as f,p}from"./infrastructure-C6Ph6Ug0.js";import{o as m,s as h}from"./plugins-views-CE0VP3vl.js";import{a as ee,i as g,n as _,r as v,t as y}from"./index-DDpLaQOV.js";import{t as b}from"./skeletons-DcGqw3b1.js";var x=e(t(),1),S=r(),C={id:`current-user`,name:`Demo User`};function w({dataSource:e,objects:t,onEdit:r}){let{objectName:w,recordId:T}=d(),{showDebug:E}=g(),{user:D}=f(),O=u(),{t:k}=p(),[A,j]=(0,x.useState)(!0),[M,N]=(0,x.useState)([]),[P,F]=(0,x.useState)([]),[I,L]=(0,x.useState)(0),[R,z]=(0,x.useState)({}),B=t.find(e=>e.name===w),V=T,[H,U]=(0,x.useState)({open:!1,message:``}),[W,G]=(0,x.useState)({open:!1,params:[]}),K=(0,x.useCallback)((e,t)=>new Promise(n=>{U({open:!0,message:e,options:t,resolve:n})}),[]),q=(0,x.useCallback)(e=>new Promise(t=>{G({open:!0,params:e,resolve:t})}),[]),J=(0,x.useCallback)((e,t)=>{t?.type===`error`?i.error(e):i.success(e)},[]),Y=(0,x.useCallback)((e,t)=>{t?.external||t?.newTab?window.open(e,`_blank`,`noopener,noreferrer`):O(e)},[O]),X=(0,x.useCallback)(async t=>{try{let n=t.target||t.name,r=t.params||{};switch(n){case`opportunity_change_stage`:await e.update(w,V,{stage:r.new_stage});break;case`opportunity_mark_won`:await e.update(w,V,{stage:`closed_won`});break;case`opportunity_mark_lost`:await e.update(w,V,{stage:`closed_lost`,loss_reason:r.loss_reason});break;default:Object.keys(r).length>0&&await e.update(w,V,r);break}let i=t.refreshAfter===!0;return i&&L(e=>e+1),{success:!0,reload:i}}catch(e){return{success:!1,error:e.message}}},[e,w,V]),Z=(0,x.useMemo)(()=>{if(!B||!t)return[];let e=[];for(let n of t)if(n.name!==B.name)for(let[t,r]of Object.entries(n.fields||{}))r&&(r.type===`lookup`||r.type===`master_detail`)&&(r.reference_to||r.reference)===B.name&&e.push({childObject:n.name,childLabel:n.label||n.name,referenceField:t});return e},[B,t]);(0,x.useEffect)(()=>{if(!e||!V||Z.length===0)return;let t=!1;return Promise.all(Z.map(({childObject:t,referenceField:n})=>e.find(t,{$filter:{[n]:V}}).then(e=>({childObject:t,items:Array.isArray(e)?e:e?.data||[]})).catch(e=>(console.warn(`[RecordDetailView] Failed to fetch related ${t}:`,e),{childObject:t,items:[]})))).then(e=>{if(t)return;let n={};for(let{childObject:t,items:r}of e)n[t]=r;z(n)}),()=>{t=!0}},[e,V,Z]);let Q=D?{id:D.id,name:D.name,avatar:D.image}:C;(0,x.useEffect)(()=>{if(!e||!w||!V)return;let t=`${w}:${V}`;e.find(`sys_presence`,{$filter:{recordId:V}}).then(e=>{e.data?.length&&F(e.data)}).catch(()=>{}),e.find(`sys_comment`,{$filter:{threadId:t},$orderby:{createdAt:`asc`}}).then(e=>{e.data?.length&&N(e.data.map(e=>({id:e.id,type:`comment`,actor:e.author?.name??`Unknown`,actorAvatarUrl:e.author?.avatar,body:e.content,createdAt:e.createdAt,updatedAt:e.updatedAt,parentId:e.parentId,reactions:e.reactions?Object.entries(e.reactions).map(([e,t])=>({emoji:e,count:t.length,reacted:t.includes(Q.id)})):void 0})))}).catch(()=>{})},[e,w,V,Q]);let te=(0,x.useCallback)(async t=>{let n={id:crypto.randomUUID(),type:`comment`,actor:Q.name,actorAvatarUrl:`avatar`in Q?Q.avatar:void 0,body:t,createdAt:new Date().toISOString()};if(N(e=>[...e,n]),e){let r=`${w}:${V}`;e.create(`sys_comment`,{id:n.id,threadId:r,author:Q,content:t,mentions:[],createdAt:n.createdAt}).catch(()=>{})}},[Q,e,w,V]),ne=(0,x.useCallback)(async(t,n)=>{let r={id:crypto.randomUUID(),type:`comment`,actor:Q.name,actorAvatarUrl:`avatar`in Q?Q.avatar:void 0,body:n,createdAt:new Date().toISOString(),parentId:t};if(N(e=>[...e,r].map(e=>e.id===t?{...e,replyCount:(e.replyCount??0)+1}:e)),e){let i=`${w}:${V}`;e.create(`sys_comment`,{id:r.id,threadId:i,author:Q,content:n,mentions:[],createdAt:r.createdAt,parentId:t}).catch(()=>{})}},[Q,e,w,V]),re=(0,x.useCallback)((t,n)=>{N(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.reactions??[]],a=i.findIndex(e=>e.emoji===n);if(a>=0){let e=i[a];e.reacted?e.count<=1?i.splice(a,1):i[a]={...e,count:e.count-1,reacted:!1}:i[a]={...e,count:e.count+1,reacted:!0}}else i.push({emoji:n,count:1,reacted:!0});let o={...r,reactions:i};return e&&e.update(`sys_comment`,String(t),{$toggleReaction:{emoji:n,userId:Q.id}}).catch(()=>{}),o}))},[Q.id,e]);(0,x.useEffect)(()=>{j(!0),queueMicrotask(()=>j(!1))},[w,T]);let $=(0,x.useMemo)(()=>{if(!B)return{type:`detail-view`};let e=B.primaryField||Object.keys(B.fields||{}).find(e=>e===`name`||e===`title`),t=B.views?.form?.sections,n=t&&t.length>0?t.map(e=>({title:e.title,collapsible:e.collapsible,defaultCollapsed:e.defaultCollapsed,fields:(e.fields||[]).map(e=>{let t=typeof e==`string`?e:e.name,n=B.fields[t];if(!n)return console.warn(`[RecordDetailView] Field "${t}" not found in ${B.name} definition`),{name:t,label:t};let r=n.reference_to||n.reference;return{name:t,label:n.label||t,type:n.type||`text`,...n.options&&{options:n.options},...r&&{reference_to:r},...n.reference_field&&{reference_field:n.reference_field},...n.currency&&{currency:n.currency}}})})):[{title:k(`detail.details`,{defaultValue:`Details`}),fields:Object.keys(B.fields||{}).map(e=>{let t=B.fields[e],n=t.reference_to||t.reference;return{name:e,label:t.label||e,type:t.type||`text`,...t.options&&{options:t.options},...n&&{reference_to:n},...t.reference_field&&{reference_field:t.reference_field},...t.currency&&{currency:t.currency}}})}],r=(()=>{let e=new Set;return(B.actions||[]).filter(t=>t.locations?.includes(`record_header`)?t.name?e.has(t.name)?!1:(e.add(t.name),!0):!0:!1)})(),i=B.views?.detail?.highlightFields??[],a=B.views?.detail?.sectionGroups??B.views?.form?.sectionGroups,o=Z.map(({childObject:e,childLabel:t})=>({title:t,type:`table`,api:e,data:R[e]||[]}));return{type:`detail-view`,objectName:B.name,resourceId:V,showBack:!0,onBack:`history`,showEdit:!0,title:B.label,primaryField:e,sections:n,autoTabs:!0,autoDiscoverRelated:!0,...o.length>0&&{related:o},...i.length>0&&{highlightFields:i},...a&&a.length>0&&{sectionGroups:a},...r.length>0&&{actions:[{type:`action:bar`,location:`record_header`,actions:r}]}}},[B?.name,V,R,I]);return A?(0,S.jsx)(b,{}):B?(0,S.jsxs)(`div`,{className:`h-full bg-background overflow-hidden flex flex-col relative`,children:[(0,S.jsx)(`div`,{className:`absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2`,children:P.length>0&&(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,title:`Users viewing this record`,children:[(0,S.jsx)(s,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,S.jsx)(ee,{users:P,size:`sm`,maxVisible:4,showStatus:!0})]})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-row`,children:[(0,S.jsxs)(`div`,{className:`flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48`,children:[(0,S.jsx)(n,{context:{record:{},objectName:w,user:Q},onConfirm:K,onToast:J,onNavigate:Y,onParamCollection:q,handlers:{api:X},children:(0,S.jsx)(h,{schema:$,dataSource:e,onEdit:()=>{r({id:V})}},I)}),(0,S.jsx)(`div`,{className:`mt-6 border-t pt-6`,children:(0,S.jsx)(m,{config:{position:`bottom`,collapsible:!0,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},collapseWhenEmpty:!0,items:M,onAddComment:te,onAddReply:ne,onToggleReaction:re})})]}),(0,S.jsx)(v,{open:E,sections:[{title:`View Schema`,data:$}]})]}),(0,S.jsx)(_,{state:H,onOpenChange:e=>{e||U(e=>({...e,open:!1}))}}),(0,S.jsx)(y,{state:W,onOpenChange:e=>{e||G(e=>({...e,open:!1}))}})]}):(0,S.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,S.jsxs)(l,{children:[(0,S.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,S.jsx)(a,{className:`h-6 w-6 text-muted-foreground`})}),(0,S.jsx)(c,{children:`Object Not Found`}),(0,S.jsxs)(o,{children:[`Object "`,w,`" definition missing. Check your configuration or navigate back to select a valid object.`]})]})})}export{w as RecordDetailView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Gs as r,ct as i,dc as a,lt as o,ol as s,st as c}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{u as l}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{n as u,t as d}from"./plugins-views-CE0VP3vl.js";import{c as f,i as p,r as m,s as h}from"./index-RiB5-8aY.js";var g=e(t(),1),_=n(),v=[{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 y({dataSource:e}){let{reportName:t}=l(),{showDebug:n}=p(),y=h(),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(0),{reports:w,objects:T,loading:E,refresh:D}=f(),O=w?.find(e=>e.name===t),[k,A]=(0,g.useState)(O),[j,M]=(0,g.useState)(null),[N,P]=(0,g.useState)([]),[F,I]=(0,g.useState)(!1),L=(0,g.useMemo)(()=>{let e=j||k,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;if(t&&T?.length){let e=T.find(e=>e.name===t);if(e?.fields){let t=e.fields;return Array.isArray(t)?t.map(e=>typeof e==`string`?{value:e,label:e,type:`text`}:{value:e.name,label:e.label||e.name,type:e.type||`text`}):Object.entries(t).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))}}return v},[j,k,T]),R=(0,g.useCallback)(async e=>{try{y&&(await y.update(`sys_report`,t,e),D().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[y,t,D]),z=(0,g.useCallback)(()=>{M(k),x(!0),C(e=>e+1)},[k]),B=(0,g.useCallback)(()=>{x(!1)},[]),V=(0,g.useMemo)(()=>j||k,[S]),H=(0,g.useCallback)(e=>{M(e),R(e),C(e=>e+1)},[R]),U=(0,g.useCallback)((e,t)=>{M(n=>({...n,[e]:t}))},[]);(0,g.useEffect)(()=>{A(O)},[O]),(0,g.useEffect)(()=>{b||M(null)},[O]);let W=j||k,G=(0,g.useMemo)(()=>JSON.stringify(W?.filters),[W?.filters]),K=(0,g.useMemo)(()=>JSON.stringify(W?.dataSource),[W?.dataSource]),q=(0,g.useMemo)(()=>JSON.stringify(W?.data),[W?.data]);if((0,g.useEffect)(()=>{if(!W||!e){P([]);return}if(W.data&&Array.isArray(W.data)){P(W.data);return}if(W.dataSource){(async()=>{I(!0);try{let t=W.dataSource.object||W.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),P([]);return}P((await e.find(t,{$filter:W.dataSource.filter,$orderby:W.dataSource.sort,$top:W.dataSource.limit})).data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),P([])}finally{I(!1)}})();return}if(W.objectName){(async()=>{I(!0);try{P((await e.find(W.objectName,{$filter:W.filters,$orderby:W.sort,$top:W.limit||100})).data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),P([])}finally{I(!1)}})();return}P([])},[W?.objectName,W?.limit,G,K,q,e]),E)return(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsx)(a,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!O||!k)return!E&&!O?(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsxs)(c,{children:[(0,_.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,_.jsx)(s,{className:`h-6 w-6 text-muted-foreground`})}),(0,_.jsx)(o,{children:`Report Not Found`}),(0,_.jsxs)(i,{children:[`The report "`,t,`" could not be found. It may have been removed or renamed.`]})]})}):(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsx)(a,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let J=e=>{let t={...e};if(!t.title&&t.label&&(t.title=t.label),!t.fields&&Array.isArray(t.columns)&&(t.fields=t.columns.map(e=>({name:e.field||e.name,label:e.label,type:e.type,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap,...e.aggregate?{aggregation:e.aggregate,showInSummary:!0}:{}}))),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.reportType||`tabular`,i=[];if((r===`summary`||n)&&i.push({type:`summary`,title:`Key Metrics`}),i.push({type:`table`,title:`Details`,columns:t.fields.map(e=>({name:e.name,label:e.label,type:e.type,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))}),t.chartConfig?.chartType&&i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:t.chartConfig.chartType,xAxisField:t.chartConfig.xAxisField,yAxisFields:t.chartConfig.yAxisFields}}),Array.isArray(e.sections)){let n=e.sections.filter(e=>e.type===`chart`&&!t.chartConfig?.chartType);i.push(...n)}t.sections=i}else t.sections||=[];return t},Y=j||k,X={type:`report-viewer`,report:J(Y),data:N,showToolbar:!0,allowExport:!0,loading:F};return(0,_.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,_.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:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:Y.title||Y.label||`Report Viewer`}),Y.description&&(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:Y.description})]}),(0,_.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:(0,_.jsxs)(`button`,{type:`button`,onClick:z,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:[(0,_.jsx)(r,{className:`h-3.5 w-3.5`}),`Edit`]})})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,_.jsx)(`div`,{className:`max-w-5xl mx-auto shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,_.jsx)(u,{schema:X})})}),(0,_.jsx)(d,{open:b,onClose:B,config:V,onSave:H,onFieldChange:U,availableFields:L}),(0,_.jsx)(m,{open:n,sections:[{title:`Report Configuration`,data:Y}]})]})]})}export{y as ReportView};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Gs as r,ct as i,dc as a,lt as o,ol as s,st as c}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{u as l}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{n as u,t as d}from"./plugins-views-CE0VP3vl.js";import{c as f,i as p,r as m,s as h}from"./index-DDpLaQOV.js";var g=e(t(),1),_=n(),v=[{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 y({dataSource:e}){let{reportName:t}=l(),{showDebug:n}=p(),y=h(),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(0),{reports:w,objects:T,loading:E,refresh:D}=f(),O=w?.find(e=>e.name===t),[k,A]=(0,g.useState)(O),[j,M]=(0,g.useState)(null),[N,P]=(0,g.useState)([]),[F,I]=(0,g.useState)(!1),L=(0,g.useMemo)(()=>{let e=j||k,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;if(t&&T?.length){let e=T.find(e=>e.name===t);if(e?.fields){let t=e.fields;return Array.isArray(t)?t.map(e=>typeof e==`string`?{value:e,label:e,type:`text`}:{value:e.name,label:e.label||e.name,type:e.type||`text`}):Object.entries(t).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))}}return v},[j,k,T]),R=(0,g.useCallback)(async e=>{try{y&&(await y.update(`sys_report`,t,e),D().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[y,t,D]),z=(0,g.useCallback)(()=>{M(k),x(!0),C(e=>e+1)},[k]),B=(0,g.useCallback)(()=>{x(!1)},[]),V=(0,g.useMemo)(()=>j||k,[S]),H=(0,g.useCallback)(e=>{M(e),R(e),C(e=>e+1)},[R]),U=(0,g.useCallback)((e,t)=>{M(n=>({...n,[e]:t}))},[]);(0,g.useEffect)(()=>{A(O)},[O]),(0,g.useEffect)(()=>{b||M(null)},[O]);let W=j||k,G=(0,g.useMemo)(()=>JSON.stringify(W?.filters),[W?.filters]),K=(0,g.useMemo)(()=>JSON.stringify(W?.dataSource),[W?.dataSource]),q=(0,g.useMemo)(()=>JSON.stringify(W?.data),[W?.data]);if((0,g.useEffect)(()=>{if(!W||!e){P([]);return}if(W.data&&Array.isArray(W.data)){P(W.data);return}if(W.dataSource){(async()=>{I(!0);try{let t=W.dataSource.object||W.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),P([]);return}P((await e.find(t,{$filter:W.dataSource.filter,$orderby:W.dataSource.sort,$top:W.dataSource.limit})).data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),P([])}finally{I(!1)}})();return}if(W.objectName){(async()=>{I(!0);try{P((await e.find(W.objectName,{$filter:W.filters,$orderby:W.sort,$top:W.limit||100})).data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),P([])}finally{I(!1)}})();return}P([])},[W?.objectName,W?.limit,G,K,q,e]),E)return(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsx)(a,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!O||!k)return!E&&!O?(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsxs)(c,{children:[(0,_.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,_.jsx)(s,{className:`h-6 w-6 text-muted-foreground`})}),(0,_.jsx)(o,{children:`Report Not Found`}),(0,_.jsxs)(i,{children:[`The report "`,t,`" could not be found. It may have been removed or renamed.`]})]})}):(0,_.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,_.jsx)(a,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let J=e=>{let t={...e};if(!t.title&&t.label&&(t.title=t.label),!t.fields&&Array.isArray(t.columns)&&(t.fields=t.columns.map(e=>({name:e.field||e.name,label:e.label,type:e.type,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap,...e.aggregate?{aggregation:e.aggregate,showInSummary:!0}:{}}))),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.reportType||`tabular`,i=[];if((r===`summary`||n)&&i.push({type:`summary`,title:`Key Metrics`}),i.push({type:`table`,title:`Details`,columns:t.fields.map(e=>({name:e.name,label:e.label,type:e.type,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))}),t.chartConfig?.chartType&&i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:t.chartConfig.chartType,xAxisField:t.chartConfig.xAxisField,yAxisFields:t.chartConfig.yAxisFields}}),Array.isArray(e.sections)){let n=e.sections.filter(e=>e.type===`chart`&&!t.chartConfig?.chartType);i.push(...n)}t.sections=i}else t.sections||=[];return t},Y=j||k,X={type:`report-viewer`,report:J(Y),data:N,showToolbar:!0,allowExport:!0,loading:F};return(0,_.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,_.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:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:Y.title||Y.label||`Report Viewer`}),Y.description&&(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:Y.description})]}),(0,_.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:(0,_.jsxs)(`button`,{type:`button`,onClick:z,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:[(0,_.jsx)(r,{className:`h-3.5 w-3.5`}),`Edit`]})})]}),(0,_.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,_.jsx)(`div`,{className:`max-w-5xl mx-auto shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,_.jsx)(u,{schema:X})})}),(0,_.jsx)(d,{open:b,onClose:B,config:V,onSave:H,onFieldChange:U,availableFields:L}),(0,_.jsx)(m,{open:n,sections:[{title:`Report Configuration`,data:Y}]})]})]})}export{y as ReportView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Ds as a,Jo as o,Po as s,So as c,St as l,dc as u,ds as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-RiB5-8aY.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_role`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_role`)).data||[])}catch{l.error(`Failed to load roles`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_role`,{name:`New Role`,description:``,isSystem:!1}),l.success(`Role created`),S()}catch{l.error(`Failed to create role`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_role`,e),l.success(`Role deleted`),S()}catch{l.error(`Failed to delete role`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(a,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Role Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Define roles and assign permissions`})]})]}),t&&(0,g.jsxs)(o,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add Role`]})]}),(0,g.jsx)(c,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(u,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(a,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No roles found.`}),(0,g.jsx)(s,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(d,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as RoleManagementPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Ds as a,Jo as o,Po as s,So as c,St as l,dc as u,ds as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-DDpLaQOV.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_role`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_role`)).data||[])}catch{l.error(`Failed to load roles`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_role`,{name:`New Role`,description:``,isSystem:!1}),l.success(`Role created`),S()}catch{l.error(`Failed to create role`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_role`,e),l.success(`Role deleted`),S()}catch{l.error(`Failed to delete role`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(a,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`Role Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Define roles and assign permissions`})]})]}),t&&(0,g.jsxs)(o,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add Role`]})]}),(0,g.jsx)(c,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(u,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(a,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No roles found.`}),(0,g.jsx)(s,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(o,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(d,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as RoleManagementPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ms as i,Pc as a,Po as o,So as s,Vc as c,gl as l,hc as u,ol as d,on as f}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{d as p,i as m,u as h}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as g}from"./index-RiB5-8aY.js";var _=e(t(),1),v=n();function y(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...y(n.children)):t.push(n);return t}var b={object:c,dashboard:u,page:a,report:d},x={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 S(){let{appName:e}=h(),[t,n]=p(),[a,u]=(0,_.useState)(t.get(`q`)||``),{apps:d}=g(),S=d||[],C=S.find(t=>t.name===e)||S[0],w=`/apps/${e}`,T=(0,_.useMemo)(()=>C?y(C.navigation||[]).map(e=>{let t=`#`;return e.type===`object`?(t=`${w}/${e.objectName}`,e.viewName&&(t+=`/view/${e.viewName}`)):e.type===`dashboard`?t=`${w}/dashboard/${e.dashboardName}`:e.type===`page`?t=`${w}/page/${e.pageName}`:e.type===`report`&&(t=`${w}/report/${e.reportName}`),{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:t,type:e.type,description:e.description}}).filter(e=>e.href!==`#`):[],[C,w]),E=(0,_.useMemo)(()=>{if(!a.trim())return T;let e=a.toLowerCase();return T.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[T,a]),D=e=>{u(e),n(e?{q:e}:{})},O=(0,_.useMemo)(()=>{let e={};for(let t of E)(e[t.type]||=[]).push(t);return e},[E]);return(0,v.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsxs)(m,{to:w,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,v.jsx)(l,{className:`h-4 w-4`}),`Back`]}),(0,v.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Search`})]}),(0,v.jsxs)(`div`,{className:`relative`,children:[(0,v.jsx)(i,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,v.jsx)(f,{value:a,onChange:e=>D(e.target.value),placeholder:`Search objects, dashboards, pages, reports...`,className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:a.trim()?`${E.length} result${E.length===1?``:`s`} for "${a}"`:`${T.length} items available`}),E.length===0?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,v.jsx)(i,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,v.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:`No results found`}),(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:`Try adjusting your search terms`})]}):(0,v.jsx)(`div`,{className:`space-y-6`,children:Object.entries(O).map(([e,t])=>(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,v.jsx)(b[e]||c,{className:`h-4 w-4`}),e.charAt(0).toUpperCase()+e.slice(1),`s`,(0,v.jsx)(o,{variant:`secondary`,className:`ml-1 text-xs`,children:t.length})]}),(0,v.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>{let t=b[e.type]||c;return(0,v.jsx)(m,{to:e.href,children:(0,v.jsx)(s,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,v.jsxs)(r,{className:`flex items-center gap-3 p-3`,children:[(0,v.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${x[e.type]||``}`,children:(0,v.jsx)(t,{className:`h-4 w-4`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.label}),e.description&&(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,v.jsx)(o,{variant:`outline`,className:`text-xs shrink-0`,children:e.type})]})})},e.id)})})]},e))})]})}export{S as SearchResultsPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ms as i,Pc as a,Po as o,So as s,Vc as c,gl as l,hc as u,ol as d,on as f}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{d as p,i as m,u as h}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as g}from"./index-DDpLaQOV.js";var _=e(t(),1),v=n();function y(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...y(n.children)):t.push(n);return t}var b={object:c,dashboard:u,page:a,report:d},x={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 S(){let{appName:e}=h(),[t,n]=p(),[a,u]=(0,_.useState)(t.get(`q`)||``),{apps:d}=g(),S=d||[],C=S.find(t=>t.name===e)||S[0],w=`/apps/${e}`,T=(0,_.useMemo)(()=>C?y(C.navigation||[]).map(e=>{let t=`#`;return e.type===`object`?(t=`${w}/${e.objectName}`,e.viewName&&(t+=`/view/${e.viewName}`)):e.type===`dashboard`?t=`${w}/dashboard/${e.dashboardName}`:e.type===`page`?t=`${w}/page/${e.pageName}`:e.type===`report`&&(t=`${w}/report/${e.reportName}`),{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:t,type:e.type,description:e.description}}).filter(e=>e.href!==`#`):[],[C,w]),E=(0,_.useMemo)(()=>{if(!a.trim())return T;let e=a.toLowerCase();return T.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[T,a]),D=e=>{u(e),n(e?{q:e}:{})},O=(0,_.useMemo)(()=>{let e={};for(let t of E)(e[t.type]||=[]).push(t);return e},[E]);return(0,v.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsxs)(m,{to:w,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,v.jsx)(l,{className:`h-4 w-4`}),`Back`]}),(0,v.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Search`})]}),(0,v.jsxs)(`div`,{className:`relative`,children:[(0,v.jsx)(i,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,v.jsx)(f,{value:a,onChange:e=>D(e.target.value),placeholder:`Search objects, dashboards, pages, reports...`,className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,v.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:a.trim()?`${E.length} result${E.length===1?``:`s`} for "${a}"`:`${T.length} items available`}),E.length===0?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,v.jsx)(i,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,v.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:`No results found`}),(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:`Try adjusting your search terms`})]}):(0,v.jsx)(`div`,{className:`space-y-6`,children:Object.entries(O).map(([e,t])=>(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,v.jsx)(b[e]||c,{className:`h-4 w-4`}),e.charAt(0).toUpperCase()+e.slice(1),`s`,(0,v.jsx)(o,{variant:`secondary`,className:`ml-1 text-xs`,children:t.length})]}),(0,v.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>{let t=b[e.type]||c;return(0,v.jsx)(m,{to:e.href,children:(0,v.jsx)(s,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,v.jsxs)(r,{className:`flex items-center gap-3 p-3`,children:[(0,v.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${x[e.type]||``}`,children:(0,v.jsx)(t,{className:`h-4 w-4`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,v.jsx)(`p`,{className:`text-sm font-medium truncate`,children:e.label}),e.description&&(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),(0,v.jsx)(o,{variant:`outline`,className:`text-xs shrink-0`,children:e.type})]})})},e.id)})})]},e))})]})}export{S as SearchResultsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ds as i,Eo as a,Ns as o,Po as s,So as c,To as l,as as u,dc as d,gc as f,is as p,ll as m,vc as h,wo as g}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as _,u as v}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as y,s as b}from"./index-RiB5-8aY.js";var x=e(t(),1),S=n();function C(){let e=_(),{appName:t}=v(),n=t?`/apps/${t}`:``,C=b(),{apps:w}=y(),[T,E]=(0,x.useState)({apps:null,users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[D,O]=(0,x.useState)(!0),k=(0,x.useCallback)(async()=>{if(C){O(!0);try{let[e,t,n,r,i]=await Promise.all([C.find(`sys_user`).catch(()=>({data:[]})),C.find(`sys_org`).catch(()=>({data:[]})),C.find(`sys_role`).catch(()=>({data:[]})),C.find(`sys_permission`).catch(()=>({data:[]})),C.find(`sys_audit_log`).catch(()=>({data:[]}))]);E({apps:w?.length??0,users:e.data?.length??0,orgs:t.data?.length??0,roles:n.data?.length??0,permissions:r.data?.length??0,auditLogs:i.data?.length??0})}catch{}finally{O(!1)}}},[C,w]);(0,x.useEffect)(()=>{k()},[k]);let A=[{title:`Applications`,description:`Manage all configured applications`,icon:f,href:`${n}/system/apps`,countLabel:`apps`,count:T.apps},{title:`Users`,description:`Manage system users and accounts`,icon:p,href:`${n}/system/users`,countLabel:`users`,count:T.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:m,href:`${n}/system/organizations`,countLabel:`organizations`,count:T.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:i,href:`${n}/system/roles`,countLabel:`roles`,count:T.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:h,href:`${n}/system/permissions`,countLabel:`permissions`,count:T.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:o,href:`${n}/system/audit-log`,countLabel:`entries`,count:T.auditLogs},{title:`Profile`,description:`View and edit your account settings`,icon:u,href:`${n}/system/profile`,countLabel:``,count:null}];return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Loading statistics...`]}),(0,S.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:A.map(t=>{let n=t.icon;return(0,S.jsxs)(c,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,children:[(0,S.jsxs)(l,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(n,{className:`h-5 w-5`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(a,{className:`text-base`,children:t.title}),(0,S.jsx)(g,{className:`text-xs`,children:t.description})]})]}),(0,S.jsx)(r,{className:`pt-0`,children:t.count!==null&&(0,S.jsxs)(s,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{C as SystemHubPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Co as r,Ds as i,Eo as a,Ns as o,Po as s,So as c,To as l,as as u,dc as d,gc as f,is as p,ll as m,vc as h,wo as g}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{l as _,u as v}from"./ui-layout-DdDX0gzI.js";import"./infrastructure-C6Ph6Ug0.js";import{c as y,s as b}from"./index-DDpLaQOV.js";var x=e(t(),1),S=n();function C(){let e=_(),{appName:t}=v(),n=t?`/apps/${t}`:``,C=b(),{apps:w}=y(),[T,E]=(0,x.useState)({apps:null,users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[D,O]=(0,x.useState)(!0),k=(0,x.useCallback)(async()=>{if(C){O(!0);try{let[e,t,n,r,i]=await Promise.all([C.find(`sys_user`).catch(()=>({data:[]})),C.find(`sys_org`).catch(()=>({data:[]})),C.find(`sys_role`).catch(()=>({data:[]})),C.find(`sys_permission`).catch(()=>({data:[]})),C.find(`sys_audit_log`).catch(()=>({data:[]}))]);E({apps:w?.length??0,users:e.data?.length??0,orgs:t.data?.length??0,roles:n.data?.length??0,permissions:r.data?.length??0,auditLogs:i.data?.length??0})}catch{}finally{O(!1)}}},[C,w]);(0,x.useEffect)(()=>{k()},[k]);let A=[{title:`Applications`,description:`Manage all configured applications`,icon:f,href:`${n}/system/apps`,countLabel:`apps`,count:T.apps},{title:`Users`,description:`Manage system users and accounts`,icon:p,href:`${n}/system/users`,countLabel:`users`,count:T.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:m,href:`${n}/system/organizations`,countLabel:`organizations`,count:T.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:i,href:`${n}/system/roles`,countLabel:`roles`,count:T.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:h,href:`${n}/system/permissions`,countLabel:`permissions`,count:T.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:o,href:`${n}/system/audit-log`,countLabel:`entries`,count:T.auditLogs},{title:`Profile`,description:`View and edit your account settings`,icon:u,href:`${n}/system/profile`,countLabel:``,count:null}];return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,S.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Loading statistics...`]}),(0,S.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:A.map(t=>{let n=t.icon;return(0,S.jsxs)(c,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,children:[(0,S.jsxs)(l,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(n,{className:`h-5 w-5`})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(a,{className:`text-base`,children:t.title}),(0,S.jsx)(g,{className:`text-xs`,children:t.description})]})]}),(0,S.jsx)(r,{className:`pt-0`,children:t.count!==null&&(0,S.jsxs)(s,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{C as SystemHubPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Jo as a,Po as o,So as s,St as c,dc as l,ds as u,is as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-RiB5-8aY.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_user`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_user`)).data||[])}catch{c.error(`Failed to load users`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_user`,{name:`New User`,email:``,role:`member`,status:`active`}),c.success(`User created`),S()}catch{c.error(`Failed to create user`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_user`,e),c.success(`User deleted`),S()}catch{c.error(`Failed to delete user`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(d,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`User Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Manage system users and their roles`})]})]}),t&&(0,g.jsxs)(a,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add User`]})]}),(0,g.jsx)(s,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(l,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No users found.`}),(0,g.jsx)(o,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(u,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as UserManagementPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{N as t,w as n}from"./framework-DJlDX9E6.js";import{Bs as r,Co as i,Jo as a,Po as o,So as s,St as c,dc as l,ds as u,is as d}from"./plugins-core-PiAAytWV.js";import"./data-adapter-wZ81OFjZ.js";import{c as f}from"./infrastructure-C6Ph6Ug0.js";import{s as p}from"./index-DDpLaQOV.js";import{t as m}from"./systemObjects-5--4zaiX.js";var h=e(t(),1),g=n(),_=m.find(e=>e.name===`sys_user`),v=_.views[0].columns;function y(){let{user:e}=f(),t=e?.role===`admin`,n=p(),[m,y]=(0,h.useState)([]),[b,x]=(0,h.useState)(!0),S=(0,h.useCallback)(async()=>{if(n){x(!0);try{y((await n.find(`sys_user`)).data||[])}catch{c.error(`Failed to load users`)}finally{x(!1)}}},[n]);(0,h.useEffect)(()=>{S()},[S]);let C=(0,h.useCallback)(async()=>{if(n)try{await n.create(`sys_user`,{name:`New User`,email:``,role:`member`,status:`active`}),c.success(`User created`),S()}catch{c.error(`Failed to create user`)}},[n,S]),w=(0,h.useCallback)(async e=>{if(n)try{await n.delete(`sys_user`,e),c.success(`User deleted`),S()}catch{c.error(`Failed to delete user`)}},[n,S]);return(0,g.jsxs)(`div`,{className:`flex flex-col gap-4 sm:gap-6 p-4 sm:p-6`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,g.jsx)(`div`,{className:`bg-primary/10 p-2 rounded-md shrink-0`,children:(0,g.jsx)(d,{className:`h-5 w-5 text-primary`})}),(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`User Management`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:`Manage system users and their roles`})]})]}),t&&(0,g.jsxs)(a,{size:`sm`,className:`shrink-0 gap-2`,onClick:C,children:[(0,g.jsx)(r,{className:`h-4 w-4`}),`Add User`]})]}),(0,g.jsx)(s,{children:(0,g.jsx)(i,{className:`p-0`,children:(0,g.jsx)(`div`,{className:`overflow-x-auto`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b bg-muted/50`,children:[v.map(e=>(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap`,children:_.fields.find(t=>t.name===e)?.label??e},e)),t&&(0,g.jsx)(`th`,{className:`h-10 px-3 sm:px-4 text-right font-medium text-muted-foreground`,children:`Actions`})]})}),(0,g.jsx)(`tbody`,{children:b?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-6 text-center`,colSpan:v.length+(t?1:0),children:(0,g.jsx)(l,{className:`h-6 w-6 animate-spin mx-auto text-muted-foreground`})})}):m.length===0?(0,g.jsx)(`tr`,{children:(0,g.jsx)(`td`,{className:`p-4 sm:p-6 text-center text-sm text-muted-foreground`,colSpan:v.length+(t?1:0),children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-4`,children:[(0,g.jsx)(d,{className:`h-8 w-8 text-muted-foreground/50`}),(0,g.jsx)(`p`,{children:`No users found.`}),(0,g.jsx)(o,{variant:`secondary`,className:`text-xs`,children:`plugin-grid powered`})]})})}):m.map(e=>(0,g.jsxs)(`tr`,{className:`border-b hover:bg-muted/50 transition-colors`,children:[v.map(t=>(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 whitespace-nowrap`,children:String(e[t]??``)},t)),t&&(0,g.jsx)(`td`,{className:`h-10 px-3 sm:px-4 text-right`,children:(0,g.jsx)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>w(e.id||e._id),children:(0,g.jsx)(u,{className:`h-3.5 w-3.5 text-destructive`})})})]},e.id||e._id))})]})})})})]})}export{y as UserManagementPage};