@objectstack/console 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-DYYVhErE.js → AdapterProvider-qwVfmAEk.js} +1 -1
- package/dist/assets/{ApiConsolePage-DqCLFtg6.js → ApiConsolePage-V6XcLsX4.js} +1 -1
- package/dist/assets/{AppDocsIndex-ChTjYsgs.js → AppDocsIndex-C4IIeN6V.js} +1 -1
- package/dist/assets/{AppManagementPage-CpBtMYk7.js → AppManagementPage-WCLo2V17.js} +1 -1
- package/dist/assets/{ConsoleFloatingChatbot-BtSnKZ5C.js → ConsoleFloatingChatbot-mf-pVd3G.js} +1 -1
- package/dist/assets/{DashboardView-DTeb8b6a.js → DashboardView-CPFt6TBZ.js} +1 -1
- package/dist/assets/{DashboardWidgetInspector-CUJFDeER.js → DashboardWidgetInspector-DknOds9r.js} +1 -1
- package/dist/assets/{FlowRunsPage-BCTyVNQV.js → FlowRunsPage-QMVLQvu7.js} +1 -1
- package/dist/assets/{InterfaceListPage-CaG6oJ3-.js → InterfaceListPage-Dbt7lZbl.js} +1 -1
- package/dist/assets/{MarketplacePackagePage-CxoOdisY.js → MarketplacePackagePage-CiRyU-vK.js} +1 -1
- package/dist/assets/{MetadataProvider-BpQl3Bw2.js → MetadataProvider-DKJsxrNu.js} +1 -1
- package/dist/assets/{ObjectDataPage-CnMdpBNe.js → ObjectDataPage-CAJf6Pu3.js} +1 -1
- package/dist/assets/{PageView-Ckvi7QO6.js → PageView-GYrk78oW.js} +1 -1
- package/dist/assets/{PublicFormsPage-xWq9jZzJ.js → PublicFormsPage-DmpEEcq4.js} +1 -1
- package/dist/assets/{RecordFormPage-DTyNzewM.js → RecordFormPage-DadWkJyX.js} +1 -1
- package/dist/assets/ReportDefaultInspector-CJGXWwWN.js +11 -0
- package/dist/assets/{ReportView-CHBbT7mP.js → ReportView-CIZjxMSJ.js} +1 -1
- package/dist/assets/{SearchResultsPage-BIuFjDoa.js → SearchResultsPage-BPDjxMw8.js} +1 -1
- package/dist/assets/{SystemHubPage-f4hYqDoI.js → SystemHubPage-2aGKeHcn.js} +1 -1
- package/dist/assets/data-adapter-Bm8GGtft.js +7 -0
- package/dist/assets/index-BXgUF5nO.css +2 -0
- package/dist/assets/{index-TdJi7kFM.js → index-PrzZHiAk.js} +1 -1
- package/dist/assets/{metadata-admin-DJAg5WLs.js → metadata-admin-CleGXds3.js} +1 -1
- package/dist/assets/src-BBieSqPB.js +16 -0
- package/dist/assets/{useMetadata-Eb5o6ihl.js → useMetadata-Ily0JuNR.js} +1 -1
- package/dist/assets/{useOpenRecordList-DIo7M1au.js → useOpenRecordList-tyj2_1bm.js} +1 -1
- package/dist/assets/{useReconcileOnError-4is_Tic6.js → useReconcileOnError-_XnUvYJA.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/ReportDefaultInspector-BA-D9th_.js +0 -11
- package/dist/assets/data-adapter-DLOPVTZ2.js +0 -7
- package/dist/assets/index-B-sF8xtC.css +0 -2
- package/dist/assets/src-6xqJEeiC.js +0 -15
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ui-components-BL3SEdAz.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{g as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as o}from"./infrastructure-Bcx6-8du.js";import{E as s,L as c,R as l,l as u}from"./framework-B3O15Lsq.js";import{G as d,J as f,Or as p,W as m,Zs as h,na as g,xr as _,za as v}from"./ui-components-rkvkkTxO.js";import"./AdapterProvider-DYYVhErE.js";import"./MetadataProvider-BpQl3Bw2.js";import{r as y}from"./ExpressionProvider-ODpzkcN3.js";import{r as b}from"./useMetadata-Eb5o6ihl.js";import{n as x,v as S}from"./ReportDefaultInspector-BA-D9th_.js";import{n as C,r as w,t as T}from"./MetadataInspector-RvnQ-QOT.js";import{r as ee}from"./runtime-metadata-persistence-D1KKivGr.js";import{n as E,t as D}from"./useOpenRecordList-DIo7M1au.js";import{r as O}from"./plugin-dashboard-CRFZp7gC.js";var k=e(a(),1),A=i();function j({open:e,onClose:t,config:n,onSave:r,onFieldChange:i,name:a,metadataClient:o,onAfterChange:s}){let{t:c}=u(),l=(0,k.useMemo)(()=>S(),[]),[d,f]=(0,k.useState)(!1),m=(0,k.useMemo)(()=>({...n??{}}),[n]),[h,g]=(0,k.useState)(m),v=(0,k.useRef)(h),y=(0,k.useRef)(m);y.current!==m&&(y.current=m,v.current=m,g(m),f(!1));let b=(0,k.useCallback)(e=>{let t={...v.current,...e};if(v.current=t,g(t),f(!0),i)for(let[n,r]of Object.entries(e))i(n,r,t)},[i]),C=(0,k.useCallback)(()=>{r(v.current),f(!1),t()},[r,t]),w=(0,k.useCallback)(e=>{let t={...e};v.current=t,g(t),f(!1)},[]),T=(0,k.useCallback)(()=>{t()},[t]);return e?(0,A.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`report-config-panel`,role:`complementary`,"aria-label":c(`report.editor.title`,{defaultValue:`Edit report`}),children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium truncate`,children:c(`report.editor.title`,{defaultValue:`Edit report`})}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":c(`common.close`,{defaultValue:`Close`}),"data-testid":`report-config-close`,children:(0,A.jsx)(p,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,A.jsx)(x,{type:`report`,name:typeof h.name==`string`?h.name:``,draft:h,readOnly:!1,locale:l,onPatch:b})}),(0,A.jsxs)(`div`,{"data-testid":`report-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(E,{type:`report`,name:a,metadataClient:o,dirty:d,onResume:w,onAfterChange:s}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:T,"data-testid":`report-config-discard`,children:c(`common.cancel`,{defaultValue:`Cancel`})}),(0,A.jsx)(_,{size:`sm`,onClick:C,"data-testid":`report-config-save`,children:c(`common.save`,{defaultValue:`Save`})})]})]}):null}var M=t({ReportView:()=>P}),N=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportViewer})),__vite__mapDeps([0]),import.meta.url)),te=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportRenderer})),__vite__mapDeps([0]),import.meta.url)),ne=[{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 P({dataSource:e}){let{t}=u(),{reportName:n}=r(),{showDebug:i}=C();c();let a=b(),p=o(),[_,x]=(0,k.useState)(!1),[S,E]=(0,k.useState)(0),{reports:M,objects:P,loading:F,refresh:I}=l(),{app:L}=y(),R=w(M,n,L?._packageId),[z,re]=(0,k.useState)(R),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)([]),[W,G]=(0,k.useState)(!1),K=D(),[q,J]=(0,k.useState)(null),Y=(0,k.useCallback)(e=>{if(!e||!P?.length)return;let t=P.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.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(n).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))},[P]),ie=(0,k.useCallback)(async({dataset:e,groupKey:t,object:n,objectFilter:r})=>{try{let i=Object.values(t).filter(e=>e!=null).map(e=>String(e)).join(` / `)||String(z?.label??z?.name??`Details`);if(n&&r){J({object:n,filter:r,title:i});return}let o=await a.get(`dataset`,e),s=typeof o?.object==`string`?o.object:void 0;if(!s)return;let c=Array.isArray(o?.dimensions)?o.dimensions:[],l=new Map(c.filter(e=>e?.name).map(e=>[e.name,e])),u=P?.find(e=>e.name===s)?.fields,d=e=>{if(Array.isArray(u))return u.find(t=>t?.name===e);if(u&&typeof u==`object`)return u[e]},f={};for(let[e,n]of Object.entries(t)){if(n==null)continue;let t=l.get(e);if(t?.dateGranularity)continue;let r=t?.field||e,i=d(r);if(i?.type===`lookup`||i?.type===`master_detail`)continue;let a=n;if(Array.isArray(i?.options)){let e=i.options.find(e=>e?.label===n||e?.value===n);e&&e.value!=null&&(a=e.value)}f[r]=a}J({object:s,filter:f,title:i})}catch(e){console.warn(`ReportView: drill failed`,e)}},[a,P,z]),ae=(0,k.useMemo)(()=>{let e=B||z,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;return Y(t)??ne},[B,z,Y]),X=(0,k.useCallback)(async e=>{try{a&&(await ee(`report`,n,e,{metadataClient:a}),I().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[a,n,I]),oe=(0,k.useCallback)(()=>{V(z),x(!0),E(e=>e+1)},[z]),se=(0,k.useCallback)(()=>{x(!1)},[]),ce=(0,k.useMemo)(()=>B||z,[S]),le=(0,k.useCallback)(e=>{V(e),X(e),E(e=>e+1)},[X]),ue=(0,k.useCallback)((e,t)=>{V(n=>({...n,[e]:t}))},[]);(0,k.useEffect)(()=>{re(R)},[R]),(0,k.useEffect)(()=>{_||V(null)},[R]);let Z=B||z,Q=(0,k.useMemo)(()=>JSON.stringify(Z?.filters),[Z?.filters]),de=(0,k.useMemo)(()=>JSON.stringify(Z?.dataSource),[Z?.dataSource]),fe=(0,k.useMemo)(()=>JSON.stringify(Z?.data),[Z?.data]);if((0,k.useEffect)(()=>{if(!Z||!e){U([]);return}if(Z.data&&Array.isArray(Z.data)){U(Z.data);return}if(Z.dataSource){(async()=>{G(!0);try{let t=Z.dataSource.object||Z.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),U([]);return}let n=await e.find(t,{$filter:Z.dataSource.filter,$orderby:Z.dataSource.sort,$top:Z.dataSource.limit});U(n.data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),U([])}finally{G(!1)}})();return}if(Z.objectName){(async()=>{G(!0);try{let t=await e.find(Z.objectName,{$filter:Z.filters,$orderby:Z.sort,$top:Z.limit||100});U(t.data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),U([])}finally{G(!1)}})();return}U([])},[Z?.objectName,Z?.limit,Q,de,fe,e]),F)return(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!R||!z)return!F&&!R?(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsxs)(m,{children:[(0,A.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,A.jsx)(h,{className:`h-6 w-6 text-muted-foreground`})}),(0,A.jsx)(f,{children:t(`empty.reportNotFound`)}),(0,A.jsx)(d,{children:t(`empty.reportNotFoundDescription`,{name:n})})]})}):(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let pe=e=>{let t={...e};!t.title&&t.label&&(t.title=t.label);let n=t.objectName||t.dataSource?.object||t.dataSource?.resource,r=n?P?.find(e=>e.name===n):null,i=Array.isArray(r?.fields)?r.fields:r?.fields?Object.entries(r.fields).map(([e,t])=>({name:e,...t})):[],a={};for(let e of i)e&&e.name&&(a[e.name]=e);let o=e=>{let t=e.name||e.field,n=t?a[t]:void 0;if(!n)return e;let r={...e};if(r.type===void 0&&n.type!==void 0&&(r.type=n.type),r.options===void 0&&Array.isArray(n.options)&&(r.options=n.options),r.referenceTo===void 0){let e=n.referenceTo||n.reference?.to||n.target;e&&(r.referenceTo=e)}return r.label===void 0&&n.label&&(r.label=n.label),r};if(!t.fields&&Array.isArray(t.columns)?t.fields=t.columns.map(e=>{let t=o(e);return{name:t.field||t.name,label:t.label,type:t.type,options:t.options,referenceTo:t.referenceTo,format:t.format,renderAs:t.renderAs,colorMap:t.colorMap,...t.aggregate?{aggregation:t.aggregate,showInSummary:!0}:{}}}):Array.isArray(t.fields)&&(t.fields=t.fields.map(o)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.type||t.reportType||`tabular`,i=[];(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,options:e.options,referenceTo:e.referenceTo,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))});let a=t.chart||t.chartConfig,o=a?.type||a?.chartType;if(o){let e=a.xAxis||a.xAxisField,t=a.yAxis||a.yAxisFields?.[0];i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:o,xAxisField:e,yAxisFields:t?[t]:a.yAxisFields}})}if(Array.isArray(e.sections)){let t=e.sections.filter(e=>e.type===`chart`&&!o);i.push(...t)}t.sections=i}else t.sections||=[];return t},$=B||z,me=!!($&&(typeof $.dataset==`string`||$.type===`joined`&&Array.isArray($.blocks)&&$.blocks.some(e=>typeof e?.dataset==`string`)))||!!($&&$.objectName&&($.type===`matrix`||$.type===`joined`||$.type===`summary`||$.type===`tabular`||$.type===void 0||Array.isArray($.groupingsAcross)&&$.groupingsAcross.length>0||Array.isArray($.columns))),he={type:`report-viewer`,report:pe($),data:H,showToolbar:!0,allowExport:!0,loading:W};return(0,A.jsxs)(s,{value:{openRecordList:K},children:[(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,A.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,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:$.title||$.label||`Report Viewer`}),$.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:$.description})]}),(0,A.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:p&&(0,A.jsxs)(`button`,{type:`button`,onClick:oe,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,A.jsx)(g,{className:`h-3.5 w-3.5`}),t(`common.edit`)]})})]}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,A.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,A.jsx)(`div`,{className:`w-full shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-8 text-sm text-muted-foreground`,children:t(`common.loading`,{defaultValue:`Loading…`})}),children:me?(0,A.jsx)(`div`,{className:`p-4 sm:p-6`,children:(0,A.jsx)(te,{schema:$,dataSource:e,rows:H,onDrill:ie})}):(0,A.jsx)(N,{schema:he})})})}),(0,A.jsx)(j,{open:_&&p,onClose:se,config:ce,onSave:le,onFieldChange:ue,availableFields:ae,getFieldsForObject:Y,name:n,metadataClient:a,onAfterChange:()=>I().catch(()=>{})}),(0,A.jsx)(T,{open:i,sections:[{title:`Report Configuration`,data:$}]})]})]}),(0,A.jsx)(O,{open:!!q,onClose:()=>J(null),title:q?.title??``,objectName:q?.object??``,filter:q?.filter,dataSource:e})]})}export{M as t};
|
|
2
|
+
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{g as n,m as r,r as i,y as a}from"./vendor-react-BGDDiZfJ.js";import{d as o}from"./infrastructure-Bcx6-8du.js";import{E as s,L as c,R as l,l as u}from"./framework-B3O15Lsq.js";import{G as d,J as f,Or as p,W as m,Zs as h,na as g,xr as _,za as v}from"./ui-components-rkvkkTxO.js";import"./AdapterProvider-qwVfmAEk.js";import"./MetadataProvider-DKJsxrNu.js";import{r as y}from"./ExpressionProvider-ODpzkcN3.js";import{r as b}from"./useMetadata-Ily0JuNR.js";import{n as x,v as S}from"./ReportDefaultInspector-CJGXWwWN.js";import{n as C,r as w,t as T}from"./MetadataInspector-RvnQ-QOT.js";import{r as ee}from"./runtime-metadata-persistence-D1KKivGr.js";import{n as E,t as D}from"./useOpenRecordList-tyj2_1bm.js";import{r as O}from"./plugin-dashboard-CRFZp7gC.js";var k=e(a(),1),A=i();function j({open:e,onClose:t,config:n,onSave:r,onFieldChange:i,name:a,metadataClient:o,onAfterChange:s}){let{t:c}=u(),l=(0,k.useMemo)(()=>S(),[]),[d,f]=(0,k.useState)(!1),m=(0,k.useMemo)(()=>({...n??{}}),[n]),[h,g]=(0,k.useState)(m),v=(0,k.useRef)(h),y=(0,k.useRef)(m);y.current!==m&&(y.current=m,v.current=m,g(m),f(!1));let b=(0,k.useCallback)(e=>{let t={...v.current,...e};if(v.current=t,g(t),f(!0),i)for(let[n,r]of Object.entries(e))i(n,r,t)},[i]),C=(0,k.useCallback)(()=>{r(v.current),f(!1),t()},[r,t]),w=(0,k.useCallback)(e=>{let t={...e};v.current=t,g(t),f(!1)},[]),T=(0,k.useCallback)(()=>{t()},[t]);return e?(0,A.jsxs)(`aside`,{className:`hidden sm:flex w-[440px] shrink-0 flex-col border-l bg-background h-full`,"data-testid":`report-config-panel`,role:`complementary`,"aria-label":c(`report.editor.title`,{defaultValue:`Edit report`}),children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium truncate`,children:c(`report.editor.title`,{defaultValue:`Edit report`})}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 w-7 p-0`,"aria-label":c(`common.close`,{defaultValue:`Close`}),"data-testid":`report-config-close`,children:(0,A.jsx)(p,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:(0,A.jsx)(x,{type:`report`,name:typeof h.name==`string`?h.name:``,draft:h,readOnly:!1,locale:l,onPatch:b})}),(0,A.jsxs)(`div`,{"data-testid":`report-config-footer`,className:`flex items-center justify-end gap-2 border-t px-4 py-2.5 shrink-0`,children:[(0,A.jsx)(E,{type:`report`,name:a,metadataClient:o,dirty:d,onResume:w,onAfterChange:s}),(0,A.jsx)(_,{variant:`ghost`,size:`sm`,onClick:T,"data-testid":`report-config-discard`,children:c(`common.cancel`,{defaultValue:`Cancel`})}),(0,A.jsx)(_,{size:`sm`,onClick:C,"data-testid":`report-config-save`,children:c(`common.save`,{defaultValue:`Save`})})]})]}):null}var M=t({ReportView:()=>P}),N=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportViewer})),__vite__mapDeps([0]),import.meta.url)),te=(0,k.lazy)(()=>n(()=>import(`./plugin-report-BKD6SOp5.js`).then(e=>e.t).then(e=>({default:e.ReportRenderer})),__vite__mapDeps([0]),import.meta.url)),ne=[{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 P({dataSource:e}){let{t}=u(),{reportName:n}=r(),{showDebug:i}=C();c();let a=b(),p=o(),[_,x]=(0,k.useState)(!1),[S,E]=(0,k.useState)(0),{reports:M,objects:P,loading:F,refresh:I}=l(),{app:L}=y(),R=w(M,n,L?._packageId),[z,re]=(0,k.useState)(R),[B,V]=(0,k.useState)(null),[H,U]=(0,k.useState)([]),[W,G]=(0,k.useState)(!1),K=D(),[q,J]=(0,k.useState)(null),Y=(0,k.useCallback)(e=>{if(!e||!P?.length)return;let t=P.find(t=>t.name===e);if(!t?.fields)return;let n=t.fields;return Array.isArray(n)?n.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(n).map(([e,t])=>({value:e,label:t.label||e,type:t.type||`text`}))},[P]),ie=(0,k.useCallback)(async({dataset:e,groupKey:t,object:n,objectFilter:r})=>{try{let i=Object.values(t).filter(e=>e!=null).map(e=>String(e)).join(` / `)||String(z?.label??z?.name??`Details`);if(n&&r){J({object:n,filter:r,title:i});return}let o=await a.get(`dataset`,e),s=typeof o?.object==`string`?o.object:void 0;if(!s)return;let c=Array.isArray(o?.dimensions)?o.dimensions:[],l=new Map(c.filter(e=>e?.name).map(e=>[e.name,e])),u=P?.find(e=>e.name===s)?.fields,d=e=>{if(Array.isArray(u))return u.find(t=>t?.name===e);if(u&&typeof u==`object`)return u[e]},f={};for(let[e,n]of Object.entries(t)){if(n==null)continue;let t=l.get(e);if(t?.dateGranularity)continue;let r=t?.field||e,i=d(r);if(i?.type===`lookup`||i?.type===`master_detail`)continue;let a=n;if(Array.isArray(i?.options)){let e=i.options.find(e=>e?.label===n||e?.value===n);e&&e.value!=null&&(a=e.value)}f[r]=a}J({object:s,filter:f,title:i})}catch(e){console.warn(`ReportView: drill failed`,e)}},[a,P,z]),ae=(0,k.useMemo)(()=>{let e=B||z,t=e?.objectName||e?.dataSource?.object||e?.dataSource?.resource;return Y(t)??ne},[B,z,Y]),X=(0,k.useCallback)(async e=>{try{a&&(await ee(`report`,n,e,{metadataClient:a}),I().catch(()=>{}))}catch(e){console.warn(`[ReportView] Auto-save failed:`,e)}},[a,n,I]),oe=(0,k.useCallback)(()=>{V(z),x(!0),E(e=>e+1)},[z]),se=(0,k.useCallback)(()=>{x(!1)},[]),ce=(0,k.useMemo)(()=>B||z,[S]),le=(0,k.useCallback)(e=>{V(e),X(e),E(e=>e+1)},[X]),ue=(0,k.useCallback)((e,t)=>{V(n=>({...n,[e]:t}))},[]);(0,k.useEffect)(()=>{re(R)},[R]),(0,k.useEffect)(()=>{_||V(null)},[R]);let Z=B||z,Q=(0,k.useMemo)(()=>JSON.stringify(Z?.filters),[Z?.filters]),de=(0,k.useMemo)(()=>JSON.stringify(Z?.dataSource),[Z?.dataSource]),fe=(0,k.useMemo)(()=>JSON.stringify(Z?.data),[Z?.data]);if((0,k.useEffect)(()=>{if(!Z||!e){U([]);return}if(Z.data&&Array.isArray(Z.data)){U(Z.data);return}if(Z.dataSource){(async()=>{G(!0);try{let t=Z.dataSource.object||Z.dataSource.resource;if(!t){console.warn(`ReportView: dataSource missing object/resource property`),U([]);return}let n=await e.find(t,{$filter:Z.dataSource.filter,$orderby:Z.dataSource.sort,$top:Z.dataSource.limit});U(n.data||[])}catch(e){console.error(`ReportView: Failed to load data from dataSource`,e),U([])}finally{G(!1)}})();return}if(Z.objectName){(async()=>{G(!0);try{let t=await e.find(Z.objectName,{$filter:Z.filters,$orderby:Z.sort,$top:Z.limit||100});U(t.data||[])}catch(e){console.error(`ReportView: Failed to load data from objectName`,e),U([])}finally{G(!1)}})();return}U([])},[Z?.objectName,Z?.limit,Q,de,fe,e]),F)return(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});if(!R||!z)return!F&&!R?(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsxs)(m,{children:[(0,A.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted`,children:(0,A.jsx)(h,{className:`h-6 w-6 text-muted-foreground`})}),(0,A.jsx)(f,{children:t(`empty.reportNotFound`)}),(0,A.jsx)(d,{children:t(`empty.reportNotFoundDescription`,{name:n})})]})}):(0,A.jsx)(`div`,{className:`h-full flex items-center justify-center p-8`,children:(0,A.jsx)(v,{className:`h-8 w-8 animate-spin text-muted-foreground`})});let pe=e=>{let t={...e};!t.title&&t.label&&(t.title=t.label);let n=t.objectName||t.dataSource?.object||t.dataSource?.resource,r=n?P?.find(e=>e.name===n):null,i=Array.isArray(r?.fields)?r.fields:r?.fields?Object.entries(r.fields).map(([e,t])=>({name:e,...t})):[],a={};for(let e of i)e&&e.name&&(a[e.name]=e);let o=e=>{let t=e.name||e.field,n=t?a[t]:void 0;if(!n)return e;let r={...e};if(r.type===void 0&&n.type!==void 0&&(r.type=n.type),r.options===void 0&&Array.isArray(n.options)&&(r.options=n.options),r.referenceTo===void 0){let e=n.referenceTo||n.reference?.to||n.target;e&&(r.referenceTo=e)}return r.label===void 0&&n.label&&(r.label=n.label),r};if(!t.fields&&Array.isArray(t.columns)?t.fields=t.columns.map(e=>{let t=o(e);return{name:t.field||t.name,label:t.label,type:t.type,options:t.options,referenceTo:t.referenceTo,format:t.format,renderAs:t.renderAs,colorMap:t.colorMap,...t.aggregate?{aggregation:t.aggregate,showInSummary:!0}:{}}}):Array.isArray(t.fields)&&(t.fields=t.fields.map(o)),t.fields&&Array.isArray(t.fields)&&t.fields.length>0){let n=t.fields.some(e=>e.showInSummary||e.aggregation),r=t.type||t.reportType||`tabular`,i=[];(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,options:e.options,referenceTo:e.referenceTo,format:e.format,renderAs:e.renderAs,colorMap:e.colorMap}))});let a=t.chart||t.chartConfig,o=a?.type||a?.chartType;if(o){let e=a.xAxis||a.xAxisField,t=a.yAxis||a.yAxisFields?.[0];i.push({type:`chart`,title:`Chart`,chart:{type:`chart`,chartType:o,xAxisField:e,yAxisFields:t?[t]:a.yAxisFields}})}if(Array.isArray(e.sections)){let t=e.sections.filter(e=>e.type===`chart`&&!o);i.push(...t)}t.sections=i}else t.sections||=[];return t},$=B||z,me=!!($&&(typeof $.dataset==`string`||$.type===`joined`&&Array.isArray($.blocks)&&$.blocks.some(e=>typeof e?.dataset==`string`)))||!!($&&$.objectName&&($.type===`matrix`||$.type===`joined`||$.type===`summary`||$.type===`tabular`||$.type===void 0||Array.isArray($.groupingsAcross)&&$.groupingsAcross.length>0||Array.isArray($.columns))),he={type:`report-viewer`,report:pe($),data:H,showToolbar:!0,allowExport:!0,loading:W};return(0,A.jsxs)(s,{value:{openRecordList:K},children:[(0,A.jsxs)(`div`,{className:`flex flex-col h-full overflow-hidden bg-background`,children:[(0,A.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,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`h1`,{className:`text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate`,children:$.title||$.label||`Report Viewer`}),$.description&&(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:$.description})]}),(0,A.jsx)(`div`,{className:`shrink-0 flex items-center gap-1.5`,children:p&&(0,A.jsxs)(`button`,{type:`button`,onClick:oe,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,A.jsx)(g,{className:`h-3.5 w-3.5`}),t(`common.edit`)]})})]}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-hidden flex flex-col sm:flex-row relative`,children:[(0,A.jsx)(`div`,{className:`flex-1 min-w-0 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5`,children:(0,A.jsx)(`div`,{className:`w-full shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150`,children:(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-8 text-sm text-muted-foreground`,children:t(`common.loading`,{defaultValue:`Loading…`})}),children:me?(0,A.jsx)(`div`,{className:`p-4 sm:p-6`,children:(0,A.jsx)(te,{schema:$,dataSource:e,rows:H,onDrill:ie})}):(0,A.jsx)(N,{schema:he})})})}),(0,A.jsx)(j,{open:_&&p,onClose:se,config:ce,onSave:le,onFieldChange:ue,availableFields:ae,getFieldsForObject:Y,name:n,metadataClient:a,onAfterChange:()=>I().catch(()=>{})}),(0,A.jsx)(T,{open:i,sections:[{title:`Report Configuration`,data:$}]})]})]}),(0,A.jsx)(O,{open:!!q,onClose:()=>J(null),title:q?.title??``,objectName:q?.object??``,filter:q?.filter,dataSource:e})]})}export{M as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BGDDiZfJ.js";import{f as s}from"./infrastructure-Bcx6-8du.js";import{R as c,l}from"./framework-B3O15Lsq.js";import{$n as u,Cc as d,Fo as f,Oi as p,Xa as m,Zs as h,ar as g,er as _,ns as v,sn as y}from"./ui-components-rkvkkTxO.js";import"./MetadataProvider-
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{a as n,h as r,m as i,r as a,y as o}from"./vendor-react-BGDDiZfJ.js";import{f as s}from"./infrastructure-Bcx6-8du.js";import{R as c,l}from"./framework-B3O15Lsq.js";import{$n as u,Cc as d,Fo as f,Oi as p,Xa as m,Zs as h,ar as g,er as _,ns as v,sn as y}from"./ui-components-rkvkkTxO.js";import"./MetadataProvider-DKJsxrNu.js";import{n as b}from"./ui-layout-CAjjF5_S.js";import{r as x}from"./appRoute-CbCiASix.js";var S=t({SearchResultsPage:()=>O}),C=e(o(),1),w=a();function T(e){let t=[];for(let n of e)n.type===`group`&&n.children?t.push(...T(n.children)):t.push(n);return t}var E={object:v,dashboard:m,page:f,report:h},D={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 O(){let{t:e}=l(),{appName:t}=i(),[a,o]=r(),[f,m]=(0,C.useState)(a.get(`q`)||``),{apps:h}=c(),S=h||[],O=x(S,t)||S[0],k=`/apps/${t}`,{user:A}=s(),j=(0,C.useMemo)(()=>{if(!O)return[];let e=T(O.navigation||[]),t={currentUserId:A?.id??null};return e.map(e=>{let{href:n}=b(e,k,t);return{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||``,href:n,type:e.type,description:e.description}}).filter(e=>e.href!==`#`)},[O,k,A?.id]),M=(0,C.useMemo)(()=>{if(!f.trim())return j;let e=f.toLowerCase();return j.filter(t=>t.label.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))},[j,f]),N=e=>{m(e),o(e?{q:e}:{})},P=(0,C.useMemo)(()=>{let e={};for(let t of M)(e[t.type]||=[]).push(t);return e},[M]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(n,{to:k,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,w.jsx)(d,{className:`h-4 w-4`}),e(`search.back`)]}),(0,w.jsx)(`h1`,{className:`text-xl font-semibold`,children:e(`search.title`)})]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`label`,{htmlFor:`search-results-input`,className:`sr-only`,children:e(`search.placeholder`)}),(0,w.jsx)(p,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,w.jsx)(y,{id:`search-results-input`,value:f,onChange:e=>N(e.target.value),placeholder:e(`search.placeholder`),className:`pl-10 h-11 text-base`,autoFocus:!0})]}),(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:f.trim()?e(M.length===1?`search.resultsCount`:`search.resultsCountPlural`,{count:M.length,query:f}):e(`search.itemsAvailable`,{count:j.length})}),M.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,w.jsx)(p,{className:`h-12 w-12 text-muted-foreground/30 mb-4`}),(0,w.jsx)(`p`,{className:`text-lg font-medium text-muted-foreground`,children:e(`search.noResults`)}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground/80 mt-1`,children:e(`search.noResultsHint`)})]}):(0,w.jsx)(`div`,{className:`space-y-6`,children:Object.entries(P).map(([t,r])=>{let i=E[t]||v,a=`search.type${t.charAt(0).toUpperCase()}${t.slice(1)}s`;return`${t.charAt(0).toUpperCase()}${t.slice(1)}`,(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h2`,{className:`text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5`,children:[(0,w.jsx)(i,{className:`h-4 w-4`}),e(a),(0,w.jsx)(g,{variant:`secondary`,className:`ml-1 text-xs`,children:r.length})]}),(0,w.jsx)(`div`,{className:`grid gap-2`,children:r.map(t=>{let r=E[t.type]||v,i=`search.badge${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}`;return(0,w.jsx)(n,{to:t.href,className:`rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:(0,w.jsx)(u,{className:`hover:bg-accent/50 transition-colors cursor-pointer`,children:(0,w.jsxs)(_,{className:`flex items-center gap-3 p-3`,children:[(0,w.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded ${D[t.type]||``}`,children:(0,w.jsx)(r,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium truncate`,children:t.label}),t.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:t.description})]}),(0,w.jsx)(g,{variant:`outline`,className:`text-xs shrink-0`,children:e(i)})]})})},t.id)})})]},t)})})]})}export{S as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a}from"./infrastructure-Bcx6-8du.js";import{L as o}from"./framework-B3O15Lsq.js";import{$n as s,Ir as c,Lr as l,Ti as u,Ya as d,ar as f,bi as p,cc as m,ei as h,eo as g,er as _,ki as v,nr as y,ns as b,oc as x,oi as S,rr as C,tc as w,tr as T,za as E}from"./ui-components-rkvkkTxO.js";import"./src-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{f as t,m as n,r,y as i}from"./vendor-react-BGDDiZfJ.js";import{d as a}from"./infrastructure-Bcx6-8du.js";import{L as o}from"./framework-B3O15Lsq.js";import{$n as s,Ir as c,Lr as l,Ti as u,Ya as d,ar as f,bi as p,cc as m,ei as h,eo as g,er as _,ki as v,nr as y,ns as b,oc as x,oi as S,rr as C,tc as w,tr as T,za as E}from"./ui-components-rkvkkTxO.js";import"./src-BBieSqPB.js";var D=e(i(),1),O=r();function k(){let e=t(),{appName:r}=n(),i=r?`/apps/${r}`:``,k=o(),A=a(),[j,M]=(0,D.useState)({users:null,orgs:null,roles:null,permissions:null,auditLogs:null}),[N,P]=(0,D.useState)(!0),F=(0,D.useCallback)(async()=>{if(k){P(!0);try{let[e,t,n,r,i]=await Promise.all([k.find(`sys_user`).catch(()=>({data:[]})),k.find(`sys_org`).catch(()=>({data:[]})),k.find(`sys_role`).catch(()=>({data:[]})),k.find(`sys_permission`).catch(()=>({data:[]})),k.find(`sys_audit_log`).catch(()=>({data:[]}))]);M({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{P(!1)}}},[k]);(0,D.useEffect)(()=>{F()},[F]);let I=[{title:`Applications`,description:`Manage all configured applications`,icon:d,href:`${i}/system/apps`,countLabel:``,count:null},{title:`Metadata`,description:`Browse and edit every metadata type the platform exposes`,icon:b,href:`${i}/component/metadata/directory`,countLabel:``,count:null},{title:`Datasources`,description:`Connect external databases and sync their tables in as objects`,icon:x,href:`${i}/component/metadata/resource?type=datasource`,countLabel:``,count:null}],L=[{title:`Users`,description:`Manage system users and accounts`,icon:c,href:`${i}/system/users`,countLabel:`users`,count:j.users},{title:`Organizations`,description:`Manage organizations and teams`,icon:w,href:`${i}/system/organizations`,countLabel:`organizations`,count:j.orgs},{title:`Roles`,description:`Configure roles and access levels`,icon:p,href:`${i}/system/roles`,countLabel:`roles`,count:j.roles},{title:`Permissions`,description:`Manage permission rules and assignments`,icon:g,href:`${i}/system/permissions`,countLabel:`permissions`,count:j.permissions},{title:`Audit Log`,description:`View system activity and changes`,icon:v,href:`${i}/system/audit-log`,countLabel:`entries`,count:j.auditLogs},{title:`AI Approvals`,description:`Review actions AI agents propose before they execute`,icon:m,href:`${i}/system/ai-approvals`,countLabel:``,count:null},{title:`App Marketplace`,description:`Browse and install approved apps from the ObjectStack catalog`,icon:S,href:`${i}/system/marketplace`,countLabel:``,count:null,adminOnly:!0},{title:`Settings`,description:`Configure mail, branding, feature flags, and more`,icon:u,href:`${i}/system/settings`,countLabel:``,count:null},{title:`Developer`,description:`API console, flow runs, and public form management`,icon:h,href:`${i}/developer`,countLabel:``,count:null},{title:`Profile`,description:`View and edit your account settings`,icon:l,href:`${i}/system/profile`,countLabel:``,count:null}],R=[...I,...L].filter(e=>!e.adminOnly||A);return(0,O.jsxs)(`div`,{className:`flex flex-col gap-6 p-4 sm:p-6`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-xl sm:text-2xl font-bold tracking-tight`,children:`System Settings`}),(0,O.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Manage applications, users, roles, permissions, and system configuration`})]}),N&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,"aria-live":`polite`,children:[(0,O.jsx)(E,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),`Loading statistics...`]}),(0,O.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:R.map(t=>{let n=t.icon;return(0,O.jsxs)(s,{className:`cursor-pointer transition-colors hover:bg-accent/50`,onClick:()=>e(t.href),"data-testid":`hub-card-${t.title.toLowerCase().replace(/\s+/g,`-`)}`,role:`link`,tabIndex:0,"aria-label":`${t.title}: ${t.description}`,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),e(t.href))},children:[(0,O.jsxs)(y,{className:`flex flex-row items-center gap-3 pb-2`,children:[(0,O.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,O.jsx)(n,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(C,{className:`text-base`,children:t.title}),(0,O.jsx)(T,{className:`text-xs`,children:t.description})]})]}),(0,O.jsx)(_,{className:`pt-0`,children:t.count!==null&&(0,O.jsxs)(f,{variant:`secondary`,children:[t.count,` `,t.countLabel]})})]},t.title)})})]})}export{k as SystemHubPage};
|