@object-ui/plugin-dashboard 4.0.6 → 4.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +42 -0
  3. package/dist/index.js +1388 -772
  4. package/dist/index.umd.cjs +1 -1
  5. package/dist/packages/plugin-dashboard/src/DashboardConfigPanel.d.ts.map +1 -1
  6. package/dist/packages/plugin-dashboard/src/DashboardRenderer.d.ts.map +1 -1
  7. package/dist/packages/plugin-dashboard/src/DashboardWithConfig.d.ts.map +1 -1
  8. package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts +23 -0
  9. package/dist/packages/plugin-dashboard/src/DrillDownDrawer.d.ts.map +1 -0
  10. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts +11 -1
  11. package/dist/packages/plugin-dashboard/src/MetricWidget.d.ts.map +1 -1
  12. package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts +11 -0
  13. package/dist/packages/plugin-dashboard/src/ObjectDataTable.d.ts.map +1 -1
  14. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts +20 -0
  15. package/dist/packages/plugin-dashboard/src/ObjectMetricWidget.d.ts.map +1 -1
  16. package/dist/packages/plugin-dashboard/src/ObjectPivotTable.d.ts.map +1 -1
  17. package/dist/packages/plugin-dashboard/src/PivotTable.d.ts +18 -0
  18. package/dist/packages/plugin-dashboard/src/PivotTable.d.ts.map +1 -1
  19. package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts +1 -11
  20. package/dist/packages/plugin-dashboard/src/WidgetConfigPanel.d.ts.map +1 -1
  21. package/dist/packages/plugin-dashboard/src/index.d.ts +3 -2
  22. package/dist/packages/plugin-dashboard/src/index.d.ts.map +1 -1
  23. package/dist/packages/plugin-dashboard/src/utils.d.ts +1 -0
  24. package/dist/packages/plugin-dashboard/src/utils.d.ts.map +1 -1
  25. package/package.json +11 -10
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/components`),require(`react`),require(`lucide-react`),require(`react/jsx-runtime`),require(`react-grid-layout`),require(`react-grid-layout/css/styles.css`),require(`@object-ui/i18n`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`react`,`lucide-react`,`react/jsx-runtime`,`react-grid-layout`,`react-grid-layout/css/styles.css`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginDashboard={},e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.React,e.lucide_react,e.react_jsx_runtime,e.ReactGridLayout,e.react_grid_layout_css_styles_css,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=Object.create,d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=p(t),a=0,o=i.length,s;a<o;a++)s=i[a],!h.call(e,s)&&s!==n&&d(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=f(t,s))||r.enumerable});return e};i=((e,t,n)=>(n=e==null?{}:u(m(e)),g(t||!e||!e.__esModule?d(n,`default`,{value:e,enumerable:!0}):n,e)))(i,1);function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}function v(e){return e?(0,r.getLazyIcon)(e):null}function y(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var b=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],x=(0,i.forwardRef)(({schema:e,className:t,dataSource:s,onRefresh:c,recordCount:l,userActions:u,designMode:d,selectedWidgetId:f,onWidgetClick:p,modalHandler:m,scriptHandlers:h,...g},x)=>{let S=(()=>{if(e.columns!=null)return e.columns;let t=e.widgets??[],n=0;for(let e of t){let t=(e.layout?.x??0)+(e.layout?.w??0);t>n&&(n=t),(e.layout?.w??0)>n&&(n=e.layout.w)}return n>4?12:4})(),C=S,w=e.gap||4,[T,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(!1),k=(0,i.useRef)(null),{executeAction:A,engine:j}=(0,n.useActionEngine)({actions:(0,i.useMemo)(()=>(e.header?.actions??[]).map(e=>({name:e.actionUrl||e.label,type:e.actionType||`url`,target:e.actionUrl,label:e.label})),[e.header?.actions])}),{dashboardLabel:M,dashboardDescription:N,dashboardActionLabel:P,widgetTitle:F,widgetDescription:I,fieldLabel:L}=(0,n.useObjectLabel)(),R=e.name,z=(0,i.useCallback)(e=>R?P(R,e.actionUrl||e.label,e.label):e.label,[R,P]),B=(0,i.useCallback)(e=>{let t=y(e.title);return!R||!e.id||t===void 0?t:F(R,e.id,t)},[R,F]),V=(0,i.useCallback)(e=>{let t=y(e.description);return!R||!e.id?t:I(R,e.id,t)},[R,I]);(0,i.useEffect)(()=>{let e=j.getRunner();if(m&&e.setModalHandler(m),h)for(let[t,n]of Object.entries(h))e.registerScript(t,n)},[j,m,h]),(0,i.useEffect)(()=>{let e=()=>O(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let H=(0,i.useCallback)(()=>{c&&(E(!0),c(),setTimeout(()=>E(!1),600))},[c]);(0,i.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!c))return k.current=setInterval(H,e.refreshInterval*1e3),()=>{k.current&&clearInterval(k.current)}},[e.refreshInterval,c,H]);let U=(0,i.useCallback)((e,t)=>{!d||!p||!t||(e.stopPropagation(),p(t))},[d,p]),W=(0,i.useCallback)((t,n,r)=>{if(!d||!p)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),p(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&p(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&p(e.id)}else t.key===`Escape`&&(t.preventDefault(),p(null))},[d,p,e.widgets]),G=(0,i.useCallback)(e=>{!d||!p||e.target===e.currentTarget&&p(null)},[d,p]),K=(e,t,i)=>{let a=e.layout?{...e.layout,w:Math.min(e.layout.w,C)}:void 0,c=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`metric`&&e.object){let t=n.data,r=_(t)&&t.aggregate?{field:e.valueField||t.aggregate.field,function:e.aggregate||t.aggregate.function,groupBy:e.categoryField??t.aggregate.groupBy??`_all`}:e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object||(_(t)?t.object:void 0),aggregate:r,filter:(_(t)?t.filter:void 0)||e.filter,label:n.label||B(e)||``,fallbackValue:n.value,trend:n.trend,icon:n.icon,description:n.description,colorVariant:e.colorVariant}}if((t===`gauge`||t===`solid-gauge`)&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object,aggregate:t,filter:e.filter,label:n.label||B(e)||``,fallbackValue:n.fallbackValue??n.value,icon:n.icon,description:n.description}}let r={funnel:`bar`,"horizontal-bar":`bar`}[t]||t;if(r===`bar`||r===`line`||r===`area`||r===`pie`||r===`donut`||r===`scatter`){let t=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(_(t)){let n=t.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a,c=e.object||t.object;return{type:`object-chart`,chartType:r,objectName:c,aggregate:o,xAxisKey:i,series:[{dataKey:s,label:c?L(c,s,s):s}],colors:b,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(!t&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0,n=e.valueField||`value`;return{type:`object-chart`,chartType:r,objectName:e.object,aggregate:t,xAxisKey:i,series:[{dataKey:n,label:L(e.object,n,n)}],colors:b,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}return{type:`chart`,chartType:r,data:Array.isArray(t)?t:t?.items||[],xAxisKey:i,series:[{dataKey:a,label:e.object?L(e.object,a,a):a}],colors:b,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(_(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(_(t)){let{data:r,...i}=n;return{type:`object-pivot`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...n,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}})(),l=e.type===`metric`,u=B(e),p=V(e),m=e.id||u||`widget-${t}`,h=d&&f===e.id,g=d?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":h,"aria-label":`Widget: ${u||`Widget ${t+1}`}`,onClick:t=>U(t,e.id),onKeyDown:n=>W(n,e.id,t)}:{},v=d?(0,r.cn)(`cursor-pointer rounded-lg transition-all outline-none`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,h?`ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10`:`hover:ring-2 hover:ring-primary/40 hover:shadow-sm`):void 0;return l?(0,o.jsxs)(`div`,{className:(0,r.cn)(`h-full w-full`,d&&`relative`,v),style:!D&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...g,children:[(0,o.jsx)(n.SchemaRenderer,{schema:c,className:(0,r.cn)(`h-full w-full`,d&&`pointer-events-none`),dataSource:s}),d&&(0,o.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},m):(0,o.jsxs)(r.Card,{className:(0,r.cn)(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,i&&`w-full`,d&&`relative`,v),style:!D&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...g,children:[u&&(0,o.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:u,children:u}),p&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:p})]}),(0,o.jsx)(r.CardContent,{className:`p-0`,children:(0,o.jsx)(`div`,{className:(0,r.cn)(`h-full w-full`,`p-3 sm:p-4 md:p-6`,d&&`pointer-events-none`),children:(0,o.jsx)(n.SchemaRenderer,{schema:c,dataSource:s})})}),d&&(0,o.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},m)},q=e.header&&(0,o.jsxs)(`div`,{className:`col-span-full mb-4`,children:[e.header.showTitle!==!1&&e.title&&(0,o.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:R?M({name:R,label:y(e.title)}):y(e.title)}),e.header.showDescription!==!1&&e.description&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:R?N({name:R,description:y(e.description)}):y(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,o.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>{let n=v(e.icon);return(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:async()=>{let{actionType:t,actionUrl:n,label:r}=e;if(!t||!n){console.warn(`[DashboardRenderer] Header action missing actionType/actionUrl:`,e);return}if(t===`url`){/^https?:\/\//.test(n)||n.startsWith(`//`)?window.location.assign(n):(window.history.pushState({},``,n),window.dispatchEvent(new PopStateEvent(`popstate`)));return}if(t===`modal`||t===`script`){let e=await A(n||r);e?.success||console.warn(`[DashboardRenderer] action failed`,e?.error);return}console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`)},children:[n&&(0,o.jsx)(n,{className:`w-4 h-4 mr-1.5`}),z(e)]},t)})})]}),J=l!==void 0&&(0,o.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l.toLocaleString(),` records`]}),Y=u?JSON.stringify(u):void 0,X=c&&(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex items-center justify-end gap-3 mb-2`,!D&&`col-span-full`),children:[J,(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:H,disabled:T,"aria-label":`Refresh dashboard`,children:[(0,o.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,T&&`animate-spin`)}),T?`Refreshing…`:`Refresh All`]})]});if(D){let n=e.widgets?.filter(e=>e.type===`metric`)||[],i=e.widgets?.filter(e=>e.type!==`metric`)||[];return(0,o.jsxs)(`div`,{ref:x,className:(0,r.cn)(`flex flex-col gap-4 px-4`,t),"data-user-actions":Y,onClick:G,...g,children:[q,X,n.length>0&&(0,o.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:G,children:n.map((e,t)=>K(e,t))}),i.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:G,children:i.map((e,t)=>K(e,t,!0))})]})}let Z=e.columns!=null||S!==4;return(0,o.jsxs)(`div`,{ref:x,className:(0,r.cn)(`grid auto-rows-min`,!Z&&`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...Z&&{gridTemplateColumns:`repeat(${C}, minmax(0, 1fr))`},gap:`${w*.25}rem`},"data-user-actions":Y,onClick:G,...g,children:[q,X,e.widgets?.map((e,t)=>K(e,t))]})});function S({editMode:e}){let t=(0,n.useDnd)();return i.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var C=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],w=({schema:e,className:t,onLayoutChange:c,persistLayoutKey:l=`dashboard-layout`,onRefresh:u})=>{let{width:d,containerRef:f,mounted:p}=(0,s.useContainerWidth)(),[m,h]=i.useState(!1),[g,v]=i.useState(!1),y=(0,n.useHasDndProvider)(),b=i.useRef(null),x=i.useCallback(()=>{u&&(v(!0),u(),setTimeout(()=>v(!1),600))},[u]);i.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!u))return b.current=setInterval(x,e.refreshInterval*1e3),()=>{b.current&&clearInterval(b.current)}},[e.refreshInterval,u,x]);let[w,T]=i.useState(()=>{if(typeof window<`u`&&l){let e=localStorage.getItem(l);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse saved layout:`,e)}}return{lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}}),E=i.useCallback((e,t)=>{T(t),c?.(e)},[c]),D=i.useCallback(()=>{typeof window<`u`&&l&&localStorage.setItem(l,JSON.stringify(w)),h(!1)},[w,l]),O=i.useCallback(()=>{T({lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}),typeof window<`u`&&l&&localStorage.removeItem(l)},[e.widgets,l]),k=i.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(_(r)){let n=r.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a;return{type:`object-chart`,chartType:t,objectName:e.object||r.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:C,className:`h-full`}}if(!r&&e.object){let n=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:t,objectName:e.object,aggregate:n,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:C,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:C,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(_(t)){let{data:r,...i}=n;return{type:`data-table`,...i,objectName:e.object||t.object,dataProvider:t,data:[],searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`data-table`,...n,objectName:e.object,data:[],searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(_(t)){let{data:r,...i}=n;return{type:`pivot`,...i,objectName:e.object||t.object,dataProvider:t,data:[]}}return{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}},[]);return(0,o.jsxs)(`div`,{ref:f,className:(0,r.cn)(`w-full`,t),"data-testid":`grid-layout`,children:[y&&(0,o.jsx)(S,{editMode:m}),(0,o.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,o.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,o.jsx)(`div`,{className:`flex gap-2`,children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(r.Button,{onClick:D,size:`sm`,variant:`default`,children:[(0,o.jsx)(a.Save,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,o.jsxs)(r.Button,{onClick:O,size:`sm`,variant:`outline`,children:[(0,o.jsx)(a.X,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,o.jsx)(r.Button,{onClick:()=>h(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,o.jsxs)(o.Fragment,{children:[u&&(0,o.jsxs)(r.Button,{onClick:x,size:`sm`,variant:`outline`,disabled:g,"aria-label":`Refresh dashboard`,children:[(0,o.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,g&&`animate-spin`)}),g?`Refreshing…`:`Refresh All`]}),(0,o.jsxs)(r.Button,{onClick:()=>h(!0),size:`sm`,variant:`outline`,children:[(0,o.jsx)(a.Edit,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),p&&(0,o.jsx)(s.ResponsiveGridLayout,{className:`layout`,width:d,layouts:w,breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},rowHeight:60,dragConfig:{enabled:m,handle:`.drag-handle`},resizeConfig:{enabled:m},onLayoutChange:E,children:e.widgets?.map((e,t)=>{let i=e.id||`widget-${t}`,s=k(e);return(0,o.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,o.jsxs)(`div`,{className:`h-full w-full relative`,children:[m&&(0,o.jsx)(`div`,{className:`drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border`,children:(0,o.jsx)(a.GripVertical,{className:`h-4 w-4`})}),(0,o.jsx)(n.SchemaRenderer,{schema:s,className:`h-full w-full`})]}):(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,m&&`ring-2 ring-primary/20`),children:[e.title&&(0,o.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,o.jsx)(r.CardTitle,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),m&&(0,o.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,o.jsx)(a.GripVertical,{className:`h-4 w-4`})})]}),(0,o.jsx)(r.CardContent,{className:`p-0 h-full`,children:(0,o.jsx)(`div`,{className:(0,r.cn)(`h-full w-full overflow-auto p-4`),children:(0,o.jsx)(n.SchemaRenderer,{schema:s})})})]})},i)})})]})};function T(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var E={default:`bg-muted text-muted-foreground`,blue:`bg-blue-500/10 text-blue-600 dark:text-blue-400`,teal:`bg-teal-500/10 text-teal-600 dark:text-teal-400`,orange:`bg-orange-500/10 text-orange-600 dark:text-orange-400`,purple:`bg-purple-500/10 text-purple-600 dark:text-purple-400`,success:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,warning:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,danger:`bg-rose-500/10 text-rose-600 dark:text-rose-400`},D=({label:e,value:t,trend:n,icon:s,className:c,description:l,loading:u,error:d,colorVariant:f=`default`,...p})=>{let m=E[f]||E.default,h=(0,i.useMemo)(()=>{if(typeof s==`string`){let e=(0,r.getLazyIcon)(s);return e?(0,o.jsx)(e,{className:`h-4 w-4`}):null}return s},[s]);return(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden`,c),...p,children:[(0,o.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm font-medium truncate`,children:T(e)}),h&&(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-8 w-8 items-center justify-center rounded-md shrink-0`,m),children:h})]}),(0,o.jsx)(r.CardContent,{children:u?(0,o.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-loading`,children:[(0,o.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,o.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):d?(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-error`,role:`alert`,children:[(0,o.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,o.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:t}),(n||l)&&(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1 truncate`,children:[n&&(0,o.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2 shrink-0 font-medium`,n.direction===`up`&&`text-emerald-600 dark:text-emerald-400`,n.direction===`down`&&`text-rose-600 dark:text-rose-400`,n.direction===`neutral`&&`text-muted-foreground`),children:[n.direction===`up`&&(0,o.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,o.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,o.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,o.jsx)(`span`,{className:`truncate`,children:T(l)||T(n?.label)})]})]})})]})};function O(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var k=({title:e,value:t,icon:n,trend:i,trendValue:s,description:c,className:l,loading:u,error:d,...f})=>{let p=n?(0,r.getLazyIcon)(n):null;return(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full`,l),...f,children:[(0,o.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm font-medium`,children:O(e)}),p&&(0,o.jsx)(p,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(r.CardContent,{children:u?(0,o.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-card-loading`,children:[(0,o.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,o.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):d?(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-card-error`,role:`alert`,children:[(0,o.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,o.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(i||s||c)&&(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[i&&s&&(0,o.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2`,i===`up`&&`text-green-500`,i===`down`&&`text-red-500`,i===`neutral`&&`text-yellow-500`),children:[i===`up`&&(0,o.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),i===`down`&&(0,o.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),i===`neutral`&&(0,o.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),s]}),O(c)]})]})})]})},A=({objectName:e,aggregate:t,filter:r,label:a,fallbackValue:s,trend:c,icon:l,className:u,description:d,dataSource:f,colorVariant:p})=>{let m=(0,i.useContext)(n.SchemaRendererContext),h=f||m?.dataSource,[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)(!1),[b,x]=(0,i.useState)(null),S=(0,i.useCallback)(async(n,i)=>{if(!(!n||!e)){i.current&&(y(!0),x(null));try{let a;if(t&&typeof n.aggregate==`function`){let i=await n.aggregate(e,{field:t.field,function:t.function,groupBy:t.groupBy||`_all`,filter:r}),o=Array.isArray(i)?i:[];a=o.length===0?0:t.function===`count`?o.reduce((e,n)=>e+(Number(n[t.field])||Number(n.count)||0),0):o[0][t.field]??0}else if(typeof n.find==`function`){let t=await n.find(e,{$filter:r});a=(Array.isArray(t)?t:t?.data||t?.records||[]).length}else return;i.current&&_(a)}catch(e){console.error(`[ObjectMetricWidget] Fetch error:`,e),i.current&&x(e instanceof Error?e.message:`Failed to load metric`)}finally{i.current&&y(!1)}}},[e,(0,i.useMemo)(()=>t?JSON.stringify(t):``,[t]),(0,i.useMemo)(()=>r?JSON.stringify(r):``,[r])]);return(0,i.useEffect)(()=>{let t={current:!0};return h&&e?S(h,t):(_(null),x(null)),()=>{t.current=!1}},[h,e,S]),(0,o.jsx)(D,{label:a,value:g===null?h?`—`:s??`—`:g,trend:c,icon:l,className:u,description:d,loading:v,error:b,colorVariant:p})};function j(e,t){if(!t)return String(e);let n=``,r=``,i=!1,a,o=t,s=o.match(/^([^0-9.,#]*)/);if(s&&s[1]){let e=s[1];n=e.replace(`,`,``),e.includes(`,`)&&(i=!0),o=o.slice(s[1].length)}o.includes(`,`)&&(i=!0,o=o.replace(/,/g,``));let c=o.match(/\.(\d+)f?/);c&&(a=Number(c[1]),o=o.slice(c[0].length)),r=o.replace(/[0-9#.f]/g,``);let l=a===void 0?String(e):e.toFixed(a);if(i){let[e,t]=l.split(`.`),i=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`);return n+(t===void 0?i:`${i}.${t}`)+r}return n+l+r}function M(e,t){if(e.length===0)return 0;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return Math.min(...e);case`max`:return Math.max(...e);default:return e.reduce((e,t)=>e+t,0)}}var N=({schema:e,className:t})=>{let{title:n,rowField:a,columnField:s,valueField:c,aggregation:l=`sum`,data:u=[],showRowTotals:d=!1,showColumnTotals:f=!1,format:p,columnColors:m}=e,h=Array.isArray(u)?u:[],{rowKeys:g,colKeys:_,matrix:v,rowTotals:y,colTotals:b,grandTotal:x}=(0,i.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of h){let i=String(r[a]??``),o=String(r[s]??``),l=Number(r[c])||0;e.set(i,!0),t.set(o,!0),n[i]||(n[i]={}),n[i][o]||(n[i][o]=[]),n[i][o].push(l)}let r=Array.from(e.keys()),i=Array.from(t.keys()),o={},u={},d={};for(let e of r){o[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],a=M(i,l);o[e][r]=a,t.push(...i),!d[r]&&d[r]}u[e]=M(t,l)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}d[e]=M(t,l)}let f=[];for(let e of h)f.push(Number(e[c])||0);return{rowKeys:r,colKeys:i,matrix:o,rowTotals:u,colTotals:d,grandTotal:M(f,l)}},[h,a,s,c,l]),S=e=>j(e,p);return h.length===0?(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,"data-testid":`pivot-empty-state`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})]}):(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,t),children:[n&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:n}),(0,o.jsxs)(`table`,{className:`w-full text-sm border-collapse`,role:`table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,o.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground`,children:a}),_.map(e=>(0,o.jsx)(`th`,{className:(0,r.cn)(`text-right p-2 font-medium`,m?.[e]??`text-muted-foreground`),children:e},e)),d&&(0,o.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20`,children:`Total`})]})}),(0,o.jsx)(`tbody`,{children:g.map(e=>(0,o.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,o.jsx)(`td`,{className:`p-2 font-medium`,children:e}),_.map(t=>(0,o.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,m?.[t]),children:S(v[e]?.[t]??0)},t)),d&&(0,o.jsx)(`td`,{className:`text-right p-2 font-semibold tabular-nums bg-muted/20`,children:S(y[e]??0)})]},e))}),f&&(0,o.jsx)(`tfoot`,{children:(0,o.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,o.jsx)(`td`,{className:`p-2`,children:`Total`}),_.map(e=>(0,o.jsx)(`td`,{className:`text-right p-2 tabular-nums`,children:S(b[e]??0)},e)),d&&(0,o.jsx)(`td`,{className:`text-right p-2 tabular-nums font-bold`,children:S(x)})]})})]})]})},P=({schema:e,dataSource:a,className:s})=>{let c=(0,i.useContext)(n.SchemaRendererContext),l=a||c?.dataSource,u=(0,n.useDataScope)(e.bind),[d,f]=(0,i.useState)([]),[p,m]=(0,i.useState)(!1),[h,g]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!u&&(!e.data||e.data.length===0)&&(async()=>{if(!(!l||!e.objectName)){n&&(m(!0),g(null));try{let r;if(typeof l.find==`function`)r=(0,t.extractRecords)(await l.find(e.objectName,{$filter:e.filter}));else return;n&&f(r)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),n&&g(e instanceof Error?e.message:`Failed to load data`)}finally{n&&m(!1)}}})(),()=>{n=!1}},[e.objectName,l,u,e.data,e.filter]);let _=u||e.data||d,v=Array.isArray(_)?_:[];return p&&v.length===0?(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`pivot-loading`,children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-6 w-24`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-5 w-24`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`})]},e))]})]}):h?(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`pivot-error`,children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,o.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,o.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:h})]})]}):!l&&e.objectName&&v.length===0?(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,o.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]}):(0,o.jsx)(N,{schema:{...e,data:v},className:s})};function F(e){return e.map(e=>typeof e==`string`?{header:e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().replace(/\b\w/g,e=>e.toUpperCase()),accessorKey:e}:e)}var I=({schema:e,dataSource:a,className:s})=>{let c=(0,i.useContext)(n.SchemaRendererContext),u=a||c?.dataSource,d=(0,n.useDataScope)(e.bind),{fieldLabel:f,fieldOptionLabel:p}=(0,l.useSafeFieldLabel)(),[m,h]=(0,i.useState)([]),[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)(!1),[b,x]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!d&&(!e.data||e.data.length===0)&&(async()=>{if(!(!u||!e.objectName)){n&&(y(!0),x(null));try{let r;if(typeof u.find==`function`)r=(0,t.extractRecords)(await u.find(e.objectName,{$filter:e.filter}));else return;n&&h(r)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),n&&x(e instanceof Error?e.message:`Failed to load data`)}finally{n&&y(!1)}}})(),()=>{n=!1}},[e.objectName,u,d,e.data,e.filter]),(0,i.useEffect)(()=>{let t=!0;if(!(!u||!e.objectName||typeof u.getObjectSchema!=`function`))return u.getObjectSchema(e.objectName).then(e=>{t&&_(e)}).catch(()=>{}),()=>{t=!1}},[e.objectName,u]);let S=d||e.data||m,C=Array.isArray(S)?S:[],w=(0,i.useMemo)(()=>{let t=e.objectName,n=e=>{let n=e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`);return t?f(t,e,n):n};if(e.columns&&e.columns.length>0){let n=F(e.columns);return t?n.map(e=>({...e,header:f(t,e.accessorKey,e.header)})):n}return C.length===0?[]:Object.keys(C[0]).filter(e=>!e.startsWith(`_`)).map(e=>({header:n(e),accessorKey:e}))},[e.columns,e.objectName,C,f]),T=(0,i.useMemo)(()=>{let t=e.objectName;if(!t||!g?.fields||C.length===0)return C;let n={};for(let e of w){let t=g.fields[e.accessorKey];if(!t)continue;let r=t.type;if(r!==`select`&&r!==`picklist`&&r!==`dropdown`)continue;let i=t.options||[],a={};for(let e of i)typeof e==`string`?a[e]=e:e&&typeof e==`object`&&(a[String(e.value)]=e.label||String(e.value));n[e.accessorKey]=a}return Object.keys(n).length===0?C:C.map(e=>{let r={...e};for(let[i,a]of Object.entries(n)){let n=e[i];if(n==null||n===``)continue;let o=String(n);r[i]=p(t,i,o,a[o]||o)}return r})},[C,w,g,e.objectName,p]);return v&&C.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-loading`,children:(0,o.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`})]},e))]})}):b?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-error`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,o.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,o.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:b})]})}):!u&&e.objectName&&C.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),children:(0,o.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,o.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})}):C.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-empty-state`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,o.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,o.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})}):(0,o.jsx)(n.SchemaRenderer,{schema:{...e,type:`data-table`,data:T,columns:w},className:s})},L={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,fields:[{key:`columns`,label:`Columns`,type:`slider`,defaultValue:3,min:1,max:12,step:1},{key:`gap`,label:`Gap`,type:`slider`,defaultValue:4,min:0,max:16,step:1},{key:`rowHeight`,label:`Row height`,type:`input`,defaultValue:`120`,placeholder:`e.g. 120`}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Refresh interval`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Manual`},{value:`30`,label:`30s`},{value:`60`,label:`1 min`},{value:`300`,label:`5 min`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard title`},{key:`showDescription`,label:`Show description`,type:`switch`,defaultValue:!0},{key:`theme`,label:`Theme`,type:`select`,defaultValue:`auto`,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`auto`,label:`Auto`}]}]}]};function R({open:e,onClose:t,config:n,onSave:i,onFieldChange:a}){let{draft:s,isDirty:c,updateField:l,discard:u}=(0,r.useConfigDraft)(n,{onUpdate:a});return(0,o.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:L,draft:s,isDirty:c,onFieldChange:l,onSave:()=>i(s),onDiscard:u})}var z=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`donut`,label:`Donut Chart`},{value:`area`,label:`Area Chart`},{value:`scatter`,label:`Scatter Plot`},{value:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`},{value:`list`,label:`List`},{value:`custom`,label:`Custom`}],B=[{value:`default`,label:`Default`},{value:`blue`,label:`Blue`},{value:`teal`,label:`Teal`},{value:`orange`,label:`Orange`},{value:`purple`,label:`Purple`},{value:`success`,label:`Success`},{value:`warning`,label:`Warning`},{value:`danger`,label:`Danger`}],V=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],H=[`bar`,`line`,`area`,`pie`,`donut`,`scatter`];function U(e){return!!e&&H.includes(e)}var W=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],G=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function K(e,t,n,i){return{key:e,label:t,type:`custom`,render:(a,s,c)=>(0,o.jsx)(r.ConfigRow,{label:t,children:(0,o.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,o.jsx)(r.Combobox,{options:i??[],value:a??``,onValueChange:s,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!c.object})})})}}function q(e,t,n){let i=e&&e.length>0,a=i?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,o.jsx)(r.ConfigRow,{label:`Data source`,children:(0,o.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,o.jsx)(r.Combobox,{options:e,value:t??``,onValueChange:n,placeholder:`Select object…`,searchPlaceholder:`Search objects…`,emptyText:`No objects found.`,className:`h-7 w-32 text-xs`})})})}:{key:`object`,label:`Data source`,type:`input`,placeholder:`Object name`},s=i?K(`categoryField`,`Category field`,`Select field…`,t):{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`},c=i?K(`valueField`,`Value field`,`Select field…`,t):{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`},l=i?K(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},u=i?K(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},d=i?K(`pivotValueField`,`Field`,`Select value field…`,t):{key:`pivotValueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(U(n)?`Chart`:`Widget`)],sections:[{key:`general`,title:`General`,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Widget title`},{key:`description`,label:`Description`,type:`input`,placeholder:`Widget description`},{key:`type`,label:`Widget type`,type:`select`,options:z,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[a,s,c,{key:`aggregate`,label:`Aggregation`,type:`select`,options:V,defaultValue:`count`}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[a]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[l,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:W,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:G,defaultValue:`asc`},{key:`showRowLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showRowTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[u,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:W,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:G,defaultValue:`asc`},{key:`showColumnLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showColumnTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-values`,title:`Values`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[d,{key:`aggregation`,label:`Aggregation`,type:`select`,options:V,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>U(e.type),fields:[{key:`xAxisLabel`,label:`X-axis label`,type:`input`,placeholder:`e.g. Month`},{key:`yAxisLabel`,label:`Y-axis label`,type:`input`,placeholder:`e.g. Revenue`},{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`table-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`table`,fields:[{key:`searchable`,label:`Searchable`,type:`switch`,defaultValue:!1},{key:`pagination`,label:`Pagination`,type:`switch`,defaultValue:!1}]},{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`layoutW`,label:`Width (columns)`,type:`slider`,min:1,max:12,step:1,defaultValue:1},{key:`layoutH`,label:`Height (rows)`,type:`slider`,min:1,max:6,step:1,defaultValue:1}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:B,defaultValue:`default`},{key:`actionUrl`,label:`Action URL`,type:`input`,placeholder:`https://...`}]}]}}function J(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`){let t=e;return t.defaultValue||t.key||``}return String(e)}function Y({open:e,onClose:t,config:n,onSave:a,onFieldChange:s,headerExtra:c,availableObjects:l,availableFields:u}){let{draft:d,isDirty:f,updateField:p,discard:m}=(0,r.useConfigDraft)(i.useMemo(()=>({...n,title:typeof n.title==`object`?J(n.title):n.title,description:typeof n.description==`object`?J(n.description):n.description}),[n]),{onUpdate:s});return(0,o.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:i.useMemo(()=>q(l,u,d.type),[l,u,d.type]),draft:d,isDirty:f,onFieldChange:p,onSave:()=>a(d),onDiscard:m,headerExtra:c})}function X({schema:e,config:t,onConfigSave:n,onWidgetSave:s,onRefresh:c,recordCount:l,defaultConfigOpen:u=!1,className:d}){let[f,p]=(0,i.useState)(u),[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(e),[v,y]=(0,i.useState)(0);(0,i.useEffect)(()=>{_(e),y(e=>e+1)},[e]);let b=i.useMemo(()=>{if(!m||!g.widgets)return null;let e=g.widgets.find(e=>(e.id||e.title)===m);return e?{id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??``,valueField:e.valueField??``,aggregate:e.aggregate??``,colorVariant:e.colorVariant??`default`,actionUrl:e.actionUrl??``,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}:null},[m,v]),S=(0,i.useCallback)(e=>{h(e),p(!0)},[]),C=(0,i.useCallback)(()=>{h(null)},[]),w=(0,i.useCallback)((e,t)=>{m&&_(n=>n.widgets?{...n,widgets:n.widgets.map(n=>(n.id||n.title)===m?e===`layoutW`?{...n,layout:{...n.layout||{},w:t}}:e===`layoutH`?{...n,layout:{...n.layout||{},h:t}}:{...n,[e]:t}:n)}:n)},[m]),T=(0,i.useCallback)(e=>{m&&s&&s(m,e),h(null),y(e=>e+1)},[m,s]),E=(0,i.useCallback)(()=>{p(e=>!e),h(null)},[]);return(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex h-full w-full`,d),"data-testid":`dashboard-with-config`,children:[(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,o.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,o.jsxs)(r.Button,{size:`sm`,variant:f?`default`:`outline`,onClick:E,"data-testid":`dashboard-config-toggle`,children:[(0,o.jsx)(a.Settings,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,o.jsx)(x,{schema:g,onRefresh:c,recordCount:l,designMode:f,selectedWidgetId:m,onWidgetClick:S})]}),f&&(0,o.jsx)(`div`,{className:`relative shrink-0`,children:m&&b?(0,o.jsx)(Y,{open:!0,onClose:C,config:b,onSave:T,onFieldChange:w}):(0,o.jsx)(R,{open:!0,onClose:()=>p(!1),config:t,onSave:n})})]})}t.ComponentRegistry.register(`dashboard`,x,{namespace:`view`,label:`Dashboard`,category:`Complex`,icon:`layout-dashboard`,inputs:[{name:`columns`,type:`number`,label:`Columns`,defaultValue:3},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:3,widgets:[]}}),t.ComponentRegistry.register(`metric`,D,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),t.ComponentRegistry.register(`metric-card`,k,{namespace:`plugin-dashboard`,label:`Metric Card`,category:`Dashboard`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`value`,type:`string`,label:`Value`,required:!0},{name:`icon`,type:`string`,label:`Icon (Lucide name)`},{name:`trend`,type:`enum`,label:`Trend`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}]},{name:`trendValue`,type:`string`,label:`Trend Value (e.g., +12%)`},{name:`description`,type:`string`,label:`Description`}],defaultProps:{title:`Metric`,value:`0`}}),t.ComponentRegistry.register(`object-metric`,A,{namespace:`plugin-dashboard`,label:`Object Metric`,category:`Dashboard`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`label`,type:`string`,label:`Label`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`},{name:`icon`,type:`string`,label:`Icon (Lucide name)`}],defaultProps:{label:`Metric`}}),t.ComponentRegistry.register(`pivot`,N,{namespace:`plugin-dashboard`,label:`Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`,data:[]}}),t.ComponentRegistry.register(`object-pivot`,P,{namespace:`plugin-dashboard`,label:`Object Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`}}),t.ComponentRegistry.register(`dashboard-grid`,w,{namespace:`plugin-dashboard`,label:`Dashboard Grid (Editable)`,category:`Complex`,icon:`layout-grid`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`persistLayoutKey`,type:`string`,label:`Layout Storage Key`,defaultValue:`dashboard-layout`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Dashboard`,widgets:[],persistLayoutKey:`dashboard-layout`}}),t.ComponentRegistry.register(`object-data-table`,I,{namespace:`plugin-dashboard`,label:`Object Data Table`,category:`Dashboard`,icon:`table`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`searchable`,type:`boolean`,label:`Searchable`},{name:`pagination`,type:`boolean`,label:`Pagination`}],defaultProps:{searchable:!1,pagination:!1}});var Z={DashboardRenderer:x,DashboardGridLayout:w,MetricWidget:D,MetricCard:k,ObjectMetricWidget:A,PivotTable:N,ObjectPivotTable:P,ObjectDataTable:I,DashboardConfigPanel:R,WidgetConfigPanel:Y,DashboardWithConfig:X};e.DashboardConfigPanel=R,e.DashboardGridLayout=w,e.DashboardRenderer=x,e.DashboardWithConfig=X,e.MetricCard=k,e.MetricWidget=D,e.ObjectDataTable=I,e.ObjectMetricWidget=A,e.ObjectPivotTable=P,e.PivotTable=N,e.WidgetConfigPanel=Y,e.dashboardComponents=Z});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`@object-ui/react`),require(`@object-ui/components`),require(`react`),require(`lucide-react`),require(`react/jsx-runtime`),require(`react-grid-layout`),require(`react-grid-layout/css/styles.css`),require(`@object-ui/i18n`),require(`@object-ui/fields`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`react`,`lucide-react`,`react/jsx-runtime`,`react-grid-layout`,`react-grid-layout/css/styles.css`,`@object-ui/i18n`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginDashboard={},e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.React,e.lucide_react,e.react_jsx_runtime,e.ReactGridLayout,e.react_grid_layout_css_styles_css,e.ObjectUII18n,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e};i=((e,t,n)=>(n=e==null?{}:d(h(e)),_(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e)))(i,1);function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.provider===`object`}function y(e){return e?(0,r.getLazyIcon)(e):null}function b(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var x=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],S=new Set([`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`]);function C(e){return S.has(e)?{enabled:!0}:void 0}var w=(0,i.forwardRef)(({schema:e,className:t,dataSource:s,onRefresh:c,recordCount:l,userActions:u,designMode:d,selectedWidgetId:f,onWidgetClick:p,modalHandler:m,scriptHandlers:h,...g},_)=>{let S=(()=>{if(e.columns!=null)return e.columns;let t=e.widgets??[],n=0;for(let e of t){let t=(e.layout?.x??0)+(e.layout?.w??0);t>n&&(n=t),(e.layout?.w??0)>n&&(n=e.layout.w)}return n>4?12:4})(),w=S,T=e.gap||4,[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)(!1),A=(0,i.useRef)(null),{executeAction:j,engine:M}=(0,n.useActionEngine)({actions:(0,i.useMemo)(()=>(e.header?.actions??[]).map(e=>({name:e.actionUrl||e.label,type:e.actionType||`url`,target:e.actionUrl,label:e.label})),[e.header?.actions])}),{dashboardLabel:N,dashboardDescription:P,dashboardActionLabel:F,widgetTitle:I,widgetDescription:L,fieldLabel:R}=(0,n.useObjectLabel)(),z=e.name,B=(0,i.useCallback)(e=>z?F(z,e.actionUrl||e.label,e.label):e.label,[z,F]),V=(0,i.useCallback)(e=>{let t=b(e.title);return!z||!e.id||t===void 0?t:I(z,e.id,t)},[z,I]),H=(0,i.useCallback)(e=>{let t=b(e.description);return!z||!e.id?t:L(z,e.id,t)},[z,L]);(0,i.useEffect)(()=>{let e=M.getRunner();if(m&&e.setModalHandler(m),h)for(let[t,n]of Object.entries(h))e.registerScript(t,n)},[M,m,h]),(0,i.useEffect)(()=>{let e=()=>k(window.innerWidth<768);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let U=(0,i.useCallback)(()=>{c&&(D(!0),c(),setTimeout(()=>D(!1),600))},[c]);(0,i.useEffect)(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!c))return A.current=setInterval(U,e.refreshInterval*1e3),()=>{A.current&&clearInterval(A.current)}},[e.refreshInterval,c,U]);let W=(0,i.useCallback)((e,t)=>{!d||!p||!t||(e.stopPropagation(),p(t))},[d,p]),G=(0,i.useCallback)((t,n,r)=>{if(!d||!p)return;let i=e.widgets||[];if(t.key===`Enter`||t.key===` `)t.preventDefault(),p(n??null);else if(t.key===`ArrowRight`||t.key===`ArrowDown`){t.preventDefault();let e=r+1<i.length?i[r+1]:null;e?.id&&p(e.id)}else if(t.key===`ArrowLeft`||t.key===`ArrowUp`){t.preventDefault();let e=r-1>=0?i[r-1]:null;e?.id&&p(e.id)}else t.key===`Escape`&&(t.preventDefault(),p(null))},[d,p,e.widgets]),K=(0,i.useCallback)(e=>{!d||!p||e.target===e.currentTarget&&p(null)},[d,p]),q=(e,t,i)=>{let a=e.layout?{...e.layout,w:Math.min(e.layout.w,w)}:void 0,c=(()=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`metric`&&e.object){let t=n.data,r=v(t)&&t.aggregate?{field:e.valueField||t.aggregate.field,function:e.aggregate||t.aggregate.function,groupBy:e.categoryField??t.aggregate.groupBy??`_all`}:e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object||(v(t)?t.object:void 0),aggregate:r,filter:(v(t)?t.filter:void 0)||e.filter,label:n.label||V(e)||``,fallbackValue:n.value,trend:n.trend,icon:n.icon,description:n.description,colorVariant:e.colorVariant,format:n.format,currency:n.currency,prefix:n.prefix,suffix:n.suffix,drillDown:n.drillDown??{enabled:!0},title:n.label||V(e)||``}}if((t===`gauge`||t===`solid-gauge`)&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`_all`}:void 0;return{type:`object-metric`,objectName:e.object,aggregate:t,filter:e.filter,label:n.label||V(e)||``,fallbackValue:n.fallbackValue??n.value,icon:n.icon,description:n.description}}let r={}[t]||t;if(r===`bar`||r===`horizontal-bar`||r===`line`||r===`area`||r===`pie`||r===`donut`||r===`scatter`||r===`funnel`){let t=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(v(t)){let o=t.aggregate,s=o?{field:e.valueField||o.field,function:e.aggregate||o.function,groupBy:e.categoryField||o.groupBy}:void 0,c=s?.field||a,l=e.object||t.object;return{type:`object-chart`,chartType:r,objectName:l,aggregate:s,xAxisKey:i,series:[{dataKey:c,label:l?R(l,c,c):c}],colors:x,drillDown:n.drillDown??C(r),className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(!t&&e.object){let t=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0,a=e.valueField||`value`;return{type:`object-chart`,chartType:r,objectName:e.object,aggregate:t,xAxisKey:i,series:[{dataKey:a,label:R(e.object,a,a)}],colors:x,drillDown:n.drillDown??C(r),className:`h-[200px] sm:h-[250px] md:h-[300px]`}}return{type:`chart`,chartType:r,data:Array.isArray(t)?t:t?.items||[],xAxisKey:i,series:[{dataKey:a,label:e.object?R(e.object,a,a):a}],colors:x,className:`h-[200px] sm:h-[250px] md:h-[300px]`}}if(t===`table`){let t=e.data||n.data;if(v(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:e.searchable??!1,pagination:e.pagination??!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data,r=e,i={rowField:r.rowField??n.rowField,columnField:r.columnField??n.columnField,valueField:r.valueField??n.valueField,aggregation:r.aggregation??n.aggregation??`sum`,showRowTotals:r.showRowTotals??n.showRowTotals,showColumnTotals:r.showColumnTotals??n.showColumnTotals,format:r.format??n.format},a=(v(t)||!t&&e.object)&&n.drillDown===void 0?{...n,drillDown:{enabled:!0}}:n;if(v(t)){let{data:n,...r}=a;return{type:`object-pivot`,...r,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter}}return!t&&e.object?{type:`object-pivot`,...a,...i,objectName:e.object,filter:e.filter}:{type:`pivot`,...n,...i,data:Array.isArray(t)?t:t?.items||[]}}if(t===`list`){let t=e.data||n.data;if(v(t)){let{data:r,...i}=n;return{type:`object-data-table`,...i,objectName:e.object||t.object,dataProvider:t,filter:t.filter||e.filter,searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`object-data-table`,...n,objectName:e.object,filter:e.filter,searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:Array.isArray(t)?t:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}return t===`custom`?{type:`text`,value:"Custom widget — set `component` to a UIComponent schema.",variant:`caption`,align:`center`,className:`flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-muted-foreground`}:{...e,...n}})(),l=e.type===`metric`,u=V(e),p=H(e),m=e.id||u||`widget-${t}`,h=d&&f===e.id,g=d?{"data-testid":`dashboard-preview-widget-${e.id}`,"data-widget-id":e.id,role:`button`,tabIndex:0,"aria-selected":h,"aria-label":`Widget: ${u||`Widget ${t+1}`}`,onClick:t=>W(t,e.id),onKeyDown:n=>G(n,e.id,t)}:{},_=d?(0,r.cn)(`cursor-pointer rounded-lg transition-all outline-none`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,h?`ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10`:`hover:ring-2 hover:ring-primary/40 hover:shadow-sm`):void 0;return l?(0,o.jsxs)(`div`,{className:(0,r.cn)(`h-full w-full`,d&&`relative`,_),style:!O&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...g,children:[(0,o.jsx)(n.SchemaRenderer,{schema:c,className:(0,r.cn)(`h-full w-full`,d&&`pointer-events-none`),dataSource:s}),d&&(0,o.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},m):(0,o.jsxs)(r.Card,{className:(0,r.cn)(`overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md`,`bg-card/50 backdrop-blur-sm`,i&&`w-full`,d&&`relative`,_),style:!O&&a?{gridColumn:`span ${a.w}`,gridRow:`span ${a.h}`}:void 0,...g,children:[u&&(0,o.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm sm:text-base font-medium tracking-tight truncate`,title:u,children:u}),p&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5 line-clamp-2`,children:p})]}),(0,o.jsx)(r.CardContent,{className:`p-0`,children:(0,o.jsx)(`div`,{className:(0,r.cn)(`h-full w-full`,`p-3 sm:p-4 md:p-6`,d&&`pointer-events-none`),children:(0,o.jsx)(n.SchemaRenderer,{schema:c,dataSource:s})})}),d&&(0,o.jsx)(`div`,{className:`absolute inset-0 z-10`,"aria-hidden":`true`,"data-testid":`widget-click-overlay`})]},m)},J=e.header&&(0,o.jsxs)(`div`,{className:`col-span-full mb-4`,children:[e.header.showTitle!==!1&&e.title&&(0,o.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight`,children:z?N({name:z,label:b(e.title)}):b(e.title)}),e.header.showDescription!==!1&&e.description&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:z?P({name:z,description:b(e.description)}):b(e.description)}),e.header.actions&&e.header.actions.length>0&&(0,o.jsx)(`div`,{className:`flex gap-2 mt-3`,children:e.header.actions.map((e,t)=>{let n=y(e.icon);return(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:async()=>{let{actionType:t,actionUrl:n,label:r}=e;if(!t||!n){console.warn(`[DashboardRenderer] Header action missing actionType/actionUrl:`,e);return}if(t===`url`){/^https?:\/\//.test(n)||n.startsWith(`//`)?window.location.assign(n):(window.history.pushState({},``,n),window.dispatchEvent(new PopStateEvent(`popstate`)));return}if(t===`modal`||t===`script`){let e=await j(n||r);e?.success||console.warn(`[DashboardRenderer] action failed`,e?.error);return}console.warn(`[DashboardRenderer] Unknown header actionType="${t}" for "${r}"`)},children:[n&&(0,o.jsx)(n,{className:`w-4 h-4 mr-1.5`}),B(e)]},t)})})]}),ee=l!==void 0&&(0,o.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l.toLocaleString(),` records`]}),Y=u?JSON.stringify(u):void 0,X=c&&(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex items-center justify-end gap-3 mb-2`,!O&&`col-span-full`),children:[ee,(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,onClick:U,disabled:E,"aria-label":`Refresh dashboard`,children:[(0,o.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,E&&`animate-spin`)}),E?`Refreshing…`:`Refresh All`]})]});if(O){let n=e.widgets?.filter(e=>e.type===`metric`)||[],i=e.widgets?.filter(e=>e.type!==`metric`)||[];return(0,o.jsxs)(`div`,{ref:_,className:(0,r.cn)(`flex flex-col gap-4 px-4`,t),"data-user-actions":Y,onClick:K,...g,children:[J,X,n.length>0&&(0,o.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,onClick:K,children:n.map((e,t)=>q(e,t))}),i.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,onClick:K,children:i.map((e,t)=>q(e,t,!0))})]})}let Z=e.columns!=null||S!==4;return(0,o.jsxs)(`div`,{ref:_,className:(0,r.cn)(`grid auto-rows-min`,!Z&&`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,t),style:{...Z&&{gridTemplateColumns:`repeat(${w}, minmax(0, 1fr))`},gap:`${T*.25}rem`},"data-user-actions":Y,onClick:K,...g,children:[J,X,e.widgets?.map((e,t)=>q(e,t))]})});function T({editMode:e}){let t=(0,n.useDnd)();return i.useEffect(()=>{if(e)return t.startDrag({id:`dashboard-layout`,type:`dashboard-widget`,data:{}}),()=>{t.endDrag()};t.endDrag(`dashboard`)},[e,t]),null}var E=[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],D=({schema:e,className:t,onLayoutChange:c,persistLayoutKey:l=`dashboard-layout`,onRefresh:u})=>{let{width:d,containerRef:f,mounted:p}=(0,s.useContainerWidth)(),[m,h]=i.useState(!1),[g,_]=i.useState(!1),y=(0,n.useHasDndProvider)(),b=i.useRef(null),x=i.useCallback(()=>{u&&(_(!0),u(),setTimeout(()=>_(!1),600))},[u]);i.useEffect(()=>{if(!(!e.refreshInterval||e.refreshInterval<=0||!u))return b.current=setInterval(x,e.refreshInterval*1e3),()=>{b.current&&clearInterval(b.current)}},[e.refreshInterval,u,x]);let[S,C]=i.useState(()=>{if(typeof window<`u`&&l){let e=localStorage.getItem(l);if(e)try{return JSON.parse(e)}catch(e){console.error(`Failed to parse saved layout:`,e)}}return{lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}}),w=i.useCallback((e,t)=>{C(t),c?.(e)},[c]),D=i.useCallback(()=>{typeof window<`u`&&l&&localStorage.setItem(l,JSON.stringify(S)),h(!1)},[S,l]),O=i.useCallback(()=>{C({lg:e.widgets?.map((e,t)=>({i:e.id||`widget-${t}`,x:e.layout?.x||t%4*3,y:e.layout?.y||Math.floor(t/4)*4,w:e.layout?.w||3,h:e.layout?.h||4}))||[]}),typeof window<`u`&&l&&localStorage.removeItem(l)},[e.widgets,l]),k=i.useCallback(e=>{if(e.component)return e.component;let t=e.type,n=e.options||{};if(t===`bar`||t===`horizontal-bar`||t===`line`||t===`area`||t===`pie`||t===`donut`||t===`scatter`||t===`funnel`){let r=e.data||n.data,i=e.categoryField||n.xField||`name`,a=e.valueField||n.yField||`value`;if(v(r)){let n=r.aggregate,o=n?{field:e.valueField||n.field,function:e.aggregate||n.function,groupBy:e.categoryField||n.groupBy}:void 0,s=o?.field||a;return{type:`object-chart`,chartType:t,objectName:e.object||r.object,aggregate:o,xAxisKey:i,series:[{dataKey:s}],colors:E,className:`h-full`}}if(!r&&e.object){let n=e.aggregate?{field:e.valueField||`value`,function:e.aggregate,groupBy:e.categoryField||`name`}:void 0;return{type:`object-chart`,chartType:t,objectName:e.object,aggregate:n,xAxisKey:i,series:[{dataKey:e.valueField||`value`}],colors:E,className:`h-full`}}return{type:`chart`,chartType:t,data:Array.isArray(r)?r:r?.items||[],xAxisKey:i,series:[{dataKey:a}],colors:E,className:`h-full`}}if(t===`table`){let t=e.data||n.data;if(v(t)){let{data:r,...i}=n;return{type:`data-table`,...i,objectName:e.object||t.object,dataProvider:t,data:[],searchable:!1,pagination:!1,className:`border-0`}}return!t&&e.object?{type:`data-table`,...n,objectName:e.object,data:[],searchable:!1,pagination:!1,className:`border-0`}:{type:`data-table`,...n,data:t?.items||[],searchable:!1,pagination:!1,className:`border-0`}}if(t===`pivot`){let t=e.data||n.data;if(v(t)){let{data:r,...i}=n;return{type:`pivot`,...i,objectName:e.object||t.object,dataProvider:t,data:[]}}return{type:`pivot`,...n,data:Array.isArray(t)?t:t?.items||[]}}return{...e,...n}},[]);return(0,o.jsxs)(`div`,{ref:f,className:(0,r.cn)(`w-full`,t),"data-testid":`grid-layout`,children:[y&&(0,o.jsx)(T,{editMode:m}),(0,o.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,o.jsx)(`h2`,{className:`text-2xl font-bold`,children:e.title||`Dashboard`}),(0,o.jsx)(`div`,{className:`flex gap-2`,children:m?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(r.Button,{onClick:D,size:`sm`,variant:`default`,children:[(0,o.jsx)(a.Save,{className:`h-4 w-4 mr-2`}),`Save Layout`]}),(0,o.jsxs)(r.Button,{onClick:O,size:`sm`,variant:`outline`,children:[(0,o.jsx)(a.X,{className:`h-4 w-4 mr-2`}),`Reset`]}),(0,o.jsx)(r.Button,{onClick:()=>h(!1),size:`sm`,variant:`ghost`,children:`Cancel`})]}):(0,o.jsxs)(o.Fragment,{children:[u&&(0,o.jsxs)(r.Button,{onClick:x,size:`sm`,variant:`outline`,disabled:g,"aria-label":`Refresh dashboard`,children:[(0,o.jsx)(a.RefreshCw,{className:(0,r.cn)(`h-4 w-4 mr-2`,g&&`animate-spin`)}),g?`Refreshing…`:`Refresh All`]}),(0,o.jsxs)(r.Button,{onClick:()=>h(!0),size:`sm`,variant:`outline`,children:[(0,o.jsx)(a.Edit,{className:`h-4 w-4 mr-2`}),`Edit Layout`]})]})})]}),p&&(0,o.jsx)(s.ResponsiveGridLayout,{className:`layout`,width:d,layouts:S,breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},rowHeight:60,dragConfig:{enabled:m,handle:`.drag-handle`},resizeConfig:{enabled:m},onLayoutChange:w,children:e.widgets?.map((e,t)=>{let i=e.id||`widget-${t}`,s=k(e);return(0,o.jsx)(`div`,{className:`h-full`,children:e.type===`metric`?(0,o.jsxs)(`div`,{className:`h-full w-full relative`,children:[m&&(0,o.jsx)(`div`,{className:`drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border`,children:(0,o.jsx)(a.GripVertical,{className:`h-4 w-4`})}),(0,o.jsx)(n.SchemaRenderer,{schema:s,className:`h-full w-full`})]}):(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden border-border/50 shadow-sm transition-all`,`bg-card/50 backdrop-blur-sm`,m&&`ring-2 ring-primary/20`),children:[e.title&&(0,o.jsxs)(r.CardHeader,{className:`pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between`,children:[(0,o.jsx)(r.CardTitle,{className:`text-base font-medium tracking-tight truncate`,title:e.title,children:e.title}),m&&(0,o.jsx)(`div`,{className:`drag-handle cursor-move p-1 hover:bg-muted/40 rounded`,children:(0,o.jsx)(a.GripVertical,{className:`h-4 w-4`})})]}),(0,o.jsx)(r.CardContent,{className:`p-0 h-full`,children:(0,o.jsx)(`div`,{className:(0,r.cn)(`h-full w-full overflow-auto p-4`),children:(0,o.jsx)(n.SchemaRenderer,{schema:s})})})]})},i)})})]})};function O(e,t,n){if(e==null)return``;if(typeof e==`string`){let r=Number(e);return!isFinite(r)||e.trim()===``?e:O(r,t,n)}if(!isFinite(e))return String(e);let r={$:`USD`,"¥":`JPY`,"€":`EUR`,"£":`GBP`},i=(t||``).trim(),a=!!n||i.length>0&&r[i[0]]!==void 0,o=i.endsWith(`%`),s=i.match(/0\.(0+)/),c=s?s[1].length:0;if(a){let t=n||r[i[0]]||`USD`;try{return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:t,minimumFractionDigits:c,maximumFractionDigits:c}).format(e)}catch{return`${t} ${e.toFixed(c)}`}}return o?`${(e>1?e:e*100).toFixed(c)}%`:new Intl.NumberFormat(`en-US`,{minimumFractionDigits:c,maximumFractionDigits:c}).format(e)}function k(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var A={default:`bg-muted text-muted-foreground`,blue:`bg-blue-500/10 text-blue-600 dark:text-blue-400`,teal:`bg-teal-500/10 text-teal-600 dark:text-teal-400`,orange:`bg-orange-500/10 text-orange-600 dark:text-orange-400`,purple:`bg-purple-500/10 text-purple-600 dark:text-purple-400`,success:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,warning:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,danger:`bg-rose-500/10 text-rose-600 dark:text-rose-400`},j=({label:e,value:t,trend:n,icon:s,className:c,description:l,loading:u,error:d,colorVariant:f=`default`,format:p,currency:m,prefix:h,suffix:g,onClick:_,...v})=>{let y=A[f]||A.default,b=(0,i.useMemo)(()=>{let e=typeof t==`number`||typeof t==`string`&&t.trim()!==``&&isFinite(Number(t))?O(t,p,m):t??``,n=String(e);return`${h&&n.startsWith(h)?``:h??``}${n}${g&&n.endsWith(g)?``:g??``}`},[t,p,m,h,g]),x=(0,i.useMemo)(()=>{if(typeof s==`string`){let e=(0,r.getLazyIcon)(s);return e?(0,o.jsx)(e,{className:`h-4 w-4`}):null}return s},[s]);return(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full overflow-hidden`,_&&`cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,c),onClick:_,role:_?`button`:void 0,tabIndex:_?0:void 0,onKeyDown:_?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_())}:void 0,...v,children:[(0,o.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm font-medium truncate`,children:k(e)}),x&&(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-8 w-8 items-center justify-center rounded-md shrink-0`,y),children:x})]}),(0,o.jsx)(r.CardContent,{children:u?(0,o.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-loading`,children:[(0,o.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,o.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):d?(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-error`,role:`alert`,children:[(0,o.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,o.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-2xl font-bold truncate`,children:b}),(n||l)&&(0,o.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 min-w-0`,children:[n&&(0,o.jsxs)(`span`,{className:(0,r.cn)(`flex items-center shrink-0 font-medium`,n.direction===`up`&&`text-emerald-600 dark:text-emerald-400`,n.direction===`down`&&`text-rose-600 dark:text-rose-400`,n.direction===`neutral`&&`text-muted-foreground`),children:[n.direction===`up`&&(0,o.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),n.direction===`down`&&(0,o.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),n.direction===`neutral`&&(0,o.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),n.value,`%`]}),(0,o.jsx)(`span`,{className:`truncate min-w-0`,children:k(l)||k(n?.label)})]})]})})]})};function M(e){if(e!=null)return typeof e==`string`?e:e.defaultValue||e.key}var N=({title:e,value:t,icon:n,trend:i,trendValue:s,description:c,className:l,loading:u,error:d,...f})=>{let p=n?(0,r.getLazyIcon)(n):null;return(0,o.jsxs)(r.Card,{className:(0,r.cn)(`h-full`,l),...f,children:[(0,o.jsxs)(r.CardHeader,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,o.jsx)(r.CardTitle,{className:`text-sm font-medium`,children:M(e)}),p&&(0,o.jsx)(p,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(r.CardContent,{children:u?(0,o.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,"data-testid":`metric-card-loading`,children:[(0,o.jsx)(a.Loader2,{className:`h-4 w-4 animate-spin`}),(0,o.jsx)(`span`,{className:`text-sm`,children:`Loading…`})]}):d?(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`metric-card-error`,role:`alert`,children:[(0,o.jsx)(a.AlertCircle,{className:`h-4 w-4 text-destructive shrink-0`}),(0,o.jsx)(`span`,{className:`text-xs text-destructive truncate`,children:d})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),(i||s||c)&&(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center mt-1`,children:[i&&s&&(0,o.jsxs)(`span`,{className:(0,r.cn)(`flex items-center mr-2`,i===`up`&&`text-green-500`,i===`down`&&`text-red-500`,i===`neutral`&&`text-yellow-500`),children:[i===`up`&&(0,o.jsx)(a.ArrowUpIcon,{className:`h-3 w-3 mr-1`}),i===`down`&&(0,o.jsx)(a.ArrowDownIcon,{className:`h-3 w-3 mr-1`}),i===`neutral`&&(0,o.jsx)(a.MinusIcon,{className:`h-3 w-3 mr-1`}),s]}),M(c)]})]})})]})},P=({objectName:e,aggregate:a,filter:s,label:c,fallbackValue:l,trend:u,icon:d,className:f,description:p,dataSource:m,colorVariant:h,format:g,currency:_,prefix:v,suffix:y,drillDown:b,title:x})=>{let S=(0,i.useContext)(n.SchemaRendererContext),C=m||S?.dataSource,[w,T]=(0,i.useState)(!1),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(!1),[A,M]=(0,i.useState)(null),[N,P]=(0,i.useState)(null);(0,i.useEffect)(()=>{let t=!0;if(!(!C||!e||typeof C.getObjectSchema!=`function`))return C.getObjectSchema(e).then(e=>{t&&P(e)}).catch(()=>{}),()=>{t=!1}},[C,e]);let F=(0,i.useMemo)(()=>{let e=a?.field;if(!e||!N?.fields)return null;let t=N.fields;return Array.isArray(t)?t.find(t=>t?.name===e)||null:t[e]||null},[N,a?.field]),I=(0,i.useMemo)(()=>{if(g)return g;if(F){if(F.type===`currency`){let e=F.precision??F.scale??0;return e>0?`0,0.${`0`.repeat(e)}`:`0,0`}if(F.type===`percent`)return`0,0%`;if(F.type===`number`||F.type===`integer`)return`0,0`}},[g,F]),L=(0,i.useMemo)(()=>{if(_)return _;if(F?.type===`currency`)return F.defaultCurrency||F.currency||void 0},[_,F]),R=(0,i.useMemo)(()=>a?JSON.stringify(a):``,[a]),z=(0,i.useMemo)(()=>(0,t.resolveDateMacros)(s),[s]),B=(0,i.useCallback)(async(t,n)=>{if(!(!t||!e)){n.current&&(k(!0),M(null));try{let r;if(a&&typeof t.aggregate==`function`){let n=await t.aggregate(e,{field:a.field,function:a.function,groupBy:a.groupBy||`_all`,filter:z}),i=Array.isArray(n)?n:[];r=i.length===0?0:a.function===`count`?i.reduce((e,t)=>e+(Number(t[a.field])||Number(t.count)||0),0):i[0][a.field]??0}else if(typeof t.find==`function`){let n=await t.find(e,{$filter:z});r=(Array.isArray(n)?n:n?.data||n?.records||[]).length}else return;n.current&&D(r)}catch(e){console.error(`[ObjectMetricWidget] Fetch error:`,e),n.current&&M(e instanceof Error?e.message:`Failed to load metric`)}finally{n.current&&k(!1)}}},[e,R,(0,i.useMemo)(()=>z?JSON.stringify(z):``,[z])]);(0,i.useEffect)(()=>{let t={current:!0};return C&&e?B(C,t):(D(null),M(null)),()=>{t.current=!1}},[C,e,B]);let V=E===null?C?`—`:l??`—`:E,H=(0,t.isDrillEnabled)(b)&&!!e&&!!C,U=(0,i.useMemo)(()=>{let e=typeof c==`string`?c:c?.defaultValue||``;return(0,t.resolveDrillTitle)(b,{},(typeof x==`string`?x:x?.defaultValue||``)||e||`Details`)},[b,c,x]),W=(0,i.useMemo)(()=>{if(!H)return null;let t=b?.target??`drawer`,i=(0,o.jsx)(`div`,{className:`h-full overflow-auto`,children:(0,o.jsx)(n.SchemaRenderer,{schema:{type:`object-data-table`,objectName:e,filter:z,pageSize:25,drillDown:{enabled:!1}}})});return t===`modal`?(0,o.jsx)(r.Dialog,{open:!0,onOpenChange:e=>!e&&T(!1),children:(0,o.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,o.jsx)(r.DialogHeader,{children:(0,o.jsx)(r.DialogTitle,{children:U})}),i]})}):(0,o.jsx)(r.Sheet,{open:!0,onOpenChange:e=>!e&&T(!1),children:(0,o.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,o.jsx)(r.SheetHeader,{children:(0,o.jsx)(r.SheetTitle,{children:U})}),(0,o.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:i})]})})},[H,b,e,z,U]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(j,{label:c,value:V,trend:u,icon:d,className:f,description:p,loading:O,error:A,colorVariant:h,format:I,currency:L,prefix:v,suffix:y,onClick:H?()=>T(!0):void 0}),w&&W]})};function F(){try{let{t:e}=(0,l.useObjectTranslation)(),t=e(`dashboard.total`);return!t||t===`dashboard.total`?`Total`:t}catch{return`Total`}}function I(e,t){if(!t)return String(e);let n=``,r=``,i=!1,a,o=t,s=o.match(/^([^0-9.,#]*)/);if(s&&s[1]){let e=s[1];n=e.replace(`,`,``),e.includes(`,`)&&(i=!0),o=o.slice(s[1].length)}o.includes(`,`)&&(i=!0,o=o.replace(/,/g,``));let c=o.match(/\.(\d+)f?/);c&&(a=Number(c[1]),o=o.slice(c[0].length)),r=o.replace(/[0-9#.f]/g,``);let l=a===void 0?String(e):e.toFixed(a);if(i){let[e,t]=l.split(`.`),i=e.replace(/\B(?=(\d{3})+(?!\d))/g,`,`);return n+(t===void 0?i:`${i}.${t}`)+r}return n+l+r}var L=`—`;function R(e,t){return e===``?L:t?.[e]??e}function z(e,t){if(e.length===0)return 0;switch(t){case`sum`:return e.reduce((e,t)=>e+t,0);case`count`:return e.length;case`avg`:return e.reduce((e,t)=>e+t,0)/e.length;case`min`:return Math.min(...e);case`max`:return Math.max(...e);default:return e.reduce((e,t)=>e+t,0)}}var B=({schema:e,className:n,rowLabels:a,columnLabels:s,rowFieldLabel:c,onDrillDown:l})=>{let{title:u,rowField:d,columnField:f,valueField:p,aggregation:m=`sum`,data:h=[],showRowTotals:g=!1,showColumnTotals:_=!1,format:v,columnColors:y,drillDown:b}=e,x=F(),S=(0,t.isDrillEnabled)(b)&&typeof l==`function`,C=e=>{S&&l({...e,rowLabel:e.rowKey===void 0?e.rowLabel:a?.[e.rowKey]??e.rowKey,colLabel:e.colKey===void 0?e.colLabel:s?.[e.colKey]??e.colKey})},w=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},T=S?`cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]`:``,E=Array.isArray(h)?h:[],{rowKeys:D,colKeys:O,matrix:k,rowTotals:A,colTotals:j,grandTotal:M}=(0,i.useMemo)(()=>{let e=new Map,t=new Map,n={};for(let r of E){let i=String(r[d]??``),a=String(r[f]??``),o=Number(r[p])||0;e.set(i,!0),t.set(a,!0),n[i]||(n[i]={}),n[i][a]||(n[i][a]=[]),n[i][a].push(o)}let r=Array.from(e.keys()),i=Array.from(t.keys()),a={},o={},s={};for(let e of r){a[e]={};let t=[];for(let r of i){let i=n[e]?.[r]??[],o=z(i,m);a[e][r]=o,t.push(...i),!s[r]&&s[r]}o[e]=z(t,m)}for(let e of i){let t=[];for(let i of r){let r=n[i]?.[e]??[];t.push(...r)}s[e]=z(t,m)}let c=[];for(let e of E)c.push(Number(e[p])||0);return{rowKeys:r,colKeys:i,matrix:a,rowTotals:o,colTotals:s,grandTotal:z(c,m)}},[E,d,f,p,m]),N=e=>I(e,v);return E.length===0?(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,n),children:[u&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:u}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,"data-testid":`pivot-empty-state`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`rect`,{x:`3`,y:`3`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`14`,y:`3`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`3`,y:`14`,width:`7`,height:`7`}),(0,o.jsx)(`rect`,{x:`14`,y:`14`,width:`7`,height:`7`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})]}):(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,n),children:[u&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:u}),(0,o.jsxs)(`table`,{className:`w-full text-sm border-collapse table-auto`,role:`table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{className:`border-b border-border`,children:[(0,o.jsx)(`th`,{className:`text-left p-2 font-medium text-muted-foreground whitespace-nowrap`,children:c||d}),O.map(e=>{let t=()=>C({scope:`column`,colKey:e});return(0,o.jsx)(`th`,{className:(0,r.cn)(`text-right p-2 font-medium whitespace-nowrap`,e===``&&`italic text-muted-foreground/70`,y?.[e]??`text-muted-foreground`,T),title:e===``?`${f}: (empty)`:`${f}: ${e}`,role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?t:void 0,onKeyDown:S?w(t):void 0,"aria-label":S?`Drill into ${f}: ${e||`(empty)`}`:void 0,children:R(e,s)},e)}),g&&(0,o.jsx)(`th`,{className:`text-right p-2 font-semibold text-muted-foreground bg-muted/20 whitespace-nowrap`,children:x})]})}),(0,o.jsx)(`tbody`,{children:D.map(e=>(0,o.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/30`,children:[(0,o.jsx)(`td`,{className:(0,r.cn)(`p-2 font-medium whitespace-nowrap`,e===``&&`italic text-muted-foreground/70`,T),role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?()=>C({scope:`row`,rowKey:e}):void 0,onKeyDown:S?w(()=>C({scope:`row`,rowKey:e})):void 0,"aria-label":S?`Drill into ${d}: ${e||`(empty)`}`:void 0,children:R(e,a)}),O.map(t=>{let n=k[e]?.[t]??0,i=()=>C({scope:`cell`,rowKey:e,colKey:t,value:n});return(0,o.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,y?.[t],T),role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?i:void 0,onKeyDown:S?w(i):void 0,"aria-label":S?`Drill into ${d}=${e||`(empty)`}, ${f}=${t||`(empty)`}`:void 0,children:N(n)},t)}),g&&(0,o.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 font-semibold tabular-nums bg-muted/20`,T),role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?()=>C({scope:`row`,rowKey:e,value:A[e]??0}):void 0,onKeyDown:S?w(()=>C({scope:`row`,rowKey:e,value:A[e]??0})):void 0,children:N(A[e]??0)})]},e))}),_&&(0,o.jsx)(`tfoot`,{children:(0,o.jsxs)(`tr`,{className:`border-t-2 border-border font-semibold bg-muted/40`,children:[(0,o.jsx)(`td`,{className:`p-2`,children:x}),O.map(e=>(0,o.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums`,T),role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?()=>C({scope:`column`,colKey:e,value:j[e]??0}):void 0,onKeyDown:S?w(()=>C({scope:`column`,colKey:e,value:j[e]??0})):void 0,children:N(j[e]??0)},e)),g&&(0,o.jsx)(`td`,{className:(0,r.cn)(`text-right p-2 tabular-nums font-bold`,T),role:S?`button`:void 0,tabIndex:S?0:void 0,onClick:S?()=>C({scope:`total`,value:M}):void 0,onKeyDown:S?w(()=>C({scope:`total`,value:M})):void 0,children:N(M)})]})})]})]})};function V(e){return e.map(e=>typeof e==`string`?{header:e.replace(/_/g,` `).replace(/([A-Z])/g,` $1`).trim().replace(/\b\w/g,e=>e.toUpperCase()),accessorKey:e}:e)}function H(e,t){if(!t?.fields)return[];let n={};if(Array.isArray(t.fields))for(let e of t.fields)e?.name&&(n[e.name]=e);else for(let[e,r]of Object.entries(t.fields))n[e]={name:e,...r};let r=e=>e===`lookup`||e===`reference`||e===`master_detail`||e===`user`||e===`owner`,i=Array.isArray(e.columns)?e.columns:[],a=new Set;if(i.length>0){let e=i.map(e=>typeof e==`string`?e:e.accessorKey||e.name).filter(Boolean);for(let t of e){let e=n[t];e&&r(e.type)&&a.add(t)}}else for(let[e,t]of Object.entries(n))r(t?.type)&&a.add(e);return Array.from(a)}var U=({schema:e,dataSource:a,className:s})=>{let c=(0,i.useContext)(n.SchemaRendererContext),d=a||c?.dataSource,f=(0,n.useDataScope)(e.bind),{fieldLabel:p,fieldOptionLabel:m}=(0,l.useSafeFieldLabel)(),[h,g]=(0,i.useState)([]),[_,v]=(0,i.useState)(null),[y,b]=(0,i.useState)(!1),[x,S]=(0,i.useState)(null);(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!f&&(!e.data||e.data.length===0)&&(async()=>{if(!(!d||!e.objectName)){n&&(b(!0),S(null));try{let r;if(typeof d.find==`function`){let n=H(e,_),i={$filter:(0,t.resolveDateMacros)(e.filter)};n.length&&(i.$expand=n),r=(0,t.extractRecords)(await d.find(e.objectName,i))}else return;n&&g(r)}catch(e){console.error(`[ObjectDataTable] Fetch error:`,e),n&&S(e instanceof Error?e.message:`Failed to load data`)}finally{n&&b(!1)}}})(),()=>{n=!1}},[e.objectName,d,f,e.data,e.filter,_]),(0,i.useEffect)(()=>{let t=!0;if(!(!d||!e.objectName||typeof d.getObjectSchema!=`function`))return d.getObjectSchema(e.objectName).then(e=>{t&&v(e)}).catch(()=>{}),()=>{t=!1}},[e.objectName,d]);let C=f||e.data||h,w=Array.isArray(C)?C:[],T=(0,i.useMemo)(()=>{let t=e.objectName,n={};if(_?.fields){let e=_.fields;if(Array.isArray(e))for(let t of e)t?.name&&(n[t.name]=t);else for(let[t,r]of Object.entries(e))n[t]={name:t,...r}}let r=e=>{let n=e.charAt(0).toUpperCase()+e.slice(1).replace(/([A-Z])/g,` $1`);return t?p(t,e,n):n},i=e=>{let r=n[e.accessorKey],i=e.referenceTo??r?.referenceTo??(typeof r?.reference==`string`?r.reference:r?.reference?.to)??r?.target,a=e.options??r?.options;t&&a&&(r?.type===`select`||r?.type===`picklist`||r?.type===`dropdown`||r?.type===`status`)&&(a=a.map(n=>{if(n==null)return n;let r=typeof n==`object`?n.value:n,i=typeof n==`object`&&n.label||String(r);return{value:r,label:m(t,e.accessorKey,String(r),i),color:typeof n==`object`?n.color:void 0}}));let s={name:e.accessorKey,label:e.header,type:e.type??r?.type,options:a,referenceTo:i,format:e.format??r?.format,currency:e.currency??r?.currency??r?.defaultCurrency,decimals:e.decimals??r?.decimals??r?.precision??r?.scale},c=new Set([`currency`,`money`,`number`,`integer`,`decimal`,`float`,`percent`,`percentage`]),l=e.align??(c.has(s.type)||typeof s.format==`string`&&/^[\$¥€£]|%$|0/.test(s.format)?`right`:void 0);if(typeof e.cell==`function`)return{...e,...s,align:l};let d=e=>{if(e==null||e===``)return``;let t=s.format;if(typeof t==`string`&&/^\$|¥|€|£/.test(t)&&typeof e==`number`){let n={$:`USD`,"¥":`JPY`,"€":`EUR`,"£":`GBP`}[t[0]];return(0,u.formatCurrency)(e,s.currency||n)}if(typeof t==`string`&&/%/.test(t)&&typeof e==`number`){let n=(t.match(/0\.(0+)%/)||[,``])[1].length;return(0,u.formatPercent)((e>1?e/100:e)*100,n)}return typeof t==`string`&&/[YMDHms]/.test(t)?(0,u.formatDate)(e,t):(0,o.jsx)((0,u.getCellRenderer)((0,u.resolveCellRendererType)(s)),{value:e,field:s})};return{...e,...s,align:l,cell:d}};if(e.columns&&e.columns.length>0){let n=V(e.columns);return(t?n.map(e=>({...e,header:p(t,e.accessorKey,e.header)})):n).map(i)}if(w.length===0)return[];let a=new Set([`id`,`organization_id`,`tenant_id`,`created_at`,`updated_at`,`created_by`,`updated_by`,`deleted_at`,`deleted_by`,`version`,`_id`,`__typename`]),s=(e,t)=>t&&(t.isSystem===!0||t.system===!0)?!0:a.has(e);return(Object.keys(n).length>0?Object.keys(n).filter(e=>!s(e,n[e])):Object.keys(w[0]).filter(e=>!e.startsWith(`_`)&&!s(e))).map(e=>i({header:r(e),accessorKey:e}))},[e.columns,e.objectName,w,_,p,m]);return y&&w.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-loading`,children:(0,o.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-1/4`})]}),[1,2,3,4].map(e=>(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-1/4`})]},e))]})}):x?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-error`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`table-error-message`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,o.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,o.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:x})]})}):!d&&e.objectName&&w.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),children:(0,o.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,o.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})}):w.length===0?(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`table-empty-state`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-40`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,o.jsx)(`line`,{x1:`3`,y1:`9`,x2:`21`,y2:`9`}),(0,o.jsx)(`line`,{x1:`9`,y1:`21`,x2:`9`,y2:`9`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:`No data available`})]})}):(0,o.jsx)(n.SchemaRenderer,{schema:{...e,type:`data-table`,data:w,columns:T},className:s})},W=({open:e,onClose:t,title:n,target:i=`drawer`,objectName:a,filter:s,dataSource:c,columns:l,maxRows:u,className:d})=>{let f={type:`object-data-table`,objectName:a,filter:s,columns:l?.map(e=>({accessorKey:e,header:e})),pagination:!0,searchable:!1,pageSize:u},p=(0,o.jsx)(`div`,{className:(0,r.cn)(`overflow-auto`,d),"data-testid":`drill-down-body`,children:(0,o.jsx)(U,{schema:f,dataSource:c})});return i===`dialog`?(0,o.jsx)(r.Dialog,{open:e,onOpenChange:e=>!e&&t(),children:(0,o.jsxs)(r.DialogContent,{className:`max-w-4xl`,children:[(0,o.jsx)(r.DialogHeader,{children:(0,o.jsx)(r.DialogTitle,{children:n})}),p]})}):(0,o.jsx)(r.Sheet,{open:e,onOpenChange:e=>!e&&t(),children:(0,o.jsxs)(r.SheetContent,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,o.jsx)(r.SheetHeader,{children:(0,o.jsx)(r.SheetTitle,{children:n})}),(0,o.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:p})]})})},G=({schema:e,dataSource:a,className:s})=>{let c=(0,i.useContext)(n.SchemaRendererContext),u=a||c?.dataSource,d=(0,n.useDataScope)(e.bind),[f,p]=(0,i.useState)([]),[m,h]=(0,i.useState)(!1),[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)({}),[b,x]=(0,i.useState)({}),[S,C]=(0,i.useState)(null),{fieldLabel:w,fieldOptionLabel:T}=(0,l.useSafeFieldLabel)(),E=(0,i.useRef)(w),D=(0,i.useRef)(T);(0,i.useEffect)(()=>{E.current=w,D.current=T},[w,T]),(0,i.useEffect)(()=>{if(!u||!e.objectName)return;let t=u.getObjectSchema;if(typeof t!=`function`)return;let n=!0;return Promise.resolve(t.call(u,e.objectName)).then(t=>{if(!n||!t?.fields)return;let r=e.objectName,i={},a={};for(let[e,n]of Object.entries(t.fields)){let t=n?.label?String(n.label):e;a[e]=E.current(r,e,t);let o=n?.options;if(Array.isArray(o)&&o.length>0){let t={};for(let n of o)if(n&&n.value!==void 0&&n.label!==void 0){let i=String(n.value),a=String(n.label);t[i]=D.current(r,e,i,a)}Object.keys(t).length>0&&(i[e]=t)}}y(i),x(a)}).catch(()=>{}),()=>{n=!1}},[u,e.objectName]),(0,i.useEffect)(()=>{let n=!0;return e.objectName&&!d&&(!e.data||e.data.length===0)&&(async()=>{if(!(!u||!e.objectName)){n&&(h(!0),_(null));try{let r;if(typeof u.find==`function`)r=(0,t.extractRecords)(await u.find(e.objectName,{$filter:(0,t.resolveDateMacros)(e.filter)}));else return;n&&p(r)}catch(e){console.error(`[ObjectPivotTable] Fetch error:`,e),n&&_(e instanceof Error?e.message:`Failed to load data`)}finally{n&&h(!1)}}})(),()=>{n=!1}},[e.objectName,u,d,e.data,e.filter]);let O=d||e.data||f,k=Array.isArray(O)?O:[];if(m&&k.length===0)return(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`pivot-loading`,children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsxs)(`div`,{className:`space-y-2 p-2`,children:[(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-6 w-24`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-6 w-20`})]}),[1,2,3].map(e=>(0,o.jsxs)(`div`,{className:`flex gap-2`,children:[(0,o.jsx)(r.Skeleton,{className:`h-5 w-24`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`}),(0,o.jsx)(r.Skeleton,{className:`h-5 w-20`})]},e))]})]});if(g)return(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),"data-testid":`pivot-error`,children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 text-destructive`,"data-testid":`pivot-error-message`,children:[(0,o.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,className:`h-8 w-8 mb-2 opacity-60`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,o.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,o.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,o.jsx)(`p`,{className:`text-xs`,children:g})]})]});if(!u&&e.objectName&&k.length===0)return(0,o.jsxs)(`div`,{className:(0,r.cn)(`overflow-auto`,s),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-sm font-semibold mb-2`,children:e.title}),(0,o.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground`,children:(0,o.jsxs)(`p`,{className:`text-xs`,children:[`No data source available for “`,e.objectName,`”`]})})]});let A={...e,data:k},j=e.rowField?v[e.rowField]:void 0,M=e.columnField?v[e.columnField]:void 0,N=e.rowField?b[e.rowField]:void 0,P=e.drillDown,F=(0,t.isDrillEnabled)(P)?e=>C(e):void 0;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(B,{schema:A,className:s,rowLabels:j,columnLabels:M,rowFieldLabel:N,onDrillDown:F}),(()=>{if(!S||!e.objectName)return null;let n=(0,t.computeDrillFilter)(P,S,{rowField:e.rowField,columnField:e.columnField}),r={...e.filter||{},...n};return(0,o.jsx)(W,{open:!0,onClose:()=>C(null),title:(0,t.resolveDrillTitle)(P,S,e.title||`Details`),target:P?.target??`drawer`,objectName:e.objectName,filter:r,dataSource:u,columns:P?.columns,maxRows:P?.maxRows})})()]})},K={breadcrumb:[`Dashboard`,`Configuration`],sections:[{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`columns`,label:`Columns`,type:`slider`,defaultValue:3,min:1,max:12,step:1},{key:`gap`,label:`Gap`,type:`slider`,defaultValue:4,min:0,max:16,step:1},{key:`rowHeight`,label:`Row height (px)`,type:`slider`,defaultValue:120,min:40,max:320,step:10}]},{key:`data`,title:`Data`,collapsible:!0,fields:[{key:`refreshInterval`,label:`Auto refresh`,type:`select`,defaultValue:`0`,options:[{value:`0`,label:`Off`},{value:`30`,label:`Every 30s`},{value:`60`,label:`Every 1 min`},{value:`300`,label:`Every 5 min`},{value:`900`,label:`Every 15 min`},{value:`1800`,label:`Every 30 min`},{value:`3600`,label:`Every 1 hour`}]}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Dashboard title`},{key:`showDescription`,label:`Show description`,type:`switch`,defaultValue:!0},{key:`theme`,label:`Theme`,type:`select`,defaultValue:`auto`,options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`auto`,label:`Auto`}]}]}]};function q({open:e,onClose:t,config:n,onSave:i,onFieldChange:a}){let{draft:s,isDirty:c,updateField:l,discard:u}=(0,r.useConfigDraft)(n,{onUpdate:a});return(0,o.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:K,draft:s,isDirty:c,onFieldChange:l,onSave:()=>i(s),onDiscard:u})}var J=[{value:`metric`,label:`Metric`},{value:`bar`,label:`Bar Chart`},{value:`horizontal-bar`,label:`Horizontal Bar`},{value:`line`,label:`Line Chart`},{value:`pie`,label:`Pie Chart`},{value:`donut`,label:`Donut Chart`},{value:`area`,label:`Area Chart`},{value:`scatter`,label:`Scatter Plot`},{value:`funnel`,label:`Funnel`},{value:`table`,label:`Table`},{value:`pivot`,label:`Pivot Table`},{value:`list`,label:`List`},{value:`custom`,label:`Custom`}],ee=[{value:`default`,label:`Default`},{value:`blue`,label:`Blue`},{value:`teal`,label:`Teal`},{value:`orange`,label:`Orange`},{value:`purple`,label:`Purple`},{value:`success`,label:`Success`},{value:`warning`,label:`Warning`},{value:`danger`,label:`Danger`}],Y=[{value:`count`,label:`Count`},{value:`sum`,label:`Sum`},{value:`avg`,label:`Average`},{value:`min`,label:`Min`},{value:`max`,label:`Max`}],X=[`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`scatter`,`funnel`],Z=[`bar`,`horizontal-bar`,`line`,`area`,`scatter`],te=[`pie`,`donut`,`funnel`],ne=[`metric`,...X],re=[...X],ie=[`pivot`,`metric`,`bar`,`horizontal-bar`,`line`,`area`,`pie`,`donut`,`funnel`];function ae(e){return!!e&&X.includes(e)}function oe(e){return!!e&&Z.includes(e)}function se(e){return!!e&&re.includes(e)}function Q(e){return!!e&&ne.includes(e)}function ce(e){return!!e&&ie.includes(e)}var le=[{value:`drawer`,label:`Side drawer`},{value:`dialog`,label:`Center dialog`}],ue=[{value:`group`,label:`Group`},{value:`value`,label:`Value`}],de=[{value:`asc`,label:`↑`},{value:`desc`,label:`↓`}];function $(e,t,n,i){return{key:e,label:t,type:`custom`,render:(a,s,c)=>(0,o.jsx)(r.ConfigRow,{label:t,children:(0,o.jsx)(`div`,{"data-testid":`config-field-${e}`,children:(0,o.jsx)(r.Combobox,{options:i??[],value:a??``,onValueChange:s,placeholder:n,searchPlaceholder:`Search fields…`,emptyText:`No fields found.`,className:`h-7 w-32 text-xs`,disabled:!c.object})})})}}function fe(e,t,n){let i=e&&e.length>0,a=i?{key:`object`,label:`Data source`,type:`custom`,render:(t,n)=>(0,o.jsx)(r.ConfigRow,{label:`Data source`,children:(0,o.jsx)(`div`,{"data-testid":`config-field-object`,children:(0,o.jsx)(r.Combobox,{options:e,value:t??``,onValueChange:n,placeholder:`Select object…`,searchPlaceholder:`Search objects…`,emptyText:`No objects found.`,className:`h-7 w-32 text-xs`})})})}:{key:`object`,label:`Data source`,type:`input`,placeholder:`Object name`},s=i?{...$(`categoryField`,`Category field`,`Select field…`,t),helpText:`Group records by this field (one bar/slice/segment per value).`,visibleWhen:e=>se(e.type)}:{key:`categoryField`,label:`Category field`,type:`input`,placeholder:`e.g. status`,helpText:`Group records by this field (one bar/slice/segment per value).`,visibleWhen:e=>se(e.type)},c=i?{...$(`valueField`,`Value field`,`Select field…`,t),helpText:`Field to aggregate (sum / average / min / max).`,visibleWhen:e=>Q(e.type)&&(e.aggregate??`count`)!==`count`}:{key:`valueField`,label:`Value field`,type:`input`,placeholder:`e.g. amount`,helpText:`Field to aggregate (sum / average / min / max).`,visibleWhen:e=>Q(e.type)&&(e.aggregate??`count`)!==`count`},l=i?$(`rowField`,`Field`,`Select row field…`,t):{key:`rowField`,label:`Field`,type:`input`,placeholder:`e.g. owner`},u=i?$(`columnField`,`Field`,`Select column field…`,t):{key:`columnField`,label:`Field`,type:`input`,placeholder:`e.g. stage`},d=i?$(`valueField`,`Field`,`Select value field…`,t):{key:`valueField`,label:`Field`,type:`input`,placeholder:`e.g. amount`};return{breadcrumb:[`Dashboard`,{pivot:`Pivot table`,table:`Table`}[n??``]??(ae(n)?`Chart`:`Widget`)],sections:[{key:`general`,title:`General`,fields:[{key:`title`,label:`Title`,type:`input`,placeholder:`Widget title`},{key:`description`,label:`Description`,type:`input`,placeholder:`Widget description`},{key:`type`,label:`Widget type`,type:`select`,options:J,defaultValue:`metric`}]},{key:`data`,title:`Data Binding`,collapsible:!0,visibleWhen:e=>e.type!==`pivot`,fields:[a,s,c,{key:`aggregate`,label:`Aggregation`,type:`select`,options:Y,defaultValue:`count`,helpText:`Count ignores Value field; Sum / Avg / Min / Max require it.`,visibleWhen:e=>Q(e.type)}]},{key:`pivot-data`,title:`Data`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[a]},{key:`pivot-rows`,title:`Rows`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[l,{key:`rowSortBy`,label:`Sort by`,type:`icon-group`,options:ue,defaultValue:`group`},{key:`rowSortOrder`,label:`Sort order`,type:`icon-group`,options:de,defaultValue:`asc`},{key:`showRowLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showRowTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-columns`,title:`Columns`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[u,{key:`columnSortBy`,label:`Sort by`,type:`icon-group`,options:ue,defaultValue:`group`},{key:`columnSortOrder`,label:`Sort order`,type:`icon-group`,options:de,defaultValue:`asc`},{key:`showColumnLabels`,label:`Show label`,type:`switch`,defaultValue:!0},{key:`showColumnTotals`,label:`Show totals`,type:`switch`,defaultValue:!1}]},{key:`pivot-values`,title:`Values`,collapsible:!0,visibleWhen:e=>e.type===`pivot`,fields:[d,{key:`aggregation`,label:`Aggregation`,type:`select`,options:Y,defaultValue:`sum`},{key:`format`,label:`Number format`,type:`input`,placeholder:`e.g. $,.2f`}]},{key:`chart-axis`,title:`Axis & Series`,collapsible:!0,visibleWhen:e=>oe(e.type),fields:[{key:`xAxisLabel`,label:`X-axis label`,type:`input`,placeholder:`e.g. Month`},{key:`yAxisLabel`,label:`Y-axis label`,type:`input`,placeholder:`e.g. Revenue`},{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`chart-legend`,title:`Display`,collapsible:!0,visibleWhen:e=>!!e.type&&te.includes(e.type),fields:[{key:`showLegend`,label:`Show legend`,type:`switch`,defaultValue:!0}]},{key:`table-options`,title:`Table options`,collapsible:!0,visibleWhen:e=>e.type===`table`,fields:[{key:`searchable`,label:`Searchable`,type:`switch`,defaultValue:!1},{key:`pagination`,label:`Pagination`,type:`switch`,defaultValue:!1}]},{key:`layout`,title:`Layout`,collapsible:!0,fields:[{key:`layoutW`,label:`Width (columns)`,type:`slider`,min:1,max:12,step:1,defaultValue:1},{key:`layoutH`,label:`Height (rows)`,type:`slider`,min:1,max:6,step:1,defaultValue:1}]},{key:`drill-down`,title:`Drill-down`,collapsible:!0,defaultCollapsed:!0,visibleWhen:e=>ce(e.type),fields:[{key:`drillDownEnabled`,label:`Enable drill-down`,type:`switch`,defaultValue:!1,helpText:`When enabled, clicking a cell / segment opens a filtered list of underlying records.`},{key:`drillDownTarget`,label:`Open in`,type:`select`,options:le,defaultValue:`drawer`,visibleWhen:e=>!!e.drillDownEnabled}]},{key:`behavior`,title:`Behavior`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`actionUrl`,label:`Click-through URL`,type:`input`,placeholder:`https://...`}]},{key:`appearance`,title:`Appearance`,collapsible:!0,defaultCollapsed:!0,fields:[{key:`colorVariant`,label:`Color variant`,type:`select`,options:ee,defaultValue:`default`}]}]}}function pe(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`){let t=e;return t.defaultValue||t.key||``}return String(e)}function me(e){let t=e.type,n={...e};return se(t)||delete n.categoryField,Q(t)?(n.aggregate??`count`)===`count`&&delete n.valueField:(delete n.valueField,delete n.aggregate),oe(t)||(delete n.xAxisLabel,delete n.yAxisLabel),t===`pivot`?(delete n.aggregate,delete n.categoryField):(delete n.rowField,delete n.columnField,delete n.aggregation,delete n.rowSortBy,delete n.rowSortOrder,delete n.columnSortBy,delete n.columnSortOrder,delete n.showRowLabels,delete n.showRowTotals,delete n.showColumnLabels,delete n.showColumnTotals,delete n.format),t!==`table`&&(delete n.searchable,delete n.pagination),ce(t)||(delete n.drillDownEnabled,delete n.drillDownTarget),n}function he({open:e,onClose:t,config:n,onSave:a,onFieldChange:s,headerExtra:c,availableObjects:l,availableFields:u}){let{draft:d,isDirty:f,updateField:p,discard:m}=(0,r.useConfigDraft)(i.useMemo(()=>({...n,title:typeof n.title==`object`?pe(n.title):n.title,description:typeof n.description==`object`?pe(n.description):n.description}),[n]),{onUpdate:s});return(0,o.jsx)(r.ConfigPanelRenderer,{open:e,onClose:t,schema:i.useMemo(()=>fe(l,u,d.type),[l,u,d.type]),draft:d,isDirty:f,onFieldChange:p,onSave:()=>a(me(d)),onDiscard:m,headerExtra:c})}function ge({schema:e,config:t,onConfigSave:n,onWidgetSave:s,onRefresh:c,recordCount:l,defaultConfigOpen:u=!1,className:d}){let[f,p]=(0,i.useState)(u),[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(e),[v,y]=(0,i.useState)(0);(0,i.useEffect)(()=>{_(e),y(e=>e+1)},[e]);let b=i.useMemo(()=>{if(!m||!g.widgets)return null;let e=g.widgets.find(e=>(e.id||e.title)===m);if(!e)return null;let t=e.options||{};return{...t,id:e.id??``,title:e.title??``,description:e.description??``,type:e.type??``,object:e.object??``,categoryField:e.categoryField??t.categoryField??``,valueField:e.valueField??t.valueField??``,aggregate:e.aggregate??t.aggregate??``,colorVariant:e.colorVariant??t.colorVariant??`default`,actionUrl:e.actionUrl??t.actionUrl??``,drillDownEnabled:t.drillDown?.enabled??!!(e.object&&(e.type===`pivot`||e.type===`metric`||e.type===`bar`||e.type===`horizontal-bar`||e.type===`line`||e.type===`area`||e.type===`pie`||e.type===`donut`||e.type===`funnel`)),drillDownTarget:t.drillDown?.target??`drawer`,layoutW:e.layout?.w??1,layoutH:e.layout?.h??1}},[m,v]),x=(0,i.useCallback)(e=>{h(e),p(!0)},[]),S=(0,i.useCallback)(()=>{h(null)},[]),C=(0,i.useCallback)((e,t)=>{m&&_(n=>n.widgets?{...n,widgets:n.widgets.map(n=>{if((n.id||n.title)!==m)return n;if(e===`layoutW`)return{...n,layout:{...n.layout||{},w:t}};if(e===`layoutH`)return{...n,layout:{...n.layout||{},h:t}};if(e===`drillDownEnabled`||e===`drillDownTarget`){let r=n.options?.drillDown??{},i=e===`drillDownEnabled`?{...r,enabled:!!t}:{...r,target:t};return{...n,options:{...n.options||{},drillDown:i}}}return{...n,[e]:t}})}:n)},[m]),T=(0,i.useCallback)(e=>{if(m&&s){let{drillDownEnabled:t,drillDownTarget:n,...r}=e,i={...r};(t||n)&&(i.options={...r.options||{},drillDown:{...r.options?.drillDown||{},...t===void 0?{}:{enabled:!!t},...n===void 0?{}:{target:n}}}),s(m,i)}h(null),y(e=>e+1)},[m,s]),E=(0,i.useCallback)(()=>{p(e=>!e),h(null)},[]);return(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex h-full w-full`,d),"data-testid":`dashboard-with-config`,children:[(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-auto relative`,children:[(0,o.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,o.jsxs)(r.Button,{size:`sm`,variant:f?`default`:`outline`,onClick:E,"data-testid":`dashboard-config-toggle`,children:[(0,o.jsx)(a.Settings,{className:`h-3.5 w-3.5 mr-1`}),`Settings`]})}),(0,o.jsx)(w,{schema:g,onRefresh:c,recordCount:l,designMode:f,selectedWidgetId:m,onWidgetClick:x})]}),f&&(0,o.jsx)(`div`,{className:`relative shrink-0`,children:m&&b?(0,o.jsx)(he,{open:!0,onClose:S,config:b,onSave:T,onFieldChange:C}):(0,o.jsx)(q,{open:!0,onClose:()=>p(!1),config:t,onSave:n})})]})}t.ComponentRegistry.register(`dashboard`,w,{namespace:`view`,label:`Dashboard`,category:`Complex`,icon:`layout-dashboard`,inputs:[{name:`columns`,type:`number`,label:`Columns`,defaultValue:3},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:3,widgets:[]}}),t.ComponentRegistry.register(`metric`,j,{namespace:`plugin-dashboard`,label:`Metric Widget`,category:`Dashboard`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`}]}),t.ComponentRegistry.register(`metric-card`,N,{namespace:`plugin-dashboard`,label:`Metric Card`,category:`Dashboard`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`value`,type:`string`,label:`Value`,required:!0},{name:`icon`,type:`string`,label:`Icon (Lucide name)`},{name:`trend`,type:`enum`,label:`Trend`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}]},{name:`trendValue`,type:`string`,label:`Trend Value (e.g., +12%)`},{name:`description`,type:`string`,label:`Description`}],defaultProps:{title:`Metric`,value:`0`}}),t.ComponentRegistry.register(`object-metric`,P,{namespace:`plugin-dashboard`,label:`Object Metric`,category:`Dashboard`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`label`,type:`string`,label:`Label`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`},{name:`icon`,type:`string`,label:`Icon (Lucide name)`}],defaultProps:{label:`Metric`}}),t.ComponentRegistry.register(`pivot`,B,{namespace:`plugin-dashboard`,label:`Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`,data:[]}}),t.ComponentRegistry.register(`object-pivot`,G,{namespace:`plugin-dashboard`,label:`Object Pivot Table`,category:`Dashboard`,icon:`table-2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`rowField`,type:`string`,label:`Row Field`,required:!0},{name:`columnField`,type:`string`,label:`Column Field`,required:!0},{name:`valueField`,type:`string`,label:`Value Field`,required:!0},{name:`aggregation`,type:`enum`,label:`Aggregation`,enum:[{label:`Sum`,value:`sum`},{label:`Count`,value:`count`},{label:`Average`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{name:`showRowTotals`,type:`boolean`,label:`Show Row Totals`},{name:`showColumnTotals`,type:`boolean`,label:`Show Column Totals`},{name:`filter`,type:`array`,label:`Filter`},{name:`format`,type:`string`,label:`Number Format`}],defaultProps:{rowField:``,columnField:``,valueField:``,aggregation:`sum`}}),t.ComponentRegistry.register(`dashboard-grid`,D,{namespace:`plugin-dashboard`,label:`Dashboard Grid (Editable)`,category:`Complex`,icon:`layout-grid`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`persistLayoutKey`,type:`string`,label:`Layout Storage Key`,defaultValue:`dashboard-layout`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Dashboard`,widgets:[],persistLayoutKey:`dashboard-layout`}}),t.ComponentRegistry.register(`object-data-table`,U,{namespace:`plugin-dashboard`,label:`Object Data Table`,category:`Dashboard`,icon:`table`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`searchable`,type:`boolean`,label:`Searchable`},{name:`pagination`,type:`boolean`,label:`Pagination`}],defaultProps:{searchable:!1,pagination:!1}});var _e={DashboardRenderer:w,DashboardGridLayout:D,MetricWidget:j,MetricCard:N,ObjectMetricWidget:P,PivotTable:B,ObjectPivotTable:G,ObjectDataTable:U,DashboardConfigPanel:q,WidgetConfigPanel:he,DashboardWithConfig:ge};e.DashboardConfigPanel=q,e.DashboardGridLayout=D,e.DashboardRenderer=w,e.DashboardWithConfig=ge,e.DrillDownDrawer=W,e.MetricCard=N,e.MetricWidget=j,e.ObjectDataTable=U,e.ObjectMetricWidget=P,e.ObjectPivotTable=G,e.PivotTable=B,e.WidgetConfigPanel=he,e.dashboardComponents=_e});
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardConfigPanel.d.ts","sourceRoot":"","sources":["../../../../src/DashboardConfigPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwGH,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,iCAAiC;IACjC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC9C,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACrD;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,GACd,EAAE,yBAAyB,2CAiB3B"}
1
+ {"version":3,"file":"DashboardConfigPanel.d.ts","sourceRoot":"","sources":["../../../../src/DashboardConfigPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8GH,MAAM,WAAW,yBAAyB;IACxC,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,iCAAiC;IACjC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC9C,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACrD;AAMD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,GACd,EAAE,yBAAyB,2CAiB3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardRenderer.d.ts","sourceRoot":"","sources":["../../../../src/DashboardRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAgC5F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACrE,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uDAAuD;IACvD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,mGAAmG;IACnG,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,wGAAwG;IACxG,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC,CAAC;IACrH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,gIAukB7B,CAAC"}
1
+ {"version":3,"file":"DashboardRenderer.d.ts","sourceRoot":"","sources":["../../../../src/DashboardRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAmD5F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACrE,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uDAAuD;IACvD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,mGAAmG;IACnG,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,wGAAwG;IACxG,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC,CAAC;IACrH,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,gIAgqB7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardWithConfig.d.ts","sourceRoot":"","sources":["../../../../src/DashboardWithConfig.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAU/E,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,6DAA6D;IAC7D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACpD,iEAAiE;IACjE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACvE,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAyB,EACzB,SAAS,GACV,EAAE,wBAAwB,2CAiJ1B"}
1
+ {"version":3,"file":"DashboardWithConfig.d.ts","sourceRoot":"","sources":["../../../../src/DashboardWithConfig.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,kBAAkB,CAAC;AAU/E,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,6DAA6D;IAC7D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACpD,iEAAiE;IACjE,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IACvE,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAyB,EACzB,SAAS,GACV,EAAE,wBAAwB,2CAgM1B"}
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+ export interface DrillDownDrawerProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ /** Drawer/dialog header. */
6
+ title: string;
7
+ /** "drawer" (right-side Sheet) or "dialog" (centered Dialog). */
8
+ target?: 'drawer' | 'dialog';
9
+ /** Object name to query. */
10
+ objectName: string;
11
+ /** Filter applied to the drilled list. */
12
+ filter?: Record<string, unknown>;
13
+ /** Optional inline data source override (otherwise inherited via context). */
14
+ dataSource?: any;
15
+ /** Optional column whitelist. */
16
+ columns?: string[];
17
+ /** Optional max rows. */
18
+ maxRows?: number;
19
+ /** Optional className on the inner container. */
20
+ className?: string;
21
+ }
22
+ export declare const DrillDownDrawer: React.FC<DrillDownDrawerProps>;
23
+ //# sourceMappingURL=DrillDownDrawer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DrillDownDrawer.d.ts","sourceRoot":"","sources":["../../../../src/DrillDownDrawer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmD1D,CAAC"}
@@ -26,6 +26,16 @@ export interface MetricWidgetProps {
26
26
  error?: string | null;
27
27
  /** Visual color variant — tints the icon container while keeping the card neutral. */
28
28
  colorVariant?: MetricColorVariant;
29
+ /** numeral.js-style format pattern (e.g. `'0,0'`, `'0,0.00'`, `'$0,0'`, `'0%'`). */
30
+ format?: string;
31
+ /** ISO currency code (e.g. `'USD'`); enables currency formatting on numeric values. */
32
+ currency?: string;
33
+ /** Static prefix appended in front of the formatted value (e.g. `'$'`, `'¥'`). */
34
+ prefix?: string;
35
+ /** Static suffix appended after the formatted value (e.g. `' /mo'`). */
36
+ suffix?: string;
37
+ /** When set, the entire card becomes clickable and emits this handler. */
38
+ onClick?: () => void;
29
39
  }
30
- export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, ...props }: MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, format, currency, prefix, suffix, onClick, ...props }: MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
31
41
  //# sourceMappingURL=MetricWidget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAYvC,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GACjD,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAmBrC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sFAAsF;IACtF,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC;AAED,eAAO,MAAM,YAAY,GAAI,+FAW1B,iBAAiB,4CAmEnB,CAAC"}
1
+ {"version":3,"file":"MetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/MetricWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAwEvC,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GACjD,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAmBrC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sFAAsF;IACtF,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,GAAI,0IAgB1B,iBAAiB,4CA+FnB,CAAC"}
@@ -49,6 +49,17 @@ export declare function normalizeColumns(columns: (string | Record<string, any>)
49
49
  * - **Empty** → friendly "No data available" message
50
50
  * - **Data** → data-table with fetched rows
51
51
  */
52
+ /**
53
+ * Compute the list of lookup-typed accessors that should be expanded when
54
+ * fetching rows. Returns column accessors whose object schema field type is
55
+ * a relation (lookup/reference/master_detail/user/owner). Used by the
56
+ * dashboard table widget to ask the data adapter to populate referenced
57
+ * records (e.g. `account: { id, name }`) so cells don't show raw FK ids.
58
+ */
59
+ export declare function computeLookupExpand(schema: {
60
+ columns?: any[];
61
+ objectName?: string;
62
+ }, objectSchema: any): string[];
52
63
  export declare const ObjectDataTable: React.FC<ObjectDataTableProps>;
53
64
  export {};
54
65
  //# sourceMappingURL=ObjectDataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectDataTable.d.ts","sourceRoot":"","sources":["../../../../src/ObjectDataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6EAA6E;AAC7E,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAiB9F;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0M1D,CAAC"}
1
+ {"version":3,"file":"ObjectDataTable.d.ts","sourceRoot":"","sources":["../../../../src/ObjectDataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAQxE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,6EAA6E;AAC7E,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAiB9F;AAED;;;;;;;;;;;;;;;GAeG;AACH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChD,YAAY,EAAE,GAAG,GAChB,MAAM,EAAE,CAgCV;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkT1D,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { DrillDownConfig } from '../../types/src';
2
3
  /**
3
4
  * ObjectMetricWidget — Data-bound metric widget.
4
5
  *
@@ -54,6 +55,25 @@ export interface ObjectMetricWidgetProps {
54
55
  dataSource?: any;
55
56
  /** Visual color variant for the icon container */
56
57
  colorVariant?: 'default' | 'blue' | 'teal' | 'orange' | 'purple' | 'success' | 'warning' | 'danger';
58
+ /** Number format pattern (e.g. `'0,0'`, `'0,0.00'`, `'$0,0'`, `'0%'`). */
59
+ format?: string;
60
+ /** ISO currency code (e.g. `'USD'`); enables currency formatting on numeric values. */
61
+ currency?: string;
62
+ /** Static prefix appended in front of the formatted value (e.g. `'$'`, `'¥'`). */
63
+ prefix?: string;
64
+ /** Static suffix appended after the formatted value (e.g. `' /mo'`). */
65
+ suffix?: string;
66
+ /**
67
+ * Drill-down config. When enabled, clicking the metric card opens a
68
+ * drawer (or modal) showing the underlying records that contributed
69
+ * to this metric, filtered by the same `filter` used for aggregation.
70
+ */
71
+ drillDown?: DrillDownConfig;
72
+ /** Title for the drill-down panel; defaults to the metric label. */
73
+ title?: string | {
74
+ key?: string;
75
+ defaultValue?: string;
76
+ };
57
77
  }
58
78
  export declare const ObjectMetricWidget: React.FC<ObjectMetricWidgetProps>;
59
79
  //# sourceMappingURL=ObjectMetricWidget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectMetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/ObjectMetricWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,wBAAwB;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,iBAAiB;IACjB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,6BAA6B;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,+CAA+C;IAC/C,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;CACrG;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAiHhE,CAAC"}
1
+ {"version":3,"file":"ObjectMetricWidget.d.ts","sourceRoot":"","sources":["../../../../src/ObjectMetricWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAgE,MAAM,OAAO,CAAC;AAIrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,wBAAwB;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,iBAAiB;IACjB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,YAAY,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;KACvC,CAAC;IACF,6BAA6B;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,+CAA+C;IAC/C,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACpG,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1D;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAiOhE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectPivotTable.d.ts","sourceRoot":"","sources":["../../../../src/ObjectPivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,GAAG;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAyH5D,CAAC"}
1
+ {"version":3,"file":"ObjectPivotTable.d.ts","sourceRoot":"","sources":["../../../../src/ObjectPivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAkD,MAAM,OAAO,CAAC;AAQvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,gBAAgB,GAAG;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA+N5D,CAAC"}
@@ -1,8 +1,26 @@
1
1
  import { default as React } from 'react';
2
2
  import { PivotTableSchema } from '../../types/src';
3
+ import { DrillEvent } from '../../core/src';
3
4
  export interface PivotTableProps {
4
5
  schema: PivotTableSchema;
5
6
  className?: string;
7
+ /**
8
+ * Optional value→label map for the row field. Callers (e.g.
9
+ * ObjectPivotTable) derive this from the referenced object's schema so the
10
+ * pivot displays select-field labels (e.g. "Proposal") instead of raw
11
+ * stored values (e.g. "proposal").
12
+ */
13
+ rowLabels?: Record<string, string>;
14
+ /** Same as rowLabels but for the column field. */
15
+ columnLabels?: Record<string, string>;
16
+ /** Optional display label for the row field name (e.g. "Stage" for "stage"). */
17
+ rowFieldLabel?: string;
18
+ /**
19
+ * Drill-down click handler. When provided **and** `schema.drillDown` is
20
+ * enabled, cells / row & column headers / totals become interactive.
21
+ * Receives the click context which is forwarded to the drill-down engine.
22
+ */
23
+ onDrillDown?: (event: DrillEvent) => void;
6
24
  }
7
25
  /**
8
26
  * PivotTable – Cross-tabulation / Pivot Table component.
@@ -1 +1 @@
1
- {"version":3,"file":"PivotTable.d.ts","sourceRoot":"","sources":["../../../../src/PivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAG3E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAqED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2KhD,CAAC"}
1
+ {"version":3,"file":"PivotTable.d.ts","sourceRoot":"","sources":["../../../../src/PivotTable.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAalE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C;AA6ED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqPhD,CAAC"}
@@ -6,6 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  import * as React from 'react';
9
+ export declare function supportsDrillDown(t: string | undefined): boolean;
9
10
  export type SelectOption = {
10
11
  value: string;
11
12
  label: string;
@@ -28,16 +29,5 @@ export interface WidgetConfigPanelProps {
28
29
  /** Available fields of the currently selected object for dropdown selection */
29
30
  availableFields?: SelectOption[];
30
31
  }
31
- /**
32
- * WidgetConfigPanel — Schema-driven configuration panel for individual
33
- * dashboard widgets.
34
- *
35
- * Supports editing: title, description, type, data binding (object,
36
- * categoryField, valueField, aggregate), layout (width, height),
37
- * appearance (colorVariant, actionUrl).
38
- *
39
- * Sections are context-aware: pivot, table, and chart types each show
40
- * their own dedicated config sections via `visibleWhen` predicates.
41
- */
42
32
  export declare function WidgetConfigPanel({ open, onClose, config, onSave, onFieldChange, headerExtra, availableObjects, availableFields, }: WidgetConfigPanelProps): import("react/jsx-runtime").JSX.Element;
43
33
  //# sourceMappingURL=WidgetConfigPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetConfigPanel.d.ts","sourceRoot":"","sources":["../../../../src/WidgetConfigPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwE/B,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAuX5D,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,wCAAwC;IACxC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC9C,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACpD,oEAAoE;IACpE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,YAAY,EAAE,CAAC;IAClC,+EAA+E;IAC/E,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;CAClC;AAiBD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,EAAE,sBAAsB,2CA8BxB"}
1
+ {"version":3,"file":"WidgetConfigPanel.d.ts","sourceRoot":"","sources":["../../../../src/WidgetConfigPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAyF/B,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEhE;AAuBD,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA4b5D,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,wCAAwC;IACxC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAC9C,oCAAoC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACpD,oEAAoE;IACpE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,YAAY,EAAE,CAAC;IAClC,+EAA+E;IAC/E,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;CAClC;AAiFD,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,EAAE,sBAAsB,2CA8BxB"}
@@ -9,11 +9,12 @@ import { ObjectDataTable } from './ObjectDataTable';
9
9
  import { DashboardConfigPanel } from './DashboardConfigPanel';
10
10
  import { WidgetConfigPanel } from './WidgetConfigPanel';
11
11
  import { DashboardWithConfig } from './DashboardWithConfig';
12
- export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard, ObjectMetricWidget, PivotTable, ObjectPivotTable, ObjectDataTable, DashboardConfigPanel, WidgetConfigPanel, DashboardWithConfig };
12
+ import { DrillDownDrawer } from './DrillDownDrawer';
13
+ export { DashboardRenderer, DashboardGridLayout, MetricWidget, MetricCard, ObjectMetricWidget, PivotTable, ObjectPivotTable, ObjectDataTable, DashboardConfigPanel, WidgetConfigPanel, DashboardWithConfig, DrillDownDrawer };
13
14
  export declare const dashboardComponents: {
14
15
  DashboardRenderer: import('react').ForwardRefExoticComponent<Omit<import('./DashboardRenderer').DashboardRendererProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
15
16
  DashboardGridLayout: import('react').FC<import('./DashboardGridLayout').DashboardGridLayoutProps>;
16
- MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, ...props }: import('./MetricWidget').MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
17
+ MetricWidget: ({ label, value, trend, icon, className, description, loading, error, colorVariant, format, currency, prefix, suffix, onClick, ...props }: import('./MetricWidget').MetricWidgetProps) => import("react/jsx-runtime").JSX.Element;
17
18
  MetricCard: import('react').FC<import('./MetricCard').MetricCardProps>;
18
19
  ObjectMetricWidget: import('react').FC<import('./ObjectMetricWidget').ObjectMetricWidgetProps>;
19
20
  PivotTable: import('react').FC<import('./PivotTable').PivotTableProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;AA0M7M,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAY/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,CAAC;AA0M9N,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAY/B,CAAC"}
@@ -12,4 +12,5 @@ export declare function isObjectProvider(widgetData: unknown): widgetData is {
12
12
  aggregate?: any;
13
13
  filter?: any;
14
14
  };
15
+ export { resolveDateMacros } from '../../core/src';
15
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,CAO1I"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,CAO1I;AAID,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-dashboard",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Dashboard plugin for Object UI",
@@ -17,14 +17,15 @@
17
17
  "dependencies": {
18
18
  "clsx": "^2.1.1",
19
19
  "lucide-react": "^1.14.0",
20
- "react": "19.2.5",
21
- "react-dom": "19.2.5",
22
- "tailwind-merge": "^3.5.0",
23
- "@object-ui/components": "4.0.6",
24
- "@object-ui/core": "4.0.6",
25
- "@object-ui/i18n": "4.0.6",
26
- "@object-ui/react": "4.0.6",
27
- "@object-ui/types": "4.0.6"
20
+ "react": "19.2.6",
21
+ "react-dom": "19.2.6",
22
+ "tailwind-merge": "^3.6.0",
23
+ "@object-ui/components": "4.0.8",
24
+ "@object-ui/core": "4.0.8",
25
+ "@object-ui/i18n": "4.0.8",
26
+ "@object-ui/fields": "4.0.8",
27
+ "@object-ui/react": "4.0.8",
28
+ "@object-ui/types": "4.0.8"
28
29
  },
29
30
  "peerDependencies": {
30
31
  "react": "^18.0.0 || ^19.0.0",
@@ -36,7 +37,7 @@
36
37
  "@vitejs/plugin-react": "^6.0.1",
37
38
  "react-grid-layout": "^2.2.3",
38
39
  "typescript": "^6.0.3",
39
- "vite": "^8.0.10",
40
+ "vite": "^8.0.12",
40
41
  "vite-plugin-dts": "^5.0.0"
41
42
  },
42
43
  "keywords": [