yamchart 0.4.16 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YL6BW3HW.js → chunk-3I5PUINM.js} +2 -2
- package/dist/{chunk-YL6BW3HW.js.map → chunk-3I5PUINM.js.map} +1 -1
- package/dist/{chunk-2LNDAMKT.js → chunk-QMGKVN2X.js} +2 -2
- package/dist/{chunk-WHBVCIPG.js → chunk-XXQU2TZ2.js} +2 -2
- package/dist/{connection-utils-Y7AWIC5M.js → connection-utils-T7DZL6MI.js} +3 -3
- package/dist/{describe-ZAEVM3XT.js → describe-G3YXRE7X.js} +3 -3
- package/dist/{dev-XC47BMBS.js → dev-BUMIVTPN.js} +51 -26
- package/dist/dev-BUMIVTPN.js.map +1 -0
- package/dist/index.js +11 -11
- package/dist/public/assets/{LoginPage-OqFkz_X-.js → LoginPage-OByqHc4n.js} +1 -1
- package/dist/public/assets/PublicViewer-DUhQW5m5.js +1 -0
- package/dist/public/assets/{SetupWizard-tGgbMxMZ.js → SetupWizard-DG46QOHB.js} +1 -1
- package/dist/public/assets/{ShareManagement-T_AFVxIm.js → ShareManagement-DAsSD-YD.js} +1 -1
- package/dist/public/assets/{UserManagement-tXhwFzPz.js → UserManagement-DZfM0Ovz.js} +1 -1
- package/dist/public/assets/{index-CLYPNLML.css → index-Csxcdlds.css} +1 -1
- package/dist/public/assets/index-DDmMI9nF.js +164 -0
- package/dist/public/assets/{index.es-DOh98lYb.js → index.es-hreeCzNo.js} +1 -1
- package/dist/public/assets/{jspdf.es.min-C599hpR0.js → jspdf.es.min-C6Vul2EZ.js} +3 -3
- package/dist/public/index.html +2 -2
- package/dist/{query-3KIMOYUD.js → query-OEEQA6RQ.js} +3 -3
- package/dist/{sample-PR4P7ZXF.js → sample-UV4GM2D4.js} +3 -3
- package/dist/{search-E53W6CR5.js → search-AV6NW2KG.js} +3 -3
- package/dist/{tables-X2GY5AVA.js → tables-MPSCAUHL.js} +3 -3
- package/dist/{test-7R7EGFOI.js → test-HE5MDTTX.js} +3 -3
- package/package.json +2 -2
- package/dist/dev-XC47BMBS.js.map +0 -1
- package/dist/public/assets/PublicViewer-bqV4skXX.js +0 -1
- package/dist/public/assets/index-zwep09NU.js +0 -164
- /package/dist/{chunk-2LNDAMKT.js.map → chunk-QMGKVN2X.js.map} +0 -0
- /package/dist/{chunk-WHBVCIPG.js.map → chunk-XXQU2TZ2.js.map} +0 -0
- /package/dist/{connection-utils-Y7AWIC5M.js.map → connection-utils-T7DZL6MI.js.map} +0 -0
- /package/dist/{describe-ZAEVM3XT.js.map → describe-G3YXRE7X.js.map} +0 -0
- /package/dist/{query-3KIMOYUD.js.map → query-OEEQA6RQ.js.map} +0 -0
- /package/dist/{sample-PR4P7ZXF.js.map → sample-UV4GM2D4.js.map} +0 -0
- /package/dist/{search-E53W6CR5.js.map → search-AV6NW2KG.js.map} +0 -0
- /package/dist/{tables-X2GY5AVA.js.map → tables-MPSCAUHL.js.map} +0 -0
- /package/dist/{test-7R7EGFOI.js.map → test-HE5MDTTX.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,c as S,b as U,d as I,e as Y,f as q,g as H,F as z,S as G,D as K,C as X,T as Q,G as J,W as Z,h as ee,H as te,i as re,k as se,l as ae,P as ne,m as ie,B as le,L as ce,a as oe,n as de}from"./index-zwep09NU.js";import{a as f}from"./echarts-DtOYsfLX.js";function xe({title:s,description:n,loading:e=!1,error:l=null,cached:a,durationMs:i,hasDrillDown:D,onRefresh:r,children:h}){return t.jsxs("div",{className:"chart-container",children:[t.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-gray-100",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:s}),D&&t.jsxs("svg",{className:"w-4 h-4 text-gray-400 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[t.jsx("title",{children:"Right-click to drill down"}),t.jsx("path",{fillRule:"evenodd",d:"M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z",clipRule:"evenodd"})]})]}),n&&t.jsx("p",{className:"text-sm text-gray-500 mt-1",children:n})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[a!==void 0&&t.jsx("span",{className:S("text-xs px-2 py-1 rounded",a?"bg-green-100 text-green-700":"bg-blue-100 text-blue-700"),children:a?"Cached":"Fresh"}),i!==void 0&&t.jsxs("span",{className:"text-xs text-gray-400",children:[i,"ms"]}),r&&t.jsx("button",{onClick:r,disabled:e,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded transition-colors disabled:opacity-50",title:"Refresh",children:t.jsx("svg",{className:S("w-4 h-4",e&&"animate-spin"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]})]}),t.jsx("div",{className:"p-4",children:l?t.jsx("div",{className:"flex items-center justify-center h-64 text-red-500",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"font-medium",children:"Failed to load chart"}),t.jsx("p",{className:"text-sm mt-1",children:l.message})]})}):h})]})}const he={day:{label:"Date",format:"%b %d, %Y"},week:{label:"Week Starting",format:"%b %d"},month:{label:"Month",format:"%b '%y"},quarter:{label:"Quarter",format:"quarter"},year:{label:"Year",format:"%Y"}};function me({chartName:s}){const[n,e]=f.useState(!1),l=async()=>{const a=`{{${s}}}`;try{await navigator.clipboard.writeText(a),e(!0),setTimeout(()=>e(!1),2e3)}catch(i){console.error("Failed to copy:",i)}};return t.jsx("button",{onClick:l,className:"text-sm text-gray-500 hover:text-gray-700 flex items-center gap-1.5 px-2 py-1 rounded hover:bg-gray-100 transition-colors",title:`Copy {{${s}}} for use in markdown widgets`,children:n?t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t.jsx("span",{className:"text-green-600",children:"Copied!"})]}):t.jsxs(t.Fragment,{children:[t.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),t.jsx("span",{children:"Copy Reference"})]})})}function M(s,n){if(!n)return s.toLocaleString();const e=n.decimals??0;switch(n.type){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:n.currency||"USD",minimumFractionDigits:e,maximumFractionDigits:e}).format(s);case"percent":return new Intl.NumberFormat("en-US",{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}).format(s/100);default:return s.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})}}function ue(s,n){const e=s>=0?"+":"";return n==="percent_change"?`${e}${s.toFixed(1)}%`:`${e}${s.toLocaleString()}`}function fe({data:s,config:n,title:e,comparison:l}){var p,b,w;if(!(s!=null&&s[0])||!((p=n.value)!=null&&p.field))return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-400",children:"No data available"});const a=s[0],i=a[n.value.field],D=M(i,n.format);let r=null,h="percent_change",C,k,g;if(l)r=l.change,h=l.changeType,C=l.currentPeriodLabel,k=l.previousPeriodLabel,g=M(l.previousValue,n.format);else if((b=n.comparison)!=null&&b.enabled&&n.comparison.field){const o=a[n.comparison.field];h=n.comparison.type,o&&o!==0&&(h==="percent_change"?r=(i-o)/o*100:r=i-o,g=M(o,n.format))}return t.jsxs("div",{className:"h-80 flex flex-col items-center justify-center p-8",children:[t.jsxs("div",{className:"text-6xl font-bold text-gray-900 tabular-nums",children:[D,n.unit&&t.jsx("span",{className:"text-3xl font-normal text-gray-400 ml-2",children:n.unit})]}),C&&t.jsx("div",{className:"text-sm text-gray-400 mt-2",children:C}),e&&t.jsx("div",{className:"text-lg text-gray-500 mt-3",children:e}),r!==null&&t.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:S("text-lg font-medium px-3 py-1 rounded",r>=0?"bg-green-100 text-green-700":"bg-red-100 text-red-700"),children:ue(r,h)}),g&&t.jsxs("span",{className:"text-sm text-gray-400",children:["vs ",g]}),!g&&((w=n.comparison)==null?void 0:w.label)&&t.jsx("span",{className:"text-sm text-gray-400",children:n.comparison.label})]}),k&&t.jsx("div",{className:"text-xs text-gray-400",children:k})]})]})}function ge({chartName:s,drillParams:n}){var V,$,B,R;const{data:e,isLoading:l}=U(s),{data:a,isLoading:i,error:D}=I(s),{data:r}=Y(),h=q(),C=H(c=>c.getEffectiveFilters),k=H(c=>c.setChartFilter),g=l||i,p=n==null?void 0:n._from,b=n?Object.fromEntries(Object.entries(n).filter(([c])=>!c.startsWith("_"))):{},w=Object.keys(b).length>0,o=Object.entries(b).map(([c,x])=>`${c}: ${x}`).join(", ");f.useEffect(()=>{if(w)for(const[c,x]of Object.entries(b))k(s,c,x)},[s,w]);const[y,A]=f.useState(null),N=f.useCallback((c,x,m)=>{var u;(u=e==null?void 0:e.drillDown)!=null&&u.chart&&A({x:m.x,y:m.y,field:c,value:x})},[(V=e==null?void 0:e.drillDown)==null?void 0:V.chart]),O=f.useCallback(()=>{var m,u;if(!y||!((m=e==null?void 0:e.drillDown)!=null&&m.chart))return;const c=e.drillDown.field??((u=e.chart.x)==null?void 0:u.field)??y.field,x=new URLSearchParams({[c]:y.value,_from:s});window.location.hash=`/charts/${e.drillDown.chart}?${x.toString()}`,A(null)},[y,e,s]),T=C(s).granularity,d=T?he[T]:void 0,F=d==null?void 0:d.label,L=d==null?void 0:d.format;if(l)return t.jsxs("div",{className:"chart-container animate-pulse",children:[t.jsx("div",{className:"p-4 border-b border-gray-100",children:t.jsx("div",{className:"h-6 bg-gray-200 rounded w-48"})}),t.jsx("div",{className:"p-4",children:t.jsx("div",{className:"h-80 bg-gray-100 rounded"})})]});if(!e)return t.jsxs("div",{className:"chart-container p-8 text-center text-gray-500",children:["Chart not found: ",s]});const P=()=>{var x,m,u,E,W,_;if(!a)return t.jsx("div",{className:"h-80 bg-gray-50 rounded animate-pulse"});const c=e.chart.type;switch(c){case"line":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(x=e.drillDown)!=null&&x.chart?N:void 0;return t.jsx(ce,{data:a.rows,columns:a.columns,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"bar":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(m=e.drillDown)!=null&&m.chart?N:void 0;return t.jsx(le,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"area":if(!e.chart.x||!e.chart.y&&!e.chart.series)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(u=e.drillDown)!=null&&u.chart?N:void 0;return t.jsx(ie,{data:a.rows,xAxis:j,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"pie":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing pie chart configuration"}):t.jsx(ne,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(E=e.drillDown)!=null&&E.chart?N:void 0});case"donut":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing donut chart configuration"}):t.jsx(ae,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,centerValue:e.chart.centerValue,theme:r==null?void 0:r.theme,loading:i,onDrillDown:(W=e.drillDown)!=null&&W.chart?N:void 0});case"scatter":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(se,{data:a.rows,xAxis:e.chart.x,yAxis:e.chart.y,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"combo":if(!e.chart.x)return t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"});{const j=d?{...e.chart.x,label:F,format:L}:e.chart.x,v=(_=e.drillDown)!=null&&_.chart?N:void 0;return t.jsx(re,{data:a.rows,xAxis:j,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i,onDrillDown:v})}case"kpi":return t.jsx(fe,{data:a.rows,config:e.chart,title:e.title,comparison:a.comparison});case"heatmap":return!e.chart.x||!e.chart.y?t.jsx("div",{className:"h-80 flex items-center justify-center text-gray-500",children:"Missing axis configuration"}):t.jsx(te,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"funnel":return t.jsx(ee,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"waterfall":return t.jsx(Z,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"gauge":return t.jsx(J,{data:a.rows,chartConfig:e.chart,theme:r==null?void 0:r.theme,loading:i});case"table":return t.jsx(Q,{data:a.rows,columns:a.columns,chartConfig:e.chart,height:"100%",loading:i});default:return t.jsxs("div",{className:"h-80 flex items-center justify-center text-gray-500",children:['Chart type "',c,'" not yet implemented']})}};return t.jsxs("div",{className:"space-y-4",children:[p&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[t.jsx("button",{onClick:()=>{window.location.hash=`/charts/${p}`},className:"hover:text-blue-600 transition-colors",children:p}),t.jsx("span",{children:"/"}),t.jsx("span",{className:"text-gray-700 font-medium",children:e.title}),o&&t.jsxs("span",{className:"text-gray-400",children:["(",o,")"]})]}),t.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.parameters.length>0?t.jsx(z,{parameters:e.parameters,chartName:s}):t.jsx("div",{}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(me,{chartName:s}),t.jsx(G,{resourceType:"chart",resourceName:s})]})]}),t.jsx(xe,{title:e.title,description:e.description,loading:g,error:D,cached:a==null?void 0:a.meta.cached,durationMs:a==null?void 0:a.meta.durationMs,hasDrillDown:!!(($=e.drillDown)!=null&&$.chart),onRefresh:()=>h(s),children:P()}),w&&a&&t.jsx(K,{data:a.rows,columns:a.columns,drillDownColumns:(B=e.drillDown)==null?void 0:B.columns,filterDisplay:o,chartName:s}),y&&((R=e.drillDown)==null?void 0:R.chart)&&t.jsx(X,{x:y.x,y:y.y,targetChartTitle:e.drillDown.chart,onDrillDown:O,onClose:()=>A(null)})]})}function pe({parsed:s}){const n=s.params.token,[e,l]=f.useState(null),[a,i]=f.useState(!1);return f.useEffect(()=>{if(!n){l("No share token provided");return}oe.getPublicConfig(n).then(()=>i(!0)).catch(()=>l("This link has expired or been revoked"))},[n]),e?t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-center",children:t.jsx("div",{className:"text-gray-400 text-lg",children:e})})}):a?t.jsxs("div",{className:"min-h-screen bg-gray-50",children:[t.jsx("div",{className:"max-w-7xl mx-auto py-6 px-4",children:s.type==="public_chart"?t.jsx(ge,{chartName:s.name}):t.jsx(de,{dashboardId:s.name,initialTab:s.params.tab})}),t.jsx("div",{className:"text-center py-4 text-xs text-gray-400",children:"Shared via yamchart"})]}):t.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:t.jsx("div",{className:"text-gray-500",children:"Loading..."})})}export{pe as PublicViewer};
|